@ngrok/mantle 0.88.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +10 -9
- package/dist/accordion.js +1 -1
- package/dist/agent.json +2 -1
- package/dist/{alert-DCVfviBx.d.ts → alert-BzPDUaU7.d.ts} +16 -15
- package/dist/alert-CZYYlx9q.js +1 -0
- package/dist/alert-center.d.ts +7 -7
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +17 -16
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-vfeV_hso.js +1 -0
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor-CgcbWEUs.js +1 -0
- package/dist/anchor.js +1 -1
- package/dist/app-layout.d.ts +1128 -45
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +41 -18
- package/dist/area-chart.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +1 -1
- package/dist/bar-chart.d.ts +37 -13
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.js +1 -1
- package/dist/button-69InNC_m.js +1 -0
- package/dist/button-BMfUxs_j.js +1 -0
- package/dist/{button-DO53OA70.d.ts → button-CHoYpOzx.d.ts} +5 -4
- package/dist/{button-B52_vczK.js → button-D8rr-1AB.js} +1 -1
- package/dist/{button-crUf0hbR.d.ts → button-DL7V4bzW.d.ts} +5 -4
- package/dist/button-b2HKEIE2.js +1 -0
- package/dist/{button-B5i9n7Qp.d.ts → button-mzUR1U0Y.d.ts} +5 -4
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +3 -2
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +8 -7
- package/dist/card.js +1 -1
- package/dist/centered-layout.js +1 -1
- package/dist/{chart-DgaWVBqi.d.ts → chart-23KQ1ZNO.d.ts} +128 -62
- package/dist/chart-BRkJfptA.js +2 -0
- package/dist/checkbox-C3N2afhB.js +1 -0
- package/dist/checkbox.d.ts +3 -2
- package/dist/checkbox.js +1 -1
- package/dist/{choice-PESu-9s8.d.ts → choice-BCiyqLgO.d.ts} +12 -11
- package/dist/choice-DQmecLfy.js +1 -0
- package/dist/choice.d.ts +1 -1
- package/dist/choice.js +1 -1
- package/dist/code-block-4Esx_gV-.js +12 -0
- package/dist/code-block.d.ts +17 -16
- package/dist/code-block.js +6 -6
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +2 -1
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +15 -14
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +13 -13
- package/dist/command.js +1 -1
- package/dist/cx-CK7o_rVv.js +1 -0
- package/dist/cx.js +1 -1
- package/dist/data-table.d.ts +32 -31
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +6 -6
- package/dist/description-list.js +1 -1
- package/dist/dialog-BDzapPLR.js +1 -0
- package/dist/{dialog-DXpqpdJj.d.ts → dialog-DQdeqvq-.d.ts} +28 -15
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-CWUzGFgf.d.ts +1 -0
- package/dist/{dropdown-menu-BloQKE_y.d.ts → dropdown-menu-CpRsyt_F.d.ts} +17 -17
- package/dist/dropdown-menu-CutWQ0bl.js +1 -0
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +7 -6
- package/dist/empty.js +1 -1
- package/dist/field.d.ts +16 -15
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +3 -2
- package/dist/flag.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +5 -4
- package/dist/hover-card.js +1 -1
- package/dist/icon-BudQMD2S.js +1 -0
- package/dist/icon-kK0c-POG.js +1 -0
- package/dist/{icon-w0HUe7tr.d.ts → icon-r2NvfTWW.d.ts} +3 -2
- package/dist/{icon-BmJ57Tgh.d.ts → icon-ucVgZeXn.d.ts} +3 -2
- package/dist/icon.d.ts +2 -2
- package/dist/icon.js +1 -1
- package/dist/icons-BMZnm4hM.js +1 -0
- package/dist/{icons-Bu-2boul.js → icons-CH3tD_wq.js} +1 -1
- package/dist/icons-CSwTVV2m.js +1 -0
- package/dist/icons.js +1 -1
- package/dist/in-view-Dxv_GrUU.js +1 -0
- package/dist/input-D_DjD9lT.js +1 -0
- package/dist/{input-DpnC3Xgj.d.ts → input-bbB1tC0h.d.ts} +3 -2
- package/dist/input.d.ts +5 -4
- package/dist/input.js +1 -1
- package/dist/kbd-CLHsJ99p.js +1 -0
- package/dist/kbd.d.ts +2 -1
- package/dist/kbd.js +1 -1
- package/dist/label-5T8i7I4X.js +1 -0
- package/dist/{label-Bnfe9YJ6.d.ts → label-C-KbNls8.d.ts} +3 -2
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/{layer-container-R7aux3n8.js → layer-container-DLf-6eBz.js} +1 -1
- package/dist/layer-container.js +1 -1
- package/dist/line-chart.d.ts +40 -15
- package/dist/line-chart.js +1 -1
- package/dist/list-DOVZoz9t.js +1 -0
- package/dist/list.d.ts +3 -2
- package/dist/list.js +1 -1
- package/dist/live-region-DQ1QLv3L.js +1 -0
- package/dist/live-region.d.ts +3 -2
- package/dist/live-region.js +1 -1
- package/dist/llms.txt +2 -1
- package/dist/{main-Dv2zuT_b.js → main-CC1L9IsH.js} +1 -1
- package/dist/main.js +1 -1
- package/dist/mantle.css +3 -0
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +23 -22
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +9 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +9 -8
- package/dist/pagination.js +1 -1
- package/dist/{popover-Cco1nw8I.d.ts → popover-Dvls7-j4.d.ts} +5 -4
- package/dist/popover-oQDUvcZ2.js +1 -0
- package/dist/popover.d.ts +1 -1
- package/dist/popover.js +1 -1
- package/dist/primitive-B-6XILB2.js +1 -0
- package/dist/progress.d.ts +9 -8
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +9 -8
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +19 -18
- package/dist/radio-group.js +1 -1
- package/dist/sandbar.d.ts +7 -7
- package/dist/sandbar.js +1 -1
- package/dist/{sandboxed-on-click-BLvvSqOP.js → sandboxed-on-click-C7pPu-2M.js} +1 -1
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/scatter-plot.d.ts +39 -14
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-BITJP7I5.d.ts → select-CxXb3aiC.d.ts} +3 -3
- package/dist/select-DcL0-duV.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +16 -15
- package/dist/selectable-list.js +1 -1
- package/dist/separator-DvPe27fH.js +1 -0
- package/dist/{separator-Bo4nY_3M.d.ts → separator-HzGvuD0B.d.ts} +4 -3
- package/dist/separator.d.ts +1 -1
- package/dist/separator.js +1 -1
- package/dist/sheet-DND_KjmS.js +1 -0
- package/dist/sheet.d.ts +13 -12
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +147 -93
- package/dist/sidebar.js +1 -1
- package/dist/skeleton-zfqoDAxT.js +1 -0
- package/dist/skeleton.d.ts +3 -2
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +3 -2
- package/dist/slider.js +1 -1
- package/dist/{slot-BsvE2ntj.js → slot-DdYN1L1C.js} +1 -1
- package/dist/{slot-DdgxmuI5.d.ts → slot-Q996Hqk9.d.ts} +1 -1
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +6 -5
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +3 -2
- package/dist/switch.js +1 -1
- package/dist/{table-DEI-qvSC.d.ts → table-BhzITa19.d.ts} +10 -9
- package/dist/table-DBbKqOVq.js +1 -0
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +2 -2
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +3 -2
- package/dist/text-area.js +1 -1
- package/dist/theme-BlCZHClJ.js +1 -0
- package/dist/theme-switcher.d.ts +3 -3
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +10 -9
- package/dist/toast.js +1 -1
- package/dist/{tooltip-nuUCoqq8.d.ts → tooltip-CngH7Kl6.d.ts} +7 -6
- package/dist/tooltip-NhYXqStK.js +1 -0
- package/dist/tooltip.d.ts +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/truncated-text.d.ts +138 -0
- package/dist/truncated-text.js +1 -0
- package/dist/types.js +1 -1
- package/dist/use-breakpoint--mo7kr9d.js +1 -0
- package/dist/use-is-hydrated-after-paint-r9Cl2mGp.js +1 -0
- package/dist/utils.js +1 -1
- package/dist/visually-hidden.d.ts +2 -1
- package/dist/visually-hidden.js +1 -1
- package/dist/well.d.ts +3 -2
- package/dist/well.js +1 -1
- package/package.json +16 -15
- package/dist/alert-OP_-aGJD.js +0 -1
- package/dist/anchor-BnMhJYS4.js +0 -1
- package/dist/button-BFpCB99R.js +0 -1
- package/dist/button-Dij5vCQG.js +0 -1
- package/dist/button-pwkdtR3U.js +0 -1
- package/dist/chart-aZLMj4xx.js +0 -2
- package/dist/checkbox-DbJSqSNN.js +0 -1
- package/dist/choice-SRyLguqU.js +0 -1
- package/dist/code-block-BE3Q0iAo.js +0 -12
- package/dist/cx-0HCjnNv1.js +0 -1
- package/dist/dialog-HIdb5d3I.js +0 -1
- package/dist/dropdown-menu-BR_AQNMj.js +0 -1
- package/dist/dropdown-menu-Dlpb7600.d.ts +0 -1
- package/dist/icon-BT8FnkkJ.js +0 -1
- package/dist/icon-U24NfYv7.js +0 -1
- package/dist/icons-BQRcOU6J.js +0 -1
- package/dist/icons-C3rVfpx9.js +0 -1
- package/dist/in-view-T_AAYaaF.js +0 -1
- package/dist/input-yq0jLE4e.js +0 -1
- package/dist/kbd-CJ8hNZfS.js +0 -1
- package/dist/label-BAy0Mg59.js +0 -1
- package/dist/list-BleZ-43e.js +0 -1
- package/dist/live-region-B2vJRvPH.js +0 -1
- package/dist/popover-BJ5XNwzD.js +0 -1
- package/dist/primitive-w3wFk2La.js +0 -1
- package/dist/select-CUWLEeuf.js +0 -1
- package/dist/separator-D98be0gY.js +0 -1
- package/dist/sheet-B5x8EO9Y.js +0 -1
- package/dist/skeleton-bVDP8BzY.js +0 -1
- package/dist/table-D2jh52KA.js +0 -1
- package/dist/theme-C1kFFdIk.js +0 -1
- package/dist/tooltip-H03l7E4Y.js +0 -1
- package/dist/use-is-hydrated-after-paint-Drj0lNi4.js +0 -1
- /package/dist/{types-D85fCNV3.js → css-properties-D85fCNV3.js} +0 -0
package/dist/sidebar.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
1
|
+
import { n as WithAsChild, t as SelfClosingWithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { t as WithDataSlot } from "./data-slot-CChfb_cv.js";
|
|
3
|
-
import { n as IconButtonProps } from "./button-
|
|
4
|
-
import { n as Separator } from "./separator-
|
|
5
|
-
import { t as Tooltip } from "./tooltip-
|
|
3
|
+
import { n as IconButtonProps } from "./button-DL7V4bzW.js";
|
|
4
|
+
import { n as Separator } from "./separator-HzGvuD0B.js";
|
|
5
|
+
import { t as Tooltip } from "./tooltip-CngH7Kl6.js";
|
|
6
6
|
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
7
7
|
//#region src/components/sidebar/sidebar.d.ts
|
|
8
8
|
/**
|
|
@@ -46,7 +46,8 @@ type SidebarState = {
|
|
|
46
46
|
open: boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Set the desktop expanded state. Calls `onOpenChange` and, when
|
|
49
|
-
* uncontrolled, updates the internal state.
|
|
49
|
+
* uncontrolled, updates the internal state. Keeps one identity across
|
|
50
|
+
* renders, so it is safe in an effect dependency list.
|
|
50
51
|
*/
|
|
51
52
|
setOpen: (open: boolean) => void;
|
|
52
53
|
/**
|
|
@@ -56,7 +57,8 @@ type SidebarState = {
|
|
|
56
57
|
/**
|
|
57
58
|
* Set the mobile sheet open state. Calls `onOpenMobileChange` and, when
|
|
58
59
|
* uncontrolled, updates the internal state. Use it to close the sheet on
|
|
59
|
-
* navigation.
|
|
60
|
+
* navigation. Keeps one identity across renders, so it is safe in an effect
|
|
61
|
+
* dependency list.
|
|
60
62
|
*/
|
|
61
63
|
setOpenMobile: (open: boolean) => void;
|
|
62
64
|
/**
|
|
@@ -244,7 +246,7 @@ type SidebarNavProps = ComponentProps<"div"> & WithDataSlot;
|
|
|
244
246
|
* both presentations (the desktop animator / the mobile `Sheet.Content`), so
|
|
245
247
|
* the width variables work anywhere:
|
|
246
248
|
* `className="[--sidebar-width:20rem] [--sidebar-width-mobile:20rem]"`.
|
|
247
|
-
* `aria-label` (default `"Main"`)
|
|
249
|
+
* The panel forwards `aria-label` (default `"Main"`) to the inner `<nav>` landmark.
|
|
248
250
|
*
|
|
249
251
|
* **CSS variables (public API):**
|
|
250
252
|
*
|
|
@@ -256,16 +258,16 @@ type SidebarNavProps = ComponentProps<"div"> & WithDataSlot;
|
|
|
256
258
|
* | `--sidebar-row-width` | `12rem` | Derived, not set: one row's width in the expanded panel (192px), for sizing surfaces that render *outside* it. See below and `Sidebar.SwitcherTrigger`. |
|
|
257
259
|
*
|
|
258
260
|
* `--sidebar-row-width` is `calc(var(--sidebar-width,13rem) - 1rem)`, declared
|
|
259
|
-
* at `:root` by `mantle.css
|
|
261
|
+
* at `:root` by `mantle.css`: the panel width minus the row gutter this
|
|
260
262
|
* component's regions apply.
|
|
261
263
|
*
|
|
262
|
-
*
|
|
263
|
-
* custom properties inherit, so set one on `Sidebar.Nav` to resize a single
|
|
264
|
+
* The panel reads each of the three widths with its default as the fallback,
|
|
265
|
+
* and custom properties inherit, so set one on `Sidebar.Nav` to resize a single
|
|
264
266
|
* sidebar or on any ancestor (`:root` in your global stylesheet) to resize
|
|
265
267
|
* every sidebar in the app. `--sidebar-row-width` resolves at `:root`, so a
|
|
266
268
|
* `--sidebar-width` override scoped to one `Sidebar.Nav` does not reach it in
|
|
267
|
-
* either direction
|
|
268
|
-
* opens from. Override `--sidebar-width` at `:root` to move both together, or
|
|
269
|
+
* either direction (a narrower panel leaves the floor *wider* than the row it
|
|
270
|
+
* opens from). Override `--sidebar-width` at `:root` to move both together, or
|
|
269
271
|
* set `--sidebar-row-width` on the outside surface itself.
|
|
270
272
|
*
|
|
271
273
|
* **Data attributes:**
|
|
@@ -275,7 +277,7 @@ type SidebarNavProps = ComponentProps<"div"> & WithDataSlot;
|
|
|
275
277
|
* | `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:`. |
|
|
276
278
|
* | `data-hydrated` | present one frame after hydration | Presence-only, desktop panel surface. The panel's pre-hydration visibility gate, its width transition, and descendant collapse transitions all key off its absence in CSS (`not-data-hydrated:`, `group-not-data-hydrated/sidebar-nav:`). The stamp waits one frame, so an SSR state correction paints first and snaps instead of animating on page load. |
|
|
277
279
|
* | `data-mobile` | present in the mobile sheet | Presence-only. Marks the `Sheet.Content` presentation used below the root's `mobileBreakpoint`. |
|
|
278
|
-
* | `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
|
|
280
|
+
* | `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. |
|
|
279
281
|
*
|
|
280
282
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarnav
|
|
281
283
|
*
|
|
@@ -400,10 +402,13 @@ type SidebarTriggerProps = Omit<IconButtonProps, "appearance" | "asChild" | "chi
|
|
|
400
402
|
* | Data Attribute | Value | Description |
|
|
401
403
|
* | --- | --- | --- |
|
|
402
404
|
* | `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`. |
|
|
403
|
-
* | `data-slot` | `"sidebar-trigger-
|
|
405
|
+
* | `data-slot` | `"sidebar-trigger icon-button"` | On the button: the part's slot, joined ahead of `IconButton`'s own. |
|
|
406
|
+
* | `data-slot` | `"sidebar-trigger-tooltip tooltip-content"` | On the tooltip surface, not the button: the styling hook for the label-and-chord popup this part renders, joined ahead of `Tooltip.Content`'s own slot. |
|
|
407
|
+
* | `data-state` | `"delayed-open"` \| `"instant-open"` \| `"closed"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
408
|
+
* | `data-side` | `"top"` \| `"right"` \| `"bottom"` \| `"left"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
404
409
|
* | `data-slot` | `"sidebar-tooltip-row"` | Inside that surface, on the flex row holding the label and the optional chord chips. Nested inside `Tooltip.Content`'s own `tooltip-label` div. Always present. |
|
|
405
410
|
* | `data-slot` | `"sidebar-tooltip-label"` | On the `<span>` wrapping `label` inside that row. Always present, and `display: contents`, so the label stays a flex item of the row. |
|
|
406
|
-
* | `data-slot` | `"sidebar-tooltip-shortcut"` | On the chord chips. Present only while `shortcut` holds something. |
|
|
411
|
+
* | `data-slot` | `"sidebar-tooltip-shortcut"` | On the chord chips. Present only while `shortcut` holds something. Carries `translate="no"`: a chord is a key name, not prose. |
|
|
407
412
|
* | `data-appearance` | `"filled"` \| `"ghost"` \| `"outlined"` | Read, not stamped: the underlying `IconButton` reflects its `appearance`, which this part defaults to `"ghost"`. |
|
|
408
413
|
* | `data-intent` | `"neutral"` | Read, not stamped: the underlying `IconButton` reflects its `intent`, and it draws the neutral tone only. |
|
|
409
414
|
* | `data-size` | `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` | Read, not stamped: the underlying `IconButton` reflects its `size` and its own `"md"` default. |
|
|
@@ -565,8 +570,8 @@ type SidebarBodyProps = ComponentProps<"div"> & WithAsChild & WithDataSlot;
|
|
|
565
570
|
* The scrollable middle region of a `Sidebar.Nav`, growing to fill the space
|
|
566
571
|
* between `Sidebar.Header` and `Sidebar.Footer`. Holds the navigation
|
|
567
572
|
* `Sidebar.Group` children. Overflowing edges fade out via the
|
|
568
|
-
* `scroll-fade-y` mask; inside the collapsed icon rail the scrollbar
|
|
569
|
-
* reserved gutter
|
|
573
|
+
* `scroll-fade-y` mask; inside the collapsed icon rail it hides the scrollbar
|
|
574
|
+
* and its reserved gutter, so the fade is the only overflow signal.
|
|
570
575
|
*
|
|
571
576
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarbody
|
|
572
577
|
*
|
|
@@ -745,9 +750,9 @@ type SidebarGroupLabelProps = ComponentProps<"div"> & WithAsChild & WithDataSlot
|
|
|
745
750
|
/**
|
|
746
751
|
* The muted label of a `Sidebar.Group`, rendered above its `Sidebar.List`.
|
|
747
752
|
* Renders a `<div>` (not a heading, so the sidebar never dictates the page's
|
|
748
|
-
* heading outline); inside a `Sidebar.Group`
|
|
749
|
-
*
|
|
750
|
-
*
|
|
753
|
+
* heading outline); inside a `Sidebar.Group` the group links it to the
|
|
754
|
+
* sibling list via `aria-labelledby`. Pass `asChild` to render a heading at a
|
|
755
|
+
* level you control.
|
|
751
756
|
*
|
|
752
757
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebargrouplabel
|
|
753
758
|
*
|
|
@@ -926,8 +931,8 @@ type SidebarItemButtonProps = ComponentProps<"button"> & WithAsChild & WithDataS
|
|
|
926
931
|
* `data-current` styling state. Consumers control it from their router,
|
|
927
932
|
* e.g. `current={pathname === "/endpoints"}`.
|
|
928
933
|
*
|
|
929
|
-
* A composed child that sets `aria-current="page"` itself
|
|
930
|
-
* `NavLink` does
|
|
934
|
+
* A composed child that sets `aria-current="page"` itself (react-router's
|
|
935
|
+
* `NavLink` does) already gets the current-row treatment, so it needs no
|
|
931
936
|
* `current`. This prop is for the rows whose parent knows.
|
|
932
937
|
*/
|
|
933
938
|
current?: boolean;
|
|
@@ -939,7 +944,7 @@ type SidebarItemButtonProps = ComponentProps<"button"> & WithAsChild & WithDataS
|
|
|
939
944
|
* `data-current` visual state.
|
|
940
945
|
*
|
|
941
946
|
* The current-row treatment follows either attribute, so a composed child that
|
|
942
|
-
* marks itself as the current page gets it without `current
|
|
947
|
+
* marks itself as the current page gets it without `current`: a react-router
|
|
943
948
|
* `NavLink` needs nothing but its `to`, since it already resolved the match the
|
|
944
949
|
* parent would otherwise re-derive:
|
|
945
950
|
*
|
|
@@ -952,22 +957,22 @@ type SidebarItemButtonProps = ComponentProps<"button"> & WithAsChild & WithDataS
|
|
|
952
957
|
* </Sidebar.ItemButton>
|
|
953
958
|
* ```
|
|
954
959
|
*
|
|
955
|
-
* The row sizes its **leading** icon to 20px
|
|
956
|
-
*
|
|
960
|
+
* The row sizes its **leading** icon to 20px. Trailing visuals (a caret, a
|
|
961
|
+
* count, a status dot) size themselves, so a row composed with
|
|
957
962
|
* `DropdownMenu.Trigger asChild` can end in `<CaretDownIcon className="text-muted
|
|
958
|
-
* ml-auto size-4 shrink-0"
|
|
959
|
-
* (`data-state="open"`, supplied by the trigger). Give that menu the same
|
|
960
|
-
* floor the switcher rows use
|
|
961
|
-
* it keeps the expanded row's width instead of shrinking to this row's 28px
|
|
963
|
+
* ml-auto size-4 shrink-0" />`. That row stays highlighted while its menu is
|
|
964
|
+
* open (`data-state="open"`, supplied by the trigger). Give that menu the same
|
|
965
|
+
* width floor the switcher rows use, `className="min-w-(--sidebar-row-width)"`,
|
|
966
|
+
* so it keeps the expanded row's width instead of shrinking to this row's 28px
|
|
962
967
|
* rail chip (see `Sidebar.SwitcherTrigger` for the whole contract).
|
|
963
968
|
*
|
|
964
969
|
* **Data attributes:**
|
|
965
970
|
*
|
|
966
971
|
* | Data Attribute | Value | Description |
|
|
967
972
|
* | --- | --- | --- |
|
|
968
|
-
* | `data-current` | present when `current` | Presence-only
|
|
973
|
+
* | `data-current` | present when `current` | Presence-only, never `"false"`, since the `data-current:` variant matches the attribute's existence. Styles the current row. |
|
|
969
974
|
* | `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. |
|
|
970
|
-
* | `data-state` | `"open"` | **Read, not stamped
|
|
975
|
+
* | `data-state` | `"open"` \| `"closed"` | **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. Inside `Sidebar.Tooltip` the tooltip's own `data-state` replaces this one, so the open highlight also keys on `aria-expanded`. |
|
|
971
976
|
*
|
|
972
977
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaritembutton
|
|
973
978
|
*
|
|
@@ -1090,9 +1095,9 @@ type SidebarSearchTriggerProps = ComponentProps<"button"> & WithDataSlot & ({
|
|
|
1090
1095
|
* | Data Attribute | Value | Description |
|
|
1091
1096
|
* | --- | --- | --- |
|
|
1092
1097
|
* | `data-slot` | `"sidebar-search-trigger"` | On the row element. |
|
|
1093
|
-
* | `data-slot` | `"sidebar-search-trigger-label"` | On the `<span>` wrapping `children` on the default `button` path. Absent under `asChild`, which renders no sibling. |
|
|
1094
|
-
* | `data-slot` | `"sidebar-search-trigger-shortcut"` | On the chord chips. Always present on the default `button` path, and `display: none` while it is empty. Absent under `asChild`, where the props union forbids `shortcut`. |
|
|
1095
|
-
* | `data-state` | `"open"` \| `"closed"` | **Read, not stamped
|
|
1098
|
+
* | `data-slot` | `"sidebar-search-trigger-label"` | On the `<span>` wrapping `children` on the default `button` path. Absent under `asChild`, which renders no sibling. Always `display: contents`, so your icon and label stay flex items of the row. |
|
|
1099
|
+
* | `data-slot` | `"sidebar-search-trigger-shortcut"` | On the chord chips. Always present on the default `button` path, and `display: none` while it is empty. Absent under `asChild`, where the props union forbids `shortcut`. Carries `translate="no"`: a chord is a key name, not prose. |
|
|
1100
|
+
* | `data-state` | `"open"` \| `"closed"` | **Read, not stamped**: supplied by the composing `Command.SearchTrigger` / `Dialog.Trigger`. The row stays highlighted while its palette is open. |
|
|
1096
1101
|
*
|
|
1097
1102
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarsearchtrigger
|
|
1098
1103
|
*
|
|
@@ -1154,35 +1159,33 @@ type SidebarSwitcherTriggerProps = ComponentProps<"button"> & WithAsChild & With
|
|
|
1154
1159
|
/**
|
|
1155
1160
|
* The styled row for the sidebar's switchers: the app/product switcher in
|
|
1156
1161
|
* `Sidebar.Header` and the account/user row in `Sidebar.Footer`. A styled
|
|
1157
|
-
* button only
|
|
1162
|
+
* button only: it is not wired to any state. Compose it with
|
|
1158
1163
|
* `DropdownMenu.Trigger asChild` or `Dialog.Trigger asChild`, which supply
|
|
1159
1164
|
* the open state (`data-state="open"` styling comes for free from those
|
|
1160
1165
|
* primitives).
|
|
1161
1166
|
*
|
|
1162
|
-
* Inside the collapsed icon rail, the row collapses to
|
|
1163
|
-
*
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
1166
|
-
*
|
|
1167
|
+
* Inside the collapsed icon rail, the row collapses to its **first child
|
|
1168
|
+
* element**, the leading visual (product icon, account avatar), and the
|
|
1169
|
+
* remaining children become visually hidden while staying in the
|
|
1170
|
+
* accessibility tree, so the button's accessible name is unchanged. Wrap
|
|
1171
|
+
* loose text in an element (e.g. a `<span>`) so it participates.
|
|
1167
1172
|
*
|
|
1168
|
-
* A menu opened from the row should be as wide as the row
|
|
1173
|
+
* A menu opened from the row should be as wide as the row. `width="trigger"`
|
|
1169
1174
|
* does that while the panel is expanded, but the row shrinks to a 36px chip in
|
|
1170
1175
|
* the icon rail and would drag the menu down to it. Floor the menu at the
|
|
1171
|
-
* expanded row width with `className="min-w-(--sidebar-row-width)"
|
|
1176
|
+
* expanded row width with `className="min-w-(--sidebar-row-width)"`, the
|
|
1172
1177
|
* token `mantle.css` declares at `:root` for exactly this, since the menu
|
|
1173
|
-
* renders in a portal and inherits nothing from the panel.
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
* `--sidebar-width`
|
|
1178
|
-
* `--sidebar-width-mobile` whenever you widen `--sidebar-width`, or the floor
|
|
1179
|
-
* overhangs the sheet.
|
|
1178
|
+
* renders in a portal and inherits nothing from the panel.
|
|
1179
|
+
*
|
|
1180
|
+
* - The floor is a no-op while the panel is expanded: the row already measures that wide.
|
|
1181
|
+
* - In the mobile sheet the floor is inert as long as the sheet's row is the wider of the two: `--sidebar-width-mobile` minus `1.5rem` and the sheet's 1px border, vs `--sidebar-width` minus `1rem` (263px vs 192px at the defaults).
|
|
1182
|
+
* - Widen `--sidebar-width-mobile` whenever you widen `--sidebar-width`, or the floor overhangs the sheet.
|
|
1180
1183
|
*
|
|
1181
1184
|
* **Data attributes:**
|
|
1182
1185
|
*
|
|
1183
1186
|
* | Data Attribute | Value | Description |
|
|
1184
1187
|
* | --- | --- | --- |
|
|
1185
|
-
* | `data-state` | `"open"` | **Read, not stamped
|
|
1188
|
+
* | `data-state` | `"open"` \| `"closed"` | **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. Inside `Sidebar.Tooltip` the tooltip's own `data-state` replaces this one, so the open highlight also keys on `aria-expanded`. |
|
|
1186
1189
|
*
|
|
1187
1190
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarswitchertrigger
|
|
1188
1191
|
*
|
|
@@ -1238,10 +1241,10 @@ type SidebarSwitcherTriggerProps = ComponentProps<"button"> & WithAsChild & With
|
|
|
1238
1241
|
*/
|
|
1239
1242
|
declare const SwitcherTrigger: ({ asChild, children, className, "data-slot": dataSlot, type, ...props }: SidebarSwitcherTriggerProps) => import("react").JSX.Element;
|
|
1240
1243
|
/**
|
|
1241
|
-
* The props for `Sidebar.Tooltip`. `Tooltip.Content`'s props
|
|
1242
|
-
* `style`, `ref`,
|
|
1243
|
-
*
|
|
1244
|
-
*
|
|
1244
|
+
* The props for `Sidebar.Tooltip`. `Tooltip.Content`'s props (so `className`,
|
|
1245
|
+
* `style`, `ref`, and any `data-*` reach the tooltip surface), except the parts
|
|
1246
|
+
* this row owns: `children` is the row being labeled (not the tooltip body,
|
|
1247
|
+
* which is `label`), and `side` becomes optional with a sidebar default.
|
|
1245
1248
|
*/
|
|
1246
1249
|
type SidebarTooltipProps = Omit<ComponentProps<typeof Tooltip.Content>, "children" | "side"> & WithDataSlot & {
|
|
1247
1250
|
/**
|
|
@@ -1255,7 +1258,9 @@ type SidebarTooltipProps = Omit<ComponentProps<typeof Tooltip.Content>, "childre
|
|
|
1255
1258
|
children: ReactElement;
|
|
1256
1259
|
/**
|
|
1257
1260
|
* What the tooltip says. Normally the row's own label text: the rail clips the
|
|
1258
|
-
* visible one, so this is what a sighted pointer user reads.
|
|
1261
|
+
* visible one, so this is what a sighted pointer user reads. Required: the
|
|
1262
|
+
* rail is the only state that shows a label, so there is no text to fall
|
|
1263
|
+
* back to.
|
|
1259
1264
|
*/
|
|
1260
1265
|
label: ReactNode;
|
|
1261
1266
|
/**
|
|
@@ -1309,19 +1314,22 @@ type SidebarTooltipProps = Omit<ComponentProps<typeof Tooltip.Content>, "childre
|
|
|
1309
1314
|
* needs a real element to clone.
|
|
1310
1315
|
*
|
|
1311
1316
|
* `children` is the row; `label` is what the tooltip says. Every other prop is
|
|
1312
|
-
* `Tooltip.Content`'s and lands on the tooltip surface
|
|
1313
|
-
* `ref`, `data-*`, positioning props such as `align` and `sideOffset
|
|
1314
|
-
* `
|
|
1315
|
-
* to `"right"` so the tooltip opens away from the rail.
|
|
1317
|
+
* `Tooltip.Content`'s and lands on the tooltip surface: `className`, `style`,
|
|
1318
|
+
* `ref`, `data-*`, and positioning props such as `align` and `sideOffset`.
|
|
1319
|
+
* `side` defaults to `"right"`, so the tooltip opens away from the rail.
|
|
1316
1320
|
*
|
|
1317
1321
|
* **Data attributes:**
|
|
1318
1322
|
*
|
|
1319
1323
|
* | Data Attribute | Value | Description |
|
|
1320
1324
|
* | --- | --- | --- |
|
|
1321
|
-
* | `data-slot` | `"sidebar-tooltip"` | On the tooltip surface. |
|
|
1325
|
+
* | `data-slot` | `"sidebar-tooltip tooltip-content"` | On the tooltip surface, with any forwarded chain ahead of it and `Tooltip.Content`'s own slot after it. |
|
|
1326
|
+
* | `data-state` | `"delayed-open"` \| `"instant-open"` \| `"closed"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
1327
|
+
* | `data-side` | `"top"` \| `"right"` \| `"bottom"` \| `"left"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. The resolved side, `"right"` by default. |
|
|
1328
|
+
* | `data-align` | `"start"` \| `"center"` \| `"end"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
1322
1329
|
* | `data-slot` | `"sidebar-tooltip-row"` | Inside that surface, on the flex row holding the label and the optional chord chips. Nested inside `Tooltip.Content`'s own `tooltip-label` div. Always present, so a chord that arrives later appends instead of replacing the label. |
|
|
1323
1330
|
* | `data-slot` | `"sidebar-tooltip-label"` | On the `<span>` wrapping `label` inside that row. Always present, and `display: contents`, so the label stays a flex item of the row. |
|
|
1324
|
-
* | `data-slot` | `"sidebar-tooltip-shortcut"` | On the chord chips. Present only while `shortcut` holds something. |
|
|
1331
|
+
* | `data-slot` | `"sidebar-tooltip-shortcut"` | On the chord chips. Present only while `shortcut` holds something. Carries `translate="no"`: a chord is a key name, not prose. |
|
|
1332
|
+
* | `data-state` | `"delayed-open"` \| `"instant-open"` \| `"closed"` | On the wrapped row, from `Tooltip.Trigger`. `"closed"` outside the collapsed rail, where this part vetoes the open state. |
|
|
1325
1333
|
*
|
|
1326
1334
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebartooltip
|
|
1327
1335
|
*
|
|
@@ -1330,6 +1338,18 @@ type SidebarTooltipProps = Omit<ComponentProps<typeof Tooltip.Content>, "childre
|
|
|
1330
1338
|
* <TooltipProvider>
|
|
1331
1339
|
* <Sidebar.Root>
|
|
1332
1340
|
* <Sidebar.Nav aria-label="Main">
|
|
1341
|
+
* <Sidebar.Header>
|
|
1342
|
+
* <DropdownMenu.Root>
|
|
1343
|
+
* <DropdownMenu.Trigger asChild>
|
|
1344
|
+
* <Sidebar.SwitcherTrigger>
|
|
1345
|
+
* <GlobeIcon />
|
|
1346
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-base">Universal Gateway</span>
|
|
1347
|
+
* <CaretDownIcon className="text-muted size-4 shrink-0" />
|
|
1348
|
+
* </Sidebar.SwitcherTrigger>
|
|
1349
|
+
* </DropdownMenu.Trigger>
|
|
1350
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
1351
|
+
* </DropdownMenu.Root>
|
|
1352
|
+
* </Sidebar.Header>
|
|
1333
1353
|
* <Sidebar.Body>
|
|
1334
1354
|
* <Sidebar.Group>
|
|
1335
1355
|
* <Sidebar.GroupLabel>Traffic</Sidebar.GroupLabel>
|
|
@@ -1348,16 +1368,19 @@ type SidebarTooltipProps = Omit<ComponentProps<typeof Tooltip.Content>, "childre
|
|
|
1348
1368
|
* </Sidebar.Group>
|
|
1349
1369
|
* </Sidebar.Body>
|
|
1350
1370
|
* <Sidebar.Footer>
|
|
1371
|
+
* <Sidebar.Separator />
|
|
1351
1372
|
* <DropdownMenu.Root>
|
|
1352
|
-
* <Sidebar.Tooltip label="
|
|
1373
|
+
* <Sidebar.Tooltip label="Acme Corp">
|
|
1353
1374
|
* <DropdownMenu.Trigger asChild>
|
|
1354
|
-
* <Sidebar.
|
|
1355
|
-
* <
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1375
|
+
* <Sidebar.SwitcherTrigger>
|
|
1376
|
+
* <Avatar.Root appearance="square" colorSeed="acc_123">
|
|
1377
|
+
* <Avatar.Fallback name="Acme Corp" />
|
|
1378
|
+
* </Avatar.Root>
|
|
1379
|
+
* <span className="text-strong min-w-0 flex-1 truncate text-sm font-medium">Acme Corp</span>
|
|
1380
|
+
* </Sidebar.SwitcherTrigger>
|
|
1358
1381
|
* </DropdownMenu.Trigger>
|
|
1359
1382
|
* </Sidebar.Tooltip>
|
|
1360
|
-
* <DropdownMenu.Content>…</DropdownMenu.Content>
|
|
1383
|
+
* <DropdownMenu.Content width="trigger" className="min-w-(--sidebar-row-width)">…</DropdownMenu.Content>
|
|
1361
1384
|
* </DropdownMenu.Root>
|
|
1362
1385
|
* </Sidebar.Footer>
|
|
1363
1386
|
* </Sidebar.Nav>
|
|
@@ -1367,14 +1390,22 @@ type SidebarTooltipProps = Omit<ComponentProps<typeof Tooltip.Content>, "childre
|
|
|
1367
1390
|
* ```
|
|
1368
1391
|
*/
|
|
1369
1392
|
declare const SidebarTooltip: ({ children, "data-slot": dataSlot, label, shortcut, side, ...props }: SidebarTooltipProps) => import("react").JSX.Element;
|
|
1370
|
-
type SidebarSeparatorProps = ComponentProps<typeof Separator> & WithDataSlot;
|
|
1393
|
+
type SidebarSeparatorProps = Omit<ComponentProps<typeof Separator>, "asChild" | "children"> & SelfClosingWithAsChild & WithDataSlot;
|
|
1371
1394
|
/**
|
|
1372
1395
|
* An inset hairline between sidebar regions. Composes the mantle `Separator`,
|
|
1373
1396
|
* staying aligned with the `px-3` content padding of `Sidebar.Body` and
|
|
1374
1397
|
* `Sidebar.Footer` (it deliberately does not run edge to edge) with `my-3`
|
|
1375
|
-
* breathing room above and below.
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1398
|
+
* breathing room above and below. In the icon rail it narrows to the 36px chip
|
|
1399
|
+
* width of `Sidebar.SwitcherTrigger`, 8px wider than the rail's 28px row chips,
|
|
1400
|
+
* so it stays optically centered between the viewport edge and the content
|
|
1401
|
+
* card.
|
|
1402
|
+
*
|
|
1403
|
+
* **Data attributes:**
|
|
1404
|
+
*
|
|
1405
|
+
* | Data Attribute | Value | Description |
|
|
1406
|
+
* | --- | --- | --- |
|
|
1407
|
+
* | `data-orientation` | `"horizontal"` \| `"vertical"` | Read, not stamped: `Separator` reflects its `orientation` prop, `"horizontal"` by default, after a `HorizontalSeparatorGroup` ancestor wins. |
|
|
1408
|
+
* | `data-separator` | present | Read, not stamped: presence-only, from `Separator`. Lets a `HorizontalSeparatorGroup` exempt it from `shrink-0`. |
|
|
1378
1409
|
*
|
|
1379
1410
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarseparator
|
|
1380
1411
|
*
|
|
@@ -1442,6 +1473,11 @@ declare const SidebarSeparator: ({ className, "data-slot": dataSlot, ...props }:
|
|
|
1442
1473
|
* The component is routing-agnostic: compose router links via `asChild` on
|
|
1443
1474
|
* `Sidebar.ItemButton` and drive `current` from your router's location.
|
|
1444
1475
|
*
|
|
1476
|
+
* Reach for it for the app's primary navigation on the start edge of an
|
|
1477
|
+
* `AppLayout`. A surface that opens beside the page for an assistant or a
|
|
1478
|
+
* details pane is `AppLayout.SidePanel`; a modal drawer is `Sheet`; switching
|
|
1479
|
+
* sections inside one page is `Tabs`.
|
|
1480
|
+
*
|
|
1445
1481
|
* @see https://mantle.ngrok.com/components/navigation/sidebar
|
|
1446
1482
|
*
|
|
1447
1483
|
* @example
|
|
@@ -1588,7 +1624,7 @@ declare const Sidebar: {
|
|
|
1588
1624
|
* | `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:`. |
|
|
1589
1625
|
* | `data-hydrated` | present one frame after hydration | Presence-only, desktop panel surface. The panel's pre-hydration visibility gate, its width transition, and descendant collapse transitions all key off its absence in CSS (`not-data-hydrated:`, `group-not-data-hydrated/sidebar-nav:`). The stamp waits one frame, so an SSR state correction paints first and snaps instead of animating on page load. |
|
|
1590
1626
|
* | `data-mobile` | present in the mobile sheet | Presence-only. Marks the `Sheet.Content` presentation used below the root's `mobileBreakpoint`. |
|
|
1591
|
-
* | `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
|
|
1627
|
+
* | `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. |
|
|
1592
1628
|
*
|
|
1593
1629
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarnav
|
|
1594
1630
|
*
|
|
@@ -1652,6 +1688,12 @@ declare const Sidebar: {
|
|
|
1652
1688
|
* | Data Attribute | Value | Description |
|
|
1653
1689
|
* | --- | --- | --- |
|
|
1654
1690
|
* | `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`. |
|
|
1691
|
+
* | `data-slot` | `"sidebar-trigger-tooltip"` | On the tooltip surface, not the button: the styling hook for the label-and-chord popup this part renders. |
|
|
1692
|
+
* | `data-state` | `"delayed-open"` \| `"instant-open"` \| `"closed"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
1693
|
+
* | `data-side` | `"top"` \| `"right"` \| `"bottom"` \| `"left"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
1694
|
+
* | `data-slot` | `"sidebar-tooltip-row"` | Inside that surface, on the flex row holding the label and the optional chord chips. Nested inside `Tooltip.Content`'s own `tooltip-label` div. Always present. |
|
|
1695
|
+
* | `data-slot` | `"sidebar-tooltip-label"` | On the `<span>` wrapping `label` inside that row. Always present, and `display: contents`, so the label stays a flex item of the row. |
|
|
1696
|
+
* | `data-slot` | `"sidebar-tooltip-shortcut"` | On the chord chips. Present only while `shortcut` holds something. Carries `translate="no"`: a chord is a key name, not prose. |
|
|
1655
1697
|
* | `data-appearance` | `"filled"` \| `"ghost"` \| `"outlined"` | Read, not stamped: the underlying `IconButton` reflects its `appearance`, which this part defaults to `"ghost"`. |
|
|
1656
1698
|
* | `data-intent` | `"neutral"` | Read, not stamped: the underlying `IconButton` reflects its `intent`, and it draws the neutral tone only. |
|
|
1657
1699
|
* | `data-size` | `"xs"` \| `"sm"` \| `"md"` \| `"lg"` \| `"xl"` | Read, not stamped: the underlying `IconButton` reflects its `size` and its own `"md"` default. |
|
|
@@ -2115,9 +2157,9 @@ declare const Sidebar: {
|
|
|
2115
2157
|
*
|
|
2116
2158
|
* | Data Attribute | Value | Description |
|
|
2117
2159
|
* | --- | --- | --- |
|
|
2118
|
-
* | `data-current` | present when `current` | Presence-only
|
|
2160
|
+
* | `data-current` | present when `current` | Presence-only, never `"false"`, since the `data-current:` variant matches the attribute's existence. Styles the current row. |
|
|
2119
2161
|
* | `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. |
|
|
2120
|
-
* | `data-state` | `"open"` | **Read, not stamped
|
|
2162
|
+
* | `data-state` | `"open"` \| `"closed"` | **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. Inside `Sidebar.Tooltip` the tooltip's own `data-state` replaces this one, so the open highlight also keys on `aria-expanded`. |
|
|
2121
2163
|
*
|
|
2122
2164
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebaritembutton
|
|
2123
2165
|
*
|
|
@@ -2184,9 +2226,9 @@ declare const Sidebar: {
|
|
|
2184
2226
|
* | Data Attribute | Value | Description |
|
|
2185
2227
|
* | --- | --- | --- |
|
|
2186
2228
|
* | `data-slot` | `"sidebar-search-trigger"` | On the row element. |
|
|
2187
|
-
* | `data-slot` | `"sidebar-search-trigger-label"` | On the `<span>` wrapping `children` on the default `button` path. Absent under `asChild`, which renders no sibling. |
|
|
2188
|
-
* | `data-slot` | `"sidebar-search-trigger-shortcut"` | On the chord chips. Always present on the default `button` path, and `display: none` while it is empty. Absent under `asChild`, where the props union forbids `shortcut`. |
|
|
2189
|
-
* | `data-state` | `"open"` \| `"closed"` | **Read, not stamped
|
|
2229
|
+
* | `data-slot` | `"sidebar-search-trigger-label"` | On the `<span>` wrapping `children` on the default `button` path. Absent under `asChild`, which renders no sibling. Always `display: contents`, so your icon and label stay flex items of the row. |
|
|
2230
|
+
* | `data-slot` | `"sidebar-search-trigger-shortcut"` | On the chord chips. Always present on the default `button` path, and `display: none` while it is empty. Absent under `asChild`, where the props union forbids `shortcut`. Carries `translate="no"`: a chord is a key name, not prose. |
|
|
2231
|
+
* | `data-state` | `"open"` \| `"closed"` | **Read, not stamped**: supplied by the composing `Command.SearchTrigger` / `Dialog.Trigger`. Style the row while its palette is open with `data-state-open:`. |
|
|
2190
2232
|
*
|
|
2191
2233
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarsearchtrigger
|
|
2192
2234
|
*
|
|
@@ -2245,14 +2287,14 @@ declare const Sidebar: {
|
|
|
2245
2287
|
*/
|
|
2246
2288
|
readonly SearchTrigger: typeof SearchTrigger;
|
|
2247
2289
|
/**
|
|
2248
|
-
* The styled switcher row for the header/footer. Not state-wired
|
|
2290
|
+
* The styled switcher row for the header/footer. Not state-wired: compose
|
|
2249
2291
|
* with `DropdownMenu.Trigger asChild` or `Dialog.Trigger asChild`.
|
|
2250
2292
|
*
|
|
2251
2293
|
* **Data attributes:**
|
|
2252
2294
|
*
|
|
2253
2295
|
* | Data Attribute | Value | Description |
|
|
2254
2296
|
* | --- | --- | --- |
|
|
2255
|
-
* | `data-state` | `"open"` | **Read, not stamped
|
|
2297
|
+
* | `data-state` | `"open"` \| `"closed"` | **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. Inside `Sidebar.Tooltip` the tooltip's own `data-state` replaces this one, so the open highlight also keys on `aria-expanded`. |
|
|
2256
2298
|
*
|
|
2257
2299
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarswitchertrigger
|
|
2258
2300
|
*
|
|
@@ -2308,19 +2350,23 @@ declare const Sidebar: {
|
|
|
2308
2350
|
*/
|
|
2309
2351
|
readonly SwitcherTrigger: typeof SwitcherTrigger;
|
|
2310
2352
|
/**
|
|
2311
|
-
* Labels a row while the panel is collapsed to the icon rail
|
|
2353
|
+
* Labels a row while the panel is collapsed to the icon rail: wrap it
|
|
2312
2354
|
* around a `Sidebar.ItemButton` or `Sidebar.SwitcherTrigger`. Requires a
|
|
2313
|
-
* `TooltipProvider` ancestor. Takes `Tooltip.Content`'s props
|
|
2314
|
-
*
|
|
2355
|
+
* `TooltipProvider` ancestor. Takes `Tooltip.Content`'s props on the
|
|
2356
|
+
* tooltip surface; `side` defaults to `"right"`.
|
|
2315
2357
|
*
|
|
2316
2358
|
* **Data attributes:**
|
|
2317
2359
|
*
|
|
2318
2360
|
* | Data Attribute | Value | Description |
|
|
2319
2361
|
* | --- | --- | --- |
|
|
2320
|
-
* | `data-slot` | `"sidebar-tooltip"` | On the tooltip surface. |
|
|
2362
|
+
* | `data-slot` | `"sidebar-tooltip tooltip-content"` | On the tooltip surface, with any forwarded chain ahead of it and `Tooltip.Content`'s own slot after it. |
|
|
2363
|
+
* | `data-state` | `"delayed-open"` \| `"instant-open"` \| `"closed"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
2364
|
+
* | `data-side` | `"top"` \| `"right"` \| `"bottom"` \| `"left"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. The resolved side, `"right"` by default. |
|
|
2365
|
+
* | `data-align` | `"start"` \| `"center"` \| `"end"` | Read, not stamped: on the tooltip surface, from `Tooltip.Content`. |
|
|
2321
2366
|
* | `data-slot` | `"sidebar-tooltip-row"` | Inside that surface, on the flex row holding the label and the optional chord chips. Nested inside `Tooltip.Content`'s own `tooltip-label` div. Always present, so a chord that arrives later appends instead of replacing the label. |
|
|
2322
2367
|
* | `data-slot` | `"sidebar-tooltip-label"` | On the `<span>` wrapping `label` inside that row. Always present, and `display: contents`, so the label stays a flex item of the row. |
|
|
2323
|
-
* | `data-slot` | `"sidebar-tooltip-shortcut"` | On the chord chips. Present only while `shortcut` holds something. |
|
|
2368
|
+
* | `data-slot` | `"sidebar-tooltip-shortcut"` | On the chord chips. Present only while `shortcut` holds something. Carries `translate="no"`: a chord is a key name, not prose. |
|
|
2369
|
+
* | `data-state` | `"delayed-open"` \| `"instant-open"` \| `"closed"` | On the wrapped row, from `Tooltip.Trigger`. `"closed"` outside the collapsed rail, where this part vetoes the open state. |
|
|
2324
2370
|
*
|
|
2325
2371
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebartooltip
|
|
2326
2372
|
*
|
|
@@ -2383,7 +2429,15 @@ declare const Sidebar: {
|
|
|
2383
2429
|
readonly Tooltip: typeof SidebarTooltip;
|
|
2384
2430
|
/**
|
|
2385
2431
|
* An inset hairline between sidebar regions, aligned with the content
|
|
2386
|
-
* padding.
|
|
2432
|
+
* padding. In the icon rail it narrows to the 36px chip width of
|
|
2433
|
+
* `Sidebar.SwitcherTrigger`.
|
|
2434
|
+
*
|
|
2435
|
+
* **Data attributes:**
|
|
2436
|
+
*
|
|
2437
|
+
* | Data Attribute | Value | Description |
|
|
2438
|
+
* | --- | --- | --- |
|
|
2439
|
+
* | `data-orientation` | `"horizontal"` \| `"vertical"` | Read, not stamped: `Separator` reflects its `orientation` prop, `"horizontal"` by default, after a `HorizontalSeparatorGroup` ancestor wins. |
|
|
2440
|
+
* | `data-separator` | present | Read, not stamped: presence-only, from `Separator`. Lets a `HorizontalSeparatorGroup` exempt it from `shrink-0`. |
|
|
2387
2441
|
*
|
|
2388
2442
|
* @see https://mantle.ngrok.com/components/navigation/sidebar#sidebarseparator
|
|
2389
2443
|
*
|
|
@@ -2463,10 +2517,10 @@ declare const SIDEBAR_STATE_COOKIE_NAME = "mantle-sidebar-state";
|
|
|
2463
2517
|
* This is the server half of cookie-backed persistence: unlike storage-backed
|
|
2464
2518
|
* persistence, a cookie is available *before* the server renders, so the
|
|
2465
2519
|
* server-rendered HTML already carries the right `data-state` and there is no
|
|
2466
|
-
* first-frame correction to hide. Pass the result straight to `defaultOpen
|
|
2520
|
+
* first-frame correction to hide. Pass the result straight to `defaultOpen`;
|
|
2467
2521
|
* controlled `open` is not required.
|
|
2468
2522
|
*
|
|
2469
|
-
* Returns `undefined
|
|
2523
|
+
* Returns `undefined`, not `false`, when the cookie is absent or holds a
|
|
2470
2524
|
* value this helper does not recognize, so a first-time visitor is
|
|
2471
2525
|
* distinguishable from one who deliberately collapsed the sidebar. Collapse the
|
|
2472
2526
|
* state into your own default at the call site with `?? true`.
|
|
@@ -2523,7 +2577,7 @@ type SerializeSidebarStateCookieOptions = {
|
|
|
2523
2577
|
*/
|
|
2524
2578
|
domain?: string;
|
|
2525
2579
|
/**
|
|
2526
|
-
* `SameSite` policy. `"Lax"` is right for a UI preference
|
|
2580
|
+
* `SameSite` policy. `"Lax"` is right for a UI preference: it survives
|
|
2527
2581
|
* top-level navigations back to your app without riding along on
|
|
2528
2582
|
* cross-site subrequests.
|
|
2529
2583
|
*
|
|
@@ -2532,10 +2586,10 @@ type SerializeSidebarStateCookieOptions = {
|
|
|
2532
2586
|
sameSite?: "Lax" | "Strict" | "None";
|
|
2533
2587
|
/**
|
|
2534
2588
|
* Whether to add the `Secure` attribute. Omitted by default so the same call
|
|
2535
|
-
* works on `http://localhost
|
|
2536
|
-
* http, which would make the preference appear not to persist in local
|
|
2537
|
-
* development.
|
|
2538
|
-
*
|
|
2589
|
+
* works on `http://localhost`: the browser silently rejects a `Secure` cookie
|
|
2590
|
+
* over http, which would make the preference appear not to persist in local
|
|
2591
|
+
* development. If your CSP or policy requires it, set it to `true` in
|
|
2592
|
+
* production; this cookie holds no secret, only whether a rail is open.
|
|
2539
2593
|
*
|
|
2540
2594
|
* @default false
|
|
2541
2595
|
*/
|
|
@@ -2571,7 +2625,7 @@ type SerializeSidebarStateCookieOptions = {
|
|
|
2571
2625
|
* ```
|
|
2572
2626
|
*
|
|
2573
2627
|
* @param open - Whether the sidebar is expanded.
|
|
2574
|
-
* @param options -
|
|
2628
|
+
* @param options - Defaults to one year, `Path=/`, `SameSite=Lax`, and no `Secure`.
|
|
2575
2629
|
* @returns A cookie string such as `mantle-sidebar-state=collapsed; Max-Age=31536000; Path=/; SameSite=Lax`.
|
|
2576
2630
|
*/
|
|
2577
2631
|
declare function serializeSidebarStateCookie(open: boolean, options?: SerializeSidebarStateCookieOptions): string;
|
package/dist/sidebar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-0HCjnNv1.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-BsvE2ntj.js";import{t as r}from"./button-pwkdtR3U.js";import{n as i}from"./separator-D98be0gY.js";import{n as a,t as o}from"./use-is-apple-platform-CMPzIYjz.js";import{t as s}from"./use-callback-ref-BvVyI5K1.js";import{n as c}from"./cookie-ca4g5CKp.js";import{t as l}from"./sheet-B5x8EO9Y.js";import{i as u,t as d}from"./use-is-hydrated-after-paint-Drj0lNi4.js";import{t as f}from"./tooltip-H03l7E4Y.js";import{c as p}from"react/compiler-runtime";import{createContext as m,useContext as h,useEffect as g,useId as _,useRef as v,useState as y}from"react";import b from"tiny-invariant";import{Fragment as x,jsx as S,jsxs as C}from"react/jsx-runtime";import{SidebarSimpleIcon as w}from"@phosphor-icons/react/SidebarSimple";const T={sm:`max-sm:not-data-hydrated:hidden`,md:`max-md:not-data-hydrated:hidden`,lg:`max-lg:not-data-hydrated:hidden`},E=m(null);function D(){let e=h(E);return b(e,`useSidebar must be used within Sidebar.Root.`),e}function O(e){let t=h(E);return b(t,`Sidebar.${e} must be rendered inside Sidebar.Root.`),t}const k=[];function A(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`:!1}function j(){let e=Symbol(`sidebar-keyboard-shortcut`);return k.push(e),{isOwner:()=>k[0]===e,release:()=>{let t=k.indexOf(e);t!==-1&&k.splice(t,1)}}}const M=e=>{let t=p(34),{children:n,defaultOpen:r,keyboardShortcut:i,mobileBreakpoint:o,onOpenChange:c,onOpenMobileChange:l,open:d,openMobile:f}=e,m=r===void 0||r,h=i===void 0||i,b=o===void 0?`lg`:o,x=u(b),C=_(),w=d!=null,[T,D]=y(m),O=w?d:T,k;t[0]!==w||t[1]!==c?(k=e=>{w||D(e),c?.(e)},t[0]=w,t[1]=c,t[2]=k):k=t[2];let M=k,N=f!=null,[P,F]=y(!1),I=N?f:P,L;t[3]!==N||t[4]!==l?(L=e=>{N||F(e),l?.(e)},t[3]=N,t[4]=l,t[5]=L):L=t[5];let R=L,z=v(x),B,V;t[6]!==x||t[7]!==I||t[8]!==R?(B=()=>{let e=z.current&&!x;z.current=x,e&&I&&R(!1)},V=[x,I,R],t[6]=x,t[7]=I,t[8]=R,t[9]=B,t[10]=V):(B=t[9],V=t[10]),g(B,V);let H;t[11]!==x||t[12]!==O||t[13]!==I||t[14]!==M||t[15]!==R?(H=()=>{x?R(!I):M(!O)},t[11]=x,t[12]=O,t[13]=I,t[14]=M,t[15]=R,t[16]=H):H=t[16];let U=H,W=s(U),G,K;t[17]!==h||t[18]!==W?(K=()=>{if(!h)return;let e=j(),t=a(),n=n=>{if(!e.isOwner()||A(n.target))return;let r=t?n.metaKey:n.ctrlKey,i=t?n.ctrlKey:n.metaKey;n.key?.toLowerCase()===`b`&&r&&!i&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),W())};return window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`keydown`,n),e.release()}},G=[h,W],t[17]=h,t[18]=W,t[19]=G,t[20]=K):(G=t[19],K=t[20]),g(K,G);let q;t[21]!==x||t[22]!==h||t[23]!==b||t[24]!==C||t[25]!==O||t[26]!==I||t[27]!==M||t[28]!==R||t[29]!==U?(q={isMobile:x,keyboardShortcut:h,mobileBreakpoint:b,navId:C,open:O,openMobile:I,setOpen:M,setOpenMobile:R,toggle:U},t[21]=x,t[22]=h,t[23]=b,t[24]=C,t[25]=O,t[26]=I,t[27]=M,t[28]=R,t[29]=U,t[30]=q):q=t[30];let J=q,Y;return t[31]!==n||t[32]!==J?(Y=S(E.Provider,{value:J,children:n}),t[31]=n,t[32]=J,t[33]=Y):Y=t[33],Y},N=n=>{let r=p(48),i,a,o,s,c,u;r[0]===n?(i=r[1],a=r[2],o=r[3],s=r[4],c=r[5],u=r[6]):({"aria-label":i,"aria-labelledby":a,children:o,className:s,"data-slot":c,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=s,r[5]=c,r[6]=u);let{isMobile:f,mobileBreakpoint:m,navId:h,open:g,openMobile:_,setOpenMobile:v}=O(`Nav`),y=d(),b=i??(a==null?`Main`:void 0);if(f){let n;r[7]===c?n=r[8]:(n=t(c,`sidebar-nav`),r[7]=c,r[8]=n);let i;r[9]===a?i=r[10]:(i=a==null?null:{"aria-labelledby":a},r[9]=a,r[10]=i);let d;r[11]===s?d=r[12]:(d=e(`bg-base w-(--sidebar-width-mobile,18rem) max-w-full p-0`,s),r[11]=s,r[12]=d);let f=b??`Sidebar`,p;r[13]===f?p=r[14]:(p=S(l.Title,{className:`sr-only`,children:f}),r[13]=f,r[14]=p);let m;r[15]!==b||r[16]!==a||r[17]!==o||r[18]!==h?(m=S(`nav`,{id:h,"aria-label":b,"aria-labelledby":a,className:`flex h-full w-full min-w-0 flex-col text-sm`,children:o}),r[15]=b,r[16]=a,r[17]=o,r[18]=h,r[19]=m):m=r[19];let g;r[20]!==u||r[21]!==n||r[22]!==i||r[23]!==d||r[24]!==p||r[25]!==m?(g=C(l.Content,{side:`left`,preferredWidth:`sm:max-w-(--sidebar-width-mobile,18rem)`,"data-slot":n,"data-mobile":``,...i,className:d,...u,children:[p,m]}),r[20]=u,r[21]=n,r[22]=i,r[23]=d,r[24]=p,r[25]=m,r[26]=g):g=r[26];let y;return r[27]!==_||r[28]!==v||r[29]!==g?(y=S(l.Root,{open:_,onOpenChange:v,children:g}),r[27]=_,r[28]=v,r[29]=g,r[30]=y):y=r[30],y}let x;r[31]===c?x=r[32]:(x=t(c,`sidebar-nav`),r[31]=c,r[32]=x);let w=T[m],E;r[33]!==s||r[34]!==w?(E=e(`group/sidebar-nav bg-base relative h-full w-(--sidebar-width,13rem) shrink-0 overflow-hidden`,`data-[state=collapsed]:w-(--sidebar-width-icon,3.25rem)`,w,`transition-[width] duration-200 ease-linear motion-reduce:transition-none not-data-hydrated:transition-none`,s),r[33]=s,r[34]=w,r[35]=E):E=r[35];let D=g?`expanded`:`collapsed`,k=y?``:void 0,A;r[36]!==b||r[37]!==a||r[38]!==o||r[39]!==h?(A=S(`nav`,{id:h,"aria-label":b,"aria-labelledby":a,className:`absolute inset-y-0 left-0 flex w-full min-w-0 flex-col text-sm`,children:o}),r[36]=b,r[37]=a,r[38]=o,r[39]=h,r[40]=A):A=r[40];let j;return r[41]!==u||r[42]!==x||r[43]!==E||r[44]!==D||r[45]!==k||r[46]!==A?(j=S(`div`,{"data-slot":x,className:E,...u,"data-state":D,"data-hydrated":k,children:A}),r[41]=u,r[42]=x,r[43]=E,r[44]=D,r[45]=k,r[46]=A,r[47]=j):j=r[47],j},P=S(w,{}),F=e=>{let t=p(7),{label:n,shortcut:r}=e,i;t[0]===n?i=t[1]:(i=S(`span`,{"data-slot":`sidebar-tooltip-label`,className:`contents`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r!=null&&S(`span`,{"aria-hidden":!0,"data-slot":`sidebar-tooltip-shortcut`,className:`inline-flex shrink-0 items-center gap-0.5 [&_kbd]:h-4 [&_kbd]:min-w-4 [&_kbd]:bg-neutral-500/25 [&_kbd]:px-0.5 [&_kbd]:text-xs`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=C(`span`,{"data-slot":`sidebar-tooltip-row`,className:`flex items-center gap-1.5`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o},I=e=>{let n=p(32),i,a,s,c,l,u,d,m;n[0]===e?(i=n[1],a=n[2],s=n[3],c=n[4],l=n[5],u=n[6],d=n[7],m=n[8]):({appearance:l,"data-slot":i,icon:u,intent:d,label:m,onClick:a,shortcut:c,...s}=e,n[0]=e,n[1]=i,n[2]=a,n[3]=s,n[4]=c,n[5]=l,n[6]=u,n[7]=d,n[8]=m);let h=l===void 0?`ghost`:l,g=u===void 0?P:u,_=d===void 0?`neutral`:d,v=m===void 0?`Toggle Sidebar`:m,{isMobile:y,keyboardShortcut:b,navId:x,open:w,openMobile:T,toggle:E}=O(`Trigger`),D=o(),k=y?T:w,A=!y||T,j=b?c:void 0,M=D?`Meta+B`:`Control+B`,N=A?x:void 0,I=b?M:void 0,L;n[9]===i?L=n[10]:(L=t(i,`sidebar-trigger`),n[9]=i,n[10]=L);let R=k?`expanded`:`collapsed`,z;n[11]!==a||n[12]!==E?(z=e=>{a?.(e),e.defaultPrevented||E()},n[11]=a,n[12]=E,n[13]=z):z=n[13];let B;n[14]!==h||n[15]!==k||n[16]!==g||n[17]!==_||n[18]!==v||n[19]!==s||n[20]!==N||n[21]!==I||n[22]!==L||n[23]!==R||n[24]!==z?(B=S(f.Trigger,{asChild:!0,children:S(r,{appearance:h,"aria-controls":N,"aria-expanded":k,"aria-keyshortcuts":I,"data-slot":L,"data-state":R,icon:g,intent:_,label:v,onClick:z,...s})}),n[14]=h,n[15]=k,n[16]=g,n[17]=_,n[18]=v,n[19]=s,n[20]=N,n[21]=I,n[22]=L,n[23]=R,n[24]=z,n[25]=B):B=n[25];let V;n[26]!==j||n[27]!==v?(V=S(f.Content,{"data-slot":`sidebar-trigger-tooltip`,children:S(F,{label:v,shortcut:j})}),n[26]=j,n[27]=v,n[28]=V):V=n[28];let H;return n[29]!==B||n[30]!==V?(H=C(f.Root,{children:[B,V]}),n[29]=B,n[30]=V,n[31]=H):H=n[31],H},L=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`div`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-header`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`grid grid-cols-1 grid-rows-(--sidebar-header-height,4.5rem) shrink-0 items-center px-3`,`group-data-[state=expanded]/sidebar-nav:pr-1`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=S(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},R=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`div`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-body`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`scrollbar scrollbar-gutter-stable scroll-fade-y flex-1 scroll-py-6 space-y-2 overflow-y-auto overflow-x-hidden px-3 pt-1.5 pb-4`,`group-data-[state=expanded]/sidebar-nav:pr-1`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-none`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-gutter-auto`,`group-data-[state=collapsed]/sidebar-nav:[&::-webkit-scrollbar]:hidden`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=S(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},z=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`div`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-footer`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`shrink-0 px-3 pt-3 pb-3.5`,`group-data-[state=expanded]/sidebar-nav:pr-1`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=S(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},B=m(null),V=r=>{let i=p(21),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let[u,d]=y(null),f;i[6]===u?f=i[7]:(f={mountedLabelId:u,setMountedLabelId:d},i[6]=u,i[7]=f);let m=f,h=a?n:`div`,g;i[8]===c?g=i[9]:(g=t(c,`sidebar-group`),i[8]=c,i[9]=g);let _;i[10]===s?_=i[11]:(_=e(`pt-0.5`,s),i[10]=s,i[11]=_);let v;i[12]!==h||i[13]!==o||i[14]!==l||i[15]!==g||i[16]!==_?(v=S(h,{"data-slot":g,className:_,...l,children:o}),i[12]=h,i[13]=o,i[14]=l,i[15]=g,i[16]=_,i[17]=v):v=i[17];let b;return i[18]!==m||i[19]!==v?(b=S(B.Provider,{value:m,children:v}),i[18]=m,i[19]=v,i[20]=b):b=i[20],b},H=r=>{let i=p(22),a,o,s,c,l,u;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({asChild:a,children:o,className:s,"data-slot":c,id:l,...u}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let d=h(B),f=_(),m=l??(d==null?void 0:f),v=d?.setMountedLabelId,y,b;i[7]!==m||i[8]!==v?(y=()=>{if(v!=null&&m!=null)return v(m),()=>{v(null)}},b=[v,m],i[7]=m,i[8]=v,i[9]=y,i[10]=b):(y=i[9],b=i[10]),g(y,b);let x=a?n:`div`,C;i[11]===c?C=i[12]:(C=t(c,`sidebar-group-label`),i[11]=c,i[12]=C);let w;i[13]===s?w=i[14]:(w=e(`text-muted flex min-w-0 items-center gap-2 truncate px-2 py-1 text-xs font-medium`,`group-data-[state=collapsed]/sidebar-nav:opacity-0`,`group-data-[state=collapsed]/sidebar-nav:pointer-events-none`,`transition-opacity duration-200 ease-linear motion-reduce:transition-none group-not-data-hydrated/sidebar-nav:transition-none`,s),i[13]=s,i[14]=w);let T;return i[15]!==x||i[16]!==o||i[17]!==m||i[18]!==u||i[19]!==C||i[20]!==w?(T=S(x,{id:m,"data-slot":C,className:w,...u,children:o}),i[15]=x,i[16]=o,i[17]=m,i[18]=u,i[19]=C,i[20]=w,i[21]=T):T=i[21],T},U=r=>{let i=p(18),a,o,s,c,l,u;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({"aria-labelledby":a,asChild:o,children:s,className:c,"data-slot":l,...u}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let d=h(B),f=o?n:`ul`,m=a??d?.mountedLabelId??void 0,g;i[7]===l?g=i[8]:(g=t(l,`sidebar-list`),i[7]=l,i[8]=g);let _;i[9]===c?_=i[10]:(_=e(`mb-2 space-y-px`,c),i[9]=c,i[10]=_);let v;return i[11]!==f||i[12]!==s||i[13]!==u||i[14]!==m||i[15]!==g||i[16]!==_?(v=S(f,{"aria-labelledby":m,"data-slot":g,className:_,...u,children:s}),i[11]=f,i[12]=s,i[13]=u,i[14]=m,i[15]=g,i[16]=_,i[17]=v):v=i[17],v},W=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`li`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-item`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`list-none`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=S(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},G=[`ring-focus-accent flex w-full min-w-0 items-center gap-2 truncate rounded-md px-2 py-1 text-left font-normal transition-none focus:outline-hidden focus-visible:ring-4`,`text-body hover:text-strong hover:bg-neutral-500/10`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`group-data-[state=collapsed]/sidebar-nav:ml-1`,`group-data-[state=collapsed]/sidebar-nav:w-7`,`group-data-[state=collapsed]/sidebar-nav:p-1`].join(` `),K={Root:M,Nav:N,Trigger:I,Header:L,Body:R,Footer:z,Group:V,GroupLabel:H,List:U,Item:W,ItemButton:r=>{let i=p(21),a,o,s,c,l,u,d;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6],d=i[7]):({asChild:a,children:o,className:s,current:c,"data-slot":l,type:d,...u}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u,i[7]=d);let f=a?n:`button`,m;i[8]===l?m=i[9]:(m=t(l,`sidebar-item-button`),i[8]=l,i[9]=m);let h=c?``:void 0,g=c?`page`:void 0,_=a?d:d??`button`,v;i[10]===s?v=i[11]:(v=e(G,`data-current:bg-neutral-500/15 data-current:text-strong`,`aria-[current=page]:bg-neutral-500/15 aria-[current=page]:text-strong`,`[&>svg]:text-muted hover:[&>svg]:text-strong data-current:[&>svg]:text-strong aria-[current=page]:[&>svg]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,s),i[10]=s,i[11]=v);let y;return i[12]!==f||i[13]!==o||i[14]!==u||i[15]!==m||i[16]!==h||i[17]!==g||i[18]!==_||i[19]!==v?(y=S(f,{"data-slot":m,"data-current":h,"aria-current":g,type:_,className:v,...u,children:o}),i[12]=f,i[13]=o,i[14]=u,i[15]=m,i[16]=h,i[17]=g,i[18]=_,i[19]=v,i[20]=y):y=i[20],y},SearchTrigger:r=>{let i=p(23),a,o,s,c,l,u,d;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6],d=i[7]):({asChild:a,children:o,className:s,"data-slot":c,shortcut:u,type:d,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u,i[7]=d);let f=a?n:`button`,m;i[8]!==a||i[9]!==o||i[10]!==u?(m=a?o:C(x,{children:[S(`span`,{"data-slot":`sidebar-search-trigger-label`,className:`contents`,children:o}),S(`span`,{"aria-hidden":!0,"data-slot":`sidebar-search-trigger-shortcut`,className:e(`pointer-events-none -mr-1 ml-auto inline-flex shrink-0 items-center gap-0.5 opacity-0 select-none`,`group-hover:opacity-100 group-focus-visible:opacity-100`,`group-data-[state=collapsed]/sidebar-nav:hidden`,`[&_kbd]:text-body [&_kbd]:h-5 [&_kbd]:min-w-5 [&_kbd]:bg-neutral-500/20 [&_kbd]:px-1 [&_kbd]:text-xs [&_kbd]:font-normal`,`empty:hidden`),children:u})]}),i[8]=a,i[9]=o,i[10]=u,i[11]=m):m=i[11];let h=m,g;i[12]===c?g=i[13]:(g=t(c,`sidebar-search-trigger`),i[12]=c,i[13]=g);let _=a?d:d??`button`,v;i[14]===s?v=i[15]:(v=e(`group`,G,`[&>svg:first-child]:text-muted hover:[&>svg:first-child]:text-strong`,`[&>svg:first-child]:size-5`,`[&>[data-slot=sidebar-search-trigger-label]>svg:first-child]:text-muted`,`hover:[&>[data-slot=sidebar-search-trigger-label]>svg:first-child]:text-strong`,`[&>[data-slot=sidebar-search-trigger-label]>svg:first-child]:size-5`,`[&_svg]:shrink-0`,s),i[14]=s,i[15]=v);let y;return i[16]!==f||i[17]!==h||i[18]!==l||i[19]!==g||i[20]!==_||i[21]!==v?(y=S(f,{"data-slot":g,type:_,className:v,...l,children:h}),i[16]=f,i[17]=h,i[18]=l,i[19]=g,i[20]=_,i[21]=v,i[22]=y):y=i[22],y},SwitcherTrigger:r=>{let i=p(18),a,o,s,c,l,u;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({asChild:a,children:o,className:s,"data-slot":c,type:u,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let d=a?n:`button`,f;i[7]===c?f=i[8]:(f=t(c,`sidebar-switcher-trigger`),i[7]=c,i[8]=f);let m=a?u:u??`button`,h;i[9]===s?h=i[10]:(h=e(`text-body hover:text-strong hover:bg-neutral-500/10 flex w-full min-w-0 items-center gap-2 rounded-[0.625rem] py-1 pr-1.5 pl-1 text-left font-medium transition-none`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`ring-focus-accent focus:outline-hidden focus-visible:ring-4`,`*:first:size-7`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:[&>:not(:first-child)]:sr-only`,s),i[9]=s,i[10]=h);let g;return i[11]!==d||i[12]!==o||i[13]!==l||i[14]!==f||i[15]!==m||i[16]!==h?(g=S(d,{"data-slot":f,type:m,className:h,...l,children:o}),i[11]=d,i[12]=o,i[13]=l,i[14]=f,i[15]=m,i[16]=h,i[17]=g):g=i[17],g},Tooltip:e=>{let n=p(26),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({children:r,"data-slot":i,label:a,shortcut:s,side:c,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=c===void 0?`right`:c,{isMobile:u,open:d}=O(`Tooltip`),m=!u&&!d,[h,g]=y(!1),[_,v]=y(m);_!==m&&(v(m),g(!1));let b;n[7]===m?b=n[8]:(b=e=>{g(e&&m)},n[7]=m,n[8]=b);let x=b,w=m&&h,T;n[9]===r?T=n[10]:(T=S(f.Trigger,{asChild:!0,children:r}),n[9]=r,n[10]=T);let E;n[11]===i?E=n[12]:(E=t(i,`sidebar-tooltip`),n[11]=i,n[12]=E);let D;n[13]!==a||n[14]!==s?(D=S(F,{label:a,shortcut:s}),n[13]=a,n[14]=s,n[15]=D):D=n[15];let k;n[16]!==o||n[17]!==l||n[18]!==E||n[19]!==D?(k=S(f.Content,{"data-slot":E,side:l,...o,children:D}),n[16]=o,n[17]=l,n[18]=E,n[19]=D,n[20]=k):k=n[20];let A;return n[21]!==x||n[22]!==w||n[23]!==T||n[24]!==k?(A=C(f.Root,{disableHoverableContent:!0,onOpenChange:x,open:w,children:[T,k]}),n[21]=x,n[22]=w,n[23]=T,n[24]=k,n[25]=A):A=n[25],A},Separator:n=>{let r=p(12),a,o,s;r[0]===n?(a=r[1],o=r[2],s=r[3]):({className:a,"data-slot":o,...s}=n,r[0]=n,r[1]=a,r[2]=o,r[3]=s);let c;r[4]===o?c=r[5]:(c=t(o,`sidebar-separator`),r[4]=o,r[5]=c);let l;r[6]===a?l=r[7]:(l=e(`my-3`,`group-data-[state=collapsed]/sidebar-nav:w-9`,a),r[6]=a,r[7]=l);let u;return r[8]!==s||r[9]!==c||r[10]!==l?(u=S(i,{"data-slot":c,className:l,...s}),r[8]=s,r[9]=c,r[10]=l,r[11]=u):u=r[11],u}},q=`mantle-sidebar-state`,J={collapsed:`collapsed`,expanded:`expanded`};function Y(e){let t=c(e,q);if(t===J.expanded)return!0;if(t===J.collapsed)return!1}function X(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?J.expanded:J.collapsed,c=[`${q}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{q as SIDEBAR_STATE_COOKIE_NAME,K as Sidebar,Y as extractSidebarStateCookie,X as serializeSidebarStateCookie,D as useSidebar};
|
|
1
|
+
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./slot-DdYN1L1C.js";import{t as r}from"./button-BMfUxs_j.js";import{t as i}from"./use-is-hydrated-after-paint-r9Cl2mGp.js";import{t as a}from"./tooltip-NhYXqStK.js";import{n as o}from"./cookie-ca4g5CKp.js";import{n as s}from"./separator-DvPe27fH.js";import{n as c,t as l}from"./use-is-apple-platform-CMPzIYjz.js";import{t as u}from"./use-callback-ref-BvVyI5K1.js";import{t as d}from"./sheet-DND_KjmS.js";import{r as f}from"./use-breakpoint--mo7kr9d.js";import{c as p}from"react/compiler-runtime";import{createContext as m,useContext as h,useEffect as g,useId as _,useLayoutEffect as v,useRef as y,useState as b}from"react";import x from"tiny-invariant";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{SidebarSimpleIcon as T}from"@phosphor-icons/react/SidebarSimple";const E={sm:`max-sm:not-data-hydrated:hidden`,md:`max-md:not-data-hydrated:hidden`,lg:`max-lg:not-data-hydrated:hidden`},D=`duration-200 ease-out-strong motion-reduce:transition-none group-not-data-hydrated/sidebar-nav:transition-none`,O=m(null);function k(){let e=h(O);return x(e,`useSidebar must be used within Sidebar.Root.`),e}function A(e){let t=h(O);return x(t,`Sidebar.${e} must be rendered inside Sidebar.Root.`),t}const j=[];function M(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.tagName===`SELECT`:!1}function N(){let e=Symbol(`sidebar-keyboard-shortcut`);return j.push(e),{isOwner:()=>j[0]===e,release:()=>{let t=j.indexOf(e);t!==-1&&j.splice(t,1)}}}const P=e=>{let t=p(35),{children:n,defaultOpen:r,keyboardShortcut:i,mobileBreakpoint:a,onOpenChange:o,onOpenMobileChange:s,open:l,openMobile:d}=e,m=r===void 0||r,h=i===void 0||i,x=a===void 0?`lg`:a,S=f(x),w=_(),T=y(o),E=y(s),D;t[0]!==o||t[1]!==s?(D=()=>{T.current=o,E.current=s},t[0]=o,t[1]=s,t[2]=D):D=t[2],v(D);let k=l!=null,[A,j]=b(m),P=k?l:A,F;t[3]===k?F=t[4]:(F=e=>{k||j(e),T.current?.(e)},t[3]=k,t[4]=F);let I=F,L=d!=null,[R,z]=b(!1),B=L?d:R,V;t[5]===L?V=t[6]:(V=e=>{L||z(e),E.current?.(e)},t[5]=L,t[6]=V);let H=V,U=y(S),W,G;t[7]!==S||t[8]!==B||t[9]!==H?(W=()=>{let e=U.current&&!S;U.current=S,e&&B&&H(!1)},G=[S,B,H],t[7]=S,t[8]=B,t[9]=H,t[10]=W,t[11]=G):(W=t[10],G=t[11]),g(W,G);let K;t[12]!==S||t[13]!==P||t[14]!==B||t[15]!==I||t[16]!==H?(K=()=>{S?H(!B):I(!P)},t[12]=S,t[13]=P,t[14]=B,t[15]=I,t[16]=H,t[17]=K):K=t[17];let q=K,J=u(q),Y,X;t[18]!==h||t[19]!==J?(Y=()=>{if(!h)return;let e=N(),t=c(),n=n=>{if(!e.isOwner()||M(n.target))return;let r=t?n.metaKey:n.ctrlKey,i=t?n.ctrlKey:n.metaKey;n.key?.toLowerCase()===`b`&&r&&!i&&!n.altKey&&!n.shiftKey&&(n.preventDefault(),J())};return window.addEventListener(`keydown`,n),()=>{window.removeEventListener(`keydown`,n),e.release()}},X=[h,J],t[18]=h,t[19]=J,t[20]=Y,t[21]=X):(Y=t[20],X=t[21]),g(Y,X);let Z;t[22]!==S||t[23]!==h||t[24]!==x||t[25]!==w||t[26]!==P||t[27]!==B||t[28]!==I||t[29]!==H||t[30]!==q?(Z={isMobile:S,keyboardShortcut:h,mobileBreakpoint:x,navId:w,open:P,openMobile:B,setOpen:I,setOpenMobile:H,toggle:q},t[22]=S,t[23]=h,t[24]=x,t[25]=w,t[26]=P,t[27]=B,t[28]=I,t[29]=H,t[30]=q,t[31]=Z):Z=t[31];let Q=Z,$;return t[32]!==n||t[33]!==Q?($=/* @__PURE__ */ C(O.Provider,{value:Q,children:n}),t[32]=n,t[33]=Q,t[34]=$):$=t[34],$},F=n=>{let r=p(48),a,o,s,c,l,u;r[0]===n?(a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6]):({"aria-label":a,"aria-labelledby":o,children:s,className:c,"data-slot":l,...u}=n,r[0]=n,r[1]=a,r[2]=o,r[3]=s,r[4]=c,r[5]=l,r[6]=u);let{isMobile:f,mobileBreakpoint:m,navId:h,open:g,openMobile:_,setOpenMobile:v}=A(`Nav`),y=i(),b=a??(o==null?`Main`:void 0);if(f){let n;r[7]===l?n=r[8]:(n=t(l,`sidebar-nav`),r[7]=l,r[8]=n);let i;r[9]===o?i=r[10]:(i=o==null?null:{"aria-labelledby":o},r[9]=o,r[10]=i);let a;r[11]===c?a=r[12]:(a=e(`bg-base w-(--sidebar-width-mobile,18rem) max-w-full p-0`,c),r[11]=c,r[12]=a);let f=b??`Sidebar`,p;r[13]===f?p=r[14]:(p=/* @__PURE__ */ C(d.Title,{className:`sr-only`,children:f}),r[13]=f,r[14]=p);let m;r[15]!==b||r[16]!==o||r[17]!==s||r[18]!==h?(m=/* @__PURE__ */ C(`nav`,{id:h,"aria-label":b,"aria-labelledby":o,className:`flex h-full w-full min-w-0 flex-col text-sm`,children:s}),r[15]=b,r[16]=o,r[17]=s,r[18]=h,r[19]=m):m=r[19];let g;r[20]!==u||r[21]!==n||r[22]!==i||r[23]!==a||r[24]!==p||r[25]!==m?(g=/* @__PURE__ */ w(d.Content,{side:`left`,preferredWidth:`sm:max-w-(--sidebar-width-mobile,18rem)`,"data-slot":n,"data-mobile":``,...i,className:a,...u,children:[p,m]}),r[20]=u,r[21]=n,r[22]=i,r[23]=a,r[24]=p,r[25]=m,r[26]=g):g=r[26];let y;return r[27]!==_||r[28]!==v||r[29]!==g?(y=/* @__PURE__ */ C(d.Root,{open:_,onOpenChange:v,children:g}),r[27]=_,r[28]=v,r[29]=g,r[30]=y):y=r[30],y}let x;r[31]===l?x=r[32]:(x=t(l,`sidebar-nav`),r[31]=l,r[32]=x);let S=E[m],T;r[33]!==c||r[34]!==S?(T=e(`group/sidebar-nav bg-base relative h-full w-(--sidebar-width,13rem) shrink-0 overflow-hidden`,`data-[state=collapsed]:w-(--sidebar-width-icon,3.25rem)`,S,`transition-[width] duration-200 ease-out-strong motion-reduce:transition-none not-data-hydrated:transition-none`,c),r[33]=c,r[34]=S,r[35]=T):T=r[35];let D=g?`expanded`:`collapsed`,O=y?``:void 0,k;r[36]!==b||r[37]!==o||r[38]!==s||r[39]!==h?(k=/* @__PURE__ */ C(`nav`,{id:h,"aria-label":b,"aria-labelledby":o,className:`absolute inset-y-0 left-0 flex w-full min-w-0 flex-col text-sm`,children:s}),r[36]=b,r[37]=o,r[38]=s,r[39]=h,r[40]=k):k=r[40];let j;return r[41]!==u||r[42]!==x||r[43]!==T||r[44]!==D||r[45]!==O||r[46]!==k?(j=/* @__PURE__ */ C(`div`,{"data-slot":x,className:T,...u,"data-state":D,"data-hydrated":O,children:k}),r[41]=u,r[42]=x,r[43]=T,r[44]=D,r[45]=O,r[46]=k,r[47]=j):j=r[47],j},I=/* @__PURE__ */ C(T,{}),L=e=>{let t=p(7),{label:n,shortcut:r}=e,i;t[0]===n?i=t[1]:(i=/* @__PURE__ */ C(`span`,{"data-slot":`sidebar-tooltip-label`,className:`contents`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r!=null&&/* @__PURE__ */ C(`span`,{"aria-hidden":!0,"data-slot":`sidebar-tooltip-shortcut`,className:`inline-flex shrink-0 items-center gap-0.5 [&_kbd]:h-4 [&_kbd]:min-w-4 [&_kbd]:bg-neutral-500/25 [&_kbd]:px-0.5 [&_kbd]:text-xs`,translate:`no`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=/* @__PURE__ */ w(`span`,{"data-slot":`sidebar-tooltip-row`,className:`flex items-center gap-1.5`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o},R=e=>{let n=p(32),i,o,s,c,u,d,f,m;n[0]===e?(i=n[1],o=n[2],s=n[3],c=n[4],u=n[5],d=n[6],f=n[7],m=n[8]):({appearance:u,"data-slot":i,icon:d,intent:f,label:m,onClick:o,shortcut:c,...s}=e,n[0]=e,n[1]=i,n[2]=o,n[3]=s,n[4]=c,n[5]=u,n[6]=d,n[7]=f,n[8]=m);let h=u===void 0?`ghost`:u,g=d===void 0?I:d,_=f===void 0?`neutral`:f,v=m===void 0?`Toggle Sidebar`:m,{isMobile:y,keyboardShortcut:b,navId:x,open:S,openMobile:T,toggle:E}=A(`Trigger`),D=l(),O=y?T:S,k=!y||T,j=b?c:void 0,M=D?`Meta+B`:`Control+B`,N=k?x:void 0,P=b?M:void 0,F;n[9]===i?F=n[10]:(F=t(i,`sidebar-trigger`),n[9]=i,n[10]=F);let R=O?`expanded`:`collapsed`,z;n[11]!==o||n[12]!==E?(z=e=>{o?.(e),e.defaultPrevented||E()},n[11]=o,n[12]=E,n[13]=z):z=n[13];let B;n[14]!==h||n[15]!==O||n[16]!==g||n[17]!==_||n[18]!==v||n[19]!==s||n[20]!==N||n[21]!==P||n[22]!==F||n[23]!==R||n[24]!==z?(B=/* @__PURE__ */ C(a.Trigger,{asChild:!0,children:/* @__PURE__ */ C(r,{appearance:h,"aria-controls":N,"aria-expanded":O,"aria-keyshortcuts":P,"data-slot":F,"data-state":R,icon:g,intent:_,label:v,onClick:z,...s})}),n[14]=h,n[15]=O,n[16]=g,n[17]=_,n[18]=v,n[19]=s,n[20]=N,n[21]=P,n[22]=F,n[23]=R,n[24]=z,n[25]=B):B=n[25];let V;n[26]!==j||n[27]!==v?(V=/* @__PURE__ */ C(a.Content,{"data-slot":`sidebar-trigger-tooltip`,children:/* @__PURE__ */ C(L,{label:v,shortcut:j})}),n[26]=j,n[27]=v,n[28]=V):V=n[28];let H;return n[29]!==B||n[30]!==V?(H=/* @__PURE__ */ w(a.Root,{children:[B,V]}),n[29]=B,n[30]=V,n[31]=H):H=n[31],H},z=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`div`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-header`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`grid grid-cols-1 grid-rows-(--sidebar-header-height,4.5rem) shrink-0 items-center px-3`,`group-data-[state=expanded]/sidebar-nav:pr-1`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=/* @__PURE__ */ C(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},B=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`div`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-body`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`scrollbar scrollbar-gutter-stable scroll-fade-y flex-1 scroll-py-6 space-y-2 overflow-y-auto overflow-x-hidden px-3 pt-1.5 pb-4`,`group-data-[state=expanded]/sidebar-nav:pr-1`,`transition-[padding]`,D,`group-data-[state=collapsed]/sidebar-nav:scrollbar-none`,`group-data-[state=collapsed]/sidebar-nav:scrollbar-gutter-auto`,`group-data-[state=collapsed]/sidebar-nav:[&::-webkit-scrollbar]:hidden`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=/* @__PURE__ */ C(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},V=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`div`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-footer`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`shrink-0 px-3 pt-3 pb-3.5`,`group-data-[state=expanded]/sidebar-nav:pr-1`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=/* @__PURE__ */ C(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},H=m(null),U=r=>{let i=p(21),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let[u,d]=b(null),f;i[6]===u?f=i[7]:(f={mountedLabelId:u,setMountedLabelId:d},i[6]=u,i[7]=f);let m=f,h=a?n:`div`,g;i[8]===c?g=i[9]:(g=t(c,`sidebar-group`),i[8]=c,i[9]=g);let _;i[10]===s?_=i[11]:(_=e(`pt-0.5`,s),i[10]=s,i[11]=_);let v;i[12]!==h||i[13]!==o||i[14]!==l||i[15]!==g||i[16]!==_?(v=/* @__PURE__ */ C(h,{"data-slot":g,className:_,...l,children:o}),i[12]=h,i[13]=o,i[14]=l,i[15]=g,i[16]=_,i[17]=v):v=i[17];let y;return i[18]!==m||i[19]!==v?(y=/* @__PURE__ */ C(H.Provider,{value:m,children:v}),i[18]=m,i[19]=v,i[20]=y):y=i[20],y},W=r=>{let i=p(22),a,o,s,c,l,u;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({asChild:a,children:o,className:s,"data-slot":c,id:l,...u}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let d=h(H),f=_(),m=l??(d==null?void 0:f),v=d?.setMountedLabelId,y,b;i[7]!==m||i[8]!==v?(y=()=>{if(v!=null&&m!=null)return v(m),()=>{v(null)}},b=[v,m],i[7]=m,i[8]=v,i[9]=y,i[10]=b):(y=i[9],b=i[10]),g(y,b);let x=a?n:`div`,S;i[11]===c?S=i[12]:(S=t(c,`sidebar-group-label`),i[11]=c,i[12]=S);let w;i[13]===s?w=i[14]:(w=e(`text-muted flex min-w-0 items-center gap-2 truncate px-2 py-1 text-xs font-medium`,`group-data-[state=collapsed]/sidebar-nav:opacity-0`,`group-data-[state=collapsed]/sidebar-nav:pointer-events-none`,`transition-opacity`,D,s),i[13]=s,i[14]=w);let T;return i[15]!==x||i[16]!==o||i[17]!==m||i[18]!==u||i[19]!==S||i[20]!==w?(T=/* @__PURE__ */ C(x,{id:m,"data-slot":S,className:w,...u,children:o}),i[15]=x,i[16]=o,i[17]=m,i[18]=u,i[19]=S,i[20]=w,i[21]=T):T=i[21],T},G=r=>{let i=p(18),a,o,s,c,l,u;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({"aria-labelledby":a,asChild:o,children:s,className:c,"data-slot":l,...u}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let d=h(H),f=o?n:`ul`,m=a??d?.mountedLabelId??void 0,g;i[7]===l?g=i[8]:(g=t(l,`sidebar-list`),i[7]=l,i[8]=g);let _;i[9]===c?_=i[10]:(_=e(`mb-2 space-y-px`,c),i[9]=c,i[10]=_);let v;return i[11]!==f||i[12]!==s||i[13]!==u||i[14]!==m||i[15]!==g||i[16]!==_?(v=/* @__PURE__ */ C(f,{"aria-labelledby":m,"data-slot":g,className:_,...u,children:s}),i[11]=f,i[12]=s,i[13]=u,i[14]=m,i[15]=g,i[16]=_,i[17]=v):v=i[17],v},K=r=>{let i=p(16),a,o,s,c,l;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5]):({asChild:a,children:o,className:s,"data-slot":c,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l);let u=a?n:`li`,d;i[6]===c?d=i[7]:(d=t(c,`sidebar-item`),i[6]=c,i[7]=d);let f;i[8]===s?f=i[9]:(f=e(`list-none`,s),i[8]=s,i[9]=f);let m;return i[10]!==u||i[11]!==o||i[12]!==l||i[13]!==d||i[14]!==f?(m=/* @__PURE__ */ C(u,{"data-slot":d,className:f,...l,children:o}),i[10]=u,i[11]=o,i[12]=l,i[13]=d,i[14]=f,i[15]=m):m=i[15],m},q=[`ring-focus-accent flex w-full min-w-0 items-center gap-2 truncate rounded-md px-2 py-1 text-left font-normal focus:outline-hidden focus-visible:ring-4`,`text-body hover:text-strong hover:bg-neutral-500/10`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`aria-expanded:bg-neutral-500/15 aria-expanded:text-strong`,`group-data-[state=collapsed]/sidebar-nav:ml-1`,`group-data-[state=collapsed]/sidebar-nav:w-7`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:text-clip`,`transition-[width,padding,margin] ${D}`].join(` `),J={Root:P,Nav:F,Trigger:R,Header:z,Body:B,Footer:V,Group:U,GroupLabel:W,List:G,Item:K,ItemButton:r=>{let i=p(21),a,o,s,c,l,u,d;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6],d=i[7]):({asChild:a,children:o,className:s,current:c,"data-slot":l,type:d,...u}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u,i[7]=d);let f=a?n:`button`,m;i[8]===l?m=i[9]:(m=t(l,`sidebar-item-button`),i[8]=l,i[9]=m);let h=c?``:void 0,g=c?`page`:void 0,_=a?d:d??`button`,v;i[10]===s?v=i[11]:(v=e(q,`data-current:bg-neutral-500/15 data-current:text-strong`,`aria-[current=page]:bg-neutral-500/15 aria-[current=page]:text-strong`,`[&>svg]:text-muted hover:[&>svg]:text-strong data-current:[&>svg]:text-strong aria-[current=page]:[&>svg]:text-strong [&>svg:first-child]:size-5 [&>svg]:shrink-0`,s),i[10]=s,i[11]=v);let y;return i[12]!==f||i[13]!==o||i[14]!==u||i[15]!==m||i[16]!==h||i[17]!==g||i[18]!==_||i[19]!==v?(y=/* @__PURE__ */ C(f,{"data-slot":m,"data-current":h,"aria-current":g,type:_,className:v,...u,children:o}),i[12]=f,i[13]=o,i[14]=u,i[15]=m,i[16]=h,i[17]=g,i[18]=_,i[19]=v,i[20]=y):y=i[20],y},SearchTrigger:r=>{let i=p(23),a,o,s,c,l,u,d;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6],d=i[7]):({asChild:a,children:o,className:s,"data-slot":c,shortcut:u,type:d,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u,i[7]=d);let f=a?n:`button`,m;i[8]!==a||i[9]!==o||i[10]!==u?(m=a?o:/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(`span`,{"data-slot":`sidebar-search-trigger-label`,className:`contents`,children:o}),/* @__PURE__ */ C(`span`,{"aria-hidden":!0,"data-slot":`sidebar-search-trigger-shortcut`,translate:`no`,className:e(`pointer-events-none -mr-1 ml-auto inline-flex shrink-0 items-center gap-0.5 opacity-0 select-none`,`group-hover:opacity-100 group-focus-visible:opacity-100`,`group-data-[state=collapsed]/sidebar-nav:hidden`,`[&_kbd]:text-body [&_kbd]:h-5 [&_kbd]:min-w-5 [&_kbd]:bg-neutral-500/20 [&_kbd]:px-1 [&_kbd]:text-xs [&_kbd]:font-normal`,`empty:hidden`),children:u})]}),i[8]=a,i[9]=o,i[10]=u,i[11]=m):m=i[11];let h=m,g;i[12]===c?g=i[13]:(g=t(c,`sidebar-search-trigger`),i[12]=c,i[13]=g);let _=a?d:d??`button`,v;i[14]===s?v=i[15]:(v=e(`group`,q,`[&>svg:first-child]:text-muted hover:[&>svg:first-child]:text-strong`,`[&>svg:first-child]:size-5`,`[&>[data-slot=sidebar-search-trigger-label]>svg:first-child]:text-muted`,`hover:[&>[data-slot=sidebar-search-trigger-label]>svg:first-child]:text-strong`,`[&>[data-slot=sidebar-search-trigger-label]>svg:first-child]:size-5`,`[&_svg]:shrink-0`,s),i[14]=s,i[15]=v);let y;return i[16]!==f||i[17]!==h||i[18]!==l||i[19]!==g||i[20]!==_||i[21]!==v?(y=/* @__PURE__ */ C(f,{"data-slot":g,type:_,className:v,...l,children:h}),i[16]=f,i[17]=h,i[18]=l,i[19]=g,i[20]=_,i[21]=v,i[22]=y):y=i[22],y},SwitcherTrigger:r=>{let i=p(18),a,o,s,c,l,u;i[0]===r?(a=i[1],o=i[2],s=i[3],c=i[4],l=i[5],u=i[6]):({asChild:a,children:o,className:s,"data-slot":c,type:u,...l}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=c,i[5]=l,i[6]=u);let d=a?n:`button`,f;i[7]===c?f=i[8]:(f=t(c,`sidebar-switcher-trigger`),i[7]=c,i[8]=f);let m=a?u:u??`button`,h;i[9]===s?h=i[10]:(h=e(`text-body hover:text-strong hover:bg-neutral-500/10 flex w-full min-w-0 items-center gap-2 rounded-[0.625rem] py-1 pr-1.5 pl-1 text-left font-medium`,`data-state-open:bg-neutral-500/15 data-state-open:text-strong`,`aria-expanded:bg-neutral-500/15 aria-expanded:text-strong`,`ring-focus-accent focus:outline-hidden focus-visible:ring-4`,`*:first:size-7`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`group-data-[state=collapsed]/sidebar-nav:p-1`,`group-data-[state=collapsed]/sidebar-nav:[&>:not(:first-child)]:sr-only`,`transition-[width,padding]`,D,s),i[9]=s,i[10]=h);let g;return i[11]!==d||i[12]!==o||i[13]!==l||i[14]!==f||i[15]!==m||i[16]!==h?(g=/* @__PURE__ */ C(d,{"data-slot":f,type:m,className:h,...l,children:o}),i[11]=d,i[12]=o,i[13]=l,i[14]=f,i[15]=m,i[16]=h,i[17]=g):g=i[17],g},Tooltip:e=>{let n=p(26),r,i,o,s,c,l;n[0]===e?(r=n[1],i=n[2],o=n[3],s=n[4],c=n[5],l=n[6]):({children:r,"data-slot":i,label:o,shortcut:c,side:l,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=o,n[4]=s,n[5]=c,n[6]=l);let u=l===void 0?`right`:l,{isMobile:d,open:f}=A(`Tooltip`),m=!d&&!f,[h,g]=b(!1),[_,v]=b(m);_!==m&&(v(m),g(!1));let y;n[7]===m?y=n[8]:(y=e=>{g(e&&m)},n[7]=m,n[8]=y);let x=y,S=m&&h,T;n[9]===r?T=n[10]:(T=/* @__PURE__ */ C(a.Trigger,{asChild:!0,children:r}),n[9]=r,n[10]=T);let E;n[11]===i?E=n[12]:(E=t(i,`sidebar-tooltip`),n[11]=i,n[12]=E);let D;n[13]!==o||n[14]!==c?(D=/* @__PURE__ */ C(L,{label:o,shortcut:c}),n[13]=o,n[14]=c,n[15]=D):D=n[15];let O;n[16]!==s||n[17]!==u||n[18]!==E||n[19]!==D?(O=/* @__PURE__ */ C(a.Content,{"data-slot":E,side:u,...s,children:D}),n[16]=s,n[17]=u,n[18]=E,n[19]=D,n[20]=O):O=n[20];let k;return n[21]!==x||n[22]!==S||n[23]!==T||n[24]!==O?(k=/* @__PURE__ */ w(a.Root,{disableHoverableContent:!0,onOpenChange:x,open:S,children:[T,O]}),n[21]=x,n[22]=S,n[23]=T,n[24]=O,n[25]=k):k=n[25],k},Separator:n=>{let r=p(12),i,a,o;r[0]===n?(i=r[1],a=r[2],o=r[3]):({className:i,"data-slot":a,...o}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o);let c;r[4]===a?c=r[5]:(c=t(a,`sidebar-separator`),r[4]=a,r[5]=c);let l;r[6]===i?l=r[7]:(l=e(`my-3`,`group-data-[state=collapsed]/sidebar-nav:w-9`,`transition-[width]`,D,i),r[6]=i,r[7]=l);let u;return r[8]!==o||r[9]!==c||r[10]!==l?(u=/* @__PURE__ */ C(s,{"data-slot":c,className:l,...o}),r[8]=o,r[9]=c,r[10]=l,r[11]=u):u=r[11],u}},Y=`mantle-sidebar-state`,X={collapsed:`collapsed`,expanded:`expanded`};function Z(e){let t=o(e,Y);if(t===X.expanded)return!0;if(t===X.collapsed)return!1}function Q(e,t={}){let{domain:n,maxAge:r=31536e3,path:i=`/`,sameSite:a=`Lax`,secure:o=!1}=t,s=e?X.expanded:X.collapsed,c=[`${Y}=${s}`,`Max-Age=${r}`,`Path=${i}`];return n!=null&&c.push(`Domain=${n}`),c.push(`SameSite=${a}`),o&&c.push(`Secure`),c.join(`; `)}export{Y as SIDEBAR_STATE_COOKIE_NAME,J as Sidebar,Z as extractSidebarStateCookie,Q as serializeSidebarStateCookie,k as useSidebar};
|