@alepha/ui 0.32.0 → 0.34.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/AccountConnections.js +1 -1
- package/dist/account/AccountConnections.js.map +1 -1
- package/dist/account/AccountDeleteDialog.d.ts.map +1 -1
- package/dist/account/AccountDeleteDialog.js +17 -17
- package/dist/account/AccountDeleteDialog.js.map +1 -1
- package/dist/account/AccountKeys.js +2 -2
- package/dist/account/AccountKeys.js.map +1 -1
- package/dist/account/AccountMfaDialog.d.ts.map +1 -1
- package/dist/account/AccountMfaDialog.js +19 -25
- package/dist/account/AccountMfaDialog.js.map +1 -1
- package/dist/account/AccountPasswordDialog.d.ts.map +1 -1
- package/dist/account/AccountPasswordDialog.js +25 -24
- package/dist/account/AccountPasswordDialog.js.map +1 -1
- package/dist/account/AccountProfile.d.ts.map +1 -1
- package/dist/account/AccountProfile.js +17 -24
- package/dist/account/AccountProfile.js.map +1 -1
- package/dist/account/AccountSecurity.d.ts.map +1 -1
- package/dist/account/AccountSecurity.js +21 -19
- package/dist/account/AccountSecurity.js.map +1 -1
- package/dist/account/AccountSessions.js +1 -1
- package/dist/account/AccountSessions.js.map +1 -1
- package/dist/account/ApiKeyCreateDialog.d.ts.map +1 -1
- package/dist/account/ApiKeyCreateDialog.js +8 -12
- package/dist/account/ApiKeyCreateDialog.js.map +1 -1
- package/dist/admin/AdminFiles.js +1 -1
- package/dist/admin/AdminFiles.js.map +1 -1
- package/dist/admin/AdminJobs.js +1 -1
- package/dist/admin/AdminJobs.js.map +1 -1
- package/dist/admin/AdminKeys.js +1 -1
- package/dist/admin/AdminKeys.js.map +1 -1
- package/dist/admin/AdminParameters.d.ts.map +1 -1
- package/dist/admin/AdminParameters.js +7 -5
- package/dist/admin/AdminParameters.js.map +1 -1
- package/dist/admin/AdminParametersTreeFooterActions.d.ts +2 -2
- package/dist/admin/AdminParametersTreeFooterActions.d.ts.map +1 -1
- package/dist/admin/AdminParametersTreeFooterActions.js.map +1 -1
- package/dist/admin/AdminParametersTreePane.d.ts +2 -2
- package/dist/admin/AdminParametersTreePane.d.ts.map +1 -1
- package/dist/admin/AdminParametersTreePane.js.map +1 -1
- package/dist/admin/AdminRouter.d.ts +1 -3
- package/dist/admin/AdminRouter.d.ts.map +1 -1
- package/dist/admin/AdminRouter.js +2 -4
- package/dist/admin/AdminRouter.js.map +1 -1
- package/dist/admin/AdminSessions.js +1 -1
- package/dist/admin/AdminSessions.js.map +1 -1
- package/dist/admin/AdminUserAvatarControl.d.ts.map +1 -1
- package/dist/admin/AdminUserAvatarControl.js +9 -16
- package/dist/admin/AdminUserAvatarControl.js.map +1 -1
- package/dist/admin/AdminUserDetail.js +4 -4
- package/dist/admin/AdminUserDetail.js.map +1 -1
- package/dist/admin/AdminUsers.d.ts.map +1 -1
- package/dist/admin/AdminUsers.js +10 -12
- package/dist/admin/AdminUsers.js.map +1 -1
- package/dist/admin/AdminUsersRolesPicker.d.ts +5 -1
- package/dist/admin/AdminUsersRolesPicker.d.ts.map +1 -1
- package/dist/admin/AdminUsersRolesPicker.js +2 -3
- package/dist/admin/AdminUsersRolesPicker.js.map +1 -1
- package/dist/admin/analytics/AdvancedSection.d.ts.map +1 -1
- package/dist/admin/analytics/AdvancedSection.js +7 -3
- package/dist/admin/analytics/AdvancedSection.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChart.d.ts +1 -0
- package/dist/admin/analytics/AnalyticsChart.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChart.js +3 -1
- package/dist/admin/analytics/AnalyticsChart.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChartHeader.d.ts +5 -0
- package/dist/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChartHeader.js +7 -2
- package/dist/admin/analytics/AnalyticsChartHeader.js.map +1 -1
- package/dist/admin/analytics/AnalyticsChartLine.d.ts +5 -0
- package/dist/admin/analytics/AnalyticsChartLine.d.ts.map +1 -1
- package/dist/admin/analytics/AnalyticsChartLine.js +6 -2
- package/dist/admin/analytics/AnalyticsChartLine.js.map +1 -1
- package/dist/admin/analytics/CoarsenedBadge.d.ts +15 -0
- package/dist/admin/analytics/CoarsenedBadge.d.ts.map +1 -0
- package/dist/admin/analytics/CoarsenedBadge.js +30 -0
- package/dist/admin/analytics/CoarsenedBadge.js.map +1 -0
- package/dist/admin/analytics/CompareNote.d.ts +5 -0
- package/dist/admin/analytics/CompareNote.d.ts.map +1 -1
- package/dist/admin/analytics/CompareNote.js +5 -1
- package/dist/admin/analytics/CompareNote.js.map +1 -1
- package/dist/admin/analytics/FilterEditor.d.ts +1 -0
- package/dist/admin/analytics/FilterEditor.d.ts.map +1 -1
- package/dist/admin/analytics/FilterEditor.js +1 -0
- package/dist/admin/analytics/FilterEditor.js.map +1 -1
- package/dist/admin/analytics/GroupByChips.d.ts +17 -11
- package/dist/admin/analytics/GroupByChips.d.ts.map +1 -1
- package/dist/admin/analytics/GroupByChips.js +21 -20
- package/dist/admin/analytics/GroupByChips.js.map +1 -1
- package/dist/admin/analytics/MeasureChips.d.ts +11 -6
- package/dist/admin/analytics/MeasureChips.d.ts.map +1 -1
- package/dist/admin/analytics/MeasureChips.js +13 -16
- package/dist/admin/analytics/MeasureChips.js.map +1 -1
- package/dist/admin/analytics/QueryPanel.d.ts.map +1 -1
- package/dist/admin/analytics/QueryPanel.js +10 -6
- package/dist/admin/analytics/QueryPanel.js.map +1 -1
- package/dist/admin/analytics/RangeControl.d.ts +11 -7
- package/dist/admin/analytics/RangeControl.d.ts.map +1 -1
- package/dist/admin/analytics/RangeControl.js +83 -30
- package/dist/admin/analytics/RangeControl.js.map +1 -1
- package/dist/admin/analytics/ResultsPane.d.ts.map +1 -1
- package/dist/admin/analytics/ResultsPane.js +13 -9
- 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 +3 -3
- package/dist/admin/analytics/ResultsTable.js.map +1 -1
- package/dist/admin/analytics/TotalsCards.d.ts +2 -1
- package/dist/admin/analytics/TotalsCards.d.ts.map +1 -1
- package/dist/admin/analytics/TotalsCards.js +9 -10
- package/dist/admin/analytics/TotalsCards.js.map +1 -1
- package/dist/admin/analytics/analyticsModel.d.ts +126 -17
- package/dist/admin/analytics/analyticsModel.d.ts.map +1 -1
- package/dist/admin/analytics/analyticsModel.js +283 -48
- package/dist/admin/analytics/analyticsModel.js.map +1 -1
- package/dist/admin/analytics/analyticsTypes.d.ts +55 -4
- package/dist/admin/analytics/analyticsTypes.d.ts.map +1 -1
- package/dist/admin/analytics/chartModel.d.ts +38 -3
- package/dist/admin/analytics/chartModel.d.ts.map +1 -1
- package/dist/admin/analytics/chartModel.js +86 -16
- package/dist/admin/analytics/chartModel.js.map +1 -1
- package/dist/admin/analytics/instantRangeSchema.d.ts +8 -0
- package/dist/admin/analytics/instantRangeSchema.d.ts.map +1 -0
- package/dist/admin/analytics/instantRangeSchema.js +13 -0
- package/dist/admin/analytics/instantRangeSchema.js.map +1 -0
- package/dist/admin/analytics/useAnalyticsQuery.d.ts +13 -3
- package/dist/admin/analytics/useAnalyticsQuery.d.ts.map +1 -1
- package/dist/admin/analytics/useAnalyticsQuery.js +60 -21
- package/dist/admin/analytics/useAnalyticsQuery.js.map +1 -1
- package/dist/admin/analytics/useFilterValues.d.ts +4 -0
- package/dist/admin/analytics/useFilterValues.d.ts.map +1 -1
- package/dist/admin/analytics/useFilterValues.js +6 -6
- package/dist/admin/analytics/useFilterValues.js.map +1 -1
- package/dist/admin/useConfirmedAction.d.ts +8 -2
- package/dist/admin/useConfirmedAction.d.ts.map +1 -1
- package/dist/admin/useConfirmedAction.js +15 -4
- package/dist/admin/useConfirmedAction.js.map +1 -1
- package/dist/ai/AiChat.d.ts +30 -0
- package/dist/ai/AiChat.d.ts.map +1 -0
- package/dist/ai/AiChat.js +116 -0
- package/dist/ai/AiChat.js.map +1 -0
- package/dist/ai/AiChatConfirmCard.d.ts +17 -0
- package/dist/ai/AiChatConfirmCard.d.ts.map +1 -0
- package/dist/ai/AiChatConfirmCard.js +47 -0
- package/dist/ai/AiChatConfirmCard.js.map +1 -0
- package/dist/ai/AiChatHistory.d.ts +14 -0
- package/dist/ai/AiChatHistory.d.ts.map +1 -0
- package/dist/ai/AiChatHistory.js +40 -0
- package/dist/ai/AiChatHistory.js.map +1 -0
- package/dist/ai/AiChatMessage.d.ts +10 -0
- package/dist/ai/AiChatMessage.d.ts.map +1 -0
- package/dist/ai/AiChatMessage.js +38 -0
- package/dist/ai/AiChatMessage.js.map +1 -0
- package/dist/ai/AiFormRegistry.d.ts +37 -0
- package/dist/ai/AiFormRegistry.d.ts.map +1 -0
- package/dist/ai/AiFormRegistry.js +59 -0
- package/dist/ai/AiFormRegistry.js.map +1 -0
- package/dist/ai/aiChatMessageFormSchema.d.ts +7 -0
- package/dist/ai/aiChatMessageFormSchema.d.ts.map +1 -0
- package/dist/ai/aiChatMessageFormSchema.js +13 -0
- package/dist/ai/aiChatMessageFormSchema.js.map +1 -0
- package/dist/ai/aiContextAtom.d.ts +16 -0
- package/dist/ai/aiContextAtom.d.ts.map +1 -0
- package/dist/ai/aiContextAtom.js +25 -0
- package/dist/ai/aiContextAtom.js.map +1 -0
- package/dist/ai/index.d.ts +18 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +10 -0
- package/dist/ai/useAiChat.d.ts +82 -0
- package/dist/ai/useAiChat.d.ts.map +1 -0
- package/dist/ai/useAiChat.js +256 -0
- package/dist/ai/useAiChat.js.map +1 -0
- package/dist/ai/useAiContext.d.ts +33 -0
- package/dist/ai/useAiContext.d.ts.map +1 -0
- package/dist/ai/useAiContext.js +52 -0
- package/dist/ai/useAiContext.js.map +1 -0
- package/dist/auth/AuthLogin.d.ts.map +1 -1
- package/dist/auth/AuthLogin.js +4 -4
- package/dist/auth/AuthLogin.js.map +1 -1
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/core/Breadcrumb.js +1 -1
- package/dist/core/Breadcrumb.js.map +1 -1
- package/dist/core/Sheet.d.ts +6 -1
- package/dist/core/Sheet.d.ts.map +1 -1
- package/dist/core/Sheet.js +2 -2
- package/dist/core/Sheet.js.map +1 -1
- package/dist/core/Sidebar.d.ts +7 -1
- package/dist/core/Sidebar.d.ts.map +1 -1
- package/dist/core/Sidebar.js +22 -17
- package/dist/core/Sidebar.js.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/form/AutoForm.js +1 -1
- package/dist/form/AutoForm.js.map +1 -1
- package/dist/form/Control.d.ts +14 -0
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +10 -4
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlArray.js +5 -5
- package/dist/form/ControlArray.js.map +1 -1
- package/dist/form/ControlDate.d.ts +11 -0
- package/dist/form/ControlDate.d.ts.map +1 -1
- package/dist/form/ControlDate.js +20 -2
- package/dist/form/ControlDate.js.map +1 -1
- package/dist/form/ControlDatePopover.d.ts +3 -0
- package/dist/form/ControlDatePopover.d.ts.map +1 -1
- package/dist/form/ControlDatePopover.js +1 -0
- package/dist/form/ControlDatePopover.js.map +1 -1
- package/dist/form/ControlMonthPopover.d.ts +25 -0
- package/dist/form/ControlMonthPopover.d.ts.map +1 -0
- package/dist/form/ControlMonthPopover.js +112 -0
- package/dist/form/ControlMonthPopover.js.map +1 -0
- package/dist/form/ControlSelect.d.ts +7 -0
- package/dist/form/ControlSelect.d.ts.map +1 -1
- package/dist/form/ControlSelect.js +39 -2
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/form/ControlUpload.d.ts +1 -1
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +31 -10
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/organizations/MyOrganizationInvitations.js +2 -2
- package/dist/organizations/MyOrganizationInvitations.js.map +1 -1
- package/dist/organizations/OrganizationInviteDialog.js +1 -1
- package/dist/organizations/OrganizationInviteDialog.js.map +1 -1
- package/dist/organizations/OrganizationMembers.js +1 -1
- package/dist/organizations/OrganizationMembers.js.map +1 -1
- package/dist/organizations/OrganizationPendingInvitations.js +1 -1
- package/dist/organizations/OrganizationPendingInvitations.js.map +1 -1
- package/dist/organizations/OrganizationRanks.js +3 -3
- package/dist/organizations/OrganizationRanks.js.map +1 -1
- package/dist/organizations/useInviteOrganizationMember.d.ts +6 -1
- package/dist/organizations/useInviteOrganizationMember.d.ts.map +1 -1
- package/dist/organizations/useInviteOrganizationMember.js +13 -13
- package/dist/organizations/useInviteOrganizationMember.js.map +1 -1
- package/dist/organizations/useRevokeOrganizationInvitation.d.ts +7 -1
- package/dist/organizations/useRevokeOrganizationInvitation.d.ts.map +1 -1
- package/dist/organizations/useRevokeOrganizationInvitation.js +13 -2
- package/dist/organizations/useRevokeOrganizationInvitation.js.map +1 -1
- package/dist/shell/AppShellNavCollapse.d.ts +4 -0
- package/dist/shell/AppShellNavCollapse.d.ts.map +1 -1
- package/dist/shell/AppShellNavCollapse.js +1 -0
- package/dist/shell/AppShellNavCollapse.js.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
- package/dist/shell/AppShellSidebarNavItem.js +13 -9
- package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.d.ts.map +1 -1
- package/dist/shell/AppShellStatefulSidebarTrigger.js +5 -2
- package/dist/shell/AppShellStatefulSidebarTrigger.js.map +1 -1
- package/dist/shell/ButtonUser.d.ts +1 -2
- package/dist/shell/ButtonUser.d.ts.map +1 -1
- package/dist/shell/ButtonUser.js +14 -42
- package/dist/shell/ButtonUser.js.map +1 -1
- package/dist/shell/ButtonUserContent.d.ts +13 -0
- package/dist/shell/ButtonUserContent.d.ts.map +1 -0
- package/dist/shell/ButtonUserContent.js +52 -0
- package/dist/shell/ButtonUserContent.js.map +1 -0
- package/dist/shell/ButtonUserPlaceholder.d.ts +14 -0
- package/dist/shell/ButtonUserPlaceholder.d.ts.map +1 -0
- package/dist/shell/ButtonUserPlaceholder.js +17 -0
- package/dist/shell/ButtonUserPlaceholder.js.map +1 -0
- package/dist/styles.css +31 -0
- package/dist/table/DataTable.d.ts.map +1 -1
- package/dist/table/DataTable.js +3 -2
- package/dist/table/DataTable.js.map +1 -1
- package/dist/table/DataTableFilterBar.js +2 -2
- package/dist/table/DataTableFilterBar.js.map +1 -1
- package/dist/table/DataTableToolbar.d.ts +7 -3
- package/dist/table/DataTableToolbar.d.ts.map +1 -1
- package/dist/table/DataTableToolbar.js +7 -3
- package/dist/table/DataTableToolbar.js.map +1 -1
- package/dist/table/dataTableBaseProps.d.ts +18 -1
- package/dist/table/dataTableBaseProps.d.ts.map +1 -1
- package/dist/table/dataTableTypes.d.ts +3 -3
- package/dist/table/dataTableTypes.d.ts.map +1 -1
- package/dist/table/useDataTableData.d.ts.map +1 -1
- package/dist/table/useDataTableData.js +3 -1
- package/dist/table/useDataTableData.js.map +1 -1
- package/dist/table/useDataTableRefresh.js +2 -2
- package/dist/table/useDataTableRefresh.js.map +1 -1
- package/dist/table/useDataTableSummary.d.ts.map +1 -1
- package/dist/table/useDataTableSummary.js +2 -1
- package/dist/table/useDataTableSummary.js.map +1 -1
- package/docs/packages-alepha-ui-account.md +29 -0
- package/docs/packages-alepha-ui-admin.md +35 -0
- package/docs/packages-alepha-ui-ai.md +29 -0
- package/docs/packages-alepha-ui-auth.md +23 -0
- package/docs/packages-alepha-ui-calendar.md +24 -0
- package/docs/packages-alepha-ui-chart.md +23 -0
- package/docs/packages-alepha-ui-command.md +24 -0
- package/docs/packages-alepha-ui-core.md +40 -0
- package/docs/packages-alepha-ui-form.md +29 -0
- package/docs/packages-alepha-ui-i18n-fr.md +31 -0
- package/docs/packages-alepha-ui-markdown.md +27 -0
- package/docs/packages-alepha-ui-organizations.md +20 -0
- package/docs/packages-alepha-ui-otp.md +22 -0
- package/docs/packages-alepha-ui-overview.md +337 -0
- package/docs/packages-alepha-ui-resizable.md +22 -0
- package/docs/packages-alepha-ui-settings.md +23 -0
- package/docs/packages-alepha-ui-shell.md +41 -0
- package/docs/packages-alepha-ui-table.md +37 -0
- package/docs/packages-alepha-ui-tree.md +31 -0
- package/package.json +18 -8
- package/src/account/AccountConnections.tsx +1 -1
- package/src/account/AccountDeleteDialog.tsx +25 -31
- package/src/account/AccountKeys.tsx +2 -2
- package/src/account/AccountMfaDialog.tsx +33 -27
- package/src/account/AccountPasswordDialog.tsx +36 -39
- package/src/account/AccountProfile.tsx +29 -43
- package/src/account/AccountSecurity.tsx +57 -64
- package/src/account/AccountSessions.tsx +1 -1
- package/src/account/ApiKeyCreateDialog.tsx +12 -20
- package/src/account/__tests__/AccountRouter.spec.ts +2 -1
- package/src/admin/AdminFiles.tsx +1 -1
- package/src/admin/AdminJobs.tsx +1 -1
- package/src/admin/AdminKeys.tsx +1 -1
- package/src/admin/AdminParameters.tsx +7 -5
- package/src/admin/AdminParametersTreeFooterActions.tsx +2 -2
- package/src/admin/AdminParametersTreePane.tsx +2 -2
- package/src/admin/AdminRouter.tsx +2 -4
- package/src/admin/AdminSessions.tsx +1 -1
- package/src/admin/AdminUserAvatarControl.tsx +17 -22
- package/src/admin/AdminUserDetail.tsx +4 -4
- package/src/admin/AdminUsers.tsx +10 -12
- package/src/admin/AdminUsersRolesPicker.tsx +11 -4
- package/src/admin/__tests__/AdminRouter.spec.ts +3 -2
- package/src/admin/analytics/AdvancedSection.tsx +39 -30
- package/src/admin/analytics/AnalyticsChart.tsx +7 -1
- package/src/admin/analytics/AnalyticsChartHeader.tsx +22 -7
- package/src/admin/analytics/AnalyticsChartLine.tsx +15 -2
- package/src/admin/analytics/CoarsenedBadge.tsx +38 -0
- package/src/admin/analytics/CompareNote.tsx +16 -5
- package/src/admin/analytics/FilterEditor.tsx +2 -0
- package/src/admin/analytics/GroupByChips.tsx +40 -27
- package/src/admin/analytics/MeasureChips.tsx +19 -11
- package/src/admin/analytics/QueryPanel.tsx +11 -6
- package/src/admin/analytics/RangeControl.tsx +91 -27
- package/src/admin/analytics/ResultsPane.tsx +20 -6
- package/src/admin/analytics/ResultsTable.tsx +9 -5
- package/src/admin/analytics/TotalsCards.tsx +24 -11
- package/src/admin/analytics/analyticsModel.spec.ts +167 -36
- package/src/admin/analytics/analyticsModel.ts +358 -49
- package/src/admin/analytics/analyticsTypes.ts +56 -4
- package/src/admin/analytics/chartModel.ts +139 -20
- package/src/admin/analytics/instantRangeSchema.ts +9 -0
- package/src/admin/analytics/useAnalyticsQuery.ts +98 -35
- package/src/admin/analytics/useFilterValues.ts +16 -5
- package/src/admin/useConfirmedAction.tsx +24 -10
- package/src/ai/AiChat.tsx +151 -0
- package/src/ai/AiChatConfirmCard.tsx +64 -0
- package/src/ai/AiChatHistory.tsx +60 -0
- package/src/ai/AiChatMessage.tsx +57 -0
- package/src/ai/AiFormRegistry.ts +78 -0
- package/src/ai/__tests__/AiChat.browser.spec.tsx +391 -0
- package/src/ai/aiChatMessageFormSchema.ts +8 -0
- package/src/ai/aiContextAtom.ts +23 -0
- package/src/ai/index.ts +18 -0
- package/src/ai/useAiChat.ts +343 -0
- package/src/ai/useAiContext.ts +74 -0
- package/src/auth/AuthLogin.tsx +10 -9
- package/src/auth/AuthRegister.tsx +2 -2
- package/src/core/Breadcrumb.tsx +1 -1
- package/src/core/Sheet.tsx +9 -2
- package/src/core/Sidebar.tsx +45 -22
- package/src/form/AutoForm.tsx +1 -1
- package/src/form/Control.tsx +27 -2
- package/src/form/ControlArray.tsx +5 -5
- package/src/form/ControlDate.tsx +37 -2
- package/src/form/ControlDatePopover.tsx +4 -1
- package/src/form/ControlMonthPopover.tsx +169 -0
- package/src/form/ControlSelect.tsx +64 -2
- package/src/form/ControlUpload.tsx +1 -1
- package/src/form/__tests__/ControlArrayChildChange.browser.spec.tsx +1 -1
- package/src/form/__tests__/ControlChoices.browser.spec.tsx +130 -0
- package/src/i18n/fr/uiFr.ts +36 -11
- package/src/organizations/MyOrganizationInvitations.tsx +2 -2
- package/src/organizations/OrganizationInviteDialog.tsx +1 -1
- package/src/organizations/OrganizationMembers.tsx +1 -1
- package/src/organizations/OrganizationPendingInvitations.tsx +1 -1
- package/src/organizations/OrganizationRanks.tsx +3 -3
- package/src/organizations/useInviteOrganizationMember.ts +22 -15
- package/src/organizations/useRevokeOrganizationInvitation.ts +23 -4
- package/src/shell/AppShellNavCollapse.tsx +5 -0
- package/src/shell/AppShellSidebarNavItem.tsx +23 -10
- package/src/shell/AppShellStatefulSidebarTrigger.tsx +10 -2
- package/src/shell/ButtonUser.tsx +14 -79
- package/src/shell/ButtonUserContent.tsx +92 -0
- package/src/shell/ButtonUserPlaceholder.tsx +25 -0
- package/src/shell/__tests__/ActionErrorToaster.browser.spec.tsx +1 -1
- package/src/shell/__tests__/ActionErrorToasterHandled.browser.spec.tsx +1 -2
- package/src/shell/__tests__/AppShell.pageCache.spec.tsx +67 -0
- package/src/shell/__tests__/AppShellDirection.browser.spec.tsx +95 -0
- package/src/styles.css +31 -0
- package/src/table/DataTable.tsx +3 -1
- package/src/table/DataTableFilterBar.tsx +2 -2
- package/src/table/DataTableToolbar.tsx +18 -3
- package/src/table/__tests__/DataTableFilterDateRange.browser.spec.tsx +1 -1
- package/src/table/__tests__/DataTableLeading.browser.spec.tsx +130 -0
- package/src/table/__tests__/DataTableQuerySeed.browser.spec.tsx +1 -1
- package/src/table/__tests__/DataTableShareFilters.browser.spec.tsx +1 -1
- package/src/table/dataTableBaseProps.ts +18 -1
- package/src/table/dataTableTypes.ts +3 -3
- package/src/table/useDataTableData.ts +2 -0
- package/src/table/useDataTableRefresh.ts +3 -3
- package/src/table/useDataTableSummary.ts +2 -1
|
@@ -4,7 +4,7 @@ void React;
|
|
|
4
4
|
|
|
5
5
|
import { Link } from "alepha/react/router";
|
|
6
6
|
import { ChevronRight, Lock, Minus, Plus } from "lucide-react";
|
|
7
|
-
import { useState } from "react";
|
|
7
|
+
import { useId, useState } from "react";
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
DropdownMenu,
|
|
@@ -64,6 +64,7 @@ export interface AppShellSidebarNavItemProps {
|
|
|
64
64
|
export const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {
|
|
65
65
|
const { item, path, accordion, animate, toggleIcon } = props;
|
|
66
66
|
const { state, isMobile } = useSidebar();
|
|
67
|
+
const collapseId = useId();
|
|
67
68
|
const children = item.children;
|
|
68
69
|
const isGroup = !!children && children.length > 0;
|
|
69
70
|
const hasActive = isGroup && hasActiveDescendant(item);
|
|
@@ -115,7 +116,7 @@ export const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {
|
|
|
115
116
|
style={{ cursor: "not-allowed" }}
|
|
116
117
|
>
|
|
117
118
|
{renderNavIcon(item.icon, "size-4 shrink-0")}
|
|
118
|
-
<span className="flex-1 truncate text-
|
|
119
|
+
<span className="flex-1 truncate text-start">{item.label}</span>
|
|
119
120
|
<Lock className="size-3.5 shrink-0 opacity-70" />
|
|
120
121
|
</div>
|
|
121
122
|
);
|
|
@@ -124,7 +125,11 @@ export const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {
|
|
|
124
125
|
{item.tooltip ? (
|
|
125
126
|
<HoverCard>
|
|
126
127
|
<HoverCardTrigger render={row} />
|
|
127
|
-
<HoverCardContent
|
|
128
|
+
<HoverCardContent
|
|
129
|
+
side="inline-end"
|
|
130
|
+
align="start"
|
|
131
|
+
className="text-sm"
|
|
132
|
+
>
|
|
128
133
|
{item.tooltip}
|
|
129
134
|
</HoverCardContent>
|
|
130
135
|
</HoverCard>
|
|
@@ -159,7 +164,7 @@ export const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {
|
|
|
159
164
|
const row = item.tooltip ? (
|
|
160
165
|
<Tooltip>
|
|
161
166
|
<TooltipTrigger render={link} />
|
|
162
|
-
<TooltipContent side="
|
|
167
|
+
<TooltipContent side="inline-end">{item.tooltip}</TooltipContent>
|
|
163
168
|
</Tooltip>
|
|
164
169
|
) : (
|
|
165
170
|
link
|
|
@@ -202,10 +207,14 @@ export const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {
|
|
|
202
207
|
}
|
|
203
208
|
>
|
|
204
209
|
{renderNavIcon(item.icon, "size-4")}
|
|
205
|
-
<span className="flex-1 text-
|
|
206
|
-
<ChevronRight className="size-4" />
|
|
210
|
+
<span className="flex-1 text-start">{item.label}</span>
|
|
211
|
+
<ChevronRight className="size-4 rtl:-scale-x-100" />
|
|
207
212
|
</DropdownMenuTrigger>
|
|
208
|
-
<DropdownMenuContent
|
|
213
|
+
<DropdownMenuContent
|
|
214
|
+
side="inline-end"
|
|
215
|
+
align="start"
|
|
216
|
+
className="min-w-48"
|
|
217
|
+
>
|
|
209
218
|
{/*
|
|
210
219
|
The group wrapper is required, not cosmetic: `DropdownMenuLabel`
|
|
211
220
|
is Base UI's `Menu.GroupLabel`, which reads `MenuGroupContext` and
|
|
@@ -228,11 +237,15 @@ export const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {
|
|
|
228
237
|
<SidebarMenuItem>
|
|
229
238
|
<SidebarMenuButton
|
|
230
239
|
onClick={toggle}
|
|
240
|
+
// The group is a disclosure: its state and what it opens, for
|
|
241
|
+
// assistive technology (and a test finding the open group by role).
|
|
242
|
+
aria-expanded={open}
|
|
243
|
+
aria-controls={collapseId}
|
|
231
244
|
isActive={item.active}
|
|
232
245
|
tooltip={typeof item.label === "string" ? item.label : undefined}
|
|
233
246
|
>
|
|
234
247
|
{renderNavIcon(item.icon, "size-4")}
|
|
235
|
-
<span className="flex-1 text-
|
|
248
|
+
<span className="flex-1 text-start">{item.label}</span>
|
|
236
249
|
{/*
|
|
237
250
|
Plus and minus are SWAPPED, never rotated: a plus turned 45° is a
|
|
238
251
|
close button, which is a different promise. The caret is the one
|
|
@@ -247,11 +260,11 @@ export const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {
|
|
|
247
260
|
)
|
|
248
261
|
) : (
|
|
249
262
|
<ChevronRight
|
|
250
|
-
className={`size-4 transition-transform ${open ? "rotate-90" : ""}`}
|
|
263
|
+
className={`size-4 transition-transform rtl:-scale-x-100 ${open ? "rotate-90" : ""}`}
|
|
251
264
|
/>
|
|
252
265
|
)}
|
|
253
266
|
</SidebarMenuButton>
|
|
254
|
-
<AppShellNavCollapse open={open} animate={animate}>
|
|
267
|
+
<AppShellNavCollapse id={collapseId} open={open} animate={animate}>
|
|
255
268
|
<SidebarMenuSub>
|
|
256
269
|
{children.map((child, ci) => (
|
|
257
270
|
<SidebarMenuSubItem key={child.href ?? ci}>
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
|
|
3
3
|
void React;
|
|
4
4
|
|
|
5
|
+
import { useI18n } from "alepha/react/i18n";
|
|
5
6
|
import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
6
7
|
|
|
7
8
|
import { Button } from "../core/Button.tsx";
|
|
@@ -9,6 +10,7 @@ import { useSidebar } from "../core/Sidebar.tsx";
|
|
|
9
10
|
|
|
10
11
|
export const AppShellStatefulSidebarTrigger = () => {
|
|
11
12
|
const { toggleSidebar, isMobile, openMobile, state } = useSidebar();
|
|
13
|
+
const { tr } = useI18n();
|
|
12
14
|
const open = isMobile ? openMobile : state === "expanded";
|
|
13
15
|
const Icon = open ? PanelLeftClose : PanelLeftOpen;
|
|
14
16
|
return (
|
|
@@ -16,10 +18,16 @@ export const AppShellStatefulSidebarTrigger = () => {
|
|
|
16
18
|
variant="minimal"
|
|
17
19
|
size="icon"
|
|
18
20
|
onClick={toggleSidebar}
|
|
19
|
-
aria-label={
|
|
21
|
+
aria-label={
|
|
22
|
+
open
|
|
23
|
+
? tr("nav.sidebar.collapse", { default: "Collapse sidebar" })
|
|
24
|
+
: tr("nav.sidebar.expand", { default: "Expand sidebar" })
|
|
25
|
+
}
|
|
20
26
|
className="size-8"
|
|
21
27
|
>
|
|
22
|
-
|
|
28
|
+
{/* The panel glyph points at the sidebar's edge: mirrored when the
|
|
29
|
+
page reads right to left. */}
|
|
30
|
+
<Icon className="size-4 rtl:-scale-x-100" />
|
|
23
31
|
</Button>
|
|
24
32
|
);
|
|
25
33
|
};
|
package/src/shell/ButtonUser.tsx
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
void React;
|
|
4
|
-
|
|
5
|
-
import { useAuth } from "alepha/react/auth";
|
|
6
|
-
import { LogIn, User } from "lucide-react";
|
|
1
|
+
import { Personal } from "alepha/react";
|
|
7
2
|
import type { ReactNode } from "react";
|
|
8
3
|
|
|
9
|
-
import { Button } from "../core/Button.tsx";
|
|
10
|
-
import {
|
|
11
|
-
DropdownMenu,
|
|
12
|
-
DropdownMenuContent,
|
|
13
|
-
DropdownMenuTrigger,
|
|
14
|
-
} from "../core/DropdownMenu.tsx";
|
|
15
|
-
import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.tsx";
|
|
16
|
-
import { UserAvatar } from "../core/UserAvatar.tsx";
|
|
17
4
|
import { ButtonUserAccountMenuItem } from "./ButtonUserAccountMenuItem.tsx";
|
|
18
5
|
import { ButtonUserAdminMenuItem } from "./ButtonUserAdminMenuItem.tsx";
|
|
19
|
-
import {
|
|
6
|
+
import { ButtonUserContent } from "./ButtonUserContent.tsx";
|
|
20
7
|
import { ButtonUserEmail } from "./ButtonUserEmail.tsx";
|
|
21
8
|
import { ButtonUserLogoutMenuItem } from "./ButtonUserLogoutMenuItem.tsx";
|
|
9
|
+
import { ButtonUserPlaceholder } from "./ButtonUserPlaceholder.tsx";
|
|
22
10
|
|
|
23
11
|
export interface ButtonUserProps {
|
|
24
12
|
/**
|
|
@@ -105,71 +93,18 @@ export interface ButtonUserProps {
|
|
|
105
93
|
* <DropdownMenuSeparator />
|
|
106
94
|
* <ButtonUser.LogoutMenuItem />
|
|
107
95
|
* </ButtonUser>
|
|
96
|
+
*
|
|
97
|
+
* The button reads the visitor, so it is wrapped in `<Personal>`: a page
|
|
98
|
+
* showing it is still cached for everyone (#E78), with a placeholder of the
|
|
99
|
+
* same size in the shared HTML, replaced by the real button right after
|
|
100
|
+
* hydration from the visitor's own state. On a page that is personal anyway,
|
|
101
|
+
* the server renders the real button.
|
|
108
102
|
*/
|
|
109
|
-
export const ButtonUser = (props: ButtonUserProps) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Tooltip>
|
|
116
|
-
<TooltipTrigger
|
|
117
|
-
render={
|
|
118
|
-
<Button
|
|
119
|
-
variant={props.variant ?? "minimal"}
|
|
120
|
-
size="icon"
|
|
121
|
-
aria-label={signInLabel}
|
|
122
|
-
disabled={!props.onSignIn}
|
|
123
|
-
onClick={props.onSignIn}
|
|
124
|
-
/>
|
|
125
|
-
}
|
|
126
|
-
>
|
|
127
|
-
<LogIn className="size-4" />
|
|
128
|
-
</TooltipTrigger>
|
|
129
|
-
<TooltipContent>{signInLabel}</TooltipContent>
|
|
130
|
-
</Tooltip>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const menuLabel = props.menuLabel ?? "Account menu";
|
|
135
|
-
const face =
|
|
136
|
-
props.avatar ??
|
|
137
|
-
(auth.user.picture ? (
|
|
138
|
-
<UserAvatar fileId={auth.user.picture} className="size-7" />
|
|
139
|
-
) : (
|
|
140
|
-
<User className="size-4" />
|
|
141
|
-
));
|
|
142
|
-
return (
|
|
143
|
-
<DropdownMenu>
|
|
144
|
-
<Tooltip>
|
|
145
|
-
<TooltipTrigger
|
|
146
|
-
render={
|
|
147
|
-
<DropdownMenuTrigger
|
|
148
|
-
render={
|
|
149
|
-
<Button
|
|
150
|
-
variant={props.variant ?? "minimal"}
|
|
151
|
-
size="icon"
|
|
152
|
-
aria-label={menuLabel}
|
|
153
|
-
/>
|
|
154
|
-
}
|
|
155
|
-
/>
|
|
156
|
-
}
|
|
157
|
-
>
|
|
158
|
-
{/* The tooltip and `aria-label` are untouched by the avatar: a
|
|
159
|
-
face is not a label, and "Account menu" is still the accessible
|
|
160
|
-
name of the button. */}
|
|
161
|
-
{face}
|
|
162
|
-
</TooltipTrigger>
|
|
163
|
-
<TooltipContent>{menuLabel}</TooltipContent>
|
|
164
|
-
</Tooltip>
|
|
165
|
-
<DropdownMenuContent align="end" className="w-56">
|
|
166
|
-
{props.children ?? (
|
|
167
|
-
<ButtonUserDefaultMenu onAdminClick={props.onAdminClick} />
|
|
168
|
-
)}
|
|
169
|
-
</DropdownMenuContent>
|
|
170
|
-
</DropdownMenu>
|
|
171
|
-
);
|
|
172
|
-
};
|
|
103
|
+
export const ButtonUser = (props: ButtonUserProps) => (
|
|
104
|
+
<Personal fallback={<ButtonUserPlaceholder variant={props.variant} />}>
|
|
105
|
+
<ButtonUserContent {...props} />
|
|
106
|
+
</Personal>
|
|
107
|
+
);
|
|
173
108
|
|
|
174
109
|
ButtonUser.Email = ButtonUserEmail;
|
|
175
110
|
ButtonUser.AdminMenuItem = ButtonUserAdminMenuItem;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
void React;
|
|
4
|
+
|
|
5
|
+
import { useAuth } from "alepha/react/auth";
|
|
6
|
+
import { LogIn, User } from "lucide-react";
|
|
7
|
+
|
|
8
|
+
import { Button } from "../core/Button.tsx";
|
|
9
|
+
import {
|
|
10
|
+
DropdownMenu,
|
|
11
|
+
DropdownMenuContent,
|
|
12
|
+
DropdownMenuTrigger,
|
|
13
|
+
} from "../core/DropdownMenu.tsx";
|
|
14
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.tsx";
|
|
15
|
+
import { UserAvatar } from "../core/UserAvatar.tsx";
|
|
16
|
+
import type { ButtonUserProps } from "./ButtonUser.tsx";
|
|
17
|
+
import { ButtonUserDefaultMenu } from "./ButtonUserDefaultMenu.tsx";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The account button itself. See {@link ButtonUserProps}.
|
|
21
|
+
*/
|
|
22
|
+
export type ButtonUserContentProps = ButtonUserProps;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* What `ButtonUser` renders once it may read the visitor: the sign-in icon
|
|
26
|
+
* when logged out, the avatar and its menu when logged in. Wrapped in
|
|
27
|
+
* `<Personal>` by `ButtonUser`, so a page showing it stays shareable.
|
|
28
|
+
*/
|
|
29
|
+
export const ButtonUserContent = (props: ButtonUserContentProps) => {
|
|
30
|
+
const auth = useAuth();
|
|
31
|
+
|
|
32
|
+
if (!auth.user) {
|
|
33
|
+
const signInLabel = props.signInLabel ?? "Sign in";
|
|
34
|
+
return (
|
|
35
|
+
<Tooltip>
|
|
36
|
+
<TooltipTrigger
|
|
37
|
+
render={
|
|
38
|
+
<Button
|
|
39
|
+
variant={props.variant ?? "minimal"}
|
|
40
|
+
size="icon"
|
|
41
|
+
aria-label={signInLabel}
|
|
42
|
+
disabled={!props.onSignIn}
|
|
43
|
+
onClick={props.onSignIn}
|
|
44
|
+
/>
|
|
45
|
+
}
|
|
46
|
+
>
|
|
47
|
+
<LogIn className="size-4" />
|
|
48
|
+
</TooltipTrigger>
|
|
49
|
+
<TooltipContent>{signInLabel}</TooltipContent>
|
|
50
|
+
</Tooltip>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const menuLabel = props.menuLabel ?? "Account menu";
|
|
55
|
+
const face =
|
|
56
|
+
props.avatar ??
|
|
57
|
+
(auth.user.picture ? (
|
|
58
|
+
<UserAvatar fileId={auth.user.picture} className="size-7" />
|
|
59
|
+
) : (
|
|
60
|
+
<User className="size-4" />
|
|
61
|
+
));
|
|
62
|
+
return (
|
|
63
|
+
<DropdownMenu>
|
|
64
|
+
<Tooltip>
|
|
65
|
+
<TooltipTrigger
|
|
66
|
+
render={
|
|
67
|
+
<DropdownMenuTrigger
|
|
68
|
+
render={
|
|
69
|
+
<Button
|
|
70
|
+
variant={props.variant ?? "minimal"}
|
|
71
|
+
size="icon"
|
|
72
|
+
aria-label={menuLabel}
|
|
73
|
+
/>
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
{/* The tooltip and `aria-label` are untouched by the avatar: a
|
|
79
|
+
face is not a label, and "Account menu" is still the accessible
|
|
80
|
+
name of the button. */}
|
|
81
|
+
{face}
|
|
82
|
+
</TooltipTrigger>
|
|
83
|
+
<TooltipContent>{menuLabel}</TooltipContent>
|
|
84
|
+
</Tooltip>
|
|
85
|
+
<DropdownMenuContent align="end" className="w-56">
|
|
86
|
+
{props.children ?? (
|
|
87
|
+
<ButtonUserDefaultMenu onAdminClick={props.onAdminClick} />
|
|
88
|
+
)}
|
|
89
|
+
</DropdownMenuContent>
|
|
90
|
+
</DropdownMenu>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cn } from "../core/utils.ts";
|
|
2
|
+
|
|
3
|
+
export interface ButtonUserPlaceholderProps {
|
|
4
|
+
/**
|
|
5
|
+
* The variant of the button it stands for: an outlined button keeps its
|
|
6
|
+
* border, so the swap moves nothing.
|
|
7
|
+
*/
|
|
8
|
+
variant?: "minimal" | "outlined";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* What a shared page shows where `ButtonUser` goes, before hydration: an
|
|
13
|
+
* empty slot the size of the icon button. Neither the sign-in icon nor an
|
|
14
|
+
* avatar, since the shared page cannot know which one its visitor gets.
|
|
15
|
+
*/
|
|
16
|
+
export const ButtonUserPlaceholder = (props: ButtonUserPlaceholderProps) => (
|
|
17
|
+
<span
|
|
18
|
+
aria-hidden
|
|
19
|
+
data-slot="button-user-placeholder"
|
|
20
|
+
className={cn(
|
|
21
|
+
"inline-block size-9 shrink-0 rounded-md",
|
|
22
|
+
props.variant === "outlined" && "border",
|
|
23
|
+
)}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
@@ -228,8 +228,7 @@ describe("ActionErrorToaster and handled errors", () => {
|
|
|
228
228
|
|
|
229
229
|
// The toast would read the error's own message, which is also what the
|
|
230
230
|
// field renders here: so one element with that text means no toast.
|
|
231
|
-
const message =
|
|
232
|
-
"Invalid input: Invalid identifier or password, here at /password";
|
|
231
|
+
const message = "Invalid identifier or password, here";
|
|
233
232
|
await waitFor(() =>
|
|
234
233
|
expect(screen.getByTestId("password-error").textContent).toBe(message),
|
|
235
234
|
);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Alepha } from "alepha";
|
|
2
|
+
import { AlephaReactI18n } from "alepha/react/i18n";
|
|
3
|
+
import { $page, AlephaReactRouter } from "alepha/react/router";
|
|
4
|
+
import { AlephaReactUi, uiAtom } from "alepha/react/ui";
|
|
5
|
+
import { ServerProvider } from "alepha/server";
|
|
6
|
+
import { describe, it } from "vitest";
|
|
7
|
+
|
|
8
|
+
import { AppShell } from "../AppShell.tsx";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An `AppShell` page reads no UI preference on the server (#E78): its markup
|
|
12
|
+
* is the same whatever the visitor's `alepha-ui` cookie says, so the page
|
|
13
|
+
* cache shares it between visitors who prefer different things.
|
|
14
|
+
*/
|
|
15
|
+
describe("AppShell and the page cache", () => {
|
|
16
|
+
class App {
|
|
17
|
+
layout = $page({
|
|
18
|
+
component: () => <AppShell brand="Brand" nav={[]} />,
|
|
19
|
+
children: () => [this.home],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
home = $page({
|
|
23
|
+
path: "/",
|
|
24
|
+
stream: false,
|
|
25
|
+
component: () => "home",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const cookie = (ui: object) =>
|
|
30
|
+
`alepha-ui=${encodeURIComponent(JSON.stringify(ui))}`;
|
|
31
|
+
|
|
32
|
+
it("serves the same cached page to visitors with different ui cookies", async ({
|
|
33
|
+
expect,
|
|
34
|
+
}) => {
|
|
35
|
+
const alepha = Alepha.create()
|
|
36
|
+
.with(AlephaReactRouter)
|
|
37
|
+
.with(AlephaReactI18n)
|
|
38
|
+
.with(AlephaReactUi)
|
|
39
|
+
.with(App);
|
|
40
|
+
await alepha.start();
|
|
41
|
+
const base = alepha.inject(ServerProvider).hostname;
|
|
42
|
+
|
|
43
|
+
const collapsedDark = cookie({
|
|
44
|
+
...uiAtom.options.default!,
|
|
45
|
+
mode: "dark",
|
|
46
|
+
sidebar: { collapsed: true },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const first = await fetch(`${base}/`, {
|
|
50
|
+
headers: { cookie: collapsedDark },
|
|
51
|
+
});
|
|
52
|
+
const firstBody = await first.text();
|
|
53
|
+
await new Promise((resolve) => setTimeout(resolve, 20));
|
|
54
|
+
const second = await fetch(`${base}/`);
|
|
55
|
+
const secondBody = await second.text();
|
|
56
|
+
|
|
57
|
+
// Variant, not shared: the shell is translated, so it reads the language,
|
|
58
|
+
// which every key carries anyway.
|
|
59
|
+
expect(first.headers.get("x-alepha-cache")).toBe("miss; verdict=variant");
|
|
60
|
+
expect(second.headers.get("x-alepha-cache")).toBe("hit; verdict=variant");
|
|
61
|
+
|
|
62
|
+
// The shared part is identical; only each visitor's private script differs.
|
|
63
|
+
const shared = (html: string) =>
|
|
64
|
+
html.replace(/<script id="__ssr_private"[^>]*>.*?<\/script>/, "");
|
|
65
|
+
expect(shared(secondBody)).toBe(shared(firstBody));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react";
|
|
2
|
+
import { Alepha } from "alepha";
|
|
3
|
+
import { AlephaContext } from "alepha/react";
|
|
4
|
+
import { AlephaReactI18n } from "alepha/react/i18n";
|
|
5
|
+
import { AlephaReactRouter } from "alepha/react/router";
|
|
6
|
+
import { setupJsdomMocks } from "alepha/testing/react";
|
|
7
|
+
import { afterEach, beforeAll, describe, expect, it } from "vitest";
|
|
8
|
+
|
|
9
|
+
import { AppShell } from "../AppShell.tsx";
|
|
10
|
+
import type { NavGroup } from "../appShellNav.tsx";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The shell for an app that reads right to left, and for assistive
|
|
14
|
+
* technology (#Q2760):
|
|
15
|
+
*
|
|
16
|
+
* - the sidebar sits on the inline START, so a right-to-left page puts it on
|
|
17
|
+
* the right. jsdom does no layout, so the class is the evidence: `start-0`
|
|
18
|
+
* and `border-e`, never the physical `left-0` / `border-r` it used to be
|
|
19
|
+
* pinned with;
|
|
20
|
+
* - a collapsible nav group is a disclosure: `aria-expanded` follows it, and
|
|
21
|
+
* `aria-controls` names the panel it opens;
|
|
22
|
+
* - the collapse button's name comes from the catalogue, not a literal.
|
|
23
|
+
*/
|
|
24
|
+
describe("AppShell direction and disclosure", () => {
|
|
25
|
+
let alepha: Alepha | undefined;
|
|
26
|
+
|
|
27
|
+
beforeAll(() => {
|
|
28
|
+
setupJsdomMocks();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
afterEach(async () => {
|
|
32
|
+
await alepha?.stop();
|
|
33
|
+
alepha = undefined;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const NAV: NavGroup[] = [
|
|
37
|
+
{
|
|
38
|
+
items: [
|
|
39
|
+
{
|
|
40
|
+
label: "Projects",
|
|
41
|
+
children: [{ href: "/projects/active", label: "Active" }],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const mount = async () => {
|
|
48
|
+
alepha = Alepha.create().with(AlephaReactRouter).with(AlephaReactI18n);
|
|
49
|
+
await alepha.start();
|
|
50
|
+
return render(
|
|
51
|
+
<AlephaContext.Provider value={alepha}>
|
|
52
|
+
<AppShell nav={NAV}>
|
|
53
|
+
<div />
|
|
54
|
+
</AppShell>
|
|
55
|
+
</AlephaContext.Provider>,
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
it("pins the sidebar to the inline start, not the left", async () => {
|
|
60
|
+
const ui = await mount();
|
|
61
|
+
const container = ui.container.querySelector(
|
|
62
|
+
'[data-slot="sidebar-container"]',
|
|
63
|
+
)!;
|
|
64
|
+
|
|
65
|
+
expect(container.getAttribute("data-side")).toBe("start");
|
|
66
|
+
const classes = container.getAttribute("class") ?? "";
|
|
67
|
+
expect(classes).toContain("data-[side=start]:start-0");
|
|
68
|
+
expect(classes).toContain("group-data-[side=start]:border-e");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("marks a nav group expanded or not, and names its panel", async () => {
|
|
72
|
+
await mount();
|
|
73
|
+
const group = screen.getByRole("button", { name: "Projects" });
|
|
74
|
+
|
|
75
|
+
expect(group.getAttribute("aria-expanded")).toBe("false");
|
|
76
|
+
const panelId = group.getAttribute("aria-controls")!;
|
|
77
|
+
expect(document.getElementById(panelId)?.getAttribute("data-state")).toBe(
|
|
78
|
+
"closed",
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
fireEvent.click(group);
|
|
82
|
+
expect(group.getAttribute("aria-expanded")).toBe("true");
|
|
83
|
+
expect(document.getElementById(panelId)?.getAttribute("data-state")).toBe(
|
|
84
|
+
"open",
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("names the collapse button through the catalogue", async () => {
|
|
89
|
+
await mount();
|
|
90
|
+
|
|
91
|
+
expect(
|
|
92
|
+
screen.getByRole("button", { name: "Collapse sidebar" }),
|
|
93
|
+
).toBeTruthy();
|
|
94
|
+
});
|
|
95
|
+
});
|
package/src/styles.css
CHANGED
|
@@ -893,3 +893,34 @@
|
|
|
893
893
|
) {
|
|
894
894
|
border-color: var(--border-hover);
|
|
895
895
|
}
|
|
896
|
+
|
|
897
|
+
/*
|
|
898
|
+
* A collapsed sidebar before hydration (#E78).
|
|
899
|
+
*
|
|
900
|
+
* The server renders the shell expanded for every visitor, so the page cache
|
|
901
|
+
* can share it; the visitor's preference reaches React only on the first
|
|
902
|
+
* commit after hydration. The boot script has already set
|
|
903
|
+
* `data-sidebar="collapsed"` on `<html>` from the `alepha-ui` cookie, so an
|
|
904
|
+
* EXPANDED sidebar under that attribute is the pre-hydration frame: it is held
|
|
905
|
+
* at the icon width, labels clipped, until React renders it collapsed. A
|
|
906
|
+
* sidebar the visitor expands again updates the attribute with it, so the rule
|
|
907
|
+
* never fights React after hydration.
|
|
908
|
+
*/
|
|
909
|
+
html[data-sidebar="collapsed"]
|
|
910
|
+
[data-slot="sidebar"][data-state="expanded"]
|
|
911
|
+
[data-slot="sidebar-gap"],
|
|
912
|
+
html[data-sidebar="collapsed"]
|
|
913
|
+
[data-slot="sidebar"][data-state="expanded"]
|
|
914
|
+
[data-slot="sidebar-container"] {
|
|
915
|
+
width: var(--sidebar-width-icon);
|
|
916
|
+
overflow: hidden;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
html[data-sidebar="collapsed"]
|
|
920
|
+
[data-slot="sidebar"][data-state="expanded"]:is(
|
|
921
|
+
[data-variant="floating"],
|
|
922
|
+
[data-variant="inset"]
|
|
923
|
+
)
|
|
924
|
+
:is([data-slot="sidebar-gap"], [data-slot="sidebar-container"]) {
|
|
925
|
+
width: calc(var(--sidebar-width-icon) + 1rem + 2px);
|
|
926
|
+
}
|
package/src/table/DataTable.tsx
CHANGED
|
@@ -287,7 +287,7 @@ export const DataTable = <
|
|
|
287
287
|
* Filter VALUES are deliberately not reset here: `useForm` captures its
|
|
288
288
|
* `initialValues` once, so resetting them is form surgery rather than a
|
|
289
289
|
* state assignment. They are also not clobbered - the filter-persist effect
|
|
290
|
-
* writes only on `form:
|
|
290
|
+
* writes only on `form:changed` / `form:submit:success`, never on mount - so
|
|
291
291
|
* the stored filters of the project you left stay its own.
|
|
292
292
|
*/
|
|
293
293
|
const scopeRef = useRef(props.persistenceKey);
|
|
@@ -374,6 +374,7 @@ export const DataTable = <
|
|
|
374
374
|
props.help != null && props.help !== false && props.help !== "";
|
|
375
375
|
const showToolbar =
|
|
376
376
|
Boolean(props.filters) ||
|
|
377
|
+
Boolean(props.leading) ||
|
|
377
378
|
Boolean(props.toolbar) ||
|
|
378
379
|
Boolean(props.actions?.length) ||
|
|
379
380
|
hasHelp ||
|
|
@@ -458,6 +459,7 @@ export const DataTable = <
|
|
|
458
459
|
shownFilters={filterVisibility.shown}
|
|
459
460
|
onShownFiltersChange={filterVisibility.setShown}
|
|
460
461
|
canResetFilters={canResetFilters}
|
|
462
|
+
leading={props.leading}
|
|
461
463
|
toolbar={props.toolbar}
|
|
462
464
|
actions={props.actions}
|
|
463
465
|
help={hasHelp ? props.help : undefined}
|
|
@@ -188,10 +188,10 @@ export const DataTableFilterBar = (props: DataTableFilterBarProps) => {
|
|
|
188
188
|
const enumValuesOf = (field: DataTableFilterBarField): string[] => {
|
|
189
189
|
const schema = schemaOf(field);
|
|
190
190
|
if (!schema) return [];
|
|
191
|
-
if (z.schema.isEnum(schema)) return z.schema.
|
|
191
|
+
if (z.schema.isEnum(schema)) return z.schema.enumOptions(schema);
|
|
192
192
|
if (z.schema.isArray(schema)) {
|
|
193
193
|
const element = z.schema.unwrap(z.schema.element(schema));
|
|
194
|
-
if (z.schema.isEnum(element)) return z.schema.
|
|
194
|
+
if (z.schema.isEnum(element)) return z.schema.enumOptions(element);
|
|
195
195
|
}
|
|
196
196
|
return [];
|
|
197
197
|
};
|
|
@@ -49,6 +49,10 @@ export interface DataTableToolbarProps<T> {
|
|
|
49
49
|
* differs from its declaration.
|
|
50
50
|
*/
|
|
51
51
|
canResetFilters: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The table's `leading` slot, drawn first on the row.
|
|
54
|
+
*/
|
|
55
|
+
leading?: ReactNode;
|
|
52
56
|
toolbar?: ReactNode;
|
|
53
57
|
actions?: TableAction[];
|
|
54
58
|
/**
|
|
@@ -83,9 +87,9 @@ export interface DataTableToolbarProps<T> {
|
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
|
-
* The bar above the rows: the filter form (or its
|
|
87
|
-
* caller's `toolbar` slot and `actions`, then the
|
|
88
|
-
* menu, refresh and help.
|
|
90
|
+
* The bar above the rows: the caller's `leading` slot, the filter form (or its
|
|
91
|
+
* dialog on a phone), the caller's `toolbar` slot and `actions`, then the
|
|
92
|
+
* column picker, the filter menu, refresh and help.
|
|
89
93
|
*/
|
|
90
94
|
export const DataTableToolbar = <T,>(props: DataTableToolbarProps<T>) => {
|
|
91
95
|
const {
|
|
@@ -183,6 +187,17 @@ export const DataTableToolbar = <T,>(props: DataTableToolbarProps<T>) => {
|
|
|
183
187
|
props.className,
|
|
184
188
|
)}
|
|
185
189
|
>
|
|
190
|
+
{/*
|
|
191
|
+
`leading` opens the row, before the search, and is centred like
|
|
192
|
+
`toolbar` for the same reason: it carries no label of its own. On a
|
|
193
|
+
phone it stays here too, so it still sits before the button that
|
|
194
|
+
opens the filter dialog.
|
|
195
|
+
*/}
|
|
196
|
+
{props.leading && (
|
|
197
|
+
<div className="flex min-w-0 items-center gap-2 self-center">
|
|
198
|
+
{props.leading}
|
|
199
|
+
</div>
|
|
200
|
+
)}
|
|
186
201
|
{props.filters && form && !isMobile ? (
|
|
187
202
|
// `self-stretch`: the form spans the bar's full row, so the "+" (whose
|
|
188
203
|
// own `self-center` targets this form) sits on the row's midline. It
|
|
@@ -91,7 +91,7 @@ describe("DataTable (a date range on the filter bar)", () => {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
const mount = async (
|
|
94
|
-
url = "/list",
|
|
94
|
+
url: `/${string}` = "/list",
|
|
95
95
|
options: { seedValues?: { createdAt?: string[] } } = {},
|
|
96
96
|
) => {
|
|
97
97
|
alepha = Alepha.create().with(AlephaReact).with(AlephaReactI18n).with(App);
|