@42-central/ui-react 0.25.0 → 0.27.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 (232) hide show
  1. package/dist/{chunk-YZJUPYPO.js → chunk-2W7H43WL.js} +3 -3
  2. package/dist/{chunk-YZJUPYPO.js.map → chunk-2W7H43WL.js.map} +1 -1
  3. package/dist/{chunk-NLSJ6T7V.js → chunk-4D2V4JE4.js} +3 -3
  4. package/dist/{chunk-NLSJ6T7V.js.map → chunk-4D2V4JE4.js.map} +1 -1
  5. package/dist/{chunk-QZ4N5LYG.js → chunk-5H5YOPCF.js} +3 -3
  6. package/dist/{chunk-QZ4N5LYG.js.map → chunk-5H5YOPCF.js.map} +1 -1
  7. package/dist/{chunk-6II2DVYR.js → chunk-7KFUFAVP.js} +4 -4
  8. package/dist/{chunk-6II2DVYR.js.map → chunk-7KFUFAVP.js.map} +1 -1
  9. package/dist/{chunk-XUFCI262.js → chunk-7OGZT7U2.js} +12 -4
  10. package/dist/chunk-7OGZT7U2.js.map +1 -0
  11. package/dist/{chunk-PI7X5YFJ.js → chunk-BGDVUC3B.js} +5 -5
  12. package/dist/{chunk-PI7X5YFJ.js.map → chunk-BGDVUC3B.js.map} +1 -1
  13. package/dist/{chunk-7247WBTV.js → chunk-DJ72KP32.js} +3 -3
  14. package/dist/{chunk-7247WBTV.js.map → chunk-DJ72KP32.js.map} +1 -1
  15. package/dist/{chunk-FZSLSUSX.js → chunk-HCHGERDB.js} +3 -3
  16. package/dist/{chunk-FZSLSUSX.js.map → chunk-HCHGERDB.js.map} +1 -1
  17. package/dist/{chunk-H7WOMZXO.js → chunk-HWBFRDX7.js} +16 -8
  18. package/dist/chunk-HWBFRDX7.js.map +1 -0
  19. package/dist/{chunk-HQPU73WV.js → chunk-I4IJOLNA.js} +4 -4
  20. package/dist/{chunk-HQPU73WV.js.map → chunk-I4IJOLNA.js.map} +1 -1
  21. package/dist/{chunk-UDCCOUWR.js → chunk-IA6DCC3N.js} +6 -6
  22. package/dist/{chunk-UDCCOUWR.js.map → chunk-IA6DCC3N.js.map} +1 -1
  23. package/dist/{chunk-36NWC4GV.js → chunk-ISX3AM32.js} +3 -3
  24. package/dist/{chunk-36NWC4GV.js.map → chunk-ISX3AM32.js.map} +1 -1
  25. package/dist/{chunk-LMCUGYHT.js → chunk-L24N5EON.js} +6 -6
  26. package/dist/chunk-L24N5EON.js.map +1 -0
  27. package/dist/{chunk-HRNWWL3Y.js → chunk-L5GH7LLD.js} +61 -29
  28. package/dist/chunk-L5GH7LLD.js.map +1 -0
  29. package/dist/chunk-LJVIZNPE.js +9 -0
  30. package/dist/chunk-LJVIZNPE.js.map +1 -0
  31. package/dist/{chunk-AHKMN3YQ.js → chunk-MCRTAUSZ.js} +6 -6
  32. package/dist/chunk-MCRTAUSZ.js.map +1 -0
  33. package/dist/{chunk-LHUWOA2U.js → chunk-MNYY7UU2.js} +6 -6
  34. package/dist/{chunk-LHUWOA2U.js.map → chunk-MNYY7UU2.js.map} +1 -1
  35. package/dist/{chunk-7HZBD4YZ.js → chunk-NF2PBGD3.js} +36 -23
  36. package/dist/chunk-NF2PBGD3.js.map +1 -0
  37. package/dist/{chunk-54W6VAI3.js → chunk-NNPSBC7O.js} +5 -5
  38. package/dist/{chunk-54W6VAI3.js.map → chunk-NNPSBC7O.js.map} +1 -1
  39. package/dist/{chunk-MW42XVPD.js → chunk-PBSVX5DB.js} +15 -5
  40. package/dist/chunk-PBSVX5DB.js.map +1 -0
  41. package/dist/{chunk-2CL3FKEY.js → chunk-QEMXXQQO.js} +3 -3
  42. package/dist/{chunk-2CL3FKEY.js.map → chunk-QEMXXQQO.js.map} +1 -1
  43. package/dist/{chunk-6UIQJJNJ.js → chunk-QRNQQIQM.js} +5 -5
  44. package/dist/{chunk-6UIQJJNJ.js.map → chunk-QRNQQIQM.js.map} +1 -1
  45. package/dist/{chunk-N66NC6QK.js → chunk-RKCUXOU2.js} +4 -4
  46. package/dist/{chunk-N66NC6QK.js.map → chunk-RKCUXOU2.js.map} +1 -1
  47. package/dist/{chunk-N5M4PDBK.js → chunk-SBZJGFZ6.js} +3 -3
  48. package/dist/{chunk-N5M4PDBK.js.map → chunk-SBZJGFZ6.js.map} +1 -1
  49. package/dist/{chunk-7P32XCEU.js → chunk-SLUOF7XW.js} +2 -2
  50. package/dist/chunk-SLUOF7XW.js.map +1 -0
  51. package/dist/{chunk-SAXWCGWR.js → chunk-SOUDKESO.js} +14 -7
  52. package/dist/chunk-SOUDKESO.js.map +1 -0
  53. package/dist/{chunk-T44RW5DW.js → chunk-ULF5LOBS.js} +4 -4
  54. package/dist/{chunk-T44RW5DW.js.map → chunk-ULF5LOBS.js.map} +1 -1
  55. package/dist/components/ambient-background/index.js +9 -23
  56. package/dist/components/ambient-background/index.js.map +1 -1
  57. package/dist/components/ambient-background/starfield.d.ts.map +1 -1
  58. package/dist/components/app-shell/app-shell.d.ts +55 -10
  59. package/dist/components/app-shell/app-shell.d.ts.map +1 -1
  60. package/dist/components/app-shell/index.d.ts +1 -1
  61. package/dist/components/app-shell/index.d.ts.map +1 -1
  62. package/dist/components/app-shell/index.js +299 -38
  63. package/dist/components/app-shell/index.js.map +1 -1
  64. package/dist/components/autocomplete/index.js +4 -4
  65. package/dist/components/avatar/avatar.d.ts +1 -1
  66. package/dist/components/avatar/avatar.d.ts.map +1 -1
  67. package/dist/components/avatar/index.js +10 -1
  68. package/dist/components/avatar/index.js.map +1 -1
  69. package/dist/components/button-group/button-group.d.ts +10 -2
  70. package/dist/components/button-group/button-group.d.ts.map +1 -1
  71. package/dist/components/button-group/index.js +1 -1
  72. package/dist/components/button-multi-select/index.js +2 -2
  73. package/dist/components/button-select/button-select-control.d.ts +4 -1
  74. package/dist/components/button-select/button-select-control.d.ts.map +1 -1
  75. package/dist/components/button-select/button-select.d.ts +4 -1
  76. package/dist/components/button-select/button-select.d.ts.map +1 -1
  77. package/dist/components/button-select/index.js +2 -2
  78. package/dist/components/calendar-heatmap/index.js +2 -2
  79. package/dist/components/camera/index.js +6 -6
  80. package/dist/components/code-block/chrome.js +5 -5
  81. package/dist/components/code-block/index.js +6 -6
  82. package/dist/components/combobox/index.js +4 -4
  83. package/dist/components/combobox-list/index.js +6 -6
  84. package/dist/components/data-table/data-table-features.d.ts +8 -0
  85. package/dist/components/data-table/data-table-features.d.ts.map +1 -1
  86. package/dist/components/data-table/data-table-group.d.ts +128 -0
  87. package/dist/components/data-table/data-table-group.d.ts.map +1 -0
  88. package/dist/components/data-table/data-table-grouping.d.ts +72 -0
  89. package/dist/components/data-table/data-table-grouping.d.ts.map +1 -0
  90. package/dist/components/data-table/data-table-icons.d.ts +4 -2
  91. package/dist/components/data-table/data-table-icons.d.ts.map +1 -1
  92. package/dist/components/data-table/data-table-meta.d.ts +9 -0
  93. package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
  94. package/dist/components/data-table/data-table-pagination.d.ts +4 -1
  95. package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
  96. package/dist/components/data-table/data-table-schema.d.ts +4 -0
  97. package/dist/components/data-table/data-table-schema.d.ts.map +1 -1
  98. package/dist/components/data-table/data-table-stack.d.ts +16 -3
  99. package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
  100. package/dist/components/data-table/data-table-toolbar.d.ts +33 -2
  101. package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
  102. package/dist/components/data-table/data-table-translations.d.ts +35 -0
  103. package/dist/components/data-table/data-table-translations.d.ts.map +1 -1
  104. package/dist/components/data-table/data-table.d.ts +55 -3
  105. package/dist/components/data-table/data-table.d.ts.map +1 -1
  106. package/dist/components/data-table/index.d.ts +3 -1
  107. package/dist/components/data-table/index.d.ts.map +1 -1
  108. package/dist/components/data-table/index.js +878 -230
  109. package/dist/components/data-table/index.js.map +1 -1
  110. package/dist/components/date-picker/index.js +8 -8
  111. package/dist/components/drawer/index.js +4 -4
  112. package/dist/components/geodesic/a11y.d.ts +3 -3
  113. package/dist/components/geodesic/a11y.d.ts.map +1 -1
  114. package/dist/components/geodesic/badge-frame.d.ts +13 -1
  115. package/dist/components/geodesic/badge-frame.d.ts.map +1 -1
  116. package/dist/components/geodesic/exam-badge.d.ts +4 -1
  117. package/dist/components/geodesic/exam-badge.d.ts.map +1 -1
  118. package/dist/components/geodesic/geometry.d.ts +14 -9
  119. package/dist/components/geodesic/geometry.d.ts.map +1 -1
  120. package/dist/components/geodesic/index.js +62 -23
  121. package/dist/components/geodesic/index.js.map +1 -1
  122. package/dist/components/geodesic/status.d.ts +8 -6
  123. package/dist/components/geodesic/status.d.ts.map +1 -1
  124. package/dist/components/geodesic/styles.css +15 -2
  125. package/dist/components/hover-card/index.js +3 -3
  126. package/dist/components/indicator/index.js +23 -8
  127. package/dist/components/indicator/index.js.map +1 -1
  128. package/dist/components/indicator/indicator.d.ts +15 -6
  129. package/dist/components/indicator/indicator.d.ts.map +1 -1
  130. package/dist/components/kbd/index.js +3 -3
  131. package/dist/components/lightbox/index.js +4 -4
  132. package/dist/components/menu/index.js +4 -4
  133. package/dist/components/modal/index.js +4 -4
  134. package/dist/components/multi-combobox-list/index.js +6 -6
  135. package/dist/components/multi-select/index.js +4 -4
  136. package/dist/components/nav-link/index.js +5 -1
  137. package/dist/components/nav-link/nav-link.d.ts.map +1 -1
  138. package/dist/components/nav-link/tanstack.js +5 -1
  139. package/dist/components/nav-link/tanstack.js.map +1 -1
  140. package/dist/components/notification/create-notifier.d.ts.map +1 -1
  141. package/dist/components/notification/index.js +15 -3
  142. package/dist/components/notification/index.js.map +1 -1
  143. package/dist/components/notification/types.d.ts +5 -0
  144. package/dist/components/notification/types.d.ts.map +1 -1
  145. package/dist/components/number-input/index.js +4 -4
  146. package/dist/components/overlays/index.js +5 -5
  147. package/dist/components/photo-capture/index.js +6 -6
  148. package/dist/components/popover/index.js +3 -3
  149. package/dist/components/schedule/index.js +4 -4
  150. package/dist/components/segment-group/index.js +1 -1
  151. package/dist/components/segment-group/segment-group.d.ts +6 -1
  152. package/dist/components/segment-group/segment-group.d.ts.map +1 -1
  153. package/dist/components/select/index.js +5 -5
  154. package/dist/components/spotlight/index.js +8 -8
  155. package/dist/components/tabs/index.js +1 -1
  156. package/dist/components/tabs/tabs-data.d.ts +4 -1
  157. package/dist/components/tabs/tabs-data.d.ts.map +1 -1
  158. package/dist/components/tabs/tabs.d.ts +4 -1
  159. package/dist/components/tabs/tabs.d.ts.map +1 -1
  160. package/dist/components/tags-input/index.js +3 -3
  161. package/dist/components/time-input/index.js +6 -6
  162. package/dist/components/tooltip/index.js +2 -2
  163. package/dist/components/tree-multi-select/index.js +4 -4
  164. package/dist/components/tree-select/index.js +4 -4
  165. package/dist/index.js +2 -2
  166. package/dist/lib/overlay-container.d.ts.map +1 -1
  167. package/dist/lib/overlay-layer.d.ts +10 -3
  168. package/dist/lib/overlay-layer.d.ts.map +1 -1
  169. package/dist/lib/sidebar-rail.d.ts +21 -0
  170. package/dist/lib/sidebar-rail.d.ts.map +1 -0
  171. package/dist/theme.css +21 -18
  172. package/package.json +1 -1
  173. package/src/as-child.contract.test.tsx +6 -0
  174. package/src/components/ambient-background/starfield.tsx +14 -41
  175. package/src/components/app-shell/app-shell.test.tsx +430 -5
  176. package/src/components/app-shell/app-shell.tsx +484 -24
  177. package/src/components/app-shell/index.ts +2 -0
  178. package/src/components/avatar/avatar.test.tsx +12 -0
  179. package/src/components/avatar/avatar.tsx +9 -0
  180. package/src/components/button-group/button-group.test.tsx +24 -0
  181. package/src/components/button-group/button-group.tsx +21 -4
  182. package/src/components/button-multi-select/button-multi-select.test.tsx +15 -0
  183. package/src/components/button-select/button-select-control.tsx +5 -0
  184. package/src/components/button-select/button-select.test.tsx +25 -0
  185. package/src/components/button-select/button-select.tsx +13 -2
  186. package/src/components/data-table/data-table-features.ts +11 -0
  187. package/src/components/data-table/data-table-group.test.tsx +1007 -0
  188. package/src/components/data-table/data-table-group.tsx +474 -0
  189. package/src/components/data-table/data-table-grouping.ts +160 -0
  190. package/src/components/data-table/data-table-icons.tsx +8 -1
  191. package/src/components/data-table/data-table-meta.ts +9 -0
  192. package/src/components/data-table/data-table-pagination.tsx +5 -1
  193. package/src/components/data-table/data-table-stack.tsx +165 -43
  194. package/src/components/data-table/data-table-toolbar.tsx +110 -2
  195. package/src/components/data-table/data-table-translations.ts +44 -0
  196. package/src/components/data-table/data-table.tsx +420 -150
  197. package/src/components/data-table/index.ts +4 -0
  198. package/src/components/drawer/drawer.tsx +1 -1
  199. package/src/components/geodesic/badge-frame.tsx +67 -13
  200. package/src/components/geodesic/exam-badge.tsx +8 -4
  201. package/src/components/geodesic/geometry.ts +8 -6
  202. package/src/components/geodesic/status.test.ts +11 -2
  203. package/src/components/geodesic/status.ts +11 -7
  204. package/src/components/geodesic/styles.css +15 -2
  205. package/src/components/indicator/indicator.test.tsx +45 -0
  206. package/src/components/indicator/indicator.tsx +40 -13
  207. package/src/components/modal/modal.tsx +1 -1
  208. package/src/components/nav-link/nav-link.test.tsx +121 -1
  209. package/src/components/nav-link/nav-link.tsx +78 -29
  210. package/src/components/notification/create-notifier.tsx +18 -2
  211. package/src/components/notification/notify-in-modal.test.tsx +128 -0
  212. package/src/components/notification/types.ts +5 -0
  213. package/src/components/segment-group/segment-group.test.tsx +22 -0
  214. package/src/components/segment-group/segment-group.tsx +35 -19
  215. package/src/components/tabs/tabs-data.tsx +5 -1
  216. package/src/components/tabs/tabs.test.tsx +28 -0
  217. package/src/components/tabs/tabs.tsx +14 -4
  218. package/src/lib/overlay-container.tsx +2 -1
  219. package/src/lib/overlay-layer.test.tsx +63 -1
  220. package/src/lib/overlay-layer.tsx +29 -6
  221. package/src/lib/sidebar-rail.ts +24 -0
  222. package/src/theme.css +21 -18
  223. package/src/theme.test.ts +14 -11
  224. package/dist/chunk-7HZBD4YZ.js.map +0 -1
  225. package/dist/chunk-7P32XCEU.js.map +0 -1
  226. package/dist/chunk-AHKMN3YQ.js.map +0 -1
  227. package/dist/chunk-H7WOMZXO.js.map +0 -1
  228. package/dist/chunk-HRNWWL3Y.js.map +0 -1
  229. package/dist/chunk-LMCUGYHT.js.map +0 -1
  230. package/dist/chunk-MW42XVPD.js.map +0 -1
  231. package/dist/chunk-SAXWCGWR.js.map +0 -1
  232. package/dist/chunk-XUFCI262.js.map +0 -1
