@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,17 @@
1
+ .chevron {
2
+ width: 14px;
3
+ height: 14px;
4
+ stroke: currentColor;
5
+ stroke-width: 1.5;
6
+ stroke-linecap: round;
7
+ stroke-linejoin: round;
8
+ fill: none;
9
+ rotate: 0deg;
10
+ transition:
11
+ rotate var(--motion-chevron) var(--ease),
12
+ color var(--motion-hover) var(--ease);
13
+ flex-shrink: 0;
14
+ }
15
+ .chevron[data-expanded="true"] {
16
+ rotate: 180deg;
17
+ }
@@ -0,0 +1,5 @@
1
+ export declare function Divider({ orientation, inset, spacing, }: {
2
+ orientation?: "horizontal" | "vertical";
3
+ inset?: number;
4
+ spacing?: number;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import s from "./Divider.module.css";
3
+ function Divider({
4
+ orientation = "horizontal",
5
+ inset = 0,
6
+ spacing = 0
7
+ }) {
8
+ return /* @__PURE__ */ jsx(
9
+ "div",
10
+ {
11
+ role: "separator",
12
+ "aria-orientation": orientation,
13
+ className: s.divider,
14
+ "data-orientation": orientation,
15
+ style: {
16
+ "--divider-inset": Math.max(0, inset) + "px",
17
+ "--divider-spacing": Math.max(0, spacing) + "px"
18
+ }
19
+ }
20
+ );
21
+ }
22
+ export {
23
+ Divider
24
+ };
@@ -0,0 +1,19 @@
1
+ .divider {
2
+ flex-shrink: 0;
3
+ border: 0;
4
+ border-radius: 0;
5
+ }
6
+ .divider[data-orientation="horizontal"] {
7
+ align-self: stretch;
8
+ height: 0;
9
+ border-top: var(--separator-width) var(--separator-style)
10
+ var(--separator-color);
11
+ margin: var(--divider-spacing) var(--divider-inset);
12
+ }
13
+ .divider[data-orientation="vertical"] {
14
+ align-self: stretch;
15
+ width: 0;
16
+ border-left: var(--separator-width) var(--separator-style)
17
+ var(--separator-color);
18
+ margin: var(--divider-inset) var(--divider-spacing);
19
+ }
@@ -0,0 +1,18 @@
1
+ import { type ReactNode, type RefObject } from "react";
2
+ export type DrawerPlacement = "left" | "right" | "top" | "bottom";
3
+ export type DrawerProps = {
4
+ open: boolean;
5
+ onClose(): void;
6
+ title: string;
7
+ description?: ReactNode;
8
+ children: ReactNode;
9
+ footer?: ReactNode;
10
+ placement?: DrawerPlacement;
11
+ size?: number | string;
12
+ closable?: boolean;
13
+ closeOnEscape?: boolean;
14
+ closeOnBackdrop?: boolean;
15
+ initialFocus?: RefObject<HTMLElement | null>;
16
+ className?: string;
17
+ };
18
+ export declare function Drawer({ open: requestedOpen, onClose, title, description, children, footer, placement, size, closable, closeOnEscape, closeOnBackdrop, initialFocus, className, }: DrawerProps): import("react").ReactPortal;
@@ -0,0 +1,145 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import {
3
+ useEffect,
4
+ useId,
5
+ useLayoutEffect,
6
+ useRef,
7
+ useState
8
+ } from "react";
9
+ import { createPortal } from "react-dom";
10
+ import { X } from "lucide-react";
11
+ import { IconButton } from "./IconButton.js";
12
+ import { FieldContext } from "./field.js";
13
+ import { useModalScrollLock } from "./useModalScrollLock.js";
14
+ import { cancelMotion, surfaceMotion } from "./motion.js";
15
+ import s from "./Drawer.module.css";
16
+ import {
17
+ SurfacePortalContext,
18
+ useSurfaceHost,
19
+ useSurfacePortal
20
+ } from "./surfacePortal.js";
21
+ const offsets = {
22
+ left: "-100% 0",
23
+ right: "100% 0",
24
+ top: "0 -100%",
25
+ bottom: "0 100%"
26
+ };
27
+ function Drawer({
28
+ open: requestedOpen,
29
+ onClose,
30
+ title,
31
+ description,
32
+ children,
33
+ footer,
34
+ placement = "right",
35
+ size = 420,
36
+ closable = true,
37
+ closeOnEscape = true,
38
+ closeOnBackdrop = true,
39
+ initialFocus,
40
+ className = ""
41
+ }) {
42
+ const owner = useSurfacePortal(), open = requestedOpen && owner?.active !== false;
43
+ const { ref, host, setRef } = useSurfaceHost();
44
+ const previousFocus = useRef(null), opened = useRef(open), backdropDown = useRef(false), titleId = useId(), descriptionId = useId();
45
+ const [closing, setClosing] = useState(false);
46
+ useModalScrollLock(open || closing);
47
+ opened.current = open;
48
+ useEffect(() => {
49
+ if (requestedOpen && owner?.active === false) onClose();
50
+ }, [requestedOpen, owner?.active, onClose]);
51
+ useEffect(() => {
52
+ const node = ref.current;
53
+ return () => {
54
+ cancelMotion(node);
55
+ if (node.open) node.close();
56
+ };
57
+ }, []);
58
+ useLayoutEffect(() => {
59
+ const node = ref.current;
60
+ if (open) {
61
+ node.inert = false;
62
+ setClosing(false);
63
+ const justOpened = !node.open;
64
+ const body = node.querySelector("[data-drawer-body]");
65
+ if (justOpened) {
66
+ previousFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
67
+ node.showModal();
68
+ if (body) body.scrollTop = 0;
69
+ }
70
+ if (justOpened || !node.contains(document.activeElement)) {
71
+ const requested = initialFocus?.current;
72
+ const target = requested && node.contains(requested) ? requested : node.querySelector("[data-autofocus]") || body?.querySelector(
73
+ 'input:not([disabled]):not([readonly]):not([type="hidden"]):not([type="file"]),textarea:not([disabled]):not([readonly]),[role="combobox"]:not([disabled]),button:not([disabled]),a[href]'
74
+ ) || node.querySelector("button:not([disabled])") || node;
75
+ target.focus({ preventScroll: true });
76
+ }
77
+ void surfaceMotion(node, "enter", offsets[placement], "--motion-panel");
78
+ return;
79
+ }
80
+ if (!node.open) return;
81
+ node.inert = true;
82
+ setClosing(true);
83
+ void surfaceMotion(node, "exit", offsets[placement]).then((done) => {
84
+ if (!done || opened.current) return;
85
+ node.close();
86
+ const focus = previousFocus.current;
87
+ const modal = [
88
+ ...document.querySelectorAll("dialog:modal")
89
+ ].at(-1);
90
+ if (focus?.isConnected && (!modal || modal.contains(focus)))
91
+ focus.focus({ preventScroll: true });
92
+ setClosing(false);
93
+ });
94
+ }, [open, placement, initialFocus]);
95
+ const outside = (event) => {
96
+ const rect = event.currentTarget.getBoundingClientRect();
97
+ return event.target === event.currentTarget && (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom);
98
+ };
99
+ const length = typeof size === "number" ? `${Number.isFinite(size) ? Math.max(180, size) : 420}px` : size;
100
+ return createPortal(
101
+ /* @__PURE__ */ jsx(SurfacePortalContext, { value: { host, active: open }, children: /* @__PURE__ */ jsx(FieldContext, { value: null, children: /* @__PURE__ */ jsxs(
102
+ "dialog",
103
+ {
104
+ ref: setRef,
105
+ tabIndex: -1,
106
+ "aria-labelledby": titleId,
107
+ "aria-describedby": description != null ? descriptionId : void 0,
108
+ "data-placement": placement,
109
+ className: `${s.drawer} ${closing ? s.closing : ""} ${className}`,
110
+ style: { "--drawer-size": length },
111
+ onCancel: (event) => {
112
+ event.preventDefault();
113
+ event.stopPropagation();
114
+ if (closeOnEscape && !closing) onClose();
115
+ },
116
+ onPointerDown: (event) => {
117
+ backdropDown.current = event.button === 0 && outside(event);
118
+ },
119
+ onPointerUp: (event) => {
120
+ if (backdropDown.current && outside(event) && closeOnBackdrop && !closing)
121
+ onClose();
122
+ backdropDown.current = false;
123
+ },
124
+ onPointerCancel: () => {
125
+ backdropDown.current = false;
126
+ },
127
+ children: [
128
+ /* @__PURE__ */ jsxs("header", { className: s.header, children: [
129
+ /* @__PURE__ */ jsxs("div", { className: s.heading, children: [
130
+ /* @__PURE__ */ jsx("h2", { id: titleId, children: title }),
131
+ description != null && /* @__PURE__ */ jsx("div", { id: descriptionId, className: s.description, children: description })
132
+ ] }),
133
+ closable && /* @__PURE__ */ jsx(IconButton, { label: "\u5173\u95ED\u62BD\u5C49", onClick: onClose, children: /* @__PURE__ */ jsx(X, {}) })
134
+ ] }),
135
+ /* @__PURE__ */ jsx("div", { className: s.body, "data-drawer-body": true, children }),
136
+ footer && /* @__PURE__ */ jsx("footer", { className: s.footer, children: footer })
137
+ ]
138
+ }
139
+ ) }) }),
140
+ document.body
141
+ );
142
+ }
143
+ export {
144
+ Drawer
145
+ };
@@ -0,0 +1,109 @@
1
+ .drawer {
2
+ position: fixed;
3
+ inset: 0 0 0 auto;
4
+ width: min(var(--drawer-size), 100vw);
5
+ height: 100dvh;
6
+ max-width: 100vw;
7
+ max-height: 100dvh;
8
+ margin: 0;
9
+ padding: 0;
10
+ color: var(--fg);
11
+ background: var(--surface);
12
+ border: 1px solid var(--line);
13
+ border-radius: var(--radius) 0 0 var(--radius);
14
+ box-shadow: var(--shadow-dialog);
15
+ overflow: hidden;
16
+ outline: none;
17
+ }
18
+ .drawer[open] {
19
+ display: flex;
20
+ flex-direction: column;
21
+ }
22
+ .drawer[data-placement="left"] {
23
+ inset: 0 auto 0 0;
24
+ border-radius: 0 var(--radius) var(--radius) 0;
25
+ }
26
+ .drawer[data-placement="top"],
27
+ .drawer[data-placement="bottom"] {
28
+ width: 100vw;
29
+ height: min(var(--drawer-size), 100dvh);
30
+ }
31
+ .drawer[data-placement="top"] {
32
+ inset: 0 0 auto;
33
+ border-radius: 0 0 var(--radius) var(--radius);
34
+ }
35
+ .drawer[data-placement="bottom"] {
36
+ inset: auto 0 0;
37
+ border-radius: var(--radius) var(--radius) 0 0;
38
+ }
39
+ .drawer::backdrop {
40
+ background: var(--overlay);
41
+ backdrop-filter: blur(3px);
42
+ animation: fade-in var(--popup-enter) var(--ease);
43
+ transition:
44
+ background var(--popup-exit),
45
+ backdrop-filter var(--popup-exit);
46
+ }
47
+ .closing {
48
+ pointer-events: none;
49
+ }
50
+ .closing::backdrop {
51
+ background: transparent;
52
+ backdrop-filter: blur(0);
53
+ }
54
+ .header {
55
+ display: flex;
56
+ flex: none;
57
+ align-items: flex-start;
58
+ gap: 16px;
59
+ justify-content: space-between;
60
+ padding: 20px 22px;
61
+ border-bottom: var(--separator-width) var(--separator-style)
62
+ var(--separator-color);
63
+ }
64
+ .heading {
65
+ min-width: 0;
66
+ padding-top: 4px;
67
+ }
68
+ .heading h2 {
69
+ font-size: 16px;
70
+ font-weight: 550;
71
+ overflow-wrap: anywhere;
72
+ }
73
+ .description {
74
+ margin-top: 6px;
75
+ color: var(--muted);
76
+ font-size: 12px;
77
+ line-height: 1.6;
78
+ }
79
+ .body {
80
+ flex: 1;
81
+ min-height: 0;
82
+ min-width: 0;
83
+ overflow: auto;
84
+ overscroll-behavior: contain;
85
+ padding: 22px;
86
+ }
87
+ .footer {
88
+ flex: none;
89
+ display: flex;
90
+ justify-content: flex-end;
91
+ align-items: center;
92
+ flex-wrap: wrap;
93
+ gap: 8px;
94
+ padding: 14px 22px;
95
+ border-top: var(--separator-width) var(--separator-style)
96
+ var(--separator-color);
97
+ background: var(--canvas);
98
+ }
99
+ @media (max-width: 600px) {
100
+ .header {
101
+ padding: 16px;
102
+ }
103
+ .body {
104
+ padding: 16px;
105
+ }
106
+ .footer {
107
+ padding: 12px 16px;
108
+ }
109
+ }
@@ -0,0 +1,6 @@
1
+ export declare function EmojiPicker(props: {
2
+ value: string;
3
+ onChange(value: string): void;
4
+ label?: string;
5
+ disabled?: boolean;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { CharacterPicker } from "./CharacterPicker.js";
3
+ import { useCharacterCatalog } from "./characterCatalog.js";
4
+ function EmojiPicker(props) {
5
+ const { retry, ...catalog } = useCharacterCatalog("emoji");
6
+ return /* @__PURE__ */ jsx(
7
+ CharacterPicker,
8
+ {
9
+ ...props,
10
+ ...catalog,
11
+ onRetry: retry,
12
+ label: props.label || "Emoji",
13
+ emoji: true
14
+ }
15
+ );
16
+ }
17
+ export {
18
+ EmojiPicker
19
+ };
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function EmptyState({ icon, title, description, children, action, }: {
3
+ icon?: ReactNode;
4
+ title: string;
5
+ description?: string;
6
+ children?: ReactNode;
7
+ action?: ReactNode;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Inbox } from "lucide-react";
3
+ import s from "./EmptyState.module.css";
4
+ function EmptyState({
5
+ icon = /* @__PURE__ */ jsx(Inbox, { size: 26 }),
6
+ title,
7
+ description,
8
+ children,
9
+ action
10
+ }) {
11
+ return /* @__PURE__ */ jsxs("div", { className: s.empty, children: [
12
+ /* @__PURE__ */ jsx("span", { className: s.emptyIcon, children: icon }),
13
+ /* @__PURE__ */ jsx("h2", { children: title }),
14
+ description && /* @__PURE__ */ jsx("p", { children: description }),
15
+ children || action
16
+ ] });
17
+ }
18
+ export {
19
+ EmptyState
20
+ };
@@ -0,0 +1,30 @@
1
+ .empty {
2
+ min-height: 270px;
3
+ display: flex;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ justify-content: center;
7
+ text-align: center;
8
+ gap: 12px;
9
+ padding: 30px;
10
+ }
11
+ .empty p {
12
+ color: var(--muted);
13
+ max-width: 300px;
14
+ font-size: 12px;
15
+ }
16
+ .emptyIcon {
17
+ display: grid;
18
+ place-items: center;
19
+ width: 50px;
20
+ height: 50px;
21
+ border: 1px solid var(--line);
22
+ border-radius: 14px;
23
+ background: var(--soft);
24
+ color: var(--muted);
25
+ margin-bottom: 6px;
26
+ }
27
+ .emptyIcon svg {
28
+ width: 23px;
29
+ height: 23px;
30
+ }
@@ -0,0 +1,8 @@
1
+ export declare function FieldLabel({ label, htmlFor, required, indicator, optional, as, }: {
2
+ label: string;
3
+ htmlFor?: string;
4
+ required?: boolean;
5
+ indicator?: "asterisk" | "text" | "none";
6
+ optional?: boolean;
7
+ as?: "label" | "span";
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import s from "./FormField.module.css";
3
+ function FieldLabel({
4
+ label,
5
+ htmlFor,
6
+ required = false,
7
+ indicator = "asterisk",
8
+ optional = false,
9
+ as = "label"
10
+ }) {
11
+ const children = /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ label,
13
+ required && indicator !== "none" && /* @__PURE__ */ jsx("span", { className: s.required, "aria-hidden": "true", title: "\u5FC5\u586B", children: indicator === "text" ? "\u5FC5\u586B" : "*" }),
14
+ !required && optional && /* @__PURE__ */ jsx("span", { className: s.optional, children: "\u53EF\u9009" })
15
+ ] });
16
+ return as === "span" ? /* @__PURE__ */ jsx("span", { className: s.label, children }) : /* @__PURE__ */ jsx("label", { htmlFor, className: s.label, children });
17
+ }
18
+ export {
19
+ FieldLabel
20
+ };
@@ -0,0 +1,5 @@
1
+ export declare function FieldMessages({ id, hint, error, }: {
2
+ id: string;
3
+ hint?: string;
4
+ error?: string;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import s from "./FormField.module.css";
3
+ function FieldMessages({
4
+ id,
5
+ hint,
6
+ error
7
+ }) {
8
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
9
+ hint && /* @__PURE__ */ jsx("p", { id: id + "-hint", className: s.hint, children: hint }),
10
+ error && /* @__PURE__ */ jsx("p", { id: id + "-error", className: s.error, role: "alert", children: error })
11
+ ] });
12
+ }
13
+ export {
14
+ FieldMessages
15
+ };
@@ -0,0 +1,5 @@
1
+ export declare function FileDropOverlay({ active, title, description, }: {
2
+ active: boolean;
3
+ title?: string;
4
+ description?: string;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { FolderOpen } from "lucide-react";
3
+ import s from "./FileDropOverlay.module.css";
4
+ function FileDropOverlay({
5
+ active,
6
+ title = "\u6DFB\u52A0\u6587\u4EF6",
7
+ description = "\u677E\u5F00\u4EE5\u6DFB\u52A0\u6587\u4EF6\u6216\u6587\u4EF6\u5939"
8
+ }) {
9
+ return /* @__PURE__ */ jsx(
10
+ "div",
11
+ {
12
+ className: s.overlay,
13
+ "data-active": active,
14
+ "aria-hidden": !active,
15
+ role: "status",
16
+ children: /* @__PURE__ */ jsxs("div", { className: s.card, children: [
17
+ /* @__PURE__ */ jsx("span", { className: s.icon, children: /* @__PURE__ */ jsx(FolderOpen, {}) }),
18
+ /* @__PURE__ */ jsx("strong", { children: title }),
19
+ /* @__PURE__ */ jsx("span", { children: description })
20
+ ] })
21
+ }
22
+ );
23
+ }
24
+ export {
25
+ FileDropOverlay
26
+ };
@@ -0,0 +1,55 @@
1
+ .overlay {
2
+ position: absolute;
3
+ inset: 0;
4
+ z-index: 6;
5
+ padding: 12px;
6
+ border-radius: inherit;
7
+ background: var(--surface);
8
+ pointer-events: none;
9
+ opacity: 0;
10
+ visibility: hidden;
11
+ transition:
12
+ opacity var(--popup-enter) var(--ease),
13
+ visibility var(--popup-enter);
14
+ }
15
+ .overlay[data-active="true"] {
16
+ opacity: 1;
17
+ visibility: visible;
18
+ }
19
+ .card {
20
+ height: 100%;
21
+ min-height: 0;
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: center;
25
+ justify-content: center;
26
+ gap: 9px;
27
+ border: 1px dashed color-mix(in srgb, var(--fg) 28%, var(--surface));
28
+ border-radius: var(--radius);
29
+ transform: scale(0.985);
30
+ transition: transform var(--motion-panel) var(--ease);
31
+ }
32
+ .overlay[data-active="true"] .card {
33
+ transform: scale(1);
34
+ }
35
+ .icon {
36
+ display: grid;
37
+ place-items: center;
38
+ width: 48px;
39
+ height: 48px;
40
+ border-radius: 12px;
41
+ background: var(--soft);
42
+ color: var(--muted);
43
+ }
44
+ .icon svg {
45
+ width: 28px;
46
+ height: 28px;
47
+ }
48
+ .card strong {
49
+ font-size: 15px;
50
+ font-weight: 550;
51
+ }
52
+ .card > span:last-child {
53
+ font-size: 12px;
54
+ color: var(--muted);
55
+ }
@@ -0,0 +1,15 @@
1
+ import { type ReactNode } from "react";
2
+ import { type FileConstraints, type FileRejection, type FileSelectionResult } from "./fileSelection";
3
+ export type FileDropZoneProps = FileConstraints & {
4
+ children: ReactNode;
5
+ onFiles(files: File[]): void;
6
+ onReject?(rejections: FileRejection[]): void;
7
+ onValidation?(result: FileSelectionResult): void;
8
+ title?: string;
9
+ description?: string;
10
+ disabled?: boolean;
11
+ label?: string;
12
+ className?: string;
13
+ showErrors?: boolean;
14
+ };
15
+ export declare function FileDropZone({ children, onFiles, title, description, disabled, label, className, onReject, onValidation, showErrors, ...constraints }: FileDropZoneProps): import("react").JSX.Element;