laif-ds 1.0.0 → 1.0.2

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.
@@ -1,129 +1,139 @@
1
1
  "use client";
2
- import { jsx as d, jsxs as S } from "react/jsx-runtime";
3
- import { Root as N } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
4
- import { cva as I } from "../../node_modules/class-variance-authority/dist/index.js";
2
+ import { jsx as i, jsxs as N } from "react/jsx-runtime";
3
+ import { Root as y } from "../../node_modules/@radix-ui/react-slot/dist/index.js";
4
+ import { cva as A } from "../../node_modules/class-variance-authority/dist/index.js";
5
5
  import * as r from "react";
6
- import { Button as T } from "./button.js";
7
- import { Input as E } from "./input.js";
8
- import { Separator as A } from "./separator.js";
9
- import { Sheet as B, SheetContent as D, SheetHeader as O, SheetTitle as G } from "./sheet.js";
10
- import { Skeleton as C } from "./skeleton.js";
11
- import { Tooltip as H, TooltipTrigger as j, TooltipContent as K, TooltipProvider as L } from "./tooltip.js";
12
- import { useIsMobile as F } from "../../hooks/use-mobile.js";
13
- import { cn as i } from "../../lib/utils.js";
14
- import P from "../../node_modules/lucide-react/dist/esm/icons/panel-left.js";
15
- const $ = "sidebar_state", V = 3600 * 24 * 7, q = "16rem", W = "3rem", U = "b", k = r.createContext(null);
6
+ import { designTokens as C } from "../design-tokens.js";
7
+ import { navTokens as B } from "../nav-tokens.js";
8
+ import { Button as D } from "./button.js";
9
+ import { Input as O } from "./input.js";
10
+ import { Separator as G } from "./separator.js";
11
+ import { Sheet as H, SheetContent as j, SheetHeader as K, SheetTitle as L } from "./sheet.js";
12
+ import { Skeleton as z } from "./skeleton.js";
13
+ import { Tooltip as P, TooltipTrigger as F, TooltipContent as $, TooltipProvider as V } from "./tooltip.js";
14
+ import { useIsMobile as q } from "../../hooks/use-mobile.js";
15
+ import { cn as o } from "../../lib/utils.js";
16
+ import W from "../../node_modules/lucide-react/dist/esm/icons/panel-left.js";
17
+ const U = "sidebar_state", X = 3600 * 24 * 7, Y = "16rem", J = "3rem", Q = "b", I = r.createContext(null);
16
18
  function M() {
17
- const a = r.useContext(k);
19
+ const a = r.useContext(I);
18
20
  if (!a)
19
21
  throw new Error("useSidebar must be used within a SidebarProvider.");
20
22
  return a;
21
23
  }
