@rebasepro/ui 0.24.0 → 0.24.1-canary.gcb918fc

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 (241) hide show
  1. package/dist/components/Alert.d.ts +6 -0
  2. package/dist/components/Alert.es.js +82 -0
  3. package/dist/components/Alert.es.js.map +1 -0
  4. package/dist/components/Autocomplete.es.js +53 -0
  5. package/dist/components/Autocomplete.es.js.map +1 -0
  6. package/dist/components/Avatar.d.ts +3 -1
  7. package/dist/components/Avatar.es.js +37 -0
  8. package/dist/components/Avatar.es.js.map +1 -0
  9. package/dist/components/Badge.es.js +27 -0
  10. package/dist/components/Badge.es.js.map +1 -0
  11. package/dist/components/BooleanSwitch.es.js +75 -0
  12. package/dist/components/BooleanSwitch.es.js.map +1 -0
  13. package/dist/components/BooleanSwitchWithLabel.es.js +55 -0
  14. package/dist/components/BooleanSwitchWithLabel.es.js.map +1 -0
  15. package/dist/components/Button.es.js +58 -0
  16. package/dist/components/Button.es.js.map +1 -0
  17. package/dist/components/Card.es.js +26 -0
  18. package/dist/components/Card.es.js.map +1 -0
  19. package/dist/components/CenteredView.es.js +23 -0
  20. package/dist/components/CenteredView.es.js.map +1 -0
  21. package/dist/components/Checkbox.es.js +62 -0
  22. package/dist/components/Checkbox.es.js.map +1 -0
  23. package/dist/components/Chip.es.js +72 -0
  24. package/dist/components/Chip.es.js.map +1 -0
  25. package/dist/components/CircularProgress.es.js +28 -0
  26. package/dist/components/CircularProgress.es.js.map +1 -0
  27. package/dist/components/CircularProgressCenter.es.js +30 -0
  28. package/dist/components/CircularProgressCenter.es.js.map +1 -0
  29. package/dist/components/Collapse.es.js +57 -0
  30. package/dist/components/Collapse.es.js.map +1 -0
  31. package/dist/components/ColorPicker.es.js +89 -0
  32. package/dist/components/ColorPicker.es.js.map +1 -0
  33. package/dist/components/Container.es.js +31 -0
  34. package/dist/components/Container.es.js.map +1 -0
  35. package/dist/components/DateTimeField.d.ts +11 -1
  36. package/dist/components/DateTimeField.es.js +253 -0
  37. package/dist/components/DateTimeField.es.js.map +1 -0
  38. package/dist/components/DebouncedTextField.es.js +93 -0
  39. package/dist/components/DebouncedTextField.es.js.map +1 -0
  40. package/dist/components/Dialog.es.js +98 -0
  41. package/dist/components/Dialog.es.js.map +1 -0
  42. package/dist/components/DialogActions.es.js +15 -0
  43. package/dist/components/DialogActions.es.js.map +1 -0
  44. package/dist/components/DialogContent.es.js +18 -0
  45. package/dist/components/DialogContent.es.js.map +1 -0
  46. package/dist/components/DialogTitle.es.js +26 -0
  47. package/dist/components/DialogTitle.es.js.map +1 -0
  48. package/dist/components/ErrorBoundary.es.js +158 -0
  49. package/dist/components/ErrorBoundary.es.js.map +1 -0
  50. package/dist/components/ExpandablePanel.es.js +91 -0
  51. package/dist/components/ExpandablePanel.es.js.map +1 -0
  52. package/dist/components/FileUpload.es.js +58 -0
  53. package/dist/components/FileUpload.es.js.map +1 -0
  54. package/dist/components/FilterChip.es.js +31 -0
  55. package/dist/components/FilterChip.es.js.map +1 -0
  56. package/dist/components/IconButton.es.js +52 -0
  57. package/dist/components/IconButton.es.js.map +1 -0
  58. package/dist/components/InfoLabel.es.js +18 -0
  59. package/dist/components/InfoLabel.es.js.map +1 -0
  60. package/dist/components/InputLabel.es.js +27 -0
  61. package/dist/components/InputLabel.es.js.map +1 -0
  62. package/dist/components/Label.es.js +18 -0
  63. package/dist/components/Label.es.js.map +1 -0
  64. package/dist/components/LoadingButton.es.js +21 -0
  65. package/dist/components/LoadingButton.es.js.map +1 -0
  66. package/dist/components/Markdown.es.js +88 -0
  67. package/dist/components/Markdown.es.js.map +1 -0
  68. package/dist/components/Menu.es.js +46 -0
  69. package/dist/components/Menu.es.js.map +1 -0
  70. package/dist/components/Menubar.es.js +142 -0
  71. package/dist/components/Menubar.es.js.map +1 -0
  72. package/dist/components/MultiSelect.d.ts +1 -7
  73. package/dist/components/MultiSelect.es.js +271 -0
  74. package/dist/components/MultiSelect.es.js.map +1 -0
  75. package/dist/components/Paper.es.js +16 -0
  76. package/dist/components/Paper.es.js.map +1 -0
  77. package/dist/components/Popover.es.js +113 -0
  78. package/dist/components/Popover.es.js.map +1 -0
  79. package/dist/components/RadioGroup.es.js +30 -0
  80. package/dist/components/RadioGroup.es.js.map +1 -0
  81. package/dist/components/ResizablePanels.d.ts +3 -1
  82. package/dist/components/ResizablePanels.es.js +137 -0
  83. package/dist/components/ResizablePanels.es.js.map +1 -0
  84. package/dist/components/SearchBar.es.js +82 -0
  85. package/dist/components/SearchBar.es.js.map +1 -0
  86. package/dist/components/Select.d.ts +8 -1
  87. package/dist/components/Select.es.js +300 -0
  88. package/dist/components/Select.es.js.map +1 -0
  89. package/dist/components/Separator.es.js +20 -0
  90. package/dist/components/Separator.es.js.map +1 -0
  91. package/dist/components/Sheet.es.js +73 -0
  92. package/dist/components/Sheet.es.js.map +1 -0
  93. package/dist/components/Skeleton.es.js +33 -0
  94. package/dist/components/Skeleton.es.js.map +1 -0
  95. package/dist/components/Slider.es.js +56 -0
  96. package/dist/components/Slider.es.js.map +1 -0
  97. package/dist/components/Table.d.ts +18 -3
  98. package/dist/components/Table.es.js +69 -0
  99. package/dist/components/Table.es.js.map +1 -0
  100. package/dist/components/Tabs.es.js +101 -0
  101. package/dist/components/Tabs.es.js.map +1 -0
  102. package/dist/components/TextField.d.ts +0 -8
  103. package/dist/components/TextField.es.js +111 -0
  104. package/dist/components/TextField.es.js.map +1 -0
  105. package/dist/components/TextareaAutosize.es.js +187 -0
  106. package/dist/components/TextareaAutosize.es.js.map +1 -0
  107. package/dist/components/ToggleButtonGroup.d.ts +6 -1
  108. package/dist/components/ToggleButtonGroup.es.js +35 -0
  109. package/dist/components/ToggleButtonGroup.es.js.map +1 -0
  110. package/dist/components/Tooltip.d.ts +24 -0
  111. package/dist/components/Tooltip.es.js +165 -0
  112. package/dist/components/Tooltip.es.js.map +1 -0
  113. package/dist/components/Typography.es.js +85 -0
  114. package/dist/components/Typography.es.js.map +1 -0
  115. package/dist/components/VirtualTable/VirtualTable.es.js +516 -0
  116. package/dist/components/VirtualTable/VirtualTable.es.js.map +1 -0
  117. package/dist/components/VirtualTable/VirtualTableCell.d.ts +1 -1
  118. package/dist/components/VirtualTable/VirtualTableCell.es.js +40 -0
  119. package/dist/components/VirtualTable/VirtualTableCell.es.js.map +1 -0
  120. package/dist/components/VirtualTable/VirtualTableHeader.es.js +209 -0
  121. package/dist/components/VirtualTable/VirtualTableHeader.es.js.map +1 -0
  122. package/dist/components/VirtualTable/VirtualTableHeaderRow.es.js +166 -0
  123. package/dist/components/VirtualTable/VirtualTableHeaderRow.es.js.map +1 -0
  124. package/dist/components/VirtualTable/VirtualTableProps.d.ts +13 -2
  125. package/dist/components/VirtualTable/VirtualTableRow.d.ts +6 -7
  126. package/dist/components/VirtualTable/VirtualTableRow.es.js +41 -0
  127. package/dist/components/VirtualTable/VirtualTableRow.es.js.map +1 -0
  128. package/dist/components/VirtualTable/fields/VirtualTableDateField.d.ts +2 -1
  129. package/dist/components/VirtualTable/fields/VirtualTableDateField.es.js +71 -0
  130. package/dist/components/VirtualTable/fields/VirtualTableDateField.es.js.map +1 -0
  131. package/dist/components/VirtualTable/fields/VirtualTableInput.es.js +73 -0
  132. package/dist/components/VirtualTable/fields/VirtualTableInput.es.js.map +1 -0
  133. package/dist/components/VirtualTable/fields/VirtualTableNumberInput.es.js +47 -0
  134. package/dist/components/VirtualTable/fields/VirtualTableNumberInput.es.js.map +1 -0
  135. package/dist/components/VirtualTable/fields/VirtualTableSelect.es.js +83 -0
  136. package/dist/components/VirtualTable/fields/VirtualTableSelect.es.js.map +1 -0
  137. package/dist/components/VirtualTable/fields/VirtualTableSwitch.es.js +22 -0
  138. package/dist/components/VirtualTable/fields/VirtualTableSwitch.es.js.map +1 -0
  139. package/dist/components/VirtualTable/selection/SelectionContext.es.js +23 -0
  140. package/dist/components/VirtualTable/selection/SelectionContext.es.js.map +1 -0
  141. package/dist/components/VirtualTable/selection/SelectionStore.es.js +43 -0
  142. package/dist/components/VirtualTable/selection/SelectionStore.es.js.map +1 -0
  143. package/dist/components/VirtualTable/types.d.ts +1 -1
  144. package/dist/components/common/SelectInputLabel.es.js +28 -0
  145. package/dist/components/common/SelectInputLabel.es.js.map +1 -0
  146. package/dist/components/index.es.js +64 -0
  147. package/dist/hooks/PortalContainerContext.es.js +40 -0
  148. package/dist/hooks/PortalContainerContext.es.js.map +1 -0
  149. package/dist/hooks/UiLabelsContext.d.ts +63 -0
  150. package/dist/hooks/UiLabelsContext.es.js +59 -0
  151. package/dist/hooks/UiLabelsContext.es.js.map +1 -0
  152. package/dist/hooks/useDebounceCallback.es.js +15 -0
  153. package/dist/hooks/useDebounceCallback.es.js.map +1 -0
  154. package/dist/hooks/useDebounceValue.es.js +19 -0
  155. package/dist/hooks/useDebounceValue.es.js.map +1 -0
  156. package/dist/hooks/useDebouncedCallback.es.js +36 -0
  157. package/dist/hooks/useDebouncedCallback.es.js.map +1 -0
  158. package/dist/hooks/useInjectStyles.es.js +27 -0
  159. package/dist/hooks/useInjectStyles.es.js.map +1 -0
  160. package/dist/hooks/useIsDarkMode.es.js +61 -0
  161. package/dist/hooks/useIsDarkMode.es.js.map +1 -0
  162. package/dist/hooks/useModalFocus.es.js +81 -0
  163. package/dist/hooks/useModalFocus.es.js.map +1 -0
  164. package/dist/hooks/useOutsideAlerter.es.js +41 -0
  165. package/dist/hooks/useOutsideAlerter.es.js.map +1 -0
  166. package/dist/hooks/useRestoreInterruptedFocus.es.js +61 -0
  167. package/dist/hooks/useRestoreInterruptedFocus.es.js.map +1 -0
  168. package/dist/icons/GitHubIcon.es.js +23 -0
  169. package/dist/icons/GitHubIcon.es.js.map +1 -0
  170. package/dist/icons/HandleIcon.es.js +60 -0
  171. package/dist/icons/HandleIcon.es.js.map +1 -0
  172. package/dist/icons/Icon.es.js +25 -0
  173. package/dist/icons/Icon.es.js.map +1 -0
  174. package/dist/icons/LucideIconByName.d.ts +12 -9
  175. package/dist/icons/LucideIconByName.es.js +83 -0
  176. package/dist/icons/LucideIconByName.es.js.map +1 -0
  177. package/dist/icons/cool_icon_keys.es.js +55 -0
  178. package/dist/icons/cool_icon_keys.es.js.map +1 -0
  179. package/dist/icons/icon_keys.es.js +1941 -0
  180. package/dist/icons/icon_keys.es.js.map +1 -0
  181. package/dist/icons/index.d.ts +4 -3
  182. package/dist/icons/index.es.js +8 -0
  183. package/dist/icons/lucide_icon_map.d.ts +12 -0
  184. package/dist/icons/lucide_icon_map.es.js +2 -0
  185. package/dist/index.d.ts +2 -0
  186. package/dist/index.es.js +87 -9563
  187. package/dist/styles.es.js +158 -0
  188. package/dist/styles.es.js.map +1 -0
  189. package/dist/util/chip_colors.es.js +290 -0
  190. package/dist/util/chip_colors.es.js.map +1 -0
  191. package/dist/util/cls.es.js +10 -0
  192. package/dist/util/cls.es.js.map +1 -0
  193. package/dist/util/debounce.es.js +22 -0
  194. package/dist/util/debounce.es.js.map +1 -0
  195. package/dist/util/hash.es.js +16 -0
  196. package/dist/util/hash.es.js.map +1 -0
  197. package/dist/util/keys.es.js +37 -0
  198. package/dist/util/keys.es.js.map +1 -0
  199. package/dist/util/lazy_chunk.es.js +96 -0
  200. package/dist/util/lazy_chunk.es.js.map +1 -0
  201. package/dist/views/CardView.d.ts +26 -2
  202. package/dist/views/CardView.es.js +435 -0
  203. package/dist/views/CardView.es.js.map +1 -0
  204. package/dist/views/CollectionView/CollectionCardView.es.js +179 -0
  205. package/dist/views/CollectionView/CollectionCardView.es.js.map +1 -0
  206. package/dist/views/CollectionView/CollectionKanbanView.es.js +172 -0
  207. package/dist/views/CollectionView/CollectionKanbanView.es.js.map +1 -0
  208. package/dist/views/CollectionView/CollectionListView.es.js +156 -0
  209. package/dist/views/CollectionView/CollectionListView.es.js.map +1 -0
  210. package/dist/views/CollectionView/CollectionTableView.es.js +149 -0
  211. package/dist/views/CollectionView/CollectionTableView.es.js.map +1 -0
  212. package/dist/views/CollectionView/CollectionView.es.js +197 -0
  213. package/dist/views/CollectionView/CollectionView.es.js.map +1 -0
  214. package/dist/views/CollectionView/CollectionViewToolbar.es.js +155 -0
  215. package/dist/views/CollectionView/CollectionViewToolbar.es.js.map +1 -0
  216. package/dist/views/CollectionView/DefaultCellRenderer.es.js +302 -0
  217. package/dist/views/CollectionView/DefaultCellRenderer.es.js.map +1 -0
  218. package/dist/views/CollectionView/resolveTitleProperty.es.js +56 -0
  219. package/dist/views/CollectionView/resolveTitleProperty.es.js.map +1 -0
  220. package/dist/views/CollectionView/utils.es.js +19 -0
  221. package/dist/views/CollectionView/utils.es.js.map +1 -0
  222. package/dist/views/Kanban/Board.es.js +237 -0
  223. package/dist/views/Kanban/Board.es.js.map +1 -0
  224. package/dist/views/Kanban/BoardColumn.es.js +81 -0
  225. package/dist/views/Kanban/BoardColumn.es.js.map +1 -0
  226. package/dist/views/Kanban/BoardColumnTitle.es.js +27 -0
  227. package/dist/views/Kanban/BoardColumnTitle.es.js.map +1 -0
  228. package/dist/views/Kanban/BoardSortableList.es.js +98 -0
  229. package/dist/views/Kanban/BoardSortableList.es.js.map +1 -0
  230. package/dist/views/Kanban/placement.es.js +27 -0
  231. package/dist/views/Kanban/placement.es.js.map +1 -0
  232. package/dist/views/KanbanView.es.js +11 -0
  233. package/dist/views/KanbanView.es.js.map +1 -0
  234. package/dist/views/ListView.d.ts +15 -2
  235. package/dist/views/ListView.es.js +245 -0
  236. package/dist/views/ListView.es.js.map +1 -0
  237. package/dist/views/useScrollParentRestoration.d.ts +8 -1
  238. package/dist/views/useScrollParentRestoration.es.js +75 -0
  239. package/dist/views/useScrollParentRestoration.es.js.map +1 -0
  240. package/package.json +2 -2
  241. package/dist/index.es.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import { createContext, useContext, useMemo } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/hooks/UiLabelsContext.tsx
