@alepha/ui 0.25.2 → 0.26.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/LICENSE +21 -0
- package/README.md +136 -2
- package/dist/components/account/account-connections.d.ts +16 -0
- package/dist/components/account/account-connections.d.ts.map +1 -0
- package/dist/components/account/account-connections.js +76 -0
- package/dist/components/account/account-connections.js.map +1 -0
- package/dist/components/account/account-delete-dialog.d.ts +44 -0
- package/dist/components/account/account-delete-dialog.d.ts.map +1 -0
- package/dist/components/account/account-delete-dialog.js +126 -0
- package/dist/components/account/account-delete-dialog.js.map +1 -0
- package/dist/components/account/account-header.d.ts +33 -0
- package/dist/components/account/account-header.d.ts.map +1 -0
- package/dist/components/account/account-header.js +41 -0
- package/dist/components/account/account-header.js.map +1 -0
- package/dist/components/account/account-keys.d.ts +23 -0
- package/dist/components/account/account-keys.d.ts.map +1 -0
- package/dist/components/account/account-keys.js +168 -0
- package/dist/components/account/account-keys.js.map +1 -0
- package/dist/components/account/account-layout.d.ts +32 -0
- package/dist/components/account/account-layout.d.ts.map +1 -0
- package/dist/components/account/account-layout.js +53 -0
- package/dist/components/account/account-layout.js.map +1 -0
- package/dist/components/account/account-password-dialog.d.ts +31 -0
- package/dist/components/account/account-password-dialog.d.ts.map +1 -0
- package/dist/components/account/account-password-dialog.js +120 -0
- package/dist/components/account/account-password-dialog.js.map +1 -0
- package/dist/components/account/account-profile.d.ts +27 -0
- package/dist/components/account/account-profile.d.ts.map +1 -0
- package/dist/components/account/account-profile.js +217 -0
- package/dist/components/account/account-profile.js.map +1 -0
- package/dist/components/account/account-router-options.d.ts +77 -0
- package/dist/components/account/account-router-options.d.ts.map +1 -0
- package/dist/components/account/account-router-options.js +22 -0
- package/dist/components/account/account-router-options.js.map +1 -0
- package/dist/components/account/account-router-page.d.ts +49 -0
- package/dist/components/account/account-router-page.d.ts.map +1 -0
- package/dist/components/account/account-router-page.js +61 -0
- package/dist/components/account/account-router-page.js.map +1 -0
- package/dist/components/account/account-router.d.ts +214 -0
- package/dist/components/account/account-router.d.ts.map +1 -0
- package/dist/components/account/account-router.js +216 -0
- package/dist/components/account/account-router.js.map +1 -0
- package/dist/components/account/account-security.d.ts +22 -0
- package/dist/components/account/account-security.d.ts.map +1 -0
- package/dist/components/account/account-security.js +107 -0
- package/dist/components/account/account-security.js.map +1 -0
- package/dist/components/account/account-sessions.d.ts +17 -0
- package/dist/components/account/account-sessions.d.ts.map +1 -0
- package/dist/components/account/account-sessions.js +108 -0
- package/dist/components/account/account-sessions.js.map +1 -0
- package/dist/components/action-error-toaster/action-error-toaster.d.ts +39 -0
- package/dist/components/action-error-toaster/action-error-toaster.d.ts.map +1 -0
- package/dist/components/action-error-toaster/action-error-toaster.js +40 -0
- package/dist/components/action-error-toaster/action-error-toaster.js.map +1 -0
- package/dist/components/admin/admin-analytics-query-panel.d.ts +16 -0
- package/dist/components/admin/admin-analytics-query-panel.d.ts.map +1 -0
- package/dist/components/admin/admin-analytics-query-panel.js +117 -0
- package/dist/components/admin/admin-analytics-query-panel.js.map +1 -0
- package/dist/components/admin/admin-analytics-results.d.ts +15 -0
- package/dist/components/admin/admin-analytics-results.d.ts.map +1 -0
- package/dist/components/admin/admin-analytics-results.js +56 -0
- package/dist/components/admin/admin-analytics-results.js.map +1 -0
- package/dist/components/admin/admin-analytics.d.ts +9 -0
- package/dist/components/admin/admin-analytics.d.ts.map +1 -0
- package/dist/components/admin/admin-analytics.js +66 -0
- package/dist/components/admin/admin-analytics.js.map +1 -0
- package/dist/components/admin/admin-audits.d.ts +4 -0
- package/dist/components/admin/admin-audits.d.ts.map +1 -0
- package/dist/components/admin/admin-audits.js +173 -0
- package/dist/components/admin/admin-audits.js.map +1 -0
- package/dist/components/admin/admin-files.d.ts +4 -0
- package/dist/components/admin/admin-files.d.ts.map +1 -0
- package/dist/components/admin/admin-files.js +237 -0
- package/dist/components/admin/admin-files.js.map +1 -0
- package/dist/components/admin/admin-jobs-executions-panel.d.ts +11 -0
- package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -0
- package/dist/components/admin/admin-jobs-executions-panel.js +200 -0
- package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -0
- package/dist/components/admin/admin-jobs-status-badge.d.ts +9 -0
- package/dist/components/admin/admin-jobs-status-badge.d.ts.map +1 -0
- package/dist/components/admin/admin-jobs-status-badge.js +26 -0
- package/dist/components/admin/admin-jobs-status-badge.js.map +1 -0
- package/dist/components/admin/admin-jobs.d.ts +4 -0
- package/dist/components/admin/admin-jobs.d.ts.map +1 -0
- package/dist/components/admin/admin-jobs.js +248 -0
- package/dist/components/admin/admin-jobs.js.map +1 -0
- package/dist/components/admin/admin-keys-token-dialog.d.ts +15 -0
- package/dist/components/admin/admin-keys-token-dialog.d.ts.map +1 -0
- package/dist/components/admin/admin-keys-token-dialog.js +66 -0
- package/dist/components/admin/admin-keys-token-dialog.js.map +1 -0
- package/dist/components/admin/admin-keys.d.ts +4 -0
- package/dist/components/admin/admin-keys.d.ts.map +1 -0
- package/dist/components/admin/admin-keys.js +161 -0
- package/dist/components/admin/admin-keys.js.map +1 -0
- package/dist/components/admin/admin-layout.d.ts +33 -0
- package/dist/components/admin/admin-layout.d.ts.map +1 -0
- package/dist/components/admin/admin-layout.js +101 -0
- package/dist/components/admin/admin-layout.js.map +1 -0
- package/dist/components/admin/admin-notifications.d.ts +4 -0
- package/dist/components/admin/admin-notifications.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications.js +99 -0
- package/dist/components/admin/admin-notifications.js.map +1 -0
- package/dist/components/admin/admin-page.d.ts +16 -0
- package/dist/components/admin/admin-page.d.ts.map +1 -0
- package/dist/components/admin/admin-page.js +15 -0
- package/dist/components/admin/admin-page.js.map +1 -0
- package/dist/components/admin/admin-parameters.d.ts +26 -0
- package/dist/components/admin/admin-parameters.d.ts.map +1 -0
- package/dist/components/admin/admin-parameters.js +560 -0
- package/dist/components/admin/admin-parameters.js.map +1 -0
- package/dist/components/admin/admin-payments.d.ts +4 -0
- package/dist/components/admin/admin-payments.d.ts.map +1 -0
- package/dist/components/admin/admin-payments.js +72 -0
- package/dist/components/admin/admin-payments.js.map +1 -0
- package/dist/components/admin/admin-router-options.d.ts +135 -0
- package/dist/components/admin/admin-router-options.d.ts.map +1 -0
- package/dist/components/admin/admin-router-options.js +29 -0
- package/dist/components/admin/admin-router-options.js.map +1 -0
- package/dist/components/admin/admin-router-page.d.ts +54 -0
- package/dist/components/admin/admin-router-page.d.ts.map +1 -0
- package/dist/components/admin/admin-router-page.js +66 -0
- package/dist/components/admin/admin-router-page.js.map +1 -0
- package/dist/components/admin/admin-router.d.ts +169 -0
- package/dist/components/admin/admin-router.d.ts.map +1 -0
- package/dist/components/admin/admin-router.js +346 -0
- package/dist/components/admin/admin-router.js.map +1 -0
- package/dist/components/admin/admin-sessions.d.ts +4 -0
- package/dist/components/admin/admin-sessions.d.ts.map +1 -0
- package/dist/components/admin/admin-sessions.js +124 -0
- package/dist/components/admin/admin-sessions.js.map +1 -0
- package/dist/components/admin/admin-user-cell.d.ts +37 -0
- package/dist/components/admin/admin-user-cell.d.ts.map +1 -0
- package/dist/components/admin/admin-user-cell.js +35 -0
- package/dist/components/admin/admin-user-cell.js.map +1 -0
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts +15 -0
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-audits-tab.js +55 -0
- package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -0
- package/dist/components/admin/admin-user-detail-identity-aside.d.ts +14 -0
- package/dist/components/admin/admin-user-detail-identity-aside.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-identity-aside.js +162 -0
- package/dist/components/admin/admin-user-detail-identity-aside.js.map +1 -0
- package/dist/components/admin/admin-user-detail-overview-tab.d.ts +26 -0
- package/dist/components/admin/admin-user-detail-overview-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-overview-tab.js +60 -0
- package/dist/components/admin/admin-user-detail-overview-tab.js.map +1 -0
- package/dist/components/admin/admin-user-detail-password-dialog.d.ts +15 -0
- package/dist/components/admin/admin-user-detail-password-dialog.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-password-dialog.js +47 -0
- package/dist/components/admin/admin-user-detail-password-dialog.js.map +1 -0
- package/dist/components/admin/admin-user-detail-password-schema.d.ts +10 -0
- package/dist/components/admin/admin-user-detail-password-schema.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-password-schema.js +13 -0
- package/dist/components/admin/admin-user-detail-password-schema.js.map +1 -0
- package/dist/components/admin/admin-user-detail-profile-policy.d.ts +56 -0
- package/dist/components/admin/admin-user-detail-profile-policy.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-profile-policy.js +73 -0
- package/dist/components/admin/admin-user-detail-profile-policy.js.map +1 -0
- package/dist/components/admin/admin-user-detail-profile-schema.d.ts +18 -0
- package/dist/components/admin/admin-user-detail-profile-schema.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-profile-schema.js +21 -0
- package/dist/components/admin/admin-user-detail-profile-schema.js.map +1 -0
- package/dist/components/admin/admin-user-detail-security-tab.d.ts +20 -0
- package/dist/components/admin/admin-user-detail-security-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-security-tab.js +70 -0
- package/dist/components/admin/admin-user-detail-security-tab.js.map +1 -0
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts +25 -0
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail-sessions-tab.js +64 -0
- package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -0
- package/dist/components/admin/admin-user-detail.d.ts +39 -0
- package/dist/components/admin/admin-user-detail.d.ts.map +1 -0
- package/dist/components/admin/admin-user-detail.js +386 -0
- package/dist/components/admin/admin-user-detail.js.map +1 -0
- package/dist/components/admin/admin-users-roles-picker.d.ts +23 -0
- package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -0
- package/dist/components/admin/admin-users-roles-picker.js +77 -0
- package/dist/components/admin/admin-users-roles-picker.js.map +1 -0
- package/dist/components/admin/admin-users-status-filter.d.ts +13 -0
- package/dist/components/admin/admin-users-status-filter.d.ts.map +1 -0
- package/dist/components/admin/admin-users-status-filter.js +41 -0
- package/dist/components/admin/admin-users-status-filter.js.map +1 -0
- package/dist/components/admin/admin-users.d.ts +16 -0
- package/dist/components/admin/admin-users.d.ts.map +1 -0
- package/dist/components/admin/admin-users.js +325 -0
- package/dist/components/admin/admin-users.js.map +1 -0
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts +11 -0
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +1 -0
- package/dist/components/admin/admin-workflows-execution-sheet.js +190 -0
- package/dist/components/admin/admin-workflows-execution-sheet.js.map +1 -0
- package/dist/components/admin/admin-workflows-executions-panel.d.ts +9 -0
- package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +1 -0
- package/dist/components/admin/admin-workflows-executions-panel.js +153 -0
- package/dist/components/admin/admin-workflows-executions-panel.js.map +1 -0
- package/dist/components/admin/admin-workflows-status-badge.d.ts +12 -0
- package/dist/components/admin/admin-workflows-status-badge.d.ts.map +1 -0
- package/dist/components/admin/admin-workflows-status-badge.js +30 -0
- package/dist/components/admin/admin-workflows-status-badge.js.map +1 -0
- package/dist/components/admin/admin-workflows.d.ts +4 -0
- package/dist/components/admin/admin-workflows.d.ts.map +1 -0
- package/dist/components/admin/admin-workflows.js +145 -0
- package/dist/components/admin/admin-workflows.js.map +1 -0
- package/dist/components/admin/diff-lines.d.ts +13 -0
- package/dist/components/admin/diff-lines.d.ts.map +1 -0
- package/dist/components/admin/diff-lines.js +57 -0
- package/dist/components/admin/diff-lines.js.map +1 -0
- package/dist/components/admin/parameter-diff-dialog.d.ts +36 -0
- package/dist/components/admin/parameter-diff-dialog.d.ts.map +1 -0
- package/dist/components/admin/parameter-diff-dialog.js +58 -0
- package/dist/components/admin/parameter-diff-dialog.js.map +1 -0
- package/dist/components/admin/parameter-history-item.d.ts +17 -0
- package/dist/components/admin/parameter-history-item.d.ts.map +1 -0
- package/dist/components/admin/parameter-history-item.js +177 -0
- package/dist/components/admin/parameter-history-item.js.map +1 -0
- package/dist/components/admin/parameter-json-dialog.d.ts +13 -0
- package/dist/components/admin/parameter-json-dialog.d.ts.map +1 -0
- package/dist/components/admin/parameter-json-dialog.js +63 -0
- package/dist/components/admin/parameter-json-dialog.js.map +1 -0
- package/dist/components/admin/parameter-save-dialog.d.ts +26 -0
- package/dist/components/admin/parameter-save-dialog.d.ts.map +1 -0
- package/dist/components/admin/parameter-save-dialog.js +74 -0
- package/dist/components/admin/parameter-save-dialog.js.map +1 -0
- package/dist/components/admin/use-confirmed-action.d.ts +53 -0
- package/dist/components/admin/use-confirmed-action.d.ts.map +1 -0
- package/dist/components/admin/use-confirmed-action.js +50 -0
- package/dist/components/admin/use-confirmed-action.js.map +1 -0
- package/dist/components/alepha-table/alepha-table.d.ts +218 -0
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -0
- package/dist/components/alepha-table/alepha-table.js +565 -0
- package/dist/components/alepha-table/alepha-table.js.map +1 -0
- package/dist/components/alepha-table/use-table-selection.d.ts +34 -0
- package/dist/components/alepha-table/use-table-selection.d.ts.map +1 -0
- package/dist/components/alepha-table/use-table-selection.js +45 -0
- package/dist/components/alepha-table/use-table-selection.js.map +1 -0
- package/dist/components/app-actions/app-actions.d.ts +74 -0
- package/dist/components/app-actions/app-actions.d.ts.map +1 -0
- package/dist/components/app-actions/app-actions.js +77 -0
- package/dist/components/app-actions/app-actions.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +135 -0
- package/dist/components/app-shell/app-shell.d.ts.map +1 -0
- package/dist/components/app-shell/app-shell.js +276 -0
- package/dist/components/app-shell/app-shell.js.map +1 -0
- package/dist/components/auth/auth-login.d.ts +40 -0
- package/dist/components/auth/auth-login.d.ts.map +1 -0
- package/dist/components/auth/auth-login.js +237 -0
- package/dist/components/auth/auth-login.js.map +1 -0
- package/dist/components/auth/auth-register.d.ts +35 -0
- package/dist/components/auth/auth-register.d.ts.map +1 -0
- package/dist/components/auth/auth-register.js +478 -0
- package/dist/components/auth/auth-register.js.map +1 -0
- package/dist/components/auth/auth-reset-password.d.ts +21 -0
- package/dist/components/auth/auth-reset-password.d.ts.map +1 -0
- package/dist/components/auth/auth-reset-password.js +283 -0
- package/dist/components/auth/auth-reset-password.js.map +1 -0
- package/dist/components/auth/auth-router.d.ts +245 -0
- package/dist/components/auth/auth-router.d.ts.map +1 -0
- package/dist/components/auth/auth-router.js +117 -0
- package/dist/components/auth/auth-router.js.map +1 -0
- package/dist/components/auth/auth-verify-email.d.ts +19 -0
- package/dist/components/auth/auth-verify-email.d.ts.map +1 -0
- package/dist/components/auth/auth-verify-email.js +124 -0
- package/dist/components/auth/auth-verify-email.js.map +1 -0
- package/dist/components/auth/provider-labels.d.ts +9 -0
- package/dist/components/auth/provider-labels.d.ts.map +1 -0
- package/dist/components/auth/provider-labels.js +20 -0
- package/dist/components/auth/provider-labels.js.map +1 -0
- package/dist/components/auto-form/auto-form.d.ts +219 -0
- package/dist/components/auto-form/auto-form.d.ts.map +1 -0
- package/dist/components/auto-form/auto-form.js +412 -0
- package/dist/components/auto-form/auto-form.js.map +1 -0
- package/dist/components/brand-icon/brand-icon.d.ts +18 -0
- package/dist/components/brand-icon/brand-icon.d.ts.map +1 -0
- package/dist/components/brand-icon/brand-icon.js +84 -0
- package/dist/components/brand-icon/brand-icon.js.map +1 -0
- package/dist/components/button-dark/button-dark.d.ts +25 -0
- package/dist/components/button-dark/button-dark.d.ts.map +1 -0
- package/dist/components/button-dark/button-dark.js +44 -0
- package/dist/components/button-dark/button-dark.js.map +1 -0
- package/dist/components/button-language/button-language.d.ts +24 -0
- package/dist/components/button-language/button-language.d.ts.map +1 -0
- package/dist/components/button-language/button-language.js +50 -0
- package/dist/components/button-language/button-language.js.map +1 -0
- package/dist/components/button-theme/button-theme.d.ts +33 -0
- package/dist/components/button-theme/button-theme.d.ts.map +1 -0
- package/dist/components/button-theme/button-theme.js +90 -0
- package/dist/components/button-theme/button-theme.js.map +1 -0
- package/dist/components/button-user/button-user.d.ts +147 -0
- package/dist/components/button-user/button-user.d.ts.map +1 -0
- package/dist/components/button-user/button-user.js +147 -0
- package/dist/components/button-user/button-user.js.map +1 -0
- package/dist/components/captcha/turnstile-widget.d.ts +59 -0
- package/dist/components/captcha/turnstile-widget.d.ts.map +1 -0
- package/dist/components/captcha/turnstile-widget.js +97 -0
- package/dist/components/captcha/turnstile-widget.js.map +1 -0
- package/dist/components/control/control.d.ts +200 -0
- package/dist/components/control/control.d.ts.map +1 -0
- package/dist/components/control/control.js +300 -0
- package/dist/components/control/control.js.map +1 -0
- package/dist/components/control-array/control-array.d.ts +77 -0
- package/dist/components/control-array/control-array.d.ts.map +1 -0
- package/dist/components/control-array/control-array.js +444 -0
- package/dist/components/control-array/control-array.js.map +1 -0
- package/dist/components/control-base/field-i18n.d.ts +30 -0
- package/dist/components/control-base/field-i18n.d.ts.map +1 -0
- package/dist/components/control-base/field-i18n.js +27 -0
- package/dist/components/control-base/field-i18n.js.map +1 -0
- package/dist/components/control-base/form-field.d.ts +128 -0
- package/dist/components/control-base/form-field.d.ts.map +1 -0
- package/dist/components/control-base/form-field.js +208 -0
- package/dist/components/control-base/form-field.js.map +1 -0
- package/dist/components/control-base/grid.d.ts +18 -0
- package/dist/components/control-base/grid.d.ts.map +1 -0
- package/dist/components/control-base/grid.js +46 -0
- package/dist/components/control-base/grid.js.map +1 -0
- package/dist/components/control-base/icon-hint.d.ts +9 -0
- package/dist/components/control-base/icon-hint.d.ts.map +1 -0
- package/dist/components/control-base/icon-hint.js +35 -0
- package/dist/components/control-base/icon-hint.js.map +1 -0
- package/dist/components/control-date/control-date.d.ts +34 -0
- package/dist/components/control-date/control-date.d.ts.map +1 -0
- package/dist/components/control-date/control-date.js +111 -0
- package/dist/components/control-date/control-date.js.map +1 -0
- package/dist/components/control-number/control-number.d.ts +38 -0
- package/dist/components/control-number/control-number.d.ts.map +1 -0
- package/dist/components/control-number/control-number.js +77 -0
- package/dist/components/control-number/control-number.js.map +1 -0
- package/dist/components/control-object/control-object.d.ts +45 -0
- package/dist/components/control-object/control-object.d.ts.map +1 -0
- package/dist/components/control-object/control-object.js +110 -0
- package/dist/components/control-object/control-object.js.map +1 -0
- package/dist/components/control-password/control-password.d.ts +28 -0
- package/dist/components/control-password/control-password.d.ts.map +1 -0
- package/dist/components/control-password/control-password.js +65 -0
- package/dist/components/control-password/control-password.js.map +1 -0
- package/dist/components/control-select/control-select.d.ts +128 -0
- package/dist/components/control-select/control-select.d.ts.map +1 -0
- package/dist/components/control-select/control-select.js +363 -0
- package/dist/components/control-select/control-select.js.map +1 -0
- package/dist/components/control-upload/control-upload.d.ts +67 -0
- package/dist/components/control-upload/control-upload.d.ts.map +1 -0
- package/dist/components/control-upload/control-upload.js +294 -0
- package/dist/components/control-upload/control-upload.js.map +1 -0
- package/dist/components/file-image/file-image.d.ts +31 -0
- package/dist/components/file-image/file-image.d.ts.map +1 -0
- package/dist/components/file-image/file-image.js +27 -0
- package/dist/components/file-image/file-image.js.map +1 -0
- package/dist/components/language-toggle/language-toggle.d.ts +8 -0
- package/dist/components/language-toggle/language-toggle.d.ts.map +1 -0
- package/dist/components/language-toggle/language-toggle.js +49 -0
- package/dist/components/language-toggle/language-toggle.js.map +1 -0
- package/dist/components/markdown-view/markdown-view.css +114 -0
- package/dist/components/markdown-view/markdown-view.d.ts +21 -0
- package/dist/components/markdown-view/markdown-view.d.ts.map +1 -0
- package/dist/components/markdown-view/markdown-view.js +104 -0
- package/dist/components/markdown-view/markdown-view.js.map +1 -0
- package/dist/components/nav-shell/nav-page.d.ts +24 -0
- package/dist/components/nav-shell/nav-page.d.ts.map +1 -0
- package/dist/components/nav-shell/nav-page.js +28 -0
- package/dist/components/nav-shell/nav-page.js.map +1 -0
- package/dist/components/nav-shell/nav-shell.d.ts +26 -0
- package/dist/components/nav-shell/nav-shell.d.ts.map +1 -0
- package/dist/components/nav-shell/nav-shell.js +53 -0
- package/dist/components/nav-shell/nav-shell.js.map +1 -0
- package/dist/components/nav-shell/nav-tree-util.d.ts +65 -0
- package/dist/components/nav-shell/nav-tree-util.d.ts.map +1 -0
- package/dist/components/nav-shell/nav-tree-util.js +87 -0
- package/dist/components/nav-shell/nav-tree-util.js.map +1 -0
- package/dist/components/nav-shell/spotlight.d.ts +37 -0
- package/dist/components/nav-shell/spotlight.d.ts.map +1 -0
- package/dist/components/nav-shell/spotlight.js +102 -0
- package/dist/components/nav-shell/spotlight.js.map +1 -0
- package/dist/components/nav-shell/use-nav-breadcrumbs.d.ts +24 -0
- package/dist/components/nav-shell/use-nav-breadcrumbs.d.ts.map +1 -0
- package/dist/components/nav-shell/use-nav-breadcrumbs.js +36 -0
- package/dist/components/nav-shell/use-nav-breadcrumbs.js.map +1 -0
- package/dist/components/nav-shell/use-nav-entries.d.ts +45 -0
- package/dist/components/nav-shell/use-nav-entries.d.ts.map +1 -0
- package/dist/components/nav-shell/use-nav-entries.js +60 -0
- package/dist/components/nav-shell/use-nav-entries.js.map +1 -0
- package/dist/components/nav-shell/use-nav-tree.d.ts +21 -0
- package/dist/components/nav-shell/use-nav-tree.d.ts.map +1 -0
- package/dist/components/nav-shell/use-nav-tree.js +48 -0
- package/dist/components/nav-shell/use-nav-tree.js.map +1 -0
- package/dist/components/settings/settings-danger-section.d.ts +35 -0
- package/dist/components/settings/settings-danger-section.d.ts.map +1 -0
- package/dist/components/settings/settings-danger-section.js +42 -0
- package/dist/components/settings/settings-danger-section.js.map +1 -0
- package/dist/components/settings/settings-heading.d.ts +36 -0
- package/dist/components/settings/settings-heading.d.ts.map +1 -0
- package/dist/components/settings/settings-heading.js +39 -0
- package/dist/components/settings/settings-heading.js.map +1 -0
- package/dist/components/settings/settings-layout.d.ts +81 -0
- package/dist/components/settings/settings-layout.d.ts.map +1 -0
- package/dist/components/settings/settings-layout.js +56 -0
- package/dist/components/settings/settings-layout.js.map +1 -0
- package/dist/components/settings/settings-nav.d.ts +85 -0
- package/dist/components/settings/settings-nav.d.ts.map +1 -0
- package/dist/components/settings/settings-nav.js +91 -0
- package/dist/components/settings/settings-nav.js.map +1 -0
- package/dist/components/settings/settings-row.d.ts +45 -0
- package/dist/components/settings/settings-row.d.ts.map +1 -0
- package/dist/components/settings/settings-row.js +44 -0
- package/dist/components/settings/settings-row.js.map +1 -0
- package/dist/components/settings/settings-section.d.ts +36 -0
- package/dist/components/settings/settings-section.d.ts.map +1 -0
- package/dist/components/settings/settings-section.js +36 -0
- package/dist/components/settings/settings-section.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +55 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +19 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +96 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +11 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +44 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts +5 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.js +15 -0
- package/dist/components/ui/aspect-ratio.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +12 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +52 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +8 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +31 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +73 -0
- package/dist/components/ui/breadcrumb.js.map +1 -0
- package/dist/components/ui/button-group.d.ts +11 -0
- package/dist/components/ui/button-group.d.ts.map +1 -0
- package/dist/components/ui/button-group.js +43 -0
- package/dist/components/ui/button-group.js.map +1 -0
- package/dist/components/ui/button.d.ts +18 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +60 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/calendar.d.ts +11 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/components/ui/calendar.js +119 -0
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts +12 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +57 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/carousel.d.ts +29 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +134 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/chart.d.ts +45 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/components/ui/chart.js +151 -0
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +22 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +26 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/combobox.d.ts +25 -0
- package/dist/components/ui/combobox.d.ts.map +1 -0
- package/dist/components/ui/combobox.js +164 -0
- package/dist/components/ui/combobox.js.map +1 -0
- package/dist/components/ui/command.d.ts +20 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +89 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +30 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +134 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +93 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/direction.d.ts +2 -0
- package/dist/components/ui/direction.d.ts.map +1 -0
- package/dist/components/ui/direction.js +3 -0
- package/dist/components/ui/drawer.d.ts +17 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/drawer.js +125 -0
- package/dist/components/ui/drawer.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +30 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +138 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/empty.d.ts +12 -0
- package/dist/components/ui/empty.d.ts.map +1 -0
- package/dist/components/ui/empty.js +61 -0
- package/dist/components/ui/empty.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +38 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +19 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +80 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input-otp.d.ts +12 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +49 -0
- package/dist/components/ui/input-otp.js.map +1 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +16 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/item.d.ts +23 -0
- package/dist/components/ui/item.d.ts.map +1 -0
- package/dist/components/ui/item.js +122 -0
- package/dist/components/ui/item.js.map +1 -0
- package/dist/components/ui/kbd.d.ts +4 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +21 -0
- package/dist/components/ui/kbd.js.map +1 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +15 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/menubar.d.ts +30 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/menubar.js +137 -0
- package/dist/components/ui/menubar.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +84 -0
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/pagination.d.ts +18 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +87 -0
- package/dist/components/ui/pagination.js.map +1 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +56 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +8 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +46 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/radio-group.d.ts +6 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +29 -0
- package/dist/components/ui/radio-group.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +30 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +38 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/segmented.d.ts +46 -0
- package/dist/components/ui/segmented.d.ts.map +1 -0
- package/dist/components/ui/segmented.js +119 -0
- package/dist/components/ui/segmented.js.map +1 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +99 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +17 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +15 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +90 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +64 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +388 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +14 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +35 -0
- package/dist/components/ui/slider.js.map +1 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/sonner.js +33 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/components/ui/spinner.d.ts +3 -0
- package/dist/components/ui/spinner.d.ts.map +1 -0
- package/dist/components/ui/spinner.js +17 -0
- package/dist/components/ui/spinner.js.map +1 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +21 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/table.d.ts +11 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +68 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +11 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +47 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +14 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +12 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +54 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +9 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +38 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +43 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components/use-dialog/use-dialog.d.ts +61 -0
- package/dist/components/use-dialog/use-dialog.d.ts.map +1 -0
- package/dist/components/use-dialog/use-dialog.js +139 -0
- package/dist/components/use-dialog/use-dialog.js.map +1 -0
- package/dist/components/use-toast/use-toast.d.ts +37 -0
- package/dist/components/use-toast/use-toast.d.ts.map +1 -0
- package/dist/components/use-toast/use-toast.js +32 -0
- package/dist/components/use-toast/use-toast.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +20 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/lib/i18n-fr.d.ts +46 -0
- package/dist/lib/i18n-fr.d.ts.map +1 -0
- package/dist/lib/i18n-fr.js +505 -0
- package/dist/lib/i18n-fr.js.map +1 -0
- package/dist/lib/resize-image.d.ts +50 -0
- package/dist/lib/resize-image.d.ts.map +1 -0
- package/dist/lib/resize-image.js +68 -0
- package/dist/lib/resize-image.js.map +1 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +10 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/styles.css +254 -0
- package/package.json +46 -15
- package/src/components/account/account-connections.tsx +9 -1
- package/src/components/account/account-keys.tsx +1 -1
- package/src/components/account/account-layout.tsx +6 -3
- package/src/components/account/account-profile.tsx +238 -125
- package/src/components/account/account-router-options.tsx +14 -0
- package/src/components/account/account-router.tsx +20 -1
- package/src/components/account/account-security.tsx +1 -1
- package/src/components/admin/admin-router-options.tsx +20 -0
- package/src/components/alepha-table/alepha-table.tsx +23 -7
- package/src/components/app-actions/app-actions.tsx +7 -2
- package/src/components/auth/auth-register.tsx +55 -17
- package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +237 -0
- package/src/components/auto-form/auto-form.tsx +113 -27
- package/src/components/button-user/button-user.tsx +76 -17
- package/src/components/control/control.tsx +33 -8
- package/src/components/control-base/form-field.tsx +60 -3
- package/src/components/markdown-view/__tests__/markdown-view-raw-html.browser.spec.tsx +48 -0
- package/src/components/markdown-view/markdown-view.tsx +14 -6
- package/src/components/nav-shell/__tests__/nav-tree-util.spec.ts +88 -0
- package/src/components/nav-shell/nav-tree-util.ts +48 -0
- package/src/components/nav-shell/use-nav-entries.ts +11 -2
- package/src/components/settings/settings-heading.tsx +55 -0
- package/src/components/settings/settings-layout.tsx +66 -7
- package/src/components/settings/settings-nav.tsx +48 -4
- package/src/components/settings/settings-section.tsx +2 -14
- package/src/components/ui/segmented.tsx +19 -2
- package/src/lib/__tests__/rehype-safe-img.spec.ts +0 -121
- package/src/lib/rehype-safe-img.ts +0 -150
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
TooltipTrigger,
|
|
17
17
|
} from "@alepha/ui/components/ui/tooltip";
|
|
18
18
|
import { useAuth } from "alepha/react/auth";
|
|
19
|
-
import { useRouter } from "alepha/react/router";
|
|
19
|
+
import { Link, useRouter } from "alepha/react/router";
|
|
20
20
|
import { CircleUser, LogIn, LogOut, Shield, User } from "lucide-react";
|
|
21
21
|
import type { ReactNode } from "react";
|
|
22
22
|
|
|
@@ -136,8 +136,15 @@ const DefaultMenu = (props: DefaultMenuProps) => {
|
|
|
136
136
|
return (
|
|
137
137
|
<>
|
|
138
138
|
<Email />
|
|
139
|
-
{
|
|
139
|
+
{/*
|
|
140
|
+
Account first, admin second: the account page is where every signed-in
|
|
141
|
+
user has something to do, and the admin panel is a destination a
|
|
142
|
+
minority of them can even see. Keep the two in this order everywhere
|
|
143
|
+
the pair is composed (see `AppActions`) so the menu does not reshuffle
|
|
144
|
+
between surfaces.
|
|
145
|
+
*/}
|
|
140
146
|
<AccountMenuItem />
|
|
147
|
+
{props.onAdminClick && <AdminMenuItem onClick={props.onAdminClick} />}
|
|
141
148
|
<DropdownMenuSeparator />
|
|
142
149
|
<LogoutMenuItem />
|
|
143
150
|
</>
|
|
@@ -168,9 +175,19 @@ const Email = (props: ButtonUserEmailProps) => {
|
|
|
168
175
|
|
|
169
176
|
export interface ButtonUserAdminMenuItemProps {
|
|
170
177
|
/**
|
|
171
|
-
*
|
|
178
|
+
* Route name to link to. Defaults to `"admin"`, which is what `AdminRouter`
|
|
179
|
+
* registers. Prefer this over {@link onClick}: it is what makes the item a
|
|
180
|
+
* real anchor.
|
|
172
181
|
*/
|
|
173
|
-
|
|
182
|
+
routeName?: string;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Escape hatch for a destination no route name can express. Supplying it
|
|
186
|
+
* turns the item back into a click handler on a `div`, so the entry loses
|
|
187
|
+
* ⌘-click, middle-click and "open in new tab" — see {@link AccountMenuItem}.
|
|
188
|
+
*/
|
|
189
|
+
onClick?: () => void;
|
|
190
|
+
|
|
174
191
|
/**
|
|
175
192
|
* Item label. Defaults to `"Admin Panel"`.
|
|
176
193
|
*/
|
|
@@ -184,21 +201,46 @@ export interface ButtonUserAdminMenuItemProps {
|
|
|
184
201
|
|
|
185
202
|
const AdminMenuItem = (props: ButtonUserAdminMenuItemProps) => {
|
|
186
203
|
const auth = useAuth();
|
|
204
|
+
const router = useRouter<any>();
|
|
187
205
|
const permission = props.permission ?? "admin:ui";
|
|
188
206
|
if (!auth.has(permission)) return null;
|
|
189
|
-
|
|
190
|
-
|
|
207
|
+
|
|
208
|
+
const label = (
|
|
209
|
+
<>
|
|
191
210
|
<Shield className="size-4" />
|
|
192
211
|
{props.label ?? "Admin Panel"}
|
|
212
|
+
</>
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
if (props.onClick) {
|
|
216
|
+
return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const routeName = props.routeName ?? "admin";
|
|
220
|
+
// Same "is the module actually mounted" question `AccountMenuItem` asks. An
|
|
221
|
+
// unregistered name would resolve to a literal `/admin`-shaped string and
|
|
222
|
+
// give the user a link to a 404.
|
|
223
|
+
if (!router.pages?.some((page: any) => page.name === routeName)) return null;
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<DropdownMenuItem render={<Link href={router.path(routeName)} />}>
|
|
227
|
+
{label}
|
|
193
228
|
</DropdownMenuItem>
|
|
194
229
|
);
|
|
195
230
|
};
|
|
196
231
|
|
|
197
232
|
export interface ButtonUserAccountMenuItemProps {
|
|
198
233
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
234
|
+
* Route name to link to. Defaults to `"account"`, which is what
|
|
235
|
+
* `AccountRouter` registers — set it only if you mounted the account area
|
|
236
|
+
* under a different name.
|
|
237
|
+
*/
|
|
238
|
+
routeName?: string;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Escape hatch for a destination no route name can express. Supplying it
|
|
242
|
+
* turns the item back into a click handler on a `div`, giving up everything
|
|
243
|
+
* an anchor provides.
|
|
202
244
|
*/
|
|
203
245
|
onClick?: () => void;
|
|
204
246
|
|
|
@@ -224,6 +266,14 @@ export interface ButtonUserAccountMenuItemProps {
|
|
|
224
266
|
* that never mounts `AccountRouter` gets no dead entry — the same "is the
|
|
225
267
|
* module actually there" question the router's own `can` gates answer, asked
|
|
226
268
|
* the only way a menu item can ask it.
|
|
269
|
+
*
|
|
270
|
+
* ⚠️ **It renders an `<a href>`, not a click handler**, because it is a
|
|
271
|
+
* destination rather than an action. `DropdownMenuItem` is a Base UI
|
|
272
|
+
* `Menu.Item`, which defaults to a `div` — correct for Logout, wrong here: a
|
|
273
|
+
* div navigating from `onClick` cannot be ⌘-clicked, middle-clicked or opened
|
|
274
|
+
* in a new tab, shows no target on hover, and offers no "copy link address".
|
|
275
|
+
* `render` swaps the element while Base UI keeps `role="menuitem"` and its
|
|
276
|
+
* keyboard handling, so the menu semantics are unchanged.
|
|
227
277
|
*/
|
|
228
278
|
const AccountMenuItem = (props: ButtonUserAccountMenuItemProps) => {
|
|
229
279
|
const auth = useAuth();
|
|
@@ -232,18 +282,27 @@ const AccountMenuItem = (props: ButtonUserAccountMenuItemProps) => {
|
|
|
232
282
|
if (!auth.user) {
|
|
233
283
|
return null;
|
|
234
284
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
285
|
+
|
|
286
|
+
const label = (
|
|
287
|
+
<>
|
|
288
|
+
<CircleUser className="size-4" />
|
|
289
|
+
{props.label ?? "User Account"}
|
|
290
|
+
</>
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
if (props.onClick) {
|
|
294
|
+
return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// No account area mounted → no entry, rather than one that 404s on click.
|
|
298
|
+
const routeName = props.routeName ?? "account";
|
|
299
|
+
if (!router.pages?.some((page: any) => page.name === routeName)) {
|
|
240
300
|
return null;
|
|
241
301
|
}
|
|
242
302
|
|
|
243
303
|
return (
|
|
244
|
-
<DropdownMenuItem
|
|
245
|
-
|
|
246
|
-
{props.label ?? "User Account"}
|
|
304
|
+
<DropdownMenuItem render={<Link href={router.path(routeName)} />}>
|
|
305
|
+
{label}
|
|
247
306
|
</DropdownMenuItem>
|
|
248
307
|
);
|
|
249
308
|
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
FormField,
|
|
11
11
|
formFieldAriaProps,
|
|
12
12
|
useFormFieldAutoSave,
|
|
13
|
+
useFormFieldLayout,
|
|
13
14
|
} from "@alepha/ui/components/control-base/form-field";
|
|
14
15
|
import {
|
|
15
16
|
type IconComponent,
|
|
@@ -30,6 +31,7 @@ import {
|
|
|
30
31
|
import { Input } from "@alepha/ui/components/ui/input";
|
|
31
32
|
import { Switch } from "@alepha/ui/components/ui/switch";
|
|
32
33
|
import { Textarea } from "@alepha/ui/components/ui/textarea";
|
|
34
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
33
35
|
import { z } from "alepha";
|
|
34
36
|
import { useAlepha } from "alepha/react";
|
|
35
37
|
import {
|
|
@@ -206,8 +208,16 @@ export interface ControlProps {
|
|
|
206
208
|
| SelectOption[]
|
|
207
209
|
| ((query: string) => SelectOption[] | Promise<SelectOption[]>);
|
|
208
210
|
/**
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
+
* Whether the field offers a way back to empty.
|
|
212
|
+
*
|
|
213
|
+
* On a `ControlSelect`, `true` adds a synthetic "none" row that resets the
|
|
214
|
+
* field to `undefined` — use it for optional filter chips.
|
|
215
|
+
*
|
|
216
|
+
* On a text field the affordance is the opposite way round: an optional
|
|
217
|
+
* field already shows a clear (×) button whenever it holds a value, and
|
|
218
|
+
* `false` takes it away. Pass `false` when emptying the field is not
|
|
219
|
+
* something the API can honour — a username has no "unset" on the server,
|
|
220
|
+
* so offering the button would promise an edit that silently does nothing.
|
|
211
221
|
*/
|
|
212
222
|
clearable?: boolean;
|
|
213
223
|
/**
|
|
@@ -241,6 +251,7 @@ export interface ControlProps {
|
|
|
241
251
|
export function Control(props: ControlProps) {
|
|
242
252
|
const form = useFormState(props.input, ["error", "dirty"]);
|
|
243
253
|
const autoSaveEnabled = useFormFieldAutoSave();
|
|
254
|
+
const rowLayout = useFormFieldLayout() === "row";
|
|
244
255
|
const [value, setValue] = useFieldValue(props.input);
|
|
245
256
|
|
|
246
257
|
// Function-form `$control` reads other fields → re-render on any
|
|
@@ -490,6 +501,7 @@ export function Control(props: ControlProps) {
|
|
|
490
501
|
id: meta.id,
|
|
491
502
|
error: meta.error,
|
|
492
503
|
description: merged.description ?? meta.description,
|
|
504
|
+
required: meta.required,
|
|
493
505
|
})}
|
|
494
506
|
id={meta.id}
|
|
495
507
|
name={props.input.props.name}
|
|
@@ -562,7 +574,9 @@ export function Control(props: ControlProps) {
|
|
|
562
574
|
const showSave = autoSaveEnabled && !!form.dirty && !merged.disabled;
|
|
563
575
|
const isNullable =
|
|
564
576
|
!meta.required && value != null && value !== "" && !merged.disabled;
|
|
565
|
-
|
|
577
|
+
// `clearable !== false`, not `clearable === true`: an optional text field
|
|
578
|
+
// offers the button by default and a caller opts *out* of it. See the prop.
|
|
579
|
+
const showClear = !showSave && isNullable && merged.clearable !== false;
|
|
566
580
|
// Reserve a fixed right gutter for any editable field so the tick/clear
|
|
567
581
|
// can swap in without nudging the input width.
|
|
568
582
|
const reserveGutter = !merged.disabled;
|
|
@@ -586,6 +600,7 @@ export function Control(props: ControlProps) {
|
|
|
586
600
|
id: meta.id,
|
|
587
601
|
error: meta.error,
|
|
588
602
|
description: merged.description ?? meta.description,
|
|
603
|
+
required: meta.required,
|
|
589
604
|
})}
|
|
590
605
|
id={meta.id}
|
|
591
606
|
name={props.input.props.name}
|
|
@@ -598,12 +613,22 @@ export function Control(props: ControlProps) {
|
|
|
598
613
|
minLength={meta.constraints.minLength}
|
|
599
614
|
maxLength={meta.constraints.maxLength}
|
|
600
615
|
pattern={meta.constraints.pattern}
|
|
601
|
-
|
|
616
|
+
// `cn`, not a plain join: the settings width below has to be
|
|
617
|
+
// overridable by the caller, and only tailwind-merge can decide
|
|
618
|
+
// that `sm:w-96` beats `sm:w-64` rather than both landing on the
|
|
619
|
+
// element. Order is precedence — later wins.
|
|
620
|
+
className={cn(
|
|
621
|
+
// Row layout is the settings-card shape, whose right-hand cell is
|
|
622
|
+
// an `auto` grid column: `w-full` there resolves against the
|
|
623
|
+
// input's own intrinsic size (~172px), so every card would get a
|
|
624
|
+
// slightly different control column. 256px is the width every
|
|
625
|
+
// hand-written `SettingsRow` already passes; encoded once here.
|
|
626
|
+
// Below `sm` the row stacks, and `w-full` from `<Input>` is right.
|
|
627
|
+
rowLayout && "sm:w-64",
|
|
602
628
|
merged.inputProps?.className,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
.join(" ")}
|
|
629
|
+
Icon && "pl-9",
|
|
630
|
+
reserveGutter && "pr-9",
|
|
631
|
+
)}
|
|
607
632
|
onChange={(e) => setValue(e.target.value)}
|
|
608
633
|
/>
|
|
609
634
|
{showSave && (
|
|
@@ -26,6 +26,17 @@ export function FormFieldLayoutProvider(props: {
|
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Read the ambient layout (see {@link FormFieldLayoutProvider}).
|
|
31
|
+
*
|
|
32
|
+
* `<FormField>` reads this itself, so a widget only needs the hook when it
|
|
33
|
+
* sizes or arranges something *around* its FormField — `<Control>` uses it to
|
|
34
|
+
* give text inputs the settings-row column width.
|
|
35
|
+
*/
|
|
36
|
+
export function useFormFieldLayout(): FormFieldLayout {
|
|
37
|
+
return useContext(FormFieldLayoutContext);
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
/**
|
|
30
41
|
* Ambient flag enabling the inline save (tick) affordance on text Controls.
|
|
31
42
|
* Set by `<AutoForm autoSave>`; standalone Controls never show the tick
|
|
@@ -51,6 +62,39 @@ export function useFormFieldAutoSave(): boolean {
|
|
|
51
62
|
return useContext(FormFieldAutoSaveContext);
|
|
52
63
|
}
|
|
53
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Ambient control over the required marker (`*`). Defaults to showing it.
|
|
67
|
+
*
|
|
68
|
+
* `<AutoForm requiredMarker={false}>` turns it off for a form where nearly
|
|
69
|
+
* every field is required and the asterisks are noise rather than news.
|
|
70
|
+
*
|
|
71
|
+
* ⚠️ **This is a purely visual switch, and must stay one.** The marker is
|
|
72
|
+
* `aria-hidden`, so it never carried the information to assistive tech in the
|
|
73
|
+
* first place — `aria-required` on the input does, and it is set from the
|
|
74
|
+
* schema regardless of this flag. Hiding the marker must never be the reason a
|
|
75
|
+
* field stops announcing that it is required.
|
|
76
|
+
*/
|
|
77
|
+
const FormFieldRequiredMarkerContext = createContext<boolean>(true);
|
|
78
|
+
|
|
79
|
+
export function FormFieldRequiredMarkerProvider(props: {
|
|
80
|
+
value: boolean;
|
|
81
|
+
children: ReactNode;
|
|
82
|
+
}) {
|
|
83
|
+
return (
|
|
84
|
+
<FormFieldRequiredMarkerContext.Provider value={props.value}>
|
|
85
|
+
{props.children}
|
|
86
|
+
</FormFieldRequiredMarkerContext.Provider>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Read the ambient required-marker flag (see
|
|
92
|
+
* {@link FormFieldRequiredMarkerProvider}).
|
|
93
|
+
*/
|
|
94
|
+
export function useFormFieldRequiredMarker(): boolean {
|
|
95
|
+
return useContext(FormFieldRequiredMarkerContext);
|
|
96
|
+
}
|
|
97
|
+
|
|
54
98
|
/**
|
|
55
99
|
* Id of the error element a `<FormField id={id} error>` renders.
|
|
56
100
|
*/
|
|
@@ -83,12 +127,21 @@ export function formFieldAriaProps(props: {
|
|
|
83
127
|
id?: string;
|
|
84
128
|
error?: string;
|
|
85
129
|
description?: string;
|
|
86
|
-
|
|
130
|
+
required?: boolean;
|
|
131
|
+
}): {
|
|
132
|
+
"aria-invalid"?: true;
|
|
133
|
+
"aria-describedby"?: string;
|
|
134
|
+
"aria-required"?: true;
|
|
135
|
+
} {
|
|
87
136
|
return {
|
|
88
137
|
"aria-invalid": props.error ? true : undefined,
|
|
89
138
|
"aria-describedby":
|
|
90
139
|
formFieldErrorId(props.id, props.error) ??
|
|
91
140
|
formFieldDescriptionId(props.id, props.description, props.error),
|
|
141
|
+
// The visible marker is `aria-hidden`, so without this a required field
|
|
142
|
+
// announced nothing at all. It is read from the schema, never from the
|
|
143
|
+
// marker flag — see {@link FormFieldRequiredMarkerProvider}.
|
|
144
|
+
"aria-required": props.required ? true : undefined,
|
|
92
145
|
};
|
|
93
146
|
}
|
|
94
147
|
|
|
@@ -171,6 +224,10 @@ export interface FormFieldProps {
|
|
|
171
224
|
export function FormField(props: FormFieldProps) {
|
|
172
225
|
const ambient = useContext(FormFieldLayoutContext);
|
|
173
226
|
const layout = props.layout ?? ambient;
|
|
227
|
+
// Hook first, `&&` after: `props.required && useFormFieldRequiredMarker()`
|
|
228
|
+
// short-circuits, which would make this a conditional hook call.
|
|
229
|
+
const requiredMarker = useFormFieldRequiredMarker();
|
|
230
|
+
const showRequiredMarker = props.required && requiredMarker;
|
|
174
231
|
const invalidClasses = props.error
|
|
175
232
|
? "[&_input]:border-destructive [&_input]:focus-visible:ring-destructive/30 [&_textarea]:border-destructive [&_textarea]:focus-visible:ring-destructive/30 [&_[role=combobox]]:border-destructive"
|
|
176
233
|
: "";
|
|
@@ -209,7 +266,7 @@ export function FormField(props: FormFieldProps) {
|
|
|
209
266
|
{props.label && (
|
|
210
267
|
<Label htmlFor={props.id} className="font-medium">
|
|
211
268
|
{props.label}
|
|
212
|
-
{
|
|
269
|
+
{showRequiredMarker && (
|
|
213
270
|
<span className="text-destructive ml-0.5" aria-hidden>
|
|
214
271
|
*
|
|
215
272
|
</span>
|
|
@@ -247,7 +304,7 @@ export function FormField(props: FormFieldProps) {
|
|
|
247
304
|
{props.label && (
|
|
248
305
|
<Label htmlFor={props.id}>
|
|
249
306
|
{props.label}
|
|
250
|
-
{
|
|
307
|
+
{showRequiredMarker && (
|
|
251
308
|
<span className="text-destructive ml-0.5" aria-hidden>
|
|
252
309
|
*
|
|
253
310
|
</span>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { MarkdownView } from "../markdown-view.tsx";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `rehypeSafeImg` promoted a lone `<img …>` raw node to a real element, and
|
|
7
|
+
* existed for exactly one reason: MDXEditor serialised a *resized* image as
|
|
8
|
+
* `<img width="…" src="…" />`. With the resize handles gone nothing produces
|
|
9
|
+
* that markup, so the plugin was deleted and react-markdown's default —
|
|
10
|
+
* escape every raw node to text — is restored.
|
|
11
|
+
*
|
|
12
|
+
* These pin that default. It is the entire raw-HTML posture of every
|
|
13
|
+
* markdown surface in every app built on this package: content is authored
|
|
14
|
+
* by one user and rendered to another, so a raw tag becoming live markup is
|
|
15
|
+
* an injection point. A future change that reaches for `rehype-raw`, or
|
|
16
|
+
* re-adds a promoting plugin, turns these red — which is the point.
|
|
17
|
+
*/
|
|
18
|
+
describe("MarkdownView raw HTML", () => {
|
|
19
|
+
it("escapes a raw img instead of promoting it to an element", () => {
|
|
20
|
+
const { container } = render(
|
|
21
|
+
<MarkdownView content={'<img src="assets/a.webp" width="600" />'} />,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(container.querySelector("img")).toBeNull();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("escapes an img carrying an event handler", () => {
|
|
28
|
+
const { container } = render(
|
|
29
|
+
<MarkdownView content={'<img src="x" onerror="alert(1)" />'} />,
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(container.querySelector("img")).toBeNull();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("escapes every other raw tag too", () => {
|
|
36
|
+
const { container } = render(
|
|
37
|
+
<MarkdownView content={'<button onclick="alert(1)">hi</button>'} />,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(container.querySelector("button")).toBeNull();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("still renders real markdown around the escaped HTML", () => {
|
|
44
|
+
render(<MarkdownView content={"# Title\n\n<img src='a' />"} />);
|
|
45
|
+
|
|
46
|
+
expect(screen.getByRole("heading", { level: 1 }).textContent).toBe("Title");
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -6,12 +6,25 @@ import "./markdown-view.css";
|
|
|
6
6
|
import ReactMarkdown from "react-markdown";
|
|
7
7
|
import rehypeHighlight from "rehype-highlight";
|
|
8
8
|
import remarkGfm from "remark-gfm";
|
|
9
|
-
import { rehypeSafeImg } from "../../lib/rehype-safe-img.ts";
|
|
10
9
|
|
|
11
10
|
export interface MarkdownViewProps {
|
|
12
11
|
content: string;
|
|
13
12
|
}
|
|
14
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Renders markdown as formatted prose.
|
|
16
|
+
*
|
|
17
|
+
* No raw HTML is ever rendered as markup: react-markdown's default is to
|
|
18
|
+
* escape a raw node to text, and this component deliberately mounts no
|
|
19
|
+
* plugin that changes that. A narrow `rehypeSafeImg` plugin used to promote
|
|
20
|
+
* a lone `<img …>` — the one thing MDXEditor emitted for a *resized* image —
|
|
21
|
+
* and was deleted along with the editor that produced it, since nothing
|
|
22
|
+
* writes that markup anymore.
|
|
23
|
+
*
|
|
24
|
+
* Do not reach for `rehype-raw` to bring the capability back: this renders
|
|
25
|
+
* content authored by one user to another, so every raw tag becoming live
|
|
26
|
+
* markup turns every markdown surface in every app into an injection point.
|
|
27
|
+
*/
|
|
15
28
|
export const MarkdownView = (props: MarkdownViewProps) => {
|
|
16
29
|
return (
|
|
17
30
|
<div className="max-w-none text-sm leading-relaxed">
|
|
@@ -19,11 +32,6 @@ export const MarkdownView = (props: MarkdownViewProps) => {
|
|
|
19
32
|
remarkPlugins={[remarkGfm]}
|
|
20
33
|
rehypePlugins={[
|
|
21
34
|
[rehypeHighlight, { detect: true, ignoreMissing: true }],
|
|
22
|
-
// Promotes ONLY `<img …>` raw HTML to a real element — what
|
|
23
|
-
// MDXEditor emits for a resized image. Every other raw node keeps
|
|
24
|
-
// react-markdown's default, which is to escape it to text. See
|
|
25
|
-
// `rehype-safe-img.ts` for why this is not `rehype-raw`.
|
|
26
|
-
rehypeSafeImg,
|
|
27
35
|
]}
|
|
28
36
|
components={{
|
|
29
37
|
h1: ({ children }) => (
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { isActivePath, keepDeepestActive } from "../nav-tree-util.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Entries as `useNavEntries` builds them: `href` is the page's resolved
|
|
6
|
+
* `match`, `active` is whatever `isActivePath` said about it in isolation.
|
|
7
|
+
*/
|
|
8
|
+
const entriesFor = (current: string, hrefs: string[]) =>
|
|
9
|
+
hrefs.map((href) => ({ href, active: isActivePath(current, href) }));
|
|
10
|
+
|
|
11
|
+
const activeHrefs = (current: string, hrefs: string[]) =>
|
|
12
|
+
keepDeepestActive(entriesFor(current, hrefs))
|
|
13
|
+
.filter((entry) => entry.active)
|
|
14
|
+
.map((entry) => entry.href);
|
|
15
|
+
|
|
16
|
+
describe("isActivePath", () => {
|
|
17
|
+
it("matches the page itself and anything below it", () => {
|
|
18
|
+
expect(isActivePath("/admin/users", "/admin/users")).toBe(true);
|
|
19
|
+
expect(isActivePath("/admin/users/42", "/admin/users")).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("does not match a sibling that merely shares a prefix", () => {
|
|
23
|
+
// Without the trailing separator, "/admin/users-import" would look like a
|
|
24
|
+
// descendant of "/admin/users".
|
|
25
|
+
expect(isActivePath("/admin/users-import", "/admin/users")).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe("keepDeepestActive", () => {
|
|
30
|
+
/*
|
|
31
|
+
The account rail's regression. `AccountRouter.profile` sits at `path: "/"`
|
|
32
|
+
under the `/account` shell, and `createMatch` collapses that to `/account`
|
|
33
|
+
— the shell's own path — so the entry is a prefix of every sibling and lit
|
|
34
|
+
up on all of them.
|
|
35
|
+
*/
|
|
36
|
+
it("drops an index entry whose match is a prefix of its siblings", () => {
|
|
37
|
+
const rail = [
|
|
38
|
+
"/account", // Profile
|
|
39
|
+
"/account/security",
|
|
40
|
+
"/account/sessions",
|
|
41
|
+
"/account/feedback",
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
expect(activeHrefs("/account/security", rail)).toEqual([
|
|
45
|
+
"/account/security",
|
|
46
|
+
]);
|
|
47
|
+
expect(activeHrefs("/account/feedback", rail)).toEqual([
|
|
48
|
+
"/account/feedback",
|
|
49
|
+
]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it("keeps the index entry on the index route itself", () => {
|
|
53
|
+
expect(activeHrefs("/account", ["/account", "/account/security"])).toEqual([
|
|
54
|
+
"/account",
|
|
55
|
+
]);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("keeps a section lit while one of its detail routes is open", () => {
|
|
59
|
+
/*
|
|
60
|
+
The behaviour the loose predicate exists for, and the reason this is
|
|
61
|
+
deepest-wins rather than "an index entry must match exactly": nothing
|
|
62
|
+
else in the rail matches `/admin/users/42`, so the section stays active.
|
|
63
|
+
*/
|
|
64
|
+
const rail = ["/admin/users", "/admin/sessions", "/admin/keys"];
|
|
65
|
+
|
|
66
|
+
expect(activeHrefs("/admin/users/42", rail)).toEqual(["/admin/users"]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("keeps an index entry lit on a child route it genuinely owns", () => {
|
|
70
|
+
// Same shape as the first case, except no sibling claims the child — so
|
|
71
|
+
// the index entry is still the deepest match and must survive.
|
|
72
|
+
expect(
|
|
73
|
+
activeHrefs("/account/photo", ["/account", "/account/security"]),
|
|
74
|
+
).toEqual(["/account"]);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("marks nothing active when the current path is outside the shell", () => {
|
|
78
|
+
expect(activeHrefs("/projects", ["/account", "/account/security"])).toEqual(
|
|
79
|
+
[],
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("leaves a list with a single active entry untouched", () => {
|
|
84
|
+
expect(activeHrefs("/admin/keys", ["/admin/users", "/admin/keys"])).toEqual(
|
|
85
|
+
["/admin/keys"],
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -56,7 +56,55 @@ export function hasNavPermission(
|
|
|
56
56
|
* Whether `current` (the active pathname) is on or under `href`. Mirrors the
|
|
57
57
|
* legacy hand-rolled check — exact match, or a path segment below it — so the
|
|
58
58
|
* sidebar highlights `/admin/users` while viewing `/admin/users/:id`.
|
|
59
|
+
*
|
|
60
|
+
* ⚠️ On its own this over-matches, because it can only see one entry at a time.
|
|
61
|
+
* Run the results through {@link keepDeepestActive} — see there for why.
|
|
59
62
|
*/
|
|
60
63
|
export function isActivePath(current: string, href: string): boolean {
|
|
61
64
|
return current === href || current.startsWith(`${href}/`);
|
|
62
65
|
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Given entries already marked by {@link isActivePath}, keep only the deepest
|
|
69
|
+
* match and clear the rest.
|
|
70
|
+
*
|
|
71
|
+
* `isActivePath` answers "is the current page on or under this entry", which is
|
|
72
|
+
* the right question for a section that owns a subtree — `/admin/users` must
|
|
73
|
+
* stay lit while a user detail page is open. But it is a per-entry predicate,
|
|
74
|
+
* so it cannot tell that a *different* entry matched more specifically.
|
|
75
|
+
*
|
|
76
|
+
* That is not hypothetical. A page at `path: "/"` under a shell contributes no
|
|
77
|
+
* segment of its own, and `ReactPageProvider.createMatch` collapses the result
|
|
78
|
+
* (`/account` + `/` → `/account/` → `/account`), so its `match` comes out
|
|
79
|
+
* **identical to the shell's**. The entry is then a path-prefix of every one of
|
|
80
|
+
* its siblings, and lights up on all of them. `AccountRouter.profile` is
|
|
81
|
+
* exactly this: Profile rendered active on Security, Sessions, API keys,
|
|
82
|
+
* Connected apps and both Lore pages.
|
|
83
|
+
*
|
|
84
|
+
* Deepest-wins rather than a narrower "an index entry must match exactly"
|
|
85
|
+
* rule, because the narrow version breaks the case the loose predicate exists
|
|
86
|
+
* for: an index page that legitimately owns child routes of its own would stop
|
|
87
|
+
* highlighting while one of those children is open. Comparing candidates keeps
|
|
88
|
+
* both behaviours without either needing to know it is an index.
|
|
89
|
+
*
|
|
90
|
+
* Length is a safe proxy for depth here: every candidate is a prefix of the
|
|
91
|
+
* same `current`, so of any two, the longer is under the shorter.
|
|
92
|
+
*/
|
|
93
|
+
export function keepDeepestActive<T extends { href: string; active: boolean }>(
|
|
94
|
+
entries: T[],
|
|
95
|
+
): T[] {
|
|
96
|
+
let deepest = -1;
|
|
97
|
+
for (const entry of entries) {
|
|
98
|
+
if (entry.active && entry.href.length > deepest) {
|
|
99
|
+
deepest = entry.href.length;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
for (const entry of entries) {
|
|
104
|
+
if (entry.active && entry.href.length < deepest) {
|
|
105
|
+
entry.active = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return entries;
|
|
110
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
hasNavPermission,
|
|
7
7
|
isActivePath,
|
|
8
8
|
isDescendantOf,
|
|
9
|
+
keepDeepestActive,
|
|
9
10
|
navLabel,
|
|
10
11
|
} from "./nav-tree-util.ts";
|
|
11
12
|
|
|
@@ -39,7 +40,11 @@ export interface NavEntry {
|
|
|
39
40
|
badge?: ReactNode;
|
|
40
41
|
/** `can()` returned `"disabled"` — show muted, block navigation. */
|
|
41
42
|
disabled: boolean;
|
|
42
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* The current route is on or under this entry, and no sibling entry matched
|
|
45
|
+
* it more specifically. At most one entry in a list is active — see
|
|
46
|
+
* {@link keepDeepestActive}.
|
|
47
|
+
*/
|
|
43
48
|
active: boolean;
|
|
44
49
|
}
|
|
45
50
|
|
|
@@ -96,6 +101,10 @@ export function useNavEntries(options: UseNavEntriesOptions): NavEntry[] {
|
|
|
96
101
|
entry.groupOrder = groupOrders.get(entry.group ?? "") ?? 0;
|
|
97
102
|
}
|
|
98
103
|
entries.sort((a, b) => a.groupOrder - b.groupOrder || a.order - b.order);
|
|
99
|
-
|
|
104
|
+
|
|
105
|
+
// `isActivePath` sees one entry at a time and so cannot tell that another
|
|
106
|
+
// matched more specifically. Only now, with the whole set in hand, can the
|
|
107
|
+
// shallower matches be dropped.
|
|
108
|
+
return keepDeepestActive(entries);
|
|
100
109
|
}, [pages, current, has, options.root]);
|
|
101
110
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
export interface SettingsHeadingProps {
|
|
5
|
+
/**
|
|
6
|
+
* What this block of the page is. A noun phrase naming the thing, not a verb
|
|
7
|
+
* phrase describing the action: "Active sessions", not "Manage sessions".
|
|
8
|
+
*/
|
|
9
|
+
title?: ReactNode;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* One line under the title. The place to put what the reader needs to know
|
|
13
|
+
* before touching anything below it — a consequence, a constraint, a limit.
|
|
14
|
+
* Skip it rather than restate the title in more words.
|
|
15
|
+
*/
|
|
16
|
+
description?: ReactNode;
|
|
17
|
+
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The title + description pair that sits above a settings block.
|
|
23
|
+
*
|
|
24
|
+
* It exists so there is exactly one of it. {@link SettingsSection} renders this
|
|
25
|
+
* for the common case (a heading over a card of {@link SettingsRow}s), and a
|
|
26
|
+
* page whose content is not a card of rows — a table, a list of invitations —
|
|
27
|
+
* uses it directly instead of hand-rolling the markup.
|
|
28
|
+
*
|
|
29
|
+
* That hand-rolling is the failure this prevents, and it had already happened:
|
|
30
|
+
* `apps/lore`'s account pages grew an `<h2 className="text-base font-semibold">`
|
|
31
|
+
* on one page and a bare `<span className="text-xs">` with no title at all on
|
|
32
|
+
* another, so the `/account` rail led to three different type scales depending
|
|
33
|
+
* on which entry you clicked. Nothing was broken and nothing could have failed
|
|
34
|
+
* — it just read as three pages from three different applications.
|
|
35
|
+
*
|
|
36
|
+
* ⚠️ **No em dash in these strings.** House rule across every user-facing
|
|
37
|
+
* string, in this component and everywhere else: use a comma, a semicolon, a
|
|
38
|
+
* full stop, or split the sentence in two.
|
|
39
|
+
*/
|
|
40
|
+
export const SettingsHeading = (props: SettingsHeadingProps) => {
|
|
41
|
+
if (props.title == null && props.description == null) return null;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className={cn("flex flex-col gap-0.5", props.className)}>
|
|
45
|
+
{props.title != null ? (
|
|
46
|
+
<span className="text-sm">{props.title}</span>
|
|
47
|
+
) : null}
|
|
48
|
+
{props.description != null ? (
|
|
49
|
+
<span className="text-muted-foreground text-xs">
|
|
50
|
+
{props.description}
|
|
51
|
+
</span>
|
|
52
|
+
) : null}
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|