@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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.6.21
2
+
3
+ - Add Link with inherited typography, subtle content links, shared hover/focus states and disabled navigation. Export from the root and Link subpath.
4
+ - Add Markdown fontSize for reading preferences, with scaled prose and headings; default rendering remains unchanged.
5
+ - Keep Slider's accessible name stable when its current value changes; native range value announcements remain available.
6
+
1
7
  # 0.6.19
2
8
 
3
9
  - Add opt-in Combobox allowCustomValue input mode: preserve freely typed text on blur, Enter, and async loading or failure; only explicit option selection commits an option. Pass the selected option as the optional second onChange argument.
package/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  React 组件、应用外壳和两套可互换的主题。无 Electron、React Router、账户 API 或持久化存储依赖。
4
4
 
5
+ ## 内容链接与阅读字号(0.6.21)
6
+
7
+ `Link` 从根入口或 `@robert-stackflow/oneui/Link` 导入。默认使用主题链接色;`variant="subtle"` 继承周围标题或正文的颜色与字体,统一 hover、键盘焦点和 disabled 行为,保留原生链接与新标签打开语义。应用无需单独定义标题链接样式。
8
+
9
+ `Markdown` 支持 `fontSize={18}`,正文与相对字号标题共同缩放;不传时保持默认 14 px。有限数值限制在 10–48 px,非有限数值沿用默认值。
10
+
5
11
  ## 可读前景色(0.6.16 候选)
6
12
 
