@alepha/ui 0.33.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.
Files changed (236) hide show
  1. package/dist/admin/analytics/AdvancedSection.d.ts.map +1 -1
  2. package/dist/admin/analytics/AdvancedSection.js +7 -3
  3. package/dist/admin/analytics/AdvancedSection.js.map +1 -1
  4. package/dist/admin/analytics/AnalyticsChart.d.ts +1 -0
  5. package/dist/admin/analytics/AnalyticsChart.d.ts.map +1 -1
  6. package/dist/admin/analytics/AnalyticsChart.js +3 -1
  7. package/dist/admin/analytics/AnalyticsChart.js.map +1 -1
  8. package/dist/admin/analytics/AnalyticsChartHeader.d.ts +5 -0
  9. package/dist/admin/analytics/AnalyticsChartHeader.d.ts.map +1 -1
  10. package/dist/admin/analytics/AnalyticsChartHeader.js +7 -2
  11. package/dist/admin/analytics/AnalyticsChartHeader.js.map +1 -1
  12. package/dist/admin/analytics/AnalyticsChartLine.d.ts +5 -0
  13. package/dist/admin/analytics/AnalyticsChartLine.d.ts.map +1 -1
  14. package/dist/admin/analytics/AnalyticsChartLine.js +6 -2
  15. package/dist/admin/analytics/AnalyticsChartLine.js.map +1 -1
  16. package/dist/admin/analytics/CoarsenedBadge.d.ts +15 -0
  17. package/dist/admin/analytics/CoarsenedBadge.d.ts.map +1 -0
  18. package/dist/admin/analytics/CoarsenedBadge.js +30 -0
  19. package/dist/admin/analytics/CoarsenedBadge.js.map +1 -0
  20. package/dist/admin/analytics/CompareNote.d.ts +5 -0
  21. package/dist/admin/analytics/CompareNote.d.ts.map +1 -1
  22. package/dist/admin/analytics/CompareNote.js +5 -1
  23. package/dist/admin/analytics/CompareNote.js.map +1 -1
  24. package/dist/admin/analytics/FilterEditor.d.ts +1 -0
  25. package/dist/admin/analytics/FilterEditor.d.ts.map +1 -1
  26. package/dist/admin/analytics/FilterEditor.js +1 -0
  27. package/dist/admin/analytics/FilterEditor.js.map +1 -1
  28. package/dist/admin/analytics/GroupByChips.d.ts +17 -11
  29. package/dist/admin/analytics/GroupByChips.d.ts.map +1 -1
  30. package/dist/admin/analytics/GroupByChips.js +21 -20
  31. package/dist/admin/analytics/GroupByChips.js.map +1 -1
  32. package/dist/admin/analytics/MeasureChips.d.ts +11 -6
  33. package/dist/admin/analytics/MeasureChips.d.ts.map +1 -1
  34. package/dist/admin/analytics/MeasureChips.js +13 -16
  35. package/dist/admin/analytics/MeasureChips.js.map +1 -1
  36. package/dist/admin/analytics/QueryPanel.d.ts.map +1 -1
  37. package/dist/admin/analytics/QueryPanel.js +9 -5
  38. package/dist/admin/analytics/QueryPanel.js.map +1 -1
  39. package/dist/admin/analytics/RangeControl.d.ts +11 -7
  40. package/dist/admin/analytics/RangeControl.d.ts.map +1 -1
  41. package/dist/admin/analytics/RangeControl.js +83 -30
  42. package/dist/admin/analytics/RangeControl.js.map +1 -1
  43. package/dist/admin/analytics/ResultsPane.d.ts.map +1 -1
  44. package/dist/admin/analytics/ResultsPane.js +13 -9
  45. package/dist/admin/analytics/ResultsPane.js.map +1 -1
  46. package/dist/admin/analytics/ResultsTable.d.ts.map +1 -1
  47. package/dist/admin/analytics/ResultsTable.js +3 -3
  48. package/dist/admin/analytics/ResultsTable.js.map +1 -1
  49. package/dist/admin/analytics/TotalsCards.d.ts +2 -1
  50. package/dist/admin/analytics/TotalsCards.d.ts.map +1 -1
  51. package/dist/admin/analytics/TotalsCards.js +9 -10
  52. package/dist/admin/analytics/TotalsCards.js.map +1 -1
  53. package/dist/admin/analytics/analyticsModel.d.ts +126 -17
  54. package/dist/admin/analytics/analyticsModel.d.ts.map +1 -1
  55. package/dist/admin/analytics/analyticsModel.js +283 -48
  56. package/dist/admin/analytics/analyticsModel.js.map +1 -1
  57. package/dist/admin/analytics/analyticsTypes.d.ts +55 -4
  58. package/dist/admin/analytics/analyticsTypes.d.ts.map +1 -1
  59. package/dist/admin/analytics/chartModel.d.ts +38 -3
  60. package/dist/admin/analytics/chartModel.d.ts.map +1 -1
  61. package/dist/admin/analytics/chartModel.js +86 -16
  62. package/dist/admin/analytics/chartModel.js.map +1 -1
  63. package/dist/admin/analytics/instantRangeSchema.d.ts +8 -0
  64. package/dist/admin/analytics/instantRangeSchema.d.ts.map +1 -0
  65. package/dist/admin/analytics/instantRangeSchema.js +13 -0
  66. package/dist/admin/analytics/instantRangeSchema.js.map +1 -0
  67. package/dist/admin/analytics/useAnalyticsQuery.d.ts +13 -3
  68. package/dist/admin/analytics/useAnalyticsQuery.d.ts.map +1 -1
  69. package/dist/admin/analytics/useAnalyticsQuery.js +60 -21
  70. package/dist/admin/analytics/useAnalyticsQuery.js.map +1 -1
  71. package/dist/admin/analytics/useFilterValues.d.ts +4 -0
  72. package/dist/admin/analytics/useFilterValues.d.ts.map +1 -1
  73. package/dist/admin/analytics/useFilterValues.js +6 -6
  74. package/dist/admin/analytics/useFilterValues.js.map +1 -1
  75. package/dist/ai/AiChat.d.ts +30 -0
  76. package/dist/ai/AiChat.d.ts.map +1 -0
  77. package/dist/ai/AiChat.js +116 -0
  78. package/dist/ai/AiChat.js.map +1 -0
  79. package/dist/ai/AiChatConfirmCard.d.ts +17 -0
  80. package/dist/ai/AiChatConfirmCard.d.ts.map +1 -0
  81. package/dist/ai/AiChatConfirmCard.js +47 -0
  82. package/dist/ai/AiChatConfirmCard.js.map +1 -0
  83. package/dist/ai/AiChatHistory.d.ts +14 -0
  84. package/dist/ai/AiChatHistory.d.ts.map +1 -0
  85. package/dist/ai/AiChatHistory.js +40 -0
  86. package/dist/ai/AiChatHistory.js.map +1 -0
  87. package/dist/ai/AiChatMessage.d.ts +10 -0
  88. package/dist/ai/AiChatMessage.d.ts.map +1 -0
  89. package/dist/ai/AiChatMessage.js +38 -0
  90. package/dist/ai/AiChatMessage.js.map +1 -0
  91. package/dist/ai/AiFormRegistry.d.ts +37 -0
  92. package/dist/ai/AiFormRegistry.d.ts.map +1 -0
  93. package/dist/ai/AiFormRegistry.js +59 -0
  94. package/dist/ai/AiFormRegistry.js.map +1 -0
  95. package/dist/ai/aiChatMessageFormSchema.d.ts +7 -0
  96. package/dist/ai/aiChatMessageFormSchema.d.ts.map +1 -0
  97. package/dist/ai/aiChatMessageFormSchema.js +13 -0
  98. package/dist/ai/aiChatMessageFormSchema.js.map +1 -0
  99. package/dist/ai/aiContextAtom.d.ts +16 -0
  100. package/dist/ai/aiContextAtom.d.ts.map +1 -0
  101. package/dist/ai/aiContextAtom.js +25 -0
  102. package/dist/ai/aiContextAtom.js.map +1 -0
  103. package/dist/ai/index.d.ts +18 -0
  104. package/dist/ai/index.d.ts.map +1 -0
  105. package/dist/ai/index.js +10 -0
  106. package/dist/ai/useAiChat.d.ts +82 -0
  107. package/dist/ai/useAiChat.d.ts.map +1 -0
  108. package/dist/ai/useAiChat.js +256 -0
  109. package/dist/ai/useAiChat.js.map +1 -0
  110. package/dist/ai/useAiContext.d.ts +33 -0
  111. package/dist/ai/useAiContext.d.ts.map +1 -0
  112. package/dist/ai/useAiContext.js +52 -0
  113. package/dist/ai/useAiContext.js.map +1 -0
  114. package/dist/core/Breadcrumb.js +1 -1
  115. package/dist/core/Breadcrumb.js.map +1 -1
  116. package/dist/core/Sheet.d.ts +6 -1
  117. package/dist/core/Sheet.d.ts.map +1 -1
  118. package/dist/core/Sheet.js +2 -2
  119. package/dist/core/Sheet.js.map +1 -1
  120. package/dist/core/Sidebar.d.ts +7 -1
  121. package/dist/core/Sidebar.d.ts.map +1 -1
  122. package/dist/core/Sidebar.js +22 -17
  123. package/dist/core/Sidebar.js.map +1 -1
  124. package/dist/core/index.js +2 -2
  125. package/dist/form/Control.d.ts +14 -0
  126. package/dist/form/Control.d.ts.map +1 -1
  127. package/dist/form/Control.js +9 -3
  128. package/dist/form/Control.js.map +1 -1
  129. package/dist/form/ControlDate.d.ts +11 -0
  130. package/dist/form/ControlDate.d.ts.map +1 -1
  131. package/dist/form/ControlDate.js +20 -2
  132. package/dist/form/ControlDate.js.map +1 -1
  133. package/dist/form/ControlDatePopover.d.ts +3 -0
  134. package/dist/form/ControlDatePopover.d.ts.map +1 -1
  135. package/dist/form/ControlDatePopover.js +1 -0
  136. package/dist/form/ControlDatePopover.js.map +1 -1
  137. package/dist/form/ControlMonthPopover.d.ts +25 -0
  138. package/dist/form/ControlMonthPopover.d.ts.map +1 -0
  139. package/dist/form/ControlMonthPopover.js +112 -0
  140. package/dist/form/ControlMonthPopover.js.map +1 -0
  141. package/dist/form/ControlSelect.d.ts +7 -0
  142. package/dist/form/ControlSelect.d.ts.map +1 -1
  143. package/dist/form/ControlSelect.js +37 -0
  144. package/dist/form/ControlSelect.js.map +1 -1
  145. package/dist/i18n/fr/uiFr.d.ts.map +1 -1
  146. package/dist/i18n/fr/uiFr.js +31 -1
  147. package/dist/i18n/fr/uiFr.js.map +1 -1
  148. package/dist/shell/AppShellNavCollapse.d.ts +4 -0
  149. package/dist/shell/AppShellNavCollapse.d.ts.map +1 -1
  150. package/dist/shell/AppShellNavCollapse.js +1 -0
  151. package/dist/shell/AppShellNavCollapse.js.map +1 -1
  152. package/dist/shell/AppShellSidebarNavItem.d.ts.map +1 -1
  153. package/dist/shell/AppShellSidebarNavItem.js +13 -9
  154. package/dist/shell/AppShellSidebarNavItem.js.map +1 -1
  155. package/dist/shell/AppShellStatefulSidebarTrigger.d.ts.map +1 -1
  156. package/dist/shell/AppShellStatefulSidebarTrigger.js +5 -2
  157. package/dist/shell/AppShellStatefulSidebarTrigger.js.map +1 -1
  158. package/dist/table/DataTable.d.ts.map +1 -1
  159. package/dist/table/DataTable.js +2 -1
  160. package/dist/table/DataTable.js.map +1 -1
  161. package/dist/table/DataTableToolbar.d.ts +7 -3
  162. package/dist/table/DataTableToolbar.d.ts.map +1 -1
  163. package/dist/table/DataTableToolbar.js +7 -3
  164. package/dist/table/DataTableToolbar.js.map +1 -1
  165. package/dist/table/dataTableBaseProps.d.ts +17 -0
  166. package/dist/table/dataTableBaseProps.d.ts.map +1 -1
  167. package/docs/packages-alepha-ui-account.md +29 -0
  168. package/docs/packages-alepha-ui-admin.md +35 -0
  169. package/docs/packages-alepha-ui-ai.md +29 -0
  170. package/docs/packages-alepha-ui-auth.md +23 -0
  171. package/docs/packages-alepha-ui-calendar.md +24 -0
  172. package/docs/packages-alepha-ui-chart.md +23 -0
  173. package/docs/packages-alepha-ui-command.md +24 -0
  174. package/docs/packages-alepha-ui-core.md +40 -0
  175. package/docs/packages-alepha-ui-form.md +29 -0
  176. package/docs/packages-alepha-ui-i18n-fr.md +31 -0
  177. package/docs/packages-alepha-ui-markdown.md +27 -0
  178. package/docs/packages-alepha-ui-organizations.md +20 -0
  179. package/docs/packages-alepha-ui-otp.md +22 -0
  180. package/docs/packages-alepha-ui-overview.md +337 -0
  181. package/docs/packages-alepha-ui-resizable.md +22 -0
  182. package/docs/packages-alepha-ui-settings.md +23 -0
  183. package/docs/packages-alepha-ui-shell.md +41 -0
  184. package/docs/packages-alepha-ui-table.md +37 -0
  185. package/docs/packages-alepha-ui-tree.md +31 -0
  186. package/package.json +15 -5
  187. package/src/admin/analytics/AdvancedSection.tsx +39 -30
  188. package/src/admin/analytics/AnalyticsChart.tsx +7 -1
  189. package/src/admin/analytics/AnalyticsChartHeader.tsx +22 -7
  190. package/src/admin/analytics/AnalyticsChartLine.tsx +15 -2
  191. package/src/admin/analytics/CoarsenedBadge.tsx +38 -0
  192. package/src/admin/analytics/CompareNote.tsx +16 -5
  193. package/src/admin/analytics/FilterEditor.tsx +2 -0
  194. package/src/admin/analytics/GroupByChips.tsx +40 -27
  195. package/src/admin/analytics/MeasureChips.tsx +19 -11
  196. package/src/admin/analytics/QueryPanel.tsx +10 -5
  197. package/src/admin/analytics/RangeControl.tsx +91 -27
  198. package/src/admin/analytics/ResultsPane.tsx +20 -6
  199. package/src/admin/analytics/ResultsTable.tsx +9 -5
  200. package/src/admin/analytics/TotalsCards.tsx +24 -11
  201. package/src/admin/analytics/analyticsModel.spec.ts +167 -36
  202. package/src/admin/analytics/analyticsModel.ts +358 -49
  203. package/src/admin/analytics/analyticsTypes.ts +56 -4
  204. package/src/admin/analytics/chartModel.ts +139 -20
  205. package/src/admin/analytics/instantRangeSchema.ts +9 -0
  206. package/src/admin/analytics/useAnalyticsQuery.ts +98 -35
  207. package/src/admin/analytics/useFilterValues.ts +16 -5
  208. package/src/ai/AiChat.tsx +151 -0
  209. package/src/ai/AiChatConfirmCard.tsx +64 -0
  210. package/src/ai/AiChatHistory.tsx +60 -0
  211. package/src/ai/AiChatMessage.tsx +57 -0
  212. package/src/ai/AiFormRegistry.ts +78 -0
  213. package/src/ai/__tests__/AiChat.browser.spec.tsx +391 -0
  214. package/src/ai/aiChatMessageFormSchema.ts +8 -0
  215. package/src/ai/aiContextAtom.ts +23 -0
  216. package/src/ai/index.ts +18 -0
  217. package/src/ai/useAiChat.ts +343 -0
  218. package/src/ai/useAiContext.ts +74 -0
  219. package/src/core/Breadcrumb.tsx +1 -1
  220. package/src/core/Sheet.tsx +9 -2
  221. package/src/core/Sidebar.tsx +45 -22
  222. package/src/form/Control.tsx +26 -1
  223. package/src/form/ControlDate.tsx +37 -2
  224. package/src/form/ControlDatePopover.tsx +4 -1
  225. package/src/form/ControlMonthPopover.tsx +169 -0
  226. package/src/form/ControlSelect.tsx +62 -0
  227. package/src/form/__tests__/ControlChoices.browser.spec.tsx +130 -0
  228. package/src/i18n/fr/uiFr.ts +36 -2
  229. package/src/shell/AppShellNavCollapse.tsx +5 -0
  230. package/src/shell/AppShellSidebarNavItem.tsx +23 -10
  231. package/src/shell/AppShellStatefulSidebarTrigger.tsx +10 -2
  232. package/src/shell/__tests__/AppShellDirection.browser.spec.tsx +95 -0
  233. package/src/table/DataTable.tsx +2 -0
  234. package/src/table/DataTableToolbar.tsx +18 -3
  235. package/src/table/__tests__/DataTableLeading.browser.spec.tsx +130 -0
  236. package/src/table/dataTableBaseProps.ts +17 -0
