@spear-ai/spectral 1.4.26 → 1.4.27
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/Accordion.d.ts +28 -9
- package/dist/Accordion.js +203 -183
- package/dist/Alert/AlertBase.d.ts +24 -16
- package/dist/Alert/AlertBase.js +33 -18
- package/dist/Alert.js +1 -1
- package/dist/Avatar.js +11 -11
- package/dist/Button.d.ts +7 -2
- package/dist/Button.js +25 -12
- package/dist/ButtonIcon.d.ts +7 -2
- package/dist/ButtonIcon.js +25 -16
- package/dist/Card.js +1 -1
- package/dist/Checkbox/CheckboxBase.d.ts +13 -13
- package/dist/Checkbox/CheckboxBase.js +128 -125
- package/dist/Checkbox.d.ts +7 -2
- package/dist/Checkbox.js +29 -22
- package/dist/DataCard.js +3 -3
- package/dist/Dialog.js +2 -2
- package/dist/Drawer.js +2 -2
- package/dist/HoverCard.js +1 -1
- package/dist/Icons/AnalyzeIcon.d.ts +3 -1
- package/dist/Icons/AnalyzeIcon.js +3 -6
- package/dist/Icons/AnnotationsIcon.d.ts +3 -1
- package/dist/Icons/AnnotationsIcon.js +3 -6
- package/dist/Icons/ApprovedIcon.d.ts +3 -1
- package/dist/Icons/ApprovedIcon.js +3 -6
- package/dist/Icons/ArrowDownIcon.d.ts +3 -1
- package/dist/Icons/ArrowDownIcon.js +3 -6
- package/dist/Icons/ArrowUpIcon.d.ts +3 -1
- package/dist/Icons/ArrowUpIcon.js +4 -7
- package/dist/Icons/CalendarIcon.d.ts +3 -1
- package/dist/Icons/CalendarIcon.js +9 -12
- package/dist/Icons/CheckCircleIcon.d.ts +3 -1
- package/dist/Icons/CheckCircleIcon.js +2 -5
- package/dist/Icons/CheckSquareIcon.d.ts +3 -1
- package/dist/Icons/CheckSquareIcon.js +4 -7
- package/dist/Icons/CheckmarkIcon.d.ts +3 -1
- package/dist/Icons/CheckmarkIcon.js +5 -8
- package/dist/Icons/ChevronDownIcon.d.ts +3 -1
- package/dist/Icons/ChevronDownIcon.js +5 -8
- package/dist/Icons/ChevronUpIcon.d.ts +3 -1
- package/dist/Icons/ChevronUpIcon.js +5 -8
- package/dist/Icons/ClockIcon.d.ts +3 -1
- package/dist/Icons/ClockIcon.js +5 -8
- package/dist/Icons/CloseCircleIcon.d.ts +3 -1
- package/dist/Icons/CloseCircleIcon.js +4 -7
- package/dist/Icons/CloseIcon.d.ts +3 -1
- package/dist/Icons/CloseIcon.js +5 -8
- package/dist/Icons/DashboardIcon.d.ts +3 -1
- package/dist/Icons/DashboardIcon.js +3 -6
- package/dist/Icons/DatabaseIcon.d.ts +3 -1
- package/dist/Icons/DatabaseIcon.js +4 -7
- package/dist/Icons/DeleteIcon.d.ts +3 -1
- package/dist/Icons/DeleteIcon.js +4 -7
- package/dist/Icons/DurationIcon.d.ts +3 -1
- package/dist/Icons/DurationIcon.js +3 -6
- package/dist/Icons/EditIcon.d.ts +3 -1
- package/dist/Icons/EditIcon.js +3 -6
- package/dist/Icons/EmailIcon.d.ts +3 -1
- package/dist/Icons/EmailIcon.js +4 -7
- package/dist/Icons/EraserIcon.d.ts +3 -1
- package/dist/Icons/EraserIcon.js +9 -10
- package/dist/Icons/ErrorIcon.d.ts +3 -1
- package/dist/Icons/ErrorIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon.js +4 -7
- package/dist/Icons/EyeClosedIcon2.d.ts +3 -1
- package/dist/Icons/EyeClosedIcon2.js +3 -6
- package/dist/Icons/EyeOpenIcon.d.ts +3 -1
- package/dist/Icons/EyeOpenIcon.js +6 -9
- package/dist/Icons/GoToFirstIcon.d.ts +3 -1
- package/dist/Icons/GoToFirstIcon.js +4 -7
- package/dist/Icons/GoToLastIcon.d.ts +3 -1
- package/dist/Icons/GoToLastIcon.js +4 -7
- package/dist/Icons/HarmonicCursorsIcon.d.ts +3 -1
- package/dist/Icons/HarmonicCursorsIcon.js +4 -7
- package/dist/Icons/IconBase.d.ts +4 -2
- package/dist/Icons/IconBase.js +17 -8
- package/dist/Icons/InfoIcon.d.ts +3 -1
- package/dist/Icons/InfoIcon.js +4 -7
- package/dist/Icons/LabelIcon.d.ts +3 -1
- package/dist/Icons/LabelIcon.js +3 -6
- package/dist/Icons/LassoIcon.d.ts +3 -1
- package/dist/Icons/LassoIcon.js +5 -8
- package/dist/Icons/LineToolIcon.d.ts +3 -1
- package/dist/Icons/LineToolIcon.js +3 -6
- package/dist/Icons/LineToolIcon2.d.ts +3 -1
- package/dist/Icons/LineToolIcon2.js +3 -6
- package/dist/Icons/LiveViewIcon.d.ts +3 -1
- package/dist/Icons/LiveViewIcon.js +2 -5
- package/dist/Icons/LoaderIcon.d.ts +3 -1
- package/dist/Icons/LoaderIcon.js +6 -7
- package/dist/Icons/LocationIcon.d.ts +3 -1
- package/dist/Icons/LocationIcon.js +3 -6
- package/dist/Icons/LogoutIcon.d.ts +3 -1
- package/dist/Icons/LogoutIcon.js +4 -7
- package/dist/Icons/MessagesIcon.d.ts +3 -1
- package/dist/Icons/MessagesIcon.js +5 -8
- package/dist/Icons/MetadataIcon.d.ts +3 -1
- package/dist/Icons/MetadataIcon.js +4 -7
- package/dist/Icons/MinusIcon.d.ts +3 -1
- package/dist/Icons/MinusIcon.js +3 -6
- package/dist/Icons/OntologyIcon.d.ts +3 -1
- package/dist/Icons/OntologyIcon.js +2 -5
- package/dist/Icons/PanelIconClose.d.ts +3 -1
- package/dist/Icons/PanelIconClose.js +4 -7
- package/dist/Icons/PanelIconOpen.d.ts +3 -1
- package/dist/Icons/PanelIconOpen.js +8 -11
- package/dist/Icons/PlayIcon.d.ts +3 -1
- package/dist/Icons/PlayIcon.js +3 -6
- package/dist/Icons/PlusIcon.d.ts +3 -1
- package/dist/Icons/PlusIcon.js +4 -7
- package/dist/Icons/ResetIcon.d.ts +3 -1
- package/dist/Icons/ResetIcon.js +4 -7
- package/dist/Icons/ReviewedIcon.d.ts +3 -1
- package/dist/Icons/ReviewedIcon.js +3 -6
- package/dist/Icons/ScissorsIcon.d.ts +3 -1
- package/dist/Icons/ScissorsIcon.js +6 -9
- package/dist/Icons/SettingsIcon.d.ts +3 -1
- package/dist/Icons/SettingsIcon.js +3 -6
- package/dist/Icons/SortAscendingIcon.d.ts +3 -1
- package/dist/Icons/SortAscendingIcon.js +3 -6
- package/dist/Icons/SortAtoZIcon.d.ts +3 -1
- package/dist/Icons/SortAtoZIcon.js +3 -6
- package/dist/Icons/SortDescendingIcon.d.ts +3 -1
- package/dist/Icons/SortDescendingIcon.js +3 -6
- package/dist/Icons/SortZtoAIcon.d.ts +3 -1
- package/dist/Icons/SortZtoAIcon.js +3 -6
- package/dist/Icons/StackIcon.d.ts +3 -1
- package/dist/Icons/StackIcon.js +4 -7
- package/dist/Icons/StarIcon.d.ts +3 -1
- package/dist/Icons/StarIcon.js +3 -6
- package/dist/Icons/TrashIcon.d.ts +3 -1
- package/dist/Icons/TrashIcon.js +3 -6
- package/dist/Icons/UndoIcon.d.ts +3 -1
- package/dist/Icons/UndoIcon.js +4 -7
- package/dist/Icons/UserIcon.d.ts +3 -1
- package/dist/Icons/UserIcon.js +3 -6
- package/dist/Icons/WarningIcon.d.ts +3 -1
- package/dist/Icons/WarningIcon.js +5 -8
- package/dist/Icons/ZoomAllIcon.d.ts +3 -1
- package/dist/Icons/ZoomAllIcon.js +3 -6
- package/dist/Icons/ZoomXIcon.d.ts +3 -1
- package/dist/Icons/ZoomXIcon.js +4 -7
- package/dist/Icons/ZoomYIcon.d.ts +3 -1
- package/dist/Icons/ZoomYIcon.js +4 -7
- package/dist/Input/InputUtils.d.ts +4 -4
- package/dist/Input/InputUtils.js +1 -1
- package/dist/Input.d.ts +7 -17
- package/dist/Input.js +105 -101
- package/dist/InputOTP.d.ts +27 -7
- package/dist/InputOTP.js +171 -146
- package/dist/Label.d.ts +7 -2
- package/dist/Label.js +12 -9
- package/dist/MultiSelect/MultiSelectBase.d.ts +7 -2
- package/dist/MultiSelect/MultiSelectBase.js +212 -213
- package/dist/{MultiSelect/MutiSelect.d.ts → MultiSelect.d.ts} +8 -2
- package/dist/MultiSelect.js +27 -0
- package/dist/Popover.js +1 -1
- package/dist/RadioButtonGroup.js +1 -1
- package/dist/RadioGroup.d.ts +20 -14
- package/dist/RadioGroup.js +177 -148
- package/dist/Select.d.ts +7 -2
- package/dist/Select.js +108 -109
- package/dist/Separator.d.ts +8 -8
- package/dist/Separator.js +14 -15
- package/dist/Switch/SwitchBase.d.ts +13 -11
- package/dist/Switch/SwitchBase.js +84 -61
- package/dist/Switch.d.ts +11 -4
- package/dist/Switch.js +19 -20
- package/dist/Tabs/TabsBase.d.ts +16 -6
- package/dist/Tabs/TabsBase.js +133 -96
- package/dist/Tabs/tabsUtils.d.ts +6 -2
- package/dist/Tabs/tabsUtils.js +5 -2
- package/dist/Tabs.js +18 -18
- package/dist/Textarea.d.ts +7 -2
- package/dist/Textarea.js +78 -61
- package/dist/Toggle/ToggleBase.d.ts +4 -8
- package/dist/Toggle/ToggleBase.js +29 -16
- package/dist/Toggle.d.ts +4 -2
- package/dist/Toggle.js +23 -13
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +4 -7
- package/dist/ToggleGroup/ToggleGroupBase.js +82 -73
- package/dist/ToggleGroup.d.ts +7 -2
- package/dist/ToggleGroup.js +31 -19
- package/dist/Tray.d.ts +47 -15
- package/dist/Tray.js +98 -60
- package/dist/hooks/useAccordionAutoScroll.d.ts +1 -1
- package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
- package/dist/hooks/useAccordionAutoScroll.js +35 -34
- package/dist/{index-BSCg4Mei.js → index-B0Kp8R0j.js} +3 -3
- package/dist/{index-jgQ7sgLl.js → index-D4jMMaAi.js} +5 -5
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +1 -4
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +4 -11
- package/dist/primitives/slot.d.ts +11 -4
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +32 -28
- package/dist/primitives/textarea.d.ts.map +1 -1
- package/dist/primitives/textarea.js +1 -3
- package/dist/utils/formFieldUtils.js +2 -2
- package/package.json +1 -1
- package/dist/MultiSelect/MutiSelect.js +0 -19
package/dist/Select.js
CHANGED
|
@@ -64,118 +64,117 @@ import "./Icons/ZoomAllIcon.js";
|
|
|
64
64
|
import "./Icons/ZoomXIcon.js";
|
|
65
65
|
import "./Icons/ZoomYIcon.js";
|
|
66
66
|
import { Label as C } from "./Label.js";
|
|
67
|
-
import { R as X, T as Y, f as Z, e as _, C as $, c as tt, V as et, S as rt, d as I, G as at, I as it, b as st, a as ot } from "./index-
|
|
68
|
-
import { useFormFieldId as lt, useFormFieldState as dt, getAriaProps as mt,
|
|
67
|
+
import { R as X, T as Y, f as Z, e as _, C as $, c as tt, V as et, S as rt, d as I, G as at, I as it, b as st, a as ot } from "./index-B0Kp8R0j.js";
|
|
68
|
+
import { useFormFieldId as lt, useFormFieldState as dt, getAriaProps as mt, groupOptions as ct, getFormFieldCSSProperties as pt, getStateClasses as nt, getTriggerClasses as ut, ErrorMessage as ht, getErrorMessageId as gt, LoadingState as bt, EmptyState as ft, getOptionClasses as xt } from "./utils/formFieldUtils.js";
|
|
69
69
|
import { cn as s } from "./utils/twUtils.js";
|
|
70
|
-
import {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
return /* @__PURE__ */ r(S, { children: [
|
|
110
|
-
N.length > 0 && /* @__PURE__ */ r(S, { children: [
|
|
111
|
-
N.map(v),
|
|
112
|
-
Object.keys(y).length > 0 && /* @__PURE__ */ t(I, { className: "-mx-1 my-1 h-px bg-border-secondary", "data-testid": "spectral-select-separator" })
|
|
113
|
-
] }),
|
|
114
|
-
Object.entries(y).map(([e, m], J) => /* @__PURE__ */ r(at, { "data-testid": "spectral-select-group", children: [
|
|
115
|
-
J > 0 && /* @__PURE__ */ t(I, { className: "-mx-1 my-1 h-px bg-border-secondary", "data-testid": "spectral-select-group-separator" }),
|
|
116
|
-
/* @__PURE__ */ t(C, { "data-testid": "spectral-select-group-label", htmlFor: i, className: s("px-2 py-1.5 text-base font-semibold text-text-primary", n), children: e }),
|
|
117
|
-
m.map((K) => v(K))
|
|
118
|
-
] }, e))
|
|
119
|
-
] });
|
|
70
|
+
import { useState as yt } from "react";
|
|
71
|
+
const Nt = ({
|
|
72
|
+
ref: w,
|
|
73
|
+
align: z = "start",
|
|
74
|
+
alignOffset: F = 0,
|
|
75
|
+
className: O,
|
|
76
|
+
collisionPadding: j = 10,
|
|
77
|
+
defaultValue: k,
|
|
78
|
+
emptyMessage: L = "No options found",
|
|
79
|
+
errorMessage: p,
|
|
80
|
+
id: T,
|
|
81
|
+
label: l,
|
|
82
|
+
labelClassName: n,
|
|
83
|
+
loadingMessage: V = "Loading…",
|
|
84
|
+
name: u,
|
|
85
|
+
onChange: q,
|
|
86
|
+
options: h = [],
|
|
87
|
+
placeholder: D = "Select an option",
|
|
88
|
+
position: E = "popper",
|
|
89
|
+
side: P = "bottom",
|
|
90
|
+
sideOffset: B = 4,
|
|
91
|
+
state: a = "default",
|
|
92
|
+
value: g,
|
|
93
|
+
"aria-label": G,
|
|
94
|
+
"aria-describedby": M,
|
|
95
|
+
...o
|
|
96
|
+
}) => {
|
|
97
|
+
const [b, R] = yt(!1), i = lt(T, u), f = gt(i), { isDisabled: d, isLoading: x, isInvalid: A } = dt(o.disabled, a), H = mt(a, M, o.required, f), { groups: y, ungrouped: N } = ct(h), U = () => {
|
|
98
|
+
if (x)
|
|
99
|
+
return /* @__PURE__ */ t(bt, { "data-testid": "spectral-select-loading", message: V });
|
|
100
|
+
if (h.length === 0)
|
|
101
|
+
return /* @__PURE__ */ t(ft, { "data-testid": "spectral-select-empty", message: L });
|
|
102
|
+
const v = (e) => {
|
|
103
|
+
const m = g === e.value;
|
|
104
|
+
return /* @__PURE__ */ r(it, { className: s(xt(!!e.disabled, !1, m), "relative flex w-full cursor-pointer items-center"), "data-testid": "spectral-select-item", disabled: e.disabled, value: e.value, children: [
|
|
105
|
+
/* @__PURE__ */ t(st, { "data-testid": "spectral-select-item-text", className: "block truncate", children: e.label }),
|
|
106
|
+
/* @__PURE__ */ t(ot, { "data-testid": "spectral-select-item-selected-indicator", asChild: !0, children: /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ t(Q, { size: 16 }) }) })
|
|
107
|
+
] }, e.value);
|
|
120
108
|
};
|
|
121
|
-
return /* @__PURE__ */ r(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */ t(
|
|
125
|
-
Y,
|
|
126
|
-
{
|
|
127
|
-
"aria-controls": i,
|
|
128
|
-
"aria-expanded": b,
|
|
129
|
-
"aria-label": R || l,
|
|
130
|
-
asChild: !0,
|
|
131
|
-
className: s(ht(!1, a), ut(a), F),
|
|
132
|
-
"data-slot": "select-trigger",
|
|
133
|
-
"data-state": a,
|
|
134
|
-
"data-testid": "spectral-select-trigger",
|
|
135
|
-
id: i,
|
|
136
|
-
ref: G,
|
|
137
|
-
role: "combobox",
|
|
138
|
-
style: nt(),
|
|
139
|
-
...H,
|
|
140
|
-
...o,
|
|
141
|
-
children: /* @__PURE__ */ r("button", { type: "button", disabled: d, children: [
|
|
142
|
-
/* @__PURE__ */ t(Z, { placeholder: q, className: "block truncate", "data-testid": "spectral-select-value" }),
|
|
143
|
-
/* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "flex items-center", children: x ? /* @__PURE__ */ t(W, { size: 20 }) : /* @__PURE__ */ t(c, { className: "transition-transform duration-200 data-[state=open]:rotate-180", size: 20 }) }) })
|
|
144
|
-
] })
|
|
145
|
-
}
|
|
146
|
-
),
|
|
147
|
-
/* @__PURE__ */ t($, { align: w, alignOffset: z, "data-slot": "select-content", "data-testid": "spectral-select-content", asChild: !0, collisionPadding: O, position: D, side: E, sideOffset: P, children: /* @__PURE__ */ r(
|
|
148
|
-
"div",
|
|
149
|
-
{
|
|
150
|
-
className: s(
|
|
151
|
-
"z-50 rounded-lg border border-input-border bg-input-bg shadow-md",
|
|
152
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
153
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
154
|
-
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
155
|
-
"data-[side=bottom]:slide-in-from-top-2",
|
|
156
|
-
"data-[side=left]:slide-in-from-right-2",
|
|
157
|
-
"data-[side=right]:slide-in-from-left-2",
|
|
158
|
-
"data-[side=top]:slide-in-from-bottom-2"
|
|
159
|
-
),
|
|
160
|
-
style: {
|
|
161
|
-
boxSizing: "border-box",
|
|
162
|
-
maxHeight: "var(--radix-select-content-available-height)",
|
|
163
|
-
position: "fixed",
|
|
164
|
-
width: "var(--radix-select-trigger-width)"
|
|
165
|
-
},
|
|
166
|
-
children: [
|
|
167
|
-
/* @__PURE__ */ t(tt, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-up-button", children: /* @__PURE__ */ t(c, { className: "rotate-180", size: 18 }) }),
|
|
168
|
-
/* @__PURE__ */ t(et, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "p-1 max-h-96", "data-testid": "spectral-select-items", style: { position: "relative", overflow: "hidden auto" }, children: U() }) }),
|
|
169
|
-
/* @__PURE__ */ t(rt, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-down-button", children: /* @__PURE__ */ t(c, { size: 18 }) })
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
) })
|
|
109
|
+
return /* @__PURE__ */ r(S, { children: [
|
|
110
|
+
N.length > 0 && /* @__PURE__ */ r(S, { children: [
|
|
111
|
+
N.map(v),
|
|
112
|
+
Object.keys(y).length > 0 && /* @__PURE__ */ t(I, { className: "bg-border-secondary -mx-1 my-1 h-px", "data-testid": "spectral-select-separator" })
|
|
173
113
|
] }),
|
|
174
|
-
|
|
114
|
+
Object.entries(y).map(([e, m], J) => /* @__PURE__ */ r(at, { "data-testid": "spectral-select-group", children: [
|
|
115
|
+
J > 0 && /* @__PURE__ */ t(I, { className: "bg-border-secondary -mx-1 my-1 h-px", "data-testid": "spectral-select-group-separator" }),
|
|
116
|
+
/* @__PURE__ */ t(C, { "data-testid": "spectral-select-group-label", htmlFor: i, className: s("text-text-primary px-2 py-1.5 text-base font-semibold", n), children: e }),
|
|
117
|
+
m.map((K) => v(K))
|
|
118
|
+
] }, e))
|
|
175
119
|
] });
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
122
|
+
l && /* @__PURE__ */ t(C, { "data-testid": "spectral-select-label", htmlFor: i, className: s("text-text-primary mb-4 block", n, d && "text-text-secondary"), children: l }),
|
|
123
|
+
/* @__PURE__ */ r(X, { "data-testid": "spectral-select", defaultValue: k, disabled: d, name: u, onOpenChange: R, onValueChange: q, open: b, required: o.required, value: g, children: [
|
|
124
|
+
/* @__PURE__ */ t(
|
|
125
|
+
Y,
|
|
126
|
+
{
|
|
127
|
+
"aria-controls": i,
|
|
128
|
+
"aria-expanded": b,
|
|
129
|
+
"aria-label": G || l,
|
|
130
|
+
asChild: !0,
|
|
131
|
+
className: s(ut(!1, a), nt(a), O),
|
|
132
|
+
"data-slot": "select-trigger",
|
|
133
|
+
"data-state": a,
|
|
134
|
+
"data-testid": "spectral-select-trigger",
|
|
135
|
+
id: i,
|
|
136
|
+
ref: w,
|
|
137
|
+
role: "combobox",
|
|
138
|
+
style: pt(),
|
|
139
|
+
...H,
|
|
140
|
+
...o,
|
|
141
|
+
children: /* @__PURE__ */ r("button", { type: "button", disabled: d, children: [
|
|
142
|
+
/* @__PURE__ */ t(Z, { placeholder: D, className: "block truncate", "data-testid": "spectral-select-value" }),
|
|
143
|
+
/* @__PURE__ */ t(_, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "flex items-center", children: x ? /* @__PURE__ */ t(W, { size: 20 }) : /* @__PURE__ */ t(c, { className: "transition-transform duration-200 data-[state=open]:rotate-180", size: 20 }) }) })
|
|
144
|
+
] })
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ t($, { align: z, alignOffset: F, "data-slot": "select-content", "data-testid": "spectral-select-content", asChild: !0, collisionPadding: j, position: E, side: P, sideOffset: B, children: /* @__PURE__ */ r(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
className: s(
|
|
151
|
+
"border-input-border bg-input-bg z-50 rounded-lg border shadow-md",
|
|
152
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
153
|
+
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
154
|
+
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
155
|
+
"data-[side=bottom]:slide-in-from-top-2",
|
|
156
|
+
"data-[side=left]:slide-in-from-right-2",
|
|
157
|
+
"data-[side=right]:slide-in-from-left-2",
|
|
158
|
+
"data-[side=top]:slide-in-from-bottom-2"
|
|
159
|
+
),
|
|
160
|
+
style: {
|
|
161
|
+
boxSizing: "border-box",
|
|
162
|
+
maxHeight: "var(--radix-select-content-available-height)",
|
|
163
|
+
position: "fixed",
|
|
164
|
+
width: "var(--radix-select-trigger-width)"
|
|
165
|
+
},
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ t(tt, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-up-button", children: /* @__PURE__ */ t(c, { className: "rotate-180", size: 18 }) }),
|
|
168
|
+
/* @__PURE__ */ t(et, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "max-h-96 p-1", "data-testid": "spectral-select-items", style: { position: "relative", overflow: "hidden auto" }, children: U() }) }),
|
|
169
|
+
/* @__PURE__ */ t(rt, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-down-button", children: /* @__PURE__ */ t(c, { size: 18 }) })
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
) })
|
|
173
|
+
] }),
|
|
174
|
+
A && p && /* @__PURE__ */ t(ht, { "data-testid": "spectral-select-error-message", id: f, message: p })
|
|
175
|
+
] });
|
|
176
|
+
};
|
|
177
|
+
Nt.displayName = "Select";
|
|
179
178
|
export {
|
|
180
|
-
|
|
179
|
+
Nt as Select
|
|
181
180
|
};
|
package/dist/Separator.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, Ref } from 'react';
|
|
2
2
|
export type SeparatorProps = {
|
|
3
|
-
orientation?: 'horizontal' | 'vertical';
|
|
4
|
-
decorative?: boolean;
|
|
5
3
|
className?: string;
|
|
6
|
-
} & ComponentPropsWithoutRef<'div'>;
|
|
7
|
-
export declare const Separator: import('react').ForwardRefExoticComponent<{
|
|
8
|
-
orientation?: "horizontal" | "vertical";
|
|
9
4
|
decorative?: boolean;
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
orientation?: 'horizontal' | 'vertical';
|
|
6
|
+
ref?: Ref<HTMLDivElement>;
|
|
7
|
+
} & ComponentPropsWithoutRef<'div'>;
|
|
8
|
+
export declare const Separator: {
|
|
9
|
+
({ className, decorative, orientation, ref, ...props }: SeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
12
|
//# sourceMappingURL=Separator.d.ts.map
|
package/dist/Separator.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import "./styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { cn as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { cn as e } from "./utils/twUtils.js";
|
|
4
|
+
import "react";
|
|
5
|
+
const l = ({ className: o, decorative: r = !0, orientation: a = "horizontal", ref: t, ...i }) => /* @__PURE__ */ p(
|
|
7
6
|
"div",
|
|
8
7
|
{
|
|
9
|
-
ref:
|
|
8
|
+
ref: t,
|
|
10
9
|
"data-slot": "separator",
|
|
11
|
-
"data-orientation":
|
|
12
|
-
role:
|
|
13
|
-
"aria-hidden":
|
|
14
|
-
"aria-orientation":
|
|
15
|
-
className:
|
|
16
|
-
...
|
|
10
|
+
"data-orientation": a,
|
|
11
|
+
role: r ? "none" : "separator",
|
|
12
|
+
"aria-hidden": r ? "true" : void 0,
|
|
13
|
+
"aria-orientation": r ? void 0 : a,
|
|
14
|
+
className: e("bg-border shrink-0", a === "horizontal" ? "h-px w-full" : "h-full w-px", o),
|
|
15
|
+
...i
|
|
17
16
|
}
|
|
18
|
-
)
|
|
19
|
-
|
|
17
|
+
);
|
|
18
|
+
l.displayName = "Separator";
|
|
20
19
|
export {
|
|
21
|
-
|
|
20
|
+
l as Separator
|
|
22
21
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsChildProp } from '../primitives/slot';
|
|
2
|
-
import { ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, HTMLAttributes, Ref } from 'react';
|
|
3
3
|
type BaseButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'value'>;
|
|
4
4
|
export type SwitchProps = BaseButtonProps & AsChildProp & {
|
|
5
5
|
checked?: boolean;
|
|
@@ -10,16 +10,18 @@ export type SwitchProps = BaseButtonProps & AsChildProp & {
|
|
|
10
10
|
required?: boolean;
|
|
11
11
|
value?: string;
|
|
12
12
|
};
|
|
13
|
-
export declare const Switch:
|
|
14
|
-
checked
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
required?: boolean;
|
|
20
|
-
value?: string;
|
|
21
|
-
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export declare const Switch: {
|
|
14
|
+
({ ref, asChild, className, checked, defaultChecked, onCheckedChange, name, value, required, form, disabled, id, onClick, onKeyDown, children, ...rest }: SwitchProps & {
|
|
15
|
+
ref?: Ref<HTMLButtonElement>;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
22
19
|
export type SwitchThumbProps = HTMLAttributes<HTMLSpanElement> & AsChildProp;
|
|
23
|
-
export declare const SwitchThumb:
|
|
20
|
+
export declare const SwitchThumb: {
|
|
21
|
+
({ ref, asChild, className, ...props }: SwitchThumbProps & {
|
|
22
|
+
ref?: Ref<HTMLSpanElement>;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
24
26
|
export {};
|
|
25
27
|
//# sourceMappingURL=SwitchBase.d.ts.map
|
|
@@ -1,80 +1,99 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { useControllableState as
|
|
5
|
-
import { Slot as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { createContext as
|
|
8
|
-
const
|
|
9
|
-
|
|
3
|
+
import { jsx as f, jsxs as F } from "react/jsx-runtime";
|
|
4
|
+
import { useControllableState as K } from "../hooks/useControllableState.js";
|
|
5
|
+
import { Slot as w } from "../primitives/slot.js";
|
|
6
|
+
import { cn as g } from "../utils/twUtils.js";
|
|
7
|
+
import { createContext as M, useRef as O, useId as V, useEffect as v, useCallback as a, useContext as $ } from "react";
|
|
8
|
+
const x = M(null), z = ({
|
|
9
|
+
ref: u,
|
|
10
|
+
asChild: d,
|
|
11
|
+
className: l,
|
|
12
|
+
checked: h,
|
|
13
|
+
defaultChecked: n = !1,
|
|
14
|
+
onCheckedChange: m,
|
|
15
|
+
name: y,
|
|
16
|
+
value: C = "on",
|
|
17
|
+
required: E,
|
|
18
|
+
form: S,
|
|
19
|
+
disabled: r,
|
|
20
|
+
id: I,
|
|
21
|
+
onClick: p,
|
|
22
|
+
onKeyDown: b,
|
|
23
|
+
children: N,
|
|
24
|
+
...P
|
|
25
|
+
}) => {
|
|
26
|
+
const c = O(null), R = V(), T = I ?? `swt-${R}`, [t, s] = K({
|
|
10
27
|
value: h,
|
|
11
|
-
defaultValue:
|
|
12
|
-
onChange:
|
|
28
|
+
defaultValue: n,
|
|
29
|
+
onChange: m
|
|
13
30
|
});
|
|
14
|
-
|
|
31
|
+
v(() => {
|
|
15
32
|
c.current && (c.current.checked = t);
|
|
16
|
-
}, [t]),
|
|
33
|
+
}, [t]), v(() => {
|
|
17
34
|
const e = c.current?.form ?? null;
|
|
18
35
|
if (!e) return;
|
|
19
|
-
const
|
|
20
|
-
return e.addEventListener("reset",
|
|
21
|
-
}, [
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
const o = () => s(n);
|
|
37
|
+
return e.addEventListener("reset", o), () => e.removeEventListener("reset", o);
|
|
38
|
+
}, [n, s]);
|
|
39
|
+
const k = a((e) => {
|
|
40
|
+
const o = c.current;
|
|
41
|
+
if (!o) return;
|
|
42
|
+
o.checked = e;
|
|
43
|
+
const q = new Event("change", { bubbles: !0 });
|
|
44
|
+
o.dispatchEvent(q);
|
|
45
|
+
}, []), i = a(() => {
|
|
46
|
+
if (r) return;
|
|
47
|
+
const e = !t;
|
|
48
|
+
s(e), queueMicrotask(() => k(e));
|
|
49
|
+
}, [r, k, t, s]), j = a(
|
|
31
50
|
(e) => {
|
|
32
|
-
|
|
51
|
+
p?.(e), !e.defaultPrevented && i();
|
|
33
52
|
},
|
|
34
|
-
[
|
|
35
|
-
),
|
|
53
|
+
[p, i]
|
|
54
|
+
), D = a(
|
|
36
55
|
(e) => {
|
|
37
|
-
|
|
56
|
+
b?.(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(), i());
|
|
38
57
|
},
|
|
39
|
-
[
|
|
40
|
-
),
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
58
|
+
[b, i]
|
|
59
|
+
), L = d ? w : "button";
|
|
60
|
+
return /* @__PURE__ */ f(x.Provider, { value: { checked: t, disabled: r }, children: /* @__PURE__ */ F(
|
|
61
|
+
L,
|
|
43
62
|
{
|
|
44
63
|
"aria-checked": t,
|
|
45
|
-
"aria-disabled":
|
|
46
|
-
className:
|
|
64
|
+
"aria-disabled": r || void 0,
|
|
65
|
+
className: g(
|
|
47
66
|
"peer border-input inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border",
|
|
48
67
|
"bg-input focus-visible:ring-ring transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
49
68
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
50
69
|
"data-[state=checked]:bg-primary",
|
|
51
70
|
l
|
|
52
71
|
),
|
|
53
|
-
"data-disabled":
|
|
72
|
+
"data-disabled": r || void 0,
|
|
54
73
|
"data-state": t ? "checked" : "unchecked",
|
|
55
|
-
disabled:
|
|
56
|
-
id:
|
|
57
|
-
onClick:
|
|
58
|
-
onKeyDown:
|
|
59
|
-
ref:
|
|
74
|
+
disabled: r,
|
|
75
|
+
id: T,
|
|
76
|
+
onClick: j,
|
|
77
|
+
onKeyDown: D,
|
|
78
|
+
ref: u,
|
|
60
79
|
role: "switch",
|
|
61
80
|
type: "button",
|
|
62
|
-
...
|
|
81
|
+
...P,
|
|
63
82
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ f(
|
|
65
84
|
"input",
|
|
66
85
|
{
|
|
67
86
|
"aria-hidden": "true",
|
|
68
87
|
checked: t,
|
|
69
|
-
disabled:
|
|
88
|
+
disabled: r,
|
|
70
89
|
form: S,
|
|
71
|
-
name:
|
|
90
|
+
name: y,
|
|
72
91
|
readOnly: !0,
|
|
73
92
|
ref: c,
|
|
74
93
|
required: E,
|
|
75
94
|
tabIndex: -1,
|
|
76
95
|
type: "checkbox",
|
|
77
|
-
value:
|
|
96
|
+
value: C,
|
|
78
97
|
style: {
|
|
79
98
|
position: "absolute",
|
|
80
99
|
opacity: 0,
|
|
@@ -84,29 +103,33 @@ const C = O(null), A = y(({ asChild: u, className: l, checked: h, defaultChecked
|
|
|
84
103
|
}
|
|
85
104
|
}
|
|
86
105
|
),
|
|
87
|
-
|
|
106
|
+
N
|
|
88
107
|
]
|
|
89
108
|
}
|
|
90
109
|
) });
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
110
|
+
};
|
|
111
|
+
z.displayName = "Switch";
|
|
112
|
+
const A = ({
|
|
113
|
+
ref: u,
|
|
114
|
+
asChild: d,
|
|
115
|
+
className: l,
|
|
116
|
+
...h
|
|
117
|
+
}) => {
|
|
118
|
+
const n = $(x);
|
|
119
|
+
if (!n) throw new Error("SwitchThumb must be used within Switch");
|
|
120
|
+
return /* @__PURE__ */ f(
|
|
121
|
+
d ? w : "span",
|
|
99
122
|
{
|
|
100
|
-
className:
|
|
101
|
-
"data-disabled":
|
|
102
|
-
"data-state":
|
|
103
|
-
ref:
|
|
123
|
+
className: g("bg-background pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform", "translate-x-0 data-[state=checked]:translate-x-5", l),
|
|
124
|
+
"data-disabled": n.disabled || void 0,
|
|
125
|
+
"data-state": n.checked ? "checked" : "unchecked",
|
|
126
|
+
ref: u,
|
|
104
127
|
...h
|
|
105
128
|
}
|
|
106
129
|
);
|
|
107
|
-
}
|
|
108
|
-
|
|
130
|
+
};
|
|
131
|
+
A.displayName = "SwitchThumb";
|
|
109
132
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
133
|
+
z as Switch,
|
|
134
|
+
A as SwitchThumb
|
|
112
135
|
};
|
package/dist/Switch.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { SwitchProps as SwitchBaseProps } from './SwitchBase';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
type SwitchProps = Omit<SwitchBaseProps, 'onCheckedChange'> & {
|
|
4
|
+
labelPosition?: 'left' | 'right';
|
|
4
5
|
labelText: string;
|
|
5
6
|
id: string;
|
|
6
7
|
hideLabel?: boolean;
|
|
7
8
|
onChange?: (checked: boolean) => void;
|
|
9
|
+
ref?: Ref<HTMLButtonElement>;
|
|
8
10
|
required?: boolean;
|
|
9
11
|
value?: string;
|
|
10
|
-
variant?:
|
|
11
|
-
}
|
|
12
|
+
variant?: 'default' | 'squared';
|
|
13
|
+
};
|
|
14
|
+
export declare const Switch: {
|
|
15
|
+
({ ref, className, disabled, id, labelPosition, labelText, name, onChange, required, value, hideLabel, variant, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
12
19
|
//# sourceMappingURL=Switch.d.ts.map
|
package/dist/Switch.js
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
import "./styles/main.css";
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { Switch as
|
|
2
|
+
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Switch as w, SwitchThumb as k } from "./Switch/SwitchBase.js";
|
|
5
4
|
import { Label as r } from "./Label.js";
|
|
6
|
-
import { cn as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
const n =
|
|
10
|
-
return /* @__PURE__ */
|
|
5
|
+
import { cn as l } from "./utils/twUtils.js";
|
|
6
|
+
import "react";
|
|
7
|
+
const x = ({ ref: o, className: d, disabled: h, id: e, labelPosition: i = "right", labelText: s, name: b, onChange: u, required: c, value: m, hideLabel: a = !1, variant: f, ...g }) => {
|
|
8
|
+
const n = f === "squared";
|
|
9
|
+
return /* @__PURE__ */ p("div", { className: "flex items-center", "data-testid": "spectral-switch-container", children: [
|
|
11
10
|
i === "left" && !a && /* @__PURE__ */ t(r, { htmlFor: e, className: "mr-2", "data-testid": "spectral-switch-label-left", children: s }),
|
|
12
11
|
/* @__PURE__ */ t(
|
|
13
|
-
|
|
12
|
+
w,
|
|
14
13
|
{
|
|
15
14
|
"aria-required": c,
|
|
16
|
-
className:
|
|
15
|
+
className: l(
|
|
17
16
|
n ? "peer data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg inline-flex h-6 w-10 shrink-0 items-center rounded-sm border-2 border-transparent transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-black disabled:cursor-not-allowed disabled:opacity-50 [&_span]:rounded-[4px]" : "focus-visible:ring-ring focus-visible:ring-offset-background peer data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-2xs transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
|
-
|
|
17
|
+
d
|
|
19
18
|
),
|
|
20
19
|
"data-testid": "spectral-switch",
|
|
21
|
-
disabled:
|
|
20
|
+
disabled: h,
|
|
22
21
|
id: e,
|
|
23
|
-
name:
|
|
24
|
-
onCheckedChange:
|
|
25
|
-
ref:
|
|
22
|
+
name: b,
|
|
23
|
+
onCheckedChange: u,
|
|
24
|
+
ref: o,
|
|
26
25
|
required: c,
|
|
27
26
|
value: m,
|
|
28
|
-
...
|
|
27
|
+
...g,
|
|
29
28
|
children: /* @__PURE__ */ t(
|
|
30
29
|
k,
|
|
31
30
|
{
|
|
32
|
-
className:
|
|
31
|
+
className: l(
|
|
33
32
|
n ? "bg-switch-thumb pointer-events-none block size-5 rounded-full shadow-xs ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0 data-[state=checked]:rtl:-translate-x-4" : "bg-switch-thumb pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
|
|
34
33
|
)
|
|
35
34
|
}
|
|
@@ -39,8 +38,8 @@ const v = x(({ className: l, disabled: d, id: e, labelPosition: i = "right", lab
|
|
|
39
38
|
i === "right" && !a && /* @__PURE__ */ t(r, { htmlFor: e, id: `${e}-label`, className: "ml-2", "data-testid": "spectral-switch-label-right", children: s }),
|
|
40
39
|
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", "data-testid": "spectral-switch-label-hidden", children: s })
|
|
41
40
|
] });
|
|
42
|
-
}
|
|
43
|
-
|
|
41
|
+
};
|
|
42
|
+
x.displayName = "Switch";
|
|
44
43
|
export {
|
|
45
|
-
|
|
44
|
+
x as Switch
|
|
46
45
|
};
|