Skip to content

Commit 2621fc6

Browse files
committed
adding dist files
1 parent 2d8cf99 commit 2621fc6

308 files changed

Lines changed: 11683 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export type BannerSeverity = 'note' | 'warning' | 'error';
2+
export declare const Severity: import("styled-components").StyledComponent<"span", any, {}, never>;
3+
export declare const StyledBanner: import("styled-components").StyledComponent<"div", any, {
4+
severity: BannerSeverity;
5+
}, never>;
6+
export declare const CloseButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<(import("../Button").ButtonProps | import("../Button").WaitingButtonProps) & import("react").RefAttributes<HTMLButtonElement>>, any, {
7+
severity: BannerSeverity;
8+
}, never>;
9+
export declare const Banner: (props: {
10+
messages: string[];
11+
severity: BannerSeverity;
12+
onDismiss?: () => void;
13+
}) => import("react/jsx-runtime").JSX.Element;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.Banner = exports.CloseButton = exports.StyledBanner = exports.Severity = void 0;
7+
const jsx_runtime_1 = require("react/jsx-runtime");
8+
const DismissIcon_1 = require("../svgs/DismissIcon");
9+
const Html_1 = require("../Html");
10+
const styled_components_1 = __importDefault(require("styled-components"));
11+
const Button_1 = require("../Button");
12+
const theme_1 = require("../../theme");
13+
exports.Severity = styled_components_1.default.span `
14+
font-weight: bold;
15+
text-transform: uppercase;
16+
`;
17+
exports.StyledBanner = styled_components_1.default.div `
18+
position: relative;
19+
background: ${({ severity }) => severity === 'error' ? '#F8E8EA' : '#fff5e0'};
20+
color: ${({ severity }) => severity === 'error' ? theme_1.colors.palette.darkRed : '#976502'};
21+
border: ${({ severity }) => severity === 'error' ? `1px solid ${theme_1.colors.palette.lightRed}` : '1px solid #fdbd3e'};
22+
padding: .6rem 1.6rem;
23+
margin: 0 0 1.6rem 0;
24+
line-height: 2rem;
25+
display: flex;
26+
align-items: center;
27+
28+
a {
29+
text-decoration: none;
30+
color: ${theme_1.colors.palette.mediumBlue};
31+
32+
&:hover {
33+
text-decoration: underline;
34+
color: ${theme_1.colors.link.hover}
35+
}
36+
}
37+
38+
.button-link {
39+
font-size: 1.6rem;
40+
}
41+
`;
42+
exports.CloseButton = (0, styled_components_1.default)(Button_1.Button) `
43+
color: ${({ severity }) => severity === 'error' ? theme_1.colors.palette.darkRed : '#976502'};
44+
overflow: visible;
45+
background: none;
46+
border: none;
47+
padding: 0;
48+
font: inherit;
49+
cursor: pointer;
50+
outline: inherit;
51+
box-shadow: none;
52+
margin-left: 2.4rem;
53+
54+
&:not([disabled]):hover,
55+
&:not([disabled]):active {
56+
background: none;
57+
}
58+
`;
59+
const Banner = (props) => {
60+
const numWarnings = props.messages.length;
61+
return (0, jsx_runtime_1.jsxs)(exports.StyledBanner, { severity: props.severity, children: [(0, jsx_runtime_1.jsxs)("div", { children: [props.severity !== 'error' ? (0, jsx_runtime_1.jsx)(exports.Severity, { children: props.severity === 'note' ? 'Note: ' : 'Warning: ' }) : null, props.messages.map((message, i) => (0, jsx_runtime_1.jsx)(Html_1.Html, { block: numWarnings > 1, children: numWarnings > 1 ? `[${i + 1} of ${numWarnings}]: ${message}` : message }, i))] }), props.onDismiss
62+
? (0, jsx_runtime_1.jsx)(exports.CloseButton, { severity: props.severity, onClick: props.onDismiss, "aria-label": 'dismiss', children: (0, jsx_runtime_1.jsx)(DismissIcon_1.DismissIcon, { "aria-hidden": 'true', focusable: 'false' }) })
63+
: null] });
64+
};
65+
exports.Banner = Banner;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react';
2+
export type BodyPortalProps = React.PropsWithChildren<{
3+
className?: string;
4+
role?: string;
5+
slot?: string;
6+
tagName?: string;
7+
id?: string;
8+
'data-testid'?: string;
9+
ariaLabel?: string;
10+
}>;
11+
export declare const BodyPortal: React.ForwardRefExoticComponent<{
12+
className?: string;
13+
role?: string;
14+
slot?: string;
15+
tagName?: string;
16+
id?: string;
17+
'data-testid'?: string;
18+
ariaLabel?: string;
19+
} & {
20+
children?: React.ReactNode | undefined;
21+
} & React.RefAttributes<HTMLElement>>;

