@spear-ai/spectral 1.9.0 → 1.10.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/README.md +6 -5
- package/dist/.js +112 -239
- package/dist/Accordion-CDXdSAST.js +363 -0
- package/dist/Accordion.js +3 -498
- package/dist/Alert/AlertBase.js +69 -152
- package/dist/Alert.js +58 -106
- package/dist/AnimatePresence-D-9jXfgI.js +178 -0
- package/dist/App.js +6 -6
- package/dist/Avatar.js +83 -65
- package/dist/Badge.d.ts +1 -3
- package/dist/Badge.js +21 -25
- package/dist/Button.js +102 -178
- package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
- package/dist/ButtonGroup.js +55 -59
- package/dist/ButtonIcon.js +58 -134
- package/dist/Calendar-s4lyijkn.js +3109 -0
- package/dist/Checkbox/CheckboxBase.js +94 -126
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.js +40 -105
- package/dist/Combobox/ComboboxBase.js +2 -79
- package/dist/Combobox.js +106 -172
- package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
- package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
- package/dist/ControlGroup/ControlGroupSelect.js +85 -101
- package/dist/ControlGroup.js +45 -48
- package/dist/DataCard/Card.js +37 -12
- package/dist/DataCard.d.ts +1 -1
- package/dist/DataCard.js +36 -16
- package/dist/DateTimePicker/Calendar.js +2 -2967
- package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
- package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -274
- package/dist/DateTimePicker/DateTimeInput.d.ts +5 -3
- package/dist/DateTimePicker/DateTimeInput.js +133 -88
- package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
- package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
- package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
- package/dist/DateTimePicker/TimePicker.d.ts +1 -1
- package/dist/DateTimePicker/TimePicker.js +76 -60
- package/dist/DateTimePicker.d.ts +2 -2
- package/dist/DateTimePicker.js +87 -205
- package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
- package/dist/Dialog.js +74 -74
- package/dist/Drawer.js +67 -37
- package/dist/HoverCard-CYDsIiVK.js +201 -0
- package/dist/HoverCard.d.ts +1 -1
- package/dist/HoverCard.js +2 -218
- package/dist/Icons/AnalyzeIcon.js +50 -57
- package/dist/Icons/AnnotationsIcon.js +20 -15
- package/dist/Icons/ApprovedIcon.js +26 -18
- package/dist/Icons/ArrowDownIcon.js +20 -6
- package/dist/Icons/ArrowUpIcon.js +20 -6
- package/dist/Icons/BoxToolIcon.js +17 -12
- package/dist/Icons/CalendarIcon.js +43 -20
- package/dist/Icons/CheckCircleIcon.js +26 -10
- package/dist/Icons/CheckSquareIcon.js +26 -10
- package/dist/Icons/CheckmarkIcon.js +22 -9
- package/dist/Icons/ChevronDownIcon.js +22 -9
- package/dist/Icons/ChevronUpIcon.js +22 -9
- package/dist/Icons/ClockIcon.js +26 -18
- package/dist/Icons/CloseCircleIcon.js +26 -10
- package/dist/Icons/CloseIcon.js +18 -9
- package/dist/Icons/DashboardIcon.js +36 -10
- package/dist/Icons/DatabaseIcon.js +36 -19
- package/dist/Icons/DeleteIcon.js +36 -19
- package/dist/Icons/DurationIcon.js +57 -22
- package/dist/Icons/EditIcon.js +26 -27
- package/dist/Icons/EmailIcon.js +26 -10
- package/dist/Icons/EraserIcon.js +41 -25
- package/dist/Icons/ErrorIcon.js +27 -11
- package/dist/Icons/EyeClosedIcon.js +29 -13
- package/dist/Icons/EyeClosedIcon2.js +27 -11
- package/dist/Icons/EyeOpenIcon.js +22 -9
- package/dist/Icons/FileDownloadIcon.js +43 -20
- package/dist/Icons/GoToFirstIcon.js +26 -9
- package/dist/Icons/GoToLastIcon.js +26 -9
- package/dist/Icons/HarmonicCursorsIcon.js +23 -9
- package/dist/Icons/IconBase.d.ts +3 -3
- package/dist/Icons/IconBase.js +49 -23
- package/dist/Icons/InfoIcon.js +36 -10
- package/dist/Icons/KeyboardIcon.js +26 -27
- package/dist/Icons/LabelIcon.js +19 -14
- package/dist/Icons/LassoIcon.js +36 -28
- package/dist/Icons/LineToolIcon.js +48 -39
- package/dist/Icons/LiveViewIcon.js +50 -12
- package/dist/Icons/LoaderIcon.js +67 -27
- package/dist/Icons/LocationIcon.js +26 -27
- package/dist/Icons/LogoutIcon.js +20 -15
- package/dist/Icons/MeasureIcon.js +78 -25
- package/dist/Icons/MessagesIcon.js +33 -18
- package/dist/Icons/MetadataIcon.js +20 -15
- package/dist/Icons/MinusIcon.d.ts +1 -1
- package/dist/Icons/MinusIcon.js +18 -6
- package/dist/Icons/OntologyIcon.js +87 -71
- package/dist/Icons/PanelIconClose.js +28 -10
- package/dist/Icons/PanelIconOpen.js +28 -10
- package/dist/Icons/PlayIcon.js +20 -6
- package/dist/Icons/PlusIcon.js +20 -14
- package/dist/Icons/PolygonIcon.js +50 -39
- package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
- package/dist/Icons/ProgressCheckIcon.js +58 -0
- package/dist/Icons/ResetIcon.js +17 -12
- package/dist/Icons/ReviewedIcon.js +36 -19
- package/dist/Icons/ScissorsIcon.js +22 -17
- package/dist/Icons/SearchIcon.js +26 -9
- package/dist/Icons/SettingsIcon.js +26 -27
- package/dist/Icons/SortAscendingIcon.js +50 -12
- package/dist/Icons/SortAtoZIcon.js +50 -12
- package/dist/Icons/SortDescendingIcon.js +50 -12
- package/dist/Icons/SortZtoAIcon.js +50 -12
- package/dist/Icons/StackIcon.js +26 -9
- package/dist/Icons/StarIcon.js +20 -6
- package/dist/Icons/TrashIcon.js +17 -12
- package/dist/Icons/UndoIcon.js +20 -15
- package/dist/Icons/User2Icon.js +26 -10
- package/dist/Icons/UserIcon.js +19 -14
- package/dist/Icons/WarningIcon.js +19 -14
- package/dist/Icons/ZoomAllIcon.js +71 -15
- package/dist/Icons/ZoomXIcon.js +36 -10
- package/dist/Icons/ZoomYIcon.js +36 -10
- package/dist/Icons/index.d.ts +1 -0
- package/dist/Icons.js +68 -136
- package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
- package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
- package/dist/IconsAnimated.js +3 -6
- package/dist/Input/InputUtils.js +51 -52
- package/dist/Input.js +132 -185
- package/dist/InputOTP-XUWW9xcI.js +461 -0
- package/dist/InputOTP.js +2 -382
- package/dist/Kbd.d.ts +1 -1
- package/dist/Kbd.js +182 -86
- package/dist/Label.js +12 -14
- package/dist/MultiSelect/MultiSelectBase.js +331 -403
- package/dist/MultiSelect.d.ts +1 -1
- package/dist/MultiSelect.js +23 -23
- package/dist/Popover.js +28 -32
- package/dist/RadioButton.d.ts +17 -0
- package/dist/RadioButton.js +33 -0
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
- package/dist/RadioButtonGroup.d.ts +1 -1
- package/dist/RadioButtonGroup.js +11 -8
- package/dist/RadioGroup-w_q6RGEK.js +447 -0
- package/dist/RadioGroup.js +2 -505
- package/dist/Select.js +163 -186
- package/dist/Separator.js +16 -19
- package/dist/Skeleton.js +10 -6
- package/dist/Slider-BzzZT3Zm.js +490 -0
- package/dist/Slider.js +2 -562
- package/dist/SpectralProvider.js +8 -5
- package/dist/Switch/SwitchBase.js +91 -95
- package/dist/Switch-CVzRJ-0n.js +126 -0
- package/dist/Switch.d.ts +1 -1
- package/dist/Switch.js +2 -134
- package/dist/Tabs/TabsBase.js +242 -250
- package/dist/Tabs/tabsUtils.js +65 -73
- package/dist/Tabs.d.ts +1 -1
- package/dist/Tabs.js +73 -103
- package/dist/Textarea/TextareaUtils.js +35 -46
- package/dist/Textarea.js +83 -160
- package/dist/Toast-9zqXxKKO.js +711 -0
- package/dist/Toast.js +2 -885
- package/dist/Toggle/ToggleBase.js +46 -56
- package/dist/Toggle.d.ts +1 -1
- package/dist/Toggle.js +52 -62
- package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
- package/dist/ToggleGroup.d.ts +1 -1
- package/dist/ToggleGroup.js +52 -63
- package/dist/Tooltip-D1K8kY1y.js +389 -0
- package/dist/Tooltip.js +2 -365
- package/dist/Tray.js +174 -217
- package/dist/chunk-h9knIhTc.js +20 -0
- package/dist/clsx-jM1GlMvB.js +16 -0
- package/dist/dist-3Af8168y.js +913 -0
- package/dist/dist-7HRQ5IKN.js +249 -0
- package/dist/dist-B2k1iWFp.js +129 -0
- package/dist/dist-B4FgboI8.js +122 -0
- package/dist/dist-B4g6zpUF.js +33 -0
- package/dist/dist-B9tup-4O.js +216 -0
- package/dist/dist-BK1K0g9W.js +29 -0
- package/dist/dist-Bfjk-jx9.js +28 -0
- package/dist/dist-Bft31cJh.js +65 -0
- package/dist/dist-BtdmHAzK.js +190 -0
- package/dist/dist-C0Hifjgh.js +1287 -0
- package/dist/dist-CGzgmYB9.js +68 -0
- package/dist/dist-ClmepHp4.js +10 -0
- package/dist/dist-D8Wb_MX9.js +6 -0
- package/dist/dist-Dtvmk11N.js +12 -0
- package/dist/dist-fW81qjVl.js +677 -0
- package/dist/dist-s1uWaZYZ.js +11 -0
- package/dist/es2015-YHaMV-St.js +701 -0
- package/dist/hooks/useAccordionAutoScroll.js +66 -67
- package/dist/hooks/useControllableState.js +14 -13
- package/dist/hooks/useTheme.js +21 -17
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/main.js +18954 -27224
- package/dist/primitives/button.js +39 -41
- package/dist/primitives/input-group.js +57 -73
- package/dist/primitives/input.js +11 -20
- package/dist/primitives/popover.d.ts.map +1 -1
- package/dist/primitives/popover.js +34 -25
- package/dist/primitives/select.js +70 -138
- package/dist/primitives/slot.js +32 -31
- package/dist/primitives/textarea.js +10 -16
- package/dist/proxy-Dn10Pl_g.js +4920 -0
- package/dist/styles/main.css +2 -1
- package/dist/styles/spectral.css +1 -1
- package/dist/twUtils-VNWgstKL.js +1673 -0
- package/dist/use-animation-CBUDycyW.js +57 -0
- package/dist/utils/constants.js +4 -4
- package/dist/utils/formFieldUtils.js +136 -148
- package/dist/utils/sharedUtils.js +26 -7
- package/dist/utils/twUtils.js +2 -2919
- package/package.json +24 -28
- package/dist/ComboboxBase-CxNxYtdT.js +0 -408
- package/dist/clsx-OuTLNxxd.js +0 -16
- package/dist/index-0ioNhtNM.js +0 -10
- package/dist/index-6oYKCvIn.js +0 -677
- package/dist/index-BFOf48AQ.js +0 -69
- package/dist/index-BZPx6jYI.js +0 -8
- package/dist/index-BlHU_t18.js +0 -142
- package/dist/index-Bm1RbF6w.js +0 -1037
- package/dist/index-Bv2OIg5P.js +0 -225
- package/dist/index-CKEI0pDv.js +0 -56
- package/dist/index-CM_hWgfC.js +0 -32
- package/dist/index-C_YVr64u.js +0 -1538
- package/dist/index-Cl8VeY0o.js +0 -149
- package/dist/index-CwSyIPrv.js +0 -13
- package/dist/index-D29mdTf5.js +0 -34
- package/dist/index-DEYs15GP.js +0 -66
- package/dist/index-Dc0No4pV.js +0 -233
- package/dist/index-T6XEa11q.js +0 -822
- package/dist/index-pBCLb6Gr.js +0 -240
- package/dist/index-psiVrsnE.js +0 -27
- package/dist/index-rKs9bXHr.js +0 -6
- package/dist/proxy-CO_-Vget.js +0 -4975
- package/dist/use-animation-DhEPRwZ3.js +0 -62
package/dist/Tabs/tabsUtils.js
CHANGED
|
@@ -1,75 +1,67 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
//#region src/components/Tabs/tabsUtils.ts
|
|
3
|
+
var e = (e) => {
|
|
4
|
+
let t = {
|
|
5
|
+
left: 0,
|
|
6
|
+
top: 0,
|
|
7
|
+
width: 0,
|
|
8
|
+
height: 0,
|
|
9
|
+
orientation: "horizontal",
|
|
10
|
+
isEnclosed: !1
|
|
11
|
+
};
|
|
12
|
+
if (!e.current) return t;
|
|
13
|
+
let n = e.current.querySelector("[data-state='active']"), r = e.current.closest("[data-orientation]")?.getAttribute("data-orientation") ?? "horizontal", i = e.current.closest(".enclosed") !== null;
|
|
14
|
+
if (!n) return {
|
|
15
|
+
...t,
|
|
16
|
+
orientation: r,
|
|
17
|
+
isEnclosed: i
|
|
18
|
+
};
|
|
19
|
+
let a = n.getBoundingClientRect(), o = e.current.getBoundingClientRect();
|
|
20
|
+
return {
|
|
21
|
+
height: a.height,
|
|
22
|
+
isEnclosed: i,
|
|
23
|
+
left: a.left - o.left,
|
|
24
|
+
orientation: r,
|
|
25
|
+
top: a.top - o.top,
|
|
26
|
+
width: a.width
|
|
27
|
+
};
|
|
28
|
+
}, t = (e) => e.orientation === "horizontal" ? {
|
|
29
|
+
left: `${e.left}px`,
|
|
30
|
+
width: `${e.width}px`
|
|
26
31
|
} : {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
return !0;
|
|
65
|
-
}, y = (e) => e.map((n) => n.key), g = (e, n) => e.find((t) => t.key === n);
|
|
66
|
-
export {
|
|
67
|
-
s as calculateIndicatorStyle,
|
|
68
|
-
d as debounce,
|
|
69
|
-
g as findTabByKey,
|
|
70
|
-
h as generateId,
|
|
71
|
-
u as getIndicatorPosition,
|
|
72
|
-
y as getTabKeys,
|
|
73
|
-
f as prefersReducedMotion,
|
|
74
|
-
p as validateTabValues
|
|
75
|
-
};
|
|
32
|
+
height: `${e.height}px`,
|
|
33
|
+
top: `${e.top}px`
|
|
34
|
+
}, n = (e, t) => {
|
|
35
|
+
let n = null, r = (...r) => {
|
|
36
|
+
n !== null && clearTimeout(n), n = setTimeout(() => {
|
|
37
|
+
e(...r);
|
|
38
|
+
}, t);
|
|
39
|
+
};
|
|
40
|
+
return r.cancel = () => {
|
|
41
|
+
n !== null && (clearTimeout(n), n = null);
|
|
42
|
+
}, r;
|
|
43
|
+
}, r = () => {
|
|
44
|
+
if (typeof window > "u") return !1;
|
|
45
|
+
try {
|
|
46
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
47
|
+
} catch {
|
|
48
|
+
return !1;
|
|
49
|
+
}
|
|
50
|
+
}, i = (e = "tabs") => typeof crypto < "u" && crypto.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Math.random().toString(36).substring(2, 11)}-${Date.now().toString(36)}`, a = (e, t) => {
|
|
51
|
+
if (typeof e != "object" || !e) return console.warn(`Tabs: Tab at index ${t} must be an object, received: ${typeof e}`), !1;
|
|
52
|
+
let n = e;
|
|
53
|
+
return !("key" in n) || typeof n.key != "string" || n.key.length === 0 ? (console.warn(`Tabs: Tab at index ${t} must have a non-empty string 'key' property`), !1) : "label" in n ? "children" in n ? !0 : (console.warn(`Tabs: Tab at index ${t} must have a 'children' property`), !1) : (console.warn(`Tabs: Tab at index ${t} must have a 'label' property`), !1);
|
|
54
|
+
}, o = (e) => {
|
|
55
|
+
if (!Array.isArray(e) || e.length === 0) return console.warn("Tabs: tabValues must be a non-empty array"), !1;
|
|
56
|
+
let t = /* @__PURE__ */ new Set();
|
|
57
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
58
|
+
let r = e[n];
|
|
59
|
+
if (!a(r, n)) return !1;
|
|
60
|
+
let i = r;
|
|
61
|
+
if (t.has(i.key)) return console.warn(`Tabs: Duplicate key found: '${i.key}' at index ${n}`), !1;
|
|
62
|
+
t.add(i.key);
|
|
63
|
+
}
|
|
64
|
+
return !0;
|
|
65
|
+
}, s = (e) => e.map((e) => e.key), c = (e, t) => e.find((e) => e.key === t);
|
|
66
|
+
//#endregion
|
|
67
|
+
export { e as calculateIndicatorStyle, n as debounce, c as findTabByKey, i as generateId, t as getIndicatorPosition, s as getTabKeys, r as prefersReducedMotion, o as validateTabValues };
|
package/dist/Tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TabsBase, TabsContent, TabsContentContainer, TabsList, TabsTrigger, TabsBaseProps } from './TabsBase';
|
|
2
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { TabsBase, TabsContent, TabsContentContainer, TabsList, TabsTrigger, TabsBaseProps } from './TabsBase';
|
|
3
3
|
export interface TabValue {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
disabled?: boolean | undefined;
|
package/dist/Tabs.js
CHANGED
|
@@ -1,106 +1,76 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { cn as s } from "./utils/twUtils.js";
|
|
2
|
+
import { t as e } from "./twUtils-VNWgstKL.js";
|
|
3
|
+
import { getTabKeys as t, validateTabValues as n } from "./Tabs/tabsUtils.js";
|
|
4
|
+
import { TabsBase as r, TabsContent as i, TabsContentContainer as a, TabsList as o, TabsTrigger as s } from "./Tabs/TabsBase.js";
|
|
6
5
|
import "react";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
value: e.key,
|
|
77
|
-
disabled: e.disabled,
|
|
78
|
-
"aria-label": e["aria-label"],
|
|
79
|
-
"aria-describedby": e["aria-describedby"],
|
|
80
|
-
className: s(
|
|
81
|
-
"relative font-semibold whitespace-nowrap transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none",
|
|
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",
|
|
86
|
-
"disabled:hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent"
|
|
87
|
-
),
|
|
88
|
-
children: e.label
|
|
89
|
-
},
|
|
90
|
-
e.key
|
|
91
|
-
))
|
|
92
|
-
}
|
|
93
|
-
),
|
|
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)) })
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
) });
|
|
98
|
-
};
|
|
99
|
-
export {
|
|
100
|
-
F as Tabs,
|
|
101
|
-
$ as TabsContent,
|
|
102
|
-
V as TabsContentContainer,
|
|
103
|
-
E as TabsList,
|
|
104
|
-
j as TabsRoot,
|
|
105
|
-
K as TabsTrigger
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/Tabs/Tabs.tsx
|
|
8
|
+
var u = ({ activationMode: u = "automatic", ariaLabel: d, className: f, hideContent: p = !1, loading: m = !1, onBeforeChange: h, onError: g, onValueChange: _, openOnLoad: v, orientation: y = "horizontal", rightSlot: b, tabValues: x = [], value: S, variant: C = "default", ...w }) => {
|
|
9
|
+
if (m) return /* @__PURE__ */ c("div", {
|
|
10
|
+
className: "p-4 relative flex w-full flex-col text-center text-text-secondary",
|
|
11
|
+
role: "status",
|
|
12
|
+
"aria-live": "polite",
|
|
13
|
+
children: /* @__PURE__ */ c("p", { children: "Loading tabs…" })
|
|
14
|
+
});
|
|
15
|
+
let T = x.filter((e) => e.key !== void 0), E = S !== void 0;
|
|
16
|
+
if (!n(T)) return g?.(/* @__PURE__ */ Error("Invalid tabValues provided to Tabs component")), /* @__PURE__ */ c("div", {
|
|
17
|
+
className: "p-4 text-gray-500 relative flex w-full flex-col text-center",
|
|
18
|
+
role: "alert",
|
|
19
|
+
"aria-live": "polite",
|
|
20
|
+
children: /* @__PURE__ */ c("p", { children: "No valid tabs provided" })
|
|
21
|
+
});
|
|
22
|
+
let D = t(T), O;
|
|
23
|
+
E && (D.includes(S) ? O = S : (console.warn(`Tabs: value '${S}' is not a valid tab key, falling back to first tab`), O = D[0]));
|
|
24
|
+
let k;
|
|
25
|
+
if (!E && (k = v ?? D[0], v && !D.includes(v) && (console.warn(`Tabs: openOnLoad value '${v}' is not a valid tab key`), k = D[0]), !k)) return g?.(/* @__PURE__ */ Error("No valid default tab available")), /* @__PURE__ */ c("div", {
|
|
26
|
+
className: "p-4 relative flex w-full flex-col text-center text-text-secondary",
|
|
27
|
+
role: "alert",
|
|
28
|
+
"aria-live": "polite",
|
|
29
|
+
children: /* @__PURE__ */ c("p", { children: "Unable to render tabs" })
|
|
30
|
+
});
|
|
31
|
+
let A = async (e) => {
|
|
32
|
+
if (h && _) {
|
|
33
|
+
let t = E ? O ?? "" : k ?? "";
|
|
34
|
+
try {
|
|
35
|
+
if (await h(e, t) === !1) return;
|
|
36
|
+
} catch (e) {
|
|
37
|
+
g?.(e instanceof Error ? e : /* @__PURE__ */ Error("Before change callback failed"));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
_?.(e);
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ c("div", {
|
|
44
|
+
className: "relative flex w-full flex-col",
|
|
45
|
+
children: /* @__PURE__ */ l(r, {
|
|
46
|
+
"aria-label": d,
|
|
47
|
+
className: e("relative w-full data-[orientation=vertical]:flex", C, f),
|
|
48
|
+
...E ? { value: O } : { defaultValue: k },
|
|
49
|
+
orientation: y,
|
|
50
|
+
activationMode: u,
|
|
51
|
+
onValueChange: A,
|
|
52
|
+
...w,
|
|
53
|
+
children: [/* @__PURE__ */ c(o, {
|
|
54
|
+
className: e("inline-flex w-full items-center justify-between", y === "horizontal" && C === "default" && "border-b border-tabs-border", y === "vertical" && C === "default" && "m-0 py-1 relative h-auto w-auto flex-col items-stretch border-r border-tabs-border", y === "horizontal" && C === "enclosed" && "rounded-lg p-1 relative border-0 bg-tabs-group-bg", y === "vertical" && C === "enclosed" && "rounded-lg p-1 w-auto flex-col border-0 bg-tabs-group-bg"),
|
|
55
|
+
rightSlot: b,
|
|
56
|
+
children: T.map((t) => /* @__PURE__ */ c(s, {
|
|
57
|
+
value: t.key,
|
|
58
|
+
disabled: t.disabled,
|
|
59
|
+
"aria-label": t["aria-label"],
|
|
60
|
+
"aria-describedby": t["aria-describedby"],
|
|
61
|
+
className: e("font-semibold relative whitespace-nowrap transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none", y === "horizontal" && C === "default" && "py-2 px-4 hover:bg-tabs-bg--hover text-text-primary hover:text-accent", y === "vertical" && C === "default" && "h-10 px-4 py-2 hover:bg-tabs-bg--hover flex items-center text-text-primary hover:text-accent data-[state=active]:text-accent", y === "horizontal" && C === "enclosed" && "px-4 py-2 hover:bg-tabs-bg--hover z-[1] inline-flex items-center justify-center text-text-primary hover:text-accent data-[state=active]:text-accent", y === "vertical" && C === "enclosed" && "px-4 py-2 hover:bg-tabs-bg--hover z-1 text-text-primary hover:text-accent data-[state=active]:text-accent", "disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-text-primary"),
|
|
62
|
+
children: t.label
|
|
63
|
+
}, t.key))
|
|
64
|
+
}), !p && /* @__PURE__ */ c(a, {
|
|
65
|
+
className: e(y === "vertical" && "flex-1"),
|
|
66
|
+
children: T.map((t) => /* @__PURE__ */ c(i, {
|
|
67
|
+
value: t.key,
|
|
68
|
+
className: e("text-text-primary focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent", y === "horizontal" && "pb-4", y === "vertical" && "py-2 px-4"),
|
|
69
|
+
children: t.children
|
|
70
|
+
}, t.key))
|
|
71
|
+
})]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
106
74
|
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { u as Tabs, i as TabsContent, a as TabsContentContainer, o as TabsList, r as TabsRoot, s as TabsTrigger };
|
|
@@ -1,47 +1,36 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
);
|
|
38
|
-
return {
|
|
39
|
-
handleFocus: c,
|
|
40
|
-
handleBlur: o,
|
|
41
|
-
handleChange: l,
|
|
42
|
-
handlePaste: u
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export {
|
|
46
|
-
P as useTextarea
|
|
47
|
-
};
|
|
2
|
+
import { useCallback as e } from "react";
|
|
3
|
+
//#region src/components/Textarea/TextareaUtils.tsx
|
|
4
|
+
var t = (e, t, n) => {
|
|
5
|
+
let r = e.target.value;
|
|
6
|
+
r.length <= t && n?.(r);
|
|
7
|
+
}, n = (e, t, n, r) => {
|
|
8
|
+
let i = e.clipboardData.getData("text"), a = n || "", o = e.currentTarget, s = o.selectionStart || 0, c = o.selectionEnd || 0, l = a.substring(0, s), u = a.substring(c);
|
|
9
|
+
if ((l + i + u).length > t) {
|
|
10
|
+
e.preventDefault();
|
|
11
|
+
let n = c - s, d = t - a.length + n, f = i.substring(0, Math.max(0, d)), p = l + f + u;
|
|
12
|
+
r?.(p), setTimeout(() => {
|
|
13
|
+
let e = s + f.length;
|
|
14
|
+
o.setSelectionRange(e, e);
|
|
15
|
+
}, 0);
|
|
16
|
+
}
|
|
17
|
+
}, r = ({ maxLength: r, value: i, onChange: a, onFocus: o, onBlur: s }) => ({
|
|
18
|
+
handleFocus: e((e) => {
|
|
19
|
+
o?.(e);
|
|
20
|
+
}, [o]),
|
|
21
|
+
handleBlur: e((e) => {
|
|
22
|
+
s?.(e);
|
|
23
|
+
}, [s]),
|
|
24
|
+
handleChange: e((e) => {
|
|
25
|
+
t(e, r, a);
|
|
26
|
+
}, [r, a]),
|
|
27
|
+
handlePaste: e((e) => {
|
|
28
|
+
n(e, r, i, a);
|
|
29
|
+
}, [
|
|
30
|
+
i,
|
|
31
|
+
r,
|
|
32
|
+
a
|
|
33
|
+
])
|
|
34
|
+
});
|
|
35
|
+
//#endregion
|
|
36
|
+
export { r as useTextarea };
|