@@ -7,12 +7,13 @@ import { AppShellNavCollapse } from "./AppShellNavCollapse.js";
7
7
  import { AppShellNavDropdownItems } from "./AppShellNavDropdownItems.js";
8
8
  import { Link } from "alepha/react/router";
9
9
  import { ChevronRight, Lock, Minus, Plus } from "lucide-react";
10
- import { useState } from "react";
10
+ import { useId, useState } from "react";
11
11
  import { jsx, jsxs } from "react/jsx-runtime";
12
12
  //#region src/shell/AppShellSidebarNavItem.tsx
13
13
  const AppShellSidebarNavItem = (props) => {
14
14
  const { item, path, accordion, animate, toggleIcon } = props;
15
15
  const { state, isMobile } = useSidebar();
16
+ const collapseId = useId();
16
17
  const children = item.children;
17
18
  const isGroup = !!children && children.length > 0;
18
19
  const hasActive = isGroup && hasActiveDescendant(item);
@@ -36,14 +37,14 @@ const AppShellSidebarNavItem = (props) => {
36
37
  children: [
37
38
  renderNavIcon(item.icon, "size-4 shrink-0"),
38
39
  /* @__PURE__ */ jsx("span", {
39
- className: "flex-1 truncate text-left",
40
+ className: "flex-1 truncate text-start",
40
41
  children: item.label
41
42
  }),
42
43
  /* @__PURE__ */ jsx(Lock, { className: "size-3.5 shrink-0 opacity-70" })
43
44
  ]
44
45
  });
45
46
  return /* @__PURE__ */ jsx(SidebarMenuItem, { children: item.tooltip ? /* @__PURE__ */ jsxs(HoverCard, { children: [/* @__PURE__ */ jsx(HoverCardTrigger, { render: row }), /* @__PURE__ */ jsx(HoverCardContent, {
46
- side: "right",
47
+ side: "inline-end",
47
48
  align: "start",
48
49
  className: "text-sm",
49
50
  children: item.tooltip
@@ -59,7 +60,7 @@ const AppShellSidebarNavItem = (props) => {
59
60
  children: [renderNavIcon(item.icon, "size-4"), /* @__PURE__ */ jsx("span", { children: item.label })]
60
61
  });
61
62
  const row = item.tooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: link }), /* @__PURE__ */ jsx(TooltipContent, {
62
- side: "right",
63
+ side: "inline-end",
63
64
  children: item.tooltip
64
65
  })] }) : link;
65
66
  return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [row, item.badge != null && item.badge !== false && /* @__PURE__ */ jsx(SidebarMenuBadge, { children: item.badge })] });
@@ -69,30 +70,33 @@ const AppShellSidebarNavItem = (props) => {
69
70
  children: [
70
71
  renderNavIcon(item.icon, "size-4"),
71
72
  /* @__PURE__ */ jsx("span", {
72
- className: "flex-1 text-left",
73
+ className: "flex-1 text-start",
73
74
  children: item.label
74
75
  }),
75
- /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
76
+ /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 rtl:-scale-x-100" })
76
77
  ]
77
78
  }), /* @__PURE__ */ jsx(DropdownMenuContent, {
78
- side: "right",
79
+ side: "inline-end",
79
80
  align: "start",
80
81
  className: "min-w-48",
81
82
  children: /* @__PURE__ */ jsxs(DropdownMenuGroup, { children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: item.label }), /* @__PURE__ */ jsx(AppShellNavDropdownItems, { items: children })] })
82
83
  })] }) });
