@godxjp/ui 20.0.0 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/app/theme-axes.d.ts +2 -0
- package/dist/app/theme-axes.js +45 -0
- package/dist/components/charts/chart-cartesian.d.ts +2 -1
- package/dist/components/charts/chart-cartesian.js +52 -3
- package/dist/components/charts/chart-category-axis.d.ts +55 -0
- package/dist/components/charts/chart-category-axis.js +93 -0
- package/dist/components/charts/chart-frame.d.ts +10 -1
- package/dist/components/charts/chart-frame.js +19 -3
- package/dist/components/charts/compact-bar-trend.d.ts +1 -1
- package/dist/components/charts/compact-bar-trend.js +2 -0
- package/dist/components/charts/pie-chart.d.ts +1 -1
- package/dist/components/charts/pie-chart.js +12 -1
- package/dist/components/charts/recharts-peer.d.ts +49 -0
- package/dist/components/charts/recharts-peer.js +45 -0
- package/dist/components/data-display/card.d.ts +12 -1
- package/dist/components/data-display/card.js +22 -4
- package/dist/components/data-display/code-block.js +6 -2
- package/dist/components/data-display/data-table.d.ts +39 -4
- package/dist/components/data-display/data-table.js +802 -270
- package/dist/components/data-display/descriptions.d.ts +27 -6
- package/dist/components/data-display/descriptions.js +58 -17
- package/dist/components/data-display/index.d.ts +2 -0
- package/dist/components/data-display/index.js +2 -0
- package/dist/components/data-display/list-row.d.ts +10 -1
- package/dist/components/data-display/list-row.js +7 -1
- package/dist/components/data-display/popover.d.ts +2 -2
- package/dist/components/data-display/popover.js +61 -11
- package/dist/components/data-display/range-timeline.d.ts +38 -0
- package/dist/components/data-display/range-timeline.js +161 -0
- package/dist/components/data-display/scroll-area.js +13 -2
- package/dist/components/data-display/service-launcher-card.js +10 -10
- package/dist/components/data-display/table.d.ts +11 -3
- package/dist/components/data-display/table.js +48 -18
- package/dist/components/data-display/tree-list.js +4 -9
- package/dist/components/data-entry/calendar.d.ts +2 -2
- package/dist/components/data-entry/calendar.js +12 -1
- package/dist/components/data-entry/cascader.d.ts +1 -1
- package/dist/components/data-entry/cascader.js +188 -24
- package/dist/components/data-entry/color-picker.d.ts +1 -1
- package/dist/components/data-entry/color-picker.js +17 -5
- package/dist/components/data-entry/control-appearance.d.ts +64 -0
- package/dist/components/data-entry/control-appearance.js +39 -0
- package/dist/components/data-entry/control-surface.d.ts +61 -0
- package/dist/components/data-entry/control-surface.js +39 -0
- package/dist/components/data-entry/date-picker.d.ts +1 -1
- package/dist/components/data-entry/date-picker.js +344 -113
- package/dist/components/data-entry/date-range-picker.d.ts +1 -1
- package/dist/components/data-entry/date-range-picker.js +278 -140
- package/dist/components/data-entry/form-field.d.ts +1 -1
- package/dist/components/data-entry/form-field.js +39 -4
- package/dist/components/data-entry/form.d.ts +4 -0
- package/dist/components/data-entry/form.js +4 -2
- package/dist/components/data-entry/index.d.ts +7 -3
- package/dist/components/data-entry/index.js +10 -1
- package/dist/components/data-entry/input-otp.d.ts +1 -1
- package/dist/components/data-entry/input.d.ts +12 -34
- package/dist/components/data-entry/input.js +92 -24
- package/dist/components/data-entry/month-picker.d.ts +1 -1
- package/dist/components/data-entry/month-picker.js +47 -10
- package/dist/components/data-entry/month-range-picker.d.ts +1 -1
- package/dist/components/data-entry/month-range-picker.js +51 -11
- package/dist/components/data-entry/number-input.d.ts +7 -0
- package/dist/components/data-entry/number-input.js +147 -98
- package/dist/components/data-entry/password-input.d.ts +1 -1
- package/dist/components/data-entry/radio.d.ts +1 -1
- package/dist/components/data-entry/radio.js +61 -13
- package/dist/components/data-entry/search-input.d.ts +1 -1
- package/dist/components/data-entry/search-input.js +16 -2
- package/dist/components/data-entry/search-select.d.ts +2 -2
- package/dist/components/data-entry/search-select.js +209 -78
- package/dist/components/data-entry/select.d.ts +22 -4
- package/dist/components/data-entry/select.js +215 -163
- package/dist/components/data-entry/slider.d.ts +9 -1
- package/dist/components/data-entry/slider.js +87 -9
- package/dist/components/data-entry/switch.d.ts +3 -0
- package/dist/components/data-entry/switch.js +29 -3
- package/dist/components/data-entry/textarea.d.ts +14 -56
- package/dist/components/data-entry/textarea.js +80 -33
- package/dist/components/data-entry/time-picker.d.ts +2 -2
- package/dist/components/data-entry/time-picker.js +333 -109
- package/dist/components/data-entry/time-range-picker.d.ts +5 -0
- package/dist/components/data-entry/time-range-picker.js +89 -0
- package/dist/components/data-entry/transfer.d.ts +1 -1
- package/dist/components/data-entry/transfer.js +86 -28
- package/dist/components/data-entry/tree-select.d.ts +1 -1
- package/dist/components/data-entry/tree-select.js +201 -113
- package/dist/components/data-entry/tree-utils.js +7 -14
- package/dist/components/data-entry/upload-files.d.ts +2 -0
- package/dist/components/data-entry/upload-files.js +31 -0
- package/dist/components/data-entry/upload-request.d.ts +4 -0
- package/dist/components/data-entry/upload-request.js +53 -0
- package/dist/components/data-entry/upload-types.d.ts +28 -0
- package/dist/components/data-entry/upload-types.js +2 -0
- package/dist/components/data-entry/upload.d.ts +2 -2
- package/dist/components/data-entry/upload.js +475 -115
- package/dist/components/feedback/dialog.js +16 -19
- package/dist/components/general/button.d.ts +1 -1
- package/dist/components/general/button.js +5 -1
- package/dist/components/general/index.d.ts +1 -0
- package/dist/components/general/index.js +2 -0
- package/dist/components/general/typography.d.ts +3 -0
- package/dist/components/general/typography.js +15 -1
- package/dist/components/general/visually-hidden.d.ts +3 -0
- package/dist/components/general/visually-hidden.js +9 -0
- package/dist/components/layout/app-launcher.d.ts +34 -0
- package/dist/components/layout/app-launcher.js +228 -0
- package/dist/components/layout/app-shell.d.ts +2 -0
- package/dist/components/layout/app-shell.js +20 -7
- package/dist/components/layout/breadcrumb.d.ts +14 -2
- package/dist/components/layout/breadcrumb.js +46 -4
- package/dist/components/layout/flex.d.ts +1 -1
- package/dist/components/layout/flex.js +23 -2
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +5 -1
- package/dist/components/layout/org-switcher.js +20 -1
- package/dist/components/layout/page-container.d.ts +1 -1
- package/dist/components/layout/page-container.js +5 -3
- package/dist/components/layout/responsive-grid.d.ts +16 -2
- package/dist/components/layout/responsive-grid.js +29 -2
- package/dist/components/layout/topbar-item.d.ts +3 -0
- package/dist/components/layout/topbar-item.js +18 -3
- package/dist/components/layout/topbar.d.ts +1 -1
- package/dist/components/layout/topbar.js +27 -6
- package/dist/components/navigation/dropdown-menu.d.ts +30 -2
- package/dist/components/navigation/dropdown-menu.js +68 -11
- package/dist/components/navigation/pagination.d.ts +2 -2
- package/dist/components/navigation/pagination.js +155 -83
- package/dist/components/navigation/steps.d.ts +2 -2
- package/dist/components/navigation/steps.js +29 -4
- package/dist/components/navigation/tabs.d.ts +5 -33
- package/dist/components/navigation/tabs.js +232 -64
- package/dist/components/ui/input-otp.d.ts +26 -28
- package/dist/components/ui/input-otp.js +50 -7
- package/dist/components/ui/password-input.d.ts +36 -2
- package/dist/components/ui/password-input.js +27 -7
- package/dist/components/ui/rating.d.ts +25 -0
- package/dist/components/ui/rating.js +67 -27
- package/dist/components/ui/segmented.d.ts +9 -0
- package/dist/components/ui/segmented.js +17 -2
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +13 -0
- package/dist/components/ui/tag-input.d.ts +45 -0
- package/dist/components/ui/tag-input.js +109 -27
- package/dist/form/form-context.d.ts +29 -0
- package/dist/form/form-context.js +44 -4
- package/dist/form/form-field-array.d.ts +22 -0
- package/dist/form/form-field-array.js +50 -0
- package/dist/form/form-field-control.d.ts +2 -1
- package/dist/form/form-field-control.js +116 -40
- package/dist/form/form-root.d.ts +2 -1
- package/dist/form/form-root.js +142 -23
- package/dist/form/index.d.ts +3 -1
- package/dist/form/index.js +12 -1
- package/dist/i18n/messages/en.json +56 -5
- package/dist/i18n/messages/ja.json +56 -5
- package/dist/i18n/messages/vi.json +56 -5
- package/dist/inertia/index.d.ts +20 -0
- package/dist/inertia/index.js +60 -1
- package/dist/lib/control-styles.d.ts +25 -3
- package/dist/lib/control-styles.js +9 -3
- package/dist/lib/datetime/picker-format.d.ts +8 -0
- package/dist/lib/datetime/picker-format.js +54 -0
- package/dist/props/components/charts.prop.d.ts +21 -0
- package/dist/props/components/data-display.prop.d.ts +55 -4
- package/dist/props/components/data-entry.prop.d.ts +687 -43
- package/dist/props/components/form.prop.d.ts +142 -4
- package/dist/props/components/general.prop.d.ts +17 -1
- package/dist/props/components/index.d.ts +2 -2
- package/dist/props/components/layout.prop.d.ts +163 -6
- package/dist/props/components/navigation.prop.d.ts +113 -3
- package/dist/props/registry.d.ts +376 -10
- package/dist/props/registry.js +493 -9
- package/dist/props/vocabulary/data.prop.d.ts +179 -1
- package/dist/props/vocabulary/index.d.ts +4 -4
- package/dist/props/vocabulary/interaction.prop.d.ts +51 -2
- package/dist/props/vocabulary/navigation.prop.d.ts +40 -0
- package/dist/props/vocabulary/shared.prop.d.ts +33 -0
- package/dist/styles/badge-layout.css +2 -1
- package/dist/styles/card-layout.css +26 -4
- package/dist/styles/chart-layout.css +15 -0
- package/dist/styles/control.css +515 -14
- package/dist/styles/data-display-layout.css +241 -6
- package/dist/styles/data-entry-layout.css +13 -0
- package/dist/styles/layout.css +221 -4
- package/dist/styles/navigation-layout.css +227 -0
- package/dist/styles/shell-layout.css +229 -5
- package/dist/styles/table-layout.css +95 -6
- package/dist/styles/text-layout.css +5 -0
- package/dist/tokens/base.css +1 -0
- package/dist/tokens/components/badge.css +1 -0
- package/dist/tokens/components/chart.css +6 -0
- package/dist/tokens/components/control.css +79 -2
- package/dist/tokens/components/data-display.css +9 -0
- package/dist/tokens/components/descriptions.css +11 -0
- package/dist/tokens/components/flex.css +8 -0
- package/dist/tokens/components/navigation.css +55 -0
- package/dist/tokens/components/shell.css +50 -2
- package/dist/tokens/components/table.css +14 -0
- package/dist/tokens/semantic/layout.css +9 -0
- package/docs/CONSUMER-RULES.md +13 -0
- package/docs/DESIGN-AUTHORITY.md +43 -6
- package/docs/DEVELOPMENT.md +4 -3
- package/docs/FORMS.md +151 -6
- package/docs/FRAME-COVERAGE-REPORT.md +29 -16
- package/docs/README.md +1 -1
- package/docs/STANDARDS-vocabulary-tokens.md +1 -1
- package/docs/TESTING.md +15 -6
- package/docs/charts/cjk-category-axis.tsx +81 -0
- package/docs/data-display/card/index.tsx +22 -0
- package/docs/data-display/data-table/examples/antd-parity.tsx +257 -0
- package/docs/data-display/data-table/index.tsx +23 -0
- package/docs/data-display/descriptions.tsx +41 -0
- package/docs/data-display/scroll-area.tsx +31 -25
- package/docs/data-display/table.tsx +104 -45
- package/docs/data-display/timeline.tsx +41 -0
- package/docs/data-entry/date-picker.tsx +85 -0
- package/docs/data-entry/date-range-picker.tsx +26 -0
- package/docs/data-entry/form-dynamic-fields.tsx +199 -0
- package/docs/data-entry/form.tsx +74 -4
- package/docs/data-entry/input-otp.tsx +24 -0
- package/docs/data-entry/input.tsx +46 -1
- package/docs/data-entry/month-range-picker.tsx +1 -1
- package/docs/data-entry/select.tsx +27 -0
- package/docs/data-entry/switch.tsx +41 -0
- package/docs/data-entry/textarea.tsx +38 -0
- package/docs/data-entry/time-picker.tsx +85 -1
- package/docs/data-entry/time-range-picker.tsx +55 -0
- package/docs/data-entry/transfer.tsx +17 -0
- package/docs/data-entry/upload.tsx +56 -12
- package/docs/feedback/tooltip.tsx +1 -1
- package/docs/general/activity.tsx +2 -2
- package/docs/general/button/index.tsx +14 -1
- package/docs/general/typography.tsx +14 -1
- package/docs/layout/app-launcher.tsx +151 -0
- package/docs/layout/app-shell.tsx +11 -0
- package/docs/layout/flex.tsx +50 -0
- package/docs/layout/responsive-grid.tsx +21 -1
- package/docs/layout/topbar.tsx +5 -9
- package/docs/navigation/app-setting-picker.tsx +11 -0
- package/docs/navigation/breadcrumb.tsx +48 -0
- package/docs/navigation/dropdown-menu.tsx +21 -0
- package/docs/navigation/pagination.tsx +52 -0
- package/docs/navigation/steps.tsx +37 -0
- package/docs/navigation/tabs.tsx +97 -1
- package/docs/query/button-refetch.tsx +1 -0
- package/package.json +19 -2
- package/scripts/_agent-setup.mjs +19 -2
- package/scripts/init-guinea-pig.mjs +26 -4
- package/scripts/ui-audit.mjs +243 -30
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Plus } from "lucide-react";
|
|
5
5
|
import { cn } from "../../lib/utils.js";
|
|
6
6
|
import { Badge } from "./badge.js";
|
|
7
|
-
import { Card } from "./card.js";
|
|
7
|
+
import { Card, CardContent } from "./card.js";
|
|
8
8
|
const ServiceLauncherCard = React.forwardRef(
|
|
9
9
|
({
|
|
10
10
|
className,
|
|
@@ -20,7 +20,7 @@ const ServiceLauncherCard = React.forwardRef(
|
|
|
20
20
|
...props
|
|
21
21
|
}, ref) => {
|
|
22
22
|
const Heading = `h${titleLevel}`;
|
|
23
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
24
|
Card,
|
|
25
25
|
{
|
|
26
26
|
ref,
|
|
@@ -29,7 +29,7 @@ const ServiceLauncherCard = React.forwardRef(
|
|
|
29
29
|
"data-service-launcher": "",
|
|
30
30
|
"data-unavailable": disabledReason != null ? "" : void 0,
|
|
31
31
|
...props,
|
|
32
|
-
children: [
|
|
32
|
+
children: /* @__PURE__ */ jsxs(CardContent, { solo: true, children: [
|
|
33
33
|
/* @__PURE__ */ jsxs("div", { "data-slot": "service-launcher-heading", children: [
|
|
34
34
|
/* @__PURE__ */ jsx("span", { "data-slot": "service-launcher-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(Icon, {}) }),
|
|
35
35
|
/* @__PURE__ */ jsx(Heading, { "data-slot": "service-launcher-title", children: title }),
|
|
@@ -39,14 +39,14 @@ const ServiceLauncherCard = React.forwardRef(
|
|
|
39
39
|
metadata != null ? /* @__PURE__ */ jsx("div", { "data-slot": "service-launcher-metadata", children: metadata }) : null,
|
|
40
40
|
disabledReason != null ? /* @__PURE__ */ jsx("div", { "data-slot": "service-launcher-disabled-reason", children: disabledReason }) : null,
|
|
41
41
|
/* @__PURE__ */ jsx("div", { "data-slot": "service-launcher-action", children: action })
|
|
42
|
-
]
|
|
42
|
+
] })
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
);
|
|
47
47
|
ServiceLauncherCard.displayName = "ServiceLauncherCard";
|
|
48
48
|
const ServiceCatalogCta = React.forwardRef(
|
|
49
|
-
({ className, icon: Icon = Plus, title, action, ...props }, ref) => /* @__PURE__ */
|
|
49
|
+
({ className, icon: Icon = Plus, title, action, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
50
50
|
Card,
|
|
51
51
|
{
|
|
52
52
|
ref,
|
|
@@ -54,11 +54,11 @@ const ServiceCatalogCta = React.forwardRef(
|
|
|
54
54
|
className: cn("ui-service-catalog-cta", className),
|
|
55
55
|
"data-service-catalog-cta": "",
|
|
56
56
|
...props,
|
|
57
|
-
children: [
|
|
57
|
+
children: /* @__PURE__ */ jsxs(CardContent, { solo: true, children: [
|
|
58
58
|
/* @__PURE__ */ jsx(Icon, { "data-slot": "service-catalog-icon", "aria-hidden": "true" }),
|
|
59
59
|
/* @__PURE__ */ jsx("div", { "data-slot": "service-catalog-title", children: title }),
|
|
60
60
|
/* @__PURE__ */ jsx("div", { "data-slot": "service-catalog-action", children: action })
|
|
61
|
-
]
|
|
61
|
+
] })
|
|
62
62
|
}
|
|
63
63
|
)
|
|
64
64
|
);
|
|
@@ -68,7 +68,7 @@ function ServiceLauncherCardSkeleton({
|
|
|
68
68
|
label,
|
|
69
69
|
...props
|
|
70
70
|
}) {
|
|
71
|
-
return /* @__PURE__ */
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
72
|
Card,
|
|
73
73
|
{
|
|
74
74
|
density: "tight",
|
|
@@ -76,7 +76,7 @@ function ServiceLauncherCardSkeleton({
|
|
|
76
76
|
"data-service-launcher": "",
|
|
77
77
|
"aria-busy": "true",
|
|
78
78
|
...props,
|
|
79
|
-
children: [
|
|
79
|
+
children: /* @__PURE__ */ jsxs(CardContent, { solo: true, children: [
|
|
80
80
|
/* @__PURE__ */ jsx("span", { className: "sr-only", children: label }),
|
|
81
81
|
/* @__PURE__ */ jsxs("div", { "data-slot": "service-launcher-skeleton-heading", children: [
|
|
82
82
|
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-icon" }),
|
|
@@ -86,7 +86,7 @@ function ServiceLauncherCardSkeleton({
|
|
|
86
86
|
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-description" }),
|
|
87
87
|
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-metadata" }),
|
|
88
88
|
/* @__PURE__ */ jsx("span", { className: "ui-skeleton-block", "data-slot": "service-launcher-skeleton-action" })
|
|
89
|
-
]
|
|
89
|
+
] })
|
|
90
90
|
}
|
|
91
91
|
);
|
|
92
92
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { BreakpointProp, FlushProp, TableCellIndentProp, TableColumnPriorityProp, TablePresetProp } from "../../props/vocabulary/index.js";
|
|
2
|
+
import type { BreakpointProp, FlushProp, TableCellIndentProp, TableColumnPriorityProp, TablePresetProp, WidthProp } from "../../props/vocabulary/index.js";
|
|
3
3
|
export type TableProps = React.HTMLAttributes<HTMLTableElement> & {
|
|
4
4
|
/**
|
|
5
5
|
* Whether the Table owns its own horizontal-scroll region (default `true`). When `true` a table
|
|
@@ -53,6 +53,14 @@ export declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttribu
|
|
|
53
53
|
type TableCellPriority = {
|
|
54
54
|
priority?: TableColumnPriorityProp;
|
|
55
55
|
};
|
|
56
|
+
/** Logical column alignment, wrapping and measure, shared by header and body cells.
|
|
57
|
+
* Numeric cells use tabular figures and end alignment unless align is explicit. */
|
|
58
|
+
type TableCellAxes = {
|
|
59
|
+
align?: "start" | "center" | "end";
|
|
60
|
+
numeric?: boolean;
|
|
61
|
+
wrap?: boolean;
|
|
62
|
+
width?: WidthProp;
|
|
63
|
+
};
|
|
56
64
|
/**
|
|
57
65
|
* Rendered into the DOM unconditionally (so it exists for the preset's CSS to reveal) but visually
|
|
58
66
|
* hidden above the collapse step, where the real `<th>` already carries the label — an ordinary
|
|
@@ -61,7 +69,7 @@ type TableCellPriority = {
|
|
|
61
69
|
type TableCellLabel = {
|
|
62
70
|
label?: React.ReactNode;
|
|
63
71
|
};
|
|
64
|
-
export declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & TableCellPriority & React.RefAttributes<HTMLTableCellElement>>;
|
|
72
|
+
export declare const TableHead: React.ForwardRefExoticComponent<Omit<React.ThHTMLAttributes<HTMLTableCellElement>, "align"> & TableCellPriority & TableCellAxes & React.RefAttributes<HTMLTableCellElement>>;
|
|
65
73
|
/**
|
|
66
74
|
* The cell's CONTENT owns its inset — an expanded detail panel, a nested table, a full-bleed media
|
|
67
75
|
* strip. The cell drops its own padding so the child reaches the cell edges; without it the only
|
|
@@ -79,5 +87,5 @@ type TableCellFlush = {
|
|
|
79
87
|
type TableCellIndent = {
|
|
80
88
|
indent?: TableCellIndentProp;
|
|
81
89
|
};
|
|
82
|
-
export declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & TableCellPriority & TableCellLabel & TableCellFlush & TableCellIndent & React.RefAttributes<HTMLTableCellElement>>;
|
|
90
|
+
export declare const TableCell: React.ForwardRefExoticComponent<Omit<React.TdHTMLAttributes<HTMLTableCellElement>, "align"> & TableCellPriority & TableCellLabel & TableCellFlush & TableCellIndent & TableCellAxes & React.RefAttributes<HTMLTableCellElement>>;
|
|
83
91
|
export {};
|
|
@@ -65,34 +65,64 @@ const TableRow = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
65
65
|
}
|
|
66
66
|
));
|
|
67
67
|
TableRow.displayName = "TableRow";
|
|
68
|
-
|
|
68
|
+
function cellWidth(width) {
|
|
69
|
+
if (width === void 0) return void 0;
|
|
70
|
+
return typeof width === "number" ? `${width}px` : width;
|
|
71
|
+
}
|
|
72
|
+
const TableHead = React.forwardRef(({ className, priority, align, numeric, wrap, width, style, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
69
73
|
"th",
|
|
70
74
|
{
|
|
71
75
|
ref,
|
|
72
76
|
"data-slot": "table-head",
|
|
73
77
|
"data-priority": priority,
|
|
78
|
+
"data-align": align,
|
|
79
|
+
"data-numeric": numeric ? "" : void 0,
|
|
80
|
+
"data-wrap": wrap ? "" : void 0,
|
|
74
81
|
className: cn(tableHeadHeightClass, className),
|
|
82
|
+
style: width === void 0 ? style : { ...style, inlineSize: cellWidth(width) },
|
|
75
83
|
...props
|
|
76
84
|
}
|
|
77
85
|
));
|
|
78
86
|
TableHead.displayName = "TableHead";
|
|
79
|
-
const TableCell = React.forwardRef(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
children
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
const TableCell = React.forwardRef(
|
|
88
|
+
({
|
|
89
|
+
className,
|
|
90
|
+
priority,
|
|
91
|
+
label,
|
|
92
|
+
flush,
|
|
93
|
+
indent,
|
|
94
|
+
align,
|
|
95
|
+
numeric,
|
|
96
|
+
wrap,
|
|
97
|
+
width,
|
|
98
|
+
children,
|
|
99
|
+
style,
|
|
100
|
+
...props
|
|
101
|
+
}, ref) => /* @__PURE__ */ jsxs(
|
|
102
|
+
"td",
|
|
103
|
+
{
|
|
104
|
+
ref,
|
|
105
|
+
"data-slot": "table-cell",
|
|
106
|
+
"data-priority": priority,
|
|
107
|
+
"data-flush": flush ? "" : void 0,
|
|
108
|
+
"data-indent": indent === void 0 ? void 0 : indent,
|
|
109
|
+
"data-align": align,
|
|
110
|
+
"data-numeric": numeric ? "" : void 0,
|
|
111
|
+
"data-wrap": wrap ? "" : void 0,
|
|
112
|
+
className: cn(className),
|
|
113
|
+
style: indent === void 0 && width === void 0 ? style : {
|
|
114
|
+
...style,
|
|
115
|
+
...indent === void 0 ? null : { "--table-cell-indent-level": indent },
|
|
116
|
+
...width === void 0 ? null : { inlineSize: cellWidth(width) }
|
|
117
|
+
},
|
|
118
|
+
...props,
|
|
119
|
+
children: [
|
|
120
|
+
label !== void 0 ? /* @__PURE__ */ jsx("span", { className: "ui-table-stacked-collection-label", "aria-hidden": "true", children: label }) : null,
|
|
121
|
+
children
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
);
|
|
96
126
|
TableCell.displayName = "TableCell";
|
|
97
127
|
export {
|
|
98
128
|
Table,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { ChevronRight, Package } from "lucide-react";
|
|
4
3
|
import { Badge } from "./badge.js";
|
|
5
4
|
function TreeList({ items }) {
|
|
6
5
|
return /* @__PURE__ */ jsx("ul", { className: "ui-tree-list", children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
@@ -8,19 +7,15 @@ function TreeList({ items }) {
|
|
|
8
7
|
{
|
|
9
8
|
className: "ui-tree-item",
|
|
10
9
|
"data-active": item.active ? "true" : void 0,
|
|
11
|
-
"data-depth": item.depth ?? 0,
|
|
10
|
+
"data-depth": Math.max(0, item.depth ?? 0),
|
|
11
|
+
style: { "--tree-item-depth": Math.max(0, item.depth ?? 0) },
|
|
12
12
|
"aria-current": item.active ? "true" : void 0,
|
|
13
13
|
children: [
|
|
14
|
-
/* @__PURE__ */ jsx(ChevronRight, { "aria-hidden": "true" }),
|
|
15
|
-
/* @__PURE__ */ jsx(Package, { "aria-hidden": "true" }),
|
|
16
14
|
/* @__PURE__ */ jsxs("div", { className: "ui-tree-item-body", children: [
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
item.active ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Current: " }) : null,
|
|
19
|
-
item.title
|
|
20
|
-
] }),
|
|
15
|
+
/* @__PURE__ */ jsx("div", { className: "ui-tree-item-title", children: item.title }),
|
|
21
16
|
item.description ? /* @__PURE__ */ jsx("div", { className: "ui-tree-item-description", children: item.description }) : null
|
|
22
17
|
] }),
|
|
23
|
-
item.badge ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: item.badge }) : null
|
|
18
|
+
item.badge != null ? /* @__PURE__ */ jsx(Badge, { variant: "secondary", children: item.badge }) : null
|
|
24
19
|
]
|
|
25
20
|
},
|
|
26
21
|
item.id
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { CalendarProp } from "../../props/components/data-entry.prop.js";
|
|
3
|
-
export type { CalendarProp, CalendarProp as CalendarProps, CalendarFooterProp, } from "../../props/components/data-entry.prop.js";
|
|
4
|
-
export declare function Calendar({ className, classNames, showOutsideDays, "aria-label": ariaLabel, labels, showToday, showClose, onClose, footer, width, bordered, month: monthProp, onMonthChange, ...props }: CalendarProp): React.JSX.Element;
|
|
3
|
+
export type { CalendarProp, CalendarProp as CalendarProps, CalendarCellRenderProp, CalendarFooterProp, } from "../../props/components/data-entry.prop.js";
|
|
4
|
+
export declare function Calendar({ className, classNames, showOutsideDays, "aria-label": ariaLabel, labels, showToday, showClose, onClose, footer, width, bordered, cellRender, month: monthProp, onMonthChange, ...props }: CalendarProp): React.JSX.Element;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from "lucide-react";
|
|
5
|
-
import { DayPicker, dateMatchModifiers } from "react-day-picker";
|
|
5
|
+
import { DayButton, DayPicker, dateMatchModifiers } from "react-day-picker";
|
|
6
6
|
import { useTranslation } from "../../i18n/use-translation.js";
|
|
7
7
|
import { cn } from "../../lib/utils.js";
|
|
8
8
|
import { controlIconSmClass } from "../../lib/control-styles.js";
|
|
@@ -23,6 +23,7 @@ function Calendar({
|
|
|
23
23
|
footer,
|
|
24
24
|
width = "auto",
|
|
25
25
|
bordered = false,
|
|
26
|
+
cellRender,
|
|
26
27
|
month: monthProp,
|
|
27
28
|
onMonthChange,
|
|
28
29
|
...props
|
|
@@ -169,6 +170,16 @@ function Calendar({
|
|
|
169
170
|
const Icon = orientation === "left" ? ChevronLeft : orientation === "up" ? ChevronUp : orientation === "down" ? ChevronDown : ChevronRight;
|
|
170
171
|
return /* @__PURE__ */ jsx(Icon, { className: cn("ui-calendar-chevron", chevronClassName), "aria-hidden": "true" });
|
|
171
172
|
},
|
|
173
|
+
/**
|
|
174
|
+
* `cellRender` WRAPS the library's own day button rather than replacing it (gh#390). The
|
|
175
|
+
* button carries the selection state, `aria-selected`, the disabled handling and its place
|
|
176
|
+
* in the grid's roving tabindex; handing a consumer a blank cell to rebuild would mean
|
|
177
|
+
* every 祝日 marker in every app re-derives all of that, and most would get it wrong.
|
|
178
|
+
* So the original node is passed in and the consumer decorates around it.
|
|
179
|
+
*/
|
|
180
|
+
...cellRender ? {
|
|
181
|
+
DayButton: (dayButtonProps) => /* @__PURE__ */ jsx(Fragment, { children: cellRender(dayButtonProps.day.date, { originNode: /* @__PURE__ */ jsx(DayButton, { ...dayButtonProps }) }) })
|
|
182
|
+
} : {},
|
|
172
183
|
/*
|
|
173
184
|
* A consumer's `components` MERGE with ours; they must not replace the object.
|
|
174
185
|
*
|
|
@@ -2,4 +2,4 @@ import * as React from "react";
|
|
|
2
2
|
import type { CascaderProp } from "../../props/components/data-entry.prop.js";
|
|
3
3
|
export type { CascaderProp, CascaderProp as CascaderProps, } from "../../props/components/data-entry.prop.js";
|
|
4
4
|
export type { TreeOption, TreeFieldNames } from "./tree-utils.js";
|
|
5
|
-
export declare function Cascader({ options: optionsProp, value, defaultValue, onValueChange, multiple, changeOnSelect, showSearch, placeholder, disabled, className, id, expandTrigger, fieldNames, allowClear, ...ariaProps }: CascaderProp): React.JSX.Element;
|
|
5
|
+
export declare function Cascader({ options: optionsProp, value, defaultValue, onValueChange, multiple, changeOnSelect, showSearch, placeholder, disabled, readOnly, name, className, id, expandTrigger, fieldNames, allowClear, size, status, variant, loading, open: openProp, defaultOpen, onOpenChange, showCheckedStrategy, loadData, displayRender, optionRender, maxTagCount, maxTagPlaceholder, notFoundContent, autoClearSearchValue, search: searchProp, onSearchChange, ...ariaProps }: CascaderProp): React.JSX.Element;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { Check, ChevronRight, ChevronsUpDown, Minus, X } from "lucide-react";
|
|
4
|
+
import { Check, ChevronRight, ChevronsUpDown, Loader2, Minus, X } from "lucide-react";
|
|
5
5
|
import { useTranslation } from "../../i18n/use-translation.js";
|
|
6
6
|
import { cn } from "../../lib/utils.js";
|
|
7
7
|
import { pickFieldA11y, useFieldIdentity } from "../../lib/field-a11y.js";
|
|
8
|
-
import {
|
|
8
|
+
import { controlSurfaceTriggerClass } from "../../lib/control-styles.js";
|
|
9
|
+
import {
|
|
10
|
+
applyMaxTagCount,
|
|
11
|
+
controlSurfaceAttrs,
|
|
12
|
+
resolveAllowClear,
|
|
13
|
+
resolveAriaInvalid
|
|
14
|
+
} from "./control-surface.js";
|
|
9
15
|
import { Popover, PopoverContent, PopoverTrigger } from "../data-display/popover.js";
|
|
10
16
|
import { ScrollArea, ScrollBar } from "../data-display/scroll-area.js";
|
|
11
17
|
import { Command, CommandInput } from "./command.js";
|
|
@@ -15,7 +21,8 @@ import {
|
|
|
15
21
|
getNodeByPath,
|
|
16
22
|
normalizeTreeOptions,
|
|
17
23
|
pathKey,
|
|
18
|
-
pathsEqual
|
|
24
|
+
pathsEqual,
|
|
25
|
+
reactNodeText
|
|
19
26
|
} from "./tree-utils.js";
|
|
20
27
|
function pathInValues(path, values) {
|
|
21
28
|
return values.some((v) => pathsEqual(v, path));
|
|
@@ -66,6 +73,41 @@ function aggregateCheckState(node, path, values) {
|
|
|
66
73
|
if (total === 0 || selected === 0) return "none";
|
|
67
74
|
return selected === total ? "checked" : "indeterminate";
|
|
68
75
|
}
|
|
76
|
+
function leafPathsUnder(node, path) {
|
|
77
|
+
const out = [];
|
|
78
|
+
const walk = (current, prefix) => {
|
|
79
|
+
const isLeaf = (current.children?.length ?? 0) === 0 || current.isLeaf === true;
|
|
80
|
+
if (isLeaf) {
|
|
81
|
+
out.push(prefix);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
for (const child of current.children) walk(child, [...prefix, child.value]);
|
|
85
|
+
};
|
|
86
|
+
walk(node, path);
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
function collapseToParents(values, options) {
|
|
90
|
+
const representative = /* @__PURE__ */ new Map();
|
|
91
|
+
const walk = (nodes, prefix) => {
|
|
92
|
+
for (const node of nodes) {
|
|
93
|
+
const path = [...prefix, node.value];
|
|
94
|
+
const hasChildren = (node.children?.length ?? 0) > 0 && node.isLeaf !== true;
|
|
95
|
+
if (!hasChildren) continue;
|
|
96
|
+
if (aggregateCheckState(node, path, values) === "checked") {
|
|
97
|
+
for (const leaf of leafPathsUnder(node, path)) representative.set(pathKey(leaf), path);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
walk(node.children, path);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
walk(options, []);
|
|
104
|
+
const out = [];
|
|
105
|
+
for (const value of values) {
|
|
106
|
+
const shown = representative.get(pathKey(value)) ?? value;
|
|
107
|
+
if (!out.some((existing) => pathsEqual(existing, shown))) out.push(shown);
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
69
111
|
function Cascader({
|
|
70
112
|
options: optionsProp,
|
|
71
113
|
value,
|
|
@@ -76,25 +118,76 @@ function Cascader({
|
|
|
76
118
|
showSearch,
|
|
77
119
|
placeholder,
|
|
78
120
|
disabled,
|
|
121
|
+
readOnly,
|
|
122
|
+
name,
|
|
79
123
|
className,
|
|
80
124
|
id,
|
|
81
125
|
expandTrigger = "click",
|
|
82
126
|
fieldNames,
|
|
83
|
-
allowClear
|
|
127
|
+
allowClear,
|
|
128
|
+
size,
|
|
129
|
+
status,
|
|
130
|
+
variant,
|
|
131
|
+
loading = false,
|
|
132
|
+
open: openProp,
|
|
133
|
+
defaultOpen = false,
|
|
134
|
+
onOpenChange,
|
|
135
|
+
showCheckedStrategy = "SHOW_CHILD",
|
|
136
|
+
loadData,
|
|
137
|
+
displayRender,
|
|
138
|
+
optionRender,
|
|
139
|
+
maxTagCount,
|
|
140
|
+
maxTagPlaceholder,
|
|
141
|
+
notFoundContent,
|
|
142
|
+
autoClearSearchValue = true,
|
|
143
|
+
search: searchProp,
|
|
144
|
+
onSearchChange,
|
|
84
145
|
...ariaProps
|
|
85
146
|
}) {
|
|
86
147
|
const { t } = useTranslation();
|
|
87
148
|
const fieldA11y = pickFieldA11y(ariaProps);
|
|
88
|
-
const identity = useFieldIdentity({ id, "data-field": fieldA11y["data-field"] });
|
|
149
|
+
const identity = useFieldIdentity({ id, name, "data-field": fieldA11y["data-field"] });
|
|
150
|
+
const resolvedName = name ?? identity.name;
|
|
89
151
|
const reactId = React.useId();
|
|
90
152
|
const panelId = `${id ?? reactId}-panel`;
|
|
91
153
|
const options = React.useMemo(
|
|
92
154
|
() => normalizeTreeOptions(optionsProp, fieldNames),
|
|
93
155
|
[optionsProp, fieldNames]
|
|
94
156
|
);
|
|
95
|
-
const [
|
|
157
|
+
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
158
|
+
const isOpenControlled = openProp !== void 0;
|
|
159
|
+
const open = isOpenControlled ? openProp : internalOpen;
|
|
160
|
+
const setOpen = React.useCallback(
|
|
161
|
+
(next) => {
|
|
162
|
+
if (!isOpenControlled) setInternalOpen(next);
|
|
163
|
+
onOpenChange?.(next);
|
|
164
|
+
},
|
|
165
|
+
[isOpenControlled, onOpenChange]
|
|
166
|
+
);
|
|
96
167
|
const [activePath, setActivePath] = React.useState([]);
|
|
97
|
-
const [
|
|
168
|
+
const [internalSearch, setInternalSearch] = React.useState("");
|
|
169
|
+
const isSearchControlled = searchProp !== void 0;
|
|
170
|
+
const search = isSearchControlled ? searchProp : internalSearch;
|
|
171
|
+
const setSearch = React.useCallback(
|
|
172
|
+
(next) => {
|
|
173
|
+
if (!isSearchControlled) setInternalSearch(next);
|
|
174
|
+
onSearchChange?.(next);
|
|
175
|
+
},
|
|
176
|
+
[isSearchControlled, onSearchChange]
|
|
177
|
+
);
|
|
178
|
+
const requestedLoads = React.useRef(/* @__PURE__ */ new Set());
|
|
179
|
+
const requestLoad = React.useCallback(
|
|
180
|
+
(path, chain) => {
|
|
181
|
+
if (!loadData) return;
|
|
182
|
+
const node = chain.at(-1);
|
|
183
|
+
if (!node || node.isLeaf === true || (node.children?.length ?? 0) > 0) return;
|
|
184
|
+
const key = pathKey(path);
|
|
185
|
+
if (requestedLoads.current.has(key)) return;
|
|
186
|
+
requestedLoads.current.add(key);
|
|
187
|
+
void loadData(chain);
|
|
188
|
+
},
|
|
189
|
+
[loadData]
|
|
190
|
+
);
|
|
98
191
|
const isControlledSingle = !multiple && value !== void 0;
|
|
99
192
|
const isControlledMulti = multiple && value !== void 0;
|
|
100
193
|
const [internalSingle, setInternalSingle] = React.useState(
|
|
@@ -106,14 +199,52 @@ function Cascader({
|
|
|
106
199
|
const singleValue = isControlledSingle ? value : internalSingle;
|
|
107
200
|
const multiValue = isControlledMulti ? value : internalMulti;
|
|
108
201
|
const resolvedPlaceholder = placeholder ?? t("dataEntry.cascader.placeholder");
|
|
202
|
+
const hasValue = multiple ? multiValue.length > 0 : singleValue.length > 0;
|
|
109
203
|
const displayLabel = React.useMemo(() => {
|
|
110
204
|
if (multiple) {
|
|
111
205
|
if (!multiValue.length) return null;
|
|
112
|
-
|
|
206
|
+
const shown = showCheckedStrategy === "SHOW_PARENT" ? collapseToParents(multiValue, options) : multiValue;
|
|
207
|
+
const items = shown.map((path) => {
|
|
208
|
+
const chain2 = getNodeByPath(options, path);
|
|
209
|
+
const labels = chain2.map((node) => reactNodeText(node.label));
|
|
210
|
+
return {
|
|
211
|
+
value: pathKey(path),
|
|
212
|
+
label: displayRender ? displayRender(labels, chain2) : formatPathLabels(chain2)
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
const { visible, omitted, overflow } = applyMaxTagCount(
|
|
216
|
+
items,
|
|
217
|
+
maxTagCount,
|
|
218
|
+
maxTagPlaceholder
|
|
219
|
+
);
|
|
220
|
+
const body = visible.map((item, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
221
|
+
index > 0 ? ", " : null,
|
|
222
|
+
item.label
|
|
223
|
+
] }, item.value));
|
|
224
|
+
if (omitted.length === 0) return body;
|
|
225
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
226
|
+
body,
|
|
227
|
+
", ",
|
|
228
|
+
/* @__PURE__ */ jsx("span", { "data-slot": "cascader-overflow", children: overflow ?? t("dataEntry.selection.overflow", { count: omitted.length }) })
|
|
229
|
+
] });
|
|
113
230
|
}
|
|
114
231
|
if (!singleValue.length) return null;
|
|
115
|
-
|
|
116
|
-
|
|
232
|
+
const chain = getNodeByPath(options, singleValue);
|
|
233
|
+
return displayRender ? displayRender(
|
|
234
|
+
chain.map((node) => reactNodeText(node.label)),
|
|
235
|
+
chain
|
|
236
|
+
) : formatPathLabels(chain);
|
|
237
|
+
}, [
|
|
238
|
+
multiple,
|
|
239
|
+
multiValue,
|
|
240
|
+
singleValue,
|
|
241
|
+
options,
|
|
242
|
+
showCheckedStrategy,
|
|
243
|
+
displayRender,
|
|
244
|
+
maxTagCount,
|
|
245
|
+
maxTagPlaceholder,
|
|
246
|
+
t
|
|
247
|
+
]);
|
|
117
248
|
const setSingleValue = (path) => {
|
|
118
249
|
if (!isControlledSingle) setInternalSingle(path);
|
|
119
250
|
onValueChange?.(path, getNodeByPath(options, path));
|
|
@@ -122,7 +253,7 @@ function Cascader({
|
|
|
122
253
|
setSingleValue(path);
|
|
123
254
|
setOpen(false);
|
|
124
255
|
setActivePath([]);
|
|
125
|
-
setSearch("");
|
|
256
|
+
if (autoClearSearchValue) setSearch("");
|
|
126
257
|
};
|
|
127
258
|
const commitMulti = (paths) => {
|
|
128
259
|
if (!isControlledMulti) setInternalMulti(paths);
|
|
@@ -143,6 +274,11 @@ function Cascader({
|
|
|
143
274
|
}, [options, activePath]);
|
|
144
275
|
const handleSelectNode = (node, path) => {
|
|
145
276
|
const hasChildren = (node.children?.length ?? 0) > 0 && node.isLeaf !== true;
|
|
277
|
+
requestLoad(path, getNodeByPath(options, path));
|
|
278
|
+
if (loadData && node.isLeaf === false && !(node.children?.length ?? 0)) {
|
|
279
|
+
setActivePath(path);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
146
282
|
if (multiple) {
|
|
147
283
|
if (hasChildren && !changeOnSelect) setActivePath(path);
|
|
148
284
|
else if (!node.disableCheckbox) commitMulti(togglePath(multiValue, path));
|
|
@@ -161,11 +297,12 @@ function Cascader({
|
|
|
161
297
|
[options, search, isSearching]
|
|
162
298
|
);
|
|
163
299
|
const handleOpenChange = (next) => {
|
|
300
|
+
if (readOnly && next) return;
|
|
164
301
|
setOpen(next);
|
|
165
302
|
if (next) {
|
|
166
303
|
setActivePath(multiple ? [] : singleValue);
|
|
167
304
|
} else {
|
|
168
|
-
setSearch("");
|
|
305
|
+
if (autoClearSearchValue) setSearch("");
|
|
169
306
|
setActivePath([]);
|
|
170
307
|
}
|
|
171
308
|
};
|
|
@@ -208,7 +345,11 @@ function Cascader({
|
|
|
208
345
|
// deeper column but keeps its own. Never collapse on the column's mouseleave
|
|
209
346
|
// — moving the pointer toward the next column would strand the deeper levels
|
|
210
347
|
// and make a depth-3 leaf unreachable.
|
|
211
|
-
expandTrigger === "hover" && !node.disabled ? () =>
|
|
348
|
+
expandTrigger === "hover" && !node.disabled ? () => {
|
|
349
|
+
const loadable = node.isLeaf === false && !(node.children?.length ?? 0);
|
|
350
|
+
requestLoad(path, getNodeByPath(options, path));
|
|
351
|
+
setActivePath(hasChildren || loadable ? path : path.slice(0, -1));
|
|
352
|
+
} : void 0
|
|
212
353
|
),
|
|
213
354
|
onClick: () => !node.disabled && handleSelectNode(node, path),
|
|
214
355
|
children: [
|
|
@@ -222,8 +363,8 @@ function Cascader({
|
|
|
222
363
|
}
|
|
223
364
|
),
|
|
224
365
|
!multiple && selected && /* @__PURE__ */ jsx(Check, { className: "ui-cascader-option-icon", "aria-hidden": "true" }),
|
|
225
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-start", children: node.label }),
|
|
226
|
-
hasChildren && /* @__PURE__ */ jsx(ChevronRight, { className: "ui-cascader-option-chevron", "aria-hidden": "true" })
|
|
366
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate text-start", children: optionRender ? optionRender(node) : node.label }),
|
|
367
|
+
(hasChildren || loadData && node.isLeaf === false) && /* @__PURE__ */ jsx(ChevronRight, { className: "ui-cascader-option-chevron", "aria-hidden": "true" })
|
|
227
368
|
]
|
|
228
369
|
}
|
|
229
370
|
) }, node.value);
|
|
@@ -233,7 +374,9 @@ function Cascader({
|
|
|
233
374
|
)) }),
|
|
234
375
|
/* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" })
|
|
235
376
|
] });
|
|
236
|
-
const
|
|
377
|
+
const clearControl = resolveAllowClear(allowClear, true, t("dataEntry.cascader.clear"));
|
|
378
|
+
const showClear = clearControl.enabled && hasValue && !disabled && !readOnly && !loading;
|
|
379
|
+
const surface = controlSurfaceAttrs({ variant, status, size });
|
|
237
380
|
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
238
381
|
/* @__PURE__ */ jsxs(Popover, { open, onOpenChange: handleOpenChange, children: [
|
|
239
382
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
@@ -247,17 +390,31 @@ function Cascader({
|
|
|
247
390
|
"aria-haspopup": "listbox",
|
|
248
391
|
"aria-controls": open ? panelId : void 0,
|
|
249
392
|
...fieldA11y,
|
|
393
|
+
...surface,
|
|
394
|
+
"aria-invalid": resolveAriaInvalid(fieldA11y["aria-invalid"], status),
|
|
395
|
+
"aria-busy": loading || void 0,
|
|
396
|
+
"aria-readonly": readOnly || void 0,
|
|
250
397
|
disabled,
|
|
251
398
|
className: cn(
|
|
252
|
-
|
|
399
|
+
controlSurfaceTriggerClass,
|
|
253
400
|
"w-full justify-start",
|
|
254
401
|
// Reserve trailing room for the single clear-or-chevron overlay rendered below.
|
|
255
402
|
"ui-control-trigger-affixed",
|
|
256
|
-
!
|
|
403
|
+
!hasValue && "text-muted-foreground"
|
|
257
404
|
),
|
|
258
|
-
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: displayLabel
|
|
405
|
+
children: /* @__PURE__ */ jsx("span", { className: "truncate", children: hasValue ? displayLabel : resolvedPlaceholder })
|
|
259
406
|
}
|
|
260
407
|
) }),
|
|
408
|
+
resolvedName ? (multiple ? multiValue : singleValue.length ? [singleValue] : []).map((path, index) => /* @__PURE__ */ jsx(
|
|
409
|
+
"input",
|
|
410
|
+
{
|
|
411
|
+
type: "hidden",
|
|
412
|
+
name: resolvedName,
|
|
413
|
+
value: path.join("/"),
|
|
414
|
+
readOnly: true
|
|
415
|
+
},
|
|
416
|
+
`${pathKey(path)}-${index}`
|
|
417
|
+
)) : null,
|
|
261
418
|
/* @__PURE__ */ jsxs(PopoverContent, { id: panelId, className: "ui-cascader-popover", align: "start", children: [
|
|
262
419
|
showSearch && /* @__PURE__ */ jsx(Command, { shouldFilter: false, children: /* @__PURE__ */ jsx(
|
|
263
420
|
CommandInput,
|
|
@@ -273,7 +430,7 @@ function Cascader({
|
|
|
273
430
|
className: "ui-cascader-panel",
|
|
274
431
|
role: "listbox",
|
|
275
432
|
"aria-multiselectable": multiple ? true : void 0,
|
|
276
|
-
children: searchResults.length === 0 ? /* @__PURE__ */ jsx("p", { className: "ui-cascader-empty", children: t("dataEntry.cascader.empty") }) : searchResults.map(({ path, labels }) => {
|
|
433
|
+
children: searchResults.length === 0 ? /* @__PURE__ */ jsx("p", { className: "ui-cascader-empty", children: notFoundContent ?? t("dataEntry.cascader.empty") }) : searchResults.map(({ path, labels }) => {
|
|
277
434
|
const label = labels.join(" / ");
|
|
278
435
|
const selected = multiple ? pathInValues(path, multiValue) : pathsEqual(path, singleValue);
|
|
279
436
|
return /* @__PURE__ */ jsxs(
|
|
@@ -307,14 +464,21 @@ function Cascader({
|
|
|
307
464
|
) }) : renderCascadeColumns()
|
|
308
465
|
] })
|
|
309
466
|
] }),
|
|
310
|
-
/* @__PURE__ */ jsx("div", { className: "ui-control-affix ui-cascader-affix", children:
|
|
467
|
+
/* @__PURE__ */ jsx("div", { className: "ui-control-affix ui-cascader-affix", children: loading ? /* @__PURE__ */ jsx(
|
|
468
|
+
Loader2,
|
|
469
|
+
{
|
|
470
|
+
"data-slot": "cascader-loading",
|
|
471
|
+
className: "ui-control-affix-icon ui-control-affix-indicator animate-spin",
|
|
472
|
+
"aria-hidden": "true"
|
|
473
|
+
}
|
|
474
|
+
) : showClear ? /* @__PURE__ */ jsx(
|
|
311
475
|
"button",
|
|
312
476
|
{
|
|
313
477
|
type: "button",
|
|
314
|
-
"aria-label":
|
|
478
|
+
"aria-label": clearControl.label,
|
|
315
479
|
className: "ui-control-affix-action",
|
|
316
480
|
onClick: clearValue,
|
|
317
|
-
children: /* @__PURE__ */ jsx(X, { className: "ui-control-affix-icon", "aria-hidden": "true" })
|
|
481
|
+
children: clearControl.clearIcon ?? /* @__PURE__ */ jsx(X, { className: "ui-control-affix-icon", "aria-hidden": "true" })
|
|
318
482
|
}
|
|
319
483
|
) : /* @__PURE__ */ jsx(
|
|
320
484
|
ChevronsUpDown,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ColorPickerProp } from "../../props/components/data-entry.prop.js";
|
|
3
3
|
export type { ColorPickerProp, ColorPickerProp as ColorPickerProps, } from "../../props/components/data-entry.prop.js";
|
|
4
|
-
export declare function ColorPicker({ value, onValueChange, disabled, className, id, showHexInput, ...ariaProps }: ColorPickerProp): React.JSX.Element;
|
|
4
|
+
export declare function ColorPicker({ value: valueProp, defaultValue, onValueChange, disabled, name, className, id, showHexInput, ...ariaProps }: ColorPickerProp): React.JSX.Element;
|