@molecule/app-ui-react 1.0.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 +115 -0
- package/README.md +2786 -0
- package/dist/components/Accordion.d.ts +12 -0
- package/dist/components/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion.js +80 -0
- package/dist/components/Accordion.js.map +1 -0
- package/dist/components/Alert.d.ts +26 -0
- package/dist/components/Alert.d.ts.map +1 -0
- package/dist/components/Alert.js +53 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/AuthGuard.d.ts +66 -0
- package/dist/components/AuthGuard.d.ts.map +1 -0
- package/dist/components/AuthGuard.js +42 -0
- package/dist/components/AuthGuard.js.map +1 -0
- package/dist/components/Avatar.d.ts +12 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.js +25 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.d.ts +12 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +18 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Button.d.ts +12 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +19 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Card.d.ts +34 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +71 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Checkbox.d.ts +12 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +41 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Dropdown.d.ts +38 -0
- package/dist/components/Dropdown.d.ts.map +1 -0
- package/dist/components/Dropdown.js +352 -0
- package/dist/components/Dropdown.js.map +1 -0
- package/dist/components/EmptyState.d.ts +15 -0
- package/dist/components/EmptyState.d.ts.map +1 -0
- package/dist/components/EmptyState.js +20 -0
- package/dist/components/EmptyState.js.map +1 -0
- package/dist/components/FloatingInput.d.ts +22 -0
- package/dist/components/FloatingInput.d.ts.map +1 -0
- package/dist/components/FloatingInput.js +38 -0
- package/dist/components/FloatingInput.js.map +1 -0
- package/dist/components/Form.d.ts +22 -0
- package/dist/components/Form.d.ts.map +1 -0
- package/dist/components/Form.js +81 -0
- package/dist/components/Form.js.map +1 -0
- package/dist/components/Icon.d.ts +48 -0
- package/dist/components/Icon.d.ts.map +1 -0
- package/dist/components/Icon.js +46 -0
- package/dist/components/Icon.js.map +1 -0
- package/dist/components/Input.d.ts +12 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +25 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/LanguagePicker.d.ts +60 -0
- package/dist/components/LanguagePicker.d.ts.map +1 -0
- package/dist/components/LanguagePicker.js +45 -0
- package/dist/components/LanguagePicker.js.map +1 -0
- package/dist/components/Layout.d.ts +24 -0
- package/dist/components/Layout.d.ts.map +1 -0
- package/dist/components/Layout.js +104 -0
- package/dist/components/Layout.js.map +1 -0
- package/dist/components/Modal.d.ts +32 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +235 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/PageHeader.d.ts +15 -0
- package/dist/components/PageHeader.d.ts.map +1 -0
- package/dist/components/PageHeader.js +20 -0
- package/dist/components/PageHeader.js.map +1 -0
- package/dist/components/PageShell.d.ts +15 -0
- package/dist/components/PageShell.d.ts.map +1 -0
- package/dist/components/PageShell.js +20 -0
- package/dist/components/PageShell.js.map +1 -0
- package/dist/components/Pagination.d.ts +12 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +78 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/PanelClose.d.ts +40 -0
- package/dist/components/PanelClose.d.ts.map +1 -0
- package/dist/components/PanelClose.js +32 -0
- package/dist/components/PanelClose.js.map +1 -0
- package/dist/components/Progress.d.ts +45 -0
- package/dist/components/Progress.d.ts.map +1 -0
- package/dist/components/Progress.js +21 -0
- package/dist/components/Progress.js.map +1 -0
- package/dist/components/RadioGroup.d.ts +12 -0
- package/dist/components/RadioGroup.d.ts.map +1 -0
- package/dist/components/RadioGroup.js +34 -0
- package/dist/components/RadioGroup.js.map +1 -0
- package/dist/components/Select.d.ts +12 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Select.js +57 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Separator.d.ts +25 -0
- package/dist/components/Separator.d.ts.map +1 -0
- package/dist/components/Separator.js +18 -0
- package/dist/components/Separator.js.map +1 -0
- package/dist/components/SidebarUserCard.d.ts +60 -0
- package/dist/components/SidebarUserCard.d.ts.map +1 -0
- package/dist/components/SidebarUserCard.js +45 -0
- package/dist/components/SidebarUserCard.js.map +1 -0
- package/dist/components/Skeleton.d.ts +26 -0
- package/dist/components/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton.js +45 -0
- package/dist/components/Skeleton.js.map +1 -0
- package/dist/components/Spinner.d.ts +17 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +32 -0
- package/dist/components/Spinner.js.map +1 -0
- package/dist/components/Switch.d.ts +12 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +52 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Table.d.ts +12 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/Table.js +53 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Tabs.d.ts +12 -0
- package/dist/components/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs.js +72 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/Textarea.d.ts +12 -0
- package/dist/components/Textarea.d.ts.map +1 -0
- package/dist/components/Textarea.js +66 -0
- package/dist/components/Textarea.js.map +1 -0
- package/dist/components/ThemeToggle.d.ts +43 -0
- package/dist/components/ThemeToggle.d.ts.map +1 -0
- package/dist/components/ThemeToggle.js +30 -0
- package/dist/components/ThemeToggle.js.map +1 -0
- package/dist/components/Toast.d.ts +61 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +159 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/components/Tooltip.d.ts +21 -0
- package/dist/components/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip.js +245 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/UserMenu.d.ts +59 -0
- package/dist/components/UserMenu.d.ts.map +1 -0
- package/dist/components/UserMenu.js +34 -0
- package/dist/components/UserMenu.js.map +1 -0
- package/dist/components/UserMenuPopover.d.ts +139 -0
- package/dist/components/UserMenuPopover.d.ts.map +1 -0
- package/dist/components/UserMenuPopover.js +173 -0
- package/dist/components/UserMenuPopover.js.map +1 -0
- package/dist/components/index.d.ts +43 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +43 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +131 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/utilities/index.d.ts +8 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +8 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/initials.d.ts +13 -0
- package/dist/utilities/initials.d.ts.map +1 -0
- package/dist/utilities/initials.js +23 -0
- package/dist/utilities/initials.js.map +1 -0
- package/dist/utilities/renderIcon.d.ts +21 -0
- package/dist/utilities/renderIcon.d.ts.map +1 -0
- package/dist/utilities/renderIcon.js +40 -0
- package/dist/utilities/renderIcon.js.map +1 -0
- package/dist/utilities.d.ts +12 -0
- package/dist/utilities.d.ts.map +1 -0
- package/dist/utilities.js +14 -0
- package/dist/utilities.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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GAAG,EAAE,EAAE;IACrD,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IAExB,OAAO,CACL,gBAAO,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,CAAC,KAAM,KAAK,YACxF,QAAQ,GACH,CACT,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { type SVGProps } from 'react';
|
|
2
|
+
import { type IconName } from '@molecule/app-icons';
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link Icon}.
|
|
5
|
+
*
|
|
6
|
+
* Extends `SVGProps<SVGSVGElement>` so callers can pass any SVG / HTML
|
|
7
|
+
* attribute the underlying `<svg>` accepts, including `data-mol-id`,
|
|
8
|
+
* `aria-*`, `role`, event handlers, `style`, etc. — without the
|
|
9
|
+
* component needing to enumerate them.
|
|
10
|
+
*/
|
|
11
|
+
export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'width' | 'height' | 'viewBox' | 'fill'> {
|
|
12
|
+
/**
|
|
13
|
+
* Name of the glyph to look up in the bonded icon set. Typed as
|
|
14
|
+
* {@link IconName} so a typo fails the type-check instead of throwing at
|
|
15
|
+
* render time; sets with extra glyphs augment `CustomIconNames` in
|
|
16
|
+
* `@molecule/app-icons` to widen it.
|
|
17
|
+
*/
|
|
18
|
+
name: IconName;
|
|
19
|
+
/** Width and height of the rendered SVG in pixels. Defaults to 20. */
|
|
20
|
+
size?: number;
|
|
21
|
+
/** Class name forwarded to the root `<svg>`. */
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Renders an SVG glyph looked up by `name` from the bonded
|
|
26
|
+
* `@molecule/app-icons` set.
|
|
27
|
+
*
|
|
28
|
+
* Handles two icon-data shapes returned by the bond:
|
|
29
|
+
* 1. Pre-rendered SVG markup (`icon.svg`) — injected via
|
|
30
|
+
* `dangerouslySetInnerHTML`. The bond is the trust boundary; only
|
|
31
|
+
* bond a set that controls its own SVG strings.
|
|
32
|
+
* 2. Structured paths (`icon.paths`) — rendered as discrete `<path>`
|
|
33
|
+
* children, with optional stroke styling forwarded from the icon set.
|
|
34
|
+
*
|
|
35
|
+
* Any extra HTML/SVG attribute (e.g. `data-mol-id`, `aria-label`,
|
|
36
|
+
* `role="img"`, `onClick`) is forwarded to the root `<svg>` via spread.
|
|
37
|
+
*
|
|
38
|
+
* Decorative by default: when the caller passes no `aria-label` /
|
|
39
|
+
* `aria-labelledby` / `role`, the SVG is rendered `aria-hidden` +
|
|
40
|
+
* `focusable="false"` so screen readers skip it (an unnamed inline SVG is
|
|
41
|
+
* announced as a stray "image" by some combos). Passing any of those props
|
|
42
|
+
* opts the icon into the accessibility tree.
|
|
43
|
+
*
|
|
44
|
+
* @param props - {@link IconProps}
|
|
45
|
+
* @returns An `<svg>` element rendering the named glyph.
|
|
46
|
+
*/
|
|
47
|
+
export declare function Icon({ name, size, className, ...rest }: IconProps): React.JSX.Element;
|
|
48
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/components/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE5C,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE5D;;;;;;;GAOG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CACrC,QAAQ,CAAC,aAAa,CAAC,EACvB,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CACxC;IACC;;;;;OAKG;IACH,IAAI,EAAE,QAAQ,CAAA;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAwD1F"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getIcon } from '@molecule/app-icons';
|
|
3
|
+
/**
|
|
4
|
+
* Renders an SVG glyph looked up by `name` from the bonded
|
|
5
|
+
* `@molecule/app-icons` set.
|
|
6
|
+
*
|
|
7
|
+
* Handles two icon-data shapes returned by the bond:
|
|
8
|
+
* 1. Pre-rendered SVG markup (`icon.svg`) — injected via
|
|
9
|
+
* `dangerouslySetInnerHTML`. The bond is the trust boundary; only
|
|
10
|
+
* bond a set that controls its own SVG strings.
|
|
11
|
+
* 2. Structured paths (`icon.paths`) — rendered as discrete `<path>`
|
|
12
|
+
* children, with optional stroke styling forwarded from the icon set.
|
|
13
|
+
*
|
|
14
|
+
* Any extra HTML/SVG attribute (e.g. `data-mol-id`, `aria-label`,
|
|
15
|
+
* `role="img"`, `onClick`) is forwarded to the root `<svg>` via spread.
|
|
16
|
+
*
|
|
17
|
+
* Decorative by default: when the caller passes no `aria-label` /
|
|
18
|
+
* `aria-labelledby` / `role`, the SVG is rendered `aria-hidden` +
|
|
19
|
+
* `focusable="false"` so screen readers skip it (an unnamed inline SVG is
|
|
20
|
+
* announced as a stray "image" by some combos). Passing any of those props
|
|
21
|
+
* opts the icon into the accessibility tree.
|
|
22
|
+
*
|
|
23
|
+
* @param props - {@link IconProps}
|
|
24
|
+
* @returns An `<svg>` element rendering the named glyph.
|
|
25
|
+
*/
|
|
26
|
+
export function Icon({ name, size = 20, className, ...rest }) {
|
|
27
|
+
const icon = getIcon(name);
|
|
28
|
+
const viewBox = icon.viewBox || '0 0 20 20';
|
|
29
|
+
// Placed BEFORE {...rest} so an explicit caller aria-hidden/role wins.
|
|
30
|
+
const decorativeProps = rest['aria-label'] == null && rest['aria-labelledby'] == null && rest.role == null
|
|
31
|
+
? { 'aria-hidden': true, focusable: 'false' }
|
|
32
|
+
: {};
|
|
33
|
+
if (icon.svg) {
|
|
34
|
+
return (_jsx("svg", { width: size, height: size, viewBox: viewBox, fill: icon.fill || 'none', className: className, dangerouslySetInnerHTML: { __html: icon.svg }, ...decorativeProps, ...rest }));
|
|
35
|
+
}
|
|
36
|
+
const isStroked = !!icon.stroke;
|
|
37
|
+
return (_jsx("svg", { width: size, height: size, viewBox: viewBox, fill: isStroked ? 'none' : icon.fill || 'currentColor', ...decorativeProps, ...(isStroked
|
|
38
|
+
? {
|
|
39
|
+
stroke: icon.stroke,
|
|
40
|
+
strokeWidth: icon.strokeWidth,
|
|
41
|
+
strokeLinecap: icon.strokeLinecap,
|
|
42
|
+
strokeLinejoin: icon.strokeLinejoin,
|
|
43
|
+
}
|
|
44
|
+
: {}), className: className, ...rest, children: icon.paths.map((p, i) => (_jsx("path", { d: p.d, ...(p.fill ? { fill: p.fill } : {}), ...(p.fillRule ? { fillRule: p.fillRule } : {}), ...(p.clipRule ? { clipRule: p.clipRule } : {}), ...(p.opacity !== undefined ? { opacity: p.opacity } : {}) }, i))) }));
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../src/components/Icon.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAiB,MAAM,qBAAqB,CAAA;AA2B5D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,IAAI,EAAa;IACrE,MAAM,IAAI,GAAG,OA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,EAAE,EAAE,CAAC,CACxB,eAEE,CAAC,EAAE,CAAC,CAAC,CAAC,KACF,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAChC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAC5C,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAC5C,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IALtD,CAAC,CAMN,CACH,CAAC,GACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input component.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { InputProps } from '@molecule/app-ui';
|
|
8
|
+
/**
|
|
9
|
+
* Input component.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
12
|
+
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA4B,MAAM,OAAO,CAAA;AAGhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAKlD;;GAEG;AACH,eAAO,MAAM,KAAK,qFA+GjB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Input component.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { forwardRef, useId } from 'react';
|
|
8
|
+
import { t } from '@molecule/app-i18n';
|
|
9
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
10
|
+
import { renderIcon } from '../utilities/renderIcon.js';
|
|
11
|
+
/**
|
|
12
|
+
* Input component.
|
|
13
|
+
*/
|
|
14
|
+
export const Input = forwardRef(({ type = 'text', size = 'md', align, label, error, hint, leftElement, rightElement, clearable, onClear, clearLabel, className, style, testId, disabled, required, value, defaultValue, placeholder, name, id, onChange, onFocus, onBlur, ...rest }, ref) => {
|
|
15
|
+
const cm = getClassMap();
|
|
16
|
+
// Fall back to a generated id so label htmlFor / aria-describedby never
|
|
17
|
+
// point at `undefined-error` (which also collides across multiple
|
|
18
|
+
// id-less inputs on the same page).
|
|
19
|
+
const generatedId = useId();
|
|
20
|
+
const inputId = id || name || generatedId;
|
|
21
|
+
const inputClasses = cm.cn(cm.input({ error: !!error, size, align }), !!leftElement && cm.inputPadLeft, !!(rightElement || clearable) && cm.inputPadRight, className);
|
|
22
|
+
return (_jsxs("div", { className: cm.inputWrapper, children: [label && (_jsx("label", { htmlFor: inputId, className: cm.cn(cm.label({ required: !!required }), cm.labelBlock), children: label })), _jsxs("div", { className: cm.inputInner, children: [!!leftElement && (_jsx("div", { className: cm.inputLeftElement, children: leftElement })), _jsx("input", { ref: ref, type: type, id: inputId, name: name, value: value, defaultValue: defaultValue, placeholder: placeholder, disabled: disabled, required: required, "aria-invalid": !!error, "aria-describedby": error ? `${inputId}-error` : hint ? `${inputId}-hint` : undefined, className: inputClasses, style: style, "data-testid": testId, onChange: onChange, onFocus: onFocus, onBlur: onBlur, ...rest }), (rightElement || (clearable && value)) && (_jsx("div", { className: cm.inputRightElement, children: clearable && value ? (_jsx("button", { type: "button", onClick: onClear, className: cm.inputClearButton, "aria-label": clearLabel ?? t('ui.input.clear', undefined, { defaultValue: 'Clear' }), children: renderIcon('x-mark', cm.iconSm) })) : (_jsx("span", { className: cm.textMuted, children: rightElement })) }))] }), error && (_jsx("p", { id: `${inputId}-error`, className: cm.formError, children: error })), hint && !error && (_jsx("p", { id: `${inputId}-hint`, className: cm.formHint, children: hint }))] }));
|
|
23
|
+
});
|
|
24
|
+
Input.displayName = 'Input';
|
|
25
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../src/components/Input.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAA;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EACE,IAAI,GAAG,MAAM,EACb,IAAI,GAAG,IAAI,EACX,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,WAAW,EACX,IAAI,EACJ,EAAE,EACF,QAAQ,EACR,OAAO,EACP,MAAM,EACN,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,wEAAwE;IACxE,kEAAkE;IAClE,oCAAoC;IACpC,MAAM,WAAW,GAAG,KAAK,EAAE,CAAA;IAC3B,MAAM,OAAO,GAAG,EAAE,IAAI,IAAI,IAA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D,KACjE,IAAoD,GACzD,EACD,CAAC,YAAY,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,CAAC,IAAI,CACzC,cAAK,SAAS,EAAE,EAAE,CAAC,iBAAiB,YACjC,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,CACpB,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,EAAE,CAAC,gBAAgB,gBAE5B,UAAU,IAAI,CAAC,CAAC,gBAAgB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC,YAGxE,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,GACzB,CACV,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAE,EAAE,CAAC,SAAS,YAAG,YAA+B,GAAQ,CACxE,GACG,CACP,IACG,EACL,KAAK,IAAI,CACR,YAAG,EAAE,EAAE,GAAG,OAAO,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,YAC/C,KAAK,GACJ,CACL,EACA,IAAI,IAAI,CAAC,KAAK,IAAI,CACjB,YAAG,EAAE,EAAE,GAAG,OAAO,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,QAAQ,YAC7C,IAAI,GACH,CACL,IACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type JSX, type ReactNode } from 'react';
|
|
2
|
+
import type { IconName } from '@molecule/app-icons';
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link LanguagePicker}.
|
|
5
|
+
*
|
|
6
|
+
* Extends standard `<button>` attributes so callers can pass any extra
|
|
7
|
+
* `data-*`, `aria-*`, event handler, or `style` prop without forking the
|
|
8
|
+
* component. The named props let apps customize the trigger label, icon,
|
|
9
|
+
* size, and modal heading without spreading attribute concerns.
|
|
10
|
+
*/
|
|
11
|
+
export interface LanguagePickerProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'aria-label' | 'onClick' | 'type' | 'children'> {
|
|
12
|
+
/** i18n key for the trigger button label / aria-label. Defaults to `'footer.language'`. */
|
|
13
|
+
labelKey?: string;
|
|
14
|
+
/** Fallback label if the i18n key is missing. Defaults to `'Language'`. */
|
|
15
|
+
labelDefault?: string;
|
|
16
|
+
/** i18n key for the modal title. Defaults to `'languagePicker.modalTitle'`. */
|
|
17
|
+
modalTitleKey?: string;
|
|
18
|
+
/** Fallback modal title if the i18n key is missing. Defaults to `'Choose language'`. */
|
|
19
|
+
modalTitleDefault?: string;
|
|
20
|
+
/** Icon glyph to render before the current locale name. Defaults to `'globe'`. */
|
|
21
|
+
icon?: IconName;
|
|
22
|
+
/** Pixel size for the rendered icon. Defaults to `16`. */
|
|
23
|
+
iconSize?: number;
|
|
24
|
+
/**
|
|
25
|
+
* What to render inside the trigger button.
|
|
26
|
+
*
|
|
27
|
+
* - `'name'` — globe icon + current locale's native name (e.g. `🌐 English`).
|
|
28
|
+
* This is the default; matches the molecule-dev footer pattern.
|
|
29
|
+
* - `'code'` — globe icon + lowercase locale code (e.g. `🌐 en`). Useful in
|
|
30
|
+
* tight chrome where the long native name (e.g. "Bahasa Indonesia") would wrap.
|
|
31
|
+
* - `'icon'` — globe icon only. Useful in icon-bar headers.
|
|
32
|
+
*/
|
|
33
|
+
display?: 'name' | 'code' | 'icon';
|
|
34
|
+
/** Optional className appended to the trigger button. */
|
|
35
|
+
className?: string;
|
|
36
|
+
/** Optional render override: receives `{ open }` and replaces the default trigger. */
|
|
37
|
+
renderTrigger?: (open: () => void) => ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Globe-icon button that opens a modal grid of every locale registered
|
|
41
|
+
* with the bonded i18n provider. Clicking a locale calls `setLocale`
|
|
42
|
+
* and closes the modal.
|
|
43
|
+
*
|
|
44
|
+
* Reads `locale`, `setLocale`, and `locales` from {@link useTranslation},
|
|
45
|
+
* so the list of choices stays in sync with whatever set the
|
|
46
|
+
* `setupI18nDefault` (or any other i18n setup) registered. No hardcoded
|
|
47
|
+
* language list — adding a locale to the i18n bond adds it to the picker.
|
|
48
|
+
*
|
|
49
|
+
* Molecule-convention defaults baked in:
|
|
50
|
+
*
|
|
51
|
+
* - `data-mol-id="language-picker-trigger"` on the trigger button
|
|
52
|
+
* - `data-mol-id="language-picker-modal"` on the modal dialog
|
|
53
|
+
* - `data-mol-id="language-picker-option-<code>"` on each locale button
|
|
54
|
+
* - `data-active` on the currently-selected locale button
|
|
55
|
+
* - `aria-label` from the `footer.language` i18n key (default `"Language"`)
|
|
56
|
+
*
|
|
57
|
+
* @param props - {@link LanguagePickerProps}
|
|
58
|
+
*/
|
|
59
|
+
export declare function LanguagePicker({ labelKey, labelDefault, modalTitleKey, modalTitleDefault, icon, iconSize, display, className, renderTrigger, ...rest }?: LanguagePickerProps): JSX.Element;
|
|
60
|
+
//# sourceMappingURL=LanguagePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguagePicker.d.ts","sourceRoot":"","sources":["../../src/components/LanguagePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAErF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAOnD;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAC/C,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,CAC/C;IACC,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wFAAwF;IACxF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kFAAkF;IAClF,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;IAClC,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sFAAsF;IACtF,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,IAAI,KAAK,SAAS,CAAA;CAChD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAA4B,EAC5B,YAAyB,EACzB,aAA2C,EAC3C,iBAAqC,EACrC,IAAc,EACd,QAAa,EACb,OAAgB,EAChB,SAAS,EACT,aAAa,EACb,GAAG,IAAI,EACR,GAAE,mBAAwB,GAAG,GAAG,CAAC,OAAO,CA6DxC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { useTranslation } from '@molecule/app-react';
|
|
4
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
5
|
+
import { Icon } from './Icon.js';
|
|
6
|
+
import { Modal } from './Modal.js';
|
|
7
|
+
/**
|
|
8
|
+
* Globe-icon button that opens a modal grid of every locale registered
|
|
9
|
+
* with the bonded i18n provider. Clicking a locale calls `setLocale`
|
|
10
|
+
* and closes the modal.
|
|
11
|
+
*
|
|
12
|
+
* Reads `locale`, `setLocale`, and `locales` from {@link useTranslation},
|
|
13
|
+
* so the list of choices stays in sync with whatever set the
|
|
14
|
+
* `setupI18nDefault` (or any other i18n setup) registered. No hardcoded
|
|
15
|
+
* language list — adding a locale to the i18n bond adds it to the picker.
|
|
16
|
+
*
|
|
17
|
+
* Molecule-convention defaults baked in:
|
|
18
|
+
*
|
|
19
|
+
* - `data-mol-id="language-picker-trigger"` on the trigger button
|
|
20
|
+
* - `data-mol-id="language-picker-modal"` on the modal dialog
|
|
21
|
+
* - `data-mol-id="language-picker-option-<code>"` on each locale button
|
|
22
|
+
* - `data-active` on the currently-selected locale button
|
|
23
|
+
* - `aria-label` from the `footer.language` i18n key (default `"Language"`)
|
|
24
|
+
*
|
|
25
|
+
* @param props - {@link LanguagePickerProps}
|
|
26
|
+
*/
|
|
27
|
+
export function LanguagePicker({ labelKey = 'footer.language', labelDefault = 'Language', modalTitleKey = 'languagePicker.modalTitle', modalTitleDefault = 'Choose language', icon = 'globe', iconSize = 16, display = 'name', className, renderTrigger, ...rest } = {}) {
|
|
28
|
+
const cm = getClassMap();
|
|
29
|
+
const { t, locale, setLocale, locales } = useTranslation();
|
|
30
|
+
const [open, setOpen] = useState(false);
|
|
31
|
+
const ariaLabel = t(labelKey, {}, { defaultValue: labelDefault });
|
|
32
|
+
const current = locales.find((l) => l.code === locale);
|
|
33
|
+
const currentName = current?.name ?? locale;
|
|
34
|
+
const triggerLabel = display === 'icon' ? null : display === 'code' ? locale : currentName;
|
|
35
|
+
return (_jsxs(_Fragment, { children: [renderTrigger ? (renderTrigger(() => setOpen(true))) : (_jsxs("button", { type: "button", "data-mol-id": "language-picker-trigger", "aria-label": ariaLabel, onClick: () => setOpen(true), className: cm.cn(cm.languagePickerTrigger, className), ...rest, children: [_jsx(Icon, { name: icon, size: iconSize }), triggerLabel != null ? _jsx("span", { children: triggerLabel }) : null] })), _jsx(Modal, { open: open, onClose: () => setOpen(false), title: t(modalTitleKey, {}, { defaultValue: modalTitleDefault }), size: "lg", "data-mol-id": "language-picker-modal", children: _jsx("div", { className: cm.languageGrid, children: [...locales]
|
|
36
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
37
|
+
.map((l) => {
|
|
38
|
+
const active = l.code === locale;
|
|
39
|
+
return (_jsx("button", { type: "button", "data-mol-id": `language-picker-option-${l.code}`, "data-active": active || undefined, "aria-pressed": active, onClick: async () => {
|
|
40
|
+
await setLocale(l.code);
|
|
41
|
+
setOpen(false);
|
|
42
|
+
}, className: active ? cm.languageActive : cm.languageOption, children: l.name }, l.code));
|
|
43
|
+
}) }) })] }));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=LanguagePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguagePicker.js","sourceRoot":"","sources":["../../src/components/LanguagePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAuD,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGrF,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AA0ClC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,GAAG,iBAAiB,EAC5B,YAAY,GAAG,UAAU,EACzB,aAAa,GAAG,2BAA2B,EAC3C,iBAAiB,GAAG,iBAAiB,EACrC,IAAI,GAAG,OAAO,EACd,QAAQ,GAAG,EAAE,EACb,OAAO,GAAG,MAAM,EAChB,SAAS,EACT,aAAa,EACb,GAAG,IAAI,KACgB,EAAE;IACzB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAA;IAC1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEvC,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAA;IACjE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,E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AAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBACT,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,KAAK,MAAM,CAAA;wBAChC,OAAO,CACL,iBAEE,IAAI,EAAC,QAAQ,iBACA,0BAA0B,CAAC,CAAC,IAAI,EAAE,iBAClC,MAAM,IAAI,SAAS,kBAClB,MAAM,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;gCAClB,MAAM,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;gCACvB,OAAO,CAAC,KAAK,CAAC,CAAA;4BAChB,CAAC,EACD,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,YAExD,CAAC,CAAC,IAAI,IAXF,CAAC,CAAC,IAAI,CAYJ,CACV,CAAA;oBACH,CAAC,CAAC,GACA,GACA,IACP,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout components.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ContainerProps, FlexProps, GridProps, SpacerProps } from '@molecule/app-ui';
|
|
8
|
+
/**
|
|
9
|
+
* Container component.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Container: React.ForwardRefExoticComponent<ContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
/**
|
|
13
|
+
* Flex container component.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
/**
|
|
17
|
+
* Grid container component.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
/**
|
|
21
|
+
* Spacer component.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Spacer: React.ForwardRefExoticComponent<SpacerProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
//# sourceMappingURL=Layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/components/Layout.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAqB,MAAM,OAAO,CAAA;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAQ,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAK/F;;GAEG;AACH,eAAO,MAAM,SAAS,uFAiCrB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,IAAI,kFAkEhB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,IAAI,kFA2ChB,CAAA;AAID;;GAEG;AACH,eAAO,MAAM,MAAM,oFAoClB,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Layout components.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import { forwardRef } from 'react';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
// spacerSizeMap removed — use cm.spacer({ size, horizontal }) instead
|
|
10
|
+
/**
|
|
11
|
+
* Container component.
|
|
12
|
+
*/
|
|
13
|
+
export const Container = forwardRef(({ children, maxWidth = 'lg', centered = true, paddingX: _paddingX, className, style, testId, ...rest }, ref) => {
|
|
14
|
+
const cm = getClassMap();
|
|
15
|
+
const containerClasses = cm.cn(cm.container({ size: maxWidth }), centered && cm.mxAuto, className);
|
|
16
|
+
return (_jsx("div", { ref: ref, className: containerClasses, style: style, "data-testid": testId, ...rest, children: children }));
|
|
17
|
+
});
|
|
18
|
+
Container.displayName = 'Container';
|
|
19
|
+
/**
|
|
20
|
+
* Flex container component.
|
|
21
|
+
*/
|
|
22
|
+
export const Flex = forwardRef(({ children, direction = 'row', justify, align, wrap, gap, className, style, testId, onClick, ...rest }, ref) => {
|
|
23
|
+
const cm = getClassMap();
|
|
24
|
+
// Map direction names to classMap API ('column' -> 'col', etc.)
|
|
25
|
+
const dirMap = {
|
|
26
|
+
row: 'row',
|
|
27
|
+
column: 'col',
|
|
28
|
+
'row-reverse': 'row-reverse',
|
|
29
|
+
'column-reverse': 'col-reverse',
|
|
30
|
+
};
|
|
31
|
+
const cmDirection = dirMap[direction] || 'row';
|
|
32
|
+
// Map gap to classMap accepted values
|
|
33
|
+
const cmGap = typeof gap === 'string' && ['none', 'xs', 'sm', 'md', 'lg', 'xl'].includes(gap)
|
|
34
|
+
? gap
|
|
35
|
+
: undefined;
|
|
36
|
+
const flexClasses = cm.cn(cm.flex({
|
|
37
|
+
direction: cmDirection,
|
|
38
|
+
align: align,
|
|
39
|
+
justify: justify,
|
|
40
|
+
wrap: wrap,
|
|
41
|
+
gap: cmGap,
|
|
42
|
+
}), className);
|
|
43
|
+
// If gap is a number or non-standard string, use inline style
|
|
44
|
+
const gapStyle = typeof gap === 'number'
|
|
45
|
+
? { gap }
|
|
46
|
+
: typeof gap === 'string' && !['none', 'xs', 'sm', 'md', 'lg', 'xl'].includes(gap)
|
|
47
|
+
? { gap }
|
|
48
|
+
: undefined;
|
|
49
|
+
return (_jsx("div", { ref: ref, className: flexClasses, style: { ...style, ...gapStyle }, "data-testid": testId, onClick: onClick, ...rest, children: children }));
|
|
50
|
+
});
|
|
51
|
+
Flex.displayName = 'Flex';
|
|
52
|
+
/**
|
|
53
|
+
* Grid container component.
|
|
54
|
+
*/
|
|
55
|
+
export const Grid = forwardRef(({ children, columns, rows, gap, columnGap, rowGap, className, style, testId, ...rest }, ref) => {
|
|
56
|
+
const cm = getClassMap();
|
|
57
|
+
const cmCols = typeof columns === 'number' ? columns : undefined;
|
|
58
|
+
const cmGap = typeof gap === 'string' && ['none', 'xs', 'sm', 'md', 'lg', 'xl'].includes(gap)
|
|
59
|
+
? gap
|
|
60
|
+
: undefined;
|
|
61
|
+
const gridClasses = cm.cn(cm.grid({ cols: cmCols, gap: cmGap }), className);
|
|
62
|
+
const gridStyle = {
|
|
63
|
+
...style,
|
|
64
|
+
gridTemplateColumns: typeof columns === 'string' ? columns : undefined,
|
|
65
|
+
gridTemplateRows: typeof rows === 'string' ? rows : undefined,
|
|
66
|
+
gap: typeof gap === 'number'
|
|
67
|
+
? gap
|
|
68
|
+
: typeof gap === 'string' && !['none', 'xs', 'sm', 'md', 'lg', 'xl'].includes(gap)
|
|
69
|
+
? gap
|
|
70
|
+
: undefined,
|
|
71
|
+
columnGap: typeof columnGap === 'number'
|
|
72
|
+
? columnGap
|
|
73
|
+
: typeof columnGap === 'string'
|
|
74
|
+
? columnGap
|
|
75
|
+
: undefined,
|
|
76
|
+
rowGap: typeof rowGap === 'number' ? rowGap : typeof rowGap === 'string' ? rowGap : undefined,
|
|
77
|
+
};
|
|
78
|
+
return (_jsx("div", { ref: ref, className: gridClasses, style: gridStyle, "data-testid": testId, ...rest, children: children }));
|
|
79
|
+
});
|
|
80
|
+
Grid.displayName = 'Grid';
|
|
81
|
+
/**
|
|
82
|
+
* Spacer component.
|
|
83
|
+
*/
|
|
84
|
+
export const Spacer = forwardRef(({ size = 'md', horizontal, className, style, testId, ...rest }, ref) => {
|
|
85
|
+
const cm = getClassMap();
|
|
86
|
+
const isNamedSize = typeof size === 'string' && ['xs', 'sm', 'md', 'lg', 'xl'].includes(size);
|
|
87
|
+
const spacerClasses = cm.cn(isNamedSize
|
|
88
|
+
? cm.spacer({ size: size, horizontal: !!horizontal })
|
|
89
|
+
: horizontal
|
|
90
|
+
? cm.displayInlineBlock
|
|
91
|
+
: cm.displayBlock, className);
|
|
92
|
+
const sizeStyle = typeof size === 'number'
|
|
93
|
+
? horizontal
|
|
94
|
+
? { width: size, height: '1px' }
|
|
95
|
+
: { height: size, width: '1px' }
|
|
96
|
+
: typeof size === 'string' && !isNamedSize
|
|
97
|
+
? horizontal
|
|
98
|
+
? { width: size }
|
|
99
|
+
: { height: size }
|
|
100
|
+
: undefined;
|
|
101
|
+
return (_jsx("div", { ref: ref, className: spacerClasses, style: { ...style, ...sizeStyle }, "data-testid": testId, ...rest }));
|
|
102
|
+
});
|
|
103
|
+
Spacer.displayName = 'Spacer';
|
|
104
|
+
//# sourceMappingURL=Layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../src/components/Layout.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,sEAAsE;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CACjC,CACE,EACE,QAAQ,EACR,QAAQ,GAAG,IAAI,EACf,QAAQ,GAAG,IAAI,EACf,QAAQ,EAAE,SAAS,EACnB,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,gBAAgB,GAAG,EAAE,CAAC,EAAE,CAC5B,EAAE,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAsD,EAAE,CAAC,EAC9E,QAAQ,IAAI,EAAE,CAAC,MAAM,EACrB,SAAS,CACV,CAAA;IAED,OAAO,CACL,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,KAAK,iBACC,MAAM,KACd,IAA6C,YAEjD,QAA2B,GACxB,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA;AAEnC;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAC5B,CACE,EACE,QAAQ,EACR,SAAS,GAAG,KAAK,EACjB,OAAO,EACP,KAAK,EACL,IAAI,EACJ,GAAG,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IAAI,EAAE,IAAY,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC;QAC7D,CAAC,CAAC,UAAU;YACV,CAAC,CAAC,EAAE,CAAC,kBAAkB;YACvB,CAAC,CAAC,EAAE,CAAC,YAAY,EACrB,SAAS,CACV,CAAA;IAED,MAAM,SAAS,GACb,OAAO,IAAI,KAAK,QAAQ;QACtB,CAAC,CAAC,UAAU;YACV,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE;YAChC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;QAClC,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,WAAW;YACxC,CAAC,CAAC,UAAU;gBACV,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;gBACjB,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;YACpB,CAAC,CAAC,SAAS,CAAA;IAEjB,OAAO,CACL,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,SAAS,EAAE,iBACpB,MAAM,KACd,IAA6C,GAClD,CACH,CAAA;AACH,CAAC,CACF,CAAA;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modal component.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ModalProps } from '@molecule/app-ui';
|
|
8
|
+
/**
|
|
9
|
+
* Modal component.
|
|
10
|
+
*
|
|
11
|
+
* Renders into a `document.body` portal. Forwards any extra `data-*` or
|
|
12
|
+
* `aria-*` props on the rest spread to the inner dialog `<div>` (e.g.
|
|
13
|
+
* callers commonly pass `data-mol-id="some-modal"` for AI-agent / e2e
|
|
14
|
+
* selectors).
|
|
15
|
+
*
|
|
16
|
+
* The internal close button always carries `data-mol-id="modal-close"`
|
|
17
|
+
* as the molecule-convention default for the one fixed interactive
|
|
18
|
+
* element inside the chrome.
|
|
19
|
+
*
|
|
20
|
+
* Implements the WAI-ARIA APG dialog (modal) pattern: on open, focus moves
|
|
21
|
+
* to the first focusable element inside the dialog (or the dialog itself
|
|
22
|
+
* when it has none); Tab/Shift+Tab are trapped inside the dialog; on close,
|
|
23
|
+
* focus returns to whatever was focused before the dialog opened. Stacked
|
|
24
|
+
* dialogs (a confirm above a drawer) each register on a module-level stack —
|
|
25
|
+
* Escape and the Tab trap only act for the TOPMOST dialog, and the body
|
|
26
|
+
* scroll lock is reference-counted so closing one of several open dialogs
|
|
27
|
+
* never unlocks scroll behind the ones still open.
|
|
28
|
+
*/
|
|
29
|
+
export declare const Modal: React.ForwardRefExoticComponent<ModalProps & {
|
|
30
|
+
'data-mol-id'?: string;
|
|
31
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../src/components/Modal.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAwD,MAAM,OAAO,CAAA;AAI5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAwFlD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,KAAK;oBAA6D,MAAM;wCAkNpF,CAAA"}
|