@robert-stackflow/oneui 0.0.0-stage → 0.1.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 (367) hide show
  1. package/README.md +45 -2
  2. package/assets/LUCIDE-LICENSE.txt +43 -0
  3. package/assets/character-metadata.json +1 -0
  4. package/assets/emoji.json +1 -0
  5. package/assets/icon-catalog.json +1 -0
  6. package/assets/symbols.json +1 -0
  7. package/components/Accessibility.module.css +8 -0
  8. package/components/Accordion.d.ts +7 -0
  9. package/components/Accordion.js +41 -0
  10. package/components/Accordion.module.css +38 -0
  11. package/components/Alert.d.ts +9 -0
  12. package/components/Alert.js +42 -0
  13. package/components/Alert.module.css +56 -0
  14. package/components/AppShell.d.ts +30 -0
  15. package/components/AppShell.js +152 -0
  16. package/components/AppShell.module.css +239 -0
  17. package/components/AppearanceSettings.d.ts +7 -0
  18. package/components/AppearanceSettings.js +201 -0
  19. package/components/AppearanceSettings.module.css +32 -0
  20. package/components/Avatar.d.ts +14 -0
  21. package/components/Avatar.js +69 -0
  22. package/components/Avatar.module.css +70 -0
  23. package/components/AvatarGroup.d.ts +15 -0
  24. package/components/AvatarGroup.js +115 -0
  25. package/components/AvatarGroup.module.css +54 -0
  26. package/components/Badge.d.ts +5 -0
  27. package/components/Badge.js +11 -0
  28. package/components/Badge.module.css +30 -0
  29. package/components/BlockedTab.d.ts +4 -0
  30. package/components/BlockedTab.js +10 -0
  31. package/components/Breadcrumb.d.ts +16 -0
  32. package/components/Breadcrumb.js +157 -0
  33. package/components/Breadcrumb.module.css +97 -0
  34. package/components/Button.d.ts +6 -0
  35. package/components/Button.js +29 -0
  36. package/components/Button.module.css +79 -0
  37. package/components/Calendar.d.ts +10 -0
  38. package/components/Calendar.js +260 -0
  39. package/components/Calendar.module.css +106 -0
  40. package/components/Card.d.ts +7 -0
  41. package/components/Card.js +19 -0
  42. package/components/Card.module.css +28 -0
  43. package/components/Cascader.d.ts +14 -0
  44. package/components/Cascader.js +296 -0
  45. package/components/CatalogIcon.d.ts +3 -0
  46. package/components/CatalogIcon.js +11 -0
  47. package/components/CharacterPicker.d.ts +15 -0
  48. package/components/CharacterPicker.js +200 -0
  49. package/components/Checkbox.d.ts +12 -0
  50. package/components/Checkbox.js +82 -0
  51. package/components/Checkbox.module.css +95 -0
  52. package/components/ColorField.d.ts +6 -0
  53. package/components/ColorField.js +61 -0
  54. package/components/ColorField.module.css +15 -0
  55. package/components/ColorPicker.d.ts +5 -0
  56. package/components/ColorPicker.js +188 -0
  57. package/components/ColorPicker.module.css +90 -0
  58. package/components/Combobox.d.ts +11 -0
  59. package/components/Combobox.js +252 -0
  60. package/components/Combobox.module.css +26 -0
  61. package/components/CommandPalette.d.ts +25 -0
  62. package/components/CommandPalette.js +269 -0
  63. package/components/CommandPalette.module.css +49 -0
  64. package/components/ContextMenu.d.ts +9 -0
  65. package/components/ContextMenu.js +363 -0
  66. package/components/ContextMenu.module.css +42 -0
  67. package/components/ContextMenuPanel.d.ts +22 -0
  68. package/components/ContextMenuPanel.js +155 -0
  69. package/components/ContributionCalendar.d.ts +18 -0
  70. package/components/ContributionCalendar.js +201 -0
  71. package/components/ContributionCalendar.module.css +114 -0
  72. package/components/ContributionCell.d.ts +11 -0
  73. package/components/ContributionCell.js +41 -0
  74. package/components/Control.module.css +73 -0
  75. package/components/DataTable.d.ts +49 -0
  76. package/components/DataTable.js +220 -0
  77. package/components/DataTable.module.css +112 -0
  78. package/components/DatePicker.d.ts +15 -0
  79. package/components/DatePicker.js +186 -0
  80. package/components/DatePicker.module.css +85 -0
  81. package/components/DateRangePicker.d.ts +9 -0
  82. package/components/DateRangePicker.js +168 -0
  83. package/components/Descriptions.d.ts +21 -0
  84. package/components/Descriptions.js +162 -0
  85. package/components/Descriptions.module.css +117 -0
  86. package/components/Dialog.d.ts +9 -0
  87. package/components/Dialog.js +112 -0
  88. package/components/Dialog.module.css +71 -0
  89. package/components/DisclosureChevron.d.ts +3 -0
  90. package/components/DisclosureChevron.js +17 -0
  91. package/components/DisclosureChevron.module.css +17 -0
  92. package/components/Divider.d.ts +5 -0
  93. package/components/Divider.js +24 -0
  94. package/components/Divider.module.css +19 -0
  95. package/components/Drawer.d.ts +18 -0
  96. package/components/Drawer.js +145 -0
  97. package/components/Drawer.module.css +109 -0
  98. package/components/EmojiPicker.d.ts +6 -0
  99. package/components/EmojiPicker.js +19 -0
  100. package/components/EmptyState.d.ts +8 -0
  101. package/components/EmptyState.js +20 -0
  102. package/components/EmptyState.module.css +30 -0
  103. package/components/FieldLabel.d.ts +8 -0
  104. package/components/FieldLabel.js +20 -0
  105. package/components/FieldMessages.d.ts +5 -0
  106. package/components/FieldMessages.js +15 -0
  107. package/components/FileDropOverlay.d.ts +5 -0
  108. package/components/FileDropOverlay.js +26 -0
  109. package/components/FileDropOverlay.module.css +55 -0
  110. package/components/FileDropZone.d.ts +15 -0
  111. package/components/FileDropZone.js +113 -0
  112. package/components/FileDropZone.module.css +6 -0
  113. package/components/FilePicker.d.ts +10 -0
  114. package/components/FilePicker.js +59 -0
  115. package/components/FileSelectionFeedback.d.ts +5 -0
  116. package/components/FileSelectionFeedback.js +23 -0
  117. package/components/FileSelectionFeedback.module.css +14 -0
  118. package/components/FileTree.d.ts +13 -0
  119. package/components/FileTree.js +125 -0
  120. package/components/FileTree.module.css +66 -0
  121. package/components/Form.d.ts +7 -0
  122. package/components/Form.js +26 -0
  123. package/components/Form.module.css +7 -0
  124. package/components/FormErrorSummary.d.ts +6 -0
  125. package/components/FormErrorSummary.js +27 -0
  126. package/components/FormErrorSummary.module.css +27 -0
  127. package/components/FormField.d.ts +9 -0
  128. package/components/FormField.js +59 -0
  129. package/components/FormField.module.css +85 -0
  130. package/components/FormGroup.d.ts +9 -0
  131. package/components/FormGroup.js +32 -0
  132. package/components/HierarchyPicker.module.css +146 -0
  133. package/components/IconButton.d.ts +7 -0
  134. package/components/IconButton.js +30 -0
  135. package/components/IconButton.module.css +39 -0
  136. package/components/IconPicker.d.ts +6 -0
  137. package/components/IconPicker.js +111 -0
  138. package/components/Indicator.d.ts +18 -0
  139. package/components/Indicator.js +97 -0
  140. package/components/Indicator.module.css +83 -0
  141. package/components/Input.d.ts +7 -0
  142. package/components/Input.js +29 -0
  143. package/components/Input.module.css +23 -0
  144. package/components/LoadingOverlay.d.ts +6 -0
  145. package/components/LoadingOverlay.js +16 -0
  146. package/components/LoadingOverlay.module.css +22 -0
  147. package/components/LoadingState.d.ts +5 -0
  148. package/components/LoadingState.js +29 -0
  149. package/components/LoadingState.module.css +14 -0
  150. package/components/Menu.d.ts +11 -0
  151. package/components/Menu.js +82 -0
  152. package/components/MenuItem.d.ts +14 -0
  153. package/components/MenuItem.js +49 -0
  154. package/components/MenuItem.module.css +163 -0
  155. package/components/MenuItemContent.d.ts +8 -0
  156. package/components/MenuItemContent.js +19 -0
  157. package/components/MultiSelect.d.ts +12 -0
  158. package/components/MultiSelect.js +161 -0
  159. package/components/MultiSelect.module.css +61 -0
  160. package/components/NumberInput.d.ts +12 -0
  161. package/components/NumberInput.js +113 -0
  162. package/components/NumberInput.module.css +33 -0
  163. package/components/Page.d.ts +7 -0
  164. package/components/Page.js +22 -0
  165. package/components/Page.module.css +44 -0
  166. package/components/Pagination.d.ts +11 -0
  167. package/components/Pagination.js +160 -0
  168. package/components/Pagination.module.css +70 -0
  169. package/components/PasswordField.d.ts +9 -0
  170. package/components/PasswordField.js +101 -0
  171. package/components/PasswordField.module.css +64 -0
  172. package/components/Picker.module.css +52 -0
  173. package/components/PinInput.d.ts +13 -0
  174. package/components/PinInput.js +172 -0
  175. package/components/PinInput.module.css +72 -0
  176. package/components/Placeholder.d.ts +31 -0
  177. package/components/Placeholder.js +36 -0
  178. package/components/Popconfirm.d.ts +17 -0
  179. package/components/Popconfirm.js +159 -0
  180. package/components/Popconfirm.module.css +49 -0
  181. package/components/Popover.d.ts +13 -0
  182. package/components/Popover.js +150 -0
  183. package/components/Popover.module.css +16 -0
  184. package/components/Progress.d.ts +5 -0
  185. package/components/Progress.js +31 -0
  186. package/components/Progress.module.css +33 -0
  187. package/components/RadioGroup.d.ts +15 -0
  188. package/components/RadioGroup.js +73 -0
  189. package/components/RadioGroup.module.css +87 -0
  190. package/components/RangeSlider.d.ts +22 -0
  191. package/components/RangeSlider.js +278 -0
  192. package/components/RangeSlider.module.css +141 -0
  193. package/components/ResizablePanel.d.ts +21 -0
  194. package/components/ResizablePanel.js +219 -0
  195. package/components/ResizablePanel.module.css +101 -0
  196. package/components/SearchField.d.ts +11 -0
  197. package/components/SearchField.js +66 -0
  198. package/components/SearchField.module.css +37 -0
  199. package/components/Section.d.ts +6 -0
  200. package/components/Section.js +18 -0
  201. package/components/Section.module.css +14 -0
  202. package/components/Segmented.d.ts +11 -0
  203. package/components/Segmented.js +77 -0
  204. package/components/Segmented.module.css +82 -0
  205. package/components/Select.d.ts +11 -0
  206. package/components/Select.js +171 -0
  207. package/components/Select.module.css +21 -0
  208. package/components/SelectOptionContent.d.ts +5 -0
  209. package/components/SelectOptionContent.js +20 -0
  210. package/components/SelectOptionContent.module.css +7 -0
  211. package/components/SelectTrigger.d.ts +5 -0
  212. package/components/SelectTrigger.js +32 -0
  213. package/components/SelectTrigger.module.css +24 -0
  214. package/components/SettingRow.d.ts +7 -0
  215. package/components/SettingRow.js +19 -0
  216. package/components/SettingRow.module.css +44 -0
  217. package/components/SettingsLayout.d.ts +9 -0
  218. package/components/SettingsLayout.js +45 -0
  219. package/components/SettingsLayout.module.css +48 -0
  220. package/components/ShortcutInput.d.ts +8 -0
  221. package/components/ShortcutInput.js +131 -0
  222. package/components/ShortcutInput.module.css +39 -0
  223. package/components/Skeleton.d.ts +5 -0
  224. package/components/Skeleton.js +19 -0
  225. package/components/Skeleton.module.css +27 -0
  226. package/components/SkeletonRows.d.ts +4 -0
  227. package/components/SkeletonRows.js +19 -0
  228. package/components/SkeletonRows.module.css +19 -0
  229. package/components/SkinTonePicker.d.ts +4 -0
  230. package/components/SkinTonePicker.js +43 -0
  231. package/components/SkinTonePicker.module.css +50 -0
  232. package/components/Slider.d.ts +10 -0
  233. package/components/Slider.js +40 -0
  234. package/components/Slider.module.css +19 -0
  235. package/components/Spinner.d.ts +6 -0
  236. package/components/Spinner.js +31 -0
  237. package/components/Spinner.module.css +57 -0
  238. package/components/SplitButton.d.ts +17 -0
  239. package/components/SplitButton.js +102 -0
  240. package/components/SplitButton.module.css +56 -0
  241. package/components/Statistic.d.ts +22 -0
  242. package/components/Statistic.js +102 -0
  243. package/components/Statistic.module.css +55 -0
  244. package/components/Steps.d.ts +19 -0
  245. package/components/Steps.js +102 -0
  246. package/components/Steps.module.css +176 -0
  247. package/components/Switch.d.ts +6 -0
  248. package/components/Switch.js +25 -0
  249. package/components/Switch.module.css +56 -0
  250. package/components/SymbolPicker.d.ts +6 -0
  251. package/components/SymbolPicker.js +18 -0
  252. package/components/Tab.module.css +145 -0
  253. package/components/TabList.d.ts +11 -0
  254. package/components/TabList.js +51 -0
  255. package/components/Table.d.ts +12 -0
  256. package/components/Table.js +20 -0
  257. package/components/Table.module.css +48 -0
  258. package/components/TableColumnFilter.d.ts +6 -0
  259. package/components/TableColumnFilter.js +76 -0
  260. package/components/TableColumnVisibility.d.ts +11 -0
  261. package/components/TableColumnVisibility.js +76 -0
  262. package/components/Tabs.d.ts +13 -0
  263. package/components/Tabs.js +49 -0
  264. package/components/Tabs.module.css +3 -0
  265. package/components/TagInput.d.ts +11 -0
  266. package/components/TagInput.js +154 -0
  267. package/components/TagInput.module.css +64 -0
  268. package/components/Textarea.d.ts +6 -0
  269. package/components/Textarea.js +24 -0
  270. package/components/Textarea.module.css +9 -0
  271. package/components/ThemePicker.d.ts +6 -0
  272. package/components/ThemePicker.js +78 -0
  273. package/components/ThemePicker.module.css +178 -0
  274. package/components/ThemeProvider.d.ts +11 -0
  275. package/components/ThemeProvider.js +80 -0
  276. package/components/ThemeStylePicker.d.ts +5 -0
  277. package/components/ThemeStylePicker.js +22 -0
  278. package/components/TimeColumns.d.ts +6 -0
  279. package/components/TimeColumns.js +55 -0
  280. package/components/TimeColumns.module.css +47 -0
  281. package/components/Timeline.d.ts +26 -0
  282. package/components/Timeline.js +131 -0
  283. package/components/Timeline.module.css +202 -0
  284. package/components/Toast.d.ts +6 -0
  285. package/components/Toast.js +181 -0
  286. package/components/Toast.module.css +175 -0
  287. package/components/ToastProvider.d.ts +35 -0
  288. package/components/ToastProvider.js +47 -0
  289. package/components/Tooltip.d.ts +10 -0
  290. package/components/Tooltip.js +169 -0
  291. package/components/Tooltip.module.css +53 -0
  292. package/components/TreeSelect.d.ts +23 -0
  293. package/components/TreeSelect.js +309 -0
  294. package/components/UIProvider.d.ts +10 -0
  295. package/components/UIProvider.js +20 -0
  296. package/components/UnderlinedTab.d.ts +2 -0
  297. package/components/UnderlinedTab.js +8 -0
  298. package/components/Upload.d.ts +22 -0
  299. package/components/Upload.js +165 -0
  300. package/components/Upload.module.css +36 -0
  301. package/components/UploadList.d.ts +9 -0
  302. package/components/UploadList.js +14 -0
  303. package/components/UploadList.module.css +130 -0
  304. package/components/UploadListItem.d.ts +13 -0
  305. package/components/UploadListItem.js +122 -0
  306. package/components/VirtualPickerList.d.ts +25 -0
  307. package/components/VirtualPickerList.js +269 -0
  308. package/components/VirtualPickerList.module.css +89 -0
  309. package/components/appearance.d.ts +19 -0
  310. package/components/appearance.js +60 -0
  311. package/components/characterCatalog.d.ts +9 -0
  312. package/components/characterCatalog.js +55 -0
  313. package/components/color.d.ts +7 -0
  314. package/components/color.js +18 -0
  315. package/components/contribution.d.ts +57 -0
  316. package/components/contribution.js +86 -0
  317. package/components/dateConstraints.d.ts +13 -0
  318. package/components/dateConstraints.js +44 -0
  319. package/components/field.d.ts +58 -0
  320. package/components/field.js +57 -0
  321. package/components/fileSelection.d.ts +21 -0
  322. package/components/fileSelection.js +43 -0
  323. package/components/hierarchy.d.ts +22 -0
  324. package/components/hierarchy.js +33 -0
  325. package/components/iconCatalog.d.ts +13 -0
  326. package/components/iconCatalog.js +80 -0
  327. package/components/index.d.ts +150 -0
  328. package/components/index.js +219 -0
  329. package/components/menuFocus.d.ts +7 -0
  330. package/components/menuFocus.js +21 -0
  331. package/components/menuPointer.d.ts +6 -0
  332. package/components/menuPointer.js +13 -0
  333. package/components/menuTypes.d.ts +24 -0
  334. package/components/menuTypes.js +0 -0
  335. package/components/motion.d.ts +9 -0
  336. package/components/motion.js +82 -0
  337. package/components/rangeMath.d.ts +12 -0
  338. package/components/rangeMath.js +30 -0
  339. package/components/surfacePortal.d.ts +13 -0
  340. package/components/surfacePortal.js +22 -0
  341. package/components/tooltipState.d.ts +5 -0
  342. package/components/tooltipState.js +48 -0
  343. package/components/types.d.ts +9 -0
  344. package/components/types.js +0 -0
  345. package/components/uploadTypes.d.ts +21 -0
  346. package/components/uploadTypes.js +0 -0
  347. package/components/useFormState.d.ts +51 -0
  348. package/components/useFormState.js +218 -0
  349. package/components/useHierarchy.d.ts +8 -0
  350. package/components/useHierarchy.js +80 -0
  351. package/components/useMenuLayers.d.ts +17 -0
  352. package/components/useMenuLayers.js +23 -0
  353. package/components/useModalScrollLock.d.ts +1 -0
  354. package/components/useModalScrollLock.js +18 -0
  355. package/components/usePopover.d.ts +8 -0
  356. package/components/usePopover.js +22 -0
  357. package/components/useTabIndicator.d.ts +12 -0
  358. package/components/useTabIndicator.js +63 -0
  359. package/components/useUploadQueue.d.ts +20 -0
  360. package/components/useUploadQueue.js +175 -0
  361. package/package.json +783 -3
  362. package/styles/base.css +189 -0
  363. package/styles/blue.css +254 -0
  364. package/styles/desktop.css +2 -0
  365. package/styles/minimal.css +337 -0
  366. package/styles/themes.css +2 -0
  367. package/styles/web.css +2 -0
