@atom-learning/components 9.0.0-beta.5 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/components/alert-dialog/AlertDialog.context.js +9 -6
  2. package/dist/components/alert-dialog/AlertDialog.context.js.map +1 -1
  3. package/dist/components/alert-dialog/alert-context/reducer.js +1 -5
  4. package/dist/components/alert-dialog/alert-context/reducer.js.map +1 -1
  5. package/dist/components/alert-dialog/alert-context/types.d.ts +1 -2
  6. package/dist/components/avatar/Avatar.js +5 -6
  7. package/dist/components/avatar/Avatar.js.map +1 -1
  8. package/dist/components/avatar/AvatarIcon.js +2 -2
  9. package/dist/components/avatar/AvatarIcon.js.map +1 -1
  10. package/dist/components/avatar/AvatarInitial.js +2 -2
  11. package/dist/components/avatar/AvatarInitial.js.map +1 -1
  12. package/dist/components/badge/Badge.context.js +12 -13
  13. package/dist/components/badge/Badge.context.js.map +1 -1
  14. package/dist/components/badge/Badge.js +4 -3
  15. package/dist/components/badge/Badge.js.map +1 -1
  16. package/dist/components/badge/BadgeText.js +3 -3
  17. package/dist/components/badge/BadgeText.js.map +1 -1
  18. package/dist/components/banner/Banner.context.js +13 -14
  19. package/dist/components/banner/Banner.context.js.map +1 -1
  20. package/dist/components/banner/banner-regular/BannerRegularActions.js +2 -8
  21. package/dist/components/banner/banner-regular/BannerRegularActions.js.map +1 -1
  22. package/dist/components/banner/banner-regular/BannerRegularButton.js +2 -2
  23. package/dist/components/banner/banner-regular/BannerRegularButton.js.map +1 -1
  24. package/dist/components/banner/banner-regular/BannerRegularDismiss.js +1 -1
  25. package/dist/components/banner/banner-regular/BannerRegularDismiss.js.map +1 -1
  26. package/dist/components/banner/banner-slim/BannerSlimButton.js +2 -2
  27. package/dist/components/banner/banner-slim/BannerSlimButton.js.map +1 -1
  28. package/dist/components/banner/banner-slim/BannerSlimContainer.js +4 -13
  29. package/dist/components/banner/banner-slim/BannerSlimContainer.js.map +1 -1
  30. package/dist/components/button/Button.js +5 -1
  31. package/dist/components/button/Button.js.map +1 -1
  32. package/dist/components/calendar/Calendar.d.ts +1 -1
  33. package/dist/components/calendar/Calendar.js +4 -2
  34. package/dist/components/calendar/Calendar.js.map +1 -1
  35. package/dist/components/carousel/Carousel.js +2 -2
  36. package/dist/components/carousel/Carousel.js.map +1 -1
  37. package/dist/components/carousel/CarouselSlide.js +1 -1
  38. package/dist/components/carousel/CarouselSlide.js.map +1 -1
  39. package/dist/components/carousel/CarouselSlider.js +1 -1
  40. package/dist/components/carousel/CarouselSlider.js.map +1 -1
  41. package/dist/components/checkbox/Checkbox.js +2 -2
  42. package/dist/components/checkbox/Checkbox.js.map +1 -1
  43. package/dist/components/checkbox-field/CheckboxField.js +7 -3
  44. package/dist/components/checkbox-field/CheckboxField.js.map +1 -1
  45. package/dist/components/checkbox-group/CheckboxGroupAllItem.js +2 -2
  46. package/dist/components/checkbox-group/CheckboxGroupAllItem.js.map +1 -1
  47. package/dist/components/checkbox-group/CheckboxGroupChecked.context.js +13 -14
  48. package/dist/components/checkbox-group/CheckboxGroupChecked.context.js.map +1 -1
  49. package/dist/components/checkbox-group/CheckboxGroupItem.js +2 -2
  50. package/dist/components/checkbox-group/CheckboxGroupItem.js.map +1 -1
  51. package/dist/components/checkbox-group/CheckboxGroupMounted.context.js +6 -7
  52. package/dist/components/checkbox-group/CheckboxGroupMounted.context.js.map +1 -1
  53. package/dist/components/chip/Chip.js +4 -5
  54. package/dist/components/chip/Chip.js.map +1 -1
  55. package/dist/components/create-password-field/CreatePasswordField.js +1 -1
  56. package/dist/components/create-password-field/CreatePasswordField.js.map +1 -1
  57. package/dist/components/data-table/DataTable.context.js +43 -26
  58. package/dist/components/data-table/DataTable.context.js.map +1 -1
  59. package/dist/components/data-table/DataTable.types.d.ts +1 -0
  60. package/dist/components/data-table/DataTable.types.js.map +1 -1
  61. package/dist/components/data-table/DataTableBulkActionsFloating.js +2 -6
  62. package/dist/components/data-table/DataTableBulkActionsFloating.js.map +1 -1
  63. package/dist/components/data-table/DataTableGlobalFilter.js +16 -8
  64. package/dist/components/data-table/DataTableGlobalFilter.js.map +1 -1
  65. package/dist/components/data-table/DataTableHead.js +5 -14
  66. package/dist/components/data-table/DataTableHead.js.map +1 -1
  67. package/dist/components/data-table/DataTableRowSelectionCheckbox.js +1 -0
  68. package/dist/components/data-table/DataTableRowSelectionCheckbox.js.map +1 -1
  69. package/dist/components/data-table/DataTableSelectAllRowsCheckbox.js +2 -1
  70. package/dist/components/data-table/DataTableSelectAllRowsCheckbox.js.map +1 -1
  71. package/dist/components/data-table/DataTableTable.js +8 -6
  72. package/dist/components/data-table/DataTableTable.js.map +1 -1
  73. package/dist/components/data-table/drag-and-drop/DragAndDropTable.js +1 -1
  74. package/dist/components/data-table/drag-and-drop/DragAndDropTable.js.map +1 -1
  75. package/dist/components/data-table/pagination/Pagination.js +3 -2
  76. package/dist/components/data-table/pagination/Pagination.js.map +1 -1
  77. package/dist/components/data-table/usePagination.d.ts +1 -0
  78. package/dist/components/data-table/usePagination.js +7 -2
  79. package/dist/components/data-table/usePagination.js.map +1 -1
  80. package/dist/components/date-input/DateInput.js +4 -3
  81. package/dist/components/date-input/DateInput.js.map +1 -1
  82. package/dist/components/dialog/DialogContent.js +19 -6
  83. package/dist/components/dialog/DialogContent.js.map +1 -1
  84. package/dist/components/dismissible/DismissibleRoot.js +15 -16
  85. package/dist/components/dismissible/DismissibleRoot.js.map +1 -1
  86. package/dist/components/dismissible/DismissibleTrigger.js +1 -1
  87. package/dist/components/dismissible/DismissibleTrigger.js.map +1 -1
  88. package/dist/components/dismissible-group/DismissibleGroupItem.js +1 -1
  89. package/dist/components/dismissible-group/DismissibleGroupItem.js.map +1 -1
  90. package/dist/components/dismissible-group/DismissibleGroupRoot.js +5 -6
  91. package/dist/components/dismissible-group/DismissibleGroupRoot.js.map +1 -1
  92. package/dist/components/drawer/Drawer.context.js +2 -3
  93. package/dist/components/drawer/Drawer.context.js.map +1 -1
  94. package/dist/components/drawer/DrawerContent.js +1 -1
  95. package/dist/components/drawer/DrawerContent.js.map +1 -1
  96. package/dist/components/empty-state/EmptyState.context.js +2 -3
  97. package/dist/components/empty-state/EmptyState.context.js.map +1 -1
  98. package/dist/components/empty-state/EmptyStateBody.js +1 -1
  99. package/dist/components/empty-state/EmptyStateBody.js.map +1 -1
  100. package/dist/components/empty-state/EmptyStateImage.js +1 -1
  101. package/dist/components/empty-state/EmptyStateImage.js.map +1 -1
  102. package/dist/components/empty-state/EmptyStateTitle.js +1 -1
  103. package/dist/components/empty-state/EmptyStateTitle.js.map +1 -1
  104. package/dist/components/file-drop/FileDrop.js +3 -3
  105. package/dist/components/file-drop/FileDrop.js.map +1 -1
  106. package/dist/components/file-drop/useFileDrop.js +1 -1
  107. package/dist/components/file-drop/useFileDrop.js.map +1 -1
  108. package/dist/components/form/Form.js +7 -6
  109. package/dist/components/form/Form.js.map +1 -1
  110. package/dist/components/form/useFormCustomContext.js +1 -1
  111. package/dist/components/form/useFormCustomContext.js.map +1 -1
  112. package/dist/components/index.d.ts +0 -3
  113. package/dist/components/index.js +1 -4
  114. package/dist/components/index.js.map +1 -1
  115. package/dist/components/input/Input.js +2 -2
  116. package/dist/components/input/Input.js.map +1 -1
  117. package/dist/components/keyboard-shortcut/KeyboardShortcut.js +10 -7
  118. package/dist/components/keyboard-shortcut/KeyboardShortcut.js.map +1 -1
  119. package/dist/components/markdown-content/MarkdownContent.d.ts +1 -1
  120. package/dist/components/markdown-content/MarkdownContent.js +4 -4
  121. package/dist/components/markdown-content/MarkdownContent.js.map +1 -1
  122. package/dist/components/navigation/NavigationMenu.context.js +1 -1
  123. package/dist/components/navigation/NavigationMenu.context.js.map +1 -1
  124. package/dist/components/navigation/NavigationMenu.js +7 -6
  125. package/dist/components/navigation/NavigationMenu.js.map +1 -1
  126. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordion.d.ts +2 -2
  127. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordion.js +3 -3
  128. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordion.js.map +1 -1
  129. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionContent.js +1 -1
  130. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionContent.js.map +1 -1
  131. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionTrigger.js +1 -1
  132. package/dist/components/navigation-menu-vertical/NavigationMenuVerticalAccordionTrigger.js.map +1 -1
  133. package/dist/components/number-input/NumberInput.js +15 -16
  134. package/dist/components/number-input/NumberInput.js.map +1 -1
  135. package/dist/components/number-input-field/NumberInputField.js +7 -3
  136. package/dist/components/number-input-field/NumberInputField.js.map +1 -1
  137. package/dist/components/pagination/Pagination.context.js +29 -22
  138. package/dist/components/pagination/Pagination.context.js.map +1 -1
  139. package/dist/components/pagination/usePagination.js +1 -1
  140. package/dist/components/pagination/usePagination.js.map +1 -1
  141. package/dist/components/password-input/PasswordInput.js +1 -2
  142. package/dist/components/password-input/PasswordInput.js.map +1 -1
  143. package/dist/components/radio-button-field/RadioButtonField.js +7 -3
  144. package/dist/components/radio-button-field/RadioButtonField.js.map +1 -1
  145. package/dist/components/search-input/SearchInput.js +7 -11
  146. package/dist/components/search-input/SearchInput.js.map +1 -1
  147. package/dist/components/section-message/SectionMessage.context.js +15 -16
  148. package/dist/components/section-message/SectionMessage.context.js.map +1 -1
  149. package/dist/components/segmented-control/SegmentedControlBadge.js +1 -1
  150. package/dist/components/segmented-control/SegmentedControlBadge.js.map +1 -1
  151. package/dist/components/segmented-control/SegmentedControlDescription.js +1 -1
  152. package/dist/components/segmented-control/SegmentedControlDescription.js.map +1 -1
  153. package/dist/components/segmented-control/SegmentedControlHeading.js +1 -1
  154. package/dist/components/segmented-control/SegmentedControlHeading.js.map +1 -1
  155. package/dist/components/segmented-control/SegmentedControlIcon.js +1 -1
  156. package/dist/components/segmented-control/SegmentedControlIcon.js.map +1 -1
  157. package/dist/components/segmented-control/SegmentedControlItem.js +1 -1
  158. package/dist/components/segmented-control/SegmentedControlItem.js.map +1 -1
  159. package/dist/components/segmented-control/SegmentedControlItemList.js +20 -14
  160. package/dist/components/segmented-control/SegmentedControlItemList.js.map +1 -1
  161. package/dist/components/segmented-control/SegmentedControlRoot.js +18 -19
  162. package/dist/components/segmented-control/SegmentedControlRoot.js.map +1 -1
  163. package/dist/components/select-menu/SelectMenu.context.js +1 -1
  164. package/dist/components/select-menu/SelectMenu.context.js.map +1 -1
  165. package/dist/components/select-menu/SelectMenu.js +18 -12
  166. package/dist/components/select-menu/SelectMenu.js.map +1 -1
  167. package/dist/components/side-bar/SideBar.context.js +1 -1
  168. package/dist/components/side-bar/SideBar.context.js.map +1 -1
  169. package/dist/components/side-bar/SideBar.js +2 -2
  170. package/dist/components/side-bar/SideBar.js.map +1 -1
  171. package/dist/components/skeleton-loader/SkeletonCard.js.map +1 -1
  172. package/dist/components/slider-field/SliderField.js +8 -3
  173. package/dist/components/slider-field/SliderField.js.map +1 -1
  174. package/dist/components/sortable/SortableRoot.js +5 -3
  175. package/dist/components/sortable/SortableRoot.js.map +1 -1
  176. package/dist/components/stepper/Stepper.context.js +38 -30
  177. package/dist/components/stepper/Stepper.context.js.map +1 -1
  178. package/dist/components/toast/Toast.context.js +1 -1
  179. package/dist/components/toast/Toast.context.js.map +1 -1
  180. package/dist/components/toast/ToastProvider.js +3 -3
  181. package/dist/components/toast/ToastProvider.js.map +1 -1
  182. package/dist/components/top-bar/TopBar.js +4 -4
  183. package/dist/components/top-bar/TopBar.js.map +1 -1
  184. package/dist/components/tree/TreeCollapsible.d.ts +2 -2
  185. package/dist/components/tree/TreeCollapsible.js +3 -3
  186. package/dist/components/tree/TreeCollapsible.js.map +1 -1
  187. package/dist/components/tree/TreeCollapsibleContent.js +1 -1
  188. package/dist/components/tree/TreeCollapsibleContent.js.map +1 -1
  189. package/dist/components/tree/TreeCollapsibleTrigger.js +1 -1
  190. package/dist/components/tree/TreeCollapsibleTrigger.js.map +1 -1
  191. package/dist/docgen.json +1 -1
  192. package/dist/index.cjs.js +553 -595
  193. package/dist/index.cjs.js.map +1 -1
  194. package/dist/index.js +1 -4
  195. package/dist/styled.js +5 -1
  196. package/dist/styled.js.map +1 -1
  197. package/dist/utilities/hooks/useCallbackRef.d.ts +3 -3
  198. package/dist/utilities/hooks/useCallbackRef.js +4 -1
  199. package/dist/utilities/hooks/useCallbackRef.js.map +1 -1
  200. package/dist/utilities/hooks/useResizeObserver.js +13 -3
  201. package/dist/utilities/hooks/useResizeObserver.js.map +1 -1
  202. package/dist/utilities/hooks/useScrollPosition.js +22 -17
  203. package/dist/utilities/hooks/useScrollPosition.js.map +1 -1
  204. package/dist/utilities/hooks/useWindowScrollPosition.js +19 -15
  205. package/dist/utilities/hooks/useWindowScrollPosition.js.map +1 -1
  206. package/dist/utilities/uri/index.js +1 -6
  207. package/dist/utilities/uri/index.js.map +1 -1
  208. package/package.json +31 -31
  209. package/src/index.css +2 -0
  210. package/src/responsive-variant-classes.css +1 -1
  211. package/src/utilities.css +6 -0
  212. package/dist/components/box/Box.d.ts +0 -1
  213. package/dist/components/box/Box.js +0 -8
  214. package/dist/components/box/Box.js.map +0 -1
  215. package/dist/components/flex/Flex.d.ts +0 -7
  216. package/dist/components/flex/Flex.js +0 -88
  217. package/dist/components/flex/Flex.js.map +0 -1
  218. package/dist/components/grid/Grid.d.ts +0 -13
  219. package/dist/components/grid/Grid.js +0 -35
  220. package/dist/components/grid/Grid.js.map +0 -1
