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.
Files changed (182) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +11 -1
  3. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  4. package/dist/components/accordion/accordion.cjs.map +1 -1
  5. package/dist/components/accordion/accordion.js.map +1 -1
  6. package/dist/components/alert/alert.cjs.map +1 -1
  7. package/dist/components/alert/alert.js.map +1 -1
  8. package/dist/components/alert-dialog/alert-dialog.cjs.map +1 -1
  9. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  10. package/dist/components/aspect-ratio/aspect-ratio.cjs.map +1 -1
  11. package/dist/components/avatar/avatar.cjs.map +1 -1
  12. package/dist/components/avatar/avatar.js.map +1 -1
  13. package/dist/components/breadcrumbs/breadcrumbs.cjs.map +1 -1
  14. package/dist/components/button/button.cjs +1 -0
  15. package/dist/components/button/button.cjs.map +1 -1
  16. package/dist/components/button/button.d.cts +2 -1
  17. package/dist/components/button/button.d.ts +2 -1
  18. package/dist/components/button/button.js +1 -0
  19. package/dist/components/button/button.js.map +1 -1
  20. package/dist/components/button-group/button-group.cjs.map +1 -1
  21. package/dist/components/calendar/calendar.cjs +4 -6
  22. package/dist/components/calendar/calendar.cjs.map +1 -1
  23. package/dist/components/calendar/calendar.js +4 -6
  24. package/dist/components/calendar/calendar.js.map +1 -1
  25. package/dist/components/card/card.cjs.map +1 -1
  26. package/dist/components/carousel/carousel.cjs.map +1 -1
  27. package/dist/components/carousel/carousel.js.map +1 -1
  28. package/dist/components/checkbox-group/checkbox-group.cjs +7 -3
  29. package/dist/components/checkbox-group/checkbox-group.cjs.map +1 -1
  30. package/dist/components/checkbox-group/checkbox-group.js +7 -3
  31. package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
  32. package/dist/components/code/code.cjs.map +1 -1
  33. package/dist/components/code/code.js.map +1 -1
  34. package/dist/components/collapsible/collapsible.cjs.map +1 -1
  35. package/dist/components/collapsible/collapsible.js.map +1 -1
  36. package/dist/components/color-picker/color-picker.cjs.map +1 -1
  37. package/dist/components/color-picker/color-picker.js.map +1 -1
  38. package/dist/components/color-picker/color-utils.cjs +5 -3
  39. package/dist/components/color-picker/color-utils.cjs.map +1 -1
  40. package/dist/components/color-picker/color-utils.js +5 -3
  41. package/dist/components/color-picker/color-utils.js.map +1 -1
  42. package/dist/components/color-swatch/color-swatch.cjs.map +1 -1
  43. package/dist/components/combobox/combobox.cjs +2 -1
  44. package/dist/components/combobox/combobox.cjs.map +1 -1
  45. package/dist/components/combobox/combobox.js +2 -1
  46. package/dist/components/combobox/combobox.js.map +1 -1
  47. package/dist/components/command/command.cjs.map +1 -1
  48. package/dist/components/command/command.js.map +1 -1
  49. package/dist/components/context-menu/context-menu.cjs.map +1 -1
  50. package/dist/components/context-menu/context-menu.d.cts +2 -2
  51. package/dist/components/context-menu/context-menu.d.ts +2 -2
  52. package/dist/components/controls/checkbox.cjs.map +1 -1
  53. package/dist/components/controls/checkbox.js.map +1 -1
  54. package/dist/components/controls/input.cjs.map +1 -1
  55. package/dist/components/controls/input.js.map +1 -1
  56. package/dist/components/controls/radio.cjs.map +1 -1
  57. package/dist/components/controls/switch.cjs.map +1 -1
  58. package/dist/components/controls/switch.js.map +1 -1
  59. package/dist/components/controls/textarea.cjs.map +1 -1
  60. package/dist/components/controls/textarea.js.map +1 -1
  61. package/dist/components/copyable/copyable.cjs.map +1 -1
  62. package/dist/components/copyable/copyable.js.map +1 -1
  63. package/dist/components/data-toolbar/data-toolbar.cjs.map +1 -1
  64. package/dist/components/data-toolbar/data-toolbar.js.map +1 -1
  65. package/dist/components/data-view/data-view.cjs.map +1 -1
  66. package/dist/components/date-picker/date-picker.cjs +4 -7
  67. package/dist/components/date-picker/date-picker.cjs.map +1 -1
  68. package/dist/components/date-picker/date-picker.js +4 -7
  69. package/dist/components/date-picker/date-picker.js.map +1 -1
  70. package/dist/components/date-range-picker/date-range-picker.cjs +4 -6
  71. package/dist/components/date-range-picker/date-range-picker.cjs.map +1 -1
  72. package/dist/components/date-range-picker/date-range-picker.js +4 -6
  73. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  74. package/dist/components/dialog/dialog.cjs.map +1 -1
  75. package/dist/components/dialog/dialog.js.map +1 -1
  76. package/dist/components/download-trigger/download-trigger.cjs.map +1 -1
  77. package/dist/components/drawer/drawer.cjs.map +1 -1
  78. package/dist/components/drawer/drawer.js.map +1 -1
  79. package/dist/components/empty-state/empty-state.cjs.map +1 -1
  80. package/dist/components/feedback/badge.cjs.map +1 -1
  81. package/dist/components/field/field.cjs.map +1 -1
  82. package/dist/components/field/field.js.map +1 -1
  83. package/dist/components/fieldset/fieldset.cjs.map +1 -1
  84. package/dist/components/figure/figure.cjs.map +1 -1
  85. package/dist/components/figure/figure.js.map +1 -1
  86. package/dist/components/form/form.cjs.map +1 -1
  87. package/dist/components/form/form.js.map +1 -1
  88. package/dist/components/icon-button/icon-button.cjs.map +1 -1
  89. package/dist/components/icon-button/icon-button.js.map +1 -1
  90. package/dist/components/image/image.cjs.map +1 -1
  91. package/dist/components/image/image.js.map +1 -1
  92. package/dist/components/input-group/input-group.cjs.map +1 -1
  93. package/dist/components/kbd/kbd.cjs.map +1 -1
  94. package/dist/components/layout/index.cjs.map +1 -1
  95. package/dist/components/list/list.cjs.map +1 -1
  96. package/dist/components/menu/menu.cjs.map +1 -1
  97. package/dist/components/menu/menu.d.cts +2 -2
  98. package/dist/components/menu/menu.d.ts +2 -2
  99. package/dist/components/menubar/menubar.cjs.map +1 -1
  100. package/dist/components/menubar/menubar.d.cts +2 -2
  101. package/dist/components/menubar/menubar.d.ts +2 -2
  102. package/dist/components/menubar/menubar.js.map +1 -1
  103. package/dist/components/meter/meter.cjs.map +1 -1
  104. package/dist/components/meter/meter.js.map +1 -1
  105. package/dist/components/navigation/navigation.cjs.map +1 -1
  106. package/dist/components/navigation/navigation.js.map +1 -1
  107. package/dist/components/navigation-menu/navigation-menu.cjs.map +1 -1
  108. package/dist/components/navigation-menu/navigation-menu.js.map +1 -1
  109. package/dist/components/number-field/number-field.cjs +2 -1
  110. package/dist/components/number-field/number-field.cjs.map +1 -1
  111. package/dist/components/number-field/number-field.js +2 -1
  112. package/dist/components/number-field/number-field.js.map +1 -1
  113. package/dist/components/option-selector/option-selector.cjs.map +1 -1
  114. package/dist/components/option-selector/option-selector.js.map +1 -1
  115. package/dist/components/pagination/pagination.cjs.map +1 -1
  116. package/dist/components/pagination/pagination.js.map +1 -1
  117. package/dist/components/pin-input/pin-input.cjs.map +1 -1
  118. package/dist/components/pin-input/pin-input.js.map +1 -1
  119. package/dist/components/popover/popover.cjs.map +1 -1
  120. package/dist/components/popover/popover.js.map +1 -1
  121. package/dist/components/progress/progress.cjs.map +1 -1
  122. package/dist/components/progress/progress.js.map +1 -1
  123. package/dist/components/qr-code/qr-code.cjs.map +1 -1
  124. package/dist/components/qr-code/qr-code.js.map +1 -1
  125. package/dist/components/quote/quote.cjs.map +1 -1
  126. package/dist/components/quote/quote.js.map +1 -1
  127. package/dist/components/radio-group/radio-group.cjs +7 -3
  128. package/dist/components/radio-group/radio-group.cjs.map +1 -1
  129. package/dist/components/radio-group/radio-group.js +7 -3
  130. package/dist/components/radio-group/radio-group.js.map +1 -1
  131. package/dist/components/range-slider/range-slider.cjs.map +1 -1
  132. package/dist/components/range-slider/range-slider.js.map +1 -1
  133. package/dist/components/scroll-area/scroll-area.cjs.map +1 -1
  134. package/dist/components/select/select.cjs.map +1 -1
  135. package/dist/components/select/select.js.map +1 -1
  136. package/dist/components/sidebar/sidebar.cjs.map +1 -1
  137. package/dist/components/sidebar/sidebar.js.map +1 -1
  138. package/dist/components/skeleton/skeleton.cjs.map +1 -1
  139. package/dist/components/slider/slider.cjs.map +1 -1
  140. package/dist/components/slider/slider.js.map +1 -1
  141. package/dist/components/spacer/spacer.cjs.map +1 -1
  142. package/dist/components/stat/stat.cjs.map +1 -1
  143. package/dist/components/stat/stat.js.map +1 -1
  144. package/dist/components/stepper/stepper.cjs +2 -1
  145. package/dist/components/stepper/stepper.cjs.map +1 -1
  146. package/dist/components/stepper/stepper.js +2 -1
  147. package/dist/components/stepper/stepper.js.map +1 -1
  148. package/dist/components/table/table.cjs.map +1 -1
  149. package/dist/components/table/table.js.map +1 -1
  150. package/dist/components/tabs/tabs.cjs.map +1 -1
  151. package/dist/components/tabs/tabs.js.map +1 -1
  152. package/dist/components/tags-input/tags-input.cjs +10 -9
  153. package/dist/components/tags-input/tags-input.cjs.map +1 -1
  154. package/dist/components/tags-input/tags-input.js +10 -9
  155. package/dist/components/tags-input/tags-input.js.map +1 -1
  156. package/dist/components/toast/toast.cjs.map +1 -1
  157. package/dist/components/toast/toast.js.map +1 -1
  158. package/dist/components/toggle/toggle.cjs.map +1 -1
  159. package/dist/components/toggle-group/toggle-group.cjs.map +1 -1
  160. package/dist/components/toolbar/toolbar.cjs.map +1 -1
  161. package/dist/components/tooltip/tooltip.cjs.map +1 -1
  162. package/dist/components/tree-view/tree-view.cjs.map +1 -1
  163. package/dist/components/tree-view/tree-view.js.map +1 -1
  164. package/dist/components/typography/heading.cjs.map +1 -1
  165. package/dist/components/typography/link.cjs.map +1 -1
  166. package/dist/components/typography/paragraph.cjs.map +1 -1
  167. package/dist/components/typography/text.cjs.map +1 -1
  168. package/dist/components/upload/upload.cjs +2 -2
  169. package/dist/components/upload/upload.cjs.map +1 -1
  170. package/dist/components/upload/upload.js +2 -2
  171. package/dist/components/upload/upload.js.map +1 -1
  172. package/dist/components/visually-hidden/visually-hidden.cjs.map +1 -1
  173. package/dist/panda-preset.cjs.map +1 -1
  174. package/dist/styles/theme.cjs +18 -18
  175. package/dist/styles/theme.cjs.map +1 -1
  176. package/dist/styles/theme.js +18 -18
  177. package/dist/styles/theme.js.map +1 -1
  178. package/dist/styles.css +12 -21
  179. package/dist/theme/theme-provider.cjs.map +1 -1
  180. package/dist/theme/theme-provider.js.map +1 -1
  181. package/dist/theme/theme-scope.cjs.map +1 -1
  182. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.cjs","names":["drawer","BaseDrawer","withRecipeClassName","useThemePortalProps","cx"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport function DrawerPortal(props: DrawerPortalProps) {\n return <BaseDrawer.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,iBAAA,GAAA,MAAA,cAAA,CAAyD,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,WAAA,GAAA,MAAA,WAAA,CAAqB,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgB,WAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAASA,eAAAA,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,WAAA,GAAA,MAAA,QAAA,QAAyB;EAAE;EAAM;EAAM;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AAO;CACP,cAAcD,sBAAAA,OAAW;AAC3B"}
