@spear-ai/spectral 1.6.16 → 1.7.0
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 +196 -191
- package/dist/Accordion.d.ts +13 -15
- package/dist/Accordion.js +172 -165
- package/dist/Alert/AlertBase.d.ts +7 -7
- package/dist/Alert/AlertBase.js +23 -21
- package/dist/Alert.d.ts +2 -2
- package/dist/Alert.js +32 -30
- package/dist/Avatar.d.ts +2 -2
- package/dist/Avatar.js +30 -22
- package/dist/Badge.d.ts +1 -1
- package/dist/Badge.js +3 -2
- package/dist/Button.d.ts +3 -3
- package/dist/Button.js +108 -46
- package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
- package/dist/ButtonGroup/ButtonGroupButton.js +5 -5
- package/dist/ButtonGroup.d.ts +5 -5
- package/dist/ButtonGroup.js +21 -21
- package/dist/ButtonIcon.d.ts +2 -2
- package/dist/ButtonIcon.js +31 -30
- package/dist/Checkbox/CheckboxBase.d.ts +2 -2
- package/dist/Checkbox/CheckboxBase.js +50 -57
- package/dist/Checkbox.js +16 -18
- package/dist/DataCard/Card.d.ts +1 -1
- package/dist/DataCard/Card.js +1 -1
- package/dist/DataCard.js +1 -1
- package/dist/DateTimePicker/Calendar.d.ts +4 -4
- package/dist/DateTimePicker/Calendar.js +4 -2
- package/dist/DateTimePicker/DateTimeDisplayInput.js +126 -136
- package/dist/DateTimePicker/DateTimeInput.js +4 -4
- package/dist/DateTimePicker/DateTimeUtils.d.ts +31 -31
- package/dist/DateTimePicker/DateTimeUtils.js +139 -197
- package/dist/DateTimePicker/TimePicker.d.ts +4 -4
- package/dist/DateTimePicker/TimePicker.js +3 -3
- package/dist/DateTimePicker.d.ts +5 -5
- package/dist/DateTimePicker.js +96 -74
- package/dist/Dialog.d.ts +13 -13
- package/dist/Dialog.js +57 -84
- package/dist/Drawer.d.ts +2 -2
- package/dist/Drawer.js +8 -8
- package/dist/HoverCard.d.ts +6 -5
- package/dist/HoverCard.js +64 -64
- package/dist/Icons/LineToolIcon.js +37 -10
- package/dist/Icons/MeasureIcon.d.ts +5 -0
- package/dist/Icons/MeasureIcon.js +26 -0
- package/dist/Icons/SearchIcon.d.ts +5 -0
- package/dist/Icons/SearchIcon.js +10 -0
- package/dist/Icons/index.d.ts +2 -0
- package/dist/Icons.js +76 -72
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +2 -2
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +2 -2
- package/dist/Input/InputUtils.d.ts +2 -2
- package/dist/Input/InputUtils.js +4 -4
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +31 -29
- package/dist/InputOTP.d.ts +10 -10
- package/dist/InputOTP.js +125 -123
- package/dist/Kbd.d.ts +8 -5
- package/dist/Kbd.js +85 -20
- package/dist/Label.d.ts +4 -2
- package/dist/Label.js +3 -3
- package/dist/MultiSelect/MultiSelectBase.d.ts +1 -1
- package/dist/MultiSelect/MultiSelectBase.js +278 -200
- package/dist/MultiSelect.d.ts +6 -6
- package/dist/MultiSelect.js +9 -9
- package/dist/Popover.js +22 -237
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +11 -11
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +28 -28
- package/dist/RadioButtonGroup.d.ts +1 -1
- package/dist/RadioGroup.d.ts +15 -15
- package/dist/RadioGroup.js +253 -236
- package/dist/Select.d.ts +3 -1
- package/dist/Select.js +92 -87
- package/dist/Separator.js +4 -4
- package/dist/Skeleton.d.ts +1 -2
- package/dist/Skeleton.js +2 -4
- package/dist/Slider.d.ts +6 -6
- package/dist/Slider.js +78 -78
- package/dist/Switch/SwitchBase.d.ts +4 -4
- package/dist/Switch/SwitchBase.js +68 -68
- package/dist/Switch.d.ts +3 -3
- package/dist/Switch.js +9 -9
- package/dist/Tabs/TabsBase.js +39 -38
- package/dist/Tabs/tabsUtils.js +7 -7
- package/dist/Tabs.d.ts +0 -4
- package/dist/Tabs.js +62 -66
- package/dist/Textarea/TextareaUtils.d.ts +7 -7
- package/dist/Textarea/TextareaUtils.js +13 -13
- package/dist/Textarea.js +34 -22
- package/dist/Toast.d.ts +43 -0
- package/dist/Toast.js +883 -0
- package/dist/Toggle/ToggleBase.d.ts +4 -4
- package/dist/Toggle/ToggleBase.js +32 -33
- package/dist/Toggle.d.ts +1 -1
- package/dist/Toggle.js +7 -12
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +5 -5
- package/dist/ToggleGroup/ToggleGroupBase.js +30 -30
- package/dist/ToggleGroup.d.ts +1 -1
- package/dist/ToggleGroup.js +27 -30
- package/dist/Tooltip.d.ts +1 -1
- package/dist/Tooltip.js +97 -97
- package/dist/Tray.d.ts +9 -9
- package/dist/Tray.js +77 -74
- package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
- package/dist/hooks/useAccordionAutoScroll.js +42 -39
- package/dist/hooks/useControllableState.d.ts +2 -2
- package/dist/hooks/useControllableState.d.ts.map +1 -1
- package/dist/hooks/useControllableState.js +2 -2
- package/dist/index-C12FUuIW.js +13 -0
- package/dist/{index-yU8jOTzS.js → index-CpovUAO-.js} +1 -1
- package/dist/{index-BdS7Ix8W.js → index-CqbPiOid.js} +1 -1
- package/dist/{index-B3UpsZ2x.js → index-CrjD9cAD.js} +1 -1
- package/dist/index-DEYs15GP.js +66 -0
- package/dist/index-DdFoGvON.js +146 -0
- package/dist/index-Q3N6lgwg.js +225 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/button.d.ts +1 -1
- package/dist/primitives/button.js +4 -4
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +8 -5
- package/dist/primitives/select.d.ts +12 -13
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +68 -95
- package/dist/primitives/slot.d.ts +5 -5
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +24 -33
- package/dist/primitives/textarea.d.ts.map +1 -1
- package/dist/primitives/textarea.js +4 -3
- package/dist/{proxy-Cukf-VVj.js → proxy-CgaCj1WQ.js} +7 -3
- package/dist/styles/base-colors.css +30 -30
- package/dist/styles/horizon/base-colors.css +30 -30
- package/dist/styles/horizon/colors.css +40 -11
- package/dist/styles/horizon/utilities.css +26 -3
- package/dist/styles/main.css +1 -1
- package/dist/styles/spectral.css +1 -1
- package/dist/styles/theme.css +96 -44
- package/dist/{use-animation-zNd5Nq85.js → use-animation-CR-SdV2l.js} +1 -1
- package/dist/utils/formFieldUtils.d.ts +2 -2
- package/dist/utils/formFieldUtils.d.ts.map +1 -1
- package/dist/utils/formFieldUtils.js +14 -11
- package/dist/utils/sharedUtils.d.ts +3 -3
- package/dist/utils/sharedUtils.d.ts.map +1 -1
- package/dist/utils/sharedUtils.js +1 -4
- package/dist/utils/twUtils.d.ts +1 -1
- package/dist/utils/twUtils.d.ts.map +1 -1
- package/dist/utils/twUtils.js +1 -4
- package/package.json +5 -1
- package/dist/createLucideIcon-D4r5Phnh.js +0 -70
- package/dist/index-CeP1E2kK.js +0 -209
- package/dist/index-Dy-Hzr7y.js +0 -13
package/dist/Switch.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { SwitchProps as SwitchBaseProps } from './SwitchBase';
|
|
2
2
|
import { Ref } from 'react';
|
|
3
3
|
export type SwitchProps = Omit<SwitchBaseProps, 'onCheckedChange'> & {
|
|
4
|
+
hideLabel?: boolean;
|
|
5
|
+
id: string;
|
|
4
6
|
labelPosition?: 'left' | 'right';
|
|
5
7
|
labelText: string;
|
|
6
|
-
id: string;
|
|
7
|
-
hideLabel?: boolean;
|
|
8
8
|
onChange?: (checked: boolean) => void;
|
|
9
9
|
ref?: Ref<HTMLButtonElement>;
|
|
10
10
|
required?: boolean;
|
|
@@ -12,7 +12,7 @@ export type SwitchProps = Omit<SwitchBaseProps, 'onCheckedChange'> & {
|
|
|
12
12
|
variant?: 'default' | 'squared';
|
|
13
13
|
};
|
|
14
14
|
export declare const Switch: {
|
|
15
|
-
({
|
|
15
|
+
({ className, disabled, hideLabel, id, labelPosition, labelText, name, onChange, ref, required, value, variant, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
displayName: string;
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=Switch.d.ts.map
|
package/dist/Switch.js
CHANGED
|
@@ -4,24 +4,24 @@ import { Switch as w, SwitchThumb as k } from "./Switch/SwitchBase.js";
|
|
|
4
4
|
import { Label as r } from "./Label.js";
|
|
5
5
|
import { cn as l } from "./utils/twUtils.js";
|
|
6
6
|
import "react";
|
|
7
|
-
const x = ({
|
|
7
|
+
const x = ({ className: o, disabled: d, hideLabel: s = !1, id: e, labelPosition: i = "right", labelText: a, name: h, onChange: b, ref: u, required: c, value: m, variant: f, ...g }) => {
|
|
8
8
|
const n = f === "squared";
|
|
9
9
|
return /* @__PURE__ */ p("div", { className: "flex items-center", "data-testid": "spectral-switch-container", children: [
|
|
10
|
-
i === "left" && !
|
|
10
|
+
i === "left" && !s && /* @__PURE__ */ t(r, { className: "mr-2", "data-testid": "spectral-switch-label-left", htmlFor: e, children: a }),
|
|
11
11
|
/* @__PURE__ */ t(
|
|
12
12
|
w,
|
|
13
13
|
{
|
|
14
14
|
"aria-required": c,
|
|
15
15
|
className: l(
|
|
16
16
|
n ? "peer data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg inline-flex h-6 w-10 shrink-0 items-center rounded-sm border-2 border-transparent transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-black disabled:cursor-not-allowed disabled:opacity-50 [&_span]:rounded-[4px]" : "focus-visible:ring-ring focus-visible:ring-offset-background peer data-[state=checked]:bg-switch-bg--checked data-[state=unchecked]:bg-switch-bg inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-2xs transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
17
|
-
|
|
17
|
+
o
|
|
18
18
|
),
|
|
19
19
|
"data-testid": "spectral-switch",
|
|
20
|
-
disabled:
|
|
20
|
+
disabled: d,
|
|
21
21
|
id: e,
|
|
22
|
-
name:
|
|
23
|
-
onCheckedChange:
|
|
24
|
-
ref:
|
|
22
|
+
name: h,
|
|
23
|
+
onCheckedChange: b,
|
|
24
|
+
ref: u,
|
|
25
25
|
required: c,
|
|
26
26
|
value: m,
|
|
27
27
|
...g,
|
|
@@ -35,8 +35,8 @@ const x = ({ ref: o, className: d, disabled: h, id: e, labelPosition: i = "right
|
|
|
35
35
|
)
|
|
36
36
|
}
|
|
37
37
|
),
|
|
38
|
-
i === "right" && !
|
|
39
|
-
|
|
38
|
+
i === "right" && !s && /* @__PURE__ */ t(r, { className: "ml-2", "data-testid": "spectral-switch-label-right", htmlFor: e, id: `${e}-label`, children: a }),
|
|
39
|
+
s && /* @__PURE__ */ t(r, { className: "sr-only", "data-testid": "spectral-switch-label-hidden", htmlFor: e, children: a })
|
|
40
40
|
] });
|
|
41
41
|
};
|
|
42
42
|
x.displayName = "Switch";
|
package/dist/Tabs/TabsBase.js
CHANGED
|
@@ -4,20 +4,21 @@ import { jsx as p, jsxs as E } from "react/jsx-runtime";
|
|
|
4
4
|
import { generateId as K, prefersReducedMotion as $, calculateIndicatorStyle as S, debounce as j } from "./tabsUtils.js";
|
|
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
|
-
import { j as H
|
|
8
|
-
import { m as D } from "../proxy-
|
|
7
|
+
import { j as H } from "../index-DEYs15GP.js";
|
|
8
|
+
import { m as D } from "../proxy-CgaCj1WQ.js";
|
|
9
|
+
import { A as G } from "../index-DdFoGvON.js";
|
|
9
10
|
const N = k(null), A = (y = "Tabs") => {
|
|
10
11
|
const d = U(N);
|
|
11
12
|
if (d === null)
|
|
12
13
|
throw new Error(`${y} components must be used within a Tabs.Root`);
|
|
13
14
|
return d;
|
|
14
|
-
},
|
|
15
|
+
}, V = function({
|
|
15
16
|
ref: d,
|
|
16
17
|
activationMode: g = "automatic",
|
|
17
18
|
children: o,
|
|
18
19
|
defaultValue: s,
|
|
19
|
-
dir:
|
|
20
|
-
disabled:
|
|
20
|
+
dir: f = "ltr",
|
|
21
|
+
disabled: u = !1,
|
|
21
22
|
onValueChange: n,
|
|
22
23
|
orientation: m = "horizontal",
|
|
23
24
|
rightSlot: b,
|
|
@@ -26,27 +27,27 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
26
27
|
}) {
|
|
27
28
|
const [w, I] = M(s ?? ""), v = F() ?? K("tabs"), h = t !== void 0, c = h ? t : w, r = T(
|
|
28
29
|
(e) => {
|
|
29
|
-
|
|
30
|
+
u || (h || I(e), n?.(e));
|
|
30
31
|
},
|
|
31
|
-
[h, n,
|
|
32
|
+
[h, n, u]
|
|
32
33
|
), a = {
|
|
33
34
|
activationMode: g,
|
|
34
35
|
baseId: v,
|
|
35
|
-
dir:
|
|
36
|
-
disabled:
|
|
36
|
+
dir: f,
|
|
37
|
+
disabled: u,
|
|
37
38
|
onValueChange: r,
|
|
38
39
|
orientation: m,
|
|
39
40
|
rightSlot: b,
|
|
40
41
|
value: c
|
|
41
42
|
};
|
|
42
|
-
return /* @__PURE__ */ p(N.Provider, { value: a, children: /* @__PURE__ */ p("div", { ref: d, "data-testid": "spectral-tabs", "data-orientation": m, "data-disabled":
|
|
43
|
-
},
|
|
43
|
+
return /* @__PURE__ */ p(N.Provider, { value: a, children: /* @__PURE__ */ p("div", { ref: d, "data-testid": "spectral-tabs", "data-orientation": m, "data-disabled": u ? "" : void 0, dir: f, ...C, children: o }) });
|
|
44
|
+
}, tt = function({
|
|
44
45
|
ref: d,
|
|
45
46
|
children: g,
|
|
46
47
|
className: o,
|
|
47
48
|
loop: s = !0,
|
|
48
|
-
rightSlot:
|
|
49
|
-
...
|
|
49
|
+
rightSlot: f,
|
|
50
|
+
...u
|
|
50
51
|
}) {
|
|
51
52
|
const { orientation: n, disabled: m, value: b } = A("TabsList"), [t, C] = M(null), w = q(null), I = $(), v = T(() => {
|
|
52
53
|
const r = S(w);
|
|
@@ -90,10 +91,10 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
90
91
|
"aria-disabled": m,
|
|
91
92
|
className: x("tabs-list flex", n === "horizontal" && "items-center justify-between", n === "vertical" && "flex-col", o),
|
|
92
93
|
onKeyDown: c,
|
|
93
|
-
...
|
|
94
|
+
...u,
|
|
94
95
|
children: [
|
|
95
96
|
/* @__PURE__ */ p("div", { className: x("flex", n === "horizontal" && "items-center", n === "vertical" && "flex-col"), children: g }),
|
|
96
|
-
|
|
97
|
+
f && /* @__PURE__ */ p("div", { className: "z-10 flex items-center", children: f })
|
|
97
98
|
]
|
|
98
99
|
}
|
|
99
100
|
),
|
|
@@ -102,10 +103,10 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
102
103
|
{
|
|
103
104
|
className: x(
|
|
104
105
|
"pointer-events-none absolute top-0 left-0 will-change-transform select-none",
|
|
105
|
-
t.orientation === "horizontal" && !t.isEnclosed &&
|
|
106
|
-
t.orientation === "vertical" && !t.isEnclosed &&
|
|
107
|
-
t.orientation === "horizontal" && t.isEnclosed &&
|
|
108
|
-
t.orientation === "vertical" && t.isEnclosed &&
|
|
106
|
+
t.orientation === "horizontal" && !t.isEnclosed && "after:border-tabs-indicator bottom-px z-10 after:absolute after:bottom-0 after:left-0 after:w-full after:rounded-t-[0.3rem] after:border-b-[0.3rem] after:content-['']",
|
|
107
|
+
t.orientation === "vertical" && !t.isEnclosed && "after:border-tabs-indicator right-px z-10 after:absolute after:top-0 after:right-0 after:h-full after:w-1 after:rounded-l-[0.3rem] after:border-r-[0.3rem] after:content-['']",
|
|
108
|
+
t.orientation === "horizontal" && t.isEnclosed && "bg-tabs-enclosed-indicator z-0 rounded-lg shadow-lg",
|
|
109
|
+
t.orientation === "vertical" && t.isEnclosed && "bg-tabs-enclosed-indicator z-0 rounded-lg shadow-lg"
|
|
109
110
|
),
|
|
110
111
|
initial: !1,
|
|
111
112
|
animate: {
|
|
@@ -128,16 +129,16 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
128
129
|
}
|
|
129
130
|
)
|
|
130
131
|
] });
|
|
131
|
-
},
|
|
132
|
+
}, et = function({
|
|
132
133
|
ref: d,
|
|
133
134
|
className: g,
|
|
134
135
|
value: o,
|
|
135
136
|
onClick: s,
|
|
136
|
-
onKeyDown:
|
|
137
|
-
disabled:
|
|
137
|
+
onKeyDown: f,
|
|
138
|
+
disabled: u = !1,
|
|
138
139
|
...n
|
|
139
140
|
}) {
|
|
140
|
-
const { value: m, onValueChange: b, activationMode: t, disabled: C, baseId: w } = A("TabsTrigger"), I = `${w}-trigger-${o}`, v = `${w}-content-${o}`, h = m === o, c = C ||
|
|
141
|
+
const { value: m, onValueChange: b, activationMode: t, disabled: C, baseId: w } = A("TabsTrigger"), I = `${w}-trigger-${o}`, v = `${w}-content-${o}`, h = m === o, c = C || u, r = T(
|
|
141
142
|
(i) => {
|
|
142
143
|
if (c) {
|
|
143
144
|
i.preventDefault();
|
|
@@ -153,9 +154,9 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
153
154
|
return;
|
|
154
155
|
}
|
|
155
156
|
const { key: l } = i;
|
|
156
|
-
(l === "Enter" || l === " ") && (i.preventDefault(), i.stopPropagation(), b(o)),
|
|
157
|
+
(l === "Enter" || l === " ") && (i.preventDefault(), i.stopPropagation(), b(o)), f?.(i);
|
|
157
158
|
},
|
|
158
|
-
[o, b,
|
|
159
|
+
[o, b, f, c]
|
|
159
160
|
), e = T(() => {
|
|
160
161
|
c || t === "automatic" && b(o);
|
|
161
162
|
}, [t, b, o, c]);
|
|
@@ -181,12 +182,12 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
181
182
|
...n
|
|
182
183
|
}
|
|
183
184
|
);
|
|
184
|
-
},
|
|
185
|
+
}, nt = function({
|
|
185
186
|
ref: d,
|
|
186
187
|
children: g,
|
|
187
188
|
className: o
|
|
188
189
|
}) {
|
|
189
|
-
const { value: s } = A("TabsContentContainer"), [
|
|
190
|
+
const { value: s } = A("TabsContentContainer"), [f, u] = H(), n = $();
|
|
190
191
|
return /* @__PURE__ */ p(
|
|
191
192
|
D.div,
|
|
192
193
|
{
|
|
@@ -194,7 +195,7 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
194
195
|
className: x("overflow-hidden", o),
|
|
195
196
|
"data-testid": "spectral-tabs-content-container",
|
|
196
197
|
animate: {
|
|
197
|
-
height:
|
|
198
|
+
height: u.height || "auto"
|
|
198
199
|
},
|
|
199
200
|
transition: n ? { duration: 0 } : {
|
|
200
201
|
duration: 0.3,
|
|
@@ -203,7 +204,7 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
203
204
|
children: /* @__PURE__ */ p(G, { mode: "wait", initial: !1, children: /* @__PURE__ */ p(
|
|
204
205
|
D.div,
|
|
205
206
|
{
|
|
206
|
-
ref:
|
|
207
|
+
ref: f,
|
|
207
208
|
initial: n ? !1 : { opacity: 0, y: 8 },
|
|
208
209
|
animate: { opacity: 1, y: 0 },
|
|
209
210
|
exit: n ? void 0 : { opacity: 0, y: -8 },
|
|
@@ -217,14 +218,14 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
217
218
|
) })
|
|
218
219
|
}
|
|
219
220
|
);
|
|
220
|
-
},
|
|
221
|
+
}, ot = function({
|
|
221
222
|
ref: d,
|
|
222
223
|
className: g,
|
|
223
224
|
value: o,
|
|
224
225
|
forceMount: s = !1,
|
|
225
|
-
...
|
|
226
|
+
...f
|
|
226
227
|
}) {
|
|
227
|
-
const { value:
|
|
228
|
+
const { value: u, baseId: n } = A("TabsContent"), m = `${n}-content-${o}`, b = `${n}-trigger-${o}`, t = u === o;
|
|
228
229
|
return !s && !t ? null : /* @__PURE__ */ p(
|
|
229
230
|
"div",
|
|
230
231
|
{
|
|
@@ -237,16 +238,16 @@ const N = k(null), A = (y = "Tabs") => {
|
|
|
237
238
|
ref: d,
|
|
238
239
|
role: "tabpanel",
|
|
239
240
|
tabIndex: 0,
|
|
240
|
-
...
|
|
241
|
+
...f
|
|
241
242
|
}
|
|
242
243
|
);
|
|
243
244
|
};
|
|
244
245
|
export {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
V as TabsBase,
|
|
247
|
+
ot as TabsContent,
|
|
248
|
+
nt as TabsContentContainer,
|
|
248
249
|
N as TabsContext,
|
|
249
|
-
|
|
250
|
-
|
|
250
|
+
tt as TabsList,
|
|
251
|
+
et as TabsTrigger,
|
|
251
252
|
A as useTabsContext
|
|
252
253
|
};
|
package/dist/Tabs/tabsUtils.js
CHANGED
|
@@ -13,19 +13,19 @@ const s = (e) => {
|
|
|
13
13
|
if (!t) return { ...n, orientation: r, isEnclosed: o };
|
|
14
14
|
const a = t.getBoundingClientRect(), i = e.current.getBoundingClientRect();
|
|
15
15
|
return {
|
|
16
|
-
left: a.left - i.left,
|
|
17
|
-
top: a.top - i.top,
|
|
18
|
-
width: a.width,
|
|
19
16
|
height: a.height,
|
|
17
|
+
isEnclosed: o,
|
|
18
|
+
left: a.left - i.left,
|
|
20
19
|
orientation: r,
|
|
21
|
-
|
|
20
|
+
top: a.top - i.top,
|
|
21
|
+
width: a.width
|
|
22
22
|
};
|
|
23
23
|
}, u = (e) => e.orientation === "horizontal" ? {
|
|
24
24
|
left: `${e.left}px`,
|
|
25
25
|
width: `${e.width}px`
|
|
26
26
|
} : {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
height: `${e.height}px`,
|
|
28
|
+
top: `${e.top}px`
|
|
29
29
|
}, d = (e, n) => {
|
|
30
30
|
let t = null;
|
|
31
31
|
const r = (...o) => {
|
|
@@ -52,7 +52,7 @@ const s = (e) => {
|
|
|
52
52
|
if (!Array.isArray(e) || e.length === 0)
|
|
53
53
|
return console.warn("Tabs: tabValues must be a non-empty array"), !1;
|
|
54
54
|
const n = /* @__PURE__ */ new Set();
|
|
55
|
-
for (let t = 0; t < e.length; t
|
|
55
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
56
56
|
const r = e[t];
|
|
57
57
|
if (!c(r, t))
|
|
58
58
|
return !1;
|
package/dist/Tabs.d.ts
CHANGED
|
@@ -17,10 +17,6 @@ export interface TabsProps extends Omit<TabsBaseProps, 'children' | 'defaultValu
|
|
|
17
17
|
onBeforeChange?: (newValue: string, oldValue: string) => boolean | Promise<boolean> | undefined;
|
|
18
18
|
onError?: ((error: Error) => void) | undefined;
|
|
19
19
|
loading?: boolean | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Initial tab to open (uncontrolled mode).
|
|
22
|
-
* Mutually exclusive with `value` - use one or the other.
|
|
23
|
-
*/
|
|
24
20
|
openOnLoad?: string | undefined;
|
|
25
21
|
rightSlot?: ReactNode | undefined;
|
|
26
22
|
tabValues: TabValue[] | undefined;
|
package/dist/Tabs.js
CHANGED
|
@@ -1,92 +1,88 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { TabsBase as j, TabsList as E, TabsTrigger as K, TabsContentContainer as
|
|
2
|
+
import { jsx as a, jsxs as C } from "react/jsx-runtime";
|
|
3
|
+
import { TabsBase as j, TabsList as E, TabsTrigger as K, TabsContentContainer as V, TabsContent as $ } from "./Tabs/TabsBase.js";
|
|
4
4
|
import { validateTabValues as B, getTabKeys as I } from "./Tabs/tabsUtils.js";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as s } from "./utils/twUtils.js";
|
|
6
6
|
import "react";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
tabValues: w = [],
|
|
24
|
-
value: d,
|
|
25
|
-
variant: t = "default",
|
|
26
|
-
...k
|
|
7
|
+
const F = ({
|
|
8
|
+
activationMode: p = "automatic",
|
|
9
|
+
ariaLabel: h,
|
|
10
|
+
className: m,
|
|
11
|
+
hideContent: y = !1,
|
|
12
|
+
loading: g = !1,
|
|
13
|
+
onBeforeChange: v,
|
|
14
|
+
onError: f,
|
|
15
|
+
onValueChange: x,
|
|
16
|
+
openOnLoad: c,
|
|
17
|
+
orientation: t = "horizontal",
|
|
18
|
+
rightSlot: w,
|
|
19
|
+
tabValues: T = [],
|
|
20
|
+
value: o,
|
|
21
|
+
variant: l = "default",
|
|
22
|
+
...N
|
|
27
23
|
}) => {
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
if (g)
|
|
25
|
+
return /* @__PURE__ */ a("div", { className: "text-text-secondary relative flex w-full flex-col p-4 text-center", role: "status", "aria-live": "polite", children: /* @__PURE__ */ a("p", { children: "Loading tabs…" }) });
|
|
26
|
+
const d = T.filter((e) => e.key !== void 0), n = o !== void 0;
|
|
27
|
+
if (!B(d)) {
|
|
30
28
|
const e = new Error("Invalid tabValues provided to Tabs component");
|
|
31
|
-
return
|
|
29
|
+
return f?.(e), /* @__PURE__ */ a("div", { className: "relative flex w-full flex-col p-4 text-center text-gray-500", role: "alert", "aria-live": "polite", children: /* @__PURE__ */ a("p", { children: "No valid tabs provided" }) });
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
let c;
|
|
39
|
-
if (!b && (c = o ?? i[0], o && !i.includes(o) && (console.warn(`Tabs: openOnLoad value '${o}' is not a valid tab key`), c = i[0]), !c)) {
|
|
31
|
+
const r = I(d);
|
|
32
|
+
let b;
|
|
33
|
+
n && (r.includes(o) ? b = o : (console.warn(`Tabs: value '${o}' is not a valid tab key, falling back to first tab`), b = r[0]));
|
|
34
|
+
let i;
|
|
35
|
+
if (!n && (i = c ?? r[0], c && !r.includes(c) && (console.warn(`Tabs: openOnLoad value '${c}' is not a valid tab key`), i = r[0]), !i)) {
|
|
40
36
|
const e = new Error("No valid default tab available");
|
|
41
|
-
return
|
|
37
|
+
return f?.(e), /* @__PURE__ */ a("div", { className: "text-text-secondary relative flex w-full flex-col p-4 text-center", role: "alert", "aria-live": "polite", children: /* @__PURE__ */ a("p", { children: "Unable to render tabs" }) });
|
|
42
38
|
}
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
39
|
+
const k = async (e) => {
|
|
40
|
+
if (v && x) {
|
|
41
|
+
const z = n ? b ?? "" : i ?? "";
|
|
46
42
|
try {
|
|
47
|
-
if (await
|
|
48
|
-
} catch (
|
|
49
|
-
|
|
43
|
+
if (await v(e, z) === !1) return;
|
|
44
|
+
} catch (u) {
|
|
45
|
+
f?.(u instanceof Error ? u : new Error("Before change callback failed"));
|
|
50
46
|
return;
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
|
-
|
|
49
|
+
x?.(e);
|
|
54
50
|
};
|
|
55
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ a("div", { className: "relative flex w-full flex-col", children: /* @__PURE__ */ C(
|
|
56
52
|
j,
|
|
57
53
|
{
|
|
58
|
-
"aria-label":
|
|
59
|
-
className:
|
|
60
|
-
...
|
|
61
|
-
orientation:
|
|
62
|
-
activationMode:
|
|
63
|
-
onValueChange:
|
|
64
|
-
...
|
|
54
|
+
"aria-label": h,
|
|
55
|
+
className: s("relative w-full data-[orientation=vertical]:flex", l, m),
|
|
56
|
+
...n ? { value: b } : { defaultValue: i },
|
|
57
|
+
orientation: t,
|
|
58
|
+
activationMode: p,
|
|
59
|
+
onValueChange: k,
|
|
60
|
+
...N,
|
|
65
61
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ a(
|
|
67
63
|
E,
|
|
68
64
|
{
|
|
69
|
-
className:
|
|
65
|
+
className: s(
|
|
70
66
|
"inline-flex w-full items-center justify-between",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
t === "horizontal" && l === "default" && "border-tabs-border border-b",
|
|
68
|
+
t === "vertical" && l === "default" && "border-tabs-border relative m-0 h-auto w-auto flex-col items-stretch border-r py-1",
|
|
69
|
+
t === "horizontal" && l === "enclosed" && "bg-tabs-group-bg relative rounded-lg border-0 p-1",
|
|
70
|
+
t === "vertical" && l === "enclosed" && "bg-tabs-group-bg w-auto flex-col rounded-lg border-0 p-1"
|
|
75
71
|
),
|
|
76
|
-
rightSlot:
|
|
77
|
-
children:
|
|
72
|
+
rightSlot: w,
|
|
73
|
+
children: d.map((e) => /* @__PURE__ */ a(
|
|
78
74
|
K,
|
|
79
75
|
{
|
|
80
76
|
value: e.key,
|
|
81
77
|
disabled: e.disabled,
|
|
82
78
|
"aria-label": e["aria-label"],
|
|
83
79
|
"aria-describedby": e["aria-describedby"],
|
|
84
|
-
className:
|
|
80
|
+
className: s(
|
|
85
81
|
"relative font-semibold whitespace-nowrap transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none",
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
t === "horizontal" && l === "default" && "text-text-primary hover:text-accent hover:bg-tabs-bg--hover px-4 py-2",
|
|
83
|
+
t === "vertical" && l === "default" && "text-text-primary data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover flex h-10 items-center px-4 py-2",
|
|
84
|
+
t === "horizontal" && l === "enclosed" && "text-text-primary data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover z-[1] inline-flex items-center justify-center px-4 py-2",
|
|
85
|
+
t === "vertical" && l === "enclosed" && "text-text-primary data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover z-1 px-4 py-2",
|
|
90
86
|
"disabled:hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent"
|
|
91
87
|
),
|
|
92
88
|
children: e.label
|
|
@@ -95,15 +91,15 @@ const L = ({ tabCount: f, orientation: s, hideContent: v }) => /* @__PURE__ */ N
|
|
|
95
91
|
))
|
|
96
92
|
}
|
|
97
93
|
),
|
|
98
|
-
!
|
|
94
|
+
!y && /* @__PURE__ */ a(V, { className: s(t === "vertical" && "flex-1"), children: d.map((e) => /* @__PURE__ */ a($, { value: e.key, className: s("focus-visible:outline-accent text-text-primary focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2", t === "horizontal" && "pb-4", t === "vertical" && "px-4 py-2"), children: e.children }, e.key)) })
|
|
99
95
|
]
|
|
100
96
|
}
|
|
101
97
|
) });
|
|
102
98
|
};
|
|
103
99
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
F as Tabs,
|
|
101
|
+
$ as TabsContent,
|
|
102
|
+
V as TabsContentContainer,
|
|
107
103
|
E as TabsList,
|
|
108
104
|
j as TabsRoot,
|
|
109
105
|
K as TabsTrigger
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ChangeEvent, ClipboardEvent, FocusEvent } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface UseTextareaOptions {
|
|
3
3
|
maxLength: number;
|
|
4
|
-
|
|
4
|
+
onBlur?: (e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
5
5
|
onChange: (value: string) => void;
|
|
6
6
|
onFocus?: (e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
export
|
|
10
|
-
handleFocus: (e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UseTextareaReturn {
|
|
11
10
|
handleBlur: (e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
12
11
|
handleChange: (e: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
12
|
+
handleFocus: (e: FocusEvent<HTMLTextAreaElement>) => void;
|
|
13
13
|
handlePaste: (e: ClipboardEvent<HTMLTextAreaElement>) => void;
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
/**
|
|
16
16
|
* Custom hook for textarea functionality with character limits and event handling
|
|
17
17
|
*/
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback as i } from "react";
|
|
3
|
-
const T = (t,
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
}, V = (t,
|
|
7
|
-
const r = t.clipboardData.getData("text"), c =
|
|
8
|
-
if ((e + r + d).length >
|
|
3
|
+
const T = (t, a, s) => {
|
|
4
|
+
const n = t.target.value;
|
|
5
|
+
n.length <= a && s?.(n);
|
|
6
|
+
}, V = (t, a, s, n) => {
|
|
7
|
+
const r = t.clipboardData.getData("text"), c = s || "", o = t.currentTarget, l = o.selectionStart || 0, u = o.selectionEnd || 0, e = c.substring(0, l), d = c.substring(u);
|
|
8
|
+
if ((e + r + d).length > a) {
|
|
9
9
|
t.preventDefault();
|
|
10
|
-
const g = u - l, h =
|
|
11
|
-
|
|
10
|
+
const g = u - l, h = a - c.length + g, p = r.substring(0, Math.max(0, h)), f = e + p + d;
|
|
11
|
+
n?.(f), setTimeout(() => {
|
|
12
12
|
const b = l + p.length;
|
|
13
13
|
o.setSelectionRange(b, b);
|
|
14
14
|
}, 0);
|
|
15
15
|
}
|
|
16
|
-
}, P = ({ maxLength: t, value:
|
|
16
|
+
}, P = ({ maxLength: t, value: a, onChange: s, onFocus: n, onBlur: r }) => {
|
|
17
17
|
const c = i(
|
|
18
18
|
(e) => {
|
|
19
|
-
|
|
19
|
+
n?.(e);
|
|
20
20
|
},
|
|
21
|
-
[
|
|
21
|
+
[n]
|
|
22
22
|
), o = i(
|
|
23
23
|
(e) => {
|
|
24
24
|
r?.(e);
|
|
@@ -31,9 +31,9 @@ const T = (t, n, s) => {
|
|
|
31
31
|
[t, s]
|
|
32
32
|
), u = i(
|
|
33
33
|
(e) => {
|
|
34
|
-
V(e,
|
|
34
|
+
V(e, t, a, s);
|
|
35
35
|
},
|
|
36
|
-
[
|
|
36
|
+
[a, t, s]
|
|
37
37
|
);
|
|
38
38
|
return {
|
|
39
39
|
handleFocus: c,
|