@eodparks/ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.js +57 -0
- package/dist/alert-dialog.d.ts +50 -0
- package/dist/alert-dialog.js +149 -0
- package/dist/alert.d.ts +23 -0
- package/dist/alert.js +87 -0
- package/dist/avatar.d.ts +35 -0
- package/dist/avatar.js +118 -0
- package/dist/badge.d.ts +27 -0
- package/dist/badge.js +148 -0
- package/dist/button-C2CCxHu1.d.ts +15 -0
- package/dist/button-DEsRlveL.js +86 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +1 -0
- package/dist/calendar-DhsRPq2D.d.ts +23 -0
- package/dist/calendar-kbn4gZ1a.js +110 -0
- package/dist/calendar.d.ts +2 -0
- package/dist/calendar.js +1 -0
- package/dist/card-tkP52GwZ.js +77 -0
- package/dist/card.d.ts +18 -0
- package/dist/card.js +1 -0
- package/dist/chart.d.ts +52 -0
- package/dist/chart.js +163 -0
- package/dist/checkbox.d.ts +7 -0
- package/dist/checkbox.js +26 -0
- package/dist/cn-B-fHM4Ov.js +12 -0
- package/dist/collapsible.d.ts +10 -0
- package/dist/collapsible.js +23 -0
- package/dist/command.d.ts +38 -0
- package/dist/command.js +124 -0
- package/dist/date-picker.d.ts +46 -0
- package/dist/date-picker.js +159 -0
- package/dist/dialog-JjpMFEDR.js +117 -0
- package/dist/dialog.d.ts +2 -0
- package/dist/dialog.js +3 -0
- package/dist/dropdown-menu-B_VG1VXX.js +116 -0
- package/dist/dropdown-menu-CZ8xcq1d.d.ts +38 -0
- package/dist/dropdown-menu.d.ts +2 -0
- package/dist/dropdown-menu.js +1 -0
- package/dist/empty-state-B11Uq0U_.js +66 -0
- package/dist/empty-state.d.ts +15 -0
- package/dist/empty-state.js +1 -0
- package/dist/error-state.d.ts +48 -0
- package/dist/error-state.js +139 -0
- package/dist/field-Cwhz73-_.d.ts +15 -0
- package/dist/field-D-n7O1n6.js +63 -0
- package/dist/field.d.ts +2 -0
- package/dist/field.js +1 -0
- package/dist/focus-ring-BpxMbGAn.js +3 -0
- package/dist/form-actions.d.ts +21 -0
- package/dist/form-actions.js +41 -0
- package/dist/forms/formik.d.ts +20 -0
- package/dist/forms/formik.js +50 -0
- package/dist/forms/rhf.d.ts +32 -0
- package/dist/forms/rhf.js +114 -0
- package/dist/icon-button-XAjcFsZ2.js +14 -0
- package/dist/icon-button.d.ts +9 -0
- package/dist/icon-button.js +1 -0
- package/dist/icon.d.ts +15 -0
- package/dist/icon.js +21 -0
- package/dist/index-Ct4mPvuB.d.ts +29 -0
- package/dist/input-BxjcqQS1.js +49 -0
- package/dist/input-group.d.ts +12 -0
- package/dist/input-group.js +26 -0
- package/dist/input.d.ts +15 -0
- package/dist/input.js +1 -0
- package/dist/label-BrOAJU1p.js +31 -0
- package/dist/label-CUAiaBbm.d.ts +13 -0
- package/dist/label.d.ts +2 -0
- package/dist/label.js +1 -0
- package/dist/native-select.d.ts +8 -0
- package/dist/native-select.js +41 -0
- package/dist/page-header.d.ts +19 -0
- package/dist/page-header.js +51 -0
- package/dist/pagination.d.ts +47 -0
- package/dist/pagination.js +131 -0
- package/dist/password-input.d.ts +14 -0
- package/dist/password-input.js +41 -0
- package/dist/popover.d.ts +19 -0
- package/dist/popover.js +54 -0
- package/dist/popup-CLsuJ-AA.js +6 -0
- package/dist/progress.d.ts +8 -0
- package/dist/progress.js +36 -0
- package/dist/radio-group.d.ts +14 -0
- package/dist/radio-group.js +25 -0
- package/dist/scroll-area.d.ts +16 -0
- package/dist/scroll-area.js +52 -0
- package/dist/select-Cq_JDuYO.js +266 -0
- package/dist/select.d.ts +40 -0
- package/dist/select.js +1 -0
- package/dist/separator.d.ts +8 -0
- package/dist/separator.js +38 -0
- package/dist/sheet.d.ts +27 -0
- package/dist/sheet.js +95 -0
- package/dist/skeleton.d.ts +19 -0
- package/dist/skeleton.js +45 -0
- package/dist/spinner.d.ts +13 -0
- package/dist/spinner.js +44 -0
- package/dist/switch.d.ts +7 -0
- package/dist/switch.js +19 -0
- package/dist/table.d.ts +24 -0
- package/dist/table.js +75 -0
- package/dist/tabs.d.ts +24 -0
- package/dist/tabs.js +74 -0
- package/dist/textarea.d.ts +5 -0
- package/dist/textarea.js +15 -0
- package/dist/theme-toggle.d.ts +11 -0
- package/dist/theme-toggle.js +50 -0
- package/dist/toast.d.ts +12 -0
- package/dist/toast.js +105 -0
- package/dist/tooltip-BsVKZDXs.js +47 -0
- package/dist/tooltip.d.ts +18 -0
- package/dist/tooltip.js +1 -0
- package/dist/typography-Dy3PCTrL.js +34 -0
- package/dist/typography.d.ts +11 -0
- package/dist/typography.js +1 -0
- package/dist/visually-hidden-BrCs6ZEy.js +11 -0
- package/dist/visually-hidden.d.ts +3 -0
- package/dist/visually-hidden.js +1 -0
- package/docs/accessibility.md +95 -0
- package/docs/accordion.md +89 -0
- package/docs/alert-dialog.md +157 -0
- package/docs/alert.md +70 -0
- package/docs/avatar.md +57 -0
- package/docs/badge.md +51 -0
- package/docs/button.md +121 -0
- package/docs/calendar.md +116 -0
- package/docs/card.md +74 -0
- package/docs/chart.md +93 -0
- package/docs/checkbox.md +119 -0
- package/docs/collapsible.md +76 -0
- package/docs/command.md +114 -0
- package/docs/date-picker.md +177 -0
- package/docs/dialog.md +110 -0
- package/docs/dropdown-menu.md +126 -0
- package/docs/empty-state.md +65 -0
- package/docs/error-state.md +59 -0
- package/docs/field.md +54 -0
- package/docs/form-actions.md +55 -0
- package/docs/forms/formik.md +42 -0
- package/docs/forms/rhf.md +64 -0
- package/docs/icon-button.md +84 -0
- package/docs/icon.md +77 -0
- package/docs/input-group.md +47 -0
- package/docs/input.md +46 -0
- package/docs/label.md +33 -0
- package/docs/layout.md +102 -0
- package/docs/llms.txt +72 -0
- package/docs/native-select.md +87 -0
- package/docs/page-header.md +61 -0
- package/docs/pagination.md +107 -0
- package/docs/password-input.md +30 -0
- package/docs/popover.md +103 -0
- package/docs/progress.md +53 -0
- package/docs/radio-group.md +119 -0
- package/docs/scroll-area.md +85 -0
- package/docs/select.md +106 -0
- package/docs/separator.md +38 -0
- package/docs/sheet.md +118 -0
- package/docs/skeleton.md +50 -0
- package/docs/spinner.md +46 -0
- package/docs/switch.md +92 -0
- package/docs/table.md +87 -0
- package/docs/tabs.md +96 -0
- package/docs/textarea.md +38 -0
- package/docs/theme-toggle.md +76 -0
- package/docs/toast.md +95 -0
- package/docs/tooltip.md +101 -0
- package/docs/typography.md +96 -0
- package/docs/visually-hidden.md +44 -0
- package/layer.css +22 -0
- package/package.json +275 -3
- package/skills/eod-ui/SKILL.md +37 -0
- package/styles.css +2 -0
- package/README.md +0 -3
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { Select as Select$1, SelectClear as SelectClear$1, SelectContent as SelectContent$1, SelectEmpty as SelectEmpty$1, SelectGroup as SelectGroup$1, SelectGroupLabel, SelectItem as SelectItem$1, SelectItemIndicator, SelectList, SelectSelectAll as SelectSelectAll$1, SelectSeparator as SelectSeparator$1, SelectStatus as SelectStatus$1, SelectTrigger as SelectTrigger$1, SelectValue as SelectValue$1 } from "@ui-sdk/react/select";
|
|
2
|
+
import { CheckIcon, ChevronDownIcon, MinusIcon, XIcon } from "lucide-react";
|
|
3
|
+
import { createContext, use, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { t as cn } from "./cn-B-fHM4Ov.js";
|
|
5
|
+
import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
|
|
6
|
+
import { t as popup } from "./popup-CLsuJ-AA.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/select/select.tsx
|
|
9
|
+
function withBase(base, className) {
|
|
10
|
+
if (typeof className === "function") return (state) => cn(base, className(state));
|
|
11
|
+
return cn(base, className);
|
|
12
|
+
}
|
|
13
|
+
const ScrollContext = createContext(null);
|
|
14
|
+
function Select({ children, onHighlight, ...props }) {
|
|
15
|
+
const scrollToRef = useRef(null);
|
|
16
|
+
const highlight = (value, details) => {
|
|
17
|
+
if (details.index >= 0) scrollToRef.current?.(details.index);
|
|
18
|
+
onHighlight?.(value, details);
|
|
19
|
+
};
|
|
20
|
+
let root;
|
|
21
|
+
if (props.multiple) root = /* @__PURE__ */ jsx(Select$1, {
|
|
22
|
+
...props,
|
|
23
|
+
multiple: true,
|
|
24
|
+
onHighlight: highlight,
|
|
25
|
+
children
|
|
26
|
+
});
|
|
27
|
+
else {
|
|
28
|
+
const { value, defaultValue, onValueChange, multiple: _, ...rest } = props;
|
|
29
|
+
root = /* @__PURE__ */ jsx(Select$1, {
|
|
30
|
+
...rest,
|
|
31
|
+
value: value === void 0 ? void 0 : value || null,
|
|
32
|
+
defaultValue: defaultValue === void 0 ? void 0 : defaultValue || null,
|
|
33
|
+
onValueChange: (next, details) => onValueChange?.(next ?? "", details),
|
|
34
|
+
onHighlight: highlight,
|
|
35
|
+
children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return /* @__PURE__ */ jsx(ScrollContext, {
|
|
39
|
+
value: scrollToRef,
|
|
40
|
+
children: root
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const triggerClass = cn("flex h-(--control-h) w-full min-w-0 items-center justify-between gap-2 rounded-control border border-input bg-background px-3 text-start text-sm whitespace-nowrap outline-hidden", "data-[size=sm]:h-(--control-h-sm) data-[size=sm]:px-2.5", "data-placeholder:text-muted-foreground data-disabled:cursor-not-allowed data-disabled:opacity-50", "aria-invalid:border-destructive data-invalid:border-destructive", focusRing);
|
|
44
|
+
function SelectTrigger({ size = "default", invalid, className, children, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx(SelectTrigger$1, {
|
|
46
|
+
"data-size": size,
|
|
47
|
+
...invalid ? {
|
|
48
|
+
"aria-invalid": true,
|
|
49
|
+
"data-invalid": ""
|
|
50
|
+
} : null,
|
|
51
|
+
className: withBase(triggerClass, className),
|
|
52
|
+
...props,
|
|
53
|
+
children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [typeof children === "function" ? children(state) : children ?? /* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
54
|
+
"aria-hidden": true,
|
|
55
|
+
className: "size-4 shrink-0 opacity-50"
|
|
56
|
+
})] })
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function SelectValue({ maxLabels = 2, className, ...props }) {
|
|
60
|
+
return /* @__PURE__ */ jsx(SelectValue$1, {
|
|
61
|
+
maxLabels,
|
|
62
|
+
className: withBase("min-w-0 flex-1 truncate", className),
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const contentClass = cn(popup, "max-h-[min(var(--available-height),24rem)] max-w-(--available-width) overflow-y-auto overscroll-contain outline-hidden");
|
|
67
|
+
function SelectContent({ side = "bottom", align = "start", sideOffset = 4, alignItemWithTrigger = false, className, children, ...props }) {
|
|
68
|
+
const placement = {
|
|
69
|
+
side,
|
|
70
|
+
align,
|
|
71
|
+
sideOffset,
|
|
72
|
+
alignItemWithTrigger
|
|
73
|
+
};
|
|
74
|
+
if (children != null && children !== false) return /* @__PURE__ */ jsx(SelectContent$1, {
|
|
75
|
+
...placement,
|
|
76
|
+
className: withBase(contentClass, className),
|
|
77
|
+
...props,
|
|
78
|
+
children
|
|
79
|
+
});
|
|
80
|
+
return /* @__PURE__ */ jsx(DataContent, {
|
|
81
|
+
...placement,
|
|
82
|
+
className: withBase(contentClass, className),
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const row = 32;
|
|
87
|
+
const overscan = 6;
|
|
88
|
+
const windowFrom = 100;
|
|
89
|
+
const asItem = (entry) => typeof entry === "string" ? {
|
|
90
|
+
value: entry,
|
|
91
|
+
label: entry
|
|
92
|
+
} : entry;
|
|
93
|
+
const keyOf = (entry) => entry === void 0 ? "start" : typeof entry === "object" && "type" in entry ? entry.type === "group" ? entry.label ?? "group" : "separator" : asItem(entry).value;
|
|
94
|
+
function DataItems({ items }) {
|
|
95
|
+
return items.map((entry, position) => {
|
|
96
|
+
if (typeof entry === "object" && "type" in entry) {
|
|
97
|
+
if (entry.type === "separator") return /* @__PURE__ */ jsx(SelectSeparator, {}, `after-${keyOf(items[position - 1])}`);
|
|
98
|
+
return /* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: entry.label }), /* @__PURE__ */ jsx(DataItems, { items: entry.items })] }, `group-${entry.label}`);
|
|
99
|
+
}
|
|
100
|
+
const item = asItem(entry);
|
|
101
|
+
return /* @__PURE__ */ jsx(SelectItem, {
|
|
102
|
+
value: item.value,
|
|
103
|
+
disabled: item.disabled,
|
|
104
|
+
children: item.label
|
|
105
|
+
}, item.value);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function DataContent(props) {
|
|
109
|
+
const scroller = useRef(null);
|
|
110
|
+
const spacer = useRef(null);
|
|
111
|
+
const [scrollTop, setScrollTop] = useState(0);
|
|
112
|
+
const [focused, setFocused] = useState(-1);
|
|
113
|
+
const scrollToRef = use(ScrollContext);
|
|
114
|
+
useLayoutEffect(() => {
|
|
115
|
+
if (!scrollToRef) return;
|
|
116
|
+
scrollToRef.current = (index) => {
|
|
117
|
+
const element = scroller.current;
|
|
118
|
+
const list = spacer.current;
|
|
119
|
+
if (!element || !list) return;
|
|
120
|
+
const offset = list.getBoundingClientRect().top - element.getBoundingClientRect().top + element.scrollTop;
|
|
121
|
+
const top = offset + index * row;
|
|
122
|
+
if (index === 0) element.scrollTop = 0;
|
|
123
|
+
else if (top + row >= offset + list.offsetHeight) element.scrollTop = element.scrollHeight;
|
|
124
|
+
else if (top < element.scrollTop) element.scrollTop = top;
|
|
125
|
+
else if (top + row > element.scrollTop + element.clientHeight) element.scrollTop = top + row - element.clientHeight;
|
|
126
|
+
};
|
|
127
|
+
return () => {
|
|
128
|
+
scrollToRef.current = null;
|
|
129
|
+
};
|
|
130
|
+
}, [scrollToRef]);
|
|
131
|
+
const opened = () => {
|
|
132
|
+
setScrollTop(scroller.current?.scrollTop ?? 0);
|
|
133
|
+
setFocused(-1);
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ jsx(SelectContent$1, {
|
|
136
|
+
ref: scroller,
|
|
137
|
+
onScroll: (event) => setScrollTop(event.currentTarget.scrollTop),
|
|
138
|
+
...props,
|
|
139
|
+
children: /* @__PURE__ */ jsx(SelectList, { children: (state) => {
|
|
140
|
+
const items = state.items;
|
|
141
|
+
if (!items.every((entry) => typeof entry !== "object" || !("type" in entry)) || items.length <= windowFrom) return /* @__PURE__ */ jsx(DataItems, { items });
|
|
142
|
+
const height = scroller.current?.clientHeight || 384;
|
|
143
|
+
const start = Math.max(0, Math.floor(scrollTop / row) - overscan);
|
|
144
|
+
const end = Math.min(items.length, Math.ceil((scrollTop + height) / row) + overscan);
|
|
145
|
+
const rows = Array.from({ length: end - start }, (_, offset) => start + offset);
|
|
146
|
+
if (focused >= 0 && focused < start) rows.unshift(focused);
|
|
147
|
+
else if (focused >= end && focused < items.length) rows.push(focused);
|
|
148
|
+
return /* @__PURE__ */ jsx(Rows, {
|
|
149
|
+
ref: spacer,
|
|
150
|
+
height: items.length * row,
|
|
151
|
+
onOpen: opened,
|
|
152
|
+
onFocus: (event) => {
|
|
153
|
+
const index = event.target.closest("[data-index]");
|
|
154
|
+
if (index) setFocused(Number(index.dataset.index));
|
|
155
|
+
},
|
|
156
|
+
children: rows.map((index) => {
|
|
157
|
+
const item = asItem(items[index]);
|
|
158
|
+
return /* @__PURE__ */ jsx(SelectItem, {
|
|
159
|
+
value: item.value,
|
|
160
|
+
label: item.label,
|
|
161
|
+
disabled: item.disabled,
|
|
162
|
+
index,
|
|
163
|
+
"data-index": index,
|
|
164
|
+
className: "absolute inset-x-0",
|
|
165
|
+
style: {
|
|
166
|
+
top: index * row,
|
|
167
|
+
height: row
|
|
168
|
+
},
|
|
169
|
+
children: item.label
|
|
170
|
+
}, item.value);
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
} })
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function Rows({ height, onOpen, ...props }) {
|
|
177
|
+
const open = useRef(onOpen);
|
|
178
|
+
useLayoutEffect(() => open.current(), []);
|
|
179
|
+
return /* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: "relative",
|
|
181
|
+
style: { height },
|
|
182
|
+
...props
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function SelectGroup({ className, ...props }) {
|
|
186
|
+
return /* @__PURE__ */ jsx(SelectGroup$1, {
|
|
187
|
+
className: withBase("flex flex-col", className),
|
|
188
|
+
...props
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function SelectLabel({ className, ...props }) {
|
|
192
|
+
return /* @__PURE__ */ jsx(SelectGroupLabel, {
|
|
193
|
+
className: withBase("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
|
|
194
|
+
...props
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const itemClass = "relative flex w-full cursor-default items-center gap-2 rounded-item py-1.5 ps-2 pe-8 text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:cursor-not-allowed data-disabled:opacity-50";
|
|
198
|
+
const indicatorClass = "absolute end-2 flex size-4 items-center justify-center";
|
|
199
|
+
function SelectItem({ className, children, ...props }) {
|
|
200
|
+
return /* @__PURE__ */ jsx(SelectItem$1, {
|
|
201
|
+
className: withBase(itemClass, className),
|
|
202
|
+
...props,
|
|
203
|
+
children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
204
|
+
className: "min-w-0 flex-1",
|
|
205
|
+
children: typeof children === "function" ? children(state) : children
|
|
206
|
+
}), /* @__PURE__ */ jsx(SelectItemIndicator, {
|
|
207
|
+
className: indicatorClass,
|
|
208
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {
|
|
209
|
+
"aria-hidden": true,
|
|
210
|
+
className: "size-4"
|
|
211
|
+
})
|
|
212
|
+
})] })
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function SelectSeparator({ className, ...props }) {
|
|
216
|
+
return /* @__PURE__ */ jsx(SelectSeparator$1, {
|
|
217
|
+
className: withBase("-mx-1 my-1 h-px bg-border", className),
|
|
218
|
+
...props
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function SelectClear({ "aria-label": label = "Clear", className, children, ...props }) {
|
|
222
|
+
return /* @__PURE__ */ jsx(SelectClear$1, {
|
|
223
|
+
"aria-label": label,
|
|
224
|
+
className: withBase(cn("inline-flex size-(--control-h) shrink-0 items-center justify-center rounded-control text-muted-foreground outline-hidden hover:bg-accent hover:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", focusRing), className),
|
|
225
|
+
...props,
|
|
226
|
+
children: children ?? /* @__PURE__ */ jsx(XIcon, {
|
|
227
|
+
"aria-hidden": true,
|
|
228
|
+
className: "size-4"
|
|
229
|
+
})
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
function SelectSelectAll({ className, children, ...props }) {
|
|
233
|
+
return /* @__PURE__ */ jsx(SelectSelectAll$1, {
|
|
234
|
+
className: withBase(itemClass, className),
|
|
235
|
+
...props,
|
|
236
|
+
children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
237
|
+
className: "min-w-0 flex-1",
|
|
238
|
+
children: typeof children === "function" ? children(state) : children
|
|
239
|
+
}), (state.checked || state.indeterminate) && /* @__PURE__ */ jsx("span", {
|
|
240
|
+
className: indicatorClass,
|
|
241
|
+
children: state.checked ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
242
|
+
"aria-hidden": true,
|
|
243
|
+
className: "size-4"
|
|
244
|
+
}) : /* @__PURE__ */ jsx(MinusIcon, {
|
|
245
|
+
"aria-hidden": true,
|
|
246
|
+
className: "size-4"
|
|
247
|
+
})
|
|
248
|
+
})] })
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const messageClass = "px-2 py-1.5 text-sm text-muted-foreground";
|
|
252
|
+
function SelectEmpty({ className, children, ...props }) {
|
|
253
|
+
return /* @__PURE__ */ jsx(SelectEmpty$1, {
|
|
254
|
+
className: withBase(messageClass, className),
|
|
255
|
+
...props,
|
|
256
|
+
children
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
function SelectStatus({ className, children, ...props }) {
|
|
260
|
+
return /* @__PURE__ */ jsx(SelectStatus$1, {
|
|
261
|
+
className: withBase(cn(messageClass, "empty:hidden"), className),
|
|
262
|
+
...props,
|
|
263
|
+
children: (state) => state.loading ? children : null
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
export { SelectGroup as a, SelectSelectAll as c, SelectTrigger as d, SelectValue as f, SelectEmpty as i, SelectSeparator as l, SelectClear as n, SelectItem as o, SelectContent as r, SelectLabel as s, Select as t, SelectStatus as u };
|
package/dist/select.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SelectClear as SelectClear$1, SelectContent as SelectContent$1, SelectEmpty as SelectEmpty$1, SelectGroup as SelectGroup$1, SelectGroupLabel, SelectItem as SelectItem$1, SelectOptions, SelectSelectAll as SelectSelectAll$1, SelectSeparator as SelectSeparator$1, SelectSharedOptions, SelectStatus as SelectStatus$1, SelectTrigger as SelectTrigger$1, SelectValue as SelectValue$1 } from "@ui-sdk/react/select";
|
|
2
|
+
import { ComponentProps, ReactNode } from "react";
|
|
3
|
+
type ValueDetails = Parameters<NonNullable<SelectOptions<string>["onValueChange"]>>[1];
|
|
4
|
+
type SingleValue = {
|
|
5
|
+
multiple?: false;
|
|
6
|
+
value?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
onValueChange?: (value: string, details: ValueDetails) => void;
|
|
9
|
+
};
|
|
10
|
+
type MultipleValue = {
|
|
11
|
+
multiple: true;
|
|
12
|
+
value?: string[];
|
|
13
|
+
defaultValue?: string[];
|
|
14
|
+
onValueChange?: (value: string[], details: ValueDetails) => void;
|
|
15
|
+
};
|
|
16
|
+
type SelectProps = SelectSharedOptions<string> & (SingleValue | MultipleValue) & {
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export declare function Select({ children, onHighlight, ...props }: SelectProps): import("react").JSX.Element;
|
|
20
|
+
type SelectTriggerProps = ComponentProps<typeof SelectTrigger$1> & {
|
|
21
|
+
size?: "default" | "sm";
|
|
22
|
+
invalid?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare function SelectTrigger({ size, invalid, className, children, ...props }: SelectTriggerProps): import("react").JSX.Element;
|
|
25
|
+
export declare function SelectValue({ maxLabels, className, ...props }: ComponentProps<typeof SelectValue$1>): import("react").JSX.Element;
|
|
26
|
+
type SelectContentProps = ComponentProps<typeof SelectContent$1>;
|
|
27
|
+
export declare function SelectContent({ side, align, sideOffset, alignItemWithTrigger, className, children, ...props }: SelectContentProps): import("react").JSX.Element;
|
|
28
|
+
export declare function SelectGroup({ className, ...props }: ComponentProps<typeof SelectGroup$1>): import("react").JSX.Element;
|
|
29
|
+
export declare function SelectLabel({ className, ...props }: ComponentProps<typeof SelectGroupLabel>): import("react").JSX.Element;
|
|
30
|
+
export declare function SelectItem({ className, children, ...props }: ComponentProps<typeof SelectItem$1<string>>): import("react").JSX.Element;
|
|
31
|
+
export declare function SelectSeparator({ className, ...props }: ComponentProps<typeof SelectSeparator$1>): import("react").JSX.Element;
|
|
32
|
+
export declare function SelectClear({ "aria-label": label, className, children, ...props }: ComponentProps<typeof SelectClear$1>): import("react").JSX.Element;
|
|
33
|
+
export declare function SelectSelectAll({ className, children, ...props }: ComponentProps<typeof SelectSelectAll$1>): import("react").JSX.Element;
|
|
34
|
+
export declare function SelectEmpty({ className, children, ...props }: ComponentProps<typeof SelectEmpty$1> & {
|
|
35
|
+
children: ReactNode;
|
|
36
|
+
}): import("react").JSX.Element;
|
|
37
|
+
export declare function SelectStatus({ className, children, ...props }: ComponentProps<typeof SelectStatus$1> & {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}): import("react").JSX.Element;
|
|
40
|
+
export type { SelectProps };
|
package/dist/select.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as Select, n as SelectClear, r as SelectContent, i as SelectEmpty, a as SelectGroup, o as SelectItem, s as SelectLabel, c as SelectSelectAll, l as SelectSeparator, u as SelectStatus, d as SelectTrigger, f as SelectValue } from "./select-Cq_JDuYO.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Separator as Separator$1 } from "@ui-sdk/react/separator";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
type SeparatorProps = Omit<ComponentProps<typeof Separator$1>, "children"> & {
|
|
4
|
+
/** Text in the middle of a horizontal line. It also names the separator. */
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
declare function Separator({ orientation, label, className, ...props }: SeparatorProps): import("react").JSX.Element;
|
|
8
|
+
export { Separator, type SeparatorProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Separator as Separator$1 } from "@ui-sdk/react/separator";
|
|
2
|
+
import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/separator/separator.tsx
|
|
5
|
+
const line = "bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:min-w-4 data-[orientation=vertical]:w-px";
|
|
6
|
+
function Separator({ orientation = "horizontal", label, className, ...props }) {
|
|
7
|
+
if (label && orientation === "horizontal") return /* @__PURE__ */ jsxs(Separator$1, {
|
|
8
|
+
...props,
|
|
9
|
+
orientation,
|
|
10
|
+
"aria-label": label,
|
|
11
|
+
"data-slot": "separator",
|
|
12
|
+
className: withBase("flex w-full items-center gap-3", className),
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ jsx("span", {
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
"data-orientation": "horizontal",
|
|
17
|
+
className: cn(line, "flex-1")
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsx("span", {
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
className: "text-xs/4 text-muted-foreground",
|
|
22
|
+
children: label
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ jsx("span", {
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
"data-orientation": "horizontal",
|
|
27
|
+
className: cn(line, "flex-1")
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
32
|
+
...props,
|
|
33
|
+
orientation,
|
|
34
|
+
"data-slot": "separator",
|
|
35
|
+
className: withBase(cn(line, "shrink-0 data-[orientation=vertical]:self-stretch"), className)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export { Separator };
|
package/dist/sheet.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Drawer, DrawerClose, DrawerContent, DrawerController as SheetController, DrawerDescription, DrawerTitle, DrawerTrigger, createDrawerController as createSheetController } from "@ui-sdk/react/drawer";
|
|
2
|
+
import { PartProps } from "@ui-sdk/react/primitive";
|
|
3
|
+
import { VariantProps } from "class-variance-authority";
|
|
4
|
+
import { ComponentProps } from "react";
|
|
5
|
+
type SheetProps = ComponentProps<typeof Drawer>;
|
|
6
|
+
declare function Sheet({ side, ...props }: SheetProps): import("react").JSX.Element;
|
|
7
|
+
type SheetTriggerProps = ComponentProps<typeof DrawerTrigger>;
|
|
8
|
+
declare function SheetTrigger(props: SheetTriggerProps): import("react").JSX.Element;
|
|
9
|
+
declare const sheetContentVariants: (props?: ({
|
|
10
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
type UIContentProps = ComponentProps<typeof DrawerContent>;
|
|
13
|
+
type SheetContentProps = UIContentProps & VariantProps<typeof sheetContentVariants> & {
|
|
14
|
+
showCloseButton?: boolean;
|
|
15
|
+
closeLabel?: string;
|
|
16
|
+
};
|
|
17
|
+
declare function SheetContent({ size, showCloseButton, closeLabel, className, children, ...props }: SheetContentProps): import("react").JSX.Element;
|
|
18
|
+
declare function SheetHeader({ className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
19
|
+
declare function SheetBody({ className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
20
|
+
declare function SheetFooter({ className, ...props }: PartProps<"div">): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
21
|
+
type SheetTitleProps = ComponentProps<typeof DrawerTitle>;
|
|
22
|
+
declare function SheetTitle({ className, ...props }: SheetTitleProps): import("react").JSX.Element;
|
|
23
|
+
type SheetDescriptionProps = ComponentProps<typeof DrawerDescription>;
|
|
24
|
+
declare function SheetDescription({ className, ...props }: SheetDescriptionProps): import("react").JSX.Element;
|
|
25
|
+
type SheetCloseProps = ComponentProps<typeof DrawerClose>;
|
|
26
|
+
declare function SheetClose(props: SheetCloseProps): import("react").JSX.Element;
|
|
27
|
+
export { Sheet, SheetBody, SheetClose, type SheetCloseProps, SheetContent, type SheetContentProps, type SheetController, SheetDescription, type SheetDescriptionProps, SheetFooter, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, SheetTrigger, type SheetTriggerProps, createSheetController, sheetContentVariants };
|
package/dist/sheet.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Drawer, DrawerBackdrop, DrawerClose, DrawerContent, DrawerDescription, DrawerTitle, DrawerTrigger, createDrawerController as createSheetController } from "@ui-sdk/react/drawer";
|
|
2
|
+
import { renderElement } from "@ui-sdk/react/primitive";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { XIcon } from "lucide-react";
|
|
5
|
+
import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
|
|
6
|
+
import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
|
|
7
|
+
import { n as textVariants } from "./typography-Dy3PCTrL.js";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/sheet/sheet.tsx
|
|
10
|
+
function Sheet({ side = "right", ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Drawer, {
|
|
12
|
+
...props,
|
|
13
|
+
side
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function SheetTrigger(props) {
|
|
17
|
+
return /* @__PURE__ */ jsx(DrawerTrigger, { ...props });
|
|
18
|
+
}
|
|
19
|
+
const sheetContentVariants = cva([
|
|
20
|
+
"relative m-0 flex flex-col gap-4 bg-background p-6 text-start text-foreground shadow-lg outline-hidden wrap-anywhere",
|
|
21
|
+
"data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r",
|
|
22
|
+
"data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l",
|
|
23
|
+
"data-[side=top]:max-h-[85dvh] data-[side=top]:w-full data-[side=top]:border-b",
|
|
24
|
+
"data-[side=bottom]:max-h-[85dvh] data-[side=bottom]:w-full data-[side=bottom]:border-t data-[side=bottom]:pt-3"
|
|
25
|
+
], {
|
|
26
|
+
variants: { size: {
|
|
27
|
+
sm: "data-[side=left]:max-w-sm data-[side=right]:max-w-sm",
|
|
28
|
+
md: "data-[side=left]:max-w-lg data-[side=right]:max-w-lg",
|
|
29
|
+
lg: "data-[side=left]:max-w-2xl data-[side=right]:max-w-2xl"
|
|
30
|
+
} },
|
|
31
|
+
defaultVariants: { size: "sm" }
|
|
32
|
+
});
|
|
33
|
+
function SheetContent({ size = "sm", showCloseButton = true, closeLabel = "Close", className, children, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(DrawerBackdrop, {
|
|
35
|
+
render: /* @__PURE__ */ jsx("div", { "data-slot": "sheet-overlay" }),
|
|
36
|
+
className: "fixed inset-0 m-0 bg-overlay/80"
|
|
37
|
+
}), /* @__PURE__ */ jsx(DrawerContent, {
|
|
38
|
+
...props,
|
|
39
|
+
className: withBase(sheetContentVariants({ size }), className),
|
|
40
|
+
children: (state) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
state.side === "bottom" && /* @__PURE__ */ jsx("div", {
|
|
42
|
+
"data-slot": "sheet-grip",
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
className: "mx-auto h-1.5 w-12 shrink-0 rounded-full bg-border"
|
|
45
|
+
}),
|
|
46
|
+
typeof children === "function" ? children(state) : children,
|
|
47
|
+
showCloseButton && /* @__PURE__ */ jsx(DrawerClose, {
|
|
48
|
+
"aria-label": closeLabel,
|
|
49
|
+
className: cn("absolute end-4 top-4 inline-flex size-8 items-center justify-center rounded-item text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground", "focus-visible:outline-hidden focus-visible:ring-(length:--focus-ring-width) focus-visible:ring-ring focus-visible:ring-offset-[length:var(--focus-ring-offset)] focus-visible:ring-offset-background"),
|
|
50
|
+
children: /* @__PURE__ */ jsx(XIcon, {
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
className: "size-4"
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
] })
|
|
56
|
+
})] });
|
|
57
|
+
}
|
|
58
|
+
function SheetHeader({ className, ...props }) {
|
|
59
|
+
return renderElement("div", {
|
|
60
|
+
...props,
|
|
61
|
+
"data-slot": "sheet-header",
|
|
62
|
+
className: withBase("flex flex-col gap-1.5 pe-8", className)
|
|
63
|
+
}, props.render);
|
|
64
|
+
}
|
|
65
|
+
function SheetBody({ className, ...props }) {
|
|
66
|
+
return renderElement("div", {
|
|
67
|
+
tabIndex: 0,
|
|
68
|
+
...props,
|
|
69
|
+
"data-slot": "sheet-body",
|
|
70
|
+
className: withBase(cn("-mx-1 min-h-0 flex-1 overflow-y-auto overscroll-contain rounded-item px-1", focusRing), className)
|
|
71
|
+
}, props.render);
|
|
72
|
+
}
|
|
73
|
+
function SheetFooter({ className, ...props }) {
|
|
74
|
+
return renderElement("div", {
|
|
75
|
+
...props,
|
|
76
|
+
"data-slot": "sheet-footer",
|
|
77
|
+
className: withBase("mt-auto flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)
|
|
78
|
+
}, props.render);
|
|
79
|
+
}
|
|
80
|
+
function SheetTitle({ className, ...props }) {
|
|
81
|
+
return /* @__PURE__ */ jsx(DrawerTitle, {
|
|
82
|
+
...props,
|
|
83
|
+
className: withBase(textVariants({ variant: "section-title" }), className)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function SheetDescription({ className, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx(DrawerDescription, {
|
|
88
|
+
...props,
|
|
89
|
+
className: withBase(cn(textVariants({ variant: "small" }), "text-muted-foreground"), className)
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function SheetClose(props) {
|
|
93
|
+
return /* @__PURE__ */ jsx(DrawerClose, { ...props });
|
|
94
|
+
}
|
|
95
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, createSheetController, sheetContentVariants };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PartProps } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const skeletonVariants: (props?: ({
|
|
4
|
+
variant?: "circle" | "rect" | "text" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
type SkeletonProps = PartProps<"div"> & VariantProps<typeof skeletonVariants>;
|
|
7
|
+
/** Decorative: hide it from assistive technology and mark the loading region `aria-busy`. */
|
|
8
|
+
declare function Skeleton({ variant, render, className, ...props }: SkeletonProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
9
|
+
type SkeletonTableRowProps = PartProps<"div"> & {
|
|
10
|
+
columns?: number;
|
|
11
|
+
};
|
|
12
|
+
/** One table row of text bars, sized with the table cell padding token. */
|
|
13
|
+
declare function SkeletonTableRow({ columns, render, className, ...props }: SkeletonTableRowProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
14
|
+
type SkeletonCardProps = Omit<PartProps<"div">, "size"> & {
|
|
15
|
+
size?: "default" | "compact";
|
|
16
|
+
};
|
|
17
|
+
/** The shape of a `Card` with a title, a description and a body. */
|
|
18
|
+
declare function SkeletonCard({ size, ...props }: SkeletonCardProps): import("react").JSX.Element;
|
|
19
|
+
export { Skeleton, SkeletonCard, type SkeletonCardProps, type SkeletonProps, SkeletonTableRow, type SkeletonTableRowProps, skeletonVariants };
|
package/dist/skeleton.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { renderElement } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { n as withBase } from "./cn-B-fHM4Ov.js";
|
|
4
|
+
import { o as CardHeader, r as CardContent, t as Card } from "./card-tkP52GwZ.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/skeleton/skeleton.tsx
|
|
7
|
+
const skeletonVariants = cva("shrink-0 animate-pulse bg-muted motion-reduce:animate-none", {
|
|
8
|
+
variants: { variant: {
|
|
9
|
+
text: "h-4 w-full rounded-item",
|
|
10
|
+
circle: "size-10 rounded-full",
|
|
11
|
+
rect: "h-24 w-full rounded-surface"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { variant: "text" }
|
|
14
|
+
});
|
|
15
|
+
/** Decorative: hide it from assistive technology and mark the loading region `aria-busy`. */
|
|
16
|
+
function Skeleton({ variant = "text", render, className, ...props }) {
|
|
17
|
+
return renderElement("div", {
|
|
18
|
+
"aria-hidden": true,
|
|
19
|
+
...props,
|
|
20
|
+
"data-slot": "skeleton",
|
|
21
|
+
"data-variant": variant,
|
|
22
|
+
className: withBase(skeletonVariants({ variant }), className)
|
|
23
|
+
}, render);
|
|
24
|
+
}
|
|
25
|
+
/** One table row of text bars, sized with the table cell padding token. */
|
|
26
|
+
function SkeletonTableRow({ columns = 4, render, className, ...props }) {
|
|
27
|
+
return renderElement("div", {
|
|
28
|
+
"aria-hidden": true,
|
|
29
|
+
...props,
|
|
30
|
+
"data-slot": "skeleton-table-row",
|
|
31
|
+
className: withBase("flex items-center gap-4 py-(--table-cell-py)", className),
|
|
32
|
+
children: Array.from({ length: columns }, (_, index) => /* @__PURE__ */ jsx(Skeleton, { className: "flex-1" }, index))
|
|
33
|
+
}, render);
|
|
34
|
+
}
|
|
35
|
+
/** The shape of a `Card` with a title, a description and a body. */
|
|
36
|
+
function SkeletonCard({ size, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
size,
|
|
40
|
+
...props,
|
|
41
|
+
"data-slot": "skeleton-card",
|
|
42
|
+
children: [/* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx(Skeleton, { className: "col-start-1 h-7 w-1/2" }), /* @__PURE__ */ jsx(Skeleton, { className: "col-start-1 h-5 w-3/4" })] }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx(Skeleton, { variant: "rect" }) })]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export { Skeleton, SkeletonCard, SkeletonTableRow, skeletonVariants };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PartProps } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const spinnerVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "lg" | "md" | null | undefined;
|
|
5
|
+
layout?: "inline" | "block" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
type SpinnerProps = PartProps<"span"> & VariantProps<typeof spinnerVariants> & {
|
|
8
|
+
/** What is loading. Announced politely; shown beside the spinner only with `showLabel`. */
|
|
9
|
+
label?: string;
|
|
10
|
+
showLabel?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare function Spinner({ size, layout, label, showLabel, render, className, ...props }: SpinnerProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
13
|
+
export { Spinner, type SpinnerProps, spinnerVariants };
|
package/dist/spinner.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { renderElement } from "@ui-sdk/react/primitive";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { LoaderCircleIcon } from "lucide-react";
|
|
4
|
+
import { n as withBase } from "./cn-B-fHM4Ov.js";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/spinner/spinner.tsx
|
|
7
|
+
const spinnerVariants = cva("", {
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
sm: "[&_svg]:size-4",
|
|
11
|
+
md: "[&_svg]:size-6",
|
|
12
|
+
lg: "[&_svg]:size-8"
|
|
13
|
+
},
|
|
14
|
+
layout: {
|
|
15
|
+
inline: "inline-flex",
|
|
16
|
+
block: "flex w-full justify-center p-6"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
size: "md",
|
|
21
|
+
layout: "inline"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
function Spinner({ size = "md", layout = "inline", label = "Loading", showLabel = false, render, className, ...props }) {
|
|
25
|
+
return renderElement("span", {
|
|
26
|
+
role: "status",
|
|
27
|
+
...props,
|
|
28
|
+
"data-slot": "spinner",
|
|
29
|
+
"data-size": size,
|
|
30
|
+
"data-layout": layout,
|
|
31
|
+
className: withBase(`${spinnerVariants({
|
|
32
|
+
size,
|
|
33
|
+
layout
|
|
34
|
+
})} items-center gap-2 text-muted-foreground`, className),
|
|
35
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(LoaderCircleIcon, {
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
className: "shrink-0 animate-spin motion-reduce:animate-none"
|
|
38
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: showLabel ? "text-sm/5" : "sr-only",
|
|
40
|
+
children: label
|
|
41
|
+
})] })
|
|
42
|
+
}, render);
|
|
43
|
+
}
|
|
44
|
+
export { Spinner, spinnerVariants };
|
package/dist/switch.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Switch as Switch$1 } from "@ui-sdk/react/switch";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
type SwitchProps = Omit<ComponentProps<typeof Switch$1>, "children"> & {
|
|
4
|
+
size?: "default" | "sm";
|
|
5
|
+
};
|
|
6
|
+
declare function Switch({ size, className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
7
|
+
export { Switch, type SwitchProps };
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Switch as Switch$1, SwitchThumb } from "@ui-sdk/react/switch";
|
|
2
|
+
import { n as withBase, t as cn } from "./cn-B-fHM4Ov.js";
|
|
3
|
+
import { t as focusRing } from "./focus-ring-BpxMbGAn.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// src/switch/switch.tsx
|
|
6
|
+
const switchClass = cn("peer relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent bg-input transition-colors", "data-[size=sm]:h-5 data-[size=sm]:w-9", "after:absolute after:inset-x-0 after:top-1/2 after:h-6 after:-translate-y-1/2", "data-checked:bg-primary", "[&:not([data-checked],[data-disabled],[data-readonly]):hover]:bg-muted-foreground", "[&[data-checked]:not([data-disabled],[data-readonly]):hover]:bg-primary/90", "data-disabled:cursor-not-allowed data-disabled:opacity-50 data-readonly:cursor-default", focusRing);
|
|
7
|
+
const thumbSize = {
|
|
8
|
+
default: "size-5 data-checked:translate-x-5 rtl:data-checked:-translate-x-5",
|
|
9
|
+
sm: "size-4 data-checked:translate-x-4 rtl:data-checked:-translate-x-4"
|
|
10
|
+
};
|
|
11
|
+
function Switch({ size = "default", className, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Switch$1, {
|
|
13
|
+
"data-size": size,
|
|
14
|
+
className: withBase(switchClass, className),
|
|
15
|
+
...props,
|
|
16
|
+
children: /* @__PURE__ */ jsx(SwitchThumb, { className: cn("pointer-events-none block rounded-full bg-background shadow-lg transition-[translate] duration-150", thumbSize[size]) })
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { Switch };
|