83
84
  return /* @__PURE__ */ jsxs(SidebarMenuItem, { children: [/* @__PURE__ */ jsxs(SidebarMenuButton, {
84
85
  onClick: toggle,
86
+ "aria-expanded": open,
87
+ "aria-controls": collapseId,
85
88
  isActive: item.active,
86
89
  tooltip: typeof item.label === "string" ? item.label : void 0,
87
90
  children: [
88
91
  renderNavIcon(item.icon, "size-4"),
89
92
  /* @__PURE__ */ jsx("span", {
90
- className: "flex-1 text-left",
93
+ className: "flex-1 text-start",
91
94
  children: item.label
92
95
  }),
93
- toggleIcon === "plusMinus" ? open ? /* @__PURE__ */ jsx(Minus, { className: "size-4" }) : /* @__PURE__ */ jsx(Plus, { className: "size-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: `size-4 transition-transform ${open ? "rotate-90" : ""}` })
96
+ toggleIcon === "plusMinus" ? open ? /* @__PURE__ */ jsx(Minus, { className: "size-4" }) : /* @__PURE__ */ jsx(Plus, { className: "size-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: `size-4 transition-transform rtl:-scale-x-100 ${open ? "rotate-90" : ""}` })
94
97
  ]
95
98
  }), /* @__PURE__ */ jsx(AppShellNavCollapse, {
99
+ id: collapseId,
96
100
  open,
97
101
  animate,
98
102
  children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: children.map((child, ci) => /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: child.children && child.children.length > 0 ? /* @__PURE__ */ jsx(AppShellSidebarNavItem, {
@@ -1 +1 @@
1
- {"version":3,"file":"AppShellSidebarNavItem.js","names":[],"sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Link } from \"alepha/react/router\";\nimport { ChevronRight, Lock, Minus, Plus } from \"lucide-react\";\nimport { useState } from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"../core/HoverCard.tsx\";\nimport {\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n useSidebar,\n} from \"../core/Sidebar.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport {\n hasActiveDescendant,\n isOpenPathPrefix,\n type NavAccordion,\n type NavItem,\n renderNavIcon,\n} from \"./appShellNav.tsx\";\nimport { AppShellNavCollapse } from \"./AppShellNavCollapse.tsx\";\nimport { AppShellNavDropdownItems } from \"./AppShellNavDropdownItems.tsx\";\n\nexport interface AppShellSidebarNavItemProps {\n item: NavItem;\n /**\n * This item's position in `nav`, used only by the accordion. See\n * {@link NavAccordion}.\n */\n path: number[];\n /**\n * Present when `navAccordion` is on, and then it OWNS the open state: the\n * local `useState` below is still declared (hooks cannot be conditional) but\n * nothing reads it.\n */\n accordion?: NavAccordion;\n /**\n * `navAnimate`, threaded down so a nested group animates like its parent.\n */\n animate: boolean;\n /**\n * `navToggleIcon`, threaded down for the same reason.\n */\n toggleIcon: \"caret\" | \"plusMinus\";\n}\n\nexport const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {\n const { item, path, accordion, animate, toggleIcon } = props;\n const { state, isMobile } = useSidebar();\n const children = item.children;\n const isGroup = !!children && children.length > 0;\n const hasActive = isGroup && hasActiveDescendant(item);\n const [localOpen, setLocalOpen] = useState(item.defaultOpen ?? hasActive);\n // Reveal a collapsed group when navigation makes one of its descendants\n // active — SPA nav, spotlight (⌘K), breadcrumb, or a deep-link that doesn't\n // remount this item (useState's initializer runs only at mount, so without\n // this the group stays stuck closed and the active page is hidden — petition\n // #4). Only OPENS; never auto-collapses, so a manual toggle is preserved.\n //\n // Accordion mode does the same job in `AppShell` instead, from the tree, and\n // skips this: the state lives there, and a child cannot write it mid-render.\n const [wasActive, setWasActive] = useState(hasActive);\n if (!accordion && hasActive !== wasActive) {\n setWasActive(hasActive);\n if (hasActive) setLocalOpen(true);\n }\n\n const open = accordion\n ? isOpenPathPrefix(path, accordion.openPath)\n : localOpen;\n\n // Closing means handing the branch back to this item's PARENT, not clearing\n // it: a nested group that closed itself by emptying the path would collapse\n // every ancestor along with it.\n const toggle = () => {\n if (accordion) {\n accordion.setOpenPath(open ? path.slice(0, -1) : path);\n } else {\n setLocalOpen((v) => !v);\n }\n };\n\n if (!isGroup) {\n // Disabled rows render with a muted, dashed-border treatment plus a\n // Lock affordance on the trailing edge. Clicks are swallowed. When a\n // `tooltip` is provided, the row opens a HoverCard dropdown on hover\n // so the explanation has space to breathe regardless of sidebar\n // state.\n if (item.disabled) {\n // Bypass SidebarMenuButton — it self-wraps in a Tooltip when given\n // a `tooltip` prop, which would swallow the HoverCard pointer\n // events. A plain styled <div> keeps cursor-not-allowed and lets\n // the row act as the HoverCard trigger.\n const row = (\n <div\n aria-disabled=\"true\"\n className=\"border-muted-foreground/40 bg-muted/40 text-muted-foreground flex h-8 w-full items-center gap-2 rounded-md border border-dashed px-2 text-sm\"\n style={{ cursor: \"not-allowed\" }}\n >\n {renderNavIcon(item.icon, \"size-4 shrink-0\")}\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n <Lock className=\"size-3.5 shrink-0 opacity-70\" />\n </div>\n );\n return (\n <SidebarMenuItem>\n {item.tooltip ? (\n <HoverCard>\n <HoverCardTrigger render={row} />\n <HoverCardContent side=\"right\" align=\"start\" className=\"text-sm\">\n {item.tooltip}\n </HoverCardContent>\n </HoverCard>\n ) : (\n row\n )}\n </SidebarMenuItem>\n );\n }\n\n const link = (\n <SidebarMenuButton\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n /*\n `aria-current` beside the styling's `data-active`, so a screen\n reader announces the page the reader is on, and a test can find the\n lit entry by role rather than by a styling hook.\n */\n render={\n <Link\n href={item.href ?? \"#\"}\n aria-current={item.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span>{item.label}</span>\n </SidebarMenuButton>\n );\n\n const row = item.tooltip ? (\n <Tooltip>\n <TooltipTrigger render={link} />\n <TooltipContent side=\"right\">{item.tooltip}</TooltipContent>\n </Tooltip>\n ) : (\n link\n );\n\n return (\n <SidebarMenuItem>\n {row}\n {item.badge != null && item.badge !== false && (\n <SidebarMenuBadge>{item.badge}</SidebarMenuBadge>\n )}\n </SidebarMenuItem>\n );\n }\n\n // Collapsed to icons, the expanded branch below is a dead button: it still\n // flips `open`, but what `open` reveals is a `SidebarMenuSub`, which carries\n // `group-data-[collapsible=icon]:hidden`. The group has no `href` either, so\n // there is no fallback — every child is simply unreachable. A dropdown is the\n // standard answer, and it belongs here rather than in any one app because\n // this hits EVERY `NavItem` with children.\n //\n // Mobile is excluded: it uses the sheet, not icon mode, so the sub renders\n // normally there.\n if (isGroup && state === \"collapsed\" && !isMobile) {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n // No `tooltip` here on purpose. `SidebarMenuButton` turns itself\n // into a `TooltipTrigger` when given one, and layering the\n // dropdown trigger on top makes hover and click fight over the\n // same element. The menu names itself with a label instead.\n //\n // `hasActive` joins `item.active` so the trigger still reads as\n // current when a descendant is — collapsed, it is the only clue\n // which group holds the open page.\n <SidebarMenuButton isActive={item.active || hasActive} />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-left\">{item.label}</span>\n <ChevronRight className=\"size-4\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent side=\"right\" align=\"start\" className=\"min-w-48\">\n {/*\n The group wrapper is required, not cosmetic: `DropdownMenuLabel`\n is Base UI's `Menu.GroupLabel`, which reads `MenuGroupContext` and\n THROWS outside a `Menu.Group`. Nothing types this — the label\n compiles fine, and the whole app-shell crashes at the first click\n on the trigger, because the throw happens when the menu opens\n rather than when it mounts.\n */}\n <DropdownMenuGroup>\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n <AppShellNavDropdownItems items={children} />\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n );\n }\n\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={toggle}\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-left\">{item.label}</span>\n {/*\n Plus and minus are SWAPPED, never rotated: a plus turned 45° is a\n close button, which is a different promise. The caret is the one\n that turns, and it stays the default because it is what every app\n using this shell already had.\n */}\n {toggleIcon === \"plusMinus\" ? (\n open ? (\n <Minus className=\"size-4\" />\n ) : (\n <Plus className=\"size-4\" />\n )\n ) : (\n <ChevronRight\n className={`size-4 transition-transform ${open ? \"rotate-90\" : \"\"}`}\n />\n )}\n </SidebarMenuButton>\n <AppShellNavCollapse open={open} animate={animate}>\n <SidebarMenuSub>\n {children.map((child, ci) => (\n <SidebarMenuSubItem key={child.href ?? ci}>\n {child.children && child.children.length > 0 ? (\n <AppShellSidebarNavItem\n item={child}\n path={[...path, ci]}\n accordion={accordion}\n animate={animate}\n toggleIcon={toggleIcon}\n />\n ) : (\n <SidebarMenuSubButton\n isActive={child.active}\n render={\n <Link\n href={child.href ?? \"#\"}\n aria-current={child.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(child.icon, \"size-4\")}\n <span>{child.label}</span>\n </SidebarMenuSubButton>\n )}\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n </AppShellNavCollapse>\n </SidebarMenuItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA+DA,MAAa,0BAA0B,UAAuC;CAC5E,MAAM,EAAE,MAAM,MAAM,WAAW,SAAS,eAAe;CACvD,MAAM,EAAE,OAAO,aAAa,WAAW;CACvC,MAAM,WAAW,KAAK;CACtB,MAAM,UAAU,CAAC,CAAC,YAAY,SAAS,SAAS;CAChD,MAAM,YAAY,WAAW,oBAAoB,IAAI;CACrD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK,eAAe,SAAS;CASxE,MAAM,CAAC,WAAW,gBAAgB,SAAS,SAAS;CACpD,IAAI,CAAC,aAAa,cAAc,WAAW;EACzC,aAAa,SAAS;EACtB,IAAI,WAAW,aAAa,IAAI;CAClC;CAEA,MAAM,OAAO,YACT,iBAAiB,MAAM,UAAU,QAAQ,IACzC;CAKJ,MAAM,eAAe;EACnB,IAAI,WACF,UAAU,YAAY,OAAO,KAAK,MAAM,GAAG,EAAE,IAAI,IAAI;OAErD,cAAc,MAAM,CAAC,CAAC;CAE1B;CAEA,IAAI,CAAC,SAAS;EAMZ,IAAI,KAAK,UAAU;GAKjB,MAAM,MACJ,qBAAC,OAAD;IACE,iBAAc;IACd,WAAU;IACV,OAAO,EAAE,QAAQ,cAAc;IAHjC,UAAA;KAKG,cAAc,KAAK,MAAM,iBAAiB;KAC3C,oBAAC,QAAD;MAAM,WAAU;MAA6B,UAAA,KAAK;KAAY,CAAA;KAC9D,oBAAC,MAAD,EAAM,WAAU,+BAAgC,CAAA;IAC7C;;GAEP,OACE,oBAAC,iBAAD,EAA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ErB"}
1
+ {"version":3,"file":"AppShellSidebarNavItem.js","names":[],"sources":["../../src/shell/AppShellSidebarNavItem.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Link } from \"alepha/react/router\";\nimport { ChevronRight, Lock, Minus, Plus } from \"lucide-react\";\nimport { useId, useState } from \"react\";\n\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../core/DropdownMenu.tsx\";\nimport {\n HoverCard,\n HoverCardContent,\n HoverCardTrigger,\n} from \"../core/HoverCard.tsx\";\nimport {\n SidebarMenuBadge,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarMenuSub,\n SidebarMenuSubButton,\n SidebarMenuSubItem,\n useSidebar,\n} from \"../core/Sidebar.tsx\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../core/Tooltip.tsx\";\nimport {\n hasActiveDescendant,\n isOpenPathPrefix,\n type NavAccordion,\n type NavItem,\n renderNavIcon,\n} from \"./appShellNav.tsx\";\nimport { AppShellNavCollapse } from \"./AppShellNavCollapse.tsx\";\nimport { AppShellNavDropdownItems } from \"./AppShellNavDropdownItems.tsx\";\n\nexport interface AppShellSidebarNavItemProps {\n item: NavItem;\n /**\n * This item's position in `nav`, used only by the accordion. See\n * {@link NavAccordion}.\n */\n path: number[];\n /**\n * Present when `navAccordion` is on, and then it OWNS the open state: the\n * local `useState` below is still declared (hooks cannot be conditional) but\n * nothing reads it.\n */\n accordion?: NavAccordion;\n /**\n * `navAnimate`, threaded down so a nested group animates like its parent.\n */\n animate: boolean;\n /**\n * `navToggleIcon`, threaded down for the same reason.\n */\n toggleIcon: \"caret\" | \"plusMinus\";\n}\n\nexport const AppShellSidebarNavItem = (props: AppShellSidebarNavItemProps) => {\n const { item, path, accordion, animate, toggleIcon } = props;\n const { state, isMobile } = useSidebar();\n const collapseId = useId();\n const children = item.children;\n const isGroup = !!children && children.length > 0;\n const hasActive = isGroup && hasActiveDescendant(item);\n const [localOpen, setLocalOpen] = useState(item.defaultOpen ?? hasActive);\n // Reveal a collapsed group when navigation makes one of its descendants\n // active — SPA nav, spotlight (⌘K), breadcrumb, or a deep-link that doesn't\n // remount this item (useState's initializer runs only at mount, so without\n // this the group stays stuck closed and the active page is hidden — petition\n // #4). Only OPENS; never auto-collapses, so a manual toggle is preserved.\n //\n // Accordion mode does the same job in `AppShell` instead, from the tree, and\n // skips this: the state lives there, and a child cannot write it mid-render.\n const [wasActive, setWasActive] = useState(hasActive);\n if (!accordion && hasActive !== wasActive) {\n setWasActive(hasActive);\n if (hasActive) setLocalOpen(true);\n }\n\n const open = accordion\n ? isOpenPathPrefix(path, accordion.openPath)\n : localOpen;\n\n // Closing means handing the branch back to this item's PARENT, not clearing\n // it: a nested group that closed itself by emptying the path would collapse\n // every ancestor along with it.\n const toggle = () => {\n if (accordion) {\n accordion.setOpenPath(open ? path.slice(0, -1) : path);\n } else {\n setLocalOpen((v) => !v);\n }\n };\n\n if (!isGroup) {\n // Disabled rows render with a muted, dashed-border treatment plus a\n // Lock affordance on the trailing edge. Clicks are swallowed. When a\n // `tooltip` is provided, the row opens a HoverCard dropdown on hover\n // so the explanation has space to breathe regardless of sidebar\n // state.\n if (item.disabled) {\n // Bypass SidebarMenuButton — it self-wraps in a Tooltip when given\n // a `tooltip` prop, which would swallow the HoverCard pointer\n // events. A plain styled <div> keeps cursor-not-allowed and lets\n // the row act as the HoverCard trigger.\n const row = (\n <div\n aria-disabled=\"true\"\n className=\"border-muted-foreground/40 bg-muted/40 text-muted-foreground flex h-8 w-full items-center gap-2 rounded-md border border-dashed px-2 text-sm\"\n style={{ cursor: \"not-allowed\" }}\n >\n {renderNavIcon(item.icon, \"size-4 shrink-0\")}\n <span className=\"flex-1 truncate text-start\">{item.label}</span>\n <Lock className=\"size-3.5 shrink-0 opacity-70\" />\n </div>\n );\n return (\n <SidebarMenuItem>\n {item.tooltip ? (\n <HoverCard>\n <HoverCardTrigger render={row} />\n <HoverCardContent\n side=\"inline-end\"\n align=\"start\"\n className=\"text-sm\"\n >\n {item.tooltip}\n </HoverCardContent>\n </HoverCard>\n ) : (\n row\n )}\n </SidebarMenuItem>\n );\n }\n\n const link = (\n <SidebarMenuButton\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n /*\n `aria-current` beside the styling's `data-active`, so a screen\n reader announces the page the reader is on, and a test can find the\n lit entry by role rather than by a styling hook.\n */\n render={\n <Link\n href={item.href ?? \"#\"}\n aria-current={item.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span>{item.label}</span>\n </SidebarMenuButton>\n );\n\n const row = item.tooltip ? (\n <Tooltip>\n <TooltipTrigger render={link} />\n <TooltipContent side=\"inline-end\">{item.tooltip}</TooltipContent>\n </Tooltip>\n ) : (\n link\n );\n\n return (\n <SidebarMenuItem>\n {row}\n {item.badge != null && item.badge !== false && (\n <SidebarMenuBadge>{item.badge}</SidebarMenuBadge>\n )}\n </SidebarMenuItem>\n );\n }\n\n // Collapsed to icons, the expanded branch below is a dead button: it still\n // flips `open`, but what `open` reveals is a `SidebarMenuSub`, which carries\n // `group-data-[collapsible=icon]:hidden`. The group has no `href` either, so\n // there is no fallback — every child is simply unreachable. A dropdown is the\n // standard answer, and it belongs here rather than in any one app because\n // this hits EVERY `NavItem` with children.\n //\n // Mobile is excluded: it uses the sheet, not icon mode, so the sub renders\n // normally there.\n if (isGroup && state === \"collapsed\" && !isMobile) {\n return (\n <SidebarMenuItem>\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n // No `tooltip` here on purpose. `SidebarMenuButton` turns itself\n // into a `TooltipTrigger` when given one, and layering the\n // dropdown trigger on top makes hover and click fight over the\n // same element. The menu names itself with a label instead.\n //\n // `hasActive` joins `item.active` so the trigger still reads as\n // current when a descendant is — collapsed, it is the only clue\n // which group holds the open page.\n <SidebarMenuButton isActive={item.active || hasActive} />\n }\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-start\">{item.label}</span>\n <ChevronRight className=\"size-4 rtl:-scale-x-100\" />\n </DropdownMenuTrigger>\n <DropdownMenuContent\n side=\"inline-end\"\n align=\"start\"\n className=\"min-w-48\"\n >\n {/*\n The group wrapper is required, not cosmetic: `DropdownMenuLabel`\n is Base UI's `Menu.GroupLabel`, which reads `MenuGroupContext` and\n THROWS outside a `Menu.Group`. Nothing types this — the label\n compiles fine, and the whole app-shell crashes at the first click\n on the trigger, because the throw happens when the menu opens\n rather than when it mounts.\n */}\n <DropdownMenuGroup>\n <DropdownMenuLabel>{item.label}</DropdownMenuLabel>\n <AppShellNavDropdownItems items={children} />\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </SidebarMenuItem>\n );\n }\n\n return (\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={toggle}\n // The group is a disclosure: its state and what it opens, for\n // assistive technology (and a test finding the open group by role).\n aria-expanded={open}\n aria-controls={collapseId}\n isActive={item.active}\n tooltip={typeof item.label === \"string\" ? item.label : undefined}\n >\n {renderNavIcon(item.icon, \"size-4\")}\n <span className=\"flex-1 text-start\">{item.label}</span>\n {/*\n Plus and minus are SWAPPED, never rotated: a plus turned 45° is a\n close button, which is a different promise. The caret is the one\n that turns, and it stays the default because it is what every app\n using this shell already had.\n */}\n {toggleIcon === \"plusMinus\" ? (\n open ? (\n <Minus className=\"size-4\" />\n ) : (\n <Plus className=\"size-4\" />\n )\n ) : (\n <ChevronRight\n className={`size-4 transition-transform rtl:-scale-x-100 ${open ? \"rotate-90\" : \"\"}`}\n />\n )}\n </SidebarMenuButton>\n <AppShellNavCollapse id={collapseId} open={open} animate={animate}>\n <SidebarMenuSub>\n {children.map((child, ci) => (\n <SidebarMenuSubItem key={child.href ?? ci}>\n {child.children && child.children.length > 0 ? (\n <AppShellSidebarNavItem\n item={child}\n path={[...path, ci]}\n accordion={accordion}\n animate={animate}\n toggleIcon={toggleIcon}\n />\n ) : (\n <SidebarMenuSubButton\n isActive={child.active}\n render={\n <Link\n href={child.href ?? \"#\"}\n aria-current={child.active ? \"page\" : undefined}\n />\n }\n >\n {renderNavIcon(child.icon, \"size-4\")}\n <span>{child.label}</span>\n </SidebarMenuSubButton>\n )}\n </SidebarMenuSubItem>\n ))}\n </SidebarMenuSub>\n </AppShellNavCollapse>\n </SidebarMenuItem>\n );\n};\n"],"mappings":";;;;;;;;;;;;AA+DA,MAAa,0BAA0B,UAAuC;CAC5E,MAAM,EAAE,MAAM,MAAM,WAAW,SAAS,eAAe;CACvD,MAAM,EAAE,OAAO,aAAa,WAAW;CACvC,MAAM,aAAa,MAAM;CACzB,MAAM,WAAW,KAAK;CACtB,MAAM,UAAU,CAAC,CAAC,YAAY,SAAS,SAAS;CAChD,MAAM,YAAY,WAAW,oBAAoB,IAAI;CACrD,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK,eAAe,SAAS;CASxE,MAAM,CAAC,WAAW,gBAAgB,SAAS,SAAS;CACpD,IAAI,CAAC,aAAa,cAAc,WAAW;EACzC,aAAa,SAAS;EACtB,IAAI,WAAW,aAAa,IAAI;CAClC;CAEA,MAAM,OAAO,YACT,iBAAiB,MAAM,UAAU,QAAQ,IACzC;CAKJ,MAAM,eAAe;EACnB,IAAI,WACF,UAAU,YAAY,OAAO,KAAK,MAAM,GAAG,EAAE,IAAI,IAAI;OAErD,cAAc,MAAM,CAAC,CAAC;CAE1B;CAEA,IAAI,CAAC,SAAS;EAMZ,IAAI,KAAK,UAAU;GAKjB,MAAM,MACJ,qBAAC,OAAD;IACE,iBAAc;IACd,WAAU;IACV,OAAO,EAAE,QAAQ,cAAc;IAHjC,UAAA;KAKG,cAAc,KAAK,MAAM,iBAAiB;KAC3C,oBAAC,QAAD;MAAM,WAAU;MAA8B,UAAA,KAAK;KAAY,CAAA;KAC/D,oBAAC,MAAD,EAAM,WAAU,+BAAgC,CAAA;IAC7C;;GAEP,OACE,oBAAC,iBAAD,EAAA,UACG,KAAK,UACJ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AAA;AAErB"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppShellStatefulSidebarTrigger.d.ts","sourceRoot":"","sources":["../../src/shell/AppShellStatefulSidebarTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,eAAO,MAAM,8BAA8B,yBAe1C,CAAC"}
1
+ {"version":3,"file":"AppShellStatefulSidebarTrigger.d.ts","sourceRoot":"","sources":["../../src/shell/AppShellStatefulSidebarTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,eAAO,MAAM,8BAA8B,yBAsB1C,CAAC"}
@@ -1,19 +1,22 @@
1
1
  import { Button } from "../core/Button.js";
2
2
  import { useSidebar } from "../core/Sidebar.js";
3
+ import { useI18n } from "alepha/react/i18n";
3
4
  import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
4
5
  import "react";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  //#region src/shell/AppShellStatefulSidebarTrigger.tsx
7
8
  const AppShellStatefulSidebarTrigger = () => {
8
9
  const { toggleSidebar, isMobile, openMobile, state } = useSidebar();
10
+ const { tr } = useI18n();
9
11
  const open = isMobile ? openMobile : state === "expanded";
12
+ const Icon = open ? PanelLeftClose : PanelLeftOpen;
10
13
  return /* @__PURE__ */ jsx(Button, {
11
14
  variant: "minimal",
12
15
  size: "icon",
13
16
  onClick: toggleSidebar,
14
- "aria-label": open ? "Collapse sidebar" : "Expand sidebar",
17
+ "aria-label": open ? tr("nav.sidebar.collapse", { default: "Collapse sidebar" }) : tr("nav.sidebar.expand", { default: "Expand sidebar" }),
15
18
  className: "size-8",
16
- children: /* @__PURE__ */ jsx(open ? PanelLeftClose : PanelLeftOpen, { className: "size-4" })
19
+ children: /* @__PURE__ */ jsx(Icon, { className: "size-4 rtl:-scale-x-100" })
17
20
  });
18
21
  };
19
22
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"AppShellStatefulSidebarTrigger.js","names":[],"sources":["../../src/shell/AppShellStatefulSidebarTrigger.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { PanelLeftClose, PanelLeftOpen } from \"lucide-react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { useSidebar } from \"../core/Sidebar.tsx\";\n\nexport const AppShellStatefulSidebarTrigger = () => {\n const { toggleSidebar, isMobile, openMobile, state } = useSidebar();\n const open = isMobile ? openMobile : state === \"expanded\";\n const Icon = open ? PanelLeftClose : PanelLeftOpen;\n return (\n <Button\n variant=\"minimal\"\n size=\"icon\"\n onClick={toggleSidebar}\n aria-label={open ? \"Collapse sidebar\" : \"Expand sidebar\"}\n className=\"size-8\"\n >\n <Icon className=\"size-4\" />\n </Button>\n );\n};\n"],"mappings":";;;;;;AASA,MAAa,uCAAuC;CAClD,MAAM,EAAE,eAAe,UAAU,YAAY,UAAU,WAAW;CAClE,MAAM,OAAO,WAAW,aAAa,UAAU;CAE/C,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,SAAS;EACT,cAAY,OAAO,qBAAqB;EACxC,WAAU;EAEV,UAAA,oBATS,OAAO,iBAAiB,eASjC,EAAM,WAAU,SAAU,CAAA;CACpB,CAAA;AAEZ"}
1
+ {"version":3,"file":"AppShellStatefulSidebarTrigger.js","names":[],"sources":["../../src/shell/AppShellStatefulSidebarTrigger.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { useI18n } from \"alepha/react/i18n\";\nimport { PanelLeftClose, PanelLeftOpen } from \"lucide-react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport { useSidebar } from \"../core/Sidebar.tsx\";\n\nexport const AppShellStatefulSidebarTrigger = () => {\n const { toggleSidebar, isMobile, openMobile, state } = useSidebar();\n const { tr } = useI18n();\n const open = isMobile ? openMobile : state === \"expanded\";\n const Icon = open ? PanelLeftClose : PanelLeftOpen;\n return (\n <Button\n variant=\"minimal\"\n size=\"icon\"\n onClick={toggleSidebar}\n aria-label={\n open\n ? tr(\"nav.sidebar.collapse\", { default: \"Collapse sidebar\" })\n : tr(\"nav.sidebar.expand\", { default: \"Expand sidebar\" })\n }\n className=\"size-8\"\n >\n {/* The panel glyph points at the sidebar's edge: mirrored when the\n page reads right to left. */}\n <Icon className=\"size-4 rtl:-scale-x-100\" />\n </Button>\n );\n};\n"],"mappings":";;;;;;;AAUA,MAAa,uCAAuC;CAClD,MAAM,EAAE,eAAe,UAAU,YAAY,UAAU,WAAW;CAClE,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,OAAO,WAAW,aAAa,UAAU;CAC/C,MAAM,OAAO,OAAO,iBAAiB;CACrC,OACE,oBAAC,QAAD;EACE,SAAQ;EACR,MAAK;EACL,SAAS;EACT,cACE,OACI,GAAG,wBAAwB,EAAE,SAAS,mBAAmB,CAAC,IAC1D,GAAG,sBAAsB,EAAE,SAAS,iBAAiB,CAAC;EAE5D,WAAU;EAIV,UAAA,oBAAC,MAAD,EAAM,WAAU,0BAA2B,CAAA;CACrC,CAAA;AAEZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/table/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAelE,OAAO,KAAK,EAEV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EAIhB,MAAM,qBAAqB,CAAC;AAU7B,MAAM,MAAM,cAAc,CACxB,CAAC,EACD,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,IACvD,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACpB,CAAC,EACD,KAAK,CAAC,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,SAExD,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,sBAmjB5B,CAAC"}
1
+ {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../src/table/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAelE,OAAO,KAAK,EAEV,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EAIhB,MAAM,qBAAqB,CAAC;AAU7B,MAAM,MAAM,cAAc,CACxB,CAAC,EACD,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,IACvD,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GACpB,CAAC,EACD,KAAK,CAAC,CAAC,SAAS,qBAAqB,GAAG,uBAAuB,SAExD,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,sBAqjB5B,CAAC"}
@@ -233,7 +233,7 @@ const DataTable = (props) => {
233
233
  const canResetFilters = hasActiveFilters || filterVisibility.differsFromDeclaration;
234
234
  const isEmptyState = !loading && data.length === 0;
235
235
  const hasHelp = props.help != null && props.help !== false && props.help !== "";
236
- const showToolbar = Boolean(props.filters) || Boolean(props.toolbar) || Boolean(props.actions?.length) || hasHelp || !props.hideColumnPicker || !props.hideActionsMenu;
236
+ const showToolbar = Boolean(props.filters) || Boolean(props.leading) || Boolean(props.toolbar) || Boolean(props.actions?.length) || hasHelp || !props.hideColumnPicker || !props.hideActionsMenu;
237
237
  const rawSummaryContent = props.summary?.content;
238
238
  const summaryContent = typeof rawSummaryContent === "function" ? rawSummaryContent({ refreshKey }) : rawSummaryContent;
239
239
  const hasSummaryContent = summaryContent != null && summaryContent !== false && summaryContent !== "";
@@ -273,6 +273,7 @@ const DataTable = (props) => {
273
273
  shownFilters: filterVisibility.shown,
274
274
  onShownFiltersChange: filterVisibility.setShown,
275
275
  canResetFilters,
276
+ leading: props.leading,
276
277
  toolbar: props.toolbar,
277
278
  actions: props.actions,
278
279
  help: hasHelp ? props.help : void 0,
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","names":[],"sources":["../../src/table/DataTable.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { ClientOnly, useAlepha } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { Table, TableHeader } from \"../core/Table.tsx\";\nimport { useIsMobile } from \"../core/useIsMobile.ts\";\nimport { useToast } from \"../core/useToast.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { DataTableBody } from \"./DataTableBody.tsx\";\nimport { DataTableBulkBar } from \"./DataTableBulkBar.tsx\";\nimport { DATA_TABLE_CELL_PADDING } from \"./dataTableCellPadding.ts\";\nimport { DataTableFooter, PAGE_SIZES } from \"./DataTableFooter.tsx\";\nimport { DataTableHeaderRow } from \"./DataTableHeaderRow.tsx\";\nimport {\n persistedColumns,\n persistedOrder,\n persistedSize,\n persistedSort,\n} from \"./dataTablePersistence.ts\";\nimport { DATA_TABLE_SQUARE_RIGHT } from \"./dataTableSquareRight.ts\";\nimport { DataTableSummaryPanel } from \"./DataTableSummaryPanel.tsx\";\nimport { DataTableToolbar } from \"./DataTableToolbar.tsx\";\nimport type {\n DataTableCellContext,\n DataTableFilterFields,\n DataTableNoFilterFields,\n DataTableSource,\n BulkActionContext,\n ColumnDef,\n RowActionContext,\n} from \"./dataTableTypes.ts\";\nimport { cleanFilterValues } from \"./queryFilters.ts\";\nimport { useDataTableColumns } from \"./useDataTableColumns.ts\";\nimport { useDataTableData } from \"./useDataTableData.ts\";\nimport { useDataTableFilterForm } from \"./useDataTableFilterForm.ts\";\nimport { useDataTableFilterVisibility } from \"./useDataTableFilterVisibility.ts\";\nimport { useDataTableRefresh } from \"./useDataTableRefresh.ts\";\nimport { useDataTableSummary } from \"./useDataTableSummary.ts\";\nimport { useTableSelection } from \"./useTableSelection.ts\";\n\nexport type DataTableProps<\n T,\n F extends DataTableFilterFields = DataTableNoFilterFields,\n> = DataTableBaseProps<T, F> & DataTableSource<T, F>;\n\n/**\n * A data table: server-side or static rows, sorting, filters, row and bulk\n * actions, persisted preferences.\n *\n * `T` is the row. `F` is the type of `filters.fields`, written as\n * `typeof filterFields` beside the row type, which is what types `fetch`'s\n * filters, the `data` predicate, `initialValues`, `seedValues` and\n * `fromQuery`. It defaults to no filters at all, so a table given `fields`\n * without it does not compile.\n */\nexport const DataTable = <\n T,\n const F extends DataTableFilterFields = DataTableNoFilterFields,\n>(\n props: DataTableProps<T, F>,\n) => {\n /**\n * The props, with their filters read untyped. The parts below enumerate\n * filter keys at runtime and never read one by name, so the type of `F` is\n * the call site's business and one cast here keeps it out of every hook.\n */\n const untyped = props as unknown as DataTableProps<T, DataTableFilterFields>;\n\n /**\n * `persistenceKey`, once per facet.\n *\n * A facet that is off gets `undefined`, which is the same value every\n * persistence helper here already treats as \"do not store\" - so turning one\n * off takes the branch a table with no key has always taken, rather than a\n * new one. That is what keeps the default behaviour of `persistenceKey`\n * exactly as it was: with `persist` absent, all three of these ARE\n * `props.persistenceKey`.\n *\n * Primitives, so they go straight into the dependency arrays and `useState`\n * initializers below without giving any of them a new identity per render.\n */\n const filtersKey =\n props.persist?.filters === false ? undefined : props.persistenceKey;\n const columnsKey =\n props.persist?.columns === false ? undefined : props.persistenceKey;\n const sortKey =\n props.persist?.sort === false ? undefined : props.persistenceKey;\n // `pageSizes={[]}` hides the picker, and with it the reader's say in the\n // size: a size stored while the picker was still there must not outlive\n // it, or a reader who once chose 50 is stuck at 50 with no control left to\n // change it. The call site's `defaultSize` is the size, full stop.\n const sizeKey =\n props.pageSizes?.length === 0 ? undefined : props.persistenceKey;\n\n // State, not a constant. It was `props.defaultSize ?? 20` read once, so a\n // reader had no way to see more rows than the call site had decided for\n // them. Already in `load`'s dependency array, so changing it refetches.\n const [size, setSize] = useState<number>(() =>\n persistedSize(sizeKey, props.defaultSize),\n );\n const alepha = useAlepha();\n const { tr } = useI18n();\n const toast = useToast();\n /**\n * The whole of the phone layout, and deliberately one switch rather than a\n * scattering of `max-md:` classes: the filter controls have to be rendered\n * in exactly ONE of the two places (see `DataTableFilterDialog`), which\n * CSS cannot express. Everything else below the breakpoint follows the same\n * flag so the two halves of the layout cannot disagree.\n *\n * Safe against hydration because the whole table sits inside `ClientOnly`,\n * and `useIsMobile` reads the same `MediaQueryList` it subscribes to.\n */\n const isMobile = useIsMobile();\n\n const { form, definition: filterDefinition } = useDataTableFilterForm({\n props: untyped,\n filtersKey,\n alepha,\n });\n\n const filterVisibility = useDataTableFilterVisibility({\n definition: filterDefinition,\n filtersKey,\n });\n\n const {\n page,\n setPage,\n sizeForm,\n sort,\n setSort,\n data,\n meta,\n rowFilters,\n loading,\n refreshKey,\n setRefreshKey,\n isRefreshing,\n setIsRefreshing,\n toggleSort,\n setSortTo,\n } = useDataTableData({\n props: untyped,\n size,\n setSize,\n sortKey,\n form,\n alepha,\n });\n\n const { refresh, handleRefreshClick, resetFilters, canShare, shareFilters } =\n useDataTableRefresh({\n props: untyped,\n form,\n filterKeys: filterDefinition?.keys ?? [],\n resetShownFilters: filterVisibility.resetShown,\n filtersKey,\n alepha,\n toast,\n tr,\n setPage,\n setRefreshKey,\n setIsRefreshing,\n });\n\n const summary = useDataTableSummary({\n summary: untyped.summary,\n persistenceKey: props.persistenceKey,\n refreshKey,\n form,\n alepha,\n });\n\n // -- Row identity ----------------------------------------------------------\n\n /**\n * A row's key, in order of preference: the caller's `rowKey`, the row's own\n * `id`, then where the row sits.\n *\n * The last one used to be `Math.random()`, which is not an identity at all.\n * Every render produced a new key, so React saw every id-less row as a new\n * row and remounted it: focus in an inline input was lost the moment\n * anything else re-rendered, and the list re-animated on every keystroke.\n * Selection was broken by the same thing - `selection.has(rowKey(item))`\n * compared against a key generated one render earlier, so it never matched.\n */\n const rowKeys = useMemo(\n () =>\n data.map((item, index) => {\n if (props.rowKey) return props.rowKey(item);\n const id = (item as { id?: unknown })?.id;\n // Coercion at a boundary: the value is a form/route/chart primitive\n // whose declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string -- a coercion at a boundary, see the comment above\n return id != null ? String(id) : `page-${page}-row-${index}`;\n }),\n [data, page, props.rowKey],\n );\n\n /**\n * Selection asks for a key by item, not by index. Every item it can ask\n * about is one of `data`'s, so a lookup keyed on identity covers it without\n * an O(n) scan per call.\n */\n const rowKeyByItem = useMemo(() => {\n const map = new Map<T, string>();\n data.forEach((item, index) => map.set(item, rowKeys[index]));\n return map;\n }, [data, rowKeys]);\n\n const rowKey = useCallback(\n (item: T): string => rowKeyByItem.get(item) ?? \"\",\n [rowKeyByItem],\n );\n\n // -- Selection -------------------------------------------------------------\n\n const {\n selection,\n selectedItems,\n allSelected,\n someSelected,\n toggleRow,\n toggleAll,\n clearSelection,\n } = useTableSelection(data, rowKey);\n\n // The bulk actions offered for THIS selection: an action's `visible`\n // predicate reads the selected rows. Computed once, here, so the pill's\n // contents and the pill's own presence come from the same list.\n const visibleBulkActions = useMemo(\n () =>\n (props.bulkActions ?? []).filter(\n (action) => action.visible?.(selectedItems) ?? true,\n ),\n [props.bulkActions, selectedItems],\n );\n\n const {\n allColumnKeys,\n visibleColumns,\n setVisibleColumns,\n orderedKeys,\n setColumnOrder,\n moveColumn,\n reorderColumn,\n toggleColumn,\n orderAnnouncement,\n } = useDataTableColumns({ props: untyped, columnsKey, tr });\n\n /**\n * ⚠️ A changed `persistenceKey` is a changed SCOPE, and this is where that\n * is handled.\n *\n * Every caller encodes its scope in that key - `lor.activity.${project.id}`,\n * `lor.epics.${project.id}` - so switching project changes it. Nothing acted\n * on that before, and `load` re-runs only on `[page, size, sortParam,\n * refreshKey, form, alepha]`, none of which a project switch touches. The\n * router does not remount on a param-only navigation either, so the table\n * kept serving the PREVIOUS project's rows under the new project's name\n * (feedback #2096).\n *\n * `refreshKey` is bumped rather than relying on the re-read: two projects\n * can share a stored sort and size, and then no dependency of `load` would\n * change and nothing would refetch. That equality is the bug's whole\n * mechanism, so the refetch cannot be a side effect of the values moving.\n *\n * ⚠️ Adjusted during RENDER, not in an effect, and that is load-bearing.\n * The sort effect (`useDataTableData`) and the column writes\n * (`useDataTableColumns`) are keyed on `persistenceKey` too, so on the\n * render where it changes they would fire in the same flush and write the\n * OUTGOING scope's state under the INCOMING key - silently\n * overwriting the project you just opened with the one you just left. React\n * re-renders before committing this, so by the time those effects run the\n * state is already the new scope's and they write back what was just read.\n *\n * ⚠️ `props.fetch` is still NOT a dependency of `load`. That is the loop\n * `fetchRef` exists to prevent, and several callers write a store atom from\n * inside their fetcher.\n *\n * Filter VALUES are deliberately not reset here: `useForm` captures its\n * `initialValues` once, so resetting them is form surgery rather than a\n * state assignment. They are also not clobbered - the filter-persist effect\n * writes only on `form:changed` / `form:submit:success`, never on mount - so\n * the stored filters of the project you left stay its own.\n */\n const scopeRef = useRef(props.persistenceKey);\n if (scopeRef.current !== props.persistenceKey) {\n scopeRef.current = props.persistenceKey;\n setPage(0);\n setSize(persistedSize(sizeKey, props.defaultSize));\n setSort(persistedSort(sortKey, props.defaultSort));\n setVisibleColumns(persistedColumns(columnsKey, props.columns));\n // Same render pass as the rest, and for the identical reason: the effects\n // keyed on `persistenceKey` fire in one flush, so an order left behind\n // here would be written back under the INCOMING key.\n setColumnOrder(persistedOrder(columnsKey, props.columns));\n // Which filters are on the bar is the scope's too, and read here for the\n // same reason: the project just opened must not show the bar of the one\n // just left.\n filterVisibility.rereadShown(filtersKey);\n // The panel's open state is the scope's like the size is, and its cards\n // are the scope's figures: they go now, and the bump below refetches.\n summary.resetScope(props.persistenceKey);\n setRefreshKey((k) => k + 1);\n }\n\n // -- Render ---------------------------------------------------------------\n\n // The reader's order, not the declaration's.\n const cols = orderedKeys.map((key) => [key, props.columns[key]!]) as Array<\n [string, ColumnDef<T>]\n >;\n const visibleCols = cols.filter(([key]) => visibleColumns.has(key));\n const hasCheckbox = Boolean(props.bulkActions?.length);\n const hasRowActions = Boolean(props.rowActions);\n\n const rowCtx: RowActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n const bulkCtx: BulkActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n\n /**\n * How many filters currently narrow the list — a count rather than the\n * boolean this used to be, because on a phone the bar is behind a button\n * and the trigger's badge is the only thing that says the table is\n * filtered at all.\n */\n const activeFilterCount = useMemo(() => {\n if (!props.filters || !form) return 0;\n return Object.keys(cleanFilterValues(form.currentValues ?? {})).length;\n }, [props.filters, form, refreshKey]);\n const hasActiveFilters = activeFilterCount > 0;\n\n // What every cell is told beside its row: the search the rows on screen\n // answer, from the first `preset: \"search\"` field holding one.\n const searchKey = Object.entries(props.filters?.fields ?? {}).find(\n ([, field]) => field.preset === \"search\",\n )?.[0];\n const rowSearch = searchKey ? rowFilters?.[searchKey] : undefined;\n const cellContext: DataTableCellContext = {\n search:\n typeof rowSearch === \"string\" && rowSearch.trim() !== \"\"\n ? rowSearch.trim()\n : undefined,\n };\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * is not the one the table declares. Not the count alone, or a reader who\n * removed a default filter would have no way to bring it back.\n */\n const canResetFilters =\n hasActiveFilters || filterVisibility.differsFromDeclaration;\n\n // The empty state is showing, as opposed to the skeleton that also renders\n // on `data.length === 0`. Read by the `<Table>` height as well as the body,\n // so the two cannot disagree.\n const isEmptyState = !loading && data.length === 0;\n\n // A node that draws nothing is no help and no content: the `?` and the\n // band would open on an empty card. Decided here, once, and handed down\n // as `undefined` when it is empty.\n const hasHelp =\n props.help != null && props.help !== false && props.help !== \"\";\n const showToolbar =\n Boolean(props.filters) ||\n Boolean(props.toolbar) ||\n Boolean(props.actions?.length) ||\n hasHelp ||\n !props.hideColumnPicker ||\n !props.hideActionsMenu;\n // Drawn while a first fetch is out (its placeholders), and after that only\n // with something in it: a summary with no card and no content is no band.\n // A function is called on every render, which only builds its element: the\n // panel mounts it while open, and the counter is what tells it to reload.\n const rawSummaryContent = props.summary?.content;\n const summaryContent =\n typeof rawSummaryContent === \"function\"\n ? rawSummaryContent({ refreshKey })\n : rawSummaryContent;\n const hasSummaryContent =\n summaryContent != null && summaryContent !== false && summaryContent !== \"\";\n const showSummary =\n Boolean(props.summary) &&\n (summary.cards === undefined ||\n summary.cards.length > 0 ||\n hasSummaryContent);\n const cellPadding = DATA_TABLE_CELL_PADDING[props.cellPadding ?? \"normal\"];\n const squareRight = props.squareRight\n ? DATA_TABLE_SQUARE_RIGHT[`${props.squareRight}`]\n : undefined;\n // `flat` drops the outer frame and keeps the lines between the bands: the\n // toolbar keeps its bottom border, the footer its top one, and the rows\n // lose the sides. Applied after `squareRight`, which has nothing left to\n // square once the corners are gone.\n const flatTop = props.flat && \"rounded-none border-x-0 border-t-0\";\n const flatRows =\n props.flat && \"rounded-none border-x-0 border-t-0 border-b-0\";\n const flatBottom = props.flat && \"rounded-none border-x-0 border-b-0\";\n // The footer holds two controls, the size picker and the page links, and\n // the count beside them. A table that hid the picker (`pageSizes={[]}`)\n // and fits on one page has neither, and \"Page 1 of 1\" alone is a bar\n // saying nothing, so it goes. The links' condition is the footer's own.\n const showFooter =\n (props.pageSizes ?? PAGE_SIZES).length > 0 ||\n Boolean(meta?.totalPages && meta.totalPages > 1);\n const showColumnPicker = !props.hideColumnPicker && allColumnKeys.length > 0;\n const showActionsMenu = !props.hideActionsMenu;\n\n return (\n <ClientOnly>\n <div className={cn(\"flex flex-col gap-2\", props.className)}>\n {props.header && (\n <div className=\"flex items-center gap-2\">\n <div className=\"min-w-0 flex-1\">{props.header}</div>\n </div>\n )}\n\n {/*\n The summary opens the frame when it is there, so it takes the top\n corners `squareRight` squares, and whatever follows it (the filter\n bar, or the rows when there is none) joins under it the way the rows\n join the filter bar: flattened top, no top border, `-mt-2` against\n the wrapper's gap. The panel's own bottom border is the line\n between them.\n */}\n {showSummary && (\n <DataTableSummaryPanel\n title={\n props.summary?.title ??\n tr(\"dataTable.summary\", { default: \"Summary\" })\n }\n open={summary.open}\n onOpenChange={summary.setOpen}\n cards={summary.cards}\n loading={summary.loading}\n content={hasSummaryContent ? summaryContent : undefined}\n className={cn(squareRight?.top, flatTop, props.chromeClassName)}\n />\n )}\n\n {showToolbar && (\n <DataTableToolbar<T>\n columns={props.columns}\n filters={untyped.filters}\n form={form}\n filterDefinition={filterDefinition}\n shownFilters={filterVisibility.shown}\n onShownFiltersChange={filterVisibility.setShown}\n canResetFilters={canResetFilters}\n toolbar={props.toolbar}\n actions={props.actions}\n help={hasHelp ? props.help : undefined}\n isMobile={isMobile}\n showColumnPicker={showColumnPicker}\n showActionsMenu={showActionsMenu}\n activeFilterCount={activeFilterCount}\n canShare={canShare}\n resetFilters={resetFilters}\n shareFilters={shareFilters}\n orderedKeys={orderedKeys}\n visibleColumns={visibleColumns}\n toggleColumn={toggleColumn}\n reorderColumn={reorderColumn}\n isRefreshing={isRefreshing}\n handleRefreshClick={handleRefreshClick}\n className={cn(\n showSummary\n ? \"-mt-2 rounded-t-none border-t-0\"\n : squareRight?.top,\n flatTop,\n props.chromeClassName,\n )}\n />\n )}\n\n {hasCheckbox && selection.size > 0 && visibleBulkActions.length > 0 && (\n <DataTableBulkBar<T>\n selection={selection}\n selectedItems={selectedItems}\n visibleBulkActions={visibleBulkActions}\n bulkCtx={bulkCtx}\n clearSelection={clearSelection}\n />\n )}\n\n {/*\n The toolbar, the rows and the footer are one panel: each facing edge\n is flattened and its border dropped so no double line appears, and\n `-mt-2` cancels the wrapper's `gap-2`. The footer half follows\n `showFooter`, which is true for every table that keeps its size\n picker: gating the footer on `meta` alone would pop the bar in and\n flip this bottom border on every load, since `meta` starts null and\n only fills after the fetch. Only a table that hid the picker can\n lose it, and then the rows close the panel themselves.\n */}\n <div\n className={cn(\n \"flex min-h-0 flex-1 flex-col overflow-auto rounded-md border\",\n (showToolbar || showSummary) && \"-mt-2 rounded-t-none border-t-0\",\n showFooter ? \"rounded-b-none border-b-0\" : squareRight?.bottom,\n flatRows,\n // With no toolbar and no summary the rows open the table, so\n // their top-right corner is the one `squareRight` squares.\n !showToolbar && !showSummary && squareRight?.top,\n // `<Table>` wraps the table in a container div whose classes it\n // hardcodes, and only this table needs that container to grow,\n // so the one class it needs is set from out here instead.\n //\n // `grow`, NOT `flex-1`: `flex-1` sets the basis to 0, and in the\n // ordinary case this wrapper has no height of its own, so a 0\n // basis with nothing to grow into collapses the table to nothing.\n // `grow` keeps the content basis and only spends space that is\n // actually free, which is the full-height case.\n \"[&>[data-slot=table-container]]:grow\",\n )}\n >\n {/* `h-full` ONLY while the empty state is what is in the body.\n It is what lets that one row take the height the scroller grew\n into, so `align-middle` can centre the state in it.\n\n ⚠️ Never unconditionally. A CSS table given a height larger\n than its content does not leave the surplus at the bottom, it\n DISTRIBUTES IT ACROSS THE ROWS - so an unconditional `h-full`\n silently turns a short table into a tall one: Lore's Apps page,\n two rows in a full-height pane, rendered them 239px each. No\n unit test sees it (jsdom computes no layout) and it is invisible\n on a table long enough to fill its own container, which is why\n it reached e2e rather than review. */}\n <Table className={cn(isEmptyState && \"h-full\")}>\n {/* `bg-muted`, fully opaque, NOT the base header's `bg-muted/50`:\n this header is sticky, so anything translucent lets the rows\n scroll visibly through the column labels. Same tint, no\n transparency.\n\n Two inset lines, not one. The bottom is the divider against the\n first row; the top is the `--bevel` highlight, which is what\n gives the band its thickness. Inset shadows rather than borders\n because a border on a sticky `<thead>` is dropped by the\n collapsed table border model, and because the two lines have to\n sit INSIDE the header's own height: it is pinned at `top-0`\n against a scrolling body, so anything painted outside it is\n painted over. */}\n <TableHeader\n className={cn(\n // ⚠️ `[&_tr]:border-b-0` or the bottom rule is drawn TWICE: `TableHeader`\n // gives its rows a `border-b`, and the inset shadow above draws\n // the same line, so the band closed with 2px where it opens with\n // 1px. The inset one wins because it is what survives the sticky\n // header being painted over.\n \"bg-muted sticky top-0 z-10 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)] [&_tr]:border-b-0\",\n props.chromeClassName,\n )}\n >\n <DataTableHeaderRow<T>\n headClassName={cellPadding.head}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n allSelected={allSelected}\n someSelected={someSelected}\n toggleAll={toggleAll}\n sort={sort}\n toggleSort={toggleSort}\n setSortTo={setSortTo}\n moveColumn={moveColumn}\n toggleColumn={toggleColumn}\n />\n </TableHeader>\n <DataTableBody<T>\n cellClassName={cellPadding.cell}\n data={data}\n cellContext={cellContext}\n rowKeys={rowKeys}\n loading={loading}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n hasActiveFilters={hasActiveFilters}\n selection={selection}\n toggleRow={toggleRow}\n rowCtx={rowCtx}\n rowActions={props.rowActions}\n onRowClick={props.onRowClick}\n onRowHover={props.onRowHover}\n empty={props.empty}\n emptyMessage={props.emptyMessage}\n emptyState={props.emptyState}\n noMatchState={props.noMatchState}\n />\n </Table>\n </div>\n\n {/* A move is otherwise silent: nothing about a reordered table is\n spoken, and the visual change is the only feedback. Outside the\n table so it is not read as a cell. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {orderAnnouncement}\n </span>\n\n {showFooter && (\n <DataTableFooter\n pageSizes={props.pageSizes}\n sizeForm={sizeForm}\n meta={meta}\n isMobile={isMobile}\n setPage={setPage}\n className={cn(\n squareRight?.bottom,\n flatBottom,\n props.chromeClassName,\n )}\n />\n )}\n </div>\n </ClientOnly>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAa,aAIX,UACG;;;;;;CAMH,MAAM,UAAU;;;;;;;;;;;;;;CAehB,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,KAAA,IAAY,MAAM;CACvD,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,KAAA,IAAY,MAAM;CACvD,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AAe,CAAC,eAAe,aAAa,KAU7C,sCACF;IAcA,UAAA,qBAAC,OAAD;KAAO,WAAW,GAAG,gBAAgB,QAAQ;KAA7C,UAAA,CAcE,oBAAC,aAAD;MACE,WAAW,GAMT,qHACA,MAAM,eACR;MAEA,UAAA,oBAAC,oBAAD;OACE,eAAe,YAAY;OACd;OACA;OACE;OACF;OACC;OACH;OACL;OACM;OACD;OACC;OACE;MACf,CAAA;KACU,CAAA,GACb,oBAAC,eAAD;MACE,eAAe,YAAY;MACrB;MACO;MACJ;MACA;MACI;MACA;MACE;MACG;MACP;MACA;MACH;MACR,YAAY,MAAM;MAClB,YAAY,MAAM;MAClB,YAAY,MAAM;MAClB,OAAO,MAAM;MACb,cAAc,MAAM;MACpB,YAAY,MAAM;MAClB,cAAc,MAAM;KACrB,CAAA,CACI;;GACJ,CAAA;GAKL,oBAAC,QAAD;IAAM,aAAU;IAAS,WAAU;IAChC,UAAA;GACG,CAAA;GAEL,cACC,oBAAC,iBAAD;IACE,WAAW,MAAM;IACP;IACJ;IACI;IACD;IACT,WAAW,GACT,aAAa,QACb,YACA,MAAM,eACR;GACD,CAAA;EAEA;CACK,CAAA,EAAA,CAAA;AAEhB"}
1
+ {"version":3,"file":"DataTable.js","names":[],"sources":["../../src/table/DataTable.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { ClientOnly, useAlepha } from \"alepha/react\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { useCallback, useMemo, useRef, useState } from \"react\";\n\nimport { Table, TableHeader } from \"../core/Table.tsx\";\nimport { useIsMobile } from \"../core/useIsMobile.ts\";\nimport { useToast } from \"../core/useToast.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport type { DataTableBaseProps } from \"./dataTableBaseProps.ts\";\nimport { DataTableBody } from \"./DataTableBody.tsx\";\nimport { DataTableBulkBar } from \"./DataTableBulkBar.tsx\";\nimport { DATA_TABLE_CELL_PADDING } from \"./dataTableCellPadding.ts\";\nimport { DataTableFooter, PAGE_SIZES } from \"./DataTableFooter.tsx\";\nimport { DataTableHeaderRow } from \"./DataTableHeaderRow.tsx\";\nimport {\n persistedColumns,\n persistedOrder,\n persistedSize,\n persistedSort,\n} from \"./dataTablePersistence.ts\";\nimport { DATA_TABLE_SQUARE_RIGHT } from \"./dataTableSquareRight.ts\";\nimport { DataTableSummaryPanel } from \"./DataTableSummaryPanel.tsx\";\nimport { DataTableToolbar } from \"./DataTableToolbar.tsx\";\nimport type {\n DataTableCellContext,\n DataTableFilterFields,\n DataTableNoFilterFields,\n DataTableSource,\n BulkActionContext,\n ColumnDef,\n RowActionContext,\n} from \"./dataTableTypes.ts\";\nimport { cleanFilterValues } from \"./queryFilters.ts\";\nimport { useDataTableColumns } from \"./useDataTableColumns.ts\";\nimport { useDataTableData } from \"./useDataTableData.ts\";\nimport { useDataTableFilterForm } from \"./useDataTableFilterForm.ts\";\nimport { useDataTableFilterVisibility } from \"./useDataTableFilterVisibility.ts\";\nimport { useDataTableRefresh } from \"./useDataTableRefresh.ts\";\nimport { useDataTableSummary } from \"./useDataTableSummary.ts\";\nimport { useTableSelection } from \"./useTableSelection.ts\";\n\nexport type DataTableProps<\n T,\n F extends DataTableFilterFields = DataTableNoFilterFields,\n> = DataTableBaseProps<T, F> & DataTableSource<T, F>;\n\n/**\n * A data table: server-side or static rows, sorting, filters, row and bulk\n * actions, persisted preferences.\n *\n * `T` is the row. `F` is the type of `filters.fields`, written as\n * `typeof filterFields` beside the row type, which is what types `fetch`'s\n * filters, the `data` predicate, `initialValues`, `seedValues` and\n * `fromQuery`. It defaults to no filters at all, so a table given `fields`\n * without it does not compile.\n */\nexport const DataTable = <\n T,\n const F extends DataTableFilterFields = DataTableNoFilterFields,\n>(\n props: DataTableProps<T, F>,\n) => {\n /**\n * The props, with their filters read untyped. The parts below enumerate\n * filter keys at runtime and never read one by name, so the type of `F` is\n * the call site's business and one cast here keeps it out of every hook.\n */\n const untyped = props as unknown as DataTableProps<T, DataTableFilterFields>;\n\n /**\n * `persistenceKey`, once per facet.\n *\n * A facet that is off gets `undefined`, which is the same value every\n * persistence helper here already treats as \"do not store\" - so turning one\n * off takes the branch a table with no key has always taken, rather than a\n * new one. That is what keeps the default behaviour of `persistenceKey`\n * exactly as it was: with `persist` absent, all three of these ARE\n * `props.persistenceKey`.\n *\n * Primitives, so they go straight into the dependency arrays and `useState`\n * initializers below without giving any of them a new identity per render.\n */\n const filtersKey =\n props.persist?.filters === false ? undefined : props.persistenceKey;\n const columnsKey =\n props.persist?.columns === false ? undefined : props.persistenceKey;\n const sortKey =\n props.persist?.sort === false ? undefined : props.persistenceKey;\n // `pageSizes={[]}` hides the picker, and with it the reader's say in the\n // size: a size stored while the picker was still there must not outlive\n // it, or a reader who once chose 50 is stuck at 50 with no control left to\n // change it. The call site's `defaultSize` is the size, full stop.\n const sizeKey =\n props.pageSizes?.length === 0 ? undefined : props.persistenceKey;\n\n // State, not a constant. It was `props.defaultSize ?? 20` read once, so a\n // reader had no way to see more rows than the call site had decided for\n // them. Already in `load`'s dependency array, so changing it refetches.\n const [size, setSize] = useState<number>(() =>\n persistedSize(sizeKey, props.defaultSize),\n );\n const alepha = useAlepha();\n const { tr } = useI18n();\n const toast = useToast();\n /**\n * The whole of the phone layout, and deliberately one switch rather than a\n * scattering of `max-md:` classes: the filter controls have to be rendered\n * in exactly ONE of the two places (see `DataTableFilterDialog`), which\n * CSS cannot express. Everything else below the breakpoint follows the same\n * flag so the two halves of the layout cannot disagree.\n *\n * Safe against hydration because the whole table sits inside `ClientOnly`,\n * and `useIsMobile` reads the same `MediaQueryList` it subscribes to.\n */\n const isMobile = useIsMobile();\n\n const { form, definition: filterDefinition } = useDataTableFilterForm({\n props: untyped,\n filtersKey,\n alepha,\n });\n\n const filterVisibility = useDataTableFilterVisibility({\n definition: filterDefinition,\n filtersKey,\n });\n\n const {\n page,\n setPage,\n sizeForm,\n sort,\n setSort,\n data,\n meta,\n rowFilters,\n loading,\n refreshKey,\n setRefreshKey,\n isRefreshing,\n setIsRefreshing,\n toggleSort,\n setSortTo,\n } = useDataTableData({\n props: untyped,\n size,\n setSize,\n sortKey,\n form,\n alepha,\n });\n\n const { refresh, handleRefreshClick, resetFilters, canShare, shareFilters } =\n useDataTableRefresh({\n props: untyped,\n form,\n filterKeys: filterDefinition?.keys ?? [],\n resetShownFilters: filterVisibility.resetShown,\n filtersKey,\n alepha,\n toast,\n tr,\n setPage,\n setRefreshKey,\n setIsRefreshing,\n });\n\n const summary = useDataTableSummary({\n summary: untyped.summary,\n persistenceKey: props.persistenceKey,\n refreshKey,\n form,\n alepha,\n });\n\n // -- Row identity ----------------------------------------------------------\n\n /**\n * A row's key, in order of preference: the caller's `rowKey`, the row's own\n * `id`, then where the row sits.\n *\n * The last one used to be `Math.random()`, which is not an identity at all.\n * Every render produced a new key, so React saw every id-less row as a new\n * row and remounted it: focus in an inline input was lost the moment\n * anything else re-rendered, and the list re-animated on every keystroke.\n * Selection was broken by the same thing - `selection.has(rowKey(item))`\n * compared against a key generated one render earlier, so it never matched.\n */\n const rowKeys = useMemo(\n () =>\n data.map((item, index) => {\n if (props.rowKey) return props.rowKey(item);\n const id = (item as { id?: unknown })?.id;\n // Coercion at a boundary: the value is a form/route/chart primitive\n // whose declared type is wider than what can reach here.\n // oxlint-disable-next-line typescript/no-base-to-string -- a coercion at a boundary, see the comment above\n return id != null ? String(id) : `page-${page}-row-${index}`;\n }),\n [data, page, props.rowKey],\n );\n\n /**\n * Selection asks for a key by item, not by index. Every item it can ask\n * about is one of `data`'s, so a lookup keyed on identity covers it without\n * an O(n) scan per call.\n */\n const rowKeyByItem = useMemo(() => {\n const map = new Map<T, string>();\n data.forEach((item, index) => map.set(item, rowKeys[index]));\n return map;\n }, [data, rowKeys]);\n\n const rowKey = useCallback(\n (item: T): string => rowKeyByItem.get(item) ?? \"\",\n [rowKeyByItem],\n );\n\n // -- Selection -------------------------------------------------------------\n\n const {\n selection,\n selectedItems,\n allSelected,\n someSelected,\n toggleRow,\n toggleAll,\n clearSelection,\n } = useTableSelection(data, rowKey);\n\n // The bulk actions offered for THIS selection: an action's `visible`\n // predicate reads the selected rows. Computed once, here, so the pill's\n // contents and the pill's own presence come from the same list.\n const visibleBulkActions = useMemo(\n () =>\n (props.bulkActions ?? []).filter(\n (action) => action.visible?.(selectedItems) ?? true,\n ),\n [props.bulkActions, selectedItems],\n );\n\n const {\n allColumnKeys,\n visibleColumns,\n setVisibleColumns,\n orderedKeys,\n setColumnOrder,\n moveColumn,\n reorderColumn,\n toggleColumn,\n orderAnnouncement,\n } = useDataTableColumns({ props: untyped, columnsKey, tr });\n\n /**\n * ⚠️ A changed `persistenceKey` is a changed SCOPE, and this is where that\n * is handled.\n *\n * Every caller encodes its scope in that key - `lor.activity.${project.id}`,\n * `lor.epics.${project.id}` - so switching project changes it. Nothing acted\n * on that before, and `load` re-runs only on `[page, size, sortParam,\n * refreshKey, form, alepha]`, none of which a project switch touches. The\n * router does not remount on a param-only navigation either, so the table\n * kept serving the PREVIOUS project's rows under the new project's name\n * (feedback #2096).\n *\n * `refreshKey` is bumped rather than relying on the re-read: two projects\n * can share a stored sort and size, and then no dependency of `load` would\n * change and nothing would refetch. That equality is the bug's whole\n * mechanism, so the refetch cannot be a side effect of the values moving.\n *\n * ⚠️ Adjusted during RENDER, not in an effect, and that is load-bearing.\n * The sort effect (`useDataTableData`) and the column writes\n * (`useDataTableColumns`) are keyed on `persistenceKey` too, so on the\n * render where it changes they would fire in the same flush and write the\n * OUTGOING scope's state under the INCOMING key - silently\n * overwriting the project you just opened with the one you just left. React\n * re-renders before committing this, so by the time those effects run the\n * state is already the new scope's and they write back what was just read.\n *\n * ⚠️ `props.fetch` is still NOT a dependency of `load`. That is the loop\n * `fetchRef` exists to prevent, and several callers write a store atom from\n * inside their fetcher.\n *\n * Filter VALUES are deliberately not reset here: `useForm` captures its\n * `initialValues` once, so resetting them is form surgery rather than a\n * state assignment. They are also not clobbered - the filter-persist effect\n * writes only on `form:changed` / `form:submit:success`, never on mount - so\n * the stored filters of the project you left stay its own.\n */\n const scopeRef = useRef(props.persistenceKey);\n if (scopeRef.current !== props.persistenceKey) {\n scopeRef.current = props.persistenceKey;\n setPage(0);\n setSize(persistedSize(sizeKey, props.defaultSize));\n setSort(persistedSort(sortKey, props.defaultSort));\n setVisibleColumns(persistedColumns(columnsKey, props.columns));\n // Same render pass as the rest, and for the identical reason: the effects\n // keyed on `persistenceKey` fire in one flush, so an order left behind\n // here would be written back under the INCOMING key.\n setColumnOrder(persistedOrder(columnsKey, props.columns));\n // Which filters are on the bar is the scope's too, and read here for the\n // same reason: the project just opened must not show the bar of the one\n // just left.\n filterVisibility.rereadShown(filtersKey);\n // The panel's open state is the scope's like the size is, and its cards\n // are the scope's figures: they go now, and the bump below refetches.\n summary.resetScope(props.persistenceKey);\n setRefreshKey((k) => k + 1);\n }\n\n // -- Render ---------------------------------------------------------------\n\n // The reader's order, not the declaration's.\n const cols = orderedKeys.map((key) => [key, props.columns[key]!]) as Array<\n [string, ColumnDef<T>]\n >;\n const visibleCols = cols.filter(([key]) => visibleColumns.has(key));\n const hasCheckbox = Boolean(props.bulkActions?.length);\n const hasRowActions = Boolean(props.rowActions);\n\n const rowCtx: RowActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n const bulkCtx: BulkActionContext = useMemo(\n () => ({ refresh, clearSelection }),\n [refresh, clearSelection],\n );\n\n /**\n * How many filters currently narrow the list — a count rather than the\n * boolean this used to be, because on a phone the bar is behind a button\n * and the trigger's badge is the only thing that says the table is\n * filtered at all.\n */\n const activeFilterCount = useMemo(() => {\n if (!props.filters || !form) return 0;\n return Object.keys(cleanFilterValues(form.currentValues ?? {})).length;\n }, [props.filters, form, refreshKey]);\n const hasActiveFilters = activeFilterCount > 0;\n\n // What every cell is told beside its row: the search the rows on screen\n // answer, from the first `preset: \"search\"` field holding one.\n const searchKey = Object.entries(props.filters?.fields ?? {}).find(\n ([, field]) => field.preset === \"search\",\n )?.[0];\n const rowSearch = searchKey ? rowFilters?.[searchKey] : undefined;\n const cellContext: DataTableCellContext = {\n search:\n typeof rowSearch === \"string\" && rowSearch.trim() !== \"\"\n ? rowSearch.trim()\n : undefined,\n };\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * is not the one the table declares. Not the count alone, or a reader who\n * removed a default filter would have no way to bring it back.\n */\n const canResetFilters =\n hasActiveFilters || filterVisibility.differsFromDeclaration;\n\n // The empty state is showing, as opposed to the skeleton that also renders\n // on `data.length === 0`. Read by the `<Table>` height as well as the body,\n // so the two cannot disagree.\n const isEmptyState = !loading && data.length === 0;\n\n // A node that draws nothing is no help and no content: the `?` and the\n // band would open on an empty card. Decided here, once, and handed down\n // as `undefined` when it is empty.\n const hasHelp =\n props.help != null && props.help !== false && props.help !== \"\";\n const showToolbar =\n Boolean(props.filters) ||\n Boolean(props.leading) ||\n Boolean(props.toolbar) ||\n Boolean(props.actions?.length) ||\n hasHelp ||\n !props.hideColumnPicker ||\n !props.hideActionsMenu;\n // Drawn while a first fetch is out (its placeholders), and after that only\n // with something in it: a summary with no card and no content is no band.\n // A function is called on every render, which only builds its element: the\n // panel mounts it while open, and the counter is what tells it to reload.\n const rawSummaryContent = props.summary?.content;\n const summaryContent =\n typeof rawSummaryContent === \"function\"\n ? rawSummaryContent({ refreshKey })\n : rawSummaryContent;\n const hasSummaryContent =\n summaryContent != null && summaryContent !== false && summaryContent !== \"\";\n const showSummary =\n Boolean(props.summary) &&\n (summary.cards === undefined ||\n summary.cards.length > 0 ||\n hasSummaryContent);\n const cellPadding = DATA_TABLE_CELL_PADDING[props.cellPadding ?? \"normal\"];\n const squareRight = props.squareRight\n ? DATA_TABLE_SQUARE_RIGHT[`${props.squareRight}`]\n : undefined;\n // `flat` drops the outer frame and keeps the lines between the bands: the\n // toolbar keeps its bottom border, the footer its top one, and the rows\n // lose the sides. Applied after `squareRight`, which has nothing left to\n // square once the corners are gone.\n const flatTop = props.flat && \"rounded-none border-x-0 border-t-0\";\n const flatRows =\n props.flat && \"rounded-none border-x-0 border-t-0 border-b-0\";\n const flatBottom = props.flat && \"rounded-none border-x-0 border-b-0\";\n // The footer holds two controls, the size picker and the page links, and\n // the count beside them. A table that hid the picker (`pageSizes={[]}`)\n // and fits on one page has neither, and \"Page 1 of 1\" alone is a bar\n // saying nothing, so it goes. The links' condition is the footer's own.\n const showFooter =\n (props.pageSizes ?? PAGE_SIZES).length > 0 ||\n Boolean(meta?.totalPages && meta.totalPages > 1);\n const showColumnPicker = !props.hideColumnPicker && allColumnKeys.length > 0;\n const showActionsMenu = !props.hideActionsMenu;\n\n return (\n <ClientOnly>\n <div className={cn(\"flex flex-col gap-2\", props.className)}>\n {props.header && (\n <div className=\"flex items-center gap-2\">\n <div className=\"min-w-0 flex-1\">{props.header}</div>\n </div>\n )}\n\n {/*\n The summary opens the frame when it is there, so it takes the top\n corners `squareRight` squares, and whatever follows it (the filter\n bar, or the rows when there is none) joins under it the way the rows\n join the filter bar: flattened top, no top border, `-mt-2` against\n the wrapper's gap. The panel's own bottom border is the line\n between them.\n */}\n {showSummary && (\n <DataTableSummaryPanel\n title={\n props.summary?.title ??\n tr(\"dataTable.summary\", { default: \"Summary\" })\n }\n open={summary.open}\n onOpenChange={summary.setOpen}\n cards={summary.cards}\n loading={summary.loading}\n content={hasSummaryContent ? summaryContent : undefined}\n className={cn(squareRight?.top, flatTop, props.chromeClassName)}\n />\n )}\n\n {showToolbar && (\n <DataTableToolbar<T>\n columns={props.columns}\n filters={untyped.filters}\n form={form}\n filterDefinition={filterDefinition}\n shownFilters={filterVisibility.shown}\n onShownFiltersChange={filterVisibility.setShown}\n canResetFilters={canResetFilters}\n leading={props.leading}\n toolbar={props.toolbar}\n actions={props.actions}\n help={hasHelp ? props.help : undefined}\n isMobile={isMobile}\n showColumnPicker={showColumnPicker}\n showActionsMenu={showActionsMenu}\n activeFilterCount={activeFilterCount}\n canShare={canShare}\n resetFilters={resetFilters}\n shareFilters={shareFilters}\n orderedKeys={orderedKeys}\n visibleColumns={visibleColumns}\n toggleColumn={toggleColumn}\n reorderColumn={reorderColumn}\n isRefreshing={isRefreshing}\n handleRefreshClick={handleRefreshClick}\n className={cn(\n showSummary\n ? \"-mt-2 rounded-t-none border-t-0\"\n : squareRight?.top,\n flatTop,\n props.chromeClassName,\n )}\n />\n )}\n\n {hasCheckbox && selection.size > 0 && visibleBulkActions.length > 0 && (\n <DataTableBulkBar<T>\n selection={selection}\n selectedItems={selectedItems}\n visibleBulkActions={visibleBulkActions}\n bulkCtx={bulkCtx}\n clearSelection={clearSelection}\n />\n )}\n\n {/*\n The toolbar, the rows and the footer are one panel: each facing edge\n is flattened and its border dropped so no double line appears, and\n `-mt-2` cancels the wrapper's `gap-2`. The footer half follows\n `showFooter`, which is true for every table that keeps its size\n picker: gating the footer on `meta` alone would pop the bar in and\n flip this bottom border on every load, since `meta` starts null and\n only fills after the fetch. Only a table that hid the picker can\n lose it, and then the rows close the panel themselves.\n */}\n <div\n className={cn(\n \"flex min-h-0 flex-1 flex-col overflow-auto rounded-md border\",\n (showToolbar || showSummary) && \"-mt-2 rounded-t-none border-t-0\",\n showFooter ? \"rounded-b-none border-b-0\" : squareRight?.bottom,\n flatRows,\n // With no toolbar and no summary the rows open the table, so\n // their top-right corner is the one `squareRight` squares.\n !showToolbar && !showSummary && squareRight?.top,\n // `<Table>` wraps the table in a container div whose classes it\n // hardcodes, and only this table needs that container to grow,\n // so the one class it needs is set from out here instead.\n //\n // `grow`, NOT `flex-1`: `flex-1` sets the basis to 0, and in the\n // ordinary case this wrapper has no height of its own, so a 0\n // basis with nothing to grow into collapses the table to nothing.\n // `grow` keeps the content basis and only spends space that is\n // actually free, which is the full-height case.\n \"[&>[data-slot=table-container]]:grow\",\n )}\n >\n {/* `h-full` ONLY while the empty state is what is in the body.\n It is what lets that one row take the height the scroller grew\n into, so `align-middle` can centre the state in it.\n\n ⚠️ Never unconditionally. A CSS table given a height larger\n than its content does not leave the surplus at the bottom, it\n DISTRIBUTES IT ACROSS THE ROWS - so an unconditional `h-full`\n silently turns a short table into a tall one: Lore's Apps page,\n two rows in a full-height pane, rendered them 239px each. No\n unit test sees it (jsdom computes no layout) and it is invisible\n on a table long enough to fill its own container, which is why\n it reached e2e rather than review. */}\n <Table className={cn(isEmptyState && \"h-full\")}>\n {/* `bg-muted`, fully opaque, NOT the base header's `bg-muted/50`:\n this header is sticky, so anything translucent lets the rows\n scroll visibly through the column labels. Same tint, no\n transparency.\n\n Two inset lines, not one. The bottom is the divider against the\n first row; the top is the `--bevel` highlight, which is what\n gives the band its thickness. Inset shadows rather than borders\n because a border on a sticky `<thead>` is dropped by the\n collapsed table border model, and because the two lines have to\n sit INSIDE the header's own height: it is pinned at `top-0`\n against a scrolling body, so anything painted outside it is\n painted over. */}\n <TableHeader\n className={cn(\n // ⚠️ `[&_tr]:border-b-0` or the bottom rule is drawn TWICE: `TableHeader`\n // gives its rows a `border-b`, and the inset shadow above draws\n // the same line, so the band closed with 2px where it opens with\n // 1px. The inset one wins because it is what survives the sticky\n // header being painted over.\n \"bg-muted sticky top-0 z-10 shadow-[inset_0_1px_0_0_var(--bevel),inset_0_-1px_0_0_var(--border)] [&_tr]:border-b-0\",\n props.chromeClassName,\n )}\n >\n <DataTableHeaderRow<T>\n headClassName={cellPadding.head}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n allSelected={allSelected}\n someSelected={someSelected}\n toggleAll={toggleAll}\n sort={sort}\n toggleSort={toggleSort}\n setSortTo={setSortTo}\n moveColumn={moveColumn}\n toggleColumn={toggleColumn}\n />\n </TableHeader>\n <DataTableBody<T>\n cellClassName={cellPadding.cell}\n data={data}\n cellContext={cellContext}\n rowKeys={rowKeys}\n loading={loading}\n visibleCols={visibleCols}\n hasCheckbox={hasCheckbox}\n hasRowActions={hasRowActions}\n hasActiveFilters={hasActiveFilters}\n selection={selection}\n toggleRow={toggleRow}\n rowCtx={rowCtx}\n rowActions={props.rowActions}\n onRowClick={props.onRowClick}\n onRowHover={props.onRowHover}\n empty={props.empty}\n emptyMessage={props.emptyMessage}\n emptyState={props.emptyState}\n noMatchState={props.noMatchState}\n />\n </Table>\n </div>\n\n {/* A move is otherwise silent: nothing about a reordered table is\n spoken, and the visual change is the only feedback. Outside the\n table so it is not read as a cell. */}\n <span aria-live=\"polite\" className=\"sr-only\">\n {orderAnnouncement}\n </span>\n\n {showFooter && (\n <DataTableFooter\n pageSizes={props.pageSizes}\n sizeForm={sizeForm}\n meta={meta}\n isMobile={isMobile}\n setPage={setPage}\n className={cn(\n squareRight?.bottom,\n flatBottom,\n props.chromeClassName,\n )}\n />\n )}\n </div>\n </ClientOnly>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAa,aAIX,UACG;;;;;;CAMH,MAAM,UAAU;;;;;;;;;;;;;;CAehB,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,KAAA,IAAY,MAAM;CACvD,MAAM,aACJ,MAAM,SAAS,YAAY,QAAQ,KAAA,IAAY,MAAM;CACvD,MAAM,UACJ,MAAM,SAAS,SAAS,QAAQ,KAAA,IAAY,MAAM;CAKpD,MAAM,UACJ,MAAM,WAAW,WAAW,IAAI,KAAA,IAAY,MAAM;CAKpD,MAAM,CAAC,MAAM,WAAW,eACtB,cAAc,SAAS,MAAM,WAAW,CAC1C;CACA,MAAM,SAAS,UAAU;CACzB,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,QAAQ,SAAS;;;;;;;;;;;CAWvB,MAAM,WAAW,YAAY;CAE7B,MAAM,EAAE,MAAM,YAAY,qBAAqB,uBAAuB;EACpE,OAAO;EACP;EACA;CACF,CAAC;CAED,MAAM,mBAAmB,6BAA6B;EACpD,YAAY;EACZ;CACF,CAAC;CAED,MAAM,EACJ,MACA,SACA,UACA,MACA,SACA,MACA,MACA,YACA,SACA,YACA,eACA,cACA,iBACA,YACA,cACE,iBAAiB;EACnB,OAAO;EACP;EACA;EACA;EACA;EACA;CACF,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QAAD;IAAM,aAAU;IAAS,WAAU;IAChC,UAAA;GACG,CAAA;GAEL,cACC,oBAAC,iBAAD;IACE,WAAW,MAAM;IACP;IACJ;IACI;IACD;IACT,WAAW,GACT,aAAa,QACb,YACA,MAAM,eACR;GACD,CAAA;EAEA;CACK,CAAA,EAAA,CAAA;AAEhB"}
@@ -26,6 +26,10 @@ export interface DataTableToolbarProps<T> {
26
26
  * differs from its declaration.
27
27
  */
28
28
  canResetFilters: boolean;
29
+ /**
30
+ * The table's `leading` slot, drawn first on the row.
31
+ */
32
+ leading?: ReactNode;
29
33
  toolbar?: ReactNode;
30
34
  actions?: TableAction[];
31
35
  /**
@@ -59,9 +63,9 @@ export interface DataTableToolbarProps<T> {
59
63
  className?: string;
60
64
  }
61
65
  /**
62
- * The bar above the rows: the filter form (or its dialog on a phone), the
63
- * caller's `toolbar` slot and `actions`, then the column picker, the filter
64
- * menu, refresh and help.
66
+ * The bar above the rows: the caller's `leading` slot, the filter form (or its
67
+ * dialog on a phone), the caller's `toolbar` slot and `actions`, then the
68
+ * column picker, the filter menu, refresh and help.
65
69
  */
66
70
  export declare const DataTableToolbar: <T>(props: DataTableToolbarProps<T>) => import("react").JSX.Element;
67
71
  //# sourceMappingURL=DataTableToolbar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableToolbar.d.ts","sourceRoot":"","sources":["../../src/table/DataTableToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAgBvC,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7E,MAAM,WAAW,qBAA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CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAU,qBAAqB,CAAC,CAAC,CAAC,gCA4QnE,CAAC"}
@@ -12,9 +12,9 @@ import { RefreshCw } from "lucide-react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  //#region src/table/DataTableToolbar.tsx
14
14
  /**
15
- * The bar above the rows: the filter form (or its dialog on a phone), the
16
- * caller's `toolbar` slot and `actions`, then the column picker, the filter
17
- * menu, refresh and help.
15
+ * The bar above the rows: the caller's `leading` slot, the filter form (or its
16
+ * dialog on a phone), the caller's `toolbar` slot and `actions`, then the
17
+ * column picker, the filter menu, refresh and help.
18
18
  */
19
19
  const DataTableToolbar = (props) => {
20
20
  const { form, isMobile, showColumnPicker, showActionsMenu, activeFilterCount, canShare, resetFilters, shareFilters, orderedKeys, visibleColumns, toggleColumn, reorderColumn, isRefreshing, handleRefreshClick } = props;
@@ -40,6 +40,10 @@ const DataTableToolbar = (props) => {
40
40
  return /* @__PURE__ */ jsxs("div", {
41
41
  className: cn("bg-muted [&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background dark:[&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background flex flex-wrap items-end gap-2 rounded-md rounded-b-none border p-2 shadow-[inset_0_1px_0_0_var(--bevel)]", props.className),
42
42
  children: [
43
+ props.leading && /* @__PURE__ */ jsx("div", {
44
+ className: "flex min-w-0 items-center gap-2 self-center",
45
+ children: props.leading
46
+ }),
43
47
  props.filters && form && !isMobile ? /* @__PURE__ */ jsx("form", {
44
48
  ...form.props,
45
49
  className: "flex flex-1 flex-wrap items-end gap-2 self-stretch",
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableToolbar.js","names":[],"sources":["../../src/table/DataTableToolbar.tsx"],"sourcesContent":["import type { ZObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { RefreshCw } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"../core/Tooltip.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { DataTableColumnPicker } from \"./DataTableColumnPicker.tsx\";\nimport { DataTableFilterBar } from \"./DataTableFilterBar.tsx\";\nimport { DataTableFilterDialog } from \"./DataTableFilterDialog.tsx\";\nimport { dataTableFilterBarFields } from \"./dataTableFilterFields.ts\";\nimport { DataTableFilterMenu } from \"./DataTableFilterMenu.tsx\";\nimport { DataTableHelpButton } from \"./DataTableHelpButton.tsx\";\nimport type {\n DataTableFilterFields,\n DataTableFilters,\n ColumnDef,\n TableAction,\n} from \"./dataTableTypes.ts\";\nimport type { DataTableFilterDefinition } from \"./useDataTableFilterForm.ts\";\n\nexport interface DataTableToolbarProps<T> {\n columns: Record<string, ColumnDef<T>>;\n filters?: DataTableFilters<DataTableFilterFields>;\n /**\n * The table's own filter form.\n */\n form?: FormModel<ZObject>;\n /**\n * What the filters are, as read at mount. The bar is drawn from it and from\n * `filters.fields`, read every render.\n */\n filterDefinition?: DataTableFilterDefinition;\n /**\n * Which filters are on the bar. The table's state; see\n * `useDataTableFilterVisibility`.\n */\n shownFilters: readonly string[];\n onShownFiltersChange: (shown: string[], act: boolean) => void;\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * differs from its declaration.\n */\n canResetFilters: boolean;\n toolbar?: ReactNode;\n actions?: TableAction[];\n /**\n * The table's `help`, behind the `?` that closes the icon group. The\n * table passes `undefined` for a node that draws nothing.\n */\n help?: ReactNode;\n isMobile: boolean;\n showColumnPicker: boolean;\n showActionsMenu: boolean;\n activeFilterCount: number;\n /**\n * Whether the table reads its filters back from the query, which is what\n * makes a shared link worth copying.\n */\n canShare: boolean;\n resetFilters: () => void;\n shareFilters: () => Promise<void>;\n /**\n * Every column key, in the reader's order.\n */\n orderedKeys: string[];\n visibleColumns: Set<string>;\n toggleColumn: (id: string) => void;\n reorderColumn: (key: string, target: string) => void;\n isRefreshing: boolean;\n handleRefreshClick: () => void;\n /**\n * The table's `chromeClassName`, merged after the bar's own classes.\n */\n className?: string;\n}\n\n/**\n * The bar above the rows: the filter form (or its dialog on a phone), the\n * caller's `toolbar` slot and `actions`, then the column picker, the filter\n * menu, refresh and help.\n */\nexport const DataTableToolbar = <T,>(props: DataTableToolbarProps<T>) => {\n const {\n form,\n isMobile,\n showColumnPicker,\n showActionsMenu,\n activeFilterCount,\n canShare,\n resetFilters,\n shareFilters,\n orderedKeys,\n visibleColumns,\n toggleColumn,\n reorderColumn,\n isRefreshing,\n handleRefreshClick,\n } = props;\n const { tr } = useI18n();\n const hasHelp = props.help !== undefined;\n\n /**\n * The filter controls, in either place. With `render`, the caller draws\n * them and the bar is not mounted; without it, the table draws the bar from\n * `fields`.\n */\n const filterControls = (variant: \"bar\" | \"dialog\") => {\n if (!props.filters || !form) return null;\n if (props.filters.render) return props.filters.render(form);\n if (!props.filterDefinition) return null;\n return (\n <DataTableFilterBar\n form={form}\n fields={dataTableFilterBarFields(\n props.filters.fields,\n props.filterDefinition,\n )}\n shown={props.shownFilters}\n onShownChange={props.onShownFiltersChange}\n variant={variant}\n />\n );\n };\n\n return (\n // `bg-muted`, paired with the pagination footer below: the filter bar\n // and the footer are the table's chrome and bracket it top and\n // bottom, so they sit one step off the page while the table itself\n // (header included) stays on it. They were `bg-card` — pure white in\n // light, the same colour as the page, so neither had an edge.\n //\n // The controls need an explicit fill because of that. shadcn ships\n // inputs and select triggers `bg-transparent` in light and only fills\n // them in dark (`dark:bg-input/30`) — the light case assumes a white\n // page, where transparent already reads as a white field. On this bar\n // it does not: they would take the muted grey and the border alone\n // would have to say \"input\". Scoped here rather than to the\n // primitives, whose transparent light fill is right everywhere\n // else.\n //\n // `bg-background` suits both modes: white against the muted bar in\n // light, near-black in dark, so the control reads as a well sunk\n // into the chrome either way. The `dark:` copy is not redundant —\n // the primitives ship `dark:bg-input/30` at (0,2,0), a translucent\n // WHITE wash that leaves the field lighter than the bar. Only the\n // dark-scoped rule (0,3,0) outranks it, and without it the two\n // controls disagreed: the trigger went dark, the input stayed light.\n //\n // ⚠️ **`date-trigger` is named, and it is not a third spelling of\n // the same thing.** `:is(input,[role=combobox])` describes the two\n // shapes a field happened to have when this was written, and a\n // calendar is neither: `ControlDate` and `ControlDateRange` open a\n // POPOVER, so their trigger is a plain button with no combobox role\n // to match on. It therefore kept the primitives' own\n // `dark:bg-input/30` and sat LIGHTER than the bar while every select\n // beside it sat darker - measured on Admin > Audit log, `oklab(1 0 0\n // / 0.045)` against the selects' opaque `oklch(0.145 0 0)`. Light\n // mode had it the other way round, the calendar taking the muted\n // grey. That is what #Q2295 reported, and what #Q2282 and #Q2283\n // could not reach: they made the date controls draw the kit's\n // trigger, and this bar was still addressing fields by tag and role\n // rather than by what they are.\n //\n // The canonical list of field surfaces is the hover-border rule in\n // `styles.css`, which enumerates the same slots. Add a field shape\n // there and it belongs here too.\n //\n // The `--bevel` line, laid just inside the bar's own top border,\n // the same fold the header and the footer carry. This one is the\n // top edge of the whole table block, so it is the one that decides\n // whether the block sits ON the page or IN it.\n <div\n className={cn(\n \"bg-muted [&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background dark:[&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background flex flex-wrap items-end gap-2 rounded-md rounded-b-none border p-2 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.className,\n )}\n >\n {props.filters && form && !isMobile ? (\n // `self-stretch`: the form spans the bar's full row, so the \"+\" (whose\n // own `self-center` targets this form) sits on the row's midline. It\n // used to shrink to its content and, under the bar's `items-end`, sat\n // at the bottom: with no filter shown the form was just the 28px \"+\"\n // against 36px actions, 4px under the midline.\n <form\n {...form.props}\n className=\"flex flex-1 flex-wrap items-end gap-2 self-stretch\"\n >\n {filterControls(\"bar\")}\n </form>\n ) : (\n <div className=\"flex flex-1\" />\n )}\n {/*\n `self-center`, against the bar's own `items-end`.\n\n The bar bottom-aligns because a filter Control may carry a label,\n and a row of labelled controls has to line up on the inputs rather\n than on the top of the tallest label. Everything to the right of\n the filters is a bare control with no label of its own, so\n inheriting that baseline pinned it to the bottom of whatever the\n filter area happened to measure — a \"New\" button sitting low\n against a labelled select, moving as soon as a filter gained or\n lost its label.\n\n Centring only the trailing content keeps the filter row's own\n alignment intact and makes the actions independent of it.\n */}\n {props.toolbar && <div className=\"self-center\">{props.toolbar}</div>}\n <TooltipProvider>\n <div className=\"flex items-center gap-1 self-center\">\n {props.actions?.length ? (\n <>\n {props.actions.map((action) => {\n const ActionIcon = action.icon;\n if (action.primary) {\n // The visible label is the tooltip, so there is\n // none. `aria-label` keeps the accessible name once\n // the label collapses below `sm`; `h-9` lines the\n // button up with the ghost icons beside it.\n return (\n <Button\n key={action.label}\n type=\"button\"\n size=\"sm\"\n className=\"h-9 px-3\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n <ActionIcon className=\"size-4\" />\n <span className=\"hidden sm:inline\">{action.label}</span>\n </Button>\n );\n }\n return (\n <Tooltip key={action.label}>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"minimal\"\n className=\"h-9 w-9 p-0\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n />\n }\n >\n <ActionIcon className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{action.label}</TooltipContent>\n </Tooltip>\n );\n })}\n {(showColumnPicker || showActionsMenu || hasHelp) && (\n <span\n aria-hidden\n className=\"bg-border mx-1 h-5 w-px self-center\"\n />\n )}\n </>\n ) : null}\n {isMobile && props.filters && form && (\n <DataTableFilterDialog\n form={form}\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onReset={resetFilters}\n onShare={canShare ? shareFilters : undefined}\n >\n {filterControls(\"dialog\")}\n </DataTableFilterDialog>\n )}\n {showColumnPicker && (\n <DataTableColumnPicker<T>\n columns={props.columns}\n order={orderedKeys}\n visible={visibleColumns}\n onToggle={toggleColumn}\n onReorder={reorderColumn}\n />\n )}\n {/*\n Desktop only. On a phone the same actions live in the filter\n dialog, beside the controls they act on, and a second copy out\n here would spend a slot of the very row that dialog exists to\n shorten.\n\n A table that cannot be linked gets the menu too, holding Reset\n alone: the bare icon button this replaced spends most of its\n life disabled, and a greyed icon carries no words saying what it\n would have done. See `DataTableFilterMenu`.\n */}\n {showActionsMenu && props.filters && !isMobile && (\n <DataTableFilterMenu\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onShare={canShare ? shareFilters : undefined}\n onReset={resetFilters}\n />\n )}\n {showActionsMenu && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"minimal\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"dataTable.refresh\", {\n default: \"Refresh\",\n })}\n disabled={isRefreshing}\n onClick={handleRefreshClick}\n />\n }\n >\n <RefreshCw\n className={cn(\"size-4\", isRefreshing && \"animate-spin\")}\n />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"dataTable.refresh\", { default: \"Refresh\" })}\n </TooltipContent>\n </Tooltip>\n )}\n {/*\n Last, after refresh: the explanation of the page is read once and\n then left alone, so it takes the end of the row rather than a slot\n between the controls a reader keeps reaching for.\n */}\n {hasHelp && <DataTableHelpButton>{props.help}</DataTableHelpButton>}\n </div>\n </TooltipProvider>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyFA,MAAa,oBAAwB,UAAoC;CACvE,MAAM,EACJ,MACA,UACA,kBACA,iBACA,mBACA,UACA,cACA,cACA,aACA,gBACA,cACA,eACA,cACA,uBACE;CACJ,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,UAAU,MAAM,SAAS,KAAA;;;;;;CAO/B,MAAM,kBAAkB,YAA8B;EACpD,IAAI,CAAC,MAAM,WAAW,CAAC,MAAM,OAAO;EACpC,IAAI,MAAM,QAAQ,QAAQ,OAAO,MAAM,QAAQ,OAAO,IAAI;EAC1D,IAAI,CAAC,MAAM,kBAAkB,OAAO;EACpC,OACE,oBAAC,oBAAD;GACQ;GACN,QAAQ,yBACN,MAAM,QAAQ,QACd,MAAM,gBACR;GACA,OAAO,MAAM;GACb,eAAe,MAAM;GACZ;EACV,CAAA;CAEL;CAEA,OA+CE,qBAAC,OAAD;EACE,WAAW,GACT,uQACA,MAAM,SACR;EAJF,UAAA;GAMG,MAAM,WAAW,QAAQ,CAAC,WAMzB,oBAAC,QAAD;IACE,GAAI,KAAK;IACT,WAAU;IAET,UAAA,eAAe,KAAK;GACjB,CAAA,IAEN,oBAAC,OAAD,EAAK,WAAU,cAAe,CAAA;GAiB/B,MAAM,WAAW,oBAAC,OAAD;IAAK,WAAU;IAAe,UAAA,MAAM;GAAa,CAAA;GACnE,oBAAC,iBAAD,EAAA,UACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACG,MAAM,SAAS,SACd,qBAAA,UAAA,EAAA,UAAA,CACG,MAAM,QAAQ,KAAK,WAAW;MAC7B,MAAM,aAAa,OAAO;M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;OACV,cAAY,GAAG,qBAAqB,EAClC,SAAS,UACX,CAAC;OACD,UAAU;OACV,SAAS;MACV,CAAA;MAGH,UAAA,oBAAC,WAAD,EACE,WAAW,GAAG,UAAU,gBAAgB,cAAc,EACvD,CAAA;KACa,CAAA,GAChB,oBAAC,gBAAD,EAAA,UACG,GAAG,qBAAqB,EAAE,SAAS,UAAU,CAAC,EACjC,CAAA,CACT,EAAA,CAAA;KAOV,WAAW,oBAAC,qBAAD,EAAA,UAAsB,MAAM,KAA0B,CAAA;IAC/D;GACU,CAAA,EAAA,CAAA;EACd;;AAET"}
1
+ {"version":3,"file":"DataTableToolbar.js","names":[],"sources":["../../src/table/DataTableToolbar.tsx"],"sourcesContent":["import type { ZObject } from \"alepha\";\nimport type { FormModel } from \"alepha/react/form\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { RefreshCw } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nimport { Button } from \"../core/Button.tsx\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"../core/Tooltip.tsx\";\nimport { cn } from \"../core/utils.ts\";\nimport { DataTableColumnPicker } from \"./DataTableColumnPicker.tsx\";\nimport { DataTableFilterBar } from \"./DataTableFilterBar.tsx\";\nimport { DataTableFilterDialog } from \"./DataTableFilterDialog.tsx\";\nimport { dataTableFilterBarFields } from \"./dataTableFilterFields.ts\";\nimport { DataTableFilterMenu } from \"./DataTableFilterMenu.tsx\";\nimport { DataTableHelpButton } from \"./DataTableHelpButton.tsx\";\nimport type {\n DataTableFilterFields,\n DataTableFilters,\n ColumnDef,\n TableAction,\n} from \"./dataTableTypes.ts\";\nimport type { DataTableFilterDefinition } from \"./useDataTableFilterForm.ts\";\n\nexport interface DataTableToolbarProps<T> {\n columns: Record<string, ColumnDef<T>>;\n filters?: DataTableFilters<DataTableFilterFields>;\n /**\n * The table's own filter form.\n */\n form?: FormModel<ZObject>;\n /**\n * What the filters are, as read at mount. The bar is drawn from it and from\n * `filters.fields`, read every render.\n */\n filterDefinition?: DataTableFilterDefinition;\n /**\n * Which filters are on the bar. The table's state; see\n * `useDataTableFilterVisibility`.\n */\n shownFilters: readonly string[];\n onShownFiltersChange: (shown: string[], act: boolean) => void;\n /**\n * Whether Reset filters would change anything: a value set, or a bar that\n * differs from its declaration.\n */\n canResetFilters: boolean;\n /**\n * The table's `leading` slot, drawn first on the row.\n */\n leading?: ReactNode;\n toolbar?: ReactNode;\n actions?: TableAction[];\n /**\n * The table's `help`, behind the `?` that closes the icon group. The\n * table passes `undefined` for a node that draws nothing.\n */\n help?: ReactNode;\n isMobile: boolean;\n showColumnPicker: boolean;\n showActionsMenu: boolean;\n activeFilterCount: number;\n /**\n * Whether the table reads its filters back from the query, which is what\n * makes a shared link worth copying.\n */\n canShare: boolean;\n resetFilters: () => void;\n shareFilters: () => Promise<void>;\n /**\n * Every column key, in the reader's order.\n */\n orderedKeys: string[];\n visibleColumns: Set<string>;\n toggleColumn: (id: string) => void;\n reorderColumn: (key: string, target: string) => void;\n isRefreshing: boolean;\n handleRefreshClick: () => void;\n /**\n * The table's `chromeClassName`, merged after the bar's own classes.\n */\n className?: string;\n}\n\n/**\n * The bar above the rows: the caller's `leading` slot, the filter form (or its\n * dialog on a phone), the caller's `toolbar` slot and `actions`, then the\n * column picker, the filter menu, refresh and help.\n */\nexport const DataTableToolbar = <T,>(props: DataTableToolbarProps<T>) => {\n const {\n form,\n isMobile,\n showColumnPicker,\n showActionsMenu,\n activeFilterCount,\n canShare,\n resetFilters,\n shareFilters,\n orderedKeys,\n visibleColumns,\n toggleColumn,\n reorderColumn,\n isRefreshing,\n handleRefreshClick,\n } = props;\n const { tr } = useI18n();\n const hasHelp = props.help !== undefined;\n\n /**\n * The filter controls, in either place. With `render`, the caller draws\n * them and the bar is not mounted; without it, the table draws the bar from\n * `fields`.\n */\n const filterControls = (variant: \"bar\" | \"dialog\") => {\n if (!props.filters || !form) return null;\n if (props.filters.render) return props.filters.render(form);\n if (!props.filterDefinition) return null;\n return (\n <DataTableFilterBar\n form={form}\n fields={dataTableFilterBarFields(\n props.filters.fields,\n props.filterDefinition,\n )}\n shown={props.shownFilters}\n onShownChange={props.onShownFiltersChange}\n variant={variant}\n />\n );\n };\n\n return (\n // `bg-muted`, paired with the pagination footer below: the filter bar\n // and the footer are the table's chrome and bracket it top and\n // bottom, so they sit one step off the page while the table itself\n // (header included) stays on it. They were `bg-card` — pure white in\n // light, the same colour as the page, so neither had an edge.\n //\n // The controls need an explicit fill because of that. shadcn ships\n // inputs and select triggers `bg-transparent` in light and only fills\n // them in dark (`dark:bg-input/30`) — the light case assumes a white\n // page, where transparent already reads as a white field. On this bar\n // it does not: they would take the muted grey and the border alone\n // would have to say \"input\". Scoped here rather than to the\n // primitives, whose transparent light fill is right everywhere\n // else.\n //\n // `bg-background` suits both modes: white against the muted bar in\n // light, near-black in dark, so the control reads as a well sunk\n // into the chrome either way. The `dark:` copy is not redundant —\n // the primitives ship `dark:bg-input/30` at (0,2,0), a translucent\n // WHITE wash that leaves the field lighter than the bar. Only the\n // dark-scoped rule (0,3,0) outranks it, and without it the two\n // controls disagreed: the trigger went dark, the input stayed light.\n //\n // ⚠️ **`date-trigger` is named, and it is not a third spelling of\n // the same thing.** `:is(input,[role=combobox])` describes the two\n // shapes a field happened to have when this was written, and a\n // calendar is neither: `ControlDate` and `ControlDateRange` open a\n // POPOVER, so their trigger is a plain button with no combobox role\n // to match on. It therefore kept the primitives' own\n // `dark:bg-input/30` and sat LIGHTER than the bar while every select\n // beside it sat darker - measured on Admin > Audit log, `oklab(1 0 0\n // / 0.045)` against the selects' opaque `oklch(0.145 0 0)`. Light\n // mode had it the other way round, the calendar taking the muted\n // grey. That is what #Q2295 reported, and what #Q2282 and #Q2283\n // could not reach: they made the date controls draw the kit's\n // trigger, and this bar was still addressing fields by tag and role\n // rather than by what they are.\n //\n // The canonical list of field surfaces is the hover-border rule in\n // `styles.css`, which enumerates the same slots. Add a field shape\n // there and it belongs here too.\n //\n // The `--bevel` line, laid just inside the bar's own top border,\n // the same fold the header and the footer carry. This one is the\n // top edge of the whole table block, so it is the one that decides\n // whether the block sits ON the page or IN it.\n <div\n className={cn(\n \"bg-muted [&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background dark:[&_:is(input,[role=combobox],[data-slot=date-trigger])]:bg-background flex flex-wrap items-end gap-2 rounded-md rounded-b-none border p-2 shadow-[inset_0_1px_0_0_var(--bevel)]\",\n props.className,\n )}\n >\n {/*\n `leading` opens the row, before the search, and is centred like\n `toolbar` for the same reason: it carries no label of its own. On a\n phone it stays here too, so it still sits before the button that\n opens the filter dialog.\n */}\n {props.leading && (\n <div className=\"flex min-w-0 items-center gap-2 self-center\">\n {props.leading}\n </div>\n )}\n {props.filters && form && !isMobile ? (\n // `self-stretch`: the form spans the bar's full row, so the \"+\" (whose\n // own `self-center` targets this form) sits on the row's midline. It\n // used to shrink to its content and, under the bar's `items-end`, sat\n // at the bottom: with no filter shown the form was just the 28px \"+\"\n // against 36px actions, 4px under the midline.\n <form\n {...form.props}\n className=\"flex flex-1 flex-wrap items-end gap-2 self-stretch\"\n >\n {filterControls(\"bar\")}\n </form>\n ) : (\n <div className=\"flex flex-1\" />\n )}\n {/*\n `self-center`, against the bar's own `items-end`.\n\n The bar bottom-aligns because a filter Control may carry a label,\n and a row of labelled controls has to line up on the inputs rather\n than on the top of the tallest label. Everything to the right of\n the filters is a bare control with no label of its own, so\n inheriting that baseline pinned it to the bottom of whatever the\n filter area happened to measure — a \"New\" button sitting low\n against a labelled select, moving as soon as a filter gained or\n lost its label.\n\n Centring only the trailing content keeps the filter row's own\n alignment intact and makes the actions independent of it.\n */}\n {props.toolbar && <div className=\"self-center\">{props.toolbar}</div>}\n <TooltipProvider>\n <div className=\"flex items-center gap-1 self-center\">\n {props.actions?.length ? (\n <>\n {props.actions.map((action) => {\n const ActionIcon = action.icon;\n if (action.primary) {\n // The visible label is the tooltip, so there is\n // none. `aria-label` keeps the accessible name once\n // the label collapses below `sm`; `h-9` lines the\n // button up with the ghost icons beside it.\n return (\n <Button\n key={action.label}\n type=\"button\"\n size=\"sm\"\n className=\"h-9 px-3\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n >\n <ActionIcon className=\"size-4\" />\n <span className=\"hidden sm:inline\">{action.label}</span>\n </Button>\n );\n }\n return (\n <Tooltip key={action.label}>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"minimal\"\n className=\"h-9 w-9 p-0\"\n aria-label={action.label}\n disabled={action.disabled}\n onClick={action.onClick}\n />\n }\n >\n <ActionIcon className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{action.label}</TooltipContent>\n </Tooltip>\n );\n })}\n {(showColumnPicker || showActionsMenu || hasHelp) && (\n <span\n aria-hidden\n className=\"bg-border mx-1 h-5 w-px self-center\"\n />\n )}\n </>\n ) : null}\n {isMobile && props.filters && form && (\n <DataTableFilterDialog\n form={form}\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onReset={resetFilters}\n onShare={canShare ? shareFilters : undefined}\n >\n {filterControls(\"dialog\")}\n </DataTableFilterDialog>\n )}\n {showColumnPicker && (\n <DataTableColumnPicker<T>\n columns={props.columns}\n order={orderedKeys}\n visible={visibleColumns}\n onToggle={toggleColumn}\n onReorder={reorderColumn}\n />\n )}\n {/*\n Desktop only. On a phone the same actions live in the filter\n dialog, beside the controls they act on, and a second copy out\n here would spend a slot of the very row that dialog exists to\n shorten.\n\n A table that cannot be linked gets the menu too, holding Reset\n alone: the bare icon button this replaced spends most of its\n life disabled, and a greyed icon carries no words saying what it\n would have done. See `DataTableFilterMenu`.\n */}\n {showActionsMenu && props.filters && !isMobile && (\n <DataTableFilterMenu\n activeCount={activeFilterCount}\n canReset={props.canResetFilters}\n onShare={canShare ? shareFilters : undefined}\n onReset={resetFilters}\n />\n )}\n {showActionsMenu && (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"minimal\"\n className=\"h-9 w-9 p-0\"\n aria-label={tr(\"dataTable.refresh\", {\n default: \"Refresh\",\n })}\n disabled={isRefreshing}\n onClick={handleRefreshClick}\n />\n }\n >\n <RefreshCw\n className={cn(\"size-4\", isRefreshing && \"animate-spin\")}\n />\n </TooltipTrigger>\n <TooltipContent>\n {tr(\"dataTable.refresh\", { default: \"Refresh\" })}\n </TooltipContent>\n </Tooltip>\n )}\n {/*\n Last, after refresh: the explanation of the page is read once and\n then left alone, so it takes the end of the row rather than a slot\n between the controls a reader keeps reaching for.\n */}\n {hasHelp && <DataTableHelpButton>{props.help}</DataTableHelpButton>}\n </div>\n </TooltipProvider>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6FA,MAAa,oBAAwB,UAAoC;CACvE,MAAM,EACJ,MACA,UACA,kBACA,iBACA,mBACA,UACA,cACA,cACA,aACA,gBACA,cACA,eACA,cACA,uBACE;CACJ,MAAM,EAAE,OAAO,QAAQ;CACvB,MAAM,UAAU,MAAM,SAAS,KAAA;;;;;;CAO/B,MAAM,kBAAkB,YAA8B;EACpD,IAAI,CAAC,MAAM,WAAW,CAAC,MAAM,OAAO;EACpC,IAAI,MAAM,QAAQ,QAAQ,OAAO,MAAM,QAAQ,OAAO,IAAI;EAC1D,IAAI,CAAC,MAAM,kBAAkB,OAAO;EACpC,OACE,oBAAC,oBAAD;GACQ;GACN,QAAQ,yBACN,MAAM,QAAQ,QACd,MAAM,gBACR;GACA,OAAO,MAAM;GACb,eAAe,MAAM;GACZ;EACV,CAAA;CAEL;CAEA,OA+CE,qBAAC,OAAD;EACE,WAAW,GACT,uQACA,MAAM,SACR;EAJF,UAAA;GAYG,MAAM,WACL,oBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,MAAM;GACJ,CAAA;GAEN,MAAM,WAAW,QAAQ,CAAC,WAMzB,oBAAC,QAAD;IACE,GAAI,KAAK;IACT,WAAU;IAET,UAAA,eAAe,KAAK;GACjB,CAAA,I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MACT,UAAU;MACV,WAAW;KACZ,CAAA;KAaF,mBAAmB,MAAM,WAAW,CAAC,YACpC,oBAAC,qBAAD;MACE,aAAa;MACb,UAAU,MAAM;MAChB,SAAS,WAAW,eAAe,KAAA;MACnC,SAAS;KACV,CAAA;KAEF,mBACC,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;MACE,QACE,oBAAC,QAAD;OACE,MAAK;OACL,MAAK;OACL,SAAQ;OACR,WAAU;OACV,cAAY,GAAG,qBAAqB,EAClC,SAAS,UACX,CAAC;OACD,UAAU;OACV,SAAS;MACV,CAAA;MAGH,UAAA,oBAAC,WAAD,EACE,WAAW,GAAG,UAAU,gBAAgB,cAAc,EACvD,CAAA;KACa,CAAA,GAChB,oBAAC,gBAAD,EAAA,UACG,GAAG,qBAAqB,EAAE,SAAS,UAAU,CAAC,EACjC,CAAA,CACT,EAAA,CAAA;KAOV,WAAW,oBAAC,qBAAD,EAAA,UAAsB,MAAM,KAA0B,CAAA;IAC/D;GACU,CAAA,EAAA,CAAA;EACd;;AAET"}
@@ -356,8 +356,25 @@ export interface DataTableBaseProps<T, F extends DataTableFilterFields = DataTab
356
356
  empty?: ReactNode;
357
357
  /**
358
358
  * Free-form content rendered above the toolbar (e.g. a page title).
359
+ *
360
+ * `header` is for a page title above the table; `leading` is for a section
361
+ * title on the toolbar's own row.
359
362
  */
360
363
  header?: ReactNode;
364
+ /**
365
+ * Free-form content drawn at the start of the toolbar's row, before the
366
+ * search, and vertically centred like `toolbar`: a section's title, say
367
+ * its icon, name and count, when one page holds several tables and each
368
+ * should read as one line of title and controls.
369
+ *
370
+ * On a phone, where the filters collapse into a dialog, it stays on the
371
+ * row, before the button that opens that dialog. The table draws nothing
372
+ * of its own here: what goes in is the caller's.
373
+ *
374
+ * Use `header` for a page title above the toolbar, `leading` for a section
375
+ * title on it.
376
+ */
377
+ leading?: ReactNode;
361
378
  /**
362
379
  * Initial sort state. When `persistenceKey` is set, a persisted sort
363
380
  * takes precedence over this.
@@ -1 +1 @@
1
- {"version":3,"file":"dataTableBaseProps.d.ts","sourceRoot":"","sources":["../../src/table/dataTableBaseProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,SAAS,EACT,cAAc,EACd,SAAS,EACT,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,MAAM,WAAW,kBAAkB,CACjC,CAAC,EACD,CAAC,SAAS,qBAAqB,GAAG,uBAAuB;IAEzD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC/B;;;;;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AAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;IACnC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
@@ -0,0 +1,29 @@
1
+ ---
2
+ slug: "packages-alepha-ui-account"
3
+ title: "@alepha/ui - Account"
4
+ summary: "The signed-in user's own account area."
5
+ package: "@alepha/ui"
6
+ section: "packages"
7
+ ---
8
+
9
+ # @alepha/ui - Account
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @alepha/ui
15
+ ```
16
+
17
+ ## Overview
18
+
19
+ The signed-in user's own account area.
20
+
21
+ `AccountRouter` mounts profile, security, sessions, connections and API keys
22
+ under one layout, each page its own lazy chunk. The pages are exported by
23
+ name too, for an app that routes them itself.
24
+
25
+ ## API Reference
26
+
27
+ ### Primitives
28
+
29
+ - [`$pageAccount`](../../../alepha/docs/reference-primitives-$pageaccount.md) - `$pageNav` already parented to `AccountRouter`'s `/account` shell: