@atom-learning/components 5.12.0 → 5.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/CHANGELOG.md +16 -22
  2. package/dist/components/accordion/AccordionContent.js +1 -1
  3. package/dist/components/accordion/AccordionTrigger.js +1 -1
  4. package/dist/components/accordion/AccordionTrigger.js.map +1 -1
  5. package/dist/components/action-icon/ActionIcon.d.ts +1 -1
  6. package/dist/components/action-icon/ActionIcon.js +1 -1
  7. package/dist/components/action-icon/ActionIcon.js.map +1 -1
  8. package/dist/components/alert-dialog/AlertDialogContent.js +1 -1
  9. package/dist/components/alert-dialog/AlertDialogContent.js.map +1 -1
  10. package/dist/components/avatar/Avatar.js +1 -1
  11. package/dist/components/avatar/Avatar.js.map +1 -1
  12. package/dist/components/badge/Badge.d.ts +4 -4
  13. package/dist/components/badge/BadgeText.js +1 -1
  14. package/dist/components/badge/BadgeText.js.map +1 -1
  15. package/dist/components/banner/BannerContainer.d.ts +4 -4
  16. package/dist/components/banner/banner-regular/BannerRegular.d.ts +11 -11
  17. package/dist/components/banner/banner-regular/BannerRegularDismiss.d.ts +2 -2
  18. package/dist/components/banner/banner-regular/BannerRegularImage.js +1 -1
  19. package/dist/components/banner/banner-regular/BannerRegularImage.js.map +1 -1
  20. package/dist/components/banner/banner-slim/BannerSlim.d.ts +27 -27
  21. package/dist/components/banner/banner-slim/BannerSlimContent.d.ts +4 -4
  22. package/dist/components/banner/banner-slim/BannerSlimDismiss.d.ts +2 -2
  23. package/dist/components/banner/banner-slim/BannerSlimImage.js +1 -1
  24. package/dist/components/banner/banner-slim/BannerSlimImage.js.map +1 -1
  25. package/dist/components/button/Button.js +1 -1
  26. package/dist/components/button/Button.js.map +1 -1
  27. package/dist/components/carousel/Carousel.js +1 -1
  28. package/dist/components/carousel/Carousel.js.map +1 -1
  29. package/dist/components/carousel/CarouselArrows.js +1 -1
  30. package/dist/components/carousel/CarouselArrows.js.map +1 -1
  31. package/dist/components/carousel/CarouselSlider.js +1 -1
  32. package/dist/components/carousel/CarouselSlider.js.map +1 -1
  33. package/dist/components/checkbox/Checkbox.js +1 -1
  34. package/dist/components/checkbox/Checkbox.js.map +1 -1
  35. package/dist/components/checkbox-tree/CheckboxTree.d.ts +123 -123
  36. package/dist/components/chip/Chip.d.ts +14 -14
  37. package/dist/components/chip-dismissible-group/ChipDismissibleGroupItem.d.ts +5 -5
  38. package/dist/components/chip-toggle-group/ChipToggleGroupItem.d.ts +5 -5
  39. package/dist/components/chip-toggle-group/ChipToggleGroupItem.js +1 -1
  40. package/dist/components/chip-toggle-group/ChipToggleGroupItem.js.map +1 -1
  41. package/dist/components/combobox/ComboboxInput.js +1 -1
  42. package/dist/components/combobox/ComboboxOption.js +1 -1
  43. package/dist/components/combobox/ComboboxOption.js.map +1 -1
  44. package/dist/components/combobox/ComboboxPopover.js +1 -1
  45. package/dist/components/combobox/ComboboxPopover.js.map +1 -1
  46. package/dist/components/create-password-field/CreatePasswordField.d.ts +1 -2
  47. package/dist/components/create-password-field/CreatePasswordField.js +1 -1
  48. package/dist/components/create-password-field/CreatePasswordField.js.map +1 -1
  49. package/dist/components/data-table/DataTable.d.ts +9 -9
  50. package/dist/components/data-table/DataTableHead.d.ts +1 -1
  51. package/dist/components/data-table/DataTableHead.js +1 -1
  52. package/dist/components/data-table/DataTableHead.js.map +1 -1
  53. package/dist/components/data-table/DataTableHeaderCell.js +1 -1
  54. package/dist/components/data-table/DataTableHeaderCell.js.map +1 -1
  55. package/dist/components/data-table/DataTableRow.js +1 -1
  56. package/dist/components/data-table/DataTableRow.js.map +1 -1
  57. package/dist/components/data-table/DataTableRowSelectionCheckbox.js +1 -1
  58. package/dist/components/data-table/DataTableRowSelectionCheckbox.js.map +1 -1
  59. package/dist/components/date-input/DateInput.js +1 -1
  60. package/dist/components/date-input/DateInput.js.map +1 -1
  61. package/dist/components/dialog/DialogContent.js +1 -1
  62. package/dist/components/dialog/DialogContent.js.map +1 -1
  63. package/dist/components/drawer/DrawerContent.js +1 -1
  64. package/dist/components/drawer/DrawerContent.js.map +1 -1
  65. package/dist/components/drawer/DrawerFooter.js +1 -1
  66. package/dist/components/drawer/DrawerFooter.js.map +1 -1
  67. package/dist/components/drawer/DrawerHeader.js +1 -1
  68. package/dist/components/drawer/DrawerHeader.js.map +1 -1
  69. package/dist/components/drawer/DrawerMain.js +1 -1
  70. package/dist/components/drawer/DrawerMain.js.map +1 -1
  71. package/dist/components/dropdown-menu/DropdownMenuContent.js +1 -1
  72. package/dist/components/dropdown-menu/DropdownMenuContent.js.map +1 -1
  73. package/dist/components/dropdown-menu/DropdownMenuItem.d.ts +2 -428
  74. package/dist/components/dropdown-menu/DropdownMenuItem.js +1 -1
  75. package/dist/components/dropdown-menu/DropdownMenuItem.js.map +1 -1
  76. package/dist/components/dropdown-menu/DropdownMenuTrigger.js +1 -1
  77. package/dist/components/dropdown-menu/DropdownMenuTrigger.js.map +1 -1
  78. package/dist/components/empty-state/EmptyState.d.ts +4 -4
  79. package/dist/components/field-wrapper/InlineFieldWrapper.js +1 -1
  80. package/dist/components/field-wrapper/InlineFieldWrapper.js.map +1 -1
  81. package/dist/components/flex/Flex.d.ts +4 -4
  82. package/dist/components/flex/Flex.js +1 -1
  83. package/dist/components/flex/Flex.js.map +1 -1
  84. package/dist/components/grid/Grid.d.ts +1 -3
  85. package/dist/components/grid/Grid.js +1 -1
  86. package/dist/components/grid/Grid.js.map +1 -1
  87. package/dist/components/heading/Heading.js +1 -1
  88. package/dist/components/icon/Icon.js +1 -1
  89. package/dist/components/icon/Icon.js.map +1 -1
  90. package/dist/components/inline-message/InlineMessage.config.d.ts +0 -2
  91. package/dist/components/inline-message/InlineMessage.config.js +1 -1
  92. package/dist/components/inline-message/InlineMessage.config.js.map +1 -1
  93. package/dist/components/inline-message/InlineMessage.d.ts +5 -6
  94. package/dist/components/inline-message/InlineMessage.js +1 -1
  95. package/dist/components/inline-message/InlineMessage.js.map +1 -1
  96. package/dist/components/input/Input.d.ts +4 -4
  97. package/dist/components/input/Input.js +1 -1
  98. package/dist/components/input/Input.js.map +1 -1
  99. package/dist/components/label/Label.d.ts +1 -1
  100. package/dist/components/link/Link.js +1 -1
  101. package/dist/components/link/Link.js.map +1 -1
  102. package/dist/components/list/List.js +1 -1
  103. package/dist/components/list/List.js.map +1 -1
  104. package/dist/components/loader/Loader.js +1 -1
  105. package/dist/components/loader/Loader.js.map +1 -1
  106. package/dist/components/markdown-content/MarkdownContent.d.ts +4 -4
  107. package/dist/components/markdown-content/MarkdownContent.js +1 -1
  108. package/dist/components/markdown-content/MarkdownContent.js.map +1 -1
  109. package/dist/components/markdown-content/components/MarkdownList.d.ts +1 -1
  110. package/dist/components/markdown-content/components/MarkdownList.js.map +1 -1
  111. package/dist/components/navigation/NavigationMenu.js +1 -1
  112. package/dist/components/navigation/NavigationMenu.js.map +1 -1
  113. package/dist/components/navigation/NavigationMenuDropdownTrigger.js +1 -1
  114. package/dist/components/navigation/NavigationMenuDropdownTrigger.js.map +1 -1
  115. package/dist/components/navigation-menu-vertical/NavigationMenuVertical.d.ts +5 -5
  116. package/dist/components/navigation-menu-vertical/NavigationMenuVertical.styles.d.ts +7 -7
  117. package/dist/components/navigation-menu-vertical/NavigationMenuVertical.styles.js +1 -1
  118. package/dist/components/navigation-menu-vertical/NavigationMenuVertical.styles.js.map +1 -1
  119. package/dist/components/number-input/NumberInput.js +1 -1
  120. package/dist/components/number-input/NumberInputStepper.d.ts +2 -2
  121. package/dist/components/number-input/NumberInputStepper.js +1 -1
  122. package/dist/components/number-input/NumberInputStepper.js.map +1 -1
  123. package/dist/components/pagination/PaginationNextButton.d.ts +2 -2
  124. package/dist/components/pagination/PaginationPage.js +1 -1
  125. package/dist/components/pagination/PaginationPage.js.map +1 -1
  126. package/dist/components/pagination/PaginationPreviousButton.d.ts +2 -2
  127. package/dist/components/password-field/PasswordField.js.map +1 -1
  128. package/dist/components/password-input/PasswordInput.js +1 -1
  129. package/dist/components/password-input/PasswordInput.js.map +1 -1
  130. package/dist/components/popover/PopoverContent.js +1 -1
  131. package/dist/components/popover/PopoverContent.js.map +1 -1
  132. package/dist/components/progress-bar/ProgressBar.js +1 -1
  133. package/dist/components/progress-bar/ProgressBar.js.map +1 -1
  134. package/dist/components/radio-button/RadioButton.js +1 -1
  135. package/dist/components/radio-button/RadioButton.js.map +1 -1
  136. package/dist/components/search-input/SearchInput.js +1 -1
  137. package/dist/components/section-message/SectionMessageLayout.js +1 -1
  138. package/dist/components/section-message/SectionMessageLayout.js.map +1 -1
  139. package/dist/components/segmented-control/SegmentedControlItem.js +1 -1
  140. package/dist/components/segmented-control/SegmentedControlItem.js.map +1 -1
  141. package/dist/components/segmented-control/SegmentedControlItemList.js +1 -1
  142. package/dist/components/segmented-control/SegmentedControlItemList.js.map +1 -1
  143. package/dist/components/select/Select.js +1 -1
  144. package/dist/components/select/Select.js.map +1 -1
  145. package/dist/components/side-bar/SideBar.d.ts +1 -1
  146. package/dist/components/side-bar/SideBar.js +1 -1
  147. package/dist/components/side-bar/SideBar.js.map +1 -1
  148. package/dist/components/slider/Slider.d.ts +372 -2
  149. package/dist/components/slider/Slider.js +1 -1
  150. package/dist/components/slider/Slider.js.map +1 -1
  151. package/dist/components/sortable/Handle.d.ts +2 -2
  152. package/dist/components/sortable/Handle.js +1 -1
  153. package/dist/components/sortable/Handle.js.map +1 -1
  154. package/dist/components/sortable/SortableItem.d.ts +3 -1
  155. package/dist/components/sortable/SortableItem.js +1 -1
  156. package/dist/components/sortable/SortableItem.js.map +1 -1
  157. package/dist/components/sortable/index.d.ts +1 -1
  158. package/dist/components/stepper/StepperStepBullet.d.ts +4 -4
  159. package/dist/components/stepper/StepperStepContainer.d.ts +4 -4
  160. package/dist/components/stepper/StepperStepContainer.js +1 -1
  161. package/dist/components/stepper/StepperStepContainer.js.map +1 -1
  162. package/dist/components/stepper/StepperSteps.js +1 -1
  163. package/dist/components/stepper/StepperSteps.js.map +1 -1
  164. package/dist/components/switch/Switch.js +1 -1
  165. package/dist/components/switch/Switch.js.map +1 -1
  166. package/dist/components/table/Table.d.ts +1 -1
  167. package/dist/components/table/Table.js +1 -1
  168. package/dist/components/table/Table.js.map +1 -1
  169. package/dist/components/table/TableBody.js +1 -1
  170. package/dist/components/table/TableBody.js.map +1 -1
  171. package/dist/components/table/TableHeader.d.ts +1 -1
  172. package/dist/components/table/TableHeader.js +1 -1
  173. package/dist/components/table/TableHeader.js.map +1 -1
  174. package/dist/components/table/TableRow.d.ts +2 -1
  175. package/dist/components/table/TableRow.js +1 -1
  176. package/dist/components/table/TableRow.js.map +1 -1
  177. package/dist/components/tabs/TabsTrigger.js +1 -1
  178. package/dist/components/tabs/TabsTrigger.js.map +1 -1
  179. package/dist/components/text/Text.js +1 -1
  180. package/dist/components/text/Text.js.map +1 -1
  181. package/dist/components/tile/TileGroup.d.ts +4 -4
  182. package/dist/components/tile-interactive/TileInteractive.js +1 -1
  183. package/dist/components/tile-interactive/TileInteractive.js.map +1 -1
  184. package/dist/components/toast/Toast.d.ts +5 -23
  185. package/dist/components/toast/Toast.js +1 -1
  186. package/dist/components/toast/Toast.js.map +1 -1
  187. package/dist/components/toast/ToastProvider.js +1 -1
  188. package/dist/components/toast/ToastProvider.js.map +1 -1
  189. package/dist/components/toggle-group/ToggleGroupButton.js +1 -1
  190. package/dist/components/toggle-group/ToggleGroupButton.js.map +1 -1
  191. package/dist/components/toggle-group/ToggleGroupItem.js +1 -1
  192. package/dist/components/toggle-group/ToggleGroupItem.js.map +1 -1
  193. package/dist/components/toggle-group/ToggleGroupRoot.js +1 -1
  194. package/dist/components/toggle-group/ToggleGroupRoot.js.map +1 -1
  195. package/dist/components/toggle-group/index.d.ts +5 -5
  196. package/dist/components/tooltip/TooltipContent.js +1 -1
  197. package/dist/components/tooltip/TooltipContent.js.map +1 -1
  198. package/dist/components/top-bar/TopBar.d.ts +2 -2
  199. package/dist/components/top-bar/TopBar.js +1 -1
  200. package/dist/components/top-bar/TopBar.js.map +1 -1
  201. package/dist/components/tree/Tree.d.ts +100 -100
  202. package/dist/components/tree/TreeCollapsibleTrigger.js +1 -1
  203. package/dist/components/tree/TreeCollapsibleTrigger.js.map +1 -1
  204. package/dist/components/tree/TreeItemContent.d.ts +5 -5
  205. package/dist/components/tree/TreeListItem.d.ts +5 -5
  206. package/dist/components/video/Video.js +1 -1
  207. package/dist/components/video/Video.js.map +1 -1
  208. package/dist/docgen.json +1 -1
  209. package/dist/index.cjs.js +1 -1
  210. package/dist/index.cjs.js.map +1 -1
  211. package/dist/index.d.ts +1 -1
  212. package/dist/index.js +1 -1
  213. package/dist/utilities/index.d.ts +1 -2
  214. package/dist/utilities/no-overflow-wrapper/NoOverflowWrapper.d.ts +1 -374
  215. package/dist/utilities/no-overflow-wrapper/NoOverflowWrapper.js +1 -1
  216. package/dist/utilities/no-overflow-wrapper/NoOverflowWrapper.js.map +1 -1
  217. package/dist/utilities/no-overflow-wrapper/index.d.ts +1 -1
  218. package/dist/utilities/style/backdrop-overlay.js +1 -1
  219. package/dist/utilities/style/backdrop-overlay.js.map +1 -1
  220. package/dist/utilities/style/index.d.ts +0 -2
  221. package/package.json +1 -1
  222. package/dist/components/drawer/Drawer.styles.d.ts +0 -4
  223. package/dist/components/drawer/Drawer.styles.js +0 -2
  224. package/dist/components/drawer/Drawer.styles.js.map +0 -1
  225. package/dist/constants/zIndices.d.ts +0 -6
  226. package/dist/constants/zIndices.js +0 -2
  227. package/dist/constants/zIndices.js.map +0 -1
  228. package/dist/utilities/create-theme-variants/createThemeVariants.d.ts +0 -22
  229. package/dist/utilities/create-theme-variants/createThemeVariants.js +0 -2
  230. package/dist/utilities/create-theme-variants/createThemeVariants.js.map +0 -1
  231. package/dist/utilities/create-theme-variants/index.d.ts +0 -1
  232. package/dist/utilities/style/disabledStyle.d.ts +0 -2
  233. package/dist/utilities/style/disabledStyle.js +0 -2
  234. package/dist/utilities/style/disabledStyle.js.map +0 -1
  235. package/dist/utilities/style/focus-visible-style-block.d.ts +0 -13
  236. package/dist/utilities/style/focus-visible-style-block.js +0 -2
  237. package/dist/utilities/style/focus-visible-style-block.js.map +0 -1
  238. package/dist/utilities/style/reset.d.ts +0 -13
  239. package/dist/utilities/style/reset.js +0 -2
  240. package/dist/utilities/style/reset.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ChipToggleGroupItem.js","sources":["../../../src/components/chip-toggle-group/ChipToggleGroupItem.tsx"],"sourcesContent":["import { Ok } from '@atom-learning/icons'\nimport * as ToggleGroup from '@radix-ui/react-toggle-group'\nimport * as React from 'react'\n\nimport { Chip } from '~/components/chip'\nimport { Icon } from '~/components/icon'\nimport { styled } from '~/stitches'\nimport { focusVisibleStyleBlock } from '~/utilities'\n\nconst StyledChipToggleIcon = styled(Icon, {\n display: 'none'\n})\n\nconst StyledChipToggleGroupItem = styled.withConfig({\n shouldForwardStitchesProp: (propName) => ['as'].includes(propName)\n})(Chip, {\n '&:not([disabled])': {\n cursor: 'pointer',\n '&:hover': {\n bg: '$grey200',\n color: '$grey1000',\n borderColor: 'currentColor'\n },\n '&:focus-visible': {\n ...focusVisibleStyleBlock()\n },\n '&[data-state=\"on\"]': {\n '&:hover': {\n bg: 'white',\n color: '$primary1000'\n }\n }\n },\n '&[data-state=\"off\"]': {\n color: '$grey800',\n bg: 'white',\n borderColor: '$grey600'\n },\n '&[data-state=\"on\"]': {\n [`& ${StyledChipToggleIcon}`]: {\n display: 'block'\n }\n }\n})\n\ntype TChipToggleGroupItem = React.ComponentProps<typeof ToggleGroup.Item> &\n React.ComponentProps<typeof StyledChipToggleGroupItem>\n\nexport const ChipToggleGroupItem = ({\n size = 'md',\n children,\n ...rest\n}: TChipToggleGroupItem) => {\n return (\n <ToggleGroup.Item {...rest} asChild>\n <StyledChipToggleGroupItem as=\"button\">\n <StyledChipToggleIcon is={Ok} size={size === 'lg' ? 'md' : 'sm'} />\n <Chip.Content>{children}</Chip.Content>\n </StyledChipToggleGroupItem>\n </ToggleGroup.Item>\n )\n}\n"],"names":["StyledChipToggleIcon","styled","Icon","StyledChipToggleGroupItem","propName","Chip","focusVisibleStyleBlock","ChipToggleGroupItem","size","children","rest","React","ToggleGroup","Ok"],"mappings":"2hBASA,MAAMA,EAAuBC,EAAOC,EAAM,CACxC,QAAS,MACX,CAAC,EAEKC,EAA4BF,EAAO,WAAW,CAClD,0BAA4BG,GAAa,CAAC,IAAI,EAAE,SAASA,CAAQ,CACnE,CAAC,EAAEC,EAAM,CACP,oBAAqB,CACnB,OAAQ,UACR,UAAW,CACT,GAAI,WACJ,MAAO,YACP,YAAa,cACf,EACA,kBAAmB,CACjB,GAAGC,GACL,EACA,qBAAsB,CACpB,UAAW,CACT,GAAI,QACJ,MAAO,cACT,CACF,CACF,EACA,sBAAuB,CACrB,MAAO,WACP,GAAI,QACJ,YAAa,UACf,EACA,qBAAsB,CACpB,CAAC,KAAKN,KAAyB,CAC7B,QAAS,OACX,CACF,CACF,CAAC,EAKYO,EAAsB,CAAC,CAClC,KAAAC,EAAO,KACP,SAAAC,KACGC,CACL,IAEIC,EAAA,cAACC,EAAY,KAAZ,CAAkB,GAAGF,EAAM,QAAO,EAAA,EACjCC,EAAA,cAACR,EAAA,CAA0B,GAAG,UAC5BQ,EAAA,cAACX,EAAA,CAAqB,GAAIa,EAAI,KAAML,IAAS,KAAO,KAAO,IAAA,CAAM,EACjEG,EAAA,cAACN,EAAK,QAAL,KAAcI,CAAS,CAC1B,CACF"}
