@alepha/ui 0.27.1 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/account-layout.d.ts.map +1 -1
- package/dist/components/account/account-layout.js +8 -2
- package/dist/components/account/account-layout.js.map +1 -1
- package/dist/components/admin/admin-analytics.d.ts +34 -5
- package/dist/components/admin/admin-analytics.d.ts.map +1 -1
- package/dist/components/admin/admin-analytics.js +69 -51
- package/dist/components/admin/admin-analytics.js.map +1 -1
- package/dist/components/admin/admin-audits.d.ts +14 -0
- package/dist/components/admin/admin-audits.d.ts.map +1 -1
- package/dist/components/admin/admin-audits.js +35 -8
- 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 +2 -1
- package/dist/components/admin/admin-files.js.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.js +1 -1
- package/dist/components/admin/admin-jobs.js +1 -1
- package/dist/components/admin/admin-keys.d.ts.map +1 -1
- package/dist/components/admin/admin-keys.js +2 -1
- package/dist/components/admin/admin-keys.js.map +1 -1
- package/dist/components/admin/admin-notifications.js +1 -1
- package/dist/components/admin/admin-parameters.d.ts.map +1 -1
- package/dist/components/admin/admin-parameters.js +108 -14
- package/dist/components/admin/admin-parameters.js.map +1 -1
- package/dist/components/admin/admin-payments.js +1 -1
- package/dist/components/admin/admin-sessions.d.ts.map +1 -1
- package/dist/components/admin/admin-sessions.js +126 -4
- package/dist/components/admin/admin-sessions.js.map +1 -1
- package/dist/components/admin/admin-user-avatar-control.d.ts +24 -0
- package/dist/components/admin/admin-user-avatar-control.d.ts.map +1 -0
- package/dist/components/admin/admin-user-avatar-control.js +84 -0
- package/dist/components/admin/admin-user-avatar-control.js.map +1 -0
- package/dist/components/admin/admin-user-detail.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail.js +13 -2
- package/dist/components/admin/admin-user-detail.js.map +1 -1
- package/dist/components/admin/admin-users.js +1 -1
- package/dist/components/admin/admin-workflows.js +1 -1
- package/dist/components/admin/analytics/AdvancedSection.d.ts +26 -0
- package/dist/components/admin/analytics/AdvancedSection.d.ts.map +1 -0
- package/dist/components/admin/analytics/AdvancedSection.js +143 -0
- package/dist/components/admin/analytics/AdvancedSection.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChart.d.ts +20 -0
- package/dist/components/admin/analytics/AnalyticsChart.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChart.js +60 -0
- package/dist/components/admin/analytics/AnalyticsChart.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartBars.d.ts +19 -0
- package/dist/components/admin/analytics/AnalyticsChartBars.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartBars.js +42 -0
- package/dist/components/admin/analytics/AnalyticsChartBars.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartDonut.d.ts +11 -0
- package/dist/components/admin/analytics/AnalyticsChartDonut.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartDonut.js +78 -0
- package/dist/components/admin/analytics/AnalyticsChartDonut.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartHeader.d.ts +20 -0
- package/dist/components/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartHeader.js +105 -0
- package/dist/components/admin/analytics/AnalyticsChartHeader.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartHeat.d.ts +10 -0
- package/dist/components/admin/analytics/AnalyticsChartHeat.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartHeat.js +58 -0
- package/dist/components/admin/analytics/AnalyticsChartHeat.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartLegend.d.ts +9 -0
- package/dist/components/admin/analytics/AnalyticsChartLegend.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartLegend.js +21 -0
- package/dist/components/admin/analytics/AnalyticsChartLegend.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartLine.d.ts +13 -0
- package/dist/components/admin/analytics/AnalyticsChartLine.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartLine.js +36 -0
- package/dist/components/admin/analytics/AnalyticsChartLine.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartRank.d.ts +13 -0
- package/dist/components/admin/analytics/AnalyticsChartRank.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartRank.js +41 -0
- package/dist/components/admin/analytics/AnalyticsChartRank.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartTicks.d.ts +13 -0
- package/dist/components/admin/analytics/AnalyticsChartTicks.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsChartTicks.js +26 -0
- package/dist/components/admin/analytics/AnalyticsChartTicks.js.map +1 -0
- package/dist/components/admin/analytics/AnalyticsEmpty.d.ts +16 -0
- package/dist/components/admin/analytics/AnalyticsEmpty.d.ts.map +1 -0
- package/dist/components/admin/analytics/AnalyticsEmpty.js +32 -0
- package/dist/components/admin/analytics/AnalyticsEmpty.js.map +1 -0
- package/dist/components/admin/analytics/ClauseLabel.d.ts +15 -0
- package/dist/components/admin/analytics/ClauseLabel.d.ts.map +1 -0
- package/dist/components/admin/analytics/ClauseLabel.js +19 -0
- package/dist/components/admin/analytics/ClauseLabel.js.map +1 -0
- package/dist/components/admin/analytics/CompareNote.d.ts +16 -0
- package/dist/components/admin/analytics/CompareNote.d.ts.map +1 -0
- package/dist/components/admin/analytics/CompareNote.js +33 -0
- package/dist/components/admin/analytics/CompareNote.js.map +1 -0
- package/dist/components/admin/analytics/DatasetSelect.d.ts +20 -0
- package/dist/components/admin/analytics/DatasetSelect.d.ts.map +1 -0
- package/dist/components/admin/analytics/DatasetSelect.js +63 -0
- package/dist/components/admin/analytics/DatasetSelect.js.map +1 -0
- package/dist/components/admin/analytics/FilterEditor.d.ts +24 -0
- package/dist/components/admin/analytics/FilterEditor.d.ts.map +1 -0
- package/dist/components/admin/analytics/FilterEditor.js +129 -0
- package/dist/components/admin/analytics/FilterEditor.js.map +1 -0
- package/dist/components/admin/analytics/FilterValuePicker.d.ts +19 -0
- package/dist/components/admin/analytics/FilterValuePicker.d.ts.map +1 -0
- package/dist/components/admin/analytics/FilterValuePicker.js +131 -0
- package/dist/components/admin/analytics/FilterValuePicker.js.map +1 -0
- package/dist/components/admin/analytics/GroupByChips.d.ts +26 -0
- package/dist/components/admin/analytics/GroupByChips.d.ts.map +1 -0
- package/dist/components/admin/analytics/GroupByChips.js +71 -0
- package/dist/components/admin/analytics/GroupByChips.js.map +1 -0
- package/dist/components/admin/analytics/MeasureChips.d.ts +18 -0
- package/dist/components/admin/analytics/MeasureChips.d.ts.map +1 -0
- package/dist/components/admin/analytics/MeasureChips.js +46 -0
- package/dist/components/admin/analytics/MeasureChips.js.map +1 -0
- package/dist/components/admin/analytics/QueryPanel.d.ts +27 -0
- package/dist/components/admin/analytics/QueryPanel.d.ts.map +1 -0
- package/dist/components/admin/analytics/QueryPanel.js +92 -0
- package/dist/components/admin/analytics/QueryPanel.js.map +1 -0
- package/dist/components/admin/analytics/RangeControl.d.ts +17 -0
- package/dist/components/admin/analytics/RangeControl.d.ts.map +1 -0
- package/dist/components/admin/analytics/RangeControl.js +43 -0
- package/dist/components/admin/analytics/RangeControl.js.map +1 -0
- package/dist/components/admin/analytics/RequestDialog.d.ts +24 -0
- package/dist/components/admin/analytics/RequestDialog.d.ts.map +1 -0
- package/dist/components/admin/analytics/RequestDialog.js +67 -0
- package/dist/components/admin/analytics/RequestDialog.js.map +1 -0
- package/dist/components/admin/analytics/ResultsPane.d.ts +15 -0
- package/dist/components/admin/analytics/ResultsPane.d.ts.map +1 -0
- package/dist/components/admin/analytics/ResultsPane.js +161 -0
- package/dist/components/admin/analytics/ResultsPane.js.map +1 -0
- package/dist/components/admin/analytics/ResultsTable.d.ts +17 -0
- package/dist/components/admin/analytics/ResultsTable.d.ts.map +1 -0
- package/dist/components/admin/analytics/ResultsTable.js +113 -0
- package/dist/components/admin/analytics/ResultsTable.js.map +1 -0
- package/dist/components/admin/analytics/RunFooter.d.ts +18 -0
- package/dist/components/admin/analytics/RunFooter.d.ts.map +1 -0
- package/dist/components/admin/analytics/RunFooter.js +78 -0
- package/dist/components/admin/analytics/RunFooter.js.map +1 -0
- package/dist/components/admin/analytics/SamplingBadge.d.ts +18 -0
- package/dist/components/admin/analytics/SamplingBadge.d.ts.map +1 -0
- package/dist/components/admin/analytics/SamplingBadge.js +35 -0
- package/dist/components/admin/analytics/SamplingBadge.js.map +1 -0
- package/dist/components/admin/analytics/ToggleChip.d.ts +28 -0
- package/dist/components/admin/analytics/ToggleChip.d.ts.map +1 -0
- package/dist/components/admin/analytics/ToggleChip.js +35 -0
- package/dist/components/admin/analytics/ToggleChip.js.map +1 -0
- package/dist/components/admin/analytics/TotalsCards.d.ts +19 -0
- package/dist/components/admin/analytics/TotalsCards.d.ts.map +1 -0
- package/dist/components/admin/analytics/TotalsCards.js +75 -0
- package/dist/components/admin/analytics/TotalsCards.js.map +1 -0
- package/dist/components/admin/analytics/TruncationBanner.d.ts +15 -0
- package/dist/components/admin/analytics/TruncationBanner.d.ts.map +1 -0
- package/dist/components/admin/analytics/TruncationBanner.js +52 -0
- package/dist/components/admin/analytics/TruncationBanner.js.map +1 -0
- package/dist/components/admin/analytics/analyticsModel.d.ts +98 -0
- package/dist/components/admin/analytics/analyticsModel.d.ts.map +1 -0
- package/dist/components/admin/analytics/analyticsModel.js +184 -0
- package/dist/components/admin/analytics/analyticsModel.js.map +1 -0
- package/dist/components/admin/analytics/analyticsTypes.d.ts +116 -0
- package/dist/components/admin/analytics/analyticsTypes.d.ts.map +1 -0
- package/dist/components/admin/analytics/analyticsTypes.js +0 -0
- package/dist/components/admin/analytics/chartModel.d.ts +149 -0
- package/dist/components/admin/analytics/chartModel.d.ts.map +1 -0
- package/dist/components/admin/analytics/chartModel.js +278 -0
- package/dist/components/admin/analytics/chartModel.js.map +1 -0
- package/dist/components/admin/analytics/useAnalyticsQuery.d.ts +62 -0
- package/dist/components/admin/analytics/useAnalyticsQuery.d.ts.map +1 -0
- package/dist/components/admin/analytics/useAnalyticsQuery.js +257 -0
- package/dist/components/admin/analytics/useAnalyticsQuery.js.map +1 -0
- package/dist/components/admin/analytics/useDismissable.d.ts +18 -0
- package/dist/components/admin/analytics/useDismissable.d.ts.map +1 -0
- package/dist/components/admin/analytics/useDismissable.js +37 -0
- package/dist/components/admin/analytics/useDismissable.js.map +1 -0
- package/dist/components/admin/analytics/useFilterValues.d.ts +37 -0
- package/dist/components/admin/analytics/useFilterValues.d.ts.map +1 -0
- package/dist/components/admin/analytics/useFilterValues.js +78 -0
- package/dist/components/admin/analytics/useFilterValues.js.map +1 -0
- package/dist/components/admin/analytics/usePanelWidth.d.ts +26 -0
- package/dist/components/admin/analytics/usePanelWidth.d.ts.map +1 -0
- package/dist/components/admin/analytics/usePanelWidth.js +61 -0
- package/dist/components/admin/analytics/usePanelWidth.js.map +1 -0
- package/dist/components/admin/analytics/useShapeLabels.d.ts +24 -0
- package/dist/components/admin/analytics/useShapeLabels.d.ts.map +1 -0
- package/dist/components/admin/analytics/useShapeLabels.js +41 -0
- package/dist/components/admin/analytics/useShapeLabels.js.map +1 -0
- package/dist/components/alepha-table/alepha-table-bulk-menu.d.ts +22 -0
- package/dist/components/alepha-table/alepha-table-bulk-menu.d.ts.map +1 -0
- package/dist/components/alepha-table/alepha-table-bulk-menu.js +117 -0
- package/dist/components/alepha-table/alepha-table-bulk-menu.js.map +1 -0
- package/dist/components/alepha-table/alepha-table.d.ts +148 -13
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
- package/dist/components/alepha-table/alepha-table.js +84 -17
- package/dist/components/alepha-table/alepha-table.js.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +30 -11
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.js +75 -67
- package/dist/components/app-shell/app-shell.js.map +1 -1
- package/dist/components/app-shell/navigation-progress.d.ts +40 -0
- package/dist/components/app-shell/navigation-progress.d.ts.map +1 -0
- package/dist/components/app-shell/navigation-progress.js +86 -0
- package/dist/components/app-shell/navigation-progress.js.map +1 -0
- package/dist/components/auth/auth-register.d.ts +35 -0
- package/dist/components/auth/auth-register.d.ts.map +1 -1
- package/dist/components/auth/auth-register.js +12 -8
- package/dist/components/auth/auth-register.js.map +1 -1
- package/dist/components/auto-form/auto-form.js +20 -17
- package/dist/components/auto-form/auto-form.js.map +1 -1
- package/dist/components/control/control.d.ts +39 -10
- package/dist/components/control/control.d.ts.map +1 -1
- package/dist/components/control/control.js +10 -4
- package/dist/components/control/control.js.map +1 -1
- package/dist/components/control-date/control-date.d.ts +8 -0
- package/dist/components/control-date/control-date.d.ts.map +1 -1
- package/dist/components/control-date/control-date.js +25 -9
- package/dist/components/control-date/control-date.js.map +1 -1
- package/dist/components/control-select/control-select.d.ts +57 -6
- package/dist/components/control-select/control-select.d.ts.map +1 -1
- package/dist/components/control-select/control-select.js +112 -32
- package/dist/components/control-select/control-select.js.map +1 -1
- package/dist/components/detail/detail-layout.d.ts.map +1 -1
- package/dist/components/detail/detail-layout.js +9 -6
- package/dist/components/detail/detail-layout.js.map +1 -1
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/MermaidFence.js +1 -15
- package/dist/components/markdown-view/diagram/MermaidFence.js.map +1 -1
- package/dist/components/markdown-view/diagram/diagramKind.d.ts +18 -0
- package/dist/components/markdown-view/diagram/diagramKind.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/diagramKind.js +27 -0
- package/dist/components/markdown-view/diagram/diagramKind.js.map +1 -0
- package/dist/components/plate-layout/plate-layout.d.ts +50 -0
- package/dist/components/plate-layout/plate-layout.d.ts.map +1 -0
- package/dist/components/plate-layout/plate-layout.js +37 -0
- package/dist/components/plate-layout/plate-layout.js.map +1 -0
- package/dist/components/plate-layout/plate-tab-bar.d.ts +55 -0
- package/dist/components/plate-layout/plate-tab-bar.d.ts.map +1 -0
- package/dist/components/plate-layout/plate-tab-bar.js +52 -0
- package/dist/components/plate-layout/plate-tab-bar.js.map +1 -0
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/use-dialog/use-dialog.d.ts +7 -0
- package/dist/components/use-dialog/use-dialog.d.ts.map +1 -1
- package/dist/components/use-dialog/use-dialog.js +10 -1
- package/dist/components/use-dialog/use-dialog.js.map +1 -1
- package/dist/lib/i18n-fr.d.ts.map +1 -1
- package/dist/lib/i18n-fr.js +110 -7
- package/dist/lib/i18n-fr.js.map +1 -1
- package/dist/styles.css +45 -21
- package/package.json +9 -8
- package/src/components/account/__tests__/account-layout.browser.spec.tsx +127 -0
- package/src/components/account/account-layout.tsx +32 -2
- package/src/components/admin/__tests__/admin-audits-action-filter.browser.spec.tsx +53 -0
- package/src/components/admin/admin-analytics.tsx +97 -83
- package/src/components/admin/admin-audits.tsx +50 -8
- package/src/components/admin/admin-files.tsx +3 -0
- package/src/components/admin/admin-keys.tsx +2 -0
- package/src/components/admin/admin-parameters.tsx +165 -12
- package/src/components/admin/admin-sessions.tsx +164 -4
- package/src/components/admin/admin-user-avatar-control.tsx +130 -0
- package/src/components/admin/admin-user-detail.tsx +25 -3
- package/src/components/admin/analytics/AdvancedSection.tsx +162 -0
- package/src/components/admin/analytics/AnalyticsChart.tsx +69 -0
- package/src/components/admin/analytics/AnalyticsChartBars.tsx +86 -0
- package/src/components/admin/analytics/AnalyticsChartDonut.tsx +78 -0
- package/src/components/admin/analytics/AnalyticsChartHeader.tsx +135 -0
- package/src/components/admin/analytics/AnalyticsChartHeat.tsx +57 -0
- package/src/components/admin/analytics/AnalyticsChartLegend.tsx +26 -0
- package/src/components/admin/analytics/AnalyticsChartLine.tsx +37 -0
- package/src/components/admin/analytics/AnalyticsChartRank.tsx +43 -0
- package/src/components/admin/analytics/AnalyticsChartTicks.tsx +38 -0
- package/src/components/admin/analytics/AnalyticsEmpty.tsx +37 -0
- package/src/components/admin/analytics/ClauseLabel.tsx +26 -0
- package/src/components/admin/analytics/CompareNote.tsx +50 -0
- package/src/components/admin/analytics/DatasetSelect.tsx +79 -0
- package/src/components/admin/analytics/FilterEditor.tsx +173 -0
- package/src/components/admin/analytics/FilterValuePicker.tsx +154 -0
- package/src/components/admin/analytics/GroupByChips.tsx +82 -0
- package/src/components/admin/analytics/MeasureChips.tsx +53 -0
- package/src/components/admin/analytics/QueryPanel.tsx +113 -0
- package/src/components/admin/analytics/RangeControl.tsx +42 -0
- package/src/components/admin/analytics/RequestDialog.tsx +91 -0
- package/src/components/admin/analytics/ResultsPane.tsx +224 -0
- package/src/components/admin/analytics/ResultsTable.tsx +176 -0
- package/src/components/admin/analytics/RunFooter.tsx +90 -0
- package/src/components/admin/analytics/SamplingBadge.tsx +46 -0
- package/src/components/admin/analytics/ToggleChip.tsx +57 -0
- package/src/components/admin/analytics/TotalsCards.tsx +79 -0
- package/src/components/admin/analytics/TruncationBanner.tsx +60 -0
- package/src/components/admin/analytics/analyticsModel.spec.ts +266 -0
- package/src/components/admin/analytics/analyticsModel.ts +263 -0
- package/src/components/admin/analytics/analyticsTypes.ts +139 -0
- package/src/components/admin/analytics/chartModel.spec.ts +240 -0
- package/src/components/admin/analytics/chartModel.ts +427 -0
- package/src/components/admin/analytics/useAnalyticsQuery.ts +401 -0
- package/src/components/admin/analytics/useDismissable.ts +48 -0
- package/src/components/admin/analytics/useFilterValues.ts +113 -0
- package/src/components/admin/analytics/usePanelWidth.ts +85 -0
- package/src/components/admin/analytics/useShapeLabels.ts +73 -0
- package/src/components/alepha-table/__tests__/alepha-table-actions.browser.spec.tsx +117 -0
- package/src/components/alepha-table/__tests__/alepha-table-bulk-menu.browser.spec.tsx +177 -0
- package/src/components/alepha-table/__tests__/alepha-table-bulk-visible.browser.spec.tsx +125 -0
- package/src/components/alepha-table/alepha-table-bulk-menu.tsx +170 -0
- package/src/components/alepha-table/alepha-table.tsx +294 -55
- package/src/components/app-shell/__tests__/navigation-progress.browser.spec.tsx +122 -0
- package/src/components/app-shell/__tests__/sidebar-nav-auto-close.browser.spec.tsx +170 -0
- package/src/components/app-shell/app-shell.tsx +135 -110
- package/src/components/app-shell/navigation-progress.tsx +110 -0
- package/src/components/auth/auth-register.tsx +72 -9
- package/src/components/auto-form/__tests__/auto-form-fill-groups.browser.spec.tsx +104 -0
- package/src/components/auto-form/auto-form.tsx +13 -3
- package/src/components/control/control.tsx +63 -14
- package/src/components/control-date/control-date.tsx +55 -16
- package/src/components/control-select/__tests__/control-select-multi.browser.spec.tsx +196 -0
- package/src/components/control-select/__tests__/control-select-searchable.browser.spec.tsx +5 -1
- package/src/components/control-select/__tests__/control-select-size-minimal.browser.spec.tsx +119 -0
- package/src/components/control-select/__tests__/control-select-trigger-props.browser.spec.tsx +89 -0
- package/src/components/control-select/control-select.tsx +294 -97
- package/src/components/detail/__tests__/detail-layout.browser.spec.tsx +46 -0
- package/src/components/detail/detail-layout.tsx +37 -7
- package/src/components/markdown-view/diagram/MermaidFence.tsx +1 -23
- package/src/components/markdown-view/diagram/diagramKind.ts +31 -0
- package/src/components/plate-layout/__tests__/plate-layout.browser.spec.tsx +167 -0
- package/src/components/plate-layout/plate-layout.tsx +78 -0
- package/src/components/plate-layout/plate-tab-bar.tsx +122 -0
- package/src/components/ui/button.tsx +1 -1
- package/src/components/use-dialog/use-dialog.tsx +10 -0
- package/src/lib/i18n-fr.ts +121 -7
- package/src/styles.css +45 -21
- package/dist/components/admin/admin-analytics-query-panel.d.ts +0 -16
- package/dist/components/admin/admin-analytics-query-panel.d.ts.map +0 -1
- package/dist/components/admin/admin-analytics-query-panel.js +0 -117
- package/dist/components/admin/admin-analytics-query-panel.js.map +0 -1
- package/dist/components/admin/admin-analytics-results.d.ts +0 -15
- package/dist/components/admin/admin-analytics-results.d.ts.map +0 -1
- package/dist/components/admin/admin-analytics-results.js +0 -56
- package/dist/components/admin/admin-analytics-results.js.map +0 -1
- package/src/components/admin/admin-analytics-query-panel.tsx +0 -150
- package/src/components/admin/admin-analytics-results.tsx +0 -95
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
|
|
3
3
|
void React;
|
|
4
4
|
|
|
5
|
+
import { Control } from "@alepha/ui/components/control/control";
|
|
5
6
|
import { Button } from "@alepha/ui/components/ui/button";
|
|
6
7
|
import { Checkbox } from "@alepha/ui/components/ui/checkbox";
|
|
7
8
|
import {
|
|
@@ -23,13 +24,6 @@ import {
|
|
|
23
24
|
PaginationNext,
|
|
24
25
|
PaginationPrevious,
|
|
25
26
|
} from "@alepha/ui/components/ui/pagination";
|
|
26
|
-
import {
|
|
27
|
-
Select,
|
|
28
|
-
SelectContent,
|
|
29
|
-
SelectItem,
|
|
30
|
-
SelectTrigger,
|
|
31
|
-
SelectValue,
|
|
32
|
-
} from "@alepha/ui/components/ui/select";
|
|
33
27
|
import { Skeleton } from "@alepha/ui/components/ui/skeleton";
|
|
34
28
|
import {
|
|
35
29
|
Table,
|
|
@@ -72,6 +66,7 @@ import {
|
|
|
72
66
|
useState,
|
|
73
67
|
} from "react";
|
|
74
68
|
|
|
69
|
+
import { AlephaTableBulkMenu } from "./alepha-table-bulk-menu.tsx";
|
|
75
70
|
import { paginateLocal } from "./paginate-local.ts";
|
|
76
71
|
import { useTableSelection } from "./use-table-selection.ts";
|
|
77
72
|
|
|
@@ -134,25 +129,110 @@ export interface BulkActionContext {
|
|
|
134
129
|
clearSelection: () => void;
|
|
135
130
|
}
|
|
136
131
|
|
|
132
|
+
/**
|
|
133
|
+
* A bulk action that is a button: one click, one handler over the selection.
|
|
134
|
+
*/
|
|
137
135
|
export interface BulkAction<T> {
|
|
138
136
|
label: string;
|
|
139
137
|
icon?: IconType;
|
|
140
138
|
onClick: (selected: T[], ctx: BulkActionContext) => void | Promise<void>;
|
|
141
139
|
destructive?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the action is offered for this selection. Absent means always.
|
|
142
|
+
*
|
|
143
|
+
* Hide, not disable: a disabled button in a three-item pill is a question
|
|
144
|
+
* ("why can't I?"), a missing one is an answer. An action that applies to
|
|
145
|
+
* some of the rows and not others should stay visible and act on the rows
|
|
146
|
+
* it fits, which is what its `onClick` receives the whole selection for.
|
|
147
|
+
*/
|
|
148
|
+
visible?: (selected: T[]) => boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* A bulk action that is a MENU: the trigger opens a list of choices, each of
|
|
153
|
+
* them a {@link BulkAction} in its own right, and picking one runs its
|
|
154
|
+
* `onClick` over the selection. For "add to release", "move to column",
|
|
155
|
+
* "assign to": one button cannot carry N targets, and the targets are not
|
|
156
|
+
* known when the table renders.
|
|
157
|
+
*
|
|
158
|
+
* `items` produces the choices, synchronously or not. It is called on open
|
|
159
|
+
* intent (pointer enter, focus, or the menu opening, so keyboard and touch
|
|
160
|
+
* are covered) and its result is kept for the life of the selection: a new
|
|
161
|
+
* selection asks again. Both the pending and the failed state are shown
|
|
162
|
+
* inside the menu, and an empty result renders a disabled "nothing to pick"
|
|
163
|
+
* row rather than an empty popup.
|
|
164
|
+
*
|
|
165
|
+
* A union with {@link BulkAction} rather than an optional `items` on it, so
|
|
166
|
+
* a button cannot also be a menu and a menu cannot also be clicked: the two
|
|
167
|
+
* are told apart by `items` being present.
|
|
168
|
+
*
|
|
169
|
+
* ```tsx
|
|
170
|
+
* const addToRelease: BulkMenuAction<Quest> = {
|
|
171
|
+
* label: "Add to release",
|
|
172
|
+
* icon: Flag,
|
|
173
|
+
* // The closure carries the target, so no item type needs a payload.
|
|
174
|
+
* items: () =>
|
|
175
|
+
* releases
|
|
176
|
+
* .filter((release) => !release.releasedAt)
|
|
177
|
+
* .map((release) => ({
|
|
178
|
+
* label: release.tag,
|
|
179
|
+
* onClick: async (quests, ctx) => {
|
|
180
|
+
* await Promise.all(
|
|
181
|
+
* quests.map((quest) => attach(quest.id, release.id)),
|
|
182
|
+
* );
|
|
183
|
+
* ctx.refresh();
|
|
184
|
+
* ctx.clearSelection();
|
|
185
|
+
* },
|
|
186
|
+
* })),
|
|
187
|
+
* };
|
|
188
|
+
*
|
|
189
|
+
* <AlephaTable<Quest> bulkActions={[shelve, addToRelease]} />
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export interface BulkMenuAction<T> {
|
|
193
|
+
label: string;
|
|
194
|
+
icon?: IconType;
|
|
195
|
+
/**
|
|
196
|
+
* Same contract as {@link BulkAction.visible}.
|
|
197
|
+
*/
|
|
198
|
+
visible?: (selected: T[]) => boolean;
|
|
199
|
+
/**
|
|
200
|
+
* The choices, produced when the menu is about to open. An async producer
|
|
201
|
+
* shows a loading row until it settles; a rejection shows a failure row and
|
|
202
|
+
* the next open tries again.
|
|
203
|
+
*/
|
|
204
|
+
items: () => BulkAction<T>[] | Promise<BulkAction<T>[]>;
|
|
142
205
|
}
|
|
143
206
|
|
|
144
207
|
/**
|
|
145
|
-
* A standalone toolbar
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
208
|
+
* A standalone toolbar action, rendered in the right-hand icon group next to
|
|
209
|
+
* the column picker and separated from the filter area by a divider. Use for
|
|
210
|
+
* table-scoped actions (e.g. "Upload", "New") that aren't tied to a row or a
|
|
211
|
+
* selection.
|
|
212
|
+
*
|
|
213
|
+
* Two forms, chosen per action:
|
|
214
|
+
*
|
|
215
|
+
* - **secondary** (the default): a ghost icon button with the label as its
|
|
216
|
+
* tooltip, matching the built-in column-picker / refresh controls.
|
|
217
|
+
* - **primary** (`primary: true`): a solid `default` button carrying the icon
|
|
218
|
+
* AND the visible label. For the page's one main action, typically its
|
|
219
|
+
* create control: a bare `+` at the same weight as two utility toggles
|
|
220
|
+
* disappears, and the create button is what a reader looks for first.
|
|
221
|
+
* No tooltip, since the label is already on screen. Below the `sm`
|
|
222
|
+
* breakpoint the label collapses to the icon and the button keeps its
|
|
223
|
+
* primary colour, so it still reads as the action.
|
|
150
224
|
*/
|
|
151
225
|
export interface TableAction {
|
|
152
226
|
icon: IconType;
|
|
153
227
|
label: string;
|
|
154
228
|
onClick: () => void;
|
|
155
229
|
disabled?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Render as the table's primary action: a solid labelled button rather
|
|
232
|
+
* than a ghost icon. One per table is the intent; a toolbar with two
|
|
233
|
+
* primary buttons has no primary action.
|
|
234
|
+
*/
|
|
235
|
+
primary?: boolean;
|
|
156
236
|
}
|
|
157
237
|
|
|
158
238
|
/**
|
|
@@ -250,6 +330,53 @@ export type AlephaTableSource<T> =
|
|
|
250
330
|
export type AlephaTableProps<T> = AlephaTableBaseProps<T> &
|
|
251
331
|
AlephaTableSource<T>;
|
|
252
332
|
|
|
333
|
+
/**
|
|
334
|
+
* ⚠️ **A page-level action goes INSIDE the table, not above it.**
|
|
335
|
+
*
|
|
336
|
+
* AlephaTable owns a toolbar, and that toolbar is the page's action bar. A
|
|
337
|
+
* "New" button, a picker, an import, an export all belong in it. Putting one
|
|
338
|
+
* in a `CardHeader` above the table produces two stacked bars saying one
|
|
339
|
+
* thing - which is exactly what the epic page's Quests tab looked like until
|
|
340
|
+
* feedback #2006, a hand-rolled header holding a title and an "Attach Quest"
|
|
341
|
+
* button, sitting directly on top of a toolbar holding the column picker and
|
|
342
|
+
* refresh.
|
|
343
|
+
*
|
|
344
|
+
* The rule is written here rather than only on the props because this is
|
|
345
|
+
* where a reader - human or agent - looks first, and the drift comes from
|
|
346
|
+
* not knowing the slot exists rather than from choosing against it.
|
|
347
|
+
*
|
|
348
|
+
* Three slots, and which one is a question about the control, not the action:
|
|
349
|
+
*
|
|
350
|
+
* - `actions` - a button that does something on click. Rendered in the
|
|
351
|
+
* right-hand icon group beside the column picker: a ghost icon with a
|
|
352
|
+
* tooltip from its own `label`, or, with `primary: true`, a solid button
|
|
353
|
+
* showing the label. The page's create action is the `primary` one.
|
|
354
|
+
* - `toolbar` - anything else: a labelled button, a popover trigger, a
|
|
355
|
+
* segmented control, a group of them. Rendered to the right of the filter
|
|
356
|
+
* inputs and vertically centred, so it does not have to match their height.
|
|
357
|
+
* - `bulkActions` - operates on the checkbox selection, and only appears
|
|
358
|
+
* while something is selected. A button, or a menu of them resolved on
|
|
359
|
+
* demand (`BulkMenuAction`, for "add to release" and its kind).
|
|
360
|
+
*
|
|
361
|
+
* ```tsx
|
|
362
|
+
* <AlephaTable<Quest>
|
|
363
|
+
* data={quests}
|
|
364
|
+
* columns={columns}
|
|
365
|
+
* // A popover trigger: `toolbar`, because it is not an icon button.
|
|
366
|
+
* toolbar={<QuestPicker onAttach={attach} />}
|
|
367
|
+
* // Buttons that act on click: `actions`. The create control is `primary`.
|
|
368
|
+
* actions={[
|
|
369
|
+
* { icon: Plus, label: "New quest", primary: true, onClick: create },
|
|
370
|
+
* { icon: Download, label: "Export", onClick: exportAll },
|
|
371
|
+
* ]}
|
|
372
|
+
* />
|
|
373
|
+
* ```
|
|
374
|
+
*
|
|
375
|
+
* The exception is a control that LEAVES the page - a back link, a tab bar,
|
|
376
|
+
* breadcrumbs. Those are navigation, not actions on this table, and belong
|
|
377
|
+
* where the page's other navigation is.
|
|
378
|
+
*/
|
|
379
|
+
|
|
253
380
|
export interface AlephaTableBaseProps<T> {
|
|
254
381
|
/**
|
|
255
382
|
* Column definitions, keyed by the property name they read from.
|
|
@@ -261,10 +388,12 @@ export interface AlephaTableBaseProps<T> {
|
|
|
261
388
|
*/
|
|
262
389
|
rowActions?: (item: T) => RowAction<T>[];
|
|
263
390
|
/**
|
|
264
|
-
* Actions applied to selected rows (enables checkbox column).
|
|
265
|
-
*
|
|
391
|
+
* Actions applied to selected rows (enables checkbox column). A
|
|
392
|
+
* {@link BulkAction} is a button whose `onClick` receives
|
|
393
|
+
* `(items, { refresh, clearSelection })`; a {@link BulkMenuAction} is a
|
|
394
|
+
* button that opens a menu of such actions, produced on demand.
|
|
266
395
|
*/
|
|
267
|
-
bulkActions?: BulkAction<T>
|
|
396
|
+
bulkActions?: Array<BulkAction<T> | BulkMenuAction<T>>;
|
|
268
397
|
/**
|
|
269
398
|
* Page size the table opens on. The reader can change it from the footer;
|
|
270
399
|
* with `persistenceKey` set, their choice is remembered and wins over this.
|
|
@@ -337,7 +466,9 @@ export interface AlephaTableBaseProps<T> {
|
|
|
337
466
|
hideActionsMenu?: boolean;
|
|
338
467
|
/**
|
|
339
468
|
* Extra slot rendered to the right of the filter inputs in the
|
|
340
|
-
* toolbar — typically a "New" / "Create" button
|
|
469
|
+
* toolbar — typically a "New" / "Create" button, or any page-level action
|
|
470
|
+
* that is not a bare icon button (see the note on `AlephaTableProps`: it
|
|
471
|
+
* belongs here rather than in a header above the table).
|
|
341
472
|
*
|
|
342
473
|
* Vertically centred in the bar (`self-center`) regardless of its own
|
|
343
474
|
* height, so it no longer has to match the filter inputs. It used to inherit
|
|
@@ -346,10 +477,11 @@ export interface AlephaTableBaseProps<T> {
|
|
|
346
477
|
*/
|
|
347
478
|
toolbar?: ReactNode;
|
|
348
479
|
/**
|
|
349
|
-
* Standalone
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
480
|
+
* Standalone actions rendered in the toolbar's right-hand icon group,
|
|
481
|
+
* before the column picker and separated from the filter area by a
|
|
482
|
+
* divider. The table renders the button itself, so callers only supply
|
|
483
|
+
* the icon/label/handler: a ghost icon with a tooltip by default, or a
|
|
484
|
+
* solid labelled button when the action is marked `primary`.
|
|
353
485
|
*/
|
|
354
486
|
actions?: TableAction[];
|
|
355
487
|
/**
|
|
@@ -409,6 +541,50 @@ const readPersisted = <V,>(key: string, suffix: string): V | undefined => {
|
|
|
409
541
|
}
|
|
410
542
|
};
|
|
411
543
|
|
|
544
|
+
/**
|
|
545
|
+
* Reshape persisted filter values that no longer match the schema.
|
|
546
|
+
*
|
|
547
|
+
* Filters are stored in localStorage per `persistenceKey`, so a filter whose
|
|
548
|
+
* shape changes meets values written by the previous shape - on the machine
|
|
549
|
+
* of anyone who has used the page, and only there, which is precisely the
|
|
550
|
+
* class of bug no test environment contains. The first case was the Quests
|
|
551
|
+
* table going from one value per filter to many (quest #1644): a stored
|
|
552
|
+
* `area: "lore/feedback"` reaching an array field.
|
|
553
|
+
*
|
|
554
|
+
* A scalar where the schema now wants an array is WRAPPED, not dropped: the
|
|
555
|
+
* reader's filter survives the change, which is what makes the migration
|
|
556
|
+
* invisible. The reverse takes the first element, since there is no honest
|
|
557
|
+
* way to keep the rest. Anything else is left alone - this reconciles a
|
|
558
|
+
* container, not a value, and the form's own validation still has the last
|
|
559
|
+
* word.
|
|
560
|
+
*/
|
|
561
|
+
const reconcilePersistedFilters = (
|
|
562
|
+
schema: ZObject | undefined,
|
|
563
|
+
values: Record<string, any> | undefined,
|
|
564
|
+
): Record<string, any> | undefined => {
|
|
565
|
+
if (!schema || !values) return values;
|
|
566
|
+
const shape = z.schema.shape(schema);
|
|
567
|
+
const out: Record<string, any> = {};
|
|
568
|
+
for (const [key, value] of Object.entries(values)) {
|
|
569
|
+
const field = shape[key];
|
|
570
|
+
if (!field) {
|
|
571
|
+
// A filter that no longer exists. Dropped rather than passed through,
|
|
572
|
+
// so a removed field cannot reappear in the fetch payload.
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
const wantsArray = z.schema.isArray(z.schema.unwrap(field));
|
|
576
|
+
const isArray = Array.isArray(value);
|
|
577
|
+
if (wantsArray && !isArray) {
|
|
578
|
+
out[key] = value === undefined || value === "" ? [] : [value];
|
|
579
|
+
} else if (!wantsArray && isArray) {
|
|
580
|
+
out[key] = value[0];
|
|
581
|
+
} else {
|
|
582
|
+
out[key] = value;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return out;
|
|
586
|
+
};
|
|
587
|
+
|
|
412
588
|
/**
|
|
413
589
|
* Synchronous localStorage write. Empty objects/null delete the key.
|
|
414
590
|
*/
|
|
@@ -470,7 +646,10 @@ export function AlephaTable<T>(props: AlephaTableProps<T>) {
|
|
|
470
646
|
// useForm captures `initialValues` only once via useMemo.
|
|
471
647
|
const persistedFilterValues = useMemo(() => {
|
|
472
648
|
if (!props.persistenceKey || !props.filters) return undefined;
|
|
473
|
-
return
|
|
649
|
+
return reconcilePersistedFilters(
|
|
650
|
+
props.filters.schema,
|
|
651
|
+
readPersisted<Record<string, any>>(props.persistenceKey, "filters"),
|
|
652
|
+
);
|
|
474
653
|
}, [props.persistenceKey, props.filters]);
|
|
475
654
|
|
|
476
655
|
const mergedFilterInitialValues = useMemo<Record<string, any>>(
|
|
@@ -517,6 +696,26 @@ export function AlephaTable<T>(props: AlephaTableProps<T>) {
|
|
|
517
696
|
writePersisted(props.persistenceKey, "size", next);
|
|
518
697
|
}
|
|
519
698
|
};
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* The footer's page-size picker, as a form of one field.
|
|
702
|
+
*
|
|
703
|
+
* `Control` is form-bound and this picker is not part of any form, which is
|
|
704
|
+
* why the footer stayed on a raw `<Select>` long after everything else here
|
|
705
|
+
* moved. One field is the whole cost of joining, and it buys the picker the
|
|
706
|
+
* same trigger, popup and keyboard handling as every other select in the
|
|
707
|
+
* table. `keepDirty: false` so the re-seed below actually re-seeds: `size`
|
|
708
|
+
* can move without the picker (a persisted value on mount), and a kept
|
|
709
|
+
* "edit" would pin the trigger to a page size the table is not using.
|
|
710
|
+
*/
|
|
711
|
+
const sizeForm = useForm({
|
|
712
|
+
schema: z.object({ size: z.number() }),
|
|
713
|
+
initialValues: { size },
|
|
714
|
+
keepDirty: false,
|
|
715
|
+
handler: async () => {},
|
|
716
|
+
onChange: (_key, next) => changeSize(next as number),
|
|
717
|
+
});
|
|
718
|
+
|
|
520
719
|
const [sort, setSort] = useState<SortState | null>(() => {
|
|
521
720
|
if (props.persistenceKey) {
|
|
522
721
|
const persisted = readPersisted<SortState>(props.persistenceKey, "sort");
|
|
@@ -811,6 +1010,17 @@ export function AlephaTable<T>(props: AlephaTableProps<T>) {
|
|
|
811
1010
|
clearSelection,
|
|
812
1011
|
} = useTableSelection(data, rowKey);
|
|
813
1012
|
|
|
1013
|
+
// The bulk actions offered for THIS selection: an action's `visible`
|
|
1014
|
+
// predicate reads the selected rows. Computed once, here, so the pill's
|
|
1015
|
+
// contents and the pill's own presence come from the same list.
|
|
1016
|
+
const visibleBulkActions = useMemo(
|
|
1017
|
+
() =>
|
|
1018
|
+
(props.bulkActions ?? []).filter(
|
|
1019
|
+
(action) => action.visible?.(selectedItems) ?? true,
|
|
1020
|
+
),
|
|
1021
|
+
[props.bulkActions, selectedItems],
|
|
1022
|
+
);
|
|
1023
|
+
|
|
814
1024
|
// -- Sort ------------------------------------------------------------------
|
|
815
1025
|
|
|
816
1026
|
const toggleSort = (col: string, def: ColumnDef<T>) => {
|
|
@@ -963,6 +1173,28 @@ export function AlephaTable<T>(props: AlephaTableProps<T>) {
|
|
|
963
1173
|
<>
|
|
964
1174
|
{props.actions.map((action) => {
|
|
965
1175
|
const ActionIcon = action.icon;
|
|
1176
|
+
if (action.primary) {
|
|
1177
|
+
// The visible label is the tooltip, so there is
|
|
1178
|
+
// none. `aria-label` keeps the accessible name once
|
|
1179
|
+
// the label collapses below `sm`; `h-9` lines the
|
|
1180
|
+
// button up with the ghost icons beside it.
|
|
1181
|
+
return (
|
|
1182
|
+
<Button
|
|
1183
|
+
key={action.label}
|
|
1184
|
+
type="button"
|
|
1185
|
+
size="sm"
|
|
1186
|
+
className="h-9 px-3"
|
|
1187
|
+
aria-label={action.label}
|
|
1188
|
+
disabled={action.disabled}
|
|
1189
|
+
onClick={action.onClick}
|
|
1190
|
+
>
|
|
1191
|
+
<ActionIcon className="size-4" />
|
|
1192
|
+
<span className="hidden sm:inline">
|
|
1193
|
+
{action.label}
|
|
1194
|
+
</span>
|
|
1195
|
+
</Button>
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
966
1198
|
return (
|
|
967
1199
|
<Tooltip key={action.label}>
|
|
968
1200
|
<TooltipTrigger
|
|
@@ -1057,7 +1289,8 @@ export function AlephaTable<T>(props: AlephaTableProps<T>) {
|
|
|
1057
1289
|
)}
|
|
1058
1290
|
|
|
1059
1291
|
{hasCheckbox &&
|
|
1060
|
-
selection.size > 0 &&
|
|
1292
|
+
selection.size > 0 &&
|
|
1293
|
+
visibleBulkActions.length > 0 && (
|
|
1061
1294
|
// Linear-style floating action pill: fixed at the bottom-center of
|
|
1062
1295
|
// the viewport, dark surface that stays readable in both themes
|
|
1063
1296
|
// because the colors are hard-coded (theme-relative `bg-foreground`
|
|
@@ -1071,7 +1304,17 @@ export function AlephaTable<T>(props: AlephaTableProps<T>) {
|
|
|
1071
1304
|
})}
|
|
1072
1305
|
</span>
|
|
1073
1306
|
<span className="mx-1 h-4 w-px bg-white/20" />
|
|
1074
|
-
{
|
|
1307
|
+
{visibleBulkActions.map((action) => {
|
|
1308
|
+
if ("items" in action) {
|
|
1309
|
+
return (
|
|
1310
|
+
<AlephaTableBulkMenu<T>
|
|
1311
|
+
key={action.label}
|
|
1312
|
+
action={action}
|
|
1313
|
+
selected={selectedItems}
|
|
1314
|
+
ctx={bulkCtx}
|
|
1315
|
+
/>
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1075
1318
|
const ActionIcon = action.icon;
|
|
1076
1319
|
return (
|
|
1077
1320
|
<Button
|
|
@@ -1305,38 +1548,34 @@ export function AlephaTable<T>(props: AlephaTableProps<T>) {
|
|
|
1305
1548
|
into a junk drawer. */}
|
|
1306
1549
|
<div className="flex items-center gap-2">
|
|
1307
1550
|
{pageSizes.length > 0 && (
|
|
1308
|
-
// The same
|
|
1309
|
-
//
|
|
1310
|
-
//
|
|
1311
|
-
//
|
|
1312
|
-
//
|
|
1313
|
-
<
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
// surface that blending is right, on a tinted bar it made
|
|
1321
|
-
// the picker read as part of the bar while the pagination
|
|
1322
|
-
// buttons beside it sat on their own plane. Overridden here
|
|
1323
|
-
// rather than in `SelectTrigger`, which every form still
|
|
1324
|
-
// wants transparent.
|
|
1325
|
-
className="bg-background h-7 w-auto gap-1 text-xs"
|
|
1326
|
-
aria-label={String(
|
|
1551
|
+
// The same `Control` the filter bar is built on, so the picker
|
|
1552
|
+
// is one component with every other select in this table. It
|
|
1553
|
+
// used to be the raw `Select` underneath it, because `Control`
|
|
1554
|
+
// is form-bound and this is not a form — `sizeForm` above is
|
|
1555
|
+
// what closes that gap.
|
|
1556
|
+
<Control
|
|
1557
|
+
input={sizeForm.input.size}
|
|
1558
|
+
// The count line beside it is not a label, so the trigger has
|
|
1559
|
+
// to name itself.
|
|
1560
|
+
label=""
|
|
1561
|
+
inputProps={{
|
|
1562
|
+
"aria-label": String(
|
|
1327
1563
|
tr("table.pageSize", { default: "Rows per page" }),
|
|
1328
|
-
)
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1564
|
+
),
|
|
1565
|
+
}}
|
|
1566
|
+
// `bg-background`, because this bar is `bg-muted` and the
|
|
1567
|
+
// trigger is `bg-transparent` by default: on a plain form
|
|
1568
|
+
// surface that blending is right, on a tinted bar it made the
|
|
1569
|
+
// picker read as part of the bar while the pagination buttons
|
|
1570
|
+
// beside it sat on their own plane. Set here rather than on
|
|
1571
|
+
// the trigger itself, which every form still wants
|
|
1572
|
+
// transparent.
|
|
1573
|
+
triggerClassName="bg-background h-7 w-auto gap-1 text-xs"
|
|
1574
|
+
items={pageSizes.map((n) => ({
|
|
1575
|
+
value: String(n),
|
|
1576
|
+
label: String(n),
|
|
1577
|
+
}))}
|
|
1578
|
+
/>
|
|
1340
1579
|
)}
|
|
1341
1580
|
<p className="text-muted-foreground text-xs">
|
|
1342
1581
|
{meta
|
|
@@ -1539,7 +1778,7 @@ function RowActionsMenu<T>(props: {
|
|
|
1539
1778
|
<DropdownMenuItem
|
|
1540
1779
|
disabled={disabled}
|
|
1541
1780
|
onClick={() => action.onClick(props.item, props.ctx)}
|
|
1542
|
-
|
|
1781
|
+
variant={action.destructive ? "destructive" : undefined}
|
|
1543
1782
|
>
|
|
1544
1783
|
{Icon && <Icon className="mr-2 size-4" />}
|
|
1545
1784
|
{action.label}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { render, screen, waitFor } from "@testing-library/react";
|
|
2
|
+
import { Alepha } from "alepha";
|
|
3
|
+
import { AlephaContext } from "alepha/react";
|
|
4
|
+
import { setupJsdomMocks } from "alepha/react/testing";
|
|
5
|
+
import type { ReactNode } from "react";
|
|
6
|
+
import { afterEach, beforeAll, describe, expect, it } from "vitest";
|
|
7
|
+
|
|
8
|
+
import { NavigationProgress } from "../navigation-progress.tsx";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The bar draws for a transition it is mounted across, and for no other.
|
|
12
|
+
*
|
|
13
|
+
* That sounds like a restatement of how `useEvents` works, and it is - but it
|
|
14
|
+
* is also the whole reason this component was pulled out of `AppShell`. Mounted
|
|
15
|
+
* inside a shell, the two navigations it cannot cover are precisely the ones
|
|
16
|
+
* that enter and leave that shell: `begin` fires before the destination's
|
|
17
|
+
* layers exist, and `NestedView` swaps the view on `end`. An application whose
|
|
18
|
+
* landing page has no shell therefore had a bar on every move within a section
|
|
19
|
+
* and none on the move into one, which reads as a broken indicator rather than
|
|
20
|
+
* as an absent one.
|
|
21
|
+
*
|
|
22
|
+
* These tests pin the contract a root mount relies on: silent until a
|
|
23
|
+
* transition starts, visible for its whole duration, gone after it lands, and
|
|
24
|
+
* still correct when a second navigation interrupts the first.
|
|
25
|
+
*/
|
|
26
|
+
describe("NavigationProgress", () => {
|
|
27
|
+
let alepha: Alepha | undefined;
|
|
28
|
+
|
|
29
|
+
beforeAll(() => {
|
|
30
|
+
setupJsdomMocks();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(async () => {
|
|
34
|
+
await alepha?.stop();
|
|
35
|
+
alepha = undefined;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const mount = async (ui: ReactNode) => {
|
|
39
|
+
alepha = Alepha.create();
|
|
40
|
+
await alepha.start();
|
|
41
|
+
render(
|
|
42
|
+
<AlephaContext.Provider value={alepha}>{ui}</AlephaContext.Provider>,
|
|
43
|
+
);
|
|
44
|
+
return alepha;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const begin = (app: Alepha) =>
|
|
48
|
+
app.events.emit(
|
|
49
|
+
"react:transition:begin",
|
|
50
|
+
{ previous: {}, state: {} } as never,
|
|
51
|
+
{ catch: true },
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const end = (app: Alepha) =>
|
|
55
|
+
app.events.emit("react:transition:end", { state: {} } as never, {
|
|
56
|
+
catch: true,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("renders nothing until a transition starts", async () => {
|
|
60
|
+
await mount(<NavigationProgress />);
|
|
61
|
+
|
|
62
|
+
expect(screen.queryByTestId("navigation-progress")).toBeNull();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("shows the bar while a transition is in flight", async () => {
|
|
66
|
+
const app = await mount(<NavigationProgress />);
|
|
67
|
+
|
|
68
|
+
await begin(app);
|
|
69
|
+
|
|
70
|
+
await waitFor(() => {
|
|
71
|
+
expect(screen.getByTestId("navigation-progress")).toBeTruthy();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("takes the bar away once the transition lands", async () => {
|
|
76
|
+
const app = await mount(<NavigationProgress />);
|
|
77
|
+
|
|
78
|
+
await begin(app);
|
|
79
|
+
await waitFor(() => {
|
|
80
|
+
expect(screen.getByTestId("navigation-progress")).toBeTruthy();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
await end(app);
|
|
84
|
+
|
|
85
|
+
await waitFor(() => {
|
|
86
|
+
expect(screen.queryByTestId("navigation-progress")).toBeNull();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("keeps one bar when a second navigation interrupts the first", async () => {
|
|
91
|
+
const app = await mount(<NavigationProgress />);
|
|
92
|
+
|
|
93
|
+
// The case that used to leak an interval per interrupted navigation: the
|
|
94
|
+
// second `begin` overwrote the ref without clearing the first timer.
|
|
95
|
+
await begin(app);
|
|
96
|
+
await begin(app);
|
|
97
|
+
await end(app);
|
|
98
|
+
|
|
99
|
+
await waitFor(() => {
|
|
100
|
+
expect(screen.queryByTestId("navigation-progress")).toBeNull();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// A leaked interval would still be calling `setProgress` on an unmounted
|
|
104
|
+
// tree, so nothing may bring the bar back on its own.
|
|
105
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
106
|
+
expect(screen.queryByTestId("navigation-progress")).toBeNull();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("takes its height and colour from the caller", async () => {
|
|
110
|
+
const app = await mount(
|
|
111
|
+
<NavigationProgress className="bg-destructive" height={4} />,
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
await begin(app);
|
|
115
|
+
|
|
116
|
+
await waitFor(() => {
|
|
117
|
+
const container = screen.getByTestId("navigation-progress");
|
|
118
|
+
expect(container.style.height).toBe("4px");
|
|
119
|
+
expect(container.querySelector(".bg-destructive")).toBeTruthy();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|