@constructive-io/ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert-dialog.d.ts +31 -0
- package/dist/components/alert-dialog.js +314 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/alert.d.ts +14 -0
- package/dist/components/alert.js +38 -0
- package/dist/components/alert.js.map +1 -0
- package/dist/components/autocomplete.d.ts +28 -0
- package/dist/components/autocomplete.js +395 -0
- package/dist/components/autocomplete.js.map +1 -0
- package/dist/components/avatar.d.ts +13 -0
- package/dist/components/avatar.js +37 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +43 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +14 -0
- package/dist/components/breadcrumb.js +154 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +62 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calendar-rac.d.ts +13 -0
- package/dist/components/calendar-rac.js +82 -0
- package/dist/components/calendar-rac.js.map +1 -0
- package/dist/components/card.d.ts +19 -0
- package/dist/components/card.js +75 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/checkbox-group.d.ts +7 -0
- package/dist/components/checkbox-group.js +16 -0
- package/dist/components/checkbox-group.js.map +1 -0
- package/dist/components/checkbox.d.ts +8 -0
- package/dist/components/checkbox.js +67 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/collapsible.d.ts +54 -0
- package/dist/components/collapsible.js +121 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.d.ts +44 -0
- package/dist/components/combobox.js +486 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command.d.ts +43 -0
- package/dist/components/command.js +690 -0
- package/dist/components/command.js.map +1 -0
- package/dist/components/dialog.d.ts +35 -0
- package/dist/components/dialog.js +440 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dock.d.ts +31 -0
- package/dist/components/dock.js +111 -0
- package/dist/components/dock.js.map +1 -0
- package/dist/components/drawer.d.ts +16 -0
- package/dist/components/drawer.js +147 -0
- package/dist/components/drawer.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +50 -0
- package/dist/components/dropdown-menu.js +380 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/field.d.ts +51 -0
- package/dist/components/field.js +115 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/flickering-grid.d.ts +15 -0
- package/dist/components/flickering-grid.js +147 -0
- package/dist/components/flickering-grid.js.map +1 -0
- package/dist/components/form-control.d.ts +15 -0
- package/dist/components/form-control.js +173 -0
- package/dist/components/form-control.js.map +1 -0
- package/dist/components/form.d.ts +37 -0
- package/dist/components/form.js +179 -0
- package/dist/components/form.js.map +1 -0
- package/dist/components/input-group.d.ts +18 -0
- package/dist/components/input-group.js +177 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +11 -0
- package/dist/components/input.js +60 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/json-input.d.ts +25 -0
- package/dist/components/json-input.js +351 -0
- package/dist/components/json-input.js.map +1 -0
- package/dist/components/label.d.ts +11 -0
- package/dist/components/label.js +27 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/motion-grid.d.ts +20 -0
- package/dist/components/motion-grid.js +81 -0
- package/dist/components/motion-grid.js.map +1 -0
- package/dist/components/multi-select.d.ts +198 -0
- package/dist/components/multi-select.js +882 -0
- package/dist/components/multi-select.js.map +1 -0
- package/dist/components/page-header.d.ts +17 -0
- package/dist/components/page-header.js +17 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +19 -0
- package/dist/components/pagination.js +144 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +35 -0
- package/dist/components/popover.js +188 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/portal.d.ts +108 -0
- package/dist/components/portal.js +75 -0
- package/dist/components/portal.js.map +1 -0
- package/dist/components/progress.d.ts +10 -0
- package/dist/components/progress.js +30 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +25 -0
- package/dist/components/progressive-blur-scroll-container.js +142 -0
- package/dist/components/progressive-blur-scroll-container.js.map +1 -0
- package/dist/components/progressive-blur.d.ts +16 -0
- package/dist/components/progressive-blur.js +68 -0
- package/dist/components/progressive-blur.js.map +1 -0
- package/dist/components/radio-group.d.ts +10 -0
- package/dist/components/radio-group.js +37 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/record-picker.d.ts +16 -0
- package/dist/components/record-picker.js +366 -0
- package/dist/components/record-picker.js.map +1 -0
- package/dist/components/resizable.d.ts +11 -0
- package/dist/components/resizable.js +52 -0
- package/dist/components/resizable.js.map +1 -0
- package/dist/components/responsive-diagram.d.ts +10 -0
- package/dist/components/responsive-diagram.js +63 -0
- package/dist/components/responsive-diagram.js.map +1 -0
- package/dist/components/scroll-area.d.ts +12 -0
- package/dist/components/scroll-area.js +69 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/select.d.ts +47 -0
- package/dist/components/select.js +287 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +11 -0
- package/dist/components/separator.js +24 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +112 -0
- package/dist/components/sheet.js +600 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +77 -0
- package/dist/components/sidebar.js +1217 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton.d.ts +7 -0
- package/dist/components/skeleton.js +16 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/sonner.d.ts +10 -0
- package/dist/components/sonner.js +23 -0
- package/dist/components/sonner.js.map +1 -0
- package/dist/components/stack/index.d.ts +663 -0
- package/dist/components/stack/index.js +1418 -0
- package/dist/components/stack/index.js.map +1 -0
- package/dist/components/stepper.d.ts +30 -0
- package/dist/components/stepper.js +280 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/switch.d.ts +8 -0
- package/dist/components/switch.js +40 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table.d.ts +15 -0
- package/dist/components/table.js +65 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +10 -0
- package/dist/components/tabs.js +48 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tags.d.ts +42 -0
- package/dist/components/tags.js +728 -0
- package/dist/components/tags.js.map +1 -0
- package/dist/components/textarea.d.ts +10 -0
- package/dist/components/textarea.js +54 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/toast/index.d.ts +52 -0
- package/dist/components/toast/index.js +221 -0
- package/dist/components/toast/index.js.map +1 -0
- package/dist/components/tooltip.d.ts +29 -0
- package/dist/components/tooltip.js +174 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/unlink-button.d.ts +14 -0
- package/dist/components/unlink-button.js +91 -0
- package/dist/components/unlink-button.js.map +1 -0
- package/dist/index.cjs +7692 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2157 -0
- package/dist/index.d.ts +2157 -0
- package/dist/index.js +7375 -0
- package/dist/index.js.map +1 -0
- package/package.json +490 -0
- package/src/styles/globals.css +397 -0
|
@@ -0,0 +1,728 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React4 from 'react';
|
|
3
|
+
import { createContext, useState, useRef, useEffect, useContext } from 'react';
|
|
4
|
+
import { XIcon, SearchIcon, ChevronsUpDownIcon } from 'lucide-react';
|
|
5
|
+
import { clsx } from 'clsx';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
import { Dialog } from '@base-ui/react/dialog';
|
|
10
|
+
import { Autocomplete as Autocomplete$1 } from '@base-ui/react/autocomplete';
|
|
11
|
+
import { Input as Input$1 } from '@base-ui/react/input';
|
|
12
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
13
|
+
import { Popover as Popover$1 } from '@base-ui/react/popover';
|
|
14
|
+
|
|
15
|
+
function cn(...inputs) {
|
|
16
|
+
return twMerge(clsx(inputs));
|
|
17
|
+
}
|
|
18
|
+
var badgeVariants = cva(
|
|
19
|
+
"relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button,a&]:cursor-pointer [button,a&]:pointer-coarse:after:absolute [button,a&]:pointer-coarse:after:size-full [button,a&]:pointer-coarse:after:min-h-11 [button,a&]:pointer-coarse:after:min-w-11",
|
|
20
|
+
{
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
size: "default",
|
|
23
|
+
variant: "default"
|
|
24
|
+
},
|
|
25
|
+
variants: {
|
|
26
|
+
size: {
|
|
27
|
+
default: "px-[calc(--spacing(1)-1px)] text-xs",
|
|
28
|
+
lg: "px-[calc(--spacing(1.5)-1px)] text-sm",
|
|
29
|
+
sm: "rounded-[calc(var(--radius-sm)-2px)] px-[calc(--spacing(1)-1px)] text-[.625rem]"
|
|
30
|
+
},
|
|
31
|
+
variant: {
|
|
32
|
+
default: "bg-primary text-primary-foreground [button,a&]:hover:bg-primary/90",
|
|
33
|
+
destructive: "bg-destructive text-white [button,a&]:hover:bg-destructive/90",
|
|
34
|
+
error: "bg-destructive/8 text-destructive dark:bg-destructive/16",
|
|
35
|
+
info: "bg-info/8 text-info-foreground dark:bg-info/16",
|
|
36
|
+
outline: "border-border/60 bg-transparent dark:bg-input/32 [button,a&]:hover:bg-accent/50 dark:[button,a&]:hover:bg-input/48",
|
|
37
|
+
secondary: "bg-secondary text-secondary-foreground [button,a&]:hover:bg-secondary/90",
|
|
38
|
+
success: "bg-success/8 text-success-foreground dark:bg-success/16",
|
|
39
|
+
warning: "bg-warning/8 text-warning-foreground dark:bg-warning/16"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
var Badge = React4.forwardRef(({ className, variant, size, ...props }, ref) => /* @__PURE__ */ jsx("span", { ref, "data-slot": "badge", className: cn(badgeVariants({ variant, size }), className), ...props }));
|
|
45
|
+
Badge.displayName = "Badge";
|
|
46
|
+
var buttonVariants = cva(
|
|
47
|
+
"[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_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",
|
|
48
|
+
{
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
size: "default",
|
|
51
|
+
variant: "default"
|
|
52
|
+
},
|
|
53
|
+
variants: {
|
|
54
|
+
size: {
|
|
55
|
+
default: "h-9 px-[calc(--spacing(3)-1px)] sm:h-8",
|
|
56
|
+
icon: "size-9 sm:size-8",
|
|
57
|
+
"icon-lg": "size-10 sm:size-9",
|
|
58
|
+
"icon-sm": "size-8 sm:size-7",
|
|
59
|
+
"icon-xl": 'size-11 sm:size-10 [&_svg:not([class*="size-"])]:size-5 sm:[&_svg:not([class*="size-"])]:size-4.5',
|
|
60
|
+
"icon-xs": 'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-3.5',
|
|
61
|
+
lg: "h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",
|
|
62
|
+
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7",
|
|
63
|
+
xl: 'h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*="size-"])]:size-5 sm:[&_svg:not([class*="size-"])]:size-4.5',
|
|
64
|
+
xs: 'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*="size-"])]:size-4 sm:[&_svg:not([class*="size-"])]:size-3.5'
|
|
65
|
+
},
|
|
66
|
+
variant: {
|
|
67
|
+
default: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
68
|
+
destructive: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
69
|
+
"destructive-outline": "border-destructive/40 bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/60 [:hover,[data-pressed]]:bg-destructive/8",
|
|
70
|
+
ghost: "border-transparent hover:bg-accent data-pressed:bg-accent",
|
|
71
|
+
link: "border-transparent underline-offset-4 hover:underline",
|
|
72
|
+
outline: "border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
|
|
73
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
var Button = React4.forwardRef(
|
|
79
|
+
({ className, variant, size, asChild, children, type = "button", ...props }, ref) => {
|
|
80
|
+
const buttonClasses = cn(buttonVariants({ className, size, variant }));
|
|
81
|
+
if (asChild && React4.isValidElement(children)) {
|
|
82
|
+
const childProps = children.props;
|
|
83
|
+
return React4.cloneElement(children, {
|
|
84
|
+
...props,
|
|
85
|
+
className: cn(buttonClasses, childProps.className),
|
|
86
|
+
"data-slot": "button"
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ jsx("button", { ref, type, className: buttonClasses, "data-slot": "button", ...props, children });
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
Button.displayName = "Button";
|
|
93
|
+
var PORTAL_ROOT_ID = "portal-root";
|
|
94
|
+
var PortalContext = React4.createContext({
|
|
95
|
+
layer: "base",
|
|
96
|
+
depth: 0,
|
|
97
|
+
floatingPortalStrategy: "root",
|
|
98
|
+
floatingZIndex: "default"
|
|
99
|
+
});
|
|
100
|
+
function useRootPortalContainer() {
|
|
101
|
+
const [container, setContainer] = React4.useState(null);
|
|
102
|
+
React4.useLayoutEffect(() => {
|
|
103
|
+
const el = document.getElementById(PORTAL_ROOT_ID);
|
|
104
|
+
setContainer(el);
|
|
105
|
+
}, []);
|
|
106
|
+
return container;
|
|
107
|
+
}
|
|
108
|
+
function useFloatingOverlayPortalProps() {
|
|
109
|
+
const rootContainer = useRootPortalContainer();
|
|
110
|
+
const { floatingPortalStrategy, floatingZIndex } = React4.useContext(PortalContext);
|
|
111
|
+
const container = floatingPortalStrategy === "nested" ? void 0 : rootContainer ?? null;
|
|
112
|
+
const zIndexClass = floatingZIndex === "elevated" ? "z-[var(--z-layer-floating-elevated)]" : "z-[var(--z-layer-floating)]";
|
|
113
|
+
return { container, zIndexClass };
|
|
114
|
+
}
|
|
115
|
+
function composeRefs(...refs) {
|
|
116
|
+
return (node) => {
|
|
117
|
+
refs.forEach((ref) => {
|
|
118
|
+
if (typeof ref === "function") {
|
|
119
|
+
ref(node);
|
|
120
|
+
} else if (ref != null) {
|
|
121
|
+
ref.current = node;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function mergeProps(slotProps, childProps) {
|
|
127
|
+
const overrideProps = { ...childProps };
|
|
128
|
+
for (const propName in childProps) {
|
|
129
|
+
if (propName === "ref") continue;
|
|
130
|
+
const slotPropValue = slotProps[propName];
|
|
131
|
+
const childPropValue = childProps[propName];
|
|
132
|
+
if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
133
|
+
overrideProps[propName] = (...args) => {
|
|
134
|
+
childPropValue(...args);
|
|
135
|
+
slotPropValue(...args);
|
|
136
|
+
};
|
|
137
|
+
} else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
|
|
138
|
+
overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
|
|
139
|
+
} else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
|
|
140
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { ...slotProps, ...overrideProps };
|
|
144
|
+
}
|
|
145
|
+
function mergePropsWithRef(parentProps, childElement) {
|
|
146
|
+
const childProps = childElement.props;
|
|
147
|
+
const parentRef = parentProps.ref;
|
|
148
|
+
const childRef = childProps.ref;
|
|
149
|
+
const mergedProps = mergeProps(parentProps, childProps);
|
|
150
|
+
if (parentRef || childRef) {
|
|
151
|
+
mergedProps.ref = composeRefs(parentRef, childRef);
|
|
152
|
+
}
|
|
153
|
+
return mergedProps;
|
|
154
|
+
}
|
|
155
|
+
function isSlottable(child) {
|
|
156
|
+
return React4.isValidElement(child);
|
|
157
|
+
}
|
|
158
|
+
var Slot = React4.forwardRef((props, forwardedRef) => {
|
|
159
|
+
const { children, ...slotProps } = props;
|
|
160
|
+
if (isSlottable(children)) {
|
|
161
|
+
const childProps = children.props;
|
|
162
|
+
const childRef = childProps.ref;
|
|
163
|
+
return React4.cloneElement(children, {
|
|
164
|
+
...mergeProps(slotProps, childProps),
|
|
165
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (React4.Children.count(children) > 1) {
|
|
169
|
+
const childrenArray = React4.Children.toArray(children);
|
|
170
|
+
const slottableChild = childrenArray.find(
|
|
171
|
+
(child) => React4.isValidElement(child) && child.type === Slottable
|
|
172
|
+
);
|
|
173
|
+
if (slottableChild) {
|
|
174
|
+
const newElement = slottableChild.props.children;
|
|
175
|
+
if (isSlottable(newElement)) {
|
|
176
|
+
const newElementProps = newElement.props;
|
|
177
|
+
const newChildren = childrenArray.map((child) => {
|
|
178
|
+
if (child === slottableChild) {
|
|
179
|
+
return React4.Children.count(newElementProps.children) > 1 ? React4.Children.only(null) : newElementProps.children;
|
|
180
|
+
}
|
|
181
|
+
return child;
|
|
182
|
+
});
|
|
183
|
+
const childRef = newElementProps.ref;
|
|
184
|
+
return React4.cloneElement(newElement, {
|
|
185
|
+
...mergeProps(slotProps, newElementProps),
|
|
186
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
187
|
+
children: newChildren
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
193
|
+
});
|
|
194
|
+
Slot.displayName = "Slot";
|
|
195
|
+
function Slottable({ children }) {
|
|
196
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
197
|
+
}
|
|
198
|
+
function Input({ className, size = "default", unstyled = false, ...props }) {
|
|
199
|
+
const isFloating = props.placeholder === " ";
|
|
200
|
+
return /* @__PURE__ */ jsx(
|
|
201
|
+
"span",
|
|
202
|
+
{
|
|
203
|
+
className: cn(
|
|
204
|
+
!unstyled && [
|
|
205
|
+
// Base layout
|
|
206
|
+
"relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs transition-shadow",
|
|
207
|
+
// Inner shadow highlight
|
|
208
|
+
"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)]",
|
|
209
|
+
"not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)]",
|
|
210
|
+
// Focus state - use primary brand color
|
|
211
|
+
"has-focus-visible:border-primary/60 has-focus-visible:ring-[3px] has-focus-visible:ring-primary/35",
|
|
212
|
+
// Invalid state
|
|
213
|
+
"has-aria-invalid:border-destructive/36",
|
|
214
|
+
"has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16",
|
|
215
|
+
// Disabled state
|
|
216
|
+
"has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none",
|
|
217
|
+
// Dark mode
|
|
218
|
+
"sm:text-sm dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border",
|
|
219
|
+
"dark:has-aria-invalid:ring-destructive/24",
|
|
220
|
+
"dark:not-has-disabled:not-has-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)]"
|
|
221
|
+
],
|
|
222
|
+
className
|
|
223
|
+
) || void 0,
|
|
224
|
+
"data-size": size,
|
|
225
|
+
"data-slot": "input-control",
|
|
226
|
+
children: /* @__PURE__ */ jsx(
|
|
227
|
+
Input$1,
|
|
228
|
+
{
|
|
229
|
+
className: cn(
|
|
230
|
+
"w-full min-w-0 rounded-[inherit] bg-transparent px-[calc(--spacing(3)-1px)] outline-none",
|
|
231
|
+
isFloating ? "h-11 pt-4.5 pb-1 leading-none placeholder:text-transparent sm:h-10" : "h-8.5 leading-8.5 placeholder:text-muted-foreground/72 sm:h-7.5 sm:leading-7.5",
|
|
232
|
+
size === "sm" && (isFloating ? "h-10 px-[calc(--spacing(2.5)-1px)] pt-4 pb-1 sm:h-9" : "h-7.5 px-[calc(--spacing(2.5)-1px)] leading-7.5 sm:h-6.5 sm:leading-6.5"),
|
|
233
|
+
size === "lg" && (isFloating ? "h-12 pt-5 pb-1.5 sm:h-11" : "h-9.5 leading-9.5 sm:h-8.5 sm:leading-8.5"),
|
|
234
|
+
props.type === "search" && "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none",
|
|
235
|
+
props.type === "file" && "text-muted-foreground file:me-3 file:bg-transparent file:font-medium file:text-foreground file:text-sm"
|
|
236
|
+
),
|
|
237
|
+
"data-slot": "input",
|
|
238
|
+
size: typeof size === "number" ? size : void 0,
|
|
239
|
+
...props
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
var ScrollArea = React4.forwardRef(
|
|
246
|
+
({ className, children, scrollFade = false, scrollbarGutter = false, ...props }, ref) => {
|
|
247
|
+
return /* @__PURE__ */ jsxs(
|
|
248
|
+
ScrollArea$1.Root,
|
|
249
|
+
{
|
|
250
|
+
ref,
|
|
251
|
+
className: cn("size-full min-h-0", className),
|
|
252
|
+
...props,
|
|
253
|
+
children: [
|
|
254
|
+
/* @__PURE__ */ jsx(
|
|
255
|
+
ScrollArea$1.Viewport,
|
|
256
|
+
{
|
|
257
|
+
className: cn(
|
|
258
|
+
"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",
|
|
259
|
+
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]",
|
|
260
|
+
scrollbarGutter && "data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5"
|
|
261
|
+
),
|
|
262
|
+
"data-slot": "scroll-area-viewport",
|
|
263
|
+
children
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
/* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" }),
|
|
267
|
+
/* @__PURE__ */ jsx(ScrollBar, { orientation: "horizontal" }),
|
|
268
|
+
/* @__PURE__ */ jsx(ScrollArea$1.Corner, { "data-slot": "scroll-area-corner" })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
ScrollArea.displayName = "ScrollArea";
|
|
275
|
+
function ScrollBar({
|
|
276
|
+
className,
|
|
277
|
+
orientation = "vertical",
|
|
278
|
+
...props
|
|
279
|
+
}) {
|
|
280
|
+
return /* @__PURE__ */ jsx(
|
|
281
|
+
ScrollArea$1.Scrollbar,
|
|
282
|
+
{
|
|
283
|
+
className: cn(
|
|
284
|
+
"m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
|
|
285
|
+
className
|
|
286
|
+
),
|
|
287
|
+
"data-slot": "scroll-area-scrollbar",
|
|
288
|
+
orientation,
|
|
289
|
+
...props,
|
|
290
|
+
children: /* @__PURE__ */ jsx(
|
|
291
|
+
ScrollArea$1.Thumb,
|
|
292
|
+
{
|
|
293
|
+
className: "relative flex-1 rounded-full bg-foreground/20",
|
|
294
|
+
"data-slot": "scroll-area-thumb"
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
var Autocomplete = Autocomplete$1.Root;
|
|
301
|
+
function AutocompleteInput({
|
|
302
|
+
className,
|
|
303
|
+
showTrigger = false,
|
|
304
|
+
showClear = false,
|
|
305
|
+
startAddon,
|
|
306
|
+
size = "default",
|
|
307
|
+
...props
|
|
308
|
+
}) {
|
|
309
|
+
const sizeValue = size;
|
|
310
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative not-has-[>*.w-full]:w-fit w-full", children: [
|
|
311
|
+
startAddon && /* @__PURE__ */ jsx(
|
|
312
|
+
"div",
|
|
313
|
+
{
|
|
314
|
+
"aria-hidden": "true",
|
|
315
|
+
className: "[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4",
|
|
316
|
+
"data-slot": "autocomplete-start-addon",
|
|
317
|
+
children: startAddon
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
/* @__PURE__ */ jsx(
|
|
321
|
+
Autocomplete$1.Input,
|
|
322
|
+
{
|
|
323
|
+
className: cn(
|
|
324
|
+
startAddon && "data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=autocomplete-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=autocomplete-input]:ps-[calc(--spacing(8)-1px)]",
|
|
325
|
+
sizeValue === "sm" ? "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-6.5" : "has-[+[data-slot=autocomplete-trigger],+[data-slot=autocomplete-clear]]:*:data-[slot=autocomplete-input]:pe-7",
|
|
326
|
+
className
|
|
327
|
+
),
|
|
328
|
+
"data-slot": "autocomplete-input",
|
|
329
|
+
render: /* @__PURE__ */ jsx(Input, { size: sizeValue }),
|
|
330
|
+
...props
|
|
331
|
+
}
|
|
332
|
+
),
|
|
333
|
+
showTrigger && /* @__PURE__ */ jsx(
|
|
334
|
+
AutocompleteTrigger,
|
|
335
|
+
{
|
|
336
|
+
className: cn(
|
|
337
|
+
"-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
338
|
+
sizeValue === "sm" ? "end-0" : "end-0.5"
|
|
339
|
+
),
|
|
340
|
+
children: /* @__PURE__ */ jsx(ChevronsUpDownIcon, {})
|
|
341
|
+
}
|
|
342
|
+
),
|
|
343
|
+
showClear && /* @__PURE__ */ jsx(
|
|
344
|
+
AutocompleteClear,
|
|
345
|
+
{
|
|
346
|
+
className: cn(
|
|
347
|
+
"-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-colors pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=autocomplete-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
348
|
+
sizeValue === "sm" ? "end-0" : "end-0.5"
|
|
349
|
+
),
|
|
350
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
] });
|
|
354
|
+
}
|
|
355
|
+
function AutocompleteItem({
|
|
356
|
+
className,
|
|
357
|
+
children,
|
|
358
|
+
...props
|
|
359
|
+
}) {
|
|
360
|
+
return /* @__PURE__ */ jsx(
|
|
361
|
+
Autocomplete$1.Item,
|
|
362
|
+
{
|
|
363
|
+
className: cn(
|
|
364
|
+
"flex min-h-8 cursor-default select-none items-center rounded-sm px-2 py-1 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",
|
|
365
|
+
className
|
|
366
|
+
),
|
|
367
|
+
"data-slot": "autocomplete-item",
|
|
368
|
+
...props,
|
|
369
|
+
children
|
|
370
|
+
}
|
|
371
|
+
);
|
|
372
|
+
}
|
|
373
|
+
function AutocompleteGroup({
|
|
374
|
+
className,
|
|
375
|
+
...props
|
|
376
|
+
}) {
|
|
377
|
+
return /* @__PURE__ */ jsx(
|
|
378
|
+
Autocomplete$1.Group,
|
|
379
|
+
{
|
|
380
|
+
className: cn("[[role=group]+&]:mt-1.5", className),
|
|
381
|
+
"data-slot": "autocomplete-group",
|
|
382
|
+
...props
|
|
383
|
+
}
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
function AutocompleteGroupLabel({
|
|
387
|
+
className,
|
|
388
|
+
...props
|
|
389
|
+
}) {
|
|
390
|
+
return /* @__PURE__ */ jsx(
|
|
391
|
+
Autocomplete$1.GroupLabel,
|
|
392
|
+
{
|
|
393
|
+
className: cn(
|
|
394
|
+
"px-2 py-1.5 font-medium text-muted-foreground text-xs",
|
|
395
|
+
className
|
|
396
|
+
),
|
|
397
|
+
"data-slot": "autocomplete-group-label",
|
|
398
|
+
...props
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
function AutocompleteEmpty({
|
|
403
|
+
className,
|
|
404
|
+
...props
|
|
405
|
+
}) {
|
|
406
|
+
return /* @__PURE__ */ jsx(
|
|
407
|
+
Autocomplete$1.Empty,
|
|
408
|
+
{
|
|
409
|
+
className: cn(
|
|
410
|
+
"not-empty:p-2 text-center text-base text-muted-foreground sm:text-sm",
|
|
411
|
+
className
|
|
412
|
+
),
|
|
413
|
+
"data-slot": "autocomplete-empty",
|
|
414
|
+
...props
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
function AutocompleteList({
|
|
419
|
+
className,
|
|
420
|
+
...props
|
|
421
|
+
}) {
|
|
422
|
+
return /* @__PURE__ */ jsx(ScrollArea, { scrollbarGutter: true, scrollFade: true, children: /* @__PURE__ */ jsx(
|
|
423
|
+
Autocomplete$1.List,
|
|
424
|
+
{
|
|
425
|
+
className: cn(
|
|
426
|
+
"not-empty:scroll-py-1 not-empty:p-1 in-data-has-overflow-y:pe-3",
|
|
427
|
+
className
|
|
428
|
+
),
|
|
429
|
+
"data-slot": "autocomplete-list",
|
|
430
|
+
...props
|
|
431
|
+
}
|
|
432
|
+
) });
|
|
433
|
+
}
|
|
434
|
+
function AutocompleteClear({
|
|
435
|
+
className,
|
|
436
|
+
...props
|
|
437
|
+
}) {
|
|
438
|
+
return /* @__PURE__ */ jsx(
|
|
439
|
+
Autocomplete$1.Clear,
|
|
440
|
+
{
|
|
441
|
+
className: cn(
|
|
442
|
+
"-translate-y-1/2 absolute end-0.5 top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-[color,background-color,box-shadow,opacity] pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
443
|
+
className
|
|
444
|
+
),
|
|
445
|
+
"data-slot": "autocomplete-clear",
|
|
446
|
+
...props,
|
|
447
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
448
|
+
}
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
function AutocompleteTrigger({
|
|
452
|
+
className,
|
|
453
|
+
...props
|
|
454
|
+
}) {
|
|
455
|
+
return /* @__PURE__ */ jsx(
|
|
456
|
+
Autocomplete$1.Trigger,
|
|
457
|
+
{
|
|
458
|
+
className,
|
|
459
|
+
"data-slot": "autocomplete-trigger",
|
|
460
|
+
...props
|
|
461
|
+
}
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
var CommandInputContext = React4.createContext({
|
|
465
|
+
inputRef: null
|
|
466
|
+
});
|
|
467
|
+
Dialog.Root;
|
|
468
|
+
function Command({
|
|
469
|
+
autoHighlight = "always",
|
|
470
|
+
keepHighlight = true,
|
|
471
|
+
open = true,
|
|
472
|
+
...props
|
|
473
|
+
}) {
|
|
474
|
+
const AutocompleteAny = Autocomplete;
|
|
475
|
+
return /* @__PURE__ */ jsx(
|
|
476
|
+
AutocompleteAny,
|
|
477
|
+
{
|
|
478
|
+
autoHighlight,
|
|
479
|
+
keepHighlight,
|
|
480
|
+
open,
|
|
481
|
+
...props
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
function CommandInput({
|
|
486
|
+
className,
|
|
487
|
+
placeholder = void 0,
|
|
488
|
+
value,
|
|
489
|
+
onValueChange,
|
|
490
|
+
...props
|
|
491
|
+
}) {
|
|
492
|
+
const { inputRef } = React4.useContext(CommandInputContext);
|
|
493
|
+
return /* @__PURE__ */ jsx("div", { className: "px-2.5 py-1.5", children: /* @__PURE__ */ jsx(
|
|
494
|
+
AutocompleteInput,
|
|
495
|
+
{
|
|
496
|
+
className: cn(
|
|
497
|
+
"border-transparent! bg-transparent! shadow-none before:hidden has-focus-visible:ring-0",
|
|
498
|
+
className
|
|
499
|
+
),
|
|
500
|
+
placeholder,
|
|
501
|
+
ref: inputRef,
|
|
502
|
+
size: "lg",
|
|
503
|
+
startAddon: /* @__PURE__ */ jsx(SearchIcon, {}),
|
|
504
|
+
value,
|
|
505
|
+
onChange: onValueChange ? (e) => onValueChange(e.target.value) : void 0,
|
|
506
|
+
...props
|
|
507
|
+
}
|
|
508
|
+
) });
|
|
509
|
+
}
|
|
510
|
+
function CommandList({
|
|
511
|
+
className,
|
|
512
|
+
...props
|
|
513
|
+
}) {
|
|
514
|
+
return /* @__PURE__ */ jsx(
|
|
515
|
+
AutocompleteList,
|
|
516
|
+
{
|
|
517
|
+
className: cn("not-empty:scroll-py-2 not-empty:p-2", className),
|
|
518
|
+
"data-slot": "command-list",
|
|
519
|
+
...props
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
function CommandEmpty({
|
|
524
|
+
className,
|
|
525
|
+
...props
|
|
526
|
+
}) {
|
|
527
|
+
return /* @__PURE__ */ jsx(
|
|
528
|
+
AutocompleteEmpty,
|
|
529
|
+
{
|
|
530
|
+
className: cn("not-empty:py-6", className),
|
|
531
|
+
"data-slot": "command-empty",
|
|
532
|
+
...props
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
function CommandGroup({
|
|
537
|
+
className,
|
|
538
|
+
heading,
|
|
539
|
+
children,
|
|
540
|
+
...props
|
|
541
|
+
}) {
|
|
542
|
+
return /* @__PURE__ */ jsxs(
|
|
543
|
+
AutocompleteGroup,
|
|
544
|
+
{
|
|
545
|
+
className,
|
|
546
|
+
"data-slot": "command-group",
|
|
547
|
+
...props,
|
|
548
|
+
children: [
|
|
549
|
+
heading && /* @__PURE__ */ jsx(CommandGroupLabel, { children: heading }),
|
|
550
|
+
children
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
function CommandGroupLabel({
|
|
556
|
+
className,
|
|
557
|
+
...props
|
|
558
|
+
}) {
|
|
559
|
+
return /* @__PURE__ */ jsx(
|
|
560
|
+
AutocompleteGroupLabel,
|
|
561
|
+
{
|
|
562
|
+
className,
|
|
563
|
+
"data-slot": "command-group-label",
|
|
564
|
+
...props
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
function CommandItem({
|
|
569
|
+
className,
|
|
570
|
+
...props
|
|
571
|
+
}) {
|
|
572
|
+
return /* @__PURE__ */ jsx(
|
|
573
|
+
AutocompleteItem,
|
|
574
|
+
{
|
|
575
|
+
className: cn("py-1.5", className),
|
|
576
|
+
"data-slot": "command-item",
|
|
577
|
+
...props
|
|
578
|
+
}
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
function Popover({ ...props }) {
|
|
582
|
+
return /* @__PURE__ */ jsx(Popover$1.Root, { "data-slot": "popover", ...props });
|
|
583
|
+
}
|
|
584
|
+
function PopoverTrigger({ asChild, nativeButton, children, ...props }) {
|
|
585
|
+
if (asChild && React4.isValidElement(children)) {
|
|
586
|
+
return /* @__PURE__ */ jsx(
|
|
587
|
+
Popover$1.Trigger,
|
|
588
|
+
{
|
|
589
|
+
"data-slot": "popover-trigger",
|
|
590
|
+
nativeButton: nativeButton ?? true,
|
|
591
|
+
...props,
|
|
592
|
+
render: (triggerProps) => {
|
|
593
|
+
const { nativeButton: _, ...rest } = triggerProps;
|
|
594
|
+
return React4.cloneElement(
|
|
595
|
+
children,
|
|
596
|
+
mergePropsWithRef(rest, children)
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
return /* @__PURE__ */ jsx(Popover$1.Trigger, { "data-slot": "popover-trigger", nativeButton, ...props, children });
|
|
603
|
+
}
|
|
604
|
+
function PopoverContent({
|
|
605
|
+
className,
|
|
606
|
+
align = "center",
|
|
607
|
+
sideOffset = 4,
|
|
608
|
+
showArrow = false,
|
|
609
|
+
side = "bottom",
|
|
610
|
+
children,
|
|
611
|
+
onOpenAutoFocus: _onOpenAutoFocus,
|
|
612
|
+
onCloseAutoFocus: _onCloseAutoFocus,
|
|
613
|
+
onFocusOutside: _onFocusOutside,
|
|
614
|
+
onEscapeKeyDown: _onEscapeKeyDown,
|
|
615
|
+
...props
|
|
616
|
+
}) {
|
|
617
|
+
const { container, zIndexClass } = useFloatingOverlayPortalProps();
|
|
618
|
+
return /* @__PURE__ */ jsx(Popover$1.Portal, { container, children: /* @__PURE__ */ jsx(
|
|
619
|
+
Popover$1.Positioner,
|
|
620
|
+
{
|
|
621
|
+
side,
|
|
622
|
+
align,
|
|
623
|
+
sideOffset,
|
|
624
|
+
className: zIndexClass,
|
|
625
|
+
children: /* @__PURE__ */ jsxs(
|
|
626
|
+
Popover$1.Popup,
|
|
627
|
+
{
|
|
628
|
+
"data-slot": "popover-content",
|
|
629
|
+
className: cn(
|
|
630
|
+
`bg-popover text-popover-foreground data-[open]:animate-in data-[closed]:animate-out
|
|
631
|
+
data-[closed]:fade-out-0 data-[open]:fade-in-0 data-[closed]:zoom-out-95
|
|
632
|
+
data-[open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2
|
|
633
|
+
data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 w-72 rounded-md border p-4
|
|
634
|
+
shadow-md outline-hidden`,
|
|
635
|
+
className
|
|
636
|
+
),
|
|
637
|
+
...props,
|
|
638
|
+
children: [
|
|
639
|
+
children,
|
|
640
|
+
showArrow && /* @__PURE__ */ jsx(Popover$1.Arrow, { className: "fill-popover -my-px drop-shadow-[0_1px_0_var(--border)]" })
|
|
641
|
+
]
|
|
642
|
+
}
|
|
643
|
+
)
|
|
644
|
+
}
|
|
645
|
+
) });
|
|
646
|
+
}
|
|
647
|
+
var TagsContext = createContext({
|
|
648
|
+
value: void 0,
|
|
649
|
+
setValue: void 0,
|
|
650
|
+
open: false,
|
|
651
|
+
onOpenChange: () => {
|
|
652
|
+
},
|
|
653
|
+
width: void 0,
|
|
654
|
+
setWidth: void 0
|
|
655
|
+
});
|
|
656
|
+
var useTagsContext = () => {
|
|
657
|
+
const context = useContext(TagsContext);
|
|
658
|
+
if (!context) {
|
|
659
|
+
throw new Error("useTagsContext must be used within a TagsProvider");
|
|
660
|
+
}
|
|
661
|
+
return context;
|
|
662
|
+
};
|
|
663
|
+
var Tags = ({
|
|
664
|
+
value,
|
|
665
|
+
setValue,
|
|
666
|
+
open: controlledOpen,
|
|
667
|
+
onOpenChange: controlledOnOpenChange,
|
|
668
|
+
children,
|
|
669
|
+
className
|
|
670
|
+
}) => {
|
|
671
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
672
|
+
const [width, setWidth] = useState();
|
|
673
|
+
const ref = useRef(null);
|
|
674
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
675
|
+
const onOpenChange = controlledOnOpenChange ?? setUncontrolledOpen;
|
|
676
|
+
useEffect(() => {
|
|
677
|
+
if (!ref.current) {
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
681
|
+
setWidth(entries[0].contentRect.width);
|
|
682
|
+
});
|
|
683
|
+
resizeObserver.observe(ref.current);
|
|
684
|
+
return () => {
|
|
685
|
+
resizeObserver.disconnect();
|
|
686
|
+
};
|
|
687
|
+
}, []);
|
|
688
|
+
return /* @__PURE__ */ jsx(TagsContext.Provider, { value: { value, setValue, open, onOpenChange, width, setWidth }, children: /* @__PURE__ */ jsx(Popover, { onOpenChange, open, children: /* @__PURE__ */ jsx("div", { className: cn("relative w-full", className), ref, children }) }) });
|
|
689
|
+
};
|
|
690
|
+
var TagsTrigger = ({ className, children, ...props }) => /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
691
|
+
Button,
|
|
692
|
+
{
|
|
693
|
+
className: cn("h-auto w-full justify-between p-2", className),
|
|
694
|
+
role: "combobox",
|
|
695
|
+
variant: "outline",
|
|
696
|
+
...props,
|
|
697
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
698
|
+
children,
|
|
699
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground px-2 py-px", children: "Select a tag..." })
|
|
700
|
+
] })
|
|
701
|
+
}
|
|
702
|
+
) });
|
|
703
|
+
var TagsValue = ({ className, children, onRemove, ...props }) => {
|
|
704
|
+
const handleRemove = (event) => {
|
|
705
|
+
event.preventDefault();
|
|
706
|
+
event.stopPropagation();
|
|
707
|
+
onRemove?.();
|
|
708
|
+
};
|
|
709
|
+
return /* @__PURE__ */ jsxs(Badge, { className: cn("flex items-center gap-2", className), ...props, children: [
|
|
710
|
+
children,
|
|
711
|
+
onRemove && // biome-ignore lint/a11y/noStaticElementInteractions: "This is a clickable badge"
|
|
712
|
+
// biome-ignore lint/a11y/useKeyWithClickEvents: "This is a clickable badge"
|
|
713
|
+
/* @__PURE__ */ jsx("div", { className: "hover:text-muted-foreground size-auto cursor-pointer", onClick: handleRemove, children: /* @__PURE__ */ jsx(XIcon, { size: 12 }) })
|
|
714
|
+
] });
|
|
715
|
+
};
|
|
716
|
+
var TagsContent = ({ className, children, ...props }) => {
|
|
717
|
+
const { width } = useTagsContext();
|
|
718
|
+
return /* @__PURE__ */ jsx(PopoverContent, { className: cn("p-0", className), style: { width }, ...props, children: /* @__PURE__ */ jsx(Command, { children }) });
|
|
719
|
+
};
|
|
720
|
+
var TagsInput = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandInput, { className: cn("h-9", className), ...props });
|
|
721
|
+
var TagsList = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandList, { className: cn("max-h-[200px]", className), ...props });
|
|
722
|
+
var TagsEmpty = ({ children, className: _className, ...props }) => /* @__PURE__ */ jsx(CommandEmpty, { ...props, children: children ?? "No tags found." });
|
|
723
|
+
var TagsGroup = CommandGroup;
|
|
724
|
+
var TagsItem = ({ className, ...props }) => /* @__PURE__ */ jsx(CommandItem, { className: cn("cursor-pointer items-center justify-between", className), ...props });
|
|
725
|
+
|
|
726
|
+
export { Tags, TagsContent, TagsEmpty, TagsGroup, TagsInput, TagsItem, TagsList, TagsTrigger, TagsValue };
|
|
727
|
+
//# sourceMappingURL=tags.js.map
|
|
728
|
+
//# sourceMappingURL=tags.js.map
|