@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
package/dist/form/form-root.js
CHANGED
|
@@ -1,46 +1,165 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import { FormProvider } from "react-hook-form";
|
|
5
|
+
import { Alert, AlertDescription } from "../components/feedback/alert.js";
|
|
6
|
+
import { ResponsiveGrid } from "../components/layout/responsive-grid.js";
|
|
7
|
+
import { useTranslation } from "../i18n/use-translation.js";
|
|
4
8
|
import { cn } from "../lib/utils.js";
|
|
5
|
-
import {
|
|
9
|
+
import { Form } from "../components/data-entry/form.js";
|
|
10
|
+
import { FormAdapterContext, FormOptionsContext } from "./form-context.js";
|
|
11
|
+
function collectErrorNames(errors, prefix = "", out = []) {
|
|
12
|
+
if (!errors || typeof errors !== "object") return out;
|
|
13
|
+
for (const [key, value] of Object.entries(errors)) {
|
|
14
|
+
if (!value || typeof value !== "object") continue;
|
|
15
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
16
|
+
if ("message" in value || "type" in value) out.push(path);
|
|
17
|
+
else collectErrorNames(value, path, out);
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
function scrollFirstErrorIntoView(formEl, errors) {
|
|
22
|
+
if (!formEl) return;
|
|
23
|
+
const names = new Set(collectErrorNames(errors));
|
|
24
|
+
if (names.size === 0) return;
|
|
25
|
+
const control = Array.from(formEl.querySelectorAll("[data-field]")).find(
|
|
26
|
+
(el) => names.has(el.dataset.field ?? "")
|
|
27
|
+
);
|
|
28
|
+
if (!control) return;
|
|
29
|
+
const focusTarget = control.matches("input, select, textarea, button, [tabindex]") ? control : control.querySelector("input, select, textarea, button, [tabindex]");
|
|
30
|
+
focusTarget?.focus({ preventScroll: true });
|
|
31
|
+
const target = control.closest('[data-slot="form-field"]') ?? control;
|
|
32
|
+
if (typeof target.scrollIntoView !== "function") return;
|
|
33
|
+
const reduceMotion = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
34
|
+
target.scrollIntoView({ block: "center", behavior: reduceMotion ? "auto" : "smooth" });
|
|
35
|
+
}
|
|
36
|
+
function afterPaint(run) {
|
|
37
|
+
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => run());
|
|
38
|
+
else setTimeout(run, 0);
|
|
39
|
+
}
|
|
6
40
|
function FormRoot({
|
|
7
41
|
form,
|
|
8
42
|
adapter,
|
|
9
43
|
onSubmit,
|
|
44
|
+
onSubmitFailed,
|
|
45
|
+
onSubmitError,
|
|
46
|
+
onReset,
|
|
47
|
+
scrollToFirstError = true,
|
|
48
|
+
disabled = false,
|
|
49
|
+
layout,
|
|
50
|
+
labelWidth,
|
|
51
|
+
controlWidth,
|
|
52
|
+
labelAlign,
|
|
53
|
+
collapseBelow,
|
|
54
|
+
density,
|
|
55
|
+
columns,
|
|
56
|
+
requiredMark,
|
|
57
|
+
errors,
|
|
10
58
|
children,
|
|
11
59
|
className,
|
|
12
60
|
id
|
|
13
61
|
}) {
|
|
62
|
+
const formRef = React.useRef(null);
|
|
63
|
+
const { t } = useTranslation();
|
|
64
|
+
const pending = React.useRef(false);
|
|
65
|
+
const [submitting, setSubmitting] = React.useState(false);
|
|
66
|
+
const [submitFailed, setSubmitFailed] = React.useState(false);
|
|
67
|
+
const options = React.useMemo(() => ({ disabled, submitting }), [disabled, submitting]);
|
|
68
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
submitFailed && /* @__PURE__ */ jsx(Alert, { tone: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: t("dataEntry.form.submitFailed") }) }),
|
|
70
|
+
columns ? /* @__PURE__ */ jsx(ResponsiveGrid, { columns, children }) : children
|
|
71
|
+
] });
|
|
72
|
+
const submit = async (work) => {
|
|
73
|
+
if (disabled || pending.current || adapter?.isSubmitting) return;
|
|
74
|
+
pending.current = true;
|
|
75
|
+
setSubmitting(true);
|
|
76
|
+
setSubmitFailed(false);
|
|
77
|
+
try {
|
|
78
|
+
await work();
|
|
79
|
+
} catch (error) {
|
|
80
|
+
setSubmitFailed(true);
|
|
81
|
+
onSubmitError?.(error);
|
|
82
|
+
} finally {
|
|
83
|
+
pending.current = false;
|
|
84
|
+
setSubmitting(false);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const layoutShell = layout !== void 0 || labelWidth !== void 0 || controlWidth !== void 0 || labelAlign !== void 0 || collapseBelow !== void 0 || density !== void 0 || requiredMark !== void 0 || errors !== void 0;
|
|
88
|
+
const formClassName = layoutShell ? className : cn("ui-stack-md", className);
|
|
89
|
+
const withLayout = (node) => layoutShell ? /* @__PURE__ */ jsx(
|
|
90
|
+
Form,
|
|
91
|
+
{
|
|
92
|
+
asChild: true,
|
|
93
|
+
layout,
|
|
94
|
+
labelWidth,
|
|
95
|
+
controlWidth,
|
|
96
|
+
labelAlign,
|
|
97
|
+
collapseBelow,
|
|
98
|
+
density,
|
|
99
|
+
requiredMark,
|
|
100
|
+
disabled,
|
|
101
|
+
errors,
|
|
102
|
+
children: node
|
|
103
|
+
}
|
|
104
|
+
) : node;
|
|
14
105
|
if (adapter) {
|
|
15
|
-
return /* @__PURE__ */ jsx(FormAdapterContext.Provider, { value: adapter, children: /* @__PURE__ */ jsx(
|
|
106
|
+
return /* @__PURE__ */ jsx(FormAdapterContext.Provider, { value: adapter, children: /* @__PURE__ */ jsx(FormOptionsContext.Provider, { value: options, children: withLayout(
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"form",
|
|
109
|
+
{
|
|
110
|
+
ref: formRef,
|
|
111
|
+
id,
|
|
112
|
+
className: formClassName,
|
|
113
|
+
onSubmit: (event) => {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
void submit(() => onSubmit(adapter.getValues?.() ?? {}));
|
|
116
|
+
},
|
|
117
|
+
onReset: (event) => {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
if (pending.current) return;
|
|
120
|
+
setSubmitFailed(false);
|
|
121
|
+
adapter.reset?.();
|
|
122
|
+
onReset?.();
|
|
123
|
+
},
|
|
124
|
+
noValidate: true,
|
|
125
|
+
children: content
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
) }) });
|
|
129
|
+
}
|
|
130
|
+
if (!form) {
|
|
131
|
+
throw new Error("FormRoot requires either a `form` (react-hook-form) or an `adapter` prop.");
|
|
132
|
+
}
|
|
133
|
+
const handleInvalid = (fieldErrors) => {
|
|
134
|
+
onSubmitFailed?.(fieldErrors);
|
|
135
|
+
if (scrollToFirstError)
|
|
136
|
+
afterPaint(() => scrollFirstErrorIntoView(formRef.current, fieldErrors));
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(FormOptionsContext.Provider, { value: options, children: withLayout(
|
|
139
|
+
/* @__PURE__ */ jsx(
|
|
16
140
|
"form",
|
|
17
141
|
{
|
|
142
|
+
ref: formRef,
|
|
18
143
|
id,
|
|
19
|
-
className:
|
|
144
|
+
className: formClassName,
|
|
20
145
|
onSubmit: (event) => {
|
|
21
146
|
event.preventDefault();
|
|
22
|
-
void
|
|
147
|
+
void submit(
|
|
148
|
+
() => form.handleSubmit((values) => onSubmit(values), handleInvalid)(event)
|
|
149
|
+
);
|
|
150
|
+
},
|
|
151
|
+
onReset: (event) => {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
if (pending.current) return;
|
|
154
|
+
setSubmitFailed(false);
|
|
155
|
+
form.reset();
|
|
156
|
+
onReset?.();
|
|
23
157
|
},
|
|
24
158
|
noValidate: true,
|
|
25
|
-
children
|
|
159
|
+
children: content
|
|
26
160
|
}
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
if (!form) {
|
|
30
|
-
throw new Error("FormRoot requires either a `form` (react-hook-form) or an `adapter` prop.");
|
|
31
|
-
}
|
|
32
|
-
return /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsx(
|
|
33
|
-
"form",
|
|
34
|
-
{
|
|
35
|
-
id,
|
|
36
|
-
className: cn("ui-stack-md", className),
|
|
37
|
-
onSubmit: (event) => {
|
|
38
|
-
void form.handleSubmit((values) => onSubmit(values))(event);
|
|
39
|
-
},
|
|
40
|
-
noValidate: true,
|
|
41
|
-
children
|
|
42
|
-
}
|
|
43
|
-
) });
|
|
161
|
+
)
|
|
162
|
+
) }) });
|
|
44
163
|
}
|
|
45
164
|
export {
|
|
46
165
|
FormRoot
|
package/dist/form/index.d.ts
CHANGED
|
@@ -4,5 +4,7 @@ export { FormRoot } from "./form-root.js";
|
|
|
4
4
|
export type { FormRootProp } from "./form-root.js";
|
|
5
5
|
export { FormFieldControl } from "./form-field-control.js";
|
|
6
6
|
export type { FormFieldControlProp } from "./form-field-control.js";
|
|
7
|
-
export {
|
|
7
|
+
export { FormFieldArray } from "./form-field-array.js";
|
|
8
|
+
export type { FormFieldArrayProp } from "./form-field-array.js";
|
|
9
|
+
export { useFormSubmitting, useFormAdapter, useFormDisabled, useFormInstance, useFormWatch, } from "./form-context.js";
|
|
8
10
|
export type { ZodSchemaProp, FieldErrorMessageProp, FormStateAdapter, } from "../props/components/form.prop.js";
|
package/dist/form/index.js
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { useZodForm } from "./use-zod-form.js";
|
|
2
2
|
import { FormRoot } from "./form-root.js";
|
|
3
3
|
import { FormFieldControl } from "./form-field-control.js";
|
|
4
|
-
import {
|
|
4
|
+
import { FormFieldArray } from "./form-field-array.js";
|
|
5
|
+
import {
|
|
6
|
+
useFormSubmitting,
|
|
7
|
+
useFormAdapter,
|
|
8
|
+
useFormDisabled,
|
|
9
|
+
useFormInstance,
|
|
10
|
+
useFormWatch
|
|
11
|
+
} from "./form-context.js";
|
|
5
12
|
export {
|
|
13
|
+
FormFieldArray,
|
|
6
14
|
FormFieldControl,
|
|
7
15
|
FormRoot,
|
|
8
16
|
useFormAdapter,
|
|
17
|
+
useFormDisabled,
|
|
18
|
+
useFormInstance,
|
|
9
19
|
useFormSubmitting,
|
|
20
|
+
useFormWatch,
|
|
10
21
|
useZodForm
|
|
11
22
|
};
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"datePicker": {
|
|
25
25
|
"placeholder": "Select date",
|
|
26
|
-
"openCalendar": "Open calendar"
|
|
26
|
+
"openCalendar": "Open calendar",
|
|
27
|
+
"quarter": "Q{quarter}"
|
|
27
28
|
},
|
|
28
29
|
"dateRangePicker": {
|
|
29
30
|
"placeholder": "Select date range",
|
|
@@ -39,7 +40,10 @@
|
|
|
39
40
|
"openPicker": "Open time picker",
|
|
40
41
|
"meridiem": "AM/PM",
|
|
41
42
|
"am": "AM",
|
|
42
|
-
"pm": "PM"
|
|
43
|
+
"pm": "PM",
|
|
44
|
+
"now": "Now",
|
|
45
|
+
"confirm": "OK",
|
|
46
|
+
"second": "Second"
|
|
43
47
|
},
|
|
44
48
|
"searchInput": {
|
|
45
49
|
"placeholder": "Search…"
|
|
@@ -55,7 +59,7 @@
|
|
|
55
59
|
"upload": {
|
|
56
60
|
"dropzoneLabel": "Upload files",
|
|
57
61
|
"dropzoneHint": "Drag and drop files here, or click to browse",
|
|
58
|
-
"dropzoneMeta": "
|
|
62
|
+
"dropzoneMeta": "Selected files appear here.",
|
|
59
63
|
"buttonLabel": "Choose file",
|
|
60
64
|
"addImage": "Add image",
|
|
61
65
|
"uploading": "Uploading…",
|
|
@@ -75,7 +79,17 @@
|
|
|
75
79
|
"statusFailed": "{count} upload(s) failed",
|
|
76
80
|
"removeImage": "Remove image",
|
|
77
81
|
"removeFile": "Remove {name}",
|
|
78
|
-
"cropDescription": "Drag the zoom slider, then save to crop your photo to a square."
|
|
82
|
+
"cropDescription": "Drag the zoom slider, then save to crop your photo to a square.",
|
|
83
|
+
"preview": "Preview",
|
|
84
|
+
"download": "Download",
|
|
85
|
+
"retry": "Retry",
|
|
86
|
+
"start": "Upload",
|
|
87
|
+
"cancel": "Cancel",
|
|
88
|
+
"rejectAccept": "{name}: file type is not allowed.",
|
|
89
|
+
"rejectSize": "{name}: file is too large.",
|
|
90
|
+
"rejectCount": "{name}: file limit reached.",
|
|
91
|
+
"rejectBeforeUpload": "{name}: file validation failed.",
|
|
92
|
+
"readFailed": "Could not read the selected folder."
|
|
79
93
|
},
|
|
80
94
|
"cascader": {
|
|
81
95
|
"placeholder": "Select…",
|
|
@@ -109,6 +123,9 @@
|
|
|
109
123
|
"empty": "No results",
|
|
110
124
|
"error": "Couldn’t load options"
|
|
111
125
|
},
|
|
126
|
+
"selection": {
|
|
127
|
+
"overflow": "+{count}"
|
|
128
|
+
},
|
|
112
129
|
"monthPicker": {
|
|
113
130
|
"openGrid": "Open month grid",
|
|
114
131
|
"previousYear": "Previous year",
|
|
@@ -135,6 +152,14 @@
|
|
|
135
152
|
},
|
|
136
153
|
"formErrors": {
|
|
137
154
|
"title": "Please review the following errors"
|
|
155
|
+
},
|
|
156
|
+
"form": {
|
|
157
|
+
"optional": "(optional)",
|
|
158
|
+
"success": "Valid",
|
|
159
|
+
"warning": "Please review",
|
|
160
|
+
"error": "Invalid",
|
|
161
|
+
"validating": "Validating",
|
|
162
|
+
"submitFailed": "Could not submit the form. Please try again."
|
|
138
163
|
}
|
|
139
164
|
},
|
|
140
165
|
"feedback": {
|
|
@@ -157,6 +182,7 @@
|
|
|
157
182
|
},
|
|
158
183
|
"appShell": {
|
|
159
184
|
"sidebarLabel": "Sidebar",
|
|
185
|
+
"navRailLabel": "Workspaces",
|
|
160
186
|
"headerLabel": "Header",
|
|
161
187
|
"mainLabel": "Main content",
|
|
162
188
|
"footerLabel": "Footer",
|
|
@@ -252,6 +278,10 @@
|
|
|
252
278
|
"denied": "You do not have permission to view this matrix",
|
|
253
279
|
"deniedDescription": "Ask an administrator to grant you access.",
|
|
254
280
|
"loading": "Loading permissions…"
|
|
281
|
+
},
|
|
282
|
+
"progress": {
|
|
283
|
+
"ariaLabel": "Progress",
|
|
284
|
+
"breakdownSeparator": ", "
|
|
255
285
|
}
|
|
256
286
|
},
|
|
257
287
|
"ui": {
|
|
@@ -285,8 +315,13 @@
|
|
|
285
315
|
}
|
|
286
316
|
},
|
|
287
317
|
"navigation": {
|
|
318
|
+
"tabs": {
|
|
319
|
+
"addTab": "Add tab",
|
|
320
|
+
"removeTab": "Close tab"
|
|
321
|
+
},
|
|
288
322
|
"steps": {
|
|
289
323
|
"ariaLabel": "Progress",
|
|
324
|
+
"percentLabel": "Current step progress",
|
|
290
325
|
"status": {
|
|
291
326
|
"wait": "Waiting",
|
|
292
327
|
"process": "Current step",
|
|
@@ -327,6 +362,7 @@
|
|
|
327
362
|
"page": "Page {page}",
|
|
328
363
|
"pageSize": "Page size",
|
|
329
364
|
"pageSizeTrigger": "{size} / page",
|
|
365
|
+
"jumpTo": "Go to page",
|
|
330
366
|
"pageSizeOption": "{size} / page",
|
|
331
367
|
"total": {
|
|
332
368
|
"one": "Total {total} item",
|
|
@@ -359,6 +395,9 @@
|
|
|
359
395
|
"logistics": "Logistics Teal",
|
|
360
396
|
"partner": "Partner Orange",
|
|
361
397
|
"slate": "HQ Slate"
|
|
398
|
+
},
|
|
399
|
+
"settingToggle": {
|
|
400
|
+
"label": "{setting}: {value}"
|
|
362
401
|
}
|
|
363
402
|
},
|
|
364
403
|
"locale": {
|
|
@@ -402,7 +441,19 @@
|
|
|
402
441
|
"error": "Couldn't load this list",
|
|
403
442
|
"errorDescription": "The data could not be retrieved. Try again in a moment.",
|
|
404
443
|
"denied": "You don't have access to this list",
|
|
405
|
-
"deniedDescription": "Ask an administrator to grant you permission to view these records."
|
|
444
|
+
"deniedDescription": "Ask an administrator to grant you permission to view these records.",
|
|
445
|
+
"selectInvert": "Invert selection",
|
|
446
|
+
"selectNone": "Clear selection",
|
|
447
|
+
"selectionMenu": "Selection options",
|
|
448
|
+
"filterColumn": "Filter",
|
|
449
|
+
"filterReset": "Reset filter",
|
|
450
|
+
"expandColumn": "Expand",
|
|
451
|
+
"expandRow": "Expand row",
|
|
452
|
+
"collapseRow": "Collapse row",
|
|
453
|
+
"sortAscending": "Sort ascending",
|
|
454
|
+
"sortDescending": "Sort descending",
|
|
455
|
+
"sortCancel": "Cancel sort",
|
|
456
|
+
"selectColumn": "Select"
|
|
406
457
|
},
|
|
407
458
|
"dataGrid": {
|
|
408
459
|
"search": "Search",
|
|
@@ -470,5 +521,13 @@
|
|
|
470
521
|
"summaryPie": "Pie chart with {slices} slices",
|
|
471
522
|
"summaryTrend": "Bar trend with {points} data points",
|
|
472
523
|
"trendCurrent": "current"
|
|
524
|
+
},
|
|
525
|
+
"rangeTimeline": {
|
|
526
|
+
"outsideRange": "Outside the visible range",
|
|
527
|
+
"schedule": "Schedule"
|
|
528
|
+
},
|
|
529
|
+
"textExamples": {
|
|
530
|
+
"preservedText": "Plain text",
|
|
531
|
+
"sampleText": "First line\n Indented line\n\nLast line"
|
|
473
532
|
}
|
|
474
533
|
}
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"datePicker": {
|
|
25
25
|
"placeholder": "日付を選択",
|
|
26
|
-
"openCalendar": "カレンダーを開く"
|
|
26
|
+
"openCalendar": "カレンダーを開く",
|
|
27
|
+
"quarter": "第{quarter}四半期"
|
|
27
28
|
},
|
|
28
29
|
"dateRangePicker": {
|
|
29
30
|
"placeholder": "期間を選択",
|
|
@@ -39,7 +40,10 @@
|
|
|
39
40
|
"openPicker": "時刻を選択",
|
|
40
41
|
"meridiem": "午前/午後",
|
|
41
42
|
"am": "午前",
|
|
42
|
-
"pm": "午後"
|
|
43
|
+
"pm": "午後",
|
|
44
|
+
"now": "現在時刻",
|
|
45
|
+
"confirm": "確定",
|
|
46
|
+
"second": "秒"
|
|
43
47
|
},
|
|
44
48
|
"searchInput": {
|
|
45
49
|
"placeholder": "検索…"
|
|
@@ -55,7 +59,7 @@
|
|
|
55
59
|
"upload": {
|
|
56
60
|
"dropzoneLabel": "ファイルをアップロード",
|
|
57
61
|
"dropzoneHint": "ここにドラッグ&ドロップ、またはクリックして選択",
|
|
58
|
-
"dropzoneMeta": "
|
|
62
|
+
"dropzoneMeta": "選択したファイルはここに表示されます。",
|
|
59
63
|
"buttonLabel": "ファイルを選択",
|
|
60
64
|
"addImage": "画像を追加",
|
|
61
65
|
"uploading": "アップロード中…",
|
|
@@ -75,7 +79,17 @@
|
|
|
75
79
|
"statusFailed": "{count} 件のアップロードに失敗",
|
|
76
80
|
"removeImage": "画像を削除",
|
|
77
81
|
"removeFile": "{name} を削除",
|
|
78
|
-
"cropDescription": "ズームスライダーを調整し、保存すると写真を正方形に切り抜きます。"
|
|
82
|
+
"cropDescription": "ズームスライダーを調整し、保存すると写真を正方形に切り抜きます。",
|
|
83
|
+
"preview": "プレビュー",
|
|
84
|
+
"download": "ダウンロード",
|
|
85
|
+
"retry": "再試行",
|
|
86
|
+
"start": "アップロード",
|
|
87
|
+
"cancel": "キャンセル",
|
|
88
|
+
"rejectAccept": "{name}: 許可されていない形式です。",
|
|
89
|
+
"rejectSize": "{name}: ファイルが大きすぎます。",
|
|
90
|
+
"rejectCount": "{name}: ファイル数の上限です。",
|
|
91
|
+
"rejectBeforeUpload": "{name}: ファイルの検証に失敗しました。",
|
|
92
|
+
"readFailed": "選択したフォルダーを読み取れませんでした。"
|
|
79
93
|
},
|
|
80
94
|
"cascader": {
|
|
81
95
|
"placeholder": "選択…",
|
|
@@ -109,6 +123,9 @@
|
|
|
109
123
|
"empty": "該当なし",
|
|
110
124
|
"error": "選択肢を読み込めませんでした"
|
|
111
125
|
},
|
|
126
|
+
"selection": {
|
|
127
|
+
"overflow": "他{count}件"
|
|
128
|
+
},
|
|
112
129
|
"monthPicker": {
|
|
113
130
|
"openGrid": "月選択を開く",
|
|
114
131
|
"previousYear": "前年へ",
|
|
@@ -132,6 +149,14 @@
|
|
|
132
149
|
},
|
|
133
150
|
"formErrors": {
|
|
134
151
|
"title": "入力内容にエラーがあります"
|
|
152
|
+
},
|
|
153
|
+
"form": {
|
|
154
|
+
"optional": "(任意)",
|
|
155
|
+
"success": "確認済み",
|
|
156
|
+
"warning": "確認してください",
|
|
157
|
+
"error": "入力エラー",
|
|
158
|
+
"validating": "確認中",
|
|
159
|
+
"submitFailed": "フォームを送信できませんでした。再試行してください。"
|
|
135
160
|
}
|
|
136
161
|
},
|
|
137
162
|
"feedback": {
|
|
@@ -154,6 +179,7 @@
|
|
|
154
179
|
},
|
|
155
180
|
"appShell": {
|
|
156
181
|
"sidebarLabel": "サイドバー",
|
|
182
|
+
"navRailLabel": "ワークスペース",
|
|
157
183
|
"headerLabel": "ヘッダー",
|
|
158
184
|
"mainLabel": "メインコンテンツ",
|
|
159
185
|
"footerLabel": "フッター",
|
|
@@ -246,6 +272,10 @@
|
|
|
246
272
|
"denied": "このマトリクスを表示する権限がありません",
|
|
247
273
|
"deniedDescription": "閲覧するには管理者に権限の付与を依頼してください。",
|
|
248
274
|
"loading": "権限を読み込み中…"
|
|
275
|
+
},
|
|
276
|
+
"progress": {
|
|
277
|
+
"ariaLabel": "進捗",
|
|
278
|
+
"breakdownSeparator": "、"
|
|
249
279
|
}
|
|
250
280
|
},
|
|
251
281
|
"ui": {
|
|
@@ -279,8 +309,13 @@
|
|
|
279
309
|
}
|
|
280
310
|
},
|
|
281
311
|
"navigation": {
|
|
312
|
+
"tabs": {
|
|
313
|
+
"addTab": "タブを追加",
|
|
314
|
+
"removeTab": "タブを閉じる"
|
|
315
|
+
},
|
|
282
316
|
"steps": {
|
|
283
317
|
"ariaLabel": "進行状況",
|
|
318
|
+
"percentLabel": "現在のステップの進捗",
|
|
284
319
|
"status": {
|
|
285
320
|
"wait": "未完了",
|
|
286
321
|
"process": "現在のステップ",
|
|
@@ -318,6 +353,7 @@
|
|
|
318
353
|
"page": "ページ {page}",
|
|
319
354
|
"pageSize": "ページサイズ",
|
|
320
355
|
"pageSizeTrigger": "{size}件",
|
|
356
|
+
"jumpTo": "ページへ移動",
|
|
321
357
|
"pageSizeOption": "{size} 件/ページ",
|
|
322
358
|
"total": "全 {total} 件"
|
|
323
359
|
},
|
|
@@ -347,6 +383,9 @@
|
|
|
347
383
|
"logistics": "Logistics Teal",
|
|
348
384
|
"partner": "Partner Orange",
|
|
349
385
|
"slate": "HQ Slate"
|
|
386
|
+
},
|
|
387
|
+
"settingToggle": {
|
|
388
|
+
"label": "{setting}:{value}"
|
|
350
389
|
}
|
|
351
390
|
},
|
|
352
391
|
"locale": {
|
|
@@ -390,7 +429,19 @@
|
|
|
390
429
|
"error": "一覧を取得できませんでした",
|
|
391
430
|
"errorDescription": "データを取得できませんでした。時間をおいて再試行してください。",
|
|
392
431
|
"denied": "この一覧を表示する権限がありません",
|
|
393
|
-
"deniedDescription": "閲覧するには管理者に権限の付与を依頼してください。"
|
|
432
|
+
"deniedDescription": "閲覧するには管理者に権限の付与を依頼してください。",
|
|
433
|
+
"selectInvert": "選択を反転",
|
|
434
|
+
"selectNone": "選択を解除",
|
|
435
|
+
"selectionMenu": "選択オプション",
|
|
436
|
+
"filterColumn": "絞り込み",
|
|
437
|
+
"filterReset": "絞り込みを解除",
|
|
438
|
+
"expandColumn": "展開",
|
|
439
|
+
"expandRow": "行を展開",
|
|
440
|
+
"collapseRow": "行を折りたたむ",
|
|
441
|
+
"sortAscending": "昇順に並べ替え",
|
|
442
|
+
"sortDescending": "降順に並べ替え",
|
|
443
|
+
"sortCancel": "並べ替えを解除",
|
|
444
|
+
"selectColumn": "選択"
|
|
394
445
|
},
|
|
395
446
|
"dataGrid": {
|
|
396
447
|
"search": "検索",
|
|
@@ -458,5 +509,13 @@
|
|
|
458
509
|
"summaryPie": "{slices}区分の円グラフ",
|
|
459
510
|
"summaryTrend": "{points}データ点の推移棒グラフ",
|
|
460
511
|
"trendCurrent": "現在"
|
|
512
|
+
},
|
|
513
|
+
"rangeTimeline": {
|
|
514
|
+
"outsideRange": "表示範囲外",
|
|
515
|
+
"schedule": "スケジュール"
|
|
516
|
+
},
|
|
517
|
+
"textExamples": {
|
|
518
|
+
"preservedText": "プレーンテキスト",
|
|
519
|
+
"sampleText": "最初の行\n 字下げした行\n\n最後の行"
|
|
461
520
|
}
|
|
462
521
|
}
|