@robert-stackflow/oneui 0.6.19 → 0.6.20

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 (196) hide show
  1. package/components/Accordion.d.ts +1 -1
  2. package/components/Accordion.js +1 -0
  3. package/components/AccountItem.js +1 -0
  4. package/components/ActionSheet.js +1 -0
  5. package/components/Alert.js +1 -0
  6. package/components/AppShell.js +1 -0
  7. package/components/AppearanceSettings.js +1 -0
  8. package/components/AuthLayout.js +1 -0
  9. package/components/Avatar.js +1 -0
  10. package/components/AvatarGroup.js +1 -0
  11. package/components/Badge.js +1 -0
  12. package/components/Banner.d.ts +3 -3
  13. package/components/Banner.js +12 -4
  14. package/components/BarChart.js +1 -0
  15. package/components/BlockedTab.js +1 -0
  16. package/components/Breadcrumb.js +1 -0
  17. package/components/Button.d.ts +4 -2
  18. package/components/Button.js +24 -0
  19. package/components/Calendar.js +19 -13
  20. package/components/Card.d.ts +5 -4
  21. package/components/Card.js +8 -4
  22. package/components/Card.module.css +10 -0
  23. package/components/Cascader.js +1 -0
  24. package/components/CatalogIcon.js +1 -0
  25. package/components/CharacterPicker.js +1 -0
  26. package/components/Checkbox.d.ts +5 -3
  27. package/components/Checkbox.js +17 -5
  28. package/components/ColorField.js +1 -0
  29. package/components/ColorPicker.js +1 -0
  30. package/components/Combobox.js +1 -0
  31. package/components/CommandPalette.js +1 -0
  32. package/components/ContextMenu.js +1 -0
  33. package/components/ContextMenuPanel.js +1 -0
  34. package/components/ContributionCalendar.js +1 -0
  35. package/components/ContributionCell.js +1 -0
  36. package/components/CopyButton.js +1 -0
  37. package/components/DataTable.js +1 -0
  38. package/components/DatePicker.js +8 -4
  39. package/components/DateRangePicker.js +1 -0
  40. package/components/Descriptions.js +1 -0
  41. package/components/Dialog.d.ts +9 -3
  42. package/components/Dialog.js +33 -11
  43. package/components/DialogVariants.js +1 -0
  44. package/components/DisclosureChevron.js +1 -0
  45. package/components/Divider.js +1 -0
  46. package/components/Drawer.d.ts +5 -2
  47. package/components/Drawer.js +20 -5
  48. package/components/EmojiPicker.js +1 -0
  49. package/components/EmptyState.js +1 -0
  50. package/components/FieldLabel.d.ts +2 -1
  51. package/components/FieldLabel.js +1 -0
  52. package/components/FieldMessages.d.ts +3 -2
  53. package/components/FieldMessages.js +1 -0
  54. package/components/FileDropOverlay.js +1 -0
  55. package/components/FileDropZone.js +1 -0
  56. package/components/FilePicker.d.ts +3 -2
  57. package/components/FilePicker.js +21 -5
  58. package/components/FileSelectionFeedback.js +1 -0
  59. package/components/FileTree.js +1 -0
  60. package/components/Form.js +1 -0
  61. package/components/FormErrorSummary.js +1 -0
  62. package/components/FormField.js +1 -0
  63. package/components/FormGroup.js +1 -0
  64. package/components/FormLayout.js +1 -0
  65. package/components/IconButton.js +1 -0
  66. package/components/IconPicker.js +1 -0
  67. package/components/Indicator.js +1 -0
  68. package/components/Input.js +1 -0
  69. package/components/Layout.js +1 -0
  70. package/components/LoadingOverlay.js +1 -0
  71. package/components/LoadingState.js +1 -0
  72. package/components/Markdown.js +1 -0
  73. package/components/Menu.js +1 -0
  74. package/components/MenuItem.d.ts +8 -3
  75. package/components/MenuItem.js +24 -1
  76. package/components/MenuItemContent.js +1 -0
  77. package/components/MultiSelect.js +1 -0
  78. package/components/NavBar.d.ts +2 -1
  79. package/components/NavBar.js +3 -1
  80. package/components/NumberInput.js +1 -0
  81. package/components/Page.d.ts +2 -1
  82. package/components/Page.js +4 -2
  83. package/components/Page.module.css +9 -0
  84. package/components/Pagination.d.ts +4 -1
  85. package/components/Pagination.js +28 -14
  86. package/components/PasskeyItem.js +1 -0
  87. package/components/PasswordField.js +1 -0
  88. package/components/PinInput.js +1 -0
  89. package/components/Placeholder.js +1 -0
  90. package/components/Popconfirm.js +1 -0
  91. package/components/Popover.d.ts +3 -2
  92. package/components/Popover.js +9 -2
  93. package/components/Progress.js +1 -0
  94. package/components/RadioGroup.js +1 -0
  95. package/components/RangeSlider.js +1 -0
  96. package/components/ResizablePanel.js +1 -0
  97. package/components/ResourceCard.js +1 -0
  98. package/components/SearchField.js +1 -0
  99. package/components/Section.js +1 -0
  100. package/components/Segmented.d.ts +1 -0
  101. package/components/Segmented.js +32 -20
  102. package/components/Select.d.ts +3 -1
  103. package/components/Select.js +12 -2
  104. package/components/SelectOptionContent.js +1 -0
  105. package/components/SelectSettingRow.js +1 -0
  106. package/components/SelectTrigger.js +1 -0
  107. package/components/SelectionTag.js +1 -0
  108. package/components/SessionItem.js +1 -0
  109. package/components/SettingRow.d.ts +3 -2
  110. package/components/SettingRow.js +9 -2
  111. package/components/SettingsLayout.js +1 -0
  112. package/components/ShortcutInput.js +1 -0
  113. package/components/SideBar.js +1 -0
  114. package/components/SidebarNavigation.js +1 -0
  115. package/components/Skeleton.js +1 -0
  116. package/components/SkeletonRows.js +1 -0
  117. package/components/SkinTonePicker.js +1 -0
  118. package/components/Slider.js +1 -0
  119. package/components/Spinner.js +1 -0
  120. package/components/SplitButton.js +1 -0
  121. package/components/Statistic.js +1 -0
  122. package/components/Steps.js +1 -0
  123. package/components/Switch.d.ts +5 -0
  124. package/components/Switch.js +26 -2
  125. package/components/Switch.module.css +101 -59
  126. package/components/SwitchSettingRow.js +1 -0
  127. package/components/SymbolPicker.js +1 -0
  128. package/components/TabList.js +1 -0
  129. package/components/Table.js +1 -0
  130. package/components/TableColumnFilter.js +1 -0
  131. package/components/TableColumnVisibility.js +1 -0
  132. package/components/TableMarkup.d.ts +2 -2
  133. package/components/TableMarkup.js +5 -2
  134. package/components/TableOfContents.js +1 -0
  135. package/components/Tabs.js +1 -0
  136. package/components/TagInput.js +1 -0
  137. package/components/TextAreaSettingRow.js +1 -0
  138. package/components/TextSettingRow.js +1 -0
  139. package/components/Textarea.js +1 -0
  140. package/components/ThemePicker.js +1 -0
  141. package/components/ThemeProvider.js +1 -0
  142. package/components/ThemeStylePicker.js +1 -0
  143. package/components/TimeColumns.js +8 -1
  144. package/components/Timeline.js +1 -0
  145. package/components/Toast.js +4 -1
  146. package/components/ToastProvider.js +1 -0
  147. package/components/Tooltip.js +7 -3
  148. package/components/TreeGuides.js +1 -0
  149. package/components/TreeSelect.js +1 -0
  150. package/components/TreeTable.js +1 -0
  151. package/components/UIProvider.d.ts +1 -0
  152. package/components/UIProvider.js +2 -0
  153. package/components/UnderlinedTab.js +1 -0
  154. package/components/Upload.js +1 -0
  155. package/components/UploadList.js +1 -0
  156. package/components/UploadListItem.js +1 -0
  157. package/components/UptimeChart.js +1 -0
  158. package/components/VirtualPickerList.js +1 -0
  159. package/components/appearance.js +1 -0
  160. package/components/calendarNow.js +1 -0
  161. package/components/characterCatalog.js +1 -0
  162. package/components/color.js +1 -0
  163. package/components/contribution.js +1 -0
  164. package/components/createToaster.js +1 -0
  165. package/components/dateConstraints.js +1 -0
  166. package/components/field.d.ts +7 -7
  167. package/components/field.js +3 -2
  168. package/components/fileSelection.js +1 -0
  169. package/components/hierarchy.js +1 -0
  170. package/components/iconCatalog.js +1 -0
  171. package/components/index.d.ts +1 -0
  172. package/components/index.js +3 -0
  173. package/components/menuFocus.js +1 -0
  174. package/components/menuPointer.js +1 -0
  175. package/components/menuTypes.js +1 -0
  176. package/components/motion.js +1 -0
  177. package/components/rangeMath.js +1 -0
  178. package/components/settingRowControl.js +1 -0
  179. package/components/surfacePortal.js +1 -0
  180. package/components/tooltipState.js +1 -0
  181. package/components/types.js +1 -0
  182. package/components/uploadTypes.js +1 -0
  183. package/components/useFormState.js +1 -0
  184. package/components/useHierarchy.js +1 -0
  185. package/components/useMenuLayers.js +1 -0
  186. package/components/useModalFocus.d.ts +1 -1
  187. package/components/useModalFocus.js +9 -3
  188. package/components/useModalScrollLock.js +1 -0
  189. package/components/usePopover.js +1 -0
  190. package/components/usePortalRoot.d.ts +2 -0
  191. package/components/usePortalRoot.js +12 -0
  192. package/components/useTabIndicator.js +1 -0
  193. package/components/useUIText.d.ts +5 -0
  194. package/components/useUIText.js +14 -0
  195. package/components/useUploadQueue.js +1 -0
  196. package/package.json +1 -1
