@spear-ai/spectral 1.8.9 → 1.9.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/.js +214 -210
- package/dist/Accordion.js +4 -4
- package/dist/Combobox/ComboboxBase.d.ts +8 -0
- package/dist/Combobox/ComboboxBase.js +80 -0
- package/dist/Combobox.d.ts +20 -0
- package/dist/Combobox.js +175 -0
- package/dist/ComboboxBase-CxNxYtdT.js +408 -0
- package/dist/ControlGroup/ControlGroupSelect.d.ts +33 -0
- package/dist/ControlGroup/ControlGroupSelect.js +104 -0
- package/dist/ControlGroup.d.ts +24 -0
- package/dist/ControlGroup.js +51 -0
- package/dist/DateTimePicker/DateTimeDisplayInput.js +53 -52
- package/dist/DateTimePicker/DateTimeInput.d.ts +5 -3
- package/dist/DateTimePicker/DateTimeInput.js +122 -69
- package/dist/Dialog.js +2 -2
- package/dist/Drawer.js +1 -1
- package/dist/HoverCard.js +4 -4
- package/dist/Icons/IconBase.d.ts +1 -1
- package/dist/Icons/IconBase.js +63 -20
- package/dist/MultiSelect/MultiSelectBase.js +128 -126
- package/dist/Popover.js +1 -1
- package/dist/RadioGroup.js +5 -5
- package/dist/Select.js +1 -1
- package/dist/Slider.js +3 -3
- package/dist/Tooltip.js +6 -6
- package/dist/Tray.d.ts +3 -1
- package/dist/Tray.js +36 -32
- package/dist/{Combination-CQ5bXZqE.js → index-6oYKCvIn.js} +179 -178
- package/dist/{index-CtqlhLRO.js → index-BFOf48AQ.js} +1 -1
- package/dist/{index-BJ6qs9i5.js → index-BlHU_t18.js} +7 -7
- package/dist/{index-D2Qxe4uK.js → index-Bm1RbF6w.js} +1 -1
- package/dist/{index-CXltlPV-.js → index-Bv2OIg5P.js} +6 -6
- package/dist/{index-Cgdmxb3F.js → index-CKEI0pDv.js} +1 -1
- package/dist/{index-CDkQCeZY.js → index-CM_hWgfC.js} +1 -1
- package/dist/{index-CJKg3MVV.js → index-C_YVr64u.js} +2 -2
- package/dist/{index-obMGvcdD.js → index-CwSyIPrv.js} +1 -1
- package/dist/{index-9OmOYyjJ.js → index-Dc0No4pV.js} +2 -1
- package/dist/{index-DqvTB1Bv.js → index-T6XEa11q.js} +7 -7
- package/dist/{index-CmWCa9Ae.js → index-pBCLb6Gr.js} +5 -5
- package/dist/{index-WBfSMXvE.js → index-psiVrsnE.js} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.d.ts.map +1 -1
- package/dist/primitives/button.js +4 -4
- package/dist/{InputGroup.d.ts → primitives/input-group.d.ts} +10 -7
- package/dist/primitives/input-group.d.ts.map +1 -0
- package/dist/primitives/input-group.js +74 -0
- package/dist/primitives/input.d.ts +6 -1
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/popover.d.ts +10 -0
- package/dist/primitives/popover.d.ts.map +1 -0
- package/dist/primitives/popover.js +29 -0
- package/dist/primitives/select.js +2 -2
- package/dist/styles/spectral.css +2 -2
- package/package.json +1 -1
- package/dist/InputGroup.js +0 -84
|
@@ -1,91 +1,144 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { getResolvedLocale as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { cn as
|
|
7
|
-
import {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
4
|
+
import { getResolvedLocale as P, getAriaValueMinMax as _, getDateByType as $, formatTimeNumber as v, getAriaValueNow as k, getAriaLabel as q, DEFAULT_TRANSLATIONS as z, setDateByType as x, getArrowByType as G } from "./DateTimeUtils.js";
|
|
5
|
+
import { Input as J } from "../primitives/input.js";
|
|
6
|
+
import { cn as Q } from "../utils/twUtils.js";
|
|
7
|
+
import { useRef as V, useMemo as y, useEffect as W, useCallback as M } from "react";
|
|
8
|
+
const X = (...N) => (m) => {
|
|
9
|
+
N.forEach((p) => {
|
|
10
|
+
p && (typeof p == "function" ? p(m) : p.current = m);
|
|
11
|
+
});
|
|
12
|
+
}, Y = ({ className: N, date: m, disabled: p, id: B, locale: A, name: b, onKeyDown: R, onLeftFocus: I, onRightFocus: g, period: w, picker: r, ref: E, setDate: D, translations: T = z, ...L }) => {
|
|
13
|
+
const o = V(null), H = X(o, E), n = V(""), i = V(!1), d = y(() => P(A), [A]), s = y(() => {
|
|
14
|
+
if (m) return m;
|
|
11
15
|
const t = /* @__PURE__ */ new Date();
|
|
12
16
|
return t.setHours(0, 0, 0, 0), t;
|
|
13
|
-
}, [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"aria-
|
|
17
|
-
"aria-
|
|
18
|
-
"aria-
|
|
19
|
-
"aria-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, q);
|
|
28
|
-
return () => clearTimeout(t);
|
|
29
|
-
}, [n]);
|
|
30
|
-
const I = N(
|
|
31
|
-
(t) => e === "12hours" && n && r.startsWith("1") && v === "0" ? `0${t}` : n ? `${r[1]}${t}` : `0${t}`,
|
|
32
|
-
[e, n, r, v]
|
|
33
|
-
), h = N(
|
|
17
|
+
}, [m]), { min: u, max: c } = y(() => _(r), [r]), h = y(() => $(s, r), [s, r]), f = y(() => v(parseInt(h, 10), d), [h, d]), U = y(
|
|
18
|
+
() => ({
|
|
19
|
+
"aria-label": q(r, T),
|
|
20
|
+
"aria-valuemin": u,
|
|
21
|
+
"aria-valuemax": c,
|
|
22
|
+
"aria-valuenow": k(s, r),
|
|
23
|
+
"aria-valuetext": f
|
|
24
|
+
}),
|
|
25
|
+
[s, r, f, T, u, c]
|
|
26
|
+
);
|
|
27
|
+
W(() => {
|
|
28
|
+
o.current && !i.current && (o.current.value = f);
|
|
29
|
+
}, [f]);
|
|
30
|
+
const l = M(
|
|
34
31
|
(t) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return;
|
|
32
|
+
n.current = "", i.current = !1;
|
|
33
|
+
const e = new Date(s);
|
|
34
|
+
D(x(e, r, t, w));
|
|
35
|
+
},
|
|
36
|
+
[s, r, w, D]
|
|
37
|
+
), K = M(
|
|
38
|
+
(t) => {
|
|
39
|
+
if (t.key === "Tab") {
|
|
40
|
+
if (n.current) {
|
|
41
|
+
const e = parseInt(n.current, 10);
|
|
42
|
+
if (!isNaN(e)) {
|
|
43
|
+
const a = Math.max(u, Math.min(c, e));
|
|
44
|
+
l(a.toString().padStart(2, "0"));
|
|
45
|
+
}
|
|
50
46
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (t.key === "ArrowRight") {
|
|
50
|
+
if (t.preventDefault(), n.current) {
|
|
51
|
+
const e = parseInt(n.current, 10);
|
|
52
|
+
if (!isNaN(e)) {
|
|
53
|
+
const a = Math.max(u, Math.min(c, e));
|
|
54
|
+
l(a.toString().padStart(2, "0"));
|
|
55
|
+
}
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
g?.();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (t.key === "ArrowLeft") {
|
|
61
|
+
if (t.preventDefault(), n.current) {
|
|
62
|
+
const e = parseInt(n.current, 10);
|
|
63
|
+
if (!isNaN(e)) {
|
|
64
|
+
const a = Math.max(u, Math.min(c, e));
|
|
65
|
+
l(a.toString().padStart(2, "0"));
|
|
66
|
+
}
|
|
62
67
|
}
|
|
68
|
+
I?.();
|
|
69
|
+
return;
|
|
63
70
|
}
|
|
71
|
+
if (t.key === "ArrowUp" || t.key === "ArrowDown") {
|
|
72
|
+
t.preventDefault(), n.current = "", i.current = !1;
|
|
73
|
+
const e = t.key === "ArrowUp" ? 1 : -1, a = G(e, r, h), S = new Date(s);
|
|
74
|
+
D(x(S, r, a, w));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (t.key === "Home" || t.key === "End") {
|
|
78
|
+
t.preventDefault(), n.current = "", i.current = !1;
|
|
79
|
+
const e = (t.key === "Home" ? u : c).toString().padStart(2, "0"), a = new Date(s);
|
|
80
|
+
D(x(a, r, e, w));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (t.key >= "0" && t.key <= "9") {
|
|
84
|
+
t.preventDefault();
|
|
85
|
+
const e = n.current + t.key, a = parseInt(e, 10);
|
|
86
|
+
if (e.length >= 2) {
|
|
87
|
+
const S = Math.max(u, Math.min(c, a));
|
|
88
|
+
l(S.toString().padStart(2, "0")), g?.();
|
|
89
|
+
} else if (a * 10 > c) {
|
|
90
|
+
const S = Math.max(u, Math.min(c, a));
|
|
91
|
+
l(S.toString().padStart(2, "0")), g?.();
|
|
92
|
+
} else
|
|
93
|
+
n.current = e, i.current = !0, o.current && (o.current.value = v(a, d));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (t.key === "Backspace")
|
|
97
|
+
if (t.preventDefault(), n.current) {
|
|
98
|
+
const e = n.current.slice(0, -1);
|
|
99
|
+
n.current = e, i.current = e.length > 0, o.current && (o.current.value = e ? v(parseInt(e, 10), d) : f);
|
|
100
|
+
} else
|
|
101
|
+
n.current = "", l(u.toString().padStart(2, "0")), o.current && (o.current.value = v(u, d));
|
|
64
102
|
},
|
|
65
|
-
[
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
|
|
103
|
+
[h, s, u, c, I, g, w, r, D, l, f, d]
|
|
104
|
+
), O = M(() => {
|
|
105
|
+
i.current || (n.current = "");
|
|
106
|
+
}, []), j = M(() => {
|
|
107
|
+
if (n.current) {
|
|
108
|
+
const t = parseInt(n.current, 10);
|
|
109
|
+
if (isNaN(t))
|
|
110
|
+
n.current = "", i.current = !1;
|
|
111
|
+
else {
|
|
112
|
+
const e = Math.max(u, Math.min(c, t));
|
|
113
|
+
l(e.toString().padStart(2, "0"));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, [u, c, l]);
|
|
117
|
+
return /* @__PURE__ */ C(
|
|
118
|
+
J,
|
|
69
119
|
{
|
|
70
|
-
className:
|
|
120
|
+
className: Q("text-center tabular-nums", N),
|
|
71
121
|
"data-slot": "datetime-input",
|
|
72
|
-
"data-testid": `spectral-datetime-input-${
|
|
73
|
-
|
|
74
|
-
|
|
122
|
+
"data-testid": `spectral-datetime-input-${r}`,
|
|
123
|
+
defaultValue: f,
|
|
124
|
+
disabled: p,
|
|
125
|
+
id: B ?? r,
|
|
75
126
|
inputMode: "numeric",
|
|
76
|
-
name:
|
|
127
|
+
name: b ?? r,
|
|
128
|
+
onBlur: j,
|
|
129
|
+
onFocus: O,
|
|
77
130
|
onKeyDown: (t) => {
|
|
78
|
-
|
|
131
|
+
R?.(t), K(t);
|
|
79
132
|
},
|
|
80
133
|
readOnly: !0,
|
|
134
|
+
ref: H,
|
|
81
135
|
role: "spinbutton",
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
...M
|
|
136
|
+
...U,
|
|
137
|
+
...L
|
|
85
138
|
}
|
|
86
139
|
);
|
|
87
140
|
};
|
|
88
|
-
|
|
141
|
+
Y.displayName = "DateTimeInput";
|
|
89
142
|
export {
|
|
90
|
-
|
|
143
|
+
Y as DateTimeInput
|
|
91
144
|
};
|
package/dist/Dialog.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
2
|
import { jsx as o, jsxs as l } from "react/jsx-runtime";
|
|
3
3
|
import { CloseIcon as m } from "./Icons/CloseIcon.js";
|
|
4
|
-
import { R as p, C as i, a as f, D as u, O as x, P as b, T as h, b as v } from "./index-
|
|
4
|
+
import { R as p, C as i, a as f, D as u, O as x, P as b, T as h, b as v } from "./index-pBCLb6Gr.js";
|
|
5
5
|
import { cn as e } from "./utils/twUtils.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { R as y } from "./
|
|
7
|
+
import { R as y } from "./index-6oYKCvIn.js";
|
|
8
8
|
const j = ({
|
|
9
9
|
isOpen: t,
|
|
10
10
|
modal: a = !1,
|
package/dist/Drawer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
2
|
import { jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
3
3
|
import { SpectralProvider as f } from "./SpectralProvider.js";
|
|
4
|
-
import { D as e } from "./index-
|
|
4
|
+
import { D as e } from "./index-Bm1RbF6w.js";
|
|
5
5
|
const u = ({ children: l, defaultOpen: d = !1, description: i, direction: o = "right", dismissible: c = !0, modal: n = !0, onOpenChange: p, open: x, size: r = "380px", title: h, trigger: m }) => {
|
|
6
6
|
const a = "font-sans! fixed", w = {
|
|
7
7
|
left: {
|
package/dist/HoverCard.js
CHANGED
|
@@ -3,10 +3,10 @@ import "./styles/main.css";
|
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
import * as s from "react";
|
|
5
5
|
import { createContext as I, useContext as B } from "react";
|
|
6
|
-
import { e as U, c as m, P as $, u as W, a as z } from "./index-
|
|
7
|
-
import { R as G, A as K, c as O, C as j, a as V } from "./index-
|
|
8
|
-
import { P as q, D as J } from "./index-
|
|
9
|
-
import { P as T } from "./index-
|
|
6
|
+
import { e as U, c as m, P as $, u as W, a as z } from "./index-Dc0No4pV.js";
|
|
7
|
+
import { R as G, A as K, c as O, C as j, a as V } from "./index-C_YVr64u.js";
|
|
8
|
+
import { P as q, D as J } from "./index-BlHU_t18.js";
|
|
9
|
+
import { P as T } from "./index-BFOf48AQ.js";
|
|
10
10
|
import { cn as E } from "./utils/twUtils.js";
|
|
11
11
|
var H, x = "HoverCard", [N] = z(x, [
|
|
12
12
|
O
|
package/dist/Icons/IconBase.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ interface IconBaseProps extends Omit<IconProps, 'strokeWidth'>, ComponentPropsWi
|
|
|
9
9
|
title?: string;
|
|
10
10
|
color?: string;
|
|
11
11
|
}
|
|
12
|
-
declare const IconBase: ({ ref, children, title, size, ariaHidden, description, className, disabled, ...rest }: IconBaseProps & {
|
|
12
|
+
declare const IconBase: ({ ref, children, title, size, ariaHidden, description, className, disabled, onClick, onKeyDown, role, tabIndex, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, ...rest }: IconBaseProps & {
|
|
13
13
|
ref?: Ref<SVGSVGElement>;
|
|
14
14
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export default IconBase;
|
package/dist/Icons/IconBase.js
CHANGED
|
@@ -1,26 +1,69 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../styles/main.css";
|
|
3
|
-
import { jsxs as
|
|
4
|
-
import { createContext as
|
|
5
|
-
const
|
|
6
|
-
ref:
|
|
7
|
-
children:
|
|
8
|
-
title:
|
|
9
|
-
size:
|
|
10
|
-
ariaHidden:
|
|
11
|
-
description:
|
|
12
|
-
className:
|
|
13
|
-
disabled:
|
|
14
|
-
|
|
3
|
+
import { jsxs as _, jsx as u } from "react/jsx-runtime";
|
|
4
|
+
import { createContext as D, useId as O, useCallback as w } from "react";
|
|
5
|
+
const P = D(""), S = function({
|
|
6
|
+
ref: x,
|
|
7
|
+
children: g,
|
|
8
|
+
title: c,
|
|
9
|
+
size: b = 24,
|
|
10
|
+
ariaHidden: p = !0,
|
|
11
|
+
description: s,
|
|
12
|
+
className: B,
|
|
13
|
+
disabled: n,
|
|
14
|
+
onClick: i,
|
|
15
|
+
onKeyDown: l,
|
|
16
|
+
role: y,
|
|
17
|
+
tabIndex: k,
|
|
18
|
+
"aria-label": h,
|
|
19
|
+
"aria-labelledby": f,
|
|
20
|
+
...E
|
|
15
21
|
}) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
const r = O(), t = i !== void 0, o = t && !n, d = c !== void 0 || !!h || !!f;
|
|
23
|
+
process.env.NODE_ENV !== "production" && t && !d && console.warn("IconBase: an onClick handler was provided without an accessible name (title, aria-label, or aria-labelledby). Interactive icons must have an accessible name. The icon will be hidden from the accessibility tree.");
|
|
24
|
+
const v = t && !d, a = (d || t) && !v ? !1 : p, A = y ?? (t && !v ? "button" : "img"), C = k ?? (o && !v ? 0 : void 0), j = w(
|
|
25
|
+
(e) => {
|
|
26
|
+
l?.(e), !e.defaultPrevented && o && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.currentTarget.dispatchEvent(new MouseEvent("click", { bubbles: !0, cancelable: !0 })));
|
|
27
|
+
},
|
|
28
|
+
[o, l]
|
|
29
|
+
), N = w(
|
|
30
|
+
(e) => {
|
|
31
|
+
n || i?.(e);
|
|
32
|
+
},
|
|
33
|
+
[n, i]
|
|
34
|
+
), m = !a && c ? `${r}_title` : "", I = !a && s ? `${r}_desc` : "", T = [m, I].filter(Boolean).join(" ") || void 0;
|
|
35
|
+
return (
|
|
36
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- role is dynamic: 'button' when interactive, 'img' otherwise
|
|
37
|
+
/* @__PURE__ */ _(
|
|
38
|
+
"svg",
|
|
39
|
+
{
|
|
40
|
+
...E,
|
|
41
|
+
"aria-disabled": n && t ? !0 : void 0,
|
|
42
|
+
"aria-hidden": a,
|
|
43
|
+
"aria-label": h,
|
|
44
|
+
"aria-labelledby": f ?? T,
|
|
45
|
+
className: B,
|
|
46
|
+
"data-disabled": n,
|
|
47
|
+
fill: "none",
|
|
48
|
+
height: b,
|
|
49
|
+
onClick: i ? N : void 0,
|
|
50
|
+
onKeyDown: o || l ? j : void 0,
|
|
51
|
+
ref: x,
|
|
52
|
+
role: A,
|
|
53
|
+
tabIndex: C,
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
width: b,
|
|
56
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
57
|
+
children: [
|
|
58
|
+
!a && c && /* @__PURE__ */ u("title", { id: m, children: c }),
|
|
59
|
+
!a && s && /* @__PURE__ */ u("desc", { id: I, children: s }),
|
|
60
|
+
/* @__PURE__ */ u(P.Provider, { value: r, children: g })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
);
|
|
22
65
|
};
|
|
23
66
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
67
|
+
P as SvgIdContext,
|
|
68
|
+
S as default
|
|
26
69
|
};
|