@ngrok/mantle 0.82.0 → 0.82.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1 -1
- package/dist/alert-center.d.ts +217 -19
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.js +1 -1
- package/dist/{alert-QMs0PqMq.js → alert-vwFd7qdp.js} +1 -1
- package/dist/alert.js +1 -1
- package/dist/{anchor-DvbNsphX.js → anchor-3OGK2UKU.js} +1 -1
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +296 -213
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/{button-BUospUB3.js → button-Cnja9Bsr.js} +1 -1
- package/dist/{button-BO2CKsz6.js → button-DmJkYfyl.js} +1 -1
- package/dist/{button-C0S8RbaJ.js → button-IlxHhjPK.js} +1 -1
- package/dist/button.js +1 -1
- package/dist/card.js +1 -1
- package/dist/centered-layout.js +1 -1
- package/dist/{chart-DdBQ3xwx.js → chart-B3pAvmkk.js} +1 -1
- package/dist/{choice-C9gLKECf.js → choice-CnwfjSEu.js} +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-block.js +1 -1
- package/dist/code.js +1 -1
- package/dist/combobox.js +1 -1
- package/dist/command.js +1 -1
- package/dist/cookie-ca4g5CKp.js +1 -0
- package/dist/data-table.js +1 -1
- package/dist/description-list.js +1 -1
- package/dist/{dialog-Bsj_dX6r.js → dialog-DozL6n-F.js} +1 -1
- package/dist/dialog.js +1 -1
- package/dist/{dropdown-menu-fUMqjRC0.js → dropdown-menu-BRH0Wd_z.js} +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.js +1 -1
- package/dist/field.d.ts +1 -1
- package/dist/field.js +1 -1
- package/dist/{icons-CPbOq7cF.js → icons-Bb_zF2OV.js} +1 -1
- package/dist/icons.js +1 -1
- package/dist/line-chart.js +1 -1
- package/dist/{list-CQFWx6Z8.js → list-CJABVHwi.js} +1 -1
- package/dist/list.js +1 -1
- package/dist/llms.txt +1 -1
- package/dist/main.d.ts +32 -1
- package/dist/media-object.js +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.js +1 -1
- package/dist/pagination.js +1 -1
- package/dist/platform-BVD3gpKD.js +1 -0
- package/dist/{primitive-Dv-3snU3.js → primitive-D-9GIFWb.js} +1 -1
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-B-9yWrif.js → select-BReznXaw.js} +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-BepAcFFy.js → separator-D0D6VyyM.js} +1 -1
- package/dist/separator.js +1 -1
- package/dist/{sheet-_fXLjiq2.js → sheet-BxvTfPLM.js} +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +534 -60
- package/dist/sidebar.js +1 -1
- package/dist/{skeleton-DsHXIa9j.js → skeleton-BhcJMpem.js} +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slot-DdgxmuI5.d.ts +67 -0
- package/dist/slot-DpNWVci8.js +1 -0
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button.js +1 -1
- package/dist/theme-BorfgnNh.js +1 -0
- package/dist/theme-switcher.d.ts +1 -1
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/tooltip-Dnu35cjU.js +1 -0
- package/dist/tooltip-mrpLz4DZ.d.ts +218 -0
- package/dist/tooltip.d.ts +1 -217
- package/dist/tooltip.js +1 -1
- package/dist/well.js +1 -1
- package/package.json +1 -1
- package/dist/slot-BtwKJTLq.d.ts +0 -25
- package/dist/slot-Dpsqz16D.js +0 -1
- package/dist/theme-IAnQ35bd.js +0 -1
package/dist/sidebar.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
-
import { n as IconButtonProps } from "./button-C7vAl6lS.js";
|
|
1
|
+
import { n as WithAsChild, t as SelfClosingWithAsChild } from "./as-child-D23mGo4f.js";
|
|
3
2
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
3
|
+
import { n as IconButtonProps } from "./button-C7vAl6lS.js";
|
|
4
4
|
import { n as Separator } from "./separator-B5UmkVRL.js";
|
|
5
|
-
import {
|
|
5
|
+
import { t as Tooltip } from "./tooltip-mrpLz4DZ.js";
|
|
6
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
6
7
|
//#region src/components/sidebar/sidebar.d.ts
|
|
7
8
|
/**
|
|
8
9
|
* The breakpoints below which `Sidebar.Nav` swaps from the inline desktop
|
|
@@ -84,7 +85,7 @@ type SidebarState = {
|
|
|
84
85
|
* `Sidebar.Root` so misuse fails loudly. Use it to build custom triggers,
|
|
85
86
|
* a keyboard shortcut, or close-on-navigate behavior.
|
|
86
87
|
*
|
|
87
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
88
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#usesidebar
|
|
88
89
|
*
|
|
89
90
|
* @example
|
|
90
91
|
* ```tsx
|
|
@@ -100,6 +101,11 @@ type SidebarState = {
|
|
|
100
101
|
*/
|
|
101
102
|
declare function useSidebar(): SidebarState;
|
|
102
103
|
type SidebarRootProps = {
|
|
104
|
+
/**
|
|
105
|
+
* The sidebar's parts — a `Sidebar.Nav` and anything that reads the state,
|
|
106
|
+
* including a `Sidebar.Trigger` rendered anywhere below (an
|
|
107
|
+
* `AppLayout.Header`, for example). `Root` renders no DOM of its own.
|
|
108
|
+
*/
|
|
103
109
|
children?: ReactNode;
|
|
104
110
|
/**
|
|
105
111
|
* The initial desktop expanded state for the uncontrolled case.
|
|
@@ -132,10 +138,18 @@ type SidebarRootProps = {
|
|
|
132
138
|
mobileBreakpoint?: SidebarMobileBreakpoint;
|
|
133
139
|
/**
|
|
134
140
|
* Toggle the sidebar with `⌘B` (macOS) / `Ctrl+B` (Windows/Linux). The
|
|
135
|
-
* shortcut requires exactly the platform modifier + `b
|
|
136
|
-
* `
|
|
137
|
-
*
|
|
138
|
-
*
|
|
141
|
+
* shortcut requires exactly the platform modifier + `b`: `⌘` on Apple
|
|
142
|
+
* platforms and `Ctrl` everywhere else, resolved per host — the two never
|
|
143
|
+
* substitute for each other, so macOS's native `Ctrl+B` ("move the caret
|
|
144
|
+
* back one character") is left alone. Combinations with `Shift`/`Alt` (e.g.
|
|
145
|
+
* the browser's own `⌘⇧B`) pass through too.
|
|
146
|
+
*
|
|
147
|
+
* The shortcut is also ignored while focus is in a text-editing or form
|
|
148
|
+
* control — an `<input>`, `<textarea>`, `<select>`, or any `contenteditable`
|
|
149
|
+
* host — because the chord is usually already bound there (`⌘B` is "bold")
|
|
150
|
+
* and this is a `window` listener that calls `preventDefault()`. That covers
|
|
151
|
+
* embedded editors like Monaco and CodeMirror, which attach to exactly those
|
|
152
|
+
* elements. Set `false` to opt out entirely.
|
|
139
153
|
*
|
|
140
154
|
* The shortcut has exactly one owner per window: the first mounted root
|
|
141
155
|
* with the shortcut enabled. Additional roots (nested or siblings) queue
|
|
@@ -156,13 +170,24 @@ type SidebarRootProps = {
|
|
|
156
170
|
* Render exactly one `Sidebar.Nav` per `Sidebar.Root`. Nested roots shadow
|
|
157
171
|
* the outer sidebar for everything below them.
|
|
158
172
|
*
|
|
159
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
173
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarroot
|
|
160
174
|
*
|
|
161
175
|
* @example
|
|
162
176
|
* ```tsx
|
|
163
177
|
* <Sidebar.Root>
|
|
164
178
|
* <Sidebar.Nav aria-label="Main">
|
|
165
|
-
* <Sidebar.Header
|
|
179
|
+
* <Sidebar.Header>
|
|
180
|
+
* <DropdownMenu.Root>
|
|
181
|
+
* <DropdownMenu.Trigger asChild>
|
|
182
|
+
* <Sidebar.SwitcherTrigger>
|
|
183
|
+
* <GlobeIcon />
|
|
184
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-base">Universal Gateway</span>
|
|
185
|
+
* <CaretDownIcon className="text-muted size-4 shrink-0" />
|
|
186
|
+
* </Sidebar.SwitcherTrigger>
|
|
187
|
+
* </DropdownMenu.Trigger>
|
|
188
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
189
|
+
* </DropdownMenu.Root>
|
|
190
|
+
* </Sidebar.Header>
|
|
166
191
|
* <Sidebar.Body>
|
|
167
192
|
* <Sidebar.Group>
|
|
168
193
|
* <Sidebar.GroupLabel>Traffic</Sidebar.GroupLabel>
|
|
@@ -178,11 +203,21 @@ type SidebarRootProps = {
|
|
|
178
203
|
* </Sidebar.List>
|
|
179
204
|
* </Sidebar.Group>
|
|
180
205
|
* </Sidebar.Body>
|
|
181
|
-
* <Sidebar.Footer
|
|
206
|
+
* <Sidebar.Footer>
|
|
207
|
+
* <Sidebar.Separator />
|
|
208
|
+
* <DropdownMenu.Root>
|
|
209
|
+
* <DropdownMenu.Trigger asChild>
|
|
210
|
+
* <Sidebar.SwitcherTrigger>
|
|
211
|
+
* <Sidebar.AccountAvatar accountId="acc_123" accountName="Acme Corp" />
|
|
212
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-sm font-medium">Acme Corp</span>
|
|
213
|
+
* <Sidebar.UserAvatar alt="Jane Doe" />
|
|
214
|
+
* </Sidebar.SwitcherTrigger>
|
|
215
|
+
* </DropdownMenu.Trigger>
|
|
216
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
217
|
+
* </DropdownMenu.Root>
|
|
218
|
+
* </Sidebar.Footer>
|
|
182
219
|
* </Sidebar.Nav>
|
|
183
|
-
* <
|
|
184
|
-
* <Sidebar.Trigger />
|
|
185
|
-
* </main>
|
|
220
|
+
* <Sidebar.Trigger />
|
|
186
221
|
* </Sidebar.Root>
|
|
187
222
|
* ```
|
|
188
223
|
*/
|
|
@@ -226,19 +261,39 @@ type SidebarNavProps = ComponentProps<"div"> & WithDataSlot;
|
|
|
226
261
|
* opens from. Override `--sidebar-width` at `:root` to move both together, or
|
|
227
262
|
* set `--sidebar-row-width` on the outside surface itself.
|
|
228
263
|
*
|
|
229
|
-
*
|
|
264
|
+
* **Data attributes:**
|
|
265
|
+
*
|
|
266
|
+
* | Data Attribute | Value | Description |
|
|
267
|
+
* | --- | --- | --- |
|
|
268
|
+
* | `data-state` | `"expanded"` \| `"collapsed"` | On the desktop panel surface. Mirrors the root's expanded state and drives the width collapse to the icon rail; descendant parts style off it with `group-data-[state=collapsed]/sidebar-nav:`. |
|
|
269
|
+
* | `data-hydrated` | present after hydration | Presence-only, desktop panel surface. The CSS-side twin of the `isHydrated` gate: descendant collapse transitions are enabled only under `group-data-[hydrated]/sidebar-nav:`, so an SSR state correction snaps instead of animating on page load. |
|
|
270
|
+
* | `data-mobile` | present in the mobile sheet | Presence-only. Marks the `Sheet.Content` presentation used below the root's `mobileBreakpoint`. |
|
|
271
|
+
* | `data-state` | `"open"` \| `"closed"` | In the mobile sheet only, where the panel *is* the `Sheet`'s Radix dialog content element and Radix owns the attribute — the sheet's open/close animation state, not the desktop expanded state. Consumers style against it too. |
|
|
272
|
+
*
|
|
273
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarnav
|
|
230
274
|
*
|
|
231
275
|
* @example
|
|
232
276
|
* ```tsx
|
|
233
277
|
* <Sidebar.Root>
|
|
234
278
|
* <Sidebar.Nav aria-label="Main">
|
|
235
|
-
* <Sidebar.Header
|
|
279
|
+
* <Sidebar.Header>
|
|
280
|
+
* <DropdownMenu.Root>
|
|
281
|
+
* <DropdownMenu.Trigger asChild>
|
|
282
|
+
* <Sidebar.SwitcherTrigger>
|
|
283
|
+
* <GlobeIcon />
|
|
284
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-base">Universal Gateway</span>
|
|
285
|
+
* <CaretDownIcon className="text-muted size-4 shrink-0" />
|
|
286
|
+
* </Sidebar.SwitcherTrigger>
|
|
287
|
+
* </DropdownMenu.Trigger>
|
|
288
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
289
|
+
* </DropdownMenu.Root>
|
|
290
|
+
* </Sidebar.Header>
|
|
236
291
|
* <Sidebar.Body>
|
|
237
292
|
* <Sidebar.Group>
|
|
238
293
|
* <Sidebar.GroupLabel>Traffic</Sidebar.GroupLabel>
|
|
239
294
|
* <Sidebar.List>
|
|
240
295
|
* <Sidebar.Item>
|
|
241
|
-
* <Sidebar.ItemButton asChild>
|
|
296
|
+
* <Sidebar.ItemButton asChild current>
|
|
242
297
|
* <a href="/endpoints">
|
|
243
298
|
* <GraphIcon />
|
|
244
299
|
* Endpoints
|
|
@@ -248,8 +303,21 @@ type SidebarNavProps = ComponentProps<"div"> & WithDataSlot;
|
|
|
248
303
|
* </Sidebar.List>
|
|
249
304
|
* </Sidebar.Group>
|
|
250
305
|
* </Sidebar.Body>
|
|
251
|
-
* <Sidebar.Footer
|
|
306
|
+
* <Sidebar.Footer>
|
|
307
|
+
* <Sidebar.Separator />
|
|
308
|
+
* <DropdownMenu.Root>
|
|
309
|
+
* <DropdownMenu.Trigger asChild>
|
|
310
|
+
* <Sidebar.SwitcherTrigger>
|
|
311
|
+
* <Sidebar.AccountAvatar accountId="acc_123" accountName="Acme Corp" />
|
|
312
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-sm font-medium">Acme Corp</span>
|
|
313
|
+
* <Sidebar.UserAvatar alt="Jane Doe" />
|
|
314
|
+
* </Sidebar.SwitcherTrigger>
|
|
315
|
+
* </DropdownMenu.Trigger>
|
|
316
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
317
|
+
* </DropdownMenu.Root>
|
|
318
|
+
* </Sidebar.Footer>
|
|
252
319
|
* </Sidebar.Nav>
|
|
320
|
+
* <Sidebar.Trigger />
|
|
253
321
|
* </Sidebar.Root>
|
|
254
322
|
* ```
|
|
255
323
|
*/
|
|
@@ -296,7 +364,16 @@ type SidebarTriggerProps = Omit<IconButtonProps, "appearance" | "asChild" | "chi
|
|
|
296
364
|
* `AppLayout.Header`) — it must stay visible at every breakpoint where the
|
|
297
365
|
* sidebar can collapse, or users have no way to reopen it.
|
|
298
366
|
*
|
|
299
|
-
*
|
|
367
|
+
* **Data attributes:**
|
|
368
|
+
*
|
|
369
|
+
* | Data Attribute | Value | Description |
|
|
370
|
+
* | --- | --- | --- |
|
|
371
|
+
* | `data-state` | `"expanded"` \| `"collapsed"` | Mirrors what the trigger toggles: the mobile sheet below the root's `mobileBreakpoint`, the desktop panel otherwise. Pairs with `aria-expanded`. |
|
|
372
|
+
* | `data-appearance` | `"ghost"` \| `"outlined"` | Read, not stamped: the underlying `IconButton` reflects its `appearance`, which this part defaults to `"ghost"`. |
|
|
373
|
+
* | `data-intent` | `"accent"` \| `"danger"` \| `"neutral"` | Read, not stamped: the underlying `IconButton` reflects its `intent`, which this part defaults to `"neutral"`. |
|
|
374
|
+
* | `data-size` | `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` | Read, not stamped: the underlying `IconButton` reflects its `size` and its own `"md"` default. |
|
|
375
|
+
*
|
|
376
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebartrigger
|
|
300
377
|
*
|
|
301
378
|
* @example
|
|
302
379
|
* ```tsx
|
|
@@ -351,15 +428,15 @@ type SidebarTriggerProps = Omit<IconButtonProps, "appearance" | "asChild" | "chi
|
|
|
351
428
|
* Placement within an `AppLayout` shell:
|
|
352
429
|
* ```tsx
|
|
353
430
|
* <Sidebar.Root>
|
|
354
|
-
* <
|
|
355
|
-
*
|
|
431
|
+
* <AppLayout.Workspace>
|
|
432
|
+
* <Sidebar.Nav aria-label="Main">…</Sidebar.Nav>
|
|
356
433
|
* <AppLayout.Content>
|
|
357
434
|
* <AppLayout.Header>
|
|
358
435
|
* <Sidebar.Trigger />
|
|
359
436
|
* </AppLayout.Header>
|
|
360
|
-
*
|
|
437
|
+
* <AppLayout.Body>…</AppLayout.Body>
|
|
361
438
|
* </AppLayout.Content>
|
|
362
|
-
* </AppLayout.
|
|
439
|
+
* </AppLayout.Workspace>
|
|
363
440
|
* </Sidebar.Root>
|
|
364
441
|
* ```
|
|
365
442
|
*/
|
|
@@ -382,7 +459,7 @@ type SidebarHeaderProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
|
382
459
|
* | --- | --- | --- |
|
|
383
460
|
* | `--sidebar-header-height` | `4.5rem` | The header row height (72px). Set it on a common ancestor of the sidebar and `AppLayout.Header`, not on `Sidebar.Nav`, so both rows read one value. |
|
|
384
461
|
*
|
|
385
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
462
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarheader
|
|
386
463
|
*
|
|
387
464
|
* @example
|
|
388
465
|
* ```tsx
|
|
@@ -442,7 +519,7 @@ type SidebarBodyProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
|
442
519
|
* `scroll-fade-y` mask; inside the collapsed icon rail the scrollbar and its
|
|
443
520
|
* reserved gutter are hidden and the fade is the only overflow signal.
|
|
444
521
|
*
|
|
445
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
522
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarbody
|
|
446
523
|
*
|
|
447
524
|
* @example
|
|
448
525
|
* ```tsx
|
|
@@ -501,7 +578,7 @@ type SidebarFooterProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
|
501
578
|
* switcher row (`Sidebar.SwitcherTrigger` with `Sidebar.AccountAvatar` and
|
|
502
579
|
* `Sidebar.UserAvatar`).
|
|
503
580
|
*
|
|
504
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
581
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarfooter
|
|
505
582
|
*
|
|
506
583
|
* @example
|
|
507
584
|
* ```tsx
|
|
@@ -560,7 +637,7 @@ type SidebarGroupProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
|
560
637
|
* group wires it to the list via `aria-labelledby` so assistive technology
|
|
561
638
|
* announces the list with the group's name.
|
|
562
639
|
*
|
|
563
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
640
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebargroup
|
|
564
641
|
*
|
|
565
642
|
* @example
|
|
566
643
|
* ```tsx
|
|
@@ -620,7 +697,7 @@ type SidebarGroupLabelProps = ComponentProps<"div"> & WithAsChild & WithDataSlot
|
|
|
620
697
|
* the sibling list via `aria-labelledby`. Pass `asChild` to render a heading
|
|
621
698
|
* at a level you control.
|
|
622
699
|
*
|
|
623
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
700
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebargrouplabel
|
|
624
701
|
*
|
|
625
702
|
* @example
|
|
626
703
|
* ```tsx
|
|
@@ -678,7 +755,7 @@ type SidebarListProps = ComponentProps<"ul"> & WithAsChild & WithDataSlot;
|
|
|
678
755
|
* has a `Sidebar.GroupLabel`, the list is announced with the group's name via
|
|
679
756
|
* `aria-labelledby`.
|
|
680
757
|
*
|
|
681
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
758
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarlist
|
|
682
759
|
*
|
|
683
760
|
* @example
|
|
684
761
|
* ```tsx
|
|
@@ -736,7 +813,7 @@ type SidebarItemProps = ComponentProps<"li"> & WithAsChild & WithDataSlot;
|
|
|
736
813
|
* element is the `Sidebar.ItemButton` child, so props, `ref`, and `className`
|
|
737
814
|
* all target the list item itself.
|
|
738
815
|
*
|
|
739
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
816
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaritem
|
|
740
817
|
*
|
|
741
818
|
* @example
|
|
742
819
|
* ```tsx
|
|
@@ -793,6 +870,10 @@ type SidebarItemButtonProps = ComponentProps<"button"> & WithAsChild & WithDataS
|
|
|
793
870
|
* Marks this row as the current page: sets `aria-current="page"` and the
|
|
794
871
|
* `data-current` styling state. Consumers control it from their router,
|
|
795
872
|
* e.g. `current={pathname === "/endpoints"}`.
|
|
873
|
+
*
|
|
874
|
+
* A composed child that sets `aria-current="page"` itself — react-router's
|
|
875
|
+
* `NavLink` does — already gets the current-row treatment, so it needs no
|
|
876
|
+
* `current`. This prop is for the rows whose parent knows.
|
|
796
877
|
*/
|
|
797
878
|
current?: boolean;
|
|
798
879
|
};
|
|
@@ -802,6 +883,20 @@ type SidebarItemButtonProps = ComponentProps<"button"> & WithAsChild & WithDataS
|
|
|
802
883
|
* compose with a router link. `current` sets `aria-current="page"` and the
|
|
803
884
|
* `data-current` visual state.
|
|
804
885
|
*
|
|
886
|
+
* The current-row treatment follows either attribute, so a composed child that
|
|
887
|
+
* marks itself as the current page gets it without `current` — a react-router
|
|
888
|
+
* `NavLink` needs nothing but its `to`, since it already resolved the match the
|
|
889
|
+
* parent would otherwise re-derive:
|
|
890
|
+
*
|
|
891
|
+
* ```tsx
|
|
892
|
+
* <Sidebar.ItemButton asChild>
|
|
893
|
+
* <NavLink to="/endpoints">
|
|
894
|
+
* <GraphIcon />
|
|
895
|
+
* Endpoints
|
|
896
|
+
* </NavLink>
|
|
897
|
+
* </Sidebar.ItemButton>
|
|
898
|
+
* ```
|
|
899
|
+
*
|
|
805
900
|
* The row sizes its **leading** icon to 20px and leaves trailing visuals — a
|
|
806
901
|
* caret, a count, a status dot — to size themselves, so a row composed with
|
|
807
902
|
* `DropdownMenu.Trigger asChild` can end in `<CaretDownIcon className="text-muted
|
|
@@ -811,7 +906,15 @@ type SidebarItemButtonProps = ComponentProps<"button"> & WithAsChild & WithDataS
|
|
|
811
906
|
* it keeps the expanded row's width instead of shrinking to this row's 28px
|
|
812
907
|
* rail chip (see `Sidebar.SwitcherTrigger` for the whole contract).
|
|
813
908
|
*
|
|
814
|
-
*
|
|
909
|
+
* **Data attributes:**
|
|
910
|
+
*
|
|
911
|
+
* | Data Attribute | Value | Description |
|
|
912
|
+
* | --- | --- | --- |
|
|
913
|
+
* | `data-current` | present when `current` | Presence-only — never `"false"`, since the `data-current:` variant matches the attribute's existence. Styles the current row. |
|
|
914
|
+
* | `aria-current` | `"page"` when `current` | Set alongside `data-current`. The current-row styling follows *either*, so a composed child that marks itself (react-router's `NavLink`) gets the treatment without the prop. |
|
|
915
|
+
* | `data-state` | `"open"` | **Read, not stamped** — supplied by a composing `DropdownMenu.Trigger` / `Dialog.Trigger`. The row styles against it so it stays highlighted while its menu is open. |
|
|
916
|
+
*
|
|
917
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaritembutton
|
|
815
918
|
*
|
|
816
919
|
* @example
|
|
817
920
|
* ```tsx
|
|
@@ -891,7 +994,13 @@ type SidebarSwitcherTriggerProps = ComponentProps<"button"> & WithAsChild & With
|
|
|
891
994
|
* `--sidebar-width-mobile` whenever you widen `--sidebar-width`, or the floor
|
|
892
995
|
* overhangs the sheet.
|
|
893
996
|
*
|
|
894
|
-
*
|
|
997
|
+
* **Data attributes:**
|
|
998
|
+
*
|
|
999
|
+
* | Data Attribute | Value | Description |
|
|
1000
|
+
* | --- | --- | --- |
|
|
1001
|
+
* | `data-state` | `"open"` | **Read, not stamped** — supplied by the composing `DropdownMenu.Trigger` / `Dialog.Trigger`. The row styles against it so it stays highlighted while its menu is open. |
|
|
1002
|
+
*
|
|
1003
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarswitchertrigger
|
|
895
1004
|
*
|
|
896
1005
|
* @example
|
|
897
1006
|
* ```tsx
|
|
@@ -943,7 +1052,108 @@ type SidebarSwitcherTriggerProps = ComponentProps<"button"> & WithAsChild & With
|
|
|
943
1052
|
* ```
|
|
944
1053
|
*/
|
|
945
1054
|
declare const SwitcherTrigger: ({ asChild, children, className, "data-slot": dataSlot, type, ...props }: SidebarSwitcherTriggerProps) => import("react").JSX.Element;
|
|
946
|
-
|
|
1055
|
+
/**
|
|
1056
|
+
* The props for `Sidebar.Tooltip`. `Tooltip.Content`'s props — so `className`,
|
|
1057
|
+
* `style`, `ref`, `asChild`, and any `data-*` reach the tooltip surface — except
|
|
1058
|
+
* the parts this row owns: `children` is the row being labeled (not the tooltip
|
|
1059
|
+
* body, which is `label`), and `side` becomes optional with a sidebar default.
|
|
1060
|
+
*/
|
|
1061
|
+
type SidebarTooltipProps = Omit<ComponentProps<typeof Tooltip.Content>, "children" | "side"> & WithDataSlot & {
|
|
1062
|
+
/**
|
|
1063
|
+
* The row this labels — a `Sidebar.ItemButton` or `Sidebar.SwitcherTrigger`,
|
|
1064
|
+
* optionally already wrapped in a `DropdownMenu.Trigger asChild`.
|
|
1065
|
+
*
|
|
1066
|
+
* A single element, required: `Tooltip.Trigger asChild` clones its child, so
|
|
1067
|
+
* text renders nothing a pointer can hover and no children renders no row at
|
|
1068
|
+
* all — both silently.
|
|
1069
|
+
*/
|
|
1070
|
+
children: ReactElement;
|
|
1071
|
+
/**
|
|
1072
|
+
* What the tooltip says. Normally the row's own label text: the rail clips the
|
|
1073
|
+
* visible one, so this is what a sighted pointer user reads.
|
|
1074
|
+
*/
|
|
1075
|
+
label: ReactNode;
|
|
1076
|
+
/**
|
|
1077
|
+
* Which side of the row the tooltip opens on. The rail sits at the inline
|
|
1078
|
+
* start of the viewport, so the default points the tooltip away from it.
|
|
1079
|
+
*
|
|
1080
|
+
* @default "right"
|
|
1081
|
+
*/
|
|
1082
|
+
side?: ComponentProps<typeof Tooltip.Content>["side"];
|
|
1083
|
+
};
|
|
1084
|
+
/**
|
|
1085
|
+
* Labels a sidebar row while — and only while — the desktop panel is collapsed
|
|
1086
|
+
* to the icon rail. Wrap it around a `Sidebar.ItemButton` or
|
|
1087
|
+
* `Sidebar.SwitcherTrigger`.
|
|
1088
|
+
*
|
|
1089
|
+
* The collapsed rail keeps every row's label in the accessibility tree (clipped,
|
|
1090
|
+
* not removed), which serves screen-reader users but leaves a sighted pointer
|
|
1091
|
+
* user with an unlabeled icon column. This restores the label for them without
|
|
1092
|
+
* duplicating it for anyone else: expanded rows already read their own text, and
|
|
1093
|
+
* the mobile sheet shows full labels, so the tooltip content only mounts in the
|
|
1094
|
+
* collapsed desktop rail.
|
|
1095
|
+
*
|
|
1096
|
+
* **Requires a `TooltipProvider` ancestor**, like any `Tooltip.Root` — mount one
|
|
1097
|
+
* at your app root. This part deliberately does not provide its own, so tooltip
|
|
1098
|
+
* delay and hover settings stay app-wide rather than being overridden per row.
|
|
1099
|
+
*
|
|
1100
|
+
* It composes with a menu trigger: nest `DropdownMenu.Root >
|
|
1101
|
+
* Sidebar.Tooltip > DropdownMenu.Trigger asChild > Sidebar.ItemButton` for a
|
|
1102
|
+
* row that opens a menu *and* labels itself in the rail. `DropdownMenu.Root` must
|
|
1103
|
+
* stay **outside** the tooltip — it is renderless, and `Tooltip.Trigger asChild`
|
|
1104
|
+
* needs a real element to clone.
|
|
1105
|
+
*
|
|
1106
|
+
* `children` is the row; `label` is what the tooltip says. Every other prop is
|
|
1107
|
+
* `Tooltip.Content`'s and lands on the tooltip surface — `className`, `style`,
|
|
1108
|
+
* `ref`, `data-*`, positioning props such as `align` and `sideOffset`, and
|
|
1109
|
+
* `asChild`, which Radix's `Tooltip.Content` implements itself. `side` defaults
|
|
1110
|
+
* to `"right"` so the tooltip opens away from the rail.
|
|
1111
|
+
*
|
|
1112
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebartooltip
|
|
1113
|
+
*
|
|
1114
|
+
* @example
|
|
1115
|
+
* ```tsx
|
|
1116
|
+
* <TooltipProvider>
|
|
1117
|
+
* <Sidebar.Root>
|
|
1118
|
+
* <Sidebar.Nav aria-label="Main">
|
|
1119
|
+
* <Sidebar.Body>
|
|
1120
|
+
* <Sidebar.Group>
|
|
1121
|
+
* <Sidebar.GroupLabel>Traffic</Sidebar.GroupLabel>
|
|
1122
|
+
* <Sidebar.List>
|
|
1123
|
+
* <Sidebar.Item>
|
|
1124
|
+
* <Sidebar.Tooltip label="Endpoints">
|
|
1125
|
+
* <Sidebar.ItemButton asChild current>
|
|
1126
|
+
* <a href="/endpoints">
|
|
1127
|
+
* <GraphIcon />
|
|
1128
|
+
* Endpoints
|
|
1129
|
+
* </a>
|
|
1130
|
+
* </Sidebar.ItemButton>
|
|
1131
|
+
* </Sidebar.Tooltip>
|
|
1132
|
+
* </Sidebar.Item>
|
|
1133
|
+
* </Sidebar.List>
|
|
1134
|
+
* </Sidebar.Group>
|
|
1135
|
+
* </Sidebar.Body>
|
|
1136
|
+
* <Sidebar.Footer>
|
|
1137
|
+
* <DropdownMenu.Root>
|
|
1138
|
+
* <Sidebar.Tooltip label="Help">
|
|
1139
|
+
* <DropdownMenu.Trigger asChild>
|
|
1140
|
+
* <Sidebar.ItemButton>
|
|
1141
|
+
* <QuestionIcon />
|
|
1142
|
+
* Help
|
|
1143
|
+
* </Sidebar.ItemButton>
|
|
1144
|
+
* </DropdownMenu.Trigger>
|
|
1145
|
+
* </Sidebar.Tooltip>
|
|
1146
|
+
* <DropdownMenu.Content>…</DropdownMenu.Content>
|
|
1147
|
+
* </DropdownMenu.Root>
|
|
1148
|
+
* </Sidebar.Footer>
|
|
1149
|
+
* </Sidebar.Nav>
|
|
1150
|
+
* <Sidebar.Trigger />
|
|
1151
|
+
* </Sidebar.Root>
|
|
1152
|
+
* </TooltipProvider>
|
|
1153
|
+
* ```
|
|
1154
|
+
*/
|
|
1155
|
+
declare const SidebarTooltip: ({ children, "data-slot": dataSlot, label, side, ...props }: SidebarTooltipProps) => import("react").JSX.Element;
|
|
1156
|
+
type SidebarSeparatorProps = ComponentProps<typeof Separator> & WithDataSlot;
|
|
947
1157
|
/**
|
|
948
1158
|
* An inset hairline between sidebar regions. Composes the mantle `Separator`,
|
|
949
1159
|
* staying aligned with the `px-3` content padding of `Sidebar.Body` and
|
|
@@ -952,7 +1162,7 @@ type SidebarSeparatorProps = ComponentProps<typeof Separator>;
|
|
|
952
1162
|
* to the same 36px chip width as `Sidebar.SwitcherTrigger`, balancing the
|
|
953
1163
|
* adjacent app-content gutter that sits outside the rail.
|
|
954
1164
|
*
|
|
955
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1165
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarseparator
|
|
956
1166
|
*
|
|
957
1167
|
* @example
|
|
958
1168
|
* ```tsx
|
|
@@ -1003,8 +1213,17 @@ type SidebarSeparatorProps = ComponentProps<typeof Separator>;
|
|
|
1003
1213
|
* </Sidebar.Root>
|
|
1004
1214
|
* ```
|
|
1005
1215
|
*/
|
|
1006
|
-
declare const SidebarSeparator: ({ className, ...props }: SidebarSeparatorProps) => import("react").JSX.Element;
|
|
1007
|
-
|
|
1216
|
+
declare const SidebarSeparator: ({ className, "data-slot": dataSlot, ...props }: SidebarSeparatorProps) => import("react").JSX.Element;
|
|
1217
|
+
/**
|
|
1218
|
+
* The props for `Sidebar.AccountAvatar`.
|
|
1219
|
+
*
|
|
1220
|
+
* `children` is valid only with `asChild`, where it is the element the avatar
|
|
1221
|
+
* renders as instead of its own `<div>` — pass an empty one, e.g. `<span />`
|
|
1222
|
+
* when the avatar sits inside a `<button>` (which may not contain a `<div>`).
|
|
1223
|
+
* The initials are derived from `accountName`, which a consumer cannot compute,
|
|
1224
|
+
* so they render *inside* that element in place of its own children.
|
|
1225
|
+
*/
|
|
1226
|
+
type SidebarAccountAvatarProps = Omit<ComponentProps<"div">, "children"> & SelfClosingWithAsChild & WithDataSlot & {
|
|
1008
1227
|
/**
|
|
1009
1228
|
* The account's stable identifier. Used to deterministically select a
|
|
1010
1229
|
* background swatch from the design system's palette so the same account
|
|
@@ -1026,7 +1245,12 @@ type SidebarAccountAvatarProps = Omit<ComponentProps<"div">, "children"> & {
|
|
|
1026
1245
|
* Accounts are rendered as squares to differentiate them visually from users,
|
|
1027
1246
|
* which use a circular `Sidebar.UserAvatar`.
|
|
1028
1247
|
*
|
|
1029
|
-
*
|
|
1248
|
+
* Pass `asChild` with a single empty element to swap the `<div>` it renders —
|
|
1249
|
+
* a `<span />` inside a `<button>`, or a link. The initials are derived from
|
|
1250
|
+
* `accountName`, so they render inside the swapped element; anything that
|
|
1251
|
+
* element carried of its own is replaced.
|
|
1252
|
+
*
|
|
1253
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaraccountavatar
|
|
1030
1254
|
*
|
|
1031
1255
|
* @example
|
|
1032
1256
|
* ```tsx
|
|
@@ -1077,8 +1301,17 @@ type SidebarAccountAvatarProps = Omit<ComponentProps<"div">, "children"> & {
|
|
|
1077
1301
|
* </Sidebar.Root>
|
|
1078
1302
|
* ```
|
|
1079
1303
|
*/
|
|
1080
|
-
declare const AccountAvatar: ({ accountId, accountName, className, ...props }: SidebarAccountAvatarProps) => import("react").JSX.Element;
|
|
1081
|
-
|
|
1304
|
+
declare const AccountAvatar: ({ accountId, accountName, asChild, children, className, "data-slot": dataSlot, ...props }: SidebarAccountAvatarProps) => import("react").JSX.Element;
|
|
1305
|
+
/**
|
|
1306
|
+
* The props for `Sidebar.UserAvatar`.
|
|
1307
|
+
*
|
|
1308
|
+
* `children` is valid only with `asChild`, where it is the element the avatar
|
|
1309
|
+
* renders as instead of its own `<div>` — pass an empty one, e.g. `<span />`
|
|
1310
|
+
* when the avatar sits inside a `<button>` (which may not contain a `<div>`).
|
|
1311
|
+
* The avatar's visual (the `src` image, or the silhouette fallback) renders
|
|
1312
|
+
* *inside* that element in place of its own children.
|
|
1313
|
+
*/
|
|
1314
|
+
type SidebarUserAvatarProps = Omit<ComponentProps<"div">, "children"> & SelfClosingWithAsChild & WithDataSlot & {
|
|
1082
1315
|
/**
|
|
1083
1316
|
* Optional URL of the user's profile picture. When provided, the image is
|
|
1084
1317
|
* rendered to fill the avatar with `object-cover`. When omitted (or while
|
|
@@ -1101,7 +1334,12 @@ type SidebarUserAvatarProps = Omit<ComponentProps<"div">, "children"> & {
|
|
|
1101
1334
|
* Users are rendered as circles to differentiate them visually from accounts,
|
|
1102
1335
|
* which use a square `Sidebar.AccountAvatar`.
|
|
1103
1336
|
*
|
|
1104
|
-
*
|
|
1337
|
+
* Pass `asChild` with a single empty element to swap the `<div>` it renders —
|
|
1338
|
+
* a `<span />` inside a `<button>`, or a link. The image (or the silhouette
|
|
1339
|
+
* fallback) renders inside the swapped element; anything that element carried of
|
|
1340
|
+
* its own is replaced.
|
|
1341
|
+
*
|
|
1342
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaruseravatar
|
|
1105
1343
|
*
|
|
1106
1344
|
* @example
|
|
1107
1345
|
* ```tsx
|
|
@@ -1152,7 +1390,7 @@ type SidebarUserAvatarProps = Omit<ComponentProps<"div">, "children"> & {
|
|
|
1152
1390
|
* </Sidebar.Root>
|
|
1153
1391
|
* ```
|
|
1154
1392
|
*/
|
|
1155
|
-
declare const UserAvatar: ({ alt, className, src, ...props }: SidebarUserAvatarProps) => import("react").JSX.Element;
|
|
1393
|
+
declare const UserAvatar: ({ alt, asChild, children, className, "data-slot": dataSlot, src, ...props }: SidebarUserAvatarProps) => import("react").JSX.Element;
|
|
1156
1394
|
/**
|
|
1157
1395
|
* A composable, collapsible app-navigation sidebar. `Sidebar.Root` owns the
|
|
1158
1396
|
* state (no DOM); `Sidebar.Nav` renders the panel — inline on desktop,
|
|
@@ -1180,8 +1418,10 @@ declare const UserAvatar: ({ alt, className, src, ...props }: SidebarUserAvatarP
|
|
|
1180
1418
|
* │ │ ├── Sidebar.GroupLabel
|
|
1181
1419
|
* │ │ └── Sidebar.List
|
|
1182
1420
|
* │ │ └── Sidebar.Item
|
|
1183
|
-
* │ │ └── Sidebar.
|
|
1421
|
+
* │ │ └── Sidebar.Tooltip
|
|
1422
|
+
* │ │ └── Sidebar.ItemButton
|
|
1184
1423
|
* │ └── Sidebar.Footer
|
|
1424
|
+
* │ ├── Sidebar.ItemButton
|
|
1185
1425
|
* │ ├── Sidebar.Separator
|
|
1186
1426
|
* │ └── Sidebar.SwitcherTrigger
|
|
1187
1427
|
* │ ├── Sidebar.AccountAvatar
|
|
@@ -1244,7 +1484,7 @@ declare const Sidebar: {
|
|
|
1244
1484
|
* mobile-sheet state to every part below it so the trigger can live in the
|
|
1245
1485
|
* app shell without coupling it to the sidebar.
|
|
1246
1486
|
*
|
|
1247
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1487
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarroot
|
|
1248
1488
|
*
|
|
1249
1489
|
* @example
|
|
1250
1490
|
* ```tsx
|
|
@@ -1302,7 +1542,16 @@ declare const Sidebar: {
|
|
|
1302
1542
|
* `--sidebar-width` / `--sidebar-width-mobile` via its `className` or
|
|
1303
1543
|
* `style`.
|
|
1304
1544
|
*
|
|
1305
|
-
*
|
|
1545
|
+
* **Data attributes:**
|
|
1546
|
+
*
|
|
1547
|
+
* | Data Attribute | Value | Description |
|
|
1548
|
+
* | --- | --- | --- |
|
|
1549
|
+
* | `data-state` | `"expanded"` \| `"collapsed"` | On the desktop panel surface. Mirrors the root's expanded state and drives the width collapse to the icon rail; descendant parts style off it with `group-data-[state=collapsed]/sidebar-nav:`. |
|
|
1550
|
+
* | `data-hydrated` | present after hydration | Presence-only, desktop panel surface. The CSS-side twin of the `isHydrated` gate: descendant collapse transitions are enabled only under `group-data-[hydrated]/sidebar-nav:`, so an SSR state correction snaps instead of animating on page load. |
|
|
1551
|
+
* | `data-mobile` | present in the mobile sheet | Presence-only. Marks the `Sheet.Content` presentation used below the root's `mobileBreakpoint`. |
|
|
1552
|
+
* | `data-state` | `"open"` \| `"closed"` | In the mobile sheet only, where the panel *is* the `Sheet`'s Radix dialog content element and Radix owns the attribute — the sheet's open/close animation state, not the desktop expanded state. Consumers style against it too. |
|
|
1553
|
+
*
|
|
1554
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarnav
|
|
1306
1555
|
*
|
|
1307
1556
|
* @example
|
|
1308
1557
|
* ```tsx
|
|
@@ -1358,7 +1607,16 @@ declare const Sidebar: {
|
|
|
1358
1607
|
* The `IconButton` that toggles the sidebar. Place it in the app shell's
|
|
1359
1608
|
* header; it stays functional at every breakpoint.
|
|
1360
1609
|
*
|
|
1361
|
-
*
|
|
1610
|
+
* **Data attributes:**
|
|
1611
|
+
*
|
|
1612
|
+
* | Data Attribute | Value | Description |
|
|
1613
|
+
* | --- | --- | --- |
|
|
1614
|
+
* | `data-state` | `"expanded"` \| `"collapsed"` | Mirrors what the trigger toggles: the mobile sheet below the root's `mobileBreakpoint`, the desktop panel otherwise. Pairs with `aria-expanded`. |
|
|
1615
|
+
* | `data-appearance` | `"ghost"` \| `"outlined"` | Read, not stamped: the underlying `IconButton` reflects its `appearance`, which this part defaults to `"ghost"`. |
|
|
1616
|
+
* | `data-intent` | `"accent"` \| `"danger"` \| `"neutral"` | Read, not stamped: the underlying `IconButton` reflects its `intent`, which this part defaults to `"neutral"`. |
|
|
1617
|
+
* | `data-size` | `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` | Read, not stamped: the underlying `IconButton` reflects its `size` and its own `"md"` default. |
|
|
1618
|
+
*
|
|
1619
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebartrigger
|
|
1362
1620
|
*
|
|
1363
1621
|
* @example
|
|
1364
1622
|
* ```tsx
|
|
@@ -1415,7 +1673,7 @@ declare const Sidebar: {
|
|
|
1415
1673
|
* switcher (`Sidebar.SwitcherTrigger` + `DropdownMenu`/`Dialog`). Its
|
|
1416
1674
|
* height vertically aligns the switcher with an `AppLayout.Header`.
|
|
1417
1675
|
*
|
|
1418
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1676
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarheader
|
|
1419
1677
|
*
|
|
1420
1678
|
* @example
|
|
1421
1679
|
* ```tsx
|
|
@@ -1470,7 +1728,7 @@ declare const Sidebar: {
|
|
|
1470
1728
|
/**
|
|
1471
1729
|
* The scrollable middle region holding the navigation groups.
|
|
1472
1730
|
*
|
|
1473
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1731
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarbody
|
|
1474
1732
|
*
|
|
1475
1733
|
* @example
|
|
1476
1734
|
* ```tsx
|
|
@@ -1526,7 +1784,7 @@ declare const Sidebar: {
|
|
|
1526
1784
|
* The pinned bottom container, typically holding cross-product items and
|
|
1527
1785
|
* the account/user switcher row.
|
|
1528
1786
|
*
|
|
1529
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1787
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarfooter
|
|
1530
1788
|
*
|
|
1531
1789
|
* @example
|
|
1532
1790
|
* ```tsx
|
|
@@ -1582,7 +1840,7 @@ declare const Sidebar: {
|
|
|
1582
1840
|
* A grouping container pairing a `GroupLabel` with a `List`; wires the
|
|
1583
1841
|
* label to the list via `aria-labelledby`.
|
|
1584
1842
|
*
|
|
1585
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1843
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebargroup
|
|
1586
1844
|
*
|
|
1587
1845
|
* @example
|
|
1588
1846
|
* ```tsx
|
|
@@ -1638,7 +1896,7 @@ declare const Sidebar: {
|
|
|
1638
1896
|
* The muted label of a group. Renders a `<div>`; pass `asChild` to render
|
|
1639
1897
|
* a heading at a level you control.
|
|
1640
1898
|
*
|
|
1641
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1899
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebargrouplabel
|
|
1642
1900
|
*
|
|
1643
1901
|
* @example
|
|
1644
1902
|
* ```tsx
|
|
@@ -1693,7 +1951,7 @@ declare const Sidebar: {
|
|
|
1693
1951
|
/**
|
|
1694
1952
|
* The `<ul>` of navigation rows in a group.
|
|
1695
1953
|
*
|
|
1696
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1954
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarlist
|
|
1697
1955
|
*
|
|
1698
1956
|
* @example
|
|
1699
1957
|
* ```tsx
|
|
@@ -1748,7 +2006,7 @@ declare const Sidebar: {
|
|
|
1748
2006
|
/**
|
|
1749
2007
|
* A single `<li>` row wrapper.
|
|
1750
2008
|
*
|
|
1751
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
2009
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaritem
|
|
1752
2010
|
*
|
|
1753
2011
|
* @example
|
|
1754
2012
|
* ```tsx
|
|
@@ -1804,7 +2062,15 @@ declare const Sidebar: {
|
|
|
1804
2062
|
* The interactive navigation row (icon + truncating label). `asChild` for
|
|
1805
2063
|
* router links; `current` for the active page.
|
|
1806
2064
|
*
|
|
1807
|
-
*
|
|
2065
|
+
* **Data attributes:**
|
|
2066
|
+
*
|
|
2067
|
+
* | Data Attribute | Value | Description |
|
|
2068
|
+
* | --- | --- | --- |
|
|
2069
|
+
* | `data-current` | present when `current` | Presence-only — never `"false"`, since the `data-current:` variant matches the attribute's existence. Styles the current row. |
|
|
2070
|
+
* | `aria-current` | `"page"` when `current` | Set alongside `data-current`. The current-row styling follows *either*, so a composed child that marks itself (react-router's `NavLink`) gets the treatment without the prop. |
|
|
2071
|
+
* | `data-state` | `"open"` | **Read, not stamped** — supplied by a composing `DropdownMenu.Trigger` / `Dialog.Trigger`. The row styles against it so it stays highlighted while its menu is open. |
|
|
2072
|
+
*
|
|
2073
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaritembutton
|
|
1808
2074
|
*
|
|
1809
2075
|
* @example
|
|
1810
2076
|
* ```tsx
|
|
@@ -1860,7 +2126,13 @@ declare const Sidebar: {
|
|
|
1860
2126
|
* The styled switcher row for the header/footer. Not state-wired — compose
|
|
1861
2127
|
* with `DropdownMenu.Trigger asChild` or `Dialog.Trigger asChild`.
|
|
1862
2128
|
*
|
|
1863
|
-
*
|
|
2129
|
+
* **Data attributes:**
|
|
2130
|
+
*
|
|
2131
|
+
* | Data Attribute | Value | Description |
|
|
2132
|
+
* | --- | --- | --- |
|
|
2133
|
+
* | `data-state` | `"open"` | **Read, not stamped** — supplied by the composing `DropdownMenu.Trigger` / `Dialog.Trigger`. The row styles against it so it stays highlighted while its menu is open. |
|
|
2134
|
+
*
|
|
2135
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarswitchertrigger
|
|
1864
2136
|
*
|
|
1865
2137
|
* @example
|
|
1866
2138
|
* ```tsx
|
|
@@ -1912,11 +2184,75 @@ declare const Sidebar: {
|
|
|
1912
2184
|
* ```
|
|
1913
2185
|
*/
|
|
1914
2186
|
readonly SwitcherTrigger: typeof SwitcherTrigger;
|
|
2187
|
+
/**
|
|
2188
|
+
* Labels a row while the panel is collapsed to the icon rail — wrap it
|
|
2189
|
+
* around a `Sidebar.ItemButton` or `Sidebar.SwitcherTrigger`. Requires a
|
|
2190
|
+
* `TooltipProvider` ancestor. Takes `Tooltip.Content`'s props (including
|
|
2191
|
+
* `asChild`) on the tooltip surface; `side` defaults to `"right"`.
|
|
2192
|
+
*
|
|
2193
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebartooltip
|
|
2194
|
+
*
|
|
2195
|
+
* @example
|
|
2196
|
+
* ```tsx
|
|
2197
|
+
* <TooltipProvider>
|
|
2198
|
+
* <Sidebar.Root>
|
|
2199
|
+
* <Sidebar.Nav aria-label="Main">
|
|
2200
|
+
* <Sidebar.Header>
|
|
2201
|
+
* <DropdownMenu.Root>
|
|
2202
|
+
* <DropdownMenu.Trigger asChild>
|
|
2203
|
+
* <Sidebar.SwitcherTrigger>
|
|
2204
|
+
* <GlobeIcon />
|
|
2205
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-base">Universal Gateway</span>
|
|
2206
|
+
* <CaretDownIcon className="text-muted size-4 shrink-0" />
|
|
2207
|
+
* </Sidebar.SwitcherTrigger>
|
|
2208
|
+
* </DropdownMenu.Trigger>
|
|
2209
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
2210
|
+
* </DropdownMenu.Root>
|
|
2211
|
+
* </Sidebar.Header>
|
|
2212
|
+
* <Sidebar.Body>
|
|
2213
|
+
* <Sidebar.Group>
|
|
2214
|
+
* <Sidebar.GroupLabel>Traffic</Sidebar.GroupLabel>
|
|
2215
|
+
* <Sidebar.List>
|
|
2216
|
+
* <Sidebar.Item>
|
|
2217
|
+
* <Sidebar.Tooltip label="Endpoints">
|
|
2218
|
+
* <Sidebar.ItemButton asChild current>
|
|
2219
|
+
* <a href="/endpoints">
|
|
2220
|
+
* <GraphIcon />
|
|
2221
|
+
* Endpoints
|
|
2222
|
+
* </a>
|
|
2223
|
+
* </Sidebar.ItemButton>
|
|
2224
|
+
* </Sidebar.Tooltip>
|
|
2225
|
+
* </Sidebar.Item>
|
|
2226
|
+
* </Sidebar.List>
|
|
2227
|
+
* </Sidebar.Group>
|
|
2228
|
+
* </Sidebar.Body>
|
|
2229
|
+
* <Sidebar.Footer>
|
|
2230
|
+
* <Sidebar.Separator />
|
|
2231
|
+
* <DropdownMenu.Root>
|
|
2232
|
+
* <Sidebar.Tooltip label="Acme Corp">
|
|
2233
|
+
* <DropdownMenu.Trigger asChild>
|
|
2234
|
+
* <Sidebar.SwitcherTrigger>
|
|
2235
|
+
* <Sidebar.AccountAvatar accountId="acc_123" accountName="Acme Corp" />
|
|
2236
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-sm font-medium">Acme Corp</span>
|
|
2237
|
+
* <Sidebar.UserAvatar alt="Jane Doe" />
|
|
2238
|
+
* </Sidebar.SwitcherTrigger>
|
|
2239
|
+
* </DropdownMenu.Trigger>
|
|
2240
|
+
* </Sidebar.Tooltip>
|
|
2241
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
2242
|
+
* </DropdownMenu.Root>
|
|
2243
|
+
* </Sidebar.Footer>
|
|
2244
|
+
* </Sidebar.Nav>
|
|
2245
|
+
* <Sidebar.Trigger />
|
|
2246
|
+
* </Sidebar.Root>
|
|
2247
|
+
* </TooltipProvider>
|
|
2248
|
+
* ```
|
|
2249
|
+
*/
|
|
2250
|
+
readonly Tooltip: typeof SidebarTooltip;
|
|
1915
2251
|
/**
|
|
1916
2252
|
* An inset hairline between sidebar regions, aligned with the content
|
|
1917
2253
|
* padding.
|
|
1918
2254
|
*
|
|
1919
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
2255
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarseparator
|
|
1920
2256
|
*
|
|
1921
2257
|
* @example
|
|
1922
2258
|
* ```tsx
|
|
@@ -1970,9 +2306,10 @@ declare const Sidebar: {
|
|
|
1970
2306
|
readonly Separator: typeof SidebarSeparator;
|
|
1971
2307
|
/**
|
|
1972
2308
|
* A rounded-square account avatar with deterministic, WCAG-compliant
|
|
1973
|
-
* swatch colors derived from the account id.
|
|
2309
|
+
* swatch colors derived from the account id. `asChild` swaps its `<div>` for
|
|
2310
|
+
* a single empty element and renders the initials inside it.
|
|
1974
2311
|
*
|
|
1975
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
2312
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaraccountavatar
|
|
1976
2313
|
*
|
|
1977
2314
|
* @example
|
|
1978
2315
|
* ```tsx
|
|
@@ -2025,9 +2362,10 @@ declare const Sidebar: {
|
|
|
2025
2362
|
*/
|
|
2026
2363
|
readonly AccountAvatar: typeof AccountAvatar;
|
|
2027
2364
|
/**
|
|
2028
|
-
* A circular user avatar with a silhouette fallback.
|
|
2365
|
+
* A circular user avatar with a silhouette fallback. `asChild` swaps its
|
|
2366
|
+
* `<div>` for a single empty element and renders the image inside it.
|
|
2029
2367
|
*
|
|
2030
|
-
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
2368
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaruseravatar
|
|
2031
2369
|
*
|
|
2032
2370
|
* @example
|
|
2033
2371
|
* ```tsx
|
|
@@ -2081,4 +2419,140 @@ declare const Sidebar: {
|
|
|
2081
2419
|
readonly UserAvatar: typeof UserAvatar;
|
|
2082
2420
|
};
|
|
2083
2421
|
//#endregion
|
|
2084
|
-
|
|
2422
|
+
//#region src/components/sidebar/sidebar-state-cookie.d.ts
|
|
2423
|
+
/**
|
|
2424
|
+
* The cookie name {@link extractSidebarStateCookie} reads and
|
|
2425
|
+
* {@link serializeSidebarStateCookie} writes.
|
|
2426
|
+
*
|
|
2427
|
+
* Exported so an app can clear the cookie on sign-out, or read it with its own
|
|
2428
|
+
* cookie library, without hard-coding the name.
|
|
2429
|
+
*
|
|
2430
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebar_state_cookie_name
|
|
2431
|
+
*
|
|
2432
|
+
* @example
|
|
2433
|
+
* ```ts
|
|
2434
|
+
* // clear the persisted rail state on sign-out
|
|
2435
|
+
* headers.append("Set-Cookie", `${SIDEBAR_STATE_COOKIE_NAME}=; Max-Age=0; Path=/`);
|
|
2436
|
+
* ```
|
|
2437
|
+
*/
|
|
2438
|
+
declare const SIDEBAR_STATE_COOKIE_NAME = "mantle-sidebar-state";
|
|
2439
|
+
/**
|
|
2440
|
+
* Parse the sidebar's expanded state out of a raw `Cookie` header.
|
|
2441
|
+
*
|
|
2442
|
+
* This is the server half of cookie-backed persistence: unlike storage-backed
|
|
2443
|
+
* persistence, a cookie is available *before* the server renders, so the
|
|
2444
|
+
* server-rendered HTML already carries the right `data-state` and there is no
|
|
2445
|
+
* first-frame correction to hide. Pass the result straight to `defaultOpen` —
|
|
2446
|
+
* controlled `open` is not required.
|
|
2447
|
+
*
|
|
2448
|
+
* Returns `undefined` — not `false` — when the cookie is absent or holds a
|
|
2449
|
+
* value this helper does not recognize, so a first-time visitor is
|
|
2450
|
+
* distinguishable from one who deliberately collapsed the sidebar. Collapse the
|
|
2451
|
+
* state into your own default at the call site with `?? true`.
|
|
2452
|
+
*
|
|
2453
|
+
* Never throws: a header is client-controlled, and a value with a malformed
|
|
2454
|
+
* percent-escape (`mantle-sidebar-state=%E0%A4%A`) is unparseable rather than
|
|
2455
|
+
* fatal, so one hostile or corrupt cookie cannot fail the server render on
|
|
2456
|
+
* every page load.
|
|
2457
|
+
*
|
|
2458
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#persisting-the-collapsed-state
|
|
2459
|
+
*
|
|
2460
|
+
* @example
|
|
2461
|
+
* ```ts
|
|
2462
|
+
* // app/root.tsx loader
|
|
2463
|
+
* export const loader = ({ request }: Route.LoaderArgs) => ({
|
|
2464
|
+
* sidebarOpen: extractSidebarStateCookie(request.headers.get("Cookie")) ?? true,
|
|
2465
|
+
* });
|
|
2466
|
+
* ```
|
|
2467
|
+
*
|
|
2468
|
+
* @param cookieHeader - The raw `Cookie` header string from the request, or null/undefined.
|
|
2469
|
+
* @returns `true` when expanded, `false` when collapsed, `undefined` when unset, undecodable, or unparseable.
|
|
2470
|
+
*/
|
|
2471
|
+
declare function extractSidebarStateCookie(cookieHeader: string | null | undefined): boolean | undefined;
|
|
2472
|
+
/**
|
|
2473
|
+
* Attributes for {@link serializeSidebarStateCookie}. Deliberately omits
|
|
2474
|
+
* `HttpOnly`: the browser writes this cookie from `onOpenChange`, so a
|
|
2475
|
+
* server-only cookie could never be updated when the user toggles the rail.
|
|
2476
|
+
*
|
|
2477
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#serializesidebarstatecookie
|
|
2478
|
+
*
|
|
2479
|
+
* @example
|
|
2480
|
+
* ```ts
|
|
2481
|
+
* serializeSidebarStateCookie(open, { maxAge: 60 * 60 * 24 * 365, sameSite: "Lax" });
|
|
2482
|
+
* ```
|
|
2483
|
+
*/
|
|
2484
|
+
type SerializeSidebarStateCookieOptions = {
|
|
2485
|
+
/**
|
|
2486
|
+
* How long the preference survives, in seconds.
|
|
2487
|
+
*
|
|
2488
|
+
* @default 31_536_000 // one year
|
|
2489
|
+
*/
|
|
2490
|
+
maxAge?: number;
|
|
2491
|
+
/**
|
|
2492
|
+
* The path the cookie applies to. Keep the default unless the sidebar only
|
|
2493
|
+
* exists under one route subtree.
|
|
2494
|
+
*
|
|
2495
|
+
* @default "/"
|
|
2496
|
+
*/
|
|
2497
|
+
path?: string;
|
|
2498
|
+
/**
|
|
2499
|
+
* The domain the cookie applies to. Omitted by default, which scopes it to
|
|
2500
|
+
* the exact current host. Set it (e.g. `".example.com"`) to share the
|
|
2501
|
+
* preference across subdomains.
|
|
2502
|
+
*/
|
|
2503
|
+
domain?: string;
|
|
2504
|
+
/**
|
|
2505
|
+
* `SameSite` policy. `"Lax"` is right for a UI preference — it survives
|
|
2506
|
+
* top-level navigations back to your app without riding along on
|
|
2507
|
+
* cross-site subrequests.
|
|
2508
|
+
*
|
|
2509
|
+
* @default "Lax"
|
|
2510
|
+
*/
|
|
2511
|
+
sameSite?: "Lax" | "Strict" | "None";
|
|
2512
|
+
/**
|
|
2513
|
+
* Whether to add the `Secure` attribute. Omitted by default so the same call
|
|
2514
|
+
* works on `http://localhost` — a `Secure` cookie is silently rejected over
|
|
2515
|
+
* http, which would make the preference appear not to persist in local
|
|
2516
|
+
* development. Set it to `true` in production if your CSP or policy requires
|
|
2517
|
+
* it; this cookie holds no secret, only whether a rail is open.
|
|
2518
|
+
*
|
|
2519
|
+
* @default false
|
|
2520
|
+
*/
|
|
2521
|
+
secure?: boolean;
|
|
2522
|
+
};
|
|
2523
|
+
/**
|
|
2524
|
+
* Serialize the sidebar's expanded state as a cookie string.
|
|
2525
|
+
*
|
|
2526
|
+
* Framework-agnostic by design: the returned string is valid for both
|
|
2527
|
+
* `document.cookie` on the client and a `Set-Cookie` response header on the
|
|
2528
|
+
* server, so the same helper covers whichever side of your app owns the write.
|
|
2529
|
+
*
|
|
2530
|
+
* @see https://mantle.ngrok.com/components/navigation/sidebar#persisting-the-collapsed-state
|
|
2531
|
+
*
|
|
2532
|
+
* @example
|
|
2533
|
+
* ```tsx
|
|
2534
|
+
* // client: persist as the user toggles, and render from the loader value
|
|
2535
|
+
* const { sidebarOpen } = useLoaderData<typeof loader>();
|
|
2536
|
+
* <Sidebar.Root
|
|
2537
|
+
* defaultOpen={sidebarOpen}
|
|
2538
|
+
* onOpenChange={(open) => {
|
|
2539
|
+
* document.cookie = serializeSidebarStateCookie(open);
|
|
2540
|
+
* }}
|
|
2541
|
+
* >
|
|
2542
|
+
* ```
|
|
2543
|
+
*
|
|
2544
|
+
* @example
|
|
2545
|
+
* ```ts
|
|
2546
|
+
* // server: set it from an action instead
|
|
2547
|
+
* return new Response(null, {
|
|
2548
|
+
* headers: { "Set-Cookie": serializeSidebarStateCookie(false, { secure: true }) },
|
|
2549
|
+
* });
|
|
2550
|
+
* ```
|
|
2551
|
+
*
|
|
2552
|
+
* @param open - Whether the sidebar is expanded.
|
|
2553
|
+
* @param options - Cookie attributes; see {@link SerializeSidebarStateCookieOptions}.
|
|
2554
|
+
* @returns A cookie string such as `mantle-sidebar-state=collapsed; Max-Age=31536000; Path=/; SameSite=Lax`.
|
|
2555
|
+
*/
|
|
2556
|
+
declare function serializeSidebarStateCookie(open: boolean, options?: SerializeSidebarStateCookieOptions): string;
|
|
2557
|
+
//#endregion
|
|
2558
|
+
export { SIDEBAR_STATE_COOKIE_NAME, type SerializeSidebarStateCookieOptions, Sidebar, type SidebarMobileBreakpoint, type SidebarState, extractSidebarStateCookie, serializeSidebarStateCookie, useSidebar };
|