5
+ /** The English labels: exactly the strings the kit rendered before it took any. */
6
+ var defaultUiLabels = {
7
+ errorLoadingData: (message) => `Error loading data: ${message}`,
8
+ noEntriesFound: "No entries found",
9
+ allEntriesLoaded: (count) => `All ${count} entries loaded`,
10
+ error: "Error",
11
+ search: "Search",
12
+ clearSearch: "Clear search",
13
+ select: "Select",
14
+ openTimePicker: "Open time picker",
15
+ relativeTime: {
16
+ justNow: "just now",
17
+ inAMoment: "in a moment",
18
+ minutesAgo: (count) => `${count}m ago`,
19
+ inMinutes: (count) => `in ${count}m`,
20
+ hoursAgo: (count) => `${count}h ago`,
21
+ inHours: (count) => `in ${count}h`,
22
+ daysAgo: (count) => `${count}d ago`,
23
+ inDays: (count) => `in ${count}d`
24
+ }
25
+ };
26
+ var UiLabelsContext = createContext(defaultUiLabels);
27
+ /**
28
+ * Gives the kit's own words in another language. `@rebasepro/app` mounts one
29
+ * filled from its translations; without a provider the kit speaks English.
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * <UiLabelsProvider labels={{ noEntriesFound: "Nessun elemento" }}>
34
+ * <ListView …/>
35
+ * </UiLabelsProvider>
36
+ * ```
37
+ */
38
+ function UiLabelsProvider({ labels, children }) {
39
+ const value = useMemo(() => ({
40
+ ...defaultUiLabels,
41
+ ...labels,
42
+ relativeTime: {
43
+ ...defaultUiLabels.relativeTime,
44
+ ...labels.relativeTime
45
+ }
46
+ }), [labels]);
47
+ return /* @__PURE__ */ jsx(UiLabelsContext.Provider, {
48
+ value,
49
+ children
50
+ });
51
+ }
52
+ /** The labels in effect: the nearest {@link UiLabelsProvider}'s, or English. */
53
+ function useUiLabels() {
54
+ return useContext(UiLabelsContext);
55
+ }
56
+ //#endregion
57
+ export { UiLabelsProvider, defaultUiLabels, useUiLabels };
58
+
59
+ //# sourceMappingURL=UiLabelsContext.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UiLabelsContext.es.js","names":[],"sources":["../../src/hooks/UiLabelsContext.tsx"],"sourcesContent":["\"use client\";\nimport React, { createContext, useContext, useMemo } from \"react\";\n\n/**\n * The words the kit itself puts on screen: the list and card views' notices,\n * the table's error title, the search bar's names, and the relative-time\n * phrases of `formatRelativeTime` (`@rebasepro/utils`).\n *\n * A label that carries a value is a function of it, so a translation can\n * choose its own plural form.\n */\nexport interface UiLabels {\n /** A list or card view that could not load its first page: \"Error loading data: <message>\". */\n errorLoadingData: (message: string) => string;\n /** A list or card view with no rows. */\n noEntriesFound: string;\n /** Under the last row of a list or card view: \"All <count> entries loaded\". */\n allEntriesLoaded: (count: number) => string;\n /** The title of a table that could not load its rows. */\n error: string;\n /** The search bar's name, and its placeholder when none is given. */\n search: string;\n /** The search bar's clear button. */\n clearSearch: string;\n /** A row's or card's selection checkbox in the collection views. */\n select: string;\n /** The button that opens a time-of-day field's picker (`DateTimeField mode=\"time\"`). */\n openTimePicker: string;\n /** The phrases `formatRelativeTime` (`@rebasepro/utils`) takes as `labels`. */\n relativeTime: UiRelativeTimeLabels;\n}\n\n/** Relative-time phrases, as `formatRelativeTime`'s `labels` option takes them. */\nexport interface UiRelativeTimeLabels {\n justNow: string;\n inAMoment: string;\n minutesAgo: (count: number) => string;\n inMinutes: (count: number) => string;\n hoursAgo: (count: number) => string;\n inHours: (count: number) => string;\n daysAgo: (count: number) => string;\n inDays: (count: number) => string;\n}\n\n/** The English labels: exactly the strings the kit rendered before it took any. */\nexport const defaultUiLabels: UiLabels = {\n errorLoadingData: (message) => `Error loading data: ${message}`,\n noEntriesFound: \"No entries found\",\n allEntriesLoaded: (count) => `All ${count} entries loaded`,\n error: \"Error\",\n search: \"Search\",\n clearSearch: \"Clear search\",\n select: \"Select\",\n openTimePicker: \"Open time picker\",\n relativeTime: {\n justNow: \"just now\",\n inAMoment: \"in a moment\",\n minutesAgo: (count) => `${count}m ago`,\n inMinutes: (count) => `in ${count}m`,\n hoursAgo: (count) => `${count}h ago`,\n inHours: (count) => `in ${count}h`,\n daysAgo: (count) => `${count}d ago`,\n inDays: (count) => `in ${count}d`\n }\n};\n\nconst UiLabelsContext = createContext<UiLabels>(defaultUiLabels);\n\nexport interface UiLabelsProviderProps {\n /** The labels to use; any left out keep their English default. */\n labels: Partial<Omit<UiLabels, \"relativeTime\">> & { relativeTime?: Partial<UiRelativeTimeLabels> };\n children: React.ReactNode;\n}\n\n/**\n * Gives the kit's own words in another language. `@rebasepro/app` mounts one\n * filled from its translations; without a provider the kit speaks English.\n *\n * @example\n * ```tsx\n * <UiLabelsProvider labels={{ noEntriesFound: \"Nessun elemento\" }}>\n * <ListView …/>\n * </UiLabelsProvider>\n * ```\n */\nexport function UiLabelsProvider({ labels, children }: UiLabelsProviderProps) {\n const value = useMemo((): UiLabels => ({\n ...defaultUiLabels,\n ...labels,\n relativeTime: { ...defaultUiLabels.relativeTime, ...labels.relativeTime }\n }), [labels]);\n return <UiLabelsContext.Provider value={value}>{children}</UiLabelsContext.Provider>;\n}\n\n/** The labels in effect: the nearest {@link UiLabelsProvider}'s, or English. */\nexport function useUiLabels(): UiLabels {\n return useContext(UiLabelsContext);\n}\n"],"mappings":";;;;;AA6CA,IAAa,kBAA4B;CACrC,mBAAmB,YAAY,uBAAuB;CACtD,gBAAgB;CAChB,mBAAmB,UAAU,OAAO,MAAM;CAC1C,OAAO;CACP,QAAQ;CACR,aAAa;CACb,QAAQ;CACR,gBAAgB;CAChB,cAAc;EACV,SAAS;EACT,WAAW;EACX,aAAa,UAAU,GAAG,MAAM;EAChC,YAAY,UAAU,MAAM,MAAM;EAClC,WAAW,UAAU,GAAG,MAAM;EAC9B,UAAU,UAAU,MAAM,MAAM;EAChC,UAAU,UAAU,GAAG,MAAM;EAC7B,SAAS,UAAU,MAAM,MAAM;CACnC;AACJ;AAEA,IAAM,kBAAkB,cAAwB,eAAe;;;;;;;;;;;;AAmB/D,SAAgB,iBAAiB,EAAE,QAAQ,YAAmC;CAC1E,MAAM,QAAQ,eAAyB;EACnC,GAAG;EACH,GAAG;EACH,cAAc;GAAE,GAAG,gBAAgB;GAAc,GAAG,OAAO;EAAa;CAC5E,IAAI,CAAC,MAAM,CAAC;CACZ,OAAO,oBAAC,gBAAgB,UAAjB;EAAiC;EAAQ;CAAmC,CAAA;AACvF;;AAGA,SAAgB,cAAwB;CACpC,OAAO,WAAW,eAAe;AACrC"}
@@ -0,0 +1,15 @@
1
+ import { useCallback, useRef } from "react";
2
+ //#region src/hooks/useDebounceCallback.tsx
3
+ function useDebounceCallback(callback, delay) {
4
+ const timeoutRef = useRef(null);
5
+ return useCallback((...args) => {
6
+ if (timeoutRef.current !== null) clearTimeout(timeoutRef.current);
7
+ timeoutRef.current = window.setTimeout(() => {
8
+ callback?.(...args);
9
+ }, delay ?? 200);
10
+ }, [callback, delay]);
11
+ }
12
+ //#endregion
13
+ export { useDebounceCallback };
14
+
15
+ //# sourceMappingURL=useDebounceCallback.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebounceCallback.es.js","names":[],"sources":["../../src/hooks/useDebounceCallback.tsx"],"sourcesContent":["import { useCallback, useRef } from \"react\";\n\n\nexport function useDebounceCallback<T extends (...args: any[]) => unknown>(\n callback?: T,\n delay?: number\n): T {\n const timeoutRef = useRef<number | null>(null);\n\n const debouncedCallback = useCallback((...args: Parameters<T>) => {\n if (timeoutRef.current !== null) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = window.setTimeout(() => {\n callback?.(...args);\n }, delay ?? 200);\n }, [callback, delay]);\n\n return debouncedCallback as T;\n}\n"],"mappings":";;AAGA,SAAgB,oBACZ,UACA,OACC;CACD,MAAM,aAAa,OAAsB,IAAI;CAY7C,OAV0B,aAAa,GAAG,SAAwB;EAC9D,IAAI,WAAW,YAAY,MACvB,aAAa,WAAW,OAAO;EAGnC,WAAW,UAAU,OAAO,iBAAiB;GACzC,WAAW,GAAG,IAAI;EACtB,GAAG,SAAS,GAAG;CACnB,GAAG,CAAC,UAAU,KAAK,CAEZ;AACX"}
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { useEffect, useState } from "react";
3
+ //#region src/hooks/useDebounceValue.tsx
4
+ function useDebounceValue(value, delay = 300) {
5
+ const [debouncedValue, setDebouncedValue] = useState(value);
6
+ useEffect(() => {
7
+ const handler = setTimeout(() => {
8
+ setDebouncedValue(value);
9
+ }, delay);
10
+ return () => {
11
+ clearTimeout(handler);
12
+ };
13
+ }, [value, delay]);
14
+ return debouncedValue;
15
+ }
16
+ //#endregion
17
+ export { useDebounceValue };
18
+
19
+ //# sourceMappingURL=useDebounceValue.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebounceValue.es.js","names":[],"sources":["../../src/hooks/useDebounceValue.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nexport function useDebounceValue<T>(value: T, delay = 300): T {\n // State and setters for debounced value\n const [debouncedValue, setDebouncedValue] = useState(value);\n useEffect(\n () => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n return () => {\n clearTimeout(handler);\n };\n },\n [value, delay] // Only re-call effect if value or delay changes\n );\n return debouncedValue;\n}\n"],"mappings":";;;AAIA,SAAgB,iBAAoB,OAAU,QAAQ,KAAQ;CAE1D,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,KAAK;CAC1D,gBACU;EACF,MAAM,UAAU,iBAAiB;GAC7B,kBAAkB,KAAK;EAC3B,GAAG,KAAK;EACR,aAAa;GACT,aAAa,OAAO;EACxB;CACJ,GACA,CAAC,OAAO,KAAK,CACjB;CACA,OAAO;AACX"}
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ //#region src/hooks/useDebouncedCallback.ts
3
+ function useDebouncedCallback(value, callback, immediate, timeoutMs = 300) {
4
+ const pendingUpdate = React.useRef(false);
5
+ const callbackRef = React.useRef(callback);
6
+ React.useEffect(() => {
7
+ callbackRef.current = callback;
8
+ }, [callback]);
9
+ const performUpdate = React.useCallback(() => {
10
+ callbackRef.current();
11
+ pendingUpdate.current = false;
12
+ }, []);
13
+ const handlerRef = React.useRef(void 0);
14
+ React.useEffect(() => {
15
+ if (immediate) {
16
+ clearTimeout(handlerRef.current);
17
+ if (pendingUpdate.current) performUpdate();
18
+ return;
19
+ }
20
+ pendingUpdate.current = true;
21
+ clearTimeout(handlerRef.current);
22
+ handlerRef.current = setTimeout(performUpdate, timeoutMs);
23
+ return () => {
24
+ if (immediate) performUpdate();
25
+ };
26
+ }, [
27
+ immediate,
28
+ value,
29
+ performUpdate,
30
+ timeoutMs
31
+ ]);
32
+ }
33
+ //#endregion
34
+ export { useDebouncedCallback };
35
+
36
+ //# sourceMappingURL=useDebouncedCallback.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebouncedCallback.es.js","names":[],"sources":["../../src/hooks/useDebouncedCallback.ts"],"sourcesContent":["import React from \"react\";\n\nexport function useDebouncedCallback<T>(value: T, callback: () => void, immediate: boolean, timeoutMs = 300) {\n\n const pendingUpdate = React.useRef(false);\n\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n const performUpdate = React.useCallback(() => {\n callbackRef.current();\n pendingUpdate.current = false;\n }, []);\n\n const handlerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n\n React.useEffect(\n () => {\n if (immediate) {\n clearTimeout(handlerRef.current);\n if (pendingUpdate.current) {\n performUpdate();\n }\n return;\n }\n\n pendingUpdate.current = true;\n clearTimeout(handlerRef.current);\n handlerRef.current = setTimeout(performUpdate, timeoutMs);\n return () => {\n if (immediate)\n performUpdate();\n };\n },\n [immediate, value, performUpdate, timeoutMs]\n );\n}\n"],"mappings":";;AAEA,SAAgB,qBAAwB,OAAU,UAAsB,WAAoB,YAAY,KAAK;CAEzG,MAAM,gBAAgB,MAAM,OAAO,KAAK;CAExC,MAAM,cAAc,MAAM,OAAO,QAAQ;CACzC,MAAM,gBAAgB;EAClB,YAAY,UAAU;CAC1B,GAAG,CAAC,QAAQ,CAAC;CAEb,MAAM,gBAAgB,MAAM,kBAAkB;EAC1C,YAAY,QAAQ;EACpB,cAAc,UAAU;CAC5B,GAAG,CAAC,CAAC;CAEL,MAAM,aAAa,MAAM,OAAkD,KAAA,CAAS;CAEpF,MAAM,gBACI;EACF,IAAI,WAAW;GACX,aAAa,WAAW,OAAO;GAC/B,IAAI,cAAc,SACd,cAAc;GAElB;EACJ;EAEA,cAAc,UAAU;EACxB,aAAa,WAAW,OAAO;EAC/B,WAAW,UAAU,WAAW,eAAe,SAAS;EACxD,aAAa;GACT,IAAI,WACA,cAAc;EACtB;CACJ,GACA;EAAC;EAAW;EAAO;EAAe;CAAS,CAC/C;AACJ"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { usePortalContainer } from "./PortalContainerContext.es.js";
3
+ import { useEffect } from "react";
4
+ //#region src/hooks/useInjectStyles.tsx
5
+ /**
6
+ * Use this hook to create a `<style>` element and inject it into the DOM.
7
+ * It checks if the style already exists, and if it does, it does not inject it again.
8
+ * @param key
9
+ * @param styles
10
+ */
11
+ function useInjectStyles(key, styles) {
12
+ const portalContainer = usePortalContainer();
13
+ useEffect(() => {
14
+ if (typeof document === "undefined") return;
15
+ const targetContainer = portalContainer ?? document.head;
16
+ if (!targetContainer.querySelector?.(`#${key}`)) {
17
+ const style = document.createElement("style");
18
+ style.id = key;
19
+ style.innerHTML = styles;
20
+ (targetContainer || document.head).appendChild(style);
21
+ }
22
+ }, []);
23
+ }
24
+ //#endregion
25
+ export { useInjectStyles };
26
+
27
+ //# sourceMappingURL=useInjectStyles.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInjectStyles.es.js","names":[],"sources":["../../src/hooks/useInjectStyles.tsx"],"sourcesContent":["\"use client\";\nimport { useEffect } from \"react\";\nimport { usePortalContainer } from \"./PortalContainerContext\";\n\n/**\n * Use this hook to create a `<style>` element and inject it into the DOM.\n * It checks if the style already exists, and if it does, it does not inject it again.\n * @param key\n * @param styles\n */\nexport function useInjectStyles(key: string, styles: string) {\n\n const portalContainer = usePortalContainer();\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n\n const targetContainer: HTMLElement | null = portalContainer ?? document.head;\n\n // Try to find an existing style element within the target container first\n const existingStyle = (targetContainer as HTMLElement).querySelector?.(`#${key}`) as HTMLStyleElement | null;\n\n if (!existingStyle) {\n const style = document.createElement(\"style\");\n style.id = key;\n style.innerHTML = styles;\n (targetContainer || document.head).appendChild(style);\n }\n }, []);\n\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAgB,gBAAgB,KAAa,QAAgB;CAEzD,MAAM,kBAAkB,mBAAmB;CAE3C,gBAAgB;EACZ,IAAI,OAAO,aAAa,aAAa;EAErC,MAAM,kBAAsC,mBAAmB,SAAS;EAKxE,IAAI,CAFmB,gBAAgC,gBAAgB,IAAI,KAAK,GAE5D;GAChB,MAAM,QAAQ,SAAS,cAAc,OAAO;GAC5C,MAAM,KAAK;GACX,MAAM,YAAY;GAClB,CAAC,mBAAmB,SAAS,KAAA,CAAM,YAAY,KAAK;EACxD;CACJ,GAAG,CAAC,CAAC;AAET"}
@@ -0,0 +1,61 @@
1
+ import { useSyncExternalStore } from "react";
2
+ //#region src/hooks/useIsDarkMode.ts
3
+ /**
4
+ * Whether the document is in dark mode right now, and re-rendered when that
5
+ * changes.
6
+ *
7
+ * The theme is a class on `<html>` (`dark`, set by the panel's mode
8
+ * controller) or a `data-theme` attribute (the marketing site). Components
9
+ * that pick colours in JS rather than through CSS variables — `Chip` derives
10
+ * its ink per theme — used to read the class once at render and never again,
11
+ * so a theme switch left every chip on screen wearing the other theme's ink
12
+ * until something else happened to re-render it. Subscribing through a
13
+ * `MutationObserver` on the root's attributes makes the read live.
14
+ */
15
+ function useIsDarkMode() {
16
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
17
+ }
18
+ function getSnapshot() {
19
+ if (typeof document === "undefined") return false;
20
+ const root = document.documentElement;
21
+ return root.classList.contains("dark") || root.getAttribute("data-theme") === "dark";
22
+ }
23
+ function getServerSnapshot() {
24
+ return false;
25
+ }
26
+ /**
27
+ * Every subscriber shares one observer of `<html>`.
28
+ *
29
+ * `Chip` subscribes, and a table can mount hundreds of chips; an observer per
30
+ * subscriber meant hundreds of observers on one element, rebuilt on every
31
+ * virtualised scroll step. The observer is created with the first subscriber
32
+ * and disconnected with the last. Entries are per subscription, not per
33
+ * callback, so one callback subscribed twice still needs two unsubscribes.
34
+ */
35
+ var subscribers = /* @__PURE__ */ new Set();
36
+ var observer;
37
+ function subscribe(onChange) {
38
+ if (typeof document === "undefined" || typeof MutationObserver === "undefined") return () => void 0;
39
+ const entry = { onChange };
40
+ subscribers.add(entry);
41
+ if (!observer) {
42
+ observer = new MutationObserver(() => {
43
+ for (const subscriber of [...subscribers]) subscriber.onChange();
44
+ });
45
+ observer.observe(document.documentElement, {
46
+ attributes: true,
47
+ attributeFilter: ["class", "data-theme"]
48
+ });
49
+ }
50
+ return () => {
51
+ subscribers.delete(entry);
52
+ if (subscribers.size === 0 && observer) {
53
+ observer.disconnect();
54
+ observer = void 0;
55
+ }
56
+ };
57
+ }
58
+ //#endregion
59
+ export { useIsDarkMode };
60
+
61
+ //# sourceMappingURL=useIsDarkMode.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsDarkMode.es.js","names":[],"sources":["../../src/hooks/useIsDarkMode.ts"],"sourcesContent":["import { useSyncExternalStore } from \"react\";\n\n/**\n * Whether the document is in dark mode right now, and re-rendered when that\n * changes.\n *\n * The theme is a class on `<html>` (`dark`, set by the panel's mode\n * controller) or a `data-theme` attribute (the marketing site). Components\n * that pick colours in JS rather than through CSS variables — `Chip` derives\n * its ink per theme — used to read the class once at render and never again,\n * so a theme switch left every chip on screen wearing the other theme's ink\n * until something else happened to re-render it. Subscribing through a\n * `MutationObserver` on the root's attributes makes the read live.\n */\nexport function useIsDarkMode(): boolean {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}\n\nfunction getSnapshot(): boolean {\n if (typeof document === \"undefined\") return false;\n const root = document.documentElement;\n return root.classList.contains(\"dark\") || root.getAttribute(\"data-theme\") === \"dark\";\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\n/**\n * Every subscriber shares one observer of `<html>`.\n *\n * `Chip` subscribes, and a table can mount hundreds of chips; an observer per\n * subscriber meant hundreds of observers on one element, rebuilt on every\n * virtualised scroll step. The observer is created with the first subscriber\n * and disconnected with the last. Entries are per subscription, not per\n * callback, so one callback subscribed twice still needs two unsubscribes.\n */\nconst subscribers = new Set<{ onChange: () => void }>();\nlet observer: MutationObserver | undefined;\n\nfunction subscribe(onChange: () => void): () => void {\n if (typeof document === \"undefined\" || typeof MutationObserver === \"undefined\") return () => undefined;\n const entry = { onChange };\n subscribers.add(entry);\n if (!observer) {\n observer = new MutationObserver(() => {\n for (const subscriber of [...subscribers]) subscriber.onChange();\n });\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: [\"class\", \"data-theme\"]\n });\n }\n return () => {\n subscribers.delete(entry);\n if (subscribers.size === 0 && observer) {\n observer.disconnect();\n observer = undefined;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,SAAgB,gBAAyB;CACrC,OAAO,qBAAqB,WAAW,aAAa,iBAAiB;AACzE;AAEA,SAAS,cAAuB;CAC5B,IAAI,OAAO,aAAa,aAAa,OAAO;CAC5C,MAAM,OAAO,SAAS;CACtB,OAAO,KAAK,UAAU,SAAS,MAAM,KAAK,KAAK,aAAa,YAAY,MAAM;AAClF;AAEA,SAAS,oBAA6B;CAClC,OAAO;AACX;;;;;;;;;;AAWA,IAAM,8BAAc,IAAI,IAA8B;AACtD,IAAI;AAEJ,SAAS,UAAU,UAAkC;CACjD,IAAI,OAAO,aAAa,eAAe,OAAO,qBAAqB,aAAa,aAAa,KAAA;CAC7F,MAAM,QAAQ,EAAE,SAAS;CACzB,YAAY,IAAI,KAAK;CACrB,IAAI,CAAC,UAAU;EACX,WAAW,IAAI,uBAAuB;GAClC,KAAK,MAAM,cAAc,CAAC,GAAG,WAAW,GAAG,WAAW,SAAS;EACnE,CAAC;EACD,SAAS,QAAQ,SAAS,iBAAiB;GACvC,YAAY;GACZ,iBAAiB,CAAC,SAAS,YAAY;EAC3C,CAAC;CACL;CACA,aAAa;EACT,YAAY,OAAO,KAAK;EACxB,IAAI,YAAY,SAAS,KAAK,UAAU;GACpC,SAAS,WAAW;GACpB,WAAW,KAAA;EACf;CACJ;AACJ"}
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ //#region src/hooks/useModalFocus.ts
4
+ function currentFocus() {
5
+ if (typeof document === "undefined") return null;
6
+ const active = document.activeElement;
7
+ if (!(active instanceof HTMLElement) || active === document.body) return null;
8
+ const layer = active.closest("[role=menu], [role=listbox]");
9
+ if (layer instanceof HTMLElement && layer.id && layer !== active) {
10
+ const trigger = Array.from(document.querySelectorAll("[aria-controls]")).find((el) => el.getAttribute("aria-controls") === layer.id);
11
+ if (trigger instanceof HTMLElement && !layer.contains(trigger)) return trigger;
12
+ }
13
+ return active;
14
+ }
15
+ /**
16
+ * Where focus goes when a kit modal (`Dialog`, `Sheet`) opens and closes.
17
+ *
18
+ * Both used to cancel Radix's open-focus and do nothing else, so focus stayed
19
+ * on the trigger behind the modal — which Radix had just hidden from assistive
20
+ * technology with `aria-hidden`. A screen reader announced nothing, and Enter
21
+ * pressed again fired the trigger a second time underneath the open modal.
22
+ *
23
+ * On open, focus moves into the modal: to `initialFocus` when the caller names
24
+ * an element, otherwise to the modal's own container (it carries
25
+ * `tabIndex=-1`). The container rather than the first field, because the first
26
+ * field on a phone raises the keyboard over a form the user has not started,
27
+ * and because the container is what a screen reader announces by its title.
28
+ * The first Tab then lands on the first control.
29
+ *
30
+ * On close, focus goes back to whatever had it when the modal opened. Radix
31
+ * only returns it to a `Dialog.Trigger`, and the kit's modals are controlled —
32
+ * there is no trigger — so focus used to fall to `<body>` and the next Tab
33
+ * started from the top of the page.
34
+ *
35
+ * The origin is read while rendering the open edge, not from the open-focus
36
+ * event: a field with `autoFocus` inside the modal has taken focus by the time
37
+ * any effect runs, and Radix then skips the event altogether. When the origin
38
+ * is an item in a menu, the menu's trigger is recorded instead: the item is
39
+ * gone a moment later, and the menu does not take focus back to its trigger
40
+ * once the modal has it.
41
+ *
42
+ * Internal to the kit's modals — not exported.
43
+ */
44
+ function useModalFocus({ open, initialFocus, focusContainer = true, onOpenAutoFocus, onCloseAutoFocus }) {
45
+ const [origin, setOrigin] = useState(() => open ? currentFocus() : null);
46
+ const [wasOpen, setWasOpen] = useState(open);
47
+ if (open !== wasOpen) {
48
+ setWasOpen(open);
49
+ if (open) setOrigin(currentFocus());
50
+ }
51
+ return {
52
+ onOpenAutoFocus: useCallback((event) => {
53
+ onOpenAutoFocus?.(event);
54
+ if (event.defaultPrevented) return;
55
+ const target = initialFocus?.current;
56
+ if (target) {
57
+ event.preventDefault();
58
+ target.focus({ preventScroll: true });
59
+ return;
60
+ }
61
+ if (!focusContainer) return;
62
+ event.preventDefault();
63
+ const container = event.currentTarget;
64
+ if (container instanceof HTMLElement) container.focus({ preventScroll: true });
65
+ }, [
66
+ initialFocus,
67
+ focusContainer,
68
+ onOpenAutoFocus
69
+ ]),
70
+ onCloseAutoFocus: useCallback((event) => {
71
+ onCloseAutoFocus?.(event);
72
+ if (event.defaultPrevented) return;
73
+ event.preventDefault();
74
+ if (origin?.isConnected) origin.focus({ preventScroll: true });
75
+ }, [origin, onCloseAutoFocus])
76
+ };
77
+ }
78
+ //#endregion
79
+ export { useModalFocus };
80
+
81
+ //# sourceMappingURL=useModalFocus.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useModalFocus.es.js","names":[],"sources":["../../src/hooks/useModalFocus.ts"],"sourcesContent":["\"use client\";\nimport React, { useCallback, useState } from \"react\";\n\nexport type ModalFocusOptions = {\n /** Whether the modal is open. Focus is recorded on the closed → open edge. */\n open: boolean;\n /**\n * The element to focus when the modal opens. Without it the modal focuses\n * itself (see {@link useModalFocus}).\n */\n initialFocus?: React.RefObject<HTMLElement | null>;\n /**\n * `false` hands the choice back to Radix: the first focusable element\n * inside the modal takes focus. `true` (the default) focuses the modal's\n * own container.\n */\n focusContainer?: boolean;\n onOpenAutoFocus?: (event: Event) => void;\n onCloseAutoFocus?: (event: Event) => void;\n};\n\nfunction currentFocus(): HTMLElement | null {\n if (typeof document === \"undefined\") return null;\n const active = document.activeElement;\n if (!(active instanceof HTMLElement) || active === document.body) return null;\n // A modal opened from a menu item: the item leaves the document as the menu\n // closes, so the place to come back to is the menu's trigger — the element\n // whose `aria-controls` names the open menu (Radix sets it on every trigger).\n const layer = active.closest(\"[role=menu], [role=listbox]\");\n if (layer instanceof HTMLElement && layer.id && layer !== active) {\n const trigger = Array.from(document.querySelectorAll(\"[aria-controls]\"))\n .find((el) => el.getAttribute(\"aria-controls\") === layer.id);\n if (trigger instanceof HTMLElement && !layer.contains(trigger)) return trigger;\n }\n return active;\n}\n\n/**\n * Where focus goes when a kit modal (`Dialog`, `Sheet`) opens and closes.\n *\n * Both used to cancel Radix's open-focus and do nothing else, so focus stayed\n * on the trigger behind the modal — which Radix had just hidden from assistive\n * technology with `aria-hidden`. A screen reader announced nothing, and Enter\n * pressed again fired the trigger a second time underneath the open modal.\n *\n * On open, focus moves into the modal: to `initialFocus` when the caller names\n * an element, otherwise to the modal's own container (it carries\n * `tabIndex=-1`). The container rather than the first field, because the first\n * field on a phone raises the keyboard over a form the user has not started,\n * and because the container is what a screen reader announces by its title.\n * The first Tab then lands on the first control.\n *\n * On close, focus goes back to whatever had it when the modal opened. Radix\n * only returns it to a `Dialog.Trigger`, and the kit's modals are controlled —\n * there is no trigger — so focus used to fall to `<body>` and the next Tab\n * started from the top of the page.\n *\n * The origin is read while rendering the open edge, not from the open-focus\n * event: a field with `autoFocus` inside the modal has taken focus by the time\n * any effect runs, and Radix then skips the event altogether. When the origin\n * is an item in a menu, the menu's trigger is recorded instead: the item is\n * gone a moment later, and the menu does not take focus back to its trigger\n * once the modal has it.\n *\n * Internal to the kit's modals — not exported.\n */\nexport function useModalFocus({\n open,\n initialFocus,\n focusContainer = true,\n onOpenAutoFocus,\n onCloseAutoFocus\n }: ModalFocusOptions) {\n const [origin, setOrigin] = useState<HTMLElement | null>(() => open ? currentFocus() : null);\n const [wasOpen, setWasOpen] = useState(open);\n if (open !== wasOpen) {\n setWasOpen(open);\n if (open) setOrigin(currentFocus());\n }\n\n const handleOpenAutoFocus = useCallback((event: Event) => {\n onOpenAutoFocus?.(event);\n if (event.defaultPrevented) return;\n\n const target = initialFocus?.current;\n if (target) {\n event.preventDefault();\n target.focus({ preventScroll: true });\n return;\n }\n if (!focusContainer) return; // Radix focuses the first focusable element\n event.preventDefault();\n // The event is dispatched on the focus scope's container: the content.\n const container = event.currentTarget;\n if (container instanceof HTMLElement) container.focus({ preventScroll: true });\n }, [initialFocus, focusContainer, onOpenAutoFocus]);\n\n const handleCloseAutoFocus = useCallback((event: Event) => {\n onCloseAutoFocus?.(event);\n if (event.defaultPrevented) return;\n event.preventDefault();\n if (origin?.isConnected) origin.focus({ preventScroll: true });\n }, [origin, onCloseAutoFocus]);\n\n return { onOpenAutoFocus: handleOpenAutoFocus, onCloseAutoFocus: handleCloseAutoFocus };\n}\n"],"mappings":";;;AAqBA,SAAS,eAAmC;CACxC,IAAI,OAAO,aAAa,aAAa,OAAO;CAC5C,MAAM,SAAS,SAAS;CACxB,IAAI,EAAE,kBAAkB,gBAAgB,WAAW,SAAS,MAAM,OAAO;CAIzE,MAAM,QAAQ,OAAO,QAAQ,6BAA6B;CAC1D,IAAI,iBAAiB,eAAe,MAAM,MAAM,UAAU,QAAQ;EAC9D,MAAM,UAAU,MAAM,KAAK,SAAS,iBAAiB,iBAAiB,CAAC,CAAC,CACnE,MAAM,OAAO,GAAG,aAAa,eAAe,MAAM,MAAM,EAAE;EAC/D,IAAI,mBAAmB,eAAe,CAAC,MAAM,SAAS,OAAO,GAAG,OAAO;CAC3E;CACA,OAAO;AACX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAgB,cAAc,EACI,MACA,cACA,iBAAiB,MACjB,iBACA,oBACkB;CAChD,MAAM,CAAC,QAAQ,aAAa,eAAmC,OAAO,aAAa,IAAI,IAAI;CAC3F,MAAM,CAAC,SAAS,cAAc,SAAS,IAAI;CAC3C,IAAI,SAAS,SAAS;EAClB,WAAW,IAAI;EACf,IAAI,MAAM,UAAU,aAAa,CAAC;CACtC;CA0BA,OAAO;EAAE,iBAxBmB,aAAa,UAAiB;GACtD,kBAAkB,KAAK;GACvB,IAAI,MAAM,kBAAkB;GAE5B,MAAM,SAAS,cAAc;GAC7B,IAAI,QAAQ;IACR,MAAM,eAAe;IACrB,OAAO,MAAM,EAAE,eAAe,KAAK,CAAC;IACpC;GACJ;GACA,IAAI,CAAC,gBAAgB;GACrB,MAAM,eAAe;GAErB,MAAM,YAAY,MAAM;GACxB,IAAI,qBAAqB,aAAa,UAAU,MAAM,EAAE,eAAe,KAAK,CAAC;EACjF,GAAG;GAAC;GAAc;GAAgB;EAAe,CASvB;EAAqB,kBAPlB,aAAa,UAAiB;GACvD,mBAAmB,KAAK;GACxB,IAAI,MAAM,kBAAkB;GAC5B,MAAM,eAAe;GACrB,IAAI,QAAQ,aAAa,OAAO,MAAM,EAAE,eAAe,KAAK,CAAC;EACjE,GAAG,CAAC,QAAQ,gBAAgB,CAEqC;CAAqB;AAC1F"}
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ //#region src/hooks/useOutsideAlerter.tsx
4
+ /**
5
+ * Hook that alerts clicks outside the passed ref
6
+ */
7
+ function useOutsideAlerter(ref, onOutsideClick, active = true) {
8
+ useEffect(() => {
9
+ if (!active) return;
10
+ /**
11
+ * Alert if clicked on outside of element
12
+ */
13
+ function handleClickOutside(event) {
14
+ if (isInPresentationLayer(event.target)) return;
15
+ if (ref.current && !ref.current.contains(event.target)) onOutsideClick();
16
+ }
17
+ document.addEventListener("mousedown", handleClickOutside);
18
+ return () => {
19
+ document.removeEventListener("mousedown", handleClickOutside);
20
+ };
21
+ }, [
22
+ ref,
23
+ active,
24
+ onOutsideClick
25
+ ]);
26
+ }
27
+ /**
28
+ * Check if any parent of the node is a presentation node
29
+ * @param node
30
+ */
31
+ function isInPresentationLayer(node) {
32
+ if (node instanceof HTMLElement) {
33
+ if (node.getAttribute("role") === "presentation") return true;
34
+ return isInPresentationLayer(node.parentNode);
35
+ }
36
+ return false;
37
+ }
38
+ //#endregion
39
+ export { useOutsideAlerter };
40
+
41
+ //# sourceMappingURL=useOutsideAlerter.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOutsideAlerter.es.js","names":[],"sources":["../../src/hooks/useOutsideAlerter.tsx"],"sourcesContent":["\"use client\";\n\nimport { RefObject, useEffect } from \"react\";\n\n/**\n * Hook that alerts clicks outside the passed ref\n */\nexport function useOutsideAlerter(ref: RefObject<HTMLElement | null>, onOutsideClick: () => void, active = true): void {\n useEffect(() => {\n if (!active)\n return;\n\n /**\n * Alert if clicked on outside of element\n */\n function handleClickOutside(event: Event) {\n if (isInPresentationLayer(event.target as Node)) {\n return;\n }\n\n if (ref.current && !ref.current.contains(event.target as Node)) {\n onOutsideClick();\n }\n }\n\n // Bind the event listener\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () => {\n // Unbind the event listener on clean up\n document.removeEventListener(\"mousedown\", handleClickOutside);\n };\n }, [ref, active, onOutsideClick]);\n}\n\n/**\n * Check if any parent of the node is a presentation node\n * @param node\n */\nfunction isInPresentationLayer(node: Node | null): boolean {\n if (node instanceof HTMLElement) {\n if (node.getAttribute(\"role\") === \"presentation\")\n return true;\n return isInPresentationLayer(node.parentNode);\n }\n return false;\n}\n"],"mappings":";;;;;;AAOA,SAAgB,kBAAkB,KAAoC,gBAA4B,SAAS,MAAY;CACnH,gBAAgB;EACZ,IAAI,CAAC,QACD;;;;EAKJ,SAAS,mBAAmB,OAAc;GACtC,IAAI,sBAAsB,MAAM,MAAc,GAC1C;GAGJ,IAAI,IAAI,WAAW,CAAC,IAAI,QAAQ,SAAS,MAAM,MAAc,GACzD,eAAe;EAEvB;EAGA,SAAS,iBAAiB,aAAa,kBAAkB;EACzD,aAAa;GAET,SAAS,oBAAoB,aAAa,kBAAkB;EAChE;CACJ,GAAG;EAAC;EAAK;EAAQ;CAAc,CAAC;AACpC;;;;;AAMA,SAAS,sBAAsB,MAA4B;CACvD,IAAI,gBAAgB,aAAa;EAC7B,IAAI,KAAK,aAAa,MAAM,MAAM,gBAC9B,OAAO;EACX,OAAO,sBAAsB,KAAK,UAAU;CAChD;CACA,OAAO;AACX"}
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ //#region src/hooks/useRestoreInterruptedFocus.ts
4
+ /**
5
+ * Finish a focus move that a modal's focus trap interrupted.
6
+ *
7
+ * Radix's `FocusScope` watches a modal for removed nodes, and when one goes
8
+ * while `document.activeElement` is `body` it concludes the focused element was
9
+ * deleted and focuses the modal itself. But `body` is also what `activeElement`
10
+ * reads *during* an ordinary focus move: the browser fires `focusout` before it
11
+ * lands on the next element. Anything that unmounts in response — a tooltip that
12
+ * opened on focus closing on blur, above all — is removed inside that window.
13
+ * The scope focuses the container, the browser abandons the move it was making,
14
+ * and Tab from one field lands on the dialog, so the next Tab starts again from
15
+ * the header. Shift+Tab the same.
16
+ *
17
+ * So remember where each move inside the container was going, and if the
18
+ * container takes focus before the move lands, send it on. A move that nothing
19
+ * interrupts lands on its target and clears the note; a note nobody used is
20
+ * dropped by the next task.
21
+ *
22
+ * The note is taken on `window`, in the capture phase — before any other
23
+ * listener for the event runs. The scope's correction arrives in the microtask
24
+ * checkpoint after whichever listener removed the node, so a note taken any
25
+ * later (on the container, bubbling) is taken after focus has already been
26
+ * moved: a field that drops something from its own `focusout` handler beat it.
27
+ *
28
+ * Internal to the kit's modals — not exported.
29
+ */
30
+ function useRestoreInterruptedFocus(container) {
31
+ useEffect(() => {
32
+ if (!container) return;
33
+ let intended = null;
34
+ let expiry;
35
+ const onFocusOut = (event) => {
36
+ if (!(event.target instanceof Node) || !container.contains(event.target)) return;
37
+ const next = event.relatedTarget;
38
+ intended = next instanceof HTMLElement && next !== container && container.contains(next) ? next : null;
39
+ clearTimeout(expiry);
40
+ if (intended) expiry = setTimeout(() => {
41
+ intended = null;
42
+ }, 0);
43
+ };
44
+ const onFocusIn = (event) => {
45
+ const target = intended;
46
+ intended = null;
47
+ if (event.target === container && target?.isConnected && container.contains(target)) target.focus();
48
+ };
49
+ window.addEventListener("focusout", onFocusOut, true);
50
+ container.addEventListener("focusin", onFocusIn);
51
+ return () => {
52
+ clearTimeout(expiry);
53
+ window.removeEventListener("focusout", onFocusOut, true);
54
+ container.removeEventListener("focusin", onFocusIn);
55
+ };
56
+ }, [container]);
57
+ }
58
+ //#endregion
59
+ export { useRestoreInterruptedFocus };
60
+
61
+ //# sourceMappingURL=useRestoreInterruptedFocus.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRestoreInterruptedFocus.es.js","names":[],"sources":["../../src/hooks/useRestoreInterruptedFocus.ts"],"sourcesContent":["\"use client\";\nimport { useEffect } from \"react\";\n\n/**\n * Finish a focus move that a modal's focus trap interrupted.\n *\n * Radix's `FocusScope` watches a modal for removed nodes, and when one goes\n * while `document.activeElement` is `body` it concludes the focused element was\n * deleted and focuses the modal itself. But `body` is also what `activeElement`\n * reads *during* an ordinary focus move: the browser fires `focusout` before it\n * lands on the next element. Anything that unmounts in response — a tooltip that\n * opened on focus closing on blur, above all — is removed inside that window.\n * The scope focuses the container, the browser abandons the move it was making,\n * and Tab from one field lands on the dialog, so the next Tab starts again from\n * the header. Shift+Tab the same.\n *\n * So remember where each move inside the container was going, and if the\n * container takes focus before the move lands, send it on. A move that nothing\n * interrupts lands on its target and clears the note; a note nobody used is\n * dropped by the next task.\n *\n * The note is taken on `window`, in the capture phase — before any other\n * listener for the event runs. The scope's correction arrives in the microtask\n * checkpoint after whichever listener removed the node, so a note taken any\n * later (on the container, bubbling) is taken after focus has already been\n * moved: a field that drops something from its own `focusout` handler beat it.\n *\n * Internal to the kit's modals — not exported.\n */\nexport function useRestoreInterruptedFocus(container: HTMLElement | null) {\n useEffect(() => {\n if (!container) return;\n\n let intended: HTMLElement | null = null;\n let expiry: ReturnType<typeof setTimeout> | undefined;\n\n const onFocusOut = (event: FocusEvent) => {\n if (!(event.target instanceof Node) || !container.contains(event.target)) return;\n const next = event.relatedTarget;\n intended = next instanceof HTMLElement && next !== container && container.contains(next)\n ? next\n : null;\n clearTimeout(expiry);\n if (intended) expiry = setTimeout(() => {\n intended = null;\n }, 0);\n };\n\n const onFocusIn = (event: FocusEvent) => {\n const target = intended;\n intended = null;\n if (event.target === container && target?.isConnected && container.contains(target)) {\n target.focus();\n }\n };\n\n window.addEventListener(\"focusout\", onFocusOut, true);\n container.addEventListener(\"focusin\", onFocusIn);\n return () => {\n clearTimeout(expiry);\n window.removeEventListener(\"focusout\", onFocusOut, true);\n container.removeEventListener(\"focusin\", onFocusIn);\n };\n }, [container]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,2BAA2B,WAA+B;CACtE,gBAAgB;EACZ,IAAI,CAAC,WAAW;EAEhB,IAAI,WAA+B;EACnC,IAAI;EAEJ,MAAM,cAAc,UAAsB;GACtC,IAAI,EAAE,MAAM,kBAAkB,SAAS,CAAC,UAAU,SAAS,MAAM,MAAM,GAAG;GAC1E,MAAM,OAAO,MAAM;GACnB,WAAW,gBAAgB,eAAe,SAAS,aAAa,UAAU,SAAS,IAAI,IACjF,OACA;GACN,aAAa,MAAM;GACnB,IAAI,UAAU,SAAS,iBAAiB;IACpC,WAAW;GACf,GAAG,CAAC;EACR;EAEA,MAAM,aAAa,UAAsB;GACrC,MAAM,SAAS;GACf,WAAW;GACX,IAAI,MAAM,WAAW,aAAa,QAAQ,eAAe,UAAU,SAAS,MAAM,GAC9E,OAAO,MAAM;EAErB;EAEA,OAAO,iBAAiB,YAAY,YAAY,IAAI;EACpD,UAAU,iBAAiB,WAAW,SAAS;EAC/C,aAAa;GACT,aAAa,MAAM;GACnB,OAAO,oBAAoB,YAAY,YAAY,IAAI;GACvD,UAAU,oBAAoB,WAAW,SAAS;EACtD;CACJ,GAAG,CAAC,SAAS,CAAC;AAClB"}
@@ -0,0 +1,23 @@
1
+ import { cls } from "../util/cls.es.js";
2
+ import { colorClassesMapping, iconSize } from "./Icon.es.js";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/icons/GitHubIcon.tsx
6
+ function GitHubIcon({ size = 24, color, className, onClick, style }) {
7
+ const px = typeof size === "number" ? size : iconSize[size];
8
+ return /* @__PURE__ */ jsx("svg", {
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ className: cls(color ? colorClassesMapping[color] : "", className),
11
+ onClick,
12
+ style,
13
+ fill: "currentColor",
14
+ width: px,
15
+ height: px,
16
+ viewBox: "0 0 24 24",
17
+ children: /* @__PURE__ */ jsx("path", { d: "M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" })
18
+ });
19
+ }
20
+ //#endregion
21
+ export { GitHubIcon };
22
+
23
+ //# sourceMappingURL=GitHubIcon.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubIcon.es.js","names":[],"sources":["../../src/icons/GitHubIcon.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { colorClassesMapping, IconProps, iconSize } from \"./Icon\";\nimport { cls } from \"../util\";\n\nexport function GitHubIcon({ size = 24, color, className, onClick, style }: IconProps) {\n // `size` is `IconSize | number` — resolve the keyword, or an SVG attribute\n // of width=\"small\" is emitted and the icon renders at its intrinsic size.\n const px = typeof size === \"number\" ? size : iconSize[size];\n return <svg xmlns=\"http://www.w3.org/2000/svg\"\n className={cls(color ? colorClassesMapping[color] : \"\", className)}\n onClick={onClick}\n style={style}\n fill={\"currentColor\"}\n width={px}\n height={px}\n viewBox=\"0 0 24 24\">\n <path\n d=\"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z\"/>\n </svg>;\n}\n"],"mappings":";;;;;AAKA,SAAgB,WAAW,EAAE,OAAO,IAAI,OAAO,WAAW,SAAS,SAAoB;CAGnF,MAAM,KAAK,OAAO,SAAS,WAAW,OAAO,SAAS;CACtD,OAAO,oBAAC,OAAD;EAAK,OAAM;EACN,WAAW,IAAI,QAAQ,oBAAoB,SAAS,IAAI,SAAS;EACxD;EACF;EACP,MAAM;EACN,OAAO;EACP,QAAQ;EACR,SAAQ;YAChB,oBAAC,QAAD,EACI,GAAE,4sBAA4sB,CAAA;CACjtB,CAAA;AACT"}
@@ -0,0 +1,60 @@
1
+ import { cls } from "../util/cls.es.js";
2
+ import { colorClassesMapping, iconSize } from "./Icon.es.js";
3
+ import "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/icons/HandleIcon.tsx
6
+ function HandleIcon({ size = 24, color, className, onClick, style }) {
7
+ const px = typeof size === "number" ? size : iconSize[size];
8
+ return /* @__PURE__ */ jsxs("svg", {
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ className: cls(color ? colorClassesMapping[color] : "", className),
11
+ onClick,
12
+ style,
13
+ width: px,
14
+ height: px,
15
+ viewBox: "0 0 100 100",
16
+ fill: "none",
17
+ children: [
18
+ /* @__PURE__ */ jsx("circle", {
19
+ cx: "28",
20
+ cy: "50",
21
+ r: "9",
22
+ fill: "currentColor"
23
+ }),
24
+ /* @__PURE__ */ jsx("circle", {
25
+ cx: "28",
26
+ cy: "21",
27
+ r: "9",
28
+ fill: "currentColor"
29
+ }),
30
+ /* @__PURE__ */ jsx("circle", {
31
+ cx: "71",
32
+ cy: "21",
33
+ r: "9",
34
+ fill: "currentColor"
35
+ }),
36
+ /* @__PURE__ */ jsx("circle", {
37
+ cx: "71",
38
+ cy: "50",
39
+ r: "9",
40
+ fill: "currentColor"
41
+ }),
42
+ /* @__PURE__ */ jsx("circle", {
43
+ cx: "71",
44
+ cy: "78",
45
+ r: "9",
46
+ fill: "currentColor"
47
+ }),
48
+ /* @__PURE__ */ jsx("circle", {
49
+ cx: "28",
50
+ cy: "78",
51
+ r: "9",
52
+ fill: "currentColor"
53
+ })
54
+ ]
55
+ });
56
+ }
57
+ //#endregion
58
+ export { HandleIcon };
59
+
60
+ //# sourceMappingURL=HandleIcon.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandleIcon.es.js","names":[],"sources":["../../src/icons/HandleIcon.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { colorClassesMapping, IconProps, iconSize } from \"./Icon\";\nimport { cls } from \"../util\";\n\nexport function HandleIcon({ size = 24, color, className, onClick, style }: IconProps) {\n const px = typeof size === \"number\" ? size : iconSize[size];\n return <svg xmlns=\"http://www.w3.org/2000/svg\"\n className={cls(color ? colorClassesMapping[color] : \"\", className)}\n onClick={onClick}\n style={style}\n width={px}\n height={px}\n viewBox=\"0 0 100 100\"\n fill=\"none\">\n <circle cx=\"28\" cy=\"50\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"28\" cy=\"21\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"21\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"50\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"71\" cy=\"78\" r=\"9\" fill={\"currentColor\"}/>\n <circle cx=\"28\" cy=\"78\" r=\"9\" fill={\"currentColor\"}/>\n </svg>;\n}\n"],"mappings":";;;;;AAKA,SAAgB,WAAW,EAAE,OAAO,IAAI,OAAO,WAAW,SAAS,SAAoB;CACnF,MAAM,KAAK,OAAO,SAAS,WAAW,OAAO,SAAS;CACtD,OAAO,qBAAC,OAAD;EAAK,OAAM;EACN,WAAW,IAAI,QAAQ,oBAAoB,SAAS,IAAI,SAAS;EACxD;EACF;EACP,OAAO;EACP,QAAQ;EACR,SAAQ;EACR,MAAK;YAPV;GAQH,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAM;GAAgB,CAAA;GACpD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAM;GAAgB,CAAA;GACpD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAM;GAAgB,CAAA;GACpD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAM;GAAgB,CAAA;GACpD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAM;GAAgB,CAAA;GACpD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAM;GAAgB,CAAA;EACnD;;AACT"}
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ //#region src/icons/Icon.tsx
3
+ /**
4
+ * Standardized icon size map in px.
5
+ * Use with direct Lucide imports: `<Database size={iconSize.small} />`
6
+ */
7
+ var iconSize = {
8
+ smallest: 16,
9
+ small: 20,
10
+ medium: 24,
11
+ large: 28
12
+ };
13
+ var colorClassesMapping = {
14
+ inherit: "",
15
+ primary: "text-primary",
16
+ success: "text-green-500",
17
+ warning: "text-yellow-500",
18
+ secondary: "text-secondary",
19
+ disabled: "text-text-disabled dark:text-text-disabled-dark",
20
+ error: "text-red-500"
21
+ };
22
+ //#endregion
23
+ export { colorClassesMapping, iconSize };
24
+
25
+ //# sourceMappingURL=Icon.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.es.js","names":[],"sources":["../../src/icons/Icon.tsx"],"sourcesContent":["\"use client\";\n\nexport type IconColor = \"inherit\" | \"primary\" | \"secondary\" | \"disabled\" | \"error\" | \"success\" | \"warning\";\nexport type IconSize = \"smallest\" | \"small\" | \"medium\" | \"large\";\n\n/**\n * Standardized icon size map in px.\n * Use with direct Lucide imports: `<Database size={iconSize.small} />`\n */\nexport const iconSize = {\n smallest: 16,\n small: 20,\n medium: 24,\n large: 28\n} as const satisfies Record<IconSize, number>;\n\nexport type IconProps = {\n size?: IconSize | number,\n color?: IconColor,\n className?: string,\n onClick?: (e: React.SyntheticEvent) => void,\n style?: React.CSSProperties,\n}\n\nexport const colorClassesMapping: Record<IconColor, string> = {\n inherit: \"\",\n primary: \"text-primary\",\n success: \"text-green-500\",\n warning: \"text-yellow-500\",\n secondary: \"text-secondary\",\n disabled: \"text-text-disabled dark:text-text-disabled-dark\",\n error: \"text-red-500\"\n}\n"],"mappings":";;;;;;AASA,IAAa,WAAW;CACpB,UAAU;CACV,OAAO;CACP,QAAQ;CACR,OAAO;AACX;AAUA,IAAa,sBAAiD;CAC1D,SAAS;CACT,SAAS;CACT,SAAS;CACT,SAAS;CACT,WAAW;CACX,UAAU;CACV,OAAO;AACX"}