@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
|
@@ -3,6 +3,11 @@ import * as React from "react";
|
|
|
3
3
|
void React;
|
|
4
4
|
|
|
5
5
|
import { FormField } from "@alepha/ui/components/control-base/form-field";
|
|
6
|
+
import {
|
|
7
|
+
DATE_ONLY,
|
|
8
|
+
formatDateOnly,
|
|
9
|
+
parseDateOnly,
|
|
10
|
+
} from "@alepha/ui/components/control-date/date-only.ts";
|
|
6
11
|
import { Button } from "@alepha/ui/components/ui/button";
|
|
7
12
|
import { Calendar } from "@alepha/ui/components/ui/calendar";
|
|
8
13
|
import { Input } from "@alepha/ui/components/ui/input";
|
|
@@ -25,6 +30,11 @@ import {
|
|
|
25
30
|
X,
|
|
26
31
|
} from "lucide-react";
|
|
27
32
|
import { useState } from "react";
|
|
33
|
+
import type { DayPickerProps } from "react-day-picker";
|
|
34
|
+
|
|
35
|
+
/** How many years back a `birthdate` picker offers. Covers every living
|
|
36
|
+
* person; the oldest verified human reached 122. */
|
|
37
|
+
const BIRTHDATE_YEARS = 120;
|
|
28
38
|
|
|
29
39
|
export interface ControlDateProps {
|
|
30
40
|
/**
|
|
@@ -63,6 +73,32 @@ export interface ControlDateProps {
|
|
|
63
73
|
* control in the kit spells this `clearable`, so this one does too.
|
|
64
74
|
*/
|
|
65
75
|
clearable?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Caption style. `"label"` (the default) shows the month name with
|
|
78
|
+
* previous/next arrows; `"dropdown"` swaps both for month and year selects.
|
|
79
|
+
*
|
|
80
|
+
* Arrows are fine for a date near today and hopeless for one that is not:
|
|
81
|
+
* reaching a 1988 birthday costs about 450 clicks on `<`. Pair `"dropdown"`
|
|
82
|
+
* with {@link startMonth} / {@link endMonth}, or use {@link birthdate},
|
|
83
|
+
* which sets both.
|
|
84
|
+
*/
|
|
85
|
+
captionLayout?: DayPickerProps["captionLayout"];
|
|
86
|
+
/**
|
|
87
|
+
* First selectable month. Also bounds the year dropdown, which otherwise
|
|
88
|
+
* offers a narrow range around today.
|
|
89
|
+
*/
|
|
90
|
+
startMonth?: Date;
|
|
91
|
+
/** Last selectable month. */
|
|
92
|
+
endMonth?: Date;
|
|
93
|
+
/**
|
|
94
|
+
* Shorthand for a date of birth: a year dropdown covering the last
|
|
95
|
+
* {@link BIRTHDATE_YEARS} years, ending this year.
|
|
96
|
+
*
|
|
97
|
+
* Sugar over `captionLayout` + `startMonth` / `endMonth`, which stay
|
|
98
|
+
* available for any other historical field. An explicit value for one of
|
|
99
|
+
* those wins over what this sets.
|
|
100
|
+
*/
|
|
101
|
+
birthdate?: boolean;
|
|
66
102
|
}
|
|
67
103
|
|
|
68
104
|
export const ControlDate = (props: ControlDateProps) => {
|
|
@@ -105,6 +141,8 @@ export const ControlDate = (props: ControlDateProps) => {
|
|
|
105
141
|
);
|
|
106
142
|
}
|
|
107
143
|
|
|
144
|
+
const thisYear = new Date().getFullYear();
|
|
145
|
+
|
|
108
146
|
return (
|
|
109
147
|
<FormField
|
|
110
148
|
id={meta.id}
|
|
@@ -119,6 +157,19 @@ export const ControlDate = (props: ControlDateProps) => {
|
|
|
119
157
|
withTime={isDateTime}
|
|
120
158
|
disabled={props.disabled}
|
|
121
159
|
clearable={props.clearable}
|
|
160
|
+
captionLayout={
|
|
161
|
+
props.captionLayout ?? (props.birthdate ? "dropdown" : undefined)
|
|
162
|
+
}
|
|
163
|
+
startMonth={
|
|
164
|
+
props.startMonth ??
|
|
165
|
+
(props.birthdate
|
|
166
|
+
? new Date(thisYear - BIRTHDATE_YEARS, 0, 1)
|
|
167
|
+
: undefined)
|
|
168
|
+
}
|
|
169
|
+
endMonth={
|
|
170
|
+
props.endMonth ??
|
|
171
|
+
(props.birthdate ? new Date(thisYear, 11, 31) : undefined)
|
|
172
|
+
}
|
|
122
173
|
onChange={(v) => setValue(v)}
|
|
123
174
|
/>
|
|
124
175
|
</FormField>
|
|
@@ -131,28 +182,12 @@ interface DatePopoverProps {
|
|
|
131
182
|
withTime: boolean;
|
|
132
183
|
disabled?: boolean;
|
|
133
184
|
clearable?: boolean;
|
|
185
|
+
captionLayout?: DayPickerProps["captionLayout"];
|
|
186
|
+
startMonth?: Date;
|
|
187
|
+
endMonth?: Date;
|
|
134
188
|
onChange: (value: string | undefined) => void;
|
|
135
189
|
}
|
|
136
190
|
|
|
137
|
-
/**
|
|
138
|
-
* A date-only value (`YYYY-MM-DD`) names a calendar day, so it is parsed
|
|
139
|
-
* and formatted in local parts: `new Date("2026-08-23")` is UTC midnight,
|
|
140
|
-
* which displays as the 22nd west of Greenwich, and `toISOString()` on a
|
|
141
|
-
* local midnight stores the previous day east of it.
|
|
142
|
-
*/
|
|
143
|
-
const parseDateOnly = (value: string): Date => {
|
|
144
|
-
const [year, month, day] = value.split("-").map(Number);
|
|
145
|
-
return new Date(year, month - 1, day);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const formatDateOnly = (date: Date): string => {
|
|
149
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
150
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
151
|
-
return `${date.getFullYear()}-${month}-${day}`;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
155
|
-
|
|
156
191
|
const DatePopover = (props: DatePopoverProps) => {
|
|
157
192
|
const [open, setOpen] = useState(false);
|
|
158
193
|
const date = props.value
|
|
@@ -205,16 +240,69 @@ const DatePopover = (props: DatePopoverProps) => {
|
|
|
205
240
|
render={
|
|
206
241
|
<Button
|
|
207
242
|
id={props.id}
|
|
243
|
+
// A FIELD trigger, not a button, and the distinction is load
|
|
244
|
+
// bearing: `styles.css` gives the `--input-hover` border to a
|
|
245
|
+
// list of `data-slot`s, and this one was not on it, so the date
|
|
246
|
+
// control was the only field in the kit that did not darken its
|
|
247
|
+
// border under the pointer. Overriding Base UI's own
|
|
248
|
+
// `data-slot="button"` is safe - nothing selects on it.
|
|
249
|
+
data-slot="date-trigger"
|
|
208
250
|
variant="outline"
|
|
209
251
|
disabled={props.disabled}
|
|
210
252
|
className={cn(
|
|
211
253
|
"flex-1 justify-start text-left font-normal",
|
|
212
|
-
|
|
254
|
+
// ⚠️ **`border-input`, overriding the outline variant's
|
|
255
|
+
// `border-border`.** Both tokens hold the same value today,
|
|
256
|
+
// so this changes nothing on screen - and that is exactly why
|
|
257
|
+
// it is written down. Rendering as a Button means inheriting
|
|
258
|
+
// `buttonVariants.outline`, which reaches for `--border`;
|
|
259
|
+
// right for a BUTTON, whose edge is decoration beside a fill
|
|
260
|
+
// and a label, and wrong for a FIELD, whose edge is the only
|
|
261
|
+
// thing saying where it is.
|
|
262
|
+
//
|
|
263
|
+
// The alias is what makes the mistake invisible. It was split
|
|
264
|
+
// once (#Q2149) and this control was immediately the only one
|
|
265
|
+
// of the six field slots on the wrong side of it, while
|
|
266
|
+
// `input`, `textarea`, `select-trigger`, `input-group` and
|
|
267
|
+
// `combobox-trigger` all followed `--input` on their own.
|
|
268
|
+
// Same reason the comment above claims
|
|
269
|
+
// `data-slot="date-trigger"` rather than leaving it a button.
|
|
270
|
+
"border-input",
|
|
271
|
+
// Undo the outline variant's hover fill AND its open-state
|
|
272
|
+
// fill. A select trigger shades for neither: the border is the
|
|
273
|
+
// affordance in both cases, and a field that greys out while
|
|
274
|
+
// its own popover is open reads as disabled at the moment it
|
|
275
|
+
// is most active. Neither `select-trigger` nor
|
|
276
|
+
// `combobox-trigger` carries an `aria-expanded:bg-*` rule at
|
|
277
|
+
// all, which is the behaviour being matched.
|
|
278
|
+
//
|
|
279
|
+
// ⚠️ Each modifier has to match the variant's own EXACTLY -
|
|
280
|
+
// `hover:` and `aria-expanded:` - or tailwind-merge keeps both
|
|
281
|
+
// rules and the winner is down to specificity, which the
|
|
282
|
+
// longer modifier chain wins.
|
|
283
|
+
"hover:bg-background aria-expanded:bg-background",
|
|
284
|
+
// Same reasoning for the placeholder: a select leaves it muted
|
|
285
|
+
// under the pointer. With a value the text is already
|
|
286
|
+
// `foreground`, so this only matters while empty.
|
|
287
|
+
!date &&
|
|
288
|
+
"text-muted-foreground hover:text-muted-foreground aria-expanded:text-muted-foreground",
|
|
213
289
|
)}
|
|
214
290
|
/>
|
|
215
291
|
}
|
|
216
292
|
>
|
|
217
|
-
|
|
293
|
+
{/*
|
|
294
|
+
Muted whatever the field holds, matching `InputGroupAddon`, which
|
|
295
|
+
paints every other leading icon in the kit `text-muted-foreground`
|
|
296
|
+
on the container.
|
|
297
|
+
|
|
298
|
+
Without the class this icon simply inherits the trigger's `color`,
|
|
299
|
+
which the control swaps between muted and foreground to grey the
|
|
300
|
+
PLACEHOLDER - so the icon brightened when a date was picked. That
|
|
301
|
+
looked deliberate and was not: an icon says what kind of field this
|
|
302
|
+
is, which does not change when you fill it, and the text beside it
|
|
303
|
+
already carries filled-versus-empty.
|
|
304
|
+
*/}
|
|
305
|
+
<CalendarIcon className="text-muted-foreground mr-2 size-4" />
|
|
218
306
|
{formatted || "Pick a date"}
|
|
219
307
|
{/* Same trailing caret a select trigger carries, for the same
|
|
220
308
|
reason: this opens a popover, and without it the control reads
|
|
@@ -236,7 +324,14 @@ const DatePopover = (props: DatePopoverProps) => {
|
|
|
236
324
|
)}
|
|
237
325
|
</div>
|
|
238
326
|
<PopoverContent className="w-auto p-0" align="start">
|
|
239
|
-
<Calendar
|
|
327
|
+
<Calendar
|
|
328
|
+
mode="single"
|
|
329
|
+
selected={date}
|
|
330
|
+
onSelect={handleDate}
|
|
331
|
+
captionLayout={props.captionLayout}
|
|
332
|
+
startMonth={props.startMonth}
|
|
333
|
+
endMonth={props.endMonth}
|
|
334
|
+
/>
|
|
240
335
|
{props.withTime && (
|
|
241
336
|
<div className="border-t p-3">
|
|
242
337
|
<Input
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A date-only value (`YYYY-MM-DD`) names a calendar DAY, not an instant, so
|
|
3
|
+
* it is parsed and formatted in local parts.
|
|
4
|
+
*
|
|
5
|
+
* ⚠️ This is not a stylistic preference. `new Date("2026-08-23")` is UTC
|
|
6
|
+
* midnight, which displays as the 22nd west of Greenwich, and
|
|
7
|
+
* `toISOString()` on a local midnight stores the previous day east of it. A
|
|
8
|
+
* control that mixes the two shifts every value it renders by a day for half
|
|
9
|
+
* the world.
|
|
10
|
+
*
|
|
11
|
+
* Extracted so `ControlDate` and `ControlDateRange` share one answer: two
|
|
12
|
+
* copies of this reasoning is two chances to get the timezone wrong, and the
|
|
13
|
+
* one that drifts is the one nobody is looking at.
|
|
14
|
+
*/
|
|
15
|
+
export const parseDateOnly = (value: string): Date => {
|
|
16
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
17
|
+
return new Date(year, month - 1, day);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const formatDateOnly = (date: Date): string => {
|
|
21
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
22
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
23
|
+
return `${date.getFullYear()}-${month}-${day}`;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
void React;
|
|
4
|
+
|
|
5
|
+
import { FormField } from "@alepha/ui/components/control-base/form-field";
|
|
6
|
+
import {
|
|
7
|
+
DATE_ONLY,
|
|
8
|
+
formatDateOnly,
|
|
9
|
+
parseDateOnly,
|
|
10
|
+
} from "@alepha/ui/components/control-date/date-only.ts";
|
|
11
|
+
import { Button } from "@alepha/ui/components/ui/button";
|
|
12
|
+
import { Calendar } from "@alepha/ui/components/ui/calendar";
|
|
13
|
+
import {
|
|
14
|
+
Popover,
|
|
15
|
+
PopoverContent,
|
|
16
|
+
PopoverTrigger,
|
|
17
|
+
} from "@alepha/ui/components/ui/popover";
|
|
18
|
+
import { cn } from "@alepha/ui/lib/utils";
|
|
19
|
+
import {
|
|
20
|
+
type BaseInputField,
|
|
21
|
+
parseField,
|
|
22
|
+
useFieldValue,
|
|
23
|
+
useFormState,
|
|
24
|
+
} from "alepha/react/form";
|
|
25
|
+
import {
|
|
26
|
+
Calendar as CalendarIcon,
|
|
27
|
+
ChevronDown as ChevronDownIcon,
|
|
28
|
+
X,
|
|
29
|
+
} from "lucide-react";
|
|
30
|
+
import { useState } from "react";
|
|
31
|
+
import type { DateRange } from "react-day-picker";
|
|
32
|
+
|
|
33
|
+
export interface ControlDateRangeProps {
|
|
34
|
+
/**
|
|
35
|
+
* Bound `InputField` from `useForm`. Stores `[start, end]`, two date-only
|
|
36
|
+
* strings, or nothing at all.
|
|
37
|
+
*/
|
|
38
|
+
input: BaseInputField;
|
|
39
|
+
label?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Offer a way back to empty once a range is picked.
|
|
44
|
+
*
|
|
45
|
+
* A calendar has no "none" cell, so without this an optional range field is
|
|
46
|
+
* one-way. Spelled `clearable` like every other control in the kit.
|
|
47
|
+
*/
|
|
48
|
+
clearable?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Shown on the trigger while the field is empty.
|
|
51
|
+
*/
|
|
52
|
+
placeholder?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Extra classes on the trigger button. A filter bar sizes its slots, and a
|
|
55
|
+
* range trigger holds two dates rather than one, so it usually wants to be
|
|
56
|
+
* wider than its neighbours.
|
|
57
|
+
*/
|
|
58
|
+
triggerClassName?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A closed range of calendar days, as one field.
|
|
63
|
+
*
|
|
64
|
+
* `z.dateRange()` makes both ends mandatory, so this control never writes a
|
|
65
|
+
* half-range: `.optional()` on the schema is the only way to say "no filter",
|
|
66
|
+
* and there is nothing in between.
|
|
67
|
+
*
|
|
68
|
+
* ⚠️ **The field is written on the second CLICK, not on the first complete
|
|
69
|
+
* range**, and the difference is measured rather than assumed. The trap this
|
|
70
|
+
* was written for is DayPicker handing back `{ from }` with no `to`
|
|
71
|
+
* mid-gesture; react-day-picker ^10 does something else, which is worse for a
|
|
72
|
+
* naive control: the first click answers `{ from: d, to: d }`, a complete
|
|
73
|
+
* one-day range. A control that wrote whenever both ends existed would
|
|
74
|
+
* therefore take the start date as the whole range and slam the popover shut
|
|
75
|
+
* before the reader picked an end.
|
|
76
|
+
*
|
|
77
|
+
* So `pending` counts the gesture instead of reading its shape, and it
|
|
78
|
+
* handles both behaviours: a genuinely half range holds, and a
|
|
79
|
+
* DayPicker-completed first click holds too. `control-date-range.browser
|
|
80
|
+
* .spec.tsx` drives two real clicks, which is what found this.
|
|
81
|
+
*
|
|
82
|
+
* ⚠️ **Local parts, never `new Date(value)`.** A date-only string is a
|
|
83
|
+
* calendar day; parsing it as an instant shifts it by one west of Greenwich.
|
|
84
|
+
* The two helpers are `control-date`'s own, shared rather than copied.
|
|
85
|
+
*/
|
|
86
|
+
export const ControlDateRange = (props: ControlDateRangeProps) => {
|
|
87
|
+
const form = useFormState(props.input, ["error"]);
|
|
88
|
+
const [value, setValue] = useFieldValue(props.input);
|
|
89
|
+
const [open, setOpen] = useState(false);
|
|
90
|
+
/**
|
|
91
|
+
* Whether a selection gesture is half-made: one click in, waiting for the
|
|
92
|
+
* other end. Reset whenever the popover opens, so an abandoned gesture
|
|
93
|
+
* cannot make the next popover's first click look like a second one.
|
|
94
|
+
*/
|
|
95
|
+
const [pending, setPending] = useState(false);
|
|
96
|
+
|
|
97
|
+
const stored = toRange(value as unknown);
|
|
98
|
+
const storedKey = Array.isArray(value) ? (value as string[]).join(",") : "";
|
|
99
|
+
// The gesture in progress. Seeded from the field, and re-seeded whenever
|
|
100
|
+
// the field moves underneath it - a form reset, or a value arriving from
|
|
101
|
+
// the URL after the first paint.
|
|
102
|
+
const [draft, setDraft] = useState<DateRange | undefined>(stored);
|
|
103
|
+
const [seenKey, setSeenKey] = useState(storedKey);
|
|
104
|
+
if (seenKey !== storedKey) {
|
|
105
|
+
// ⚠️ Adjusted DURING render, not in an effect. React documents this as
|
|
106
|
+
// the way to reset state when an input changes, and the effect version is
|
|
107
|
+
// a lint error here (`react(set-state-in-effect)`) for the reason the
|
|
108
|
+
// rule gives: it renders once with the stale draft and again with the new
|
|
109
|
+
// one, so a value arriving from the URL is visibly wrong for a frame.
|
|
110
|
+
//
|
|
111
|
+
// Keyed on the joined VALUE, never on `stored`: `toRange` builds a new
|
|
112
|
+
// object every render, so comparing objects would reset the draft on
|
|
113
|
+
// every keystroke elsewhere in the form and discard a half-made
|
|
114
|
+
// selection.
|
|
115
|
+
setSeenKey(storedKey);
|
|
116
|
+
setDraft(stored);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!props.input?.props) return null;
|
|
120
|
+
|
|
121
|
+
const meta = parseField(props.input, {
|
|
122
|
+
label: props.label,
|
|
123
|
+
description: props.description,
|
|
124
|
+
error: form.error,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const shown = draft ?? stored;
|
|
128
|
+
const formatted = shown?.from
|
|
129
|
+
? shown.to
|
|
130
|
+
? `${shown.from.toLocaleDateString()} - ${shown.to.toLocaleDateString()}`
|
|
131
|
+
: shown.from.toLocaleDateString()
|
|
132
|
+
: "";
|
|
133
|
+
|
|
134
|
+
const handleSelect = (next: DateRange | undefined) => {
|
|
135
|
+
setDraft(next);
|
|
136
|
+
if (!next?.from) {
|
|
137
|
+
setPending(false);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (!next.to || !pending) {
|
|
141
|
+
// The first click of a gesture, whichever shape DayPicker gave it. The
|
|
142
|
+
// field keeps whatever it had: writing now would either fail the schema
|
|
143
|
+
// (half a range) or record the start day as the whole range, and
|
|
144
|
+
// clearing would destroy the old range before the new one exists.
|
|
145
|
+
setPending(true);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
setPending(false);
|
|
149
|
+
setValue([formatDateOnly(next.from), formatDateOnly(next.to)]);
|
|
150
|
+
setOpen(false);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const showClear = props.clearable && !!stored?.from && !props.disabled;
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<FormField
|
|
157
|
+
id={meta.id}
|
|
158
|
+
label={meta.label}
|
|
159
|
+
description={meta.description}
|
|
160
|
+
error={meta.error}
|
|
161
|
+
required={meta.required}
|
|
162
|
+
>
|
|
163
|
+
<Popover
|
|
164
|
+
open={open}
|
|
165
|
+
onOpenChange={(next) => {
|
|
166
|
+
setOpen(next);
|
|
167
|
+
if (next) setPending(false);
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
{/* The clear button sits BESIDE the trigger, not inside it: a button
|
|
171
|
+
nested in a button is invalid, and Base UI's popover trigger would
|
|
172
|
+
swallow its click anyway. Same arrangement as `ControlDate`. */}
|
|
173
|
+
<div className="flex w-full items-center gap-1">
|
|
174
|
+
<PopoverTrigger
|
|
175
|
+
render={
|
|
176
|
+
<Button
|
|
177
|
+
id={meta.id}
|
|
178
|
+
// `date-trigger`, the same slot `ControlDate` claims, so this
|
|
179
|
+
// control gets the kit's `--input-hover` border rule rather
|
|
180
|
+
// than being the one field that does not darken.
|
|
181
|
+
data-slot="date-trigger"
|
|
182
|
+
variant="outline"
|
|
183
|
+
disabled={props.disabled}
|
|
184
|
+
// `name` only, never the whole `input.props` spread: those
|
|
185
|
+
// are an `<input>`'s props and this is a button, so their
|
|
186
|
+
// `onChange` signature is genuinely incompatible. The name is
|
|
187
|
+
// what `AutoForm`'s scroll-to-first-error looks a field up by.
|
|
188
|
+
name={props.input.props.name}
|
|
189
|
+
className={cn(
|
|
190
|
+
"flex-1 justify-start text-left font-normal",
|
|
191
|
+
// `border-input`, for the reason `ControlDate` spells out:
|
|
192
|
+
// rendering as a Button means inheriting the outline
|
|
193
|
+
// variant's `border-border`, which is right for a button
|
|
194
|
+
// and wrong for a field. A no-op while the two tokens are
|
|
195
|
+
// aliased, which is why it is worth stating.
|
|
196
|
+
"border-input",
|
|
197
|
+
"hover:bg-background aria-expanded:bg-background",
|
|
198
|
+
!formatted &&
|
|
199
|
+
"text-muted-foreground hover:text-muted-foreground aria-expanded:text-muted-foreground",
|
|
200
|
+
props.triggerClassName,
|
|
201
|
+
)}
|
|
202
|
+
/>
|
|
203
|
+
}
|
|
204
|
+
>
|
|
205
|
+
<CalendarIcon className="text-muted-foreground mr-2 size-4" />
|
|
206
|
+
{formatted || props.placeholder || "Pick a date range"}
|
|
207
|
+
<ChevronDownIcon className="text-muted-foreground pointer-events-none ml-auto size-4 shrink-0" />
|
|
208
|
+
</PopoverTrigger>
|
|
209
|
+
{showClear && (
|
|
210
|
+
<Button
|
|
211
|
+
type="button"
|
|
212
|
+
variant="ghost"
|
|
213
|
+
size="icon"
|
|
214
|
+
aria-label="Clear date range"
|
|
215
|
+
onClick={() => {
|
|
216
|
+
setDraft(undefined);
|
|
217
|
+
setValue(undefined);
|
|
218
|
+
}}
|
|
219
|
+
>
|
|
220
|
+
<X className="size-4" />
|
|
221
|
+
</Button>
|
|
222
|
+
)}
|
|
223
|
+
</div>
|
|
224
|
+
<PopoverContent className="w-auto p-0" align="start">
|
|
225
|
+
{/* The range visuals were built and unused: `calendar.tsx` passes
|
|
226
|
+
`...props` straight to DayPicker and already defines
|
|
227
|
+
`range_start` / `range_middle` / `range_end`, which its custom
|
|
228
|
+
`DayButton` reads into styled data attributes. */}
|
|
229
|
+
<Calendar mode="range" selected={shown} onSelect={handleSelect} />
|
|
230
|
+
</PopoverContent>
|
|
231
|
+
</Popover>
|
|
232
|
+
</FormField>
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The stored pair as DayPicker's own shape, or nothing.
|
|
238
|
+
*
|
|
239
|
+
* Anything that is not two parseable date-only strings reads as empty rather
|
|
240
|
+
* than as half a range: the value comes off a URL as often as off a form, and
|
|
241
|
+
* a malformed one is the schema's to reject, not this control's to render.
|
|
242
|
+
*/
|
|
243
|
+
const toRange = (value: unknown): DateRange | undefined => {
|
|
244
|
+
if (!Array.isArray(value) || value.length !== 2) return undefined;
|
|
245
|
+
const [from, to] = value as string[];
|
|
246
|
+
if (!from || !to || !DATE_ONLY.test(from) || !DATE_ONLY.test(to)) {
|
|
247
|
+
return undefined;
|
|
248
|
+
}
|
|
249
|
+
return { from: parseDateOnly(from), to: parseDateOnly(to) };
|
|
250
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render } from "@testing-library/react";
|
|
1
|
+
import { fireEvent, render, waitFor } from "@testing-library/react";
|
|
2
2
|
import { Alepha, z } from "alepha";
|
|
3
3
|
import { AlephaLogger } from "alepha/logger";
|
|
4
4
|
import { AlephaContext } from "alepha/react";
|
|
@@ -10,16 +10,29 @@ import { describe, expect, it } from "vitest";
|
|
|
10
10
|
import { ControlSelect } from "../control-select.tsx";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* `
|
|
14
|
-
* count (>20 → combobox). The two paths disagreed about what the `clearable`
|
|
15
|
-
* row's label *is*: the Select path made it a genuine selected value, the
|
|
16
|
-
* combobox passed it through as a placeholder and muted the trigger. So the
|
|
17
|
-
* same filter, meaning the same thing, changed colour the day its option list
|
|
18
|
-
* grew past 20 — which is exactly what happened to the quests board, where
|
|
19
|
-
* "All status" and "All areas" read as set and "All tags" read as unset.
|
|
13
|
+
* Where a `clearable` field's label belongs: on the trigger, and nowhere else.
|
|
20
14
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* ⚠️ This file used to assert the OPPOSITE of what it asserts now, and the
|
|
16
|
+
* reversal is deliberate rather than drift.
|
|
17
|
+
*
|
|
18
|
+
* It was written when `ControlSelect` injected a synthetic clear ROW at the
|
|
19
|
+
* top of a single-select's list, and when two render paths disagreed about
|
|
20
|
+
* whether that row was a genuine selected value (full contrast) or a
|
|
21
|
+
* placeholder (muted) - so the same filter changed colour the day its option
|
|
22
|
+
* list crossed a threshold. Its cases therefore pinned "reads as a value, not
|
|
23
|
+
* a placeholder" on both paths.
|
|
24
|
+
*
|
|
25
|
+
* Two things have since changed. The paths converged - the threshold now only
|
|
26
|
+
* decides whether a search input appears, never which control you get - and
|
|
27
|
+
* the clear row is gone: it said the same thing the trigger already says, a
|
|
28
|
+
* second time, as a pickable option with a check mark, so "All states" read
|
|
29
|
+
* as a third state rather than as the absence of a filter (feedback #2092,
|
|
30
|
+
* then #2098).
|
|
31
|
+
*
|
|
32
|
+
* So empty is now EMPTY: `clearLabel` is the trigger's placeholder, styled as
|
|
33
|
+
* one, and getting back there is either the `x` the trigger grows once
|
|
34
|
+
* something is chosen or re-clicking the chosen row
|
|
35
|
+
* (`control-select-deselect.browser.spec.tsx`).
|
|
23
36
|
*/
|
|
24
37
|
describe("ControlSelect clear label", () => {
|
|
25
38
|
const mount = (alepha: Alepha, ui: ReactNode) =>
|
|
@@ -52,6 +65,9 @@ describe("ControlSelect clear label", () => {
|
|
|
52
65
|
);
|
|
53
66
|
};
|
|
54
67
|
|
|
68
|
+
const clearButton = (ui: ReturnType<typeof render>) =>
|
|
69
|
+
ui.queryByRole("button", { name: "Clear selection" });
|
|
70
|
+
|
|
55
71
|
/**
|
|
56
72
|
* Both paths render their trigger as the field's only `combobox` role — the
|
|
57
73
|
* shadcn `SelectTrigger` and the Base UI `ComboboxTrigger` alike — so one
|
|
@@ -73,23 +89,26 @@ describe("ControlSelect clear label", () => {
|
|
|
73
89
|
el.hasAttribute("data-placeholder") ||
|
|
74
90
|
el.className.split(/\s+/).includes("text-muted-foreground");
|
|
75
91
|
|
|
76
|
-
it("
|
|
92
|
+
it("shows the clear label on the trigger, as a placeholder", async () => {
|
|
77
93
|
const alepha = await start();
|
|
78
94
|
const ui = mount(alepha, <Probe count={5} clearable />);
|
|
79
95
|
|
|
80
96
|
expect(trigger(ui).textContent).toContain("All tags");
|
|
81
|
-
|
|
97
|
+
// The reversal: empty is empty, so it is styled as the placeholder it is.
|
|
98
|
+
expect(readsAsPlaceholder(trigger(ui))).toBe(true);
|
|
82
99
|
});
|
|
83
100
|
|
|
84
|
-
it("
|
|
101
|
+
it("does the same past the search threshold", async () => {
|
|
85
102
|
const alepha = await start();
|
|
86
103
|
const ui = mount(alepha, <Probe count={25} clearable />);
|
|
87
104
|
|
|
105
|
+
// The threshold decides whether you can type, never which control you
|
|
106
|
+
// get, so the two option counts cannot disagree about this any more.
|
|
88
107
|
expect(trigger(ui).textContent).toContain("All tags");
|
|
89
|
-
expect(readsAsPlaceholder(trigger(ui))).toBe(
|
|
108
|
+
expect(readsAsPlaceholder(trigger(ui))).toBe(true);
|
|
90
109
|
});
|
|
91
110
|
|
|
92
|
-
it("
|
|
111
|
+
it("reads as a placeholder without a clear label too", async () => {
|
|
93
112
|
const alepha = await start();
|
|
94
113
|
|
|
95
114
|
const short = mount(alepha, <Probe count={5} />);
|
|
@@ -99,4 +118,99 @@ describe("ControlSelect clear label", () => {
|
|
|
99
118
|
const long = mount(alepha, <Probe count={25} />);
|
|
100
119
|
expect(readsAsPlaceholder(trigger(long))).toBe(true);
|
|
101
120
|
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The change itself: the label appears ONCE. Before this, opening a
|
|
124
|
+
* `clearable` single-select showed "All tags" again as the first row.
|
|
125
|
+
*/
|
|
126
|
+
it("puts no clear row in the list", async () => {
|
|
127
|
+
const alepha = await start();
|
|
128
|
+
const ui = mount(alepha, <Probe count={5} clearable />);
|
|
129
|
+
|
|
130
|
+
trigger(ui).click();
|
|
131
|
+
|
|
132
|
+
const rows = await ui.findAllByRole("option");
|
|
133
|
+
const labels = rows.map((r) => r.textContent);
|
|
134
|
+
expect(labels).not.toContain("All tags");
|
|
135
|
+
// The real options are all still there.
|
|
136
|
+
expect(labels).toContain("tag-0");
|
|
137
|
+
expect(labels).toHaveLength(5);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The affordance that replaced the row, in the place the row was never in.
|
|
142
|
+
*
|
|
143
|
+
* Deleting the row left re-pressing the chosen option as the only way back
|
|
144
|
+
* to empty, which works but is quiet - the row was the visible half. This
|
|
145
|
+
* is the answer the quest named ahead of time: an `x` on the trigger, not
|
|
146
|
+
* the row coming back.
|
|
147
|
+
*/
|
|
148
|
+
/**
|
|
149
|
+
* Why this button exists, stated properly.
|
|
150
|
+
*
|
|
151
|
+
* ⚠️ An earlier version of the component's own comment said the `x` had to
|
|
152
|
+
* exist because `epics.spec.ts` went red when the injected "No release" row
|
|
153
|
+
* was deleted. That is circular, and it is corrected in
|
|
154
|
+
* `control-select.tsx` and in that spec: it went red because its SELECTOR
|
|
155
|
+
* named a deleted node, and re-clicking the selected release would have
|
|
156
|
+
* fixed it in one line. A broken locator is not a usability finding.
|
|
157
|
+
*
|
|
158
|
+
* The reasons that hold:
|
|
159
|
+
*
|
|
160
|
+
* - re-click-to-deselect is counter-conventional, not merely quiet - in a
|
|
161
|
+
* native `select` and in almost every combobox, clicking the chosen
|
|
162
|
+
* option confirms and closes;
|
|
163
|
+
* - "Reset filters" is all or nothing, and there is no per-filter escape;
|
|
164
|
+
* - it costs nothing at rest, which the first case below pins.
|
|
165
|
+
*
|
|
166
|
+
* The last case pins the asymmetry rather than hiding it: `deselectable` is
|
|
167
|
+
* `clearable || !meta.required`, so optional fields accept re-click and
|
|
168
|
+
* show no `x`. `clearable` is the caller saying empty is worth ADVERTISING.
|
|
169
|
+
*/
|
|
170
|
+
describe("the clear button", () => {
|
|
171
|
+
it("appears only once something is chosen", async () => {
|
|
172
|
+
const alepha = await start();
|
|
173
|
+
const ui = mount(alepha, <Probe count={5} clearable />);
|
|
174
|
+
|
|
175
|
+
// Nothing selected: the trigger already says "All tags", so an `x`
|
|
176
|
+
// beside it would offer to reach the state it is in.
|
|
177
|
+
expect(clearButton(ui)).toBeNull();
|
|
178
|
+
|
|
179
|
+
trigger(ui).click();
|
|
180
|
+
fireEvent.click(await ui.findByRole("option", { name: "tag-2" }));
|
|
181
|
+
|
|
182
|
+
await waitFor(() => expect(clearButton(ui)).not.toBeNull());
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("puts the field back to its clear label", async () => {
|
|
186
|
+
const alepha = await start();
|
|
187
|
+
const ui = mount(alepha, <Probe count={5} clearable />);
|
|
188
|
+
|
|
189
|
+
trigger(ui).click();
|
|
190
|
+
fireEvent.click(await ui.findByRole("option", { name: "tag-2" }));
|
|
191
|
+
await waitFor(() => expect(trigger(ui).textContent).toContain("tag-2"));
|
|
192
|
+
|
|
193
|
+
fireEvent.click(clearButton(ui)!);
|
|
194
|
+
|
|
195
|
+
await waitFor(() => {
|
|
196
|
+
expect(trigger(ui).textContent).toContain("All tags");
|
|
197
|
+
});
|
|
198
|
+
// Reads as a placeholder again, not as a value called "All tags".
|
|
199
|
+
expect(readsAsPlaceholder(trigger(ui))).toBe(true);
|
|
200
|
+
expect(clearButton(ui)).toBeNull();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("stays off a field that never asked for one", async () => {
|
|
204
|
+
const alepha = await start();
|
|
205
|
+
// Not `clearable`: an ordinary optional field keeps the trigger it
|
|
206
|
+
// has, and clears by re-pressing its row like it always could.
|
|
207
|
+
const ui = mount(alepha, <Probe count={5} />);
|
|
208
|
+
|
|
209
|
+
trigger(ui).click();
|
|
210
|
+
fireEvent.click(await ui.findByRole("option", { name: "tag-2" }));
|
|
211
|
+
await waitFor(() => expect(trigger(ui).textContent).toContain("tag-2"));
|
|
212
|
+
|
|
213
|
+
expect(clearButton(ui)).toBeNull();
|
|
214
|
+
});
|
|
215
|
+
});
|
|
102
216
|
});
|