@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
|
@@ -1,26 +1,65 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
2
|
import { FormField } from "../control-base/form-field.js";
|
|
3
|
-
import { Combobox as Combobox$1,
|
|
3
|
+
import { Combobox as Combobox$1, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, ComboboxTrigger } from "../ui/combobox.js";
|
|
4
4
|
import { Segmented } from "../ui/segmented.js";
|
|
5
5
|
import { useMemo, useRef, useState } from "react";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { Loader2 } from "lucide-react";
|
|
7
|
+
import { ListChecks, Loader2 } from "lucide-react";
|
|
8
8
|
import { useI18n } from "alepha/react/i18n";
|
|
9
9
|
import { useAction } from "alepha/react";
|
|
10
10
|
import { parseField, useFieldValue, useFormState } from "alepha/react/form";
|
|
11
11
|
//#region src/components/control-select/control-select.tsx
|
|
12
12
|
/**
|
|
13
|
+
* Per-size trigger geometry. Kept as one table rather than scattered
|
|
14
|
+
* conditionals so a new size is one row and the three axes cannot drift.
|
|
15
|
+
*
|
|
16
|
+
* `chevron` targets the trigger's own last SVG - the one `ComboboxTrigger`
|
|
17
|
+
* appends at a hardcoded `size-4`. That file is stock shadcn, refreshed
|
|
18
|
+
* wholesale by `yarn sync`, so it is sized from here rather than edited.
|
|
19
|
+
*/
|
|
20
|
+
const SIZE_CLASSES = {
|
|
21
|
+
default: {
|
|
22
|
+
trigger: "h-8 gap-1.5 py-2 pr-2 pl-2.5 text-sm",
|
|
23
|
+
icon: "size-4",
|
|
24
|
+
chevron: "[&>svg]:size-4"
|
|
25
|
+
},
|
|
26
|
+
sm: {
|
|
27
|
+
trigger: "h-7 gap-1.5 py-1 pr-1.5 pl-2 text-sm",
|
|
28
|
+
icon: "size-3.5",
|
|
29
|
+
chevron: "[&>svg]:size-3.5"
|
|
30
|
+
},
|
|
31
|
+
xs: {
|
|
32
|
+
trigger: "h-6 gap-1 px-1 text-xs",
|
|
33
|
+
icon: "size-3",
|
|
34
|
+
chevron: "[&>svg]:size-3"
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The bordered box, or nothing at all.
|
|
39
|
+
*
|
|
40
|
+
* `minimal` drops the border, the background and the shadow, and pulls the
|
|
41
|
+
* trigger left by its own padding so its text aligns with plain rows beside
|
|
42
|
+
* it. The hover tint is what keeps it discoverable as a control.
|
|
43
|
+
*/
|
|
44
|
+
const MINIMAL_CLASSES = "-mx-1 border-transparent bg-transparent shadow-none hover:bg-muted dark:bg-transparent dark:hover:bg-input/50";
|
|
45
|
+
/**
|
|
13
46
|
* Internal sentinel for the `clearable` row. Picked to be unlikely to
|
|
14
47
|
* collide with a real option value; we translate it to `undefined` at
|
|
15
48
|
* the boundary so callers never see it.
|
|
16
49
|
*/
|
|
17
50
|
const CLEAR_VALUE = "__alepha_clear__";
|
|
18
51
|
/**
|
|
52
|
+
* Internal sentinel for the "select every match" row. Same reasoning as
|
|
53
|
+
* `CLEAR_VALUE`: it never reaches a caller, because it is expanded into the
|
|
54
|
+
* matching values before `onChange` is called.
|
|
55
|
+
*/
|
|
56
|
+
const SELECT_ALL_VALUE = "__alepha_select_all__";
|
|
57
|
+
/**
|
|
19
58
|
* Static option count above which the dropdown grows a search input. Below it
|
|
20
59
|
* the very same combobox renders without one — the threshold decides whether
|
|
21
60
|
* you can type, never which control you get.
|
|
22
61
|
*/
|
|
23
|
-
const SEARCH_THRESHOLD =
|
|
62
|
+
const SEARCH_THRESHOLD = 50;
|
|
24
63
|
const optValue = (o) => typeof o === "string" ? o : o.value;
|
|
25
64
|
const optLabel = (o) => typeof o === "string" ? o : o.label;
|
|
26
65
|
const optDesc = (o) => typeof o === "string" ? void 0 : o.description;
|
|
@@ -103,7 +142,7 @@ const ControlSelect = (props) => {
|
|
|
103
142
|
})
|
|
104
143
|
});
|
|
105
144
|
const clearLabel = props.clearLabel ?? tr("controlSelect.none", { default: "None" });
|
|
106
|
-
const searchable =
|
|
145
|
+
const searchable = props.searchable ?? (props.combobox || mode === "long" || Boolean(props.createNewEntry) || data.length > SEARCH_THRESHOLD);
|
|
107
146
|
return /* @__PURE__ */ jsx(FormField, {
|
|
108
147
|
id: meta.id,
|
|
109
148
|
label: meta.label,
|
|
@@ -124,10 +163,14 @@ const ControlSelect = (props) => {
|
|
|
124
163
|
createNewEntry: props.createNewEntry,
|
|
125
164
|
icon: props.icon,
|
|
126
165
|
triggerClassName: props.triggerClassName,
|
|
166
|
+
triggerProps: props.triggerProps,
|
|
167
|
+
size: props.size,
|
|
168
|
+
minimal: props.minimal,
|
|
127
169
|
clearable: props.clearable,
|
|
128
170
|
clearLabel,
|
|
171
|
+
countLabel: props.countLabel,
|
|
129
172
|
deselectable: props.clearable || !meta.required,
|
|
130
|
-
placeholder: props.clearable ? clearLabel : void 0
|
|
173
|
+
placeholder: props.placeholder ?? (props.clearable || isArray ? clearLabel : void 0)
|
|
131
174
|
})
|
|
132
175
|
});
|
|
133
176
|
};
|
|
@@ -142,9 +185,9 @@ const ControlSelect = (props) => {
|
|
|
142
185
|
*/
|
|
143
186
|
function Combobox(props) {
|
|
144
187
|
const { tr } = useI18n();
|
|
188
|
+
const sizeClasses = SIZE_CLASSES[props.size ?? "default"];
|
|
145
189
|
const [query, setQuery] = useState("");
|
|
146
190
|
const labelCache = useRef(/* @__PURE__ */ new Map());
|
|
147
|
-
const anchor = useComboboxAnchor();
|
|
148
191
|
const options = props.data.map((o) => ({
|
|
149
192
|
value: optValue(o),
|
|
150
193
|
label: optLabel(o),
|
|
@@ -155,7 +198,6 @@ function Combobox(props) {
|
|
|
155
198
|
}));
|
|
156
199
|
const selected = props.multi ? Array.isArray(props.value) ? props.value.map(String) : [] : props.value != null ? [String(props.value)] : [];
|
|
157
200
|
const labelFor = (val) => options.find((o) => o.value === val)?.label ?? labelCache.current.get(val) ?? val;
|
|
158
|
-
const disabledFor = (val) => options.find((o) => o.value === val)?.disabled ?? false;
|
|
159
201
|
const serverMode = Boolean(props.onSearch);
|
|
160
202
|
const q = query.trim().toLowerCase();
|
|
161
203
|
const filtered = serverMode || !q ? options : options.filter((o) => o.label.toLowerCase().includes(q));
|
|
@@ -176,8 +218,39 @@ function Combobox(props) {
|
|
|
176
218
|
label: props.clearLabel ?? tr("controlSelect.none", { default: "None" }),
|
|
177
219
|
clear: true
|
|
178
220
|
} : void 0;
|
|
221
|
+
const showClear = clearRow && clearRow.label.toLowerCase().includes(q);
|
|
222
|
+
/**
|
|
223
|
+
* "Select every match" — the row that makes a typed prefix a filter clause
|
|
224
|
+
* rather than a way to find one item.
|
|
225
|
+
*
|
|
226
|
+
* Areas are named by import path (`lore/quests`, `lore/folios`, `lore/ui`),
|
|
227
|
+
* so the prefix is the meaningful unit and "everything under lore/" took
|
|
228
|
+
* eight separate picks (feedback #2009). Typing `lore/` and pressing one row
|
|
229
|
+
* is the whole feature.
|
|
230
|
+
*
|
|
231
|
+
* ⚠️ It resolves to the individual values, deliberately, rather than
|
|
232
|
+
* becoming a pattern the query carries. Two consequences, and both are the
|
|
233
|
+
* point: the caller's schema and endpoint are untouched (a list of values is
|
|
234
|
+
* what they already take), and the chips stay honest - what is filtered is
|
|
235
|
+
* exactly what is shown, so removing one of the eight is an ordinary
|
|
236
|
+
* gesture rather than an escape from a prefix.
|
|
237
|
+
*
|
|
238
|
+
* Only when it would do something: multi-select, a non-empty query, and at
|
|
239
|
+
* least two matches that are not already selected. One match is what
|
|
240
|
+
* pressing the row itself does.
|
|
241
|
+
*/
|
|
242
|
+
const unselectedMatches = props.multi ? filtered.filter((o) => !o.disabled && !selected.includes(o.value)) : [];
|
|
243
|
+
const selectAllRow = props.multi && q.length > 0 && unselectedMatches.length > 1 ? {
|
|
244
|
+
value: SELECT_ALL_VALUE,
|
|
245
|
+
label: String(tr("controlSelect.selectAll", {
|
|
246
|
+
default: `Select ${unselectedMatches.length} matching "${query}"`,
|
|
247
|
+
args: [String(unselectedMatches.length), query]
|
|
248
|
+
})),
|
|
249
|
+
selectAll: true
|
|
250
|
+
} : void 0;
|
|
179
251
|
const items = [
|
|
180
|
-
...
|
|
252
|
+
...showClear && clearRow ? [clearRow] : [],
|
|
253
|
+
...selectAllRow ? [selectAllRow] : [],
|
|
181
254
|
...filtered,
|
|
182
255
|
...createOption ? [createOption] : []
|
|
183
256
|
];
|
|
@@ -206,12 +279,27 @@ function Combobox(props) {
|
|
|
206
279
|
setQuery("");
|
|
207
280
|
};
|
|
208
281
|
const handleMulti = (list) => {
|
|
209
|
-
|
|
210
|
-
|
|
282
|
+
const expanded = list.flatMap((o) => o.selectAll ? unselectedMatches : [o]);
|
|
283
|
+
const seen = /* @__PURE__ */ new Set();
|
|
284
|
+
const unique = expanded.filter((o) => seen.has(o.value) ? false : (seen.add(o.value), true));
|
|
285
|
+
for (const o of unique) remember(o);
|
|
286
|
+
props.onChange(unique.map((o) => props.coerce(o.value)));
|
|
211
287
|
setQuery("");
|
|
212
288
|
};
|
|
213
289
|
const emptyLabel = props.placeholder ?? tr("controlSelect.select", { default: "Select…" });
|
|
214
|
-
|
|
290
|
+
/**
|
|
291
|
+
* Value, then count.
|
|
292
|
+
*
|
|
293
|
+
* One selection names itself; two or more collapse to a count. That is what
|
|
294
|
+
* keeps a filter row at a FIXED width: chips grew the trigger with every
|
|
295
|
+
* pick and then truncated, so the control both moved its neighbours and
|
|
296
|
+
* stopped saying what it was filtering on. A count does neither, and the
|
|
297
|
+
* single-selection case — much the commonest — still reads as the value.
|
|
298
|
+
*/
|
|
299
|
+
const triggerLabel = props.multi ? selected.length === 0 ? emptyLabel : selected.length === 1 ? labelFor(selected[0]) : props.countLabel?.(selected.length) ?? String(tr("controlSelect.count", {
|
|
300
|
+
default: `${selected.length} selected`,
|
|
301
|
+
args: [String(selected.length)]
|
|
302
|
+
})) : selected[0] ? labelFor(selected[0]) : emptyLabel;
|
|
215
303
|
const popupBody = props.loading ? /* @__PURE__ */ jsxs("div", {
|
|
216
304
|
className: "text-muted-foreground flex items-center justify-center gap-2 p-4 text-sm",
|
|
217
305
|
children: [
|
|
@@ -219,7 +307,13 @@ function Combobox(props) {
|
|
|
219
307
|
" ",
|
|
220
308
|
tr("controlSelect.loading", { default: "Loading…" })
|
|
221
309
|
]
|
|
222
|
-
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ComboboxEmpty, { children: props.createNewEntry ? "" : tr("controlSelect.noResults", { default: "No results." }) }), /* @__PURE__ */ jsx(ComboboxList, { children: (opt) => opt.
|
|
310
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ComboboxEmpty, { children: props.createNewEntry ? "" : tr("controlSelect.noResults", { default: "No results." }) }), /* @__PURE__ */ jsx(ComboboxList, { children: (opt) => opt.selectAll ? /* @__PURE__ */ jsxs(ComboboxItem, {
|
|
311
|
+
value: opt,
|
|
312
|
+
children: [/* @__PURE__ */ jsx(ListChecks, { className: "mr-2 size-4 shrink-0" }), /* @__PURE__ */ jsx("span", {
|
|
313
|
+
className: "truncate font-medium",
|
|
314
|
+
children: opt.label
|
|
315
|
+
})]
|
|
316
|
+
}, "__select_all__") : opt.create ? /* @__PURE__ */ jsxs(ComboboxItem, {
|
|
223
317
|
value: opt,
|
|
224
318
|
children: [/* @__PURE__ */ jsx("span", {
|
|
225
319
|
className: "mr-2",
|
|
@@ -251,7 +345,7 @@ function Combobox(props) {
|
|
|
251
345
|
})]
|
|
252
346
|
})]
|
|
253
347
|
}, opt.value) })] });
|
|
254
|
-
return /* @__PURE__ */
|
|
348
|
+
return /* @__PURE__ */ jsxs(Combobox$1, {
|
|
255
349
|
items,
|
|
256
350
|
multiple: props.multi,
|
|
257
351
|
disabled: props.disabled,
|
|
@@ -264,28 +358,14 @@ function Combobox(props) {
|
|
|
264
358
|
setQuery(v);
|
|
265
359
|
props.onSearch?.(v);
|
|
266
360
|
},
|
|
267
|
-
children:
|
|
268
|
-
ref: anchor,
|
|
269
|
-
id: props.id,
|
|
270
|
-
className: cn("w-full", props.disabled && "pointer-events-none opacity-50", props.triggerClassName),
|
|
271
|
-
children: [
|
|
272
|
-
props.icon && /* @__PURE__ */ jsx(props.icon, { className: "text-muted-foreground ml-1 size-4 shrink-0" }),
|
|
273
|
-
selected.map((val) => /* @__PURE__ */ jsx(ComboboxChip, {
|
|
274
|
-
showRemove: !disabledFor(val),
|
|
275
|
-
children: labelFor(val)
|
|
276
|
-
}, val)),
|
|
277
|
-
/* @__PURE__ */ jsx(ComboboxChipsInput, { placeholder: selected.length === 0 ? props.placeholder ?? "Search…" : "Search…" })
|
|
278
|
-
]
|
|
279
|
-
}), /* @__PURE__ */ jsx(ComboboxContent, {
|
|
280
|
-
anchor,
|
|
281
|
-
children: popupBody
|
|
282
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
361
|
+
children: [/* @__PURE__ */ jsx(ComboboxTrigger, {
|
|
283
362
|
id: props.id,
|
|
284
363
|
disabled: props.disabled,
|
|
285
|
-
|
|
364
|
+
...props.triggerProps,
|
|
365
|
+
className: cn("border-input focus-visible:border-ring focus-visible:ring-ring/50 dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between rounded-lg border bg-transparent whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50", sizeClasses.trigger, sizeClasses.chevron, props.minimal && MINIMAL_CLASSES, selected.length === 0 && (props.multi || !props.clearable) && "text-muted-foreground", props.triggerClassName),
|
|
286
366
|
children: /* @__PURE__ */ jsxs("span", {
|
|
287
367
|
className: "flex min-w-0 items-center gap-2",
|
|
288
|
-
children: [props.icon && /* @__PURE__ */ jsx(props.icon, { className: "text-muted-foreground
|
|
368
|
+
children: [props.icon && /* @__PURE__ */ jsx(props.icon, { className: cn("text-muted-foreground shrink-0", sizeClasses.icon) }), /* @__PURE__ */ jsx("span", {
|
|
289
369
|
className: "truncate",
|
|
290
370
|
children: triggerLabel
|
|
291
371
|
})]
|
|
@@ -293,7 +373,7 @@ function Combobox(props) {
|
|
|
293
373
|
}), /* @__PURE__ */ jsxs(ComboboxContent, { children: [props.searchable && /* @__PURE__ */ jsx(ComboboxInput, {
|
|
294
374
|
showTrigger: false,
|
|
295
375
|
placeholder: "Search…"
|
|
296
|
-
}), popupBody] })]
|
|
376
|
+
}), popupBody] })]
|
|
297
377
|
});
|
|
298
378
|
}
|
|
299
379
|
const useAsyncLoader = (loader, threshold, debounceMs, defaultValue) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-select.js","names":["ComboboxRoot"],"sources":["../../../src/components/control-select/control-select.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { FormField } from \"@alepha/ui/components/control-base/form-field\";\nimport type { IconComponent } from \"@alepha/ui/components/control-base/icon-hint\";\nimport {\n ComboboxChip,\n ComboboxChips,\n ComboboxChipsInput,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n Combobox as ComboboxRoot,\n ComboboxTrigger,\n useComboboxAnchor,\n} from \"@alepha/ui/components/ui/combobox\";\nimport { Segmented } from \"@alepha/ui/components/ui/segmented\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport type { Async } from \"alepha\";\nimport { useAction } from \"alepha/react\";\nimport {\n type BaseInputField,\n parseField,\n useFieldValue,\n useFormState,\n} from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { Loader2 } from \"lucide-react\";\nimport { type ReactNode, useMemo, useRef, useState } from \"react\";\n\nexport type SelectOption =\n | string\n | {\n value: string;\n label: string;\n /**\n * Optional secondary line shown under the label in the dropdown.\n */\n description?: string;\n /**\n * Optional small badge rendered next to the label.\n */\n tag?: string;\n /**\n * Optional icon/element rendered before the label, in both the\n * dropdown row and (for single-select) the trigger when selected.\n */\n icon?: ReactNode;\n /**\n * When true, the row is non-interactive — can't be selected if\n * not selected, can't be deselected if selected. Useful for\n * default/mandatory entries (e.g. the base \"user\" role).\n */\n disabled?: boolean;\n };\n\ntype LoaderMode = \"static\" | \"short\" | \"long\";\n\nexport interface ControlSelectProps {\n /**\n * Bound `InputField` from `useForm`. Single or multi value depending on schema.\n */\n input: BaseInputField;\n /**\n * Field label. Falls back to schema `title`.\n */\n label?: string;\n /**\n * Helper text shown below the input.\n */\n description?: string;\n /**\n * Render as a `<Segmented>` control (best for 2–4 options).\n */\n segmented?: boolean;\n /**\n * Force the search input on. Kept as the historical name for\n * `searchable: true` — every select is a combobox now, the flag only\n * decides whether it carries a search field.\n */\n combobox?: boolean;\n /**\n * Whether the dropdown carries a search input. Defaults to \"auto\": on for\n * multi-select, for a long-mode `loader`, and for static lists longer than\n * `SEARCH_THRESHOLD`. Set explicitly to search a short list or to drop the\n * search field from a long one.\n */\n searchable?: boolean;\n /**\n * Async option loader. Triggers long-mode (server-side search) above `loaderThreshold` options.\n */\n loader?: (search: string, resolve?: string[]) => Async<SelectOption[]>;\n /**\n * Option count above which `loader` is invoked on every search instead of once. Defaults to 100.\n */\n loaderThreshold?: number;\n /**\n * Debounce in ms applied to search queries when calling `loader` in long mode.\n */\n loaderDebounce?: number;\n /**\n * Disable the control.\n */\n disabled?: boolean;\n /**\n * Inline option list (overrides schema `enum`). Accepts either a static\n * array or an async function `(query) => SelectOption[]`. The async form\n * is mapped to a long-mode loader.\n */\n items?:\n | SelectOption[]\n | ((query: string) => SelectOption[] | Promise<SelectOption[]>);\n /**\n * Allow the user to add a new option by typing. When `true`, the typed\n * query becomes the value (and label) of a freshly created entry. When a\n * function, the function builds the option from the query.\n *\n * - For multi-select fields: each entry is appended to the value array.\n * - For single fields: behaves like a regular text input with a dropdown\n * suggesting existing options.\n */\n createNewEntry?: boolean | ((query: string) => Exclude<SelectOption, string>);\n /**\n * When true, the dropdown gets a synthetic \"none\" row at the top that\n * resets the field to `undefined`. Useful for optional filter chips\n * (e.g. an admin-table status filter) where the user needs an explicit\n * \"no filter\" option — Base UI's `Select` reserves empty-string values\n * as its internal no-selection sentinel, so a regular `<SelectItem\n * value=\"\">` can't be picked. With `clearable`, ControlSelect uses an\n * internal sentinel and translates it to `undefined` in `onChange`.\n *\n * Currently honored by the static-short `Select` and the searchable\n * Combobox render paths. Ignored by `segmented` (use a real segment\n * for \"all\" there).\n */\n clearable?: boolean;\n /**\n * Label rendered for the \"clear\" row injected by `clearable`. Also\n * used as the trigger placeholder when the field is empty. Defaults to\n * `\"None\"`. Localize at the call site (e.g. `\"All types\"`,\n * `\"All status\"`).\n */\n clearLabel?: string;\n /**\n * Extra className applied to the visible trigger (the `<SelectTrigger>`\n * or combobox `<Button>`). Useful for sizing filter chips\n * (`\"w-40\"`, `\"w-72\"`, etc.) without wrapping the whole `FormField` in\n * an extra div.\n */\n triggerClassName?: string;\n /**\n * Leading icon rendered on the left of the trigger, matching the\n * text-input controls. Resolved by the parent `Control` from its `icon`\n * prop — unlike text inputs there is no schema-hint fallback, so a select\n * only shows an icon when one is explicitly set.\n */\n icon?: IconComponent;\n}\n\n/**\n * Internal sentinel for the `clearable` row. Picked to be unlikely to\n * collide with a real option value; we translate it to `undefined` at\n * the boundary so callers never see it.\n */\nconst CLEAR_VALUE = \"__alepha_clear__\";\n\n/**\n * Static option count above which the dropdown grows a search input. Below it\n * the very same combobox renders without one — the threshold decides whether\n * you can type, never which control you get.\n */\nconst SEARCH_THRESHOLD = 20;\n\nconst optValue = (o: SelectOption) => (typeof o === \"string\" ? o : o.value);\nconst optLabel = (o: SelectOption) => (typeof o === \"string\" ? o : o.label);\nconst optDesc = (o: SelectOption) =>\n typeof o === \"string\" ? undefined : o.description;\nconst optTag = (o: SelectOption) => (typeof o === \"string\" ? undefined : o.tag);\nconst optDisabled = (o: SelectOption) =>\n typeof o === \"string\" ? false : Boolean(o.disabled);\nconst optIcon = (o: SelectOption): ReactNode =>\n typeof o === \"string\" ? undefined : o.icon;\n\n/**\n * Friendly label for plain string options: \"optional\" → \"Optional\",\n * \"in_progress\" → \"In Progress\". Custom `{ value, label }` items pass through\n * untouched.\n */\nconst titlecase = (s: string) =>\n s.replace(/[_-]+/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase());\nconst segmentedLabel = (o: SelectOption) =>\n typeof o === \"string\" ? titlecase(o) : o.label;\n\nexport const ControlSelect = (props: ControlSelectProps) => {\n const { tr } = useI18n();\n const form = useFormState(props.input, [\"error\"]);\n const [value, setValue] = useFieldValue(props.input);\n\n const meta = parseField(props.input, {\n label: props.label,\n description: props.description,\n error: form.error,\n });\n\n const isArray = meta.isArray;\n const isNumeric = meta.type === \"number\" || meta.type === \"integer\";\n const isBoolean = meta.type === \"boolean\";\n\n // Normalize items prop: array → static; function → loader\n const itemsArray = Array.isArray(props.items)\n ? (props.items as SelectOption[])\n : undefined;\n const itemsLoader =\n typeof props.items === \"function\"\n ? (props.items as (q: string) => Async<SelectOption[]>)\n : undefined;\n\n const enumValues =\n itemsArray ?? (meta.enum as SelectOption[] | undefined) ?? [];\n\n const effectiveLoader = props.loader ?? itemsLoader;\n\n const {\n data: asyncData,\n loading,\n mode,\n search,\n } = useAsyncLoader(\n effectiveLoader,\n props.loaderThreshold ?? 100,\n props.loaderDebounce ?? 300,\n props.input.initialValue,\n );\n\n // Labels and `disabled` flags are part of the identity: keying on the\n // joined values alone collided (`[\"ab\",\"c\"]` vs `[\"a\",\"bc\"]`) and kept a\n // stale list when only the labels changed.\n const enumKey = JSON.stringify(enumValues);\n const min = meta.constraints.minimum;\n const max = meta.constraints.maximum;\n // Derived, not stored: this is a pure function of the schema. As state\n // filled in by an effect, the first paint of every boolean or ranged select\n // was an EMPTY list, corrected one render later.\n const staticData = useMemo<SelectOption[]>(() => {\n if (effectiveLoader) return [];\n if (isBoolean && enumValues.length === 0) {\n return [\n { value: \"true\", label: tr(\"controlSelect.yes\", { default: \"Yes\" }) },\n { value: \"false\", label: tr(\"controlSelect.no\", { default: \"No\" }) },\n ];\n }\n if (\n isNumeric &&\n enumValues.length === 0 &&\n typeof min === \"number\" &&\n typeof max === \"number\" &&\n max - min <= 20\n ) {\n const range: SelectOption[] = [];\n for (let i = min; i <= max; i++) range.push(String(i));\n return range;\n }\n return enumValues;\n }, [effectiveLoader, enumKey, isBoolean, isNumeric, min, max, tr]);\n\n const data = effectiveLoader ? asyncData : staticData;\n\n if (!props.input?.props) return null;\n\n const coerce = (raw: string): unknown => {\n if (isNumeric) return Number(raw);\n if (isBoolean) return raw === \"true\";\n return raw;\n };\n\n if (props.segmented) {\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Segmented\n value={value != null ? String(value) : undefined}\n onChange={(v) => setValue(coerce(v))}\n disabled={props.disabled}\n options={data.slice(0, 10).map((o) => ({\n value: optValue(o),\n label: segmentedLabel(o),\n }))}\n fullWidth\n />\n </FormField>\n );\n }\n\n const clearLabel =\n props.clearLabel ?? tr(\"controlSelect.none\", { default: \"None\" });\n\n // One control for every list. The option count decides whether the popup\n // carries a search field — it no longer decides which primitive renders.\n // The native `Select` path this replaced silently dropped `description`,\n // `tag`, per-option `disabled` and `deselectable`, and styled its trigger\n // differently, purely because a list happened to be short.\n // Multi-select is never search-less: the chips input IS its trigger.\n const searchable =\n isArray ||\n (props.searchable ??\n (props.combobox || mode === \"long\" || data.length > SEARCH_THRESHOLD));\n\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Combobox\n id={meta.id}\n data={data}\n loading={loading}\n multi={isArray}\n searchable={searchable}\n disabled={props.disabled}\n value={value}\n onChange={(v) => setValue(v)}\n coerce={coerce}\n onSearch={mode === \"long\" ? search.run : undefined}\n createNewEntry={props.createNewEntry}\n icon={props.icon}\n // Used to be dropped on this path, so a filter chip sized `w-40` lost\n // its width as soon as its list crossed the threshold.\n triggerClassName={props.triggerClassName}\n // `clearable` used to reach this path as a placeholder and nothing\n // else, so a filter chip that had switched to the combobox (>20\n // options) could be set but never put back to \"All …\".\n clearable={props.clearable}\n clearLabel={clearLabel}\n // An optional field must also be able to go back to empty without a\n // dedicated row: Base UI never emits `null`, so re-pressing the\n // selected row deselects (see `handleSingle`). A required field keeps\n // its value — clearing it would only produce a validation error the\n // user cannot see yet.\n deselectable={props.clearable || !meta.required}\n placeholder={props.clearable ? clearLabel : undefined}\n />\n </FormField>\n );\n};\n\ninterface ComboboxProps {\n id?: string;\n data: SelectOption[];\n loading: boolean;\n multi: boolean;\n /**\n * Render the search input. When false the popup is the list alone — the\n * shape a short static list gets. Multi-select ignores it: its input is the\n * chips box itself, and it is the only way to open and type.\n */\n searchable: boolean;\n disabled?: boolean;\n value: unknown;\n onChange: (v: unknown) => void;\n coerce: (v: string) => unknown;\n onSearch?: (q: string) => void;\n createNewEntry?: ControlSelectProps[\"createNewEntry\"];\n icon?: IconComponent;\n triggerClassName?: string;\n /**\n * Trigger text when nothing is selected. Mirrors the native-Select path,\n * where a `clearable` field shows its `clearLabel` (e.g. \"All zones\") as the\n * empty placeholder. Defaults to \"Select…\".\n */\n placeholder?: string;\n /**\n * Prepend a row that resets the field to `undefined` — the combobox\n * equivalent of the native `Select`'s clear row.\n */\n clearable?: boolean;\n /**\n * Label of the `clearable` row (e.g. \"All zones\").\n */\n clearLabel?: string;\n /**\n * Allow the single-select value to be unset by pressing the row that is\n * already selected. Set for optional (and `clearable`) fields only.\n */\n deselectable?: boolean;\n}\n\n/**\n * Normalized option used as the Base UI `Combobox.Item` value. Because the\n * shape is `{ value, label }`, Base UI uses `label` for display/search and\n * `value` for selection automatically — which is what makes the popup search\n * match the visible label rather than the raw id.\n */\ninterface ComboOption {\n value: string;\n label: string;\n description?: string;\n tag?: string;\n icon?: ReactNode;\n disabled?: boolean;\n /**\n * Marks the synthetic \"create new\" row injected by `createNewEntry`.\n */\n create?: boolean;\n /**\n * Marks the synthetic \"clear\" row injected by `clearable`.\n */\n clear?: boolean;\n /**\n * The raw query that produced a `create` row (used as the new entry's label).\n */\n query?: string;\n}\n\n/**\n * Searchable single/multi select built on the Base UI `Combobox` primitive.\n *\n * Composed in the \"select-like\" shape: a button trigger that shows the current\n * value, with the search `<input>` living inside the popup. We disable Base\n * UI's internal filtering (`filter={null}`) and filter in JS so the same code\n * path serves static lists, server-driven (`onSearch`) lists, and the\n * `createNewEntry` affordance.\n */\nfunction Combobox(props: ComboboxProps) {\n const { tr } = useI18n();\n const [query, setQuery] = useState(\"\");\n // Remembers labels for values the user has picked, so the trigger/chips keep\n // a human label even after the source option drops out of a server-filtered\n // `data` set — or for freshly created entries that never existed in `data`.\n const labelCache = useRef(new Map<string, string>());\n // Positioning anchor for the multi-select chips box (the popup is anchored to\n // the chips container rather than the inline input).\n const anchor = useComboboxAnchor();\n\n const options: ComboOption[] = props.data.map((o) => ({\n value: optValue(o),\n label: optLabel(o),\n description: optDesc(o),\n tag: optTag(o),\n icon: optIcon(o),\n disabled: optDisabled(o),\n }));\n\n const selected: string[] = props.multi\n ? Array.isArray(props.value)\n ? (props.value as unknown[]).map(String)\n : []\n : props.value != null\n ? // Coercion at a boundary: the value is a form/route/chart primitive whose\n // declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n [String(props.value)]\n : [];\n\n const labelFor = (val: string) =>\n options.find((o) => o.value === val)?.label ??\n labelCache.current.get(val) ??\n val;\n\n const disabledFor = (val: string) =>\n options.find((o) => o.value === val)?.disabled ?? false;\n\n // Server mode (`onSearch`) filters upstream; for static lists we filter on\n // the visible label — never the value/id (that was the cmdk bug).\n const serverMode = Boolean(props.onSearch);\n const q = query.trim().toLowerCase();\n const filtered =\n serverMode || !q\n ? options\n : options.filter((o) => o.label.toLowerCase().includes(q));\n\n const showCreate =\n Boolean(props.createNewEntry) &&\n q.length > 0 &&\n !options.some((o) => o.value === query || o.label.toLowerCase() === q) &&\n !selected.includes(query);\n\n const createOption: ComboOption | undefined = showCreate\n ? (() => {\n const built =\n typeof props.createNewEntry === \"function\"\n ? props.createNewEntry(query)\n : { value: query, label: query };\n return {\n value: built.value,\n label: built.label,\n create: true,\n query,\n };\n })()\n : undefined;\n\n // The synthetic \"no selection\" row — \"All zones\", \"All tags\", \"None\". Only\n // meaningful for a single select: the multi path clears by removing chips.\n const clearRow: ComboOption | undefined =\n props.clearable && !props.multi\n ? {\n value: CLEAR_VALUE,\n label:\n props.clearLabel ?? tr(\"controlSelect.none\", { default: \"None\" }),\n clear: true,\n }\n : undefined;\n // Filtered on its own label like any other row, so searching \"zone\" doesn't\n // leave \"All zones\" stranded at the top of a list it doesn't match.\n const showClear = clearRow && clearRow.label.toLowerCase().includes(q);\n\n const items: ComboOption[] = [\n ...(showClear && clearRow ? [clearRow] : []),\n ...filtered,\n ...(createOption ? [createOption] : []),\n ];\n\n // Reconstruct option objects for the controlled value. Base UI matches them\n // back to list items via `isItemEqualToValue` (by `value`), so identity\n // across renders doesn't matter.\n const toValueObject = (val: string): ComboOption =>\n options.find((o) => o.value === val) ?? {\n value: val,\n label: labelFor(val),\n };\n\n const cbValue = props.multi\n ? selected.map(toValueObject)\n : selected[0]\n ? toValueObject(selected[0])\n : // Empty + clearable reads as \"the clear row is what's selected\", so it\n // carries the check mark — same as the native `Select` path.\n (clearRow ?? null);\n\n const remember = (o: ComboOption) => {\n if (o.create) labelCache.current.set(o.value, o.query ?? o.value);\n else labelCache.current.set(o.value, o.label);\n };\n\n const handleSingle = (o: ComboOption | null) => {\n if (!o || o.clear) {\n props.onChange(undefined);\n setQuery(\"\");\n return;\n }\n // Base UI's single-select `Combobox` re-selects on every item press — its\n // `handleSelection` calls `setSelectedValue(itemValue)` unconditionally and\n // never emits `null` — so pressing the checked row was a no-op and an\n // optional field had no way back to empty. Toggle it off here, the way the\n // multi path already does via its chips.\n if (props.deselectable && !o.create && selected[0] === o.value) {\n props.onChange(undefined);\n setQuery(\"\");\n return;\n }\n remember(o);\n props.onChange(props.coerce(o.value));\n setQuery(\"\");\n };\n\n const handleMulti = (list: ComboOption[]) => {\n for (const o of list) remember(o);\n props.onChange(list.map((o) => props.coerce(o.value)));\n setQuery(\"\");\n };\n\n const emptyLabel =\n props.placeholder ?? tr(\"controlSelect.select\", { default: \"Select…\" });\n const triggerLabel = selected[0] ? labelFor(selected[0]) : emptyLabel;\n\n // The list (loading / empty / items) is identical for single and multi — only\n // the trigger differs (button vs. chips box), so render it once.\n const popupBody = props.loading ? (\n <div className=\"text-muted-foreground flex items-center justify-center gap-2 p-4 text-sm\">\n <Loader2 className=\"size-4 animate-spin\" />{\" \"}\n {tr(\"controlSelect.loading\", { default: \"Loading…\" })}\n </div>\n ) : (\n <>\n <ComboboxEmpty>\n {props.createNewEntry\n ? \"\"\n : tr(\"controlSelect.noResults\", { default: \"No results.\" })}\n </ComboboxEmpty>\n <ComboboxList>\n {(opt: ComboOption) =>\n opt.create ? (\n <ComboboxItem key={`__create__${opt.value}`} value={opt}>\n <span className=\"mr-2\">+</span>\n {tr(\"controlSelect.create\", {\n default: `Create \"${opt.query}\"`,\n args: [String(opt.query ?? \"\")],\n })}\n </ComboboxItem>\n ) : (\n <ComboboxItem key={opt.value} value={opt} disabled={opt.disabled}>\n {opt.icon && (\n <span className=\"mr-2 flex shrink-0 items-center\">\n {opt.icon}\n </span>\n )}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex items-center gap-1.5\">\n {opt.tag && (\n <span className=\"bg-muted text-muted-foreground rounded px-1 text-[10px] tracking-wide uppercase\">\n {opt.tag}\n </span>\n )}\n <span className=\"truncate\">{opt.label}</span>\n </div>\n {opt.description && (\n <span className=\"text-muted-foreground truncate text-xs\">\n {opt.description}\n </span>\n )}\n </div>\n </ComboboxItem>\n )\n }\n </ComboboxList>\n </>\n );\n\n return (\n <ComboboxRoot\n items={items as never}\n multiple={props.multi}\n disabled={props.disabled}\n value={cbValue as never}\n onValueChange={\n (props.multi\n ? (v: ComboOption[]) => handleMulti(v)\n : (v: ComboOption | null) => handleSingle(v)) as never\n }\n isItemEqualToValue={\n ((a: ComboOption, b: ComboOption) => a.value === b.value) as never\n }\n filter={null}\n // Base UI leaves `autoHighlight` off by default, so nothing is\n // highlighted while typing and Enter has no target — the user has to\n // click a row (including the `createNewEntry` one). Highlighting the\n // first match makes Enter pick it, which is what a search field is\n // expected to do. It only engages while the query is non-empty, so\n // opening the popup still starts with no preselection.\n autoHighlight\n onInputValueChange={(v) => {\n setQuery(v);\n props.onSearch?.(v);\n }}\n >\n {props.multi ? (\n // Multi-select: removable chips for each value with an inline search\n // input, all inside the bordered chips box (Base UI's native shape).\n <>\n <ComboboxChips\n ref={anchor}\n id={props.id}\n className={cn(\n \"w-full\",\n props.disabled && \"pointer-events-none opacity-50\",\n props.triggerClassName,\n )}\n >\n {props.icon && (\n <props.icon className=\"text-muted-foreground ml-1 size-4 shrink-0\" />\n )}\n {selected.map((val) => (\n <ComboboxChip key={val} showRemove={!disabledFor(val)}>\n {labelFor(val)}\n </ComboboxChip>\n ))}\n <ComboboxChipsInput\n placeholder={\n selected.length === 0\n ? (props.placeholder ?? \"Search…\")\n : \"Search…\"\n }\n />\n </ComboboxChips>\n <ComboboxContent anchor={anchor}>{popupBody}</ComboboxContent>\n </>\n ) : (\n // Single-select: a button trigger styled to mirror <SelectTrigger>,\n // with the search input inside the popup.\n <>\n <ComboboxTrigger\n id={props.id}\n disabled={props.disabled}\n className={cn(\n \"border-input focus-visible:border-ring focus-visible:ring-ring/50 dark:bg-input/30 dark:hover:bg-input/50 flex h-8 w-full items-center justify-between gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50\",\n // Muted means \"nothing chosen yet\", which is only true without\n // a clear row. WITH one, empty is a selected value — the popup\n // already puts the check mark on it (see `cbValue`), and the\n // native `Select` path renders the same state in full contrast\n // because it makes the clear label a genuine `selectedValue`.\n // Muting here made one `clearable` filter look unset and its\n // neighbour look set for the same meaning, purely because the\n // option count crossed the 20 that picks between the two paths.\n selected.length === 0 &&\n !props.clearable &&\n \"text-muted-foreground\",\n props.triggerClassName,\n )}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n {props.icon && (\n <props.icon className=\"text-muted-foreground size-4 shrink-0\" />\n )}\n <span className=\"truncate\">{triggerLabel}</span>\n </span>\n </ComboboxTrigger>\n <ComboboxContent>\n {props.searchable && (\n <ComboboxInput showTrigger={false} placeholder=\"Search…\" />\n )}\n {popupBody}\n </ComboboxContent>\n </>\n )}\n </ComboboxRoot>\n );\n}\n\nconst useAsyncLoader = (\n loader: ControlSelectProps[\"loader\"],\n threshold: number,\n debounceMs: number,\n defaultValue: unknown,\n) => {\n const [data, setData] = useState<SelectOption[]>([]);\n const [loading, setLoading] = useState(false);\n const [mode, setMode] = useState<LoaderMode>(\"static\");\n const cache = useRef(new Map<string, SelectOption[]>());\n\n useAction(\n {\n // `id`, not `name`: `id` is what useAction threads into its\n // react:action:* events. `name` was accepted and never read, so this\n // identifier reached nothing.\n id: \"select:loader:init\",\n runOnInit: true,\n handler: async () => {\n if (!loader) {\n setMode(\"static\");\n return;\n }\n setLoading(true);\n try {\n const result = await loader(\"\");\n const isShort = result.length <= threshold;\n setMode(isShort ? \"short\" : \"long\");\n cache.current.set(\"\", result);\n setData(result);\n\n // Coercion at a boundary: the value is a form/route/chart primitive whose\n // declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n if (!isShort && defaultValue != null && String(defaultValue) !== \"\") {\n // Coercion at a boundary: the value is a form/route/chart primitive whose\n // declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n const resolved = await loader(\"\", [String(defaultValue)]);\n if (resolved.length > 0) {\n setData((prev) => {\n const existing = new Set(prev.map(optValue));\n const fresh = resolved.filter(\n (r) => !existing.has(optValue(r)),\n );\n return [...prev, ...fresh];\n });\n }\n }\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, threshold],\n );\n\n const search = useAction<[string]>(\n {\n debounce: debounceMs,\n handler: async (text) => {\n if (!loader || mode !== \"long\") return;\n if (cache.current.has(text)) {\n setData(cache.current.get(text)!);\n return;\n }\n setLoading(true);\n try {\n const result = await loader(text);\n cache.current.set(text, result);\n setData(result);\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, mode, debounceMs],\n );\n\n return { data, loading, mode, search };\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAuKA,MAAM,cAAc;;;;;;AAOpB,MAAM,mBAAmB;AAEzB,MAAM,YAAY,MAAqB,OAAO,MAAM,WAAW,IAAI,EAAE;AACrE,MAAM,YAAY,MAAqB,OAAO,MAAM,WAAW,IAAI,EAAE;AACrE,MAAM,WAAW,MACf,OAAO,MAAM,WAAW,KAAA,IAAY,EAAE;AACxC,MAAM,UAAU,MAAqB,OAAO,MAAM,WAAW,KAAA,IAAY,EAAE;AAC3E,MAAM,eAAe,MACnB,OAAO,MAAM,WAAW,QAAQ,QAAQ,EAAE,QAAQ;AACpD,MAAM,WAAW,MACf,OAAO,MAAM,WAAW,KAAA,IAAY,EAAE;;;;;;AAOxC,MAAM,aAAa,MACjB,EAAE,QAAQ,UAAU,GAAG,CAAC,CAAC,QAAQ,UAAU,MAAM,EAAE,YAAY,CAAC;AAClE,MAAM,kBAAkB,MACtB,OAAO,MAAM,WAAW,UAAU,CAAC,IAAI,EAAE;AAE3C,MAAa,iBAAiB,UAA8B;CAC1D,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,OAAO,aAAa,MAAM,OAAO,CAAC,OAAO,CAAC;CAChD,MAAM,CAAC,OAAO,YAAY,cAAc,MAAM,KAAK;CAEnD,MAAM,OAAO,WAAW,MAAM,OAAO;EACnC,OAAO,MAAM;EACb,aAAa,MAAM;EACnB,OAAO,KAAK;CACd,CAAC;CAED,MAAM,UAAU,KAAK;CACrB,MAAM,YAAY,KAAK,SAAS,YAAY,KAAK,SAAS;CAC1D,MAAM,YAAY,KAAK,SAAS;CAGhC,MAAM,aAAa,MA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/control-select.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { FormField } from \"@alepha/ui/components/control-base/form-field\";\nimport type { IconComponent } from \"@alepha/ui/components/control-base/icon-hint\";\nimport {\n ComboboxContent,\n ComboboxEmpty,\n ComboboxInput,\n ComboboxItem,\n ComboboxList,\n Combobox as ComboboxRoot,\n ComboboxTrigger,\n} from \"@alepha/ui/components/ui/combobox\";\nimport { Segmented } from \"@alepha/ui/components/ui/segmented\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport type { Async } from \"alepha\";\nimport { useAction } from \"alepha/react\";\nimport {\n type BaseInputField,\n parseField,\n useFieldValue,\n useFormState,\n} from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { ListChecks, Loader2 } from \"lucide-react\";\nimport type { HTMLAttributes } from \"react\";\nimport { type ReactNode, useMemo, useRef, useState } from \"react\";\n\nexport type SelectOption =\n | string\n | {\n value: string;\n label: string;\n /**\n * Optional secondary line shown under the label in the dropdown.\n */\n description?: string;\n /**\n * Optional small badge rendered next to the label.\n */\n tag?: string;\n /**\n * Optional icon/element rendered before the label, in both the\n * dropdown row and (for single-select) the trigger when selected.\n */\n icon?: ReactNode;\n /**\n * When true, the row is non-interactive — can't be selected if\n * not selected, can't be deselected if selected. Useful for\n * default/mandatory entries (e.g. the base \"user\" role).\n */\n disabled?: boolean;\n };\n\ntype LoaderMode = \"static\" | \"short\" | \"long\";\n\n/**\n * How tall and how loud a select trigger is.\n *\n * `xs` exists for a control that sits ON a row of text rather than in a form:\n * the quest rail's Release field beside its Assigned picker, where a\n * default-height boxed select reads as heavier than every line around it.\n */\nexport type ControlSelectSize = \"xs\" | \"sm\" | \"default\";\n\n/**\n * Per-size trigger geometry. Kept as one table rather than scattered\n * conditionals so a new size is one row and the three axes cannot drift.\n *\n * `chevron` targets the trigger's own last SVG - the one `ComboboxTrigger`\n * appends at a hardcoded `size-4`. That file is stock shadcn, refreshed\n * wholesale by `yarn sync`, so it is sized from here rather than edited.\n */\nconst SIZE_CLASSES: Record<\n ControlSelectSize,\n { trigger: string; icon: string; chevron: string }\n> = {\n default: {\n trigger: \"h-8 gap-1.5 py-2 pr-2 pl-2.5 text-sm\",\n icon: \"size-4\",\n chevron: \"[&>svg]:size-4\",\n },\n sm: {\n trigger: \"h-7 gap-1.5 py-1 pr-1.5 pl-2 text-sm\",\n icon: \"size-3.5\",\n chevron: \"[&>svg]:size-3.5\",\n },\n xs: {\n trigger: \"h-6 gap-1 px-1 text-xs\",\n icon: \"size-3\",\n chevron: \"[&>svg]:size-3\",\n },\n};\n\n/**\n * The bordered box, or nothing at all.\n *\n * `minimal` drops the border, the background and the shadow, and pulls the\n * trigger left by its own padding so its text aligns with plain rows beside\n * it. The hover tint is what keeps it discoverable as a control.\n */\nconst MINIMAL_CLASSES =\n \"-mx-1 border-transparent bg-transparent shadow-none hover:bg-muted dark:bg-transparent dark:hover:bg-input/50\";\n\nexport interface ControlSelectProps {\n /**\n * Bound `InputField` from `useForm`. Single or multi value depending on schema.\n */\n input: BaseInputField;\n /**\n * Field label. Falls back to schema `title`.\n */\n label?: string;\n /**\n * Helper text shown below the input.\n */\n description?: string;\n /**\n * Render as a `<Segmented>` control (best for 2–4 options).\n */\n segmented?: boolean;\n /**\n * Force the search input on. Kept as the historical name for\n * `searchable: true` — every select is a combobox now, the flag only\n * decides whether it carries a search field.\n */\n combobox?: boolean;\n /**\n * Whether the dropdown carries a search input. Defaults to \"auto\": on for a\n * long-mode `loader` (the rows are not all here), when `createNewEntry` is\n * set (typing IS how an entry is made), and for lists longer than\n * `SEARCH_THRESHOLD`. Set explicitly to search a short list or to drop the\n * search field from a long one.\n *\n * Multi-select obeys the same rule as everything else; it used to force the\n * field on because its chips box doubled as the search input.\n */\n searchable?: boolean;\n /**\n * Async option loader. Triggers long-mode (server-side search) above `loaderThreshold` options.\n */\n loader?: (search: string, resolve?: string[]) => Async<SelectOption[]>;\n /**\n * Option count above which `loader` is invoked on every search instead of once. Defaults to 100.\n */\n loaderThreshold?: number;\n /**\n * Debounce in ms applied to search queries when calling `loader` in long mode.\n */\n loaderDebounce?: number;\n /**\n * Disable the control.\n */\n disabled?: boolean;\n /**\n * Inline option list (overrides schema `enum`). Accepts either a static\n * array or an async function `(query) => SelectOption[]`. The async form\n * is mapped to a long-mode loader.\n */\n items?:\n | SelectOption[]\n | ((query: string) => SelectOption[] | Promise<SelectOption[]>);\n /**\n * Allow the user to add a new option by typing. When `true`, the typed\n * query becomes the value (and label) of a freshly created entry. When a\n * function, the function builds the option from the query.\n *\n * - For multi-select fields: each entry is appended to the value array.\n * - For single fields: behaves like a regular text input with a dropdown\n * suggesting existing options.\n */\n createNewEntry?: boolean | ((query: string) => Exclude<SelectOption, string>);\n /**\n * When true, the dropdown gets a synthetic \"none\" row at the top that\n * resets the field to `undefined`. Useful for optional filter chips\n * (e.g. an admin-table status filter) where the user needs an explicit\n * \"no filter\" option — Base UI's `Select` reserves empty-string values\n * as its internal no-selection sentinel, so a regular `<SelectItem\n * value=\"\">` can't be picked. With `clearable`, ControlSelect uses an\n * internal sentinel and translates it to `undefined` in `onChange`.\n *\n * Currently honored by the static-short `Select` and the searchable\n * Combobox render paths. Ignored by `segmented` (use a real segment\n * for \"all\" there).\n */\n clearable?: boolean;\n /**\n * Label rendered for the \"clear\" row injected by `clearable`. Also\n * used as the trigger placeholder when the field is empty. Defaults to\n * `\"None\"`. Localize at the call site (e.g. `\"All types\"`,\n * `\"All status\"`).\n */\n clearLabel?: string;\n /**\n * Trigger text for a multi-select holding two or more values, e.g.\n * `(n) => \\`${n} status\\``. One selection always shows the value itself, so\n * this is only ever asked for the collapsed case. Defaults to\n * `\"{n} selected\"`.\n */\n countLabel?: (count: number) => string;\n /**\n * Trigger text when nothing is selected, e.g. \"Pick an epic…\". Defaults to\n * the `clearLabel` on a `clearable` or multi field (where empty IS a\n * meaningful state to name), and to \"Select…\" otherwise.\n *\n * Set it when the empty trigger has a job to do - a picker whose whole\n * purpose is the choice it prompts for reads as a dead \"Select…\" without\n * it, which is why the surfaces that needed one stayed on the raw `Select`.\n */\n placeholder?: string;\n /**\n * Extra className applied to the visible trigger: the combobox button or\n * the segmented control, whichever this field renders. Useful for sizing\n * filter chips (`\"w-40\"`, `\"w-72\"`, etc.) without wrapping the whole\n * `FormField` in an extra div.\n */\n triggerClassName?: string;\n /**\n * Trigger height and type scale. Defaults to `default`.\n */\n size?: ControlSelectSize;\n /**\n * Render the trigger borderless and transparent, so it reads as the row it\n * sits on rather than as a form field.\n */\n minimal?: boolean;\n /**\n * Extra attributes for whichever trigger this field renders, forwarded from\n * `Control`'s `inputProps`.\n *\n * The accessible name usually lives here, because a filter is routinely\n * rendered with `label=\"\"` next to its own heading: with no `<label>` to\n * borrow a name from, a `role=combobox` button or a radiogroup has no name\n * at all. That is both an a11y hole and unaddressable from a\n * test, and it was silent, since `Control` accepted `inputProps` and then\n * dropped it on every select-shaped branch.\n */\n triggerProps?: HTMLAttributes<HTMLElement>;\n /**\n * Leading icon rendered on the left of the trigger, matching the\n * text-input controls. Resolved by the parent `Control` from its `icon`\n * prop — unlike text inputs there is no schema-hint fallback, so a select\n * only shows an icon when one is explicitly set.\n */\n icon?: IconComponent;\n}\n\n/**\n * Internal sentinel for the `clearable` row. Picked to be unlikely to\n * collide with a real option value; we translate it to `undefined` at\n * the boundary so callers never see it.\n */\nconst CLEAR_VALUE = \"__alepha_clear__\";\n\n/**\n * Internal sentinel for the \"select every match\" row. Same reasoning as\n * `CLEAR_VALUE`: it never reaches a caller, because it is expanded into the\n * matching values before `onChange` is called.\n */\nconst SELECT_ALL_VALUE = \"__alepha_select_all__\";\n\n/**\n * Static option count above which the dropdown grows a search input. Below it\n * the very same combobox renders without one — the threshold decides whether\n * you can type, never which control you get.\n */\n// Past this many rows, scanning by eye stops being realistic and the popup\n// grows a search field. Raised 20 -> 50 with the multi-select rework: the old\n// value put a search box on lists a reader takes in at a glance.\nconst SEARCH_THRESHOLD = 50;\n\nconst optValue = (o: SelectOption) => (typeof o === \"string\" ? o : o.value);\nconst optLabel = (o: SelectOption) => (typeof o === \"string\" ? o : o.label);\nconst optDesc = (o: SelectOption) =>\n typeof o === \"string\" ? undefined : o.description;\nconst optTag = (o: SelectOption) => (typeof o === \"string\" ? undefined : o.tag);\nconst optDisabled = (o: SelectOption) =>\n typeof o === \"string\" ? false : Boolean(o.disabled);\nconst optIcon = (o: SelectOption): ReactNode =>\n typeof o === \"string\" ? undefined : o.icon;\n\n/**\n * Friendly label for plain string options: \"optional\" → \"Optional\",\n * \"in_progress\" → \"In Progress\". Custom `{ value, label }` items pass through\n * untouched.\n */\nconst titlecase = (s: string) =>\n s.replace(/[_-]+/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase());\nconst segmentedLabel = (o: SelectOption) =>\n typeof o === \"string\" ? titlecase(o) : o.label;\n\nexport const ControlSelect = (props: ControlSelectProps) => {\n const { tr } = useI18n();\n const form = useFormState(props.input, [\"error\"]);\n const [value, setValue] = useFieldValue(props.input);\n\n const meta = parseField(props.input, {\n label: props.label,\n description: props.description,\n error: form.error,\n });\n\n const isArray = meta.isArray;\n const isNumeric = meta.type === \"number\" || meta.type === \"integer\";\n const isBoolean = meta.type === \"boolean\";\n\n // Normalize items prop: array → static; function → loader\n const itemsArray = Array.isArray(props.items)\n ? (props.items as SelectOption[])\n : undefined;\n const itemsLoader =\n typeof props.items === \"function\"\n ? (props.items as (q: string) => Async<SelectOption[]>)\n : undefined;\n\n const enumValues =\n itemsArray ?? (meta.enum as SelectOption[] | undefined) ?? [];\n\n const effectiveLoader = props.loader ?? itemsLoader;\n\n const {\n data: asyncData,\n loading,\n mode,\n search,\n } = useAsyncLoader(\n effectiveLoader,\n props.loaderThreshold ?? 100,\n props.loaderDebounce ?? 300,\n props.input.initialValue,\n );\n\n // Labels and `disabled` flags are part of the identity: keying on the\n // joined values alone collided (`[\"ab\",\"c\"]` vs `[\"a\",\"bc\"]`) and kept a\n // stale list when only the labels changed.\n const enumKey = JSON.stringify(enumValues);\n const min = meta.constraints.minimum;\n const max = meta.constraints.maximum;\n // Derived, not stored: this is a pure function of the schema. As state\n // filled in by an effect, the first paint of every boolean or ranged select\n // was an EMPTY list, corrected one render later.\n const staticData = useMemo<SelectOption[]>(() => {\n if (effectiveLoader) return [];\n if (isBoolean && enumValues.length === 0) {\n return [\n { value: \"true\", label: tr(\"controlSelect.yes\", { default: \"Yes\" }) },\n { value: \"false\", label: tr(\"controlSelect.no\", { default: \"No\" }) },\n ];\n }\n if (\n isNumeric &&\n enumValues.length === 0 &&\n typeof min === \"number\" &&\n typeof max === \"number\" &&\n max - min <= 20\n ) {\n const range: SelectOption[] = [];\n for (let i = min; i <= max; i++) range.push(String(i));\n return range;\n }\n return enumValues;\n }, [effectiveLoader, enumKey, isBoolean, isNumeric, min, max, tr]);\n\n const data = effectiveLoader ? asyncData : staticData;\n\n if (!props.input?.props) return null;\n\n const coerce = (raw: string): unknown => {\n if (isNumeric) return Number(raw);\n if (isBoolean) return raw === \"true\";\n return raw;\n };\n\n if (props.segmented) {\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n {/* `triggerProps` is deliberately NOT spread here. `Segmented`\n redeclares two attributes that `HTMLAttributes` also has, with\n narrower types (`defaultValue` is string-only, `onChange` takes a\n value rather than an event), so a blanket spread neither typechecks\n nor is safe. A segmented field also renders every option as visible\n text, so it is the one branch that is not nameless without a label.\n Name it with `label` if it needs one. */}\n <Segmented\n value={value != null ? String(value) : undefined}\n onChange={(v) => setValue(coerce(v))}\n disabled={props.disabled}\n options={data.slice(0, 10).map((o) => ({\n value: optValue(o),\n label: segmentedLabel(o),\n }))}\n fullWidth\n />\n </FormField>\n );\n }\n\n const clearLabel =\n props.clearLabel ?? tr(\"controlSelect.none\", { default: \"None\" });\n\n // One control for every list. The option count decides whether the popup\n // carries a search field — it no longer decides which primitive renders.\n // The native `Select` path this replaced silently dropped `description`,\n // `tag`, per-option `disabled` and `deselectable`, and styled its trigger\n // differently, purely because a list happened to be short.\n // A search field is offered only when scanning the list by eye stops being\n // realistic: a server-driven list (whose rows are not all here), one past\n // `SEARCH_THRESHOLD`, or one where typing is how a new entry is made.\n //\n // Multi-select used to force it on unconditionally, because the chips box\n // WAS the search input and there was no other way to open the popup. The\n // trigger is a button now, so multi obeys the same rule as everything else\n // and a four-row status filter no longer opens onto a search field.\n const searchable =\n props.searchable ??\n (props.combobox ||\n mode === \"long\" ||\n Boolean(props.createNewEntry) ||\n data.length > SEARCH_THRESHOLD);\n\n return (\n <FormField\n id={meta.id}\n label={meta.label}\n description={meta.description}\n error={meta.error}\n required={meta.required}\n >\n <Combobox\n id={meta.id}\n data={data}\n loading={loading}\n multi={isArray}\n searchable={searchable}\n disabled={props.disabled}\n value={value}\n onChange={(v) => setValue(v)}\n coerce={coerce}\n onSearch={mode === \"long\" ? search.run : undefined}\n createNewEntry={props.createNewEntry}\n icon={props.icon}\n // Used to be dropped on this path, so a filter chip sized `w-40` lost\n // its width as soon as its list crossed the threshold.\n triggerClassName={props.triggerClassName}\n triggerProps={props.triggerProps}\n size={props.size}\n minimal={props.minimal}\n // `clearable` used to reach this path as a placeholder and nothing\n // else, so a filter chip that had switched to the combobox (>20\n // options) could be set but never put back to \"All …\".\n clearable={props.clearable}\n clearLabel={clearLabel}\n countLabel={props.countLabel}\n // An optional field must also be able to go back to empty without a\n // dedicated row: Base UI never emits `null`, so re-pressing the\n // selected row deselects (see `handleSingle`). A required field keeps\n // its value — clearing it would only produce a validation error the\n // user cannot see yet.\n deselectable={props.clearable || !meta.required}\n // Multi shows this muted when nothing is picked, so it reaches the\n // trigger whether or not the field is `clearable` — a multi-select\n // has no clear ROW (it clears by deselecting), and without this its\n // empty trigger fell back to a bare \"Select…\".\n placeholder={\n props.placeholder ??\n (props.clearable || isArray ? clearLabel : undefined)\n }\n />\n </FormField>\n );\n};\n\ninterface ComboboxProps {\n id?: string;\n data: SelectOption[];\n loading: boolean;\n multi: boolean;\n /**\n * Render the search input. When false the popup is the list alone — the\n * shape a short static list gets. Multi-select ignores it: its input is the\n * chips box itself, and it is the only way to open and type.\n */\n searchable: boolean;\n disabled?: boolean;\n value: unknown;\n onChange: (v: unknown) => void;\n coerce: (v: string) => unknown;\n onSearch?: (q: string) => void;\n createNewEntry?: ControlSelectProps[\"createNewEntry\"];\n icon?: IconComponent;\n triggerClassName?: string;\n /**\n * Trigger height and type scale. Defaults to `default`.\n */\n size?: ControlSelectSize;\n /**\n * Render the trigger borderless and transparent, so it reads as the row it\n * sits on rather than as a form field.\n */\n minimal?: boolean;\n triggerProps?: HTMLAttributes<HTMLElement>;\n /**\n * Trigger text when nothing is selected. Mirrors the native-Select path,\n * where a `clearable` field shows its `clearLabel` (e.g. \"All zones\") as the\n * empty placeholder. Defaults to \"Select…\".\n */\n placeholder?: string;\n /**\n * Prepend a row that resets the field to `undefined` — the combobox\n * equivalent of the native `Select`'s clear row.\n */\n clearable?: boolean;\n /**\n * Label of the `clearable` row (e.g. \"All zones\").\n */\n clearLabel?: string;\n /**\n * See `ControlSelectProps.countLabel`.\n */\n countLabel?: (count: number) => string;\n /**\n * Allow the single-select value to be unset by pressing the row that is\n * already selected. Set for optional (and `clearable`) fields only.\n */\n deselectable?: boolean;\n}\n\n/**\n * Normalized option used as the Base UI `Combobox.Item` value. Because the\n * shape is `{ value, label }`, Base UI uses `label` for display/search and\n * `value` for selection automatically — which is what makes the popup search\n * match the visible label rather than the raw id.\n */\ninterface ComboOption {\n value: string;\n label: string;\n description?: string;\n tag?: string;\n icon?: ReactNode;\n disabled?: boolean;\n /**\n * Marks the synthetic \"create new\" row injected by `createNewEntry`.\n */\n create?: boolean;\n /**\n * Marks the synthetic \"clear\" row injected by `clearable`.\n */\n clear?: boolean;\n /**\n * Marks the synthetic \"select every match\" row a multi-select offers while\n * a query is narrowing the list.\n */\n selectAll?: boolean;\n /**\n * The raw query that produced a `create` row (used as the new entry's label).\n */\n query?: string;\n}\n\n/**\n * Searchable single/multi select built on the Base UI `Combobox` primitive.\n *\n * Composed in the \"select-like\" shape: a button trigger that shows the current\n * value, with the search `<input>` living inside the popup. We disable Base\n * UI's internal filtering (`filter={null}`) and filter in JS so the same code\n * path serves static lists, server-driven (`onSearch`) lists, and the\n * `createNewEntry` affordance.\n */\nfunction Combobox(props: ComboboxProps) {\n const { tr } = useI18n();\n const sizeClasses = SIZE_CLASSES[props.size ?? \"default\"];\n const [query, setQuery] = useState(\"\");\n // Remembers labels for values the user has picked, so the trigger/chips keep\n // a human label even after the source option drops out of a server-filtered\n // `data` set — or for freshly created entries that never existed in `data`.\n const labelCache = useRef(new Map<string, string>());\n\n const options: ComboOption[] = props.data.map((o) => ({\n value: optValue(o),\n label: optLabel(o),\n description: optDesc(o),\n tag: optTag(o),\n icon: optIcon(o),\n disabled: optDisabled(o),\n }));\n\n const selected: string[] = props.multi\n ? Array.isArray(props.value)\n ? (props.value as unknown[]).map(String)\n : []\n : props.value != null\n ? // Coercion at a boundary: the value is a form/route/chart primitive whose\n // declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n [String(props.value)]\n : [];\n\n const labelFor = (val: string) =>\n options.find((o) => o.value === val)?.label ??\n labelCache.current.get(val) ??\n val;\n\n // Server mode (`onSearch`) filters upstream; for static lists we filter on\n // the visible label — never the value/id (that was the cmdk bug).\n const serverMode = Boolean(props.onSearch);\n const q = query.trim().toLowerCase();\n const filtered =\n serverMode || !q\n ? options\n : options.filter((o) => o.label.toLowerCase().includes(q));\n\n const showCreate =\n Boolean(props.createNewEntry) &&\n q.length > 0 &&\n !options.some((o) => o.value === query || o.label.toLowerCase() === q) &&\n !selected.includes(query);\n\n const createOption: ComboOption | undefined = showCreate\n ? (() => {\n const built =\n typeof props.createNewEntry === \"function\"\n ? props.createNewEntry(query)\n : { value: query, label: query };\n return {\n value: built.value,\n label: built.label,\n create: true,\n query,\n };\n })()\n : undefined;\n\n // The synthetic \"no selection\" row — \"All zones\", \"All tags\", \"None\". Only\n // meaningful for a single select: the multi path clears by removing chips.\n const clearRow: ComboOption | undefined =\n props.clearable && !props.multi\n ? {\n value: CLEAR_VALUE,\n label:\n props.clearLabel ?? tr(\"controlSelect.none\", { default: \"None\" }),\n clear: true,\n }\n : undefined;\n // Filtered on its own label like any other row, so searching \"zone\" doesn't\n // leave \"All zones\" stranded at the top of a list it doesn't match.\n const showClear = clearRow && clearRow.label.toLowerCase().includes(q);\n\n /**\n * \"Select every match\" — the row that makes a typed prefix a filter clause\n * rather than a way to find one item.\n *\n * Areas are named by import path (`lore/quests`, `lore/folios`, `lore/ui`),\n * so the prefix is the meaningful unit and \"everything under lore/\" took\n * eight separate picks (feedback #2009). Typing `lore/` and pressing one row\n * is the whole feature.\n *\n * ⚠️ It resolves to the individual values, deliberately, rather than\n * becoming a pattern the query carries. Two consequences, and both are the\n * point: the caller's schema and endpoint are untouched (a list of values is\n * what they already take), and the chips stay honest - what is filtered is\n * exactly what is shown, so removing one of the eight is an ordinary\n * gesture rather than an escape from a prefix.\n *\n * Only when it would do something: multi-select, a non-empty query, and at\n * least two matches that are not already selected. One match is what\n * pressing the row itself does.\n */\n const unselectedMatches = props.multi\n ? filtered.filter((o) => !o.disabled && !selected.includes(o.value))\n : [];\n\n const selectAllRow: ComboOption | undefined =\n props.multi && q.length > 0 && unselectedMatches.length > 1\n ? {\n value: SELECT_ALL_VALUE,\n label: String(\n tr(\"controlSelect.selectAll\", {\n default: `Select ${unselectedMatches.length} matching \"${query}\"`,\n args: [String(unselectedMatches.length), query],\n }),\n ),\n selectAll: true,\n }\n : undefined;\n\n const items: ComboOption[] = [\n ...(showClear && clearRow ? [clearRow] : []),\n ...(selectAllRow ? [selectAllRow] : []),\n ...filtered,\n ...(createOption ? [createOption] : []),\n ];\n\n // Reconstruct option objects for the controlled value. Base UI matches them\n // back to list items via `isItemEqualToValue` (by `value`), so identity\n // across renders doesn't matter.\n const toValueObject = (val: string): ComboOption =>\n options.find((o) => o.value === val) ?? {\n value: val,\n label: labelFor(val),\n };\n\n const cbValue = props.multi\n ? selected.map(toValueObject)\n : selected[0]\n ? toValueObject(selected[0])\n : // Empty + clearable reads as \"the clear row is what's selected\", so it\n // carries the check mark — same as the native `Select` path.\n (clearRow ?? null);\n\n const remember = (o: ComboOption) => {\n if (o.create) labelCache.current.set(o.value, o.query ?? o.value);\n else labelCache.current.set(o.value, o.label);\n };\n\n const handleSingle = (o: ComboOption | null) => {\n if (!o || o.clear) {\n props.onChange(undefined);\n setQuery(\"\");\n return;\n }\n // Base UI's single-select `Combobox` re-selects on every item press — its\n // `handleSelection` calls `setSelectedValue(itemValue)` unconditionally and\n // never emits `null` — so pressing the checked row was a no-op and an\n // optional field had no way back to empty. Toggle it off here, the way the\n // multi path already does via its chips.\n if (props.deselectable && !o.create && selected[0] === o.value) {\n props.onChange(undefined);\n setQuery(\"\");\n return;\n }\n remember(o);\n props.onChange(props.coerce(o.value));\n setQuery(\"\");\n };\n\n const handleMulti = (list: ComboOption[]) => {\n // The \"select every match\" row arrives here as one more selected item.\n // Swap it for the values it stands for, so the sentinel never leaves this\n // component and the chips show the real areas rather than a prefix.\n const expanded = list.flatMap((o) =>\n o.selectAll ? unselectedMatches : [o],\n );\n // Base UI can hand the same option back twice when the expansion overlaps\n // something already selected.\n const seen = new Set<string>();\n const unique = expanded.filter((o) =>\n seen.has(o.value) ? false : (seen.add(o.value), true),\n );\n for (const o of unique) remember(o);\n props.onChange(unique.map((o) => props.coerce(o.value)));\n setQuery(\"\");\n };\n\n const emptyLabel =\n props.placeholder ?? tr(\"controlSelect.select\", { default: \"Select…\" });\n\n /**\n * Value, then count.\n *\n * One selection names itself; two or more collapse to a count. That is what\n * keeps a filter row at a FIXED width: chips grew the trigger with every\n * pick and then truncated, so the control both moved its neighbours and\n * stopped saying what it was filtering on. A count does neither, and the\n * single-selection case — much the commonest — still reads as the value.\n */\n const triggerLabel = props.multi\n ? selected.length === 0\n ? emptyLabel\n : selected.length === 1\n ? labelFor(selected[0])\n : (props.countLabel?.(selected.length) ??\n String(\n tr(\"controlSelect.count\", {\n default: `${selected.length} selected`,\n args: [String(selected.length)],\n }),\n ))\n : selected[0]\n ? labelFor(selected[0])\n : emptyLabel;\n\n // The list (loading / empty / items) is identical for single and multi, and\n // so is the trigger now, so render it once.\n const popupBody = props.loading ? (\n <div className=\"text-muted-foreground flex items-center justify-center gap-2 p-4 text-sm\">\n <Loader2 className=\"size-4 animate-spin\" />{\" \"}\n {tr(\"controlSelect.loading\", { default: \"Loading…\" })}\n </div>\n ) : (\n <>\n <ComboboxEmpty>\n {props.createNewEntry\n ? \"\"\n : tr(\"controlSelect.noResults\", { default: \"No results.\" })}\n </ComboboxEmpty>\n <ComboboxList>\n {(opt: ComboOption) =>\n opt.selectAll ? (\n <ComboboxItem key=\"__select_all__\" value={opt}>\n <ListChecks className=\"mr-2 size-4 shrink-0\" />\n <span className=\"truncate font-medium\">{opt.label}</span>\n </ComboboxItem>\n ) : opt.create ? (\n <ComboboxItem key={`__create__${opt.value}`} value={opt}>\n <span className=\"mr-2\">+</span>\n {tr(\"controlSelect.create\", {\n default: `Create \"${opt.query}\"`,\n args: [String(opt.query ?? \"\")],\n })}\n </ComboboxItem>\n ) : (\n <ComboboxItem key={opt.value} value={opt} disabled={opt.disabled}>\n {opt.icon && (\n <span className=\"mr-2 flex shrink-0 items-center\">\n {opt.icon}\n </span>\n )}\n <div className=\"flex min-w-0 flex-1 flex-col\">\n <div className=\"flex items-center gap-1.5\">\n {opt.tag && (\n <span className=\"bg-muted text-muted-foreground rounded px-1 text-[10px] tracking-wide uppercase\">\n {opt.tag}\n </span>\n )}\n <span className=\"truncate\">{opt.label}</span>\n </div>\n {opt.description && (\n <span className=\"text-muted-foreground truncate text-xs\">\n {opt.description}\n </span>\n )}\n </div>\n </ComboboxItem>\n )\n }\n </ComboboxList>\n </>\n );\n\n return (\n <ComboboxRoot\n items={items as never}\n multiple={props.multi}\n disabled={props.disabled}\n value={cbValue as never}\n onValueChange={\n (props.multi\n ? (v: ComboOption[]) => handleMulti(v)\n : (v: ComboOption | null) => handleSingle(v)) as never\n }\n isItemEqualToValue={\n ((a: ComboOption, b: ComboOption) => a.value === b.value) as never\n }\n filter={null}\n // Base UI leaves `autoHighlight` off by default, so nothing is\n // highlighted while typing and Enter has no target — the user has to\n // click a row (including the `createNewEntry` one). Highlighting the\n // first match makes Enter pick it, which is what a search field is\n // expected to do. It only engages while the query is non-empty, so\n // opening the popup still starts with no preselection.\n autoHighlight\n onInputValueChange={(v) => {\n setQuery(v);\n props.onSearch?.(v);\n }}\n >\n {/* One trigger for single AND multi. Multi used to render a bordered\n chips box instead, which made it a different-looking control for the\n same job, grew with every pick, and forced a search field on because\n the chips input was the only way to open the popup. */}\n <ComboboxTrigger\n id={props.id}\n disabled={props.disabled}\n {...props.triggerProps}\n className={cn(\n \"border-input focus-visible:border-ring focus-visible:ring-ring/50 dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between rounded-lg border bg-transparent whitespace-nowrap transition-colors outline-none select-none focus-visible:ring-3 disabled:cursor-not-allowed disabled:opacity-50\",\n sizeClasses.trigger,\n sizeClasses.chevron,\n props.minimal && MINIMAL_CLASSES,\n // Muted means \"nothing chosen yet\".\n //\n // For MULTI that is simply \"no selection\": there is no clear row to\n // stand in for it, so empty is empty and the placeholder is shown in\n // placeholder colour.\n //\n // For SINGLE it is only true without a clear row. WITH one, empty is\n // a selected value — the popup already puts the check mark on it\n // (see `cbValue`), and the native `Select` path renders the same\n // state in full contrast because it makes the clear label a genuine\n // `selectedValue`. Muting there made one `clearable` filter look\n // unset and its neighbour look set for the same meaning, purely\n // because the option count crossed the threshold that picks between\n // the two paths.\n selected.length === 0 &&\n (props.multi || !props.clearable) &&\n \"text-muted-foreground\",\n props.triggerClassName,\n )}\n >\n <span className=\"flex min-w-0 items-center gap-2\">\n {props.icon && (\n <props.icon\n className={cn(\"text-muted-foreground shrink-0\", sizeClasses.icon)}\n />\n )}\n <span className=\"truncate\">{triggerLabel}</span>\n </span>\n </ComboboxTrigger>\n <ComboboxContent>\n {props.searchable && (\n <ComboboxInput showTrigger={false} placeholder=\"Search…\" />\n )}\n {popupBody}\n </ComboboxContent>\n </ComboboxRoot>\n );\n}\n\nconst useAsyncLoader = (\n loader: ControlSelectProps[\"loader\"],\n threshold: number,\n debounceMs: number,\n defaultValue: unknown,\n) => {\n const [data, setData] = useState<SelectOption[]>([]);\n const [loading, setLoading] = useState(false);\n const [mode, setMode] = useState<LoaderMode>(\"static\");\n const cache = useRef(new Map<string, SelectOption[]>());\n\n useAction(\n {\n // `id`, not `name`: `id` is what useAction threads into its\n // react:action:* events. `name` was accepted and never read, so this\n // identifier reached nothing.\n id: \"select:loader:init\",\n runOnInit: true,\n handler: async () => {\n if (!loader) {\n setMode(\"static\");\n return;\n }\n setLoading(true);\n try {\n const result = await loader(\"\");\n const isShort = result.length <= threshold;\n setMode(isShort ? \"short\" : \"long\");\n cache.current.set(\"\", result);\n setData(result);\n\n // Coercion at a boundary: the value is a form/route/chart primitive whose\n // declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n if (!isShort && defaultValue != null && String(defaultValue) !== \"\") {\n // Coercion at a boundary: the value is a form/route/chart primitive whose\n // declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string\n const resolved = await loader(\"\", [String(defaultValue)]);\n if (resolved.length > 0) {\n setData((prev) => {\n const existing = new Set(prev.map(optValue));\n const fresh = resolved.filter(\n (r) => !existing.has(optValue(r)),\n );\n return [...prev, ...fresh];\n });\n }\n }\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, threshold],\n );\n\n const search = useAction<[string]>(\n {\n debounce: debounceMs,\n handler: async (text) => {\n if (!loader || mode !== \"long\") return;\n if (cache.current.has(text)) {\n setData(cache.current.get(text)!);\n return;\n }\n setLoading(true);\n try {\n const result = await loader(text);\n cache.current.set(text, result);\n setData(result);\n } finally {\n setLoading(false);\n }\n },\n },\n [loader, mode, debounceMs],\n );\n\n return { data, loading, mode, search };\n};\n"],"mapp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KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,YAAY,UAAW,iBAAiB,sBA4HpD,CAAC"}
|
|
@@ -84,13 +84,16 @@ const DetailLayout = (props) => {
|
|
|
84
84
|
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
85
85
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
86
86
|
className: "bg-background flex h-14 shrink-0 items-center gap-2 border-b px-4",
|
|
87
|
-
children: [/* @__PURE__ */ jsx(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
88
|
+
className: "min-w-0 overflow-x-auto py-1",
|
|
89
|
+
children: /* @__PURE__ */ jsx(Segmented, {
|
|
90
|
+
size: "lg",
|
|
91
|
+
options,
|
|
92
|
+
value: props.tab,
|
|
93
|
+
onChange: props.onTabChange
|
|
94
|
+
})
|
|
92
95
|
}), props.actions ? /* @__PURE__ */ jsx("div", {
|
|
93
|
-
className: "ml-auto flex items-center gap-2",
|
|
96
|
+
className: "ml-auto flex shrink-0 items-center gap-2",
|
|
94
97
|
children: props.actions
|
|
95
98
|
}) : null]
|
|
96
99
|
}), props.children]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detail-layout.js","names":[],"sources":["../../../src/components/detail/detail-layout.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Segmented } from \"@alepha/ui/components/ui/segmented\";\nimport { Skeleton } from \"@alepha/ui/components/ui/skeleton\";\nimport { ArrowLeft } from \"lucide-react\";\nimport type { ComponentType, SVGProps } from \"react\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface DetailTab {\n value: string;\n label: React.ReactNode;\n /**\n * A trailing count. Passed through to `Segmented`, which colours it from\n * the segment's own state — see {@link SegmentedOption.count} for why a\n * count folded into `label` cannot be read on the active tab.\n */\n count?: React.ReactNode;\n /**\n * Rendered at `size-4` before the label. Passed as a component rather than\n * an element so callers hand over data — every detail page used to repeat\n * the same `inline-flex items-center gap-1.5` wrapper by hand.\n */\n icon?: IconType;\n}\n\nexport interface DetailNotFound {\n message: string;\n backLabel: string;\n onBack: () => void;\n}\n\nexport interface DetailLayoutProps {\n /**\n * The identity panel. Usually an {@link DetailAside}.\n */\n aside: React.ReactNode;\n tabs: DetailTab[];\n tab: string;\n onTabChange: (value: string) => void;\n /**\n * Buttons for the right end of the toolbar.\n *\n * Size them `lg`. `Segmented`'s size tokens are cut to match a `<Button>`\n * of the same token exactly, the tab selector on the left of this bar is\n * `lg`, and nothing here can size what a caller passes: a `sm` button\n * beside it is 28px against 36px, both centred in a 56px bar, and the two\n * ends of the toolbar stop lining up.\n */\n actions?: React.ReactNode;\n /**\n * Replaces the whole shell with a skeleton. Pass it only for the first load —\n * a refetch that blanks the page an operator is reading is a regression, so\n * a caller should gate this on \"loading **and** no data yet\".\n */\n loading?: boolean;\n /**\n * Replaces the whole shell with a message and a way back.\n */\n notFound?: DetailNotFound;\n children?: React.ReactNode;\n}\n\n/**\n * The shell every detail page shares: a full-height identity aside, and a\n * right column whose toolbar carries tab selection on the left and actions on\n * the right.\n *\n * It lived at `components/admin/admin-detail-layout` while admin pages were\n * its only consumers, and moved here when Lore's Epic page became the first\n * one outside admin. Nothing about it was ever admin-specific — it imports a\n * button, a segmented control and a skeleton — so the old name described the\n * callers rather than the component. There is deliberately **no re-export\n * left behind at the old path**: an alias nobody is forced to notice is an\n * alias nobody removes.\n *\n * It owns the chrome and nothing else. Data, forms and mutations stay in the\n * page that composes it, and each tab body is its own component that renders\n * what it is given — the split that keeps a detail page from growing into one\n * unreadable file.\n *\n * The aside is hidden below `md`. A phone gets the tabs full width rather than\n * a 288px column and a sliver of content; the same facts are reachable from\n * the tab bodies.\n *\n * ```tsx\n * const [tab, setTab] = useDetailTab<\"overview\" | \"stock\">(\"overview\");\n *\n * <DetailLayout\n * aside={<DetailAside title={product.name} rows={rows} />}\n * tabs={[{ value: \"overview\", label: \"Overview\", icon: Package }]}\n * tab={tab}\n * onTabChange={(v) => setTab(v as typeof tab)}\n * actions={<Button size=\"sm\">Publish</Button>}\n * >\n * {tab === \"overview\" && <OverviewTab product={product} />}\n * </DetailLayout>\n * ```\n *\n * Dialogs belong beside it, not inside `children` — they portal out anyway,\n * and nesting them in the tab body unmounts them on a tab switch.\n */\nexport const DetailLayout = (props: DetailLayoutProps) => {\n if (props.loading) {\n return (\n <div className=\"flex flex-col gap-4 p-6\">\n <Skeleton className=\"h-10 w-72\" />\n <Skeleton className=\"h-40 w-full\" />\n <Skeleton className=\"h-40 w-full\" />\n </div>\n );\n }\n\n if (props.notFound) {\n return (\n <div className=\"flex flex-col items-start gap-3 p-6\">\n <p className=\"text-muted-foreground text-sm\">\n {props.notFound.message}\n </p>\n <Button variant=\"outline\" onClick={props.notFound.onBack}>\n <ArrowLeft className=\"size-4\" />\n {props.notFound.backLabel}\n </Button>\n </div>\n );\n }\n\n const options = props.tabs.map((entry) => {\n const Icon = entry.icon;\n return {\n value: entry.value,\n count: entry.count,\n label: Icon ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <Icon className=\"size-4\" />\n {entry.label}\n </span>\n ) : (\n entry.label\n ),\n };\n });\n\n return (\n <div className=\"flex h-full min-h-0 flex-1 overflow-hidden\">\n {/* `p-4`, not `p-6`. The aside is a fixed 288px, so its padding comes\n straight out of the identity panel's width: at 24px a side the\n `DetailAside` card had 240px to fit a label, a value and sometimes\n a copy button, and read as undersized in a column that had room to\n spare. 16px gives it back 16px of card without letting the content\n touch the border. */}\n <aside className=\"border-border bg-background hidden w-72 shrink-0 flex-col gap-4 overflow-auto border-r p-4 md:flex\">\n {props.aside}\n </aside>\n\n {/* `min-w-0` is not decoration, and it is the horizontal twin of the\n `min-h-0` beside it. This column is a flex item on the row's\n horizontal main axis, so `min-width: auto` resolves to its content's\n min-content width and it refuses to shrink below it. A tab body\n wider than the viewport (the Questline board is `w-max`) then\n stretches this column past the viewport instead of overflowing\n inside it: the body's own `overflow-auto` sees a box as wide as its\n content and never scrolls, and the row's `overflow-hidden` simply\n clips whatever is past the edge, with no scrollbar to reach it.\n Measured on a 1276px viewport with a 16-card questline: without it\n the column is 3160px and `scrollWidth === clientWidth`; with it the\n column is 988px and the body scrolls 2172px. */}\n <div className=\"flex min-h-0 min-w-0 flex-1 flex-col\">\n <div className=\"bg-background flex h-14 shrink-0 items-center gap-2 border-b px-4\">\n {/* `lg` (h-9), not the `sm` (h-7) this started on. The toolbar is\n `h-14`, so at 28px the control filled exactly half of it and\n read as a small thing floating in a tall bar.\n\n This does give up the pixel-for-pixel match with the toolbar's\n action buttons: all three consumers pass `size=\"sm\"`, so the\n two were the same 28px before and are 28 vs 36 now. The match\n only ever held because both happened to pick the same token,\n and `actions` is caller JSX this component cannot size, so any\n increase here breaks it. Both are centred in a 56px bar, which\n is why 8px of difference does not show. */}\n <Segmented\n size=\"lg\"\n options={options}\n value={props.tab}\n onChange={props.onTabChange}\n />\n {props.actions ? (\n <div className=\"ml-auto flex items-center gap-2\">\n {props.actions}\n </div>\n ) : null}\n </div>\n {props.children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAa,gBAAgB,UAA6B;CACxD,IAAI,MAAM,SACR,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,oBAAC,UAAD,EAAU,WAAU,YAAa,CAAA;GACjC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;GACnC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;EAChC;;CAIT,IAAI,MAAM,UACR,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,KAAD;GAAG,WAAU;GACV,UAAA,MAAM,SAAS;EACf,CAAA,GACH,qBAAC,QAAD;GAAQ,SAAQ;GAAU,SAAS,MAAM,SAAS;GAAlD,UAAA,CACE,oBAAC,WAAD,EAAW,WAAU,SAAU,CAAA,GAC9B,MAAM,SAAS,SACV;EACL,CAAA,CAAA;;CAIT,MAAM,UAAU,MAAM,KAAK,KAAK,UAAU;EACxC,MAAM,OAAO,MAAM;EACnB,OAAO;GACL,OAAO,MAAM;GACb,OAAO,MAAM;GACb,OAAO,OACL,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,MAAD,EAAM,WAAU,SAAU,CAAA,GACzB,MAAM,KACH;GAEN,CAAA,IAAA,MAAM;EAEV;CACF,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CAOE,oBAAC,SAAD;GAAO,WAAU;GACd,UAAA,MAAM;EACF,CAAA,GAcP,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CAYE,oBAAC,WAAD;KACE,MAAK;KACI;KACT,OAAO,MAAM;KACb,UAAU,MAAM;IACjB,CAAA,GACA,MAAM,UACL,oBAAC,OAAD;KAAK,WAAU;KACZ,UAAA,MAAM;IACJ,CAAA,IACH,IACD;GACJ,CAAA,GAAA,MAAM,QACJ;EACF,CAAA,CAAA;;AAET"}
|
|
1
|
+
{"version":3,"file":"detail-layout.js","names":[],"sources":["../../../src/components/detail/detail-layout.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport { Segmented } from \"@alepha/ui/components/ui/segmented\";\nimport { Skeleton } from \"@alepha/ui/components/ui/skeleton\";\nimport { ArrowLeft } from \"lucide-react\";\nimport type { ComponentType, SVGProps } from \"react\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface DetailTab {\n value: string;\n label: React.ReactNode;\n /**\n * A trailing count. Passed through to `Segmented`, which colours it from\n * the segment's own state — see {@link SegmentedOption.count} for why a\n * count folded into `label` cannot be read on the active tab.\n */\n count?: React.ReactNode;\n /**\n * Rendered at `size-4` before the label. Passed as a component rather than\n * an element so callers hand over data — every detail page used to repeat\n * the same `inline-flex items-center gap-1.5` wrapper by hand.\n */\n icon?: IconType;\n}\n\nexport interface DetailNotFound {\n message: string;\n backLabel: string;\n onBack: () => void;\n}\n\nexport interface DetailLayoutProps {\n /**\n * The identity panel. Usually an {@link DetailAside}.\n */\n aside: React.ReactNode;\n tabs: DetailTab[];\n tab: string;\n onTabChange: (value: string) => void;\n /**\n * Buttons for the right end of the toolbar.\n *\n * Size them `lg`. `Segmented`'s size tokens are cut to match a `<Button>`\n * of the same token exactly, the tab selector on the left of this bar is\n * `lg`, and nothing here can size what a caller passes: a `sm` button\n * beside it is 28px against 36px, both centred in a 56px bar, and the two\n * ends of the toolbar stop lining up.\n */\n actions?: React.ReactNode;\n /**\n * Replaces the whole shell with a skeleton. Pass it only for the first load —\n * a refetch that blanks the page an operator is reading is a regression, so\n * a caller should gate this on \"loading **and** no data yet\".\n */\n loading?: boolean;\n /**\n * Replaces the whole shell with a message and a way back.\n */\n notFound?: DetailNotFound;\n children?: React.ReactNode;\n}\n\n/**\n * The shell every detail page shares: a full-height identity aside, and a\n * right column whose toolbar carries tab selection on the left and actions on\n * the right.\n *\n * It lived at `components/admin/admin-detail-layout` while admin pages were\n * its only consumers, and moved here when Lore's Epic page became the first\n * one outside admin. Nothing about it was ever admin-specific — it imports a\n * button, a segmented control and a skeleton — so the old name described the\n * callers rather than the component. There is deliberately **no re-export\n * left behind at the old path**: an alias nobody is forced to notice is an\n * alias nobody removes.\n *\n * It owns the chrome and nothing else. Data, forms and mutations stay in the\n * page that composes it, and each tab body is its own component that renders\n * what it is given — the split that keeps a detail page from growing into one\n * unreadable file.\n *\n * The aside is hidden below `md`. A phone gets the tabs full width rather than\n * a 288px column and a sliver of content; the same facts are reachable from\n * the tab bodies.\n *\n * ```tsx\n * const [tab, setTab] = useDetailTab<\"overview\" | \"stock\">(\"overview\");\n *\n * <DetailLayout\n * aside={<DetailAside title={product.name} rows={rows} />}\n * tabs={[{ value: \"overview\", label: \"Overview\", icon: Package }]}\n * tab={tab}\n * onTabChange={(v) => setTab(v as typeof tab)}\n * actions={<Button size=\"sm\">Publish</Button>}\n * >\n * {tab === \"overview\" && <OverviewTab product={product} />}\n * </DetailLayout>\n * ```\n *\n * Dialogs belong beside it, not inside `children` — they portal out anyway,\n * and nesting them in the tab body unmounts them on a tab switch.\n */\nexport const DetailLayout = (props: DetailLayoutProps) => {\n if (props.loading) {\n return (\n <div className=\"flex flex-col gap-4 p-6\">\n <Skeleton className=\"h-10 w-72\" />\n <Skeleton className=\"h-40 w-full\" />\n <Skeleton className=\"h-40 w-full\" />\n </div>\n );\n }\n\n if (props.notFound) {\n return (\n <div className=\"flex flex-col items-start gap-3 p-6\">\n <p className=\"text-muted-foreground text-sm\">\n {props.notFound.message}\n </p>\n <Button variant=\"outline\" onClick={props.notFound.onBack}>\n <ArrowLeft className=\"size-4\" />\n {props.notFound.backLabel}\n </Button>\n </div>\n );\n }\n\n const options = props.tabs.map((entry) => {\n const Icon = entry.icon;\n return {\n value: entry.value,\n count: entry.count,\n label: Icon ? (\n <span className=\"inline-flex items-center gap-1.5\">\n <Icon className=\"size-4\" />\n {entry.label}\n </span>\n ) : (\n entry.label\n ),\n };\n });\n\n return (\n <div className=\"flex h-full min-h-0 flex-1 overflow-hidden\">\n {/* `p-4`, not `p-6`. The aside is a fixed 288px, so its padding comes\n straight out of the identity panel's width: at 24px a side the\n `DetailAside` card had 240px to fit a label, a value and sometimes\n a copy button, and read as undersized in a column that had room to\n spare. 16px gives it back 16px of card without letting the content\n touch the border. */}\n <aside className=\"border-border bg-background hidden w-72 shrink-0 flex-col gap-4 overflow-auto border-r p-4 md:flex\">\n {props.aside}\n </aside>\n\n {/* `min-w-0` is not decoration, and it is the horizontal twin of the\n `min-h-0` beside it. This column is a flex item on the row's\n horizontal main axis, so `min-width: auto` resolves to its content's\n min-content width and it refuses to shrink below it. A tab body\n wider than the viewport (the Questline board is `w-max`) then\n stretches this column past the viewport instead of overflowing\n inside it: the body's own `overflow-auto` sees a box as wide as its\n content and never scrolls, and the row's `overflow-hidden` simply\n clips whatever is past the edge, with no scrollbar to reach it.\n Measured on a 1276px viewport with a 16-card questline: without it\n the column is 3160px and `scrollWidth === clientWidth`; with it the\n column is 988px and the body scrolls 2172px. */}\n <div className=\"flex min-h-0 min-w-0 flex-1 flex-col\">\n <div className=\"bg-background flex h-14 shrink-0 items-center gap-2 border-b px-4\">\n {/* `lg` (h-9), not the `sm` (h-7) this started on. The toolbar is\n `h-14`, so at 28px the control filled exactly half of it and\n read as a small thing floating in a tall bar.\n\n This does give up the pixel-for-pixel match with the toolbar's\n action buttons: all three consumers pass `size=\"sm\"`, so the\n two were the same 28px before and are 28 vs 36 now. The match\n only ever held because both happened to pick the same token,\n and `actions` is caller JSX this component cannot size, so any\n increase here breaks it. Both are centred in a 56px bar, which\n is why 8px of difference does not show. */}\n {/* ⚠️ `min-w-0 overflow-x-auto` around the tab strip, and `shrink-0`\n on the actions. Without them the row is a non-wrapping flex line\n whose items refuse to shrink below their `whitespace-nowrap`\n min-content width, while the ancestor two levels up is\n `overflow-hidden` (deliberately, see the comment above it) and\n this row is `overflow-x: visible`. Everything past the right edge\n was therefore CLIPPED, with no scrollbar and no way to reach it.\n\n Measured on the epic view at 411x845: the row was 409 wide with a\n 648 scrollWidth, and `Folios`, `Edit` and `Begin the Epic` - the\n page's primary action - were all off-screen and unclickable. 768px\n was worse, not better, because the 288px aside returns at `md`.\n\n The two classes split the row's shortfall deliberately. The tab\n strip is a bounded list this component owns, so it takes the\n scrolling; the actions are caller JSX this component cannot size\n (as the comment above already says), so they keep their full width\n and stay clickable. A tab strip that scrolls is a known phone\n pattern; a primary action hidden behind a scroll is not.\n\n The `no-scrollbar` class used elsewhere in this package is not\n defined anywhere in the repo, so the thin scrollbar shows - which\n is the affordance saying there is more to the right.\n\n `py-1` is not spacing: `overflow-x: auto` makes the computed\n `overflow-y` `auto` too, and without 4px of slack the segment's\n 3px focus ring is clipped top and bottom. The row is\n `items-center` in a fixed 56px bar, so it costs no height. */}\n <div className=\"min-w-0 overflow-x-auto py-1\">\n <Segmented\n size=\"lg\"\n options={options}\n value={props.tab}\n onChange={props.onTabChange}\n />\n </div>\n {props.actions ? (\n <div className=\"ml-auto flex shrink-0 items-center gap-2\">\n {props.actions}\n </div>\n ) : null}\n </div>\n {props.children}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAa,gBAAgB,UAA6B;CACxD,IAAI,MAAM,SACR,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,oBAAC,UAAD,EAAU,WAAU,YAAa,CAAA;GACjC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;GACnC,oBAAC,UAAD,EAAU,WAAU,cAAe,CAAA;EAChC;;CAIT,IAAI,MAAM,UACR,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,KAAD;GAAG,WAAU;GACV,UAAA,MAAM,SAAS;EACf,CAAA,GACH,qBAAC,QAAD;GAAQ,SAAQ;GAAU,SAAS,MAAM,SAAS;GAAlD,UAAA,CACE,oBAAC,WAAD,EAAW,WAAU,SAAU,CAAA,GAC9B,MAAM,SAAS,SACV;EACL,CAAA,CAAA;;CAIT,MAAM,UAAU,MAAM,KAAK,KAAK,UAAU;EACxC,MAAM,OAAO,MAAM;EACnB,OAAO;GACL,OAAO,MAAM;GACb,OAAO,MAAM;GACb,OAAO,OACL,qBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,oBAAC,MAAD,EAAM,WAAU,SAAU,CAAA,GACzB,MAAM,KACH;GAEN,CAAA,IAAA,MAAM;EAEV;CACF,CAAC;CAED,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CAOE,oBAAC,SAAD;GAAO,WAAU;GACd,UAAA,MAAM;EACF,CAAA,GAcP,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CAwCE,oBAAC,OAAD;KAAK,WAAU;KACb,UAAA,oBAAC,WAAD;MACE,MAAK;MACI;MACT,OAAO,MAAM;MACb,UAAU,MAAM;KACjB,CAAA;IACE,CAAA,GACJ,MAAM,UACL,oBAAC,OAAD;KAAK,WAAU;KACZ,UAAA,MAAM;IACJ,CAAA,IACH,IACD;GACJ,CAAA,GAAA,MAAM,QACJ;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MermaidFence.d.ts","sourceRoot":"","sources":["../../../../src/components/markdown-view/diagram/MermaidFence.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MermaidFence.d.ts","sourceRoot":"","sources":["../../../../src/components/markdown-view/diagram/MermaidFence.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,YAAY,UAAW,iBAAiB,sBAoBpD,CAAC;eAIa,YAAY"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FlowchartDiagram } from "./FlowchartDiagram.js";
|
|
2
|
+
import { diagramKind } from "./diagramKind.js";
|
|
2
3
|
import { parseFlowchart } from "./flowchartParser.js";
|
|
3
4
|
import { layoutFlowchart } from "./layoutFlowchart.js";
|
|
4
5
|
import { layoutSequence } from "./layoutSequence.js";
|
|
@@ -44,21 +45,6 @@ const MermaidFence = (props) => {
|
|
|
44
45
|
}
|
|
45
46
|
return /* @__PURE__ */ jsx(Fragment$1, { children: props.fallback });
|
|
46
47
|
};
|
|
47
|
-
/**
|
|
48
|
-
* Which pipeline a fence belongs to, from its header line.
|
|
49
|
-
*
|
|
50
|
-
* The header is the first line that is not YAML frontmatter, a
|
|
51
|
-
* `%%{init: …}%%` directive or a `%%` comment - mermaid allows all three
|
|
52
|
-
* above it. Both parsers check their own header again, because both are
|
|
53
|
-
* independently callable; this exists so an unsupported diagram type never
|
|
54
|
-
* enters a parser at all.
|
|
55
|
-
*/
|
|
56
|
-
const diagramKind = (source) => {
|
|
57
|
-
const header = source.replace(/^\s*---\r?\n[\s\S]*?\r?\n---\r?\n/, "").replace(/%%\{[\s\S]*?\}%%/g, "").split(/\r?\n/).map((line) => line.replace(/%%.*$/, "").trim()).find(Boolean);
|
|
58
|
-
if (!header) return void 0;
|
|
59
|
-
if (/^sequenceDiagram\b/i.test(header)) return "sequence";
|
|
60
|
-
if (/^(?:flowchart|graph)\b/i.test(header)) return "flowchart";
|
|
61
|
-
};
|
|
62
48
|
//#endregion
|
|
63
49
|
export { MermaidFence, MermaidFence as default };
|
|
64
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MermaidFence.js","names":[],"sources":["../../../../src/components/markdown-view/diagram/MermaidFence.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ReactNode } from \"react\";\n\nimport { FlowchartDiagram } from \"./FlowchartDiagram.tsx\";\nimport { parseFlowchart } from \"./flowchartParser.ts\";\nimport { layoutFlowchart } from \"./layoutFlowchart.ts\";\nimport { layoutSequence } from \"./layoutSequence.ts\";\nimport { SequenceDiagram } from \"./SequenceDiagram.tsx\";\nimport { parseSequence } from \"./sequenceParser.ts\";\n\nexport interface MermaidFenceProps {\n /**\n * The raw text between the fence markers.\n */\n source: string;\n /**\n * What to render when the source is not a diagram we can draw. Always the\n * code block the fence would otherwise have produced.\n */\n fallback: ReactNode;\n}\n\n/**\n * The lazy chunk's entry point, and the dispatcher between the two\n * pipelines: read the header, parse, lay out, draw - or hand back the fence\n * untouched.\n *\n * This is the ONLY module that pulls in either parser, `graphre` and either\n * emitter, and it is imported through `lazy()` from `markdown-view.tsx`.\n * That is the whole constraint the diagram layer lives under: a document\n * with no diagram must pay nothing at all.\n *\n * **The two pipelines are parallel, not shared.** A flowchart ranks a node\n * graph and needs a layout library; a sequence diagram has both axes\n * decided by source order and needs none. Lifelines, ordered messages and\n * fragment boxes have essentially nothing in common with nodes, edges and\n * clusters, so one model type for both would make both halves worse. What\n * they do share is the text metrics, the theming, the marker namespacing,\n * the error boundary and the policy below.\n *\n * **Failure is always the code block, silently.** A parse failure, a\n * refused construct, a diagram past its cap, and a `classDiagram` all land\n * here identically. Agents write invalid mermaid, and a red error box in\n * the middle of a folio is worse than a grey fence.\n */\nexport const MermaidFence = (props: MermaidFenceProps) => {\n const kind = diagramKind(props.source);\n\n if (kind === \"sequence\") {\n const model = parseSequence(props.source);\n const diagram = model ? layoutSequence(model) : undefined;\n return diagram ? (\n <SequenceDiagram diagram={diagram} />\n ) : (\n <>{props.fallback}</>\n );\n }\n\n if (kind === \"flowchart\") {\n const model = parseFlowchart(props.source);\n const graph = model ? layoutFlowchart(model) : undefined;\n return graph ? <FlowchartDiagram graph={graph} /> : <>{props.fallback}</>;\n }\n\n return <>{props.fallback}</>;\n};\n\n
|
|
1
|
+
{"version":3,"file":"MermaidFence.js","names":[],"sources":["../../../../src/components/markdown-view/diagram/MermaidFence.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ReactNode } from \"react\";\n\nimport { diagramKind } from \"./diagramKind.ts\";\nimport { FlowchartDiagram } from \"./FlowchartDiagram.tsx\";\nimport { parseFlowchart } from \"./flowchartParser.ts\";\nimport { layoutFlowchart } from \"./layoutFlowchart.ts\";\nimport { layoutSequence } from \"./layoutSequence.ts\";\nimport { SequenceDiagram } from \"./SequenceDiagram.tsx\";\nimport { parseSequence } from \"./sequenceParser.ts\";\n\nexport interface MermaidFenceProps {\n /**\n * The raw text between the fence markers.\n */\n source: string;\n /**\n * What to render when the source is not a diagram we can draw. Always the\n * code block the fence would otherwise have produced.\n */\n fallback: ReactNode;\n}\n\n/**\n * The lazy chunk's entry point, and the dispatcher between the two\n * pipelines: read the header, parse, lay out, draw - or hand back the fence\n * untouched.\n *\n * This is the ONLY module that pulls in either parser, `graphre` and either\n * emitter, and it is imported through `lazy()` from `markdown-view.tsx`.\n * That is the whole constraint the diagram layer lives under: a document\n * with no diagram must pay nothing at all.\n *\n * **The two pipelines are parallel, not shared.** A flowchart ranks a node\n * graph and needs a layout library; a sequence diagram has both axes\n * decided by source order and needs none. Lifelines, ordered messages and\n * fragment boxes have essentially nothing in common with nodes, edges and\n * clusters, so one model type for both would make both halves worse. What\n * they do share is the text metrics, the theming, the marker namespacing,\n * the error boundary and the policy below.\n *\n * **Failure is always the code block, silently.** A parse failure, a\n * refused construct, a diagram past its cap, and a `classDiagram` all land\n * here identically. Agents write invalid mermaid, and a red error box in\n * the middle of a folio is worse than a grey fence.\n */\nexport const MermaidFence = (props: MermaidFenceProps) => {\n const kind = diagramKind(props.source);\n\n if (kind === \"sequence\") {\n const model = parseSequence(props.source);\n const diagram = model ? layoutSequence(model) : undefined;\n return diagram ? (\n <SequenceDiagram diagram={diagram} />\n ) : (\n <>{props.fallback}</>\n );\n }\n\n if (kind === \"flowchart\") {\n const model = parseFlowchart(props.source);\n const graph = model ? layoutFlowchart(model) : undefined;\n return graph ? <FlowchartDiagram graph={graph} /> : <>{props.fallback}</>;\n }\n\n return <>{props.fallback}</>;\n};\n\n// Default export as well, so the `lazy()` call site stays a bare\n// `import(...)` with no `.then(m => ({ default: m.X }))` wrapper.\nexport default MermaidFence;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,gBAAgB,UAA6B;CACxD,MAAM,OAAO,YAAY,MAAM,MAAM;CAErC,IAAI,SAAS,YAAY;EACvB,MAAM,QAAQ,cAAc,MAAM,MAAM;EACxC,MAAM,UAAU,QAAQ,eAAe,KAAK,IAAI,KAAA;EAChD,OAAO,UACL,oBAAC,iBAAD,EAA0B,QAAU,CAAA,IAEpC,oBAAA,YAAA,EAAA,UAAG,MAAM,SAAW,CAAA;CAExB;CAEA,IAAI,SAAS,aAAa;EACxB,MAAM,QAAQ,eAAe,MAAM,MAAM;EACzC,MAAM,QAAQ,QAAQ,gBAAgB,KAAK,IAAI,KAAA;EAC/C,OAAO,QAAQ,oBAAC,kBAAD,EAAyB,MAAQ,CAAA,IAAI,oBAAA,YAAA,EAAA,UAAG,MAAM,SAAW,CAAA;CAC1E;CAEA,OAAO,oBAAA,YAAA,EAAA,UAAG,MAAM,SAAW,CAAA;AAC7B"}
|