@jiwambe/components 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +367 -0
- package/dist/client.d.ts +40 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +46 -0
- package/dist/client.js.map +1 -0
- package/dist/components/Accordion/Accordion.d.ts +74 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +297 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Box/Box.d.ts +56 -0
- package/dist/components/Box/Box.d.ts.map +1 -0
- package/dist/components/Box/Box.js +51 -0
- package/dist/components/Box/Box.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +66 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Button/Button.d.ts +54 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +92 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Card/Card.d.ts +54 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +98 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +61 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js +205 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/dist/components/Container/Container.d.ts +72 -0
- package/dist/components/Container/Container.d.ts.map +1 -0
- package/dist/components/Container/Container.js +69 -0
- package/dist/components/Container/Container.js.map +1 -0
- package/dist/components/DateInput/DateInput.d.ts +61 -0
- package/dist/components/DateInput/DateInput.d.ts.map +1 -0
- package/dist/components/DateInput/DateInput.js +234 -0
- package/dist/components/DateInput/DateInput.js.map +1 -0
- package/dist/components/Divider/Divider.d.ts +44 -0
- package/dist/components/Divider/Divider.d.ts.map +1 -0
- package/dist/components/Divider/Divider.js +35 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +35 -0
- package/dist/components/Drawer/Drawer.d.ts.map +1 -0
- package/dist/components/Drawer/Drawer.js +37 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/FAQ/FAQ.d.ts +40 -0
- package/dist/components/FAQ/FAQ.d.ts.map +1 -0
- package/dist/components/FAQ/FAQ.js +161 -0
- package/dist/components/FAQ/FAQ.js.map +1 -0
- package/dist/components/Grid/Grid.d.ts +61 -0
- package/dist/components/Grid/Grid.d.ts.map +1 -0
- package/dist/components/Grid/Grid.js +95 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +21 -0
- package/dist/components/Icon/Icon.d.ts.map +1 -0
- package/dist/components/Icon/Icon.js +167 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Link/Link.d.ts +49 -0
- package/dist/components/Link/Link.d.ts.map +1 -0
- package/dist/components/Link/Link.js +70 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/List/List.d.ts +36 -0
- package/dist/components/List/List.d.ts.map +1 -0
- package/dist/components/List/List.js +42 -0
- package/dist/components/List/List.js.map +1 -0
- package/dist/components/List/index.d.ts +3 -0
- package/dist/components/List/index.d.ts.map +1 -0
- package/dist/components/Overlay/Overlay.d.ts +35 -0
- package/dist/components/Overlay/Overlay.d.ts.map +1 -0
- package/dist/components/Overlay/Overlay.js +51 -0
- package/dist/components/Overlay/Overlay.js.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +55 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.js +255 -0
- package/dist/components/PhoneInput/PhoneInput.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +46 -0
- package/dist/components/Popover/Popover.d.ts.map +1 -0
- package/dist/components/Popover/Popover.js +57 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/ProductImage/ProductImage.d.ts +78 -0
- package/dist/components/ProductImage/ProductImage.d.ts.map +1 -0
- package/dist/components/ProductImage/ProductImage.js +220 -0
- package/dist/components/ProductImage/ProductImage.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +63 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +233 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/Section/Section.d.ts +44 -0
- package/dist/components/Section/Section.d.ts.map +1 -0
- package/dist/components/Section/Section.js +48 -0
- package/dist/components/Section/Section.js.map +1 -0
- package/dist/components/Select/Select.d.ts +47 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/Select.js +153 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/SelectTab/SelectTab.d.ts +62 -0
- package/dist/components/SelectTab/SelectTab.d.ts.map +1 -0
- package/dist/components/SelectTab/SelectTab.js +192 -0
- package/dist/components/SelectTab/SelectTab.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +87 -0
- package/dist/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +97 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/Skeleton/index.d.ts.map +1 -0
- package/dist/components/Slider/Slider.d.ts +47 -0
- package/dist/components/Slider/Slider.d.ts.map +1 -0
- package/dist/components/Slider/Slider.js +147 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Stack/Stack.d.ts +145 -0
- package/dist/components/Stack/Stack.d.ts.map +1 -0
- package/dist/components/Stack/Stack.js +80 -0
- package/dist/components/Stack/Stack.js.map +1 -0
- package/dist/components/Tab/Tab.d.ts +38 -0
- package/dist/components/Tab/Tab.d.ts.map +1 -0
- package/dist/components/Tab/Tab.js +146 -0
- package/dist/components/Tab/Tab.js.map +1 -0
- package/dist/components/TextArea/TextArea.d.ts +32 -0
- package/dist/components/TextArea/TextArea.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.js +118 -0
- package/dist/components/TextArea/TextArea.js.map +1 -0
- package/dist/components/TextInput/TextInput.d.ts +35 -0
- package/dist/components/TextInput/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput/TextInput.js +128 -0
- package/dist/components/TextInput/TextInput.js.map +1 -0
- package/dist/components/Toggle/Toggle.d.ts +83 -0
- package/dist/components/Toggle/Toggle.d.ts.map +1 -0
- package/dist/components/Toggle/Toggle.js +121 -0
- package/dist/components/Toggle/Toggle.js.map +1 -0
- package/dist/components/Typography/Typography.d.ts +321 -0
- package/dist/components/Typography/Typography.d.ts.map +1 -0
- package/dist/components/Typography/Typography.js +21 -0
- package/dist/components/Typography/Typography.js.map +1 -0
- package/dist/components/UploadInput/UploadInput.d.ts +39 -0
- package/dist/components/UploadInput/UploadInput.d.ts.map +1 -0
- package/dist/components/UploadInput/UploadInput.js +297 -0
- package/dist/components/UploadInput/UploadInput.js.map +1 -0
- package/dist/components/index.d.ts +65 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/jiwambe-plugin.d.ts +37 -0
- package/dist/plugin/jiwambe-plugin.d.ts.map +1 -0
- package/dist/plugin/jiwambe-plugin.js +640 -0
- package/dist/plugin/jiwambe-plugin.js.map +1 -0
- package/dist/server.d.ts +22 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +23 -0
- package/dist/server.js.map +1 -0
- package/dist/types/index.d.ts +103 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/layout.d.ts +138 -0
- package/dist/types/layout.d.ts.map +1 -0
- package/dist/types/list.d.ts +69 -0
- package/dist/types/list.d.ts.map +1 -0
- package/dist/types/list.js +9 -0
- package/dist/types/list.js.map +1 -0
- package/dist/types/skeleton.d.ts +38 -0
- package/dist/types/skeleton.d.ts.map +1 -0
- package/dist/types/skeleton.js +13 -0
- package/dist/types/skeleton.js.map +1 -0
- package/dist/types/spacing.d.ts +105 -0
- package/dist/types/spacing.d.ts.map +1 -0
- package/dist/utils/layoutClasses.d.ts +44 -0
- package/dist/utils/layoutClasses.d.ts.map +1 -0
- package/dist/utils/layoutClasses.js +88 -0
- package/dist/utils/layoutClasses.js.map +1 -0
- package/dist/utils/responsive-props.d.ts +60 -0
- package/dist/utils/responsive-props.d.ts.map +1 -0
- package/dist/utils/responsive-props.js +184 -0
- package/dist/utils/responsive-props.js.map +1 -0
- package/dist/utils/spacing.d.ts +52 -0
- package/dist/utils/spacing.d.ts.map +1 -0
- package/dist/utils/spacing.js +625 -0
- package/dist/utils/spacing.js.map +1 -0
- package/package.json +96 -0
- package/tailwind.preset.d.ts +3 -0
- package/tailwind.preset.ts +21 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SpacingProps } from '../../types/spacing';
|
|
3
|
+
import { LayoutProps } from '../../types/layout';
|
|
4
|
+
/**
|
|
5
|
+
* Preset max-width keys for Container. Maps to rem values in the design system.
|
|
6
|
+
* false = no max-width constraint.
|
|
7
|
+
*/
|
|
8
|
+
export type ContainerMaxWidth = 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
9
|
+
/**
|
|
10
|
+
* Props for the Container component. Extends div attributes, SpacingProps,
|
|
11
|
+
* and a subset of LayoutProps (alignItems, justifyContent only).
|
|
12
|
+
*
|
|
13
|
+
* Effective horizontal padding: when disableGutters is true, no padding is
|
|
14
|
+
* applied regardless of px. When disableGutters is false, the px prop
|
|
15
|
+
* (from SpacingProps) is used, defaulting to 'fluid-4-9'.
|
|
16
|
+
*/
|
|
17
|
+
export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement>, SpacingProps, Pick<LayoutProps, 'alignItems' | 'justifyContent'> {
|
|
18
|
+
/** Content to render inside the container. */
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Maximum width of the container content area.
|
|
22
|
+
*
|
|
23
|
+
* Preset values:
|
|
24
|
+
* - 'sm' 600px (37.5rem)
|
|
25
|
+
* - 'md' 800px (50rem)
|
|
26
|
+
* - 'lg' 940px (58.75rem)
|
|
27
|
+
* - 'xl' 1328px (83rem) — default
|
|
28
|
+
* - false No max-width constraint
|
|
29
|
+
*
|
|
30
|
+
* Also accepts any valid CSS width string (e.g. '75ch', '1200px').
|
|
31
|
+
* @default 'xl'
|
|
32
|
+
*/
|
|
33
|
+
maxWidth?: ContainerMaxWidth | string;
|
|
34
|
+
/**
|
|
35
|
+
* When true, suppresses horizontal padding entirely. Takes precedence
|
|
36
|
+
* over the px prop. The container still constrains width and centres itself.
|
|
37
|
+
* @default false
|
|
38
|
+
* @see px
|
|
39
|
+
*/
|
|
40
|
+
disableGutters?: boolean;
|
|
41
|
+
/** Forwarded ref for the root div. @default undefined */
|
|
42
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Page-width constraint wrapper. Renders a full-width div that is
|
|
46
|
+
* centred horizontally (mx-auto) with a maximum width and fluid
|
|
47
|
+
* horizontal gutters by default.
|
|
48
|
+
*
|
|
49
|
+
* Use Container as the outermost wrapper for every page section to
|
|
50
|
+
* ensure consistent content width and horizontal breathing room
|
|
51
|
+
* across viewport sizes. Do not nest Containers — use Box for
|
|
52
|
+
* inner layout needs.
|
|
53
|
+
*
|
|
54
|
+
* Default gutters use the fluid-4-9 token, which scales from 1rem
|
|
55
|
+
* at 360px viewport to 2.25rem at 1240px viewport.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Default — fluid gutters, xl max-width
|
|
59
|
+
* <Container>
|
|
60
|
+
* <Stack spacing="space-8">...</Stack>
|
|
61
|
+
* </Container>
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* // Custom max-width and gutters
|
|
65
|
+
* <Container maxWidth="md" px="space-8">...</Container>
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* // No gutters — content touches the container edge
|
|
69
|
+
* <Container disableGutters>...</Container>
|
|
70
|
+
*/
|
|
71
|
+
export declare function Container({ children, className, style, maxWidth, disableGutters, px: pxProp, alignItems, justifyContent, ref, ...rest }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
72
|
+
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../src/components/Container/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAIlE;;;;;;;GAOG;AACH,MAAM,WAAW,cACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC1C,YAAY,EACZ,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,gBAAgB,CAAC;IACpD,8CAA8C;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACtC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,yDAAyD;IACzD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAc,EACd,KAAK,EACL,QAAe,EACf,cAAsB,EACtB,EAAE,EAAE,MAAM,EACV,UAAU,EACV,cAAc,EACd,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,2CAyChB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { resolveSpacing } from "../../utils/spacing.js";
|
|
3
|
+
import { resolveLayout } from "../../utils/layoutClasses.js";
|
|
4
|
+
const CONTAINER_LAYOUT_KEYS = ["alignItems", "justifyContent"];
|
|
5
|
+
const MAX_WIDTH_PRESETS = {
|
|
6
|
+
sm: "37.5rem",
|
|
7
|
+
md: "50rem",
|
|
8
|
+
lg: "58.75rem",
|
|
9
|
+
xl: "83rem"
|
|
10
|
+
};
|
|
11
|
+
const SPACING_KEYS = [
|
|
12
|
+
"p",
|
|
13
|
+
"px",
|
|
14
|
+
"py",
|
|
15
|
+
"pt",
|
|
16
|
+
"pb",
|
|
17
|
+
"pl",
|
|
18
|
+
"pr",
|
|
19
|
+
"m",
|
|
20
|
+
"mx",
|
|
21
|
+
"my",
|
|
22
|
+
"mt",
|
|
23
|
+
"mb",
|
|
24
|
+
"ml",
|
|
25
|
+
"mr"
|
|
26
|
+
];
|
|
27
|
+
function Container({
|
|
28
|
+
children,
|
|
29
|
+
className = "",
|
|
30
|
+
style,
|
|
31
|
+
maxWidth = "xl",
|
|
32
|
+
disableGutters = false,
|
|
33
|
+
px: pxProp,
|
|
34
|
+
alignItems,
|
|
35
|
+
justifyContent,
|
|
36
|
+
ref,
|
|
37
|
+
...rest
|
|
38
|
+
}) {
|
|
39
|
+
const resolvedMax = maxWidth === false ? void 0 : MAX_WIDTH_PRESETS[maxWidth] ?? maxWidth;
|
|
40
|
+
const effectivePx = disableGutters ? void 0 : pxProp ?? "fluid-4-9";
|
|
41
|
+
const spacingProps = { ...rest, px: effectivePx };
|
|
42
|
+
const spacingClasses = resolveSpacing(spacingProps);
|
|
43
|
+
const layoutClasses = resolveLayout({ alignItems, justifyContent });
|
|
44
|
+
const restWithoutSpacing = { ...rest };
|
|
45
|
+
for (const key of SPACING_KEYS) {
|
|
46
|
+
delete restWithoutSpacing[key];
|
|
47
|
+
}
|
|
48
|
+
for (const key of CONTAINER_LAYOUT_KEYS) {
|
|
49
|
+
delete restWithoutSpacing[key];
|
|
50
|
+
}
|
|
51
|
+
const classes = [
|
|
52
|
+
"w-full",
|
|
53
|
+
resolvedMax && "mx-auto",
|
|
54
|
+
layoutClasses,
|
|
55
|
+
spacingClasses,
|
|
56
|
+
className
|
|
57
|
+
].filter(Boolean).join(" ");
|
|
58
|
+
const inlineStyle = {
|
|
59
|
+
...style
|
|
60
|
+
};
|
|
61
|
+
if (resolvedMax) {
|
|
62
|
+
inlineStyle.maxWidth = resolvedMax;
|
|
63
|
+
}
|
|
64
|
+
return /* @__PURE__ */ jsx("div", { ref, className: classes, style: inlineStyle, ...restWithoutSpacing, children });
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
Container
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=Container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.js","sources":["../../../src/components/Container/Container.tsx"],"sourcesContent":["import React from 'react';\nimport type { SpacingProps } from '../../types/spacing';\nimport type { LayoutProps } from '../../types/layout';\nimport { resolveSpacing } from '../../utils/spacing';\nimport { resolveLayout } from '../../utils/layoutClasses';\n\n/**\n * Preset max-width keys for Container. Maps to rem values in the design system.\n * false = no max-width constraint.\n */\nexport type ContainerMaxWidth = 'sm' | 'md' | 'lg' | 'xl' | false;\n\nconst CONTAINER_LAYOUT_KEYS = ['alignItems', 'justifyContent'] as const;\n\n/**\n * Props for the Container component. Extends div attributes, SpacingProps,\n * and a subset of LayoutProps (alignItems, justifyContent only).\n *\n * Effective horizontal padding: when disableGutters is true, no padding is\n * applied regardless of px. When disableGutters is false, the px prop\n * (from SpacingProps) is used, defaulting to 'fluid-4-9'.\n */\nexport interface ContainerProps\n extends React.HTMLAttributes<HTMLDivElement>,\n SpacingProps,\n Pick<LayoutProps, 'alignItems' | 'justifyContent'> {\n /** Content to render inside the container. */\n children: React.ReactNode;\n /**\n * Maximum width of the container content area.\n *\n * Preset values:\n * - 'sm' 600px (37.5rem)\n * - 'md' 800px (50rem)\n * - 'lg' 940px (58.75rem)\n * - 'xl' 1328px (83rem) — default\n * - false No max-width constraint\n *\n * Also accepts any valid CSS width string (e.g. '75ch', '1200px').\n * @default 'xl'\n */\n maxWidth?: ContainerMaxWidth | string;\n /**\n * When true, suppresses horizontal padding entirely. Takes precedence\n * over the px prop. The container still constrains width and centres itself.\n * @default false\n * @see px\n */\n disableGutters?: boolean;\n /** Forwarded ref for the root div. @default undefined */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nconst MAX_WIDTH_PRESETS: Record<string, string> = {\n sm: '37.5rem',\n md: '50rem',\n lg: '58.75rem',\n xl: '83rem',\n};\n\nconst SPACING_KEYS = [\n 'p', 'px', 'py', 'pt', 'pb', 'pl', 'pr', 'm', 'mx', 'my', 'mt', 'mb', 'ml', 'mr',\n] as const;\n\n/**\n * Page-width constraint wrapper. Renders a full-width div that is\n * centred horizontally (mx-auto) with a maximum width and fluid\n * horizontal gutters by default.\n *\n * Use Container as the outermost wrapper for every page section to\n * ensure consistent content width and horizontal breathing room\n * across viewport sizes. Do not nest Containers — use Box for\n * inner layout needs.\n *\n * Default gutters use the fluid-4-9 token, which scales from 1rem\n * at 360px viewport to 2.25rem at 1240px viewport.\n *\n * @example\n * // Default — fluid gutters, xl max-width\n * <Container>\n * <Stack spacing=\"space-8\">...</Stack>\n * </Container>\n *\n * @example\n * // Custom max-width and gutters\n * <Container maxWidth=\"md\" px=\"space-8\">...</Container>\n *\n * @example\n * // No gutters — content touches the container edge\n * <Container disableGutters>...</Container>\n */\nexport function Container({\n children,\n className = '',\n style,\n maxWidth = 'xl',\n disableGutters = false,\n px: pxProp,\n alignItems,\n justifyContent,\n ref,\n ...rest\n}: ContainerProps) {\n const resolvedMax =\n maxWidth === false\n ? undefined\n : MAX_WIDTH_PRESETS[maxWidth as string] ?? maxWidth;\n\n const effectivePx = disableGutters ? undefined : (pxProp ?? 'fluid-4-9');\n const spacingProps: SpacingProps = { ...rest, px: effectivePx };\n const spacingClasses = resolveSpacing(spacingProps);\n const layoutClasses = resolveLayout({ alignItems, justifyContent });\n\n const restWithoutSpacing = { ...rest };\n for (const key of SPACING_KEYS) {\n delete (restWithoutSpacing as Record<string, unknown>)[key];\n }\n for (const key of CONTAINER_LAYOUT_KEYS) {\n delete (restWithoutSpacing as Record<string, unknown>)[key];\n }\n\n const classes = [\n 'w-full',\n resolvedMax && 'mx-auto',\n layoutClasses,\n spacingClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const inlineStyle: React.CSSProperties = {\n ...style,\n };\n if (resolvedMax) {\n inlineStyle.maxWidth = resolvedMax;\n }\n\n return (\n <div ref={ref} className={classes} style={inlineStyle} {...restWithoutSpacing}>\n {children}\n </div>\n );\n}\n"],"names":[],"mappings":";;;AAYA,MAAM,wBAAwB,CAAC,cAAc,gBAAgB;AAyC7D,MAAM,oBAA4C;AAAA,EAChD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAAe;AAAA,EACnB;AAAA,EAAK;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAK;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAAA,EAAM;AAC9E;AA6BO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,IAAI;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,QAAM,cACJ,aAAa,QACT,SACA,kBAAkB,QAAkB,KAAK;AAE/C,QAAM,cAAc,iBAAiB,SAAa,UAAU;AAC5D,QAAM,eAA6B,EAAE,GAAG,MAAM,IAAI,YAAA;AAClD,QAAM,iBAAiB,eAAe,YAAY;AAClD,QAAM,gBAAgB,cAAc,EAAE,YAAY,gBAAgB;AAElE,QAAM,qBAAqB,EAAE,GAAG,KAAA;AAChC,aAAW,OAAO,cAAc;AAC9B,WAAQ,mBAA+C,GAAG;AAAA,EAC5D;AACA,aAAW,OAAO,uBAAuB;AACvC,WAAQ,mBAA+C,GAAG;AAAA,EAC5D;AAEA,QAAM,UAAU;AAAA,IACd;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,QAAM,cAAmC;AAAA,IACvC,GAAG;AAAA,EAAA;AAEL,MAAI,aAAa;AACf,gBAAY,WAAW;AAAA,EACzB;AAEA,SACE,oBAAC,SAAI,KAAU,WAAW,SAAS,OAAO,aAAc,GAAG,oBACxD,SAAA,CACH;AAEJ;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Date value as three string segments (DD, MM, YY). Day and month are zero-padded (e.g. "01");
|
|
4
|
+
* year is two digits. Empty strings mean "no selection".
|
|
5
|
+
*/
|
|
6
|
+
export interface DateValue {
|
|
7
|
+
day: string;
|
|
8
|
+
month: string;
|
|
9
|
+
year: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Props for the DateInput component. Supports controlled (value/onChange) or uncontrolled
|
|
13
|
+
* (defaultValue) usage. Format is segment-based (day, month, year); locale or display
|
|
14
|
+
* formatting is not applied — use your own formatting for display or submission.
|
|
15
|
+
*/
|
|
16
|
+
export interface DateInputProps {
|
|
17
|
+
/** Label text displayed above the date selects. @default undefined */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Secondary label shown lighter beside the main label. @default undefined */
|
|
20
|
+
secondaryLabel?: string;
|
|
21
|
+
/** Supportive text rendered below the label. @default undefined */
|
|
22
|
+
supportText?: string;
|
|
23
|
+
/** Controlled date value. Use with onChange. @default undefined */
|
|
24
|
+
value?: DateValue;
|
|
25
|
+
/** Uncontrolled default date value. @default undefined */
|
|
26
|
+
defaultValue?: DateValue;
|
|
27
|
+
/** Called when any segment (day, month, year) changes. @default undefined */
|
|
28
|
+
onChange?: (date: DateValue) => void;
|
|
29
|
+
/** Disables all three selects. @default false */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Places the component in an error state (borders and optional errorMessage). @default false */
|
|
32
|
+
error?: boolean;
|
|
33
|
+
/** Error message shown in the alert below the selects when error is true. @default undefined */
|
|
34
|
+
errorMessage?: string;
|
|
35
|
+
/** Shows an asterisk next to the label. @default undefined */
|
|
36
|
+
required?: boolean;
|
|
37
|
+
/** Additional class names on the outer wrapper. @default undefined */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** HTML id for the first select; day/month/year inputs get derived ids. @default undefined */
|
|
40
|
+
id?: string;
|
|
41
|
+
/** Base year for the year dropdown. Pass explicitly to avoid hydration mismatches near year boundaries. @default current year */
|
|
42
|
+
baseYear?: number;
|
|
43
|
+
/** Number of years shown in the year dropdown (counting back from baseYear). @default 10 */
|
|
44
|
+
yearRange?: number;
|
|
45
|
+
/** Forwarded ref for the root div. @default undefined */
|
|
46
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Three-segment date input (day, month, year) using native selects. Renders DD, MM, YY
|
|
50
|
+
* dropdowns with design-token styling. Use for birth dates or simple date capture where
|
|
51
|
+
* a single native date picker is not desired. Values are strings; convert to Date or
|
|
52
|
+
* ISO string in your app as needed.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* <DateInput label="Date of birth" value={date} onChange={setDate} />
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* <DateInput label="Start date" defaultValue={{ day: '', month: '', year: '' }} baseYear={2024} yearRange={5} />
|
|
59
|
+
*/
|
|
60
|
+
export declare function DateInput({ label, secondaryLabel, supportText, value: valueProp, defaultValue, onChange, disabled, error, errorMessage, required, className, id: idProp, baseYear, yearRange, ref, }: DateInputProps): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
//# sourceMappingURL=DateInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/components/DateInput/DateInput.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAMlD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0DAA0D;IAC1D,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,iDAAiD;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iGAAiG;IACjG,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gGAAgG;IAChG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8FAA8F;IAC9F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iIAAiI;IACjI,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AA6ID;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,cAAc,EACd,WAAW,EACX,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,QAAQ,EACR,QAAgB,EAChB,KAAa,EACb,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,EAAE,EAAE,MAAM,EACV,QAAQ,EACR,SAAc,EACd,GAAG,GACJ,EAAE,cAAc,2CAkHhB"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import React, { useId, useCallback } from "react";
|
|
4
|
+
function ChevronDown({ className }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
className,
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: "1.25",
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
children: /* @__PURE__ */ jsx("path", { d: "M6 9L12 15L18 9" })
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function ErrorIcon({ className }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"svg",
|
|
23
|
+
{
|
|
24
|
+
className,
|
|
25
|
+
viewBox: "0 0 20 20",
|
|
26
|
+
fill: "currentColor",
|
|
27
|
+
"aria-hidden": "true",
|
|
28
|
+
children: /* @__PURE__ */ jsx(
|
|
29
|
+
"path",
|
|
30
|
+
{
|
|
31
|
+
fillRule: "evenodd",
|
|
32
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",
|
|
33
|
+
clipRule: "evenodd"
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
const DAYS = Array.from(
|
|
40
|
+
{ length: 31 },
|
|
41
|
+
(_, i) => String(i + 1).padStart(2, "0")
|
|
42
|
+
);
|
|
43
|
+
const MONTHS = Array.from(
|
|
44
|
+
{ length: 12 },
|
|
45
|
+
(_, i) => String(i + 1).padStart(2, "0")
|
|
46
|
+
);
|
|
47
|
+
function buildYearOptions(baseYear, range) {
|
|
48
|
+
return Array.from(
|
|
49
|
+
{ length: range },
|
|
50
|
+
(_, i) => String(baseYear - i).slice(-2)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function Segment({
|
|
54
|
+
id,
|
|
55
|
+
placeholder,
|
|
56
|
+
options,
|
|
57
|
+
value,
|
|
58
|
+
disabled,
|
|
59
|
+
error,
|
|
60
|
+
onChange,
|
|
61
|
+
wrapperClassName = ""
|
|
62
|
+
}) {
|
|
63
|
+
const hasValue = value !== "";
|
|
64
|
+
const classes = [
|
|
65
|
+
"w-full min-h-[48px] pl-space-4 pr-10 py-space-3 appearance-none",
|
|
66
|
+
"rounded-rad-md text-form-text outline-none",
|
|
67
|
+
"transition-all duration-150",
|
|
68
|
+
hasValue ? "text-text-primary" : "text-text-disabled",
|
|
69
|
+
!disabled && !error && "border-border-sm border-border-form-primary bg-fill-bg-primary",
|
|
70
|
+
!disabled && error && "border-border-sm border-border-err bg-fill-bg-primary",
|
|
71
|
+
!disabled && "hover:border-border-md hover:border-border-form-primary-hover",
|
|
72
|
+
!disabled && "focus:border-border-md focus:border-border-form-primary-active focus:text-text-primary",
|
|
73
|
+
!disabled && [
|
|
74
|
+
"focus-visible:border-border-sm focus-visible:border-border-form-primary-focus",
|
|
75
|
+
"focus-visible:ring-[1.5px] focus-visible:ring-border-focus focus-visible:ring-offset-[3px]"
|
|
76
|
+
].join(" "),
|
|
77
|
+
disabled && "border-border-sm border-border-form-primary-disabled bg-fill-form-primary-disabled text-text-disabled cursor-not-allowed"
|
|
78
|
+
].filter(Boolean).join(" ");
|
|
79
|
+
return /* @__PURE__ */ jsxs("div", { className: `date-segment relative flex-1 min-w-0 ${wrapperClassName}`, children: [
|
|
80
|
+
/* @__PURE__ */ jsxs(
|
|
81
|
+
"select",
|
|
82
|
+
{
|
|
83
|
+
id,
|
|
84
|
+
disabled,
|
|
85
|
+
value,
|
|
86
|
+
onChange: (e) => onChange(e.target.value),
|
|
87
|
+
className: classes,
|
|
88
|
+
"aria-invalid": error || void 0,
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx("option", { value: "", disabled: true, hidden: true, children: placeholder }),
|
|
91
|
+
options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(
|
|
96
|
+
"span",
|
|
97
|
+
{
|
|
98
|
+
className: `absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none flex items-center ${disabled ? "text-icon-primary-disabled" : "text-icon-primary"}`,
|
|
99
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-6 h-6" })
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] });
|
|
103
|
+
}
|
|
104
|
+
function DateInput({
|
|
105
|
+
label,
|
|
106
|
+
secondaryLabel,
|
|
107
|
+
supportText,
|
|
108
|
+
value: valueProp,
|
|
109
|
+
defaultValue,
|
|
110
|
+
onChange,
|
|
111
|
+
disabled = false,
|
|
112
|
+
error = false,
|
|
113
|
+
errorMessage,
|
|
114
|
+
required,
|
|
115
|
+
className,
|
|
116
|
+
id: idProp,
|
|
117
|
+
baseYear,
|
|
118
|
+
yearRange = 10,
|
|
119
|
+
ref
|
|
120
|
+
}) {
|
|
121
|
+
const autoId = useId();
|
|
122
|
+
const baseId = idProp ?? autoId;
|
|
123
|
+
const isControlled = valueProp !== void 0;
|
|
124
|
+
const [internal, setInternal] = React.useState(
|
|
125
|
+
defaultValue ?? { day: "", month: "", year: "" }
|
|
126
|
+
);
|
|
127
|
+
const current = isControlled ? valueProp : internal;
|
|
128
|
+
const update = useCallback(
|
|
129
|
+
(segment, val) => {
|
|
130
|
+
const next = { ...current, [segment]: val };
|
|
131
|
+
if (!isControlled) setInternal(next);
|
|
132
|
+
onChange == null ? void 0 : onChange(next);
|
|
133
|
+
},
|
|
134
|
+
[current, isControlled, onChange]
|
|
135
|
+
);
|
|
136
|
+
const showErrorAlert = error && errorMessage;
|
|
137
|
+
const resolvedBaseYear = baseYear ?? (/* @__PURE__ */ new Date()).getFullYear();
|
|
138
|
+
const YEARS = React.useMemo(() => buildYearOptions(resolvedBaseYear, yearRange), [resolvedBaseYear, yearRange]);
|
|
139
|
+
return /* @__PURE__ */ jsxs(
|
|
140
|
+
"div",
|
|
141
|
+
{
|
|
142
|
+
ref,
|
|
143
|
+
className: `flex flex-col gap-space-2 w-full ${className ?? ""}`,
|
|
144
|
+
children: [
|
|
145
|
+
(label || supportText) && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-space-1", children: [
|
|
146
|
+
label && /* @__PURE__ */ jsxs(
|
|
147
|
+
"label",
|
|
148
|
+
{
|
|
149
|
+
htmlFor: `${baseId}-day`,
|
|
150
|
+
className: `text-form-label ${disabled ? "text-text-disabled" : "text-text-primary"}`,
|
|
151
|
+
children: [
|
|
152
|
+
label,
|
|
153
|
+
secondaryLabel && /* @__PURE__ */ jsx("span", { className: "text-text-secondary font-normal ml-1", children: secondaryLabel }),
|
|
154
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-text-err ml-0.5", children: "*" })
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
supportText && /* @__PURE__ */ jsx(
|
|
159
|
+
"p",
|
|
160
|
+
{
|
|
161
|
+
className: `text-text-xs ${disabled ? "text-text-disabled" : "text-text-secondary"}`,
|
|
162
|
+
children: supportText
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-space-2", children: [
|
|
167
|
+
/* @__PURE__ */ jsx(
|
|
168
|
+
Segment,
|
|
169
|
+
{
|
|
170
|
+
id: `${baseId}-day`,
|
|
171
|
+
placeholder: "DD",
|
|
172
|
+
options: DAYS,
|
|
173
|
+
value: current.day,
|
|
174
|
+
disabled,
|
|
175
|
+
error,
|
|
176
|
+
onChange: (v) => update("day", v)
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ jsx(
|
|
180
|
+
Segment,
|
|
181
|
+
{
|
|
182
|
+
id: `${baseId}-month`,
|
|
183
|
+
placeholder: "MM",
|
|
184
|
+
options: MONTHS,
|
|
185
|
+
value: current.month,
|
|
186
|
+
disabled,
|
|
187
|
+
error,
|
|
188
|
+
onChange: (v) => update("month", v)
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ jsx(
|
|
192
|
+
Segment,
|
|
193
|
+
{
|
|
194
|
+
id: `${baseId}-year`,
|
|
195
|
+
placeholder: "YY",
|
|
196
|
+
options: YEARS,
|
|
197
|
+
value: current.year,
|
|
198
|
+
disabled,
|
|
199
|
+
error,
|
|
200
|
+
onChange: (v) => update("year", v)
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] }),
|
|
204
|
+
showErrorAlert && /* @__PURE__ */ jsxs(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
id: `${baseId}-error`,
|
|
208
|
+
role: "alert",
|
|
209
|
+
className: `flex items-start gap-space-4 p-space-4 rounded-rad-md ${disabled ? "bg-fill-bg-secondary" : "bg-fill-bg-err"}`,
|
|
210
|
+
children: [
|
|
211
|
+
/* @__PURE__ */ jsx(
|
|
212
|
+
ErrorIcon,
|
|
213
|
+
{
|
|
214
|
+
className: `w-5 h-5 shrink-0 ${disabled ? "text-icon-primary-disabled" : "text-icon-err"}`
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
/* @__PURE__ */ jsx(
|
|
218
|
+
"span",
|
|
219
|
+
{
|
|
220
|
+
className: `text-text-xs ${disabled ? "text-text-disabled" : "text-text-err"}`,
|
|
221
|
+
children: errorMessage
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
export {
|
|
232
|
+
DateInput
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=DateInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateInput.js","sources":["../../../src/components/DateInput/DateInput.tsx"],"sourcesContent":["'use client';\n\nimport React, { useId, useCallback } from 'react';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * Date value as three string segments (DD, MM, YY). Day and month are zero-padded (e.g. \"01\");\n * year is two digits. Empty strings mean \"no selection\".\n */\nexport interface DateValue {\n day: string;\n month: string;\n year: string;\n}\n\n/**\n * Props for the DateInput component. Supports controlled (value/onChange) or uncontrolled\n * (defaultValue) usage. Format is segment-based (day, month, year); locale or display\n * formatting is not applied — use your own formatting for display or submission.\n */\nexport interface DateInputProps {\n /** Label text displayed above the date selects. @default undefined */\n label?: string;\n /** Secondary label shown lighter beside the main label. @default undefined */\n secondaryLabel?: string;\n /** Supportive text rendered below the label. @default undefined */\n supportText?: string;\n /** Controlled date value. Use with onChange. @default undefined */\n value?: DateValue;\n /** Uncontrolled default date value. @default undefined */\n defaultValue?: DateValue;\n /** Called when any segment (day, month, year) changes. @default undefined */\n onChange?: (date: DateValue) => void;\n /** Disables all three selects. @default false */\n disabled?: boolean;\n /** Places the component in an error state (borders and optional errorMessage). @default false */\n error?: boolean;\n /** Error message shown in the alert below the selects when error is true. @default undefined */\n errorMessage?: string;\n /** Shows an asterisk next to the label. @default undefined */\n required?: boolean;\n /** Additional class names on the outer wrapper. @default undefined */\n className?: string;\n /** HTML id for the first select; day/month/year inputs get derived ids. @default undefined */\n id?: string;\n /** Base year for the year dropdown. Pass explicitly to avoid hydration mismatches near year boundaries. @default current year */\n baseYear?: number;\n /** Number of years shown in the year dropdown (counting back from baseYear). @default 10 */\n yearRange?: number;\n /** Forwarded ref for the root div. @default undefined */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction ChevronDown({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.25\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M6 9L12 15L18 9\" />\n </svg>\n );\n}\n\nfunction ErrorIcon({ className }: { className?: string }) {\n return (\n <svg\n className={className}\n viewBox=\"0 0 20 20\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n}\n\nconst DAYS = Array.from({ length: 31 }, (_, i) =>\n String(i + 1).padStart(2, '0'),\n);\n\nconst MONTHS = Array.from({ length: 12 }, (_, i) =>\n String(i + 1).padStart(2, '0'),\n);\n\nfunction buildYearOptions(baseYear: number, range: number): string[] {\n return Array.from({ length: range }, (_, i) =>\n String(baseYear - i).slice(-2),\n );\n}\n\n// ---------------------------------------------------------------------------\n// Internal segment select\n// ---------------------------------------------------------------------------\n\ninterface SegmentProps {\n id: string;\n placeholder: string;\n options: string[];\n value: string;\n disabled: boolean;\n error: boolean;\n onChange: (val: string) => void;\n wrapperClassName?: string;\n}\n\nfunction Segment({\n id,\n placeholder,\n options,\n value,\n disabled,\n error,\n onChange,\n wrapperClassName = '',\n}: SegmentProps) {\n const hasValue = value !== '';\n\n const classes = [\n 'w-full min-h-[48px] pl-space-4 pr-10 py-space-3 appearance-none',\n 'rounded-rad-md text-form-text outline-none',\n 'transition-all duration-150',\n hasValue ? 'text-text-primary' : 'text-text-disabled',\n\n !disabled && !error &&\n 'border-border-sm border-border-form-primary bg-fill-bg-primary',\n !disabled && error &&\n 'border-border-sm border-border-err bg-fill-bg-primary',\n\n !disabled &&\n 'hover:border-border-md hover:border-border-form-primary-hover',\n !disabled &&\n 'focus:border-border-md focus:border-border-form-primary-active focus:text-text-primary',\n !disabled && [\n 'focus-visible:border-border-sm focus-visible:border-border-form-primary-focus',\n 'focus-visible:ring-[1.5px] focus-visible:ring-border-focus focus-visible:ring-offset-[3px]',\n ].join(' '),\n\n disabled &&\n 'border-border-sm border-border-form-primary-disabled bg-fill-form-primary-disabled text-text-disabled cursor-not-allowed',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={`date-segment relative flex-1 min-w-0 ${wrapperClassName}`}>\n <select\n id={id}\n disabled={disabled}\n value={value}\n onChange={(e) => onChange(e.target.value)}\n className={classes}\n aria-invalid={error || undefined}\n >\n <option value=\"\" disabled hidden>\n {placeholder}\n </option>\n {options.map((opt) => (\n <option key={opt} value={opt}>\n {opt}\n </option>\n ))}\n </select>\n <span\n className={`absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none flex items-center ${\n disabled ? 'text-icon-primary-disabled' : 'text-icon-primary'\n }`}\n >\n <ChevronDown className=\"w-6 h-6\" />\n </span>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\n/**\n * Three-segment date input (day, month, year) using native selects. Renders DD, MM, YY\n * dropdowns with design-token styling. Use for birth dates or simple date capture where\n * a single native date picker is not desired. Values are strings; convert to Date or\n * ISO string in your app as needed.\n *\n * @example\n * <DateInput label=\"Date of birth\" value={date} onChange={setDate} />\n *\n * @example\n * <DateInput label=\"Start date\" defaultValue={{ day: '', month: '', year: '' }} baseYear={2024} yearRange={5} />\n */\nexport function DateInput({\n label,\n secondaryLabel,\n supportText,\n value: valueProp,\n defaultValue,\n onChange,\n disabled = false,\n error = false,\n errorMessage,\n required,\n className,\n id: idProp,\n baseYear,\n yearRange = 10,\n ref,\n}: DateInputProps) {\n const autoId = useId();\n const baseId = idProp ?? autoId;\n\n const isControlled = valueProp !== undefined;\n const [internal, setInternal] = React.useState<DateValue>(\n defaultValue ?? { day: '', month: '', year: '' },\n );\n const current = isControlled ? valueProp : internal;\n\n const update = useCallback(\n (segment: keyof DateValue, val: string) => {\n const next = { ...current, [segment]: val };\n if (!isControlled) setInternal(next);\n onChange?.(next);\n },\n [current, isControlled, onChange],\n );\n\n const showErrorAlert = error && errorMessage;\n\n const resolvedBaseYear = baseYear ?? new Date().getFullYear();\n const YEARS = React.useMemo(() => buildYearOptions(resolvedBaseYear, yearRange), [resolvedBaseYear, yearRange]);\n\n return (\n <div\n ref={ref}\n className={`flex flex-col gap-space-2 w-full ${className ?? ''}`}\n >\n {/* Label + support text */}\n {(label || supportText) && (\n <div className=\"flex flex-col gap-space-1\">\n {label && (\n <label\n htmlFor={`${baseId}-day`}\n className={`text-form-label ${disabled ? 'text-text-disabled' : 'text-text-primary'}`}\n >\n {label}\n {secondaryLabel && (\n <span className=\"text-text-secondary font-normal ml-1\">\n {secondaryLabel}\n </span>\n )}\n {required && (\n <span className=\"text-text-err ml-0.5\">*</span>\n )}\n </label>\n )}\n {supportText && (\n <p\n className={`text-text-xs ${disabled ? 'text-text-disabled' : 'text-text-secondary'}`}\n >\n {supportText}\n </p>\n )}\n </div>\n )}\n\n {/* Three-segment row: DD | MM | YY */}\n <div className=\"flex items-start gap-space-2\">\n <Segment\n id={`${baseId}-day`}\n placeholder=\"DD\"\n options={DAYS}\n value={current.day}\n disabled={disabled}\n error={error}\n onChange={(v) => update('day', v)}\n />\n <Segment\n id={`${baseId}-month`}\n placeholder=\"MM\"\n options={MONTHS}\n value={current.month}\n disabled={disabled}\n error={error}\n onChange={(v) => update('month', v)}\n />\n <Segment\n id={`${baseId}-year`}\n placeholder=\"YY\"\n options={YEARS}\n value={current.year}\n disabled={disabled}\n error={error}\n onChange={(v) => update('year', v)}\n />\n </div>\n\n {/* Error alert */}\n {showErrorAlert && (\n <div\n id={`${baseId}-error`}\n role=\"alert\"\n className={`flex items-start gap-space-4 p-space-4 rounded-rad-md ${\n disabled ? 'bg-fill-bg-secondary' : 'bg-fill-bg-err'\n }`}\n >\n <ErrorIcon\n className={`w-5 h-5 shrink-0 ${\n disabled ? 'text-icon-primary-disabled' : 'text-icon-err'\n }`}\n />\n <span\n className={`text-text-xs ${\n disabled ? 'text-text-disabled' : 'text-text-err'\n }`}\n >\n {errorMessage}\n </span>\n </div>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";;;AA4DA;AACE;AACE;AAAC;AAAA;AACC;AACQ;AACH;AACE;AACK;AACE;AACC;AACH;AAEc;AAAA;AAGhC;AAEA;AACE;AACE;AAAC;AAAA;AACC;AACQ;AACH;AACO;AAEZ;AAAC;AAAA;AACU;AACP;AACO;AAAA;AAAA;AACX;AAGN;AAEA;AAAmB;AAAe;AAElC;AAEA;AAAqB;AAAe;AAEpC;AAEA;AACE;AAAa;AAAe;AACG;AAEjC;AAiBA;AAAiB;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AAEF;AACE;AAEA;AAAgB;AACd;AACA;AACA;AACiC;AAG/B;AAEA;AAGA;AAEA;AACW;AACX;AACA;AACQ;AAGR;AAKJ;AAEI;AAAA;AAAC;AAAA;AACC;AACA;AACA;AACwC;AAC7B;AACY;AAEvB;AAEA;AAKC;AAAA;AAAA;AAAA;AAEH;AAAC;AAAA;AAGC;AAEiC;AAAA;AAAA;AAIzC;AAkBO;AAAmB;AACxB;AACA;AACA;AACO;AACP;AACA;AACW;AACH;AACR;AACA;AACA;AACI;AACJ;AACY;AAEd;AACE;AACA;AAEA;AACA;AAAsC;AACQ;AAE9C;AAEA;AAAe;AAEX;AACA;AACA;AAAW;AACb;AACgC;AAGlC;AAEA;AACA;AAEA;AACE;AAAC;AAAA;AACC;AAC8D;AAG5D;AAEG;AACC;AAAC;AAAA;AACmB;AACiE;AAElF;AAAA;AAIC;AAGwC;AAAA;AAAA;AAAA;AAK5C;AAAC;AAAA;AACmF;AAEjF;AAAA;AAAA;AAGP;AAKA;AAAA;AAAC;AAAA;AACc;AACD;AACH;AACM;AACf;AACA;AACgC;AAAA;AAAA;AAElC;AAAC;AAAA;AACc;AACD;AACH;AACM;AACf;AACA;AACkC;AAAA;AAAA;AAEpC;AAAC;AAAA;AACc;AACD;AACH;AACM;AACf;AACA;AACiC;AAAA;AAAA;AAErC;AAIE;AAAC;AAAA;AACc;AACR;AAGL;AAEA;AAAA;AAAC;AAAA;AAGC;AAAA;AAAA;AAEF;AAAC;AAAA;AAGC;AAEC;AAAA;AAAA;AACH;AAAA;AAAA;AACF;AAAA;AAIR;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Divider orientation. Horizontal renders a full-width top border;
|
|
4
|
+
* vertical renders a left border and requires a height (e.g. via className).
|
|
5
|
+
*/
|
|
6
|
+
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
7
|
+
/**
|
|
8
|
+
* Divider border weight. Maps to design-system border tokens.
|
|
9
|
+
* - 'light' border-border-light (subtle).
|
|
10
|
+
* - 'heavy' border-border-heavy (more prominent).
|
|
11
|
+
*/
|
|
12
|
+
export type DividerVariant = 'light' | 'heavy';
|
|
13
|
+
/**
|
|
14
|
+
* Props for the Divider component. Renders an <hr> (or separator when vertical).
|
|
15
|
+
*/
|
|
16
|
+
export interface DividerProps extends React.HTMLAttributes<HTMLHRElement> {
|
|
17
|
+
/**
|
|
18
|
+
* Orientation of the divider line. Vertical dividers use border-left and
|
|
19
|
+
* need a height from className or parent layout.
|
|
20
|
+
* @default 'horizontal'
|
|
21
|
+
*/
|
|
22
|
+
orientation?: DividerOrientation;
|
|
23
|
+
/**
|
|
24
|
+
* Border weight token. Light for subtle separation, heavy for emphasis.
|
|
25
|
+
* @default 'light'
|
|
26
|
+
*/
|
|
27
|
+
variant?: DividerVariant;
|
|
28
|
+
/** Forwarded ref for the root hr element. @default undefined */
|
|
29
|
+
ref?: React.Ref<HTMLHRElement>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Renders a horizontal or vertical separator using design-system border
|
|
33
|
+
* tokens. Use between sections, list groups, or inline to separate content.
|
|
34
|
+
* Renders an <hr> with role="separator" when vertical.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <Divider />
|
|
38
|
+
* <Divider variant="heavy" />
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* <Divider orientation="vertical" className="h-8" />
|
|
42
|
+
*/
|
|
43
|
+
export declare function Divider({ orientation, variant, className, style, ref, ...rest }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../src/components/Divider/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC;IACvE;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,gEAAgE;IAChE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAChC;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,EACtB,WAA0B,EAC1B,OAAiB,EACjB,SAAc,EACd,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,YAAY,2CAuBd"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const variantClasses = {
|
|
3
|
+
light: "border-border-light",
|
|
4
|
+
heavy: "border-border-heavy"
|
|
5
|
+
};
|
|
6
|
+
function Divider({
|
|
7
|
+
orientation = "horizontal",
|
|
8
|
+
variant = "light",
|
|
9
|
+
className = "",
|
|
10
|
+
style,
|
|
11
|
+
ref,
|
|
12
|
+
...rest
|
|
13
|
+
}) {
|
|
14
|
+
const isVertical = orientation === "vertical";
|
|
15
|
+
const classes = [
|
|
16
|
+
isVertical ? "self-stretch border-l border-t-0 w-0 m-0" : "block w-full border-t border-l-0",
|
|
17
|
+
variantClasses[variant],
|
|
18
|
+
className
|
|
19
|
+
].filter(Boolean).join(" ");
|
|
20
|
+
return /* @__PURE__ */ jsx(
|
|
21
|
+
"hr",
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
className: classes,
|
|
25
|
+
style,
|
|
26
|
+
role: isVertical ? "separator" : void 0,
|
|
27
|
+
"aria-orientation": isVertical ? "vertical" : void 0,
|
|
28
|
+
...rest
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
Divider
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","sources":["../../../src/components/Divider/Divider.tsx"],"sourcesContent":["import React from 'react';\n\n/**\n * Divider orientation. Horizontal renders a full-width top border;\n * vertical renders a left border and requires a height (e.g. via className).\n */\nexport type DividerOrientation = 'horizontal' | 'vertical';\n\n/**\n * Divider border weight. Maps to design-system border tokens.\n * - 'light' border-border-light (subtle).\n * - 'heavy' border-border-heavy (more prominent).\n */\nexport type DividerVariant = 'light' | 'heavy';\n\n/**\n * Props for the Divider component. Renders an <hr> (or separator when vertical).\n */\nexport interface DividerProps extends React.HTMLAttributes<HTMLHRElement> {\n /**\n * Orientation of the divider line. Vertical dividers use border-left and\n * need a height from className or parent layout.\n * @default 'horizontal'\n */\n orientation?: DividerOrientation;\n /**\n * Border weight token. Light for subtle separation, heavy for emphasis.\n * @default 'light'\n */\n variant?: DividerVariant;\n /** Forwarded ref for the root hr element. @default undefined */\n ref?: React.Ref<HTMLHRElement>;\n}\n\nconst variantClasses: Record<DividerVariant, string> = {\n light: 'border-border-light',\n heavy: 'border-border-heavy',\n};\n\n/**\n * Renders a horizontal or vertical separator using design-system border\n * tokens. Use between sections, list groups, or inline to separate content.\n * Renders an <hr> with role=\"separator\" when vertical.\n *\n * @example\n * <Divider />\n * <Divider variant=\"heavy\" />\n *\n * @example\n * <Divider orientation=\"vertical\" className=\"h-8\" />\n */\nexport function Divider({\n orientation = 'horizontal',\n variant = 'light',\n className = '',\n style,\n ref,\n ...rest\n}: DividerProps) {\n const isVertical = orientation === 'vertical';\n\n const classes = [\n isVertical\n ? 'self-stretch border-l border-t-0 w-0 m-0'\n : 'block w-full border-t border-l-0',\n variantClasses[variant],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <hr\n ref={ref}\n className={classes}\n style={style}\n role={isVertical ? 'separator' : undefined}\n aria-orientation={isVertical ? 'vertical' : undefined}\n {...rest}\n />\n );\n}\n"],"names":[],"mappings":";AAkCA,MAAM,iBAAiD;AAAA,EACrD,OAAO;AAAA,EACP,OAAO;AACT;AAcO,SAAS,QAAQ;AAAA,EACtB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiB;AACf,QAAM,aAAa,gBAAgB;AAEnC,QAAM,UAAU;AAAA,IACd,aACI,6CACA;AAAA,IACJ,eAAe,OAAO;AAAA,IACtB;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA,MAAM,aAAa,cAAc;AAAA,MACjC,oBAAkB,aAAa,aAAa;AAAA,MAC3C,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Edge from which the drawer panel slides in. Use 'left' for navigation-style drawers,
|
|
4
|
+
* 'right' for filters or detail panels.
|
|
5
|
+
*/
|
|
6
|
+
export type DrawerAnchor = 'left' | 'right';
|
|
7
|
+
/**
|
|
8
|
+
* Props for the Drawer component. Drawer does not control visibility — use it inside
|
|
9
|
+
* an Overlay and control open/onClose on the Overlay.
|
|
10
|
+
*/
|
|
11
|
+
export interface DrawerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
/** Which edge the drawer panel slides in from. @default 'right' */
|
|
13
|
+
anchor?: DrawerAnchor;
|
|
14
|
+
/** Max width of the drawer panel. @default '24rem' (384px) */
|
|
15
|
+
maxWidth?: string;
|
|
16
|
+
/** Panel content. Typically Stack or nav content. @default undefined */
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/** Forwarded ref for the root div. @default undefined */
|
|
19
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Slide-in side panel for mobile navigation, filters, or detail views.
|
|
23
|
+
* Designed to be used inside an `<Overlay>`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <Overlay open={isOpen} onClose={close}>
|
|
28
|
+
* <Drawer anchor="right">
|
|
29
|
+
* <Stack gap="space-4" className="p-space-4">...</Stack>
|
|
30
|
+
* </Drawer>
|
|
31
|
+
* </Overlay>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function Drawer({ anchor, maxWidth, children, className, style, ref, ...rest }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACvE,mEAAmE;IACnE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,yDAAyD;IACzD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAgB,EAChB,QAAkB,EAClB,QAAQ,EACR,SAAc,EACd,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,WAAW,2CAqBb"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const anchorClasses = {
|
|
4
|
+
left: "left-0",
|
|
5
|
+
right: "right-0"
|
|
6
|
+
};
|
|
7
|
+
function Drawer({
|
|
8
|
+
anchor = "right",
|
|
9
|
+
maxWidth = "24rem",
|
|
10
|
+
children,
|
|
11
|
+
className = "",
|
|
12
|
+
style,
|
|
13
|
+
ref,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
16
|
+
const classes = [
|
|
17
|
+
"absolute inset-y-0 w-full bg-fill-bg-primary shadow-elevation-normal",
|
|
18
|
+
anchorClasses[anchor],
|
|
19
|
+
className
|
|
20
|
+
].filter(Boolean).join(" ");
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
className: classes,
|
|
26
|
+
style: { maxWidth, ...style },
|
|
27
|
+
role: "dialog",
|
|
28
|
+
"aria-modal": "true",
|
|
29
|
+
...rest,
|
|
30
|
+
children
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
Drawer
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=Drawer.js.map
|