@@ -1,7 +1,8 @@
1
- import { fireEvent, render, screen } from "@testing-library/react"
1
+ import { fireEvent, render, screen, waitFor } from "@testing-library/react"
2
2
  import type { ReactNode } from "react"
3
3
  import { describe, expect, it, vi } from "vitest"
4
4
  import { LinkComponentProvider } from "../../lib/link-component"
5
+ import { SidebarRailContext } from "../../lib/sidebar-rail"
5
6
  import { NavLink } from "./nav-link"
6
7
 
7
8
  const StubLink = ({
@@ -164,3 +165,122 @@ describe("NavLink translations", () => {
164
165
  )
165
166
  })
166
167
  })
168
+
169
+ describe("NavLink in a sidebar icon rail", () => {
170
+ const Row = () => (
171
+ <NavLink
172
+ label="Dashboard"
173
+ startSlot={<svg data-icon />}
174
+ endSlot={<b>3</b>}
175
+ linkOptions={{ href: "/d" }}
176
+ >
177
+ <NavLink label="Child" linkOptions={{ href: "/c" }} />
178
+ </NavLink>
179
+ )
180
+
181
+ it("renders no tooltip machinery outside a rail-capable sidebar", () => {
182
+ render(<Row />)
183
+ // endSlot's text ("3") is part of the row's name.
184
+ const link = screen.getByRole("link", { name: /^Dashboard/ })
185
+ expect(link.getAttribute("data-scope")).toBeNull()
186
+ })
187
+
188
+ it("keeps the label as the accessible name, hides the rest behind the rail variant", () => {
189
+ render(
190
+ <SidebarRailContext.Provider value={{ active: true }}>
191
+ <Row />
192
+ </SidebarRailContext.Provider>,
193
+ )
194
+ const link = screen.getByRole("link", { name: /^Dashboard/ })
195
+ expect(link.getAttribute("data-scope")).toBe("tooltip")
196
+ expect(screen.getByText("Dashboard").className).toContain("sidebar-rail:sr-only")
197
+ expect(screen.getByText("3").parentElement?.className).toContain("sidebar-rail:hidden")
198
+ expect(screen.getByRole("button", { name: "Expand" }).className).toContain(
199
+ "sidebar-rail:hidden",
200
+ )
201
+ })
202
+
203
+ it("folds nested rows shut on an active rail, keeping the row's own open state", () => {
204
+ const { rerender } = render(
205
+ <SidebarRailContext.Provider value={{ active: true }}>
206
+ <NavLink label="Projects" startSlot={<svg />} linkOptions={{ href: "/p" }} defaultOpen>
207
+ <NavLink label="Libft" linkOptions={{ href: "/p/libft" }} />
208
+ </NavLink>
209
+ </SidebarRailContext.Provider>,
210
+ )
211
+ // Animated shut (grid rows to 0fr) and inert, rather than display: none.
212
+ const folded = screen.getByText("Libft").closest("div.grid") as HTMLElement
213
+ expect(folded.getAttribute("data-state")).toBe("closed")
214
+ expect(folded.className).toContain("grid-rows-[0fr]")
215
+ expect(folded.className).not.toContain("sidebar-rail:hidden")
216
+ // Out of the tab order while folded (jsdom's role queries ignore inert).
217
+ expect(screen.getByRole("link", { name: "Libft" }).closest("[inert]")).not.toBeNull()
218
+
219
+ rerender(
220
+ <SidebarRailContext.Provider value={{ active: false }}>
221
+ <NavLink label="Projects" startSlot={<svg />} linkOptions={{ href: "/p" }} defaultOpen>
222
+ <NavLink label="Libft" linkOptions={{ href: "/p/libft" }} />
223
+ </NavLink>
224
+ </SidebarRailContext.Provider>,
225
+ )
226
+ expect(folded.getAttribute("data-state")).toBe("open")
227
+ expect(screen.getByRole("link", { name: "Libft" }).closest("[inert]")).toBeNull()
228
+ })
229
+
230
+ it("shows the label as a tooltip on focus while the rail is active", async () => {
231
+ render(
232
+ <SidebarRailContext.Provider value={{ active: true }}>
233
+ <NavLink label="Dashboard" startSlot={<svg />} linkOptions={{ href: "/d" }} />
234
+ </SidebarRailContext.Provider>,
235
+ )
236
+ // zag opens a tooltip on *keyboard* focus only: Tab first.
237
+ fireEvent.keyDown(document.body, { key: "Tab" })
238
+ fireEvent.focus(screen.getByRole("link", { name: "Dashboard" }))
239
+ expect((await screen.findByRole("tooltip")).textContent).toBe("Dashboard")
240
+ })
241
+
242
+ it("keeps its expanded geometry on a rail, so icons don't move as it opens", () => {
243
+ render(
244
+ <SidebarRailContext.Provider value={{ active: true }}>
245
+ <NavLink label="Dashboard" startSlot={<svg />} linkOptions={{ href: "/d" }} />
246
+ </SidebarRailContext.Provider>,
247
+ )
248
+ // The rail is sized to the row (see AppShell's RAIL_WIDTH): only the label
249
+ // hides, nothing re-lays out the row itself.
250
+ const row = screen.getByRole("link", { name: "Dashboard" })
251
+ expect(row.className).not.toMatch(/sidebar-rail:(p|px|size|justify)/)
252
+ })
253
+
254
+ it("never lets the start slot shrink, so an icon can't squish in a narrow row", () => {
255
+ render(<NavLink label="Dashboard" startSlot={<svg data-icon />} linkOptions={{ href: "/d" }} />)
256
+ const icon = document.querySelector("[data-icon]") as Element
257
+ expect(icon.parentElement?.className).toContain("shrink-0")
258
+ })
259
+
260
+ it("closes an open tooltip as soon as the rail opens", async () => {
261
+ const Rail = ({ active }: { active: boolean }) => (
262
+ <SidebarRailContext.Provider value={{ active }}>
263
+ <NavLink label="Dashboard" startSlot={<svg />} linkOptions={{ href: "/d" }} />
264
+ </SidebarRailContext.Provider>
265
+ )
266
+ const { rerender } = render(<Rail active />)
267
+ fireEvent.keyDown(document.body, { key: "Tab" })
268
+ fireEvent.focus(screen.getByRole("link", { name: "Dashboard" }))
269
+ expect(await screen.findByRole("tooltip")).toBeTruthy()
270
+
271
+ rerender(<Rail active={false} />)
272
+ await waitFor(() => expect(screen.queryByRole("tooltip")).toBeNull())
273
+ })
274
+
275
+ it("keeps the tooltip off once the labels are back", async () => {
276
+ render(
277
+ <SidebarRailContext.Provider value={{ active: false }}>
278
+ <NavLink label="Dashboard" startSlot={<svg />} linkOptions={{ href: "/d" }} />
279
+ </SidebarRailContext.Provider>,
280
+ )
281
+ fireEvent.keyDown(document.body, { key: "Tab" })
282
+ fireEvent.focus(screen.getByRole("link", { name: "Dashboard" }))
283
+ await new Promise((resolve) => setTimeout(resolve, 50))
284
+ expect(screen.queryByRole("tooltip")).toBeNull()
285
+ })
286
+ })
@@ -1,16 +1,18 @@
1
1
  "use client"
