@craftzbay/ui 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -10
- package/dist-lib/__tests__/helpers/color.d.ts +9 -0
- package/dist-lib/__tests__/helpers/theme.d.ts +18 -0
- package/dist-lib/components/ui/Accordion.js +71 -0
- package/dist-lib/components/ui/Accordion.js.map +1 -0
- package/dist-lib/components/ui/Alert.d.ts +17 -1
- package/dist-lib/components/ui/Alert.js +79 -0
- package/dist-lib/components/ui/Alert.js.map +1 -0
- package/dist-lib/components/ui/Avatar.d.ts +3 -3
- package/dist-lib/components/ui/Avatar.js +94 -0
- package/dist-lib/components/ui/Avatar.js.map +1 -0
- package/dist-lib/components/ui/Badge.d.ts +4 -2
- package/dist-lib/components/ui/Badge.js +76 -0
- package/dist-lib/components/ui/Badge.js.map +1 -0
- package/dist-lib/components/ui/Breadcrumbs.d.ts +2 -0
- package/dist-lib/components/ui/Breadcrumbs.js +52 -0
- package/dist-lib/components/ui/Breadcrumbs.js.map +1 -0
- package/dist-lib/components/ui/Button.d.ts +6 -4
- package/dist-lib/components/ui/Button.js +131 -0
- package/dist-lib/components/ui/Button.js.map +1 -0
- package/dist-lib/components/ui/Calendar.d.ts +7 -1
- package/dist-lib/components/ui/Calendar.js +139 -0
- package/dist-lib/components/ui/Calendar.js.map +1 -0
- package/dist-lib/components/ui/Card.d.ts +3 -1
- package/dist-lib/components/ui/Card.js +97 -0
- package/dist-lib/components/ui/Card.js.map +1 -0
- package/dist-lib/components/ui/Carousel.d.ts +11 -7
- package/dist-lib/components/ui/Carousel.js +174 -0
- package/dist-lib/components/ui/Carousel.js.map +1 -0
- package/dist-lib/components/ui/Chart.d.ts +68 -7
- package/dist-lib/components/ui/Chart.js +487 -0
- package/dist-lib/components/ui/Chart.js.map +1 -0
- package/dist-lib/components/ui/Checkbox.js +70 -0
- package/dist-lib/components/ui/Checkbox.js.map +1 -0
- package/dist-lib/components/ui/Combobox.d.ts +9 -0
- package/dist-lib/components/ui/Combobox.js +195 -0
- package/dist-lib/components/ui/Combobox.js.map +1 -0
- package/dist-lib/components/ui/CommandPalette.d.ts +9 -6
- package/dist-lib/components/ui/CommandPalette.js +179 -0
- package/dist-lib/components/ui/CommandPalette.js.map +1 -0
- package/dist-lib/components/ui/ContextMenu.d.ts +7 -2
- package/dist-lib/components/ui/ContextMenu.js +165 -0
- package/dist-lib/components/ui/ContextMenu.js.map +1 -0
- package/dist-lib/components/ui/DataGrid.d.ts +17 -4
- package/dist-lib/components/ui/DataGrid.js +99 -0
- package/dist-lib/components/ui/DataGrid.js.map +1 -0
- package/dist-lib/components/ui/DatePicker.d.ts +16 -13
- package/dist-lib/components/ui/DatePicker.js +193 -0
- package/dist-lib/components/ui/DatePicker.js.map +1 -0
- package/dist-lib/components/ui/DesignSystemProvider.d.ts +102 -41
- package/dist-lib/components/ui/DesignSystemProvider.js +135 -0
- package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -0
- package/dist-lib/components/ui/Dialog.d.ts +19 -4
- package/dist-lib/components/ui/Dialog.js +165 -0
- package/dist-lib/components/ui/Dialog.js.map +1 -0
- package/dist-lib/components/ui/Drawer.d.ts +23 -2
- package/dist-lib/components/ui/Drawer.js +132 -0
- package/dist-lib/components/ui/Drawer.js.map +1 -0
- package/dist-lib/components/ui/DropdownMenu.js +169 -0
- package/dist-lib/components/ui/DropdownMenu.js.map +1 -0
- package/dist-lib/components/ui/EmptyState.d.ts +2 -0
- package/dist-lib/components/ui/EmptyState.js +46 -0
- package/dist-lib/components/ui/EmptyState.js.map +1 -0
- package/dist-lib/components/ui/ErrorState.d.ts +13 -2
- package/dist-lib/components/ui/ErrorState.js +69 -0
- package/dist-lib/components/ui/ErrorState.js.map +1 -0
- package/dist-lib/components/ui/FileUpload.d.ts +3 -0
- package/dist-lib/components/ui/FileUpload.js +111 -0
- package/dist-lib/components/ui/FileUpload.js.map +1 -0
- package/dist-lib/components/ui/Form.d.ts +16 -2
- package/dist-lib/components/ui/Form.js +131 -0
- package/dist-lib/components/ui/Form.js.map +1 -0
- package/dist-lib/components/ui/Icon.d.ts +1 -1
- package/dist-lib/components/ui/Icon.js +32 -0
- package/dist-lib/components/ui/Icon.js.map +1 -0
- package/dist-lib/components/ui/IconButton.d.ts +3 -3
- package/dist-lib/components/ui/IconButton.js +64 -0
- package/dist-lib/components/ui/IconButton.js.map +1 -0
- package/dist-lib/components/ui/Input.d.ts +9 -4
- package/dist-lib/components/ui/Input.js +149 -0
- package/dist-lib/components/ui/Input.js.map +1 -0
- package/dist-lib/components/ui/Kbd.js +24 -0
- package/dist-lib/components/ui/Kbd.js.map +1 -0
- package/dist-lib/components/ui/MultiSelect.d.ts +3 -1
- package/dist-lib/components/ui/MultiSelect.js +210 -0
- package/dist-lib/components/ui/MultiSelect.js.map +1 -0
- package/dist-lib/components/ui/Pagination.d.ts +23 -0
- package/dist-lib/components/ui/Pagination.js +153 -0
- package/dist-lib/components/ui/Pagination.js.map +1 -0
- package/dist-lib/components/ui/Popover.js +35 -0
- package/dist-lib/components/ui/Popover.js.map +1 -0
- package/dist-lib/components/ui/Progress.d.ts +3 -3
- package/dist-lib/components/ui/Progress.js +100 -0
- package/dist-lib/components/ui/Progress.js.map +1 -0
- package/dist-lib/components/ui/RadioGroup.d.ts +1 -1
- package/dist-lib/components/ui/RadioGroup.js +81 -0
- package/dist-lib/components/ui/RadioGroup.js.map +1 -0
- package/dist-lib/components/ui/RelativeTime.d.ts +19 -0
- package/dist-lib/components/ui/RelativeTime.js +31 -0
- package/dist-lib/components/ui/RelativeTime.js.map +1 -0
- package/dist-lib/components/ui/ScrollArea.d.ts +9 -1
- package/dist-lib/components/ui/ScrollArea.js +60 -0
- package/dist-lib/components/ui/ScrollArea.js.map +1 -0
- package/dist-lib/components/ui/Select.d.ts +6 -1
- package/dist-lib/components/ui/Select.js +139 -0
- package/dist-lib/components/ui/Select.js.map +1 -0
- package/dist-lib/components/ui/Separator.js +26 -0
- package/dist-lib/components/ui/Separator.js.map +1 -0
- package/dist-lib/components/ui/Sheet.d.ts +10 -1
- package/dist-lib/components/ui/Sheet.js +136 -0
- package/dist-lib/components/ui/Sheet.js.map +1 -0
- package/dist-lib/components/ui/Sidebar.d.ts +29 -14
- package/dist-lib/components/ui/Sidebar.js +212 -0
- package/dist-lib/components/ui/Sidebar.js.map +1 -0
- package/dist-lib/components/ui/Skeleton.d.ts +13 -2
- package/dist-lib/components/ui/Skeleton.js +29 -0
- package/dist-lib/components/ui/Skeleton.js.map +1 -0
- package/dist-lib/components/ui/Slider.js +64 -0
- package/dist-lib/components/ui/Slider.js.map +1 -0
- package/dist-lib/components/ui/Snackbar.d.ts +1 -1
- package/dist-lib/components/ui/Snackbar.js +57 -0
- package/dist-lib/components/ui/Snackbar.js.map +1 -0
- package/dist-lib/components/ui/Spinner.js +54 -0
- package/dist-lib/components/ui/Spinner.js.map +1 -0
- package/dist-lib/components/ui/Stepper.d.ts +6 -0
- package/dist-lib/components/ui/Stepper.js +111 -0
- package/dist-lib/components/ui/Stepper.js.map +1 -0
- package/dist-lib/components/ui/Switch.js +80 -0
- package/dist-lib/components/ui/Switch.js.map +1 -0
- package/dist-lib/components/ui/Table.d.ts +41 -5
- package/dist-lib/components/ui/Table.js +179 -0
- package/dist-lib/components/ui/Table.js.map +1 -0
- package/dist-lib/components/ui/Tabs.d.ts +1 -1
- package/dist-lib/components/ui/Tabs.js +91 -0
- package/dist-lib/components/ui/Tabs.js.map +1 -0
- package/dist-lib/components/ui/TagInput.d.ts +17 -2
- package/dist-lib/components/ui/TagInput.js +111 -0
- package/dist-lib/components/ui/TagInput.js.map +1 -0
- package/dist-lib/components/ui/Textarea.js +88 -0
- package/dist-lib/components/ui/Textarea.js.map +1 -0
- package/dist-lib/components/ui/Timeline.d.ts +16 -6
- package/dist-lib/components/ui/Timeline.js +56 -0
- package/dist-lib/components/ui/Timeline.js.map +1 -0
- package/dist-lib/components/ui/Toast.d.ts +1 -1
- package/dist-lib/components/ui/Toast.js +158 -0
- package/dist-lib/components/ui/Toast.js.map +1 -0
- package/dist-lib/components/ui/Tooltip.d.ts +4 -1
- package/dist-lib/components/ui/Tooltip.js +60 -0
- package/dist-lib/components/ui/Tooltip.js.map +1 -0
- package/dist-lib/components/ui/TopNav.d.ts +7 -3
- package/dist-lib/components/ui/TopNav.js +62 -0
- package/dist-lib/components/ui/TopNav.js.map +1 -0
- package/dist-lib/components/ui/Tree.d.ts +34 -7
- package/dist-lib/components/ui/Tree.js +170 -0
- package/dist-lib/components/ui/Tree.js.map +1 -0
- package/dist-lib/hooks/use-debounce.d.ts +19 -0
- package/dist-lib/hooks/use-debounce.js +36 -0
- package/dist-lib/hooks/use-debounce.js.map +1 -0
- package/dist-lib/hooks/use-delayed-loading.d.ts +21 -0
- package/dist-lib/hooks/use-delayed-loading.js +20 -0
- package/dist-lib/hooks/use-delayed-loading.js.map +1 -0
- package/dist-lib/hooks/use-field-ids.d.ts +30 -0
- package/dist-lib/hooks/use-field-ids.js +18 -0
- package/dist-lib/hooks/use-field-ids.js.map +1 -0
- package/dist-lib/hooks/use-media-query.d.ts +3 -1
- package/dist-lib/hooks/use-media-query.js +22 -0
- package/dist-lib/hooks/use-media-query.js.map +1 -0
- package/dist-lib/hooks/use-modifier-key.d.ts +13 -0
- package/dist-lib/hooks/use-modifier-key.js +19 -0
- package/dist-lib/hooks/use-modifier-key.js.map +1 -0
- package/dist-lib/hooks/use-strings.d.ts +5 -0
- package/dist-lib/hooks/use-strings.js +12 -0
- package/dist-lib/hooks/use-strings.js.map +1 -0
- package/dist-lib/hooks/use-toast.d.ts +7 -2
- package/dist-lib/hooks/use-toast.js +67 -0
- package/dist-lib/hooks/use-toast.js.map +1 -0
- package/dist-lib/icon.d.ts +8 -0
- package/dist-lib/icon.js +7 -0
- package/dist-lib/icon.js.map +1 -0
- package/dist-lib/icons/index.d.ts +80 -88
- package/dist-lib/icons/index.js +163 -0
- package/dist-lib/icons/index.js.map +1 -0
- package/dist-lib/illustrations/index.d.ts +1 -0
- package/dist-lib/illustrations/index.js +114 -0
- package/dist-lib/illustrations/index.js.map +1 -0
- package/dist-lib/index.d.ts +68 -59
- package/dist-lib/index.js +288 -4530
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/lib/format.d.ts +65 -0
- package/dist-lib/lib/format.js +95 -0
- package/dist-lib/lib/format.js.map +1 -0
- package/dist-lib/lib/return-focus.d.ts +11 -0
- package/dist-lib/lib/return-focus.js +12 -0
- package/dist-lib/lib/return-focus.js.map +1 -0
- package/dist-lib/lib/strings.d.ts +190 -0
- package/dist-lib/lib/strings.js +141 -0
- package/dist-lib/lib/strings.js.map +1 -0
- package/dist-lib/lib/strings.mn.d.ts +3 -0
- package/dist-lib/lib/strings.mn.js +115 -0
- package/dist-lib/lib/strings.mn.js.map +1 -0
- package/dist-lib/lib/utils.d.ts +0 -1
- package/dist-lib/lib/utils.js +10 -0
- package/dist-lib/lib/utils.js.map +1 -0
- package/dist-lib/styles.css +1 -1
- package/dist-lib/theme.css +840 -0
- package/package.json +38 -8
- package/dist-lib/index.cjs +0 -8
- package/dist-lib/index.cjs.map +0 -1
|
@@ -3,7 +3,12 @@ import * as SelectPrimitive from '@radix-ui/react-select';
|
|
|
3
3
|
export declare const Select: import('react').FC<SelectPrimitive.SelectProps>;
|
|
4
4
|
export declare const SelectValue: import('react').ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
5
5
|
export interface SelectTriggerProps extends Omit<ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>, 'children'> {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Placeholder shown when no value is selected. Also used as the trigger's
|
|
8
|
+
* accessible name when no `aria-label` / `aria-labelledby` / `id` (external
|
|
9
|
+
* `<Label htmlFor>`) is supplied — `role="combobox"` takes no name from
|
|
10
|
+
* its content.
|
|
11
|
+
*/
|
|
7
12
|
placeholder?: string;
|
|
8
13
|
/** Trigger height — matches Input sizes. */
|
|
9
14
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as l } from "react";
|
|
4
|
+
import * as a from "@radix-ui/react-select";
|
|
5
|
+
import { Check as S, ChevronDown as x, ChevronUp as v, ChevronsUpDown as N } from "../../icons/index.js";
|
|
6
|
+
import { cn as c } from "../../lib/utils.js";
|
|
7
|
+
import { useStrings as y } from "../../hooks/use-strings.js";
|
|
8
|
+
const G = a.Root, L = a.Value, w = l(function({ className: r, placeholder: o, size: e = "md", tone: i = "default", ...n }, g) {
|
|
9
|
+
const b = y(), h = !!(n["aria-label"] || n["aria-labelledby"] || n.id);
|
|
10
|
+
return /* @__PURE__ */ d(
|
|
11
|
+
a.Trigger,
|
|
12
|
+
{
|
|
13
|
+
ref: g,
|
|
14
|
+
"aria-label": h ? void 0 : o ?? b.select.placeholder,
|
|
15
|
+
className: c(
|
|
16
|
+
"bg-card text-foreground inline-flex w-full items-center justify-between gap-2 rounded-md border text-lg md:text-sm",
|
|
17
|
+
"[&>span]:min-w-0 [&>span]:truncate",
|
|
18
|
+
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]",
|
|
19
|
+
"outline-none",
|
|
20
|
+
"focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
21
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
22
|
+
"data-[placeholder]:text-foreground-subtle",
|
|
23
|
+
e === "sm" && "h-8 px-2.5",
|
|
24
|
+
e === "md" && "h-9 px-3",
|
|
25
|
+
e === "lg" && "h-10 px-3.5",
|
|
26
|
+
i === "default" ? "border-border-input focus-visible:border-accent focus-visible:ring-ring" : "border-danger focus-visible:border-danger focus-visible:ring-danger",
|
|
27
|
+
r
|
|
28
|
+
),
|
|
29
|
+
...n,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ t(a.Value, { placeholder: o }),
|
|
32
|
+
/* @__PURE__ */ t(a.Icon, { asChild: !0, children: /* @__PURE__ */ t(N, { className: "text-foreground-subtle size-4 shrink-0", "aria-hidden": !0 }) })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
w.displayName = "SelectTrigger";
|
|
38
|
+
const u = "flex h-6 cursor-default items-center justify-center text-foreground-subtle", m = l(function({ className: r, ...o }, e) {
|
|
39
|
+
return /* @__PURE__ */ t(a.ScrollUpButton, { ref: e, className: c(u, r), ...o, children: /* @__PURE__ */ t(v, { className: "size-4", "aria-hidden": !0 }) });
|
|
40
|
+
});
|
|
41
|
+
m.displayName = "SelectScrollUpButton";
|
|
42
|
+
const p = l(function({ className: r, ...o }, e) {
|
|
43
|
+
return /* @__PURE__ */ t(a.ScrollDownButton, { ref: e, className: c(u, r), ...o, children: /* @__PURE__ */ t(x, { className: "size-4", "aria-hidden": !0 }) });
|
|
44
|
+
});
|
|
45
|
+
p.displayName = "SelectScrollDownButton";
|
|
46
|
+
const B = l(function({ className: r, children: o, position: e = "popper", ...i }, n) {
|
|
47
|
+
return /* @__PURE__ */ t(a.Portal, { children: /* @__PURE__ */ d(
|
|
48
|
+
a.Content,
|
|
49
|
+
{
|
|
50
|
+
ref: n,
|
|
51
|
+
position: e,
|
|
52
|
+
className: c(
|
|
53
|
+
"z-[var(--z-popover)] max-h-96 min-w-[var(--radix-select-trigger-width)]",
|
|
54
|
+
"border-border bg-popover text-popover-foreground overflow-hidden rounded-lg border",
|
|
55
|
+
"shadow-md",
|
|
56
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
57
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
58
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
59
|
+
e === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
|
|
60
|
+
r
|
|
61
|
+
),
|
|
62
|
+
...i,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ t(m, {}),
|
|
65
|
+
/* @__PURE__ */ t(a.Viewport, { className: "p-1", children: o }),
|
|
66
|
+
/* @__PURE__ */ t(p, {})
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
) });
|
|
70
|
+
});
|
|
71
|
+
B.displayName = "SelectContent";
|
|
72
|
+
const f = l(function({ className: r, ...o }, e) {
|
|
73
|
+
return /* @__PURE__ */ t(
|
|
74
|
+
a.Label,
|
|
75
|
+
{
|
|
76
|
+
ref: e,
|
|
77
|
+
className: c("text-foreground-subtle px-2 py-1.5 text-xs font-medium", r),
|
|
78
|
+
...o
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
f.displayName = "SelectLabel";
|
|
83
|
+
const C = l(
|
|
84
|
+
function({ className: r, children: o, leadingIcon: e, ...i }, n) {
|
|
85
|
+
return /* @__PURE__ */ d(
|
|
86
|
+
a.Item,
|
|
87
|
+
{
|
|
88
|
+
ref: n,
|
|
89
|
+
className: c(
|
|
90
|
+
"relative flex w-full cursor-default items-center gap-2 select-none",
|
|
91
|
+
"text-foreground rounded-sm px-2 py-1.5 pr-8 text-sm outline-none",
|
|
92
|
+
"data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground",
|
|
93
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
94
|
+
r
|
|
95
|
+
),
|
|
96
|
+
...i,
|
|
97
|
+
children: [
|
|
98
|
+
e && /* @__PURE__ */ t("span", { className: "text-foreground-subtle flex items-center [&_svg]:size-4", children: e }),
|
|
99
|
+
/* @__PURE__ */ t(a.ItemText, { children: o }),
|
|
100
|
+
/* @__PURE__ */ t("span", { className: "absolute right-2 flex items-center justify-center", children: /* @__PURE__ */ t(a.ItemIndicator, { children: /* @__PURE__ */ t(S, { className: "text-accent size-4", "aria-hidden": !0 }) }) })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
C.displayName = "SelectItem";
|
|
107
|
+
const z = l(function({ className: r, ...o }, e) {
|
|
108
|
+
return /* @__PURE__ */ t(
|
|
109
|
+
a.Separator,
|
|
110
|
+
{
|
|
111
|
+
ref: e,
|
|
112
|
+
className: c("bg-border -mx-1 my-1 h-px", r),
|
|
113
|
+
...o
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
z.displayName = "SelectSeparator";
|
|
118
|
+
const I = l(
|
|
119
|
+
function({ label: r, children: o, ...e }, i) {
|
|
120
|
+
return /* @__PURE__ */ d(a.Group, { ref: i, ...e, children: [
|
|
121
|
+
r && /* @__PURE__ */ t(f, { children: r }),
|
|
122
|
+
o
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
I.displayName = "SelectGroup";
|
|
127
|
+
export {
|
|
128
|
+
G as Select,
|
|
129
|
+
B as SelectContent,
|
|
130
|
+
I as SelectGroup,
|
|
131
|
+
C as SelectItem,
|
|
132
|
+
f as SelectLabel,
|
|
133
|
+
p as SelectScrollDownButton,
|
|
134
|
+
m as SelectScrollUpButton,
|
|
135
|
+
z as SelectSeparator,
|
|
136
|
+
w as SelectTrigger,
|
|
137
|
+
L as SelectValue
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../src/components/ui/Select.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { Check, ChevronDown, ChevronUp, ChevronsUpDown } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\n\n/* -----------------------------------------------------------------------------\n * Compound API:\n *\n * <Select value={…} onValueChange={…}>\n * <SelectTrigger placeholder=\"Pick one\" />\n * <SelectContent>\n * <SelectGroup label=\"Active\">\n * <SelectItem value=\"a\">Apple</SelectItem>\n * <SelectItem value=\"b\">Banana</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </Select>\n *\n * All accessibility is handled by Radix: keyboard navigation, type-ahead,\n * focus trap, ARIA roles. We only style.\n * --------------------------------------------------------------------------- */\n\nexport const Select = SelectPrimitive.Root;\nexport const SelectValue = SelectPrimitive.Value;\n\nexport interface SelectTriggerProps extends Omit<\n ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>,\n 'children'\n> {\n /**\n * Placeholder shown when no value is selected. Also used as the trigger's\n * accessible name when no `aria-label` / `aria-labelledby` / `id` (external\n * `<Label htmlFor>`) is supplied — `role=\"combobox\"` takes no name from\n * its content.\n */\n placeholder?: string;\n /** Trigger height — matches Input sizes. */\n size?: 'sm' | 'md' | 'lg';\n /** Visual tone — `error` swaps the border + ring to danger. */\n tone?: 'default' | 'error';\n}\n\nexport const SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(function SelectTrigger({ className, placeholder, size = 'md', tone = 'default', ...props }, ref) {\n const strings = useStrings();\n const hasName = Boolean(props['aria-label'] || props['aria-labelledby'] || props.id);\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n aria-label={hasName ? undefined : (placeholder ?? strings.select.placeholder)}\n className={cn(\n 'bg-card text-foreground inline-flex w-full items-center justify-between gap-2 rounded-md border text-lg md:text-sm',\n '[&>span]:min-w-0 [&>span]:truncate',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'outline-none',\n 'focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'data-[placeholder]:text-foreground-subtle',\n size === 'sm' && 'h-8 px-2.5',\n size === 'md' && 'h-9 px-3',\n size === 'lg' && 'h-10 px-3.5',\n tone === 'default'\n ? 'border-border-input focus-visible:border-accent focus-visible:ring-ring'\n : 'border-danger focus-visible:border-danger focus-visible:ring-danger',\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Value placeholder={placeholder} />\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDown className=\"text-foreground-subtle size-4 shrink-0\" aria-hidden />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n});\nSelectTrigger.displayName = 'SelectTrigger';\n\nconst scrollBtn = 'flex h-6 cursor-default items-center justify-center text-foreground-subtle';\n\nexport const SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(function SelectScrollUpButton({ className, ...props }, ref) {\n return (\n <SelectPrimitive.ScrollUpButton ref={ref} className={cn(scrollBtn, className)} {...props}>\n <ChevronUp className=\"size-4\" aria-hidden />\n </SelectPrimitive.ScrollUpButton>\n );\n});\nSelectScrollUpButton.displayName = 'SelectScrollUpButton';\n\nexport const SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(function SelectScrollDownButton({ className, ...props }, ref) {\n return (\n <SelectPrimitive.ScrollDownButton ref={ref} className={cn(scrollBtn, className)} {...props}>\n <ChevronDown className=\"size-4\" aria-hidden />\n </SelectPrimitive.ScrollDownButton>\n );\n});\nSelectScrollDownButton.displayName = 'SelectScrollDownButton';\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(function SelectContent({ className, children, position = 'popper', ...props }, ref) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n className={cn(\n 'z-[var(--z-popover)] max-h-96 min-w-[var(--radix-select-trigger-width)]',\n 'border-border bg-popover text-popover-foreground overflow-hidden rounded-lg border',\n 'shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport className=\"p-1\">{children}</SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = 'SelectContent';\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(function SelectLabel({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('text-foreground-subtle px-2 py-1.5 text-xs font-medium', className)}\n {...props}\n />\n );\n});\nSelectLabel.displayName = 'SelectLabel';\n\nexport interface SelectItemProps extends ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Icon shown to the left of the label. */\n leadingIcon?: ReactNode;\n}\n\nexport const SelectItem = forwardRef<ElementRef<typeof SelectPrimitive.Item>, SelectItemProps>(\n function SelectItem({ className, children, leadingIcon, ...props }, ref) {\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex w-full cursor-default items-center gap-2 select-none',\n 'text-foreground rounded-sm px-2 py-1.5 pr-8 text-sm outline-none',\n 'data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n {leadingIcon && (\n <span className=\"text-foreground-subtle flex items-center [&_svg]:size-4\">\n {leadingIcon}\n </span>\n )}\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <span className=\"absolute right-2 flex items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"text-accent size-4\" aria-hidden />\n </SelectPrimitive.ItemIndicator>\n </span>\n </SelectPrimitive.Item>\n );\n },\n);\nSelectItem.displayName = 'SelectItem';\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(function SelectSeparator({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('bg-border -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n});\nSelectSeparator.displayName = 'SelectSeparator';\n\n/** Optional grouping with a label header. Pure composition over Radix Group + Label. */\nexport interface SelectGroupProps extends ComponentPropsWithoutRef<typeof SelectPrimitive.Group> {\n label?: ReactNode;\n}\nexport const SelectGroup = forwardRef<ElementRef<typeof SelectPrimitive.Group>, SelectGroupProps>(\n function SelectGroup({ label, children, ...props }, ref) {\n return (\n <SelectPrimitive.Group ref={ref} {...props}>\n {label && <SelectLabel>{label}</SelectLabel>}\n {children}\n </SelectPrimitive.Group>\n );\n },\n);\nSelectGroup.displayName = 'SelectGroup';\n\n/**\n * Compose `Select` + `SelectTrigger` + `SelectContent` + `SelectItem` for a\n * single-choice picker. Keyboard, type-ahead, and ARIA come from Radix.\n *\n * @example Basic\n * <Select onValueChange={setStatus}>\n * <SelectTrigger placeholder=\"Status\" />\n * <SelectContent>\n * <SelectItem value=\"open\">Open</SelectItem>\n * <SelectItem value=\"closed\">Closed</SelectItem>\n * </SelectContent>\n * </Select>\n *\n * @example Grouped\n * <SelectContent>\n * <SelectGroup label=\"People\">\n * <SelectItem value=\"anu\">Anu</SelectItem>\n * <SelectItem value=\"bat\">Bat</SelectItem>\n * </SelectGroup>\n * <SelectSeparator />\n * <SelectGroup label=\"Bots\">\n * <SelectItem value=\"robo\">Robo</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n *\n * @do Use `placeholder` on the trigger when there is no default value.\n * @dont Use Select for more than ~12 options — switch to `Combobox`.\n */\n"],"names":["Select","SelectPrimitive","SelectValue","SelectTrigger","forwardRef","className","placeholder","size","tone","props","ref","strings","useStrings","hasName","jsxs","cn","jsx","ChevronsUpDown","scrollBtn","SelectScrollUpButton","ChevronUp","SelectScrollDownButton","ChevronDown","SelectContent","children","position","SelectLabel","SelectItem","leadingIcon","Check","SelectSeparator","SelectGroup","label"],"mappings":";;;;;;;AAyBO,MAAMA,IAASC,EAAgB,MACzBC,IAAcD,EAAgB,OAmB9BE,IAAgBC,EAG3B,SAAuB,EAAE,WAAAC,GAAW,aAAAC,GAAa,MAAAC,IAAO,MAAM,MAAAC,IAAO,WAAW,GAAGC,EAAA,GAASC,GAAK;AACjG,QAAMC,IAAUC,EAAA,GACVC,IAAU,GAAQJ,EAAM,YAAY,KAAKA,EAAM,iBAAiB,KAAKA,EAAM;AACjF,SACE,gBAAAK;AAAA,IAACb,EAAgB;AAAA,IAAhB;AAAA,MACC,KAAAS;AAAA,MACA,cAAYG,IAAU,SAAaP,KAAeK,EAAQ,OAAO;AAAA,MACjE,WAAWI;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACAR,MAAS,QAAQ;AAAA,QACjBA,MAAS,QAAQ;AAAA,QACjBA,MAAS,QAAQ;AAAA,QACjBC,MAAS,YACL,4EACA;AAAA,QACJH;AAAA,MAAA;AAAA,MAED,GAAGI;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAO,EAACf,EAAgB,OAAhB,EAAsB,aAAAK,EAAA,CAA0B;AAAA,QACjD,gBAAAU,EAACf,EAAgB,MAAhB,EAAqB,SAAO,IAC3B,UAAA,gBAAAe,EAACC,GAAA,EAAe,WAAU,0CAAyC,eAAW,GAAA,CAAC,EAAA,CACjF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AACDd,EAAc,cAAc;AAE5B,MAAMe,IAAY,8EAELC,IAAuBf,EAGlC,SAA8B,EAAE,WAAAC,GAAW,GAAGI,EAAA,GAASC,GAAK;AAC5D,2BACGT,EAAgB,gBAAhB,EAA+B,KAAAS,G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,EAAA,CAAM;AAAA,MAC7BR;AAAA,IAAA,GACH;AAAA,EAEJ;AACF;AACAO,EAAY,cAAc;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as i } from "react";
|
|
4
|
+
import * as m from "@radix-ui/react-separator";
|
|
5
|
+
import { cn as f } from "../../lib/utils.js";
|
|
6
|
+
const l = i(function({ className: o, orientation: r = "horizontal", decorative: t = !0, ...a }, e) {
|
|
7
|
+
return /* @__PURE__ */ p(
|
|
8
|
+
m.Root,
|
|
9
|
+
{
|
|
10
|
+
ref: e,
|
|
11
|
+
orientation: r,
|
|
12
|
+
decorative: t,
|
|
13
|
+
className: f(
|
|
14
|
+
"bg-border shrink-0",
|
|
15
|
+
r === "horizontal" ? "h-px w-full" : "h-full w-px",
|
|
16
|
+
o
|
|
17
|
+
),
|
|
18
|
+
...a
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
l.displayName = "Separator";
|
|
23
|
+
export {
|
|
24
|
+
l as Separator
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Separator.js","sources":["../../../src/components/ui/Separator.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from 'react';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport { cn } from '@/lib/utils';\n\n/**\n * Hairline divider. Decorative by default (no role announced). Pass\n * `decorative={false}` when the separator carries semantic meaning, e.g.\n * splitting two regions in a landmark.\n *\n * @example Section divider\n * <Separator className=\"my-6\" />\n *\n * @example Vertical inside a toolbar\n * <Separator orientation=\"vertical\" className=\"h-5 mx-2\" />\n */\nexport const Separator = forwardRef<\n ElementRef<typeof SeparatorPrimitive.Root>,\n ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(function Separator({ className, orientation = 'horizontal', decorative = true, ...props }, ref) {\n return (\n <SeparatorPrimitive.Root\n ref={ref}\n orientation={orientation}\n decorative={decorative}\n className={cn(\n 'bg-border shrink-0',\n orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',\n className,\n )}\n {...props}\n />\n );\n});\nSeparator.displayName = 'Separator';\n"],"names":["Separator","forwardRef","className","orientation","decorative","props","ref","jsx","SeparatorPrimitive","cn"],"mappings":";;;;;AAiBO,MAAMA,IAAYC,EAGvB,SAAmB,EAAE,WAAAC,GAAW,aAAAC,IAAc,cAAc,YAAAC,IAAa,IAAM,GAAGC,EAAA,GAASC,GAAK;AAChG,SACE,gBAAAC;AAAA,IAACC,EAAmB;AAAA,IAAnB;AAAA,MACC,KAAAF;AAAA,MACA,aAAAH;AAAA,MACA,YAAAC;AAAA,MACA,WAAWK;AAAA,QACT;AAAA,QACAN,MAAgB,eAAe,gBAAgB;AAAA,QAC/CD;AAAA,MAAA;AAAA,MAED,GAAGG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDL,EAAU,cAAc;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, HTMLAttributes } from 'react';
|
|
2
|
-
import { VariantProps } from '../../lib/cva';
|
|
2
|
+
import { VariantProps } from '../../lib/cva.js';
|
|
3
|
+
import { ReturnFocusRef } from '../../lib/return-focus.js';
|
|
3
4
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
5
|
export declare const Sheet: import('react').FC<DialogPrimitive.DialogProps>;
|
|
5
6
|
export declare const SheetTrigger: import('react').ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -10,6 +11,14 @@ declare const sheet: (props?: ({
|
|
|
10
11
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
11
12
|
export interface SheetContentProps extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheet> {
|
|
12
13
|
showClose?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Element to focus when the overlay closes. Overrides Radix's default
|
|
16
|
+
* (the element focused when the content mounted), which is `<body>` for
|
|
17
|
+
* controlled overlays opened from a pointer click on a non-focusable /
|
|
18
|
+
* tooltip-wrapped trigger. A consumer `onCloseAutoFocus` runs first and
|
|
19
|
+
* wins if it calls `preventDefault()`.
|
|
20
|
+
*/
|
|
21
|
+
returnFocusTo?: ReturnFocusRef;
|
|
13
22
|
}
|
|
14
23
|
export declare const SheetContent: import('react').ForwardRefExoticComponent<SheetContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
15
24
|
export declare function SheetHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import * as t from "@radix-ui/react-dialog";
|
|
5
|
+
import { X as g } from "../../icons/index.js";
|
|
6
|
+
import { cn as i } from "../../lib/utils.js";
|
|
7
|
+
import { useStrings as b } from "../../hooks/use-strings.js";
|
|
8
|
+
import { withReturnFocus as x } from "../../lib/return-focus.js";
|
|
9
|
+
import { cva as v } from "class-variance-authority";
|
|
10
|
+
const k = t.Root, A = t.Trigger, V = t.Close, S = t.Portal, l = n(function({ className: e, ...r }, s) {
|
|
11
|
+
return /* @__PURE__ */ o(
|
|
12
|
+
t.Overlay,
|
|
13
|
+
{
|
|
14
|
+
ref: s,
|
|
15
|
+
className: i(
|
|
16
|
+
"bg-overlay fixed inset-0 z-[var(--z-overlay)]",
|
|
17
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
18
|
+
"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0",
|
|
19
|
+
e
|
|
20
|
+
),
|
|
21
|
+
...r
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
l.displayName = "SheetOverlay";
|
|
26
|
+
const y = v(
|
|
27
|
+
[
|
|
28
|
+
"fixed z-[var(--z-modal)] bg-card text-card-foreground shadow-lg",
|
|
29
|
+
"flex flex-col gap-4 p-6",
|
|
30
|
+
// Safe-area insets for notched devices (consumers set viewport-fit=cover).
|
|
31
|
+
"pb-[max(1.5rem,env(safe-area-inset-bottom))] pl-[max(1.5rem,env(safe-area-inset-left))] pr-[max(1.5rem,env(safe-area-inset-right))]",
|
|
32
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
33
|
+
"data-[state=closed]:duration-[var(--duration-base)] data-[state=open]:duration-[var(--duration-slow)]"
|
|
34
|
+
],
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
side: {
|
|
38
|
+
top: "inset-x-0 top-0 border-b border-border data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top",
|
|
39
|
+
bottom: "inset-x-0 bottom-0 border-t border-border data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom",
|
|
40
|
+
left: "inset-y-0 left-0 h-full w-3/4 max-w-md border-r border-border data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left",
|
|
41
|
+
right: "inset-y-0 right-0 h-full w-3/4 max-w-md border-l border-border data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: { side: "right" }
|
|
45
|
+
}
|
|
46
|
+
), N = n(function({
|
|
47
|
+
className: e,
|
|
48
|
+
children: r,
|
|
49
|
+
side: s = "right",
|
|
50
|
+
showClose: m = !0,
|
|
51
|
+
returnFocusTo: f,
|
|
52
|
+
onCloseAutoFocus: c,
|
|
53
|
+
...u
|
|
54
|
+
}, h) {
|
|
55
|
+
const p = b();
|
|
56
|
+
return /* @__PURE__ */ d(S, { children: [
|
|
57
|
+
/* @__PURE__ */ o(l, {}),
|
|
58
|
+
/* @__PURE__ */ d(
|
|
59
|
+
t.Content,
|
|
60
|
+
{
|
|
61
|
+
ref: h,
|
|
62
|
+
className: i(y({ side: s }), e),
|
|
63
|
+
onCloseAutoFocus: x(f, c),
|
|
64
|
+
...u,
|
|
65
|
+
children: [
|
|
66
|
+
r,
|
|
67
|
+
m && /* @__PURE__ */ o(
|
|
68
|
+
t.Close,
|
|
69
|
+
{
|
|
70
|
+
"aria-label": p.sheet.close,
|
|
71
|
+
className: i(
|
|
72
|
+
"text-foreground-subtle absolute top-4 right-4 inline-flex size-8 items-center justify-center rounded-md",
|
|
73
|
+
"hover:bg-background-muted hover:text-foreground",
|
|
74
|
+
"focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
75
|
+
"transition-colors duration-[var(--duration-fast)]"
|
|
76
|
+
),
|
|
77
|
+
children: /* @__PURE__ */ o(g, { className: "size-4", "aria-hidden": !0 })
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
] });
|
|
84
|
+
});
|
|
85
|
+
N.displayName = "SheetContent";
|
|
86
|
+
function w({ className: a, ...e }) {
|
|
87
|
+
return /* @__PURE__ */ o("div", { className: i("flex flex-col gap-1", a), ...e });
|
|
88
|
+
}
|
|
89
|
+
w.displayName = "SheetHeader";
|
|
90
|
+
function C({ className: a, ...e }) {
|
|
91
|
+
return /* @__PURE__ */ o(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
className: i(
|
|
95
|
+
"mt-auto flex flex-col-reverse gap-2 pt-4 sm:flex-row sm:justify-end",
|
|
96
|
+
a
|
|
97
|
+
),
|
|
98
|
+
...e
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
C.displayName = "SheetFooter";
|
|
103
|
+
const z = n(function({ className: e, ...r }, s) {
|
|
104
|
+
return /* @__PURE__ */ o(
|
|
105
|
+
t.Title,
|
|
106
|
+
{
|
|
107
|
+
ref: s,
|
|
108
|
+
className: i("text-foreground text-lg leading-tight font-semibold", e),
|
|
109
|
+
...r
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
z.displayName = "SheetTitle";
|
|
114
|
+
const T = n(function({ className: e, ...r }, s) {
|
|
115
|
+
return /* @__PURE__ */ o(
|
|
116
|
+
t.Description,
|
|
117
|
+
{
|
|
118
|
+
ref: s,
|
|
119
|
+
className: i("text-foreground-muted text-sm", e),
|
|
120
|
+
...r
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
T.displayName = "SheetDescription";
|
|
125
|
+
export {
|
|
126
|
+
k as Sheet,
|
|
127
|
+
V as SheetClose,
|
|
128
|
+
N as SheetContent,
|
|
129
|
+
T as SheetDescription,
|
|
130
|
+
C as SheetFooter,
|
|
131
|
+
w as SheetHeader,
|
|
132
|
+
S as SheetPortal,
|
|
133
|
+
z as SheetTitle,
|
|
134
|
+
A as SheetTrigger
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=Sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sheet.js","sources":["../../../src/components/ui/Sheet.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type HTMLAttributes,\n} from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { X } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { cva, type VariantProps } from '@/lib/cva';\nimport { withReturnFocus, type ReturnFocusRef } from '@/lib/return-focus';\n\n/* -----------------------------------------------------------------------------\n * Sheet — drawer-style overlay. Built on Radix Dialog (focus trap, escape,\n * click-outside come from there). Slides in from one of four sides.\n * --------------------------------------------------------------------------- */\n\nexport const Sheet = DialogPrimitive.Root;\nexport const SheetTrigger = DialogPrimitive.Trigger;\nexport const SheetClose = DialogPrimitive.Close;\nexport const SheetPortal = DialogPrimitive.Portal;\n\nconst SheetOverlay = forwardRef<\n ElementRef<typeof DialogPrimitive.Overlay>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(function SheetOverlay({ className, ...props }, ref) {\n return (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'bg-overlay fixed inset-0 z-[var(--z-overlay)]',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0',\n className,\n )}\n {...props}\n />\n );\n});\nSheetOverlay.displayName = 'SheetOverlay';\n\nconst sheet = cva(\n [\n 'fixed z-[var(--z-modal)] bg-card text-card-foreground shadow-lg',\n 'flex flex-col gap-4 p-6',\n // Safe-area insets for notched devices (consumers set viewport-fit=cover).\n 'pb-[max(1.5rem,env(safe-area-inset-bottom))] pl-[max(1.5rem,env(safe-area-inset-left))] pr-[max(1.5rem,env(safe-area-inset-right))]',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:duration-[var(--duration-base)] data-[state=open]:duration-[var(--duration-slow)]',\n ],\n {\n variants: {\n side: {\n top: 'inset-x-0 top-0 border-b border-border data-[state=open]:slide-in-from-top data-[state=closed]:slide-out-to-top',\n bottom:\n 'inset-x-0 bottom-0 border-t border-border data-[state=open]:slide-in-from-bottom data-[state=closed]:slide-out-to-bottom',\n left: 'inset-y-0 left-0 h-full w-3/4 max-w-md border-r border-border data-[state=open]:slide-in-from-left data-[state=closed]:slide-out-to-left',\n right:\n 'inset-y-0 right-0 h-full w-3/4 max-w-md border-l border-border data-[state=open]:slide-in-from-right data-[state=closed]:slide-out-to-right',\n },\n },\n defaultVariants: { side: 'right' },\n },\n);\n\nexport interface SheetContentProps\n extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheet> {\n showClose?: boolean;\n /**\n * Element to focus when the overlay closes. Overrides Radix's default\n * (the element focused when the content mounted), which is `<body>` for\n * controlled overlays opened from a pointer click on a non-focusable /\n * tooltip-wrapped trigger. A consumer `onCloseAutoFocus` runs first and\n * wins if it calls `preventDefault()`.\n */\n returnFocusTo?: ReturnFocusRef;\n}\n\nexport const SheetContent = forwardRef<\n ElementRef<typeof DialogPrimitive.Content>,\n SheetContentProps\n>(function SheetContent(\n {\n className,\n children,\n side = 'right',\n showClose = true,\n returnFocusTo,\n onCloseAutoFocus,\n ...props\n },\n ref,\n) {\n const strings = useStrings();\n return (\n <SheetPortal>\n <SheetOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(sheet({ side }), className)}\n onCloseAutoFocus={withReturnFocus(returnFocusTo, onCloseAutoFocus)}\n {...props}\n >\n {children}\n {showClose && (\n <DialogPrimitive.Close\n aria-label={strings.sheet.close}\n className={cn(\n 'text-foreground-subtle absolute top-4 right-4 inline-flex size-8 items-center justify-center rounded-md',\n 'hover:bg-background-muted hover:text-foreground',\n 'focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:ring-2 focus-visible:ring-offset-2',\n 'transition-colors duration-[var(--duration-fast)]',\n )}\n >\n <X className=\"size-4\" aria-hidden />\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </SheetPortal>\n );\n});\nSheetContent.displayName = 'SheetContent';\n\nexport function SheetHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return <div className={cn('flex flex-col gap-1', className)} {...props} />;\n}\nSheetHeader.displayName = 'SheetHeader';\n\nexport function SheetFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn(\n 'mt-auto flex flex-col-reverse gap-2 pt-4 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n );\n}\nSheetFooter.displayName = 'SheetFooter';\n\nexport const SheetTitle = forwardRef<\n ElementRef<typeof DialogPrimitive.Title>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(function SheetTitle({ className, ...props }, ref) {\n return (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-foreground text-lg leading-tight font-semibold', className)}\n {...props}\n />\n );\n});\nSheetTitle.displayName = 'SheetTitle';\n\nexport const SheetDescription = forwardRef<\n ElementRef<typeof DialogPrimitive.Description>,\n ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(function SheetDescription({ className, ...props }, ref) {\n return (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-foreground-muted text-sm', className)}\n {...props}\n />\n );\n});\nSheetDescription.displayName = 'SheetDescription';\n\n/**\n * @example Right-side filter drawer\n * <Sheet>\n * <SheetTrigger asChild><Button variant=\"outline\">Filters</Button></SheetTrigger>\n * <SheetContent side=\"right\">\n * <SheetHeader>\n * <SheetTitle>Filters</SheetTitle>\n * <SheetDescription>Refine the result set.</SheetDescription>\n * </SheetHeader>\n * …\n * <SheetFooter>\n * <SheetClose asChild><Button variant=\"outline\">Cancel</Button></SheetClose>\n * <Button>Apply</Button>\n * </SheetFooter>\n * </SheetContent>\n * </Sheet>\n *\n * @do Use right side for filters/inspectors, left for navigation, bottom for\n * mobile sheets.\n * @dont Use a full-screen sheet on desktop — prefer Dialog or a dedicated page.\n */\n"],"names":["Sheet","DialogPrimitive","SheetTrigger","SheetClose","SheetPortal","SheetOverlay","forwardRef","className","props","ref","jsx","cn","sheet","cva","SheetContent","children","side","showClose","returnFocusTo","onCloseAutoFocus","strings","useStrings","jsxs","withReturnFocus","X","SheetHeader","SheetFooter","SheetTitle","SheetDescription"],"mappings":";;;;;;;;;AAoBO,MAAMA,IAAQC,EAAgB,MACxBC,IAAeD,EAAgB,SAC/BE,IAAaF,EAAgB,OAC7BG,IAAcH,EAAgB,QAErCI,IAAeC,EAGnB,SAAsB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,GAAK;AACpD,SACE,gBAAAC;AAAA,IAACT,EAAgB;AAAA,IAAhB;AAAA,MACC,KAAAQ;AAAA,MACA,WAAWE;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;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pB,SAASW,EAAY,EAAE,WAAAlB,GAAW,GAAGC,KAAyC;AACnF,SAAO,gBAAAE,EAAC,SAAI,WAAWC,EAAG,uBAAuBJ,CAAS,GAAI,GAAGC,GAAO;AAC1E;AACAiB,EAAY,cAAc;AAEnB,SAASC,EAAY,EAAE,WAAAnB,GAAW,GAAGC,KAAyC;AACnF,SACE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AACAkB,EAAY,cAAc;AAEnB,MAAMC,IAAarB,EAGxB,SAAoB,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,GAAK;AAClD,SACE,gBAAAC;AAAA,IAACT,EAAgB;AAAA,IAAhB;AAAA,MACC,KAAAQ;AAAA,MACA,WAAWE,EAAG,uDAAuDJ,CAAS;AAAA,MAC7E,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDmB,EAAW,cAAc;AAElB,MAAMC,IAAmBtB,EAG9B,SAA0B,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,GAAK;AACxD,SACE,gBAAAC;AAAA,IAACT,EAAgB;AAAA,IAAhB;AAAA,MACC,KAAAQ;AAAA,MACA,WAAWE,EAAG,iCAAiCJ,CAAS;AAAA,MACvD,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDoB,EAAiB,cAAc;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
1
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
interface SidebarContextValue {
|
|
3
3
|
collapsed: boolean;
|
|
4
4
|
}
|
|
@@ -20,6 +20,7 @@ export interface SidebarProps extends HTMLAttributes<HTMLElement> {
|
|
|
20
20
|
/**
|
|
21
21
|
* App-level navigation rail. Holds `SidebarSection` → `SidebarItem` lists,
|
|
22
22
|
* and optionally a `footer`. Supports collapse to icon-only on desktop.
|
|
23
|
+
* Below `md` the rail is hidden — pair it with a Sheet / Drawer for mobile.
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* <Sidebar footer={<UserCard />}>
|
|
@@ -45,32 +46,46 @@ export declare function SidebarSection({ label, className, children, ...props }:
|
|
|
45
46
|
export declare namespace SidebarSection {
|
|
46
47
|
var displayName: string;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
interface SidebarItemBaseProps {
|
|
49
50
|
/** Lucide icon shown to the left. */
|
|
50
51
|
icon?: ReactNode;
|
|
51
52
|
/** Mark as the current page. */
|
|
52
53
|
active?: boolean;
|
|
53
|
-
/** Optional `href` — when absent, renders as a `<button>` so consumers can
|
|
54
|
-
* bind their own handler / routing wrapper via `onClick`. */
|
|
55
|
-
href?: string;
|
|
56
54
|
/** Trailing badge / counter slot. */
|
|
57
55
|
trailing?: ReactNode;
|
|
58
56
|
/** Render a sub-item indented under a parent. */
|
|
59
57
|
sub?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Tooltip text shown while the sidebar is collapsed. Defaults to `children`
|
|
60
|
+
* when that is a plain string.
|
|
61
|
+
*/
|
|
62
|
+
tooltip?: ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Render the child element (router `<Link>`) instead of `<a>`/`<button>`.
|
|
65
|
+
* The child receives className, aria-current and the item content.
|
|
66
|
+
*/
|
|
67
|
+
asChild?: boolean;
|
|
60
68
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
69
|
+
type SidebarItemAnchorProps = SidebarItemBaseProps & AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
70
|
+
/** Renders an `<a>`. Omit to render a `<button>`. */
|
|
71
|
+
href: string;
|
|
72
|
+
};
|
|
73
|
+
type SidebarItemButtonProps = SidebarItemBaseProps & ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
74
|
+
href?: undefined;
|
|
75
|
+
};
|
|
76
|
+
/** Discriminated on `href`: with it the item is an anchor, without it a button. */
|
|
77
|
+
export type SidebarItemProps = SidebarItemAnchorProps | SidebarItemButtonProps;
|
|
78
|
+
export declare const SidebarItem: import('react').ForwardRefExoticComponent<SidebarItemProps & import('react').RefAttributes<HTMLElement>>;
|
|
65
79
|
/** Lightweight collapsible sub-section inside the sidebar. */
|
|
66
|
-
export interface SidebarGroupProps {
|
|
80
|
+
export interface SidebarGroupProps extends Omit<HTMLAttributes<HTMLLIElement>, 'children'> {
|
|
67
81
|
icon?: ReactNode;
|
|
68
82
|
label: ReactNode;
|
|
83
|
+
/** Initial open state (uncontrolled). */
|
|
69
84
|
defaultOpen?: boolean;
|
|
85
|
+
/** Controlled open state. */
|
|
86
|
+
open?: boolean;
|
|
87
|
+
onOpenChange?: (open: boolean) => void;
|
|
70
88
|
children: ReactNode;
|
|
71
89
|
}
|
|
72
|
-
export declare
|
|
73
|
-
export declare namespace SidebarGroup {
|
|
74
|
-
var displayName: string;
|
|
75
|
-
}
|
|
90
|
+
export declare const SidebarGroup: import('react').ForwardRefExoticComponent<SidebarGroupProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
76
91
|
export {};
|