dist/cjs/components/BodyPortal.js

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.BodyPortal = void 0;
7+
const react_1 = __importDefault(require("react"));
8+
const react_dom_1 = require("react-dom");
9+
const BodyPortalSlotsContext_1 = require("./BodyPortalSlotsContext");
10+
const getInsertBeforeTarget = (bodyPortalSlots, slot) => {
11+
// Note: If the slot is not found in bodyPortalSlots, this code will append the tag instead,
12+
// meaning the ordering will then depend on the rendering order and may change
13+
const slotIndex = bodyPortalSlots.findIndex((sl) => sl === slot);
14+
if (slotIndex === -1) {
15+
return null;
16+
}
17+
// Find the next slot that is present in the DOM and return it
18+
for (let index = slotIndex + 1; index < bodyPortalSlots.length; index++) {
19+
const sl = bodyPortalSlots[index];
20+
const tag = sl === 'root'
21+
? document.body.querySelector('#root')
22+
: document.body.querySelector(`[data-portal-slot="${sl}"]`);
23+
if (tag) {
24+
return tag;
25+
}
26+
}
27+
// None of the slots after this one are present in the DOM, so just append it instead
28+
return null;
29+
};
30+
exports.BodyPortal = react_1.default.forwardRef(({ children, className, role, slot, tagName, id, ariaLabel, ...props }, ref) => {
31+
var _a;
32+
const tag = (_a = tagName === null || tagName === void 0 ? void 0 : tagName.toUpperCase()) !== null && _a !== void 0 ? _a : 'DIV';
33+
const internalRef = react_1.default.useRef(typeof document !== 'undefined' ? document.createElement(tag) : null);
34+
if (typeof document !== 'undefined' && (!internalRef.current || internalRef.current.tagName !== tag)) {
35+
internalRef.current = document.createElement(tag);
36+
}
37+
if (ref && internalRef.current) {
38+
if (typeof ref === 'function') {
39+
ref(internalRef.current);
40+
}
41+
else {
42+
ref.current = internalRef.current;
43+
}
44+
}
45+
const bodyPortalOrderedRefs = react_1.default.useContext(BodyPortalSlotsContext_1.BodyPortalSlotsContext);
46+
const testId = props['data-testid'];
47+
react_1.default.useLayoutEffect(() => {
48+
const element = internalRef.current;
49+
if (!element) {
50+
return;
51+
}
52+
if (className) {
53+
element.classList.add(...className.split(' '));
54+
}
55+
if (id) {
56+
element.id = id;
57+
}
58+
if (testId) {
59+
element.dataset.testid = testId;
60+
}
61+
if (role) {
62+
element.setAttribute('role', role);
63+
}
64+
if (slot) {
65+
element.dataset.portalSlot = slot;
66+
}
67+
if (ariaLabel)
68+
element.setAttribute('aria-label', ariaLabel);
69+
document.body.insertBefore(element, getInsertBeforeTarget(bodyPortalOrderedRefs, slot));
70+
return () => {
71+
if (element.parentNode) {
72+
element.parentNode.removeChild(element);
73+
}
74+
if (slot) {
75+
delete element.dataset.portalSlot;
76+
}
77+
if (role) {
78+
element.removeAttribute('role');
79+
}
80+
if (ariaLabel) {
81+
element.removeAttribute('aria-label');
82+
}
83+
if (className) {
84+
element.classList.remove(...className.split(' '));
85+
}
86+
if (id) {
87+
element.id = '';
88+
}
89+
if (testId) {
90+
delete element.dataset.testid;
91+
}
92+
};
93+
}, [bodyPortalOrderedRefs, className, id, role, slot, ariaLabel, tag, testId]);
94+
if (!internalRef.current) {
95+
return null;
96+
}
97+
return (0, react_dom_1.createPortal)(children, internalRef.current);
98+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import React from 'react';
2+
export declare const BodyPortalSlotsContext: React.Context<string[]>;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use strict";
2+
var __importDefault = (this && this.__importDefault) || function (mod) {
3+
return (mod && mod.__esModule) ? mod : { "default": mod };
4+
};
5+
Object.defineProperty(exports, "__esModule", { value: true });
6+
exports.BodyPortalSlotsContext = void 0;
7+
const react_1 = __importDefault(require("react"));
8+
exports.BodyPortalSlotsContext = react_1.default.createContext(['root']);

dist/cjs/components/Button.css

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/* Base button styles */
2+
.button-base {
3+
font-size: 1.6rem;
4+
line-height: 2rem;
5+
-moz-osx-font-smoothing: grayscale;
6+
-webkit-font-smoothing: antialiased;
7+
display: inline-flex;
8+
flex-direction: row;
9+
justify-content: center;
10+
align-items: center;
11+
height: 4rem;
12+
padding: 0 3rem;
13+
border: 0;
14+
border-radius: 0.5rem;
15+
box-shadow: 0px 0.2rem 0.4rem rgba(0, 0, 0, 0.2);
16+
transition: all 0.2s ease-in-out;
17+
text-decoration: none;
18+
user-select: none;
19+
white-space: nowrap;
20+
21+
/* Variant-specific styles using CSS custom properties with fallback defaults (primary variant) */
22+
background-color: var(--button-bg, #d4450c);
23+
color: var(--button-color, #ffffff);
24+
font-weight: var(--button-font-weight, 700);
25+
}
26+
27+
.button-base:not([disabled]) {
28+
cursor: pointer;
29+
}
30+
31+
.button-base:disabled {
32+
opacity: 0.4;
33+
}
34+
35+
.button-base + .button-base {
36+
margin-left: 1.6rem;
37+
}
38+
39+
.button-base:not([disabled]):hover {
40+
background: var(--button-bg-hover, #be3c08);
41+
}
42+
43+
.button-base:not([disabled]):active {
44+
background: var(--button-bg-active, #b03808);
45+
}
46+
47+
.button-base:focus {
48+
outline: solid var(--button-outline, #ffffff);
49+
box-shadow: inset 0 0 0 0.3rem var(--button-shadow, #424242);
50+
}
51+
52+
/* Plain button - minimal styling */
53+
.plain-button {
54+
cursor: pointer;
55+
border: none;
56+
margin: 0;
57+
padding: 0;
58+
background: none;
59+
}
60+
61+
/* Button that looks like a link */
62+
.button-link {
63+
cursor: pointer;
64+
border: none;
65+
margin: 0;
66+
padding: 0;
67+
background: none;
68+
color: var(--link-color, #026AA1);
69+
text-decoration: none;
70+
}
71+
72+
.button-link:hover,
73+
.button-link:focus {
74+
text-decoration: underline;
75+
color: var(--link-hover-color, #005481);
76+
}

dist/cjs/components/Button.d.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import { ButtonVariant } from "../theme/buttons";
3+
import './Button.css';
4+
export { applyButtonVariantStyles } from "../theme/buttons";
5+
export declare const buttonCss = "button-base";
6+
/**
7+
* Link style CSS fragment for backwards compatibility.
8+
*
9+
* @deprecated This export is deprecated. Use the ButtonLink component instead.
10+
* @note Breaking change: Previously returned a styled-components css fragment,
11+
* now returns a plain CSS string. This is part of the migration away from styled-components.
12+
* The string can still be used in styled-components template literals.
13+
*/
14+
export declare const linkStyle: string;
15+
interface ButtonOptions {
16+
variant?: ButtonVariant;
17+
}
18+
type ButtonBase = React.ComponentPropsWithoutRef<'button'> & ButtonOptions;
19+
export interface ButtonProps extends ButtonBase {
20+
isWaiting?: never;
21+
waitingText?: never;
22+
}
23+
export interface WaitingButtonProps extends ButtonBase {
24+
isWaiting: boolean;
25+
waitingText: string;
26+
}
27+
export declare const Button: React.ForwardRefExoticComponent<(ButtonProps | WaitingButtonProps) & React.RefAttributes<HTMLButtonElement>>;
28+
export declare const LinkButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & ButtonOptions & React.RefAttributes<HTMLAnchorElement>>;
29+
export declare const PlainButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
30+
export declare const ButtonLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;

0 commit comments

Comments
 (0)