@fanvue/ui 0.1.0-alpha.2 → 1.0.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 +1 -1
- package/dist/cjs/components/Alert/Alert.cjs +72 -0
- package/dist/cjs/components/Alert/Alert.cjs.map +1 -0
- package/dist/cjs/components/Avatar/Avatar.cjs +162 -0
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -0
- package/dist/cjs/components/Badge/Badge.cjs +99 -0
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -0
- package/dist/cjs/components/Button/Button.cjs +172 -0
- package/dist/cjs/components/Button/Button.cjs.map +1 -0
- package/dist/cjs/components/Checkbox/Checkbox.cjs +157 -0
- package/dist/cjs/components/Checkbox/Checkbox.cjs.map +1 -0
- package/dist/cjs/components/Chip/Chip.cjs +92 -0
- package/dist/cjs/components/Chip/Chip.cjs.map +1 -0
- package/dist/cjs/components/Count/Count.cjs +56 -0
- package/dist/cjs/components/Count/Count.cjs.map +1 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs +133 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -0
- package/dist/cjs/components/Divider/Divider.cjs +69 -0
- package/dist/cjs/components/Divider/Divider.cjs.map +1 -0
- package/dist/cjs/components/IconButton/IconButton.cjs +92 -0
- package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -0
- package/dist/cjs/components/Icons/ArrowRightIcon.cjs +47 -0
- package/dist/cjs/components/Icons/ArrowRightIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/ArrowUpRightIcon.cjs +47 -0
- package/dist/cjs/components/Icons/ArrowUpRightIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/CheckCircleIcon.cjs +47 -0
- package/dist/cjs/components/Icons/CheckCircleIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/CheckIcon.cjs +49 -0
- package/dist/cjs/components/Icons/CheckIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/ChevronLeftIcon.cjs +49 -0
- package/dist/cjs/components/Icons/ChevronLeftIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/ChevronRightIcon.cjs +49 -0
- package/dist/cjs/components/Icons/ChevronRightIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/CloseIcon.cjs +46 -0
- package/dist/cjs/components/Icons/CloseIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/CrossIcon.cjs +40 -0
- package/dist/cjs/components/Icons/CrossIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/CrownIcon.cjs +40 -0
- package/dist/cjs/components/Icons/CrownIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/ErrorCircleIcon.cjs +47 -0
- package/dist/cjs/components/Icons/ErrorCircleIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/ErrorIcon.cjs +30 -0
- package/dist/cjs/components/Icons/ErrorIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/FireIcon.cjs +47 -0
- package/dist/cjs/components/Icons/FireIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/HomeIcon.cjs +40 -0
- package/dist/cjs/components/Icons/HomeIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/InfoCircleIcon.cjs +47 -0
- package/dist/cjs/components/Icons/InfoCircleIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/InfoIcon.cjs +30 -0
- package/dist/cjs/components/Icons/InfoIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/MicrophoneIcon.cjs +31 -0
- package/dist/cjs/components/Icons/MicrophoneIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/MinusIcon.cjs +40 -0
- package/dist/cjs/components/Icons/MinusIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/PlusIcon.cjs +40 -0
- package/dist/cjs/components/Icons/PlusIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/SpinnerIcon.cjs +43 -0
- package/dist/cjs/components/Icons/SpinnerIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/StopIcon.cjs +22 -0
- package/dist/cjs/components/Icons/StopIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/SuccessIcon.cjs +30 -0
- package/dist/cjs/components/Icons/SuccessIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/VipBadgeIcon.cjs +97 -0
- package/dist/cjs/components/Icons/VipBadgeIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/WarningIcon.cjs +30 -0
- package/dist/cjs/components/Icons/WarningIcon.cjs.map +1 -0
- package/dist/cjs/components/Icons/WarningTriangleIcon.cjs +47 -0
- package/dist/cjs/components/Icons/WarningTriangleIcon.cjs.map +1 -0
- package/dist/cjs/components/Logo/Logo.cjs +182 -0
- package/dist/cjs/components/Logo/Logo.cjs.map +1 -0
- package/dist/cjs/components/Pagination/Pagination.cjs +144 -0
- package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -0
- package/dist/cjs/components/Pill/Pill.cjs +69 -0
- package/dist/cjs/components/Pill/Pill.cjs.map +1 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs +112 -0
- package/dist/cjs/components/ProgressBar/ProgressBar.cjs.map +1 -0
- package/dist/cjs/components/Radio/Radio.cjs +74 -0
- package/dist/cjs/components/Radio/Radio.cjs.map +1 -0
- package/dist/cjs/components/RadioGroup/RadioGroup.cjs +30 -0
- package/dist/cjs/components/RadioGroup/RadioGroup.cjs.map +1 -0
- package/dist/cjs/components/Slider/Slider.cjs +96 -0
- package/dist/cjs/components/Slider/Slider.cjs.map +1 -0
- package/dist/cjs/components/Slider/SliderLayout.cjs +31 -0
- package/dist/cjs/components/Slider/SliderLayout.cjs.map +1 -0
- package/dist/cjs/components/Slider/SliderThumb.cjs +87 -0
- package/dist/cjs/components/Slider/SliderThumb.cjs.map +1 -0
- package/dist/cjs/components/Snackbar/Snackbar.cjs +215 -0
- package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -0
- package/dist/cjs/components/Switch/Switch.cjs +57 -0
- package/dist/cjs/components/Switch/Switch.cjs.map +1 -0
- package/dist/cjs/components/SwitchField/SwitchField.cjs +103 -0
- package/dist/cjs/components/SwitchField/SwitchField.cjs.map +1 -0
- package/dist/cjs/components/SwitchToggle/SwitchToggle.cjs +110 -0
- package/dist/cjs/components/SwitchToggle/SwitchToggle.cjs.map +1 -0
- package/dist/cjs/components/Tabs/Tabs.cjs +24 -0
- package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -0
- package/dist/cjs/components/Tabs/TabsContent.cjs +36 -0
- package/dist/cjs/components/Tabs/TabsContent.cjs.map +1 -0
- package/dist/cjs/components/Tabs/TabsList.cjs +42 -0
- package/dist/cjs/components/Tabs/TabsList.cjs.map +1 -0
- package/dist/cjs/components/Tabs/TabsTrigger.cjs +50 -0
- package/dist/cjs/components/Tabs/TabsTrigger.cjs.map +1 -0
- package/dist/cjs/components/Toast/Toast.cjs +128 -0
- package/dist/cjs/components/Toast/Toast.cjs.map +1 -0
- package/dist/cjs/index.cjs +111 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/utils/cn.cjs +10 -0
- package/dist/cjs/utils/cn.cjs.map +1 -0
- package/dist/components/Alert/Alert.mjs +55 -0
- package/dist/components/Alert/Alert.mjs.map +1 -0
- package/dist/components/Avatar/Avatar.mjs +144 -0
- package/dist/components/Avatar/Avatar.mjs.map +1 -0
- package/dist/components/Badge/Badge.mjs +82 -0
- package/dist/components/Badge/Badge.mjs.map +1 -0
- package/dist/components/Button/Button.mjs +155 -0
- package/dist/components/Button/Button.mjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.mjs +139 -0
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -0
- package/dist/components/Chip/Chip.mjs +75 -0
- package/dist/components/Chip/Chip.mjs.map +1 -0
- package/dist/components/Count/Count.mjs +39 -0
- package/dist/components/Count/Count.mjs.map +1 -0
- package/dist/components/DatePicker/DatePicker.mjs +133 -0
- package/dist/components/DatePicker/DatePicker.mjs.map +1 -0
- package/dist/components/Divider/Divider.mjs +51 -0
- package/dist/components/Divider/Divider.mjs.map +1 -0
- package/dist/components/IconButton/IconButton.mjs +75 -0
- package/dist/components/IconButton/IconButton.mjs.map +1 -0
- package/dist/components/Icons/ArrowRightIcon.mjs +30 -0
- package/dist/components/Icons/ArrowRightIcon.mjs.map +1 -0
- package/dist/components/Icons/ArrowUpRightIcon.mjs +30 -0
- package/dist/components/Icons/ArrowUpRightIcon.mjs.map +1 -0
- package/dist/components/Icons/CheckCircleIcon.mjs +30 -0
- package/dist/components/Icons/CheckCircleIcon.mjs.map +1 -0
- package/dist/components/Icons/CheckIcon.mjs +32 -0
- package/dist/components/Icons/CheckIcon.mjs.map +1 -0
- package/dist/components/Icons/ChevronLeftIcon.mjs +32 -0
- package/dist/components/Icons/ChevronLeftIcon.mjs.map +1 -0
- package/dist/components/Icons/ChevronRightIcon.mjs +32 -0
- package/dist/components/Icons/ChevronRightIcon.mjs.map +1 -0
- package/dist/components/Icons/CloseIcon.mjs +29 -0
- package/dist/components/Icons/CloseIcon.mjs.map +1 -0
- package/dist/components/Icons/CrossIcon.mjs +23 -0
- package/dist/components/Icons/CrossIcon.mjs.map +1 -0
- package/dist/components/Icons/CrownIcon.mjs +23 -0
- package/dist/components/Icons/CrownIcon.mjs.map +1 -0
- package/dist/components/Icons/ErrorCircleIcon.mjs +30 -0
- package/dist/components/Icons/ErrorCircleIcon.mjs.map +1 -0
- package/dist/components/Icons/ErrorIcon.mjs +30 -0
- package/dist/components/Icons/ErrorIcon.mjs.map +1 -0
- package/dist/components/Icons/FireIcon.mjs +30 -0
- package/dist/components/Icons/FireIcon.mjs.map +1 -0
- package/dist/components/Icons/HomeIcon.mjs +23 -0
- package/dist/components/Icons/HomeIcon.mjs.map +1 -0
- package/dist/components/Icons/InfoCircleIcon.mjs +30 -0
- package/dist/components/Icons/InfoCircleIcon.mjs.map +1 -0
- package/dist/components/Icons/InfoIcon.mjs +30 -0
- package/dist/components/Icons/InfoIcon.mjs.map +1 -0
- package/dist/components/Icons/MicrophoneIcon.mjs +31 -0
- package/dist/components/Icons/MicrophoneIcon.mjs.map +1 -0
- package/dist/components/Icons/MinusIcon.mjs +23 -0
- package/dist/components/Icons/MinusIcon.mjs.map +1 -0
- package/dist/components/Icons/PlusIcon.mjs +23 -0
- package/dist/components/Icons/PlusIcon.mjs.map +1 -0
- package/dist/components/Icons/SpinnerIcon.mjs +26 -0
- package/dist/components/Icons/SpinnerIcon.mjs.map +1 -0
- package/dist/components/Icons/StopIcon.mjs +22 -0
- package/dist/components/Icons/StopIcon.mjs.map +1 -0
- package/dist/components/Icons/SuccessIcon.mjs +30 -0
- package/dist/components/Icons/SuccessIcon.mjs.map +1 -0
- package/dist/components/Icons/VipBadgeIcon.mjs +80 -0
- package/dist/components/Icons/VipBadgeIcon.mjs.map +1 -0
- package/dist/components/Icons/WarningIcon.mjs +30 -0
- package/dist/components/Icons/WarningIcon.mjs.map +1 -0
- package/dist/components/Icons/WarningTriangleIcon.mjs +30 -0
- package/dist/components/Icons/WarningTriangleIcon.mjs.map +1 -0
- package/dist/components/Logo/Logo.mjs +165 -0
- package/dist/components/Logo/Logo.mjs.map +1 -0
- package/dist/components/Pagination/Pagination.mjs +127 -0
- package/dist/components/Pagination/Pagination.mjs.map +1 -0
- package/dist/components/Pill/Pill.mjs +52 -0
- package/dist/components/Pill/Pill.mjs.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.mjs +95 -0
- package/dist/components/ProgressBar/ProgressBar.mjs.map +1 -0
- package/dist/components/Radio/Radio.mjs +56 -0
- package/dist/components/Radio/Radio.mjs.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.mjs +12 -0
- package/dist/components/RadioGroup/RadioGroup.mjs.map +1 -0
- package/dist/components/Slider/Slider.mjs +78 -0
- package/dist/components/Slider/Slider.mjs.map +1 -0
- package/dist/components/Slider/SliderLayout.mjs +31 -0
- package/dist/components/Slider/SliderLayout.mjs.map +1 -0
- package/dist/components/Slider/SliderThumb.mjs +69 -0
- package/dist/components/Slider/SliderThumb.mjs.map +1 -0
- package/dist/components/Snackbar/Snackbar.mjs +198 -0
- package/dist/components/Snackbar/Snackbar.mjs.map +1 -0
- package/dist/components/Switch/Switch.mjs +39 -0
- package/dist/components/Switch/Switch.mjs.map +1 -0
- package/dist/components/SwitchField/SwitchField.mjs +86 -0
- package/dist/components/SwitchField/SwitchField.mjs.map +1 -0
- package/dist/components/SwitchToggle/SwitchToggle.mjs +93 -0
- package/dist/components/SwitchToggle/SwitchToggle.mjs.map +1 -0
- package/dist/components/Tabs/Tabs.mjs +7 -0
- package/dist/components/Tabs/Tabs.mjs.map +1 -0
- package/dist/components/Tabs/TabsContent.mjs +18 -0
- package/dist/components/Tabs/TabsContent.mjs.map +1 -0
- package/dist/components/Tabs/TabsList.mjs +24 -0
- package/dist/components/Tabs/TabsList.mjs.map +1 -0
- package/dist/components/Tabs/TabsTrigger.mjs +32 -0
- package/dist/components/Tabs/TabsTrigger.mjs.map +1 -0
- package/dist/components/Toast/Toast.mjs +110 -0
- package/dist/components/Toast/Toast.mjs.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.mjs +107 -10507
- package/dist/index.mjs.map +1 -1
- package/dist/utils/cn.mjs +10 -0
- package/dist/utils/cn.mjs.map +1 -0
- package/package.json +10 -4
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.mjs";
|
|
5
|
+
import { Button } from "../Button/Button.mjs";
|
|
6
|
+
import { CrossIcon } from "../Icons/CrossIcon.mjs";
|
|
7
|
+
function CloseButton({ onClose, className }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Button,
|
|
10
|
+
{
|
|
11
|
+
variant: "tertiary",
|
|
12
|
+
size: "24",
|
|
13
|
+
onClick: onClose,
|
|
14
|
+
className: cn("h-auto shrink-0", className),
|
|
15
|
+
"aria-label": "Close snackbar",
|
|
16
|
+
children: /* @__PURE__ */ jsx(CrossIcon, {})
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function resolveCtaSlot(slot, label, onClick, buttonProps) {
|
|
21
|
+
if (slot) return slot;
|
|
22
|
+
if (label) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Button, { onClick, ...buttonProps, children: label });
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
function VipEarnContent({
|
|
28
|
+
icon,
|
|
29
|
+
title,
|
|
30
|
+
description,
|
|
31
|
+
showActions,
|
|
32
|
+
primarySlot,
|
|
33
|
+
primaryLabel,
|
|
34
|
+
primaryOnClick
|
|
35
|
+
}) {
|
|
36
|
+
const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {
|
|
37
|
+
variant: "text",
|
|
38
|
+
size: "24"
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
+
icon && /* @__PURE__ */ jsx("span", { className: "flex shrink-0", "aria-hidden": "true", children: icon }),
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-4", children: [
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
44
|
+
title && /* @__PURE__ */ jsx("p", { className: "typography-body-1-semibold text-body-100 leading-6", children: title }),
|
|
45
|
+
description && /* @__PURE__ */ jsx("p", { className: "typography-body-2-regular text-body-200", children: description })
|
|
46
|
+
] }),
|
|
47
|
+
showActions && primary && /* @__PURE__ */ jsx("div", { className: "self-start", children: primary })
|
|
48
|
+
] })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
function WelcomeContent({
|
|
52
|
+
title,
|
|
53
|
+
description,
|
|
54
|
+
showActions,
|
|
55
|
+
primarySlot,
|
|
56
|
+
primaryLabel,
|
|
57
|
+
primaryOnClick,
|
|
58
|
+
secondarySlot,
|
|
59
|
+
secondaryLabel,
|
|
60
|
+
secondaryOnClick
|
|
61
|
+
}) {
|
|
62
|
+
const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {
|
|
63
|
+
variant: "primary"
|
|
64
|
+
});
|
|
65
|
+
const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {
|
|
66
|
+
variant: "secondary"
|
|
67
|
+
});
|
|
68
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 px-8 text-center text-body-100", children: [
|
|
70
|
+
title && /* @__PURE__ */ jsx("p", { className: "typography-heading-4 text-body-100", children: title }),
|
|
71
|
+
description && /* @__PURE__ */ jsx("p", { className: "typography-body-2-regular text-body-200", children: description })
|
|
72
|
+
] }),
|
|
73
|
+
showActions && (primary || secondary) && /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-4 px-8 sm:flex-row sm:*:flex-1", children: [
|
|
74
|
+
secondary,
|
|
75
|
+
primary
|
|
76
|
+
] })
|
|
77
|
+
] });
|
|
78
|
+
}
|
|
79
|
+
function DefaultContent({
|
|
80
|
+
children,
|
|
81
|
+
showActions,
|
|
82
|
+
primarySlot,
|
|
83
|
+
primaryLabel,
|
|
84
|
+
primaryOnClick,
|
|
85
|
+
secondarySlot,
|
|
86
|
+
secondaryLabel,
|
|
87
|
+
secondaryOnClick
|
|
88
|
+
}) {
|
|
89
|
+
const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {
|
|
90
|
+
variant: "primary",
|
|
91
|
+
size: "40"
|
|
92
|
+
});
|
|
93
|
+
const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {
|
|
94
|
+
variant: "tertiary",
|
|
95
|
+
size: "40"
|
|
96
|
+
});
|
|
97
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
98
|
+
/* @__PURE__ */ jsx("div", { className: "typography-body-1-medium flex min-w-0 flex-1 items-center self-stretch text-body-100", children }),
|
|
99
|
+
showActions && (primary || secondary) && /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-start gap-2", children: [
|
|
100
|
+
primary,
|
|
101
|
+
secondary
|
|
102
|
+
] })
|
|
103
|
+
] });
|
|
104
|
+
}
|
|
105
|
+
const Snackbar = React.forwardRef(
|
|
106
|
+
({
|
|
107
|
+
className,
|
|
108
|
+
variant = "default",
|
|
109
|
+
icon,
|
|
110
|
+
title,
|
|
111
|
+
description,
|
|
112
|
+
showActions = true,
|
|
113
|
+
primaryLabel,
|
|
114
|
+
primaryOnClick,
|
|
115
|
+
primarySlot,
|
|
116
|
+
secondaryLabel,
|
|
117
|
+
secondaryOnClick,
|
|
118
|
+
secondarySlot,
|
|
119
|
+
closable = false,
|
|
120
|
+
onClose,
|
|
121
|
+
children,
|
|
122
|
+
...props
|
|
123
|
+
}, ref) => {
|
|
124
|
+
return (
|
|
125
|
+
/* biome-ignore lint/a11y/useSemanticElements: output cannot contain div children; browsers would break the wrapper. */
|
|
126
|
+
/* @__PURE__ */ jsxs(
|
|
127
|
+
"div",
|
|
128
|
+
{
|
|
129
|
+
ref,
|
|
130
|
+
role: "status",
|
|
131
|
+
"data-testid": "snackbar",
|
|
132
|
+
className: cn(
|
|
133
|
+
"flex gap-4 rounded-2xl",
|
|
134
|
+
(variant === "default" || variant === "vipEarn") && "border border-neutral-50 bg-background-200 p-4 backdrop-blur-md",
|
|
135
|
+
variant === "default" && "flex-wrap items-start",
|
|
136
|
+
variant === "vipEarn" && "items-start",
|
|
137
|
+
variant === "welcome" && "relative flex-col items-center bg-background-inverse-solid py-6",
|
|
138
|
+
className
|
|
139
|
+
),
|
|
140
|
+
...props,
|
|
141
|
+
children: [
|
|
142
|
+
variant === "vipEarn" && /* @__PURE__ */ jsx(
|
|
143
|
+
VipEarnContent,
|
|
144
|
+
{
|
|
145
|
+
icon,
|
|
146
|
+
title,
|
|
147
|
+
description,
|
|
148
|
+
showActions,
|
|
149
|
+
primarySlot,
|
|
150
|
+
primaryLabel,
|
|
151
|
+
primaryOnClick
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
variant === "welcome" && /* @__PURE__ */ jsx(
|
|
155
|
+
WelcomeContent,
|
|
156
|
+
{
|
|
157
|
+
title,
|
|
158
|
+
description,
|
|
159
|
+
showActions,
|
|
160
|
+
primarySlot,
|
|
161
|
+
primaryLabel,
|
|
162
|
+
primaryOnClick,
|
|
163
|
+
secondarySlot,
|
|
164
|
+
secondaryLabel,
|
|
165
|
+
secondaryOnClick
|
|
166
|
+
}
|
|
167
|
+
),
|
|
168
|
+
variant === "default" && /* @__PURE__ */ jsx(
|
|
169
|
+
DefaultContent,
|
|
170
|
+
{
|
|
171
|
+
showActions,
|
|
172
|
+
primarySlot,
|
|
173
|
+
primaryLabel,
|
|
174
|
+
primaryOnClick,
|
|
175
|
+
secondarySlot,
|
|
176
|
+
secondaryLabel,
|
|
177
|
+
secondaryOnClick,
|
|
178
|
+
children
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
closable && /* @__PURE__ */ jsx(
|
|
182
|
+
CloseButton,
|
|
183
|
+
{
|
|
184
|
+
onClose,
|
|
185
|
+
className: variant === "welcome" ? "absolute top-2 right-2" : void 0
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
Snackbar.displayName = "Snackbar";
|
|
195
|
+
export {
|
|
196
|
+
Snackbar
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=Snackbar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Snackbar.mjs","sources":["../../../src/components/Snackbar/Snackbar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../Button/Button\";\nimport { CrossIcon } from \"../Icons/CrossIcon\";\n\nexport type SnackbarVariant = \"default\" | \"vipEarn\" | \"welcome\";\n\nexport interface SnackbarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Snackbar layout variant */\n variant?: SnackbarVariant;\n /** Left icon element */\n icon?: React.ReactNode;\n /** Title text */\n title?: React.ReactNode;\n /** Description text */\n description?: React.ReactNode;\n /** Whether to show the actions section */\n showActions?: boolean;\n /** Primary CTA label (renders a default Button) */\n primaryLabel?: string;\n /** Primary CTA click handler (used with primaryLabel) */\n primaryOnClick?: () => void;\n /** Custom element to render as primary CTA (overrides primaryLabel/primaryOnClick) */\n primarySlot?: React.ReactNode;\n /** Secondary CTA label (renders a default Button) */\n secondaryLabel?: string;\n /** Secondary CTA click handler (used with secondaryLabel) */\n secondaryOnClick?: () => void;\n /** Custom element to render as secondary CTA (overrides secondaryLabel/secondaryOnClick) */\n secondarySlot?: React.ReactNode;\n /** Show close button */\n closable?: boolean;\n /** Close button click handler */\n onClose?: () => void;\n}\n\nfunction CloseButton({ onClose, className }: { onClose?: () => void; className?: string }) {\n return (\n <Button\n variant=\"tertiary\"\n size=\"24\"\n onClick={onClose}\n className={cn(\"h-auto shrink-0\", className)}\n aria-label=\"Close snackbar\"\n >\n <CrossIcon />\n </Button>\n );\n}\n\n/**\n * Resolves a CTA slot. If a custom slot is provided it takes precedence,\n * otherwise a default Button is rendered from label + onClick.\n */\nfunction resolveCtaSlot(\n slot: React.ReactNode | undefined,\n label: string | undefined,\n onClick: (() => void) | undefined,\n buttonProps: React.ComponentProps<typeof Button>,\n): React.ReactNode | null {\n if (slot) return slot;\n if (label) {\n return (\n <Button onClick={onClick} {...buttonProps}>\n {label}\n </Button>\n );\n }\n return null;\n}\n\nfunction VipEarnContent({\n icon,\n title,\n description,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"icon\"\n | \"title\"\n | \"description\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"text\",\n size: \"24\",\n });\n\n return (\n <>\n {icon && (\n <span className=\"flex shrink-0\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-4\">\n <div className=\"flex flex-col\">\n {title && <p className=\"typography-body-1-semibold text-body-100 leading-6\">{title}</p>}\n {description && <p className=\"typography-body-2-regular text-body-200\">{description}</p>}\n </div>\n {showActions && primary && <div className=\"self-start\">{primary}</div>}\n </div>\n </>\n );\n}\n\nfunction WelcomeContent({\n title,\n description,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n secondarySlot,\n secondaryLabel,\n secondaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"title\"\n | \"description\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n | \"secondarySlot\"\n | \"secondaryLabel\"\n | \"secondaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"primary\",\n });\n const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {\n variant: \"secondary\",\n });\n\n return (\n <>\n <div className=\"flex flex-col items-center gap-2 px-8 text-center text-body-100\">\n {title && <p className=\"typography-heading-4 text-body-100\">{title}</p>}\n {description && <p className=\"typography-body-2-regular text-body-200\">{description}</p>}\n </div>\n {showActions && (primary || secondary) && (\n <div className=\"flex w-full flex-col gap-4 px-8 sm:flex-row sm:*:flex-1\">\n {secondary}\n {primary}\n </div>\n )}\n </>\n );\n}\n\nfunction DefaultContent({\n children,\n showActions,\n primarySlot,\n primaryLabel,\n primaryOnClick,\n secondarySlot,\n secondaryLabel,\n secondaryOnClick,\n}: Pick<\n SnackbarProps,\n | \"children\"\n | \"showActions\"\n | \"primarySlot\"\n | \"primaryLabel\"\n | \"primaryOnClick\"\n | \"secondarySlot\"\n | \"secondaryLabel\"\n | \"secondaryOnClick\"\n>) {\n const primary = resolveCtaSlot(primarySlot, primaryLabel, primaryOnClick, {\n variant: \"primary\",\n size: \"40\",\n });\n const secondary = resolveCtaSlot(secondarySlot, secondaryLabel, secondaryOnClick, {\n variant: \"tertiary\",\n size: \"40\",\n });\n\n return (\n <>\n <div className=\"typography-body-1-medium flex min-w-0 flex-1 items-center self-stretch text-body-100\">\n {children}\n </div>\n {showActions && (primary || secondary) && (\n <div className=\"flex shrink-0 items-start gap-2\">\n {primary}\n {secondary}\n </div>\n )}\n </>\n );\n}\n\nexport const Snackbar = React.forwardRef<HTMLDivElement, SnackbarProps>(\n (\n {\n className,\n variant = \"default\",\n icon,\n title,\n description,\n showActions = true,\n primaryLabel,\n primaryOnClick,\n primarySlot,\n secondaryLabel,\n secondaryOnClick,\n secondarySlot,\n closable = false,\n onClose,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n /* biome-ignore lint/a11y/useSemanticElements: output cannot contain div children; browsers would break the wrapper. */\n <div\n ref={ref}\n role=\"status\"\n data-testid=\"snackbar\"\n className={cn(\n \"flex gap-4 rounded-2xl\",\n (variant === \"default\" || variant === \"vipEarn\") &&\n \"border border-neutral-50 bg-background-200 p-4 backdrop-blur-md\",\n variant === \"default\" && \"flex-wrap items-start\",\n variant === \"vipEarn\" && \"items-start\",\n variant === \"welcome\" &&\n \"relative flex-col items-center bg-background-inverse-solid py-6\",\n className,\n )}\n {...props}\n >\n {variant === \"vipEarn\" && (\n <VipEarnContent\n icon={icon}\n title={title}\n description={description}\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n />\n )}\n {variant === \"welcome\" && (\n <WelcomeContent\n title={title}\n description={description}\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n secondarySlot={secondarySlot}\n secondaryLabel={secondaryLabel}\n secondaryOnClick={secondaryOnClick}\n />\n )}\n {variant === \"default\" && (\n <DefaultContent\n showActions={showActions}\n primarySlot={primarySlot}\n primaryLabel={primaryLabel}\n primaryOnClick={primaryOnClick}\n secondarySlot={secondarySlot}\n secondaryLabel={secondaryLabel}\n secondaryOnClick={secondaryOnClick}\n >\n {children}\n </DefaultContent>\n )}\n {closable && (\n <CloseButton\n onClose={onClose}\n className={variant === \"welcome\" ? \"absolute top-2 right-2\" : undefined}\n />\n )}\n </div>\n );\n },\n);\n\nSnackbar.displayName = \"Snackbar\";\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
const Switch = React.forwardRef(({ className, size = "default", ...props }, ref) => {
|
|
7
|
+
const thumbSizeClass = size === "default" ? "size-4.5 translate-x-0.75 data-[state=checked]:translate-x-4.75" : "size-4 translate-x-0.5 data-[state=checked]:translate-x-4.25";
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
SwitchPrimitive.Root,
|
|
10
|
+
{
|
|
11
|
+
ref,
|
|
12
|
+
className: cn(
|
|
13
|
+
"inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-150",
|
|
14
|
+
"focus-visible:shadow-focus-ring focus-visible:outline-none",
|
|
15
|
+
"data-[state=checked]:border-neutral-200 data-[state=checked]:bg-brand-green-500",
|
|
16
|
+
"data-[state=unchecked]:bg-neutral-400",
|
|
17
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
|
+
size === "default" && "h-6 w-10.5",
|
|
19
|
+
size === "small" && "h-5 w-9",
|
|
20
|
+
className
|
|
21
|
+
),
|
|
22
|
+
...props,
|
|
23
|
+
children: /* @__PURE__ */ jsx(
|
|
24
|
+
SwitchPrimitive.Thumb,
|
|
25
|
+
{
|
|
26
|
+
className: cn(
|
|
27
|
+
"pointer-events-none rounded-full bg-body-white-solid-constant shadow-sm transition-transform duration-150 dark:bg-body-black-solid-constant",
|
|
28
|
+
thumbSizeClass
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
Switch.displayName = "Switch";
|
|
36
|
+
export {
|
|
37
|
+
Switch
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=Switch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.mjs","sources":["../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as SwitchPrimitive from \"@radix-ui/react-switch\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport type SwitchSize = \"default\" | \"small\";\n\nexport interface SwitchProps\n extends Omit<React.ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>, \"asChild\"> {\n /** Size variant of the switch */\n size?: SwitchSize;\n}\n\nexport const Switch = React.forwardRef<\n React.ComponentRef<typeof SwitchPrimitive.Root>,\n SwitchProps\n>(({ className, size = \"default\", ...props }, ref) => {\n const thumbSizeClass =\n size === \"default\"\n ? \"size-4.5 translate-x-0.75 data-[state=checked]:translate-x-4.75\"\n : \"size-4 translate-x-0.5 data-[state=checked]:translate-x-4.25\";\n\n return (\n <SwitchPrimitive.Root\n ref={ref}\n className={cn(\n \"inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors duration-150\",\n \"focus-visible:shadow-focus-ring focus-visible:outline-none\",\n \"data-[state=checked]:border-neutral-200 data-[state=checked]:bg-brand-green-500\",\n \"data-[state=unchecked]:bg-neutral-400\",\n \"disabled:cursor-not-allowed disabled:opacity-50\",\n size === \"default\" && \"h-6 w-10.5\",\n size === \"small\" && \"h-5 w-9\",\n className,\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n className={cn(\n \"pointer-events-none rounded-full bg-body-white-solid-constant shadow-sm transition-transform duration-150 dark:bg-body-black-solid-constant\",\n thumbSizeClass,\n )}\n />\n </SwitchPrimitive.Root>\n );\n});\n\nSwitch.displayName = \"Switch\";\n"],"names":[],"mappings":";;;;;AAYO,MAAM,SAAS,MAAM,WAG1B,CAAC,EAAE,WAAW,OAAO,WAAW,GAAG,MAAA,GAAS,QAAQ;AACpD,QAAM,iBACJ,SAAS,YACL,oEACA;AAEN,SACE;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS,aAAa;AAAA,QACtB,SAAS,WAAW;AAAA,QACpB;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAC,gBAAgB;AAAA,QAAhB;AAAA,UACC,WAAW;AAAA,YACT;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN,CAAC;AAED,OAAO,cAAc;"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.mjs";
|
|
5
|
+
import { InfoCircleIcon } from "../Icons/InfoCircleIcon.mjs";
|
|
6
|
+
import { Switch } from "../Switch/Switch.mjs";
|
|
7
|
+
const SwitchField = React.forwardRef(
|
|
8
|
+
({
|
|
9
|
+
className,
|
|
10
|
+
orientation = "right",
|
|
11
|
+
size = "default",
|
|
12
|
+
label,
|
|
13
|
+
helperText,
|
|
14
|
+
infoText,
|
|
15
|
+
disabled,
|
|
16
|
+
id: propId,
|
|
17
|
+
...props
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const generatedId = React.useId();
|
|
20
|
+
const id = propId ?? generatedId;
|
|
21
|
+
const helperTextId = helperText ? `${id}-helper` : void 0;
|
|
22
|
+
const switchElement = /* @__PURE__ */ jsx(
|
|
23
|
+
Switch,
|
|
24
|
+
{
|
|
25
|
+
ref,
|
|
26
|
+
id,
|
|
27
|
+
size,
|
|
28
|
+
disabled,
|
|
29
|
+
"aria-describedby": helperTextId,
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
const labelContent = (label || helperText) && /* @__PURE__ */ jsxs(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: cn(
|
|
37
|
+
"flex min-w-0 flex-1 flex-col items-start",
|
|
38
|
+
size === "default" ? "gap-1" : "gap-0.5"
|
|
39
|
+
),
|
|
40
|
+
children: [
|
|
41
|
+
label && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
"label",
|
|
44
|
+
{
|
|
45
|
+
htmlFor: id,
|
|
46
|
+
className: cn(
|
|
47
|
+
"cursor-pointer select-none text-body-100",
|
|
48
|
+
disabled && "cursor-not-allowed text-disabled-100",
|
|
49
|
+
size === "default" ? "typography-body-1-semibold" : "typography-body-2-semibold"
|
|
50
|
+
),
|
|
51
|
+
children: label
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
infoText && /* @__PURE__ */ jsxs("span", { className: "group relative flex shrink-0 pt-0.5", children: [
|
|
55
|
+
/* @__PURE__ */ jsx(InfoCircleIcon, { className: "size-5 text-body-200" }),
|
|
56
|
+
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute top-full left-1/2 mt-1 -translate-x-1/2 rounded-lg bg-neutral-400 px-3 py-1.5 text-body-white-solid-constant text-xs leading-none opacity-0 transition-opacity group-hover:opacity-100", children: infoText })
|
|
57
|
+
] })
|
|
58
|
+
] }),
|
|
59
|
+
helperText && /* @__PURE__ */ jsx(
|
|
60
|
+
"span",
|
|
61
|
+
{
|
|
62
|
+
id: helperTextId,
|
|
63
|
+
className: cn(
|
|
64
|
+
"text-body-200",
|
|
65
|
+
// !TODO https://linear.app/fanvue/issue/ENG-7301/swap-out-typography-tailwind-utility-classes
|
|
66
|
+
disabled && "text-disabled-100",
|
|
67
|
+
size === "default" ? "typography-body-2-regular" : "typography-caption-regular"
|
|
68
|
+
),
|
|
69
|
+
children: helperText
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-start gap-2", disabled && "cursor-not-allowed", className), children: [
|
|
76
|
+
orientation === "left" && switchElement,
|
|
77
|
+
labelContent,
|
|
78
|
+
orientation === "right" && switchElement
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
SwitchField.displayName = "SwitchField";
|
|
83
|
+
export {
|
|
84
|
+
SwitchField
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=SwitchField.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchField.mjs","sources":["../../../src/components/SwitchField/SwitchField.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { InfoCircleIcon } from \"../Icons/InfoCircleIcon\";\nimport { Switch, type SwitchSize } from \"../Switch/Switch\";\n\nexport type SwitchFieldOrientation = \"right\" | \"left\";\n\nexport interface SwitchFieldProps\n extends Omit<React.ComponentPropsWithoutRef<typeof Switch>, \"size\" | \"className\"> {\n /** Position of the switch relative to the label */\n orientation?: SwitchFieldOrientation;\n /** Size variant of the switch and text */\n size?: SwitchSize;\n /** Label text displayed next to the switch */\n label?: string;\n /** Helper text displayed below the label */\n helperText?: string;\n /** Info tooltip text displayed on hover of the info icon */\n infoText?: string;\n /** Additional className for the wrapper */\n className?: string;\n}\n\nexport const SwitchField = React.forwardRef<React.ComponentRef<typeof Switch>, SwitchFieldProps>(\n (\n {\n className,\n orientation = \"right\",\n size = \"default\",\n label,\n helperText,\n infoText,\n disabled,\n id: propId,\n ...props\n },\n ref,\n ) => {\n const generatedId = React.useId();\n const id = propId ?? generatedId;\n const helperTextId = helperText ? `${id}-helper` : undefined;\n\n const switchElement = (\n <Switch\n ref={ref}\n id={id}\n size={size}\n disabled={disabled}\n aria-describedby={helperTextId}\n {...props}\n />\n );\n\n const labelContent = (label || helperText) && (\n <div\n className={cn(\n \"flex min-w-0 flex-1 flex-col items-start\",\n size === \"default\" ? \"gap-1\" : \"gap-0.5\",\n )}\n >\n {label && (\n <div className=\"flex items-center gap-1\">\n <label\n htmlFor={id}\n className={cn(\n \"cursor-pointer select-none text-body-100\",\n disabled && \"cursor-not-allowed text-disabled-100\",\n size === \"default\" ? \"typography-body-1-semibold\" : \"typography-body-2-semibold\",\n )}\n >\n {label}\n </label>\n {infoText && (\n <span className=\"group relative flex shrink-0 pt-0.5\">\n <InfoCircleIcon className=\"size-5 text-body-200\" />\n <span className=\"pointer-events-none absolute top-full left-1/2 mt-1 -translate-x-1/2 rounded-lg bg-neutral-400 px-3 py-1.5 text-body-white-solid-constant text-xs leading-none opacity-0 transition-opacity group-hover:opacity-100\">\n {/*!TODO Replace with Tooltip once built\n https://linear.app/fanvue/issue/ENG-7226/component-library-tooltip-component */}\n {infoText}\n </span>\n </span>\n )}\n </div>\n )}\n {helperText && (\n <span\n id={helperTextId}\n className={cn(\n \"text-body-200\", // !TODO https://linear.app/fanvue/issue/ENG-7301/swap-out-typography-tailwind-utility-classes\n disabled && \"text-disabled-100\",\n size === \"default\" ? \"typography-body-2-regular\" : \"typography-caption-regular\",\n )}\n >\n {helperText}\n </span>\n )}\n </div>\n );\n\n return (\n <div className={cn(\"flex items-start gap-2\", disabled && \"cursor-not-allowed\", className)}>\n {orientation === \"left\" && switchElement}\n {labelContent}\n {orientation === \"right\" && switchElement}\n </div>\n );\n },\n);\n\nSwitchField.displayName = \"SwitchField\";\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,cAAc,MAAM;AAAA,EAC/B,CACE;AAAA,IACE;AAAA,IACA,cAAc;AAAA,IACd,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,IAAI;AAAA,IACJ,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,cAAc,MAAM,MAAA;AAC1B,UAAM,KAAK,UAAU;AACrB,UAAM,eAAe,aAAa,GAAG,EAAE,YAAY;AAEnD,UAAM,gBACJ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,oBAAkB;AAAA,QACjB,GAAG;AAAA,MAAA;AAAA,IAAA;AAIR,UAAM,gBAAgB,SAAS,eAC7B;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,SAAS,YAAY,UAAU;AAAA,QAAA;AAAA,QAGhC,UAAA;AAAA,UAAA,SACC,qBAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,YAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,SAAS;AAAA,gBACT,WAAW;AAAA,kBACT;AAAA,kBACA,YAAY;AAAA,kBACZ,SAAS,YAAY,+BAA+B;AAAA,gBAAA;AAAA,gBAGrD,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAEF,YACC,qBAAC,QAAA,EAAK,WAAU,uCACd,UAAA;AAAA,cAAA,oBAAC,gBAAA,EAAe,WAAU,uBAAA,CAAuB;AAAA,cACjD,oBAAC,QAAA,EAAK,WAAU,uNAGb,UAAA,SAAA,CACH;AAAA,YAAA,EAAA,CACF;AAAA,UAAA,GAEJ;AAAA,UAED,cACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI;AAAA,cACJ,WAAW;AAAA,gBACT;AAAA;AAAA,gBACA,YAAY;AAAA,gBACZ,SAAS,YAAY,8BAA8B;AAAA,cAAA;AAAA,cAGpD,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAKN,WACE,qBAAC,SAAI,WAAW,GAAG,0BAA0B,YAAY,sBAAsB,SAAS,GACrF,UAAA;AAAA,MAAA,gBAAgB,UAAU;AAAA,MAC1B;AAAA,MACA,gBAAgB,WAAW;AAAA,IAAA,GAC9B;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../../utils/cn.mjs";
|
|
5
|
+
const SwitchToggle = React.forwardRef(
|
|
6
|
+
({
|
|
7
|
+
className,
|
|
8
|
+
size = "24",
|
|
9
|
+
options,
|
|
10
|
+
value: controlledValue,
|
|
11
|
+
defaultValue,
|
|
12
|
+
onChange,
|
|
13
|
+
disabled = false,
|
|
14
|
+
...props
|
|
15
|
+
}, ref) => {
|
|
16
|
+
const groupName = React.useId();
|
|
17
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0].value);
|
|
18
|
+
const isControlled = controlledValue !== void 0;
|
|
19
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
20
|
+
const isSecondSelected = currentValue === options[1].value;
|
|
21
|
+
const sizeClass = size === "24" ? "px-2 py-1 typography-caption-semibold" : size === "32" ? "px-3 py-1.75 typography-body-2-semibold" : "h-10 px-4 py-2.25 typography-button-small";
|
|
22
|
+
const handleSelect = (optionValue) => {
|
|
23
|
+
if (disabled) return;
|
|
24
|
+
if (!isControlled) {
|
|
25
|
+
setInternalValue(optionValue);
|
|
26
|
+
}
|
|
27
|
+
onChange?.(optionValue);
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
role: "radiogroup",
|
|
34
|
+
className: cn(
|
|
35
|
+
"relative inline-grid grid-cols-2 rounded-full border border-neutral-200 p-1",
|
|
36
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
37
|
+
className
|
|
38
|
+
),
|
|
39
|
+
...props,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
"span",
|
|
43
|
+
{
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
className: cn(
|
|
46
|
+
"absolute inset-y-1 left-1 w-[calc(50%-4px)] rounded-full border border-brand-green-500 bg-brand-green-50",
|
|
47
|
+
"motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out",
|
|
48
|
+
isSecondSelected && "translate-x-full"
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
options.map((option) => {
|
|
53
|
+
const optionId = `${groupName}-${option.value}`;
|
|
54
|
+
return /* @__PURE__ */ jsxs(
|
|
55
|
+
"label",
|
|
56
|
+
{
|
|
57
|
+
htmlFor: optionId,
|
|
58
|
+
className: cn(
|
|
59
|
+
"relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full border border-transparent text-body-100",
|
|
60
|
+
"has-focus-visible:shadow-focus-ring has-focus-visible:outline-none",
|
|
61
|
+
disabled && "pointer-events-none",
|
|
62
|
+
sizeClass
|
|
63
|
+
),
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
"input",
|
|
67
|
+
{
|
|
68
|
+
id: optionId,
|
|
69
|
+
type: "radio",
|
|
70
|
+
name: groupName,
|
|
71
|
+
value: option.value,
|
|
72
|
+
checked: currentValue === option.value,
|
|
73
|
+
disabled,
|
|
74
|
+
onChange: () => handleSelect(option.value),
|
|
75
|
+
className: "sr-only"
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
option.label
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
option.value
|
|
82
|
+
);
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
SwitchToggle.displayName = "SwitchToggle";
|
|
90
|
+
export {
|
|
91
|
+
SwitchToggle
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=SwitchToggle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchToggle.mjs","sources":["../../../src/components/SwitchToggle/SwitchToggle.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport type SwitchToggleSize = \"24\" | \"32\" | \"40\";\n\nexport interface SwitchToggleOption {\n /** Display label for the option */\n label: string;\n /** Value identifier for the option */\n value: string;\n}\n\nexport interface SwitchToggleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /** Size variant */\n size?: SwitchToggleSize;\n /** The two options to toggle between */\n options: [SwitchToggleOption, SwitchToggleOption];\n /** Currently selected value */\n value?: string;\n /** Default selected value (uncontrolled) */\n defaultValue?: string;\n /** Callback when the selected value changes */\n onChange?: (value: string) => void;\n /** Whether the toggle is disabled */\n disabled?: boolean;\n}\n\nexport const SwitchToggle = React.forwardRef<HTMLDivElement, SwitchToggleProps>(\n (\n {\n className,\n size = \"24\",\n options,\n value: controlledValue,\n defaultValue,\n onChange,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n const groupName = React.useId();\n // Tracks selection for uncontrolled usage; ignored when `value` prop is provided\n const [internalValue, setInternalValue] = React.useState(defaultValue ?? options[0].value);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n const isSecondSelected = currentValue === options[1].value;\n\n const sizeClass =\n size === \"24\"\n ? \"px-2 py-1 typography-caption-semibold\"\n : size === \"32\"\n ? \"px-3 py-1.75 typography-body-2-semibold\"\n : \"h-10 px-4 py-2.25 typography-button-small\";\n\n const handleSelect = (optionValue: string) => {\n if (disabled) return;\n if (!isControlled) {\n setInternalValue(optionValue);\n }\n onChange?.(optionValue);\n };\n\n return (\n <div\n ref={ref}\n role=\"radiogroup\"\n className={cn(\n \"relative inline-grid grid-cols-2 rounded-full border border-neutral-200 p-1\",\n disabled && \"cursor-not-allowed opacity-50\",\n className,\n )}\n {...props}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"absolute inset-y-1 left-1 w-[calc(50%-4px)] rounded-full border border-brand-green-500 bg-brand-green-50\",\n \"motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-in-out\",\n isSecondSelected && \"translate-x-full\",\n )}\n />\n {options.map((option) => {\n const optionId = `${groupName}-${option.value}`;\n return (\n <label\n key={option.value}\n htmlFor={optionId}\n className={cn(\n \"relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full border border-transparent text-body-100\",\n \"has-focus-visible:shadow-focus-ring has-focus-visible:outline-none\",\n disabled && \"pointer-events-none\",\n sizeClass,\n )}\n >\n <input\n id={optionId}\n type=\"radio\"\n name={groupName}\n value={option.value}\n checked={currentValue === option.value}\n disabled={disabled}\n onChange={() => handleSelect(option.value)}\n className=\"sr-only\"\n />\n {option.label}\n </label>\n );\n })}\n </div>\n );\n },\n);\n\nSwitchToggle.displayName = \"SwitchToggle\";\n"],"names":[],"mappings":";;;;AA2BO,MAAM,eAAe,MAAM;AAAA,EAChC,CACE;AAAA,IACE;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,YAAY,MAAM,MAAA;AAExB,UAAM,CAAC,eAAe,gBAAgB,IAAI,MAAM,SAAS,gBAAgB,QAAQ,CAAC,EAAE,KAAK;AACzF,UAAM,eAAe,oBAAoB;AACzC,UAAM,eAAe,eAAe,kBAAkB;AACtD,UAAM,mBAAmB,iBAAiB,QAAQ,CAAC,EAAE;AAErD,UAAM,YACJ,SAAS,OACL,0CACA,SAAS,OACP,4CACA;AAER,UAAM,eAAe,CAAC,gBAAwB;AAC5C,UAAI,SAAU;AACd,UAAI,CAAC,cAAc;AACjB,yBAAiB,WAAW;AAAA,MAC9B;AACA,iBAAW,WAAW;AAAA,IACxB;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,WAAW;AAAA,UACT;AAAA,UACA,YAAY;AAAA,UACZ;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,eAAY;AAAA,cACZ,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA,oBAAoB;AAAA,cAAA;AAAA,YACtB;AAAA,UAAA;AAAA,UAED,QAAQ,IAAI,CAAC,WAAW;AACvB,kBAAM,WAAW,GAAG,SAAS,IAAI,OAAO,KAAK;AAC7C,mBACE;AAAA,cAAC;AAAA,cAAA;AAAA,gBAEC,SAAS;AAAA,gBACT,WAAW;AAAA,kBACT;AAAA,kBACA;AAAA,kBACA,YAAY;AAAA,kBACZ;AAAA,gBAAA;AAAA,gBAGF,UAAA;AAAA,kBAAA;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,IAAI;AAAA,sBACJ,MAAK;AAAA,sBACL,MAAM;AAAA,sBACN,OAAO,OAAO;AAAA,sBACd,SAAS,iBAAiB,OAAO;AAAA,sBACjC;AAAA,sBACA,UAAU,MAAM,aAAa,OAAO,KAAK;AAAA,sBACzC,WAAU;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAEX,OAAO;AAAA,gBAAA;AAAA,cAAA;AAAA,cAnBH,OAAO;AAAA,YAAA;AAAA,UAsBlB,CAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,aAAa,cAAc;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.mjs","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport type * as React from \"react\";\n\nexport type TabsProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>;\n\nexport const Tabs = TabsPrimitive.Root;\n"],"names":[],"mappings":";;AAKO,MAAM,OAAO,cAAc;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
const TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7
|
+
TabsPrimitive.Content,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn("focus-visible:outline-none", className),
|
|
11
|
+
...props
|
|
12
|
+
}
|
|
13
|
+
));
|
|
14
|
+
TabsContent.displayName = "TabsContent";
|
|
15
|
+
export {
|
|
16
|
+
TabsContent
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=TabsContent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabsContent.mjs","sources":["../../../src/components/Tabs/TabsContent.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport type TabsContentProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>;\n\nexport const TabsContent = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Content>,\n TabsContentProps\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\"focus-visible:outline-none\", className)}\n {...props}\n />\n));\n\nTabsContent.displayName = \"TabsContent\";\n"],"names":[],"mappings":";;;;;AAMO,MAAM,cAAc,MAAM,WAG/B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,cAAc;AAAA,EAAd;AAAA,IACC;AAAA,IACA,WAAW,GAAG,8BAA8B,SAAS;AAAA,IACpD,GAAG;AAAA,EAAA;AACN,CACD;AAED,YAAY,cAAc;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
const TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7
|
+
TabsPrimitive.List,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn(
|
|
11
|
+
"inline-flex",
|
|
12
|
+
// !TODO setup shadows tokens https://linear.app/fanvue/issue/ENG-7368/setup-shadow-tokens
|
|
13
|
+
"data-[orientation=horizontal]:items-center data-[orientation=horizontal]:shadow-[inset_0_-1px_0_0_var(--color-neutral-200)]",
|
|
14
|
+
"data-[orientation=vertical]:flex-col data-[orientation=vertical]:shadow-[inset_-1px_0_0_0_var(--color-neutral-200)]",
|
|
15
|
+
className
|
|
16
|
+
),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
));
|
|
20
|
+
TabsList.displayName = "TabsList";
|
|
21
|
+
export {
|
|
22
|
+
TabsList
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=TabsList.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabsList.mjs","sources":["../../../src/components/Tabs/TabsList.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>;\n\nexport const TabsList = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.List>,\n TabsListProps\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n \"inline-flex\", // !TODO setup shadows tokens https://linear.app/fanvue/issue/ENG-7368/setup-shadow-tokens\n \"data-[orientation=horizontal]:items-center data-[orientation=horizontal]:shadow-[inset_0_-1px_0_0_var(--color-neutral-200)]\",\n \"data-[orientation=vertical]:flex-col data-[orientation=vertical]:shadow-[inset_-1px_0_0_0_var(--color-neutral-200)]\",\n className,\n )}\n {...props}\n />\n));\n\nTabsList.displayName = \"TabsList\";\n"],"names":[],"mappings":";;;;;AAMO,MAAM,WAAW,MAAM,WAG5B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,cAAc;AAAA,EAAd;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN,CACD;AAED,SAAS,cAAc;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { cn } from "../../utils/cn.mjs";
|
|
6
|
+
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7
|
+
TabsPrimitive.Trigger,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn(
|
|
11
|
+
"inline-flex items-center justify-center",
|
|
12
|
+
"rounded-xs border-transparent",
|
|
13
|
+
"typography-body-1-semibold cursor-pointer text-body-100",
|
|
14
|
+
"data-[orientation=horizontal]:border-b-4 data-[orientation=horizontal]:px-3 data-[orientation=horizontal]:pb-4",
|
|
15
|
+
"data-[orientation=vertical]:justify-start data-[orientation=vertical]:border-r-4 data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3",
|
|
16
|
+
"data-[state=active]:border-brand-green-500",
|
|
17
|
+
"data-[state=active]:hover:text-hover-100",
|
|
18
|
+
"data-[state=inactive]:hover:text-hover-200",
|
|
19
|
+
"data-disabled:pointer-events-none",
|
|
20
|
+
"data-disabled:data-[state=active]:text-disabled-100",
|
|
21
|
+
"data-disabled:data-[state=inactive]:text-disabled-400",
|
|
22
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-purple-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background-inverse-solid",
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
...props
|
|
26
|
+
}
|
|
27
|
+
));
|
|
28
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
29
|
+
export {
|
|
30
|
+
TabsTrigger
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=TabsTrigger.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabsTrigger.mjs","sources":["../../../src/components/Tabs/TabsTrigger.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\nexport type TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>;\n\nexport const TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Trigger>,\n TabsTriggerProps\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center\",\n \"rounded-xs border-transparent\",\n \"typography-body-1-semibold cursor-pointer text-body-100\",\n \"data-[orientation=horizontal]:border-b-4 data-[orientation=horizontal]:px-3 data-[orientation=horizontal]:pb-4\",\n \"data-[orientation=vertical]:justify-start data-[orientation=vertical]:border-r-4 data-[orientation=vertical]:px-4 data-[orientation=vertical]:py-3\",\n \"data-[state=active]:border-brand-green-500\",\n \"data-[state=active]:hover:text-hover-100\",\n \"data-[state=inactive]:hover:text-hover-200\",\n \"data-disabled:pointer-events-none\",\n \"data-disabled:data-[state=active]:text-disabled-100\",\n \"data-disabled:data-[state=inactive]:text-disabled-400\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-purple-500 focus-visible:ring-offset-2 focus-visible:ring-offset-background-inverse-solid\",\n className,\n )}\n {...props}\n />\n));\n\nTabsTrigger.displayName = \"TabsTrigger\";\n"],"names":[],"mappings":";;;;;AAMO,MAAM,cAAc,MAAM,WAG/B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,cAAc;AAAA,EAAd;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IAED,GAAG;AAAA,EAAA;AACN,CACD;AAED,YAAY,cAAc;"}
|