@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,85 @@
1
+ .field {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 7px;
5
+ min-width: 0;
6
+ }
7
+ .label {
8
+ display: inline-flex;
9
+ align-items: baseline;
10
+ gap: 5px;
11
+ font-size: 12px;
12
+ color: var(--fg);
13
+ }
14
+ .required {
15
+ color: var(--danger);
16
+ font-size: 12px;
17
+ line-height: 1;
18
+ }
19
+ .optional {
20
+ color: var(--muted);
21
+ font-size: 11px;
22
+ }
23
+ .hint,
24
+ .error {
25
+ font-size: 11px;
26
+ line-height: 1.5;
27
+ margin: 0;
28
+ }
29
+ .hint {
30
+ color: var(--muted);
31
+ }
32
+ .error {
33
+ color: var(--danger);
34
+ }
35
+ .field[data-disabled="true"] > .labelRow > .label,
36
+ .field:has(
37
+ > input:disabled,
38
+ > textarea:disabled,
39
+ > button:disabled,
40
+ > div > input:disabled,
41
+ > label > input:disabled,
42
+ > fieldset:disabled
43
+ )
44
+ > .labelRow
45
+ > .label {
46
+ opacity: 0.55;
47
+ }
48
+ .group {
49
+ display: flex;
50
+ flex-direction: column;
51
+ gap: 12px;
52
+ min-width: 0;
53
+ border: 0;
54
+ padding: 0;
55
+ margin: 0;
56
+ }
57
+ .group > legend {
58
+ padding: 0;
59
+ margin-bottom: 10px;
60
+ }
61
+
62
+ .labelRow {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: space-between;
66
+ gap: var(--field-gap);
67
+ }
68
+ .field {
69
+ width: 100%;
70
+ gap: 8px;
71
+ }
72
+ .field > .labelRow:empty {
73
+ display: none;
74
+ }
75
+ .field > [role="combobox"] {
76
+ width: var(--field-trigger-width);
77
+ max-width: 100%;
78
+ }
79
+ .label {
80
+ font-size: var(--field-label-size);
81
+ }
82
+ .hint,
83
+ .error {
84
+ font-size: var(--field-message-size);
85
+ }
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function FormGroup({ label, children, disabled, required, hint, error, }: {
3
+ label: string;
4
+ children: ReactNode;
5
+ disabled?: boolean;
6
+ required?: boolean;
7
+ hint?: string;
8
+ error?: string;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { FieldMessages } from "./FieldMessages.js";
3
+ import { useId } from "react";
4
+ import { FieldLabel } from "./FieldLabel.js";
5
+ import s from "./FormField.module.css";
6
+ function FormGroup({
7
+ label,
8
+ children,
9
+ disabled = false,
10
+ required = false,
11
+ hint,
12
+ error
13
+ }) {
14
+ const id = useId();
15
+ return /* @__PURE__ */ jsxs(
16
+ "fieldset",
17
+ {
18
+ className: s.group,
19
+ disabled,
20
+ "aria-invalid": !!error,
21
+ "aria-describedby": [hint ? id + "-hint" : "", error ? id + "-error" : ""].filter(Boolean).join(" ") || void 0,
22
+ children: [
23
+ /* @__PURE__ */ jsx("legend", { children: /* @__PURE__ */ jsx(FieldLabel, { as: "span", label, required }) }),
24
+ children,
25
+ /* @__PURE__ */ jsx(FieldMessages, { id, hint, error })
26
+ ]
27
+ }
28
+ );
29
+ }
30
+ export {
31
+ FormGroup
32
+ };
@@ -0,0 +1,146 @@
1
+ .trigger {
2
+ width: 280px;
3
+ max-width: 100%;
4
+ min-width: 0;
5
+ }
6
+ .search {
7
+ margin: 3px 3px 8px;
8
+ }
9
+ .tree {
10
+ max-height: 292px;
11
+ overflow: auto;
12
+ padding: 2px;
13
+ }
14
+ .row {
15
+ padding-left: calc(var(--menu-item-padding-x) + var(--level, 0) * 18px);
16
+ }
17
+ .row:focus-visible {
18
+ outline: none;
19
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
20
+ }
21
+ .expander,
22
+ .spacer {
23
+ display: inline-grid;
24
+ place-items: center;
25
+ flex: 0 0 18px;
26
+ width: 18px;
27
+ height: 20px;
28
+ }
29
+ .expander {
30
+ padding: 0;
31
+ border: 0;
32
+ border-radius: 4px;
33
+ background: transparent;
34
+ color: var(--muted);
35
+ }
36
+ .expander:hover {
37
+ background: var(--selected);
38
+ }
39
+ .expander svg {
40
+ width: 13px;
41
+ height: 13px;
42
+ transform: rotate(-90deg);
43
+ transition: transform var(--motion-chevron) var(--ease);
44
+ }
45
+ .expander[data-expanded="true"] svg {
46
+ transform: rotate(0deg);
47
+ }
48
+ .mixed {
49
+ display: grid;
50
+ place-items: center;
51
+ width: 16px;
52
+ height: 16px;
53
+ border: 1px solid var(--accent);
54
+ border-radius: 4px;
55
+ background: var(--accent);
56
+ color: var(--on-accent);
57
+ }
58
+ .mixed svg {
59
+ width: 12px;
60
+ height: 12px;
61
+ }
62
+ .empty,
63
+ .status {
64
+ padding: 16px 10px;
65
+ color: var(--muted);
66
+ font-size: 12px;
67
+ }
68
+ .error {
69
+ color: var(--danger);
70
+ padding: 6px 10px;
71
+ font-size: 12px;
72
+ display: flex;
73
+ gap: 8px;
74
+ align-items: center;
75
+ flex-wrap: wrap;
76
+ }
77
+ .error span {
78
+ min-width: 0;
79
+ overflow-wrap: anywhere;
80
+ }
81
+ .footer {
82
+ display: flex;
83
+ justify-content: space-between;
84
+ align-items: center;
85
+ gap: 12px;
86
+ padding: 8px 3px 1px;
87
+ margin-top: 6px;
88
+ border-top: var(--separator-width) var(--separator-style)
89
+ var(--separator-color);
90
+ font-size: 11px;
91
+ color: var(--muted);
92
+ }
93
+ .columns {
94
+ display: flex;
95
+ min-height: 240px;
96
+ max-height: 300px;
97
+ overflow: auto;
98
+ overscroll-behavior: contain;
99
+ }
100
+ .column {
101
+ flex: 1 0 170px;
102
+ min-width: 170px;
103
+ max-height: 292px;
104
+ overflow: auto;
105
+ padding: 2px 5px;
106
+ animation: columnIn 160ms var(--ease);
107
+ }
108
+ .column + .column {
109
+ border-left: var(--separator-width) var(--separator-style)
110
+ var(--separator-color);
111
+ }
112
+ .treeRow {
113
+ animation: rowIn 140ms var(--ease);
114
+ }
115
+ .treeRow[aria-disabled="true"] .expander {
116
+ pointer-events: none;
117
+ }
118
+ @keyframes rowIn {
119
+ from {
120
+ opacity: 0;
121
+ transform: translateY(-3px);
122
+ }
123
+ to {
124
+ opacity: 1;
125
+ transform: none;
126
+ }
127
+ }
128
+ @keyframes columnIn {
129
+ from {
130
+ opacity: 0;
131
+ transform: translateX(6px);
132
+ }
133
+ to {
134
+ opacity: 1;
135
+ transform: none;
136
+ }
137
+ }
138
+ @media (prefers-reduced-motion: reduce) {
139
+ .column,
140
+ .treeRow {
141
+ animation: none;
142
+ }
143
+ .expander svg {
144
+ transition: none;
145
+ }
146
+ }
@@ -0,0 +1,7 @@
1
+ import type { ButtonHTMLAttributes } from "react";
2
+ export declare function IconButton({ label, loading, children, variant, size, ...props }: ButtonHTMLAttributes<HTMLButtonElement> & {
3
+ label: string;
4
+ loading?: boolean;
5
+ variant?: "primary" | "secondary" | "ghost" | "danger";
6
+ size?: "small" | "normal";
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Spinner } from "./Spinner.js";
3
+ import { Tooltip } from "./Tooltip.js";
4
+ import s from "./IconButton.module.css";
5
+ function IconButton({
6
+ label,
7
+ loading,
8
+ children,
9
+ variant = "ghost",
10
+ size = "normal",
11
+ ...props
12
+ }) {
13
+ return /* @__PURE__ */ jsx(Tooltip, { content: label, children: /* @__PURE__ */ jsx(
14
+ "button",
15
+ {
16
+ type: "button",
17
+ ...props,
18
+ "aria-label": label,
19
+ "aria-busy": loading || void 0,
20
+ "data-variant": variant,
21
+ "data-size": size,
22
+ disabled: props.disabled || loading,
23
+ className: `${s.iconButton} ${props.className || ""}`,
24
+ children: /* @__PURE__ */ jsx("span", { className: s.icon, children: loading ? /* @__PURE__ */ jsx(Spinner, { decorative: true }) : children })
25
+ }
26
+ ) });
27
+ }
28
+ export {
29
+ IconButton
30
+ };
@@ -0,0 +1,39 @@
1
+ .iconButton {
2
+ position: relative;
3
+ display: grid;
4
+ place-items: center;
5
+ width: 32px;
6
+ height: 32px;
7
+ padding: 0;
8
+ border: 0;
9
+ background: transparent;
10
+ border-radius: calc(var(--radius) - 3px);
11
+ color: var(--muted);
12
+ transition:
13
+ background var(--motion-hover),
14
+ color var(--motion-hover);
15
+ }
16
+ .iconButton:hover {
17
+ color: var(--fg);
18
+ background: var(--hover);
19
+ }
20
+ .icon {
21
+ display: contents;
22
+ }
23
+ .iconButton[data-size="small"] {
24
+ width: 30px;
25
+ height: 30px;
26
+ min-width: 30px;
27
+ }
28
+ .iconButton[data-variant="primary"] {
29
+ background: var(--accent);
30
+ color: var(--on-accent);
31
+ }
32
+ .iconButton[data-variant="secondary"] {
33
+ border: 1px solid var(--border);
34
+ background: var(--surface);
35
+ }
36
+ .iconButton[data-variant="danger"] {
37
+ color: var(--danger);
38
+ background: var(--danger-soft);
39
+ }
@@ -0,0 +1,6 @@
1
+ export declare function IconPicker({ value, onChange, label, disabled, }: {
2
+ value: string;
3
+ onChange(value: string): void;
4
+ label?: string;
5
+ disabled?: boolean;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,111 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useMemo, useRef, useState } from "react";
3
+ import { Popover } from "./Popover.js";
4
+ import { SearchField } from "./SearchField.js";
5
+ import { CatalogIcon } from "./CatalogIcon.js";
6
+ import { Spinner } from "./Spinner.js";
7
+ import { Button } from "./Button.js";
8
+ import { SelectTrigger } from "./SelectTrigger.js";
9
+ import {
10
+ VirtualPickerList
11
+ } from "./VirtualPickerList.js";
12
+ import { useIconCatalog, iconCategories } from "./iconCatalog.js";
13
+ import s from "./Picker.module.css";
14
+ function IconPicker({
15
+ value,
16
+ onChange,
17
+ label = "\u56FE\u6807",
18
+ disabled = false
19
+ }) {
20
+ const anchor = useRef(null), [open, setOpen] = useState(false), [query, setQuery] = useState("");
21
+ const { items, error, retry } = useIconCatalog(open);
22
+ const groups = useMemo(() => {
23
+ if (!items) return [];
24
+ const indexed = items.map((icon) => ({
25
+ id: icon.name,
26
+ label: icon.name,
27
+ icon,
28
+ search: [
29
+ icon.name,
30
+ ...icon.aliases,
31
+ ...icon.categories.flatMap((c) => [c, iconCategories[c]])
32
+ ].join(" ").toLowerCase()
33
+ }));
34
+ return Object.entries(iconCategories).map(
35
+ ([id, label2]) => ({
36
+ id,
37
+ label: label2,
38
+ items: indexed.filter(
39
+ (entry) => id === "uncategorized" ? !entry.icon.categories.length : entry.icon.categories.includes(id)
40
+ )
41
+ })
42
+ ).filter((group) => group.items.length);
43
+ }, [items]);
44
+ const choose = useCallback(
45
+ (item) => {
46
+ onChange(item.id);
47
+ setOpen(false);
48
+ anchor.current?.focus();
49
+ },
50
+ [onChange]
51
+ );
52
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
53
+ /* @__PURE__ */ jsx(
54
+ SelectTrigger,
55
+ {
56
+ ref: anchor,
57
+ expanded: open,
58
+ disabled,
59
+ "aria-label": label,
60
+ "aria-haspopup": "dialog",
61
+ onClick: () => setOpen((x) => !x),
62
+ onKeyDown: (e) => {
63
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") {
64
+ e.preventDefault();
65
+ setOpen(true);
66
+ }
67
+ },
68
+ icon: /* @__PURE__ */ jsx(CatalogIcon, { name: value }),
69
+ children: /* @__PURE__ */ jsx("span", { children: value || "\u9009\u62E9\u56FE\u6807" })
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsx(
73
+ Popover,
74
+ {
75
+ open,
76
+ onClose: () => setOpen(false),
77
+ anchor,
78
+ width: 470,
79
+ label: label + "\u9009\u62E9\u5668",
80
+ children: /* @__PURE__ */ jsxs("div", { className: s.panel, children: [
81
+ /* @__PURE__ */ jsx(
82
+ SearchField,
83
+ {
84
+ label: "\u641C\u7D22\u56FE\u6807",
85
+ placeholder: "\u540D\u79F0\u3001\u5206\u7C7B\uFF08\u4E2D/\u82F1\u6587\uFF09",
86
+ value: query,
87
+ onChange: setQuery
88
+ }
89
+ ),
90
+ error ? /* @__PURE__ */ jsx(Button, { onClick: retry, children: "\u91CD\u65B0\u52A0\u8F7D" }) : !items ? /* @__PURE__ */ jsx("div", { className: s.loading, children: /* @__PURE__ */ jsx(Spinner, { label: "\u52A0\u8F7D\u56FE\u6807" }) }) : /* @__PURE__ */ jsx(
91
+ VirtualPickerList,
92
+ {
93
+ groups,
94
+ query,
95
+ value,
96
+ label: "\u56FE\u6807",
97
+ onChoose: choose
98
+ }
99
+ ),
100
+ /* @__PURE__ */ jsx("div", { className: s.footer, children: /* @__PURE__ */ jsxs("span", { children: [
101
+ items?.length || 0,
102
+ " \u4E2A\u56FE\u6807"
103
+ ] }) })
104
+ ] })
105
+ }
106
+ )
107
+ ] });
108
+ }
109
+ export {
110
+ IconPicker
111
+ };
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from "react";
2
+ export type IndicatorItem<T extends string = string> = {
3
+ value: T;
4
+ label: string;
5
+ icon?: ReactNode;
6
+ disabled?: boolean;
7
+ };
8
+ export type IndicatorGroup<T extends string = string> = {
9
+ id: string;
10
+ label?: string;
11
+ items: IndicatorItem<T>[];
12
+ };
13
+ export declare function Indicator<T extends string>({ value, onChange, groups, label, }: {
14
+ value: T;
15
+ onChange(value: T): void;
16
+ groups: IndicatorGroup<T>[];
17
+ label?: string;
18
+ }): import("react").JSX.Element;
@@ -0,0 +1,97 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useLayoutEffect, useRef } from "react";
3
+ import s from "./Indicator.module.css";
4
+ function Indicator({
5
+ value,
6
+ onChange,
7
+ groups,
8
+ label = "\u5206\u7C7B\u5BFC\u822A"
9
+ }) {
10
+ const root = useRef(null);
11
+ useLayoutEffect(() => {
12
+ const node = root.current;
13
+ const measure = () => {
14
+ const selected = [
15
+ ...node.querySelectorAll("button[data-value]")
16
+ ].find((b) => b.dataset.value === value);
17
+ if (!selected) {
18
+ node.style.setProperty("--indicator-opacity", "0");
19
+ return;
20
+ }
21
+ node.style.setProperty("--indicator-opacity", "1");
22
+ node.style.setProperty("--indicator-y", selected.offsetTop + "px");
23
+ node.style.setProperty(
24
+ "--indicator-height",
25
+ selected.offsetHeight + "px"
26
+ );
27
+ if (!node.dataset.ready) {
28
+ node.getBoundingClientRect();
29
+ node.dataset.ready = "true";
30
+ }
31
+ };
32
+ measure();
33
+ const observer = new ResizeObserver(measure);
34
+ observer.observe(node);
35
+ node.querySelectorAll("button").forEach((n) => observer.observe(n));
36
+ return () => observer.disconnect();
37
+ }, [value, groups]);
38
+ const enabled = groups.flatMap((g) => g.items).filter((i) => !i.disabled);
39
+ return /* @__PURE__ */ jsxs(
40
+ "nav",
41
+ {
42
+ ref: root,
43
+ className: s.indicator,
44
+ "aria-label": label,
45
+ onKeyDown: (e) => {
46
+ const active = enabled.findIndex(
47
+ (i) => i.value === e.target.closest("button")?.dataset.value
48
+ );
49
+ let next = active;
50
+ if (e.key === "ArrowDown") next = (active + 1) % enabled.length;
51
+ else if (e.key === "ArrowUp")
52
+ next = (active - 1 + enabled.length) % enabled.length;
53
+ else if (e.key === "Home") next = 0;
54
+ else if (e.key === "End") next = enabled.length - 1;
55
+ else return;
56
+ if (!enabled[next]) return;
57
+ e.preventDefault();
58
+ onChange(enabled[next].value);
59
+ [...root.current.querySelectorAll("button")].find((b) => b.dataset.value === enabled[next].value)?.focus();
60
+ },
61
+ children: [
62
+ /* @__PURE__ */ jsx("span", { className: s.track, "data-indicator-track": true, "aria-hidden": "true" }),
63
+ groups.map((group) => /* @__PURE__ */ jsxs(
64
+ "div",
65
+ {
66
+ className: s.group,
67
+ role: "group",
68
+ "aria-label": group.label,
69
+ children: [
70
+ group.label && /* @__PURE__ */ jsx("div", { className: s.groupLabel, children: group.label }),
71
+ group.items.map((item) => /* @__PURE__ */ jsxs(
72
+ "button",
73
+ {
74
+ type: "button",
75
+ "data-value": item.value,
76
+ disabled: item.disabled,
77
+ "aria-current": value === item.value ? "page" : void 0,
78
+ tabIndex: value === item.value ? 0 : -1,
79
+ onClick: () => onChange(item.value),
80
+ children: [
81
+ item.icon,
82
+ /* @__PURE__ */ jsx("span", { children: item.label })
83
+ ]
84
+ },
85
+ item.value
86
+ ))
87
+ ]
88
+ },
89
+ group.id
90
+ ))
91
+ ]
92
+ }
93
+ );
94
+ }
95
+ export {
96
+ Indicator
97
+ };
@@ -0,0 +1,83 @@
1
+ .indicator {
2
+ position: relative;
3
+ isolation: isolate;
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: 18px;
7
+ align-self: start;
8
+ min-width: 0;
9
+ }
10
+ .group {
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: 4px;
14
+ }
15
+ .groupLabel {
16
+ font-size: 11px;
17
+ color: var(--muted);
18
+ padding: 4px 12px 6px;
19
+ }
20
+ .indicator button {
21
+ position: relative;
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 9px;
25
+ width: 100%;
26
+ text-align: left;
27
+ border: 0;
28
+ background: transparent;
29
+ padding: 10px 12px 10px 16px;
30
+ min-height: 38px;
31
+ border-radius: 7px;
32
+ color: var(--muted);
33
+ font-size: 12px;
34
+ transition: color var(--motion-hover);
35
+ }
36
+ .indicator button > span {
37
+ overflow: hidden;
38
+ text-overflow: ellipsis;
39
+ white-space: nowrap;
40
+ }
41
+ .indicator button:hover:not(:disabled) {
42
+ color: var(--fg);
43
+ }
44
+ .indicator button[aria-current="page"] {
45
+ color: var(--fg);
46
+ }
47
+ .indicator button:focus-visible {
48
+ outline-offset: -2px;
49
+ }
50
+ .indicator svg {
51
+ width: 15px;
52
+ height: 15px;
53
+ }
54
+ .track {
55
+ position: absolute;
56
+ z-index: -1;
57
+ pointer-events: none;
58
+ left: 0;
59
+ right: 0;
60
+ top: 0;
61
+ height: var(--indicator-height, 38px);
62
+ transform: translateY(var(--indicator-y, 0px));
63
+ opacity: var(--indicator-opacity, 0);
64
+ border-radius: 7px;
65
+ background: var(--selected);
66
+ }
67
+ .track::before {
68
+ content: "";
69
+ position: absolute;
70
+ left: 4px;
71
+ top: 50%;
72
+ height: 14px;
73
+ width: 3px;
74
+ transform: translateY(-50%);
75
+ border-radius: 3px;
76
+ background: var(--accent);
77
+ }
78
+ .indicator[data-ready="true"] .track {
79
+ transition:
80
+ transform var(--motion-segment) var(--ease),
81
+ height var(--motion-segment) var(--ease),
82
+ opacity var(--motion-hover);
83
+ }
@@ -0,0 +1,7 @@
1
+ import type { ComponentPropsWithRef, ReactNode } from "react";
2
+ export declare function Input({ label, error, hint, leading, ...props }: ComponentPropsWithRef<"input"> & {
3
+ label?: string;
4
+ error?: string;
5
+ hint?: string;
6
+ leading?: ReactNode;
7
+ }): import("react").JSX.Element;