22
- const X = r.forwardRef(
24
+ const Z = r.forwardRef(
23
25
  ({
24
26
  defaultOpen: a = !0,
25
27
  open: e,
26
28
  onOpenChange: t,
27
- className: o,
29
+ className: d,
28
30
  style: n,
29
31
  children: s,
30
32
  ...m
31
- }, h) => {
32
- const c = F(), [u, b] = r.useState(!1), [f, g] = r.useState(
33
+ }, v) => {
34
+ const l = q(), [b, f] = r.useState(!1), [g, u] = r.useState(!1);
35
+ r.useEffect(() => {
36
+ l && u(!1);
37
+ }, [l]);
38
+ const [x, h] = r.useState(
33
39
  null
34
40
  );
35
41
  r.useEffect(() => {
36
- u || g(null);
37
- }, [u]);
38
- const [v, x] = r.useState(a), w = e ?? v, y = r.useCallback(
39
- (l) => {
40
- const p = typeof l == "function" ? l(w) : l;
41
- t ? t(p) : x(p), document.cookie = `${$}=${p}; path=/; max-age=${V}`;
42
+ b || h(null);
43
+ }, [b]);
44
+ const [w, T] = r.useState(a), S = e ?? w, R = r.useCallback(
45
+ (c) => {
46
+ const p = typeof c == "function" ? c(S) : c;
47
+ t ? t(p) : T(p), document.cookie = `${U}=${p}; path=/; max-age=${X}`;
42
48
  },
43
- [t, w]
44
- ), R = r.useCallback(() => c ? b((l) => !l) : y((l) => !l), [c, y, b]);
49
+ [t, S]
50
+ ), k = r.useCallback(() => l ? f((c) => !c) : R((c) => !c), [l, R, f]);
45
51
  r.useEffect(() => {
46
- const l = (p) => {
47
- p.key === U && (p.metaKey || p.ctrlKey) && (p.preventDefault(), R());
52
+ const c = (p) => {
53
+ p.key === Q && (p.metaKey || p.ctrlKey) && (p.preventDefault(), k());
48
54
  };
49
- return window.addEventListener("keydown", l), () => window.removeEventListener("keydown", l);
50
- }, [R]);
51
- const _ = w ? "expanded" : "collapsed", z = r.useMemo(
55
+ return window.addEventListener("keydown", c), () => window.removeEventListener("keydown", c);
56
+ }, [k]);
57
+ const _ = S || g ? "expanded" : "collapsed", E = r.useMemo(
52
58
  () => ({
53
59
  state: _,
54
- open: w,
55
- setOpen: y,
56
- isMobile: c,
57
- openMobile: u,
58
- setOpenMobile: b,
59
- mobileNavTarget: f,
60
- setMobileNavTarget: g,
61
- toggleSidebar: R
60
+ open: S,
61
+ setOpen: R,
62
+ peek: g,
63
+ setPeek: u,
64
+ isMobile: l,
65
+ openMobile: b,
66
+ setOpenMobile: f,
67
+ mobileNavTarget: x,
68
+ setMobileNavTarget: h,
69
+ toggleSidebar: k
62
70
  }),
63
71
  [
64
72
  _,
65
- w,
66
- y,
67
- c,
73
+ S,
74
+ R,
75
+ g,
68
76
  u,
77
+ l,
69
78
  b,
70
79
  f,
71
- g,
72
- R
80
+ x,
81
+ h,
82
+ k
73
83
  ]
74
84
  );
75
- return /* @__PURE__ */ d(k.Provider, { value: z, children: /* @__PURE__ */ d(L, { delayDuration: 0, children: /* @__PURE__ */ d(
85
+ return /* @__PURE__ */ i(I.Provider, { value: E, children: /* @__PURE__ */ i(V, { delayDuration: 0, children: /* @__PURE__ */ i(
76
86
  "div",
77
87
  {
78
88
  style: {
79
- "--sidebar-width": q,
80
- "--sidebar-width-icon": W,
89
+ "--sidebar-width": Y,
90
+ "--sidebar-width-icon": J,
81
91
  ...n
82
92
  },
83
- className: i(
93
+ className: o(
84
94
  "group/sidebar-wrapper has-[[data-variant=inset]]:bg-d-sidebar flex min-h-svh w-full",
85
- o
95
+ d
86
96
  ),
87
- ref: h,
97
+ ref: v,
88
98
  ...m,
89
99
  children: s
90
100
  }
91
101
  ) }) });
92
102
  }
93
103
  );
94
- X.displayName = "SidebarProvider";
95
- const Y = r.forwardRef(
104
+ Z.displayName = "SidebarProvider";
105
+ const ee = r.forwardRef(
96
106
  ({
97
107
  side: a = "left",
98
108
  variant: e = "sidebar",
99
109
  collapsible: t = "offcanvas",
100
- className: o,
110
+ className: d,
101
111
  children: n,
102
112
  ...s
103
113
  }, m) => {
104
- const { isMobile: h, state: c, openMobile: u, setOpenMobile: b } = M(), f = r.useRef(null), g = r.useRef(null);
105
- return h ? /* @__PURE__ */ d(B, { open: u, onOpenChange: b, ...s, children: /* @__PURE__ */ S(
106
- D,
114
+ const { isMobile: v, state: l, peek: b, openMobile: f, setOpenMobile: g } = M(), u = r.useRef(null), x = r.useRef(null);
115
+ return v ? /* @__PURE__ */ i(H, { open: f, onOpenChange: g, ...s, children: /* @__PURE__ */ N(
116
+ j,
107
117
  {
108
118
  "data-sidebar": "sidebar",
109
119
  "data-mobile": "true",
110
- className: "bg-d-sidebar text-d-sidebar-foreground p-0 [&_[data-sidebar=header]]:pr-12 [&>button]:top-2 [&>button]:right-2 [&>button]:flex [&>button]:size-11 [&>button]:items-center [&>button]:justify-center [&>button]:opacity-100",
120
+ className: "bg-d-sidebar text-d-sidebar-foreground p-0 [&>button]:top-2 [&>button]:right-2 [&>button]:flex [&>button]:size-11 [&>button]:items-center [&>button]:justify-center [&>button]:opacity-100",
111
121
  side: "full",
112
122
  "aria-describedby": void 0,
113
- onOpenAutoFocus: (v) => {
114
- v.preventDefault();
115
- const x = document.activeElement;
116
- g.current = x instanceof HTMLElement && x !== document.body ? x : null, f.current?.focus();
123
+ onOpenAutoFocus: (h) => {
124
+ h.preventDefault();
125
+ const w = document.activeElement;
126
+ x.current = w instanceof HTMLElement && w !== document.body ? w : null, u.current?.focus();
117
127
  },
118
- onCloseAutoFocus: (v) => {
119
- v.preventDefault(), g.current?.focus();
128
+ onCloseAutoFocus: (h) => {
129
+ h.preventDefault(), x.current?.focus();
120
130
  },
121
131
  children: [
122
- /* @__PURE__ */ d(O, { className: "sr-only", children: /* @__PURE__ */ d(G, { children: "Navigation menu" }) }),
123
- /* @__PURE__ */ d(
132
+ /* @__PURE__ */ i(K, { className: "sr-only", children: /* @__PURE__ */ i(L, { children: "Navigation menu" }) }),
133
+ /* @__PURE__ */ i(
124
134
  "div",
125
135
  {
126
- ref: f,
136
+ ref: u,
127
137
  tabIndex: -1,
128
138
  className: "flex h-full w-full flex-col outline-none",
129
139
  children: n
@@ -131,54 +141,94 @@ const Y = r.forwardRef(
131
141
  )
132
142
  ]
133
143
  }
134
- ) }) : t === "none" ? /* @__PURE__ */ d(
144
+ ) }) : t === "none" ? /* @__PURE__ */ i(
135
145
  "div",
136
146
  {
137
- className: i(
147
+ className: o(
138
148
  "bg-d-sidebar text-d-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",
139
- o
149
+ d
140
150
  ),
141
151
  ref: m,
142
152
  ...s,
143
153
  children: n
144
154
  }
145
- ) : /* @__PURE__ */ S(
155
+ ) : /* @__PURE__ */ N(
146
156
  "div",
147
157
  {
148
158
  ref: m,
149
159
  className: "group peer text-d-sidebar-foreground hidden md:block",
150
- "data-state": c,
151
- "data-collapsible": c === "collapsed" ? t : "",
160
+ "data-state": l,
161
+ "data-collapsible": l === "collapsed" ? t : "",
152
162
  "data-variant": e,
153
163
  "data-side": a,
164
+ "data-peek": b ? "true" : void 0,
154
165
  children: [
155
- /* @__PURE__ */ d(
166
+ /* @__PURE__ */ i(
156
167
  "div",
157
168
  {
158
- className: i(
159
- "relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear",
169
+ className: o(
170
+ "relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear motion-reduce:transition-none",
160
171
  "group-data-[collapsible=offcanvas]:w-0",
161
172
  "group-data-[side=right]:rotate-180",
162
- e === "floating" || e === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]" : "group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]"
173
+ // The peek rule repeats the icon width instead of sharing the
174
+ // selector with `collapsible=icon`: `data-collapsible` is emptied
175
+ // the moment `state` flips to "expanded", so during a peek that
176
+ // selector no longer matches and the gap would grow to the full
177
+ // width — dragging the whole page 13rem to the right. Holding the
178
+ // gap here is what makes the peek an overlay. Same formula per
179
+ // variant, or floating/inset lose the 16px of padding they reserve.
180
+ e === "floating" || e === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))] group-data-[peek=true]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]" : "group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[peek=true]:w-[var(--sidebar-width-icon)]"
163
181
  )
164
182
  }
165
183
  ),
166
- /* @__PURE__ */ d(
184
+ /* @__PURE__ */ i(
167
185
  "div",
168
186
  {
169
- className: i(
170
- "fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",
187
+ className: o(
188
+ "fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear motion-reduce:transition-none md:flex",
171
189
  a === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
172
190
  // Adjust the padding for floating and inset variants.
173
- e === "floating" || e === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]" : "group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",
174
- o
191
+ e === "floating" || e === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]" : (
192
+ // `border-d-sidebar-border` is not decoration, it is the fix: the
193
+ // v4 entry (`src/styles/index.css`) carries no
194
+ // `* { border-color }` base reset — only `index.v3.css` does —
195
+ // so a bare `border-r` resolves to Tailwind v4's default,
196
+ // `currentColor`. That inherits the host app's body text
197
+ // colour, which is how the panel's edge came out near-white on
198
+ // a dark theme and near-black on a light one. Naming the token
199
+ // pins it to `--colors--border--subtle`, the same value the
200
+ // rail, the separator and the floating variant already use.
201
+ "border-d-sidebar-border group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l"
202
+ ),
203
+ // PENDING PO DECISION: the resting `z-10` sits under the sticky
204
+ // header the template apps put in the main area, so a peeking panel
205
+ // would slide *behind* it. `z-30` clears every sticky layer in the
206
+ // current templates but the right value depends on the host app's
207
+ // stack, which the library cannot know — hence a working default
208
+ // rather than a prop. Raised only while peeking: pinned is a push,
209
+ // it covers nothing, and leaving it high would change what the
210
+ // sidebar overlaps in a state that works today.
211
+ "group-data-[peek=true]:z-30",
212
+ d
175
213
  ),
176
214
  ...s,
177
- children: /* @__PURE__ */ d(
215
+ children: /* @__PURE__ */ i(
178
216
  "div",
179
217
  {
180
218
  "data-sidebar": "sidebar",
181
- className: "bg-d-sidebar group-data-[variant=floating]:border-d-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow",
219
+ className: o(
220
+ "bg-d-sidebar group-data-[variant=floating]:border-d-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow",
221
+ // The overlay's shadow lives on this element and not on the
222
+ // panel: the panel's transition is a single declaration shared by
223
+ // `left`/`right`/`width`, and those must stay on the primitive's
224
+ // 200ms linear (the gap div animates in lockstep with them during
225
+ // a pin, and a second curve would desync the two). A shadow is not
226
+ // a layout property, so here it can take the house curve without
227
+ // dragging the width along.
228
+ "transition-shadow group-data-[peek=true]:shadow-lg motion-reduce:transition-none",
229
+ C.motion.duration,
230
+ C.motion.ease
231
+ ),
182
232
  children: n
183
233
  }
184
234
  )
@@ -189,41 +239,41 @@ const Y = r.forwardRef(
189
239
  );
190
240
  }
191
241
  );
192
- Y.displayName = "Sidebar";
193
- const J = r.forwardRef(({ className: a, onClick: e, ...t }, o) => {
242
+ ee.displayName = "Sidebar";
243
+ const ae = r.forwardRef(({ className: a, onClick: e, ...t }, d) => {
194
244
  const { toggleSidebar: n } = M();
195
- return /* @__PURE__ */ S(
196
- T,
245
+ return /* @__PURE__ */ N(
246
+ D,
197
247
  {
198
- ref: o,
248
+ ref: d,
199
249
  "data-sidebar": "trigger",
200
250
  variant: "ghost",
201
251
  size: "icon",
202
- className: i("h-7 w-7", a),
252
+ className: o("h-7 w-7", a),
203
253
  onClick: (s) => {
204
254
  e?.(s), n();
205
255
  },
206
256
  ...t,
207
257
  children: [
208
- /* @__PURE__ */ d(P, {}),
209
- /* @__PURE__ */ d("span", { className: "sr-only", children: "Toggle Sidebar" })
258
+ /* @__PURE__ */ i(W, {}),
259
+ /* @__PURE__ */ i("span", { className: "sr-only", children: "Toggle Sidebar" })
210
260
  ]
211
261
  }
212
262
  );
213
263
  });
214
- J.displayName = "SidebarTrigger";
215
- const Q = r.forwardRef(({ className: a, ...e }, t) => {
216
- const { toggleSidebar: o } = M();
217
- return /* @__PURE__ */ d(
264
+ ae.displayName = "SidebarTrigger";
265
+ const te = r.forwardRef(({ className: a, ...e }, t) => {
266
+ const { toggleSidebar: d } = M();
267
+ return /* @__PURE__ */ i(
218
268
  "button",
219
269
  {
220
270
  ref: t,
221
271
  "data-sidebar": "rail",
222
272
  "aria-label": "Toggle Sidebar",
223
273
  tabIndex: -1,
224
- onClick: o,
274
+ onClick: d,
225
275
  title: "Toggle Sidebar",
226
- className: i(
276
+ className: o(
227
277
  "hover:after:bg-d-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
228
278
  "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
229
279
  "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
@@ -236,92 +286,97 @@ const Q = r.forwardRef(({ className: a, ...e }, t) => {
236
286
  }
237
287
  );
238
288
  });
239
- Q.displayName = "SidebarRail";
240
- const Z = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
289
+ te.displayName = "SidebarRail";
290
+ const re = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
241
291
  "main",
242
292
  {
243
293
  ref: t,
244
- className: i(
294
+ className: o(
245
295
  "bg-d-background relative flex w-full flex-1 flex-col",
246
296
  "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2",
297
+ // Second half of the overlay fix, and easy to miss: the inset's left
298
+ // margin keys off `data-state`, which a peek flips to "expanded" — so
299
+ // without this the main area would slide by the 8px the collapsed rule
300
+ // adds, exactly the shift the gap div is being held still to prevent.
301
+ "md:peer-data-[peek=true]:peer-data-[variant=inset]:ml-2",
247
302
  a
248
303
  ),
249
304
  ...e
250
305
  }
251
306
  ));
252
- Z.displayName = "SidebarInset";
253
- const ee = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
254
- E,
307
+ re.displayName = "SidebarInset";
308
+ const ie = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
309
+ O,
255
310
  {
256
311
  ref: t,
257
312
  "data-sidebar": "input",
258
- className: i(
313
+ className: o(
259
314
  "bg-d-background focus-visible:ring-d-sidebar-ring h-8 w-full shadow-none focus-visible:ring-2",
260
315
  a
261
316
  ),
262
317
  ...e
263
318
  }
264
319
  ));
265
- ee.displayName = "SidebarInput";
266
- const ae = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
320
+ ie.displayName = "SidebarInput";
321
+ const oe = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
267
322
  "div",
268
323
  {
269
324
  ref: t,
270
325
  "data-sidebar": "header",
271
- className: i("flex flex-col gap-2 p-2", a),
326
+ className: o("flex flex-col gap-2 p-2", a),
272
327
  ...e
273
328
  }
274
329
  ));
275
- ae.displayName = "SidebarHeader";
276
- const te = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
330
+ oe.displayName = "SidebarHeader";
331
+ const de = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
277
332
  "div",
278
333
  {
279
334
  ref: t,
280
335
  "data-sidebar": "footer",
281
- className: i("flex flex-col gap-2 p-2", a),
336
+ className: o("flex flex-col gap-2 p-2", a),
282
337
  ...e
283
338
  }
284
339
  ));
285
- te.displayName = "SidebarFooter";
286
- const re = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
287
- A,
340
+ de.displayName = "SidebarFooter";
341
+ const ne = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
342
+ G,
288
343
  {
289
344
  ref: t,
290
345
  "data-sidebar": "separator",
291
- className: i("bg-d-sidebar-border mx-2 w-auto", a),
346
+ className: o("bg-d-sidebar-border mx-2 w-auto", a),
292
347
  ...e
293
348
  }
294
349
  ));
295
- re.displayName = "SidebarSeparator";
296
- const de = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
350
+ ne.displayName = "SidebarSeparator";
351
+ const se = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
297
352
  "div",
298
353
  {
299
354
  ref: t,
300
355
  "data-sidebar": "content",
301
- className: i(
356
+ className: o(
302
357
  "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-x-hidden group-data-[collapsible=icon]:overflow-y-auto",
303
358
  a
304
359
  ),
305
360
  ...e
306
361
  }
307
362
  ));
308
- de.displayName = "SidebarContent";
309
- const ie = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
363
+ se.displayName = "SidebarContent";
364
+ const le = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
310
365
  "div",
311
366
  {
312
367
  ref: t,
313
368
  "data-sidebar": "group",
314
- className: i("relative flex w-full min-w-0 flex-col p-2", a),
369
+ className: o("relative flex w-full min-w-0 flex-col p-2", a),
315
370
  ...e
316
371
  }
317
372
  ));
318
- ie.displayName = "SidebarGroup";
319
- const oe = r.forwardRef(({ className: a, asChild: e = !1, ...t }, o) => /* @__PURE__ */ d(
320
- e ? N : "div",
373
+ le.displayName = "SidebarGroup";
374
+ const ce = r.forwardRef(({ className: a, asChild: e = !1, ...t }, d) => /* @__PURE__ */ i(
375
+ e ? y : "div",
321
376
  {
322
- ref: o,
377
+ ref: d,
323
378
  "data-sidebar": "group-label",
324
- className: i(
379
+ className: o(
325
380
  "text-d-sidebar-foreground/70 ring-d-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
326
381
  "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
327
382
  a
@@ -329,13 +384,13 @@ const oe = r.forwardRef(({ className: a, asChild: e = !1, ...t }, o) => /* @__PU
329
384
  ...t
330
385
  }
331
386
  ));
332
- oe.displayName = "SidebarGroupLabel";
333
- const ne = r.forwardRef(({ className: a, asChild: e = !1, ...t }, o) => /* @__PURE__ */ d(
334
- e ? N : "button",
387
+ ce.displayName = "SidebarGroupLabel";
388
+ const ue = r.forwardRef(({ className: a, asChild: e = !1, ...t }, d) => /* @__PURE__ */ i(
389
+ e ? y : "button",
335
390
  {
336
- ref: o,
391
+ ref: d,
337
392
  "data-sidebar": "group-action",
338
- className: i(
393
+ className: o(
339
394
  "text-d-sidebar-foreground ring-d-sidebar-ring hover:bg-d-sidebar-accent hover:text-d-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
340
395
  // Increases the hit area of the button on mobile.
341
396
  "after:absolute after:-inset-2 after:md:hidden",
@@ -345,39 +400,49 @@ const ne = r.forwardRef(({ className: a, asChild: e = !1, ...t }, o) => /* @__PU
345
400
  ...t
346
401
  }
347
402
  ));
348
- ne.displayName = "SidebarGroupAction";
349
- const se = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
403
+ ue.displayName = "SidebarGroupAction";
404
+ const be = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
350
405
  "div",
351
406
  {
352
407
  ref: t,
353
408
  "data-sidebar": "group-content",
354
- className: i("w-full text-sm", a),
409
+ className: o("w-full text-sm", a),
355
410
  ...e
356
411
  }
357
412
  ));
358
- se.displayName = "SidebarGroupContent";
359
- const le = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
413
+ be.displayName = "SidebarGroupContent";
414
+ const fe = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
360
415
  "ul",
361
416
  {
362
417
  ref: t,
363
418
  "data-sidebar": "menu",
364
- className: i("flex w-full min-w-0 flex-col gap-1", a),
419
+ className: o("flex w-full min-w-0 flex-col gap-1", a),
365
420
  ...e
366
421
  }
367
422
  ));
368
- le.displayName = "SidebarMenu";
369
- const ce = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
423
+ fe.displayName = "SidebarMenu";
424
+ const pe = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
370
425
  "li",
371
426
  {
372
427
  ref: t,
373
428
  "data-sidebar": "menu-item",
374
- className: i("group/menu-item relative", a),
429
+ className: o("group/menu-item relative", a),
375
430
  ...e
376
431
  }
377
432
  ));
378
- ce.displayName = "SidebarMenuItem";
379
- const ue = I(
380
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-d-sidebar-ring transition-[width,height,padding] hover:bg-d-sidebar-accent hover:text-d-sidebar-accent-foreground focus-visible:ring-2 active:bg-d-sidebar-accent active:text-d-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-d-sidebar-accent data-[active=true]:font-bold data-[active=true]:text-d-sidebar-accent-foreground data-[state=open]:hover:bg-d-sidebar-accent data-[state=open]:hover:text-d-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
433
+ pe.displayName = "SidebarMenuItem";
434
+ const me = A(
435
+ o(
436
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-d-sidebar-ring transition-[width,height,padding] hover:bg-d-sidebar-accent hover:text-d-sidebar-accent-foreground focus-visible:ring-2 active:bg-d-sidebar-accent active:text-d-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-d-sidebar-accent data-[active=true]:font-bold data-[active=true]:text-d-sidebar-accent-foreground data-[state=open]:hover:bg-d-sidebar-accent data-[state=open]:hover:text-d-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
437
+ // The rail's own geometry — 32px pill, 6px padding, 20px glyph — and the
438
+ // reason those three numbers are one decision is in the token.
439
+ //
440
+ // Its `[&>svg]:size-5` outranks the `[&>svg]:size-4` above it on
441
+ // specificity, not on order (`.group[data-collapsible=icon] .btn > svg` is
442
+ // one class more), so expanded rows keep 16px glyphs whichever way Tailwind
443
+ // sorts the two rules.
444
+ B.rail.button
445
+ ),
381
446
  {
382
447
  variants: {
383
448
  variant: {
@@ -395,50 +460,50 @@ const ue = I(
395
460
  size: "default"
396
461
  }
397
462
  }
398
- ), be = r.forwardRef(
463
+ ), ge = r.forwardRef(
399
464
  ({
400
465
  asChild: a = !1,
401
466
  isActive: e = !1,
402
467
  variant: t = "default",
403
- size: o = "default",
468
+ size: d = "default",
404
469
  tooltip: n,
405
470
  className: s,
406
471
  ...m
407
- }, h) => {
408
- const c = a ? N : "button", { isMobile: u, state: b } = M(), f = /* @__PURE__ */ d(
409
- c,
472
+ }, v) => {
473
+ const l = a ? y : "button", { isMobile: b, state: f } = M(), g = f !== "collapsed" || b, u = /* @__PURE__ */ i(
474
+ l,
410
475
  {
411
- ref: h,
476
+ ref: v,
412
477
  "data-sidebar": "menu-button",
413
- "data-size": o,
478
+ "data-size": d,
414
479
  "data-active": e,
415
- className: i(ue({ variant: t, size: o }), s),
480
+ className: o(me({ variant: t, size: d }), s),
416
481
  ...m
417
482
  }
418
483
  );
419
484
  return n ? (typeof n == "string" && (n = {
420
485
  children: n
421
- }), /* @__PURE__ */ S(H, { children: [
422
- /* @__PURE__ */ d(j, { asChild: !0, children: f }),
423
- /* @__PURE__ */ d(
424
- K,
486
+ }), /* @__PURE__ */ N(P, { children: [
487
+ /* @__PURE__ */ i(F, { asChild: !0, children: u }),
488
+ /* @__PURE__ */ i(
489
+ $,
425
490
  {
426
491
  side: "right",
427
492
  align: "center",
428
- hidden: b !== "collapsed" || u,
493
+ hidden: g,
429
494
  ...n
430
495
  }
431
496
  )
432
- ] })) : f;
497
+ ] })) : u;
433
498
  }
434
499
  );
435
- be.displayName = "SidebarMenuButton";
436
- const fe = r.forwardRef(({ className: a, asChild: e = !1, showOnHover: t = !1, ...o }, n) => /* @__PURE__ */ d(
437
- e ? N : "button",
500
+ ge.displayName = "SidebarMenuButton";
501
+ const he = r.forwardRef(({ className: a, asChild: e = !1, showOnHover: t = !1, ...d }, n) => /* @__PURE__ */ i(
502
+ e ? y : "button",
438
503
  {
439
504
  ref: n,
440
505
  "data-sidebar": "menu-action",
441
- className: i(
506
+ className: o(
442
507
  "text-d-sidebar-foreground ring-d-sidebar-ring hover:bg-d-sidebar-accent hover:text-d-sidebar-accent-foreground peer-hover/menu-button:text-d-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
443
508
  // Increases the hit area of the button on mobile.
444
509
  "after:absolute after:-inset-2 after:md:hidden",
@@ -449,16 +514,16 @@ const fe = r.forwardRef(({ className: a, asChild: e = !1, showOnHover: t = !1, .
449
514
  t && "peer-data-[active=true]/menu-button:text-d-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
450
515
  a
451
516
  ),
452
- ...o
517
+ ...d
453
518
  }
454
519
  ));
455
- fe.displayName = "SidebarMenuAction";
456
- const pe = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
520
+ he.displayName = "SidebarMenuAction";
521
+ const ve = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
457
522
  "div",
458
523
  {
459
524
  ref: t,
460
525
  "data-sidebar": "menu-badge",
461
- className: i(
526
+ className: o(
462
527
  "text-d-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
463
528
  "peer-hover/menu-button:text-d-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-d-sidebar-accent-foreground",
464
529
  "peer-data-[size=sm]/menu-button:top-1",
@@ -470,26 +535,26 @@ const pe = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
470
535
  ...e
471
536
  }
472
537
  ));
473
- pe.displayName = "SidebarMenuBadge";
474
- const me = r.forwardRef(({ className: a, showIcon: e = !1, ...t }, o) => {
538
+ ve.displayName = "SidebarMenuBadge";
539
+ const xe = r.forwardRef(({ className: a, showIcon: e = !1, ...t }, d) => {
475
540
  const n = r.useMemo(() => `${Math.floor(Math.random() * 40) + 50}%`, []);
476
- return /* @__PURE__ */ S(
541
+ return /* @__PURE__ */ N(
477
542
  "div",
478
543
  {
479
- ref: o,
544
+ ref: d,
480
545
  "data-sidebar": "menu-skeleton",
481
- className: i("flex h-8 items-center gap-2 rounded-md px-2", a),
546
+ className: o("flex h-8 items-center gap-2 rounded-md px-2", a),
482
547
  ...t,
483
548
  children: [
484
- e && /* @__PURE__ */ d(
485
- C,
549
+ e && /* @__PURE__ */ i(
550
+ z,
486
551
  {
487
552
  className: "size-4 rounded-md",
488
553
  "data-sidebar": "menu-skeleton-icon"
489
554
  }
490
555
  ),
491
- /* @__PURE__ */ d(
492
- C,
556
+ /* @__PURE__ */ i(
557
+ z,
493
558
  {
494
559
  className: "h-4 max-w-[--skeleton-width] flex-1",
495
560
  "data-sidebar": "menu-skeleton-text",
@@ -502,13 +567,13 @@ const me = r.forwardRef(({ className: a, showIcon: e = !1, ...t }, o) => {
502
567
  }
503
568
  );
504
569
  });
505
- me.displayName = "SidebarMenuSkeleton";
506
- const ge = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
570
+ xe.displayName = "SidebarMenuSkeleton";
571
+ const we = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ i(
507
572
  "ul",
508
573
  {
509
574
  ref: t,
510
575
  "data-sidebar": "menu-sub",
511
- className: i(
576
+ className: o(
512
577
  "border-d-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
513
578
  "group-data-[collapsible=icon]:hidden",
514
579
  a
@@ -516,51 +581,51 @@ const ge = r.forwardRef(({ className: a, ...e }, t) => /* @__PURE__ */ d(
516
581
  ...e
517
582
  }
518
583
  ));
519
- ge.displayName = "SidebarMenuSub";
520
- const he = r.forwardRef(({ ...a }, e) => /* @__PURE__ */ d("li", { ref: e, ...a }));
521
- he.displayName = "SidebarMenuSubItem";
522
- const ve = r.forwardRef(({ asChild: a = !1, size: e = "md", isActive: t, className: o, ...n }, s) => /* @__PURE__ */ d(
523
- a ? N : "a",
584
+ we.displayName = "SidebarMenuSub";
585
+ const Se = r.forwardRef(({ ...a }, e) => /* @__PURE__ */ i("li", { ref: e, ...a }));
586
+ Se.displayName = "SidebarMenuSubItem";
587
+ const Ne = r.forwardRef(({ asChild: a = !1, size: e = "md", isActive: t, className: d, ...n }, s) => /* @__PURE__ */ i(
588
+ a ? y : "a",
524
589
  {
525
590
  ref: s,
526
591
  "data-sidebar": "menu-sub-button",
527
592
  "data-size": e,
528
593
  "data-active": t,
529
- className: i(
594
+ className: o(
530
595
  "text-d-sidebar-foreground ring-d-sidebar-ring hover:bg-d-sidebar-accent hover:text-d-sidebar-accent-foreground active:bg-d-sidebar-accent active:text-d-sidebar-accent-foreground [&>svg]:text-d-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
531
596
  "data-[active=true]:bg-d-sidebar-accent data-[active=true]:text-d-sidebar-accent-foreground data-[active=true]:font-bold",
532
597
  e === "sm" && "text-xs",
533
598
  e === "md" && "text-sm",
534
599
  "group-data-[collapsible=icon]:hidden",
535
- o
600
+ d
536
601
  ),
537
602
  ...n
538
603
  }
539
604
  ));
540
- ve.displayName = "SidebarMenuSubButton";
605
+ Ne.displayName = "SidebarMenuSubButton";
541
606
  export {
542
- Y as Sidebar,
543
- de as SidebarContent,
544
- te as SidebarFooter,
545
- ie as SidebarGroup,
546
- ne as SidebarGroupAction,
547
- se as SidebarGroupContent,
548
- oe as SidebarGroupLabel,
549
- ae as SidebarHeader,
550
- ee as SidebarInput,
551
- Z as SidebarInset,
552
- le as SidebarMenu,
553
- fe as SidebarMenuAction,
554
- pe as SidebarMenuBadge,
555
- be as SidebarMenuButton,
556
- ce as SidebarMenuItem,
557
- me as SidebarMenuSkeleton,
558
- ge as SidebarMenuSub,
559
- ve as SidebarMenuSubButton,
560
- he as SidebarMenuSubItem,
561
- X as SidebarProvider,
562
- Q as SidebarRail,
563
- re as SidebarSeparator,
564
- J as SidebarTrigger,
607
+ ee as Sidebar,
608
+ se as SidebarContent,
609
+ de as SidebarFooter,
610
+ le as SidebarGroup,
611
+ ue as SidebarGroupAction,
612
+ be as SidebarGroupContent,
613
+ ce as SidebarGroupLabel,
614
+ oe as SidebarHeader,
615
+ ie as SidebarInput,
616
+ re as SidebarInset,
617
+ fe as SidebarMenu,
618
+ he as SidebarMenuAction,
619
+ ve as SidebarMenuBadge,
620
+ ge as SidebarMenuButton,
621
+ pe as SidebarMenuItem,
622
+ xe as SidebarMenuSkeleton,
623
+ we as SidebarMenuSub,
624
+ Ne as SidebarMenuSubButton,
625
+ Se as SidebarMenuSubItem,
626
+ Z as SidebarProvider,
627
+ te as SidebarRail,
628
+ ne as SidebarSeparator,
629
+ ae as SidebarTrigger,
565
630
  M as useSidebar
566
631
  };