2
2
 
3
3
  import { cva } from "class-variance-authority"
4
- import { type ElementType, type ReactNode, useId } from "react"
4
+ import { type ElementType, type ReactNode, useId, useState } from "react"
5
5
  import { cn } from "../../lib/cn"
6
6
  import { focusStyles } from "../../lib/focus-styles"
7
7
  import { useLinkComponent } from "../../lib/link-component"
8
8
  import { props } from "../../lib/props"
9
+ import { useSidebarRail } from "../../lib/sidebar-rail"
9
10
  import type { WithTestId } from "../../lib/test-id"
10
11
  import { TEXT_COLOR_CLASSES } from "../../lib/typography-size"
11
12
  import { useUncontrolled } from "../../lib/use-uncontrolled"
12
13
  import { Collapse } from "../collapse/collapse"
13
14
  import { ChevronIcon } from "../popover/icons"
15
+ import { Tooltip } from "../tooltip/tooltip"
14
16
 
15
17
  /**
16
18
  * NavLink — a single sidebar/nav row: leading `startSlot`, `label`, trailing
@@ -37,6 +39,12 @@ import { ChevronIcon } from "../popover/icons"
37
39
  * `linkComponent` — a router's `Link` would put the `href` straight back.
38
40
  *
39
41
  * <NavLink label="Dashboard" startSlot={<Home />} linkOptions={{ href: "/dashboard" }} />
42
+ * In a sidebar collapsed to an icon rail (`AppShell.Sidebar collapse="icons"`)
43
+ * the row shows `startSlot` alone: the label stays as the accessible name
44
+ * (visually hidden) and shows as a tooltip on hover and focus; `endSlot` and
45
+ * the chevron are hidden, and nested children fold shut (animated, and inert)
46
+ * until the sidebar is expanded or peeking. Give such rows a `startSlot` — a rail row without one is empty.
47
+ *
40
48
  * <NavLink label="Settings" startSlot={<Settings />} defaultOpen>
41
49
  * <NavLink label="Profile" linkOptions={{ href: "/settings/profile" }} />
42
50
  * <NavLink label="Security" linkOptions={{ href: "/settings/security" }} />
@@ -46,6 +54,10 @@ import { ChevronIcon } from "../popover/icons"
46
54
  const navLinkRow = cva(
47
55
  [
48
56
  "flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2.5 py-2 text-start text-sm",
57
+ // The row's expanded height, held on an icon rail too, where the label is
58
+ // visually hidden and would otherwise take its line height with it — the
59
+ // rows would grow 4px each as the rail opens.
60
+ "min-h-9",
49
61
  "outline-none transition-colors",
50
62
  "hover:bg-black/5 dark:hover:bg-white/8",
51
63
  focusStyles(),
@@ -63,7 +75,7 @@ const navLinkRow = cva(
63
75
  )
64
76
 
65
77
  const chevronButton = cn(
66
- "flex shrink-0 cursor-pointer items-center justify-center rounded-md p-2 text-black/50 transition-colors",
78
+ "flex shrink-0 sidebar-rail:hidden cursor-pointer items-center justify-center rounded-md p-2 text-black/50 transition-colors",
67
79
  "hover:bg-black/5 dark:text-white/50 dark:hover:bg-white/8",
68
80
  focusStyles(),
69
81
  )
@@ -72,7 +84,7 @@ const chevron = (open: boolean) => (
72
84
  <span
73
85
  aria-hidden="true"
74
86
  data-state={open ? "open" : "closed"}
75
- className="ms-auto flex shrink-0 transition-transform data-[state=open]:rotate-180 [&_svg]:size-4"
87
+ className="ms-auto flex shrink-0 transition-transform sidebar-rail:hidden data-[state=open]:rotate-180 [&_svg]:size-4"
76
88
  >
77
89
  <ChevronIcon />
78
90
  </span>
@@ -152,12 +164,20 @@ function NavLinkImpl({
152
164
  const isLink = linkOptions != null
153
165
  const Comp = useLinkComponent(linkComponent) ?? "a"
154
166
  const itemsId = `nav-link-items-${useId()}`
167
+ const rail = useSidebarRail()
168
+ // Controlled, so the bubble closes the moment the rail opens: Ark's
169
+ // `disabled` only stops a closed tooltip from opening, it doesn't shut one.
170
+ const [tipOpen, setTipOpen] = useState(false)
155
171
 
156
172
  const content = (
157
173
  <>
158
- {startSlot}
159
- <span className="min-w-0 flex-1 truncate">{label}</span>
160
- {endSlot}
174
+ {/* Never shrinks: only the label gives way when the row is narrow. A
175
+ bare SVG icon is a flex item that would otherwise squeeze — and scale
176
+ its drawing down — as an icon rail widens with the label already
177
+ showing, visibly squishing the icon for a frame or two. */}
178
+ {startSlot != null && <span className="flex shrink-0">{startSlot}</span>}
179
+ <span className="min-w-0 flex-1 truncate sidebar-rail:sr-only">{label}</span>
180
+ {endSlot != null && <span className="contents sidebar-rail:hidden">{endSlot}</span>}
161
181
  </>
