@dynamic-labs-sdk/droplet 1.50.0 → 1.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/components/copy-button/copy-button.d.ts +3 -1
- package/dist/components/copy-button/copy-button.d.ts.map +1 -1
- package/dist/components/copy-button/copy-button.stories.d.ts +1 -1
- package/dist/components/toggle-card/toggle-card.d.ts +10 -0
- package/dist/components/toggle-card/toggle-card.d.ts.map +1 -1
- package/dist/components/toggle-card/toggle-card.stories.d.ts +5 -0
- package/dist/components/toggle-card/toggle-card.stories.d.ts.map +1 -1
- package/dist/components/toggle-row/toggle-row.d.ts +22 -1
- package/dist/components/toggle-row/toggle-row.d.ts.map +1 -1
- package/dist/components/toggle-row/toggle-row.stories.d.ts +10 -6
- package/dist/components/toggle-row/toggle-row.stories.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts +54 -12
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.stories.d.ts +12 -1
- package/dist/components/ui/combobox/combobox.stories.d.ts.map +1 -1
- package/dist/components/ui/field/field-control-context.d.ts +20 -0
- package/dist/components/ui/field/field-control-context.d.ts.map +1 -0
- package/dist/components/ui/field/field.d.ts +24 -4
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.stories.d.ts +26 -6
- package/dist/components/ui/field/field.stories.d.ts.map +1 -1
- package/dist/components/ui/field/use-field-feedback.d.ts +25 -0
- package/dist/components/ui/field/use-field-feedback.d.ts.map +1 -0
- package/dist/components/ui/label/label.d.ts +15 -0
- package/dist/components/ui/label/label.d.ts.map +1 -1
- package/dist/components/ui/select/select.d.ts.map +1 -1
- package/dist/components/ui/select/select.stories.d.ts.map +1 -1
- package/dist/components/ui/table/table.d.ts +7 -1
- package/dist/components/ui/table/table.d.ts.map +1 -1
- package/dist/components/ui/well/index.d.ts +1 -1
- package/dist/components/ui/well/index.d.ts.map +1 -1
- package/dist/components/ui/well/well-reveal.stories.d.ts.map +1 -1
- package/dist/components/ui/well/well.d.ts +18 -3
- package/dist/components/ui/well/well.d.ts.map +1 -1
- package/dist/components/ui/well/well.stories.d.ts +1 -9
- package/dist/components/ui/well/well.stories.d.ts.map +1 -1
- package/dist/index.cjs +995 -407
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +796 -205
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -6
- package/src/styles/globals.css +11 -15
- package/dist/components/migration/banner/banner.d.ts +0 -24
- package/dist/components/migration/banner/banner.d.ts.map +0 -1
- package/dist/components/migration/banner/banner.stories.d.ts +0 -39
- package/dist/components/migration/banner/banner.stories.d.ts.map +0 -1
- package/dist/components/migration/banner/index.d.ts +0 -2
- package/dist/components/migration/banner/index.d.ts.map +0 -1
- package/dist/components/migration/double-section/double-section.d.ts +0 -29
- package/dist/components/migration/double-section/double-section.d.ts.map +0 -1
- package/dist/components/migration/double-section/double-section.stories.d.ts +0 -32
- package/dist/components/migration/double-section/double-section.stories.d.ts.map +0 -1
- package/dist/components/migration/double-section/index.d.ts +0 -2
- package/dist/components/migration/double-section/index.d.ts.map +0 -1
- package/dist/components/migration/field/field.d.ts +0 -19
- package/dist/components/migration/field/field.d.ts.map +0 -1
- package/dist/components/migration/field/field.stories.d.ts +0 -43
- package/dist/components/migration/field/field.stories.d.ts.map +0 -1
- package/dist/components/migration/field/index.d.ts +0 -2
- package/dist/components/migration/field/index.d.ts.map +0 -1
- package/dist/components/migration/index.d.ts +0 -16
- package/dist/components/migration/index.d.ts.map +0 -1
- package/dist/components/migration/settings-section-v2/index.d.ts +0 -2
- package/dist/components/migration/settings-section-v2/index.d.ts.map +0 -1
- package/dist/components/migration/settings-section-v2/settings-section-v2.d.ts +0 -45
- package/dist/components/migration/settings-section-v2/settings-section-v2.d.ts.map +0 -1
- package/dist/components/migration/settings-section-v2/settings-section-v2.stories.d.ts +0 -40
- package/dist/components/migration/settings-section-v2/settings-section-v2.stories.d.ts.map +0 -1
- package/dist/components/migration/sub-section/index.d.ts +0 -2
- package/dist/components/migration/sub-section/index.d.ts.map +0 -1
- package/dist/components/migration/sub-section/sub-section.d.ts +0 -26
- package/dist/components/migration/sub-section/sub-section.d.ts.map +0 -1
- package/dist/components/migration/sub-section/sub-section.stories.d.ts +0 -33
- package/dist/components/migration/sub-section/sub-section.stories.d.ts.map +0 -1
- package/dist/components/migration/toggle-group/index.d.ts +0 -2
- package/dist/components/migration/toggle-group/index.d.ts.map +0 -1
- package/dist/components/migration/toggle-group/toggle-group.d.ts +0 -22
- package/dist/components/migration/toggle-group/toggle-group.d.ts.map +0 -1
- package/dist/components/migration/toggle-group/toggle-group.stories.d.ts +0 -30
- package/dist/components/migration/toggle-group/toggle-group.stories.d.ts.map +0 -1
- package/dist/components/patterns/config-tab-with-pill/config-tab-with-pill.stories.d.ts +0 -17
- package/dist/components/patterns/config-tab-with-pill/config-tab-with-pill.stories.d.ts.map +0 -1
- package/dist/components/patterns/cors-list/cors-list.stories.d.ts +0 -17
- package/dist/components/patterns/cors-list/cors-list.stories.d.ts.map +0 -1
- package/dist/components/patterns/rounded-row-list/rounded-row-list.stories.d.ts +0 -17
- package/dist/components/patterns/rounded-row-list/rounded-row-list.stories.d.ts.map +0 -1
- package/dist/components/status-badge/index.d.ts +0 -2
- package/dist/components/status-badge/index.d.ts.map +0 -1
- package/dist/components/status-badge/status-badge.d.ts +0 -10
- package/dist/components/status-badge/status-badge.d.ts.map +0 -1
- package/dist/components/status-badge/status-badge.stories.d.ts +0 -24
- package/dist/components/status-badge/status-badge.stories.d.ts.map +0 -1
- package/dist/components/ui/flush-card-detach/flush-card-detach.stories.d.ts +0 -17
- package/dist/components/ui/flush-card-detach/flush-card-detach.stories.d.ts.map +0 -1
- package/dist/migration.cjs +0 -328
- package/dist/migration.cjs.map +0 -1
- package/dist/migration.esm.js +0 -322
- package/dist/migration.esm.js.map +0 -1
- package/dist/toggle-row-BBTk7_bT.cjs +0 -408
- package/dist/toggle-row-BBTk7_bT.cjs.map +0 -1
- package/dist/toggle-row-PqelNVXI.esm.js +0 -360
- package/dist/toggle-row-PqelNVXI.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
2
3
|
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
4
|
import { AnimatePresence, motion, useAnimation, useReducedMotion } from "motion/react";
|
|
4
5
|
import { HugeiconsIcon } from "@hugeicons/react";
|
|
5
|
-
import { Add01Icon, Alert01Icon, AlertCircleIcon, ArrowDown01Icon, ArrowLeft01Icon, ArrowRight01Icon, ArrowUp01Icon, Cancel01Icon, CheckmarkCircle02Icon, Copy01Icon, FilterIcon, InformationCircleIcon, LayoutThreeColumnIcon, MoreHorizontalIcon, Search01Icon, Table01Icon, Tick01Icon, WebhookIcon } from "@hugeicons/core-free-icons";
|
|
6
|
+
import { Add01Icon, Alert01Icon, AlertCircleIcon, ArrowDown01Icon, ArrowLeft01Icon, ArrowRight01Icon, ArrowUp01Icon, Cancel01Icon, CheckmarkCircle02Icon, Copy01Icon, FilterIcon, InformationCircleIcon, LayoutThreeColumnIcon, MoreHorizontalIcon, Search01Icon, Setting07Icon, Table01Icon, Tick01Icon, WebhookIcon } from "@hugeicons/core-free-icons";
|
|
6
7
|
import { cva } from "class-variance-authority";
|
|
7
8
|
import { Slot } from "@radix-ui/react-slot";
|
|
8
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -18,20 +19,160 @@ import { Close, Content as Content$2, Description as Description$1, Overlay as O
|
|
|
18
19
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
19
20
|
import { CheckboxItem, Content as Content$3, Group, Item as Item$1, ItemIndicator, Label as Label$1, Portal as Portal$2, RadioGroup as RadioGroup$1, RadioItem, Root as Root$3, Separator as Separator$1, Sub, SubContent, SubTrigger, Trigger as Trigger$3 } from "@radix-ui/react-dropdown-menu";
|
|
20
21
|
import { CheckIcon as CheckIcon$1, ChevronRightIcon as ChevronRightIcon$1, CircleIcon } from "lucide-react";
|
|
22
|
+
import { PulsingBorder } from "@paper-design/shaders-react";
|
|
23
|
+
import { Root as Root$4 } from "@radix-ui/react-label";
|
|
24
|
+
import { Content as Content$4, Group as Group$1, Icon as Icon$1, Item as Item$2, ItemIndicator as ItemIndicator$1, ItemText, Label as Label$2, Portal as Portal$3, Root as Root$5, ScrollDownButton, ScrollUpButton, Separator as Separator$2, Trigger as Trigger$4, Value, Viewport } from "@radix-ui/react-select";
|
|
21
25
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
22
26
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
23
|
-
import {
|
|
24
|
-
import { Root as Root$5 } from "@radix-ui/react-separator";
|
|
27
|
+
import { Root as Root$6 } from "@radix-ui/react-separator";
|
|
25
28
|
import { useTheme } from "next-themes";
|
|
26
29
|
import { Toaster as Toaster$1, toast } from "sonner";
|
|
30
|
+
import { Root as Root$7, Thumb } from "@radix-ui/react-switch";
|
|
27
31
|
import { createColumnHelper as createColumnHelper$1, flexRender, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
28
32
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
29
33
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
30
|
-
import { Arrow, Content as Content$5, Portal as Portal$4, Provider, Root as Root$
|
|
34
|
+
import { Arrow, Content as Content$5, Portal as Portal$4, Provider, Root as Root$8, Trigger as Trigger$5 } from "@radix-ui/react-tooltip";
|
|
31
35
|
import Link from "next/link";
|
|
32
36
|
|
|
37
|
+
//#region src/lib/utils.ts
|
|
38
|
+
const cn = (...inputs) => twMerge(clsx(inputs));
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/ui/spinner/spinner.tsx
|
|
42
|
+
/** Maps the `size` prop to Tailwind size utilities. */
|
|
43
|
+
const sizeMap = {
|
|
44
|
+
lg: "size-6",
|
|
45
|
+
md: "size-4",
|
|
46
|
+
sm: "size-3"
|
|
47
|
+
};
|
|
48
|
+
const Spinner = ({ className, size = "md" }) => /* @__PURE__ */ jsx("output", {
|
|
49
|
+
"aria-label": "Loading",
|
|
50
|
+
className: "inline-flex",
|
|
51
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
52
|
+
viewBox: "0 0 24 24",
|
|
53
|
+
fill: "none",
|
|
54
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
55
|
+
className: cn("animate-spin motion-reduce:animate-none", sizeMap[size], className),
|
|
56
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
57
|
+
className: "opacity-25",
|
|
58
|
+
cx: "12",
|
|
59
|
+
cy: "12",
|
|
60
|
+
r: "10",
|
|
61
|
+
stroke: "currentColor",
|
|
62
|
+
strokeWidth: "4"
|
|
63
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
64
|
+
className: "opacity-75",
|
|
65
|
+
fill: "currentColor",
|
|
66
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/components/ui/button/button.tsx
|
|
73
|
+
const buttonVariants = cva("relative isolate inline-flex items-center justify-center gap-1.5 whitespace-nowrap select-none text-[13px] font-medium leading-[calc(18/13)] touch-manipulation transition-[background-color,color,opacity,box-shadow,transform,filter,scale] duration-150 ease-out active:scale-[0.96] motion-reduce:transition-none cursor-pointer border-0 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", {
|
|
74
|
+
compoundVariants: [
|
|
75
|
+
{
|
|
76
|
+
class: "min-w-16",
|
|
77
|
+
size: "sm",
|
|
78
|
+
variant: [
|
|
79
|
+
"default",
|
|
80
|
+
"destructive",
|
|
81
|
+
"outline",
|
|
82
|
+
"secondary"
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
class: "min-w-20",
|
|
87
|
+
size: "default",
|
|
88
|
+
variant: [
|
|
89
|
+
"default",
|
|
90
|
+
"destructive",
|
|
91
|
+
"outline",
|
|
92
|
+
"secondary"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
class: "min-w-24",
|
|
97
|
+
size: "lg",
|
|
98
|
+
variant: [
|
|
99
|
+
"default",
|
|
100
|
+
"destructive",
|
|
101
|
+
"outline",
|
|
102
|
+
"secondary"
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
defaultVariants: {
|
|
107
|
+
size: "default",
|
|
108
|
+
variant: "default"
|
|
109
|
+
},
|
|
110
|
+
variants: {
|
|
111
|
+
size: {
|
|
112
|
+
default: "rounded-md px-3 py-1.5 h-8 has-[>svg]:px-2.5 [&_svg:not([class*='size-'])]:size-3.5",
|
|
113
|
+
icon: "size-9 rounded-md",
|
|
114
|
+
"icon-sm": "size-7 rounded-md [&_svg:not([class*='size-'])]:size-3.5 relative before:absolute before:-inset-[8px] before:content-['']",
|
|
115
|
+
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3 relative before:absolute before:-inset-[10px] before:content-['']",
|
|
116
|
+
lg: "rounded-md px-5 py-2.5 h-10 has-[>svg]:px-4 [&_svg:not([class*='size-'])]:size-4",
|
|
117
|
+
sm: "rounded-md px-2.5 py-1 h-7 has-[>svg]:px-2 [&_svg:not([class*='size-'])]:size-3 before:absolute before:-inset-y-[6px] before:inset-x-0 before:content-['']",
|
|
118
|
+
xs: "rounded-md px-3 py-1 h-7 [&_svg:not([class*='size-'])]:size-3"
|
|
119
|
+
},
|
|
120
|
+
variant: {
|
|
121
|
+
default: "bg-(--action) text-white shadow-[0_0_0_1px_var(--action),var(--shadow-button)] hover:brightness-105 [text-shadow:0_1px_1px_rgba(0,0,0,0.16)]",
|
|
122
|
+
destructive: "bg-destructive text-white shadow-[0_0_0_1px_var(--destructive),var(--shadow-button)] hover:brightness-105 [text-shadow:0_1px_1px_rgba(0,0,0,0.16)] focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
123
|
+
ghost: "text-muted-foreground hover:bg-[#f8f8f9] hover:text-foreground dark:hover:bg-white/[0.06]",
|
|
124
|
+
link: "text-(--action) underline-offset-4 hover:underline",
|
|
125
|
+
outline: "bg-white shadow-[var(--shadow-input)] hover:bg-[#f8f8f9] hover:shadow-[var(--shadow-input-hover)] dark:bg-input/30 dark:hover:bg-white/[0.06]",
|
|
126
|
+
secondary: "bg-white shadow-[var(--shadow-secondary)] hover:bg-[#f8f8f9] hover:shadow-[var(--shadow-secondary-hover)] dark:bg-input/30 dark:hover:bg-white/[0.06]"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* Primary clickable action button.
|
|
132
|
+
*
|
|
133
|
+
* Variants: `default` | `destructive` | `outline` | `secondary` | `ghost` | `link`.
|
|
134
|
+
* Sizes: `default` | `sm` | `xs` | `lg` | `icon` | `icon-sm` | `icon-xs`.
|
|
135
|
+
* Set `asChild` to render the button styles onto a child element (e.g. an anchor) instead of a `<button>`.
|
|
136
|
+
* Set `loading` to show an inline spinner before the label and disable interaction while an async action is pending.
|
|
137
|
+
* When `asChild` is true, `loading` is ignored — the Slot host cannot render an additional spinner child.
|
|
138
|
+
*/
|
|
139
|
+
const Button = ({ className, variant = "default", size = "default", asChild = false, loading = false, disabled, children, style, ...props }) => {
|
|
140
|
+
if (asChild) return /* @__PURE__ */ jsx(Slot, {
|
|
141
|
+
"data-slot": "button",
|
|
142
|
+
"data-size": size,
|
|
143
|
+
"data-variant": variant,
|
|
144
|
+
className: cn(buttonVariants({
|
|
145
|
+
className,
|
|
146
|
+
size,
|
|
147
|
+
variant
|
|
148
|
+
})),
|
|
149
|
+
...props,
|
|
150
|
+
disabled,
|
|
151
|
+
style,
|
|
152
|
+
children
|
|
153
|
+
});
|
|
154
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
155
|
+
"data-slot": "button",
|
|
156
|
+
"data-size": size,
|
|
157
|
+
"data-variant": variant,
|
|
158
|
+
className: cn(buttonVariants({
|
|
159
|
+
size,
|
|
160
|
+
variant
|
|
161
|
+
}), loading && "cursor-wait", className),
|
|
162
|
+
disabled: disabled || loading,
|
|
163
|
+
"aria-busy": loading || void 0,
|
|
164
|
+
style: loading ? {
|
|
165
|
+
opacity: 1,
|
|
166
|
+
...style
|
|
167
|
+
} : style,
|
|
168
|
+
...props,
|
|
169
|
+
children: [loading && /* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), children]
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
33
174
|
//#region src/components/unsaved-changes-bar/unsaved-changes-bar.tsx
|
|
34
|
-
const spring$
|
|
175
|
+
const spring$4 = {
|
|
35
176
|
bounce: 0,
|
|
36
177
|
duration: .35,
|
|
37
178
|
type: "spring"
|
|
@@ -69,7 +210,7 @@ const ProgressiveBlur = () => {
|
|
|
69
210
|
});
|
|
70
211
|
};
|
|
71
212
|
const popTransition = {
|
|
72
|
-
...spring$
|
|
213
|
+
...spring$4,
|
|
73
214
|
duration: .25
|
|
74
215
|
};
|
|
75
216
|
const StatusIcon = ({ state }) => {
|
|
@@ -168,7 +309,7 @@ const UnsavedChangesBar = ({ hasChanges, onSave, onReset, suppressed = false })
|
|
|
168
309
|
initial: { opacity: 0 },
|
|
169
310
|
animate: { opacity: 1 },
|
|
170
311
|
exit: { opacity: 0 },
|
|
171
|
-
transition: spring$
|
|
312
|
+
transition: spring$4,
|
|
172
313
|
children: /* @__PURE__ */ jsx(ProgressiveBlur, {})
|
|
173
314
|
}, "blur") }), /* @__PURE__ */ jsx("div", {
|
|
174
315
|
className: "fixed bottom-10 left-1/2 -translate-x-1/2 z-50",
|
|
@@ -188,7 +329,7 @@ const UnsavedChangesBar = ({ hasChanges, onSave, onReset, suppressed = false })
|
|
|
188
329
|
scale: .95,
|
|
189
330
|
y: 20
|
|
190
331
|
},
|
|
191
|
-
transition: spring$
|
|
332
|
+
transition: spring$4,
|
|
192
333
|
style: { willChange: "opacity, transform" },
|
|
193
334
|
className: "flex items-center gap-1.5 rounded-xl bg-zinc-900 dark:bg-[oklch(0.940_0.008_231)] shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_8px_24px_-4px_rgba(0,0,0,0.25),0_20px_50px_-8px_rgba(0,0,0,0.20)] dark:shadow-[0_0_0_1px_rgba(0,0,0,0.08),0_8px_20px_-4px_rgba(0,0,0,0.10),0_20px_50px_-8px_rgba(0,0,0,0.08)] pl-3 pr-1.5 py-1.5",
|
|
194
335
|
children: [
|
|
@@ -517,7 +658,7 @@ const AvatarGroupCount = ({ className, ...props }) => {
|
|
|
517
658
|
|
|
518
659
|
//#endregion
|
|
519
660
|
//#region src/components/ui/alert/alert.tsx
|
|
520
|
-
const spring$
|
|
661
|
+
const spring$3 = {
|
|
521
662
|
bounce: 0,
|
|
522
663
|
duration: .35,
|
|
523
664
|
type: "spring"
|
|
@@ -589,7 +730,7 @@ const Alert = ({ variant = "neutral", title, children, dismissible = false, onDi
|
|
|
589
730
|
type: "button",
|
|
590
731
|
"aria-label": "Dismiss",
|
|
591
732
|
whileTap: shouldReduceMotion ? void 0 : { scale: .96 },
|
|
592
|
-
transition: spring$
|
|
733
|
+
transition: spring$3,
|
|
593
734
|
onClick: () => {
|
|
594
735
|
setDismissed(true);
|
|
595
736
|
onDismiss?.();
|
|
@@ -833,7 +974,8 @@ const Checkbox = ({ className, ...props }) => {
|
|
|
833
974
|
className: "relative grid place-content-center text-current size-full",
|
|
834
975
|
forceMount: true,
|
|
835
976
|
children: [/* @__PURE__ */ jsx("svg", {
|
|
836
|
-
|
|
977
|
+
"aria-hidden": "true",
|
|
978
|
+
className: "size-3.5 text-current absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=indeterminate]:opacity-100 group-data-[state=indeterminate]:scale-100 group-data-[state=indeterminate]:blur-none",
|
|
837
979
|
viewBox: "0 0 24 24",
|
|
838
980
|
fill: "none",
|
|
839
981
|
stroke: "currentColor",
|
|
@@ -845,7 +987,8 @@ const Checkbox = ({ className, ...props }) => {
|
|
|
845
987
|
strokeWidth: 3
|
|
846
988
|
})
|
|
847
989
|
}), /* @__PURE__ */ jsx("svg", {
|
|
848
|
-
|
|
990
|
+
"aria-hidden": "true",
|
|
991
|
+
className: "size-3.5 text-current absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=checked]:opacity-100 group-data-[state=checked]:scale-100 group-data-[state=checked]:blur-none",
|
|
849
992
|
viewBox: "0 0 24 24",
|
|
850
993
|
fill: "none",
|
|
851
994
|
stroke: "currentColor",
|
|
@@ -1077,13 +1220,37 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ jsx(PopoverPrimitive.Anc
|
|
|
1077
1220
|
|
|
1078
1221
|
//#endregion
|
|
1079
1222
|
//#region src/components/ui/combobox/combobox.tsx
|
|
1223
|
+
/** cmdk value of the select-all row; never matches a real option. */
|
|
1224
|
+
const SELECT_ALL_VALUE = "__droplet-combobox-select-all__";
|
|
1225
|
+
/**
|
|
1226
|
+
* Decorative `Checkbox` inside a multi-select option. The option row is the
|
|
1227
|
+
* control: it owns focus, the click target and the checked state for
|
|
1228
|
+
* assistive tech, so the checkbox is hidden from them and ignores pointer
|
|
1229
|
+
* events to avoid a second tab stop or a second announcement.
|
|
1230
|
+
*/
|
|
1231
|
+
const OptionCheckbox = ({ checked }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
1232
|
+
checked,
|
|
1233
|
+
"aria-hidden": true,
|
|
1234
|
+
tabIndex: -1,
|
|
1235
|
+
className: "pointer-events-none after:hidden in-data-[selected=true]:data-[state=unchecked]:shadow-[var(--shadow-control-hover)]"
|
|
1236
|
+
});
|
|
1237
|
+
/** Checkbox state of the select-all row: indeterminate while only some are selected. */
|
|
1238
|
+
const getSelectAllState = ({ selectedCount, totalCount }) => {
|
|
1239
|
+
if (selectedCount === 0) return false;
|
|
1240
|
+
if (selectedCount === totalCount) return true;
|
|
1241
|
+
return "indeterminate";
|
|
1242
|
+
};
|
|
1080
1243
|
/**
|
|
1081
|
-
* Searchable single-select
|
|
1244
|
+
* Searchable Combobox, single-select by default or multi-select with `multiple`.
|
|
1082
1245
|
*
|
|
1083
|
-
* Composes `Popover`, `
|
|
1084
|
-
* The trigger is
|
|
1085
|
-
* signals open/closed state.
|
|
1086
|
-
*
|
|
1246
|
+
* Composes `Popover`, `Command` and `Checkbox` from the droplet design system.
|
|
1247
|
+
* The trigger is styled like `SelectTrigger` with a rotating chevron that
|
|
1248
|
+
* signals open/closed state.
|
|
1249
|
+
*
|
|
1250
|
+
* - Single-select: picking an item closes the popover, fires `onValueChange`
|
|
1251
|
+
* and shows a check mark next to the active selection.
|
|
1252
|
+
* - Multi-select: each option shows a `Checkbox`, picking an item toggles it
|
|
1253
|
+
* and keeps the popover open, and the trigger lists the selected labels.
|
|
1087
1254
|
*
|
|
1088
1255
|
* @example
|
|
1089
1256
|
* ```tsx
|
|
@@ -1094,18 +1261,49 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ jsx(PopoverPrimitive.Anc
|
|
|
1094
1261
|
* onValueChange={setChain}
|
|
1095
1262
|
* placeholder="Select a chain"
|
|
1096
1263
|
* />
|
|
1264
|
+
*
|
|
1265
|
+
* const [chains, setChains] = useState<string[]>([]);
|
|
1266
|
+
* <Combobox
|
|
1267
|
+
* multiple
|
|
1268
|
+
* options={[{ value: 'eth', label: 'Ethereum' }, { value: 'sol', label: 'Solana' }]}
|
|
1269
|
+
* value={chains}
|
|
1270
|
+
* onValueChange={setChains}
|
|
1271
|
+
* selectAllLabel="All chains"
|
|
1272
|
+
* />
|
|
1097
1273
|
* ```
|
|
1098
1274
|
*/
|
|
1099
|
-
const Combobox = (
|
|
1275
|
+
const Combobox = (props) => {
|
|
1276
|
+
const { options, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", className, disabled = false } = props;
|
|
1100
1277
|
const [open, setOpen] = useState(false);
|
|
1101
|
-
const
|
|
1278
|
+
const [search, setSearch] = useState("");
|
|
1279
|
+
const selectedValues = props.multiple ? props.value : [props.value];
|
|
1280
|
+
const selectedOptions = options.filter((opt) => selectedValues.includes(opt.value));
|
|
1281
|
+
const selectedLabels = selectedOptions.map((opt) => opt.label);
|
|
1282
|
+
const selectedLabel = props.multiple && props.formatSelected && selectedLabels.length > 0 ? props.formatSelected(selectedLabels) : selectedLabels.join(", ") || void 0;
|
|
1283
|
+
const selectAllState = getSelectAllState({
|
|
1284
|
+
selectedCount: selectedOptions.length,
|
|
1285
|
+
totalCount: options.length
|
|
1286
|
+
});
|
|
1287
|
+
const showSelectAll = props.multiple && props.selectAllLabel !== void 0 && search === "";
|
|
1102
1288
|
const handleSelect = (selectedValue) => {
|
|
1103
|
-
|
|
1104
|
-
|
|
1289
|
+
if (!props.multiple) {
|
|
1290
|
+
props.onValueChange(selectedValue);
|
|
1291
|
+
handleOpenChange(false);
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
props.onValueChange(props.value.includes(selectedValue) ? props.value.filter((v) => v !== selectedValue) : [...props.value, selectedValue]);
|
|
1295
|
+
};
|
|
1296
|
+
const handleSelectAll = () => {
|
|
1297
|
+
if (!props.multiple) return;
|
|
1298
|
+
props.onValueChange(selectAllState === true ? [] : options.map((opt) => opt.value));
|
|
1299
|
+
};
|
|
1300
|
+
const handleOpenChange = (nextOpen) => {
|
|
1301
|
+
setOpen(nextOpen);
|
|
1302
|
+
if (!nextOpen) setSearch("");
|
|
1105
1303
|
};
|
|
1106
1304
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
1107
1305
|
open,
|
|
1108
|
-
onOpenChange:
|
|
1306
|
+
onOpenChange: handleOpenChange,
|
|
1109
1307
|
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
1110
1308
|
asChild: true,
|
|
1111
1309
|
children: /* @__PURE__ */ jsxs("button", {
|
|
@@ -1130,12 +1328,32 @@ const Combobox = ({ options, value, onValueChange, placeholder = "Select…", se
|
|
|
1130
1328
|
sideOffset: 4,
|
|
1131
1329
|
children: /* @__PURE__ */ jsxs(Command, {
|
|
1132
1330
|
className: "rounded-[inherit]",
|
|
1133
|
-
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1331
|
+
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
1332
|
+
placeholder: searchPlaceholder,
|
|
1333
|
+
value: search,
|
|
1334
|
+
onValueChange: setSearch
|
|
1335
|
+
}), /* @__PURE__ */ jsxs(CommandList, {
|
|
1336
|
+
"aria-multiselectable": props.multiple || void 0,
|
|
1337
|
+
children: [
|
|
1338
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }),
|
|
1339
|
+
showSelectAll && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(CommandItem, {
|
|
1340
|
+
value: SELECT_ALL_VALUE,
|
|
1341
|
+
"aria-checked": selectAllState === "indeterminate" ? "mixed" : selectAllState,
|
|
1342
|
+
onSelect: handleSelectAll,
|
|
1343
|
+
children: [/* @__PURE__ */ jsx(OptionCheckbox, { checked: selectAllState }), props.selectAllLabel]
|
|
1344
|
+
}), /* @__PURE__ */ jsx(CommandSeparator, { className: "my-1" })] }),
|
|
1345
|
+
options.map((opt) => {
|
|
1346
|
+
const isSelected = selectedValues.includes(opt.value);
|
|
1347
|
+
return /* @__PURE__ */ jsxs(CommandItem, {
|
|
1348
|
+
value: opt.value,
|
|
1349
|
+
keywords: [opt.label],
|
|
1350
|
+
"aria-checked": props.multiple ? isSelected : void 0,
|
|
1351
|
+
onSelect: handleSelect,
|
|
1352
|
+
children: [props.multiple ? /* @__PURE__ */ jsx(OptionCheckbox, { checked: isSelected }) : /* @__PURE__ */ jsx(CheckIcon, { className: cn("shrink-0", isSelected ? "opacity-100" : "opacity-0") }), opt.label]
|
|
1353
|
+
}, opt.value);
|
|
1354
|
+
})
|
|
1355
|
+
]
|
|
1356
|
+
})]
|
|
1139
1357
|
})
|
|
1140
1358
|
})]
|
|
1141
1359
|
});
|
|
@@ -1217,11 +1435,11 @@ DropdownMenuSubContent.displayName = SubContent.displayName;
|
|
|
1217
1435
|
|
|
1218
1436
|
//#endregion
|
|
1219
1437
|
//#region src/components/ui/well/well.tsx
|
|
1220
|
-
|
|
1438
|
+
/** The Well's one look plus the rhythm knobs (`gap`, `spacing`). */
|
|
1439
|
+
const wellVariants = cva("rounded-xl flex flex-col bg-muted/50 border border-border", {
|
|
1221
1440
|
defaultVariants: {
|
|
1222
1441
|
gap: "sm",
|
|
1223
|
-
spacing: "default"
|
|
1224
|
-
variant: "inset"
|
|
1442
|
+
spacing: "default"
|
|
1225
1443
|
},
|
|
1226
1444
|
variants: {
|
|
1227
1445
|
gap: {
|
|
@@ -1235,21 +1453,29 @@ const wellVariants = cva("rounded-xl flex flex-col", {
|
|
|
1235
1453
|
lg: "p-5",
|
|
1236
1454
|
none: "p-0",
|
|
1237
1455
|
sm: "p-3"
|
|
1238
|
-
},
|
|
1239
|
-
variant: {
|
|
1240
|
-
default: "bg-muted/50",
|
|
1241
|
-
inset: "bg-muted/50 border border-border",
|
|
1242
|
-
outline: "border border-border"
|
|
1243
1456
|
}
|
|
1244
1457
|
}
|
|
1245
1458
|
});
|
|
1246
|
-
|
|
1459
|
+
/**
|
|
1460
|
+
* The muted surface that holds the settings a toggle reveals. Put it inside `WellReveal`
|
|
1461
|
+
* or a `FlushCardStack.Item`. It has one look; `gap` and `spacing` only tune its rhythm.
|
|
1462
|
+
*
|
|
1463
|
+
* @example
|
|
1464
|
+
* ```tsx
|
|
1465
|
+
* <WellReveal open={emailOn}>
|
|
1466
|
+
* <Well>{rows}</Well>
|
|
1467
|
+
* </WellReveal>
|
|
1468
|
+
* ```
|
|
1469
|
+
* @returns The rendered surface.
|
|
1470
|
+
* @see WellReveal
|
|
1471
|
+
* @see FlushCardStack
|
|
1472
|
+
*/
|
|
1473
|
+
const Well = ({ className, gap, spacing, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
1247
1474
|
"data-slot": "well",
|
|
1248
1475
|
"data-spacing": spacing ?? "default",
|
|
1249
1476
|
className: cn(wellVariants({
|
|
1250
1477
|
gap,
|
|
1251
|
-
spacing
|
|
1252
|
-
variant
|
|
1478
|
+
spacing
|
|
1253
1479
|
}), className),
|
|
1254
1480
|
...props
|
|
1255
1481
|
});
|
|
@@ -1389,9 +1615,337 @@ const Icon = (props) => {
|
|
|
1389
1615
|
});
|
|
1390
1616
|
};
|
|
1391
1617
|
|
|
1618
|
+
//#endregion
|
|
1619
|
+
//#region src/components/ui/input/input.tsx
|
|
1620
|
+
const shaderDefaults = {
|
|
1621
|
+
bloom: 0,
|
|
1622
|
+
colors: [
|
|
1623
|
+
"#BDDCFF",
|
|
1624
|
+
"#57A7FF",
|
|
1625
|
+
"#DEEAFC"
|
|
1626
|
+
],
|
|
1627
|
+
inset: 1,
|
|
1628
|
+
intensity: 0,
|
|
1629
|
+
pulse: .3,
|
|
1630
|
+
roundness: .6,
|
|
1631
|
+
scale: 1,
|
|
1632
|
+
smoke: .75,
|
|
1633
|
+
smokeSize: .7,
|
|
1634
|
+
softness: .6,
|
|
1635
|
+
speed: 2.2,
|
|
1636
|
+
spots: 8,
|
|
1637
|
+
spotSize: .75,
|
|
1638
|
+
thickness: .04
|
|
1639
|
+
};
|
|
1640
|
+
const spring$2 = {
|
|
1641
|
+
bounce: 0,
|
|
1642
|
+
duration: .35,
|
|
1643
|
+
type: "spring"
|
|
1644
|
+
};
|
|
1645
|
+
const Input = forwardRef(({ className, type, shaderBorder, style, ...props }, ref) => {
|
|
1646
|
+
const prefersReducedMotion = useReducedMotion();
|
|
1647
|
+
const inputClassName = cn("file:text-foreground placeholder:text-muted-foreground/60 selection:bg-primary selection:text-primary-foreground dark:bg-input/30 h-8 w-full min-w-0 touch-manipulation rounded-md border-0 bg-background px-3 py-1 text-base shadow-[var(--shadow-input)] transition-[color,box-shadow] duration-100 ease-out outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "hover:shadow-[var(--shadow-input-hover)]", "focus-visible:shadow-[0_0_0_1px_var(--ring),0_0_0_4px_var(--ring-halo,#0072EF26)]", "aria-invalid:shadow-[0_0_0_1px_var(--destructive),0_0_1px_0_var(--destructive)] dark:aria-invalid:shadow-[0_0_0_1px_var(--destructive)]", className);
|
|
1648
|
+
const isActive = !!shaderBorder;
|
|
1649
|
+
const config = typeof shaderBorder === "object" ? {
|
|
1650
|
+
...shaderDefaults,
|
|
1651
|
+
...shaderBorder
|
|
1652
|
+
} : shaderDefaults;
|
|
1653
|
+
const inset = config.inset;
|
|
1654
|
+
if (shaderBorder !== void 0) return /* @__PURE__ */ jsxs("div", {
|
|
1655
|
+
className: "relative",
|
|
1656
|
+
children: [/* @__PURE__ */ jsx(AnimatePresence, {
|
|
1657
|
+
initial: false,
|
|
1658
|
+
children: isActive && /* @__PURE__ */ jsx(motion.div, {
|
|
1659
|
+
initial: prefersReducedMotion ? false : { opacity: 0 },
|
|
1660
|
+
animate: { opacity: 1 },
|
|
1661
|
+
exit: { opacity: 0 },
|
|
1662
|
+
transition: prefersReducedMotion ? { duration: 0 } : spring$2,
|
|
1663
|
+
className: "absolute pointer-events-none z-20",
|
|
1664
|
+
style: {
|
|
1665
|
+
borderRadius: `${8 + inset}px`,
|
|
1666
|
+
inset: `-${inset}px`,
|
|
1667
|
+
willChange: "opacity"
|
|
1668
|
+
},
|
|
1669
|
+
children: /* @__PURE__ */ jsx(PulsingBorder, {
|
|
1670
|
+
colorBack: "#00000000",
|
|
1671
|
+
colors: config.colors,
|
|
1672
|
+
speed: config.speed,
|
|
1673
|
+
scale: config.scale,
|
|
1674
|
+
roundness: config.roundness,
|
|
1675
|
+
thickness: config.thickness,
|
|
1676
|
+
softness: config.softness,
|
|
1677
|
+
intensity: config.intensity,
|
|
1678
|
+
bloom: config.bloom,
|
|
1679
|
+
spots: config.spots,
|
|
1680
|
+
spotSize: config.spotSize,
|
|
1681
|
+
pulse: config.pulse,
|
|
1682
|
+
smoke: config.smoke,
|
|
1683
|
+
smokeSize: config.smokeSize,
|
|
1684
|
+
webGlContextAttributes: {
|
|
1685
|
+
alpha: true,
|
|
1686
|
+
premultipliedAlpha: true
|
|
1687
|
+
},
|
|
1688
|
+
className: "size-full",
|
|
1689
|
+
style: { borderRadius: `${8 + inset}px` }
|
|
1690
|
+
})
|
|
1691
|
+
}, "shader-border")
|
|
1692
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
1693
|
+
ref,
|
|
1694
|
+
type,
|
|
1695
|
+
"data-slot": "input",
|
|
1696
|
+
className: cn(inputClassName, isActive && "animate-shimmer motion-reduce:animate-none", isActive && "focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ring)]"),
|
|
1697
|
+
style: isActive ? {
|
|
1698
|
+
backgroundClip: "text",
|
|
1699
|
+
backgroundImage: `linear-gradient(to right, color-mix(in srgb, ${config.colors[0]} 70%, #000), color-mix(in srgb, ${config.colors[1] || config.colors[0]} 70%, #000), color-mix(in srgb, ${config.colors[2] || config.colors[0]} 70%, #000), color-mix(in srgb, ${config.colors[0]} 70%, #000))`,
|
|
1700
|
+
backgroundSize: "200% 100%",
|
|
1701
|
+
boxShadow: "none",
|
|
1702
|
+
color: "transparent",
|
|
1703
|
+
WebkitBackgroundClip: "text",
|
|
1704
|
+
...style
|
|
1705
|
+
} : style,
|
|
1706
|
+
...props
|
|
1707
|
+
})]
|
|
1708
|
+
});
|
|
1709
|
+
return /* @__PURE__ */ jsx("input", {
|
|
1710
|
+
ref,
|
|
1711
|
+
type,
|
|
1712
|
+
"data-slot": "input",
|
|
1713
|
+
className: inputClassName,
|
|
1714
|
+
style,
|
|
1715
|
+
...props
|
|
1716
|
+
});
|
|
1717
|
+
});
|
|
1718
|
+
Input.displayName = "Input";
|
|
1719
|
+
|
|
1720
|
+
//#endregion
|
|
1721
|
+
//#region src/components/ui/label/label.tsx
|
|
1722
|
+
const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
|
|
1723
|
+
/**
|
|
1724
|
+
* The text label for a form control.
|
|
1725
|
+
*
|
|
1726
|
+
* `Label` carries no spacing of its own. To label a form control, wrap the
|
|
1727
|
+
* control in `Field` and pass `label`: `Field` sets the gap between the label
|
|
1728
|
+
* and the control and wires up `htmlFor`. A bare `Label` placed next to a
|
|
1729
|
+
* control ends up at whatever gap its parent happens to use.
|
|
1730
|
+
*
|
|
1731
|
+
* @example
|
|
1732
|
+
* ```tsx
|
|
1733
|
+
* <Field label="Email">
|
|
1734
|
+
* <Input type="email" />
|
|
1735
|
+
* </Field>
|
|
1736
|
+
* ```
|
|
1737
|
+
*/
|
|
1738
|
+
const Label = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Root$4, {
|
|
1739
|
+
ref,
|
|
1740
|
+
className: cn(labelVariants(), className),
|
|
1741
|
+
...props
|
|
1742
|
+
}));
|
|
1743
|
+
Label.displayName = Root$4.displayName;
|
|
1744
|
+
|
|
1745
|
+
//#endregion
|
|
1746
|
+
//#region src/components/ui/field/field-control-context.ts
|
|
1747
|
+
/**
|
|
1748
|
+
* Carries a `Field`'s control attributes to a control that renders its focusable
|
|
1749
|
+
* element deeper than `Field`'s direct child.
|
|
1750
|
+
*
|
|
1751
|
+
* `Field` injects `id` and the `aria-*` attributes onto its direct child. That
|
|
1752
|
+
* works for `Input` and `Textarea`, but `Select` renders no element of its own,
|
|
1753
|
+
* so `SelectTrigger` reads them from here instead.
|
|
1754
|
+
*/
|
|
1755
|
+
const FieldControlContext = createContext(null);
|
|
1756
|
+
|
|
1757
|
+
//#endregion
|
|
1758
|
+
//#region src/components/ui/select/select.tsx
|
|
1759
|
+
const Select = ({ ...props }) => /* @__PURE__ */ jsx(Root$5, {
|
|
1760
|
+
"data-slot": "select",
|
|
1761
|
+
...props
|
|
1762
|
+
});
|
|
1763
|
+
const SelectGroup = ({ ...props }) => /* @__PURE__ */ jsx(Group$1, {
|
|
1764
|
+
"data-slot": "select-group",
|
|
1765
|
+
...props
|
|
1766
|
+
});
|
|
1767
|
+
const SelectValue = ({ ...props }) => /* @__PURE__ */ jsx(Value, {
|
|
1768
|
+
"data-slot": "select-value",
|
|
1769
|
+
...props
|
|
1770
|
+
});
|
|
1771
|
+
const SelectTrigger = ({ className, size = "default", children, ...props }) => {
|
|
1772
|
+
const fieldControlProps = useContext(FieldControlContext);
|
|
1773
|
+
return /* @__PURE__ */ jsxs(Trigger$4, {
|
|
1774
|
+
...fieldControlProps,
|
|
1775
|
+
"data-slot": "select-trigger",
|
|
1776
|
+
"data-size": size,
|
|
1777
|
+
className: cn("data-[placeholder]:text-muted-foreground/60 [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit touch-manipulation items-center justify-between gap-1.5 rounded-md border-0 bg-transparent px-3 py-2 text-[13px] whitespace-nowrap shadow-[var(--shadow-input)] hover:shadow-[var(--shadow-input-hover)] transition-[color,box-shadow] duration-100 ease-out outline-none focus-visible:shadow-[0_0_0_1px_var(--ring),0_0_0_4px_var(--ring-halo,#0072EF26)] aria-invalid:shadow-[0_0_0_1px_var(--destructive)] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:text-[13px] data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[state=open]:[&>svg:last-of-type]:rotate-180", className),
|
|
1778
|
+
...props,
|
|
1779
|
+
...fieldControlProps ? { id: fieldControlProps.id } : {},
|
|
1780
|
+
children: [children, /* @__PURE__ */ jsx(Icon$1, {
|
|
1781
|
+
asChild: true,
|
|
1782
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1783
|
+
icon: ArrowDown01Icon,
|
|
1784
|
+
size: 16,
|
|
1785
|
+
className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
|
|
1786
|
+
})
|
|
1787
|
+
})]
|
|
1788
|
+
});
|
|
1789
|
+
};
|
|
1790
|
+
const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ jsx(Portal$3, { children: /* @__PURE__ */ jsxs(Content$4, {
|
|
1791
|
+
"data-slot": "select-content",
|
|
1792
|
+
className: cn("bg-popover text-popover-foreground will-change-[opacity,transform] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-0 shadow-[var(--shadow-elevated)]", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
1793
|
+
position,
|
|
1794
|
+
align,
|
|
1795
|
+
...props,
|
|
1796
|
+
children: [
|
|
1797
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
1798
|
+
/* @__PURE__ */ jsx(Viewport, {
|
|
1799
|
+
className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
|
|
1800
|
+
children
|
|
1801
|
+
}),
|
|
1802
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
1803
|
+
]
|
|
1804
|
+
}) });
|
|
1805
|
+
const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ jsx(Label$2, {
|
|
1806
|
+
"data-slot": "select-label",
|
|
1807
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
1808
|
+
...props
|
|
1809
|
+
});
|
|
1810
|
+
const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ jsxs(Item$2, {
|
|
1811
|
+
"data-slot": "select-item",
|
|
1812
|
+
className: cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:font-medium [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
1813
|
+
...props,
|
|
1814
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1815
|
+
"data-slot": "select-item-indicator",
|
|
1816
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
1817
|
+
children: /* @__PURE__ */ jsx(ItemIndicator$1, { children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1818
|
+
icon: Tick01Icon,
|
|
1819
|
+
size: 14
|
|
1820
|
+
}) })
|
|
1821
|
+
}), /* @__PURE__ */ jsx(ItemText, { children })]
|
|
1822
|
+
});
|
|
1823
|
+
const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(Separator$2, {
|
|
1824
|
+
"data-slot": "select-separator",
|
|
1825
|
+
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
1826
|
+
...props
|
|
1827
|
+
});
|
|
1828
|
+
const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollUpButton, {
|
|
1829
|
+
"data-slot": "select-scroll-up-button",
|
|
1830
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1831
|
+
...props,
|
|
1832
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1833
|
+
icon: ArrowUp01Icon,
|
|
1834
|
+
size: 16,
|
|
1835
|
+
"aria-hidden": true
|
|
1836
|
+
})
|
|
1837
|
+
});
|
|
1838
|
+
const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollDownButton, {
|
|
1839
|
+
"data-slot": "select-scroll-down-button",
|
|
1840
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1841
|
+
...props,
|
|
1842
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1843
|
+
icon: ArrowDown01Icon,
|
|
1844
|
+
size: 16,
|
|
1845
|
+
"aria-hidden": true
|
|
1846
|
+
})
|
|
1847
|
+
});
|
|
1848
|
+
|
|
1849
|
+
//#endregion
|
|
1850
|
+
//#region src/components/ui/field/use-field-feedback.ts
|
|
1851
|
+
const EASE_OUT = "cubic-bezier(0.215, 0.61, 0.355, 1)";
|
|
1852
|
+
const EASE_IN_OUT = "cubic-bezier(0.645, 0.045, 0.355, 1)";
|
|
1853
|
+
const SHAKE_KEYFRAMES = [
|
|
1854
|
+
0,
|
|
1855
|
+
-4,
|
|
1856
|
+
3.5,
|
|
1857
|
+
-2,
|
|
1858
|
+
1,
|
|
1859
|
+
0
|
|
1860
|
+
].map((offset) => ({
|
|
1861
|
+
easing: EASE_IN_OUT,
|
|
1862
|
+
transform: `translateX(${offset}px)`
|
|
1863
|
+
}));
|
|
1864
|
+
const SHAKE_TIMING = {
|
|
1865
|
+
duration: 300,
|
|
1866
|
+
easing: "linear"
|
|
1867
|
+
};
|
|
1868
|
+
const MESSAGE_KEYFRAMES = [{
|
|
1869
|
+
opacity: 0,
|
|
1870
|
+
transform: "translateY(-4px)"
|
|
1871
|
+
}, {
|
|
1872
|
+
opacity: 1,
|
|
1873
|
+
transform: "translateY(0)"
|
|
1874
|
+
}];
|
|
1875
|
+
const MESSAGE_TIMING = {
|
|
1876
|
+
duration: 150,
|
|
1877
|
+
easing: EASE_OUT
|
|
1878
|
+
};
|
|
1879
|
+
const ERROR_HAPTIC_MS = 12;
|
|
1880
|
+
const CONTROL_SELECTOR = ":scope > :not([data-slot^=\"field-\"])";
|
|
1881
|
+
const ERROR_SELECTOR = ":scope > [data-slot=\"field-error\"]";
|
|
1882
|
+
const MESSAGE_SELECTOR = `${ERROR_SELECTOR}, :scope > [data-slot="field-description"]`;
|
|
1883
|
+
const tickHaptics = () => {
|
|
1884
|
+
if (window.matchMedia?.("(pointer: coarse)").matches) navigator.vibrate?.(ERROR_HAPTIC_MS);
|
|
1885
|
+
};
|
|
1886
|
+
const shakeControl = (wrapper) => {
|
|
1887
|
+
wrapper.querySelectorAll(CONTROL_SELECTOR).forEach((control) => {
|
|
1888
|
+
control.animate?.(SHAKE_KEYFRAMES, SHAKE_TIMING);
|
|
1889
|
+
});
|
|
1890
|
+
};
|
|
1891
|
+
/**
|
|
1892
|
+
* Plays a field's validation feedback and returns the ref for its wrapper.
|
|
1893
|
+
*
|
|
1894
|
+
* When an error appears, the control shakes, the message under it slides in,
|
|
1895
|
+
* and touch devices get a short haptic tick. Each later submit of the
|
|
1896
|
+
* surrounding `<form>` that leaves the error in place shakes and ticks again,
|
|
1897
|
+
* so every failed attempt is acknowledged. When the error clears, the
|
|
1898
|
+
* description slides back in. A change to the error's text alone swaps
|
|
1899
|
+
* instantly: it usually comes from re-validating while the user types, and
|
|
1900
|
+
* motion on every keystroke reads as noise. Nothing plays on first render, and
|
|
1901
|
+
* motion is skipped under `prefers-reduced-motion`.
|
|
1902
|
+
*
|
|
1903
|
+
* Uses the Web Animations API, so the feedback needs no stylesheet.
|
|
1904
|
+
*
|
|
1905
|
+
* @see Field
|
|
1906
|
+
* @see FieldControlContext
|
|
1907
|
+
*/
|
|
1908
|
+
const useFieldFeedback = ({ error }) => {
|
|
1909
|
+
const wrapperRef = useRef(null);
|
|
1910
|
+
const hasError = Boolean(error);
|
|
1911
|
+
const previousHasErrorRef = useRef(hasError);
|
|
1912
|
+
const prefersReducedMotion = useReducedMotion();
|
|
1913
|
+
const prefersReducedMotionRef = useRef(prefersReducedMotion);
|
|
1914
|
+
prefersReducedMotionRef.current = prefersReducedMotion;
|
|
1915
|
+
useEffect(() => {
|
|
1916
|
+
if (previousHasErrorRef.current === hasError) return;
|
|
1917
|
+
previousHasErrorRef.current = hasError;
|
|
1918
|
+
const wrapper = wrapperRef.current;
|
|
1919
|
+
if (!wrapper) return;
|
|
1920
|
+
if (hasError) tickHaptics();
|
|
1921
|
+
if (prefersReducedMotionRef.current) return;
|
|
1922
|
+
wrapper.querySelectorAll(MESSAGE_SELECTOR).forEach((message) => {
|
|
1923
|
+
message.animate?.(MESSAGE_KEYFRAMES, MESSAGE_TIMING);
|
|
1924
|
+
});
|
|
1925
|
+
if (hasError) shakeControl(wrapper);
|
|
1926
|
+
}, [hasError]);
|
|
1927
|
+
useEffect(() => {
|
|
1928
|
+
const form = wrapperRef.current?.closest("form");
|
|
1929
|
+
if (!form) return void 0;
|
|
1930
|
+
const handleSubmit = () => {
|
|
1931
|
+
const wrapper = wrapperRef.current;
|
|
1932
|
+
if (!wrapper?.querySelector(ERROR_SELECTOR)) return;
|
|
1933
|
+
requestAnimationFrame(() => {
|
|
1934
|
+
if (!wrapper.querySelector(ERROR_SELECTOR)) return;
|
|
1935
|
+
tickHaptics();
|
|
1936
|
+
if (!prefersReducedMotionRef.current) shakeControl(wrapper);
|
|
1937
|
+
});
|
|
1938
|
+
};
|
|
1939
|
+
form.addEventListener("submit", handleSubmit);
|
|
1940
|
+
return () => form.removeEventListener("submit", handleSubmit);
|
|
1941
|
+
}, []);
|
|
1942
|
+
return wrapperRef;
|
|
1943
|
+
};
|
|
1944
|
+
|
|
1392
1945
|
//#endregion
|
|
1393
1946
|
//#region src/components/ui/field/field.tsx
|
|
1394
|
-
const
|
|
1947
|
+
const FIELD_GAP_CLASS_NAME = "grid [--field-gap:6px] [--label-gap:10px] gap-[var(--field-gap)]";
|
|
1948
|
+
const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--label-gap)-var(--field-gap))]";
|
|
1395
1949
|
/**
|
|
1396
1950
|
* A generic labeled form-field wrapper.
|
|
1397
1951
|
*
|
|
@@ -1399,16 +1953,30 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
|
|
|
1399
1953
|
* an error message together with the correct `id`/`htmlFor`/`aria-describedby`
|
|
1400
1954
|
* associations so callers don't have to hand-assemble these.
|
|
1401
1955
|
*
|
|
1956
|
+
* Always wrap a form control in `Field` rather than pairing a bare `<Label>`
|
|
1957
|
+
* with it: `Field` owns the label-to-control gap (10px) and the gap to the
|
|
1958
|
+
* error (6px). Don't add helper text: the error is the only message under a
|
|
1959
|
+
* control.
|
|
1960
|
+
*
|
|
1402
1961
|
* When there is exactly one child element, `Field` uses `cloneElement` to
|
|
1403
1962
|
* inject:
|
|
1404
1963
|
* - `id` — links the label's `htmlFor` to the control
|
|
1964
|
+
* - `aria-labelledby` — names group controls such as `RadioGroup`, which a
|
|
1965
|
+
* `<label for>` cannot name
|
|
1405
1966
|
* - `aria-describedby` — references the description and/or error paragraph ids
|
|
1406
1967
|
* - `aria-invalid` — `true` when `error` is present
|
|
1407
1968
|
*
|
|
1969
|
+
* When an error appears, the control shakes, the message slides in, and
|
|
1970
|
+
* touch devices get a short haptic tick. Motion is skipped under
|
|
1971
|
+
* `prefers-reduced-motion` and never plays on first render.
|
|
1972
|
+
*
|
|
1973
|
+
* `Select` renders no element of its own, so `SelectTrigger` picks up `id`,
|
|
1974
|
+
* `aria-describedby` and `aria-invalid` from `Field` instead.
|
|
1975
|
+
*
|
|
1408
1976
|
* @example
|
|
1409
1977
|
* ```tsx
|
|
1410
|
-
* <Field label="Email"
|
|
1411
|
-
* <Input type="email" />
|
|
1978
|
+
* <Field label="Email" required>
|
|
1979
|
+
* <Input type="email" required />
|
|
1412
1980
|
* </Field>
|
|
1413
1981
|
*
|
|
1414
1982
|
* <Field label="Email" error="Enter a valid email address.">
|
|
@@ -1417,25 +1985,41 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
|
|
|
1417
1985
|
* ```
|
|
1418
1986
|
*/
|
|
1419
1987
|
const Field = ({ label, description, error, required, htmlFor, children, className }) => {
|
|
1988
|
+
const childArray = Children.toArray(children);
|
|
1989
|
+
const singleChild = childArray.length === 1 && isValidElement(childArray[0]) ? childArray[0] : null;
|
|
1990
|
+
const childId = (singleChild?.props)?.id;
|
|
1420
1991
|
const generatedId = useId();
|
|
1421
|
-
const
|
|
1992
|
+
const wrapperRef = useFieldFeedback({ error });
|
|
1993
|
+
const controlId = (typeof childId === "string" ? childId : void 0) ?? htmlFor ?? generatedId;
|
|
1422
1994
|
const descriptionId = `${controlId}-description`;
|
|
1423
1995
|
const errorId = `${controlId}-error`;
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
const
|
|
1996
|
+
const labelId = label ? `${controlId}-label` : void 0;
|
|
1997
|
+
const showDescription = Boolean(description) && !error;
|
|
1998
|
+
let ariaDescribedBy;
|
|
1999
|
+
if (error) ariaDescribedBy = errorId;
|
|
2000
|
+
else if (showDescription) ariaDescribedBy = descriptionId;
|
|
2001
|
+
const hasError = Boolean(error);
|
|
2002
|
+
const controlProps = useMemo(() => ({
|
|
2003
|
+
"aria-describedby": ariaDescribedBy,
|
|
2004
|
+
id: controlId,
|
|
2005
|
+
...hasError ? { "aria-invalid": true } : {}
|
|
2006
|
+
}), [
|
|
2007
|
+
ariaDescribedBy,
|
|
2008
|
+
controlId,
|
|
2009
|
+
hasError
|
|
2010
|
+
]);
|
|
1430
2011
|
const enrichedChild = singleChild ? cloneElement(singleChild, {
|
|
1431
2012
|
"aria-describedby": singleChild.props["aria-describedby"] ?? ariaDescribedBy,
|
|
1432
|
-
|
|
2013
|
+
"aria-labelledby": singleChild.props["aria-labelledby"] ?? labelId,
|
|
2014
|
+
id: controlId,
|
|
1433
2015
|
...error ? { "aria-invalid": true } : {}
|
|
1434
2016
|
}) : null;
|
|
1435
2017
|
return /* @__PURE__ */ jsxs("div", {
|
|
1436
|
-
|
|
2018
|
+
ref: wrapperRef,
|
|
2019
|
+
className: cn(FIELD_GAP_CLASS_NAME, className),
|
|
1437
2020
|
children: [
|
|
1438
2021
|
label && /* @__PURE__ */ jsxs(Label, {
|
|
2022
|
+
id: labelId,
|
|
1439
2023
|
htmlFor: controlId,
|
|
1440
2024
|
"data-slot": "field-label",
|
|
1441
2025
|
className: LABEL_GAP_CLASS_NAME,
|
|
@@ -1445,14 +2029,19 @@ const Field = ({ label, description, error, required, htmlFor, children, classNa
|
|
|
1445
2029
|
children: "*"
|
|
1446
2030
|
})]
|
|
1447
2031
|
}),
|
|
1448
|
-
|
|
1449
|
-
|
|
2032
|
+
/* @__PURE__ */ jsx(FieldControlContext.Provider, {
|
|
2033
|
+
value: singleChild?.type === Select ? controlProps : null,
|
|
2034
|
+
children: enrichedChild ?? children
|
|
2035
|
+
}),
|
|
2036
|
+
showDescription && /* @__PURE__ */ jsx("p", {
|
|
1450
2037
|
id: descriptionId,
|
|
2038
|
+
"data-slot": "field-description",
|
|
1451
2039
|
className: "text-sm text-muted-foreground",
|
|
1452
2040
|
children: description
|
|
1453
2041
|
}),
|
|
1454
2042
|
error && /* @__PURE__ */ jsx("p", {
|
|
1455
2043
|
id: errorId,
|
|
2044
|
+
"data-slot": "field-error",
|
|
1456
2045
|
role: "alert",
|
|
1457
2046
|
className: "text-sm text-[var(--text-danger)]",
|
|
1458
2047
|
children: error
|
|
@@ -1796,93 +2385,6 @@ const SearchInput = ({ className, placeholder = "Search...", shortcut = "⌘K",
|
|
|
1796
2385
|
});
|
|
1797
2386
|
};
|
|
1798
2387
|
|
|
1799
|
-
//#endregion
|
|
1800
|
-
//#region src/components/ui/select/select.tsx
|
|
1801
|
-
const Select = ({ ...props }) => /* @__PURE__ */ jsx(Root$4, {
|
|
1802
|
-
"data-slot": "select",
|
|
1803
|
-
...props
|
|
1804
|
-
});
|
|
1805
|
-
const SelectGroup = ({ ...props }) => /* @__PURE__ */ jsx(Group$1, {
|
|
1806
|
-
"data-slot": "select-group",
|
|
1807
|
-
...props
|
|
1808
|
-
});
|
|
1809
|
-
const SelectValue = ({ ...props }) => /* @__PURE__ */ jsx(Value, {
|
|
1810
|
-
"data-slot": "select-value",
|
|
1811
|
-
...props
|
|
1812
|
-
});
|
|
1813
|
-
const SelectTrigger = ({ className, size = "default", children, ...props }) => /* @__PURE__ */ jsxs(Trigger$4, {
|
|
1814
|
-
"data-slot": "select-trigger",
|
|
1815
|
-
"data-size": size,
|
|
1816
|
-
className: cn("data-[placeholder]:text-muted-foreground/60 [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit touch-manipulation items-center justify-between gap-1.5 rounded-md border-0 bg-transparent px-3 py-2 text-[13px] whitespace-nowrap shadow-[var(--shadow-input)] hover:shadow-[var(--shadow-input-hover)] transition-[color,box-shadow] duration-100 ease-out outline-none focus-visible:shadow-[0_0_0_1px_var(--ring),0_0_0_4px_var(--ring-halo,#0072EF26)] aria-invalid:shadow-[0_0_0_1px_var(--destructive)] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:text-[13px] data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[state=open]:[&>svg:last-of-type]:rotate-180", className),
|
|
1817
|
-
...props,
|
|
1818
|
-
children: [children, /* @__PURE__ */ jsx(Icon$1, {
|
|
1819
|
-
asChild: true,
|
|
1820
|
-
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1821
|
-
icon: ArrowDown01Icon,
|
|
1822
|
-
size: 16,
|
|
1823
|
-
className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
|
|
1824
|
-
})
|
|
1825
|
-
})]
|
|
1826
|
-
});
|
|
1827
|
-
const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ jsx(Portal$3, { children: /* @__PURE__ */ jsxs(Content$4, {
|
|
1828
|
-
"data-slot": "select-content",
|
|
1829
|
-
className: cn("bg-popover text-popover-foreground will-change-[opacity,transform] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-0 shadow-[var(--shadow-elevated)]", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
1830
|
-
position,
|
|
1831
|
-
align,
|
|
1832
|
-
...props,
|
|
1833
|
-
children: [
|
|
1834
|
-
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
1835
|
-
/* @__PURE__ */ jsx(Viewport, {
|
|
1836
|
-
className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
|
|
1837
|
-
children
|
|
1838
|
-
}),
|
|
1839
|
-
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
1840
|
-
]
|
|
1841
|
-
}) });
|
|
1842
|
-
const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ jsx(Label$2, {
|
|
1843
|
-
"data-slot": "select-label",
|
|
1844
|
-
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
1845
|
-
...props
|
|
1846
|
-
});
|
|
1847
|
-
const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ jsxs(Item$2, {
|
|
1848
|
-
"data-slot": "select-item",
|
|
1849
|
-
className: cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:font-medium [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
1850
|
-
...props,
|
|
1851
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1852
|
-
"data-slot": "select-item-indicator",
|
|
1853
|
-
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
1854
|
-
children: /* @__PURE__ */ jsx(ItemIndicator$1, { children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1855
|
-
icon: Tick01Icon,
|
|
1856
|
-
size: 14
|
|
1857
|
-
}) })
|
|
1858
|
-
}), /* @__PURE__ */ jsx(ItemText, { children })]
|
|
1859
|
-
});
|
|
1860
|
-
const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(Separator$2, {
|
|
1861
|
-
"data-slot": "select-separator",
|
|
1862
|
-
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
1863
|
-
...props
|
|
1864
|
-
});
|
|
1865
|
-
const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollUpButton, {
|
|
1866
|
-
"data-slot": "select-scroll-up-button",
|
|
1867
|
-
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1868
|
-
...props,
|
|
1869
|
-
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1870
|
-
icon: ArrowUp01Icon,
|
|
1871
|
-
size: 16,
|
|
1872
|
-
"aria-hidden": true
|
|
1873
|
-
})
|
|
1874
|
-
});
|
|
1875
|
-
const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollDownButton, {
|
|
1876
|
-
"data-slot": "select-scroll-down-button",
|
|
1877
|
-
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1878
|
-
...props,
|
|
1879
|
-
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1880
|
-
icon: ArrowDown01Icon,
|
|
1881
|
-
size: 16,
|
|
1882
|
-
"aria-hidden": true
|
|
1883
|
-
})
|
|
1884
|
-
});
|
|
1885
|
-
|
|
1886
2388
|
//#endregion
|
|
1887
2389
|
//#region src/components/ui/selectable-card/selectable-card.tsx
|
|
1888
2390
|
const SelectableCard = ({ badge, className, description, icon, iconSize = 20, label, selected, ...props }) => /* @__PURE__ */ jsxs("button", {
|
|
@@ -1927,14 +2429,14 @@ const SelectableCard = ({ badge, className, description, icon, iconSize = 20, la
|
|
|
1927
2429
|
|
|
1928
2430
|
//#endregion
|
|
1929
2431
|
//#region src/components/ui/separator/separator.tsx
|
|
1930
|
-
const Separator = forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(Root$
|
|
2432
|
+
const Separator = forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(Root$6, {
|
|
1931
2433
|
ref,
|
|
1932
2434
|
decorative,
|
|
1933
2435
|
orientation,
|
|
1934
2436
|
className: cn("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className),
|
|
1935
2437
|
...props
|
|
1936
2438
|
}));
|
|
1937
|
-
Separator.displayName = Root$
|
|
2439
|
+
Separator.displayName = Root$6.displayName;
|
|
1938
2440
|
|
|
1939
2441
|
//#endregion
|
|
1940
2442
|
//#region src/components/ui/slider/slider.tsx
|
|
@@ -2167,6 +2669,22 @@ const Stepper = ({ steps, currentStep, className, ...props }) => /* @__PURE__ */
|
|
|
2167
2669
|
})
|
|
2168
2670
|
});
|
|
2169
2671
|
|
|
2672
|
+
//#endregion
|
|
2673
|
+
//#region src/components/ui/switch/switch.tsx
|
|
2674
|
+
const Switch = forwardRef(({ className, size = "default", ...props }, ref) => /* @__PURE__ */ jsx(Root$7, {
|
|
2675
|
+
ref,
|
|
2676
|
+
"data-slot": "switch",
|
|
2677
|
+
"data-size": size,
|
|
2678
|
+
className: cn("peer data-[state=checked]:bg-(--action) data-[state=unchecked]:bg-input hover:data-[state=unchecked]:bg-[rgba(31,41,55,0.16)] group-hover/toggle:data-[state=unchecked]:bg-[rgba(31,41,55,0.16)] focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 dark:hover:data-[state=unchecked]:bg-[rgba(255,255,255,0.12)] dark:group-hover/toggle:data-[state=unchecked]:bg-[rgba(255,255,255,0.12)] relative group/switch inline-flex shrink-0 touch-manipulation items-center rounded-full border-0 shadow-[var(--shadow-control)] dark:shadow-[var(--shadow-control)] data-[state=checked]:shadow-[var(--shadow-control-checked)] dark:data-[state=checked]:shadow-[var(--shadow-control-checked)] transition-[color,background-color,box-shadow] duration-200 ease-out motion-reduce:transition-none outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer data-[size=default]:h-[18px] data-[size=default]:w-[30px] data-[size=sm]:h-3.5 data-[size=sm]:w-[22px] before:absolute before:-inset-[15px] before:content-['']", className),
|
|
2679
|
+
...props,
|
|
2680
|
+
children: /* @__PURE__ */ jsx(Thumb, {
|
|
2681
|
+
"data-slot": "switch-thumb",
|
|
2682
|
+
className: cn("pointer-events-none relative block ring-0", "transition-transform duration-200 ease-out motion-reduce:transition-none", "group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-2.5", "data-[state=unchecked]:translate-x-0.5 group-data-[size=default]/switch:data-[state=checked]:translate-x-[14px] group-data-[size=sm]/switch:data-[state=checked]:translate-x-[10px]"),
|
|
2683
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("absolute top-0 h-full rounded-full", "bg-background dark:group-data-[state=checked]/switch:bg-white dark:group-data-[state=unchecked]/switch:bg-[oklch(0.500_0.013_253)]", "shadow-[var(--shadow-control-thumb)] dark:shadow-[var(--shadow-control-thumb)]", "group-data-[size=default]/switch:w-3.5 group-data-[size=sm]/switch:w-2.5", "group-data-[state=checked]/switch:right-0 group-data-[state=unchecked]/switch:left-0", "group-[&[data-size=default]:active]/switch:w-[17px] group-[&[data-size=sm]:active]/switch:w-3", "transition-[width,background-color] duration-[120ms] ease-out motion-reduce:transition-none") })
|
|
2684
|
+
})
|
|
2685
|
+
}));
|
|
2686
|
+
Switch.displayName = "Switch";
|
|
2687
|
+
|
|
2170
2688
|
//#endregion
|
|
2171
2689
|
//#region src/components/ui/table/table.tsx
|
|
2172
2690
|
/** Keep overlay tracks clear of the shelf's rounded corners. */
|
|
@@ -2212,7 +2730,13 @@ const measureShelfTop = ({ scrollArea, table }) => {
|
|
|
2212
2730
|
const body = table?.tBodies[0];
|
|
2213
2731
|
return body ? body.getBoundingClientRect().top - scrollArea.getBoundingClientRect().top + scrollArea.scrollTop : 0;
|
|
2214
2732
|
};
|
|
2215
|
-
/**
|
|
2733
|
+
/**
|
|
2734
|
+
* Render a table in a stable tray with keyboard access only when content overflows.
|
|
2735
|
+
* For any list of records, use `DataTable`, which is built on this. Use `Table` directly
|
|
2736
|
+
* only for static layout: a short fixed grid of values that nobody sorts, filters, pages or selects.
|
|
2737
|
+
*
|
|
2738
|
+
* @deprecated For lists of records, use `DataTable`. Direct use is only for static layout.
|
|
2739
|
+
*/
|
|
2216
2740
|
const Table = ({ className, fill = false, scrollAreaProps = {}, stickyFirstColumn = false, viewportRef, ...props }) => {
|
|
2217
2741
|
const scrollAreaRef = useRef(null);
|
|
2218
2742
|
const setViewportRef = useMemo(() => mergeRefs(scrollAreaRef, viewportRef), [viewportRef]);
|
|
@@ -3953,7 +4477,7 @@ const Textarea = ({ className, ...props }) => {
|
|
|
3953
4477
|
//#endregion
|
|
3954
4478
|
//#region src/components/ui/tooltip/tooltip.tsx
|
|
3955
4479
|
const TooltipProvider = Provider;
|
|
3956
|
-
const Tooltip = Root$
|
|
4480
|
+
const Tooltip = Root$8;
|
|
3957
4481
|
const TooltipTrigger = Trigger$5;
|
|
3958
4482
|
const TooltipContent = forwardRef(({ children, className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Portal$4, { children: /* @__PURE__ */ jsxs(Content$5, {
|
|
3959
4483
|
ref,
|
|
@@ -4028,9 +4552,10 @@ const AssetIcon = ({ symbol, size = 32, className }) => {
|
|
|
4028
4552
|
//#endregion
|
|
4029
4553
|
//#region src/components/copy-button/copy-button.tsx
|
|
4030
4554
|
const TIMING = {
|
|
4031
|
-
|
|
4032
|
-
iconSwap:
|
|
4033
|
-
reset: 120
|
|
4555
|
+
errorHold: 2e3,
|
|
4556
|
+
iconSwap: 200,
|
|
4557
|
+
reset: 120,
|
|
4558
|
+
successHold: 1e3
|
|
4034
4559
|
};
|
|
4035
4560
|
const COPY_STAGE = {
|
|
4036
4561
|
copied: 1,
|
|
@@ -4038,12 +4563,18 @@ const COPY_STAGE = {
|
|
|
4038
4563
|
idle: 0
|
|
4039
4564
|
};
|
|
4040
4565
|
const ICON = {
|
|
4566
|
+
activeBlur: "blur(0px)",
|
|
4041
4567
|
activeScale: 1,
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4568
|
+
inactiveBlur: "blur(4px)",
|
|
4569
|
+
inactiveScale: .25,
|
|
4570
|
+
transition: {
|
|
4571
|
+
duration: TIMING.iconSwap / 1e3,
|
|
4572
|
+
ease: [
|
|
4573
|
+
.4,
|
|
4574
|
+
0,
|
|
4575
|
+
.2,
|
|
4576
|
+
1
|
|
4577
|
+
]
|
|
4047
4578
|
}
|
|
4048
4579
|
};
|
|
4049
4580
|
const LABEL = {
|
|
@@ -4064,6 +4595,7 @@ const HIDDEN_RESET_TRANSITION = {
|
|
|
4064
4595
|
duration: 0
|
|
4065
4596
|
};
|
|
4066
4597
|
const ICON_RESET_TRANSITION = {
|
|
4598
|
+
filter: HIDDEN_RESET_TRANSITION,
|
|
4067
4599
|
opacity: RESET_TRANSITION,
|
|
4068
4600
|
scale: HIDDEN_RESET_TRANSITION
|
|
4069
4601
|
};
|
|
@@ -4073,12 +4605,11 @@ const LABEL_RESET_TRANSITION = {
|
|
|
4073
4605
|
};
|
|
4074
4606
|
const REDUCED_MOTION_TRANSITION = { duration: 0 };
|
|
4075
4607
|
/** Copies a value and presents stable, accessible success or failure feedback. */
|
|
4076
|
-
const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", className }) => {
|
|
4608
|
+
const CopyButton = ({ value, ariaLabel: idleAriaLabel, label, variant = "outline", size = "icon-xs", className }) => {
|
|
4077
4609
|
const [stage, setStage] = useState(COPY_STAGE.idle);
|
|
4078
4610
|
const timeoutRef = useRef(null);
|
|
4079
4611
|
const requestIdRef = useRef(0);
|
|
4080
4612
|
const shouldReduceMotion = useReducedMotion();
|
|
4081
|
-
const animationStyle = { willChange: shouldReduceMotion ? "auto" : "transform, opacity" };
|
|
4082
4613
|
useEffect(() => {
|
|
4083
4614
|
return () => {
|
|
4084
4615
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
@@ -4087,7 +4618,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
4087
4618
|
const showFeedback = (nextStage) => {
|
|
4088
4619
|
setStage(nextStage);
|
|
4089
4620
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4090
|
-
timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), TIMING.
|
|
4621
|
+
timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), nextStage === COPY_STAGE.error ? TIMING.errorHold : TIMING.successHold);
|
|
4091
4622
|
};
|
|
4092
4623
|
const handleCopy = async () => {
|
|
4093
4624
|
const requestId = ++requestIdRef.current;
|
|
@@ -4098,7 +4629,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
4098
4629
|
if (requestId === requestIdRef.current) showFeedback(COPY_STAGE.error);
|
|
4099
4630
|
}
|
|
4100
4631
|
};
|
|
4101
|
-
let ariaLabel = label || "Copy to clipboard";
|
|
4632
|
+
let ariaLabel = idleAriaLabel || label || "Copy to clipboard";
|
|
4102
4633
|
let announcement = "";
|
|
4103
4634
|
if (stage === COPY_STAGE.copied) {
|
|
4104
4635
|
ariaLabel = "Copied";
|
|
@@ -4107,7 +4638,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
4107
4638
|
ariaLabel = "Copy failed";
|
|
4108
4639
|
announcement = "Copy failed";
|
|
4109
4640
|
}
|
|
4110
|
-
let iconTransition = ICON.
|
|
4641
|
+
let iconTransition = ICON.transition;
|
|
4111
4642
|
let labelTransition = LABEL.spring;
|
|
4112
4643
|
if (stage === COPY_STAGE.idle) {
|
|
4113
4644
|
iconTransition = ICON_RESET_TRANSITION;
|
|
@@ -4128,8 +4659,8 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
4128
4659
|
},
|
|
4129
4660
|
{
|
|
4130
4661
|
icon: /* @__PURE__ */ jsx(CheckIcon, {
|
|
4131
|
-
|
|
4132
|
-
|
|
4662
|
+
className: "[&_path]:[stroke-width:var(--icon-stroke-width,1.75)]",
|
|
4663
|
+
size: null
|
|
4133
4664
|
}),
|
|
4134
4665
|
label: label ? "Copied" : void 0,
|
|
4135
4666
|
stage: COPY_STAGE.copied
|
|
@@ -4159,17 +4690,18 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
4159
4690
|
className: "col-start-1 row-start-1 flex items-center gap-1.5",
|
|
4160
4691
|
children: [/* @__PURE__ */ jsx(motion.span, {
|
|
4161
4692
|
initial: false,
|
|
4693
|
+
"data-slot": visualState.stage === COPY_STAGE.copied ? "copy-button-check" : void 0,
|
|
4694
|
+
"data-state": isActive ? "checked" : "unchecked",
|
|
4162
4695
|
animate: {
|
|
4696
|
+
filter: isIdleVisual || isActive ? ICON.activeBlur : ICON.inactiveBlur,
|
|
4163
4697
|
opacity: isActive ? 1 : 0,
|
|
4164
4698
|
scale: isIdleVisual || isActive ? ICON.activeScale : ICON.inactiveScale
|
|
4165
4699
|
},
|
|
4166
4700
|
transition: iconTransition,
|
|
4167
|
-
style: animationStyle,
|
|
4168
4701
|
className: "flex items-center",
|
|
4169
4702
|
children: visualState.icon
|
|
4170
4703
|
}), visualState.label && /* @__PURE__ */ jsx(motion.span, {
|
|
4171
4704
|
initial: false,
|
|
4172
|
-
style: animationStyle,
|
|
4173
4705
|
animate: {
|
|
4174
4706
|
opacity: isActive ? 1 : 0,
|
|
4175
4707
|
y: isIdleVisual || isActive ? LABEL.activeOffset : LABEL.inactiveOffset
|
|
@@ -4394,7 +4926,7 @@ const DomainList = ({ className, domains, onChange, placeholder = "https://examp
|
|
|
4394
4926
|
children: domains.map((domain) => /* @__PURE__ */ jsxs("li", {
|
|
4395
4927
|
className: "flex items-center justify-between gap-2 rounded-md border bg-[var(--bg-bottom)] px-3 py-2 text-sm",
|
|
4396
4928
|
children: [/* @__PURE__ */ jsx("span", {
|
|
4397
|
-
className: "
|
|
4929
|
+
className: "text-sm tabular-nums truncate",
|
|
4398
4930
|
children: domain
|
|
4399
4931
|
}), /* @__PURE__ */ jsx("button", {
|
|
4400
4932
|
type: "button",
|
|
@@ -4697,47 +5229,6 @@ const SettingsSection = ({ title, description, children, variant = "default", cl
|
|
|
4697
5229
|
});
|
|
4698
5230
|
};
|
|
4699
5231
|
|
|
4700
|
-
//#endregion
|
|
4701
|
-
//#region src/components/status-badge/status-badge.tsx
|
|
4702
|
-
const statusConfig = {
|
|
4703
|
-
active: {
|
|
4704
|
-
label: "Active",
|
|
4705
|
-
variant: "success"
|
|
4706
|
-
},
|
|
4707
|
-
blocked: {
|
|
4708
|
-
label: "Blocked",
|
|
4709
|
-
variant: "danger"
|
|
4710
|
-
},
|
|
4711
|
-
inactive: {
|
|
4712
|
-
label: "Inactive",
|
|
4713
|
-
variant: "inactive"
|
|
4714
|
-
},
|
|
4715
|
-
live: {
|
|
4716
|
-
label: "Live",
|
|
4717
|
-
variant: "success"
|
|
4718
|
-
},
|
|
4719
|
-
pending: {
|
|
4720
|
-
label: "Pending",
|
|
4721
|
-
variant: "warning"
|
|
4722
|
-
},
|
|
4723
|
-
processing: {
|
|
4724
|
-
label: "Processing",
|
|
4725
|
-
variant: "process"
|
|
4726
|
-
},
|
|
4727
|
-
sandbox: {
|
|
4728
|
-
label: "Sandbox",
|
|
4729
|
-
variant: "warning"
|
|
4730
|
-
}
|
|
4731
|
-
};
|
|
4732
|
-
const StatusBadge = ({ status, label, className }) => {
|
|
4733
|
-
const config = statusConfig[status];
|
|
4734
|
-
return /* @__PURE__ */ jsx(Badge, {
|
|
4735
|
-
variant: config.variant,
|
|
4736
|
-
className,
|
|
4737
|
-
children: label || config.label
|
|
4738
|
-
});
|
|
4739
|
-
};
|
|
4740
|
-
|
|
4741
5232
|
//#endregion
|
|
4742
5233
|
//#region src/components/tab-navigation/tab-navigation.tsx
|
|
4743
5234
|
/**
|
|
@@ -4915,6 +5406,16 @@ const renderInput = (input, id) => {
|
|
|
4915
5406
|
})
|
|
4916
5407
|
});
|
|
4917
5408
|
};
|
|
5409
|
+
/**
|
|
5410
|
+
* DEPRECATED. Never use in new code. Use `FlushCardStack` with a `ToggleRow`
|
|
5411
|
+
* header instead; put sub-options in the item's reveal.
|
|
5412
|
+
*
|
|
5413
|
+
* Kept so existing callers keep rendering while they migrate.
|
|
5414
|
+
*
|
|
5415
|
+
* @deprecated Use `FlushCardStack` + `ToggleRow`.
|
|
5416
|
+
* @see FlushCardStack
|
|
5417
|
+
* @see ToggleRow
|
|
5418
|
+
*/
|
|
4918
5419
|
const ToggleCard = ({ accordionKey, title, description, inputProps, allowExpand = true, defaultExpanded, value, onValueChange, collapsible = true, Tags, RightSideTags, notification, actionLink, customActionIcon, onCardClick: _onCardClick, children, disabled, triggerTestId, className, triggerClassName }) => {
|
|
4919
5420
|
const generatedId = useId();
|
|
4920
5421
|
const inputId = inputProps?.id ?? generatedId;
|
|
@@ -5012,6 +5513,96 @@ const ToggleCard = ({ accordionKey, title, description, inputProps, allowExpand
|
|
|
5012
5513
|
});
|
|
5013
5514
|
};
|
|
5014
5515
|
|
|
5516
|
+
//#endregion
|
|
5517
|
+
//#region src/components/toggle-row/toggle-row.tsx
|
|
5518
|
+
/**
|
|
5519
|
+
* A single on/off setting: switch on the left, then label, description and
|
|
5520
|
+
* optional `Badge`. It has no surface of its own.
|
|
5521
|
+
*
|
|
5522
|
+
* Use it as the `header` of a `FlushCardStack.Item`, or on its own inside a
|
|
5523
|
+
* `Card`. Never put a `Well` under it directly; sub-options go in the
|
|
5524
|
+
* `FlushCardStack.Item` reveal.
|
|
5525
|
+
*
|
|
5526
|
+
* @see FlushCardStack
|
|
5527
|
+
* @see Switch
|
|
5528
|
+
*/
|
|
5529
|
+
const ToggleRow = (props) => {
|
|
5530
|
+
const { label, description, checked, onCheckedChange, disabled = false, switchPosition = "left", icon, badge, onSettings, children, className } = props;
|
|
5531
|
+
const switchId = useId();
|
|
5532
|
+
const descId = useId();
|
|
5533
|
+
const cursorClass = disabled ? "cursor-not-allowed" : "cursor-pointer";
|
|
5534
|
+
if (switchPosition === "left") return /* @__PURE__ */ jsxs("div", {
|
|
5535
|
+
className,
|
|
5536
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5537
|
+
className: cn("flex items-start gap-2.5 touch-manipulation group/toggle"),
|
|
5538
|
+
children: [
|
|
5539
|
+
/* @__PURE__ */ jsx(Switch, {
|
|
5540
|
+
id: switchId,
|
|
5541
|
+
"aria-describedby": description ? descId : void 0,
|
|
5542
|
+
checked,
|
|
5543
|
+
onCheckedChange,
|
|
5544
|
+
disabled,
|
|
5545
|
+
className: "mt-0.5"
|
|
5546
|
+
}),
|
|
5547
|
+
icon && /* @__PURE__ */ jsx("label", {
|
|
5548
|
+
htmlFor: switchId,
|
|
5549
|
+
className: cn("text-muted-foreground shrink-0 self-start", cursorClass),
|
|
5550
|
+
children: icon
|
|
5551
|
+
}),
|
|
5552
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5553
|
+
className: "flex-1 min-w-0",
|
|
5554
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
5555
|
+
className: "flex items-center gap-2",
|
|
5556
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
5557
|
+
htmlFor: switchId,
|
|
5558
|
+
className: cn("font-medium select-none", disabled && "text-muted-foreground", cursorClass),
|
|
5559
|
+
children: label
|
|
5560
|
+
}), badge]
|
|
5561
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
5562
|
+
id: descId,
|
|
5563
|
+
className: "text-sm text-muted-foreground mt-1 text-pretty",
|
|
5564
|
+
children: description
|
|
5565
|
+
})]
|
|
5566
|
+
})
|
|
5567
|
+
]
|
|
5568
|
+
}), children]
|
|
5569
|
+
});
|
|
5570
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5571
|
+
className: cn("space-y-3", className),
|
|
5572
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
5573
|
+
className: "flex items-center justify-between gap-4",
|
|
5574
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
5575
|
+
htmlFor: switchId,
|
|
5576
|
+
className: cn("text-sm font-medium select-none", cursorClass),
|
|
5577
|
+
children: label
|
|
5578
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5579
|
+
className: "flex items-center gap-2 shrink-0",
|
|
5580
|
+
children: [onSettings && checked && /* @__PURE__ */ jsx(Button, {
|
|
5581
|
+
variant: "ghost",
|
|
5582
|
+
size: "icon-xs",
|
|
5583
|
+
onClick: onSettings,
|
|
5584
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
5585
|
+
"aria-label": "Configure",
|
|
5586
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
5587
|
+
icon: Setting07Icon,
|
|
5588
|
+
size: 14
|
|
5589
|
+
})
|
|
5590
|
+
}), /* @__PURE__ */ jsx(Switch, {
|
|
5591
|
+
id: switchId,
|
|
5592
|
+
"aria-describedby": description ? descId : void 0,
|
|
5593
|
+
checked,
|
|
5594
|
+
onCheckedChange,
|
|
5595
|
+
disabled
|
|
5596
|
+
})]
|
|
5597
|
+
})]
|
|
5598
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
5599
|
+
id: descId,
|
|
5600
|
+
className: "text-sm text-muted-foreground mt-0.5 text-pretty",
|
|
5601
|
+
children: description
|
|
5602
|
+
})] }), checked && children && children]
|
|
5603
|
+
});
|
|
5604
|
+
};
|
|
5605
|
+
|
|
5015
5606
|
//#endregion
|
|
5016
5607
|
//#region src/components/icons/animated-icon/animated-icon.tsx
|
|
5017
5608
|
const AnimatedIcon = forwardRef(({ children, className, onMouseEnter, onMouseLeave, size = 28, ...props }, ref) => {
|
|
@@ -6599,5 +7190,5 @@ const UsersIcon = forwardRef((props, ref) => /* @__PURE__ */ jsx(AnimatedIcon, {
|
|
|
6599
7190
|
UsersIcon.displayName = "UsersIcon";
|
|
6600
7191
|
|
|
6601
7192
|
//#endregion
|
|
6602
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AnimatedIcon, ArrowUpRightIcon, AskAIAction, AssetIcon, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartBarIncreasingIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ClaudeLogo, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyButton, CopyCheckIcon, CopyIcon, CursorLogo, CursorPagination, DangerZone, DataTable, DataTableActiveFilters, DataTableColumnFilter, DataTableColumnVisibility, DataTableContent, DataTablePagination, DataTableSearch, DataTableToolbar, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DollarSignIcon, DomainList, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Field, FingerprintIcon, FlushCardStack, HomeIcon, Icon, IconConfigProvider, InfoBanner, Input, Kbd, KeyIcon, Label, LayoutPanelTopIcon, LinkIcon, MetricCard, MoonIcon, OpenAILogo, PageHeader, PageSkeleton, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PanelLeftCloseIcon, PanelLeftOpenIcon, PlusIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProductPageLayout, Progress, Radio, RadioField, RadioGroup, RadioGroupItem, RefreshCWIcon, SELECTION_COLUMN_ID, ScrollArea, ScrollBar, SearchIcon, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableCard, Separator, SettingsIcon, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShieldCheckIcon, Skeleton, Slider, Spinner, StatCardSkeleton,
|
|
7193
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AnimatedIcon, ArrowUpRightIcon, AskAIAction, AssetIcon, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartBarIncreasingIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ClaudeLogo, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyButton, CopyCheckIcon, CopyIcon, CursorLogo, CursorPagination, DangerZone, DataTable, DataTableActiveFilters, DataTableColumnFilter, DataTableColumnVisibility, DataTableContent, DataTablePagination, DataTableSearch, DataTableToolbar, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DollarSignIcon, DomainList, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Field, FingerprintIcon, FlushCardStack, HomeIcon, Icon, IconConfigProvider, InfoBanner, Input, Kbd, KeyIcon, Label, LayoutPanelTopIcon, LinkIcon, MetricCard, MoonIcon, OpenAILogo, PageHeader, PageSkeleton, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PanelLeftCloseIcon, PanelLeftOpenIcon, PlusIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProductPageLayout, Progress, Radio, RadioField, RadioGroup, RadioGroupItem, RefreshCWIcon, SELECTION_COLUMN_ID, ScrollArea, ScrollBar, SearchIcon, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableCard, Separator, SettingsIcon, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShieldCheckIcon, Skeleton, Slider, Spinner, StatCardSkeleton, Stepper, SunIcon, Switch, TabNavigation, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TerminalIcon, Textarea, Toaster, ToggleCard, ToggleGroup, ToggleGroupItem, ToggleRow, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UnsavedChangesBar, UsersIcon, VSCodeLogo, WebhooksAction, Well, WellReveal, WindsurfLogo, badgeVariants, buttonVariants, cn, createColumnHelper, selectionColumn, toast, useDataTable, useIconConfig, useUnsavedChanges };
|
|
6603
7194
|
//# sourceMappingURL=index.esm.js.map
|