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,27 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/components/ruler-picker.d.ts
|
|
4
|
+
export declare const rulerPickerVariants: (props?: ({
|
|
5
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export declare const labelVariants: (props?: ({
|
|
8
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export declare const tickContainerVariants: (props?: ({
|
|
11
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
+
export declare const majorTickVariants: (props?: ({
|
|
14
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
16
|
+
export interface RulerPickerProps extends Omit<React$1.ComponentPropsWithRef<"div">, "onChange" | "value" | "defaultValue">, VariantProps<typeof rulerPickerVariants> {
|
|
17
|
+
min?: number;
|
|
18
|
+
max?: number;
|
|
19
|
+
value?: number;
|
|
20
|
+
defaultValue?: number;
|
|
21
|
+
onChange?: (value: number) => void;
|
|
22
|
+
itemWidth?: number;
|
|
23
|
+
subDivisions?: number;
|
|
24
|
+
}
|
|
25
|
+
declare function RulerPicker({ className, min, max, value, defaultValue, onChange, itemWidth, subDivisions, size, ref, ...props }: RulerPickerProps): React$1.JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { RulerPicker };
|
|
@@ -0,0 +1,253 @@
|
|
|
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
|
+
//#region src/components/ruler-picker.tsx
|
|
7
|
+
const rulerPickerVariants = cva("relative overflow-hidden bg-background border border-border/80 shadow-xs/5 select-none focus-within:ring-2 focus-within:ring-ring/30 focus-within:ring-offset-1 focus-within:ring-offset-background before:absolute before:inset-0 before:pointer-events-none before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)] not-dark:bg-clip-padding", {
|
|
8
|
+
variants: { size: {
|
|
9
|
+
sm: "h-14 rounded-xl before:rounded-[calc(var(--radius-xl)-1px)] w-full",
|
|
10
|
+
md: "h-16 rounded-2xl before:rounded-[calc(var(--radius-2xl)-1px)] w-full",
|
|
11
|
+
lg: "h-20 rounded-2xl before:rounded-[calc(var(--radius-2xl)-1px)] w-full"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { size: "md" }
|
|
14
|
+
});
|
|
15
|
+
const labelVariants = cva("relative z-20 text-foreground font-semibold tabular-nums select-none origin-bottom transition-colors duration-200", {
|
|
16
|
+
variants: { size: {
|
|
17
|
+
sm: "text-[10px] mb-0.5",
|
|
18
|
+
md: "text-xs mb-0.5",
|
|
19
|
+
lg: "text-sm mb-1"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { size: "md" }
|
|
22
|
+
});
|
|
23
|
+
const tickContainerVariants = cva("relative flex w-full items-end justify-center", {
|
|
24
|
+
variants: { size: {
|
|
25
|
+
sm: "h-3.5 mt-0.5",
|
|
26
|
+
md: "h-4 mt-0.5",
|
|
27
|
+
lg: "h-5 mt-1"
|
|
28
|
+
} },
|
|
29
|
+
defaultVariants: { size: "md" }
|
|
30
|
+
});
|
|
31
|
+
const majorTickVariants = cva("w-[2px] rounded-t-full bg-muted-foreground/60", {
|
|
32
|
+
variants: { size: {
|
|
33
|
+
sm: "h-3",
|
|
34
|
+
md: "h-4",
|
|
35
|
+
lg: "h-5"
|
|
36
|
+
} },
|
|
37
|
+
defaultVariants: { size: "md" }
|
|
38
|
+
});
|
|
39
|
+
function RulerPicker({ className, min = 0, max = 100, value, defaultValue, onChange, itemWidth = 80, subDivisions = 4, size = "md", ref, ...props }) {
|
|
40
|
+
const rootRef = React$1.useRef(null);
|
|
41
|
+
const scrollContainerRef = React$1.useRef(null);
|
|
42
|
+
const isMountedRef = React$1.useRef(false);
|
|
43
|
+
const itemWidthRef = React$1.useRef(itemWidth);
|
|
44
|
+
React$1.useEffect(() => {
|
|
45
|
+
itemWidthRef.current = itemWidth;
|
|
46
|
+
}, [itemWidth]);
|
|
47
|
+
const internalValueRef = React$1.useRef(null);
|
|
48
|
+
const [activeValue, setActiveValue] = React$1.useState(value !== void 0 ? value : defaultValue !== void 0 ? defaultValue : min);
|
|
49
|
+
React$1.useImperativeHandle(ref, () => rootRef.current);
|
|
50
|
+
const updateStyles = React$1.useCallback((container) => {
|
|
51
|
+
const scrollLeft = container.scrollLeft;
|
|
52
|
+
const children = container.children;
|
|
53
|
+
const length = children.length;
|
|
54
|
+
const closestVal = min + Math.max(0, Math.min(length - 1, Math.round(scrollLeft / itemWidth)));
|
|
55
|
+
for (let i = 0; i < length; i++) {
|
|
56
|
+
const itemEl = children[i];
|
|
57
|
+
if (!itemEl) continue;
|
|
58
|
+
const distance = Math.abs(i * itemWidth - scrollLeft);
|
|
59
|
+
const maxDistance = itemWidth * 1.2;
|
|
60
|
+
const pct = Math.min(1, distance / maxDistance);
|
|
61
|
+
const opacity = 1 - pct * .7;
|
|
62
|
+
const scale = 1.1 - pct * .2;
|
|
63
|
+
const label = itemEl.firstElementChild;
|
|
64
|
+
if (label && label.getAttribute("data-slot") === "ruler-picker-label") {
|
|
65
|
+
label.style.opacity = opacity.toString();
|
|
66
|
+
label.style.transform = `scale(${scale})`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return closestVal;
|
|
70
|
+
}, [min, itemWidth]);
|
|
71
|
+
const onScroll = React$1.useCallback((e) => {
|
|
72
|
+
const container = e.currentTarget;
|
|
73
|
+
const closestVal = updateStyles(container);
|
|
74
|
+
if (closestVal !== internalValueRef.current) {
|
|
75
|
+
internalValueRef.current = closestVal;
|
|
76
|
+
setActiveValue(closestVal);
|
|
77
|
+
onChange?.(closestVal);
|
|
78
|
+
}
|
|
79
|
+
}, [updateStyles, onChange]);
|
|
80
|
+
React$1.useEffect(() => {
|
|
81
|
+
const container = scrollContainerRef.current;
|
|
82
|
+
if (!container || value === void 0) return;
|
|
83
|
+
const targetScrollLeft = (value - min) * itemWidth;
|
|
84
|
+
if (Math.round(container.scrollLeft / itemWidth) + min !== value) {
|
|
85
|
+
container.scrollTo({
|
|
86
|
+
left: targetScrollLeft,
|
|
87
|
+
behavior: isMountedRef.current ? "smooth" : "instant"
|
|
88
|
+
});
|
|
89
|
+
updateStyles(container);
|
|
90
|
+
}
|
|
91
|
+
}, [
|
|
92
|
+
value,
|
|
93
|
+
min,
|
|
94
|
+
itemWidth,
|
|
95
|
+
updateStyles
|
|
96
|
+
]);
|
|
97
|
+
React$1.useEffect(() => {
|
|
98
|
+
const container = scrollContainerRef.current;
|
|
99
|
+
if (!container) return;
|
|
100
|
+
container.scrollLeft = ((value !== void 0 ? value : defaultValue !== void 0 ? defaultValue : min) - min) * itemWidth;
|
|
101
|
+
updateStyles(container);
|
|
102
|
+
isMountedRef.current = true;
|
|
103
|
+
}, [
|
|
104
|
+
min,
|
|
105
|
+
itemWidth,
|
|
106
|
+
value,
|
|
107
|
+
defaultValue,
|
|
108
|
+
updateStyles
|
|
109
|
+
]);
|
|
110
|
+
React$1.useEffect(() => {
|
|
111
|
+
const container = scrollContainerRef.current;
|
|
112
|
+
if (!container) return;
|
|
113
|
+
let snapTimeout = null;
|
|
114
|
+
const handleWheel = (e) => {
|
|
115
|
+
const scrollAmount = e.deltaY || e.deltaX;
|
|
116
|
+
if (scrollAmount !== 0) {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
container.classList.remove("scroll-smooth");
|
|
119
|
+
container.scrollLeft += scrollAmount * .8;
|
|
120
|
+
if (snapTimeout) clearTimeout(snapTimeout);
|
|
121
|
+
snapTimeout = setTimeout(() => {
|
|
122
|
+
container.classList.add("scroll-smooth");
|
|
123
|
+
const closestIndex = Math.round(container.scrollLeft / itemWidthRef.current);
|
|
124
|
+
container.scrollTo({
|
|
125
|
+
left: closestIndex * itemWidthRef.current,
|
|
126
|
+
behavior: "smooth"
|
|
127
|
+
});
|
|
128
|
+
}, 150);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
container.addEventListener("wheel", handleWheel, { passive: false });
|
|
132
|
+
return () => {
|
|
133
|
+
container.removeEventListener("wheel", handleWheel);
|
|
134
|
+
if (snapTimeout) clearTimeout(snapTimeout);
|
|
135
|
+
};
|
|
136
|
+
}, []);
|
|
137
|
+
const onMouseDown = (e) => {
|
|
138
|
+
const container = scrollContainerRef.current;
|
|
139
|
+
if (!container) return;
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
container.classList.remove("scroll-smooth", "snap-x", "snap-mandatory");
|
|
142
|
+
const startX = e.pageX - container.offsetLeft;
|
|
143
|
+
const startScrollLeft = container.scrollLeft;
|
|
144
|
+
let isMoving = false;
|
|
145
|
+
const onMouseMove = (moveEvent) => {
|
|
146
|
+
isMoving = true;
|
|
147
|
+
document.body.style.cursor = "grabbing";
|
|
148
|
+
const walk = (moveEvent.pageX - container.offsetLeft - startX) * 1.5;
|
|
149
|
+
container.scrollLeft = startScrollLeft - walk;
|
|
150
|
+
};
|
|
151
|
+
const onMouseUp = () => {
|
|
152
|
+
document.body.style.cursor = "";
|
|
153
|
+
container.classList.add("scroll-smooth", "snap-x", "snap-mandatory");
|
|
154
|
+
if (isMoving) {
|
|
155
|
+
const scrollLeft = container.scrollLeft;
|
|
156
|
+
const closestValue = Math.round(scrollLeft / itemWidth) * itemWidth;
|
|
157
|
+
container.scrollTo({
|
|
158
|
+
left: closestValue,
|
|
159
|
+
behavior: "smooth"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
163
|
+
window.removeEventListener("mouseup", onMouseUp);
|
|
164
|
+
};
|
|
165
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
166
|
+
window.addEventListener("mouseup", onMouseUp);
|
|
167
|
+
};
|
|
168
|
+
const onKeyDown = (e) => {
|
|
169
|
+
const container = scrollContainerRef.current;
|
|
170
|
+
if (!container) return;
|
|
171
|
+
if (e.key === "ArrowRight") {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
const currentSnapped = Math.round(container.scrollLeft / itemWidth);
|
|
174
|
+
const nextSnapped = Math.min(max - min, currentSnapped + 1);
|
|
175
|
+
container.scrollTo({
|
|
176
|
+
left: nextSnapped * itemWidth,
|
|
177
|
+
behavior: "smooth"
|
|
178
|
+
});
|
|
179
|
+
} else if (e.key === "ArrowLeft") {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
const currentSnapped = Math.round(container.scrollLeft / itemWidth);
|
|
182
|
+
const prevSnapped = Math.max(0, currentSnapped - 1);
|
|
183
|
+
container.scrollTo({
|
|
184
|
+
left: prevSnapped * itemWidth,
|
|
185
|
+
behavior: "smooth"
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const range = max - min;
|
|
190
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
191
|
+
ref: rootRef,
|
|
192
|
+
className: cn(rulerPickerVariants({ size }), className),
|
|
193
|
+
onMouseDown,
|
|
194
|
+
onKeyDown,
|
|
195
|
+
tabIndex: 0,
|
|
196
|
+
"aria-label": "Ruler Picker",
|
|
197
|
+
"aria-valuemin": min,
|
|
198
|
+
"aria-valuemax": max,
|
|
199
|
+
"aria-valuenow": activeValue,
|
|
200
|
+
role: "slider",
|
|
201
|
+
"data-slot": "ruler-picker",
|
|
202
|
+
...props,
|
|
203
|
+
children: [
|
|
204
|
+
/* @__PURE__ */ jsxs("div", {
|
|
205
|
+
className: "pointer-events-none absolute inset-y-0 left-1/2 z-10 flex -translate-x-1/2 flex-col items-center",
|
|
206
|
+
"data-slot": "ruler-picker-indicator",
|
|
207
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
208
|
+
className: cn("bg-primary shadow-xs/5 rounded-b-xs", size === "sm" ? "h-2 w-3.5" : size === "lg" ? "h-3.5 w-6" : "h-2.5 w-4.5"),
|
|
209
|
+
style: { clipPath: "polygon(0 0, 100% 0, 70% 100%, 30% 100%)" }
|
|
210
|
+
}), /* @__PURE__ */ jsx("div", { className: cn("w-[1.5px] grow bg-primary", size === "sm" && "w-px", size === "lg" && "w-[2px]") })]
|
|
211
|
+
}),
|
|
212
|
+
/* @__PURE__ */ jsx("div", {
|
|
213
|
+
ref: scrollContainerRef,
|
|
214
|
+
onScroll,
|
|
215
|
+
className: cn("h-full w-full overflow-x-auto flex items-end snap-x snap-mandatory scroll-smooth scrollbar-none cursor-grab active:cursor-grabbing", size === "lg" ? "pb-2" : "pb-1.5"),
|
|
216
|
+
style: {
|
|
217
|
+
paddingLeft: `calc(50% - ${itemWidth / 2}px)`,
|
|
218
|
+
paddingRight: `calc(50% - ${itemWidth / 2}px)`
|
|
219
|
+
},
|
|
220
|
+
"data-slot": "ruler-picker-track",
|
|
221
|
+
children: Array.from({ length: range + 1 }, (_, index) => {
|
|
222
|
+
const val = min + index;
|
|
223
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
224
|
+
className: "flex flex-col justify-end items-center h-full shrink-0 relative",
|
|
225
|
+
style: { width: itemWidth },
|
|
226
|
+
"data-slot": "ruler-picker-item",
|
|
227
|
+
"data-value": val,
|
|
228
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
229
|
+
className: labelVariants({ size }),
|
|
230
|
+
"data-slot": "ruler-picker-label",
|
|
231
|
+
children: val
|
|
232
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
233
|
+
className: tickContainerVariants({ size }),
|
|
234
|
+
"data-slot": "ruler-picker-ticks",
|
|
235
|
+
children: [/* @__PURE__ */ jsx("div", { className: majorTickVariants({ size }) }), val !== max && Array.from({ length: subDivisions }).map((_subdivision, idx) => {
|
|
236
|
+
const stepPercent = (idx + 1) / (subDivisions + 1) * 100;
|
|
237
|
+
const isMedium = subDivisions === 9 && idx === 4;
|
|
238
|
+
return /* @__PURE__ */ jsx("div", {
|
|
239
|
+
className: cn("absolute bottom-0 -translate-x-1/2 w-[1.2px] rounded-t-full bg-muted-foreground/30", size === "sm" ? isMedium ? "h-2 bg-muted-foreground/45" : "h-1.5" : size === "lg" ? isMedium ? "h-4 bg-muted-foreground/45" : "h-3" : isMedium ? "h-3 bg-muted-foreground/45" : "h-2"),
|
|
240
|
+
style: { left: `calc(50% + ${stepPercent}%)` }
|
|
241
|
+
}, idx);
|
|
242
|
+
})]
|
|
243
|
+
})]
|
|
244
|
+
}, val);
|
|
245
|
+
})
|
|
246
|
+
}),
|
|
247
|
+
/* @__PURE__ */ jsx("div", { className: cn("from-background via-background/50 pointer-events-none absolute inset-y-0 left-0 z-30 bg-linear-to-r to-transparent", size === "sm" ? "w-12" : size === "lg" ? "w-20" : "w-16") }),
|
|
248
|
+
/* @__PURE__ */ jsx("div", { className: cn("from-background via-background/50 pointer-events-none absolute inset-y-0 right-0 z-30 bg-linear-to-l to-transparent", size === "sm" ? "w-12" : size === "lg" ? "w-20" : "w-16") })
|
|
249
|
+
]
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
export { RulerPicker, labelVariants, majorTickVariants, rulerPickerVariants, tickContainerVariants };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ScrollBar, ScrollBarProps } from "./scroll-bar.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
4
|
+
//#region src/components/scroll-area.d.ts
|
|
5
|
+
declare function ScrollArea({ className, children, scrollFade, scrollbarGutter, scrollbarSize, scrollbarVariant, scrollbarVisibility, ...props }: ScrollArea$1.Root.Props & {
|
|
6
|
+
scrollFade?: boolean;
|
|
7
|
+
scrollbarGutter?: boolean;
|
|
8
|
+
scrollbarSize?: ScrollBarProps["size"];
|
|
9
|
+
scrollbarVariant?: ScrollBarProps["variant"];
|
|
10
|
+
scrollbarVisibility?: ScrollBarProps["visibility"];
|
|
11
|
+
}): React$1.JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ScrollBar } from "./scroll-bar.js";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
6
|
+
//#region src/components/scroll-area.tsx
|
|
7
|
+
function ScrollArea({ className, children, scrollFade = false, scrollbarGutter = false, scrollbarSize = "sm", scrollbarVariant = "default", scrollbarVisibility = "auto", ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs(ScrollArea$1.Root, {
|
|
9
|
+
className: cn("size-full min-h-0", className),
|
|
10
|
+
...props,
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
|
|
13
|
+
className: cn("h-full overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-has-overflow-x:overscroll-x-contain", scrollFade && "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]", scrollbarGutter && "data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5"),
|
|
14
|
+
"data-slot": "scroll-area-viewport",
|
|
15
|
+
children
|
|
16
|
+
}),
|
|
17
|
+
/* @__PURE__ */ jsx(ScrollBar, {
|
|
18
|
+
orientation: "vertical",
|
|
19
|
+
size: scrollbarSize,
|
|
20
|
+
variant: scrollbarVariant,
|
|
21
|
+
visibility: scrollbarVisibility
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ jsx(ScrollBar, {
|
|
24
|
+
orientation: "horizontal",
|
|
25
|
+
size: scrollbarSize,
|
|
26
|
+
variant: scrollbarVariant,
|
|
27
|
+
visibility: scrollbarVisibility
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Corner, { "data-slot": "scroll-area-corner" })
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { ScrollArea } from "@base-ui/react/scroll-area";
|
|
4
|
+
//#region src/components/scroll-bar.d.ts
|
|
5
|
+
declare const scrollBarVariants: (props?: ({
|
|
6
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
7
|
+
variant?: "default" | "card" | null | undefined;
|
|
8
|
+
visibility?: "auto" | "always" | "hover" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export interface ScrollBarProps extends ScrollArea.Scrollbar.Props, VariantProps<typeof scrollBarVariants> {}
|
|
11
|
+
declare function ScrollBar({ className, orientation, size, variant, visibility, ...props }: ScrollBarProps): React$1.JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ScrollBar, scrollBarVariants };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { ScrollArea } from "@base-ui/react/scroll-area";
|
|
6
|
+
//#region src/components/scroll-bar.tsx
|
|
7
|
+
const scrollBarVariants = cva("m-1 flex select-none touch-none transition-[opacity,width,height] duration-200 ease-out opacity-0 z-50", {
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
sm: "data-[orientation=horizontal]:h-1 data-[orientation=vertical]:w-1 data-hovering:data-[orientation=horizontal]:h-1.5 data-hovering:data-[orientation=vertical]:w-1.5 data-scrolling:data-[orientation=horizontal]:h-1.5 data-scrolling:data-[orientation=vertical]:w-1.5",
|
|
11
|
+
md: "data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-hovering:data-[orientation=horizontal]:h-2.5 data-hovering:data-[orientation=vertical]:w-2.5 data-scrolling:data-[orientation=horizontal]:h-2.5 data-scrolling:data-[orientation=vertical]:w-2.5",
|
|
12
|
+
lg: "data-[orientation=horizontal]:h-2.5 data-[orientation=vertical]:w-2.5 data-hovering:data-[orientation=horizontal]:h-3.5 data-hovering:data-[orientation=vertical]:w-3.5 data-scrolling:data-[orientation=horizontal]:h-3.5 data-scrolling:data-[orientation=vertical]:w-3.5"
|
|
13
|
+
},
|
|
14
|
+
variant: {
|
|
15
|
+
default: "bg-transparent",
|
|
16
|
+
card: "bg-muted/30 border border-border/40 rounded-full"
|
|
17
|
+
},
|
|
18
|
+
visibility: {
|
|
19
|
+
auto: "delay-300 data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
|
|
20
|
+
always: "opacity-100",
|
|
21
|
+
hover: "data-hovering:opacity-100 data-hovering:delay-0 data-hovering:duration-100"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
size: "sm",
|
|
26
|
+
variant: "default",
|
|
27
|
+
visibility: "auto"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function ScrollBar({ className, orientation = "vertical", size, variant, visibility, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsx(ScrollArea.Scrollbar, {
|
|
32
|
+
className: cn(scrollBarVariants({
|
|
33
|
+
size,
|
|
34
|
+
variant,
|
|
35
|
+
visibility
|
|
36
|
+
}), className),
|
|
37
|
+
"data-slot": "scroll-bar",
|
|
38
|
+
orientation,
|
|
39
|
+
...props,
|
|
40
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Thumb, {
|
|
41
|
+
className: cn("relative flex-1 rounded-full bg-foreground/20 transition-[background-color,transform] duration-150 ease-out cursor-grab active:cursor-grabbing hover:bg-foreground/35 active:bg-foreground/50", "after:absolute after:inset-0 in-[[data-slot=scroll-bar][data-orientation=vertical]]:after:-inset-x-2.5 in-[[data-slot=scroll-bar][data-orientation=horizontal]]:after:-inset-y-2.5 pointer-coarse:in-[[data-slot=scroll-bar][data-orientation=vertical]]:after:-inset-x-4 pointer-coarse:in-[[data-slot=scroll-bar][data-orientation=horizontal]]:after:-inset-y-4"),
|
|
42
|
+
"data-slot": "scroll-bar-thumb"
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { ScrollBar, scrollBarVariants };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
5
|
+
//#region src/components/select.d.ts
|
|
6
|
+
declare const Select: typeof Select$1.Root;
|
|
7
|
+
declare const selectTriggerVariants: (props?: ({
|
|
8
|
+
size?: "sm" | "lg" | "default" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
interface SelectButtonProps extends useRender.ComponentProps<"button"> {
|
|
11
|
+
size?: VariantProps<typeof selectTriggerVariants>["size"];
|
|
12
|
+
}
|
|
13
|
+
declare function SelectButton({ className, size, render, children, ...props }: SelectButtonProps): React$1.ReactElement;
|
|
14
|
+
declare function SelectTrigger({ className, size, children, ...props }: Select$1.Trigger.Props & VariantProps<typeof selectTriggerVariants>): React$1.JSX.Element;
|
|
15
|
+
declare function SelectValue({ className, ...props }: Select$1.Value.Props): React$1.JSX.Element;
|
|
16
|
+
declare function SelectPopup({ className, children, side, sideOffset, align, alignOffset, alignItemWithTrigger, anchor, ...props }: Select$1.Popup.Props & {
|
|
17
|
+
side?: Select$1.Positioner.Props["side"];
|
|
18
|
+
sideOffset?: Select$1.Positioner.Props["sideOffset"];
|
|
19
|
+
align?: Select$1.Positioner.Props["align"];
|
|
20
|
+
alignOffset?: Select$1.Positioner.Props["alignOffset"];
|
|
21
|
+
alignItemWithTrigger?: Select$1.Positioner.Props["alignItemWithTrigger"];
|
|
22
|
+
anchor?: Select$1.Positioner.Props["anchor"];
|
|
23
|
+
}): React$1.JSX.Element;
|
|
24
|
+
declare function SelectItem({ className, children, ...props }: Select$1.Item.Props): React$1.JSX.Element;
|
|
25
|
+
declare function SelectSeparator({ className, ...props }: Select$1.Separator.Props): React$1.JSX.Element;
|
|
26
|
+
declare function SelectGroup(props: Select$1.Group.Props): React$1.JSX.Element;
|
|
27
|
+
declare function SelectGroupLabel(props: Select$1.GroupLabel.Props): React$1.JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Select, SelectButton, SelectPopup as SelectContent, SelectPopup, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { ChevronDown } from "xiod-icons/icons/ChevronDown";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
import { UnfoldMore } from "xiod-icons/icons/UnfoldMore";
|
|
9
|
+
import { Select as Select$1 } from "@base-ui/react/select";
|
|
10
|
+
import { ChevronUp } from "xiod-icons/icons/ChevronUp";
|
|
11
|
+
//#region src/components/select.tsx
|
|
12
|
+
const Select = Select$1.Root;
|
|
13
|
+
const selectTriggerVariants = cva("relative inline-flex min-h-9 w-full min-w-36 select-none items-center justify-between gap-2 rounded-lg border border-input bg-background not-dark:bg-clip-padding px-[calc(--spacing(3)-1px)] text-left text-base text-foreground shadow-xs/5 outline-none ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 focus-visible:border-ring focus-visible:ring-[3px] aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 data-disabled:pointer-events-none data-disabled:opacity-64 sm:min-h-8 sm:text-sm dark:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-focus-visible:not-aria-invalid:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [[data-disabled],:focus-visible,[aria-invalid],[data-pressed]]:shadow-none", {
|
|
14
|
+
defaultVariants: { size: "default" },
|
|
15
|
+
variants: { size: {
|
|
16
|
+
default: "",
|
|
17
|
+
lg: "min-h-10 sm:min-h-9",
|
|
18
|
+
sm: "min-h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:min-h-7"
|
|
19
|
+
} }
|
|
20
|
+
});
|
|
21
|
+
const selectTriggerIconClassName = "-me-1 size-4.5 opacity-80 sm:size-4";
|
|
22
|
+
function SelectButton({ className, size, render, children, ...props }) {
|
|
23
|
+
const typeValue = render ? void 0 : "button";
|
|
24
|
+
const defaultProps = {
|
|
25
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: "flex-1 truncate in-data-placeholder:text-muted-foreground/72",
|
|
27
|
+
children
|
|
28
|
+
}), /* @__PURE__ */ jsx(UnfoldMore, { className: selectTriggerIconClassName })] }),
|
|
29
|
+
className: cn(selectTriggerVariants({ size }), "min-w-0", className),
|
|
30
|
+
"data-slot": "select-button",
|
|
31
|
+
type: typeValue
|
|
32
|
+
};
|
|
33
|
+
return useRender({
|
|
34
|
+
defaultTagName: "button",
|
|
35
|
+
props: mergeProps(defaultProps, props),
|
|
36
|
+
render
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function SelectTrigger({ className, size = "default", children, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsxs(Select$1.Trigger, {
|
|
41
|
+
className: cn(selectTriggerVariants({ size }), className),
|
|
42
|
+
"data-slot": "select-trigger",
|
|
43
|
+
...props,
|
|
44
|
+
children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
|
|
45
|
+
"data-slot": "select-icon",
|
|
46
|
+
children: /* @__PURE__ */ jsx(UnfoldMore, { className: selectTriggerIconClassName })
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function SelectValue({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(Select$1.Value, {
|
|
52
|
+
className: cn("flex-1 truncate data-placeholder:text-muted-foreground", className),
|
|
53
|
+
"data-slot": "select-value",
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function SelectPopup({ className, children, side = "bottom", sideOffset = 4, align = "start", alignOffset = 0, alignItemWithTrigger = true, anchor, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
|
|
59
|
+
align,
|
|
60
|
+
alignItemWithTrigger,
|
|
61
|
+
alignOffset,
|
|
62
|
+
anchor,
|
|
63
|
+
className: "z-50 select-none",
|
|
64
|
+
"data-slot": "select-positioner",
|
|
65
|
+
side,
|
|
66
|
+
sideOffset,
|
|
67
|
+
children: /* @__PURE__ */ jsxs(Select$1.Popup, {
|
|
68
|
+
className: "origin-(--transform-origin) text-foreground transition-[scale,opacity] duration-100 ease-out data-ending-style:scale-97 data-starting-style:scale-97 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
69
|
+
"data-slot": "select-popup",
|
|
70
|
+
...props,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx(Select$1.ScrollUpArrow, {
|
|
73
|
+
className: "top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover",
|
|
74
|
+
"data-slot": "select-scroll-up-arrow",
|
|
75
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { className: "relative size-4.5 sm:size-4" })
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx("div", {
|
|
78
|
+
className: "relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
|
79
|
+
children: /* @__PURE__ */ jsx(Select$1.List, {
|
|
80
|
+
className: cn("max-h-(--available-height) overflow-y-auto p-1", className),
|
|
81
|
+
"data-slot": "select-list",
|
|
82
|
+
children
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx(Select$1.ScrollDownArrow, {
|
|
86
|
+
className: "bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover",
|
|
87
|
+
"data-slot": "select-scroll-down-arrow",
|
|
88
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "relative size-4.5 sm:size-4" })
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
}) });
|
|
93
|
+
}
|
|
94
|
+
function SelectItem({ className, children, ...props }) {
|
|
95
|
+
return /* @__PURE__ */ jsxs(Select$1.Item, {
|
|
96
|
+
className: cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 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),
|
|
97
|
+
"data-slot": "select-item",
|
|
98
|
+
...props,
|
|
99
|
+
children: [/* @__PURE__ */ jsx(Select$1.ItemIndicator, {
|
|
100
|
+
className: "col-start-1",
|
|
101
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
102
|
+
fill: "none",
|
|
103
|
+
height: "24",
|
|
104
|
+
stroke: "currentColor",
|
|
105
|
+
strokeLinecap: "round",
|
|
106
|
+
strokeLinejoin: "round",
|
|
107
|
+
strokeWidth: "2",
|
|
108
|
+
viewBox: "0 0 24 24",
|
|
109
|
+
width: "24",
|
|
110
|
+
xmlns: "http://www.w3.org/1500/svg",
|
|
111
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5.252 12.7 10.2 18.63 18.748 5.37" })
|
|
112
|
+
})
|
|
113
|
+
}), /* @__PURE__ */ jsx(Select$1.ItemText, {
|
|
114
|
+
className: "col-start-2 min-w-0",
|
|
115
|
+
children
|
|
116
|
+
})]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function SelectSeparator({ className, ...props }) {
|
|
120
|
+
return /* @__PURE__ */ jsx(Select$1.Separator, {
|
|
121
|
+
className: cn("mx-2 my-1 h-px bg-border", className),
|
|
122
|
+
"data-slot": "select-separator",
|
|
123
|
+
...props
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function SelectGroup(props) {
|
|
127
|
+
return /* @__PURE__ */ jsx(Select$1.Group, {
|
|
128
|
+
"data-slot": "select-group",
|
|
129
|
+
...props
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function SelectGroupLabel(props) {
|
|
133
|
+
return /* @__PURE__ */ jsx(Select$1.GroupLabel, {
|
|
134
|
+
className: "px-2 py-1.5 font-medium text-muted-foreground text-xs",
|
|
135
|
+
"data-slot": "select-group-label",
|
|
136
|
+
...props
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
export { Select, SelectButton, SelectPopup as SelectContent, SelectPopup, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, SelectValue, selectTriggerVariants };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Separator as Separator$1 } from "@base-ui/react/separator";
|
|
3
|
+
//#region src/components/separator.d.ts
|
|
4
|
+
declare function Separator({ className, orientation, ...props }: Separator$1.Props): React$1.JSX.Element;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Separator };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "cn";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Separator as Separator$1 } from "@base-ui/react/separator";
|
|
5
|
+
//#region src/components/separator.tsx
|
|
6
|
+
function Separator({ className, orientation = "horizontal", ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Separator$1, {
|
|
8
|
+
className: cn("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch", className),
|
|
9
|
+
"data-slot": "separator",
|
|
10
|
+
orientation,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { Separator };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Separator } from "./separator.js";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
import { Input } from "./input.js";
|
|
4
|
+
import { TooltipContent as TooltipPopup } from "./tooltip.js";
|
|
5
|
+
import { VariantProps } from "class-variance-authority";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
8
|
+
//#region src/components/sidebar.d.ts
|
|
9
|
+
type SidebarContextProps = {
|
|
10
|
+
state: "expanded" | "collapsed";
|
|
11
|
+
open: boolean;
|
|
12
|
+
setOpen: (open: boolean) => void;
|
|
13
|
+
openMobile: boolean;
|
|
14
|
+
setOpenMobile: (open: boolean) => void;
|
|
15
|
+
isMobile: boolean;
|
|
16
|
+
toggleSidebar: () => void;
|
|
17
|
+
};
|
|
18
|
+
declare function useSidebar(): SidebarContextProps;
|
|
19
|
+
declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React$1.ComponentProps<"div"> & {
|
|
20
|
+
defaultOpen?: boolean;
|
|
21
|
+
open?: boolean;
|
|
22
|
+
onOpenChange?: (open: boolean) => void;
|
|
23
|
+
}): React$1.JSX.Element;
|
|
24
|
+
declare function Sidebar({ side, variant, collapsible, className, children, ...props }: React$1.ComponentProps<"div"> & {
|
|
25
|
+
side?: "left" | "right";
|
|
26
|
+
variant?: "sidebar" | "floating" | "inset" | "modal";
|
|
27
|
+
collapsible?: "offcanvas" | "icon" | "none";
|
|
28
|
+
}): React$1.JSX.Element;
|
|
29
|
+
declare function SidebarTrigger({ className, onClick, ...props }: React$1.ComponentProps<typeof Button>): React$1.JSX.Element;
|
|
30
|
+
declare function SidebarRail({ className, ...props }: React$1.ComponentProps<"button">): React$1.JSX.Element;
|
|
31
|
+
declare function SidebarInset({ className, ...props }: React$1.ComponentProps<"main">): React$1.JSX.Element;
|
|
32
|
+
declare function SidebarInput({ className, ...props }: React$1.ComponentProps<typeof Input>): React$1.JSX.Element;
|
|
33
|
+
declare function SidebarHeader({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
34
|
+
declare function SidebarFooter({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
35
|
+
declare function SidebarSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): React$1.JSX.Element;
|
|
36
|
+
declare function SidebarContent({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
37
|
+
declare function SidebarGroup({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
38
|
+
declare function SidebarGroupLabel({ className, render, ...props }: useRender.ComponentProps<"div">): React$1.ReactElement;
|
|
39
|
+
declare function SidebarGroupAction({ className, render, ...props }: useRender.ComponentProps<"button">): React$1.ReactElement;
|
|
40
|
+
declare function SidebarGroupContent({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
41
|
+
declare function SidebarMenu({ className, ...props }: React$1.ComponentProps<"ul">): React$1.JSX.Element;
|
|
42
|
+
declare function SidebarMenuItem({ className, ...props }: React$1.ComponentProps<"li">): React$1.JSX.Element;
|
|
43
|
+
export declare const sidebarMenuButtonVariants: (props?: ({
|
|
44
|
+
size?: "sm" | "lg" | "default" | null | undefined;
|
|
45
|
+
variant?: "default" | "outline" | null | undefined;
|
|
46
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
47
|
+
declare function SidebarMenuButton({ isActive, variant, size, tooltip, className, render, ...props }: useRender.ComponentProps<"button"> & {
|
|
48
|
+
isActive?: boolean;
|
|
49
|
+
tooltip?: string | React$1.ComponentProps<typeof TooltipPopup>;
|
|
50
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>): React$1.JSX.Element;
|
|
51
|
+
declare function SidebarMenuAction({ className, showOnHover, render, ...props }: useRender.ComponentProps<"button"> & {
|
|
52
|
+
showOnHover?: boolean;
|
|
53
|
+
}): React$1.ReactElement;
|
|
54
|
+
declare function SidebarMenuBadge({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
55
|
+
declare function SidebarMenuSkeleton({ className, showIcon, ...props }: React$1.ComponentProps<"div"> & {
|
|
56
|
+
showIcon?: boolean;
|
|
57
|
+
}): React$1.JSX.Element;
|
|
58
|
+
declare function SidebarMenuSub({ className, ...props }: React$1.ComponentProps<"ul">): React$1.JSX.Element;
|
|
59
|
+
declare function SidebarMenuSubItem({ className, ...props }: React$1.ComponentProps<"li">): React$1.JSX.Element;
|
|
60
|
+
declare function SidebarMenuSubButton({ size, isActive, className, render, ...props }: useRender.ComponentProps<"a"> & {
|
|
61
|
+
size?: "sm" | "md";
|
|
62
|
+
isActive?: boolean;
|
|
63
|
+
}): React$1.ReactElement;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|