1
+ {"version":3,"file":"drawer.cjs","names":["createContext","useContext","drawer","useMemo","BaseDrawer","forwardRef","withRecipeClassName","useThemePortalProps","cx"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport function DrawerPortal(props: DrawerPortalProps) {\n return <BaseDrawer.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,iBAAA,GAAgBA,MAAAA,cAAAA,CAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,WAAA,GAAUC,MAAAA,WAAAA,CAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgB,WAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAASC,eAAAA,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,WAAA,GAAUC,MAAAA,QAAAA,QAA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CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,OAAO;CACP,aAAa;CACb,QAAQ;CACR,OAAO;CACP,cAAcF,sBAAAA,OAAW;AAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","names":["DrawerRoot","BaseDrawer","Drawer"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport function DrawerPortal(props: DrawerPortalProps) {\n return <BaseDrawer.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgBA,aAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAAS,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,UAAU,eAAe;EAAE;EAAM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AAW,GAAG,OAAO,QAAQ,SAAS;EAAG,aAAU;CAAiB,CAAA;AAElG,CAAC;AAID,MAAa,cAAc,WAAgD,SAAS,YAClF,EAAE,cAAc,WAAW,UAAU,WAAW,GAAG,SACnD,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,kBAAkB,YAAY;CAEpC,OACE,oBAACA,OAAW,OAAZ;EACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAW,oBAAoB,kBAAkB,OAAO,SAAS,OAAO,OAAO,SAAS;EACxF,aAAU;YAET,YAAY;CACG,CAAA;AAEtB,CAAC;AAED,MAAaC,WAAS;CACpB,MAAMF;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,OAAO;CACP,aAAa;CACb,QAAQ;CACR,OAAO;CACP,cAAcC,OAAW;AAC3B"}
1
+ {"version":3,"file":"drawer.js","names":["DrawerRoot","BaseDrawer","Drawer"],"sources":["../../../src/components/drawer/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { Drawer as BaseDrawer } from \"@base-ui/react/drawer\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { DrawerRoot as BaseDrawerRoot } from \"@base-ui/react/drawer\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { drawer } from \"../../styled-system/recipes\";\nimport { withRecipeClassName } from \"../base-ui\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type DrawerSide = \"bottom\" | \"left\" | \"right\" | \"top\";\nexport type DrawerSize = \"sm\" | \"md\" | \"lg\";\n\ninterface DrawerContextValue {\n side: DrawerSide;\n size: DrawerSize;\n styles: ReturnType<typeof drawer>;\n}\n\nconst DrawerContext = createContext<DrawerContextValue | null>(null);\n\nfunction useDrawerContext() {\n const context = useContext(DrawerContext);\n if (!context) {\n throw new Error(\"Drawer parts must be rendered inside Drawer.Root.\");\n }\n\n return context;\n}\n\nexport interface DrawerRootProps<Payload = unknown>\n extends Omit<BaseDrawerRoot.Props<Payload>, \"children\"> {\n /** Side from which the drawer enters. */\n side?: DrawerSide;\n /** Shared spacing scale for the drawer content. */\n size?: DrawerSize;\n children?: BaseDrawerRoot.Props<Payload>[\"children\"];\n}\n\nexport function DrawerRoot<Payload = unknown>({\n children,\n side = \"bottom\",\n size = \"md\",\n ...props\n}: DrawerRootProps<Payload>) {\n const styles = drawer({ size });\n const context = useMemo(() => ({ side, size, styles }), [side, size, styles]);\n const swipeDirection =\n props.swipeDirection ?? (side === \"bottom\" ? \"down\" : side === \"top\" ? \"up\" : side);\n\n return (\n <DrawerContext.Provider value={context}>\n <BaseDrawer.Root {...props} swipeDirection={swipeDirection}>\n {children}\n </BaseDrawer.Root>\n </DrawerContext.Provider>\n );\n}\n\nexport type DrawerTriggerProps = ComponentPropsWithoutRef<typeof BaseDrawer.Trigger>;\n\nexport const DrawerTrigger = forwardRef<HTMLButtonElement, DrawerTriggerProps>(\n function DrawerTrigger({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Trigger\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.trigger, className)}\n data-slot=\"drawer-trigger\"\n />\n );\n },\n);\n\nexport type DrawerPortalProps = ComponentPropsWithoutRef<typeof BaseDrawer.Portal>;\nexport function DrawerPortal(props: DrawerPortalProps) {\n return <BaseDrawer.Portal {...useThemePortalProps(props)} />;\n}\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof BaseDrawer.Backdrop>;\n\nexport const DrawerBackdrop = forwardRef<HTMLDivElement, DrawerBackdropProps>(\n function DrawerBackdrop({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Backdrop\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.backdrop, className)}\n data-slot=\"drawer-backdrop\"\n />\n );\n },\n);\n\nexport type DrawerViewportProps = ComponentPropsWithoutRef<typeof BaseDrawer.Viewport>;\n\nexport const DrawerViewport = forwardRef<HTMLDivElement, DrawerViewportProps>(\n function DrawerViewport({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Viewport\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.viewport, className)}\n data-slot=\"drawer-viewport\"\n />\n );\n },\n);\n\nexport interface DrawerPopupProps extends ComponentPropsWithoutRef<typeof BaseDrawer.Popup> {\n /** Overrides the side configured on `Drawer.Root`. */\n side?: DrawerSide;\n /** Overrides the size configured on `Drawer.Root`. */\n size?: DrawerSize;\n}\n\nexport const DrawerPopup = forwardRef<HTMLDivElement, DrawerPopupProps>(function DrawerPopup(\n { \"aria-label\": ariaLabel, className, side: popupSide, size: popupSize, ...props },\n ref,\n) {\n const { side: rootSide, size: rootSize, styles: rootStyles } = useDrawerContext();\n const side = popupSide ?? rootSide;\n const styles = popupSize && popupSize !== rootSize ? drawer({ size: popupSize }) : rootStyles;\n\n return (\n <BaseDrawer.Popup\n {...props}\n aria-label={ariaLabel ?? \"Drawer\"}\n data-jaci-component=\"drawer\"\n data-side={side}\n data-slot=\"drawer-popup\"\n ref={ref}\n className={withRecipeClassName(styles.popup, className)}\n />\n );\n});\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof BaseDrawer.Content>;\n\nexport const DrawerContent = forwardRef<HTMLDivElement, DrawerContentProps>(function DrawerContent(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n\n return (\n <BaseDrawer.Content\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.content, className)}\n data-slot=\"drawer-content\"\n />\n );\n});\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerHeader = forwardRef<HTMLDivElement, DrawerHeaderProps>(function DrawerHeader(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.header, className)} data-slot=\"drawer-header\" />\n );\n});\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof BaseDrawer.Title>;\n\nexport const DrawerTitle = forwardRef<HTMLHeadingElement, DrawerTitleProps>(function DrawerTitle(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Title\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.title, className)}\n data-slot=\"drawer-title\"\n />\n );\n});\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof BaseDrawer.Description>;\n\nexport const DrawerDescription = forwardRef<HTMLParagraphElement, DrawerDescriptionProps>(\n function DrawerDescription({ className, ...props }, ref) {\n const { styles } = useDrawerContext();\n return (\n <BaseDrawer.Description\n {...props}\n ref={ref}\n className={withRecipeClassName(styles.description, className)}\n data-slot=\"drawer-description\"\n />\n );\n },\n);\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const DrawerFooter = forwardRef<HTMLDivElement, DrawerFooterProps>(function DrawerFooter(\n { className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n return (\n <div {...props} ref={ref} className={cx(styles.footer, className)} data-slot=\"drawer-footer\" />\n );\n});\n\nexport type DrawerCloseProps = ComponentPropsWithoutRef<typeof BaseDrawer.Close>;\n\nexport const DrawerClose = forwardRef<HTMLButtonElement, DrawerCloseProps>(function DrawerClose(\n { \"aria-label\": ariaLabel, children, className, ...props },\n ref,\n) {\n const { styles } = useDrawerContext();\n const hasVisibleLabel = children != null;\n\n return (\n <BaseDrawer.Close\n {...props}\n aria-label={ariaLabel ?? (hasVisibleLabel ? undefined : \"Close drawer\")}\n ref={ref}\n className={withRecipeClassName(hasVisibleLabel ? styles.action : styles.close, className)}\n data-slot=\"drawer-close\"\n >\n {children ?? \"×\"}\n </BaseDrawer.Close>\n );\n});\n\nexport const Drawer = {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Backdrop: DrawerBackdrop,\n Viewport: DrawerViewport,\n Popup: DrawerPopup,\n Content: DrawerContent,\n Header: DrawerHeader,\n Title: DrawerTitle,\n Description: DrawerDescription,\n Footer: DrawerFooter,\n Close: DrawerClose,\n createHandle: BaseDrawer.createHandle,\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAGrE,OAAO;AACT;AAWA,SAAgBA,aAA8B,EAC5C,UACA,OAAO,UACP,OAAO,MACP,GAAG,SACwB;CAC3B,MAAM,SAAS,OAAO,EAAE,KAAK,CAAC;CAC9B,MAAM,UAAU,eAAe;EAAE;EAAM;EAAM;CAAO,IAAI;EAAC;EAAM;EAAM;CAAM,CAAC;CAC5E,MAAM,iBACJ,MAAM,mBAAmB,SAAS,WAAW,SAAS,SAAS,QAAQ,OAAO;CAEhF,OACE,oBAAC,cAAc,UAAf;EAAwB,OAAO;EAC7B,UAAA,oBAACC,OAAW,MAAZ;GAAiB,GAAI;GAAuB;GACzC;EACc,CAAA;CACK,CAAA;AAE5B;AAIA,MAAa,gBAAgB,WAC3B,SAAS,cAAc,EAAE,WAAW,GAAG,SAAS,KAAK;CACnD,MAAM,EAAE,WAAW,iBAAiB;CAEpC,OACE,oBAACA,OAAW,SAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,SAAS,SAAS;EACxD,aAAU;CACX,CAAA;AAEL,CACF;AAGA,SAAgB,aAAa,OAA0B;CACrD,OAAO,oBAACA,OAAW,QAAZ,EAAmB,GAAI,oBAAoB,KAAK,EAAI,CAAA;AAC7D;AAIA,MAAa,iBAAiB,WAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,MAAM,EAAE,WAAW,iBAAiB;CAEpC,OACE,oBAACA,OAAW,UAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,UAAU,SAAS;EACzD,aAAU;CACX,C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AI;EACC;EACL,WAAW,oBAAoB,OAAO,OAAO,SAAS;EACtD,aAAU;CACX,CAAA;AAEL,CAAC;AAID,MAAa,oBAAoB,WAC/B,SAAS,kBAAkB,EAAE,WAAW,GAAG,SAAS,KAAK;CACvD,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,oBAACA,OAAW,aAAZ;EACE,GAAI;EACC;EACL,WAAW,oBAAoB,OAAO,aAAa,SAAS;EAC5D,aAAU;CACX,CAAA;AAEL,CACF;AAIA,MAAa,eAAe,WAA8C,SAAS,aACjF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,oBAAC,OAAD;EAAK,GAAI;EAAY;EAAK,WAAW,GAAG,OAAO,QAAQ,SAAS;EAAG,aAAU;CAAiB,CAAA;AAElG,CAAC;AAID,MAAa,cAAc,WAAgD,SAAS,YAClF,EAAE,cAAc,WAAW,UAAU,WAAW,GAAG,SACnD,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,MAAM,kBAAkB,YAAY;CAEpC,OACE,oBAACA,OAAW,OAAZ;EACE,GAAI;EACJ,cAAY,cAAc,kBAAkB,KAAA,IAAY;EACnD;EACL,WAAW,oBAAoB,kBAAkB,OAAO,SAAS,OAAO,OAAO,SAAS;EACxF,aAAU;EAET,UAAA,YAAY;CACG,CAAA;AAEtB,CAAC;AAED,MAAaC,WAAS;CACpB,MAAMF;CACN,SAAS;CACT,QAAQ;CACR,UAAU;CACV,UAAU;CACV,OAAO;CACP,SAAS;CACT,QAAQ;CACR,OAAO;CACP,aAAa;CACb,QAAQ;CACR,OAAO;CACP,cAAcC,OAAW;AAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"empty-state.cjs","names":["cx","emptyState"],"sources":["../../../src/components/empty-state/empty-state.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { emptyState } from \"../../styled-system/recipes\";\n\nexport type EmptyStateRootProps = ComponentPropsWithoutRef<\"section\">;\n\nexport const EmptyStateRoot = forwardRef<HTMLElement, EmptyStateRootProps>(function EmptyStateRoot(\n { className, ...props },\n ref,\n) {\n return (\n <section\n {...props}\n ref={ref}\n className={cx(emptyState().root, className)}\n data-jaci-component=\"empty-state\"\n data-slot=\"empty-state\"\n />\n );\n});\n\nexport const EmptyStateIcon = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function EmptyStateIcon({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(emptyState().icon, className)}\n data-slot=\"empty-state-icon\"\n />\n );\n },\n);\n\nexport const EmptyStateTitle = forwardRef<HTMLHeadingElement, ComponentPropsWithoutRef<\"h3\">>(\n function EmptyStateTitle({ className, ...props }, ref) {\n return (\n <h3\n {...props}\n ref={ref}\n className={cx(emptyState().title, className)}\n data-slot=\"empty-state-title\"\n />\n );\n },\n);\n\nexport const EmptyStateDescription = forwardRef<\n HTMLParagraphElement,\n ComponentPropsWithoutRef<\"p\">\n>(function EmptyStateDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(emptyState().description, className)}\n data-slot=\"empty-state-description\"\n />\n );\n});\n\nexport const EmptyStateAction = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function EmptyStateAction({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(emptyState().action, className)}\n data-slot=\"empty-state-action\"\n />\n );\n },\n);\n\nexport const EmptyState = Object.assign(EmptyStateRoot, {\n Root: EmptyStateRoot,\n Icon: EmptyStateIcon,\n Title: EmptyStateTitle,\n Description: EmptyStateDescription,\n Action: EmptyStateAction,\n});\n"],"mappings":";;;;;AAQA,MAAa,kBAAA,GAAA,MAAA,WAAA,CAA8D,SAAS,eAClF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;E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V,CAAC"}
1
+ {"version":3,"file":"empty-state.cjs","names":["forwardRef","cx","emptyState"],"sources":["../../../src/components/empty-state/empty-state.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { emptyState } from \"../../styled-system/recipes\";\n\nexport type EmptyStateRootProps = ComponentPropsWithoutRef<\"section\">;\n\nexport const EmptyStateRoot = forwardRef<HTMLElement, EmptyStateRootProps>(function EmptyStateRoot(\n { className, ...props },\n ref,\n) {\n return (\n <section\n {...props}\n ref={ref}\n className={cx(emptyState().root, className)}\n data-jaci-component=\"empty-state\"\n data-slot=\"empty-state\"\n />\n );\n});\n\nexport const EmptyStateIcon = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function EmptyStateIcon({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(emptyState().icon, className)}\n data-slot=\"empty-state-icon\"\n />\n );\n },\n);\n\nexport const EmptyStateTitle = forwardRef<HTMLHeadingElement, ComponentPropsWithoutRef<\"h3\">>(\n function EmptyStateTitle({ className, ...props }, ref) {\n return (\n <h3\n {...props}\n ref={ref}\n className={cx(emptyState().title, className)}\n data-slot=\"empty-state-title\"\n />\n );\n },\n);\n\nexport const EmptyStateDescription = forwardRef<\n HTMLParagraphElement,\n ComponentPropsWithoutRef<\"p\">\n>(function EmptyStateDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(emptyState().description, className)}\n data-slot=\"empty-state-description\"\n />\n );\n});\n\nexport const EmptyStateAction = forwardRef<HTMLDivElement, ComponentPropsWithoutRef<\"div\">>(\n function EmptyStateAction({ className, ...props }, ref) {\n return (\n <div\n {...props}\n ref={ref}\n className={cx(emptyState().action, className)}\n data-slot=\"empty-state-action\"\n />\n );\n },\n);\n\nexport const EmptyState = Object.assign(EmptyStateRoot, {\n Root: EmptyStateRoot,\n Icon: EmptyStateIcon,\n Title: Empt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AAA,CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGC,oBAAAA,WAAW,CAAC,CAAC,QAAQ,SAAS;EAC5C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,aAAa,OAAO,OAAO,gBAAgB;CACtD,MAAM;CACN,MAAM;CACN,OAAO;CACP,aAAa;CACb,QAAQ;AACV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"badge.cjs","names":["cx","badge"],"sources":["../../../src/components/feedback/badge.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { badge } from \"../../styled-system/recipes\";\n\nexport interface BadgeProps extends ComponentPropsWithoutRef<\"span\"> {\n /** Use `custom` when the color should be provided by a className or CSS module. */\n tone?: \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\" | \"custom\";\n variant?: \"solid\" | \"soft\" | \"outline\";\n}\n\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n { className, tone = \"neutral\", variant = \"solid\", ...props },\n ref,\n) {\n const appearance = `${tone}-${variant}` as\n | \"neutral-solid\"\n | \"accent-solid\"\n | \"success-solid\"\n | \"warning-solid\"\n | \"danger-solid\"\n | \"neutral-soft\"\n | \"accent-soft\"\n | \"success-soft\"\n | \"warning-soft\"\n | \"danger-soft\"\n | \"neutral-outline\"\n | \"accent-outline\"\n | \"success-outline\"\n | \"warning-outline\"\n | \"danger-outline\"\n | \"custom-solid\"\n | \"custom-soft\"\n | \"custom-outline\";\n\n return (\n <span\n {...props}\n ref={ref}\n className={cx(badge({ tone: appearance }), className)}\n data-jaci-component=\"badge\"\n data-jaci-tone={tone}\n data-slot=\"badge\"\n data-variant={variant}\n />\n );\n});\n"],"mappings":";;;;;AAYA,MAAa,SAAA,GAAA,MAAA,WAAA,CAAgD,SAAS,MACpE,EAAE,WAAW,OAAO,WAAW,UAAU,SAAS,GAAG,SACrD,KACA;CACA,MAAM,aAAa,GAAG,KAAK,GAAG;CAoB9B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,WAAWA,WAAAA,GAAGC,cAAAA,MAAM,EAAE,MAAM,WAAW,CAAC,GAAG,SAAS;EACpD,uBAAoB;EACpB,kBAAgB;EAChB,aAAU;EACV,gBAAc;CACf,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"badge.cjs","names":["forwardRef","cx","badge"],"sources":["../../../src/components/feedback/badge.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { badge } from \"../../styled-system/recipes\";\n\nexport interface BadgeProps extends ComponentPropsWithoutRef<\"span\"> {\n /** Use `custom` when the color should be provided by a className or CSS module. */\n tone?: \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\" | \"custom\";\n variant?: \"solid\" | \"soft\" | \"outline\";\n}\n\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n { className, tone = \"neutral\", variant = \"solid\", ...props },\n ref,\n) {\n const appearance = `${tone}-${variant}` as\n | \"neutral-solid\"\n | \"accent-solid\"\n | \"success-solid\"\n | \"warning-solid\"\n | \"danger-solid\"\n | \"neutral-soft\"\n | \"accent-soft\"\n | \"success-soft\"\n | \"warning-soft\"\n | \"danger-soft\"\n | \"neutral-outline\"\n | \"accent-outline\"\n | \"success-outline\"\n | \"warning-outline\"\n | \"danger-outline\"\n | \"custom-solid\"\n | \"custom-soft\"\n | \"custom-outline\";\n\n return (\n <span\n {...props}\n ref={ref}\n className={cx(badge({ tone: appearance }), className)}\n data-jaci-component=\"badge\"\n data-jaci-tone={tone}\n data-slot=\"badge\"\n data-variant={variant}\n />\n );\n});\n"],"mappings":";;;;;AAYA,MAAa,SAAA,GAAQA,MAAAA,WAAAA,CAAwC,SAAS,MACpE,EAAE,WAAW,OAAO,WAAW,UAAU,SAAS,GAAG,SACrD,KACA;CACA,MAAM,aAAa,GAAG,KAAK,GAAG;CAoB9B,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGC,cAAAA,MAAM,EAAE,MAAM,WAAW,CAAC,GAAG,SAAS;EACpD,uBAAoB;EACpB,kBAAgB;EAChB,aAAU;EACV,gBAAc;CACf,CAAA;AAEL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"field.cjs","names":["JaciFormContext","field","BaseField","cx"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,gBAAA,GAAA,MAAA,cAAA,CAAgD;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,SAAS,KAAA;CACT,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,SAAS,KAAA;CACT,MAAM,KAAA;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,CAAC;AAED,SAAS,gBAAgB,QAA0D;CACjF,IAAI,WAAW,KAAA,KAAa,WAAW,QAAQ,WAAW,OACxD,OAAO,CAAC;CAGV,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAEA,SAAS,aAAa,QAAqB;CACzC,IAAI,OAAO,UAAU,GACnB,OAAO,OAAO;CAGhB,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD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;CAEP;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,MAAU,OAAX;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGF,cAAAA,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;EACjD,aAAU;EACV,IAAI,MAAM,MAAM;EAChB,OAAO,UAAU,UAAU,OAAO,KAAA;EAClC,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD,CAAI,CAAA;EACZ,MAAK;YAEJ;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,QAAA,GAAA,MAAA,WAAA,CAAkB,YAAY;AAChC;AAEA,MAAa,QAAQ,OAAO,OAAO,WAAW;CAC5C,MAAM;CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
1
+ {"version":3,"file":"field.cjs","names":["createContext","forwardRef","useId","useState","useRef","useContext","JaciFormContext","useCallback","field","BaseField","cx"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: unknown): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors as ReactNode];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,gBAAA,GAAeA,MAAAA,cAAAA,CAAiC;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,SAAS,KAAA;CACT,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,SAAS,KAAA;CACT,MAAM,KAAA;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,CAAC;AAED,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CACzE,MAAM,UAAU,YAAY,aAAa,MAAM;CAE/C,IAAI,CAAC,aAAa;EAChB,IAAI,YAAY,KAAA,KAAa,YAAY,QAAQ,YAAY,OAC3D,OAAO;EAGT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;GACE,GAAI;GACC;GACL,WAAWK,WAAAA,GAAGF,cAAAA,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;GACjD,aAAU;GACV,IAAI,MAAM,MAAM;GAChB,MAAK;GAEJ,UAAA;EACA,CAAA;CAEP;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,MAAU,OAAX;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGF,cAAAA,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;EACjD,aAAU;EACV,IAAI,MAAM,MAAM;EAChB,OAAO,UAAU,UAAU,OAAO,KAAA;EAClC,QAAQ,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD,CAAI,CAAA;EACZ,MAAK;EAEJ,UAAA;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,QAAA,GAAOH,MAAAA,WAAAA,CAAW,YAAY;AAChC;AAEA,MAAa,QAAQ,OAAO,OAAO,WAAW;CAC5C,MAAM;CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","names":["FieldRoot","Field","BaseField"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: ReactNode | ReactNode[] | undefined): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,eAAe,cAAiC;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,SAAS,KAAA;CACT,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,SAAS,KAAA;CACT,MAAM,KAAA;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,CAAC;AAED,SAAS,gBAAgB,QAA0D;CACjF,IAAI,WAAW,KAAA,KAAa,WAAW,QAAQ,WAAW,OACxD,OAAO,CAAC;CAGV,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAEA,SAAS,aAAa,QAAqB;CACzC,IAAI,OAAO,UAAU,GACnB,OAAO,OAAO;CAGhB,OACE,oBAAC,MAAD,EAAA,UACG,OAAO,KAAK,OAAO,UAClB,oBAAC,MAAD,EAAA,UAAqD,MAAU,GAAtD,OAAO,UAAU,WAAW,QAAQ,KAAkB,CAChE,EACC,CAAA;AAER;AA+BA,MAAMA,cAAY,WAAuC,SAASC,QAChE,EACE,YACA,UACA,WACA,OACA,WAAW,OACX,QAAQ,cACR,SAAS,cAAc,OACvB,MACA,SAAS,cAAc,OACvB,SACA,UACA,wBACA,gBACA,GAAG,SAEL,KACA;CACA,MAAM,cAAc,MAAM;CAC1B,MAAM,YAAY,GAAG,YAAY;CACjC,MAAM,UAAU,GAAG,YAAY;CAC/B,MAAM,gBAAgB,GAAG,YAAY;CACrC,MAAM,UAAU,GAAG,YAAY;CAC/B,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,KAAK;CAChE,MAAM,CAAC,kBAAkB,uBAAuB,SAAsB,CAAC,CAAC;CACxE,MAAM,CAAC,iBAAiB,sBAAsB,SAAyB,IAAI;CAC3E,MAAM,qBAAqB,OAAO,CAAC;CACnC,MAAM,EAAE,QAAQ,eAAe,WAAW,eAAe;CACzD,MAA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,OAAO,SAAS;EACjD,aAAU;EACV,IAAI,MAAM,MAAM;EAChB,OAAO,UAAU,UAAU,OAAO,KAAA;EAClC,QAAQ,oBAAC,KAAD,CAAI,CAAA;EACZ,MAAK;YAEJ;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,OAAO,WAAW,YAAY;AAChC;AAEA,MAAaD,UAAQ,OAAO,OAAOD,aAAW;CAC5C,MAAMA;CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
1
+ {"version":3,"file":"field.js","names":["FieldRoot","Field","BaseField"],"sources":["../../../src/components/field/field.tsx"],"sourcesContent":["\"use client\";\n\nimport { Field as BaseField } from \"@base-ui/react/field\";\nimport { createContext, forwardRef, useCallback, useContext, useId, useRef, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport type { FieldRoot as BaseFieldRoot } from \"@base-ui/react/field\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { field } from \"../../styled-system/recipes\";\nimport { JaciFormContext } from \"../form\";\n\nexport type FieldValidationMode = \"onSubmit\" | \"onBlur\" | \"onChange\";\n\ninterface FieldContextValue {\n controlId: string | undefined;\n descriptionId: string | undefined;\n dirty: boolean;\n errorId: string | undefined;\n errors: ReactNode[];\n insideField: boolean;\n invalid: boolean;\n labelId: string | undefined;\n name: string | undefined;\n pending: boolean;\n touched: boolean;\n valid: boolean | null;\n}\n\nconst FieldContext = createContext<FieldContextValue>({\n controlId: undefined,\n descriptionId: undefined,\n dirty: false,\n errorId: undefined,\n errors: [],\n insideField: false,\n invalid: false,\n labelId: undefined,\n name: undefined,\n pending: false,\n touched: false,\n valid: null,\n});\n\nfunction normalizeErrors(errors: unknown): ReactNode[] {\n if (errors === undefined || errors === null || errors === false) {\n return [];\n }\n\n return Array.isArray(errors) ? errors : [errors as ReactNode];\n}\n\nfunction renderErrors(errors: ReactNode[]) {\n if (errors.length <= 1) {\n return errors[0];\n }\n\n return (\n <ul>\n {errors.map((error, index) => (\n <li key={typeof error === \"string\" ? error : index}>{error}</li>\n ))}\n </ul>\n );\n}\n\nexport interface FieldProps extends Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> {\n /** Marks the field invalid when an external validator owns its state. */\n invalid?: boolean;\n /** Field name used to resolve errors supplied to the parent Form. */\n name?: string;\n /** Direct error content, useful outside a Form or with custom validation. */\n errors?: ReactNode | ReactNode[];\n /** Disables the field and its Base UI validation state. */\n disabled?: boolean;\n /** Native/Base UI validation callback. */\n validate?: BaseFieldRoot.Props[\"validate\"];\n /** Validation timing used by the parent Form. */\n validationMode?: FieldValidationMode;\n /** Debounce duration for `validationMode=\"onChange\"`. */\n validationDebounceTime?: number;\n /** Controlled dirty/touched state for integrations with external form state. */\n dirty?: boolean;\n touched?: boolean;\n /** Marks the field as awaiting asynchronous validation. */\n pending?: boolean;\n /** Imperative field validation actions. */\n actionsRef?: BaseFieldRoot.Props[\"actionsRef\"];\n children?: ReactNode;\n}\n\nexport interface FieldLabelProps extends ComponentPropsWithoutRef<\"label\"> {\n htmlFor?: string;\n}\n\nconst FieldRoot = forwardRef<HTMLDivElement, FieldProps>(function Field(\n {\n actionsRef,\n children,\n className,\n dirty,\n disabled = false,\n errors: directErrors,\n invalid: invalidProp = false,\n name,\n pending: pendingProp = false,\n touched,\n validate,\n validationDebounceTime,\n validationMode,\n ...props\n },\n ref,\n) {\n const generatedId = useId();\n const controlId = `${generatedId}-control`;\n const labelId = `${generatedId}-label`;\n const descriptionId = `${generatedId}-description`;\n const errorId = `${generatedId}-error`;\n const [pendingValidation, setPendingValidation] = useState(false);\n const [validationErrors, setValidationErrors] = useState<ReactNode[]>([]);\n const [validationValid, setValidationValid] = useState<boolean | null>(null);\n const validationSequence = useRef(0);\n const { errors: formErrors } = useContext(JaciFormContext);\n const formError = name ? formErrors[name] : undefined;\n const externalErrors =\n directErrors === undefined ? normalizeErrors(formError) : normalizeErrors(directErrors);\n const errors =\n directErrors !== undefined || formError !== undefined ? externalErrors : validationErrors;\n const invalid = invalidProp || errors.length > 0;\n const pending = pendingProp || pendingValidation;\n const wrappedValidate = useCallback<NonNullable<BaseFieldRoot.Props[\"validate\"]>>(\n (value, formValues) => {\n const sequence = ++validationSequence.current;\n if (!validate) return null;\n const result = validate(value, formValues);\n if (!result || typeof result !== \"object\" || !(\"then\" in result)) {\n const resultErrors = normalizeErrors(result);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n setPendingValidation(false);\n return result;\n }\n setValidationErrors([]);\n setValidationValid(null);\n setPendingValidation(true);\n return Promise.resolve(result)\n .then((validationResult) => {\n if (sequence !== validationSequence.current) return null;\n const resultErrors = normalizeErrors(validationResult);\n setValidationErrors(resultErrors);\n setValidationValid(resultErrors.length === 0);\n return validationResult;\n })\n .finally(() => {\n if (sequence === validationSequence.current) setPendingValidation(false);\n });\n },\n [validate],\n );\n const styles = field({ invalid });\n\n return (\n <FieldContext.Provider\n value={{\n controlId,\n descriptionId,\n dirty: dirty ?? false,\n errorId,\n errors,\n insideField: true,\n invalid,\n labelId,\n name,\n pending,\n touched: touched ?? false,\n valid: invalid ? false : validationValid,\n }}\n >\n <BaseField.Root\n {...props}\n ref={ref}\n actionsRef={actionsRef}\n className={cx(styles.root, className)}\n aria-busy={pending || undefined}\n data-dirty={dirty || undefined}\n data-invalid={invalid || undefined}\n data-jaci-component=\"field\"\n data-pending={pending || undefined}\n data-slot=\"field\"\n data-touched={touched || undefined}\n disabled={disabled}\n dirty={dirty}\n invalid={invalid}\n name={name}\n touched={touched}\n {...(validate ? { validate: wrappedValidate } : {})}\n validationDebounceTime={validationDebounceTime}\n validationMode={validationMode}\n >\n {children}\n </BaseField.Root>\n </FieldContext.Provider>\n );\n});\n\nexport interface FieldControlProps extends ComponentPropsWithoutRef<typeof BaseField.Control> {}\n\nexport const FieldControl = forwardRef<HTMLElement, FieldControlProps>(function FieldControl(\n {\n \"aria-describedby\": ariaDescribedBy,\n \"aria-errormessage\": ariaErrorMessage,\n \"aria-invalid\": ariaInvalid,\n \"aria-labelledby\": ariaLabelledBy,\n className,\n id,\n ...props\n },\n ref,\n) {\n const { controlId, descriptionId, errorId, invalid, labelId, pending, insideField } =\n useContext(FieldContext);\n const describedBy =\n [ariaDescribedBy, descriptionId, invalid ? errorId : undefined].filter(Boolean).join(\" \") ||\n undefined;\n const labelledBy = [ariaLabelledBy, labelId].filter(Boolean).join(\" \") || undefined;\n const controlProps = {\n ...props,\n \"aria-busy\": pending || undefined,\n \"aria-describedby\": describedBy,\n \"aria-errormessage\": ariaErrorMessage ?? (invalid ? errorId : undefined),\n \"aria-invalid\": ariaInvalid ?? (invalid || undefined),\n \"aria-labelledby\": labelledBy,\n className,\n \"data-pending\": pending || undefined,\n id: id ?? controlId,\n };\n if (!insideField) return <BaseField.Control {...controlProps} ref={ref} />;\n return <BaseField.Control {...controlProps} ref={ref} />;\n});\n\nexport const FieldLabel = forwardRef<HTMLLabelElement, FieldLabelProps>(function FieldLabel(\n { children, className, htmlFor, ...props },\n ref,\n) {\n const { controlId, insideField, invalid, labelId } = useContext(FieldContext);\n\n const labelProps = {\n ...props,\n className: cx(field({ invalid }).label, className),\n \"data-slot\": \"field-label\",\n htmlFor: htmlFor ?? controlId,\n id: props.id ?? labelId,\n };\n\n if (!insideField) {\n return (\n <label {...labelProps} ref={ref} htmlFor={htmlFor ?? controlId}>\n {children}\n </label>\n );\n }\n\n return (\n <BaseField.Label {...labelProps} ref={ref as Ref<HTMLElement>}>\n {children}\n </BaseField.Label>\n );\n});\n\nexport const FieldDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldDescription({ className, ...props }, ref) {\n const { descriptionId, insideField, invalid } = useContext(FieldContext);\n const descriptionProps = {\n ...props,\n className: cx(field({ invalid }).description, className),\n \"data-slot\": \"field-description\",\n id: props.id ?? descriptionId,\n };\n\n if (!insideField) {\n return <p {...descriptionProps} ref={ref} />;\n }\n\n return <BaseField.Description {...descriptionProps} ref={ref} />;\n },\n);\n\nexport interface FieldErrorProps extends Omit<ComponentPropsWithoutRef<\"p\">, \"children\"> {\n children?: ReactNode;\n match?: boolean | keyof ValidityState;\n}\n\nexport const FieldError = forwardRef<HTMLParagraphElement, FieldErrorProps>(function FieldError(\n { children, className, match, ...props },\n ref,\n) {\n const { errorId, errors, insideField, invalid } = useContext(FieldContext);\n const content = children ?? renderErrors(errors);\n\n if (!insideField) {\n if (content === undefined || content === null || content === false) {\n return null;\n }\n\n return (\n <p\n {...props}\n ref={ref}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n role=\"alert\"\n >\n {content}\n </p>\n );\n }\n\n return (\n <BaseField.Error\n {...props}\n ref={ref as Ref<HTMLDivElement>}\n className={cx(field({ invalid }).error, className)}\n data-slot=\"field-error\"\n id={props.id ?? errorId}\n match={match ?? (invalid ? true : undefined)}\n render={<p />}\n role=\"alert\"\n >\n {content}\n </BaseField.Error>\n );\n});\n\nexport function useFieldState() {\n return useContext(FieldContext);\n}\n\nexport const Field = Object.assign(FieldRoot, {\n Root: FieldRoot,\n Control: FieldControl,\n Label: FieldLabel,\n Description: FieldDescription,\n Error: FieldError,\n});\n"],"mappings":";;;;;;;;AA4BA,MAAM,eAAe,cAAiC;CACpD,WAAW,KAAA;CACX,eAAe,KAAA;CACf,OAAO;CACP,SAAS,KAAA;CACT,QAAQ,CAAC;CACT,aAAa;CACb,SAAS;CACT,SAAS,KAAA;CACT,MAAM,KAAA;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT,CAAC;AAED,SAAS,gBAAgB,QAA8B;CACrD,IAAI,WAAW,KAAA,KAAa,WAAW,QAAQ,WAAW,OACxD,OAAO,CAAC;CAGV,OAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAmB;AAC9D;AAEA,SAAS,aAAa,QAAqB;CACzC,IAAI,OAAO,UAAU,GACnB,OAAO,OAAO;CAGhB,OACE,oBAAC,MAAD,EAAA,UACG,OAAO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,CAAC,aACH,OAAO,oBAAC,KAAD;EAAG,GAAI;EAAuB;CAAM,CAAA;CAG7C,OAAO,oBAACA,MAAU,aAAX;EAAuB,GAAI;EAAuB;CAAM,CAAA;AACjE,CACF;AAOA,MAAa,aAAa,WAAkD,SAAS,WACnF,EAAE,UAAU,WAAW,OAAO,GAAG,SACjC,KACA;CACA,MAAM,EAAE,SAAS,QAAQ,aAAa,YAAY,WAAW,YAAY;CACzE,MAAM,UAAU,YAAY,aAAa,MAAM;CAE/C,IAAI,CAAC,aAAa;EAChB,IAAI,YAAY,KAAA,KAAa,YAAY,QAAQ,YAAY,OAC3D,OAAO;EAGT,OACE,oBAAC,KAAD;GACE,GAAI;GACC;GACL,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;GACjD,aAAU;GACV,IAAI,MAAM,MAAM;GAChB,MAAK;GAEJ,UAAA;EACA,CAAA;CAEP;CAEA,OACE,oBAACA,MAAU,OAAX;EACE,GAAI;EACC;EACL,WAAW,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,SAAS;EACjD,aAAU;EACV,IAAI,MAAM,MAAM;EAChB,OAAO,UAAU,UAAU,OAAO,KAAA;EAClC,QAAQ,oBAAC,KAAD,CAAI,CAAA;EACZ,MAAK;EAEJ,UAAA;CACc,CAAA;AAErB,CAAC;AAED,SAAgB,gBAAgB;CAC9B,OAAO,WAAW,YAAY;AAChC;AAEA,MAAaD,UAAQ,OAAO,OAAOD,aAAW;CAC5C,MAAMA;CACN,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;AACT,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fieldset.cjs","names":["fieldset","BaseFieldset","cx"],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fieldset as BaseFieldset } from \"@base-ui/react/fieldset\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { fieldset } from \"../../styled-system/recipes\";\n\nexport interface FieldsetRootProps extends ComponentPropsWithoutRef<\"fieldset\"> {\n children?: ReactNode;\n}\n\nexport const FieldsetRoot = forwardRef<HTMLFieldSetElement, FieldsetRootProps>(\n function FieldsetRoot({ children, className, disabled = false, ...props }, ref) {\n const styles = fieldset({ disabled });\n\n return (\n <BaseFieldset.Root\n {...props}\n ref={ref as Ref<HTMLElement>}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"fieldset\"\n data-slot=\"fieldset\"\n disabled={disabled}\n >\n {children}\n </BaseFieldset.Root>\n );\n },\n);\n\nexport type FieldsetLegendProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const FieldsetLegend = forwardRef<HTMLDivElement, FieldsetLegendProps>(\n function FieldsetLegend({ className, ...props }, ref) {\n return (\n <BaseFieldset.Legend\n {...props}\n ref={ref}\n className={cx(fieldset().legend, className)}\n data-slot=\"fieldset-legend\"\n />\n );\n },\n);\n\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldsetDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(fieldset().description, className)}\n data-slot=\"fieldset-description\"\n />\n );\n },\n);\n\nexport const Fieldset = {\n Root: FieldsetRoot,\n Legend: FieldsetLegend,\n Description: FieldsetDescription,\n};\n"],"mappings":";;;;;;;AAaA,MAAa,gBAAA,GAAA,MAAA,WAAA,CACX,SAAS,aAAa,EAAE,UAAU,WAAW,WAAW,OAAO,GAAG,SAAS,KAAK;CAC9E,MAAM,SAASA,iBAAAA,SAAS,EAAE,SAAS,CAAC;CAEpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAa,MAAd;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,iBAAe,YAAY,KAAA;EAC3B,uBAAoB;EACpB,aAAU;EACA;EAET;CACgB,CAAA;AAEvB,CACF;AAIA,MAAa,kBAAA,GAAA,MAAA,WAAA,CACX,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACD,wBAAAA,SAAa,QAAd;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGF,iBAAAA,SAAS,CAAC,CAAC,QAAQ,SAAS;EAC1C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,uBAAA,GAAA,MAAA,WAAA,CACX,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAS,KAAK;CACzD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EACE,GAAI;EACC;EACL,WAAWE,WAAAA,GAAGF,iBAAAA,SAAS,CAAC,CAAC,aAAa,SAAS;EAC/C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,WAAW;CACtB,MAAM;CACN,QAAQ;CACR,aAAa;AACf"}
1
+ {"version":3,"file":"fieldset.cjs","names":["forwardRef","fieldset","BaseFieldset","cx"],"sources":["../../../src/components/fieldset/fieldset.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fieldset as BaseFieldset } from \"@base-ui/react/fieldset\";\nimport { forwardRef } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { fieldset } from \"../../styled-system/recipes\";\n\nexport interface FieldsetRootProps extends ComponentPropsWithoutRef<\"fieldset\"> {\n children?: ReactNode;\n}\n\nexport const FieldsetRoot = forwardRef<HTMLFieldSetElement, FieldsetRootProps>(\n function FieldsetRoot({ children, className, disabled = false, ...props }, ref) {\n const styles = fieldset({ disabled });\n\n return (\n <BaseFieldset.Root\n {...props}\n ref={ref as Ref<HTMLElement>}\n className={cx(styles.root, className)}\n data-disabled={disabled || undefined}\n data-jaci-component=\"fieldset\"\n data-slot=\"fieldset\"\n disabled={disabled}\n >\n {children}\n </BaseFieldset.Root>\n );\n },\n);\n\nexport type FieldsetLegendProps = ComponentPropsWithoutRef<\"div\">;\n\nexport const FieldsetLegend = forwardRef<HTMLDivElement, FieldsetLegendProps>(\n function FieldsetLegend({ className, ...props }, ref) {\n return (\n <BaseFieldset.Legend\n {...props}\n ref={ref}\n className={cx(fieldset().legend, className)}\n data-slot=\"fieldset-legend\"\n />\n );\n },\n);\n\nexport const FieldsetDescription = forwardRef<HTMLParagraphElement, ComponentPropsWithoutRef<\"p\">>(\n function FieldsetDescription({ className, ...props }, ref) {\n return (\n <p\n {...props}\n ref={ref}\n className={cx(fieldset().description, className)}\n data-slot=\"fieldset-description\"\n />\n );\n },\n);\n\nexport const Fieldset = {\n Root: FieldsetRoot,\n Legend: FieldsetLegend,\n Description: FieldsetDescription,\n};\n"],"mappings":";;;;;;;AAaA,MAAa,gBAAA,GAAeA,MAAAA,WAAAA,CAC1B,SAAS,aAAa,EAAE,UAAU,WAAW,WAAW,OAAO,GAAG,SAAS,KAAK;CAC9E,MAAM,SAASC,iBAAAA,SAAS,EAAE,SAAS,CAAC;CAEpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,wBAAAA,SAAa,MAAd;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,MAAM,SAAS;EACpC,iBAAe,YAAY,KAAA;EAC3B,uBAAoB;EACpB,aAAU;EACA;EAET;CACgB,CAAA;AAEvB,CACF;AAIA,MAAa,kBAAA,GAAiBH,MAAAA,WAAAA,CAC5B,SAAS,eAAe,EAAE,WAAW,GAAG,SAAS,KAAK;CACpD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACE,wBAAAA,SAAa,QAAd;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAGF,iBAAAA,SAAS,CAAC,CAAC,QAAQ,SAAS;EAC1C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,uBAAA,GAAsBD,MAAAA,WAAAA,CACjC,SAAS,oBAAoB,EAAE,WAAW,GAAG,SAAS,KAAK;CACzD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;EACE,GAAI;EACC;EACL,WAAWG,WAAAA,GAAGF,iBAAAA,SAAS,CAAC,CAAC,aAAa,SAAS;EAC/C,aAAU;CACX,CAAA;AAEL,CACF;AAEA,MAAa,WAAW;CACtB,MAAM;CACN,QAAQ;CACR,aAAa;AACf"}
@@ -1 +1 @@
1
- {"version":3,"file":"figure.cjs","names":["Image","cx","BaseDialog","Children","figureStyles","useThemePortalProps"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\n Root: FigureRoot,\n Image: FigureImage,\n Caption: FigureCaption,\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAM,iBAAA,GAAA,MAAA,cAAA,CAAyD,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,SAAA,GAAA,MAAA,WAAA,CAAmB,aAAa;CACtC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;AAIA,MAAa,eAAA,GAAA,MAAA,WAAA,CAA6D,SAAS,YACjF,EAAE,WAAW,UAAU,WAAW,GAAG,SACrC,KACA;CACA,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAC9C,MAAM,UACJ,iBAAA,GAAA,kBAAA,IAAA,CAACA,cAAAA,OAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,OAAO,SAAS;EACrC,aAAU;EACV,UAAU;CACX,CAAA;CAGH,IAAI,CAAC,UACH,OAAO;CAGT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,OAAW,SAAZ;EACE,cAAW;EACX,WAAW,OAA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["createContext","useContext","forwardRef","Image","cx","BaseDialog","Children","isValidElement","figureStyles","useThemePortalProps"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\n Root: FigureRoot,\n Image: FigureImage,\n Caption: FigureCaption,\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAM,iBAAA,GAAgBA,MAAAA,cAAAA,CAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,SAAA,GAAQC,MAAAA,WAAAA,CAAW,aAAa;CACtC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;AAIA,MAAa,eAAA,GAAcC,MAAAA,WAAAA,CAA+C,SAAS,YACjF,EAAE,WAAW,UAAU,WAAW,GAAG,SACrC,KACA;CACA,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAC9C,MAAM,UACJ,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,OAAD;EACE,GAAI;EACC;EACL,WAAWC,WAAAA,GAAG,OAAO,OAAO,SAAS;EACrC,aAAU;EACV,UAAU;CACX,CAAA;CAGH,IAAI,CAAC,UACH,OAAO;CAGT,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,OAAW,SAAZ;EACE,cAAW;EACX,WAAW,OAAO;EAClB,uBAAoB;EACpB,aAAU;EAET,UAAA;CACiB,CAAA;AAExB,CAAC;AAID,MAAa,iBAAA,GAAgBH,MAAAA,WAAAA,CAA4C,SAAS,cAChF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;EACE,GAAI;EACC;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OAAW,QAAZ;IAAmB,GAAI;IAAvB,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,UAAZ;KAAqB,WAAW,OAAO;KAAU,aAAU;IAA4B,CAAA,GACvF,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,UAAZ;KAAqB,WAAW,OAAO;KAAU,aAAU;KACzD,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACA,sBAAAA,OAAW,OAAZ;MACE,cAAY,OAAO;MACnB,WAAW,OAAO;MAClB,uBAAoB;MACpB,aAAU;MAJZ,UAAA;OAME,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,OAAZ;QAAkB,WAAW,OAAO;QAAQ,UAAA,OAAO;OAAkC,CAAA;OACrF,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;QAAK,WAAW,OAAO;QAAU,aAAU;QACzC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACA,sBAAAA,OAAW,OAAZ;SACE,cAAY;SACZ,WAAW,OAAO;SAClB,aAAU;SACX,UAAA;QAEiB,CAAA;OACf,CAAA;OACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;QACO;QACL,WAAW,OAAO;QAClB,aAAU;QACL;OACN,CAAA;OACA,UACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,cAAD;QAAY,WAAW,OAAO;QAAiB,aAAU;QACtD,UAAA,QAAQ,MAAM;OACL,CAAA,IACV;MACY;;IACC,CAAA,CACJ;GACJ,CAAA,CAAA;;CACK,CAAA;AAE5B,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,OAAO;CACP,SAAS;AACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"figure.js","names":["BaseDialog","figureStyles"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\n Root: FigureRoot,\n Image: FigureImage,\n Caption: FigureCaption,\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,QAAQ,WAAW,aAAa;CACtC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;AAIA,MAAa,cAAc,WAA+C,SAAS,YACjF,EAAE,WAAW,UAAU,WAAW,GAAG,SACrC,KACA;CACA,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAC9C,MAAM,UACJ,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,OAAO,OAAO,SAAS;EACrC,aAAU;EACV,UAAU;CACX,CAAA;CAGH,IAAI,CAAC,UACH,OAAO;CAGT,OACE,oBAACA,OAAW,SAAZ;EACE,cAAW;EACX,WAAW,OAAO;EAClB,uBAAoB;EACpB,aAAU;YAET;CACiB,CAAA;AAExB,CAAC;AAID,MAAa,gBAAgB,WAA4C,SAAS,cAChF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,oBAAC,cAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,OAAO,SAAS,SAAS;EACvC,aAAU;CACX,CAAA;AAEL,CAAC;AAUD,SAAS,UAAa,UAAqB,WAAgD;CAIzF,OAHc,SAAS,QAAQ,QAAQ,CAAC,CAAC,MACtC,SAAS,eAAe,IAAI,KAAK,KAAK,SAAS,SAEtC,KAAqC;AACnD;AAEA,MAAa,aAAa,WAAyC,SAAS,WAC1E,EACE,UACA,WACA,aAAa,eACb,aACA,WAAW,OACX,cACA,MACA,GAAG,SAEL,KACA;CACA,MAAM,SAASC,OAAa;CAC5B,MAAM,QAAQ,UAA4B,UAAU,WAAW;CAC/D,MAAM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;;IACC,CAAA,CACJ;KACJ;;CACK,CAAA;AAE5B,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,OAAO;CACP,SAAS;AACX"}
1
+ {"version":3,"file":"figure.js","names":["BaseDialog","figureStyles"],"sources":["../../../src/components/figure/figure.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { Children, createContext, forwardRef, isValidElement, useContext } from \"react\";\nimport type { ComponentPropsWithoutRef, ElementType, ReactElement, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { figure as figureStyles } from \"../../styled-system/recipes\";\nimport { Image } from \"../image\";\nimport type { ImageProps } from \"../image\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\ninterface FigureContextValue {\n lightbox: boolean;\n styles: ReturnType<typeof figureStyles>;\n}\n\nconst FigureContext = createContext<FigureContextValue | null>(null);\n\nfunction useFigureContext() {\n const value = useContext(FigureContext);\n if (!value) {\n throw new Error(\"Figure parts must be rendered inside Figure.Root.\");\n }\n return value;\n}\n\nexport type FigureImageProps = ImageProps;\n\nexport const FigureImage = forwardRef<HTMLImageElement, FigureImageProps>(function FigureImage(\n { className, lightbox: _lightbox, ...props },\n ref,\n) {\n const { lightbox, styles } = useFigureContext();\n const content = (\n <Image\n {...props}\n ref={ref}\n className={cx(styles.image, className)}\n data-slot=\"figure-image\"\n lightbox={false}\n />\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Trigger\n aria-label=\"Open image\"\n className={styles.trigger}\n data-jaci-component=\"figure-trigger\"\n data-slot=\"figure-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n );\n});\n\nexport type FigureCaptionProps = ComponentPropsWithoutRef<\"figcaption\">;\n\nexport const FigureCaption = forwardRef<HTMLElement, FigureCaptionProps>(function FigureCaption(\n { className, ...props },\n ref,\n) {\n const { styles } = useFigureContext();\n return (\n <figcaption\n {...props}\n ref={ref}\n className={cx(styles.caption, className)}\n data-slot=\"figure-caption\"\n />\n );\n});\n\nexport interface FigureRootProps extends ComponentPropsWithoutRef<\"figure\"> {\n lightbox?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n closeLabel?: string;\n}\n\nfunction findChild<T>(children: ReactNode, component: ElementType): ReactElement<T> | null {\n const child = Children.toArray(children).find(\n (item) => isValidElement(item) && item.type === component,\n );\n return (child as ReactElement<T> | undefined) ?? null;\n}\n\nexport const FigureRoot = forwardRef<HTMLElement, FigureRootProps>(function FigureRoot(\n {\n children,\n className,\n closeLabel = \"Close image\",\n defaultOpen,\n lightbox = false,\n onOpenChange,\n open,\n ...props\n },\n ref,\n) {\n const styles = figureStyles();\n const media = findChild<FigureImageProps>(children, FigureImage);\n const caption = findChild<FigureCaptionProps>(children, FigureCaption);\n const canOpen = Boolean(lightbox && media?.props.src);\n const content = (\n <figure\n {...props}\n ref={ref}\n className={cx(styles.root, className)}\n data-jaci-component=\"figure\"\n data-lightbox={canOpen || undefined}\n data-slot=\"figure\"\n >\n {children}\n </figure>\n );\n\n const value = { lightbox: canOpen, styles };\n const scopedPortalProps = useThemePortalProps({});\n\n if (!canOpen || !media) {\n return <FigureContext.Provider value={value}>{content}</FigureContext.Provider>;\n }\n\n const alt = media.props.alt;\n const src = media.props.src;\n\n return (\n <FigureContext.Provider value={value}>\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n {content}\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"figure-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"figure-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || \"Image preview\"}\n className={styles.popup}\n data-jaci-component=\"figure-lightbox\"\n data-slot=\"figure-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || \"Image preview\"}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"figure-lightbox-close-row\">\n <BaseDialog.Close\n aria-label={closeLabel}\n className={styles.close}\n data-slot=\"figure-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"figure-lightbox-image\"\n src={src}\n />\n {caption ? (\n <figcaption className={styles.lightboxCaption} data-slot=\"figure-lightbox-caption\">\n {caption.props.children}\n </figcaption>\n ) : null}\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n </FigureContext.Provider>\n );\n});\n\nexport const Figure = {\n Root: FigureRoot,\n Image: FigureImage,\n Caption: FigureCaption,\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,mBAAmB;CAC1B,MAAM,QAAQ,WAAW,aAAa;CACtC,IAAI,CAAC,OACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;AAIA,MAAa,cAAc,WAA+C,SAAS,YACjF,EAAE,WAAW,UAAU,WAAW,GAAG,SACrC,KACA;CACA,MAAM,EAAE,UAAU,WAAW,iBAAiB;CAC9C,MAAM,UACJ,oBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,OAAO,OAAO,SAAS;EACrC,aAAU;EACV,UAAU;CACX,CAAA;CAGH,IAAI,CAAC,UACH,OAAO;CAGT,OACE,oBAACA,OAAW,SAAZ;EACE,cAAW;EACX,WAAW,OAAO;EAClB,uBAAoB;EACpB,aAAU;EAET,UAAA;CACiB,CAAA;AAExB,CAAC;AAID,MAAa,gBAAgB,WAA4C,SAAS,cAChF,EAAE,WAAW,GAAG,SAChB,KACA;CACA,MAAM,EAAE,WAAW,iBAAiB;CACpC,OACE,oBAAC,cAAD;EACE,GAAI;EACC;EACL,WAAW,GAAG,OAAO,SAAS,SAAS;EACvC,aAAU;CACX,CAAA;AAEL,CAAC;AAUD,SAAS,UAAa,UAAqB,WA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AAA,OAAO;OAAkC,CAAA;OACrF,oBAAC,OAAD;QAAK,WAAW,OAAO;QAAU,aAAU;QACzC,UAAA,oBAACA,OAAW,OAAZ;SACE,cAAY;SACZ,WAAW,OAAO;SAClB,aAAU;SACX,UAAA;QAEiB,CAAA;OACf,CAAA;OACL,oBAAC,OAAD;QACO;QACL,WAAW,OAAO;QAClB,aAAU;QACL;OACN,CAAA;OACA,UACC,oBAAC,cAAD;QAAY,WAAW,OAAO;QAAiB,aAAU;QACtD,UAAA,QAAQ,MAAM;OACL,CAAA,IACV;MACY;;IACC,CAAA,CACJ;GACJ,CAAA,CAAA;;CACK,CAAA;AAE5B,CAAC;AAED,MAAa,SAAS;CACpB,MAAM;CACN,OAAO;CACP,SAAS;AACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"form.cjs","names":["BaseForm","cx","form"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,mBAAA,GAAA,MAAA,cAAA,CAAsD,EAAE,QAAQ,CAAC,EAAE,CAAC;AA8BjF,MAAa,QApBP,GAAA,MAAA,WAAA,CAAkD,SAAS,KAC/D,EAAE,UAAU,WAAW,QAAQ,GAAG,SAClC,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAgB,UAAjB;EAA0B,OAAO,EAAE,QAAQ,UAAU,CAAC,EAAE;YACtD,iBAAA,GAAA,kBAAA,IAAA,CAACA,oBAAAA,MAAD;GACE,GAAI;GACC;GACL,WAAWC,WAAAA,GAAGC,aAAAA,KAAK,GAAG,SAAS;GAC/B,uBAAoB;GACpB,aAAU;GACF;GAEP;EACO,CAAA;CACc,CAAA;AAE9B,CAEoB"}
1
+ {"version":3,"file":"form.cjs","names":["createContext","forwardRef","BaseForm","cx","form"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,mBAAA,GAAkBA,MAAAA,cAAAA,CAAoC,EAAE,QAAQ,CAAC,EAAE,CAAC;AA8BjF,MAAa,QApBP,GAAWC,MAAAA,WAAAA,CAAuC,SAAS,KAC/D,EAAE,UAAU,WAAW,QAAQ,GAAG,SAClC,KACA;CACA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,gBAAgB,UAAjB;EAA0B,OAAO,EAAE,QAAQ,UAAU,CAAC,EAAE;EACtD,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,MAAD;GACE,GAAI;GACC;GACL,WAAWC,WAAAA,GAAGC,aAAAA,KAAK,GAAG,SAAS;GAC/B,uBAAoB;GACpB,aAAU;GACF;GAEP;EACO,CAAA;CACc,CAAA;AAE9B,CAEoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"form.js","names":["Form","BaseForm"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,kBAAkB,cAAoC,EAAE,QAAQ,CAAC,EAAE,CAAC;AA8BjF,MAAaA,SApBI,WAAuC,SAASA,OAC/D,EAAE,UAAU,WAAW,QAAQ,GAAG,SAClC,KACA;CACA,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO,EAAE,QAAQ,UAAU,CAAC,EAAE;YACtD,oBAACC,MAAD;GACE,GAAI;GACC;GACL,WAAW,GAAG,KAAK,GAAG,SAAS;GAC/B,uBAAoB;GACpB,aAAU;GACF;GAEP;EACO,CAAA;CACc,CAAA;AAE9B,CAEoB"}
1
+ {"version":3,"file":"form.js","names":["Form","BaseForm"],"sources":["../../../src/components/form/form.tsx"],"sourcesContent":["\"use client\";\n\nimport { Form as BaseForm } from \"@base-ui/react/form\";\nimport { createContext, forwardRef } from \"react\";\nimport type { ReactElement, ReactNode, RefAttributes } from \"react\";\nimport type { FormProps as BaseFormProps } from \"@base-ui/react/form\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { form } from \"../../styled-system/recipes\";\n\nexport type FormErrors = Record<string, string | string[]>;\n\ninterface JaciFormContextValue {\n errors: FormErrors;\n}\n\nexport const JaciFormContext = createContext<JaciFormContextValue>({ errors: {} });\n\nexport interface FormProps<FormValues extends Record<string, unknown> = Record<string, unknown>>\n extends Omit<BaseFormProps<FormValues>, \"children\" | \"errors\" | \"className\"> {\n className?: string;\n /** External errors keyed by each field's `name`. */\n errors?: FormErrors;\n children?: ReactNode;\n}\n\nconst FormRoot = forwardRef<HTMLFormElement, FormProps>(function Form(\n { children, className, errors, ...props },\n ref,\n) {\n return (\n <JaciFormContext.Provider value={{ errors: errors ?? {} }}>\n <BaseForm\n {...props}\n ref={ref}\n className={cx(form(), className)}\n data-jaci-component=\"form\"\n data-slot=\"form\"\n errors={errors}\n >\n {children}\n </BaseForm>\n </JaciFormContext.Provider>\n );\n});\n\nexport const Form = FormRoot as <\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: FormProps<FormValues> & RefAttributes<HTMLFormElement>,\n) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,MAAa,kBAAkB,cAAoC,EAAE,QAAQ,CAAC,EAAE,CAAC;AA8BjF,MAAaA,SApBI,WAAuC,SAASA,OAC/D,EAAE,UAAU,WAAW,QAAQ,GAAG,SAClC,KACA;CACA,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO,EAAE,QAAQ,UAAU,CAAC,EAAE;EACtD,UAAA,oBAACC,MAAD;GACE,GAAI;GACC;GACL,WAAW,GAAG,KAAK,GAAG,SAAS;GAC/B,uBAAoB;GACpB,aAAU;GACF;GAEP;EACO,CAAA;CACc,CAAA;AAE9B,CAEoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.cjs","names":["Children","cx","iconButton","Spinner"],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAOA,MAAAA,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,EAAA,GAAA,MAAA,eAAA,CAAgB,KAAK,GAAG,OAAO;EACnC,OAAO,kBAAmB,MAAM,MAAmC,QAAQ;CAC7E,CAAC;AACH;AAEA,MAAa,cAAA,GAAA,MAAA,WAAA,CAA4D,SAAS,WAChF,EAAE,UAAU,WAAW,UAAU,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SACvF,KACA;CACA,IAAI,CAAC,kBAAkB,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,oBACjE,MAAM,IAAI,MAAM,mEAAmE;CAGrF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EACE,GAAI;EACC;EACL,aAAW,WAAW,KAAA;EACtB,WAAWC,WAAAA,GAAGC,oBAAAA,WAAW;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACtD,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,MAAM,QAAQ;YAEnB,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,SAAD;GAAS,eAAY;GAAO,OAAM;GAAG,MAAK;EAAM,CAAA,IAAI;CACzD,CAAA;AAEZ,CAAC"}
1
+ {"version":3,"file":"icon-button.cjs","names":["Children","isValidElement","forwardRef","cx","iconButton","Spinner"],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAOA,MAAAA,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,EAAA,GAACC,MAAAA,eAAAA,CAAe,KAAK,GAAG,OAAO;EACnC,OAAO,kBAAmB,MAAM,MAAmC,QAAQ;CAC7E,CAAC;AACH;AAEA,MAAa,cAAA,GAAaC,MAAAA,WAAAA,CAA+C,SAAS,WAChF,EAAE,UAAU,WAAW,UAAU,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SACvF,KACA;CACA,IAAI,CAAC,kBAAkB,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,oBACjE,MAAM,IAAI,MAAM,mEAAmE;CAGrF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;EACE,GAAI;EACC;EACL,aAAW,WAAW,KAAA;EACtB,WAAWC,WAAAA,GAAGC,oBAAAA,WAAW;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACtD,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,MAAM,QAAQ;EAEnB,UAAA,UAAU,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,SAAD;GAAS,eAAY;GAAO,OAAM;GAAG,MAAK;EAAM,CAAA,IAAI;CACzD,CAAA;AAEZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"icon-button.js","names":[],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAO,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,CAAC,eAAe,KAAK,GAAG,OAAO;EACnC,OAAO,kBAAmB,MAAM,MAAmC,QAAQ;CAC7E,CAAC;AACH;AAEA,MAAa,aAAa,WAA+C,SAAS,WAChF,EAAE,UAAU,WAAW,UAAU,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SACvF,KACA;CACA,IAAI,CAAC,kBAAkB,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,oBACjE,MAAM,IAAI,MAAM,mEAAmE;CAGrF,OACE,oBAAC,UAAD;EACE,GAAI;EACC;EACL,aAAW,WAAW,KAAA;EACtB,WAAW,GAAG,WAAW;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACtD,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,MAAM,QAAQ;YAEnB,UAAU,oBAAC,SAAD;GAAS,eAAY;GAAO,OAAM;GAAG,MAAK;EAAM,CAAA,IAAI;CACzD,CAAA;AAEZ,CAAC"}
1
+ {"version":3,"file":"icon-button.js","names":[],"sources":["../../../src/components/icon-button/icon-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, forwardRef, isValidElement } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { iconButton } from \"../../styled-system/recipes\";\nimport { Spinner } from \"../layout\";\n\nexport interface IconButtonProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"color\"> {\n children?: ReactNode;\n variant?: \"solid\" | \"outline\" | \"ghost\" | \"danger\";\n size?: \"sm\" | \"md\" | \"lg\";\n loading?: boolean;\n}\n\nfunction hasTextualContent(children: ReactNode): boolean {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return String(children).trim().length > 0;\n }\n\n return Children.toArray(children).some((child) => {\n if (!isValidElement(child)) return false;\n return hasTextualContent((child.props as { children?: ReactNode }).children);\n });\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { children, className, disabled, loading = false, size = \"md\", variant = \"outline\", ...props },\n ref,\n) {\n if (!hasTextualContent(children) && !props[\"aria-label\"] && !props[\"aria-labelledby\"]) {\n throw new Error(\"IconButton requires an aria-label when it has no textual content.\");\n }\n\n return (\n <button\n {...props}\n ref={ref}\n aria-busy={loading || undefined}\n className={cx(iconButton({ size, variant }), className)}\n data-jaci-component=\"icon-button\"\n data-loading={loading || undefined}\n data-slot=\"icon-button\"\n disabled={disabled || loading}\n type={props.type ?? \"button\"}\n >\n {loading ? <Spinner aria-hidden=\"true\" label=\"\" size=\"sm\" /> : children}\n </button>\n );\n});\n"],"mappings":";;;;;;;AAiBA,SAAS,kBAAkB,UAA8B;CACvD,IAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,OAAO,OAAO,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS;CAG1C,OAAO,SAAS,QAAQ,QAAQ,CAAC,CAAC,MAAM,UAAU;EAChD,IAAI,CAAC,eAAe,KAAK,GAAG,OAAO;EACnC,OAAO,kBAAmB,MAAM,MAAmC,QAAQ;CAC7E,CAAC;AACH;AAEA,MAAa,aAAa,WAA+C,SAAS,WAChF,EAAE,UAAU,WAAW,UAAU,UAAU,OAAO,OAAO,MAAM,UAAU,WAAW,GAAG,SACvF,KACA;CACA,IAAI,CAAC,kBAAkB,QAAQ,KAAK,CAAC,MAAM,iBAAiB,CAAC,MAAM,oBACjE,MAAM,IAAI,MAAM,mEAAmE;CAGrF,OACE,oBAAC,UAAD;EACE,GAAI;EACC;EACL,aAAW,WAAW,KAAA;EACtB,WAAW,GAAG,WAAW;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EACtD,uBAAoB;EACpB,gBAAc,WAAW,KAAA;EACzB,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,MAAM,QAAQ;EAEnB,UAAA,UAAU,oBAAC,SAAD;GAAS,eAAY;GAAO,OAAM;GAAG,MAAK;EAAM,CAAA,IAAI;CACzD,CAAA;AAEZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"image.cjs","names":["image","useThemePortalProps","cx","BaseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\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;;AAErB,CAAC"}
1
+ {"version":3,"file":"image.cjs","names":["forwardRef","useState","image","useThemePortalProps","cx","BaseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n );\n});\n"],"mappings":";;;;;;;;AA2BA,MAAa,SAAA,GAAQA,MAAAA,WAAA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aseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n );\n});\n"],"mappings":";;;;;;;;AA2BA,MAAa,QAAQ,WAAyC,SAAS,MACrE,EACE,KACA,aACA,WACA,aACA,UACA,MAAM,SACN,WAAW,OACX,gBAAgB,cAChB,SACA,QAC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IAAU,aAAU;GAA2B,CAAA,GACtF,oBAACA,OAAW,UAAZ;IAAqB,WAAW,OAAO;IAAU,aAAU;cACzD,qBAACA,OAAW,OAAZ;KACE,cAAY,OAAO;KACnB,WAAW,OAAO;KAClB,uBAAoB;KACpB,aAAU;eAJZ;MAME,oBAACA,OAAW,OAAZ;OAAkB,WAAW,OAAO;iBAAQ,OAAO;MAAgC,CAAA;MACnF,oBAAC,OAAD;OAAK,WAAW,OAAO;OAAU,aAAU;iBACzC,oBAACA,OAAW,OAAZ;QACE,cAAW;QACX,WAAW,OAAO;QAClB,aAAU;kBACX;OAEiB,CAAA;MACf,CAAA;MACL,oBAAC,OAAD;OACO;OACL,WAAW,OAAO;OAClB,aAAU;OACL;OACL,OAAO,EAAE,gBAAgB,SAAS;MACnC,CAAA;KACe;;GACC,CAAA,CACJ;IACJ;;AAErB,CAAC"}
1
+ {"version":3,"file":"image.js","names":["BaseDialog"],"sources":["../../../src/components/image/image.tsx"],"sourcesContent":["\"use client\";\n\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { forwardRef, useEffect, useState } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\n\nimport { cx } from \"../../styled-system/css\";\nimport { image } from \"../../styled-system/recipes\";\nimport { useThemePortalProps } from \"../../theme/theme-scope\";\n\nexport type ImageFit = \"contain\" | \"cover\" | \"fill\" | \"none\";\nexport type ImageStatus = \"loading\" | \"loaded\" | \"error\";\n\nexport interface ImageProps extends Omit<ComponentPropsWithoutRef<\"img\">, \"children\"> {\n alt: string;\n aspectRatio?: number;\n defaultOpen?: boolean;\n fallback?: ReactNode;\n fit?: ImageFit;\n lightbox?: boolean;\n lightboxLabel?: string;\n onOpenChange?: (open: boolean) => void;\n onStatusChange?: (status: ImageStatus) => void;\n open?: boolean;\n position?: string;\n}\n\nexport const Image = forwardRef<HTMLImageElement, ImageProps>(function Image(\n {\n alt,\n aspectRatio,\n className,\n defaultOpen,\n fallback,\n fit = \"cover\",\n lightbox = false,\n lightboxLabel = \"Open image\",\n onError,\n onLoad,\n onOpenChange,\n onStatusChange,\n open,\n position,\n src,\n style,\n ...props\n },\n ref,\n) {\n const [status, setStatus] = useState<ImageStatus>(\"loading\");\n\n // The source is intentionally the reset key for the native image lifecycle.\n // biome-ignore lint/correctness/useExhaustiveDependencies: changing src starts a new lifecycle.\n useEffect(() => {\n setStatus(\"loading\");\n }, [src]);\n\n useEffect(() => {\n onStatusChange?.(status);\n }, [onStatusChange, status]);\n\n const styles = image({ fit, status });\n const scopedPortalProps = useThemePortalProps({});\n const rootStyle = {\n ...(aspectRatio && Number.isFinite(aspectRatio) && aspectRatio > 0\n ? { aspectRatio }\n : undefined),\n ...style,\n };\n\n const content = (\n <span\n aria-busy={status === \"loading\" || undefined}\n className={styles.root}\n data-fit={fit}\n data-jaci-component=\"image\"\n data-slot=\"image\"\n data-status={status}\n style={rootStyle}\n >\n <img\n {...props}\n ref={ref}\n alt={alt}\n className={cx(styles.image, className)}\n data-slot=\"image-content\"\n onError={(event) => {\n setStatus(\"error\");\n onError?.(event);\n }}\n onLoad={(event) => {\n setStatus(\"loaded\");\n onLoad?.(event);\n }}\n src={src}\n style={{ objectPosition: position }}\n />\n {status === \"error\" && fallback ? (\n <span aria-live=\"polite\" className={styles.fallback} data-slot=\"image-fallback\">\n {fallback}\n </span>\n ) : null}\n </span>\n );\n\n if (!lightbox) {\n return content;\n }\n\n return (\n <BaseDialog.Root\n defaultOpen={defaultOpen}\n onOpenChange={(nextOpen) => onOpenChange?.(nextOpen)}\n open={open}\n >\n <BaseDialog.Trigger\n aria-label={lightboxLabel}\n className={styles.trigger}\n data-jaci-component=\"image-trigger\"\n data-slot=\"image-trigger\"\n >\n {content}\n </BaseDialog.Trigger>\n <BaseDialog.Portal {...scopedPortalProps}>\n <BaseDialog.Backdrop className={styles.backdrop} data-slot=\"image-lightbox-backdrop\" />\n <BaseDialog.Viewport className={styles.viewport} data-slot=\"image-lightbox-viewport\">\n <BaseDialog.Popup\n aria-label={alt || lightboxLabel}\n className={styles.popup}\n data-jaci-component=\"image-lightbox\"\n data-slot=\"image-lightbox-popup\"\n >\n <BaseDialog.Title className={styles.title}>{alt || lightboxLabel}</BaseDialog.Title>\n <div className={styles.closeRow} data-slot=\"image-lightbox-close-row\">\n <BaseDialog.Close\n aria-label=\"Close image\"\n className={styles.close}\n data-slot=\"image-lightbox-close\"\n >\n ×\n </BaseDialog.Close>\n </div>\n <img\n alt={alt}\n className={styles.lightboxImage}\n data-slot=\"image-lightbox-content\"\n src={src}\n style={{ objectPosition: position }}\n />\n </BaseDialog.Popup>\n </BaseDialog.Viewport>\n </BaseDialog.Portal>\n </BaseDialog.Root>\n );\n});\n"],"mappings":";;;;;;;;AA2BA,MAAa,QAAQ,WAAyC,SAAS,MACrE,EACE,KACA,aACA,WACA,aACA,UACA,MAAM,SACN,WAAW,OACX,gBAAgB,cAChB,SACA,QACA,cACA,gBACA,MACA,UACA,KACA,OACA,GAAG,SAEL,KACA;CACA,MAAM,CAAC,QAAQ,aAAa,SAAsB,SAAS;CAI3D,gBAAgB;EACd,UAAU,SAAS;CACrB,GAAG,CAAC,GAAG,CAAC;CAER,gBAAgB;EACd,iBAAiB,MAAM;CACzB,GAAG,CAAC,gBAAgB,MAAM,CAAC;CAE3B,MAAM,SAAS,MAAM;EAAE;EAAK;CAAO,CAAC;CACpC,MAAM,oBAAoB,oBAAoB,CAAC,CAAC;CAChD,MAAM,YAAY;EAChB,GAAI,eAAe,OAAO,SAAS,WAAW,KAAK,cAAc,IAC7D,EAAE,YAAY,IACd,KAAA;EACJ,GAAG;CACL;CAEA,MAAM,UACJ,qBAAC,QAAD;EACE,aAAW,WAAW,aAAa,KAAA;EACnC,WAAW,OAAO;EAClB,YAAU;EACV,uBAAoB;EACpB,aAAU;EACV,eAAa;EACb,OAAO;EAPT,UAAA,CASE,oBAAC,OAAD;GACE,GAAI;GACC;GACA;GACL,WAAW,GAAG,OAAO,OAAO,SAAS;GACrC,aAAU;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