@spear-ai/spectral 1.4.3 → 1.4.5
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/Alert/AlertBase.js +5 -5
- package/dist/Button.js +3 -3
- package/dist/ButtonGroup.js +6 -6
- package/dist/Card.d.ts +2 -7
- package/dist/Card.js +7 -18
- package/dist/DataCard.d.ts +11 -0
- package/dist/DataCard.js +18 -0
- package/dist/Select.d.ts +1 -1
- package/dist/Select.js +54 -54
- package/dist/Slider.js +26 -17
- package/dist/Switch.js +8 -8
- package/dist/Tabs/TabsBase.js +18 -18
- package/dist/Tabs/tabsUtils.js +31 -30
- package/dist/Textarea.js +2 -2
- package/dist/styles/base-colors.css +12 -12
- package/dist/styles/main.css +1 -1
- package/package.json +1 -1
- package/dist/Slider/SliderBase.d.ts +0 -54
- package/dist/Slider/SliderBase.js +0 -256
- package/dist/Tooltip/TooltipBase.d.ts +0 -51
- package/dist/Tooltip/TooltipBase.js +0 -186
package/dist/Alert/AlertBase.js
CHANGED
|
@@ -28,15 +28,15 @@ const g = n(
|
|
|
28
28
|
danger: "text-alert-danger-text",
|
|
29
29
|
info: "text-alert-info-text",
|
|
30
30
|
default: "text-alert-text"
|
|
31
|
-
}, f = i(({ className: t, variant: e, ...
|
|
31
|
+
}, f = i(({ className: t, variant: e, ...a }, r) => /* @__PURE__ */ l("div", { className: s(g({ variant: e }), t), "data-slot": "alert", "data-testid": "spectral-alert", ref: r, role: "alert", ...a }));
|
|
32
32
|
f.displayName = "AlertBase";
|
|
33
|
-
const m = i(({ className: t, variant: e, ...
|
|
33
|
+
const m = i(({ className: t, variant: e, ...a }, r) => /* @__PURE__ */ l("div", { className: s(x[e], "col-start-2 line-clamp-1 min-h-4 font-semibold text-base tracking-tight h-6 flex items-center", t), "data-slot": "alert-title", "data-testid": "spectral-alert-title", ref: r, ...a }));
|
|
34
34
|
m.displayName = "AlertTitle";
|
|
35
|
-
const u = i(({ className: t, ...e },
|
|
35
|
+
const u = i(({ className: t, ...e }, a) => /* @__PURE__ */ l("div", { className: s("text-primary-inverse col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed", t), "data-slot": "alert-description", "data-testid": "spectral-alert-description", ref: a, ...e }));
|
|
36
36
|
u.displayName = "AlertDescription";
|
|
37
37
|
function A({ children: t, container: e }) {
|
|
38
|
-
const [
|
|
39
|
-
return d(() => (
|
|
38
|
+
const [a, r] = o(!1);
|
|
39
|
+
return d(() => (r(!0), () => r(!1)), []), a ? c(t, e ?? document.body) : null;
|
|
40
40
|
}
|
|
41
41
|
export {
|
|
42
42
|
f as AlertBase,
|
package/dist/Button.js
CHANGED
|
@@ -27,7 +27,7 @@ const w = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], _ = N
|
|
|
27
27
|
outline: `bg-button-outline-bg border-button-outline-border text-button-outline-text hover:bg-button-outline-bg--hover hover:text-button-outline-text--hover focus-visible:outline-button-outline-border
|
|
28
28
|
disabled:text-button-outline-text--disabled disabled:border-button-outline-border--disabled`,
|
|
29
29
|
ghost: "bg-button-ghost-bg border-none text-button-ghost-text hover:bg-button-ghost-bg--hover hover:text-button-ghost-text--hover focus-visible:outline-none disabled:text-button-ghost-text--disabled",
|
|
30
|
-
card: "bg-button-card-bg border-button-card-border text-button-card-text !py-1 hover:text-button-card-text--hover"
|
|
30
|
+
card: "bg-button-card-bg border-button-card-border text-button-card-text !py-1 hover:text-button-card-text--hover !font-medium text-sm hover:border-button-card-border--hover"
|
|
31
31
|
},
|
|
32
32
|
size: {
|
|
33
33
|
default: "py-2 px-6 w-fit",
|
|
@@ -64,9 +64,9 @@ const w = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], _ = N
|
|
|
64
64
|
}, v = u(j({ variant: e, state: t, size: r }), t === "error" && i.error[e || "primary"], t === "loading" && i.loading[e || "primary"], r, l);
|
|
65
65
|
return /* @__PURE__ */ s("div", { className: u("flex flex-col justify-items-center", r), children: [
|
|
66
66
|
/* @__PURE__ */ s("button", { "aria-disabled": n, className: v, "data-state": t, "data-testid": c || `spectral-button-${e}`, disabled: n, ref: m, type: p, ...x, children: [
|
|
67
|
-
a && /* @__PURE__ */ o("span", { className: "flex pr-2", "aria-hidden": !0, children: a }),
|
|
67
|
+
a && /* @__PURE__ */ o("span", { className: "flex pr-2", "aria-hidden": !0, "data-testid": "spectral-button-start-icon", children: a }),
|
|
68
68
|
t === "loading" && /* @__PURE__ */ o(_, { className: "ml-2 animate-spin", size: 16 }),
|
|
69
|
-
b && t !== "loading" && /* @__PURE__ */ o("span", { className: "flex pl-2", "aria-hidden": !0, children: b }),
|
|
69
|
+
b && t !== "loading" && /* @__PURE__ */ o("span", { className: "flex pl-2", "aria-hidden": !0, "data-testid": "spectral-button-end-icon", children: b }),
|
|
70
70
|
g
|
|
71
71
|
] }),
|
|
72
72
|
t === "error" && d && /* @__PURE__ */ o(y, { message: d, dataTestId: "spectral-button-error-message", id: "button-error" })
|
package/dist/ButtonGroup.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "./styles/main.css";
|
|
3
3
|
import { jsx as s } from "react/jsx-runtime";
|
|
4
4
|
import { ButtonGroupButton as u } from "./ButtonGroup/ButtonGroupButton.js";
|
|
5
|
-
import { Separator as
|
|
5
|
+
import { Separator as d } from "./Separator.js";
|
|
6
6
|
import { Slot as m } from "./primitives/slot.js";
|
|
7
7
|
import { cn as i } from "./utils/twUtils.js";
|
|
8
8
|
import { c } from "./index-D29mdTf5.js";
|
|
@@ -28,12 +28,12 @@ const v = c(
|
|
|
28
28
|
size: a = "md",
|
|
29
29
|
children: l,
|
|
30
30
|
...n
|
|
31
|
-
}) => /* @__PURE__ */ s("div", { role: "group", "data-slot": "button-group", "data-testid": "spectral-button-group", "aria-label": n["aria-label"], "data-orientation": t, className: i(v({ orientation: t }), o), ...n, children: f.map(l, (e) => b(e) && (e.type ===
|
|
31
|
+
}) => /* @__PURE__ */ s("div", { role: "group", "data-slot": "button-group", "data-testid": "spectral-button-group", "aria-label": n["aria-label"], "data-orientation": t, className: i(v({ orientation: t }), o), ...n, children: f.map(l, (e) => b(e) && (e.type === p || e.type === u) ? g(e, {
|
|
32
32
|
variant: e.props.variant ?? r,
|
|
33
33
|
size: e.props.size ?? a
|
|
34
34
|
}) : e) });
|
|
35
35
|
h.displayName = "ButtonGroup";
|
|
36
|
-
const
|
|
36
|
+
const p = ({
|
|
37
37
|
children: o,
|
|
38
38
|
className: t,
|
|
39
39
|
size: r,
|
|
@@ -41,7 +41,7 @@ const d = ({
|
|
|
41
41
|
asChild: l,
|
|
42
42
|
...n
|
|
43
43
|
}) => /* @__PURE__ */ s(u, { "data-slot": "button-group-item", "data-testid": "spectral-button-group-item", "data-variant": a, size: r, variant: a, asChild: l, className: i(t), ...n, children: o });
|
|
44
|
-
|
|
44
|
+
p.displayName = "ButtonGroupItem";
|
|
45
45
|
const C = ({
|
|
46
46
|
className: o,
|
|
47
47
|
asChild: t = !1,
|
|
@@ -50,11 +50,11 @@ const C = ({
|
|
|
50
50
|
className: o,
|
|
51
51
|
orientation: t = "vertical",
|
|
52
52
|
...r
|
|
53
|
-
}) => /* @__PURE__ */ s(
|
|
53
|
+
}) => /* @__PURE__ */ s(d, { "data-slot": "button-group-separator", "data-testid": "spectral-button-group-separator", orientation: t, className: i("bg-input-primitive-border relative !m-0 self-stretch data-[orientation=vertical]:h-auto", o), ...r });
|
|
54
54
|
x.displayName = "ButtonGroupSeparator";
|
|
55
55
|
export {
|
|
56
56
|
h as ButtonGroup,
|
|
57
|
-
|
|
57
|
+
p as ButtonGroupItem,
|
|
58
58
|
x as ButtonGroupSeparator,
|
|
59
59
|
C as ButtonGroupText,
|
|
60
60
|
v as buttonGroupVariants
|
package/dist/Card.d.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import { VariantProps } from 'class-variance-authority';
|
|
2
1
|
import { ComponentProps } from 'react';
|
|
3
|
-
export type CardProps = ComponentProps<'div'> &
|
|
2
|
+
export type CardProps = ComponentProps<'div'> & {
|
|
4
3
|
asChild?: boolean;
|
|
5
4
|
};
|
|
6
|
-
declare const cardVariants: (props?: ({
|
|
7
|
-
variant?: "default" | "sm" | null | undefined;
|
|
8
|
-
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
5
|
export declare const CardBase: ({ ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
6
|
export declare const CardHeader: ({ className, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
7
|
export declare const CardTitle: ({ className, asChild, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
8
|
export declare const CardHeaderEndSlot: ({ className, asChild, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
9
|
export declare const CardContent: ({ className, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare const Card: ({ className,
|
|
15
|
-
export {};
|
|
10
|
+
export declare const Card: ({ className, asChild, children, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
11
|
//# sourceMappingURL=Card.d.ts.map
|
package/dist/Card.js
CHANGED
|
@@ -2,24 +2,13 @@ import "./styles/main.css";
|
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { Slot as c } from "./primitives/slot.js";
|
|
4
4
|
import { cn as d } from "./utils/twUtils.js";
|
|
5
|
-
import { c as n } from "./index-D29mdTf5.js";
|
|
6
5
|
import "react";
|
|
7
|
-
const
|
|
8
|
-
variants: {
|
|
9
|
-
variant: {
|
|
10
|
-
default: "gap-6 rounded-xl content-card",
|
|
11
|
-
sm: "data-card gap-2 rounded-lg"
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
defaultVariants: {
|
|
15
|
-
variant: "default"
|
|
16
|
-
}
|
|
17
|
-
}), v = ({ ...t }) => /* @__PURE__ */ e("div", { "data-slot": "card", "data-testid": "spectral-card", ...t }), x = ({ className: t, ...a }) => /* @__PURE__ */ e("div", { "data-slot": "card-header", "data-testid": "spectral-card-header", className: d("@container/card-header pb-4 flex justify-between items-center", t), ...a }), N = ({ className: t, asChild: a = !1, ...r }) => /* @__PURE__ */ e(a ? c : "div", { "data-slot": "card-title", "data-testid": "spectral-card-title", className: d("font-semibold text-xl", t), ...r }), b = ({ className: t, asChild: a = !1, ...r }) => /* @__PURE__ */ e(a ? c : "div", { "data-slot": "card-action", "data-testid": "spectral-card-action", className: d("justify-self-end", t), ...r }), g = ({ className: t, ...a }) => /* @__PURE__ */ e("div", { "data-slot": "card-content", "data-testid": "spectral-card-content", className: t, ...a }), h = ({ className: t, variant: a, asChild: r = !1, children: s, ...o }) => /* @__PURE__ */ e(r ? c : "div", { "data-slot": "card", "data-testid": "spectral-card", className: d(l({ variant: a }), t), ...o, children: s });
|
|
6
|
+
const o = "text-text-primary flex flex-col w-full card-effects p-3 gap-6 rounded-xl", f = ({ ...t }) => /* @__PURE__ */ e("div", { "data-slot": "card", "data-testid": "spectral-card", ...t }), C = ({ className: t, ...a }) => /* @__PURE__ */ e("div", { "data-slot": "card-header", "data-testid": "spectral-card-header", className: d("@container/card-header pb-4 flex justify-between items-center", t), ...a }), u = ({ className: t, asChild: a = !1, ...r }) => /* @__PURE__ */ e(a ? c : "div", { "data-slot": "card-title", "data-testid": "spectral-card-title", className: d("font-semibold text-xl", t), ...r }), x = ({ className: t, asChild: a = !1, ...r }) => /* @__PURE__ */ e(a ? c : "div", { "data-slot": "card-action", "data-testid": "spectral-card-action", className: d("justify-self-end", t), ...r }), v = ({ className: t, ...a }) => /* @__PURE__ */ e("div", { "data-slot": "card-content", "data-testid": "spectral-card-content", className: t, ...a }), N = ({ className: t, asChild: a = !1, children: r, ...s }) => /* @__PURE__ */ e(a ? c : "div", { "data-slot": "card", "data-testid": "spectral-card", className: d(o, t), ...s, children: r });
|
|
18
7
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
N as Card,
|
|
9
|
+
f as CardBase,
|
|
10
|
+
v as CardContent,
|
|
11
|
+
C as CardHeader,
|
|
12
|
+
x as CardHeaderEndSlot,
|
|
13
|
+
u as CardTitle
|
|
25
14
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CardProps } from '../Card/Card';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type DataCardProps = CardProps & {
|
|
4
|
+
accentColor: string;
|
|
5
|
+
cardHeaderEndSlot: ReactNode;
|
|
6
|
+
dataDescription: string;
|
|
7
|
+
dataValue: string | number;
|
|
8
|
+
title: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const DataCard: ({ accentColor, cardHeaderEndSlot, className, dataDescription, dataValue, title, ...props }: DataCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=DataCard.d.ts.map
|
package/dist/DataCard.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./styles/main.css";
|
|
2
|
+
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { Card as o, CardHeader as p, CardTitle as n, CardContent as m } from "./Card.js";
|
|
4
|
+
import { cn as x } from "./utils/twUtils.js";
|
|
5
|
+
import "react";
|
|
6
|
+
const C = ({ accentColor: d, cardHeaderEndSlot: e, className: r, dataDescription: s, dataValue: c, title: l, ...i }) => /* @__PURE__ */ t(o, { className: x("gap-4 card-effects", r), ...i, "data-testid": "spectral-datacard", children: [
|
|
7
|
+
/* @__PURE__ */ t(p, { className: "pb-0", "data-testid": "spectral-datacard-header", children: [
|
|
8
|
+
/* @__PURE__ */ a(n, { className: "uppercase text-sm font-bold", "data-testid": "spectral-datacard-title", children: l }),
|
|
9
|
+
/* @__PURE__ */ a("div", { style: { color: d }, "data-testid": "spectral-datacard-end-slot", children: e })
|
|
10
|
+
] }),
|
|
11
|
+
/* @__PURE__ */ a(m, { children: /* @__PURE__ */ t("div", { className: "flex flex-col gap-4", children: [
|
|
12
|
+
/* @__PURE__ */ a("div", { className: "text-4xl font-bold", style: { color: d }, "data-testid": "spectral-datacard-data-value", children: c }),
|
|
13
|
+
/* @__PURE__ */ a("div", { className: "text-xs text-data-card-description", "data-testid": "spectral-datacard-data-description", children: s })
|
|
14
|
+
] }) })
|
|
15
|
+
] });
|
|
16
|
+
export {
|
|
17
|
+
C as DataCard
|
|
18
|
+
};
|
package/dist/Select.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
|
3
3
|
type SelectOption = BaseOption;
|
|
4
4
|
type Align = 'start' | 'center' | 'end';
|
|
5
5
|
type Side = 'top' | 'bottom' | 'left' | 'right';
|
|
6
|
-
export interface SelectProps extends Omit<ComponentPropsWithoutRef<'button'>, 'value' | 'onChange'>, BaseFormFieldProps {
|
|
6
|
+
export interface SelectProps extends Omit<ComponentPropsWithoutRef<'button'>, 'value' | 'onChange' | 'aria-disabled' | 'aria-invalid' | 'aria-required' | 'aria-describedby' | 'aria-label'>, BaseFormFieldProps {
|
|
7
7
|
defaultValue?: string;
|
|
8
8
|
emptyMessage?: ReactNode;
|
|
9
9
|
id?: string;
|
package/dist/Select.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "./styles/main.css";
|
|
3
|
-
import { jsxs as r, jsx as
|
|
3
|
+
import { jsxs as r, jsx as t, Fragment as S } from "react/jsx-runtime";
|
|
4
4
|
import "./Icons/AnalyzeIcon.js";
|
|
5
5
|
import "./Icons/AnnotationsIcon.js";
|
|
6
6
|
import "./Icons/ApprovedIcon.js";
|
|
@@ -8,7 +8,7 @@ import "./Icons/CalendarIcon.js";
|
|
|
8
8
|
import "./Icons/CheckCircleIcon.js";
|
|
9
9
|
import "./Icons/CheckSquareIcon.js";
|
|
10
10
|
import { CheckmarkIcon as Q } from "./Icons/CheckmarkIcon.js";
|
|
11
|
-
import { ChevronDownIcon as
|
|
11
|
+
import { ChevronDownIcon as c } from "./Icons/ChevronDownIcon.js";
|
|
12
12
|
import "./Icons/ChevronUpIcon.js";
|
|
13
13
|
import "./Icons/ClockIcon.js";
|
|
14
14
|
import "./Icons/CloseCircleIcon.js";
|
|
@@ -59,11 +59,11 @@ import "./Icons/ZoomAllIcon.js";
|
|
|
59
59
|
import "./Icons/ZoomXIcon.js";
|
|
60
60
|
import "./Icons/ZoomYIcon.js";
|
|
61
61
|
import { Label as C } from "./Label.js";
|
|
62
|
-
import { R as X, T as Y, f as Z, e as _, C as $, c as
|
|
63
|
-
import { useFormFieldId as
|
|
64
|
-
import { cn as
|
|
65
|
-
import { forwardRef as
|
|
66
|
-
const
|
|
62
|
+
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 st, b as it, a as ot } from "./index-CevVJ05e.js";
|
|
63
|
+
import { useFormFieldId as lt, useFormFieldState as dt, getAriaProps as mt, getErrorMessageId as ct, groupOptions as pt, getFormFieldCSSProperties as nt, getStateClasses as ut, getTriggerClasses as ht, ErrorMessage as gt, LoadingState as bt, EmptyState as ft, getOptionClasses as xt } from "./utils/formFieldUtils.js";
|
|
64
|
+
import { cn as i } from "./utils/twUtils.js";
|
|
65
|
+
import { forwardRef as yt, useState as Nt } from "react";
|
|
66
|
+
const vt = yt(
|
|
67
67
|
({
|
|
68
68
|
align: w = "start",
|
|
69
69
|
alignOffset: z = 0,
|
|
@@ -73,76 +73,76 @@ const Se = ye(
|
|
|
73
73
|
emptyMessage: k = "No options found",
|
|
74
74
|
errorMessage: p,
|
|
75
75
|
id: L,
|
|
76
|
-
label:
|
|
77
|
-
labelClassName:
|
|
76
|
+
label: l,
|
|
77
|
+
labelClassName: n,
|
|
78
78
|
loadingMessage: T = "Loading…",
|
|
79
79
|
name: u,
|
|
80
80
|
onChange: V,
|
|
81
81
|
options: h = [],
|
|
82
|
-
placeholder:
|
|
83
|
-
position:
|
|
84
|
-
side:
|
|
85
|
-
sideOffset:
|
|
82
|
+
placeholder: q = "Select an option",
|
|
83
|
+
position: D = "popper",
|
|
84
|
+
side: E = "bottom",
|
|
85
|
+
sideOffset: P = 4,
|
|
86
86
|
state: a = "default",
|
|
87
87
|
value: g,
|
|
88
|
-
"aria-label":
|
|
88
|
+
"aria-label": R,
|
|
89
89
|
"aria-describedby": B,
|
|
90
|
-
...
|
|
90
|
+
...o
|
|
91
91
|
}, G) => {
|
|
92
|
-
const [
|
|
92
|
+
const [b, M] = Nt(!1), s = lt(L, u), f = ct(s), { isDisabled: d, isLoading: x, isInvalid: A } = dt(o.disabled, a), H = mt(a, B, o.required, f), { groups: y, ungrouped: N } = pt(h), U = () => {
|
|
93
93
|
if (x)
|
|
94
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ t(bt, { "data-testid": "spectral-select-loading", message: T });
|
|
95
95
|
if (h.length === 0)
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
const
|
|
98
|
-
const m = g ===
|
|
99
|
-
return /* @__PURE__ */ r(
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
] },
|
|
96
|
+
return /* @__PURE__ */ t(ft, { "data-testid": "spectral-select-empty", message: k });
|
|
97
|
+
const v = (e) => {
|
|
98
|
+
const m = g === e.value;
|
|
99
|
+
return /* @__PURE__ */ r(st, { className: i(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: [
|
|
100
|
+
/* @__PURE__ */ t(it, { "data-testid": "spectral-select-item-text", className: "block truncate", children: e.label }),
|
|
101
|
+
/* @__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 }) }) })
|
|
102
|
+
] }, e.value);
|
|
103
103
|
};
|
|
104
|
-
return /* @__PURE__ */ r(
|
|
105
|
-
N.length > 0 && /* @__PURE__ */ r(
|
|
106
|
-
N.map(
|
|
107
|
-
Object.keys(y).length > 0 && /* @__PURE__ */
|
|
104
|
+
return /* @__PURE__ */ r(S, { children: [
|
|
105
|
+
N.length > 0 && /* @__PURE__ */ r(S, { children: [
|
|
106
|
+
N.map(v),
|
|
107
|
+
Object.keys(y).length > 0 && /* @__PURE__ */ t(I, { className: "-mx-1 my-1 h-px bg-border-secondary", "data-testid": "spectral-select-separator" })
|
|
108
108
|
] }),
|
|
109
|
-
Object.entries(y).map(([
|
|
110
|
-
J > 0 && /* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
m.map((K) =>
|
|
113
|
-
] },
|
|
109
|
+
Object.entries(y).map(([e, m], J) => /* @__PURE__ */ r(at, { "data-testid": "spectral-select-group", children: [
|
|
110
|
+
J > 0 && /* @__PURE__ */ t(I, { className: "-mx-1 my-1 h-px bg-border-secondary", "data-testid": "spectral-select-group-separator" }),
|
|
111
|
+
/* @__PURE__ */ t(C, { "data-testid": "spectral-select-group-label", htmlFor: s, className: i("px-2 py-1.5 text-base font-semibold text-text-primary", n), children: e }),
|
|
112
|
+
m.map((K) => v(K))
|
|
113
|
+
] }, e))
|
|
114
114
|
] });
|
|
115
115
|
};
|
|
116
|
-
return /* @__PURE__ */ r("div", { className: "w-full",
|
|
117
|
-
|
|
118
|
-
/* @__PURE__ */ r(X, { "data-testid": "spectral-select", defaultValue: j, disabled: d, name: u, onOpenChange: M, onValueChange: V, open:
|
|
119
|
-
/* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ r("div", { className: "w-full", children: [
|
|
117
|
+
l && /* @__PURE__ */ t(C, { "data-testid": "spectral-select-label", htmlFor: s, className: i("block mb-4 text-text-primary", n, d && "text-text-secondary"), children: l }),
|
|
118
|
+
/* @__PURE__ */ r(X, { "data-testid": "spectral-select", defaultValue: j, disabled: d, name: u, onOpenChange: M, onValueChange: V, open: b, required: o.required, value: g, children: [
|
|
119
|
+
/* @__PURE__ */ t(
|
|
120
120
|
Y,
|
|
121
121
|
{
|
|
122
|
-
"aria-controls":
|
|
123
|
-
"aria-expanded":
|
|
124
|
-
"aria-label":
|
|
122
|
+
"aria-controls": s,
|
|
123
|
+
"aria-expanded": b,
|
|
124
|
+
"aria-label": R || l,
|
|
125
125
|
asChild: !0,
|
|
126
|
-
className:
|
|
126
|
+
className: i(ht(!1, a), ut(a), F),
|
|
127
127
|
"data-slot": "select-trigger",
|
|
128
128
|
"data-state": a,
|
|
129
129
|
"data-testid": "spectral-select-trigger",
|
|
130
|
-
id:
|
|
130
|
+
id: s,
|
|
131
131
|
ref: G,
|
|
132
132
|
role: "combobox",
|
|
133
|
-
style:
|
|
133
|
+
style: nt(),
|
|
134
134
|
...H,
|
|
135
|
-
...
|
|
135
|
+
...o,
|
|
136
136
|
children: /* @__PURE__ */ r("button", { type: "button", disabled: d, children: [
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ t(Z, { placeholder: q, className: "block truncate", "data-testid": "spectral-select-value" }),
|
|
138
|
+
/* @__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 }) }) })
|
|
139
139
|
] })
|
|
140
140
|
}
|
|
141
141
|
),
|
|
142
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__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(
|
|
143
143
|
"div",
|
|
144
144
|
{
|
|
145
|
-
className:
|
|
145
|
+
className: i(
|
|
146
146
|
"z-50 rounded-lg border border-input-border bg-input-bg shadow-md",
|
|
147
147
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
148
148
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
@@ -159,18 +159,18 @@ const Se = ye(
|
|
|
159
159
|
width: "var(--radix-select-trigger-width)"
|
|
160
160
|
},
|
|
161
161
|
children: [
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__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 }) }),
|
|
163
|
+
/* @__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() }) }),
|
|
164
|
+
/* @__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 }) })
|
|
165
165
|
]
|
|
166
166
|
}
|
|
167
167
|
) })
|
|
168
168
|
] }),
|
|
169
|
-
A && p && /* @__PURE__ */
|
|
169
|
+
A && p && /* @__PURE__ */ t(gt, { "data-testid": "spectral-select-error-message", id: f, message: p })
|
|
170
170
|
] });
|
|
171
171
|
}
|
|
172
172
|
);
|
|
173
|
-
|
|
173
|
+
vt.displayName = "Select";
|
|
174
174
|
export {
|
|
175
|
-
|
|
175
|
+
vt as Select
|
|
176
176
|
};
|
package/dist/Slider.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx as m, jsxs as j } from "react/jsx-runtime";
|
|
|
4
4
|
import * as c from "react";
|
|
5
5
|
import { useMemo as de } from "react";
|
|
6
6
|
import { c as X } from "./index-rKs9bXHr.js";
|
|
7
|
-
import { u as ue, c as fe, b as _, P as
|
|
7
|
+
import { u as ue, c as fe, b as _, P as k, a as C } from "./index-BhufZRa2.js";
|
|
8
8
|
import { c as me, u as he } from "./index-UEFPWH8U.js";
|
|
9
9
|
import { u as pe } from "./index-BZPx6jYI.js";
|
|
10
10
|
import { u as Se } from "./index-y6Br5T4h.js";
|
|
@@ -16,7 +16,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
16
16
|
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
17
17
|
}, M = "Slider", [L, ge, ve] = me(M), [J] = fe(M, [
|
|
18
18
|
ve
|
|
19
|
-
]), [be,
|
|
19
|
+
]), [be, B] = J(M), Q = c.forwardRef(
|
|
20
20
|
(e, t) => {
|
|
21
21
|
const {
|
|
22
22
|
name: o,
|
|
@@ -41,7 +41,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
41
41
|
onChange: (y) => {
|
|
42
42
|
[...g.current][f.current]?.focus(), r(y);
|
|
43
43
|
}
|
|
44
|
-
}),
|
|
44
|
+
}), T = c.useRef(v);
|
|
45
45
|
function z(y) {
|
|
46
46
|
const P = Ee(v, y);
|
|
47
47
|
K(y, P);
|
|
@@ -50,7 +50,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
50
50
|
K(y, f.current);
|
|
51
51
|
}
|
|
52
52
|
function ce() {
|
|
53
|
-
const y =
|
|
53
|
+
const y = T.current[f.current];
|
|
54
54
|
v[f.current] !== y && d(v);
|
|
55
55
|
}
|
|
56
56
|
function K(y, P, { commit: V } = { commit: !1 }) {
|
|
@@ -86,7 +86,7 @@ var G = ["PageUp", "PageDown"], W = ["ArrowUp", "ArrowDown", "ArrowLeft", "Arrow
|
|
|
86
86
|
...S,
|
|
87
87
|
ref: t,
|
|
88
88
|
onPointerDown: _(S.onPointerDown, () => {
|
|
89
|
-
s || (
|
|
89
|
+
s || (T.current = v);
|
|
90
90
|
}),
|
|
91
91
|
min: n,
|
|
92
92
|
max: i,
|
|
@@ -235,9 +235,9 @@ var [Z, ee] = J(M, {
|
|
|
235
235
|
onEndKeyDown: s,
|
|
236
236
|
onStepKeyDown: u,
|
|
237
237
|
...b
|
|
238
|
-
} = e, h =
|
|
238
|
+
} = e, h = B(M, o);
|
|
239
239
|
return /* @__PURE__ */ m(
|
|
240
|
-
|
|
240
|
+
k.span,
|
|
241
241
|
{
|
|
242
242
|
...b,
|
|
243
243
|
ref: t,
|
|
@@ -260,9 +260,9 @@ var [Z, ee] = J(M, {
|
|
|
260
260
|
}
|
|
261
261
|
), ne = "SliderTrack", oe = c.forwardRef(
|
|
262
262
|
(e, t) => {
|
|
263
|
-
const { __scopeSlider: o, ...n } = e, i =
|
|
263
|
+
const { __scopeSlider: o, ...n } = e, i = B(ne, o);
|
|
264
264
|
return /* @__PURE__ */ m(
|
|
265
|
-
|
|
265
|
+
k.span,
|
|
266
266
|
{
|
|
267
267
|
"data-disabled": i.disabled ? "" : void 0,
|
|
268
268
|
"data-orientation": i.orientation,
|
|
@@ -275,11 +275,11 @@ var [Z, ee] = J(M, {
|
|
|
275
275
|
oe.displayName = ne;
|
|
276
276
|
var O = "SliderRange", re = c.forwardRef(
|
|
277
277
|
(e, t) => {
|
|
278
|
-
const { __scopeSlider: o, ...n } = e, i =
|
|
278
|
+
const { __scopeSlider: o, ...n } = e, i = B(O, o), l = ee(O, o), a = c.useRef(null), s = C(t, a), u = i.values.length, b = i.values.map(
|
|
279
279
|
(d) => se(d, i.min, i.max)
|
|
280
280
|
), h = u > 1 ? Math.min(...b) : 0, r = 100 - Math.max(...b);
|
|
281
281
|
return /* @__PURE__ */ m(
|
|
282
|
-
|
|
282
|
+
k.span,
|
|
283
283
|
{
|
|
284
284
|
"data-orientation": i.orientation,
|
|
285
285
|
"data-disabled": i.disabled ? "" : void 0,
|
|
@@ -305,7 +305,7 @@ var U = "SliderThumb", ie = c.forwardRef(
|
|
|
305
305
|
}
|
|
306
306
|
), Re = c.forwardRef(
|
|
307
307
|
(e, t) => {
|
|
308
|
-
const { __scopeSlider: o, index: n, name: i, ...l } = e, a =
|
|
308
|
+
const { __scopeSlider: o, index: n, name: i, ...l } = e, a = B(U, o), s = ee(U, o), [u, b] = c.useState(null), h = C(t, (D) => b(D)), r = u ? a.form || !!u.closest("form") : !0, d = Se(u), p = a.values[n], R = p === void 0 ? 0 : se(p, a.min, a.max), S = De(n, a.values.length), g = d?.[s.size], f = g ? _e(g, R, s.direction) : 0;
|
|
309
309
|
return c.useEffect(() => {
|
|
310
310
|
if (u)
|
|
311
311
|
return a.thumbs.add(u), () => {
|
|
@@ -321,7 +321,7 @@ var U = "SliderThumb", ie = c.forwardRef(
|
|
|
321
321
|
},
|
|
322
322
|
children: [
|
|
323
323
|
/* @__PURE__ */ m(L.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ m(
|
|
324
|
-
|
|
324
|
+
k.span,
|
|
325
325
|
{
|
|
326
326
|
role: "slider",
|
|
327
327
|
"aria-label": e["aria-label"] || S,
|
|
@@ -367,7 +367,7 @@ var Pe = "RadioBubbleInput", ae = c.forwardRef(
|
|
|
367
367
|
h.call(s, t), s.dispatchEvent(r);
|
|
368
368
|
}
|
|
369
369
|
}, [a, t]), /* @__PURE__ */ m(
|
|
370
|
-
|
|
370
|
+
k.input,
|
|
371
371
|
{
|
|
372
372
|
style: { display: "none" },
|
|
373
373
|
...o,
|
|
@@ -422,7 +422,7 @@ function Ke(e, t) {
|
|
|
422
422
|
const o = Math.pow(10, t);
|
|
423
423
|
return Math.round(e * o) / o;
|
|
424
424
|
}
|
|
425
|
-
var Ie = Q,
|
|
425
|
+
var Ie = Q, ke = oe, Be = re, Te = ie;
|
|
426
426
|
const Ye = ({ className: e, defaultValue: t, disabled: o, max: n = 100, min: i = 0, minStepsBetweenThumbs: l = 1, name: a, onValueChange: s, onValueCommit: u, orientation: b = "horizontal", step: h = 1, value: r, ...d }) => {
|
|
427
427
|
const p = de(() => Array.isArray(r) ? r : Array.isArray(t) ? t : [i, n], [r, t, i, n]);
|
|
428
428
|
return /* @__PURE__ */ j(
|
|
@@ -447,11 +447,20 @@ const Ye = ({ className: e, defaultValue: t, disabled: o, max: n = 100, min: i =
|
|
|
447
447
|
className: H("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", e),
|
|
448
448
|
...d,
|
|
449
449
|
children: [
|
|
450
|
-
/* @__PURE__ */ m(
|
|
451
|
-
Array.from({ length: p.length }, (R, S) => /* @__PURE__ */ m(
|
|
450
|
+
/* @__PURE__ */ m(
|
|
452
451
|
ke,
|
|
452
|
+
{
|
|
453
|
+
"data-slot": "slider-track",
|
|
454
|
+
"data-testid": "spectral-slider-track",
|
|
455
|
+
className: H("bg-slider-track relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),
|
|
456
|
+
children: /* @__PURE__ */ m(Be, { "data-slot": "slider-range", "data-testid": "spectral-slider-range", className: H("bg-slider-range absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full") })
|
|
457
|
+
}
|
|
458
|
+
),
|
|
459
|
+
Array.from({ length: p.length }, (R, S) => /* @__PURE__ */ m(
|
|
460
|
+
Te,
|
|
453
461
|
{
|
|
454
462
|
"data-slot": "slider-thumb",
|
|
463
|
+
"data-testid": "spectral-slider-thumb",
|
|
455
464
|
className: "border-slider-thumb-border bg-slider-thumb-bg ring-slider-thumb-ring/50 block size-5 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"
|
|
456
465
|
},
|
|
457
466
|
S
|
package/dist/Switch.js
CHANGED
|
@@ -5,39 +5,39 @@ import { Switch as p, SwitchThumb as k } from "./Switch/SwitchBase.js";
|
|
|
5
5
|
import { Label as r } from "./Label.js";
|
|
6
6
|
import { cn as o } from "./utils/twUtils.js";
|
|
7
7
|
import { forwardRef as x } from "react";
|
|
8
|
-
const v = x(({ className: l, disabled: d, id: e, labelPosition: i = "right", labelText: s, name: h, onChange: b, required:
|
|
9
|
-
const
|
|
8
|
+
const v = x(({ className: l, disabled: d, id: e, labelPosition: i = "right", labelText: s, name: h, onChange: b, required: c, value: m, hideLabel: a = !1, variant: u, ...f }, g) => {
|
|
9
|
+
const n = u === "squared";
|
|
10
10
|
return /* @__PURE__ */ w("div", { className: "flex items-center", "data-testid": "spectral-switch-container", children: [
|
|
11
11
|
i === "left" && !a && /* @__PURE__ */ t(r, { htmlFor: e, className: "mr-2", "data-testid": "spectral-switch-label-left", children: s }),
|
|
12
12
|
/* @__PURE__ */ t(
|
|
13
13
|
p,
|
|
14
14
|
{
|
|
15
|
-
"aria-required":
|
|
15
|
+
"aria-required": c,
|
|
16
16
|
className: o(
|
|
17
|
-
|
|
17
|
+
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
18
|
l
|
|
19
19
|
),
|
|
20
|
-
"data-testid": "spectral-switch
|
|
20
|
+
"data-testid": "spectral-switch",
|
|
21
21
|
disabled: d,
|
|
22
22
|
id: e,
|
|
23
23
|
name: h,
|
|
24
24
|
onCheckedChange: b,
|
|
25
25
|
ref: g,
|
|
26
|
-
required:
|
|
26
|
+
required: c,
|
|
27
27
|
value: m,
|
|
28
28
|
...f,
|
|
29
29
|
children: /* @__PURE__ */ t(
|
|
30
30
|
k,
|
|
31
31
|
{
|
|
32
32
|
className: o(
|
|
33
|
-
|
|
33
|
+
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
34
|
)
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
39
|
i === "right" && !a && /* @__PURE__ */ t(r, { htmlFor: e, id: `${e}-label`, className: "ml-2", "data-testid": "spectral-switch-label-right", children: s }),
|
|
40
|
-
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", children: s })
|
|
40
|
+
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", "data-testid": "spectral-switch-label-hidden", children: s })
|
|
41
41
|
] });
|
|
42
42
|
});
|
|
43
43
|
v.displayName = "Switch";
|