1
+ {"version":3,"file":"ChipToggleGroupItem.js","sources":["../../../src/components/chip-toggle-group/ChipToggleGroupItem.tsx"],"sourcesContent":["import { Ok } from '@atom-learning/icons'\nimport * as ToggleGroup from '@radix-ui/react-toggle-group'\nimport * as React from 'react'\n\nimport { Chip } from '~/components/chip'\nimport { Icon } from '~/components/icon'\nimport { styled } from '~/stitches'\n\nconst StyledChipToggleIcon = styled(Icon, {\n display: 'none'\n})\n\nconst StyledChipToggleGroupItem = styled.withConfig({\n shouldForwardStitchesProp: (propName) => ['as'].includes(propName)\n})(Chip, {\n '&:not([disabled])': {\n cursor: 'pointer',\n '&:hover': {\n bg: '$grey200',\n color: '$grey1000',\n borderColor: 'currentColor'\n },\n '&:focus-visible': {\n outline: 'none',\n position: 'relative',\n zIndex: 1,\n boxShadow: `white 0px 0px 0px 2px, $colors$primary800 0px 0px 0px 4px`\n },\n '&[data-state=\"on\"]': {\n '&:hover': {\n bg: 'white',\n color: '$primary1000'\n }\n }\n },\n '&[data-state=\"off\"]': {\n color: '$grey800',\n bg: 'white',\n borderColor: '$grey600'\n },\n '&[data-state=\"on\"]': {\n '& svg': {\n display: 'block'\n }\n }\n})\n\ntype TChipToggleGroupItem = React.ComponentProps<typeof ToggleGroup.Item> &\n React.ComponentProps<typeof StyledChipToggleGroupItem>\n\nexport const ChipToggleGroupItem = ({\n size = 'md',\n children,\n ...rest\n}: TChipToggleGroupItem) => {\n return (\n <ToggleGroup.Item {...rest} asChild>\n <StyledChipToggleGroupItem as=\"button\">\n <StyledChipToggleIcon is={Ok} size={size === 'lg' ? 'md' : 'sm'} />\n <Chip.Content>{children}</Chip.Content>\n </StyledChipToggleGroupItem>\n </ToggleGroup.Item>\n )\n}\n"],"names":["StyledChipToggleIcon","styled","Icon","StyledChipToggleGroupItem","propName","Chip","ChipToggleGroupItem","size","children","rest","React","ToggleGroup","Ok"],"mappings":"uQAQA,MAAMA,EAAuBC,EAAOC,EAAM,CACxC,QAAS,MACX,CAAC,EAEKC,EAA4BF,EAAO,WAAW,CAClD,0BAA4BG,GAAa,CAAC,IAAI,EAAE,SAASA,CAAQ,CACnE,CAAC,EAAEC,EAAM,CACP,oBAAqB,CACnB,OAAQ,UACR,UAAW,CACT,GAAI,WACJ,MAAO,YACP,YAAa,cACf,EACA,kBAAmB,CACjB,QAAS,OACT,SAAU,WACV,OAAQ,EACR,UAAW,2DACb,EACA,qBAAsB,CACpB,UAAW,CACT,GAAI,QACJ,MAAO,cACT,CACF,CACF,EACA,sBAAuB,CACrB,MAAO,WACP,GAAI,QACJ,YAAa,UACf,EACA,qBAAsB,CACpB,QAAS,CACP,QAAS,OACX,CACF,CACF,CAAC,EAKYC,EAAsB,CAAC,CAClC,KAAAC,EAAO,KACP,SAAAC,KACGC,CACL,IAEIC,EAAA,cAACC,EAAY,KAAZ,CAAkB,GAAGF,EAAM,QAAO,EAAA,EACjCC,EAAA,cAACP,EAAA,CAA0B,GAAG,UAC5BO,EAAA,cAACV,EAAA,CAAqB,GAAIY,EAAI,KAAML,IAAS,KAAO,KAAO,IAAA,CAAM,EACjEG,EAAA,cAACL,EAAK,QAAL,KAAcG,CAAS,CAC1B,CACF"}
@@ -1,2 +1,2 @@
1
- import{ComboboxInput as n}from"@reach/combobox";import*as o from"react";import{styled as a,theme as d}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import"../../utilities/no-overflow-wrapper/NoOverflowWrapper.js";import{encodeBackgroundIcon as l}from"../../utilities/style/encode-background-icon.js";import"../../utilities/style/keyframe-animations.js";const e=a(n,{boxShadow:"none",appearance:"none",backgroundImage:l(d.colors.grey700.value,"chevron"),backgroundPosition:"right $space$3 top 50%, 0 0",backgroundRepeat:"no-repeat, repeat",backgroundSize:"20px auto, 100%",border:"1px solid $grey700",borderRadius:"$1",boxSizing:"border-box",color:"$grey1000",cursor:"text",display:"block",fontFamily:"$body",height:"$4",pl:"$3",pr:"$6",transition:"all 100ms ease-out",width:"100%","&::placeholder":{color:"$grey700",opacity:1},"&:focus-within":{borderColor:"$primary800",outline:"none"},"&[disabled]":{backgroundColor:"$grey200",color:"$grey800",cursor:"not-allowed"},variants:{size:{sm:{height:"$3",fontSize:"$sm",lineHeight:1.7},md:{height:"$4",fontSize:"$md",lineHeight:2},lg:{height:"$5",fontSize:"$md",lineHeight:2}},state:{error:{border:"1px solid $danger"}}}}),p=o.forwardRef(({size:r="md",...t},i)=>o.createElement(e,{size:r,...t,ref:i}));export{p as ComboboxInput,e as StyledComboboxInput};
1
+ import{ComboboxInput as n}from"@reach/combobox";import*as o from"react";import{styled as a,theme as d}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import{encodeBackgroundIcon as l}from"../../utilities/style/encode-background-icon.js";import"../../utilities/style/keyframe-animations.js";import"../../utilities/no-overflow-wrapper/NoOverflowWrapper.js";const e=a(n,{boxShadow:"none",appearance:"none",backgroundImage:l(d.colors.grey700.value,"chevron"),backgroundPosition:"right $space$3 top 50%, 0 0",backgroundRepeat:"no-repeat, repeat",backgroundSize:"20px auto, 100%",border:"1px solid $grey700",borderRadius:"$1",boxSizing:"border-box",color:"$grey1000",cursor:"text",display:"block",fontFamily:"$body",height:"$4",pl:"$3",pr:"$6",transition:"all 100ms ease-out",width:"100%","&::placeholder":{color:"$grey700",opacity:1},"&:focus-within":{borderColor:"$primary800",outline:"none"},"&[disabled]":{backgroundColor:"$grey200",color:"$grey800",cursor:"not-allowed"},variants:{size:{sm:{height:"$3",fontSize:"$sm",lineHeight:1.7},md:{height:"$4",fontSize:"$md",lineHeight:2},lg:{height:"$5",fontSize:"$md",lineHeight:2}},state:{error:{border:"1px solid $danger"}}}}),p=o.forwardRef(({size:r="md",...t},i)=>o.createElement(e,{size:r,...t,ref:i}));export{p as ComboboxInput,e as StyledComboboxInput};
2
2
  //# sourceMappingURL=ComboboxInput.js.map
@@ -1,2 +1,2 @@
1
- import{ComboboxOption as o}from"@reach/combobox";import{styled as r}from"../../stitches.js";const e=r(o,{color:"$grey900",cursor:"pointer",m:0,p:"$2",'&:hover, &[aria-selected="true"]':{bg:"$grey100",borderRadius:"$0"},"[data-user-value]":{color:"$primary800"}});export{e as ComboboxOption};
1
+ import{ComboboxOption as o}from"@reach/combobox";import{styled as r}from"../../stitches.js";const e=r(o,{color:"$grey900",cursor:"pointer",m:0,p:"$2",'&:hover, &[aria-selected="true"]':{bg:"$grey100",borderRadius:"$0"},"&[data-user-value]":{color:"$primary800"}});export{e as ComboboxOption};
2
2
  //# sourceMappingURL=ComboboxOption.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxOption.js","sources":["../../../src/components/combobox/ComboboxOption.tsx"],"sourcesContent":["import { ComboboxOption as BaseComboboxOption } from '@reach/combobox'\n\nimport { styled } from '~/stitches'\n\nexport const ComboboxOption = styled(BaseComboboxOption, {\n color: '$grey900',\n cursor: 'pointer',\n m: 0,\n p: '$2',\n '&:hover, &[aria-selected=\"true\"]': {\n bg: '$grey100',\n borderRadius: '$0'\n },\n '[data-user-value]': {\n color: '$primary800'\n }\n})\n"],"names":["ComboboxOption","styled","BaseComboboxOption"],"mappings":"4FAIa,MAAAA,EAAiBC,EAAOC,EAAoB,CACvD,MAAO,WACP,OAAQ,UACR,EAAG,EACH,EAAG,KACH,mCAAoC,CAClC,GAAI,WACJ,aAAc,IAChB,EACA,oBAAqB,CACnB,MAAO,aACT,CACF,CAAC"}
1
+ {"version":3,"file":"ComboboxOption.js","sources":["../../../src/components/combobox/ComboboxOption.tsx"],"sourcesContent":["import { ComboboxOption as BaseComboboxOption } from '@reach/combobox'\n\nimport { styled } from '~/stitches'\n\nexport const ComboboxOption = styled(BaseComboboxOption, {\n color: '$grey900',\n cursor: 'pointer',\n m: 0,\n p: '$2',\n '&:hover, &[aria-selected=\"true\"]': {\n bg: '$grey100',\n borderRadius: '$0'\n },\n '&[data-user-value]': {\n color: '$primary800'\n }\n})\n"],"names":["ComboboxOption","styled","BaseComboboxOption"],"mappings":"4FAIa,MAAAA,EAAiBC,EAAOC,EAAoB,CACvD,MAAO,WACP,OAAQ,UACR,EAAG,EACH,EAAG,KACH,mCAAoC,CAClC,GAAI,WACJ,aAAc,IAChB,EACA,qBAAsB,CACpB,MAAO,aACT,CACF,CAAC"}
@@ -1,2 +1,2 @@
1
- import{ComboboxPopover as o}from"@reach/combobox";import{styled as r}from"../../stitches.js";const e=r(o,{bg:"white",border:"solid 1px $grey200",borderRadius:"$1",boxShadow:"$1",boxSizing:"border-box",fontFamily:"$body",fontSize:"$md",outline:"none",p:"$1",transform:"translateY($space$2)"});export{e as ComboboxPopover};
1
+ import{ComboboxPopover as o}from"@reach/combobox";import{styled as r}from"../../stitches.js";const e=r(o,{bg:"white",border:"1px solid $grey200",borderRadius:"$1",boxShadow:"$1",boxSizing:"border-box",fontFamily:"$body",fontSize:"$md",outline:"none",p:"$1",transform:"translateY($space$2)"});export{e as ComboboxPopover};
2
2
  //# sourceMappingURL=ComboboxPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxPopover.js","sources":["../../../src/components/combobox/ComboboxPopover.tsx"],"sourcesContent":["import { ComboboxPopover as BaseComboboxPopover } from '@reach/combobox'\n\nimport { styled } from '~/stitches'\n\nexport const ComboboxPopover = styled(BaseComboboxPopover, {\n bg: 'white',\n border: 'solid 1px $grey200',\n borderRadius: '$1',\n boxShadow: '$1',\n boxSizing: 'border-box',\n fontFamily: '$body',\n fontSize: '$md',\n outline: 'none',\n p: '$1',\n transform: 'translateY($space$2)'\n})\n"],"names":["ComboboxPopover","styled","BaseComboboxPopover"],"mappings":"6FAIa,MAAAA,EAAkBC,EAAOC,EAAqB,CACzD,GAAI,QACJ,OAAQ,qBACR,aAAc,KACd,UAAW,KACX,UAAW,aACX,WAAY,QACZ,SAAU,MACV,QAAS,OACT,EAAG,KACH,UAAW,sBACb,CAAC"}
1
+ {"version":3,"file":"ComboboxPopover.js","sources":["../../../src/components/combobox/ComboboxPopover.tsx"],"sourcesContent":["import { ComboboxPopover as BaseComboboxPopover } from '@reach/combobox'\n\nimport { styled } from '~/stitches'\n\nexport const ComboboxPopover = styled(BaseComboboxPopover, {\n bg: 'white',\n border: '1px solid $grey200',\n borderRadius: '$1',\n boxShadow: '$1',\n boxSizing: 'border-box',\n fontFamily: '$body',\n fontSize: '$md',\n outline: 'none',\n p: '$1',\n transform: 'translateY($space$2)'\n})\n"],"names":["ComboboxPopover","styled","BaseComboboxPopover"],"mappings":"6FAIa,MAAAA,EAAkBC,EAAOC,EAAqB,CACzD,GAAI,QACJ,OAAQ,qBACR,aAAc,KACd,UAAW,KACX,UAAW,aACX,WAAY,QACZ,SAAU,MACV,QAAS,OACT,EAAG,KACH,UAAW,sBACb,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import type { CSS } from '../../stitches';
3
2
  import { Override } from '../../utilities';
4
3
  import { FieldElementWrapperProps } from '../field-wrapper';
5
4
  import { PasswordInput } from '../password-input';
@@ -9,7 +8,7 @@ type CreatePasswordFieldProps = Override<React.ComponentProps<typeof PasswordInp
9
8
  name?: string;
10
9
  validate: (password: string) => Promise<ValidationResult | undefined> | ValidationResult;
11
10
  defaultValidation: ValidationResult;
12
- messageDirection?: CSS['flexDirection'];
11
+ messageDirection?: 'row' | 'column';
13
12
  }>;