@@ -1,59 +1,101 @@
1
- .switch {
2
- position: relative;
3
- width: 36px;
4
- height: 22px;
5
- flex-shrink: 0;
6
- padding: 0;
7
- border: 1px solid color-mix(in srgb, var(--fg) 25%, var(--surface));
8
- border-radius: 999px;
9
- background: var(--field);
10
- transition:
11
- background-color var(--motion-panel) var(--ease),
12
- border-color var(--motion-panel) var(--ease),
13
- box-shadow var(--motion-hover);
14
- }
15
- .switch span {
16
- position: absolute;
17
- left: 3px;
18
- top: 3px;
19
- width: 14px;
20
- height: 14px;
21
- border-radius: 50%;
22
- background: var(--muted);
23
- transition:
24
- transform var(--motion-panel) var(--ease),
25
- width var(--motion-press) var(--ease),
26
- background-color var(--motion-panel);
27
- }
28
- .switch:hover:not(:disabled) {
29
- background: var(--hover);
30
- border-color: var(--muted);
31
- }
32
- .switch[aria-checked="true"] {
33
- background: var(--switch-on, var(--accent));
34
- border-color: var(--switch-on, var(--accent));
35
- }
36
- .switch[aria-checked="true"]:hover:not(:disabled) {
37
- background: var(
38
- --switch-on-hover,
39
- color-mix(in srgb, var(--accent) 88%, var(--fg))
40
- );
41
- border-color: var(--switch-on, var(--accent));
42
- }
43
- .switch[aria-checked="true"] span {
44
- transform: translateX(14px);
45
- background: var(--switch-thumb-on, var(--on-accent));
46
- }
47
- .switch:active:not(:disabled) span {
48
- width: 17px;
49
- }
50
- .switch[aria-checked="true"]:active:not(:disabled) span {
51
- transform: translateX(11px);
52
- }
53
- .switch:focus-visible {
54
- outline: 0;
55
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-ink, var(--accent)) 14%, transparent);
56
- }
57
- .switch:disabled {
58
- opacity: 0.4;
59
- }
1
+ .switch {
2
+ position: relative;
3
+ width: 36px;
4
+ height: 22px;
5
+ flex-shrink: 0;
6
+ padding: 0;
7
+ border: 1px solid color-mix(in srgb, var(--fg) 25%, var(--surface));
8
+ border-radius: 999px;
9
+ background: var(--field);
10
+ transition:
11
+ background-color var(--motion-panel) var(--ease),
12
+ border-color var(--motion-panel) var(--ease),
13
+ box-shadow var(--motion-hover);
14
+ }
15
+ .switch span {
16
+ position: absolute;
17
+ left: 3px;
18
+ top: 3px;
19
+ width: 14px;
20
+ height: 14px;
21
+ border-radius: 50%;
22
+ background: var(--muted);
23
+ transition:
24
+ transform var(--motion-panel) var(--ease),
25
+ width var(--motion-press) var(--ease),
26
+ background-color var(--motion-panel);
27
+ }
28
+ .switch:hover:not(:disabled) {
29
+ background: var(--hover);
30
+ border-color: var(--muted);
31
+ }
32
+ .switch[aria-checked="true"] {
33
+ background: var(--switch-on, var(--accent));
34
+ border-color: var(--switch-on, var(--accent));
35
+ }
36
+ .switch[aria-checked="true"]:hover:not(:disabled) {
37
+ background: var(
38
+ --switch-on-hover,
39
+ color-mix(in srgb, var(--accent) 88%, var(--fg))
40
+ );
41
+ border-color: var(--switch-on, var(--accent));
42
+ }
43
+ .switch[aria-checked="true"] span {
44
+ transform: translateX(14px);
45
+ background: var(--switch-thumb-on, var(--on-accent));
46
+ }
47
+ .switch:active:not(:disabled) span {
48
+ width: 17px;
49
+ }
50
+ .switch[aria-checked="true"]:active:not(:disabled) span {
51
+ transform: translateX(11px);
52
+ }
53
+ .switch:focus-visible {
54
+ outline: 0;
55
+ box-shadow: 0 0 0 3px
56
+ color-mix(in srgb, var(--accent-ink, var(--accent)) 14%, transparent);
57
+ }
58
+ .switch:disabled {
59
+ opacity: 0.4;
60
+ }
61
+ .nativeLabel {
62
+ display: inline-flex;
63
+ align-items: center;
64
+ gap: 8px;
65
+ }
66
+ .nativeControl {
67
+ display: inline-flex;
68
+ position: relative;
69
+ width: 36px;
70
+ height: 22px;
71
+ flex-shrink: 0;
72
+ }
73
+ .nativeInput {
74
+ position: absolute;
75
+ z-index: 1;
76
+ inset: 0;
77
+ width: 100%;
78
+ height: 100%;
79
+ margin: 0;
80
+ opacity: 0;
81
+ cursor: pointer;
82
+ }
83
+ .nativeInput + .switch {
84
+ pointer-events: none;
85
+ box-sizing: border-box;
86
+ }
87
+ .nativeInput:checked + .switch {
88
+ background: var(--switch-on, var(--accent));
89
+ border-color: var(--switch-on, var(--accent));
90
+ }
91
+ .nativeInput:checked + .switch span {
92
+ transform: translateX(14px);
93
+ background: var(--switch-thumb-on, var(--on-accent));
94
+ }
95
+ .nativeInput:disabled + .switch {
96
+ opacity: 0.4;
97
+ }
98
+ .nativeInput:focus-visible + .switch {
99
+ box-shadow: 0 0 0 3px
100
+ color-mix(in srgb, var(--accent-ink, var(--accent)) 14%, transparent);
101
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { Switch } from "./Switch.js";
3
4
  import { SettingRow } from "./SettingRow.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { CharacterPicker } from "./CharacterPicker.js";
3
4
  import { useCharacterCatalog } from "./characterCatalog.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useTabIndicator } from "./useTabIndicator.js";
3
4
  import s from "./Tab.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./Table.module.css";
3
4
  function Table({
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useRef } from "react";
3
4
  import { ListFilter } from "lucide-react";
@@ -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 { useId, useRef } from "react";
@@ -1,8 +1,8 @@
1
- import type { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, CSSProperties, ReactNode } from "react";
1
+ import type { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, CSSProperties, ReactNode, ComponentProps } from "react";
2
2
  import type { TableAppearance } from "./Table";
3
3
  /** Semantic table composition for cells with forms, selection and nested content. */
4
4
  declare function Markup({ children, className, striped, density, hoverable, bordered, stickyHeader, ...props }: HTMLAttributes<HTMLTableElement> & TableAppearance): import("react").JSX.Element;
5
- declare function ScrollContainer({ children, minWidth, }: {
5
+ declare function ScrollContainer({ children, minWidth, className, ...props }: ComponentProps<"div"> & {
6
6
  children: ReactNode;
7
7
  minWidth?: number;
8
8
  }): import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import s from "./Table.module.css";
3
4
  function Markup({
@@ -26,9 +27,11 @@ function Markup({
26
27
  }
27
28
  function ScrollContainer({
28
29
  children,
29
- minWidth = 600
30
+ minWidth = 600,
31
+ className = "",
32
+ ...props
30
33
  }) {
31
- return /* @__PURE__ */ jsx("div", { className: s.scroll, children: /* @__PURE__ */ jsx("div", { style: { minWidth }, children }) });
34
+ return /* @__PURE__ */ jsx("div", { ...props, className: `${s.scroll} ${className}`, children: /* @__PURE__ */ jsx("div", { style: { minWidth }, children }) });
32
35
  }
33
36
  function Th({
34
37
  ta,
@@ -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 { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./Tabs.module.css";
3
4
  import { useId } from "react";
@@ -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 { SelectionTag } from "./SelectionTag.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { Textarea } from "./Textarea.js";
3
4
  import { SettingRow } from "./SettingRow.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { Input } from "./Input.js";
3
4
  import { SettingRow } from "./SettingRow.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { FormField } from "./FormField.js";
3
4
  import { fieldInputProps, useFieldControl } from "./field.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { Check, Monitor, Sun, Moon } from "lucide-react";
3
4
  import s from "./ThemePicker.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { useLayoutEffect, useRef } from "react";
3
4
  import { UIProvider } from "./UIProvider.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { Segmented } from "./Segmented.js";
3
4
  function ThemeStylePicker({
@@ -1,12 +1,15 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useLayoutEffect, useRef } from "react";
3
4
  import s from "./TimeColumns.module.css";
5
+ import { useUIText } from "./useUIText.js";
4
6
  function TimeColumns({
5
7
  value,
6
8
  onChange,
7
9
  seconds = false,
8
10
  active = true
9
11
  }) {
12
+ const { text } = useUIText();
10
13
  const root = useRef(null), parts = value.split(":");
11
14
  useLayoutEffect(() => {
12
15
  if (active)
@@ -20,7 +23,11 @@ function TimeColumns({
20
23
  updated[part] = String(next).padStart(2, "0");
21
24
  onChange(updated.slice(0, seconds ? 3 : 2).join(":"));
22
25
  };
23
- return /* @__PURE__ */ jsx("div", { ref: root, className: s.columns, children: ["\u5C0F\u65F6", "\u5206\u949F", ...seconds ? ["\u79D2"] : []].map((name, part) => /* @__PURE__ */ jsxs("div", { className: s.column, children: [
26
+ return /* @__PURE__ */ jsx("div", { ref: root, className: s.columns, children: [
27
+ text("\u5C0F\u65F6", "Hours", "\u5C0F\u6642"),
28
+ text("\u5206\u949F", "Minutes", "\u5206\u9418"),
29
+ ...seconds ? [text("\u79D2", "Seconds")] : []
30
+ ].map((name, part) => /* @__PURE__ */ jsxs("div", { className: s.column, children: [
24
31
  /* @__PURE__ */ jsx("span", { children: name }),
25
32
  /* @__PURE__ */ jsx("div", { role: "listbox", "aria-label": name, children: Array.from({ length: part ? 60 : 24 }, (_, n) => /* @__PURE__ */ jsx(
26
33
  "button",
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useId, useState } from "react";
3
4
  import { Check, CircleAlert } 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,
@@ -16,6 +17,7 @@ import {
16
17
  } from "lucide-react";
17
18
  import { toastMotion, cancelMotion } from "./motion.js";
18
19
  import s from "./Toast.module.css";
20
+ import { useUIText } from "./useUIText.js";
19
21
  const icons = {
20
22
  neutral: Info,
21
23
  success: CheckCircle2,
@@ -35,6 +37,7 @@ function Toast({
35
37
  onHoverChange,
36
38
  onHeightChange
37
39
  }) {
40
+ const { text } = useUIText();
38
41
  const ref = useRef(null), current = useRef(toast), timer = useRef(void 0), pendingId = useRef(null);
39
42
  const [pending, setPending] = useState(false), [error, setError] = useState("");
40
43
  current.current = toast;
@@ -197,7 +200,7 @@ function Toast({
197
200
  {
198
201
  className: s.close,
199
202
  type: "button",
200
- "aria-label": "\u5173\u95ED\u63D0\u793A",
203
+ "aria-label": text("\u5173\u95ED\u63D0\u793A", "Dismiss notification", "\u95DC\u9589\u63D0\u793A"),
201
204
  onClick: dismiss,
202
205
  children: /* @__PURE__ */ jsx(X, {})
203
206
  }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  createContext,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  cloneElement,
@@ -9,6 +10,7 @@ import {
9
10
  useState
10
11
  } from "react";
11
12
  import { useUIConfig } from "./UIProvider.js";
13
+ import { usePortalRoot } from "./usePortalRoot.js";
12
14
  import { createPortal } from "react-dom";
13
15
  import { surfaceMotion, cancelMotion } from "./motion.js";
14
16
  import {
@@ -29,7 +31,8 @@ function Tooltip({
29
31
  const config = useUIConfig();
30
32
  const preferred = placement || config.tooltipPlacement, id = useId();
31
33
  const anchor = useRef(null), popup = useRef(null), timer = useRef(void 0);
32
- const owner = useSurfacePortal(), portalHost = owner?.host || document.body;
34
+ const portalRoot = usePortalRoot();
35
+ const owner = useSurfacePortal(), portalHost = owner?.host || portalRoot;
33
36
  const [requestedOpen, setOpen] = useState(false), opened = useRef(false), visible = useRef(false);
34
37
  const open = requestedOpen && owner?.active !== false;
35
38
  const hide = useCallback((immediate = false) => {
@@ -57,7 +60,7 @@ function Tooltip({
57
60
  return () => {
58
61
  clearTimeout(timer.current);
59
62
  releaseTooltip(hide, visible.current);
60
- cancelMotion(node);
63
+ if (node) cancelMotion(node);
61
64
  release();
62
65
  };
63
66
  }, [hide, portalHost]);
@@ -66,6 +69,7 @@ function Tooltip({
66
69
  }, [owner?.active, hide]);
67
70
  useLayoutEffect(() => {
68
71
  const node = popup.current;
72
+ if (!node) return;
69
73
  if (!open) {
70
74
  if (node.matches(":popover-open"))
71
75
  void surfaceMotion(node, "exit", node.dataset.offset).then((done) => {
@@ -150,7 +154,7 @@ function Tooltip({
150
154
  })
151
155
  }
152
156
  ),
153
- createPortal(
157
+ portalHost && createPortal(
154
158
  /* @__PURE__ */ jsx(
155
159
  "div",
156
160
  {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./TreeGuides.module.css";
3
4
  function TreeGuides({
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  useId,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useMemo, useRef, useState } from "react";
3
4
  import { Table } from "./Table.js";
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  export type UIConfig = {
3
+ locale: string;
3
4
  toastPosition: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
4
5
  tooltipPlacement: "top" | "bottom" | "left" | "right";
5
6
  requiredIndicator: "asterisk" | "text" | "none";
@@ -1,6 +1,8 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { createContext, useContext } from "react";
3
4
  const defaults = {
5
+ locale: "zh-CN",
4
6
  toastPosition: "bottom-right",
5
7
  tooltipPlacement: "top",
6
8
  requiredIndicator: "none"
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { TabList } from "./TabList.js";
3
4
  function UnderlinedTab(props) {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useEffect, useRef, useState } from "react";
3
4
  import { FilePicker } from "./FilePicker.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { UploadListItem } from "./UploadListItem.js";
3
4
  import s from "./UploadList.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useEffect, useState } from "react";
3
4
  import {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { Tooltip } from "./Tooltip.js";
3
4
  import s from "./UptimeChart.module.css";
@@ -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
  function appearanceDefaults(designTheme = "minimal") {
2
3
  const blue = designTheme === "blue";
3
4
  return {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { dateKey } from "./dateConstraints.js";
2
3
  function calendarNow(timeZone, instant = /* @__PURE__ */ new Date()) {
3
4
  if (!timeZone)
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useEffect, useState } from "react";
2
3
  import metadata from "../assets/character-metadata.json";
3
4
  const cache = {}, pending = {};
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  function toHSV(hex) {
2
3
  const [r, g, b] = [1, 3, 5].map(
3
4
  (i) => parseInt(hex.slice(i, i + 2), 16) / 255
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const calendarKey = (date) => date.toISOString().slice(0, 10);
2
3
  function parseCalendarDay(key) {
3
4
  if (!/^\d{4}-\d{2}-\d{2}$/.test(key)) return void 0;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  let nextController = 0;
2
3
  function createToaster() {
3
4
  let messages = [], counter = 0;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  const dateKey = (date) => `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
2
3
  function calendarDate(year, month, day = 1) {
3
4
  const date = /* @__PURE__ */ new Date(0);
@@ -1,4 +1,4 @@
1
- import type { AriaAttributes } from "react";
1
+ import type { AriaAttributes, ReactNode } from "react";
2
2
  export type FieldOptions = {
3
3
  id?: string;
4
4
  name?: string;
@@ -6,8 +6,8 @@ export type FieldOptions = {
6
6
  required?: boolean;
7
7
  disabled?: boolean;
8
8
  readOnly?: boolean;
9
- error?: string;
10
- hint?: string;
9
+ error?: ReactNode;
10
+ hint?: ReactNode;
11
11
  "aria-describedby"?: string;
12
12
  "aria-invalid"?: AriaAttributes["aria-invalid"];
13
13
  };
@@ -18,8 +18,8 @@ export type FieldState = {
18
18
  required: boolean;
19
19
  disabled: boolean;
20
20
  readOnly: boolean;
21
- error?: string;
22
- hint?: string;
21
+ error?: ReactNode;
22
+ hint?: ReactNode;
23
23
  descriptionId?: string;
24
24
  invalid: AriaAttributes["aria-invalid"];
25
25
  };
@@ -50,8 +50,8 @@ export declare function useFieldControl(options: FieldOptions): {
50
50
  required: boolean;
51
51
  disabled: boolean;
52
52
  readOnly: boolean;
53
- error: string | undefined;
54
- hint: string | undefined;
53
+ error: ReactNode;
54
+ hint: ReactNode;
55
55
  descriptionId: string | undefined;
56
56
  invalid: "false" | "grammar" | "spelling" | "true" | boolean;
57
57
  wrapped: boolean;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { createContext, useContext, useId } from "react";
2
3
  const FieldContext = createContext(null);
3
4
  function fieldInputProps(field) {
@@ -41,8 +42,8 @@ function useFieldControl(options) {
41
42
  descriptionId: joinIds(
42
43
  inherited?.descriptionId,
43
44
  options["aria-describedby"],
44
- hint ? id + "-hint" : void 0,
45
- error ? id + "-error" : void 0
45
+ hint && (!inherited || id === inherited.id || options.hint !== void 0) ? id + "-hint" : void 0,
46
+ error && (!inherited || id === inherited.id || options.error !== void 0) ? id + "-error" : void 0
46
47
  ),
47
48
  invalid: error ? true : options["aria-invalid"] ?? inherited?.invalid ?? false,
48
49
  wrapped: !!inherited
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  function formatFileSize(bytes) {
2
3
  const unit = bytes >= 1024 * 1024 ? "MB" : bytes >= 1024 ? "KB" : "B", divisor = unit === "MB" ? 1024 * 1024 : unit === "KB" ? 1024 : 1;
3
4
  return `${Math.round(bytes / divisor * 100) / 100} ${unit}`;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  function indexHierarchy(options, children, lazy = false) {
2
3
  const entries = /* @__PURE__ */ new Map();
3
4
  const walk = (nodes, path, disabled) => {
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useEffect, useState } from "react";
2
3
  let cache;
3
4
  let pending;
@@ -27,6 +27,7 @@ export { SelectSettingRow, type SelectSettingRowProps, } from "./SelectSettingRo
27
27
  export { Skeleton } from "./Skeleton";
28
28
  export { SkeletonRows } from "./SkeletonRows";
29
29
  export { Switch } from "./Switch";
30
+ export { SwitchInput } from "./Switch";
30
31
  export { ToastProvider } from "./ToastProvider";
31
32
  export { Tooltip } from "./Tooltip";
32
33
  export type { SelectOption } from "./types";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Badge } from "./Badge.js";
2
3
  import { ActionSheet } from "./ActionSheet.js";
3
4
  import { Button } from "./Button.js";
@@ -33,6 +34,7 @@ import {
33
34
  import { Skeleton } from "./Skeleton.js";
34
35
  import { SkeletonRows } from "./SkeletonRows.js";
35
36
  import { Switch } from "./Switch.js";
37
+ import { SwitchInput } from "./Switch.js";
36
38
  import { ToastProvider } from "./ToastProvider.js";
37
39
  import { Tooltip } from "./Tooltip.js";
38
40
  import { FileDropOverlay } from "./FileDropOverlay.js";
@@ -266,6 +268,7 @@ export {
266
268
  Steps,
267
269
  Surface,
268
270
  Switch,
271
+ SwitchInput,
269
272
  SwitchSettingRow,
270
273
  SymbolPicker,
271
274
  Table,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  function moveMenuFocus(event, root) {
2
3
  if (!root || event.defaultPrevented || !["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key))
3
4
  return false;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  function movingTowardSubmenu(origin, point, rect) {
2
3
  if (!origin || point.time - origin.time > 400) return false;
3
4
  const edge = rect.left >= origin.x ? rect.left : rect.right <= origin.x ? rect.right : void 0;
@@ -0,0 +1 @@
1
+ "use client";