@rovula/ui 0.1.1 → 0.1.3
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/cjs/bundle.css +358 -73
- package/dist/cjs/bundle.js +1564 -1570
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/ActionButton/ActionButton.d.ts +4 -2
- package/dist/cjs/types/components/ActionButton/ActionButton.stories.d.ts +30 -8
- package/dist/cjs/types/components/ActionButton/ActionButton.styles.d.ts +2 -1
- package/dist/cjs/types/components/Avatar/Avatar.styles.d.ts +1 -1
- package/dist/cjs/types/components/Button/Button.d.ts +4 -2
- package/dist/cjs/types/components/Button/Button.styles.d.ts +2 -1
- package/dist/cjs/types/components/Button/Buttons.stories.d.ts +71 -6
- package/dist/cjs/types/components/Checkbox/Checkbox.stories.d.ts +13 -9
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +1 -0
- package/dist/cjs/types/components/InputFilter/InputFilter.stories.d.ts +1 -0
- package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.d.ts +1 -0
- package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +2 -0
- package/dist/cjs/types/components/PasswordInput/PasswordInput.stories.d.ts +1 -0
- package/dist/cjs/types/components/RadioGroup/RadioGroup.stories.d.ts +10 -7
- package/dist/cjs/types/components/Search/Search.stories.d.ts +1 -0
- package/dist/cjs/types/components/TextInput/TextInput.d.ts +2 -0
- package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +10 -0
- package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +15 -0
- package/dist/components/ActionButton/ActionButton.js +2 -1
- package/dist/components/ActionButton/ActionButton.stories.js +40 -7
- package/dist/components/ActionButton/ActionButton.styles.js +77 -17
- package/dist/components/Button/Button.js +9 -2
- package/dist/components/Button/Button.styles.js +51 -14
- package/dist/components/Button/Buttons.stories.js +55 -0
- package/dist/components/Checkbox/Checkbox.js +6 -7
- package/dist/components/Checkbox/Checkbox.stories.js +23 -1
- package/dist/components/InputFilter/InputFilter.js +1 -1
- package/dist/components/InputFilter/InputFilter.styles.js +1 -1
- package/dist/components/PasswordInput/PasswordInput.js +2 -2
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.stories.js +16 -1
- package/dist/components/TextArea/TextArea.styles.js +1 -1
- package/dist/components/TextInput/TextInput.js +33 -24
- package/dist/components/TextInput/TextInput.stories.js +14 -2
- package/dist/components/TextInput/TextInput.styles.js +25 -10
- package/dist/esm/bundle.css +358 -73
- package/dist/esm/bundle.js +1564 -1570
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/ActionButton/ActionButton.d.ts +4 -2
- package/dist/esm/types/components/ActionButton/ActionButton.stories.d.ts +30 -8
- package/dist/esm/types/components/ActionButton/ActionButton.styles.d.ts +2 -1
- package/dist/esm/types/components/Avatar/Avatar.styles.d.ts +1 -1
- package/dist/esm/types/components/Button/Button.d.ts +4 -2
- package/dist/esm/types/components/Button/Button.styles.d.ts +2 -1
- package/dist/esm/types/components/Button/Buttons.stories.d.ts +71 -6
- package/dist/esm/types/components/Checkbox/Checkbox.stories.d.ts +13 -9
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +1 -0
- package/dist/esm/types/components/InputFilter/InputFilter.stories.d.ts +1 -0
- package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.d.ts +1 -0
- package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +2 -0
- package/dist/esm/types/components/PasswordInput/PasswordInput.stories.d.ts +1 -0
- package/dist/esm/types/components/RadioGroup/RadioGroup.stories.d.ts +10 -7
- package/dist/esm/types/components/Search/Search.stories.d.ts +1 -0
- package/dist/esm/types/components/TextInput/TextInput.d.ts +2 -0
- package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +10 -0
- package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +15 -0
- package/dist/index.d.ts +9 -3
- package/dist/src/theme/global.css +453 -84
- package/package.json +1 -1
- package/src/components/ActionButton/ActionButton.stories.tsx +105 -149
- package/src/components/ActionButton/ActionButton.styles.ts +78 -18
- package/src/components/ActionButton/ActionButton.tsx +7 -2
- package/src/components/Button/Button.styles.ts +51 -14
- package/src/components/Button/Button.tsx +11 -2
- package/src/components/Button/Buttons.stories.tsx +235 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +50 -4
- package/src/components/Checkbox/Checkbox.tsx +12 -8
- package/src/components/InputFilter/InputFilter.styles.ts +2 -2
- package/src/components/InputFilter/InputFilter.tsx +21 -24
- package/src/components/PasswordInput/PasswordInput.tsx +2 -2
- package/src/components/RadioGroup/RadioGroup.stories.tsx +43 -4
- package/src/components/RadioGroup/RadioGroup.tsx +1 -1
- package/src/components/TextArea/TextArea.styles.ts +1 -1
- package/src/components/TextInput/TextInput.stories.tsx +60 -2
- package/src/components/TextInput/TextInput.styles.ts +36 -19
- package/src/components/TextInput/TextInput.tsx +83 -55
- package/src/theme/themes/variable.css +1 -1
|
@@ -6,6 +6,7 @@ import Loading from "../Loading/Loading";
|
|
|
6
6
|
export type ButtonProps = {
|
|
7
7
|
title?: string;
|
|
8
8
|
size?: "sm" | "md" | "lg";
|
|
9
|
+
shape?: "round" | "capsule";
|
|
9
10
|
color?:
|
|
10
11
|
| "primary"
|
|
11
12
|
| "secondary"
|
|
@@ -14,7 +15,7 @@ export type ButtonProps = {
|
|
|
14
15
|
| "info"
|
|
15
16
|
| "warning"
|
|
16
17
|
| "error";
|
|
17
|
-
variant?: "solid" | "outline" | "flat" | "link";
|
|
18
|
+
variant?: "solid" | "outline" | "flat" | "text" | "link";
|
|
18
19
|
disabled?: boolean;
|
|
19
20
|
isLoading?: boolean;
|
|
20
21
|
fullwidth?: boolean;
|
|
@@ -27,6 +28,7 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
27
28
|
(
|
|
28
29
|
{
|
|
29
30
|
size = "md",
|
|
31
|
+
shape = "round",
|
|
30
32
|
color = "primary",
|
|
31
33
|
variant = "solid",
|
|
32
34
|
title,
|
|
@@ -52,7 +54,14 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
52
54
|
data-loading={isLoading || undefined}
|
|
53
55
|
tabIndex={isDisabled ? -1 : 0}
|
|
54
56
|
className={cn(
|
|
55
|
-
buttonVariants({
|
|
57
|
+
buttonVariants({
|
|
58
|
+
size,
|
|
59
|
+
shape,
|
|
60
|
+
color,
|
|
61
|
+
variant,
|
|
62
|
+
disabled,
|
|
63
|
+
fullwidth,
|
|
64
|
+
}),
|
|
56
65
|
className
|
|
57
66
|
)}
|
|
58
67
|
disabled={isDisabled}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { ArrowsUpDownIcon } from "@heroicons/react/16/solid";
|
|
3
4
|
|
|
4
5
|
import Button from "./Button";
|
|
5
6
|
|
|
@@ -8,6 +9,12 @@ const meta = {
|
|
|
8
9
|
title: "Components/Button",
|
|
9
10
|
component: Button,
|
|
10
11
|
tags: ["autodocs"],
|
|
12
|
+
argTypes: {
|
|
13
|
+
shape: {
|
|
14
|
+
control: { type: "inline-radio" },
|
|
15
|
+
options: ["round", "capsule"],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
11
18
|
parameters: {
|
|
12
19
|
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
13
20
|
layout: "fullscreen",
|
|
@@ -29,6 +36,7 @@ export const Solid = {
|
|
|
29
36
|
title: "Button",
|
|
30
37
|
disabled: false,
|
|
31
38
|
isLoading: false,
|
|
39
|
+
shape: "round",
|
|
32
40
|
},
|
|
33
41
|
render: (args) => {
|
|
34
42
|
const props: typeof args = {
|
|
@@ -55,6 +63,7 @@ export const Outline = {
|
|
|
55
63
|
variant: "outline",
|
|
56
64
|
disabled: false,
|
|
57
65
|
isLoading: false,
|
|
66
|
+
shape: "round",
|
|
58
67
|
},
|
|
59
68
|
render: (args) => {
|
|
60
69
|
const props: typeof args = {
|
|
@@ -81,6 +90,34 @@ export const Flat = {
|
|
|
81
90
|
variant: "flat",
|
|
82
91
|
disabled: false,
|
|
83
92
|
isLoading: false,
|
|
93
|
+
shape: "round",
|
|
94
|
+
},
|
|
95
|
+
render: (args) => {
|
|
96
|
+
const props: typeof args = {
|
|
97
|
+
...args,
|
|
98
|
+
className: "capitalize",
|
|
99
|
+
};
|
|
100
|
+
return (
|
|
101
|
+
<div className="flex gap-2">
|
|
102
|
+
<Button color="primary" {...props} title="primary" />
|
|
103
|
+
<Button color="secondary" {...props} title="secondary" />
|
|
104
|
+
<Button color="tertiary" {...props} title="tertiary" />
|
|
105
|
+
<Button color="info" {...props} title="info" />
|
|
106
|
+
<Button color="success" {...props} title="success" />
|
|
107
|
+
<Button color="warning" {...props} title="warning" />
|
|
108
|
+
<Button color="error" {...props} title="error" />
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
} satisfies Story;
|
|
113
|
+
|
|
114
|
+
export const Text = {
|
|
115
|
+
args: {
|
|
116
|
+
title: "Button",
|
|
117
|
+
variant: "text",
|
|
118
|
+
disabled: false,
|
|
119
|
+
isLoading: false,
|
|
120
|
+
shape: "round",
|
|
84
121
|
},
|
|
85
122
|
render: (args) => {
|
|
86
123
|
const props: typeof args = {
|
|
@@ -107,6 +144,7 @@ export const Link = {
|
|
|
107
144
|
variant: "link",
|
|
108
145
|
disabled: false,
|
|
109
146
|
isLoading: false,
|
|
147
|
+
shape: "round",
|
|
110
148
|
},
|
|
111
149
|
render: (args) => {
|
|
112
150
|
const props: typeof args = {
|
|
@@ -126,3 +164,200 @@ export const Link = {
|
|
|
126
164
|
);
|
|
127
165
|
},
|
|
128
166
|
} satisfies Story;
|
|
167
|
+
|
|
168
|
+
export const ShapePreview = {
|
|
169
|
+
args: {
|
|
170
|
+
variant: "solid",
|
|
171
|
+
color: "primary",
|
|
172
|
+
},
|
|
173
|
+
render: (args) => (
|
|
174
|
+
<div className="flex flex-col gap-3">
|
|
175
|
+
<div className="flex items-center gap-2">
|
|
176
|
+
<span className="w-20 typography-subtitile4">Round</span>
|
|
177
|
+
<Button {...args} shape="round" size="lg" title="Large" />
|
|
178
|
+
<Button {...args} shape="round" size="md" title="Medium" />
|
|
179
|
+
<Button {...args} shape="round" size="sm" title="Small" />
|
|
180
|
+
</div>
|
|
181
|
+
<div className="flex items-center gap-2">
|
|
182
|
+
<span className="w-20 typography-subtitile4">Capsule</span>
|
|
183
|
+
<Button {...args} shape="capsule" size="lg" title="Large" />
|
|
184
|
+
<Button {...args} shape="capsule" size="md" title="Medium" />
|
|
185
|
+
<Button {...args} shape="capsule" size="sm" title="Small" />
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
),
|
|
189
|
+
} satisfies Story;
|
|
190
|
+
|
|
191
|
+
const previewColors: Array<
|
|
192
|
+
"primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error"
|
|
193
|
+
> = ["primary", "secondary", "tertiary", "info", "success", "warning", "error"];
|
|
194
|
+
const previewSizes: Array<"lg" | "md" | "sm"> = ["lg", "md", "sm"];
|
|
195
|
+
const previewSizeLabel: Record<(typeof previewSizes)[number], string> = {
|
|
196
|
+
lg: "Large",
|
|
197
|
+
md: "Medium",
|
|
198
|
+
sm: "Small",
|
|
199
|
+
};
|
|
200
|
+
const previewStyles: Array<{ label: string; variant: "solid" | "outline" | "text"; }> =
|
|
201
|
+
[
|
|
202
|
+
{ label: "Solid", variant: "solid" },
|
|
203
|
+
{ label: "Outline", variant: "outline" },
|
|
204
|
+
{ label: "Text", variant: "text" },
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
const icon = <ArrowsUpDownIcon />;
|
|
208
|
+
const previewStates = [
|
|
209
|
+
{ label: "Default", isLoading: false, disabled: false },
|
|
210
|
+
{ label: "Loading", isLoading: true, disabled: false },
|
|
211
|
+
{ label: "Disable", isLoading: false, disabled: true },
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
export const FigmaPreview = {
|
|
215
|
+
render: () => (
|
|
216
|
+
<div className="bg-base-bg2 p-8 min-h-screen">
|
|
217
|
+
<div className="flex flex-col gap-10">
|
|
218
|
+
{previewColors.map((color) => (
|
|
219
|
+
<div key={color} className="flex flex-col gap-2">
|
|
220
|
+
<h3 className="text-xl font-semibold tracking-wide text-text-white capitalize">
|
|
221
|
+
{color} btn
|
|
222
|
+
</h3>
|
|
223
|
+
|
|
224
|
+
{previewStates.map((state) => (
|
|
225
|
+
<div
|
|
226
|
+
key={state.label}
|
|
227
|
+
className="grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-2"
|
|
228
|
+
>
|
|
229
|
+
{/* <span className="pt-3 text-sm font-semibold text-text-white">
|
|
230
|
+
{state.label}
|
|
231
|
+
</span> */}
|
|
232
|
+
|
|
233
|
+
{previewStyles.map((style) => (
|
|
234
|
+
<div
|
|
235
|
+
key={style.label}
|
|
236
|
+
className="h-full rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-3"
|
|
237
|
+
>
|
|
238
|
+
<span className="text-xs font-semibold tracking-wide text-text-white uppercase">
|
|
239
|
+
{style.label} ({state.label})
|
|
240
|
+
</span>
|
|
241
|
+
|
|
242
|
+
<div className="mt-3 flex flex-col gap-2">
|
|
243
|
+
{previewSizes.map((size) => (
|
|
244
|
+
<div key={size} className="flex items-center gap-2">
|
|
245
|
+
<Button
|
|
246
|
+
color={color}
|
|
247
|
+
variant={style.variant}
|
|
248
|
+
size={size}
|
|
249
|
+
title={previewSizeLabel[size]}
|
|
250
|
+
startIcon={icon}
|
|
251
|
+
isLoading={state.isLoading}
|
|
252
|
+
disabled={state.disabled}
|
|
253
|
+
fullwidth={false}
|
|
254
|
+
/>
|
|
255
|
+
<Button
|
|
256
|
+
color={color}
|
|
257
|
+
variant={style.variant}
|
|
258
|
+
size={size}
|
|
259
|
+
title={previewSizeLabel[size]}
|
|
260
|
+
isLoading={state.isLoading}
|
|
261
|
+
disabled={state.disabled}
|
|
262
|
+
fullwidth={false}
|
|
263
|
+
/>
|
|
264
|
+
<Button
|
|
265
|
+
color={color}
|
|
266
|
+
variant={style.variant}
|
|
267
|
+
size={size}
|
|
268
|
+
title={previewSizeLabel[size]}
|
|
269
|
+
endIcon={icon}
|
|
270
|
+
isLoading={state.isLoading}
|
|
271
|
+
disabled={state.disabled}
|
|
272
|
+
fullwidth={false}
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
))}
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
))}
|
|
279
|
+
</div>
|
|
280
|
+
))}
|
|
281
|
+
</div>
|
|
282
|
+
))}
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
),
|
|
286
|
+
} satisfies Story;
|
|
287
|
+
|
|
288
|
+
export const FigmaPreviewCapsule = {
|
|
289
|
+
render: () => (
|
|
290
|
+
<div className="bg-base-bg2 p-8 min-h-screen">
|
|
291
|
+
<div className="flex flex-col gap-10">
|
|
292
|
+
{previewColors.map((color) => (
|
|
293
|
+
<div key={color} className="flex flex-col gap-4">
|
|
294
|
+
<h3 className="text-xl font-semibold tracking-wide text-text-white capitalize">
|
|
295
|
+
{color} btn
|
|
296
|
+
</h3>
|
|
297
|
+
|
|
298
|
+
{previewStates.map((state) => (
|
|
299
|
+
<div
|
|
300
|
+
key={state.label}
|
|
301
|
+
className="grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-4"
|
|
302
|
+
>
|
|
303
|
+
{/* <span className="pt-3 text-sm font-semibold text-text-white">
|
|
304
|
+
{state.label}
|
|
305
|
+
</span> */}
|
|
306
|
+
|
|
307
|
+
{previewStyles.map((style) => (
|
|
308
|
+
<div
|
|
309
|
+
key={style.label}
|
|
310
|
+
className="h-full rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-3"
|
|
311
|
+
>
|
|
312
|
+
<span className="text-xs font-semibold tracking-wide text-text-white uppercase">
|
|
313
|
+
{style.label} ({state.label})
|
|
314
|
+
</span>
|
|
315
|
+
|
|
316
|
+
<div className="mt-3 flex flex-col gap-2">
|
|
317
|
+
{previewSizes.map((size) => (
|
|
318
|
+
<div key={size} className="flex items-center gap-2">
|
|
319
|
+
<Button
|
|
320
|
+
color={color}
|
|
321
|
+
variant={style.variant}
|
|
322
|
+
size={size}
|
|
323
|
+
shape="capsule"
|
|
324
|
+
title={previewSizeLabel[size]}
|
|
325
|
+
startIcon={icon}
|
|
326
|
+
isLoading={state.isLoading}
|
|
327
|
+
disabled={state.disabled}
|
|
328
|
+
fullwidth={false}
|
|
329
|
+
/>
|
|
330
|
+
<Button
|
|
331
|
+
color={color}
|
|
332
|
+
variant={style.variant}
|
|
333
|
+
size={size}
|
|
334
|
+
shape="capsule"
|
|
335
|
+
title={previewSizeLabel[size]}
|
|
336
|
+
isLoading={state.isLoading}
|
|
337
|
+
disabled={state.disabled}
|
|
338
|
+
fullwidth={false}
|
|
339
|
+
/>
|
|
340
|
+
<Button
|
|
341
|
+
color={color}
|
|
342
|
+
variant={style.variant}
|
|
343
|
+
size={size}
|
|
344
|
+
shape="capsule"
|
|
345
|
+
title={previewSizeLabel[size]}
|
|
346
|
+
endIcon={icon}
|
|
347
|
+
isLoading={state.isLoading}
|
|
348
|
+
disabled={state.disabled}
|
|
349
|
+
fullwidth={false}
|
|
350
|
+
/>
|
|
351
|
+
</div>
|
|
352
|
+
))}
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
))}
|
|
356
|
+
</div>
|
|
357
|
+
))}
|
|
358
|
+
</div>
|
|
359
|
+
))}
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
),
|
|
363
|
+
} satisfies Story;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import type { CheckedState } from "@radix-ui/react-checkbox";
|
|
3
4
|
import { Checkbox } from "./Checkbox";
|
|
4
5
|
|
|
5
6
|
const meta = {
|
|
@@ -19,6 +20,7 @@ const meta = {
|
|
|
19
20
|
} satisfies Meta<typeof Checkbox>;
|
|
20
21
|
|
|
21
22
|
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
22
24
|
|
|
23
25
|
export const Default = {
|
|
24
26
|
args: {
|
|
@@ -43,7 +45,7 @@ export const Default = {
|
|
|
43
45
|
</div>
|
|
44
46
|
);
|
|
45
47
|
},
|
|
46
|
-
} satisfies
|
|
48
|
+
} satisfies Story;
|
|
47
49
|
|
|
48
50
|
export const WithText = {
|
|
49
51
|
args: {},
|
|
@@ -68,9 +70,9 @@ export const WithText = {
|
|
|
68
70
|
</div>
|
|
69
71
|
);
|
|
70
72
|
},
|
|
71
|
-
} satisfies
|
|
73
|
+
} satisfies Story;
|
|
72
74
|
|
|
73
|
-
export const
|
|
75
|
+
export const Disabled = {
|
|
74
76
|
args: {},
|
|
75
77
|
render: (args) => {
|
|
76
78
|
const props: typeof args = {
|
|
@@ -88,4 +90,48 @@ export const Diabled = {
|
|
|
88
90
|
</div>
|
|
89
91
|
);
|
|
90
92
|
},
|
|
91
|
-
} satisfies
|
|
93
|
+
} satisfies Story;
|
|
94
|
+
|
|
95
|
+
type CheckboxPreviewRow = {
|
|
96
|
+
label: string;
|
|
97
|
+
checked: CheckedState;
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
className?: string;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const checkboxPreviewRows: CheckboxPreviewRow[] = [
|
|
103
|
+
{ label: "Default", checked: false },
|
|
104
|
+
{ label: "Hover", checked: false, className: "!border-function-default-hover" },
|
|
105
|
+
{ label: "Disable", checked: false, disabled: true },
|
|
106
|
+
{ label: "Checked", checked: true },
|
|
107
|
+
{
|
|
108
|
+
label: "Checked - Hover",
|
|
109
|
+
checked: true,
|
|
110
|
+
className:
|
|
111
|
+
"!data-[state=checked]:border-function-active-hover !data-[state=checked]:bg-function-active-hover",
|
|
112
|
+
},
|
|
113
|
+
{ label: "Checked - Disable", checked: true, disabled: true },
|
|
114
|
+
{ label: "Indeterminate", checked: "indeterminate" },
|
|
115
|
+
{
|
|
116
|
+
label: "Indeterminate - Hover",
|
|
117
|
+
checked: "indeterminate",
|
|
118
|
+
className:
|
|
119
|
+
"!data-[state=indeterminate]:border-function-active-hover !data-[state=indeterminate]:bg-function-active-hover",
|
|
120
|
+
},
|
|
121
|
+
{ label: "Indeterminate - Disable", checked: "indeterminate", disabled: true },
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
export const FigmaPreview = {
|
|
125
|
+
render: () => (
|
|
126
|
+
<div className="bg-base-bg2 p-8 min-h-screen">
|
|
127
|
+
<div className="mx-auto flex w-full max-w-[360px] flex-col gap-4 rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-6">
|
|
128
|
+
{checkboxPreviewRows.map((row) => (
|
|
129
|
+
<div key={row.label} className="grid grid-cols-[160px_16px] items-center gap-4">
|
|
130
|
+
<span className="text-sm font-medium text-text-white">{row.label}</span>
|
|
131
|
+
<Checkbox checked={row.checked} disabled={row.disabled} className={row.className} />
|
|
132
|
+
</div>
|
|
133
|
+
))}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
),
|
|
137
|
+
} satisfies Story;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
5
5
|
|
|
6
|
-
import { CheckIcon } from "@heroicons/react/16/solid";
|
|
6
|
+
import { CheckIcon, MinusIcon } from "@heroicons/react/16/solid";
|
|
7
7
|
|
|
8
8
|
import { cn } from "@/utils/cn";
|
|
9
9
|
|
|
@@ -14,25 +14,29 @@ const Checkbox = React.forwardRef<
|
|
|
14
14
|
<CheckboxPrimitive.Root
|
|
15
15
|
ref={ref}
|
|
16
16
|
className={cn(
|
|
17
|
-
"peer size-4 shrink-0 rounded-[var(--spacing-spacing-xxs,2px)] border border-function-default-solid ring-offset-background",
|
|
17
|
+
"peer size-4 shrink-0 cursor-pointer rounded-[var(--spacing-spacing-xxs,2px)] border border-function-default-solid ring-offset-background",
|
|
18
18
|
"hover:border-function-default-hover",
|
|
19
19
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
20
|
-
"disabled:cursor-not-allowed disabled:border-state-disable-solid disabled:text-state-disable-outline",
|
|
20
|
+
"disabled:cursor-not-allowed disabled:border-state-disable-solid disabled:text-state-disable-outline disabled:data-[state=checked]:bg-state-disable-solid disabled:data-[state=indeterminate]:bg-state-disable-solid",
|
|
21
21
|
{
|
|
22
|
-
"data-[state=checked]:border-function-active-solid data-[state=checked]:bg-function-active-solid data-[state=checked]:text-function-active-icon":
|
|
22
|
+
"data-[state=checked]:border-function-active-solid data-[state=checked]:bg-function-active-solid data-[state=checked]:text-function-active-icon data-[state=indeterminate]:border-function-active-solid data-[state=indeterminate]:bg-function-active-solid data-[state=indeterminate]:text-function-active-icon":
|
|
23
23
|
!props.disabled,
|
|
24
|
-
"hover:data-[state=checked]:border-function-active-hover hover:data-[state=checked]:bg-function-active-hover":
|
|
24
|
+
"hover:data-[state=checked]:border-function-active-hover hover:data-[state=checked]:bg-function-active-hover hover:data-[state=indeterminate]:border-function-active-hover hover:data-[state=indeterminate]:bg-function-active-hover":
|
|
25
25
|
!props.disabled,
|
|
26
|
-
"bg-state-disable-solid": props.checked && props.disabled,
|
|
27
26
|
},
|
|
28
27
|
className
|
|
29
28
|
)}
|
|
30
29
|
{...props}
|
|
31
30
|
>
|
|
32
31
|
<CheckboxPrimitive.Indicator
|
|
33
|
-
className={cn(
|
|
32
|
+
className={cn(
|
|
33
|
+
"flex size-[14px] items-center justify-center text-current",
|
|
34
|
+
"[&[data-state=checked]_.checkbox-check-icon]:block",
|
|
35
|
+
"[&[data-state=indeterminate]_.checkbox-minus-icon]:block"
|
|
36
|
+
)}
|
|
34
37
|
>
|
|
35
|
-
<CheckIcon className="size-
|
|
38
|
+
<CheckIcon className="checkbox-check-icon hidden size-[14px]" />
|
|
39
|
+
<MinusIcon className="checkbox-minus-icon hidden size-[14px]" />
|
|
36
40
|
</CheckboxPrimitive.Indicator>
|
|
37
41
|
</CheckboxPrimitive.Root>
|
|
38
42
|
));
|
|
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority";
|
|
|
4
4
|
export const filterIconVariant = cva(
|
|
5
5
|
[
|
|
6
6
|
// Base styles
|
|
7
|
-
"absolute
|
|
7
|
+
"absolute flex items-center justify-center cursor-pointer",
|
|
8
8
|
|
|
9
9
|
// Border styles
|
|
10
10
|
"border-l border-l-input-default-stroke",
|
|
@@ -70,5 +70,5 @@ export const filterIconVariant = cva(
|
|
|
70
70
|
active: false,
|
|
71
71
|
disabled: false,
|
|
72
72
|
},
|
|
73
|
-
}
|
|
73
|
+
},
|
|
74
74
|
);
|
|
@@ -179,13 +179,12 @@ const InputFilter = forwardRef<HTMLInputElement, InputFilterProps>(
|
|
|
179
179
|
value: option.value,
|
|
180
180
|
label: option.label,
|
|
181
181
|
handleOnClick: () => handleOptionClick(option),
|
|
182
|
-
className: `p-4 typography-subtitile4 hover:bg-gray-100 cursor-pointer flex items-center gap-3 ${
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}`,
|
|
182
|
+
className: `p-4 typography-subtitile4 hover:bg-gray-100 cursor-pointer flex items-center gap-3 ${selectedOptions.some(
|
|
183
|
+
(selected) => selected.value === option.value
|
|
184
|
+
)
|
|
185
|
+
? "bg-gray-200"
|
|
186
|
+
: ""
|
|
187
|
+
}`,
|
|
189
188
|
})}
|
|
190
189
|
</Fragment>
|
|
191
190
|
);
|
|
@@ -194,13 +193,12 @@ const InputFilter = forwardRef<HTMLInputElement, InputFilterProps>(
|
|
|
194
193
|
<li
|
|
195
194
|
key={option.value}
|
|
196
195
|
onMouseDown={() => handleOptionClick(option)}
|
|
197
|
-
className={`p-4 typography-subtitile4 hover:bg-primary-hover-bg cursor-pointer flex items-center gap-3 ${
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}`}
|
|
196
|
+
className={`p-4 typography-subtitile4 hover:bg-primary-hover-bg cursor-pointer flex items-center gap-3 ${selectedOptions.some(
|
|
197
|
+
(selected) => selected.value === option.value
|
|
198
|
+
)
|
|
199
|
+
? "bg-base-popup-highlight"
|
|
200
|
+
: ""
|
|
201
|
+
}`}
|
|
204
202
|
>
|
|
205
203
|
<Checkbox
|
|
206
204
|
checked={selectedOptions.some(
|
|
@@ -272,17 +270,16 @@ const InputFilter = forwardRef<HTMLInputElement, InputFilterProps>(
|
|
|
272
270
|
<TextInput
|
|
273
271
|
hasClearIcon={false}
|
|
274
272
|
endIcon={
|
|
275
|
-
<
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
/>
|
|
284
|
-
</div>
|
|
273
|
+
<Icon
|
|
274
|
+
type="heroicons"
|
|
275
|
+
name="adjustments-horizontal"
|
|
276
|
+
variant="outline"
|
|
277
|
+
color="inherit"
|
|
278
|
+
stroke="inherit"
|
|
279
|
+
fill="transparent"
|
|
280
|
+
/>
|
|
285
281
|
}
|
|
282
|
+
classes={{ endIconWrapper: filterIconClassName }}
|
|
286
283
|
{...props}
|
|
287
284
|
ref={ref}
|
|
288
285
|
readOnly={!filterMode}
|
|
@@ -26,8 +26,8 @@ export const PasswordInput = forwardRef<HTMLInputElement, PasswordInputProps>(
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const toggleIcon = visible
|
|
29
|
-
? showIcon ?? <Icon name="eye" type="lucide" size="inherit" className="size-full" aria-label="Hide password" />
|
|
30
|
-
: hideIcon ?? <Icon name="eye-closed" type="lucide" size="inherit" className="size-full" aria-label="Show password" />;
|
|
29
|
+
? showIcon ?? <Icon name="eye" type="lucide" size="inherit" className="size-full stroke-input-default-stroke hover:stroke-input-active-stroke" aria-label="Hide password" />
|
|
30
|
+
: hideIcon ?? <Icon name="eye-closed" type="lucide" size="inherit" className="size-full stroke-input-default-stroke hover:stroke-input-active-stroke" aria-label="Show password" />;
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<TextInput
|
|
@@ -19,6 +19,7 @@ const meta = {
|
|
|
19
19
|
} satisfies Meta<typeof RadioGroup>;
|
|
20
20
|
|
|
21
21
|
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof RadioGroup>;
|
|
22
23
|
|
|
23
24
|
export const Default = {
|
|
24
25
|
args: {
|
|
@@ -43,9 +44,9 @@ export const Default = {
|
|
|
43
44
|
</div>
|
|
44
45
|
);
|
|
45
46
|
},
|
|
46
|
-
} satisfies
|
|
47
|
+
} satisfies Story;
|
|
47
48
|
|
|
48
|
-
export const
|
|
49
|
+
export const Disabled = {
|
|
49
50
|
args: {
|
|
50
51
|
disabled: true,
|
|
51
52
|
},
|
|
@@ -68,7 +69,7 @@ export const Diabled = {
|
|
|
68
69
|
</div>
|
|
69
70
|
);
|
|
70
71
|
},
|
|
71
|
-
} satisfies
|
|
72
|
+
} satisfies Story;
|
|
72
73
|
|
|
73
74
|
export const Horizontal = {
|
|
74
75
|
args: {
|
|
@@ -95,4 +96,42 @@ export const Horizontal = {
|
|
|
95
96
|
</RadioGroup>
|
|
96
97
|
);
|
|
97
98
|
},
|
|
98
|
-
} satisfies
|
|
99
|
+
} satisfies Story;
|
|
100
|
+
|
|
101
|
+
type RadioPreviewRow = {
|
|
102
|
+
label: string;
|
|
103
|
+
checked: boolean;
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
className?: string;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const radioPreviewRows: RadioPreviewRow[] = [
|
|
109
|
+
{ label: "Default", checked: false },
|
|
110
|
+
{ label: "Hover", checked: false, className: "!border-function-default-hover" },
|
|
111
|
+
{ label: "Disable", checked: false, disabled: true },
|
|
112
|
+
{ label: "Checked", checked: true },
|
|
113
|
+
{
|
|
114
|
+
label: "Checked - Hover",
|
|
115
|
+
checked: true,
|
|
116
|
+
className:
|
|
117
|
+
"!data-[state=checked]:border-function-active-hover !data-[state=checked]:text-function-active-hover",
|
|
118
|
+
},
|
|
119
|
+
{ label: "Checked - Disable", checked: true, disabled: true },
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
export const FigmaPreview = {
|
|
123
|
+
render: () => (
|
|
124
|
+
<div className="bg-base-bg2 p-8 min-h-screen">
|
|
125
|
+
<div className="mx-auto flex w-full max-w-[360px] flex-col gap-4 rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-6">
|
|
126
|
+
{radioPreviewRows.map((row) => (
|
|
127
|
+
<div key={row.label} className="grid grid-cols-[160px_16px] items-center gap-4">
|
|
128
|
+
<span className="text-sm font-medium text-text-white">{row.label}</span>
|
|
129
|
+
<RadioGroup defaultValue={row.checked ? "option" : undefined} disabled={row.disabled}>
|
|
130
|
+
<RadioGroupItem value="option" className={row.className} />
|
|
131
|
+
</RadioGroup>
|
|
132
|
+
</div>
|
|
133
|
+
))}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
),
|
|
137
|
+
} satisfies Story;
|
|
@@ -24,7 +24,7 @@ const RadioGroupItem = React.forwardRef<
|
|
|
24
24
|
<RadioGroupPrimitive.Item
|
|
25
25
|
ref={ref}
|
|
26
26
|
className={cn(
|
|
27
|
-
"aspect-square box-border size-4 rounded-full border border-function-default-solid text-function-default-solid",
|
|
27
|
+
"aspect-square box-border size-4 cursor-pointer rounded-full border border-function-default-solid text-function-default-solid",
|
|
28
28
|
"hover:border-function-default-hover",
|
|
29
29
|
"focus:outline-none",
|
|
30
30
|
// Disabled state styles
|