@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type Alepha, type ZObject } from "alepha";
|
|
2
|
+
/**
|
|
3
|
+
* The two halves of a shareable filter link.
|
|
4
|
+
*
|
|
5
|
+
* `queryToFilters` reads the URL into filter values on arrival;
|
|
6
|
+
* `filtersToQuery` writes the current values back out when the reader asks
|
|
7
|
+
* for a link. Nothing here runs on its own: the table seeds from the query
|
|
8
|
+
* once, at mount, and only ever writes on an explicit Share.
|
|
9
|
+
*
|
|
10
|
+
* ⚠️ The pair is deliberately NOT a two-way binding. An effect that keeps
|
|
11
|
+
* the address bar in step with the filters is the shape Lore incident #156
|
|
12
|
+
* was about (see `AppRouter.projectQuests`): the router state is a global
|
|
13
|
+
* store, so the render on the way OUT of a page sees the next route's query
|
|
14
|
+
* and writes against it.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Read the filter values a URL carries.
|
|
18
|
+
*
|
|
19
|
+
* Only keys declared by the filter `schema` are read, so query params the
|
|
20
|
+
* page owns (a tab, a locale, a tracking param) never reach the fetch
|
|
21
|
+
* payload. `keys` narrows that further when a table wants only some of its
|
|
22
|
+
* filters to be linkable.
|
|
23
|
+
*
|
|
24
|
+
* Values arrive as strings and are coerced then decoded per field, the same
|
|
25
|
+
* pair the server applies to its own query strings, which is what turns
|
|
26
|
+
* `?limit=25` into a number and `?archived=true` into a boolean. A value the
|
|
27
|
+
* schema refuses is DROPPED rather than thrown: a stale bookmark has to
|
|
28
|
+
* degrade to the unfiltered list, never to an error page.
|
|
29
|
+
*
|
|
30
|
+
* Multi-value filters are comma-joined (`?status=new,triaged`). Repeated
|
|
31
|
+
* params are not an option: `ReactBrowserRouterProvider` builds its query
|
|
32
|
+
* from `URLSearchParams.entries()` into a flat record, so `?status=new&status=triaged`
|
|
33
|
+
* arrives as `triaged` alone.
|
|
34
|
+
*
|
|
35
|
+
* Returns `undefined` rather than `{}` when nothing matches, because the
|
|
36
|
+
* caller hands this to the table's seed slot, and an empty seed still
|
|
37
|
+
* outranks the filters the reader chose last time.
|
|
38
|
+
*/
|
|
39
|
+
export declare const queryToFilters: (alepha: Alepha, schema: ZObject, query: Record<string, any>, keys?: readonly string[]) => Record<string, any> | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Serialize filter values into query params for a shareable link.
|
|
42
|
+
*
|
|
43
|
+
* Strings, numbers, booleans and arrays of those. Anything else is dropped:
|
|
44
|
+
* a link carrying some of the filters is honest, and one carrying
|
|
45
|
+
* `[object Object]` is not.
|
|
46
|
+
*/
|
|
47
|
+
export declare const filtersToQuery: (values: Record<string, any>) => Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* The link the toolbar's Share item copies.
|
|
50
|
+
*
|
|
51
|
+
* Built on the page's own URL, so query params the table knows nothing about
|
|
52
|
+
* (a tab, a locale, a campaign) survive into the shared link. Every filter
|
|
53
|
+
* key is cleared first, which is what makes a filter the reader has since
|
|
54
|
+
* removed disappear from the link rather than linger from the URL they
|
|
55
|
+
* arrived on.
|
|
56
|
+
*
|
|
57
|
+
* Commas are written literally. `URLSearchParams` percent-encodes them, and
|
|
58
|
+
* `?status=new%2Ctriaged` defeats the point of a link somebody reads before
|
|
59
|
+
* clicking it. A comma is a legal sub-delimiter in a query, and it round-trips
|
|
60
|
+
* back through `queryToFilters` either way.
|
|
61
|
+
*/
|
|
62
|
+
export declare const shareFiltersUrl: (href: string, keys: readonly string[], values: Record<string, any>) => string;
|
|
63
|
+
/**
|
|
64
|
+
* The filter values that are actually narrowing the list.
|
|
65
|
+
*
|
|
66
|
+
* Empty is not a filter: an untouched text input holds `""` and a
|
|
67
|
+
* multi-select the reader emptied holds `[]`, and neither should be stored,
|
|
68
|
+
* counted on the toolbar badge, or written into a shared link. One
|
|
69
|
+
* definition rather than three, because the three used to disagree on
|
|
70
|
+
* nothing at all and that is exactly how they would drift.
|
|
71
|
+
*/
|
|
72
|
+
export declare const cleanFilterValues: (values: Record<string, any>) => Record<string, any>;
|
|
73
|
+
//# sourceMappingURL=query-filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-filters.d.ts","sourceRoot":"","sources":["../../../src/components/alepha-table/query-filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,OAAO,EAAmB,MAAM,QAAQ,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,cAAc,WACjB,MAAM,UACN,OAAO,SACR,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,SACnB,SAAS,MAAM,EAAE,KACvB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SA0BxB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,WACjB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAgBvB,CAAC;AAOF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,QACN,SAAS,MAAM,EAAE,UACf,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAYF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,WACpB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAUpB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { coerceScalar, z } from "alepha";
|
|
2
|
+
//#region src/components/alepha-table/query-filters.ts
|
|
3
|
+
/**
|
|
4
|
+
* The two halves of a shareable filter link.
|
|
5
|
+
*
|
|
6
|
+
* `queryToFilters` reads the URL into filter values on arrival;
|
|
7
|
+
* `filtersToQuery` writes the current values back out when the reader asks
|
|
8
|
+
* for a link. Nothing here runs on its own: the table seeds from the query
|
|
9
|
+
* once, at mount, and only ever writes on an explicit Share.
|
|
10
|
+
*
|
|
11
|
+
* ⚠️ The pair is deliberately NOT a two-way binding. An effect that keeps
|
|
12
|
+
* the address bar in step with the filters is the shape Lore incident #156
|
|
13
|
+
* was about (see `AppRouter.projectQuests`): the router state is a global
|
|
14
|
+
* store, so the render on the way OUT of a page sees the next route's query
|
|
15
|
+
* and writes against it.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Read the filter values a URL carries.
|
|
19
|
+
*
|
|
20
|
+
* Only keys declared by the filter `schema` are read, so query params the
|
|
21
|
+
* page owns (a tab, a locale, a tracking param) never reach the fetch
|
|
22
|
+
* payload. `keys` narrows that further when a table wants only some of its
|
|
23
|
+
* filters to be linkable.
|
|
24
|
+
*
|
|
25
|
+
* Values arrive as strings and are coerced then decoded per field, the same
|
|
26
|
+
* pair the server applies to its own query strings, which is what turns
|
|
27
|
+
* `?limit=25` into a number and `?archived=true` into a boolean. A value the
|
|
28
|
+
* schema refuses is DROPPED rather than thrown: a stale bookmark has to
|
|
29
|
+
* degrade to the unfiltered list, never to an error page.
|
|
30
|
+
*
|
|
31
|
+
* Multi-value filters are comma-joined (`?status=new,triaged`). Repeated
|
|
32
|
+
* params are not an option: `ReactBrowserRouterProvider` builds its query
|
|
33
|
+
* from `URLSearchParams.entries()` into a flat record, so `?status=new&status=triaged`
|
|
34
|
+
* arrives as `triaged` alone.
|
|
35
|
+
*
|
|
36
|
+
* Returns `undefined` rather than `{}` when nothing matches, because the
|
|
37
|
+
* caller hands this to the table's seed slot, and an empty seed still
|
|
38
|
+
* outranks the filters the reader chose last time.
|
|
39
|
+
*/
|
|
40
|
+
const queryToFilters = (alepha, schema, query, keys) => {
|
|
41
|
+
const shape = z.schema.shape(schema);
|
|
42
|
+
const out = {};
|
|
43
|
+
for (const [key, field] of Object.entries(shape)) {
|
|
44
|
+
if (keys && !keys.includes(key)) continue;
|
|
45
|
+
const raw = query[key];
|
|
46
|
+
if (typeof raw !== "string" || raw === "") continue;
|
|
47
|
+
const base = z.schema.unwrap(field);
|
|
48
|
+
const input = z.schema.isArray(base) ? raw.split(",").map((part) => part.trim()).filter((part) => part !== "") : raw;
|
|
49
|
+
try {
|
|
50
|
+
out[key] = alepha.codec.decode(field, coerceScalar(field, input));
|
|
51
|
+
} catch {}
|
|
52
|
+
}
|
|
53
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Serialize filter values into query params for a shareable link.
|
|
57
|
+
*
|
|
58
|
+
* Strings, numbers, booleans and arrays of those. Anything else is dropped:
|
|
59
|
+
* a link carrying some of the filters is honest, and one carrying
|
|
60
|
+
* `[object Object]` is not.
|
|
61
|
+
*/
|
|
62
|
+
const filtersToQuery = (values) => {
|
|
63
|
+
const out = {};
|
|
64
|
+
for (const [key, value] of Object.entries(values)) {
|
|
65
|
+
if (value === void 0 || value === null || value === "") continue;
|
|
66
|
+
if (Array.isArray(value)) {
|
|
67
|
+
const parts = value.filter((item) => isScalar(item)).map(String);
|
|
68
|
+
if (parts.length > 0) out[key] = parts.join(",");
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (isScalar(value)) out[key] = String(value);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
};
|
|
75
|
+
const isScalar = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
76
|
+
/**
|
|
77
|
+
* The link the toolbar's Share item copies.
|
|
78
|
+
*
|
|
79
|
+
* Built on the page's own URL, so query params the table knows nothing about
|
|
80
|
+
* (a tab, a locale, a campaign) survive into the shared link. Every filter
|
|
81
|
+
* key is cleared first, which is what makes a filter the reader has since
|
|
82
|
+
* removed disappear from the link rather than linger from the URL they
|
|
83
|
+
* arrived on.
|
|
84
|
+
*
|
|
85
|
+
* Commas are written literally. `URLSearchParams` percent-encodes them, and
|
|
86
|
+
* `?status=new%2Ctriaged` defeats the point of a link somebody reads before
|
|
87
|
+
* clicking it. A comma is a legal sub-delimiter in a query, and it round-trips
|
|
88
|
+
* back through `queryToFilters` either way.
|
|
89
|
+
*/
|
|
90
|
+
const shareFiltersUrl = (href, keys, values) => {
|
|
91
|
+
const url = new URL(href);
|
|
92
|
+
for (const key of keys) url.searchParams.delete(key);
|
|
93
|
+
for (const [key, value] of Object.entries(filtersToQuery(values))) url.searchParams.set(key, value);
|
|
94
|
+
url.search = url.search.replace(/%2C/g, ",");
|
|
95
|
+
return url.toString();
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* The filter values that are actually narrowing the list.
|
|
99
|
+
*
|
|
100
|
+
* Empty is not a filter: an untouched text input holds `""` and a
|
|
101
|
+
* multi-select the reader emptied holds `[]`, and neither should be stored,
|
|
102
|
+
* counted on the toolbar badge, or written into a shared link. One
|
|
103
|
+
* definition rather than three, because the three used to disagree on
|
|
104
|
+
* nothing at all and that is exactly how they would drift.
|
|
105
|
+
*/
|
|
106
|
+
const cleanFilterValues = (values) => {
|
|
107
|
+
const out = {};
|
|
108
|
+
for (const [key, value] of Object.entries(values)) {
|
|
109
|
+
if (value === void 0 || value === null || value === "") continue;
|
|
110
|
+
if (Array.isArray(value) && value.length === 0) continue;
|
|
111
|
+
out[key] = value;
|
|
112
|
+
}
|
|
113
|
+
return out;
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
export { cleanFilterValues, filtersToQuery, queryToFilters, shareFiltersUrl };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=query-filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-filters.js","names":[],"sources":["../../../src/components/alepha-table/query-filters.ts"],"sourcesContent":["import { type Alepha, type ZObject, coerceScalar, z } from \"alepha\";\n\n/**\n * The two halves of a shareable filter link.\n *\n * `queryToFilters` reads the URL into filter values on arrival;\n * `filtersToQuery` writes the current values back out when the reader asks\n * for a link. Nothing here runs on its own: the table seeds from the query\n * once, at mount, and only ever writes on an explicit Share.\n *\n * ⚠️ The pair is deliberately NOT a two-way binding. An effect that keeps\n * the address bar in step with the filters is the shape Lore incident #156\n * was about (see `AppRouter.projectQuests`): the router state is a global\n * store, so the render on the way OUT of a page sees the next route's query\n * and writes against it.\n */\n\n/**\n * Read the filter values a URL carries.\n *\n * Only keys declared by the filter `schema` are read, so query params the\n * page owns (a tab, a locale, a tracking param) never reach the fetch\n * payload. `keys` narrows that further when a table wants only some of its\n * filters to be linkable.\n *\n * Values arrive as strings and are coerced then decoded per field, the same\n * pair the server applies to its own query strings, which is what turns\n * `?limit=25` into a number and `?archived=true` into a boolean. A value the\n * schema refuses is DROPPED rather than thrown: a stale bookmark has to\n * degrade to the unfiltered list, never to an error page.\n *\n * Multi-value filters are comma-joined (`?status=new,triaged`). Repeated\n * params are not an option: `ReactBrowserRouterProvider` builds its query\n * from `URLSearchParams.entries()` into a flat record, so `?status=new&status=triaged`\n * arrives as `triaged` alone.\n *\n * Returns `undefined` rather than `{}` when nothing matches, because the\n * caller hands this to the table's seed slot, and an empty seed still\n * outranks the filters the reader chose last time.\n */\nexport const queryToFilters = (\n alepha: Alepha,\n schema: ZObject,\n query: Record<string, any>,\n keys?: readonly string[],\n): Record<string, any> | undefined => {\n const shape = z.schema.shape(schema);\n const out: Record<string, any> = {};\n\n for (const [key, field] of Object.entries(shape)) {\n if (keys && !keys.includes(key)) continue;\n const raw = query[key];\n if (typeof raw !== \"string\" || raw === \"\") continue;\n\n const base = z.schema.unwrap(field);\n const input = z.schema.isArray(base)\n ? raw\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\")\n : raw;\n\n try {\n out[key] = alepha.codec.decode(field as any, coerceScalar(field, input));\n } catch {\n // A value this schema no longer accepts, from a link written against\n // an older shape. The rest of the link still applies.\n }\n }\n\n return Object.keys(out).length > 0 ? out : undefined;\n};\n\n/**\n * Serialize filter values into query params for a shareable link.\n *\n * Strings, numbers, booleans and arrays of those. Anything else is dropped:\n * a link carrying some of the filters is honest, and one carrying\n * `[object Object]` is not.\n */\nexport const filtersToQuery = (\n values: Record<string, any>,\n): Record<string, string> => {\n const out: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (value === undefined || value === null || value === \"\") continue;\n\n if (Array.isArray(value)) {\n const parts = value.filter((item) => isScalar(item)).map(String);\n if (parts.length > 0) out[key] = parts.join(\",\");\n continue;\n }\n\n if (isScalar(value)) out[key] = String(value);\n }\n\n return out;\n};\n\nconst isScalar = (value: unknown): boolean =>\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\";\n\n/**\n * The link the toolbar's Share item copies.\n *\n * Built on the page's own URL, so query params the table knows nothing about\n * (a tab, a locale, a campaign) survive into the shared link. Every filter\n * key is cleared first, which is what makes a filter the reader has since\n * removed disappear from the link rather than linger from the URL they\n * arrived on.\n *\n * Commas are written literally. `URLSearchParams` percent-encodes them, and\n * `?status=new%2Ctriaged` defeats the point of a link somebody reads before\n * clicking it. A comma is a legal sub-delimiter in a query, and it round-trips\n * back through `queryToFilters` either way.\n */\nexport const shareFiltersUrl = (\n href: string,\n keys: readonly string[],\n values: Record<string, any>,\n): string => {\n const url = new URL(href);\n\n for (const key of keys) {\n url.searchParams.delete(key);\n }\n for (const [key, value] of Object.entries(filtersToQuery(values))) {\n url.searchParams.set(key, value);\n }\n\n url.search = url.search.replace(/%2C/g, \",\");\n return url.toString();\n};\n\n/**\n * The filter values that are actually narrowing the list.\n *\n * Empty is not a filter: an untouched text input holds `\"\"` and a\n * multi-select the reader emptied holds `[]`, and neither should be stored,\n * counted on the toolbar badge, or written into a shared link. One\n * definition rather than three, because the three used to disagree on\n * nothing at all and that is exactly how they would drift.\n */\nexport const cleanFilterValues = (\n values: Record<string, any>,\n): Record<string, any> => {\n const out: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(values)) {\n if (value === undefined || value === null || value === \"\") continue;\n if (Array.isArray(value) && value.length === 0) continue;\n out[key] = value;\n }\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,kBACX,QACA,QACA,OACA,SACoC;CACpC,MAAM,QAAQ,EAAE,OAAO,MAAM,MAAM;CACnC,MAAM,MAA2B,CAAC;CAElC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;EAChD,IAAI,QAAQ,CAAC,KAAK,SAAS,GAAG,GAAG;EACjC,MAAM,MAAM,MAAM;EAClB,IAAI,OAAO,QAAQ,YAAY,QAAQ,IAAI;EAE3C,MAAM,OAAO,EAAE,OAAO,OAAO,KAAK;EAClC,MAAM,QAAQ,EAAE,OAAO,QAAQ,IAAI,IAC/B,IACG,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,QAAQ,SAAS,SAAS,EAAE,IAC/B;EAEJ,IAAI;GACF,IAAI,OAAO,OAAO,MAAM,OAAO,OAAc,aAAa,OAAO,KAAK,CAAC;EACzE,QAAQ,CAGR;CACF;CAEA,OAAO,OAAO,KAAK,GAAG,CAAC,CAAC,SAAS,IAAI,MAAM,KAAA;AAC7C;;;;;;;;AASA,MAAa,kBACX,WAC2B;CAC3B,MAAM,MAA8B,CAAC;CAErC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI;EAE3D,IAAI,MAAM,QAAQ,KAAK,GAAG;GACxB,MAAM,QAAQ,MAAM,QAAQ,SAAS,SAAS,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM;GAC/D,IAAI,MAAM,SAAS,GAAG,IAAI,OAAO,MAAM,KAAK,GAAG;GAC/C;EACF;EAEA,IAAI,SAAS,KAAK,GAAG,IAAI,OAAO,OAAO,KAAK;CAC9C;CAEA,OAAO;AACT;AAEA,MAAM,YAAY,UAChB,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU;;;;;;;;;;;;;;;AAgBnB,MAAa,mBACX,MACA,MACA,WACW;CACX,MAAM,MAAM,IAAI,IAAI,IAAI;CAExB,KAAK,MAAM,OAAO,MAChB,IAAI,aAAa,OAAO,GAAG;CAE7B,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,eAAe,MAAM,CAAC,GAC9D,IAAI,aAAa,IAAI,KAAK,KAAK;CAGjC,IAAI,SAAS,IAAI,OAAO,QAAQ,QAAQ,GAAG;CAC3C,OAAO,IAAI,SAAS;AACtB;;;;;;;;;;AAWA,MAAa,qBACX,WACwB;CACxB,MAAM,MAA2B,CAAC;CAElC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAAG;EACjD,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI;EAC3D,IAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,WAAW,GAAG;EAChD,IAAI,OAAO;CACb;CAEA,OAAO;AACT"}
|
|
@@ -35,6 +35,27 @@ export interface AppActionsProps {
|
|
|
35
35
|
account?: string;
|
|
36
36
|
logout?: string;
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Forwarded to {@link ButtonUser.avatar}: what the signed-in account
|
|
40
|
+
* button shows instead of the generic glyph. Absent, the glyph stands.
|
|
41
|
+
*/
|
|
42
|
+
avatar?: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Below `sm`, drop the three ambient SETTINGS controls - language, theme
|
|
45
|
+
* and dark mode - and keep only the account button.
|
|
46
|
+
*
|
|
47
|
+
* ⚠️ **Opt-in, and it has to be.** On a phone this cluster is most of the
|
|
48
|
+
* header and half of it is settings a reader changes about once
|
|
49
|
+
* (feedback #P2144), but hidden must never mean unreachable: language and
|
|
50
|
+
* theme live nowhere else today. So a surface passes this only when
|
|
51
|
+
* another surface still offers them - which is why `AccountHeader` does
|
|
52
|
+
* NOT, and the account area stays the place a phone reader changes both.
|
|
53
|
+
*
|
|
54
|
+
* A responsive class rather than a media-query hook, deliberately: a hook
|
|
55
|
+
* re-renders after mount, and on a server-rendered header that means the
|
|
56
|
+
* buttons paint and then vanish.
|
|
57
|
+
*/
|
|
58
|
+
compact?: boolean;
|
|
38
59
|
className?: string;
|
|
39
60
|
}
|
|
40
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-actions.d.ts","sourceRoot":"","sources":["../../../src/components/app-actions/app-actions.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,UAAU,UAAW,eAAe,
|
|
1
|
+
{"version":3,"file":"app-actions.d.ts","sourceRoot":"","sources":["../../../src/components/app-actions/app-actions.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,UAAU,UAAW,eAAe,gCAqChD,CAAC"}
|
|
@@ -46,14 +46,20 @@ const AppActions = (props) => {
|
|
|
46
46
|
className: cn("flex items-center gap-1", props.className),
|
|
47
47
|
children: [
|
|
48
48
|
props.before,
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
/* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: cn(props.compact ? "hidden sm:contents" : "contents"),
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx(ButtonLanguage, {
|
|
53
|
+
variant: "ghost",
|
|
54
|
+
label: props.labels?.language
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ jsx(ButtonTheme, { variant: "ghost" }),
|
|
57
|
+
/* @__PURE__ */ jsx(ButtonDark, { variant: "ghost" })
|
|
58
|
+
]
|
|
52
59
|
}),
|
|
53
|
-
/* @__PURE__ */ jsx(ButtonTheme, { variant: "ghost" }),
|
|
54
|
-
/* @__PURE__ */ jsx(ButtonDark, { variant: "ghost" }),
|
|
55
60
|
/* @__PURE__ */ jsxs(ButtonUser, {
|
|
56
61
|
variant: "ghost",
|
|
62
|
+
avatar: props.avatar,
|
|
57
63
|
signInLabel: props.labels?.signIn,
|
|
58
64
|
onSignIn: () => router.push(props.loginRouteName ?? "login"),
|
|
59
65
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-actions.js","names":[],"sources":["../../../src/components/app-actions/app-actions.tsx"],"sourcesContent":["import { ButtonDark } from \"@alepha/ui/components/button-dark/button-dark\";\nimport { ButtonLanguage } from \"@alepha/ui/components/button-language/button-language\";\nimport { ButtonTheme } from \"@alepha/ui/components/button-theme/button-theme\";\nimport { ButtonUser } from \"@alepha/ui/components/button-user/button-user\";\nimport { DropdownMenuSeparator } from \"@alepha/ui/components/ui/dropdown-menu\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\nexport interface AppActionsProps {\n /**\n * Extra menu items appended to the account dropdown, below the built-ins\n * and above Logout. For an application-specific destination — \"My orders\",\n * \"Billing\" — that belongs with the account rather than in the page chrome.\n */\n children?: ReactNode;\n\n /**\n * Rendered to the left of the cluster: a search trigger, a create button,\n * anything the surface wants adjacent to these controls.\n */\n before?: ReactNode;\n\n /**\n * Route name pushed by the \"Admin Panel\" item. The item is hidden anyway\n * unless the viewer holds `admin:ui`.\n *\n * @default \"admin\"\n */\n adminRouteName?: string;\n\n /**\n * Route name pushed by the signed-out state's sign-in button.\n *\n * @default \"login\"\n */\n loginRouteName?: string;\n\n /**\n * Labels, for an application that localises its chrome. Omitted entries\n * fall back to each button's own English default.\n */\n labels?: {\n language?: string;\n signIn?: string;\n admin?: string;\n account?: string;\n logout?: string;\n };\n\n className?: string;\n}\n\n/**\n * The ambient controls every signed-in surface carries: language, theme,\n * dark mode, account.\n *\n * ### Why this is one component rather than four imports\n *\n * It was four imports, in three places — `AdminLayout`, `AccountLayout` and\n * `apps/lore`'s own header — and they had already drifted: admin rendered no\n * theme switcher, and Lore's account menu pushed a route that no longer\n * existed. A cluster that every shell rebuilds by hand is a cluster where\n * each copy is one refactor away from being subtly wrong.\n *\n * ### Each button decides whether it has anything to offer\n *\n * There is no \"show the language switcher?\" prop, and there should not be:\n * `ButtonLanguage` and `ButtonTheme` already return `null` at one or fewer\n * options, reading the real registry rather than a flag a caller has to keep\n * in sync. So an application with a single locale and a single theme renders\n * exactly two controls here, and gains the others the day it registers a\n * second — with no change at any call site.\n *\n * `ButtonUser` likewise renders a sign-in button when signed out and the\n * account menu when signed in, and `ButtonUser.AccountMenuItem` hides itself\n * when no `account` route is mounted.\n *\n * ### What it deliberately does not include\n *\n * Search. `AdminLayout` keeps its ⌘K trigger outside this cluster because the\n * Spotlight open-state is local to that layout, so a shared component could\n * never own it — and Lore's own search is a field-sized element that reads as\n * a different kind of control next to four icons. Pass it via `before` when a\n * surface wants it adjacent.\n */\nexport const AppActions = (props: AppActionsProps) => {\n const router = useRouter<any>();\n\n return (\n <div className={cn(\"flex items-center gap-1\", props.className)}>\n {props.before}\n <ButtonLanguage variant=\"ghost\" label={props.labels?.language} />\n
|
|
1
|
+
{"version":3,"file":"app-actions.js","names":[],"sources":["../../../src/components/app-actions/app-actions.tsx"],"sourcesContent":["import { ButtonDark } from \"@alepha/ui/components/button-dark/button-dark\";\nimport { ButtonLanguage } from \"@alepha/ui/components/button-language/button-language\";\nimport { ButtonTheme } from \"@alepha/ui/components/button-theme/button-theme\";\nimport { ButtonUser } from \"@alepha/ui/components/button-user/button-user\";\nimport { DropdownMenuSeparator } from \"@alepha/ui/components/ui/dropdown-menu\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\nexport interface AppActionsProps {\n /**\n * Extra menu items appended to the account dropdown, below the built-ins\n * and above Logout. For an application-specific destination — \"My orders\",\n * \"Billing\" — that belongs with the account rather than in the page chrome.\n */\n children?: ReactNode;\n\n /**\n * Rendered to the left of the cluster: a search trigger, a create button,\n * anything the surface wants adjacent to these controls.\n */\n before?: ReactNode;\n\n /**\n * Route name pushed by the \"Admin Panel\" item. The item is hidden anyway\n * unless the viewer holds `admin:ui`.\n *\n * @default \"admin\"\n */\n adminRouteName?: string;\n\n /**\n * Route name pushed by the signed-out state's sign-in button.\n *\n * @default \"login\"\n */\n loginRouteName?: string;\n\n /**\n * Labels, for an application that localises its chrome. Omitted entries\n * fall back to each button's own English default.\n */\n labels?: {\n language?: string;\n signIn?: string;\n admin?: string;\n account?: string;\n logout?: string;\n };\n\n /**\n * Forwarded to {@link ButtonUser.avatar}: what the signed-in account\n * button shows instead of the generic glyph. Absent, the glyph stands.\n */\n avatar?: ReactNode;\n\n /**\n * Below `sm`, drop the three ambient SETTINGS controls - language, theme\n * and dark mode - and keep only the account button.\n *\n * ⚠️ **Opt-in, and it has to be.** On a phone this cluster is most of the\n * header and half of it is settings a reader changes about once\n * (feedback #P2144), but hidden must never mean unreachable: language and\n * theme live nowhere else today. So a surface passes this only when\n * another surface still offers them - which is why `AccountHeader` does\n * NOT, and the account area stays the place a phone reader changes both.\n *\n * A responsive class rather than a media-query hook, deliberately: a hook\n * re-renders after mount, and on a server-rendered header that means the\n * buttons paint and then vanish.\n */\n compact?: boolean;\n\n className?: string;\n}\n\n/**\n * The ambient controls every signed-in surface carries: language, theme,\n * dark mode, account.\n *\n * ### Why this is one component rather than four imports\n *\n * It was four imports, in three places — `AdminLayout`, `AccountLayout` and\n * `apps/lore`'s own header — and they had already drifted: admin rendered no\n * theme switcher, and Lore's account menu pushed a route that no longer\n * existed. A cluster that every shell rebuilds by hand is a cluster where\n * each copy is one refactor away from being subtly wrong.\n *\n * ### Each button decides whether it has anything to offer\n *\n * There is no \"show the language switcher?\" prop, and there should not be:\n * `ButtonLanguage` and `ButtonTheme` already return `null` at one or fewer\n * options, reading the real registry rather than a flag a caller has to keep\n * in sync. So an application with a single locale and a single theme renders\n * exactly two controls here, and gains the others the day it registers a\n * second — with no change at any call site.\n *\n * `ButtonUser` likewise renders a sign-in button when signed out and the\n * account menu when signed in, and `ButtonUser.AccountMenuItem` hides itself\n * when no `account` route is mounted.\n *\n * ### What it deliberately does not include\n *\n * Search. `AdminLayout` keeps its ⌘K trigger outside this cluster because the\n * Spotlight open-state is local to that layout, so a shared component could\n * never own it — and Lore's own search is a field-sized element that reads as\n * a different kind of control next to four icons. Pass it via `before` when a\n * surface wants it adjacent.\n */\nexport const AppActions = (props: AppActionsProps) => {\n const router = useRouter<any>();\n\n return (\n <div className={cn(\"flex items-center gap-1\", props.className)}>\n {props.before}\n {/* `contents` so the three stay direct children of the flex row and\n keep its `gap-1`; `hidden` wins over `display: contents`, which is\n what makes the whole group disappear below the breakpoint. */}\n <div className={cn(props.compact ? \"hidden sm:contents\" : \"contents\")}>\n <ButtonLanguage variant=\"ghost\" label={props.labels?.language} />\n <ButtonTheme variant=\"ghost\" />\n <ButtonDark variant=\"ghost\" />\n </div>\n <ButtonUser\n variant=\"ghost\"\n avatar={props.avatar}\n signInLabel={props.labels?.signIn}\n onSignIn={() => router.push(props.loginRouteName ?? \"login\")}\n >\n <ButtonUser.Email />\n {/* Account before admin — see `ButtonUser`'s `DefaultMenu` for why. */}\n <ButtonUser.AccountMenuItem label={props.labels?.account} />\n {/*\n `routeName`, not `onClick`: both of these are destinations, so they\n render as real anchors and keep ⌘-click and open-in-new-tab.\n */}\n <ButtonUser.AdminMenuItem\n label={props.labels?.admin}\n routeName={props.adminRouteName}\n />\n {props.children}\n <DropdownMenuSeparator />\n <ButtonUser.LogoutMenuItem label={props.labels?.logout} />\n </ButtonUser>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6GA,MAAa,cAAc,UAA2B;CACpD,MAAM,SAAS,UAAe;CAE9B,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,2BAA2B,MAAM,SAAS;EAA7D,UAAA;GACG,MAAM;GAIP,qBAAC,OAAD;IAAK,WAAW,GAAG,MAAM,UAAU,uBAAuB,UAAU;IAApE,UAAA;KACE,oBAAC,gBAAD;MAAgB,SAAQ;MAAQ,OAAO,MAAM,QAAQ;KAAW,CAAA;KAChE,oBAAC,aAAD,EAAa,SAAQ,QAAS,CAAA;KAC9B,oBAAC,YAAD,EAAY,SAAQ,QAAS,CAAA;IAC1B;;GACL,qBAAC,YAAD;IACE,SAAQ;IACR,QAAQ,MAAM;IACd,aAAa,MAAM,QAAQ;IAC3B,gBAAgB,OAAO,KAAK,MAAM,kBAAkB,OAAO;IAJ7D,UAAA;KAME,oBAAC,WAAW,OAAZ,CAAmB,CAAA;KAEnB,oBAAC,WAAW,iBAAZ,EAA4B,OAAO,MAAM,QAAQ,QAAU,CAAA;KAK3D,oBAAC,WAAW,eAAZ;MACE,OAAO,MAAM,QAAQ;MACrB,WAAW,MAAM;KAClB,CAAA;KACA,MAAM;KACP,oBAAC,uBAAD,CAAwB,CAAA;KACxB,oBAAC,WAAW,gBAAZ,EAA2B,OAAO,MAAM,QAAQ,OAAS,CAAA;IAC/C;;EACT;;AAET"}
|
|
@@ -87,6 +87,51 @@ export interface AppShellProps {
|
|
|
87
87
|
* Sidebar navigation groups.
|
|
88
88
|
*/
|
|
89
89
|
nav?: NavGroup[];
|
|
90
|
+
/**
|
|
91
|
+
* Keep at most ONE nav group open at a time. Defaults to `true`.
|
|
92
|
+
*
|
|
93
|
+
* Opening a group closes the one that was open beside it, the way an
|
|
94
|
+
* accordion does. Exclusivity is per level, so a nested group opens inside
|
|
95
|
+
* its parent rather than replacing it, and the open branch always runs from
|
|
96
|
+
* the root to the deepest open group.
|
|
97
|
+
*
|
|
98
|
+
* On means the sidebar owns the open state, so `NavItem.defaultOpen` seeds
|
|
99
|
+
* the branch rather than opening a group of its own: the first item asking
|
|
100
|
+
* for it wins, and only when nothing is active. Pass `false` for the older
|
|
101
|
+
* behaviour, where every group keeps its own state and any number can be
|
|
102
|
+
* open at once.
|
|
103
|
+
*
|
|
104
|
+
* ⚠️ Nothing changes in the icon rail. Collapsed to icons a group is a
|
|
105
|
+
* dropdown, and one dropdown at a time is already all a menu can do.
|
|
106
|
+
*/
|
|
107
|
+
navAccordion?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Slide a nav group open and shut instead of swapping it in. Defaults to
|
|
110
|
+
* `true`.
|
|
111
|
+
*
|
|
112
|
+
* `false` is a snap, not a shorter animation: an app that wants a different
|
|
113
|
+
* duration or curve should style
|
|
114
|
+
* `[data-slot=sidebar-menu-item] [data-state]` rather than turn this off.
|
|
115
|
+
*
|
|
116
|
+
* ⚠️ Honours `prefers-reduced-motion` on its own, so this is not the switch
|
|
117
|
+
* for accessibility. It exists for a shell embedded somewhere that owns its
|
|
118
|
+
* own motion, and for a test that would rather not wait 200ms.
|
|
119
|
+
*/
|
|
120
|
+
navAnimate?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Which glyph a collapsible nav group carries. Defaults to `"caret"`.
|
|
123
|
+
*
|
|
124
|
+
* - `"caret"` - a chevron that turns a quarter clockwise when the group
|
|
125
|
+
* opens. One glyph, and the rotation is the state.
|
|
126
|
+
* - `"plusMinus"` - a plus when shut, a minus when open. Two glyphs that
|
|
127
|
+
* name the two states outright, where a caret only points and leaves the
|
|
128
|
+
* reader to learn which direction means open.
|
|
129
|
+
*
|
|
130
|
+
* ⚠️ Nothing in the icon rail. Collapsed, a group is a dropdown that opens
|
|
131
|
+
* to the RIGHT, so its chevron is a direction rather than a state and there
|
|
132
|
+
* is no minus that could answer it.
|
|
133
|
+
*/
|
|
134
|
+
navToggleIcon?: "caret" | "plusMinus";
|
|
90
135
|
/**
|
|
91
136
|
* Content rendered at the bottom of the sidebar (user menu, etc.).
|
|
92
137
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../../../src/components/app-shell/app-shell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qDAAqD,CAAC;AAgE7D,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGhE;;;;GAIG;AACH,YAAY,EAAE,yBAAyB,EAAE,CAAC;AAmB1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,mBAAmB,UAAW;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,wRAqCjE,CAAC;AAEF,KAAK,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAEvD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAuaD,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC;IACjB;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IACtC;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE;QAAE,KAAK,EAAE,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpD;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAC3C;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,yBAAyB,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IACvD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,UAAW,aAAa,sBA+N5C,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { Toaster } from "../ui/sonner.js";
|
|
|
13
13
|
import * as React from "react";
|
|
14
14
|
import { Fragment, useState } from "react";
|
|
15
15
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
-
import { ChevronRight, Lock, PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
16
|
+
import { ChevronRight, Lock, Minus, PanelLeftClose, PanelLeftOpen, Plus } from "lucide-react";
|
|
17
17
|
import { useSidebarState } from "alepha/react/ui";
|
|
18
18
|
import { Link as Link$1, NestedView } from "alepha/react/router";
|
|
19
19
|
//#region src/components/app-shell/app-shell.tsx
|
|
@@ -72,6 +72,43 @@ function hasActiveDescendant(item) {
|
|
|
72
72
|
if (item.active) return true;
|
|
73
73
|
return (item.children ?? []).some(hasActiveDescendant);
|
|
74
74
|
}
|
|
75
|
+
function isOpenPathPrefix(path, openPath) {
|
|
76
|
+
if (path.length === 0 || path.length > openPath.length) return false;
|
|
77
|
+
return path.every((index, depth) => openPath[depth] === index);
|
|
78
|
+
}
|
|
79
|
+
function samePath(a, b) {
|
|
80
|
+
return a.length === b.length && a.every((index, i) => b[i] === index);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The path the accordion should be showing: the DEEPEST group holding the
|
|
84
|
+
* active page, or failing that the first group asking for `defaultOpen`.
|
|
85
|
+
*
|
|
86
|
+
* Computed here, from the tree, rather than reported upwards by the item that
|
|
87
|
+
* notices it is active. An item cannot set its parent's state during render
|
|
88
|
+
* (React refuses to update another component mid-render), and doing it in an
|
|
89
|
+
* effect costs a frame of the wrong group being open on every navigation.
|
|
90
|
+
*/
|
|
91
|
+
function findOpenPath(nav) {
|
|
92
|
+
let fallback = [];
|
|
93
|
+
const walk = (item, path) => {
|
|
94
|
+
const children = item.children ?? [];
|
|
95
|
+
if (children.length === 0) return void 0;
|
|
96
|
+
for (let ci = 0; ci < children.length; ci++) {
|
|
97
|
+
const deeper = walk(children[ci], [...path, ci]);
|
|
98
|
+
if (deeper) return deeper;
|
|
99
|
+
}
|
|
100
|
+
if (hasActiveDescendant(item)) return path;
|
|
101
|
+
if (fallback.length === 0 && item.defaultOpen) fallback = path;
|
|
102
|
+
};
|
|
103
|
+
for (let gi = 0; gi < nav.length; gi++) {
|
|
104
|
+
const items = nav[gi]?.items ?? [];
|
|
105
|
+
for (let ii = 0; ii < items.length; ii++) {
|
|
106
|
+
const found = walk(items[ii], [gi, ii]);
|
|
107
|
+
if (found) return found;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return fallback;
|
|
111
|
+
}
|
|
75
112
|
/**
|
|
76
113
|
* Render a NavItem icon. An already-created element (e.g. `<Users />`, which
|
|
77
114
|
* `React.isValidElement` recognises) is returned as-is; anything else is
|
|
@@ -87,18 +124,54 @@ function renderNavIcon(icon, className) {
|
|
|
87
124
|
}
|
|
88
125
|
return /* @__PURE__ */ jsx(icon, { className });
|
|
89
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* The open/close animation for a nav group.
|
|
129
|
+
*
|
|
130
|
+
* `grid-template-rows: 0fr -> 1fr` on a wrapper whose child is
|
|
131
|
+
* `overflow: hidden`. That is the one way to transition to an INTRINSIC
|
|
132
|
+
* height in CSS alone: `height: auto` is not interpolable, so the usual
|
|
133
|
+
* alternatives are a hardcoded max-height (which either clips a long group or
|
|
134
|
+
* makes a short one crawl through empty space) or measuring the subtree in an
|
|
135
|
+
* effect (a layout read on every toggle, and a frame of the wrong height).
|
|
136
|
+
*
|
|
137
|
+
* ⚠️ The children stay MOUNTED while closed, which is what makes the height
|
|
138
|
+
* animatable, so something has to do what unmounting used to: clipped content
|
|
139
|
+
* is invisible but still focusable and still read aloud. `inert` does it, and
|
|
140
|
+
* it is the right tool rather than `visibility: hidden` because it needs no
|
|
141
|
+
* animation of its own - the clipping already hides the group, so the only
|
|
142
|
+
* job left is taking it out of the tab order and the a11y tree, which is a
|
|
143
|
+
* state rather than a transition.
|
|
144
|
+
*
|
|
145
|
+
* `min-h-0` on the inner element is load-bearing, not tidiness: a grid item's
|
|
146
|
+
* automatic minimum size is its content, so without it the row never shrinks
|
|
147
|
+
* below the subtree's natural height and nothing appears to animate.
|
|
148
|
+
*/
|
|
149
|
+
const NavCollapse = (props) => /* @__PURE__ */ jsx("div", {
|
|
150
|
+
"data-state": props.open ? "open" : "closed",
|
|
151
|
+
inert: !props.open,
|
|
152
|
+
className: cn("grid grid-rows-[0fr] data-[state=open]:grid-rows-[1fr]", props.animate && "transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"),
|
|
153
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
154
|
+
className: "min-h-0 overflow-hidden",
|
|
155
|
+
children: props.children
|
|
156
|
+
})
|
|
157
|
+
});
|
|
90
158
|
const SidebarNavItem = (props) => {
|
|
91
|
-
const { item } = props;
|
|
159
|
+
const { item, path, accordion, animate, toggleIcon } = props;
|
|
92
160
|
const { state, isMobile } = useSidebar();
|
|
93
161
|
const children = item.children;
|
|
94
162
|
const isGroup = !!children && children.length > 0;
|
|
95
163
|
const hasActive = isGroup && hasActiveDescendant(item);
|
|
96
|
-
const [
|
|
164
|
+
const [localOpen, setLocalOpen] = useState(item.defaultOpen ?? hasActive);
|
|
97
165
|
const [wasActive, setWasActive] = useState(hasActive);
|
|
98
|
-
if (hasActive !== wasActive) {
|
|
166
|
+
if (!accordion && hasActive !== wasActive) {
|
|
99
167
|
setWasActive(hasActive);
|
|
100
|
-
if (hasActive)
|
|
168
|
+
if (hasActive) setLocalOpen(true);
|
|
101
169
|
}
|
|
170
|
+
const open = accordion ? isOpenPathPrefix(path, accordion.openPath) : localOpen;
|
|
171
|
+
const toggle = () => {
|
|
172
|
+
if (accordion) accordion.setOpenPath(open ? path.slice(0, -1) : path);
|
|
173
|
+
else setLocalOpen((v) => !v);
|
|
174
|
+
};
|
|
102
175
|
if (!isGroup) {
|
|
103
176
|
if (item.disabled) {
|
|
104
177
|
const row = /* @__PURE__ */ jsxs("div", {
|
|
@@ -127,10 +200,11 @@ const SidebarNavItem = (props) => {
|
|
|
127
200
|
render: /* @__PURE__ */ jsx(Link$1, { href: item.href ?? "#" }),
|
|
128
201
|
children: [renderNavIcon(item.icon, "size-4"), /* @__PURE__ */ jsx("span", { children: item.label })]
|
|
129
202
|
});
|
|
130
|
-
|
|
203
|
+
const row = item.tooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: link }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
131
204
|
side: "right",
|
|
132
205
|
children: item.tooltip
|
|
133
|
-
})] }) : link
|
|
206
|
+
})] }) : link;
|
|
207
|
+
return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [row, item.badge != null && item.badge !== false && /* @__PURE__ */ jsx(SidebarMenuBadge, { children: item.badge })] });
|
|
134
208
|
}
|
|
135
209
|
if (isGroup && state === "collapsed" && !isMobile) return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(DropdownMenuTrigger, {
|
|
136
210
|
render: /* @__PURE__ */ jsx(SidebarMenuButton, { isActive: item.active || hasActive }),
|
|
@@ -149,7 +223,7 @@ const SidebarNavItem = (props) => {
|
|
|
149
223
|
children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: item.label }), /* @__PURE__ */ jsx(NavDropdownItems, { items: children })] })
|
|
150
224
|
})] }) });
|
|
151
225
|
return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
152
|
-
onClick:
|
|
226
|
+
onClick: toggle,
|
|
153
227
|
isActive: item.active,
|
|
154
228
|
tooltip: typeof item.label === "string" ? item.label : void 0,
|
|
155
229
|
children: [
|
|
@@ -158,13 +232,23 @@ const SidebarNavItem = (props) => {
|
|
|
158
232
|
className: "flex-1 text-left",
|
|
159
233
|
children: item.label
|
|
160
234
|
}),
|
|
161
|
-
/* @__PURE__ */ jsx(ChevronRight, { className: `size-4 transition-transform ${open ? "rotate-90" : ""}` })
|
|
235
|
+
toggleIcon === "plusMinus" ? open ? /* @__PURE__ */ jsx(Minus, { className: "size-4" }) : /* @__PURE__ */ jsx(Plus, { className: "size-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: `size-4 transition-transform ${open ? "rotate-90" : ""}` })
|
|
162
236
|
]
|
|
163
|
-
}),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
children:
|
|
167
|
-
|
|
237
|
+
}), /* @__PURE__ */ jsx(NavCollapse, {
|
|
238
|
+
open,
|
|
239
|
+
animate,
|
|
240
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: children.map((child, ci) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: child.children && child.children.length > 0 ? /* @__PURE__ */ jsx(SidebarNavItem, {
|
|
241
|
+
item: child,
|
|
242
|
+
path: [...path, ci],
|
|
243
|
+
accordion,
|
|
244
|
+
animate,
|
|
245
|
+
toggleIcon
|
|
246
|
+
}) : /* @__PURE__ */ jsxs(SidebarMenuSubButton, {
|
|
247
|
+
isActive: child.active,
|
|
248
|
+
render: /* @__PURE__ */ jsx(Link$1, { href: child.href ?? "#" }),
|
|
249
|
+
children: [renderNavIcon(child.icon, "size-4"), /* @__PURE__ */ jsx("span", { children: child.label })]
|
|
250
|
+
}) }, child.href ?? ci)) })
|
|
251
|
+
})] });
|
|
168
252
|
};
|
|
169
253
|
/**
|
|
170
254
|
* The children of a collapsed nav group, as dropdown entries.
|
|
@@ -210,6 +294,16 @@ const NavDropdownItems = (props) => {
|
|
|
210
294
|
const AppShell = (props) => {
|
|
211
295
|
const { collapsed, setCollapsed } = useSidebarState();
|
|
212
296
|
const nav = props.nav ?? [];
|
|
297
|
+
const navAccordion = props.navAccordion ?? true;
|
|
298
|
+
const navAnimate = props.navAnimate ?? true;
|
|
299
|
+
const navToggleIcon = props.navToggleIcon ?? "caret";
|
|
300
|
+
const wantedOpenPath = findOpenPath(nav);
|
|
301
|
+
const [openPath, setOpenPath] = useState(wantedOpenPath);
|
|
302
|
+
const [lastWanted, setLastWanted] = useState(wantedOpenPath);
|
|
303
|
+
if (!samePath(wantedOpenPath, lastWanted)) {
|
|
304
|
+
setLastWanted(wantedOpenPath);
|
|
305
|
+
if (wantedOpenPath.length > 0) setOpenPath(wantedOpenPath);
|
|
306
|
+
}
|
|
213
307
|
const variant = props.variant ?? "sidebar";
|
|
214
308
|
const progress = props.progress ?? true;
|
|
215
309
|
const headerOutside = !!props.headerOutside && variant === "inset";
|
|
@@ -251,7 +345,7 @@ const AppShell = (props) => {
|
|
|
251
345
|
]
|
|
252
346
|
});
|
|
253
347
|
const mainNode = /* @__PURE__ */ jsx("main", {
|
|
254
|
-
className: cn(props.mainClassName, props.fill ? "flex min-h-0 flex-1 flex-col overflow-hidden" : "flex-1 overflow-auto"),
|
|
348
|
+
className: cn(props.mainClassName, "relative", props.fill ? "flex min-h-0 flex-1 flex-col overflow-hidden" : "flex-1 overflow-auto"),
|
|
255
349
|
children: props.children ?? /* @__PURE__ */ jsx(NestedView, {})
|
|
256
350
|
});
|
|
257
351
|
const renderBody = () => /* @__PURE__ */ jsxs(Fragment$1, { children: [progress !== false && /* @__PURE__ */ jsx(NavigationProgress, { ...progress === true ? {} : progress }), /* @__PURE__ */ jsxs(SidebarProvider, {
|
|
@@ -263,7 +357,16 @@ const AppShell = (props) => {
|
|
|
263
357
|
variant,
|
|
264
358
|
children: /* @__PURE__ */ jsxs(SidebarNavAutoClose, { children: [
|
|
265
359
|
/* @__PURE__ */ jsx(SidebarHeader, { children: props.brand }),
|
|
266
|
-
/* @__PURE__ */ jsx(SidebarContent, { children: nav.map((group, gi) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [group.label && /* @__PURE__ */ jsx(SidebarGroupLabel, { children: group.label }), /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item, ii) => /* @__PURE__ */ jsx(SidebarNavItem, {
|
|
360
|
+
/* @__PURE__ */ jsx(SidebarContent, { children: nav.map((group, gi) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [group.label && /* @__PURE__ */ jsx(SidebarGroupLabel, { children: group.label }), /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item, ii) => /* @__PURE__ */ jsx(SidebarNavItem, {
|
|
361
|
+
item,
|
|
362
|
+
path: [gi, ii],
|
|
363
|
+
accordion: navAccordion ? {
|
|
364
|
+
openPath,
|
|
365
|
+
setOpenPath
|
|
366
|
+
} : void 0,
|
|
367
|
+
animate: navAnimate,
|
|
368
|
+
toggleIcon: navToggleIcon
|
|
369
|
+
}, item.href ?? `${gi}-${ii}`)) }) })] }, gi)) }),
|
|
267
370
|
props.sidebarFooter && /* @__PURE__ */ jsx(SidebarFooter, { children: props.sidebarFooter })
|
|
268
371
|
] })
|
|
269
372
|
}), headerOutside ? /* @__PURE__ */ jsxs("div", {
|