@foundrykit/components 2.1.4 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/chunk-4WYKNDYY.js +91 -0
  2. package/dist/chunk-4WYKNDYY.js.map +1 -0
  3. package/dist/chunk-5CXNMTIN.js +84 -0
  4. package/dist/chunk-5CXNMTIN.js.map +1 -0
  5. package/dist/chunk-B5ZTF5MZ.js +203 -0
  6. package/dist/chunk-B5ZTF5MZ.js.map +1 -0
  7. package/dist/chunk-EDNWBEKV.js +51 -0
  8. package/dist/chunk-EDNWBEKV.js.map +1 -0
  9. package/dist/chunk-ID7BFTID.js +248 -0
  10. package/dist/chunk-ID7BFTID.js.map +1 -0
  11. package/dist/chunk-IYBHXVCH.js +181 -0
  12. package/dist/chunk-IYBHXVCH.js.map +1 -0
  13. package/dist/chunk-KQZEF7PS.js +71 -0
  14. package/dist/chunk-KQZEF7PS.js.map +1 -0
  15. package/dist/chunk-P3GSYR7O.js +889 -0
  16. package/dist/chunk-P3GSYR7O.js.map +1 -0
  17. package/dist/chunk-PKSRYDN4.js +168 -0
  18. package/dist/chunk-PKSRYDN4.js.map +1 -0
  19. package/dist/chunk-SFM7ZMG2.js +104 -0
  20. package/dist/chunk-SFM7ZMG2.js.map +1 -0
  21. package/dist/chunk-TLQQZJUR.js +126 -0
  22. package/dist/chunk-TLQQZJUR.js.map +1 -0
  23. package/dist/chunk-UE7CDYEN.js +59 -0
  24. package/dist/chunk-UE7CDYEN.js.map +1 -0
  25. package/dist/chunk-UG7YS3D5.js +198 -0
  26. package/dist/chunk-UG7YS3D5.js.map +1 -0
  27. package/dist/components/advanced-search-bar/index.d.ts +308 -0
  28. package/dist/components/advanced-search-bar/index.js +34 -0
  29. package/dist/components/advanced-search-bar/index.js.map +1 -0
  30. package/dist/components/calendar/index.d.ts +20 -0
  31. package/dist/components/calendar/index.js +11 -0
  32. package/dist/components/calendar/index.js.map +1 -0
  33. package/dist/components/carousel/index.d.ts +40 -0
  34. package/dist/components/carousel/index.js +17 -0
  35. package/dist/components/carousel/index.js.map +1 -0
  36. package/dist/components/chart/index.d.ts +59 -0
  37. package/dist/components/chart/index.js +21 -0
  38. package/dist/components/chart/index.js.map +1 -0
  39. package/dist/components/combobox/index.d.ts +33 -0
  40. package/dist/components/combobox/index.js +10 -0
  41. package/dist/components/combobox/index.js.map +1 -0
  42. package/dist/components/command/index.d.ts +33 -0
  43. package/dist/components/command/index.js +25 -0
  44. package/dist/components/command/index.js.map +1 -0
  45. package/dist/components/data-table/index.d.ts +17 -0
  46. package/dist/components/data-table/index.js +9 -0
  47. package/dist/components/data-table/index.js.map +1 -0
  48. package/dist/components/date-picker/index.d.ts +17 -0
  49. package/dist/components/date-picker/index.js +9 -0
  50. package/dist/components/date-picker/index.js.map +1 -0
  51. package/dist/components/form/index.d.ts +37 -0
  52. package/dist/components/form/index.js +23 -0
  53. package/dist/components/form/index.js.map +1 -0
  54. package/dist/components/input-otp/index.d.ts +30 -0
  55. package/dist/components/input-otp/index.js +15 -0
  56. package/dist/components/input-otp/index.js.map +1 -0
  57. package/dist/components/pagination/index.d.ts +26 -0
  58. package/dist/components/pagination/index.js +20 -0
  59. package/dist/components/pagination/index.js.map +1 -0
  60. package/dist/components/search-bar/index.d.ts +17 -0
  61. package/dist/components/search-bar/index.js +9 -0
  62. package/dist/components/search-bar/index.js.map +1 -0
  63. package/dist/components/sidebar/index.d.ts +70 -0
  64. package/dist/components/sidebar/index.js +652 -0
  65. package/dist/components/sidebar/index.js.map +1 -0
  66. package/dist/components/theme-toggle/index.d.ts +20 -0
  67. package/dist/components/theme-toggle/index.js +9 -0
  68. package/dist/components/theme-toggle/index.js.map +1 -0
  69. package/dist/index.d.ts +27 -582
  70. package/dist/index.js +74 -2280
  71. package/dist/index.js.map +1 -1
  72. package/package.json +15 -8
  73. package/.turbo/turbo-build.log +0 -17
  74. package/.turbo/turbo-type-check.log +0 -4
  75. package/CHANGELOG.md +0 -351
  76. package/src/components/advanced-search-bar/config.ts +0 -223
  77. package/src/components/advanced-search-bar/index.tsx +0 -1415
  78. package/src/components/calendar/config.ts +0 -51
  79. package/src/components/calendar/index.tsx +0 -225
  80. package/src/components/carousel/config.ts +0 -28
  81. package/src/components/carousel/index.tsx +0 -258
  82. package/src/components/chart/config.ts +0 -28
  83. package/src/components/chart/index.tsx +0 -365
  84. package/src/components/combobox/config.ts +0 -28
  85. package/src/components/combobox/index.tsx +0 -101
  86. package/src/components/command/config.ts +0 -804
  87. package/src/components/command/index.tsx +0 -195
  88. package/src/components/data-table/config.ts +0 -28
  89. package/src/components/data-table/index.tsx +0 -124
  90. package/src/components/date-picker/config.ts +0 -55
  91. package/src/components/date-picker/index.tsx +0 -207
  92. package/src/components/form/config.ts +0 -21
  93. package/src/components/form/index.tsx +0 -150
  94. package/src/components/input-otp/config.ts +0 -28
  95. package/src/components/input-otp/index.tsx +0 -92
  96. package/src/components/pagination/config.ts +0 -367
  97. package/src/components/pagination/index.tsx +0 -135
  98. package/src/components/search-bar/config.ts +0 -58
  99. package/src/components/search-bar/index.tsx +0 -70
  100. package/src/components/sidebar/config.ts +0 -29
  101. package/src/components/sidebar/index.tsx +0 -723
  102. package/src/components/theme-toggle/config.ts +0 -58
  103. package/src/components/theme-toggle/index.tsx +0 -35
  104. package/src/index.ts +0 -82
  105. package/tsconfig.json +0 -12
  106. package/tsconfig.lint.json +0 -8
  107. package/tsup.config.ts +0 -11
