@spear-ai/spectral 1.8.0 → 1.8.1
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/DateTimePicker/Calendar.js +364 -359
- package/dist/DateTimePicker/DateTimeUtils.js +2 -2
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +4 -4
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +2 -2
- package/dist/MultiSelect/MultiSelectBase.js +29 -29
- package/dist/RadioGroup.js +2 -2
- package/dist/Select.js +38 -38
- package/dist/Tabs/TabsBase.js +2 -2
- package/dist/Tray.js +2 -2
- package/dist/index-Cl8VeY0o.js +149 -0
- package/dist/{proxy-CgaCj1WQ.js → proxy-CO_-Vget.js} +3107 -2803
- package/dist/styles/spectral.css +1 -1
- package/dist/{use-animation-CR-SdV2l.js → use-animation-DhEPRwZ3.js} +1 -1
- package/dist/utils/twUtils.js +528 -369
- package/package.json +33 -33
- package/dist/index-DdFoGvON.js +0 -146
|
@@ -643,7 +643,7 @@ class Dn {
|
|
|
643
643
|
const Cn = {
|
|
644
644
|
major: 4,
|
|
645
645
|
minor: 3,
|
|
646
|
-
patch:
|
|
646
|
+
patch: 6
|
|
647
647
|
}, g = /* @__PURE__ */ l("$ZodType", (e, n) => {
|
|
648
648
|
var t;
|
|
649
649
|
e ?? (e = {}), e._zod.def = n, e._zod.bag = e._zod.bag || {}, e._zod.version = Cn;
|
|
@@ -1518,7 +1518,7 @@ function Ge(e, n) {
|
|
|
1518
1518
|
if (p.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(p)) : Object.assign(c, p), Object.assign(c, a), s._zod.parent === f)
|
|
1519
1519
|
for (const v in c)
|
|
1520
1520
|
v === "$ref" || v === "allOf" || v in a || delete c[v];
|
|
1521
|
-
if (p.$ref)
|
|
1521
|
+
if (p.$ref && d.def)
|
|
1522
1522
|
for (const v in c)
|
|
1523
1523
|
v === "$ref" || v === "allOf" || v in d.def && JSON.stringify(c[v]) === JSON.stringify(d.def[v]) && delete c[v];
|
|
1524
1524
|
}
|
|
@@ -3,8 +3,8 @@ import "../styles/main.css";
|
|
|
3
3
|
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
4
4
|
import { cn as f } from "../utils/twUtils.js";
|
|
5
5
|
import { useRef as p, useImperativeHandle as x, useCallback as i } from "react";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { m as v } from "../proxy-CO_-Vget.js";
|
|
7
|
+
import { u as A } from "../use-animation-DhEPRwZ3.js";
|
|
8
8
|
const w = {
|
|
9
9
|
times: [0, 0.4, 1],
|
|
10
10
|
duration: 0.5
|
|
@@ -12,7 +12,7 @@ const w = {
|
|
|
12
12
|
normal: { x: 0 },
|
|
13
13
|
animate: { x: [0, -1.5, 0] }
|
|
14
14
|
}, N = ({ onMouseEnter: o, onMouseLeave: s, className: m, size: a = 28, ref: l, ...c }) => {
|
|
15
|
-
const t =
|
|
15
|
+
const t = A(), r = p(!1);
|
|
16
16
|
x(l, () => (r.current = !0, {
|
|
17
17
|
startAnimation: () => t.start("animate"),
|
|
18
18
|
stopAnimation: () => t.start("normal")
|
|
@@ -31,7 +31,7 @@ const w = {
|
|
|
31
31
|
return /* @__PURE__ */ e("div", { className: f(m), onMouseEnter: u, onMouseLeave: d, ...c, children: /* @__PURE__ */ h("svg", { fill: "none", height: a, stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", viewBox: "0 0 24 24", width: a, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
32
32
|
/* @__PURE__ */ e("rect", { height: "18", rx: "2", width: "18", x: "3", y: "3" }),
|
|
33
33
|
/* @__PURE__ */ e("path", { d: "M9 3v18" }),
|
|
34
|
-
/* @__PURE__ */ e(
|
|
34
|
+
/* @__PURE__ */ e(v.path, { animate: t, d: "m16 15-3-3 3-3", transition: w, variants: g })
|
|
35
35
|
] }) });
|
|
36
36
|
};
|
|
37
37
|
export {
|
|
@@ -3,8 +3,8 @@ import "../styles/main.css";
|
|
|
3
3
|
import { jsx as e, jsxs as h } from "react/jsx-runtime";
|
|
4
4
|
import { cn as p } from "../utils/twUtils.js";
|
|
5
5
|
import { useRef as f, useImperativeHandle as x, useCallback as i } from "react";
|
|
6
|
-
import { u as v } from "../use-animation-
|
|
7
|
-
import { m as A } from "../proxy-
|
|
6
|
+
import { u as v } from "../use-animation-DhEPRwZ3.js";
|
|
7
|
+
import { m as A } from "../proxy-CO_-Vget.js";
|
|
8
8
|
const w = {
|
|
9
9
|
times: [0, 0.4, 1],
|
|
10
10
|
duration: 0.5
|
|
@@ -110,7 +110,7 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
110
110
|
const p = t >= 0 && t < r.length ? r[t] : null;
|
|
111
111
|
if (o.key === " " && p?.type === "search" || o.key === "Enter" && p?.type === "search")
|
|
112
112
|
return;
|
|
113
|
-
const
|
|
113
|
+
const a = {
|
|
114
114
|
ArrowDown: () => {
|
|
115
115
|
o.preventDefault();
|
|
116
116
|
const l = Math.min(t + 1, r.length - 1);
|
|
@@ -154,7 +154,7 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
154
154
|
o.preventDefault(), m();
|
|
155
155
|
}
|
|
156
156
|
}[o.key];
|
|
157
|
-
|
|
157
|
+
a && a();
|
|
158
158
|
},
|
|
159
159
|
[r, t, I, N, g, m, x]
|
|
160
160
|
), M = w(
|
|
@@ -196,32 +196,32 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
196
196
|
showSelectAll: o = !0,
|
|
197
197
|
sortAlphabetically: p = !1,
|
|
198
198
|
state: f = "default",
|
|
199
|
-
value:
|
|
199
|
+
value: a = [],
|
|
200
200
|
"aria-label": l,
|
|
201
201
|
"aria-describedby": W,
|
|
202
202
|
...H
|
|
203
203
|
}) => {
|
|
204
204
|
const X = ve(), K = D ?? `${t}-${X}`, _ = `${K}-listbox`, G = `${K}-error`, [h, L] = V(!1), [T, Y] = V(""), R = we(null), ee = H.disabled ?? f === "disabled", te = f === "loading", re = f === "error", k = v(() => {
|
|
205
|
-
let e = r.filter((
|
|
206
|
-
return p && (e = [...e].sort((
|
|
205
|
+
let e = r.filter((n) => n.label.toLowerCase().includes(T.toLowerCase()));
|
|
206
|
+
return p && (e = [...e].sort((n, i) => n.label.localeCompare(i.label))), e;
|
|
207
207
|
}, [r, T, p]), O = v(() => {
|
|
208
|
-
const e = {},
|
|
208
|
+
const e = {}, n = [];
|
|
209
209
|
return k.forEach((i) => {
|
|
210
|
-
i.group ? (e[i.group] || (e[i.group] = []), e[i.group].push(i)) :
|
|
211
|
-
}), { groups: e, ungrouped:
|
|
210
|
+
i.group ? (e[i.group] || (e[i.group] = []), e[i.group].push(i)) : n.push(i);
|
|
211
|
+
}), { groups: e, ungrouped: n, hasGroups: Object.keys(e).length > 0 };
|
|
212
212
|
}, [k]), $ = w(
|
|
213
213
|
(e) => {
|
|
214
214
|
if (r.find((u) => u.value === e)?.disabled) return;
|
|
215
|
-
const i =
|
|
215
|
+
const i = a.includes(e) ? a.filter((u) => u !== e) : [...a, e];
|
|
216
216
|
c(i), m && L(!1);
|
|
217
217
|
},
|
|
218
|
-
[r,
|
|
218
|
+
[r, a, c, m]
|
|
219
219
|
), U = w(() => {
|
|
220
|
-
const e = r.filter((i) => !i.disabled).map((i) => i.value),
|
|
221
|
-
c(
|
|
222
|
-
}, [r,
|
|
220
|
+
const e = r.filter((i) => !i.disabled).map((i) => i.value), n = e.every((i) => a.includes(i));
|
|
221
|
+
c(n ? [] : e);
|
|
222
|
+
}, [r, a, c]), Z = w(() => {
|
|
223
223
|
c([]);
|
|
224
|
-
}, [c]), q = v(() => r.filter((e) => !e.disabled).map((e) => e.value), [r]), ie = q.length > 0 && q.every((e) =>
|
|
224
|
+
}, [c]), q = v(() => r.filter((e) => !e.disabled).map((e) => e.value), [r]), ie = q.length > 0 && q.every((e) => a.includes(e)), { getOptionFocusIndex: se, handleKeyDown: oe, isSelectAllFocused: le, setFocusedIndex: A } = De(
|
|
225
225
|
k,
|
|
226
226
|
Z,
|
|
227
227
|
() => L(!1),
|
|
@@ -236,12 +236,12 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
236
236
|
Ne(() => {
|
|
237
237
|
A(h ? 0 : -1);
|
|
238
238
|
}, [h, A]);
|
|
239
|
-
const
|
|
239
|
+
const ne = w((e) => {
|
|
240
240
|
Y(e.target.value);
|
|
241
|
-
}, []),
|
|
242
|
-
if (
|
|
241
|
+
}, []), ae = () => {
|
|
242
|
+
if (a.length === 0)
|
|
243
243
|
return /* @__PURE__ */ s("span", { className: "text-input-text-placeholder flex min-h-8 items-center", children: x });
|
|
244
|
-
const e =
|
|
244
|
+
const e = a.slice(0, j), n = a.length - j;
|
|
245
245
|
return /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-1 overflow-hidden", children: [
|
|
246
246
|
e.map((i) => {
|
|
247
247
|
const u = r.find((B) => B.value === i);
|
|
@@ -262,14 +262,14 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
262
262
|
)
|
|
263
263
|
] }, i) : null;
|
|
264
264
|
}),
|
|
265
|
-
|
|
265
|
+
n > 0 && /* @__PURE__ */ d("span", { className: "text-input-text-secondary flex items-center py-1 text-xs", children: [
|
|
266
266
|
"+",
|
|
267
|
-
|
|
267
|
+
n,
|
|
268
268
|
" more"
|
|
269
269
|
] })
|
|
270
270
|
] });
|
|
271
|
-
}, J = (e,
|
|
272
|
-
const i =
|
|
271
|
+
}, J = (e, n) => {
|
|
272
|
+
const i = a.includes(e.value), u = se(n);
|
|
273
273
|
return /* @__PURE__ */ d(
|
|
274
274
|
"button",
|
|
275
275
|
{
|
|
@@ -294,7 +294,7 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
294
294
|
"--multiselect-dropdown-max-height": "20rem"
|
|
295
295
|
});
|
|
296
296
|
return /* @__PURE__ */ d("div", { className: "w-full", "data-testid": "spectral-multiselect-root", children: [
|
|
297
|
-
/* @__PURE__ */ s(be, { open: h, onOpenChange: L, children: /* @__PURE__ */ d("div", { "data-testid": "spectral-multiselect-wrapper", onKeyDown: h ? oe : void 0, children: [
|
|
297
|
+
/* @__PURE__ */ s(be, { open: h, onOpenChange: L, children: /* @__PURE__ */ d("div", { "data-testid": "spectral-multiselect-wrapper", onKeyDown: h ? oe : void 0, role: "none", children: [
|
|
298
298
|
/* @__PURE__ */ s(ge, { asChild: !0, children: /* @__PURE__ */ d(
|
|
299
299
|
"button",
|
|
300
300
|
{
|
|
@@ -314,9 +314,9 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
314
314
|
type: "button",
|
|
315
315
|
...H,
|
|
316
316
|
children: [
|
|
317
|
-
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1 overflow-hidden", "data-testid": "spectral-multiselect-selected-items", children:
|
|
317
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1 overflow-hidden", "data-testid": "spectral-multiselect-selected-items", children: ae() }),
|
|
318
318
|
/* @__PURE__ */ d("div", { className: "ml-2 flex shrink-0 items-center gap-2", children: [
|
|
319
|
-
P &&
|
|
319
|
+
P && a.length > 0 && /* @__PURE__ */ s(
|
|
320
320
|
"button",
|
|
321
321
|
{
|
|
322
322
|
"aria-label": "Clear all selections",
|
|
@@ -357,7 +357,7 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
357
357
|
"aria-label": "Search options",
|
|
358
358
|
className: "border-input-border bg-input-bg focus-visible:border-input-border--focus w-full rounded-md border py-2 pr-3 pl-9 text-sm focus-visible:ring-1 focus-visible:ring-black focus-visible:outline-none",
|
|
359
359
|
"data-testid": "spectral-multiselect-search-input",
|
|
360
|
-
onChange:
|
|
360
|
+
onChange: ne,
|
|
361
361
|
placeholder: M,
|
|
362
362
|
ref: R,
|
|
363
363
|
type: "text",
|
|
@@ -382,11 +382,11 @@ const Ie = "h-4 w-4", Ce = (b) => ({
|
|
|
382
382
|
),
|
|
383
383
|
/* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" })
|
|
384
384
|
] }),
|
|
385
|
-
O.ungrouped.length > 0 && /* @__PURE__ */ s("div", { className: "mb-1", children: O.ungrouped.map((e,
|
|
386
|
-
Object.entries(O.groups).map(([e,
|
|
385
|
+
O.ungrouped.length > 0 && /* @__PURE__ */ s("div", { className: "mb-1", children: O.ungrouped.map((e, n) => J(e, n)) }),
|
|
386
|
+
Object.entries(O.groups).map(([e, n]) => /* @__PURE__ */ d("div", { className: "mb-1", "data-testid": "spectral-multiselect-group", children: [
|
|
387
387
|
(O.ungrouped.length > 0 || Object.keys(O.groups).indexOf(e) > 0) && /* @__PURE__ */ s("div", { className: "bg-input-border mx-3 my-1 h-px" }),
|
|
388
388
|
/* @__PURE__ */ s("div", { "data-testid": "spectral-multiselect-group-name", className: "text-input-text-secondary px-3 py-1 text-xs font-semibold tracking-wide uppercase", children: e }),
|
|
389
|
-
|
|
389
|
+
n.map((i, u) => J(i, k.indexOf(i)))
|
|
390
390
|
] }, e))
|
|
391
391
|
] }) })
|
|
392
392
|
] })
|
package/dist/RadioGroup.js
CHANGED
|
@@ -12,8 +12,8 @@ import { u as Ae } from "./index-ZExQO1ax.js";
|
|
|
12
12
|
import { u as Ne } from "./index-BZPx6jYI.js";
|
|
13
13
|
import { P as _e } from "./index-D6HcSXrq.js";
|
|
14
14
|
import { cn as E } from "./utils/twUtils.js";
|
|
15
|
-
import { h as Pe, c as Te, p as xe, w as Ge, m as V } from "./proxy-
|
|
16
|
-
import { A as ke } from "./index-
|
|
15
|
+
import { h as Pe, c as Te, p as xe, w as Ge, m as V } from "./proxy-CO_-Vget.js";
|
|
16
|
+
import { A as ke } from "./index-Cl8VeY0o.js";
|
|
17
17
|
var k = "rovingFocusGroup.onEntryFocus", De = { bubbles: !1, cancelable: !0 }, N = "RovingFocusGroup", [M, H, Me] = Ee(N), [Oe, z] = L(
|
|
18
18
|
N,
|
|
19
19
|
[Me]
|
package/dist/Select.js
CHANGED
|
@@ -68,65 +68,65 @@ import "./Icons/ZoomAllIcon.js";
|
|
|
68
68
|
import "./Icons/ZoomXIcon.js";
|
|
69
69
|
import "./Icons/ZoomYIcon.js";
|
|
70
70
|
import { Label as I } from "./Label.js";
|
|
71
|
-
import { R as Z, T as _, V as $, I as tt,
|
|
72
|
-
import { useFormFieldId as
|
|
71
|
+
import { R as Z, T as _, V as $, I as tt, P as et, C as rt, S as at, a as it, b as st, c as C, G as ot, d as lt, e as dt, f as mt } from "./index-CpovUAO-.js";
|
|
72
|
+
import { useFormFieldId as ct, useFormFieldState as pt, getAriaProps as nt, groupOptions as ut, getFormFieldCSSProperties as gt, getStateClasses as ht, getTriggerClasses as ft, ErrorMessage as bt, getErrorMessageId as xt, LoadingState as yt, EmptyState as Nt, getOptionClasses as vt } from "./utils/formFieldUtils.js";
|
|
73
73
|
import { cn as a } from "./utils/twUtils.js";
|
|
74
74
|
import { useState as St } from "react";
|
|
75
|
-
const
|
|
75
|
+
const wt = ({
|
|
76
76
|
align: z = "start",
|
|
77
77
|
alignOffset: F = 0,
|
|
78
78
|
avoidCollisions: O = !0,
|
|
79
79
|
className: j,
|
|
80
80
|
collisionBoundary: k,
|
|
81
81
|
collisionPadding: L = 10,
|
|
82
|
-
defaultValue:
|
|
83
|
-
emptyMessage:
|
|
82
|
+
defaultValue: P,
|
|
83
|
+
emptyMessage: T = "No options found",
|
|
84
84
|
errorMessage: n,
|
|
85
|
-
id:
|
|
85
|
+
id: V,
|
|
86
86
|
label: l,
|
|
87
87
|
labelClassName: u,
|
|
88
|
-
loadingMessage:
|
|
88
|
+
loadingMessage: q = "Loading…",
|
|
89
89
|
name: g,
|
|
90
|
-
onChange:
|
|
91
|
-
options:
|
|
92
|
-
placeholder:
|
|
90
|
+
onChange: D,
|
|
91
|
+
options: h = [],
|
|
92
|
+
placeholder: E = "Select an option",
|
|
93
93
|
position: d = "popper",
|
|
94
94
|
ref: B,
|
|
95
95
|
side: G = "bottom",
|
|
96
96
|
sideOffset: M = 4,
|
|
97
97
|
state: i = "default",
|
|
98
|
-
value:
|
|
98
|
+
value: f,
|
|
99
99
|
"aria-label": R,
|
|
100
100
|
"aria-describedby": A,
|
|
101
101
|
...s
|
|
102
102
|
}) => {
|
|
103
|
-
const [b, U] = St(!1), o =
|
|
103
|
+
const [b, U] = St(!1), o = ct(V, g), x = xt(o), { isDisabled: m, isLoading: y, isInvalid: H } = pt(s.disabled, i), J = nt(i, A, s.required, x), { groups: N, ungrouped: v } = ut(h), K = () => {
|
|
104
104
|
if (y)
|
|
105
|
-
return /* @__PURE__ */ t(
|
|
106
|
-
if (
|
|
107
|
-
return /* @__PURE__ */ t(
|
|
108
|
-
const
|
|
109
|
-
const c =
|
|
110
|
-
return /* @__PURE__ */ r(
|
|
111
|
-
/* @__PURE__ */ t(
|
|
112
|
-
/* @__PURE__ */ t(
|
|
105
|
+
return /* @__PURE__ */ t(yt, { "data-testid": "spectral-select-loading", message: q });
|
|
106
|
+
if (h.length === 0)
|
|
107
|
+
return /* @__PURE__ */ t(Nt, { "data-testid": "spectral-select-empty", message: T });
|
|
108
|
+
const S = (e) => {
|
|
109
|
+
const c = f === e.value;
|
|
110
|
+
return /* @__PURE__ */ r(lt, { className: a(vt(!!e.disabled, !1, c), "relative flex w-full cursor-pointer items-center"), "data-testid": "spectral-select-item", disabled: e.disabled, value: e.value, children: [
|
|
111
|
+
/* @__PURE__ */ t(dt, { "data-testid": "spectral-select-item-text", className: "block truncate", children: e.label }),
|
|
112
|
+
/* @__PURE__ */ t(mt, { "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(X, { size: 16 }) }) })
|
|
113
113
|
] }, e.value);
|
|
114
114
|
};
|
|
115
115
|
return /* @__PURE__ */ r(w, { children: [
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
v.length > 0 && /* @__PURE__ */ r(w, { children: [
|
|
117
|
+
v.map(S),
|
|
118
118
|
Object.keys(N).length > 0 && /* @__PURE__ */ t(C, { className: "bg-border-secondary -mx-1 my-1 h-px", "data-testid": "spectral-select-separator" })
|
|
119
119
|
] }),
|
|
120
|
-
Object.entries(N).map(([e, c], Q) => /* @__PURE__ */ r(
|
|
120
|
+
Object.entries(N).map(([e, c], Q) => /* @__PURE__ */ r(ot, { "data-testid": "spectral-select-group", children: [
|
|
121
121
|
Q > 0 && /* @__PURE__ */ t(C, { className: "bg-border-secondary -mx-1 my-1 h-px", "data-testid": "spectral-select-group-separator" }),
|
|
122
122
|
/* @__PURE__ */ t(I, { className: a("text-text-primary px-2 py-1.5 text-base font-semibold", u), "data-testid": "spectral-select-group-label", children: e }),
|
|
123
|
-
c.map((W) =>
|
|
123
|
+
c.map((W) => S(W))
|
|
124
124
|
] }, e))
|
|
125
125
|
] });
|
|
126
126
|
};
|
|
127
127
|
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
128
128
|
l && /* @__PURE__ */ t(I, { className: a("text-text-primary mb-2 block", u, m && "text-text-secondary"), "data-testid": "spectral-select-label", htmlFor: o, children: l }),
|
|
129
|
-
/* @__PURE__ */ r(Z, { "data-testid": "spectral-select", defaultValue:
|
|
129
|
+
/* @__PURE__ */ r(Z, { "data-testid": "spectral-select", defaultValue: P, disabled: m, name: g, onOpenChange: U, onValueChange: D, open: b, required: s.required, value: f, children: [
|
|
130
130
|
/* @__PURE__ */ t(
|
|
131
131
|
_,
|
|
132
132
|
{
|
|
@@ -134,24 +134,24 @@ const vt = ({
|
|
|
134
134
|
"aria-expanded": b,
|
|
135
135
|
"aria-label": R ?? l,
|
|
136
136
|
asChild: !0,
|
|
137
|
-
className: a(ft(!1, i),
|
|
137
|
+
className: a(ft(!1, i), ht(i), j),
|
|
138
138
|
"data-slot": "select-trigger",
|
|
139
139
|
"data-state": i,
|
|
140
140
|
"data-testid": "spectral-select-trigger",
|
|
141
141
|
id: o,
|
|
142
142
|
ref: B,
|
|
143
143
|
role: "combobox",
|
|
144
|
-
style:
|
|
144
|
+
style: gt(),
|
|
145
145
|
...J,
|
|
146
146
|
...s,
|
|
147
147
|
children: /* @__PURE__ */ r("button", { type: "button", disabled: m, children: [
|
|
148
|
-
/* @__PURE__ */ t($, { className: "block truncate", "data-testid": "spectral-select-value", placeholder:
|
|
148
|
+
/* @__PURE__ */ t($, { className: "block truncate", "data-testid": "spectral-select-value", placeholder: E }),
|
|
149
149
|
/* @__PURE__ */ t(tt, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "flex items-center", children: y ? /* @__PURE__ */ t(Y, { size: 20 }) : /* @__PURE__ */ t(p, { className: "transition-transform duration-200 data-[state=open]:rotate-180", size: 20 }) }) })
|
|
150
150
|
] })
|
|
151
151
|
}
|
|
152
152
|
),
|
|
153
|
-
/* @__PURE__ */ r(
|
|
154
|
-
|
|
153
|
+
/* @__PURE__ */ t(et, { children: /* @__PURE__ */ r(
|
|
154
|
+
rt,
|
|
155
155
|
{
|
|
156
156
|
align: z,
|
|
157
157
|
alignOffset: F,
|
|
@@ -159,7 +159,7 @@ const vt = ({
|
|
|
159
159
|
className: a(
|
|
160
160
|
"border-input-border bg-input-bg motion-safe:data-[state=open]:animate-in motion-safe:data-[state=closed]:animate-out relative z-50 rounded-lg border shadow-md",
|
|
161
161
|
"motion-safe:data-[state=closed]:fade-out-0 motion-safe:data-[state=open]:fade-in-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:zoom-in-95",
|
|
162
|
-
"motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-select-content-available-height)",
|
|
162
|
+
"motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 max-h-[min(var(--radix-select-content-available-height),300px)]",
|
|
163
163
|
"min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto",
|
|
164
164
|
d === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1"
|
|
165
165
|
),
|
|
@@ -171,17 +171,17 @@ const vt = ({
|
|
|
171
171
|
side: G,
|
|
172
172
|
sideOffset: M,
|
|
173
173
|
children: [
|
|
174
|
-
/* @__PURE__ */ t(
|
|
175
|
-
/* @__PURE__ */ t(
|
|
176
|
-
/* @__PURE__ */ t(
|
|
174
|
+
/* @__PURE__ */ t(at, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-up-button", children: /* @__PURE__ */ t(p, { "aria-hidden": "true", className: "rotate-180", size: 18 }) }),
|
|
175
|
+
/* @__PURE__ */ t(it, { asChild: !0, children: /* @__PURE__ */ t("div", { className: a("p-1", d === "popper" && "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"), "data-testid": "spectral-select-items", children: K() }) }),
|
|
176
|
+
/* @__PURE__ */ t(st, { className: "flex cursor-default items-center justify-center py-1", "data-testid": "spectral-select-scroll-down-button", children: /* @__PURE__ */ t(p, { "aria-hidden": "true", size: 18 }) })
|
|
177
177
|
]
|
|
178
178
|
}
|
|
179
|
-
)
|
|
179
|
+
) })
|
|
180
180
|
] }),
|
|
181
|
-
H && n && /* @__PURE__ */ t(
|
|
181
|
+
H && n && /* @__PURE__ */ t(bt, { "data-testid": "spectral-select-error-message", id: x, message: n })
|
|
182
182
|
] });
|
|
183
183
|
};
|
|
184
|
-
|
|
184
|
+
wt.displayName = "Select";
|
|
185
185
|
export {
|
|
186
|
-
|
|
186
|
+
wt as Select
|
|
187
187
|
};
|
package/dist/Tabs/TabsBase.js
CHANGED
|
@@ -5,8 +5,8 @@ import { generateId as K, prefersReducedMotion as $, calculateIndicatorStyle as
|
|
|
5
5
|
import { cn as x } from "../utils/twUtils.js";
|
|
6
6
|
import { createContext as k, useContext as U, useState as M, useId as F, useCallback as T, useRef as q, useMemo as B, useEffect as R } from "react";
|
|
7
7
|
import { j as H } from "../index-DEYs15GP.js";
|
|
8
|
-
import { m as D } from "../proxy-
|
|
9
|
-
import { A as G } from "../index-
|
|
8
|
+
import { m as D } from "../proxy-CO_-Vget.js";
|
|
9
|
+
import { A as G } from "../index-Cl8VeY0o.js";
|
|
10
10
|
const N = k(null), A = (y = "Tabs") => {
|
|
11
11
|
const d = U(N);
|
|
12
12
|
if (d === null)
|
package/dist/Tray.js
CHANGED
|
@@ -73,8 +73,8 @@ import { c as M } from "./index-D29mdTf5.js";
|
|
|
73
73
|
import { createContext as H, useRef as h, useMemo as T, useContext as I } from "react";
|
|
74
74
|
import { j as g } from "./index-DEYs15GP.js";
|
|
75
75
|
import { D as s } from "./index-CrjD9cAD.js";
|
|
76
|
-
import { m as v } from "./proxy-
|
|
77
|
-
import { A as O } from "./index-
|
|
76
|
+
import { m as v } from "./proxy-CO_-Vget.js";
|
|
77
|
+
import { A as O } from "./index-Cl8VeY0o.js";
|
|
78
78
|
const j = M("fixed bottom-4 left-1/2 z-10 -translate-x-1/2 overflow-hidden rounded-2xl bg-drawer-bg outline-none w-full sm:max-md:max-w-full", {
|
|
79
79
|
variants: {
|
|
80
80
|
size: {
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import { jsx as b, Fragment as U } from "react/jsx-runtime";
|
|
3
|
+
import * as v from "react";
|
|
4
|
+
import { useId as W, useRef as P, useContext as Y, useInsertionEffect as V, useMemo as A, Children as X, isValidElement as _, useState as I } from "react";
|
|
5
|
+
import { M as B, d as T, u as j, P as F, e as G, b as O, L as q } from "./proxy-CO_-Vget.js";
|
|
6
|
+
function D(e, s) {
|
|
7
|
+
if (typeof e == "function")
|
|
8
|
+
return e(s);
|
|
9
|
+
e != null && (e.current = s);
|
|
10
|
+
}
|
|
11
|
+
function J(...e) {
|
|
12
|
+
return (s) => {
|
|
13
|
+
let t = !1;
|
|
14
|
+
const o = e.map((l) => {
|
|
15
|
+
const r = D(l, s);
|
|
16
|
+
return !t && typeof r == "function" && (t = !0), r;
|
|
17
|
+
});
|
|
18
|
+
if (t)
|
|
19
|
+
return () => {
|
|
20
|
+
for (let l = 0; l < o.length; l++) {
|
|
21
|
+
const r = o[l];
|
|
22
|
+
typeof r == "function" ? r() : D(e[l], null);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function Q(...e) {
|
|
28
|
+
return v.useCallback(J(...e), e);
|
|
29
|
+
}
|
|
30
|
+
class Z extends v.Component {
|
|
31
|
+
getSnapshotBeforeUpdate(s) {
|
|
32
|
+
const t = this.props.childRef.current;
|
|
33
|
+
if (t && s.isPresent && !this.props.isPresent && this.props.pop !== !1) {
|
|
34
|
+
const o = t.offsetParent, l = T(o) && o.offsetWidth || 0, r = T(o) && o.offsetHeight || 0, n = this.props.sizeRef.current;
|
|
35
|
+
n.height = t.offsetHeight || 0, n.width = t.offsetWidth || 0, n.top = t.offsetTop, n.left = t.offsetLeft, n.right = l - n.width - n.left, n.bottom = r - n.height - n.top;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Required with getSnapshotBeforeUpdate to stop React complaining.
|
|
41
|
+
*/
|
|
42
|
+
componentDidUpdate() {
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return this.props.children;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function ee({ children: e, isPresent: s, anchorX: t, anchorY: o, root: l, pop: r }) {
|
|
49
|
+
const n = W(), h = P(null), g = P({
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0,
|
|
52
|
+
top: 0,
|
|
53
|
+
left: 0,
|
|
54
|
+
right: 0,
|
|
55
|
+
bottom: 0
|
|
56
|
+
}), { nonce: y } = Y(B), u = e.props?.ref ?? e?.ref, w = Q(h, u);
|
|
57
|
+
return V(() => {
|
|
58
|
+
const { width: c, height: a, top: p, left: m, right: C, bottom: E } = g.current;
|
|
59
|
+
if (s || r === !1 || !h.current || !c || !a)
|
|
60
|
+
return;
|
|
61
|
+
const M = t === "left" ? `left: ${m}` : `right: ${C}`, L = o === "bottom" ? `bottom: ${E}` : `top: ${p}`;
|
|
62
|
+
h.current.dataset.motionPopId = n;
|
|
63
|
+
const f = document.createElement("style");
|
|
64
|
+
y && (f.nonce = y);
|
|
65
|
+
const x = l ?? document.head;
|
|
66
|
+
return x.appendChild(f), f.sheet && f.sheet.insertRule(`
|
|
67
|
+
[data-motion-pop-id="${n}"] {
|
|
68
|
+
position: absolute !important;
|
|
69
|
+
width: ${c}px !important;
|
|
70
|
+
height: ${a}px !important;
|
|
71
|
+
${M}px !important;
|
|
72
|
+
${L}px !important;
|
|
73
|
+
}
|
|
74
|
+
`), () => {
|
|
75
|
+
x.contains(f) && x.removeChild(f);
|
|
76
|
+
};
|
|
77
|
+
}, [s]), b(Z, { isPresent: s, childRef: h, sizeRef: g, pop: r, children: r === !1 ? e : v.cloneElement(e, { ref: w }) });
|
|
78
|
+
}
|
|
79
|
+
const te = ({ children: e, initial: s, isPresent: t, onExitComplete: o, custom: l, presenceAffectsLayout: r, mode: n, anchorX: h, anchorY: g, root: y }) => {
|
|
80
|
+
const u = j(ne), w = W();
|
|
81
|
+
let c = !0, a = A(() => (c = !1, {
|
|
82
|
+
id: w,
|
|
83
|
+
initial: s,
|
|
84
|
+
isPresent: t,
|
|
85
|
+
custom: l,
|
|
86
|
+
onExitComplete: (p) => {
|
|
87
|
+
u.set(p, !0);
|
|
88
|
+
for (const m of u.values())
|
|
89
|
+
if (!m)
|
|
90
|
+
return;
|
|
91
|
+
o && o();
|
|
92
|
+
},
|
|
93
|
+
register: (p) => (u.set(p, !1), () => u.delete(p))
|
|
94
|
+
}), [t, u, o]);
|
|
95
|
+
return r && c && (a = { ...a }), A(() => {
|
|
96
|
+
u.forEach((p, m) => u.set(m, !1));
|
|
97
|
+
}, [t]), v.useEffect(() => {
|
|
98
|
+
!t && !u.size && o && o();
|
|
99
|
+
}, [t]), e = b(ee, { pop: n === "popLayout", isPresent: t, anchorX: h, anchorY: g, root: y, children: e }), b(F.Provider, { value: a, children: e });
|
|
100
|
+
};
|
|
101
|
+
function ne() {
|
|
102
|
+
return /* @__PURE__ */ new Map();
|
|
103
|
+
}
|
|
104
|
+
const $ = (e) => e.key || "";
|
|
105
|
+
function S(e) {
|
|
106
|
+
const s = [];
|
|
107
|
+
return X.forEach(e, (t) => {
|
|
108
|
+
_(t) && s.push(t);
|
|
109
|
+
}), s;
|
|
110
|
+
}
|
|
111
|
+
const ie = ({ children: e, custom: s, initial: t = !0, onExitComplete: o, presenceAffectsLayout: l = !0, mode: r = "sync", propagate: n = !1, anchorX: h = "left", anchorY: g = "top", root: y }) => {
|
|
112
|
+
const [u, w] = G(n), c = A(() => S(e), [e]), a = n && !u ? [] : c.map($), p = P(!0), m = P(c), C = j(() => /* @__PURE__ */ new Map()), E = P(/* @__PURE__ */ new Set()), [M, L] = I(c), [f, x] = I(c);
|
|
113
|
+
O(() => {
|
|
114
|
+
p.current = !1, m.current = c;
|
|
115
|
+
for (let d = 0; d < f.length; d++) {
|
|
116
|
+
const i = $(f[d]);
|
|
117
|
+
a.includes(i) ? (C.delete(i), E.current.delete(i)) : C.get(i) !== !0 && C.set(i, !1);
|
|
118
|
+
}
|
|
119
|
+
}, [f, a.length, a.join("-")]);
|
|
120
|
+
const k = [];
|
|
121
|
+
if (c !== M) {
|
|
122
|
+
let d = [...c];
|
|
123
|
+
for (let i = 0; i < f.length; i++) {
|
|
124
|
+
const R = f[i], z = $(R);
|
|
125
|
+
a.includes(z) || (d.splice(i, 0, R), k.push(R));
|
|
126
|
+
}
|
|
127
|
+
return r === "wait" && k.length && (d = k), x(S(d)), L(c), null;
|
|
128
|
+
}
|
|
129
|
+
process.env.NODE_ENV !== "production" && r === "wait" && f.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
130
|
+
const { forceRender: K } = Y(q);
|
|
131
|
+
return b(U, { children: f.map((d) => {
|
|
132
|
+
const i = $(d), R = n && !u ? !1 : c === f || a.includes(i), z = () => {
|
|
133
|
+
if (E.current.has(i))
|
|
134
|
+
return;
|
|
135
|
+
if (E.current.add(i), C.has(i))
|
|
136
|
+
C.set(i, !0);
|
|
137
|
+
else
|
|
138
|
+
return;
|
|
139
|
+
let H = !0;
|
|
140
|
+
C.forEach((N) => {
|
|
141
|
+
N || (H = !1);
|
|
142
|
+
}), H && (K?.(), x(m.current), n && w?.(), o && o());
|
|
143
|
+
};
|
|
144
|
+
return b(te, { isPresent: R, initial: !p.current || t ? void 0 : !1, custom: s, presenceAffectsLayout: l, mode: r, root: y, onExitComplete: R ? void 0 : z, anchorX: h, anchorY: g, children: d }, i);
|
|
145
|
+
}) });
|
|
146
|
+
};
|
|
147
|
+
export {
|
|
148
|
+
ie as A
|
|
149
|
+
};
|