@mohirlab/react 0.6.0 → 0.6.1
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/dist/components/accordion/accordion.d.ts +1 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/accordion.js +1 -0
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/accordion/accordion.styles.js +1 -0
- package/dist/components/accordion/index.d.ts +1 -0
- package/dist/components/avatar/avatar.css.d.ts +1 -0
- package/dist/components/avatar/avatar.css.d.ts.map +1 -1
- package/dist/components/avatar/avatar.d.ts +1 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +1 -0
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/avatar/avatar.styles.js +1 -0
- package/dist/components/avatar/index.d.ts +1 -0
- package/dist/components/badge/badge.css.d.ts +1 -0
- package/dist/components/badge/badge.css.d.ts.map +1 -1
- package/dist/components/badge/badge.d.ts +1 -0
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +1 -0
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/badge/badge.styles.js +1 -0
- package/dist/components/badge/index.d.ts +1 -0
- package/dist/components/box/box.d.ts +1 -0
- package/dist/components/box/box.d.ts.map +1 -1
- package/dist/components/box/box.js +1 -0
- package/dist/components/box/box.js.map +1 -1
- package/dist/components/box/index.d.ts +1 -0
- package/dist/components/box/stack.d.ts +1 -0
- package/dist/components/box/stack.d.ts.map +1 -1
- package/dist/components/box/stack.js +1 -0
- package/dist/components/box/stack.js.map +1 -1
- package/dist/components/button/button.css.d.ts +1 -0
- package/dist/components/button/button.css.d.ts.map +1 -1
- package/dist/components/button/button.d.ts +1 -0
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +1 -0
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button/button.styles.js +1 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/card/card-media.d.ts +1 -0
- package/dist/components/card/card-media.d.ts.map +1 -1
- package/dist/components/card/card-media.js +1 -0
- package/dist/components/card/card-media.js.map +1 -1
- package/dist/components/card/card.css.d.ts +1 -0
- package/dist/components/card/card.css.d.ts.map +1 -1
- package/dist/components/card/card.d.ts +1 -0
- package/dist/components/card/card.d.ts.map +1 -1
- package/dist/components/card/card.js +1 -0
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/card.styles.js +1 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/choice/choice.d.ts +1 -0
- package/dist/components/choice/choice.d.ts.map +1 -1
- package/dist/components/choice/choice.js +1 -0
- package/dist/components/choice/choice.js.map +1 -1
- package/dist/components/choice/choice.styles.js +1 -0
- package/dist/components/choice/index.d.ts +1 -0
- package/dist/components/dialog/dialog.css.d.ts +1 -0
- package/dist/components/dialog/dialog.css.d.ts.map +1 -1
- package/dist/components/dialog/dialog.d.ts +1 -0
- package/dist/components/dialog/dialog.d.ts.map +1 -1
- package/dist/components/dialog/dialog.js +1 -0
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dialog/dialog.styles.js +1 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/field/field-context.d.ts +1 -0
- package/dist/components/field/field-context.d.ts.map +1 -1
- package/dist/components/field/field-context.js +1 -0
- package/dist/components/field/field-context.js.map +1 -1
- package/dist/components/field/field.d.ts +1 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/field.js +1 -0
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/field.styles.js +1 -0
- package/dist/components/field/index.d.ts +1 -0
- package/dist/components/field/use-field-control.js +1 -0
- package/dist/components/field/use-field-control.js.map +1 -1
- package/dist/components/icon/icon.d.ts +1 -0
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +1 -0
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/icon/index.d.ts +1 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/input/input.css.d.ts +1 -0
- package/dist/components/input/input.css.d.ts.map +1 -1
- package/dist/components/input/input.d.ts +1 -0
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +1 -0
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/input.styles.js +1 -0
- package/dist/components/navigation/index.d.ts +1 -0
- package/dist/components/navigation/nav.d.ts +1 -0
- package/dist/components/navigation/nav.d.ts.map +1 -1
- package/dist/components/navigation/nav.js +1 -0
- package/dist/components/navigation/nav.js.map +1 -1
- package/dist/components/navigation/navigation.styles.js +1 -0
- package/dist/components/navigation/tabs.d.ts +1 -0
- package/dist/components/navigation/tabs.d.ts.map +1 -1
- package/dist/components/navigation/tabs.js +1 -0
- package/dist/components/navigation/tabs.js.map +1 -1
- package/dist/components/popover/index.d.ts +1 -0
- package/dist/components/popover/popover.css.d.ts +1 -0
- package/dist/components/popover/popover.css.d.ts.map +1 -1
- package/dist/components/popover/popover.d.ts +1 -0
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/popover/popover.js +1 -0
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/popover/popover.styles.js +1 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/select/select.d.ts +1 -0
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +1 -0
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/select.styles.js +1 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/slider/slider.d.ts +1 -0
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/slider/slider.js +1 -0
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/slider/slider.styles.js +1 -0
- package/dist/components/table/index.d.ts +1 -0
- package/dist/components/table/table.d.ts +1 -0
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +1 -0
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/table/table.styles.js +1 -0
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/text/text.css.d.ts +1 -0
- package/dist/components/text/text.css.d.ts.map +1 -1
- package/dist/components/text/text.d.ts +1 -0
- package/dist/components/text/text.d.ts.map +1 -1
- package/dist/components/text/text.js +1 -0
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/text/text.styles.js +1 -0
- package/dist/components/theme-scope/theme-scope.d.ts +1 -0
- package/dist/components/theme-scope/theme-scope.d.ts.map +1 -1
- package/dist/components/theme-scope/theme-scope.js +1 -0
- package/dist/components/theme-scope/theme-scope.js.map +1 -1
- package/dist/components/toast/index.d.ts +1 -0
- package/dist/components/toast/toast.d.ts +1 -0
- package/dist/components/toast/toast.d.ts.map +1 -1
- package/dist/components/toast/toast.js +1 -0
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toast/toast.styles.js +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-disclosure.d.ts +1 -0
- package/dist/hooks/use-disclosure.d.ts.map +1 -1
- package/dist/hooks/use-disclosure.js +1 -0
- package/dist/hooks/use-disclosure.js.map +1 -1
- package/dist/hooks/use-presence.d.ts +1 -0
- package/dist/hooks/use-presence.d.ts.map +1 -1
- package/dist/hooks/use-presence.js +1 -0
- package/dist/hooks/use-presence.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/cx.d.ts +1 -0
- package/dist/utils/cx.d.ts.map +1 -1
- package/dist/utils/cx.js +1 -0
- package/dist/utils/cx.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-context.js","names":[],"sources":["../../../src/components/field/field-context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface FieldContextValue {\n id: string;\n describedBy: string | undefined;\n invalid: boolean;\n required: boolean;\n disabled: boolean;\n}\n\nexport const FieldContext = createContext<FieldContextValue | null>(null);\n\n/** Read the surrounding `<Field>`, if any. Controls use it to wire up ARIA. */\nexport const useField = () => useContext(FieldContext);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field-context.js","names":[],"sources":["../../../src/components/field/field-context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport interface FieldContextValue {\n id: string;\n describedBy: string | undefined;\n invalid: boolean;\n required: boolean;\n disabled: boolean;\n}\n\nexport const FieldContext = createContext<FieldContextValue | null>(null);\n\n/** Read the surrounding `<Field>`, if any. Controls use it to wire up ARIA. */\nexport const useField = () => useContext(FieldContext);\n"],"mappings":";;;AAUA,MAAa,eAAe,cAAwC,IAAI;;AAGxE,MAAa,iBAAiB,WAAW,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","names":[],"sources":["../../../src/components/field/field.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.d.ts","names":[],"sources":["../../../src/components/field/field.tsx"],"mappings":";;iBAKiB,mBAAmB,KAAK;EACvC,OAAO;;EAEP,OAAO;;EAEP,QAAQ;;EAER;EACA;EACA;;EAEA;;EAEA,gBAAgB;EAChB,UAAU;;wBAGI,QACd,OACA,MACA,OACA,UACA,UACA,UACA,IACA,eACA,WACA,aACG,QACF,6BAAU,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":["label","hint","error","styles.field","styles.labelRow","styles.label"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["import { useId, useMemo, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { cx } from '../../utils/cx';\nimport { FieldContext } from './field-context';\nimport * as styles from './field.css';\n\nexport interface FieldProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n label: ReactNode;\n /** Help text under the control. Linked with `aria-describedby`. */\n hint?: ReactNode;\n /** Error message. Marks the control `aria-invalid` and replaces nothing: the hint stays. */\n error?: ReactNode;\n /** Shows an \"Optional\" tag. Mohirlab marks optional fields, not required ones. */\n optional?: boolean;\n required?: boolean;\n disabled?: boolean;\n /** Override the generated control id. */\n id?: string;\n /** Text shown for optional fields, for localisation. */\n optionalLabel?: ReactNode;\n children: ReactNode;\n}\n\nexport function Field({\n label,\n hint,\n error,\n optional = false,\n required = false,\n disabled = false,\n id,\n optionalLabel = 'Optional',\n className,\n children,\n ...rest\n}: FieldProps) {\n const generated = useId();\n const controlId = id ?? `ml-field-${generated}`;\n const hintId = hint ? `${controlId}-hint` : undefined;\n const errorId = error ? `${controlId}-error` : undefined;\n const describedBy = [errorId, hintId].filter(Boolean).join(' ') || undefined;\n\n const context = useMemo(\n () => ({ id: controlId, describedBy, invalid: Boolean(error), required, disabled }),\n [controlId, describedBy, error, required, disabled],\n );\n\n return (\n <div {...rest} className={cx(styles.field, className)}>\n <div className={styles.labelRow}>\n <label htmlFor={controlId} className={styles.label}>\n {label}\n </label>\n {optional && <span className={styles.optionalTag}>{optionalLabel}</span>}\n </div>\n <FieldContext.Provider value={context}>{children}</FieldContext.Provider>\n {error && (\n <p id={errorId} className={styles.error}>\n <span className={styles.errorMark} aria-hidden=\"true\" />\n {error}\n </p>\n )}\n {hint && (\n <p id={hintId} className={styles.hint}>\n {hint}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.js","names":["label","hint","error","styles.field","styles.labelRow","styles.label"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["import { useId, useMemo, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { cx } from '../../utils/cx';\nimport { FieldContext } from './field-context';\nimport * as styles from './field.css';\n\nexport interface FieldProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {\n label: ReactNode;\n /** Help text under the control. Linked with `aria-describedby`. */\n hint?: ReactNode;\n /** Error message. Marks the control `aria-invalid` and replaces nothing: the hint stays. */\n error?: ReactNode;\n /** Shows an \"Optional\" tag. Mohirlab marks optional fields, not required ones. */\n optional?: boolean;\n required?: boolean;\n disabled?: boolean;\n /** Override the generated control id. */\n id?: string;\n /** Text shown for optional fields, for localisation. */\n optionalLabel?: ReactNode;\n children: ReactNode;\n}\n\nexport function Field({\n label,\n hint,\n error,\n optional = false,\n required = false,\n disabled = false,\n id,\n optionalLabel = 'Optional',\n className,\n children,\n ...rest\n}: FieldProps) {\n const generated = useId();\n const controlId = id ?? `ml-field-${generated}`;\n const hintId = hint ? `${controlId}-hint` : undefined;\n const errorId = error ? `${controlId}-error` : undefined;\n const describedBy = [errorId, hintId].filter(Boolean).join(' ') || undefined;\n\n const context = useMemo(\n () => ({ id: controlId, describedBy, invalid: Boolean(error), required, disabled }),\n [controlId, describedBy, error, required, disabled],\n );\n\n return (\n <div {...rest} className={cx(styles.field, className)}>\n <div className={styles.labelRow}>\n <label htmlFor={controlId} className={styles.label}>\n {label}\n </label>\n {optional && <span className={styles.optionalTag}>{optionalLabel}</span>}\n </div>\n <FieldContext.Provider value={context}>{children}</FieldContext.Provider>\n {error && (\n <p id={errorId} className={styles.error}>\n <span className={styles.errorMark} aria-hidden=\"true\" />\n {error}\n </p>\n )}\n {hint && (\n <p id={hintId} className={styles.hint}>\n {hint}\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAsBA,SAAgB,MAAM,EACpBA,OAAAA,SACAC,MAAAA,QACAC,OAAAA,SACA,WAAW,OACX,WAAW,OACX,WAAW,OACX,IACA,gBAAgB,YAChB,WACA,UACA,GAAG,QACU;CACb,MAAM,YAAY,MAAM;CACxB,MAAM,YAAY,MAAM,YAAY;CACpC,MAAM,SAASD,SAAO,GAAG,UAAU,SAAS,KAAA;CAC5C,MAAM,UAAUC,UAAQ,GAAG,UAAU,UAAU,KAAA;CAC/C,MAAM,cAAc,CAAC,SAAS,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;CAEnE,MAAM,UAAU,eACP;EAAE,IAAI;EAAW;EAAa,SAAS,QAAQA,OAAK;EAAG;EAAU;CAAS,IACjF;EAAC;EAAW;EAAaA;EAAO;EAAU;CAAQ,CACpD;CAEA,OACE,qBAAC,OAAD;EAAK,GAAI;EAAM,WAAW,GAAGC,OAAc,SAAS;EAApD,UAAA;GACE,qBAAC,OAAD;IAAK,WAAWC;IAAhB,UAAA,CACE,oBAAC,SAAD;KAAO,SAAS;KAAW,WAAWC;KACnCL,UAAAA;IACI,CAAA,GACN,YAAY,oBAAC,QAAD;KAAM,WAAW;KAAqB,UAAA;IAAoB,CAAA,CACpE;;GACL,oBAAC,aAAa,UAAd;IAAuB,OAAO;IAAU;GAAgC,CAAA;GACvEE,WACC,qBAAC,KAAD;IAAG,IAAI;IAAS,WAAW;IAA3B,UAAA,CACE,oBAAC,QAAD;KAAM,WAAW;KAAkB,eAAY;IAAQ,CAAA,GACtDA,OACA;;GAEJD,UACC,oBAAC,KAAD;IAAG,IAAI;IAAQ,WAAW;IACvBA,UAAAA;GACA,CAAA;EAEF;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-field-control.js","names":[],"sources":["../../../src/components/field/use-field-control.ts"],"sourcesContent":["import { useField } from './field-context';\n\ninterface ControlProps {\n id?: string;\n required?: boolean;\n disabled?: boolean;\n invalid?: boolean;\n 'aria-describedby'?: string;\n}\n\n/**\n * Props a form control takes from the surrounding `<Field>`: id (for the label),\n * required, disabled, invalid state and the hint/error description. Anything set\n * on the control itself wins; descriptions are merged.\n */\nexport function useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': describedBy,\n}: ControlProps) {\n const field = useField();\n const isInvalid = invalid ?? field?.invalid ?? false;\n return {\n id: id ?? field?.id,\n required: required ?? field?.required,\n disabled: disabled ?? field?.disabled,\n 'aria-invalid': isInvalid || undefined,\n 'aria-describedby': [field?.describedBy, describedBy].filter(Boolean).join(' ') || undefined,\n } as const;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-field-control.js","names":[],"sources":["../../../src/components/field/use-field-control.ts"],"sourcesContent":["import { useField } from './field-context';\n\ninterface ControlProps {\n id?: string;\n required?: boolean;\n disabled?: boolean;\n invalid?: boolean;\n 'aria-describedby'?: string;\n}\n\n/**\n * Props a form control takes from the surrounding `<Field>`: id (for the label),\n * required, disabled, invalid state and the hint/error description. Anything set\n * on the control itself wins; descriptions are merged.\n */\nexport function useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': describedBy,\n}: ControlProps) {\n const field = useField();\n const isInvalid = invalid ?? field?.invalid ?? false;\n return {\n id: id ?? field?.id,\n required: required ?? field?.required,\n disabled: disabled ?? field?.disabled,\n 'aria-invalid': isInvalid || undefined,\n 'aria-describedby': [field?.describedBy, describedBy].filter(Boolean).join(' ') || undefined,\n } as const;\n}\n"],"mappings":";;;;;;;;AAeA,SAAgB,gBAAgB,EAC9B,IACA,UACA,UACA,SACA,oBAAoB,eACL;CACf,MAAM,QAAQ,SAAS;CACvB,MAAM,YAAY,WAAW,OAAO,WAAW;CAC/C,OAAO;EACL,IAAI,MAAM,OAAO;EACjB,UAAU,YAAY,OAAO;EAC7B,UAAU,YAAY,OAAO;EAC7B,gBAAgB,aAAa,KAAA;EAC7B,oBAAoB,CAAC,OAAO,aAAa,WAAW,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAAK,KAAA;CACrF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","names":[],"sources":["../../../src/components/icon/icon.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon.d.ts","names":[],"sources":["../../../src/components/icon/icon.tsx"],"mappings":";;;iBAGiB,kBAAkB,KAAK,SAAS;;EAE/C,MAAM;;EAEN;EACA;;EAEA;;wBAOc,OAAO,MAAM,MAAiB,aAAa,UAAU,QAAQ,4BAAS,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","names":[],"sources":["../../../src/components/icon/icon.tsx"],"sourcesContent":["import { createElement, type SVGProps } from 'react';\nimport { defaultAttributes, type IconData } from '@mohirlab/icons';\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {\n /** Icon data from `@mohirlab/icons`, e.g. `iconHeart`. Import only what you use. */\n icon: IconData;\n /** Pixel size or any CSS length. Default `1.25em`, so icons follow text size. */\n size?: number | string;\n strokeWidth?: number | string;\n /** Accessible name. Without it the icon is decorative and hidden from assistive tech. */\n label?: string;\n}\n\n// SVG attribute names → React prop names, for the few that differ.\nconst reactName = (attr: string) => attr.replace(/-(\\w)/g, (_, c: string) => c.toUpperCase());\nconst defaults = Object.fromEntries(Object.entries(defaultAttributes).map(([k, v]) => [reactName(k), v]));\n\nexport function Icon({ icon, size = '1.25em', strokeWidth, label, ...rest }: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n width={size}\n height={size}\n {...defaults}\n {...(strokeWidth === undefined ? {} : { strokeWidth })}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n focusable=\"false\"\n data-icon={icon.name}\n {...rest}\n >\n {icon.nodes.map(([tag, attrs], i) =>\n createElement(tag, {\n key: i,\n ...Object.fromEntries(Object.entries(attrs).map(([k, v]) => [reactName(k), v])),\n }),\n )}\n </svg>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon.js","names":[],"sources":["../../../src/components/icon/icon.tsx"],"sourcesContent":["import { createElement, type SVGProps } from 'react';\nimport { defaultAttributes, type IconData } from '@mohirlab/icons';\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'children'> {\n /** Icon data from `@mohirlab/icons`, e.g. `iconHeart`. Import only what you use. */\n icon: IconData;\n /** Pixel size or any CSS length. Default `1.25em`, so icons follow text size. */\n size?: number | string;\n strokeWidth?: number | string;\n /** Accessible name. Without it the icon is decorative and hidden from assistive tech. */\n label?: string;\n}\n\n// SVG attribute names → React prop names, for the few that differ.\nconst reactName = (attr: string) => attr.replace(/-(\\w)/g, (_, c: string) => c.toUpperCase());\nconst defaults = Object.fromEntries(Object.entries(defaultAttributes).map(([k, v]) => [reactName(k), v]));\n\nexport function Icon({ icon, size = '1.25em', strokeWidth, label, ...rest }: IconProps) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n width={size}\n height={size}\n {...defaults}\n {...(strokeWidth === undefined ? {} : { strokeWidth })}\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n focusable=\"false\"\n data-icon={icon.name}\n {...rest}\n >\n {icon.nodes.map(([tag, attrs], i) =>\n createElement(tag, {\n key: i,\n ...Object.fromEntries(Object.entries(attrs).map(([k, v]) => [reactName(k), v])),\n }),\n )}\n </svg>\n );\n}\n"],"mappings":";;;;;AAcA,MAAM,aAAa,SAAiB,KAAK,QAAQ,WAAW,GAAG,MAAc,EAAE,YAAY,CAAC;AAC5F,MAAM,WAAW,OAAO,YAAY,OAAO,QAAQ,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAExG,SAAgB,KAAK,EAAE,MAAM,OAAO,UAAU,aAAa,OAAO,GAAG,QAAmB;CACtF,OACE,oBAAC,OAAD;EACE,OAAM;EACN,SAAQ;EACR,OAAO;EACP,QAAQ;EACR,GAAI;EACJ,GAAK,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY;EACpD,MAAM,QAAQ,QAAQ,KAAA;EACtB,cAAY;EACZ,eAAa,QAAQ,KAAA,IAAY;EACjC,WAAU;EACV,aAAW,KAAK;EAChB,GAAI;EAEH,UAAA,KAAK,MAAM,KAAK,CAAC,KAAK,QAAQ,MAC7B,cAAc,KAAK;GACjB,KAAK;GACL,GAAG,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;EAChF,CAAC,CACH;CACG,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.css.d.ts","names":[],"sources":["../../../src/components/input/input.css.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.css.d.ts","names":[],"sources":["../../../src/components/input/input.css.ts"],"mappings":";;;;;;qBAgBa,0CAAK;;IAqCZ,mCAAE;IACF,mCAAE;IACF,mCAAE;;;YAMI,gBAAgB,YAAY,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","names":[],"sources":["../../../src/components/input/input.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.d.ts","names":[],"sources":["../../../src/components/input/input.tsx"],"mappings":";;;iBAMiB,mBAAmB,KAAK;EACvC,OAAO;;EAEP;;wBAGc,QAAQ,MAAM,SAAS,WAAW,IAAI,UAAU,aAAa,QAAQ,6BAAU,IAAA;iBAW9E,sBAAsB;EACrC;;;;;;EAMA;;EAEA;;wBAGc,WACd,SACA,UACA,MACA,SACA,WACA,OACA,IACA,UACA,aACG,QACF,gCAAa,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","names":["maxRows","maxRowsVar"],"sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { input, maxRows as maxRowsVar, textarea, type InputVariants } from './input.css';\n\nexport interface InputProps extends Omit<ComponentPropsWithRef<'input'>, 'size'> {\n size?: InputVariants['size'];\n /** Mark as invalid. Inside a `<Field error>` this is set for you. */\n invalid?: boolean;\n}\n\nexport function Input({ size, invalid, className, id, required, disabled, ...rest }: InputProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n return <input {...rest} {...control} className={cx(input({ size }), className)} />;\n}\n\nexport interface TextareaProps extends ComponentPropsWithRef<'textarea'> {\n invalid?: boolean;\n /**\n * Grow with the content up to `maxRows`, where the browser supports CSS\n * `field-sizing` (Chrome 123, Safari 26.2, Firefox 152). Elsewhere the user can\n * resize it. Default true.\n */\n autoGrow?: boolean;\n /** Upper bound for auto-grow, in lines. Default 10. */\n maxRows?: number;\n}\n\nexport function Textarea({\n invalid,\n autoGrow = true,\n rows = 3,\n maxRows = 10,\n className,\n style,\n id,\n required,\n disabled,\n ...rest\n}: TextareaProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n return (\n <textarea\n {...rest}\n {...control}\n rows={rows}\n data-autogrow={autoGrow || undefined}\n className={cx(input({ size: 'md' }), textarea, className)}\n style={{ ...style, ...assignInlineVars({ [maxRowsVar]: String(maxRows) }) }}\n />\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.js","names":["maxRows","maxRowsVar"],"sources":["../../../src/components/input/input.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { input, maxRows as maxRowsVar, textarea, type InputVariants } from './input.css';\n\nexport interface InputProps extends Omit<ComponentPropsWithRef<'input'>, 'size'> {\n size?: InputVariants['size'];\n /** Mark as invalid. Inside a `<Field error>` this is set for you. */\n invalid?: boolean;\n}\n\nexport function Input({ size, invalid, className, id, required, disabled, ...rest }: InputProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n return <input {...rest} {...control} className={cx(input({ size }), className)} />;\n}\n\nexport interface TextareaProps extends ComponentPropsWithRef<'textarea'> {\n invalid?: boolean;\n /**\n * Grow with the content up to `maxRows`, where the browser supports CSS\n * `field-sizing` (Chrome 123, Safari 26.2, Firefox 152). Elsewhere the user can\n * resize it. Default true.\n */\n autoGrow?: boolean;\n /** Upper bound for auto-grow, in lines. Default 10. */\n maxRows?: number;\n}\n\nexport function Textarea({\n invalid,\n autoGrow = true,\n rows = 3,\n maxRows = 10,\n className,\n style,\n id,\n required,\n disabled,\n ...rest\n}: TextareaProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n return (\n <textarea\n {...rest}\n {...control}\n rows={rows}\n data-autogrow={autoGrow || undefined}\n className={cx(input({ size: 'md' }), textarea, className)}\n style={{ ...style, ...assignInlineVars({ [maxRowsVar]: String(maxRows) }) }}\n />\n );\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,MAAM,EAAE,MAAM,SAAS,WAAW,IAAI,UAAU,UAAU,GAAG,QAAoB;CAC/F,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CACD,OAAO,oBAAC,SAAD;EAAO,GAAI;EAAM,GAAI;EAAS,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS;CAAI,CAAA;AACnF;AAcA,SAAgB,SAAS,EACvB,SACA,WAAW,MACX,OAAO,GACPA,SAAAA,YAAU,IACV,WACA,OACA,IACA,UACA,UACA,GAAG,QACa;CAChB,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CACD,OACE,oBAAC,YAAD;EACE,GAAI;EACJ,GAAI;EACE;EACN,iBAAe,YAAY,KAAA;EAC3B,WAAW,GAAG,MAAM,EAAE,MAAM,KAAK,CAAC,GAAG,UAAU,SAAS;EACxD,OAAO;GAAE,GAAG;GAAO,GAAG,iBAAiB,GAAGC,UAAa,OAAOD,SAAO,EAAE,CAAC;EAAE;CAC3E,CAAA;AAEL"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { Tab, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, Tabs, TabsProps } from "./tabs.js";
|
|
2
3
|
import { BottomNav, BottomNavItem, BottomNavProps, BottomNavSpacer, Breadcrumbs, BreadcrumbsProps, Crumb, SegmentedControl, SegmentedControlProps, SegmentedOption } from "./nav.js";
|
|
3
4
|
export { BottomNav, BottomNavItem, type BottomNavProps, BottomNavSpacer, Breadcrumbs, type BreadcrumbsProps, type Crumb, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.d.ts","names":[],"sources":["../../../src/components/navigation/nav.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nav.d.ts","names":[],"sources":["../../../src/components/navigation/nav.tsx"],"mappings":";;;iBAQiB;EACf;EACA,OAAO;EACP,OAAO;EACP;;iBAGe,8BAA8B,KAC7C;;EAIA;EACA,SAAS;EACT;EACA;EACA,iBAAiB;EACjB;;EAEA;;;;;;wBAOc,mBACd,SACA,OACA,cACA,eACA,MACA,WACA,cACG,QACF,wCAAqB,IAAA;iBAqCP,uBAAuB;;EAEtC;;EAEA;;;;;;;wBAQc,YAAY,UAAqB,cAAc,QAAQ,iCAAc,IAAA;KAIhF;EACH,MAAM;EACN;;EAEA;;EAEA;EACA;;EAEK;IAAiB,KAAK;EACtB;IAAqB,KAAK;wBAGjB,gBAAgB,MAAM,OAAO,SAAS,OAAO,cAAc,QAAQ,qCAAkB,IAAA;;wBAiCrF,kBAAkB,YAAuB,KAAK,8CAA2B,IAAA;iBAMxE;EACf,OAAO;EACP;;iBAGe,yBAAyB,KAAK;;EAE7C,OAAO;;;;;;wBAOO,cACd,OACA,yBACc,cACX,QACF,mCAAgB,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.js","names":["styles.segmented","styles.segment","styles.segmentInput","styles.segmentLabel","styles.bottomNav","styles.bottomBadge","styles.bottomItem","styles.bottomNavSpacer","styles.crumbs","styles.crumb","styles.crumbCurrent","styles.crumbLink"],"sources":["../../../src/components/navigation/nav.tsx"],"sourcesContent":["import { useId, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { iconArrowLeft, iconChevronRight, type IconData } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './navigation.css';\n\n/* ---------------------------------------------------- Segmented control */\n\nexport interface SegmentedOption {\n value: string;\n label: ReactNode;\n icon?: IconData;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps extends Omit<\n ComponentPropsWithRef<'div'>,\n 'defaultValue' | 'onChange' | 'children'\n> {\n /** Names the choice, e.g. \"View\". */\n 'aria-label': string;\n options: SegmentedOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n name?: string;\n /** Stretch to the container width, segments sharing it equally. */\n fullWidth?: boolean;\n}\n\n/**\n * One choice from two to five short options, such as a view or a time range. Native\n * radios underneath: arrow keys move the choice, and it submits with forms.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onValueChange,\n name,\n fullWidth,\n className,\n ...rest\n}: SegmentedControlProps) {\n const generated = useId();\n const [internal, setInternal] = useState(defaultValue ?? options[0]?.value);\n const current = value ?? internal;\n return (\n <div\n {...rest}\n role=\"radiogroup\"\n data-full-width={fullWidth || undefined}\n className={cx(styles.segmented, className)}\n >\n {options.map((option) => (\n <label key={option.value} className={styles.segment}>\n <input\n type=\"radio\"\n className={styles.segmentInput}\n name={name ?? `ml-seg-${generated}`}\n value={option.value}\n checked={current === option.value}\n disabled={option.disabled}\n onChange={() => {\n if (value === undefined) setInternal(option.value);\n onValueChange?.(option.value);\n }}\n />\n <span className={styles.segmentLabel}>\n {option.icon && <Icon icon={option.icon} size={16} />}\n {option.label}\n </span>\n </label>\n ))}\n </div>\n );\n}\n\n/* ---------------------------------------------------------- Bottom nav */\n\nexport interface BottomNavProps extends ComponentPropsWithRef<'nav'> {\n /** Names the navigation, e.g. \"Main\". */\n 'aria-label': string;\n /** Hide from this breakpoint up, where a sidebar or top bar takes over. Default tablet. */\n hideFrom?: 'tablet' | 'desktop' | 'never';\n}\n\n/**\n * The phone tab bar: three to five top-level destinations, fixed to the bottom and\n * clear of the home indicator. Add a `BottomNavSpacer` at the end of the page so\n * content can scroll past it.\n */\nexport function BottomNav({ hideFrom = 'tablet', className, ...rest }: BottomNavProps) {\n return <nav {...rest} data-hide-from={hideFrom} className={cx(styles.bottomNav, className)} />;\n}\n\ntype BottomNavItemProps = {\n icon: IconData;\n label: string;\n /** Marks the current destination (`aria-current=\"page\"`). */\n current?: boolean;\n /** A count such as unread messages; announced with the label. */\n badge?: number;\n className?: string;\n} & (\n | ({ href: string } & Omit<ComponentPropsWithRef<'a'>, 'children'>)\n | ({ href?: undefined } & Omit<ComponentPropsWithRef<'button'>, 'children'>)\n);\n\nexport function BottomNavItem({ icon, label, current, badge, className, ...rest }: BottomNavItemProps) {\n const content = (\n <>\n <Icon icon={icon} size={22} />\n <span>{label}</span>\n {badge ? (\n <span className={styles.bottomBadge} aria-hidden=\"true\">\n {badge > 99 ? '99+' : badge}\n </span>\n ) : null}\n </>\n );\n const shared = {\n className: cx(styles.bottomItem, className),\n 'aria-current': current ? ('page' as const) : undefined,\n // The visual badge is hidden; the count is part of the accessible name instead.\n 'aria-label': badge ? `${label}, ${badge}` : undefined,\n };\n if (rest.href !== undefined) {\n return (\n <a {...(rest as ComponentPropsWithRef<'a'>)} {...shared}>\n {content}\n </a>\n );\n }\n return (\n <button type=\"button\" {...(rest as ComponentPropsWithRef<'button'>)} {...shared}>\n {content}\n </button>\n );\n}\n\n/** Reserves room under the page content for the bottom nav (on the same breakpoints). */\nexport function BottomNavSpacer({ hideFrom = 'tablet' }: Pick<BottomNavProps, 'hideFrom'>) {\n return <div aria-hidden=\"true\" data-hide-from={hideFrom} className={styles.bottomNavSpacer} />;\n}\n\n/* --------------------------------------------------------- Breadcrumbs */\n\nexport interface Crumb {\n label: ReactNode;\n href?: string;\n}\n\nexport interface BreadcrumbsProps extends Omit<ComponentPropsWithRef<'nav'>, 'children'> {\n /** From the top level down to the current page (last, not linked). */\n items: Crumb[];\n}\n\n/**\n * Where the current page sits in the hierarchy. On phones it collapses to a single\n * \"← Parent\" back link, the thing people actually use a trail for on a small screen.\n */\nexport function Breadcrumbs({\n items,\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: BreadcrumbsProps) {\n const parent = items.length > 1 ? items[items.length - 2] : undefined;\n return (\n <nav {...rest} aria-label={ariaLabel} className={className}>\n <ol className={styles.crumbs}>\n {parent?.href && (\n <li className={styles.crumbBack}>\n <a className={styles.crumbLink} href={parent.href}>\n <Icon icon={iconArrowLeft} size={16} /> {parent.label}\n </a>\n </li>\n )}\n {items.map((item, index) => {\n const last = index === items.length - 1;\n return (\n <li key={index} className={styles.crumb}>\n {last || !item.href ? (\n <span className={styles.crumbCurrent} aria-current={last ? 'page' : undefined}>\n {item.label}\n </span>\n ) : (\n <a className={styles.crumbLink} href={item.href}>\n {item.label}\n </a>\n )}\n {!last && <Icon icon={iconChevronRight} size={14} className={styles.crumbSeparator} />}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"nav.js","names":["styles.segmented","styles.segment","styles.segmentInput","styles.segmentLabel","styles.bottomNav","styles.bottomBadge","styles.bottomItem","styles.bottomNavSpacer","styles.crumbs","styles.crumb","styles.crumbCurrent","styles.crumbLink"],"sources":["../../../src/components/navigation/nav.tsx"],"sourcesContent":["import { useId, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { iconArrowLeft, iconChevronRight, type IconData } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './navigation.css';\n\n/* ---------------------------------------------------- Segmented control */\n\nexport interface SegmentedOption {\n value: string;\n label: ReactNode;\n icon?: IconData;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps extends Omit<\n ComponentPropsWithRef<'div'>,\n 'defaultValue' | 'onChange' | 'children'\n> {\n /** Names the choice, e.g. \"View\". */\n 'aria-label': string;\n options: SegmentedOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n name?: string;\n /** Stretch to the container width, segments sharing it equally. */\n fullWidth?: boolean;\n}\n\n/**\n * One choice from two to five short options, such as a view or a time range. Native\n * radios underneath: arrow keys move the choice, and it submits with forms.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onValueChange,\n name,\n fullWidth,\n className,\n ...rest\n}: SegmentedControlProps) {\n const generated = useId();\n const [internal, setInternal] = useState(defaultValue ?? options[0]?.value);\n const current = value ?? internal;\n return (\n <div\n {...rest}\n role=\"radiogroup\"\n data-full-width={fullWidth || undefined}\n className={cx(styles.segmented, className)}\n >\n {options.map((option) => (\n <label key={option.value} className={styles.segment}>\n <input\n type=\"radio\"\n className={styles.segmentInput}\n name={name ?? `ml-seg-${generated}`}\n value={option.value}\n checked={current === option.value}\n disabled={option.disabled}\n onChange={() => {\n if (value === undefined) setInternal(option.value);\n onValueChange?.(option.value);\n }}\n />\n <span className={styles.segmentLabel}>\n {option.icon && <Icon icon={option.icon} size={16} />}\n {option.label}\n </span>\n </label>\n ))}\n </div>\n );\n}\n\n/* ---------------------------------------------------------- Bottom nav */\n\nexport interface BottomNavProps extends ComponentPropsWithRef<'nav'> {\n /** Names the navigation, e.g. \"Main\". */\n 'aria-label': string;\n /** Hide from this breakpoint up, where a sidebar or top bar takes over. Default tablet. */\n hideFrom?: 'tablet' | 'desktop' | 'never';\n}\n\n/**\n * The phone tab bar: three to five top-level destinations, fixed to the bottom and\n * clear of the home indicator. Add a `BottomNavSpacer` at the end of the page so\n * content can scroll past it.\n */\nexport function BottomNav({ hideFrom = 'tablet', className, ...rest }: BottomNavProps) {\n return <nav {...rest} data-hide-from={hideFrom} className={cx(styles.bottomNav, className)} />;\n}\n\ntype BottomNavItemProps = {\n icon: IconData;\n label: string;\n /** Marks the current destination (`aria-current=\"page\"`). */\n current?: boolean;\n /** A count such as unread messages; announced with the label. */\n badge?: number;\n className?: string;\n} & (\n | ({ href: string } & Omit<ComponentPropsWithRef<'a'>, 'children'>)\n | ({ href?: undefined } & Omit<ComponentPropsWithRef<'button'>, 'children'>)\n);\n\nexport function BottomNavItem({ icon, label, current, badge, className, ...rest }: BottomNavItemProps) {\n const content = (\n <>\n <Icon icon={icon} size={22} />\n <span>{label}</span>\n {badge ? (\n <span className={styles.bottomBadge} aria-hidden=\"true\">\n {badge > 99 ? '99+' : badge}\n </span>\n ) : null}\n </>\n );\n const shared = {\n className: cx(styles.bottomItem, className),\n 'aria-current': current ? ('page' as const) : undefined,\n // The visual badge is hidden; the count is part of the accessible name instead.\n 'aria-label': badge ? `${label}, ${badge}` : undefined,\n };\n if (rest.href !== undefined) {\n return (\n <a {...(rest as ComponentPropsWithRef<'a'>)} {...shared}>\n {content}\n </a>\n );\n }\n return (\n <button type=\"button\" {...(rest as ComponentPropsWithRef<'button'>)} {...shared}>\n {content}\n </button>\n );\n}\n\n/** Reserves room under the page content for the bottom nav (on the same breakpoints). */\nexport function BottomNavSpacer({ hideFrom = 'tablet' }: Pick<BottomNavProps, 'hideFrom'>) {\n return <div aria-hidden=\"true\" data-hide-from={hideFrom} className={styles.bottomNavSpacer} />;\n}\n\n/* --------------------------------------------------------- Breadcrumbs */\n\nexport interface Crumb {\n label: ReactNode;\n href?: string;\n}\n\nexport interface BreadcrumbsProps extends Omit<ComponentPropsWithRef<'nav'>, 'children'> {\n /** From the top level down to the current page (last, not linked). */\n items: Crumb[];\n}\n\n/**\n * Where the current page sits in the hierarchy. On phones it collapses to a single\n * \"← Parent\" back link, the thing people actually use a trail for on a small screen.\n */\nexport function Breadcrumbs({\n items,\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: BreadcrumbsProps) {\n const parent = items.length > 1 ? items[items.length - 2] : undefined;\n return (\n <nav {...rest} aria-label={ariaLabel} className={className}>\n <ol className={styles.crumbs}>\n {parent?.href && (\n <li className={styles.crumbBack}>\n <a className={styles.crumbLink} href={parent.href}>\n <Icon icon={iconArrowLeft} size={16} /> {parent.label}\n </a>\n </li>\n )}\n {items.map((item, index) => {\n const last = index === items.length - 1;\n return (\n <li key={index} className={styles.crumb}>\n {last || !item.href ? (\n <span className={styles.crumbCurrent} aria-current={last ? 'page' : undefined}>\n {item.label}\n </span>\n ) : (\n <a className={styles.crumbLink} href={item.href}>\n {item.label}\n </a>\n )}\n {!last && <Icon icon={iconChevronRight} size={14} className={styles.crumbSeparator} />}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgB,iBAAiB,EAC/B,SACA,OACA,cACA,eACA,MACA,WACA,WACA,GAAG,QACqB;CACxB,MAAM,YAAY,MAAM;CACxB,MAAM,CAAC,UAAU,eAAe,SAAS,gBAAgB,QAAQ,EAAE,EAAE,KAAK;CAC1E,MAAM,UAAU,SAAS;CACzB,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,MAAK;EACL,mBAAiB,aAAa,KAAA;EAC9B,WAAW,GAAGA,WAAkB,SAAS;EAExC,UAAA,QAAQ,KAAK,WACZ,qBAAC,SAAD;GAA0B,WAAWC;GAArC,UAAA,CACE,oBAAC,SAAD;IACE,MAAK;IACL,WAAWC;IACX,MAAM,QAAQ,UAAU;IACxB,OAAO,OAAO;IACd,SAAS,YAAY,OAAO;IAC5B,UAAU,OAAO;IACjB,gBAAgB;KACd,IAAI,UAAU,KAAA,GAAW,YAAY,OAAO,KAAK;KACjD,gBAAgB,OAAO,KAAK;IAC9B;GACD,CAAA,GACD,qBAAC,QAAD;IAAM,WAAWC;IAAjB,UAAA,CACG,OAAO,QAAQ,oBAAC,MAAD;KAAM,MAAM,OAAO;KAAM,MAAM;IAAK,CAAA,GACnD,OAAO,KACJ;GACD,CAAA,CAAA;EAjBK,GAAA,OAAO,KAiBZ,CACR;CACE,CAAA;AAET;;;;;;AAgBA,SAAgB,UAAU,EAAE,WAAW,UAAU,WAAW,GAAG,QAAwB;CACrF,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,kBAAgB;EAAU,WAAW,GAAGC,WAAkB,SAAS;CAAI,CAAA;AAC/F;AAeA,SAAgB,cAAc,EAAE,MAAM,OAAO,SAAS,OAAO,WAAW,GAAG,QAA4B;CACrG,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,MAAD;GAAY;GAAM,MAAM;EAAK,CAAA;EAC7B,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;EAClB,QACC,oBAAC,QAAD;GAAM,WAAWC;GAAoB,eAAY;GAC9C,UAAA,QAAQ,KAAK,QAAQ;EAClB,CAAA,IACJ;CACJ,EAAA,CAAA;CAEJ,MAAM,SAAS;EACb,WAAW,GAAGC,YAAmB,SAAS;EAC1C,gBAAgB,UAAW,SAAmB,KAAA;EAE9C,cAAc,QAAQ,GAAG,MAAM,IAAI,UAAU,KAAA;CAC/C;CACA,IAAI,KAAK,SAAS,KAAA,GAChB,OACE,oBAAC,KAAD;EAAG,GAAK;EAAqC,GAAI;EAC9C,UAAA;CACA,CAAA;CAGP,OACE,oBAAC,UAAD;EAAQ,MAAK;EAAS,GAAK;EAA0C,GAAI;EACtE,UAAA;CACK,CAAA;AAEZ;;AAGA,SAAgB,gBAAgB,EAAE,WAAW,YAA8C;CACzF,OAAO,oBAAC,OAAD;EAAK,eAAY;EAAO,kBAAgB;EAAU,WAAWC;CAAyB,CAAA;AAC/F;;;;;AAkBA,SAAgB,YAAY,EAC1B,OACA,WACA,cAAc,YAAY,cAC1B,GAAG,QACgB;CACnB,MAAM,SAAS,MAAM,SAAS,IAAI,MAAM,MAAM,SAAS,KAAK,KAAA;CAC5D,OACE,oBAAC,OAAD;EAAK,GAAI;EAAM,cAAY;EAAsB;EAC/C,UAAA,qBAAC,MAAD;GAAI,WAAWC;GAAf,UAAA,CACG,QAAQ,QACP,oBAAC,MAAD;IAAI,WAAW;IACb,UAAA,qBAAC,KAAD;KAAG,WAAW;KAAkB,MAAM,OAAO;KAA7C,UAAA;MACE,oBAAC,MAAD;OAAM,MAAM;OAAe,MAAM;MAAK,CAAA;MAAC;MAAE,OAAO;KAC/C;;GACD,CAAA,GAEL,MAAM,KAAK,MAAM,UAAU;IAC1B,MAAM,OAAO,UAAU,MAAM,SAAS;IACtC,OACE,qBAAC,MAAD;KAAgB,WAAWC;KAA3B,UAAA,CACG,QAAQ,CAAC,KAAK,OACb,oBAAC,QAAD;MAAM,WAAWC;MAAqB,gBAAc,OAAO,SAAS,KAAA;MACjE,UAAA,KAAK;KACF,CAAA,IAEN,oBAAC,KAAD;MAAG,WAAWC;MAAkB,MAAM,KAAK;MACxC,UAAA,KAAK;KACL,CAAA,GAEJ,CAAC,QAAQ,oBAAC,MAAD;MAAM,MAAM;MAAkB,MAAM;MAAI,WAAW;KAAwB,CAAA,CACnF;IAXK,GAAA,KAWL;GAER,CAAC,CACC;;CACD,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","names":[],"sources":["../../../src/components/navigation/tabs.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","names":[],"sources":["../../../src/components/navigation/tabs.tsx"],"mappings":";;iBAyBiB,kBAAkB,KAAK;;EAEtC;;EAEA;EACA,iBAAiB;EACjB,UAAU;;;;;;wBAOI,OAAO,OAAO,cAAmB,eAAe,aAAa,QAAQ,4BAAS,IAAA;iBAmB7E,qBAAqB;;EAEpC;;;wBAIc,UAAU,WAAW,cAAc,QAAQ,+BAAY,IAAA;iBAyBtD,iBAAiB,KAAK;EACrC;;wBAGc,MAAM,OAAO,WAAW,YAAY,QAAQ,2BAAQ,IAAA;iBAsBnD,sBAAsB;EACrC;;;wBAIc,WAAW,OAAO,cAAc,QAAQ,gCAAa,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.js","names":["styles.tabList","styles.tab","styles.tabPanel"],"sources":["../../../src/components/navigation/tabs.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useId,\n useState,\n type ComponentPropsWithRef,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './navigation.css';\n\ninterface TabsContextValue {\n value: string;\n select: (value: string) => void;\n idFor: (kind: 'tab' | 'panel', value: string) => string;\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\nconst useTabs = () => {\n const context = useContext(TabsContext);\n if (!context) throw new Error('Tab parts must be used inside <Tabs>.');\n return context;\n};\n\nexport interface TabsProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange'> {\n /** The selected tab (controlled). */\n value?: string;\n /** The tab selected first (uncontrolled). One of `value` or `defaultValue` is required. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children: ReactNode;\n}\n\n/**\n * Tabs switch between panels of related content in place. For moving between pages,\n * use links instead. Follows the WAI-ARIA tabs pattern with automatic activation.\n */\nexport function Tabs({ value, defaultValue = '', onValueChange, children, ...rest }: TabsProps) {\n const base = useId();\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const context: TabsContextValue = {\n value: current,\n select: (next) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n idFor: (kind, v) => `${base}-${kind}-${v.replace(/[^\\w-]/g, '_')}`,\n };\n return (\n <TabsContext.Provider value={context}>\n <div {...rest}>{children}</div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabListProps extends ComponentPropsWithRef<'div'> {\n /** Names the set of tabs, e.g. \"Invoice views\". */\n 'aria-label': string;\n}\n\n/** The row of tabs. Arrow keys, Home and End move between tabs and select them. */\nexport function TabList({ className, onKeyDown, ...rest }: TabListProps) {\n const onKey = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(document.activeElement as HTMLButtonElement);\n if (index === -1) return;\n const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';\n const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 }[event.key];\n let next: HTMLButtonElement | undefined;\n if (step) next = tabs[(index + step + tabs.length) % tabs.length];\n else if (event.key === 'Home') next = tabs[0];\n else if (event.key === 'End') next = tabs.at(-1);\n if (!next) return;\n event.preventDefault();\n next.focus();\n next.click();\n };\n return (\n // WAI-ARIA tabs pattern: focus lives on the tabs (roving tabindex), not on the list.\n // The list only handles keys that bubble up from the focused tab.\n // oxlint-disable-next-line jsx-a11y/interactive-supports-focus\n <div {...rest} role=\"tablist\" className={cx(styles.tabList, className)} onKeyDown={onKey} />\n );\n}\n\nexport interface TabProps extends Omit<ComponentPropsWithRef<'button'>, 'value'> {\n value: string;\n}\n\nexport function Tab({ value, className, onClick, ...rest }: TabProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <button\n {...rest}\n type=\"button\"\n role=\"tab\"\n id={tabs.idFor('tab', value)}\n aria-controls={tabs.idFor('panel', value)}\n aria-selected={selected}\n // Roving tabindex: Tab moves into the list once, arrows move within it.\n tabIndex={selected ? 0 : -1}\n className={cx(styles.tab, className)}\n onClick={(event) => {\n onClick?.(event);\n tabs.select(value);\n }}\n />\n );\n}\n\nexport interface TabPanelProps extends ComponentPropsWithRef<'div'> {\n value: string;\n}\n\n/** Content for one tab. Hidden panels stay in the DOM (state is kept) but are not shown. */\nexport function TabPanel({ value, className, ...rest }: TabPanelProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <div\n {...rest}\n role=\"tabpanel\"\n id={tabs.idFor('panel', value)}\n aria-labelledby={tabs.idFor('tab', value)}\n tabIndex={0}\n hidden={!selected}\n className={cx(styles.tabPanel, className)}\n />\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["styles.tabList","styles.tab","styles.tabPanel"],"sources":["../../../src/components/navigation/tabs.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useId,\n useState,\n type ComponentPropsWithRef,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './navigation.css';\n\ninterface TabsContextValue {\n value: string;\n select: (value: string) => void;\n idFor: (kind: 'tab' | 'panel', value: string) => string;\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\nconst useTabs = () => {\n const context = useContext(TabsContext);\n if (!context) throw new Error('Tab parts must be used inside <Tabs>.');\n return context;\n};\n\nexport interface TabsProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange'> {\n /** The selected tab (controlled). */\n value?: string;\n /** The tab selected first (uncontrolled). One of `value` or `defaultValue` is required. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children: ReactNode;\n}\n\n/**\n * Tabs switch between panels of related content in place. For moving between pages,\n * use links instead. Follows the WAI-ARIA tabs pattern with automatic activation.\n */\nexport function Tabs({ value, defaultValue = '', onValueChange, children, ...rest }: TabsProps) {\n const base = useId();\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const context: TabsContextValue = {\n value: current,\n select: (next) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n idFor: (kind, v) => `${base}-${kind}-${v.replace(/[^\\w-]/g, '_')}`,\n };\n return (\n <TabsContext.Provider value={context}>\n <div {...rest}>{children}</div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabListProps extends ComponentPropsWithRef<'div'> {\n /** Names the set of tabs, e.g. \"Invoice views\". */\n 'aria-label': string;\n}\n\n/** The row of tabs. Arrow keys, Home and End move between tabs and select them. */\nexport function TabList({ className, onKeyDown, ...rest }: TabListProps) {\n const onKey = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(document.activeElement as HTMLButtonElement);\n if (index === -1) return;\n const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';\n const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 }[event.key];\n let next: HTMLButtonElement | undefined;\n if (step) next = tabs[(index + step + tabs.length) % tabs.length];\n else if (event.key === 'Home') next = tabs[0];\n else if (event.key === 'End') next = tabs.at(-1);\n if (!next) return;\n event.preventDefault();\n next.focus();\n next.click();\n };\n return (\n // WAI-ARIA tabs pattern: focus lives on the tabs (roving tabindex), not on the list.\n // The list only handles keys that bubble up from the focused tab.\n // oxlint-disable-next-line jsx-a11y/interactive-supports-focus\n <div {...rest} role=\"tablist\" className={cx(styles.tabList, className)} onKeyDown={onKey} />\n );\n}\n\nexport interface TabProps extends Omit<ComponentPropsWithRef<'button'>, 'value'> {\n value: string;\n}\n\nexport function Tab({ value, className, onClick, ...rest }: TabProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <button\n {...rest}\n type=\"button\"\n role=\"tab\"\n id={tabs.idFor('tab', value)}\n aria-controls={tabs.idFor('panel', value)}\n aria-selected={selected}\n // Roving tabindex: Tab moves into the list once, arrows move within it.\n tabIndex={selected ? 0 : -1}\n className={cx(styles.tab, className)}\n onClick={(event) => {\n onClick?.(event);\n tabs.select(value);\n }}\n />\n );\n}\n\nexport interface TabPanelProps extends ComponentPropsWithRef<'div'> {\n value: string;\n}\n\n/** Content for one tab. Hidden panels stay in the DOM (state is kept) but are not shown. */\nexport function TabPanel({ value, className, ...rest }: TabPanelProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <div\n {...rest}\n role=\"tabpanel\"\n id={tabs.idFor('panel', value)}\n aria-labelledby={tabs.idFor('tab', value)}\n tabIndex={0}\n hidden={!selected}\n className={cx(styles.tabPanel, className)}\n />\n );\n}\n"],"mappings":";;;;;;AAkBA,MAAM,cAAc,cAAuC,IAAI;AAC/D,MAAM,gBAAgB;CACpB,MAAM,UAAU,WAAW,WAAW;CACtC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,uCAAuC;CACrE,OAAO;AACT;;;;;AAeA,SAAgB,KAAK,EAAE,OAAO,eAAe,IAAI,eAAe,UAAU,GAAG,QAAmB;CAC9F,MAAM,OAAO,MAAM;CACnB,MAAM,CAAC,UAAU,eAAe,SAAS,YAAY;CAErD,MAAM,UAA4B;EAChC,OAFc,SAAS;EAGvB,SAAS,SAAS;GAChB,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,gBAAgB,IAAI;EACtB;EACA,QAAQ,MAAM,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,EAAE,QAAQ,WAAW,GAAG;CACjE;CACA,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAC3B,UAAA,oBAAC,OAAD;GAAK,GAAI;GAAO;EAAc,CAAA;CACV,CAAA;AAE1B;;AAQA,SAAgB,QAAQ,EAAE,WAAW,WAAW,GAAG,QAAsB;CACvE,MAAM,SAAS,UAAyC;EACtD,YAAY,KAAK;EACjB,MAAM,OAAO,CAAC,GAAG,MAAM,cAAc,iBAAoC,+BAA6B,CAAC;EACvG,MAAM,QAAQ,KAAK,QAAQ,SAAS,aAAkC;EACtE,IAAI,UAAU,IAAI;EAClB,MAAM,MAAM,iBAAiB,MAAM,aAAa,CAAC,CAAC,cAAc;EAChE,MAAM,OAAO;GAAE,YAAY,MAAM,KAAK;GAAG,WAAW,MAAM,IAAI;EAAG,EAAE,MAAM;EACzE,IAAI;EACJ,IAAI,MAAM,OAAO,MAAM,QAAQ,OAAO,KAAK,UAAU,KAAK;OACrD,IAAI,MAAM,QAAQ,QAAQ,OAAO,KAAK;OACtC,IAAI,MAAM,QAAQ,OAAO,OAAO,KAAK,GAAG,EAAE;EAC/C,IAAI,CAAC,MAAM;EACX,MAAM,eAAe;EACrB,KAAK,MAAM;EACX,KAAK,MAAM;CACb;CACA,OAIE,oBAAC,OAAD;EAAK,GAAI;EAAM,MAAK;EAAU,WAAW,GAAGA,SAAgB,SAAS;EAAG,WAAW;CAAQ,CAAA;AAE/F;AAMA,SAAgB,IAAI,EAAE,OAAO,WAAW,SAAS,GAAG,QAAkB;CACpE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,MAAK;EACL,MAAK;EACL,IAAI,KAAK,MAAM,OAAO,KAAK;EAC3B,iBAAe,KAAK,MAAM,SAAS,KAAK;EACxC,iBAAe;EAEf,UAAU,WAAW,IAAI;EACzB,WAAW,GAAGC,KAAY,SAAS;EACnC,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,KAAK,OAAO,KAAK;EACnB;CACD,CAAA;AAEL;;AAOA,SAAgB,SAAS,EAAE,OAAO,WAAW,GAAG,QAAuB;CACrE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,MAAK;EACL,IAAI,KAAK,MAAM,SAAS,KAAK;EAC7B,mBAAiB,KAAK,MAAM,OAAO,KAAK;EACxC,UAAU;EACV,QAAQ,CAAC;EACT,WAAW,GAAGC,UAAiB,SAAS;CACzC,CAAA;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.css.d.ts","names":[],"sources":["../../../src/components/popover/popover.css.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"popover.css.d.ts","names":[],"sources":["../../../src/components/popover/popover.css.ts"],"mappings":";;;;;;cAcM;WACJ;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAGU,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.d.ts","names":["styles.Placement"],"sources":["../../../src/components/popover/popover.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"popover.d.ts","names":["styles.Placement"],"sources":["../../../src/components/popover/popover.tsx"],"mappings":";;;KAcK;EACH,QAAQ;EACR;EACA;EACA,kBAAkB;EAClB,kBAAkB;EAClB,WAAW;EACX,UAAU;EACV,aAAa;;iBAQE,qBAAqB,KAAK;;EAEzC,SAAS,aAAa;;EAEtB,QAAQ;EACR,YAAYA;;EAEZ,gBAAgB;EAChB,WAAW;;;;;;;wBAQG,UACd,SACA,OACA,WACA,cACA,WACA,OACA,aACG,QACF,+BAAY,IAAA;iBAoDE;;EAEf,SAAS;;EAET,UAAU,aAAa;EACvB,YAAYA;;EAEZ;;;;;;;wBAQc,UAAU,SAAS,UAAU,WAAW,SAAe,+BAAY,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","names":["styles.popover","styles.tooltip"],"sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["import {\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './popover.css';\n\ntype TriggerProps = {\n style?: CSSProperties;\n popoverTarget?: string;\n 'aria-describedby'?: string;\n onPointerEnter?: (event: never) => void;\n onPointerLeave?: (event: never) => void;\n onFocus?: (event: never) => void;\n onBlur?: (event: never) => void;\n onKeyDown?: (event: never) => void;\n};\n\n/** A unique, CSS-safe anchor name per instance. */\nfunction useAnchorName() {\n return `--ml-anchor-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n}\n\nexport interface PopoverProps extends Omit<ComponentPropsWithRef<'div'>, 'title' | 'popover'> {\n /** The element that toggles it: usually a `Button`. It must be a `<button>`. */\n trigger: ReactElement<TriggerProps>;\n /** Optional heading; it also names the popover. */\n title?: ReactNode;\n placement?: styles.Placement;\n /** Called when it opens or closes, including light dismiss and Escape. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n}\n\n/**\n * Non-modal content next to its trigger: filters, details, small forms.\n * Built on the Popover API: the browser handles light dismiss, Escape and top layer,\n * and `popovertarget` exposes the expanded state. CSS anchor positioning places it.\n */\nexport function Popover({\n trigger,\n title,\n placement,\n onOpenChange,\n className,\n style,\n children,\n ...rest\n}: PopoverProps) {\n const id = useId();\n const titleId = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const onToggle = (event: Event) => onOpenChangeRef.current?.((event as ToggleEvent).newState === 'open');\n el.addEventListener('toggle', onToggle);\n return () => el.removeEventListener('toggle', onToggle);\n }, []);\n\n const wiredTrigger = isValidElement(trigger)\n ? cloneElement(trigger, {\n popoverTarget: id,\n style: { ...trigger.props.style, anchorName: anchor } as CSSProperties,\n })\n : trigger;\n\n return (\n <>\n {wiredTrigger}\n <div\n {...rest}\n ref={ref}\n id={id}\n popover=\"auto\"\n // A <dialog> shown through the Popover API is unreliable across browsers, so the\n // panel stays a <div> and the role names it.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"dialog\"\n aria-labelledby={title ? titleId : undefined}\n className={cx(styles.popover({ placement }), className)}\n style={{ ...style, positionAnchor: anchor } as CSSProperties}\n >\n {title && (\n <p id={titleId} className={styles.popoverTitle}>\n {title}\n </p>\n )}\n {children}\n </div>\n </>\n );\n}\n\nexport interface TooltipProps {\n /** Short, plain text. Tooltips must never hold links, buttons or other controls. */\n content: ReactNode;\n /** The described element. It must be focusable, so keyboard users get the tooltip too. */\n children: ReactElement<TriggerProps>;\n placement?: styles.Placement;\n /** Hover delay before showing, in ms. Focus shows it straight away. Default 400. */\n delay?: number;\n}\n\n/**\n * A short description of a control, shown on hover (after a delay) and on focus,\n * hidden on leave, blur and Escape. Linked with `aria-describedby`.\n * Touch screens have no hover, so never put essential information only in a tooltip.\n */\nexport function Tooltip({ content, children, placement, delay = 400 }: TooltipProps) {\n const id = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n const show = (after = 0) => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n const el = ref.current;\n if (el && !el.matches(':popover-open')) el.showPopover();\n }, after);\n };\n const hide = () => {\n clearTimeout(timer.current);\n const el = ref.current;\n if (el?.matches(':popover-open')) el.hidePopover();\n };\n useEffect(() => {\n const pending = timer;\n return () => clearTimeout(pending.current);\n }, [timer]);\n\n const props = children.props;\n // The handlers below read refs only when the events fire; the rule cannot see that\n // through cloneElement.\n // oxlint-disable-next-line react/refs\n const trigger = cloneElement(children, {\n 'aria-describedby': [props['aria-describedby'], id].filter(Boolean).join(' '),\n style: { ...props.style, anchorName: anchor } as CSSProperties,\n onPointerEnter: (event: never) => {\n props.onPointerEnter?.(event);\n show(delay);\n },\n onPointerLeave: (event: never) => {\n props.onPointerLeave?.(event);\n hide();\n },\n onFocus: (event: never) => {\n props.onFocus?.(event);\n show(0);\n },\n onBlur: (event: never) => {\n props.onBlur?.(event);\n hide();\n },\n onKeyDown: (event: never) => {\n props.onKeyDown?.(event);\n if ((event as KeyboardEvent).key === 'Escape') hide();\n },\n });\n\n return (\n <>\n {trigger}\n <div\n ref={ref}\n id={id}\n popover=\"manual\"\n role=\"tooltip\"\n className={styles.tooltip({ placement })}\n style={{ positionAnchor: anchor } as CSSProperties}\n >\n {content}\n </div>\n </>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"popover.js","names":["styles.popover","styles.tooltip"],"sources":["../../../src/components/popover/popover.tsx"],"sourcesContent":["import {\n cloneElement,\n isValidElement,\n useEffect,\n useId,\n useRef,\n type ComponentPropsWithRef,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './popover.css';\n\ntype TriggerProps = {\n style?: CSSProperties;\n popoverTarget?: string;\n 'aria-describedby'?: string;\n onPointerEnter?: (event: never) => void;\n onPointerLeave?: (event: never) => void;\n onFocus?: (event: never) => void;\n onBlur?: (event: never) => void;\n onKeyDown?: (event: never) => void;\n};\n\n/** A unique, CSS-safe anchor name per instance. */\nfunction useAnchorName() {\n return `--ml-anchor-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n}\n\nexport interface PopoverProps extends Omit<ComponentPropsWithRef<'div'>, 'title' | 'popover'> {\n /** The element that toggles it: usually a `Button`. It must be a `<button>`. */\n trigger: ReactElement<TriggerProps>;\n /** Optional heading; it also names the popover. */\n title?: ReactNode;\n placement?: styles.Placement;\n /** Called when it opens or closes, including light dismiss and Escape. */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n}\n\n/**\n * Non-modal content next to its trigger: filters, details, small forms.\n * Built on the Popover API: the browser handles light dismiss, Escape and top layer,\n * and `popovertarget` exposes the expanded state. CSS anchor positioning places it.\n */\nexport function Popover({\n trigger,\n title,\n placement,\n onOpenChange,\n className,\n style,\n children,\n ...rest\n}: PopoverProps) {\n const id = useId();\n const titleId = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const onOpenChangeRef = useRef(onOpenChange);\n useEffect(() => {\n onOpenChangeRef.current = onOpenChange;\n });\n\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n const onToggle = (event: Event) => onOpenChangeRef.current?.((event as ToggleEvent).newState === 'open');\n el.addEventListener('toggle', onToggle);\n return () => el.removeEventListener('toggle', onToggle);\n }, []);\n\n const wiredTrigger = isValidElement(trigger)\n ? cloneElement(trigger, {\n popoverTarget: id,\n style: { ...trigger.props.style, anchorName: anchor } as CSSProperties,\n })\n : trigger;\n\n return (\n <>\n {wiredTrigger}\n <div\n {...rest}\n ref={ref}\n id={id}\n popover=\"auto\"\n // A <dialog> shown through the Popover API is unreliable across browsers, so the\n // panel stays a <div> and the role names it.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"dialog\"\n aria-labelledby={title ? titleId : undefined}\n className={cx(styles.popover({ placement }), className)}\n style={{ ...style, positionAnchor: anchor } as CSSProperties}\n >\n {title && (\n <p id={titleId} className={styles.popoverTitle}>\n {title}\n </p>\n )}\n {children}\n </div>\n </>\n );\n}\n\nexport interface TooltipProps {\n /** Short, plain text. Tooltips must never hold links, buttons or other controls. */\n content: ReactNode;\n /** The described element. It must be focusable, so keyboard users get the tooltip too. */\n children: ReactElement<TriggerProps>;\n placement?: styles.Placement;\n /** Hover delay before showing, in ms. Focus shows it straight away. Default 400. */\n delay?: number;\n}\n\n/**\n * A short description of a control, shown on hover (after a delay) and on focus,\n * hidden on leave, blur and Escape. Linked with `aria-describedby`.\n * Touch screens have no hover, so never put essential information only in a tooltip.\n */\nexport function Tooltip({ content, children, placement, delay = 400 }: TooltipProps) {\n const id = useId();\n const anchor = useAnchorName();\n const ref = useRef<HTMLDivElement>(null);\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined);\n\n const show = (after = 0) => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n const el = ref.current;\n if (el && !el.matches(':popover-open')) el.showPopover();\n }, after);\n };\n const hide = () => {\n clearTimeout(timer.current);\n const el = ref.current;\n if (el?.matches(':popover-open')) el.hidePopover();\n };\n useEffect(() => {\n const pending = timer;\n return () => clearTimeout(pending.current);\n }, [timer]);\n\n const props = children.props;\n // The handlers below read refs only when the events fire; the rule cannot see that\n // through cloneElement.\n // oxlint-disable-next-line react/refs\n const trigger = cloneElement(children, {\n 'aria-describedby': [props['aria-describedby'], id].filter(Boolean).join(' '),\n style: { ...props.style, anchorName: anchor } as CSSProperties,\n onPointerEnter: (event: never) => {\n props.onPointerEnter?.(event);\n show(delay);\n },\n onPointerLeave: (event: never) => {\n props.onPointerLeave?.(event);\n hide();\n },\n onFocus: (event: never) => {\n props.onFocus?.(event);\n show(0);\n },\n onBlur: (event: never) => {\n props.onBlur?.(event);\n hide();\n },\n onKeyDown: (event: never) => {\n props.onKeyDown?.(event);\n if ((event as KeyboardEvent).key === 'Escape') hide();\n },\n });\n\n return (\n <>\n {trigger}\n <div\n ref={ref}\n id={id}\n popover=\"manual\"\n role=\"tooltip\"\n className={styles.tooltip({ placement })}\n style={{ positionAnchor: anchor } as CSSProperties}\n >\n {content}\n </div>\n </>\n );\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","names":[],"sources":["../../../src/components/select/select.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.d.ts","names":[],"sources":["../../../src/components/select/select.tsx"],"mappings":";;;iBAQiB,oBAAoB,KAAK;EACxC,OAAO;EACP;;EAEA;;;;;;wBAOc,SACd,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,UACG,QACF,8BAAW,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","names":["styles.wrap","styles.select","styles.chevron"],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { iconChevronDown } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { Icon } from '../icon';\nimport { input, type InputVariants } from '../input/input.css';\nimport * as styles from './select.css';\n\nexport interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'size'> {\n size?: InputVariants['size'];\n invalid?: boolean;\n /** Shown first and not selectable again once a choice is made, e.g. \"Choose a country\". */\n placeholder?: string;\n}\n\n/**\n * The native `<select>`, styled like `Input`. Phones get the system picker, keyboards\n * and screen readers get native behaviour, and forms submit it as is.\n */\nexport function Select({\n size,\n invalid,\n placeholder,\n className,\n id,\n required,\n disabled,\n children,\n defaultValue,\n value,\n ...rest\n}: SelectProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n // With a placeholder and no value given, start on the placeholder option.\n const initial = placeholder && value === undefined && defaultValue === undefined ? '' : defaultValue;\n return (\n <span className={styles.wrap}>\n <select\n {...rest}\n {...control}\n value={value}\n defaultValue={initial}\n className={cx(input({ size }), styles.select, className)}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {children}\n </select>\n <Icon icon={iconChevronDown} className={styles.chevron} size={18} />\n </span>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.js","names":["styles.wrap","styles.select","styles.chevron"],"sources":["../../../src/components/select/select.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react';\nimport { iconChevronDown } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport { Icon } from '../icon';\nimport { input, type InputVariants } from '../input/input.css';\nimport * as styles from './select.css';\n\nexport interface SelectProps extends Omit<ComponentPropsWithRef<'select'>, 'size'> {\n size?: InputVariants['size'];\n invalid?: boolean;\n /** Shown first and not selectable again once a choice is made, e.g. \"Choose a country\". */\n placeholder?: string;\n}\n\n/**\n * The native `<select>`, styled like `Input`. Phones get the system picker, keyboards\n * and screen readers get native behaviour, and forms submit it as is.\n */\nexport function Select({\n size,\n invalid,\n placeholder,\n className,\n id,\n required,\n disabled,\n children,\n defaultValue,\n value,\n ...rest\n}: SelectProps) {\n const control = useFieldControl({\n id,\n required,\n disabled,\n invalid,\n 'aria-describedby': rest['aria-describedby'],\n });\n // With a placeholder and no value given, start on the placeholder option.\n const initial = placeholder && value === undefined && defaultValue === undefined ? '' : defaultValue;\n return (\n <span className={styles.wrap}>\n <select\n {...rest}\n {...control}\n value={value}\n defaultValue={initial}\n className={cx(input({ size }), styles.select, className)}\n >\n {placeholder && (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n )}\n {children}\n </select>\n <Icon icon={iconChevronDown} className={styles.chevron} size={18} />\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,SAAgB,OAAO,EACrB,MACA,SACA,aACA,WACA,IACA,UACA,UACA,UACA,cACA,OACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAC9B;EACA;EACA;EACA;EACA,oBAAoB,KAAK;CAC3B,CAAC;CAED,MAAM,UAAU,eAAe,UAAU,KAAA,KAAa,iBAAiB,KAAA,IAAY,KAAK;CACxF,OACE,qBAAC,QAAD;EAAM,WAAWA;EAAjB,UAAA,CACE,qBAAC,UAAD;GACE,GAAI;GACJ,GAAI;GACG;GACP,cAAc;GACd,WAAW,GAAG,MAAM,EAAE,KAAK,CAAC,GAAGC,QAAe,SAAS;GALzD,UAAA,CAOG,eACC,oBAAC,UAAD;IAAQ,OAAM;IAAG,UAAA;IACd,UAAA;GACK,CAAA,GAET,QACK;EACR,CAAA,GAAA,oBAAC,MAAD;GAAM,MAAM;GAAiB,WAAWC;GAAgB,MAAM;EAAK,CAAA,CAC/D;;AAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.d.ts","names":[],"sources":["../../../src/components/slider/slider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slider.d.ts","names":[],"sources":["../../../src/components/slider/slider.tsx"],"mappings":";;iBAMiB,oBAAoB,KACnC;EAGA;EACA;EACA,iBAAiB;EACjB;EACA;EACA;;EAEA,UAAU;;;wBAII,SACd,OACA,cACA,eACA,KACA,KACA,MACA,QACA,WACA,OACA,IACA,UACA,UACA,aACG,QACF,8BAAW,IAAA;;wBA4BE,cAAc;EAAc,UAAU;oBAAW,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","names":["styles.slider","styles.fill","styles.output"],"sources":["../../../src/components/slider/slider.tsx"],"sourcesContent":["import { useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport * as styles from './slider.css';\n\nexport interface SliderProps extends Omit<\n ComponentPropsWithRef<'input'>,\n 'type' | 'value' | 'defaultValue' | 'size'\n> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n /** Format the value for `aria-valuetext` and for `SliderValue`, e.g. `(v) => \\`${v}%\\``. */\n format?: (value: number) => string;\n}\n\n/** A native range input with a filled track. Arrow keys, Page Up/Down, Home and End work natively. */\nexport function Slider({\n value,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n format,\n className,\n style,\n id,\n required,\n disabled,\n onChange,\n ...rest\n}: SliderProps) {\n const control = useFieldControl({ id, required, disabled, 'aria-describedby': rest['aria-describedby'] });\n const [internal, setInternal] = useState(defaultValue ?? (min + max) / 2);\n const current = value ?? internal;\n const percent = max === min ? 0 : ((current - min) / (max - min)) * 100;\n return (\n <input\n {...rest}\n {...control}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={current}\n aria-valuetext={format?.(current)}\n onChange={(event) => {\n onChange?.(event);\n const next = Number(event.target.value);\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n }}\n className={cx(styles.slider, className)}\n style={{ ...style, ...assignInlineVars({ [styles.fill]: `${percent}%` }) }}\n />\n );\n}\n\n/** Label row for a slider inside a `Field`: puts the current value at the end. */\nexport function SliderValue({ children }: { children: ReactNode }) {\n return <output className={styles.output}>{children}</output>;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slider.js","names":["styles.slider","styles.fill","styles.output"],"sources":["../../../src/components/slider/slider.tsx"],"sourcesContent":["import { useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { cx } from '../../utils/cx';\nimport { useFieldControl } from '../field/use-field-control';\nimport * as styles from './slider.css';\n\nexport interface SliderProps extends Omit<\n ComponentPropsWithRef<'input'>,\n 'type' | 'value' | 'defaultValue' | 'size'\n> {\n value?: number;\n defaultValue?: number;\n onValueChange?: (value: number) => void;\n min?: number;\n max?: number;\n step?: number;\n /** Format the value for `aria-valuetext` and for `SliderValue`, e.g. `(v) => \\`${v}%\\``. */\n format?: (value: number) => string;\n}\n\n/** A native range input with a filled track. Arrow keys, Page Up/Down, Home and End work natively. */\nexport function Slider({\n value,\n defaultValue,\n onValueChange,\n min = 0,\n max = 100,\n step = 1,\n format,\n className,\n style,\n id,\n required,\n disabled,\n onChange,\n ...rest\n}: SliderProps) {\n const control = useFieldControl({ id, required, disabled, 'aria-describedby': rest['aria-describedby'] });\n const [internal, setInternal] = useState(defaultValue ?? (min + max) / 2);\n const current = value ?? internal;\n const percent = max === min ? 0 : ((current - min) / (max - min)) * 100;\n return (\n <input\n {...rest}\n {...control}\n type=\"range\"\n min={min}\n max={max}\n step={step}\n value={current}\n aria-valuetext={format?.(current)}\n onChange={(event) => {\n onChange?.(event);\n const next = Number(event.target.value);\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n }}\n className={cx(styles.slider, className)}\n style={{ ...style, ...assignInlineVars({ [styles.fill]: `${percent}%` }) }}\n />\n );\n}\n\n/** Label row for a slider inside a `Field`: puts the current value at the end. */\nexport function SliderValue({ children }: { children: ReactNode }) {\n return <output className={styles.output}>{children}</output>;\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAgB,OAAO,EACrB,OACA,cACA,eACA,MAAM,GACN,MAAM,KACN,OAAO,GACP,QACA,WACA,OACA,IACA,UACA,UACA,UACA,GAAG,QACW;CACd,MAAM,UAAU,gBAAgB;EAAE;EAAI;EAAU;EAAU,oBAAoB,KAAK;CAAoB,CAAC;CACxG,MAAM,CAAC,UAAU,eAAe,SAAS,iBAAiB,MAAM,OAAO,CAAC;CACxE,MAAM,UAAU,SAAS;CACzB,MAAM,UAAU,QAAQ,MAAM,KAAM,UAAU,QAAQ,MAAM,OAAQ;CACpE,OACE,oBAAC,SAAD;EACE,GAAI;EACJ,GAAI;EACJ,MAAK;EACA;EACA;EACC;EACN,OAAO;EACP,kBAAgB,SAAS,OAAO;EAChC,WAAW,UAAU;GACnB,WAAW,KAAK;GAChB,MAAM,OAAO,OAAO,MAAM,OAAO,KAAK;GACtC,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,gBAAgB,IAAI;EACtB;EACA,WAAW,GAAGA,QAAe,SAAS;EACtC,OAAO;GAAE,GAAG;GAAO,GAAG,iBAAiB,GAAGC,OAAc,GAAG,QAAQ,GAAG,CAAC;EAAE;CAC1E,CAAA;AAEL;;AAGA,SAAgB,YAAY,EAAE,YAAqC;CACjE,OAAO,oBAAC,UAAD;EAAQ,WAAWC;EAAgB;CAAiB,CAAA;AAC7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","names":[],"sources":["../../../src/components/table/table.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"table.d.ts","names":[],"sources":["../../../src/components/table/table.tsx"],"mappings":";;iBAIiB,mBAAmB;;EAElC,SAAS;EACT;EACA;;EAEA;EACA;;EAEA;;;;;;;wBAQc,QACd,SACA,aACA,SACA,cACA,WACA,mBACA,WACA,aACG,QACF,6BAAU,IAAA;iBAgCI;;EAEf;;wBAGc,KAAK,SAAS,WAAW,UAAkB,QAAQ,8BAA8B,4BAAS,IAAA;wBAI1F,KAAK,SAAS,cAAc,QAAQ,8BAA8B,4BAAS,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":["wrap","styles.wrap","styles.table","styles.captionHidden","numeric"],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './table.css';\n\nexport interface TableProps extends ComponentPropsWithRef<'table'> {\n /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */\n caption: ReactNode;\n hideCaption?: boolean;\n density?: 'compact' | 'standard' | 'comfortable';\n /** Keep the header row visible while scrolling; give the table a max height via `maxHeight`. */\n stickyHeader?: boolean;\n maxHeight?: string;\n /** Keep the first column visible while scrolling sideways, e.g. names. */\n stickyFirstColumn?: boolean;\n}\n\n/**\n * A semantic `<table>` in a scroll container. When it is wider (or taller) than its\n * space, the container becomes a named, focusable region so keyboard users can scroll it.\n * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.\n */\nexport function Table({\n caption,\n hideCaption,\n density = 'standard',\n stickyHeader,\n maxHeight,\n stickyFirstColumn,\n className,\n children,\n ...rest\n}: TableProps) {\n const wrap = useRef<HTMLDivElement>(null);\n const [scrollable, setScrollable] = useState(false);\n useEffect(() => {\n const el = wrap.current;\n if (!el) return;\n const check = () => setScrollable(el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight);\n check();\n const observer = new ResizeObserver(check);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={wrap}\n className={styles.wrap}\n data-sticky-header={stickyHeader || undefined}\n data-sticky-first={stickyFirstColumn || undefined}\n style={maxHeight ? { maxHeight } : undefined}\n // Only a region (and a tab stop) when there is something to scroll.\n role={scrollable ? 'region' : undefined}\n aria-label={scrollable && typeof caption === 'string' ? caption : undefined}\n tabIndex={scrollable ? 0 : undefined}\n >\n <table {...rest} data-density={density} className={cx(styles.table, className)}>\n <caption className={hideCaption ? styles.captionHidden : undefined}>{caption}</caption>\n {children}\n </table>\n </div>\n );\n}\n\nexport interface CellProps {\n /** Right-align with tabular figures, for amounts and counts. */\n numeric?: boolean;\n}\n\nexport function Th({ numeric, className, scope = 'col', ...rest }: ComponentPropsWithRef<'th'> & CellProps) {\n return <th {...rest} scope={scope} className={cx(numeric && styles.numeric, className)} />;\n}\n\nexport function Td({ numeric, className, ...rest }: ComponentPropsWithRef<'td'> & CellProps) {\n return <td {...rest} className={cx(numeric && styles.numeric, className)} />;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"table.js","names":["wrap","styles.wrap","styles.table","styles.captionHidden","numeric"],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './table.css';\n\nexport interface TableProps extends ComponentPropsWithRef<'table'> {\n /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */\n caption: ReactNode;\n hideCaption?: boolean;\n density?: 'compact' | 'standard' | 'comfortable';\n /** Keep the header row visible while scrolling; give the table a max height via `maxHeight`. */\n stickyHeader?: boolean;\n maxHeight?: string;\n /** Keep the first column visible while scrolling sideways, e.g. names. */\n stickyFirstColumn?: boolean;\n}\n\n/**\n * A semantic `<table>` in a scroll container. When it is wider (or taller) than its\n * space, the container becomes a named, focusable region so keyboard users can scroll it.\n * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.\n */\nexport function Table({\n caption,\n hideCaption,\n density = 'standard',\n stickyHeader,\n maxHeight,\n stickyFirstColumn,\n className,\n children,\n ...rest\n}: TableProps) {\n const wrap = useRef<HTMLDivElement>(null);\n const [scrollable, setScrollable] = useState(false);\n useEffect(() => {\n const el = wrap.current;\n if (!el) return;\n const check = () => setScrollable(el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight);\n check();\n const observer = new ResizeObserver(check);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={wrap}\n className={styles.wrap}\n data-sticky-header={stickyHeader || undefined}\n data-sticky-first={stickyFirstColumn || undefined}\n style={maxHeight ? { maxHeight } : undefined}\n // Only a region (and a tab stop) when there is something to scroll.\n role={scrollable ? 'region' : undefined}\n aria-label={scrollable && typeof caption === 'string' ? caption : undefined}\n tabIndex={scrollable ? 0 : undefined}\n >\n <table {...rest} data-density={density} className={cx(styles.table, className)}>\n <caption className={hideCaption ? styles.captionHidden : undefined}>{caption}</caption>\n {children}\n </table>\n </div>\n );\n}\n\nexport interface CellProps {\n /** Right-align with tabular figures, for amounts and counts. */\n numeric?: boolean;\n}\n\nexport function Th({ numeric, className, scope = 'col', ...rest }: ComponentPropsWithRef<'th'> & CellProps) {\n return <th {...rest} scope={scope} className={cx(numeric && styles.numeric, className)} />;\n}\n\nexport function Td({ numeric, className, ...rest }: ComponentPropsWithRef<'td'> & CellProps) {\n return <td {...rest} className={cx(numeric && styles.numeric, className)} />;\n}\n"],"mappings":";;;;;;;;;;;AAqBA,SAAgB,MAAM,EACpB,SACA,aACA,UAAU,YACV,cACA,WACA,mBACA,WACA,UACA,GAAG,QACU;CACb,MAAMA,SAAO,OAAuB,IAAI;CACxC,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,gBAAgB;EACd,MAAM,KAAKA,OAAK;EAChB,IAAI,CAAC,IAAI;EACT,MAAM,cAAc,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,eAAe,GAAG,YAAY;EACtG,MAAM;EACN,MAAM,WAAW,IAAI,eAAe,KAAK;EACzC,SAAS,QAAQ,EAAE;EACnB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CACL,OACE,oBAAC,OAAD;EACE,KAAKA;EACL,WAAWC;EACX,sBAAoB,gBAAgB,KAAA;EACpC,qBAAmB,qBAAqB,KAAA;EACxC,OAAO,YAAY,EAAE,UAAU,IAAI,KAAA;EAEnC,MAAM,aAAa,WAAW,KAAA;EAC9B,cAAY,cAAc,OAAO,YAAY,WAAW,UAAU,KAAA;EAClE,UAAU,aAAa,IAAI,KAAA;EAE3B,UAAA,qBAAC,SAAD;GAAO,GAAI;GAAM,gBAAc;GAAS,WAAW,GAAGC,OAAc,SAAS;GAA7E,UAAA,CACE,oBAAC,WAAD;IAAS,WAAW,cAAcC,gBAAuB,KAAA;IAAY,UAAA;GAAiB,CAAA,GACrF,QACI;;CACJ,CAAA;AAET;AAOA,SAAgB,GAAG,EAAEC,SAAAA,WAAS,WAAW,QAAQ,OAAO,GAAG,QAAiD;CAC1G,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAa;EAAO,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC3F;AAEA,SAAgB,GAAG,EAAEA,SAAAA,WAAS,WAAW,GAAG,QAAiD;CAC3F,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.css.d.ts","names":[],"sources":["../../../src/components/text/text.css.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.css.d.ts","names":[],"sources":["../../../src/components/text/text.css.ts"],"mappings":";;qBAQa,yCAAI;;;;;;;;;;;;;;;;;MAmBT;MACA;MACA;MACA;;;MAGA;MACA;MACA;;;;;;;;MAGO;MAAwB;;;;;;;;;;;;;;;;;MAYtB;;;MACF;;;MACC;;;MACA;;;MACA;;;MACC;;;;;;;;;;;;;YAWL,eAAe,YAAY,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","names":[],"sources":["../../../src/components/text/text.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"text.d.ts","names":[],"sources":["../../../src/components/text/text.tsx"],"mappings":";;;;;YAMY,cAAc,KACxB;iBAae,kBAAkB,KAAK,sCAAsC;EAC5E,UAAU;EACV,OAAO;;EAEP;EACA,KAAK;;wBAQS,OAAO,SAAkB,MAAM,SAAS,IAAI,cAAc,SAAS,4BAAS,IAAA;iBAsB3E,qBAAqB,KAAK;;EAEzC;EACA,UAAU,QAAQ;;;wBAMJ,UAAU,OAAW,SAAS,SAAqB,QAAQ,+BAAY,IAAA"}
|