7
13
  `--accent-ink` 用于文字、小图标、细标记和焦点;按钮实心填充仍使用 `--accent-fill` / `--accent`。极简主题的 ink 随前景色变化,蓝白主题使用相应模式的强调色;自定义强调色混入当前前景色后用于 ink,避免深色模式中的深灰标记或浅色模式中的白色标记不可见。可单独覆盖此变量。徽标、链接、步骤、菜单/单选标记、进度、图表、时间线及信息反馈复用这套颜色。
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from "react";
2
2
  export declare function Accordion({ title, open, onChange, children, }: {
3
- title: string;
3
+ title: ReactNode;
4
4
  open: boolean;
5
5
  onChange(open: boolean): void;
6
6
  children: ReactNode;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useId } from "react";
3
4
  import { DisclosureChevron } from "./DisclosureChevron.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./AccountItem.module.css";
3
4
  function AccountItem({
@@ -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 { MoreHorizontal } from "lucide-react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Banner } from "./Banner.js";
2
3
  export {
3
4
  Banner as Alert
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, 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 { SwitchSettingRow } from "./SwitchSettingRow.js";
3
4
  import { SelectSettingRow } from "./SelectSettingRow.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { Surface, Stack, Heading } from "./Layout.js";
3
4
  import s from "./AuthLayout.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useState } from "react";
3
4
  import { User } from "lucide-react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { moveMenuFocus } from "./menuFocus.js";
3
4
  import { useEffect, useId, useRef } from "react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import s from "./Badge.module.css";
3
4
  function Badge({
@@ -1,5 +1,5 @@
1
- import { type ReactNode } from "react";
2
- export type BannerProps = {
1
+ import { type ReactNode, type ComponentProps } from "react";
2
+ export type BannerProps = Omit<ComponentProps<"div">, "title" | "onClose"> & {
3
3
  tone?: "info" | "success" | "warning" | "danger" | "neutral";
4
4
  variant?: "soft" | "outline" | "filled";
5
5
  title?: ReactNode;
@@ -14,4 +14,4 @@ export type BannerProps = {
14
14
  onExpandedChange?(expanded: boolean): void;
15
15
  className?: string;
16
16
  };
17
- export declare function Banner({ tone, variant, title, children, icon, action, onClose, compact, details, expanded, defaultExpanded, onExpandedChange, className, }: BannerProps): import("react").JSX.Element;
17
+ export declare function Banner({ tone, variant, title, children, icon, action, onClose, compact, details, expanded, defaultExpanded, onExpandedChange, className, role, style, ...props }: BannerProps): import("react").JSX.Element;
@@ -1,5 +1,9 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useId, useState } from "react";
3
+ import {
4
+ useId,
5
+ useState
6
+ } from "react";
3
7
  import {
4
8
  Info,
5
9
  CircleCheck,
@@ -24,7 +28,10 @@ function Banner({
24
28
  expanded,
25
29
  defaultExpanded = false,
26
30
  onExpandedChange,
27
- className = ""
31
+ className = "",
32
+ role = tone === "danger" ? "alert" : "status",
33
+ style,
34
+ ...props
28
35
  }) {
29
36
  const [internal, setInternal] = useState(defaultExpanded);
30
37
  const open = expanded ?? internal;
@@ -34,13 +41,14 @@ function Banner({
34
41
  return /* @__PURE__ */ jsxs(
35
42
  "div",
36
43
  {
44
+ ...props,
37
45
  className: `${s.banner} ${className}`,
38
46
  "data-tone": tone,
39
47
  "data-variant": variant,
40
48
  "data-compact": compact,
41
49
  "data-has-icon": !!icon,
42
- role: tone === "danger" ? "alert" : "status",
43
- style: { "--banner-color": color },
50
+ role,
51
+ style: { "--banner-color": color, ...style },
44
52
  children: [
45
53
  /* @__PURE__ */ jsxs("div", { className: s.main, children: [
46
54
  icon && /* @__PURE__ */ jsx("span", { className: s.icon, "aria-hidden": "true", children: icon === true ? /* @__PURE__ */ jsx(Icon, {}) : icon }),
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { Tooltip } from "./Tooltip.js";
3
4
  import s from "./BarChart.module.css";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { memo } from "react";
3
4
  import { TabList } from "./TabList.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { moveMenuFocus } from "./menuFocus.js";
3
4
  import {
@@ -1,13 +1,15 @@
1
- import type { ComponentPropsWithRef } from "react";
1
+ import { type ComponentPropsWithRef } from "react";
2
2
  type ButtonProps = {
3
3
  variant?: "primary" | "secondary" | "ghost" | "danger" | "link";
4
4
  size?: "normal" | "small";
5
5
  loading?: boolean;
6
+ /** Apply button appearance to a router link without replacing its behavior. */
7
+ asChild?: boolean;
6
8
  } & ((ComponentPropsWithRef<"button"> & {
7
9
  href?: never;
8
10
  }) | (ComponentPropsWithRef<"a"> & {
9
11
  href: string;
10
12
  disabled?: boolean;
11
13
  }));
12
- export declare function Button({ variant, size, loading, children, className, ...props }: ButtonProps): import("react").JSX.Element;
14
+ export declare function Button({ variant, size, loading, asChild, children, className, ...props }: ButtonProps): import("react").JSX.Element;
13
15
  export {};
@@ -1,10 +1,16 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ cloneElement,
5
+ isValidElement
6
+ } from "react";
2
7
  import { Spinner } from "./Spinner.js";
3
8
  import s from "./Button.module.css";
4
9
  function Button({
5
10
  variant = "secondary",
6
11
  size = "normal",
7
12
  loading,
13
+ asChild,
8
14
  children,
9
15
  className = "",
10
16
  ...props
@@ -14,6 +20,24 @@ function Button({
14
20
  loading && /* @__PURE__ */ jsx("span", { className: s.loader, children: /* @__PURE__ */ jsx(Spinner, { decorative: true }) })
15
21
  ] });
16
22
  const classes = `${s.button} ${s[variant]} ${size === "small" ? s.small : ""} ${className}`;
23
+ if (asChild && isValidElement(children)) {
24
+ const child = children;
25
+ const blocked = props.disabled || loading;
26
+ return cloneElement(child, {
27
+ ...props,
28
+ ...child.props,
29
+ className: `${classes} ${child.props.className ?? ""}`,
30
+ "aria-disabled": blocked || void 0,
31
+ "aria-busy": loading || void 0,
32
+ tabIndex: blocked ? -1 : child.props.tabIndex,
33
+ onClick: (event) => {
34
+ if (blocked) {
35
+ event.preventDefault();
36
+ event.stopPropagation();
37
+ } else child.props.onClick?.(event);
38
+ }
39
+ });
40
+ }
17
41
  if (typeof props.href === "string") {
18
42
  const { disabled, onClick, ...link } = props;
19
43
  const blocked = disabled || loading;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useEffect, useLayoutEffect, useRef, useState } from "react";
3
4
  import { ChevronLeft, ChevronRight } from "lucide-react";
@@ -11,6 +12,7 @@ import {
11
12
  readDate
12
13
  } from "./dateConstraints.js";
13
14
  import s from "./Calendar.module.css";
15
+ import { useUIText } from "./useUIText.js";
14
16
  import { dateKey as dateKey2, readDate as readDate2 } from "./dateConstraints.js";
15
17
  function Calendar({
16
18
  value,
@@ -23,6 +25,7 @@ function Calendar({
23
25
  disabledDate,
24
26
  today = dateKey(/* @__PURE__ */ new Date())
25
27
  }) {
28
+ const { text, english } = useUIText();
26
29
  const constraints = { minDate, maxDate, disabledDate };
27
30
  const [month, setMonth] = useState(
28
31
  () => readDate(boundedDate(value || today, constraints))
@@ -80,7 +83,7 @@ function Calendar({
80
83
  /* @__PURE__ */ jsx(
81
84
  IconButton,
82
85
  {
83
- label: view === "days" ? "\u4E0A\u4E2A\u6708" : view === "months" ? "\u4E0A\u4E00\u5E74" : "\u524D\u5341\u4E8C\u5E74",
86
+ label: view === "days" ? text("\u4E0A\u4E2A\u6708", "Previous month", "\u4E0A\u500B\u6708") : view === "months" ? text("\u4E0A\u4E00\u5E74", "Previous year") : text("\u524D\u5341\u4E8C\u5E74", "Previous twelve years"),
84
87
  disabled: !periodAllowed(-1),
85
88
  onClick: () => move(-1),
86
89
  children: /* @__PURE__ */ jsx(ChevronLeft, {})
@@ -95,31 +98,30 @@ function Calendar({
95
98
  "button",
96
99
  {
97
100
  type: "button",
98
- "aria-label": "\u9009\u62E9\u5E74\u4EFD",
101
+ "aria-label": text("\u9009\u62E9\u5E74\u4EFD", "Choose year", "\u9078\u64C7\u5E74\u4EFD"),
99
102
  onClick: () => openView("years"),
100
103
  children: [
101
104
  year,
102
- " \u5E74"
105
+ text(" \u5E74", "")
103
106
  ]
104
107
  }
105
108
  ),
106
- /* @__PURE__ */ jsxs(
109
+ /* @__PURE__ */ jsx(
107
110
  "button",
108
111
  {
109
112
  type: "button",
110
- "aria-label": "\u9009\u62E9\u6708\u4EFD",
113
+ "aria-label": text("\u9009\u62E9\u6708\u4EFD", "Choose month", "\u9078\u64C7\u6708\u4EFD"),
111
114
  onClick: () => openView(view === "months" ? "days" : "months"),
112
- children: [
113
- index + 1,
114
- " \u6708"
115
- ]
115
+ children: english ? new Intl.DateTimeFormat("en", { month: "short" }).format(
116
+ month
117
+ ) : `${index + 1} \u6708`
116
118
  }
117
119
  )
118
120
  ] }) }),
119
121
  /* @__PURE__ */ jsx(
120
122
  IconButton,
121
123
  {
122
- label: view === "days" ? "\u4E0B\u4E2A\u6708" : view === "months" ? "\u4E0B\u4E00\u5E74" : "\u540E\u5341\u4E8C\u5E74",
124
+ label: view === "days" ? text("\u4E0B\u4E2A\u6708", "Next month", "\u4E0B\u500B\u6708") : view === "months" ? text("\u4E0B\u4E00\u5E74", "Next year") : text("\u540E\u5341\u4E8C\u5E74", "Next twelve years", "\u5F8C\u5341\u4E8C\u5E74"),
123
125
  disabled: !periodAllowed(1),
124
126
  onClick: () => move(1),
125
127
  children: /* @__PURE__ */ jsx(ChevronRight, {})
@@ -127,7 +129,7 @@ function Calendar({
127
129
  )
128
130
  ] }),
129
131
  /* @__PURE__ */ jsx("div", { className: s.area, children: view === "days" ? /* @__PURE__ */ jsxs(Fragment, { children: [
130
- /* @__PURE__ */ jsx("div", { className: s.week, children: ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"].map((day) => /* @__PURE__ */ jsx("span", { children: day }, day)) }),
132
+ /* @__PURE__ */ jsx("div", { className: s.week, children: (english ? ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] : ["\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D", "\u65E5"]).map((day) => /* @__PURE__ */ jsx("span", { children: day }, day)) }),
131
133
  /* @__PURE__ */ jsx(
132
134
  "div",
133
135
  {
@@ -235,7 +237,9 @@ function Calendar({
235
237
  "button",
236
238
  {
237
239
  type: "button",
238
- "aria-label": view === "years" ? choice + " \u5E74" : choice + 1 + " \u6708",
240
+ "aria-label": view === "years" ? choice + text(" \u5E74", "") : english ? new Intl.DateTimeFormat("en", {
241
+ month: "short"
242
+ }).format(calendarDate(year, choice)) : choice + 1 + " \u6708",
239
243
  "aria-pressed": choice === (view === "years" ? year : index),
240
244
  disabled: !enabled,
241
245
  onClick: () => {
@@ -247,7 +251,9 @@ function Calendar({
247
251
  );
248
252
  openView(view === "years" ? "months" : "days");
249
253
  },
250
- children: view === "years" ? choice : choice + 1 + " \u6708"
254
+ children: view === "years" ? choice : english ? new Intl.DateTimeFormat("en", {
255
+ month: "short"
256
+ }).format(calendarDate(year, choice)) : choice + 1 + " \u6708"
251
257
  },
252
258
  choice
253
259
  );
@@ -1,9 +1,10 @@
1
- import type { ReactNode } from "react";
2
- export declare function Card({ title, description, action, children, className, onClick, }: {
3
- title?: string;
1
+ import type { ReactNode, ComponentPropsWithRef } from "react";
2
+ export declare function Card({ title, description, action, children, className, onClick, bodyClassName, padding, ...props }: Omit<ComponentPropsWithRef<"section">, "title"> & {
3
+ title?: ReactNode;
4
4
  description?: ReactNode;
5
5
  action?: ReactNode;
6
6
  children?: ReactNode;
7
7
  className?: string;
8
- onClick?(): void;
8
+ bodyClassName?: string;
9
+ padding?: "normal" | "compact" | "none";
9
10
  }): import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import s from "./Card.module.css";
3
4
  function Card({
@@ -6,10 +7,13 @@ function Card({
6
7
  action,
7
8
  children,
8
9
  className = "",
9
- onClick
10
+ onClick,
11
+ bodyClassName,
12
+ padding = "normal",
13
+ ...props
10
14
  }) {
11
15
  const hasBody = children != null && children !== false;
12
- const classes = `${s.card} ${!hasBody ? s.headerOnly : ""} ${className}`;
16
+ const classes = `${s.card} ${!hasBody ? s.headerOnly : ""} ${s[padding]} ${className}`;
13
17
  const content = /* @__PURE__ */ jsxs(Fragment, { children: [
14
18
  (title || description || action) && /* @__PURE__ */ jsxs("header", { className: s.header, children: [
15
19
  /* @__PURE__ */ jsxs("div", { className: s.heading, children: [
@@ -18,7 +22,7 @@ function Card({
18
22
  ] }),
19
23
  action
20
24
  ] }),
21
- hasBody && /* @__PURE__ */ jsx("div", { className: s.body, "data-card-body": true, children })
25
+ hasBody && /* @__PURE__ */ jsx("div", { className: `${s.body} ${bodyClassName ?? ""}`, "data-card-body": true, children })
22
26
  ] });
23
27
  return onClick ? /* @__PURE__ */ jsx(
24
28
  "button",
@@ -28,7 +32,7 @@ function Card({
28
32
  onClick,
29
33
  children: content
30
34
  }
31
- ) : /* @__PURE__ */ jsx("section", { className: classes, children: content });
35
+ ) : /* @__PURE__ */ jsx("section", { ...props, className: classes, children: content });
32
36
  }
33
37
  export {
34
38
  Card
@@ -65,3 +65,13 @@
65
65
  padding-bottom: 18px;
66
66
  }
67
67
  }
68
+
69
+ .compact {
70
+ --card-space: 18px;
71
+ }
72
+ .none > .body {
73
+ padding: 0;
74
+ }
75
+ .none > .header + .body {
76
+ padding-top: 0;
77
+ }
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useId, useLayoutEffect, useRef, useState } from "react";
3
4
  import { ChevronRight } from "lucide-react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx } from "react/jsx-runtime";
2
3
  import { Icon, Shapes } from "lucide-react";
3
4
  import { useIconCatalog } from "./iconCatalog.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useCallback, useMemo, useRef, useState } from "react";
3
4
  import { ArrowLeft } from "lucide-react";
@@ -1,8 +1,10 @@
1
1
  import { type FieldOptions } from "./field";
2
- export declare function Checkbox({ label, checked, onChange, disabled, indeterminate, name, value, required, readOnly, id, error, hint, }: FieldOptions & {
2
+ import { type ComponentPropsWithRef } from "react";
3
+ export declare function Checkbox({ label, checked, onChange, disabled, indeterminate, name, value, required, readOnly, id, error, hint, inputProps, }: FieldOptions & {
3
4
  label: string;
4
- checked: boolean;
5
- onChange(value: boolean): void;
5
+ checked?: boolean;
6
+ onChange?(value: boolean): void;
7
+ inputProps?: Omit<ComponentPropsWithRef<"input">, "type">;
6
8
  disabled?: boolean;
7
9
  name?: string;
8
10
  value?: string;
@@ -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";
@@ -15,8 +16,10 @@ function Checkbox({
15
16
  readOnly,
16
17
  id,
17
18
  error,
18
- hint
19
+ hint,
20
+ inputProps
19
21
  }) {
22
+ const Label = label ? "label" : "span";
20
23
  const field = useFieldControl({
21
24
  id,
22
25
  name,
@@ -32,7 +35,7 @@ function Checkbox({
32
35
  if (ref.current) ref.current.indeterminate = indeterminate;
33
36
  }, [indeterminate]);
34
37
  return /* @__PURE__ */ jsxs(
35
- "label",
38
+ Label,
36
39
  {
37
40
  className: s.checkbox,
38
41
  "data-disabled": field.disabled,
@@ -41,10 +44,16 @@ function Checkbox({
41
44
  /* @__PURE__ */ jsx(
42
45
  "input",
43
46
  {
47
+ ...inputProps,
44
48
  id: field.id,
45
49
  "aria-invalid": field.invalid,
46
- "aria-describedby": field.descriptionId,
47
- ref,
50
+ "aria-describedby": [field.descriptionId, inputProps?.["aria-describedby"]].filter(Boolean).join(" ") || void 0,
51
+ ref: (node) => {
52
+ ref.current = node;
53
+ const external = inputProps?.ref;
54
+ if (typeof external === "function") return external(node);
55
+ if (external) external.current = node;
56
+ },
48
57
  "aria-checked": indeterminate ? "mixed" : checked,
49
58
  type: "checkbox",
50
59
  name: field.name,
@@ -53,7 +62,10 @@ function Checkbox({
53
62
  "aria-readonly": field.readOnly || void 0,
54
63
  checked,
55
64
  onChange: (e) => {
56
- if (!field.readOnly) onChange(e.target.checked);
65
+ if (!field.readOnly) {
66
+ inputProps?.onChange?.(e);
67
+ onChange?.(e.target.checked);
68
+ }
57
69
  },
58
70
  disabled: field.disabled
59
71
  }
@@ -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 { useId } from "react";
@@ -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 { Input } from "./Input.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, 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 {
3
4
  useEffect,
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, 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 { MenuItem } from "./MenuItem.js";
3
4
  import { menuSurfaceMotion, cancelMotion } from "./motion.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 } from "react/jsx-runtime";
2
3
  import { memo } from "react";
3
4
  import { Tooltip } from "./Tooltip.js";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useEffect, useRef, useState } from "react";
2
3
  import { useToast } from "./ToastProvider.js";
3
4
  function CopyButton({
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import { useMemo, useState } from "react";
3
4
  import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
3
  import { createElement } from "react";
3
4
  import { fieldTriggerProps, useFieldControl } from "./field.js";
@@ -9,6 +10,7 @@ import { Calendar } from "./Calendar.js";
9
10
  import { TimeColumns } from "./TimeColumns.js";
10
11
  import { Button } from "./Button.js";
11
12
  import s from "./DatePicker.module.css";
13
+ import { useUIText } from "./useUIText.js";
12
14
  import {
13
15
  boundedDate,
14
16
  isDateAllowed
@@ -26,7 +28,7 @@ function SingleDatePicker({
26
28
  seconds = false,
27
29
  timeZone,
28
30
  clearable = false,
29
- placeholder = "\u8BF7\u9009\u62E9",
31
+ placeholder,
30
32
  disabled,
31
33
  readOnly,
32
34
  name,
@@ -39,6 +41,8 @@ function SingleDatePicker({
39
41
  disabledDate,
40
42
  ...aria
41
43
  }) {
44
+ const { text } = useUIText();
45
+ placeholder ??= text("\u8BF7\u9009\u62E9", "Select", "\u8ACB\u9078\u64C7");
42
46
  const constraints = { minDate, maxDate, disabledDate };
43
47
  const field = useFieldControl({
44
48
  id: controlId,
@@ -168,7 +172,7 @@ function SingleDatePicker({
168
172
  close();
169
173
  }
170
174
  },
171
- children: mode === "date" ? "\u4ECA\u5929" : "\u6B64\u523B"
175
+ children: mode === "date" ? text("\u4ECA\u5929", "Today") : text("\u6B64\u523B", "Now")
172
176
  }
173
177
  ),
174
178
  (clearable || mode !== "date") && /* @__PURE__ */ jsxs("div", { className: s.rangeActions, children: [
@@ -182,7 +186,7 @@ function SingleDatePicker({
182
186
  onChange("");
183
187
  close();
184
188
  },
185
- children: "\u6E05\u7A7A"
189
+ children: text("\u6E05\u7A7A", "Clear")
186
190
  }
187
191
  ),
188
192
  mode !== "date" && /* @__PURE__ */ jsx(
@@ -192,7 +196,7 @@ function SingleDatePicker({
192
196
  size: "small",
193
197
  onClick: commit,
194
198
  disabled: mode !== "time" && !isDateAllowed(date, constraints),
195
- children: "\u786E\u5B9A"
199
+ children: text("\u786E\u5B9A", "Apply", "\u78BA\u5B9A")
196
200
  }
197
201
  )
198
202
  ] })
@@ -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 { CalendarDays, ArrowRight } from "lucide-react";
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx, jsxs } from "react/jsx-runtime";
2
3
  import {
3
4
  Fragment,