@robert-stackflow/oneui 0.0.0-stage → 0.2.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 (380) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +72 -2
  3. package/assets/LUCIDE-LICENSE.txt +43 -0
  4. package/assets/character-metadata.json +1 -0
  5. package/assets/emoji.json +1 -0
  6. package/assets/icon-catalog.json +1 -0
  7. package/assets/symbols.json +1 -0
  8. package/components/Accessibility.module.css +8 -0
  9. package/components/Accordion.d.ts +7 -0
  10. package/components/Accordion.js +41 -0
  11. package/components/Accordion.module.css +38 -0
  12. package/components/Alert.d.ts +9 -0
  13. package/components/Alert.js +42 -0
  14. package/components/Alert.module.css +56 -0
  15. package/components/AppShell.d.ts +30 -0
  16. package/components/AppShell.js +152 -0
  17. package/components/AppShell.module.css +239 -0
  18. package/components/AppearanceSettings.d.ts +7 -0
  19. package/components/AppearanceSettings.js +201 -0
  20. package/components/AppearanceSettings.module.css +32 -0
  21. package/components/Avatar.d.ts +14 -0
  22. package/components/Avatar.js +69 -0
  23. package/components/Avatar.module.css +70 -0
  24. package/components/AvatarGroup.d.ts +15 -0
  25. package/components/AvatarGroup.js +115 -0
  26. package/components/AvatarGroup.module.css +54 -0
  27. package/components/Badge.d.ts +5 -0
  28. package/components/Badge.js +11 -0
  29. package/components/Badge.module.css +30 -0
  30. package/components/BlockedTab.d.ts +4 -0
  31. package/components/BlockedTab.js +10 -0
  32. package/components/Breadcrumb.d.ts +16 -0
  33. package/components/Breadcrumb.js +157 -0
  34. package/components/Breadcrumb.module.css +97 -0
  35. package/components/Button.d.ts +13 -0
  36. package/components/Button.js +52 -0
  37. package/components/Button.module.css +88 -0
  38. package/components/Calendar.d.ts +10 -0
  39. package/components/Calendar.js +260 -0
  40. package/components/Calendar.module.css +106 -0
  41. package/components/Card.d.ts +8 -0
  42. package/components/Card.js +29 -0
  43. package/components/Card.module.css +47 -0
  44. package/components/Cascader.d.ts +14 -0
  45. package/components/Cascader.js +296 -0
  46. package/components/CatalogIcon.d.ts +3 -0
  47. package/components/CatalogIcon.js +11 -0
  48. package/components/CharacterPicker.d.ts +15 -0
  49. package/components/CharacterPicker.js +200 -0
  50. package/components/Checkbox.d.ts +12 -0
  51. package/components/Checkbox.js +82 -0
  52. package/components/Checkbox.module.css +95 -0
  53. package/components/ColorField.d.ts +6 -0
  54. package/components/ColorField.js +61 -0
  55. package/components/ColorField.module.css +15 -0
  56. package/components/ColorPicker.d.ts +5 -0
  57. package/components/ColorPicker.js +188 -0
  58. package/components/ColorPicker.module.css +90 -0
  59. package/components/Combobox.d.ts +13 -0
  60. package/components/Combobox.js +338 -0
  61. package/components/Combobox.module.css +24 -0
  62. package/components/CommandPalette.d.ts +25 -0
  63. package/components/CommandPalette.js +269 -0
  64. package/components/CommandPalette.module.css +49 -0
  65. package/components/ContextMenu.d.ts +9 -0
  66. package/components/ContextMenu.js +363 -0
  67. package/components/ContextMenu.module.css +42 -0
  68. package/components/ContextMenuPanel.d.ts +22 -0
  69. package/components/ContextMenuPanel.js +155 -0
  70. package/components/ContributionCalendar.d.ts +18 -0
  71. package/components/ContributionCalendar.js +201 -0
  72. package/components/ContributionCalendar.module.css +114 -0
  73. package/components/ContributionCell.d.ts +11 -0
  74. package/components/ContributionCell.js +41 -0
  75. package/components/Control.module.css +86 -0
  76. package/components/DataTable.d.ts +49 -0
  77. package/components/DataTable.js +220 -0
  78. package/components/DataTable.module.css +112 -0
  79. package/components/DatePicker.d.ts +15 -0
  80. package/components/DatePicker.js +186 -0
  81. package/components/DatePicker.module.css +85 -0
  82. package/components/DateRangePicker.d.ts +9 -0
  83. package/components/DateRangePicker.js +168 -0
  84. package/components/Descriptions.d.ts +21 -0
  85. package/components/Descriptions.js +162 -0
  86. package/components/Descriptions.module.css +117 -0
  87. package/components/Dialog.d.ts +14 -0
  88. package/components/Dialog.js +125 -0
  89. package/components/Dialog.module.css +88 -0
  90. package/components/DialogVariants.d.ts +27 -0
  91. package/components/DialogVariants.js +161 -0
  92. package/components/DialogVariants.module.css +29 -0
  93. package/components/DisclosureChevron.d.ts +3 -0
  94. package/components/DisclosureChevron.js +17 -0
  95. package/components/DisclosureChevron.module.css +17 -0
  96. package/components/Divider.d.ts +5 -0
  97. package/components/Divider.js +24 -0
  98. package/components/Divider.module.css +19 -0
  99. package/components/Drawer.d.ts +18 -0
  100. package/components/Drawer.js +145 -0
  101. package/components/Drawer.module.css +109 -0
  102. package/components/EmojiPicker.d.ts +6 -0
  103. package/components/EmojiPicker.js +19 -0
  104. package/components/EmptyState.d.ts +8 -0
  105. package/components/EmptyState.js +20 -0
  106. package/components/EmptyState.module.css +30 -0
  107. package/components/FieldLabel.d.ts +8 -0
  108. package/components/FieldLabel.js +20 -0
  109. package/components/FieldMessages.d.ts +5 -0
  110. package/components/FieldMessages.js +15 -0
  111. package/components/FileDropOverlay.d.ts +5 -0
  112. package/components/FileDropOverlay.js +26 -0
  113. package/components/FileDropOverlay.module.css +55 -0
  114. package/components/FileDropZone.d.ts +15 -0
  115. package/components/FileDropZone.js +113 -0
  116. package/components/FileDropZone.module.css +6 -0
  117. package/components/FilePicker.d.ts +10 -0
  118. package/components/FilePicker.js +59 -0
  119. package/components/FileSelectionFeedback.d.ts +5 -0
  120. package/components/FileSelectionFeedback.js +23 -0
  121. package/components/FileSelectionFeedback.module.css +14 -0
  122. package/components/FileTree.d.ts +13 -0
  123. package/components/FileTree.js +125 -0
  124. package/components/FileTree.module.css +66 -0
  125. package/components/Form.d.ts +7 -0
  126. package/components/Form.js +26 -0
  127. package/components/Form.module.css +7 -0
  128. package/components/FormErrorSummary.d.ts +6 -0
  129. package/components/FormErrorSummary.js +27 -0
  130. package/components/FormErrorSummary.module.css +27 -0
  131. package/components/FormField.d.ts +9 -0
  132. package/components/FormField.js +59 -0
  133. package/components/FormField.module.css +85 -0
  134. package/components/FormGroup.d.ts +9 -0
  135. package/components/FormGroup.js +32 -0
  136. package/components/HierarchyPicker.module.css +181 -0
  137. package/components/IconButton.d.ts +7 -0
  138. package/components/IconButton.js +30 -0
  139. package/components/IconButton.module.css +42 -0
  140. package/components/IconPicker.d.ts +6 -0
  141. package/components/IconPicker.js +111 -0
  142. package/components/Indicator.d.ts +18 -0
  143. package/components/Indicator.js +97 -0
  144. package/components/Indicator.module.css +83 -0
  145. package/components/Input.d.ts +8 -0
  146. package/components/Input.js +37 -0
  147. package/components/Input.module.css +40 -0
  148. package/components/LoadingOverlay.d.ts +6 -0
  149. package/components/LoadingOverlay.js +16 -0
  150. package/components/LoadingOverlay.module.css +22 -0
  151. package/components/LoadingState.d.ts +7 -0
  152. package/components/LoadingState.js +40 -0
  153. package/components/LoadingState.module.css +17 -0
  154. package/components/Menu.d.ts +11 -0
  155. package/components/Menu.js +82 -0
  156. package/components/MenuItem.d.ts +15 -0
  157. package/components/MenuItem.js +51 -0
  158. package/components/MenuItem.module.css +172 -0
  159. package/components/MenuItemContent.d.ts +8 -0
  160. package/components/MenuItemContent.js +19 -0
  161. package/components/MultiSelect.d.ts +13 -0
  162. package/components/MultiSelect.js +225 -0
  163. package/components/MultiSelect.module.css +99 -0
  164. package/components/NumberInput.d.ts +12 -0
  165. package/components/NumberInput.js +114 -0
  166. package/components/NumberInput.module.css +33 -0
  167. package/components/OptionList.module.css +12 -0
  168. package/components/Page.d.ts +7 -0
  169. package/components/Page.js +22 -0
  170. package/components/Page.module.css +44 -0
  171. package/components/Pagination.d.ts +11 -0
  172. package/components/Pagination.js +160 -0
  173. package/components/Pagination.module.css +70 -0
  174. package/components/PasswordField.d.ts +9 -0
  175. package/components/PasswordField.js +102 -0
  176. package/components/PasswordField.module.css +64 -0
  177. package/components/Picker.module.css +52 -0
  178. package/components/PinInput.d.ts +13 -0
  179. package/components/PinInput.js +173 -0
  180. package/components/PinInput.module.css +72 -0
  181. package/components/Placeholder.d.ts +31 -0
  182. package/components/Placeholder.js +36 -0
  183. package/components/Popconfirm.d.ts +17 -0
  184. package/components/Popconfirm.js +159 -0
  185. package/components/Popconfirm.module.css +49 -0
  186. package/components/Popover.d.ts +16 -0
  187. package/components/Popover.js +156 -0
  188. package/components/Popover.module.css +19 -0
  189. package/components/Progress.d.ts +5 -0
  190. package/components/Progress.js +31 -0
  191. package/components/Progress.module.css +33 -0
  192. package/components/RadioGroup.d.ts +15 -0
  193. package/components/RadioGroup.js +73 -0
  194. package/components/RadioGroup.module.css +87 -0
  195. package/components/RangeSlider.d.ts +22 -0
  196. package/components/RangeSlider.js +278 -0
  197. package/components/RangeSlider.module.css +141 -0
  198. package/components/ResizablePanel.d.ts +21 -0
  199. package/components/ResizablePanel.js +219 -0
  200. package/components/ResizablePanel.module.css +101 -0
  201. package/components/SearchField.d.ts +11 -0
  202. package/components/SearchField.js +67 -0
  203. package/components/SearchField.module.css +37 -0
  204. package/components/Section.d.ts +6 -0
  205. package/components/Section.js +18 -0
  206. package/components/Section.module.css +14 -0
  207. package/components/Segmented.d.ts +11 -0
  208. package/components/Segmented.js +77 -0
  209. package/components/Segmented.module.css +82 -0
  210. package/components/Select.d.ts +11 -0
  211. package/components/Select.js +172 -0
  212. package/components/Select.module.css +24 -0
  213. package/components/SelectOptionContent.d.ts +5 -0
  214. package/components/SelectOptionContent.js +20 -0
  215. package/components/SelectOptionContent.module.css +7 -0
  216. package/components/SelectTrigger.d.ts +5 -0
  217. package/components/SelectTrigger.js +32 -0
  218. package/components/SelectTrigger.module.css +24 -0
  219. package/components/SelectionTag.d.ts +8 -0
  220. package/components/SelectionTag.js +39 -0
  221. package/components/SettingRow.d.ts +7 -0
  222. package/components/SettingRow.js +19 -0
  223. package/components/SettingRow.module.css +44 -0
  224. package/components/SettingsLayout.d.ts +11 -0
  225. package/components/SettingsLayout.js +61 -0
  226. package/components/SettingsLayout.module.css +68 -0
  227. package/components/ShortcutInput.d.ts +8 -0
  228. package/components/ShortcutInput.js +131 -0
  229. package/components/ShortcutInput.module.css +39 -0
  230. package/components/Skeleton.d.ts +5 -0
  231. package/components/Skeleton.js +19 -0
  232. package/components/Skeleton.module.css +27 -0
  233. package/components/SkeletonRows.d.ts +4 -0
  234. package/components/SkeletonRows.js +19 -0
  235. package/components/SkeletonRows.module.css +19 -0
  236. package/components/SkinTonePicker.d.ts +4 -0
  237. package/components/SkinTonePicker.js +43 -0
  238. package/components/SkinTonePicker.module.css +50 -0
  239. package/components/Slider.d.ts +10 -0
  240. package/components/Slider.js +40 -0
  241. package/components/Slider.module.css +19 -0
  242. package/components/Spinner.d.ts +6 -0
  243. package/components/Spinner.js +31 -0
  244. package/components/Spinner.module.css +57 -0
  245. package/components/SplitButton.d.ts +17 -0
  246. package/components/SplitButton.js +102 -0
  247. package/components/SplitButton.module.css +56 -0
  248. package/components/Statistic.d.ts +22 -0
  249. package/components/Statistic.js +102 -0
  250. package/components/Statistic.module.css +55 -0
  251. package/components/Steps.d.ts +19 -0
  252. package/components/Steps.js +102 -0
  253. package/components/Steps.module.css +176 -0
  254. package/components/Switch.d.ts +6 -0
  255. package/components/Switch.js +25 -0
  256. package/components/Switch.module.css +59 -0
  257. package/components/SymbolPicker.d.ts +6 -0
  258. package/components/SymbolPicker.js +18 -0
  259. package/components/Tab.module.css +145 -0
  260. package/components/TabList.d.ts +11 -0
  261. package/components/TabList.js +51 -0
  262. package/components/Table.d.ts +16 -0
  263. package/components/Table.js +30 -0
  264. package/components/Table.module.css +48 -0
  265. package/components/TableColumnFilter.d.ts +6 -0
  266. package/components/TableColumnFilter.js +76 -0
  267. package/components/TableColumnVisibility.d.ts +11 -0
  268. package/components/TableColumnVisibility.js +76 -0
  269. package/components/Tabs.d.ts +13 -0
  270. package/components/Tabs.js +49 -0
  271. package/components/Tabs.module.css +3 -0
  272. package/components/TagInput.d.ts +11 -0
  273. package/components/TagInput.js +142 -0
  274. package/components/TagInput.module.css +64 -0
  275. package/components/Textarea.d.ts +6 -0
  276. package/components/Textarea.js +24 -0
  277. package/components/Textarea.module.css +9 -0
  278. package/components/ThemePicker.d.ts +6 -0
  279. package/components/ThemePicker.js +78 -0
  280. package/components/ThemePicker.module.css +178 -0
  281. package/components/ThemeProvider.d.ts +11 -0
  282. package/components/ThemeProvider.js +94 -0
  283. package/components/ThemeStylePicker.d.ts +5 -0
  284. package/components/ThemeStylePicker.js +22 -0
  285. package/components/TimeColumns.d.ts +6 -0
  286. package/components/TimeColumns.js +55 -0
  287. package/components/TimeColumns.module.css +47 -0
  288. package/components/Timeline.d.ts +26 -0
  289. package/components/Timeline.js +131 -0
  290. package/components/Timeline.module.css +202 -0
  291. package/components/Toast.d.ts +6 -0
  292. package/components/Toast.js +181 -0
  293. package/components/Toast.module.css +175 -0
  294. package/components/ToastProvider.d.ts +35 -0
  295. package/components/ToastProvider.js +47 -0
  296. package/components/Tooltip.d.ts +10 -0
  297. package/components/Tooltip.js +169 -0
  298. package/components/Tooltip.module.css +53 -0
  299. package/components/TreeGuides.d.ts +9 -0
  300. package/components/TreeGuides.js +39 -0
  301. package/components/TreeGuides.module.css +45 -0
  302. package/components/TreeSelect.d.ts +26 -0
  303. package/components/TreeSelect.js +337 -0
  304. package/components/TreeTable.d.ts +15 -0
  305. package/components/TreeTable.js +151 -0
  306. package/components/TreeTable.module.css +53 -0
  307. package/components/UIProvider.d.ts +10 -0
  308. package/components/UIProvider.js +20 -0
  309. package/components/UnderlinedTab.d.ts +2 -0
  310. package/components/UnderlinedTab.js +8 -0
  311. package/components/Upload.d.ts +22 -0
  312. package/components/Upload.js +165 -0
  313. package/components/Upload.module.css +36 -0
  314. package/components/UploadList.d.ts +9 -0
  315. package/components/UploadList.js +14 -0
  316. package/components/UploadList.module.css +130 -0
  317. package/components/UploadListItem.d.ts +13 -0
  318. package/components/UploadListItem.js +122 -0
  319. package/components/VirtualPickerList.d.ts +25 -0
  320. package/components/VirtualPickerList.js +269 -0
  321. package/components/VirtualPickerList.module.css +93 -0
  322. package/components/appearance.d.ts +20 -0
  323. package/components/appearance.js +69 -0
  324. package/components/characterCatalog.d.ts +9 -0
  325. package/components/characterCatalog.js +55 -0
  326. package/components/color.d.ts +7 -0
  327. package/components/color.js +18 -0
  328. package/components/contribution.d.ts +57 -0
  329. package/components/contribution.js +86 -0
  330. package/components/dateConstraints.d.ts +13 -0
  331. package/components/dateConstraints.js +44 -0
  332. package/components/field.d.ts +58 -0
  333. package/components/field.js +57 -0
  334. package/components/fileSelection.d.ts +21 -0
  335. package/components/fileSelection.js +43 -0
  336. package/components/hierarchy.d.ts +23 -0
  337. package/components/hierarchy.js +33 -0
  338. package/components/iconCatalog.d.ts +13 -0
  339. package/components/iconCatalog.js +80 -0
  340. package/components/index.d.ts +152 -0
  341. package/components/index.js +225 -0
  342. package/components/menuFocus.d.ts +7 -0
  343. package/components/menuFocus.js +21 -0
  344. package/components/menuPointer.d.ts +6 -0
  345. package/components/menuPointer.js +13 -0
  346. package/components/menuTypes.d.ts +24 -0
  347. package/components/menuTypes.js +0 -0
  348. package/components/motion.d.ts +9 -0
  349. package/components/motion.js +82 -0
  350. package/components/rangeMath.d.ts +12 -0
  351. package/components/rangeMath.js +30 -0
  352. package/components/surfacePortal.d.ts +13 -0
  353. package/components/surfacePortal.js +22 -0
  354. package/components/tooltipState.d.ts +5 -0
  355. package/components/tooltipState.js +48 -0
  356. package/components/types.d.ts +9 -0
  357. package/components/types.js +0 -0
  358. package/components/uploadTypes.d.ts +21 -0
  359. package/components/uploadTypes.js +0 -0
  360. package/components/useFormState.d.ts +51 -0
  361. package/components/useFormState.js +218 -0
  362. package/components/useHierarchy.d.ts +8 -0
  363. package/components/useHierarchy.js +80 -0
  364. package/components/useMenuLayers.d.ts +17 -0
  365. package/components/useMenuLayers.js +23 -0
  366. package/components/useModalScrollLock.d.ts +1 -0
  367. package/components/useModalScrollLock.js +18 -0
  368. package/components/usePopover.d.ts +8 -0
  369. package/components/usePopover.js +22 -0
  370. package/components/useTabIndicator.d.ts +12 -0
  371. package/components/useTabIndicator.js +63 -0
  372. package/components/useUploadQueue.d.ts +20 -0
  373. package/components/useUploadQueue.js +175 -0
  374. package/package.json +810 -3
  375. package/styles/base.css +206 -0
  376. package/styles/blue.css +268 -0
  377. package/styles/desktop.css +2 -0
  378. package/styles/minimal.css +337 -0
  379. package/styles/themes.css +2 -0
  380. package/styles/web.css +2 -0
