@alepha/ui 0.30.0 → 0.31.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.d.ts +15 -7
- package/dist/account/$pageAccount.d.ts.map +1 -1
- package/dist/account/$pageAccount.js +15 -7
- package/dist/account/$pageAccount.js.map +1 -1
- package/dist/account/AccountBackToSiteMenuItem.d.ts +21 -0
- package/dist/account/AccountBackToSiteMenuItem.d.ts.map +1 -0
- package/dist/account/AccountBackToSiteMenuItem.js +32 -0
- package/dist/account/AccountBackToSiteMenuItem.js.map +1 -0
- package/dist/account/AccountBrand.d.ts +23 -0
- package/dist/account/AccountBrand.d.ts.map +1 -0
- package/dist/account/AccountBrand.js +47 -0
- package/dist/account/AccountBrand.js.map +1 -0
- package/dist/account/AccountConnections.d.ts +11 -6
- package/dist/account/AccountConnections.d.ts.map +1 -1
- package/dist/account/AccountConnections.js +103 -63
- package/dist/account/AccountConnections.js.map +1 -1
- package/dist/account/AccountDeleteDialog.js +4 -4
- package/dist/account/AccountDeleteDialog.js.map +1 -1
- package/dist/account/AccountKeys.d.ts +12 -8
- package/dist/account/AccountKeys.d.ts.map +1 -1
- package/dist/account/AccountKeys.js +236 -123
- package/dist/account/AccountKeys.js.map +1 -1
- package/dist/account/AccountLayout.d.ts +23 -24
- package/dist/account/AccountLayout.d.ts.map +1 -1
- package/dist/account/AccountLayout.js +79 -46
- package/dist/account/AccountLayout.js.map +1 -1
- package/dist/account/AccountMfaDialog.d.ts.map +1 -1
- package/dist/account/AccountMfaDialog.js +64 -75
- package/dist/account/AccountMfaDialog.js.map +1 -1
- package/dist/account/AccountPage.d.ts +28 -0
- package/dist/account/AccountPage.d.ts.map +1 -0
- package/dist/account/AccountPage.js +33 -0
- package/dist/account/AccountPage.js.map +1 -0
- package/dist/account/AccountPasswordDialog.js +3 -3
- package/dist/account/AccountPasswordDialog.js.map +1 -1
- package/dist/account/AccountProfile.d.ts.map +1 -1
- package/dist/account/AccountProfile.js +119 -115
- package/dist/account/AccountProfile.js.map +1 -1
- package/dist/account/AccountRecoveryCodes.d.ts +16 -0
- package/dist/account/AccountRecoveryCodes.d.ts.map +1 -0
- package/dist/account/AccountRecoveryCodes.js +46 -0
- package/dist/account/AccountRecoveryCodes.js.map +1 -0
- package/dist/account/AccountRecoveryCodesDialog.d.ts +16 -0
- package/dist/account/AccountRecoveryCodesDialog.d.ts.map +1 -0
- package/dist/account/AccountRecoveryCodesDialog.js +30 -0
- package/dist/account/AccountRecoveryCodesDialog.js.map +1 -0
- package/dist/account/AccountRouter.d.ts +61 -40
- package/dist/account/AccountRouter.d.ts.map +1 -1
- package/dist/account/AccountRouter.js +74 -48
- package/dist/account/AccountRouter.js.map +1 -1
- package/dist/account/AccountRouterOptions.d.ts +55 -26
- package/dist/account/AccountRouterOptions.d.ts.map +1 -1
- package/dist/account/AccountRouterOptions.js +1 -1
- package/dist/account/AccountRouterOptions.js.map +1 -1
- package/dist/account/AccountSecurity.d.ts.map +1 -1
- package/dist/account/AccountSecurity.js +129 -89
- package/dist/account/AccountSecurity.js.map +1 -1
- package/dist/account/AccountSessions.d.ts +16 -7
- package/dist/account/AccountSessions.d.ts.map +1 -1
- package/dist/account/AccountSessions.js +144 -98
- package/dist/account/AccountSessions.js.map +1 -1
- package/dist/account/ApiKeyCreateDialog.js +3 -3
- package/dist/account/ApiKeyCreateDialog.js.map +1 -1
- package/dist/account/ApiKeyScopeMatrix.js +1 -1
- package/dist/account/index.d.ts +4 -1
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +4 -1
- package/dist/admin/AdminAnalytics.js +2 -2
- package/dist/admin/AdminAudits.js +3 -3
- package/dist/admin/AdminDashboardCountCard.js +1 -1
- package/dist/admin/AdminFiles.d.ts.map +1 -1
- package/dist/admin/AdminFiles.js +7 -4
- package/dist/admin/AdminFiles.js.map +1 -1
- package/dist/admin/AdminFilesUsage.d.ts +4 -0
- package/dist/admin/AdminFilesUsage.d.ts.map +1 -1
- package/dist/admin/AdminFilesUsage.js +5 -2
- package/dist/admin/AdminFilesUsage.js.map +1 -1
- package/dist/admin/AdminFilesUsageCard.d.ts +12 -0
- package/dist/admin/AdminFilesUsageCard.d.ts.map +1 -1
- package/dist/admin/AdminFilesUsageCard.js +31 -3
- package/dist/admin/AdminFilesUsageCard.js.map +1 -1
- package/dist/admin/AdminJobDetail.js +3 -3
- package/dist/admin/AdminJobDetail.js.map +1 -1
- package/dist/admin/AdminJobDetailAside.js +1 -1
- package/dist/admin/AdminJobDetailExecutions.js +4 -4
- package/dist/admin/AdminJobDetailExecutions.js.map +1 -1
- package/dist/admin/AdminJobExecutionLogs.js +1 -1
- package/dist/admin/AdminJobExecutionLogs.js.map +1 -1
- package/dist/admin/AdminJobExecutionSheet.js +4 -4
- package/dist/admin/AdminJobExecutionSheet.js.map +1 -1
- package/dist/admin/AdminJobs.js +4 -4
- package/dist/admin/AdminJobs.js.map +1 -1
- package/dist/admin/AdminJobsPayloadDialog.js +1 -1
- package/dist/admin/AdminJobsTypeIcon.js +1 -1
- package/dist/admin/AdminKeys.js +6 -6
- package/dist/admin/AdminKeysTokenDialog.js +2 -2
- package/dist/admin/AdminKeysTokenDialog.js.map +1 -1
- package/dist/admin/AdminLayout.js +3 -3
- package/dist/admin/AdminNotifications.js +3 -3
- package/dist/admin/AdminNotificationsDetail.js +1 -1
- package/dist/admin/AdminNotificationsDetailTabs.js +1 -1
- package/dist/admin/AdminNotificationsPreviewTab.js +1 -1
- package/dist/admin/AdminParameters.d.ts.map +1 -1
- package/dist/admin/AdminParameters.js +2 -2
- package/dist/admin/AdminParameters.js.map +1 -1
- package/dist/admin/AdminParametersEditorForm.js +3 -3
- package/dist/admin/AdminParametersEditorForm.js.map +1 -1
- package/dist/admin/AdminParametersEditorPane.js +2 -2
- package/dist/admin/AdminParametersHistoryPane.js +2 -2
- package/dist/admin/AdminParametersTreeFooterActions.js +3 -3
- package/dist/admin/AdminParametersTreeFooterActions.js.map +1 -1
- package/dist/admin/AdminParametersTreeNodeView.js +4 -4
- package/dist/admin/AdminParametersTreeNodeView.js.map +1 -1
- package/dist/admin/AdminParametersTreePane.js +2 -2
- package/dist/admin/AdminParametersTreePane.js.map +1 -1
- package/dist/admin/AdminPayments.js +2 -2
- package/dist/admin/AdminRouter.js +1 -1
- package/dist/admin/AdminSessions.js +3 -3
- package/dist/admin/AdminUserAvatarControl.js +4 -4
- package/dist/admin/AdminUserAvatarControl.js.map +1 -1
- package/dist/admin/AdminUserDetail.d.ts.map +1 -1
- package/dist/admin/AdminUserDetail.js +5 -4
- package/dist/admin/AdminUserDetail.js.map +1 -1
- package/dist/admin/AdminUserDetailAuditsTab.js +1 -1
- package/dist/admin/AdminUserDetailIdentityAside.js +1 -1
- package/dist/admin/AdminUserDetailOverviewTab.js +1 -1
- package/dist/admin/AdminUserDetailPasswordDialog.js +2 -2
- package/dist/admin/AdminUserDetailPasswordDialog.js.map +1 -1
- package/dist/admin/AdminUserDetailSecurityTab.d.ts.map +1 -1
- package/dist/admin/AdminUserDetailSecurityTab.js +6 -4
- package/dist/admin/AdminUserDetailSecurityTab.js.map +1 -1
- package/dist/admin/AdminUserDetailSessionsTab.js +1 -1
- package/dist/admin/AdminUsers.js +4 -4
- package/dist/admin/AdminUsersRolesPicker.js +1 -1
- package/dist/admin/AdminUsersStatusBadge.js +1 -1
- package/dist/admin/ParameterDiffDialog.js +3 -3
- package/dist/admin/ParameterDiffDialog.js.map +1 -1
- package/dist/admin/ParameterHistoryItem.js +3 -3
- package/dist/admin/ParameterHistoryItem.js.map +1 -1
- package/dist/admin/ParameterJsonDialog.js +2 -2
- package/dist/admin/ParameterJsonDialog.js.map +1 -1
- package/dist/admin/ParameterSaveDialog.js +3 -3
- package/dist/admin/ParameterSaveDialog.js.map +1 -1
- package/dist/admin/analytics/AdvancedSection.js +1 -1
- package/dist/admin/analytics/AnalyticsEmpty.js +1 -1
- package/dist/admin/analytics/DatasetSelect.js +1 -1
- package/dist/admin/analytics/FilterEditor.js +4 -4
- package/dist/admin/analytics/FilterEditor.js.map +1 -1
- package/dist/admin/analytics/FilterValuePicker.js +3 -3
- package/dist/admin/analytics/FilterValuePicker.js.map +1 -1
- package/dist/admin/analytics/RequestDialog.js +2 -2
- package/dist/admin/analytics/RequestDialog.js.map +1 -1
- package/dist/admin/analytics/ResultsPane.js +2 -2
- 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 +2 -2
- package/dist/admin/analytics/ResultsTable.js.map +1 -1
- package/dist/admin/analytics/RunFooter.js +1 -1
- package/dist/admin/analytics/SamplingBadge.js +1 -1
- package/dist/admin/analytics/ToggleChip.js +1 -1
- package/dist/admin/analytics/ToggleChip.js.map +1 -1
- package/dist/admin/analytics/TruncationBanner.js +2 -2
- package/dist/admin/analytics/TruncationBanner.js.map +1 -1
- package/dist/admin/analytics/useAnalyticsQuery.js +1 -1
- package/dist/admin/analytics/useShapeLabels.js +1 -1
- package/dist/auth/AuthLogin.js +5 -5
- package/dist/auth/AuthLogin.js.map +1 -1
- package/dist/auth/AuthMfaStep.js +3 -3
- package/dist/auth/AuthMfaStep.js.map +1 -1
- package/dist/auth/AuthRegister.js +5 -5
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/auth/AuthRegisterFormPhase.js +3 -3
- package/dist/auth/AuthRegisterFormPhase.js.map +1 -1
- package/dist/auth/AuthRegisterPasswordRules.js +1 -1
- package/dist/auth/AuthResetPassword.js +5 -5
- package/dist/auth/AuthResetPassword.js.map +1 -1
- package/dist/auth/AuthRouter.d.ts +2 -2
- package/dist/auth/AuthRouter.js +2 -2
- package/dist/auth/AuthRouter.js.map +1 -1
- package/dist/auth/AuthVerifyEmailStateful.js +2 -2
- package/dist/auth/AuthVerifyEmailView.js +3 -3
- package/dist/auth/AuthVerifyEmailView.js.map +1 -1
- package/dist/auth/safeRedirect.d.ts +3 -0
- package/dist/auth/safeRedirect.d.ts.map +1 -1
- package/dist/auth/safeRedirect.js +11 -0
- package/dist/auth/safeRedirect.js.map +1 -1
- package/dist/calendar/Calendar.js +3 -3
- package/dist/calendar/Calendar.js.map +1 -1
- package/dist/core/Alert.js +2 -2
- package/dist/core/Alert.js.map +1 -1
- package/dist/core/AlertDialog.js +1 -1
- package/dist/core/AlertDialog.js.map +1 -1
- package/dist/core/Badge.js +3 -3
- package/dist/core/Badge.js.map +1 -1
- package/dist/core/Button.d.ts +45 -3
- package/dist/core/Button.d.ts.map +1 -1
- package/dist/core/Button.js +155 -11
- package/dist/core/Button.js.map +1 -1
- package/dist/core/ButtonGroup.js +1 -1
- package/dist/core/Checkbox.js +1 -1
- package/dist/core/Checkbox.js.map +1 -1
- package/dist/core/Combobox.js +4 -4
- package/dist/core/Combobox.js.map +1 -1
- package/dist/core/ContextMenu.js +1 -1
- package/dist/core/ContextMenu.js.map +1 -1
- package/dist/core/Dialog.js +2 -2
- package/dist/core/Dialog.js.map +1 -1
- package/dist/core/DropdownMenu.js +2 -2
- package/dist/core/DropdownMenu.js.map +1 -1
- package/dist/core/Empty.js +1 -1
- package/dist/core/Input.js +1 -1
- package/dist/core/Input.js.map +1 -1
- package/dist/core/InputGroup.js +3 -3
- package/dist/core/InputGroup.js.map +1 -1
- package/dist/core/Menubar.js +2 -2
- package/dist/core/Menubar.js.map +1 -1
- package/dist/core/Pagination.js +1 -1
- package/dist/core/Pagination.js.map +1 -1
- package/dist/core/Segmented.d.ts.map +1 -1
- package/dist/core/Segmented.js +1 -1
- package/dist/core/Segmented.js.map +1 -1
- package/dist/core/Sheet.js +1 -1
- package/dist/core/Sheet.js.map +1 -1
- package/dist/core/Sidebar.js +4 -4
- package/dist/core/Sidebar.js.map +1 -1
- package/dist/core/Switch.js +1 -1
- package/dist/core/Switch.js.map +1 -1
- package/dist/core/Tabs.js +1 -1
- package/dist/core/Textarea.js +1 -1
- package/dist/core/Textarea.js.map +1 -1
- package/dist/core/TimeAgo.js +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +19 -19
- package/dist/core/useDialog.d.ts.map +1 -1
- package/dist/core/useDialog.js +3 -3
- package/dist/core/useDialog.js.map +1 -1
- package/dist/form/AutoForm.d.ts +3 -1
- package/dist/form/AutoForm.d.ts.map +1 -1
- package/dist/form/AutoForm.js +3 -3
- package/dist/form/AutoForm.js.map +1 -1
- package/dist/form/AutoFormBottomBar.d.ts.map +1 -1
- package/dist/form/AutoFormBottomBar.js +5 -4
- package/dist/form/AutoFormBottomBar.js.map +1 -1
- package/dist/form/AutoFormErrorPopover.js +4 -4
- package/dist/form/AutoFormErrorPopover.js.map +1 -1
- package/dist/form/AutoFormGroupBlock.js +2 -2
- package/dist/form/AutoFormGroupGridField.js +1 -1
- package/dist/form/Control.d.ts +16 -0
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +20 -10
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlArray.d.ts.map +1 -1
- package/dist/form/ControlArray.js +15 -14
- package/dist/form/ControlArray.js.map +1 -1
- package/dist/form/ControlDate.d.ts.map +1 -1
- package/dist/form/ControlDate.js +5 -2
- package/dist/form/ControlDate.js.map +1 -1
- package/dist/form/ControlDatePopover.js +1 -1
- package/dist/form/ControlDateRange.js +2 -2
- package/dist/form/ControlObject.js +7 -7
- package/dist/form/ControlObject.js.map +1 -1
- package/dist/form/ControlPassword.js +1 -1
- package/dist/form/ControlPassword.js.map +1 -1
- package/dist/form/ControlSelect.d.ts +3 -2
- package/dist/form/ControlSelect.d.ts.map +1 -1
- package/dist/form/ControlSelect.js +2 -2
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/form/ControlSelectCombobox.js +1 -1
- package/dist/form/ControlUpload.js +3 -3
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/form/FormField.js +5 -5
- package/dist/form/FormField.js.map +1 -1
- package/dist/form/fieldTrigger.js +1 -1
- package/dist/form/grid.d.ts +11 -0
- package/dist/form/grid.d.ts.map +1 -1
- package/dist/form/grid.js +17 -6
- package/dist/form/grid.js.map +1 -1
- package/dist/form/index.js +2 -2
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +41 -30
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/markdown/MarkdownView.d.ts.map +1 -1
- package/dist/markdown/MarkdownView.js +5 -4
- package/dist/markdown/MarkdownView.js.map +1 -1
- package/dist/markdown/rehypeHighlight.d.ts +1 -1
- package/dist/markdown/rehypeHighlight.js +1 -1
- package/dist/markdown/rehypeHighlight.js.map +1 -1
- package/dist/organizations/MyOrganizationInvitations.d.ts +36 -0
- package/dist/organizations/MyOrganizationInvitations.d.ts.map +1 -1
- package/dist/organizations/MyOrganizationInvitations.js +116 -58
- package/dist/organizations/MyOrganizationInvitations.js.map +1 -1
- package/dist/organizations/MyOrganizations.js +4 -4
- package/dist/organizations/MyOrganizations.js.map +1 -1
- package/dist/organizations/OrganizationInviteDialog.js +2 -2
- package/dist/organizations/OrganizationInviteDialog.js.map +1 -1
- package/dist/organizations/OrganizationMemberIdentity.d.ts.map +1 -1
- package/dist/organizations/OrganizationMemberIdentity.js +1 -1
- package/dist/organizations/OrganizationMemberIdentity.js.map +1 -1
- package/dist/organizations/OrganizationMemberRankPicker.js +3 -3
- package/dist/organizations/OrganizationMembers.js +7 -7
- package/dist/organizations/OrganizationMembers.js.map +1 -1
- package/dist/organizations/OrganizationPendingInvitations.js +5 -5
- package/dist/organizations/OrganizationPendingInvitations.js.map +1 -1
- package/dist/organizations/OrganizationRankColumnHeader.d.ts +0 -1
- package/dist/organizations/OrganizationRankColumnHeader.d.ts.map +1 -1
- package/dist/organizations/OrganizationRankColumnHeader.js +26 -35
- package/dist/organizations/OrganizationRankColumnHeader.js.map +1 -1
- package/dist/organizations/OrganizationRanks.d.ts.map +1 -1
- package/dist/organizations/OrganizationRanks.js +7 -8
- package/dist/organizations/OrganizationRanks.js.map +1 -1
- package/dist/organizations/OrganizationTransferOwnershipDialog.js +3 -3
- package/dist/organizations/OrganizationTransferOwnershipDialog.js.map +1 -1
- package/dist/organizations/useInviteOrganizationMember.js +1 -1
- package/dist/organizations/useRevokeOrganizationInvitation.js +1 -1
- package/dist/otp/InputOTP.js +2 -2
- package/dist/otp/InputOTP.js.map +1 -1
- package/dist/settings/SettingsDangerSection.js +2 -2
- package/dist/settings/SettingsDangerSection.js.map +1 -1
- package/dist/settings/SettingsHeading.d.ts +1 -1
- package/dist/settings/SettingsHeading.js +1 -1
- package/dist/settings/SettingsHeading.js.map +1 -1
- package/dist/settings/SettingsSection.d.ts +1 -1
- package/dist/settings/SettingsSection.js +2 -2
- package/dist/settings/SettingsSection.js.map +1 -1
- package/dist/settings/index.js +2 -2
- package/dist/shell/AppActions.d.ts +2 -2
- package/dist/shell/AppActions.js +6 -6
- package/dist/shell/AppActions.js.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.js +8 -2
- package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.js +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.js.map +1 -1
- package/dist/shell/ButtonDark.d.ts +2 -2
- package/dist/shell/ButtonDark.d.ts.map +1 -1
- package/dist/shell/ButtonDark.js +1 -1
- package/dist/shell/ButtonDark.js.map +1 -1
- package/dist/shell/ButtonInbox.d.ts +1 -1
- package/dist/shell/ButtonInbox.d.ts.map +1 -1
- package/dist/shell/ButtonInbox.js +7 -7
- package/dist/shell/ButtonInbox.js.map +1 -1
- package/dist/shell/ButtonLanguage.d.ts +2 -2
- package/dist/shell/ButtonLanguage.d.ts.map +1 -1
- package/dist/shell/ButtonLanguage.js +3 -3
- package/dist/shell/ButtonLanguage.js.map +1 -1
- package/dist/shell/ButtonSettings.d.ts +2 -2
- package/dist/shell/ButtonSettings.d.ts.map +1 -1
- package/dist/shell/ButtonSettings.js +2 -2
- package/dist/shell/ButtonSettings.js.map +1 -1
- package/dist/shell/ButtonSettingsLanguageMenu.js +1 -1
- package/dist/shell/ButtonSettingsThemeMenu.js +1 -1
- package/dist/shell/ButtonTheme.d.ts +2 -2
- package/dist/shell/ButtonTheme.d.ts.map +1 -1
- package/dist/shell/ButtonTheme.js +3 -3
- package/dist/shell/ButtonTheme.js.map +1 -1
- package/dist/shell/ButtonUser.d.ts +2 -2
- package/dist/shell/ButtonUser.d.ts.map +1 -1
- package/dist/shell/ButtonUser.js +4 -4
- package/dist/shell/ButtonUser.js.map +1 -1
- package/dist/shell/DetailAside.js +3 -3
- package/dist/shell/DetailAside.js.map +1 -1
- package/dist/shell/DetailLayout.js +2 -2
- package/dist/shell/DetailLayout.js.map +1 -1
- package/dist/shell/NavShell.js +1 -1
- package/dist/shell/NavigationProgress.js +1 -1
- 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/Spotlight.js +1 -1
- package/dist/shell/index.js +3 -3
- package/dist/shell/useNavBreadcrumbs.js +1 -1
- package/dist/shell/useNavEntries.js +1 -1
- package/dist/styles.css +89 -12
- package/dist/table/DataTable.js +3 -3
- package/dist/table/DataTableBody.js +1 -1
- package/dist/table/DataTableBulkBar.d.ts.map +1 -1
- package/dist/table/DataTableBulkBar.js +6 -3
- package/dist/table/DataTableBulkBar.js.map +1 -1
- package/dist/table/DataTableBulkMenu.d.ts.map +1 -1
- package/dist/table/DataTableBulkMenu.js +4 -3
- package/dist/table/DataTableBulkMenu.js.map +1 -1
- package/dist/table/DataTableColumnPicker.js +3 -3
- package/dist/table/DataTableColumnPicker.js.map +1 -1
- package/dist/table/DataTableFilterAdd.d.ts +7 -0
- package/dist/table/DataTableFilterAdd.d.ts.map +1 -1
- package/dist/table/DataTableFilterAdd.js +15 -6
- package/dist/table/DataTableFilterAdd.js.map +1 -1
- package/dist/table/DataTableFilterBar.d.ts.map +1 -1
- package/dist/table/DataTableFilterBar.js +12 -3
- package/dist/table/DataTableFilterBar.js.map +1 -1
- package/dist/table/DataTableFilterControl.d.ts +1 -1
- package/dist/table/DataTableFilterControl.js +2 -2
- package/dist/table/DataTableFilterControl.js.map +1 -1
- package/dist/table/DataTableFilterDialog.js +5 -5
- package/dist/table/DataTableFilterDialog.js.map +1 -1
- package/dist/table/DataTableFilterMenu.js +3 -3
- package/dist/table/DataTableFilterMenu.js.map +1 -1
- package/dist/table/DataTableFooter.d.ts.map +1 -1
- package/dist/table/DataTableFooter.js +1 -1
- package/dist/table/DataTableFooter.js.map +1 -1
- package/dist/table/DataTableHeaderRow.js +1 -1
- package/dist/table/DataTableHelpButton.js +2 -2
- package/dist/table/DataTableHelpButton.js.map +1 -1
- package/dist/table/DataTableRowActionsMenu.js +3 -3
- package/dist/table/DataTableRowActionsMenu.js.map +1 -1
- package/dist/table/DataTableToolbar.d.ts.map +1 -1
- package/dist/table/DataTableToolbar.js +4 -4
- package/dist/table/DataTableToolbar.js.map +1 -1
- package/dist/table/PermissionMatrixRowLabel.d.ts +1 -1
- package/dist/table/PermissionMatrixRowLabel.js +1 -1
- package/dist/table/PermissionMatrixRowLabel.js.map +1 -1
- package/dist/table/dataTableTypes.d.ts +12 -1
- package/dist/table/dataTableTypes.d.ts.map +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table/useDataTableData.d.ts.map +1 -1
- package/dist/table/useDataTableData.js +13 -2
- package/dist/table/useDataTableData.js.map +1 -1
- package/dist/tree/TreeViewRenameInput.js +1 -1
- package/dist/tree/TreeViewResizer.js +1 -1
- package/package.json +17 -14
- package/src/account/$pageAccount.tsx +15 -7
- package/src/account/AccountBackToSiteMenuItem.tsx +46 -0
- package/src/account/AccountBrand.tsx +51 -0
- package/src/account/AccountConnections.tsx +154 -126
- package/src/account/AccountDeleteDialog.tsx +2 -2
- package/src/account/AccountKeys.tsx +277 -162
- package/src/account/AccountLayout.tsx +75 -84
- package/src/account/AccountMfaDialog.tsx +19 -38
- package/src/account/AccountPage.tsx +63 -0
- package/src/account/AccountPasswordDialog.tsx +1 -1
- package/src/account/AccountProfile.tsx +6 -4
- package/src/account/AccountRecoveryCodes.tsx +69 -0
- package/src/account/AccountRecoveryCodesDialog.tsx +47 -0
- package/src/account/AccountRouter.tsx +82 -50
- package/src/account/AccountRouterOptions.tsx +59 -27
- package/src/account/AccountSecurity.tsx +84 -12
- package/src/account/AccountSessions.tsx +214 -159
- package/src/account/ApiKeyCreateDialog.tsx +1 -1
- package/src/account/__tests__/AccountConnections.browser.spec.tsx +130 -0
- package/src/account/__tests__/AccountKeys.browser.spec.tsx +156 -0
- package/src/account/__tests__/AccountLayout.browser.spec.tsx +120 -30
- package/src/account/__tests__/AccountRecoveryCodes.browser.spec.tsx +118 -0
- package/src/account/__tests__/AccountRouter.spec.ts +34 -0
- package/src/account/__tests__/AccountSessions.browser.spec.tsx +199 -0
- package/src/account/index.ts +7 -1
- package/src/admin/AdminFiles.tsx +4 -1
- package/src/admin/AdminFilesUsage.tsx +10 -1
- package/src/admin/AdminFilesUsageCard.tsx +69 -2
- package/src/admin/AdminJobDetail.tsx +1 -1
- package/src/admin/AdminJobDetailExecutions.tsx +1 -1
- package/src/admin/AdminJobExecutionLogs.tsx +1 -1
- package/src/admin/AdminJobExecutionSheet.tsx +1 -1
- package/src/admin/AdminJobs.tsx +1 -1
- package/src/admin/AdminKeysTokenDialog.tsx +1 -1
- package/src/admin/AdminParameters.tsx +13 -14
- package/src/admin/AdminParametersEditorForm.tsx +2 -2
- package/src/admin/AdminParametersTreeFooterActions.tsx +2 -2
- package/src/admin/AdminParametersTreeNodeView.tsx +2 -2
- package/src/admin/AdminParametersTreePane.tsx +1 -1
- package/src/admin/AdminUserAvatarControl.tsx +2 -2
- package/src/admin/AdminUserDetail.tsx +3 -2
- package/src/admin/AdminUserDetailPasswordDialog.tsx +1 -1
- package/src/admin/AdminUserDetailSecurityTab.tsx +5 -3
- package/src/admin/ParameterDiffDialog.tsx +2 -2
- package/src/admin/ParameterHistoryItem.tsx +1 -1
- package/src/admin/ParameterJsonDialog.tsx +1 -1
- package/src/admin/ParameterSaveDialog.tsx +1 -1
- package/src/admin/__tests__/AdminFilesUsageCard.browser.spec.tsx +52 -2
- package/src/admin/analytics/FilterEditor.tsx +3 -3
- package/src/admin/analytics/FilterValuePicker.tsx +2 -2
- package/src/admin/analytics/RequestDialog.tsx +1 -1
- package/src/admin/analytics/ResultsPane.tsx +1 -1
- package/src/admin/analytics/ResultsTable.tsx +6 -1
- package/src/admin/analytics/ToggleChip.tsx +1 -1
- package/src/admin/analytics/TruncationBanner.tsx +1 -1
- package/src/auth/AuthLogin.tsx +2 -2
- package/src/auth/AuthMfaStep.tsx +2 -2
- package/src/auth/AuthRegister.tsx +2 -2
- package/src/auth/AuthRegisterFormPhase.tsx +1 -1
- package/src/auth/AuthResetPassword.tsx +2 -2
- package/src/auth/AuthRouter.tsx +2 -2
- package/src/auth/AuthVerifyEmailView.tsx +1 -1
- package/src/auth/__tests__/AuthRouter.spec.ts +2 -1
- package/src/auth/__tests__/safeRedirect.spec.ts +38 -0
- package/src/auth/safeRedirect.ts +13 -0
- package/src/calendar/Calendar.tsx +2 -2
- package/src/core/Alert.tsx +1 -1
- package/src/core/AlertDialog.tsx +1 -1
- package/src/core/Badge.tsx +2 -2
- package/src/core/Button.tsx +232 -18
- package/src/core/Checkbox.tsx +1 -1
- package/src/core/Combobox.tsx +4 -4
- package/src/core/ContextMenu.tsx +1 -1
- package/src/core/Dialog.tsx +2 -2
- package/src/core/DropdownMenu.tsx +1 -1
- package/src/core/Input.tsx +1 -1
- package/src/core/InputGroup.tsx +2 -2
- package/src/core/Menubar.tsx +1 -1
- package/src/core/Pagination.tsx +1 -1
- package/src/core/Segmented.tsx +6 -4
- package/src/core/Sheet.tsx +1 -1
- package/src/core/Sidebar.tsx +1 -1
- package/src/core/Switch.tsx +1 -1
- package/src/core/Textarea.tsx +1 -1
- package/src/core/index.ts +7 -1
- package/src/core/useDialog.tsx +3 -5
- package/src/form/AutoForm.tsx +3 -1
- package/src/form/AutoFormBottomBar.tsx +4 -3
- package/src/form/AutoFormErrorPopover.tsx +3 -3
- package/src/form/Control.tsx +53 -9
- package/src/form/ControlArray.tsx +13 -12
- package/src/form/ControlDate.tsx +4 -1
- package/src/form/ControlObject.tsx +6 -6
- package/src/form/ControlPassword.tsx +1 -1
- package/src/form/ControlSelect.tsx +3 -2
- package/src/form/ControlUpload.tsx +1 -1
- package/src/form/FormField.tsx +5 -5
- package/src/form/grid.tsx +17 -6
- package/src/i18n/fr/uiFr.ts +46 -33
- package/src/markdown/MarkdownView.tsx +5 -4
- package/src/markdown/rehypeHighlight.ts +1 -1
- package/src/organizations/MyOrganizationInvitations.tsx +177 -71
- package/src/organizations/MyOrganizations.tsx +1 -1
- package/src/organizations/OrganizationInviteDialog.tsx +1 -1
- package/src/organizations/OrganizationMemberIdentity.tsx +4 -1
- package/src/organizations/OrganizationMembers.tsx +3 -3
- package/src/organizations/OrganizationPendingInvitations.tsx +1 -1
- package/src/organizations/OrganizationRankColumnHeader.tsx +1 -8
- package/src/organizations/OrganizationRanks.tsx +2 -3
- package/src/organizations/OrganizationTransferOwnershipDialog.tsx +2 -2
- package/src/organizations/__tests__/MyOrganizationInvitations.browser.spec.tsx +61 -7
- package/src/organizations/__tests__/OrganizationRanks.browser.spec.tsx +34 -0
- package/src/otp/InputOTP.tsx +2 -2
- package/src/settings/SettingsDangerSection.tsx +2 -2
- package/src/settings/SettingsHeading.tsx +1 -1
- package/src/settings/SettingsSection.tsx +1 -1
- package/src/settings/__tests__/SettingsSection.browser.spec.tsx +3 -3
- package/src/shell/AppActions.tsx +6 -6
- package/src/shell/AppShellSidebarNavItem.tsx +17 -2
- package/src/shell/AppShellStatefulSidebarTrigger.tsx +1 -1
- package/src/shell/ButtonDark.tsx +3 -3
- package/src/shell/ButtonInbox.tsx +15 -5
- package/src/shell/ButtonLanguage.tsx +3 -3
- package/src/shell/ButtonSettings.tsx +3 -3
- package/src/shell/ButtonTheme.tsx +3 -3
- package/src/shell/ButtonUser.tsx +4 -4
- package/src/shell/DetailAside.tsx +1 -1
- package/src/shell/DetailLayout.tsx +1 -1
- package/src/shell/PlateTabBar.tsx +4 -2
- package/src/shell/__tests__/ActionErrorToaster.browser.spec.tsx +2 -2
- package/src/shell/__tests__/AppActions.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ButtonInbox.browser.spec.tsx +12 -0
- package/src/shell/__tests__/NavigationProgress.browser.spec.tsx +2 -2
- package/src/styles.css +89 -12
- package/src/table/DataTableBulkBar.tsx +10 -3
- package/src/table/DataTableBulkMenu.tsx +2 -1
- package/src/table/DataTableColumnPicker.tsx +1 -1
- package/src/table/DataTableFilterAdd.tsx +55 -25
- package/src/table/DataTableFilterBar.tsx +16 -3
- package/src/table/DataTableFilterControl.tsx +1 -1
- package/src/table/DataTableFilterDialog.tsx +3 -3
- package/src/table/DataTableFilterMenu.tsx +1 -1
- package/src/table/DataTableFooter.tsx +31 -32
- package/src/table/DataTableHelpButton.tsx +1 -1
- package/src/table/DataTableRowActionsMenu.tsx +1 -1
- package/src/table/DataTableToolbar.tsx +11 -3
- package/src/table/PermissionMatrixRowLabel.tsx +1 -1
- package/src/table/__tests__/DataTableBulkBarChrome.browser.spec.tsx +87 -0
- package/src/table/__tests__/DataTableFilterDefaultBar.browser.spec.tsx +24 -0
- package/src/table/__tests__/DataTableNewestRequest.browser.spec.tsx +91 -0
- package/src/table/dataTableTypes.ts +14 -1
- package/src/table/useDataTableData.ts +24 -1
- package/dist/account/AccountHeader.d.ts +0 -33
- package/dist/account/AccountHeader.d.ts.map +0 -1
- package/dist/account/AccountHeader.js +0 -45
- package/dist/account/AccountHeader.js.map +0 -1
- package/dist/account/AccountKeysRow.d.ts +0 -22
- package/dist/account/AccountKeysRow.d.ts.map +0 -1
- package/dist/account/AccountKeysRow.js +0 -68
- package/dist/account/AccountKeysRow.js.map +0 -1
- package/src/account/AccountHeader.tsx +0 -66
- package/src/account/AccountKeysRow.tsx +0 -100
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableToolbar.js","names":[],"sources":["../../src/table/DataTableToolbar.tsx"],"sourcesContent":["import type { ZObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { RefreshCw } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"../core/Tooltip.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { DataTableColumnPicker } from \"./DataTableColumnPicker.tsx\";\nimport { DataTableFilterBar } from \"./DataTableFilterBar.tsx\";\nimport { DataTableFilterDialog } from \"./DataTableFilterDialog.tsx\";\nimport { dataTableFilterBarFields } from \"./dataTableFilterFields.ts\";\nimport { DataTableFilterMenu } from \"./DataTableFilterMenu.tsx\";\nimport { DataTableHelpButton } from \"./DataTableHelpButton.tsx\";\nimport type {\n DataTableFilterFields,\n DataTableFilters,\n ColumnDef,\n TableAction,\n} from \"./dataTableTypes.ts\";\nimport type { DataTableFilterDefinition } from \"./useDataTableFilterForm.ts\";\n\nexport interface DataTableToolbarProps<T> {\n columns: Record<string, ColumnDef<T>>;\n filters?: DataTableFilters<DataTableFilterFields>;\n /**\n * The table's own filter form.\n */\n form?: FormModel<ZObject>;\n /**\n * What the filters are, as read at mount. The bar is drawn from it and from\n * `filters.fields`, read every render.\n */\n filterDefinition?: DataTableFilterDefinition;\n /**\n * Which filters are on the bar. The table's state; see\n * `useDataTableFilterVisibility`.\n */\n shownFilters: readonly string[];\n onShownFiltersChange: (shown: string[], act: boolean) => void;\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * differs from its declaration.\n */\n canResetFilters: boolean;\n toolbar?: ReactNode;\n actions?: TableAction[];\n /**\n * The table's `help`, behind the `?` that closes the icon group. The\n * table passes `undefined` for a node that draws nothing.\n */\n help?: ReactNode;\n isMobile: boolean;\n showColumnPicker: boolean;\n showActionsMenu: boolean;\n activeFilterCount: number;\n /**\n * Whether the table reads its filters back from the query, which is what\n * makes a shared link worth copying.\n */\n canShare: boolean;\n resetFilters: () => void;\n shareFilters: () => Promise<void>;\n /**\n * Every column key, in the reader's order.\n */\n orderedKeys: string[];\n visibleColumns: Set<string>;\n toggleColumn: (id: string) => void;\n reorderColumn: (key: string, target: string) => void;\n isRefreshing: boolean;\n handleRefreshClick: () => void;\n /**\n * The table's `chromeClassName`, merged after the bar's own classes.\n */\n className?: string;\n}\n\n/**\n * The bar above the rows: the filter form (or its dialog on a phone), the\n * caller's `toolbar` slot and `actions`, then the column picker, the filter\n * menu, refresh and help.\n */\nexport const DataTableToolbar = <T,>(props: DataTableToolbarProps<T>) => {\n const {\n form,\n isMobile,\n showColumnPicker,\n showActionsMenu,\n activeFilterCount,\n canShare,\n resetFilters,\n shareFilters,\n orderedKeys,\n visibleColumns,\n toggleColumn,\n reorderColumn,\n isRefreshing,\n handleRefreshClick,\n } = props;\n const { tr } = useI18n();\n const hasHelp = props.help !== undefined;\n\n /**\n * The filter controls, in either place. With `render`, the caller draws\n * them and the bar is not mounted; without it, the table draws the bar from\n * `fields`.\n */\n const filterControls = (variant: \"bar\" | \"dialog\") => {\n if (!props.filters || !form) return null;\n if (props.filters.render) return props.filters.render(form);\n if (!props.filterDefinition) return null;\n return (\n <DataTableFilterBar\n form={form}\n fields={dataTableFilterBarFields(\n props.filters.fields,\n props.filterDefinition,\n )}\n shown={props.shownFilters}\n onShownChange={props.onShownFiltersChange}\n variant={variant}\n />\n );\n };\n\n return (\n // `bg-muted`, paired with the pagination footer below: the filter bar\n // and the footer are the table's chrome and bracket it top and\n // bottom, so they sit one step off the page while the table itself\n // (header included) stays on it. They were `bg-card` — pure white in\n // light, the same colour as the page, so neither had an edge.\n //\n // The controls need an explicit fill because of that. shadcn ships\n // inputs and select triggers `bg-transparent` in light and only fills\n // them in dark (`dark:bg-input/30`) — the light case assumes a white\n // page, where transparent already reads as a white field. On this bar\n // it does not: they would take the muted grey and the border alone\n // would have to say \"input\". Scoped here rather than to the\n // primitives, whose transparent light fill is right everywhere\n // else.\n //\n // `bg-background` suits both modes: white against the muted bar in\n // light, near-black in dark, so the control reads as a well sunk\n // into the chrome either way. The `dark:` copy is not redundant —\n // the primitives ship `dark:bg-input/30` at (0,2,0), a translucent\n // WHITE wash that leaves the field lighter than the bar. Only the\n // dark-scoped rule (0,3,0) outranks it, and without it the two\n // controls disagreed: the trigger went dark, the input stayed light.\n //\n // ⚠️ **`date-trigger` is named, and it is not a third spelling of\n // the same thing.** `:is(input,[role=combobox])` describes the two\n // shapes a field happened to have when this was written, and a\n // calendar is neither: `ControlDate` and `ControlDateRange` open a\n // POPOVER, so their trigger is a plain button with no combobox role\n // to match on. It therefore kept the primitives' own\n // `dark:bg-input/30` and sat LIGHTER than the bar while every select\n // beside it sat darker - measured on Admin > Audit log, `oklab(1 0 0\n // / 0.045)` against the selects' opaque `oklch(0.145 0 0)`. Light\n // mode had it the other way round, the calendar taking the muted\n // grey. That is what #Q2295 reported, and what #Q2282 and #Q2283\n // could not reach: they made the date controls draw the kit's\n // trigger, and this bar was still addressing fields by tag and role\n // rather than by what they are.\n //\n // The canonical list of field surfaces is the hover-border rule in\n // `styles.css`, which enumerates the same slots. Add a field shape\n // there and it belongs here too.\n //\n // The `--bevel` line, laid just inside the bar's own top border,\n // the same fold the header and the footer carry. This one is the\n // top edge of the whole table block, so it is the one that decides\n // whether the block sits ON the page or IN it.\n <div\n className={cn(\n \"bg-muted [&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background dark:[&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background flex flex-wrap items-end gap-2 rounded-md rounded-b-none border p-2 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.className,\n )}\n >\n {props.filters && form && !isMobile ? (\n <form {...form.props} className=\"flex flex-1 flex-wrap items-end gap-2\">\n {filterControls(\"bar\")}\n </form>\n ) : (\n <div className=\"flex flex-1\" />\n )}\n {/*\n `self-center`, against the bar's own `items-end`.\n\n The bar bottom-aligns because a filter Control may carry a label,\n and a row of labelled controls has to line up on the inputs rather\n than on the top of the tallest label. Everything to the right of\n the filters is a bare control with no label of its own, so\n inheriting that baseline pinned it to the bottom of whatever the\n filter area happened to measure — a \"New\" button sitting low\n against a labelled select, moving as soon as a filter gained or\n lost its label.\n\n Centring only the trailing content keeps the filter row's own\n alignment intact and makes the actions independent of it.\n */}\n {props.toolbar && <div className=\"self-center\">{props.toolbar}</div>}\n <TooltipProvider>\n <div className=\"flex items-center gap-1 self-center\">\n {props.actions?.length ? (\n <>\n {props.actions.map((action) => {\n const ActionIcon = action.icon;\n if (action.primary) {\n // The visible label is the tooltip, so there is\n // none. `aria-label` keeps the accessible name once\n // the label collapses below `sm`; `h-9` lines the\n // button up with the ghost icons beside it.\n return (\n <Button\n key={action.label}\n type=\"button\"\n size=\"sm\"\n className=\"h-9 px-3\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n <ActionIcon className=\"size-4\" />\n <span className=\"hidden sm:inline\">{action.label}</span>\n </Button>\n );\n }\n return (\n <Tooltip key={action.label}>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n />\n }\n >\n <ActionIcon className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{action.label}</TooltipContent>\n </Tooltip>\n );\n })}\n {(showColumnPicker || showActionsMenu || hasHelp) && (\n <span\n aria-hidden\n className=\"bg-border mx-1 h-5 w-px self-center\"\n />\n )}\n </>\n ) : null}\n {isMobile && props.filters && form && (\n <DataTableFilterDialog\n form={form}\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onReset={resetFilters}\n onShare={canShare ? shareFilters : undefined}\n >\n {filterControls(\"dialog\")}\n </DataTableFilterDialog>\n )}\n {showColumnPicker && (\n <DataTableColumnPicker<T>\n columns={props.columns}\n order={orderedKeys}\n visible={visibleColumns}\n onToggle={toggleColumn}\n onReorder={reorderColumn}\n />\n )}\n {/*\n Desktop only. On a phone the same actions live in the filter\n dialog, beside the controls they act on, and a second copy out\n here would spend a slot of the very row that dialog exists to\n shorten.\n\n A table that cannot be linked gets the menu too, holding Reset\n alone: the bare icon button this replaced spends most of its\n life disabled, and a greyed icon carries no words saying what it\n would have done. See `DataTableFilterMenu`.\n */}\n {showActionsMenu && props.filters && !isMobile && (\n <DataTableFilterMenu\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onShare={canShare ? shareFilters : undefined}\n onReset={resetFilters}\n />\n )}\n {showActionsMenu && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"dataTable.refresh\", {\n default: \"Refresh\",\n })}\n disabled={isRefreshing}\n onClick={handleRefreshClick}\n />\n }\n >\n <RefreshCw\n className={cn(\"size-4\", isRefreshing && \"animate-spin\")}\n />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"dataTable.refresh\", { default: \"Refresh\" })}\n </TooltipContent>\n </Tooltip>\n )}\n {/*\n Last, after refresh: the explanation of the page is read once and\n then left alone, so it takes the end of the row rather than a slot\n between the controls a reader keeps reaching for.\n */}\n {hasHelp && <DataTableHelpButton>{props.help}</DataTableHelpButton>}\n </div>\n </TooltipProvider>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyFA,MAAa,oBAAwB,UAAoC;CACvE,MAAM,EACJ,MACA,UACA,kBACA,iBACA,mBACA,UACA,cACA,cACA,aACA,gBACA,cACA,eACA,cACA,uBACE;CACJ,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,UAAU,MAAM,SAAS,KAAA;;;;;;CAO/B,MAAM,kBAAkB,YAA8B;EACpD,IAAI,CAAC,MAA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AAD,EAAY,WAAU,SAAU,CAAA;MAClB,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,OAAO,MAAsB,CAAA,CACvC,EAAA,GAjBK,OAAO,KAiBZ;KAEb,CAAC,IACC,oBAAoB,mBAAmB,YACvC,oBAAC,QAAD;MACE,eAAA;MACA,WAAU;KACX,CAAA,CAEH,EAAA,CAAA,IACA;KACH,YAAY,MAAM,WAAW,QAC5B,oBAAC,uBAAD;MACQ;MACN,aAAa;MACb,UAAU,MAAM;MAChB,SAAS;MACT,SAAS,WAAW,eAAe,KAAA;MAElC,UAAA,eAAe,QAAQ;KACH,CAAA;KAExB,oBACC,oBAAC,uBAAD;MACE,SAAS,MAAM;MACf,OAAO;MACP,SAAS;MACT,UAAU;MACV,WAAW;KACZ,CAAA;KAaF,mBAAmB,MAAM,WAAW,CAAC,YACpC,oBAAC,qBAAD;MACE,aAAa;MACb,UAAU,MAAM;MAChB,SAAS,WAAW,eAAe,KAAA;MACnC,SAAS;KACV,CAAA;KAEF,mBACC,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;MACE,QACE,oBAAC,QAAD;OACE,MAAK;OACL,MAAK;OACL,SAAQ;OACR,WAAU;OACV,cAAY,GAAG,qBAAqB,EAClC,SAAS,UACX,CAAC;OACD,UAAU;OACV,SAAS;MACV,CAAA;MAGH,UAAA,oBAAC,WAAD,EACE,WAAW,GAAG,UAAU,gBAAgB,cAAc,EACvD,CAAA;KACa,CAAA,GAChB,oBAAC,gBAAD,EAAA,UACG,GAAG,qBAAqB,EAAE,SAAS,UAAU,CAAC,EACjC,CAAA,CACT,EAAA,CAAA;KAOV,WAAW,oBAAC,qBAAD,EAAA,UAAsB,MAAM,KAA0B,CAAA;IAC/D;GACU,CAAA,EAAA,CAAA;EACd;;AAET"}
|
|
1
|
+
{"version":3,"file":"DataTableToolbar.js","names":[],"sources":["../../src/table/DataTableToolbar.tsx"],"sourcesContent":["import type { ZObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { RefreshCw } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"../core/Tooltip.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { DataTableColumnPicker } from \"./DataTableColumnPicker.tsx\";\nimport { DataTableFilterBar } from \"./DataTableFilterBar.tsx\";\nimport { DataTableFilterDialog } from \"./DataTableFilterDialog.tsx\";\nimport { dataTableFilterBarFields } from \"./dataTableFilterFields.ts\";\nimport { DataTableFilterMenu } from \"./DataTableFilterMenu.tsx\";\nimport { DataTableHelpButton } from \"./DataTableHelpButton.tsx\";\nimport type {\n DataTableFilterFields,\n DataTableFilters,\n ColumnDef,\n TableAction,\n} from \"./dataTableTypes.ts\";\nimport type { DataTableFilterDefinition } from \"./useDataTableFilterForm.ts\";\n\nexport interface DataTableToolbarProps<T> {\n columns: Record<string, ColumnDef<T>>;\n filters?: DataTableFilters<DataTableFilterFields>;\n /**\n * The table's own filter form.\n */\n form?: FormModel<ZObject>;\n /**\n * What the filters are, as read at mount. The bar is drawn from it and from\n * `filters.fields`, read every render.\n */\n filterDefinition?: DataTableFilterDefinition;\n /**\n * Which filters are on the bar. The table's state; see\n * `useDataTableFilterVisibility`.\n */\n shownFilters: readonly string[];\n onShownFiltersChange: (shown: string[], act: boolean) => void;\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * differs from its declaration.\n */\n canResetFilters: boolean;\n toolbar?: ReactNode;\n actions?: TableAction[];\n /**\n * The table's `help`, behind the `?` that closes the icon group. The\n * table passes `undefined` for a node that draws nothing.\n */\n help?: ReactNode;\n isMobile: boolean;\n showColumnPicker: boolean;\n showActionsMenu: boolean;\n activeFilterCount: number;\n /**\n * Whether the table reads its filters back from the query, which is what\n * makes a shared link worth copying.\n */\n canShare: boolean;\n resetFilters: () => void;\n shareFilters: () => Promise<void>;\n /**\n * Every column key, in the reader's order.\n */\n orderedKeys: string[];\n visibleColumns: Set<string>;\n toggleColumn: (id: string) => void;\n reorderColumn: (key: string, target: string) => void;\n isRefreshing: boolean;\n handleRefreshClick: () => void;\n /**\n * The table's `chromeClassName`, merged after the bar's own classes.\n */\n className?: string;\n}\n\n/**\n * The bar above the rows: the filter form (or its dialog on a phone), the\n * caller's `toolbar` slot and `actions`, then the column picker, the filter\n * menu, refresh and help.\n */\nexport const DataTableToolbar = <T,>(props: DataTableToolbarProps<T>) => {\n const {\n form,\n isMobile,\n showColumnPicker,\n showActionsMenu,\n activeFilterCount,\n canShare,\n resetFilters,\n shareFilters,\n orderedKeys,\n visibleColumns,\n toggleColumn,\n reorderColumn,\n isRefreshing,\n handleRefreshClick,\n } = props;\n const { tr } = useI18n();\n const hasHelp = props.help !== undefined;\n\n /**\n * The filter controls, in either place. With `render`, the caller draws\n * them and the bar is not mounted; without it, the table draws the bar from\n * `fields`.\n */\n const filterControls = (variant: \"bar\" | \"dialog\") => {\n if (!props.filters || !form) return null;\n if (props.filters.render) return props.filters.render(form);\n if (!props.filterDefinition) return null;\n return (\n <DataTableFilterBar\n form={form}\n fields={dataTableFilterBarFields(\n props.filters.fields,\n props.filterDefinition,\n )}\n shown={props.shownFilters}\n onShownChange={props.onShownFiltersChange}\n variant={variant}\n />\n );\n };\n\n return (\n // `bg-muted`, paired with the pagination footer below: the filter bar\n // and the footer are the table's chrome and bracket it top and\n // bottom, so they sit one step off the page while the table itself\n // (header included) stays on it. They were `bg-card` — pure white in\n // light, the same colour as the page, so neither had an edge.\n //\n // The controls need an explicit fill because of that. shadcn ships\n // inputs and select triggers `bg-transparent` in light and only fills\n // them in dark (`dark:bg-input/30`) — the light case assumes a white\n // page, where transparent already reads as a white field. On this bar\n // it does not: they would take the muted grey and the border alone\n // would have to say \"input\". Scoped here rather than to the\n // primitives, whose transparent light fill is right everywhere\n // else.\n //\n // `bg-background` suits both modes: white against the muted bar in\n // light, near-black in dark, so the control reads as a well sunk\n // into the chrome either way. The `dark:` copy is not redundant —\n // the primitives ship `dark:bg-input/30` at (0,2,0), a translucent\n // WHITE wash that leaves the field lighter than the bar. Only the\n // dark-scoped rule (0,3,0) outranks it, and without it the two\n // controls disagreed: the trigger went dark, the input stayed light.\n //\n // ⚠️ **`date-trigger` is named, and it is not a third spelling of\n // the same thing.** `:is(input,[role=combobox])` describes the two\n // shapes a field happened to have when this was written, and a\n // calendar is neither: `ControlDate` and `ControlDateRange` open a\n // POPOVER, so their trigger is a plain button with no combobox role\n // to match on. It therefore kept the primitives' own\n // `dark:bg-input/30` and sat LIGHTER than the bar while every select\n // beside it sat darker - measured on Admin > Audit log, `oklab(1 0 0\n // / 0.045)` against the selects' opaque `oklch(0.145 0 0)`. Light\n // mode had it the other way round, the calendar taking the muted\n // grey. That is what #Q2295 reported, and what #Q2282 and #Q2283\n // could not reach: they made the date controls draw the kit's\n // trigger, and this bar was still addressing fields by tag and role\n // rather than by what they are.\n //\n // The canonical list of field surfaces is the hover-border rule in\n // `styles.css`, which enumerates the same slots. Add a field shape\n // there and it belongs here too.\n //\n // The `--bevel` line, laid just inside the bar's own top border,\n // the same fold the header and the footer carry. This one is the\n // top edge of the whole table block, so it is the one that decides\n // whether the block sits ON the page or IN it.\n <div\n className={cn(\n \"bg-muted [&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background dark:[&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background flex flex-wrap items-end gap-2 rounded-md rounded-b-none border p-2 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.className,\n )}\n >\n {props.filters && form && !isMobile ? (\n // `self-stretch`: the form spans the bar's full row, so the \"+\" (whose\n // own `self-center` targets this form) sits on the row's midline. It\n // used to shrink to its content and, under the bar's `items-end`, sat\n // at the bottom: with no filter shown the form was just the 28px \"+\"\n // against 36px actions, 4px under the midline.\n <form\n {...form.props}\n className=\"flex flex-1 flex-wrap items-end gap-2 self-stretch\"\n >\n {filterControls(\"bar\")}\n </form>\n ) : (\n <div className=\"flex flex-1\" />\n )}\n {/*\n `self-center`, against the bar's own `items-end`.\n\n The bar bottom-aligns because a filter Control may carry a label,\n and a row of labelled controls has to line up on the inputs rather\n than on the top of the tallest label. Everything to the right of\n the filters is a bare control with no label of its own, so\n inheriting that baseline pinned it to the bottom of whatever the\n filter area happened to measure — a \"New\" button sitting low\n against a labelled select, moving as soon as a filter gained or\n lost its label.\n\n Centring only the trailing content keeps the filter row's own\n alignment intact and makes the actions independent of it.\n */}\n {props.toolbar && <div className=\"self-center\">{props.toolbar}</div>}\n <TooltipProvider>\n <div className=\"flex items-center gap-1 self-center\">\n {props.actions?.length ? (\n <>\n {props.actions.map((action) => {\n const ActionIcon = action.icon;\n if (action.primary) {\n // The visible label is the tooltip, so there is\n // none. `aria-label` keeps the accessible name once\n // the label collapses below `sm`; `h-9` lines the\n // button up with the ghost icons beside it.\n return (\n <Button\n key={action.label}\n type=\"button\"\n size=\"sm\"\n className=\"h-9 px-3\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n <ActionIcon className=\"size-4\" />\n <span className=\"hidden sm:inline\">{action.label}</span>\n </Button>\n );\n }\n return (\n <Tooltip key={action.label}>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"minimal\"\n className=\"h-9 w-9 p-0\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n />\n }\n >\n <ActionIcon className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{action.label}</TooltipContent>\n </Tooltip>\n );\n })}\n {(showColumnPicker || showActionsMenu || hasHelp) && (\n <span\n aria-hidden\n className=\"bg-border mx-1 h-5 w-px self-center\"\n />\n )}\n </>\n ) : null}\n {isMobile && props.filters && form && (\n <DataTableFilterDialog\n form={form}\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onReset={resetFilters}\n onShare={canShare ? shareFilters : undefined}\n >\n {filterControls(\"dialog\")}\n </DataTableFilterDialog>\n )}\n {showColumnPicker && (\n <DataTableColumnPicker<T>\n columns={props.columns}\n order={orderedKeys}\n visible={visibleColumns}\n onToggle={toggleColumn}\n onReorder={reorderColumn}\n />\n )}\n {/*\n Desktop only. On a phone the same actions live in the filter\n dialog, beside the controls they act on, and a second copy out\n here would spend a slot of the very row that dialog exists to\n shorten.\n\n A table that cannot be linked gets the menu too, holding Reset\n alone: the bare icon button this replaced spends most of its\n life disabled, and a greyed icon carries no words saying what it\n would have done. See `DataTableFilterMenu`.\n */}\n {showActionsMenu && props.filters && !isMobile && (\n <DataTableFilterMenu\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onShare={canShare ? shareFilters : undefined}\n onReset={resetFilters}\n />\n )}\n {showActionsMenu && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"minimal\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"dataTable.refresh\", {\n default: \"Refresh\",\n })}\n disabled={isRefreshing}\n onClick={handleRefreshClick}\n />\n }\n >\n <RefreshCw\n className={cn(\"size-4\", isRefreshing && \"animate-spin\")}\n />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"dataTable.refresh\", { default: \"Refresh\" })}\n </TooltipContent>\n </Tooltip>\n )}\n {/*\n Last, after refresh: the explanation of the page is read once and\n then left alone, so it takes the end of the row rather than a slot\n between the controls a reader keeps reaching for.\n */}\n {hasHelp && <DataTableHelpButton>{props.help}</DataTableHelpButton>}\n </div>\n </TooltipProvider>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyFA,MAAa,oBAAwB,UAAoC;CACvE,MAAM,EACJ,MACA,UACA,kBACA,iBACA,mBACA,UACA,cACA,cACA,aACA,gBACA,cACA,eACA,cACA,uBACE;CACJ,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,UAAU,MAAM,SAAS,KAAA;;;;;;CAO/B,MAAM,kBAAkB,YAA8B;EACpD,IAAI,CAAC,MAA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,EAAY,WAAU,SAAU,CAAA;MAClB,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,OAAO,MAAsB,CAAA,CACvC,EAAA,GAjBK,OAAO,KAiBZ;KAEb,CAAC,IACC,oBAAoB,mBAAmB,YACvC,oBAAC,QAAD;MACE,eAAA;MACA,WAAU;KACX,CAAA,CAEH,EAAA,CAAA,IACA;KACH,YAAY,MAAM,WAAW,QAC5B,oBAAC,uBAAD;MACQ;MACN,aAAa;MACb,UAAU,MAAM;MAChB,SAAS;MACT,SAAS,WAAW,eAAe,KAAA;MAElC,UAAA,eAAe,QAAQ;KACH,CAAA;KAExB,oBACC,oBAAC,uBAAD;MACE,SAAS,MAAM;MACf,OAAO;MACP,SAAS;MACT,UAAU;MACV,WAAW;KACZ,CAAA;KAaF,mBAAmB,MAAM,WAAW,CAAC,YACpC,oBAAC,qBAAD;MACE,aAAa;MACb,UAAU,MAAM;MAChB,SAAS,WAAW,eAAe,KAAA;MACnC,SAAS;KACV,CAAA;KAEF,mBACC,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;MACE,QACE,oBAAC,QAAD;OACE,MAAK;OACL,MAAK;OACL,SAAQ;OACR,WAAU;OACV,cAAY,GAAG,qBAAqB,EAClC,SAAS,UACX,CAAC;OACD,UAAU;OACV,SAAS;MACV,CAAA;MAGH,UAAA,oBAAC,WAAD,EACE,WAAW,GAAG,UAAU,gBAAgB,cAAc,EACvD,CAAA;KACa,CAAA,GAChB,oBAAC,gBAAD,EAAA,UACG,GAAG,qBAAqB,EAAE,SAAS,UAAU,CAAC,EACjC,CAAA,CACT,EAAA,CAAA;KAOV,WAAW,oBAAC,qBAAD,EAAA,UAAsB,MAAM,KAA0B,CAAA;IAC/D;GACU,CAAA,EAAA,CAAA;EACd;;AAET"}
|
|
@@ -15,7 +15,7 @@ export interface PermissionMatrixRowLabelProps {
|
|
|
15
15
|
* affordance, "there is more to know here", not "this does something".
|
|
16
16
|
*
|
|
17
17
|
* Needs a `TooltipProvider` above it, like every other tooltip in this
|
|
18
|
-
* package; `apps/ui` and
|
|
18
|
+
* package; `apps/ui` and Lore both mount one in their layout.
|
|
19
19
|
*/
|
|
20
20
|
export declare const PermissionMatrixRowLabel: (props: PermissionMatrixRowLabelProps) => import("react").JSX.Element;
|
|
21
21
|
//# sourceMappingURL=PermissionMatrixRowLabel.d.ts.map
|
|
@@ -14,7 +14,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
* affordance, "there is more to know here", not "this does something".
|
|
15
15
|
*
|
|
16
16
|
* Needs a `TooltipProvider` above it, like every other tooltip in this
|
|
17
|
-
* package; `apps/ui` and
|
|
17
|
+
* package; `apps/ui` and Lore both mount one in their layout.
|
|
18
18
|
*/
|
|
19
19
|
const PermissionMatrixRowLabel = (props) => {
|
|
20
20
|
if (!props.permission.description) return /* @__PURE__ */ jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionMatrixRowLabel.js","names":[],"sources":["../../src/table/PermissionMatrixRowLabel.tsx"],"sourcesContent":["import { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport type { PermissionMatrixRow } from \"./PermissionMatrix.tsx\";\n\nexport interface PermissionMatrixRowLabelProps {\n permission: PermissionMatrixRow;\n}\n\n/**\n * A permission's label, carrying its `description` as a tooltip.\n *\n * A tooltip rather than a second line, because the mono permission name now\n * owns that line and a third one turns a dense table into a loose one.\n *\n * The trigger is Base UI's default (a button) with a dotted underline rather\n * than a bare `<span>`: a span is not focusable, so a description hung on one\n * is reachable with a mouse and by nothing else. The underline is what keeps\n * a focusable element from reading as an action - it is the abbreviation\n * affordance, \"there is more to know here\", not \"this does something\".\n *\n * Needs a `TooltipProvider` above it, like every other tooltip in this\n * package; `apps/ui` and
|
|
1
|
+
{"version":3,"file":"PermissionMatrixRowLabel.js","names":[],"sources":["../../src/table/PermissionMatrixRowLabel.tsx"],"sourcesContent":["import { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport type { PermissionMatrixRow } from \"./PermissionMatrix.tsx\";\n\nexport interface PermissionMatrixRowLabelProps {\n permission: PermissionMatrixRow;\n}\n\n/**\n * A permission's label, carrying its `description` as a tooltip.\n *\n * A tooltip rather than a second line, because the mono permission name now\n * owns that line and a third one turns a dense table into a loose one.\n *\n * The trigger is Base UI's default (a button) with a dotted underline rather\n * than a bare `<span>`: a span is not focusable, so a description hung on one\n * is reachable with a mouse and by nothing else. The underline is what keeps\n * a focusable element from reading as an action - it is the abbreviation\n * affordance, \"there is more to know here\", not \"this does something\".\n *\n * Needs a `TooltipProvider` above it, like every other tooltip in this\n * package; `apps/ui` and Lore both mount one in their layout.\n */\nexport const PermissionMatrixRowLabel = (\n props: PermissionMatrixRowLabelProps,\n) => {\n if (!props.permission.description) {\n return <span className=\"text-sm\">{props.permission.label}</span>;\n }\n\n return (\n <Tooltip>\n <TooltipTrigger className=\"decoration-muted-foreground/60 w-fit cursor-default text-left text-sm underline decoration-dotted underline-offset-4\">\n {props.permission.label}\n </TooltipTrigger>\n <TooltipContent>{props.permission.description}</TooltipContent>\n </Tooltip>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAa,4BACX,UACG;CACH,IAAI,CAAC,MAAM,WAAW,aACpB,OAAO,oBAAC,QAAD;EAAM,WAAU;EAAW,UAAA,MAAM,WAAW;CAAY,CAAA;CAGjE,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EAAgB,WAAU;EACvB,UAAA,MAAM,WAAW;CACJ,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAM,WAAW,YAA4B,CAAA,CACvD,EAAA,CAAA;AAEb"}
|
|
@@ -358,8 +358,12 @@ export interface DataTableFilterFieldOptions {
|
|
|
358
358
|
/**
|
|
359
359
|
* The options of a list filter, for live data (an atom, a fetch). Without
|
|
360
360
|
* it, an enum schema gives the options. Read every render.
|
|
361
|
+
*
|
|
362
|
+
* A function receives the bar's current values, so one filter's options can
|
|
363
|
+
* follow another's choice: an "action" list narrowed to the actions the
|
|
364
|
+
* picked resource types actually have.
|
|
361
365
|
*/
|
|
362
|
-
items?: SelectOption[];
|
|
366
|
+
items?: SelectOption[] | ((values: Record<string, unknown>) => SelectOption[]);
|
|
363
367
|
/**
|
|
364
368
|
* The label of one option an enum schema gives. Its argument is `any` in
|
|
365
369
|
* the hoisted form; annotate it where a label map needs the literal type.
|
|
@@ -614,6 +618,13 @@ export type TableFetcher<T, F extends DataTableFilterFields = DataTableNoFilterF
|
|
|
614
618
|
size: number;
|
|
615
619
|
sort?: string;
|
|
616
620
|
filters?: DataTableFilterValues<F>;
|
|
621
|
+
/**
|
|
622
|
+
* Aborted when a newer load supersedes this one (a filter keystroke, a
|
|
623
|
+
* project switch, a refresh). Pass it to the request to stop paying for an
|
|
624
|
+
* answer the table will discard anyway; ignoring it is safe, since a
|
|
625
|
+
* superseded answer is never written.
|
|
626
|
+
*/
|
|
627
|
+
signal?: AbortSignal;
|
|
617
628
|
}) => Promise<Page<T>>;
|
|
618
629
|
/**
|
|
619
630
|
* Where the rows come from. Exactly one of the two.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataTableTypes.d.ts","sourceRoot":"","sources":["../../src/table/dataTableTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,IAAI,EACJ,OAAO,EACP,WAAW,EACX,SAAS,EACT,KAAK,EACN,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,CACjC,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,IACvD,CAAC,MAAM,EAAE;IACX,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,EAAE,WAAW,CAAC;CACrB,KAAK,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAEnC;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB,CAC/B,CAAC,SAAS,qBAAqB,GAAG,uBAAuB;IAEzD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IACnC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,OAAO,EAAE,uBAAuB,KAAK,SAAS,CAAC,CAAC;CACzE;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/table/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PermissionMatrix } from "./PermissionMatrix.js";
|
|
2
1
|
import { DataTableBulkMenu } from "./DataTableBulkMenu.js";
|
|
3
2
|
import { PAGE_SIZES } from "./DataTableFooter.js";
|
|
4
3
|
import { DataTableFilterDialog } from "./DataTableFilterDialog.js";
|
|
@@ -7,4 +6,5 @@ import { DataTableFilterMenu } from "./DataTableFilterMenu.js";
|
|
|
7
6
|
import { paginateLocal } from "./paginateLocal.js";
|
|
8
7
|
import { useTableSelection } from "./useTableSelection.js";
|
|
9
8
|
import { DataTable } from "./DataTable.js";
|
|
9
|
+
import { PermissionMatrix } from "./PermissionMatrix.js";
|
|
10
10
|
export { DataTable, DataTableBulkMenu, DataTableFilterDialog, DataTableFilterMenu, PAGE_SIZES, PermissionMatrix, dataTableFilterKeys, paginateLocal, useTableSelection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableData.d.ts","sourceRoot":"","sources":["../../src/table/useDataTableData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAa,KAAK,OAAO,EAAK,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,cAAc,EAMpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAAE,qBAAqB,CAAC,GACjD,eAAe,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAC5C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C;;;OAGG;IACH,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,WAAW,uBAAuB,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useDataTableData.d.ts","sourceRoot":"","sources":["../../src/table/useDataTableData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAa,KAAK,OAAO,EAAK,MAAM,QAAQ,CAAC;AACjE,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,cAAc,EAMpB,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,SAAS,EACT,SAAS,EACV,MAAM,qBAAqB,CAAC;AAG7B,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAAE,qBAAqB,CAAC,GACjD,eAAe,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAC5C;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C;;;OAGG;IACH,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,WAAW,uBAAuB,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA6M5C,MAAM,OAAO,SAAS,CAAC,CAAC,CAAC;qBAsB3C,MAAM,OACN,SAAS,CAAC,CAAC,CAAC,aACN,KAAK,GAAG,MAAM,GAAG,IAAI;CA0BnC,CAAC"}
|
|
@@ -56,9 +56,17 @@ const useDataTableData = (options) => {
|
|
|
56
56
|
const sortParam = sort ? sort.direction === "desc" ? `-${sort.field}` : sort.field : void 0;
|
|
57
57
|
const fetchRef = useRef(props.fetch);
|
|
58
58
|
fetchRef.current = props.fetch;
|
|
59
|
+
const latestRequest = useRef(void 0);
|
|
59
60
|
const load = useCallback(async () => {
|
|
60
61
|
const fetcher = fetchRef.current;
|
|
61
62
|
if (!fetcher) return;
|
|
63
|
+
latestRequest.current?.abort.abort();
|
|
64
|
+
const request = {
|
|
65
|
+
id: (latestRequest.current?.id ?? 0) + 1,
|
|
66
|
+
abort: new AbortController()
|
|
67
|
+
};
|
|
68
|
+
latestRequest.current = request;
|
|
69
|
+
const isLatest = () => latestRequest.current === request;
|
|
62
70
|
setLoading(true);
|
|
63
71
|
const sent = form ? { ...form.currentValues } : void 0;
|
|
64
72
|
try {
|
|
@@ -66,19 +74,22 @@ const useDataTableData = (options) => {
|
|
|
66
74
|
page,
|
|
67
75
|
size,
|
|
68
76
|
sort: sortParam,
|
|
69
|
-
filters: form?.currentValues
|
|
77
|
+
filters: form?.currentValues,
|
|
78
|
+
signal: request.abort.signal
|
|
70
79
|
});
|
|
80
|
+
if (!isLatest()) return;
|
|
71
81
|
setData(res.content);
|
|
72
82
|
setMeta(res.page);
|
|
73
83
|
setFetchedFilters(sent);
|
|
74
84
|
} catch (error) {
|
|
85
|
+
if (!isLatest()) return;
|
|
75
86
|
alepha.events.emit("react:action:error", {
|
|
76
87
|
type: "custom",
|
|
77
88
|
id: "data-table:load",
|
|
78
89
|
error
|
|
79
90
|
});
|
|
80
91
|
} finally {
|
|
81
|
-
setLoading(false);
|
|
92
|
+
if (isLatest()) setLoading(false);
|
|
82
93
|
}
|
|
83
94
|
}, [
|
|
84
95
|
page,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableData.js","names":[],"sources":["../../src/table/useDataTableData.ts"],"sourcesContent":["import { type Alepha, type Page, type ZObject, z } from \"alepha\";\nimport { type FormModel, useForm } from \"alepha/react/form\";\nimport {\n type Dispatch,\n type SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { persistedSort, writePersisted } from \"./dataTablePersistence.ts\";\nimport type {\n DataTableFilterFields,\n DataTableSource,\n ColumnDef,\n SortState,\n} from \"./dataTableTypes.ts\";\nimport { paginateLocal } from \"./paginateLocal.ts\";\n\nexport interface UseDataTableDataOptions<T> {\n props: DataTableBaseProps<T, DataTableFilterFields> &\n DataTableSource<T, DataTableFilterFields>;\n /**\n * The page size and its setter. The state is declared in `DataTable`,\n * first of all its hooks; this hook changes it from the footer's picker.\n */\n size: number;\n setSize: Dispatch<SetStateAction<number>>;\n /**\n * The key the sort is persisted under, or `undefined` when the table does\n * not store it.\n */\n sortKey: string | undefined;\n form: FormModel<ZObject> | undefined;\n alepha: Alepha;\n}\n\n/**\n * The rows `DataTable` renders and the state that picks them: the page, the\n * page-size picker, the sort, and either the fetched page or the static one\n * derived from `data`.\n *\n * The setters are returned alongside the values because the refresh wiring\n * and the scope change in `DataTable` write the same state.\n */\nexport const useDataTableData = <T>(options: UseDataTableDataOptions<T>) => {\n const { props, size, setSize, sortKey, form, alepha } = options;\n\n // -- Paging / sort / data --------------------------------------------------\n\n const [page, setPage] = useState(0);\n\n /**\n * Change the page size and go back to the first page.\n *\n * The reset is the whole point: raising the size while on page 5 can put\n * the reader past the last page, which renders an empty table with no\n * visible cause. Persisted so the choice survives a reload, alongside the\n * filters, sort and columns this table already remembers.\n */\n const changeSize = (next: number) => {\n setSize(next);\n setPage(0);\n if (props.persistenceKey) {\n writePersisted(props.persistenceKey, \"size\", next);\n }\n };\n\n /**\n * The footer's page-size picker, as a form of one field.\n *\n * `Control` is form-bound and this picker is not part of any form, which is\n * why the footer stayed on a raw `<Select>` long after everything else here\n * moved. One field is the whole cost of joining, and it buys the picker the\n * same trigger, popup and keyboard handling as every other select in the\n * table. `keepDirty: false` so the re-seed below actually re-seeds: `size`\n * can move without the picker (a persisted value on mount), and a kept\n * \"edit\" would pin the trigger to a page size the table is not using.\n */\n const sizeForm = useForm({\n schema: z.object({ size: z.number() }),\n initialValues: { size },\n keepDirty: false,\n handler: async () => {},\n onChange: (_key, next) => changeSize(next as number),\n });\n\n const [sort, setSort] = useState<SortState | null>(() =>\n persistedSort(sortKey, props.defaultSort),\n );\n const [fetchedData, setData] = useState<T[]>([]);\n const [fetchedMeta, setMeta] = useState<Page<T>[\"page\"] | null>(null);\n // The filters the fetched rows answer, copied when their request left:\n // `form.currentValues` is mutated in place and already holds what the\n // reader is typing now. Read by the cells through `rowFilters`.\n const [fetchedFilters, setFetchedFilters] = useState<\n Record<string, unknown> | undefined\n >(undefined);\n const [loading, setLoading] = useState(false);\n const [refreshKey, setRefreshKey] = useState(0);\n const [isRefreshing, setIsRefreshing] = useState(false);\n\n // Alepha's pagination parser reads \"field\" as asc and \"-field\" as desc.\n // Multiple comma-separated entries are multi-column sort, so we must\n // NOT use `field,direction` syntax — that would treat \"asc\"/\"desc\" as\n // a second column name and 500 on the backend.\n const sortParam = sort\n ? sort.direction === \"desc\"\n ? `-${sort.field}`\n : sort.field\n : undefined;\n\n // Hold the latest `fetch` in a ref so it is NOT a dependency of `load`.\n // Callers pass `fetch` inline (a new function every render), and a fetcher\n // that writes a store atom the caller also subscribes to would otherwise\n // self-trigger: load → atom write → caller re-render → new `fetch` → new\n // `load` → effect re-runs → infinite loop. The ref keeps the newest closure\n // available while `load` only re-runs on actual inputs (page/size/sort/…).\n const fetchRef = useRef(props.fetch);\n fetchRef.current = props.fetch;\n\n const load = useCallback(async () => {\n // Static mode owns no request. Bail before touching `loading` too, so a\n // table fed an array never flashes the skeleton over rows it already has.\n const fetcher = fetchRef.current;\n if (!fetcher) return;\n setLoading(true);\n const sent = form ? { ...form.currentValues } : undefined;\n try {\n const res = await fetcher({\n page,\n size,\n sort: sortParam,\n filters: form?.currentValues,\n });\n setData(res.content);\n setMeta(res.page);\n setFetchedFilters(sent);\n } catch (error) {\n // Surface read failures through the same `react:action:error` channel\n // that useAction/useQuery use, so a mounted <ActionErrorToaster /> toasts\n // them. Keep the previous rows on screen rather than blanking the table.\n void alepha.events.emit(\"react:action:error\", {\n type: \"custom\",\n id: \"data-table:load\",\n error: error as Error,\n });\n } finally {\n setLoading(false);\n }\n }, [page, size, sortParam, refreshKey, form, alepha]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n /**\n * Static mode's equivalent of `load` — derived, not stored.\n *\n * Deliberately NOT routed through `load`: putting `props.data` in that\n * effect's dependencies reproduces the exact loop `fetchRef` exists to\n * prevent (load → setData → re-render → new inline array → new load).\n * Computed synchronously there is no state to go stale, an inline\n * `data={rows.filter(…)}` is safe, and a changed array is on screen in\n * the same render.\n */\n const staticPage = useMemo(() => {\n if (!props.data) return null;\n const sortValues: Record<string, (item: T) => unknown> = {};\n for (const [key, column] of Object.entries(props.columns)) {\n if (column.sortValue) {\n sortValues[column.sortKey ?? key] = column.sortValue;\n }\n }\n return paginateLocal(props.data, {\n page,\n size,\n sort: sortParam,\n sortValues,\n filters: form?.currentValues,\n filter: props.filter,\n });\n // `refreshKey` is what the filter-form subscriptions bump, so it is how\n // a filter change reaches this memo — `form.currentValues` is mutated in\n // place and its identity never changes.\n }, [\n props.data,\n props.columns,\n props.filter,\n page,\n size,\n sortParam,\n refreshKey,\n form,\n ]);\n\n const data = staticPage ? staticPage.content : fetchedData;\n const meta = staticPage ? staticPage.page : fetchedMeta;\n // Static rows are derived in this render from the current values, so those\n // ARE the filters they answer.\n const rowFilters = staticPage ? form?.currentValues : fetchedFilters;\n\n /**\n * Rows vanish under the reader in static mode: the caller detaches one and\n * the page they are on stops existing. Nothing fetches, so nothing else\n * would notice — the table would sit on an empty page with no visible\n * cause. Fetch mode has the same hole, but there the server round-trip\n * needed to see it makes this the wrong place to close it.\n */\n if (staticPage) {\n const totalPages = staticPage.page.totalPages ?? 0;\n if (page > 0 && page > totalPages - 1) {\n // Guarded on `page`, so it settles in one pass and does not need an\n // effect: the clamp lands before the rows render against a page that no\n // longer exists.\n setPage(Math.max(0, totalPages - 1));\n }\n }\n\n // Persist sort to localStorage on every change.\n useEffect(() => {\n if (!sortKey) return;\n writePersisted(sortKey, \"sort\", sort);\n }, [sortKey, sort]);\n\n // -- Sort ------------------------------------------------------------------\n\n const toggleSort = (col: string, def: ColumnDef<T>) => {\n if (!def.sortable) return;\n const field = def.sortKey ?? col;\n setSort((s) => {\n const next: SortState | null =\n !s || s.field !== field\n ? { field, direction: \"asc\" }\n : s.direction === \"asc\"\n ? { field, direction: \"desc\" }\n : null;\n props.onSortChange?.(next);\n return next;\n });\n };\n\n /**\n * Sort in a named direction, or clear it.\n *\n * The header cycles; the menu states. Both write the same state, so a\n * column sorted from the menu shows the header's own arrow.\n */\n const setSortTo = (\n col: string,\n def: ColumnDef<T>,\n direction: \"asc\" | \"desc\" | null,\n ) => {\n if (!def.sortable) return;\n const field = def.sortKey ?? col;\n const next: SortState | null = direction ? { field, direction } : null;\n setSort(next);\n props.onSortChange?.(next);\n };\n\n return {\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 };\n};\n"],"mappings":";;;;;;;;;;;;;;AAgDA,MAAa,oBAAuB,YAAwC;CAC1E,MAAM,EAAE,OAAO,MAAM,SAAS,SAAS,MAAM,WAAW;CAIxD,MAAM,CAAC,MAAM,WAAW,SAAS,CAAC;;;;;;;;;CAUlC,MAAM,cAAc,SAAiB;EACnC,QAAQ,IAAI;EACZ,QAAQ,CAAC;EACT,IAAI,MAAM,gBACR,eAAe,MAAM,gBAAgB,QAAQ,IAAI;CAErD;;;;;;;;;;;;CAaA,MAAM,WAAW,QAAQ;EACvB,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;EACrC,eAAe,EAAE,KAAK;EACtB,WAAW;EACX,SAAS,YAAY,CAAC;EACtB,WAAW,MAAM,SAAS,WAAW,IAAc;C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ableData.ts"],"sourcesContent":["import { type Alepha, type Page, type ZObject, z } from \"alepha\";\nimport { type FormModel, useForm } from \"alepha/react/form\";\nimport {\n type Dispatch,\n type SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\n\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { persistedSort, writePersisted } from \"./dataTablePersistence.ts\";\nimport type {\n DataTableFilterFields,\n DataTableSource,\n ColumnDef,\n SortState,\n} from \"./dataTableTypes.ts\";\nimport { paginateLocal } from \"./paginateLocal.ts\";\n\nexport interface UseDataTableDataOptions<T> {\n props: DataTableBaseProps<T, DataTableFilterFields> &\n DataTableSource<T, DataTableFilterFields>;\n /**\n * The page size and its setter. The state is declared in `DataTable`,\n * first of all its hooks; this hook changes it from the footer's picker.\n */\n size: number;\n setSize: Dispatch<SetStateAction<number>>;\n /**\n * The key the sort is persisted under, or `undefined` when the table does\n * not store it.\n */\n sortKey: string | undefined;\n form: FormModel<ZObject> | undefined;\n alepha: Alepha;\n}\n\n/**\n * The rows `DataTable` renders and the state that picks them: the page, the\n * page-size picker, the sort, and either the fetched page or the static one\n * derived from `data`.\n *\n * The setters are returned alongside the values because the refresh wiring\n * and the scope change in `DataTable` write the same state.\n */\nexport const useDataTableData = <T>(options: UseDataTableDataOptions<T>) => {\n const { props, size, setSize, sortKey, form, alepha } = options;\n\n // -- Paging / sort / data --------------------------------------------------\n\n const [page, setPage] = useState(0);\n\n /**\n * Change the page size and go back to the first page.\n *\n * The reset is the whole point: raising the size while on page 5 can put\n * the reader past the last page, which renders an empty table with no\n * visible cause. Persisted so the choice survives a reload, alongside the\n * filters, sort and columns this table already remembers.\n */\n const changeSize = (next: number) => {\n setSize(next);\n setPage(0);\n if (props.persistenceKey) {\n writePersisted(props.persistenceKey, \"size\", next);\n }\n };\n\n /**\n * The footer's page-size picker, as a form of one field.\n *\n * `Control` is form-bound and this picker is not part of any form, which is\n * why the footer stayed on a raw `<Select>` long after everything else here\n * moved. One field is the whole cost of joining, and it buys the picker the\n * same trigger, popup and keyboard handling as every other select in the\n * table. `keepDirty: false` so the re-seed below actually re-seeds: `size`\n * can move without the picker (a persisted value on mount), and a kept\n * \"edit\" would pin the trigger to a page size the table is not using.\n */\n const sizeForm = useForm({\n schema: z.object({ size: z.number() }),\n initialValues: { size },\n keepDirty: false,\n handler: async () => {},\n onChange: (_key, next) => changeSize(next as number),\n });\n\n const [sort, setSort] = useState<SortState | null>(() =>\n persistedSort(sortKey, props.defaultSort),\n );\n const [fetchedData, setData] = useState<T[]>([]);\n const [fetchedMeta, setMeta] = useState<Page<T>[\"page\"] | null>(null);\n // The filters the fetched rows answer, copied when their request left:\n // `form.currentValues` is mutated in place and already holds what the\n // reader is typing now. Read by the cells through `rowFilters`.\n const [fetchedFilters, setFetchedFilters] = useState<\n Record<string, unknown> | undefined\n >(undefined);\n const [loading, setLoading] = useState(false);\n const [refreshKey, setRefreshKey] = useState(0);\n const [isRefreshing, setIsRefreshing] = useState(false);\n\n // Alepha's pagination parser reads \"field\" as asc and \"-field\" as desc.\n // Multiple comma-separated entries are multi-column sort, so we must\n // NOT use `field,direction` syntax — that would treat \"asc\"/\"desc\" as\n // a second column name and 500 on the backend.\n const sortParam = sort\n ? sort.direction === \"desc\"\n ? `-${sort.field}`\n : sort.field\n : undefined;\n\n // Hold the latest `fetch` in a ref so it is NOT a dependency of `load`.\n // Callers pass `fetch` inline (a new function every render), and a fetcher\n // that writes a store atom the caller also subscribes to would otherwise\n // self-trigger: load → atom write → caller re-render → new `fetch` → new\n // `load` → effect re-runs → infinite loop. The ref keeps the newest closure\n // available while `load` only re-runs on actual inputs (page/size/sort/…).\n const fetchRef = useRef(props.fetch);\n fetchRef.current = props.fetch;\n\n // The newest request, so an older one that answers late cannot put its\n // rows back (#Q2517). A project switch, a filter keystroke or a refresh\n // each start one; only the last may write, and it aborts the one before.\n const latestRequest = useRef<\n { id: number; abort: AbortController } | undefined\n >(undefined);\n\n const load = useCallback(async () => {\n // Static mode owns no request. Bail before touching `loading` too, so a\n // table fed an array never flashes the skeleton over rows it already has.\n const fetcher = fetchRef.current;\n if (!fetcher) return;\n latestRequest.current?.abort.abort();\n const request = {\n id: (latestRequest.current?.id ?? 0) + 1,\n abort: new AbortController(),\n };\n latestRequest.current = request;\n const isLatest = () => latestRequest.current === request;\n setLoading(true);\n const sent = form ? { ...form.currentValues } : undefined;\n try {\n const res = await fetcher({\n page,\n size,\n sort: sortParam,\n filters: form?.currentValues,\n signal: request.abort.signal,\n });\n if (!isLatest()) return;\n setData(res.content);\n setMeta(res.page);\n setFetchedFilters(sent);\n } catch (error) {\n // A superseded request's failure (its own abort included) is nobody's\n // news: a newer one is already answering.\n if (!isLatest()) return;\n // Surface read failures through the same `react:action:error` channel\n // that useAction/useQuery use, so a mounted <ActionErrorToaster /> toasts\n // them. Keep the previous rows on screen rather than blanking the table.\n void alepha.events.emit(\"react:action:error\", {\n type: \"custom\",\n id: \"data-table:load\",\n error: error as Error,\n });\n } finally {\n // Only the newest request clears `loading`: an older one finishing\n // first used to hide the spinner while the table still waited.\n if (isLatest()) {\n setLoading(false);\n }\n }\n }, [page, size, sortParam, refreshKey, form, alepha]);\n\n useEffect(() => {\n void load();\n }, [load]);\n\n /**\n * Static mode's equivalent of `load` — derived, not stored.\n *\n * Deliberately NOT routed through `load`: putting `props.data` in that\n * effect's dependencies reproduces the exact loop `fetchRef` exists to\n * prevent (load → setData → re-render → new inline array → new load).\n * Computed synchronously there is no state to go stale, an inline\n * `data={rows.filter(…)}` is safe, and a changed array is on screen in\n * the same render.\n */\n const staticPage = useMemo(() => {\n if (!props.data) return null;\n const sortValues: Record<string, (item: T) => unknown> = {};\n for (const [key, column] of Object.entries(props.columns)) {\n if (column.sortValue) {\n sortValues[column.sortKey ?? key] = column.sortValue;\n }\n }\n return paginateLocal(props.data, {\n page,\n size,\n sort: sortParam,\n sortValues,\n filters: form?.currentValues,\n filter: props.filter,\n });\n // `refreshKey` is what the filter-form subscriptions bump, so it is how\n // a filter change reaches this memo — `form.currentValues` is mutated in\n // place and its identity never changes.\n }, [\n props.data,\n props.columns,\n props.filter,\n page,\n size,\n sortParam,\n refreshKey,\n form,\n ]);\n\n const data = staticPage ? staticPage.content : fetchedData;\n const meta = staticPage ? staticPage.page : fetchedMeta;\n // Static rows are derived in this render from the current values, so those\n // ARE the filters they answer.\n const rowFilters = staticPage ? form?.currentValues : fetchedFilters;\n\n /**\n * Rows vanish under the reader in static mode: the caller detaches one and\n * the page they are on stops existing. Nothing fetches, so nothing else\n * would notice — the table would sit on an empty page with no visible\n * cause. Fetch mode has the same hole, but there the server round-trip\n * needed to see it makes this the wrong place to close it.\n */\n if (staticPage) {\n const totalPages = staticPage.page.totalPages ?? 0;\n if (page > 0 && page > totalPages - 1) {\n // Guarded on `page`, so it settles in one pass and does not need an\n // effect: the clamp lands before the rows render against a page that no\n // longer exists.\n setPage(Math.max(0, totalPages - 1));\n }\n }\n\n // Persist sort to localStorage on every change.\n useEffect(() => {\n if (!sortKey) return;\n writePersisted(sortKey, \"sort\", sort);\n }, [sortKey, sort]);\n\n // -- Sort ------------------------------------------------------------------\n\n const toggleSort = (col: string, def: ColumnDef<T>) => {\n if (!def.sortable) return;\n const field = def.sortKey ?? col;\n setSort((s) => {\n const next: SortState | null =\n !s || s.field !== field\n ? { field, direction: \"asc\" }\n : s.direction === \"asc\"\n ? { field, direction: \"desc\" }\n : null;\n props.onSortChange?.(next);\n return next;\n });\n };\n\n /**\n * Sort in a named direction, or clear it.\n *\n * The header cycles; the menu states. Both write the same state, so a\n * column sorted from the menu shows the header's own arrow.\n */\n const setSortTo = (\n col: string,\n def: ColumnDef<T>,\n direction: \"asc\" | \"desc\" | null,\n ) => {\n if (!def.sortable) return;\n const field = def.sortKey ?? col;\n const next: SortState | null = direction ? { field, direction } : null;\n setSort(next);\n props.onSortChange?.(next);\n };\n\n return {\n page,\n setPage,\n sizeForm,\n sort,\n setSort,\n data,\n meta,\n rowFilters,\n loading,\n refreshKey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aAAa,WAAW,KAAK,cAAc;EACjD,IAAI,OAAO,KAAK,OAAO,aAAa,GAIlC,QAAQ,KAAK,IAAI,GAAG,aAAa,CAAC,CAAC;CAEvC;CAGA,gBAAgB;EACd,IAAI,CAAC,SAAS;EACd,eAAe,SAAS,QAAQ,IAAI;CACtC,GAAG,CAAC,SAAS,IAAI,CAAC;CAIlB,MAAM,cAAc,KAAa,QAAsB;EACrD,IAAI,CAAC,IAAI,UAAU;EACnB,MAAM,QAAQ,IAAI,WAAW;EAC7B,SAAS,MAAM;GACb,MAAM,OACJ,CAAC,KAAK,EAAE,UAAU,QACd;IAAE;IAAO,WAAW;GAAM,IAC1B,EAAE,cAAc,QACd;IAAE;IAAO,WAAW;GAAO,IAC3B;GACR,MAAM,eAAe,IAAI;GACzB,OAAO;EACT,CAAC;CACH;;;;;;;CAQA,MAAM,aACJ,KACA,KACA,cACG;EACH,IAAI,CAAC,IAAI,UAAU;EACnB,MAAM,QAAQ,IAAI,WAAW;EAC7B,MAAM,OAAyB,YAAY;GAAE;GAAO;EAAU,IAAI;EAClE,QAAQ,IAAI;EACZ,MAAM,eAAe,IAAI;CAC3B;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alepha/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Shared Base UI and Tailwind components for Alepha apps. Edited directly; bugfixes propagate via normal dep updates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alepha",
|
|
@@ -181,19 +181,18 @@
|
|
|
181
181
|
"@fontsource-variable/inter": "^5.3.0",
|
|
182
182
|
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
|
183
183
|
"class-variance-authority": "^0.7.1",
|
|
184
|
-
"cn": "^0.
|
|
184
|
+
"cn": "^0.4.0",
|
|
185
185
|
"date-fns": "^4.4.0",
|
|
186
186
|
"graphre": "^0.1.3",
|
|
187
187
|
"hast-util-to-text": "^4.0.2",
|
|
188
188
|
"highlight.js": "^11.12.0",
|
|
189
189
|
"input-otp": "^1.5.0",
|
|
190
190
|
"lowlight": "^3.3.0",
|
|
191
|
-
"lucide-react": "^1.
|
|
192
|
-
"react-day-picker": "^10.0.
|
|
193
|
-
"react-is": "^19.
|
|
191
|
+
"lucide-react": "^1.49.0",
|
|
192
|
+
"react-day-picker": "^10.0.2",
|
|
193
|
+
"react-is": "^19.3.0",
|
|
194
194
|
"react-markdown": "^10.1.0",
|
|
195
|
-
"react-resizable-panels": "^4.
|
|
196
|
-
"recharts": "3.10.1",
|
|
195
|
+
"react-resizable-panels": "^4.14.1",
|
|
197
196
|
"remark-gfm": "^4.0.1",
|
|
198
197
|
"sonner": "^2.0.8",
|
|
199
198
|
"tw-animate-css": "^1.4.0",
|
|
@@ -201,25 +200,29 @@
|
|
|
201
200
|
},
|
|
202
201
|
"devDependencies": {
|
|
203
202
|
"@playwright/test": "^1.63.0",
|
|
204
|
-
"@testing-library/dom": "^10.4.
|
|
203
|
+
"@testing-library/dom": "^10.4.2",
|
|
205
204
|
"@testing-library/react": "^16.3.3",
|
|
206
205
|
"@types/bun": "^1.4.2",
|
|
207
|
-
"@types/node": "^26.
|
|
208
|
-
"@types/react": "^19.
|
|
209
|
-
"alepha": "0.
|
|
210
|
-
"react": "^19.
|
|
211
|
-
"react-dom": "^19.
|
|
206
|
+
"@types/node": "^26.6.3",
|
|
207
|
+
"@types/react": "^19.3.0",
|
|
208
|
+
"alepha": "0.31.0",
|
|
209
|
+
"react": "^19.3.0",
|
|
210
|
+
"react-dom": "^19.3.0",
|
|
211
|
+
"recharts": "^3.10.1",
|
|
212
212
|
"tsdown": "^0.23.0",
|
|
213
213
|
"typescript": "^7.0.2"
|
|
214
214
|
},
|
|
215
215
|
"peerDependencies": {
|
|
216
|
-
"alepha": "^0.
|
|
216
|
+
"alepha": "^0.31.0",
|
|
217
217
|
"react": "*",
|
|
218
218
|
"react-dom": "*",
|
|
219
219
|
"recharts": "^3",
|
|
220
220
|
"tailwindcss": "^4"
|
|
221
221
|
},
|
|
222
222
|
"peerDependenciesMeta": {
|
|
223
|
+
"recharts": {
|
|
224
|
+
"optional": true
|
|
225
|
+
},
|
|
223
226
|
"tailwindcss": {
|
|
224
227
|
"optional": true
|
|
225
228
|
}
|
|
@@ -18,8 +18,8 @@ import { AccountRouter } from "./AccountRouter.tsx";
|
|
|
18
18
|
* `$page`. Nothing about its lifecycle differs from declaring `$page`
|
|
19
19
|
* yourself.
|
|
20
20
|
*
|
|
21
|
-
* The page appears in the
|
|
22
|
-
*
|
|
21
|
+
* The page appears in the sidebar with no separate registration: the layout
|
|
22
|
+
* is `NavShell root="account"`, which walks the parent chain
|
|
23
23
|
* and reads each page's own `nav`.
|
|
24
24
|
*
|
|
25
25
|
* **Calling this registers `AccountRouter`.** Declaring even one page this
|
|
@@ -28,10 +28,15 @@ import { AccountRouter } from "./AccountRouter.tsx";
|
|
|
28
28
|
* the intended reading, but it is a real side effect: an application wanting
|
|
29
29
|
* `/account` to carry only its own pages must build its own layout instead.
|
|
30
30
|
*
|
|
31
|
-
* **Take
|
|
32
|
-
* built-ins occupy `Account` (order 1) and `Security` (orders
|
|
33
|
-
* `useNavEntries` sorts groups by their smallest member, so
|
|
34
|
-
*
|
|
31
|
+
* **Take an order between 100 and 999, in your own `nav.group`.** The
|
|
32
|
+
* built-ins occupy `Account` (order 1) and `Security` (orders 1000-1003), and
|
|
33
|
+
* `useNavEntries` sorts groups by their smallest member, so the application's
|
|
34
|
+
* groups sit between the two: personal first, then the application, then
|
|
35
|
+
* security. An order below 100 competes with Profile, one of 1000 or more
|
|
36
|
+
* sinks the page in among the security pages.
|
|
37
|
+
*
|
|
38
|
+
* **Frame the page with `AccountPage`**: `variant="table"` for a `DataTable`
|
|
39
|
+
* that fills the area, `variant="form"` for a centred column of cards.
|
|
35
40
|
*
|
|
36
41
|
* **Gate with `can: () => this.someApi.someAction.can()`, not `permission`
|
|
37
42
|
* alone.** A permission named by this page's own `$secure` is self-declaring:
|
|
@@ -60,7 +65,10 @@ import { AccountRouter } from "./AccountRouter.tsx";
|
|
|
60
65
|
* order: 100,
|
|
61
66
|
* },
|
|
62
67
|
* can: () => this.invitationApi.getMyOrganizationInvitations.can(),
|
|
63
|
-
*
|
|
68
|
+
* // A lazy page framing `MyOrganizationInvitations` in
|
|
69
|
+
* // `<AccountPage variant="table">`: the component draws the table,
|
|
70
|
+
* // the page owns the frame.
|
|
71
|
+
* lazy: () => import("./AccountInvitations.tsx"),
|
|
64
72
|
* });
|
|
65
73
|
* }
|
|
66
74
|
* ```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useI18n } from "alepha/react/i18n";
|
|
2
|
+
import { Link, useRouter } from "alepha/react/router";
|
|
3
|
+
import { ArrowLeft } from "lucide-react";
|
|
4
|
+
|
|
5
|
+
import { DropdownMenuItem } from "../core/DropdownMenu.tsx";
|
|
6
|
+
|
|
7
|
+
export interface AccountBackToSiteMenuItemProps {
|
|
8
|
+
/**
|
|
9
|
+
* Route name the item links to.
|
|
10
|
+
*
|
|
11
|
+
* @default "home"
|
|
12
|
+
*/
|
|
13
|
+
routeName?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* "Back to site" in the account menu: the way out of the account shell for
|
|
18
|
+
* everybody.
|
|
19
|
+
*
|
|
20
|
+
* `AdminLayout` reuses the menu's admin item for its way out, which works
|
|
21
|
+
* there because everyone inside `/admin` holds `admin:ui`. Inside `/account`
|
|
22
|
+
* most people do not, and that item hides itself for them, so the account
|
|
23
|
+
* shell carries its own. A real `<Link href>`, so middle-click and "open in
|
|
24
|
+
* new tab" work, and hidden when the route is not mounted rather than
|
|
25
|
+
* linking to a 404.
|
|
26
|
+
*/
|
|
27
|
+
export const AccountBackToSiteMenuItem = (
|
|
28
|
+
props: AccountBackToSiteMenuItemProps,
|
|
29
|
+
) => {
|
|
30
|
+
const router = useRouter<any>();
|
|
31
|
+
const { tr } = useI18n();
|
|
32
|
+
const routeName = props.routeName ?? "home";
|
|
33
|
+
if (!router.pages?.some((page: any) => page.name === routeName)) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<DropdownMenuItem
|
|
39
|
+
render={<Link href={router.path(routeName)} />}
|
|
40
|
+
data-testid="account-back-to-site"
|
|
41
|
+
>
|
|
42
|
+
<ArrowLeft className="size-4" />
|
|
43
|
+
{tr("account.nav.backToSite", { default: "Back to site" })}
|
|
44
|
+
</DropdownMenuItem>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useAuth } from "alepha/react/auth";
|
|
2
|
+
import { useI18n } from "alepha/react/i18n";
|
|
3
|
+
|
|
4
|
+
import { UserAvatar } from "../core/UserAvatar.tsx";
|
|
5
|
+
|
|
6
|
+
export interface AccountBrandProps {
|
|
7
|
+
/**
|
|
8
|
+
* Line under the name. Defaults to the translated "Account", so the header
|
|
9
|
+
* says whose area this is and what it is.
|
|
10
|
+
*/
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The account sidebar's default header: the signed-in user's avatar and
|
|
16
|
+
* display name, collapsing to the avatar alone when the sidebar folds to its
|
|
17
|
+
* icon rail.
|
|
18
|
+
*
|
|
19
|
+
* The account area is the user's own, so the header says whose it is rather
|
|
20
|
+
* than repeating the application's name. An application that wants its own
|
|
21
|
+
* mark there passes `brand` on `accountRouterOptionsAtom`, as Lore does.
|
|
22
|
+
*
|
|
23
|
+
* ⚠️ Imported only from `AccountLayout`, the lazy chunk. `AccountRouter` is
|
|
24
|
+
* evaluated eagerly in the server graph, where a component import would drag
|
|
25
|
+
* this file into the migration generator's classic-JSX `tsx` run (see the
|
|
26
|
+
* router's own JSDoc).
|
|
27
|
+
*/
|
|
28
|
+
export const AccountBrand = (props: AccountBrandProps) => {
|
|
29
|
+
const auth = useAuth();
|
|
30
|
+
const { tr } = useI18n();
|
|
31
|
+
const user = auth.user;
|
|
32
|
+
const name = user?.name ?? user?.username ?? user?.email ?? "";
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div className="flex min-w-0 items-center gap-2 px-2 py-1.5 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 group-data-[collapsible=icon]:px-0">
|
|
36
|
+
<UserAvatar fileId={user?.picture} className="size-7" alt={name} />
|
|
37
|
+
<div className="flex min-w-0 flex-col group-data-[collapsible=icon]:hidden">
|
|
38
|
+
<span
|
|
39
|
+
className="truncate text-sm font-semibold tracking-tight"
|
|
40
|
+
data-testid="account-brand-name"
|
|
41
|
+
>
|
|
42
|
+
{name}
|
|
43
|
+
</span>
|
|
44
|
+
<span className="text-muted-foreground truncate text-xs">
|
|
45
|
+
{props.subtitle ??
|
|
46
|
+
tr("account.brand.subtitle", { default: "Account" })}
|
|
47
|
+
</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
};
|