162
182
  )
163
183
 
@@ -168,32 +188,56 @@ function NavLinkImpl({
168
188
  "data-testid": testId,
169
189
  })
170
190
 
191
+ const row =
192
+ isLink && disabled ? (
193
+ // No `href`, so no tab stop and nothing for Enter to follow; the
194
+ // explicit role keeps it announced as a (disabled) link.
195
+ <a role="link" {...rowState} className={rowClassName}>
196
+ {content}
197
+ </a>
198
+ ) : isLink ? (
199
+ <Comp {...linkOptions} {...rowState} className={rowClassName}>
200
+ {content}
201
+ </Comp>
202
+ ) : (
203
+ <button
204
+ type="button"
205
+ {...rowState}
206
+ aria-expanded={hasChildren ? isOpen : undefined}
207
+ {...props({ "aria-controls": hasChildren && itemsId })}
208
+ disabled={disabled}
209
+ onClick={() => hasChildren && setOpen(!isOpen)}
210
+ className={rowClassName}
211
+ >
212
+ {content}
213
+ {hasChildren && chevron(isOpen)}
214
+ </button>
215
+ )
216
+
171
217
  return (
172
218
  <div>
173
219
  <div className="flex items-stretch gap-1">
174
- {isLink && disabled ? (
175
- // No `href`, so no tab stop and nothing for Enter to follow; the
176
- // explicit role keeps it announced as a (disabled) link.
177
- <a role="link" {...rowState} className={rowClassName}>
178
- {content}
179
- </a>
180
- ) : isLink ? (
181
- <Comp {...linkOptions} {...rowState} className={rowClassName}>
182
- {content}
183
- </Comp>
184
- ) : (
185
- <button
186
- type="button"
187
- {...rowState}
188
- aria-expanded={hasChildren ? isOpen : undefined}
189
- {...props({ "aria-controls": hasChildren && itemsId })}
190
- disabled={disabled}
191
- onClick={() => hasChildren && setOpen(!isOpen)}
192
- className={rowClassName}
220
+ {rail ? (
221
+ // Only inside a rail-capable sidebar, so a plain NavLink pays for
222
+ // no tooltip machine. Disabled (not unmounted) while the labels
223
+ // show, so expanding never remounts the row under focus.
224
+ <Tooltip
225
+ label={label}
226
+ position="end"
227
+ asChild
228
+ disabled={!rail.active}
229
+ open={tipOpen && rail.active}
230
+ onOpenChange={({ open }) => setTipOpen(open)}
231
+ openDelay={200}
232
+ // Gone at once when the rail opens, rather than fading out over
233
+ // the label that's appearing beneath it. Important: it ties with
234
+ // the bubble's own data-[state=closed] exit animation otherwise.
235
+ classNames={{ content: rail.active ? undefined : "data-[state=closed]:animate-none!" }}
193
236
  >
194
- {content}
195
- {hasChildren && chevron(isOpen)}
196
- </button>
237
+ {row}
238
+ </Tooltip>
239
+ ) : (
240
+ row
197
241
  )}
198
242
  {hasChildren && isLink && (
199
243
  <button
@@ -213,7 +257,12 @@ function NavLinkImpl({
213
257
  )}
214
258
  </div>
215
259
  {hasChildren && (
216
- <Collapse open={isOpen}>
260
+ // Nested rows have no place on a rail, so they fold shut there — the
261
+ // same Collapse animation, not `display: none`, so they slide open as
262
+ // the rail peeks (and shut as it closes) instead of snapping, and stay
263
+ // inert while folded. `isOpen` itself is untouched: the row's own
264
+ // open state comes back with the labels.
265
+ <Collapse open={isOpen && !rail?.active}>
217
266
  <div
218
267
  id={itemsId}
219
268
  className={cn(
@@ -17,6 +17,7 @@ import type { UnavailableProps } from "../../lib/available-if"
17
17
  import { cn } from "../../lib/cn"
18
18
  import type { Color } from "../../lib/colors"
19
19
  import { useMergedRefs } from "../../lib/merge-refs"
20
+ import { isModalOpen } from "../../lib/overlay-layer"
20
21
  import { useDocumentVisibility } from "../../lib/use-document-visibility"
21
22
  import {
22
23
  NOTIFICATION_DEFAULT_TRANSLATIONS,
@@ -266,7 +267,8 @@ function ToasterItem({
266
267
  const { id } = toast
267
268
  // The store keeps `type` and `color` side by side; the card takes one or the
268
269
  // other. At most one is ever set (see `toData`), so pick whichever is.
269
- const { type, color, ...fields } = toast
270
+ // `raised` is the region's business, not the card's.
271
+ const { type, color, raised: _raised, ...fields } = toast
270
272
  const hue: ToastHue = type ? { type } : { color }
271
273
 
272
274
  const presence = usePresence({
@@ -392,6 +394,11 @@ export function createNotifier(options: CreateNotifierOptions = {}): Notifier {
392
394
  icon: o.icon,
393
395
  duration: o.duration ?? (type === "loading" ? Number.POSITIVE_INFINITY : defaultDuration),
394
396
  withCloseButton: o.withCloseButton ?? true,
397
+ // A toast is feedback on what the user just did, so if they did it in a
398
+ // modal it must show over the modal. Only ever set, never cleared: the
399
+ // store merges a re-create by id, so a promise settling after the modal
400
+ // closed keeps its place. See `--toast-raised-z` in theme.css.
401
+ ...(isModalOpen() && { raised: true }),
395
402
  }
396
403
  }
397
404
 
@@ -527,17 +534,26 @@ export function createNotifier(options: CreateNotifierOptions = {}): Notifier {
527
534
  const maxHeight = toasts.reduce((max, toast) => Math.max(max, heightOf(toast)), 0)
528
535
  const stackOverflow = placement.startsWith("bottom") ? Math.max(0, maxHeight - frontHeight) : 0
529
536
 
537
+ const raised = toasts.some((toast) => toast.raised)
538
+
530
539
  const region = (
531
540
  <section
532
541
  aria-label={translations.regionLabel}
533
542
  data-scope="notifications"
534
543
  data-placement={placement}
535
544
  data-expand={expand ? "" : undefined}
545
+ data-raised={raised ? "" : undefined}
546
+ // zag's modal dialog aria-hides everything outside it, which would
547
+ // silence a toast raised from inside it. It skips live announcers.
548
+ data-live-announcer=""
536
549
  // Slide direction for the enter/exit keyframes: from below for bottom
537
550
  // placements, from above for top.
538
551
  style={{ ["--toast-from" as string]: placement.startsWith("top") ? "-100%" : "100%" }}
539
552
  className={cn(
540
- "pointer-events-none fixed z-(--toast-z,100) justify-center flex",
553
+ "pointer-events-none fixed justify-center flex",
554
+ // Under modals by default; above them while it holds a toast created
555
+ // from inside one (theme.css, OVERLAY STACKING).
556
+ raised ? "z-(--toast-raised-z,200)" : "z-(--toast-z,100)",
541
557
  REGION_POSITION[placement],
542
558
  // Phones (< xs): pin to the bottom, full-bleed, above the safe area.
543
559
  "max-xs:inset-x-0! max-xs:bottom-[calc(1rem+env(safe-area-inset-bottom))]! max-xs:top-auto! max-xs:translate-x-0!",
@@ -0,0 +1,128 @@
1
+ /** biome-ignore-all lint/style/noNonNullAssertion: a missing node fails the test anyway */
2
+
3
+ import { act, render, screen } from "@testing-library/react"
4
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"
5
+ import { Drawer } from "../drawer/drawer"
6
+ import { Modal } from "../modal/modal"
7
+ import { createNotifier } from "./create-notifier"
8
+
9
+ /**
10
+ * #440: a toast created from inside a modal is feedback on what was done in
11
+ * it, so it has to reach the user over the modal: painted above it, announced,
12
+ * and dismissable without taking the modal along. Toasts that were on screen
13
+ * before the modal opened stay under it.
14
+ *
15
+ * Fake timers for the same reason as `lib/overlay-layer.test.tsx`: zag arms its
16
+ * outside listeners (and its aria-hiding) a few frames after the layer mounts.
17
+ */
18
+ beforeEach(() => {
19
+ vi.useFakeTimers({
20
+ toFake: [
21
+ "setTimeout",
22
+ "clearTimeout",
23
+ "requestAnimationFrame",
24
+ "cancelAnimationFrame",
25
+ "performance",
26
+ ],
27
+ })
28
+ })
29
+ afterEach(() => {
30
+ vi.useRealTimers()
31
+ })
32
+
33
+ const settle = () => act(() => vi.advanceTimersByTimeAsync(150))
34
+
35
+ const region = () => document.querySelector<HTMLElement>('[data-scope="notifications"]')!
36
+
37
+ const setup = (Surface: "modal" | "drawer" = "modal") => {
38
+ const { notify, Notifications } = createNotifier({ duration: Number.POSITIVE_INFINITY })
39
+ const onOpenChange = vi.fn()
40
+ const view = (open: boolean) =>
41
+ Surface === "modal" ? (
42
+ <>
43
+ <Modal open={open} onOpenChange={onOpenChange} title="Edit slot">
44
+ body
45
+ </Modal>
46
+ <Notifications />
47
+ </>
48
+ ) : (
49
+ <>
50
+ <Drawer open={open} onOpenChange={onOpenChange} title="Edit slot">
51
+ body
52
+ </Drawer>
53
+ <Notifications />
54
+ </>
55
+ )
56
+ const utils = render(view(false))
57
+ return {
58
+ notify,
59
+ open: async () => {
60
+ utils.rerender(view(true))
61
+ await settle()
62
+ },
63
+ close: async () => {
64
+ utils.rerender(view(false))
65
+ await settle()
66
+ },
67
+ }
68
+ }
69
+
70
+ describe("notify while a modal is open", () => {
71
+ it("leaves the region in its own band with no modal open", async () => {
72
+ const { notify } = setup()
73
+ act(() => void notify.error("Failed"))
74
+ await settle()
75
+ expect(region().hasAttribute("data-raised")).toBe(false)
76
+ })
77
+
78
+ it.each(["modal", "drawer"] as const)("raises a toast created from a %s", async (surface) => {
79
+ const { notify, open } = setup(surface)
80
+ await open()
81
+ act(() => void notify.error("Failed"))
82
+ await settle()
83
+ expect(region().hasAttribute("data-raised")).toBe(true)
84
+ })
85
+
86
+ it("leaves a toast that was already on screen under the modal", async () => {
87
+ const { notify, open } = setup()
88
+ act(() => void notify.success("Saved earlier"))
89
+ await open()
90
+ await settle()
91
+ expect(region().hasAttribute("data-raised")).toBe(false)
92
+ })
93
+
94
+ it("keeps a raised toast raised after the modal closes", async () => {
95
+ const { notify, open, close } = setup()
96
+ await open()
97
+ act(() => void notify.error("Failed"))
98
+ await close()
99
+ expect(region().hasAttribute("data-raised")).toBe(true)
100
+ })
101
+
102
+ it("keeps the raise when a promise toast settles after the modal closed", async () => {
103
+ const { notify, open, close } = setup()
104
+ await open()
105
+ let reject!: (reason: unknown) => void
106
+ act(() => {
107
+ notify.promise(new Promise((_, r) => (reject = r)), { loading: "Saving…", error: "Failed" })
108
+ })
109
+ await close()
110
+ await act(async () => reject(new Error("409")))
111
+ await settle()
112
+ expect(screen.getByText("Failed")).toBeTruthy()
113
+ expect(region().hasAttribute("data-raised")).toBe(true)
114
+ })
115
+
116
+ it("is not aria-hidden by the modal, so the error is announced", async () => {
117
+ const { notify, open } = setup()
118
+ await open()
119
+ act(() => void notify.error("Failed"))
120
+ await settle()
121
+ expect(region().closest("[aria-hidden='true']")).toBeNull()
122
+ expect(screen.getByRole("alert").textContent).toContain("Failed")
123
+ })
124
+
125
+ // A press on a toast not dismissing the modal is tested against the guard
126
+ // itself in `lib/overlay-layer.test.tsx`: jsdom doesn't reproduce zag's
127
+ // outside dismissal from a press on a portaled sibling reliably.
128
+ })
@@ -64,4 +64,9 @@ export type ToastFields = {
64
64
  /** Render the close (×) button. Takes precedence over `withCollapse` (on the
65
65
  * ready-made `Notification`). */
66
66
  withCloseButton?: boolean
67
+ /** Created while a Modal, Drawer or Lightbox was open: the region paints
68
+ * above modals (`--toast-raised-z`) while this toast is on screen. Set by the
69
+ * notifier, never by the caller, and kept once set, so a toast that was
70
+ * above a modal never drops under it mid-life. */
71
+ raised?: boolean
67
72
  }
@@ -214,4 +214,26 @@ describe("SegmentGroup separators under RTL", () => {
214
214
  const pill = container.querySelector('[data-part="indicator"]') as HTMLElement
215
215
  expect(pill.className).not.toMatch(/(^|\s)z-0(\s|$)/)
216
216
  })
217
+
218
+ it("spans the container with an even share per segment under `grow`", () => {
219
+ render(<SegmentGroup data={ITEMS} testId="g" grow />)
220
+ const tray = screen.getByTestId("g")
221
+ expect(tray.className).toMatch(/(^|\s)w-full(\s|$)/)
222
+ expect(tray.className).not.toContain("max-w-fit")
223
+ const item = screen.getByTestId("item-list")
224
+ expect(item.className).toMatch(/(^|\s)flex-1(\s|$)/)
225
+ const text = item.querySelector('[data-part="item-text"]') as HTMLElement
226
+ expect(text.className).toMatch(/(^|\s)w-full(\s|$)/)
227
+ })
228
+
229
+ it("hugs its labels without `grow`", () => {
230
+ render(<SegmentGroup data={ITEMS} testId="g" />)
231
+ const tray = screen.getByTestId("g")
232
+ expect(tray.className).toContain("max-w-fit")
233
+ expect(tray.className).not.toMatch(/(^|\s)w-full(\s|$)/)
234
+ const item = screen.getByTestId("item-list")
235
+ expect(item.className).not.toMatch(/(^|\s)flex-1(\s|$)/)
236
+ const text = item.querySelector('[data-part="item-text"]') as HTMLElement
237
+ expect(text.className).not.toMatch(/(^|\s)w-full(\s|$)/)
238
+ })
217
239
  })
@@ -103,6 +103,8 @@ const segItem = cva(
103
103
  lg: "flex items-center justify-center px-3 text-lg",
104
104
  xl: "flex items-center justify-center px-4 text-xl",
105
105
  },
106
+ // Fill the (grown) segment so the label centers across its whole share.
107
+ grow: { true: "w-full" },
106
108
  },
107
109
  defaultVariants: { variant: "default", size: "md" },
108
110
  },
@@ -117,22 +119,30 @@ const segItem = cva(
117
119
  * `:nth-child(2)`). It flips from a vertical rule to a horizontal one when the
118
120
  * group is laid out vertically.
119
121
  */
120
- const segItemWrap = cva([
121
- "relative z-1 inline-flex",
122
- "before:absolute before:rounded-full before:bg-brand-900/30 dark:before:bg-white/35",
123
- "group-data-invalid:before:bg-red-500/30",
124
- "before:transition-opacity before:duration-200",
125
- // Horizontal: a vertical rule centered on the leading edge, sitting in the gap. Logical
126
- // (`start`, `-ms-[0.5px]` to center the 1px rule), so under `dir="rtl"` the rule still lands
127
- // between a segment and the one before it instead of on the far side.
128
- "before:top-1/2 before:start-0 before:-ms-[0.5px] before:h-1/2 before:w-px before:-translate-y-1/2",
129
- // Vertical: a horizontal rule centered on the top edge instead (`start-1/4` + `w-1/2` is
130
- // centered in either direction).
131
- "in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:start-1/4 in-data-[orientation=vertical]:before:ms-0 in-data-[orientation=vertical]:before:h-px in-data-[orientation=vertical]:before:w-1/2",
132
- // No separator before the first segment, or flanking the active pill.
133
- "nth-2:before:hidden",
134
- "data-[state=checked]:before:opacity-0 data-[state=checked]:[&+*]:before:opacity-0",
135
- ])
122
+ const segItemWrap = cva(
123
+ [
124
+ "relative z-1 inline-flex",
125
+ "before:absolute before:rounded-full before:bg-brand-900/30 dark:before:bg-white/35",
126
+ "group-data-invalid:before:bg-red-500/30",
127
+ "before:transition-opacity before:duration-200",
128
+ // Horizontal: a vertical rule centered on the leading edge, sitting in the gap. Logical
129
+ // (`start`, `-ms-[0.5px]` to center the 1px rule), so under `dir="rtl"` the rule still lands
130
+ // between a segment and the one before it instead of on the far side.
131
+ "before:top-1/2 before:start-0 before:-ms-[0.5px] before:h-1/2 before:w-px before:-translate-y-1/2",
132
+ // Vertical: a horizontal rule centered on the top edge instead (`start-1/4` + `w-1/2` is
133
+ // centered in either direction).
134
+ "in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:start-1/4 in-data-[orientation=vertical]:before:ms-0 in-data-[orientation=vertical]:before:h-px in-data-[orientation=vertical]:before:w-1/2",
135
+ // No separator before the first segment, or flanking the active pill.
136
+ "nth-2:before:hidden",
137
+ "data-[state=checked]:before:opacity-0 data-[state=checked]:[&+*]:before:opacity-0",
138
+ ],
139
+ {
140
+ variants: {
141
+ // An even share of the tray per segment, like a tab bar.
142
+ grow: { true: "flex-1" },
143
+ },
144
+ },
145
+ )
136
146
 
137
147
  /**
138
148
  * The sliding pill, mirroring each `Button` surface. Its slide + color transition
@@ -213,6 +223,8 @@ const segTray = cva(
213
223
  lg: "gap-0 min-h-10",
214
224
  xl: "gap-0 min-h-12",
215
225
  },
226
+ // Span the container instead of hugging the labels.
227
+ grow: { true: "flex w-full max-w-none" },
216
228
  },
217
229
  defaultVariants: { variant: "default" },
218
230
  },
@@ -331,6 +343,9 @@ export type SegmentGroupProps<Data extends SegmentGroupData = SegmentGroupData>
331
343
  size?: SegmentGroupSize
332
344
  variant?: SegmentGroupVariant
333
345
  color?: Color
346
+ /** Span the container and give every segment an even share of it, like a
347
+ * tab bar. Without it the group hugs its labels. */
348
+ grow?: boolean
334
349
  /** Wires the hidden radio inputs into native form submission. */
335
350
  name?: string
336
351
  /** Explicit id for label association. */
@@ -453,6 +468,7 @@ export const SegmentGroup = <const Data extends SegmentGroupData = SegmentGroupD
453
468
  size = "md",
454
469
  variant = "default",
455
470
  color,
471
+ grow,
456
472
  name,
457
473
  id,
458
474
  ref,
@@ -513,7 +529,7 @@ export const SegmentGroup = <const Data extends SegmentGroupData = SegmentGroupD
513
529
  onBlur={onBlur}
514
530
  color={color}
515
531
  testId={testId}
516
- className={cn(segTray({ variant, size }), className, classNames?.root)}
532
+ className={cn(segTray({ variant, size, grow }), className, classNames?.root)}
517
533
  >
518
534
  {/* The sliding pill. Ark sets `position: absolute` + `--left`/`--top`/
519
535
  `--width`/`--height` (the selected segment's rect) inline, so it
@@ -552,11 +568,11 @@ export const SegmentGroup = <const Data extends SegmentGroupData = SegmentGroupD
552
568
  value={item.value}
553
569
  disabled={item.disabled}
554
570
  data-testid={item.testId}
555
- className={cn(segItemWrap(), classNames?.item)}
571
+ className={cn(segItemWrap({ grow }), classNames?.item)}
556
572
  >
557
573
  <Ark.ItemText
558
574
  data-color={item.color}
559
- className={cn(segItem({ size, variant }), classNames?.itemText)}
575
+ className={cn(segItem({ size, variant, grow }), classNames?.itemText)}
560
576
  >
561
577
  {/* `renderItem` owns the label content (with the item's typed payload);
562
578
  the ItemText keeps its sizing, checked color, and pill wiring. */}