@alepha/ui 0.36.0 → 0.37.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/dist/account/$pageAccount.d.ts +1 -1
- package/dist/account/$pageAccount.d.ts.map +1 -1
- package/dist/account/$pageAccount.js.map +1 -1
- package/dist/account/AccountDisplay.d.ts +13 -0
- package/dist/account/AccountDisplay.d.ts.map +1 -0
- package/dist/account/AccountDisplay.js +48 -0
- package/dist/account/AccountDisplay.js.map +1 -0
- package/dist/account/AccountProfile.d.ts.map +1 -1
- package/dist/account/AccountProfile.js +14 -10
- package/dist/account/AccountProfile.js.map +1 -1
- package/dist/account/AccountRouter.d.ts +6 -6
- package/dist/account/AccountRouter.d.ts.map +1 -1
- package/dist/account/index.d.ts +5 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +2 -1
- package/dist/admin/$pageAdmin.d.ts +1 -1
- package/dist/admin/$pageAdmin.d.ts.map +1 -1
- package/dist/admin/$pageAdmin.js.map +1 -1
- package/dist/admin/AdminAudits.js.map +1 -1
- package/dist/admin/AdminJobDetail.js.map +1 -1
- package/dist/admin/AdminJobs.js.map +1 -1
- package/dist/admin/AdminNotifications.js.map +1 -1
- package/dist/admin/AdminRouter.d.ts +14 -14
- package/dist/admin/AdminRouter.d.ts.map +1 -1
- package/dist/admin/AdminUserDetail.js.map +1 -1
- package/dist/admin/AdminUsers.js.map +1 -1
- package/dist/admin/ParameterHistoryItem.js.map +1 -1
- package/dist/ai/AiChat.d.ts +26 -39
- package/dist/ai/AiChat.d.ts.map +1 -1
- package/dist/ai/AiChat.js +65 -123
- package/dist/ai/AiChat.js.map +1 -1
- package/dist/ai/AiChatDock.d.ts +23 -0
- package/dist/ai/AiChatDock.d.ts.map +1 -0
- package/dist/ai/AiChatDock.js +90 -0
- package/dist/ai/AiChatDock.js.map +1 -0
- package/dist/ai/AiChatDockSlot.d.ts +15 -0
- package/dist/ai/AiChatDockSlot.d.ts.map +1 -0
- package/dist/ai/AiChatDockSlot.js +20 -0
- package/dist/ai/AiChatDockSlot.js.map +1 -0
- package/dist/ai/AiChatLauncher.d.ts +17 -0
- package/dist/ai/AiChatLauncher.d.ts.map +1 -0
- package/dist/ai/AiChatLauncher.js +42 -0
- package/dist/ai/AiChatLauncher.js.map +1 -0
- package/dist/ai/AiChatMessage.d.ts +7 -1
- package/dist/ai/AiChatMessage.d.ts.map +1 -1
- package/dist/ai/AiChatMessage.js +27 -7
- package/dist/ai/AiChatMessage.js.map +1 -1
- package/dist/ai/AiChatPanel.d.ts +71 -0
- package/dist/ai/AiChatPanel.d.ts.map +1 -0
- package/dist/ai/AiChatPanel.js +143 -0
- package/dist/ai/AiChatPanel.js.map +1 -0
- package/dist/ai/index.d.ts +8 -4
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -1
- package/dist/ai/useAiChat.d.ts +17 -0
- package/dist/ai/useAiChat.d.ts.map +1 -1
- package/dist/ai/useAiChat.js +38 -17
- package/dist/ai/useAiChat.js.map +1 -1
- package/dist/auth/AuthLogin.d.ts +9 -0
- package/dist/auth/AuthLogin.d.ts.map +1 -1
- package/dist/auth/AuthLogin.js +2 -2
- package/dist/auth/AuthLogin.js.map +1 -1
- package/dist/auth/AuthRegister.d.ts +4 -1
- package/dist/auth/AuthRegister.d.ts.map +1 -1
- package/dist/auth/AuthRegister.js +1 -1
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/auth/AuthResetPassword.d.ts +8 -0
- package/dist/auth/AuthResetPassword.d.ts.map +1 -1
- package/dist/auth/AuthResetPassword.js +2 -2
- package/dist/auth/AuthResetPassword.js.map +1 -1
- package/dist/auth/AuthRouter.d.ts +4 -4
- package/dist/auth/AuthRouter.d.ts.map +1 -1
- package/dist/core/Badge.d.ts.map +1 -1
- package/dist/core/Badge.js +7 -3
- package/dist/core/Badge.js.map +1 -1
- package/dist/core/Collapsible.d.ts +50 -0
- package/dist/core/Collapsible.d.ts.map +1 -0
- package/dist/core/Collapsible.js +70 -0
- package/dist/core/Collapsible.js.map +1 -0
- package/dist/core/Combobox.d.ts +7 -1
- package/dist/core/Combobox.d.ts.map +1 -1
- package/dist/core/Combobox.js +2 -2
- package/dist/core/Combobox.js.map +1 -1
- package/dist/core/PaneRail.d.ts +24 -7
- package/dist/core/PaneRail.d.ts.map +1 -1
- package/dist/core/PaneRail.js +24 -19
- package/dist/core/PaneRail.js.map +1 -1
- package/dist/core/Stepper.d.ts +36 -0
- package/dist/core/Stepper.d.ts.map +1 -0
- package/dist/core/Stepper.js +54 -0
- package/dist/core/Stepper.js.map +1 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/useToast.js +13 -13
- package/dist/core/useToast.js.map +1 -1
- package/dist/form/AutoForm.d.ts.map +1 -1
- package/dist/form/AutoForm.js +29 -0
- package/dist/form/AutoForm.js.map +1 -1
- package/dist/form/AutoFormErrorPopover.js +13 -3
- package/dist/form/AutoFormErrorPopover.js.map +1 -1
- package/dist/form/Control.d.ts +14 -1
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +12 -2
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlDate.d.ts.map +1 -1
- package/dist/form/ControlDate.js +3 -0
- package/dist/form/ControlDate.js.map +1 -1
- package/dist/form/ControlDateRange.d.ts +12 -1
- package/dist/form/ControlDateRange.d.ts.map +1 -1
- package/dist/form/ControlDateRange.js +11 -1
- package/dist/form/ControlDateRange.js.map +1 -1
- package/dist/form/ControlNumber.d.ts.map +1 -1
- package/dist/form/ControlNumber.js +2 -0
- package/dist/form/ControlNumber.js.map +1 -1
- package/dist/form/ControlObject.d.ts.map +1 -1
- package/dist/form/ControlObject.js +15 -1
- package/dist/form/ControlObject.js.map +1 -1
- package/dist/form/ControlPassword.d.ts +4 -0
- package/dist/form/ControlPassword.d.ts.map +1 -1
- package/dist/form/ControlPassword.js +1 -0
- package/dist/form/ControlPassword.js.map +1 -1
- package/dist/form/ControlSelect.d.ts +23 -1
- package/dist/form/ControlSelect.d.ts.map +1 -1
- package/dist/form/ControlSelect.js +5 -0
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/form/ControlSelectCombobox.d.ts +11 -1
- package/dist/form/ControlSelectCombobox.d.ts.map +1 -1
- package/dist/form/ControlSelectCombobox.js +9 -1
- package/dist/form/ControlSelectCombobox.js.map +1 -1
- package/dist/form/ControlUpload.d.ts.map +1 -1
- package/dist/form/ControlUpload.js +1 -0
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/form/FormField.d.ts +5 -0
- package/dist/form/FormField.d.ts.map +1 -1
- package/dist/form/FormField.js +7 -0
- package/dist/form/FormField.js.map +1 -1
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +15 -0
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/shell/$pageNav.d.ts +2 -2
- package/dist/shell/$pageNav.d.ts.map +1 -1
- package/dist/shell/$pageNav.js.map +1 -1
- package/dist/shell/AppShell.d.ts +6 -0
- package/dist/shell/AppShell.d.ts.map +1 -1
- package/dist/shell/AppShell.js +31 -27
- package/dist/shell/AppShell.js.map +1 -1
- package/dist/shell/ButtonSettings.d.ts +6 -2
- package/dist/shell/ButtonSettings.d.ts.map +1 -1
- package/dist/shell/ButtonSettings.js +17 -3
- package/dist/shell/ButtonSettings.js.map +1 -1
- package/dist/shell/ButtonSettingsVisionMenuItem.d.ts +16 -0
- package/dist/shell/ButtonSettingsVisionMenuItem.d.ts.map +1 -0
- package/dist/shell/ButtonSettingsVisionMenuItem.js +24 -0
- package/dist/shell/ButtonSettingsVisionMenuItem.js.map +1 -0
- package/dist/shell/ButtonVision.d.ts +28 -0
- package/dist/shell/ButtonVision.d.ts.map +1 -0
- package/dist/shell/ButtonVision.js +46 -0
- package/dist/shell/ButtonVision.js.map +1 -0
- package/dist/shell/index.d.ts +6 -3
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +2 -1
- package/dist/styles.css +57 -0
- package/dist/table/DataTable.d.ts.map +1 -1
- package/dist/table/DataTable.js +29 -4
- package/dist/table/DataTable.js.map +1 -1
- package/dist/table/DataTableColumnPicker.d.ts.map +1 -1
- package/dist/table/DataTableColumnPicker.js +1 -0
- package/dist/table/DataTableColumnPicker.js.map +1 -1
- package/dist/table/DataTableFilterBar.d.ts +1 -1
- package/dist/table/DataTableFilterBar.d.ts.map +1 -1
- package/dist/table/DataTableFilterBar.js +5 -108
- package/dist/table/DataTableFilterBar.js.map +1 -1
- package/dist/table/DataTableHeaderFilter.d.ts +51 -0
- package/dist/table/DataTableHeaderFilter.d.ts.map +1 -0
- package/dist/table/DataTableHeaderFilter.js +113 -0
- package/dist/table/DataTableHeaderFilter.js.map +1 -0
- package/dist/table/DataTableHeaderRow.d.ts +7 -0
- package/dist/table/DataTableHeaderRow.d.ts.map +1 -1
- package/dist/table/DataTableHeaderRow.js +92 -74
- package/dist/table/DataTableHeaderRow.js.map +1 -1
- package/dist/table/DataTableTabs.d.ts +42 -0
- package/dist/table/DataTableTabs.d.ts.map +1 -0
- package/dist/table/DataTableTabs.js +55 -0
- package/dist/table/DataTableTabs.js.map +1 -0
- package/dist/table/dataTableBaseProps.d.ts +12 -0
- package/dist/table/dataTableBaseProps.d.ts.map +1 -1
- package/dist/table/dataTablePersistence.d.ts.map +1 -1
- package/dist/table/dataTablePersistence.js +4 -2
- package/dist/table/dataTablePersistence.js.map +1 -1
- package/dist/table/dataTableTypes.d.ts +18 -0
- package/dist/table/dataTableTypes.d.ts.map +1 -1
- package/dist/table/index.d.ts +5 -2
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +2 -1
- package/dist/table/useDataTableColumns.d.ts.map +1 -1
- package/dist/table/useDataTableColumns.js +1 -0
- package/dist/table/useDataTableColumns.js.map +1 -1
- package/dist/table/useDataTableFilterModel.d.ts +110 -0
- package/dist/table/useDataTableFilterModel.d.ts.map +1 -0
- package/dist/table/useDataTableFilterModel.js +154 -0
- package/dist/table/useDataTableFilterModel.js.map +1 -0
- package/docs/packages-alepha-ui-account.md +4 -0
- package/docs/packages-alepha-ui-ai.md +5 -5
- package/docs/packages-alepha-ui-shell.md +4 -3
- package/docs/packages-alepha-ui-table.md +4 -2
- package/package.json +8 -8
- package/src/account/$pageAccount.tsx +5 -4
- package/src/account/AccountDisplay.tsx +58 -0
- package/src/account/AccountProfile.tsx +30 -42
- package/src/account/__tests__/AccountProfile.browser.spec.tsx +141 -0
- package/src/account/__tests__/AccountRecoveryCodes.browser.spec.tsx +1 -1
- package/src/account/index.ts +5 -0
- package/src/admin/$pageAdmin.tsx +5 -4
- package/src/admin/AdminAudits.tsx +1 -1
- package/src/admin/AdminJobDetail.tsx +1 -1
- package/src/admin/AdminJobs.tsx +1 -1
- package/src/admin/AdminNotifications.tsx +1 -1
- package/src/admin/AdminUserDetail.tsx +1 -1
- package/src/admin/AdminUsers.tsx +1 -1
- package/src/admin/ParameterHistoryItem.tsx +1 -1
- package/src/admin/__tests__/AdminFilesUsageCard.browser.spec.tsx +17 -9
- package/src/ai/AiChat.tsx +94 -183
- package/src/ai/AiChatDock.tsx +129 -0
- package/src/ai/AiChatDockSlot.tsx +23 -0
- package/src/ai/AiChatLauncher.tsx +58 -0
- package/src/ai/AiChatMessage.tsx +48 -9
- package/src/ai/AiChatPanel.tsx +252 -0
- package/src/ai/__tests__/AiChat.browser.spec.tsx +197 -5
- package/src/ai/index.ts +8 -4
- package/src/ai/useAiChat.ts +80 -14
- package/src/auth/AuthLogin.tsx +19 -4
- package/src/auth/AuthRegister.tsx +6 -3
- package/src/auth/AuthResetPassword.tsx +18 -8
- package/src/auth/__tests__/AuthCancel.browser.spec.tsx +129 -0
- package/src/core/Badge.tsx +7 -3
- package/src/core/Collapsible.tsx +95 -0
- package/src/core/Combobox.tsx +11 -3
- package/src/core/PaneRail.tsx +36 -20
- package/src/core/Stepper.tsx +118 -0
- package/src/core/__tests__/Badge.browser.spec.tsx +5 -5
- package/src/core/__tests__/Collapsible.browser.spec.tsx +88 -0
- package/src/core/__tests__/PaneRail.browser.spec.tsx +48 -0
- package/src/core/__tests__/Stepper.browser.spec.tsx +39 -0
- package/src/core/__tests__/primitiveSlots.spec.ts +7 -0
- package/src/core/index.ts +15 -0
- package/src/form/AutoForm.tsx +32 -0
- package/src/form/AutoFormErrorPopover.tsx +27 -6
- package/src/form/Control.tsx +22 -0
- package/src/form/ControlDate.tsx +3 -0
- package/src/form/ControlDateRange.tsx +87 -58
- package/src/form/ControlNumber.tsx +2 -0
- package/src/form/ControlObject.tsx +20 -1
- package/src/form/ControlPassword.tsx +5 -0
- package/src/form/ControlSelect.tsx +32 -1
- package/src/form/ControlSelectCombobox.tsx +82 -56
- package/src/form/ControlUpload.tsx +1 -0
- package/src/form/FormField.tsx +23 -1
- package/src/form/__tests__/ControlFieldErrors.browser.spec.tsx +253 -0
- package/src/form/__tests__/ControlValidateMode.browser.spec.tsx +217 -0
- package/src/form/__tests__/ControlVariantErrors.browser.spec.tsx +133 -0
- package/src/i18n/fr/uiFr.ts +19 -1
- package/src/markdown/css.d.ts +11 -0
- package/src/shell/$pageNav.tsx +6 -4
- package/src/shell/AppShell.tsx +7 -0
- package/src/shell/ButtonSettings.tsx +20 -5
- package/src/shell/ButtonSettingsVisionMenuItem.tsx +40 -0
- package/src/shell/ButtonVision.tsx +73 -0
- package/src/shell/__tests__/ButtonSettings.browser.spec.tsx +42 -2
- package/src/shell/__tests__/ButtonVision.browser.spec.tsx +73 -0
- package/src/shell/__tests__/visionTokens.spec.ts +104 -0
- package/src/shell/index.ts +6 -3
- package/src/styles.css +57 -0
- package/src/table/DataTable.tsx +52 -4
- package/src/table/DataTableColumnPicker.tsx +3 -0
- package/src/table/DataTableFilterBar.tsx +18 -191
- package/src/table/DataTableHeaderFilter.tsx +156 -0
- package/src/table/DataTableHeaderRow.tsx +78 -40
- package/src/table/DataTableTabs.tsx +114 -0
- package/src/table/__tests__/DataTableHeaderFilter.browser.spec.tsx +174 -0
- package/src/table/__tests__/DataTableStaleColumns.browser.spec.tsx +80 -0
- package/src/table/__tests__/DataTableTabs.browser.spec.tsx +72 -0
- package/src/table/dataTableBaseProps.ts +12 -0
- package/src/table/dataTablePersistence.ts +11 -5
- package/src/table/dataTableTypes.ts +18 -0
- package/src/table/index.ts +9 -2
- package/src/table/useDataTableColumns.ts +1 -0
- package/src/table/useDataTableFilterModel.tsx +240 -0
package/src/core/PaneRail.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PanelLeftOpen, PanelRightOpen } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
2
3
|
|
|
3
4
|
import { cn } from "./utils.ts";
|
|
4
5
|
|
|
@@ -13,48 +14,63 @@ export interface PaneRailProps {
|
|
|
13
14
|
*/
|
|
14
15
|
label: string;
|
|
15
16
|
onExpand: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* The pane's own icon, at the top of the strip. Given one, the rail names
|
|
19
|
+
* WHAT it reopens, and the open-panel arrow moves to the strip's foot so
|
|
20
|
+
* the strip still says it opens something. Without one the arrow is the
|
|
21
|
+
* only mark, at the top.
|
|
22
|
+
*/
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Shown under the top icon: a count badge, say. Not separately
|
|
26
|
+
* actionable, since the whole strip is the button.
|
|
27
|
+
*/
|
|
28
|
+
children?: ReactNode;
|
|
16
29
|
className?: string;
|
|
30
|
+
"data-testid"?: string;
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
/**
|
|
20
|
-
* What a collapsible pane leaves behind once it is closed: a 36px strip
|
|
21
|
-
* the
|
|
34
|
+
* What a collapsible pane leaves behind once it is closed: a 36px strip that
|
|
35
|
+
* is, all of it, the button that brings the pane back.
|
|
22
36
|
*
|
|
23
37
|
* A pane closed with a click has to say how to reopen it. Collapsing to
|
|
24
38
|
* nothing strands the reader: the only routes back left are a keyboard
|
|
25
39
|
* shortcut and a menu that does not advertise itself, for a pane they just
|
|
26
40
|
* closed with a click.
|
|
27
41
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
42
|
+
* The whole strip is the hit area, hover included, rather than a small
|
|
43
|
+
* button at its top: the strip has no other use, and a 28px target inside a
|
|
44
|
+
* full-height column reads as broken when a click below it does nothing.
|
|
45
|
+
*
|
|
46
|
+
* It moved from Lore into the kit with #Q2265 and became one full-height
|
|
47
|
+
* button with #Q3206, so the admin Parameters History panel, Lore's folio
|
|
48
|
+
* tree and inspector, and Lore's Quest Log (`icon` plus a count as
|
|
49
|
+
* `children`) share one strip and cannot drift apart.
|
|
33
50
|
*
|
|
34
51
|
* ⚠️ Render it only where the pane would otherwise be a COLUMN. Where a
|
|
35
52
|
* layout stacks its panes or turns one into an overlay, a strip frees no
|
|
36
53
|
* width and only changes the default layout.
|
|
37
54
|
*/
|
|
38
55
|
export const PaneRail = (props: PaneRailProps) => {
|
|
39
|
-
const
|
|
56
|
+
const Arrow = props.side === "left" ? PanelLeftOpen : PanelRightOpen;
|
|
40
57
|
|
|
41
58
|
return (
|
|
42
|
-
<
|
|
59
|
+
<button
|
|
60
|
+
type="button"
|
|
61
|
+
onClick={props.onExpand}
|
|
62
|
+
aria-label={props.label}
|
|
63
|
+
title={props.label}
|
|
64
|
+
data-testid={props["data-testid"]}
|
|
43
65
|
className={cn(
|
|
44
|
-
"border-border flex w-9 flex-none flex-col items-center pt-
|
|
66
|
+
"border-border text-muted-foreground hover:text-foreground hover:bg-hover focus-visible:ring-ring/50 flex w-9 flex-none cursor-pointer flex-col items-center gap-2 pt-3 transition-colors outline-none focus-visible:ring-3 focus-visible:ring-inset",
|
|
45
67
|
props.side === "left" ? "border-r" : "border-l",
|
|
46
68
|
props.className,
|
|
47
69
|
)}
|
|
48
70
|
>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
title={props.label}
|
|
54
|
-
className="text-muted-foreground hover:text-foreground hover:bg-hover flex size-7 items-center justify-center rounded-md transition-colors"
|
|
55
|
-
>
|
|
56
|
-
<Icon className="size-4" />
|
|
57
|
-
</button>
|
|
58
|
-
</div>
|
|
71
|
+
{props.icon ?? <Arrow className="size-4 shrink-0" />}
|
|
72
|
+
{props.children}
|
|
73
|
+
{props.icon && <Arrow className="mt-auto mb-3 size-3.5 shrink-0" />}
|
|
74
|
+
</button>
|
|
59
75
|
);
|
|
60
76
|
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Check } from "lucide-react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "./utils.ts";
|
|
5
|
+
|
|
6
|
+
/** One step of a {@link Stepper}. */
|
|
7
|
+
export interface StepperStep {
|
|
8
|
+
/** Unique among the steps. */
|
|
9
|
+
key: string;
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
/** A short line under the label. */
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Where a step stands against the current one. */
|
|
16
|
+
export type StepperStepState = "done" | "current" | "upcoming";
|
|
17
|
+
|
|
18
|
+
export interface StepperProps {
|
|
19
|
+
steps: StepperStep[];
|
|
20
|
+
/** The index of the step on screen. */
|
|
21
|
+
current: number;
|
|
22
|
+
/**
|
|
23
|
+
* Called with a step's index when it is clicked. Only the steps already
|
|
24
|
+
* done are clickable: going forward is the caller's to validate.
|
|
25
|
+
*/
|
|
26
|
+
onStepClick?: (index: number) => void;
|
|
27
|
+
/** The list's accessible name. Defaults to "Steps". */
|
|
28
|
+
label?: string;
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The state of the step at `index` when `current` is on screen. */
|
|
33
|
+
export const stepperStepState = (
|
|
34
|
+
index: number,
|
|
35
|
+
current: number,
|
|
36
|
+
): StepperStepState =>
|
|
37
|
+
index < current ? "done" : index === current ? "current" : "upcoming";
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The header of a multi-step form: each step numbered, with its state drawn
|
|
41
|
+
* (a check once done, the current one highlighted, the ones to come muted)
|
|
42
|
+
* and joined by a line that fills as the steps are done.
|
|
43
|
+
*
|
|
44
|
+
* It draws the steps and nothing else: the body and the Back / Next buttons
|
|
45
|
+
* stay the caller's, which is where validating a step belongs.
|
|
46
|
+
*/
|
|
47
|
+
export const Stepper = (props: StepperProps) => (
|
|
48
|
+
<ol
|
|
49
|
+
data-slot="stepper"
|
|
50
|
+
aria-label={props.label ?? "Steps"}
|
|
51
|
+
className={cn("flex w-full items-start gap-2", props.className)}
|
|
52
|
+
>
|
|
53
|
+
{props.steps.map((step, index) => {
|
|
54
|
+
const state = stepperStepState(index, props.current);
|
|
55
|
+
const clickable = state === "done" && Boolean(props.onStepClick);
|
|
56
|
+
const last = index === props.steps.length - 1;
|
|
57
|
+
return (
|
|
58
|
+
<li
|
|
59
|
+
key={step.key}
|
|
60
|
+
data-state={state}
|
|
61
|
+
aria-current={state === "current" ? "step" : undefined}
|
|
62
|
+
className={cn(
|
|
63
|
+
"flex min-w-0 flex-1 items-start gap-2",
|
|
64
|
+
last && "flex-none",
|
|
65
|
+
)}
|
|
66
|
+
>
|
|
67
|
+
<button
|
|
68
|
+
type="button"
|
|
69
|
+
disabled={!clickable}
|
|
70
|
+
onClick={clickable ? () => props.onStepClick?.(index) : undefined}
|
|
71
|
+
className={cn(
|
|
72
|
+
"flex min-w-0 items-start gap-2 text-left",
|
|
73
|
+
clickable && "cursor-pointer",
|
|
74
|
+
!clickable && "cursor-default",
|
|
75
|
+
)}
|
|
76
|
+
>
|
|
77
|
+
<span
|
|
78
|
+
className={cn(
|
|
79
|
+
"flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold tabular-nums transition-colors",
|
|
80
|
+
state === "done" &&
|
|
81
|
+
"bg-primary border-primary text-primary-foreground",
|
|
82
|
+
state === "current" &&
|
|
83
|
+
"border-primary text-primary ring-primary/20 ring-4",
|
|
84
|
+
state === "upcoming" && "text-muted-foreground",
|
|
85
|
+
)}
|
|
86
|
+
>
|
|
87
|
+
{state === "done" ? <Check className="size-3.5" /> : index + 1}
|
|
88
|
+
</span>
|
|
89
|
+
<span className="flex min-w-0 flex-col pt-1">
|
|
90
|
+
<span
|
|
91
|
+
className={cn(
|
|
92
|
+
"truncate text-sm font-medium",
|
|
93
|
+
state === "upcoming" && "text-muted-foreground",
|
|
94
|
+
)}
|
|
95
|
+
>
|
|
96
|
+
{step.label}
|
|
97
|
+
</span>
|
|
98
|
+
{step.description && (
|
|
99
|
+
<span className="text-muted-foreground truncate text-xs">
|
|
100
|
+
{step.description}
|
|
101
|
+
</span>
|
|
102
|
+
)}
|
|
103
|
+
</span>
|
|
104
|
+
</button>
|
|
105
|
+
{!last && (
|
|
106
|
+
<span
|
|
107
|
+
aria-hidden
|
|
108
|
+
className={cn(
|
|
109
|
+
"mt-3.5 h-px min-w-4 flex-1",
|
|
110
|
+
state === "done" ? "bg-primary" : "bg-border",
|
|
111
|
+
)}
|
|
112
|
+
/>
|
|
113
|
+
)}
|
|
114
|
+
</li>
|
|
115
|
+
);
|
|
116
|
+
})}
|
|
117
|
+
</ol>
|
|
118
|
+
);
|
|
@@ -25,9 +25,9 @@ describe("Badge tone", () => {
|
|
|
25
25
|
|
|
26
26
|
it.each([
|
|
27
27
|
["neutral", "bg-muted"],
|
|
28
|
-
["success", "bg-
|
|
29
|
-
["warning", "bg-
|
|
30
|
-
["danger", "bg-
|
|
28
|
+
["success", "bg-success/15"],
|
|
29
|
+
["warning", "bg-warning/15"],
|
|
30
|
+
["danger", "bg-danger/15"],
|
|
31
31
|
] as const)("paints %s with %s", (tone, fill) => {
|
|
32
32
|
render(
|
|
33
33
|
<Badge variant="tint" tone={tone}>
|
|
@@ -43,7 +43,7 @@ describe("Badge tone", () => {
|
|
|
43
43
|
const badge = screen.getByText("Default");
|
|
44
44
|
|
|
45
45
|
expect(badge.className).toContain("bg-primary");
|
|
46
|
-
expect(badge.className).not.toContain("bg-
|
|
47
|
-
expect(badge.className).not.toContain("border-
|
|
46
|
+
expect(badge.className).not.toContain("bg-danger/15");
|
|
47
|
+
expect(badge.className).not.toContain("border-danger/40");
|
|
48
48
|
});
|
|
49
49
|
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
2
|
+
import { renderToString } from "react-dom/server";
|
|
3
|
+
import { describe, expect, it, vi } from "vitest";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Collapsible,
|
|
7
|
+
CollapsiblePanel,
|
|
8
|
+
CollapsibleTrigger,
|
|
9
|
+
} from "../Collapsible.tsx";
|
|
10
|
+
|
|
11
|
+
const Demo = (props: {
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
keepMounted?: boolean;
|
|
15
|
+
}) => (
|
|
16
|
+
<Collapsible
|
|
17
|
+
defaultOpen={props.defaultOpen}
|
|
18
|
+
onOpenChange={props.onOpenChange}
|
|
19
|
+
>
|
|
20
|
+
<CollapsibleTrigger chevron>Try the demo</CollapsibleTrigger>
|
|
21
|
+
<CollapsiblePanel keepMounted={props.keepMounted}>
|
|
22
|
+
<button type="button">Sign in as a viewer</button>
|
|
23
|
+
</CollapsiblePanel>
|
|
24
|
+
</Collapsible>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
describe("Collapsible", () => {
|
|
28
|
+
it("is closed by default: the panel is not rendered, so it holds no focusable content", () => {
|
|
29
|
+
render(<Demo />);
|
|
30
|
+
const trigger = screen.getByRole("button", { name: "Try the demo" });
|
|
31
|
+
expect(trigger.getAttribute("aria-expanded")).toBe("false");
|
|
32
|
+
expect(screen.queryByText("Sign in as a viewer")).toBeNull();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("opens and closes from the trigger, and reports each change", () => {
|
|
36
|
+
const onOpenChange = vi.fn();
|
|
37
|
+
render(<Demo onOpenChange={onOpenChange} />);
|
|
38
|
+
const trigger = screen.getByRole("button", { name: "Try the demo" });
|
|
39
|
+
|
|
40
|
+
fireEvent.click(trigger);
|
|
41
|
+
expect(trigger.getAttribute("aria-expanded")).toBe("true");
|
|
42
|
+
expect(trigger.hasAttribute("data-panel-open")).toBe(true);
|
|
43
|
+
const panel = screen
|
|
44
|
+
.getByText("Sign in as a viewer")
|
|
45
|
+
.closest("[data-slot=collapsible-panel]");
|
|
46
|
+
expect(panel).not.toBeNull();
|
|
47
|
+
expect(trigger.getAttribute("aria-controls")).toBe(panel?.id);
|
|
48
|
+
expect(onOpenChange).toHaveBeenLastCalledWith(true, expect.anything());
|
|
49
|
+
|
|
50
|
+
fireEvent.click(trigger);
|
|
51
|
+
expect(trigger.getAttribute("aria-expanded")).toBe("false");
|
|
52
|
+
expect(trigger.hasAttribute("data-panel-open")).toBe(false);
|
|
53
|
+
expect(onOpenChange).toHaveBeenLastCalledWith(false, expect.anything());
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("keeps a closed panel hidden in the DOM with keepMounted", () => {
|
|
57
|
+
render(<Demo keepMounted />);
|
|
58
|
+
const panel = document.querySelector("[data-slot=collapsible-panel]");
|
|
59
|
+
expect(panel?.hasAttribute("hidden")).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("draws the chevron only when asked", () => {
|
|
63
|
+
const { container } = render(
|
|
64
|
+
<Collapsible>
|
|
65
|
+
<CollapsibleTrigger>Plain</CollapsibleTrigger>
|
|
66
|
+
</Collapsible>,
|
|
67
|
+
);
|
|
68
|
+
expect(container.querySelector("[data-slot=collapsible-chevron]")).toBe(
|
|
69
|
+
null,
|
|
70
|
+
);
|
|
71
|
+
render(<Demo />);
|
|
72
|
+
expect(
|
|
73
|
+
document.querySelector("[data-slot=collapsible-chevron]"),
|
|
74
|
+
).not.toBeNull();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("renders on the server closed, or open at its natural height", () => {
|
|
78
|
+
const closed = renderToString(<Demo />);
|
|
79
|
+
expect(closed).toContain('aria-expanded="false"');
|
|
80
|
+
expect(closed).not.toContain("Sign in as a viewer");
|
|
81
|
+
|
|
82
|
+
const open = renderToString(<Demo defaultOpen />);
|
|
83
|
+
expect(open).toContain('aria-expanded="true"');
|
|
84
|
+
expect(open).toContain("Sign in as a viewer");
|
|
85
|
+
expect(open).toContain("--collapsible-panel-height:auto");
|
|
86
|
+
expect(open).not.toContain('data-starting-style=""');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { PaneRail } from "../PaneRail.tsx";
|
|
5
|
+
|
|
6
|
+
describe("PaneRail", () => {
|
|
7
|
+
it("is one button the whole strip: a click below the icon expands the pane", () => {
|
|
8
|
+
const onExpand = vi.fn();
|
|
9
|
+
render(
|
|
10
|
+
<PaneRail side="left" label="Show the tree" onExpand={onExpand}>
|
|
11
|
+
<span data-testid="below">3</span>
|
|
12
|
+
</PaneRail>,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const rail = screen.getByRole("button", { name: "Show the tree" });
|
|
16
|
+
expect(rail.getAttribute("title")).toBe("Show the tree");
|
|
17
|
+
// No inner button: the strip itself is the control.
|
|
18
|
+
expect(rail.querySelector("button")).toBeNull();
|
|
19
|
+
expect(rail.className).toContain("hover:bg-hover");
|
|
20
|
+
|
|
21
|
+
fireEvent.click(screen.getByTestId("below"));
|
|
22
|
+
expect(onExpand).toHaveBeenCalledTimes(1);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("puts the border on the side facing the content", () => {
|
|
26
|
+
render(<PaneRail side="right" label="Show history" onExpand={() => {}} />);
|
|
27
|
+
const rail = screen.getByRole("button", { name: "Show history" });
|
|
28
|
+
expect(rail.className).toContain("border-l");
|
|
29
|
+
expect(rail.className).not.toContain("border-r");
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("with a pane icon, keeps the open arrow at the strip's foot", () => {
|
|
33
|
+
render(
|
|
34
|
+
<PaneRail
|
|
35
|
+
side="left"
|
|
36
|
+
label="Show the log"
|
|
37
|
+
onExpand={() => {}}
|
|
38
|
+
icon={<svg data-testid="pane-icon" />}
|
|
39
|
+
data-testid="rail"
|
|
40
|
+
/>,
|
|
41
|
+
);
|
|
42
|
+
const rail = screen.getByTestId("rail");
|
|
43
|
+
const svgs = rail.querySelectorAll("svg");
|
|
44
|
+
expect(svgs).toHaveLength(2);
|
|
45
|
+
expect(svgs[0].getAttribute("data-testid")).toBe("pane-icon");
|
|
46
|
+
expect(svgs[1].getAttribute("class")).toContain("mt-auto");
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it, vi } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { Stepper, stepperStepState } from "../Stepper.tsx";
|
|
5
|
+
|
|
6
|
+
const STEPS = [
|
|
7
|
+
{ key: "a", label: "Identity" },
|
|
8
|
+
{ key: "b", label: "Address" },
|
|
9
|
+
{ key: "c", label: "Profile" },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
describe("Stepper", () => {
|
|
13
|
+
it("marks each step done, current or upcoming", () => {
|
|
14
|
+
const { container } = render(<Stepper steps={STEPS} current={1} />);
|
|
15
|
+
const states = [...container.querySelectorAll("li")].map((li) =>
|
|
16
|
+
li.getAttribute("data-state"),
|
|
17
|
+
);
|
|
18
|
+
expect(states).toEqual(["done", "current", "upcoming"]);
|
|
19
|
+
expect(
|
|
20
|
+
screen.getByText("Address").closest("li")?.getAttribute("aria-current"),
|
|
21
|
+
).toBe("step");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("lets only a done step be clicked", () => {
|
|
25
|
+
const onStepClick = vi.fn();
|
|
26
|
+
render(<Stepper steps={STEPS} current={1} onStepClick={onStepClick} />);
|
|
27
|
+
fireEvent.click(screen.getByText("Profile"));
|
|
28
|
+
fireEvent.click(screen.getByText("Address"));
|
|
29
|
+
expect(onStepClick).not.toHaveBeenCalled();
|
|
30
|
+
fireEvent.click(screen.getByText("Identity"));
|
|
31
|
+
expect(onStepClick).toHaveBeenCalledWith(0);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("derives a state from two indexes", () => {
|
|
35
|
+
expect(stepperStepState(0, 2)).toBe("done");
|
|
36
|
+
expect(stepperStepState(2, 2)).toBe("current");
|
|
37
|
+
expect(stepperStepState(3, 2)).toBe("upcoming");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -80,6 +80,12 @@ describe("primitive data-slots", () => {
|
|
|
80
80
|
"card-title",
|
|
81
81
|
],
|
|
82
82
|
"core/Checkbox.tsx": ["checkbox", "checkbox-indicator"],
|
|
83
|
+
"core/Collapsible.tsx": [
|
|
84
|
+
"collapsible",
|
|
85
|
+
"collapsible-chevron",
|
|
86
|
+
"collapsible-panel",
|
|
87
|
+
"collapsible-trigger",
|
|
88
|
+
],
|
|
83
89
|
"core/Combobox.tsx": [
|
|
84
90
|
"combobox-chip",
|
|
85
91
|
"combobox-chip-input",
|
|
@@ -279,6 +285,7 @@ describe("primitive data-slots", () => {
|
|
|
279
285
|
"slider-track",
|
|
280
286
|
],
|
|
281
287
|
"core/Spinner.tsx": ["spinner"],
|
|
288
|
+
"core/Stepper.tsx": ["stepper"],
|
|
282
289
|
"core/Switch.tsx": ["switch", "switch-thumb"],
|
|
283
290
|
"core/Table.tsx": [
|
|
284
291
|
"table",
|
package/src/core/index.ts
CHANGED
|
@@ -122,6 +122,14 @@ export {
|
|
|
122
122
|
type CardTitleProps,
|
|
123
123
|
} from "./Card.tsx";
|
|
124
124
|
export { Checkbox, type CheckboxProps } from "./Checkbox.tsx";
|
|
125
|
+
export {
|
|
126
|
+
Collapsible,
|
|
127
|
+
type CollapsibleProps,
|
|
128
|
+
CollapsiblePanel,
|
|
129
|
+
type CollapsiblePanelProps,
|
|
130
|
+
CollapsibleTrigger,
|
|
131
|
+
type CollapsibleTriggerProps,
|
|
132
|
+
} from "./Collapsible.tsx";
|
|
125
133
|
export {
|
|
126
134
|
Combobox,
|
|
127
135
|
ComboboxChip,
|
|
@@ -384,6 +392,13 @@ export {
|
|
|
384
392
|
ProgressValue,
|
|
385
393
|
type ProgressValueProps,
|
|
386
394
|
} from "./Progress.tsx";
|
|
395
|
+
export {
|
|
396
|
+
Stepper,
|
|
397
|
+
type StepperProps,
|
|
398
|
+
type StepperStep,
|
|
399
|
+
type StepperStepState,
|
|
400
|
+
stepperStepState,
|
|
401
|
+
} from "./Stepper.tsx";
|
|
387
402
|
export {
|
|
388
403
|
Segmented,
|
|
389
404
|
type SegmentedOption,
|
package/src/form/AutoForm.tsx
CHANGED
|
@@ -234,6 +234,38 @@ export const AutoForm = <T extends ZObject>(props: AutoFormProps<T>) => {
|
|
|
234
234
|
typeof autoSave === "object" ? (autoSave?.delay ?? 600) : 600;
|
|
235
235
|
const autoSaveEnabled = !!autoSave;
|
|
236
236
|
const alepha = useAlepha();
|
|
237
|
+
|
|
238
|
+
// ── First field error into view ───────────────────────────────────
|
|
239
|
+
// After a refused submit, the person has to find what was refused: the
|
|
240
|
+
// first invalid control, in page order, is scrolled to and focused. Its
|
|
241
|
+
// `ControlObject` opens itself when the error is inside, so the control may
|
|
242
|
+
// mount a frame later: a few short retries cover that.
|
|
243
|
+
const formId = props.form.id;
|
|
244
|
+
useEffect(() => {
|
|
245
|
+
const timers: Array<ReturnType<typeof setTimeout>> = [];
|
|
246
|
+
const off = alepha.events.on("form:submit:error", (event) => {
|
|
247
|
+
if (event.id !== formId) return;
|
|
248
|
+
if (Object.keys(props.form.errors).length === 0) return;
|
|
249
|
+
const reveal = (attempt: number) => {
|
|
250
|
+
const target = document
|
|
251
|
+
.getElementById(formId)
|
|
252
|
+
?.querySelector<HTMLElement>('[aria-invalid="true"]');
|
|
253
|
+
if (!target) {
|
|
254
|
+
if (attempt < 5)
|
|
255
|
+
timers.push(setTimeout(() => reveal(attempt + 1), 16));
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
target.scrollIntoView?.({ block: "center", behavior: "smooth" });
|
|
259
|
+
target.focus({ preventScroll: true });
|
|
260
|
+
};
|
|
261
|
+
timers.push(setTimeout(() => reveal(0), 0));
|
|
262
|
+
});
|
|
263
|
+
return () => {
|
|
264
|
+
off();
|
|
265
|
+
for (const timer of timers) clearTimeout(timer);
|
|
266
|
+
};
|
|
267
|
+
}, [alepha, formId, props.form]);
|
|
268
|
+
|
|
237
269
|
useEffect(() => {
|
|
238
270
|
if (!autoSaveEnabled) return;
|
|
239
271
|
let handle: ReturnType<typeof setTimeout> | undefined;
|
|
@@ -76,13 +76,34 @@ interface ErrorItem {
|
|
|
76
76
|
message: string;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Every issue the error carries: a schema refusal's or a server
|
|
81
|
+
* `ValidationError`'s `data.issues`, else its one path and message. It read
|
|
82
|
+
* `error.value` before, a shape no error has had since errors became
|
|
83
|
+
* declared, so the list always showed the whole message under "Form".
|
|
84
|
+
*/
|
|
79
85
|
const collectErrors = (error: Error): ErrorItem[] => {
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
const data = (
|
|
87
|
+
error as Error & {
|
|
88
|
+
data?: {
|
|
89
|
+
message?: string;
|
|
90
|
+
path?: string;
|
|
91
|
+
issues?: Array<{ path: string; message: string }>;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
).data;
|
|
95
|
+
if (data?.issues?.length) {
|
|
96
|
+
return data.issues.map((issue) => ({
|
|
97
|
+
path: issue.path,
|
|
98
|
+
message: issue.message,
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
path: data?.path ?? "",
|
|
104
|
+
message: data?.message ?? error.message ?? "Invalid",
|
|
105
|
+
},
|
|
106
|
+
];
|
|
86
107
|
};
|
|
87
108
|
|
|
88
109
|
const focusError = (path: string, formId: string) => {
|
package/src/form/Control.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { Check, X } from "lucide-react";
|
|
|
15
15
|
import {
|
|
16
16
|
type ComponentType,
|
|
17
17
|
type HTMLAttributes,
|
|
18
|
+
type ReactElement,
|
|
18
19
|
type ReactNode,
|
|
19
20
|
useEffect,
|
|
20
21
|
useState,
|
|
@@ -338,6 +339,17 @@ export interface ControlProps {
|
|
|
338
339
|
* `w-max min-w-48` to size it from its content rather than its trigger.
|
|
339
340
|
*/
|
|
340
341
|
popupClassName?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Forwarded to `ControlSelect` and `ControlDateRange`: an element drawn
|
|
344
|
+
* INSTEAD of the field, as the button that opens its popup. See
|
|
345
|
+
* `ControlSelectProps.trigger`.
|
|
346
|
+
*/
|
|
347
|
+
trigger?: ReactElement<{ children?: ReactNode }>;
|
|
348
|
+
/**
|
|
349
|
+
* Forwarded to `ControlSelect` and `ControlDateRange`: the popup opened or
|
|
350
|
+
* closed.
|
|
351
|
+
*/
|
|
352
|
+
onPopupOpenChange?: (open: boolean) => void;
|
|
341
353
|
/**
|
|
342
354
|
* Render a managed upload control (image preview, multi, drag-drop)
|
|
343
355
|
* that calls `FileController.uploadFile` and stores the file ID(s) in
|
|
@@ -395,6 +407,7 @@ export const Control = (props: ControlProps) => {
|
|
|
395
407
|
return wrapWithSlots(
|
|
396
408
|
merged,
|
|
397
409
|
<FormField
|
|
410
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
398
411
|
id={meta.id}
|
|
399
412
|
label={merged.label ?? meta.label}
|
|
400
413
|
description={merged.description ?? meta.description}
|
|
@@ -528,6 +541,8 @@ export const Control = (props: ControlProps) => {
|
|
|
528
541
|
// From `props`, like the select's below: a node has no place in a
|
|
529
542
|
// schema's `$control`.
|
|
530
543
|
triggerPrefix={props.triggerPrefix}
|
|
544
|
+
trigger={props.trigger}
|
|
545
|
+
onPopupOpenChange={props.onPopupOpenChange}
|
|
531
546
|
/>,
|
|
532
547
|
);
|
|
533
548
|
}
|
|
@@ -585,6 +600,8 @@ export const Control = (props: ControlProps) => {
|
|
|
585
600
|
popupHeader={props.popupHeader}
|
|
586
601
|
triggerPrefix={props.triggerPrefix}
|
|
587
602
|
popupClassName={merged.popupClassName}
|
|
603
|
+
trigger={props.trigger}
|
|
604
|
+
onPopupOpenChange={props.onPopupOpenChange}
|
|
588
605
|
/>,
|
|
589
606
|
);
|
|
590
607
|
}
|
|
@@ -594,6 +611,7 @@ export const Control = (props: ControlProps) => {
|
|
|
594
611
|
return wrapWithSlots(
|
|
595
612
|
merged,
|
|
596
613
|
<FormField
|
|
614
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
597
615
|
id={meta.id}
|
|
598
616
|
label={merged.label ?? meta.label}
|
|
599
617
|
description={merged.description ?? meta.description}
|
|
@@ -656,6 +674,7 @@ export const Control = (props: ControlProps) => {
|
|
|
656
674
|
return wrapWithSlots(
|
|
657
675
|
merged,
|
|
658
676
|
<FormField
|
|
677
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
659
678
|
id={meta.id}
|
|
660
679
|
label={merged.label ?? meta.label}
|
|
661
680
|
description={merged.description ?? meta.description}
|
|
@@ -682,6 +701,7 @@ export const Control = (props: ControlProps) => {
|
|
|
682
701
|
return wrapWithSlots(
|
|
683
702
|
merged,
|
|
684
703
|
<FormField
|
|
704
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
685
705
|
id={meta.id}
|
|
686
706
|
label={merged.label ?? meta.label}
|
|
687
707
|
description={merged.description ?? meta.description}
|
|
@@ -721,6 +741,7 @@ export const Control = (props: ControlProps) => {
|
|
|
721
741
|
return wrapWithSlots(
|
|
722
742
|
merged,
|
|
723
743
|
<ControlPassword
|
|
744
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
724
745
|
id={meta.id}
|
|
725
746
|
name={props.input.props.name}
|
|
726
747
|
label={merged.label ?? meta.label}
|
|
@@ -796,6 +817,7 @@ export const Control = (props: ControlProps) => {
|
|
|
796
817
|
return wrapWithSlots(
|
|
797
818
|
merged,
|
|
798
819
|
<FormField
|
|
820
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
799
821
|
id={meta.id}
|
|
800
822
|
label={merged.label ?? meta.label}
|
|
801
823
|
description={merged.description ?? meta.description}
|
package/src/form/ControlDate.tsx
CHANGED
|
@@ -114,6 +114,7 @@ export const ControlDate = (props: ControlDateProps) => {
|
|
|
114
114
|
if (isTime) {
|
|
115
115
|
return (
|
|
116
116
|
<FormField
|
|
117
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
117
118
|
id={meta.id}
|
|
118
119
|
label={meta.label}
|
|
119
120
|
description={meta.description}
|
|
@@ -140,6 +141,7 @@ export const ControlDate = (props: ControlDateProps) => {
|
|
|
140
141
|
if (props.month) {
|
|
141
142
|
return (
|
|
142
143
|
<FormField
|
|
144
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
143
145
|
id={meta.id}
|
|
144
146
|
label={meta.label}
|
|
145
147
|
description={meta.description}
|
|
@@ -162,6 +164,7 @@ export const ControlDate = (props: ControlDateProps) => {
|
|
|
162
164
|
|
|
163
165
|
return (
|
|
164
166
|
<FormField
|
|
167
|
+
onBlur={() => props.input.form?.blur(props.input.path)}
|
|
165
168
|
id={meta.id}
|
|
166
169
|
label={meta.label}
|
|
167
170
|
description={meta.description}
|