torch-glare 1.0.2
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/LICENSE +21 -0
- package/README.md +207 -0
- package/cli/bin/addComponent.js +278 -0
- package/cli/bin/addHooks.js +75 -0
- package/cli/bin/addLayout.js +71 -0
- package/cli/bin/addProvider.js +71 -0
- package/cli/bin/addUtils.js +74 -0
- package/cli/bin/cli.js +73 -0
- package/cli/bin/init/init.js +15 -0
- package/cli/bin/init/tailwindInit.js +174 -0
- package/cli/bin/update.js +147 -0
- package/lib/components/ActionButton.tsx +63 -0
- package/lib/components/ActionsGroup.tsx +34 -0
- package/lib/components/AlertDialog.tsx +211 -0
- package/lib/components/Badge.tsx +116 -0
- package/lib/components/BadgeField.tsx +192 -0
- package/lib/components/Button.tsx +277 -0
- package/lib/components/Card.tsx +63 -0
- package/lib/components/Checkbox.tsx +122 -0
- package/lib/components/CountBadge.tsx +54 -0
- package/lib/components/DatePicker.tsx +464 -0
- package/lib/components/Drawer.tsx +118 -0
- package/lib/components/DropdownMenu.tsx +399 -0
- package/lib/components/FieldHint.tsx +76 -0
- package/lib/components/ImageAttachment.tsx +180 -0
- package/lib/components/InnerLabelField.tsx +155 -0
- package/lib/components/Input.tsx +179 -0
- package/lib/components/InputField.tsx +147 -0
- package/lib/components/Label.tsx +107 -0
- package/lib/components/LabelField.tsx +75 -0
- package/lib/components/LabeledCheckBox.tsx +65 -0
- package/lib/components/LabeledRadio.tsx +45 -0
- package/lib/components/LinkButton.tsx +94 -0
- package/lib/components/LoginButton.tsx +56 -0
- package/lib/components/PasswordLevel.tsx +58 -0
- package/lib/components/Popover.tsx +274 -0
- package/lib/components/ProfileMenu.tsx +90 -0
- package/lib/components/Radio.tsx +77 -0
- package/lib/components/RadioCard.tsx +72 -0
- package/lib/components/RingLoading.tsx +190 -0
- package/lib/components/SearchField.tsx +49 -0
- package/lib/components/Select.tsx +417 -0
- package/lib/components/SlideDatePicker.tsx +120 -0
- package/lib/components/SpinLoading.tsx +190 -0
- package/lib/components/Switcher.tsx +56 -0
- package/lib/components/TabFormItem.tsx +158 -0
- package/lib/components/Table.tsx +395 -0
- package/lib/components/Textarea.tsx +108 -0
- package/lib/components/Tooltip.tsx +111 -0
- package/lib/components/TransparentLabel.tsx +72 -0
- package/lib/components/TreeDropDown.tsx +69 -0
- package/lib/hooks/MobileSlidePicker/components/Picker.tsx +218 -0
- package/lib/hooks/MobileSlidePicker/components/PickerColumn.tsx +238 -0
- package/lib/hooks/MobileSlidePicker/components/PickerItem.tsx +64 -0
- package/lib/hooks/MobileSlidePicker/index.ts +10 -0
- package/lib/hooks/useActiveTreeItem.tsx +61 -0
- package/lib/hooks/useClickOutside.tsx +20 -0
- package/lib/hooks/useResize.tsx +78 -0
- package/lib/layouts/CLayout.tsx +326 -0
- package/lib/layouts/FieldSection.tsx +64 -0
- package/lib/layouts/TreeSubLayout.tsx +187 -0
- package/lib/providers/ThemeProvider.tsx +99 -0
- package/lib/utils/cn.ts +6 -0
- package/lib/utils/convertImageFileToDataUrl.ts +17 -0
- package/lib/utils/resize.ts +35 -0
- package/lib/utils/types.ts +12 -0
- package/package.json +28 -0
- package/torch-glare.js +24 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { HTMLAttributes } from "react";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../utils/cn";
|
|
4
|
+
|
|
5
|
+
export const loadingFrame = cva("relative flex justify-center items-center", {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
S: "w-[200px] h-[200px]",
|
|
9
|
+
M: "w-[400px] h-[400px]",
|
|
10
|
+
L: "w-[500px] h-[500px]",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: "S",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const loadingAnimationTextContainer = cva("", {
|
|
19
|
+
variants: {
|
|
20
|
+
size: {
|
|
21
|
+
S: "w-[150px] h-[150px]",
|
|
22
|
+
M: "w-[200px] h-[200px]",
|
|
23
|
+
L: "w-[300px] h-[300px]",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
size: "S",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
size?: "S" | "M" | "L"; // this is used to change the size style of the component
|
|
33
|
+
theme?: "light" | "dark" | "default";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function SpinLoading({ className, theme = "light", size = "M", ...props }: Props) {
|
|
37
|
+
return (
|
|
38
|
+
<section data-theme={theme} {...props} className={cn(loadingFrame({ size }), className)}>
|
|
39
|
+
<DarkRingLoadingIcon
|
|
40
|
+
data-theme={theme}
|
|
41
|
+
className="w-full h-full animate-spin bg-transparent object-cover object-center hidden data-[theme=dark]:flex"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
{/* Light Theme Loader */}
|
|
45
|
+
<RingLoadingIcon
|
|
46
|
+
data-theme={theme}
|
|
47
|
+
className="w-full h-full animate-spin bg-transparent object-cover object-center hidden data-[theme=light]:flex"
|
|
48
|
+
/>
|
|
49
|
+
<section
|
|
50
|
+
className={cn(
|
|
51
|
+
"absolute flex justify-center items-center top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
{props.children}
|
|
55
|
+
</section>
|
|
56
|
+
</section>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
64
|
+
<svg
|
|
65
|
+
{...props}
|
|
66
|
+
id="e7Ze8cPfGzd1"
|
|
67
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
68
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
69
|
+
viewBox="0 0 216 216"
|
|
70
|
+
shapeRendering="geometricPrecision"
|
|
71
|
+
textRendering="geometricPrecision"
|
|
72
|
+
>
|
|
73
|
+
<defs>
|
|
74
|
+
<filter
|
|
75
|
+
id="e7Ze8cPfGzd3-filter"
|
|
76
|
+
x="-150%"
|
|
77
|
+
width="400%"
|
|
78
|
+
y="-150%"
|
|
79
|
+
height="400%"
|
|
80
|
+
>
|
|
81
|
+
<feGaussianBlur
|
|
82
|
+
id="e7Ze8cPfGzd3-filter-blur-0"
|
|
83
|
+
stdDeviation="4,4"
|
|
84
|
+
result="result"
|
|
85
|
+
/>
|
|
86
|
+
</filter>
|
|
87
|
+
<linearGradient
|
|
88
|
+
id="e7Ze8cPfGzd4-fill"
|
|
89
|
+
x1="16"
|
|
90
|
+
y1="116"
|
|
91
|
+
x2="126.065"
|
|
92
|
+
y2="28.6871"
|
|
93
|
+
spreadMethod="pad"
|
|
94
|
+
gradientUnits="userSpaceOnUse"
|
|
95
|
+
gradientTransform="translate(0 0)"
|
|
96
|
+
>
|
|
97
|
+
<stop
|
|
98
|
+
id="e7Ze8cPfGzd4-fill-0"
|
|
99
|
+
offset="0%"
|
|
100
|
+
stopColor="rgba(83,23,255,0)"
|
|
101
|
+
/>
|
|
102
|
+
<stop id="e7Ze8cPfGzd4-fill-1" offset="100%" stopColor="#b900d8" />
|
|
103
|
+
</linearGradient>
|
|
104
|
+
<filter
|
|
105
|
+
id="e7Ze8cPfGzd5-filter"
|
|
106
|
+
x="-150%"
|
|
107
|
+
width="400%"
|
|
108
|
+
y="-150%"
|
|
109
|
+
height="400%"
|
|
110
|
+
>
|
|
111
|
+
<feGaussianBlur
|
|
112
|
+
id="e7Ze8cPfGzd5-filter-blur-0"
|
|
113
|
+
stdDeviation="8,8"
|
|
114
|
+
result="result"
|
|
115
|
+
/>
|
|
116
|
+
</filter>
|
|
117
|
+
<linearGradient
|
|
118
|
+
id="e7Ze8cPfGzd6-fill"
|
|
119
|
+
x1="16"
|
|
120
|
+
y1="116"
|
|
121
|
+
x2="126.065"
|
|
122
|
+
y2="28.6871"
|
|
123
|
+
spreadMethod="pad"
|
|
124
|
+
gradientUnits="userSpaceOnUse"
|
|
125
|
+
gradientTransform="translate(0 0)"
|
|
126
|
+
>
|
|
127
|
+
<stop
|
|
128
|
+
id="e7Ze8cPfGzd6-fill-0"
|
|
129
|
+
offset="0%"
|
|
130
|
+
stopColor="rgba(83,23,255,0)"
|
|
131
|
+
/>
|
|
132
|
+
<stop id="e7Ze8cPfGzd6-fill-1" offset="100%" stopColor="#b900d8" />
|
|
133
|
+
</linearGradient>
|
|
134
|
+
<linearGradient
|
|
135
|
+
id="e7Ze8cPfGzd7-fill"
|
|
136
|
+
x1="16"
|
|
137
|
+
y1="116"
|
|
138
|
+
x2="126.065"
|
|
139
|
+
y2="28.6871"
|
|
140
|
+
spreadMethod="pad"
|
|
141
|
+
gradientUnits="userSpaceOnUse"
|
|
142
|
+
gradientTransform="translate(0 0)"
|
|
143
|
+
>
|
|
144
|
+
<stop
|
|
145
|
+
id="e7Ze8cPfGzd7-fill-0"
|
|
146
|
+
offset="0%"
|
|
147
|
+
stopColor="rgba(83,23,255,0.3)"
|
|
148
|
+
/>
|
|
149
|
+
<stop id="e7Ze8cPfGzd7-fill-1" offset="100%" stopColor="#e75cff" />
|
|
150
|
+
</linearGradient>
|
|
151
|
+
</defs>
|
|
152
|
+
<path
|
|
153
|
+
d="M116,16c55.228,0,100,44.7715,100,100c0,55.228-44.772,100-100,100-55.2285,0-100-44.772-100-100C16,60.7715,60.7715,16,116,16Zm0,195c52.467,0,95-42.533,95-95s-42.533-95-95-95-95,42.5329-95,95c0,52.467,42.5329,95,95,95Z"
|
|
154
|
+
transform="translate(-8-8)"
|
|
155
|
+
fillOpacity="0.1"
|
|
156
|
+
/>
|
|
157
|
+
<g transform="translate(-7.999968-8)" filter="url(#e7Ze8cPfGzd3-filter)">
|
|
158
|
+
<path
|
|
159
|
+
d="M116,18.5c0-1.3807-1.119-2.5033-2.5-2.4688-12.28.3071-24.4062,2.8745-35.7684,7.5808-12.1325,5.0255-23.1564,12.3915-32.4423,21.6773-9.2858,9.2859-16.6518,20.3098-21.6773,32.4424C18.9057,89.0939,16.3383,101.22,16.0312,113.5c-.0345,1.381,1.0881,2.5,2.4688,2.5s2.4966-1.12,2.5329-2.5c.3059-11.623,2.7434-23.0994,7.1985-33.8549c4.7742-11.5259,11.7719-21.9987,20.5934-30.8202s19.2943-15.8193,30.8203-20.5935c10.7555-4.4551,22.2319-6.8926,33.8549-7.1985c1.38-.0363,2.5-1.1522,2.5-2.5329Z"
|
|
160
|
+
fill="url(#e7Ze8cPfGzd4-fill)"
|
|
161
|
+
/>
|
|
162
|
+
</g>
|
|
163
|
+
<g transform="translate(-8-8)" filter="url(#e7Ze8cPfGzd5-filter)">
|
|
164
|
+
<path
|
|
165
|
+
d="M116,18.5c0-1.3807-1.119-2.5033-2.5-2.4688-12.28.3071-24.4062,2.8745-35.7684,7.5808-12.1325,5.0255-23.1564,12.3915-32.4423,21.6773-9.2858,9.2859-16.6518,20.3098-21.6773,32.4424C18.9057,89.0939,16.3383,101.22,16.0312,113.5c-.0345,1.381,1.0881,2.5,2.4688,2.5s2.4966-1.12,2.5329-2.5c.3059-11.623,2.7434-23.0994,7.1985-33.8549c4.7742-11.5259,11.7719-21.9987,20.5934-30.8202s19.2943-15.8193,30.8203-20.5935c10.7555-4.4551,22.2319-6.8926,33.8549-7.1985c1.38-.0363,2.5-1.1522,2.5-2.5329Z"
|
|
166
|
+
fill="url(#e7Ze8cPfGzd6-fill)"
|
|
167
|
+
/>
|
|
168
|
+
</g>
|
|
169
|
+
<path
|
|
170
|
+
d="M116,18.5c0-1.3807-1.119-2.5033-2.5-2.4688-12.28.3071-24.4062,2.8745-35.7684,7.5808-12.1325,5.0255-23.1564,12.3915-32.4423,21.6773-9.2858,9.2859-16.6518,20.3098-21.6773,32.4424C18.9057,89.0939,16.3383,101.22,16.0312,113.5c-.0345,1.381,1.0881,2.5,2.4688,2.5s2.4966-1.12,2.5329-2.5c.3059-11.623,2.7434-23.0994,7.1985-33.8549c4.7742-11.5259,11.7719-21.9987,20.5934-30.8202s19.2943-15.8193,30.8203-20.5935c10.7555-4.4551,22.2319-6.8926,33.8549-7.1985c1.38-.0363,2.5-1.1522,2.5-2.5329Z"
|
|
171
|
+
transform="translate(-8-8)"
|
|
172
|
+
fill="url(#e7Ze8cPfGzd7-fill)"
|
|
173
|
+
/>
|
|
174
|
+
</svg>
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
const RingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
180
|
+
<svg {...props} width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
181
|
+
<path d="M200 100C200 155.228 155.228 200 100 200C44.7715 200 0 155.228 0 100C0 44.7715 44.7715 0 100 0C155.228 0 200 44.7715 200 100ZM5 100C5 152.467 47.5329 195 100 195C152.467 195 195 152.467 195 100C195 47.5329 152.467 5 100 5C47.5329 5 5 47.5329 5 100Z" fill="black" fillOpacity="0.1" />
|
|
182
|
+
<path d="M197.5 100C198.881 100 200.003 98.8805 199.969 97.5002C199.662 85.22 197.094 73.0938 192.388 61.7317C187.362 49.5991 179.997 38.5752 170.711 29.2893C161.425 20.0035 150.401 12.6375 138.268 7.61205C126.906 2.90567 114.78 0.338305 102.5 0.031247C101.119 -0.00326585 100 1.11929 100 2.5C100 3.88071 101.12 4.99656 102.5 5.03289C114.123 5.33884 125.599 7.77635 136.355 12.2314C147.881 17.0056 158.354 24.0033 167.175 32.8249C175.997 41.6464 182.994 52.1191 187.769 63.6451C192.224 74.4006 194.661 85.8767 194.967 97.5002C195.003 98.8805 196.119 100 197.5 100Z" fill="url(#paint0_linear_10856_138364)" />
|
|
183
|
+
<defs>
|
|
184
|
+
<linearGradient id="paint0_linear_10856_138364" x1="3.4045" y1="-9.09091" x2="225.705" y2="19.8973" gradientUnits="userSpaceOnUse">
|
|
185
|
+
<stop stopColor="#D500F9" />
|
|
186
|
+
<stop offset="1" stopColor="#5317FF" />
|
|
187
|
+
</linearGradient>
|
|
188
|
+
</defs>
|
|
189
|
+
</svg>
|
|
190
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from "react";
|
|
2
|
+
import { cn } from "../utils/cn";
|
|
3
|
+
import { Label } from "./Label";
|
|
4
|
+
|
|
5
|
+
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
active: boolean;
|
|
7
|
+
activeLabel?: string;
|
|
8
|
+
disabledLabel?: string;
|
|
9
|
+
theme?: "dark" | "light" | "default";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function Switcher({
|
|
13
|
+
active,
|
|
14
|
+
activeLabel,
|
|
15
|
+
disabledLabel,
|
|
16
|
+
theme,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: Props) {
|
|
20
|
+
return (
|
|
21
|
+
<section data-theme={theme} className={cn("flex justify-center items-center w-fit h-[28px] gap-[6px] overflow-hidden", className)}>
|
|
22
|
+
<button
|
|
23
|
+
{...props}
|
|
24
|
+
className={cn(
|
|
25
|
+
"flex p-[2px] items-center w-[48px] h-[28px] rounded-full bg-background-presentation-switcher-disabled relative transition-all duration-200 overflow-hidden",
|
|
26
|
+
{
|
|
27
|
+
"bg-background-presentation-switcher-active": active,
|
|
28
|
+
}
|
|
29
|
+
)}
|
|
30
|
+
>
|
|
31
|
+
<div
|
|
32
|
+
className={cn(
|
|
33
|
+
"absolute left-[2px] w-[24px] h-[24px] rounded-full bg-background-presentation-switcher-knob shadow-[0px_0px_0px_1px_rgba(0,0,0,0.04),0px_3px_8px_0px_rgba(0,0,0,0.15),0px_3px_1px_0px_rgba(0,0,0,0.06)] transition-all duration-200",
|
|
34
|
+
{
|
|
35
|
+
"left-[22px]": active,
|
|
36
|
+
}
|
|
37
|
+
)}
|
|
38
|
+
/>
|
|
39
|
+
</button>
|
|
40
|
+
|
|
41
|
+
{activeLabel && (
|
|
42
|
+
<section
|
|
43
|
+
className={cn(
|
|
44
|
+
"flex justify-center items-start flex-col gap-[10px] translate-y-[-15px] transition-all duration-300 ease-in-out",
|
|
45
|
+
{
|
|
46
|
+
"translate-y-[15px]": active,
|
|
47
|
+
}
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
<Label className="h-[20px]" size="M" label={activeLabel} />
|
|
51
|
+
<Label className="h-[20px]" size="M" label={disabledLabel} />
|
|
52
|
+
</section>
|
|
53
|
+
)}
|
|
54
|
+
</section>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from "react";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../utils/cn";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
|
|
6
|
+
export const formBarItemStyles = cva(
|
|
7
|
+
[
|
|
8
|
+
"flex",
|
|
9
|
+
"items-center",
|
|
10
|
+
"justify-center",
|
|
11
|
+
"text-ellipsis",
|
|
12
|
+
"overflow-hidden",
|
|
13
|
+
"whitespace-nowrap",
|
|
14
|
+
"rounded-[4px]",
|
|
15
|
+
"border-transparent",
|
|
16
|
+
"outline-none",
|
|
17
|
+
"transition-all",
|
|
18
|
+
"duration-300",
|
|
19
|
+
"ease-in-out",
|
|
20
|
+
"text-content-presentation-global-primary",
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
componentType: {
|
|
25
|
+
side: [
|
|
26
|
+
"px-[8px]",
|
|
27
|
+
"h-[36px]",
|
|
28
|
+
"w-full",
|
|
29
|
+
"border",
|
|
30
|
+
"px-[8px]",
|
|
31
|
+
"justify-start",
|
|
32
|
+
"bg-background-presentation-tab-sidebar-primary",
|
|
33
|
+
"border-border-presentation-tab-sidebar-primary",
|
|
34
|
+
"hover:bg-border-presentation-tab-sidebar-primary",
|
|
35
|
+
"hover:border-border-presentation-tab-sidebar-primary",
|
|
36
|
+
"hover:px-[16px]",
|
|
37
|
+
"focus:bg-background-presentation-tab-sidebar-selected focus:hover:bg-background-presentation-tab-sidebar-selected",
|
|
38
|
+
"focus:text-content-presentation-action-dark-primary focus:hover:text-content-presentation-action-dark-primary",
|
|
39
|
+
"focus:border-transparent focus:hover:border-transparent",
|
|
40
|
+
"focus:px-[8px] focus:hover:px-[8px]",
|
|
41
|
+
"active:text-content-presentation-action-dark-primary active:hover:text-content-presentation-action-dark-primary",
|
|
42
|
+
"active:border-transparent active:hover:border-transparent",
|
|
43
|
+
"active:px-[8px] active:hover:px-[8px]",
|
|
44
|
+
],
|
|
45
|
+
top: [
|
|
46
|
+
"px-[24px]",
|
|
47
|
+
"h-[28px]",
|
|
48
|
+
"bg-background-presentation-tab-topbar-primary",
|
|
49
|
+
"hover:bg-background-presentation-tab-topbar-hover",
|
|
50
|
+
"hover:text-content-presentation-tab-action-hover",
|
|
51
|
+
"hover:border-border-presentation-tab-topbar-hover",
|
|
52
|
+
"focus:bg-background-presentation-tab-topbar-selected focus:hover:bg-background-presentation-tab-topbar-selected",
|
|
53
|
+
"focus:text-content-presentation-tab-action-selected focus:hover:text-content-presentation-tab-action-selected",
|
|
54
|
+
"focus:border-border-presentation-tab-topbar-selected focus:hover:border-border-presentation-tab-topbar-selected",
|
|
55
|
+
"active:bg-background-presentation-tab-topbar-selected active:hover:bg-background-presentation-tab-topbar-selected",
|
|
56
|
+
"active:text-content-presentation-tab-action-selected active:hover:text-content-presentation-tab-action-selected",
|
|
57
|
+
"active:border-border-presentation-tab-topbar-selected active:hover:border-border-presentation-tab-topbar-selected",
|
|
58
|
+
],
|
|
59
|
+
tree: [
|
|
60
|
+
"px-[8px]",
|
|
61
|
+
"h-[36px]",
|
|
62
|
+
"w-full",
|
|
63
|
+
"border",
|
|
64
|
+
"px-[8px]",
|
|
65
|
+
"justify-start",
|
|
66
|
+
"hover:bg-border-presentation-tab-sidebar-primary",
|
|
67
|
+
"hover:px-[16px]",
|
|
68
|
+
"focus:bg-background-presentation-tab-sidebar-selected focus:hover:bg-background-presentation-tab-sidebar-selected",
|
|
69
|
+
"focus:text-content-presentation-action-dark-primary focus:hover:text-content-presentation-action-dark-primary",
|
|
70
|
+
"focus:border-transparent focus:hover:border-transparent",
|
|
71
|
+
"focus:px-[8px] focus:hover:px-[8px]",
|
|
72
|
+
"active:text-content-presentation-action-dark-primary active:hover:text-content-presentation-action-dark-primary",
|
|
73
|
+
"active:border-transparent active:hover:border-transparent",
|
|
74
|
+
"active:px-[8px] active:hover:px-[8px]",
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
active: {
|
|
78
|
+
true: "",
|
|
79
|
+
},
|
|
80
|
+
buttonType: {
|
|
81
|
+
button: "",
|
|
82
|
+
icon: "h-[28px] w-[28px] !p-0 [&_i]:text-inherit justify-center",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
defaultVariants: {
|
|
86
|
+
componentType: "side",
|
|
87
|
+
buttonType: "button",
|
|
88
|
+
},
|
|
89
|
+
compoundVariants: [
|
|
90
|
+
{
|
|
91
|
+
componentType: "side",
|
|
92
|
+
active: true,
|
|
93
|
+
className: [
|
|
94
|
+
"bg-background-presentation-tab-sidebar-selected hover:bg-background-presentation-tab-sidebar-selected",
|
|
95
|
+
"text-content-presentation-action-dark-primary hover:text-content-presentation-action-dark-primary",
|
|
96
|
+
"border-transparent hover:border-transparent",
|
|
97
|
+
"px-[8px] hover:px-[8px]",
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
componentType: "top",
|
|
102
|
+
active: true,
|
|
103
|
+
className: [
|
|
104
|
+
"bg-background-presentation-tab-topbar-selected hover:bg-background-presentation-tab-topbar-selected",
|
|
105
|
+
"text-content-presentation-tab-action-selected hover:text-content-presentation-tab-action-selected",
|
|
106
|
+
"border-border-presentation-tab-topbar-selected hover:border-border-presentation-tab-topbar-selected",
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
componentType: "tree",
|
|
111
|
+
active: true,
|
|
112
|
+
className: [
|
|
113
|
+
"bg-background-presentation-tab-topbar-selected hover:bg-background-presentation-tab-topbar-selected",
|
|
114
|
+
"text-content-presentation-tab-action-selected hover:text-content-presentation-tab-action-selected",
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
],
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
122
|
+
componentType: "top" | "side" | "tree"; // component type and style see on the figma design file
|
|
123
|
+
active?: boolean;
|
|
124
|
+
buttonType?: "icon" | "button";
|
|
125
|
+
theme?: "dark" | "light" | "default";
|
|
126
|
+
asChild?: boolean;
|
|
127
|
+
as?: React.ElementType;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
const TabFormItem: React.FC<Props> = ({
|
|
132
|
+
componentType,
|
|
133
|
+
active,
|
|
134
|
+
buttonType,
|
|
135
|
+
theme,
|
|
136
|
+
asChild,
|
|
137
|
+
className,
|
|
138
|
+
as: Tag = "button",
|
|
139
|
+
...props
|
|
140
|
+
}) => {
|
|
141
|
+
|
|
142
|
+
const Component = asChild ? Slot : Tag;
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<Component
|
|
146
|
+
data-theme={theme}
|
|
147
|
+
{...props}
|
|
148
|
+
className={cn(
|
|
149
|
+
formBarItemStyles({ componentType, active, buttonType }),
|
|
150
|
+
className
|
|
151
|
+
)}
|
|
152
|
+
>
|
|
153
|
+
{props.children}
|
|
154
|
+
</Component>
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export default TabFormItem;
|