@alepha/ui 0.36.0 → 0.37.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 +1 -1
- package/dist/account/$pageAccount.d.ts.map +1 -1
- package/dist/account/$pageAccount.js.map +1 -1
- package/dist/account/AccountDisplay.d.ts +13 -0
- package/dist/account/AccountDisplay.d.ts.map +1 -0
- package/dist/account/AccountDisplay.js +48 -0
- package/dist/account/AccountDisplay.js.map +1 -0
- package/dist/account/AccountProfile.d.ts.map +1 -1
- package/dist/account/AccountProfile.js +14 -10
- package/dist/account/AccountProfile.js.map +1 -1
- package/dist/account/AccountRouter.d.ts +6 -6
- package/dist/account/AccountRouter.d.ts.map +1 -1
- package/dist/account/index.d.ts +5 -0
- package/dist/account/index.d.ts.map +1 -1
- package/dist/account/index.js +2 -1
- package/dist/admin/$pageAdmin.d.ts +1 -1
- package/dist/admin/$pageAdmin.d.ts.map +1 -1
- package/dist/admin/$pageAdmin.js.map +1 -1
- package/dist/admin/AdminAudits.js.map +1 -1
- package/dist/admin/AdminJobDetail.js.map +1 -1
- package/dist/admin/AdminJobs.js.map +1 -1
- package/dist/admin/AdminNotifications.js.map +1 -1
- package/dist/admin/AdminRouter.d.ts +14 -14
- package/dist/admin/AdminRouter.d.ts.map +1 -1
- package/dist/admin/AdminUserDetail.js.map +1 -1
- package/dist/admin/AdminUsers.js.map +1 -1
- package/dist/admin/ParameterHistoryItem.js.map +1 -1
- package/dist/ai/AiChat.d.ts +26 -39
- package/dist/ai/AiChat.d.ts.map +1 -1
- package/dist/ai/AiChat.js +65 -123
- package/dist/ai/AiChat.js.map +1 -1
- package/dist/ai/AiChatDock.d.ts +23 -0
- package/dist/ai/AiChatDock.d.ts.map +1 -0
- package/dist/ai/AiChatDock.js +90 -0
- package/dist/ai/AiChatDock.js.map +1 -0
- package/dist/ai/AiChatDockSlot.d.ts +15 -0
- package/dist/ai/AiChatDockSlot.d.ts.map +1 -0
- package/dist/ai/AiChatDockSlot.js +20 -0
- package/dist/ai/AiChatDockSlot.js.map +1 -0
- package/dist/ai/AiChatLauncher.d.ts +17 -0
- package/dist/ai/AiChatLauncher.d.ts.map +1 -0
- package/dist/ai/AiChatLauncher.js +42 -0
- package/dist/ai/AiChatLauncher.js.map +1 -0
- package/dist/ai/AiChatMessage.d.ts +7 -1
- package/dist/ai/AiChatMessage.d.ts.map +1 -1
- package/dist/ai/AiChatMessage.js +27 -7
- package/dist/ai/AiChatMessage.js.map +1 -1
- package/dist/ai/AiChatPanel.d.ts +71 -0
- package/dist/ai/AiChatPanel.d.ts.map +1 -0
- package/dist/ai/AiChatPanel.js +143 -0
- package/dist/ai/AiChatPanel.js.map +1 -0
- package/dist/ai/index.d.ts +8 -4
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -1
- package/dist/ai/useAiChat.d.ts +17 -0
- package/dist/ai/useAiChat.d.ts.map +1 -1
- package/dist/ai/useAiChat.js +38 -17
- package/dist/ai/useAiChat.js.map +1 -1
- package/dist/auth/AuthLogin.d.ts +9 -0
- package/dist/auth/AuthLogin.d.ts.map +1 -1
- package/dist/auth/AuthLogin.js +2 -2
- package/dist/auth/AuthLogin.js.map +1 -1
- package/dist/auth/AuthRegister.d.ts +4 -1
- package/dist/auth/AuthRegister.d.ts.map +1 -1
- package/dist/auth/AuthRegister.js +1 -1
- package/dist/auth/AuthRegister.js.map +1 -1
- package/dist/auth/AuthResetPassword.d.ts +8 -0
- package/dist/auth/AuthResetPassword.d.ts.map +1 -1
- package/dist/auth/AuthResetPassword.js +2 -2
- package/dist/auth/AuthResetPassword.js.map +1 -1
- package/dist/auth/AuthRouter.d.ts +4 -4
- package/dist/auth/AuthRouter.d.ts.map +1 -1
- package/dist/core/Badge.d.ts.map +1 -1
- package/dist/core/Badge.js +7 -3
- package/dist/core/Badge.js.map +1 -1
- package/dist/core/Collapsible.d.ts +50 -0
- package/dist/core/Collapsible.d.ts.map +1 -0
- package/dist/core/Collapsible.js +70 -0
- package/dist/core/Collapsible.js.map +1 -0
- package/dist/core/Combobox.d.ts +7 -1
- package/dist/core/Combobox.d.ts.map +1 -1
- package/dist/core/Combobox.js +2 -2
- package/dist/core/Combobox.js.map +1 -1
- package/dist/core/PaneRail.d.ts +24 -7
- package/dist/core/PaneRail.d.ts.map +1 -1
- package/dist/core/PaneRail.js +24 -19
- package/dist/core/PaneRail.js.map +1 -1
- package/dist/core/Stepper.d.ts +36 -0
- package/dist/core/Stepper.d.ts.map +1 -0
- package/dist/core/Stepper.js +54 -0
- package/dist/core/Stepper.js.map +1 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/useToast.js +13 -13
- package/dist/core/useToast.js.map +1 -1
- package/dist/form/AutoForm.d.ts.map +1 -1
- package/dist/form/AutoForm.js +29 -0
- package/dist/form/AutoForm.js.map +1 -1
- package/dist/form/AutoFormErrorPopover.js +13 -3
- package/dist/form/AutoFormErrorPopover.js.map +1 -1
- package/dist/form/Control.d.ts +14 -1
- package/dist/form/Control.d.ts.map +1 -1
- package/dist/form/Control.js +12 -2
- package/dist/form/Control.js.map +1 -1
- package/dist/form/ControlDate.d.ts.map +1 -1
- package/dist/form/ControlDate.js +3 -0
- package/dist/form/ControlDate.js.map +1 -1
- package/dist/form/ControlDateRange.d.ts +12 -1
- package/dist/form/ControlDateRange.d.ts.map +1 -1
- package/dist/form/ControlDateRange.js +11 -1
- package/dist/form/ControlDateRange.js.map +1 -1
- package/dist/form/ControlNumber.d.ts.map +1 -1
- package/dist/form/ControlNumber.js +2 -0
- package/dist/form/ControlNumber.js.map +1 -1
- package/dist/form/ControlObject.d.ts.map +1 -1
- package/dist/form/ControlObject.js +15 -1
- package/dist/form/ControlObject.js.map +1 -1
- package/dist/form/ControlPassword.d.ts +4 -0
- package/dist/form/ControlPassword.d.ts.map +1 -1
- package/dist/form/ControlPassword.js +1 -0
- package/dist/form/ControlPassword.js.map +1 -1
- package/dist/form/ControlSelect.d.ts +23 -1
- package/dist/form/ControlSelect.d.ts.map +1 -1
- package/dist/form/ControlSelect.js +5 -0
- package/dist/form/ControlSelect.js.map +1 -1
- package/dist/form/ControlSelectCombobox.d.ts +11 -1
- package/dist/form/ControlSelectCombobox.d.ts.map +1 -1
- package/dist/form/ControlSelectCombobox.js +9 -1
- package/dist/form/ControlSelectCombobox.js.map +1 -1
- package/dist/form/ControlUpload.d.ts.map +1 -1
- package/dist/form/ControlUpload.js +1 -0
- package/dist/form/ControlUpload.js.map +1 -1
- package/dist/form/FormField.d.ts +5 -0
- package/dist/form/FormField.d.ts.map +1 -1
- package/dist/form/FormField.js +7 -0
- package/dist/form/FormField.js.map +1 -1
- package/dist/i18n/fr/uiFr.d.ts.map +1 -1
- package/dist/i18n/fr/uiFr.js +15 -0
- package/dist/i18n/fr/uiFr.js.map +1 -1
- package/dist/shell/$pageNav.d.ts +2 -2
- package/dist/shell/$pageNav.d.ts.map +1 -1
- package/dist/shell/$pageNav.js.map +1 -1
- package/dist/shell/AppShell.d.ts +6 -0
- package/dist/shell/AppShell.d.ts.map +1 -1
- package/dist/shell/AppShell.js +31 -27
- package/dist/shell/AppShell.js.map +1 -1
- package/dist/shell/ButtonSettings.d.ts +6 -2
- package/dist/shell/ButtonSettings.d.ts.map +1 -1
- package/dist/shell/ButtonSettings.js +17 -3
- package/dist/shell/ButtonSettings.js.map +1 -1
- package/dist/shell/ButtonSettingsVisionMenuItem.d.ts +16 -0
- package/dist/shell/ButtonSettingsVisionMenuItem.d.ts.map +1 -0
- package/dist/shell/ButtonSettingsVisionMenuItem.js +24 -0
- package/dist/shell/ButtonSettingsVisionMenuItem.js.map +1 -0
- package/dist/shell/ButtonVision.d.ts +28 -0
- package/dist/shell/ButtonVision.d.ts.map +1 -0
- package/dist/shell/ButtonVision.js +46 -0
- package/dist/shell/ButtonVision.js.map +1 -0
- package/dist/shell/index.d.ts +6 -3
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +2 -1
- package/dist/styles.css +57 -0
- package/dist/table/DataTable.d.ts.map +1 -1
- package/dist/table/DataTable.js +29 -4
- package/dist/table/DataTable.js.map +1 -1
- package/dist/table/DataTableColumnPicker.d.ts.map +1 -1
- package/dist/table/DataTableColumnPicker.js +1 -0
- package/dist/table/DataTableColumnPicker.js.map +1 -1
- package/dist/table/DataTableFilterBar.d.ts +1 -1
- package/dist/table/DataTableFilterBar.d.ts.map +1 -1
- package/dist/table/DataTableFilterBar.js +5 -108
- package/dist/table/DataTableFilterBar.js.map +1 -1
- package/dist/table/DataTableHeaderFilter.d.ts +51 -0
- package/dist/table/DataTableHeaderFilter.d.ts.map +1 -0
- package/dist/table/DataTableHeaderFilter.js +113 -0
- package/dist/table/DataTableHeaderFilter.js.map +1 -0
- package/dist/table/DataTableHeaderRow.d.ts +7 -0
- package/dist/table/DataTableHeaderRow.d.ts.map +1 -1
- package/dist/table/DataTableHeaderRow.js +92 -74
- package/dist/table/DataTableHeaderRow.js.map +1 -1
- package/dist/table/DataTableTabs.d.ts +42 -0
- package/dist/table/DataTableTabs.d.ts.map +1 -0
- package/dist/table/DataTableTabs.js +55 -0
- package/dist/table/DataTableTabs.js.map +1 -0
- package/dist/table/dataTableBaseProps.d.ts +12 -0
- package/dist/table/dataTableBaseProps.d.ts.map +1 -1
- package/dist/table/dataTablePersistence.d.ts.map +1 -1
- package/dist/table/dataTablePersistence.js +4 -2
- package/dist/table/dataTablePersistence.js.map +1 -1
- package/dist/table/dataTableTypes.d.ts +18 -0
- package/dist/table/dataTableTypes.d.ts.map +1 -1
- package/dist/table/index.d.ts +5 -2
- package/dist/table/index.d.ts.map +1 -1
- package/dist/table/index.js +2 -1
- package/dist/table/useDataTableColumns.d.ts.map +1 -1
- package/dist/table/useDataTableColumns.js +1 -0
- package/dist/table/useDataTableColumns.js.map +1 -1
- package/dist/table/useDataTableFilterModel.d.ts +110 -0
- package/dist/table/useDataTableFilterModel.d.ts.map +1 -0
- package/dist/table/useDataTableFilterModel.js +154 -0
- package/dist/table/useDataTableFilterModel.js.map +1 -0
- package/docs/packages-alepha-ui-account.md +4 -0
- package/docs/packages-alepha-ui-ai.md +5 -5
- package/docs/packages-alepha-ui-shell.md +4 -3
- package/docs/packages-alepha-ui-table.md +4 -2
- package/package.json +8 -8
- package/src/account/$pageAccount.tsx +5 -4
- package/src/account/AccountDisplay.tsx +58 -0
- package/src/account/AccountProfile.tsx +30 -42
- package/src/account/__tests__/AccountProfile.browser.spec.tsx +141 -0
- package/src/account/__tests__/AccountRecoveryCodes.browser.spec.tsx +1 -1
- package/src/account/index.ts +5 -0
- package/src/admin/$pageAdmin.tsx +5 -4
- package/src/admin/AdminAudits.tsx +1 -1
- package/src/admin/AdminJobDetail.tsx +1 -1
- package/src/admin/AdminJobs.tsx +1 -1
- package/src/admin/AdminNotifications.tsx +1 -1
- package/src/admin/AdminUserDetail.tsx +1 -1
- package/src/admin/AdminUsers.tsx +1 -1
- package/src/admin/ParameterHistoryItem.tsx +1 -1
- package/src/admin/__tests__/AdminFilesUsageCard.browser.spec.tsx +17 -9
- package/src/ai/AiChat.tsx +94 -183
- package/src/ai/AiChatDock.tsx +129 -0
- package/src/ai/AiChatDockSlot.tsx +23 -0
- package/src/ai/AiChatLauncher.tsx +58 -0
- package/src/ai/AiChatMessage.tsx +48 -9
- package/src/ai/AiChatPanel.tsx +252 -0
- package/src/ai/__tests__/AiChat.browser.spec.tsx +197 -5
- package/src/ai/index.ts +8 -4
- package/src/ai/useAiChat.ts +80 -14
- package/src/auth/AuthLogin.tsx +19 -4
- package/src/auth/AuthRegister.tsx +6 -3
- package/src/auth/AuthResetPassword.tsx +18 -8
- package/src/auth/__tests__/AuthCancel.browser.spec.tsx +129 -0
- package/src/core/Badge.tsx +7 -3
- package/src/core/Collapsible.tsx +95 -0
- package/src/core/Combobox.tsx +11 -3
- package/src/core/PaneRail.tsx +36 -20
- package/src/core/Stepper.tsx +118 -0
- package/src/core/__tests__/Badge.browser.spec.tsx +5 -5
- package/src/core/__tests__/Collapsible.browser.spec.tsx +88 -0
- package/src/core/__tests__/PaneRail.browser.spec.tsx +48 -0
- package/src/core/__tests__/Stepper.browser.spec.tsx +39 -0
- package/src/core/__tests__/primitiveSlots.spec.ts +7 -0
- package/src/core/index.ts +15 -0
- package/src/form/AutoForm.tsx +32 -0
- package/src/form/AutoFormErrorPopover.tsx +27 -6
- package/src/form/Control.tsx +22 -0
- package/src/form/ControlDate.tsx +3 -0
- package/src/form/ControlDateRange.tsx +87 -58
- package/src/form/ControlNumber.tsx +2 -0
- package/src/form/ControlObject.tsx +20 -1
- package/src/form/ControlPassword.tsx +5 -0
- package/src/form/ControlSelect.tsx +32 -1
- package/src/form/ControlSelectCombobox.tsx +82 -56
- package/src/form/ControlUpload.tsx +1 -0
- package/src/form/FormField.tsx +23 -1
- package/src/form/__tests__/ControlFieldErrors.browser.spec.tsx +253 -0
- package/src/form/__tests__/ControlValidateMode.browser.spec.tsx +217 -0
- package/src/form/__tests__/ControlVariantErrors.browser.spec.tsx +133 -0
- package/src/i18n/fr/uiFr.ts +19 -1
- package/src/markdown/css.d.ts +11 -0
- package/src/shell/$pageNav.tsx +6 -4
- package/src/shell/AppShell.tsx +7 -0
- package/src/shell/ButtonSettings.tsx +20 -5
- package/src/shell/ButtonSettingsVisionMenuItem.tsx +40 -0
- package/src/shell/ButtonVision.tsx +73 -0
- package/src/shell/__tests__/ButtonSettings.browser.spec.tsx +42 -2
- package/src/shell/__tests__/ButtonVision.browser.spec.tsx +73 -0
- package/src/shell/__tests__/visionTokens.spec.ts +104 -0
- package/src/shell/index.ts +6 -3
- package/src/styles.css +57 -0
- package/src/table/DataTable.tsx +52 -4
- package/src/table/DataTableColumnPicker.tsx +3 -0
- package/src/table/DataTableFilterBar.tsx +18 -191
- package/src/table/DataTableHeaderFilter.tsx +156 -0
- package/src/table/DataTableHeaderRow.tsx +78 -40
- package/src/table/DataTableTabs.tsx +114 -0
- package/src/table/__tests__/DataTableHeaderFilter.browser.spec.tsx +174 -0
- package/src/table/__tests__/DataTableStaleColumns.browser.spec.tsx +80 -0
- package/src/table/__tests__/DataTableTabs.browser.spec.tsx +72 -0
- package/src/table/dataTableBaseProps.ts +12 -0
- package/src/table/dataTablePersistence.ts +11 -5
- package/src/table/dataTableTypes.ts +18 -0
- package/src/table/index.ts +9 -2
- package/src/table/useDataTableColumns.ts +1 -0
- package/src/table/useDataTableFilterModel.tsx +240 -0
package/dist/shell/AppShell.js
CHANGED
|
@@ -81,33 +81,37 @@ const AppShell = (props) => {
|
|
|
81
81
|
open: !collapsed,
|
|
82
82
|
onOpenChange: (o) => setCollapsed(!o),
|
|
83
83
|
className: props.fill ? "relative h-full min-h-0 [&_[data-slot=sidebar-container]]:absolute [&_[data-slot=sidebar-container]]:h-auto" : void 0,
|
|
84
|
-
children: [
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
item,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
className: "bg-
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ jsx(Sidebar, {
|
|
86
|
+
collapsible: "icon",
|
|
87
|
+
variant,
|
|
88
|
+
children: /* @__PURE__ */ jsxs(SidebarNavAutoClose, { children: [
|
|
89
|
+
/* @__PURE__ */ jsx(SidebarHeader, { children: props.brand }),
|
|
90
|
+
/* @__PURE__ */ jsx(SidebarContent, { children: nav.map((group, gi) => /* @__PURE__ */ jsxs(SidebarGroup, { children: [group.label && /* @__PURE__ */ jsx(SidebarGroupLabel, { children: group.label }), /* @__PURE__ */ jsx(SidebarGroupContent, { children: /* @__PURE__ */ jsx(SidebarMenu, { children: group.items.map((item, ii) => /* @__PURE__ */ jsx(AppShellSidebarNavItem, {
|
|
91
|
+
item,
|
|
92
|
+
path: [gi, ii],
|
|
93
|
+
accordion: navAccordion ? {
|
|
94
|
+
openPath,
|
|
95
|
+
setOpenPath
|
|
96
|
+
} : void 0,
|
|
97
|
+
animate: navAnimate,
|
|
98
|
+
toggleIcon: navToggleIcon
|
|
99
|
+
}, item.href ?? `${gi}-${ii}`)) }) })] }, gi)) }),
|
|
100
|
+
props.sidebarFooter && /* @__PURE__ */ jsx(SidebarFooter, { children: props.sidebarFooter })
|
|
101
|
+
] })
|
|
102
|
+
}),
|
|
103
|
+
headerOutside ? /* @__PURE__ */ jsxs("div", {
|
|
104
|
+
className: "bg-sidebar flex flex-1 flex-col",
|
|
105
|
+
children: [headerNode, /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "bg-background m-2 mt-0 flex flex-1 flex-col overflow-hidden rounded-xl border shadow-sm",
|
|
107
|
+
children: mainNode
|
|
108
|
+
})]
|
|
109
|
+
}) : /* @__PURE__ */ jsxs(SidebarInset, {
|
|
110
|
+
className: variant === "inset" ? "border md:peer-data-[variant=inset]:overflow-hidden" : void 0,
|
|
111
|
+
children: [headerNode, mainNode]
|
|
112
|
+
}),
|
|
113
|
+
props.aside
|
|
114
|
+
]
|
|
111
115
|
})] });
|
|
112
116
|
if (props.embedded) return renderBody();
|
|
113
117
|
const errorToaster = props.actionErrorToaster ?? true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.js","names":[],"sources":["../../src/shell/AppShell.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"../core/utils.ts\";\n\nvoid React;\n\nimport { Link, NestedView } from \"alepha/react/router\";\nimport { useSidebarState } from \"alepha/react/ui\";\nimport type { ReactNode } from \"react\";\nimport { Fragment, useState } from \"react\";\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"../core/Breadcrumb.tsx\";\nimport { Separator } from \"../core/Separator.tsx\";\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInset,\n SidebarMenu,\n SidebarProvider,\n} from \"../core/Sidebar.tsx\";\nimport { Toaster } from \"../core/Toaster.tsx\";\nimport { TooltipProvider } from \"../core/Tooltip.tsx\";\nimport { DialogProvider } from \"../core/useDialog.tsx\";\nimport {\n ActionErrorToaster,\n type ActionErrorToasterProps,\n} from \"./ActionErrorToaster.tsx\";\nimport { findOpenPath, type NavGroup, samePath } from \"./appShellNav.tsx\";\nimport { AppShellSidebarNavItem } from \"./AppShellSidebarNavItem.tsx\";\nimport { AppShellStatefulSidebarTrigger } from \"./AppShellStatefulSidebarTrigger.tsx\";\nimport {\n NavigationProgress,\n type NavigationProgressOptions,\n} from \"./NavigationProgress.tsx\";\nimport { SidebarNavAutoClose } from \"./SidebarNavAutoClose.tsx\";\n\n/**\n * Re-exported: the bar moved to its own module so it can be mounted at an\n * application root, but the option type is part of {@link AppShellProps}\n * and was importable from here first.\n */\nexport type { NavigationProgressOptions };\n\nexport interface AppShellProps {\n /**\n * Branding shown at the top of the sidebar.\n */\n brand?: ReactNode;\n /**\n * Sidebar navigation groups.\n */\n nav?: NavGroup[];\n /**\n * Keep at most ONE nav group open at a time. Defaults to `true`.\n *\n * Opening a group closes the one that was open beside it, the way an\n * accordion does. Exclusivity is per level, so a nested group opens inside\n * its parent rather than replacing it, and the open branch always runs from\n * the root to the deepest open group.\n *\n * On means the sidebar owns the open state, so `NavItem.defaultOpen` seeds\n * the branch rather than opening a group of its own: the first item asking\n * for it wins, and only when nothing is active. Pass `false` for the older\n * behaviour, where every group keeps its own state and any number can be\n * open at once.\n *\n * ⚠️ Nothing changes in the icon rail. Collapsed to icons a group is a\n * dropdown, and one dropdown at a time is already all a menu can do.\n */\n navAccordion?: boolean;\n /**\n * Slide a nav group open and shut instead of swapping it in. Defaults to\n * `true`.\n *\n * `false` is a snap, not a shorter animation: an app that wants a different\n * duration or curve should style\n * `[data-slot=sidebar-menu-item] [data-state]` rather than turn this off.\n *\n * ⚠️ Honours `prefers-reduced-motion` on its own, so this is not the switch\n * for accessibility. It exists for a shell embedded somewhere that owns its\n * own motion, and for a test that would rather not wait 200ms.\n */\n navAnimate?: boolean;\n /**\n * Which glyph a collapsible nav group carries. Defaults to `\"caret\"`.\n *\n * - `\"caret\"` - a chevron that turns a quarter clockwise when the group\n * opens. One glyph, and the rotation is the state.\n * - `\"plusMinus\"` - a plus when shut, a minus when open. Two glyphs that\n * name the two states outright, where a caret only points and leaves the\n * reader to learn which direction means open.\n *\n * ⚠️ Nothing in the icon rail. Collapsed, a group is a dropdown that opens\n * to the RIGHT, so its chevron is a direction rather than a state and there\n * is no minus that could answer it.\n */\n navToggleIcon?: \"caret\" | \"plusMinus\";\n /**\n * Content rendered at the bottom of the sidebar (user menu, etc.).\n */\n sidebarFooter?: ReactNode;\n /**\n * Breadcrumb crumbs (last one is rendered as the current page).\n */\n breadcrumbs?: { label: ReactNode; href?: string }[];\n /**\n * Top-bar right-side content (search, theme toggle, user menu).\n */\n topbarActions?: ReactNode;\n /**\n * Layout variant.\n * - `sidebar` (default): sidebar and page sit flush side-by-side.\n * - `inset`: sidebar uses the global background; the page is a rounded card with margin.\n * - `floating`: the page uses the global background; the sidebar is a rounded card with margin.\n */\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n /**\n * When `variant=\"inset\"`, lift the header out of the floating card so it\n * sits on the sidebar background — only the main page becomes the card.\n * Has no effect on other variants.\n */\n headerOutside?: boolean;\n /**\n * Top loading bar shown during route transitions.\n * `true` (default) enables it with default styling, `false` disables it,\n * or pass an options object to customize.\n */\n progress?: boolean | NavigationProgressOptions;\n /**\n * Page content. Defaults to `<NestedView />` (renders the active route).\n */\n children?: ReactNode;\n /**\n * Surface failed `useAction` / `useQuery` calls as a toast (via the\n * `react:action:error` event). `true` (default) enables it, `false`\n * disables it, or pass an options object to configure\n * (see {@link ActionErrorToasterProps}). Ignored when `embedded` (the\n * parent layout owns the toaster).\n */\n actionErrorToaster?: boolean | ActionErrorToasterProps;\n /**\n * When `true`, the shell assumes it is mounted inside an outer provider tree\n * and skips its own `<DialogProvider>` and `<Toaster />` wrappers. Use this\n * when a parent layout already provides them.\n */\n embedded?: boolean;\n /**\n * When `true`, the shell fills its parent container instead of the viewport\n * (`min-h-svh`). Use when a parent layout owns the height (e.g. when a\n * sticky footer sits below the shell).\n */\n fill?: boolean;\n /**\n * Extra classes for the scrolling `<main>` element.\n *\n * Exists so an app can paint its own page surface (Lore stamps a dot\n * texture there) without every other consumer of the shell inheriting it.\n * Layout classes are applied after this, so a caller cannot break the\n * flex/overflow contract described above.\n */\n mainClassName?: string;\n}\n\n/**\n * Standard SaaS layout: collapsible sidebar + topbar with breadcrumbs.\n * Built on shadcn `<Sidebar>` + `<Breadcrumb>`.\n */\nexport const AppShell = (props: AppShellProps) => {\n const { collapsed, setCollapsed } = useSidebarState();\n const nav = props.nav ?? [];\n\n // The accordion's one open branch. Held here because exclusivity is a\n // question about SIBLINGS, and no nav item can see its own.\n const navAccordion = props.navAccordion ?? true;\n const navAnimate = props.navAnimate ?? true;\n const navToggleIcon = props.navToggleIcon ?? \"caret\";\n const wantedOpenPath = findOpenPath(nav);\n const [openPath, setOpenPath] = useState(wantedOpenPath);\n // Follow the active page. Set during render of THIS component, which is the\n // supported way to react to changed input without a wasted frame; the same\n // pattern a nav item uses for its own state when the accordion is off.\n // Only ever opens: `findOpenPath` returns an empty path when nothing is\n // active and nothing asked for `defaultOpen`, and adopting that would slam\n // the branch shut on every navigation to a top-level page.\n const [lastWanted, setLastWanted] = useState(wantedOpenPath);\n if (!samePath(wantedOpenPath, lastWanted)) {\n setLastWanted(wantedOpenPath);\n if (wantedOpenPath.length > 0) setOpenPath(wantedOpenPath);\n }\n const variant = props.variant ?? \"sidebar\";\n const progress = props.progress ?? true;\n const headerOutside = !!props.headerOutside && variant === \"inset\";\n\n const headerNode = (\n <header\n className={\n headerOutside\n ? \"bg-sidebar flex h-14 shrink-0 items-center gap-2 px-4\"\n : \"bg-background flex h-14 shrink-0 items-center gap-2 border-b px-4\"\n }\n >\n {/* This bar is one non-wrapping flex line, and on a Lore project page it\n carries the trigger, a separator, the breadcrumbs, a split button,\n the search button and four header icons: about 470px of content in\n 373px at phone width. Nothing here used to be marked as the one that\n must survive, so the overflow fell off the RIGHT end and took the\n theme, colour-mode and account controls with it — off-screen, with no\n horizontal scroll to reach them and no menu they collapse into.\n\n So everything on the row is `shrink-0` with exactly one exception:\n the breadcrumbs, which are the one thing repeated in the page below\n and can therefore afford to give way. They truncate while there is\n still something to read, and below `sm` they are dropped outright\n rather than left as an unreadable sliver. */}\n <div className=\"flex shrink-0 items-center\">\n <AppShellStatefulSidebarTrigger />\n <Separator orientation=\"vertical\" className=\"mx-2\" />\n </div>\n {props.breadcrumbs && props.breadcrumbs.length > 0 && (\n <Breadcrumb className=\"min-w-0 overflow-hidden max-sm:hidden\">\n {/* `flex-nowrap`: the list wraps by default, and a second line in an\n `h-14` bar is drawn outside it. */}\n <BreadcrumbList className=\"flex-nowrap\">\n {props.breadcrumbs.map((crumb, i) => {\n const last = i === props.breadcrumbs!.length - 1;\n return (\n <Fragment key={i}>\n <BreadcrumbItem className=\"min-w-0\">\n {last || !crumb.href ? (\n <BreadcrumbPage className=\"truncate\">\n {crumb.label}\n </BreadcrumbPage>\n ) : (\n <BreadcrumbLink\n className=\"truncate\"\n render={<Link href={crumb.href} />}\n >\n {crumb.label}\n </BreadcrumbLink>\n )}\n </BreadcrumbItem>\n {!last && <BreadcrumbSeparator className=\"shrink-0\" />}\n </Fragment>\n );\n })}\n </BreadcrumbList>\n </Breadcrumb>\n )}\n <div className=\"flex-1\" />\n {/* Wrapped rather than spread straight into the header: the actions have\n to be one `shrink-0` unit, and they keep the `gap-2` the header was\n giving them. */}\n <div className=\"flex shrink-0 items-center gap-2\">\n {props.topbarActions}\n </div>\n </header>\n );\n\n const mainNode = (\n // Layout contract for `fill: true` pages:\n // parent (`h-svh`) → SidebarProvider (`h-full`) → SidebarInset → main\n // - main is `flex flex-col min-h-0 flex-1` so its children can\n // claim the leftover height via `flex-1 min-h-0`.\n // - main itself is `overflow-hidden` (not `overflow-auto`) so the\n // table's inner `overflow-auto` is the actual scroll surface —\n // header stays sticky, body scrolls, no page-level scrollbar.\n // - For non-fill pages there's no height bound, so this collapses\n // to \"scroll whatever overflows\" without further config.\n //\n // `relative` is load-bearing in BOTH branches, and it is the whole of\n // #1849: an `overflow` declared on a STATIC element does not clip an\n // absolutely positioned descendant whose containing block resolves above\n // it. Base UI gives every named form control a 1×1 hidden `<input>`\n // styled `position: absolute` with no offsets, so on a page whose fields\n // live inside an inner scroller each of those inputs escaped this `main`,\n // resolved against the positioned `SidebarInset` and pinned the document\n // open at its own static offset — a page that scrolled 1271px into empty\n // background beneath a shell that had not moved. Positioning `main` makes\n // its overflow bound real, whatever a page renders inside it.\n <main\n className={cn(\n props.mainClassName,\n \"relative\",\n props.fill\n ? \"flex min-h-0 flex-1 flex-col overflow-hidden\"\n : \"flex-1 overflow-auto\",\n )}\n >\n {props.children ?? <NestedView />}\n </main>\n );\n const renderBody = () => (\n <>\n {progress !== false && (\n <NavigationProgress {...(progress === true ? {} : progress)} />\n )}\n <SidebarProvider\n open={!collapsed}\n onOpenChange={(o: boolean) => setCollapsed(!o)}\n // `fill` = a parent owns the height (e.g. a full-width banner above\n // the shell). The desktop sidebar is `fixed inset-y-0 h-svh` (pinned\n // to the VIEWPORT), so it would overlap whatever sits above the\n // shell — re-anchor it to this wrapper instead (absolute within the\n // now-relative provider, height from the wrapper). The arbitrary\n // selectors out-specify the base `.fixed`/`.h-svh` utilities.\n className={\n props.fill\n ? \"relative h-full min-h-0 [&_[data-slot=sidebar-container]]:absolute [&_[data-slot=sidebar-container]]:h-auto\"\n : undefined\n }\n >\n <Sidebar collapsible=\"icon\" variant={variant}>\n {/* Wraps the WHOLE sidebar, brand slot and footer included, because\n the links that leave this sheet are not only the nav items - the\n project switcher lives in `brand` and each app puts its own\n links in `sidebarFooter`. */}\n <SidebarNavAutoClose>\n <SidebarHeader>{props.brand}</SidebarHeader>\n <SidebarContent>\n {nav.map((group, gi) => (\n <SidebarGroup key={gi}>\n {group.label && (\n <SidebarGroupLabel>{group.label}</SidebarGroupLabel>\n )}\n <SidebarGroupContent>\n <SidebarMenu>\n {group.items.map((item, ii) => (\n <AppShellSidebarNavItem\n key={item.href ?? `${gi}-${ii}`}\n item={item}\n path={[gi, ii]}\n accordion={\n navAccordion ? { openPath, setOpenPath } : undefined\n }\n animate={navAnimate}\n toggleIcon={navToggleIcon}\n />\n ))}\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n ))}\n </SidebarContent>\n {props.sidebarFooter && (\n <SidebarFooter>{props.sidebarFooter}</SidebarFooter>\n )}\n </SidebarNavAutoClose>\n </Sidebar>\n {headerOutside ? (\n <div className=\"bg-sidebar flex flex-1 flex-col\">\n {headerNode}\n <div className=\"bg-background m-2 mt-0 flex flex-1 flex-col overflow-hidden rounded-xl border shadow-sm\">\n {mainNode}\n </div>\n </div>\n ) : (\n <SidebarInset\n className={\n variant === \"inset\"\n ? \"border md:peer-data-[variant=inset]:overflow-hidden\"\n : undefined\n }\n >\n {headerNode}\n {mainNode}\n </SidebarInset>\n )}\n </SidebarProvider>\n </>\n );\n\n if (props.embedded) {\n return renderBody();\n }\n\n const errorToaster = props.actionErrorToaster ?? true;\n\n return (\n <DialogProvider>\n <TooltipProvider>\n {renderBody()}\n <Toaster />\n {errorToaster !== false && (\n <ActionErrorToaster\n {...(typeof errorToaster === \"object\" ? errorToaster : {})}\n />\n )}\n </TooltipProvider>\n </DialogProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmLA,MAAa,YAAY,UAAyB;CAChD,MAAM,EAA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,MAAM,cAA6B,CAAA;GAElC,EAAA,CAAA;EACd,CAAA,GACR,gBACC,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,YACD,oBAAC,OAAD;IAAK,WAAU;IACZ,UAAA;GACE,CAAA,CACF;EAEL,CAAA,IAAA,qBAAC,cAAD;GACE,WACE,YAAY,UACR,wDACA,KAAA;GAJR,UAAA,CAOG,YACA,QACW;EAED,CAAA,CAAA;CACjB,CAAA,CAAA,EAAA,CAAA;CAGJ,IAAI,MAAM,UACR,OAAO,WAAW;CAGpB,MAAM,eAAe,MAAM,sBAAsB;CAEjD,OACE,oBAAC,gBAAD,EAAA,UACE,qBAAC,iBAAD,EAAA,UAAA;EACG,WAAW;EACZ,oBAAC,SAAD,CAAU,CAAA;EACT,iBAAiB,SAChB,oBAAC,oBAAD,EACE,GAAK,OAAO,iBAAiB,WAAW,eAAe,CAAC,EACzD,CAAA;CAEY,EAAA,CAAA,EACH,CAAA;AAEpB"}
|
|
1
|
+
{"version":3,"file":"AppShell.js","names":[],"sources":["../../src/shell/AppShell.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"../core/utils.ts\";\n\nvoid React;\n\nimport { Link, NestedView } from \"alepha/react/router\";\nimport { useSidebarState } from \"alepha/react/ui\";\nimport type { ReactNode } from \"react\";\nimport { Fragment, useState } from \"react\";\n\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n BreadcrumbSeparator,\n} from \"../core/Breadcrumb.tsx\";\nimport { Separator } from \"../core/Separator.tsx\";\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarGroup,\n SidebarGroupContent,\n SidebarGroupLabel,\n SidebarHeader,\n SidebarInset,\n SidebarMenu,\n SidebarProvider,\n} from \"../core/Sidebar.tsx\";\nimport { Toaster } from \"../core/Toaster.tsx\";\nimport { TooltipProvider } from \"../core/Tooltip.tsx\";\nimport { DialogProvider } from \"../core/useDialog.tsx\";\nimport {\n ActionErrorToaster,\n type ActionErrorToasterProps,\n} from \"./ActionErrorToaster.tsx\";\nimport { findOpenPath, type NavGroup, samePath } from \"./appShellNav.tsx\";\nimport { AppShellSidebarNavItem } from \"./AppShellSidebarNavItem.tsx\";\nimport { AppShellStatefulSidebarTrigger } from \"./AppShellStatefulSidebarTrigger.tsx\";\nimport {\n NavigationProgress,\n type NavigationProgressOptions,\n} from \"./NavigationProgress.tsx\";\nimport { SidebarNavAutoClose } from \"./SidebarNavAutoClose.tsx\";\n\n/**\n * Re-exported: the bar moved to its own module so it can be mounted at an\n * application root, but the option type is part of {@link AppShellProps}\n * and was importable from here first.\n */\nexport type { NavigationProgressOptions };\n\nexport interface AppShellProps {\n /**\n * Branding shown at the top of the sidebar.\n */\n brand?: ReactNode;\n /**\n * Sidebar navigation groups.\n */\n nav?: NavGroup[];\n /**\n * Keep at most ONE nav group open at a time. Defaults to `true`.\n *\n * Opening a group closes the one that was open beside it, the way an\n * accordion does. Exclusivity is per level, so a nested group opens inside\n * its parent rather than replacing it, and the open branch always runs from\n * the root to the deepest open group.\n *\n * On means the sidebar owns the open state, so `NavItem.defaultOpen` seeds\n * the branch rather than opening a group of its own: the first item asking\n * for it wins, and only when nothing is active. Pass `false` for the older\n * behaviour, where every group keeps its own state and any number can be\n * open at once.\n *\n * ⚠️ Nothing changes in the icon rail. Collapsed to icons a group is a\n * dropdown, and one dropdown at a time is already all a menu can do.\n */\n navAccordion?: boolean;\n /**\n * Slide a nav group open and shut instead of swapping it in. Defaults to\n * `true`.\n *\n * `false` is a snap, not a shorter animation: an app that wants a different\n * duration or curve should style\n * `[data-slot=sidebar-menu-item] [data-state]` rather than turn this off.\n *\n * ⚠️ Honours `prefers-reduced-motion` on its own, so this is not the switch\n * for accessibility. It exists for a shell embedded somewhere that owns its\n * own motion, and for a test that would rather not wait 200ms.\n */\n navAnimate?: boolean;\n /**\n * Which glyph a collapsible nav group carries. Defaults to `\"caret\"`.\n *\n * - `\"caret\"` - a chevron that turns a quarter clockwise when the group\n * opens. One glyph, and the rotation is the state.\n * - `\"plusMinus\"` - a plus when shut, a minus when open. Two glyphs that\n * name the two states outright, where a caret only points and leaves the\n * reader to learn which direction means open.\n *\n * ⚠️ Nothing in the icon rail. Collapsed, a group is a dropdown that opens\n * to the RIGHT, so its chevron is a direction rather than a state and there\n * is no minus that could answer it.\n */\n navToggleIcon?: \"caret\" | \"plusMinus\";\n /**\n * Content rendered at the bottom of the sidebar (user menu, etc.).\n */\n sidebarFooter?: ReactNode;\n /**\n * Breadcrumb crumbs (last one is rendered as the current page).\n */\n breadcrumbs?: { label: ReactNode; href?: string }[];\n /**\n * Top-bar right-side content (search, theme toggle, user menu).\n */\n topbarActions?: ReactNode;\n /**\n * A column on the right of the page, beside it rather than over it: the\n * page narrows to make room. Where an app docks a panel that works with\n * the page, such as `AiChatDockSlot` for the assistant.\n */\n aside?: ReactNode;\n /**\n * Layout variant.\n * - `sidebar` (default): sidebar and page sit flush side-by-side.\n * - `inset`: sidebar uses the global background; the page is a rounded card with margin.\n * - `floating`: the page uses the global background; the sidebar is a rounded card with margin.\n */\n variant?: \"sidebar\" | \"floating\" | \"inset\";\n /**\n * When `variant=\"inset\"`, lift the header out of the floating card so it\n * sits on the sidebar background — only the main page becomes the card.\n * Has no effect on other variants.\n */\n headerOutside?: boolean;\n /**\n * Top loading bar shown during route transitions.\n * `true` (default) enables it with default styling, `false` disables it,\n * or pass an options object to customize.\n */\n progress?: boolean | NavigationProgressOptions;\n /**\n * Page content. Defaults to `<NestedView />` (renders the active route).\n */\n children?: ReactNode;\n /**\n * Surface failed `useAction` / `useQuery` calls as a toast (via the\n * `react:action:error` event). `true` (default) enables it, `false`\n * disables it, or pass an options object to configure\n * (see {@link ActionErrorToasterProps}). Ignored when `embedded` (the\n * parent layout owns the toaster).\n */\n actionErrorToaster?: boolean | ActionErrorToasterProps;\n /**\n * When `true`, the shell assumes it is mounted inside an outer provider tree\n * and skips its own `<DialogProvider>` and `<Toaster />` wrappers. Use this\n * when a parent layout already provides them.\n */\n embedded?: boolean;\n /**\n * When `true`, the shell fills its parent container instead of the viewport\n * (`min-h-svh`). Use when a parent layout owns the height (e.g. when a\n * sticky footer sits below the shell).\n */\n fill?: boolean;\n /**\n * Extra classes for the scrolling `<main>` element.\n *\n * Exists so an app can paint its own page surface (Lore stamps a dot\n * texture there) without every other consumer of the shell inheriting it.\n * Layout classes are applied after this, so a caller cannot break the\n * flex/overflow contract described above.\n */\n mainClassName?: string;\n}\n\n/**\n * Standard SaaS layout: collapsible sidebar + topbar with breadcrumbs.\n * Built on shadcn `<Sidebar>` + `<Breadcrumb>`.\n */\nexport const AppShell = (props: AppShellProps) => {\n const { collapsed, setCollapsed } = useSidebarState();\n const nav = props.nav ?? [];\n\n // The accordion's one open branch. Held here because exclusivity is a\n // question about SIBLINGS, and no nav item can see its own.\n const navAccordion = props.navAccordion ?? true;\n const navAnimate = props.navAnimate ?? true;\n const navToggleIcon = props.navToggleIcon ?? \"caret\";\n const wantedOpenPath = findOpenPath(nav);\n const [openPath, setOpenPath] = useState(wantedOpenPath);\n // Follow the active page. Set during render of THIS component, which is the\n // supported way to react to changed input without a wasted frame; the same\n // pattern a nav item uses for its own state when the accordion is off.\n // Only ever opens: `findOpenPath` returns an empty path when nothing is\n // active and nothing asked for `defaultOpen`, and adopting that would slam\n // the branch shut on every navigation to a top-level page.\n const [lastWanted, setLastWanted] = useState(wantedOpenPath);\n if (!samePath(wantedOpenPath, lastWanted)) {\n setLastWanted(wantedOpenPath);\n if (wantedOpenPath.length > 0) setOpenPath(wantedOpenPath);\n }\n const variant = props.variant ?? \"sidebar\";\n const progress = props.progress ?? true;\n const headerOutside = !!props.headerOutside && variant === \"inset\";\n\n const headerNode = (\n <header\n className={\n headerOutside\n ? \"bg-sidebar flex h-14 shrink-0 items-center gap-2 px-4\"\n : \"bg-background flex h-14 shrink-0 items-center gap-2 border-b px-4\"\n }\n >\n {/* This bar is one non-wrapping flex line, and on a Lore project page it\n carries the trigger, a separator, the breadcrumbs, a split button,\n the search button and four header icons: about 470px of content in\n 373px at phone width. Nothing here used to be marked as the one that\n must survive, so the overflow fell off the RIGHT end and took the\n theme, colour-mode and account controls with it — off-screen, with no\n horizontal scroll to reach them and no menu they collapse into.\n\n So everything on the row is `shrink-0` with exactly one exception:\n the breadcrumbs, which are the one thing repeated in the page below\n and can therefore afford to give way. They truncate while there is\n still something to read, and below `sm` they are dropped outright\n rather than left as an unreadable sliver. */}\n <div className=\"flex shrink-0 items-center\">\n <AppShellStatefulSidebarTrigger />\n <Separator orientation=\"vertical\" className=\"mx-2\" />\n </div>\n {props.breadcrumbs && props.breadcrumbs.length > 0 && (\n <Breadcrumb className=\"min-w-0 overflow-hidden max-sm:hidden\">\n {/* `flex-nowrap`: the list wraps by default, and a second line in an\n `h-14` bar is drawn outside it. */}\n <BreadcrumbList className=\"flex-nowrap\">\n {props.breadcrumbs.map((crumb, i) => {\n const last = i === props.breadcrumbs!.length - 1;\n return (\n <Fragment key={i}>\n <BreadcrumbItem className=\"min-w-0\">\n {last || !crumb.href ? (\n <BreadcrumbPage className=\"truncate\">\n {crumb.label}\n </BreadcrumbPage>\n ) : (\n <BreadcrumbLink\n className=\"truncate\"\n render={<Link href={crumb.href} />}\n >\n {crumb.label}\n </BreadcrumbLink>\n )}\n </BreadcrumbItem>\n {!last && <BreadcrumbSeparator className=\"shrink-0\" />}\n </Fragment>\n );\n })}\n </BreadcrumbList>\n </Breadcrumb>\n )}\n <div className=\"flex-1\" />\n {/* Wrapped rather than spread straight into the header: the actions have\n to be one `shrink-0` unit, and they keep the `gap-2` the header was\n giving them. */}\n <div className=\"flex shrink-0 items-center gap-2\">\n {props.topbarActions}\n </div>\n </header>\n );\n\n const mainNode = (\n // Layout contract for `fill: true` pages:\n // parent (`h-svh`) → SidebarProvider (`h-full`) → SidebarInset → main\n // - main is `flex flex-col min-h-0 flex-1` so its children can\n // claim the leftover height via `flex-1 min-h-0`.\n // - main itself is `overflow-hidden` (not `overflow-auto`) so the\n // table's inner `overflow-auto` is the actual scroll surface —\n // header stays sticky, body scrolls, no page-level scrollbar.\n // - For non-fill pages there's no height bound, so this collapses\n // to \"scroll whatever overflows\" without further config.\n //\n // `relative` is load-bearing in BOTH branches, and it is the whole of\n // #1849: an `overflow` declared on a STATIC element does not clip an\n // absolutely positioned descendant whose containing block resolves above\n // it. Base UI gives every named form control a 1×1 hidden `<input>`\n // styled `position: absolute` with no offsets, so on a page whose fields\n // live inside an inner scroller each of those inputs escaped this `main`,\n // resolved against the positioned `SidebarInset` and pinned the document\n // open at its own static offset — a page that scrolled 1271px into empty\n // background beneath a shell that had not moved. Positioning `main` makes\n // its overflow bound real, whatever a page renders inside it.\n <main\n className={cn(\n props.mainClassName,\n \"relative\",\n props.fill\n ? \"flex min-h-0 flex-1 flex-col overflow-hidden\"\n : \"flex-1 overflow-auto\",\n )}\n >\n {props.children ?? <NestedView />}\n </main>\n );\n const renderBody = () => (\n <>\n {progress !== false && (\n <NavigationProgress {...(progress === true ? {} : progress)} />\n )}\n <SidebarProvider\n open={!collapsed}\n onOpenChange={(o: boolean) => setCollapsed(!o)}\n // `fill` = a parent owns the height (e.g. a full-width banner above\n // the shell). The desktop sidebar is `fixed inset-y-0 h-svh` (pinned\n // to the VIEWPORT), so it would overlap whatever sits above the\n // shell — re-anchor it to this wrapper instead (absolute within the\n // now-relative provider, height from the wrapper). The arbitrary\n // selectors out-specify the base `.fixed`/`.h-svh` utilities.\n className={\n props.fill\n ? \"relative h-full min-h-0 [&_[data-slot=sidebar-container]]:absolute [&_[data-slot=sidebar-container]]:h-auto\"\n : undefined\n }\n >\n <Sidebar collapsible=\"icon\" variant={variant}>\n {/* Wraps the WHOLE sidebar, brand slot and footer included, because\n the links that leave this sheet are not only the nav items - the\n project switcher lives in `brand` and each app puts its own\n links in `sidebarFooter`. */}\n <SidebarNavAutoClose>\n <SidebarHeader>{props.brand}</SidebarHeader>\n <SidebarContent>\n {nav.map((group, gi) => (\n <SidebarGroup key={gi}>\n {group.label && (\n <SidebarGroupLabel>{group.label}</SidebarGroupLabel>\n )}\n <SidebarGroupContent>\n <SidebarMenu>\n {group.items.map((item, ii) => (\n <AppShellSidebarNavItem\n key={item.href ?? `${gi}-${ii}`}\n item={item}\n path={[gi, ii]}\n accordion={\n navAccordion ? { openPath, setOpenPath } : undefined\n }\n animate={navAnimate}\n toggleIcon={navToggleIcon}\n />\n ))}\n </SidebarMenu>\n </SidebarGroupContent>\n </SidebarGroup>\n ))}\n </SidebarContent>\n {props.sidebarFooter && (\n <SidebarFooter>{props.sidebarFooter}</SidebarFooter>\n )}\n </SidebarNavAutoClose>\n </Sidebar>\n {headerOutside ? (\n <div className=\"bg-sidebar flex flex-1 flex-col\">\n {headerNode}\n <div className=\"bg-background m-2 mt-0 flex flex-1 flex-col overflow-hidden rounded-xl border shadow-sm\">\n {mainNode}\n </div>\n </div>\n ) : (\n <SidebarInset\n className={\n variant === \"inset\"\n ? \"border md:peer-data-[variant=inset]:overflow-hidden\"\n : undefined\n }\n >\n {headerNode}\n {mainNode}\n </SidebarInset>\n )}\n {props.aside}\n </SidebarProvider>\n </>\n );\n\n if (props.embedded) {\n return renderBody();\n }\n\n const errorToaster = props.actionErrorToaster ?? true;\n\n return (\n <DialogProvider>\n <TooltipProvider>\n {renderBody()}\n <Toaster />\n {errorToaster !== false && (\n <ActionErrorToaster\n {...(typeof errorToaster === \"object\" ? errorToaster : {})}\n />\n )}\n </TooltipProvider>\n </DialogProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAyLA,MAAa,YAAY,UAAyB;CAChD,MAAM,EAAE,WAAW,iBAAiB,gBAAgB;CACpD,MAAM,MAAM,MAAM,OAAO,CAAC;CAI1B,MAAM,eAAe,MAAM,gBAAgB;CAC3C,MAAM,aAAa,MAAM,cAAc;CACvC,MAAM,gBAAgB,MAAM,iBAAiB;CAC7C,MAAM,iBAAiB,aAAa,GAAG;CACvC,MAAM,CAAC,UAAU,eAAe,SAAS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UAAA,CAOG,YACA,QACW;;GAEf,MAAM;EACQ;CACjB,CAAA,CAAA,EAAA,CAAA;CAGJ,IAAI,MAAM,UACR,OAAO,WAAW;CAGpB,MAAM,eAAe,MAAM,sBAAsB;CAEjD,OACE,oBAAC,gBAAD,EAAA,UACE,qBAAC,iBAAD,EAAA,UAAA;EACG,WAAW;EACZ,oBAAC,SAAD,CAAU,CAAA;EACT,iBAAiB,SAChB,oBAAC,oBAAD,EACE,GAAK,OAAO,iBAAiB,WAAW,eAAe,CAAC,EACzD,CAAA;CAEY,EAAA,CAAA,EACH,CAAA;AAEpB"}
|
|
@@ -3,6 +3,7 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
import { ButtonSettingsColorModeMenu } from "./ButtonSettingsColorModeMenu.tsx";
|
|
4
4
|
import { ButtonSettingsLanguageMenu } from "./ButtonSettingsLanguageMenu.tsx";
|
|
5
5
|
import { ButtonSettingsThemeMenu } from "./ButtonSettingsThemeMenu.tsx";
|
|
6
|
+
import { ButtonSettingsVisionMenuItem } from "./ButtonSettingsVisionMenuItem.tsx";
|
|
6
7
|
export interface ButtonSettingsProps {
|
|
7
8
|
/**
|
|
8
9
|
* Where language, theme and display mode go while the viewer is signed in.
|
|
@@ -47,7 +48,8 @@ export interface ButtonSettingsProps {
|
|
|
47
48
|
* default and French through `uiFr`, so the admin console and the account
|
|
48
49
|
* area are localised without passing any. `language`, `theme` and
|
|
49
50
|
* `colorMode` name the control in both placements: the submenu in the
|
|
50
|
-
* menu, the tooltip and `aria-label` as a button.
|
|
51
|
+
* menu, the tooltip and `aria-label` as a button. `vision` names the
|
|
52
|
+
* colour-blind button, which only exists as a button.
|
|
51
53
|
*/
|
|
52
54
|
labels?: {
|
|
53
55
|
signIn?: string;
|
|
@@ -61,6 +63,7 @@ export interface ButtonSettingsProps {
|
|
|
61
63
|
colorModeSystem?: string;
|
|
62
64
|
colorModeDark?: string;
|
|
63
65
|
colorModeLight?: string;
|
|
66
|
+
vision?: string;
|
|
64
67
|
};
|
|
65
68
|
/**
|
|
66
69
|
* Forwarded to {@link ButtonUser.avatar}: overrides what the signed-in
|
|
@@ -71,7 +74,7 @@ export interface ButtonSettingsProps {
|
|
|
71
74
|
/**
|
|
72
75
|
* Below `sm`, drop the settings BUTTONS and keep only the account button.
|
|
73
76
|
* It never touches the menu, so a signed-in viewer on a phone still reaches
|
|
74
|
-
* all
|
|
77
|
+
* all of them there under the default `placement`.
|
|
75
78
|
*/
|
|
76
79
|
compact?: boolean;
|
|
77
80
|
/**
|
|
@@ -85,5 +88,6 @@ export declare namespace ButtonSettings {
|
|
|
85
88
|
export { ButtonSettingsLanguageMenu as LanguageMenu };
|
|
86
89
|
export { ButtonSettingsThemeMenu as ThemeMenu };
|
|
87
90
|
export { ButtonSettingsColorModeMenu as ColorModeMenu };
|
|
91
|
+
export { ButtonSettingsVisionMenuItem as VisionMenuItem };
|
|
88
92
|
}
|
|
89
93
|
//# sourceMappingURL=ButtonSettings.d.ts.map
|
|
@@ -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;
|
|
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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AA4B"}
|
|
@@ -5,8 +5,10 @@ import { ButtonLanguage } from "./ButtonLanguage.js";
|
|
|
5
5
|
import { ButtonSettingsColorModeMenu } from "./ButtonSettingsColorModeMenu.js";
|
|
6
6
|
import { ButtonSettingsLanguageMenu } from "./ButtonSettingsLanguageMenu.js";
|
|
7
7
|
import { ButtonSettingsThemeMenu } from "./ButtonSettingsThemeMenu.js";
|
|
8
|
+
import { ButtonSettingsVisionMenuItem } from "./ButtonSettingsVisionMenuItem.js";
|
|
8
9
|
import { ButtonTheme } from "./ButtonTheme.js";
|
|
9
10
|
import { ButtonUser } from "./ButtonUser.js";
|
|
11
|
+
import { ButtonVision } from "./ButtonVision.js";
|
|
10
12
|
import { useRouter } from "alepha/react/router";
|
|
11
13
|
import { useI18n } from "alepha/react/i18n";
|
|
12
14
|
import "react";
|
|
@@ -17,8 +19,8 @@ import { useAuth } from "alepha/react/auth";
|
|
|
17
19
|
* The account button with the viewer's settings attached: language, theme
|
|
18
20
|
* and display mode, wrapped around {@link ButtonUser}.
|
|
19
21
|
*
|
|
20
|
-
* Signed out, it draws
|
|
21
|
-
*
|
|
22
|
+
* Signed out, it draws icon buttons: language, theme, dark mode,
|
|
23
|
+
* colour-blind mode (`ButtonVision`), sign in. Signed in, it draws ONE button, the avatar, and
|
|
22
24
|
* the settings move into its menu:
|
|
23
25
|
*
|
|
24
26
|
* ```
|
|
@@ -33,6 +35,12 @@ import { useAuth } from "alepha/react/auth";
|
|
|
33
35
|
* Logout
|
|
34
36
|
* ```
|
|
35
37
|
*
|
|
38
|
+
* Colour-blind mode is not in that menu: it is set once, so a signed-in
|
|
39
|
+
* viewer finds it on the account page (`AccountDisplay`, on the profile). A
|
|
40
|
+
* signed-out visitor has no account page, and keeps the `ButtonVision` icon.
|
|
41
|
+
* `ButtonSettings.VisionMenuItem` is still exported for an application that
|
|
42
|
+
* wants the item among its own `children`.
|
|
43
|
+
*
|
|
36
44
|
* Pass `placement="buttons"` to keep them as buttons once signed in too.
|
|
37
45
|
*
|
|
38
46
|
* Each part still decides whether it has anything to offer: language and
|
|
@@ -56,7 +64,8 @@ const ButtonSettings = (props) => {
|
|
|
56
64
|
colorMode: given.colorMode ?? tr("shell.settings.colorMode", { default: "Display Mode" }),
|
|
57
65
|
colorModeSystem: given.colorModeSystem ?? tr("shell.settings.colorModeSystem", { default: "System" }),
|
|
58
66
|
colorModeDark: given.colorModeDark ?? tr("shell.settings.colorModeDark", { default: "Dark" }),
|
|
59
|
-
colorModeLight: given.colorModeLight ?? tr("shell.settings.colorModeLight", { default: "Light" })
|
|
67
|
+
colorModeLight: given.colorModeLight ?? tr("shell.settings.colorModeLight", { default: "Light" }),
|
|
68
|
+
vision: given.vision ?? tr("shell.settings.vision", { default: "Colour-blind mode" })
|
|
60
69
|
};
|
|
61
70
|
const variant = props.variant ?? "minimal";
|
|
62
71
|
const inMenu = !!auth.user && (props.placement ?? "menu") === "menu";
|
|
@@ -78,6 +87,10 @@ const ButtonSettings = (props) => {
|
|
|
78
87
|
/* @__PURE__ */ jsx(ButtonDark, {
|
|
79
88
|
variant,
|
|
80
89
|
label: labels.colorMode
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ jsx(ButtonVision, {
|
|
92
|
+
variant,
|
|
93
|
+
label: labels.vision
|
|
81
94
|
})
|
|
82
95
|
]
|
|
83
96
|
}),
|
|
@@ -118,6 +131,7 @@ const ButtonSettings = (props) => {
|
|
|
118
131
|
ButtonSettings.LanguageMenu = ButtonSettingsLanguageMenu;
|
|
119
132
|
ButtonSettings.ThemeMenu = ButtonSettingsThemeMenu;
|
|
120
133
|
ButtonSettings.ColorModeMenu = ButtonSettingsColorModeMenu;
|
|
134
|
+
ButtonSettings.VisionMenuItem = ButtonSettingsVisionMenuItem;
|
|
121
135
|
export { ButtonSettings };
|
|
122
136
|
|
|
123
137
|
//# sourceMappingURL=ButtonSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSettings.js","names":[],"sources":["../../src/shell/ButtonSettings.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useAuth } from \"alepha/react/auth\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { 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 { ButtonSettingsColorModeMenu } from \"./ButtonSettingsColorModeMenu.tsx\";\nimport { ButtonSettingsLanguageMenu } from \"./ButtonSettingsLanguageMenu.tsx\";\nimport { ButtonSettingsThemeMenu } from \"./ButtonSettingsThemeMenu.tsx\";\nimport { ButtonTheme } from \"./ButtonTheme.tsx\";\nimport { ButtonUser } from \"./ButtonUser.tsx\";\n\nexport interface ButtonSettingsProps {\n /**\n * Where language, theme and display mode go while the viewer is signed in.\n *\n * - `\"menu\"`: inside the account menu, between the destinations and\n * Logout, so the header carries one button.\n * - `\"buttons\"`: icon buttons left of the account button, the way\n * `AppActions` draws them.\n *\n * Signed out there is no menu to put them in, so they are buttons whatever\n * this says.\n *\n * @default \"menu\"\n */\n placement?: \"menu\" | \"buttons\";\n\n /**\n * Extra menu items appended to the account dropdown, below Admin Panel and\n * above the settings. For an application-specific destination that belongs\n * with the account rather than in the page chrome.\n */\n children?: ReactNode;\n\n /**\n * Rendered to the left of the cluster, in the same `flex gap-1` row.\n */\n before?: ReactNode;\n\n /**\n * Route name of the \"Admin Panel\" item. The item is hidden anyway unless\n * 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 names its chrome itself. An omitted\n * entry is read from the catalogue under `shell.settings.*`, English by\n * default and French through `uiFr`, so the admin console and the account\n * area are localised without passing any. `language`, `theme` and\n * `colorMode` name the control in both placements: the submenu in the\n * menu, the tooltip and `aria-label` as a button.\n */\n labels?: {\n signIn?: string;\n menu?: string;\n account?: string;\n admin?: string;\n logout?: string;\n language?: string;\n theme?: string;\n colorMode?: string;\n colorModeSystem?: string;\n colorModeDark?: string;\n colorModeLight?: string;\n };\n\n /**\n * Forwarded to {@link ButtonUser.avatar}: overrides what the signed-in\n * button shows. Absent, it draws the viewer's own picture when they have\n * one and the generic glyph when they do not.\n */\n avatar?: ReactNode;\n\n /**\n * Below `sm`, drop the settings BUTTONS and keep only the account button.\n * It never touches the menu, so a signed-in viewer on a phone still reaches\n * all three there under the default `placement`.\n */\n compact?: boolean;\n\n /**\n * Visual variant of every button. Defaults to `\"minimal\"`.\n */\n variant?: \"minimal\" | \"outlined\";\n\n className?: string;\n}\n\n/**\n * The account button with the viewer's settings attached: language, theme\n * and display mode, wrapped around {@link ButtonUser}.\n *\n * Signed out, it draws the four icon buttons `AppActions` draws: language,\n * theme, dark mode, sign in. Signed in, it draws ONE button, the avatar, and\n * the settings move into its menu:\n *\n * ```\n * ada@example.com\n * User Account\n * Admin Panel\n * ───────────\n * Language ›\n * Theme ›\n * Display Mode ›\n * ───────────\n * Logout\n * ```\n *\n * Pass `placement=\"buttons\"` to keep them as buttons once signed in too.\n *\n * Each part still decides whether it has anything to offer: language and\n * theme disappear, as a button or as a submenu, when one or fewer are\n * registered, and the account and admin items hide when their route is not\n * mounted or the viewer lacks `admin:ui`.\n */\nexport const ButtonSettings = (props: ButtonSettingsProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n const { tr } = useI18n();\n const given = props.labels ?? {};\n // Each key written out, not built from a list: the `uiFr` coverage spec\n // finds a key by its literal `tr(\"...\")` call.\n const labels = {\n signIn: given.signIn ?? tr(\"shell.settings.signIn\", { default: \"Sign in\" }),\n menu: given.menu ?? tr(\"shell.settings.menu\", { default: \"Account menu\" }),\n account:\n given.account ??\n tr(\"shell.settings.account\", { default: \"User Account\" }),\n admin:\n given.admin ?? tr(\"shell.settings.admin\", { default: \"Admin Panel\" }),\n logout: given.logout ?? tr(\"shell.settings.logout\", { default: \"Logout\" }),\n language:\n given.language ?? tr(\"shell.settings.language\", { default: \"Language\" }),\n theme: given.theme ?? tr(\"shell.settings.theme\", { default: \"Theme\" }),\n colorMode:\n given.colorMode ??\n tr(\"shell.settings.colorMode\", { default: \"Display Mode\" }),\n colorModeSystem:\n given.colorModeSystem ??\n tr(\"shell.settings.colorModeSystem\", { default: \"System\" }),\n colorModeDark:\n given.colorModeDark ??\n tr(\"shell.settings.colorModeDark\", { default: \"Dark\" }),\n colorModeLight:\n given.colorModeLight ??\n tr(\"shell.settings.colorModeLight\", { default: \"Light\" }),\n };\n const variant = props.variant ?? \"minimal\";\n const inMenu = !!auth.user && (props.placement ?? \"menu\") === \"menu\";\n\n return (\n <div className={cn(\"flex items-center gap-1\", props.className)}>\n {props.before}\n {!inMenu && (\n // `contents` keeps the three direct children of the flex row and its\n // `gap-1`; `hidden` wins over it below the breakpoint.\n <div className={cn(props.compact ? \"hidden sm:contents\" : \"contents\")}>\n <ButtonLanguage variant={variant} label={labels.language} />\n <ButtonTheme variant={variant} label={labels.theme} />\n <ButtonDark variant={variant} label={labels.colorMode} />\n </div>\n )}\n <ButtonUser\n variant={variant}\n avatar={props.avatar}\n signInLabel={labels.signIn}\n menuLabel={labels.menu}\n onSignIn={() => router.push(props.loginRouteName ?? \"login\")}\n >\n <ButtonUser.Email />\n {/* Account before admin: see `ButtonUserDefaultMenu` for why. */}\n <ButtonUser.AccountMenuItem label={labels.account} />\n <ButtonUser.AdminMenuItem\n label={labels.admin}\n routeName={props.adminRouteName}\n />\n {props.children}\n {inMenu && (\n <>\n <DropdownMenuSeparator />\n <ButtonSettingsLanguageMenu label={labels.language} />\n <ButtonSettingsThemeMenu label={labels.theme} />\n <ButtonSettingsColorModeMenu\n label={labels.colorMode}\n labels={{\n system: labels.colorModeSystem,\n dark: labels.colorModeDark,\n light: labels.colorModeLight,\n }}\n />\n </>\n )}\n <DropdownMenuSeparator />\n <ButtonUser.LogoutMenuItem label={labels.logout} />\n </ButtonUser>\n </div>\n );\n};\n\nButtonSettings.LanguageMenu = ButtonSettingsLanguageMenu;\nButtonSettings.ThemeMenu = ButtonSettingsThemeMenu;\nButtonSettings.ColorModeMenu = ButtonSettingsColorModeMenu;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqIA,MAAa,kBAAkB,UAA+B;CAC5D,MAAM,OAAO,QAAQ;CACrB,MAAM,SAAS,UAAe;CAC9B,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,QAAQ,MAAM,UAAU,CAAC;CAG/B,MAAM,SAAS;EACb,QAAQ,MAAM,UAAU,GAAG,yBAAyB,EAAE,SAAS,UAAU,CAAC;EAC1E,MAAM,MAAM,QAAQ,GAAG,uBAAuB,EAAE,SAAS,eAAe,CAAC;EACzE,SACE,MAAM,WACN,GAAG,0BAA0B,EAAE,SAAS,eAAe,CAAC;EAC1D,OACE,MAAM,SAAS,GAAG,wBAAwB,EAAE,SAAS,cAAc,CAAC;EACtE,QAAQ,MAAM,UAAU,GAAG,yBAAyB,EAAE,SAAS,SAAS,CAAC;EACzE,UACE,MAAM,YAAY,GAAG,2BAA2B,EAAE,SAAS,WAAW,CAAC;EACzE,OAAO,MAAM,SAAS,GAAG,wBAAwB,EAAE,SAAS,QAAQ,CAAC;EACrE,WACE,MAAM,aACN,GAAG,4BAA4B,EAAE,SAAS,eAAe,CAAC;EAC5D,iBACE,MAAM,mBACN,GAAG,kCAAkC,EAAE,SAAS,SAAS,CAAC;EAC5D,eACE,MAAM,iBACN,GAAG,gCAAgC,EAAE,SAAS,OAAO,CAAC;EACxD,gBACE,MAAM,kBACN,GAAG,iCAAiC,EAAE,SAAS,QAAQ,CAAC;CAC5D;CACA,MAAM,UAAU,MAAM,WAAW;CACjC,MAAM,SAAS,CAAC,CAAC,KAAK,SAAS,MAAM,aAAa,YAAY;CAE9D,OAC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from \"react\";\n\nvoid React;\n\nimport { useAuth } from \"alepha/react/auth\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { 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 { ButtonSettingsColorModeMenu } from \"./ButtonSettingsColorModeMenu.tsx\";\nimport { ButtonSettingsLanguageMenu } from \"./ButtonSettingsLanguageMenu.tsx\";\nimport { ButtonSettingsThemeMenu } from \"./ButtonSettingsThemeMenu.tsx\";\nimport { ButtonSettingsVisionMenuItem } from \"./ButtonSettingsVisionMenuItem.tsx\";\nimport { ButtonTheme } from \"./ButtonTheme.tsx\";\nimport { ButtonUser } from \"./ButtonUser.tsx\";\nimport { ButtonVision } from \"./ButtonVision.tsx\";\n\nexport interface ButtonSettingsProps {\n /**\n * Where language, theme and display mode go while the viewer is signed in.\n *\n * - `\"menu\"`: inside the account menu, between the destinations and\n * Logout, so the header carries one button.\n * - `\"buttons\"`: icon buttons left of the account button, the way\n * `AppActions` draws them.\n *\n * Signed out there is no menu to put them in, so they are buttons whatever\n * this says.\n *\n * @default \"menu\"\n */\n placement?: \"menu\" | \"buttons\";\n\n /**\n * Extra menu items appended to the account dropdown, below Admin Panel and\n * above the settings. For an application-specific destination that belongs\n * with the account rather than in the page chrome.\n */\n children?: ReactNode;\n\n /**\n * Rendered to the left of the cluster, in the same `flex gap-1` row.\n */\n before?: ReactNode;\n\n /**\n * Route name of the \"Admin Panel\" item. The item is hidden anyway unless\n * 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 names its chrome itself. An omitted\n * entry is read from the catalogue under `shell.settings.*`, English by\n * default and French through `uiFr`, so the admin console and the account\n * area are localised without passing any. `language`, `theme` and\n * `colorMode` name the control in both placements: the submenu in the\n * menu, the tooltip and `aria-label` as a button. `vision` names the\n * colour-blind button, which only exists as a button.\n */\n labels?: {\n signIn?: string;\n menu?: string;\n account?: string;\n admin?: string;\n logout?: string;\n language?: string;\n theme?: string;\n colorMode?: string;\n colorModeSystem?: string;\n colorModeDark?: string;\n colorModeLight?: string;\n vision?: string;\n };\n\n /**\n * Forwarded to {@link ButtonUser.avatar}: overrides what the signed-in\n * button shows. Absent, it draws the viewer's own picture when they have\n * one and the generic glyph when they do not.\n */\n avatar?: ReactNode;\n\n /**\n * Below `sm`, drop the settings BUTTONS and keep only the account button.\n * It never touches the menu, so a signed-in viewer on a phone still reaches\n * all of them there under the default `placement`.\n */\n compact?: boolean;\n\n /**\n * Visual variant of every button. Defaults to `\"minimal\"`.\n */\n variant?: \"minimal\" | \"outlined\";\n\n className?: string;\n}\n\n/**\n * The account button with the viewer's settings attached: language, theme\n * and display mode, wrapped around {@link ButtonUser}.\n *\n * Signed out, it draws icon buttons: language, theme, dark mode,\n * colour-blind mode (`ButtonVision`), sign in. Signed in, it draws ONE button, the avatar, and\n * the settings move into its menu:\n *\n * ```\n * ada@example.com\n * User Account\n * Admin Panel\n * ───────────\n * Language ›\n * Theme ›\n * Display Mode ›\n * ───────────\n * Logout\n * ```\n *\n * Colour-blind mode is not in that menu: it is set once, so a signed-in\n * viewer finds it on the account page (`AccountDisplay`, on the profile). A\n * signed-out visitor has no account page, and keeps the `ButtonVision` icon.\n * `ButtonSettings.VisionMenuItem` is still exported for an application that\n * wants the item among its own `children`.\n *\n * Pass `placement=\"buttons\"` to keep them as buttons once signed in too.\n *\n * Each part still decides whether it has anything to offer: language and\n * theme disappear, as a button or as a submenu, when one or fewer are\n * registered, and the account and admin items hide when their route is not\n * mounted or the viewer lacks `admin:ui`.\n */\nexport const ButtonSettings = (props: ButtonSettingsProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n const { tr } = useI18n();\n const given = props.labels ?? {};\n // Each key written out, not built from a list: the `uiFr` coverage spec\n // finds a key by its literal `tr(\"...\")` call.\n const labels = {\n signIn: given.signIn ?? tr(\"shell.settings.signIn\", { default: \"Sign in\" }),\n menu: given.menu ?? tr(\"shell.settings.menu\", { default: \"Account menu\" }),\n account:\n given.account ??\n tr(\"shell.settings.account\", { default: \"User Account\" }),\n admin:\n given.admin ?? tr(\"shell.settings.admin\", { default: \"Admin Panel\" }),\n logout: given.logout ?? tr(\"shell.settings.logout\", { default: \"Logout\" }),\n language:\n given.language ?? tr(\"shell.settings.language\", { default: \"Language\" }),\n theme: given.theme ?? tr(\"shell.settings.theme\", { default: \"Theme\" }),\n colorMode:\n given.colorMode ??\n tr(\"shell.settings.colorMode\", { default: \"Display Mode\" }),\n colorModeSystem:\n given.colorModeSystem ??\n tr(\"shell.settings.colorModeSystem\", { default: \"System\" }),\n colorModeDark:\n given.colorModeDark ??\n tr(\"shell.settings.colorModeDark\", { default: \"Dark\" }),\n colorModeLight:\n given.colorModeLight ??\n tr(\"shell.settings.colorModeLight\", { default: \"Light\" }),\n vision:\n given.vision ??\n tr(\"shell.settings.vision\", { default: \"Colour-blind mode\" }),\n };\n const variant = props.variant ?? \"minimal\";\n const inMenu = !!auth.user && (props.placement ?? \"menu\") === \"menu\";\n\n return (\n <div className={cn(\"flex items-center gap-1\", props.className)}>\n {props.before}\n {!inMenu && (\n // `contents` keeps the four direct children of the flex row and its\n // `gap-1`; `hidden` wins over it below the breakpoint.\n <div className={cn(props.compact ? \"hidden sm:contents\" : \"contents\")}>\n <ButtonLanguage variant={variant} label={labels.language} />\n <ButtonTheme variant={variant} label={labels.theme} />\n <ButtonDark variant={variant} label={labels.colorMode} />\n <ButtonVision variant={variant} label={labels.vision} />\n </div>\n )}\n <ButtonUser\n variant={variant}\n avatar={props.avatar}\n signInLabel={labels.signIn}\n menuLabel={labels.menu}\n onSignIn={() => router.push(props.loginRouteName ?? \"login\")}\n >\n <ButtonUser.Email />\n {/* Account before admin: see `ButtonUserDefaultMenu` for why. */}\n <ButtonUser.AccountMenuItem label={labels.account} />\n <ButtonUser.AdminMenuItem\n label={labels.admin}\n routeName={props.adminRouteName}\n />\n {props.children}\n {inMenu && (\n <>\n <DropdownMenuSeparator />\n <ButtonSettingsLanguageMenu label={labels.language} />\n <ButtonSettingsThemeMenu label={labels.theme} />\n <ButtonSettingsColorModeMenu\n label={labels.colorMode}\n labels={{\n system: labels.colorModeSystem,\n dark: labels.colorModeDark,\n light: labels.colorModeLight,\n }}\n />\n </>\n )}\n <DropdownMenuSeparator />\n <ButtonUser.LogoutMenuItem label={labels.logout} />\n </ButtonUser>\n </div>\n );\n};\n\nButtonSettings.LanguageMenu = ButtonSettingsLanguageMenu;\nButtonSettings.ThemeMenu = ButtonSettingsThemeMenu;\nButtonSettings.ColorModeMenu = ButtonSettingsColorModeMenu;\nButtonSettings.VisionMenuItem = ButtonSettingsVisionMenuItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA,MAAa,kBAAkB,UAA+B;CAC5D,MAAM,OAAO,QAAQ;CACrB,MAAM,SAAS,UAAe;CAC9B,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,QAAQ,MAAM,UAAU,CAAC;CAG/B,MAAM,SAAS;EACb,QAAQ,MAAM,UAAU,GAAG,yBAAyB,EAAE,SAAS,UAAU,CAAC;EAC1E,MAAM,MAAM,QAAQ,GAAG,uBAAuB,EAAE,SAAS,eAAe,CAAC;EACzE,SACE,MAAM,WACN,GAAG,0BAA0B,EAAE,SAAS,eAAe,CAAC;EAC1D,OACE,MAAM,SAAS,GAAG,wBAAwB,EAAE,SAAS,cAAc,CAAC;EACtE,QAAQ,MAAM,UAAU,GAAG,yBAAyB,EAAE,SAAS,SAAS,CAAC;EACzE,UACE,MAAM,YAAY,GAAG,2BAA2B,EAAE,SAAS,WAAW,CAAC;EACzE,OAAO,MAAM,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uBAAD,CAAwB,CAAA;MACxB,oBAAC,4BAAD,EAA4B,OAAO,OAAO,SAAW,CAAA;MACrD,oBAAC,yBAAD,EAAyB,OAAO,OAAO,MAAQ,CAAA;MAC/C,oBAAC,6BAAD;OACE,OAAO,OAAO;OACd,QAAQ;QACN,QAAQ,OAAO;QACf,MAAM,OAAO;QACb,OAAO,OAAO;OAChB;MACD,CAAA;KACD,EAAA,CAAA;KAEJ,oBAAC,uBAAD,CAAwB,CAAA;KACxB,oBAAC,WAAW,gBAAZ,EAA2B,OAAO,OAAO,OAAS,CAAA;IACxC;;EACT;;AAET;AAEA,eAAe,eAAe;AAC9B,eAAe,YAAY;AAC3B,eAAe,gBAAgB;AAC/B,eAAe,iBAAiB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ButtonSettingsVisionMenuItemProps {
|
|
3
|
+
/**
|
|
4
|
+
* Item label. Defaults to `"Colour-blind mode"`.
|
|
5
|
+
*/
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The vision mode as a checkbox item of the account menu: checked while the
|
|
10
|
+
* colour-blind palette is on, through `useVisionMode()`.
|
|
11
|
+
*
|
|
12
|
+
* Reading the mode during render is safe here, as in the color-mode submenu:
|
|
13
|
+
* the menu mounts only when opened, so the server never renders it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ButtonSettingsVisionMenuItem: (props: ButtonSettingsVisionMenuItemProps) => React.JSX.Element;
|
|
16
|
+
//# sourceMappingURL=ButtonSettingsVisionMenuItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonSettingsVisionMenuItem.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonSettingsVisionMenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,iCAAiC;IAChD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,UAChC,iCAAiC,sBAezC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DropdownMenuCheckboxItem } from "../core/DropdownMenu.js";
|
|
2
|
+
import { Eye } from "lucide-react";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { useVisionMode } from "alepha/react/ui";
|
|
6
|
+
// src/shell/ButtonSettingsVisionMenuItem.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The vision mode as a checkbox item of the account menu: checked while the
|
|
9
|
+
* colour-blind palette is on, through `useVisionMode()`.
|
|
10
|
+
*
|
|
11
|
+
* Reading the mode during render is safe here, as in the color-mode submenu:
|
|
12
|
+
* the menu mounts only when opened, so the server never renders it.
|
|
13
|
+
*/
|
|
14
|
+
const ButtonSettingsVisionMenuItem = (props) => {
|
|
15
|
+
const { vision, setVision } = useVisionMode();
|
|
16
|
+
return /* @__PURE__ */ jsxs(DropdownMenuCheckboxItem, {
|
|
17
|
+
checked: vision === "cvd",
|
|
18
|
+
onCheckedChange: (checked) => setVision(checked ? "cvd" : "normal"),
|
|
19
|
+
children: [/* @__PURE__ */ jsx(Eye, { className: "size-4" }), props.label ?? "Colour-blind mode"]
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export { ButtonSettingsVisionMenuItem };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=ButtonSettingsVisionMenuItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonSettingsVisionMenuItem.js","names":[],"sources":["../../src/shell/ButtonSettingsVisionMenuItem.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useVisionMode } from \"alepha/react/ui\";\nimport { Eye } from \"lucide-react\";\n\nimport { DropdownMenuCheckboxItem } from \"../core/DropdownMenu.tsx\";\n\nexport interface ButtonSettingsVisionMenuItemProps {\n /**\n * Item label. Defaults to `\"Colour-blind mode\"`.\n */\n label?: string;\n}\n\n/**\n * The vision mode as a checkbox item of the account menu: checked while the\n * colour-blind palette is on, through `useVisionMode()`.\n *\n * Reading the mode during render is safe here, as in the color-mode submenu:\n * the menu mounts only when opened, so the server never renders it.\n */\nexport const ButtonSettingsVisionMenuItem = (\n props: ButtonSettingsVisionMenuItemProps,\n) => {\n const { vision, setVision } = useVisionMode();\n\n return (\n <DropdownMenuCheckboxItem\n checked={vision === \"cvd\"}\n onCheckedChange={(checked: boolean) =>\n setVision(checked ? \"cvd\" : \"normal\")\n }\n >\n <Eye className=\"size-4\" />\n {props.label ?? \"Colour-blind mode\"}\n </DropdownMenuCheckboxItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAuBA,MAAa,gCACX,UACG;CACH,MAAM,EAAE,QAAQ,cAAc,cAAc;CAE5C,OACE,qBAAC,0BAAD;EACE,SAAS,WAAW;EACpB,kBAAkB,YAChB,UAAU,UAAU,QAAQ,QAAQ;EAHxC,UAAA,CAME,oBAAC,KAAD,EAAK,WAAU,SAAU,CAAA,GACxB,MAAM,SAAS,mBACQ;;AAE9B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ButtonVisionProps {
|
|
3
|
+
/**
|
|
4
|
+
* Optional aria-label override. Defaults to `"Colour-blind mode"`.
|
|
5
|
+
*/
|
|
6
|
+
label?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Visual variant. Defaults to `"minimal"`. Pass `"outlined"` for a
|
|
9
|
+
* bordered toolbar look.
|
|
10
|
+
*/
|
|
11
|
+
variant?: "minimal" | "outlined";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Colour-blind mode toggle: flips the vision mode between `normal` and `cvd`
|
|
15
|
+
* through `useVisionMode()`, persisted in the UI cookie beside the color mode
|
|
16
|
+
* and the theme, and independent of both.
|
|
17
|
+
*
|
|
18
|
+
* `cvd` puts the class `cvd` on `<html>`, under which the kit's stylesheet
|
|
19
|
+
* swaps its signal colours (success, warning, danger, the chart palette) for
|
|
20
|
+
* a colour-blind-safe palette. An app remaps its own signal tokens in a
|
|
21
|
+
* `.cvd` block (and `.cvd.dark` for dark mode).
|
|
22
|
+
*
|
|
23
|
+
* `aria-pressed` reports the state to assistive technology. It reads the
|
|
24
|
+
* default until hydration has committed, like every UI preference (see
|
|
25
|
+
* `useUiState`), and the visitor's value right after.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ButtonVision: (props: ButtonVisionProps) => React.JSX.Element;
|
|
28
|
+
//# sourceMappingURL=ButtonVision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonVision.d.ts","sourceRoot":"","sources":["../../src/shell/ButtonVision.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CAClC;AAgBD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,UAAW,iBAAiB,sBAqBpD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Button } from "../core/Button.js";
|
|
2
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "../core/Tooltip.js";
|
|
3
|
+
import { Eye, EyeOff } from "lucide-react";
|
|
4
|
+
import "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useVisionMode } from "alepha/react/ui";
|
|
7
|
+
// src/shell/ButtonVision.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Both icons, always rendered, with the `cvd` class on `<html>` revealing
|
|
10
|
+
* one: the vision mode is a paint, not a render, for the reason
|
|
11
|
+
* `ButtonDark` gives. A prerendered page carries the default icon, and the
|
|
12
|
+
* boot script has already set the class from the cookie by first paint, so
|
|
13
|
+
* the visitor sees their own state with no hydration mismatch.
|
|
14
|
+
*/
|
|
15
|
+
const ICONS = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Eye, { className: "size-4 [.cvd_&]:hidden" }), /* @__PURE__ */ jsx(EyeOff, { className: "hidden size-4 [.cvd_&]:block" })] });
|
|
16
|
+
/**
|
|
17
|
+
* Colour-blind mode toggle: flips the vision mode between `normal` and `cvd`
|
|
18
|
+
* through `useVisionMode()`, persisted in the UI cookie beside the color mode
|
|
19
|
+
* and the theme, and independent of both.
|
|
20
|
+
*
|
|
21
|
+
* `cvd` puts the class `cvd` on `<html>`, under which the kit's stylesheet
|
|
22
|
+
* swaps its signal colours (success, warning, danger, the chart palette) for
|
|
23
|
+
* a colour-blind-safe palette. An app remaps its own signal tokens in a
|
|
24
|
+
* `.cvd` block (and `.cvd.dark` for dark mode).
|
|
25
|
+
*
|
|
26
|
+
* `aria-pressed` reports the state to assistive technology. It reads the
|
|
27
|
+
* default until hydration has committed, like every UI preference (see
|
|
28
|
+
* `useUiState`), and the visitor's value right after.
|
|
29
|
+
*/
|
|
30
|
+
const ButtonVision = (props) => {
|
|
31
|
+
const { vision, toggle } = useVisionMode();
|
|
32
|
+
const label = props.label ?? "Colour-blind mode";
|
|
33
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
34
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
35
|
+
variant: props.variant ?? "minimal",
|
|
36
|
+
size: "icon",
|
|
37
|
+
"aria-label": label,
|
|
38
|
+
"aria-pressed": vision === "cvd",
|
|
39
|
+
onClick: toggle
|
|
40
|
+
}),
|
|
41
|
+
children: ICONS
|
|
42
|
+
}), /* @__PURE__ */ jsx(TooltipContent, { children: label })] });
|
|
43
|
+
};
|
|
44
|
+
export { ButtonVision };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=ButtonVision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonVision.js","names":[],"sources":["../../src/shell/ButtonVision.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useVisionMode } from \"alepha/react/ui\";\nimport { Eye, EyeOff } 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 ButtonVisionProps {\n /**\n * Optional aria-label override. Defaults to `\"Colour-blind mode\"`.\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 * Both icons, always rendered, with the `cvd` class on `<html>` revealing\n * one: the vision mode is a paint, not a render, for the reason\n * `ButtonDark` gives. A prerendered page carries the default icon, and the\n * boot script has already set the class from the cookie by first paint, so\n * the visitor sees their own state with no hydration mismatch.\n */\nconst ICONS: ReactNode = (\n <>\n <Eye className=\"size-4 [.cvd_&]:hidden\" />\n <EyeOff className=\"hidden size-4 [.cvd_&]:block\" />\n </>\n);\n\n/**\n * Colour-blind mode toggle: flips the vision mode between `normal` and `cvd`\n * through `useVisionMode()`, persisted in the UI cookie beside the color mode\n * and the theme, and independent of both.\n *\n * `cvd` puts the class `cvd` on `<html>`, under which the kit's stylesheet\n * swaps its signal colours (success, warning, danger, the chart palette) for\n * a colour-blind-safe palette. An app remaps its own signal tokens in a\n * `.cvd` block (and `.cvd.dark` for dark mode).\n *\n * `aria-pressed` reports the state to assistive technology. It reads the\n * default until hydration has committed, like every UI preference (see\n * `useUiState`), and the visitor's value right after.\n */\nexport const ButtonVision = (props: ButtonVisionProps) => {\n const { vision, toggle } = useVisionMode();\n const label = props.label ?? \"Colour-blind mode\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"minimal\"}\n size=\"icon\"\n aria-label={label}\n aria-pressed={vision === \"cvd\"}\n onClick={toggle}\n />\n }\n >\n {ICONS}\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA8BA,MAAM,QACJ,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,KAAD,EAAK,WAAU,yBAA0B,CAAA,GACzC,oBAAC,QAAD,EAAQ,WAAU,+BAAgC,CAAA,CAClD,EAAA,CAAA;;;;;;;;;;;;;;;AAiBJ,MAAa,gBAAgB,UAA6B;CACxD,MAAM,EAAE,QAAQ,WAAW,cAAc;CACzC,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;GACZ,gBAAc,WAAW;GACzB,SAAS;EACV,CAAA;EAGF,UAAA;CACa,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA;AAEb"}
|
package/dist/shell/index.d.ts
CHANGED
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
* `AppShell` is the sidebar-and-header frame of an application and `NavShell`
|
|
9
9
|
* the page-tree variant with its `Spotlight` search. `PlateLayout` and
|
|
10
10
|
* `DetailLayout` frame a page, `AppActions` a toolbar. `ButtonDark`,
|
|
11
|
-
* `ButtonTheme`, `ButtonLanguage`, `ButtonInbox` and
|
|
12
|
-
* header buttons, and `ButtonSettings` is the account
|
|
13
|
-
* theme
|
|
11
|
+
* `ButtonVision`, `ButtonTheme`, `ButtonLanguage`, `ButtonInbox` and
|
|
12
|
+
* `ButtonUser` are the header buttons, and `ButtonSettings` is the account
|
|
13
|
+
* button with language, theme, display mode and colour-blind mode folded
|
|
14
|
+
* into its menu once signed in.
|
|
14
15
|
* `ActionErrorToaster` turns a failed action into a toast.
|
|
15
16
|
*
|
|
16
17
|
* @module alepha.ui.shell
|
|
@@ -27,8 +28,10 @@ export { ButtonSettings, type ButtonSettingsProps } from "./ButtonSettings.tsx";
|
|
|
27
28
|
export type { ButtonSettingsColorModeMenuProps } from "./ButtonSettingsColorModeMenu.tsx";
|
|
28
29
|
export type { ButtonSettingsLanguageMenuProps } from "./ButtonSettingsLanguageMenu.tsx";
|
|
29
30
|
export type { ButtonSettingsThemeMenuProps } from "./ButtonSettingsThemeMenu.tsx";
|
|
31
|
+
export type { ButtonSettingsVisionMenuItemProps } from "./ButtonSettingsVisionMenuItem.tsx";
|
|
30
32
|
export { ButtonTheme, type ButtonThemeProps } from "./ButtonTheme.tsx";
|
|
31
33
|
export { ButtonUser, type ButtonUserProps } from "./ButtonUser.tsx";
|
|
34
|
+
export { ButtonVision, type ButtonVisionProps } from "./ButtonVision.tsx";
|
|
32
35
|
export type { ButtonUserAccountMenuItemProps } from "./ButtonUserAccountMenuItem.tsx";
|
|
33
36
|
export type { ButtonUserAdminMenuItemProps } from "./ButtonUserAdminMenuItem.tsx";
|
|
34
37
|
export type { ButtonUserEmailProps } from "./ButtonUserEmail.tsx";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shell/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shell/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EACL,QAAQ,EACR,KAAK,aAAa,EAClB,KAAK,yBAAyB,GAC/B,MAAM,gBAAgB,CAAC;AACxB,YAA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ACvD,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/shell/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ButtonLanguage } from "./ButtonLanguage.js";
|
|
|
8
8
|
import { ButtonSettings } from "./ButtonSettings.js";
|
|
9
9
|
import { ButtonTheme } from "./ButtonTheme.js";
|
|
10
10
|
import { ButtonUser } from "./ButtonUser.js";
|
|
11
|
+
import { ButtonVision } from "./ButtonVision.js";
|
|
11
12
|
import { DetailAside } from "./DetailAside.js";
|
|
12
13
|
import { DetailLayout } from "./DetailLayout.js";
|
|
13
14
|
import { inboxUnreadAtom } from "./inboxUnreadAtom.js";
|
|
@@ -18,4 +19,4 @@ import { SidebarBackHeader } from "./SidebarBackHeader.js";
|
|
|
18
19
|
import { SidebarNavAutoClose } from "./SidebarNavAutoClose.js";
|
|
19
20
|
import { Spotlight } from "./Spotlight.js";
|
|
20
21
|
import { useDetailTab } from "./useDetailTab.js";
|
|
21
|
-
export { $pageNav, ActionErrorToaster, AppActions, AppShell, ButtonDark, ButtonInbox, ButtonLanguage, ButtonSettings, ButtonTheme, ButtonUser, DetailAside, DetailLayout, NavShell, NavigationProgress, PlateLayout, SidebarBackHeader, SidebarNavAutoClose, Spotlight, inboxUnreadAtom, useDetailTab };
|
|
22
|
+
export { $pageNav, ActionErrorToaster, AppActions, AppShell, ButtonDark, ButtonInbox, ButtonLanguage, ButtonSettings, ButtonTheme, ButtonUser, ButtonVision, DetailAside, DetailLayout, NavShell, NavigationProgress, PlateLayout, SidebarBackHeader, SidebarNavAutoClose, Spotlight, inboxUnreadAtom, useDetailTab };
|
package/dist/styles.css
CHANGED
|
@@ -433,6 +433,63 @@
|
|
|
433
433
|
--sidebar-ring: oklch(0.556 0 0);
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
/*
|
|
437
|
+
* Colour-blind mode (colour vision deficiency): the `cvd` class on `<html>`,
|
|
438
|
+
* set by `alepha/react/ui` (`useVisionMode`, `ButtonVision`) and painted
|
|
439
|
+
* before first paint by its boot script. Independent of `.dark` and of the
|
|
440
|
+
* theme palette, so it combines with both.
|
|
441
|
+
*
|
|
442
|
+
* It swaps only the tokens that CARRY MEANING (success, warning, danger and
|
|
443
|
+
* the chart palette) for Okabe and Ito's colour-blind-safe palette, as Wong
|
|
444
|
+
* popularised it: blue #0072b2, vermillion #d55e00, bluish green #009e73,
|
|
445
|
+
* reddish purple #cc79a7, orange #e69f00, with lighter variants in dark. The
|
|
446
|
+
* red/green pair, the one most deficiencies merge, becomes vermillion/blue.
|
|
447
|
+
* `--primary` and the neutrals are brand and surface, not signal, and stay.
|
|
448
|
+
*
|
|
449
|
+
* Contrast holds AA (4.5:1) on every foreground: a fill's `-foreground`
|
|
450
|
+
* against the fill, a `-text` against the page. Vermillion and orange are
|
|
451
|
+
* too light for white text, so their fills take the dark foreground the
|
|
452
|
+
* warning already used, and their `-text` is a darker step of the same hue.
|
|
453
|
+
*
|
|
454
|
+
* `:root.cvd` rather than `.cvd`: (0,2,0) beats a bare `.theme-*` and
|
|
455
|
+
* `:root.cvd.dark` (0,3,0) beats `.theme-*.dark`, so the palette wins over a
|
|
456
|
+
* theme loaded after this file, whichever it is. An app remaps its own
|
|
457
|
+
* signal tokens the same way, in a `.cvd` and a `.cvd.dark` block.
|
|
458
|
+
*/
|
|
459
|
+
:root.cvd {
|
|
460
|
+
--success: #0072b2;
|
|
461
|
+
--success-foreground: #ffffff;
|
|
462
|
+
--success-text: #0072b2;
|
|
463
|
+
--warning: #e69f00;
|
|
464
|
+
--warning-foreground: #111418;
|
|
465
|
+
--warning-text: #8f6200;
|
|
466
|
+
--danger: #d55e00;
|
|
467
|
+
--danger-foreground: #111418;
|
|
468
|
+
--danger-text: #b34f00;
|
|
469
|
+
--chart-1: #0072b2;
|
|
470
|
+
--chart-2: #e69f00;
|
|
471
|
+
--chart-3: #009e73;
|
|
472
|
+
--chart-4: #cc79a7;
|
|
473
|
+
--chart-5: #d55e00;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
:root.cvd.dark {
|
|
477
|
+
--success: #0072b2;
|
|
478
|
+
--success-foreground: #ffffff;
|
|
479
|
+
--success-text: #4ea8e0;
|
|
480
|
+
--warning: #e69f00;
|
|
481
|
+
--warning-foreground: #111418;
|
|
482
|
+
--warning-text: #ffba33;
|
|
483
|
+
--danger: #d55e00;
|
|
484
|
+
--danger-foreground: #111418;
|
|
485
|
+
--danger-text: #ff8a3d;
|
|
486
|
+
--chart-1: #4ea8e0;
|
|
487
|
+
--chart-2: #ffba33;
|
|
488
|
+
--chart-3: #2bc999;
|
|
489
|
+
--chart-4: #e3a8c5;
|
|
490
|
+
--chart-5: #ff8a3d;
|
|
491
|
+
}
|
|
492
|
+
|
|
436
493
|
/*
|
|
437
494
|
* `--surface` follows the surface utilities rather than being set by hand
|
|
438
495
|
* in each component: a hand-written `bg-card` panel is as much a surface as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/table/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/table/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAmBlE,OAAO,KAAK,EAEV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EAIhB,MAAM,qBAAqB,CAAC;AAW7B,MAAM,MAAM,cAAc,CACxB,CAAC,EACD,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,IACvD,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACpB,CAAC,EACD,KAAK,CAAC,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,SAExD,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,sBAmpB5B,CAAC"}
|