@godxjp/ui 19.6.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 +14 -3
- package/dist/components/data-display/card.js +22 -4
- package/dist/components/data-display/code-block.js +6 -2
- package/dist/components/data-display/collapsible.d.ts +23 -4
- package/dist/components/data-display/collapsible.js +119 -4
- 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 +5 -1
- package/dist/components/data-display/index.js +4 -0
- package/dist/components/data-display/legend.d.ts +15 -0
- package/dist/components/data-display/legend.js +11 -0
- package/dist/components/data-display/list-row.d.ts +10 -1
- package/dist/components/data-display/list-row.js +8 -2
- package/dist/components/data-display/popover.d.ts +60 -7
- package/dist/components/data-display/popover.js +268 -39
- package/dist/components/data-display/progress.d.ts +50 -2
- package/dist/components/data-display/progress.js +57 -9
- 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 +79 -33
- package/dist/components/data-entry/cascader.d.ts +1 -1
- package/dist/components/data-entry/cascader.js +188 -24
- package/dist/components/data-entry/checkbox.d.ts +19 -6
- package/dist/components/data-entry/checkbox.js +55 -16
- package/dist/components/data-entry/choice-option.d.ts +1 -1
- 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 +2 -2
- package/dist/components/data-entry/date-range-picker.js +278 -140
- package/dist/components/data-entry/field.js +0 -1
- 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 +5 -3
- 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/label.d.ts +3 -2
- package/dist/components/data-entry/label.js +23 -10
- package/dist/components/data-entry/month-picker.d.ts +2 -2
- package/dist/components/data-entry/month-picker.js +47 -10
- package/dist/components/data-entry/month-range-picker.d.ts +2 -2
- 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 +99 -31
- package/dist/components/data-entry/tree-select-strategy.d.ts +1 -1
- package/dist/components/data-entry/tree-select.d.ts +1 -1
- package/dist/components/data-entry/tree-select.js +197 -92
- package/dist/components/data-entry/tree-utils.d.ts +1 -1
- 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 +482 -117
- package/dist/components/feedback/dialog.d.ts +105 -38
- package/dist/components/feedback/dialog.js +268 -193
- package/dist/components/feedback/overlay-close-focus.d.ts +31 -0
- package/dist/components/feedback/overlay-close-focus.js +31 -0
- package/dist/components/feedback/overlay-header-tone.d.ts +1 -1
- package/dist/components/feedback/sheet.d.ts +53 -11
- package/dist/components/feedback/sheet.js +150 -81
- package/dist/components/feedback/tooltip.d.ts +51 -7
- package/dist/components/feedback/tooltip.js +107 -25
- package/dist/components/general/button.d.ts +1 -1
- package/dist/components/general/button.js +7 -3
- package/dist/components/general/index.d.ts +1 -0
- package/dist/components/general/index.js +2 -0
- package/dist/components/general/logo.d.ts +17 -0
- package/dist/components/general/logo.js +22 -16
- 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 +3 -1
- package/dist/components/layout/app-shell.js +69 -12
- package/dist/components/layout/aspect-ratio.js +0 -1
- package/dist/components/layout/auth-divider.js +0 -1
- 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 +41 -3
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +5 -1
- package/dist/components/layout/nav-surface.d.ts +26 -0
- package/dist/components/layout/nav-surface.js +17 -0
- package/dist/components/layout/org-switcher.d.ts +5 -1
- package/dist/components/layout/org-switcher.js +25 -4
- 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/separator.js +0 -1
- package/dist/components/layout/sidebar.js +4 -1
- package/dist/components/layout/split-pane.d.ts +14 -1
- package/dist/components/layout/split-pane.js +26 -13
- package/dist/components/layout/topbar-item.d.ts +3 -0
- package/dist/components/layout/topbar-item.js +19 -5
- package/dist/components/layout/topbar.d.ts +1 -1
- package/dist/components/layout/topbar.js +27 -6
- package/dist/components/navigation/app-setting-picker.js +21 -2
- package/dist/components/navigation/app-setting-toggle.d.ts +16 -0
- package/dist/components/navigation/app-setting-toggle.js +96 -0
- package/dist/components/navigation/dropdown-menu.d.ts +227 -18
- package/dist/components/navigation/dropdown-menu.js +402 -118
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.js +2 -0
- package/dist/components/navigation/pagination-utils.d.ts +2 -1
- 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 +29 -16
- package/dist/components/navigation/tabs.js +374 -144
- package/dist/components/ui/accordion.d.ts +50 -5
- package/dist/components/ui/accordion.js +239 -33
- package/dist/components/ui/aspect-ratio.d.ts +23 -2
- package/dist/components/ui/aspect-ratio.js +15 -13
- package/dist/components/ui/avatar.d.ts +29 -4
- package/dist/components/ui/avatar.js +111 -25
- package/dist/components/ui/hover-card.d.ts +42 -4
- package/dist/components/ui/hover-card.js +183 -27
- package/dist/components/ui/input-otp.d.ts +26 -28
- package/dist/components/ui/input-otp.js +50 -7
- package/dist/components/ui/label.js +0 -1
- 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 +12 -3
- package/dist/components/ui/segmented.js +17 -2
- package/dist/components/ui/separator.d.ts +12 -2
- package/dist/components/ui/separator.js +30 -9
- package/dist/components/ui/tag-input.d.ts +45 -0
- package/dist/components/ui/tag-input.js +109 -27
- package/dist/components/ui/toggle-group.d.ts +50 -5
- package/dist/components/ui/toggle-group.js +79 -20
- package/dist/components/ui/toggle.d.ts +31 -5
- package/dist/components/ui/toggle.js +42 -3
- 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 +64 -5
- package/dist/i18n/messages/ja.json +64 -5
- package/dist/i18n/messages/vi.json +64 -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/lib/slot.d.ts +32 -0
- package/dist/lib/slot.js +22 -0
- package/dist/lib/variants.d.ts +22 -3
- package/dist/lib/variants.js +56 -1
- package/dist/props/components/app.prop.d.ts +25 -1
- package/dist/props/components/charts.prop.d.ts +21 -0
- package/dist/props/components/data-display.prop.d.ts +72 -4
- package/dist/props/components/data-entry.prop.d.ts +718 -46
- 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 +3 -3
- package/dist/props/components/layout.prop.d.ts +281 -11
- package/dist/props/components/navigation.prop.d.ts +114 -4
- package/dist/props/registry.d.ts +397 -11
- package/dist/props/registry.js +526 -11
- package/dist/props/vocabulary/content.prop.d.ts +1 -1
- package/dist/props/vocabulary/data.prop.d.ts +179 -1
- package/dist/props/vocabulary/index.d.ts +5 -5
- package/dist/props/vocabulary/interaction.prop.d.ts +68 -3
- package/dist/props/vocabulary/layout.prop.d.ts +57 -1
- 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 +657 -15
- package/dist/styles/core.css +5 -2
- package/dist/styles/data-display-layout.css +313 -6
- package/dist/styles/data-entry-layout.css +13 -0
- package/dist/styles/focus-ring.css +4 -0
- package/dist/styles/index.css +5 -2
- package/dist/styles/layout.css +327 -4
- package/dist/styles/navigation-layout.css +227 -0
- package/dist/styles/shell-layout.css +369 -13
- package/dist/styles/table-layout.css +95 -6
- package/dist/styles/text-layout.css +10 -4
- package/dist/tokens/base.css +2 -1
- 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 +20 -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 +53 -3
- package/dist/tokens/components/table.css +14 -0
- package/dist/tokens/foundation.css +2 -0
- package/dist/tokens/semantic/layout.css +9 -0
- package/docs/COMPONENTS.md +9 -3
- package/docs/CONSUMER-RULES.md +13 -0
- package/docs/DESIGN-AUTHORITY.md +145 -83
- package/docs/DEVELOPMENT.md +4 -3
- package/docs/FORMS.md +151 -6
- package/docs/FRAME-COVERAGE-REPORT.md +32 -17
- package/docs/README.md +15 -15
- package/docs/STANDARDS-vocabulary-tokens.md +1 -1
- package/docs/TESTING.md +15 -6
- package/docs/WHAT-BELONGS-HERE.md +179 -0
- 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/legend.tsx +145 -0
- package/docs/data-display/progress.tsx +32 -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/segmented.tsx +1 -1
- package/docs/data-entry/select.tsx +29 -2
- 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/sheet.tsx +1 -1
- 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-arrangements.tsx +225 -0
- package/docs/layout/app-shell.tsx +11 -0
- package/docs/layout/aspect-ratio.tsx +1 -1
- 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 +37 -1
- package/docs/navigation/app-setting-toggle.tsx +111 -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 +28 -8
- package/scripts/_agent-setup.mjs +182 -3
- package/scripts/consumer-rule.md +98 -0
- package/scripts/guinea-pig-skill.md +322 -0
- package/scripts/init-guinea-pig.mjs +84 -0
- package/scripts/postinstall.mjs +13 -2
- package/scripts/ui-audit.mjs +351 -37
- /package/dist/tokens/{antd.generated.css → derived.css} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { padStyle, padStepToken } from "../../lib/variants.js";
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
import { cn } from "../../lib/utils.js";
|
|
4
5
|
const Card = React.forwardRef(
|
|
@@ -74,10 +75,27 @@ const CardFooter = React.forwardRef(
|
|
|
74
75
|
);
|
|
75
76
|
CardFooter.displayName = "CardFooter";
|
|
76
77
|
const CardBar = React.forwardRef(
|
|
77
|
-
({ className, children, extra, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
({ className, children, extra, pad, padRaw, gap, surface, border, style, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
"data-surface": surface,
|
|
83
|
+
"data-border": border,
|
|
84
|
+
"data-pad-raw": padRaw === void 0 ? void 0 : "",
|
|
85
|
+
style: {
|
|
86
|
+
...style,
|
|
87
|
+
...padStyle(pad, padRaw),
|
|
88
|
+
...gap === void 0 ? void 0 : { gap: padStepToken(gap) }
|
|
89
|
+
},
|
|
90
|
+
"data-slot": "card-bar",
|
|
91
|
+
className: cn("ui-card-bar", className),
|
|
92
|
+
...props,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "card-bar-main", className: "ui-card-bar-main", children }),
|
|
95
|
+
extra != null ? /* @__PURE__ */ jsx("div", { "data-slot": "card-bar-extra", className: "ui-card-bar-extra", children: extra }) : null
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
)
|
|
81
99
|
);
|
|
82
100
|
CardBar.displayName = "CardBar";
|
|
83
101
|
function getDeltaTone(delta, inverse) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cn } from "../../lib/utils.js";
|
|
4
|
-
const CodeBlock = React.forwardRef(function CodeBlock2({ children, wrap = true, maxHeight = "none", size = "sm", language, className, ...rest }, ref) {
|
|
4
|
+
const CodeBlock = React.forwardRef(function CodeBlock2({ children, wrap = true, maxHeight = "none", size = "sm", language, className, style, ...rest }, ref) {
|
|
5
5
|
const scrolls = maxHeight !== "none" || !wrap;
|
|
6
6
|
return /* @__PURE__ */ jsx(
|
|
7
7
|
"pre",
|
|
@@ -9,7 +9,11 @@ const CodeBlock = React.forwardRef(function CodeBlock2({ children, wrap = true,
|
|
|
9
9
|
ref,
|
|
10
10
|
"data-slot": "code-block",
|
|
11
11
|
"data-wrap": wrap ? void 0 : "false",
|
|
12
|
-
"data-max-height": maxHeight === "none" ? void 0
|
|
12
|
+
"data-max-height": typeof maxHeight === "string" && maxHeight !== "none" ? maxHeight : void 0,
|
|
13
|
+
style: {
|
|
14
|
+
...style,
|
|
15
|
+
...typeof maxHeight === "object" ? { maxBlockSize: maxHeight.value, overflow: "auto" } : void 0
|
|
16
|
+
},
|
|
13
17
|
"data-size": size === "sm" ? void 0 : size,
|
|
14
18
|
"data-language": language,
|
|
15
19
|
tabIndex: scrolls ? 0 : void 0,
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface CollapsibleProps extends React.ComponentPropsWithRef<"div"> {
|
|
3
|
+
/** Trạng thái mở, có kiểm soát. */
|
|
4
|
+
open?: boolean;
|
|
5
|
+
/** Trạng thái mở ban đầu khi không kiểm soát. */
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
/** Gọi khi trạng thái mở/đóng đổi. */
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
/** Khoá trigger; `data-disabled` được phát ra để CSS bám vào. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function Collapsible({ open, defaultOpen, onOpenChange, disabled, children, ref, ...props }: CollapsibleProps): React.JSX.Element;
|
|
13
|
+
interface CollapsibleTriggerProps extends React.ComponentPropsWithRef<"button"> {
|
|
14
|
+
/** Mượn thẻ của con thay vì dựng `<button>` riêng. */
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function CollapsibleTrigger({ asChild, onClick, disabled, ...props }: CollapsibleTriggerProps): React.JSX.Element;
|
|
18
|
+
interface CollapsibleContentProps extends React.ComponentPropsWithRef<"div"> {
|
|
19
|
+
/** Giữ nội dung trong DOM cả khi đóng. */
|
|
20
|
+
forceMount?: true;
|
|
21
|
+
}
|
|
22
|
+
export declare function CollapsibleContent({ forceMount, children, ref, ...props }: CollapsibleContentProps): React.JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -1,8 +1,123 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { chain, mergeRefs } from "@react-aria/utils";
|
|
5
|
+
import {
|
|
6
|
+
ButtonContext,
|
|
7
|
+
Disclosure,
|
|
8
|
+
DisclosurePanel,
|
|
9
|
+
DisclosureStateContext,
|
|
10
|
+
useSlottedContext
|
|
11
|
+
} from "react-aria-components";
|
|
12
|
+
import { Slot } from "../../lib/slot.js";
|
|
13
|
+
function Collapsible({
|
|
14
|
+
open,
|
|
15
|
+
defaultOpen,
|
|
16
|
+
onOpenChange,
|
|
17
|
+
disabled,
|
|
18
|
+
children,
|
|
19
|
+
ref,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
Disclosure,
|
|
24
|
+
{
|
|
25
|
+
isExpanded: open,
|
|
26
|
+
defaultExpanded: defaultOpen,
|
|
27
|
+
onExpandedChange: onOpenChange,
|
|
28
|
+
isDisabled: disabled,
|
|
29
|
+
render: (racProps, { isExpanded }) => {
|
|
30
|
+
const {
|
|
31
|
+
className: _racClass,
|
|
32
|
+
"data-rac": _rac,
|
|
33
|
+
ref: racRef,
|
|
34
|
+
...rest
|
|
35
|
+
} = racProps;
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
...props,
|
|
40
|
+
...rest,
|
|
41
|
+
ref: mergeRefs(ref, racRef),
|
|
42
|
+
"data-state": isExpanded ? "open" : "closed",
|
|
43
|
+
"data-disabled": disabled ? "" : void 0,
|
|
44
|
+
children
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function CollapsibleTrigger({
|
|
52
|
+
asChild,
|
|
53
|
+
onClick,
|
|
54
|
+
disabled,
|
|
55
|
+
...props
|
|
56
|
+
}) {
|
|
57
|
+
const trigger = useSlottedContext(ButtonContext, "trigger");
|
|
58
|
+
const state = React.useContext(DisclosureStateContext);
|
|
59
|
+
if (!trigger || !state) {
|
|
60
|
+
throw new Error("`CollapsibleTrigger` ph\u1EA3i n\u1EB1m trong `Collapsible`.");
|
|
61
|
+
}
|
|
62
|
+
const isDisabled = disabled ?? trigger.isDisabled ?? false;
|
|
63
|
+
const Comp = asChild ? Slot : "button";
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
Comp,
|
|
66
|
+
{
|
|
67
|
+
type: "button",
|
|
68
|
+
id: trigger.id,
|
|
69
|
+
"aria-controls": state.isExpanded ? trigger["aria-controls"] : void 0,
|
|
70
|
+
"aria-expanded": state.isExpanded,
|
|
71
|
+
"data-state": state.isExpanded ? "open" : "closed",
|
|
72
|
+
"data-disabled": isDisabled ? "" : void 0,
|
|
73
|
+
disabled: isDisabled,
|
|
74
|
+
...props,
|
|
75
|
+
onClick: chain(onClick, () => {
|
|
76
|
+
if (!isDisabled) {
|
|
77
|
+
state.toggle();
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
function CollapsibleContent({
|
|
84
|
+
forceMount,
|
|
85
|
+
children,
|
|
86
|
+
ref,
|
|
87
|
+
...props
|
|
88
|
+
}) {
|
|
89
|
+
const trigger = useSlottedContext(ButtonContext, "trigger");
|
|
90
|
+
const state = React.useContext(DisclosureStateContext);
|
|
91
|
+
if (!state) {
|
|
92
|
+
throw new Error("`CollapsibleContent` ph\u1EA3i n\u1EB1m trong `Collapsible`.");
|
|
93
|
+
}
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
DisclosurePanel,
|
|
96
|
+
{
|
|
97
|
+
render: (racProps) => {
|
|
98
|
+
const {
|
|
99
|
+
className: _racClass,
|
|
100
|
+
"data-rac": _rac,
|
|
101
|
+
children: _racChildren,
|
|
102
|
+
ref: racRef,
|
|
103
|
+
...rest
|
|
104
|
+
} = racProps;
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
...props,
|
|
109
|
+
...rest,
|
|
110
|
+
ref: mergeRefs(ref, racRef),
|
|
111
|
+
"data-state": state.isExpanded ? "open" : "closed",
|
|
112
|
+
"data-disabled": trigger?.isDisabled ? "" : void 0,
|
|
113
|
+
children: state.isExpanded || forceMount ? children : null
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
children: null
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
6
121
|
export {
|
|
7
122
|
Collapsible,
|
|
8
123
|
CollapsibleContent,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { flexRender, type ColumnVisibilityState, type OnChangeFn, type PaginationState } from "@tanstack/react-table";
|
|
3
|
-
import type { BreakpointProp, ColumnDefProp, DensityProp, SortStateProp, TablePresetProp } from "../../props/vocabulary/index.js";
|
|
3
|
+
import type { BreakpointProp, ColumnDefProp, DensityProp, OnColumnFilterChangeProp, OnRowProp, SortDirectionProp, SortStateProp, TableExpandableProp, TablePaginationProp, TablePresetProp, TableRowSelectionProp, TableScrollProp, TableStickyProp, TableSummaryProp } from "../../props/vocabulary/index.js";
|
|
4
4
|
export type Density = DensityProp;
|
|
5
5
|
/**
|
|
6
6
|
* Lean column definition — the simple, common-case column API. `render` shapes a cell; `sortable`
|
|
@@ -25,8 +25,14 @@ interface DataTableProps<T> {
|
|
|
25
25
|
/** Global search term, surfaced by DataTable.Search. */
|
|
26
26
|
globalFilter?: string;
|
|
27
27
|
onGlobalFilterChange?: (next: string) => void;
|
|
28
|
-
/**
|
|
29
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Numbered-pagination state, surfaced by DataTable.Pagination. THREE shapes, all accepted:
|
|
30
|
+
* the TanStack `{ pageIndex, pageSize }` this prop has always taken; antd's
|
|
31
|
+
* `TablePaginationConfig` object (`{ current, pageSize, total, pageSizeOptions,
|
|
32
|
+
* showSizeChanger, onChange }`, 1-based like antd); and `false`, which hides the pager
|
|
33
|
+
* entirely (antd `pagination={false}`).
|
|
34
|
+
*/
|
|
35
|
+
pagination?: PaginationState | TablePaginationProp | false;
|
|
30
36
|
onPaginationChange?: OnChangeFn<PaginationState>;
|
|
31
37
|
/** Total server row count (manual pagination) — drives the page count. */
|
|
32
38
|
rowCount?: number;
|
|
@@ -76,10 +82,39 @@ interface DataTableProps<T> {
|
|
|
76
82
|
* classes are appended last, so they win over the built-in hover/selected fills.
|
|
77
83
|
*/
|
|
78
84
|
rowClassName?: (row: T) => string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Full row-selection configuration (antd `rowSelection`). Supersedes — and can be mixed with —
|
|
87
|
+
* `selectable` / `selected` / `onSelectChange`, which drive the same state.
|
|
88
|
+
*/
|
|
89
|
+
rowSelection?: TableRowSelectionProp<T>;
|
|
90
|
+
/** Expandable detail rows (antd `expandable`). */
|
|
91
|
+
expandable?: TableExpandableProp<T>;
|
|
92
|
+
/** Footer totals row (antd `summary`) — rendered in a real `<tfoot>` so it survives sorting. */
|
|
93
|
+
summary?: TableSummaryProp<T>;
|
|
94
|
+
/** Scroll envelope (antd `scroll`) — `x` a minimum inline size, `y` a maximum body block size. */
|
|
95
|
+
scroll?: TableScrollProp;
|
|
96
|
+
/**
|
|
97
|
+
* Sticky header (antd `sticky`). Supersedes `stickyHeader` when given; the object form carries
|
|
98
|
+
* the `offsetHeader` a page-level fixed topbar needs.
|
|
99
|
+
*/
|
|
100
|
+
sticky?: TableStickyProp;
|
|
101
|
+
/** Per-row DOM props merged onto the `<tr>` (antd `onRow`). */
|
|
102
|
+
onRow?: OnRowProp<T>;
|
|
103
|
+
/** Draw the outer frame and the vertical rules between columns (antd `bordered`). */
|
|
104
|
+
bordered?: boolean;
|
|
105
|
+
/** Explain the next sort step in a tooltip on every sortable header (antd `showSorterTooltip`). */
|
|
106
|
+
showSorterTooltip?: boolean;
|
|
107
|
+
/** Table-wide sort cycle (antd `sortDirections`); a column's own value wins. */
|
|
108
|
+
sortDirections?: SortDirectionProp[];
|
|
109
|
+
/**
|
|
110
|
+
* Column filters changed (antd hands the same map to `onChange`). Pair it with a column's
|
|
111
|
+
* `filteredValue` to drive filtering from a server query.
|
|
112
|
+
*/
|
|
113
|
+
onFilterChange?: OnColumnFilterChangeProp;
|
|
79
114
|
className?: string;
|
|
80
115
|
children?: React.ReactNode;
|
|
81
116
|
}
|
|
82
|
-
export declare function DataTable<T>({ data, columns, getRowId, selectable, selected: controlledSelected, onSelectChange, onRowClick, density: controlledDensity, onDensityChange, sort, onSortChange, globalFilter: controlledGlobalFilter, onGlobalFilterChange, pagination:
|
|
117
|
+
export declare function DataTable<T>({ data, columns, getRowId, selectable, selected: controlledSelected, onSelectChange, onRowClick, density: controlledDensity, onDensityChange, sort, onSortChange, globalFilter: controlledGlobalFilter, onGlobalFilterChange, pagination: paginationProp, onPaginationChange, rowCount, columnVisibility: controlledVisibility, onColumnVisibilityChange, manualSorting, manualFiltering, manualPagination, loading, empty, error, denied, onRetry, striped, hoverable, stickyHeader, preset, collapseBelow, rowClassName, rowSelection, expandable, summary, scroll, sticky, onRow, bordered, showSorterTooltip, sortDirections, onFilterChange, className, children, }: DataTableProps<T>): React.JSX.Element;
|
|
83
118
|
export declare namespace DataTable {
|
|
84
119
|
var Toolbar: ({ children, className, }: {
|
|
85
120
|
children?: React.ReactNode;
|