@@ -0,0 +1,80 @@
1
+ import { useEffect, useState } from "react";
2
+ const url = new URL("../assets/icon-catalog.json", import.meta.url).href;
3
+ let cache;
4
+ let pending;
5
+ function loadCatalog() {
6
+ return pending ||= fetch(url).then((r) => {
7
+ if (!r.ok) throw Error("\u56FE\u6807\u52A0\u8F7D\u5931\u8D25");
8
+ return r.json();
9
+ }).then((data) => cache = data).catch((e) => {
10
+ pending = void 0;
11
+ throw e;
12
+ });
13
+ }
14
+ function useIconCatalog(enabled = true) {
15
+ const [items, setItems] = useState(cache), [error, setError] = useState(false), [revision, setRevision] = useState(0);
16
+ useEffect(() => {
17
+ if (!enabled) return;
18
+ let alive = true;
19
+ setError(false);
20
+ loadCatalog().then((data) => {
21
+ if (alive) setItems(data);
22
+ }).catch(() => {
23
+ if (alive) setError(true);
24
+ });
25
+ return () => {
26
+ alive = false;
27
+ };
28
+ }, [enabled, revision]);
29
+ return { items, error, retry: () => setRevision((x) => x + 1) };
30
+ }
31
+ const iconCategories = {
32
+ accessibility: "\u65E0\u969C\u788D",
33
+ account: "\u8D26\u6237",
34
+ animals: "\u52A8\u7269",
35
+ arrows: "\u7BAD\u5934",
36
+ buildings: "\u5EFA\u7B51",
37
+ charts: "\u56FE\u8868",
38
+ communication: "\u901A\u4FE1",
39
+ connectivity: "\u8FDE\u63A5",
40
+ cursors: "\u5149\u6807",
41
+ design: "\u8BBE\u8BA1",
42
+ development: "\u5F00\u53D1",
43
+ devices: "\u8BBE\u5907",
44
+ emoji: "\u8868\u60C5",
45
+ files: "\u6587\u4EF6",
46
+ finance: "\u91D1\u878D",
47
+ "food-beverage": "\u9910\u996E",
48
+ gaming: "\u6E38\u620F",
49
+ home: "\u5BB6\u5C45",
50
+ layout: "\u5E03\u5C40",
51
+ mail: "\u90AE\u4EF6",
52
+ math: "\u6570\u5B66",
53
+ medical: "\u533B\u7597",
54
+ multimedia: "\u591A\u5A92\u4F53",
55
+ nature: "\u81EA\u7136",
56
+ navigation: "\u5BFC\u822A",
57
+ notifications: "\u901A\u77E5",
58
+ people: "\u4EBA\u7269",
59
+ photography: "\u6444\u5F71",
60
+ science: "\u79D1\u5B66",
61
+ seasons: "\u5B63\u8282",
62
+ security: "\u5B89\u5168",
63
+ shapes: "\u5F62\u72B6",
64
+ shopping: "\u8D2D\u7269",
65
+ social: "\u793E\u4EA4",
66
+ sports: "\u8FD0\u52A8",
67
+ sustainability: "\u53EF\u6301\u7EED",
68
+ text: "\u6587\u672C",
69
+ time: "\u65F6\u95F4",
70
+ tools: "\u5DE5\u5177",
71
+ transportation: "\u4EA4\u901A",
72
+ travel: "\u65C5\u884C",
73
+ weather: "\u5929\u6C14",
74
+ uncategorized: "\u5176\u4ED6"
75
+ };
76
+ export {
77
+ iconCategories,
78
+ loadCatalog,
79
+ useIconCatalog
80
+ };
@@ -0,0 +1,150 @@
1
+ export { Badge } from "./Badge";
2
+ export { Button } from "./Button";
3
+ export { Checkbox } from "./Checkbox";
4
+ export { ColorField } from "./ColorField";
5
+ export { DatePicker } from "./DatePicker";
6
+ export { Dialog } from "./Dialog";
7
+ export { EmptyState } from "./EmptyState";
8
+ export { FileDropZone } from "./FileDropZone";
9
+ export { FilePicker } from "./FilePicker";
10
+ export { IconButton } from "./IconButton";
11
+ export { Input } from "./Input";
12
+ export { MultiSelect } from "./MultiSelect";
13
+ export { NumberInput } from "./NumberInput";
14
+ export { Page } from "./Page";
15
+ export { Popover } from "./Popover";
16
+ export { Progress } from "./Progress";
17
+ export { SearchField } from "./SearchField";
18
+ export { Section } from "./Section";
19
+ export { Segmented } from "./Segmented";
20
+ export { Select } from "./Select";
21
+ export { SettingRow } from "./SettingRow";
22
+ export { Skeleton } from "./Skeleton";
23
+ export { SkeletonRows } from "./SkeletonRows";
24
+ export { Switch } from "./Switch";
25
+ export { ToastProvider } from "./ToastProvider";
26
+ export { Tooltip } from "./Tooltip";
27
+ export type { SelectOption } from "./types";
28
+ export { FileDropOverlay } from "./FileDropOverlay";
29
+ export { DisclosureChevron } from "./DisclosureChevron";
30
+ export { ColorPicker } from "./ColorPicker";
31
+ export { Textarea } from "./Textarea";
32
+ export { ThemePicker } from "./ThemePicker";
33
+ export { Toast } from "./Toast";
34
+ export { SplitButton } from "./SplitButton";
35
+ export { Calendar } from "./Calendar";
36
+ export { TimeColumns } from "./TimeColumns";
37
+ export { RadioGroup } from "./RadioGroup";
38
+ export { Slider } from "./Slider";
39
+ export { Accordion } from "./Accordion";
40
+ export type { ToastOptions, ToastAction, ToastTone, ToastMessage, } from "./ToastProvider";
41
+ export { useToast } from "./ToastProvider";
42
+ export type { DatePickerMode } from "./DatePicker";
43
+ export type { SplitButtonItem } from "./SplitButton";
44
+ export { Divider } from "./Divider";
45
+ export { CatalogIcon } from "./CatalogIcon";
46
+ export { CharacterPicker } from "./CharacterPicker";
47
+ export { DataTable } from "./DataTable";
48
+ export { EmojiPicker } from "./EmojiPicker";
49
+ export { FileTree } from "./FileTree";
50
+ export { IconPicker } from "./IconPicker";
51
+ export { LoadingOverlay } from "./LoadingOverlay";
52
+ export { LoadingState } from "./LoadingState";
53
+ export { Pagination } from "./Pagination";
54
+ export { Placeholder } from "./Placeholder";
55
+ export { ShortcutInput } from "./ShortcutInput";
56
+ export { Spinner } from "./Spinner";
57
+ export { SymbolPicker } from "./SymbolPicker";
58
+ export { TableColumnFilter } from "./TableColumnFilter";
59
+ export type { FileTreeNode } from "./FileTree";
60
+ export type { TableColumn } from "./DataTable";
61
+ export type { CharacterGroup } from "./CharacterPicker";
62
+ export { SelectTrigger } from "./SelectTrigger";
63
+ export { BlockedTab } from "./BlockedTab";
64
+ export { UnderlinedTab } from "./UnderlinedTab";
65
+ export { Indicator } from "./Indicator";
66
+ export type { IndicatorItem, IndicatorGroup } from "./Indicator";
67
+ export type { TabOption } from "./useTabIndicator";
68
+ export { VirtualPickerList } from "./VirtualPickerList";
69
+ export { SkinTonePicker } from "./SkinTonePicker";
70
+ export type { PickerCatalogItem, PickerCatalogGroup, } from "./VirtualPickerList";
71
+ export { ContextMenu } from "./ContextMenu";
72
+ export { ContextMenuPanel } from "./ContextMenuPanel";
73
+ export { SelectOptionContent } from "./SelectOptionContent";
74
+ export type { ContextMenuItem, MenuAction } from "./menuTypes";
75
+ export { MenuItem } from "./MenuItem";
76
+ export type { MenuItemProps } from "./MenuItem";
77
+ export { Form } from "./Form";
78
+ export { FormField } from "./FormField";
79
+ export { FieldLabel } from "./FieldLabel";
80
+ export { FormGroup } from "./FormGroup";
81
+ export { FormErrorSummary } from "./FormErrorSummary";
82
+ export { useFormState } from "./useFormState";
83
+ export type { FormController, FormRules, FieldRule } from "./useFormState";
84
+ export { PinInput } from "./PinInput";
85
+ export { ContributionCalendar } from "./ContributionCalendar";
86
+ export type { ContributionDay } from "./contribution";
87
+ export { Combobox } from "./Combobox";
88
+ export { TagInput } from "./TagInput";
89
+ export { PasswordField } from "./PasswordField";
90
+ export { Alert } from "./Alert";
91
+ export { Drawer } from "./Drawer";
92
+ export type { DrawerProps, DrawerPlacement } from "./Drawer";
93
+ export { Steps } from "./Steps";
94
+ export type { StepsProps, StepItem, StepStatus } from "./Steps";
95
+ export { Breadcrumb } from "./Breadcrumb";
96
+ export type { BreadcrumbProps, BreadcrumbItem } from "./Breadcrumb";
97
+ export { Avatar } from "./Avatar";
98
+ export type { AvatarProps, AvatarStatus } from "./Avatar";
99
+ export { AvatarGroup } from "./AvatarGroup";
100
+ export type { AvatarGroupProps, AvatarGroupItem } from "./AvatarGroup";
101
+ export { CommandPalette } from "./CommandPalette";
102
+ export type { CommandPaletteProps, CommandPaletteItem } from "./CommandPalette";
103
+ export { ResizablePanel } from "./ResizablePanel";
104
+ export type { ResizablePanelProps } from "./ResizablePanel";
105
+ export { DateRangePicker } from "./DateRangePicker";
106
+ export type { DateRangePickerProps } from "./DateRangePicker";
107
+ export type { DatePickerProps, SingleDatePickerProps } from "./DatePicker";
108
+ export type { DateRange, DateConstraints } from "./dateConstraints";
109
+ export { validateFiles, formatFileSize } from "./fileSelection";
110
+ export type { FileConstraints, FileRejection, FileSelectionResult, } from "./fileSelection";
111
+ export type { FilePickerProps } from "./FilePicker";
112
+ export type { FileDropZoneProps } from "./FileDropZone";
113
+ export { TableColumnVisibility } from "./TableColumnVisibility";
114
+ export { TreeSelect } from "./TreeSelect";
115
+ export { Upload } from "./Upload";
116
+ export type { UploadProps } from "./Upload";
117
+ export { UploadList } from "./UploadList";
118
+ export type { UploadListProps } from "./UploadList";
119
+ export type { UploadFile, UploadStatus, UploadRequest, UploadResult, } from "./uploadTypes";
120
+ export { Timeline } from "./Timeline";
121
+ export type { TimelineProps, TimelineItem } from "./Timeline";
122
+ export { RangeSlider } from "./RangeSlider";
123
+ export type { RangeSliderProps } from "./RangeSlider";
124
+ export type { RangeValue } from "./rangeMath";
125
+ export type { TreeSelectProps } from "./TreeSelect";
126
+ export { Cascader } from "./Cascader";
127
+ export type { CascaderProps } from "./Cascader";
128
+ export type { HierarchyOption, HierarchyLoader } from "./hierarchy";
129
+ export { Popconfirm } from "./Popconfirm";
130
+ export type { PopconfirmProps } from "./Popconfirm";
131
+ export { Descriptions } from "./Descriptions";
132
+ export type { DescriptionsProps, DescriptionItem } from "./Descriptions";
133
+ export { Statistic } from "./Statistic";
134
+ export type { StatisticProps } from "./Statistic";
135
+ export type { DataTableProps, TableSort, TableFilters, TablePagination, } from "./DataTable";
136
+ export { Card } from "./Card";
137
+ export { Tabs } from "./Tabs";
138
+ export { Table } from "./Table";
139
+ export { Menu } from "./Menu";
140
+ export { UIProvider, useUIConfig } from "./UIProvider";
141
+ export type { UIConfig } from "./UIProvider";
142
+ export { ThemeProvider } from "./ThemeProvider";
143
+ export type { UITheme, ColorMode } from "./ThemeProvider";
144
+ export { ThemeStylePicker } from "./ThemeStylePicker";
145
+ export { AppShell, ShellHeader } from "./AppShell";
146
+ export type { NavigationItem } from "./AppShell";
147
+ export { SettingsLayout, SettingsCard } from "./SettingsLayout";
148
+ export { AppearanceSettings } from "./AppearanceSettings";
149
+ export { appearanceDefaults, normalizeAppearance } from "./appearance";
150
+ export type { AppearancePreferences } from "./appearance";
@@ -0,0 +1,219 @@
1
+ import { Badge } from "./Badge.js";
2
+ import { Button } from "./Button.js";
3
+ import { Checkbox } from "./Checkbox.js";
4
+ import { ColorField } from "./ColorField.js";
5
+ import { DatePicker } from "./DatePicker.js";
6
+ import { Dialog } from "./Dialog.js";
7
+ import { EmptyState } from "./EmptyState.js";
8
+ import { FileDropZone } from "./FileDropZone.js";
9
+ import { FilePicker } from "./FilePicker.js";
10
+ import { IconButton } from "./IconButton.js";
11
+ import { Input } from "./Input.js";
12
+ import { MultiSelect } from "./MultiSelect.js";
13
+ import { NumberInput } from "./NumberInput.js";
14
+ import { Page } from "./Page.js";
15
+ import { Popover } from "./Popover.js";
16
+ import { Progress } from "./Progress.js";
17
+ import { SearchField } from "./SearchField.js";
18
+ import { Section } from "./Section.js";
19
+ import { Segmented } from "./Segmented.js";
20
+ import { Select } from "./Select.js";
21
+ import { SettingRow } from "./SettingRow.js";
22
+ import { Skeleton } from "./Skeleton.js";
23
+ import { SkeletonRows } from "./SkeletonRows.js";
24
+ import { Switch } from "./Switch.js";
25
+ import { ToastProvider } from "./ToastProvider.js";
26
+ import { Tooltip } from "./Tooltip.js";
27
+ import { FileDropOverlay } from "./FileDropOverlay.js";
28
+ import { DisclosureChevron } from "./DisclosureChevron.js";
29
+ import { ColorPicker } from "./ColorPicker.js";
30
+ import { Textarea } from "./Textarea.js";
31
+ import { ThemePicker } from "./ThemePicker.js";
32
+ import { Toast } from "./Toast.js";
33
+ import { SplitButton } from "./SplitButton.js";
34
+ import { Calendar } from "./Calendar.js";
35
+ import { TimeColumns } from "./TimeColumns.js";
36
+ import { RadioGroup } from "./RadioGroup.js";
37
+ import { Slider } from "./Slider.js";
38
+ import { Accordion } from "./Accordion.js";
39
+ import { useToast } from "./ToastProvider.js";
40
+ import { Divider } from "./Divider.js";
41
+ import { CatalogIcon } from "./CatalogIcon.js";
42
+ import { CharacterPicker } from "./CharacterPicker.js";
43
+ import { DataTable } from "./DataTable.js";
44
+ import { EmojiPicker } from "./EmojiPicker.js";
45
+ import { FileTree } from "./FileTree.js";
46
+ import { IconPicker } from "./IconPicker.js";
47
+ import { LoadingOverlay } from "./LoadingOverlay.js";
48
+ import { LoadingState } from "./LoadingState.js";
49
+ import { Pagination } from "./Pagination.js";
50
+ import { Placeholder } from "./Placeholder.js";
51
+ import { ShortcutInput } from "./ShortcutInput.js";
52
+ import { Spinner } from "./Spinner.js";
53
+ import { SymbolPicker } from "./SymbolPicker.js";
54
+ import { TableColumnFilter } from "./TableColumnFilter.js";
55
+ import { SelectTrigger } from "./SelectTrigger.js";
56
+ import { BlockedTab } from "./BlockedTab.js";
57
+ import { UnderlinedTab } from "./UnderlinedTab.js";
58
+ import { Indicator } from "./Indicator.js";
59
+ import { VirtualPickerList } from "./VirtualPickerList.js";
60
+ import { SkinTonePicker } from "./SkinTonePicker.js";
61
+ import { ContextMenu } from "./ContextMenu.js";
62
+ import { ContextMenuPanel } from "./ContextMenuPanel.js";
63
+ import { SelectOptionContent } from "./SelectOptionContent.js";
64
+ import { MenuItem } from "./MenuItem.js";
65
+ import { Form } from "./Form.js";
66
+ import { FormField } from "./FormField.js";
67
+ import { FieldLabel } from "./FieldLabel.js";
68
+ import { FormGroup } from "./FormGroup.js";
69
+ import { FormErrorSummary } from "./FormErrorSummary.js";
70
+ import { useFormState } from "./useFormState.js";
71
+ import { PinInput } from "./PinInput.js";
72
+ import { ContributionCalendar } from "./ContributionCalendar.js";
73
+ import { Combobox } from "./Combobox.js";
74
+ import { TagInput } from "./TagInput.js";
75
+ import { PasswordField } from "./PasswordField.js";
76
+ import { Alert } from "./Alert.js";
77
+ import { Drawer } from "./Drawer.js";
78
+ import { Steps } from "./Steps.js";
79
+ import { Breadcrumb } from "./Breadcrumb.js";
80
+ import { Avatar } from "./Avatar.js";
81
+ import { AvatarGroup } from "./AvatarGroup.js";
82
+ import { CommandPalette } from "./CommandPalette.js";
83
+ import { ResizablePanel } from "./ResizablePanel.js";
84
+ import { DateRangePicker } from "./DateRangePicker.js";
85
+ import { validateFiles, formatFileSize } from "./fileSelection.js";
86
+ import { TableColumnVisibility } from "./TableColumnVisibility.js";
87
+ import { TreeSelect } from "./TreeSelect.js";
88
+ import { Upload } from "./Upload.js";
89
+ import { UploadList } from "./UploadList.js";
90
+ import { Timeline } from "./Timeline.js";
91
+ import { RangeSlider } from "./RangeSlider.js";
92
+ import { Cascader } from "./Cascader.js";
93
+ import { Popconfirm } from "./Popconfirm.js";
94
+ import { Descriptions } from "./Descriptions.js";
95
+ import { Statistic } from "./Statistic.js";
96
+ import { Card } from "./Card.js";
97
+ import { Tabs } from "./Tabs.js";
98
+ import { Table } from "./Table.js";
99
+ import { Menu } from "./Menu.js";
100
+ import { UIProvider, useUIConfig } from "./UIProvider.js";
101
+ import { ThemeProvider } from "./ThemeProvider.js";
102
+ import { ThemeStylePicker } from "./ThemeStylePicker.js";
103
+ import { AppShell, ShellHeader } from "./AppShell.js";
104
+ import { SettingsLayout, SettingsCard } from "./SettingsLayout.js";
105
+ import { AppearanceSettings } from "./AppearanceSettings.js";
106
+ import { appearanceDefaults, normalizeAppearance } from "./appearance.js";
107
+ export {
108
+ Accordion,
109
+ Alert,
110
+ AppShell,
111
+ AppearanceSettings,
112
+ Avatar,
113
+ AvatarGroup,
114
+ Badge,
115
+ BlockedTab,
116
+ Breadcrumb,
117
+ Button,
118
+ Calendar,
119
+ Card,
120
+ Cascader,
121
+ CatalogIcon,
122
+ CharacterPicker,
123
+ Checkbox,
124
+ ColorField,
125
+ ColorPicker,
126
+ Combobox,
127
+ CommandPalette,
128
+ ContextMenu,
129
+ ContextMenuPanel,
130
+ ContributionCalendar,
131
+ DataTable,
132
+ DatePicker,
133
+ DateRangePicker,
134
+ Descriptions,
135
+ Dialog,
136
+ DisclosureChevron,
137
+ Divider,
138
+ Drawer,
139
+ EmojiPicker,
140
+ EmptyState,
141
+ FieldLabel,
142
+ FileDropOverlay,
143
+ FileDropZone,
144
+ FilePicker,
145
+ FileTree,
146
+ Form,
147
+ FormErrorSummary,
148
+ FormField,
149
+ FormGroup,
150
+ IconButton,
151
+ IconPicker,
152
+ Indicator,
153
+ Input,
154
+ LoadingOverlay,
155
+ LoadingState,
156
+ Menu,
157
+ MenuItem,
158
+ MultiSelect,
159
+ NumberInput,
160
+ Page,
161
+ Pagination,
162
+ PasswordField,
163
+ PinInput,
164
+ Placeholder,
165
+ Popconfirm,
166
+ Popover,
167
+ Progress,
168
+ RadioGroup,
169
+ RangeSlider,
170
+ ResizablePanel,
171
+ SearchField,
172
+ Section,
173
+ Segmented,
174
+ Select,
175
+ SelectOptionContent,
176
+ SelectTrigger,
177
+ SettingRow,
178
+ SettingsCard,
179
+ SettingsLayout,
180
+ ShellHeader,
181
+ ShortcutInput,
182
+ Skeleton,
183
+ SkeletonRows,
184
+ SkinTonePicker,
185
+ Slider,
186
+ Spinner,
187
+ SplitButton,
188
+ Statistic,
189
+ Steps,
190
+ Switch,
191
+ SymbolPicker,
192
+ Table,
193
+ TableColumnFilter,
194
+ TableColumnVisibility,
195
+ Tabs,
196
+ TagInput,
197
+ Textarea,
198
+ ThemePicker,
199
+ ThemeProvider,
200
+ ThemeStylePicker,
201
+ TimeColumns,
202
+ Timeline,
203
+ Toast,
204
+ ToastProvider,
205
+ Tooltip,
206
+ TreeSelect,
207
+ UIProvider,
208
+ UnderlinedTab,
209
+ Upload,
210
+ UploadList,
211
+ VirtualPickerList,
212
+ appearanceDefaults,
213
+ formatFileSize,
214
+ normalizeAppearance,
215
+ useFormState,
216
+ useToast,
217
+ useUIConfig,
218
+ validateFiles
219
+ };
@@ -0,0 +1,7 @@
1
+ type MenuKeyEvent = {
2
+ key: string;
3
+ defaultPrevented?: boolean;
4
+ preventDefault(): void;
5
+ };
6
+ export declare function moveMenuFocus(event: MenuKeyEvent, root: HTMLElement | null): boolean;
7
+ export {};
@@ -0,0 +1,21 @@
1
+ function moveMenuFocus(event, root) {
2
+ if (!root || event.defaultPrevented || !["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key))
3
+ return false;
4
+ if ((event.key === "Home" || event.key === "End") && !root.contains(document.activeElement))
5
+ return false;
6
+ const items = [
7
+ ...root.querySelectorAll(
8
+ '[data-menu-item],a[role="menuitem"]'
9
+ )
10
+ ].filter(
11
+ (node) => node.matches("button,a[href],[tabindex]") && !node.matches(':disabled,[aria-disabled="true"]')
12
+ );
13
+ if (!items.length) return false;
14
+ const active = items.indexOf(document.activeElement), next = event.key === "Home" ? 0 : event.key === "End" ? items.length - 1 : event.key === "ArrowDown" ? (active + 1) % items.length : active < 0 ? items.length - 1 : (active - 1 + items.length) % items.length;
15
+ event.preventDefault();
16
+ items[next].focus();
17
+ return true;
18
+ }
19
+ export {
20
+ moveMenuFocus
21
+ };
@@ -0,0 +1,6 @@
1
+ export type MenuPoint = {
2
+ x: number;
3
+ y: number;
4
+ time: number;
5
+ };
6
+ export declare function movingTowardSubmenu(origin: MenuPoint | undefined, point: MenuPoint, rect: DOMRect): boolean;
@@ -0,0 +1,13 @@
1
+ function movingTowardSubmenu(origin, point, rect) {
2
+ if (!origin || point.time - origin.time > 400) return false;
3
+ const edge = rect.left >= origin.x ? rect.left : rect.right <= origin.x ? rect.right : void 0;
4
+ if (edge === void 0 || Math.abs(edge - point.x) >= Math.abs(edge - origin.x))
5
+ return false;
6
+ const a = origin, b = { x: edge, y: rect.top - 10 }, c = { x: edge, y: rect.bottom + 10 };
7
+ const cross = (p, q, r) => (p.x - r.x) * (q.y - r.y) - (q.x - r.x) * (p.y - r.y);
8
+ const d1 = cross(point, a, b), d2 = cross(point, b, c), d3 = cross(point, c, a);
9
+ return !([d1, d2, d3].some((d) => d < 0) && [d1, d2, d3].some((d) => d > 0));
10
+ }
11
+ export {
12
+ movingTowardSubmenu
13
+ };
@@ -0,0 +1,24 @@
1
+ import type { CSSProperties, ReactNode } from "react";
2
+ export type ContextMenuItem = {
3
+ id: string;
4
+ type: "separator";
5
+ } | {
6
+ id: string;
7
+ type?: "item" | "checkbox" | "radio";
8
+ label: string;
9
+ description?: string;
10
+ icon?: ReactNode;
11
+ shortcut?: string;
12
+ color?: string;
13
+ tone?: "default" | "danger";
14
+ style?: CSSProperties;
15
+ className?: string;
16
+ disabled?: boolean;
17
+ checked?: boolean;
18
+ children?: ContextMenuItem[];
19
+ onSelect?(): void | Promise<void>;
20
+ closeOnSelect?: boolean;
21
+ };
22
+ export type MenuAction = Extract<ContextMenuItem, {
23
+ label: string;
24
+ }>;
File without changes
@@ -0,0 +1,9 @@
1
+ type Phase = "enter" | "update" | "exit";
2
+ export declare const reducedMotion: () => boolean;
3
+ export declare function motionDuration(token: string, fallback?: number): number;
4
+ export declare const popupExitDuration: () => number;
5
+ export declare function cancelMotion(node: HTMLElement): void;
6
+ export declare function surfaceMotion(node: HTMLElement, phase: Phase, offset?: string, token?: string): Promise<boolean>;
7
+ export type MenuSide = "top" | "bottom" | "left" | "right";
8
+ export declare function menuSurfaceMotion(node: HTMLElement, phase: "enter" | "exit", side?: MenuSide): Promise<boolean>;
9
+ export {};
@@ -0,0 +1,82 @@
1
+ const runs = /* @__PURE__ */ new WeakMap();
2
+ const reducedMotion = () => ["false", "off"].includes(document.documentElement.dataset.motion || "") || matchMedia("(prefers-reduced-motion: reduce)").matches;
3
+ function motionDuration(token, fallback = 180) {
4
+ if (reducedMotion()) return 0;
5
+ const raw = getComputedStyle(document.documentElement).getPropertyValue(token).trim();
6
+ const value = parseFloat(raw);
7
+ return Number.isFinite(value) ? value * (raw.endsWith("ms") ? 1 : 1e3) : fallback;
8
+ }
9
+ const popupExitDuration = () => motionDuration("--popup-exit", 120);
10
+ function cancelMotion(node) {
11
+ const state = runs.get(node);
12
+ if (state) {
13
+ state.revision++;
14
+ state.animation?.cancel();
15
+ state.animation = void 0;
16
+ }
17
+ }
18
+ function surfaceMotion(node, phase, offset = "0 -4px", token) {
19
+ const state = runs.get(node) || { revision: 0 };
20
+ runs.set(node, state);
21
+ const revision = ++state.revision, interrupted = !!state.animation, style = getComputedStyle(node);
22
+ const from = {
23
+ opacity: interrupted ? style.opacity : phase === "enter" ? "0" : phase === "update" ? ".78" : "1",
24
+ translate: interrupted ? style.translate : phase === "enter" ? offset : phase === "update" ? "0 2px" : "0 0"
25
+ };
26
+ state.animation?.cancel();
27
+ const to = {
28
+ opacity: phase === "exit" ? "0" : "1",
29
+ translate: phase === "exit" ? offset : "0 0"
30
+ };
31
+ node.dataset.motionPhase = phase;
32
+ const finish = () => {
33
+ if (revision !== state.revision) return false;
34
+ Object.assign(node.style, to);
35
+ state.animation?.cancel();
36
+ state.animation = void 0;
37
+ node.dataset.motionPhase = phase === "exit" ? "hidden" : "visible";
38
+ return true;
39
+ };
40
+ const duration = motionDuration(
41
+ token || (phase === "enter" ? "--popup-enter" : "--popup-exit")
42
+ );
43
+ if (!duration || !node.isConnected) return Promise.resolve(finish());
44
+ const animation = node.animate([from, to], {
45
+ duration,
46
+ easing: getComputedStyle(document.documentElement).getPropertyValue("--ease").trim() || "ease-out",
47
+ fill: "both"
48
+ });
49
+ state.animation = animation;
50
+ const policy = matchMedia("(prefers-reduced-motion: reduce)");
51
+ const stop = () => {
52
+ if (reducedMotion() && animation.playState !== "finished")
53
+ animation.finish();
54
+ };
55
+ const observer = new MutationObserver(stop);
56
+ observer.observe(document.documentElement, {
57
+ attributes: true,
58
+ attributeFilter: ["data-motion"]
59
+ });
60
+ policy.addEventListener("change", stop);
61
+ return animation.finished.then(finish, () => false).finally(() => {
62
+ observer.disconnect();
63
+ policy.removeEventListener("change", stop);
64
+ });
65
+ }
66
+ function menuSurfaceMotion(node, phase, side = "bottom") {
67
+ const offset = {
68
+ top: "0 4px",
69
+ bottom: "0 -4px",
70
+ left: "4px 0",
71
+ right: "-4px 0"
72
+ }[side];
73
+ return surfaceMotion(node, phase, offset);
74
+ }
75
+ export {
76
+ cancelMotion,
77
+ menuSurfaceMotion,
78
+ motionDuration,
79
+ popupExitDuration,
80
+ reducedMotion,
81
+ surfaceMotion
82
+ };
@@ -0,0 +1,12 @@
1
+ export type RangeValue = [number, number];
2
+ export declare function rangeSettings(minimum?: number, maximum?: number, increment?: number, minDistance?: number): {
3
+ min: number;
4
+ max: number;
5
+ step: number;
6
+ count: number;
7
+ gap: number;
8
+ indexOf: (value: number) => number;
9
+ toValue: (index: number) => number;
10
+ normalize: (value: RangeValue) => RangeValue;
11
+ };
12
+ export declare function moveRange(value: RangeValue, index: 0 | 1, target: number, settings: ReturnType<typeof rangeSettings>): RangeValue;
@@ -0,0 +1,30 @@
1
+ const finite = (n, fallback) => typeof n === "number" && Number.isFinite(n) ? n : fallback;
2
+ const round = (n) => Number(n.toFixed(10));
3
+ function rangeSettings(minimum = 0, maximum = 100, increment = 1, minDistance = 0) {
4
+ const min = finite(minimum, 0), requestedMax = Math.max(min, finite(maximum, min + 100)), span = Number.isFinite(requestedMax - min) ? requestedMax - min : 0, safeStep = finite(increment, 1), step = span ? Math.min(span, Math.max(1e-8, safeStep > 0 ? safeStep : 1)) : 1, count = Math.max(0, Math.floor(span / step + 1e-8)), max = round(min + count * step), gap = Math.min(
5
+ count,
6
+ Math.max(0, Math.ceil(finite(minDistance, 0) / step - 1e-8))
7
+ );
8
+ const indexOf = (value) => Math.min(
9
+ count,
10
+ Math.max(0, Math.round((finite(value, min) - min) / step))
11
+ ), toValue = (index) => round(min + index * step);
12
+ const normalize = (value) => {
13
+ const a = indexOf(value[0]), b = indexOf(value[1]);
14
+ let low = Math.min(a, b), high = Math.max(a, b);
15
+ if (high - low < gap) {
16
+ high = Math.min(count, low + gap);
17
+ low = Math.min(low, high - gap);
18
+ }
19
+ return [toValue(low), toValue(high)];
20
+ };
21
+ return { min, max, step, count, gap, indexOf, toValue, normalize };
22
+ }
23
+ function moveRange(value, index, target, settings) {
24
+ const current = settings.normalize(value), low = settings.indexOf(current[0]), high = settings.indexOf(current[1]), next = settings.indexOf(target);
25
+ return index === 0 ? [settings.toValue(Math.min(next, high - settings.gap)), current[1]] : [current[0], settings.toValue(Math.max(next, low + settings.gap))];
26
+ }
27
+ export {
28
+ moveRange,
29
+ rangeSettings
30
+ };