14
13
  export declare const CreatePasswordField: {
15
14
  ({ validate, defaultValidation, messageDirection, label, name, css, validation, appearance, ...remainingProps }: CreatePasswordFieldProps): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import E from"invariant";import*as a from"react";import{useFormContext as k}from"react-hook-form";import{throttle as B}from"throttle-debounce";import{Box as P}from"../box/Box.js";import{Flex as D}from"../flex/Flex.js";import{InlineMessage as $}from"../inline-message/InlineMessage.js";import{PasswordField as I}from"../password-field/PasswordField.js";const p=({validate:u,defaultValidation:f,messageDirection:v="row",label:b="Create a password",name:r="password",css:w,validation:y,appearance:C,...x})=>{var i;const{formState:o,control:n}=k(),[s,m]=a.useState(!1),[c,d]=a.useState(f),F=o.touched[r],h=((i=o.errors[r])==null?void 0:i.type)==="validate"||Object.values(c).every(e=>!e),l=a.useCallback(async e=>{const t=await u(e);return t?(E(typeof t=="object","The validate function must return an object"),d(t),Object.values(t).every(S=>S)):!1},[d]),g=a.useCallback(B(500,l),[l]),j=(e,t)=>e?"success":t?"neutral":"error",O=n.mode.isOnBlur&&(s||F)||n.mode.isOnSubmit&&(s||o.isSubmitted&&h);return a.createElement(P,{css:w},a.createElement(I,{label:b,name:r,onChange:e=>g(e.target.value),onBlur:()=>m(!1),onFocus:()=>m(!0),validation:{...y,validate:l},appearance:C,...x}),O&&a.createElement(D,{css:{mt:"$2",gap:"$2",flexWrap:"wrap",flexDirection:v}},Object.entries(c).map(([e,t])=>a.createElement($,{key:e,theme:j(t,s)},e))))};p.displayName="CreatePasswordField";export{p as CreatePasswordField};
1
+ import E from"invariant";import*as a from"react";import{useFormContext as k}from"react-hook-form";import{throttle as B}from"throttle-debounce";import{Box as P}from"../box/Box.js";import{Flex as D}from"../flex/Flex.js";import{InlineMessage as $}from"../inline-message/InlineMessage.js";import{PasswordField as I}from"../password-field/PasswordField.js";const p=({validate:u,defaultValidation:f,messageDirection:v="row",label:b="Create a password",name:r="password",css:y,validation:w,appearance:C,...x})=>{var l;const{formState:o,control:n}=k(),[s,m]=a.useState(!1),[c,d]=a.useState(f),F=o.touched[r],h=((l=o.errors[r])==null?void 0:l.type)==="validate"||Object.values(c).every(e=>!e),i=a.useCallback(async e=>{const t=await u(e);return t?(E(typeof t=="object","The validate function must return an object"),d(t),Object.values(t).every(S=>S)):!1},[d]),g=a.useCallback(B(500,i),[i]),j=(e,t)=>e?"success":t?"neutral":"error",O=n.mode.isOnBlur&&(s||F)||n.mode.isOnSubmit&&(s||o.isSubmitted&&h);return a.createElement(P,{css:y},a.createElement(I,{label:b,name:r,onChange:e=>g(e.target.value),onBlur:()=>m(!1),onFocus:()=>m(!0),validation:{...w,validate:i},appearance:C,...x}),O&&a.createElement(D,{style:{"--direction":v},css:{mt:"$2",gap:"$2",flexWrap:"wrap",flexDirection:"var(--direction)"}},Object.entries(c).map(([e,t])=>a.createElement($,{key:e,theme:j(t,s)},e))))};p.displayName="CreatePasswordField";export{p as CreatePasswordField};
2
2
  //# sourceMappingURL=CreatePasswordField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CreatePasswordField.js","sources":["../../../src/components/create-password-field/CreatePasswordField.tsx"],"sourcesContent":["import invariant from 'invariant'\nimport * as React from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { throttle } from 'throttle-debounce'\n\nimport type { CSS } from '~/stitches'\nimport { Override } from '~/utilities'\n\nimport { Box } from '../box'\nimport { FieldElementWrapperProps } from '../field-wrapper'\nimport { Flex } from '../flex'\nimport { InlineMessage } from '../inline-message'\nimport { PasswordField } from '../password-field'\nimport { PasswordInput } from '../password-input'\n\ntype ValidationResult = Record<string, boolean>\n\ntype CreatePasswordFieldProps = Override<\n React.ComponentProps<typeof PasswordInput> & FieldElementWrapperProps,\n {\n label?: string\n name?: string\n validate: (\n password: string\n ) => Promise<ValidationResult | undefined> | ValidationResult\n defaultValidation: ValidationResult\n messageDirection?: CSS['flexDirection']\n }\n>\n\nexport const CreatePasswordField = ({\n validate,\n defaultValidation,\n messageDirection = 'row',\n label = 'Create a password',\n name = 'password',\n css,\n validation,\n appearance,\n ...remainingProps\n}: CreatePasswordFieldProps) => {\n const { formState, control } = useFormContext()\n const [isFocused, setIsFocused] = React.useState<boolean>(false)\n const [validationResult, setValidationResult] =\n React.useState<ValidationResult>(defaultValidation)\n\n const touched: boolean = formState.touched[name]\n const error =\n formState.errors[name]?.type === 'validate' ||\n Object.values(validationResult).every((isValid) => !isValid)\n\n const validatePassword = React.useCallback(\n async (password: string) => {\n const result = await validate(password)\n\n if (result) {\n invariant(\n typeof result === 'object',\n 'The validate function must return an object'\n )\n\n setValidationResult(result)\n return Object.values(result).every((isValid) => isValid)\n }\n\n return false\n },\n [setValidationResult]\n )\n\n const handleChange = React.useCallback(throttle(500, validatePassword), [\n validatePassword\n ])\n\n const getMessageTheme = (result: boolean, isFocused: boolean) => {\n if (result) return 'success'\n\n return isFocused ? 'neutral' : 'error'\n }\n\n const showValidation: boolean =\n (control.mode.isOnBlur && (isFocused || touched)) ||\n (control.mode.isOnSubmit && (isFocused || (formState.isSubmitted && error)))\n\n return (\n <Box css={css}>\n <PasswordField\n label={label}\n name={name}\n onChange={(e) => handleChange(e.target.value)}\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n validation={{ ...validation, validate: validatePassword }}\n appearance={appearance}\n {...remainingProps}\n />\n {showValidation && (\n <Flex\n css={{\n mt: '$2',\n gap: '$2',\n flexWrap: 'wrap',\n flexDirection: messageDirection\n }}\n >\n {Object.entries(validationResult).map(([message, result]) => (\n <InlineMessage\n key={message}\n theme={getMessageTheme(result, isFocused)}\n >\n {message}\n </InlineMessage>\n ))}\n </Flex>\n )}\n </Box>\n )\n}\n\nCreatePasswordField.displayName = 'CreatePasswordField'\n"],"names":["CreatePasswordField","validate","defaultValidation","messageDirection","label","name","css","validation","appearance","remainingProps","_a","formState","control","useFormContext","isFocused","setIsFocused","React","validationResult","setValidationResult","touched","error","isValid","validatePassword","password","result","invariant","handleChange","throttle","getMessageTheme","showValidation","Box","PasswordField","Flex","message","InlineMessage"],"mappings":"gWA8Ba,MAAAA,EAAsB,CAAC,CAClC,SAAAC,EACA,kBAAAC,EACA,iBAAAC,EAAmB,MACnB,MAAAC,EAAQ,oBACR,KAAAC,EAAO,WACP,IAAAC,EACA,WAAAC,EACA,WAAAC,KACGC,CACL,IAAgC,CAxChC,IAAAC,EAyCE,KAAM,CAAE,UAAAC,EAAW,QAAAC,CAAQ,EAAIC,EAAe,EACxC,CAACC,EAAWC,CAAY,EAAIC,EAAM,SAAkB,EAAK,EACzD,CAACC,EAAkBC,CAAmB,EAC1CF,EAAM,SAA2Bd,CAAiB,EAE9CiB,EAAmBR,EAAU,QAAQN,GACrCe,IACJV,EAAAC,EAAU,OAAON,KAAjB,KAAA,OAAAK,EAAwB,QAAS,YACjC,OAAO,OAAOO,CAAgB,EAAE,MAAOI,GAAY,CAACA,CAAO,EAEvDC,EAAmBN,EAAM,YAC7B,MAAOO,GAAqB,CAC1B,MAAMC,EAAS,MAAMvB,EAASsB,CAAQ,EAEtC,OAAIC,GACFC,EACE,OAAOD,GAAW,SAClB,6CACF,EAEAN,EAAoBM,CAAM,EACnB,OAAO,OAAOA,CAAM,EAAE,MAAOH,GAAYA,CAAO,GAGlD,EACT,EACA,CAACH,CAAmB,CACtB,EAEMQ,EAAeV,EAAM,YAAYW,EAAS,IAAKL,CAAgB,EAAG,CACtEA,CACF,CAAC,EAEKM,EAAkB,CAACJ,EAAiBV,IACpCU,EAAe,UAEZV,EAAY,UAAY,QAG3Be,EACHjB,EAAQ,KAAK,WAAaE,GAAaK,IACvCP,EAAQ,KAAK,aAAeE,GAAcH,EAAU,aAAeS,GAEtE,OACEJ,EAAA,cAACc,EAAA,CAAI,IAAKxB,CACRU,EAAAA,EAAA,cAACe,EAAA,CACC,MAAO3B,EACP,KAAMC,EACN,SAAW,GAAMqB,EAAa,EAAE,OAAO,KAAK,EAC5C,OAAQ,IAAMX,EAAa,EAAK,EAChC,QAAS,IAAMA,EAAa,EAAI,EAChC,WAAY,CAAE,GAAGR,EAAY,SAAUe,CAAiB,EACxD,WAAYd,EACX,GAAGC,CAAAA,CACN,EACCoB,GACCb,EAAA,cAACgB,EAAA,CACC,IAAK,CACH,GAAI,KACJ,IAAK,KACL,SAAU,OACV,cAAe7B,CACjB,CAAA,EAEC,OAAO,QAAQc,CAAgB,EAAE,IAAI,CAAC,CAACgB,EAAST,CAAM,IACrDR,EAAA,cAACkB,EAAA,CACC,IAAKD,EACL,MAAOL,EAAgBJ,EAAQV,CAAS,CAAA,EAEvCmB,CACH,CACD,CACH,CAEJ,CAEJ,EAEAjC,EAAoB,YAAc"}
1
+ {"version":3,"file":"CreatePasswordField.js","sources":["../../../src/components/create-password-field/CreatePasswordField.tsx"],"sourcesContent":["import invariant from 'invariant'\nimport * as React from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { throttle } from 'throttle-debounce'\n\nimport type { CSS } from '~/stitches'\nimport { Override } from '~/utilities'\n\nimport { Box } from '../box'\nimport { FieldElementWrapperProps } from '../field-wrapper'\nimport { Flex } from '../flex'\nimport { InlineMessage } from '../inline-message'\nimport { PasswordField } from '../password-field'\nimport { PasswordInput } from '../password-input'\n\ntype ValidationResult = Record<string, boolean>\n\ntype CreatePasswordFieldProps = Override<\n React.ComponentProps<typeof PasswordInput> & FieldElementWrapperProps,\n {\n label?: string\n name?: string\n validate: (\n password: string\n ) => Promise<ValidationResult | undefined> | ValidationResult\n defaultValidation: ValidationResult\n messageDirection?: 'row' | 'column'\n }\n>\n\nexport const CreatePasswordField = ({\n validate,\n defaultValidation,\n messageDirection = 'row',\n label = 'Create a password',\n name = 'password',\n css,\n validation,\n appearance,\n ...remainingProps\n}: CreatePasswordFieldProps) => {\n const { formState, control } = useFormContext()\n const [isFocused, setIsFocused] = React.useState<boolean>(false)\n const [validationResult, setValidationResult] =\n React.useState<ValidationResult>(defaultValidation)\n\n const touched: boolean = formState.touched[name]\n const error =\n formState.errors[name]?.type === 'validate' ||\n Object.values(validationResult).every((isValid) => !isValid)\n\n const validatePassword = React.useCallback(\n async (password: string) => {\n const result = await validate(password)\n\n if (result) {\n invariant(\n typeof result === 'object',\n 'The validate function must return an object'\n )\n\n setValidationResult(result)\n return Object.values(result).every((isValid) => isValid)\n }\n\n return false\n },\n [setValidationResult]\n )\n\n const handleChange = React.useCallback(throttle(500, validatePassword), [\n validatePassword\n ])\n\n const getMessageTheme = (result: boolean, isFocused: boolean) => {\n if (result) return 'success'\n\n return isFocused ? 'neutral' : 'error'\n }\n\n const showValidation: boolean =\n (control.mode.isOnBlur && (isFocused || touched)) ||\n (control.mode.isOnSubmit && (isFocused || (formState.isSubmitted && error)))\n\n return (\n <Box css={css}>\n <PasswordField\n label={label}\n name={name}\n onChange={(e) => handleChange(e.target.value)}\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n validation={{ ...validation, validate: validatePassword }}\n appearance={appearance}\n {...remainingProps}\n />\n {showValidation && (\n <Flex\n style={{\n '--direction': messageDirection\n }}\n css={{\n mt: '$2',\n gap: '$2',\n flexWrap: 'wrap',\n flexDirection: 'var(--direction)'\n }}\n >\n {Object.entries(validationResult).map(([message, result]) => (\n <InlineMessage\n key={message}\n theme={getMessageTheme(result, isFocused)}\n >\n {message}\n </InlineMessage>\n ))}\n </Flex>\n )}\n </Box>\n )\n}\n\nCreatePasswordField.displayName = 'CreatePasswordField'\n"],"names":["CreatePasswordField","validate","defaultValidation","messageDirection","label","name","css","validation","appearance","remainingProps","_a","formState","control","useFormContext","isFocused","setIsFocused","React","validationResult","setValidationResult","touched","error","isValid","validatePassword","password","result","invariant","handleChange","throttle","getMessageTheme","showValidation","Box","PasswordField","Flex","message","InlineMessage"],"mappings":"gWA8Ba,MAAAA,EAAsB,CAAC,CAClC,SAAAC,EACA,kBAAAC,EACA,iBAAAC,EAAmB,MACnB,MAAAC,EAAQ,oBACR,KAAAC,EAAO,WACP,IAAAC,EACA,WAAAC,EACA,WAAAC,KACGC,CACL,IAAgC,CAxChC,IAAAC,EAyCE,KAAM,CAAE,UAAAC,EAAW,QAAAC,CAAQ,EAAIC,EACzB,EAAA,CAACC,EAAWC,CAAY,EAAIC,EAAM,SAAkB,EAAK,EACzD,CAACC,EAAkBC,CAAmB,EAC1CF,EAAM,SAA2Bd,CAAiB,EAE9CiB,EAAmBR,EAAU,QAAQN,GACrCe,IACJV,EAAAC,EAAU,OAAON,KAAjB,KAAA,OAAAK,EAAwB,QAAS,YACjC,OAAO,OAAOO,CAAgB,EAAE,MAAOI,GAAY,CAACA,CAAO,EAEvDC,EAAmBN,EAAM,YAC7B,MAAOO,GAAqB,CAC1B,MAAMC,EAAS,MAAMvB,EAASsB,CAAQ,EAEtC,OAAIC,GACFC,EACE,OAAOD,GAAW,SAClB,6CACF,EAEAN,EAAoBM,CAAM,EACnB,OAAO,OAAOA,CAAM,EAAE,MAAOH,GAAYA,CAAO,GAGlD,EACT,EACA,CAACH,CAAmB,CACtB,EAEMQ,EAAeV,EAAM,YAAYW,EAAS,IAAKL,CAAgB,EAAG,CACtEA,CACF,CAAC,EAEKM,EAAkB,CAACJ,EAAiBV,IACpCU,EAAe,UAEZV,EAAY,UAAY,QAG3Be,EACHjB,EAAQ,KAAK,WAAaE,GAAaK,IACvCP,EAAQ,KAAK,aAAeE,GAAcH,EAAU,aAAeS,GAEtE,OACEJ,EAAA,cAACc,EAAA,CAAI,IAAKxB,CAAAA,EACRU,EAAA,cAACe,EAAA,CACC,MAAO3B,EACP,KAAMC,EACN,SAAW,GAAMqB,EAAa,EAAE,OAAO,KAAK,EAC5C,OAAQ,IAAMX,EAAa,EAAK,EAChC,QAAS,IAAMA,EAAa,EAAI,EAChC,WAAY,CAAE,GAAGR,EAAY,SAAUe,CAAiB,EACxD,WAAYd,EACX,GAAGC,CACN,CAAA,EACCoB,GACCb,EAAA,cAACgB,EAAA,CACC,MAAO,CACL,cAAe7B,CACjB,EACA,IAAK,CACH,GAAI,KACJ,IAAK,KACL,SAAU,OACV,cAAe,kBACjB,CAAA,EAEC,OAAO,QAAQc,CAAgB,EAAE,IAAI,CAAC,CAACgB,EAAST,CAAM,IACrDR,EAAA,cAACkB,EAAA,CACC,IAAKD,EACL,MAAOL,EAAgBJ,EAAQV,CAAS,CAAA,EAEvCmB,CACH,CACD,CACH,CAEJ,CAEJ,EAEAjC,EAAoB,YAAc"}
@@ -793,7 +793,7 @@ export declare const DataTable: (({ columns, data: dataProp, getAsyncData, defau
793
793
  }, "ref"> & import("react").RefAttributes<HTMLTableElement>, "children" | "numberOfStickyColumns"> & Partial<Pick<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
794
794
  ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
795
795
  }, "css" | "theme" | "isSticky"> & import("@atom-learning/stitches-react/types/styled-component").TransformProps<{
796
- theme?: "light" | "primary" | "white" | "primaryDark" | "primaryLight" | undefined;
796
+ theme?: "light" | "white" | "primary" | "primaryDark" | "primaryLight" | undefined;
797
797
  isSticky?: boolean | "true" | undefined;
798
798
  }, {
799
799
  sm: string;
@@ -1937,7 +1937,7 @@ export declare const DataTable: (({ columns, data: dataProp, getAsyncData, defau
1937
1937
  marginBottom: string | number | import("@atom-learning/stitches-react/types/css-util").WithScaleValue<"space">;
1938
1938
  };
1939
1939
  }> | undefined;
1940
- }, "size" | "as" | "type"> & {
1940
+ }, "size" | "type" | "as"> & {
1941
1941
  size: import("react").ComponentProps<typeof import("..").Text>["size"];
1942
1942
  type?: "text" | "number" | "email" | "password" | "tel" | "url" | "search";
1943
1943
  as?: never;
@@ -1996,10 +1996,10 @@ export declare const DataTable: (({ columns, data: dataProp, getAsyncData, defau
1996
1996
  * If you need more customisation options, you can build your own implementation
1997
1997
  * with `useDataTable` and the UI-only `Table` components.
1998
1998
  */
1999
- Head: ({ sortable, theme, isSticky, stickyOffset, css, ...props }: Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
1999
+ Head: ({ sortable, theme, isSticky, stickyOffset, style, css, ...props }: Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & {
2000
2000
  ref?: ((instance: HTMLTableSectionElement | null) => void) | import("react").RefObject<HTMLTableSectionElement> | null | undefined;
2001
2001
  }, "css" | "theme" | "isSticky"> & import("@atom-learning/stitches-react/types/styled-component").TransformProps<{
2002
- theme?: "light" | "primary" | "white" | "primaryDark" | "primaryLight" | undefined;
2002
+ theme?: "light" | "white" | "primary" | "primaryDark" | "primaryLight" | undefined;
2003
2003
  isSticky?: boolean | "true" | undefined;
2004
2004
  }, {
2005
2005
  sm: string;
@@ -3570,11 +3570,11 @@ export declare const DataTable: (({ columns, data: dataProp, getAsyncData, defau
3570
3570
  */
3571
3571
  EmptyState: ({ children, ...rest }: Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3572
3572
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
3573
- }, "direction" | "gap" | "css" | "align" | "wrap" | "justify"> & import("@atom-learning/stitches-react/types/styled-component").TransformProps<{
3574
- direction?: "inherit" | "initial" | "revert" | "unset" | "row" | "column" | "column-reverse" | "row-reverse" | "revert-layer" | undefined;
3575
- wrap?: "inherit" | "initial" | "revert" | "unset" | "wrap" | "nowrap" | "wrap-reverse" | "revert-layer" | undefined;
3576
- justify?: "left" | "right" | "center" | "stretch" | "inherit" | "initial" | "revert" | "unset" | "end" | "start" | "space-around" | "space-between" | "space-evenly" | "flex-end" | "flex-start" | "normal" | "revert-layer" | "unsafe" | "safe" | undefined;
3577
- align?: "center" | "stretch" | "inherit" | "initial" | "revert" | "unset" | "end" | "start" | "flex-end" | "flex-start" | "baseline" | "normal" | "self-end" | "self-start" | "revert-layer" | "unsafe" | "safe" | "first baseline" | "last baseline" | undefined;
3573
+ }, "direction" | "gap" | "css" | "wrap" | "justify" | "align"> & import("@atom-learning/stitches-react/types/styled-component").TransformProps<{
3574
+ direction?: "inherit" | "initial" | "revert" | "unset" | "row" | "row-reverse" | "column" | "column-reverse" | "revert-layer" | undefined;
3575
+ wrap?: "inherit" | "initial" | "revert" | "unset" | "revert-layer" | "wrap" | "nowrap" | "wrap-reverse" | undefined;
3576
+ justify?: "left" | "right" | "center" | "stretch" | "inherit" | "initial" | "revert" | "unset" | "revert-layer" | "normal" | "unsafe" | "safe" | "start" | "end" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
3577
+ align?: "center" | "stretch" | "inherit" | "initial" | "revert" | "unset" | "revert-layer" | "normal" | "unsafe" | "safe" | "start" | "end" | "flex-start" | "flex-end" | "self-start" | "self-end" | "baseline" | "first baseline" | "last baseline" | undefined;
3578
3578
  gap?: number | "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "24" | undefined;
3579
3579
  }, {
3580
3580
  sm: string;
@@ -7,5 +7,5 @@ type DataTableHeadProps = Omit<React.ComponentProps<typeof Table.Header>, 'child
7
7
  stickyOffset?: number;
8
8
  headerCss?: CSS;
9
9
  };
10
- export declare const DataTableHead: ({ sortable, theme, isSticky, stickyOffset, css, ...props }: DataTableHeadProps) => React.ReactElement;
10
+ export declare const DataTableHead: ({ sortable, theme, isSticky, stickyOffset, style, css, ...props }: DataTableHeadProps) => React.ReactElement;
11
11
  export {};
@@ -1,2 +1,2 @@
1
- import*as t from"react";import{Table as s}from"../table/Table.js";import{DataTableSelectAllRowsCheckbox as C}from"./DataTableSelectAllRowsCheckbox.js";import{useDataTable as x}from"./DataTableContext.js";import{DataTable as H}from"./DataTable.js";const k=({sortable:u=!0,theme:h="light",isSticky:a=!1,stickyOffset:n=0,css:E,...v})=>{var d;const{getHeaderGroups:R,setIsSortable:m,enableRowSelection:w,getCanSomeRowsExpand:S,tablePosition:e,setTablePosition:g}=x();t.useEffect(()=>{m(u)},[u,m]);const l=t.useRef(null),i=t.useRef(null),T=t.useRef(0),[f,y]=t.useState(0),[c,p]=t.useState(!1),b=(d=l==null?void 0:l.current)==null?void 0:d.closest("thead");if(b&&(e==null?void 0:e.offsetTop)===null){const o=b.getBoundingClientRect().height,r=n+o;e&&g({...e,offsetTop:r||0})}return t.useEffect(()=>{if(!!a&&(!i.current&&l.current&&(i.current=l.current.closest("table")),i.current&&(e==null?void 0:e.top)!==null&&(e==null?void 0:e.bottom)!==null)){const o=(e==null?void 0:e.top)!=null&&(e==null?void 0:e.bottom)!=null&&e.top<n&&e.bottom>100?-e.top+n:0;o!==0&&p(!0),T.current=o,y(o),requestAnimationFrame(()=>{p(!1)})}},[a,n,e]),t.createElement(s.Header,{theme:h,css:{position:"relative",zIndex:3,"& tr:not(:last-child) > th":{borderBottom:"none"},"& tr:not(:first-child) > th":{borderRadius:"0 !important"},...E},...v},R().map(o=>t.createElement(s.Row,{key:o.id,ref:l,css:{...a&&f!==0&&{transform:`translateY(${f}px)`,opacity:c?0:1,transition:c?"none":"opacity 100ms",transitionDelay:c?"0ms":"150ms","& th:last-child:before":{content:"",position:"absolute",right:0,top:0,bottom:0,width:"100%",boxShadow:"$0",pointerEvents:"none"}}}},S()&&t.createElement(s.HeaderCell,{css:{width:"$4"}}),w&&t.createElement(s.HeaderCell,{css:{width:"$4"}},t.createElement(C,null)),o.headers.map(r=>t.createElement(H.HeaderCell,{header:r,key:r.id})))))};export{k as DataTableHead};
1
+ import*as t from"react";import{Table as s}from"../table/Table.js";import{DataTableSelectAllRowsCheckbox as C}from"./DataTableSelectAllRowsCheckbox.js";import{useDataTable as D}from"./DataTableContext.js";import{DataTable as H}from"./DataTable.js";const k=({sortable:u=!0,theme:h="light",isSticky:a=!1,stickyOffset:r=0,style:v,css:E,...R})=>{var d;const{getHeaderGroups:w,setIsSortable:m,enableRowSelection:y,getCanSomeRowsExpand:S,tablePosition:e,setTablePosition:g}=D();t.useEffect(()=>{m(u)},[u,m]);const l=t.useRef(null),i=t.useRef(null),T=t.useRef(0),[f,x]=t.useState(0),[c,p]=t.useState(!1),b=(d=l==null?void 0:l.current)==null?void 0:d.closest("thead");if(b&&(e==null?void 0:e.offsetTop)===null){const o=b.getBoundingClientRect().height,n=r+o;e&&g({...e,offsetTop:n||0})}return t.useEffect(()=>{if(!!a&&(!i.current&&l.current&&(i.current=l.current.closest("table")),i.current&&(e==null?void 0:e.top)!==null&&(e==null?void 0:e.bottom)!==null)){const o=(e==null?void 0:e.top)!=null&&(e==null?void 0:e.bottom)!=null&&e.top<r&&e.bottom>100?-e.top+r:0;o!==0&&p(!0),T.current=o,x(o),requestAnimationFrame(()=>{p(!1)})}},[a,r,e]),t.createElement(s.Header,{theme:h,style:{...v,"--header-offset":`${f}px`},css:{position:"relative",zIndex:3,"& tr:not(:last-child) > th":{borderBottom:"none"},"& tr:not(:first-child) > th":{borderRadius:"0 !important"},...E},...R},w().map(o=>t.createElement(s.Row,{key:o.id,ref:l,css:{...a&&f!==0&&{transform:"translateY(var(--header-offset))",opacity:c?0:1,transition:c?"none":"opacity 100ms",transitionDelay:c?"0ms":"150ms","& th:last-child:before":{content:"",position:"absolute",right:0,top:0,bottom:0,width:"100%",boxShadow:"$0",pointerEvents:"none"}}}},S()&&t.createElement(s.HeaderCell,{css:{width:"$4"}}),y&&t.createElement(s.HeaderCell,{css:{width:"$4"}},t.createElement(C,null)),o.headers.map(n=>t.createElement(H.HeaderCell,{header:n,key:n.id})))))};export{k as DataTableHead};
2
2
  //# sourceMappingURL=DataTableHead.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableHead.js","sources":["../../../src/components/data-table/DataTableHead.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { CSS } from '~/stitches'\n\nimport { Table } from '../table'\nimport { DataTableSelectAllRowsCheckbox } from './DataTableSelectAllRowsCheckbox'\nimport { DataTable, useDataTable } from './index'\n\ntype DataTableHeadProps = Omit<\n React.ComponentProps<typeof Table.Header>,\n 'children'\n> & {\n sortable?: boolean\n isSticky?: boolean\n stickyOffset?: number\n headerCss?: CSS\n}\n\nexport const DataTableHead = ({\n sortable = true,\n theme = 'light',\n isSticky = false,\n stickyOffset = 0,\n css,\n ...props\n}: DataTableHeadProps): React.ReactElement => {\n const {\n getHeaderGroups,\n setIsSortable,\n enableRowSelection,\n getCanSomeRowsExpand,\n tablePosition,\n setTablePosition\n } = useDataTable()\n\n React.useEffect(() => {\n setIsSortable(sortable)\n }, [sortable, setIsSortable])\n\n const tableHeaderRowRef = React.useRef<HTMLTableRowElement>(null)\n const tableRef = React.useRef<HTMLTableElement | null>(null)\n const headerOffsetRef = React.useRef(0)\n\n const [headerOffset, setHeaderOffset] = React.useState<number>(0)\n const [headerHide, setHeaderHide] = React.useState<boolean>(false)\n\n const tableHeadElement = tableHeaderRowRef?.current?.closest('thead')\n\n if (tableHeadElement && tablePosition?.offsetTop === null) {\n const tableHeadHeight = tableHeadElement.getBoundingClientRect().height\n const intersectionOffset = stickyOffset + tableHeadHeight\n if (tablePosition) {\n setTablePosition({ ...tablePosition, offsetTop: intersectionOffset || 0 })\n }\n }\n\n React.useEffect(() => {\n if (!isSticky) return\n\n if (!tableRef.current && tableHeaderRowRef.current) {\n tableRef.current = tableHeaderRowRef.current.closest(\n 'table'\n ) as HTMLTableElement | null\n }\n\n if (tableRef.current) {\n if (tablePosition?.top !== null && tablePosition?.bottom !== null) {\n const newOffset =\n tablePosition?.top != null &&\n tablePosition?.bottom != null &&\n tablePosition.top < stickyOffset &&\n tablePosition.bottom > 100\n ? -tablePosition.top + stickyOffset\n : 0\n\n if (newOffset !== 0) setHeaderHide(true)\n\n headerOffsetRef.current = newOffset\n setHeaderOffset(newOffset)\n\n requestAnimationFrame(() => {\n setHeaderHide(false)\n })\n }\n }\n }, [isSticky, stickyOffset, tablePosition])\n\n return (\n <Table.Header\n theme={theme}\n css={{\n position: 'relative',\n zIndex: 3,\n '& tr:not(:last-child) > th': {\n borderBottom: 'none'\n },\n '& tr:not(:first-child) > th': {\n borderRadius: '0 !important'\n },\n ...css\n }}\n {...props}\n >\n {getHeaderGroups().map((headerGroup) => {\n return (\n <Table.Row\n key={headerGroup.id}\n ref={tableHeaderRowRef}\n css={{\n ...(isSticky &&\n headerOffset !== 0 && {\n transform: `translateY(${headerOffset}px)`,\n opacity: headerHide ? 0 : 1,\n transition: headerHide ? 'none' : `opacity 100ms`,\n transitionDelay: headerHide ? '0ms' : `150ms`,\n '& th:last-child:before': {\n content: '',\n position: 'absolute',\n right: 0,\n top: 0,\n bottom: 0,\n width: '100%',\n boxShadow: '$0',\n pointerEvents: 'none'\n }\n })\n }}\n >\n {getCanSomeRowsExpand() && (\n <Table.HeaderCell css={{ width: '$4' }} />\n )}\n {enableRowSelection && (\n <Table.HeaderCell css={{ width: '$4' }}>\n <DataTableSelectAllRowsCheckbox />\n </Table.HeaderCell>\n )}\n {headerGroup.headers.map((header) => (\n <DataTable.HeaderCell header={header} key={header.id} />\n ))}\n </Table.Row>\n )\n })}\n </Table.Header>\n )\n}\n"],"names":["DataTableHead","sortable","theme","isSticky","stickyOffset","css","props","_a","getHeaderGroups","setIsSortable","enableRowSelection","getCanSomeRowsExpand","tablePosition","setTablePosition","useDataTable","React","tableHeaderRowRef","tableRef","headerOffsetRef","headerOffset","setHeaderOffset","headerHide","setHeaderHide","tableHeadElement","tableHeadHeight","intersectionOffset","newOffset","Table","headerGroup","DataTableSelectAllRowsCheckbox","header","DataTable"],"mappings":"uPAkBO,MAAMA,EAAgB,CAAC,CAC5B,SAAAC,EAAW,GACX,MAAAC,EAAQ,QACR,SAAAC,EAAW,GACX,aAAAC,EAAe,EACf,IAAAC,KACGC,CACL,IAA8C,CAzB9C,IAAAC,EA0BE,KAAM,CACJ,gBAAAC,EACA,cAAAC,EACA,mBAAAC,EACA,qBAAAC,EACA,cAAAC,EACA,iBAAAC,CACF,EAAIC,IAEJC,EAAM,UAAU,IAAM,CACpBN,EAAcR,CAAQ,CACxB,EAAG,CAACA,EAAUQ,CAAa,CAAC,EAE5B,MAAMO,EAAoBD,EAAM,OAA4B,IAAI,EAC1DE,EAAWF,EAAM,OAAgC,IAAI,EACrDG,EAAkBH,EAAM,OAAO,CAAC,EAEhC,CAACI,EAAcC,CAAe,EAAIL,EAAM,SAAiB,CAAC,EAC1D,CAACM,EAAYC,CAAa,EAAIP,EAAM,SAAkB,EAAK,EAE3DQ,GAAmBhB,EAAAS,GAAA,KAAAA,OAAAA,EAAmB,UAAnB,KAAAT,OAAAA,EAA4B,QAAQ,OAAA,EAE7D,GAAIgB,IAAoBX,GAAA,YAAAA,EAAe,aAAc,KAAM,CACzD,MAAMY,EAAkBD,EAAiB,wBAAwB,OAC3DE,EAAqBrB,EAAeoB,EACtCZ,GACFC,EAAiB,CAAE,GAAGD,EAAe,UAAWa,GAAsB,CAAE,CAAC,CAE7E,CAEA,OAAAV,EAAM,UAAU,IAAM,CACpB,GAAI,EAACZ,IAED,CAACc,EAAS,SAAWD,EAAkB,UACzCC,EAAS,QAAUD,EAAkB,QAAQ,QAC3C,OACF,GAGEC,EAAS,UACPL,GAAA,YAAAA,EAAe,OAAQ,OAAQA,GAAA,KAAA,OAAAA,EAAe,UAAW,MAAM,CACjE,MAAMc,GACJd,GAAA,KAAAA,OAAAA,EAAe,MAAO,O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x"],"sourcesContent":["import * as React from 'react'\n\nimport { CSS } from '~/stitches'\n\nimport { Table } from '../table'\nimport { DataTableSelectAllRowsCheckbox } from './DataTableSelectAllRowsCheckbox'\nimport { DataTable, useDataTable } from './index'\n\ntype DataTableHeadProps = Omit<\n React.ComponentProps<typeof Table.Header>,\n 'children'\n> & {\n sortable?: boolean\n isSticky?: boolean\n stickyOffset?: number\n headerCss?: CSS\n}\n\nexport const DataTableHead = ({\n sortable = true,\n theme = 'light',\n isSticky = false,\n stickyOffset = 0,\n style,\n css,\n ...props\n}: DataTableHeadProps): React.ReactElement => {\n const {\n getHeaderGroups,\n setIsSortable,\n enableRowSelection,\n getCanSomeRowsExpand,\n tablePosition,\n setTablePosition\n } = useDataTable()\n\n React.useEffect(() => {\n setIsSortable(sortable)\n }, [sortable, setIsSortable])\n\n const tableHeaderRowRef = React.useRef<HTMLTableRowElement>(null)\n const tableRef = React.useRef<HTMLTableElement | null>(null)\n const headerOffsetRef = React.useRef(0)\n\n const [headerOffset, setHeaderOffset] = React.useState<number>(0)\n const [headerHide, setHeaderHide] = React.useState<boolean>(false)\n\n const tableHeadElement = tableHeaderRowRef?.current?.closest('thead')\n\n if (tableHeadElement && tablePosition?.offsetTop === null) {\n const tableHeadHeight = tableHeadElement.getBoundingClientRect().height\n const intersectionOffset = stickyOffset + tableHeadHeight\n if (tablePosition) {\n setTablePosition({ ...tablePosition, offsetTop: intersectionOffset || 0 })\n }\n }\n\n React.useEffect(() => {\n if (!isSticky) return\n\n if (!tableRef.current && tableHeaderRowRef.current) {\n tableRef.current = tableHeaderRowRef.current.closest(\n 'table'\n ) as HTMLTableElement | null\n }\n\n if (tableRef.current) {\n if (tablePosition?.top !== null && tablePosition?.bottom !== null) {\n const newOffset =\n tablePosition?.top != null &&\n tablePosition?.bottom != null &&\n tablePosition.top < stickyOffset &&\n tablePosition.bottom > 100\n ? -tablePosition.top + stickyOffset\n : 0\n\n if (newOffset !== 0) setHeaderHide(true)\n\n headerOffsetRef.current = newOffset\n setHeaderOffset(newOffset)\n\n requestAnimationFrame(() => {\n setHeaderHide(false)\n })\n }\n }\n }, [isSticky, stickyOffset, tablePosition])\n\n return (\n <Table.Header\n theme={theme}\n style={{\n ...style,\n '--header-offset': `${headerOffset}px`\n }}\n css={{\n position: 'relative',\n zIndex: 3,\n '& tr:not(:last-child) > th': {\n borderBottom: 'none'\n },\n '& tr:not(:first-child) > th': {\n borderRadius: '0 !important'\n },\n ...css\n }}\n {...props}\n >\n {getHeaderGroups().map((headerGroup) => {\n return (\n <Table.Row\n key={headerGroup.id}\n ref={tableHeaderRowRef}\n css={{\n ...(isSticky &&\n headerOffset !== 0 && {\n transform: `translateY(var(--header-offset))`,\n opacity: headerHide ? 0 : 1,\n transition: headerHide ? 'none' : `opacity 100ms`,\n transitionDelay: headerHide ? '0ms' : `150ms`,\n '& th:last-child:before': {\n content: '',\n position: 'absolute',\n right: 0,\n top: 0,\n bottom: 0,\n width: '100%',\n boxShadow: '$0',\n pointerEvents: 'none'\n }\n })\n }}\n >\n {getCanSomeRowsExpand() && (\n <Table.HeaderCell css={{ width: '$4' }} />\n )}\n {enableRowSelection && (\n <Table.HeaderCell css={{ width: '$4' }}>\n <DataTableSelectAllRowsCheckbox />\n </Table.HeaderCell>\n )}\n {headerGroup.headers.map((header) => (\n <DataTable.HeaderCell header={header} key={header.id} />\n ))}\n </Table.Row>\n )\n })}\n </Table.Header>\n )\n}\n"],"names":["DataTableHead","sortable","theme","isSticky","stickyOffset","style","css","props","_a","getHeaderGroups","setIsSortable","enableRowSelection","getCanSomeRowsExpand","tablePosition","setTablePosition","useDataTable","React","tableHeaderRowRef","tableRef","headerOffsetRef","headerOffset","setHeaderOffset","headerHide","setHeaderHide","tableHeadElement","tableHeadHeight","intersectionOffset","newOffset","Table","headerGroup","DataTableSelectAllRowsCheckbox","header","DataTable"],"mappings":"uPAkBa,MAAAA,EAAgB,CAAC,CAC5B,SAAAC,EAAW,GACX,MAAAC,EAAQ,QACR,SAAAC,E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BN,EAAgBM,CAAS,EAEzB,sBAAsB,IAAM,CAC1BJ,EAAc,EAAK,CACrB,CAAC,CACH,CAEJ,EAAG,CAACpB,EAAUC,EAAcS,CAAa,CAAC,EAGxCG,EAAA,cAACY,EAAM,OAAN,CACC,MAAO1B,EACP,MAAO,CACL,GAAGG,EACH,kBAAmB,GAAGe,KACxB,EACA,IAAK,CACH,SAAU,WACV,OAAQ,EACR,6BAA8B,CAC5B,aAAc,MAChB,EACA,8BAA+B,CAC7B,aAAc,cAChB,EACA,GAAGd,CACL,EACC,GAAGC,GAEHE,EAAgB,EAAE,IAAKoB,GAEpBb,EAAA,cAACY,EAAM,IAAN,CACC,IAAKC,EAAY,GACjB,IAAKZ,EACL,IAAK,CACH,GAAId,GACFiB,IAAiB,GAAK,CACpB,UAAW,mCACX,QAASE,EAAa,EAAI,EAC1B,WAAYA,EAAa,OAAS,gBAClC,gBAAiBA,EAAa,MAAQ,QACtC,yBAA0B,CACxB,QAAS,GACT,SAAU,WACV,MAAO,EACP,IAAK,EACL,OAAQ,EACR,MAAO,OACP,UAAW,KACX,cAAe,MACjB,CACF,CACJ,CAECV,EAAAA,KACCI,EAAA,cAACY,EAAM,WAAN,CAAiB,IAAK,CAAE,MAAO,IAAK,CAAA,CAAG,EAEzCjB,GACCK,EAAA,cAACY,EAAM,WAAN,CAAiB,IAAK,CAAE,MAAO,IAAK,CAAA,EACnCZ,EAAA,cAACc,EAAA,IAA+B,CAClC,EAEDD,EAAY,QAAQ,IAAKE,GACxBf,EAAA,cAACgB,EAAU,WAAV,CAAqB,OAAQD,EAAQ,IAAKA,EAAO,EAAA,CAAI,CACvD,CACH,CAEH,CACH,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{ArrowUp as u,ArrowDown as b}from"@atom-learning/icons";import{styled as g}from"@atom-learning/stitches-react";import{flexRender as y}from"@tanstack/react-table";import*as t from"react";import{useHover as v}from"react-aria";import{Flex as s}from"../flex/Flex.js";import{Icon as x}from"../icon/Icon.js";import{Table as S}from"../table/Table.js";import{useDataTable as h}from"./DataTableContext.js";const D=g(S.HeaderCell,{variants:{isSortable:{true:{cursor:"pointer",position:"relative","& > *":{position:"relative"},"&:before":{content:"",position:"absolute",inset:0,opacity:0,backgroundColor:"$primary100",transition:"opacity 0.2s ease"},"&:hover:before":{opacity:.5}}}}}),k={asc:u,desc:b},w=({direction:e})=>t.createElement(x,{is:k[e],size:"sm",css:{position:"absolute",left:"$1",stroke:"$primary900"}}),C=({header:e,children:E,css:l,...c})=>{const a=e.column.getIsSorted(),{isSortable:o}=h(),i=e.column.getCanSort(),{hoverProps:m,isHovered:p}=v({}),d=(r,f)=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),f(r))},n=e.column.getToggleSortingHandler();return t.createElement(D,{isSortable:o&&i,colSpan:e.colSpan,onClick:o&&i&&n?n:void 0,onKeyDown:r=>o&&i&&n&&d(r,n),tabIndex:o&&i?0:-1,...m,css:l,...c},t.createElement(s,{align:"center",justify:e.colSpan>1?"center":"flex-start"},y(e.column.columnDef.header,e.getContext()),a&&o&&t.createElement(s,{align:"center",css:{position:"relative",width:"24px",height:"24px",ml:"$2",bg:p?"$primary200":"$primary100",borderRadius:"$0"}},t.createElement(w,{direction:a}))))};export{C as DataTableHeaderCell};
1
+ import{ArrowUp as u,ArrowDown as b}from"@atom-learning/icons";import{styled as g}from"@atom-learning/stitches-react";import{flexRender as y}from"@tanstack/react-table";import*as t from"react";import{useHover as v}from"react-aria";import{Flex as s}from"../flex/Flex.js";import{Icon as x}from"../icon/Icon.js";import{Table as S}from"../table/Table.js";import{useDataTable as h}from"./DataTableContext.js";const D=g(S.HeaderCell,{variants:{isSortable:{true:{cursor:"pointer",position:"relative","& > *":{position:"relative"},"&:before":{content:"",position:"absolute",inset:0,opacity:0,backgroundColor:"$primary100",transition:"opacity 200ms ease"},"&:hover":{"&::before":{opacity:.5}}}}}}),k={asc:u,desc:b},w=({direction:e})=>t.createElement(x,{is:k[e],size:"sm",css:{position:"absolute",left:"$1",stroke:"$primary900"}}),C=({header:e,children:E,css:l,...c})=>{const a=e.column.getIsSorted(),{isSortable:o}=h(),i=e.column.getCanSort(),{hoverProps:m,isHovered:p}=v({}),d=(r,f)=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),f(r))},n=e.column.getToggleSortingHandler();return t.createElement(D,{isSortable:o&&i,colSpan:e.colSpan,onClick:o&&i&&n?n:void 0,onKeyDown:r=>o&&i&&n&&d(r,n),tabIndex:o&&i?0:-1,...m,css:l,...c},t.createElement(s,{align:"center",justify:e.colSpan>1?"center":"flex-start"},y(e.column.columnDef.header,e.getContext()),a&&o&&t.createElement(s,{align:"center",css:{position:"relative",width:"24px",height:"24px",ml:"$2",bg:p?"$primary200":"$primary100",borderRadius:"$0"}},t.createElement(w,{direction:a}))))};export{C as DataTableHeaderCell};
2
2
  //# sourceMappingURL=DataTableHeaderCell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableHeaderCell.js","sources":["../../../src/components/data-table/DataTableHeaderCell.tsx"],"sourcesContent":["import { ArrowDown, ArrowUp } from '@atom-learning/icons'\nimport { styled } from '@atom-learning/stitches-react'\nimport type { Header } from '@tanstack/react-table'\nimport { flexRender } from '@tanstack/react-table'\nimport * as React from 'react'\nimport { useHover } from 'react-aria'\n\nimport { Flex } from '../flex'\nimport { Icon } from '../icon'\nimport { Table } from '../table'\nimport { useDataTable } from './DataTableContext'\ntype DataTableHeaderProps = React.ComponentProps<typeof Table.HeaderCell> & {\n header: Header<Record<string, unknown>, unknown>\n}\n\nconst StyledTableHeaderCell = styled(Table.HeaderCell, {\n variants: {\n isSortable: {\n true: {\n cursor: 'pointer',\n position: 'relative',\n '& > *': {\n position: 'relative'\n },\n '&:before': {\n content: '',\n position: 'absolute',\n inset: 0,\n opacity: 0,\n backgroundColor: '$primary100',\n transition: 'opacity 0.2s ease'\n },\n '&:hover:before': {\n opacity: 0.5\n }\n }\n }\n }\n})\n\nconst sortIcons = {\n asc: ArrowUp,\n desc: ArrowDown\n}\n\nconst SortIcon = ({ direction }: { direction: 'asc' | 'desc' }) => (\n <Icon\n is={sortIcons[direction]}\n size=\"sm\"\n css={{ position: 'absolute', left: '$1', stroke: '$primary900' }}\n />\n)\n\nexport const DataTableHeaderCell = ({\n header,\n children,\n css,\n ...props\n}: DataTableHeaderProps) => {\n const sortDirection = header.column.getIsSorted()\n const { isSortable: isSortableTable } = useDataTable()\n // false for display columns, e.g. \"Actions\"\n const isDataColumn = header.column.getCanSort()\n\n const { hoverProps, isHovered } = useHover({})\n\n const handleKeyDown = (\n event: React.KeyboardEvent<HTMLTableCellElement>,\n callback: (event: unknown) => void | undefined\n ) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n callback(event as unknown)\n }\n }\n\n const headerSortingHandler = header.column.getToggleSortingHandler()\n\n return (\n <StyledTableHeaderCell\n isSortable={isSortableTable && isDataColumn}\n colSpan={header.colSpan}\n onClick={\n isSortableTable && isDataColumn && headerSortingHandler\n ? headerSortingHandler\n : undefined\n }\n onKeyDown={(event) =>\n isSortableTable &&\n isDataColumn &&\n headerSortingHandler &&\n handleKeyDown(event, headerSortingHandler)\n }\n tabIndex={isSortableTable && isDataColumn ? 0 : -1}\n {...hoverProps}\n css={css}\n {...props}\n >\n <Flex\n align=\"center\"\n justify={header.colSpan > 1 ? 'center' : 'flex-start'}\n >\n {flexRender(header.column.columnDef.header, header.getContext())}\n {sortDirection && isSortableTable && (\n <Flex\n align=\"center\"\n css={{\n position: 'relative',\n width: '24px',\n height: '24px',\n ml: '$2',\n bg: isHovered ? '$primary200' : '$primary100',\n borderRadius: '$0'\n }}\n >\n <SortIcon direction={sortDirection} />\n </Flex>\n )}\n </Flex>\n </StyledTableHeaderCell>\n )\n}\n"],"names":["StyledTableHeaderCell","styled","Table","sortIcons","ArrowUp","ArrowDown","SortIcon","direction","React","Icon","DataTableHeaderCell","header","children","css","props","sortDirection","isSortableTable","useDataTable","isDataColumn","hoverProps","isHovered","useHover","handleKeyDown","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SAAW,YAExCgB,EAAAA,EAAWhB,EAAO,OAAO,UAAU,OAAQA,EAAO,WAAA,CAAY,EAC9DI,GAAiBC,GAChBR,EAAA,cAACkB,EAAA,CACC,MAAM,SACN,IAAK,CACH,SAAU,WACV,MAAO,OACP,OAAQ,OACR,GAAI,KACJ,GAAIN,EAAY,cAAgB,cAChC,aAAc,IAChB,GAEAZ,EAAA,cAACF,EAAA,CAAS,UAAWS,CAAAA,CAAe,CACtC,CAEJ,CACF,CAEJ"}
1
+ {"version":3,"file":"DataTableHeaderCell.js","sources":["../../../src/components/data-table/DataTableHeaderCell.tsx"],"sourcesContent":["import { ArrowDown, ArrowUp } from '@atom-learning/icons'\nimport { styled } from '@atom-learning/stitches-react'\nimport type { Header } from '@tanstack/react-table'\nimport { flexRender } from '@tanstack/react-table'\nimport * as React from 'react'\nimport { useHover } from 'react-aria'\n\nimport { Flex } from '../flex'\nimport { Icon } from '../icon'\nimport { Table } from '../table'\nimport { useDataTable } from './DataTableContext'\ntype DataTableHeaderProps = React.ComponentProps<typeof Table.HeaderCell> & {\n header: Header<Record<string, unknown>, unknown>\n}\n\nconst StyledTableHeaderCell = styled(Table.HeaderCell, {\n variants: {\n isSortable: {\n true: {\n cursor: 'pointer',\n position: 'relative',\n '& > *': {\n position: 'relative'\n },\n '&:before': {\n content: '',\n position: 'absolute',\n inset: 0,\n opacity: 0,\n backgroundColor: '$primary100',\n transition: 'opacity 200ms ease'\n },\n '&:hover': {\n '&::before': {\n opacity: 0.5\n }\n }\n }\n }\n }\n})\n\nconst sortIcons = {\n asc: ArrowUp,\n desc: ArrowDown\n}\n\nconst SortIcon = ({ direction }: { direction: 'asc' | 'desc' }) => (\n <Icon\n is={sortIcons[direction]}\n size=\"sm\"\n css={{ position: 'absolute', left: '$1', stroke: '$primary900' }}\n />\n)\n\nexport const DataTableHeaderCell = ({\n header,\n children,\n css,\n ...props\n}: DataTableHeaderProps) => {\n const sortDirection = header.column.getIsSorted()\n const { isSortable: isSortableTable } = useDataTable()\n // false for display columns, e.g. \"Actions\"\n const isDataColumn = header.column.getCanSort()\n\n const { hoverProps, isHovered } = useHover({})\n\n const handleKeyDown = (\n event: React.KeyboardEvent<HTMLTableCellElement>,\n callback: (event: unknown) => void | undefined\n ) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n callback(event as unknown)\n }\n }\n\n const headerSortingHandler = header.column.getToggleSortingHandler()\n\n return (\n <StyledTableHeaderCell\n isSortable={isSortableTable && isDataColumn}\n colSpan={header.colSpan}\n onClick={\n isSortableTable && isDataColumn && headerSortingHandler\n ? headerSortingHandler\n : undefined\n }\n onKeyDown={(event) =>\n isSortableTable &&\n isDataColumn &&\n headerSortingHandler &&\n handleKeyDown(event, headerSortingHandler)\n }\n tabIndex={isSortableTable && isDataColumn ? 0 : -1}\n {...hoverProps}\n css={css}\n {...props}\n >\n <Flex\n align=\"center\"\n justify={header.colSpan > 1 ? 'center' : 'flex-start'}\n >\n {flexRender(header.column.columnDef.header, header.getContext())}\n {sortDirection && isSortableTable && (\n <Flex\n align=\"center\"\n css={{\n position: 'relative',\n width: '24px',\n height: '24px',\n ml: '$2',\n bg: isHovered ? '$primary200' : '$primary100',\n borderRadius: '$0'\n }}\n >\n <SortIcon direction={sortDirection} />\n </Flex>\n )}\n </Flex>\n </StyledTableHeaderCell>\n )\n}\n"],"names":["StyledTableHeaderCell","styled","Table","sortIcons","ArrowUp","ArrowDown","SortIcon","direction","React","Icon","DataTableHeaderCell","header","children","css","props","sortDirection","isSortableTable","useDataTable","isDataColumn","hoverProps","isHovered","useHover","handleKeyDown","event","callback","headerSortingHandler","Flex","flexRender"],"mappings":"mZAeA,MAAMA,EAAwBC,EAAOC,EAAM,WAAY,CACrD,SAAU,CACR,WAAY,CACV,KAAM,CACJ,OAAQ,UACR,SAAU,WACV,QAAS,CACP,SAAU,UACZ,EACA,WAAY,CACV,QAAS,GACT,SAAU,WACV,MAAO,EACP,QAAS,EACT,gBAAiB,cACjB,WAAY,oBACd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,cAACF,EAAA,CAAS,UAAWS,CAAAA,CAAe,CACtC,CAEJ,CACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{ChevronDown as x,ChevronRight as w}from"@atom-learning/icons";import*as n from"react";import{styled as h}from"../../stitches.js";import{Icon as C}from"../icon/Icon.js";import{Table as i}from"../table/Table.js";import{useDataTable as E}from"./DataTableContext.js";import{DataTableDataCell as D}from"./DataTableDataCell.js";import{DataTableRowSelectionCheckbox as S}from"./DataTableRowSelectionCheckbox.js";const v=h(i.Row,{bg:"initial",variants:{isSelected:{true:{["&:nth-child(odd), &:nth-child(even)"]:{bg:"$primary100"}}},isDisabled:{true:{opacity:"30%"}},isFocusable:{true:{transition:"transform 150ms ease-in-out, box-shadow 150ms ease-in-out","&:hover":{transform:"translateY(-1px)",boxShadow:"0px 4px 11px 0px hsla(0, 0%, 12%, 0.12)",position:"relative",zIndex:3},"&:focus":{outline:"2px solid $primary500",outlineOffset:"-4px","& td":{bg:"transparent"}}}}}}),d=e=>e?!!(e.closest("button, a, input, select, textarea")||e.getAttribute("role")==="button"):!1,k=({row:e,rowAction:r})=>{const{enableRowSelection:m,disabledRows:l,getCanSomeRowsExpand:p}=E(),s=!!(l!=null&&l[e.id]),g=e.getToggleExpandedHandler(),u=e.getToggleSelectedHandler(),b=()=>e.getIsSomeSelected()?"indeterminate":e.getIsSelected(),c=(t,o)=>{!r||!o.target.closest("tr")||d(o.target)||r(t.original,o)},f=t=>{if(t.key==="Enter"||t.key===" "){if(d(t.target))return;t.preventDefault(),c(e,t)}if(t.key==="ArrowDown"){t.preventDefault();const o=t.target.closest("tr"),a=o==null?void 0:o.nextElementSibling;a&&a.tagName==="TR"&&a.focus()}if(t.key==="ArrowUp"){t.preventDefault();const o=t.target.closest("tr"),a=o==null?void 0:o.previousElementSibling;a&&a.tagName==="TR"&&a.focus()}};return n.createElement(v,{isSelected:e.getIsSelected(),isDisabled:s,isFocusable:!!r&&!s,...r&&{onClick:t=>c(e,t),tabIndex:0,css:{cursor:"pointer"},onKeyDown:f}},p()&&n.createElement(i.Cell,{"data-testid":`expand-icon-${e.id}`,css:{width:"$4",cursor:e.getCanExpand()?"pointer":"auto"},onClick:g},e.getCanExpand()&&n.createElement(C,{is:e.getIsExpanded()?x:w})),m&&n.createElement(i.Cell,{css:{width:"$4"}},n.createElement(S,{row:e,checked:b(),onCheckedChange:u})),e.getVisibleCells().map((t,o)=>n.createElement(D,{key:t.id,cell:t})))};export{k as DataTableRow};
1
+ import{ChevronDown as x,ChevronRight as w}from"@atom-learning/icons";import*as n from"react";import{styled as h}from"../../stitches.js";import{Icon as C}from"../icon/Icon.js";import{Table as i}from"../table/Table.js";import{useDataTable as E}from"./DataTableContext.js";import{DataTableDataCell as D}from"./DataTableDataCell.js";import{DataTableRowSelectionCheckbox as S}from"./DataTableRowSelectionCheckbox.js";const v=h(i.Row,{bg:"initial",variants:{isSelected:{true:{"&:nth-child(odd), &:nth-child(even)":{bg:"$primary100"}}},isDisabled:{true:{opacity:"30%"}},isFocusable:{true:{transition:"transform 150ms ease-in-out, box-shadow 150ms ease-in-out","&:hover":{transform:"translateY(-1px)",boxShadow:"0px 4px 11px 0px hsla(0, 0%, 12%, 0.12)",position:"relative",zIndex:3},"&:focus":{outline:"2px solid $primary500",outlineOffset:"-4px","& td":{bg:"transparent"}}}}}}),d=e=>e?!!(e.closest("button, a, input, select, textarea")||e.getAttribute("role")==="button"):!1,k=({row:e,rowAction:r})=>{const{enableRowSelection:m,disabledRows:l,getCanSomeRowsExpand:p}=E(),s=!!(l!=null&&l[e.id]),g=e.getToggleExpandedHandler(),u=e.getToggleSelectedHandler(),b=()=>e.getIsSomeSelected()?"indeterminate":e.getIsSelected(),c=(t,o)=>{!r||!o.target.closest("tr")||d(o.target)||r(t.original,o)},f=t=>{if(t.key==="Enter"||t.key===" "){if(d(t.target))return;t.preventDefault(),c(e,t)}if(t.key==="ArrowDown"){t.preventDefault();const o=t.target.closest("tr"),a=o==null?void 0:o.nextElementSibling;a&&a.tagName==="TR"&&a.focus()}if(t.key==="ArrowUp"){t.preventDefault();const o=t.target.closest("tr"),a=o==null?void 0:o.previousElementSibling;a&&a.tagName==="TR"&&a.focus()}};return n.createElement(v,{isSelected:e.getIsSelected(),isDisabled:s,isFocusable:!!r&&!s,...r&&{onClick:t=>c(e,t),tabIndex:0,css:{cursor:"pointer"},onKeyDown:f}},p()&&n.createElement(i.Cell,{"data-testid":`expand-icon-${e.id}`,css:{width:"$4",cursor:e.getCanExpand()?"pointer":"auto"},onClick:g},e.getCanExpand()&&n.createElement(C,{is:e.getIsExpanded()?x:w})),m&&n.createElement(i.Cell,{css:{width:"$4"}},n.createElement(S,{row:e,checked:b(),onCheckedChange:u})),e.getVisibleCells().map((t,o)=>n.createElement(D,{key:t.id,cell:t})))};export{k as DataTableRow};
2
2
  //# sourceMappingURL=DataTableRow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableRow.js","sources":["../../../src/components/data-table/DataTableRow.tsx"],"sourcesContent":["import { ChevronDown, ChevronRight } from '@atom-learning/icons'\nimport type { Row } from '@tanstack/react-table'\nimport * as React from 'react'\n\nimport { styled } from '~/stitches'\n\nimport { Icon } from '../icon'\nimport { Table } from '../table'\nimport { useDataTable } from './DataTableContext'\nimport { DataTableDataCell } from './DataTableDataCell'\nimport { DataTableRowSelectionCheckbox } from './DataTableRowSelectionCheckbox'\n\nexport type DataTableRowProps = React.ComponentProps<typeof Table.Row> & {\n row: Row<Record<string, unknown>>\n rowAction?: (row: Record<string, unknown>, event: React.MouseEvent) => void\n}\n\nconst StyledRow = styled(Table.Row, {\n bg: 'initial',\n variants: {\n isSelected: {\n true: {\n [`&:nth-child(odd), &:nth-child(even)`]: {\n bg: '$primary100'\n }\n }\n },\n isDisabled: {\n true: {\n opacity: '30%'\n }\n },\n isFocusable: {\n true: {\n transition: 'transform 150ms ease-in-out, box-shadow 150ms ease-in-out',\n '&:hover': {\n transform: 'translateY(-1px)',\n boxShadow: '0px 4px 11px 0px hsla(0, 0%, 12%, 0.12)',\n position: 'relative',\n zIndex: 3\n },\n '&:focus': {\n outline: '2px solid $primary500',\n outlineOffset: '-4px',\n '& td': {\n bg: 'transparent'\n }\n }\n }\n }\n }\n})\n\nconst isElementInteractive = (element: Element | null): boolean => {\n if (!element) return false\n if (element.closest('button, a, input, select, textarea')) return true\n if (element.getAttribute('role') === 'button') return true\n return false\n}\n\nexport const DataTableRow = ({ row, rowAction }: DataTableRowProps) => {\n const { enableRowSelection, disabledRows, getCanSomeRowsExpand } =\n useDataTable()\n\n const isDisabled = !!disabledRows?.[row.id]\n\n const toggleExpandHandler = row.getToggleExpandedHandler()\n const toggleSelectHandler = row.getToggleSelectedHandler()\n\n const getCheckedState = (): boolean | 'indeterminate' => {\n if (row.getIsSomeSelected()) return 'indeterminate'\n return row.getIsSelected()\n }\n\n const handleRowClick = (\n rowData: Row<Record<string, unknown>>,\n event: React.MouseEvent<HTMLTableRowElement>\n ) => {\n if (!rowAction) return\n\n // Skip if clicking on an interactive element\n const rowElement = (event.target as Element).closest('tr')\n if (!rowElement || isElementInteractive(event.target as Element)) {\n return\n }\n\n rowAction(rowData.original, event)\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n if (isElementInteractive(event.target as Element)) {\n return\n }\n event.preventDefault()\n handleRowClick(\n row,\n event as unknown as React.MouseEvent<HTMLTableRowElement>\n )\n }\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n const currentRow = (event.target as HTMLElement).closest('tr')\n const nextRow = currentRow?.nextElementSibling as HTMLElement\n if (nextRow && nextRow.tagName === 'TR') {\n nextRow.focus()\n }\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n const currentRow = (event.target as HTMLElement).closest('tr')\n const previousRow = currentRow?.previousElementSibling as HTMLElement\n if (previousRow && previousRow.tagName === 'TR') {\n previousRow.focus()\n }\n }\n }\n\n return (\n <StyledRow\n isSelected={row.getIsSelected()}\n isDisabled={isDisabled}\n isFocusable={!!rowAction && !isDisabled}\n {...(rowAction && {\n onClick: (event) => handleRowClick(row, event),\n tabIndex: 0,\n css: { cursor: 'pointer' },\n onKeyDown: handleKeyDown\n })}\n >\n {getCanSomeRowsExpand() && (\n <Table.Cell\n data-testid={`expand-icon-${row.id}`}\n css={{ width: '$4', cursor: row.getCanExpand() ? 'pointer' : 'auto' }}\n onClick={toggleExpandHandler}\n >\n {row.getCanExpand() && (\n <Icon is={row.getIsExpanded() ? ChevronDown : ChevronRight} />\n )}\n </Table.Cell>\n )}\n\n {enableRowSelection && (\n <Table.Cell css={{ width: '$4' }}>\n <DataTableRowSelectionCheckbox\n row={row}\n checked={getCheckedState()}\n onCheckedChange={toggleSelectHandler}\n />\n </Table.Cell>\n )}\n {row.getVisibleCells().map((cell, i) => {\n return <DataTableDataCell key={cell.id} cell={cell} />\n })}\n </StyledRow>\n )\n}\n"],"names":["StyledRow","styled","Table","isElementInteractive","element","DataTableRow","row","rowAction","enableRowSelection","disabledRows","getCanSomeRowsExpand","useDataTable","isDisabled","toggleExpandHandler","toggleSelectHandler","getCheckedState","handleRowClick","rowData","event","handleKeyDown","currentRow","nextRow","previousRow","React","Icon","ChevronDown","ChevronRight","DataTableRowSelectionCheckbox","cell","i","DataTableDataCell"],"mappings":"4ZAiBA,MAAMA,EAAYC,EAAOC,EAAM,IAAK,CAClC,GAAI,UACJ,SAAU,CACR,WAAY,CACV,KAAM,CACJ,CAAC,uCAAwC,CACvC,GAAI,aACN,CACF,CACF,EACA,WAAY,CACV,KAAM,CACJ,QAAS,KACX,CACF,EACA,YAAa,CACX,KAAM,CACJ,WAAY,4DACZ,UAAW,CACT,UAAW,mBACX,UAAW,0CACX,SAAU,WACV,OAAQ,CACV,EACA,UAAW,CACT,QAAS,wBACT,cAAe,OACf,OAAQ,CACN,GAAI,aACN,CACF,CACF,CACF,CACF,CACF,CAAC,EAEKC,EAAwBC,GACvBA,EACD,GAAAA,EAAQ,QAAQ,oCAAoC,GACpDA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Q,SAAU,EACzB,UAAWC,CACb,GAECT,EAAqB,GACpBa,EAAA,cAACrB,EAAM,KAAN,CACC,cAAa,eAAeI,EAAI,KAChC,IAAK,CAAE,MAAO,KAAM,OAAQA,EAAI,eAAiB,UAAY,MAAO,EACpE,QAASO,GAERP,EAAI,gBACHiB,EAAA,cAACC,EAAA,CAAK,GAAIlB,EAAI,cAAc,EAAImB,EAAcC,CAAc,CAAA,CAEhE,EAGDlB,GACCe,EAAA,cAACrB,EAAM,KAAN,CAAW,IAAK,CAAE,MAAO,IAAK,CAAA,EAC7BqB,EAAA,cAACI,EAAA,CACC,IAAKrB,EACL,QAASS,EAAgB,EACzB,gBAAiBD,CACnB,CAAA,CACF,EAEDR,EAAI,gBAAA,EAAkB,IAAI,CAACsB,EAAMC,IACzBN,EAAA,cAACO,EAAA,CAAkB,IAAKF,EAAK,GAAI,KAAMA,CAAM,CAAA,CACrD,CACH,CAEJ"}
1
+ {"version":3,"file":"DataTableRow.js","sources":["../../../src/components/data-table/DataTableRow.tsx"],"sourcesContent":["import { ChevronDown, ChevronRight } from '@atom-learning/icons'\nimport type { Row } from '@tanstack/react-table'\nimport * as React from 'react'\n\nimport { styled } from '~/stitches'\n\nimport { Icon } from '../icon'\nimport { Table } from '../table'\nimport { useDataTable } from './DataTableContext'\nimport { DataTableDataCell } from './DataTableDataCell'\nimport { DataTableRowSelectionCheckbox } from './DataTableRowSelectionCheckbox'\n\nexport type DataTableRowProps = React.ComponentProps<typeof Table.Row> & {\n row: Row<Record<string, unknown>>\n rowAction?: (row: Record<string, unknown>, event: React.MouseEvent) => void\n}\n\nconst StyledRow = styled(Table.Row, {\n bg: 'initial',\n variants: {\n isSelected: {\n true: {\n '&:nth-child(odd), &:nth-child(even)': {\n bg: '$primary100'\n }\n }\n },\n isDisabled: {\n true: {\n opacity: '30%'\n }\n },\n isFocusable: {\n true: {\n transition: 'transform 150ms ease-in-out, box-shadow 150ms ease-in-out',\n '&:hover': {\n transform: 'translateY(-1px)',\n boxShadow: '0px 4px 11px 0px hsla(0, 0%, 12%, 0.12)',\n position: 'relative',\n zIndex: 3\n },\n '&:focus': {\n outline: '2px solid $primary500',\n outlineOffset: '-4px',\n '& td': {\n bg: 'transparent'\n }\n }\n }\n }\n }\n})\n\nconst isElementInteractive = (element: Element | null): boolean => {\n if (!element) return false\n if (element.closest('button, a, input, select, textarea')) return true\n if (element.getAttribute('role') === 'button') return true\n return false\n}\n\nexport const DataTableRow = ({ row, rowAction }: DataTableRowProps) => {\n const { enableRowSelection, disabledRows, getCanSomeRowsExpand } =\n useDataTable()\n\n const isDisabled = !!disabledRows?.[row.id]\n\n const toggleExpandHandler = row.getToggleExpandedHandler()\n const toggleSelectHandler = row.getToggleSelectedHandler()\n\n const getCheckedState = (): boolean | 'indeterminate' => {\n if (row.getIsSomeSelected()) return 'indeterminate'\n return row.getIsSelected()\n }\n\n const handleRowClick = (\n rowData: Row<Record<string, unknown>>,\n event: React.MouseEvent<HTMLTableRowElement>\n ) => {\n if (!rowAction) return\n\n // Skip if clicking on an interactive element\n const rowElement = (event.target as Element).closest('tr')\n if (!rowElement || isElementInteractive(event.target as Element)) {\n return\n }\n\n rowAction(rowData.original, event)\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n if (isElementInteractive(event.target as Element)) {\n return\n }\n event.preventDefault()\n handleRowClick(\n row,\n event as unknown as React.MouseEvent<HTMLTableRowElement>\n )\n }\n if (event.key === 'ArrowDown') {\n event.preventDefault()\n const currentRow = (event.target as HTMLElement).closest('tr')\n const nextRow = currentRow?.nextElementSibling as HTMLElement\n if (nextRow && nextRow.tagName === 'TR') {\n nextRow.focus()\n }\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n const currentRow = (event.target as HTMLElement).closest('tr')\n const previousRow = currentRow?.previousElementSibling as HTMLElement\n if (previousRow && previousRow.tagName === 'TR') {\n previousRow.focus()\n }\n }\n }\n\n return (\n <StyledRow\n isSelected={row.getIsSelected()}\n isDisabled={isDisabled}\n isFocusable={!!rowAction && !isDisabled}\n {...(rowAction && {\n onClick: (event) => handleRowClick(row, event),\n tabIndex: 0,\n css: { cursor: 'pointer' },\n onKeyDown: handleKeyDown\n })}\n >\n {getCanSomeRowsExpand() && (\n <Table.Cell\n data-testid={`expand-icon-${row.id}`}\n css={{ width: '$4', cursor: row.getCanExpand() ? 'pointer' : 'auto' }}\n onClick={toggleExpandHandler}\n >\n {row.getCanExpand() && (\n <Icon is={row.getIsExpanded() ? ChevronDown : ChevronRight} />\n )}\n </Table.Cell>\n )}\n\n {enableRowSelection && (\n <Table.Cell css={{ width: '$4' }}>\n <DataTableRowSelectionCheckbox\n row={row}\n checked={getCheckedState()}\n onCheckedChange={toggleSelectHandler}\n />\n </Table.Cell>\n )}\n {row.getVisibleCells().map((cell, i) => {\n return <DataTableDataCell key={cell.id} cell={cell} />\n })}\n </StyledRow>\n )\n}\n"],"names":["StyledRow","styled","Table","isElementInteractive","element","DataTableRow","row","rowAction","enableRowSelection","disabledRows","getCanSomeRowsExpand","useDataTable","isDisabled","toggleExpandHandler","toggleSelectHandler","getCheckedState","handleRowClick","rowData","event","handleKeyDown","currentRow","nextRow","previousRow","React","Icon","ChevronDown","ChevronRight","DataTableRowSelectionCheckbox","cell","i","DataTableDataCell"],"mappings":"4ZAiBA,MAAMA,EAAYC,EAAOC,EAAM,IAAK,CAClC,GAAI,UACJ,SAAU,CACR,WAAY,CACV,KAAM,CACJ,sCAAuC,CACrC,GAAI,aACN,CACF,CACF,EACA,WAAY,CACV,KAAM,CACJ,QAAS,KACX,CACF,EACA,YAAa,CACX,KAAM,CACJ,WAAY,4DACZ,UAAW,CACT,UAAW,mBACX,UAAW,0CACX,SAAU,WACV,OAAQ,CACV,EACA,UAAW,CACT,QAAS,wBACT,cAAe,OACf,OAAQ,CACN,GAAI,aACN,CACF,CACF,CACF,CACF,CACF,CAAC,EAEKC,EAAwBC,GACvBA,EACD,GAAAA,EAA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AAU,EACV,IAAK,CAAE,OAAQ,SAAU,EACzB,UAAWC,CACb,GAECT,EAAqB,GACpBa,EAAA,cAACrB,EAAM,KAAN,CACC,cAAa,eAAeI,EAAI,KAChC,IAAK,CAAE,MAAO,KAAM,OAAQA,EAAI,eAAiB,UAAY,MAAO,EACpE,QAASO,GAERP,EAAI,gBACHiB,EAAA,cAACC,EAAA,CAAK,GAAIlB,EAAI,cAAc,EAAImB,EAAcC,CAAc,CAAA,CAEhE,EAGDlB,GACCe,EAAA,cAACrB,EAAM,KAAN,CAAW,IAAK,CAAE,MAAO,IAAK,CAAA,EAC7BqB,EAAA,cAACI,EAAA,CACC,IAAKrB,EACL,QAASS,EAAgB,EACzB,gBAAiBD,CACnB,CAAA,CACF,EAEDR,EAAI,gBAAA,EAAkB,IAAI,CAACsB,EAAMC,IACzBN,EAAA,cAACO,EAAA,CAAkB,IAAKF,EAAK,GAAI,KAAMA,CAAM,CAAA,CACrD,CACH,CAEJ"}
@@ -1,2 +1,2 @@
1
- import*as c from"@radix-ui/react-visually-hidden";import*as t from"react";import{Checkbox as n}from"../checkbox/Checkbox.js";import{Label as m}from"../label/Label.js";import{useDataTable as i}from"./DataTableContext.js";const d=({row:e,checked:l,onCheckedChange:r,label:a=`Row ${e.id} selection`})=>{const{tableId:o}=i();return t.createElement(t.Fragment,null,t.createElement(c.Root,null,t.createElement(m,{htmlFor:`${o}_row_${e.id}_selection`},a)),t.createElement(n,{size:"lg",css:{ml:e.depth?`$${e.depth*2}`:0},checked:l,onCheckedChange:r,name:`${o}_row_${e.id}_selection`,disabled:!e.getCanSelect()}))};export{d as DataTableRowSelectionCheckbox};
1
+ import*as c from"@radix-ui/react-visually-hidden";import*as t from"react";import{Checkbox as n}from"../checkbox/Checkbox.js";import{Label as m}from"../label/Label.js";import{useDataTable as i}from"./DataTableContext.js";const d=({row:e,checked:l,onCheckedChange:a,label:r=`Row ${e.id} selection`})=>{const{tableId:o}=i();return t.createElement(t.Fragment,null,t.createElement(c.Root,null,t.createElement(m,{htmlFor:`${o}_row_${e.id}_selection`},r)),t.createElement(n,{size:"lg",style:{"--depth":e.depth},css:{ml:"calc((var(--depth, 0) * 2) * 4px)"},checked:l,onCheckedChange:a,name:`${o}_row_${e.id}_selection`,disabled:!e.getCanSelect()}))};export{d as DataTableRowSelectionCheckbox};
2
2
  //# sourceMappingURL=DataTableRowSelectionCheckbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableRowSelectionCheckbox.js","sources":["../../../src/components/data-table/DataTableRowSelectionCheckbox.tsx"],"sourcesContent":["import * as VisuallyHidden from '@radix-ui/react-visually-hidden'\nimport type { Row } from '@tanstack/react-table'\nimport * as React from 'react'\n\nimport { Checkbox } from '../checkbox'\nimport { Label } from '../label'\nimport { useDataTable } from './DataTableContext'\n\nexport const DataTableRowSelectionCheckbox = ({\n row,\n checked,\n onCheckedChange,\n label = `Row ${row.id} selection`\n}: {\n row: Row<Record<string, unknown>>\n checked: boolean | 'indeterminate'\n onCheckedChange: (value: boolean) => void\n label?: string\n}): React.ReactElement => {\n const { tableId } = useDataTable()\n\n return (\n <>\n <VisuallyHidden.Root>\n <Label htmlFor={`${tableId}_row_${row.id}_selection`}>{label}</Label>\n </VisuallyHidden.Root>\n <Checkbox\n size=\"lg\"\n css={{ ml: row.depth ? `$${row.depth * 2}` : 0 }}\n checked={checked}\n onCheckedChange={onCheckedChange}\n name={`${tableId}_row_${row.id}_selection`}\n disabled={!row.getCanSelect()}\n />\n </>\n )\n}\n"],"names":["DataTableRowSelectionCheckbox","row","checked","onCheckedChange","label","tableId","useDataTable","React","VisuallyHidden","Label","Checkbox"],"mappings":"4NAQa,MAAAA,EAAgC,CAAC,CAC5C,IAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,MAAAC,EAAQ,OAAOH,EAAI,cACrB,IAK0B,CACxB,KAAM,CAAE,QAAAI,CAAQ,EAAIC,IAEpB,OACEC,EAAA,cAAAA,EAAA,SACEA,KAAAA,EAAA,cAACC,EAAe,KAAf,KACCD,EAAA,cAACE,EAAA,CAAM,QAAS,GAAGJ,SAAeJ,EAAI,gBAAiBG,CAAM,CAC/D,EACAG,EAAA,cAACG,EAAA,CACC,KAAK,KACL,IAAK,CAAE,GAAIT,EAAI,MAAQ,IAAIA,EAAI,MAAQ,IAAM,CAAE,EAC/C,QAASC,EACT,gBAAiBC,EACjB,KAAM,GAAGE,SAAeJ,EAAI,eAC5B,SAAU,CAACA,EAAI,aACjB,CAAA,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"DataTableRowSelectionCheckbox.js","sources":["../../../src/components/data-table/DataTableRowSelectionCheckbox.tsx"],"sourcesContent":["import * as VisuallyHidden from '@radix-ui/react-visually-hidden'\nimport type { Row } from '@tanstack/react-table'\nimport * as React from 'react'\n\nimport { Checkbox } from '../checkbox'\nimport { Label } from '../label'\nimport { useDataTable } from './DataTableContext'\n\nexport const DataTableRowSelectionCheckbox = ({\n row,\n checked,\n onCheckedChange,\n label = `Row ${row.id} selection`\n}: {\n row: Row<Record<string, unknown>>\n checked: boolean | 'indeterminate'\n onCheckedChange: (value: boolean) => void\n label?: string\n}): React.ReactElement => {\n const { tableId } = useDataTable()\n\n return (\n <>\n <VisuallyHidden.Root>\n <Label htmlFor={`${tableId}_row_${row.id}_selection`}>{label}</Label>\n </VisuallyHidden.Root>\n <Checkbox\n size=\"lg\"\n style={{ '--depth': row.depth }}\n css={{ ml: 'calc((var(--depth, 0) * 2) * 4px)' }}\n checked={checked}\n onCheckedChange={onCheckedChange}\n name={`${tableId}_row_${row.id}_selection`}\n disabled={!row.getCanSelect()}\n />\n </>\n )\n}\n"],"names":["DataTableRowSelectionCheckbox","row","checked","onCheckedChange","label","tableId","useDataTable","React","VisuallyHidden","Label","Checkbox"],"mappings":"4NAQa,MAAAA,EAAgC,CAAC,CAC5C,IAAAC,EACA,QAAAC,EACA,gBAAAC,EACA,MAAAC,EAAQ,OAAOH,EAAI,cACrB,IAK0B,CACxB,KAAM,CAAE,QAAAI,CAAQ,EAAIC,IAEpB,OACEC,EAAA,cAAAA,EAAA,SACEA,KAAAA,EAAA,cAACC,EAAe,KAAf,KACCD,EAAA,cAACE,EAAA,CAAM,QAAS,GAAGJ,SAAeJ,EAAI,gBAAiBG,CAAM,CAC/D,EACAG,EAAA,cAACG,EAAA,CACC,KAAK,KACL,MAAO,CAAE,UAAWT,EAAI,KAAM,EAC9B,IAAK,CAAE,GAAI,mCAAoC,EAC/C,QAASC,EACT,gBAAiBC,EACjB,KAAM,GAAGE,SAAeJ,EAAI,eAC5B,SAAU,CAACA,EAAI,aACjB,CAAA,CAAA,CACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{CalendarEvent as B}from"@atom-learning/icons";import p from"dayjs";import M from"dayjs/plugin/customParseFormat";import*as e from"react";import{DIALOG_Z_INDEX as P}from"../../constants/zIndices.js";import"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import"../../utilities/no-overflow-wrapper/NoOverflowWrapper.js";import"color2k";import"../../utilities/style/keyframe-animations.js";import{getFieldIconSize as H}from"../../utilities/style/get-icon-size.js";import{useCallbackRefState as $}from"../../utilities/hooks/useCallbackRef.js";import{ActionIcon as U}from"../action-icon/ActionIcon.js";import{Box as V}from"../box/Box.js";import{Calendar as W}from"../calendar/Calendar.js";import{DEFAULT_LABELS as Y}from"../calendar/constants.js";import{Icon as j}from"../icon/Icon.js";import{Input as G}from"../input/Input.js";import{Popover as c}from"../popover/Popover.js";import{DEFAULT_DATE_FORMAT as C}from"./constants.js";p.extend(M);const I=(n,o=C)=>n?p(n).format(o):"",w=e.forwardRef(({initialDate:n,dateFormat:o=C,firstDayOfWeek:y=1,disabled:f,monthNames:T,weekdayNames:k,size:d="md",labels:A,revalidate:l,onChange:u,minDate:O,maxDate:x,...z},F)=>{const[s,D]=e.useState(n?p(n).toDate():void 0),[m,S]=$();e.useImperativeHandle(F,()=>m);const L=I(s,o),N=e.useCallback(t=>{const r=t.target.value,a=p(r,o),i=a.isValid()?a.toDate():void 0;D(i),u==null||u(i)},[o,u]),E=e.useCallback(t=>{D(t),(()=>{var r;if(!m)return;const a=(r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))==null?void 0:r.set;a==null||a.call(m,I(t,o));const i=new Event("input",{bubbles:!0});m.dispatchEvent(i)})()},[o,m]),b={...Y,...A},[R,v]=e.useState(!1),h=e.useRef(null),g=e.useRef(null),_=e.useMemo(()=>H(d),[d]);return e.createElement(V,{css:{position:"relative",height:"max-content"}},e.createElement(G,{name:"date",disabled:f,size:d,...z,onChange:N,ref:S,defaultValue:L}),e.createElement(c,{modal:!0,open:R,onOpenChange:v},e.createElement(c.Trigger,{asChild:!0},e.createElement(U,{css:{position:"absolute",top:"50%",transform:"translateY(-50%)",right:"0"},disabled:f,label:b.open,size:_,theme:"neutral",hasTooltip:!1},e.createElement(j,{is:B}))),e.createElement(c.Portal,null,e.createElement(c.Content,{css:{pr:"$sizes$2",zIndex:P},side:"bottom",align:"end",showCloseButton:!1,onOpenAutoFocus:t=>{var r,a;t.preventDefault(),s?(r=g.current)==null||r.focus():(a=h.current)==null||a.focus()}},e.createElement(W,{date:s||new Date,selected:s,onDateSelected:async t=>{v(!1),await E(t.date),l&&l()},setYear:async t=>{await E(t),l&&l()},minDate:O,maxDate:x,refDateToday:h,refDateSelected:g,firstDayOfWeek:y,monthNames:T,weekdayNames:k,labels:b})))))});w.displayName="DateInput";export{w as DateInput};
1
+ import{CalendarEvent as M}from"@atom-learning/icons";import p from"dayjs";import P from"dayjs/plugin/customParseFormat";import*as e from"react";import"../../utilities/css-wrapper/CSSWrapper.js";import"color2k";import"../../utilities/style/keyframe-animations.js";import{getFieldIconSize as H}from"../../utilities/style/get-icon-size.js";import"../../utilities/no-overflow-wrapper/NoOverflowWrapper.js";import{useCallbackRefState as _}from"../../utilities/hooks/useCallbackRef.js";import{ActionIcon as U}from"../action-icon/ActionIcon.js";import{Box as V}from"../box/Box.js";import{Calendar as W}from"../calendar/Calendar.js";import{DEFAULT_LABELS as Y}from"../calendar/constants.js";import{Icon as $}from"../icon/Icon.js";import{Input as j}from"../input/Input.js";import{Popover as c}from"../popover/Popover.js";import{DEFAULT_DATE_FORMAT as C}from"./constants.js";p.extend(P);const w=(n,o=C)=>n?p(n).format(o):"",y=e.forwardRef(({initialDate:n,dateFormat:o=C,firstDayOfWeek:I=1,disabled:f,monthNames:T,weekdayNames:k,size:d="md",labels:A,revalidate:m,onChange:u,minDate:x,maxDate:O,...S},z)=>{const[s,D]=e.useState(n?p(n).toDate():void 0),[l,F]=_();e.useImperativeHandle(z,()=>l);const N=w(s,o),L=e.useCallback(t=>{const r=t.target.value,a=p(r,o),i=a.isValid()?a.toDate():void 0;D(i),u==null||u(i)},[o,u]),E=e.useCallback(t=>{D(t),(()=>{var r;if(!l)return;const a=(r=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))==null?void 0:r.set;a==null||a.call(l,w(t,o));const i=new Event("input",{bubbles:!0});l.dispatchEvent(i)})()},[o,l]),b={...Y,...A},[R,v]=e.useState(!1),h=e.useRef(null),g=e.useRef(null),B=e.useMemo(()=>H(d),[d]);return e.createElement(V,{css:{position:"relative",height:"max-content"}},e.createElement(j,{name:"date",disabled:f,size:d,...S,onChange:L,ref:F,defaultValue:N}),e.createElement(c,{modal:!0,open:R,onOpenChange:v},e.createElement(c.Trigger,{asChild:!0},e.createElement(U,{css:{position:"absolute",top:"50%",transform:"translateY(-50%)",right:"0"},disabled:f,label:b.open,size:B,theme:"neutral",hasTooltip:!1},e.createElement($,{is:M}))),e.createElement(c.Portal,null,e.createElement(c.Content,{css:{pr:"$sizes$2",zIndex:1147483646},side:"bottom",align:"end",showCloseButton:!1,onOpenAutoFocus:t=>{var r,a;t.preventDefault(),s?(r=g.current)==null||r.focus():(a=h.current)==null||a.focus()}},e.createElement(W,{date:s||new Date,selected:s,onDateSelected:async t=>{v(!1),await E(t.date),m&&m()},setYear:async t=>{await E(t),m&&m()},minDate:x,maxDate:O,refDateToday:h,refDateSelected:g,firstDayOfWeek:I,monthNames:T,weekdayNames:k,labels:b})))))});y.displayName="DateInput";export{y as DateInput};
2
2
  //# sourceMappingURL=DateInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.js","sources":["../../../src/components/date-input/DateInput.tsx"],"sourcesContent":["import { CalendarEvent } from '@atom-learning/icons'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat'\nimport type { Props as DayzedInterface } from 'dayzed'\nimport * as React from 'react'\n\nimport { DIALOG_Z_INDEX } from '~/constants/zIndices'\nimport { getFieldIconSize } from '~/utilities'\nimport { useCallbackRefState } from '~/utilities/hooks/useCallbackRef'\n\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Box } from '../box/Box'\nimport { Calendar, CalendarTranslationProps } from '../calendar/Calendar'\nimport { DEFAULT_LABELS } from '../calendar/constants'\nimport { Icon } from '../icon/Icon'\nimport { Input } from '../input/Input'\nimport { Popover } from '../popover/Popover'\nimport { DEFAULT_DATE_FORMAT } from './constants'\ndayjs.extend(customParseFormat)\n\nexport type DateInputProps = Omit<DayzedInterface, 'onDateSelected'> &\n CalendarTranslationProps & {\n initialDate?: Date\n dateFormat?: string\n disabled?: boolean\n size?: 'sm' | 'md' | 'lg'\n revalidate?: () => Promise<boolean>\n onChange?: (value?: Date) => void\n }\n\nconst formatDateToString = (date?: Date, dateFormat = DEFAULT_DATE_FORMAT) =>\n date ? dayjs(date).format(dateFormat) : ''\n\nexport const DateInput: React.ForwardRefExoticComponent<DateInputProps> =\n React.forwardRef(\n (\n {\n initialDate,\n dateFormat = DEFAULT_DATE_FORMAT,\n firstDayOfWeek = 1,\n disabled,\n monthNames,\n weekdayNames,\n size = 'md',\n labels,\n revalidate,\n onChange,\n minDate,\n maxDate,\n ...remainingProps\n },\n ref\n ) => {\n const [date, setDate] = React.useState(\n initialDate ? dayjs(initialDate).toDate() : undefined\n )\n\n const [inputElRef, setInputElRef] = useCallbackRefState()\n React.useImperativeHandle(ref, () => inputElRef as HTMLInputElement)\n\n const dateString = formatDateToString(date, dateFormat)\n\n const handleInputChange = React.useCallback(\n (event) => {\n const newDateString = event.target.value\n const parsedInputDate = dayjs(newDateString, dateFormat)\n const newDate = parsedInputDate.isValid()\n ? parsedInputDate.toDate()\n : undefined\n setDate(newDate)\n onChange?.(newDate)\n },\n [dateFormat, onChange]\n )\n\n const handleCalendarChange = React.useCallback(\n (newDate) => {\n setDate(newDate)\n\n const mirrorChangeToInputElement = () => {\n if (!inputElRef) return\n\n // Call the `set` function on the input value directly to mirror the change.\n // Props to: https://stackoverflow.com/a/46012210\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n 'value'\n )?.set\n nativeInputValueSetter?.call(\n inputElRef,\n formatDateToString(newDate, dateFormat)\n )\n const event = new Event('input', { bubbles: true })\n inputElRef.dispatchEvent(event)\n }\n mirrorChangeToInputElement()\n },\n [dateFormat, inputElRef]\n )\n\n const updatedLabels = {\n ...DEFAULT_LABELS,\n ...labels\n }\n\n const [calendarOpen, setCalendarOpen] = React.useState(false)\n\n const refDateToday = React.useRef<HTMLButtonElement>(null)\n const refDateSelected = React.useRef<HTMLButtonElement>(null)\n\n const iconSize = React.useMemo(() => getFieldIconSize(size), [size])\n\n return (\n <Box css={{ position: 'relative', height: 'max-content' }}>\n <Input\n name=\"date\"\n disabled={disabled}\n size={size}\n {...remainingProps}\n onChange={handleInputChange}\n ref={setInputElRef}\n defaultValue={dateString}\n />\n <Popover modal open={calendarOpen} onOpenChange={setCalendarOpen}>\n <Popover.Trigger asChild>\n <ActionIcon\n css={{\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n right: '0'\n }}\n disabled={disabled}\n label={updatedLabels.open}\n size={iconSize}\n theme=\"neutral\"\n hasTooltip={false}\n >\n <Icon is={CalendarEvent} />\n </ActionIcon>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n css={{ pr: '$sizes$2', zIndex: DIALOG_Z_INDEX }}\n side=\"bottom\"\n align=\"end\"\n showCloseButton={false}\n onOpenAutoFocus={(e) => {\n e.preventDefault()\n if (date) {\n refDateSelected.current?.focus()\n } else {\n refDateToday.current?.focus()\n }\n }}\n >\n <Calendar\n date={date || new Date()}\n selected={date}\n onDateSelected={async (date) => {\n setCalendarOpen(false)\n await handleCalendarChange(date.date)\n if (revalidate) revalidate()\n }}\n setYear={async (date) => {\n await handleCalendarChange(date)\n if (revalidate) revalidate()\n }}\n minDate={minDate}\n maxDate={maxDate}\n refDateToday={refDateToday}\n refDateSelected={refDateSelected}\n firstDayOfWeek={firstDayOfWeek}\n monthNames={monthNames}\n weekdayNames={weekdayNames}\n labels={updatedLabels}\n />\n </Popover.Content>\n </Popover.Portal>\n </Popover>\n </Box>\n )\n }\n )\n\nDateInput.displayName = 'DateInput'\n"],"names":["dayjs","customParseFormat","formatDateToString","date","dateFormat","DEFAULT_DATE_FORMAT","DateInput","React","initialDate","firstDayOfWeek","disabled","monthNames","weekdayNames","size","labels","revalidate","onChange","minDate","maxDate","remainingProps","ref","setDate","inputElRef","setInputElRef","useCallbackRefState","dateString","handleInputChange","event","newDateString","parsedInputDate","newDate","handleCalendarChange","_a","nativeInputValueSetter","updatedLabels","DEFAULT_LABELS","calendarOpen","setCalendarOpen","refDateToday","refDateSelected","iconSize","getFieldIconSize","Box","Input","Popover","ActionIcon","Icon","CalendarEvent","DIALOG_Z_INDEX","e","_b","Calendar"],"mappings":"w7BAkBAA,EAAM,OAAOC,CAAiB,EAY9B,MAAMC,EAAqB,CAACC,EAAaC,EAAaC,IACpDF,EAAOH,EAAMG,CAAI,EAAE,OAAOC,CAAU,EAAI,GAE7BE,EACXC,EAAM,WACJ,CACE,CACE,YAAAC,EACA,WAAAJ,EAAaC,EACb,eAAAI,EAAiB,EACjB,SAAAC,EACA,WAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,KACP,OAAAC,EACA,WAAAC,EACA,SAAAC,EACA,QAAAC,EACA,QAAAC,K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CACF,EAEF5B,EAAU,YAAc"}
1
+ {"version":3,"file":"DateInput.js","sources":["../../../src/components/date-input/DateInput.tsx"],"sourcesContent":["import { CalendarEvent } from '@atom-learning/icons'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat'\nimport type { Props as DayzedInterface } from 'dayzed'\nimport * as React from 'react'\n\nimport { getFieldIconSize } from '~/utilities'\nimport { useCallbackRefState } from '~/utilities/hooks/useCallbackRef'\n\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Box } from '../box/Box'\nimport { Calendar, CalendarTranslationProps } from '../calendar/Calendar'\nimport { DEFAULT_LABELS } from '../calendar/constants'\nimport { Icon } from '../icon/Icon'\nimport { Input } from '../input/Input'\nimport { Popover } from '../popover/Popover'\nimport { DEFAULT_DATE_FORMAT } from './constants'\ndayjs.extend(customParseFormat)\n\nexport type DateInputProps = Omit<DayzedInterface, 'onDateSelected'> &\n CalendarTranslationProps & {\n initialDate?: Date\n dateFormat?: string\n disabled?: boolean\n size?: 'sm' | 'md' | 'lg'\n revalidate?: () => Promise<boolean>\n onChange?: (value?: Date) => void\n }\n\nconst formatDateToString = (date?: Date, dateFormat = DEFAULT_DATE_FORMAT) =>\n date ? dayjs(date).format(dateFormat) : ''\n\nexport const DateInput: React.ForwardRefExoticComponent<DateInputProps> =\n React.forwardRef(\n (\n {\n initialDate,\n dateFormat = DEFAULT_DATE_FORMAT,\n firstDayOfWeek = 1,\n disabled,\n monthNames,\n weekdayNames,\n size = 'md',\n labels,\n revalidate,\n onChange,\n minDate,\n maxDate,\n ...remainingProps\n },\n ref\n ) => {\n const [date, setDate] = React.useState(\n initialDate ? dayjs(initialDate).toDate() : undefined\n )\n\n const [inputElRef, setInputElRef] = useCallbackRefState()\n React.useImperativeHandle(ref, () => inputElRef as HTMLInputElement)\n\n const dateString = formatDateToString(date, dateFormat)\n\n const handleInputChange = React.useCallback(\n (event) => {\n const newDateString = event.target.value\n const parsedInputDate = dayjs(newDateString, dateFormat)\n const newDate = parsedInputDate.isValid()\n ? parsedInputDate.toDate()\n : undefined\n setDate(newDate)\n onChange?.(newDate)\n },\n [dateFormat, onChange]\n )\n\n const handleCalendarChange = React.useCallback(\n (newDate) => {\n setDate(newDate)\n\n const mirrorChangeToInputElement = () => {\n if (!inputElRef) return\n\n // Call the `set` function on the input value directly to mirror the change.\n // Props to: https://stackoverflow.com/a/46012210\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n window.HTMLInputElement.prototype,\n 'value'\n )?.set\n nativeInputValueSetter?.call(\n inputElRef,\n formatDateToString(newDate, dateFormat)\n )\n const event = new Event('input', { bubbles: true })\n inputElRef.dispatchEvent(event)\n }\n mirrorChangeToInputElement()\n },\n [dateFormat, inputElRef]\n )\n\n const updatedLabels = {\n ...DEFAULT_LABELS,\n ...labels\n }\n\n const [calendarOpen, setCalendarOpen] = React.useState(false)\n\n const refDateToday = React.useRef<HTMLButtonElement>(null)\n const refDateSelected = React.useRef<HTMLButtonElement>(null)\n\n const iconSize = React.useMemo(() => getFieldIconSize(size), [size])\n\n return (\n <Box css={{ position: 'relative', height: 'max-content' }}>\n <Input\n name=\"date\"\n disabled={disabled}\n size={size}\n {...remainingProps}\n onChange={handleInputChange}\n ref={setInputElRef}\n defaultValue={dateString}\n />\n <Popover modal open={calendarOpen} onOpenChange={setCalendarOpen}>\n <Popover.Trigger asChild>\n <ActionIcon\n css={{\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n right: '0'\n }}\n disabled={disabled}\n label={updatedLabels.open}\n size={iconSize}\n theme=\"neutral\"\n hasTooltip={false}\n >\n <Icon is={CalendarEvent} />\n </ActionIcon>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n css={{ pr: '$sizes$2', zIndex: 1147483646 }}\n side=\"bottom\"\n align=\"end\"\n showCloseButton={false}\n onOpenAutoFocus={(e) => {\n e.preventDefault()\n if (date) {\n refDateSelected.current?.focus()\n } else {\n refDateToday.current?.focus()\n }\n }}\n >\n <Calendar\n date={date || new Date()}\n selected={date}\n onDateSelected={async (date) => {\n setCalendarOpen(false)\n await handleCalendarChange(date.date)\n if (revalidate) revalidate()\n }}\n setYear={async (date) => {\n await handleCalendarChange(date)\n if (revalidate) revalidate()\n }}\n minDate={minDate}\n maxDate={maxDate}\n refDateToday={refDateToday}\n refDateSelected={refDateSelected}\n firstDayOfWeek={firstDayOfWeek}\n monthNames={monthNames}\n weekdayNames={weekdayNames}\n labels={updatedLabels}\n />\n </Popover.Content>\n </Popover.Portal>\n </Popover>\n </Box>\n )\n }\n )\n\nDateInput.displayName = 'DateInput'\n"],"names":["dayjs","customParseFormat","formatDateToString","date","dateFormat","DEFAULT_DATE_FORMAT","DateInput","React","initialDate","firstDayOfWeek","disabled","monthNames","weekdayNames","size","labels","revalidate","onChange","minDate","maxDate","remainingProps","ref","setDate","inputElRef","setInputElRef","useCallbackRefState","dateString","handleInputChange","event","newDateString","parsedInputDate","newDate","handleCalendarChange","_a","nativeInputValueSetter","updatedLabels","DEFAULT_LABELS","calendarOpen","setCalendarOpen","refDateToday","refDateSelected","iconSize","getFieldIconSize","Box","Input","Popover","ActionIcon","Icon","CalendarEvent","e","_b","Calendar"],"mappings":"i2BAiBAA,EAAM,OAAOC,CAAiB,EAY9B,MAAMC,EAAqB,CAACC,EAAaC,EAAaC,IACpDF,EAAOH,EAAMG,CAAI,EAAE,OAAOC,CAAU,EAAI,GAE7BE,EACXC,EAAM,WACJ,CACE,CACE,YAAAC,EACA,WAAAJ,EAAaC,EACb,eAAAI,EAAiB,EACjB,SAAAC,EACA,WAAAC,EACA,aAAAC,EACA,KAAAC,EAAO,KACP,OAAAC,EACA,WAAAC,EACA,SAAAC,EACA,QAAAC,EACA,QAAAC,KACGC,CACL,EACAC,IACG,CACH,KAAM,CAACjB,EAAMkB,CAAO,EAAId,EAAM,SAC5BC,EAAcR,EAAMQ,CAAW,EAAE,OAAW,EAAA,MAC9C,EAEM,CAACc,EAAYC,CAAa,EAAIC,EAA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cAACqC,EAAA,CAAQ,MAAK,GAAC,KAAMR,EAAc,aAAcC,CAC/C9B,EAAAA,EAAA,cAACqC,EAAQ,QAAR,CAAgB,QAAO,EACtBrC,EAAAA,EAAA,cAACsC,EAAA,CACC,IAAK,CACH,SAAU,WACV,IAAK,MACL,UAAW,mBACX,MAAO,GACT,EACA,SAAUnC,EACV,MAAOwB,EAAc,KACrB,KAAMM,EACN,MAAM,UACN,WAAY,EAAA,EAEZjC,EAAA,cAACuC,EAAA,CAAK,GAAIC,CAAe,CAAA,CAC3B,CACF,EACAxC,EAAA,cAACqC,EAAQ,OAAR,KACCrC,EAAA,cAACqC,EAAQ,QAAR,CACC,IAAK,CAAE,GAAI,WAAY,OAAQ,UAAW,EAC1C,KAAK,SACL,MAAM,MACN,gBAAiB,GACjB,gBAAkBI,GAAM,CAlJxC,IAAAhB,EAAAiB,EAmJkBD,EAAE,eAAe,EACb7C,GACF6B,EAAAO,EAAgB,UAAhB,MAAAP,EAAyB,SAEzBiB,EAAAX,EAAa,UAAb,MAAAW,EAAsB,OAE1B,CAEA1C,EAAAA,EAAA,cAAC2C,EAAA,CACC,KAAM/C,GAAQ,IAAI,KAClB,SAAUA,EACV,eAAgB,MAAOA,GAAS,CAC9BkC,EAAgB,EAAK,EACrB,MAAMN,EAAqB5B,EAAK,IAAI,EAChCY,GAAYA,EAAAA,CAClB,EACA,QAAS,MAAOZ,GAAS,CACvB,MAAM4B,EAAqB5B,CAAI,EAC3BY,GAAYA,EAAW,CAC7B,EACA,QAASE,EACT,QAASC,EACT,aAAcoB,EACd,gBAAiBC,EACjB,eAAgB9B,EAChB,WAAYE,EACZ,aAAcC,EACd,OAAQsB,CAAAA,CACV,CACF,CACF,CACF,CACF,CAEJ,CACF,EAEF5B,EAAU,YAAc"}
@@ -1,2 +1,2 @@
1
- import{Close as g}from"@atom-learning/icons";import{Overlay as x,Content as f,Portal as v,Close as b}from"@radix-ui/react-dialog";import*as e from"react";import{DIALOG_Z_INDEX as w}from"../../constants/zIndices.js";import{keyframes as s,styled as l}from"../../stitches.js";import{backdropOverlay as $}from"../../utilities/style/backdrop-overlay.js";import{ActionIcon as z}from"../action-icon/ActionIcon.js";import{Icon as C}from"../icon/Icon.js";import{DialogBackground as n}from"./DialogBackground.js";const i="translate3d(-50%, -50%, 0)",m="translate3d(-50%, 50vh, 0)",d="modal_overlay",D=s({"0%":{transform:m},"100%":{transform:i}}),y=s({"0%":{transform:i},"100%":{transform:m}}),E=l(x,$),o={width:"auto",height:"auto",maxWidth:"auto",maxHeight:"auto","@supports (height: 100svh)":{height:"auto",maxHeight:"auto"}},I=l(f,{bg:"white",boxShadow:"$3",boxSizing:"border-box",left:"50%",maxWidth:"90vw",maxHeight:"90vh",overflowY:"auto",p:"$5",position:"fixed",top:"50%",transform:i,zIndex:w,"&:focus":{outline:"none"},"@allowMotion":{'&[data-state="open"]':{animation:`${D} 550ms cubic-bezier(0.22, 1, 0.36, 1)`},'&[data-state="closed"]':{animation:`${y} 550ms cubic-bezier(0.22, 1, 0.36, 1)`}},variants:{size:{xs:{...o,borderRadius:"$1",width:"380px"},sm:{...o,borderRadius:"$1",width:"480px"},md:{...o,borderRadius:"$1",width:"600px"},lg:{...o,borderRadius:"$1",width:"800px"},xl:{...o,borderRadius:"$1",width:"1100px"},fullscreen:{width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh","@supports (height: 100svh)":{height:"100svh",maxHeight:"100svh"}}}}}),H=({size:h="sm",children:a,closeDialogText:p="Close dialog",showCloseButton:u=!0,...c})=>e.createElement(v,null,e.createElement(E,{id:d},e.Children.map(a,t=>(t==null?void 0:t.type)===n&&t),e.createElement(I,{size:h,"aria-label":"Dialog",onPointerDownOutside:t=>{const r=t.target;(r==null?void 0:r.id)!==d&&t.preventDefault()},...c},u&&e.createElement(z,{as:b,css:{position:"absolute",right:"$4",top:"$4",size:"$5"},label:p,hasTooltip:!1,size:"md",theme:"neutral"},e.createElement(C,{is:g})),e.Children.map(a,t=>(t==null?void 0:t.type)!==n&&t))));export{H as DialogContent};
1
+ import{Close as g}from"@atom-learning/icons";import{Overlay as x,Content as f,Portal as v,Close as b}from"@radix-ui/react-dialog";import*as t from"react";import{keyframes as s,styled as l}from"../../stitches.js";import{backdropOverlay as w}from"../../utilities/style/backdrop-overlay.js";import{ActionIcon as $}from"../action-icon/ActionIcon.js";import{Icon as z}from"../icon/Icon.js";import{DialogBackground as n}from"./DialogBackground.js";const i="translate3d(-50%, -50%, 0)",m="translate3d(-50%, 50vh, 0)",d="modal_overlay",C=s({"0%":{transform:m},"100%":{transform:i}}),y=s({"0%":{transform:i},"100%":{transform:m}}),D=l(x,w),o={width:"auto",height:"auto",maxWidth:"auto",maxHeight:"auto","@supports (height: 100svh)":{height:"auto",maxHeight:"auto"}},E=l(f,{bg:"white",boxShadow:"$3",boxSizing:"border-box",left:"50%",maxWidth:"90vw",maxHeight:"90vh",overflowY:"auto",p:"$5",position:"fixed",top:"50%",transform:i,zIndex:1147483646,"&:focus":{outline:"none"},"@allowMotion":{'&[data-state="open"]':{animation:`${C} 550ms cubic-bezier(0.22, 1, 0.36, 1)`},'&[data-state="closed"]':{animation:`${y} 550ms cubic-bezier(0.22, 1, 0.36, 1)`}},variants:{size:{xs:{...o,borderRadius:"$1",width:"380px"},sm:{...o,borderRadius:"$1",width:"480px"},md:{...o,borderRadius:"$1",width:"600px"},lg:{...o,borderRadius:"$1",width:"800px"},xl:{...o,borderRadius:"$1",width:"1100px"},fullscreen:{width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh","@supports (height: 100svh)":{height:"100svh",maxHeight:"100svh"}}}}}),H=({size:h="sm",children:a,closeDialogText:p="Close dialog",showCloseButton:u=!0,...c})=>t.createElement(v,null,t.createElement(D,{id:d},t.Children.map(a,e=>(e==null?void 0:e.type)===n&&e),t.createElement(E,{size:h,"aria-label":"Dialog",onPointerDownOutside:e=>{const r=e.target;(r==null?void 0:r.id)!==d&&e.preventDefault()},...c},u&&t.createElement($,{as:b,css:{position:"absolute",right:"$4",top:"$4",size:"$5"},label:p,hasTooltip:!1,size:"md",theme:"neutral"},t.createElement(z,{is:g})),t.Children.map(a,e=>(e==null?void 0:e.type)!==n&&e))));export{H as DialogContent};
2
2
  //# sourceMappingURL=DialogContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContent.js","sources":["../../../src/components/dialog/DialogContent.tsx"],"sourcesContent":["import { Close as CloseIcon } from '@atom-learning/icons'\nimport { Close, Content, Overlay, Portal } from '@radix-ui/react-dialog'\nimport * as React from 'react'\n\nimport { DIALOG_Z_INDEX } from '~/constants/zIndices'\nimport { keyframes, styled } from '~/stitches'\nimport { backdropOverlay } from '~/utilities/style/backdrop-overlay'\n\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Icon } from '../icon/Icon'\nimport { DialogBackground } from './DialogBackground'\n\nconst contentOnScreen = 'translate3d(-50%, -50%, 0)'\nconst contentOffScreen = 'translate3d(-50%, 50vh, 0)'\nconst modalOverlayId = 'modal_overlay'\n\nconst slideIn = keyframes({\n '0%': { transform: contentOffScreen },\n '100%': { transform: contentOnScreen }\n})\nconst slideOut = keyframes({\n '0%': { transform: contentOnScreen },\n '100%': { transform: contentOffScreen }\n})\n\nconst StyledDialogOverlay = styled(Overlay, backdropOverlay)\n\nconst sizeReset = {\n width: 'auto',\n height: 'auto',\n maxWidth: 'auto',\n maxHeight: 'auto',\n '@supports (height: 100svh)': {\n height: 'auto',\n maxHeight: 'auto'\n }\n}\nconst StyledDialogContent = styled(Content, {\n bg: 'white',\n boxShadow: '$3',\n boxSizing: 'border-box',\n left: '50%',\n maxWidth: '90vw',\n maxHeight: '90vh',\n overflowY: 'auto',\n p: '$5',\n position: 'fixed',\n top: '50%',\n transform: contentOnScreen,\n zIndex: DIALOG_Z_INDEX,\n '&:focus': {\n outline: 'none'\n },\n '@allowMotion': {\n '&[data-state=\"open\"]': {\n animation: `${slideIn} 550ms cubic-bezier(0.22, 1, 0.36, 1)`\n },\n '&[data-state=\"closed\"]': {\n animation: `${slideOut} 550ms cubic-bezier(0.22, 1, 0.36, 1)`\n }\n },\n variants: {\n size: {\n xs: {\n ...sizeReset,\n borderRadius: '$1',\n width: '380px'\n },\n sm: {\n ...sizeReset,\n borderRadius: '$1',\n width: '480px'\n },\n md: {\n ...sizeReset,\n borderRadius: '$1',\n width: '600px'\n },\n lg: {\n ...sizeReset,\n borderRadius: '$1',\n width: '800px'\n },\n xl: {\n ...sizeReset,\n borderRadius: '$1',\n width: '1100px'\n },\n fullscreen: {\n width: '100vw',\n height: '100vh',\n maxWidth: '100vw',\n maxHeight: '100vh',\n '@supports (height: 100svh)': {\n height: '100svh',\n maxHeight: '100svh'\n }\n }\n }\n }\n})\n\ntype DialogContentProps = React.ComponentProps<typeof StyledDialogContent> & {\n closeDialogText?: string\n showCloseButton?: boolean\n}\n\nexport const DialogContent = ({\n size = 'sm',\n children,\n closeDialogText = 'Close dialog',\n showCloseButton = true,\n ...remainingProps\n}: DialogContentProps) => (\n <Portal>\n <StyledDialogOverlay id={modalOverlayId}>\n {React.Children.map(\n children,\n (child?: React.ReactElement) =>\n child?.type === DialogBackground && child\n )}\n <StyledDialogContent\n size={size}\n aria-label=\"Dialog\"\n onPointerDownOutside={(event) => {\n const element = event.target as HTMLElement\n if (element?.id !== modalOverlayId) {\n event.preventDefault()\n }\n }}\n {...remainingProps}\n >\n {showCloseButton && (\n <ActionIcon\n as={Close}\n css={{ position: 'absolute', right: '$4', top: '$4', size: '$5' }}\n label={closeDialogText}\n hasTooltip={false}\n size=\"md\"\n theme=\"neutral\"\n >\n <Icon is={CloseIcon} />\n </ActionIcon>\n )}\n {React.Children.map(\n children,\n (child?: React.ReactElement) =>\n child?.type !== DialogBackground && child\n )}\n </StyledDialogContent>\n </StyledDialogOverlay>\n </Portal>\n)\n"],"names":["contentOnScreen","contentOffScreen","modalOverlayId","slideIn","keyframes","slideOut","StyledDialogOverlay","styled","Overlay","backdropOverlay","sizeReset","StyledDialogContent","Content","DIALOG_Z_INDEX","DialogContent","size","children","closeDialogText","showCloseButton","remainingProps","React","Portal","child","DialogBackground","event","element","ActionIcon","Close","Icon","CloseIcon"],"mappings":"ufAYA,MAAMA,EAAkB,6BAClBC,EAAmB,6BACnBC,EAAiB,gBAEjBC,EAAUC,EAAU,CACxB,KAAM,CAAE,UAAWH,CAAiB,EACpC,OAAQ,CAAE,UAAWD,CAAgB,CACvC,CAAC,EACKK,EAAWD,EAAU,CACzB,KAAM,CAAE,UAAWJ,CAAgB,EACnC,OAAQ,CAAE,UAAWC,CAAiB,CACxC,CAAC,EAEKK,EAAsBC,EAAOC,EAASC,CAAe,EAErDC,EAAY,CAChB,MAAO,OACP,OAAQ,OACR,SAAU,OACV,UAAW,OACX,6BAA8B,CAC5B,OAAQ,OACR,UAAW,MACb,CACF,EACMC,EAAsBJ,EAAOK,EAAS,CAC1C,GAAI,QACJ,UAAW,KACX,UAAW,aACX,KAAM,MACN,SAAU,OACV,UAAW,OACX,UAAW,OACX,EAAG,KACH,SAAU,QACV,IAAK,MACL,UAAWZ,EACX,OAAQa,EACR,UAAW,CACT,QAAS,MACX,EACA,eAAgB,CACd,uBAAwB,CACtB,UAAW,GAAGV,wCAChB,EACA,yBAA0B,CACxB,UAAW,GAAGE,wCAChB,CACF,EACA,SAAU,CACR,KAAM,CACJ,GAAI,CACF,GAAGK,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,QACT,EACA,WAAY,CACV,MAAO,QACP,OAAQ,QACR,SAAU,QACV,UAAW,QACX,6BAA8B,CAC5B,OAAQ,SACR,UAAW,QACb,CACF,CACF,CACF,CACF,CAAC,EAOYI,EAAgB,CAAC,CAC5B,KAAAC,EAAO,KACP,SAAAC,EACA,gBAAAC,EAAkB,eAClB,gBAAAC,EAAkB,MACfC,CACL,IACEC,EAAA,cAACC,EAAA,KACCD,EAAA,cAACd,EAAA,CAAoB,GAAIJ,GACtBkB,EAAM,SAAS,IACdJ,EACCM,IACCA,GAAA,KAAA,OAAAA,EAAO,QAASC,GAAoBD,CACxC,EACAF,EAAA,cAACT,EAAA,CACC,KAAMI,EACN,aAAW,SACX,qBAAuBS,GAAU,CAC/B,MAAMC,EAAUD,EAAM,QAClBC,GAAA,KAAAA,OAAAA,EAAS,MAAOvB,GAClBsB,EAAM,eAEV,CAAA,EACC,GAAGL,CAAAA,EAEHD,GACCE,EAAA,cAACM,EAAA,CACC,GAAIC,EACJ,IAAK,CAAE,SAAU,WAAY,MAAO,KAAM,IAAK,KAAM,KAAM,IAAK,EAChE,MAAOV,EACP,WAAY,GACZ,KAAK,KACL,MAAM,SAENG,EAAAA,EAAA,cAACQ,EAAA,CAAK,GAAIC,CAAAA,CAAW,CACvB,EAEDT,EAAM,SAAS,IACdJ,EACCM,IACCA,GAAA,YAAAA,EAAO,QAASC,GAAoBD,CACxC,CACF,CACF,CACF"}
1
+ {"version":3,"file":"DialogContent.js","sources":["../../../src/components/dialog/DialogContent.tsx"],"sourcesContent":["import { Close as CloseIcon } from '@atom-learning/icons'\nimport { Close, Content, Overlay, Portal } from '@radix-ui/react-dialog'\nimport * as React from 'react'\n\nimport { keyframes, styled } from '~/stitches'\nimport { backdropOverlay } from '~/utilities/style/backdrop-overlay'\n\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Icon } from '../icon/Icon'\nimport { DialogBackground } from './DialogBackground'\n\nconst contentOnScreen = 'translate3d(-50%, -50%, 0)'\nconst contentOffScreen = 'translate3d(-50%, 50vh, 0)'\nconst modalOverlayId = 'modal_overlay'\n\nconst slideIn = keyframes({\n '0%': { transform: contentOffScreen },\n '100%': { transform: contentOnScreen }\n})\nconst slideOut = keyframes({\n '0%': { transform: contentOnScreen },\n '100%': { transform: contentOffScreen }\n})\n\nconst StyledDialogOverlay = styled(Overlay, backdropOverlay)\n\nconst sizeReset = {\n width: 'auto',\n height: 'auto',\n maxWidth: 'auto',\n maxHeight: 'auto',\n '@supports (height: 100svh)': {\n height: 'auto',\n maxHeight: 'auto'\n }\n}\nconst StyledDialogContent = styled(Content, {\n bg: 'white',\n boxShadow: '$3',\n boxSizing: 'border-box',\n left: '50%',\n maxWidth: '90vw',\n maxHeight: '90vh',\n overflowY: 'auto',\n p: '$5',\n position: 'fixed',\n top: '50%',\n transform: contentOnScreen,\n zIndex: 1147483646,\n '&:focus': {\n outline: 'none'\n },\n '@allowMotion': {\n '&[data-state=\"open\"]': {\n animation: `${slideIn} 550ms cubic-bezier(0.22, 1, 0.36, 1)`\n },\n '&[data-state=\"closed\"]': {\n animation: `${slideOut} 550ms cubic-bezier(0.22, 1, 0.36, 1)`\n }\n },\n variants: {\n size: {\n xs: {\n ...sizeReset,\n borderRadius: '$1',\n width: '380px'\n },\n sm: {\n ...sizeReset,\n borderRadius: '$1',\n width: '480px'\n },\n md: {\n ...sizeReset,\n borderRadius: '$1',\n width: '600px'\n },\n lg: {\n ...sizeReset,\n borderRadius: '$1',\n width: '800px'\n },\n xl: {\n ...sizeReset,\n borderRadius: '$1',\n width: '1100px'\n },\n fullscreen: {\n width: '100vw',\n height: '100vh',\n maxWidth: '100vw',\n maxHeight: '100vh',\n '@supports (height: 100svh)': {\n height: '100svh',\n maxHeight: '100svh'\n }\n }\n }\n }\n})\n\ntype DialogContentProps = React.ComponentProps<typeof StyledDialogContent> & {\n closeDialogText?: string\n showCloseButton?: boolean\n}\n\nexport const DialogContent = ({\n size = 'sm',\n children,\n closeDialogText = 'Close dialog',\n showCloseButton = true,\n ...remainingProps\n}: DialogContentProps) => (\n <Portal>\n <StyledDialogOverlay id={modalOverlayId}>\n {React.Children.map(\n children,\n (child?: React.ReactElement) =>\n child?.type === DialogBackground && child\n )}\n <StyledDialogContent\n size={size}\n aria-label=\"Dialog\"\n onPointerDownOutside={(event) => {\n const element = event.target as HTMLElement\n if (element?.id !== modalOverlayId) {\n event.preventDefault()\n }\n }}\n {...remainingProps}\n >\n {showCloseButton && (\n <ActionIcon\n as={Close}\n css={{ position: 'absolute', right: '$4', top: '$4', size: '$5' }}\n label={closeDialogText}\n hasTooltip={false}\n size=\"md\"\n theme=\"neutral\"\n >\n <Icon is={CloseIcon} />\n </ActionIcon>\n )}\n {React.Children.map(\n children,\n (child?: React.ReactElement) =>\n child?.type !== DialogBackground && child\n )}\n </StyledDialogContent>\n </StyledDialogOverlay>\n </Portal>\n)\n"],"names":["contentOnScreen","contentOffScreen","modalOverlayId","slideIn","keyframes","slideOut","StyledDialogOverlay","styled","Overlay","backdropOverlay","sizeReset","StyledDialogContent","Content","DialogContent","size","children","closeDialogText","showCloseButton","remainingProps","React","Portal","child","DialogBackground","event","element","ActionIcon","Close","Icon","CloseIcon"],"mappings":"0bAWA,MAAMA,EAAkB,6BAClBC,EAAmB,6BACnBC,EAAiB,gBAEjBC,EAAUC,EAAU,CACxB,KAAM,CAAE,UAAWH,CAAiB,EACpC,OAAQ,CAAE,UAAWD,CAAgB,CACvC,CAAC,EACKK,EAAWD,EAAU,CACzB,KAAM,CAAE,UAAWJ,CAAgB,EACnC,OAAQ,CAAE,UAAWC,CAAiB,CACxC,CAAC,EAEKK,EAAsBC,EAAOC,EAASC,CAAe,EAErDC,EAAY,CAChB,MAAO,OACP,OAAQ,OACR,SAAU,OACV,UAAW,OACX,6BAA8B,CAC5B,OAAQ,OACR,UAAW,MACb,CACF,EACMC,EAAsBJ,EAAOK,EAAS,CAC1C,GAAI,QACJ,UAAW,KACX,UAAW,aACX,KAAM,MACN,SAAU,OACV,UAAW,OACX,UAAW,OACX,EAAG,KACH,SAAU,QACV,IAAK,MACL,UAAWZ,EACX,OAAQ,WACR,UAAW,CACT,QAAS,MACX,EACA,eAAgB,CACd,uBAAwB,CACtB,UAAW,GAAGG,wCAChB,EACA,yBAA0B,CACxB,UAAW,GAAGE,wCAChB,CACF,EACA,SAAU,CACR,KAAM,CACJ,GAAI,CACF,GAAGK,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,OACT,EACA,GAAI,CACF,GAAGA,EACH,aAAc,KACd,MAAO,QACT,EACA,WAAY,CACV,MAAO,QACP,OAAQ,QACR,SAAU,QACV,UAAW,QACX,6BAA8B,CAC5B,OAAQ,SACR,UAAW,QACb,CACF,CACF,CACF,CACF,CAAC,EAOYG,EAAgB,CAAC,CAC5B,KAAAC,EAAO,KACP,SAAAC,EACA,gBAAAC,EAAkB,eAClB,gBAAAC,EAAkB,MACfC,CACL,IACEC,EAAA,cAACC,EAAA,KACCD,EAAA,cAACb,EAAA,CAAoB,GAAIJ,CAAAA,EACtBiB,EAAM,SAAS,IACdJ,EACCM,IACCA,GAAA,KAAAA,OAAAA,EAAO,QAASC,GAAoBD,CACxC,EACAF,EAAA,cAACR,EAAA,CACC,KAAMG,EACN,aAAW,SACX,qBAAuBS,GAAU,CAC/B,MAAMC,EAAUD,EAAM,QAClBC,GAAA,KAAA,OAAAA,EAAS,MAAOtB,GAClBqB,EAAM,eAEV,CAAA,EACC,GAAGL,CAEHD,EAAAA,GACCE,EAAA,cAACM,EAAA,CACC,GAAIC,EACJ,IAAK,CAAE,SAAU,WAAY,MAAO,KAAM,IAAK,KAAM,KAAM,IAAK,EAChE,MAAOV,EACP,WAAY,GACZ,KAAK,KACL,MAAM,WAENG,EAAA,cAACQ,EAAA,CAAK,GAAIC,CAAW,CAAA,CACvB,EAEDT,EAAM,SAAS,IACdJ,EACCM,IACCA,GAAA,YAAAA,EAAO,QAASC,GAAoBD,CACxC,CACF,CACF,CACF"}
@@ -1,2 +1,2 @@
1
- import{Content as l,Portal as p}from"@radix-ui/react-dialog";import t from"react";import{Flex as s}from"../flex/Flex.js";import{DIALOG_Z_INDEX as c}from"../../constants/zIndices.js";import{ColorScheme as x}from"../../experiments/color-scheme/ColorScheme.js";import{styled as w}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import"../../utilities/no-overflow-wrapper/NoOverflowWrapper.js";import"color2k";import{slideInOut as e}from"../../utilities/style/keyframe-animations.js";import{DrawerContext as h}from"./Drawer.context.js";import{DrawerOverlay as u}from"./DrawerOverlay.js";const f=e({outPosition:{x:0,y:"-100%"}}),y=e({outPosition:{x:"100%",y:0}}),g=e({outPosition:{x:0,y:"100%"}}),C=e({outPosition:{x:"-100%",y:0}}),i=o=>({'&[data-state="open"]':{animationName:o.in},'&[data-state="closed"]':{animationName:o.out}}),n={left:0,width:"100%",maxHeight:"85%"},r={top:0,height:"100%",width:"var(--drawer-content-width, 100%)",maxWidth:"100%"},a=w(l,{bg:"$base1",boxShadow:"$2",position:"fixed",zIndex:c,"@allowMotion":{animationTimingFunction:"ease-out",animationDuration:"250ms"},variants:{position:{top:{top:0,...n,...i(f)},right:{right:0,...r,...i(y)},bottom:{bottom:0,...n,...i(g)},left:{left:0,...r,...i(C)}},size:{xs:{"--drawer-content-width":"240px"},sm:{"--drawer-content-width":"256px"},md:{"--drawer-content-width":"288px"},lg:{"--drawer-content-width":"304px"},xl:{"--drawer-content-width":"320px"},"2xl":{"--drawer-content-width":"720px"},"3xl":{"--drawer-content-width":"1000px"}}}}),D=({children:o,...m})=>{const{position:d}=t.useContext(h);return t.createElement(p,null,t.createElement(u,null),t.createElement(x,{base:"grey1",accent:"primary1",asChild:!0},t.createElement(a,{size:"lg",position:d,...m,asChild:!0},t.createElement(s,{direction:"column"},o))))};export{D as DrawerContent,a as StyledContent};
1
+ import{Content as l,Portal as p}from"@radix-ui/react-dialog";import t from"react";import{Flex as s}from"../flex/Flex.js";import{ColorScheme as c}from"../../experiments/color-scheme/ColorScheme.js";import{styled as x}from"../../stitches.js";import"../../utilities/css-wrapper/CSSWrapper.js";import"color2k";import{slideInOut as e}from"../../utilities/style/keyframe-animations.js";import"../../utilities/no-overflow-wrapper/NoOverflowWrapper.js";import{DrawerContext as w}from"./Drawer.context.js";import{DrawerOverlay as h}from"./DrawerOverlay.js";const u=e({outPosition:{x:0,y:"-100%"}}),f=e({outPosition:{x:"100%",y:0}}),y=e({outPosition:{x:0,y:"100%"}}),g=e({outPosition:{x:"-100%",y:0}}),i=o=>({'&[data-state="open"]':{animationName:o.in},'&[data-state="closed"]':{animationName:o.out}}),n={left:0,width:"100%",maxHeight:"85%"},r={top:0,height:"100%",width:"var(--drawer-content-width, 100%)",maxWidth:"100%"},a=x(l,{bg:"$base1",boxShadow:"$2",position:"fixed",zIndex:1147483646,"@allowMotion":{animationTimingFunction:"ease-out",animationDuration:"250ms"},variants:{position:{top:{top:0,...n,...i(u)},right:{right:0,...r,...i(f)},bottom:{bottom:0,...n,...i(y)},left:{left:0,...r,...i(g)}},size:{xs:{"--drawer-content-width":"240px"},sm:{"--drawer-content-width":"256px"},md:{"--drawer-content-width":"288px"},lg:{"--drawer-content-width":"304px"},xl:{"--drawer-content-width":"320px"},"2xl":{"--drawer-content-width":"720px"},"3xl":{"--drawer-content-width":"1000px"}}}}),C=({children:o,...m})=>{const{position:d}=t.useContext(w);return t.createElement(p,null,t.createElement(h,null),t.createElement(c,{base:"grey1",accent:"primary1",asChild:!0},t.createElement(a,{size:"lg",position:d,...m,asChild:!0},t.createElement(s,{direction:"column"},o))))};export{C as DrawerContent,a as StyledContent};
2
2
  //# sourceMappingURL=DrawerContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerContent.js","sources":["../../../src/components/drawer/DrawerContent.tsx"],"sourcesContent":["import { Content, Portal } from '@radix-ui/react-dialog'\nimport React from 'react'\n\nimport { Flex } from '~/components/flex'\nimport { DIALOG_Z_INDEX } from '~/constants/zIndices'\nimport { ColorScheme } from '~/experiments/color-scheme'\nimport { styled } from '~/stitches'\nimport { slideInOut } from '~/utilities'\n\nimport { DrawerContext } from './Drawer.context'\nimport { DrawerOverlay } from './DrawerOverlay'\n\nconst animationTop = slideInOut({ outPosition: { x: 0, y: '-100%' } })\nconst animationRight = slideInOut({ outPosition: { x: '100%', y: 0 } })\nconst animationBottom = slideInOut({ outPosition: { x: 0, y: '100%' } })\nconst animationLeft = slideInOut({ outPosition: { x: '-100%', y: 0 } })\nconst setupAnimation = (animation: ReturnType<typeof slideInOut>) => {\n return {\n '&[data-state=\"open\"]': {\n animationName: animation.in\n },\n '&[data-state=\"closed\"]': {\n animationName: animation.out\n }\n }\n}\n\nconst positionY = {\n left: 0,\n width: '100%',\n maxHeight: '85%'\n}\n\nconst positionX = {\n top: 0,\n height: '100%',\n width: 'var(--drawer-content-width, 100%)',\n maxWidth: '100%'\n}\n\nexport const StyledContent = styled(Content, {\n bg: '$base1',\n boxShadow: '$2',\n position: 'fixed',\n zIndex: DIALOG_Z_INDEX,\n '@allowMotion': {\n animationTimingFunction: 'ease-out',\n animationDuration: '250ms'\n },\n variants: {\n position: {\n top: {\n top: 0,\n ...positionY,\n ...setupAnimation(animationTop)\n },\n right: {\n right: 0,\n ...positionX,\n ...setupAnimation(animationRight)\n },\n bottom: {\n bottom: 0,\n ...positionY,\n ...setupAnimation(animationBottom)\n },\n left: {\n left: 0,\n ...positionX,\n ...setupAnimation(animationLeft)\n }\n },\n size: {\n xs: {\n '--drawer-content-width': '240px'\n },\n sm: {\n '--drawer-content-width': '256px'\n },\n md: {\n '--drawer-content-width': '288px'\n },\n lg: {\n '--drawer-content-width': '304px'\n },\n xl: {\n '--drawer-content-width': '320px'\n },\n '2xl': {\n '--drawer-content-width': '720px'\n },\n '3xl': {\n '--drawer-content-width': '1000px'\n }\n }\n }\n})\n\nexport const DrawerContent = ({\n children,\n ...rest\n}: React.ComponentProps<typeof StyledContent>) => {\n const { position } = React.useContext(DrawerContext)\n\n return (\n <Portal>\n <DrawerOverlay />\n <ColorScheme base=\"grey1\" accent=\"primary1\" asChild>\n <StyledContent size=\"lg\" position={position} {...rest} asChild>\n <Flex direction=\"column\">{children}</Flex>\n </StyledContent>\n </ColorScheme>\n </Portal>\n )\n}\n"],"names":["animationTop","slideInOut","animationRight","animationBottom","animationLeft","setupAnimation","animation","positionY","positionX","StyledContent","styled","Content","DIALOG_Z_INDEX","DrawerContent","children","rest","position","React","DrawerContext","Portal","DrawerOverlay","ColorScheme","Flex"],"mappings":"imBAYA,MAAMA,EAAeC,EAAW,CAAE,YAAa,CAAE,EAAG,EAAG,EAAG,OAAQ,CAAE,CAAC,EAC/DC,EAAiBD,EAAW,CAAE,YAAa,CAAE,EAAG,OAAQ,EAAG,CAAE,CAAE,CAAC,EAChEE,EAAkBF,EAAW,CAAE,YAAa,CAAE,EAAG,EAAG,EAAG,MAAO,CAAE,CAAC,EACjEG,EAAgBH,EAAW,CAAE,YAAa,CAAE,EAAG,QAAS,EAAG,CAAE,CAAE,CAAC,EAChEI,EAAkBC,IACf,CACL,uBAAwB,CACtB,cAAeA,EAAU,EAC3B,EACA,yBAA0B,CACxB,cAAeA,EAAU,GAC3B,CACF,GAGIC,EAAY,CAChB,KAAM,EACN,MAAO,OACP,UAAW,KACb,EAEMC,EAAY,CAChB,IAAK,EACL,OAAQ,OACR,MAAO,oCACP,SAAU,MACZ,EAEaC,EAAgBC,EAAOC,EAAS,CAC3C,GAAI,SACJ,UAAW,KACX,SAAU,QACV,OAAQC,EACR,eAAgB,CACd,wBAAyB,WACzB,kBAAmB,OACrB,EACA,SAAU,CACR,SAAU,CACR,IAAK,CACH,IAAK,EACL,GAAGL,EACH,GAAGF,EAAeL,CAAY,CAChC,EACA,MAAO,CACL,MAAO,EACP,GAAGQ,EACH,GAAGH,EAAeH,CAAc,CAClC,EACA,OAAQ,CACN,OAAQ,EACR,GAAGK,EACH,GAAGF,EAAeF,CAAe,CACnC,EACA,KAAM,CACJ,KAAM,EACN,GAAGK,EACH,GAAGH,EAAeD,CAAa,CACjC,CACF,EACA,KAAM,CACJ,GAAI,CACF,yBAA0B,OAC5B,EACA,GAAI,CACF,yBAA0B,OAC5B,EACA,GAAI,CACF,yBAA0B,OAC5B,EACA,GAAI,CACF,yBAA0B,OAC5B,EACA,GAAI,CACF,yBAA0B,OAC5B,EACA,MAAO,CACL,yBAA0B,OAC5B,EACA,MAAO,CACL,yBAA0B,QAC5B,CACF,CACF,CACF,CAAC,EAEYS,EAAgB,CAAC,CAC5B,SAAAC,KACGC,CACL,IAAkD,CAChD,KAAM,CAAE,SAAAC,CAAS,EAAIC,EAAM,WAAWC,CAAa,EAEnD,OACED,EAAA,cAACE,EAAA,KACCF,EAAA,cAACG,EAAA,IAAc,EACfH,EAAA,cAACI,EAAA,CAAY,KAAK,QAAQ,OAAO,WAAW,QAAO,EACjDJ,EAAAA,EAAA,cAACR,EAAc,CAAA,KAAK,KAAK,SAAUO,EAAW,GAAGD,EAAM,QAAO,IAC5DE,EAAA,cAACK,EAAA,CAAK,UAAU,QAAUR,EAAAA,CAAS,CACrC,CACF,CACF,CAEJ"}
1
+ {"version":3,"file":"DrawerContent.js","sources":["../../../src/components/drawer/DrawerContent.tsx"],"sourcesContent":["import { Content, Portal } from '@radix-ui/react-dialog'\nimport React from 'react'\n\nimport { Flex } from '~/components/flex'\nimport { ColorScheme } from '~/experiments/color-scheme'\nimport { styled } from '~/stitches'\nimport { slideInOut } from '~/utilities'\n\nimport { DrawerContext } from './Drawer.context'\nimport { DrawerOverlay } from './DrawerOverlay'\n\nconst animationTop = slideInOut({ outPosition: { x: 0, y: '-100%' } })\nconst animationRight = slideInOut({ outPosition: { x: '100%', y: 0 } })\nconst animationBottom = slideInOut({ outPosition: { x: 0, y: '100%' } })\nconst animationLeft = slideInOut({ outPosition: { x: '-100%', y: 0 } })\nconst setupAnimation = (animation: ReturnType<typeof slideInOut>) => {\n return {\n '&[data-state=\"open\"]': {\n animationName: animation.in\n },\n '&[data-state=\"closed\"]': {\n animationName: animation.out\n }\n }\n}\n\nconst positionY = {\n left: 0,\n width: '100%',\n maxHeight: '85%'\n}\n\nconst positionX = {\n top: 0,\n height: '100%',\n width: 'var(--drawer-content-width, 100%)',\n maxWidth: '100%'\n}\n\nexport const StyledContent = styled(Content, {\n bg: '$base1',\n boxShadow: '$2',\n position: 'fixed',\n zIndex: 1147483646,\n '@allowMotion': {\n animationTimingFunction: 'ease-out',\n animationDuration: '250ms'\n },\n variants: {\n position: {\n top: {\n top: 0,\n ...positionY,\n ...setupAnimation(animationTop)\n },\n right: {\n right: 0,\n ...positionX,\n ...setupAnimation(animationRight)\n },\n bottom: {\n bottom: 0,\n ...positionY,\n ...setupAnimation(animationBottom)\n },\n left: {\n left: 0,\n ...positionX,\n ...setupAnimation(animationLeft)\n }\n },\n size: {\n xs: {\n '--drawer-content-width': '240px'\n },\n sm: {\n '--drawer-content-width': '256px'\n },\n md: {\n '--drawer-content-width': '288px'\n },\n lg: {\n '--drawer-content-width': '304px'\n },\n xl: {\n '--drawer-content-width': '320px'\n },\n '2xl': {\n '--drawer-content-width': '720px'\n },\n '3xl': {\n '--drawer-content-width': '1000px'\n }\n }\n }\n})\n\nexport const DrawerContent = ({\n children,\n ...rest\n}: React.ComponentProps<typeof StyledContent>) => {\n const { position } = React.useContext(DrawerContext)\n\n return (\n <Portal>\n <DrawerOverlay />\n <ColorScheme base=\"grey1\" accent=\"primary1\" asChild>\n <StyledContent size=\"lg\" position={position} {...rest} asChild>\n <Flex direction=\"column\">{children}</Flex>\n </StyledContent>\n </ColorScheme>\n </Portal>\n )\n}\n"],"names":["animationTop","slideInOut","animationRight","animationBottom","animationLeft","setupAnimation","animation","positionY","positionX","StyledContent","styled","Content","DrawerContent","children","rest","position","React","DrawerContext","Portal","DrawerOverlay","ColorScheme","Flex"],"mappings":"oiBAWA,MAAMA,EAAeC,EAAW,CAAE,YAAa,CAAE,EAAG,EAAG,EAAG,OAAQ,CAAE,CAAC,EAC/DC,EAAiBD,EAAW,CAAE,YAAa,CAAE,EAAG,OAAQ,EAAG,CAAE,CAAE,CAAC,EAChEE,EAAkBF,EAAW,CAAE,Y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,WAAW,QAAO,EACjDJ,EAAAA,EAAA,cAACP,EAAc,CAAA,KAAK,KAAK,SAAUM,EAAW,GAAGD,EAAM,QAAO,IAC5DE,EAAA,cAACK,EAAA,CAAK,UAAU,QAAUR,EAAAA,CAAS,CACrC,CACF,CACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{styled as o}from"../../stitches.js";import{drawerSection as r}from"./Drawer.styles.js";const e=o("div",{...r,borderTop:"1px solid $base3"});export{e as DrawerFooter};
1
+ import{styled as o}from"../../stitches.js";const r=o("div",{p:"$4",width:"100%",borderTop:"1px solid $base3"});export{r as DrawerFooter};
2
2
  //# sourceMappingURL=DrawerFooter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerFooter.js","sources":["../../../src/components/drawer/DrawerFooter.tsx"],"sourcesContent":["import { styled } from '~/stitches'\n\nimport { drawerSection } from './Drawer.styles'\n\nexport const DrawerFooter = styled('div', {\n ...drawerSection,\n borderTop: '1px solid $base3'\n})\n"],"names":["DrawerFooter","styled","drawerSection"],"mappings":"8FAIO,MAAMA,EAAeC,EAAO,MAAO,CACxC,GAAGC,EACH,UAAW,kBACb,CAAC"}
1
+ {"version":3,"file":"DrawerFooter.js","sources":["../../../src/components/drawer/DrawerFooter.tsx"],"sourcesContent":["import { styled } from '~/stitches'\n\nexport const DrawerFooter = styled('div', {\n p: '$4',\n width: '100%',\n borderTop: '1px solid $base3'\n})\n"],"names":["DrawerFooter","styled"],"mappings":"2CAEO,MAAMA,EAAeC,EAAO,MAAO,CACxC,EAAG,KACH,MAAO,OACP,UAAW,kBACb,CAAC"}
@@ -1,2 +1,2 @@
1
- import{styled as r}from"../../stitches.js";import{drawerSection as o}from"./Drawer.styles.js";const e=r("div",{...o,minHeight:"$6",borderBottom:"1px solid $base3"});export{e as DrawerHeader};
1
+ import{styled as e}from"../../stitches.js";const o=e("div",{p:"$4",width:"100%",minHeight:"$6",borderBottom:"1px solid $base3"});export{o as DrawerHeader};
2
2
  //# sourceMappingURL=DrawerHeader.js.map