@@ -0,0 +1,652 @@
1
+ 'use client';
2
+ "use client";
3
+
4
+ // src/components/sidebar/index.tsx
5
+ import { useIsMobile } from "@foundrykit/hooks";
6
+ import {
7
+ Button,
8
+ Input,
9
+ Separator,
10
+ Sheet,
11
+ SheetContent,
12
+ SheetDescription,
13
+ SheetHeader,
14
+ SheetTitle,
15
+ Skeleton,
16
+ Tooltip,
17
+ TooltipContent,
18
+ TooltipProvider,
19
+ TooltipTrigger
20
+ } from "@foundrykit/primitives";
21
+ import { cn } from "@foundrykit/utils";
22
+ import { Slot } from "@radix-ui/react-slot";
23
+ import { cva } from "class-variance-authority";
24
+ import { PanelLeftIcon } from "lucide-react";
25
+ import * as React from "react";
26
+ import { jsx, jsxs } from "react/jsx-runtime";
27
+ var SIDEBAR_COOKIE_NAME = "sidebar_state";
28
+ var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
29
+ var SIDEBAR_WIDTH = "16rem";
30
+ var SIDEBAR_WIDTH_MOBILE = "18rem";
31
+ var SIDEBAR_WIDTH_ICON = "3rem";
32
+ var SIDEBAR_KEYBOARD_SHORTCUT = "b";
33
+ var SidebarContext = React.createContext(null);
34
+ function useSidebar() {
35
+ const context = React.useContext(SidebarContext);
36
+ if (!context) {
37
+ throw new Error("useSidebar must be used within a SidebarProvider.");
38
+ }
39
+ return context;
40
+ }
41
+ function SidebarProvider({
42
+ defaultOpen = true,
43
+ open: openProp,
44
+ onOpenChange: setOpenProp,
45
+ className,
46
+ style,
47
+ children,
48
+ ...props
49
+ }) {
50
+ const isMobile = useIsMobile();
51
+ const [openMobile, setOpenMobile] = React.useState(false);
52
+ const [_open, _setOpen] = React.useState(defaultOpen);
53
+ const open = openProp ?? _open;
54
+ const setOpen = React.useCallback(
55
+ (value) => {
56
+ const openState = typeof value === "function" ? value(open) : value;
57
+ if (setOpenProp) {
58
+ setOpenProp(openState);
59
+ } else {
60
+ _setOpen(openState);
61
+ }
62
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
63
+ },
64
+ [setOpenProp, open]
65
+ );
66
+ const toggleSidebar = React.useCallback(() => {
67
+ return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
68
+ }, [isMobile, setOpen, setOpenMobile]);
69
+ React.useEffect(() => {
70
+ const handleKeyDown = (event) => {
71
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
72
+ event.preventDefault();
73
+ toggleSidebar();
74
+ }
75
+ };
76
+ window.addEventListener("keydown", handleKeyDown);
77
+ return () => window.removeEventListener("keydown", handleKeyDown);
78
+ }, [toggleSidebar]);
79
+ const state = open ? "expanded" : "collapsed";
80
+ const contextValue = React.useMemo(
81
+ () => ({
82
+ state,
83
+ open,
84
+ setOpen,
85
+ isMobile,
86
+ openMobile,
87
+ setOpenMobile,
88
+ toggleSidebar
89
+ }),
90
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
91
+ );
92
+ return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
93
+ "div",
94
+ {
95
+ "data-slot": "sidebar-wrapper",
96
+ style: {
97
+ "--sidebar-width": SIDEBAR_WIDTH,
98
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
99
+ ...style
100
+ },
101
+ className: cn(
102
+ "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
103
+ className
104
+ ),
105
+ ...props,
106
+ children
107
+ }
108
+ ) }) });
109
+ }
110
+ function Sidebar({
111
+ side = "left",
112
+ variant = "sidebar",
113
+ collapsible = "offcanvas",
114
+ className,
115
+ children,
116
+ ...props
117
+ }) {
118
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
119
+ if (collapsible === "none") {
120
+ return /* @__PURE__ */ jsx(
121
+ "div",
122
+ {
123
+ "data-slot": "sidebar",
124
+ className: cn(
125
+ "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
126
+ className
127
+ ),
128
+ ...props,
129
+ children
130
+ }
131
+ );
132
+ }
133
+ if (isMobile) {
134
+ return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
135
+ SheetContent,
136
+ {
137
+ "data-sidebar": "sidebar",
138
+ "data-slot": "sidebar",
139
+ "data-mobile": "true",
140
+ className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
141
+ style: {
142
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE
143
+ },
144
+ side,
145
+ children: [
146
+ /* @__PURE__ */ jsxs(SheetHeader, { className: "sr-only", children: [
147
+ /* @__PURE__ */ jsx(SheetTitle, { children: "Sidebar" }),
148
+ /* @__PURE__ */ jsx(SheetDescription, { children: "Displays the mobile sidebar." })
149
+ ] }),
150
+ /* @__PURE__ */ jsx("div", { className: "flex h-full w-full flex-col", children })
151
+ ]
152
+ }
153
+ ) });
154
+ }
155
+ return /* @__PURE__ */ jsxs(
156
+ "div",
157
+ {
158
+ className: "text-sidebar-foreground group peer hidden md:block",
159
+ "data-state": state,
160
+ "data-collapsible": state === "collapsed" ? collapsible : "",
161
+ "data-variant": variant,
162
+ "data-side": side,
163
+ "data-slot": "sidebar",
164
+ children: [
165
+ /* @__PURE__ */ jsx(
166
+ "div",
167
+ {
168
+ "data-slot": "sidebar-gap",
169
+ className: cn(
170
+ "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
171
+ "group-data-[collapsible=offcanvas]:w-0",
172
+ "group-data-[side=right]:rotate-180",
173
+ variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
174
+ )
175
+ }
176
+ ),
177
+ /* @__PURE__ */ jsx(
178
+ "div",
179
+ {
180
+ "data-slot": "sidebar-container",
181
+ className: cn(
182
+ "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
183
+ side === "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)]",
184
+ // Adjust the padding for floating and inset variants.
185
+ variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
186
+ className
187
+ ),
188
+ ...props,
189
+ children: /* @__PURE__ */ jsx(
190
+ "div",
191
+ {
192
+ "data-sidebar": "sidebar",
193
+ "data-slot": "sidebar-inner",
194
+ className: "bg-sidebar group-data-[variant=floating]:border-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-sm",
195
+ children
196
+ }
197
+ )
198
+ }
199
+ )
200
+ ]
201
+ }
202
+ );
203
+ }
204
+ function SidebarTrigger({
205
+ className,
206
+ onClick,
207
+ ...props
208
+ }) {
209
+ const { toggleSidebar } = useSidebar();
210
+ return /* @__PURE__ */ jsxs(
211
+ Button,
212
+ {
213
+ "data-sidebar": "trigger",
214
+ "data-slot": "sidebar-trigger",
215
+ variant: "ghost",
216
+ size: "icon",
217
+ className: cn("size-7", className),
218
+ onClick: (event) => {
219
+ onClick?.(event);
220
+ toggleSidebar();
221
+ },
222
+ ...props,
223
+ children: [
224
+ /* @__PURE__ */ jsx(PanelLeftIcon, {}),
225
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
226
+ ]
227
+ }
228
+ );
229
+ }
230
+ function SidebarRail({ className, ...props }) {
231
+ const { toggleSidebar } = useSidebar();
232
+ return /* @__PURE__ */ jsx(
233
+ "button",
234
+ {
235
+ "data-sidebar": "rail",
236
+ "data-slot": "sidebar-rail",
237
+ "aria-label": "Toggle Sidebar",
238
+ tabIndex: -1,
239
+ onClick: toggleSidebar,
240
+ title: "Toggle Sidebar",
241
+ className: cn(
242
+ "hover:after:bg-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",
243
+ "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
244
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
245
+ "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
246
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
247
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
248
+ className
249
+ ),
250
+ ...props
251
+ }
252
+ );
253
+ }
254
+ function SidebarInset({ className, ...props }) {
255
+ return /* @__PURE__ */ jsx(
256
+ "main",
257
+ {
258
+ "data-slot": "sidebar-inset",
259
+ className: cn(
260
+ "bg-background relative flex w-full flex-1 flex-col",
261
+ "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-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
262
+ className
263
+ ),
264
+ ...props
265
+ }
266
+ );
267
+ }
268
+ function SidebarInput({
269
+ className,
270
+ ...props
271
+ }) {
272
+ return /* @__PURE__ */ jsx(
273
+ Input,
274
+ {
275
+ "data-slot": "sidebar-input",
276
+ "data-sidebar": "input",
277
+ className: cn("bg-background h-8 w-full shadow-none", className),
278
+ ...props
279
+ }
280
+ );
281
+ }
282
+ function SidebarHeader({ className, ...props }) {
283
+ return /* @__PURE__ */ jsx(
284
+ "div",
285
+ {
286
+ "data-slot": "sidebar-header",
287
+ "data-sidebar": "header",
288
+ className: cn("flex flex-col gap-2 p-2", className),
289
+ ...props
290
+ }
291
+ );
292
+ }
293
+ function SidebarFooter({ className, ...props }) {
294
+ return /* @__PURE__ */ jsx(
295
+ "div",
296
+ {
297
+ "data-slot": "sidebar-footer",
298
+ "data-sidebar": "footer",
299
+ className: cn("flex flex-col gap-2 p-2", className),
300
+ ...props
301
+ }
302
+ );
303
+ }
304
+ function SidebarSeparator({
305
+ className,
306
+ ...props
307
+ }) {
308
+ return /* @__PURE__ */ jsx(
309
+ Separator,
310
+ {
311
+ "data-slot": "sidebar-separator",
312
+ "data-sidebar": "separator",
313
+ className: cn("bg-sidebar-border mx-2 w-auto", className),
314
+ ...props
315
+ }
316
+ );
317
+ }
318
+ function SidebarContent({ className, ...props }) {
319
+ return /* @__PURE__ */ jsx(
320
+ "div",
321
+ {
322
+ "data-slot": "sidebar-content",
323
+ "data-sidebar": "content",
324
+ className: cn(
325
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
326
+ className
327
+ ),
328
+ ...props
329
+ }
330
+ );
331
+ }
332
+ function SidebarGroup({ className, ...props }) {
333
+ return /* @__PURE__ */ jsx(
334
+ "div",
335
+ {
336
+ "data-slot": "sidebar-group",
337
+ "data-sidebar": "group",
338
+ className: cn("relative flex w-full min-w-0 flex-col p-2", className),
339
+ ...props
340
+ }
341
+ );
342
+ }
343
+ function SidebarGroupLabel({
344
+ className,
345
+ asChild = false,
346
+ ...props
347
+ }) {
348
+ const Comp = asChild ? Slot : "div";
349
+ return /* @__PURE__ */ jsx(
350
+ Comp,
351
+ {
352
+ "data-slot": "sidebar-group-label",
353
+ "data-sidebar": "group-label",
354
+ className: cn(
355
+ "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
356
+ "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
357
+ className
358
+ ),
359
+ ...props
360
+ }
361
+ );
362
+ }
363
+ function SidebarGroupAction({
364
+ className,
365
+ asChild = false,
366
+ ...props
367
+ }) {
368
+ const Comp = asChild ? Slot : "button";
369
+ return /* @__PURE__ */ jsx(
370
+ Comp,
371
+ {
372
+ "data-slot": "sidebar-group-action",
373
+ "data-sidebar": "group-action",
374
+ className: cn(
375
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
376
+ // Increases the hit area of the button on mobile.
377
+ "after:absolute after:-inset-2 md:after:hidden",
378
+ "group-data-[collapsible=icon]:hidden",
379
+ className
380
+ ),
381
+ ...props
382
+ }
383
+ );
384
+ }
385
+ function SidebarGroupContent({
386
+ className,
387
+ ...props
388
+ }) {
389
+ return /* @__PURE__ */ jsx(
390
+ "div",
391
+ {
392
+ "data-slot": "sidebar-group-content",
393
+ "data-sidebar": "group-content",
394
+ className: cn("w-full text-sm", className),
395
+ ...props
396
+ }
397
+ );
398
+ }
399
+ function SidebarMenu({ className, ...props }) {
400
+ return /* @__PURE__ */ jsx(
401
+ "ul",
402
+ {
403
+ "data-slot": "sidebar-menu",
404
+ "data-sidebar": "menu",
405
+ className: cn("flex w-full min-w-0 flex-col gap-1", className),
406
+ ...props
407
+ }
408
+ );
409
+ }
410
+ function SidebarMenuItem({ className, ...props }) {
411
+ return /* @__PURE__ */ jsx(
412
+ "li",
413
+ {
414
+ "data-slot": "sidebar-menu-item",
415
+ "data-sidebar": "menu-item",
416
+ className: cn("group/menu-item relative", className),
417
+ ...props
418
+ }
419
+ );
420
+ }
421
+ var sidebarMenuButtonVariants = cva(
422
+ "peer/menu-button ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
423
+ {
424
+ variants: {
425
+ variant: {
426
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
427
+ outline: "bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
428
+ },
429
+ size: {
430
+ default: "h-8 text-sm",
431
+ sm: "h-7 text-xs",
432
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
433
+ }
434
+ },
435
+ defaultVariants: {
436
+ variant: "default",
437
+ size: "default"
438
+ }
439
+ }
440
+ );
441
+ function SidebarMenuButton({
442
+ asChild = false,
443
+ isActive = false,
444
+ variant = "default",
445
+ size = "default",
446
+ tooltip,
447
+ className,
448
+ ...props
449
+ }) {
450
+ const Comp = asChild ? Slot : "button";
451
+ const { isMobile, state } = useSidebar();
452
+ const button = /* @__PURE__ */ jsx(
453
+ Comp,
454
+ {
455
+ "data-slot": "sidebar-menu-button",
456
+ "data-sidebar": "menu-button",
457
+ "data-size": size,
458
+ "data-active": isActive,
459
+ className: cn(sidebarMenuButtonVariants({ variant, size }), className),
460
+ ...props
461
+ }
462
+ );
463
+ if (!tooltip) {
464
+ return button;
465
+ }
466
+ if (typeof tooltip === "string") {
467
+ tooltip = {
468
+ children: tooltip
469
+ };
470
+ }
471
+ return /* @__PURE__ */ jsxs(Tooltip, { children: [
472
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button }),
473
+ /* @__PURE__ */ jsx(
474
+ TooltipContent,
475
+ {
476
+ side: "right",
477
+ align: "center",
478
+ hidden: state !== "collapsed" || isMobile,
479
+ ...tooltip
480
+ }
481
+ )
482
+ ] });
483
+ }
484
+ function SidebarMenuAction({
485
+ className,
486
+ asChild = false,
487
+ showOnHover = false,
488
+ ...props
489
+ }) {
490
+ const Comp = asChild ? Slot : "button";
491
+ return /* @__PURE__ */ jsx(
492
+ Comp,
493
+ {
494
+ "data-slot": "sidebar-menu-action",
495
+ "data-sidebar": "menu-action",
496
+ className: cn(
497
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
498
+ // Increases the hit area of the button on mobile.
499
+ "after:absolute after:-inset-2 md:after:hidden",
500
+ "peer-data-[size=sm]/menu-button:top-1",
501
+ "peer-data-[size=default]/menu-button:top-1.5",
502
+ "peer-data-[size=lg]/menu-button:top-2.5",
503
+ "group-data-[collapsible=icon]:hidden",
504
+ showOnHover && "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
505
+ className
506
+ ),
507
+ ...props
508
+ }
509
+ );
510
+ }
511
+ function SidebarMenuBadge({
512
+ className,
513
+ ...props
514
+ }) {
515
+ return /* @__PURE__ */ jsx(
516
+ "div",
517
+ {
518
+ "data-slot": "sidebar-menu-badge",
519
+ "data-sidebar": "menu-badge",
520
+ className: cn(
521
+ "text-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",
522
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
523
+ "peer-data-[size=sm]/menu-button:top-1",
524
+ "peer-data-[size=default]/menu-button:top-1.5",
525
+ "peer-data-[size=lg]/menu-button:top-2.5",
526
+ "group-data-[collapsible=icon]:hidden",
527
+ className
528
+ ),
529
+ ...props
530
+ }
531
+ );
532
+ }
533
+ function SidebarMenuSkeleton({
534
+ className,
535
+ showIcon = false,
536
+ ...props
537
+ }) {
538
+ const width = React.useMemo(() => {
539
+ return `${Math.floor(Math.random() * 40) + 50}%`;
540
+ }, []);
541
+ return /* @__PURE__ */ jsxs(
542
+ "div",
543
+ {
544
+ "data-slot": "sidebar-menu-skeleton",
545
+ "data-sidebar": "menu-skeleton",
546
+ className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
547
+ ...props,
548
+ children: [
549
+ showIcon && /* @__PURE__ */ jsx(
550
+ Skeleton,
551
+ {
552
+ className: "size-4 rounded-md",
553
+ "data-sidebar": "menu-skeleton-icon"
554
+ }
555
+ ),
556
+ /* @__PURE__ */ jsx(
557
+ Skeleton,
558
+ {
559
+ className: "h-4 max-w-(--skeleton-width) flex-1",
560
+ "data-sidebar": "menu-skeleton-text",
561
+ style: {
562
+ "--skeleton-width": width
563
+ }
564
+ }
565
+ )
566
+ ]
567
+ }
568
+ );
569
+ }
570
+ function SidebarMenuSub({ className, ...props }) {
571
+ return /* @__PURE__ */ jsx(
572
+ "ul",
573
+ {
574
+ "data-slot": "sidebar-menu-sub",
575
+ "data-sidebar": "menu-sub",
576
+ className: cn(
577
+ "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
578
+ "group-data-[collapsible=icon]:hidden",
579
+ className
580
+ ),
581
+ ...props
582
+ }
583
+ );
584
+ }
585
+ function SidebarMenuSubItem({
586
+ className,
587
+ ...props
588
+ }) {
589
+ return /* @__PURE__ */ jsx(
590
+ "li",
591
+ {
592
+ "data-slot": "sidebar-menu-sub-item",
593
+ "data-sidebar": "menu-sub-item",
594
+ className: cn("group/menu-sub-item relative", className),
595
+ ...props
596
+ }
597
+ );
598
+ }
599
+ function SidebarMenuSubButton({
600
+ asChild = false,
601
+ size = "md",
602
+ isActive = false,
603
+ className,
604
+ ...props
605
+ }) {
606
+ const Comp = asChild ? Slot : "a";
607
+ return /* @__PURE__ */ jsx(
608
+ Comp,
609
+ {
610
+ "data-slot": "sidebar-menu-sub-button",
611
+ "data-sidebar": "menu-sub-button",
612
+ "data-size": size,
613
+ "data-active": isActive,
614
+ className: cn(
615
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden 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",
616
+ "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
617
+ size === "sm" && "text-xs",
618
+ size === "md" && "text-sm",
619
+ "group-data-[collapsible=icon]:hidden",
620
+ className
621
+ ),
622
+ ...props
623
+ }
624
+ );
625
+ }
626
+ export {
627
+ Sidebar,
628
+ SidebarContent,
629
+ SidebarFooter,
630
+ SidebarGroup,
631
+ SidebarGroupAction,
632
+ SidebarGroupContent,
633
+ SidebarGroupLabel,
634
+ SidebarHeader,
635
+ SidebarInput,
636
+ SidebarInset,
637
+ SidebarMenu,
638
+ SidebarMenuAction,
639
+ SidebarMenuBadge,
640
+ SidebarMenuButton,
641
+ SidebarMenuItem,
642
+ SidebarMenuSkeleton,
643
+ SidebarMenuSub,
644
+ SidebarMenuSubButton,
645
+ SidebarMenuSubItem,
646
+ SidebarProvider,
647
+ SidebarRail,
648
+ SidebarSeparator,
649
+ SidebarTrigger,
650
+ useSidebar
651
+ };
652
+ //# sourceMappingURL=index.js.map