@alepha/ui 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -2
- package/dist/components/account/account-connections.d.ts.map +1 -1
- package/dist/components/account/account-connections.js +4 -1
- package/dist/components/account/account-connections.js.map +1 -1
- package/dist/components/account/account-delete-dialog.d.ts.map +1 -1
- package/dist/components/account/account-delete-dialog.js +12 -15
- package/dist/components/account/account-delete-dialog.js.map +1 -1
- package/dist/components/account/account-keys.d.ts.map +1 -1
- package/dist/components/account/account-keys.js +22 -28
- package/dist/components/account/account-keys.js.map +1 -1
- package/dist/components/account/account-mfa-dialog.js +1 -4
- package/dist/components/account/account-mfa-dialog.js.map +1 -1
- package/dist/components/account/account-password-dialog.d.ts.map +1 -1
- package/dist/components/account/account-password-dialog.js +11 -14
- package/dist/components/account/account-password-dialog.js.map +1 -1
- package/dist/components/account/account-profile.js +3 -2
- package/dist/components/account/account-profile.js.map +1 -1
- package/dist/components/account/account-router-options.d.ts +38 -0
- package/dist/components/account/account-router-options.d.ts.map +1 -1
- package/dist/components/account/account-router-options.js.map +1 -1
- package/dist/components/account/account-router-page.d.ts +11 -1
- package/dist/components/account/account-router-page.d.ts.map +1 -1
- package/dist/components/account/account-router-page.js +11 -1
- package/dist/components/account/account-router-page.js.map +1 -1
- package/dist/components/account/account-router.d.ts +11 -0
- package/dist/components/account/account-router.d.ts.map +1 -1
- package/dist/components/account/account-router.js +16 -5
- package/dist/components/account/account-router.js.map +1 -1
- package/dist/components/admin/admin-audits.d.ts.map +1 -1
- package/dist/components/admin/admin-audits.js +91 -34
- package/dist/components/admin/admin-audits.js.map +1 -1
- package/dist/components/admin/admin-files.d.ts.map +1 -1
- package/dist/components/admin/admin-files.js +6 -17
- package/dist/components/admin/admin-files.js.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.js +39 -8
- package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-jobs-payload-dialog.d.ts +19 -0
- package/dist/components/admin/admin-jobs-payload-dialog.d.ts.map +1 -0
- package/dist/components/admin/admin-jobs-payload-dialog.js +33 -0
- package/dist/components/admin/admin-jobs-payload-dialog.js.map +1 -0
- package/dist/components/admin/admin-keys.d.ts.map +1 -1
- package/dist/components/admin/admin-keys.js +5 -4
- package/dist/components/admin/admin-keys.js.map +1 -1
- package/dist/components/admin/admin-notifications-channel-label.d.ts +14 -0
- package/dist/components/admin/admin-notifications-channel-label.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-channel-label.js +26 -0
- package/dist/components/admin/admin-notifications-channel-label.js.map +1 -0
- package/dist/components/admin/admin-notifications-preview-body.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications-preview-body.js +23 -13
- package/dist/components/admin/admin-notifications-preview-body.js.map +1 -1
- package/dist/components/admin/admin-notifications.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications.js +11 -12
- package/dist/components/admin/admin-notifications.js.map +1 -1
- package/dist/components/admin/admin-payments.d.ts.map +1 -1
- package/dist/components/admin/admin-payments.js +9 -7
- package/dist/components/admin/admin-payments.js.map +1 -1
- package/dist/components/admin/admin-router-options.d.ts +12 -0
- package/dist/components/admin/admin-router-options.d.ts.map +1 -1
- package/dist/components/admin/admin-router-options.js.map +1 -1
- package/dist/components/admin/admin-router.d.ts +5 -8
- package/dist/components/admin/admin-router.d.ts.map +1 -1
- package/dist/components/admin/admin-router.js +6 -29
- package/dist/components/admin/admin-router.js.map +1 -1
- package/dist/components/admin/admin-sessions.d.ts.map +1 -1
- package/dist/components/admin/admin-sessions.js +9 -7
- package/dist/components/admin/admin-sessions.js.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.js +5 -4
- package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.js +7 -5
- package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail.js +3 -2
- package/dist/components/admin/admin-user-detail.js.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.js.map +1 -1
- package/dist/components/admin/admin-users.d.ts.map +1 -1
- package/dist/components/admin/admin-users.js +6 -4
- package/dist/components/admin/admin-users.js.map +1 -1
- package/dist/components/admin/analytics/AnalyticsChartBars.js +2 -1
- package/dist/components/admin/analytics/AnalyticsChartBars.js.map +1 -1
- package/dist/components/admin/parameter-history-item.d.ts.map +1 -1
- package/dist/components/admin/parameter-history-item.js +3 -2
- package/dist/components/admin/parameter-history-item.js.map +1 -1
- package/dist/components/alepha-table/alepha-table-bulk-menu.js +2 -1
- package/dist/components/alepha-table/alepha-table-bulk-menu.js.map +1 -1
- package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts +60 -0
- package/dist/components/alepha-table/alepha-table-filter-dialog.d.ts.map +1 -0
- package/dist/components/alepha-table/alepha-table-filter-dialog.js +88 -0
- package/dist/components/alepha-table/alepha-table-filter-dialog.js.map +1 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.d.ts +35 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.d.ts.map +1 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.js +54 -0
- package/dist/components/alepha-table/alepha-table-filter-menu.js.map +1 -0
- package/dist/components/alepha-table/alepha-table.d.ts +188 -3
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
- package/dist/components/alepha-table/alepha-table.js +551 -162
- package/dist/components/alepha-table/alepha-table.js.map +1 -1
- package/dist/components/alepha-table/query-filters.d.ts +73 -0
- package/dist/components/alepha-table/query-filters.d.ts.map +1 -0
- package/dist/components/alepha-table/query-filters.js +118 -0
- package/dist/components/alepha-table/query-filters.js.map +1 -0
- package/dist/components/app-actions/app-actions.d.ts +21 -0
- package/dist/components/app-actions/app-actions.d.ts.map +1 -1
- package/dist/components/app-actions/app-actions.js +11 -5
- package/dist/components/app-actions/app-actions.js.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +45 -0
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.js +119 -16
- package/dist/components/app-shell/app-shell.js.map +1 -1
- package/dist/components/auth/auth-register.js +31 -30
- package/dist/components/auth/auth-register.js.map +1 -1
- package/dist/components/auto-form/auto-form.d.ts.map +1 -1
- package/dist/components/auto-form/auto-form.js +68 -30
- package/dist/components/auto-form/auto-form.js.map +1 -1
- package/dist/components/button-dark/button-dark.d.ts.map +1 -1
- package/dist/components/button-dark/button-dark.js +39 -8
- package/dist/components/button-dark/button-dark.js.map +1 -1
- package/dist/components/button-inbox/button-inbox.d.ts +66 -0
- package/dist/components/button-inbox/button-inbox.d.ts.map +1 -0
- package/dist/components/button-inbox/button-inbox.js +167 -0
- package/dist/components/button-inbox/button-inbox.js.map +1 -0
- package/dist/components/button-inbox/inbox-unread-atom.d.ts +22 -0
- package/dist/components/button-inbox/inbox-unread-atom.d.ts.map +1 -0
- package/dist/components/button-inbox/inbox-unread-atom.js +29 -0
- package/dist/components/button-inbox/inbox-unread-atom.js.map +1 -0
- package/dist/components/button-theme/button-theme.d.ts +4 -3
- package/dist/components/button-theme/button-theme.d.ts.map +1 -1
- package/dist/components/button-theme/button-theme.js +8 -25
- package/dist/components/button-theme/button-theme.js.map +1 -1
- package/dist/components/button-user/button-user.d.ts +19 -0
- package/dist/components/button-user/button-user.d.ts.map +1 -1
- package/dist/components/button-user/button-user.js +1 -1
- package/dist/components/button-user/button-user.js.map +1 -1
- package/dist/components/control/control.d.ts +51 -0
- package/dist/components/control/control.d.ts.map +1 -1
- package/dist/components/control/control.js +49 -5
- package/dist/components/control/control.js.map +1 -1
- package/dist/components/control-array/control-array.js +2 -1
- package/dist/components/control-array/control-array.js.map +1 -1
- package/dist/components/control-date/control-date.d.ts +27 -0
- package/dist/components/control-date/control-date.d.ts.map +1 -1
- package/dist/components/control-date/control-date.js +15 -19
- package/dist/components/control-date/control-date.js.map +1 -1
- package/dist/components/control-date/date-only.d.ts +18 -0
- package/dist/components/control-date/date-only.d.ts.map +1 -0
- package/dist/components/control-date/date-only.js +29 -0
- package/dist/components/control-date/date-only.js.map +1 -0
- package/dist/components/control-date-range/control-date-range.d.ts +56 -0
- package/dist/components/control-date-range/control-date-range.d.ts.map +1 -0
- package/dist/components/control-date-range/control-date-range.js +148 -0
- package/dist/components/control-date-range/control-date-range.js.map +1 -0
- package/dist/components/control-object/control-object.js +2 -1
- package/dist/components/control-object/control-object.js.map +1 -1
- package/dist/components/control-select/control-select.d.ts.map +1 -1
- package/dist/components/control-select/control-select.js +177 -37
- package/dist/components/control-select/control-select.js.map +1 -1
- package/dist/components/control-upload/control-upload.d.ts.map +1 -1
- package/dist/components/control-upload/control-upload.js +1 -11
- package/dist/components/control-upload/control-upload.js.map +1 -1
- package/dist/components/detail/detail-aside.d.ts.map +1 -1
- package/dist/components/detail/detail-aside.js +4 -3
- package/dist/components/detail/detail-aside.js.map +1 -1
- package/dist/components/file-image/file-image.js +2 -1
- package/dist/components/file-image/file-image.js.map +1 -1
- package/dist/components/markdown-view/SpoilerSpan.d.ts +28 -0
- package/dist/components/markdown-view/SpoilerSpan.d.ts.map +1 -0
- package/dist/components/markdown-view/SpoilerSpan.js +53 -0
- package/dist/components/markdown-view/SpoilerSpan.js.map +1 -0
- package/dist/components/markdown-view/diagram/layoutSequence.js +13 -23
- package/dist/components/markdown-view/diagram/layoutSequence.js.map +1 -1
- package/dist/components/markdown-view/diagram/textMetrics.js +2 -2
- package/dist/components/markdown-view/diagram/textMetrics.js.map +1 -1
- package/dist/components/markdown-view/markdown-view.css +44 -0
- package/dist/components/markdown-view/markdown-view.d.ts +12 -0
- package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view/markdown-view.js +22 -1
- package/dist/components/markdown-view/markdown-view.js.map +1 -1
- package/dist/components/markdown-view/remarkSpoiler.d.ts +17 -0
- package/dist/components/markdown-view/remarkSpoiler.d.ts.map +1 -0
- package/dist/components/markdown-view/remarkSpoiler.js +117 -0
- package/dist/components/markdown-view/remarkSpoiler.js.map +1 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts +34 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.d.ts.map +1 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.js +109 -0
- package/dist/components/permission-matrix/permission-matrix-group-rows.js.map +1 -0
- package/dist/components/permission-matrix/permission-matrix.d.ts +145 -0
- package/dist/components/permission-matrix/permission-matrix.d.ts.map +1 -0
- package/dist/components/permission-matrix/permission-matrix.js +113 -0
- package/dist/components/permission-matrix/permission-matrix.js.map +1 -0
- package/dist/components/plate-layout/plate-layout.d.ts +5 -0
- package/dist/components/plate-layout/plate-layout.d.ts.map +1 -1
- package/dist/components/plate-layout/plate-layout.js +2 -1
- package/dist/components/plate-layout/plate-layout.js.map +1 -1
- package/dist/components/plate-layout/plate-tab-bar.d.ts +10 -0
- package/dist/components/plate-layout/plate-tab-bar.d.ts.map +1 -1
- package/dist/components/plate-layout/plate-tab-bar.js +1 -1
- package/dist/components/plate-layout/plate-tab-bar.js.map +1 -1
- package/dist/components/settings/settings-nav.js +2 -1
- package/dist/components/settings/settings-nav.js.map +1 -1
- package/dist/components/time-ago/time-ago.d.ts +57 -0
- package/dist/components/time-ago/time-ago.d.ts.map +1 -0
- package/dist/components/time-ago/time-ago.js +60 -0
- package/dist/components/time-ago/time-ago.js.map +1 -0
- package/dist/components/tree-view/tree-model.d.ts +128 -0
- package/dist/components/tree-view/tree-model.d.ts.map +1 -0
- package/dist/components/tree-view/tree-model.js +226 -0
- package/dist/components/tree-view/tree-model.js.map +1 -0
- package/dist/components/tree-view/tree-view-rename-input.d.ts +31 -0
- package/dist/components/tree-view/tree-view-rename-input.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view-rename-input.js +68 -0
- package/dist/components/tree-view/tree-view-rename-input.js.map +1 -0
- package/dist/components/tree-view/tree-view-resizer.d.ts +38 -0
- package/dist/components/tree-view/tree-view-resizer.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view-resizer.js +73 -0
- package/dist/components/tree-view/tree-view-resizer.js.map +1 -0
- package/dist/components/tree-view/tree-view-row.d.ts +177 -0
- package/dist/components/tree-view/tree-view-row.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view-row.js +241 -0
- package/dist/components/tree-view/tree-view-row.js.map +1 -0
- package/dist/components/tree-view/tree-view.d.ts +186 -0
- package/dist/components/tree-view/tree-view.d.ts.map +1 -0
- package/dist/components/tree-view/tree-view.js +112 -0
- package/dist/components/tree-view/tree-view.js.map +1 -0
- package/dist/components/tree-view/use-tree-state.d.ts +79 -0
- package/dist/components/tree-view/use-tree-state.d.ts.map +1 -0
- package/dist/components/tree-view/use-tree-state.js +93 -0
- package/dist/components/tree-view/use-tree-state.js.map +1 -0
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/select.d.ts +7 -0
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +7 -0
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/lib/i18n-fr.d.ts.map +1 -1
- package/dist/lib/i18n-fr.js +31 -47
- package/dist/lib/i18n-fr.js.map +1 -1
- package/dist/lib/utils.d.ts +22 -2
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +29 -5
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles.css +255 -0
- package/package.json +13 -14
- package/src/components/account/__tests__/account-router.spec.ts +95 -0
- package/src/components/account/account-connections.tsx +14 -1
- package/src/components/account/account-delete-dialog.tsx +3 -2
- package/src/components/account/account-keys.tsx +11 -4
- package/src/components/account/account-mfa-dialog.tsx +1 -1
- package/src/components/account/account-password-dialog.tsx +3 -2
- package/src/components/account/account-profile.tsx +1 -1
- package/src/components/account/account-router-options.tsx +45 -0
- package/src/components/account/account-router-page.tsx +11 -1
- package/src/components/account/account-router.tsx +23 -6
- package/src/components/admin/__tests__/admin-jobs-payload-dialog.browser.spec.tsx +68 -0
- package/src/components/admin/__tests__/admin-notifications-preview-body.browser.spec.tsx +20 -4
- package/src/components/admin/__tests__/admin-status-labels.browser.spec.tsx +0 -31
- package/src/components/admin/admin-audits.tsx +99 -5
- package/src/components/admin/admin-files.tsx +7 -16
- package/src/components/admin/admin-jobs-executions-panel.tsx +152 -114
- package/src/components/admin/admin-jobs-payload-dialog.tsx +57 -0
- package/src/components/admin/admin-keys.tsx +7 -4
- package/src/components/admin/admin-notifications-channel-label.ts +18 -0
- package/src/components/admin/admin-notifications-preview-body.tsx +7 -2
- package/src/components/admin/admin-notifications.tsx +19 -8
- package/src/components/admin/admin-payments.tsx +7 -4
- package/src/components/admin/admin-router-options.tsx +12 -0
- package/src/components/admin/admin-router.tsx +5 -27
- package/src/components/admin/admin-sessions.tsx +10 -6
- package/src/components/admin/admin-user-detail-audits-tab.tsx +7 -4
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +7 -4
- package/src/components/admin/admin-users-roles-picker.tsx +4 -0
- package/src/components/admin/admin-users.tsx +6 -3
- package/src/components/admin/parameter-history-item.tsx +4 -2
- package/src/components/alepha-table/__tests__/alepha-table-default-hidden.browser.spec.tsx +108 -0
- package/src/components/alepha-table/__tests__/alepha-table-empty-state.browser.spec.tsx +233 -0
- package/src/components/alepha-table/__tests__/alepha-table-persist-facets.browser.spec.tsx +177 -0
- package/src/components/alepha-table/__tests__/alepha-table-persisted-filters.browser.spec.tsx +182 -0
- package/src/components/alepha-table/__tests__/alepha-table-query-seed.browser.spec.tsx +170 -0
- package/src/components/alepha-table/__tests__/alepha-table-row-action-checked.browser.spec.tsx +210 -0
- package/src/components/alepha-table/__tests__/alepha-table-row-action-group.browser.spec.tsx +202 -0
- package/src/components/alepha-table/__tests__/alepha-table-scope.browser.spec.tsx +161 -0
- package/src/components/alepha-table/__tests__/alepha-table-share-filters.browser.spec.tsx +309 -0
- package/src/components/alepha-table/__tests__/query-filters.spec.ts +212 -0
- package/src/components/alepha-table/alepha-table-filter-dialog.tsx +162 -0
- package/src/components/alepha-table/alepha-table-filter-menu.tsx +77 -0
- package/src/components/alepha-table/alepha-table.tsx +1113 -207
- package/src/components/alepha-table/query-filters.ts +159 -0
- package/src/components/app-actions/app-actions.tsx +32 -3
- package/src/components/app-shell/__tests__/sidebar-nav-accordion.browser.spec.tsx +163 -0
- package/src/components/app-shell/app-shell.tsx +255 -12
- package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +1 -1
- package/src/components/auto-form/auto-form.tsx +98 -30
- package/src/components/button-dark/button-dark.tsx +47 -8
- package/src/components/button-inbox/__tests__/button-inbox.browser.spec.tsx +247 -0
- package/src/components/button-inbox/button-inbox.tsx +303 -0
- package/src/components/button-inbox/inbox-unread-atom.ts +27 -0
- package/src/components/button-theme/button-theme.tsx +16 -29
- package/src/components/button-user/__tests__/button-user-avatar.browser.spec.tsx +88 -0
- package/src/components/button-user/button-user.tsx +24 -1
- package/src/components/control/__tests__/control-date-range.browser.spec.tsx +177 -0
- package/src/components/control/control.tsx +119 -12
- package/src/components/control-date/control-date.tsx +117 -22
- package/src/components/control-date/date-only.ts +26 -0
- package/src/components/control-date-range/control-date-range.tsx +250 -0
- package/src/components/control-select/__tests__/control-select-clear-label.browser.spec.tsx +129 -15
- package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +27 -6
- package/src/components/control-select/__tests__/control-select-multi.browser.spec.tsx +204 -1
- package/src/components/control-select/__tests__/control-select-size-minimal.browser.spec.tsx +77 -1
- package/src/components/control-select/control-select.tsx +317 -83
- package/src/components/control-upload/control-upload.tsx +1 -10
- package/src/components/detail/detail-aside.tsx +30 -6
- package/src/components/markdown-view/SpoilerSpan.tsx +66 -0
- package/src/components/markdown-view/__tests__/markdown-view-spoiler.browser.spec.tsx +165 -0
- package/src/components/markdown-view/diagram/textMetrics.spec.ts +1 -1
- package/src/components/markdown-view/diagram/textMetrics.ts +2 -2
- package/src/components/markdown-view/markdown-view.css +44 -0
- package/src/components/markdown-view/markdown-view.tsx +37 -1
- package/src/components/markdown-view/remarkSpoiler.ts +150 -0
- package/src/components/permission-matrix/__tests__/permission-matrix.browser.spec.tsx +237 -0
- package/src/components/permission-matrix/permission-matrix-group-rows.tsx +240 -0
- package/src/components/permission-matrix/permission-matrix.tsx +286 -0
- package/src/components/plate-layout/__tests__/plate-layout.browser.spec.tsx +22 -0
- package/src/components/plate-layout/plate-layout.tsx +6 -0
- package/src/components/plate-layout/plate-tab-bar.tsx +27 -1
- package/src/components/time-ago/time-ago.browser.spec.tsx +110 -0
- package/src/components/time-ago/time-ago.tsx +80 -0
- package/src/components/tree-view/__tests__/tree-model.spec.ts +441 -0
- package/src/components/tree-view/__tests__/tree-view-drag.browser.spec.tsx +295 -0
- package/src/components/tree-view/__tests__/tree-view-rename.browser.spec.tsx +278 -0
- package/src/components/tree-view/__tests__/tree-view-resizer.browser.spec.tsx +112 -0
- package/src/components/tree-view/__tests__/tree-view.browser.spec.tsx +260 -0
- package/src/components/tree-view/__tests__/use-tree-state.browser.spec.tsx +238 -0
- package/src/components/tree-view/tree-model.ts +369 -0
- package/src/components/tree-view/tree-view-rename-input.tsx +95 -0
- package/src/components/tree-view/tree-view-resizer.tsx +83 -0
- package/src/components/tree-view/tree-view-row.tsx +414 -0
- package/src/components/tree-view/tree-view.tsx +300 -0
- package/src/components/tree-view/use-tree-state.ts +184 -0
- package/src/components/ui/button.tsx +79 -1
- package/src/components/ui/dropdown-menu.tsx +1 -1
- package/src/components/ui/select.tsx +7 -0
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/lib/i18n-fr.ts +34 -51
- package/src/lib/utils.ts +32 -4
- package/src/styles.css +255 -0
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts +0 -11
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-execution-sheet.js +0 -190
- package/dist/components/admin/admin-workflows-execution-sheet.js.map +0 -1
- package/dist/components/admin/admin-workflows-executions-panel.d.ts +0 -9
- package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-executions-panel.js +0 -121
- package/dist/components/admin/admin-workflows-executions-panel.js.map +0 -1
- package/dist/components/admin/admin-workflows-status-badge.d.ts +0 -12
- package/dist/components/admin/admin-workflows-status-badge.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-status-badge.js +0 -30
- package/dist/components/admin/admin-workflows-status-badge.js.map +0 -1
- package/dist/components/admin/admin-workflows-status-labels.d.ts +0 -19
- package/dist/components/admin/admin-workflows-status-labels.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows-status-labels.js +0 -48
- package/dist/components/admin/admin-workflows-status-labels.js.map +0 -1
- package/dist/components/admin/admin-workflows.d.ts +0 -4
- package/dist/components/admin/admin-workflows.d.ts.map +0 -1
- package/dist/components/admin/admin-workflows.js +0 -145
- package/dist/components/admin/admin-workflows.js.map +0 -1
- package/src/components/admin/admin-workflows-execution-sheet.tsx +0 -285
- package/src/components/admin/admin-workflows-executions-panel.tsx +0 -169
- package/src/components/admin/admin-workflows-status-badge.tsx +0 -41
- package/src/components/admin/admin-workflows-status-labels.ts +0 -51
- package/src/components/admin/admin-workflows.tsx +0 -209
|
@@ -6,14 +6,15 @@ import { FormFieldAutoSaveProvider, FormFieldLayoutProvider, FormFieldRequiredMa
|
|
|
6
6
|
import { spanClass, widthFor } from "../control-base/grid.js";
|
|
7
7
|
import { iconFor } from "../control-base/icon-hint.js";
|
|
8
8
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
|
|
9
|
-
import { Control } from "../control/control.js";
|
|
9
|
+
import { Control, readSchemaControl, useDynamicControlRefresh } from "../control/control.js";
|
|
10
10
|
import { useEffect, useMemo, useState } from "react";
|
|
11
11
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { AlertCircle, X } from "lucide-react";
|
|
13
13
|
import { z } from "alepha";
|
|
14
14
|
import { useI18n } from "alepha/react/i18n";
|
|
15
15
|
import { useAlepha } from "alepha/react";
|
|
16
|
-
import {
|
|
16
|
+
import { resolveSchemaControl } from "alepha/react/ui";
|
|
17
|
+
import { isObjectOrUnionOfObjects, useFieldValue, useFormState } from "alepha/react/form";
|
|
17
18
|
//#region src/components/auto-form/auto-form.tsx
|
|
18
19
|
/**
|
|
19
20
|
* Detect a `z.string()` schema (incl. optional/nullable wrappers) so the
|
|
@@ -174,7 +175,7 @@ function AutoForm(props) {
|
|
|
174
175
|
})]
|
|
175
176
|
}),
|
|
176
177
|
/* @__PURE__ */ jsxs(CardContent, {
|
|
177
|
-
className: cn("flex flex-col gap-4", props.fill && "min-h-0 flex-1 overflow-y-auto"),
|
|
178
|
+
className: cn("flex flex-col gap-4", props.fill && "relative min-h-0 flex-1 overflow-y-auto"),
|
|
178
179
|
children: [fieldGroups, props.footer]
|
|
179
180
|
}),
|
|
180
181
|
!skipBottomBar && /* @__PURE__ */ jsx(CardFooter, { children: /* @__PURE__ */ jsx(BottomBar, {
|
|
@@ -221,6 +222,42 @@ function AutoForm(props) {
|
|
|
221
222
|
})
|
|
222
223
|
});
|
|
223
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* One field of the grid: the cell, sized, and the control inside it.
|
|
227
|
+
*
|
|
228
|
+
* ⚠️ Its own component rather than a `<div>` in `GroupBlock`'s loop, and that
|
|
229
|
+
* is the whole point of it. Sizing a cell means ASKING the field's `$control`
|
|
230
|
+
* how wide it wants to be, and a function-form `$control` can only be asked
|
|
231
|
+
* with `{ form, value }` and re-asked when another field changes - two hooks,
|
|
232
|
+
* which cannot be called inside a `.map`.
|
|
233
|
+
*
|
|
234
|
+
* Before this, the grid was computed from the STATIC schema while `Control`
|
|
235
|
+
* resolved the same `$control` DYNAMICALLY, and the two disagreed in both
|
|
236
|
+
* directions: a field whose width came from a function silently fell back to
|
|
237
|
+
* the 33% default (`widthFor` reads `.width` off the raw value, and a function
|
|
238
|
+
* has none), and a field the function had hidden left its cell behind, holding
|
|
239
|
+
* columns for a control that rendered nothing.
|
|
240
|
+
*/
|
|
241
|
+
const GroupGridField = (props) => {
|
|
242
|
+
const { item } = props;
|
|
243
|
+
const [value] = useFieldValue(item.input);
|
|
244
|
+
useDynamicControlRefresh(item.input);
|
|
245
|
+
const resolved = resolveSchemaControl(readSchemaControl(item.input), {
|
|
246
|
+
form: item.input.form,
|
|
247
|
+
value
|
|
248
|
+
});
|
|
249
|
+
if (resolved === null) return null;
|
|
250
|
+
const width = widthFor(item.input, resolved.width ?? item.props.width);
|
|
251
|
+
const hidden = !!resolved.hidden;
|
|
252
|
+
return /* @__PURE__ */ jsx("div", {
|
|
253
|
+
className: props.gridClassName ? width >= 100 ? "col-span-full" : void 0 : spanClass(width),
|
|
254
|
+
children: hidden ? null : /* @__PURE__ */ jsx(Control, {
|
|
255
|
+
input: item.input,
|
|
256
|
+
...item.props,
|
|
257
|
+
disabled: props.disabled || item.props.disabled
|
|
258
|
+
})
|
|
259
|
+
});
|
|
260
|
+
};
|
|
224
261
|
const GroupBlock = (props) => {
|
|
225
262
|
const { group } = props;
|
|
226
263
|
const { tr } = useI18n();
|
|
@@ -253,28 +290,32 @@ const GroupBlock = (props) => {
|
|
|
253
290
|
}).filter(Boolean);
|
|
254
291
|
if (!items.length && !props.multiGroup && !props.bottomBar) return null;
|
|
255
292
|
const isNaked = !group.title && !Icon;
|
|
256
|
-
if (props.layout === "row")
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
className: "
|
|
260
|
-
children: [
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
293
|
+
if (props.layout === "row") {
|
|
294
|
+
const hasHeading = !!(group.title || group.description);
|
|
295
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
296
|
+
className: "shrink-0",
|
|
297
|
+
children: [hasHeading && /* @__PURE__ */ jsxs("div", {
|
|
298
|
+
className: "mb-2 flex items-start gap-2",
|
|
299
|
+
children: [Icon && /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground mt-0.5 size-4 shrink-0" }), /* @__PURE__ */ jsx(SettingsHeading, {
|
|
300
|
+
title: group.title,
|
|
301
|
+
description: group.description
|
|
302
|
+
})]
|
|
303
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
304
|
+
className: "bg-card divide-y rounded-lg border shadow-sm",
|
|
305
|
+
children: [items.map((it) => /* @__PURE__ */ jsx(Control, {
|
|
306
|
+
input: it.input,
|
|
307
|
+
...it.props,
|
|
308
|
+
disabled: props.disabled || it.props.disabled
|
|
309
|
+
}, it.name)), props.bottomBar && /* @__PURE__ */ jsx("div", {
|
|
310
|
+
className: "px-4 py-3",
|
|
311
|
+
children: props.bottomBar
|
|
312
|
+
})]
|
|
273
313
|
})]
|
|
274
|
-
})
|
|
275
|
-
}
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
const wrapperCls = cn("shrink-0", props.multiGroup && !isNaked && "overflow-hidden rounded-md border");
|
|
276
317
|
return /* @__PURE__ */ jsxs("div", {
|
|
277
|
-
className:
|
|
318
|
+
className: wrapperCls,
|
|
278
319
|
children: [props.multiGroup && !isNaked && /* @__PURE__ */ jsxs("div", {
|
|
279
320
|
className: "bg-muted/40 flex items-center gap-2 border-b px-3 py-2",
|
|
280
321
|
children: [Icon && /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground size-4" }), group.title && /* @__PURE__ */ jsx("span", {
|
|
@@ -283,13 +324,10 @@ const GroupBlock = (props) => {
|
|
|
283
324
|
})]
|
|
284
325
|
}), /* @__PURE__ */ jsx("div", {
|
|
285
326
|
className: cn("grid gap-3", props.gridClassName ?? "grid-cols-12", !isNaked && "p-3"),
|
|
286
|
-
children: items.map((it) => /* @__PURE__ */ jsx(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
...it.props,
|
|
291
|
-
disabled: props.disabled || it.props.disabled
|
|
292
|
-
})
|
|
327
|
+
children: items.map((it) => /* @__PURE__ */ jsx(GroupGridField, {
|
|
328
|
+
item: it,
|
|
329
|
+
gridClassName: props.gridClassName,
|
|
330
|
+
disabled: props.disabled
|
|
293
331
|
}, it.name))
|
|
294
332
|
})]
|
|
295
333
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-form.js","names":[],"sources":["../../../src/components/auto-form/auto-form.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport {\n FormFieldAutoSaveProvider,\n FormFieldLayoutProvider,\n FormFieldRequiredMarkerProvider,\n} from \"@alepha/ui/components/control-base/form-field\";\nimport { spanClass, widthFor } from \"@alepha/ui/components/control-base/grid\";\nimport { iconFor } from \"@alepha/ui/components/control-base/icon-hint\";\nimport {\n Control,\n type ControlProps,\n} from \"@alepha/ui/components/control/control\";\nimport { SettingsHeading } from \"@alepha/ui/components/settings/settings-heading\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardTitle,\n} from \"@alepha/ui/components/ui/card\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@alepha/ui/components/ui/popover\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { type ZObject, type ZType, z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport {\n type BaseInputField,\n type FormModel,\n isObjectOrUnionOfObjects,\n useFormState,\n} from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { AlertCircle, X } from \"lucide-react\";\nimport { type ReactNode, useEffect, useMemo, useState } from \"react\";\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 `GroupBlock` 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\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?: \"default\" | \"outline\" | \"ghost\" | \"destructive\" | \"secondary\";\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n}\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 function 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:change\", (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 <BottomBar {...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 <GroupBlock\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 props.fill && \"min-h-0 flex-1 overflow-y-auto\",\n )}\n >\n {fieldGroups}\n {props.footer}\n </CardContent>\n {!skipBottomBar && (\n <CardFooter>\n <BottomBar {...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 <BottomBar {...bottomBarProps} />\n )}\n </div>\n </form>\n );\n}\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface GroupBlockProps {\n group: AutoFormGroup;\n inputs: Record<string, never>;\n fields?: Partial<Record<string, Partial<Omit<ControlProps, \"input\">>>>;\n i18nPrefix?: string;\n disabled?: boolean;\n multiGroup?: boolean;\n layout: \"stack\" | \"row\";\n gridClassName?: string;\n /**\n * The form's action bar, rendered as this group's last divided row. Set by\n * `AutoForm` on the *last* group in `layout=\"row\"`; `undefined` everywhere\n * else, including every group in the grid layout.\n */\n bottomBar?: ReactNode;\n}\n\nconst GroupBlock = (props: GroupBlockProps) => {\n const { group } = props;\n const { tr } = useI18n();\n const Icon = group.icon ? iconFor(group.icon) : undefined;\n\n const items = group.fields\n .map((entry) => {\n const name = typeof entry === \"string\" ? entry : entry.name;\n const override =\n typeof entry === \"object\" ? (entry as Partial<ControlProps>) : {};\n const input = props.inputs[name];\n if (!input) return null;\n const fromMap = props.fields?.[name] ?? {};\n const merged: Partial<ControlProps> = {\n ...fromMap,\n ...override,\n };\n // i18nPrefix: fill label/description from the dictionary when neither\n // the override nor the schema already provides one. A missing key\n // makes `tr` echo the key back (an empty `default` is falsy, so the\n // provider can't substitute it) — guard with `!== key` so an absent\n // entry leaves the Control to fall back to `schema.title ??\n // prettyName(field)`, preserving current behaviour.\n if (props.i18nPrefix && merged.label === undefined) {\n const key = `${props.i18nPrefix}.${name}`;\n const label = tr(key, { default: \"\" });\n if (label && label !== key) merged.label = label;\n }\n if (props.i18nPrefix && merged.description === undefined) {\n const key = `${props.i18nPrefix}.${name}.desc`;\n const desc = tr(key, { default: \"\" });\n if (desc && desc !== key) merged.description = desc;\n }\n // Hand the extended prefix down so an object's children and an array's\n // item fields resolve their own labels/help\n // (`parameters.x.payg.dailyCapCents.desc`).\n if (props.i18nPrefix && merged.i18nPrefix === undefined) {\n merged.i18nPrefix = `${props.i18nPrefix}.${name}`;\n }\n return { name, input, props: merged };\n })\n .filter(Boolean) as Array<{\n name: string;\n input: BaseInputField;\n props: Partial<ControlProps>;\n }>;\n\n // `!props.bottomBar`: a group carrying the action bar still renders when it\n // has no resolvable fields, or the form would silently lose its submit\n // button rather than merely render empty.\n if (!items.length && !props.multiGroup && !props.bottomBar) return null;\n\n // Naked group: no title, no icon → no card chrome (lets solo complex\n // fields render with just their own header).\n const isNaked = !group.title && !Icon;\n\n // Row layout: each group becomes a divider-stacked card, every Control\n // takes a full row through its own FormField row layout (via context).\n if (props.layout === \"row\") {\n const hasHeading = !!(group.title || group.description);\n return (\n <div className=\"shrink-0\">\n {hasHeading && (\n // `SettingsHeading` rather than a local span pair: this is the same\n // heading `SettingsSection` renders, and the whole reason that\n // component exists is that there be exactly one of it. `items-start`\n // + `mt-0.5` keeps the icon on the title line when a description\n // wraps a second one under it.\n <div className=\"mb-2 flex items-start gap-2\">\n {Icon && (\n <Icon className=\"text-muted-foreground mt-0.5 size-4 shrink-0\" />\n )}\n <SettingsHeading\n title={group.title}\n description={group.description}\n />\n </div>\n )}\n <div className=\"bg-card divide-y rounded-lg border shadow-sm\">\n {items.map((it) => (\n <Control\n key={it.name}\n input={it.input}\n {...it.props}\n disabled={props.disabled || it.props.disabled}\n />\n ))}\n {props.bottomBar && (\n // Same `px-4 py-3` every row carries, so the action row sits on\n // the card's own rhythm and `divide-y` draws its rule flush.\n <div className=\"px-4 py-3\">{props.bottomBar}</div>\n )}\n </div>\n </div>\n );\n }\n\n // `shrink-0` on every group root, titled or naked. Under `fill` the groups\n // are flex items of a `CardContent` that has a definite height, and per the\n // flexbox automatic-minimum-size rule an item whose computed `overflow` is\n // not `visible` gets an auto min size of 0. The titled group is the only one\n // carrying `overflow-hidden`, so it was the only child that could give way:\n // once the expanded object groups overflowed the card it absorbed all of it\n // and collapsed to nothing. `CardContent` already asked for `overflow-y-auto`\n // and now gets to do the scrolling itself.\n const wrapperCls = cn(\n \"shrink-0\",\n props.multiGroup && !isNaked && \"overflow-hidden rounded-md border\",\n );\n\n return (\n <div className={wrapperCls}>\n {props.multiGroup && !isNaked && (\n <div className=\"bg-muted/40 flex items-center gap-2 border-b px-3 py-2\">\n {Icon && <Icon className=\"text-muted-foreground size-4\" />}\n {group.title && (\n <span className=\"text-sm font-medium\">{group.title}</span>\n )}\n </div>\n )}\n <div\n className={cn(\n \"grid gap-3\",\n props.gridClassName ?? \"grid-cols-12\",\n !isNaked && \"p-3\",\n )}\n >\n {items.map((it) => (\n <div\n key={it.name}\n className={\n // Responsive grid: each field is one cell. Default: 12-col span\n // from width heuristics. A caller-supplied grid keeps its own\n // column count for scalars, but COMPLEX fields (an object card,\n // a list of object editors) still claim the whole row —\n // squeezing one into a third of a row is unreadable, and the\n // heuristic already knows which those are (width 100).\n props.gridClassName\n ? widthFor(it.input, it.props.width as number | undefined) >=\n 100\n ? \"col-span-full\"\n : undefined\n : spanClass(\n widthFor(it.input, it.props.width as number | undefined),\n )\n }\n >\n <Control\n input={it.input}\n {...it.props}\n disabled={props.disabled || it.props.disabled}\n />\n </div>\n ))}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface BottomBarProps {\n form: FormModel<ZObject>;\n dirty?: boolean;\n loading?: boolean;\n disabled?: boolean;\n disabledIfPristine?: boolean;\n submitLabel?: string;\n noSubmit?: boolean;\n onCancel?: () => void;\n skipReset?: boolean;\n actions?: AutoFormAction[];\n /**\n * Drop the standalone chrome (border / rounded / background / padding) so\n * the bar slots into a `CardFooter`, which provides that chrome itself.\n */\n bare?: boolean;\n}\n\nconst BottomBar = (props: BottomBarProps) => {\n const { tr } = useI18n();\n return (\n <div\n className={\n props.bare\n ? \"flex w-full items-center gap-2\"\n : \"bg-card flex items-center gap-2 rounded-md border p-2\"\n }\n >\n {props.onCancel && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={props.onCancel}\n disabled={props.disabled}\n >\n <X className=\"mr-1 size-4\" />\n {tr(\"autoForm.cancel\", { default: \"Cancel\" })}\n </Button>\n )}\n {!props.skipReset && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => props.form.reset()}\n disabled={props.disabled || !props.dirty}\n >\n {/* No icon, deliberately. The submit button next to it carries none\n — a glyph would have to be either a dated floppy disk or a tick\n that reads as \"done\" rather than \"do it\" — and a bar where only\n some buttons are decorated reads as unfinished rather than as a\n hierarchy. `Button` still shows a spinner while submitting,\n which is the one icon here that carries information. */}\n {tr(\"autoForm.reset\", { default: \"Reset\" })}\n </Button>\n )}\n {props.actions?.map((action, i) => {\n const Icon = action.icon ? iconFor(action.icon) : undefined;\n return (\n <Button\n key={i}\n type=\"button\"\n variant={action.variant ?? \"ghost\"}\n onClick={() => action.onClick()}\n disabled={props.disabled || action.disabled}\n >\n {Icon && <Icon className=\"mr-1 size-4\" />}\n {action.label}\n </Button>\n );\n })}\n\n <div className=\"ml-auto flex items-center gap-2\">\n <FormErrorPopover form={props.form} />\n {!props.noSubmit && (\n <Button\n type=\"submit\"\n loading={props.loading}\n disabled={\n props.disabled || (props.disabledIfPristine && !props.dirty)\n }\n >\n {props.submitLabel ?? tr(\"autoForm.save\", { default: \"Save\" })}\n </Button>\n )}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface FormErrorPopoverProps {\n form: FormModel<ZObject>;\n}\n\nconst FormErrorPopover = (props: FormErrorPopoverProps) => {\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=\"ghost\"\n size=\"icon\"\n aria-label={tr(\"autoForm.errors\", { default: \"Form errors\" })}\n className=\"text-destructive\"\n />\n }\n >\n <AlertCircle className=\"size-4\" />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-80 p-2\">\n <p className=\"text-destructive 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-accent 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 anyErr = error as Error & {\n value?: { message?: string; path?: string };\n };\n const path = anyErr.value?.path ?? \"\";\n const message = anyErr.value?.message ?? error.message ?? \"Invalid\";\n return [{ path, message }];\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\n// ──────────────────────────────────────────────────────────────────────\n\nconst autoGroupSchema = (\n schema: ZObject,\n opts: {\n defaultTitle?: string;\n defaultIcon?: string;\n /**\n * Translator for the fallback group title (the helper is hook-free).\n */\n tr?: (key: string, options?: { default?: string }) => string;\n },\n): AutoFormGroup[] => {\n const general: AutoFormGroup = {\n title:\n opts.defaultTitle ??\n opts.tr?.(\"autoForm.general\", { default: \"General\" }) ??\n \"General\",\n icon: opts.defaultIcon ?? \"cog\",\n fields: [],\n };\n const groups: AutoFormGroup[] = [];\n\n for (const [key, prop] of Object.entries(z.schema.shape(schema))) {\n // Classify the unwrapped schema: an optional object is still an object.\n const inner = z.schema.unwrap(prop);\n const isObject = z.schema.isObject(inner);\n // An array of a UNION of objects is a complex field too — without this it\n // lands in the \"General\" grid and gets a third of a row to render a list\n // of object editors in.\n const isArrayOfObjects =\n z.schema.isArray(inner) &&\n isObjectOrUnionOfObjects(z.schema.element(inner));\n if (isObject || isArrayOfObjects) {\n // Solo complex fields render their own header (label + description +\n // chevron + add/init), so we skip the group bar to avoid a\n // duplicate title row.\n groups.push({ fields: [key] });\n } else {\n general.fields.push(key);\n }\n }\n\n if (general.fields.length === 0) return groups;\n return [general, ...groups];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8CA,SAAS,eAAe,QAA0B;CAChD,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAGlD,MAAM,QAAQ,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,M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EhE,MAAM,QAAQ,EAAE,OAAO,OAAO,IAAI;EAClC,MAAM,WAAW,EAAE,OAAO,SAAS,KAAK;EAIxC,MAAM,mBACJ,EAAE,OAAO,QAAQ,KAAK,KACtB,yBAAyB,EAAE,OAAO,QAAQ,KAAK,CAAC;EAClD,IAAI,YAAY,kBAId,OAAO,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;OAE7B,QAAQ,OAAO,KAAK,GAAG;CAE3B;CAEA,IAAI,QAAQ,OAAO,WAAW,GAAG,OAAO;CACxC,OAAO,CAAC,SAAS,GAAG,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"auto-form.js","names":[],"sources":["../../../src/components/auto-form/auto-form.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport {\n FormFieldAutoSaveProvider,\n FormFieldLayoutProvider,\n FormFieldRequiredMarkerProvider,\n} from \"@alepha/ui/components/control-base/form-field\";\nimport { spanClass, widthFor } from \"@alepha/ui/components/control-base/grid\";\nimport { iconFor } from \"@alepha/ui/components/control-base/icon-hint\";\nimport {\n Control,\n type ControlProps,\n readSchemaControl,\n useDynamicControlRefresh,\n} from \"@alepha/ui/components/control/control\";\nimport { SettingsHeading } from \"@alepha/ui/components/settings/settings-heading\";\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Card,\n CardContent,\n CardDescription,\n CardFooter,\n CardTitle,\n} from \"@alepha/ui/components/ui/card\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@alepha/ui/components/ui/popover\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { type ZObject, type ZType, z } from \"alepha\";\nimport { useAlepha } from \"alepha/react\";\nimport {\n type BaseInputField,\n type FormModel,\n isObjectOrUnionOfObjects,\n useFieldValue,\n useFormState,\n} from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { resolveSchemaControl } from \"alepha/react/ui\";\nimport { AlertCircle, X } from \"lucide-react\";\nimport { type ReactNode, useEffect, useMemo, useState } from \"react\";\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 `GroupBlock` 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\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?: \"default\" | \"outline\" | \"ghost\" | \"destructive\" | \"secondary\";\n onClick: () => void | Promise<void>;\n disabled?: boolean;\n}\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 function 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:change\", (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 <BottomBar {...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 <GroupBlock\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 <BottomBar {...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 <BottomBar {...bottomBarProps} />\n )}\n </div>\n </form>\n );\n}\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface GroupItem {\n name: string;\n input: BaseInputField;\n props: Partial<ControlProps>;\n}\n\ninterface GroupBlockProps {\n group: AutoFormGroup;\n inputs: Record<string, never>;\n fields?: Partial<Record<string, Partial<Omit<ControlProps, \"input\">>>>;\n i18nPrefix?: string;\n disabled?: boolean;\n multiGroup?: boolean;\n layout: \"stack\" | \"row\";\n gridClassName?: string;\n /**\n * The form's action bar, rendered as this group's last divided row. Set by\n * `AutoForm` on the *last* group in `layout=\"row\"`; `undefined` everywhere\n * else, including every group in the grid layout.\n */\n bottomBar?: ReactNode;\n}\n\n/**\n * One field of the grid: the cell, sized, and the control inside it.\n *\n * ⚠️ Its own component rather than a `<div>` in `GroupBlock`'s loop, and that\n * is the whole point of it. Sizing a cell means ASKING the field's `$control`\n * how wide it wants to be, and a function-form `$control` can only be asked\n * with `{ form, value }` and re-asked when another field changes - two hooks,\n * which cannot be called inside a `.map`.\n *\n * Before this, the grid was computed from the STATIC schema while `Control`\n * resolved the same `$control` DYNAMICALLY, and the two disagreed in both\n * directions: a field whose width came from a function silently fell back to\n * the 33% default (`widthFor` reads `.width` off the raw value, and a function\n * has none), and a field the function had hidden left its cell behind, holding\n * columns for a control that rendered nothing.\n */\nconst GroupGridField = (props: {\n item: GroupItem;\n gridClassName?: string;\n disabled?: boolean;\n}) => {\n const { item } = props;\n const [value] = useFieldValue(item.input);\n useDynamicControlRefresh(item.input);\n\n const resolved = resolveSchemaControl(readSchemaControl(item.input), {\n form: item.input.form,\n value,\n });\n\n // `null` is the field saying it is not here AT ALL, so the cell goes with\n // it and the grid repacks.\n if (resolved === null) return null;\n\n // `resolved.width` first, matching the precedence `Control` applies when it\n // merges `{ ...props, ...resolved }`: what the schema asks for beats what a\n // `fields` entry passed in.\n const width = widthFor(\n item.input,\n (resolved.width ?? item.props.width) as number | undefined,\n );\n\n // `hidden` is the other answer: the field is here, it just draws nothing.\n // The cell stays, at its own width, so the fields around it do not move\n // while it comes and goes. That is the whole difference from `false`, and\n // it is why the width has to survive the resolve.\n const hidden = !!resolved.hidden;\n\n return (\n <div\n className={\n // Responsive grid: each field is one cell. Default: 12-col span from\n // width heuristics. A caller-supplied grid keeps its own column count\n // for scalars, but COMPLEX fields (an object card, a list of object\n // editors) still claim the whole row — squeezing one into a third of a\n // row is unreadable, and the heuristic already knows which those are\n // (width 100).\n props.gridClassName\n ? width >= 100\n ? \"col-span-full\"\n : undefined\n : spanClass(width)\n }\n >\n {hidden ? null : (\n <Control\n input={item.input}\n {...item.props}\n disabled={props.disabled || item.props.disabled}\n />\n )}\n </div>\n );\n};\n\nconst GroupBlock = (props: GroupBlockProps) => {\n const { group } = props;\n const { tr } = useI18n();\n const Icon = group.icon ? iconFor(group.icon) : undefined;\n\n const items = group.fields\n .map((entry) => {\n const name = typeof entry === \"string\" ? entry : entry.name;\n const override =\n typeof entry === \"object\" ? (entry as Partial<ControlProps>) : {};\n const input = props.inputs[name];\n if (!input) return null;\n const fromMap = props.fields?.[name] ?? {};\n const merged: Partial<ControlProps> = {\n ...fromMap,\n ...override,\n };\n // i18nPrefix: fill label/description from the dictionary when neither\n // the override nor the schema already provides one. A missing key\n // makes `tr` echo the key back (an empty `default` is falsy, so the\n // provider can't substitute it) — guard with `!== key` so an absent\n // entry leaves the Control to fall back to `schema.title ??\n // prettyName(field)`, preserving current behaviour.\n if (props.i18nPrefix && merged.label === undefined) {\n const key = `${props.i18nPrefix}.${name}`;\n const label = tr(key, { default: \"\" });\n if (label && label !== key) merged.label = label;\n }\n if (props.i18nPrefix && merged.description === undefined) {\n const key = `${props.i18nPrefix}.${name}.desc`;\n const desc = tr(key, { default: \"\" });\n if (desc && desc !== key) merged.description = desc;\n }\n // Hand the extended prefix down so an object's children and an array's\n // item fields resolve their own labels/help\n // (`parameters.x.payg.dailyCapCents.desc`).\n if (props.i18nPrefix && merged.i18nPrefix === undefined) {\n merged.i18nPrefix = `${props.i18nPrefix}.${name}`;\n }\n return { name, input, props: merged };\n })\n .filter(Boolean) as GroupItem[];\n\n // `!props.bottomBar`: a group carrying the action bar still renders when it\n // has no resolvable fields, or the form would silently lose its submit\n // button rather than merely render empty.\n if (!items.length && !props.multiGroup && !props.bottomBar) return null;\n\n // Naked group: no title, no icon → no card chrome (lets solo complex\n // fields render with just their own header).\n const isNaked = !group.title && !Icon;\n\n // Row layout: each group becomes a divider-stacked card, every Control\n // takes a full row through its own FormField row layout (via context).\n if (props.layout === \"row\") {\n const hasHeading = !!(group.title || group.description);\n return (\n <div className=\"shrink-0\">\n {hasHeading && (\n // `SettingsHeading` rather than a local span pair: this is the same\n // heading `SettingsSection` renders, and the whole reason that\n // component exists is that there be exactly one of it. `items-start`\n // + `mt-0.5` keeps the icon on the title line when a description\n // wraps a second one under it.\n <div className=\"mb-2 flex items-start gap-2\">\n {Icon && (\n <Icon className=\"text-muted-foreground mt-0.5 size-4 shrink-0\" />\n )}\n <SettingsHeading\n title={group.title}\n description={group.description}\n />\n </div>\n )}\n <div className=\"bg-card divide-y rounded-lg border shadow-sm\">\n {items.map((it) => (\n <Control\n key={it.name}\n input={it.input}\n {...it.props}\n disabled={props.disabled || it.props.disabled}\n />\n ))}\n {props.bottomBar && (\n // Same `px-4 py-3` every row carries, so the action row sits on\n // the card's own rhythm and `divide-y` draws its rule flush.\n <div className=\"px-4 py-3\">{props.bottomBar}</div>\n )}\n </div>\n </div>\n );\n }\n\n // `shrink-0` on every group root, titled or naked. Under `fill` the groups\n // are flex items of a `CardContent` that has a definite height, and per the\n // flexbox automatic-minimum-size rule an item whose computed `overflow` is\n // not `visible` gets an auto min size of 0. The titled group is the only one\n // carrying `overflow-hidden`, so it was the only child that could give way:\n // once the expanded object groups overflowed the card it absorbed all of it\n // and collapsed to nothing. `CardContent` already asked for `overflow-y-auto`\n // and now gets to do the scrolling itself.\n const wrapperCls = cn(\n \"shrink-0\",\n props.multiGroup && !isNaked && \"overflow-hidden rounded-md border\",\n );\n\n return (\n <div className={wrapperCls}>\n {props.multiGroup && !isNaked && (\n <div className=\"bg-muted/40 flex items-center gap-2 border-b px-3 py-2\">\n {Icon && <Icon className=\"text-muted-foreground size-4\" />}\n {group.title && (\n <span className=\"text-sm font-medium\">{group.title}</span>\n )}\n </div>\n )}\n <div\n className={cn(\n \"grid gap-3\",\n props.gridClassName ?? \"grid-cols-12\",\n !isNaked && \"p-3\",\n )}\n >\n {items.map((it) => (\n <GroupGridField\n key={it.name}\n item={it}\n gridClassName={props.gridClassName}\n disabled={props.disabled}\n />\n ))}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface BottomBarProps {\n form: FormModel<ZObject>;\n dirty?: boolean;\n loading?: boolean;\n disabled?: boolean;\n disabledIfPristine?: boolean;\n submitLabel?: string;\n noSubmit?: boolean;\n onCancel?: () => void;\n skipReset?: boolean;\n actions?: AutoFormAction[];\n /**\n * Drop the standalone chrome (border / rounded / background / padding) so\n * the bar slots into a `CardFooter`, which provides that chrome itself.\n */\n bare?: boolean;\n}\n\nconst BottomBar = (props: BottomBarProps) => {\n const { tr } = useI18n();\n return (\n <div\n className={\n props.bare\n ? \"flex w-full items-center gap-2\"\n : \"bg-card flex items-center gap-2 rounded-md border p-2\"\n }\n >\n {props.onCancel && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={props.onCancel}\n disabled={props.disabled}\n >\n <X className=\"mr-1 size-4\" />\n {tr(\"autoForm.cancel\", { default: \"Cancel\" })}\n </Button>\n )}\n {!props.skipReset && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => props.form.reset()}\n disabled={props.disabled || !props.dirty}\n >\n {/* No icon, deliberately. The submit button next to it carries none\n — a glyph would have to be either a dated floppy disk or a tick\n that reads as \"done\" rather than \"do it\" — and a bar where only\n some buttons are decorated reads as unfinished rather than as a\n hierarchy. `Button` still shows a spinner while submitting,\n which is the one icon here that carries information. */}\n {tr(\"autoForm.reset\", { default: \"Reset\" })}\n </Button>\n )}\n {props.actions?.map((action, i) => {\n const Icon = action.icon ? iconFor(action.icon) : undefined;\n return (\n <Button\n key={i}\n type=\"button\"\n variant={action.variant ?? \"ghost\"}\n onClick={() => action.onClick()}\n disabled={props.disabled || action.disabled}\n >\n {Icon && <Icon className=\"mr-1 size-4\" />}\n {action.label}\n </Button>\n );\n })}\n\n <div className=\"ml-auto flex items-center gap-2\">\n <FormErrorPopover form={props.form} />\n {!props.noSubmit && (\n <Button\n type=\"submit\"\n loading={props.loading}\n disabled={\n props.disabled || (props.disabledIfPristine && !props.dirty)\n }\n >\n {props.submitLabel ?? tr(\"autoForm.save\", { default: \"Save\" })}\n </Button>\n )}\n </div>\n </div>\n );\n};\n\n// ──────────────────────────────────────────────────────────────────────\n\ninterface FormErrorPopoverProps {\n form: FormModel<ZObject>;\n}\n\nconst FormErrorPopover = (props: FormErrorPopoverProps) => {\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=\"ghost\"\n size=\"icon\"\n aria-label={tr(\"autoForm.errors\", { default: \"Form errors\" })}\n className=\"text-destructive\"\n />\n }\n >\n <AlertCircle className=\"size-4\" />\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-80 p-2\">\n <p className=\"text-destructive 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-accent 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 anyErr = error as Error & {\n value?: { message?: string; path?: string };\n };\n const path = anyErr.value?.path ?? \"\";\n const message = anyErr.value?.message ?? error.message ?? \"Invalid\";\n return [{ path, message }];\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\n// ──────────────────────────────────────────────────────────────────────\n\nconst autoGroupSchema = (\n schema: ZObject,\n opts: {\n defaultTitle?: string;\n defaultIcon?: string;\n /**\n * Translator for the fallback group title (the helper is hook-free).\n */\n tr?: (key: string, options?: { default?: string }) => string;\n },\n): AutoFormGroup[] => {\n const general: AutoFormGroup = {\n title:\n opts.defaultTitle ??\n opts.tr?.(\"autoForm.general\", { default: \"General\" }) ??\n \"General\",\n icon: opts.defaultIcon ?? \"cog\",\n fields: [],\n };\n const groups: AutoFormGroup[] = [];\n\n for (const [key, prop] of Object.entries(z.schema.shape(schema))) {\n // Classify the unwrapped schema: an optional object is still an object.\n const inner = z.schema.unwrap(prop);\n const isObject = z.schema.isObject(inner);\n // An array of a UNION of objects is a complex field too — without this it\n // lands in the \"General\" grid and gets a third of a row to render a list\n // of object editors in.\n const isArrayOfObjects =\n z.schema.isArray(inner) &&\n isObjectOrUnionOfObjects(z.schema.element(inner));\n if (isObject || isArrayOfObjects) {\n // Solo complex fields render their own header (label + description +\n // chevron + add/init), so we skip the group bar to avoid a\n // duplicate title row.\n groups.push({ fields: [key] });\n } else {\n general.fields.push(key);\n }\n }\n\n if (general.fields.length === 0) return groups;\n return [general, ...groups];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAS,eAAe,QAA0B;CAChD,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU,OAAO;CAGlD,MAAM,QAAQ,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;;;;;;AAsOA,SAAgB,SAA4B,OAAyB;CACnE,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,EAAE,O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B;EAC7B,OACE,KAAK,gBACL,KAAK,KAAK,oBAAoB,EAAE,SAAS,UAAU,CAAC,KACpD;EACF,MAAM,KAAK,eAAe;EAC1B,QAAQ,CAAC;CACX;CACA,MAAM,SAA0B,CAAC;CAEjC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,EAAE,OAAO,MAAM,MAAM,CAAC,GAAG;EAEhE,MAAM,QAAQ,EAAE,OAAO,OAAO,IAAI;EAClC,MAAM,WAAW,EAAE,OAAO,SAAS,KAAK;EAIxC,MAAM,mBACJ,EAAE,OAAO,QAAQ,KAAK,KACtB,yBAAyB,EAAE,OAAO,QAAQ,KAAK,CAAC;EAClD,IAAI,YAAY,kBAId,OAAO,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;OAE7B,QAAQ,OAAO,KAAK,GAAG;CAE3B;CAEA,IAAI,QAAQ,OAAO,WAAW,GAAG,OAAO;CACxC,OAAO,CAAC,SAAS,GAAG,MAAM;AAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-dark.d.ts","sourceRoot":"","sources":["../../../src/components/button-dark/button-dark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"button-dark.d.ts","sourceRoot":"","sources":["../../../src/components/button-dark/button-dark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAsDD;;;;GAIG;AACH,eAAO,MAAM,UAAU,UAAW,eAAe,sBA2BhD,CAAC"}
|
|
@@ -1,21 +1,53 @@
|
|
|
1
1
|
import { Button } from "../ui/button.js";
|
|
2
2
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Monitor, Moon, Sun } from "lucide-react";
|
|
6
6
|
import { useColorMode } from "alepha/react/ui";
|
|
7
7
|
//#region src/components/button-dark/button-dark.tsx
|
|
8
|
-
const ICON = {
|
|
9
|
-
light: /* @__PURE__ */ jsx(Sun, { className: "size-4" }),
|
|
10
|
-
dark: /* @__PURE__ */ jsx(Moon, { className: "size-4" }),
|
|
11
|
-
system: /* @__PURE__ */ jsx(Monitor, { className: "size-4" })
|
|
12
|
-
};
|
|
13
8
|
const NEXT = {
|
|
14
9
|
light: "dark",
|
|
15
10
|
dark: "system",
|
|
16
11
|
system: "light"
|
|
17
12
|
};
|
|
18
13
|
/**
|
|
14
|
+
* Every icon the button can show, all rendered, with CSS revealing one.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ This is the point of the component, not a styling flourish. It used to
|
|
17
|
+
* render ONE icon chosen from the color mode DURING RENDER, which is a
|
|
18
|
+
* hydration mismatch on any PRERENDERED page: the HTML is built with the
|
|
19
|
+
* default preference and the client renders the visitor's. React reported #418
|
|
20
|
+
* on every cold load for anyone who had ever picked a mode, then threw the
|
|
21
|
+
* prerendered tree away and re-rendered from scratch - most of what
|
|
22
|
+
* prerendering was buying.
|
|
23
|
+
*
|
|
24
|
+
* `apps/docs` had already solved this by hand and wrote the rule down: the
|
|
25
|
+
* theme is "a paint, not a render". The markup here is identical for every
|
|
26
|
+
* visitor, and `.dark` / `data-color-mode` on `<html>` - both outside React's
|
|
27
|
+
* tree, both set by `ColorScheme` - decide which copy shows.
|
|
28
|
+
*
|
|
29
|
+
* A mount gate would be the other way round, and it is wrong here: an app that
|
|
30
|
+
* genuinely SSRs (Lore) already emits the right icon from the request's
|
|
31
|
+
* cookie, so deferring to a mount would INTRODUCE the mismatch it is meant to
|
|
32
|
+
* prevent. `withSystem` is a prop, identical on both sides, so branching on it
|
|
33
|
+
* is safe.
|
|
34
|
+
*/
|
|
35
|
+
const TWO_STATE_ICONS = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Sun, { className: "size-4 dark:hidden" }), /* @__PURE__ */ jsx(Moon, { className: "hidden size-4 dark:block" })] });
|
|
36
|
+
/**
|
|
37
|
+
* The three-state cycle needs the UNRESOLVED preference, which `.dark` cannot
|
|
38
|
+
* express: "system, resolved to dark" and "dark, chosen" carry the same class.
|
|
39
|
+
* `data-color-mode` carries it.
|
|
40
|
+
*
|
|
41
|
+
* The system icon is the one that shows when the attribute is ABSENT, which is
|
|
42
|
+
* every first paint and every prerendered document - and `system` is also the
|
|
43
|
+
* default mode, so the fallback is the correct answer rather than a guess.
|
|
44
|
+
*/
|
|
45
|
+
const THREE_STATE_ICONS = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(Sun, { className: "hidden size-4 [[data-color-mode='light']_&]:block" }),
|
|
47
|
+
/* @__PURE__ */ jsx(Moon, { className: "hidden size-4 [[data-color-mode='dark']_&]:block" }),
|
|
48
|
+
/* @__PURE__ */ jsx(Monitor, { className: "size-4 [[data-color-mode='dark']_&]:hidden [[data-color-mode='light']_&]:hidden" })
|
|
49
|
+
] });
|
|
50
|
+
/**
|
|
19
51
|
* Color-mode toggle. Default is a two-state Sun ↔ Moon flip; opt into the
|
|
20
52
|
* three-state `light → dark → system` cycle with `withSystem`.
|
|
21
53
|
* Reads/writes the persisted UI cookie via `useColorMode()`.
|
|
@@ -26,7 +58,6 @@ const ButtonDark = (props) => {
|
|
|
26
58
|
if (props.withSystem) setMode(NEXT[mode]);
|
|
27
59
|
else setMode(resolved === "dark" ? "light" : "dark");
|
|
28
60
|
};
|
|
29
|
-
const iconKey = props.withSystem ? mode : resolved;
|
|
30
61
|
const label = props.label ?? "Toggle color mode";
|
|
31
62
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
32
63
|
render: /* @__PURE__ */ jsx(Button, {
|
|
@@ -35,7 +66,7 @@ const ButtonDark = (props) => {
|
|
|
35
66
|
"aria-label": label,
|
|
36
67
|
onClick
|
|
37
68
|
}),
|
|
38
|
-
children:
|
|
69
|
+
children: props.withSystem ? THREE_STATE_ICONS : TWO_STATE_ICONS
|
|
39
70
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: label })] });
|
|
40
71
|
};
|
|
41
72
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-dark.js","names":[],"sources":["../../../src/components/button-dark/button-dark.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useColorMode } from \"alepha/react/ui\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonDarkProps {\n /**\n * Optional aria-label override. Defaults to `\"Toggle color mode\"`.\n */\n label?: string;\n /**\n * When `true`, the button cycles through three states `light → dark →\n * system`. By default the button toggles strictly between `light` and\n * `dark` using the resolved mode as the starting point.\n */\n withSystem?: boolean;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\nconst
|
|
1
|
+
{"version":3,"file":"button-dark.js","names":[],"sources":["../../../src/components/button-dark/button-dark.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useColorMode } from \"alepha/react/ui\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonDarkProps {\n /**\n * Optional aria-label override. Defaults to `\"Toggle color mode\"`.\n */\n label?: string;\n /**\n * When `true`, the button cycles through three states `light → dark →\n * system`. By default the button toggles strictly between `light` and\n * `dark` using the resolved mode as the starting point.\n */\n withSystem?: boolean;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\nconst NEXT: Record<\"light\" | \"dark\" | \"system\", \"light\" | \"dark\" | \"system\"> = {\n light: \"dark\",\n dark: \"system\",\n system: \"light\",\n};\n\n/**\n * Every icon the button can show, all rendered, with CSS revealing one.\n *\n * ⚠️ This is the point of the component, not a styling flourish. It used to\n * render ONE icon chosen from the color mode DURING RENDER, which is a\n * hydration mismatch on any PRERENDERED page: the HTML is built with the\n * default preference and the client renders the visitor's. React reported #418\n * on every cold load for anyone who had ever picked a mode, then threw the\n * prerendered tree away and re-rendered from scratch - most of what\n * prerendering was buying.\n *\n * `apps/docs` had already solved this by hand and wrote the rule down: the\n * theme is \"a paint, not a render\". The markup here is identical for every\n * visitor, and `.dark` / `data-color-mode` on `<html>` - both outside React's\n * tree, both set by `ColorScheme` - decide which copy shows.\n *\n * A mount gate would be the other way round, and it is wrong here: an app that\n * genuinely SSRs (Lore) already emits the right icon from the request's\n * cookie, so deferring to a mount would INTRODUCE the mismatch it is meant to\n * prevent. `withSystem` is a prop, identical on both sides, so branching on it\n * is safe.\n */\nconst TWO_STATE_ICONS: ReactNode = (\n <>\n <Sun className=\"size-4 dark:hidden\" />\n <Moon className=\"hidden size-4 dark:block\" />\n </>\n);\n\n/**\n * The three-state cycle needs the UNRESOLVED preference, which `.dark` cannot\n * express: \"system, resolved to dark\" and \"dark, chosen\" carry the same class.\n * `data-color-mode` carries it.\n *\n * The system icon is the one that shows when the attribute is ABSENT, which is\n * every first paint and every prerendered document - and `system` is also the\n * default mode, so the fallback is the correct answer rather than a guess.\n */\nconst THREE_STATE_ICONS: ReactNode = (\n <>\n <Sun className=\"hidden size-4 [[data-color-mode='light']_&]:block\" />\n <Moon className=\"hidden size-4 [[data-color-mode='dark']_&]:block\" />\n <Monitor className=\"size-4 [[data-color-mode='dark']_&]:hidden [[data-color-mode='light']_&]:hidden\" />\n </>\n);\n\n/**\n * Color-mode toggle. Default is a two-state Sun ↔ Moon flip; opt into the\n * three-state `light → dark → system` cycle with `withSystem`.\n * Reads/writes the persisted UI cookie via `useColorMode()`.\n */\nexport const ButtonDark = (props: ButtonDarkProps) => {\n const { mode, resolved, setMode } = useColorMode();\n const onClick = () => {\n if (props.withSystem) {\n setMode(NEXT[mode]);\n } else {\n setMode(resolved === \"dark\" ? \"light\" : \"dark\");\n }\n };\n const label = props.label ?? \"Toggle color mode\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n onClick={onClick}\n />\n }\n >\n {props.withSystem ? THREE_STATE_ICONS : TWO_STATE_ICONS}\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n );\n};\n"],"mappings":";;;;;;;AAgCA,MAAM,OAAyE;CAC7E,OAAO;CACP,MAAM;CACN,QAAQ;AACV;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,kBACJ,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,KAAD,EAAK,WAAU,qBAAsB,CAAA,GACrC,oBAAC,MAAD,EAAM,WAAU,2BAA4B,CAAA,CAC5C,EAAA,CAAA;;;;;;;;;;AAYJ,MAAM,oBACJ,qBAAA,YAAA,EAAA,UAAA;CACE,oBAAC,KAAD,EAAK,WAAU,oDAAqD,CAAA;CACpE,oBAAC,MAAD,EAAM,WAAU,mDAAoD,CAAA;CACpE,oBAAC,SAAD,EAAS,WAAU,kFAAmF,CAAA;AACtG,EAAA,CAAA;;;;;;AAQJ,MAAa,cAAc,UAA2B;CACpD,MAAM,EAAE,MAAM,UAAU,YAAY,aAAa;CACjD,MAAM,gBAAgB;EACpB,IAAI,MAAM,YACR,QAAQ,KAAK,KAAK;OAElB,QAAQ,aAAa,SAAS,UAAU,MAAM;CAElD;CACA,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;GACH;EACV,CAAA;EAGF,UAAA,MAAM,aAAa,oBAAoB;CAC1B,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA;AAEb"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ButtonInboxProps {
|
|
3
|
+
/**
|
|
4
|
+
* Where "See all" goes. `@alepha/ui` cannot know an application's routes,
|
|
5
|
+
* so the destination is the surface's to decide; the footer is hidden when
|
|
6
|
+
* it is absent.
|
|
7
|
+
*
|
|
8
|
+
* ⚠️ It should point at the **unfiltered** list. This dropdown lists
|
|
9
|
+
* messages from every scope, so a footer landing on a filtered view shows
|
|
10
|
+
* fewer rows than the menu it was clicked out of.
|
|
11
|
+
*/
|
|
12
|
+
seeAllHref?: string;
|
|
13
|
+
/**
|
|
14
|
+
* How many messages the dropdown lists. Five is the shape the design
|
|
15
|
+
* settled on: enough to recognise what happened, short enough to read
|
|
16
|
+
* without scrolling.
|
|
17
|
+
*/
|
|
18
|
+
limit?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Labels, for an application that localises its chrome. Each falls back to
|
|
21
|
+
* its English default.
|
|
22
|
+
*
|
|
23
|
+
* They are this component's own props rather than entries in a shared
|
|
24
|
+
* cluster's `labels` bag, because the surface that mounts the bell is the
|
|
25
|
+
* one that has a translator in hand.
|
|
26
|
+
*/
|
|
27
|
+
labels?: {
|
|
28
|
+
/**
|
|
29
|
+
* The trigger's `aria-label` and tooltip. Defaults to `"Notifications"`.
|
|
30
|
+
*/
|
|
31
|
+
inbox?: string;
|
|
32
|
+
heading?: string;
|
|
33
|
+
empty?: string;
|
|
34
|
+
markAllRead?: string;
|
|
35
|
+
seeAll?: string;
|
|
36
|
+
};
|
|
37
|
+
variant?: "ghost" | "outline";
|
|
38
|
+
/**
|
|
39
|
+
* Called with the message's `href` when a row is clicked, after it has
|
|
40
|
+
* been marked read. Defaults to a full navigation, which is correct for an
|
|
41
|
+
* app with no router in scope and wrong for one that has it - so a router
|
|
42
|
+
* app passes its own push.
|
|
43
|
+
*/
|
|
44
|
+
onOpen?: (href: string) => void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The bell: an unread count, and the most recent messages behind it.
|
|
48
|
+
*
|
|
49
|
+
* ## It decides for itself whether it has anything to offer
|
|
50
|
+
*
|
|
51
|
+
* `countInbox.can()` is the gate, and it is a **registry lookup, not a
|
|
52
|
+
* request**: `/api/_links` carries only the actions the server actually
|
|
53
|
+
* registered, and it prunes every `$secure()` one for an anonymous caller.
|
|
54
|
+
* So this renders nothing both when the app has not registered
|
|
55
|
+
* `alepha/api/notifications` and when nobody is signed in, with no 404 fired
|
|
56
|
+
* on every page load. `AccountRouter` gates its five pages the same way.
|
|
57
|
+
*
|
|
58
|
+
* ## ⚠️ The scope chip is a label the message carries, never a parsed scope
|
|
59
|
+
*
|
|
60
|
+
* `scope` is an app-owned opaque string (`project:65`) and this component has
|
|
61
|
+
* no way to turn one into a name - nor should it learn. The message carries
|
|
62
|
+
* `scopeLabel`, written by whoever pushed it and frozen at that moment. Null
|
|
63
|
+
* means no chip.
|
|
64
|
+
*/
|
|
65
|
+
export declare const ButtonInbox: (props: ButtonInboxProps) => React.JSX.Element | null;
|
|
66
|
+
//# sourceMappingURL=button-inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-inbox.d.ts","sourceRoot":"","sources":["../../../src/components/button-inbox/button-inbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA2B/B,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAWD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,UAAW,gBAAgB,6BAwLlD,CAAC"}
|