jaci-ui 0.9.4 → 1.0.2
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/CHANGELOG.md +25 -0
- package/README.md +11 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/components/accordion/accordion.cjs.map +1 -1
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.cjs.map +1 -1
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.cjs.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
- package/dist/components/avatar/avatar.cjs.map +1 -1
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/breadcrumbs/breadcrumbs.cjs.map +1 -1
- package/dist/components/button/button.cjs +1 -0
- package/dist/components/button/button.cjs.map +1 -1
- package/dist/components/button/button.d.cts +2 -1
- package/dist/components/button/button.d.ts +2 -1
- package/dist/components/button/button.js +1 -0
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button-group/button-group.cjs.map +1 -1
- package/dist/components/calendar/calendar.cjs +4 -6
- package/dist/components/calendar/calendar.cjs.map +1 -1
- package/dist/components/calendar/calendar.js +4 -6
- package/dist/components/calendar/calendar.js.map +1 -1
- package/dist/components/card/card.cjs.map +1 -1
- package/dist/components/carousel/carousel.cjs.map +1 -1
- package/dist/components/carousel/carousel.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.cjs +7 -3
- package/dist/components/checkbox-group/checkbox-group.cjs.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +7 -3
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/code/code.cjs.map +1 -1
- package/dist/components/code/code.js.map +1 -1
- package/dist/components/collapsible/collapsible.cjs.map +1 -1
- package/dist/components/collapsible/collapsible.js.map +1 -1
- package/dist/components/color-picker/color-picker.cjs.map +1 -1
- package/dist/components/color-picker/color-picker.js.map +1 -1
- package/dist/components/color-picker/color-utils.cjs +5 -3
- package/dist/components/color-picker/color-utils.cjs.map +1 -1
- package/dist/components/color-picker/color-utils.js +5 -3
- package/dist/components/color-picker/color-utils.js.map +1 -1
- package/dist/components/color-swatch/color-swatch.cjs.map +1 -1
- package/dist/components/combobox/combobox.cjs +2 -1
- package/dist/components/combobox/combobox.cjs.map +1 -1
- package/dist/components/combobox/combobox.js +2 -1
- package/dist/components/combobox/combobox.js.map +1 -1
- package/dist/components/command/command.cjs.map +1 -1
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/context-menu/context-menu.cjs.map +1 -1
- package/dist/components/context-menu/context-menu.d.cts +2 -2
- package/dist/components/context-menu/context-menu.d.ts +2 -2
- package/dist/components/controls/checkbox.cjs.map +1 -1
- package/dist/components/controls/checkbox.js.map +1 -1
- package/dist/components/controls/input.cjs.map +1 -1
- package/dist/components/controls/input.js.map +1 -1
- package/dist/components/controls/radio.cjs.map +1 -1
- package/dist/components/controls/switch.cjs.map +1 -1
- package/dist/components/controls/switch.js.map +1 -1
- package/dist/components/controls/textarea.cjs.map +1 -1
- package/dist/components/controls/textarea.js.map +1 -1
- package/dist/components/copyable/copyable.cjs.map +1 -1
- package/dist/components/copyable/copyable.js.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.cjs.map +1 -1
- package/dist/components/data-toolbar/data-toolbar.js.map +1 -1
- package/dist/components/data-view/data-view.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.cjs +4 -7
- package/dist/components/date-picker/date-picker.cjs.map +1 -1
- package/dist/components/date-picker/date-picker.js +4 -7
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.cjs +4 -6
- package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +4 -6
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/dialog/dialog.cjs.map +1 -1
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/download-trigger/download-trigger.cjs.map +1 -1
- package/dist/components/drawer/drawer.cjs.map +1 -1
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/empty-state/empty-state.cjs.map +1 -1
- package/dist/components/feedback/badge.cjs.map +1 -1
- package/dist/components/field/field.cjs.map +1 -1
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/fieldset/fieldset.cjs.map +1 -1
- package/dist/components/figure/figure.cjs.map +1 -1
- package/dist/components/figure/figure.js.map +1 -1
- package/dist/components/form/form.cjs.map +1 -1
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/icon-button/icon-button.cjs.map +1 -1
- package/dist/components/icon-button/icon-button.js.map +1 -1
- package/dist/components/image/image.cjs.map +1 -1
- package/dist/components/image/image.js.map +1 -1
- package/dist/components/input-group/input-group.cjs.map +1 -1
- package/dist/components/kbd/kbd.cjs.map +1 -1
- package/dist/components/layout/index.cjs.map +1 -1
- package/dist/components/list/list.cjs.map +1 -1
- package/dist/components/menu/menu.cjs.map +1 -1
- package/dist/components/menu/menu.d.cts +2 -2
- package/dist/components/menu/menu.d.ts +2 -2
- package/dist/components/menubar/menubar.cjs.map +1 -1
- package/dist/components/menubar/menubar.d.cts +2 -2
- package/dist/components/menubar/menubar.d.ts +2 -2
- package/dist/components/menubar/menubar.js.map +1 -1
- package/dist/components/meter/meter.cjs.map +1 -1
- package/dist/components/meter/meter.js.map +1 -1
- package/dist/components/navigation/navigation.cjs.map +1 -1
- package/dist/components/navigation/navigation.js.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
- package/dist/components/number-field/number-field.cjs +2 -1
- package/dist/components/number-field/number-field.cjs.map +1 -1
- package/dist/components/number-field/number-field.js +2 -1
- package/dist/components/number-field/number-field.js.map +1 -1
- package/dist/components/option-selector/option-selector.cjs.map +1 -1
- package/dist/components/option-selector/option-selector.js.map +1 -1
- package/dist/components/pagination/pagination.cjs.map +1 -1
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/pin-input/pin-input.cjs.map +1 -1
- package/dist/components/pin-input/pin-input.js.map +1 -1
- package/dist/components/popover/popover.cjs.map +1 -1
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.cjs.map +1 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/qr-code/qr-code.cjs.map +1 -1
- package/dist/components/qr-code/qr-code.js.map +1 -1
- package/dist/components/quote/quote.cjs.map +1 -1
- package/dist/components/quote/quote.js.map +1 -1
- package/dist/components/radio-group/radio-group.cjs +7 -3
- package/dist/components/radio-group/radio-group.cjs.map +1 -1
- package/dist/components/radio-group/radio-group.js +7 -3
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/range-slider/range-slider.cjs.map +1 -1
- package/dist/components/range-slider/range-slider.js.map +1 -1
- package/dist/components/scroll-area/scroll-area.cjs.map +1 -1
- package/dist/components/select/select.cjs.map +1 -1
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/sidebar/sidebar.cjs.map +1 -1
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/skeleton/skeleton.cjs.map +1 -1
- package/dist/components/slider/slider.cjs.map +1 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/spacer/spacer.cjs.map +1 -1
- package/dist/components/stat/stat.cjs.map +1 -1
- package/dist/components/stat/stat.js.map +1 -1
- package/dist/components/stepper/stepper.cjs +2 -1
- package/dist/components/stepper/stepper.cjs.map +1 -1
- package/dist/components/stepper/stepper.js +2 -1
- package/dist/components/stepper/stepper.js.map +1 -1
- package/dist/components/table/table.cjs.map +1 -1
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.cjs.map +1 -1
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tags-input/tags-input.cjs +10 -9
- package/dist/components/tags-input/tags-input.cjs.map +1 -1
- package/dist/components/tags-input/tags-input.js +10 -9
- package/dist/components/tags-input/tags-input.js.map +1 -1
- package/dist/components/toast/toast.cjs.map +1 -1
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toggle/toggle.cjs.map +1 -1
- package/dist/components/toggle-group/toggle-group.cjs.map +1 -1
- package/dist/components/toolbar/toolbar.cjs.map +1 -1
- package/dist/components/tooltip/tooltip.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.cjs.map +1 -1
- package/dist/components/tree-view/tree-view.js.map +1 -1
- package/dist/components/typography/heading.cjs.map +1 -1
- package/dist/components/typography/link.cjs.map +1 -1
- package/dist/components/typography/paragraph.cjs.map +1 -1
- package/dist/components/typography/text.cjs.map +1 -1
- package/dist/components/upload/upload.cjs +2 -2
- package/dist/components/upload/upload.cjs.map +1 -1
- package/dist/components/upload/upload.js +2 -2
- package/dist/components/upload/upload.js.map +1 -1
- package/dist/components/visually-hidden/visually-hidden.cjs.map +1 -1
- package/dist/panda-preset.cjs.map +1 -1
- package/dist/styles/theme.cjs +18 -18
- package/dist/styles/theme.cjs.map +1 -1
- package/dist/styles/theme.js +18 -18
- package/dist/styles/theme.js.map +1 -1
- package/dist/styles.css +12 -21
- package/dist/theme/theme-provider.cjs.map +1 -1
- package/dist/theme/theme-provider.js.map +1 -1
- package/dist/theme/theme-scope.cjs.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat.cjs","names":["stat","cx","statGroup"],"sources":["../../../src/components/stat/stat.tsx"],"sourcesContent":["import { createContext, forwardRef, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stat, statGroup } from \"../../styled-system/recipes\";\n\nexport type StatTone = \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\";\nexport type StatSize = \"sm\" | \"md\" | \"lg\";\nexport type StatTrendDirection = \"up\" | \"down\" | \"neutral\";\n\ninterface StatContextValue {\n size: StatSize;\n styles: ReturnType<typeof stat>;\n tone: StatTone;\n}\n\nconst StatContext = createContext<StatContextValue | null>(null);\n\nfunction useStatContext() {\n const context = useContext(StatContext);\n if (!context) {\n throw new Error(\"Stat parts must be rendered inside Stat.Root.\");\n }\n\n return context;\n}\n\nexport interface StatRootProps extends ComponentPropsWithoutRef<\"article\"> {\n size?: StatSize;\n tone?: StatTone;\n}\n\nexport const StatRoot = forwardRef<HTMLElement, StatRootProps>(function StatRoot(\n { children, className, size = \"md\", tone = \"neutral\", ...props },\n ref,\n) {\n const styles = stat({ size, tone });\n\n return (\n <StatContext.Provider value={{ size, styles, tone }}>\n <article\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"stat\"\n data-size={size}\n data-slot=\"stat\"\n data-tone={tone}\n >\n {children}\n </article>\n </StatContext.Provider>\n );\n});\n\nexport type StatIconProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatIcon = forwardRef<HTMLSpanElement, StatIconProps>(function StatIcon(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return <span {...props} ref={ref} className={cx(styles.icon, className)} data-slot=\"stat-icon\" />;\n});\n\nexport type StatLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatLabel = forwardRef<HTMLSpanElement, StatLabelProps>(function StatLabel(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span {...props} ref={ref} className={cx(styles.label, className)} data-slot=\"stat-label\" />\n );\n});\n\nexport type StatValueProps = ComponentPropsWithoutRef<\"strong\">;\nexport const StatValue = forwardRef<HTMLElement, StatValueProps>(function StatValue(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <strong {...props} ref={ref} className={cx(styles.value, className)} data-slot=\"stat-value\" />\n );\n});\n\nexport type StatDescriptionProps = ComponentPropsWithoutRef<\"p\">;\nexport const StatDescription = forwardRef<HTMLParagraphElement, StatDescriptionProps>(\n function StatDescription({ className, ...props }, ref) {\n const { styles } = useStatContext();\n return (\n <p\n {...props}\n ref={ref}\n className={cx(styles.description, className)}\n data-slot=\"stat-description\"\n />\n );\n },\n);\n\nexport interface StatTrendProps extends ComponentPropsWithoutRef<\"span\"> {\n direction?: StatTrendDirection;\n}\n\nexport const StatTrend = forwardRef<HTMLSpanElement, StatTrendProps>(function StatTrend(\n { className, direction = \"neutral\", ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.trend, stat({ direction }).trend, className)}\n data-direction={direction}\n data-slot=\"stat-trend\"\n />\n );\n});\n\nexport const Stat = {\n Root: StatRoot,\n Icon: StatIcon,\n Label: StatLabel,\n Value: StatValue,\n Description: StatDescription,\n Trend: StatTrend,\n};\n\nexport type StatGroupRootProps = ComponentPropsWithoutRef<\"div\"> & {\n columns?: 1 | 2 | 3 | 4;\n gap?: \"sm\" | \"md\" | \"lg\";\n responsive?: boolean;\n};\n\nexport const StatGroupRoot = forwardRef<HTMLDivElement, StatGroupRootProps>(function StatGroupRoot(\n { children, className, columns = 3, gap = \"md\", responsive = true, style, ...props },\n ref,\n) {\n const columnValue = String(columns) as \"1\" | \"2\" | \"3\" | \"4\";\n return (\n <div\n {...props}\n ref={ref}\n className={cx(statGroup({ columns: columnValue, gap }), className)}\n data-columns={columns}\n data-jaci-component=\"stat-group\"\n data-responsive={responsive || undefined}\n data-slot=\"stat-group\"\n style={\n responsive ? style : { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`, ...style }\n }\n >\n {children}\n </div>\n );\n});\n\nexport const StatGroup = { Root: StatGroupRoot };\n\nexport type StatGroupProps = StatGroupRootProps;\n\nexport type StatChildren = ReactNode;\n"],"mappings":";;;;;;AAgBA,MAAM,eAAA,
|
|
1
|
+
{"version":3,"file":"stat.cjs","names":["createContext","useContext","forwardRef","stat","cx","statGroup"],"sources":["../../../src/components/stat/stat.tsx"],"sourcesContent":["import { createContext, forwardRef, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stat, statGroup } from \"../../styled-system/recipes\";\n\nexport type StatTone = \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\";\nexport type StatSize = \"sm\" | \"md\" | \"lg\";\nexport type StatTrendDirection = \"up\" | \"down\" | \"neutral\";\n\ninterface StatContextValue {\n size: StatSize;\n styles: ReturnType<typeof stat>;\n tone: StatTone;\n}\n\nconst StatContext = createContext<StatContextValue | null>(null);\n\nfunction useStatContext() {\n const context = useContext(StatContext);\n if (!context) {\n throw new Error(\"Stat parts must be rendered inside Stat.Root.\");\n }\n\n return context;\n}\n\nexport interface StatRootProps extends ComponentPropsWithoutRef<\"article\"> {\n size?: StatSize;\n tone?: StatTone;\n}\n\nexport const StatRoot = forwardRef<HTMLElement, StatRootProps>(function StatRoot(\n { children, className, size = \"md\", tone = \"neutral\", ...props },\n ref,\n) {\n const styles = stat({ size, tone });\n\n return (\n <StatContext.Provider value={{ size, styles, tone }}>\n <article\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"stat\"\n data-size={size}\n data-slot=\"stat\"\n data-tone={tone}\n >\n {children}\n </article>\n </StatContext.Provider>\n );\n});\n\nexport type StatIconProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatIcon = forwardRef<HTMLSpanElement, StatIconProps>(function StatIcon(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return <span {...props} ref={ref} className={cx(styles.icon, className)} data-slot=\"stat-icon\" />;\n});\n\nexport type StatLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatLabel = forwardRef<HTMLSpanElement, StatLabelProps>(function StatLabel(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span {...props} ref={ref} className={cx(styles.label, className)} data-slot=\"stat-label\" />\n );\n});\n\nexport type StatValueProps = ComponentPropsWithoutRef<\"strong\">;\nexport const StatValue = forwardRef<HTMLElement, StatValueProps>(function StatValue(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <strong {...props} ref={ref} className={cx(styles.value, className)} data-slot=\"stat-value\" />\n );\n});\n\nexport type StatDescriptionProps = ComponentPropsWithoutRef<\"p\">;\nexport const StatDescription = forwardRef<HTMLParagraphElement, StatDescriptionProps>(\n function StatDescription({ className, ...props }, ref) {\n const { styles } = useStatContext();\n return (\n <p\n {...props}\n ref={ref}\n className={cx(styles.description, className)}\n data-slot=\"stat-description\"\n />\n );\n },\n);\n\nexport interface StatTrendProps extends ComponentPropsWithoutRef<\"span\"> {\n direction?: StatTrendDirection;\n}\n\nexport const StatTrend = forwardRef<HTMLSpanElement, StatTrendProps>(function StatTrend(\n { className, direction = \"neutral\", ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.trend, stat({ direction }).trend, className)}\n data-direction={direction}\n data-slot=\"stat-trend\"\n />\n );\n});\n\nexport const Stat = {\n Root: StatRoot,\n Icon: StatIcon,\n Label: StatLabel,\n Value: StatValue,\n Description: StatDescription,\n Trend: StatTrend,\n};\n\nexport type StatGroupRootProps = ComponentPropsWithoutRef<\"div\"> & {\n columns?: 1 | 2 | 3 | 4;\n gap?: \"sm\" | \"md\" | \"lg\";\n responsive?: boolean;\n};\n\nexport const StatGroupRoot = forwardRef<HTMLDivElement, StatGroupRootProps>(function StatGroupRoot(\n { children, className, columns = 3, gap = \"md\", responsive = true, style, ...props },\n ref,\n) {\n const columnValue = String(columns) as \"1\" | \"2\" | \"3\" | \"4\";\n return (\n <div\n {...props}\n ref={ref}\n className={cx(statGroup({ columns: columnValue, gap }), className)}\n data-columns={columns}\n data-jaci-component=\"stat-group\"\n data-responsive={responsive || undefined}\n data-slot=\"stat-group\"\n style={\n responsive ? style : { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`, ...style }\n }\n >\n {children}\n </div>\n );\n});\n\nexport const StatGroup = { Root: StatGroupRoot };\n\nexport type StatGroupProps = StatGroupRootProps;\n\nexport type StatChildren = ReactNode;\n"],"mappings":";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GAAG,SAAS;EACjE,gBAAc;EACd,uBAAoB;EACpB,mBAAiB,cAAc,KAAA;EAC/B,aAAU;EACV,OACE,aAAa,QAAQ;GAAE,qBAAqB,UAAU,QAAQ;GAAoB,GAAG;EAAM;EAG5F;CACE,CAAA;AAET,CAAC;AAED,MAAa,YAAY,EAAE,MAAM,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat.js","names":[],"sources":["../../../src/components/stat/stat.tsx"],"sourcesContent":["import { createContext, forwardRef, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stat, statGroup } from \"../../styled-system/recipes\";\n\nexport type StatTone = \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\";\nexport type StatSize = \"sm\" | \"md\" | \"lg\";\nexport type StatTrendDirection = \"up\" | \"down\" | \"neutral\";\n\ninterface StatContextValue {\n size: StatSize;\n styles: ReturnType<typeof stat>;\n tone: StatTone;\n}\n\nconst StatContext = createContext<StatContextValue | null>(null);\n\nfunction useStatContext() {\n const context = useContext(StatContext);\n if (!context) {\n throw new Error(\"Stat parts must be rendered inside Stat.Root.\");\n }\n\n return context;\n}\n\nexport interface StatRootProps extends ComponentPropsWithoutRef<\"article\"> {\n size?: StatSize;\n tone?: StatTone;\n}\n\nexport const StatRoot = forwardRef<HTMLElement, StatRootProps>(function StatRoot(\n { children, className, size = \"md\", tone = \"neutral\", ...props },\n ref,\n) {\n const styles = stat({ size, tone });\n\n return (\n <StatContext.Provider value={{ size, styles, tone }}>\n <article\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"stat\"\n data-size={size}\n data-slot=\"stat\"\n data-tone={tone}\n >\n {children}\n </article>\n </StatContext.Provider>\n );\n});\n\nexport type StatIconProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatIcon = forwardRef<HTMLSpanElement, StatIconProps>(function StatIcon(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return <span {...props} ref={ref} className={cx(styles.icon, className)} data-slot=\"stat-icon\" />;\n});\n\nexport type StatLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatLabel = forwardRef<HTMLSpanElement, StatLabelProps>(function StatLabel(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span {...props} ref={ref} className={cx(styles.label, className)} data-slot=\"stat-label\" />\n );\n});\n\nexport type StatValueProps = ComponentPropsWithoutRef<\"strong\">;\nexport const StatValue = forwardRef<HTMLElement, StatValueProps>(function StatValue(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <strong {...props} ref={ref} className={cx(styles.value, className)} data-slot=\"stat-value\" />\n );\n});\n\nexport type StatDescriptionProps = ComponentPropsWithoutRef<\"p\">;\nexport const StatDescription = forwardRef<HTMLParagraphElement, StatDescriptionProps>(\n function StatDescription({ className, ...props }, ref) {\n const { styles } = useStatContext();\n return (\n <p\n {...props}\n ref={ref}\n className={cx(styles.description, className)}\n data-slot=\"stat-description\"\n />\n );\n },\n);\n\nexport interface StatTrendProps extends ComponentPropsWithoutRef<\"span\"> {\n direction?: StatTrendDirection;\n}\n\nexport const StatTrend = forwardRef<HTMLSpanElement, StatTrendProps>(function StatTrend(\n { className, direction = \"neutral\", ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.trend, stat({ direction }).trend, className)}\n data-direction={direction}\n data-slot=\"stat-trend\"\n />\n );\n});\n\nexport const Stat = {\n Root: StatRoot,\n Icon: StatIcon,\n Label: StatLabel,\n Value: StatValue,\n Description: StatDescription,\n Trend: StatTrend,\n};\n\nexport type StatGroupRootProps = ComponentPropsWithoutRef<\"div\"> & {\n columns?: 1 | 2 | 3 | 4;\n gap?: \"sm\" | \"md\" | \"lg\";\n responsive?: boolean;\n};\n\nexport const StatGroupRoot = forwardRef<HTMLDivElement, StatGroupRootProps>(function StatGroupRoot(\n { children, className, columns = 3, gap = \"md\", responsive = true, style, ...props },\n ref,\n) {\n const columnValue = String(columns) as \"1\" | \"2\" | \"3\" | \"4\";\n return (\n <div\n {...props}\n ref={ref}\n className={cx(statGroup({ columns: columnValue, gap }), className)}\n data-columns={columns}\n data-jaci-component=\"stat-group\"\n data-responsive={responsive || undefined}\n data-slot=\"stat-group\"\n style={\n responsive ? style : { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`, ...style }\n }\n >\n {children}\n </div>\n );\n});\n\nexport const StatGroup = { Root: StatGroupRoot };\n\nexport type StatGroupProps = StatGroupRootProps;\n\nexport type StatChildren = ReactNode;\n"],"mappings":";;;;;;AAgBA,MAAM,cAAc,cAAuC,IAAI;AAE/D,SAAS,iBAAiB;CACxB,MAAM,UAAU,WAAW,WAAW;CACtC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,+CAA+C;CAGjE,OAAO;AACT;AAOA,MAAa,WAAW,WAAuC,SAAS,SACtE,EAAE,UAAU,WAAW,OAAO,MAAM,OAAO,WAAW,GAAG,SACzD,KACA;CACA,MAAM,SAAS,KAAK;EAAE;EAAM;CAAK,CAAC;CAElC,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;GAAE;GAAM;GAAQ;EAAK;
|
|
1
|
+
{"version":3,"file":"stat.js","names":[],"sources":["../../../src/components/stat/stat.tsx"],"sourcesContent":["import { createContext, forwardRef, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stat, statGroup } from \"../../styled-system/recipes\";\n\nexport type StatTone = \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\";\nexport type StatSize = \"sm\" | \"md\" | \"lg\";\nexport type StatTrendDirection = \"up\" | \"down\" | \"neutral\";\n\ninterface StatContextValue {\n size: StatSize;\n styles: ReturnType<typeof stat>;\n tone: StatTone;\n}\n\nconst StatContext = createContext<StatContextValue | null>(null);\n\nfunction useStatContext() {\n const context = useContext(StatContext);\n if (!context) {\n throw new Error(\"Stat parts must be rendered inside Stat.Root.\");\n }\n\n return context;\n}\n\nexport interface StatRootProps extends ComponentPropsWithoutRef<\"article\"> {\n size?: StatSize;\n tone?: StatTone;\n}\n\nexport const StatRoot = forwardRef<HTMLElement, StatRootProps>(function StatRoot(\n { children, className, size = \"md\", tone = \"neutral\", ...props },\n ref,\n) {\n const styles = stat({ size, tone });\n\n return (\n <StatContext.Provider value={{ size, styles, tone }}>\n <article\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"stat\"\n data-size={size}\n data-slot=\"stat\"\n data-tone={tone}\n >\n {children}\n </article>\n </StatContext.Provider>\n );\n});\n\nexport type StatIconProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatIcon = forwardRef<HTMLSpanElement, StatIconProps>(function StatIcon(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return <span {...props} ref={ref} className={cx(styles.icon, className)} data-slot=\"stat-icon\" />;\n});\n\nexport type StatLabelProps = ComponentPropsWithoutRef<\"span\">;\nexport const StatLabel = forwardRef<HTMLSpanElement, StatLabelProps>(function StatLabel(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span {...props} ref={ref} className={cx(styles.label, className)} data-slot=\"stat-label\" />\n );\n});\n\nexport type StatValueProps = ComponentPropsWithoutRef<\"strong\">;\nexport const StatValue = forwardRef<HTMLElement, StatValueProps>(function StatValue(\n { className, ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <strong {...props} ref={ref} className={cx(styles.value, className)} data-slot=\"stat-value\" />\n );\n});\n\nexport type StatDescriptionProps = ComponentPropsWithoutRef<\"p\">;\nexport const StatDescription = forwardRef<HTMLParagraphElement, StatDescriptionProps>(\n function StatDescription({ className, ...props }, ref) {\n const { styles } = useStatContext();\n return (\n <p\n {...props}\n ref={ref}\n className={cx(styles.description, className)}\n data-slot=\"stat-description\"\n />\n );\n },\n);\n\nexport interface StatTrendProps extends ComponentPropsWithoutRef<\"span\"> {\n direction?: StatTrendDirection;\n}\n\nexport const StatTrend = forwardRef<HTMLSpanElement, StatTrendProps>(function StatTrend(\n { className, direction = \"neutral\", ...props },\n ref,\n) {\n const { styles } = useStatContext();\n return (\n <span\n {...props}\n ref={ref}\n className={cx(styles.trend, stat({ direction }).trend, className)}\n data-direction={direction}\n data-slot=\"stat-trend\"\n />\n );\n});\n\nexport const Stat = {\n Root: StatRoot,\n Icon: StatIcon,\n Label: StatLabel,\n Value: StatValue,\n Description: StatDescription,\n Trend: StatTrend,\n};\n\nexport type StatGroupRootProps = ComponentPropsWithoutRef<\"div\"> & {\n columns?: 1 | 2 | 3 | 4;\n gap?: \"sm\" | \"md\" | \"lg\";\n responsive?: boolean;\n};\n\nexport const StatGroupRoot = forwardRef<HTMLDivElement, StatGroupRootProps>(function StatGroupRoot(\n { children, className, columns = 3, gap = \"md\", responsive = true, style, ...props },\n ref,\n) {\n const columnValue = String(columns) as \"1\" | \"2\" | \"3\" | \"4\";\n return (\n <div\n {...props}\n ref={ref}\n className={cx(statGroup({ columns: columnValue, gap }), className)}\n data-columns={columns}\n data-jaci-component=\"stat-group\"\n data-responsive={responsive || undefined}\n data-slot=\"stat-group\"\n style={\n responsive ? style : { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`, ...style }\n }\n >\n {children}\n </div>\n );\n});\n\nexport const StatGroup = { Root: StatGroupRoot };\n\nexport type StatGroupProps = StatGroupRootProps;\n\nexport type StatChildren = ReactNode;\n"],"mappings":";;;;;;AAgBA,MAAM,cAAc,cAAuC,IAAI;AAE/D,SAAS,iBAAiB;CACxB,MAAM,UAAU,WAAW,WAAW;CACtC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,+CAA+C;CAGjE,OAAO;AACT;AAOA,MAAa,WAAW,WAAuC,SAAS,SACtE,EAAE,UAAU,WAAW,OAAO,MAAM,OAAO,WAAW,GAAG,SACzD,KACA;CACA,MAAM,SAAS,KAAK;EAAE;EAAM;CAAK,CAAC;CAElC,O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GAAG,OAAO,OAAO,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,SAAS;EAChE,kBAAgB;EAChB,aAAU;CACX,CAAA;AAEL,CAAC;AAED,MAAa,OAAO;CAClB,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,aAAa;CACb,OAAO;AACT;AAQA,MAAa,gBAAgB,WAA+C,SAAS,cACnF,EAAE,UAAU,WAAW,UAAU,GAAG,MAAM,MAAM,aAAa,MAAM,OAAO,GAAG,SAC7E,KACA;CACA,MAAM,cAAc,OAAO,OAAO;CAClC,OACE,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,UAAU;GAAE,SAAS;GAAa;EAAI,CAAC,GAAG,SAAS;EACjE,gBAAc;EACd,uBAAoB;EACpB,mBAAiB,cAAc,KAAA;EAC/B,aAAU;EACV,OACE,aAAa,QAAQ;GAAE,qBAAqB,UAAU,QAAQ;GAAoB,GAAG;EAAM;EAG5F;CACE,CAAA;AAET,CAAC;AAED,MAAa,YAAY,EAAE,MAAM,cAAc"}
|
|
@@ -247,9 +247,10 @@ const StepperIndicator = (0, react.forwardRef)(function StepperIndicator({ child
|
|
|
247
247
|
function createSpanSlot(slot) {
|
|
248
248
|
return (0, react.forwardRef)(function StepperSlot({ className, ...props }, ref) {
|
|
249
249
|
const { orientation } = useStepperContext();
|
|
250
|
+
const item = useStepperItemContext();
|
|
250
251
|
const styles = require_stepper.stepper({
|
|
251
252
|
orientation,
|
|
252
|
-
status:
|
|
253
|
+
status: item.status
|
|
253
254
|
});
|
|
254
255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
255
256
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.cjs","names":["cx","stepper"],"sources":["../../../src/components/stepper/stepper.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stepper } from \"../../styled-system/recipes\";\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\nexport type StepperStatus = \"current\" | \"complete\" | \"upcoming\" | \"disabled\";\n\ninterface StepRecord {\n value: string;\n disabled: boolean;\n status?: StepperStatus;\n}\n\ninterface StepperContextValue {\n activeValue: string | undefined;\n allowStepSelect: boolean;\n disabled: boolean;\n getStatus: (value: string, status?: StepperStatus, disabled?: boolean) => StepperStatus;\n goTo: (value: string, options?: { fromNavigation?: boolean }) => void;\n linear: boolean;\n orientation: StepperOrientation;\n register: (record: StepRecord) => void;\n unregister: (value: string) => void;\n move: (direction: -1 | 1) => void;\n moveToBoundary: (direction: -1 | 1) => void;\n}\n\ninterface StepperItemContextValue {\n disabled: boolean;\n status: StepperStatus;\n value: string;\n}\n\nconst StepperContext = createContext<StepperContextValue | null>(null);\nconst StepperItemContext = createContext<StepperItemContextValue | null>(null);\n\nfunction useStepperContext() {\n const context = useContext(StepperContext);\n if (!context) throw new Error(\"Stepper parts must be rendered inside Stepper.Root.\");\n return context;\n}\n\nfunction useStepperItemContext() {\n const context = useContext(StepperItemContext);\n if (!context) throw new Error(\"This Stepper part must be rendered inside Stepper.Item.\");\n return context;\n}\n\nexport interface StepperRootProps extends Omit<ComponentPropsWithoutRef<\"nav\">, \"children\"> {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n orientation?: StepperOrientation;\n linear?: boolean;\n allowStepSelect?: boolean;\n disabled?: boolean;\n name?: string;\n form?: string;\n children?: ReactNode;\n}\n\nexport const StepperRoot = forwardRef<HTMLElement, StepperRootProps>(function StepperRoot(\n {\n allowStepSelect = true,\n \"aria-label\": ariaLabel,\n children,\n className,\n defaultValue,\n disabled = false,\n form,\n linear = false,\n name,\n onValueChange,\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const [records, setRecords] = useState<StepRecord[]>([]);\n const activeValue = controlledValue ?? uncontrolledValue ?? records[0]?.value;\n\n const register = useCallback((record: StepRecord) => {\n setRecords((current) => {\n const index = current.findIndex((item) => item.value === record.value);\n if (index === -1) return [...current, record];\n const currentRecord = current[index];\n if (!currentRecord) return current;\n if (currentRecord.disabled === record.disabled && currentRecord.status === record.status) {\n return current;\n }\n const next = current.slice();\n next[index] = record;\n return next;\n });\n }, []);\n\n const unregister = useCallback((valueToRemove: string) => {\n setRecords((current) => current.filter((item) => item.value !== valueToRemove));\n }, []);\n\n const goTo = useCallback(\n (nextValue: string, options?: { fromNavigation?: boolean }) => {\n if (disabled) return;\n const targetIndex = records.findIndex((item) => item.value === nextValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n const target = records[targetIndex];\n if (!target || target.disabled) return;\n if (nextValue === activeValue) return;\n if (!allowStepSelect && !options?.fromNavigation && nextValue !== activeValue) return;\n if (linear && activeIndex >= 0 && targetIndex > activeIndex + 1) return;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n },\n [activeValue, allowStepSelect, controlledValue, disabled, linear, onValueChange, records],\n );\n\n const move = useCallback(\n (direction: -1 | 1) => {\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n let index = activeIndex + direction;\n while (index >= 0 && index < records.length && records[index]?.disabled) index += direction;\n const target = records[index];\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [activeValue, goTo, records],\n );\n\n const moveToBoundary = useCallback(\n (direction: -1 | 1) => {\n const candidates = direction === -1 ? records : records.slice().reverse();\n const target = candidates.find((record) => !record.disabled);\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [goTo, records],\n );\n\n const getStatus = useCallback(\n (itemValue: string, explicitStatus?: StepperStatus, itemDisabled = false) => {\n if (itemDisabled || disabled) return \"disabled\";\n if (explicitStatus) return explicitStatus;\n const itemIndex = records.findIndex((item) => item.value === itemValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n if (itemValue === activeValue || (activeIndex < 0 && itemIndex === 0)) return \"current\";\n if (itemIndex >= 0 && activeIndex >= 0 && itemIndex < activeIndex) return \"complete\";\n return \"upcoming\";\n },\n [activeValue, disabled, records],\n );\n\n const context = useMemo(\n () => ({\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n }),\n [\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n ],\n );\n\n return (\n <StepperContext.Provider value={context}>\n <nav\n {...props}\n aria-label={ariaLabel ?? \"Progress\"}\n className={cx(stepper({ orientation }).root, className)}\n data-jaci-component=\"stepper\"\n data-orientation={orientation}\n data-slot=\"stepper\"\n data-state={disabled ? \"disabled\" : \"active\"}\n ref={ref}\n >\n {children}\n {name ? (\n <input\n aria-hidden=\"true\"\n name={name}\n type=\"hidden\"\n value={activeValue ?? \"\"}\n form={form}\n />\n ) : null}\n </nav>\n </StepperContext.Provider>\n );\n});\n\nexport type StepperListProps = ComponentPropsWithoutRef<\"ol\">;\nexport const StepperList = forwardRef<HTMLOListElement, StepperListProps>(function StepperList(\n { className, ...props },\n ref,\n) {\n const { orientation } = useStepperContext();\n return (\n <ol\n {...props}\n className={cx(stepper({ orientation }).list, className)}\n data-slot=\"stepper-list\"\n ref={ref}\n />\n );\n});\n\nexport interface StepperItemProps extends ComponentPropsWithoutRef<\"li\"> {\n value: string;\n status?: StepperStatus;\n disabled?: boolean;\n}\n\nexport const StepperItem = forwardRef<HTMLLIElement, StepperItemProps>(function StepperItem(\n { children, className, disabled = false, status, value, ...props },\n ref,\n) {\n const context = useStepperContext();\n const resolvedStatus = context.getStatus(value, status, disabled);\n useEffect(() => {\n const record: StepRecord = { disabled: disabled || status === \"disabled\", value };\n if (status !== undefined) record.status = status;\n context.register(record);\n return () => context.unregister(value);\n }, [context.register, context.unregister, disabled, status, value]);\n const itemContext = useMemo<StepperItemContextValue>(\n () => ({\n disabled: disabled || context.disabled || resolvedStatus === \"disabled\",\n status: resolvedStatus,\n value,\n }),\n [context.disabled, disabled, resolvedStatus, value],\n );\n const styles = stepper({ orientation: context.orientation, status: resolvedStatus });\n\n return (\n <StepperItemContext.Provider value={itemContext}>\n <li\n {...props}\n aria-disabled={itemContext.disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={itemContext.disabled || undefined}\n data-jaci-component=\"stepper-item\"\n data-slot=\"stepper-item\"\n data-status={resolvedStatus}\n data-value={value}\n ref={ref}\n >\n {children}\n </li>\n </StepperItemContext.Provider>\n );\n});\n\nexport type StepperTriggerProps = ComponentPropsWithoutRef<\"button\">;\nexport const StepperTrigger = forwardRef<HTMLButtonElement, StepperTriggerProps>(\n function StepperTrigger({ className, onClick, onKeyDown, type = \"button\", ...props }, ref) {\n const context = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation: context.orientation, status: item.status });\n return (\n <button\n {...props}\n aria-current={item.status === \"current\" ? \"step\" : undefined}\n aria-disabled={\n item.disabled || (!context.allowStepSelect && item.status !== \"current\") || undefined\n }\n className={cx(styles.trigger, className)}\n data-disabled={item.disabled || undefined}\n data-slot=\"stepper-trigger\"\n data-status={item.status}\n disabled={context.disabled || item.disabled}\n onClick={(event) => {\n if (!event.defaultPrevented) context.goTo(item.value);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n const isForwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowRight\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowDown\");\n const isBackwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowLeft\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowUp\");\n if (isForwardKey) {\n event.preventDefault();\n context.move(1);\n } else if (isBackwardKey) {\n event.preventDefault();\n context.move(-1);\n } else if (event.key === \"Home\") {\n event.preventDefault();\n context.moveToBoundary(-1);\n } else if (event.key === \"End\") {\n event.preventDefault();\n context.moveToBoundary(1);\n }\n onKeyDown?.(event);\n }}\n ref={ref}\n type={type}\n />\n );\n },\n);\n\nexport type StepperIndicatorProps = ComponentPropsWithoutRef<\"span\">;\nexport const StepperIndicator = forwardRef<HTMLSpanElement, StepperIndicatorProps>(\n function StepperIndicator({ children, className, ...props }, ref) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n aria-hidden={props[\"aria-hidden\"] ?? true}\n className={cx(styles.indicator, className)}\n data-slot=\"stepper-indicator\"\n data-status={item.status}\n ref={ref}\n >\n {children ?? (item.status === \"complete\" ? \"✓\" : \"\")}\n </span>\n );\n },\n);\n\nfunction createSpanSlot(slot: \"title\" | \"description\" | \"separator\") {\n return forwardRef<HTMLSpanElement, ComponentPropsWithoutRef<\"span\">>(function StepperSlot(\n { className, ...props },\n ref,\n ) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n className={cx(styles[slot], className)}\n data-slot={`stepper-${slot}`}\n ref={ref}\n />\n );\n });\n}\n\nexport const StepperTitle = createSpanSlot(\"title\");\nexport const StepperDescription = createSpanSlot(\"description\");\n\nexport const StepperContent = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function StepperContent({ className, hidden, ...props }, ref) {\n const item = useStepperItemContext();\n const { orientation } = useStepperContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <div\n {...props}\n className={cx(styles.content, className)}\n data-slot=\"stepper-content\"\n hidden={hidden ?? item.status !== \"current\"}\n ref={ref}\n />\n );\n },\n);\n\nexport const StepperSeparator = createSpanSlot(\"separator\");\n\nexport interface StepperNavigationButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\n\nexport const StepperPrevious = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperPrevious(\n { children = \"Previous\", className, disabled: disabledProp, ...props },\n ref,\n ) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.previous, className)}\n data-slot=\"stepper-previous\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(-1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const StepperNext = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperNext({ children = \"Next\", className, disabled: disabledProp, ...props }, ref) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.next, className)}\n data-slot=\"stepper-next\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const Stepper = {\n Root: StepperRoot,\n List: StepperList,\n Item: StepperItem,\n Trigger: StepperTrigger,\n Indicator: StepperIndicator,\n Title: StepperTitle,\n Description: StepperDescription,\n Content: StepperContent,\n Separator: StepperSeparator,\n Previous: StepperPrevious,\n Next: StepperNext,\n};\n"],"mappings":";;;;;;AA6CA,MAAM,kBAAA,GAAA,MAAA,cAAA,CAA2D,IAAI;AACrE,MAAM,sBAAA,GAAA,MAAA,cAAA,CAAmE,IAAI;AAE7E,SAAS,oBAAoB;CAC3B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,cAAc;CACzC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,qDAAqD;CACnF,OAAO;AACT;AAEA,SAAS,wBAAwB;CAC/B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,kBAAkB;CAC7C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,yDAAyD;CACvF,OAAO;AACT;AAeA,MAAa,eAAA,GAAA,MAAA,WAAA,CAAwD,SAAS,YAC5E,EACE,kBAAkB,MAClB,cAAc,WACd,UACA,WACA,cACA,WAAW,OACX,MACA,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AU,kBAAkB;CAClC,MAAM,SAASC,gBAAAA,QAAQ,EAAE,aAAa,QAAQ,YAAY,CAAC;CAC3D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EACE,GAAI;EACJ,WAAWD,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,aAAU;EACV,UAAU,gBAAgB,QAAQ;EAClC,UAAU,UAAU;GAClB,QAAQ,KAAK,CAAC;GACd,MAAM,UAAU,KAAK;EACvB;EACK;EACL,MAAM,MAAM,QAAQ;EAEnB;CACK,CAAA;AAEZ,CACF;AAEA,MAAa,UAAU;CACrB,MAAM;CACN,MAAM;CACN,MAAM;CACN,SAAS;CACT,WAAW;CACX,OAAO;CACP,aAAa;CACb,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;AACR"}
|
|
1
|
+
{"version":3,"file":"stepper.cjs","names":["createContext","useContext","forwardRef","useState","useCallback","useMemo","cx","stepper"],"sources":["../../../src/components/stepper/stepper.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stepper } from \"../../styled-system/recipes\";\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\nexport type StepperStatus = \"current\" | \"complete\" | \"upcoming\" | \"disabled\";\n\ninterface StepRecord {\n value: string;\n disabled: boolean;\n status?: StepperStatus;\n}\n\ninterface StepperContextValue {\n activeValue: string | undefined;\n allowStepSelect: boolean;\n disabled: boolean;\n getStatus: (value: string, status?: StepperStatus, disabled?: boolean) => StepperStatus;\n goTo: (value: string, options?: { fromNavigation?: boolean }) => void;\n linear: boolean;\n orientation: StepperOrientation;\n register: (record: StepRecord) => void;\n unregister: (value: string) => void;\n move: (direction: -1 | 1) => void;\n moveToBoundary: (direction: -1 | 1) => void;\n}\n\ninterface StepperItemContextValue {\n disabled: boolean;\n status: StepperStatus;\n value: string;\n}\n\nconst StepperContext = createContext<StepperContextValue | null>(null);\nconst StepperItemContext = createContext<StepperItemContextValue | null>(null);\n\nfunction useStepperContext() {\n const context = useContext(StepperContext);\n if (!context) throw new Error(\"Stepper parts must be rendered inside Stepper.Root.\");\n return context;\n}\n\nfunction useStepperItemContext() {\n const context = useContext(StepperItemContext);\n if (!context) throw new Error(\"This Stepper part must be rendered inside Stepper.Item.\");\n return context;\n}\n\nexport interface StepperRootProps extends Omit<ComponentPropsWithoutRef<\"nav\">, \"children\"> {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n orientation?: StepperOrientation;\n linear?: boolean;\n allowStepSelect?: boolean;\n disabled?: boolean;\n name?: string;\n form?: string;\n children?: ReactNode;\n}\n\nexport const StepperRoot = forwardRef<HTMLElement, StepperRootProps>(function StepperRoot(\n {\n allowStepSelect = true,\n \"aria-label\": ariaLabel,\n children,\n className,\n defaultValue,\n disabled = false,\n form,\n linear = false,\n name,\n onValueChange,\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const [records, setRecords] = useState<StepRecord[]>([]);\n const activeValue = controlledValue ?? uncontrolledValue ?? records[0]?.value;\n\n const register = useCallback((record: StepRecord) => {\n setRecords((current) => {\n const index = current.findIndex((item) => item.value === record.value);\n if (index === -1) return [...current, record];\n const currentRecord = current[index];\n if (!currentRecord) return current;\n if (currentRecord.disabled === record.disabled && currentRecord.status === record.status) {\n return current;\n }\n const next = current.slice();\n next[index] = record;\n return next;\n });\n }, []);\n\n const unregister = useCallback((valueToRemove: string) => {\n setRecords((current) => current.filter((item) => item.value !== valueToRemove));\n }, []);\n\n const goTo = useCallback(\n (nextValue: string, options?: { fromNavigation?: boolean }) => {\n if (disabled) return;\n const targetIndex = records.findIndex((item) => item.value === nextValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n const target = records[targetIndex];\n if (!target || target.disabled) return;\n if (nextValue === activeValue) return;\n if (!allowStepSelect && !options?.fromNavigation && nextValue !== activeValue) return;\n if (linear && activeIndex >= 0 && targetIndex > activeIndex + 1) return;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n },\n [activeValue, allowStepSelect, controlledValue, disabled, linear, onValueChange, records],\n );\n\n const move = useCallback(\n (direction: -1 | 1) => {\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n let index = activeIndex + direction;\n while (index >= 0 && index < records.length && records[index]?.disabled) index += direction;\n const target = records[index];\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [activeValue, goTo, records],\n );\n\n const moveToBoundary = useCallback(\n (direction: -1 | 1) => {\n const candidates = direction === -1 ? records : records.slice().reverse();\n const target = candidates.find((record) => !record.disabled);\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [goTo, records],\n );\n\n const getStatus = useCallback(\n (itemValue: string, explicitStatus?: StepperStatus, itemDisabled = false) => {\n if (itemDisabled || disabled) return \"disabled\";\n if (explicitStatus) return explicitStatus;\n const itemIndex = records.findIndex((item) => item.value === itemValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n if (itemValue === activeValue || (activeIndex < 0 && itemIndex === 0)) return \"current\";\n if (itemIndex >= 0 && activeIndex >= 0 && itemIndex < activeIndex) return \"complete\";\n return \"upcoming\";\n },\n [activeValue, disabled, records],\n );\n\n const context = useMemo(\n () => ({\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n }),\n [\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n ],\n );\n\n return (\n <StepperContext.Provider value={context}>\n <nav\n {...props}\n aria-label={ariaLabel ?? \"Progress\"}\n className={cx(stepper({ orientation }).root, className)}\n data-jaci-component=\"stepper\"\n data-orientation={orientation}\n data-slot=\"stepper\"\n data-state={disabled ? \"disabled\" : \"active\"}\n ref={ref}\n >\n {children}\n {name ? (\n <input\n aria-hidden=\"true\"\n name={name}\n type=\"hidden\"\n value={activeValue ?? \"\"}\n form={form}\n />\n ) : null}\n </nav>\n </StepperContext.Provider>\n );\n});\n\nexport type StepperListProps = ComponentPropsWithoutRef<\"ol\">;\nexport const StepperList = forwardRef<HTMLOListElement, StepperListProps>(function StepperList(\n { className, ...props },\n ref,\n) {\n const { orientation } = useStepperContext();\n return (\n <ol\n {...props}\n className={cx(stepper({ orientation }).list, className)}\n data-slot=\"stepper-list\"\n ref={ref}\n />\n );\n});\n\nexport interface StepperItemProps extends ComponentPropsWithoutRef<\"li\"> {\n value: string;\n status?: StepperStatus;\n disabled?: boolean;\n}\n\nexport const StepperItem = forwardRef<HTMLLIElement, StepperItemProps>(function StepperItem(\n { children, className, disabled = false, status, value, ...props },\n ref,\n) {\n const context = useStepperContext();\n const resolvedStatus = context.getStatus(value, status, disabled);\n useEffect(() => {\n const record: StepRecord = { disabled: disabled || status === \"disabled\", value };\n if (status !== undefined) record.status = status;\n context.register(record);\n return () => context.unregister(value);\n }, [context.register, context.unregister, disabled, status, value]);\n const itemContext = useMemo<StepperItemContextValue>(\n () => ({\n disabled: disabled || context.disabled || resolvedStatus === \"disabled\",\n status: resolvedStatus,\n value,\n }),\n [context.disabled, disabled, resolvedStatus, value],\n );\n const styles = stepper({ orientation: context.orientation, status: resolvedStatus });\n\n return (\n <StepperItemContext.Provider value={itemContext}>\n <li\n {...props}\n aria-disabled={itemContext.disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={itemContext.disabled || undefined}\n data-jaci-component=\"stepper-item\"\n data-slot=\"stepper-item\"\n data-status={resolvedStatus}\n data-value={value}\n ref={ref}\n >\n {children}\n </li>\n </StepperItemContext.Provider>\n );\n});\n\nexport type StepperTriggerProps = ComponentPropsWithoutRef<\"button\">;\nexport const StepperTrigger = forwardRef<HTMLButtonElement, StepperTriggerProps>(\n function StepperTrigger({ className, onClick, onKeyDown, type = \"button\", ...props }, ref) {\n const context = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation: context.orientation, status: item.status });\n return (\n <button\n {...props}\n aria-current={item.status === \"current\" ? \"step\" : undefined}\n aria-disabled={\n item.disabled || (!context.allowStepSelect && item.status !== \"current\") || undefined\n }\n className={cx(styles.trigger, className)}\n data-disabled={item.disabled || undefined}\n data-slot=\"stepper-trigger\"\n data-status={item.status}\n disabled={context.disabled || item.disabled}\n onClick={(event) => {\n if (!event.defaultPrevented) context.goTo(item.value);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n const isForwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowRight\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowDown\");\n const isBackwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowLeft\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowUp\");\n if (isForwardKey) {\n event.preventDefault();\n context.move(1);\n } else if (isBackwardKey) {\n event.preventDefault();\n context.move(-1);\n } else if (event.key === \"Home\") {\n event.preventDefault();\n context.moveToBoundary(-1);\n } else if (event.key === \"End\") {\n event.preventDefault();\n context.moveToBoundary(1);\n }\n onKeyDown?.(event);\n }}\n ref={ref}\n type={type}\n />\n );\n },\n);\n\nexport type StepperIndicatorProps = ComponentPropsWithoutRef<\"span\">;\nexport const StepperIndicator = forwardRef<HTMLSpanElement, StepperIndicatorProps>(\n function StepperIndicator({ children, className, ...props }, ref) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n aria-hidden={props[\"aria-hidden\"] ?? true}\n className={cx(styles.indicator, className)}\n data-slot=\"stepper-indicator\"\n data-status={item.status}\n ref={ref}\n >\n {children ?? (item.status === \"complete\" ? \"✓\" : \"\")}\n </span>\n );\n },\n);\n\nfunction createSpanSlot(slot: \"title\" | \"description\" | \"separator\") {\n return forwardRef<HTMLSpanElement, ComponentPropsWithoutRef<\"span\">>(function StepperSlot(\n { className, ...props },\n ref,\n ) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n className={cx(styles[slot], className)}\n data-slot={`stepper-${slot}`}\n ref={ref}\n />\n );\n });\n}\n\nexport const StepperTitle = createSpanSlot(\"title\");\nexport const StepperDescription = createSpanSlot(\"description\");\n\nexport const StepperContent = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function StepperContent({ className, hidden, ...props }, ref) {\n const item = useStepperItemContext();\n const { orientation } = useStepperContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <div\n {...props}\n className={cx(styles.content, className)}\n data-slot=\"stepper-content\"\n hidden={hidden ?? item.status !== \"current\"}\n ref={ref}\n />\n );\n },\n);\n\nexport const StepperSeparator = createSpanSlot(\"separator\");\n\nexport interface StepperNavigationButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\n\nexport const StepperPrevious = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperPrevious(\n { children = \"Previous\", className, disabled: disabledProp, ...props },\n ref,\n ) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.previous, className)}\n data-slot=\"stepper-previous\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(-1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const StepperNext = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperNext({ children = \"Next\", className, disabled: disabledProp, ...props }, ref) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.next, className)}\n data-slot=\"stepper-next\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const Stepper = {\n Root: StepperRoot,\n List: StepperList,\n Item: StepperItem,\n Trigger: StepperTrigger,\n Indicator: StepperIndicator,\n Title: StepperTitle,\n Description: StepperDescription,\n Content: StepperContent,\n Separator: StepperSeparator,\n Previous: StepperPrevious,\n Next: StepperNext,\n};\n"],"mappings":";;;;;;AA6CA,MAAM,kBAAA,GAAiBA,MAAAA,cAAAA,CAA0C,IAAI;AACrE,MAAM,sBAAA,GAAqBA,MAAAA,cAAAA,CAA8C,IAAI;AAE7E,SAAS,oBAAoB;CAC3B,MAAM,WAAA,GAAUC,MAAAA,WAAAA,CAAW,cAAc;CACzC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,qDAAqD;CACnF,OAAO;AACT;AAEA,SAAS,wBAAwB;CAC/B,MAAM,WAAA,GAAUA,MAAAA,WAAAA,CAAW,kBAAkB;CAC7C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,yDAAyD;CACvF,OAAO;AACT;AAeA,MAAa,eAAA,GAAcC,MAAAA,WAAAA,CAA0C,SAAS,YAC5E,EACE,kBAAkB,MAClB,cAAc,WACd,UACA,WACA,cACA,WAAW,OACX,MACA,SAAS,OACT,MACA,eACA,cAAc,cACd,OAAO,iBACP,GAAG,SAEL,KACA;CACA,MAAM,CAAC,mBAAmB,yBAAA,GAAwBC,MAAAA,SAAAA,CAAS,YAAY;CACvE,MAAM,CAAC,SAAS,eAAA,GAAcA,MAAAA,SAAAA,CAAuB,CAAC,CAAC;CACvD,MAAM,cAAc,mBAAmB,qBAAqB,QAAQ,EAAE,EAAE;CAExE,MAAM,YAAA,GAAWC,MAAAA,YAAAA,EAAa,WAAuB;EACnD,YAAY,YAAY;GACtB,MAAM,QAAQ,QAAQ,WAAW,SAAS,KAAK,UAAU,OAAO,KAAK;GACrE,IAAI,UAAU,IAAI,OAAO,CAAC,GAAG,SAAS,MAAM;GAC5C,MAAM,gBAAgB,QAAQ;GAC9B,IAAI,CAAC,eAAe,OAAO;GA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MAAM;CACN,MAAM;CACN,MAAM;CACN,SAAS;CACT,WAAW;CACX,OAAO;CACP,aAAa;CACb,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;AACR"}
|
|
@@ -247,9 +247,10 @@ const StepperIndicator = forwardRef(function StepperIndicator({ children, classN
|
|
|
247
247
|
function createSpanSlot(slot) {
|
|
248
248
|
return forwardRef(function StepperSlot({ className, ...props }, ref) {
|
|
249
249
|
const { orientation } = useStepperContext();
|
|
250
|
+
const item = useStepperItemContext();
|
|
250
251
|
const styles = stepper({
|
|
251
252
|
orientation,
|
|
252
|
-
status:
|
|
253
|
+
status: item.status
|
|
253
254
|
});
|
|
254
255
|
return /* @__PURE__ */ jsx("span", {
|
|
255
256
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.js","names":[],"sources":["../../../src/components/stepper/stepper.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stepper } from \"../../styled-system/recipes\";\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\nexport type StepperStatus = \"current\" | \"complete\" | \"upcoming\" | \"disabled\";\n\ninterface StepRecord {\n value: string;\n disabled: boolean;\n status?: StepperStatus;\n}\n\ninterface StepperContextValue {\n activeValue: string | undefined;\n allowStepSelect: boolean;\n disabled: boolean;\n getStatus: (value: string, status?: StepperStatus, disabled?: boolean) => StepperStatus;\n goTo: (value: string, options?: { fromNavigation?: boolean }) => void;\n linear: boolean;\n orientation: StepperOrientation;\n register: (record: StepRecord) => void;\n unregister: (value: string) => void;\n move: (direction: -1 | 1) => void;\n moveToBoundary: (direction: -1 | 1) => void;\n}\n\ninterface StepperItemContextValue {\n disabled: boolean;\n status: StepperStatus;\n value: string;\n}\n\nconst StepperContext = createContext<StepperContextValue | null>(null);\nconst StepperItemContext = createContext<StepperItemContextValue | null>(null);\n\nfunction useStepperContext() {\n const context = useContext(StepperContext);\n if (!context) throw new Error(\"Stepper parts must be rendered inside Stepper.Root.\");\n return context;\n}\n\nfunction useStepperItemContext() {\n const context = useContext(StepperItemContext);\n if (!context) throw new Error(\"This Stepper part must be rendered inside Stepper.Item.\");\n return context;\n}\n\nexport interface StepperRootProps extends Omit<ComponentPropsWithoutRef<\"nav\">, \"children\"> {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n orientation?: StepperOrientation;\n linear?: boolean;\n allowStepSelect?: boolean;\n disabled?: boolean;\n name?: string;\n form?: string;\n children?: ReactNode;\n}\n\nexport const StepperRoot = forwardRef<HTMLElement, StepperRootProps>(function StepperRoot(\n {\n allowStepSelect = true,\n \"aria-label\": ariaLabel,\n children,\n className,\n defaultValue,\n disabled = false,\n form,\n linear = false,\n name,\n onValueChange,\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const [records, setRecords] = useState<StepRecord[]>([]);\n const activeValue = controlledValue ?? uncontrolledValue ?? records[0]?.value;\n\n const register = useCallback((record: StepRecord) => {\n setRecords((current) => {\n const index = current.findIndex((item) => item.value === record.value);\n if (index === -1) return [...current, record];\n const currentRecord = current[index];\n if (!currentRecord) return current;\n if (currentRecord.disabled === record.disabled && currentRecord.status === record.status) {\n return current;\n }\n const next = current.slice();\n next[index] = record;\n return next;\n });\n }, []);\n\n const unregister = useCallback((valueToRemove: string) => {\n setRecords((current) => current.filter((item) => item.value !== valueToRemove));\n }, []);\n\n const goTo = useCallback(\n (nextValue: string, options?: { fromNavigation?: boolean }) => {\n if (disabled) return;\n const targetIndex = records.findIndex((item) => item.value === nextValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n const target = records[targetIndex];\n if (!target || target.disabled) return;\n if (nextValue === activeValue) return;\n if (!allowStepSelect && !options?.fromNavigation && nextValue !== activeValue) return;\n if (linear && activeIndex >= 0 && targetIndex > activeIndex + 1) return;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n },\n [activeValue, allowStepSelect, controlledValue, disabled, linear, onValueChange, records],\n );\n\n const move = useCallback(\n (direction: -1 | 1) => {\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n let index = activeIndex + direction;\n while (index >= 0 && index < records.length && records[index]?.disabled) index += direction;\n const target = records[index];\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [activeValue, goTo, records],\n );\n\n const moveToBoundary = useCallback(\n (direction: -1 | 1) => {\n const candidates = direction === -1 ? records : records.slice().reverse();\n const target = candidates.find((record) => !record.disabled);\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [goTo, records],\n );\n\n const getStatus = useCallback(\n (itemValue: string, explicitStatus?: StepperStatus, itemDisabled = false) => {\n if (itemDisabled || disabled) return \"disabled\";\n if (explicitStatus) return explicitStatus;\n const itemIndex = records.findIndex((item) => item.value === itemValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n if (itemValue === activeValue || (activeIndex < 0 && itemIndex === 0)) return \"current\";\n if (itemIndex >= 0 && activeIndex >= 0 && itemIndex < activeIndex) return \"complete\";\n return \"upcoming\";\n },\n [activeValue, disabled, records],\n );\n\n const context = useMemo(\n () => ({\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n }),\n [\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n ],\n );\n\n return (\n <StepperContext.Provider value={context}>\n <nav\n {...props}\n aria-label={ariaLabel ?? \"Progress\"}\n className={cx(stepper({ orientation }).root, className)}\n data-jaci-component=\"stepper\"\n data-orientation={orientation}\n data-slot=\"stepper\"\n data-state={disabled ? \"disabled\" : \"active\"}\n ref={ref}\n >\n {children}\n {name ? (\n <input\n aria-hidden=\"true\"\n name={name}\n type=\"hidden\"\n value={activeValue ?? \"\"}\n form={form}\n />\n ) : null}\n </nav>\n </StepperContext.Provider>\n );\n});\n\nexport type StepperListProps = ComponentPropsWithoutRef<\"ol\">;\nexport const StepperList = forwardRef<HTMLOListElement, StepperListProps>(function StepperList(\n { className, ...props },\n ref,\n) {\n const { orientation } = useStepperContext();\n return (\n <ol\n {...props}\n className={cx(stepper({ orientation }).list, className)}\n data-slot=\"stepper-list\"\n ref={ref}\n />\n );\n});\n\nexport interface StepperItemProps extends ComponentPropsWithoutRef<\"li\"> {\n value: string;\n status?: StepperStatus;\n disabled?: boolean;\n}\n\nexport const StepperItem = forwardRef<HTMLLIElement, StepperItemProps>(function StepperItem(\n { children, className, disabled = false, status, value, ...props },\n ref,\n) {\n const context = useStepperContext();\n const resolvedStatus = context.getStatus(value, status, disabled);\n useEffect(() => {\n const record: StepRecord = { disabled: disabled || status === \"disabled\", value };\n if (status !== undefined) record.status = status;\n context.register(record);\n return () => context.unregister(value);\n }, [context.register, context.unregister, disabled, status, value]);\n const itemContext = useMemo<StepperItemContextValue>(\n () => ({\n disabled: disabled || context.disabled || resolvedStatus === \"disabled\",\n status: resolvedStatus,\n value,\n }),\n [context.disabled, disabled, resolvedStatus, value],\n );\n const styles = stepper({ orientation: context.orientation, status: resolvedStatus });\n\n return (\n <StepperItemContext.Provider value={itemContext}>\n <li\n {...props}\n aria-disabled={itemContext.disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={itemContext.disabled || undefined}\n data-jaci-component=\"stepper-item\"\n data-slot=\"stepper-item\"\n data-status={resolvedStatus}\n data-value={value}\n ref={ref}\n >\n {children}\n </li>\n </StepperItemContext.Provider>\n );\n});\n\nexport type StepperTriggerProps = ComponentPropsWithoutRef<\"button\">;\nexport const StepperTrigger = forwardRef<HTMLButtonElement, StepperTriggerProps>(\n function StepperTrigger({ className, onClick, onKeyDown, type = \"button\", ...props }, ref) {\n const context = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation: context.orientation, status: item.status });\n return (\n <button\n {...props}\n aria-current={item.status === \"current\" ? \"step\" : undefined}\n aria-disabled={\n item.disabled || (!context.allowStepSelect && item.status !== \"current\") || undefined\n }\n className={cx(styles.trigger, className)}\n data-disabled={item.disabled || undefined}\n data-slot=\"stepper-trigger\"\n data-status={item.status}\n disabled={context.disabled || item.disabled}\n onClick={(event) => {\n if (!event.defaultPrevented) context.goTo(item.value);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n const isForwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowRight\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowDown\");\n const isBackwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowLeft\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowUp\");\n if (isForwardKey) {\n event.preventDefault();\n context.move(1);\n } else if (isBackwardKey) {\n event.preventDefault();\n context.move(-1);\n } else if (event.key === \"Home\") {\n event.preventDefault();\n context.moveToBoundary(-1);\n } else if (event.key === \"End\") {\n event.preventDefault();\n context.moveToBoundary(1);\n }\n onKeyDown?.(event);\n }}\n ref={ref}\n type={type}\n />\n );\n },\n);\n\nexport type StepperIndicatorProps = ComponentPropsWithoutRef<\"span\">;\nexport const StepperIndicator = forwardRef<HTMLSpanElement, StepperIndicatorProps>(\n function StepperIndicator({ children, className, ...props }, ref) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n aria-hidden={props[\"aria-hidden\"] ?? true}\n className={cx(styles.indicator, className)}\n data-slot=\"stepper-indicator\"\n data-status={item.status}\n ref={ref}\n >\n {children ?? (item.status === \"complete\" ? \"✓\" : \"\")}\n </span>\n );\n },\n);\n\nfunction createSpanSlot(slot: \"title\" | \"description\" | \"separator\") {\n return forwardRef<HTMLSpanElement, ComponentPropsWithoutRef<\"span\">>(function StepperSlot(\n { className, ...props },\n ref,\n ) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n className={cx(styles[slot], className)}\n data-slot={`stepper-${slot}`}\n ref={ref}\n />\n );\n });\n}\n\nexport const StepperTitle = createSpanSlot(\"title\");\nexport const StepperDescription = createSpanSlot(\"description\");\n\nexport const StepperContent = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function StepperContent({ className, hidden, ...props }, ref) {\n const item = useStepperItemContext();\n const { orientation } = useStepperContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <div\n {...props}\n className={cx(styles.content, className)}\n data-slot=\"stepper-content\"\n hidden={hidden ?? item.status !== \"current\"}\n ref={ref}\n />\n );\n },\n);\n\nexport const StepperSeparator = createSpanSlot(\"separator\");\n\nexport interface StepperNavigationButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\n\nexport const StepperPrevious = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperPrevious(\n { children = \"Previous\", className, disabled: disabledProp, ...props },\n ref,\n ) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.previous, className)}\n data-slot=\"stepper-previous\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(-1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const StepperNext = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperNext({ children = \"Next\", className, disabled: disabledProp, ...props }, ref) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.next, className)}\n data-slot=\"stepper-next\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const Stepper = {\n Root: StepperRoot,\n List: StepperList,\n Item: StepperItem,\n Trigger: StepperTrigger,\n Indicator: StepperIndicator,\n Title: StepperTitle,\n Description: StepperDescription,\n Content: StepperContent,\n Separator: StepperSeparator,\n Previous: StepperPrevious,\n Next: StepperNext,\n};\n"],"mappings":";;;;;;AA6CA,MAAM,iBAAiB,cAA0C,IAAI;AACrE,MAAM,qBAAqB,cAA8C,IAAI;AAE7E,SAAS,oBAAoB;CAC3B,MAAM,UAAU,WAAW,cAAc;CACzC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,qDAAqD;CACnF,OAAO;AACT;AAEA,SAAS,wBAAwB;CAC/B,MAAM,UAAU,WAAW,kBAAkB;CAC7C,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,yDAAyD;CACvF,OAAO;AACT;AAeA,MAAa,cAAc,WAA0C,SAAS,YAC5E,EACE,kBAAkB,MAClB,cAAc,WACd,UACA,WACA,cACA,WAAW,OACX,MACA,SAAS,OACT,MACA,eACA,cAAc,cACd,OAAO,iBACP,GAAG,SAEL,KACA;CACA,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,YAAY;CACvE,MAAM,CAAC,SAAS,cAAc,SAAuB,CAAC,CAAC;CACvD,MAAM,cAAc,mBAAmB,qBAAqB,QAAQ,EAAE,EAAE;CAExE,MAAM,WAAW,aAAa,WAAuB;EACnD,YAAY,YAAY;GACtB,MAAM,QAAQ,QAAQ,WAAW,SAAS,KAAK,UAAU,OAAO,KAAK;GACrE,IAAI,UAAU,IAAI,OAAO,CAAC,GAAG,SAAS,MAAM;GAC5C,MAAM,gBAAgB,QAAQ;GAC9B,IAAI,CAAC,eAAe,OAAO;GAC3B,IAAI,cAAc,aAAa,OAAO,YAAY,cAAc,WAAW,OAAO,QAChF,OAAO;GAET,MAAM,OAAO,QAAQ,MAAM;GAC3B,KAAK,SAAS;GACd,OAAO;EACT,CAAC;CACH,GAAG,CAAC,CAAC;CAEL,MAAM,aAAa,aAAa,kBAA0B;EACxD,YAAY,YAAY,QAAQ,QAAQ,SAAS,KAA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AAU,UAAU;GAClB,QAAQ,KAAK,CAAC;GACd,MAAM,UAAU,KAAK;EACvB;EACK;EACL,MAAM,MAAM,QAAQ;EAEnB;CACK,CAAA;AAEZ,CACF;AAEA,MAAa,UAAU;CACrB,MAAM;CACN,MAAM;CACN,MAAM;CACN,SAAS;CACT,WAAW;CACX,OAAO;CACP,aAAa;CACb,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;AACR"}
|
|
1
|
+
{"version":3,"file":"stepper.js","names":[],"sources":["../../../src/components/stepper/stepper.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { stepper } from \"../../styled-system/recipes\";\n\nexport type StepperOrientation = \"horizontal\" | \"vertical\";\nexport type StepperStatus = \"current\" | \"complete\" | \"upcoming\" | \"disabled\";\n\ninterface StepRecord {\n value: string;\n disabled: boolean;\n status?: StepperStatus;\n}\n\ninterface StepperContextValue {\n activeValue: string | undefined;\n allowStepSelect: boolean;\n disabled: boolean;\n getStatus: (value: string, status?: StepperStatus, disabled?: boolean) => StepperStatus;\n goTo: (value: string, options?: { fromNavigation?: boolean }) => void;\n linear: boolean;\n orientation: StepperOrientation;\n register: (record: StepRecord) => void;\n unregister: (value: string) => void;\n move: (direction: -1 | 1) => void;\n moveToBoundary: (direction: -1 | 1) => void;\n}\n\ninterface StepperItemContextValue {\n disabled: boolean;\n status: StepperStatus;\n value: string;\n}\n\nconst StepperContext = createContext<StepperContextValue | null>(null);\nconst StepperItemContext = createContext<StepperItemContextValue | null>(null);\n\nfunction useStepperContext() {\n const context = useContext(StepperContext);\n if (!context) throw new Error(\"Stepper parts must be rendered inside Stepper.Root.\");\n return context;\n}\n\nfunction useStepperItemContext() {\n const context = useContext(StepperItemContext);\n if (!context) throw new Error(\"This Stepper part must be rendered inside Stepper.Item.\");\n return context;\n}\n\nexport interface StepperRootProps extends Omit<ComponentPropsWithoutRef<\"nav\">, \"children\"> {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n orientation?: StepperOrientation;\n linear?: boolean;\n allowStepSelect?: boolean;\n disabled?: boolean;\n name?: string;\n form?: string;\n children?: ReactNode;\n}\n\nexport const StepperRoot = forwardRef<HTMLElement, StepperRootProps>(function StepperRoot(\n {\n allowStepSelect = true,\n \"aria-label\": ariaLabel,\n children,\n className,\n defaultValue,\n disabled = false,\n form,\n linear = false,\n name,\n onValueChange,\n orientation = \"horizontal\",\n value: controlledValue,\n ...props\n },\n ref,\n) {\n const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);\n const [records, setRecords] = useState<StepRecord[]>([]);\n const activeValue = controlledValue ?? uncontrolledValue ?? records[0]?.value;\n\n const register = useCallback((record: StepRecord) => {\n setRecords((current) => {\n const index = current.findIndex((item) => item.value === record.value);\n if (index === -1) return [...current, record];\n const currentRecord = current[index];\n if (!currentRecord) return current;\n if (currentRecord.disabled === record.disabled && currentRecord.status === record.status) {\n return current;\n }\n const next = current.slice();\n next[index] = record;\n return next;\n });\n }, []);\n\n const unregister = useCallback((valueToRemove: string) => {\n setRecords((current) => current.filter((item) => item.value !== valueToRemove));\n }, []);\n\n const goTo = useCallback(\n (nextValue: string, options?: { fromNavigation?: boolean }) => {\n if (disabled) return;\n const targetIndex = records.findIndex((item) => item.value === nextValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n const target = records[targetIndex];\n if (!target || target.disabled) return;\n if (nextValue === activeValue) return;\n if (!allowStepSelect && !options?.fromNavigation && nextValue !== activeValue) return;\n if (linear && activeIndex >= 0 && targetIndex > activeIndex + 1) return;\n if (controlledValue === undefined) setUncontrolledValue(nextValue);\n onValueChange?.(nextValue);\n },\n [activeValue, allowStepSelect, controlledValue, disabled, linear, onValueChange, records],\n );\n\n const move = useCallback(\n (direction: -1 | 1) => {\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n let index = activeIndex + direction;\n while (index >= 0 && index < records.length && records[index]?.disabled) index += direction;\n const target = records[index];\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [activeValue, goTo, records],\n );\n\n const moveToBoundary = useCallback(\n (direction: -1 | 1) => {\n const candidates = direction === -1 ? records : records.slice().reverse();\n const target = candidates.find((record) => !record.disabled);\n if (target) goTo(target.value, { fromNavigation: true });\n },\n [goTo, records],\n );\n\n const getStatus = useCallback(\n (itemValue: string, explicitStatus?: StepperStatus, itemDisabled = false) => {\n if (itemDisabled || disabled) return \"disabled\";\n if (explicitStatus) return explicitStatus;\n const itemIndex = records.findIndex((item) => item.value === itemValue);\n const activeIndex = records.findIndex((item) => item.value === activeValue);\n if (itemValue === activeValue || (activeIndex < 0 && itemIndex === 0)) return \"current\";\n if (itemIndex >= 0 && activeIndex >= 0 && itemIndex < activeIndex) return \"complete\";\n return \"upcoming\";\n },\n [activeValue, disabled, records],\n );\n\n const context = useMemo(\n () => ({\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n }),\n [\n activeValue,\n allowStepSelect,\n disabled,\n getStatus,\n goTo,\n linear,\n move,\n moveToBoundary,\n orientation,\n register,\n unregister,\n ],\n );\n\n return (\n <StepperContext.Provider value={context}>\n <nav\n {...props}\n aria-label={ariaLabel ?? \"Progress\"}\n className={cx(stepper({ orientation }).root, className)}\n data-jaci-component=\"stepper\"\n data-orientation={orientation}\n data-slot=\"stepper\"\n data-state={disabled ? \"disabled\" : \"active\"}\n ref={ref}\n >\n {children}\n {name ? (\n <input\n aria-hidden=\"true\"\n name={name}\n type=\"hidden\"\n value={activeValue ?? \"\"}\n form={form}\n />\n ) : null}\n </nav>\n </StepperContext.Provider>\n );\n});\n\nexport type StepperListProps = ComponentPropsWithoutRef<\"ol\">;\nexport const StepperList = forwardRef<HTMLOListElement, StepperListProps>(function StepperList(\n { className, ...props },\n ref,\n) {\n const { orientation } = useStepperContext();\n return (\n <ol\n {...props}\n className={cx(stepper({ orientation }).list, className)}\n data-slot=\"stepper-list\"\n ref={ref}\n />\n );\n});\n\nexport interface StepperItemProps extends ComponentPropsWithoutRef<\"li\"> {\n value: string;\n status?: StepperStatus;\n disabled?: boolean;\n}\n\nexport const StepperItem = forwardRef<HTMLLIElement, StepperItemProps>(function StepperItem(\n { children, className, disabled = false, status, value, ...props },\n ref,\n) {\n const context = useStepperContext();\n const resolvedStatus = context.getStatus(value, status, disabled);\n useEffect(() => {\n const record: StepRecord = { disabled: disabled || status === \"disabled\", value };\n if (status !== undefined) record.status = status;\n context.register(record);\n return () => context.unregister(value);\n }, [context.register, context.unregister, disabled, status, value]);\n const itemContext = useMemo<StepperItemContextValue>(\n () => ({\n disabled: disabled || context.disabled || resolvedStatus === \"disabled\",\n status: resolvedStatus,\n value,\n }),\n [context.disabled, disabled, resolvedStatus, value],\n );\n const styles = stepper({ orientation: context.orientation, status: resolvedStatus });\n\n return (\n <StepperItemContext.Provider value={itemContext}>\n <li\n {...props}\n aria-disabled={itemContext.disabled || undefined}\n className={cx(styles.item, className)}\n data-disabled={itemContext.disabled || undefined}\n data-jaci-component=\"stepper-item\"\n data-slot=\"stepper-item\"\n data-status={resolvedStatus}\n data-value={value}\n ref={ref}\n >\n {children}\n </li>\n </StepperItemContext.Provider>\n );\n});\n\nexport type StepperTriggerProps = ComponentPropsWithoutRef<\"button\">;\nexport const StepperTrigger = forwardRef<HTMLButtonElement, StepperTriggerProps>(\n function StepperTrigger({ className, onClick, onKeyDown, type = \"button\", ...props }, ref) {\n const context = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation: context.orientation, status: item.status });\n return (\n <button\n {...props}\n aria-current={item.status === \"current\" ? \"step\" : undefined}\n aria-disabled={\n item.disabled || (!context.allowStepSelect && item.status !== \"current\") || undefined\n }\n className={cx(styles.trigger, className)}\n data-disabled={item.disabled || undefined}\n data-slot=\"stepper-trigger\"\n data-status={item.status}\n disabled={context.disabled || item.disabled}\n onClick={(event) => {\n if (!event.defaultPrevented) context.goTo(item.value);\n onClick?.(event);\n }}\n onKeyDown={(event) => {\n const isForwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowRight\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowDown\");\n const isBackwardKey =\n (context.orientation === \"horizontal\" && event.key === \"ArrowLeft\") ||\n (context.orientation === \"vertical\" && event.key === \"ArrowUp\");\n if (isForwardKey) {\n event.preventDefault();\n context.move(1);\n } else if (isBackwardKey) {\n event.preventDefault();\n context.move(-1);\n } else if (event.key === \"Home\") {\n event.preventDefault();\n context.moveToBoundary(-1);\n } else if (event.key === \"End\") {\n event.preventDefault();\n context.moveToBoundary(1);\n }\n onKeyDown?.(event);\n }}\n ref={ref}\n type={type}\n />\n );\n },\n);\n\nexport type StepperIndicatorProps = ComponentPropsWithoutRef<\"span\">;\nexport const StepperIndicator = forwardRef<HTMLSpanElement, StepperIndicatorProps>(\n function StepperIndicator({ children, className, ...props }, ref) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n aria-hidden={props[\"aria-hidden\"] ?? true}\n className={cx(styles.indicator, className)}\n data-slot=\"stepper-indicator\"\n data-status={item.status}\n ref={ref}\n >\n {children ?? (item.status === \"complete\" ? \"✓\" : \"\")}\n </span>\n );\n },\n);\n\nfunction createSpanSlot(slot: \"title\" | \"description\" | \"separator\") {\n return forwardRef<HTMLSpanElement, ComponentPropsWithoutRef<\"span\">>(function StepperSlot(\n { className, ...props },\n ref,\n ) {\n const { orientation } = useStepperContext();\n const item = useStepperItemContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <span\n {...props}\n className={cx(styles[slot], className)}\n data-slot={`stepper-${slot}`}\n ref={ref}\n />\n );\n });\n}\n\nexport const StepperTitle = createSpanSlot(\"title\");\nexport const StepperDescription = createSpanSlot(\"description\");\n\nexport const StepperContent = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function StepperContent({ className, hidden, ...props }, ref) {\n const item = useStepperItemContext();\n const { orientation } = useStepperContext();\n const styles = stepper({ orientation, status: item.status });\n return (\n <div\n {...props}\n className={cx(styles.content, className)}\n data-slot=\"stepper-content\"\n hidden={hidden ?? item.status !== \"current\"}\n ref={ref}\n />\n );\n },\n);\n\nexport const StepperSeparator = createSpanSlot(\"separator\");\n\nexport interface StepperNavigationButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n children?: ReactNode;\n}\n\nexport const StepperPrevious = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperPrevious(\n { children = \"Previous\", className, disabled: disabledProp, ...props },\n ref,\n ) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.previous, className)}\n data-slot=\"stepper-previous\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(-1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const StepperNext = forwardRef<HTMLButtonElement, StepperNavigationButtonProps>(\n function StepperNext({ children = \"Next\", className, disabled: disabledProp, ...props }, ref) {\n const context = useStepperContext();\n const styles = stepper({ orientation: context.orientation });\n return (\n <button\n {...props}\n className={cx(styles.next, className)}\n data-slot=\"stepper-next\"\n disabled={disabledProp || context.disabled}\n onClick={(event) => {\n context.move(1);\n props.onClick?.(event);\n }}\n ref={ref}\n type={props.type ?? \"button\"}\n >\n {children}\n </button>\n );\n },\n);\n\nexport const Stepper = {\n Root: StepperRoot,\n List: StepperList,\n Item: StepperItem,\n Trigger: StepperTrigger,\n Indicator: StepperIndicator,\n Title: StepperTitle,\n Description: StepperDescription,\n Content: StepperContent,\n Separator: StepperSeparator,\n Previous: StepperPrevious,\n Next: StepperNext,\n};\n"],"mappings":";;;;;;AA6CA,MAAM,iBAAiB,cAA0C,IAAI;AACrE,MAAM,qBAAqB,cAA8C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M;CACN,SAAS;CACT,WAAW;CACX,OAAO;CACP,aAAa;CACb,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.cjs","names":["cx","table"],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { table } from \"../../styled-system/recipes\";\n\nexport type TableSortDirection = \"none\" | \"ascending\" | \"descending\";\nexport type TableDensity = \"compact\" | \"comfortable\";\nexport type TableSelectionMode = \"none\" | \"single\" | \"multiple\";\nexport type TableStatus = \"idle\" | \"loading\" | \"empty\" | \"error\" | \"ready\";\nexport type TableAlignment = \"start\" | \"center\" | \"end\";\nexport type TableHideBelow = \"sm\" | \"md\" | \"lg\";\n\nexport interface TableSortState {\n id: string;\n direction: Exclude<TableSortDirection, \"none\">;\n}\n\ninterface TableRowRecord {\n disabled: boolean;\n}\n\ninterface TableContextValue {\n allSelected: boolean;\n indeterminate: boolean;\n isRowSelected: (id: string) => boolean;\n registerRow: (id: string, row: TableRowRecord) => () => void;\n requestSort: (id: string, direction?: TableSortDirection) => void;\n selectedRowIds: ReadonlySet<string>;\n selectionMode: TableSelectionMode;\n toggleAll: (checked: boolean) => void;\n toggleRow: (id: string, checked: boolean) => void;\n sort: TableSortState | null;\n status: TableStatus;\n}\n\ninterface TableRowContextValue {\n id: string;\n selectionDisabled: boolean;\n}\n\ntype TableSection = \"head\" | \"body\" | \"foot\";\n\nconst TableContext = createContext<TableContextValue | null>(null);\nconst TableRowContext = createContext<TableRowContextValue | null>(null);\nconst TableSectionContext = createContext<TableSection>(\"body\");\n\nfunction useTableContext() {\n return useContext(TableContext);\n}\n\nfunction useRequiredTableContext() {\n const context = useTableContext();\n if (!context) throw new Error(\"Table parts must be rendered inside Table.Root.\");\n return context;\n}\n\nfunction useTableRowContext() {\n return useContext(TableRowContext);\n}\n\nfunction cycleSortDirection(direction: TableSortDirection): TableSortDirection {\n if (direction === \"none\") return \"ascending\";\n if (direction === \"ascending\") return \"descending\";\n return \"none\";\n}\n\nexport interface TableContainerProps extends ComponentPropsWithoutRef<\"div\"> {}\n\nexport const TableContainer = forwardRef<HTMLDivElement, TableContainerProps>(\n function TableContainer({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(table().container, className)}\n data-jaci-component=\"table\"\n data-slot=\"table-container\"\n />\n );\n },\n);\n\nexport interface TableRootProps extends ComponentPropsWithoutRef<\"table\"> {\n bordered?: boolean;\n density?: TableDensity;\n defaultSelectedRowIds?: readonly string[];\n defaultSort?: TableSortState | null;\n onSelectionChange?: (rowIds: string[]) => void;\n onSortChange?: (sort: TableSortState | null) => void;\n selectedRowIds?: readonly string[];\n selectionMode?: TableSelectionMode;\n sort?: TableSortState | null;\n status?: TableStatus;\n stickyHeader?: boolean;\n striped?: boolean;\n}\n\nexport const TableRoot = forwardRef<HTMLTableElement, TableRootProps>(function TableRoot(\n {\n bordered = false,\n className,\n defaultSelectedRowIds = [],\n defaultSort = null,\n density = \"comfortable\",\n onSelectionChange,\n onSortChange,\n selectedRowIds: controlledSelectedRowIds,\n selectionMode = \"none\",\n sort: controlledSort,\n status = \"idle\",\n stickyHeader = false,\n striped = false,\n ...props\n },\n ref,\n) {\n const [uncontrolledSelectedRowIds, setUncontrolledSelectedRowIds] = useState(\n () => new Set(defaultSelectedRowIds),\n );\n const [uncontrolledSort, setUncontrolledSort] = useState<TableSortState | null>(defaultSort);\n const [rows, setRows] = useState<Map<string, TableRowRecord>>(() => new Map());\n const selectedRowIds = useMemo(\n () => new Set(controlledSelectedRowIds ?? uncontrolledSelectedRowIds),\n [controlledSelectedRowIds, uncontrolledSelectedRowIds],\n );\n const sort = controlledSort === undefined ? uncontrolledSort : controlledSort;\n const selectableRows = useMemo(\n () => [...rows.entries()].filter(([, row]) => !row.disabled).map(([id]) => id),\n [rows],\n );\n const selectedSelectableRows = selectableRows.filter((id) => selectedRowIds.has(id));\n const allSelected =\n selectableRows.length > 0 && selectedSelectableRows.length === selectableRows.length;\n const indeterminate = selectedSelectableRows.length > 0 && !allSelected;\n const styles = table({ bordered, density, stickyHeader, striped });\n\n const updateSelection = useCallback(\n (next: Set<string>) => {\n const normalized = selectionMode === \"single\" ? new Set([...next].slice(-1)) : next;\n if (controlledSelectedRowIds === undefined) setUncontrolledSelectedRowIds(normalized);\n onSelectionChange?.([...normalized]);\n },\n [controlledSelectedRowIds, onSelectionChange, selectionMode],\n );\n const toggleRow = useCallback(\n (id: string, checked: boolean) => {\n const row = rows.get(id);\n if (selectionMode === \"none\" || row?.disabled) return;\n const next = new Set(selectedRowIds);\n if (selectionMode === \"single\") next.clear();\n if (checked) next.add(id);\n else next.delete(id);\n updateSelection(next);\n },\n [rows, selectedRowIds, selectionMode, updateSelection],\n );\n const toggleAll = useCallback(\n (checked: boolean) => {\n if (selectionMode !== \"multiple\") return;\n updateSelection(new Set(checked ? selectableRows : []));\n },\n [selectableRows, selectionMode, updateSelection],\n );\n const registerRow = useCallback((id: string, row: TableRowRecord) => {\n setRows((current) => {\n const next = new Map(current);\n next.set(id, row);\n return next;\n });\n return () =>\n setRows((current) => {\n if (!current.has(id)) return current;\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n }, []);\n const requestSort = useCallback(\n (id: string, requestedDirection?: TableSortDirection) => {\n const currentDirection = sort?.id === id ? sort.direction : \"none\";\n const direction = requestedDirection ?? cycleSortDirection(currentDirection);\n const nextSort = direction === \"none\" ? null : { id, direction };\n if (controlledSort === undefined) setUncontrolledSort(nextSort);\n onSortChange?.(nextSort);\n },\n [controlledSort, onSortChange, sort],\n );\n\n const context = useMemo<TableContextValue>(\n () => ({\n allSelected,\n indeterminate,\n isRowSelected: (id) => selectedRowIds.has(id),\n registerRow,\n requestSort,\n selectedRowIds,\n selectionMode,\n status,\n toggleAll,\n toggleRow,\n sort,\n }),\n [\n allSelected,\n indeterminate,\n registerRow,\n requestSort,\n selectedRowIds,\n selectionMode,\n sort,\n status,\n toggleAll,\n toggleRow,\n ],\n );\n\n return (\n <TableContext.Provider value={context}>\n <table\n {...props}\n ref={ref}\n aria-busy={props[\"aria-busy\"] ?? (status === \"loading\" || undefined)}\n className={cx(styles.root, className)}\n data-jaci-component=\"table\"\n data-status={status}\n data-slot=\"table\"\n />\n </TableContext.Provider>\n );\n});\n\nexport type TableCaptionProps = ComponentPropsWithoutRef<\"caption\">;\nexport const TableCaption = forwardRef<HTMLTableCaptionElement, TableCaptionProps>(\n function TableCaption({ className, ...props }, ref) {\n return (\n <caption\n {...props}\n ref={ref}\n className={cx(table().caption, className)}\n data-slot=\"table-caption\"\n />\n );\n },\n);\n\nexport type TableDescriptionProps = ComponentPropsWithoutRef<\"p\">;\nexport const TableDescription = forwardRef<HTMLParagraphElement, TableDescriptionProps>(\n function TableDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(table().description, className)}\n data-slot=\"table-description\"\n />\n );\n },\n);\n\nexport type TableHeaderProps = ComponentPropsWithoutRef<\"thead\">;\nexport const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n function TableHeader({ className, ...props }, ref) {\n return (\n <TableSectionContext.Provider value=\"head\">\n <thead\n {...props}\n ref={ref}\n className={cx(table().header, className)}\n data-slot=\"table-header\"\n />\n </TableSectionContext.Provider>\n );\n },\n);\n\nexport type TableBodyProps = ComponentPropsWithoutRef<\"tbody\">;\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(function TableBody(\n { className, ...props },\n ref,\n) {\n return (\n <TableSectionContext.Provider value=\"body\">\n <tbody {...props} ref={ref} className={cx(table().body, className)} data-slot=\"table-body\" />\n </TableSectionContext.Provider>\n );\n});\n\nexport type TableFooterProps = ComponentPropsWithoutRef<\"tfoot\">;\nexport const TableFooter = forwardRef<HTMLTableSectionElement, TableFooterProps>(\n function TableFooter({ className, ...props }, ref) {\n return (\n <TableSectionContext.Provider value=\"foot\">\n <tfoot\n {...props}\n ref={ref}\n className={cx(table().footer, className)}\n data-slot=\"table-footer\"\n />\n </TableSectionContext.Provider>\n );\n },\n);\n\nexport interface TableRowProps extends Omit<ComponentPropsWithoutRef<\"tr\">, \"id\"> {\n id: string;\n selectionDisabled?: boolean;\n selected?: boolean;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(\n { className, id, selectionDisabled = false, selected: selectedOverride, ...props },\n ref,\n) {\n const context = useTableContext();\n const section = useContext(TableSectionContext);\n const selected = selectedOverride ?? context?.isRowSelected(id) ?? false;\n useEffect(\n () =>\n section === \"head\" ? undefined : context?.registerRow(id, { disabled: selectionDisabled }),\n [context?.registerRow, id, section, selectionDisabled],\n );\n\n return (\n <TableRowContext.Provider value={{ id, selectionDisabled }}>\n <tr\n {...props}\n id={id}\n ref={ref}\n aria-selected={selected || undefined}\n className={cx(table().row, className)}\n data-selected={selected || undefined}\n data-selection-disabled={selectionDisabled || undefined}\n data-slot=\"table-row\"\n />\n </TableRowContext.Provider>\n );\n});\n\nexport interface TableHeadProps extends Omit<ComponentPropsWithoutRef<\"th\">, \"align\"> {\n align?: TableAlignment;\n hideBelow?: TableHideBelow;\n onSort?: (direction: TableSortDirection) => void;\n sortDirection?: TableSortDirection;\n sortable?: boolean;\n}\n\nexport const TableHead = forwardRef<HTMLTableCellElement, TableHeadProps>(function TableHead(\n {\n align = \"start\",\n children,\n className,\n hideBelow,\n onSort,\n sortDirection,\n sortable = false,\n ...props\n },\n ref,\n) {\n const context = useTableContext();\n const styles = table({ align, hideBelow });\n const resolvedDirection =\n sortDirection ??\n (sortable && props.id && context?.sort?.id === props.id ? context.sort.direction : \"none\");\n const sort = () => {\n const next = cycleSortDirection(resolvedDirection);\n if (props.id) context?.requestSort(props.id, next);\n onSort?.(next);\n };\n\n return (\n <th\n {...props}\n ref={ref}\n aria-sort={sortable ? resolvedDirection : undefined}\n className={cx(styles.head, className)}\n data-align={align}\n data-hide-below={hideBelow}\n data-sort-direction={sortable ? resolvedDirection : undefined}\n data-slot=\"table-head\"\n scope={props.scope ?? \"col\"}\n >\n {sortable ? (\n <button\n aria-label={\n props[\"aria-label\"] ?? `Sort by ${typeof children === \"string\" ? children : \"column\"}`\n }\n className={styles.sortButton}\n onClick={sort}\n type=\"button\"\n >\n <span>{children}</span>\n <span aria-hidden=\"true\">\n {resolvedDirection === \"ascending\"\n ? \"↑\"\n : resolvedDirection === \"descending\"\n ? \"↓\"\n : \"↕\"}\n </span>\n </button>\n ) : (\n children\n )}\n </th>\n );\n});\n\nexport interface TableCellProps extends Omit<ComponentPropsWithoutRef<\"td\">, \"align\"> {\n align?: TableAlignment;\n hideBelow?: TableHideBelow;\n}\n\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(function TableCell(\n { align = \"start\", className, hideBelow, ...props },\n ref,\n) {\n const styles = table({ align, hideBelow });\n return (\n <td\n {...props}\n ref={ref}\n className={cx(styles.cell, className)}\n data-align={align}\n data-hide-below={hideBelow}\n data-slot=\"table-cell\"\n />\n );\n});\n\ninterface TableSelectionInputProps {\n \"aria-label\"?: string | undefined;\n checked?: boolean | undefined;\n indeterminate?: boolean | undefined;\n inputProps?: Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"checked\" | \"defaultChecked\" | \"onChange\" | \"type\"\n >;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nfunction SelectionInput({\n \"aria-label\": ariaLabel,\n checked = false,\n indeterminate = false,\n inputProps,\n onCheckedChange,\n}: TableSelectionInputProps) {\n const ref = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (ref.current) ref.current.indeterminate = indeterminate;\n }, [indeterminate]);\n\n return (\n <input\n {...inputProps}\n ref={ref}\n aria-label={ariaLabel ?? inputProps?.[\"aria-label\"]}\n aria-checked={indeterminate ? \"mixed\" : checked}\n checked={checked}\n onChange={(event) => onCheckedChange?.(event.currentTarget.checked)}\n type=\"checkbox\"\n />\n );\n}\n\nexport interface TableSelectionHeaderProps\n extends Omit<ComponentPropsWithoutRef<\"th\">, \"children\">,\n TableSelectionInputProps {}\n\nexport const TableSelectionHeader = forwardRef<HTMLTableCellElement, TableSelectionHeaderProps>(\n function TableSelectionHeader(\n {\n checked: checkedOverride,\n className,\n indeterminate: indeterminateOverride,\n inputProps,\n onCheckedChange,\n ...props\n },\n ref,\n ) {\n const context = useRequiredTableContext();\n const ariaLabel = props[\"aria-label\"] ?? inputProps?.[\"aria-label\"] ?? \"Select all rows\";\n const checked = checkedOverride ?? context.allSelected;\n const indeterminate = indeterminateOverride ?? context.indeterminate;\n const disabled = Boolean(\n inputProps?.disabled ||\n (context.selectionMode !== \"multiple\" && !onCheckedChange && checkedOverride === undefined),\n );\n return (\n <th\n {...props}\n ref={ref}\n aria-label={ariaLabel}\n className={cx(table().selection, className)}\n data-slot=\"table-selection-header\"\n scope=\"col\"\n >\n <SelectionInput\n aria-label={ariaLabel}\n checked={checked}\n indeterminate={indeterminate}\n inputProps={{ ...inputProps, disabled }}\n onCheckedChange={onCheckedChange ?? context.toggleAll}\n />\n </th>\n );\n },\n);\n\nexport interface TableSelectionCellProps\n extends Omit<ComponentPropsWithoutRef<\"td\">, \"children\">,\n TableSelectionInputProps {}\n\nexport const TableSelectionCell = forwardRef<HTMLTableCellElement, TableSelectionCellProps>(\n function TableSelectionCell(\n {\n checked: checkedOverride,\n className,\n indeterminate = false,\n inputProps,\n onCheckedChange,\n ...props\n },\n ref,\n ) {\n const context = useRequiredTableContext();\n const row = useTableRowContext();\n const id = row?.id ?? \"\";\n const ariaLabel = props[\"aria-label\"] ?? inputProps?.[\"aria-label\"] ?? \"Select row\";\n const checked = checkedOverride ?? context.isRowSelected(id);\n const disabled = Boolean(\n inputProps?.disabled ||\n row?.selectionDisabled ||\n (context.selectionMode === \"none\" && !onCheckedChange && checkedOverride === undefined),\n );\n return (\n <td\n {...props}\n ref={ref}\n className={cx(table().selection, className)}\n data-slot=\"table-selection-cell\"\n >\n <SelectionInput\n aria-label={ariaLabel}\n checked={checked}\n indeterminate={indeterminate}\n inputProps={{ ...inputProps, disabled }}\n onCheckedChange={onCheckedChange ?? ((next) => context.toggleRow(id, next))}\n />\n </td>\n );\n },\n);\n\nexport interface TableStateProps extends Omit<ComponentPropsWithoutRef<\"tr\">, \"children\"> {\n children?: ReactNode;\n colSpan?: number;\n}\n\nconst TableStateRow = forwardRef<\n HTMLTableRowElement,\n TableStateProps & { live?: \"polite\" | \"assertive\" }\n>(function TableStateRow({ children, className, colSpan = 1, live = \"polite\", ...props }, ref) {\n const name = live === \"assertive\" ? \"error\" : \"loading\";\n return (\n <tr {...props} ref={ref} className={cx(table().row, className)} data-slot={`table-${name}-row`}>\n <td aria-live={live} className={table().empty} colSpan={colSpan} data-slot={`table-${name}`}>\n {children}\n </td>\n </tr>\n );\n});\n\nexport interface TableEmptyProps extends TableStateProps {}\nexport type TableLoadingProps = TableStateProps;\nexport type TableErrorProps = TableStateProps;\nexport const TableEmpty = forwardRef<HTMLTableRowElement, TableEmptyProps>(function TableEmpty(\n { children = \"No results found.\", className, colSpan = 1, ...props },\n ref,\n) {\n return (\n <tr {...props} ref={ref} className={cx(table().row, className)} data-slot=\"table-empty-row\">\n <td className={table().empty} colSpan={colSpan} data-slot=\"table-empty\">\n {children}\n </td>\n </tr>\n );\n});\n\nexport const TableLoading = forwardRef<HTMLTableRowElement, TableStateProps>(function TableLoading(\n { children = \"Loading…\", ...props },\n ref,\n) {\n return (\n <TableStateRow {...props} ref={ref} live=\"polite\">\n {children}\n </TableStateRow>\n );\n});\n\nexport const TableError = forwardRef<HTMLTableRowElement, TableStateProps>(function TableError(\n { children = \"Something went wrong.\", ...props },\n ref,\n) {\n return (\n <TableStateRow {...props} ref={ref} live=\"assertive\">\n {children}\n </TableStateRow>\n );\n});\n\nexport const Table = {\n Container: TableContainer,\n Root: TableRoot,\n Caption: TableCaption,\n Description: TableDescription,\n Header: TableHeader,\n Body: TableBody,\n Footer: TableFooter,\n Row: TableRow,\n Head: TableHead,\n Cell: TableCell,\n SelectionHeader: TableSelectionHeader,\n SelectionCell: TableSelectionCell,\n Empty: TableEmpty,\n Loading: TableLoading,\n Error: TableError,\n};\n"],"mappings":";;;;;;AAsDA,MAAM,gBAAA,GAAA,MAAA,cAAA,CAAuD,IAAI;AACjE,MAAM,mBAAA,GAAA,MAAA,cAAA,CAA6D,IAAI;AACvE,MAAM,uBAAA,GAAA,MAAA,cAAA,CAAkD,MAAM;AAE9D,SAAS,kBAAkB;CACzB,QAAA,GAAA,MAAA,WAAA,CAAkB,YAAY;AAChC;AAEA,SAAS,0BAA0B;CACjC,MAAM,UAAU,gBAAgB;CAChC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,iDAAiD;CAC/E,OAAO;AACT;AAEA,SAAS,qBAAqB;CAC5B,QAAA,GAAA,MAAA,WAAA,CAAkB,eAAe;AACnC;AAEA,SAAS,mBAAmB,WAAmD;CAC7E,IAAI,cAAc,QAAQ,OAAO;CACjC,IAAI,cAAc,aAAa,OAAO;CACtC,OAAO;AACT;AAIA,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAWA,WAAAA,GAAGC,cAAAA,MAAM,CAAC,CAAC,WAAW,SAAS;EAC1C,uBAAoB;EACpB,aAAU;CACX,CAAA;AAEL,CACF;AAiBA,MAAa,aAAA,GAAA,MAAA,WAAA,CAAyD,SAAS,UAC7E,EACE,WAAW,OACX,WACA,wBAAwB,CAAC,GACzB,cAAc,MACd,UAAU,eACV,mBACA,cACA,gBAAgB,0BAChB,gBAAgB,QAChB,MAAM,gBACN,SAAS,QACT,eAAe,OACf,UAAU,OACV,GAAG,SAEL,KACA;CACA,MAAM,CAAC,4BAA4B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A,MAAA,WAAA,CAA8D,SAAS,WAClF,EAAE,WAAW,qBAAqB,WAAW,UAAU,GAAG,GAAG,SAC7D,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;EAAI,GAAI;EAAY;EAAK,WAAWD,WAAAA,GAAGC,cAAAA,MAAM,CAAC,CAAC,KAAK,SAAS;EAAG,aAAU;YACxE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;GAAI,WAAWA,cAAAA,MAAM,CAAC,CAAC;GAAgB;GAAS,aAAU;GACvD;EACC,CAAA;CACF,CAAA;AAER,CAAC;AAED,MAAa,gBAAA,GAAA,MAAA,WAAA,CAAgE,SAAS,aACpF,EAAE,WAAW,YAAY,GAAG,SAC5B,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;EAAe,GAAI;EAAY;EAAK,MAAK;EACtC;CACY,CAAA;AAEnB,CAAC;AAED,MAAa,cAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,WAClF,EAAE,WAAW,yBAAyB,GAAG,SACzC,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;EAAe,GAAI;EAAY;EAAK,MAAK;EACtC;CACY,CAAA;AAEnB,CAAC;AAED,MAAa,QAAQ;CACnB,WAAW;CACX,MAAM;CACN,SAAS;CACT,aAAa;CACb,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,KAAK;CACL,MAAM;CACN,MAAM;CACN,iBAAiB;CACjB,eAAe;CACf,OAAO;CACP,SAAS;CACT,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"table.cjs","names":["createContext","useContext","forwardRef","cx","table","useState","useMemo","useCallback","useRef"],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { table } from \"../../styled-system/recipes\";\n\nexport type TableSortDirection = \"none\" | \"ascending\" | \"descending\";\nexport type TableDensity = \"compact\" | \"comfortable\";\nexport type TableSelectionMode = \"none\" | \"single\" | \"multiple\";\nexport type TableStatus = \"idle\" | \"loading\" | \"empty\" | \"error\" | \"ready\";\nexport type TableAlignment = \"start\" | \"center\" | \"end\";\nexport type TableHideBelow = \"sm\" | \"md\" | \"lg\";\n\nexport interface TableSortState {\n id: string;\n direction: Exclude<TableSortDirection, \"none\">;\n}\n\ninterface TableRowRecord {\n disabled: boolean;\n}\n\ninterface TableContextValue {\n allSelected: boolean;\n indeterminate: boolean;\n isRowSelected: (id: string) => boolean;\n registerRow: (id: string, row: TableRowRecord) => () => void;\n requestSort: (id: string, direction?: TableSortDirection) => void;\n selectedRowIds: ReadonlySet<string>;\n selectionMode: TableSelectionMode;\n toggleAll: (checked: boolean) => void;\n toggleRow: (id: string, checked: boolean) => void;\n sort: TableSortState | null;\n status: TableStatus;\n}\n\ninterface TableRowContextValue {\n id: string;\n selectionDisabled: boolean;\n}\n\ntype TableSection = \"head\" | \"body\" | \"foot\";\n\nconst TableContext = createContext<TableContextValue | null>(null);\nconst TableRowContext = createContext<TableRowContextValue | null>(null);\nconst TableSectionContext = createContext<TableSection>(\"body\");\n\nfunction useTableContext() {\n return useContext(TableContext);\n}\n\nfunction useRequiredTableContext() {\n const context = useTableContext();\n if (!context) throw new Error(\"Table parts must be rendered inside Table.Root.\");\n return context;\n}\n\nfunction useTableRowContext() {\n return useContext(TableRowContext);\n}\n\nfunction cycleSortDirection(direction: TableSortDirection): TableSortDirection {\n if (direction === \"none\") return \"ascending\";\n if (direction === \"ascending\") return \"descending\";\n return \"none\";\n}\n\nexport interface TableContainerProps extends ComponentPropsWithoutRef<\"div\"> {}\n\nexport const TableContainer = forwardRef<HTMLDivElement, TableContainerProps>(\n function TableContainer({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(table().container, className)}\n data-jaci-component=\"table\"\n data-slot=\"table-container\"\n />\n );\n },\n);\n\nexport interface TableRootProps extends ComponentPropsWithoutRef<\"table\"> {\n bordered?: boolean;\n density?: TableDensity;\n defaultSelectedRowIds?: readonly string[];\n defaultSort?: TableSortState | null;\n onSelectionChange?: (rowIds: string[]) => void;\n onSortChange?: (sort: TableSortState | null) => void;\n selectedRowIds?: readonly string[];\n selectionMode?: TableSelectionMode;\n sort?: TableSortState | null;\n status?: TableStatus;\n stickyHeader?: boolean;\n striped?: boolean;\n}\n\nexport const TableRoot = forwardRef<HTMLTableElement, TableRootProps>(function TableRoot(\n {\n bordered = false,\n className,\n defaultSelectedRowIds = [],\n defaultSort = null,\n density = \"comfortable\",\n onSelectionChange,\n onSortChange,\n selectedRowIds: controlledSelectedRowIds,\n selectionMode = \"none\",\n sort: controlledSort,\n status = \"idle\",\n stickyHeader = false,\n striped = false,\n ...props\n },\n ref,\n) {\n const [uncontrolledSelectedRowIds, setUncontrolledSelectedRowIds] = useState(\n () => new Set(defaultSelectedRowIds),\n );\n const [uncontrolledSort, setUncontrolledSort] = useState<TableSortState | null>(defaultSort);\n const [rows, setRows] = useState<Map<string, TableRowRecord>>(() => new Map());\n const selectedRowIds = useMemo(\n () => new Set(controlledSelectedRowIds ?? uncontrolledSelectedRowIds),\n [controlledSelectedRowIds, uncontrolledSelectedRowIds],\n );\n const sort = controlledSort === undefined ? uncontrolledSort : controlledSort;\n const selectableRows = useMemo(\n () => [...rows.entries()].filter(([, row]) => !row.disabled).map(([id]) => id),\n [rows],\n );\n const selectedSelectableRows = selectableRows.filter((id) => selectedRowIds.has(id));\n const allSelected =\n selectableRows.length > 0 && selectedSelectableRows.length === selectableRows.length;\n const indeterminate = selectedSelectableRows.length > 0 && !allSelected;\n const styles = table({ bordered, density, stickyHeader, striped });\n\n const updateSelection = useCallback(\n (next: Set<string>) => {\n const normalized = selectionMode === \"single\" ? new Set([...next].slice(-1)) : next;\n if (controlledSelectedRowIds === undefined) setUncontrolledSelectedRowIds(normalized);\n onSelectionChange?.([...normalized]);\n },\n [controlledSelectedRowIds, onSelectionChange, selectionMode],\n );\n const toggleRow = useCallback(\n (id: string, checked: boolean) => {\n const row = rows.get(id);\n if (selectionMode === \"none\" || row?.disabled) return;\n const next = new Set(selectedRowIds);\n if (selectionMode === \"single\") next.clear();\n if (checked) next.add(id);\n else next.delete(id);\n updateSelection(next);\n },\n [rows, selectedRowIds, selectionMode, updateSelection],\n );\n const toggleAll = useCallback(\n (checked: boolean) => {\n if (selectionMode !== \"multiple\") return;\n updateSelection(new Set(checked ? selectableRows : []));\n },\n [selectableRows, selectionMode, updateSelection],\n );\n const registerRow = useCallback((id: string, row: TableRowRecord) => {\n setRows((current) => {\n const next = new Map(current);\n next.set(id, row);\n return next;\n });\n return () =>\n setRows((current) => {\n if (!current.has(id)) return current;\n const next = new Map(current);\n next.delete(id);\n return next;\n });\n }, []);\n const requestSort = useCallback(\n (id: string, requestedDirection?: TableSortDirection) => {\n const currentDirection = sort?.id === id ? sort.direction : \"none\";\n const direction = requestedDirection ?? cycleSortDirection(currentDirection);\n const nextSort = direction === \"none\" ? null : { id, direction };\n if (controlledSort === undefined) setUncontrolledSort(nextSort);\n onSortChange?.(nextSort);\n },\n [controlledSort, onSortChange, sort],\n );\n\n const context = useMemo<TableContextValue>(\n () => ({\n allSelected,\n indeterminate,\n isRowSelected: (id) => selectedRowIds.has(id),\n registerRow,\n requestSort,\n selectedRowIds,\n selectionMode,\n status,\n toggleAll,\n toggleRow,\n sort,\n }),\n [\n allSelected,\n indeterminate,\n registerRow,\n requestSort,\n selectedRowIds,\n selectionMode,\n sort,\n status,\n toggleAll,\n toggleRow,\n ],\n );\n\n return (\n <TableContext.Provider value={context}>\n <table\n {...props}\n ref={ref}\n aria-busy={props[\"aria-busy\"] ?? (status === \"loading\" || undefined)}\n className={cx(styles.root, className)}\n data-jaci-component=\"table\"\n data-status={status}\n data-slot=\"table\"\n />\n </TableContext.Provider>\n );\n});\n\nexport type TableCaptionProps = ComponentPropsWithoutRef<\"caption\">;\nexport const TableCaption = forwardRef<HTMLTableCaptionElement, TableCaptionProps>(\n function TableCaption({ className, ...props }, ref) {\n return (\n <caption\n {...props}\n ref={ref}\n className={cx(table().caption, className)}\n data-slot=\"table-caption\"\n />\n );\n },\n);\n\nexport type TableDescriptionProps = ComponentPropsWithoutRef<\"p\">;\nexport const TableDescription = forwardRef<HTMLParagraphElement, TableDescriptionProps>(\n function TableDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(table().description, className)}\n data-slot=\"table-description\"\n />\n );\n },\n);\n\nexport type TableHeaderProps = ComponentPropsWithoutRef<\"thead\">;\nexport const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(\n function TableHeader({ className, ...props }, ref) {\n return (\n <TableSectionContext.Provider value=\"head\">\n <thead\n {...props}\n ref={ref}\n className={cx(table().header, className)}\n data-slot=\"table-header\"\n />\n </TableSectionContext.Provider>\n );\n },\n);\n\nexport type TableBodyProps = ComponentPropsWithoutRef<\"tbody\">;\nexport const TableBody = forwardRef<HTMLTableSectionElement, TableBodyProps>(function TableBody(\n { className, ...props },\n ref,\n) {\n return (\n <TableSectionContext.Provider value=\"body\">\n <tbody {...props} ref={ref} className={cx(table().body, className)} data-slot=\"table-body\" />\n </TableSectionContext.Provider>\n );\n});\n\nexport type TableFooterProps = ComponentPropsWithoutRef<\"tfoot\">;\nexport const TableFooter = forwardRef<HTMLTableSectionElement, TableFooterProps>(\n function TableFooter({ className, ...props }, ref) {\n return (\n <TableSectionContext.Provider value=\"foot\">\n <tfoot\n {...props}\n ref={ref}\n className={cx(table().footer, className)}\n data-slot=\"table-footer\"\n />\n </TableSectionContext.Provider>\n );\n },\n);\n\nexport interface TableRowProps extends Omit<ComponentPropsWithoutRef<\"tr\">, \"id\"> {\n id: string;\n selectionDisabled?: boolean;\n selected?: boolean;\n}\n\nexport const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(function TableRow(\n { className, id, selectionDisabled = false, selected: selectedOverride, ...props },\n ref,\n) {\n const context = useTableContext();\n const section = useContext(TableSectionContext);\n const selected = selectedOverride ?? context?.isRowSelected(id) ?? false;\n useEffect(\n () =>\n section === \"head\" ? undefined : context?.registerRow(id, { disabled: selectionDisabled }),\n [context?.registerRow, id, section, selectionDisabled],\n );\n\n return (\n <TableRowContext.Provider value={{ id, selectionDisabled }}>\n <tr\n {...props}\n id={id}\n ref={ref}\n aria-selected={selected || undefined}\n className={cx(table().row, className)}\n data-selected={selected || undefined}\n data-selection-disabled={selectionDisabled || undefined}\n data-slot=\"table-row\"\n />\n </TableRowContext.Provider>\n );\n});\n\nexport interface TableHeadProps extends Omit<ComponentPropsWithoutRef<\"th\">, \"align\"> {\n align?: TableAlignment;\n hideBelow?: TableHideBelow;\n onSort?: (direction: TableSortDirection) => void;\n sortDirection?: TableSortDirection;\n sortable?: boolean;\n}\n\nexport const TableHead = forwardRef<HTMLTableCellElement, TableHeadProps>(function TableHead(\n {\n align = \"start\",\n children,\n className,\n hideBelow,\n onSort,\n sortDirection,\n sortable = false,\n ...props\n },\n ref,\n) {\n const context = useTableContext();\n const styles = table({ align, hideBelow });\n const resolvedDirection =\n sortDirection ??\n (sortable && props.id && context?.sort?.id === props.id ? context.sort.direction : \"none\");\n const sort = () => {\n const next = cycleSortDirection(resolvedDirection);\n if (props.id) context?.requestSort(props.id, next);\n onSort?.(next);\n };\n\n return (\n <th\n {...props}\n ref={ref}\n aria-sort={sortable ? resolvedDirection : undefined}\n className={cx(styles.head, className)}\n data-align={align}\n data-hide-below={hideBelow}\n data-sort-direction={sortable ? resolvedDirection : undefined}\n data-slot=\"table-head\"\n scope={props.scope ?? \"col\"}\n >\n {sortable ? (\n <button\n aria-label={\n props[\"aria-label\"] ?? `Sort by ${typeof children === \"string\" ? children : \"column\"}`\n }\n className={styles.sortButton}\n onClick={sort}\n type=\"button\"\n >\n <span>{children}</span>\n <span aria-hidden=\"true\">\n {resolvedDirection === \"ascending\"\n ? \"↑\"\n : resolvedDirection === \"descending\"\n ? \"↓\"\n : \"↕\"}\n </span>\n </button>\n ) : (\n children\n )}\n </th>\n );\n});\n\nexport interface TableCellProps extends Omit<ComponentPropsWithoutRef<\"td\">, \"align\"> {\n align?: TableAlignment;\n hideBelow?: TableHideBelow;\n}\n\nexport const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(function TableCell(\n { align = \"start\", className, hideBelow, ...props },\n ref,\n) {\n const styles = table({ align, hideBelow });\n return (\n <td\n {...props}\n ref={ref}\n className={cx(styles.cell, className)}\n data-align={align}\n data-hide-below={hideBelow}\n data-slot=\"table-cell\"\n />\n );\n});\n\ninterface TableSelectionInputProps {\n \"aria-label\"?: string | undefined;\n checked?: boolean | undefined;\n indeterminate?: boolean | undefined;\n inputProps?: Omit<\n ComponentPropsWithoutRef<\"input\">,\n \"checked\" | \"defaultChecked\" | \"onChange\" | \"type\"\n >;\n onCheckedChange?: (checked: boolean) => void;\n}\n\nfunction SelectionInput({\n \"aria-label\": ariaLabel,\n checked = false,\n indeterminate = false,\n inputProps,\n onCheckedChange,\n}: TableSelectionInputProps) {\n const ref = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (ref.current) ref.current.indeterminate = indeterminate;\n }, [indeterminate]);\n\n return (\n <input\n {...inputProps}\n ref={ref}\n aria-label={ariaLabel ?? inputProps?.[\"aria-label\"]}\n aria-checked={indeterminate ? \"mixed\" : checked}\n checked={checked}\n onChange={(event) => onCheckedChange?.(event.currentTarget.checked)}\n type=\"checkbox\"\n />\n );\n}\n\nexport interface TableSelectionHeaderProps\n extends Omit<ComponentPropsWithoutRef<\"th\">, \"children\">,\n TableSelectionInputProps {}\n\nexport const TableSelectionHeader = forwardRef<HTMLTableCellElement, TableSelectionHeaderProps>(\n function TableSelectionHeader(\n {\n checked: checkedOverride,\n className,\n indeterminate: indeterminateOverride,\n inputProps,\n onCheckedChange,\n ...props\n },\n ref,\n ) {\n const context = useRequiredTableContext();\n const ariaLabel = props[\"aria-label\"] ?? inputProps?.[\"aria-label\"] ?? \"Select all rows\";\n const checked = checkedOverride ?? context.allSelected;\n const indeterminate = indeterminateOverride ?? context.indeterminate;\n const disabled = Boolean(\n inputProps?.disabled ||\n (context.selectionMode !== \"multiple\" && !onCheckedChange && checkedOverride === undefined),\n );\n return (\n <th\n {...props}\n ref={ref}\n aria-label={ariaLabel}\n className={cx(table().selection, className)}\n data-slot=\"table-selection-header\"\n scope=\"col\"\n >\n <SelectionInput\n aria-label={ariaLabel}\n checked={checked}\n indeterminate={indeterminate}\n inputProps={{ ...inputProps, disabled }}\n onCheckedChange={onCheckedChange ?? context.toggleAll}\n />\n </th>\n );\n },\n);\n\nexport interface TableSelectionCellProps\n extends Omit<ComponentPropsWithoutRef<\"td\">, \"children\">,\n TableSelectionInputProps {}\n\nexport const TableSelectionCell = forwardRef<HTMLTableCellElement, TableSelectionCellProps>(\n function TableSelectionCell(\n {\n checked: checkedOverride,\n className,\n indeterminate = false,\n inputProps,\n onCheckedChange,\n ...props\n },\n ref,\n ) {\n const context = useRequiredTableContext();\n const row = useTableRowContext();\n const id = row?.id ?? \"\";\n const ariaLabel = props[\"aria-label\"] ?? inputProps?.[\"aria-label\"] ?? \"Select row\";\n const checked = checkedOverride ?? context.isRowSelected(id);\n const disabled = Boolean(\n inputProps?.disabled ||\n row?.selectionDisabled ||\n (context.selectionMode === \"none\" && !onCheckedChange && checkedOverride === undefined),\n );\n return (\n <td\n {...props}\n ref={ref}\n className={cx(table().selection, className)}\n data-slot=\"table-selection-cell\"\n >\n <SelectionInput\n aria-label={ariaLabel}\n checked={checked}\n indeterminate={indeterminate}\n inputProps={{ ...inputProps, disabled }}\n onCheckedChange={onCheckedChange ?? ((next) => context.toggleRow(id, next))}\n />\n </td>\n );\n },\n);\n\nexport interface TableStateProps extends Omit<ComponentPropsWithoutRef<\"tr\">, \"children\"> {\n children?: ReactNode;\n colSpan?: number;\n}\n\nconst TableStateRow = forwardRef<\n HTMLTableRowElement,\n TableStateProps & { live?: \"polite\" | \"assertive\" }\n>(function TableStateRow({ children, className, colSpan = 1, live = \"polite\", ...props }, ref) {\n const name = live === \"assertive\" ? \"error\" : \"loading\";\n return (\n <tr {...props} ref={ref} className={cx(table().row, className)} data-slot={`table-${name}-row`}>\n <td aria-live={live} className={table().empty} colSpan={colSpan} data-slot={`table-${name}`}>\n {children}\n </td>\n </tr>\n );\n});\n\nexport interface TableEmptyProps extends TableStateProps {}\nexport type TableLoadingProps = TableStateProps;\nexport type TableErrorProps = TableStateProps;\nexport const TableEmpty = forwardRef<HTMLTableRowElement, TableEmptyProps>(function TableEmpty(\n { children = \"No results found.\", className, colSpan = 1, ...props },\n ref,\n) {\n return (\n <tr {...props} ref={ref} className={cx(table().row, className)} data-slot=\"table-empty-row\">\n <td className={table().empty} colSpan={colSpan} data-slot=\"table-empty\">\n {children}\n </td>\n </tr>\n );\n});\n\nexport const TableLoading = forwardRef<HTMLTableRowElement, TableStateProps>(function TableLoading(\n { children = \"Loading…\", ...props },\n ref,\n) {\n return (\n <TableStateRow {...props} ref={ref} live=\"polite\">\n {children}\n </TableStateRow>\n );\n});\n\nexport const TableError = forwardRef<HTMLTableRowElement, TableStateProps>(function TableError(\n { children = \"Something went wrong.\", ...props },\n ref,\n) {\n return (\n <TableStateRow {...props} ref={ref} live=\"assertive\">\n {children}\n </TableStateRow>\n );\n});\n\nexport const Table = {\n Container: TableContainer,\n Root: TableRoot,\n Caption: TableCaption,\n Description: TableDescription,\n Header: TableHeader,\n Body: TableBody,\n Footer: TableFooter,\n Row: TableRow,\n Head: TableHead,\n Cell: TableCell,\n SelectionHeader: TableSelectionHeader,\n SelectionCell: TableSelectionCell,\n Empty: TableEmpty,\n Loading: TableLoading,\n Error: TableError,\n};\n"],"mappings":";;;;;;AAsDA,MAAM,gBAAA,GAAeA,MAAAA,cAAAA,CAAwC,IAAI;AACjE,MAAM,mBAAA,GAAkBA,MAAAA,cAAAA,CAA2C,IAAI;AACvE,MAAM,uBAAA,GAAsBA,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