@robert-stackflow/oneui 0.6.19 → 0.6.21

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 (202) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +6 -0
  3. package/components/Accordion.d.ts +1 -1
  4. package/components/Accordion.js +1 -0
  5. package/components/AccountItem.js +1 -0
  6. package/components/ActionSheet.js +1 -0
  7. package/components/Alert.js +1 -0
  8. package/components/AppShell.js +1 -0
  9. package/components/AppearanceSettings.js +1 -0
  10. package/components/AuthLayout.js +1 -0
  11. package/components/Avatar.js +1 -0
  12. package/components/AvatarGroup.js +1 -0
  13. package/components/Badge.js +1 -0
  14. package/components/Banner.d.ts +3 -3
  15. package/components/Banner.js +12 -4
  16. package/components/BarChart.js +1 -0
  17. package/components/BlockedTab.js +1 -0
  18. package/components/Breadcrumb.js +1 -0
  19. package/components/Button.d.ts +4 -2
  20. package/components/Button.js +24 -0
  21. package/components/Calendar.js +19 -13
  22. package/components/Card.d.ts +5 -4
  23. package/components/Card.js +8 -4
  24. package/components/Card.module.css +10 -0
  25. package/components/Cascader.js +1 -0
  26. package/components/CatalogIcon.js +1 -0
  27. package/components/CharacterPicker.js +1 -0
  28. package/components/Checkbox.d.ts +5 -3
  29. package/components/Checkbox.js +17 -5
  30. package/components/ColorField.js +1 -0
  31. package/components/ColorPicker.js +1 -0
  32. package/components/Combobox.js +1 -0
  33. package/components/CommandPalette.js +1 -0
  34. package/components/ContextMenu.js +1 -0
  35. package/components/ContextMenuPanel.js +1 -0
  36. package/components/ContributionCalendar.js +1 -0
  37. package/components/ContributionCell.js +1 -0
  38. package/components/CopyButton.js +1 -0
  39. package/components/DataTable.js +1 -0
  40. package/components/DatePicker.js +8 -4
  41. package/components/DateRangePicker.js +1 -0
  42. package/components/Descriptions.js +1 -0
  43. package/components/Dialog.d.ts +9 -3
  44. package/components/Dialog.js +33 -11
  45. package/components/DialogVariants.js +1 -0
  46. package/components/DisclosureChevron.js +1 -0
  47. package/components/Divider.js +1 -0
  48. package/components/Drawer.d.ts +5 -2
  49. package/components/Drawer.js +20 -5
  50. package/components/EmojiPicker.js +1 -0
  51. package/components/EmptyState.js +1 -0
  52. package/components/FieldLabel.d.ts +2 -1
  53. package/components/FieldLabel.js +1 -0
  54. package/components/FieldMessages.d.ts +3 -2
  55. package/components/FieldMessages.js +1 -0
  56. package/components/FileDropOverlay.js +1 -0
  57. package/components/FileDropZone.js +1 -0
  58. package/components/FilePicker.d.ts +3 -2
  59. package/components/FilePicker.js +21 -5
  60. package/components/FileSelectionFeedback.js +1 -0
  61. package/components/FileTree.js +1 -0
  62. package/components/Form.js +1 -0
  63. package/components/FormErrorSummary.js +1 -0
  64. package/components/FormField.js +1 -0
  65. package/components/FormGroup.js +1 -0
  66. package/components/FormLayout.js +1 -0
  67. package/components/IconButton.js +1 -0
  68. package/components/IconPicker.js +1 -0
  69. package/components/Indicator.js +1 -0
  70. package/components/Input.js +1 -0
  71. package/components/Layout.js +1 -0
  72. package/components/Link.d.ts +8 -0
  73. package/components/Link.js +36 -0
  74. package/components/Link.module.css +18 -0
  75. package/components/LoadingOverlay.js +1 -0
  76. package/components/LoadingState.js +1 -0
  77. package/components/Markdown.d.ts +3 -1
  78. package/components/Markdown.js +3 -1
  79. package/components/Menu.js +1 -0
  80. package/components/MenuItem.d.ts +8 -3
  81. package/components/MenuItem.js +24 -1
  82. package/components/MenuItemContent.js +1 -0
  83. package/components/MultiSelect.js +1 -0
  84. package/components/NavBar.d.ts +2 -1
  85. package/components/NavBar.js +3 -1
  86. package/components/NumberInput.js +1 -0
  87. package/components/Page.d.ts +2 -1
  88. package/components/Page.js +4 -2
  89. package/components/Page.module.css +9 -0
  90. package/components/Pagination.d.ts +4 -1
  91. package/components/Pagination.js +28 -14
  92. package/components/PasskeyItem.js +1 -0
  93. package/components/PasswordField.js +1 -0
  94. package/components/PinInput.js +1 -0
  95. package/components/Placeholder.js +1 -0
  96. package/components/Popconfirm.js +1 -0
  97. package/components/Popover.d.ts +3 -2
  98. package/components/Popover.js +9 -2
  99. package/components/Progress.js +1 -0
  100. package/components/RadioGroup.js +1 -0
  101. package/components/RangeSlider.js +1 -0
  102. package/components/ResizablePanel.js +1 -0
  103. package/components/ResourceCard.js +1 -0
  104. package/components/SearchField.js +1 -0
  105. package/components/Section.js +1 -0
  106. package/components/Segmented.d.ts +1 -0
  107. package/components/Segmented.js +32 -20
  108. package/components/Select.d.ts +3 -1
  109. package/components/Select.js +12 -2
  110. package/components/SelectOptionContent.js +1 -0
  111. package/components/SelectSettingRow.js +1 -0
  112. package/components/SelectTrigger.js +1 -0
  113. package/components/SelectionTag.js +1 -0
  114. package/components/SessionItem.js +1 -0
  115. package/components/SettingRow.d.ts +3 -2
  116. package/components/SettingRow.js +9 -2
  117. package/components/SettingsLayout.js +1 -0
  118. package/components/ShortcutInput.js +1 -0
  119. package/components/SideBar.js +1 -0
  120. package/components/SidebarNavigation.js +1 -0
  121. package/components/Skeleton.js +1 -0
  122. package/components/SkeletonRows.js +1 -0
  123. package/components/SkinTonePicker.js +1 -0
  124. package/components/Slider.js +2 -1
  125. package/components/Spinner.js +1 -0
  126. package/components/SplitButton.js +1 -0
  127. package/components/Statistic.js +1 -0
  128. package/components/Steps.js +1 -0
  129. package/components/Switch.d.ts +5 -0
  130. package/components/Switch.js +26 -2
  131. package/components/Switch.module.css +101 -59
  132. package/components/SwitchSettingRow.js +1 -0
  133. package/components/SymbolPicker.js +1 -0
  134. package/components/TabList.js +1 -0
  135. package/components/Table.js +1 -0
  136. package/components/TableColumnFilter.js +1 -0
  137. package/components/TableColumnVisibility.js +1 -0
  138. package/components/TableMarkup.d.ts +2 -2
  139. package/components/TableMarkup.js +5 -2
  140. package/components/TableOfContents.js +1 -0
  141. package/components/Tabs.js +1 -0
  142. package/components/TagInput.js +1 -0
  143. package/components/TextAreaSettingRow.js +1 -0
  144. package/components/TextSettingRow.js +1 -0
  145. package/components/Textarea.js +1 -0
  146. package/components/ThemePicker.js +1 -0
  147. package/components/ThemeProvider.js +1 -0
  148. package/components/ThemeStylePicker.js +1 -0
  149. package/components/TimeColumns.js +8 -1
  150. package/components/Timeline.js +1 -0
  151. package/components/Toast.js +4 -1
  152. package/components/ToastProvider.js +1 -0
  153. package/components/Tooltip.js +7 -3
  154. package/components/TreeGuides.js +1 -0
  155. package/components/TreeSelect.js +1 -0
  156. package/components/TreeTable.js +1 -0
  157. package/components/UIProvider.d.ts +1 -0
  158. package/components/UIProvider.js +2 -0
  159. package/components/UnderlinedTab.js +1 -0
  160. package/components/Upload.js +1 -0
  161. package/components/UploadList.js +1 -0
  162. package/components/UploadListItem.js +1 -0
  163. package/components/UptimeChart.js +1 -0
  164. package/components/VirtualPickerList.js +1 -0
  165. package/components/appearance.js +1 -0
  166. package/components/calendarNow.js +1 -0
  167. package/components/characterCatalog.js +1 -0
  168. package/components/color.js +1 -0
  169. package/components/contribution.js +1 -0
  170. package/components/createToaster.js +1 -0
  171. package/components/dateConstraints.js +1 -0
  172. package/components/field.d.ts +7 -7
  173. package/components/field.js +3 -2
  174. package/components/fileSelection.js +1 -0
  175. package/components/hierarchy.js +1 -0
  176. package/components/iconCatalog.js +1 -0
  177. package/components/index.d.ts +2 -0
  178. package/components/index.js +5 -0
  179. package/components/menuFocus.js +1 -0
  180. package/components/menuPointer.js +1 -0
  181. package/components/menuTypes.js +1 -0
  182. package/components/motion.js +1 -0
  183. package/components/rangeMath.js +1 -0
  184. package/components/settingRowControl.js +1 -0
  185. package/components/surfacePortal.js +1 -0
  186. package/components/tooltipState.js +1 -0
  187. package/components/types.js +1 -0
  188. package/components/uploadTypes.js +1 -0
  189. package/components/useFormState.js +1 -0
  190. package/components/useHierarchy.js +1 -0
  191. package/components/useMenuLayers.js +1 -0
  192. package/components/useModalFocus.d.ts +1 -1
  193. package/components/useModalFocus.js +9 -3
  194. package/components/useModalScrollLock.js +1 -0
  195. package/components/usePopover.js +1 -0
  196. package/components/usePortalRoot.d.ts +2 -0
  197. package/components/usePortalRoot.js +12 -0
  198. package/components/useTabIndicator.js +1 -0
  199. package/components/useUIText.d.ts +5 -0
  200. package/components/useUIText.js +14 -0
  201. package/components/useUploadQueue.js +1 -0
  202. package/package.json +7 -1
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./MenuItem.module.css";
3
4
  function MenuItemContent({
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { moveMenuFocus } from "./menuFocus.js";
3
4
  import { fieldTriggerProps, useFieldControl } from "./field.js";
@@ -8,6 +8,7 @@ export type NavBarItem = NavigationItem | {
8
8
  children: readonly NavigationItem[];
9
9
  };
10
10
  export type NavBarProps = {
11
+ as?: "header" | "div";
11
12
  items: readonly NavBarItem[];
12
13
  active: string;
13
14
  onNavigate?(path: string): void;
@@ -17,4 +18,4 @@ export type NavBarProps = {
17
18
  label?: string;
18
19
  className?: string;
19
20
  };
20
- export declare function NavBar({ items, active, onNavigate, brand, homePath, actions, label, className, }: NavBarProps): import("react").JSX.Element;
21
+ export declare function NavBar({ as: Root, items, active, onNavigate, brand, homePath, actions, label, className, }: NavBarProps): import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useId, useState } from "react";
3
4
  import { ChevronDown, Menu as MenuIcon } from "lucide-react";
@@ -14,6 +15,7 @@ function follow(event, path, onNavigate) {
14
15
  onNavigate(path);
15
16
  }
16
17
  function NavBar({
18
+ as: Root = "header",
17
19
  items,
18
20
  active,
19
21
  onNavigate,
@@ -24,7 +26,7 @@ function NavBar({
24
26
  className = ""
25
27
  }) {
26
28
  const [mobile, setMobile] = useState(false);
27
- return /* @__PURE__ */ jsxs("header", { className: `${s.bar} ${className}`, children: [
29
+ return /* @__PURE__ */ jsxs(Root, { className: `${s.bar} ${className}`, children: [
28
30
  brand && /* @__PURE__ */ jsx(
29
31
  "a",
30
32
  {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { fieldInputProps, useFieldControl } from "./field.js";
3
4
  import { useEffect, useRef, useState } from "react";
@@ -1,9 +1,10 @@
1
1
  import type { ReactNode } from "react";
2
- export declare function PageHeading({ title, description, actions, titleExtra, }: {
2
+ export declare function PageHeading({ title, description, actions, titleExtra, compact, }: {
3
3
  title?: ReactNode;
4
4
  description?: string;
5
5
  actions?: ReactNode;
6
6
  titleExtra?: ReactNode;
7
+ compact?: boolean;
7
8
  }): import("react").JSX.Element | null;
8
9
  export declare function Page({ title, description, actions, children, }: {
9
10
  title?: ReactNode;
@@ -1,13 +1,15 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./Page.module.css";
3
4
  function PageHeading({
4
5
  title,
5
6
  description,
6
7
  actions,
7
- titleExtra
8
+ titleExtra,
9
+ compact = false
8
10
  }) {
9
11
  if (!title && !description && !actions && !titleExtra) return null;
10
- return /* @__PURE__ */ jsxs("header", { className: s.heading, children: [
12
+ return /* @__PURE__ */ jsxs("header", { className: `${s.heading} ${compact ? s.compact : ""}`, children: [
11
13
  /* @__PURE__ */ jsxs("div", { children: [
12
14
  /* @__PURE__ */ jsxs("div", { className: s.title, children: [
13
15
  title && /* @__PURE__ */ jsx("h1", { children: title }),
@@ -59,3 +59,12 @@
59
59
  translate: 0 0;
60
60
  }
61
61
  }
62
+
63
+ .compact {
64
+ margin-bottom: 0;
65
+ align-items: center;
66
+ }
67
+ .compact h1 {
68
+ font-size: 18px;
69
+ line-height: 1.5;
70
+ }
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- export declare function Pagination({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizes, summary, resetPageOnSizeChange, compact, size: controlSize, className, showSummary, }: {
2
+ export declare function Pagination({ page, pageSize, total, onPageChange, onPageSizeChange, pageSizes, summary, resetPageOnSizeChange, compact, size: controlSize, className, showSummary, label, previousLabel, nextLabel, }: {
3
3
  page: number;
4
4
  pageSize: number;
5
5
  total: number;
@@ -13,4 +13,7 @@ export declare function Pagination({ page, pageSize, total, onPageChange, onPage
13
13
  size?: "default" | "small";
14
14
  className?: string;
15
15
  showSummary?: boolean;
16
+ label?: string;
17
+ previousLabel?: string;
18
+ nextLabel?: string;
16
19
  }): import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useEffect, useId, useState } from "react";
3
4
  import {
@@ -10,6 +11,7 @@ import { Button } from "./Button.js";
10
11
  import { Select } from "./Select.js";
11
12
  import control from "./Control.module.css";
12
13
  import s from "./Pagination.module.css";
14
+ import { useUIText } from "./useUIText.js";
13
15
  function Pagination({
14
16
  page,
15
17
  pageSize,
@@ -22,8 +24,12 @@ function Pagination({
22
24
  compact = false,
23
25
  size: controlSize = "default",
24
26
  className = "",
25
- showSummary = true
27
+ showSummary = true,
28
+ label,
29
+ previousLabel,
30
+ nextLabel
26
31
  }) {
32
+ const { text, english } = useUIText();
27
33
  const size = Math.max(1, pageSize), pages = Math.max(1, Math.ceil(total / size)), current = Math.min(pages, Math.max(1, page)), id = useId(), [draft, setDraft] = useState(String(current));
28
34
  useEffect(() => setDraft(String(current)), [current]);
29
35
  const jump = () => {
@@ -49,27 +55,31 @@ function Pagination({
49
55
  "nav",
50
56
  {
51
57
  className: `${s.pagination} ${compact ? s.compact : ""} ${controlSize === "small" ? s.small : ""} ${className}`,
52
- "aria-label": "\u5206\u9875",
58
+ "aria-label": label ?? text("\u5206\u9875", "Pages", "\u5206\u9801"),
53
59
  children: [
54
60
  showSummary && /* @__PURE__ */ jsxs("span", { className: s.summary, children: [
55
61
  total ? (current - 1) * size + 1 + "\u2013" + Math.min(current * size, total) : 0,
56
62
  " ",
57
63
  "/ ",
58
64
  total,
59
- " \u9879",
65
+ " ",
66
+ text("\u9879", "items", "\u9805"),
60
67
  summary
61
68
  ] }),
62
69
  /* @__PURE__ */ jsxs("div", { className: s.controls, children: [
63
70
  onPageSizeChange && /* @__PURE__ */ jsx(
64
71
  Select,
65
72
  {
66
- label: "\u6BCF\u9875\u6761\u6570",
73
+ label: text("\u6BCF\u9875\u6761\u6570", "Page size", "\u6BCF\u9801\u7B46\u6578"),
67
74
  value: String(size),
68
75
  onChange: (v) => {
69
76
  onPageSizeChange(Number(v));
70
77
  if (resetPageOnSizeChange) onPageChange(1);
71
78
  },
72
- options: [.../* @__PURE__ */ new Set([...pageSizes, size])].sort((a, b) => a - b).map((n) => ({ value: String(n), label: n + " / \u9875" }))
79
+ options: [.../* @__PURE__ */ new Set([...pageSizes, size])].sort((a, b) => a - b).map((n) => ({
80
+ value: String(n),
81
+ label: n + text(" / \u9875", " / page", " / \u9801")
82
+ }))
73
83
  }
74
84
  ),
75
85
  /* @__PURE__ */ jsxs("div", { className: s.pages, children: [
@@ -77,7 +87,7 @@ function Pagination({
77
87
  Button,
78
88
  {
79
89
  className: s.arrow,
80
- "aria-label": "\u7B2C\u4E00\u9875",
90
+ "aria-label": text("\u7B2C\u4E00\u9875", "First page", "\u7B2C\u4E00\u9801"),
81
91
  disabled: current === 1,
82
92
  onClick: () => onPageChange(1),
83
93
  children: /* @__PURE__ */ jsx(ChevronsLeft, {})
@@ -87,7 +97,7 @@ function Pagination({
87
97
  Button,
88
98
  {
89
99
  className: s.arrow,
90
- "aria-label": "\u4E0A\u4E00\u9875",
100
+ "aria-label": previousLabel ?? text("\u4E0A\u4E00\u9875", "Previous", "\u4E0A\u4E00\u9801"),
91
101
  disabled: current === 1,
92
102
  onClick: () => onPageChange(current - 1),
93
103
  children: /* @__PURE__ */ jsx(ChevronLeft, {})
@@ -99,7 +109,7 @@ function Pagination({
99
109
  Button,
100
110
  {
101
111
  className: s.page,
102
- "aria-label": "\u7B2C " + n + " \u9875",
112
+ "aria-label": english ? "Page " + n : "\u7B2C " + n + text(" \u9875", "", " \u9801"),
103
113
  "aria-current": n === current ? "page" : void 0,
104
114
  variant: n === current ? "primary" : "ghost",
105
115
  onClick: () => onPageChange(n),
@@ -111,7 +121,7 @@ function Pagination({
111
121
  Button,
112
122
  {
113
123
  className: s.arrow,
114
- "aria-label": "\u4E0B\u4E00\u9875",
124
+ "aria-label": nextLabel ?? text("\u4E0B\u4E00\u9875", "Next", "\u4E0B\u4E00\u9801"),
115
125
  disabled: current === pages,
116
126
  onClick: () => onPageChange(current + 1),
117
127
  children: /* @__PURE__ */ jsx(ChevronRight, {})
@@ -121,7 +131,7 @@ function Pagination({
121
131
  Button,
122
132
  {
123
133
  className: s.arrow,
124
- "aria-label": "\u6700\u540E\u4E00\u9875",
134
+ "aria-label": text("\u6700\u540E\u4E00\u9875", "Last page", "\u6700\u5F8C\u4E00\u9801"),
125
135
  disabled: current === pages,
126
136
  onClick: () => onPageChange(pages),
127
137
  children: /* @__PURE__ */ jsx(ChevronsRight, {})
@@ -137,14 +147,18 @@ function Pagination({
137
147
  jump();
138
148
  },
139
149
  children: [
140
- /* @__PURE__ */ jsx("label", { htmlFor: id, children: "\u8DF3\u81F3" }),
150
+ /* @__PURE__ */ jsx("label", { htmlFor: id, children: text("\u8DF3\u81F3", "Go to") }),
141
151
  /* @__PURE__ */ jsx(
142
152
  "input",
143
153
  {
144
154
  id,
145
155
  className: control.surface,
146
- "aria-label": "\u8DF3\u8F6C\u9875\u7801",
147
- "aria-description": "\u8F93\u5165\u9875\u7801\u540E\u6309\u56DE\u8F66\u786E\u8BA4",
156
+ "aria-label": text("\u8DF3\u8F6C\u9875\u7801", "Page number", "\u8DF3\u8F49\u9801\u78BC"),
157
+ "aria-description": text(
158
+ "\u8F93\u5165\u9875\u7801\u540E\u6309\u56DE\u8F66\u786E\u8BA4",
159
+ "Enter a page number and press Enter",
160
+ "\u8F38\u5165\u9801\u78BC\u5F8C\u6309 Enter \u78BA\u8A8D"
161
+ ),
148
162
  inputMode: "numeric",
149
163
  value: draft,
150
164
  onChange: (e) => setDraft(e.target.value),
@@ -157,7 +171,7 @@ function Pagination({
157
171
  }
158
172
  }
159
173
  ),
160
- /* @__PURE__ */ jsx("span", { children: "\u9875" })
174
+ /* @__PURE__ */ jsx("span", { children: text("\u9875", "", "\u9801") })
161
175
  ]
162
176
  }
163
177
  )
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { KeyRound, Pencil, Trash2 } from "lucide-react";
3
4
  import { AccountItem } from "./AccountItem.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useRef, useState } from "react";
3
4
  import { Eye, EyeOff } from "lucide-react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  useEffect,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import {
3
4
  Inbox,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  cloneElement,
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode, type RefObject } from "react";
2
2
  import { type MenuSide } from "./motion";
3
- export declare function Popover({ open: requestedOpen, onClose, anchor, children, width, maxHeight, scrollable, side, align, label, role, id, onKeyDown, descriptionId, autoFocus, matchAnchorWidth, className, }: {
3
+ export declare function Popover({ open: requestedOpen, onClose, anchor, children, width, maxHeight, scrollable, side, align, label, role, id, onKeyDown, descriptionId, autoFocus, matchAnchorWidth, className, portalContainer, }: {
4
4
  open: boolean;
5
5
  onClose(): void;
6
6
  anchor: RefObject<HTMLElement | null>;
@@ -20,4 +20,5 @@ export declare function Popover({ open: requestedOpen, onClose, anchor, children
20
20
  autoFocus?: boolean;
21
21
  matchAnchorWidth?: boolean;
22
22
  className?: string;
23
- }): import("react").ReactPortal;
23
+ portalContainer?: HTMLElement | null;
24
+ }): import("react").ReactPortal | null;
@@ -1,4 +1,6 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
3
+ import { usePortalRoot } from "./usePortalRoot.js";
2
4
  import { FieldContext } from "./field.js";
3
5
  import {
4
6
  useLayoutEffect,
@@ -26,9 +28,11 @@ function Popover({
26
28
  descriptionId,
27
29
  autoFocus = true,
28
30
  matchAnchorWidth = false,
29
- className = ""
31
+ className = "",
32
+ portalContainer
30
33
  }) {
31
- const owner = useSurfacePortal(), portalHost = owner?.host || document.body, open = requestedOpen && owner?.active !== false;
34
+ const root = usePortalRoot();
35
+ const owner = useSurfacePortal(), portalHost = portalContainer || owner?.host || root, open = requestedOpen && owner?.active !== false;
32
36
  const ref = useRef(null), close = useRef(onClose);
33
37
  close.current = onClose;
34
38
  const opened = useRef(open);
@@ -38,10 +42,12 @@ function Popover({
38
42
  }, [requestedOpen, owner?.active]);
39
43
  useEffect(() => {
40
44
  const node = ref.current;
45
+ if (!node) return;
41
46
  return () => cancelMotion(node);
42
47
  }, [portalHost]);
43
48
  useLayoutEffect(() => {
44
49
  const surface = ref.current, trigger = anchor.current;
50
+ if (!surface) return;
45
51
  if (!open) {
46
52
  if (!surface.matches(":popover-open")) return;
47
53
  surface.inert = true;
@@ -160,6 +166,7 @@ function Popover({
160
166
  side,
161
167
  align
162
168
  ]);
169
+ if (!portalHost) return null;
163
170
  return createPortal(
164
171
  /* @__PURE__ */ jsx(
165
172
  "div",
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import s from "./Progress.module.css";
3
4
  function Progress({
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { FieldLabel } from "./FieldLabel.js";
3
4
  import { useFieldControl } from "./field.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useEffect, useRef } from "react";
3
4
  import { Tooltip } from "./Tooltip.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  useCallback,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { ArrowUpRight } from "lucide-react";
3
4
  import card from "./Card.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useRef } from "react";
3
4
  import { Spinner } from "./Spinner.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./Section.module.css";
3
4
  function Section({
@@ -5,6 +5,7 @@ export declare function Segmented<T extends string>({ value, onChange, options,
5
5
  options: {
6
6
  value: T;
7
7
  label: ReactNode;
8
+ textValue?: string;
8
9
  disabled?: boolean;
9
10
  }[];
10
11
  label: string;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useLayoutEffect, useRef } from "react";
3
4
  import s from "./Segmented.module.css";
@@ -52,26 +53,37 @@ function Segmented({
52
53
  onChange(enabled[target].value);
53
54
  buttons.current.get(enabled[target].value)?.focus();
54
55
  };
55
- return /* @__PURE__ */ jsxs("div", { ref: root, className: s.segmented, "data-full-width": fullWidth || void 0, role: "group", "aria-label": label, children: [
56
- /* @__PURE__ */ jsx("span", { className: s.indicator, "aria-hidden": "true", "data-segment-indicator": true }),
57
- options.map((option, index) => /* @__PURE__ */ jsx(
58
- "button",
59
- {
60
- type: "button",
61
- ref: (node) => {
62
- if (node) buttons.current.set(option.value, node);
63
- else buttons.current.delete(option.value);
64
- },
65
- "aria-pressed": value === option.value,
66
- disabled: option.disabled,
67
- tabIndex: (options.some((item) => item.value === value && !item.disabled) ? value === option.value : option === options.find((item) => !item.disabled)) ? 0 : -1,
68
- onKeyDown: (event) => keyboard(event, index),
69
- onClick: () => onChange(option.value),
70
- children: option.label
71
- },
72
- option.value
73
- ))
74
- ] });
56
+ return /* @__PURE__ */ jsxs(
57
+ "div",
58
+ {
59
+ ref: root,
60
+ className: s.segmented,
61
+ "data-full-width": fullWidth || void 0,
62
+ role: "group",
63
+ "aria-label": label,
64
+ children: [
65
+ /* @__PURE__ */ jsx("span", { className: s.indicator, "aria-hidden": "true", "data-segment-indicator": true }),
66
+ options.map((option, index) => /* @__PURE__ */ jsx(
67
+ "button",
68
+ {
69
+ type: "button",
70
+ ref: (node) => {
71
+ if (node) buttons.current.set(option.value, node);
72
+ else buttons.current.delete(option.value);
73
+ },
74
+ "aria-label": option.textValue,
75
+ "aria-pressed": value === option.value,
76
+ disabled: option.disabled,
77
+ tabIndex: (options.some((item) => item.value === value && !item.disabled) ? value === option.value : option === options.find((item) => !item.disabled)) ? 0 : -1,
78
+ onKeyDown: (event) => keyboard(event, index),
79
+ onClick: () => onChange(option.value),
80
+ children: option.label
81
+ },
82
+ option.value
83
+ ))
84
+ ]
85
+ }
86
+ );
75
87
  }
76
88
  export {
77
89
  Segmented
@@ -1,6 +1,6 @@
1
1
  import { type FieldOptions } from "./field";
2
2
  import type { SelectOption } from "./types";
3
- export declare function Select({ value, onChange, options, label, disabled, id: controlId, name, required, readOnly, error, hint, placeholder, emptyText, ...aria }: FieldOptions & {
3
+ export declare function Select({ value, onChange, options, label, disabled, id: controlId, name, required, readOnly, error, hint, placeholder, emptyText, portalContainer, onCloseAutoFocus, ...aria }: FieldOptions & {
4
4
  value: string;
5
5
  onChange(value: string): void;
6
6
  options: SelectOption[];
@@ -8,4 +8,6 @@ export declare function Select({ value, onChange, options, label, disabled, id:
8
8
  disabled?: boolean;
9
9
  placeholder?: string;
10
10
  emptyText?: string;
11
+ portalContainer?: HTMLElement | null;
12
+ onCloseAutoFocus?(event: Event): void;
11
13
  }): import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { fieldTriggerProps, useFieldControl } from "./field.js";
3
4
  import { MenuItem } from "./MenuItem.js";
@@ -20,6 +21,8 @@ function Select({
20
21
  hint,
21
22
  placeholder = "\u8BF7\u9009\u62E9",
22
23
  emptyText = "\u6CA1\u6709\u53EF\u7528\u9009\u9879",
24
+ portalContainer,
25
+ onCloseAutoFocus,
23
26
  ...aria
24
27
  }) {
25
28
  const field = useFieldControl({
@@ -34,6 +37,12 @@ function Select({
34
37
  ...aria
35
38
  });
36
39
  const pop = usePopover(field.disabled || field.readOnly), ref = pop.anchor, open = pop.open, [active, setActive] = useState(0), id = useId();
40
+ const close = () => {
41
+ pop.close();
42
+ const event = new Event("closeAutoFocus", { cancelable: true });
43
+ onCloseAutoFocus?.(event);
44
+ if (!event.defaultPrevented) ref.current?.focus({ preventScroll: true });
45
+ };
37
46
  const reserveIcon = options.some((option) => !!option.icon);
38
47
  const selected = options.findIndex((v) => v.value === value);
39
48
  const show = () => {
@@ -45,7 +54,7 @@ function Select({
45
54
  const choose = (index) => {
46
55
  if (!field.disabled && !field.readOnly && options[index] && !options[index].disabled) {
47
56
  onChange(options[index].value);
48
- pop.closeAndFocus();
57
+ close();
49
58
  }
50
59
  };
51
60
  const move = (delta) => {
@@ -128,7 +137,8 @@ function Select({
128
137
  {
129
138
  id,
130
139
  open,
131
- onClose: pop.close,
140
+ onClose: close,
141
+ portalContainer,
132
142
  anchor: ref,
133
143
  width: Math.max(
134
144
  options.some((option) => option.description || option.shortcut) ? 280 : 200,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { MenuItemContent } from "./MenuItemContent.js";
3
4
  import s from "./SelectOptionContent.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { Select } from "./Select.js";
3
4
  import { FormField } from "./FormField.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { DisclosureChevron } from "./DisclosureChevron.js";
3
4
  import s from "./Select.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { X } from "lucide-react";
3
4
  import s from "./TagInput.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { Globe, LogOut, Monitor, Smartphone, Tablet } from "lucide-react";
3
4
  import { AccountItem } from "./AccountItem.js";
@@ -1,6 +1,7 @@
1
- import type { CSSProperties, ReactNode } from "react";
1
+ import { type CSSProperties, type ReactNode } from "react";
2
2
  export type SettingRowProps = {
3
3
  title: string;
4
+ className?: string;
4
5
  description?: string;
5
6
  children: ReactNode;
6
7
  divider?: boolean;
@@ -10,4 +11,4 @@ export type SettingRowProps = {
10
11
  controlId?: string;
11
12
  descriptionId?: string;
12
13
  };
13
- export declare function SettingRow({ title, description, children, divider, titleBold, align, controlWidth, controlId, descriptionId, }: SettingRowProps): import("react").JSX.Element;
14
+ export declare function SettingRow({ title, className, description, children, divider, titleBold, align, controlWidth, controlId, descriptionId, }: SettingRowProps): import("react").JSX.Element;
@@ -1,7 +1,10 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useId } from "react";
2
4
  import s from "./SettingRow.module.css";
3
5
  function SettingRow({
4
6
  title,
7
+ className = "",
5
8
  description,
6
9
  children,
7
10
  divider = true,
@@ -11,17 +14,21 @@ function SettingRow({
11
14
  controlId,
12
15
  descriptionId
13
16
  }) {
17
+ const titleId = useId();
14
18
  return /* @__PURE__ */ jsxs(
15
19
  "div",
16
20
  {
17
- className: s.settingRow,
21
+ className: `${s.settingRow} ${className}`,
22
+ role: controlId ? void 0 : "group",
23
+ "aria-labelledby": controlId ? void 0 : titleId,
24
+ "aria-describedby": !controlId && description ? descriptionId : void 0,
18
25
  "data-divider": divider,
19
26
  "data-title-bold": titleBold,
20
27
  "data-align": align,
21
28
  "data-sized": controlWidth !== void 0,
22
29
  children: [
23
30
  /* @__PURE__ */ jsxs("div", { className: s.settingCopy, children: [
24
- /* @__PURE__ */ jsx("h3", { children: controlId ? /* @__PURE__ */ jsx("label", { htmlFor: controlId, children: title }) : title }),
31
+ /* @__PURE__ */ jsx("h3", { id: titleId, children: controlId ? /* @__PURE__ */ jsx("label", { htmlFor: controlId, children: title }) : title }),
25
32
  description && /* @__PURE__ */ jsx("p", { id: descriptionId, children: description })
26
33
  ] }),
27
34
  /* @__PURE__ */ jsx(
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { Settings2, Palette } from "lucide-react";
3
4
  import { SideBar } from "./SideBar.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { FieldMessages } from "./FieldMessages.js";
3
4
  import { FieldLabel } from "./FieldLabel.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import {
3
4
  SidebarNavigation
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  useId,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import s from "./Skeleton.module.css";
3
4
  function Skeleton({
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { Skeleton } from "./Skeleton.js";
3
4
  import s from "./SkeletonRows.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./SkinTonePicker.module.css";
3
4
  const tones = [