@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.
- package/components/Accordion.d.ts +1 -1
- package/components/Accordion.js +1 -0
- package/components/AccountItem.js +1 -0
- package/components/ActionSheet.js +1 -0
- package/components/Alert.js +1 -0
- package/components/AppShell.js +1 -0
- package/components/AppearanceSettings.js +1 -0
- package/components/AuthLayout.js +1 -0
- package/components/Avatar.js +1 -0
- package/components/AvatarGroup.js +1 -0
- package/components/Badge.js +1 -0
- package/components/Banner.d.ts +3 -3
- package/components/Banner.js +12 -4
- package/components/BarChart.js +1 -0
- package/components/BlockedTab.js +1 -0
- package/components/Breadcrumb.js +1 -0
- package/components/Button.d.ts +4 -2
- package/components/Button.js +24 -0
- package/components/Calendar.js +19 -13
- package/components/Card.d.ts +5 -4
- package/components/Card.js +8 -4
- package/components/Card.module.css +10 -0
- package/components/Cascader.js +1 -0
- package/components/CatalogIcon.js +1 -0
- package/components/CharacterPicker.js +1 -0
- package/components/Checkbox.d.ts +5 -3
- package/components/Checkbox.js +17 -5
- package/components/ColorField.js +1 -0
- package/components/ColorPicker.js +1 -0
- package/components/Combobox.js +1 -0
- package/components/CommandPalette.js +1 -0
- package/components/ContextMenu.js +1 -0
- package/components/ContextMenuPanel.js +1 -0
- package/components/ContributionCalendar.js +1 -0
- package/components/ContributionCell.js +1 -0
- package/components/CopyButton.js +1 -0
- package/components/DataTable.js +1 -0
- package/components/DatePicker.js +8 -4
- package/components/DateRangePicker.js +1 -0
- package/components/Descriptions.js +1 -0
- package/components/Dialog.d.ts +9 -3
- package/components/Dialog.js +33 -11
- package/components/DialogVariants.js +1 -0
- package/components/DisclosureChevron.js +1 -0
- package/components/Divider.js +1 -0
- package/components/Drawer.d.ts +5 -2
- package/components/Drawer.js +20 -5
- package/components/EmojiPicker.js +1 -0
- package/components/EmptyState.js +1 -0
- package/components/FieldLabel.d.ts +2 -1
- package/components/FieldLabel.js +1 -0
- package/components/FieldMessages.d.ts +3 -2
- package/components/FieldMessages.js +1 -0
- package/components/FileDropOverlay.js +1 -0
- package/components/FileDropZone.js +1 -0
- package/components/FilePicker.d.ts +3 -2
- package/components/FilePicker.js +21 -5
- package/components/FileSelectionFeedback.js +1 -0
- package/components/FileTree.js +1 -0
- package/components/Form.js +1 -0
- package/components/FormErrorSummary.js +1 -0
- package/components/FormField.js +1 -0
- package/components/FormGroup.js +1 -0
- package/components/FormLayout.js +1 -0
- package/components/IconButton.js +1 -0
- package/components/IconPicker.js +1 -0
- package/components/Indicator.js +1 -0
- package/components/Input.js +1 -0
- package/components/Layout.js +1 -0
- package/components/LoadingOverlay.js +1 -0
- package/components/LoadingState.js +1 -0
- package/components/Markdown.js +1 -0
- package/components/Menu.js +1 -0
- package/components/MenuItem.d.ts +8 -3
- package/components/MenuItem.js +24 -1
- package/components/MenuItemContent.js +1 -0
- package/components/MultiSelect.js +1 -0
- package/components/NavBar.d.ts +2 -1
- package/components/NavBar.js +3 -1
- package/components/NumberInput.js +1 -0
- package/components/Page.d.ts +2 -1
- package/components/Page.js +4 -2
- package/components/Page.module.css +9 -0
- package/components/Pagination.d.ts +4 -1
- package/components/Pagination.js +28 -14
- package/components/PasskeyItem.js +1 -0
- package/components/PasswordField.js +1 -0
- package/components/PinInput.js +1 -0
- package/components/Placeholder.js +1 -0
- package/components/Popconfirm.js +1 -0
- package/components/Popover.d.ts +3 -2
- package/components/Popover.js +9 -2
- package/components/Progress.js +1 -0
- package/components/RadioGroup.js +1 -0
- package/components/RangeSlider.js +1 -0
- package/components/ResizablePanel.js +1 -0
- package/components/ResourceCard.js +1 -0
- package/components/SearchField.js +1 -0
- package/components/Section.js +1 -0
- package/components/Segmented.d.ts +1 -0
- package/components/Segmented.js +32 -20
- package/components/Select.d.ts +3 -1
- package/components/Select.js +12 -2
- package/components/SelectOptionContent.js +1 -0
- package/components/SelectSettingRow.js +1 -0
- package/components/SelectTrigger.js +1 -0
- package/components/SelectionTag.js +1 -0
- package/components/SessionItem.js +1 -0
- package/components/SettingRow.d.ts +3 -2
- package/components/SettingRow.js +9 -2
- package/components/SettingsLayout.js +1 -0
- package/components/ShortcutInput.js +1 -0
- package/components/SideBar.js +1 -0
- package/components/SidebarNavigation.js +1 -0
- package/components/Skeleton.js +1 -0
- package/components/SkeletonRows.js +1 -0
- package/components/SkinTonePicker.js +1 -0
- package/components/Slider.js +1 -0
- package/components/Spinner.js +1 -0
- package/components/SplitButton.js +1 -0
- package/components/Statistic.js +1 -0
- package/components/Steps.js +1 -0
- package/components/Switch.d.ts +5 -0
- package/components/Switch.js +26 -2
- package/components/Switch.module.css +101 -59
- package/components/SwitchSettingRow.js +1 -0
- package/components/SymbolPicker.js +1 -0
- package/components/TabList.js +1 -0
- package/components/Table.js +1 -0
- package/components/TableColumnFilter.js +1 -0
- package/components/TableColumnVisibility.js +1 -0
- package/components/TableMarkup.d.ts +2 -2
- package/components/TableMarkup.js +5 -2
- package/components/TableOfContents.js +1 -0
- package/components/Tabs.js +1 -0
- package/components/TagInput.js +1 -0
- package/components/TextAreaSettingRow.js +1 -0
- package/components/TextSettingRow.js +1 -0
- package/components/Textarea.js +1 -0
- package/components/ThemePicker.js +1 -0
- package/components/ThemeProvider.js +1 -0
- package/components/ThemeStylePicker.js +1 -0
- package/components/TimeColumns.js +8 -1
- package/components/Timeline.js +1 -0
- package/components/Toast.js +4 -1
- package/components/ToastProvider.js +1 -0
- package/components/Tooltip.js +7 -3
- package/components/TreeGuides.js +1 -0
- package/components/TreeSelect.js +1 -0
- package/components/TreeTable.js +1 -0
- package/components/UIProvider.d.ts +1 -0
- package/components/UIProvider.js +2 -0
- package/components/UnderlinedTab.js +1 -0
- package/components/Upload.js +1 -0
- package/components/UploadList.js +1 -0
- package/components/UploadListItem.js +1 -0
- package/components/UptimeChart.js +1 -0
- package/components/VirtualPickerList.js +1 -0
- package/components/appearance.js +1 -0
- package/components/calendarNow.js +1 -0
- package/components/characterCatalog.js +1 -0
- package/components/color.js +1 -0
- package/components/contribution.js +1 -0
- package/components/createToaster.js +1 -0
- package/components/dateConstraints.js +1 -0
- package/components/field.d.ts +7 -7
- package/components/field.js +3 -2
- package/components/fileSelection.js +1 -0
- package/components/hierarchy.js +1 -0
- package/components/iconCatalog.js +1 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +3 -0
- package/components/menuFocus.js +1 -0
- package/components/menuPointer.js +1 -0
- package/components/menuTypes.js +1 -0
- package/components/motion.js +1 -0
- package/components/rangeMath.js +1 -0
- package/components/settingRowControl.js +1 -0
- package/components/surfacePortal.js +1 -0
- package/components/tooltipState.js +1 -0
- package/components/types.js +1 -0
- package/components/uploadTypes.js +1 -0
- package/components/useFormState.js +1 -0
- package/components/useHierarchy.js +1 -0
- package/components/useMenuLayers.js +1 -0
- package/components/useModalFocus.d.ts +1 -1
- package/components/useModalFocus.js +9 -3
- package/components/useModalScrollLock.js +1 -0
- package/components/usePopover.js +1 -0
- package/components/usePortalRoot.d.ts +2 -0
- package/components/usePortalRoot.js +12 -0
- package/components/useTabIndicator.js +1 -0
- package/components/useUIText.d.ts +5 -0
- package/components/useUIText.js +14 -0
- package/components/useUploadQueue.js +1 -0
- package/package.json +1 -1
package/components/Accordion.js
CHANGED
package/components/Alert.js
CHANGED
package/components/AppShell.js
CHANGED
package/components/AuthLayout.js
CHANGED
package/components/Avatar.js
CHANGED
package/components/Badge.js
CHANGED
package/components/Banner.d.ts
CHANGED
|
@@ -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;
|
package/components/Banner.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
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
|
|
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 }),
|
package/components/BarChart.js
CHANGED
package/components/BlockedTab.js
CHANGED
package/components/Breadcrumb.js
CHANGED
package/components/Button.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import type
|
|
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 {};
|
package/components/Button.js
CHANGED
|
@@ -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;
|
package/components/Calendar.js
CHANGED
|
@@ -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__ */
|
|
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
|
-
|
|
114
|
-
|
|
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" :
|
|
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 :
|
|
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
|
);
|
package/components/Card.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
export declare function Card({ title, description, action, children, className, onClick, }: {
|
|
3
|
-
title?:
|
|
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
|
-
|
|
8
|
+
bodyClassName?: string;
|
|
9
|
+
padding?: "normal" | "compact" | "none";
|
|
9
10
|
}): import("react").JSX.Element;
|
package/components/Card.js
CHANGED
|
@@ -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
|
|
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
|
package/components/Cascader.js
CHANGED
package/components/Checkbox.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type FieldOptions } from "./field";
|
|
2
|
-
|
|
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
|
|
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;
|
package/components/Checkbox.js
CHANGED
|
@@ -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
|
-
|
|
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)
|
|
65
|
+
if (!field.readOnly) {
|
|
66
|
+
inputProps?.onChange?.(e);
|
|
67
|
+
onChange?.(e.target.checked);
|
|
68
|
+
}
|
|
57
69
|
},
|
|
58
70
|
disabled: field.disabled
|
|
59
71
|
}
|
package/components/ColorField.js
CHANGED
package/components/Combobox.js
CHANGED
package/components/CopyButton.js
CHANGED
package/components/DataTable.js
CHANGED
package/components/DatePicker.js
CHANGED
|
@@ -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
|
|
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
|
] })
|
package/components/Dialog.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ReactNode, type RefObject } from "react";
|
|
2
|
-
export declare function Dialog({ open: requestedOpen, onClose, title, children, footer, wide, size, role, descriptionId, busy, variant, headerIcon, tone, returnFocus, }: {
|
|
2
|
+
export declare function Dialog({ open: requestedOpen, onClose, title, children, footer, wide, size, role, descriptionId, busy, variant, headerIcon, tone, initialFocus, onAfterClose, className, returnFocus, fallbackFocus, portalContainer, closeLabel, }: {
|
|
3
3
|
open: boolean;
|
|
4
4
|
onClose(): void;
|
|
5
|
-
title:
|
|
5
|
+
title: ReactNode;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
footer?: ReactNode;
|
|
8
8
|
wide?: boolean;
|
|
@@ -14,5 +14,11 @@ export declare function Dialog({ open: requestedOpen, onClose, title, children,
|
|
|
14
14
|
headerIcon?: ReactNode;
|
|
15
15
|
tone?: "neutral" | "info" | "success" | "warning" | "danger";
|
|
16
16
|
/** Trigger to focus after closing, including surfaces opened asynchronously. */
|
|
17
|
+
initialFocus?: RefObject<HTMLElement | null>;
|
|
18
|
+
onAfterClose?(): void;
|
|
19
|
+
className?: string;
|
|
17
20
|
returnFocus?: RefObject<HTMLElement | null>;
|
|
18
|
-
|
|
21
|
+
fallbackFocus?: RefObject<HTMLElement | null>;
|
|
22
|
+
closeLabel?: string;
|
|
23
|
+
portalContainer?: HTMLElement | null;
|
|
24
|
+
}): import("react").ReactPortal | null;
|