@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":"SettingsHeading.js","names":[],"sources":["../../src/settings/SettingsHeading.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport { cn } from \"../core/utils.ts\";\n\nexport interface SettingsHeadingProps {\n /**\n * What this block of the page is. A noun phrase naming the thing, not a verb\n * phrase describing the action: \"Active sessions\", not \"Manage sessions\".\n */\n title?: ReactNode;\n\n /**\n * One line under the title. The place to put what the reader needs to know\n * before touching anything below it — a consequence, a constraint, a limit.\n * Skip it rather than restate the title in more words.\n */\n description?: ReactNode;\n\n className?: string;\n}\n\n/**\n * The title + description pair that sits above a settings block.\n *\n * It exists so there is exactly one of it. {@link SettingsSection} renders this\n * for the common case (a heading over a card of {@link SettingsRow}s), and a\n * page whose content is not a card of rows — a table, a list of invitations —\n * uses it directly instead of hand-rolling the markup.\n *\n * That hand-rolling is the failure this prevents, and it had already happened:\n *
|
|
1
|
+
{"version":3,"file":"SettingsHeading.js","names":[],"sources":["../../src/settings/SettingsHeading.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport { cn } from \"../core/utils.ts\";\n\nexport interface SettingsHeadingProps {\n /**\n * What this block of the page is. A noun phrase naming the thing, not a verb\n * phrase describing the action: \"Active sessions\", not \"Manage sessions\".\n */\n title?: ReactNode;\n\n /**\n * One line under the title. The place to put what the reader needs to know\n * before touching anything below it — a consequence, a constraint, a limit.\n * Skip it rather than restate the title in more words.\n */\n description?: ReactNode;\n\n className?: string;\n}\n\n/**\n * The title + description pair that sits above a settings block.\n *\n * It exists so there is exactly one of it. {@link SettingsSection} renders this\n * for the common case (a heading over a card of {@link SettingsRow}s), and a\n * page whose content is not a card of rows — a table, a list of invitations —\n * uses it directly instead of hand-rolling the markup.\n *\n * That hand-rolling is the failure this prevents, and it had already happened:\n * Lore's account pages grew an `<h2 className=\"text-base font-semibold\">`\n * on one page and a bare `<span className=\"text-xs\">` with no title at all on\n * another, so the `/account` rail led to three different type scales depending\n * on which entry you clicked. Nothing was broken and nothing could have failed\n * — it just read as three pages from three different applications.\n *\n * ⚠️ **No em dash in these strings.** House rule across every user-facing\n * string, in this component and everywhere else: use a comma, a semicolon, a\n * full stop, or split the sentence in two.\n */\nexport const SettingsHeading = (props: SettingsHeadingProps) => {\n if (props.title == null && props.description == null) return null;\n\n return (\n <div className={cn(\"flex flex-col gap-0.5\", props.className)}>\n {props.title != null ? (\n <span className=\"text-sm\">{props.title}</span>\n ) : null}\n {props.description != null ? (\n <span className=\"text-muted-foreground text-xs\">\n {props.description}\n </span>\n ) : null}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAa,mBAAmB,UAAgC;CAC9D,IAAI,MAAM,SAAS,QAAQ,MAAM,eAAe,MAAM,OAAO;CAE7D,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,yBAAyB,MAAM,SAAS;EAA3D,UAAA,CACG,MAAM,SAAS,OACd,oBAAC,QAAD;GAAM,WAAU;GAAW,UAAA,MAAM;EAAY,CAAA,IAC3C,MACH,MAAM,eAAe,OACpB,oBAAC,QAAD;GAAM,WAAU;GACb,UAAA,MAAM;EACH,CAAA,IACJ,IACD;;AAET"}
|
|
@@ -29,7 +29,7 @@ export interface SettingsSectionProps {
|
|
|
29
29
|
* `divide-y` land flush between rows.
|
|
30
30
|
*
|
|
31
31
|
* The rule is one or the other, never both — so do **not** "fix" this to a
|
|
32
|
-
* numeric `py-4` / `py-3`. Several pages in
|
|
32
|
+
* numeric `py-4` / `py-3`. Several pages in Lore's project settings did
|
|
33
33
|
* exactly that and they are the ones that look wrong next to these.
|
|
34
34
|
*/
|
|
35
35
|
export declare const SettingsSection: (props: SettingsSectionProps) => import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../core/utils.js";
|
|
2
2
|
import { Card } from "../core/Card.js";
|
|
3
|
-
import { settingsCardEdge } from "./settingsCardEdge.js";
|
|
4
3
|
import { SettingsHeading } from "./SettingsHeading.js";
|
|
4
|
+
import { settingsCardEdge } from "./settingsCardEdge.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/settings/SettingsSection.tsx
|
|
7
7
|
/**
|
|
@@ -16,7 +16,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
16
16
|
* `divide-y` land flush between rows.
|
|
17
17
|
*
|
|
18
18
|
* The rule is one or the other, never both — so do **not** "fix" this to a
|
|
19
|
-
* numeric `py-4` / `py-3`. Several pages in
|
|
19
|
+
* numeric `py-4` / `py-3`. Several pages in Lore's project settings did
|
|
20
20
|
* exactly that and they are the ones that look wrong next to these.
|
|
21
21
|
*/
|
|
22
22
|
const SettingsSection = (props) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsSection.js","names":[],"sources":["../../src/settings/SettingsSection.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport { Card } from \"../core/Card.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { settingsCardEdge } from \"./settingsCardEdge.ts\";\nimport { SettingsHeading } from \"./SettingsHeading.tsx\";\n\nexport interface SettingsSectionProps {\n /**\n * Heading above the card. Optional — a page whose first section needs no\n * heading (because the page title already says it) omits it.\n */\n title?: ReactNode;\n\n /**\n * One line under the title, for context the rows themselves should not\n * each repeat.\n */\n description?: ReactNode;\n\n /**\n * {@link SettingsRow}s. Anything else works too, but the divider and the\n * padding contract below assume rows.\n */\n children: ReactNode;\n\n className?: string;\n}\n\n/**\n * A titled group of settings rows in one bordered card — the GitHub-settings\n * shape.\n *\n * ⚠️ **The card is `py-0` and that is deliberate.** `Card` ships its own\n * vertical padding (`py-(--card-spacing)`), and every {@link SettingsRow}\n * brings `py-3`. Leave both on and the two stack into a visibly thick blank\n * band at the top and bottom of the card. `py-0` opts the card out so each\n * row's own padding is the only vertical space, which is also what makes\n * `divide-y` land flush between rows.\n *\n * The rule is one or the other, never both — so do **not** \"fix\" this to a\n * numeric `py-4` / `py-3`. Several pages in
|
|
1
|
+
{"version":3,"file":"SettingsSection.js","names":[],"sources":["../../src/settings/SettingsSection.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport { Card } from \"../core/Card.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { settingsCardEdge } from \"./settingsCardEdge.ts\";\nimport { SettingsHeading } from \"./SettingsHeading.tsx\";\n\nexport interface SettingsSectionProps {\n /**\n * Heading above the card. Optional — a page whose first section needs no\n * heading (because the page title already says it) omits it.\n */\n title?: ReactNode;\n\n /**\n * One line under the title, for context the rows themselves should not\n * each repeat.\n */\n description?: ReactNode;\n\n /**\n * {@link SettingsRow}s. Anything else works too, but the divider and the\n * padding contract below assume rows.\n */\n children: ReactNode;\n\n className?: string;\n}\n\n/**\n * A titled group of settings rows in one bordered card — the GitHub-settings\n * shape.\n *\n * ⚠️ **The card is `py-0` and that is deliberate.** `Card` ships its own\n * vertical padding (`py-(--card-spacing)`), and every {@link SettingsRow}\n * brings `py-3`. Leave both on and the two stack into a visibly thick blank\n * band at the top and bottom of the card. `py-0` opts the card out so each\n * row's own padding is the only vertical space, which is also what makes\n * `divide-y` land flush between rows.\n *\n * The rule is one or the other, never both — so do **not** \"fix\" this to a\n * numeric `py-4` / `py-3`. Several pages in Lore's project settings did\n * exactly that and they are the ones that look wrong next to these.\n */\nexport const SettingsSection = (props: SettingsSectionProps) => {\n return (\n <div className={cn(\"flex flex-col gap-2\", props.className)}>\n <SettingsHeading title={props.title} description={props.description} />\n <Card className={cn(settingsCardEdge, \"gap-0 divide-y py-0\")}>\n {props.children}\n </Card>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4CA,MAAa,mBAAmB,UAAgC;CAC9D,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,uBAAuB,MAAM,SAAS;EAAzD,UAAA,CACE,oBAAC,iBAAD;GAAiB,OAAO,MAAM;GAAO,aAAa,MAAM;EAAc,CAAA,GACtE,oBAAC,MAAD;GAAM,WAAW,GAAG,kBAAkB,qBAAqB;GACxD,UAAA,MAAM;EACH,CAAA,CACH;;AAET"}
|
package/dist/settings/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { SettingsHeading } from "./SettingsHeading.js";
|
|
1
2
|
import { SettingsRow } from "./SettingsRow.js";
|
|
2
3
|
import { settingsCardEdge } from "./settingsCardEdge.js";
|
|
3
|
-
import { SettingsHeading } from "./SettingsHeading.js";
|
|
4
4
|
import { SettingsSection } from "./SettingsSection.js";
|
|
5
|
+
import { SettingsDangerSection } from "./SettingsDangerSection.js";
|
|
5
6
|
import { SettingsLayout } from "./SettingsLayout.js";
|
|
6
7
|
import { SettingsNav } from "./SettingsNav.js";
|
|
7
|
-
import { SettingsDangerSection } from "./SettingsDangerSection.js";
|
|
8
8
|
export { SettingsDangerSection, SettingsHeading, SettingsLayout, SettingsNav, SettingsRow, SettingsSection, settingsCardEdge };
|
|
@@ -63,14 +63,14 @@ export interface AppActionsProps {
|
|
|
63
63
|
* The ambient controls as four buttons: language, theme, dark mode, account.
|
|
64
64
|
*
|
|
65
65
|
* ⚠️ **The kit's own shells no longer use it.** `AdminLayout`,
|
|
66
|
-
* `
|
|
66
|
+
* `AccountLayout` and Lore's header draw `ButtonSettings`, which folds
|
|
67
67
|
* the three settings into the account menu once signed in, and renders this
|
|
68
68
|
* same row with `placement="buttons"`.
|
|
69
69
|
*
|
|
70
70
|
* ### Why this is one component rather than four imports
|
|
71
71
|
*
|
|
72
72
|
* It was four imports, in three places — `AdminLayout`, `AccountLayout` and
|
|
73
|
-
*
|
|
73
|
+
* Lore's own header — and they had already drifted: admin rendered no
|
|
74
74
|
* theme switcher, and Lore's account menu pushed a route that no longer
|
|
75
75
|
* existed. A cluster that every shell rebuilds by hand is a cluster where
|
|
76
76
|
* each copy is one refactor away from being subtly wrong.
|
package/dist/shell/AppActions.js
CHANGED
|
@@ -11,14 +11,14 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
11
|
* The ambient controls as four buttons: language, theme, dark mode, account.
|
|
12
12
|
*
|
|
13
13
|
* ⚠️ **The kit's own shells no longer use it.** `AdminLayout`,
|
|
14
|
-
* `
|
|
14
|
+
* `AccountLayout` and Lore's header draw `ButtonSettings`, which folds
|
|
15
15
|
* the three settings into the account menu once signed in, and renders this
|
|
16
16
|
* same row with `placement="buttons"`.
|
|
17
17
|
*
|
|
18
18
|
* ### Why this is one component rather than four imports
|
|
19
19
|
*
|
|
20
20
|
* It was four imports, in three places — `AdminLayout`, `AccountLayout` and
|
|
21
|
-
*
|
|
21
|
+
* Lore's own header — and they had already drifted: admin rendered no
|
|
22
22
|
* theme switcher, and Lore's account menu pushed a route that no longer
|
|
23
23
|
* existed. A cluster that every shell rebuilds by hand is a cluster where
|
|
24
24
|
* each copy is one refactor away from being subtly wrong.
|
|
@@ -54,15 +54,15 @@ const AppActions = (props) => {
|
|
|
54
54
|
className: cn(props.compact ? "hidden sm:contents" : "contents"),
|
|
55
55
|
children: [
|
|
56
56
|
/* @__PURE__ */ jsx(ButtonLanguage, {
|
|
57
|
-
variant: "
|
|
57
|
+
variant: "minimal",
|
|
58
58
|
label: props.labels?.language
|
|
59
59
|
}),
|
|
60
|
-
/* @__PURE__ */ jsx(ButtonTheme, { variant: "
|
|
61
|
-
/* @__PURE__ */ jsx(ButtonDark, { variant: "
|
|
60
|
+
/* @__PURE__ */ jsx(ButtonTheme, { variant: "minimal" }),
|
|
61
|
+
/* @__PURE__ */ jsx(ButtonDark, { variant: "minimal" })
|
|
62
62
|
]
|
|
63
63
|
}),
|
|
64
64
|
/* @__PURE__ */ jsxs(ButtonUser, {
|
|
65
|
-
variant: "
|
|
65
|
+
variant: "minimal",
|
|
66
66
|
avatar: props.avatar,
|
|
67
67
|
signInLabel: props.labels?.signIn,
|
|
68
68
|
onSignIn: () => router.push(props.loginRouteName ?? "login"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppActions.js","names":[],"sources":["../../src/shell/AppActions.tsx"],"sourcesContent":["import { useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\nimport { DropdownMenuSeparator } from \"../core/DropdownMenu.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { ButtonDark } from \"./ButtonDark.tsx\";\nimport { ButtonLanguage } from \"./ButtonLanguage.tsx\";\nimport { ButtonTheme } from \"./ButtonTheme.tsx\";\nimport { ButtonUser } from \"./ButtonUser.tsx\";\n\nexport interface AppActionsProps {\n /**\n * Extra menu items appended to the account dropdown, below the built-ins\n * and above Logout. For an application-specific destination — \"My orders\",\n * \"Billing\" — that belongs with the account rather than in the page chrome.\n */\n children?: ReactNode;\n\n /**\n * Rendered to the left of the cluster: a search trigger, a create button,\n * anything the surface wants adjacent to these controls.\n */\n before?: ReactNode;\n\n /**\n * Route name pushed by the \"Admin Panel\" item. The item is hidden anyway\n * unless the viewer holds `admin:ui`.\n *\n * @default \"admin\"\n */\n adminRouteName?: string;\n\n /**\n * Route name pushed by the signed-out state's sign-in button.\n *\n * @default \"login\"\n */\n loginRouteName?: string;\n\n /**\n * Labels, for an application that localises its chrome. Omitted entries\n * fall back to each button's own English default.\n */\n labels?: {\n language?: string;\n signIn?: string;\n admin?: string;\n account?: string;\n logout?: string;\n };\n\n /**\n * Forwarded to {@link ButtonUser.avatar}: overrides what the signed-in\n * account button shows. Absent, the button draws the viewer's own picture\n * when they have one and the generic glyph when they do not.\n */\n avatar?: ReactNode;\n\n /**\n * Below `sm`, drop the three ambient SETTINGS controls - language, theme\n * and dark mode - and keep only the account button.\n *\n * ⚠️ **Opt-in, and it has to be.** On a phone this cluster is most of the\n * header and half of it is settings a reader changes about once\n * (feedback #P2144), but hidden must never mean unreachable. So a surface\n * passes this only when another surface still offers them. `ButtonSettings`\n * is the other answer: it moves them into the account menu instead of\n * hiding them.\n *\n * A responsive class rather than a media-query hook, deliberately: a hook\n * re-renders after mount, and on a server-rendered header that means the\n * buttons paint and then vanish.\n */\n compact?: boolean;\n\n className?: string;\n}\n\n/**\n * The ambient controls as four buttons: language, theme, dark mode, account.\n *\n * ⚠️ **The kit's own shells no longer use it.** `AdminLayout`,\n * `
|
|
1
|
+
{"version":3,"file":"AppActions.js","names":[],"sources":["../../src/shell/AppActions.tsx"],"sourcesContent":["import { useRouter } from \"alepha/react/router\";\nimport type { ReactNode } from \"react\";\n\nimport { DropdownMenuSeparator } from \"../core/DropdownMenu.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { ButtonDark } from \"./ButtonDark.tsx\";\nimport { ButtonLanguage } from \"./ButtonLanguage.tsx\";\nimport { ButtonTheme } from \"./ButtonTheme.tsx\";\nimport { ButtonUser } from \"./ButtonUser.tsx\";\n\nexport interface AppActionsProps {\n /**\n * Extra menu items appended to the account dropdown, below the built-ins\n * and above Logout. For an application-specific destination — \"My orders\",\n * \"Billing\" — that belongs with the account rather than in the page chrome.\n */\n children?: ReactNode;\n\n /**\n * Rendered to the left of the cluster: a search trigger, a create button,\n * anything the surface wants adjacent to these controls.\n */\n before?: ReactNode;\n\n /**\n * Route name pushed by the \"Admin Panel\" item. The item is hidden anyway\n * unless the viewer holds `admin:ui`.\n *\n * @default \"admin\"\n */\n adminRouteName?: string;\n\n /**\n * Route name pushed by the signed-out state's sign-in button.\n *\n * @default \"login\"\n */\n loginRouteName?: string;\n\n /**\n * Labels, for an application that localises its chrome. Omitted entries\n * fall back to each button's own English default.\n */\n labels?: {\n language?: string;\n signIn?: string;\n admin?: string;\n account?: string;\n logout?: string;\n };\n\n /**\n * Forwarded to {@link ButtonUser.avatar}: overrides what the signed-in\n * account button shows. Absent, the button draws the viewer's own picture\n * when they have one and the generic glyph when they do not.\n */\n avatar?: ReactNode;\n\n /**\n * Below `sm`, drop the three ambient SETTINGS controls - language, theme\n * and dark mode - and keep only the account button.\n *\n * ⚠️ **Opt-in, and it has to be.** On a phone this cluster is most of the\n * header and half of it is settings a reader changes about once\n * (feedback #P2144), but hidden must never mean unreachable. So a surface\n * passes this only when another surface still offers them. `ButtonSettings`\n * is the other answer: it moves them into the account menu instead of\n * hiding them.\n *\n * A responsive class rather than a media-query hook, deliberately: a hook\n * re-renders after mount, and on a server-rendered header that means the\n * buttons paint and then vanish.\n */\n compact?: boolean;\n\n className?: string;\n}\n\n/**\n * The ambient controls as four buttons: language, theme, dark mode, account.\n *\n * ⚠️ **The kit's own shells no longer use it.** `AdminLayout`,\n * `AccountLayout` and Lore's header draw `ButtonSettings`, which folds\n * the three settings into the account menu once signed in, and renders this\n * same row with `placement=\"buttons\"`.\n *\n * ### Why this is one component rather than four imports\n *\n * It was four imports, in three places — `AdminLayout`, `AccountLayout` and\n * Lore's own header — and they had already drifted: admin rendered no\n * theme switcher, and Lore's account menu pushed a route that no longer\n * existed. A cluster that every shell rebuilds by hand is a cluster where\n * each copy is one refactor away from being subtly wrong.\n *\n * ### Each button decides whether it has anything to offer\n *\n * There is no \"show the language switcher?\" prop, and there should not be:\n * `ButtonLanguage` and `ButtonTheme` already return `null` at one or fewer\n * options, reading the real registry rather than a flag a caller has to keep\n * in sync. So an application with a single locale and a single theme renders\n * exactly two controls here, and gains the others the day it registers a\n * second — with no change at any call site.\n *\n * `ButtonUser` likewise renders a sign-in button when signed out and the\n * account menu when signed in, and `ButtonUser.AccountMenuItem` hides itself\n * when no `account` route is mounted.\n *\n * ### What it deliberately does not include\n *\n * Search. `AdminLayout` keeps its ⌘K trigger outside this cluster because the\n * Spotlight open-state is local to that layout, so a shared component could\n * never own it — and Lore's own search is a field-sized element that reads as\n * a different kind of control next to four icons. Pass it via `before` when a\n * surface wants it adjacent.\n */\nexport const AppActions = (props: AppActionsProps) => {\n const router = useRouter<any>();\n\n return (\n <div className={cn(\"flex items-center gap-1\", props.className)}>\n {props.before}\n {/* `contents` so the three stay direct children of the flex row and\n keep its `gap-1`; `hidden` wins over `display: contents`, which is\n what makes the whole group disappear below the breakpoint. */}\n <div className={cn(props.compact ? \"hidden sm:contents\" : \"contents\")}>\n <ButtonLanguage variant=\"minimal\" label={props.labels?.language} />\n <ButtonTheme variant=\"minimal\" />\n <ButtonDark variant=\"minimal\" />\n </div>\n <ButtonUser\n variant=\"minimal\"\n avatar={props.avatar}\n signInLabel={props.labels?.signIn}\n onSignIn={() => router.push(props.loginRouteName ?? \"login\")}\n >\n <ButtonUser.Email />\n {/* Account before admin — see `ButtonUser`'s `DefaultMenu` for why. */}\n <ButtonUser.AccountMenuItem label={props.labels?.account} />\n {/*\n `routeName`, not `onClick`: both of these are destinations, so they\n render as real anchors and keep ⌘-click and open-in-new-tab.\n */}\n <ButtonUser.AdminMenuItem\n label={props.labels?.admin}\n routeName={props.adminRouteName}\n />\n {props.children}\n <DropdownMenuSeparator />\n <ButtonUser.LogoutMenuItem label={props.labels?.logout} />\n </ButtonUser>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAa,cAAc,UAA2B;CACpD,MAAM,SAAS,UAAe;CAE9B,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,2BAA2B,MAAM,SAAS;EAA7D,UAAA;GACG,MAAM;GAIP,qBAAC,OAAD;IAAK,WAAW,GAAG,MAAM,UAAU,uBAAuB,UAAU;IAApE,UAAA;KACE,oBAAC,gBAAD;MAAgB,SAAQ;MAAU,OAAO,MAAM,QAAQ;KAAW,CAAA;KAClE,oBAAC,aAAD,EAAa,SAAQ,UAAW,CAAA;KAChC,oBAAC,YAAD,EAAY,SAAQ,UAAW,CAAA;IAC5B;;GACL,qBAAC,YAAD;IACE,SAAQ;IACR,QAAQ,MAAM;IACd,aAAa,MAAM,QAAQ;IAC3B,gBAAgB,OAAO,KAAK,MAAM,kBAAkB,OAAO;IAJ7D,UAAA;KAME,oBAAC,WAAW,OAAZ,CAAmB,CAAA;KAEnB,oBAAC,WAAW,iBAAZ,EAA4B,OAAO,MAAM,QAAQ,QAAU,CAAA;KAK3D,oBAAC,WAAW,eAAZ;MACE,OAAO,MAAM,QAAQ;MACrB,WAAW,MAAM;KAClB,CAAA;KACA,MAAM;KACP,oBAAC,uBAAD,CAAwB,CAAA;KACxB,oBAAC,WAAW,gBAAZ,EAA2B,OAAO,MAAM,QAAQ,OAAS,CAAA;IAC/C;;EACT;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShellSidebarNavItem.d.ts","sourceRoot":"","sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,OAAO,EAEb,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,OAAO,GAAG,WAAW,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,UAAW,2BAA2B,
|
|
1
|
+
{"version":3,"file":"AppShellSidebarNavItem.d.ts","sourceRoot":"","sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8B/B,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,OAAO,EAEb,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd;;;OAGG;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,OAAO,GAAG,WAAW,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,UAAW,2BAA2B,sBA8NxE,CAAC"}
|
|
@@ -52,7 +52,10 @@ const AppShellSidebarNavItem = (props) => {
|
|
|
52
52
|
const link = /* @__PURE__ */ jsxs(SidebarMenuButton, {
|
|
53
53
|
isActive: item.active,
|
|
54
54
|
tooltip: typeof item.label === "string" ? item.label : void 0,
|
|
55
|
-
render: /* @__PURE__ */ jsx(Link, {
|
|
55
|
+
render: /* @__PURE__ */ jsx(Link, {
|
|
56
|
+
href: item.href ?? "#",
|
|
57
|
+
"aria-current": item.active ? "page" : void 0
|
|
58
|
+
}),
|
|
56
59
|
children: [renderNavIcon(item.icon, "size-4"), /* @__PURE__ */ jsx("span", { children: item.label })]
|
|
57
60
|
});
|
|
58
61
|
const row = item.tooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: link }), /* @__PURE__ */ jsx(TooltipContent, {
|
|
@@ -100,7 +103,10 @@ const AppShellSidebarNavItem = (props) => {
|
|
|
100
103
|
toggleIcon
|
|
101
104
|
}) : /* @__PURE__ */ jsxs(SidebarMenuSubButton, {
|
|
102
105
|
isActive: child.active,
|
|
103
|
-
render: /* @__PURE__ */ jsx(Link, {
|
|
106
|
+
render: /* @__PURE__ */ jsx(Link, {
|
|
107
|
+
href: child.href ?? "#",
|
|
108
|
+
"aria-current": child.active ? "page" : void 0
|
|
109
|
+
}),
|
|
104
110
|
children: [renderNavIcon(child.icon, "size-4"), /* @__PURE__ */ jsx("span", { children: child.label })]
|
|
105
111
|
}) }, child.href ?? ci)) })
|
|
106
112
|
})] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShellSidebarNavItem.js","names":[],"sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Link } from \"alepha/react/router\";\nimport { ChevronRight, Lock, Minus, Plus } from \"lucide-react\";\nimport { useState } from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"../core/HoverCard.tsx\";\nimport {\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n useSidebar,\n} from \"../core/Sidebar.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport {\n hasActiveDescendant,\n isOpenPathPrefix,\n type NavAccordion,\n type NavItem,\n renderNavIcon,\n} from \"./appShellNav.tsx\";\nimport { AppShellNavCollapse } from \"./AppShellNavCollapse.tsx\";\nimport { AppShellNavDropdownItems } from \"./AppShellNavDropdownItems.tsx\";\n\nexport interface AppShellSidebarNavItemProps {\n item: NavItem;\n /**\n * This item's position in `nav`, used only by the accordion. See\n * {@link NavAccordion}.\n */\n path: number[];\n /**\n * Present when `navAccordion` is on, and then it OWNS the open state: the\n * local `useState` below is still declared (hooks cannot be conditional) but\n * nothing reads it.\n */\n accordion?: NavAccordion;\n /**\n * `navAnimate`, threaded down so a nested group animates like its parent.\n */\n animate: boolean;\n /**\n * `navToggleIcon`, threaded down for the same reason.\n */\n toggleIcon: \"caret\" | \"plusMinus\";\n}\n\nexport const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {\n const { item, path, accordion, animate, toggleIcon } = props;\n const { state, isMobile } = useSidebar();\n const children = item.children;\n const isGroup = !!children && children.length > 0;\n const hasActive = isGroup && hasActiveDescendant(item);\n const [localOpen, setLocalOpen] = useState(item.defaultOpen ?? hasActive);\n // Reveal a collapsed group when navigation makes one of its descendants\n // active — SPA nav, spotlight (⌘K), breadcrumb, or a deep-link that doesn't\n // remount this item (useState's initializer runs only at mount, so without\n // this the group stays stuck closed and the active page is hidden — petition\n // #4). Only OPENS; never auto-collapses, so a manual toggle is preserved.\n //\n // Accordion mode does the same job in `AppShell` instead, from the tree, and\n // skips this: the state lives there, and a child cannot write it mid-render.\n const [wasActive, setWasActive] = useState(hasActive);\n if (!accordion && hasActive !== wasActive) {\n setWasActive(hasActive);\n if (hasActive) setLocalOpen(true);\n }\n\n const open = accordion\n ? isOpenPathPrefix(path, accordion.openPath)\n : localOpen;\n\n // Closing means handing the branch back to this item's PARENT, not clearing\n // it: a nested group that closed itself by emptying the path would collapse\n // every ancestor along with it.\n const toggle = () => {\n if (accordion) {\n accordion.setOpenPath(open ? path.slice(0, -1) : path);\n } else {\n setLocalOpen((v) => !v);\n }\n };\n\n if (!isGroup) {\n // Disabled rows render with a muted, dashed-border treatment plus a\n // Lock affordance on the trailing edge. Clicks are swallowed. When a\n // `tooltip` is provided, the row opens a HoverCard dropdown on hover\n // so the explanation has space to breathe regardless of sidebar\n // state.\n if (item.disabled) {\n // Bypass SidebarMenuButton — it self-wraps in a Tooltip when given\n // a `tooltip` prop, which would swallow the HoverCard pointer\n // events. A plain styled <div> keeps cursor-not-allowed and lets\n // the row act as the HoverCard trigger.\n const row = (\n <div\n aria-disabled=\"true\"\n className=\"border-muted-foreground/40 bg-muted/40 text-muted-foreground flex h-8 w-full items-center gap-2 rounded-md border border-dashed px-2 text-sm\"\n style={{ cursor: \"not-allowed\" }}\n >\n {renderNavIcon(item.icon, \"size-4 shrink-0\")}\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n <Lock className=\"size-3.5 shrink-0 opacity-70\" />\n </div>\n );\n return (\n <SidebarMenuItem>\n {item.tooltip ? (\n <HoverCard>\n <HoverCardTrigger render={row} />\n <HoverCardContent side=\"right\" align=\"start\" className=\"text-sm\">\n {item.tooltip}\n </HoverCardContent>\n </HoverCard>\n ) : (\n row\n )}\n </SidebarMenuItem>\n );\n }\n\n const link = (\n <SidebarMenuButton\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n render={<Link href={item.href ?? \"#\"} />}\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span>{item.label}</span>\n </SidebarMenuButton>\n );\n\n const row = item.tooltip ? (\n <Tooltip>\n <TooltipTrigger render={link} />\n <TooltipContent side=\"right\">{item.tooltip}</TooltipContent>\n </Tooltip>\n ) : (\n link\n );\n\n return (\n <SidebarMenuItem>\n {row}\n {item.badge != null && item.badge !== false && (\n <SidebarMenuBadge>{item.badge}</SidebarMenuBadge>\n )}\n </SidebarMenuItem>\n );\n }\n\n // Collapsed to icons, the expanded branch below is a dead button: it still\n // flips `open`, but what `open` reveals is a `SidebarMenuSub`, which carries\n // `group-data-[collapsible=icon]:hidden`. The group has no `href` either, so\n // there is no fallback — every child is simply unreachable. A dropdown is the\n // standard answer, and it belongs here rather than in any one app because\n // this hits EVERY `NavItem` with children.\n //\n // Mobile is excluded: it uses the sheet, not icon mode, so the sub renders\n // normally there.\n if (isGroup && state === \"collapsed\" && !isMobile) {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n // No `tooltip` here on purpose. `SidebarMenuButton` turns itself\n // into a `TooltipTrigger` when given one, and layering the\n // dropdown trigger on top makes hover and click fight over the\n // same element. The menu names itself with a label instead.\n //\n // `hasActive` joins `item.active` so the trigger still reads as\n // current when a descendant is — collapsed, it is the only clue\n // which group holds the open page.\n <SidebarMenuButton isActive={item.active || hasActive} />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-left\">{item.label}</span>\n <ChevronRight className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"right\" align=\"start\" className=\"min-w-48\">\n {/*\n The group wrapper is required, not cosmetic: `DropdownMenuLabel`\n is Base UI's `Menu.GroupLabel`, which reads `MenuGroupContext` and\n THROWS outside a `Menu.Group`. Nothing types this — the label\n compiles fine, and the whole app-shell crashes at the first click\n on the trigger, because the throw happens when the menu opens\n rather than when it mounts.\n */}\n <DropdownMenuGroup>\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n <AppShellNavDropdownItems items={children} />\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n );\n }\n\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={toggle}\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-left\">{item.label}</span>\n {/*\n Plus and minus are SWAPPED, never rotated: a plus turned 45° is a\n close button, which is a different promise. The caret is the one\n that turns, and it stays the default because it is what every app\n using this shell already had.\n */}\n {toggleIcon === \"plusMinus\" ? (\n open ? (\n <Minus className=\"size-4\" />\n ) : (\n <Plus className=\"size-4\" />\n )\n ) : (\n <ChevronRight\n className={`size-4 transition-transform ${open ? \"rotate-90\" : \"\"}`}\n />\n )}\n </SidebarMenuButton>\n <AppShellNavCollapse open={open} animate={animate}>\n <SidebarMenuSub>\n {children.map((child, ci) => (\n <SidebarMenuSubItem key={child.href ?? ci}>\n {child.children && child.children.length > 0 ? (\n <AppShellSidebarNavItem\n item={child}\n path={[...path, ci]}\n accordion={accordion}\n animate={animate}\n toggleIcon={toggleIcon}\n />\n ) : (\n <SidebarMenuSubButton\n isActive={child.active}\n render={<Link href={child.href ?? \"#\"} />}\n >\n {renderNavIcon(child.icon, \"size-4\")}\n <span>{child.label}</span>\n </SidebarMenuSubButton>\n )}\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n </AppShellNavCollapse>\n </SidebarMenuItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA+DA,MAAa,0BAA0B,UAAuC;CAC5E,MAAM,EAAE,MAAM,MAAM,WAAW,SAAS,eAAe;CACvD,MAAM,EAAE,OAAO,aAAa,WAAW;CACvC,MAAM,WAAW,KAAK;CACtB,MAAM,UAAU,CAAC,CAAC,YAAY,SAAS,SAAS;CAChD,MAAM,YAAY,WAAW,oBAAoB,IAAI;CACrD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK,eAA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,WAAW,+BAA+B,OAAO,cAAc,KAChE,CAAA;EAEc;CACnB,CAAA,GAAA,oBAAC,qBAAD;EAA2B;EAAe;EACxC,UAAA,oBAAC,gBAAD,EAAA,UACG,SAAS,KAAK,OAAO,OACpB,oBAAC,oBAAD,EAAA,UACG,MAAM,YAAY,MAAM,SAAS,SAAS,IACzC,oBAAC,wBAAD;GACE,MAAM;GACN,MAAM,CAAC,GAAG,MAAM,EAAE;GACP;GACF;GACG;EACb,CAAA,IAED,qBAAC,sBAAD;GACE,UAAU,MAAM;GAChB,QAAQ,oBAAC,MAAD,EAAM,MAAM,MAAM,QAAQ,IAAM,CAAA;GAF1C,UAAA,CAIG,cAAc,MAAM,MAAM,QAAQ,GACnC,oBAAC,QAAD,EAAA,UAAO,MAAM,MAAY,CAAA,CACL;EAEN,CAAA,EAAA,GAlBK,MAAM,QAAQ,EAkBnB,CACrB,EACa,CAAA;CACG,CAAA,CACN,EAAA,CAAA;AAErB"}
|
|
1
|
+
{"version":3,"file":"AppShellSidebarNavItem.js","names":[],"sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Link } from \"alepha/react/router\";\nimport { ChevronRight, Lock, Minus, Plus } from \"lucide-react\";\nimport { useState } from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"../core/HoverCard.tsx\";\nimport {\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n useSidebar,\n} from \"../core/Sidebar.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport {\n hasActiveDescendant,\n isOpenPathPrefix,\n type NavAccordion,\n type NavItem,\n renderNavIcon,\n} from \"./appShellNav.tsx\";\nimport { AppShellNavCollapse } from \"./AppShellNavCollapse.tsx\";\nimport { AppShellNavDropdownItems } from \"./AppShellNavDropdownItems.tsx\";\n\nexport interface AppShellSidebarNavItemProps {\n item: NavItem;\n /**\n * This item's position in `nav`, used only by the accordion. See\n * {@link NavAccordion}.\n */\n path: number[];\n /**\n * Present when `navAccordion` is on, and then it OWNS the open state: the\n * local `useState` below is still declared (hooks cannot be conditional) but\n * nothing reads it.\n */\n accordion?: NavAccordion;\n /**\n * `navAnimate`, threaded down so a nested group animates like its parent.\n */\n animate: boolean;\n /**\n * `navToggleIcon`, threaded down for the same reason.\n */\n toggleIcon: \"caret\" | \"plusMinus\";\n}\n\nexport const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {\n const { item, path, accordion, animate, toggleIcon } = props;\n const { state, isMobile } = useSidebar();\n const children = item.children;\n const isGroup = !!children && children.length > 0;\n const hasActive = isGroup && hasActiveDescendant(item);\n const [localOpen, setLocalOpen] = useState(item.defaultOpen ?? hasActive);\n // Reveal a collapsed group when navigation makes one of its descendants\n // active — SPA nav, spotlight (⌘K), breadcrumb, or a deep-link that doesn't\n // remount this item (useState's initializer runs only at mount, so without\n // this the group stays stuck closed and the active page is hidden — petition\n // #4). Only OPENS; never auto-collapses, so a manual toggle is preserved.\n //\n // Accordion mode does the same job in `AppShell` instead, from the tree, and\n // skips this: the state lives there, and a child cannot write it mid-render.\n const [wasActive, setWasActive] = useState(hasActive);\n if (!accordion && hasActive !== wasActive) {\n setWasActive(hasActive);\n if (hasActive) setLocalOpen(true);\n }\n\n const open = accordion\n ? isOpenPathPrefix(path, accordion.openPath)\n : localOpen;\n\n // Closing means handing the branch back to this item's PARENT, not clearing\n // it: a nested group that closed itself by emptying the path would collapse\n // every ancestor along with it.\n const toggle = () => {\n if (accordion) {\n accordion.setOpenPath(open ? path.slice(0, -1) : path);\n } else {\n setLocalOpen((v) => !v);\n }\n };\n\n if (!isGroup) {\n // Disabled rows render with a muted, dashed-border treatment plus a\n // Lock affordance on the trailing edge. Clicks are swallowed. When a\n // `tooltip` is provided, the row opens a HoverCard dropdown on hover\n // so the explanation has space to breathe regardless of sidebar\n // state.\n if (item.disabled) {\n // Bypass SidebarMenuButton — it self-wraps in a Tooltip when given\n // a `tooltip` prop, which would swallow the HoverCard pointer\n // events. A plain styled <div> keeps cursor-not-allowed and lets\n // the row act as the HoverCard trigger.\n const row = (\n <div\n aria-disabled=\"true\"\n className=\"border-muted-foreground/40 bg-muted/40 text-muted-foreground flex h-8 w-full items-center gap-2 rounded-md border border-dashed px-2 text-sm\"\n style={{ cursor: \"not-allowed\" }}\n >\n {renderNavIcon(item.icon, \"size-4 shrink-0\")}\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n <Lock className=\"size-3.5 shrink-0 opacity-70\" />\n </div>\n );\n return (\n <SidebarMenuItem>\n {item.tooltip ? (\n <HoverCard>\n <HoverCardTrigger render={row} />\n <HoverCardContent side=\"right\" align=\"start\" className=\"text-sm\">\n {item.tooltip}\n </HoverCardContent>\n </HoverCard>\n ) : (\n row\n )}\n </SidebarMenuItem>\n );\n }\n\n const link = (\n <SidebarMenuButton\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n /*\n `aria-current` beside the styling's `data-active`, so a screen\n reader announces the page the reader is on, and a test can find the\n lit entry by role rather than by a styling hook.\n */\n render={\n <Link\n href={item.href ?? \"#\"}\n aria-current={item.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span>{item.label}</span>\n </SidebarMenuButton>\n );\n\n const row = item.tooltip ? (\n <Tooltip>\n <TooltipTrigger render={link} />\n <TooltipContent side=\"right\">{item.tooltip}</TooltipContent>\n </Tooltip>\n ) : (\n link\n );\n\n return (\n <SidebarMenuItem>\n {row}\n {item.badge != null && item.badge !== false && (\n <SidebarMenuBadge>{item.badge}</SidebarMenuBadge>\n )}\n </SidebarMenuItem>\n );\n }\n\n // Collapsed to icons, the expanded branch below is a dead button: it still\n // flips `open`, but what `open` reveals is a `SidebarMenuSub`, which carries\n // `group-data-[collapsible=icon]:hidden`. The group has no `href` either, so\n // there is no fallback — every child is simply unreachable. A dropdown is the\n // standard answer, and it belongs here rather than in any one app because\n // this hits EVERY `NavItem` with children.\n //\n // Mobile is excluded: it uses the sheet, not icon mode, so the sub renders\n // normally there.\n if (isGroup && state === \"collapsed\" && !isMobile) {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n // No `tooltip` here on purpose. `SidebarMenuButton` turns itself\n // into a `TooltipTrigger` when given one, and layering the\n // dropdown trigger on top makes hover and click fight over the\n // same element. The menu names itself with a label instead.\n //\n // `hasActive` joins `item.active` so the trigger still reads as\n // current when a descendant is — collapsed, it is the only clue\n // which group holds the open page.\n <SidebarMenuButton isActive={item.active || hasActive} />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-left\">{item.label}</span>\n <ChevronRight className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"right\" align=\"start\" className=\"min-w-48\">\n {/*\n The group wrapper is required, not cosmetic: `DropdownMenuLabel`\n is Base UI's `Menu.GroupLabel`, which reads `MenuGroupContext` and\n THROWS outside a `Menu.Group`. Nothing types this — the label\n compiles fine, and the whole app-shell crashes at the first click\n on the trigger, because the throw happens when the menu opens\n rather than when it mounts.\n */}\n <DropdownMenuGroup>\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n <AppShellNavDropdownItems items={children} />\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n );\n }\n\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={toggle}\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-left\">{item.label}</span>\n {/*\n Plus and minus are SWAPPED, never rotated: a plus turned 45° is a\n close button, which is a different promise. The caret is the one\n that turns, and it stays the default because it is what every app\n using this shell already had.\n */}\n {toggleIcon === \"plusMinus\" ? (\n open ? (\n <Minus className=\"size-4\" />\n ) : (\n <Plus className=\"size-4\" />\n )\n ) : (\n <ChevronRight\n className={`size-4 transition-transform ${open ? \"rotate-90\" : \"\"}`}\n />\n )}\n </SidebarMenuButton>\n <AppShellNavCollapse open={open} animate={animate}>\n <SidebarMenuSub>\n {children.map((child, ci) => (\n <SidebarMenuSubItem key={child.href ?? ci}>\n {child.children && child.children.length > 0 ? (\n <AppShellSidebarNavItem\n item={child}\n path={[...path, ci]}\n accordion={accordion}\n animate={animate}\n toggleIcon={toggleIcon}\n />\n ) : (\n <SidebarMenuSubButton\n isActive={child.active}\n render={\n <Link\n href={child.href ?? \"#\"}\n aria-current={child.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(child.icon, \"size-4\")}\n <span>{child.label}</span>\n </SidebarMenuSubButton>\n )}\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n </AppShellNavCollapse>\n </SidebarMenuItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA+DA,MAAa,0BAA0B,UAAuC;CAC5E,MAAM,EAAE,MAAM,MAAM,WAAW,SAAS,eAAe;CACvD,MAAM,EAAE,OAAO,aAAa,WAAW;CACvC,MAAM,WAAW,KAAK;CACtB,MAAM,UAAU,CAAC,CAAC,YAAY,SAAS,SAAS;CAChD,MAAM,YAAY,WAAW,oBAAoB,IAAI;CACrD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK,eAAe,SAAS;CASxE,MAAM,CAAC,WAAW,gBAAgB,SAAS,SAAS;CACpD,IAAI,CAAC,aAAa,cAAc,WAAW;EACzC,aAAa,SAAS;EACtB,IAAI,WAAW,aAAa,IAAI;CAClC;CAEA,MAAM,OAAO,YACT,iBAAiB,MAAM,UAAU,QAAQ,IACzC;CAKJ,MAAM,eAAe;EACnB,IAAI,WACF,UAAU,YAAY,OAAO,KAAK,MAA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ACE,MAAM;GACN,MAAM,CAAC,GAAG,MAAM,EAAE;GACP;GACF;GACG;EACb,CAAA,IAED,qBAAC,sBAAD;GACE,UAAU,MAAM;GAChB,QACE,oBAAC,MAAD;IACE,MAAM,MAAM,QAAQ;IACpB,gBAAc,MAAM,SAAS,SAAS,KAAA;GACvC,CAAA;GANL,UAAA,CASG,cAAc,MAAM,MAAM,QAAQ,GACnC,oBAAC,QAAD,EAAA,UAAO,MAAM,MAAY,CAAA,CACL;EAEN,CAAA,EAAA,GAvBK,MAAM,QAAQ,EAuBnB,CACrB,EACa,CAAA;CACG,CAAA,CACN,EAAA,CAAA;AAErB"}
|
|
@@ -8,7 +8,7 @@ const AppShellStatefulSidebarTrigger = () => {
|
|
|
8
8
|
const { toggleSidebar, isMobile, openMobile, state } = useSidebar();
|
|
9
9
|
const open = isMobile ? openMobile : state === "expanded";
|
|
10
10
|
return /* @__PURE__ */ jsx(Button, {
|
|
11
|
-
variant: "
|
|
11
|
+
variant: "minimal",
|
|
12
12
|
size: "icon",
|
|
13
13
|
onClick: toggleSidebar,
|
|
14
14
|
"aria-label": open ? "Collapse sidebar" : "Expand sidebar",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShellStatefulSidebarTrigger.js","names":[],"sources":["../../src/shell/AppShellStatefulSidebarTrigger.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { PanelLeftClose, PanelLeftOpen } from \"lucide-react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { useSidebar } from \"../core/Sidebar.tsx\";\n\nexport const AppShellStatefulSidebarTrigger = () => {\n const { toggleSidebar, isMobile, openMobile, state } = useSidebar();\n const open = isMobile ? openMobile : state === \"expanded\";\n const Icon = open ? PanelLeftClose : PanelLeftOpen;\n return (\n <Button\n variant=\"
|
|
1
|
+
{"version":3,"file":"AppShellStatefulSidebarTrigger.js","names":[],"sources":["../../src/shell/AppShellStatefulSidebarTrigger.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { PanelLeftClose, PanelLeftOpen } from \"lucide-react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { useSidebar } from \"../core/Sidebar.tsx\";\n\nexport const AppShellStatefulSidebarTrigger = () => {\n const { toggleSidebar, isMobile, openMobile, state } = useSidebar();\n const open = isMobile ? openMobile : state === \"expanded\";\n const Icon = open ? PanelLeftClose : PanelLeftOpen;\n return (\n <Button\n variant=\"minimal\"\n size=\"icon\"\n onClick={toggleSidebar}\n aria-label={open ? \"Collapse sidebar\" : \"Expand sidebar\"}\n className=\"size-8\"\n >\n <Icon className=\"size-4\" />\n </Button>\n );\n};\n"],"mappings":";;;;;;AASA,MAAa,uCAAuC;CAClD,MAAM,EAAE,eAAe,UAAU,YAAY,UAAU,WAAW;CAClE,MAAM,OAAO,WAAW,aAAa,UAAU;CAE/C,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,SAAS;EACT,cAAY,OAAO,qBAAqB;EACxC,WAAU;EAEV,UAAA,oBATS,OAAO,iBAAiB,eASjC,EAAM,WAAU,SAAU,CAAA;CACpB,CAAA;AAEZ"}
|
|
@@ -11,10 +11,10 @@ export interface ButtonDarkProps {
|
|
|
11
11
|
*/
|
|
12
12
|
withSystem?: boolean;
|
|
13
13
|
/**
|
|
14
|
-
* Visual variant. Defaults to `"
|
|
14
|
+
* Visual variant. Defaults to `"minimal"`. Pass `"outlined"` for a
|
|
15
15
|
* bordered toolbar look.
|
|
16
16
|
*/
|
|
17
|
-
variant?: "
|
|
17
|
+
variant?: "minimal" | "outlined";
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Color-mode toggle. Default is a two-state Sun ↔ Moon flip; opt into the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonDark.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonDark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ButtonDark.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonDark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CAClC;AAsDD;;;;GAIG;AACH,eAAO,MAAM,UAAU,UAAW,eAAe,sBA2BhD,CAAC"}
|
package/dist/shell/ButtonDark.js
CHANGED
|
@@ -61,7 +61,7 @@ const ButtonDark = (props) => {
|
|
|
61
61
|
const label = props.label ?? "Toggle color mode";
|
|
62
62
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
63
63
|
render: /* @__PURE__ */ jsx(Button, {
|
|
64
|
-
variant: props.variant ?? "
|
|
64
|
+
variant: props.variant ?? "minimal",
|
|
65
65
|
size: "icon",
|
|
66
66
|
"aria-label": label,
|
|
67
67
|
onClick
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonDark.js","names":[],"sources":["../../src/shell/ButtonDark.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useColorMode } from \"alepha/react/ui\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\n\nexport interface ButtonDarkProps {\n /**\n * Optional aria-label override. Defaults to `\"Toggle color mode\"`.\n */\n label?: string;\n /**\n * When `true`, the button cycles through three states `light → dark →\n * system`. By default the button toggles strictly between `light` and\n * `dark` using the resolved mode as the starting point.\n */\n withSystem?: boolean;\n /**\n * Visual variant. Defaults to `\"
|
|
1
|
+
{"version":3,"file":"ButtonDark.js","names":[],"sources":["../../src/shell/ButtonDark.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useColorMode } from \"alepha/react/ui\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\n\nexport interface ButtonDarkProps {\n /**\n * Optional aria-label override. Defaults to `\"Toggle color mode\"`.\n */\n label?: string;\n /**\n * When `true`, the button cycles through three states `light → dark →\n * system`. By default the button toggles strictly between `light` and\n * `dark` using the resolved mode as the starting point.\n */\n withSystem?: boolean;\n /**\n * Visual variant. Defaults to `\"minimal\"`. Pass `\"outlined\"` for a\n * bordered toolbar look.\n */\n variant?: \"minimal\" | \"outlined\";\n}\n\nconst NEXT: Record<\"light\" | \"dark\" | \"system\", \"light\" | \"dark\" | \"system\"> = {\n light: \"dark\",\n dark: \"system\",\n system: \"light\",\n};\n\n/**\n * Every icon the button can show, all rendered, with CSS revealing one.\n *\n * ⚠️ This is the point of the component, not a styling flourish. It used to\n * render ONE icon chosen from the color mode DURING RENDER, which is a\n * hydration mismatch on any PRERENDERED page: the HTML is built with the\n * default preference and the client renders the visitor's. React reported #418\n * on every cold load for anyone who had ever picked a mode, then threw the\n * prerendered tree away and re-rendered from scratch - most of what\n * prerendering was buying.\n *\n * `apps/docs` had already solved this by hand and wrote the rule down: the\n * theme is \"a paint, not a render\". The markup here is identical for every\n * visitor, and `.dark` / `data-color-mode` on `<html>` - both outside React's\n * tree, both set by `ColorScheme` - decide which copy shows.\n *\n * A mount gate would be the other way round, and it is wrong here: an app that\n * genuinely SSRs (Lore) already emits the right icon from the request's\n * cookie, so deferring to a mount would INTRODUCE the mismatch it is meant to\n * prevent. `withSystem` is a prop, identical on both sides, so branching on it\n * is safe.\n */\nconst TWO_STATE_ICONS: ReactNode = (\n <>\n <Sun className=\"size-4 dark:hidden\" />\n <Moon className=\"hidden size-4 dark:block\" />\n </>\n);\n\n/**\n * The three-state cycle needs the UNRESOLVED preference, which `.dark` cannot\n * express: \"system, resolved to dark\" and \"dark, chosen\" carry the same class.\n * `data-color-mode` carries it.\n *\n * The system icon is the one that shows when the attribute is ABSENT, which is\n * every first paint and every prerendered document - and `system` is also the\n * default mode, so the fallback is the correct answer rather than a guess.\n */\nconst THREE_STATE_ICONS: ReactNode = (\n <>\n <Sun className=\"hidden size-4 [[data-color-mode='light']_&]:block\" />\n <Moon className=\"hidden size-4 [[data-color-mode='dark']_&]:block\" />\n <Monitor className=\"size-4 [[data-color-mode='dark']_&]:hidden [[data-color-mode='light']_&]:hidden\" />\n </>\n);\n\n/**\n * Color-mode toggle. Default is a two-state Sun ↔ Moon flip; opt into the\n * three-state `light → dark → system` cycle with `withSystem`.\n * Reads/writes the persisted UI cookie via `useColorMode()`.\n */\nexport const ButtonDark = (props: ButtonDarkProps) => {\n const { mode, resolved, setMode } = useColorMode();\n const onClick = () => {\n if (props.withSystem) {\n setMode(NEXT[mode]);\n } else {\n setMode(resolved === \"dark\" ? \"light\" : \"dark\");\n }\n };\n const label = props.label ?? \"Toggle color mode\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"minimal\"}\n size=\"icon\"\n aria-label={label}\n onClick={onClick}\n />\n }\n >\n {props.withSystem ? THREE_STATE_ICONS : TWO_STATE_ICONS}\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n );\n};\n"],"mappings":";;;;;;;AA6BA,MAAM,OAAyE;CAC7E,OAAO;CACP,MAAM;CACN,QAAQ;AACV;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAM,kBACJ,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,KAAD,EAAK,WAAU,qBAAsB,CAAA,GACrC,oBAAC,MAAD,EAAM,WAAU,2BAA4B,CAAA,CAC5C,EAAA,CAAA;;;;;;;;;;AAYJ,MAAM,oBACJ,qBAAA,YAAA,EAAA,UAAA;CACE,oBAAC,KAAD,EAAK,WAAU,oDAAqD,CAAA;CACpE,oBAAC,MAAD,EAAM,WAAU,mDAAoD,CAAA;CACpE,oBAAC,SAAD,EAAS,WAAU,kFAAmF,CAAA;AACtG,EAAA,CAAA;;;;;;AAQJ,MAAa,cAAc,UAA2B;CACpD,MAAM,EAAE,MAAM,UAAU,YAAY,aAAa;CACjD,MAAM,gBAAgB;EACpB,IAAI,MAAM,YACR,QAAQ,KAAK,KAAK;OAElB,QAAQ,aAAa,SAAS,UAAU,MAAM;CAElD;CACA,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;GACH;EACV,CAAA;EAGF,UAAA,MAAM,aAAa,oBAAoB;CAC1B,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA;AAEb"}
|
|
@@ -34,7 +34,7 @@ export interface ButtonInboxProps {
|
|
|
34
34
|
markAllRead?: string;
|
|
35
35
|
seeAll?: string;
|
|
36
36
|
};
|
|
37
|
-
variant?: "
|
|
37
|
+
variant?: "minimal" | "outlined";
|
|
38
38
|
/**
|
|
39
39
|
* Called with the message's `href` when a row is clicked, after it has
|
|
40
40
|
* been marked read. Defaults to a full navigation, which is correct for an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonInbox.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonInbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwB/B,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ButtonInbox.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonInbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwB/B,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAWD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,UAAW,gBAAgB,6BAkMlD,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { cn } from "../core/utils.js";
|
|
2
|
-
import { Button } from "../core/Button.js";
|
|
3
2
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
3
|
+
import { Button } from "../core/Button.js";
|
|
4
4
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.js";
|
|
5
5
|
import { inboxUnreadAtom } from "./inboxUnreadAtom.js";
|
|
6
6
|
import { Bell } from "lucide-react";
|
|
7
7
|
import { useCallback, useEffect, useState } from "react";
|
|
8
|
-
import { DateTimeProvider } from "alepha/datetime";
|
|
9
|
-
import { useClient, useInject, useStore } from "alepha/react";
|
|
10
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useClient, useInject, useStore } from "alepha/react";
|
|
10
|
+
import { DateTimeProvider } from "alepha/datetime";
|
|
11
11
|
//#region src/shell/ButtonInbox.tsx
|
|
12
12
|
/**
|
|
13
13
|
* The bell: an unread count, and the most recent messages behind it.
|
|
@@ -86,14 +86,14 @@ const ButtonInbox = (props) => {
|
|
|
86
86
|
onOpenChange: (next) => next && void load(),
|
|
87
87
|
children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsxs(TooltipTrigger, {
|
|
88
88
|
render: /* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
89
|
-
variant: props.variant ?? "
|
|
89
|
+
variant: props.variant ?? "minimal",
|
|
90
90
|
size: "icon",
|
|
91
91
|
"aria-label": label,
|
|
92
92
|
className: "relative"
|
|
93
93
|
}) }),
|
|
94
94
|
children: [/* @__PURE__ */ jsx(Bell, { className: "size-4" }), count > 0 && /* @__PURE__ */ jsx("span", {
|
|
95
95
|
"data-testid": "inbox-badge",
|
|
96
|
-
className: "bg-
|
|
96
|
+
className: "bg-danger text-danger-foreground absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] leading-none font-medium",
|
|
97
97
|
children: count > 99 ? "99+" : count
|
|
98
98
|
})]
|
|
99
99
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: label })] }), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
@@ -101,7 +101,8 @@ const ButtonInbox = (props) => {
|
|
|
101
101
|
className: "w-80",
|
|
102
102
|
children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [
|
|
103
103
|
/* @__PURE__ */ jsxs(DropdownMenuLabel, {
|
|
104
|
-
|
|
104
|
+
"data-testid": "inbox-header",
|
|
105
|
+
className: "bg-muted text-foreground -mx-1 -mt-1 mb-1 flex items-center justify-between gap-2 px-2.5 py-2 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)]",
|
|
105
106
|
children: [/* @__PURE__ */ jsx("span", { children: props.labels?.heading ?? "Notifications" }), count > 0 && /* @__PURE__ */ jsx("button", {
|
|
106
107
|
type: "button",
|
|
107
108
|
className: "text-muted-foreground hover:text-foreground text-xs font-normal",
|
|
@@ -113,7 +114,6 @@ const ButtonInbox = (props) => {
|
|
|
113
114
|
children: props.labels?.markAllRead ?? "Mark all read"
|
|
114
115
|
})]
|
|
115
116
|
}),
|
|
116
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
117
117
|
items.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
118
118
|
className: "text-muted-foreground px-2 py-6 text-center text-sm",
|
|
119
119
|
children: props.labels?.empty ?? "Nothing new"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonInbox.js","names":[],"sources":["../../src/shell/ButtonInbox.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { NotificationInboxController } from \"alepha/api/notifications\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useClient, useInject, useStore } from \"alepha/react\";\nimport { Bell } from \"lucide-react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { inboxUnreadAtom } from \"./inboxUnreadAtom.ts\";\n\nexport interface ButtonInboxProps {\n /**\n * Where \"See all\" goes. `@alepha/ui` cannot know an application's routes,\n * so the destination is the surface's to decide; the footer is hidden when\n * it is absent.\n *\n * ⚠️ It should point at the **unfiltered** list. This dropdown lists\n * messages from every scope, so a footer landing on a filtered view shows\n * fewer rows than the menu it was clicked out of.\n */\n seeAllHref?: string;\n /**\n * How many messages the dropdown lists. Five is the shape the design\n * settled on: enough to recognise what happened, short enough to read\n * without scrolling.\n */\n limit?: number;\n /**\n * Labels, for an application that localises its chrome. Each falls back to\n * its English default.\n *\n * They are this component's own props rather than entries in a shared\n * cluster's `labels` bag, because the surface that mounts the bell is the\n * one that has a translator in hand.\n */\n labels?: {\n /**\n * The trigger's `aria-label` and tooltip. Defaults to `\"Notifications\"`.\n */\n inbox?: string;\n heading?: string;\n empty?: string;\n markAllRead?: string;\n seeAll?: string;\n };\n variant?: \"ghost\" | \"outline\";\n /**\n * Called with the message's `href` when a row is clicked, after it has\n * been marked read. Defaults to a full navigation, which is correct for an\n * app with no router in scope and wrong for one that has it - so a router\n * app passes its own push.\n */\n onOpen?: (href: string) => void;\n}\n\ninterface InboxRow {\n id: string;\n title: string;\n href: string;\n createdAt: string;\n readAt?: string;\n scopeLabel?: string;\n}\n\n/**\n * The bell: an unread count, and the most recent messages behind it.\n *\n * ## It decides for itself whether it has anything to offer\n *\n * `countInbox.can()` is the gate, and it is a **registry lookup, not a\n * request**: `/api/_links` carries only the actions the server actually\n * registered, and it prunes every `$secure()` one for an anonymous caller.\n * So this renders nothing both when the app has not registered\n * `alepha/api/notifications` and when nobody is signed in, with no 404 fired\n * on every page load. `AccountRouter` gates its five pages the same way.\n *\n * ## ⚠️ The scope chip is a label the message carries, never a parsed scope\n *\n * `scope` is an app-owned opaque string (`project:65`) and this component has\n * no way to turn one into a name - nor should it learn. The message carries\n * `scopeLabel`, written by whoever pushed it and frozen at that moment. Null\n * means no chip.\n */\nexport const ButtonInbox = (props: ButtonInboxProps) => {\n const api = useClient<NotificationInboxController>();\n const dt = useInject(DateTimeProvider);\n const [unread, setUnread] = useStore(inboxUnreadAtom);\n const [items, setItems] = useState<InboxRow[]>([]);\n\n const available = api.countInbox.can();\n const limit = props.limit ?? 5;\n\n const refreshCount = useCallback(async () => {\n if (!available) return;\n try {\n const result = await api.countInbox({ query: {} });\n setUnread({ count: result.unread });\n } catch {\n // A bell that throws takes the header with it. A count nobody could\n // read is zero, and the badge disappears.\n setUnread({ count: 0 });\n }\n }, [api, available]);\n\n useEffect(() => {\n if (!available) return;\n // A fallback, not the primary read: a host whose route loader already\n // seeded the atom has a count before the first paint, and this only\n // covers the case where that call failed or never ran.\n if (unread.count === 0) {\n void refreshCount();\n }\n // Staleness, not coverage. A message arriving while somebody sits on one\n // page is invisible until they navigate, and this is the only thing that\n // changes that.\n const onFocus = () => void refreshCount();\n window.addEventListener(\"focus\", onFocus);\n return () => window.removeEventListener(\"focus\", onFocus);\n }, [available, refreshCount]);\n\n const load = async () => {\n if (!available) return;\n try {\n const page = await api.listInbox({ query: { limit } });\n setItems(page.items as InboxRow[]);\n setUnread({ count: page.unreadCount });\n } catch {\n setItems([]);\n }\n };\n\n const open = async (row: InboxRow) => {\n if (!row.readAt) {\n try {\n await api.markInboxRead({ params: { id: row.id } });\n setUnread({ count: Math.max(0, unread.count - 1) });\n } catch {\n // Opening the message matters more than recording that it was read.\n }\n }\n navigate(props, row.href);\n };\n\n const markAllRead = async () => {\n try {\n await api.markAllInboxRead({ query: {} });\n } finally {\n setUnread({ count: 0 });\n setItems((current) =>\n current.map((it) => ({ ...it, readAt: it.readAt ?? \"read\" })),\n );\n }\n };\n\n if (!available) {\n return null;\n }\n\n const label = props.labels?.inbox ?? \"Notifications\";\n const count = unread.count;\n\n return (\n <DropdownMenu onOpenChange={(next) => next && void load()}>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n className=\"relative\"\n />\n }\n />\n }\n >\n <Bell className=\"size-4\" />\n {count > 0 && (\n // Filled and in the destructive colour, not a subtle dot: the\n // whole point of the control is that an unread message is not\n // easy to miss.\n <span\n data-testid=\"inbox-badge\"\n className=\"bg-destructive text-destructive-foreground absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] leading-none font-medium\"\n >\n {count > 99 ? \"99+\" : count}\n </span>\n )}\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-80\">\n <DropdownMenuGroup>\n <DropdownMenuLabel className=\"flex items-center justify-between gap-2\">\n <span>{props.labels?.heading ?? \"Notifications\"}</span>\n {count > 0 && (\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:text-foreground text-xs font-normal\"\n onClick={(event) => {\n // The menu must not close: marking read is a change to what\n // is on screen, and the reader is still reading it.\n event.preventDefault();\n event.stopPropagation();\n void markAllRead();\n }}\n >\n {props.labels?.markAllRead ?? \"Mark all read\"}\n </button>\n )}\n </DropdownMenuLabel>\n <DropdownMenuSeparator />\n {items.length === 0 ? (\n <p className=\"text-muted-foreground px-2 py-6 text-center text-sm\">\n {props.labels?.empty ?? \"Nothing new\"}\n </p>\n ) : (\n items.map((row) => (\n <DropdownMenuItem\n key={row.id}\n className=\"flex flex-col items-start gap-0.5\"\n onClick={() => void open(row)}\n >\n <span className=\"flex w-full items-center gap-2\">\n {!row.readAt && (\n <span\n data-testid=\"inbox-unread-dot\"\n className=\"bg-primary size-1.5 shrink-0 rounded-full\"\n />\n )}\n <span\n className={cn(\n \"flex-1 truncate text-sm\",\n !row.readAt && \"font-medium\",\n )}\n >\n {row.title}\n </span>\n </span>\n <span className=\"text-muted-foreground flex w-full items-center gap-2 text-xs\">\n <span>{dt.of(row.createdAt).fromNow()}</span>\n {row.scopeLabel && (\n <span className=\"bg-muted ml-auto rounded px-1.5 py-0.5\">\n {row.scopeLabel}\n </span>\n )}\n </span>\n </DropdownMenuItem>\n ))\n )}\n {props.seeAllHref && (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n onClick={() => navigate(props, props.seeAllHref!)}\n className=\"justify-center text-sm\"\n >\n {props.labels?.seeAll ?? \"See all\"}\n </DropdownMenuItem>\n </>\n )}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\n/**\n * Follow a message's destination.\n *\n * `onOpen` is what a router app passes; without one this is a full\n * navigation, which is correct for a host that has no router in scope.\n * `assign()` rather than writing `location.href`, because the href is not a\n * variable this component owns.\n */\nconst navigate = (props: ButtonInboxProps, href: string): void => {\n if (props.onOpen) {\n props.onOpen(href);\n return;\n }\n if (typeof window !== \"undefined\") {\n window.location.assign(href);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,MAAa,eAAe,UAA4B;CACtD,MAAM,MAAM,UAAuC;CACnD,MAAM,KAAK,UAAU,gBAAgB;CACrC,MAAM,CAAC,QAAQ,aAAa,SAAS,eAAe;CACpD,MAAM,CAAC,OAAO,YAAY,SAAqB,CAAC,CAAC;CAEjD,MAAM,YAAY,IAAI,WAAW,IAAI;CACrC,MAAM,QAAQ,MAAM,SAAS;CAE7B,MAAM,eAAe,YAAY,YAAY;EAC3C,IAAI,CAAC,WAAW;EAChB,IAAI;GACF,MAAM,SAAS,MAAM,IAAI,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;GACjD,UAAU,EAAE,OAAO,OAAO,OAAO,CAAC;EACpC,QAAQ;GAGN,UAAU,EAAE,OAAO,EAAE,CAAC;EACxB;CACF,GA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AA,UAAO,GAAG,GAAG,IAAI,SAAS,CAAC,CAAC,QAAQ,EAAQ,CAAA,GAC3C,IAAI,cACH,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA,IAAI;MACD,CAAA,CAEJ;KACU,CAAA,CAAA;IA5BX,GAAA,IAAI,EA4BO,CACnB;IAEF,MAAM,cACL,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,uBAAD,CAAwB,CAAA,GACxB,oBAAC,kBAAD;KACE,eAAe,SAAS,OAAO,MAAM,UAAW;KAChD,WAAU;KAET,UAAA,MAAM,QAAQ,UAAU;IACT,CAAA,CAClB,EAAA,CAAA;GAEa,EAAA,CAAA;EACA,CAAA,CACT;;AAElB;;;;;;;;;AAUA,MAAM,YAAY,OAAyB,SAAuB;CAChE,IAAI,MAAM,QAAQ;EAChB,MAAM,OAAO,IAAI;EACjB;CACF;CACA,IAAI,OAAO,WAAW,aACpB,OAAO,SAAS,OAAO,IAAI;AAE/B"}
|
|
1
|
+
{"version":3,"file":"ButtonInbox.js","names":[],"sources":["../../src/shell/ButtonInbox.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport type { NotificationInboxController } from \"alepha/api/notifications\";\nimport { DateTimeProvider } from \"alepha/datetime\";\nimport { useClient, useInject, useStore } from \"alepha/react\";\nimport { Bell } from \"lucide-react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { inboxUnreadAtom } from \"./inboxUnreadAtom.ts\";\n\nexport interface ButtonInboxProps {\n /**\n * Where \"See all\" goes. `@alepha/ui` cannot know an application's routes,\n * so the destination is the surface's to decide; the footer is hidden when\n * it is absent.\n *\n * ⚠️ It should point at the **unfiltered** list. This dropdown lists\n * messages from every scope, so a footer landing on a filtered view shows\n * fewer rows than the menu it was clicked out of.\n */\n seeAllHref?: string;\n /**\n * How many messages the dropdown lists. Five is the shape the design\n * settled on: enough to recognise what happened, short enough to read\n * without scrolling.\n */\n limit?: number;\n /**\n * Labels, for an application that localises its chrome. Each falls back to\n * its English default.\n *\n * They are this component's own props rather than entries in a shared\n * cluster's `labels` bag, because the surface that mounts the bell is the\n * one that has a translator in hand.\n */\n labels?: {\n /**\n * The trigger's `aria-label` and tooltip. Defaults to `\"Notifications\"`.\n */\n inbox?: string;\n heading?: string;\n empty?: string;\n markAllRead?: string;\n seeAll?: string;\n };\n variant?: \"minimal\" | \"outlined\";\n /**\n * Called with the message's `href` when a row is clicked, after it has\n * been marked read. Defaults to a full navigation, which is correct for an\n * app with no router in scope and wrong for one that has it - so a router\n * app passes its own push.\n */\n onOpen?: (href: string) => void;\n}\n\ninterface InboxRow {\n id: string;\n title: string;\n href: string;\n createdAt: string;\n readAt?: string;\n scopeLabel?: string;\n}\n\n/**\n * The bell: an unread count, and the most recent messages behind it.\n *\n * ## It decides for itself whether it has anything to offer\n *\n * `countInbox.can()` is the gate, and it is a **registry lookup, not a\n * request**: `/api/_links` carries only the actions the server actually\n * registered, and it prunes every `$secure()` one for an anonymous caller.\n * So this renders nothing both when the app has not registered\n * `alepha/api/notifications` and when nobody is signed in, with no 404 fired\n * on every page load. `AccountRouter` gates its five pages the same way.\n *\n * ## ⚠️ The scope chip is a label the message carries, never a parsed scope\n *\n * `scope` is an app-owned opaque string (`project:65`) and this component has\n * no way to turn one into a name - nor should it learn. The message carries\n * `scopeLabel`, written by whoever pushed it and frozen at that moment. Null\n * means no chip.\n */\nexport const ButtonInbox = (props: ButtonInboxProps) => {\n const api = useClient<NotificationInboxController>();\n const dt = useInject(DateTimeProvider);\n const [unread, setUnread] = useStore(inboxUnreadAtom);\n const [items, setItems] = useState<InboxRow[]>([]);\n\n const available = api.countInbox.can();\n const limit = props.limit ?? 5;\n\n const refreshCount = useCallback(async () => {\n if (!available) return;\n try {\n const result = await api.countInbox({ query: {} });\n setUnread({ count: result.unread });\n } catch {\n // A bell that throws takes the header with it. A count nobody could\n // read is zero, and the badge disappears.\n setUnread({ count: 0 });\n }\n }, [api, available]);\n\n useEffect(() => {\n if (!available) return;\n // A fallback, not the primary read: a host whose route loader already\n // seeded the atom has a count before the first paint, and this only\n // covers the case where that call failed or never ran.\n if (unread.count === 0) {\n void refreshCount();\n }\n // Staleness, not coverage. A message arriving while somebody sits on one\n // page is invisible until they navigate, and this is the only thing that\n // changes that.\n const onFocus = () => void refreshCount();\n window.addEventListener(\"focus\", onFocus);\n return () => window.removeEventListener(\"focus\", onFocus);\n }, [available, refreshCount]);\n\n const load = async () => {\n if (!available) return;\n try {\n const page = await api.listInbox({ query: { limit } });\n setItems(page.items as InboxRow[]);\n setUnread({ count: page.unreadCount });\n } catch {\n setItems([]);\n }\n };\n\n const open = async (row: InboxRow) => {\n if (!row.readAt) {\n try {\n await api.markInboxRead({ params: { id: row.id } });\n setUnread({ count: Math.max(0, unread.count - 1) });\n } catch {\n // Opening the message matters more than recording that it was read.\n }\n }\n navigate(props, row.href);\n };\n\n const markAllRead = async () => {\n try {\n await api.markAllInboxRead({ query: {} });\n } finally {\n setUnread({ count: 0 });\n setItems((current) =>\n current.map((it) => ({ ...it, readAt: it.readAt ?? \"read\" })),\n );\n }\n };\n\n if (!available) {\n return null;\n }\n\n const label = props.labels?.inbox ?? \"Notifications\";\n const count = unread.count;\n\n return (\n <DropdownMenu onOpenChange={(next) => next && void load()}>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"minimal\"}\n size=\"icon\"\n aria-label={label}\n className=\"relative\"\n />\n }\n />\n }\n >\n <Bell className=\"size-4\" />\n {count > 0 && (\n // Filled and in the destructive colour, not a subtle dot: the\n // whole point of the control is that an unread message is not\n // easy to miss.\n <span\n data-testid=\"inbox-badge\"\n className=\"bg-danger text-danger-foreground absolute -top-0.5 -right-0.5 flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] leading-none font-medium\"\n >\n {count > 99 ? \"99+\" : count}\n </span>\n )}\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-80\">\n <DropdownMenuGroup>\n {/*\n The header is chrome, not a row: `bg-muted` under the `--bevel`\n line, the pair `PlateTabBar` and the table header use, closed by\n a border line below. Pulled out over the content's `p-1` so it\n runs edge to edge; the rounded, overflow-clipped popover trims\n its corners. The border replaces the separator that used to sit\n under it, which would have drawn a second line.\n */}\n <DropdownMenuLabel\n data-testid=\"inbox-header\"\n className=\"bg-muted text-foreground -mx-1 -mt-1 mb-1 flex items-center justify-between gap-2 px-2.5 py-2 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)]\"\n >\n <span>{props.labels?.heading ?? \"Notifications\"}</span>\n {count > 0 && (\n <button\n type=\"button\"\n className=\"text-muted-foreground hover:text-foreground text-xs font-normal\"\n onClick={(event) => {\n // The menu must not close: marking read is a change to what\n // is on screen, and the reader is still reading it.\n event.preventDefault();\n event.stopPropagation();\n void markAllRead();\n }}\n >\n {props.labels?.markAllRead ?? \"Mark all read\"}\n </button>\n )}\n </DropdownMenuLabel>\n {items.length === 0 ? (\n <p className=\"text-muted-foreground px-2 py-6 text-center text-sm\">\n {props.labels?.empty ?? \"Nothing new\"}\n </p>\n ) : (\n items.map((row) => (\n <DropdownMenuItem\n key={row.id}\n className=\"flex flex-col items-start gap-0.5\"\n onClick={() => void open(row)}\n >\n <span className=\"flex w-full items-center gap-2\">\n {!row.readAt && (\n <span\n data-testid=\"inbox-unread-dot\"\n className=\"bg-primary size-1.5 shrink-0 rounded-full\"\n />\n )}\n <span\n className={cn(\n \"flex-1 truncate text-sm\",\n !row.readAt && \"font-medium\",\n )}\n >\n {row.title}\n </span>\n </span>\n <span className=\"text-muted-foreground flex w-full items-center gap-2 text-xs\">\n <span>{dt.of(row.createdAt).fromNow()}</span>\n {row.scopeLabel && (\n <span className=\"bg-muted ml-auto rounded px-1.5 py-0.5\">\n {row.scopeLabel}\n </span>\n )}\n </span>\n </DropdownMenuItem>\n ))\n )}\n {props.seeAllHref && (\n <>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n onClick={() => navigate(props, props.seeAllHref!)}\n className=\"justify-center text-sm\"\n >\n {props.labels?.seeAll ?? \"See all\"}\n </DropdownMenuItem>\n </>\n )}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\n/**\n * Follow a message's destination.\n *\n * `onOpen` is what a router app passes; without one this is a full\n * navigation, which is correct for a host that has no router in scope.\n * `assign()` rather than writing `location.href`, because the href is not a\n * variable this component owns.\n */\nconst navigate = (props: ButtonInboxProps, href: string): void => {\n if (props.onOpen) {\n props.onOpen(href);\n return;\n }\n if (typeof window !== \"undefined\") {\n window.location.assign(href);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,MAAa,eAAe,UAA4B;CACtD,MAAM,MAAM,UAAuC;CACnD,MAAM,KAAK,UAAU,gBAAgB;CACrC,MAAM,CAAC,QAAQ,aAAa,SAAS,eAAe;CACpD,MAAM,CAAC,OAAO,YAAY,SAAqB,CAAC,CAAC;CAEjD,MAAM,YAAY,IAAI,WAAW,IAAI;CACrC,MAAM,QAAQ,MAAM,SAAS;CAE7B,MAAM,eAAe,YAAY,YAAY;EAC3C,IAAI,CAAC,WAAW;EAChB,IAAI;GACF,MAAM,SAAS,MAAM,IAAI,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;GACjD,UAAU,EAAE,OAAO,OAAO,OAAO,CAAC;EACpC,QAAQ;GAGN,UAAU,EAAE,OAAO,EAAE,CAAC;EACxB;CACF,GAAG,CAAC,KAAK,SAAS,CAAC;CAEnB,gBAAgB;EACd,I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,IAAI,cACH,oBAAC,QAAD;OAAM,WAAU;OACb,UAAA,IAAI;MACD,CAAA,CAEJ;KACU,CAAA,CAAA;IA5BX,GAAA,IAAI,EA4BO,CACnB;IAEF,MAAM,cACL,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,uBAAD,CAAwB,CAAA,GACxB,oBAAC,kBAAD;KACE,eAAe,SAAS,OAAO,MAAM,UAAW;KAChD,WAAU;KAET,UAAA,MAAM,QAAQ,UAAU;IACT,CAAA,CAClB,EAAA,CAAA;GAEa,EAAA,CAAA;EACA,CAAA,CACT;;AAElB;;;;;;;;;AAUA,MAAM,YAAY,OAAyB,SAAuB;CAChE,IAAI,MAAM,QAAQ;EAChB,MAAM,OAAO,IAAI;EACjB;CACF;CACA,IAAI,OAAO,WAAW,aACpB,OAAO,SAAS,OAAO,IAAI;AAE/B"}
|
|
@@ -5,10 +5,10 @@ export interface ButtonLanguageProps {
|
|
|
5
5
|
*/
|
|
6
6
|
label?: string;
|
|
7
7
|
/**
|
|
8
|
-
* Visual variant. Defaults to `"
|
|
8
|
+
* Visual variant. Defaults to `"minimal"`. Pass `"outlined"` for a
|
|
9
9
|
* bordered toolbar look.
|
|
10
10
|
*/
|
|
11
|
-
variant?: "
|
|
11
|
+
variant?: "minimal" | "outlined";
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Dropdown listing every language registered via `$dictionary`. Switches the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLanguage.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonLanguage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ButtonLanguage.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonLanguage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CAClC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,UAAW,mBAAmB,6BAwDxD,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Button } from "../core/Button.js";
|
|
2
1
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger } from "../core/DropdownMenu.js";
|
|
2
|
+
import { Button } from "../core/Button.js";
|
|
3
3
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.js";
|
|
4
|
+
import { useI18n } from "alepha/react/i18n";
|
|
4
5
|
import { Languages } from "lucide-react";
|
|
5
6
|
import "react";
|
|
6
|
-
import { useI18n } from "alepha/react/i18n";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/shell/ButtonLanguage.tsx
|
|
9
9
|
/**
|
|
@@ -23,7 +23,7 @@ const ButtonLanguage = (props) => {
|
|
|
23
23
|
const label = props.label ?? "Switch language";
|
|
24
24
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
25
25
|
render: /* @__PURE__ */ jsx(DropdownMenuTrigger, { render: /* @__PURE__ */ jsx(Button, {
|
|
26
|
-
variant: props.variant ?? "
|
|
26
|
+
variant: props.variant ?? "minimal",
|
|
27
27
|
size: "icon",
|
|
28
28
|
"aria-label": label
|
|
29
29
|
}) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLanguage.js","names":[],"sources":["../../src/shell/ButtonLanguage.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useI18n } from \"alepha/react/i18n\";\nimport { Languages } from \"lucide-react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\n\nexport interface ButtonLanguageProps {\n /**\n * Optional aria-label override. Defaults to `\"Switch language\"`.\n */\n label?: string;\n /**\n * Visual variant. Defaults to `\"
|
|
1
|
+
{"version":3,"file":"ButtonLanguage.js","names":[],"sources":["../../src/shell/ButtonLanguage.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useI18n } from \"alepha/react/i18n\";\nimport { Languages } from \"lucide-react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\n\nexport interface ButtonLanguageProps {\n /**\n * Optional aria-label override. Defaults to `\"Switch language\"`.\n */\n label?: string;\n /**\n * Visual variant. Defaults to `\"minimal\"`. Pass `\"outlined\"` for a\n * bordered toolbar look.\n */\n variant?: \"minimal\" | \"outlined\";\n}\n\n/**\n * Dropdown listing every language registered via `$dictionary`. Switches the\n * active locale via `useI18n().setLang(code)`.\n *\n * Labels come from translation keys `language.<code>` (e.g. `language.en`,\n * `language.fr`). If the key is missing, the raw code is shown — so adding a\n * new language to the picker is a one-line `tr` entry per dictionary.\n *\n * Renders nothing when only one language is registered.\n */\nexport const ButtonLanguage = (props: ButtonLanguageProps) => {\n const i18n = useI18n();\n const languages = i18n.languages;\n\n if (languages.length <= 1) {\n return null;\n }\n\n const label = props.label ?? \"Switch language\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"minimal\"}\n size=\"icon\"\n aria-label={label}\n />\n }\n />\n }\n >\n <Languages className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\">\n {languages.map((code) => {\n const translated = i18n.tr(`language.${code}` as never);\n const label = translated === `language.${code}` ? code : translated;\n return (\n <DropdownMenuCheckboxItem\n key={code}\n checked={i18n.lang === code}\n /*\n * Checkbox items keep the menu open by default, which is right when\n * you are ticking several things and wrong here: a language is a\n * single choice, and the menu stayed hanging over the page after\n * you made it. Closing on click also means the ticked state is\n * something you see on reopening rather than a leftover panel.\n */\n closeOnClick\n onCheckedChange={() => {\n void i18n.setLang(code);\n }}\n >\n {label}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsCA,MAAa,kBAAkB,UAA+B;CAC5D,MAAM,OAAO,QAAQ;CACrB,MAAM,YAAY,KAAK;CAEvB,IAAI,UAAU,UAAU,GACtB,OAAO;CAGT,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAGH,UAAA,oBAAC,WAAD,EAAW,WAAU,SAAU,CAAA;CACjB,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA,GACT,oBAAC,qBAAD;EAAqB,OAAM;EACxB,UAAA,UAAU,KAAK,SAAS;GACvB,MAAM,aAAa,KAAK,GAAG,YAAY,MAAe;GACtD,MAAM,QAAQ,eAAe,YAAY,SAAS,OAAO;GACzD,OACE,oBAAC,0BAAD;IAEE,SAAS,KAAK,SAAS;IAQvB,cAAA;IACA,uBAAuB;KACrB,KAAU,QAAQ,IAAI;IACxB;IAEC,UAAA;GACuB,GAfnB,IAemB;EAE9B,CAAC;CACkB,CAAA,CACT,EAAA,CAAA;AAElB"}
|
|
@@ -75,9 +75,9 @@ export interface ButtonSettingsProps {
|
|
|
75
75
|
*/
|
|
76
76
|
compact?: boolean;
|
|
77
77
|
/**
|
|
78
|
-
* Visual variant of every button. Defaults to `"
|
|
78
|
+
* Visual variant of every button. Defaults to `"minimal"`.
|
|
79
79
|
*/
|
|
80
|
-
variant?: "
|
|
80
|
+
variant?: "minimal" | "outlined";
|
|
81
81
|
className?: string;
|
|
82
82
|
}
|
|
83
83
|
export declare function ButtonSettings(props: ButtonSettingsProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSettings.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAIxE,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI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