@@ -10,12 +10,17 @@ var usePagination = (initialPaginationState) => {
10
10
  ...defaultPaginationState,
11
11
  ...initialPaginationState || {}
12
12
  });
13
+ const applyPagination = React$1.useCallback(() => {
14
+ setIsPaginated(true);
15
+ }, []);
16
+ const wasInitiallyPaginated = React$1.useRef(!!initialPaginationState);
13
17
  return {
14
18
  isPaginated,
15
19
  paginationState,
16
20
  setPaginationState,
17
- applyPagination: React$1.useCallback(() => {
18
- setIsPaginated(true);
21
+ applyPagination,
22
+ removePagination: React$1.useCallback(() => {
23
+ setIsPaginated(wasInitiallyPaginated.current);
19
24
  }, [])
20
25
  };
21
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"usePagination.js","names":[],"sources":["../../../src/components/data-table/usePagination.ts"],"sourcesContent":["import type { PaginationState } from '@tanstack/react-table'\nimport * as React from 'react'\n\nconst defaultPaginationState: PaginationState = { pageIndex: 0, pageSize: 10 }\nexport const usePagination = (\n // Initial pagination may be partial (e.g. just `pageSize`); defaults below\n // fill the rest, so the working `paginationState` stays a full PaginationState.\n initialPaginationState: Partial<PaginationState> | undefined\n) => {\n const [isPaginated, setIsPaginated] = React.useState<boolean>(\n !!initialPaginationState\n )\n\n const [paginationState, setPaginationState] = React.useState<\n PaginationState | undefined\n >({\n ...defaultPaginationState,\n ...(initialPaginationState || {})\n })\n\n const applyPagination = React.useCallback(() => {\n setIsPaginated(true)\n }, [])\n\n return {\n isPaginated,\n paginationState,\n setPaginationState,\n applyPagination\n }\n}\n"],"mappings":";;AAGA,IAAM,yBAA0C;CAAE,WAAW;CAAG,UAAU;AAAG;AAC7E,IAAa,iBAGX,2BACG;CACH,MAAM,CAAC,aAAa,kBAAkB,QAAM,SAC1C,CAAC,CAAC,sBACJ;CAEA,MAAM,CAAC,iBAAiB,sBAAsB,QAAM,SAElD;EACA,GAAG;EACH,GAAI,0BAA0B,CAAC;CACjC,CAAC;CAMD,OAAO;EACL;EACA;EACA;EACA,iBARsB,QAAM,kBAAkB;GAC9C,eAAe,IAAI;EACrB,GAAG,CAAC,CAMF;CACF;AACF"}
1
+ {"version":3,"file":"usePagination.js","names":[],"sources":["../../../src/components/data-table/usePagination.ts"],"sourcesContent":["import type { PaginationState } from '@tanstack/react-table'\nimport * as React from 'react'\n\nconst defaultPaginationState: PaginationState = { pageIndex: 0, pageSize: 10 }\nexport const usePagination = (\n // Initial pagination may be partial (e.g. just `pageSize`); defaults below\n // fill the rest, so the working `paginationState` stays a full PaginationState.\n initialPaginationState: Partial<PaginationState> | undefined\n) => {\n const [isPaginated, setIsPaginated] = React.useState<boolean>(\n !!initialPaginationState\n )\n\n const [paginationState, setPaginationState] = React.useState<\n PaginationState | undefined\n >({\n ...defaultPaginationState,\n ...(initialPaginationState || {})\n })\n\n const applyPagination = React.useCallback(() => {\n setIsPaginated(true)\n }, [])\n\n // Lets <Pagination> undo applyPagination when it unmounts, restoring\n // whatever the provider was configured with initially.\n const wasInitiallyPaginated = React.useRef(!!initialPaginationState)\n const removePagination = React.useCallback(() => {\n setIsPaginated(wasInitiallyPaginated.current)\n }, [])\n\n return {\n isPaginated,\n paginationState,\n setPaginationState,\n applyPagination,\n removePagination\n }\n}\n"],"mappings":";;AAGA,IAAM,yBAA0C;CAAE,WAAW;CAAG,UAAU;AAAG;AAC7E,IAAa,iBAGX,2BACG;CACH,MAAM,CAAC,aAAa,kBAAkB,QAAM,SAC1C,CAAC,CAAC,sBACJ;CAEA,MAAM,CAAC,iBAAiB,sBAAsB,QAAM,SAElD;EACA,GAAG;EACH,GAAI,0BAA0B,CAAC;CACjC,CAAC;CAED,MAAM,kBAAkB,QAAM,kBAAkB;EAC9C,eAAe,IAAI;CACrB,GAAG,CAAC,CAAC;CAIL,MAAM,wBAAwB,QAAM,OAAO,CAAC,CAAC,sBAAsB;CAKnE,OAAO;EACL;EACA;EACA;EACA;EACA,kBATuB,QAAM,kBAAkB;GAC/C,eAAe,sBAAsB,OAAO;EAC9C,GAAG,CAAC,CAOF;CACF;AACF"}
@@ -8,6 +8,7 @@ import { DEFAULT_LABELS } from "../calendar/constants.js";
8
8
  import { Calendar } from "../calendar/Calendar.js";
9
9
  import { DEFAULT_DATE_FORMAT } from "./constants.js";
10
10
  import * as React$1 from "react";
11
+ import { useComposedRefs } from "@radix-ui/react-compose-refs";
11
12
  import { jsx, jsxs } from "react/jsx-runtime";
12
13
  import { CalendarEvent } from "@atom-learning/icons";
13
14
  import dayjs from "dayjs";
@@ -18,7 +19,7 @@ var formatDateToString = (date, dateFormat = DEFAULT_DATE_FORMAT) => date ? dayj
18
19
  var DateInput = ({ ref, initialDate, dateFormat = DEFAULT_DATE_FORMAT, firstDayOfWeek = 1, disabled, monthNames, weekdayNames, size = "md", appearance, theme, labels, revalidate, onChange, minDate, maxDate, ...rest }) => {
19
20
  const [date, setDate] = React$1.useState(initialDate ? dayjs(initialDate).toDate() : void 0);
20
21
  const [inputElRef, setInputElRef] = useCallbackRefState();
21
- React$1.useImperativeHandle(ref, () => inputElRef);
22
+ const composedInputRef = useComposedRefs(ref, setInputElRef);
22
23
  const dateString = formatDateToString(date, dateFormat);
23
24
  const handleInputChange = React$1.useCallback((event) => {
24
25
  const newDateString = event.target.value;
@@ -44,7 +45,7 @@ var DateInput = ({ ref, initialDate, dateFormat = DEFAULT_DATE_FORMAT, firstDayO
44
45
  const [calendarOpen, setCalendarOpen] = React$1.useState(false);
45
46
  const refDateToday = React$1.useRef(null);
46
47
  const refDateSelected = React$1.useRef(null);
47
- const iconSize = React$1.useMemo(() => getFieldIconSize(size), [size]);
48
+ const iconSize = getFieldIconSize(size);
48
49
  return /* @__PURE__ */ jsxs("div", {
49
50
  className: "relative h-max",
50
51
  children: [/* @__PURE__ */ jsx(Input, {
@@ -55,7 +56,7 @@ var DateInput = ({ ref, initialDate, dateFormat = DEFAULT_DATE_FORMAT, firstDayO
55
56
  theme,
56
57
  ...rest,
57
58
  onChange: handleInputChange,
58
- ref: setInputElRef,
59
+ ref: composedInputRef,
59
60
  defaultValue: dateString
60
61
  }), /* @__PURE__ */ jsxs(Popover, {
61
62
  modal: true,
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.js","names":[],"sources":["../../../src/components/date-input/DateInput.tsx"],"sourcesContent":["import { CalendarEvent } from '@atom-learning/icons'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js'\nimport type { Props as DayzedInterface } from 'dayzed'\nimport * as React from 'react'\n\nimport { useCallbackRefState } from '../../utilities/hooks/useCallbackRef'\nimport { getFieldIconSize } from '../../utilities/style/get-icon-size'\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Calendar, type 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'\n\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 appearance?: 'standard' | 'modern'\n theme?: 'white' | 'grey'\n revalidate?: () => Promise<boolean>\n onChange?: (value?: Date) => void\n ref?: React.Ref<HTMLInputElement>\n }\n\nconst formatDateToString = (date?: Date, dateFormat = DEFAULT_DATE_FORMAT) =>\n date ? dayjs(date).format(dateFormat) : ''\n\nexport const DateInput = ({\n ref,\n initialDate,\n dateFormat = DEFAULT_DATE_FORMAT,\n firstDayOfWeek = 1,\n disabled,\n monthNames,\n weekdayNames,\n size = 'md',\n appearance,\n theme,\n labels,\n revalidate,\n onChange,\n minDate,\n maxDate,\n ...rest\n}: DateInputProps) => {\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 <div className=\"relative h-max\">\n <Input\n name=\"date\"\n disabled={disabled}\n size={size}\n appearance={appearance}\n theme={theme}\n {...(rest as React.ComponentProps<typeof Input>)}\n onChange={handleInputChange}\n ref={setInputElRef}\n defaultValue={dateString}\n />\n <Popover modal open={calendarOpen} onOpenChange={setCalendarOpen}>\n <Popover.Trigger asChild>\n <ActionIcon\n disabled={disabled}\n label={updatedLabels.open}\n size={iconSize}\n theme=\"neutral\"\n hasTooltip={false}\n className=\"absolute top-1/2 right-0 -translate-y-1/2\"\n >\n <Icon is={CalendarEvent} />\n </ActionIcon>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\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 className=\"z-1147483646 pr-6\"\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 </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,OAAO,iBAAiB;AAe9B,IAAM,sBAAsB,MAAa,aAAa,wBACpD,OAAO,MAAM,IAAI,CAAC,CAAC,OAAO,UAAU,IAAI;AAE1C,IAAa,aAAa,EACxB,KACA,aACA,aAAa,qBACb,iBAAiB,GACjB,UACA,YACA,cACA,OAAO,MACP,YACA,OACA,QACA,YACA,UACA,SACA,SACA,GAAG,WACiB;CACpB,MAAM,CAAC,MAAM,WAAW,QAAM,SAC5B,cAAc,MAAM,WAAW,CAAC,CAAC,OAAO,IAAI,KAAA,CAC9C;CAEA,MAAM,CAAC,YAAY,iBAAiB,oBAAoB;CACxD,QAAM,oBAAoB,WAAW,UAA8B;CAEnE,MAAM,aAAa,mBAAmB,MAAM,UAAU;CAEtD,MAAM,oBAAoB,QAAM,aAC7B,UAAU;EACT,MAAM,gBAAgB,MAAM,OAAO;EACnC,MAAM,kBAAkB,MAAM,eAAe,UAAU;EACvD,MAAM,UAAU,gBAAgB,QAAQ,IACpC,gBAAgB,OAAO,IACvB,KAAA;EACJ,QAAQ,OAAO;EACf,WAAW,OAAO;CACpB,GACA,CAAC,YAAY,QAAQ,CACvB;CAEA,MAAM,uBAAuB,QAAM,aAChC,YAAY;EACX,QAAQ,OAAO;EAEf,MAAM,mCAAmC;GACvC,IAAI,CAAC,YAAY;GAQjB,CAJ+B,OAAO,yBACpC,OAAO,iBAAiB,WACxB,OACF,CAAC,EAAE,IAAA,EACqB,KACtB,YACA,mBAAmB,SAAS,UAAU,CACxC;GACA,MAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC;GAClD,WAAW,cAAc,KAAK;EAChC;EACA,2BAA2B;CAC7B,GACA,CAAC,YAAY,UAAU,CACzB;CAEA,MAAM,gBAAgB;EACpB,GAAG;EACH,GAAG;CACL;CAEA,MAAM,CAAC,cAAc,mBAAmB,QAAM,SAAS,KAAK;CAE5D,MAAM,eAAe,QAAM,OAA0B,IAAI;CACzD,MAAM,kBAAkB,QAAM,OAA0B,IAAI;CAE5D,MAAM,WAAW,QAAM,cAAc,iBAAiB,IAAI,GAAG,CAAC,IAAI,CAAC;CAEnE,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,OAAD;GACE,MAAK;GACK;GACJ;GACM;GACL;GACP,GAAK;GACL,UAAU;GACV,KAAK;GACL,cAAc;EACf,CAAA,GACD,qBAAC,SAAD;GAAS,OAAA;GAAM,MAAM;GAAc,cAAc;aAAjD,CACE,oBAAC,QAAQ,SAAT;IAAiB,SAAA;cACf,oBAAC,YAAD;KACY;KACV,OAAO,cAAc;KACrB,MAAM;KACN,OAAM;KACN,YAAY;KACZ,WAAU;eAEV,oBAAC,MAAD,EAAM,IAAI,cAAgB,CAAA;IAChB,CAAA;GACG,CAAA,GACjB,oBAAC,QAAQ,QAAT,EAAA,UACE,oBAAC,QAAQ,SAAT;IACE,MAAK;IACL,OAAM;IACN,iBAAiB;IACjB,kBAAkB,MAAM;KACtB,EAAE,eAAe;KACjB,IAAI,MACF,gBAAgB,SAAS,MAAM;UAE/B,aAAa,SAAS,MAAM;IAEhC;IACA,WAAU;cAEV,oBAAC,UAAD;KACE,MAAM,wBAAQ,IAAI,KAAK;KACvB,UAAU;KACV,gBAAgB,OAAO,SAAS;MAC9B,gBAAgB,KAAK;MACrB,MAAM,qBAAqB,KAAK,IAAI;MACpC,IAAI,YAAY,WAAW;KAC7B;KACA,SAAS,OAAO,SAAS;MACvB,MAAM,qBAAqB,IAAI;MAC/B,IAAI,YAAY,WAAW;KAC7B;KACS;KACA;KACK;KACG;KACD;KACJ;KACE;KACd,QAAQ;IACT,CAAA;GACc,CAAA,EACH,CAAA,CACT;IACN;;AAET"}
1
+ {"version":3,"file":"DateInput.js","names":[],"sources":["../../../src/components/date-input/DateInput.tsx"],"sourcesContent":["import { CalendarEvent } from '@atom-learning/icons'\nimport { useComposedRefs } from '@radix-ui/react-compose-refs'\nimport dayjs from 'dayjs'\nimport customParseFormat from 'dayjs/plugin/customParseFormat.js'\nimport type { Props as DayzedInterface } from 'dayzed'\nimport * as React from 'react'\n\nimport { useCallbackRefState } from '../../utilities/hooks/useCallbackRef'\nimport { getFieldIconSize } from '../../utilities/style/get-icon-size'\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Calendar, type 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'\n\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 appearance?: 'standard' | 'modern'\n theme?: 'white' | 'grey'\n revalidate?: () => Promise<boolean>\n onChange?: (value?: Date) => void\n ref?: React.Ref<HTMLInputElement>\n }\n\nconst formatDateToString = (date?: Date, dateFormat = DEFAULT_DATE_FORMAT) =>\n date ? dayjs(date).format(dateFormat) : ''\n\nexport const DateInput = ({\n ref,\n initialDate,\n dateFormat = DEFAULT_DATE_FORMAT,\n firstDayOfWeek = 1,\n disabled,\n monthNames,\n weekdayNames,\n size = 'md',\n appearance,\n theme,\n labels,\n revalidate,\n onChange,\n minDate,\n maxDate,\n ...rest\n}: DateInputProps) => {\n const [date, setDate] = React.useState(\n initialDate ? dayjs(initialDate).toDate() : undefined\n )\n\n const [inputElRef, setInputElRef] = useCallbackRefState()\n const composedInputRef = useComposedRefs(\n ref as React.Ref<HTMLElement>,\n setInputElRef\n )\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 = getFieldIconSize(size)\n\n return (\n <div className=\"relative h-max\">\n <Input\n name=\"date\"\n disabled={disabled}\n size={size}\n appearance={appearance}\n theme={theme}\n {...(rest as React.ComponentProps<typeof Input>)}\n onChange={handleInputChange}\n ref={composedInputRef}\n defaultValue={dateString}\n />\n <Popover modal open={calendarOpen} onOpenChange={setCalendarOpen}>\n <Popover.Trigger asChild>\n <ActionIcon\n disabled={disabled}\n label={updatedLabels.open}\n size={iconSize}\n theme=\"neutral\"\n hasTooltip={false}\n className=\"absolute top-1/2 right-0 -translate-y-1/2\"\n >\n <Icon is={CalendarEvent} />\n </ActionIcon>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\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 className=\"z-1147483646 pr-6\"\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 </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,OAAO,iBAAiB;AAe9B,IAAM,sBAAsB,MAAa,aAAa,wBACpD,OAAO,MAAM,IAAI,CAAC,CAAC,OAAO,UAAU,IAAI;AAE1C,IAAa,aAAa,EACxB,KACA,aACA,aAAa,qBACb,iBAAiB,GACjB,UACA,YACA,cACA,OAAO,MACP,YACA,OACA,QACA,YACA,UACA,SACA,SACA,GAAG,WACiB;CACpB,MAAM,CAAC,MAAM,WAAW,QAAM,SAC5B,cAAc,MAAM,WAAW,CAAC,CAAC,OAAO,IAAI,KAAA,CAC9C;CAEA,MAAM,CAAC,YAAY,iBAAiB,oBAAoB;CACxD,MAAM,mBAAmB,gBACvB,KACA,aACF;CAEA,MAAM,aAAa,mBAAmB,MAAM,UAAU;CAEtD,MAAM,oBAAoB,QAAM,aAC7B,UAAU;EACT,MAAM,gBAAgB,MAAM,OAAO;EACnC,MAAM,kBAAkB,MAAM,eAAe,UAAU;EACvD,MAAM,UAAU,gBAAgB,QAAQ,IACpC,gBAAgB,OAAO,IACvB,KAAA;EACJ,QAAQ,OAAO;EACf,WAAW,OAAO;CACpB,GACA,CAAC,YAAY,QAAQ,CACvB;CAEA,MAAM,uBAAuB,QAAM,aAChC,YAAY;EACX,QAAQ,OAAO;EAEf,MAAM,mCAAmC;GACvC,IAAI,CAAC,YAAY;GAQjB,CAJ+B,OAAO,yBACpC,OAAO,iBAAiB,WACxB,OACF,CAAC,EAAE,IAAA,EACqB,KACtB,YACA,mBAAmB,SAAS,UAAU,CACxC;GACA,MAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC;GAClD,WAAW,cAAc,KAAK;EAChC;EACA,2BAA2B;CAC7B,GACA,CAAC,YAAY,UAAU,CACzB;CAEA,MAAM,gBAAgB;EACpB,GAAG;EACH,GAAG;CACL;CAEA,MAAM,CAAC,cAAc,mBAAmB,QAAM,SAAS,KAAK;CAE5D,MAAM,eAAe,QAAM,OAA0B,IAAI;CACzD,MAAM,kBAAkB,QAAM,OAA0B,IAAI;CAE5D,MAAM,WAAW,iBAAiB,IAAI;CAEtC,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,OAAD;GACE,MAAK;GACK;GACJ;GACM;GACL;GACP,GAAK;GACL,UAAU;GACV,KAAK;GACL,cAAc;EACf,CAAA,GACD,qBAAC,SAAD;GAAS,OAAA;GAAM,MAAM;GAAc,cAAc;aAAjD,CACE,oBAAC,QAAQ,SAAT;IAAiB,SAAA;cACf,oBAAC,YAAD;KACY;KACV,OAAO,cAAc;KACrB,MAAM;KACN,OAAM;KACN,YAAY;KACZ,WAAU;eAEV,oBAAC,MAAD,EAAM,IAAI,cAAgB,CAAA;IAChB,CAAA;GACG,CAAA,GACjB,oBAAC,QAAQ,QAAT,EAAA,UACE,oBAAC,QAAQ,SAAT;IACE,MAAK;IACL,OAAM;IACN,iBAAiB;IACjB,kBAAkB,MAAM;KACtB,EAAE,eAAe;KACjB,IAAI,MACF,gBAAgB,SAAS,MAAM;UAE/B,aAAa,SAAS,MAAM;IAEhC;IACA,WAAU;cAEV,oBAAC,UAAD;KACE,MAAM,wBAAQ,IAAI,KAAK;KACvB,UAAU;KACV,gBAAgB,OAAO,SAAS;MAC9B,gBAAgB,KAAK;MACrB,MAAM,qBAAqB,KAAK,IAAI;MACpC,IAAI,YAAY,WAAW;KAC7B;KACA,SAAS,OAAO,SAAS;MACvB,MAAM,qBAAqB,IAAI;MAC/B,IAAI,YAAY,WAAW;KAC7B;KACS;KACA;KACK;KACG;KACD;KACJ;KACE;KACd,QAAQ;IACT,CAAA;GACc,CAAA,EACH,CAAA,CACT;IACN;;AAET"}
@@ -39,7 +39,9 @@ var StyledDialogContent = styled(Content, {
39
39
  "max-h-[90vh]",
40
40
  "supports-svh:h-auto",
41
41
  "supports-svh:max-h-[90vh]",
42
- "w-95"
42
+ "w-95",
43
+ "[&>[data-dialog-close]]:top-4",
44
+ "[&>[data-dialog-close]]:right-4"
43
45
  ],
44
46
  sm: [
45
47
  "rounded-md",
@@ -48,7 +50,9 @@ var StyledDialogContent = styled(Content, {
48
50
  "max-h-[90vh]",
49
51
  "supports-svh:h-auto",
50
52
  "supports-svh:max-h-[90vh]",
51
- "w-120"
53
+ "w-120",
54
+ "[&>[data-dialog-close]]:top-4",
55
+ "[&>[data-dialog-close]]:right-4"
52
56
  ],
53
57
  md: [
54
58
  "rounded-md",
@@ -57,7 +61,9 @@ var StyledDialogContent = styled(Content, {
57
61
  "max-h-[90vh]",
58
62
  "supports-svh:h-auto",
59
63
  "supports-svh:max-h-[90vh]",
60
- "w-150"
64
+ "w-150",
65
+ "[&>[data-dialog-close]]:top-4",
66
+ "[&>[data-dialog-close]]:right-4"
61
67
  ],
62
68
  lg: [
63
69
  "rounded-md",
@@ -66,7 +72,9 @@ var StyledDialogContent = styled(Content, {
66
72
  "max-h-[90vh]",
67
73
  "supports-svh:h-auto",
68
74
  "supports-svh:max-h-[90vh]",
69
- "w-200"
75
+ "w-200",
76
+ "[&>[data-dialog-close]]:top-4",
77
+ "[&>[data-dialog-close]]:right-4"
70
78
  ],
71
79
  xl: [
72
80
  "rounded-md",
@@ -75,7 +83,9 @@ var StyledDialogContent = styled(Content, {
75
83
  "max-h-[90vh]",
76
84
  "supports-svh:h-auto",
77
85
  "supports-svh:max-h-[90vh]",
78
- "w-275"
86
+ "w-275",
87
+ "[&>[data-dialog-close]]:top-4",
88
+ "[&>[data-dialog-close]]:right-4"
79
89
  ],
80
90
  fullscreen: [
81
91
  "rounded-none",
@@ -84,7 +94,9 @@ var StyledDialogContent = styled(Content, {
84
94
  "max-w-screen",
85
95
  "max-h-screen",
86
96
  "supports-svh:h-svh",
87
- "supports-svh:max-h-svh"
97
+ "supports-svh:max-h-svh",
98
+ "[&>[data-dialog-close]]:top-safe-offset-4",
99
+ "[&>[data-dialog-close]]:right-safe-offset-4"
88
100
  ]
89
101
  },
90
102
  layout: { panel: [
@@ -109,6 +121,7 @@ var DialogContent = ({ size = "sm", children, closeDialogText = "Close dialog",
109
121
  hasTooltip: false,
110
122
  size: "md",
111
123
  theme: "neutral",
124
+ "data-dialog-close": true,
112
125
  className: "absolute top-4 right-4 size-12",
113
126
  children: /* @__PURE__ */ jsx(Icon, { is: Close })
114
127
  }), React$1.Children.map(children, (child) => React$1.isValidElement(child) && child.type === DialogBackground ? null : child)]
@@ -1 +1 @@
1
- {"version":3,"file":"DialogContent.js","names":[],"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 { styled } from '../../styled'\nimport { backdropOverlay } from '../../utilities/style/backdrop-overlay'\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Icon } from '../icon/Icon'\nimport { DialogBackground } from './DialogBackground'\n\nconst modalOverlayId = 'modal_overlay'\n\nconst StyledDialogOverlay = styled(Overlay, {\n base: backdropOverlay\n})\n\nconst StyledDialogContent = styled(\n Content,\n {\n base: [\n // `transform: translate()` is required for `floating-ui` to\n // correctly position elements within the Dialog component.\n // we can't use the translate property directly\n 'transform-[translate(-50%,-50%)]',\n 'bg-white',\n 'shadow-xl',\n 'box-border',\n 'left-1/2',\n 'h-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'overflow-y-auto',\n 'rounded-md',\n 'p-8',\n 'fixed',\n 'top-1/2',\n 'z-1147483646',\n 'focus:outline-none',\n 'motion-safe:data-[state=open]:animate-slide-in-center',\n 'motion-safe:data-[state=closed]:animate-slide-out-center'\n ],\n variants: {\n size: {\n xs: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-95'\n ],\n sm: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-120'\n ],\n md: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-150'\n ],\n lg: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-200'\n ],\n xl: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-275'\n ],\n fullscreen: [\n 'rounded-none',\n 'w-screen',\n 'h-screen',\n 'max-w-screen',\n 'max-h-screen',\n 'supports-svh:h-svh',\n 'supports-svh:max-h-svh'\n ]\n },\n layout: {\n panel: ['flex', 'flex-col', 'p-0']\n }\n }\n },\n { enableResponsiveVariants: true }\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 ...rest\n}: DialogContentProps) => (\n <Portal>\n <StyledDialogOverlay id={modalOverlayId}>\n {React.Children.map(children, (child) =>\n React.isValidElement(child) && child.type === DialogBackground\n ? child\n : null\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 {...rest}\n >\n {showCloseButton && (\n <ActionIcon\n as={Close}\n label={closeDialogText}\n hasTooltip={false}\n size=\"md\"\n theme=\"neutral\"\n className=\"absolute top-4 right-4 size-12\"\n >\n <Icon is={CloseIcon} />\n </ActionIcon>\n )}\n {React.Children.map(children, (child) =>\n React.isValidElement(child) && child.type === DialogBackground\n ? null\n : child\n )}\n </StyledDialogContent>\n </StyledDialogOverlay>\n </Portal>\n)\n"],"mappings":";;;;;;;;;;AAUA,IAAM,iBAAiB;AAEvB,IAAM,sBAAsB,OAAO,SAAS,EAC1C,MAAM,gBACR,CAAC;AAED,IAAM,sBAAsB,OAC1B,SACA;CACE,MAAM;EAIJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU;EACR,MAAM;GACJ,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,YAAY;IACV;IACA;IACA;IACA;IACA;IACA;IACA;GACF;EACF;EACA,QAAQ,EACN,OAAO;GAAC;GAAQ;GAAY;EAAK,EACnC;CACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAOA,IAAa,iBAAiB,EAC5B,OAAO,MACP,UACA,kBAAkB,gBAClB,kBAAkB,MAClB,GAAG,WAEH,oBAAC,QAAD,EAAA,UACE,qBAAC,qBAAD;CAAqB,IAAI;WAAzB,CACG,QAAM,SAAS,IAAI,WAAW,UAC7B,QAAM,eAAe,KAAK,KAAK,MAAM,SAAS,mBAC1C,QACA,IACN,GACA,qBAAC,qBAAD;EACQ;EACN,cAAW;EACX,uBAAuB,UAAU;GAE/B,IADgB,MAAM,QACT,OAAO,gBAClB,MAAM,eAAe;EAEzB;EACA,GAAI;YATN,CAWG,mBACC,oBAAC,YAAD;GACE,IAAI;GACJ,OAAO;GACP,YAAY;GACZ,MAAK;GACL,OAAM;GACN,WAAU;aAEV,oBAAC,MAAD,EAAM,IAAI,MAAY,CAAA;EACZ,CAAA,GAEb,QAAM,SAAS,IAAI,WAAW,UAC7B,QAAM,eAAe,KAAK,KAAK,MAAM,SAAS,mBAC1C,OACA,KACN,CACmB;GACF;GACf,CAAA"}
1
+ {"version":3,"file":"DialogContent.js","names":[],"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 { styled } from '../../styled'\nimport { backdropOverlay } from '../../utilities/style/backdrop-overlay'\nimport { ActionIcon } from '../action-icon/ActionIcon'\nimport { Icon } from '../icon/Icon'\nimport { DialogBackground } from './DialogBackground'\n\nconst modalOverlayId = 'modal_overlay'\n\nconst StyledDialogOverlay = styled(Overlay, {\n base: backdropOverlay\n})\n\nconst StyledDialogContent = styled(\n Content,\n {\n base: [\n // `transform: translate()` is required for `floating-ui` to\n // correctly position elements within the Dialog component.\n // we can't use the translate property directly\n 'transform-[translate(-50%,-50%)]',\n 'bg-white',\n 'shadow-xl',\n 'box-border',\n 'left-1/2',\n 'h-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'overflow-y-auto',\n 'rounded-md',\n 'p-8',\n 'fixed',\n 'top-1/2',\n 'z-1147483646',\n 'focus:outline-none',\n 'motion-safe:data-[state=open]:animate-slide-in-center',\n 'motion-safe:data-[state=closed]:animate-slide-out-center'\n ],\n variants: {\n size: {\n xs: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-95',\n '[&>[data-dialog-close]]:top-4',\n '[&>[data-dialog-close]]:right-4'\n ],\n sm: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-120',\n '[&>[data-dialog-close]]:top-4',\n '[&>[data-dialog-close]]:right-4'\n ],\n md: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-150',\n '[&>[data-dialog-close]]:top-4',\n '[&>[data-dialog-close]]:right-4'\n ],\n lg: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-200',\n '[&>[data-dialog-close]]:top-4',\n '[&>[data-dialog-close]]:right-4'\n ],\n xl: [\n 'rounded-md',\n 'size-auto',\n 'max-w-[90vw]',\n 'max-h-[90vh]',\n 'supports-svh:h-auto',\n 'supports-svh:max-h-[90vh]',\n 'w-275',\n '[&>[data-dialog-close]]:top-4',\n '[&>[data-dialog-close]]:right-4'\n ],\n fullscreen: [\n 'rounded-none',\n 'w-screen',\n 'h-screen',\n 'max-w-screen',\n 'max-h-screen',\n 'supports-svh:h-svh',\n 'supports-svh:max-h-svh',\n '[&>[data-dialog-close]]:top-safe-offset-4',\n '[&>[data-dialog-close]]:right-safe-offset-4'\n ]\n },\n layout: {\n panel: ['flex', 'flex-col', 'p-0']\n }\n }\n },\n { enableResponsiveVariants: true }\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 ...rest\n}: DialogContentProps) => (\n <Portal>\n <StyledDialogOverlay id={modalOverlayId}>\n {React.Children.map(children, (child) =>\n React.isValidElement(child) && child.type === DialogBackground\n ? child\n : null\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 {...rest}\n >\n {showCloseButton && (\n <ActionIcon\n as={Close}\n label={closeDialogText}\n hasTooltip={false}\n size=\"md\"\n theme=\"neutral\"\n data-dialog-close\n className=\"absolute top-4 right-4 size-12\"\n >\n <Icon is={CloseIcon} />\n </ActionIcon>\n )}\n {React.Children.map(children, (child) =>\n React.isValidElement(child) && child.type === DialogBackground\n ? null\n : child\n )}\n </StyledDialogContent>\n </StyledDialogOverlay>\n </Portal>\n)\n"],"mappings":";;;;;;;;;;AAUA,IAAM,iBAAiB;AAEvB,IAAM,sBAAsB,OAAO,SAAS,EAC1C,MAAM,gBACR,CAAC;AAED,IAAM,sBAAsB,OAC1B,SACA;CACE,MAAM;EAIJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU;EACR,MAAM;GACJ,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,IAAI;IACF;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,YAAY;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;EACF;EACA,QAAQ,EACN,OAAO;GAAC;GAAQ;GAAY;EAAK,EACnC;CACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAOA,IAAa,iBAAiB,EAC5B,OAAO,MACP,UACA,kBAAkB,gBAClB,kBAAkB,MAClB,GAAG,WAEH,oBAAC,QAAD,EAAA,UACE,qBAAC,qBAAD;CAAqB,IAAI;WAAzB,CACG,QAAM,SAAS,IAAI,WAAW,UAC7B,QAAM,eAAe,KAAK,KAAK,MAAM,SAAS,mBAC1C,QACA,IACN,GACA,qBAAC,qBAAD;EACQ;EACN,cAAW;EACX,uBAAuB,UAAU;GAE/B,IADgB,MAAM,QACT,OAAO,gBAClB,MAAM,eAAe;EAEzB;EACA,GAAI;YATN,CAWG,mBACC,oBAAC,YAAD;GACE,IAAI;GACJ,OAAO;GACP,YAAY;GACZ,MAAK;GACL,OAAM;GACN,qBAAA;GACA,WAAU;aAEV,oBAAC,MAAD,EAAM,IAAI,MAAY,CAAA;EACZ,CAAA,GAEb,QAAM,SAAS,IAAI,WAAW,UAC7B,QAAM,eAAe,KAAK,KAAK,MAAM,SAAS,mBAC1C,OACA,KACN,CACmB;GACF;GACf,CAAA"}
@@ -9,27 +9,26 @@ var DismissibleRootContext = React$1.createContext({
9
9
  });
10
10
  var DismissibleRootProvider = ({ dismissed: controlledIsDismissed, children, disabled, onDismiss = () => null }) => {
11
11
  const [isDismissed, setIsDismissed] = React$1.useState(false);
12
- const value = React$1.useMemo(() => {
13
- const isControlled = typeof controlledIsDismissed === "boolean";
14
- return {
12
+ return /* @__PURE__ */ jsx(DismissibleRootContext, {
13
+ value: React$1.useMemo(() => {
14
+ const isControlled = typeof controlledIsDismissed === "boolean";
15
+ return {
16
+ disabled,
17
+ isDismissed: isControlled ? controlledIsDismissed : isDismissed,
18
+ setIsDismissed: isControlled ? () => null : setIsDismissed,
19
+ onDismiss
20
+ };
21
+ }, [
15
22
  disabled,
16
- isDismissed: isControlled ? controlledIsDismissed : isDismissed,
17
- setIsDismissed: isControlled ? () => null : setIsDismissed,
18
- onDismiss
19
- };
20
- }, [
21
- disabled,
22
- isDismissed,
23
- onDismiss,
24
- controlledIsDismissed
25
- ]);
26
- return /* @__PURE__ */ jsx(DismissibleRootContext.Provider, {
27
- value,
23
+ isDismissed,
24
+ onDismiss,
25
+ controlledIsDismissed
26
+ ]),
28
27
  children
29
28
  });
30
29
  };
31
30
  var DismissibleRootInternal = ({ asChild = false, ...rest }) => {
32
- const { isDismissed, disabled } = React$1.useContext(DismissibleRootContext);
31
+ const { isDismissed, disabled } = React$1.use(DismissibleRootContext);
33
32
  if (isDismissed) return null;
34
33
  const props = {
35
34
  ...disabled && { [`data-disabled`]: "" },
@@ -1 +1 @@
1
- {"version":3,"file":"DismissibleRoot.js","names":[],"sources":["../../../src/components/dismissible/DismissibleRoot.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\n\nexport interface DismissibleRootContextValue {\n disabled?: boolean\n isDismissed: boolean\n setIsDismissed: (boolean) => void\n onDismiss: () => void\n}\n\nexport const DismissibleRootContext =\n React.createContext<DismissibleRootContextValue>({\n isDismissed: false,\n setIsDismissed: () => undefined,\n onDismiss: () => undefined\n })\n\nexport interface DismissibleRootProps {\n disabled?: boolean\n dismissed?: boolean\n onDismiss?: () => void\n}\n\nexport const DismissibleRootProvider = ({\n dismissed: controlledIsDismissed,\n children,\n disabled,\n onDismiss = () => null\n}: React.PropsWithChildren<DismissibleRootProps>) => {\n const [isDismissed, setIsDismissed] = React.useState(false)\n\n const value = React.useMemo<DismissibleRootContextValue>(() => {\n const isControlled = typeof controlledIsDismissed === 'boolean'\n return {\n disabled,\n isDismissed: isControlled\n ? (controlledIsDismissed as boolean)\n : isDismissed,\n setIsDismissed: isControlled ? () => null : setIsDismissed,\n onDismiss\n }\n }, [disabled, isDismissed, onDismiss, controlledIsDismissed])\n\n return (\n <DismissibleRootContext.Provider value={value}>\n {children}\n </DismissibleRootContext.Provider>\n )\n}\n\nexport interface DismissibleRootInternalProps {\n asChild?: boolean\n}\n\nconst DismissibleRootInternal = ({\n asChild = false,\n ...rest\n}: React.PropsWithChildren<DismissibleRootInternalProps>) => {\n const rootContext = React.useContext(DismissibleRootContext)\n\n const { isDismissed, disabled } = rootContext\n\n if (isDismissed) return null\n\n const props = { ...(disabled && { [`data-disabled`]: '' }), ...rest }\n const Component = asChild ? Slot : 'div'\n return <Component {...props} />\n}\n\nexport const DismissibleRoot = ({\n disabled = false,\n dismissed,\n onDismiss,\n ...rest\n}: React.PropsWithChildren<\n DismissibleRootInternalProps & DismissibleRootProps\n>) => (\n <DismissibleRootProvider\n dismissed={dismissed}\n disabled={disabled}\n onDismiss={onDismiss}\n >\n <DismissibleRootInternal {...rest} />\n </DismissibleRootProvider>\n)\n\nDismissibleRoot.displayName = 'Dismissible'\n"],"mappings":";;;;AAUA,IAAa,yBACX,QAAM,cAA2C;CAC/C,aAAa;CACb,sBAAsB,KAAA;CACtB,iBAAiB,KAAA;AACnB,CAAC;AAQH,IAAa,2BAA2B,EACtC,WAAW,uBACX,UACA,UACA,kBAAkB,WACiC;CACnD,MAAM,CAAC,aAAa,kBAAkB,QAAM,SAAS,KAAK;CAE1D,MAAM,QAAQ,QAAM,cAA2C;EAC7D,MAAM,eAAe,OAAO,0BAA0B;EACtD,OAAO;GACL;GACA,aAAa,eACR,wBACD;GACJ,gBAAgB,qBAAqB,OAAO;GAC5C;EACF;CACF,GAAG;EAAC;EAAU;EAAa;EAAW;CAAqB,CAAC;CAE5D,OACE,oBAAC,uBAAuB,UAAxB;EAAwC;EACrC;CAC8B,CAAA;AAErC;AAMA,IAAM,2BAA2B,EAC/B,UAAU,OACV,GAAG,WACwD;CAG3D,MAAM,EAAE,aAAa,aAFD,QAAM,WAAW,sBAEH;CAElC,IAAI,aAAa,OAAO;CAExB,MAAM,QAAQ;EAAE,GAAI,YAAY,GAAG,kBAAkB,GAAG;EAAI,GAAG;CAAK;CAEpE,OAAO,oBADW,UAAU,OAAO,OAC5B,EAAW,GAAI,MAAQ,CAAA;AAChC;AAEA,IAAa,mBAAmB,EAC9B,WAAW,OACX,WACA,WACA,GAAG,WAIH,oBAAC,yBAAD;CACa;CACD;CACC;WAEX,oBAAC,yBAAD,EAAyB,GAAI,KAAO,CAAA;AACb,CAAA;AAG3B,gBAAgB,cAAc"}
1
+ {"version":3,"file":"DismissibleRoot.js","names":[],"sources":["../../../src/components/dismissible/DismissibleRoot.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\n\nexport interface DismissibleRootContextValue {\n disabled?: boolean\n isDismissed: boolean\n setIsDismissed: (boolean) => void\n onDismiss: () => void\n}\n\nexport const DismissibleRootContext =\n React.createContext<DismissibleRootContextValue>({\n isDismissed: false,\n setIsDismissed: () => undefined,\n onDismiss: () => undefined\n })\n\nexport interface DismissibleRootProps {\n disabled?: boolean\n dismissed?: boolean\n onDismiss?: () => void\n}\n\nexport const DismissibleRootProvider = ({\n dismissed: controlledIsDismissed,\n children,\n disabled,\n onDismiss = () => null\n}: React.PropsWithChildren<DismissibleRootProps>) => {\n const [isDismissed, setIsDismissed] = React.useState(false)\n\n const value = React.useMemo<DismissibleRootContextValue>(() => {\n const isControlled = typeof controlledIsDismissed === 'boolean'\n return {\n disabled,\n isDismissed: isControlled\n ? (controlledIsDismissed as boolean)\n : isDismissed,\n setIsDismissed: isControlled ? () => null : setIsDismissed,\n onDismiss\n }\n }, [disabled, isDismissed, onDismiss, controlledIsDismissed])\n\n return (\n <DismissibleRootContext value={value}>{children}</DismissibleRootContext>\n )\n}\n\nexport interface DismissibleRootInternalProps {\n asChild?: boolean\n}\n\nconst DismissibleRootInternal = ({\n asChild = false,\n ...rest\n}: React.PropsWithChildren<DismissibleRootInternalProps>) => {\n const rootContext = React.use(DismissibleRootContext)\n\n const { isDismissed, disabled } = rootContext\n\n if (isDismissed) return null\n\n const props = { ...(disabled && { [`data-disabled`]: '' }), ...rest }\n const Component = asChild ? Slot : 'div'\n return <Component {...props} />\n}\n\nexport const DismissibleRoot = ({\n disabled = false,\n dismissed,\n onDismiss,\n ...rest\n}: React.PropsWithChildren<\n DismissibleRootInternalProps & DismissibleRootProps\n>) => (\n <DismissibleRootProvider\n dismissed={dismissed}\n disabled={disabled}\n onDismiss={onDismiss}\n >\n <DismissibleRootInternal {...rest} />\n </DismissibleRootProvider>\n)\n\nDismissibleRoot.displayName = 'Dismissible'\n"],"mappings":";;;;AAUA,IAAa,yBACX,QAAM,cAA2C;CAC/C,aAAa;CACb,sBAAsB,KAAA;CACtB,iBAAiB,KAAA;AACnB,CAAC;AAQH,IAAa,2BAA2B,EACtC,WAAW,uBACX,UACA,UACA,kBAAkB,WACiC;CACnD,MAAM,CAAC,aAAa,kBAAkB,QAAM,SAAS,KAAK;CAc1D,OACE,oBAAC,wBAAD;EAA+B,OAbnB,QAAM,cAA2C;GAC7D,MAAM,eAAe,OAAO,0BAA0B;GACtD,OAAO;IACL;IACA,aAAa,eACR,wBACD;IACJ,gBAAgB,qBAAqB,OAAO;IAC5C;GACF;EACF,GAAG;GAAC;GAAU;GAAa;GAAW;EAAqB,CAG1B;EAAQ;CAAiC,CAAA;AAE5E;AAMA,IAAM,2BAA2B,EAC/B,UAAU,OACV,GAAG,WACwD;CAG3D,MAAM,EAAE,aAAa,aAFD,QAAM,IAAI,sBAEI;CAElC,IAAI,aAAa,OAAO;CAExB,MAAM,QAAQ;EAAE,GAAI,YAAY,GAAG,kBAAkB,GAAG;EAAI,GAAG;CAAK;CAEpE,OAAO,oBADW,UAAU,OAAO,OAC5B,EAAW,GAAI,MAAQ,CAAA;AAChC;AAEA,IAAa,mBAAmB,EAC9B,WAAW,OACX,WACA,WACA,GAAG,WAIH,oBAAC,yBAAD;CACa;CACD;CACC;WAEX,oBAAC,yBAAD,EAAyB,GAAI,KAAO,CAAA;AACb,CAAA;AAG3B,gBAAgB,cAAc"}
@@ -9,7 +9,7 @@ var DefaultTrigger = (props) => /* @__PURE__ */ jsx("button", {
9
9
  children: "Dismiss"
10
10
  });
11
11
  var DismissibleTrigger = ({ asChild = false, ...rest }) => {
12
- const context = React$1.useContext(DismissibleRootContext);
12
+ const context = React$1.use(DismissibleRootContext);
13
13
  if (context === void 0) throw new Error("Dismissible.Trigger can only be used within a Dismissible.Item");
14
14
  const { setIsDismissed, disabled, onDismiss } = context;
15
15
  const handleDismiss = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"DismissibleTrigger.js","names":[],"sources":["../../../src/components/dismissible/DismissibleTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\n\nimport { DismissibleRootContext } from './DismissibleRoot'\n\nexport interface DismissibleTriggerProps {\n asChild?: boolean\n}\n\nconst DefaultTrigger = (props) => (\n <button type=\"button\" {...props}>\n Dismiss\n </button>\n)\n\nexport const DismissibleTrigger = ({\n asChild = false,\n ...rest\n}: React.PropsWithChildren<DismissibleTriggerProps>) => {\n const context = React.useContext(DismissibleRootContext)\n if (context === undefined) {\n throw new Error(\n 'Dismissible.Trigger can only be used within a Dismissible.Item'\n )\n }\n\n const { setIsDismissed, disabled, onDismiss } = context\n\n const handleDismiss = () => {\n setIsDismissed(true)\n onDismiss?.()\n }\n\n const props = {\n disabled: disabled,\n onClick: handleDismiss,\n ...rest\n }\n\n const Component = asChild ? Slot : DefaultTrigger\n return <Component {...props} />\n}\n"],"mappings":";;;;;AASA,IAAM,kBAAkB,UACtB,oBAAC,UAAD;CAAQ,MAAK;CAAS,GAAI;WAAO;AAEzB,CAAA;AAGV,IAAa,sBAAsB,EACjC,UAAU,OACV,GAAG,WACmD;CACtD,MAAM,UAAU,QAAM,WAAW,sBAAsB;CACvD,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MACR,gEACF;CAGF,MAAM,EAAE,gBAAgB,UAAU,cAAc;CAEhD,MAAM,sBAAsB;EAC1B,eAAe,IAAI;EACnB,YAAY;CACd;CAEA,MAAM,QAAQ;EACF;EACV,SAAS;EACT,GAAG;CACL;CAGA,OAAO,oBADW,UAAU,OAAO,gBAC5B,EAAW,GAAI,MAAQ,CAAA;AAChC"}
1
+ {"version":3,"file":"DismissibleTrigger.js","names":[],"sources":["../../../src/components/dismissible/DismissibleTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\n\nimport { DismissibleRootContext } from './DismissibleRoot'\n\nexport interface DismissibleTriggerProps {\n asChild?: boolean\n}\n\nconst DefaultTrigger = (props) => (\n <button type=\"button\" {...props}>\n Dismiss\n </button>\n)\n\nexport const DismissibleTrigger = ({\n asChild = false,\n ...rest\n}: React.PropsWithChildren<DismissibleTriggerProps>) => {\n const context = React.use(DismissibleRootContext)\n if (context === undefined) {\n throw new Error(\n 'Dismissible.Trigger can only be used within a Dismissible.Item'\n )\n }\n\n const { setIsDismissed, disabled, onDismiss } = context\n\n const handleDismiss = () => {\n setIsDismissed(true)\n onDismiss?.()\n }\n\n const props = {\n disabled: disabled,\n onClick: handleDismiss,\n ...rest\n }\n\n const Component = asChild ? Slot : DefaultTrigger\n return <Component {...props} />\n}\n"],"mappings":";;;;;AASA,IAAM,kBAAkB,UACtB,oBAAC,UAAD;CAAQ,MAAK;CAAS,GAAI;WAAO;AAEzB,CAAA;AAGV,IAAa,sBAAsB,EACjC,UAAU,OACV,GAAG,WACmD;CACtD,MAAM,UAAU,QAAM,IAAI,sBAAsB;CAChD,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MACR,gEACF;CAGF,MAAM,EAAE,gBAAgB,UAAU,cAAc;CAEhD,MAAM,sBAAsB;EAC1B,eAAe,IAAI;EACnB,YAAY;CACd;CAEA,MAAM,QAAQ;EACF;EACV,SAAS;EACT,GAAG;CACL;CAGA,OAAO,oBADW,UAAU,OAAO,gBAC5B,EAAW,GAAI,MAAQ,CAAA;AAChC"}
@@ -4,7 +4,7 @@ import * as React$1 from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/components/dismissible-group/DismissibleGroupItem.tsx
6
6
  var DismissibleGroupItem = ({ children, value, disabled: itemDisabled = false, ...rest }) => {
7
- const groupContext = React$1.useContext(DismissibleGroupContext);
7
+ const groupContext = React$1.use(DismissibleGroupContext);
8
8
  if (groupContext === void 0) throw new Error("DismissibleGroup.Item can only be used within a DismissibleGroup");
9
9
  const { onDismiss, disabled: groupDisabled } = groupContext;
10
10
  return /* @__PURE__ */ jsx(Dismissible, {
@@ -1 +1 @@
1
- {"version":3,"file":"DismissibleGroupItem.js","names":[],"sources":["../../../src/components/dismissible-group/DismissibleGroupItem.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Dismissible } from '../dismissible'\nimport { DismissibleGroupContext } from './DismissibleGroupRoot'\n\nexport type DismissibleGroupItemProps = React.ComponentProps<\n typeof Dismissible\n> & {\n value: string | number\n disabled?: boolean\n}\n\nexport const DismissibleGroupItem = ({\n children,\n value,\n disabled: itemDisabled = false,\n ...rest\n}: React.PropsWithChildren<DismissibleGroupItemProps>) => {\n const groupContext = React.useContext(DismissibleGroupContext)\n if (groupContext === undefined) {\n throw new Error(\n 'DismissibleGroup.Item can only be used within a DismissibleGroup'\n )\n }\n const { onDismiss, disabled: groupDisabled } = groupContext\n return (\n <Dismissible\n disabled={groupDisabled || itemDisabled}\n {...rest}\n onDismiss={() => onDismiss(value)}\n >\n {children}\n </Dismissible>\n )\n}\n"],"mappings":";;;;;AAYA,IAAa,wBAAwB,EACnC,UACA,OACA,UAAU,eAAe,OACzB,GAAG,WACqD;CACxD,MAAM,eAAe,QAAM,WAAW,uBAAuB;CAC7D,IAAI,iBAAiB,KAAA,GACnB,MAAM,IAAI,MACR,kEACF;CAEF,MAAM,EAAE,WAAW,UAAU,kBAAkB;CAC/C,OACE,oBAAC,aAAD;EACE,UAAU,iBAAiB;EAC3B,GAAI;EACJ,iBAAiB,UAAU,KAAK;EAE/B;CACU,CAAA;AAEjB"}
1
+ {"version":3,"file":"DismissibleGroupItem.js","names":[],"sources":["../../../src/components/dismissible-group/DismissibleGroupItem.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { Dismissible } from '../dismissible'\nimport { DismissibleGroupContext } from './DismissibleGroupRoot'\n\nexport type DismissibleGroupItemProps = React.ComponentProps<\n typeof Dismissible\n> & {\n value: string | number\n disabled?: boolean\n}\n\nexport const DismissibleGroupItem = ({\n children,\n value,\n disabled: itemDisabled = false,\n ...rest\n}: React.PropsWithChildren<DismissibleGroupItemProps>) => {\n const groupContext = React.use(DismissibleGroupContext)\n if (groupContext === undefined) {\n throw new Error(\n 'DismissibleGroup.Item can only be used within a DismissibleGroup'\n )\n }\n const { onDismiss, disabled: groupDisabled } = groupContext\n return (\n <Dismissible\n disabled={groupDisabled || itemDisabled}\n {...rest}\n onDismiss={() => onDismiss(value)}\n >\n {children}\n </Dismissible>\n )\n}\n"],"mappings":";;;;;AAYA,IAAa,wBAAwB,EACnC,UACA,OACA,UAAU,eAAe,OACzB,GAAG,WACqD;CACxD,MAAM,eAAe,QAAM,IAAI,uBAAuB;CACtD,IAAI,iBAAiB,KAAA,GACnB,MAAM,IAAI,MACR,kEACF;CAEF,MAAM,EAAE,WAAW,UAAU,kBAAkB;CAC/C,OACE,oBAAC,aAAD;EACE,UAAU,iBAAiB;EAC3B,GAAI;EACJ,iBAAiB,UAAU,KAAK;EAE/B;CACU,CAAA;AAEjB"}
@@ -3,12 +3,11 @@ import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/dismissible-group/DismissibleGroupRoot.tsx
4
4
  var DismissibleGroupContext = React$1.createContext({ onDismiss: () => null });
5
5
  var DismissibleGroupProvider = ({ children, disabled, onDismiss }) => {
6
- const value = React$1.useMemo(() => ({
7
- disabled,
8
- onDismiss
9
- }), [disabled, onDismiss]);
10
- return /* @__PURE__ */ jsx(DismissibleGroupContext.Provider, {
11
- value,
6
+ return /* @__PURE__ */ jsx(DismissibleGroupContext, {
7
+ value: React$1.useMemo(() => ({
8
+ disabled,
9
+ onDismiss
10
+ }), [disabled, onDismiss]),
12
11
  children
13
12
  });
14
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DismissibleGroupRoot.js","names":[],"sources":["../../../src/components/dismissible-group/DismissibleGroupRoot.tsx"],"sourcesContent":["import * as React from 'react'\n\nexport interface DismissibleGroupContextValue {\n disabled?: boolean\n onDismiss: (value: string | number) => void\n}\nexport const DismissibleGroupContext =\n React.createContext<DismissibleGroupContextValue>({\n onDismiss: () => null\n })\n\nexport interface DismissibleGroupProps {\n disabled?: boolean\n onDismiss: (value: string | number) => void\n}\n\nexport const DismissibleGroupProvider = ({\n children,\n disabled,\n onDismiss\n}: React.PropsWithChildren<DismissibleGroupProps>) => {\n const value = React.useMemo<DismissibleGroupContextValue>(\n () => ({ disabled, onDismiss }),\n [disabled, onDismiss]\n )\n return (\n <DismissibleGroupContext.Provider value={value}>\n {children}\n </DismissibleGroupContext.Provider>\n )\n}\n\nexport interface DismissibleGroupRootProps extends DismissibleGroupProps {\n as?: React.ElementType\n ref?: React.Ref<HTMLDivElement>\n}\n\nexport const DismissibleGroupRoot = ({\n as: Component = 'div',\n disabled,\n onDismiss,\n ...rest\n}: React.PropsWithChildren<DismissibleGroupRootProps>) => (\n <DismissibleGroupProvider disabled={disabled} onDismiss={onDismiss}>\n <Component {...rest} />\n </DismissibleGroupProvider>\n)\n\nDismissibleGroupRoot.displayName = 'DismissibleGroup'\n"],"mappings":";;;AAMA,IAAa,0BACX,QAAM,cAA4C,EAChD,iBAAiB,KACnB,CAAC;AAOH,IAAa,4BAA4B,EACvC,UACA,UACA,gBACoD;CACpD,MAAM,QAAQ,QAAM,eACX;EAAE;EAAU;CAAU,IAC7B,CAAC,UAAU,SAAS,CACtB;CACA,OACE,oBAAC,wBAAwB,UAAzB;EAAyC;EACtC;CAC+B,CAAA;AAEtC;AAOA,IAAa,wBAAwB,EACnC,IAAI,YAAY,OAChB,UACA,WACA,GAAG,WAEH,oBAAC,0BAAD;CAAoC;CAAqB;WACvD,oBAAC,WAAD,EAAW,GAAI,KAAO,CAAA;AACE,CAAA;AAG5B,qBAAqB,cAAc"}
1
+ {"version":3,"file":"DismissibleGroupRoot.js","names":[],"sources":["../../../src/components/dismissible-group/DismissibleGroupRoot.tsx"],"sourcesContent":["import * as React from 'react'\n\nexport interface DismissibleGroupContextValue {\n disabled?: boolean\n onDismiss: (value: string | number) => void\n}\nexport const DismissibleGroupContext =\n React.createContext<DismissibleGroupContextValue>({\n onDismiss: () => null\n })\n\nexport interface DismissibleGroupProps {\n disabled?: boolean\n onDismiss: (value: string | number) => void\n}\n\nexport const DismissibleGroupProvider = ({\n children,\n disabled,\n onDismiss\n}: React.PropsWithChildren<DismissibleGroupProps>) => {\n const value = React.useMemo<DismissibleGroupContextValue>(\n () => ({ disabled, onDismiss }),\n [disabled, onDismiss]\n )\n return (\n <DismissibleGroupContext value={value}>{children}</DismissibleGroupContext>\n )\n}\n\nexport interface DismissibleGroupRootProps extends DismissibleGroupProps {\n as?: React.ElementType\n ref?: React.Ref<HTMLDivElement>\n}\n\nexport const DismissibleGroupRoot = ({\n as: Component = 'div',\n disabled,\n onDismiss,\n ...rest\n}: React.PropsWithChildren<DismissibleGroupRootProps>) => (\n <DismissibleGroupProvider disabled={disabled} onDismiss={onDismiss}>\n <Component {...rest} />\n </DismissibleGroupProvider>\n)\n\nDismissibleGroupRoot.displayName = 'DismissibleGroup'\n"],"mappings":";;;AAMA,IAAa,0BACX,QAAM,cAA4C,EAChD,iBAAiB,KACnB,CAAC;AAOH,IAAa,4BAA4B,EACvC,UACA,UACA,gBACoD;CAKpD,OACE,oBAAC,yBAAD;EAAgC,OALpB,QAAM,eACX;GAAE;GAAU;EAAU,IAC7B,CAAC,UAAU,SAAS,CAGY;EAAQ;CAAkC,CAAA;AAE9E;AAOA,IAAa,wBAAwB,EACnC,IAAI,YAAY,OAChB,UACA,WACA,GAAG,WAEH,oBAAC,0BAAD;CAAoC;CAAqB;WACvD,oBAAC,WAAD,EAAW,GAAI,KAAO,CAAA;AACE,CAAA;AAG5B,qBAAqB,cAAc"}
@@ -3,9 +3,8 @@ import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/drawer/Drawer.context.tsx
4
4
  var DrawerContext = React$1.createContext({ position: "left" });
5
5
  var DrawerProvider = ({ position = "left", ...rest }) => {
6
- const value = React$1.useMemo(() => ({ position }), [position]);
7
- return /* @__PURE__ */ jsx(DrawerContext.Provider, {
8
- value,
6
+ return /* @__PURE__ */ jsx(DrawerContext, {
7
+ value: React$1.useMemo(() => ({ position }), [position]),
9
8
  ...rest
10
9
  });
11
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.context.js","names":[],"sources":["../../../src/components/drawer/Drawer.context.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { StyledContent } from './DrawerContent'\n\ntype DrawerProviderProps = {\n position?: React.ComponentProps<typeof StyledContent>['position']\n}\n\ntype DrawerContext = DrawerProviderProps\n\nexport const DrawerContext = React.createContext<DrawerContext>({\n position: 'left'\n})\n\nexport const DrawerProvider = ({\n position = 'left',\n ...rest\n}: React.PropsWithChildren<DrawerProviderProps>) => {\n const value = React.useMemo<DrawerContext>(() => ({ position }), [position])\n return <DrawerContext.Provider value={value} {...rest} />\n}\n"],"mappings":";;;AAUA,IAAa,gBAAgB,QAAM,cAA6B,EAC9D,UAAU,OACZ,CAAC;AAED,IAAa,kBAAkB,EAC7B,WAAW,QACX,GAAG,WAC+C;CAClD,MAAM,QAAQ,QAAM,eAA8B,EAAE,SAAS,IAAI,CAAC,QAAQ,CAAC;CAC3E,OAAO,oBAAC,cAAc,UAAf;EAA+B;EAAO,GAAI;CAAO,CAAA;AAC1D"}
1
+ {"version":3,"file":"Drawer.context.js","names":[],"sources":["../../../src/components/drawer/Drawer.context.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { StyledContent } from './DrawerContent'\n\ntype DrawerProviderProps = {\n position?: React.ComponentProps<typeof StyledContent>['position']\n}\n\ntype DrawerContext = DrawerProviderProps\n\nexport const DrawerContext = React.createContext<DrawerContext>({\n position: 'left'\n})\n\nexport const DrawerProvider = ({\n position = 'left',\n ...rest\n}: React.PropsWithChildren<DrawerProviderProps>) => {\n const value = React.useMemo<DrawerContext>(() => ({ position }), [position])\n return <DrawerContext value={value} {...rest} />\n}\n"],"mappings":";;;AAUA,IAAa,gBAAgB,QAAM,cAA6B,EAC9D,UAAU,OACZ,CAAC;AAED,IAAa,kBAAkB,EAC7B,WAAW,QACX,GAAG,WAC+C;CAElD,OAAO,oBAAC,eAAD;EAAsB,OADf,QAAM,eAA8B,EAAE,SAAS,IAAI,CAAC,QAAQ,CAC7C;EAAO,GAAI;CAAO,CAAA;AACjD"}
@@ -60,7 +60,7 @@ var StyledContent = styled(Content, {
60
60
  }
61
61
  });
62
62
  var DrawerContent = ({ children, ...rest }) => {
63
- const { position } = React$1.useContext(DrawerContext);
63
+ const { position } = React$1.use(DrawerContext);
64
64
  return /* @__PURE__ */ jsxs(Portal, { children: [/* @__PURE__ */ jsx(DrawerOverlay, {}), /* @__PURE__ */ jsx(ColorScheme, {
65
65
  base: "grey1",
66
66
  accent: "primary1",
@@ -1 +1 @@
1
- {"version":3,"file":"DrawerContent.js","names":[],"sources":["../../../src/components/drawer/DrawerContent.tsx"],"sourcesContent":["import { Content, Portal } from '@radix-ui/react-dialog'\nimport * as React from 'react'\n\nimport { ColorScheme } from '../../experiments/color-scheme/ColorScheme'\nimport { styled } from '../../styled'\nimport { DrawerContext } from './Drawer.context'\nimport { DrawerOverlay } from './DrawerOverlay'\n\nexport const StyledContent = styled(Content, {\n base: [\n 'bg-(--base-1)',\n 'shadow-lg',\n 'fixed',\n 'z-1147483646',\n 'motion-safe:data-[state=open]:animate-slide-direction-in',\n 'motion-safe:data-[state=closed]:animate-slide-direction-out'\n ],\n variants: {\n position: {\n top: [\n '[--slide-direction-out-y:-100%]',\n 'top-0',\n 'left-0',\n 'w-full',\n 'max-h-17/20'\n ],\n right: [\n '[--slide-direction-out-x:100%]',\n 'right-0',\n 'top-0',\n 'h-full',\n 'w-(--drawer-content-width,100%)',\n 'max-w-full'\n ],\n bottom: [\n '[--slide-direction-out-y:100%]',\n 'bottom-0',\n 'left-0',\n 'w-full',\n 'max-h-17/20'\n ],\n left: [\n '[--slide-direction-out-x:-100%]',\n 'left-0',\n 'top-0',\n 'h-full',\n 'w-(--drawer-content-width,100%)',\n 'max-w-full'\n ]\n },\n size: {\n xs: ['[--drawer-content-width:240px]'],\n sm: ['[--drawer-content-width:256px]'],\n md: ['[--drawer-content-width:288px]'],\n lg: ['[--drawer-content-width:304px]'],\n xl: ['[--drawer-content-width:320px]'],\n '2xl': ['[--drawer-content-width:720px]'],\n '3xl': ['[--drawer-content-width:1000px]']\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 <div className=\"flex flex-col\">{children}</div>\n </StyledContent>\n </ColorScheme>\n </Portal>\n )\n}\n"],"mappings":";;;;;;;;AAQA,IAAa,gBAAgB,OAAO,SAAS;CAC3C,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU;EACR,UAAU;GACR,KAAK;IACH;IACA;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;GACF;GACA,QAAQ;IACN;IACA;IACA;IACA;IACA;GACF;GACA,MAAM;IACJ;IACA;IACA;IACA;IACA;IACA;GACF;EACF;EACA,MAAM;GACJ,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,OAAO,CAAC,gCAAgC;GACxC,OAAO,CAAC,iCAAiC;EAC3C;CACF;AACF,CAAC;AAED,IAAa,iBAAiB,EAC5B,UACA,GAAG,WAC6C;CAChD,MAAM,EAAE,aAAa,QAAM,WAAW,aAAa;CAEnD,OACE,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,eAAD,CAAgB,CAAA,GAChB,oBAAC,aAAD;EAAa,MAAK;EAAQ,QAAO;EAAW,SAAA;YAC1C,oBAAC,eAAD;GAAe,MAAK;GAAe;GAAU,GAAI;GAAM,SAAA;aACrD,oBAAC,OAAD;IAAK,WAAU;IAAiB;GAAc,CAAA;EACjC,CAAA;CACJ,CAAA,CACP,EAAA,CAAA;AAEZ"}
1
+ {"version":3,"file":"DrawerContent.js","names":[],"sources":["../../../src/components/drawer/DrawerContent.tsx"],"sourcesContent":["import { Content, Portal } from '@radix-ui/react-dialog'\nimport * as React from 'react'\n\nimport { ColorScheme } from '../../experiments/color-scheme/ColorScheme'\nimport { styled } from '../../styled'\nimport { DrawerContext } from './Drawer.context'\nimport { DrawerOverlay } from './DrawerOverlay'\n\nexport const StyledContent = styled(Content, {\n base: [\n 'bg-(--base-1)',\n 'shadow-lg',\n 'fixed',\n 'z-1147483646',\n 'motion-safe:data-[state=open]:animate-slide-direction-in',\n 'motion-safe:data-[state=closed]:animate-slide-direction-out'\n ],\n variants: {\n position: {\n top: [\n '[--slide-direction-out-y:-100%]',\n 'top-0',\n 'left-0',\n 'w-full',\n 'max-h-17/20'\n ],\n right: [\n '[--slide-direction-out-x:100%]',\n 'right-0',\n 'top-0',\n 'h-full',\n 'w-(--drawer-content-width,100%)',\n 'max-w-full'\n ],\n bottom: [\n '[--slide-direction-out-y:100%]',\n 'bottom-0',\n 'left-0',\n 'w-full',\n 'max-h-17/20'\n ],\n left: [\n '[--slide-direction-out-x:-100%]',\n 'left-0',\n 'top-0',\n 'h-full',\n 'w-(--drawer-content-width,100%)',\n 'max-w-full'\n ]\n },\n size: {\n xs: ['[--drawer-content-width:240px]'],\n sm: ['[--drawer-content-width:256px]'],\n md: ['[--drawer-content-width:288px]'],\n lg: ['[--drawer-content-width:304px]'],\n xl: ['[--drawer-content-width:320px]'],\n '2xl': ['[--drawer-content-width:720px]'],\n '3xl': ['[--drawer-content-width:1000px]']\n }\n }\n})\n\nexport const DrawerContent = ({\n children,\n ...rest\n}: React.ComponentProps<typeof StyledContent>) => {\n const { position } = React.use(DrawerContext)\n\n return (\n <Portal>\n <DrawerOverlay />\n <ColorScheme base=\"grey1\" accent=\"primary1\" asChild>\n <StyledContent size=\"lg\" position={position} {...rest} asChild>\n <div className=\"flex flex-col\">{children}</div>\n </StyledContent>\n </ColorScheme>\n </Portal>\n )\n}\n"],"mappings":";;;;;;;;AAQA,IAAa,gBAAgB,OAAO,SAAS;CAC3C,MAAM;EACJ;EACA;EACA;EACA;EACA;EACA;CACF;CACA,UAAU;EACR,UAAU;GACR,KAAK;IACH;IACA;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;IACA;IACA;IACA;GACF;GACA,QAAQ;IACN;IACA;IACA;IACA;IACA;GACF;GACA,MAAM;IACJ;IACA;IACA;IACA;IACA;IACA;GACF;EACF;EACA,MAAM;GACJ,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,IAAI,CAAC,gCAAgC;GACrC,OAAO,CAAC,gCAAgC;GACxC,OAAO,CAAC,iCAAiC;EAC3C;CACF;AACF,CAAC;AAED,IAAa,iBAAiB,EAC5B,UACA,GAAG,WAC6C;CAChD,MAAM,EAAE,aAAa,QAAM,IAAI,aAAa;CAE5C,OACE,qBAAC,QAAD,EAAA,UAAA,CACE,oBAAC,eAAD,CAAgB,CAAA,GAChB,oBAAC,aAAD;EAAa,MAAK;EAAQ,QAAO;EAAW,SAAA;YAC1C,oBAAC,eAAD;GAAe,MAAK;GAAe;GAAU,GAAI;GAAM,SAAA;aACrD,oBAAC,OAAD;IAAK,WAAU;IAAiB;GAAc,CAAA;EACjC,CAAA;CACJ,CAAA,CACP,EAAA,CAAA;AAEZ"}
@@ -3,9 +3,8 @@ import { jsx } from "react/jsx-runtime";
3
3
  //#region src/components/empty-state/EmptyState.context.tsx
4
4
  var EmptyStateContext = React$1.createContext({});
5
5
  var EmptyStateProvider = ({ size, children }) => {
6
- const value = React$1.useMemo(() => ({ size }), [size]);
7
- return /* @__PURE__ */ jsx(EmptyStateContext.Provider, {
8
- value,
6
+ return /* @__PURE__ */ jsx(EmptyStateContext, {
7
+ value: React$1.useMemo(() => ({ size }), [size]),
9
8
  children
10
9
  });
11
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.context.js","names":[],"sources":["../../../src/components/empty-state/EmptyState.context.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { EmptyStateProps } from './EmptyState'\n\ntype EmptyStateProviderProps = {\n size?: EmptyStateProps['size']\n}\n\ntype EmptyStateContextValue = EmptyStateProviderProps\n\nexport const EmptyStateContext = React.createContext<EmptyStateContextValue>({})\n\nexport const EmptyStateProvider = ({\n size,\n children\n}: React.PropsWithChildren<EmptyStateProviderProps>) => {\n const value = React.useMemo<EmptyStateContextValue>(() => ({ size }), [size])\n return (\n <EmptyStateContext.Provider value={value}>\n {children}\n </EmptyStateContext.Provider>\n )\n}\n"],"mappings":";;;AAUA,IAAa,oBAAoB,QAAM,cAAsC,CAAC,CAAC;AAE/E,IAAa,sBAAsB,EACjC,MACA,eACsD;CACtD,MAAM,QAAQ,QAAM,eAAuC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC;CAC5E,OACE,oBAAC,kBAAkB,UAAnB;EAAmC;EAChC;CACyB,CAAA;AAEhC"}
1
+ {"version":3,"file":"EmptyState.context.js","names":[],"sources":["../../../src/components/empty-state/EmptyState.context.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport type { EmptyStateProps } from './EmptyState'\n\ntype EmptyStateProviderProps = {\n size?: EmptyStateProps['size']\n}\n\ntype EmptyStateContextValue = EmptyStateProviderProps\n\nexport const EmptyStateContext = React.createContext<EmptyStateContextValue>({})\n\nexport const EmptyStateProvider = ({\n size,\n children\n}: React.PropsWithChildren<EmptyStateProviderProps>) => {\n const value = React.useMemo<EmptyStateContextValue>(() => ({ size }), [size])\n return <EmptyStateContext value={value}>{children}</EmptyStateContext>\n}\n"],"mappings":";;;AAUA,IAAa,oBAAoB,QAAM,cAAsC,CAAC,CAAC;AAE/E,IAAa,sBAAsB,EACjC,MACA,eACsD;CAEtD,OAAO,oBAAC,mBAAD;EAA0B,OADnB,QAAM,eAAuC,EAAE,KAAK,IAAI,CAAC,IAAI,CAC1C;EAAQ;CAA4B,CAAA;AACvE"}
@@ -15,7 +15,7 @@ var StyledEmptyStateBody = styled(Text, {
15
15
  } }
16
16
  }, { enableResponsiveVariants: true });
17
17
  var EmptyStateBody = (props) => {
18
- const { size } = React$1.useContext(EmptyStateContext);
18
+ const { size } = React$1.use(EmptyStateContext);
19
19
  return /* @__PURE__ */ jsx(StyledEmptyStateBody, {
20
20
  ...props,
21
21
  size
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyStateBody.js","names":[],"sources":["../../../src/components/empty-state/EmptyStateBody.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { Text } from '../text/Text'\nimport { EmptyStateContext } from './EmptyState.context'\n\nconst StyledEmptyStateBody = styled(\n Text,\n {\n base: ['text-grey-800', 'font-normal'],\n variants: {\n size: {\n xs: ['mb-4', 'text-sm'],\n sm: ['mb-4', 'text-sm'],\n md: ['mb-4', 'text-sm'],\n lg: ['mb-6', 'text-md'],\n xl: ['mb-6', 'text-md']\n }\n }\n },\n { enableResponsiveVariants: true }\n)\n\ntype EmptyStateBodyProps = React.ComponentProps<typeof StyledEmptyStateBody>\n\nexport const EmptyStateBody = (props: EmptyStateBodyProps) => {\n const { size } = React.useContext(EmptyStateContext)\n return <StyledEmptyStateBody {...props} size={size} />\n}\n"],"mappings":";;;;;;AAMA,IAAM,uBAAuB,OAC3B,MACA;CACE,MAAM,CAAC,iBAAiB,aAAa;CACrC,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;CACxB,EACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAIA,IAAa,kBAAkB,UAA+B;CAC5D,MAAM,EAAE,SAAS,QAAM,WAAW,iBAAiB;CACnD,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAa;CAAO,CAAA;AACvD"}
1
+ {"version":3,"file":"EmptyStateBody.js","names":[],"sources":["../../../src/components/empty-state/EmptyStateBody.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { Text } from '../text/Text'\nimport { EmptyStateContext } from './EmptyState.context'\n\nconst StyledEmptyStateBody = styled(\n Text,\n {\n base: ['text-grey-800', 'font-normal'],\n variants: {\n size: {\n xs: ['mb-4', 'text-sm'],\n sm: ['mb-4', 'text-sm'],\n md: ['mb-4', 'text-sm'],\n lg: ['mb-6', 'text-md'],\n xl: ['mb-6', 'text-md']\n }\n }\n },\n { enableResponsiveVariants: true }\n)\n\ntype EmptyStateBodyProps = React.ComponentProps<typeof StyledEmptyStateBody>\n\nexport const EmptyStateBody = (props: EmptyStateBodyProps) => {\n const { size } = React.use(EmptyStateContext)\n return <StyledEmptyStateBody {...props} size={size} />\n}\n"],"mappings":";;;;;;AAMA,IAAM,uBAAuB,OAC3B,MACA;CACE,MAAM,CAAC,iBAAiB,aAAa;CACrC,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;CACxB,EACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAIA,IAAa,kBAAkB,UAA+B;CAC5D,MAAM,EAAE,SAAS,QAAM,IAAI,iBAAiB;CAC5C,OAAO,oBAAC,sBAAD;EAAsB,GAAI;EAAa;CAAO,CAAA;AACvD"}
@@ -35,7 +35,7 @@ var StyledEmptyStateImage = styled(Image, {
35
35
  } }
36
36
  }, { enableResponsiveVariants: true });
37
37
  var EmptyStateImage = (props) => {
38
- const { size } = React$1.useContext(EmptyStateContext);
38
+ const { size } = React$1.use(EmptyStateContext);
39
39
  return /* @__PURE__ */ jsx(StyledEmptyStateImage, {
40
40
  size,
41
41
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyStateImage.js","names":[],"sources":["../../../src/components/empty-state/EmptyStateImage.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { Image } from '../image/Image'\nimport { EmptyStateContext } from './EmptyState.context'\n\nconst StyledEmptyStateImage = styled(\n Image,\n {\n base: [],\n variants: {\n size: {\n xs: ['max-h-8', 'max-w-14', 'mb-4'],\n sm: ['max-h-12', 'max-w-21', 'mb-4'],\n md: ['max-h-18', 'max-w-[126px]', 'mb-4'],\n lg: ['max-h-[142px]', 'max-w-[190px]', 'mb-6'],\n xl: ['max-h-[213px]', 'max-w-[285px]', 'mb-6']\n }\n }\n },\n { enableResponsiveVariants: true }\n)\n\ntype EmptyStateImageProps = React.ComponentProps<typeof StyledEmptyStateImage>\n\nexport const EmptyStateImage = (props: EmptyStateImageProps) => {\n const { size } = React.useContext(EmptyStateContext)\n return <StyledEmptyStateImage size={size} {...props} />\n}\n"],"mappings":";;;;;;AAMA,IAAM,wBAAwB,OAC5B,OACA;CACE,MAAM,CAAC;CACP,UAAU,EACR,MAAM;EACJ,IAAI;GAAC;GAAW;GAAY;EAAM;EAClC,IAAI;GAAC;GAAY;GAAY;EAAM;EACnC,IAAI;GAAC;GAAY;GAAiB;EAAM;EACxC,IAAI;GAAC;GAAiB;GAAiB;EAAM;EAC7C,IAAI;GAAC;GAAiB;GAAiB;EAAM;CAC/C,EACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAIA,IAAa,mBAAmB,UAAgC;CAC9D,MAAM,EAAE,SAAS,QAAM,WAAW,iBAAiB;CACnD,OAAO,oBAAC,uBAAD;EAA6B;EAAM,GAAI;CAAQ,CAAA;AACxD"}
1
+ {"version":3,"file":"EmptyStateImage.js","names":[],"sources":["../../../src/components/empty-state/EmptyStateImage.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { Image } from '../image/Image'\nimport { EmptyStateContext } from './EmptyState.context'\n\nconst StyledEmptyStateImage = styled(\n Image,\n {\n base: [],\n variants: {\n size: {\n xs: ['max-h-8', 'max-w-14', 'mb-4'],\n sm: ['max-h-12', 'max-w-21', 'mb-4'],\n md: ['max-h-18', 'max-w-[126px]', 'mb-4'],\n lg: ['max-h-[142px]', 'max-w-[190px]', 'mb-6'],\n xl: ['max-h-[213px]', 'max-w-[285px]', 'mb-6']\n }\n }\n },\n { enableResponsiveVariants: true }\n)\n\ntype EmptyStateImageProps = React.ComponentProps<typeof StyledEmptyStateImage>\n\nexport const EmptyStateImage = (props: EmptyStateImageProps) => {\n const { size } = React.use(EmptyStateContext)\n return <StyledEmptyStateImage size={size} {...props} />\n}\n"],"mappings":";;;;;;AAMA,IAAM,wBAAwB,OAC5B,OACA;CACE,MAAM,CAAC;CACP,UAAU,EACR,MAAM;EACJ,IAAI;GAAC;GAAW;GAAY;EAAM;EAClC,IAAI;GAAC;GAAY;GAAY;EAAM;EACnC,IAAI;GAAC;GAAY;GAAiB;EAAM;EACxC,IAAI;GAAC;GAAiB;GAAiB;EAAM;EAC7C,IAAI;GAAC;GAAiB;GAAiB;EAAM;CAC/C,EACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAIA,IAAa,mBAAmB,UAAgC;CAC9D,MAAM,EAAE,SAAS,QAAM,IAAI,iBAAiB;CAC5C,OAAO,oBAAC,uBAAD;EAA6B;EAAM,GAAI;CAAQ,CAAA;AACxD"}
@@ -19,7 +19,7 @@ var StyledEmptyStateTitle = styled("h2", {
19
19
  } }
20
20
  }, { enableResponsiveVariants: true });
21
21
  var EmptyStateTitle = (props) => {
22
- const { size } = React$1.useContext(EmptyStateContext);
22
+ const { size } = React$1.use(EmptyStateContext);
23
23
  return /* @__PURE__ */ jsx(StyledEmptyStateTitle, {
24
24
  size,
25
25
  ...props
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyStateTitle.js","names":[],"sources":["../../../src/components/empty-state/EmptyStateTitle.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport type { Override } from '../../utilities/types'\nimport { EmptyStateContext } from './EmptyState.context'\n\nconst StyledEmptyStateTitle = styled(\n 'h2',\n {\n base: ['text-grey-800', 'font-body', 'font-semibold', 'm-0'],\n variants: {\n size: {\n xs: ['mb-3', 'text-md'],\n sm: ['mb-3', 'text-md'],\n md: ['mb-3', 'text-md'],\n lg: ['mb-4', 'text-lg'],\n xl: ['mb-4', 'text-lg']\n }\n }\n },\n { enableResponsiveVariants: true }\n)\n\n// Override, not intersection: ComponentProps yields `as?: never`, and\n// intersecting that with ElementType silently collapses `as` to undefined\ntype EmptyStateTitleProps = Override<\n React.ComponentProps<typeof StyledEmptyStateTitle>,\n {\n as?: React.ComponentType | React.ElementType\n }\n>\n\nexport const EmptyStateTitle = (props: EmptyStateTitleProps) => {\n const { size } = React.useContext(EmptyStateContext)\n return <StyledEmptyStateTitle size={size} {...props} />\n}\n"],"mappings":";;;;;AAMA,IAAM,wBAAwB,OAC5B,MACA;CACE,MAAM;EAAC;EAAiB;EAAa;EAAiB;CAAK;CAC3D,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;CACxB,EACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAWA,IAAa,mBAAmB,UAAgC;CAC9D,MAAM,EAAE,SAAS,QAAM,WAAW,iBAAiB;CACnD,OAAO,oBAAC,uBAAD;EAA6B;EAAM,GAAI;CAAQ,CAAA;AACxD"}
1
+ {"version":3,"file":"EmptyStateTitle.js","names":[],"sources":["../../../src/components/empty-state/EmptyStateTitle.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport type { Override } from '../../utilities/types'\nimport { EmptyStateContext } from './EmptyState.context'\n\nconst StyledEmptyStateTitle = styled(\n 'h2',\n {\n base: ['text-grey-800', 'font-body', 'font-semibold', 'm-0'],\n variants: {\n size: {\n xs: ['mb-3', 'text-md'],\n sm: ['mb-3', 'text-md'],\n md: ['mb-3', 'text-md'],\n lg: ['mb-4', 'text-lg'],\n xl: ['mb-4', 'text-lg']\n }\n }\n },\n { enableResponsiveVariants: true }\n)\n\n// Override, not intersection: ComponentProps yields `as?: never`, and\n// intersecting that with ElementType silently collapses `as` to undefined\ntype EmptyStateTitleProps = Override<\n React.ComponentProps<typeof StyledEmptyStateTitle>,\n {\n as?: React.ComponentType | React.ElementType\n }\n>\n\nexport const EmptyStateTitle = (props: EmptyStateTitleProps) => {\n const { size } = React.use(EmptyStateContext)\n return <StyledEmptyStateTitle size={size} {...props} />\n}\n"],"mappings":";;;;;AAMA,IAAM,wBAAwB,OAC5B,MACA;CACE,MAAM;EAAC;EAAiB;EAAa;EAAiB;CAAK;CAC3D,UAAU,EACR,MAAM;EACJ,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;EACtB,IAAI,CAAC,QAAQ,SAAS;CACxB,EACF;AACF,GACA,EAAE,0BAA0B,KAAK,CACnC;AAWA,IAAa,mBAAmB,UAAgC;CAC9D,MAAM,EAAE,SAAS,QAAM,IAAI,iBAAiB;CAC5C,OAAO,oBAAC,uBAAD;EAA6B;EAAM,GAAI;CAAQ,CAAA;AACxD"}
@@ -36,11 +36,11 @@ var FileDrop = ({ children, accept, multiple, onDrop, ...rest }) => {
36
36
  const handleKeyDown = (event) => {
37
37
  if (["Space", "Enter"].includes(event.key)) fileUploadInputRef.current?.click();
38
38
  };
39
- const value = {
39
+ const value = React$1.useMemo(() => ({
40
40
  isDragging,
41
41
  files
42
- };
43
- return /* @__PURE__ */ jsx(FileDropContext.Provider, {
42
+ }), [isDragging, files]);
43
+ return /* @__PURE__ */ jsx(FileDropContext, {
44
44
  value,
45
45
  children: /* @__PURE__ */ jsxs(StyledContainer, {
46
46
  onDragOver: handleDragOver,
@@ -1 +1 @@
1
- {"version":3,"file":"FileDrop.js","names":[],"sources":["../../../src/components/file-drop/FileDrop.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { FileDropContext } from './FileDrop.context'\nimport { type FileDropContextValue } from './types'\n\ninterface FileDropProps extends Omit<\n React.ComponentProps<'div'>,\n 'onDrop' | 'ref' | 'children'\n> {\n onDrop: (files: File[]) => void\n children?:\n | React.ReactNode\n | ((value: FileDropContextValue) => React.ReactNode)\n accept?: React.InputHTMLAttributes<HTMLInputElement>['accept']\n multiple?: React.InputHTMLAttributes<HTMLInputElement>['multiple']\n}\n\nconst StyledContainer = styled('div', {\n base: [\n 'flex',\n 'flex-col',\n 'gap-6',\n 'items-center',\n 'border',\n 'border-dashed',\n 'border-grey-500',\n 'px-12',\n 'py-8',\n 'rounded-md',\n 'cursor-pointer',\n '**:pointer-events-none'\n ]\n})\n\nexport const FileDrop = ({\n children,\n accept,\n multiple,\n onDrop,\n ...rest\n}: FileDropProps) => {\n const [isDragging, setIsDragging] = React.useState(false)\n const [files, setFiles] = React.useState<File[]>([])\n const fileUploadInputRef = React.useRef<HTMLInputElement>(null)\n\n const handleDragOver = (event: React.DragEvent<HTMLDivElement>) => {\n event.preventDefault()\n setIsDragging(true)\n }\n\n const handleDragLeave = () => setIsDragging(false)\n\n const handleDrop = (fileList: FileList | null) => {\n if (!fileList) return\n\n setIsDragging(false)\n\n const files = Array.from(fileList)\n onDrop(files)\n setFiles(files)\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (['Space', 'Enter'].includes(event.key)) {\n fileUploadInputRef.current?.click()\n }\n }\n\n const value: FileDropContextValue = { isDragging, files }\n\n return (\n <FileDropContext.Provider value={value}>\n <StyledContainer\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={(event) => {\n event.preventDefault()\n handleDrop(event.dataTransfer.files)\n }}\n onClick={() => fileUploadInputRef.current?.click()}\n role=\"button\"\n onKeyDown={handleKeyDown}\n tabIndex={0}\n {...rest}\n >\n {typeof children === 'function' ? children(value) : children}\n <input\n type=\"file\"\n ref={fileUploadInputRef}\n style={{ visibility: 'hidden' }}\n accept={accept}\n multiple={multiple}\n onChange={(event) => {\n handleDrop(event.target.files)\n }}\n />\n </StyledContainer>\n </FileDropContext.Provider>\n )\n}\n\nFileDrop.displayName = 'FileDrop'\n"],"mappings":";;;;;AAkBA,IAAM,kBAAkB,OAAO,OAAO,EACpC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAa,YAAY,EACvB,UACA,QACA,UACA,QACA,GAAG,WACgB;CACnB,MAAM,CAAC,YAAY,iBAAiB,QAAM,SAAS,KAAK;CACxD,MAAM,CAAC,OAAO,YAAY,QAAM,SAAiB,CAAC,CAAC;CACnD,MAAM,qBAAqB,QAAM,OAAyB,IAAI;CAE9D,MAAM,kBAAkB,UAA2C;EACjE,MAAM,eAAe;EACrB,cAAc,IAAI;CACpB;CAEA,MAAM,wBAAwB,cAAc,KAAK;CAEjD,MAAM,cAAc,aAA8B;EAChD,IAAI,CAAC,UAAU;EAEf,cAAc,KAAK;EAEnB,MAAM,QAAQ,MAAM,KAAK,QAAQ;EACjC,OAAO,KAAK;EACZ,SAAS,KAAK;CAChB;CAEA,MAAM,iBAAiB,UAA+C;EACpE,IAAI,CAAC,SAAS,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,GACvC,mBAAmB,SAAS,MAAM;CAEtC;CAEA,MAAM,QAA8B;EAAE;EAAY;CAAM;CAExD,OACE,oBAAC,gBAAgB,UAAjB;EAAiC;YAC/B,qBAAC,iBAAD;GACE,YAAY;GACZ,aAAa;GACb,SAAS,UAAU;IACjB,MAAM,eAAe;IACrB,WAAW,MAAM,aAAa,KAAK;GACrC;GACA,eAAe,mBAAmB,SAAS,MAAM;GACjD,MAAK;GACL,WAAW;GACX,UAAU;GACV,GAAI;aAXN,CAaG,OAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACpD,oBAAC,SAAD;IACE,MAAK;IACL,KAAK;IACL,OAAO,EAAE,YAAY,SAAS;IACtB;IACE;IACV,WAAW,UAAU;KACnB,WAAW,MAAM,OAAO,KAAK;IAC/B;GACD,CAAA,CACc;;CACO,CAAA;AAE9B;AAEA,SAAS,cAAc"}
1
+ {"version":3,"file":"FileDrop.js","names":[],"sources":["../../../src/components/file-drop/FileDrop.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { styled } from '../../styled'\nimport { FileDropContext } from './FileDrop.context'\nimport { type FileDropContextValue } from './types'\n\ninterface FileDropProps extends Omit<\n React.ComponentProps<'div'>,\n 'onDrop' | 'ref' | 'children'\n> {\n onDrop: (files: File[]) => void\n children?:\n | React.ReactNode\n | ((value: FileDropContextValue) => React.ReactNode)\n accept?: React.InputHTMLAttributes<HTMLInputElement>['accept']\n multiple?: React.InputHTMLAttributes<HTMLInputElement>['multiple']\n}\n\nconst StyledContainer = styled('div', {\n base: [\n 'flex',\n 'flex-col',\n 'gap-6',\n 'items-center',\n 'border',\n 'border-dashed',\n 'border-grey-500',\n 'px-12',\n 'py-8',\n 'rounded-md',\n 'cursor-pointer',\n '**:pointer-events-none'\n ]\n})\n\nexport const FileDrop = ({\n children,\n accept,\n multiple,\n onDrop,\n ...rest\n}: FileDropProps) => {\n const [isDragging, setIsDragging] = React.useState(false)\n const [files, setFiles] = React.useState<File[]>([])\n const fileUploadInputRef = React.useRef<HTMLInputElement>(null)\n\n const handleDragOver = (event: React.DragEvent<HTMLDivElement>) => {\n event.preventDefault()\n setIsDragging(true)\n }\n\n const handleDragLeave = () => setIsDragging(false)\n\n const handleDrop = (fileList: FileList | null) => {\n if (!fileList) return\n\n setIsDragging(false)\n\n const files = Array.from(fileList)\n onDrop(files)\n setFiles(files)\n }\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (['Space', 'Enter'].includes(event.key)) {\n fileUploadInputRef.current?.click()\n }\n }\n\n // Memoized: consumers otherwise re-render at drag-over event frequency.\n const value = React.useMemo<FileDropContextValue>(\n () => ({ isDragging, files }),\n [isDragging, files]\n )\n\n return (\n <FileDropContext value={value}>\n <StyledContainer\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={(event) => {\n event.preventDefault()\n handleDrop(event.dataTransfer.files)\n }}\n onClick={() => fileUploadInputRef.current?.click()}\n role=\"button\"\n onKeyDown={handleKeyDown}\n tabIndex={0}\n {...rest}\n >\n {typeof children === 'function' ? children(value) : children}\n <input\n type=\"file\"\n ref={fileUploadInputRef}\n style={{ visibility: 'hidden' }}\n accept={accept}\n multiple={multiple}\n onChange={(event) => {\n handleDrop(event.target.files)\n }}\n />\n </StyledContainer>\n </FileDropContext>\n )\n}\n\nFileDrop.displayName = 'FileDrop'\n"],"mappings":";;;;;AAkBA,IAAM,kBAAkB,OAAO,OAAO,EACpC,MAAM;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,EACF,CAAC;AAED,IAAa,YAAY,EACvB,UACA,QACA,UACA,QACA,GAAG,WACgB;CACnB,MAAM,CAAC,YAAY,iBAAiB,QAAM,SAAS,KAAK;CACxD,MAAM,CAAC,OAAO,YAAY,QAAM,SAAiB,CAAC,CAAC;CACnD,MAAM,qBAAqB,QAAM,OAAyB,IAAI;CAE9D,MAAM,kBAAkB,UAA2C;EACjE,MAAM,eAAe;EACrB,cAAc,IAAI;CACpB;CAEA,MAAM,wBAAwB,cAAc,KAAK;CAEjD,MAAM,cAAc,aAA8B;EAChD,IAAI,CAAC,UAAU;EAEf,cAAc,KAAK;EAEnB,MAAM,QAAQ,MAAM,KAAK,QAAQ;EACjC,OAAO,KAAK;EACZ,SAAS,KAAK;CAChB;CAEA,MAAM,iBAAiB,UAA+C;EACpE,IAAI,CAAC,SAAS,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,GACvC,mBAAmB,SAAS,MAAM;CAEtC;CAGA,MAAM,QAAQ,QAAM,eACX;EAAE;EAAY;CAAM,IAC3B,CAAC,YAAY,KAAK,CACpB;CAEA,OACE,oBAAC,iBAAD;EAAwB;YACtB,qBAAC,iBAAD;GACE,YAAY;GACZ,aAAa;GACb,SAAS,UAAU;IACjB,MAAM,eAAe;IACrB,WAAW,MAAM,aAAa,KAAK;GACrC;GACA,eAAe,mBAAmB,SAAS,MAAM;GACjD,MAAK;GACL,WAAW;GACX,UAAU;GACV,GAAI;aAXN,CAaG,OAAO,aAAa,aAAa,SAAS,KAAK,IAAI,UACpD,oBAAC,SAAD;IACE,MAAK;IACL,KAAK;IACL,OAAO,EAAE,YAAY,SAAS;IACtB;IACE;IACV,WAAW,UAAU;KACnB,WAAW,MAAM,OAAO,KAAK;IAC/B;GACD,CAAA,CACc;;CACF,CAAA;AAErB;AAEA,SAAS,cAAc"}
@@ -1,7 +1,7 @@
1
1
  import { FileDropContext } from "./FileDrop.context.js";
2
2
  import * as React$1 from "react";
3
3
  //#region src/components/file-drop/useFileDrop.ts
4
- var useFileDrop = () => React$1.useContext(FileDropContext);
4
+ var useFileDrop = () => React$1.use(FileDropContext);
5
5
  //#endregion
6
6
  export { useFileDrop };
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"useFileDrop.js","names":[],"sources":["../../../src/components/file-drop/useFileDrop.ts"],"sourcesContent":["import * as React from 'react'\n\nimport { FileDropContext } from './FileDrop.context'\nimport type { FileDropContextValue } from './types'\n\nexport const useFileDrop = (): FileDropContextValue =>\n React.useContext(FileDropContext)\n"],"mappings":";;;AAKA,IAAa,oBACX,QAAM,WAAW,eAAe"}
1
+ {"version":3,"file":"useFileDrop.js","names":[],"sources":["../../../src/components/file-drop/useFileDrop.ts"],"sourcesContent":["import * as React from 'react'\n\nimport { FileDropContext } from './FileDrop.context'\nimport type { FileDropContextValue } from './types'\n\nexport const useFileDrop = (): FileDropContextValue =>\n React.use(FileDropContext)\n"],"mappings":";;;AAKA,IAAa,oBACX,QAAM,IAAI,eAAe"}
@@ -1,5 +1,5 @@
1
1
  import { FormCustomContext } from "./useFormCustomContext.js";
2
- import "react";
2
+ import * as React$1 from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { FormProvider, useForm } from "react-hook-form";
5
5
  //#region src/components/form/Form.tsx
@@ -9,13 +9,14 @@ var Form = (props) => {
9
9
  defaultValues,
10
10
  mode: validationMode
11
11
  });
12
+ const customContextValue = React$1.useMemo(() => ({
13
+ appearance,
14
+ theme
15
+ }), [appearance, theme]);
12
16
  return /* @__PURE__ */ jsx(FormProvider, {
13
17
  ...methods,
14
- children: /* @__PURE__ */ jsx(FormCustomContext.Provider, {
15
- value: {
16
- appearance,
17
- theme
18
- },
18
+ children: /* @__PURE__ */ jsx(FormCustomContext, {
19
+ value: customContextValue,
19
20
  children: /* @__PURE__ */ jsx("form", {
20
21
  "aria-label": "form",
21
22
  onSubmit: methods.handleSubmit(onSubmit, onError),
@@ -1 +1 @@
1
- {"version":3,"file":"Form.js","names":[],"sources":["../../../src/components/form/Form.tsx"],"sourcesContent":["import * as React from 'react'\nimport type {\n DefaultValues,\n FieldValues,\n Mode,\n SubmitErrorHandler,\n SubmitHandler,\n UseFormMethods\n} from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\n\nimport {\n type FormCustomContextType,\n FormCustomContext\n} from './useFormCustomContext'\n\ntype FormProps<TFormData extends FieldValues> = Omit<\n React.HTMLAttributes<HTMLFormElement>,\n 'onSubmit' | 'onError' | 'children'\n> & {\n defaultValues?: DefaultValues<TFormData>\n validationMode?: Mode\n onSubmit: SubmitHandler<TFormData>\n onError?: SubmitErrorHandler<TFormData>\n noValidate?: boolean\n children:\n | React.ReactNode\n | ((methods: UseFormMethods<TFormData>) => React.ReactNode)\n}\n\nexport const Form = <TFormData extends FieldValues>(\n props: FormProps<TFormData> & FormCustomContextType\n) => {\n const {\n children,\n defaultValues,\n validationMode = 'onBlur',\n onSubmit,\n onError,\n appearance,\n theme,\n ...rest\n } = props\n\n const methods = useForm<TFormData>({\n defaultValues,\n mode: validationMode\n })\n\n return (\n <FormProvider {...methods}>\n <FormCustomContext.Provider value={{ appearance, theme }}>\n <form\n aria-label=\"form\"\n onSubmit={methods.handleSubmit(onSubmit, onError)}\n {...rest}\n >\n {typeof children === 'function' ? children(methods) : children}\n </form>\n </FormCustomContext.Provider>\n </FormProvider>\n )\n}\n\nForm.displayName = 'Form'\n"],"mappings":";;;;;AA8BA,IAAa,QACX,UACG;CACH,MAAM,EACJ,UACA,eACA,iBAAiB,UACjB,UACA,SACA,YACA,OACA,GAAG,SACD;CAEJ,MAAM,UAAU,QAAmB;EACjC;EACA,MAAM;CACR,CAAC;CAED,OACE,oBAAC,cAAD;EAAc,GAAI;YAChB,oBAAC,kBAAkB,UAAnB;GAA4B,OAAO;IAAE;IAAY;GAAM;aACrD,oBAAC,QAAD;IACE,cAAW;IACX,UAAU,QAAQ,aAAa,UAAU,OAAO;IAChD,GAAI;cAEH,OAAO,aAAa,aAAa,SAAS,OAAO,IAAI;GAClD,CAAA;EACoB,CAAA;CAChB,CAAA;AAElB;AAEA,KAAK,cAAc"}
1
+ {"version":3,"file":"Form.js","names":[],"sources":["../../../src/components/form/Form.tsx"],"sourcesContent":["import * as React from 'react'\nimport type {\n DefaultValues,\n FieldValues,\n Mode,\n SubmitErrorHandler,\n SubmitHandler,\n UseFormMethods\n} from 'react-hook-form'\nimport { FormProvider, useForm } from 'react-hook-form'\n\nimport {\n type FormCustomContextType,\n FormCustomContext\n} from './useFormCustomContext'\n\ntype FormProps<TFormData extends FieldValues> = Omit<\n React.HTMLAttributes<HTMLFormElement>,\n 'onSubmit' | 'onError' | 'children'\n> & {\n defaultValues?: DefaultValues<TFormData>\n validationMode?: Mode\n onSubmit: SubmitHandler<TFormData>\n onError?: SubmitErrorHandler<TFormData>\n noValidate?: boolean\n children:\n | React.ReactNode\n | ((methods: UseFormMethods<TFormData>) => React.ReactNode)\n}\n\nexport const Form = <TFormData extends FieldValues>(\n props: FormProps<TFormData> & FormCustomContextType\n) => {\n const {\n children,\n defaultValues,\n validationMode = 'onBlur',\n onSubmit,\n onError,\n appearance,\n theme,\n ...rest\n } = props\n\n const methods = useForm<TFormData>({\n defaultValues,\n mode: validationMode\n })\n\n // Memoized: the form re-renders on every RHF state change and would\n // otherwise push a fresh context value to every consumer each time.\n const customContextValue = React.useMemo(\n () => ({ appearance, theme }),\n [appearance, theme]\n )\n\n return (\n <FormProvider {...methods}>\n <FormCustomContext value={customContextValue}>\n <form\n aria-label=\"form\"\n onSubmit={methods.handleSubmit(onSubmit, onError)}\n {...rest}\n >\n {typeof children === 'function' ? children(methods) : children}\n </form>\n </FormCustomContext>\n </FormProvider>\n )\n}\n\nForm.displayName = 'Form'\n"],"mappings":";;;;;AA8BA,IAAa,QACX,UACG;CACH,MAAM,EACJ,UACA,eACA,iBAAiB,UACjB,UACA,SACA,YACA,OACA,GAAG,SACD;CAEJ,MAAM,UAAU,QAAmB;EACjC;EACA,MAAM;CACR,CAAC;CAID,MAAM,qBAAqB,QAAM,eACxB;EAAE;EAAY;CAAM,IAC3B,CAAC,YAAY,KAAK,CACpB;CAEA,OACE,oBAAC,cAAD;EAAc,GAAI;YAChB,oBAAC,mBAAD;GAAmB,OAAO;aACxB,oBAAC,QAAD;IACE,cAAW;IACX,UAAU,QAAQ,aAAa,UAAU,OAAO;IAChD,GAAI;cAEH,OAAO,aAAa,aAAa,SAAS,OAAO,IAAI;GAClD,CAAA;EACW,CAAA;CACP,CAAA;AAElB;AAEA,KAAK,cAAc"}