@alepha/ui 0.33.0 → 0.35.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/account/$pageAccount.js +1 -2
- package/dist/account/AccountBackToSiteMenuItem.js +1 -2
- package/dist/account/AccountBrand.js +1 -2
- package/dist/account/AccountConnections.js +1 -2
- package/dist/account/AccountDeleteDialog.js +2 -3
- package/dist/account/AccountKeys.js +3 -4
- package/dist/account/AccountLayout.js +4 -5
- package/dist/account/AccountMfaDialog.js +2 -3
- package/dist/account/AccountPage.js +1 -2
- package/dist/account/AccountPasswordDialog.js +2 -3
- package/dist/account/AccountProfile.js +3 -4
- package/dist/account/AccountRecoveryCodes.js +2 -3
- package/dist/account/AccountRecoveryCodesDialog.js +1 -2
- package/dist/account/AccountRouter.js +1 -2
- package/dist/account/AccountRouterOptions.js +1 -2
- package/dist/account/AccountSecurity.js +6 -7
- package/dist/account/AccountSessions.js +1 -2
- package/dist/account/ApiKeyCreateDialog.js +2 -3
- package/dist/account/ApiKeyScopeMatrix.js +1 -2
- package/dist/account/ApiKeyScopeSummary.js +1 -2
- package/dist/account/ApiKeyStatusBadge.js +1 -2
- package/dist/account/index.js +5 -5
- package/dist/admin/$pageAdmin.js +1 -2
- package/dist/admin/AdminAnalytics.js +1 -2
- package/dist/admin/AdminAudits.js +2 -3
- package/dist/admin/AdminAudits.js.map +1 -1
- package/dist/admin/AdminDashboard.js +2 -3
- package/dist/admin/AdminDashboardCountCard.js +1 -2
- package/dist/admin/AdminFiles.js +5 -6
- package/dist/admin/AdminFiles.js.map +1 -1
- package/dist/admin/AdminFilesUsage.d.ts.map +1 -1
- package/dist/admin/AdminFilesUsage.js +1 -2
- package/dist/admin/AdminFilesUsage.js.map +1 -1
- package/dist/admin/AdminFilesUsageCard.js +2 -3
- package/dist/admin/AdminJobDetail.js +1 -2
- package/dist/admin/AdminJobDetailAside.js +1 -2
- package/dist/admin/AdminJobDetailExecutions.js +2 -3
- package/dist/admin/AdminJobExecutionLogs.js +1 -2
- package/dist/admin/AdminJobExecutionSheet.js +3 -4
- package/dist/admin/AdminJobs.js +2 -3
- package/dist/admin/AdminJobsPayloadBody.js +1 -2
- package/dist/admin/AdminJobsPayloadDialog.js +1 -2
- package/dist/admin/AdminJobsStatusBadge.js +1 -2
- package/dist/admin/AdminJobsTypeIcon.js +1 -2
- package/dist/admin/AdminKeys.js +6 -7
- package/dist/admin/AdminKeysTokenDialog.js +2 -3
- package/dist/admin/AdminLayout.js +1 -2
- package/dist/admin/AdminNotifications.d.ts.map +1 -1
- package/dist/admin/AdminNotifications.js +6 -7
- package/dist/admin/AdminNotifications.js.map +1 -1
- package/dist/admin/AdminNotificationsDetail.js +1 -2
- package/dist/admin/AdminNotificationsDetailTabs.js +1 -2
- package/dist/admin/AdminNotificationsPreviewBody.js +1 -2
- package/dist/admin/AdminNotificationsPreviewTab.js +1 -2
- package/dist/admin/AdminNotificationsPreviewTab.js.map +1 -1
- package/dist/admin/AdminNotificationsRawTab.js +1 -2
- package/dist/admin/AdminNotificationsStatusBadge.js +1 -2
- package/dist/admin/AdminPage.js +1 -2
- package/dist/admin/AdminParameters.d.ts.map +1 -1
- package/dist/admin/AdminParameters.js +5 -6
- package/dist/admin/AdminParameters.js.map +1 -1
- package/dist/admin/AdminParametersEditorForm.js +1 -2
- package/dist/admin/AdminParametersEditorForm.js.map +1 -1
- package/dist/admin/AdminParametersEditorPane.js +3 -4
- package/dist/admin/AdminParametersEditorPane.js.map +1 -1
- package/dist/admin/AdminParametersHistoryPane.js +2 -3
- package/dist/admin/AdminParametersTreeFooterActions.js +1 -2
- package/dist/admin/AdminParametersTreeNodeView.js +2 -3
- package/dist/admin/AdminParametersTreePane.js +1 -2
- package/dist/admin/AdminPayments.js +2 -3
- package/dist/admin/AdminPaymentsStatusBadge.js +1 -2
- package/dist/admin/AdminRouter.d.ts +3 -2
- package/dist/admin/AdminRouter.d.ts.map +1 -1
- package/dist/admin/AdminRouter.js +1 -2
- package/dist/admin/AdminRouterOptions.js +1 -2
- package/dist/admin/AdminSessions.js +1 -2
- package/dist/admin/AdminUserAvatarControl.js +1 -2
- package/dist/admin/AdminUserCell.js +1 -2
- package/dist/admin/AdminUserDetail.js +2 -3
- package/dist/admin/AdminUserDetailAuditsTab.js +2 -3
- package/dist/admin/AdminUserDetailIdentityAside.js +1 -2
- package/dist/admin/AdminUserDetailOverviewTab.js +1 -2
- package/dist/admin/AdminUserDetailPasswordDialog.js +1 -2
- package/dist/admin/AdminUserDetailSecurityTab.js +3 -4
- package/dist/admin/AdminUserDetailSessionsTab.js +1 -2
- package/dist/admin/AdminUsers.js +3 -4
- package/dist/admin/AdminUsersRolesPicker.js +1 -2
- package/dist/admin/AdminUsersStatusBadge.js +1 -2
- package/dist/admin/EmailBodyFrame.js +1 -2
- package/dist/admin/ParameterDiffDialog.js +2 -3
- package/dist/admin/ParameterHistoryItem.d.ts.map +1 -1
- package/dist/admin/ParameterHistoryItem.js +4 -5
- package/dist/admin/ParameterHistoryItem.js.map +1 -1
- package/dist/admin/ParameterJsonDialog.js +2 -3
- package/dist/admin/ParameterSaveDialog.js +1 -2
- package/dist/admin/adminJobsStatusTones.js +1 -2
- package/dist/admin/adminNotificationsChannelLabel.js +1 -2
- package/dist/admin/adminNotificationsStatusTones.js +1 -2
- package/dist/admin/adminNotificationsTemplateLabel.js +1 -2
- package/dist/admin/adminParametersTree.js +1 -2
- package/dist/admin/adminPaymentsStatusTones.js +1 -2
- package/dist/admin/adminUserDetailPasswordSchema.d.ts +2 -1
- package/dist/admin/adminUserDetailPasswordSchema.d.ts.map +1 -1
- package/dist/admin/adminUserDetailPasswordSchema.js +1 -2
- package/dist/admin/adminUserDetailProfilePolicy.js +1 -2
- package/dist/admin/adminUserDetailProfileSchema.d.ts +7 -7
- package/dist/admin/adminUserDetailProfileSchema.d.ts.map +1 -1
- package/dist/admin/adminUserDetailProfileSchema.js +1 -2
- package/dist/admin/analytics/AdvancedSection.d.ts.map +1 -1
- package/dist/admin/analytics/AdvancedSection.js +9 -6
- package/dist/admin/analytics/AdvancedSection.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChart.d.ts +1 -0
- package/dist/admin/analytics/AnalyticsChart.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChart.js +4 -3
- package/dist/admin/analytics/AnalyticsChart.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChartBars.js +1 -2
- package/dist/admin/analytics/AnalyticsChartDonut.js +1 -2
- package/dist/admin/analytics/AnalyticsChartHeader.d.ts +5 -0
- package/dist/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChartHeader.js +8 -4
- package/dist/admin/analytics/AnalyticsChartHeader.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChartHeat.js +1 -2
- package/dist/admin/analytics/AnalyticsChartLegend.js +1 -2
- package/dist/admin/analytics/AnalyticsChartLine.d.ts +5 -0
- package/dist/admin/analytics/AnalyticsChartLine.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChartLine.js +7 -4
- package/dist/admin/analytics/AnalyticsChartLine.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChartRank.js +1 -2
- package/dist/admin/analytics/AnalyticsChartTicks.js +1 -2
- package/dist/admin/analytics/AnalyticsEmpty.js +1 -2
- package/dist/admin/analytics/ClauseLabel.js +1 -2
- package/dist/admin/analytics/CoarsenedBadge.d.ts +15 -0
- package/dist/admin/analytics/CoarsenedBadge.d.ts.map +1 -0
- package/dist/admin/analytics/CoarsenedBadge.js +29 -0
- package/dist/admin/analytics/CoarsenedBadge.js.map +1 -0
- package/dist/admin/analytics/CompareNote.d.ts +5 -0
- package/dist/admin/analytics/CompareNote.d.ts.map +1 -1
- package/dist/admin/analytics/CompareNote.js +6 -3
- package/dist/admin/analytics/CompareNote.js.map +1 -1
- package/dist/admin/analytics/DatasetSelect.js +1 -2
- package/dist/admin/analytics/FilterEditor.d.ts +1 -0
- package/dist/admin/analytics/FilterEditor.d.ts.map +1 -1
- package/dist/admin/analytics/FilterEditor.js +2 -2
- package/dist/admin/analytics/FilterEditor.js.map +1 -1
- package/dist/admin/analytics/FilterValuePicker.js +2 -3
- package/dist/admin/analytics/GroupByChips.d.ts +17 -11
- package/dist/admin/analytics/GroupByChips.d.ts.map +1 -1
- package/dist/admin/analytics/GroupByChips.js +22 -22
- package/dist/admin/analytics/GroupByChips.js.map +1 -1
- package/dist/admin/analytics/MeasureChips.d.ts +11 -6
- package/dist/admin/analytics/MeasureChips.d.ts.map +1 -1
- package/dist/admin/analytics/MeasureChips.js +14 -18
- package/dist/admin/analytics/MeasureChips.js.map +1 -1
- package/dist/admin/analytics/QueryPanel.d.ts.map +1 -1
- package/dist/admin/analytics/QueryPanel.js +10 -7
- package/dist/admin/analytics/QueryPanel.js.map +1 -1
- package/dist/admin/analytics/RangeControl.d.ts +11 -7
- package/dist/admin/analytics/RangeControl.d.ts.map +1 -1
- package/dist/admin/analytics/RangeControl.js +84 -32
- package/dist/admin/analytics/RangeControl.js.map +1 -1
- package/dist/admin/analytics/RequestDialog.js +1 -2
- package/dist/admin/analytics/ResultsPane.d.ts.map +1 -1
- package/dist/admin/analytics/ResultsPane.js +17 -14
- package/dist/admin/analytics/ResultsPane.js.map +1 -1
- package/dist/admin/analytics/ResultsTable.d.ts.map +1 -1
- package/dist/admin/analytics/ResultsTable.js +6 -7
- package/dist/admin/analytics/ResultsTable.js.map +1 -1
- package/dist/admin/analytics/RunFooter.js +1 -2
- package/dist/admin/analytics/SamplingBadge.js +1 -2
- package/dist/admin/analytics/ToggleChip.js +2 -3
- package/dist/admin/analytics/TotalsCards.d.ts +2 -1
- package/dist/admin/analytics/TotalsCards.d.ts.map +1 -1
- package/dist/admin/analytics/TotalsCards.js +10 -12
- package/dist/admin/analytics/TotalsCards.js.map +1 -1
- package/dist/admin/analytics/TruncationBanner.js +1 -2
- package/dist/admin/analytics/analyticsModel.d.ts +126 -17
- package/dist/admin/analytics/analyticsModel.d.ts.map +1 -1
- package/dist/admin/analytics/analyticsModel.js +284 -50
- package/dist/admin/analytics/analyticsModel.js.map +1 -1
- package/dist/admin/analytics/analyticsTypes.d.ts +55 -4
- package/dist/admin/analytics/analyticsTypes.d.ts.map +1 -1
- package/dist/admin/analytics/chartModel.d.ts +38 -3
- package/dist/admin/analytics/chartModel.d.ts.map +1 -1
- package/dist/admin/analytics/chartModel.js +87 -18
- package/dist/admin/analytics/chartModel.js.map +1 -1
- package/dist/admin/analytics/instantRangeSchema.d.ts +9 -0
- package/dist/admin/analytics/instantRangeSchema.d.ts.map +1 -0
- package/dist/admin/analytics/instantRangeSchema.js +12 -0
- package/dist/admin/analytics/instantRangeSchema.js.map +1 -0
- package/dist/admin/analytics/useAnalyticsQuery.d.ts +13 -3
- package/dist/admin/analytics/useAnalyticsQuery.d.ts.map +1 -1
- package/dist/admin/analytics/useAnalyticsQuery.js +61 -23
- package/dist/admin/analytics/useAnalyticsQuery.js.map +1 -1
- package/dist/admin/analytics/useDismissable.js +1 -2
- package/dist/admin/analytics/useFilterValues.d.ts +4 -0
- package/dist/admin/analytics/useFilterValues.d.ts.map +1 -1
- package/dist/admin/analytics/useFilterValues.js +7 -8
- package/dist/admin/analytics/useFilterValues.js.map +1 -1
- package/dist/admin/analytics/usePanelWidth.js +1 -2
- package/dist/admin/analytics/useShapeLabels.js +1 -2
- package/dist/admin/diffLines.js +1 -2
- package/dist/admin/downloadJson.js +1 -2
- package/dist/admin/index.js +5 -5
- package/dist/admin/useConfirmedAction.js +1 -2
- package/dist/admin/useJobRetentionLabels.js +1 -2
- package/dist/admin/useJobStatusLabels.js +1 -2
- package/dist/admin/useNotificationStatusLabels.js +1 -2
- package/dist/admin/useParameterHistoryCollapsed.js +1 -2
- package/dist/ai/AiChat.d.ts +30 -0
- package/dist/ai/AiChat.d.ts.map +1 -0
- package/dist/ai/AiChat.js +115 -0
- package/dist/ai/AiChat.js.map +1 -0
- package/dist/ai/AiChatConfirmCard.d.ts +17 -0
- package/dist/ai/AiChatConfirmCard.d.ts.map +1 -0
- package/dist/ai/AiChatConfirmCard.js +46 -0
- package/dist/ai/AiChatConfirmCard.js.map +1 -0
- package/dist/ai/AiChatHistory.d.ts +14 -0
- package/dist/ai/AiChatHistory.d.ts.map +1 -0
- package/dist/ai/AiChatHistory.js +39 -0
- package/dist/ai/AiChatHistory.js.map +1 -0
- package/dist/ai/AiChatMessage.d.ts +10 -0
- package/dist/ai/AiChatMessage.d.ts.map +1 -0
- package/dist/ai/AiChatMessage.js +37 -0
- package/dist/ai/AiChatMessage.js.map +1 -0
- package/dist/ai/AiFormRegistry.d.ts +37 -0
- package/dist/ai/AiFormRegistry.d.ts.map +1 -0
- package/dist/ai/AiFormRegistry.js +58 -0
- package/dist/ai/AiFormRegistry.js.map +1 -0
- package/dist/ai/aiChatMessageFormSchema.d.ts +8 -0
- package/dist/ai/aiChatMessageFormSchema.d.ts.map +1 -0
- package/dist/ai/aiChatMessageFormSchema.js +12 -0
- package/dist/ai/aiChatMessageFormSchema.js.map +1 -0
- package/dist/ai/aiContextAtom.d.ts +17 -0
- package/dist/ai/aiContextAtom.d.ts.map +1 -0
- package/dist/ai/aiContextAtom.js +24 -0
- package/dist/ai/aiContextAtom.js.map +1 -0
- package/dist/ai/index.d.ts +18 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +10 -0
- package/dist/ai/useAiChat.d.ts +82 -0
- package/dist/ai/useAiChat.d.ts.map +1 -0
- package/dist/ai/useAiChat.js +255 -0
- package/dist/ai/useAiChat.js.map +1 -0
- package/dist/ai/useAiContext.d.ts +33 -0
- package/dist/ai/useAiContext.d.ts.map +1 -0
- package/dist/ai/useAiContext.js +51 -0
- package/dist/ai/useAiContext.js.map +1 -0
- package/dist/auth/AuthLogin.js +5 -6
- package/dist/auth/AuthMfaStep.js +2 -3
- package/dist/auth/AuthRegister.d.ts.map +1 -1
- package/dist/auth/AuthRegister.js +4 -5
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/auth/AuthRegisterCentered.js +1 -2
- package/dist/auth/AuthRegisterFormPhase.js +5 -6
- package/dist/auth/AuthRegisterPasswordRules.js +1 -2
- package/dist/auth/AuthRegisterRealmHeader.js +1 -2
- package/dist/auth/AuthRegisterRealmLogo.js +1 -2
- package/dist/auth/AuthResetPassword.js +4 -5
- package/dist/auth/AuthRouter.js +1 -2
- package/dist/auth/AuthVerifyEmail.js +2 -3
- package/dist/auth/AuthVerifyEmailStateful.js +1 -2
- package/dist/auth/AuthVerifyEmailView.js +2 -3
- package/dist/auth/TurnstileWidget.js +1 -2
- package/dist/auth/index.js +3 -3
- package/dist/auth/providerLabels.js +1 -2
- package/dist/auth/safeRedirect.js +1 -2
- package/dist/calendar/Calendar.js +2 -3
- package/dist/calendar/LazyCalendar.js +1 -2
- package/dist/calendar/index.js +1 -2
- package/dist/chart/Chart.js +1 -2
- package/dist/chart/index.js +1 -2
- package/dist/command/Command.js +2 -3
- package/dist/command/commandScore.js +1 -2
- package/dist/command/index.js +1 -1
- package/dist/command/rankCommandItems.js +1 -2
- package/dist/core/Alert.js +1 -2
- package/dist/core/AlertDialog.js +2 -3
- package/dist/core/Avatar.js +1 -2
- package/dist/core/Badge.js +1 -2
- package/dist/core/BrandIcon.js +1 -2
- package/dist/core/Breadcrumb.js +2 -3
- package/dist/core/Breadcrumb.js.map +1 -1
- package/dist/core/Button.js +1 -2
- package/dist/core/ButtonGroup.js +2 -3
- package/dist/core/Card.js +1 -2
- package/dist/core/Checkbox.js +1 -2
- package/dist/core/Combobox.js +2 -3
- package/dist/core/ContextMenu.js +1 -2
- package/dist/core/Dialog.js +2 -3
- package/dist/core/Drawer.js +1 -2
- package/dist/core/DropdownMenu.js +1 -2
- package/dist/core/Empty.js +1 -2
- package/dist/core/FileImage.js +1 -2
- package/dist/core/FilterSlot.js +1 -2
- package/dist/core/Highlight.js +2 -3
- package/dist/core/HoverCard.js +1 -2
- package/dist/core/Input.js +1 -2
- package/dist/core/InputGroup.js +2 -3
- package/dist/core/Kbd.js +1 -2
- package/dist/core/Label.js +1 -2
- package/dist/core/Menubar.js +2 -3
- package/dist/core/Pagination.js +2 -3
- package/dist/core/PaneRail.js +1 -2
- package/dist/core/Popover.js +1 -2
- package/dist/core/Progress.js +1 -2
- package/dist/core/Segmented.js +1 -2
- package/dist/core/Separator.js +1 -2
- package/dist/core/Sheet.d.ts +6 -1
- package/dist/core/Sheet.d.ts.map +1 -1
- package/dist/core/Sheet.js +4 -5
- package/dist/core/Sheet.js.map +1 -1
- package/dist/core/Sidebar.d.ts +7 -1
- package/dist/core/Sidebar.d.ts.map +1 -1
- package/dist/core/Sidebar.js +27 -23
- package/dist/core/Sidebar.js.map +1 -1
- package/dist/core/Skeleton.js +1 -2
- package/dist/core/Slider.js +1 -2
- package/dist/core/Spinner.js +1 -2
- package/dist/core/Switch.js +1 -2
- package/dist/core/Table.js +1 -2
- package/dist/core/Tabs.js +1 -2
- package/dist/core/Textarea.js +1 -2
- package/dist/core/TimeAgo.js +1 -2
- package/dist/core/Toaster.js +1 -2
- package/dist/core/Tooltip.js +1 -2
- package/dist/core/UserAvatar.js +2 -3
- package/dist/core/highlightRanges.js +1 -2
- package/dist/core/index.js +37 -37
- package/dist/core/useDialog.js +1 -2
- package/dist/core/useIsMobile.js +1 -2
- package/dist/core/useToast.js +1 -2
- package/dist/core/utils.js +1 -2
- package/dist/form/AutoForm.js +6 -7
- package/dist/form/AutoFormBottomBar.js +2 -3
- package/dist/form/AutoFormErrorPopover.js +1 -2
- package/dist/form/AutoFormGroupBlock.js +3 -4
- package/dist/form/AutoFormGroupGridField.js +2 -3
- package/dist/form/Control.d.ts +14 -0
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +14 -9
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlArray.js +2 -3
- package/dist/form/ControlArray.js.map +1 -1
- package/dist/form/ControlDate.d.ts +11 -0
- package/dist/form/ControlDate.d.ts.map +1 -1
- package/dist/form/ControlDate.js +21 -4
- package/dist/form/ControlDate.js.map +1 -1
- package/dist/form/ControlDatePopover.d.ts +3 -0
- package/dist/form/ControlDatePopover.d.ts.map +1 -1
- package/dist/form/ControlDatePopover.js +4 -4
- package/dist/form/ControlDatePopover.js.map +1 -1
- package/dist/form/ControlDateRange.js +2 -3
- package/dist/form/ControlMonthPopover.d.ts +25 -0
- package/dist/form/ControlMonthPopover.d.ts.map +1 -0
- package/dist/form/ControlMonthPopover.js +111 -0
- package/dist/form/ControlMonthPopover.js.map +1 -0
- package/dist/form/ControlNumber.js +2 -3
- package/dist/form/ControlObject.js +2 -3
- package/dist/form/ControlObject.js.map +1 -1
- package/dist/form/ControlPassword.js +1 -2
- package/dist/form/ControlSelect.d.ts +7 -0
- package/dist/form/ControlSelect.d.ts.map +1 -1
- package/dist/form/ControlSelect.js +40 -4
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/form/ControlSelectCombobox.js +3 -4
- package/dist/form/ControlUpload.js +4 -5
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/form/ControlUploadItemThumb.js +1 -2
- package/dist/form/FormField.js +2 -3
- package/dist/form/FormFieldAutoSaveProvider.js +1 -2
- package/dist/form/FormFieldLayoutProvider.js +1 -2
- package/dist/form/FormFieldRequiredMarkerProvider.js +1 -2
- package/dist/form/autoFormGroups.js +1 -2
- package/dist/form/controlSelectOptions.js +1 -2
- package/dist/form/dateOnly.js +1 -2
- package/dist/form/fieldI18n.js +1 -2
- package/dist/form/fieldTrigger.js +1 -2
- package/dist/form/grid.js +1 -2
- package/dist/form/iconHint.js +1 -2
- package/dist/form/index.js +7 -7
- package/dist/form/resizeImage.js +1 -2
- package/dist/i18n/fr/index.js +1 -2
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +32 -3
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/markdown/MarkdownView.js +1 -2
- package/dist/markdown/SpoilerSpan.js +1 -2
- package/dist/markdown/diagram/DiagramErrorBoundary.js +1 -2
- package/dist/markdown/diagram/DiagramLabel.js +1 -2
- package/dist/markdown/diagram/FlowchartDiagram.js +2 -3
- package/dist/markdown/diagram/FlowchartDiagramCluster.js +2 -3
- package/dist/markdown/diagram/FlowchartDiagramEdge.js +1 -2
- package/dist/markdown/diagram/FlowchartDiagramNode.js +1 -2
- package/dist/markdown/diagram/MermaidFence.js +3 -4
- package/dist/markdown/diagram/SequenceDiagram.js +2 -3
- package/dist/markdown/diagram/SequenceDiagramFragment.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramMessage.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramNote.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramParticipant.js +1 -2
- package/dist/markdown/diagram/SequenceDiagramParticipantActor.js +2 -3
- package/dist/markdown/diagram/diagramKind.js +1 -2
- package/dist/markdown/diagram/flowchartParser.js +1 -2
- package/dist/markdown/diagram/layoutFlowchart.js +1 -2
- package/dist/markdown/diagram/layoutFlowchart.js.map +1 -1
- package/dist/markdown/diagram/layoutSequence.js +1 -2
- package/dist/markdown/diagram/sequenceParser.js +1 -2
- package/dist/markdown/diagram/textMetrics.js +1 -2
- package/dist/markdown/index.js +1 -1
- package/dist/markdown/rehypeHighlight.js +1 -2
- package/dist/markdown/remarkSpoiler.js +1 -2
- package/dist/organizations/MyOrganizationInvitations.js +2 -3
- package/dist/organizations/MyOrganizations.js +2 -3
- package/dist/organizations/OrganizationInviteDialog.js +2 -3
- package/dist/organizations/OrganizationMemberIdentity.js +2 -3
- package/dist/organizations/OrganizationMemberRankPicker.js +1 -2
- package/dist/organizations/OrganizationMembers.js +3 -4
- package/dist/organizations/OrganizationPendingInvitations.js +3 -4
- package/dist/organizations/OrganizationRankColumnHeader.js +2 -3
- package/dist/organizations/OrganizationRanks.js +5 -6
- package/dist/organizations/OrganizationTransferOwnershipDialog.js +2 -3
- package/dist/organizations/index.js +6 -6
- package/dist/organizations/useInviteOrganizationMember.js +1 -2
- package/dist/organizations/useRevokeOrganizationInvitation.js +1 -2
- package/dist/otp/InputOTP.js +1 -2
- package/dist/otp/index.js +1 -2
- package/dist/resizable/Resizable.js +1 -2
- package/dist/resizable/index.js +1 -2
- package/dist/settings/SettingsDangerSection.js +2 -3
- package/dist/settings/SettingsHeading.js +1 -2
- package/dist/settings/SettingsLayout.js +1 -2
- package/dist/settings/SettingsNav.js +1 -2
- package/dist/settings/SettingsRow.js +2 -3
- package/dist/settings/SettingsSection.js +3 -4
- package/dist/settings/index.js +3 -3
- package/dist/settings/settingsCardEdge.js +1 -2
- package/dist/shell/$pageNav.js +1 -2
- package/dist/shell/ActionErrorToaster.js +1 -2
- package/dist/shell/AppActions.js +2 -3
- package/dist/shell/AppShell.js +3 -4
- package/dist/shell/AppShellNavCollapse.d.ts +4 -0
- package/dist/shell/AppShellNavCollapse.d.ts.map +1 -1
- package/dist/shell/AppShellNavCollapse.js +2 -2
- package/dist/shell/AppShellNavCollapse.js.map +1 -1
- package/dist/shell/AppShellNavDropdownItems.js +1 -2
- package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.js +17 -12
- package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.d.ts.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.js +6 -4
- package/dist/shell/AppShellStatefulSidebarTrigger.js.map +1 -1
- package/dist/shell/ButtonDark.js +1 -2
- package/dist/shell/ButtonInbox.js +3 -4
- package/dist/shell/ButtonLanguage.js +2 -3
- package/dist/shell/ButtonLanguage.js.map +1 -1
- package/dist/shell/ButtonSettings.js +2 -3
- package/dist/shell/ButtonSettingsColorModeMenu.js +1 -2
- package/dist/shell/ButtonSettingsLanguageMenu.js +1 -2
- package/dist/shell/ButtonSettingsLanguageMenu.js.map +1 -1
- package/dist/shell/ButtonSettingsThemeMenu.js +1 -2
- package/dist/shell/ButtonTheme.js +3 -4
- package/dist/shell/ButtonThemeSwatch.js +1 -2
- package/dist/shell/ButtonUser.js +2 -3
- package/dist/shell/ButtonUserAccountMenuItem.js +1 -2
- package/dist/shell/ButtonUserAdminMenuItem.js +1 -2
- package/dist/shell/ButtonUserContent.js +3 -4
- package/dist/shell/ButtonUserDefaultMenu.js +1 -2
- package/dist/shell/ButtonUserEmail.js +1 -2
- package/dist/shell/ButtonUserLogoutMenuItem.js +1 -2
- package/dist/shell/ButtonUserPlaceholder.js +1 -2
- package/dist/shell/DetailAside.js +3 -4
- package/dist/shell/DetailLayout.js +2 -3
- package/dist/shell/NavShell.js +1 -2
- package/dist/shell/NavigationProgress.js +1 -2
- package/dist/shell/PlateLayout.js +1 -2
- package/dist/shell/PlateTabBar.d.ts +5 -0
- package/dist/shell/PlateTabBar.d.ts.map +1 -1
- package/dist/shell/PlateTabBar.js +2 -2
- package/dist/shell/PlateTabBar.js.map +1 -1
- package/dist/shell/SidebarNavAutoClose.js +1 -2
- package/dist/shell/Spotlight.js +2 -3
- package/dist/shell/appShellNav.d.ts +6 -0
- package/dist/shell/appShellNav.d.ts.map +1 -1
- package/dist/shell/appShellNav.js +1 -2
- package/dist/shell/appShellNav.js.map +1 -1
- package/dist/shell/inboxUnreadAtom.js +1 -2
- package/dist/shell/index.js +10 -10
- package/dist/shell/navTreeUtil.js +1 -2
- package/dist/shell/spotlightSearchText.js +1 -2
- package/dist/shell/useDetailTab.js +1 -2
- package/dist/shell/useNavBreadcrumbs.js +1 -2
- package/dist/shell/useNavEntries.js +1 -2
- package/dist/shell/useNavTree.js +1 -2
- package/dist/table/DataTable.d.ts.map +1 -1
- package/dist/table/DataTable.js +4 -4
- package/dist/table/DataTable.js.map +1 -1
- package/dist/table/DataTableBody.js +3 -4
- package/dist/table/DataTableBulkBar.js +1 -2
- package/dist/table/DataTableBulkMenu.js +2 -3
- package/dist/table/DataTableColumnPicker.js +3 -4
- package/dist/table/DataTableFilterAdd.js +2 -3
- package/dist/table/DataTableFilterBar.js +2 -3
- package/dist/table/DataTableFilterBar.js.map +1 -1
- package/dist/table/DataTableFilterControl.js +2 -3
- package/dist/table/DataTableFilterDialog.js +1 -2
- package/dist/table/DataTableFilterMenu.js +2 -3
- package/dist/table/DataTableFilterOperator.js +1 -2
- package/dist/table/DataTableFooter.js +2 -3
- package/dist/table/DataTableHeaderRow.js +3 -4
- package/dist/table/DataTableHelpButton.js +1 -2
- package/dist/table/DataTableRowActionItem.js +1 -2
- package/dist/table/DataTableRowActionsMenu.js +2 -3
- package/dist/table/DataTableSkeletonRows.js +2 -3
- package/dist/table/DataTableSummaryCard.js +1 -2
- package/dist/table/DataTableSummaryPanel.js +2 -3
- package/dist/table/DataTableToolbar.d.ts +7 -3
- package/dist/table/DataTableToolbar.d.ts.map +1 -1
- package/dist/table/DataTableToolbar.js +9 -6
- package/dist/table/DataTableToolbar.js.map +1 -1
- package/dist/table/PermissionMatrix.js +2 -3
- package/dist/table/PermissionMatrixGroupRows.js +3 -4
- package/dist/table/PermissionMatrixRowLabel.js +1 -2
- package/dist/table/dataTableBaseProps.d.ts +17 -0
- package/dist/table/dataTableBaseProps.d.ts.map +1 -1
- package/dist/table/dataTableCellPadding.js +1 -2
- package/dist/table/dataTableFilterFields.js +1 -2
- package/dist/table/dataTablePersistence.js +1 -2
- package/dist/table/dataTableSquareRight.js +1 -2
- package/dist/table/index.js +4 -4
- package/dist/table/paginateLocal.js +1 -2
- package/dist/table/queryFilters.js +1 -2
- package/dist/table/queryFilters.js.map +1 -1
- package/dist/table/useDataTableColumns.js +1 -2
- package/dist/table/useDataTableData.d.ts +2 -2
- package/dist/table/useDataTableData.d.ts.map +1 -1
- package/dist/table/useDataTableData.js +1 -2
- package/dist/table/useDataTableFilterForm.js +2 -3
- package/dist/table/useDataTableFilterVisibility.js +1 -2
- package/dist/table/useDataTableRefresh.js +1 -2
- package/dist/table/useDataTableSummary.js +1 -2
- package/dist/table/useTableSelection.js +1 -2
- package/dist/tree/TreeView.js +1 -2
- package/dist/tree/TreeViewRenameInput.js +1 -2
- package/dist/tree/TreeViewResizer.js +1 -2
- package/dist/tree/TreeViewRow.js +2 -3
- package/dist/tree/index.js +1 -1
- package/dist/tree/treeModel.js +1 -2
- package/dist/tree/useTreeState.js +1 -2
- package/docs/packages-alepha-ui-account.md +29 -0
- package/docs/packages-alepha-ui-admin.md +35 -0
- package/docs/packages-alepha-ui-ai.md +29 -0
- package/docs/packages-alepha-ui-auth.md +23 -0
- package/docs/packages-alepha-ui-calendar.md +24 -0
- package/docs/packages-alepha-ui-chart.md +23 -0
- package/docs/packages-alepha-ui-command.md +24 -0
- package/docs/packages-alepha-ui-core.md +40 -0
- package/docs/packages-alepha-ui-form.md +29 -0
- package/docs/packages-alepha-ui-i18n-fr.md +31 -0
- package/docs/packages-alepha-ui-markdown.md +27 -0
- package/docs/packages-alepha-ui-organizations.md +20 -0
- package/docs/packages-alepha-ui-otp.md +22 -0
- package/docs/packages-alepha-ui-overview.md +337 -0
- package/docs/packages-alepha-ui-resizable.md +22 -0
- package/docs/packages-alepha-ui-settings.md +23 -0
- package/docs/packages-alepha-ui-shell.md +41 -0
- package/docs/packages-alepha-ui-table.md +37 -0
- package/docs/packages-alepha-ui-tree.md +31 -0
- package/package.json +28 -18
- package/src/account/__tests__/AccountLayout.browser.spec.tsx +2 -2
- package/src/account/__tests__/AccountRouter.spec.ts +1 -1
- package/src/admin/AdminAudits.tsx +1 -1
- package/src/admin/AdminFiles.tsx +1 -1
- package/src/admin/AdminFilesUsage.tsx +1 -2
- package/src/admin/AdminNotifications.tsx +2 -5
- package/src/admin/AdminNotificationsPreviewTab.tsx +2 -2
- package/src/admin/AdminParameters.tsx +1 -3
- package/src/admin/AdminParametersEditorForm.tsx +1 -1
- package/src/admin/AdminParametersEditorPane.tsx +1 -1
- package/src/admin/ParameterHistoryItem.tsx +1 -3
- package/src/admin/__tests__/AdminNavI18n.browser.spec.tsx +1 -1
- package/src/admin/__tests__/AdminStatusLabels.browser.spec.tsx +1 -1
- package/src/admin/analytics/AdvancedSection.tsx +39 -30
- package/src/admin/analytics/AnalyticsChart.tsx +7 -1
- package/src/admin/analytics/AnalyticsChartHeader.tsx +22 -7
- package/src/admin/analytics/AnalyticsChartLine.tsx +15 -2
- package/src/admin/analytics/CoarsenedBadge.tsx +38 -0
- package/src/admin/analytics/CompareNote.tsx +16 -5
- package/src/admin/analytics/FilterEditor.tsx +2 -0
- package/src/admin/analytics/GroupByChips.tsx +40 -27
- package/src/admin/analytics/MeasureChips.tsx +19 -11
- package/src/admin/analytics/QueryPanel.tsx +10 -5
- package/src/admin/analytics/RangeControl.tsx +91 -27
- package/src/admin/analytics/ResultsPane.tsx +20 -6
- package/src/admin/analytics/ResultsTable.tsx +9 -5
- package/src/admin/analytics/TotalsCards.tsx +24 -11
- package/src/admin/analytics/analyticsModel.spec.ts +171 -40
- package/src/admin/analytics/analyticsModel.ts +358 -49
- package/src/admin/analytics/analyticsTypes.ts +56 -4
- package/src/admin/analytics/chartModel.ts +139 -20
- package/src/admin/analytics/instantRangeSchema.ts +9 -0
- package/src/admin/analytics/useAnalyticsQuery.ts +98 -35
- package/src/admin/analytics/useFilterValues.ts +16 -5
- package/src/ai/AiChat.tsx +151 -0
- package/src/ai/AiChatConfirmCard.tsx +64 -0
- package/src/ai/AiChatHistory.tsx +60 -0
- package/src/ai/AiChatMessage.tsx +57 -0
- package/src/ai/AiFormRegistry.ts +78 -0
- package/src/ai/__tests__/AiChat.browser.spec.tsx +391 -0
- package/src/ai/aiChatMessageFormSchema.ts +8 -0
- package/src/ai/aiContextAtom.ts +23 -0
- package/src/ai/index.ts +18 -0
- package/src/ai/useAiChat.ts +343 -0
- package/src/ai/useAiContext.ts +74 -0
- package/src/auth/AuthRegister.tsx +1 -3
- package/src/core/Breadcrumb.tsx +1 -1
- package/src/core/Sheet.tsx +9 -2
- package/src/core/Sidebar.tsx +45 -22
- package/src/form/Control.tsx +26 -1
- package/src/form/ControlArray.tsx +1 -1
- package/src/form/ControlDate.tsx +37 -2
- package/src/form/ControlDatePopover.tsx +4 -1
- package/src/form/ControlMonthPopover.tsx +169 -0
- package/src/form/ControlObject.tsx +1 -1
- package/src/form/ControlSelect.tsx +62 -0
- package/src/form/ControlUpload.tsx +1 -1
- package/src/form/__tests__/ControlChoices.browser.spec.tsx +130 -0
- package/src/form/__tests__/ControlDateLanguage.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlDateRange.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlObjectClear.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectClearLabel.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlSelectDeselect.browser.spec.tsx +1 -3
- package/src/form/__tests__/ControlSelectMulti.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectSearchable.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlSelectSizeMinimal.browser.spec.tsx +2 -2
- package/src/form/__tests__/ControlSelectTriggerProps.browser.spec.tsx +1 -3
- package/src/i18n/fr/uiFr.ts +36 -2
- package/src/markdown/diagram/layoutFlowchart.ts +1 -1
- package/src/organizations/__tests__/OrganizationRanks.browser.spec.tsx +1 -1
- package/src/organizations/__tests__/OrganizationTransferOwnershipDialog.browser.spec.tsx +1 -1
- package/src/shell/AppShellNavCollapse.tsx +5 -0
- package/src/shell/AppShellSidebarNavItem.tsx +31 -10
- package/src/shell/AppShellStatefulSidebarTrigger.tsx +10 -2
- package/src/shell/ButtonLanguage.tsx +1 -1
- package/src/shell/ButtonSettingsLanguageMenu.tsx +1 -1
- package/src/shell/PlateTabBar.tsx +6 -0
- package/src/shell/__tests__/AppActions.browser.spec.tsx +1 -1
- package/src/shell/__tests__/AppShellDirection.browser.spec.tsx +95 -0
- package/src/shell/__tests__/ButtonInbox.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ButtonSettings.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ButtonUserAvatar.browser.spec.tsx +1 -1
- package/src/shell/__tests__/SidebarNavAutoClose.browser.spec.tsx +1 -1
- package/src/shell/appShellNav.tsx +6 -0
- package/src/table/DataTable.tsx +2 -0
- package/src/table/DataTableFilterBar.tsx +1 -1
- package/src/table/DataTableToolbar.tsx +18 -3
- package/src/table/__tests__/DataTableLeading.browser.spec.tsx +130 -0
- package/src/table/dataTableBaseProps.ts +17 -0
- package/src/table/queryFilters.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../core/utils.js";
|
|
2
2
|
import { Link } from "alepha/react/router";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/shell/PlateTabBar.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Underlined tabs along the bottom edge of a {@link PlateLayout}'s plate.
|
|
7
7
|
*
|
|
@@ -32,6 +32,7 @@ const PlateTabBar = (props) => {
|
|
|
32
32
|
] });
|
|
33
33
|
return tab.href !== void 0 ? /* @__PURE__ */ jsx(Link, {
|
|
34
34
|
href: tab.href,
|
|
35
|
+
prefetch: tab.prefetch,
|
|
35
36
|
"aria-current": active ? "page" : void 0,
|
|
36
37
|
className,
|
|
37
38
|
children: body
|
|
@@ -46,7 +47,6 @@ const PlateTabBar = (props) => {
|
|
|
46
47
|
})
|
|
47
48
|
});
|
|
48
49
|
};
|
|
49
|
-
//#endregion
|
|
50
50
|
export { PlateTabBar };
|
|
51
51
|
|
|
52
52
|
//# sourceMappingURL=PlateTabBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlateTabBar.js","names":[],"sources":["../../src/shell/PlateTabBar.tsx"],"sourcesContent":["import { Link } from \"alepha/react/router\";\n\nimport { cn } from \"../core/utils.ts\";\nimport type { IconComponent } from \"../form/iconHint.tsx\";\n\nexport interface PlateTab {\n /**\n * Identifies the tab. Compared against {@link PlateTabBarProps.active}, and\n * handed back to {@link PlateTabBarProps.onSelect}. For a router-driven bar\n * this is the route name.\n */\n key: string;\n label: string;\n icon?: IconComponent;\n /**\n * A trailing count, in a pill of its own rather than folded into the label.\n * The pill's colour follows the tab's state - `text-foreground` active,\n * `text-muted-foreground` not - and a count written into the label would\n * carry one fixed class that is wrong on one of the two. Same reason\n * `Segmented` has a `count` prop.\n *\n * Show it only once its collection has resolved: `undefined` renders the\n * bare label rather than a confident \"0\".\n */\n count?: number;\n /**\n * Makes this tab a NAVIGATION rather than a state change. Present, the tab\n * is a router `Link` and `onSelect` is not called; absent, it is a button.\n *\n * Both shapes exist because both are real: a tab that swaps a panel inside\n * one route is state, and a tab that is its own route has to be a link -\n * middle-click, copy-link and the back button all depend on it.\n */\n href?: string;\n}\n\nexport interface PlateTabBarProps {\n tabs: PlateTab[];\n active: string;\n /**\n * Called for a tab with no `href`. A router-driven bar passes nothing.\n */\n onSelect?: (key: string) => void;\n /**\n * Marks the bar for tests. Worth setting: tab labels are ordinary words\n * (\"Overview\", \"Settings\") that a page-wide `getByRole` finds in the tab\n * BODIES too, and \"Settings\" is also a project-level nav entry.\n */\n testId?: string;\n /**\n * Whether to rule off the top edge. Default `true`.\n *\n * The line separates the tabs from the plate above them, so it is only\n * right when there IS one. `PlateLayout` derives this from its own `plate`\n * slot; a bar with no plate above it would otherwise draw a stray line\n * immediately under the container's top edge, which is what a caller\n * omitting the plate for the first time discovered (feedback #2095).\n */\n divided?: boolean;\n}\n\n/**\n * Underlined tabs along the bottom edge of a {@link PlateLayout}'s plate.\n *\n * Underlines rather than `Segmented`, which sits inside a toolbar as a\n * control. This bar IS the bottom edge of a full-width band, and a pill group\n * floating on that edge reads as a widget dropped onto the header rather than\n * as the header's own last row.\n */\nexport const PlateTabBar = (props: PlateTabBarProps) => {\n // A bar of links is a NAVIGATION, not a tablist, and its items are links\n // rather than tabs. `role=\"tab\"` on an anchor overrides the implicit link\n // role, which takes it out of `getByRole(\"link\")` and tells a screen reader\n // it swaps a panel when it actually leaves the page. `aria-current=\"page\"`\n // is what marks the current one in a set of navigation links.\n const navigates = props.tabs.every((tab) => tab.href !== undefined);\n\n return (\n <div\n data-testid={props.testId}\n className={cn(\n // The table header's surface, and for the same reason: this strip is\n // chrome, not body. `bg-muted` under a `--bevel` line laid just inside\n // the top edge - two adjacent lines of opposite polarity read as a\n // fold - so the band looks raised out of the page rather than painted\n // onto it. Opaque like the sticky table header, not the base header's\n // `bg-muted/50`: the plate above is already translucent over the page,\n // and stacking a second wash on it makes the two bands differ by a\n // couple of percent instead of reading as one raised object.\n //\n // The border above the bevel is whichever line closes the top edge:\n // the bar's own `border-t` when there is a plate, and the shell\n // header's bottom border when there is not. Both are `--border`, so\n // the fold reads the same either way.\n // `overflow-x-auto` so a bar wider than a phone scrolls sideways\n // instead of widening the page; the tabs never wrap or shrink.\n \"bg-muted border-border flex gap-5 overflow-x-auto px-6 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.divided !== false && \"border-t\",\n )}\n role={navigates ? \"navigation\" : \"tablist\"}\n >\n {props.tabs.map((tab) => {\n const active = tab.key === props.active;\n const className = cn(\n \"-mb-px inline-flex h-[42px] shrink-0 items-center gap-[7px] border-b-2 text-[13.5px] font-medium whitespace-nowrap transition-colors\",\n active\n ? \"border-primary text-foreground\"\n : \"text-muted-foreground hover:text-foreground border-transparent\",\n );\n const body = (\n <>\n {tab.icon && <tab.icon className=\"size-[14px]\" aria-hidden />}\n {tab.label}\n {tab.count !== undefined && (\n <span\n className={cn(\n \"bg-foreground/10 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-[5px] font-mono text-[10.5px]\",\n active ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {tab.count}\n </span>\n )}\n </>\n );\n\n return tab.href !== undefined ? (\n <Link\n key={tab.key}\n href={tab.href}\n aria-current={active ? \"page\" : undefined}\n className={className}\n >\n {body}\n </Link>\n ) : (\n <button\n key={tab.key}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => props.onSelect?.(tab.key)}\n className={className}\n >\n {body}\n </button>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PlateTabBar.js","names":[],"sources":["../../src/shell/PlateTabBar.tsx"],"sourcesContent":["import { Link } from \"alepha/react/router\";\n\nimport { cn } from \"../core/utils.ts\";\nimport type { IconComponent } from \"../form/iconHint.tsx\";\n\nexport interface PlateTab {\n /**\n * Identifies the tab. Compared against {@link PlateTabBarProps.active}, and\n * handed back to {@link PlateTabBarProps.onSelect}. For a router-driven bar\n * this is the route name.\n */\n key: string;\n label: string;\n icon?: IconComponent;\n /**\n * A trailing count, in a pill of its own rather than folded into the label.\n * The pill's colour follows the tab's state - `text-foreground` active,\n * `text-muted-foreground` not - and a count written into the label would\n * carry one fixed class that is wrong on one of the two. Same reason\n * `Segmented` has a `count` prop.\n *\n * Show it only once its collection has resolved: `undefined` renders the\n * bare label rather than a confident \"0\".\n */\n count?: number;\n /**\n * Makes this tab a NAVIGATION rather than a state change. Present, the tab\n * is a router `Link` and `onSelect` is not called; absent, it is a button.\n *\n * Both shapes exist because both are real: a tab that swaps a panel inside\n * one route is state, and a tab that is its own route has to be a link -\n * middle-click, copy-link and the back button all depend on it.\n */\n href?: string;\n /**\n * When to fetch a tab that is a link ahead of the click. Loader data comes\n * with the code when the page's `prefetch` says it may.\n */\n prefetch?: \"hover\" | \"visible\";\n}\n\nexport interface PlateTabBarProps {\n tabs: PlateTab[];\n active: string;\n /**\n * Called for a tab with no `href`. A router-driven bar passes nothing.\n */\n onSelect?: (key: string) => void;\n /**\n * Marks the bar for tests. Worth setting: tab labels are ordinary words\n * (\"Overview\", \"Settings\") that a page-wide `getByRole` finds in the tab\n * BODIES too, and \"Settings\" is also a project-level nav entry.\n */\n testId?: string;\n /**\n * Whether to rule off the top edge. Default `true`.\n *\n * The line separates the tabs from the plate above them, so it is only\n * right when there IS one. `PlateLayout` derives this from its own `plate`\n * slot; a bar with no plate above it would otherwise draw a stray line\n * immediately under the container's top edge, which is what a caller\n * omitting the plate for the first time discovered (feedback #2095).\n */\n divided?: boolean;\n}\n\n/**\n * Underlined tabs along the bottom edge of a {@link PlateLayout}'s plate.\n *\n * Underlines rather than `Segmented`, which sits inside a toolbar as a\n * control. This bar IS the bottom edge of a full-width band, and a pill group\n * floating on that edge reads as a widget dropped onto the header rather than\n * as the header's own last row.\n */\nexport const PlateTabBar = (props: PlateTabBarProps) => {\n // A bar of links is a NAVIGATION, not a tablist, and its items are links\n // rather than tabs. `role=\"tab\"` on an anchor overrides the implicit link\n // role, which takes it out of `getByRole(\"link\")` and tells a screen reader\n // it swaps a panel when it actually leaves the page. `aria-current=\"page\"`\n // is what marks the current one in a set of navigation links.\n const navigates = props.tabs.every((tab) => tab.href !== undefined);\n\n return (\n <div\n data-testid={props.testId}\n className={cn(\n // The table header's surface, and for the same reason: this strip is\n // chrome, not body. `bg-muted` under a `--bevel` line laid just inside\n // the top edge - two adjacent lines of opposite polarity read as a\n // fold - so the band looks raised out of the page rather than painted\n // onto it. Opaque like the sticky table header, not the base header's\n // `bg-muted/50`: the plate above is already translucent over the page,\n // and stacking a second wash on it makes the two bands differ by a\n // couple of percent instead of reading as one raised object.\n //\n // The border above the bevel is whichever line closes the top edge:\n // the bar's own `border-t` when there is a plate, and the shell\n // header's bottom border when there is not. Both are `--border`, so\n // the fold reads the same either way.\n // `overflow-x-auto` so a bar wider than a phone scrolls sideways\n // instead of widening the page; the tabs never wrap or shrink.\n \"bg-muted border-border flex gap-5 overflow-x-auto px-6 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.divided !== false && \"border-t\",\n )}\n role={navigates ? \"navigation\" : \"tablist\"}\n >\n {props.tabs.map((tab) => {\n const active = tab.key === props.active;\n const className = cn(\n \"-mb-px inline-flex h-[42px] shrink-0 items-center gap-[7px] border-b-2 text-[13.5px] font-medium whitespace-nowrap transition-colors\",\n active\n ? \"border-primary text-foreground\"\n : \"text-muted-foreground hover:text-foreground border-transparent\",\n );\n const body = (\n <>\n {tab.icon && <tab.icon className=\"size-[14px]\" aria-hidden />}\n {tab.label}\n {tab.count !== undefined && (\n <span\n className={cn(\n \"bg-foreground/10 inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full px-[5px] font-mono text-[10.5px]\",\n active ? \"text-foreground\" : \"text-muted-foreground\",\n )}\n >\n {tab.count}\n </span>\n )}\n </>\n );\n\n return tab.href !== undefined ? (\n <Link\n key={tab.key}\n href={tab.href}\n prefetch={tab.prefetch}\n aria-current={active ? \"page\" : undefined}\n className={className}\n >\n {body}\n </Link>\n ) : (\n <button\n key={tab.key}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => props.onSelect?.(tab.key)}\n className={className}\n >\n {body}\n </button>\n );\n })}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA0EA,MAAa,eAAe,UAA4B;CAMtD,MAAM,YAAY,MAAM,KAAK,OAAO,QAAQ,IAAI,SAAS,KAAA,CAAS;CAElE,OACE,oBAAC,OAAD;EACE,eAAa,MAAM;EACnB,WAAW,GAgBT,gGACA,MAAM,YAAY,SAAS,UAC7B;EACA,MAAM,YAAY,eAAe;EAEhC,UAAA,MAAM,KAAK,KAAK,QAAQ;GACvB,MAAM,SAAS,IAAI,QAAQ,MAAM;GACjC,MAAM,YAAY,GAChB,wIACA,SACI,mCACA,gEACN;GACA,MAAM,OACJ,qBAAA,UAAA,EAAA,UAAA;IACG,IAAI,QAAQ,oBAAC,IAAI,MAAL;KAAU,WAAU;KAAc,eAAA;IAAa,CAAA;IAC3D,IAAI;IACJ,IAAI,UAAU,KAAA,KACb,oBAAC,QAAD;KACE,WAAW,GACT,gIACA,SAAS,oBAAoB,uBAC/B;KAEC,UAAA,IAAI;IACD,CAAA;GAER,EAAA,CAAA;GAGJ,OAAO,IAAI,SAAS,KAAA,IAClB,oBAAC,MAAD;IAEE,MAAM,IAAI;IACV,UAAU,IAAI;IACd,gBAAc,SAAS,SAAS,KAAA;IACrB;IAEV,UAAA;GACG,GAPC,IAAI,GAOL,IAEN,oBAAC,UAAD;IAEE,MAAK;IACL,MAAK;IACL,iBAAe;IACf,eAAe,MAAM,WAAW,IAAI,GAAG;IAC5B;IAEV,UAAA;GACK,GARD,IAAI,GAQH;EAEZ,CAAC;CACE,CAAA;AAET"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSidebar } from "../core/Sidebar.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/shell/SidebarNavAutoClose.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Closes the mobile nav sheet when a link inside it is followed.
|
|
7
7
|
*
|
|
@@ -42,7 +42,6 @@ const SidebarNavAutoClose = (props) => {
|
|
|
42
42
|
children: props.children
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
|
-
//#endregion
|
|
46
45
|
export { SidebarNavAutoClose };
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=SidebarNavAutoClose.js.map
|
package/dist/shell/Spotlight.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useNavEntries } from "./useNavEntries.js";
|
|
2
1
|
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from "../command/Command.js";
|
|
3
2
|
import { spotlightSearchText } from "./spotlightSearchText.js";
|
|
3
|
+
import { useNavEntries } from "./useNavEntries.js";
|
|
4
4
|
import { useRouter } from "alepha/react/router";
|
|
5
5
|
import { useI18n } from "alepha/react/i18n";
|
|
6
6
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/shell/Spotlight.tsx
|
|
9
9
|
/**
|
|
10
10
|
* Command palette over the navigation tree. Opens on ⌘K / Ctrl+K (or via
|
|
11
11
|
* controlled `open`), searches page labels / keywords / descriptions, and
|
|
@@ -96,7 +96,6 @@ const Spotlight = (props) => {
|
|
|
96
96
|
})
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
-
//#endregion
|
|
100
99
|
export { Spotlight };
|
|
101
100
|
|
|
102
101
|
//# sourceMappingURL=Spotlight.js.map
|
|
@@ -6,6 +6,12 @@ export interface NavItem {
|
|
|
6
6
|
* Required for leaf items. Ignored when `children` is provided (the parent becomes a toggle group).
|
|
7
7
|
*/
|
|
8
8
|
href?: string;
|
|
9
|
+
/**
|
|
10
|
+
* When to fetch the page's code ahead of the click. `false` turns it off.
|
|
11
|
+
*
|
|
12
|
+
* @default "hover"
|
|
13
|
+
*/
|
|
14
|
+
prefetch?: "hover" | "visible" | false;
|
|
9
15
|
/**
|
|
10
16
|
* Either an icon *component* (e.g. a lucide `Users`) which is instantiated
|
|
11
17
|
* with the row's sizing className, or an already-rendered ReactNode element
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appShellNav.d.ts","sourceRoot":"","sources":["../../src/shell/appShellNav.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,KAAK,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAEvD,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;A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C;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAG1D;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACvC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAG5E;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAE1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAuBtD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EACrB,SAAS,EAAE,MAAM,GAChB,SAAS,CAgBX"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/shell/appShellNav.tsx
|
|
4
4
|
function hasActiveDescendant(item) {
|
|
5
5
|
if (item.active) return true;
|
|
6
6
|
return (item.children ?? []).some(hasActiveDescendant);
|
|
@@ -57,7 +57,6 @@ function renderNavIcon(icon, className) {
|
|
|
57
57
|
}
|
|
58
58
|
return /* @__PURE__ */ jsx(icon, { className });
|
|
59
59
|
}
|
|
60
|
-
//#endregion
|
|
61
60
|
export { findOpenPath, hasActiveDescendant, isOpenPathPrefix, renderNavIcon, samePath };
|
|
62
61
|
|
|
63
62
|
//# sourceMappingURL=appShellNav.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appShellNav.js","names":["Icon"],"sources":["../../src/shell/appShellNav.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ComponentType, ReactNode, SVGProps } from \"react\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface NavItem {\n label: ReactNode;\n /**\n * Required for leaf items. Ignored when `children` is provided (the parent becomes a toggle group).\n */\n href?: string;\n /**\n * Either an icon *component* (e.g. a lucide `Users`) which is instantiated\n * with the row's sizing className, or an already-rendered ReactNode element\n * (e.g. `<Users />`). The latter lets nav metadata declared on a `$page`\n * (which is pure React) carry its icon as a node — see `useNavTree`.\n */\n icon?: IconType | ReactNode;\n /**\n * When provided, renders as the active marker. Compare against current path.\n */\n active?: boolean;\n /**\n * Nested items. When set, the parent becomes a collapsible group.\n */\n children?: NavItem[];\n /**\n * Initial open state for groups. Defaults to true if any descendant is active.\n */\n defaultOpen?: boolean;\n /**\n * Optional trailing badge (e.g. unread count). Hidden when the sidebar is collapsed to icons.\n */\n badge?: ReactNode;\n /**\n * When true the item is rendered muted, navigation is blocked, and the\n * `tooltip` (if any) explains why. Use for paywalled / unavailable entries.\n */\n disabled?: boolean;\n /**\n * Hover tooltip shown on the row regardless of sidebar state. When the\n * item is `disabled`, this is the explanation surface (HoverCard, with\n * room to breathe). When the item is enabled, it surfaces as a regular\n * Tooltip on the trigger.\n */\n tooltip?: ReactNode;\n}\n\nexport interface NavGroup {\n label?: string;\n items: NavItem[];\n}\n\nexport function hasActiveDescendant(item: NavItem): boolean {\n if (item.active) return true;\n return (item.children ?? []).some(hasActiveDescendant);\n}\n\n/**\n * The one open branch of the nav tree, when `navAccordion` is on.\n *\n * A single path rather than a set of open ids, because \"one group open\" has to\n * mean one group open PER LEVEL: a nested group closing its own parent to open\n * itself would be a bug, not exclusivity. A path says both things at once - a\n * group is open exactly when its path is a prefix of this one, so opening a\n * sibling replaces the path (the sibling closes) while opening a child extends\n * it (the parent stays).\n *\n * Paths are indices into `nav`: `[groupIndex, itemIndex, ...childIndex]`.\n */\nexport interface NavAccordion {\n openPath: number[];\n setOpenPath: (path: number[]) => void;\n}\n\nexport function isOpenPathPrefix(path: number[], openPath: number[]): boolean {\n if (path.length === 0 || path.length > openPath.length) return false;\n return path.every((index, depth) => openPath[depth] === index);\n}\n\nexport function samePath(a: number[], b: number[]): boolean {\n return a.length === b.length && a.every((index, i) => b[i] === index);\n}\n\n/**\n * The path the accordion should be showing: the DEEPEST group holding the\n * active page, or failing that the first group asking for `defaultOpen`.\n *\n * Computed here, from the tree, rather than reported upwards by the item that\n * notices it is active. An item cannot set its parent's state during render\n * (React refuses to update another component mid-render), and doing it in an\n * effect costs a frame of the wrong group being open on every navigation.\n */\nexport function findOpenPath(nav: NavGroup[]): number[] {\n let fallback: number[] = [];\n\n const walk = (item: NavItem, path: number[]): number[] | undefined => {\n const children = item.children ?? [];\n if (children.length === 0) return undefined;\n for (let ci = 0; ci < children.length; ci++) {\n const deeper = walk(children[ci]!, [...path, ci]);\n if (deeper) return deeper;\n }\n if (hasActiveDescendant(item)) return path;\n if (fallback.length === 0 && item.defaultOpen) fallback = path;\n return undefined;\n };\n\n for (let gi = 0; gi < nav.length; gi++) {\n const items = nav[gi]?.items ?? [];\n for (let ii = 0; ii < items.length; ii++) {\n const found = walk(items[ii]!, [gi, ii]);\n if (found) return found;\n }\n }\n return fallback;\n}\n\n/**\n * Render a NavItem icon. An already-created element (e.g. `<Users />`, which\n * `React.isValidElement` recognises) is returned as-is; anything else is\n * treated as a component *type* — including lucide's `forwardRef` icons, which\n * are objects rather than plain functions — and instantiated with the row's\n * sizing className.\n */\nexport function renderNavIcon(\n icon: NavItem[\"icon\"],\n className: string,\n): ReactNode {\n if (icon == null || icon === false) return null;\n if (React.isValidElement(icon)) {\n // Already an element (e.g. `<Users />`): clone it to apply the row's sizing\n // className so element icons render at the same size as component icons,\n // merging with any className the caller already set.\n const existing = (icon.props as { className?: string })?.className;\n return React.cloneElement(\n icon as React.ReactElement<{ className?: string }>,\n {\n className: existing ? `${existing} ${className}` : className,\n },\n );\n }\n const Icon = icon as IconType;\n return <Icon className={className} />;\n}\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"appShellNav.js","names":["Icon"],"sources":["../../src/shell/appShellNav.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { ComponentType, ReactNode, SVGProps } from \"react\";\n\ntype IconType = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport interface NavItem {\n label: ReactNode;\n /**\n * Required for leaf items. Ignored when `children` is provided (the parent becomes a toggle group).\n */\n href?: string;\n /**\n * When to fetch the page's code ahead of the click. `false` turns it off.\n *\n * @default \"hover\"\n */\n prefetch?: \"hover\" | \"visible\" | false;\n /**\n * Either an icon *component* (e.g. a lucide `Users`) which is instantiated\n * with the row's sizing className, or an already-rendered ReactNode element\n * (e.g. `<Users />`). The latter lets nav metadata declared on a `$page`\n * (which is pure React) carry its icon as a node — see `useNavTree`.\n */\n icon?: IconType | ReactNode;\n /**\n * When provided, renders as the active marker. Compare against current path.\n */\n active?: boolean;\n /**\n * Nested items. When set, the parent becomes a collapsible group.\n */\n children?: NavItem[];\n /**\n * Initial open state for groups. Defaults to true if any descendant is active.\n */\n defaultOpen?: boolean;\n /**\n * Optional trailing badge (e.g. unread count). Hidden when the sidebar is collapsed to icons.\n */\n badge?: ReactNode;\n /**\n * When true the item is rendered muted, navigation is blocked, and the\n * `tooltip` (if any) explains why. Use for paywalled / unavailable entries.\n */\n disabled?: boolean;\n /**\n * Hover tooltip shown on the row regardless of sidebar state. When the\n * item is `disabled`, this is the explanation surface (HoverCard, with\n * room to breathe). When the item is enabled, it surfaces as a regular\n * Tooltip on the trigger.\n */\n tooltip?: ReactNode;\n}\n\nexport interface NavGroup {\n label?: string;\n items: NavItem[];\n}\n\nexport function hasActiveDescendant(item: NavItem): boolean {\n if (item.active) return true;\n return (item.children ?? []).some(hasActiveDescendant);\n}\n\n/**\n * The one open branch of the nav tree, when `navAccordion` is on.\n *\n * A single path rather than a set of open ids, because \"one group open\" has to\n * mean one group open PER LEVEL: a nested group closing its own parent to open\n * itself would be a bug, not exclusivity. A path says both things at once - a\n * group is open exactly when its path is a prefix of this one, so opening a\n * sibling replaces the path (the sibling closes) while opening a child extends\n * it (the parent stays).\n *\n * Paths are indices into `nav`: `[groupIndex, itemIndex, ...childIndex]`.\n */\nexport interface NavAccordion {\n openPath: number[];\n setOpenPath: (path: number[]) => void;\n}\n\nexport function isOpenPathPrefix(path: number[], openPath: number[]): boolean {\n if (path.length === 0 || path.length > openPath.length) return false;\n return path.every((index, depth) => openPath[depth] === index);\n}\n\nexport function samePath(a: number[], b: number[]): boolean {\n return a.length === b.length && a.every((index, i) => b[i] === index);\n}\n\n/**\n * The path the accordion should be showing: the DEEPEST group holding the\n * active page, or failing that the first group asking for `defaultOpen`.\n *\n * Computed here, from the tree, rather than reported upwards by the item that\n * notices it is active. An item cannot set its parent's state during render\n * (React refuses to update another component mid-render), and doing it in an\n * effect costs a frame of the wrong group being open on every navigation.\n */\nexport function findOpenPath(nav: NavGroup[]): number[] {\n let fallback: number[] = [];\n\n const walk = (item: NavItem, path: number[]): number[] | undefined => {\n const children = item.children ?? [];\n if (children.length === 0) return undefined;\n for (let ci = 0; ci < children.length; ci++) {\n const deeper = walk(children[ci]!, [...path, ci]);\n if (deeper) return deeper;\n }\n if (hasActiveDescendant(item)) return path;\n if (fallback.length === 0 && item.defaultOpen) fallback = path;\n return undefined;\n };\n\n for (let gi = 0; gi < nav.length; gi++) {\n const items = nav[gi]?.items ?? [];\n for (let ii = 0; ii < items.length; ii++) {\n const found = walk(items[ii]!, [gi, ii]);\n if (found) return found;\n }\n }\n return fallback;\n}\n\n/**\n * Render a NavItem icon. An already-created element (e.g. `<Users />`, which\n * `React.isValidElement` recognises) is returned as-is; anything else is\n * treated as a component *type* — including lucide's `forwardRef` icons, which\n * are objects rather than plain functions — and instantiated with the row's\n * sizing className.\n */\nexport function renderNavIcon(\n icon: NavItem[\"icon\"],\n className: string,\n): ReactNode {\n if (icon == null || icon === false) return null;\n if (React.isValidElement(icon)) {\n // Already an element (e.g. `<Users />`): clone it to apply the row's sizing\n // className so element icons render at the same size as component icons,\n // merging with any className the caller already set.\n const existing = (icon.props as { className?: string })?.className;\n return React.cloneElement(\n icon as React.ReactElement<{ className?: string }>,\n {\n className: existing ? `${existing} ${className}` : className,\n },\n );\n }\n const Icon = icon as IconType;\n return <Icon className={className} />;\n}\n"],"mappings":";;;AA8DA,SAAgB,oBAAoB,MAAwB;CAC1D,IAAI,KAAK,QAAQ,OAAO;CACxB,QAAQ,KAAK,YAAY,CAAC,EAAA,CAAG,KAAK,mBAAmB;AACvD;AAmBA,SAAgB,iBAAiB,MAAgB,UAA6B;CAC5E,IAAI,KAAK,WAAW,KAAK,KAAK,SAAS,SAAS,QAAQ,OAAO;CAC/D,OAAO,KAAK,OAAO,OAAO,UAAU,SAAS,WAAW,KAAK;AAC/D;AAEA,SAAgB,SAAS,GAAa,GAAsB;CAC1D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,OAAO,MAAM,EAAE,OAAO,KAAK;AACtE;;;;;;;;;;AAWA,SAAgB,aAAa,KAA2B;CACtD,IAAI,WAAqB,CAAC;CAE1B,MAAM,QAAQ,MAAe,SAAyC;EACpE,MAAM,WAAW,KAAK,YAAY,CAAC;EACnC,IAAI,SAAS,WAAW,GAAG,OAAO,KAAA;EAClC,KAAK,IAAI,KAAK,GAAG,KAAK,SAAS,QAAQ,MAAM;GAC3C,MAAM,SAAS,KAAK,SAAS,KAAM,CAAC,GAAG,MAAM,EAAE,CAAC;GAChD,IAAI,QAAQ,OAAO;EACrB;EACA,IAAI,oBAAoB,IAAI,GAAG,OAAO;EACtC,IAAI,SAAS,WAAW,KAAK,KAAK,aAAa,WAAW;CAE5D;CAEA,KAAK,IAAI,KAAK,GAAG,KAAK,IAAI,QAAQ,MAAM;EACtC,MAAM,QAAQ,IAAI,GAAG,EAAE,SAAS,CAAC;EACjC,KAAK,IAAI,KAAK,GAAG,KAAK,MAAM,QAAQ,MAAM;GACxC,MAAM,QAAQ,KAAK,MAAM,KAAM,CAAC,IAAI,EAAE,CAAC;GACvC,IAAI,OAAO,OAAO;EACpB;CACF;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,cACd,MACA,WACW;CACX,IAAI,QAAQ,QAAQ,SAAS,OAAO,OAAO;CAC3C,IAAI,MAAM,eAAe,IAAI,GAAG;EAI9B,MAAM,WAAY,KAAK,OAAkC;EACzD,OAAO,MAAM,aACX,MACA,EACE,WAAW,WAAW,GAAG,SAAS,GAAG,cAAc,UACrD,CACF;CACF;CAEA,OAAO,oBAACA,MAAD,EAAiB,UAAY,CAAA;AACtC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $atom, z } from "alepha";
|
|
2
|
-
|
|
2
|
+
// src/shell/inboxUnreadAtom.ts
|
|
3
3
|
/**
|
|
4
4
|
* How many messages the signed-in viewer has not read, **across every
|
|
5
5
|
* scope**.
|
|
@@ -23,7 +23,6 @@ const inboxUnreadAtom = $atom({
|
|
|
23
23
|
schema: z.object({ count: z.integer() }),
|
|
24
24
|
default: { count: 0 }
|
|
25
25
|
});
|
|
26
|
-
//#endregion
|
|
27
26
|
export { inboxUnreadAtom };
|
|
28
27
|
|
|
29
28
|
//# sourceMappingURL=inboxUnreadAtom.js.map
|
package/dist/shell/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { ActionErrorToaster } from "./ActionErrorToaster.js";
|
|
1
2
|
import { $pageNav } from "./$pageNav.js";
|
|
3
|
+
import { AppActions } from "./AppActions.js";
|
|
4
|
+
import { AppShell } from "./AppShell.js";
|
|
2
5
|
import { ButtonDark } from "./ButtonDark.js";
|
|
6
|
+
import { ButtonInbox } from "./ButtonInbox.js";
|
|
3
7
|
import { ButtonLanguage } from "./ButtonLanguage.js";
|
|
8
|
+
import { ButtonSettings } from "./ButtonSettings.js";
|
|
4
9
|
import { ButtonTheme } from "./ButtonTheme.js";
|
|
5
10
|
import { ButtonUser } from "./ButtonUser.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
11
|
+
import { DetailAside } from "./DetailAside.js";
|
|
12
|
+
import { DetailLayout } from "./DetailLayout.js";
|
|
13
|
+
import { inboxUnreadAtom } from "./inboxUnreadAtom.js";
|
|
8
14
|
import { NavigationProgress } from "./NavigationProgress.js";
|
|
9
|
-
import { SidebarNavAutoClose } from "./SidebarNavAutoClose.js";
|
|
10
|
-
import { AppShell } from "./AppShell.js";
|
|
11
15
|
import { NavShell } from "./NavShell.js";
|
|
16
|
+
import { PlateLayout } from "./PlateLayout.js";
|
|
17
|
+
import { SidebarNavAutoClose } from "./SidebarNavAutoClose.js";
|
|
12
18
|
import { Spotlight } from "./Spotlight.js";
|
|
13
|
-
import { DetailLayout } from "./DetailLayout.js";
|
|
14
19
|
import { useDetailTab } from "./useDetailTab.js";
|
|
15
|
-
import { DetailAside } from "./DetailAside.js";
|
|
16
|
-
import { AppActions } from "./AppActions.js";
|
|
17
|
-
import { inboxUnreadAtom } from "./inboxUnreadAtom.js";
|
|
18
|
-
import { ButtonInbox } from "./ButtonInbox.js";
|
|
19
|
-
import { PlateLayout } from "./PlateLayout.js";
|
|
20
20
|
export { $pageNav, ActionErrorToaster, AppActions, AppShell, ButtonDark, ButtonInbox, ButtonLanguage, ButtonSettings, ButtonTheme, ButtonUser, DetailAside, DetailLayout, NavShell, NavigationProgress, PlateLayout, SidebarNavAutoClose, Spotlight, inboxUnreadAtom, useDetailTab };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shell/navTreeUtil.ts
|
|
2
2
|
/**
|
|
3
3
|
* A page's nav metadata, widened to the shell's own {@link NavMeta}.
|
|
4
4
|
*
|
|
@@ -104,7 +104,6 @@ function keepDeepestActive(entries) {
|
|
|
104
104
|
for (const entry of entries) if (entry.active && entry.href.length < deepest) entry.active = false;
|
|
105
105
|
return entries;
|
|
106
106
|
}
|
|
107
|
-
//#endregion
|
|
108
107
|
export { hasNavPermission, isActivePath, isDescendantOf, keepDeepestActive, navGroupLabel, navLabel, navMeta };
|
|
109
108
|
|
|
110
109
|
//# sourceMappingURL=navTreeUtil.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/shell/spotlightSearchText.ts
|
|
2
2
|
/**
|
|
3
3
|
* A `ReactNode` label as searchable text. A component label contributes
|
|
4
4
|
* nothing, which is what `nav.keywords` is for.
|
|
@@ -22,7 +22,6 @@ const spotlightSearchText = (entry) => {
|
|
|
22
22
|
const value = `${entry.name} ${toText(entry.label)}`;
|
|
23
23
|
return keywords.length > 0 ? `${value} ${keywords.join(" ")}` : value;
|
|
24
24
|
};
|
|
25
|
-
//#endregion
|
|
26
25
|
export { spotlightSearchText };
|
|
27
26
|
|
|
28
27
|
//# sourceMappingURL=spotlightSearchText.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "alepha";
|
|
2
2
|
import { useQueryParams } from "alepha/react/router";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
-
|
|
4
|
+
// src/shell/useDetailTab.tsx
|
|
5
5
|
/**
|
|
6
6
|
* `.tsx` despite holding no JSX, like `useConfirmedAction.tsx`: both were named
|
|
7
7
|
* when the package exported one wildcard subpath per component, which resolved
|
|
@@ -31,7 +31,6 @@ const useDetailTab = (defaultTab) => {
|
|
|
31
31
|
const setTab = useCallback((next) => setQuery({ tab: next }), [setQuery]);
|
|
32
32
|
return [query.tab ?? defaultTab, setTab];
|
|
33
33
|
};
|
|
34
|
-
//#endregion
|
|
35
34
|
export { useDetailTab };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=useDetailTab.js.map
|
|
@@ -2,7 +2,7 @@ import { navLabel } from "./navTreeUtil.js";
|
|
|
2
2
|
import { useRouterState } from "alepha/react/router";
|
|
3
3
|
import { useI18n } from "alepha/react/i18n";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
|
-
|
|
5
|
+
// src/shell/useNavBreadcrumbs.ts
|
|
6
6
|
/**
|
|
7
7
|
* Derive the breadcrumb trail from the active route layers. Each rendered
|
|
8
8
|
* layer that carries a route becomes a crumb (labelled via {@link navLabel});
|
|
@@ -37,7 +37,6 @@ function useNavBreadcrumbs(options) {
|
|
|
37
37
|
lang
|
|
38
38
|
]);
|
|
39
39
|
}
|
|
40
|
-
//#endregion
|
|
41
40
|
export { useNavBreadcrumbs };
|
|
42
41
|
|
|
43
42
|
//# sourceMappingURL=useNavBreadcrumbs.js.map
|
|
@@ -3,7 +3,7 @@ import { useRouter, useRouterState } from "alepha/react/router";
|
|
|
3
3
|
import { useI18n } from "alepha/react/i18n";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { useAuth } from "alepha/react/auth";
|
|
6
|
-
|
|
6
|
+
// src/shell/useNavEntries.ts
|
|
7
7
|
/**
|
|
8
8
|
* Flat, filtered, sorted list of nav entries for the subtree under `root`.
|
|
9
9
|
* Filtering (hidden / permission / `can`), labelling and active-state matching
|
|
@@ -59,7 +59,6 @@ function useNavEntries(options) {
|
|
|
59
59
|
lang
|
|
60
60
|
]);
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
62
|
export { useNavEntries };
|
|
64
63
|
|
|
65
64
|
//# sourceMappingURL=useNavEntries.js.map
|
package/dist/shell/useNavTree.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useNavEntries } from "./useNavEntries.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
|
|
3
|
+
// src/shell/useNavTree.ts
|
|
4
4
|
/**
|
|
5
5
|
* Derive sidebar navigation groups from the route tree. Built on the shared
|
|
6
6
|
* {@link useNavEntries} (which handles filtering, permissions, `can`, labelling
|
|
@@ -42,7 +42,6 @@ function toNavItem(entry) {
|
|
|
42
42
|
active: entry.active
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
//#endregion
|
|
46
45
|
export { useNavTree };
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=useNavTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/table/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAelE,OAAO,KAAK,EAEV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EAIhB,MAAM,qBAAqB,CAAC;AAU7B,MAAM,MAAM,cAAc,CACxB,CAAC,EACD,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,IACvD,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACpB,CAAC,EACD,KAAK,CAAC,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,SAExD,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/table/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAelE,OAAO,KAAK,EAEV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EAIhB,MAAM,qBAAqB,CAAC;AAU7B,MAAM,MAAM,cAAc,CACxB,CAAC,EACD,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,IACvD,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACpB,CAAC,EACD,KAAK,CAAC,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,SAExD,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,sBAqjB5B,CAAC"}
|
package/dist/table/DataTable.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
1
|
import { Table, TableHeader } from "../core/Table.js";
|
|
3
2
|
import { useIsMobile } from "../core/useIsMobile.js";
|
|
4
3
|
import { useToast } from "../core/useToast.js";
|
|
4
|
+
import { cn } from "../core/utils.js";
|
|
5
5
|
import { DataTableBody } from "./DataTableBody.js";
|
|
6
6
|
import { DataTableBulkBar } from "./DataTableBulkBar.js";
|
|
7
7
|
import { DATA_TABLE_CELL_PADDING } from "./dataTableCellPadding.js";
|
|
@@ -23,7 +23,7 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
23
23
|
import { useCallback, useMemo, useRef, useState } from "react";
|
|
24
24
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
25
|
import { ClientOnly, useAlepha } from "alepha/react";
|
|
26
|
-
|
|
26
|
+
// src/table/DataTable.tsx
|
|
27
27
|
/**
|
|
28
28
|
* A data table: server-side or static rows, sorting, filters, row and bulk
|
|
29
29
|
* actions, persisted preferences.
|
|
@@ -233,7 +233,7 @@ const DataTable = (props) => {
|
|
|
233
233
|
const canResetFilters = hasActiveFilters || filterVisibility.differsFromDeclaration;
|
|
234
234
|
const isEmptyState = !loading && data.length === 0;
|
|
235
235
|
const hasHelp = props.help != null && props.help !== false && props.help !== "";
|
|
236
|
-
const showToolbar = Boolean(props.filters) || Boolean(props.toolbar) || Boolean(props.actions?.length) || hasHelp || !props.hideColumnPicker || !props.hideActionsMenu;
|
|
236
|
+
const showToolbar = Boolean(props.filters) || Boolean(props.leading) || Boolean(props.toolbar) || Boolean(props.actions?.length) || hasHelp || !props.hideColumnPicker || !props.hideActionsMenu;
|
|
237
237
|
const rawSummaryContent = props.summary?.content;
|
|
238
238
|
const summaryContent = typeof rawSummaryContent === "function" ? rawSummaryContent({ refreshKey }) : rawSummaryContent;
|
|
239
239
|
const hasSummaryContent = summaryContent != null && summaryContent !== false && summaryContent !== "";
|
|
@@ -273,6 +273,7 @@ const DataTable = (props) => {
|
|
|
273
273
|
shownFilters: filterVisibility.shown,
|
|
274
274
|
onShownFiltersChange: filterVisibility.setShown,
|
|
275
275
|
canResetFilters,
|
|
276
|
+
leading: props.leading,
|
|
276
277
|
toolbar: props.toolbar,
|
|
277
278
|
actions: props.actions,
|
|
278
279
|
help: hasHelp ? props.help : void 0,
|
|
@@ -357,7 +358,6 @@ const DataTable = (props) => {
|
|
|
357
358
|
]
|
|
358
359
|
}) });
|
|
359
360
|
};
|
|
360
|
-
//#endregion
|
|
361
361
|
export { DataTable };
|
|
362
362
|
|
|
363
363
|
//# sourceMappingURL=DataTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","names":[],"sources":["../../src/table/DataTable.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { ClientOnly, useAlepha } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { Table, TableHeader } from \"../core/Table.tsx\";\nimport { useIsMobile } from \"../core/useIsMobile.ts\";\nimport { useToast } from \"../core/useToast.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { DataTableBody } from \"./DataTableBody.tsx\";\nimport { DataTableBulkBar } from \"./DataTableBulkBar.tsx\";\nimport { DATA_TABLE_CELL_PADDING } from \"./dataTableCellPadding.ts\";\nimport { DataTableFooter, PAGE_SIZES } from \"./DataTableFooter.tsx\";\nimport { DataTableHeaderRow } from \"./DataTableHeaderRow.tsx\";\nimport {\n persistedColumns,\n persistedOrder,\n persistedSize,\n persistedSort,\n} from \"./dataTablePersistence.ts\";\nimport { DATA_TABLE_SQUARE_RIGHT } from \"./dataTableSquareRight.ts\";\nimport { DataTableSummaryPanel } from \"./DataTableSummaryPanel.tsx\";\nimport { DataTableToolbar } from \"./DataTableToolbar.tsx\";\nimport type {\n DataTableCellContext,\n DataTableFilterFields,\n DataTableNoFilterFields,\n DataTableSource,\n BulkActionContext,\n ColumnDef,\n RowActionContext,\n} from \"./dataTableTypes.ts\";\nimport { cleanFilterValues } from \"./queryFilters.ts\";\nimport { useDataTableColumns } from \"./useDataTableColumns.ts\";\nimport { useDataTableData } from \"./useDataTableData.ts\";\nimport { useDataTableFilterForm } from \"./useDataTableFilterForm.ts\";\nimport { useDataTableFilterVisibility } from \"./useDataTableFilterVisibility.ts\";\nimport { useDataTableRefresh } from \"./useDataTableRefresh.ts\";\nimport { useDataTableSummary } from \"./useDataTableSummary.ts\";\nimport { useTableSelection } from \"./useTableSelection.ts\";\n\nexport type DataTableProps<\n T,\n F extends DataTableFilterFields = DataTableNoFilterFields,\n> = DataTableBaseProps<T, F> & DataTableSource<T, F>;\n\n/**\n * A data table: server-side or static rows, sorting, filters, row and bulk\n * actions, persisted preferences.\n *\n * `T` is the row. `F` is the type of `filters.fields`, written as\n * `typeof filterFields` beside the row type, which is what types `fetch`'s\n * filters, the `data` predicate, `initialValues`, `seedValues` and\n * `fromQuery`. It defaults to no filters at all, so a table given `fields`\n * without it does not compile.\n */\nexport const DataTable = <\n T,\n const F extends DataTableFilterFields = DataTableNoFilterFields,\n>(\n props: DataTableProps<T, F>,\n) => {\n /**\n * The props, with their filters read untyped. The parts below enumerate\n * filter keys at runtime and never read one by name, so the type of `F` is\n * the call site's business and one cast here keeps it out of every hook.\n */\n const untyped = props as unknown as DataTableProps<T, DataTableFilterFields>;\n\n /**\n * `persistenceKey`, once per facet.\n *\n * A facet that is off gets `undefined`, which is the same value every\n * persistence helper here already treats as \"do not store\" - so turning one\n * off takes the branch a table with no key has always taken, rather than a\n * new one. That is what keeps the default behaviour of `persistenceKey`\n * exactly as it was: with `persist` absent, all three of these ARE\n * `props.persistenceKey`.\n *\n * Primitives, so they go straight into the dependency arrays and `useState`\n * initializers below without giving any of them a new identity per render.\n */\n const filtersKey =\n props.persist?.filters === false ? undefined : props.persistenceKey;\n const columnsKey =\n props.persist?.columns === false ? undefined : props.persistenceKey;\n const sortKey =\n props.persist?.sort === false ? undefined : props.persistenceKey;\n // `pageSizes={[]}` hides the picker, and with it the reader's say in the\n // size: a size stored while the picker was still there must not outlive\n // it, or a reader who once chose 50 is stuck at 50 with no control left to\n // change it. The call site's `defaultSize` is the size, full stop.\n const sizeKey =\n props.pageSizes?.length === 0 ? undefined : props.persistenceKey;\n\n // State, not a constant. It was `props.defaultSize ?? 20` read once, so a\n // reader had no way to see more rows than the call site had decided for\n // them. Already in `load`'s dependency array, so changing it refetches.\n const [size, setSize] = useState<number>(() =>\n persistedSize(sizeKey, props.defaultSize),\n );\n const alepha = useAlepha();\n const { tr } = useI18n();\n const toast = useToast();\n /**\n * The whole of the phone layout, and deliberately one switch rather than a\n * scattering of `max-md:` classes: the filter controls have to be rendered\n * in exactly ONE of the two places (see `DataTableFilterDialog`), which\n * CSS cannot express. Everything else below the breakpoint follows the same\n * flag so the two halves of the layout cannot disagree.\n *\n * Safe against hydration because the whole table sits inside `ClientOnly`,\n * and `useIsMobile` reads the same `MediaQueryList` it subscribes to.\n */\n const isMobile = useIsMobile();\n\n const { form, definition: filterDefinition } = useDataTableFilterForm({\n props: untyped,\n filtersKey,\n alepha,\n });\n\n const filterVisibility = useDataTableFilterVisibility({\n definition: filterDefinition,\n filtersKey,\n });\n\n const {\n page,\n setPage,\n sizeForm,\n sort,\n setSort,\n data,\n meta,\n rowFilters,\n loading,\n refreshKey,\n setRefreshKey,\n isRefreshing,\n setIsRefreshing,\n toggleSort,\n setSortTo,\n } = useDataTableData({\n props: untyped,\n size,\n setSize,\n sortKey,\n form,\n alepha,\n });\n\n const { refresh, handleRefreshClick, resetFilters, canShare, shareFilters } =\n useDataTableRefresh({\n props: untyped,\n form,\n filterKeys: filterDefinition?.keys ?? [],\n resetShownFilters: filterVisibility.resetShown,\n filtersKey,\n alepha,\n toast,\n tr,\n setPage,\n setRefreshKey,\n setIsRefreshing,\n });\n\n const summary = useDataTableSummary({\n summary: untyped.summary,\n persistenceKey: props.persistenceKey,\n refreshKey,\n form,\n alepha,\n });\n\n // -- Row identity ----------------------------------------------------------\n\n /**\n * A row's key, in order of preference: the caller's `rowKey`, the row's own\n * `id`, then where the row sits.\n *\n * The last one used to be `Math.random()`, which is not an identity at all.\n * Every render produced a new key, so React saw every id-less row as a new\n * row and remounted it: focus in an inline input was lost the moment\n * anything else re-rendered, and the list re-animated on every keystroke.\n * Selection was broken by the same thing - `selection.has(rowKey(item))`\n * compared against a key generated one render earlier, so it never matched.\n */\n const rowKeys = useMemo(\n () =>\n data.map((item, index) => {\n if (props.rowKey) return props.rowKey(item);\n const id = (item as { id?: unknown })?.id;\n // Coercion at a boundary: the value is a form/route/chart primitive\n // whose declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string -- a coercion at a boundary, see the comment above\n return id != null ? String(id) : `page-${page}-row-${index}`;\n }),\n [data, page, props.rowKey],\n );\n\n /**\n * Selection asks for a key by item, not by index. Every item it can ask\n * about is one of `data`'s, so a lookup keyed on identity covers it without\n * an O(n) scan per call.\n */\n const rowKeyByItem = useMemo(() => {\n const map = new Map<T, string>();\n data.forEach((item, index) => map.set(item, rowKeys[index]));\n return map;\n }, [data, rowKeys]);\n\n const rowKey = useCallback(\n (item: T): string => rowKeyByItem.get(item) ?? \"\",\n [rowKeyByItem],\n );\n\n // -- Selection -------------------------------------------------------------\n\n const {\n selection,\n selectedItems,\n allSelected,\n someSelected,\n toggleRow,\n toggleAll,\n clearSelection,\n } = useTableSelection(data, rowKey);\n\n // The bulk actions offered for THIS selection: an action's `visible`\n // predicate reads the selected rows. Computed once, here, so the pill's\n // contents and the pill's own presence come from the same list.\n const visibleBulkActions = useMemo(\n () =>\n (props.bulkActions ?? []).filter(\n (action) => action.visible?.(selectedItems) ?? true,\n ),\n [props.bulkActions, selectedItems],\n );\n\n const {\n allColumnKeys,\n visibleColumns,\n setVisibleColumns,\n orderedKeys,\n setColumnOrder,\n moveColumn,\n reorderColumn,\n toggleColumn,\n orderAnnouncement,\n } = useDataTableColumns({ props: untyped, columnsKey, tr });\n\n /**\n * ⚠️ A changed `persistenceKey` is a changed SCOPE, and this is where that\n * is handled.\n *\n * Every caller encodes its scope in that key - `lor.activity.${project.id}`,\n * `lor.epics.${project.id}` - so switching project changes it. Nothing acted\n * on that before, and `load` re-runs only on `[page, size, sortParam,\n * refreshKey, form, alepha]`, none of which a project switch touches. The\n * router does not remount on a param-only navigation either, so the table\n * kept serving the PREVIOUS project's rows under the new project's name\n * (feedback #2096).\n *\n * `refreshKey` is bumped rather than relying on the re-read: two projects\n * can share a stored sort and size, and then no dependency of `load` would\n * change and nothing would refetch. That equality is the bug's whole\n * mechanism, so the refetch cannot be a side effect of the values moving.\n *\n * ⚠️ Adjusted during RENDER, not in an effect, and that is load-bearing.\n * The sort effect (`useDataTableData`) and the column writes\n * (`useDataTableColumns`) are keyed on `persistenceKey` too, so on the\n * render where it changes they would fire in the same flush and write the\n * OUTGOING scope's state under the INCOMING key - silently\n * overwriting the project you just opened with the one you just left. React\n * re-renders before committing this, so by the time those effects run the\n * state is already the new scope's and they write back what was just read.\n *\n * ⚠️ `props.fetch` is still NOT a dependency of `load`. That is the loop\n * `fetchRef` exists to prevent, and several callers write a store atom from\n * inside their fetcher.\n *\n * Filter VALUES are deliberately not reset here: `useForm` captures its\n * `initialValues` once, so resetting them is form surgery rather than a\n * state assignment. They are also not clobbered - the filter-persist effect\n * writes only on `form:changed` / `form:submit:success`, never on mount - so\n * the stored filters of the project you left stay its own.\n */\n const scopeRef = useRef(props.persistenceKey);\n if (scopeRef.current !== props.persistenceKey) {\n scopeRef.current = props.persistenceKey;\n setPage(0);\n setSize(persistedSize(sizeKey, props.defaultSize));\n setSort(persistedSort(sortKey, props.defaultSort));\n setVisibleColumns(persistedColumns(columnsKey, props.columns));\n // Same render pass as the rest, and for the identical reason: the effects\n // keyed on `persistenceKey` fire in one flush, so an order left behind\n // here would be written back under the INCOMING key.\n setColumnOrder(persistedOrder(columnsKey, props.columns));\n // Which filters are on the bar is the scope's too, and read here for the\n // same reason: the project just opened must not show the bar of the one\n // just left.\n filterVisibility.rereadShown(filtersKey);\n // The panel's open state is the scope's like the size is, and its cards\n // are the scope's figures: they go now, and the bump below refetches.\n summary.resetScope(props.persistenceKey);\n setRefreshKey((k) => k + 1);\n }\n\n // -- Render ---------------------------------------------------------------\n\n // The reader's order, not the declaration's.\n const cols = orderedKeys.map((key) => [key, props.columns[key]!]) as Array<\n [string, ColumnDef<T>]\n >;\n const visibleCols = cols.filter(([key]) => visibleColumns.has(key));\n const hasCheckbox = Boolean(props.bulkActions?.length);\n const hasRowActions = Boolean(props.rowActions);\n\n const rowCtx: RowActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n const bulkCtx: BulkActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n\n /**\n * How many filters currently narrow the list — a count rather than the\n * boolean this used to be, because on a phone the bar is behind a button\n * and the trigger's badge is the only thing that says the table is\n * filtered at all.\n */\n const activeFilterCount = useMemo(() => {\n if (!props.filters || !form) return 0;\n return Object.keys(cleanFilterValues(form.currentValues ?? {})).length;\n }, [props.filters, form, refreshKey]);\n const hasActiveFilters = activeFilterCount > 0;\n\n // What every cell is told beside its row: the search the rows on screen\n // answer, from the first `preset: \"search\"` field holding one.\n const searchKey = Object.entries(props.filters?.fields ?? {}).find(\n ([, field]) => field.preset === \"search\",\n )?.[0];\n const rowSearch = searchKey ? rowFilters?.[searchKey] : undefined;\n const cellContext: DataTableCellContext = {\n search:\n typeof rowSearch === \"string\" && rowSearch.trim() !== \"\"\n ? rowSearch.trim()\n : undefined,\n };\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * is not the one the table declares. Not the count alone, or a reader who\n * removed a default filter would have no way to bring it back.\n */\n const canResetFilters =\n hasActiveFilters || filterVisibility.differsFromDeclaration;\n\n // The empty state is showing, as opposed to the skeleton that also renders\n // on `data.length === 0`. Read by the `<Table>` height as well as the body,\n // so the two cannot disagree.\n const isEmptyState = !loading && data.length === 0;\n\n // A node that draws nothing is no help and no content: the `?` and the\n // band would open on an empty card. Decided here, once, and handed down\n // as `undefined` when it is empty.\n const hasHelp =\n props.help != null && props.help !== false && props.help !== \"\";\n const showToolbar =\n Boolean(props.filters) ||\n Boolean(props.toolbar) ||\n Boolean(props.actions?.length) ||\n hasHelp ||\n !props.hideColumnPicker ||\n !props.hideActionsMenu;\n // Drawn while a first fetch is out (its placeholders), and after that only\n // with something in it: a summary with no card and no content is no band.\n // A function is called on every render, which only builds its element: the\n // panel mounts it while open, and the counter is what tells it to reload.\n const rawSummaryContent = props.summary?.content;\n const summaryContent =\n typeof rawSummaryContent === \"function\"\n ? rawSummaryContent({ refreshKey })\n : rawSummaryContent;\n const hasSummaryContent =\n summaryContent != null && summaryContent !== false && summaryContent !== \"\";\n const showSummary =\n Boolean(props.summary) &&\n (summary.cards === undefined ||\n summary.cards.length > 0 ||\n hasSummaryContent);\n const cellPadding = DATA_TABLE_CELL_PADDING[props.cellPadding ?? \"normal\"];\n const squareRight = props.squareRight\n ? DATA_TABLE_SQUARE_RIGHT[`${props.squareRight}`]\n : undefined;\n // `flat` drops the outer frame and keeps the lines between the bands: the\n // toolbar keeps its bottom border, the footer its top one, and the rows\n // lose the sides. Applied after `squareRight`, which has nothing left to\n // square once the corners are gone.\n const flatTop = props.flat && \"rounded-none border-x-0 border-t-0\";\n const flatRows =\n props.flat && \"rounded-none border-x-0 border-t-0 border-b-0\";\n const flatBottom = props.flat && \"rounded-none border-x-0 border-b-0\";\n // The footer holds two controls, the size picker and the page links, and\n // the count beside them. A table that hid the picker (`pageSizes={[]}`)\n // and fits on one page has neither, and \"Page 1 of 1\" alone is a bar\n // saying nothing, so it goes. The links' condition is the footer's own.\n const showFooter =\n (props.pageSizes ?? PAGE_SIZES).length > 0 ||\n Boolean(meta?.totalPages && meta.totalPages > 1);\n const showColumnPicker = !props.hideColumnPicker && allColumnKeys.length > 0;\n const showActionsMenu = !props.hideActionsMenu;\n\n return (\n <ClientOnly>\n <div className={cn(\"flex flex-col gap-2\", props.className)}>\n {props.header && (\n <div className=\"flex items-center gap-2\">\n <div className=\"min-w-0 flex-1\">{props.header}</div>\n </div>\n )}\n\n {/*\n The summary opens the frame when it is there, so it takes the top\n corners `squareRight` squares, and whatever follows it (the filter\n bar, or the rows when there is none) joins under it the way the rows\n join the filter bar: flattened top, no top border, `-mt-2` against\n the wrapper's gap. The panel's own bottom border is the line\n between them.\n */}\n {showSummary && (\n <DataTableSummaryPanel\n title={\n props.summary?.title ??\n tr(\"dataTable.summary\", { default: \"Summary\" })\n }\n open={summary.open}\n onOpenChange={summary.setOpen}\n cards={summary.cards}\n loading={summary.loading}\n content={hasSummaryContent ? summaryContent : undefined}\n className={cn(squareRight?.top, flatTop, props.chromeClassName)}\n />\n )}\n\n {showToolbar && (\n <DataTableToolbar<T>\n columns={props.columns}\n filters={untyped.filters}\n form={form}\n filterDefinition={filterDefinition}\n shownFilters={filterVisibility.shown}\n onShownFiltersChange={filterVisibility.setShown}\n canResetFilters={canResetFilters}\n toolbar={props.toolbar}\n actions={props.actions}\n help={hasHelp ? props.help : undefined}\n isMobile={isMobile}\n showColumnPicker={showColumnPicker}\n showActionsMenu={showActionsMenu}\n activeFilterCount={activeFilterCount}\n canShare={canShare}\n resetFilters={resetFilters}\n shareFilters={shareFilters}\n orderedKeys={orderedKeys}\n visibleColumns={visibleColumns}\n toggleColumn={toggleColumn}\n reorderColumn={reorderColumn}\n isRefreshing={isRefreshing}\n handleRefreshClick={handleRefreshClick}\n className={cn(\n showSummary\n ? \"-mt-2 rounded-t-none border-t-0\"\n : squareRight?.top,\n flatTop,\n props.chromeClassName,\n )}\n />\n )}\n\n {hasCheckbox && selection.size > 0 && visibleBulkActions.length > 0 && (\n <DataTableBulkBar<T>\n selection={selection}\n selectedItems={selectedItems}\n visibleBulkActions={visibleBulkActions}\n bulkCtx={bulkCtx}\n clearSelection={clearSelection}\n />\n )}\n\n {/*\n The toolbar, the rows and the footer are one panel: each facing edge\n is flattened and its border dropped so no double line appears, and\n `-mt-2` cancels the wrapper's `gap-2`. The footer half follows\n `showFooter`, which is true for every table that keeps its size\n picker: gating the footer on `meta` alone would pop the bar in and\n flip this bottom border on every load, since `meta` starts null and\n only fills after the fetch. Only a table that hid the picker can\n lose it, and then the rows close the panel themselves.\n */}\n <div\n className={cn(\n \"flex min-h-0 flex-1 flex-col overflow-auto rounded-md border\",\n (showToolbar || showSummary) && \"-mt-2 rounded-t-none border-t-0\",\n showFooter ? \"rounded-b-none border-b-0\" : squareRight?.bottom,\n flatRows,\n // With no toolbar and no summary the rows open the table, so\n // their top-right corner is the one `squareRight` squares.\n !showToolbar && !showSummary && squareRight?.top,\n // `<Table>` wraps the table in a container div whose classes it\n // hardcodes, and only this table needs that container to grow,\n // so the one class it needs is set from out here instead.\n //\n // `grow`, NOT `flex-1`: `flex-1` sets the basis to 0, and in the\n // ordinary case this wrapper has no height of its own, so a 0\n // basis with nothing to grow into collapses the table to nothing.\n // `grow` keeps the content basis and only spends space that is\n // actually free, which is the full-height case.\n \"[&>[data-slot=table-container]]:grow\",\n )}\n >\n {/* `h-full` ONLY while the empty state is what is in the body.\n It is what lets that one row take the height the scroller grew\n into, so `align-middle` can centre the state in it.\n\n ⚠️ Never unconditionally. A CSS table given a height larger\n than its content does not leave the surplus at the bottom, it\n DISTRIBUTES IT ACROSS THE ROWS - so an unconditional `h-full`\n silently turns a short table into a tall one: Lore's Apps page,\n two rows in a full-height pane, rendered them 239px each. No\n unit test sees it (jsdom computes no layout) and it is invisible\n on a table long enough to fill its own container, which is why\n it reached e2e rather than review. */}\n <Table className={cn(isEmptyState && \"h-full\")}>\n {/* `bg-muted`, fully opaque, NOT the base header's `bg-muted/50`:\n this header is sticky, so anything translucent lets the rows\n scroll visibly through the column labels. Same tint, no\n transparency.\n\n Two inset lines, not one. The bottom is the divider against the\n first row; the top is the `--bevel` highlight, which is what\n gives the band its thickness. Inset shadows rather than borders\n because a border on a sticky `<thead>` is dropped by the\n collapsed table border model, and because the two lines have to\n sit INSIDE the header's own height: it is pinned at `top-0`\n against a scrolling body, so anything painted outside it is\n painted over. */}\n <TableHeader\n className={cn(\n // ⚠️ `[&_tr]:border-b-0` or the bottom rule is drawn TWICE: `TableHeader`\n // gives its rows a `border-b`, and the inset shadow above draws\n // the same line, so the band closed with 2px where it opens with\n // 1px. The inset one wins because it is what survives the sticky\n // header being painted over.\n \"bg-muted sticky top-0 z-10 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)] [&_tr]:border-b-0\",\n props.chromeClassName,\n )}\n >\n <DataTableHeaderRow<T>\n headClassName={cellPadding.head}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n allSelected={allSelected}\n someSelected={someSelected}\n toggleAll={toggleAll}\n sort={sort}\n toggleSort={toggleSort}\n setSortTo={setSortTo}\n moveColumn={moveColumn}\n toggleColumn={toggleColumn}\n />\n </TableHeader>\n <DataTableBody<T>\n cellClassName={cellPadding.cell}\n data={data}\n cellContext={cellContext}\n rowKeys={rowKeys}\n loading={loading}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n hasActiveFilters={hasActiveFilters}\n selection={selection}\n toggleRow={toggleRow}\n rowCtx={rowCtx}\n rowActions={props.rowActions}\n onRowClick={props.onRowClick}\n onRowHover={props.onRowHover}\n empty={props.empty}\n emptyMessage={props.emptyMessage}\n emptyState={props.emptyState}\n noMatchState={props.noMatchState}\n />\n </Table>\n </div>\n\n {/* A move is otherwise silent: nothing about a reordered table is\n spoken, and the visual change is the only feedback. Outside the\n table so it is not read as a cell. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {orderAnnouncement}\n </span>\n\n {showFooter && (\n <DataTableFooter\n pageSizes={props.pageSizes}\n sizeForm={sizeForm}\n meta={meta}\n isMobile={isMobile}\n setPage={setPage}\n className={cn(\n squareRight?.bottom,\n flatBottom,\n props.chromeClassName,\n )}\n />\n )}\n </div>\n </ClientOnly>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAa,aAIX,UACG;;;;;;CAMH,MAAM,UAAU;;;;;;;;;;;;;;CAehB,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,KAAA,IAAY,MAAM;CACvD,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,KAAA,IAAY,MAAM;CACvD,MAAM,UACJ,MAAM,SAAS,SAAS,QAAQ,KAAA,IAAY,MAAM;CAKpD,MAAM,UACJ,MAAM,WAAW,WAAW,IAAI,KAAA,IAAY,MAAM;CAKpD,MAAM,CAAC,MAAM,WAAW,eACtB,cAAc,SAAS,MAAM,WAAW,CAC1C;CACA,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,QAAQ,SAAS;;;;;;;;;;;CAWvB,MAAM,WAAW,YAAY;CAE7B,MAAM,EAAE,MAAM,YAAY,qBAAqB,uBAAuB;EACpE,OAAO;EACP;EACA;CACF,CAAC;CAED,MAAM,mBAAmB,6BAA6B;EACpD,YAAY;EACZ;CACF,CAAC;CAED,MAAM,EACJ,MACA,SACA,UACA,MACA,SACA,MACA,MACA,YACA,SACA,YACA,eACA,cACA,iBACA,YACA,cACE,iBAAiB;EACnB,OAAO;EACP;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,EAAE,SAAS,oBAAoB,cAAc,UAAU,iBAC3D,o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ACJ;IACI;IACD;IACT,WAAW,GACT,aAAa,QACb,YACA,MAAM,eACR;GACD,CAAA;EAEA;CACK,CAAA,EAAA,CAAA;AAEhB"}
|
|
1
|
+
{"version":3,"file":"DataTable.js","names":[],"sources":["../../src/table/DataTable.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { ClientOnly, useAlepha } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { Table, TableHeader } from \"../core/Table.tsx\";\nimport { useIsMobile } from \"../core/useIsMobile.ts\";\nimport { useToast } from \"../core/useToast.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { DataTableBody } from \"./DataTableBody.tsx\";\nimport { DataTableBulkBar } from \"./DataTableBulkBar.tsx\";\nimport { DATA_TABLE_CELL_PADDING } from \"./dataTableCellPadding.ts\";\nimport { DataTableFooter, PAGE_SIZES } from \"./DataTableFooter.tsx\";\nimport { DataTableHeaderRow } from \"./DataTableHeaderRow.tsx\";\nimport {\n persistedColumns,\n persistedOrder,\n persistedSize,\n persistedSort,\n} from \"./dataTablePersistence.ts\";\nimport { DATA_TABLE_SQUARE_RIGHT } from \"./dataTableSquareRight.ts\";\nimport { DataTableSummaryPanel } from \"./DataTableSummaryPanel.tsx\";\nimport { DataTableToolbar } from \"./DataTableToolbar.tsx\";\nimport type {\n DataTableCellContext,\n DataTableFilterFields,\n DataTableNoFilterFields,\n DataTableSource,\n BulkActionContext,\n ColumnDef,\n RowActionContext,\n} from \"./dataTableTypes.ts\";\nimport { cleanFilterValues } from \"./queryFilters.ts\";\nimport { useDataTableColumns } from \"./useDataTableColumns.ts\";\nimport { useDataTableData } from \"./useDataTableData.ts\";\nimport { useDataTableFilterForm } from \"./useDataTableFilterForm.ts\";\nimport { useDataTableFilterVisibility } from \"./useDataTableFilterVisibility.ts\";\nimport { useDataTableRefresh } from \"./useDataTableRefresh.ts\";\nimport { useDataTableSummary } from \"./useDataTableSummary.ts\";\nimport { useTableSelection } from \"./useTableSelection.ts\";\n\nexport type DataTableProps<\n T,\n F extends DataTableFilterFields = DataTableNoFilterFields,\n> = DataTableBaseProps<T, F> & DataTableSource<T, F>;\n\n/**\n * A data table: server-side or static rows, sorting, filters, row and bulk\n * actions, persisted preferences.\n *\n * `T` is the row. `F` is the type of `filters.fields`, written as\n * `typeof filterFields` beside the row type, which is what types `fetch`'s\n * filters, the `data` predicate, `initialValues`, `seedValues` and\n * `fromQuery`. It defaults to no filters at all, so a table given `fields`\n * without it does not compile.\n */\nexport const DataTable = <\n T,\n const F extends DataTableFilterFields = DataTableNoFilterFields,\n>(\n props: DataTableProps<T, F>,\n) => {\n /**\n * The props, with their filters read untyped. The parts below enumerate\n * filter keys at runtime and never read one by name, so the type of `F` is\n * the call site's business and one cast here keeps it out of every hook.\n */\n const untyped = props as unknown as DataTableProps<T, DataTableFilterFields>;\n\n /**\n * `persistenceKey`, once per facet.\n *\n * A facet that is off gets `undefined`, which is the same value every\n * persistence helper here already treats as \"do not store\" - so turning one\n * off takes the branch a table with no key has always taken, rather than a\n * new one. That is what keeps the default behaviour of `persistenceKey`\n * exactly as it was: with `persist` absent, all three of these ARE\n * `props.persistenceKey`.\n *\n * Primitives, so they go straight into the dependency arrays and `useState`\n * initializers below without giving any of them a new identity per render.\n */\n const filtersKey =\n props.persist?.filters === false ? undefined : props.persistenceKey;\n const columnsKey =\n props.persist?.columns === false ? undefined : props.persistenceKey;\n const sortKey =\n props.persist?.sort === false ? undefined : props.persistenceKey;\n // `pageSizes={[]}` hides the picker, and with it the reader's say in the\n // size: a size stored while the picker was still there must not outlive\n // it, or a reader who once chose 50 is stuck at 50 with no control left to\n // change it. The call site's `defaultSize` is the size, full stop.\n const sizeKey =\n props.pageSizes?.length === 0 ? undefined : props.persistenceKey;\n\n // State, not a constant. It was `props.defaultSize ?? 20` read once, so a\n // reader had no way to see more rows than the call site had decided for\n // them. Already in `load`'s dependency array, so changing it refetches.\n const [size, setSize] = useState<number>(() =>\n persistedSize(sizeKey, props.defaultSize),\n );\n const alepha = useAlepha();\n const { tr } = useI18n();\n const toast = useToast();\n /**\n * The whole of the phone layout, and deliberately one switch rather than a\n * scattering of `max-md:` classes: the filter controls have to be rendered\n * in exactly ONE of the two places (see `DataTableFilterDialog`), which\n * CSS cannot express. Everything else below the breakpoint follows the same\n * flag so the two halves of the layout cannot disagree.\n *\n * Safe against hydration because the whole table sits inside `ClientOnly`,\n * and `useIsMobile` reads the same `MediaQueryList` it subscribes to.\n */\n const isMobile = useIsMobile();\n\n const { form, definition: filterDefinition } = useDataTableFilterForm({\n props: untyped,\n filtersKey,\n alepha,\n });\n\n const filterVisibility = useDataTableFilterVisibility({\n definition: filterDefinition,\n filtersKey,\n });\n\n const {\n page,\n setPage,\n sizeForm,\n sort,\n setSort,\n data,\n meta,\n rowFilters,\n loading,\n refreshKey,\n setRefreshKey,\n isRefreshing,\n setIsRefreshing,\n toggleSort,\n setSortTo,\n } = useDataTableData({\n props: untyped,\n size,\n setSize,\n sortKey,\n form,\n alepha,\n });\n\n const { refresh, handleRefreshClick, resetFilters, canShare, shareFilters } =\n useDataTableRefresh({\n props: untyped,\n form,\n filterKeys: filterDefinition?.keys ?? [],\n resetShownFilters: filterVisibility.resetShown,\n filtersKey,\n alepha,\n toast,\n tr,\n setPage,\n setRefreshKey,\n setIsRefreshing,\n });\n\n const summary = useDataTableSummary({\n summary: untyped.summary,\n persistenceKey: props.persistenceKey,\n refreshKey,\n form,\n alepha,\n });\n\n // -- Row identity ----------------------------------------------------------\n\n /**\n * A row's key, in order of preference: the caller's `rowKey`, the row's own\n * `id`, then where the row sits.\n *\n * The last one used to be `Math.random()`, which is not an identity at all.\n * Every render produced a new key, so React saw every id-less row as a new\n * row and remounted it: focus in an inline input was lost the moment\n * anything else re-rendered, and the list re-animated on every keystroke.\n * Selection was broken by the same thing - `selection.has(rowKey(item))`\n * compared against a key generated one render earlier, so it never matched.\n */\n const rowKeys = useMemo(\n () =>\n data.map((item, index) => {\n if (props.rowKey) return props.rowKey(item);\n const id = (item as { id?: unknown })?.id;\n // Coercion at a boundary: the value is a form/route/chart primitive\n // whose declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string -- a coercion at a boundary, see the comment above\n return id != null ? String(id) : `page-${page}-row-${index}`;\n }),\n [data, page, props.rowKey],\n );\n\n /**\n * Selection asks for a key by item, not by index. Every item it can ask\n * about is one of `data`'s, so a lookup keyed on identity covers it without\n * an O(n) scan per call.\n */\n const rowKeyByItem = useMemo(() => {\n const map = new Map<T, string>();\n data.forEach((item, index) => map.set(item, rowKeys[index]));\n return map;\n }, [data, rowKeys]);\n\n const rowKey = useCallback(\n (item: T): string => rowKeyByItem.get(item) ?? \"\",\n [rowKeyByItem],\n );\n\n // -- Selection -------------------------------------------------------------\n\n const {\n selection,\n selectedItems,\n allSelected,\n someSelected,\n toggleRow,\n toggleAll,\n clearSelection,\n } = useTableSelection(data, rowKey);\n\n // The bulk actions offered for THIS selection: an action's `visible`\n // predicate reads the selected rows. Computed once, here, so the pill's\n // contents and the pill's own presence come from the same list.\n const visibleBulkActions = useMemo(\n () =>\n (props.bulkActions ?? []).filter(\n (action) => action.visible?.(selectedItems) ?? true,\n ),\n [props.bulkActions, selectedItems],\n );\n\n const {\n allColumnKeys,\n visibleColumns,\n setVisibleColumns,\n orderedKeys,\n setColumnOrder,\n moveColumn,\n reorderColumn,\n toggleColumn,\n orderAnnouncement,\n } = useDataTableColumns({ props: untyped, columnsKey, tr });\n\n /**\n * ⚠️ A changed `persistenceKey` is a changed SCOPE, and this is where that\n * is handled.\n *\n * Every caller encodes its scope in that key - `lor.activity.${project.id}`,\n * `lor.epics.${project.id}` - so switching project changes it. Nothing acted\n * on that before, and `load` re-runs only on `[page, size, sortParam,\n * refreshKey, form, alepha]`, none of which a project switch touches. The\n * router does not remount on a param-only navigation either, so the table\n * kept serving the PREVIOUS project's rows under the new project's name\n * (feedback #2096).\n *\n * `refreshKey` is bumped rather than relying on the re-read: two projects\n * can share a stored sort and size, and then no dependency of `load` would\n * change and nothing would refetch. That equality is the bug's whole\n * mechanism, so the refetch cannot be a side effect of the values moving.\n *\n * ⚠️ Adjusted during RENDER, not in an effect, and that is load-bearing.\n * The sort effect (`useDataTableData`) and the column writes\n * (`useDataTableColumns`) are keyed on `persistenceKey` too, so on the\n * render where it changes they would fire in the same flush and write the\n * OUTGOING scope's state under the INCOMING key - silently\n * overwriting the project you just opened with the one you just left. React\n * re-renders before committing this, so by the time those effects run the\n * state is already the new scope's and they write back what was just read.\n *\n * ⚠️ `props.fetch` is still NOT a dependency of `load`. That is the loop\n * `fetchRef` exists to prevent, and several callers write a store atom from\n * inside their fetcher.\n *\n * Filter VALUES are deliberately not reset here: `useForm` captures its\n * `initialValues` once, so resetting them is form surgery rather than a\n * state assignment. They are also not clobbered - the filter-persist effect\n * writes only on `form:changed` / `form:submit:success`, never on mount - so\n * the stored filters of the project you left stay its own.\n */\n const scopeRef = useRef(props.persistenceKey);\n if (scopeRef.current !== props.persistenceKey) {\n scopeRef.current = props.persistenceKey;\n setPage(0);\n setSize(persistedSize(sizeKey, props.defaultSize));\n setSort(persistedSort(sortKey, props.defaultSort));\n setVisibleColumns(persistedColumns(columnsKey, props.columns));\n // Same render pass as the rest, and for the identical reason: the effects\n // keyed on `persistenceKey` fire in one flush, so an order left behind\n // here would be written back under the INCOMING key.\n setColumnOrder(persistedOrder(columnsKey, props.columns));\n // Which filters are on the bar is the scope's too, and read here for the\n // same reason: the project just opened must not show the bar of the one\n // just left.\n filterVisibility.rereadShown(filtersKey);\n // The panel's open state is the scope's like the size is, and its cards\n // are the scope's figures: they go now, and the bump below refetches.\n summary.resetScope(props.persistenceKey);\n setRefreshKey((k) => k + 1);\n }\n\n // -- Render ---------------------------------------------------------------\n\n // The reader's order, not the declaration's.\n const cols = orderedKeys.map((key) => [key, props.columns[key]!]) as Array<\n [string, ColumnDef<T>]\n >;\n const visibleCols = cols.filter(([key]) => visibleColumns.has(key));\n const hasCheckbox = Boolean(props.bulkActions?.length);\n const hasRowActions = Boolean(props.rowActions);\n\n const rowCtx: RowActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n const bulkCtx: BulkActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n\n /**\n * How many filters currently narrow the list — a count rather than the\n * boolean this used to be, because on a phone the bar is behind a button\n * and the trigger's badge is the only thing that says the table is\n * filtered at all.\n */\n const activeFilterCount = useMemo(() => {\n if (!props.filters || !form) return 0;\n return Object.keys(cleanFilterValues(form.currentValues ?? {})).length;\n }, [props.filters, form, refreshKey]);\n const hasActiveFilters = activeFilterCount > 0;\n\n // What every cell is told beside its row: the search the rows on screen\n // answer, from the first `preset: \"search\"` field holding one.\n const searchKey = Object.entries(props.filters?.fields ?? {}).find(\n ([, field]) => field.preset === \"search\",\n )?.[0];\n const rowSearch = searchKey ? rowFilters?.[searchKey] : undefined;\n const cellContext: DataTableCellContext = {\n search:\n typeof rowSearch === \"string\" && rowSearch.trim() !== \"\"\n ? rowSearch.trim()\n : undefined,\n };\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * is not the one the table declares. Not the count alone, or a reader who\n * removed a default filter would have no way to bring it back.\n */\n const canResetFilters =\n hasActiveFilters || filterVisibility.differsFromDeclaration;\n\n // The empty state is showing, as opposed to the skeleton that also renders\n // on `data.length === 0`. Read by the `<Table>` height as well as the body,\n // so the two cannot disagree.\n const isEmptyState = !loading && data.length === 0;\n\n // A node that draws nothing is no help and no content: the `?` and the\n // band would open on an empty card. Decided here, once, and handed down\n // as `undefined` when it is empty.\n const hasHelp =\n props.help != null && props.help !== false && props.help !== \"\";\n const showToolbar =\n Boolean(props.filters) ||\n Boolean(props.leading) ||\n Boolean(props.toolbar) ||\n Boolean(props.actions?.length) ||\n hasHelp ||\n !props.hideColumnPicker ||\n !props.hideActionsMenu;\n // Drawn while a first fetch is out (its placeholders), and after that only\n // with something in it: a summary with no card and no content is no band.\n // A function is called on every render, which only builds its element: the\n // panel mounts it while open, and the counter is what tells it to reload.\n const rawSummaryContent = props.summary?.content;\n const summaryContent =\n typeof rawSummaryContent === \"function\"\n ? rawSummaryContent({ refreshKey })\n : rawSummaryContent;\n const hasSummaryContent =\n summaryContent != null && summaryContent !== false && summaryContent !== \"\";\n const showSummary =\n Boolean(props.summary) &&\n (summary.cards === undefined ||\n summary.cards.length > 0 ||\n hasSummaryContent);\n const cellPadding = DATA_TABLE_CELL_PADDING[props.cellPadding ?? \"normal\"];\n const squareRight = props.squareRight\n ? DATA_TABLE_SQUARE_RIGHT[`${props.squareRight}`]\n : undefined;\n // `flat` drops the outer frame and keeps the lines between the bands: the\n // toolbar keeps its bottom border, the footer its top one, and the rows\n // lose the sides. Applied after `squareRight`, which has nothing left to\n // square once the corners are gone.\n const flatTop = props.flat && \"rounded-none border-x-0 border-t-0\";\n const flatRows =\n props.flat && \"rounded-none border-x-0 border-t-0 border-b-0\";\n const flatBottom = props.flat && \"rounded-none border-x-0 border-b-0\";\n // The footer holds two controls, the size picker and the page links, and\n // the count beside them. A table that hid the picker (`pageSizes={[]}`)\n // and fits on one page has neither, and \"Page 1 of 1\" alone is a bar\n // saying nothing, so it goes. The links' condition is the footer's own.\n const showFooter =\n (props.pageSizes ?? PAGE_SIZES).length > 0 ||\n Boolean(meta?.totalPages && meta.totalPages > 1);\n const showColumnPicker = !props.hideColumnPicker && allColumnKeys.length > 0;\n const showActionsMenu = !props.hideActionsMenu;\n\n return (\n <ClientOnly>\n <div className={cn(\"flex flex-col gap-2\", props.className)}>\n {props.header && (\n <div className=\"flex items-center gap-2\">\n <div className=\"min-w-0 flex-1\">{props.header}</div>\n </div>\n )}\n\n {/*\n The summary opens the frame when it is there, so it takes the top\n corners `squareRight` squares, and whatever follows it (the filter\n bar, or the rows when there is none) joins under it the way the rows\n join the filter bar: flattened top, no top border, `-mt-2` against\n the wrapper's gap. The panel's own bottom border is the line\n between them.\n */}\n {showSummary && (\n <DataTableSummaryPanel\n title={\n props.summary?.title ??\n tr(\"dataTable.summary\", { default: \"Summary\" })\n }\n open={summary.open}\n onOpenChange={summary.setOpen}\n cards={summary.cards}\n loading={summary.loading}\n content={hasSummaryContent ? summaryContent : undefined}\n className={cn(squareRight?.top, flatTop, props.chromeClassName)}\n />\n )}\n\n {showToolbar && (\n <DataTableToolbar<T>\n columns={props.columns}\n filters={untyped.filters}\n form={form}\n filterDefinition={filterDefinition}\n shownFilters={filterVisibility.shown}\n onShownFiltersChange={filterVisibility.setShown}\n canResetFilters={canResetFilters}\n leading={props.leading}\n toolbar={props.toolbar}\n actions={props.actions}\n help={hasHelp ? props.help : undefined}\n isMobile={isMobile}\n showColumnPicker={showColumnPicker}\n showActionsMenu={showActionsMenu}\n activeFilterCount={activeFilterCount}\n canShare={canShare}\n resetFilters={resetFilters}\n shareFilters={shareFilters}\n orderedKeys={orderedKeys}\n visibleColumns={visibleColumns}\n toggleColumn={toggleColumn}\n reorderColumn={reorderColumn}\n isRefreshing={isRefreshing}\n handleRefreshClick={handleRefreshClick}\n className={cn(\n showSummary\n ? \"-mt-2 rounded-t-none border-t-0\"\n : squareRight?.top,\n flatTop,\n props.chromeClassName,\n )}\n />\n )}\n\n {hasCheckbox && selection.size > 0 && visibleBulkActions.length > 0 && (\n <DataTableBulkBar<T>\n selection={selection}\n selectedItems={selectedItems}\n visibleBulkActions={visibleBulkActions}\n bulkCtx={bulkCtx}\n clearSelection={clearSelection}\n />\n )}\n\n {/*\n The toolbar, the rows and the footer are one panel: each facing edge\n is flattened and its border dropped so no double line appears, and\n `-mt-2` cancels the wrapper's `gap-2`. The footer half follows\n `showFooter`, which is true for every table that keeps its size\n picker: gating the footer on `meta` alone would pop the bar in and\n flip this bottom border on every load, since `meta` starts null and\n only fills after the fetch. Only a table that hid the picker can\n lose it, and then the rows close the panel themselves.\n */}\n <div\n className={cn(\n \"flex min-h-0 flex-1 flex-col overflow-auto rounded-md border\",\n (showToolbar || showSummary) && \"-mt-2 rounded-t-none border-t-0\",\n showFooter ? \"rounded-b-none border-b-0\" : squareRight?.bottom,\n flatRows,\n // With no toolbar and no summary the rows open the table, so\n // their top-right corner is the one `squareRight` squares.\n !showToolbar && !showSummary && squareRight?.top,\n // `<Table>` wraps the table in a container div whose classes it\n // hardcodes, and only this table needs that container to grow,\n // so the one class it needs is set from out here instead.\n //\n // `grow`, NOT `flex-1`: `flex-1` sets the basis to 0, and in the\n // ordinary case this wrapper has no height of its own, so a 0\n // basis with nothing to grow into collapses the table to nothing.\n // `grow` keeps the content basis and only spends space that is\n // actually free, which is the full-height case.\n \"[&>[data-slot=table-container]]:grow\",\n )}\n >\n {/* `h-full` ONLY while the empty state is what is in the body.\n It is what lets that one row take the height the scroller grew\n into, so `align-middle` can centre the state in it.\n\n ⚠️ Never unconditionally. A CSS table given a height larger\n than its content does not leave the surplus at the bottom, it\n DISTRIBUTES IT ACROSS THE ROWS - so an unconditional `h-full`\n silently turns a short table into a tall one: Lore's Apps page,\n two rows in a full-height pane, rendered them 239px each. No\n unit test sees it (jsdom computes no layout) and it is invisible\n on a table long enough to fill its own container, which is why\n it reached e2e rather than review. */}\n <Table className={cn(isEmptyState && \"h-full\")}>\n {/* `bg-muted`, fully opaque, NOT the base header's `bg-muted/50`:\n this header is sticky, so anything translucent lets the rows\n scroll visibly through the column labels. Same tint, no\n transparency.\n\n Two inset lines, not one. The bottom is the divider against the\n first row; the top is the `--bevel` highlight, which is what\n gives the band its thickness. Inset shadows rather than borders\n because a border on a sticky `<thead>` is dropped by the\n collapsed table border model, and because the two lines have to\n sit INSIDE the header's own height: it is pinned at `top-0`\n against a scrolling body, so anything painted outside it is\n painted over. */}\n <TableHeader\n className={cn(\n // ⚠️ `[&_tr]:border-b-0` or the bottom rule is drawn TWICE: `TableHeader`\n // gives its rows a `border-b`, and the inset shadow above draws\n // the same line, so the band closed with 2px where it opens with\n // 1px. The inset one wins because it is what survives the sticky\n // header being painted over.\n \"bg-muted sticky top-0 z-10 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)] [&_tr]:border-b-0\",\n props.chromeClassName,\n )}\n >\n <DataTableHeaderRow<T>\n headClassName={cellPadding.head}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n allSelected={allSelected}\n someSelected={someSelected}\n toggleAll={toggleAll}\n sort={sort}\n toggleSort={toggleSort}\n setSortTo={setSortTo}\n moveColumn={moveColumn}\n toggleColumn={toggleColumn}\n />\n </TableHeader>\n <DataTableBody<T>\n cellClassName={cellPadding.cell}\n data={data}\n cellContext={cellContext}\n rowKeys={rowKeys}\n loading={loading}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n hasActiveFilters={hasActiveFilters}\n selection={selection}\n toggleRow={toggleRow}\n rowCtx={rowCtx}\n rowActions={props.rowActions}\n onRowClick={props.onRowClick}\n onRowHover={props.onRowHover}\n empty={props.empty}\n emptyMessage={props.emptyMessage}\n emptyState={props.emptyState}\n noMatchState={props.noMatchState}\n />\n </Table>\n </div>\n\n {/* A move is otherwise silent: nothing about a reordered table is\n spoken, and the visual change is the only feedback. Outside the\n table so it is not read as a cell. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {orderAnnouncement}\n </span>\n\n {showFooter && (\n <DataTableFooter\n pageSizes={props.pageSizes}\n sizeForm={sizeForm}\n meta={meta}\n isMobile={isMobile}\n setPage={setPage}\n className={cn(\n squareRight?.bottom,\n flatBottom,\n props.chromeClassName,\n )}\n />\n )}\n </div>\n </ClientOnly>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAa,aAIX,UACG;;;;;;CAMH,MAAM,UAAU;;;;;;;;;;;;;;CAehB,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,KAAA,IAAY,MAAM;CACvD,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,K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ACC,eAAe,gBAAgB,mCAChC,aAAa,8BAA8B,aAAa,QACxD,UAGA,CAAC,eAAe,CAAC,eAAe,aAAa,KAU7C,sCACF;IAcA,UAAA,qBAAC,OAAD;KAAO,WAAW,GAAG,gBAAgB,QAAQ;KAA7C,UAAA,CAcE,oBAAC,aAAD;MACE,WAAW,GAMT,qHACA,MAAM,eACR;MAEA,UAAA,oBAAC,oBAAD;OACE,eAAe,YAAY;OACd;OACA;OACE;OACF;OACC;OACH;OACL;OACM;OACD;OACC;OACE;MACf,CAAA;KACU,CAAA,GACb,oBAAC,eAAD;MACE,eAAe,YAAY;MACrB;MACO;MACJ;MACA;MACI;MACA;MACE;MACG;MACP;MACA;MACH;MACR,YAAY,MAAM;MAClB,YAAY,MAAM;MAClB,YAAY,MAAM;MAClB,OAAO,MAAM;MACb,cAAc,MAAM;MACpB,YAAY,MAAM;MAClB,cAAc,MAAM;KACrB,CAAA,CACI;;GACJ,CAAA;GAKL,oBAAC,QAAD;IAAM,aAAU;IAAS,WAAU;IAChC,UAAA;GACG,CAAA;GAEL,cACC,oBAAC,iBAAD;IACE,WAAW,MAAM;IACP;IACJ;IACI;IACD;IACT,WAAW,GACT,aAAa,QACb,YACA,MAAM,eACR;GACD,CAAA;EAEA;CACK,CAAA,EAAA,CAAA;AAEhB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { cn } from "../core/utils.js";
|
|
2
|
-
import { TableBody, TableCell, TableRow } from "../core/Table.js";
|
|
3
1
|
import { Checkbox } from "../core/Checkbox.js";
|
|
2
|
+
import { TableBody, TableCell, TableRow } from "../core/Table.js";
|
|
3
|
+
import { cn } from "../core/utils.js";
|
|
4
4
|
import { DataTableRowActionsMenu } from "./DataTableRowActionsMenu.js";
|
|
5
5
|
import { DataTableSkeletonRows } from "./DataTableSkeletonRows.js";
|
|
6
6
|
import { useI18n } from "alepha/react/i18n";
|
|
7
7
|
import { Inbox, SearchX } from "lucide-react";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
// src/table/DataTableBody.tsx
|
|
10
10
|
/**
|
|
11
11
|
* The table body: skeleton rows while the first page loads, the empty state
|
|
12
12
|
* when the page came back empty, the rows otherwise.
|
|
@@ -82,7 +82,6 @@ const DataTableBody = (props) => {
|
|
|
82
82
|
}, key);
|
|
83
83
|
}) });
|
|
84
84
|
};
|
|
85
|
-
//#endregion
|
|
86
85
|
export { DataTableBody };
|
|
87
86
|
|
|
88
87
|
//# sourceMappingURL=DataTableBody.js.map
|
|
@@ -4,7 +4,7 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
4
4
|
import { Loader2, X } from "lucide-react";
|
|
5
5
|
import { useState } from "react";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/table/DataTableBulkBar.tsx
|
|
8
8
|
/**
|
|
9
9
|
* The floating pill of bulk actions, shown while rows are selected.
|
|
10
10
|
*
|
|
@@ -78,7 +78,6 @@ const DataTableBulkBar = (props) => {
|
|
|
78
78
|
})
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
|
-
//#endregion
|
|
82
81
|
export { DataTableBulkBar };
|
|
83
82
|
|
|
84
83
|
//# sourceMappingURL=DataTableBulkBar.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
2
1
|
import { Button } from "../core/Button.js";
|
|
2
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
3
3
|
import { useI18n } from "alepha/react/i18n";
|
|
4
4
|
import { ChevronUp, Loader2 } from "lucide-react";
|
|
5
5
|
import { useCallback, useRef, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// src/table/DataTableBulkMenu.tsx
|
|
8
8
|
/**
|
|
9
9
|
* The menu form of a bulk action, rendered in the selection pill.
|
|
10
10
|
*
|
|
@@ -113,7 +113,6 @@ const DataTableBulkMenu = (props) => {
|
|
|
113
113
|
})]
|
|
114
114
|
});
|
|
115
115
|
};
|
|
116
|
-
//#endregion
|
|
117
116
|
export { DataTableBulkMenu };
|
|
118
117
|
|
|
119
118
|
//# sourceMappingURL=DataTableBulkMenu.js.map
|