@alepha/ui 0.36.1 → 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 +6 -0
- package/dist/ai/AiChatMessage.d.ts.map +1 -1
- package/dist/ai/AiChatMessage.js +20 -4
- 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 +12 -0
- package/dist/ai/useAiChat.d.ts.map +1 -1
- package/dist/ai/useAiChat.js +32 -15
- 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 +14 -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 +36 -2
- package/src/ai/AiChatPanel.tsx +252 -0
- package/src/ai/__tests__/AiChat.browser.spec.tsx +187 -5
- package/src/ai/index.ts +8 -4
- package/src/ai/useAiChat.ts +63 -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 +18 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.js","names":[],"sources":["../../src/core/Stepper.tsx"],"sourcesContent":["import { Check } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { cn } from \"./utils.ts\";\n\n/** One step of a {@link Stepper}. */\nexport interface StepperStep {\n /** Unique among the steps. */\n key: string;\n label: ReactNode;\n /** A short line under the label. */\n description?: ReactNode;\n}\n\n/** Where a step stands against the current one. */\nexport type StepperStepState = \"done\" | \"current\" | \"upcoming\";\n\nexport interface StepperProps {\n steps: StepperStep[];\n /** The index of the step on screen. */\n current: number;\n /**\n * Called with a step's index when it is clicked. Only the steps already\n * done are clickable: going forward is the caller's to validate.\n */\n onStepClick?: (index: number) => void;\n /** The list's accessible name. Defaults to \"Steps\". */\n label?: string;\n className?: string;\n}\n\n/** The state of the step at `index` when `current` is on screen. */\nexport const stepperStepState = (\n index: number,\n current: number,\n): StepperStepState =>\n index < current ? \"done\" : index === current ? \"current\" : \"upcoming\";\n\n/**\n * The header of a multi-step form: each step numbered, with its state drawn\n * (a check once done, the current one highlighted, the ones to come muted)\n * and joined by a line that fills as the steps are done.\n *\n * It draws the steps and nothing else: the body and the Back / Next buttons\n * stay the caller's, which is where validating a step belongs.\n */\nexport const Stepper = (props: StepperProps) => (\n <ol\n data-slot=\"stepper\"\n aria-label={props.label ?? \"Steps\"}\n className={cn(\"flex w-full items-start gap-2\", props.className)}\n >\n {props.steps.map((step, index) => {\n const state = stepperStepState(index, props.current);\n const clickable = state === \"done\" && Boolean(props.onStepClick);\n const last = index === props.steps.length - 1;\n return (\n <li\n key={step.key}\n data-state={state}\n aria-current={state === \"current\" ? \"step\" : undefined}\n className={cn(\n \"flex min-w-0 flex-1 items-start gap-2\",\n last && \"flex-none\",\n )}\n >\n <button\n type=\"button\"\n disabled={!clickable}\n onClick={clickable ? () => props.onStepClick?.(index) : undefined}\n className={cn(\n \"flex min-w-0 items-start gap-2 text-left\",\n clickable && \"cursor-pointer\",\n !clickable && \"cursor-default\",\n )}\n >\n <span\n className={cn(\n \"flex size-7 shrink-0 items-center justify-center rounded-full border text-xs font-semibold tabular-nums transition-colors\",\n state === \"done\" &&\n \"bg-primary border-primary text-primary-foreground\",\n state === \"current\" &&\n \"border-primary text-primary ring-primary/20 ring-4\",\n state === \"upcoming\" && \"text-muted-foreground\",\n )}\n >\n {state === \"done\" ? <Check className=\"size-3.5\" /> : index + 1}\n </span>\n <span className=\"flex min-w-0 flex-col pt-1\">\n <span\n className={cn(\n \"truncate text-sm font-medium\",\n state === \"upcoming\" && \"text-muted-foreground\",\n )}\n >\n {step.label}\n </span>\n {step.description && (\n <span className=\"text-muted-foreground truncate text-xs\">\n {step.description}\n </span>\n )}\n </span>\n </button>\n {!last && (\n <span\n aria-hidden\n className={cn(\n \"mt-3.5 h-px min-w-4 flex-1\",\n state === \"done\" ? \"bg-primary\" : \"bg-border\",\n )}\n />\n )}\n </li>\n );\n })}\n </ol>\n);\n"],"mappings":";;;;;AAgCA,MAAa,oBACX,OACA,YAEA,QAAQ,UAAU,SAAS,UAAU,UAAU,YAAY;;;;;;;;;AAU7D,MAAa,WAAW,UACtB,oBAAC,MAAD;CACE,aAAU;CACV,cAAY,MAAM,SAAS;CAC3B,WAAW,GAAG,iCAAiC,MAAM,SAAS;CAE7D,UAAA,MAAM,MAAM,KAAK,MAAM,UAAU;EAChC,MAAM,QAAQ,iBAAiB,OAAO,MAAM,OAAO;EACnD,MAAM,YAAY,UAAU,UAAU,QAAQ,MAAM,WAAW;EAC/D,MAAM,OAAO,UAAU,MAAM,MAAM,SAAS;EAC5C,OACE,qBAAC,MAAD;GAEE,cAAY;GACZ,gBAAc,UAAU,YAAY,SAAS,KAAA;GAC7C,WAAW,GACT,yCACA,QAAQ,WACV;GAPF,UAAA,CASE,qBAAC,UAAD;IACE,MAAK;IACL,UAAU,CAAC;IACX,SAAS,kBAAkB,MAAM,cAAc,KAAK,IAAI,KAAA;IACxD,WAAW,GACT,4CACA,aAAa,kBACb,CAAC,aAAa,gBAChB;IARF,UAAA,CAUE,oBAAC,QAAD;KACE,WAAW,GACT,6HACA,UAAU,UACR,qDACF,UAAU,aACR,sDACF,UAAU,cAAc,uBAC1B;KAEC,UAAA,UAAU,SAAS,oBAAC,OAAD,EAAO,WAAU,WAAY,CAAA,IAAI,QAAQ;IACzD,CAAA,GACN,qBAAC,QAAD;KAAM,WAAU;KAAhB,UAAA,CACE,oBAAC,QAAD;MACE,WAAW,GACT,gCACA,UAAU,cAAc,uBAC1B;MAEC,UAAA,KAAK;KACF,CAAA,GACL,KAAK,eACJ,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,KAAK;KACF,CAAA,CAEJ;IACA,CAAA,CAAA;GACP,CAAA,GAAA,CAAC,QACA,oBAAC,QAAD;IACE,eAAA;IACA,WAAW,GACT,8BACA,UAAU,SAAS,eAAe,WACpC;GACD,CAAA,CAED;EAvDG,GAAA,KAAK,GAuDR;CAER,CAAC;AACC,CAAA"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export { Button, type ButtonIntent, type ButtonProps, type ButtonVariant, button
|
|
|
25
25
|
export { ButtonGroup, type ButtonGroupProps, ButtonGroupSeparator, type ButtonGroupSeparatorProps, ButtonGroupText, type ButtonGroupTextProps, buttonGroupVariants, } from "./ButtonGroup.tsx";
|
|
26
26
|
export { Card, type CardProps, CardAction, type CardActionProps, CardContent, type CardContentProps, CardDescription, type CardDescriptionProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardTitle, type CardTitleProps, } from "./Card.tsx";
|
|
27
27
|
export { Checkbox, type CheckboxProps } from "./Checkbox.tsx";
|
|
28
|
+
export { Collapsible, type CollapsibleProps, CollapsiblePanel, type CollapsiblePanelProps, CollapsibleTrigger, type CollapsibleTriggerProps, } from "./Collapsible.tsx";
|
|
28
29
|
export { Combobox, ComboboxChip, type ComboboxChipProps, ComboboxChips, type ComboboxChipsProps, ComboboxChipsInput, type ComboboxChipsInputProps, ComboboxCollection, type ComboboxCollectionProps, ComboboxContent, type ComboboxContentProps, ComboboxEmpty, type ComboboxEmptyProps, ComboboxGroup, type ComboboxGroupProps, ComboboxInput, type ComboboxInputProps, ComboboxItem, type ComboboxItemProps, ComboboxLabel, type ComboboxLabelProps, ComboboxList, type ComboboxListProps, ComboboxSeparator, type ComboboxSeparatorProps, ComboboxTrigger, type ComboboxTriggerProps, ComboboxValue, type ComboboxValueProps, useComboboxAnchor, } from "./Combobox.tsx";
|
|
29
30
|
export { ContextMenu, type ContextMenuProps, ContextMenuCheckboxItem, type ContextMenuCheckboxItemProps, ContextMenuContent, type ContextMenuContentProps, ContextMenuGroup, type ContextMenuGroupProps, ContextMenuItem, type ContextMenuItemProps, ContextMenuLabel, type ContextMenuLabelProps, ContextMenuPortal, type ContextMenuPortalProps, ContextMenuRadioGroup, type ContextMenuRadioGroupProps, ContextMenuRadioItem, type ContextMenuRadioItemProps, ContextMenuSeparator, type ContextMenuSeparatorProps, ContextMenuShortcut, type ContextMenuShortcutProps, ContextMenuSub, type ContextMenuSubProps, ContextMenuSubContent, type ContextMenuSubContentProps, ContextMenuSubTrigger, type ContextMenuSubTriggerProps, ContextMenuTrigger, type ContextMenuTriggerProps, } from "./ContextMenu.tsx";
|
|
30
31
|
export { Dialog, type DialogProps, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderProps, DialogOverlay, type DialogOverlayProps, DialogPortal, type DialogPortalProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, } from "./Dialog.tsx";
|
|
@@ -45,6 +46,7 @@ export { Pagination, type PaginationProps, PaginationContent, type PaginationCon
|
|
|
45
46
|
export { PaneRail, type PaneRailProps } from "./PaneRail.tsx";
|
|
46
47
|
export { Popover, type PopoverProps, PopoverContent, type PopoverContentProps, PopoverDescription, type PopoverDescriptionProps, PopoverHeader, type PopoverHeaderProps, PopoverTitle, type PopoverTitleProps, PopoverTrigger, type PopoverTriggerProps, } from "./Popover.tsx";
|
|
47
48
|
export { Progress, type ProgressProps, ProgressIndicator, type ProgressIndicatorProps, ProgressLabel, type ProgressLabelProps, ProgressTrack, type ProgressTrackProps, ProgressValue, type ProgressValueProps, } from "./Progress.tsx";
|
|
49
|
+
export { Stepper, type StepperProps, type StepperStep, type StepperStepState, stepperStepState, } from "./Stepper.tsx";
|
|
48
50
|
export { Segmented, type SegmentedOption, type SegmentedProps, } from "./Segmented.tsx";
|
|
49
51
|
export { Separator, type SeparatorProps } from "./Separator.tsx";
|
|
50
52
|
export { Sheet, type SheetProps, SheetClose, type SheetCloseProps, SheetContent, type SheetContentProps, SheetDescription, type SheetDescriptionProps, SheetFooter, type SheetFooterProps, SheetHeader, type SheetHeaderProps, SheetTitle, type SheetTitleProps, SheetTrigger, type SheetTriggerProps, } from "./Sheet.tsx";
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,KAAK,EACL,KAAK,UAAU,EACf,WAAW,EACX,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,KAAK,sBAAsB,E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AAK,YAAY,EACjB,cAAc,EACd,KAAK,mBAAmB,EACxB,eAAe,EACf,KAAK,oBAAoB,EACzB,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,SAAS,EACT,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,KAAK,EACL,KAAK,UAAU,EACf,WAAW,EACX,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,gBAAgB,EAChB,KAA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,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EACL,OAAO,EACP,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,mBAAmB,EACxB,eAAe,EACf,KAAK,oBAAoB,EACzB,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,SAAS,EACT,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,QAAQ,GACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { Button, buttonVariants } from "./Button.js";
|
|
|
8
8
|
import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText, buttonGroupVariants } from "./ButtonGroup.js";
|
|
9
9
|
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./Card.js";
|
|
10
10
|
import { Checkbox } from "./Checkbox.js";
|
|
11
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "./Collapsible.js";
|
|
11
12
|
import { Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, useComboboxAnchor } from "./Combobox.js";
|
|
12
13
|
import { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from "./ContextMenu.js";
|
|
13
14
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./Dialog.js";
|
|
@@ -28,6 +29,7 @@ import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, Pagi
|
|
|
28
29
|
import { PaneRail } from "./PaneRail.js";
|
|
29
30
|
import { Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger } from "./Popover.js";
|
|
30
31
|
import { Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue } from "./Progress.js";
|
|
32
|
+
import { Stepper, stepperStepState } from "./Stepper.js";
|
|
31
33
|
import { Segmented } from "./Segmented.js";
|
|
32
34
|
import { Separator } from "./Separator.js";
|
|
33
35
|
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./Sheet.js";
|
|
@@ -48,4 +50,4 @@ import { UserAvatar } from "./UserAvatar.js";
|
|
|
48
50
|
import { useToast } from "./useToast.js";
|
|
49
51
|
import { useUndoable } from "./useUndoable.js";
|
|
50
52
|
import { cn, formatBytes } from "./utils.js";
|
|
51
|
-
export { Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BrandIcon, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogProvider, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FileImage, FilterSlot, Highlight, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PaneRail, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, Segmented, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TimeAgo, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserAvatar, badgeVariants, buttonGroupVariants, buttonVariants, cn, formatBytes, highlightRanges, tabsListVariants, useComboboxAnchor, useDialog, useHasDialogProvider, useIsMobile, useSidebar, useToast, useUndoable };
|
|
53
|
+
export { Alert, AlertAction, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, BrandIcon, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsiblePanel, CollapsibleTrigger, Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxTrigger, ComboboxValue, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogProvider, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerSwipeHandle, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FileImage, FilterSlot, Highlight, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Kbd, KbdGroup, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PaneRail, Popover, PopoverContent, PopoverDescription, PopoverHeader, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, Segmented, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Stepper, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, TimeAgo, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UserAvatar, badgeVariants, buttonGroupVariants, buttonVariants, cn, formatBytes, highlightRanges, stepperStepState, tabsListVariants, useComboboxAnchor, useDialog, useHasDialogProvider, useIsMobile, useSidebar, useToast, useUndoable };
|
package/dist/core/useToast.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import { toast } from "sonner";
|
|
2
|
+
import { toast as toast$1 } from "sonner";
|
|
3
3
|
// src/core/useToast.tsx
|
|
4
4
|
const toSonner = (options) => options;
|
|
5
|
-
const toast
|
|
5
|
+
const toast = {
|
|
6
6
|
show(message, intent = "primary", options) {
|
|
7
7
|
const opts = toSonner(options);
|
|
8
|
-
if (intent === "success") return toast.success(message, opts);
|
|
9
|
-
if (intent === "danger") return toast.error(message, opts);
|
|
10
|
-
if (intent === "warning") return toast.warning(message, opts);
|
|
11
|
-
if (intent === "info") return toast.info(message, opts);
|
|
12
|
-
return toast.message(message, opts);
|
|
8
|
+
if (intent === "success") return toast$1.success(message, opts);
|
|
9
|
+
if (intent === "danger") return toast$1.error(message, opts);
|
|
10
|
+
if (intent === "warning") return toast$1.warning(message, opts);
|
|
11
|
+
if (intent === "info") return toast$1.info(message, opts);
|
|
12
|
+
return toast$1.message(message, opts);
|
|
13
13
|
},
|
|
14
14
|
success(message, options) {
|
|
15
|
-
toast.success(message, toSonner(options));
|
|
15
|
+
toast$1.success(message, toSonner(options));
|
|
16
16
|
},
|
|
17
17
|
error(message, options) {
|
|
18
|
-
toast.error(message, toSonner(options));
|
|
18
|
+
toast$1.error(message, toSonner(options));
|
|
19
19
|
},
|
|
20
20
|
warning(message, options) {
|
|
21
|
-
toast.warning(message, toSonner(options));
|
|
21
|
+
toast$1.warning(message, toSonner(options));
|
|
22
22
|
},
|
|
23
23
|
info(message, options) {
|
|
24
|
-
toast.info(message, toSonner(options));
|
|
24
|
+
toast$1.info(message, toSonner(options));
|
|
25
25
|
},
|
|
26
26
|
dismiss(id) {
|
|
27
|
-
toast.dismiss(id);
|
|
27
|
+
toast$1.dismiss(id);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
function useToast() {
|
|
31
|
-
return toast
|
|
31
|
+
return toast;
|
|
32
32
|
}
|
|
33
33
|
export { useToast };
|
|
34
34
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToast.js","names":["
|
|
1
|
+
{"version":3,"file":"useToast.js","names":["sonner"],"sources":["../../src/core/useToast.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { toast as sonner } from \"sonner\";\n\n/**\n * Intent buckets for `Toast.show`. Maps internally to icon + colour\n * variants. Keep the vocabulary stable — call sites name *meaning*,\n * not visual style.\n */\nexport type ToastIntent = \"primary\" | \"success\" | \"info\" | \"warning\" | \"danger\";\n\n/**\n * Cross-intent options. Intentionally a small, framework-defined shape\n * (rather than re-exporting sonner's `ExternalToast`) so the underlying\n * library can be swapped without touching consumer code. Add fields\n * here as consumers genuinely need them.\n */\nexport interface ToastOptions {\n /**\n * Action button shown next to the toast.\n */\n action?: { label: string; onClick: () => void };\n /**\n * Auto-dismiss delay in ms.\n */\n duration?: number;\n /**\n * Secondary description line under the main message.\n */\n description?: string;\n /**\n * Reuse an id to replace a toast in place rather than stacking a second\n * one: a \"Shelving...\" toast that becomes \"Shelved\" keeps its slot.\n */\n id?: string | number;\n /**\n * Called when the reader closes the toast (the close button, a swipe).\n * Not called on an action click or a timeout.\n */\n onDismiss?: () => void;\n /**\n * Called when the toast times out on its own.\n */\n onAutoClose?: () => void;\n}\n\n/**\n * Toast API returned by {@link useToast}. Per-intent shortcuts cover\n * the common case (`toast.success(msg)`); `show` is the generic entry\n * for code that picks the intent dynamically.\n */\nexport interface Toast {\n /**\n * Returns the toast's id, for `dismiss` or to replace it with `id`.\n */\n show(\n message: string,\n intent?: ToastIntent,\n options?: ToastOptions,\n ): string | number;\n success(message: string, options?: ToastOptions): void;\n error(message: string, options?: ToastOptions): void;\n warning(message: string, options?: ToastOptions): void;\n info(message: string, options?: ToastOptions): void;\n /**\n * Close one toast by the id a call above returned, or every toast.\n */\n dismiss(id?: string | number): void;\n}\n\n/**\n * Imperative toast hook. Requires a `<Toaster />` mounted somewhere in\n * the tree (`Toaster`, from the same `@alepha/ui` module).\n *\n * The underlying library (currently sonner) is an implementation\n * detail — never exported from this module. Consumers depend on the\n * `Toast` interface, not on sonner's API. This keeps the door open to\n * swapping libraries or adding cross-cutting behavior (dedup,\n * rate-limit, branded icons) without rippling through call sites.\n *\n * @example\n * const toast = useToast();\n * toast.success(\"Saved\");\n * toast.error(err.message, { description: \"Please try again\" });\n * toast.show(message, intent, { action: { label: \"Undo\", onClick } });\n */\n// Bridge our shape to sonner's. ToastOptions is intentionally a\n// strict subset; using sonner's own parameter type derives it without\n// importing the name, so this file's type surface stays sonner-free.\ntype SonnerOptions = Parameters<typeof sonner.success>[1];\nconst toSonner = (options?: ToastOptions): SonnerOptions =>\n options as SonnerOptions;\n\n// A single module-level instance: the API closes over nothing per-render,\n// and consumers put it in useCallback/useEffect dependency arrays — a fresh\n// object each render would invalidate those deps every render, turning any\n// state-setting effect downstream into an infinite loop.\nconst toast: Toast = {\n show(message, intent = \"primary\", options) {\n const opts = toSonner(options);\n if (intent === \"success\") return sonner.success(message, opts);\n if (intent === \"danger\") return sonner.error(message, opts);\n if (intent === \"warning\") return sonner.warning(message, opts);\n if (intent === \"info\") return sonner.info(message, opts);\n // Neutral \"primary\" — sonner exposes `.message` for the unflavoured toast.\n return sonner.message(message, opts);\n },\n success(message, options) {\n sonner.success(message, toSonner(options));\n },\n error(message, options) {\n sonner.error(message, toSonner(options));\n },\n warning(message, options) {\n sonner.warning(message, toSonner(options));\n },\n info(message, options) {\n sonner.info(message, toSonner(options));\n },\n dismiss(id) {\n sonner.dismiss(id);\n },\n};\n\nexport function useToast(): Toast {\n return toast;\n}\n"],"mappings":";;;AA4FA,MAAM,YAAY,YAChB;AAMF,MAAM,QAAe;CACnB,KAAK,SAAS,SAAS,WAAW,SAAS;EACzC,MAAM,OAAO,SAAS,OAAO;EAC7B,IAAI,WAAW,WAAW,OAAOA,QAAO,QAAQ,SAAS,IAAI;EAC7D,IAAI,WAAW,UAAU,OAAOA,QAAO,MAAM,SAAS,IAAI;EAC1D,IAAI,WAAW,WAAW,OAAOA,QAAO,QAAQ,SAAS,IAAI;EAC7D,IAAI,WAAW,QAAQ,OAAOA,QAAO,KAAK,SAAS,IAAI;EAEvD,OAAOA,QAAO,QAAQ,SAAS,IAAI;CACrC;CACA,QAAQ,SAAS,SAAS;EACxB,QAAO,QAAQ,SAAS,SAAS,OAAO,CAAC;CAC3C;CACA,MAAM,SAAS,SAAS;EACtB,QAAO,MAAM,SAAS,SAAS,OAAO,CAAC;CACzC;CACA,QAAQ,SAAS,SAAS;EACxB,QAAO,QAAQ,SAAS,SAAS,OAAO,CAAC;CAC3C;CACA,KAAK,SAAS,SAAS;EACrB,QAAO,KAAK,SAAS,SAAS,OAAO,CAAC;CACxC;CACA,QAAQ,IAAI;EACV,QAAO,QAAQ,EAAE;CACnB;AACF;AAEA,SAAgB,WAAkB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CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/form/AutoForm.js
CHANGED
|
@@ -28,6 +28,35 @@ const AutoForm = (props) => {
|
|
|
28
28
|
const autoSaveDelay = typeof autoSave === "object" ? autoSave?.delay ?? 600 : 600;
|
|
29
29
|
const autoSaveEnabled = !!autoSave;
|
|
30
30
|
const alepha = useAlepha();
|
|
31
|
+
const formId = props.form.id;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const timers = [];
|
|
34
|
+
const off = alepha.events.on("form:submit:error", (event) => {
|
|
35
|
+
if (event.id !== formId) return;
|
|
36
|
+
if (Object.keys(props.form.errors).length === 0) return;
|
|
37
|
+
const reveal = (attempt) => {
|
|
38
|
+
const target = document.getElementById(formId)?.querySelector("[aria-invalid=\"true\"]");
|
|
39
|
+
if (!target) {
|
|
40
|
+
if (attempt < 5) timers.push(setTimeout(() => reveal(attempt + 1), 16));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
target.scrollIntoView?.({
|
|
44
|
+
block: "center",
|
|
45
|
+
behavior: "smooth"
|
|
46
|
+
});
|
|
47
|
+
target.focus({ preventScroll: true });
|
|
48
|
+
};
|
|
49
|
+
timers.push(setTimeout(() => reveal(0), 0));
|
|
50
|
+
});
|
|
51
|
+
return () => {
|
|
52
|
+
off();
|
|
53
|
+
for (const timer of timers) clearTimeout(timer);
|
|
54
|
+
};
|
|
55
|
+
}, [
|
|
56
|
+
alepha,
|
|
57
|
+
formId,
|
|
58
|
+
props.form
|
|
59
|
+
]);
|
|
31
60
|
useEffect(() => {
|
|
32
61
|
if (!autoSaveEnabled) return;
|
|
33
62
|
let handle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoForm.js","names":[],"sources":["../../src/form/AutoForm.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { type ZObject, type ZType, z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { type ReactNode, useEffect, useMemo } from \"react\";\n\nimport type { ButtonIntent, ButtonVariant } from \"../core/Button.tsx\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardTitle,\n} from \"../core/Card.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { AutoFormBottomBar } from \"./AutoFormBottomBar.tsx\";\nimport { AutoFormGroupBlock } from \"./AutoFormGroupBlock.tsx\";\nimport { autoGroupSchema } from \"./autoFormGroups.ts\";\nimport type { ControlProps } from \"./Control.tsx\";\nimport { FormFieldAutoSaveProvider } from \"./FormFieldAutoSaveProvider.tsx\";\nimport { FormFieldLayoutProvider } from \"./FormFieldLayoutProvider.tsx\";\nimport { FormFieldRequiredMarkerProvider } from \"./FormFieldRequiredMarkerProvider.tsx\";\nimport { iconFor } from \"./iconHint.tsx\";\n\nexport interface AutoFormProps<T extends ZObject> {\n /**\n * Form model returned by `useForm()`. The schema drives every field.\n */\n form: FormModel<T>;\n\n /**\n * Header icon (lucide name).\n */\n icon?: string;\n /**\n * Header title.\n */\n title?: string;\n /**\n * Header description / subtitle.\n */\n description?: string;\n /**\n * Extra content rendered on the right of the header (e.g. a status badge).\n * In `card` mode it renders as the `CardAction`; otherwise it is pushed to\n * the right edge of the header box.\n */\n headerAction?: ReactNode;\n\n /**\n * Manual layout: list of groups, each with its own fields.\n * If neither `groups` nor `autoGroup` is set, every top-level schema\n * field is rendered in a single ungrouped column.\n */\n groups?: AutoFormGroup[];\n\n /**\n * Auto-group: scan the schema, primitive fields land in a \"General\"\n * group, each object/array-of-objects becomes its own group.\n */\n autoGroup?: boolean | { defaultTitle?: string; defaultIcon?: string };\n\n /**\n * Per-field control overrides keyed by field name (also works without groups).\n */\n fields?: Partial<\n Record<keyof T[\"shape\"] & string, Partial<Omit<ControlProps, \"input\">>>\n >;\n\n /**\n * Localize field labels the schema doesn't carry. When set, each field's\n * label is resolved from the app dictionary via\n * `tr(\\`${i18nPrefix}.${fieldName}\\`)` and its description via\n * `tr(\\`${i18nPrefix}.${fieldName}.desc\\`)`, falling back to the\n * schema-derived label/description when the key is absent. Lets a generic\n * AutoForm (e.g. the parameters admin, whose schemas rarely set `title`)\n * render translated labels without per-schema annotations. Explicit\n * `fields[name].label` overrides still win.\n */\n i18nPrefix?: string;\n\n /**\n * Submit button label.\n */\n submitLabel?: string;\n /**\n * Hide built-in submit button.\n */\n noSubmit?: boolean;\n /**\n * Disable submit when form is pristine (not dirty).\n */\n disabledIfPristine?: boolean;\n /**\n * Disable the entire form (cascades to controls).\n */\n disabled?: boolean;\n\n /**\n * Show the red `*` next to the label of every required field.\n *\n * Set `false` on a form where the marker is not news — one whose fields are\n * nearly all required, or where the one required field is self-evidently so\n * (a project's Name). A page of asterisks tells the reader nothing about\n * which field to be careful with, which is the only thing the marker is for.\n *\n * Purely visual. `aria-required` still comes from the schema, so a screen\n * reader announces the field as required either way — the marker itself is\n * `aria-hidden` and never carried that.\n *\n * @default true\n */\n requiredMarker?: boolean;\n\n /**\n * Cancel button — hidden when omitted.\n */\n onCancel?: () => void;\n /**\n * Skip the reset button in the bottom bar.\n */\n skipReset?: boolean;\n /**\n * Skip the entire bottom bar.\n */\n skipBottomBar?: boolean;\n\n /**\n * Extra action buttons in the bottom bar (left side).\n */\n actions?: AutoFormAction[];\n\n /**\n * Extra content rendered above the bottom bar.\n */\n footer?: ReactNode;\n\n /**\n * Extra classes applied to the form wrapper.\n */\n className?: string;\n\n /**\n * Override the column classes of each field group's grid. By default fields\n * lay out on a fixed 12-column grid and each field's span is derived from\n * width heuristics (`$control.width`, type, …).\n *\n * Pass responsive column classes — e.g.\n * `\"grid-cols-1 md:grid-cols-2 xl:grid-cols-3\"` — to get N equal columns per\n * breakpoint instead; when set, every field occupies a single cell and the\n * per-field width heuristics are ignored.\n */\n gridClassName?: string;\n\n /**\n * Wrap the form in a `<Card>`:\n * - the header (icon + title/description) renders as the `CardHeader`,\n * - the field groups render as the `CardContent`,\n * - the action bar (cancel / reset / actions / submit) renders as the\n * `CardFooter`.\n *\n * When omitted, the form uses its default chrome (a muted header box and a\n * standalone bottom bar). The footer is hidden in `autoSave` mode just like\n * the default bottom bar.\n *\n * Pass a string to override the `<Card>` className (e.g. `\"rounded-none\"` to\n * make the card sit flush against neighbouring panes).\n */\n card?: boolean | string;\n\n /**\n * Fill the available height: the card stretches to `100%` of its container\n * and the body (field groups) scrolls while the header and footer stay\n * pinned. Only meaningful in `card` mode.\n */\n fill?: boolean;\n\n /**\n * Visual layout for every nested Control.\n * - `\"stack\"` (default): label on top, control below — the classic form look.\n * - `\"row\"`: settings-style — each control sits on its own line with the\n * label/description on the left and the control on the right. Each\n * group renders as a bordered card with horizontal dividers.\n *\n * `\"row\"` **is** the settings-card shape, not an approximation of it: the\n * rows render the same markup as {@link SettingsRow}, the card the same as\n * {@link SettingsSection}, the heading through the same\n * {@link SettingsHeading}, and the action bar as the card's own last\n * divided row. So a settings card whose rows are form fields should be an\n * `AutoForm`, and reach for `SettingsSection` only for the rows that are\n * *not* fields — an avatar picker, a read-only value, a lone button.\n */\n layout?: \"stack\" | \"row\";\n\n /**\n * Auto-commit edits instead of showing a Save button.\n *\n * When enabled, every field change schedules a debounced `form.submit()`\n * and the bottom bar is hidden by default. Pass an options object to\n * customize the debounce delay (default 600ms).\n *\n * The `handler` you pass to `useForm` is the auto-commit target — it\n * runs once per quiescent edit, and any thrown error stops the loop\n * until the user edits again.\n */\n autoSave?: boolean | { delay?: number };\n}\n\n/**\n * Schema-driven form with optional grouping, header chrome, and bottom\n * bar. Every input field is resolved through `<Control>`, so schemas\n * carrying `$control` metadata configure themselves.\n */\nexport const AutoForm = <T extends ZObject>(props: AutoFormProps<T>) => {\n const { tr } = useI18n();\n const { dirty, loading } = useFormState(props.form, [\"dirty\", \"loading\"]);\n const inputs = props.form.input as Record<string, never>;\n\n // `z.object({})` rather than a hand-made `{ properties: {} }`: the latter\n // only ever worked because a prototype alias made `.properties` readable on\n // a schema, so a fake object with that key passed for one.\n const schema = (props.form.options.schema as ZObject) ?? z.object({});\n\n // ── Auto-save ─────────────────────────────────────────────────────\n // Text fields (string) are intentionally excluded: typing should not commit\n // on every keystroke. They commit via Enter (native submit) or the inline\n // tick button. Booleans / selects / uploads / etc. auto-commit on change.\n const autoSave = props.autoSave;\n const autoSaveDelay =\n typeof autoSave === \"object\" ? (autoSave?.delay ?? 600) : 600;\n const autoSaveEnabled = !!autoSave;\n const alepha = useAlepha();\n useEffect(() => {\n if (!autoSaveEnabled) return;\n let handle: ReturnType<typeof setTimeout> | undefined;\n const off = alepha.events.on(\"form:changed\", (ev) => {\n if (ev.id !== props.form.id) return;\n if (ev.initial) return;\n // FormModel paths look like \"/title\" or \"/contacts/0/email\". The\n // top-level key is the first segment after the leading slash.\n const top = ev.path.replace(/^\\//, \"\").split(\"/\")[0];\n const fieldSchema = z.schema.shape(schema)[top];\n const fieldConfig = resolveControlConfig(\n top,\n props.fields as Record<string, unknown> | undefined,\n props.groups,\n );\n // Text fields (incl. optional/nullable wrappers) should NOT auto-commit\n // on keystroke; they commit via Enter or the inline tick button.\n // Uploads commit a uuid string when the upload finishes, and selects /\n // comboboxes / segmented controls commit a discrete value on change —\n // all of those MUST auto-save even though the field schema is a string.\n const rendersAsSelect =\n !!fieldConfig.select ||\n !!fieldConfig.combobox ||\n !!fieldConfig.segmented ||\n fieldConfig.items != null ||\n isEnumSchema(fieldSchema);\n if (\n !fieldConfig.upload &&\n !rendersAsSelect &&\n isStringSchema(fieldSchema)\n )\n return;\n if (handle) clearTimeout(handle);\n handle = setTimeout(() => props.form.submit(), autoSaveDelay);\n });\n return () => {\n off();\n if (handle) clearTimeout(handle);\n };\n }, [\n alepha,\n autoSaveEnabled,\n autoSaveDelay,\n props.form,\n props.fields,\n props.groups,\n schema,\n ]);\n const skipBottomBar = props.skipBottomBar ?? autoSaveEnabled;\n\n const resolvedGroups: AutoFormGroup[] = useMemo(() => {\n if (props.groups) return props.groups.filter((g) => g.can?.() !== false);\n if (props.autoGroup) {\n const opts = typeof props.autoGroup === \"object\" ? props.autoGroup : {};\n return autoGroupSchema(schema, { tr, ...opts });\n }\n return [\n {\n fields: Object.keys(z.schema.shape(schema)),\n },\n ];\n }, [props.groups, props.autoGroup, schema]);\n\n const HeaderIcon = props.icon ? iconFor(props.icon) : undefined;\n const hasHeader = !!(\n props.title ||\n props.description ||\n HeaderIcon ||\n props.headerAction\n );\n\n const layout = props.layout ?? \"stack\";\n\n const bottomBarProps = {\n form: props.form,\n dirty,\n loading,\n disabled: props.disabled,\n disabledIfPristine: props.disabledIfPristine,\n submitLabel: props.submitLabel,\n noSubmit: props.noSubmit,\n onCancel: props.onCancel,\n skipReset: props.skipReset,\n actions: props.actions,\n };\n\n // In row layout the action bar is the card's own last row, not a second\n // bordered box floating under it — see the `layout` prop's note. `card`\n // mode already owns its footer (`CardFooter`), and a form that resolved to\n // no groups at all has nothing to put the bar inside, so both fall back to\n // the standalone bar below.\n const inCardBottomBar =\n layout === \"row\" &&\n !props.card &&\n !skipBottomBar &&\n resolvedGroups.length ? (\n <AutoFormBottomBar {...bottomBarProps} bare />\n ) : undefined;\n\n const fieldGroups = (\n <FormFieldLayoutProvider value={layout}>\n <FormFieldRequiredMarkerProvider value={props.requiredMarker ?? true}>\n <FormFieldAutoSaveProvider value={autoSaveEnabled}>\n {resolvedGroups.map((group, gi) => (\n <AutoFormGroupBlock\n key={gi}\n group={group}\n inputs={inputs}\n disabled={props.disabled}\n fields={props.fields}\n i18nPrefix={props.i18nPrefix}\n multiGroup={resolvedGroups.length > 1}\n layout={layout}\n gridClassName={props.gridClassName}\n bottomBar={\n gi === resolvedGroups.length - 1 ? inCardBottomBar : undefined\n }\n />\n ))}\n </FormFieldAutoSaveProvider>\n </FormFieldRequiredMarkerProvider>\n </FormFieldLayoutProvider>\n );\n\n if (props.card) {\n const cardClassName =\n typeof props.card === \"string\" ? props.card : undefined;\n return (\n <form\n {...props.form.props}\n className={cn(\n props.fill && \"flex h-full min-h-0 flex-col\",\n props.className,\n )}\n >\n <Card\n className={cn(\n props.fill && \"min-h-0 flex-1\",\n // Header owns its bottom padding (pb-3); trim the card's top\n // padding to match so header top/bottom are an even 12px.\n hasHeader && \"pt-3\",\n cardClassName,\n )}\n >\n {hasHeader && (\n // Explicit flex header (not shadcn CardHeader): CardHeader's grid\n // adds a phantom second row + row-gap below the title whenever a\n // CardDescription is nested, making the bottom padding larger than\n // the top. A plain flex row keeps top/bottom padding symmetric.\n <div\n data-slot=\"card-header\"\n className=\"flex items-start justify-between gap-3 border-b px-4 pb-3\"\n >\n <div className=\"flex items-center gap-3\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-0\">\n {props.title && <CardTitle>{props.title}</CardTitle>}\n {props.description && (\n <CardDescription>{props.description}</CardDescription>\n )}\n </div>\n </div>\n {props.headerAction && (\n <div className=\"shrink-0\">{props.headerAction}</div>\n )}\n </div>\n )}\n <CardContent\n className={cn(\n \"flex flex-col gap-4\",\n // `relative` alongside the scroller, not decoration: Base UI\n // gives every named control a 1×1 hidden `<input>` positioned\n // `absolute` with no offsets, and a scroller that is not itself\n // a containing block neither clips those inputs nor scrolls\n // them with the field they belong to — so a native validation\n // bubble would point at where the field used to be. #1849.\n props.fill && \"relative min-h-0 flex-1 overflow-y-auto\",\n )}\n >\n {fieldGroups}\n {props.footer}\n </CardContent>\n {!skipBottomBar && (\n <CardFooter>\n <AutoFormBottomBar {...bottomBarProps} bare />\n </CardFooter>\n )}\n </Card>\n </form>\n );\n }\n\n return (\n <form {...props.form.props} className={props.className}>\n <div className=\"flex flex-col gap-4\">\n {hasHeader && (\n <div className=\"bg-muted/40 flex items-start gap-3 rounded-md border p-4\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-1\">\n {props.title && (\n <h2 className=\"text-base font-semibold\">{props.title}</h2>\n )}\n {props.description && (\n <p className=\"text-muted-foreground text-sm\">\n {props.description}\n </p>\n )}\n </div>\n {props.headerAction && (\n <div className=\"ml-auto\">{props.headerAction}</div>\n )}\n </div>\n )}\n\n {fieldGroups}\n\n {props.footer}\n\n {!skipBottomBar && !inCardBottomBar && (\n <AutoFormBottomBar {...bottomBarProps} />\n )}\n </div>\n </form>\n );\n};\n\nexport interface AutoFormGroup {\n /**\n * Group title shown in the header.\n */\n title?: string;\n /**\n * One line under the title, for context the fields should not each repeat.\n *\n * Only rendered in `layout=\"row\"`, where the heading sits above the card\n * and there is room for it — the boxed group bar the grid layout uses is a\n * single line by construction.\n */\n description?: string;\n /**\n * Icon name (lucide) for the group header.\n */\n icon?: string;\n /**\n * Visibility predicate. Group is omitted when this returns false.\n */\n can?: () => boolean;\n /**\n * Field names from the form schema. Each renders as a `<Control>`.\n * Use the object form `{ name, ...controlProps }` for per-field overrides\n * (width, icon, custom, etc.).\n */\n fields: Array<\n string | (Partial<Omit<ControlProps, \"input\">> & { name: string })\n >;\n}\n\nexport interface AutoFormAction {\n label: string;\n icon?: string;\n variant?: ButtonVariant;\n intent?: ButtonIntent;\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n}\n\n/**\n * Detect a `z.string()` schema (incl. optional/nullable wrappers) so the\n * auto-save effect can skip keystroke commits on text fields.\n */\nfunction isStringSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n // Zod, not JSON Schema: `z.string().optional()` has no `type: \"string\"`,\n // so the optional text fields of a form used to auto-save every keystroke.\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isString(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isStringSchema);\n }\n return false;\n}\n\n/**\n * Detect an enum schema (incl. optional/nullable wrappers). Enum fields\n * render as a `<Select>`, so they must auto-commit on change like any\n * other select — never get lumped in with free-text string fields.\n */\nfunction isEnumSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isEnum(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isEnumSchema);\n }\n return false;\n}\n\n/**\n * Resolve the effective `<Control>` config for a field, merging the\n * `fields` map with any per-field override carried on a `groups` entry —\n * the same precedence `AutoFormGroupBlock` applies when rendering.\n */\nfunction resolveControlConfig(\n name: string,\n fields: Record<string, unknown> | undefined,\n groups: AutoFormGroup[] | undefined,\n): Record<string, unknown> {\n const fromMap = (fields?.[name] as Record<string, unknown>) ?? {};\n let fromGroup: Record<string, unknown> = {};\n for (const group of groups ?? []) {\n for (const field of group.fields) {\n if (typeof field === \"object\" && field.name === name) {\n fromGroup = field as Record<string, unknown>;\n }\n }\n }\n return { ...fromMap, ...fromGroup };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyNA,MAAa,YAA+B,UAA4B;CACtE,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,EAAE,OAAO,YAAY,aAAa,MAAM,MAAM,CAAC,SAAS,SAAS,CAAC;CACxE,MAAM,SAAS,MAAM,KAAK;CAK1B,MAAM,SAAU,MAAM,KAAK,QAAQ,UAAsB,EAAE,OAAO,CAAC,CAAC;CAMpE,MAAM,WAAW,MAAM;CACvB,MAAM,gBACJ,OAAO,aAAa,WAAY,UAAU,SAAS,MAAO;CAC5D,MAAM,kBAAkB,CAAC,CAAC;CAC1B,MAAM,SAAS,UAAU;CACzB,gBAAgB;EACd,IAAI,CAAC,iBAAiB;EACtB,IAAI;EACJ,MAAM,MAAM,OAAO,OAAO,GAAG,iBAAiB,OAAO;GACnD,IAAI,GA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AQ,EAAE,OAAO,OAAO,MAAe;CAC7C,IAAI,EAAE,OAAO,SAAS,KAAK,GAAG,OAAO;CACrC,IAAI,EAAE,OAAO,QAAQ,KAAK,GACxB,OAAO,EAAE,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,cAAc;CAEpD,OAAO;AACT;;;;;;AAOA,SAAS,aAAa,QAA0B;CAC9C,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAClD,MAAM,QAAQ,EAAE,OAAO,OAAO,MAAe;CAC7C,IAAI,EAAE,OAAO,OAAO,KAAK,GAAG,OAAO;CACnC,IAAI,EAAE,OAAO,QAAQ,KAAK,GACxB,OAAO,EAAE,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,YAAY;CAElD,OAAO;AACT;;;;;;AAOA,SAAS,qBACP,MACA,QACA,QACyB;CACzB,MAAM,UAAW,SAAS,SAAqC,CAAC;CAChE,IAAI,YAAqC,CAAC;CAC1C,KAAK,MAAM,SAAS,UAAU,CAAC,GAC7B,KAAK,MAAM,SAAS,MAAM,QACxB,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,MAC9C,YAAY;CAIlB,OAAO;EAAE,GAAG;EAAS,GAAG;CAAU;AACpC"}
|
|
1
|
+
{"version":3,"file":"AutoForm.js","names":[],"sources":["../../src/form/AutoForm.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { type ZObject, type ZType, z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { type ReactNode, useEffect, useMemo } from \"react\";\n\nimport type { ButtonIntent, ButtonVariant } from \"../core/Button.tsx\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardTitle,\n} from \"../core/Card.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { AutoFormBottomBar } from \"./AutoFormBottomBar.tsx\";\nimport { AutoFormGroupBlock } from \"./AutoFormGroupBlock.tsx\";\nimport { autoGroupSchema } from \"./autoFormGroups.ts\";\nimport type { ControlProps } from \"./Control.tsx\";\nimport { FormFieldAutoSaveProvider } from \"./FormFieldAutoSaveProvider.tsx\";\nimport { FormFieldLayoutProvider } from \"./FormFieldLayoutProvider.tsx\";\nimport { FormFieldRequiredMarkerProvider } from \"./FormFieldRequiredMarkerProvider.tsx\";\nimport { iconFor } from \"./iconHint.tsx\";\n\nexport interface AutoFormProps<T extends ZObject> {\n /**\n * Form model returned by `useForm()`. The schema drives every field.\n */\n form: FormModel<T>;\n\n /**\n * Header icon (lucide name).\n */\n icon?: string;\n /**\n * Header title.\n */\n title?: string;\n /**\n * Header description / subtitle.\n */\n description?: string;\n /**\n * Extra content rendered on the right of the header (e.g. a status badge).\n * In `card` mode it renders as the `CardAction`; otherwise it is pushed to\n * the right edge of the header box.\n */\n headerAction?: ReactNode;\n\n /**\n * Manual layout: list of groups, each with its own fields.\n * If neither `groups` nor `autoGroup` is set, every top-level schema\n * field is rendered in a single ungrouped column.\n */\n groups?: AutoFormGroup[];\n\n /**\n * Auto-group: scan the schema, primitive fields land in a \"General\"\n * group, each object/array-of-objects becomes its own group.\n */\n autoGroup?: boolean | { defaultTitle?: string; defaultIcon?: string };\n\n /**\n * Per-field control overrides keyed by field name (also works without groups).\n */\n fields?: Partial<\n Record<keyof T[\"shape\"] & string, Partial<Omit<ControlProps, \"input\">>>\n >;\n\n /**\n * Localize field labels the schema doesn't carry. When set, each field's\n * label is resolved from the app dictionary via\n * `tr(\\`${i18nPrefix}.${fieldName}\\`)` and its description via\n * `tr(\\`${i18nPrefix}.${fieldName}.desc\\`)`, falling back to the\n * schema-derived label/description when the key is absent. Lets a generic\n * AutoForm (e.g. the parameters admin, whose schemas rarely set `title`)\n * render translated labels without per-schema annotations. Explicit\n * `fields[name].label` overrides still win.\n */\n i18nPrefix?: string;\n\n /**\n * Submit button label.\n */\n submitLabel?: string;\n /**\n * Hide built-in submit button.\n */\n noSubmit?: boolean;\n /**\n * Disable submit when form is pristine (not dirty).\n */\n disabledIfPristine?: boolean;\n /**\n * Disable the entire form (cascades to controls).\n */\n disabled?: boolean;\n\n /**\n * Show the red `*` next to the label of every required field.\n *\n * Set `false` on a form where the marker is not news — one whose fields are\n * nearly all required, or where the one required field is self-evidently so\n * (a project's Name). A page of asterisks tells the reader nothing about\n * which field to be careful with, which is the only thing the marker is for.\n *\n * Purely visual. `aria-required` still comes from the schema, so a screen\n * reader announces the field as required either way — the marker itself is\n * `aria-hidden` and never carried that.\n *\n * @default true\n */\n requiredMarker?: boolean;\n\n /**\n * Cancel button — hidden when omitted.\n */\n onCancel?: () => void;\n /**\n * Skip the reset button in the bottom bar.\n */\n skipReset?: boolean;\n /**\n * Skip the entire bottom bar.\n */\n skipBottomBar?: boolean;\n\n /**\n * Extra action buttons in the bottom bar (left side).\n */\n actions?: AutoFormAction[];\n\n /**\n * Extra content rendered above the bottom bar.\n */\n footer?: ReactNode;\n\n /**\n * Extra classes applied to the form wrapper.\n */\n className?: string;\n\n /**\n * Override the column classes of each field group's grid. By default fields\n * lay out on a fixed 12-column grid and each field's span is derived from\n * width heuristics (`$control.width`, type, …).\n *\n * Pass responsive column classes — e.g.\n * `\"grid-cols-1 md:grid-cols-2 xl:grid-cols-3\"` — to get N equal columns per\n * breakpoint instead; when set, every field occupies a single cell and the\n * per-field width heuristics are ignored.\n */\n gridClassName?: string;\n\n /**\n * Wrap the form in a `<Card>`:\n * - the header (icon + title/description) renders as the `CardHeader`,\n * - the field groups render as the `CardContent`,\n * - the action bar (cancel / reset / actions / submit) renders as the\n * `CardFooter`.\n *\n * When omitted, the form uses its default chrome (a muted header box and a\n * standalone bottom bar). The footer is hidden in `autoSave` mode just like\n * the default bottom bar.\n *\n * Pass a string to override the `<Card>` className (e.g. `\"rounded-none\"` to\n * make the card sit flush against neighbouring panes).\n */\n card?: boolean | string;\n\n /**\n * Fill the available height: the card stretches to `100%` of its container\n * and the body (field groups) scrolls while the header and footer stay\n * pinned. Only meaningful in `card` mode.\n */\n fill?: boolean;\n\n /**\n * Visual layout for every nested Control.\n * - `\"stack\"` (default): label on top, control below — the classic form look.\n * - `\"row\"`: settings-style — each control sits on its own line with the\n * label/description on the left and the control on the right. Each\n * group renders as a bordered card with horizontal dividers.\n *\n * `\"row\"` **is** the settings-card shape, not an approximation of it: the\n * rows render the same markup as {@link SettingsRow}, the card the same as\n * {@link SettingsSection}, the heading through the same\n * {@link SettingsHeading}, and the action bar as the card's own last\n * divided row. So a settings card whose rows are form fields should be an\n * `AutoForm`, and reach for `SettingsSection` only for the rows that are\n * *not* fields — an avatar picker, a read-only value, a lone button.\n */\n layout?: \"stack\" | \"row\";\n\n /**\n * Auto-commit edits instead of showing a Save button.\n *\n * When enabled, every field change schedules a debounced `form.submit()`\n * and the bottom bar is hidden by default. Pass an options object to\n * customize the debounce delay (default 600ms).\n *\n * The `handler` you pass to `useForm` is the auto-commit target — it\n * runs once per quiescent edit, and any thrown error stops the loop\n * until the user edits again.\n */\n autoSave?: boolean | { delay?: number };\n}\n\n/**\n * Schema-driven form with optional grouping, header chrome, and bottom\n * bar. Every input field is resolved through `<Control>`, so schemas\n * carrying `$control` metadata configure themselves.\n */\nexport const AutoForm = <T extends ZObject>(props: AutoFormProps<T>) => {\n const { tr } = useI18n();\n const { dirty, loading } = useFormState(props.form, [\"dirty\", \"loading\"]);\n const inputs = props.form.input as Record<string, never>;\n\n // `z.object({})` rather than a hand-made `{ properties: {} }`: the latter\n // only ever worked because a prototype alias made `.properties` readable on\n // a schema, so a fake object with that key passed for one.\n const schema = (props.form.options.schema as ZObject) ?? z.object({});\n\n // ── Auto-save ─────────────────────────────────────────────────────\n // Text fields (string) are intentionally excluded: typing should not commit\n // on every keystroke. They commit via Enter (native submit) or the inline\n // tick button. Booleans / selects / uploads / etc. auto-commit on change.\n const autoSave = props.autoSave;\n const autoSaveDelay =\n typeof autoSave === \"object\" ? (autoSave?.delay ?? 600) : 600;\n const autoSaveEnabled = !!autoSave;\n const alepha = useAlepha();\n\n // ── First field error into view ───────────────────────────────────\n // After a refused submit, the person has to find what was refused: the\n // first invalid control, in page order, is scrolled to and focused. Its\n // `ControlObject` opens itself when the error is inside, so the control may\n // mount a frame later: a few short retries cover that.\n const formId = props.form.id;\n useEffect(() => {\n const timers: Array<ReturnType<typeof setTimeout>> = [];\n const off = alepha.events.on(\"form:submit:error\", (event) => {\n if (event.id !== formId) return;\n if (Object.keys(props.form.errors).length === 0) return;\n const reveal = (attempt: number) => {\n const target = document\n .getElementById(formId)\n ?.querySelector<HTMLElement>('[aria-invalid=\"true\"]');\n if (!target) {\n if (attempt < 5)\n timers.push(setTimeout(() => reveal(attempt + 1), 16));\n return;\n }\n target.scrollIntoView?.({ block: \"center\", behavior: \"smooth\" });\n target.focus({ preventScroll: true });\n };\n timers.push(setTimeout(() => reveal(0), 0));\n });\n return () => {\n off();\n for (const timer of timers) clearTimeout(timer);\n };\n }, [alepha, formId, props.form]);\n\n useEffect(() => {\n if (!autoSaveEnabled) return;\n let handle: ReturnType<typeof setTimeout> | undefined;\n const off = alepha.events.on(\"form:changed\", (ev) => {\n if (ev.id !== props.form.id) return;\n if (ev.initial) return;\n // FormModel paths look like \"/title\" or \"/contacts/0/email\". The\n // top-level key is the first segment after the leading slash.\n const top = ev.path.replace(/^\\//, \"\").split(\"/\")[0];\n const fieldSchema = z.schema.shape(schema)[top];\n const fieldConfig = resolveControlConfig(\n top,\n props.fields as Record<string, unknown> | undefined,\n props.groups,\n );\n // Text fields (incl. optional/nullable wrappers) should NOT auto-commit\n // on keystroke; they commit via Enter or the inline tick button.\n // Uploads commit a uuid string when the upload finishes, and selects /\n // comboboxes / segmented controls commit a discrete value on change —\n // all of those MUST auto-save even though the field schema is a string.\n const rendersAsSelect =\n !!fieldConfig.select ||\n !!fieldConfig.combobox ||\n !!fieldConfig.segmented ||\n fieldConfig.items != null ||\n isEnumSchema(fieldSchema);\n if (\n !fieldConfig.upload &&\n !rendersAsSelect &&\n isStringSchema(fieldSchema)\n )\n return;\n if (handle) clearTimeout(handle);\n handle = setTimeout(() => props.form.submit(), autoSaveDelay);\n });\n return () => {\n off();\n if (handle) clearTimeout(handle);\n };\n }, [\n alepha,\n autoSaveEnabled,\n autoSaveDelay,\n props.form,\n props.fields,\n props.groups,\n schema,\n ]);\n const skipBottomBar = props.skipBottomBar ?? autoSaveEnabled;\n\n const resolvedGroups: AutoFormGroup[] = useMemo(() => {\n if (props.groups) return props.groups.filter((g) => g.can?.() !== false);\n if (props.autoGroup) {\n const opts = typeof props.autoGroup === \"object\" ? props.autoGroup : {};\n return autoGroupSchema(schema, { tr, ...opts });\n }\n return [\n {\n fields: Object.keys(z.schema.shape(schema)),\n },\n ];\n }, [props.groups, props.autoGroup, schema]);\n\n const HeaderIcon = props.icon ? iconFor(props.icon) : undefined;\n const hasHeader = !!(\n props.title ||\n props.description ||\n HeaderIcon ||\n props.headerAction\n );\n\n const layout = props.layout ?? \"stack\";\n\n const bottomBarProps = {\n form: props.form,\n dirty,\n loading,\n disabled: props.disabled,\n disabledIfPristine: props.disabledIfPristine,\n submitLabel: props.submitLabel,\n noSubmit: props.noSubmit,\n onCancel: props.onCancel,\n skipReset: props.skipReset,\n actions: props.actions,\n };\n\n // In row layout the action bar is the card's own last row, not a second\n // bordered box floating under it — see the `layout` prop's note. `card`\n // mode already owns its footer (`CardFooter`), and a form that resolved to\n // no groups at all has nothing to put the bar inside, so both fall back to\n // the standalone bar below.\n const inCardBottomBar =\n layout === \"row\" &&\n !props.card &&\n !skipBottomBar &&\n resolvedGroups.length ? (\n <AutoFormBottomBar {...bottomBarProps} bare />\n ) : undefined;\n\n const fieldGroups = (\n <FormFieldLayoutProvider value={layout}>\n <FormFieldRequiredMarkerProvider value={props.requiredMarker ?? true}>\n <FormFieldAutoSaveProvider value={autoSaveEnabled}>\n {resolvedGroups.map((group, gi) => (\n <AutoFormGroupBlock\n key={gi}\n group={group}\n inputs={inputs}\n disabled={props.disabled}\n fields={props.fields}\n i18nPrefix={props.i18nPrefix}\n multiGroup={resolvedGroups.length > 1}\n layout={layout}\n gridClassName={props.gridClassName}\n bottomBar={\n gi === resolvedGroups.length - 1 ? inCardBottomBar : undefined\n }\n />\n ))}\n </FormFieldAutoSaveProvider>\n </FormFieldRequiredMarkerProvider>\n </FormFieldLayoutProvider>\n );\n\n if (props.card) {\n const cardClassName =\n typeof props.card === \"string\" ? props.card : undefined;\n return (\n <form\n {...props.form.props}\n className={cn(\n props.fill && \"flex h-full min-h-0 flex-col\",\n props.className,\n )}\n >\n <Card\n className={cn(\n props.fill && \"min-h-0 flex-1\",\n // Header owns its bottom padding (pb-3); trim the card's top\n // padding to match so header top/bottom are an even 12px.\n hasHeader && \"pt-3\",\n cardClassName,\n )}\n >\n {hasHeader && (\n // Explicit flex header (not shadcn CardHeader): CardHeader's grid\n // adds a phantom second row + row-gap below the title whenever a\n // CardDescription is nested, making the bottom padding larger than\n // the top. A plain flex row keeps top/bottom padding symmetric.\n <div\n data-slot=\"card-header\"\n className=\"flex items-start justify-between gap-3 border-b px-4 pb-3\"\n >\n <div className=\"flex items-center gap-3\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-0\">\n {props.title && <CardTitle>{props.title}</CardTitle>}\n {props.description && (\n <CardDescription>{props.description}</CardDescription>\n )}\n </div>\n </div>\n {props.headerAction && (\n <div className=\"shrink-0\">{props.headerAction}</div>\n )}\n </div>\n )}\n <CardContent\n className={cn(\n \"flex flex-col gap-4\",\n // `relative` alongside the scroller, not decoration: Base UI\n // gives every named control a 1×1 hidden `<input>` positioned\n // `absolute` with no offsets, and a scroller that is not itself\n // a containing block neither clips those inputs nor scrolls\n // them with the field they belong to — so a native validation\n // bubble would point at where the field used to be. #1849.\n props.fill && \"relative min-h-0 flex-1 overflow-y-auto\",\n )}\n >\n {fieldGroups}\n {props.footer}\n </CardContent>\n {!skipBottomBar && (\n <CardFooter>\n <AutoFormBottomBar {...bottomBarProps} bare />\n </CardFooter>\n )}\n </Card>\n </form>\n );\n }\n\n return (\n <form {...props.form.props} className={props.className}>\n <div className=\"flex flex-col gap-4\">\n {hasHeader && (\n <div className=\"bg-muted/40 flex items-start gap-3 rounded-md border p-4\">\n {HeaderIcon && (\n <div className=\"bg-primary/10 text-primary flex size-10 shrink-0 items-center justify-center rounded-full\">\n <HeaderIcon className=\"size-5\" />\n </div>\n )}\n <div className=\"flex flex-col gap-1\">\n {props.title && (\n <h2 className=\"text-base font-semibold\">{props.title}</h2>\n )}\n {props.description && (\n <p className=\"text-muted-foreground text-sm\">\n {props.description}\n </p>\n )}\n </div>\n {props.headerAction && (\n <div className=\"ml-auto\">{props.headerAction}</div>\n )}\n </div>\n )}\n\n {fieldGroups}\n\n {props.footer}\n\n {!skipBottomBar && !inCardBottomBar && (\n <AutoFormBottomBar {...bottomBarProps} />\n )}\n </div>\n </form>\n );\n};\n\nexport interface AutoFormGroup {\n /**\n * Group title shown in the header.\n */\n title?: string;\n /**\n * One line under the title, for context the fields should not each repeat.\n *\n * Only rendered in `layout=\"row\"`, where the heading sits above the card\n * and there is room for it — the boxed group bar the grid layout uses is a\n * single line by construction.\n */\n description?: string;\n /**\n * Icon name (lucide) for the group header.\n */\n icon?: string;\n /**\n * Visibility predicate. Group is omitted when this returns false.\n */\n can?: () => boolean;\n /**\n * Field names from the form schema. Each renders as a `<Control>`.\n * Use the object form `{ name, ...controlProps }` for per-field overrides\n * (width, icon, custom, etc.).\n */\n fields: Array<\n string | (Partial<Omit<ControlProps, \"input\">> & { name: string })\n >;\n}\n\nexport interface AutoFormAction {\n label: string;\n icon?: string;\n variant?: ButtonVariant;\n intent?: ButtonIntent;\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n}\n\n/**\n * Detect a `z.string()` schema (incl. optional/nullable wrappers) so the\n * auto-save effect can skip keystroke commits on text fields.\n */\nfunction isStringSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n // Zod, not JSON Schema: `z.string().optional()` has no `type: \"string\"`,\n // so the optional text fields of a form used to auto-save every keystroke.\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isString(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isStringSchema);\n }\n return false;\n}\n\n/**\n * Detect an enum schema (incl. optional/nullable wrappers). Enum fields\n * render as a `<Select>`, so they must auto-commit on change like any\n * other select — never get lumped in with free-text string fields.\n */\nfunction isEnumSchema(schema: unknown): boolean {\n if (!schema || typeof schema !== \"object\") return false;\n const inner = z.schema.unwrap(schema as ZType);\n if (z.schema.isEnum(inner)) return true;\n if (z.schema.isUnion(inner)) {\n return z.schema.options(inner).some(isEnumSchema);\n }\n return false;\n}\n\n/**\n * Resolve the effective `<Control>` config for a field, merging the\n * `fields` map with any per-field override carried on a `groups` entry —\n * the same precedence `AutoFormGroupBlock` applies when rendering.\n */\nfunction resolveControlConfig(\n name: string,\n fields: Record<string, unknown> | undefined,\n groups: AutoFormGroup[] | undefined,\n): Record<string, unknown> {\n const fromMap = (fields?.[name] as Record<string, unknown>) ?? {};\n let fromGroup: Record<string, unknown> = {};\n for (const group of groups ?? []) {\n for (const field of group.fields) {\n if (typeof field === \"object\" && field.name === name) {\n fromGroup = field as Record<string, unknown>;\n }\n }\n }\n return { ...fromMap, ...fromGroup };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyNA,MAAa,YAA+B,UAA4B;CACtE,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,EAAE,OAAO,YAAY,aAAa,MAAM,MAAM,CAAC,SAAS,SAAS,CAAC;CACxE,MAAM,SAAS,MAAM,KAAK;CAK1B,MAAM,SAAU,MAAM,KAAK,QAAQ,UAAsB,EAAE,OAAO,CAAC,CAAC;CAMpE,MAAM,WAAW,MAAM;CACvB,MAAM,gBACJ,OAAO,aAAa,WAAY,UAAU,SAAS,MAAO;CAC5D,MAAM,kBAAkB,CAAC,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AO;CACnC,IAAI,EAAE,OAAO,QAAQ,KAAK,GACxB,OAAO,EAAE,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,YAAY;CAElD,OAAO;AACT;;;;;;AAOA,SAAS,qBACP,MACA,QACA,QACyB;CACzB,MAAM,UAAW,SAAS,SAAqC,CAAC;CAChE,IAAI,YAAqC,CAAC;CAC1C,KAAK,MAAM,SAAS,UAAU,CAAC,GAC7B,KAAK,MAAM,SAAS,MAAM,QACxB,IAAI,OAAO,UAAU,YAAY,MAAM,SAAS,MAC9C,YAAY;CAIlB,OAAO;EAAE,GAAG;EAAS,GAAG;CAAU;AACpC"}
|
|
@@ -49,11 +49,21 @@ const AutoFormErrorPopover = (props) => {
|
|
|
49
49
|
})]
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
|
+
/**
|
|
53
|
+
* Every issue the error carries: a schema refusal's or a server
|
|
54
|
+
* `ValidationError`'s `data.issues`, else its one path and message. It read
|
|
55
|
+
* `error.value` before, a shape no error has had since errors became
|
|
56
|
+
* declared, so the list always showed the whole message under "Form".
|
|
57
|
+
*/
|
|
52
58
|
const collectErrors = (error) => {
|
|
53
|
-
const
|
|
59
|
+
const data = error.data;
|
|
60
|
+
if (data?.issues?.length) return data.issues.map((issue) => ({
|
|
61
|
+
path: issue.path,
|
|
62
|
+
message: issue.message
|
|
63
|
+
}));
|
|
54
64
|
return [{
|
|
55
|
-
path:
|
|
56
|
-
message:
|
|
65
|
+
path: data?.path ?? "",
|
|
66
|
+
message: data?.message ?? error.message ?? "Invalid"
|
|
57
67
|
}];
|
|
58
68
|
};
|
|
59
69
|
const focusError = (path, formId) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoFormErrorPopover.js","names":[],"sources":["../../src/form/AutoFormErrorPopover.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ZObject } from \"alepha\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AlertCircle } from \"lucide-react\";\nimport { useState } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../core/Popover.tsx\";\n\nexport interface AutoFormErrorPopoverProps {\n form: FormModel<ZObject>;\n}\n\nexport const AutoFormErrorPopover = (props: AutoFormErrorPopoverProps) => {\n const { error } = useFormState(props.form, [\"error\"]);\n const { tr } = useI18n();\n const [open, setOpen] = useState(false);\n // Close the popover when the error clears. Guarded on `open`, so it settles\n // in one pass and does not need an effect.\n if (!error && open) {\n setOpen(false);\n }\n\n if (!error) return null;\n\n const items = collectErrors(error);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n type=\"button\"\n variant=\"minimal\"\n size=\"icon\"\n aria-label={tr(\"autoForm.errors\", { default: \"Form errors\" })}\n className=\"text-danger-text\"\n />\n }\n >\n <AlertCircle className=\"size-4\" />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-80 p-2\">\n <p className=\"text-danger-text px-2 py-1 text-sm font-medium\">\n {items.length === 1\n ? tr(\"autoForm.error\", { default: \"Error\" })\n : tr(\"autoForm.errors\", { default: \"Errors\" })}\n </p>\n <ul className=\"flex flex-col gap-1\">\n {items.map((it, i) => (\n <li key={i}>\n <button\n type=\"button\"\n onClick={() => focusError(it.path, props.form.id)}\n className=\"hover:bg-hover w-full rounded px-2 py-1 text-left text-xs\"\n >\n <span className=\"font-medium\">\n {it.path || tr(\"autoForm.formLabel\", { default: \"Form\" })}\n </span>\n <span className=\"text-muted-foreground\"> — {it.message}</span>\n </button>\n </li>\n ))}\n </ul>\n </PopoverContent>\n </Popover>\n );\n};\n\ninterface ErrorItem {\n path: string;\n message: string;\n}\n\nconst collectErrors = (error: Error): ErrorItem[] => {\n const
|
|
1
|
+
{"version":3,"file":"AutoFormErrorPopover.js","names":[],"sources":["../../src/form/AutoFormErrorPopover.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ZObject } from \"alepha\";\nimport { type FormModel, useFormState } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AlertCircle } from \"lucide-react\";\nimport { useState } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../core/Popover.tsx\";\n\nexport interface AutoFormErrorPopoverProps {\n form: FormModel<ZObject>;\n}\n\nexport const AutoFormErrorPopover = (props: AutoFormErrorPopoverProps) => {\n const { error } = useFormState(props.form, [\"error\"]);\n const { tr } = useI18n();\n const [open, setOpen] = useState(false);\n // Close the popover when the error clears. Guarded on `open`, so it settles\n // in one pass and does not need an effect.\n if (!error && open) {\n setOpen(false);\n }\n\n if (!error) return null;\n\n const items = collectErrors(error);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n type=\"button\"\n variant=\"minimal\"\n size=\"icon\"\n aria-label={tr(\"autoForm.errors\", { default: \"Form errors\" })}\n className=\"text-danger-text\"\n />\n }\n >\n <AlertCircle className=\"size-4\" />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-80 p-2\">\n <p className=\"text-danger-text px-2 py-1 text-sm font-medium\">\n {items.length === 1\n ? tr(\"autoForm.error\", { default: \"Error\" })\n : tr(\"autoForm.errors\", { default: \"Errors\" })}\n </p>\n <ul className=\"flex flex-col gap-1\">\n {items.map((it, i) => (\n <li key={i}>\n <button\n type=\"button\"\n onClick={() => focusError(it.path, props.form.id)}\n className=\"hover:bg-hover w-full rounded px-2 py-1 text-left text-xs\"\n >\n <span className=\"font-medium\">\n {it.path || tr(\"autoForm.formLabel\", { default: \"Form\" })}\n </span>\n <span className=\"text-muted-foreground\"> — {it.message}</span>\n </button>\n </li>\n ))}\n </ul>\n </PopoverContent>\n </Popover>\n );\n};\n\ninterface ErrorItem {\n path: string;\n message: string;\n}\n\n/**\n * Every issue the error carries: a schema refusal's or a server\n * `ValidationError`'s `data.issues`, else its one path and message. It read\n * `error.value` before, a shape no error has had since errors became\n * declared, so the list always showed the whole message under \"Form\".\n */\nconst collectErrors = (error: Error): ErrorItem[] => {\n const data = (\n error as Error & {\n data?: {\n message?: string;\n path?: string;\n issues?: Array<{ path: string; message: string }>;\n };\n }\n ).data;\n if (data?.issues?.length) {\n return data.issues.map((issue) => ({\n path: issue.path,\n message: issue.message,\n }));\n }\n return [\n {\n path: data?.path ?? \"\",\n message: data?.message ?? error.message ?? \"Invalid\",\n },\n ];\n};\n\nconst focusError = (path: string, formId: string) => {\n const segments = path.split(\"/\").filter(Boolean);\n if (segments.length === 0) return;\n const dotted = segments.join(\".\");\n // ControlArray names its item fields `items[0].email` and joins their ids\n // with `-`; the dotted forms are what every other control renders.\n const bracketed = segments\n .map((segment, i) =>\n i === 0\n ? segment\n : /^\\d+$/.test(segment)\n ? `[${segment}]`\n : `.${segment}`,\n )\n .join(\"\");\n const el =\n document.getElementById(`${formId}-${dotted}`) ??\n document.getElementById(`${formId}-${segments.join(\"-\")}`) ??\n document.querySelector<HTMLElement>(`[name=\"${dotted}\"]`) ??\n document.querySelector<HTMLElement>(`[name=\"${bracketed}\"]`);\n el?.focus();\n};\n"],"mappings":";;;;;;;;AAiBA,MAAa,wBAAwB,UAAqC;CACxE,MAAM,EAAE,UAAU,aAAa,MAAM,MAAM,CAAC,OAAO,CAAC;CACpD,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CAGtC,IAAI,CAAC,SAAS,MACZ,QAAQ,KAAK;CAGf,IAAI,CAAC,OAAO,OAAO;CAEnB,MAAM,QAAQ,cAAc,KAAK;CAEjC,OACE,qBAAC,SAAD;EAAe;EAAM,cAAc;EAAnC,UAAA,CACE,oBAAC,gBAAD;GACE,QACE,oBAAC,QAAD;IACE,MAAK;IACL,SAAQ;IACR,MAAK;IACL,cAAY,GAAG,mBAAmB,EAAE,SAAS,cAAc,CAAC;IAC5D,WAAU;GACX,CAAA;GAGH,UA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,KACZ,IAAI,SACZ,CAAC,CACA,KAAK,EAAE;CAMV,CAJE,SAAS,eAAe,GAAG,OAAO,GAAG,QAAQ,KAC7C,SAAS,eAAe,GAAG,OAAO,GAAG,SAAS,KAAK,GAAG,GAAG,KACzD,SAAS,cAA2B,UAAU,OAAO,GAAG,KACxD,SAAS,cAA2B,UAAU,UAAU,GAAG,EAAA,EACzD,MAAM;AACZ"}
|
package/dist/form/Control.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BaseInputField } from "alepha/react/form";
|
|
2
|
-
import { type ComponentType, type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import { type ComponentType, type HTMLAttributes, type ReactElement, type ReactNode } from "react";
|
|
3
3
|
import { type ControlDateProps } from "./ControlDate.tsx";
|
|
4
4
|
import { type ControlSelectSize, type SelectOption } from "./ControlSelect.tsx";
|
|
5
5
|
import { type ControlUploadProps } from "./ControlUpload.tsx";
|
|
@@ -302,6 +302,19 @@ export interface ControlProps {
|
|
|
302
302
|
* `w-max min-w-48` to size it from its content rather than its trigger.
|
|
303
303
|
*/
|
|
304
304
|
popupClassName?: string;
|
|
305
|
+
/**
|
|
306
|
+
* Forwarded to `ControlSelect` and `ControlDateRange`: an element drawn
|
|
307
|
+
* INSTEAD of the field, as the button that opens its popup. See
|
|
308
|
+
* `ControlSelectProps.trigger`.
|
|
309
|
+
*/
|
|
310
|
+
trigger?: ReactElement<{
|
|
311
|
+
children?: ReactNode;
|
|
312
|
+
}>;
|
|
313
|
+
/**
|
|
314
|
+
* Forwarded to `ControlSelect` and `ControlDateRange`: the popup opened or
|
|
315
|
+
* closed.
|
|
316
|
+
*/
|
|
317
|
+
onPopupOpenChange?: (open: boolean) => void;
|
|
305
318
|
/**
|
|
306
319
|
* Render a managed upload control (image preview, multi, drag-drop)
|
|
307
320
|
* that calls `FileController.uploadFile` and stores the file ID(s) in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Control.d.ts","s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"}
|
package/dist/form/Control.js
CHANGED
|
@@ -55,6 +55,7 @@ const Control = (props) => {
|
|
|
55
55
|
if (merged.custom) {
|
|
56
56
|
const Custom = merged.custom;
|
|
57
57
|
return wrapWithSlots(merged, /* @__PURE__ */ jsx(FormField, {
|
|
58
|
+
onBlur: () => props.input.form?.blur(props.input.path),
|
|
58
59
|
id: meta.id,
|
|
59
60
|
label: merged.label ?? meta.label,
|
|
60
61
|
description: merged.description ?? meta.description,
|
|
@@ -118,7 +119,9 @@ const Control = (props) => {
|
|
|
118
119
|
clearable: merged.clearable,
|
|
119
120
|
placeholder: merged.placeholder,
|
|
120
121
|
triggerClassName: merged.triggerClassName,
|
|
121
|
-
triggerPrefix: props.triggerPrefix
|
|
122
|
+
triggerPrefix: props.triggerPrefix,
|
|
123
|
+
trigger: props.trigger,
|
|
124
|
+
onPopupOpenChange: props.onPopupOpenChange
|
|
122
125
|
}));
|
|
123
126
|
if (merged.select || merged.combobox || merged.segmented || merged.checkboxes || meta.isEnum || meta.isArray && !meta.isArrayOfObjects || items != null) return wrapWithSlots(merged, /* @__PURE__ */ jsx(ControlSelect, {
|
|
124
127
|
input: props.input,
|
|
@@ -143,9 +146,12 @@ const Control = (props) => {
|
|
|
143
146
|
triggerProps: merged.inputProps,
|
|
144
147
|
popupHeader: props.popupHeader,
|
|
145
148
|
triggerPrefix: props.triggerPrefix,
|
|
146
|
-
popupClassName: merged.popupClassName
|
|
149
|
+
popupClassName: merged.popupClassName,
|
|
150
|
+
trigger: props.trigger,
|
|
151
|
+
onPopupOpenChange: props.onPopupOpenChange
|
|
147
152
|
}));
|
|
148
153
|
if (meta.type === "boolean" && merged.switch !== false) return wrapWithSlots(merged, /* @__PURE__ */ jsx(FormField, {
|
|
154
|
+
onBlur: () => props.input.form?.blur(props.input.path),
|
|
149
155
|
id: meta.id,
|
|
150
156
|
label: merged.label ?? meta.label,
|
|
151
157
|
description: merged.description ?? meta.description,
|
|
@@ -180,6 +186,7 @@ const Control = (props) => {
|
|
|
180
186
|
birthdate: merged.birthdate
|
|
181
187
|
}));
|
|
182
188
|
if (merged.file) return wrapWithSlots(merged, /* @__PURE__ */ jsx(FormField, {
|
|
189
|
+
onBlur: () => props.input.form?.blur(props.input.path),
|
|
183
190
|
id: meta.id,
|
|
184
191
|
label: merged.label ?? meta.label,
|
|
185
192
|
description: merged.description ?? meta.description,
|
|
@@ -198,6 +205,7 @@ const Control = (props) => {
|
|
|
198
205
|
if (merged.area || maxLength > 256) {
|
|
199
206
|
const rows = merged.rows ?? (maxLength > 1024 ? 6 : maxLength > 512 ? 4 : 2);
|
|
200
207
|
return wrapWithSlots(merged, /* @__PURE__ */ jsx(FormField, {
|
|
208
|
+
onBlur: () => props.input.form?.blur(props.input.path),
|
|
201
209
|
id: meta.id,
|
|
202
210
|
label: merged.label ?? meta.label,
|
|
203
211
|
description: merged.description ?? meta.description,
|
|
@@ -225,6 +233,7 @@ const Control = (props) => {
|
|
|
225
233
|
}));
|
|
226
234
|
}
|
|
227
235
|
if (merged.password || meta.iconHint === "password" || meta.format === "password") return wrapWithSlots(merged, /* @__PURE__ */ jsx(ControlPassword, {
|
|
236
|
+
onBlur: () => props.input.form?.blur(props.input.path),
|
|
228
237
|
id: meta.id,
|
|
229
238
|
name: props.input.props.name,
|
|
230
239
|
label: merged.label ?? meta.label,
|
|
@@ -256,6 +265,7 @@ const Control = (props) => {
|
|
|
256
265
|
const showTrailing = !showSave && !showClear && merged.trailing != null;
|
|
257
266
|
const reserveGutter = showSave || showTrailing;
|
|
258
267
|
return wrapWithSlots(merged, /* @__PURE__ */ jsx(FormField, {
|
|
268
|
+
onBlur: () => props.input.form?.blur(props.input.path),
|
|
259
269
|
id: meta.id,
|
|
260
270
|
label: merged.label ?? meta.label,
|
|
261
271
|
description: merged.description ?? meta.description,
|