xiod-ui 1.0.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 +73 -0
- package/README.md +167 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +46 -0
- package/dist/components/agent-steps.d.ts +47 -0
- package/dist/components/agent-steps.js +223 -0
- package/dist/components/alert-dialog.d.ts +21 -0
- package/dist/components/alert-dialog.js +74 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +45 -0
- package/dist/components/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio.js +22 -0
- package/dist/components/autocomplete.d.ts +35 -0
- package/dist/components/autocomplete.js +160 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +65 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +46 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +75 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +45 -0
- package/dist/components/button-split.d.ts +19 -0
- package/dist/components/button-split.js +73 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +54 -0
- package/dist/components/calendar.d.ts +63 -0
- package/dist/components/calendar.js +425 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +139 -0
- package/dist/components/carousel.d.ts +59 -0
- package/dist/components/carousel.js +503 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +86 -0
- package/dist/components/circular-progress.d.ts +28 -0
- package/dist/components/circular-progress.js +127 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/color-picker.d.ts +159 -0
- package/dist/components/color-picker.js +1589 -0
- package/dist/components/combobox.d.ts +46 -0
- package/dist/components/combobox.js +237 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +129 -0
- package/dist/components/context-menu.d.ts +38 -0
- package/dist/components/context-menu.js +164 -0
- package/dist/components/copy-to-clipboard.d.ts +32 -0
- package/dist/components/copy-to-clipboard.js +83 -0
- package/dist/components/corner-badge.d.ts +22 -0
- package/dist/components/corner-badge.js +84 -0
- package/dist/components/dashboard-grid.d.ts +83 -0
- package/dist/components/dashboard-grid.js +486 -0
- package/dist/components/date-picker.d.ts +29 -0
- package/dist/components/date-picker.js +261 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.js +97 -0
- package/dist/components/dot-matrix.d.ts +32 -0
- package/dist/components/dot-matrix.js +707 -0
- package/dist/components/draggable.d.ts +42 -0
- package/dist/components/draggable.js +346 -0
- package/dist/components/drawer.d.ts +66 -0
- package/dist/components/drawer.js +304 -0
- package/dist/components/empty.d.ts +14 -0
- package/dist/components/empty.js +75 -0
- package/dist/components/field.d.ts +12 -0
- package/dist/components/field.js +44 -0
- package/dist/components/fieldset.d.ts +7 -0
- package/dist/components/fieldset.js +21 -0
- package/dist/components/file-upload.d.ts +61 -0
- package/dist/components/file-upload.js +482 -0
- package/dist/components/form.d.ts +6 -0
- package/dist/components/form.js +14 -0
- package/dist/components/frame.d.ts +10 -0
- package/dist/components/frame.js +47 -0
- package/dist/components/gauge.d.ts +27 -0
- package/dist/components/gauge.js +74 -0
- package/dist/components/grid.d.ts +26 -0
- package/dist/components/grid.js +204 -0
- package/dist/components/group.d.ts +19 -0
- package/dist/components/group.js +45 -0
- package/dist/components/input-group.d.ts +15 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.js +50 -0
- package/dist/components/input-payment.d.ts +131 -0
- package/dist/components/input-payment.js +1140 -0
- package/dist/components/input-phone.d.ts +70 -0
- package/dist/components/input-phone.js +657 -0
- package/dist/components/input-sensitive.d.ts +12 -0
- package/dist/components/input-sensitive.js +169 -0
- package/dist/components/input.d.ts +13 -0
- package/dist/components/input.js +26 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +19 -0
- package/dist/components/kinetic-click.d.ts +48 -0
- package/dist/components/kinetic-click.js +1184 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +18 -0
- package/dist/components/list-box.d.ts +20 -0
- package/dist/components/list-box.js +148 -0
- package/dist/components/loader.d.ts +13 -0
- package/dist/components/loader.js +430 -0
- package/dist/components/marker.d.ts +15 -0
- package/dist/components/marker.js +59 -0
- package/dist/components/menu.d.ts +42 -0
- package/dist/components/menu.js +186 -0
- package/dist/components/menubar.d.ts +40 -0
- package/dist/components/menubar.js +107 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +112 -0
- package/dist/components/meter.d.ts +10 -0
- package/dist/components/meter.js +42 -0
- package/dist/components/morphic-toast.d.ts +61 -0
- package/dist/components/morphic-toast.js +916 -0
- package/dist/components/navigation-menu.d.ts +26 -0
- package/dist/components/navigation-menu.js +116 -0
- package/dist/components/number-field.d.ts +15 -0
- package/dist/components/number-field.js +86 -0
- package/dist/components/option-picker.d.ts +18 -0
- package/dist/components/option-picker.js +89 -0
- package/dist/components/orb.d.ts +38 -0
- package/dist/components/orb.js +1413 -0
- package/dist/components/pagination.d.ts +25 -0
- package/dist/components/pagination.js +147 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +79 -0
- package/dist/components/preview-card.d.ts +16 -0
- package/dist/components/preview-card.js +60 -0
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.js +139 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +68 -0
- package/dist/components/resizable.d.ts +58 -0
- package/dist/components/resizable.js +964 -0
- package/dist/components/ruler-picker.d.ts +27 -0
- package/dist/components/ruler-picker.js +253 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area.js +34 -0
- package/dist/components/scroll-bar.d.ts +13 -0
- package/dist/components/scroll-bar.js +47 -0
- package/dist/components/select.d.ts +29 -0
- package/dist/components/select.js +140 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +15 -0
- package/dist/components/sidebar.d.ts +65 -0
- package/dist/components/sidebar.js +408 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +12 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +96 -0
- package/dist/components/sortable.d.ts +44 -0
- package/dist/components/sortable.js +327 -0
- package/dist/components/switch.d.ts +15 -0
- package/dist/components/switch.js +63 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +65 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +39 -0
- package/dist/components/text.d.ts +14 -0
- package/dist/components/text.js +69 -0
- package/dist/components/textarea.d.ts +9 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme-provider.d.ts +52 -0
- package/dist/components/theme-provider.js +148 -0
- package/dist/components/timeline.d.ts +34 -0
- package/dist/components/timeline.js +147 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/toast.js +161 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +53 -0
- package/dist/components/toggle.d.ts +11 -0
- package/dist/components/toggle.js +36 -0
- package/dist/components/toolbar.d.ts +11 -0
- package/dist/components/toolbar.js +49 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/waveform.d.ts +61 -0
- package/dist/components/waveform.js +500 -0
- package/dist/components/wheel-picker.d.ts +44 -0
- package/dist/components/wheel-picker.js +771 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.js +36 -0
- package/dist/hooks/use-media-query.d.ts +21 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/styles.css +202 -0
- package/dist/themes/afterglow.css +89 -0
- package/dist/themes/afterglow.scoped.css +90 -0
- package/dist/themes/blacklight.css +89 -0
- package/dist/themes/blacklight.scoped.css +90 -0
- package/dist/themes/cathode.css +89 -0
- package/dist/themes/cathode.scoped.css +90 -0
- package/dist/themes/cel.css +89 -0
- package/dist/themes/cel.scoped.css +90 -0
- package/dist/themes/cinder.css +89 -0
- package/dist/themes/cinder.scoped.css +90 -0
- package/dist/themes/clay.css +89 -0
- package/dist/themes/clay.scoped.css +90 -0
- package/dist/themes/cobalt.css +89 -0
- package/dist/themes/cobalt.scoped.css +90 -0
- package/dist/themes/crimson.css +89 -0
- package/dist/themes/crimson.scoped.css +90 -0
- package/dist/themes/ion.css +89 -0
- package/dist/themes/ion.scoped.css +90 -0
- package/dist/themes/iris.css +89 -0
- package/dist/themes/iris.scoped.css +90 -0
- package/dist/themes/lagoon.css +89 -0
- package/dist/themes/lagoon.scoped.css +90 -0
- package/dist/themes/mochi.css +89 -0
- package/dist/themes/mochi.scoped.css +90 -0
- package/dist/themes/riso.css +89 -0
- package/dist/themes/riso.scoped.css +90 -0
- package/dist/themes/roast.css +89 -0
- package/dist/themes/roast.scoped.css +90 -0
- package/dist/themes/sage.css +89 -0
- package/dist/themes/sage.scoped.css +90 -0
- package/dist/themes/sepia.css +89 -0
- package/dist/themes/sepia.scoped.css +90 -0
- package/dist/themes/sorbet.css +89 -0
- package/dist/themes/sorbet.scoped.css +90 -0
- package/dist/themes/taffy.css +89 -0
- package/dist/themes/taffy.scoped.css +90 -0
- package/dist/themes/toxin.css +89 -0
- package/dist/themes/toxin.scoped.css +90 -0
- package/package.json +140 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import * as React$1 from "react";
|
|
6
|
+
import { Cancel } from "xiod-icons/icons/Cancel";
|
|
7
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
8
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
9
|
+
import { GripVertical } from "xiod-icons/icons/GripVertical";
|
|
10
|
+
//#region src/components/sortable.tsx
|
|
11
|
+
const sortableVariants = cva("relative flex select-none transition-colors duration-200 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
12
|
+
variants: {
|
|
13
|
+
orientation: {
|
|
14
|
+
vertical: "flex-col gap-2 w-full",
|
|
15
|
+
horizontal: "flex-row gap-2 items-center overflow-x-auto",
|
|
16
|
+
grid: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 w-full"
|
|
17
|
+
},
|
|
18
|
+
variant: {
|
|
19
|
+
default: "",
|
|
20
|
+
ghost: "bg-transparent p-0",
|
|
21
|
+
bordered: "border border-border/60 bg-background/50 rounded-xl p-3 backdrop-blur-xs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
orientation: "vertical",
|
|
26
|
+
variant: "default"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const sortableItemVariants = cva("relative flex items-center gap-3 rounded-lg border text-card-foreground shadow-xs/5 transition-[transform,box-shadow,border-color,opacity] duration-150 group overflow-hidden touch-none", {
|
|
30
|
+
variants: {
|
|
31
|
+
variant: {
|
|
32
|
+
default: "border-border/80 bg-card hover:border-foreground/20",
|
|
33
|
+
accent: "border-primary/30 bg-primary/5 hover:border-primary/50",
|
|
34
|
+
flat: "border-border/40 bg-muted/40 shadow-none"
|
|
35
|
+
},
|
|
36
|
+
isDragging: {
|
|
37
|
+
true: "z-30 opacity-30 border-dashed border-primary shadow-none scale-[0.98]",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
isHoveredTarget: {
|
|
41
|
+
true: "border-primary bg-primary/10 scale-[1.02] shadow-md/10 z-20",
|
|
42
|
+
false: ""
|
|
43
|
+
},
|
|
44
|
+
isKeyboardActive: {
|
|
45
|
+
true: "ring-2 ring-ring ring-offset-2 ring-offset-background border-primary z-20",
|
|
46
|
+
false: ""
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
variant: "default",
|
|
51
|
+
isDragging: false,
|
|
52
|
+
isHoveredTarget: false,
|
|
53
|
+
isKeyboardActive: false
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const SortableContext = React$1.createContext(null);
|
|
57
|
+
function Sortable({ className, orientation = "vertical", variant, items, onReorder, onRemove, render, children, ...props }) {
|
|
58
|
+
const containerRef = React$1.useRef(null);
|
|
59
|
+
const [activeIndex, setActiveIndex] = React$1.useState(null);
|
|
60
|
+
const [overIndex, setOverIndex] = React$1.useState(null);
|
|
61
|
+
const [keyboardActiveIndex, setKeyboardActiveIndex] = React$1.useState(null);
|
|
62
|
+
const [dragOverlayPos, setDragOverlayPos] = React$1.useState(null);
|
|
63
|
+
const activeIndexRef = React$1.useRef(null);
|
|
64
|
+
const overIndexRef = React$1.useRef(null);
|
|
65
|
+
const itemsRef = React$1.useRef(items);
|
|
66
|
+
const onReorderRef = React$1.useRef(onReorder);
|
|
67
|
+
React$1.useEffect(() => {
|
|
68
|
+
itemsRef.current = items;
|
|
69
|
+
onReorderRef.current = onReorder;
|
|
70
|
+
}, [items, onReorder]);
|
|
71
|
+
const handlePointerDown = React$1.useCallback((index, e) => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
activeIndexRef.current = index;
|
|
75
|
+
overIndexRef.current = index;
|
|
76
|
+
setActiveIndex(index);
|
|
77
|
+
setOverIndex(index);
|
|
78
|
+
setDragOverlayPos({
|
|
79
|
+
x: e.clientX,
|
|
80
|
+
y: e.clientY
|
|
81
|
+
});
|
|
82
|
+
const container = containerRef.current;
|
|
83
|
+
const onPointerMove = (moveEvent) => {
|
|
84
|
+
setDragOverlayPos({
|
|
85
|
+
x: moveEvent.clientX,
|
|
86
|
+
y: moveEvent.clientY
|
|
87
|
+
});
|
|
88
|
+
if (!container) return;
|
|
89
|
+
const elementUnder = document.elementFromPoint(moveEvent.clientX, moveEvent.clientY);
|
|
90
|
+
if (!elementUnder) return;
|
|
91
|
+
const itemEl = elementUnder.closest("[data-sortable-index]");
|
|
92
|
+
if (itemEl && container.contains(itemEl)) {
|
|
93
|
+
const hoverIdx = Number(itemEl.getAttribute("data-sortable-index"));
|
|
94
|
+
if (!Number.isNaN(hoverIdx) && hoverIdx !== overIndexRef.current) {
|
|
95
|
+
overIndexRef.current = hoverIdx;
|
|
96
|
+
setOverIndex(hoverIdx);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const onPointerUp = () => {
|
|
101
|
+
window.removeEventListener("pointermove", onPointerMove);
|
|
102
|
+
window.removeEventListener("pointerup", onPointerUp);
|
|
103
|
+
const fromIdx = activeIndexRef.current;
|
|
104
|
+
const toIdx = overIndexRef.current;
|
|
105
|
+
if (fromIdx !== null && toIdx !== null && fromIdx !== toIdx && fromIdx >= 0 && fromIdx < itemsRef.current.length && toIdx >= 0 && toIdx < itemsRef.current.length) {
|
|
106
|
+
const reordered = [...itemsRef.current];
|
|
107
|
+
const [removed] = reordered.splice(fromIdx, 1);
|
|
108
|
+
reordered.splice(toIdx, 0, removed);
|
|
109
|
+
onReorderRef.current(reordered);
|
|
110
|
+
}
|
|
111
|
+
activeIndexRef.current = null;
|
|
112
|
+
overIndexRef.current = null;
|
|
113
|
+
setActiveIndex(null);
|
|
114
|
+
setOverIndex(null);
|
|
115
|
+
setDragOverlayPos(null);
|
|
116
|
+
};
|
|
117
|
+
window.addEventListener("pointermove", onPointerMove);
|
|
118
|
+
window.addEventListener("pointerup", onPointerUp);
|
|
119
|
+
}, []);
|
|
120
|
+
const handleKeyDown = React$1.useCallback((index, e) => {
|
|
121
|
+
if (keyboardActiveIndex === null) {
|
|
122
|
+
if (e.key === " " || e.key === "Enter") {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
setKeyboardActiveIndex(index);
|
|
125
|
+
}
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (e.key === "Escape") {
|
|
129
|
+
e.preventDefault();
|
|
130
|
+
setKeyboardActiveIndex(null);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (e.key === " " || e.key === "Enter") {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
setKeyboardActiveIndex(null);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
let nextIdx = keyboardActiveIndex;
|
|
139
|
+
if (e.key === "ArrowDown" || e.key === "ArrowRight") {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
nextIdx = Math.min(items.length - 1, keyboardActiveIndex + 1);
|
|
142
|
+
} else if (e.key === "ArrowUp" || e.key === "ArrowLeft") {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
nextIdx = Math.max(0, keyboardActiveIndex - 1);
|
|
145
|
+
}
|
|
146
|
+
if (nextIdx !== keyboardActiveIndex) {
|
|
147
|
+
const reordered = [...items];
|
|
148
|
+
const [removed] = reordered.splice(keyboardActiveIndex, 1);
|
|
149
|
+
reordered.splice(nextIdx, 0, removed);
|
|
150
|
+
setKeyboardActiveIndex(nextIdx);
|
|
151
|
+
onReorder(reordered);
|
|
152
|
+
}
|
|
153
|
+
}, [
|
|
154
|
+
keyboardActiveIndex,
|
|
155
|
+
items,
|
|
156
|
+
onReorder
|
|
157
|
+
]);
|
|
158
|
+
const contextValue = React$1.useMemo(() => ({
|
|
159
|
+
items,
|
|
160
|
+
activeIndex,
|
|
161
|
+
overIndex,
|
|
162
|
+
keyboardActiveIndex,
|
|
163
|
+
orientation,
|
|
164
|
+
onItemPointerDown: handlePointerDown,
|
|
165
|
+
onItemKeyDown: handleKeyDown,
|
|
166
|
+
onItemRemove: onRemove
|
|
167
|
+
}), [
|
|
168
|
+
items,
|
|
169
|
+
activeIndex,
|
|
170
|
+
overIndex,
|
|
171
|
+
keyboardActiveIndex,
|
|
172
|
+
orientation,
|
|
173
|
+
onRemove,
|
|
174
|
+
handlePointerDown,
|
|
175
|
+
handleKeyDown
|
|
176
|
+
]);
|
|
177
|
+
const activeItemValue = activeIndex !== null ? items[activeIndex] : null;
|
|
178
|
+
const defaultProps = {
|
|
179
|
+
ref: containerRef,
|
|
180
|
+
className: cn(sortableVariants({
|
|
181
|
+
orientation,
|
|
182
|
+
variant,
|
|
183
|
+
className
|
|
184
|
+
})),
|
|
185
|
+
role: "list",
|
|
186
|
+
"data-slot": "sortable",
|
|
187
|
+
children: /* @__PURE__ */ jsxs(SortableContext.Provider, {
|
|
188
|
+
value: contextValue,
|
|
189
|
+
children: [children, activeItemValue && dragOverlayPos && /* @__PURE__ */ jsx("div", {
|
|
190
|
+
className: "fixed pointer-events-none z-50 rounded-lg border border-primary bg-card/95 px-[calc(--spacing(4)-1px)] py-[calc(--spacing(3)-1px)] shadow-xl/20 backdrop-blur-md text-foreground opacity-95 scale-105 transition-none",
|
|
191
|
+
style: {
|
|
192
|
+
left: dragOverlayPos.x - 24,
|
|
193
|
+
top: dragOverlayPos.y - 20
|
|
194
|
+
},
|
|
195
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
196
|
+
className: "flex items-center gap-2 text-xs font-medium",
|
|
197
|
+
children: [/* @__PURE__ */ jsx(GripVertical, { className: "size-4 text-primary shrink-0" }), /* @__PURE__ */ jsx("span", { children: activeItemValue })]
|
|
198
|
+
})
|
|
199
|
+
})]
|
|
200
|
+
})
|
|
201
|
+
};
|
|
202
|
+
return useRender({
|
|
203
|
+
defaultTagName: "div",
|
|
204
|
+
props: mergeProps(defaultProps, props),
|
|
205
|
+
render
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function SortableItem({ className, variant, id, render, children, ...props }) {
|
|
209
|
+
const context = React$1.useContext(SortableContext);
|
|
210
|
+
const index = context ? context.items.indexOf(id) : -1;
|
|
211
|
+
const isDragging = context?.activeIndex === index;
|
|
212
|
+
const isHoveredTarget = context?.overIndex === index && context?.activeIndex !== index;
|
|
213
|
+
const isKeyboardActive = context?.keyboardActiveIndex === index;
|
|
214
|
+
const handleItemPointerDown = React$1.useCallback((e) => {
|
|
215
|
+
if (!context || index < 0) return;
|
|
216
|
+
if (e.target.closest("button, input, textarea, select, a, [data-slot='sortable-handle'], [data-slot='sortable-remove']")) return;
|
|
217
|
+
context.onItemPointerDown(index, e);
|
|
218
|
+
}, [context, index]);
|
|
219
|
+
const defaultProps = {
|
|
220
|
+
tabIndex: 0,
|
|
221
|
+
role: "listitem",
|
|
222
|
+
"aria-label": id,
|
|
223
|
+
className: cn(sortableItemVariants({
|
|
224
|
+
variant,
|
|
225
|
+
isDragging,
|
|
226
|
+
isHoveredTarget,
|
|
227
|
+
isKeyboardActive,
|
|
228
|
+
className
|
|
229
|
+
})),
|
|
230
|
+
onPointerDown: handleItemPointerDown,
|
|
231
|
+
"data-slot": "sortable-item",
|
|
232
|
+
"data-sortable-id": id,
|
|
233
|
+
"data-sortable-index": index,
|
|
234
|
+
"aria-roledescription": "sortable item",
|
|
235
|
+
onKeyDown: (e) => context?.onItemKeyDown(index, e),
|
|
236
|
+
children
|
|
237
|
+
};
|
|
238
|
+
const renderedElement = useRender({
|
|
239
|
+
defaultTagName: "div",
|
|
240
|
+
props: mergeProps(defaultProps, props),
|
|
241
|
+
render
|
|
242
|
+
});
|
|
243
|
+
if (!context) return null;
|
|
244
|
+
return renderedElement;
|
|
245
|
+
}
|
|
246
|
+
function SortableItemHandle({ className, id: _id, render, children, ...props }) {
|
|
247
|
+
const context = React$1.useContext(SortableContext);
|
|
248
|
+
const handlePointerDown = React$1.useCallback((e) => {
|
|
249
|
+
if (!context) return;
|
|
250
|
+
const parentItem = e.currentTarget.closest("[data-sortable-index]");
|
|
251
|
+
if (parentItem) {
|
|
252
|
+
const idx = Number(parentItem.getAttribute("data-sortable-index"));
|
|
253
|
+
if (!Number.isNaN(idx)) context.onItemPointerDown(idx, e);
|
|
254
|
+
}
|
|
255
|
+
}, [context]);
|
|
256
|
+
const defaultProps = {
|
|
257
|
+
className: cn("flex items-center justify-center p-2 text-muted-foreground/60 hover:text-foreground cursor-grab active:cursor-grabbing select-none shrink-0 touch-none pointer-coarse:after:absolute pointer-coarse:after:size-11", className),
|
|
258
|
+
onPointerDown: handlePointerDown,
|
|
259
|
+
"data-slot": "sortable-handle",
|
|
260
|
+
children: children || /* @__PURE__ */ jsx(GripVertical, { className: "size-4 shrink-0" })
|
|
261
|
+
};
|
|
262
|
+
return useRender({
|
|
263
|
+
defaultTagName: "div",
|
|
264
|
+
props: mergeProps(defaultProps, props),
|
|
265
|
+
render
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function SortableItemRemove({ className, id, render, children, ...props }) {
|
|
269
|
+
const context = React$1.useContext(SortableContext);
|
|
270
|
+
const handleClick = React$1.useCallback((e) => {
|
|
271
|
+
e.stopPropagation();
|
|
272
|
+
context?.onItemRemove?.(id);
|
|
273
|
+
}, [context, id]);
|
|
274
|
+
const defaultProps = {
|
|
275
|
+
type: "button",
|
|
276
|
+
"aria-label": `Remove ${id}`,
|
|
277
|
+
className: cn("flex items-center justify-center p-1.5 rounded-md text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-colors shrink-0 pointer-coarse:after:absolute pointer-coarse:after:size-11", className),
|
|
278
|
+
onClick: handleClick,
|
|
279
|
+
"data-slot": "sortable-remove",
|
|
280
|
+
children: children || /* @__PURE__ */ jsx(Cancel, { className: "size-3.5 shrink-0" })
|
|
281
|
+
};
|
|
282
|
+
return useRender({
|
|
283
|
+
defaultTagName: "button",
|
|
284
|
+
props: mergeProps(defaultProps, props),
|
|
285
|
+
render
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function SortableColumn({ className, id, render, children, ...props }) {
|
|
289
|
+
const defaultProps = {
|
|
290
|
+
role: "listitem",
|
|
291
|
+
"aria-label": id,
|
|
292
|
+
className: cn("flex flex-col gap-2.5 w-72 shrink-0 rounded-xl border border-border/60 bg-muted/20 p-3 backdrop-blur-xs shadow-xs/5", className),
|
|
293
|
+
"data-slot": "sortable-column",
|
|
294
|
+
children
|
|
295
|
+
};
|
|
296
|
+
return useRender({
|
|
297
|
+
defaultTagName: "div",
|
|
298
|
+
props: mergeProps(defaultProps, props),
|
|
299
|
+
render
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function SortableColumnHeader({ className, render, children, ...props }) {
|
|
303
|
+
const defaultProps = {
|
|
304
|
+
className: cn("flex items-center justify-between gap-2 px-1 py-0.5 text-xs font-semibold text-foreground select-none", className),
|
|
305
|
+
"data-slot": "sortable-column-header",
|
|
306
|
+
children
|
|
307
|
+
};
|
|
308
|
+
return useRender({
|
|
309
|
+
defaultTagName: "div",
|
|
310
|
+
props: mergeProps(defaultProps, props),
|
|
311
|
+
render
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function SortableColumnTitle({ className, render, children, ...props }) {
|
|
315
|
+
const defaultProps = {
|
|
316
|
+
className: cn("font-medium text-xs text-foreground truncate", className),
|
|
317
|
+
"data-slot": "sortable-column-title",
|
|
318
|
+
children
|
|
319
|
+
};
|
|
320
|
+
return useRender({
|
|
321
|
+
defaultTagName: "span",
|
|
322
|
+
props: mergeProps(defaultProps, props),
|
|
323
|
+
render
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
export { Sortable, SortableColumn, SortableColumnHeader, SortableColumnTitle, SortableItem, SortableItemHandle, SortableItemRemove, sortableItemVariants, sortableVariants };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
4
|
+
//#region src/components/switch.d.ts
|
|
5
|
+
declare const switchVariants: (props?: ({
|
|
6
|
+
size?: "sm" | "md" | "lg" | "xl" | "2xl" | null | undefined;
|
|
7
|
+
variant?: "default" | "expressive" | "sharp" | "classic" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
declare const switchThumbVariants: (props?: ({
|
|
10
|
+
variant?: "default" | "expressive" | "sharp" | "classic" | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
export interface SwitchProps extends Switch$1.Root.Props, VariantProps<typeof switchVariants> {}
|
|
13
|
+
declare function Switch({ className, size, variant, ...props }: SwitchProps): React$1.JSX.Element;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Switch, switchThumbVariants, switchVariants };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
6
|
+
//#region src/components/switch.tsx
|
|
7
|
+
const switchVariants = cva("relative inline-flex shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow,inset-shadow] duration-200 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-checked:not-data-disabled:inset-shadow-[0_1px_--alpha(var(--primary-foreground)/16%)] data-checked:shadow-primary/24 data-checked:shadow-xs data-unchecked:bg-input data-unchecked:inset-shadow-[0_1px_var(--border)] data-disabled:pointer-events-none data-disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11", {
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
sm: "[--thumb-size:--spacing(4)] sm:[--thumb-size:--spacing(3.5)]",
|
|
11
|
+
md: "[--thumb-size:--spacing(5)] sm:[--thumb-size:--spacing(4)]",
|
|
12
|
+
lg: "[--thumb-size:--spacing(6)] sm:[--thumb-size:--spacing(5)]",
|
|
13
|
+
xl: "[--thumb-size:--spacing(7)] sm:[--thumb-size:--spacing(6)]",
|
|
14
|
+
"2xl": "[--thumb-size:--spacing(8)] sm:[--thumb-size:--spacing(7)]"
|
|
15
|
+
},
|
|
16
|
+
variant: {
|
|
17
|
+
default: "h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2.5+2px)]",
|
|
18
|
+
classic: "h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)]",
|
|
19
|
+
expressive: "h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)]",
|
|
20
|
+
sharp: "rounded-md h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)]"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
size: "md",
|
|
25
|
+
variant: "default"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const switchThumbVariants = cva("pointer-events-none relative flex h-full origin-left items-center justify-center rounded-full bg-background shadow-xs border border-black/8 dark:border-white/8 before:pointer-events-none before:absolute before:inset-0 before:rounded-[inherit] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] will-change-transform", {
|
|
29
|
+
variants: { variant: {
|
|
30
|
+
default: "block w-[calc(var(--thumb-size)*1.5)] border-[0.5px] border-black/5 dark:border-white/5 [transition:translate_.15s,scale_.1s_.1s,transform-origin_.15s] in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-125 data-checked:origin-[calc(var(--thumb-size)*1.3)_50%] data-checked:translate-x-[calc(var(--thumb-size))]",
|
|
31
|
+
classic: "block aspect-square in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]",
|
|
32
|
+
expressive: "aspect-square origin-center scale-60 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-75 [transition:translate_.15s,scale_.15s,transform-origin_.15s] data-checked:scale-100 data-checked:translate-x-[calc(var(--thumb-size)-4px)]",
|
|
33
|
+
sharp: "block aspect-square rounded-sm in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-md [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]"
|
|
34
|
+
} },
|
|
35
|
+
defaultVariants: { variant: "default" }
|
|
36
|
+
});
|
|
37
|
+
function Switch({ className, size, variant, ...props }) {
|
|
38
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
39
|
+
className: cn(switchVariants({
|
|
40
|
+
size,
|
|
41
|
+
variant
|
|
42
|
+
}), className),
|
|
43
|
+
"data-slot": "switch",
|
|
44
|
+
...props,
|
|
45
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, {
|
|
46
|
+
className: cn(switchThumbVariants({ variant })),
|
|
47
|
+
"data-slot": "switch-thumb",
|
|
48
|
+
children: variant === "expressive" && /* @__PURE__ */ jsx("svg", {
|
|
49
|
+
className: "size-[calc(var(--thumb-size)*0.75)] text-primary transition-opacity duration-150 opacity-0 in-data-checked:opacity-100",
|
|
50
|
+
fill: "none",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeLinecap: "round",
|
|
53
|
+
strokeLinejoin: "round",
|
|
54
|
+
strokeWidth: "3",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
"data-slot": "switch-icon",
|
|
57
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Switch, switchThumbVariants, switchVariants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/table.d.ts
|
|
3
|
+
declare function Table({ className, ...props }: React$1.ComponentProps<"table">): React$1.JSX.Element;
|
|
4
|
+
declare function TableHeader({ className, ...props }: React$1.ComponentProps<"thead">): React$1.JSX.Element;
|
|
5
|
+
declare function TableBody({ className, ...props }: React$1.ComponentProps<"tbody">): React$1.JSX.Element;
|
|
6
|
+
declare function TableFooter({ className, ...props }: React$1.ComponentProps<"tfoot">): React$1.JSX.Element;
|
|
7
|
+
declare function TableRow({ className, ...props }: React$1.ComponentProps<"tr">): React$1.JSX.Element;
|
|
8
|
+
declare function TableHead({ className, ...props }: React$1.ComponentProps<"th">): React$1.JSX.Element;
|
|
9
|
+
declare function TableCell({ className, ...props }: React$1.ComponentProps<"td">): React$1.JSX.Element;
|
|
10
|
+
declare function TableCaption({ className, ...props }: React$1.ComponentProps<"caption">): React$1.JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/table.tsx
|
|
4
|
+
function Table({ className, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: "relative w-full overflow-x-auto",
|
|
7
|
+
"data-slot": "table-container",
|
|
8
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
9
|
+
className: cn("w-full caption-bottom in-data-[slot=frame]:border-separate in-data-[slot=frame]:border-spacing-0 text-sm", className),
|
|
10
|
+
"data-slot": "table",
|
|
11
|
+
...props
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function TableHeader({ className, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
17
|
+
className: cn("[&_tr]:border-b in-data-[slot=frame]:**:[th]:h-9 in-data-[slot=frame]:*:[tr]:border-none in-data-[slot=frame]:*:[tr]:hover:bg-transparent", className),
|
|
18
|
+
"data-slot": "table-header",
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function TableBody({ className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
24
|
+
className: cn("relative in-data-[slot=frame]:rounded-xl in-data-[slot=frame]:shadow-xs/5 before:pointer-events-none before:absolute before:inset-px not-in-data-[slot=frame]:before:hidden before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/8%)] [&_tr:last-child]:border-0 in-data-[slot=frame]:*:[tr]:border-0 in-data-[slot=frame]:*:[tr]:*:[td]:border-b in-data-[slot=frame]:*:[tr]:*:[td]:bg-background in-data-[slot=frame]:*:[tr]:*:[td]:bg-clip-padding in-data-[slot=frame]:*:[tr]:first:*:[td]:first:rounded-ss-xl in-data-[slot=frame]:*:[tr]:*:[td]:first:border-s in-data-[slot=frame]:*:[tr]:first:*:[td]:border-t in-data-[slot=frame]:*:[tr]:last:*:[td]:last:rounded-ee-xl in-data-[slot=frame]:*:[tr]:*:[td]:last:border-e in-data-[slot=frame]:*:[tr]:first:*:[td]:last:rounded-se-xl in-data-[slot=frame]:*:[tr]:last:*:[td]:first:rounded-es-xl in-data-[slot=frame]:*:[tr]:hover:*:[td]:bg-transparent in-data-[slot=frame]:*:[tr]:data-[state=selected]:*:[td]:bg-muted/72", className),
|
|
25
|
+
"data-slot": "table-body",
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function TableFooter({ className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
31
|
+
className: cn("border-t in-data-[slot=frame]:border-none bg-muted/72 in-data-[slot=frame]:bg-transparent font-medium [&>tr]:last:border-b-0 in-data-[slot=frame]:*:[tr]:hover:bg-transparent", className),
|
|
32
|
+
"data-slot": "table-footer",
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function TableRow({ className, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
38
|
+
className: cn("border-b transition-colors hover:bg-muted/72 in-data-[slot=frame]:hover:bg-transparent data-[state=selected]:bg-muted/72 in-data-[slot=frame]:data-[state=selected]:bg-transparent", className),
|
|
39
|
+
"data-slot": "table-row",
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function TableHead({ className, ...props }) {
|
|
44
|
+
return /* @__PURE__ */ jsx("th", {
|
|
45
|
+
className: cn("h-10 whitespace-nowrap px-2.5 text-left align-middle font-medium text-muted-foreground leading-none has-[[role=checkbox]]:w-px has-[[role=checkbox]]:pe-0", className),
|
|
46
|
+
"data-slot": "table-head",
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function TableCell({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx("td", {
|
|
52
|
+
className: cn("whitespace-nowrap p-2.5 align-middle leading-none in-data-[slot=frame]:first:p-[calc(--spacing(2.5)-1px)] in-data-[slot=frame]:last:p-[calc(--spacing(2.5)-1px)] has-[[role=checkbox]]:pe-0", className),
|
|
53
|
+
"data-slot": "table-cell",
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function TableCaption({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
59
|
+
className: cn("in-data-[slot=frame]:my-4 mt-4 text-muted-foreground text-sm", className),
|
|
60
|
+
"data-slot": "table-caption",
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
3
|
+
//#region src/components/tabs.d.ts
|
|
4
|
+
type TabsVariant = "default" | "underline";
|
|
5
|
+
declare function Tabs({ className, ...props }: Tabs$1.Root.Props): React$1.JSX.Element;
|
|
6
|
+
declare function TabsList({ variant, className, children, ...props }: Tabs$1.List.Props & {
|
|
7
|
+
variant?: TabsVariant;
|
|
8
|
+
}): React$1.JSX.Element;
|
|
9
|
+
declare function TabsTab({ className, ...props }: Tabs$1.Tab.Props): React$1.JSX.Element;
|
|
10
|
+
declare function TabsPanel({ className, ...props }: Tabs$1.Panel.Props): React$1.JSX.Element;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Tabs, TabsPanel as TabsContent, TabsPanel, TabsList, TabsTab, TabsTab as TabsTrigger };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
5
|
+
//#region src/components/tabs.tsx
|
|
6
|
+
function Tabs({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
8
|
+
className: cn("flex flex-col gap-2 data-[orientation=vertical]:flex-row", className),
|
|
9
|
+
"data-slot": "tabs",
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function TabsList({ variant = "default", className, children, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsxs(Tabs$1.List, {
|
|
15
|
+
className: cn("relative z-0 flex w-fit items-center justify-center gap-x-0.5 text-muted-foreground", "data-[orientation=vertical]:flex-col", variant === "default" ? "rounded-lg bg-muted p-0.5 text-muted-foreground/72" : "data-[orientation=vertical]:px-1 data-[orientation=horizontal]:py-1 *:data-[slot=tabs-tab]:hover:bg-accent", className),
|
|
16
|
+
"data-slot": "tabs-list",
|
|
17
|
+
...props,
|
|
18
|
+
children: [children, /* @__PURE__ */ jsx(Tabs$1.Indicator, {
|
|
19
|
+
className: cn("-translate-y-(--active-tab-bottom) absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) transition-[width,translate] duration-200 ease-in-out", variant === "underline" ? "data-[orientation=vertical]:-translate-x-px z-10 bg-primary data-[orientation=horizontal]:h-0.5 data-[orientation=vertical]:w-0.5 data-[orientation=horizontal]:translate-y-px" : "-z-1 rounded-md bg-background shadow-sm/5 dark:bg-input"),
|
|
20
|
+
"data-slot": "tab-indicator"
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function TabsTab({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Tabs$1.Tab, {
|
|
26
|
+
className: cn("[&_svg]:-mx-0.5 relative flex h-9 shrink-0 grow cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-[calc(--spacing(2.5)-1px)] font-medium text-base outline-none transition-[color,background-color,box-shadow] hover:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring data-disabled:pointer-events-none data-[orientation=vertical]:w-full data-[orientation=vertical]:justify-start data-active:text-foreground data-disabled:opacity-64 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 sm:h-8 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
27
|
+
"data-slot": "tabs-tab",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function TabsPanel({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Tabs$1.Panel, {
|
|
33
|
+
className: cn("flex-1 outline-none", className),
|
|
34
|
+
"data-slot": "tabs-content",
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { Tabs, TabsPanel as TabsContent, TabsPanel, TabsList, TabsTab, TabsTab as TabsTrigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
//#region src/components/text.d.ts
|
|
5
|
+
declare const textVariants: (props?: ({
|
|
6
|
+
variant?: "error" | "info" | "secondary" | "success" | "warning" | "body" | "heading1" | "heading2" | "heading3" | "heading4" | "mono" | "mono-secondary" | null | undefined;
|
|
7
|
+
size?: "sm" | "lg" | "xs" | "xl" | "default" | "none" | null | undefined;
|
|
8
|
+
weight?: "normal" | "medium" | "semibold" | "bold" | null | undefined;
|
|
9
|
+
truncate?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
export interface TextProps extends useRender.ComponentProps<"p">, VariantProps<typeof textVariants> {}
|
|
12
|
+
declare function Text({ className, variant, size, weight, truncate, render, ...props }: TextProps): React$1.ReactElement;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Text, textVariants };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
|
+
//#region src/components/text.tsx
|
|
7
|
+
const textVariants = cva("", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
heading1: "text-3xl font-semibold tracking-tight",
|
|
11
|
+
heading2: "text-2xl font-semibold tracking-tight",
|
|
12
|
+
heading3: "text-xl font-semibold tracking-tight",
|
|
13
|
+
heading4: "text-lg font-semibold tracking-tight",
|
|
14
|
+
body: "text-foreground",
|
|
15
|
+
secondary: "text-muted-foreground",
|
|
16
|
+
success: "text-success-foreground",
|
|
17
|
+
error: "text-destructive-foreground",
|
|
18
|
+
warning: "text-warning-foreground",
|
|
19
|
+
info: "text-info-foreground",
|
|
20
|
+
mono: "font-mono text-foreground",
|
|
21
|
+
"mono-secondary": "font-mono text-muted-foreground"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
xs: "text-xs",
|
|
25
|
+
sm: "text-sm sm:text-xs",
|
|
26
|
+
default: "text-base sm:text-sm",
|
|
27
|
+
lg: "text-lg sm:text-base",
|
|
28
|
+
xl: "text-xl sm:text-lg",
|
|
29
|
+
none: ""
|
|
30
|
+
},
|
|
31
|
+
weight: {
|
|
32
|
+
normal: "font-normal",
|
|
33
|
+
medium: "font-medium",
|
|
34
|
+
semibold: "font-semibold",
|
|
35
|
+
bold: "font-bold"
|
|
36
|
+
},
|
|
37
|
+
truncate: { true: "truncate min-w-0" }
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "body",
|
|
41
|
+
size: "default"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
function Text({ className, variant, size, weight, truncate, render, ...props }) {
|
|
45
|
+
let defaultTagName = "p";
|
|
46
|
+
if (variant === "heading1") defaultTagName = "h1";
|
|
47
|
+
else if (variant === "heading2") defaultTagName = "h2";
|
|
48
|
+
else if (variant === "heading3") defaultTagName = "h3";
|
|
49
|
+
else if (variant === "heading4") defaultTagName = "h4";
|
|
50
|
+
else if (variant === "mono" || variant === "mono-secondary") defaultTagName = "span";
|
|
51
|
+
const effectiveSize = variant?.startsWith("heading") && !size ? "none" : size;
|
|
52
|
+
const defaultProps = {
|
|
53
|
+
className: cn(textVariants({
|
|
54
|
+
variant,
|
|
55
|
+
size: effectiveSize,
|
|
56
|
+
weight,
|
|
57
|
+
truncate,
|
|
58
|
+
className
|
|
59
|
+
})),
|
|
60
|
+
"data-slot": "text"
|
|
61
|
+
};
|
|
62
|
+
return useRender({
|
|
63
|
+
defaultTagName,
|
|
64
|
+
props: mergeProps(defaultProps, props),
|
|
65
|
+
render
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { Text, textVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/textarea.d.ts
|
|
3
|
+
type TextareaProps = React$1.ComponentProps<"textarea"> & {
|
|
4
|
+
size?: "sm" | "default" | "lg" | number;
|
|
5
|
+
unstyled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare function Textarea({ className, size, unstyled, ...props }: TextareaProps): React$1.JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Textarea, type TextareaProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
5
|
+
import { Field } from "@base-ui/react/field";
|
|
6
|
+
//#region src/components/textarea.tsx
|
|
7
|
+
function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx("span", {
|
|
9
|
+
className: cn(!unstyled && "relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]", className) || void 0,
|
|
10
|
+
"data-size": size,
|
|
11
|
+
"data-slot": "textarea-control",
|
|
12
|
+
children: /* @__PURE__ */ jsx(Field.Control, { render: (defaultProps) => /* @__PURE__ */ jsx("textarea", {
|
|
13
|
+
className: cn("field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5", size === "sm" && "min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5", size === "lg" && "min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5"),
|
|
14
|
+
"data-slot": "textarea",
|
|
15
|
+
...mergeProps(defaultProps, props)
|
|
16
|
+
}) })
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Textarea };
|