@spear-ai/spectral 1.3.67 → 1.3.68
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/Accordion.js +7 -31
- package/dist/Alert/AlertBase.d.ts +10 -1
- package/dist/Alert/AlertBase.js +25 -42
- package/dist/Alert.d.ts +5 -5
- package/dist/Alert.js +43 -54
- package/dist/Avatar.js +4 -33
- package/dist/Badge.js +1 -6
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +32 -67
- package/dist/ButtonGroup/ButtonGroupButton.js +1 -10
- package/dist/ButtonGroup.js +6 -42
- package/dist/ButtonIcon.d.ts +4 -4
- package/dist/ButtonIcon.js +44 -53
- package/dist/Card.js +6 -13
- package/dist/Checkbox/CheckboxBase.js +4 -15
- package/dist/Checkbox.js +24 -40
- package/dist/Dialog/DialogBase.d.ts +17 -17
- package/dist/Dialog/DialogBase.js +13 -62
- package/dist/Dialog.d.ts +1 -1
- package/dist/Dialog.js +6 -44
- package/dist/Drawer.d.ts +6 -6
- package/dist/Drawer.js +6 -14
- package/dist/HoverCard.d.ts +5 -4
- package/dist/HoverCard.js +148 -138
- package/dist/Icons/AnalyzeIcon.js +52 -64
- package/dist/Icons/AnnotationsIcon.js +8 -20
- package/dist/Icons/ApprovedIcon.js +13 -34
- package/dist/Icons/CalendarIcon.js +15 -54
- package/dist/Icons/CheckCircleIcon.js +5 -21
- package/dist/Icons/CheckSquareIcon.js +5 -21
- package/dist/Icons/CheckmarkIcon.js +4 -20
- package/dist/Icons/ChevronDownIcon.js +4 -20
- package/dist/Icons/ChevronUpIcon.js +4 -20
- package/dist/Icons/ClockIcon.js +13 -34
- package/dist/Icons/CloseCircleIcon.js +5 -21
- package/dist/Icons/CloseIcon.js +4 -20
- package/dist/Icons/DashboardIcon.js +5 -44
- package/dist/Icons/DatabaseIcon.js +14 -44
- package/dist/Icons/DeleteIcon.js +14 -44
- package/dist/Icons/DurationIcon.js +17 -74
- package/dist/Icons/EmailIcon.js +5 -21
- package/dist/Icons/EraserIcon.js +16 -37
- package/dist/Icons/ErrorIcon.js +6 -22
- package/dist/Icons/EyeClosedIcon.js +8 -24
- package/dist/Icons/EyeClosedIcon2.js +6 -22
- package/dist/Icons/EyeOpenIcon.js +4 -20
- package/dist/Icons/GoToFirstIcon.js +4 -34
- package/dist/Icons/GoToLastIcon.js +4 -34
- package/dist/Icons/HarmonicCursorsIcon.js +4 -31
- package/dist/Icons/IconBase.js +5 -22
- package/dist/Icons/InfoIcon.js +5 -26
- package/dist/Icons/LabelIcon.js +7 -19
- package/dist/Icons/LassoIcon.js +23 -44
- package/dist/Icons/LineToolIcon.js +5 -17
- package/dist/Icons/LineToolIcon2.js +43 -64
- package/dist/Icons/LiveViewIcon.js +7 -64
- package/dist/Icons/LoaderIcon.js +18 -42
- package/dist/Icons/LocationIcon.js +22 -34
- package/dist/Icons/LogoutIcon.js +8 -20
- package/dist/Icons/MessagesIcon.js +13 -25
- package/dist/Icons/MetadataIcon.js +8 -20
- package/dist/Icons/MinusIcon.js +1 -17
- package/dist/Icons/OntologyIcon.js +66 -78
- package/dist/Icons/PanelIconClose.js +5 -21
- package/dist/Icons/PanelIconOpen.js +5 -21
- package/dist/Icons/PlayIcon.js +1 -22
- package/dist/Icons/PlusIcon.js +7 -20
- package/dist/Icons/ResetIcon.js +5 -17
- package/dist/Icons/ReviewedIcon.js +14 -35
- package/dist/Icons/ScissorsIcon.js +12 -30
- package/dist/Icons/SettingsIcon.js +22 -34
- package/dist/Icons/SortAscendingIcon.js +7 -64
- package/dist/Icons/SortDescendingIcon.js +7 -64
- package/dist/Icons/StackIcon.js +4 -34
- package/dist/Icons/StarIcon.js +1 -22
- package/dist/Icons/TrashIcon.js +5 -17
- package/dist/Icons/UndoIcon.js +8 -20
- package/dist/Icons/UserIcon.js +7 -19
- package/dist/Icons/WarningIcon.js +7 -19
- package/dist/Icons/ZoomAllIcon.js +10 -94
- package/dist/Icons/ZoomXIcon.js +5 -35
- package/dist/Icons/ZoomYIcon.js +5 -44
- package/dist/Input.d.ts +22 -20
- package/dist/Input.js +52 -92
- package/dist/InputGroup.js +2 -47
- package/dist/InputOTP.js +63 -99
- package/dist/Label.js +1 -12
- package/dist/MultiSelect/MultiSelectBase.d.ts +24 -24
- package/dist/MultiSelect/MultiSelectBase.js +82 -151
- package/dist/MultiSelect/MutiSelect.d.ts +6 -6
- package/dist/MultiSelect/MutiSelect.js +9 -21
- package/dist/Popover.js +2 -9
- package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +8 -8
- package/dist/RadioButtonGroup/RadioButtonGroupBase.js +1 -27
- package/dist/RadioButtonGroup.d.ts +1 -1
- package/dist/RadioButtonGroup.js +1 -11
- package/dist/RadioGroup.d.ts +16 -16
- package/dist/RadioGroup.js +40 -92
- package/dist/Select.d.ts +7 -6
- package/dist/Select.js +81 -135
- package/dist/Separator.js +13 -15
- package/dist/Slider/SliderBase.js +129 -188
- package/dist/Slider.js +4 -41
- package/dist/Switch/SwitchBase.js +84 -106
- package/dist/Switch.d.ts +6 -6
- package/dist/Switch.js +34 -49
- package/dist/Tabs/TabsBase.d.ts +18 -18
- package/dist/Tabs/TabsBase.js +12 -71
- package/dist/Tabs/tabsStoryData.js +2 -2
- package/dist/Tabs/tabsUtils.d.ts +17 -17
- package/dist/Tabs.d.ts +14 -14
- package/dist/Tabs.js +67 -130
- package/dist/Textarea/TextareaUtils.d.ts +1 -1
- package/dist/Textarea.d.ts +9 -8
- package/dist/Textarea.js +49 -84
- package/dist/Toggle/ToggleBase.d.ts +4 -4
- package/dist/Toggle/ToggleBase.js +2 -27
- package/dist/Toggle.js +1 -11
- package/dist/ToggleGroup/ToggleGroupBase.d.ts +8 -8
- package/dist/ToggleGroup/ToggleGroupBase.js +6 -35
- package/dist/ToggleGroup.js +1 -1
- package/dist/Tooltip/TooltipBase.d.ts +1 -1
- package/dist/Tooltip/TooltipBase.js +5 -47
- package/dist/Tray/TrayStoriesData.d.ts +1 -1
- package/dist/Tray/TrayStoriesData.js +22 -134
- package/dist/Tray.d.ts +6 -2
- package/dist/Tray.js +55 -68
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Alert/Alert.d.ts +5 -5
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/AlertBase.d.ts +10 -1
- package/dist/components/Alert/AlertBase.d.ts.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/components/ButtonGroup/ButtonGroupButton.d.ts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.d.ts +4 -4
- package/dist/components/ButtonIcon/ButtonIcon.d.ts.map +1 -1
- package/dist/components/Card/Card.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/CheckboxBase.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.d.ts +1 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/DialogBase.d.ts +17 -17
- package/dist/components/Dialog/DialogBase.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +6 -6
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/HoverCard/HoverCard.d.ts +5 -4
- package/dist/components/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/components/Icons/AnalyzeIcon.d.ts.map +1 -1
- package/dist/components/Icons/AnnotationsIcon.d.ts.map +1 -1
- package/dist/components/Icons/ApprovedIcon.d.ts.map +1 -1
- package/dist/components/Icons/CalendarIcon.d.ts.map +1 -1
- package/dist/components/Icons/CheckCircleIcon.d.ts.map +1 -1
- package/dist/components/Icons/CheckSquareIcon.d.ts.map +1 -1
- package/dist/components/Icons/CheckmarkIcon.d.ts.map +1 -1
- package/dist/components/Icons/ChevronDownIcon.d.ts.map +1 -1
- package/dist/components/Icons/ChevronUpIcon.d.ts.map +1 -1
- package/dist/components/Icons/ClockIcon.d.ts.map +1 -1
- package/dist/components/Icons/CloseCircleIcon.d.ts.map +1 -1
- package/dist/components/Icons/CloseIcon.d.ts.map +1 -1
- package/dist/components/Icons/DashboardIcon.d.ts.map +1 -1
- package/dist/components/Icons/DatabaseIcon.d.ts.map +1 -1
- package/dist/components/Icons/DeleteIcon.d.ts.map +1 -1
- package/dist/components/Icons/DurationIcon.d.ts.map +1 -1
- package/dist/components/Icons/EmailIcon.d.ts.map +1 -1
- package/dist/components/Icons/EraserIcon.d.ts.map +1 -1
- package/dist/components/Icons/ErrorIcon.d.ts.map +1 -1
- package/dist/components/Icons/EyeClosedIcon.d.ts.map +1 -1
- package/dist/components/Icons/EyeClosedIcon2.d.ts.map +1 -1
- package/dist/components/Icons/EyeOpenIcon.d.ts.map +1 -1
- package/dist/components/Icons/GoToFirstIcon.d.ts.map +1 -1
- package/dist/components/Icons/GoToLastIcon.d.ts.map +1 -1
- package/dist/components/Icons/HarmonicCursorsIcon.d.ts.map +1 -1
- package/dist/components/Icons/IconBase.d.ts.map +1 -1
- package/dist/components/Icons/InfoIcon.d.ts.map +1 -1
- package/dist/components/Icons/LabelIcon.d.ts.map +1 -1
- package/dist/components/Icons/LassoIcon.d.ts.map +1 -1
- package/dist/components/Icons/LineToolIcon.d.ts.map +1 -1
- package/dist/components/Icons/LineToolIcon2.d.ts.map +1 -1
- package/dist/components/Icons/LiveViewIcon.d.ts.map +1 -1
- package/dist/components/Icons/LoaderIcon.d.ts.map +1 -1
- package/dist/components/Icons/LocationIcon.d.ts.map +1 -1
- package/dist/components/Icons/LogoutIcon.d.ts.map +1 -1
- package/dist/components/Icons/MessagesIcon.d.ts.map +1 -1
- package/dist/components/Icons/MetadataIcon.d.ts.map +1 -1
- package/dist/components/Icons/MinusIcon.d.ts.map +1 -1
- package/dist/components/Icons/OntologyIcon.d.ts.map +1 -1
- package/dist/components/Icons/PanelIconClose.d.ts.map +1 -1
- package/dist/components/Icons/PanelIconOpen.d.ts.map +1 -1
- package/dist/components/Icons/PlayIcon.d.ts.map +1 -1
- package/dist/components/Icons/PlusIcon.d.ts.map +1 -1
- package/dist/components/Icons/ResetIcon.d.ts.map +1 -1
- package/dist/components/Icons/ReviewedIcon.d.ts.map +1 -1
- package/dist/components/Icons/ScissorsIcon.d.ts.map +1 -1
- package/dist/components/Icons/SettingsIcon.d.ts.map +1 -1
- package/dist/components/Icons/SortAscendingIcon.d.ts.map +1 -1
- package/dist/components/Icons/SortDescendingIcon.d.ts.map +1 -1
- package/dist/components/Icons/StackIcon.d.ts.map +1 -1
- package/dist/components/Icons/StarIcon.d.ts.map +1 -1
- package/dist/components/Icons/TrashIcon.d.ts.map +1 -1
- package/dist/components/Icons/UndoIcon.d.ts.map +1 -1
- package/dist/components/Icons/UserIcon.d.ts.map +1 -1
- package/dist/components/Icons/WarningIcon.d.ts.map +1 -1
- package/dist/components/Icons/ZoomAllIcon.d.ts.map +1 -1
- package/dist/components/Icons/ZoomXIcon.d.ts.map +1 -1
- package/dist/components/Icons/ZoomYIcon.d.ts.map +1 -1
- package/dist/components/Input/Input.d.ts +22 -20
- package/dist/components/Input/Input.d.ts.map +1 -1
- package/dist/components/Input/InputUtils.d.ts.map +1 -1
- package/dist/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/components/InputOTP/InputOTP.d.ts.map +1 -1
- package/dist/components/Label/Label.d.ts.map +1 -1
- package/dist/components/MultiSelect/MultiSelectBase.d.ts +24 -24
- package/dist/components/MultiSelect/MultiSelectBase.d.ts.map +1 -1
- package/dist/components/MultiSelect/MutiSelect.d.ts +6 -6
- package/dist/components/MultiSelect/MutiSelect.d.ts.map +1 -1
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/RadioButtonGroup/RadioButtonGroup.d.ts +1 -1
- package/dist/components/RadioButtonGroup/RadioButtonGroup.d.ts.map +1 -1
- package/dist/components/RadioButtonGroup/RadioButtonGroupBase.d.ts +8 -8
- package/dist/components/RadioButtonGroup/RadioButtonGroupBase.d.ts.map +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +16 -16
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts +7 -6
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Separator/Separator.d.ts.map +1 -1
- package/dist/components/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Slider/SliderBase.d.ts.map +1 -1
- package/dist/components/Switch/Switch.d.ts +6 -6
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/SwitchBase.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +14 -14
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/TabsBase.d.ts +18 -18
- package/dist/components/Tabs/TabsBase.d.ts.map +1 -1
- package/dist/components/Tabs/tabsStoryData.d.ts.map +1 -1
- package/dist/components/Tabs/tabsUtils.d.ts +17 -17
- package/dist/components/Tabs/tabsUtils.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts +9 -8
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea/TextareaUtils.d.ts +1 -1
- package/dist/components/Textarea/TextareaUtils.d.ts.map +1 -1
- package/dist/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/Toggle/ToggleBase.d.ts +4 -4
- package/dist/components/Toggle/ToggleBase.d.ts.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.d.ts.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroupBase.d.ts +8 -8
- package/dist/components/ToggleGroup/ToggleGroupBase.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/TooltipBase.d.ts +1 -1
- package/dist/components/Tooltip/TooltipBase.d.ts.map +1 -1
- package/dist/components/Tray/Tray.d.ts +6 -2
- package/dist/components/Tray/Tray.d.ts.map +1 -1
- package/dist/components/Tray/TrayStoriesData.d.ts +1 -1
- package/dist/components/Tray/TrayStoriesData.d.ts.map +1 -1
- package/dist/features/AuthCard/AuthCard.d.ts.map +1 -1
- package/dist/features/AuthCard/AuthToggle.d.ts.map +1 -1
- package/dist/features/AuthCard/AuthToggle.js +4 -20
- package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts +1 -1
- package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts.map +1 -1
- package/dist/features/AuthCard/ForgotPasswordEmailForm.js +5 -21
- package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts +1 -1
- package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts.map +1 -1
- package/dist/features/AuthCard/ForgotPasswordResetForm.js +5 -50
- package/dist/features/AuthCard/OTPInput.d.ts +1 -1
- package/dist/features/AuthCard/OTPInput.d.ts.map +1 -1
- package/dist/features/AuthCard/OTPInput.js +3 -21
- package/dist/features/AuthCard/PasswordInput.d.ts +1 -1
- package/dist/features/AuthCard/PasswordInput.d.ts.map +1 -1
- package/dist/features/AuthCard/PasswordInput.js +9 -50
- package/dist/features/AuthCard/SignInForm.d.ts.map +1 -1
- package/dist/features/AuthCard/SignInForm.js +7 -51
- package/dist/features/AuthCard/SignUpForm.d.ts.map +1 -1
- package/dist/features/AuthCard/SignUpForm.js +10 -55
- package/dist/features/AuthCard.js +144 -248
- package/dist/features/ClearDialog/ClearDialog.d.ts.map +1 -1
- package/dist/features/ClearDialog.js +10 -10
- package/dist/features/LabelingTools/LabelingTools.d.ts.map +1 -1
- package/dist/features/LabelingTools.js +21 -56
- package/dist/features/SensorMetadata/SensorMetadata.d.ts.map +1 -1
- package/dist/features/SensorMetadata.js +20 -20
- package/dist/features/SettingsPopover/SettingsPopover.d.ts.map +1 -1
- package/dist/features/SettingsPopover.js +14 -14
- package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
- package/dist/hooks/useControllableState.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/primitives/button.d.ts.map +1 -1
- package/dist/primitives/input.d.ts.map +1 -1
- package/dist/primitives/input.js +4 -1
- package/dist/primitives/select.d.ts +1 -1
- package/dist/primitives/select.d.ts.map +1 -1
- package/dist/primitives/select.js +7 -55
- package/dist/primitives/slot.d.ts.map +1 -1
- package/dist/primitives/slot.js +1 -4
- package/dist/primitives/textarea.d.ts.map +1 -1
- package/dist/primitives/textarea.js +3 -1
- package/dist/styles/main.css +1 -1
- package/dist/utils/formFieldUtils.d.ts +4 -2
- package/dist/utils/formFieldUtils.d.ts.map +1 -1
- package/dist/utils/formFieldUtils.js +3 -34
- package/dist/utils/refs.d.ts.map +1 -1
- package/package.json +23 -16
package/dist/Switch.js
CHANGED
|
@@ -5,55 +5,40 @@ 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 c } from "./utils/twUtils.js";
|
|
7
7
|
import { forwardRef as x } from "react";
|
|
8
|
-
const v = x(
|
|
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
|
-
children: /* @__PURE__ */ t(
|
|
43
|
-
k,
|
|
44
|
-
{
|
|
45
|
-
className: c(
|
|
46
|
-
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"
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
i === "right" && !a && /* @__PURE__ */ t(r, { htmlFor: e, id: `${e}-label`, className: "ml-2", "data-testid": "switch-label-right", children: s }),
|
|
53
|
-
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", children: s })
|
|
54
|
-
] });
|
|
55
|
-
}
|
|
56
|
-
);
|
|
8
|
+
const v = x(({ className: o, disabled: d, id: e, labelPosition: i = "right", labelText: s, name: l, onChange: h, required: b, value: m, hideLabel: a = !1, variant: u, ...f }, g) => {
|
|
9
|
+
const n = u === "squared";
|
|
10
|
+
return /* @__PURE__ */ w("div", { className: "flex items-center", "data-testid": "switch-container", children: [
|
|
11
|
+
i === "left" && !a && /* @__PURE__ */ t(r, { htmlFor: e, className: "mr-2", "data-testid": "switch-label-left", children: s }),
|
|
12
|
+
/* @__PURE__ */ t(
|
|
13
|
+
p,
|
|
14
|
+
{
|
|
15
|
+
"data-testid": "switch-root",
|
|
16
|
+
className: c(
|
|
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
|
+
o
|
|
19
|
+
),
|
|
20
|
+
disabled: d,
|
|
21
|
+
id: e,
|
|
22
|
+
name: l,
|
|
23
|
+
onCheckedChange: h,
|
|
24
|
+
value: m,
|
|
25
|
+
required: b,
|
|
26
|
+
...f,
|
|
27
|
+
ref: g,
|
|
28
|
+
children: /* @__PURE__ */ t(
|
|
29
|
+
k,
|
|
30
|
+
{
|
|
31
|
+
className: c(
|
|
32
|
+
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"
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
i === "right" && !a && /* @__PURE__ */ t(r, { htmlFor: e, id: `${e}-label`, className: "ml-2", "data-testid": "switch-label-right", children: s }),
|
|
39
|
+
a && /* @__PURE__ */ t(r, { htmlFor: e, className: "sr-only", children: s })
|
|
40
|
+
] });
|
|
41
|
+
});
|
|
57
42
|
v.displayName = "Switch";
|
|
58
43
|
export {
|
|
59
44
|
v as Switch
|
package/dist/Tabs/TabsBase.d.ts
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
export interface TabsContextValue {
|
|
3
3
|
onValueChange: (value: string) => void;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
activationMode: 'automatic' | 'manual';
|
|
5
|
+
baseId: string;
|
|
6
|
+
dir: 'ltr' | 'rtl';
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
orientation: 'horizontal' | 'vertical';
|
|
9
|
+
value: string;
|
|
10
10
|
}
|
|
11
11
|
export declare const TabsContext: import('react').Context<TabsContextValue | null>;
|
|
12
12
|
export declare const useTabsContext: (componentName?: string) => TabsContextValue;
|
|
13
13
|
export interface TabsBaseProps extends Omit<ComponentPropsWithoutRef<'div'>, 'dir' | 'defaultValue'> {
|
|
14
14
|
onValueChange?: (value: string) => void;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
activationMode?: 'automatic' | 'manual';
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
dir?: 'ltr' | 'rtl';
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
orientation?: 'horizontal' | 'vertical';
|
|
21
|
+
value?: string;
|
|
22
22
|
}
|
|
23
23
|
export declare const TabsBase: import('react').ForwardRefExoticComponent<TabsBaseProps & import('react').RefAttributes<HTMLElement>>;
|
|
24
24
|
export interface TabsListProps extends ComponentPropsWithoutRef<'div'> {
|
|
25
|
-
|
|
25
|
+
loop?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export declare const TabsList: import('react').ForwardRefExoticComponent<TabsListProps & import('react').RefAttributes<HTMLElement>>;
|
|
28
28
|
export interface TabsTriggerProps extends ComponentPropsWithoutRef<'button'> {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
value: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
31
|
}
|
|
32
32
|
export declare const TabsTrigger: import('react').ForwardRefExoticComponent<TabsTriggerProps & import('react').RefAttributes<HTMLElement>>;
|
|
33
33
|
export interface TabsContentProps extends ComponentPropsWithoutRef<'div'> {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
value: string;
|
|
35
|
+
forceMount?: boolean;
|
|
36
36
|
}
|
|
37
37
|
export declare const TabsContent: import('react').ForwardRefExoticComponent<TabsContentProps & import('react').RefAttributes<HTMLElement>>;
|
|
38
38
|
//# sourceMappingURL=TabsBase.d.ts.map
|
package/dist/Tabs/TabsBase.js
CHANGED
|
@@ -9,17 +9,7 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
9
9
|
if (u === null)
|
|
10
10
|
throw new Error(`${I} components must be used within a Tabs.Root`);
|
|
11
11
|
return u;
|
|
12
|
-
}, B = z(function({
|
|
13
|
-
activationMode: u = "automatic",
|
|
14
|
-
children: e,
|
|
15
|
-
defaultValue: h,
|
|
16
|
-
dir: b = "ltr",
|
|
17
|
-
disabled: l = !1,
|
|
18
|
-
onValueChange: f,
|
|
19
|
-
orientation: o = "horizontal",
|
|
20
|
-
value: v,
|
|
21
|
-
...s
|
|
22
|
-
}, c) {
|
|
12
|
+
}, B = z(function({ activationMode: u = "automatic", children: e, defaultValue: h, dir: b = "ltr", disabled: l = !1, onValueChange: f, orientation: o = "horizontal", value: v, ...s }, c) {
|
|
23
13
|
const [m, g] = D(h ?? ""), d = N() ?? $("tabs"), r = v !== void 0, t = r ? v : m, n = p(
|
|
24
14
|
(w) => {
|
|
25
15
|
l || (r || g(w), f?.(w));
|
|
@@ -34,17 +24,7 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
34
24
|
disabled: l,
|
|
35
25
|
baseId: d
|
|
36
26
|
};
|
|
37
|
-
return /* @__PURE__ */ x(E.Provider, { value: a, children: /* @__PURE__ */ x(
|
|
38
|
-
"div",
|
|
39
|
-
{
|
|
40
|
-
ref: c,
|
|
41
|
-
"data-orientation": o,
|
|
42
|
-
"data-disabled": l ? "" : void 0,
|
|
43
|
-
dir: b,
|
|
44
|
-
...s,
|
|
45
|
-
children: e
|
|
46
|
-
}
|
|
47
|
-
) });
|
|
27
|
+
return /* @__PURE__ */ x(E.Provider, { value: a, children: /* @__PURE__ */ x("div", { ref: c, "data-orientation": o, "data-disabled": l ? "" : void 0, dir: b, ...s, children: e }) });
|
|
48
28
|
}), H = z(function({ className: u, loop: e = !0, ...h }, b) {
|
|
49
29
|
const { orientation: l, disabled: f } = C("TabsList"), [o, v] = D(() => ({
|
|
50
30
|
left: 0,
|
|
@@ -75,11 +55,7 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
75
55
|
const g = p(
|
|
76
56
|
(d) => {
|
|
77
57
|
if (f) return;
|
|
78
|
-
const r = Array.from(
|
|
79
|
-
s.current?.querySelectorAll(
|
|
80
|
-
"[role='tab']:not([disabled]):not([aria-disabled='true'])"
|
|
81
|
-
) ?? []
|
|
82
|
-
);
|
|
58
|
+
const r = Array.from(s.current?.querySelectorAll("[role='tab']:not([disabled]):not([aria-disabled='true'])") ?? []);
|
|
83
59
|
if (r.length === 0) return;
|
|
84
60
|
const t = r.findIndex((T) => T === document.activeElement);
|
|
85
61
|
if (t === -1) return;
|
|
@@ -90,41 +66,22 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
90
66
|
[f, l, e]
|
|
91
67
|
);
|
|
92
68
|
return /* @__PURE__ */ R("div", { className: "relative", ref: s, children: [
|
|
93
|
-
/* @__PURE__ */ x(
|
|
94
|
-
"div",
|
|
95
|
-
{
|
|
96
|
-
ref: b,
|
|
97
|
-
role: "tablist",
|
|
98
|
-
"aria-orientation": l,
|
|
99
|
-
"aria-disabled": f,
|
|
100
|
-
className: y("tabs-list", u),
|
|
101
|
-
onKeyDown: g,
|
|
102
|
-
...h
|
|
103
|
-
}
|
|
104
|
-
),
|
|
69
|
+
/* @__PURE__ */ x("div", { ref: b, role: "tablist", "aria-orientation": l, "aria-disabled": f, className: y("tabs-list", u), onKeyDown: g, ...h }),
|
|
105
70
|
/* @__PURE__ */ x(
|
|
106
71
|
"div",
|
|
107
72
|
{
|
|
108
73
|
className: y(
|
|
109
|
-
"pointer-events-none
|
|
74
|
+
"absolute pointer-events-none select-none",
|
|
110
75
|
!c && "transition-all duration-300 ease-out",
|
|
111
|
-
o.orientation === "horizontal" && !o.isEnclosed && [
|
|
112
|
-
"bottom-[1px] after:absolute after:bottom-0 after:left-0 after:w-full after:content-['']",
|
|
113
|
-
"after:border-tabs-indicator z-10 after:rounded-t-[0.3rem] after:border-b-[0.3rem]"
|
|
114
|
-
],
|
|
76
|
+
o.orientation === "horizontal" && !o.isEnclosed && ["bottom-[1px] after:content-[''] after:absolute after:bottom-0 after:left-0 after:w-full", "after:border-b-[0.3rem] after:border-tabs-indicator after:rounded-t-[0.3rem] z-10"],
|
|
115
77
|
o.orientation === "vertical" && !o.isEnclosed && [
|
|
116
78
|
"right-[1px]",
|
|
117
79
|
!c && "transition-[top_300ms_ease,height_300ms_ease]",
|
|
118
|
-
"after:absolute after:
|
|
119
|
-
"after:border-tabs-indicator
|
|
120
|
-
],
|
|
121
|
-
o.orientation === "horizontal" && o.isEnclosed && [
|
|
122
|
-
"bg-tabs-enclosed-indicator top-[10%] bottom-[10%] z-0 rounded-lg shadow-lg",
|
|
123
|
-
!c && "transition-[left_300ms_ease,width_300ms_ease]"
|
|
80
|
+
"after:content-[''] after:absolute after:right-0 after:top-0 after:h-full after:w-1",
|
|
81
|
+
"after:border-r-[0.3rem] after:border-tabs-indicator after:rounded-l-[0.3rem] z-10"
|
|
124
82
|
],
|
|
125
|
-
o.orientation === "
|
|
126
|
-
|
|
127
|
-
]
|
|
83
|
+
o.orientation === "horizontal" && o.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg top-[10%] bottom-[10%] z-0", !c && "transition-[left_300ms_ease,width_300ms_ease]"],
|
|
84
|
+
o.orientation === "vertical" && o.isEnclosed && ["bg-tabs-enclosed-indicator rounded-lg shadow-lg left-1 right-1 z-0 max-h-10 w-auto"]
|
|
128
85
|
),
|
|
129
86
|
style: {
|
|
130
87
|
...S(o),
|
|
@@ -171,10 +128,7 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
171
128
|
"data-state": t ? "active" : "inactive",
|
|
172
129
|
"data-disabled": n ? "" : void 0,
|
|
173
130
|
tabIndex: t ? 0 : -1,
|
|
174
|
-
className: y(
|
|
175
|
-
"tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600",
|
|
176
|
-
u
|
|
177
|
-
),
|
|
131
|
+
className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", u),
|
|
178
132
|
onClick: a,
|
|
179
133
|
onKeyDown: w,
|
|
180
134
|
onFocus: A,
|
|
@@ -183,20 +137,7 @@ const E = M(null), C = (I = "Tabs") => {
|
|
|
183
137
|
);
|
|
184
138
|
}), J = z(function({ className: u, value: e, forceMount: h = !1, ...b }, l) {
|
|
185
139
|
const { value: f, baseId: o } = C("TabsContent"), v = `${o}-content-${e}`, s = `${o}-trigger-${e}`, c = f === e;
|
|
186
|
-
return !h && !c ? null : /* @__PURE__ */ x(
|
|
187
|
-
"div",
|
|
188
|
-
{
|
|
189
|
-
ref: l,
|
|
190
|
-
role: "tabpanel",
|
|
191
|
-
id: v,
|
|
192
|
-
"aria-labelledby": s,
|
|
193
|
-
"data-state": c ? "active" : "inactive",
|
|
194
|
-
tabIndex: 0,
|
|
195
|
-
className: y("tabs-content focus:outline-none focus-visible:outline-none", u),
|
|
196
|
-
hidden: !c,
|
|
197
|
-
...b
|
|
198
|
-
}
|
|
199
|
-
);
|
|
140
|
+
return !h && !c ? null : /* @__PURE__ */ x("div", { ref: l, role: "tabpanel", id: v, "aria-labelledby": s, "data-state": c ? "active" : "inactive", tabIndex: 0, className: y("tabs-content focus:outline-none focus-visible:outline-none", u), hidden: !c, ...b });
|
|
200
141
|
});
|
|
201
142
|
export {
|
|
202
143
|
B as TabsBase,
|
|
@@ -53,7 +53,7 @@ const t = [
|
|
|
53
53
|
children: /* @__PURE__ */ i(l, { children: [
|
|
54
54
|
/* @__PURE__ */ e("p", { className: "mb-[1.2rem]", children: "Choose your gift options at Checkout. Some items may not be eligible for all gift options" }),
|
|
55
55
|
/* @__PURE__ */ i("div", { className: "flex gap-[0.4rem]", children: [
|
|
56
|
-
/* @__PURE__ */ i("div", { className: "flex
|
|
56
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-[0.4rem] w-[32rem]", children: [
|
|
57
57
|
/* @__PURE__ */ e("p", { className: "font-semibold", children: "Free Pickup" }),
|
|
58
58
|
/* @__PURE__ */ i("ul", { className: "sb-unstyled", children: [
|
|
59
59
|
/* @__PURE__ */ e("li", { children: "Printed gift message (free)" }),
|
|
@@ -130,7 +130,7 @@ const t = [
|
|
|
130
130
|
children: /* @__PURE__ */ i(l, { children: [
|
|
131
131
|
/* @__PURE__ */ e("p", { className: "mb-[1.2rem]", children: "Choose your gift options at Checkout. Some items may not be eligible for all gift options" }),
|
|
132
132
|
/* @__PURE__ */ i("div", { className: "flex gap-[0.4rem]", children: [
|
|
133
|
-
/* @__PURE__ */ i("div", { className: "flex
|
|
133
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-[0.4rem] w-[32rem]", children: [
|
|
134
134
|
/* @__PURE__ */ e("p", { className: "font-semibold", children: "Free Pickup" }),
|
|
135
135
|
/* @__PURE__ */ i("ul", { className: "sb-unstyled", children: [
|
|
136
136
|
/* @__PURE__ */ e("li", { children: "Printed gift message (free)" }),
|
package/dist/Tabs/tabsUtils.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
2
|
export interface IndicatorStyle {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
orientation: 'horizontal' | 'vertical';
|
|
8
|
+
isEnclosed: boolean;
|
|
9
9
|
}
|
|
10
10
|
export interface IndicatorPosition {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
left?: string;
|
|
12
|
+
top?: string;
|
|
13
|
+
width?: string;
|
|
14
|
+
height?: string;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Calculates the position and dimensions of the active tab indicator
|
|
@@ -24,7 +24,7 @@ export declare const getIndicatorPosition: (style: IndicatorStyle) => IndicatorP
|
|
|
24
24
|
/**
|
|
25
25
|
* Debounce utility for performance optimization with proper cleanup
|
|
26
26
|
*/
|
|
27
|
-
export declare const debounce: <TArgs extends
|
|
27
|
+
export declare const debounce: <TArgs extends unknown[]>(func: (...args: TArgs) => void, wait: number) => ((...args: TArgs) => void);
|
|
28
28
|
/**
|
|
29
29
|
* Checks if user prefers reduced motion (SSR safe)
|
|
30
30
|
*/
|
|
@@ -36,22 +36,22 @@ export declare const generateId: (prefix?: string) => string;
|
|
|
36
36
|
/**
|
|
37
37
|
* Validates tab values array for library usage with comprehensive type checking
|
|
38
38
|
*/
|
|
39
|
-
export declare const validateTabValues: (tabValues:
|
|
39
|
+
export declare const validateTabValues: (tabValues: {
|
|
40
40
|
key: string;
|
|
41
41
|
label: unknown;
|
|
42
42
|
children: unknown;
|
|
43
43
|
[K: string]: unknown;
|
|
44
|
-
}[];
|
|
44
|
+
}[]) => boolean;
|
|
45
45
|
/**
|
|
46
46
|
* Type-safe key extractor for tab values
|
|
47
47
|
*/
|
|
48
48
|
export declare const getTabKeys: <T extends {
|
|
49
|
-
|
|
50
|
-
}>(tabValues:
|
|
49
|
+
key: string;
|
|
50
|
+
}>(tabValues: T[]) => string[];
|
|
51
51
|
/**
|
|
52
52
|
* Finds a tab by key with proper type narrowing
|
|
53
53
|
*/
|
|
54
54
|
export declare const findTabByKey: <T extends {
|
|
55
|
-
|
|
56
|
-
}>(tabValues:
|
|
55
|
+
key: string;
|
|
56
|
+
}>(tabValues: T[], key: string) => T | undefined;
|
|
57
57
|
//# sourceMappingURL=tabsUtils.d.ts.map
|
package/dist/Tabs.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { TabsBase, TabsContent, TabsList, TabsTrigger, TabsBaseProps } from './TabsBase';
|
|
2
2
|
import { ReactEventHandler, ReactNode } from 'react';
|
|
3
3
|
export interface TabValue {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
key: string | undefined;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
'aria-label'?: string | undefined;
|
|
9
|
+
'aria-describedby'?: string | undefined;
|
|
10
10
|
}
|
|
11
11
|
export interface TabsProps extends Omit<TabsBaseProps, 'children' | 'defaultValue' | 'onError' | 'disabled'> {
|
|
12
12
|
onBeforeChange?: (newValue: string, oldValue: string) => boolean | Promise<boolean> | undefined;
|
|
13
13
|
onError?: (error: Error) => void | ReactEventHandler<HTMLDivElement> | undefined;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
ariaLabel?: string | undefined;
|
|
15
|
+
className?: string | undefined;
|
|
16
|
+
openOnLoad?: string | undefined;
|
|
17
|
+
tabValues: TabValue[] | undefined;
|
|
18
|
+
variant?: 'enclosed' | 'default';
|
|
19
|
+
loading?: boolean | undefined;
|
|
20
20
|
}
|
|
21
21
|
export declare const Tabs: ({ ariaLabel, className, openOnLoad, orientation, tabValues, variant, activationMode, loading, onError, onBeforeChange, onValueChange, ...props }: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
export { TabsContent, TabsList, TabsBase as TabsRoot, TabsTrigger };
|
|
23
23
|
export type { TabsBaseProps, TabsContentProps, TabsListProps, TabsTriggerProps } from './TabsBase';
|
|
24
|
-
export type TabKeys<T extends
|
|
24
|
+
export type TabKeys<T extends TabValue[]> = T[number]['key'];
|
|
25
25
|
export type TabValueWithKey<TKey extends string> = TabValue & {
|
|
26
|
-
|
|
26
|
+
key: TKey;
|
|
27
27
|
};
|
|
28
28
|
//# sourceMappingURL=Tabs.d.ts.map
|
package/dist/Tabs.js
CHANGED
|
@@ -1,157 +1,94 @@
|
|
|
1
1
|
import "./styles/main.css";
|
|
2
|
-
import { jsxs as f, jsx as
|
|
3
|
-
import { TabsBase as
|
|
4
|
-
import { validateTabValues as
|
|
5
|
-
import { cn as
|
|
2
|
+
import { jsxs as f, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { TabsBase as N, TabsList as T, TabsTrigger as z, TabsContent as k } from "./Tabs/TabsBase.js";
|
|
4
|
+
import { validateTabValues as E, getTabKeys as V } from "./Tabs/tabsUtils.js";
|
|
5
|
+
import { cn as r } from "./utils/twUtils.js";
|
|
6
6
|
import "react";
|
|
7
|
-
const j = ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
className: a(
|
|
15
|
-
"inline-flex w-full items-center justify-start",
|
|
16
|
-
s === "horizontal" && "border-b border-neutral-600",
|
|
17
|
-
s === "vertical" && "flex-col items-stretch border-r border-neutral-600"
|
|
18
|
-
),
|
|
19
|
-
children: Array.from({ length: Math.min(n, 5) }, (i, t) => /* @__PURE__ */ l(
|
|
20
|
-
"div",
|
|
21
|
-
{
|
|
22
|
-
className: a(
|
|
23
|
-
"animate-pulse rounded bg-neutral-600",
|
|
24
|
-
s === "horizontal" ? "mx-2 my-2 h-6 w-16" : "mx-2 my-1 h-6 w-full"
|
|
25
|
-
),
|
|
26
|
-
"aria-hidden": "true"
|
|
27
|
-
},
|
|
28
|
-
t
|
|
29
|
-
))
|
|
30
|
-
}
|
|
31
|
-
),
|
|
32
|
-
/* @__PURE__ */ l("div", { className: "mt-4 h-32 w-full animate-pulse rounded bg-neutral-600", "aria-hidden": "true" }),
|
|
33
|
-
/* @__PURE__ */ l("span", { className: "sr-only", children: "Loading tabs…" })
|
|
34
|
-
] }), U = ({
|
|
35
|
-
ariaLabel: n,
|
|
36
|
-
className: s,
|
|
37
|
-
openOnLoad: i,
|
|
38
|
-
orientation: t = "horizontal",
|
|
39
|
-
tabValues: o = [],
|
|
40
|
-
variant: r = "default",
|
|
41
|
-
activationMode: v = "automatic",
|
|
42
|
-
loading: m = !1,
|
|
43
|
-
onError: d,
|
|
44
|
-
onBeforeChange: h,
|
|
45
|
-
onValueChange: x,
|
|
46
|
-
...p
|
|
47
|
-
}) => {
|
|
48
|
-
if (!k(o)) {
|
|
7
|
+
const j = ({ tabCount: d, orientation: s }) => /* @__PURE__ */ f("div", { className: "flex flex-col relative w-full", role: "status", children: [
|
|
8
|
+
/* @__PURE__ */ a("div", { className: r("inline-flex items-center justify-start w-full", s === "horizontal" && "border-b border-neutral-600", s === "vertical" && "flex-col items-stretch border-r border-neutral-600"), children: Array.from({ length: Math.min(d, 5) }, (i, t) => /* @__PURE__ */ a("div", { className: r("animate-pulse bg-neutral-600 rounded", s === "horizontal" ? "h-6 w-16 mx-2 my-2" : "h-6 w-full mx-2 my-1"), "aria-hidden": "true" }, t)) }),
|
|
9
|
+
/* @__PURE__ */ a("div", { className: "animate-pulse bg-neutral-600 h-32 w-full mt-4 rounded", "aria-hidden": "true" }),
|
|
10
|
+
/* @__PURE__ */ a("span", { className: "sr-only", children: "Loading tabs…" })
|
|
11
|
+
] }), A = ({ ariaLabel: d, className: s, openOnLoad: i, orientation: t = "horizontal", tabValues: h = [], variant: l = "default", activationMode: m = "automatic", loading: p = !1, onError: n, onBeforeChange: v, onValueChange: x, ...y }) => {
|
|
12
|
+
const o = h.filter((e) => e.key !== void 0);
|
|
13
|
+
if (!E(o)) {
|
|
49
14
|
const e = new Error("Invalid tabValues provided to Tabs component");
|
|
50
|
-
return
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
process.env.NODE_ENV !== "production" && /* @__PURE__ */
|
|
15
|
+
return n?.(e), /* @__PURE__ */ f("div", { className: "flex flex-col relative w-full p-4 text-center text-gray-500", role: "alert", "aria-live": "polite", children: [
|
|
16
|
+
/* @__PURE__ */ a("p", { children: "No valid tabs provided" }),
|
|
17
|
+
process.env.NODE_ENV !== "production" && /* @__PURE__ */ a("p", { className: "text-xs mt-2 text-gray-400", children: "Check console for detailed validation errors" })
|
|
53
18
|
] });
|
|
54
19
|
}
|
|
55
|
-
if (
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
const u =
|
|
20
|
+
if (p)
|
|
21
|
+
return /* @__PURE__ */ a(j, { tabCount: h.length || 3, orientation: t });
|
|
22
|
+
const u = V(o);
|
|
58
23
|
let c = i ?? u[0];
|
|
59
24
|
if (i && !u.includes(i) && (process.env.NODE_ENV !== "production" && console.warn(`Tabs: openOnLoad value '${i}' not found in tabValues. Using first tab.`), c = u[0]), !c) {
|
|
60
25
|
const e = new Error("No valid default tab available");
|
|
61
|
-
return
|
|
62
|
-
"div",
|
|
63
|
-
{
|
|
64
|
-
className: "text-text-secondary relative flex w-full flex-col p-4 text-center",
|
|
65
|
-
role: "alert",
|
|
66
|
-
"aria-live": "polite",
|
|
67
|
-
children: /* @__PURE__ */ l("p", { children: "Unable to render tabs" })
|
|
68
|
-
}
|
|
69
|
-
);
|
|
26
|
+
return n?.(e), /* @__PURE__ */ a("div", { className: "flex flex-col relative w-full p-4 text-center text-text-secondary", role: "alert", "aria-live": "polite", children: /* @__PURE__ */ a("p", { children: "Unable to render tabs" }) });
|
|
70
27
|
}
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
28
|
+
const g = async (e) => {
|
|
29
|
+
if (v && x) {
|
|
30
|
+
const w = c;
|
|
74
31
|
try {
|
|
75
|
-
if (await
|
|
32
|
+
if (await v(e, w) === !1) return;
|
|
76
33
|
} catch (b) {
|
|
77
|
-
|
|
34
|
+
n?.(b instanceof Error ? b : new Error("Before change callback failed"));
|
|
78
35
|
return;
|
|
79
36
|
}
|
|
80
37
|
}
|
|
81
38
|
x?.(e);
|
|
82
39
|
};
|
|
83
|
-
return /* @__PURE__ */
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
children: [
|
|
94
|
-
/* @__PURE__ */ l(
|
|
95
|
-
N,
|
|
96
|
-
{
|
|
97
|
-
className: a(
|
|
98
|
-
"inline-flex w-full items-center justify-start",
|
|
99
|
-
t === "horizontal" && r === "default" && ["border-tabs-border border-b"],
|
|
100
|
-
t === "vertical" && r === "default" && [
|
|
101
|
-
"border-tabs-border relative m-0 h-auto w-auto flex-col items-stretch border-r py-1"
|
|
102
|
-
],
|
|
103
|
-
t === "horizontal" && r === "enclosed" && ["bg-tabs-group-bg relative rounded-lg border-0 p-1"],
|
|
104
|
-
t === "vertical" && r === "enclosed" && ["bg-tabs-group-bg w-auto flex-col rounded-lg border-0 p-1"]
|
|
105
|
-
),
|
|
106
|
-
children: o.filter((e) => e.key !== null).map((e) => /* @__PURE__ */ l(
|
|
107
|
-
T,
|
|
108
|
-
{
|
|
109
|
-
value: e.key,
|
|
110
|
-
disabled: e.disabled,
|
|
111
|
-
"aria-label": e["aria-label"],
|
|
112
|
-
"aria-describedby": e["aria-describedby"],
|
|
113
|
-
className: a(
|
|
114
|
-
"relative font-semibold whitespace-nowrap transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none",
|
|
115
|
-
t === "horizontal" && r === "default" && ["text-text-primary hover:text-accent hover:bg-tabs-bg--hover px-4 py-2"],
|
|
116
|
-
t === "vertical" && r === "default" && [
|
|
117
|
-
"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"
|
|
118
|
-
],
|
|
119
|
-
t === "horizontal" && r === "enclosed" && [
|
|
120
|
-
"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"
|
|
121
|
-
],
|
|
122
|
-
t === "vertical" && r === "enclosed" && [
|
|
123
|
-
"text-text-primary data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover z-[1] px-4 py-2"
|
|
124
|
-
],
|
|
125
|
-
"disabled:hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent"
|
|
126
|
-
),
|
|
127
|
-
children: e.label
|
|
128
|
-
},
|
|
129
|
-
e.key
|
|
130
|
-
))
|
|
131
|
-
}
|
|
40
|
+
return /* @__PURE__ */ a("div", { className: "flex flex-col relative w-full", children: /* @__PURE__ */ f(N, { "aria-label": d, className: r("relative w-full data-[orientation=vertical]:flex", l, s), defaultValue: c, orientation: t, activationMode: m, onValueChange: g, ...y, children: [
|
|
41
|
+
/* @__PURE__ */ a(
|
|
42
|
+
T,
|
|
43
|
+
{
|
|
44
|
+
className: r(
|
|
45
|
+
"inline-flex items-center justify-start w-full",
|
|
46
|
+
t === "horizontal" && l === "default" && ["border-b border-tabs-border"],
|
|
47
|
+
t === "vertical" && l === "default" && ["flex-col items-stretch border-r border-tabs-border h-auto m-0 py-1 w-auto relative"],
|
|
48
|
+
t === "horizontal" && l === "enclosed" && ["bg-tabs-group-bg border-0 rounded-lg p-1 relative"],
|
|
49
|
+
t === "vertical" && l === "enclosed" && ["bg-tabs-group-bg rounded-lg border-0 p-1 w-auto flex-col"]
|
|
132
50
|
),
|
|
133
|
-
o.
|
|
51
|
+
children: o.map((e) => /* @__PURE__ */ a(
|
|
134
52
|
z,
|
|
135
53
|
{
|
|
136
54
|
value: e.key,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"
|
|
55
|
+
disabled: e.disabled,
|
|
56
|
+
"aria-label": e["aria-label"],
|
|
57
|
+
"aria-describedby": e["aria-describedby"],
|
|
58
|
+
className: r(
|
|
59
|
+
"relative whitespace-nowrap font-semibold transition-all duration-500 ease-in-out focus:outline-none focus-visible:outline-none",
|
|
60
|
+
t === "horizontal" && l === "default" && ["text-text-primary hover:text-accent py-2 px-4 hover:bg-tabs-bg--hover"],
|
|
61
|
+
t === "vertical" && l === "default" && ["text-text-primary flex items-center h-10 px-4 py-2 data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover"],
|
|
62
|
+
t === "horizontal" && l === "enclosed" && ["text-text-primary inline-flex items-center justify-center px-4 py-2 data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover z-[1]"],
|
|
63
|
+
t === "vertical" && l === "enclosed" && ["text-text-primary px-4 py-2 z-[1] data-[state=active]:text-accent hover:text-accent hover:bg-tabs-bg--hover"],
|
|
64
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:text-text-primary disabled:hover:bg-transparent"
|
|
142
65
|
),
|
|
143
|
-
children: e.
|
|
66
|
+
children: e.label
|
|
144
67
|
},
|
|
145
68
|
e.key
|
|
146
69
|
))
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
o.map((e) => /* @__PURE__ */ a(
|
|
73
|
+
k,
|
|
74
|
+
{
|
|
75
|
+
value: e.key,
|
|
76
|
+
className: r(
|
|
77
|
+
"focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent text-text-primary",
|
|
78
|
+
t === "horizontal" && "py-6 px-4",
|
|
79
|
+
t === "vertical" && "py-0 ps-8",
|
|
80
|
+
"data-[state=active]:animate-fade-in-tabs"
|
|
81
|
+
),
|
|
82
|
+
children: e.children
|
|
83
|
+
},
|
|
84
|
+
e.key
|
|
85
|
+
))
|
|
86
|
+
] }) });
|
|
150
87
|
};
|
|
151
88
|
export {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
89
|
+
A as Tabs,
|
|
90
|
+
k as TabsContent,
|
|
91
|
+
T as TabsList,
|
|
92
|
+
N as TabsRoot,
|
|
93
|
+
z as TabsTrigger
|
|
157
94
|
};
|