@meldgrove/ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +204 -2
  3. package/dist/components/alert-dialog.d.ts +18 -0
  4. package/dist/components/alert-dialog.js +44 -0
  5. package/dist/components/alert.d.ts +9 -0
  6. package/dist/components/alert.js +25 -0
  7. package/dist/components/avatar.d.ts +11 -0
  8. package/dist/components/avatar.js +24 -0
  9. package/dist/components/badge.d.ts +9 -0
  10. package/dist/components/badge.js +25 -0
  11. package/dist/components/breadcrumb.d.ts +11 -0
  12. package/dist/components/breadcrumb.js +28 -0
  13. package/dist/components/button-group.d.ts +11 -0
  14. package/dist/components/button-group.js +27 -0
  15. package/dist/components/button.d.ts +10 -0
  16. package/dist/components/button.js +36 -0
  17. package/dist/components/calendar.d.ts +8 -0
  18. package/dist/components/calendar.js +73 -0
  19. package/dist/components/card.d.ts +9 -0
  20. package/dist/components/card.js +25 -0
  21. package/dist/components/chart.d.ts +44 -0
  22. package/dist/components/chart.js +117 -0
  23. package/dist/components/checkbox.d.ts +4 -0
  24. package/dist/components/checkbox.js +10 -0
  25. package/dist/components/collapsible.d.ts +5 -0
  26. package/dist/components/collapsible.js +13 -0
  27. package/dist/components/command.d.ts +18 -0
  28. package/dist/components/command.js +35 -0
  29. package/dist/components/confirm-dialog.d.ts +15 -0
  30. package/dist/components/confirm-dialog.js +26 -0
  31. package/dist/components/copy-button.d.ts +6 -0
  32. package/dist/components/copy-button.js +23 -0
  33. package/dist/components/dialog.d.ts +17 -0
  34. package/dist/components/dialog.js +39 -0
  35. package/dist/components/dropdown-menu.d.ts +25 -0
  36. package/dist/components/dropdown-menu.js +53 -0
  37. package/dist/components/empty.d.ts +11 -0
  38. package/dist/components/empty.js +33 -0
  39. package/dist/components/field.d.ts +24 -0
  40. package/dist/components/field.js +74 -0
  41. package/dist/components/hover-card.d.ts +6 -0
  42. package/dist/components/hover-card.js +16 -0
  43. package/dist/components/input-group.d.ts +16 -0
  44. package/dist/components/input-group.js +64 -0
  45. package/dist/components/input.d.ts +3 -0
  46. package/dist/components/input.js +7 -0
  47. package/dist/components/item.d.ts +23 -0
  48. package/dist/components/item.js +67 -0
  49. package/dist/components/kbd.d.ts +3 -0
  50. package/dist/components/kbd.js +11 -0
  51. package/dist/components/label.d.ts +4 -0
  52. package/dist/components/label.js +9 -0
  53. package/dist/components/native-select.d.ts +8 -0
  54. package/dist/components/native-select.js +14 -0
  55. package/dist/components/pager.d.ts +7 -0
  56. package/dist/components/pager.js +11 -0
  57. package/dist/components/pagination.d.ts +13 -0
  58. package/dist/components/pagination.js +30 -0
  59. package/dist/components/popover.d.ts +10 -0
  60. package/dist/components/popover.js +28 -0
  61. package/dist/components/progress.d.ts +4 -0
  62. package/dist/components/progress.js +9 -0
  63. package/dist/components/radio-group.d.ts +5 -0
  64. package/dist/components/radio-group.js +13 -0
  65. package/dist/components/scroll-area.d.ts +5 -0
  66. package/dist/components/scroll-area.js +12 -0
  67. package/dist/components/secret-field.d.ts +23 -0
  68. package/dist/components/secret-field.js +47 -0
  69. package/dist/components/select.d.ts +15 -0
  70. package/dist/components/select.js +40 -0
  71. package/dist/components/separator.d.ts +4 -0
  72. package/dist/components/separator.js +9 -0
  73. package/dist/components/sheet.d.ts +14 -0
  74. package/dist/components/sheet.js +42 -0
  75. package/dist/components/sidebar.d.ts +70 -0
  76. package/dist/components/sidebar.js +212 -0
  77. package/dist/components/skeleton.d.ts +2 -0
  78. package/dist/components/skeleton.js +6 -0
  79. package/dist/components/sonner.d.ts +5 -0
  80. package/dist/components/sonner.js +14 -0
  81. package/dist/components/spinner.d.ts +2 -0
  82. package/dist/components/spinner.js +7 -0
  83. package/dist/components/states.d.ts +14 -0
  84. package/dist/components/states.js +18 -0
  85. package/dist/components/switch.d.ts +6 -0
  86. package/dist/components/switch.js +9 -0
  87. package/dist/components/table.d.ts +17 -0
  88. package/dist/components/table.js +34 -0
  89. package/dist/components/tabs.d.ts +11 -0
  90. package/dist/components/tabs.js +30 -0
  91. package/dist/components/textarea.d.ts +3 -0
  92. package/dist/components/textarea.js +7 -0
  93. package/dist/components/toggle-group.d.ts +9 -0
  94. package/dist/components/toggle-group.js +23 -0
  95. package/dist/components/toggle.d.ts +9 -0
  96. package/dist/components/toggle.js +27 -0
  97. package/dist/components/tooltip.d.ts +7 -0
  98. package/dist/components/tooltip.js +19 -0
  99. package/dist/hooks/use-mobile.d.ts +2 -0
  100. package/dist/hooks/use-mobile.js +13 -0
  101. package/dist/lib/format.d.ts +8 -0
  102. package/dist/lib/format.js +38 -0
  103. package/dist/lib/i18n-core.d.ts +38 -0
  104. package/dist/lib/i18n-core.js +61 -0
  105. package/dist/lib/i18n.d.ts +11 -0
  106. package/dist/lib/i18n.js +19 -0
  107. package/dist/lib/portal.d.ts +13 -0
  108. package/dist/lib/portal.js +17 -0
  109. package/dist/lib/theme.d.ts +5 -0
  110. package/dist/lib/theme.js +17 -0
  111. package/dist/lib/utils.d.ts +2 -0
  112. package/dist/lib/utils.js +5 -0
  113. package/dist/standalone/meldgrove-updates.js +57 -0
  114. package/dist/styles.css +11 -0
  115. package/dist/theme.css +62 -0
  116. package/dist/tokens.css +94 -0
  117. package/dist/updates/controller.d.ts +210 -0
  118. package/dist/updates/controller.js +592 -0
  119. package/dist/updates/core.d.ts +10 -0
  120. package/dist/updates/core.js +10 -0
  121. package/dist/updates/index.d.ts +15 -0
  122. package/dist/updates/index.js +15 -0
  123. package/dist/updates/messages.d.ts +92 -0
  124. package/dist/updates/messages.js +182 -0
  125. package/dist/updates/notice.d.ts +3 -0
  126. package/dist/updates/notice.js +6 -0
  127. package/dist/updates/react.d.ts +56 -0
  128. package/dist/updates/react.js +72 -0
  129. package/dist/updates/state.d.ts +214 -0
  130. package/dist/updates/state.js +396 -0
  131. package/dist/updates/transport.d.ts +50 -0
  132. package/dist/updates/transport.js +76 -0
  133. package/dist/updates/types.d.ts +77 -0
  134. package/dist/updates/types.js +68 -0
  135. package/dist/updates/update-button.d.ts +9 -0
  136. package/dist/updates/update-button.js +161 -0
  137. package/dist/updates/updates-settings.d.ts +17 -0
  138. package/dist/updates/updates-settings.js +97 -0
  139. package/package.json +159 -4
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { Popover as PopoverPrimitive } from "radix-ui";
6
+ import { usePortalContainer } from "../lib/portal.js";
7
+ function Popover({ ...props }) {
8
+ return _jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
9
+ }
10
+ function PopoverTrigger({ ...props }) {
11
+ return _jsx(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
12
+ }
13
+ function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
14
+ return (_jsx(PopoverPrimitive.Portal, { container: usePortalContainer(), children: _jsx(PopoverPrimitive.Content, { "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className), ...props }) }));
15
+ }
16
+ function PopoverAnchor({ ...props }) {
17
+ return _jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
18
+ }
19
+ function PopoverHeader({ className, ...props }) {
20
+ return (_jsx("div", { "data-slot": "popover-header", className: cn("flex flex-col gap-1 text-sm", className), ...props }));
21
+ }
22
+ function PopoverTitle({ className, ...props }) {
23
+ return _jsx("div", { "data-slot": "popover-title", className: cn("font-medium", className), ...props });
24
+ }
25
+ function PopoverDescription({ className, ...props }) {
26
+ return _jsx("p", { "data-slot": "popover-description", className: cn("text-muted-foreground", className), ...props });
27
+ }
28
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor, PopoverHeader, PopoverTitle, PopoverDescription, };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { Progress as ProgressPrimitive } from "radix-ui";
3
+ declare function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>): React.JSX.Element;
4
+ export { Progress };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { Progress as ProgressPrimitive } from "radix-ui";
6
+ function Progress({ className, value, ...props }) {
7
+ return (_jsx(ProgressPrimitive.Root, { "data-slot": "progress", className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className), ...props, children: _jsx(ProgressPrimitive.Indicator, { "data-slot": "progress-indicator", className: "h-full w-full flex-1 bg-primary transition-all", style: { transform: `translateX(-${100 - (value || 0)}%)` } }) }));
8
+ }
9
+ export { Progress };
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
3
+ declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): React.JSX.Element;
4
+ declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): React.JSX.Element;
5
+ export { RadioGroup, RadioGroupItem };
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { CircleIcon } from "lucide-react";
6
+ import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
7
+ function RadioGroup({ className, ...props }) {
8
+ return (_jsx(RadioGroupPrimitive.Root, { "data-slot": "radio-group", className: cn("grid gap-3", className), ...props }));
9
+ }
10
+ function RadioGroupItem({ className, ...props }) {
11
+ return (_jsx(RadioGroupPrimitive.Item, { "data-slot": "radio-group-item", className: cn("aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40", className), ...props, children: _jsx(RadioGroupPrimitive.Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: _jsx(CircleIcon, { className: "absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 fill-primary" }) }) }));
12
+ }
13
+ export { RadioGroup, RadioGroupItem };
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
3
+ declare function ScrollArea({ className, children, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>): React.JSX.Element;
4
+ declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): React.JSX.Element;
5
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
6
+ function ScrollArea({ className, children, ...props }) {
7
+ return (_jsxs(ScrollAreaPrimitive.Root, { "data-slot": "scroll-area", className: cn("relative", className), ...props, children: [_jsx(ScrollAreaPrimitive.Viewport, { "data-slot": "scroll-area-viewport", className: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1", children: children }), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] }));
8
+ }
9
+ function ScrollBar({ className, orientation = "vertical", ...props }) {
10
+ return (_jsx(ScrollAreaPrimitive.ScrollAreaScrollbar, { "data-slot": "scroll-area-scrollbar", orientation: orientation, className: cn("flex touch-none p-px transition-colors select-none", orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent", orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent", className), ...props, children: _jsx(ScrollAreaPrimitive.ScrollAreaThumb, { "data-slot": "scroll-area-thumb", className: "relative flex-1 rounded-full bg-border" }) }));
11
+ }
12
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,23 @@
1
+ /** A write-only secret: keep the stored one, replace it, or remove it. */
2
+ export type SecretValue = {
3
+ mode: "keep" | "replace" | "remove";
4
+ value: string;
5
+ };
6
+ export declare function initialSecret(stored: boolean): SecretValue;
7
+ /** The API value: undefined keeps the stored secret, a string replaces it, null removes it. */
8
+ export declare function secretPayload(secret: SecretValue): string | null | undefined;
9
+ export declare function SecretField(props: {
10
+ id: string;
11
+ label: string;
12
+ /** A value is stored on the server. */
13
+ stored: boolean;
14
+ /** The last characters of the stored value, e.g. "…3f9a". */
15
+ hint?: string | null;
16
+ value: SecretValue;
17
+ onChange: (value: SecretValue) => void;
18
+ /** Offer to remove the stored value. */
19
+ removable?: boolean;
20
+ placeholder?: string;
21
+ description?: string;
22
+ error?: string;
23
+ }): import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Field, FieldDescription, FieldError, FieldLabel } from "./field.js";
4
+ import { Button } from "./button.js";
5
+ import { Input } from "./input.js";
6
+ import { Badge } from "./badge.js";
7
+ import { KeyRound } from "lucide-react";
8
+ import { defineMessages, useT } from "../lib/i18n.js";
9
+ const messages = defineMessages({
10
+ en: {
11
+ stored: "Stored",
12
+ storedHint: "Stored ({hint})",
13
+ replace: "Replace",
14
+ keep: "Keep stored value",
15
+ remove: "Remove",
16
+ removed: "Removed when you save.",
17
+ undo: "Undo",
18
+ writeOnly: "Write-only: the stored value is never shown again.",
19
+ },
20
+ de: {
21
+ stored: "Gespeichert",
22
+ storedHint: "Gespeichert ({hint})",
23
+ replace: "Ersetzen",
24
+ keep: "Gespeicherten Wert behalten",
25
+ remove: "Entfernen",
26
+ removed: "Wird beim Speichern entfernt.",
27
+ undo: "Rückgängig",
28
+ writeOnly: "Nur schreibbar: Der gespeicherte Wert wird nie wieder angezeigt.",
29
+ },
30
+ });
31
+ export function initialSecret(stored) {
32
+ return { mode: stored ? "keep" : "replace", value: "" };
33
+ }
34
+ /** The API value: undefined keeps the stored secret, a string replaces it, null removes it. */
35
+ export function secretPayload(secret) {
36
+ if (secret.mode === "remove")
37
+ return null;
38
+ if (secret.mode === "replace" && secret.value.trim() !== "")
39
+ return secret.value.trim();
40
+ return undefined;
41
+ }
42
+ export function SecretField(props) {
43
+ const t = useT(messages);
44
+ const { value, onChange } = props;
45
+ const describedBy = `${props.id}-hint`;
46
+ return (_jsxs(Field, { "data-invalid": props.error ? true : undefined, children: [_jsx(FieldLabel, { htmlFor: props.id, children: props.label }), props.stored && value.mode !== "replace" ? (_jsx("div", { className: "flex flex-wrap items-center gap-2", id: props.id, tabIndex: -1, children: value.mode === "keep" ? (_jsxs(_Fragment, { children: [_jsxs(Badge, { variant: "secondary", children: [_jsx(KeyRound, {}), props.hint ? t("storedHint", { hint: props.hint }) : t("stored")] }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => onChange({ mode: "replace", value: "" }), children: t("replace") }), props.removable ? (_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => onChange({ mode: "remove", value: "" }), children: t("remove") })) : null] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground text-sm", children: t("removed") }), _jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => onChange({ mode: "keep", value: "" }), children: t("undo") })] })) })) : (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Input, { id: props.id, type: "password", autoComplete: "off", spellCheck: false, className: "min-w-0 flex-1 font-mono", value: value.value, placeholder: props.placeholder, "aria-invalid": props.error ? true : undefined, "aria-describedby": describedBy, autoFocus: props.stored, onChange: (event) => onChange({ mode: "replace", value: event.target.value }) }), props.stored ? (_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => onChange({ mode: "keep", value: "" }), children: t("keep") })) : null] })), _jsxs(FieldDescription, { id: describedBy, children: [props.description ? `${props.description} ` : "", t("writeOnly")] }), props.error ? _jsx(FieldError, { children: props.error }) : null] }));
47
+ }
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import { Select as SelectPrimitive } from "radix-ui";
3
+ declare function Select({ ...props }: React.ComponentProps<typeof SelectPrimitive.Root>): React.JSX.Element;
4
+ declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element;
5
+ declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
6
+ declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
7
+ size?: "sm" | "default";
8
+ }): React.JSX.Element;
9
+ declare function SelectContent({ className, children, position, align, ...props }: React.ComponentProps<typeof SelectPrimitive.Content>): React.JSX.Element;
10
+ declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): React.JSX.Element;
11
+ declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): React.JSX.Element;
12
+ declare function SelectSeparator({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Separator>): React.JSX.Element;
13
+ declare function SelectScrollUpButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>): React.JSX.Element;
14
+ declare function SelectScrollDownButton({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>): React.JSX.Element;
15
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
6
+ import { Select as SelectPrimitive } from "radix-ui";
7
+ import { usePortalContainer } from "../lib/portal.js";
8
+ function Select({ ...props }) {
9
+ return _jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
10
+ }
11
+ function SelectGroup({ ...props }) {
12
+ return _jsx(SelectPrimitive.Group, { "data-slot": "select-group", ...props });
13
+ }
14
+ function SelectValue({ ...props }) {
15
+ return _jsx(SelectPrimitive.Value, { "data-slot": "select-value", ...props });
16
+ }
17
+ function SelectTrigger({ className, size = "default", children, ...props }) {
18
+ return (_jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDownIcon, { className: "size-4 opacity-50" }) })] }));
19
+ }
20
+ function SelectContent({ className, children, position = "item-aligned", align = "center", ...props }) {
21
+ return (_jsx(SelectPrimitive.Portal, { container: usePortalContainer(), children: _jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", position === "popper" &&
22
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className), position: position, align: align, ...props, children: [_jsx(SelectScrollUpButton, {}), _jsx(SelectPrimitive.Viewport, { className: cn("p-1", position === "popper" &&
23
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"), children: children }), _jsx(SelectScrollDownButton, {})] }) }));
24
+ }
25
+ function SelectLabel({ className, ...props }) {
26
+ return (_jsx(SelectPrimitive.Label, { "data-slot": "select-label", className: cn("px-2 py-1.5 text-xs text-muted-foreground", className), ...props }));
27
+ }
28
+ function SelectItem({ className, children, ...props }) {
29
+ return (_jsxs(SelectPrimitive.Item, { "data-slot": "select-item", className: cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className), ...props, children: [_jsx("span", { "data-slot": "select-item-indicator", className: "absolute right-2 flex size-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "size-4" }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
30
+ }
31
+ function SelectSeparator({ className, ...props }) {
32
+ return (_jsx(SelectPrimitive.Separator, { "data-slot": "select-separator", className: cn("pointer-events-none -mx-1 my-1 h-px bg-border", className), ...props }));
33
+ }
34
+ function SelectScrollUpButton({ className, ...props }) {
35
+ return (_jsx(SelectPrimitive.ScrollUpButton, { "data-slot": "select-scroll-up-button", className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronUpIcon, { className: "size-4" }) }));
36
+ }
37
+ function SelectScrollDownButton({ className, ...props }) {
38
+ return (_jsx(SelectPrimitive.ScrollDownButton, { "data-slot": "select-scroll-down-button", className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronDownIcon, { className: "size-4" }) }));
39
+ }
40
+ export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, };
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import { Separator as SeparatorPrimitive } from "radix-ui";
3
+ declare function Separator({ className, orientation, decorative, ...props }: React.ComponentProps<typeof SeparatorPrimitive.Root>): React.JSX.Element;
4
+ export { Separator };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { Separator as SeparatorPrimitive } from "radix-ui";
6
+ function Separator({ className, orientation = "horizontal", decorative = true, ...props }) {
7
+ return (_jsx(SeparatorPrimitive.Root, { "data-slot": "separator", decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className), ...props }));
8
+ }
9
+ export { Separator };
@@ -0,0 +1,14 @@
1
+ import * as React from "react";
2
+ import { Dialog as SheetPrimitive } from "radix-ui";
3
+ declare function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>): React.JSX.Element;
4
+ declare function SheetTrigger({ ...props }: React.ComponentProps<typeof SheetPrimitive.Trigger>): React.JSX.Element;
5
+ declare function SheetClose({ ...props }: React.ComponentProps<typeof SheetPrimitive.Close>): React.JSX.Element;
6
+ declare function SheetContent({ className, children, side, showCloseButton, ...props }: React.ComponentProps<typeof SheetPrimitive.Content> & {
7
+ side?: "top" | "right" | "bottom" | "left";
8
+ showCloseButton?: boolean;
9
+ }): React.JSX.Element;
10
+ declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
11
+ declare function SheetFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
12
+ declare function SheetTitle({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Title>): React.JSX.Element;
13
+ declare function SheetDescription({ className, ...props }: React.ComponentProps<typeof SheetPrimitive.Description>): React.JSX.Element;
14
+ export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { XIcon } from "lucide-react";
6
+ import { Dialog as SheetPrimitive } from "radix-ui";
7
+ import { usePortalContainer } from "../lib/portal.js";
8
+ function Sheet({ ...props }) {
9
+ return _jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
10
+ }
11
+ function SheetTrigger({ ...props }) {
12
+ return _jsx(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
13
+ }
14
+ function SheetClose({ ...props }) {
15
+ return _jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
16
+ }
17
+ function SheetPortal({ ...props }) {
18
+ return _jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", container: usePortalContainer(), ...props });
19
+ }
20
+ function SheetOverlay({ className, ...props }) {
21
+ return (_jsx(SheetPrimitive.Overlay, { "data-slot": "sheet-overlay", className: cn("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", className), ...props }));
22
+ }
23
+ function SheetContent({ className, children, side = "right", showCloseButton = true, ...props }) {
24
+ return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", className: cn("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500", side === "right" &&
25
+ "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", side === "left" &&
26
+ "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", side === "top" &&
27
+ "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", side === "bottom" &&
28
+ "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", className), ...props, children: [children, showCloseButton && (_jsxs(SheetPrimitive.Close, { className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary", children: [_jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
29
+ }
30
+ function SheetHeader({ className, ...props }) {
31
+ return _jsx("div", { "data-slot": "sheet-header", className: cn("flex flex-col gap-1.5 p-4", className), ...props });
32
+ }
33
+ function SheetFooter({ className, ...props }) {
34
+ return (_jsx("div", { "data-slot": "sheet-footer", className: cn("mt-auto flex flex-col gap-2 p-4", className), ...props }));
35
+ }
36
+ function SheetTitle({ className, ...props }) {
37
+ return (_jsx(SheetPrimitive.Title, { "data-slot": "sheet-title", className: cn("font-semibold text-foreground", className), ...props }));
38
+ }
39
+ function SheetDescription({ className, ...props }) {
40
+ return (_jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className: cn("text-sm text-muted-foreground", className), ...props }));
41
+ }
42
+ export { Sheet, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
@@ -0,0 +1,70 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import { Button } from "./button.tsx";
4
+ import { Input } from "./input.tsx";
5
+ import { Separator } from "./separator.tsx";
6
+ import { TooltipContent } from "./tooltip.tsx";
7
+ type SidebarContextProps = {
8
+ state: "expanded" | "collapsed";
9
+ open: boolean;
10
+ setOpen: (open: boolean) => void;
11
+ openMobile: boolean;
12
+ setOpenMobile: (open: boolean) => void;
13
+ isMobile: boolean;
14
+ toggleSidebar: () => void;
15
+ };
16
+ declare function useSidebar(): SidebarContextProps;
17
+ declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React.ComponentProps<"div"> & {
18
+ defaultOpen?: boolean;
19
+ open?: boolean;
20
+ onOpenChange?: (open: boolean) => void;
21
+ }): React.JSX.Element;
22
+ declare function Sidebar({ side, variant, collapsible, className, children, ...props }: React.ComponentProps<"div"> & {
23
+ side?: "left" | "right";
24
+ variant?: "sidebar" | "floating" | "inset";
25
+ collapsible?: "offcanvas" | "icon" | "none";
26
+ }): React.JSX.Element;
27
+ declare function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
28
+ declare function SidebarRail({ className, ...props }: React.ComponentProps<"button">): React.JSX.Element;
29
+ /** The area beside the sidebar. A plain container: the page puts its own `<main>` inside. */
30
+ declare function SidebarInset({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
31
+ declare function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>): React.JSX.Element;
32
+ declare function SidebarHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
33
+ declare function SidebarFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
34
+ declare function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
35
+ declare function SidebarContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
36
+ declare function SidebarGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
37
+ declare function SidebarGroupLabel({ className, asChild, ...props }: React.ComponentProps<"div"> & {
38
+ asChild?: boolean;
39
+ }): React.JSX.Element;
40
+ declare function SidebarGroupAction({ className, asChild, ...props }: React.ComponentProps<"button"> & {
41
+ asChild?: boolean;
42
+ }): React.JSX.Element;
43
+ declare function SidebarGroupContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
44
+ declare function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
45
+ declare function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
46
+ declare const sidebarMenuButtonVariants: (props?: ({
47
+ variant?: "default" | "outline" | null | undefined;
48
+ size?: "default" | "sm" | "lg" | null | undefined;
49
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
50
+ declare function SidebarMenuButton({ asChild, isActive, variant, size, tooltip, className, ...props }: React.ComponentProps<"button"> & {
51
+ asChild?: boolean;
52
+ isActive?: boolean;
53
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
54
+ } & VariantProps<typeof sidebarMenuButtonVariants>): React.JSX.Element;
55
+ declare function SidebarMenuAction({ className, asChild, showOnHover, ...props }: React.ComponentProps<"button"> & {
56
+ asChild?: boolean;
57
+ showOnHover?: boolean;
58
+ }): React.JSX.Element;
59
+ declare function SidebarMenuBadge({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
60
+ declare function SidebarMenuSkeleton({ className, showIcon, ...props }: React.ComponentProps<"div"> & {
61
+ showIcon?: boolean;
62
+ }): React.JSX.Element;
63
+ declare function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">): React.JSX.Element;
64
+ declare function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
65
+ declare function SidebarMenuSubButton({ asChild, size, isActive, className, ...props }: React.ComponentProps<"a"> & {
66
+ asChild?: boolean;
67
+ size?: "sm" | "md";
68
+ isActive?: boolean;
69
+ }): React.JSX.Element;
70
+ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
@@ -0,0 +1,212 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cva } from "class-variance-authority";
5
+ import { cn } from "../lib/utils.js";
6
+ import { PanelLeftIcon } from "lucide-react";
7
+ import { Slot } from "radix-ui";
8
+ import { useIsMobile } from "../hooks/use-mobile.js";
9
+ import { Button } from "./button.js";
10
+ import { Input } from "./input.js";
11
+ import { Separator } from "./separator.js";
12
+ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "./sheet.js";
13
+ import { Skeleton } from "./skeleton.js";
14
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
15
+ const SIDEBAR_COOKIE_NAME = "sidebar_state";
16
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
17
+ const SIDEBAR_WIDTH = "16rem";
18
+ const SIDEBAR_WIDTH_MOBILE = "18rem";
19
+ const SIDEBAR_WIDTH_ICON = "3rem";
20
+ const SIDEBAR_KEYBOARD_SHORTCUT = "b";
21
+ const SidebarContext = React.createContext(null);
22
+ function useSidebar() {
23
+ const context = React.useContext(SidebarContext);
24
+ if (!context) {
25
+ throw new Error("useSidebar must be used within a SidebarProvider.");
26
+ }
27
+ return context;
28
+ }
29
+ function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }) {
30
+ const isMobile = useIsMobile();
31
+ const [openMobile, setOpenMobile] = React.useState(false);
32
+ // This is the internal state of the sidebar.
33
+ // We use openProp and setOpenProp for control from outside the component.
34
+ const [_open, _setOpen] = React.useState(defaultOpen);
35
+ const open = openProp ?? _open;
36
+ const setOpen = React.useCallback((value) => {
37
+ const openState = typeof value === "function" ? value(open) : value;
38
+ if (setOpenProp) {
39
+ setOpenProp(openState);
40
+ }
41
+ else {
42
+ _setOpen(openState);
43
+ }
44
+ // This sets the cookie to keep the sidebar state.
45
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
46
+ }, [setOpenProp, open]);
47
+ // Helper to toggle the sidebar.
48
+ const toggleSidebar = React.useCallback(() => {
49
+ return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
50
+ }, [isMobile, setOpen, setOpenMobile]);
51
+ // Adds a keyboard shortcut to toggle the sidebar.
52
+ React.useEffect(() => {
53
+ const handleKeyDown = (event) => {
54
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
55
+ event.preventDefault();
56
+ toggleSidebar();
57
+ }
58
+ };
59
+ window.addEventListener("keydown", handleKeyDown);
60
+ return () => window.removeEventListener("keydown", handleKeyDown);
61
+ }, [toggleSidebar]);
62
+ // We add a state so that we can do data-state="expanded" or "collapsed".
63
+ // This makes it easier to style the sidebar with Tailwind classes.
64
+ const state = open ? "expanded" : "collapsed";
65
+ const contextValue = React.useMemo(() => ({
66
+ state,
67
+ open,
68
+ setOpen,
69
+ isMobile,
70
+ openMobile,
71
+ setOpenMobile,
72
+ toggleSidebar,
73
+ }), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
74
+ return (_jsx(SidebarContext.Provider, { value: contextValue, children: _jsx(TooltipProvider, { delayDuration: 0, children: _jsx("div", { "data-slot": "sidebar-wrapper", style: {
75
+ "--sidebar-width": SIDEBAR_WIDTH,
76
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
77
+ ...style,
78
+ }, className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className), ...props, children: children }) }) }));
79
+ }
80
+ function Sidebar({ side = "left", variant = "sidebar", collapsible = "offcanvas", className, children, ...props }) {
81
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
82
+ if (collapsible === "none") {
83
+ return (_jsx("div", { "data-slot": "sidebar", className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className), ...props, children: children }));
84
+ }
85
+ if (isMobile) {
86
+ return (_jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: _jsxs(SheetContent, { "data-sidebar": "sidebar", "data-slot": "sidebar", "data-mobile": "true", className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", style: {
87
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
88
+ }, side: side, children: [_jsxs(SheetHeader, { className: "sr-only", children: [_jsx(SheetTitle, { children: "Sidebar" }), _jsx(SheetDescription, { children: "Displays the mobile sidebar." })] }), _jsx("div", { className: "flex h-full w-full flex-col", children: children })] }) }));
89
+ }
90
+ return (_jsxs("div", { className: "group peer hidden text-sidebar-foreground md:block", "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : "", "data-variant": variant, "data-side": side, "data-slot": "sidebar", children: [_jsx("div", { "data-slot": "sidebar-gap", className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset"
91
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
92
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)") }), _jsx("div", { "data-slot": "sidebar-container", className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", side === "left"
93
+ ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
94
+ : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
95
+ // Adjust the padding for floating and inset variants.
96
+ variant === "floating" || variant === "inset"
97
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
98
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className), ...props, children: _jsx("div", { "data-sidebar": "sidebar", "data-slot": "sidebar-inner", className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm", children: children }) })] }));
99
+ }
100
+ function SidebarTrigger({ className, onClick, ...props }) {
101
+ const { toggleSidebar } = useSidebar();
102
+ return (_jsxs(Button, { "data-sidebar": "trigger", "data-slot": "sidebar-trigger", variant: "ghost", size: "icon", className: cn("size-7", className), onClick: (event) => {
103
+ onClick?.(event);
104
+ toggleSidebar();
105
+ }, ...props, children: [_jsx(PanelLeftIcon, {}), _jsx("span", { className: "sr-only", children: "Toggle Sidebar" })] }));
106
+ }
107
+ function SidebarRail({ className, ...props }) {
108
+ const { toggleSidebar } = useSidebar();
109
+ return (_jsx("button", { "data-sidebar": "rail", "data-slot": "sidebar-rail", "aria-label": "Toggle Sidebar", tabIndex: -1, onClick: toggleSidebar, title: "Toggle Sidebar", className: cn("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] hover:after:bg-sidebar-border sm:flex", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className), ...props }));
110
+ }
111
+ /** The area beside the sidebar. A plain container: the page puts its own `<main>` inside. */
112
+ function SidebarInset({ className, ...props }) {
113
+ return (_jsx("div", { "data-slot": "sidebar-inset", className: cn("relative flex w-full flex-1 flex-col bg-background", "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", className), ...props }));
114
+ }
115
+ function SidebarInput({ className, ...props }) {
116
+ return (_jsx(Input, { "data-slot": "sidebar-input", "data-sidebar": "input", className: cn("h-8 w-full bg-background shadow-none", className), ...props }));
117
+ }
118
+ function SidebarHeader({ className, ...props }) {
119
+ return (_jsx("div", { "data-slot": "sidebar-header", "data-sidebar": "header", className: cn("flex flex-col gap-2 p-2", className), ...props }));
120
+ }
121
+ function SidebarFooter({ className, ...props }) {
122
+ return (_jsx("div", { "data-slot": "sidebar-footer", "data-sidebar": "footer", className: cn("flex flex-col gap-2 p-2", className), ...props }));
123
+ }
124
+ function SidebarSeparator({ className, ...props }) {
125
+ return (_jsx(Separator, { "data-slot": "sidebar-separator", "data-sidebar": "separator", className: cn("mx-2 w-auto bg-sidebar-border", className), ...props }));
126
+ }
127
+ function SidebarContent({ className, ...props }) {
128
+ return (_jsx("div", { "data-slot": "sidebar-content", "data-sidebar": "content", className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className), ...props }));
129
+ }
130
+ function SidebarGroup({ className, ...props }) {
131
+ return (_jsx("div", { "data-slot": "sidebar-group", "data-sidebar": "group", className: cn("relative flex w-full min-w-0 flex-col p-2", className), ...props }));
132
+ }
133
+ function SidebarGroupLabel({ className, asChild = false, ...props }) {
134
+ const Comp = asChild ? Slot.Root : "div";
135
+ return (_jsx(Comp, { "data-slot": "sidebar-group-label", "data-sidebar": "group-label", className: cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0", className), ...props }));
136
+ }
137
+ function SidebarGroupAction({ className, asChild = false, ...props }) {
138
+ const Comp = asChild ? Slot.Root : "button";
139
+ return (_jsx(Comp, { "data-slot": "sidebar-group-action", "data-sidebar": "group-action", className: cn("absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
140
+ // Increases the hit area of the button on mobile.
141
+ "after:absolute after:-inset-2 md:after:hidden", "group-data-[collapsible=icon]:hidden", className), ...props }));
142
+ }
143
+ function SidebarGroupContent({ className, ...props }) {
144
+ return (_jsx("div", { "data-slot": "sidebar-group-content", "data-sidebar": "group-content", className: cn("w-full text-sm", className), ...props }));
145
+ }
146
+ function SidebarMenu({ className, ...props }) {
147
+ return (_jsx("ul", { "data-slot": "sidebar-menu", "data-sidebar": "menu", className: cn("flex w-full min-w-0 flex-col gap-1", className), ...props }));
148
+ }
149
+ function SidebarMenuItem({ className, ...props }) {
150
+ return (_jsx("li", { "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className: cn("group/menu-item relative", className), ...props }));
151
+ }
152
+ const sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring 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! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", {
153
+ variants: {
154
+ variant: {
155
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
156
+ outline: "bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]",
157
+ },
158
+ size: {
159
+ default: "h-8 text-sm",
160
+ sm: "h-7 text-xs",
161
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
162
+ },
163
+ },
164
+ defaultVariants: {
165
+ variant: "default",
166
+ size: "default",
167
+ },
168
+ });
169
+ function SidebarMenuButton({ asChild = false, isActive = false, variant = "default", size = "default", tooltip, className, ...props }) {
170
+ const Comp = asChild ? Slot.Root : "button";
171
+ const { isMobile, state } = useSidebar();
172
+ const button = (_jsx(Comp, { "data-slot": "sidebar-menu-button", "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className), ...props }));
173
+ if (!tooltip) {
174
+ return button;
175
+ }
176
+ if (typeof tooltip === "string") {
177
+ tooltip = {
178
+ children: tooltip,
179
+ };
180
+ }
181
+ return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { side: "right", align: "center", hidden: state !== "collapsed" || isMobile, ...tooltip })] }));
182
+ }
183
+ function SidebarMenuAction({ className, asChild = false, showOnHover = false, ...props }) {
184
+ const Comp = asChild ? Slot.Root : "button";
185
+ return (_jsx(Comp, { "data-slot": "sidebar-menu-action", "data-sidebar": "menu-action", className: cn("absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
186
+ // Increases the hit area of the button on mobile.
187
+ "after:absolute after:-inset-2 md:after:hidden", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", showOnHover &&
188
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0", className), ...props }));
189
+ }
190
+ function SidebarMenuBadge({ className, ...props }) {
191
+ return (_jsx("div", { "data-slot": "sidebar-menu-badge", "data-sidebar": "menu-badge", className: cn("pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none", "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground", "peer-data-[size=sm]/menu-button:top-1", "peer-data-[size=default]/menu-button:top-1.5", "peer-data-[size=lg]/menu-button:top-2.5", "group-data-[collapsible=icon]:hidden", className), ...props }));
192
+ }
193
+ function SidebarMenuSkeleton({ className, showIcon = false, ...props }) {
194
+ // Random width between 50 to 90%.
195
+ const width = React.useMemo(() => {
196
+ return `${Math.floor(Math.random() * 40) + 50}%`;
197
+ }, []);
198
+ return (_jsxs("div", { "data-slot": "sidebar-menu-skeleton", "data-sidebar": "menu-skeleton", className: cn("flex h-8 items-center gap-2 rounded-md px-2", className), ...props, children: [showIcon && _jsx(Skeleton, { className: "size-4 rounded-md", "data-sidebar": "menu-skeleton-icon" }), _jsx(Skeleton, { className: "h-4 max-w-(--skeleton-width) flex-1", "data-sidebar": "menu-skeleton-text", style: {
199
+ "--skeleton-width": width,
200
+ } })] }));
201
+ }
202
+ function SidebarMenuSub({ className, ...props }) {
203
+ return (_jsx("ul", { "data-slot": "sidebar-menu-sub", "data-sidebar": "menu-sub", className: cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className), ...props }));
204
+ }
205
+ function SidebarMenuSubItem({ className, ...props }) {
206
+ return (_jsx("li", { "data-slot": "sidebar-menu-sub-item", "data-sidebar": "menu-sub-item", className: cn("group/menu-sub-item relative", className), ...props }));
207
+ }
208
+ function SidebarMenuSubButton({ asChild = false, size = "md", isActive = false, className, ...props }) {
209
+ const Comp = asChild ? Slot.Root : "a";
210
+ return (_jsx(Comp, { "data-slot": "sidebar-menu-sub-button", "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground 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 [&>svg]:text-sidebar-accent-foreground", "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground", size === "sm" && "text-xs", size === "md" && "text-sm", "group-data-[collapsible=icon]:hidden", className), ...props }));
211
+ }
212
+ export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, };
@@ -0,0 +1,2 @@
1
+ declare function Skeleton({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
2
+ export { Skeleton };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/utils.js";
3
+ function Skeleton({ className, ...props }) {
4
+ return (_jsx("div", { "data-slot": "skeleton", className: cn("animate-pulse rounded-md bg-accent", className), ...props }));
5
+ }
6
+ export { Skeleton };