@spear-ai/spectral 1.3.10 → 1.3.12
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 +91 -0
- package/dist/Accordion/AccordionBase.js +233 -0
- package/dist/App.js +8 -0
- package/dist/Badge/BadgeBase.js +35 -0
- package/dist/Badge.js +7 -0
- package/dist/Button.js +99 -0
- package/dist/Card.js +35 -0
- package/dist/Checkbox/CheckboxBase.js +141 -0
- package/dist/Drawer.js +1293 -0
- package/dist/Icons/AnnotationsIcon.js +28 -0
- package/dist/Icons/CalendarIcon.js +60 -0
- package/dist/Icons/ClockIcon.js +40 -0
- package/dist/Icons/DeleteIcon.js +32 -0
- package/dist/Icons/DurationIcon.js +80 -0
- package/dist/Icons/EraserIcon.js +37 -0
- package/dist/Icons/GoToFirstIcon.js +40 -0
- package/dist/Icons/GoToLastIcon.js +40 -0
- package/dist/Icons/IconBase.js +33 -0
- package/dist/Icons/LabelIcon.js +27 -0
- package/dist/Icons/LassoIcon.js +50 -0
- package/dist/Icons/LineToolIcon.js +96 -0
- package/dist/Icons/LiveViewIcon.js +70 -0
- package/dist/Icons/LocationIcon.js +40 -0
- package/dist/Icons/MetadataIcon.js +28 -0
- package/dist/Icons/OntologyIcon.js +31 -0
- package/dist/Icons/PlayIcon.js +28 -0
- package/dist/Icons/PlusIcon.js +27 -0
- package/dist/Icons/ResetIcon.js +25 -0
- package/dist/Icons/ScissorsIcon.js +36 -0
- package/dist/Icons/TrashIcon.js +25 -0
- package/dist/Icons/UndoIcon.js +28 -0
- package/dist/Icons/ZoomAllIcon.js +28 -0
- package/dist/Icons/ZoomXIcon.js +41 -0
- package/dist/Icons/ZoomYIcon.js +41 -0
- package/dist/Icons/iconTypes.js +2 -0
- package/dist/Icons.js +51 -0
- package/dist/Label.js +13 -0
- package/dist/Popover.js +250 -0
- package/dist/RadioGroup/RadioGroupBase.js +254 -0
- package/dist/Skeleton.js +10 -0
- package/dist/Slider/SliderBase.js +315 -0
- package/dist/Slider.js +74 -0
- package/dist/Switch/SwitchBase.js +131 -0
- package/dist/Switch.js +59 -0
- package/dist/Toggle/ToggleBase.js +51 -0
- package/dist/Toggle.js +51 -0
- package/dist/ToggleGroup/ToggleGroupBase.js +125 -0
- package/dist/ToggleGroup.js +53 -0
- package/dist/Toolbar.js +13 -0
- package/dist/Tooltip/TooltipBase.js +225 -0
- package/dist/Tooltip.js +371 -0
- package/dist/features/LabelingTools/LabelingTools.d.ts.map +1 -0
- package/dist/features/LabelingTools.js +107 -0
- package/dist/hooks/useAccordionAutoScroll.js +65 -0
- package/dist/hooks/useOutsideClick.js +16 -0
- package/dist/hooks/useTheme.js +19 -0
- package/dist/index-B7LSgz_k.js +446 -0
- package/dist/index-CRBC94ik.js +34 -0
- package/dist/index-gg2zpNk0.js +672 -0
- package/dist/index-sDEISz8i.js +1558 -0
- package/dist/loader-circle-Btf6jOd5.js +101 -0
- package/dist/main.js +25212 -0
- package/dist/primitives/label.js +27 -0
- package/dist/primitives/slot.js +40 -0
- package/dist/twUtils-CRiPKpXj.js +2743 -0
- package/dist/utils/refs.js +10 -0
- package/dist/utils/shared.js +29 -0
- package/dist/utils/twUtils.js +5 -0
- package/package.json +19 -7
- package/dist/components/LabelingTools/LabelingTools.d.ts.map +0 -1
- package/dist/index.js +0 -9253
- package/dist/spectral.cjs.js +0 -83
- /package/dist/{components → features}/LabelingTools/LabelingTools.d.ts +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsx as f, jsxs as K } from "react/jsx-runtime";
|
|
3
|
+
import { Slot as g } from "../primitives/slot.js";
|
|
4
|
+
import { useControllableState as M, cn as x } from "../utils/shared.js";
|
|
5
|
+
import { createContext as O, forwardRef as y, useRef as V, useId as $, useEffect as k, useCallback as d, useContext as z } from "react";
|
|
6
|
+
const C = O(null), A = y(
|
|
7
|
+
({
|
|
8
|
+
asChild: u,
|
|
9
|
+
className: l,
|
|
10
|
+
checked: h,
|
|
11
|
+
defaultChecked: r = !1,
|
|
12
|
+
onCheckedChange: o,
|
|
13
|
+
name: m,
|
|
14
|
+
value: p = "on",
|
|
15
|
+
required: E,
|
|
16
|
+
form: S,
|
|
17
|
+
disabled: n,
|
|
18
|
+
id: R,
|
|
19
|
+
onClick: b,
|
|
20
|
+
onKeyDown: w,
|
|
21
|
+
children: I,
|
|
22
|
+
...N
|
|
23
|
+
}, P) => {
|
|
24
|
+
const c = V(null), T = $(), j = R ?? `swt-${T}`, [t, s] = M({
|
|
25
|
+
value: h,
|
|
26
|
+
defaultValue: r,
|
|
27
|
+
onChange: o
|
|
28
|
+
});
|
|
29
|
+
k(() => {
|
|
30
|
+
c.current && (c.current.checked = t);
|
|
31
|
+
}, [t]), k(() => {
|
|
32
|
+
const e = c.current?.form ?? null;
|
|
33
|
+
if (!e) return;
|
|
34
|
+
const a = () => s(r);
|
|
35
|
+
return e.addEventListener("reset", a), () => e.removeEventListener("reset", a);
|
|
36
|
+
}, [r, s]);
|
|
37
|
+
const v = d(() => {
|
|
38
|
+
const e = c.current;
|
|
39
|
+
if (!e) return;
|
|
40
|
+
e.checked = t;
|
|
41
|
+
const a = new Event("change", { bubbles: !0 });
|
|
42
|
+
e.dispatchEvent(a);
|
|
43
|
+
}, [t]), i = d(() => {
|
|
44
|
+
n || (s(!t), queueMicrotask(() => v()));
|
|
45
|
+
}, [n, v, t, s]), D = d(
|
|
46
|
+
(e) => {
|
|
47
|
+
b?.(e), !e.defaultPrevented && i();
|
|
48
|
+
},
|
|
49
|
+
[b, i]
|
|
50
|
+
), L = d(
|
|
51
|
+
(e) => {
|
|
52
|
+
w?.(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(), i());
|
|
53
|
+
},
|
|
54
|
+
[w, i]
|
|
55
|
+
), q = u ? g : "button", F = P;
|
|
56
|
+
return /* @__PURE__ */ f(C.Provider, { value: { checked: t, disabled: n }, children: /* @__PURE__ */ K(
|
|
57
|
+
q,
|
|
58
|
+
{
|
|
59
|
+
id: j,
|
|
60
|
+
ref: F,
|
|
61
|
+
type: "button",
|
|
62
|
+
role: "switch",
|
|
63
|
+
"aria-checked": t,
|
|
64
|
+
"aria-disabled": n || void 0,
|
|
65
|
+
"data-state": t ? "checked" : "unchecked",
|
|
66
|
+
"data-disabled": n || void 0,
|
|
67
|
+
onClick: D,
|
|
68
|
+
onKeyDown: L,
|
|
69
|
+
disabled: n,
|
|
70
|
+
className: x(
|
|
71
|
+
"peer border-input inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border",
|
|
72
|
+
"bg-input focus-visible:ring-ring transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",
|
|
73
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
74
|
+
"data-[state=checked]:bg-primary",
|
|
75
|
+
l
|
|
76
|
+
),
|
|
77
|
+
...N,
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ f(
|
|
80
|
+
"input",
|
|
81
|
+
{
|
|
82
|
+
ref: c,
|
|
83
|
+
type: "checkbox",
|
|
84
|
+
name: m,
|
|
85
|
+
value: p,
|
|
86
|
+
required: E,
|
|
87
|
+
disabled: n,
|
|
88
|
+
form: S,
|
|
89
|
+
checked: t,
|
|
90
|
+
readOnly: !0,
|
|
91
|
+
tabIndex: -1,
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
style: {
|
|
94
|
+
position: "absolute",
|
|
95
|
+
opacity: 0,
|
|
96
|
+
width: 0,
|
|
97
|
+
height: 0,
|
|
98
|
+
pointerEvents: "none"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
I
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
) });
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
A.displayName = "Switch";
|
|
109
|
+
const B = y(({ asChild: u, className: l, ...h }, r) => {
|
|
110
|
+
const o = z(C);
|
|
111
|
+
if (!o) throw new Error("SwitchThumb must be used within Switch");
|
|
112
|
+
return /* @__PURE__ */ f(
|
|
113
|
+
u ? g : "span",
|
|
114
|
+
{
|
|
115
|
+
ref: r,
|
|
116
|
+
"data-state": o.checked ? "checked" : "unchecked",
|
|
117
|
+
"data-disabled": o.disabled || void 0,
|
|
118
|
+
className: x(
|
|
119
|
+
"bg-background pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform",
|
|
120
|
+
"translate-x-0 data-[state=checked]:translate-x-5",
|
|
121
|
+
l
|
|
122
|
+
),
|
|
123
|
+
...h
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
B.displayName = "SwitchThumb";
|
|
128
|
+
export {
|
|
129
|
+
A as Switch,
|
|
130
|
+
B as SwitchThumb
|
|
131
|
+
};
|
package/dist/Switch.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsxs as w, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Switch as p, SwitchThumb as k } from "./Switch/SwitchBase.js";
|
|
4
|
+
import { Label as r } from "./Label.js";
|
|
5
|
+
import { c } from "./twUtils-CRiPKpXj.js";
|
|
6
|
+
import { forwardRef as x } from "react";
|
|
7
|
+
const v = x(
|
|
8
|
+
({
|
|
9
|
+
className: o,
|
|
10
|
+
disabled: d,
|
|
11
|
+
id: e,
|
|
12
|
+
labelPosition: i = "right",
|
|
13
|
+
labelText: s,
|
|
14
|
+
name: l,
|
|
15
|
+
onChange: h,
|
|
16
|
+
required: b,
|
|
17
|
+
value: m,
|
|
18
|
+
hideLabel: a = !1,
|
|
19
|
+
variant: u,
|
|
20
|
+
...f
|
|
21
|
+
}, g) => {
|
|
22
|
+
const n = u === "squared";
|
|
23
|
+
return /* @__PURE__ */ w("div", { className: "flex items-center", "data-testid": "switch-container", children: [
|
|
24
|
+
i === "left" && !a && /* @__PURE__ */ t(r, { htmlFor: e, className: "mr-2", "data-testid": "switch-label-left", children: s }),
|
|
25
|
+
/* @__PURE__ */ t(
|
|
26
|
+
p,
|
|
27
|
+
{
|
|
28
|
+
"data-testid": "switch-root",
|
|
29
|
+
className: c(
|
|
30
|
+
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-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
31
|
+
o
|
|
32
|
+
),
|
|
33
|
+
disabled: d,
|
|
34
|
+
id: e,
|
|
35
|
+
name: l,
|
|
36
|
+
onCheckedChange: h,
|
|
37
|
+
value: m,
|
|
38
|
+
required: b,
|
|
39
|
+
...f,
|
|
40
|
+
ref: g,
|
|
41
|
+
children: /* @__PURE__ */ t(
|
|
42
|
+
k,
|
|
43
|
+
{
|
|
44
|
+
className: c(
|
|
45
|
+
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"
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
i === "right" && !a && /* @__PURE__ */ t(r, { htmlFor: e, id: `${e}-label`, className: "ml-2", "data-testid": "switch-label-right", children: s }),
|
|
52
|
+
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", children: s })
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
v.displayName = "Switch";
|
|
57
|
+
export {
|
|
58
|
+
v as Switch
|
|
59
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
3
|
+
import { useControllableState as k } from "../utils/shared.js";
|
|
4
|
+
import { forwardRef as C, useCallback as f } from "react";
|
|
5
|
+
const y = C(function({
|
|
6
|
+
pressed: l,
|
|
7
|
+
defaultPressed: u = !1,
|
|
8
|
+
onPressedChange: d,
|
|
9
|
+
disabled: t,
|
|
10
|
+
className: i,
|
|
11
|
+
onKeyDown: a,
|
|
12
|
+
onClick: n,
|
|
13
|
+
type: p = "button",
|
|
14
|
+
...c
|
|
15
|
+
}, g) {
|
|
16
|
+
const [r, s] = k({
|
|
17
|
+
value: l,
|
|
18
|
+
defaultValue: u,
|
|
19
|
+
onChange: d
|
|
20
|
+
}), o = f(() => {
|
|
21
|
+
t || s(!r);
|
|
22
|
+
}, [t, r, s]), m = f(
|
|
23
|
+
(e) => {
|
|
24
|
+
a && a(e), !e.defaultPrevented && (e.key === " " || e.key === "Enter") && (e.preventDefault(), o());
|
|
25
|
+
},
|
|
26
|
+
[o, a]
|
|
27
|
+
), v = f(
|
|
28
|
+
(e) => {
|
|
29
|
+
n && n(e), !e.defaultPrevented && o();
|
|
30
|
+
},
|
|
31
|
+
[o, n]
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ h(
|
|
34
|
+
"button",
|
|
35
|
+
{
|
|
36
|
+
...c,
|
|
37
|
+
ref: g,
|
|
38
|
+
type: p,
|
|
39
|
+
"aria-pressed": r,
|
|
40
|
+
"data-state": r ? "on" : "off",
|
|
41
|
+
"data-disabled": t ? "" : void 0,
|
|
42
|
+
disabled: t,
|
|
43
|
+
onKeyDown: m,
|
|
44
|
+
onClick: v,
|
|
45
|
+
className: i
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
y as ToggleBase
|
|
51
|
+
};
|
package/dist/Toggle.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { ToggleBase as g } from "./Toggle/ToggleBase.js";
|
|
4
|
+
import { c as s } from "./twUtils-CRiPKpXj.js";
|
|
5
|
+
import { c as d } from "./index-CRBC94ik.js";
|
|
6
|
+
import { forwardRef as l } from "react";
|
|
7
|
+
const v = d(
|
|
8
|
+
`
|
|
9
|
+
bg-toggle-bg inline-flex items-center justify-center gap-2 border rounded-md text-sm shadow-sm font-medium w-fit disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed
|
|
10
|
+
hover:cursor-pointer data-[state=on]:text-toggle-text--active text-toggle-text hover:bg-toggle-bg--hover hover:border-toggle-border--hover data-[state=on]:bg-toggle-bg--active
|
|
11
|
+
data-[state=on]:border-toggle-border--active hover:text-toggle-text--hover data-[state=on]:bg-toggle-bg--active data-[state=on]:text-toggle-text--active data-[state=on]:border-toggle-border--active
|
|
12
|
+
transition-[colors] [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus:outline-none outline-none
|
|
13
|
+
aria-invalid:ring-danger-200/20 dark:aria-invalid:ring-danger-200/40 aria-invalid:border-danger-200 whitespace-nowrap
|
|
14
|
+
`,
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
default: "border-toggle-border hover:border-toggle-border--hover",
|
|
19
|
+
outline: "border-toggle-outline-border hover:bg-toggle-bg--hover"
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
default: 'h-9 px-3 min-w-9 [&_svg:not([class*="size-"]):not([width]):not([height])]:size-4',
|
|
23
|
+
sm: 'h-8 px-1.5 min-w-8 [&_svg:not([class*="size-"]):not([width]):not([height])]:size-3',
|
|
24
|
+
lg: 'h-10 px-2.5 min-w-10 [&_svg:not([class*="size-"]):not([width]):not([height])]:size-5'
|
|
25
|
+
},
|
|
26
|
+
layout: {
|
|
27
|
+
default: "w-fit",
|
|
28
|
+
expanded: "w-full"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
variant: "default",
|
|
33
|
+
size: "default",
|
|
34
|
+
layout: "default"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
), m = l(
|
|
38
|
+
({ className: e, variant: t, size: o, layout: r, ...a }, i) => /* @__PURE__ */ n(
|
|
39
|
+
g,
|
|
40
|
+
{
|
|
41
|
+
ref: i,
|
|
42
|
+
"data-slot": "toggle",
|
|
43
|
+
className: s(v({ variant: t, size: o, layout: r }), e),
|
|
44
|
+
...a
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
export {
|
|
49
|
+
m as Toggle,
|
|
50
|
+
v as toggleVariants
|
|
51
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsx as B, jsxs as E } from "react/jsx-runtime";
|
|
3
|
+
import { useControllableState as R, clamp as M } from "../utils/shared.js";
|
|
4
|
+
import { createContext as j, forwardRef as H, useContext as K, useRef as S, useImperativeHandle as L, useEffect as N, useCallback as i, useMemo as U } from "react";
|
|
5
|
+
const T = j(null), Q = (C) => {
|
|
6
|
+
const {
|
|
7
|
+
type: n = "single",
|
|
8
|
+
orientation: l = "horizontal",
|
|
9
|
+
loop: d = !0,
|
|
10
|
+
disabled: I = !1,
|
|
11
|
+
name: u,
|
|
12
|
+
className: x,
|
|
13
|
+
value: z,
|
|
14
|
+
defaultValue: A,
|
|
15
|
+
onValueChange: a,
|
|
16
|
+
"data-variant": D,
|
|
17
|
+
"data-size": v,
|
|
18
|
+
"data-slot": c,
|
|
19
|
+
"data-layout": b,
|
|
20
|
+
...G
|
|
21
|
+
} = C, f = n === "multiple", [r, p] = R({
|
|
22
|
+
value: z,
|
|
23
|
+
defaultValue: typeof A < "u" ? A : f ? [] : "",
|
|
24
|
+
onChange: a
|
|
25
|
+
}), o = S([]), m = i((t, s) => {
|
|
26
|
+
const P = { val: t, el: s, disabled: !!s?.disabled };
|
|
27
|
+
return o.current = [...o.current.filter((w) => w.val !== t), P], () => {
|
|
28
|
+
o.current = o.current.filter((w) => w.val !== t);
|
|
29
|
+
};
|
|
30
|
+
}, []), V = i(() => o.current.slice(), []), k = i(
|
|
31
|
+
(t) => f ? Array.isArray(r) && r.includes(t) : r === t,
|
|
32
|
+
[f, r]
|
|
33
|
+
), e = i((t) => p(t), [p]), g = i(
|
|
34
|
+
(t) => {
|
|
35
|
+
const s = o.current;
|
|
36
|
+
if (s.length === 0) return;
|
|
37
|
+
const P = s.length - 1, w = d ? (t % s.length + s.length) % s.length : M(t, 0, P);
|
|
38
|
+
s[w]?.el?.focus();
|
|
39
|
+
},
|
|
40
|
+
[d]
|
|
41
|
+
), y = U(
|
|
42
|
+
() => ({
|
|
43
|
+
type: n,
|
|
44
|
+
value: r,
|
|
45
|
+
setValue: e,
|
|
46
|
+
orientation: l,
|
|
47
|
+
loop: d,
|
|
48
|
+
groupDisabled: I,
|
|
49
|
+
name: u,
|
|
50
|
+
register: m,
|
|
51
|
+
isItemPressed: k,
|
|
52
|
+
focusItemByIndex: g,
|
|
53
|
+
itemsSnapshot: V
|
|
54
|
+
}),
|
|
55
|
+
[I, k, V, d, u, l, e, n, r]
|
|
56
|
+
), h = u;
|
|
57
|
+
return /* @__PURE__ */ E(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
...G,
|
|
61
|
+
role: "group",
|
|
62
|
+
"data-orientation": l,
|
|
63
|
+
"data-disabled": I ? "" : void 0,
|
|
64
|
+
"data-variant": D,
|
|
65
|
+
"data-size": v,
|
|
66
|
+
"data-slot": c,
|
|
67
|
+
"data-layout": b,
|
|
68
|
+
className: x,
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ B(T.Provider, { value: y, children: C.children }),
|
|
71
|
+
h && n === "single" && typeof r == "string" ? /* @__PURE__ */ B("input", { type: "hidden", name: h, value: r }) : null,
|
|
72
|
+
h && n === "multiple" && Array.isArray(r) ? r.map((t) => /* @__PURE__ */ B("input", { type: "hidden", name: h + "[]", value: t }, t)) : null
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}, W = H(function({ value: n, disabled: l, className: d, children: I, onKeyDown: u, onClick: x, ...z }, A) {
|
|
77
|
+
const a = K(T);
|
|
78
|
+
if (!a) throw new Error("ToggleGroupItem must be used within ToggleGroup");
|
|
79
|
+
const { type: D, orientation: v, groupDisabled: c, setValue: b, isItemPressed: G, itemsSnapshot: f, register: r } = a, p = S(null);
|
|
80
|
+
L(A, () => p.current), N(() => r(n, p.current), [r, n]);
|
|
81
|
+
const o = G(n), m = i(() => {
|
|
82
|
+
if (!(c || l))
|
|
83
|
+
if (D === "single") b(o ? "" : n);
|
|
84
|
+
else {
|
|
85
|
+
const e = a.value, g = o ? e.filter((y) => y !== n) : [...e, n];
|
|
86
|
+
b(g);
|
|
87
|
+
}
|
|
88
|
+
}, [a.value, l, c, o, b, D, n]), V = i(
|
|
89
|
+
(e) => {
|
|
90
|
+
if (u && u(e), e.defaultPrevented) return;
|
|
91
|
+
if (e.key === " " || e.key === "Enter") {
|
|
92
|
+
e.preventDefault(), m();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const g = f(), y = g.findIndex((s) => s.val === n), h = v === "horizontal" ? "ArrowLeft" : "ArrowUp", t = v === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
96
|
+
e.key === h ? (e.preventDefault(), a.focusItemByIndex(y - 1)) : e.key === t ? (e.preventDefault(), a.focusItemByIndex(y + 1)) : e.key === "Home" ? (e.preventDefault(), a.focusItemByIndex(0)) : e.key === "End" && (e.preventDefault(), a.focusItemByIndex(g.length - 1));
|
|
97
|
+
},
|
|
98
|
+
[a, f, u, v, m, n]
|
|
99
|
+
), k = i(
|
|
100
|
+
(e) => {
|
|
101
|
+
x && x(e), !e.defaultPrevented && m();
|
|
102
|
+
},
|
|
103
|
+
[x, m]
|
|
104
|
+
);
|
|
105
|
+
return /* @__PURE__ */ B(
|
|
106
|
+
"button",
|
|
107
|
+
{
|
|
108
|
+
...z,
|
|
109
|
+
ref: p,
|
|
110
|
+
type: "button",
|
|
111
|
+
"aria-pressed": o,
|
|
112
|
+
"data-state": o ? "on" : "off",
|
|
113
|
+
"data-disabled": c || l ? "" : void 0,
|
|
114
|
+
disabled: c || l,
|
|
115
|
+
onKeyDown: V,
|
|
116
|
+
onClick: k,
|
|
117
|
+
className: d,
|
|
118
|
+
children: I
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
export {
|
|
123
|
+
Q as ToggleGroupBase,
|
|
124
|
+
W as ToggleGroupItemBase
|
|
125
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
3
|
+
import { ToggleGroupItemBase as p, ToggleGroupBase as m } from "./ToggleGroup/ToggleGroupBase.js";
|
|
4
|
+
import { toggleVariants as f } from "./Toggle.js";
|
|
5
|
+
import { c as l } from "./twUtils-CRiPKpXj.js";
|
|
6
|
+
import { createContext as c, forwardRef as v, useContext as b } from "react";
|
|
7
|
+
const g = c({
|
|
8
|
+
size: "default",
|
|
9
|
+
variant: "default",
|
|
10
|
+
layout: "default"
|
|
11
|
+
}), h = ({ className: n, variant: e, size: o, layout: a, children: u, ...r }) => /* @__PURE__ */ d(
|
|
12
|
+
m,
|
|
13
|
+
{
|
|
14
|
+
"data-slot": "toggle-group",
|
|
15
|
+
"data-variant": e,
|
|
16
|
+
"data-size": o,
|
|
17
|
+
"data-layout": a,
|
|
18
|
+
className: l(
|
|
19
|
+
"group/toggle-group [&[data-variant='outline']]:bg-toggle-group-bg flex h-fit w-fit items-center rounded-md [&_button:first-of-type]:rounded-l-md [&_button:last-of-type]:rounded-r-md [&[data-variant='outline']]:gap-0.25",
|
|
20
|
+
n
|
|
21
|
+
),
|
|
22
|
+
...r,
|
|
23
|
+
children: /* @__PURE__ */ d(g.Provider, { value: { variant: e, size: o, layout: a }, children: u })
|
|
24
|
+
}
|
|
25
|
+
), w = v(({ className: n, children: e, variant: o, size: a, value: u, layout: r, ...i }, s) => {
|
|
26
|
+
const t = b(g);
|
|
27
|
+
return /* @__PURE__ */ d(
|
|
28
|
+
p,
|
|
29
|
+
{
|
|
30
|
+
ref: s,
|
|
31
|
+
"data-slot": "toggle-group-item",
|
|
32
|
+
"data-variant": t.variant || o,
|
|
33
|
+
"data-size": t.size || a,
|
|
34
|
+
"data-layout": t.layout || r,
|
|
35
|
+
value: u,
|
|
36
|
+
className: l(
|
|
37
|
+
f({
|
|
38
|
+
variant: t.variant || o,
|
|
39
|
+
size: t.size || a,
|
|
40
|
+
layout: t.layout || r
|
|
41
|
+
}),
|
|
42
|
+
"group data-[variant=outline]:border-togglegroup-border rounded-none shadow-none focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0",
|
|
43
|
+
n
|
|
44
|
+
),
|
|
45
|
+
...i,
|
|
46
|
+
children: e
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
h as ToggleGroup,
|
|
52
|
+
w as ToggleGroupItem
|
|
53
|
+
};
|
package/dist/Toolbar.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import(/* @vite-ignore */ new URL('./assets/main.css', import.meta.url).href)
|
|
2
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import "react";
|
|
4
|
+
const c = ({ title: r, description: t, children: l }) => /* @__PURE__ */ s("div", { className: "bg-background text-text-primary border-border-primary flex h-[72px] w-full justify-between border-b", children: [
|
|
5
|
+
/* @__PURE__ */ s("div", { className: "flex w-auto flex-col justify-center", children: [
|
|
6
|
+
r && /* @__PURE__ */ e("h3", { className: "w-fit font-semibold", children: r }),
|
|
7
|
+
t && /* @__PURE__ */ e("p", { className: "text-text-secondary m-0 w-fit text-sm", children: t })
|
|
8
|
+
] }),
|
|
9
|
+
/* @__PURE__ */ e("div", { className: "flex items-center", children: l })
|
|
10
|
+
] });
|
|
11
|
+
export {
|
|
12
|
+
c as Toolbar
|
|
13
|
+
};
|