@@ -0,0 +1,172 @@
1
+ .item {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: var(--menu-item-gap);
5
+ width: 100%;
6
+ min-width: 0;
7
+ min-height: var(--menu-item-height);
8
+ margin: 0;
9
+ padding: max(
10
+ 4px,
11
+ calc((var(--menu-item-height) - var(--menu-item-line-height)) / 2)
12
+ )
13
+ var(--menu-item-padding-x);
14
+ border: 0;
15
+ border-radius: calc(var(--radius) - 4px);
16
+ background: transparent;
17
+ color: var(--fg);
18
+ text-align: left;
19
+ font-family: var(--ui-font);
20
+ font-size: var(--menu-item-font-size);
21
+ font-weight: 400;
22
+ line-height: var(--menu-item-line-height);
23
+ cursor: pointer;
24
+ outline: none;
25
+ transition:
26
+ background-color var(--motion-hover),
27
+ color var(--motion-hover);
28
+ }
29
+ .item + .item {
30
+ margin-top: var(--menu-item-spacing);
31
+ }
32
+ @media (pointer: coarse) {
33
+ .item {
34
+ min-height: 44px;
35
+ }
36
+ }
37
+ .item[data-selected="true"] {
38
+ background: var(--selected);
39
+ }
40
+ .item:where(:not(:disabled):not([aria-disabled="true"])):is(
41
+ :hover,
42
+ :focus-visible,
43
+ [data-active="true"],
44
+ [aria-expanded="true"]
45
+ ) {
46
+ background: var(--hover);
47
+ }
48
+ .item[data-selected="true"]:where(
49
+ :not(:disabled):not([aria-disabled="true"])
50
+ ):is(:hover, :focus-visible, [data-active="true"]) {
51
+ background: color-mix(in srgb, var(--selected) 75%, var(--hover));
52
+ }
53
+ .item:where(:not(:disabled):not([aria-disabled="true"])):active {
54
+ background: var(--selected);
55
+ }
56
+ .item:disabled,
57
+ .item[aria-disabled="true"] {
58
+ opacity: var(--menu-disabled-opacity);
59
+ cursor: not-allowed;
60
+ }
61
+ .item[data-tone="danger"] {
62
+ color: var(--danger);
63
+ }
64
+ .leading,
65
+ .trailing {
66
+ display: grid;
67
+ place-items: center;
68
+ flex: 0 0 var(--menu-item-icon-size);
69
+ width: var(--menu-item-icon-size);
70
+ height: var(--menu-item-icon-size);
71
+ }
72
+ .leading {
73
+ color: inherit;
74
+ opacity: 0.8;
75
+ }
76
+ .leading svg,
77
+ .trailing > svg {
78
+ width: var(--menu-item-icon-size);
79
+ height: var(--menu-item-icon-size);
80
+ stroke-width: 1.65;
81
+ }
82
+ .copy {
83
+ flex: 1;
84
+ min-width: 0;
85
+ display: flex;
86
+ flex-direction: column;
87
+ gap: 2px;
88
+ }
89
+ .label {
90
+ min-width: 0;
91
+ overflow: hidden;
92
+ text-overflow: ellipsis;
93
+ white-space: nowrap;
94
+ }
95
+ .description {
96
+ white-space: nowrap;
97
+ overflow: hidden;
98
+ text-overflow: ellipsis;
99
+ font-size: 11px;
100
+ font-weight: 400;
101
+ line-height: 14px;
102
+ color: var(--muted);
103
+ }
104
+ .shortcut {
105
+ flex-shrink: 0;
106
+ margin-left: auto;
107
+ padding: 0;
108
+ border: 0;
109
+ border-radius: 0;
110
+ background: transparent;
111
+ box-shadow: none;
112
+ font-family: var(--ui-font);
113
+ font-size: var(--menu-shortcut-font-size);
114
+ font-weight: 400;
115
+ line-height: var(--menu-shortcut-line-height);
116
+ font-variant-numeric: tabular-nums;
117
+ color: var(--muted);
118
+ white-space: nowrap;
119
+ text-align: right;
120
+ }
121
+ .shortcut ~ .trailing:empty {
122
+ display: none;
123
+ }
124
+ .check {
125
+ color: var(--accent);
126
+ }
127
+ .checkbox,
128
+ .radio {
129
+ display: grid;
130
+ place-items: center;
131
+ width: var(--menu-item-icon-size);
132
+ height: var(--menu-item-icon-size);
133
+ border: 1px solid color-mix(in srgb, var(--fg) 25%, var(--surface));
134
+ background: var(--field);
135
+ transition:
136
+ background var(--motion-hover),
137
+ border-color var(--motion-hover);
138
+ }
139
+ .checkbox {
140
+ border-radius: 4px;
141
+ }
142
+ .checkbox[data-checked="true"] {
143
+ background: var(--accent);
144
+ border-color: var(--accent);
145
+ color: var(--on-accent);
146
+ }
147
+ .checkbox svg {
148
+ width: 12px;
149
+ height: 12px;
150
+ stroke-width: 2;
151
+ }
152
+ .radio {
153
+ border-radius: 50%;
154
+ }
155
+ .radio i {
156
+ width: 6px;
157
+ height: 6px;
158
+ border-radius: 50%;
159
+ background: var(--accent);
160
+ transform: scale(0);
161
+ transition: transform var(--motion-press) var(--ease);
162
+ }
163
+ .radio[data-checked="true"] {
164
+ border-color: var(--accent);
165
+ }
166
+ .radio[data-checked="true"] i {
167
+ transform: scale(1);
168
+ }
169
+
170
+ .item:focus-visible {
171
+ outline: none;
172
+ }
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from "react";
2
+ export type MenuItemContentProps = {
3
+ label: ReactNode;
4
+ description?: ReactNode;
5
+ icon?: ReactNode;
6
+ reserveIcon?: boolean;
7
+ };
8
+ export declare function MenuItemContent({ label, description, icon, reserveIcon, }: MenuItemContentProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import s from "./MenuItem.module.css";
3
+ function MenuItemContent({
4
+ label,
5
+ description,
6
+ icon,
7
+ reserveIcon = false
8
+ }) {
9
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10
+ (icon || reserveIcon) && /* @__PURE__ */ jsx("span", { className: s.leading, "data-menu-icon": true, "aria-hidden": "true", children: icon }),
11
+ /* @__PURE__ */ jsxs("span", { className: s.copy, children: [
12
+ /* @__PURE__ */ jsx("span", { className: s.label, "data-menu-label": true, children: label }),
13
+ description && /* @__PURE__ */ jsx("span", { className: s.description, children: description })
14
+ ] })
15
+ ] });
16
+ }
17
+ export {
18
+ MenuItemContent
19
+ };
@@ -0,0 +1,13 @@
1
+ import { type FieldOptions } from "./field";
2
+ import type { SelectOption } from "./types";
3
+ export declare function MultiSelect({ value, onChange, options, label, disabled, readOnly, required, name, id: controlId, error, hint, maxSelected, clearable, placeholder, display, ...aria }: FieldOptions & {
4
+ value: string[];
5
+ onChange(value: string[]): void;
6
+ options: SelectOption[];
7
+ label: string;
8
+ disabled?: boolean;
9
+ maxSelected?: number;
10
+ clearable?: boolean;
11
+ placeholder?: string;
12
+ display?: "summary" | "tags";
13
+ }): import("react").JSX.Element;
@@ -0,0 +1,225 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { moveMenuFocus } from "./menuFocus.js";
3
+ import { fieldTriggerProps, useFieldControl } from "./field.js";
4
+ import { MenuItem } from "./MenuItem.js";
5
+ import { SelectTrigger } from "./SelectTrigger.js";
6
+ import { useEffect, useId, useRef, useState } from "react";
7
+ import { Search } from "lucide-react";
8
+ import { Popover } from "./Popover.js";
9
+ import { usePopover } from "./usePopover.js";
10
+ import { Button } from "./Button.js";
11
+ import s from "./MultiSelect.module.css";
12
+ import { SelectionTag } from "./SelectionTag.js";
13
+ import { DisclosureChevron } from "./DisclosureChevron.js";
14
+ import { joinIds } from "./field.js";
15
+ function MultiSelect({
16
+ value,
17
+ onChange,
18
+ options,
19
+ label,
20
+ disabled,
21
+ readOnly,
22
+ required,
23
+ name,
24
+ id: controlId,
25
+ error,
26
+ hint,
27
+ maxSelected = Infinity,
28
+ clearable = true,
29
+ placeholder = "\u8BF7\u9009\u62E9",
30
+ display = "summary",
31
+ ...aria
32
+ }) {
33
+ const field = useFieldControl({
34
+ id: controlId,
35
+ name,
36
+ label,
37
+ disabled,
38
+ readOnly,
39
+ required,
40
+ error,
41
+ hint,
42
+ ...aria
43
+ });
44
+ const pop = usePopover(
45
+ field.disabled || field.readOnly
46
+ ), [query, setQuery] = useState(""), list = useRef(null), search = useRef(null), id = useId();
47
+ const { disabled: triggerDisabled, ...tagField } = fieldTriggerProps(field);
48
+ const reserveIcon = options.some((option) => !!option.icon);
49
+ const filtered = options.filter(
50
+ (item) => item.label.toLowerCase().includes(query.toLowerCase())
51
+ );
52
+ const toggle = (option) => {
53
+ if (!field.disabled && !field.readOnly && !option.disabled && (value.includes(option.value) || value.length < maxSelected))
54
+ onChange(
55
+ value.includes(option.value) ? value.filter((v) => v !== option.value) : [...value, option.value]
56
+ );
57
+ };
58
+ useEffect(() => {
59
+ if (pop.open) {
60
+ setQuery("");
61
+ search.current?.focus();
62
+ }
63
+ }, [pop.open]);
64
+ const remove = (id2) => {
65
+ if (field.disabled || field.readOnly || options.find((option) => option.value === id2)?.disabled)
66
+ return;
67
+ onChange(value.filter((v) => v !== id2));
68
+ pop.anchor.current?.focus();
69
+ };
70
+ const summary = value.length ? options.filter((item) => value.includes(item.value)).map((item) => item.label).slice(0, 2).join("\u3001") + (value.length > 2 ? ` +${value.length - 2}` : "") : placeholder;
71
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
72
+ display === "tags" ? /* @__PURE__ */ jsxs(Fragment, { children: [
73
+ /* @__PURE__ */ jsxs(
74
+ "div",
75
+ {
76
+ ...tagField,
77
+ ref: pop.anchor,
78
+ role: "combobox",
79
+ "aria-expanded": pop.open,
80
+ "aria-controls": id,
81
+ "aria-haspopup": "dialog",
82
+ "aria-disabled": field.disabled || void 0,
83
+ "aria-describedby": joinIds(field.descriptionId, id + "-summary"),
84
+ "data-disabled": triggerDisabled,
85
+ "data-readonly": field.readOnly || void 0,
86
+ className: s.tagTrigger,
87
+ tabIndex: field.disabled ? -1 : 0,
88
+ onClick: pop.toggle,
89
+ onKeyDown: (event) => {
90
+ if (event.target !== event.currentTarget || field.disabled || field.readOnly)
91
+ return;
92
+ if (["ArrowDown", "Enter", " "].includes(event.key)) {
93
+ event.preventDefault();
94
+ pop.show();
95
+ }
96
+ if (event.key === "Backspace" && value.length) {
97
+ event.preventDefault();
98
+ remove(value[value.length - 1]);
99
+ }
100
+ },
101
+ children: [
102
+ value.map((id2) => {
103
+ const option = options.find((option2) => option2.value === id2);
104
+ return /* @__PURE__ */ jsx(
105
+ SelectionTag,
106
+ {
107
+ label: option?.label || id2,
108
+ icon: option?.icon,
109
+ disabled: field.disabled || option?.disabled,
110
+ onRemove: field.readOnly ? void 0 : () => remove(id2),
111
+ removeLabel: "\u79FB\u9664 " + (option?.label || id2)
112
+ },
113
+ id2
114
+ );
115
+ }),
116
+ !value.length && /* @__PURE__ */ jsx("span", { className: s.tagPlaceholder, children: placeholder }),
117
+ /* @__PURE__ */ jsx("span", { className: s.tagChevron, children: /* @__PURE__ */ jsx(DisclosureChevron, { expanded: pop.open }) })
118
+ ]
119
+ }
120
+ ),
121
+ /* @__PURE__ */ jsx("span", { id: id + "-summary", className: s.hidden, children: value.length ? "\u5DF2\u9009\u62E9 " + summary : "\u672A\u9009\u62E9" })
122
+ ] }) : /* @__PURE__ */ jsx(
123
+ SelectTrigger,
124
+ {
125
+ ...fieldTriggerProps(field),
126
+ expanded: pop.open,
127
+ ref: pop.anchor,
128
+ className: s.multiTrigger,
129
+ "aria-haspopup": "dialog",
130
+ "aria-controls": id,
131
+ onClick: pop.toggle,
132
+ children: /* @__PURE__ */ jsx("span", { children: summary })
133
+ }
134
+ ),
135
+ field.name && value.map((value2) => /* @__PURE__ */ jsx(
136
+ "input",
137
+ {
138
+ type: "hidden",
139
+ name: field.name,
140
+ value: value2,
141
+ disabled: field.disabled
142
+ },
143
+ value2
144
+ )),
145
+ /* @__PURE__ */ jsxs(
146
+ Popover,
147
+ {
148
+ id,
149
+ anchor: pop.anchor,
150
+ open: pop.open,
151
+ onClose: pop.close,
152
+ label,
153
+ width: 270,
154
+ matchAnchorWidth: display === "tags",
155
+ onKeyDown: (event) => moveMenuFocus(event, list.current),
156
+ children: [
157
+ /* @__PURE__ */ jsxs("div", { className: s.multiSearch, children: [
158
+ /* @__PURE__ */ jsx(Search, {}),
159
+ /* @__PURE__ */ jsx(
160
+ "input",
161
+ {
162
+ ref: search,
163
+ "aria-label": `\u641C\u7D22${label}`,
164
+ placeholder: "\u641C\u7D22\u9009\u9879\u2026",
165
+ value: query,
166
+ onChange: (e) => setQuery(e.target.value)
167
+ }
168
+ )
169
+ ] }),
170
+ /* @__PURE__ */ jsxs(
171
+ "div",
172
+ {
173
+ ref: list,
174
+ className: s.multiList,
175
+ role: "listbox",
176
+ "aria-label": label,
177
+ "aria-multiselectable": "true",
178
+ children: [
179
+ filtered.map((option) => /* @__PURE__ */ jsx(
180
+ MenuItem,
181
+ {
182
+ label: option.label,
183
+ description: option.description,
184
+ icon: option.icon,
185
+ reserveIcon,
186
+ shortcut: option.shortcut,
187
+ selected: value.includes(option.value),
188
+ selection: "checkbox",
189
+ role: "option",
190
+ "aria-selected": value.includes(option.value),
191
+ disabled: option.disabled || !value.includes(option.value) && value.length >= maxSelected,
192
+ onClick: () => toggle(option)
193
+ },
194
+ option.value
195
+ )),
196
+ !filtered.length && /* @__PURE__ */ jsx("p", { className: s.noResults, children: "\u6CA1\u6709\u5339\u914D\u7684\u9009\u9879" })
197
+ ]
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsxs("footer", { className: s.multiFooter, children: [
201
+ clearable && /* @__PURE__ */ jsx(
202
+ Button,
203
+ {
204
+ variant: "ghost",
205
+ size: "small",
206
+ disabled: !value.length,
207
+ onClick: () => onChange([]),
208
+ children: "\u6E05\u7A7A"
209
+ }
210
+ ),
211
+ /* @__PURE__ */ jsxs("span", { children: [
212
+ value.length,
213
+ Number.isFinite(maxSelected) ? " / " + maxSelected : "",
214
+ " \u9879"
215
+ ] }),
216
+ /* @__PURE__ */ jsx(Button, { size: "small", onClick: pop.closeAndFocus, children: "\u5B8C\u6210" })
217
+ ] })
218
+ ]
219
+ }
220
+ )
221
+ ] });
222
+ }
223
+ export {
224
+ MultiSelect
225
+ };
@@ -0,0 +1,99 @@
1
+ .multiTrigger {
2
+ composes: surface from "./Control.module.css";
3
+ display: flex;
4
+ align-items: center;
5
+ justify-content: space-between;
6
+ gap: 16px;
7
+ min-width: 184px;
8
+ max-width: 280px;
9
+ padding: 5px 10px;
10
+ }
11
+ .tagTrigger {
12
+ composes: surface from "./Control.module.css";
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ align-items: center;
16
+ gap: 5px;
17
+ width: 100%;
18
+ min-width: 0;
19
+ padding: 5px 8px;
20
+ cursor: pointer;
21
+ }
22
+ .tagTrigger.tagTrigger {
23
+ height: auto;
24
+ min-height: var(--control-height);
25
+ }
26
+ .tagPlaceholder {
27
+ color: var(--placeholder);
28
+ }
29
+ .tagChevron {
30
+ display: flex;
31
+ align-items: center;
32
+ margin-left: auto;
33
+ color: var(--muted);
34
+ }
35
+ .tagChevron > svg {
36
+ width: 16px;
37
+ height: 16px;
38
+ }
39
+ .hidden {
40
+ position: absolute;
41
+ width: 1px;
42
+ height: 1px;
43
+ margin: -1px;
44
+ overflow: hidden;
45
+ clip: rect(0, 0, 0, 0);
46
+ white-space: nowrap;
47
+ }
48
+ .multiTrigger span {
49
+ white-space: nowrap;
50
+ overflow: hidden;
51
+ text-overflow: ellipsis;
52
+ }
53
+ .multiTrigger svg {
54
+ width: 14px;
55
+ color: var(--muted);
56
+ }
57
+ .multiSearch {
58
+ composes: surface from "./Control.module.css";
59
+ display: flex;
60
+ align-items: center;
61
+ gap: 8px;
62
+ margin: 3px 3px 6px;
63
+ padding: 0 8px;
64
+ }
65
+ .multiSearch input {
66
+ min-width: 0;
67
+ flex: 1;
68
+ border: 0;
69
+ outline: 0;
70
+ background: transparent;
71
+ font-size: inherit;
72
+ }
73
+ .multiSearch svg {
74
+ width: 14px;
75
+ color: var(--muted);
76
+ }
77
+ .multiList {
78
+ composes: stack from "./OptionList.module.css";
79
+ padding: 5px 0;
80
+ max-height: 220px;
81
+ overflow: auto;
82
+ }
83
+ .multiFooter {
84
+ display: flex;
85
+ align-items: center;
86
+ justify-content: space-between;
87
+ padding: 6px 2px 1px;
88
+ border-top: var(--separator-width) var(--separator-style)
89
+ var(--separator-color);
90
+ }
91
+ .multiFooter span,
92
+ .noResults {
93
+ color: var(--muted);
94
+ font-size: 11px;
95
+ }
96
+ .noResults {
97
+ padding: 15px;
98
+ text-align: center;
99
+ }
@@ -0,0 +1,12 @@
1
+ import { type FieldOptions } from "./field";
2
+ export declare function NumberInput({ value, onChange, label, min, max, step, disabled, readOnly, invalid, ...options }: FieldOptions & {
3
+ value: number;
4
+ onChange(value: number): void;
5
+ label: string;
6
+ min?: number;
7
+ max?: number;
8
+ step?: number;
9
+ disabled?: boolean;
10
+ readOnly?: boolean;
11
+ invalid?: boolean;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,114 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { fieldInputProps, useFieldControl } from "./field.js";
3
+ import { useEffect, useRef, useState } from "react";
4
+ import { Minus, Plus } from "lucide-react";
5
+ import s from "./NumberInput.module.css";
6
+ function NumberInput({
7
+ value,
8
+ onChange,
9
+ label,
10
+ min = -Infinity,
11
+ max = Infinity,
12
+ step = 1,
13
+ disabled,
14
+ readOnly,
15
+ invalid = false,
16
+ ...options
17
+ }) {
18
+ const field = useFieldControl({ ...options, label, disabled, readOnly });
19
+ disabled = field.disabled;
20
+ readOnly = field.readOnly;
21
+ const [draft, setDraft] = useState(String(value)), input = useRef(null);
22
+ const safeStep = Number.isFinite(step) && step > 0 ? step : 1;
23
+ const clamp = (n) => Math.min(max, Math.max(min, n));
24
+ useEffect(() => setDraft(String(value)), [value]);
25
+ const parsed = () => draft.trim() && Number.isFinite(Number(draft)) ? Number(draft) : value;
26
+ const commit = () => {
27
+ if (readOnly) return;
28
+ const next = clamp(parsed());
29
+ setDraft(String(next));
30
+ if (next !== value) onChange(next);
31
+ };
32
+ const change = (direction) => {
33
+ if (readOnly) return;
34
+ const next = clamp(Number((parsed() + direction * safeStep).toFixed(10)));
35
+ setDraft(String(next));
36
+ if (next !== value) onChange(next);
37
+ };
38
+ return /* @__PURE__ */ jsxs(
39
+ "div",
40
+ {
41
+ className: s.number,
42
+ "data-disabled": disabled,
43
+ "data-readonly": readOnly || void 0,
44
+ "aria-invalid": field.invalid || invalid,
45
+ children: [
46
+ /* @__PURE__ */ jsx(
47
+ "button",
48
+ {
49
+ type: "button",
50
+ "aria-label": `\u51CF\u5C11${label}`,
51
+ disabled: disabled || readOnly || parsed() <= min,
52
+ onMouseDown: (e) => e.preventDefault(),
53
+ onClick: () => change(-1),
54
+ children: /* @__PURE__ */ jsx(Minus, {})
55
+ }
56
+ ),
57
+ /* @__PURE__ */ jsx(
58
+ "input",
59
+ {
60
+ ...fieldInputProps(field),
61
+ ref: input,
62
+ type: "text",
63
+ inputMode: "decimal",
64
+ role: "spinbutton",
65
+ "aria-invalid": field.invalid || invalid,
66
+ "aria-label": label,
67
+ "aria-valuenow": value,
68
+ "aria-valuemin": Number.isFinite(min) ? min : void 0,
69
+ "aria-valuemax": Number.isFinite(max) ? max : void 0,
70
+ value: draft,
71
+ onChange: (e) => {
72
+ const raw = e.target.value;
73
+ if (/^-?\d*\.?\d*$/.test(raw)) setDraft(raw);
74
+ },
75
+ onBlur: commit,
76
+ onKeyDown: (e) => {
77
+ if (readOnly) return;
78
+ if (e.key === "ArrowUp" || e.key === "ArrowDown") {
79
+ e.preventDefault();
80
+ change(e.key === "ArrowUp" ? 1 : -1);
81
+ } else if (e.key === "Enter") {
82
+ e.preventDefault();
83
+ commit();
84
+ } else if (e.key === "Escape") setDraft(String(value));
85
+ else if (e.key === "Home" && Number.isFinite(min)) {
86
+ e.preventDefault();
87
+ setDraft(String(min));
88
+ onChange(min);
89
+ } else if (e.key === "End" && Number.isFinite(max)) {
90
+ e.preventDefault();
91
+ setDraft(String(max));
92
+ onChange(max);
93
+ }
94
+ }
95
+ }
96
+ ),
97
+ /* @__PURE__ */ jsx(
98
+ "button",
99
+ {
100
+ type: "button",
101
+ "aria-label": `\u589E\u52A0${label}`,
102
+ disabled: disabled || readOnly || parsed() >= max,
103
+ onMouseDown: (e) => e.preventDefault(),
104
+ onClick: () => change(1),
105
+ children: /* @__PURE__ */ jsx(Plus, {})
106
+ }
107
+ )
108
+ ]
109
+ }
110
+ );
111
+ }
112
+ export {
113
+ NumberInput
114
+ };
@@ -0,0 +1,33 @@
1
+ .number {
2
+ composes: surface from "./Control.module.css";
3
+ width: 132px;
4
+ display: grid;
5
+ grid-template-columns: 30px minmax(0, 1fr) 30px;
6
+ overflow: hidden;
7
+ }
8
+
9
+ .number input {
10
+ width: 100%;
11
+ text-align: center;
12
+ font-size: inherit;
13
+ background: transparent;
14
+ border: 0;
15
+ outline: 0;
16
+ padding: 0;
17
+ font-variant-numeric: tabular-nums;
18
+ }
19
+ .number button {
20
+ display: grid;
21
+ place-items: center;
22
+ border: 0;
23
+ background: transparent;
24
+ color: var(--muted);
25
+ }
26
+ .number button:hover:not(:disabled) {
27
+ background: var(--hover);
28
+ color: var(--fg);
29
+ }
30
+ .number svg {
31
+ width: 13px;
32
+ height: 13px;
33
+ }