@rovula/ui 0.1.2 → 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 +294 -73
- package/dist/cjs/bundle.js +3 -3
- 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/RadioGroup/RadioGroup.stories.d.ts +10 -7
- 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/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.stories.js +16 -1
- package/dist/esm/bundle.css +294 -73
- package/dist/esm/bundle.js +115 -115
- 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/RadioGroup/RadioGroup.stories.d.ts +10 -7
- package/dist/index.d.ts +6 -3
- package/dist/src/theme/global.css +370 -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/RadioGroup/RadioGroup.stories.tsx +43 -4
- package/src/components/RadioGroup/RadioGroup.tsx +1 -1
- package/src/theme/themes/variable.css +1 -1
|
@@ -15,8 +15,15 @@ import { buttonVariants } from "./Button.styles";
|
|
|
15
15
|
import { cn } from "@/utils/cn";
|
|
16
16
|
import Loading from "../Loading/Loading";
|
|
17
17
|
const Button = forwardRef((_a, ref) => {
|
|
18
|
-
var { size = "md", color = "primary", variant = "solid", title, children, startIcon, endIcon, disabled = false, fullwidth = false, isLoading = false, className } = _a, props = __rest(_a, ["size", "color", "variant", "title", "children", "startIcon", "endIcon", "disabled", "fullwidth", "isLoading", "className"]);
|
|
18
|
+
var { size = "md", shape = "round", color = "primary", variant = "solid", title, children, startIcon, endIcon, disabled = false, fullwidth = false, isLoading = false, className } = _a, props = __rest(_a, ["size", "shape", "color", "variant", "title", "children", "startIcon", "endIcon", "disabled", "fullwidth", "isLoading", "className"]);
|
|
19
19
|
const isDisabled = disabled || isLoading;
|
|
20
|
-
return (_jsx("button", Object.assign({ type: "button" }, props, { ref: ref, "aria-disabled": isDisabled || undefined, "data-loading": isLoading || undefined, tabIndex: isDisabled ? -1 : 0, className: cn(buttonVariants({
|
|
20
|
+
return (_jsx("button", Object.assign({ type: "button" }, props, { ref: ref, "aria-disabled": isDisabled || undefined, "data-loading": isLoading || undefined, tabIndex: isDisabled ? -1 : 0, className: cn(buttonVariants({
|
|
21
|
+
size,
|
|
22
|
+
shape,
|
|
23
|
+
color,
|
|
24
|
+
variant,
|
|
25
|
+
disabled,
|
|
26
|
+
fullwidth,
|
|
27
|
+
}), className), disabled: isDisabled, children: _jsxs(_Fragment, { children: [isLoading && _jsx(Loading, {}), startIcon, children || title, endIcon] }) })));
|
|
21
28
|
});
|
|
22
29
|
export default Button;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
export const buttonVariants = cva([
|
|
3
|
-
"gap-2 font-bold inline-flex items-center justify-center outline-none transition ease-in-out duration-45",
|
|
3
|
+
"relative gap-2 font-bold inline-flex items-center justify-center outline-none transition ease-in-out duration-45",
|
|
4
|
+
"before:content-[''] before:absolute before:inset-0 before:rounded-[inherit] before:pointer-events-none before:border-0 before:border-inherit",
|
|
4
5
|
], {
|
|
5
6
|
variants: {
|
|
6
7
|
color: {
|
|
@@ -55,14 +56,19 @@ export const buttonVariants = cva([
|
|
|
55
56
|
],
|
|
56
57
|
},
|
|
57
58
|
size: {
|
|
58
|
-
sm: "px-
|
|
59
|
-
md: "px-
|
|
60
|
-
lg: "px-
|
|
59
|
+
sm: "px-[12px] py-[4px] [&_svg]:size-[18px] typography-buttonMS gap-1",
|
|
60
|
+
md: "px-[16px] py-[8px] [&_svg]:size-5 typography-buttonMS",
|
|
61
|
+
lg: "px-[24px] py-[16px] [&_svg]:size-6 typography-buttonL",
|
|
62
|
+
},
|
|
63
|
+
shape: {
|
|
64
|
+
round: "",
|
|
65
|
+
capsule: "",
|
|
61
66
|
},
|
|
62
67
|
variant: {
|
|
63
|
-
solid: "border",
|
|
64
|
-
outline: "border bg-transparent",
|
|
68
|
+
solid: "before:border",
|
|
69
|
+
outline: "before:border bg-transparent",
|
|
65
70
|
flat: "bg-transparent",
|
|
71
|
+
text: "bg-transparent",
|
|
66
72
|
link: "bg-transparent underline underline-offset-4",
|
|
67
73
|
},
|
|
68
74
|
disabled: {
|
|
@@ -78,6 +84,36 @@ export const buttonVariants = cva([
|
|
|
78
84
|
},
|
|
79
85
|
},
|
|
80
86
|
compoundVariants: [
|
|
87
|
+
{
|
|
88
|
+
size: "sm",
|
|
89
|
+
shape: "round",
|
|
90
|
+
className: "rounded-[var(--button-s-round)]",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
size: "md",
|
|
94
|
+
shape: "round",
|
|
95
|
+
className: "rounded-[var(--button-m-round)]",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
size: "lg",
|
|
99
|
+
shape: "round",
|
|
100
|
+
className: "rounded-[var(--button-l-round)]",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
size: "sm",
|
|
104
|
+
shape: "capsule",
|
|
105
|
+
className: "rounded-[var(--button-s-capsule)]",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
size: "md",
|
|
109
|
+
shape: "capsule",
|
|
110
|
+
className: "rounded-[var(--button-m-capsule)]",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
size: "lg",
|
|
114
|
+
shape: "capsule",
|
|
115
|
+
className: "rounded-[var(--button-l-capsule)]",
|
|
116
|
+
},
|
|
81
117
|
{
|
|
82
118
|
variant: "outline",
|
|
83
119
|
color: "primary",
|
|
@@ -90,7 +126,7 @@ export const buttonVariants = cva([
|
|
|
90
126
|
],
|
|
91
127
|
},
|
|
92
128
|
{
|
|
93
|
-
variant: ["flat", "link"],
|
|
129
|
+
variant: ["flat", "text", "link"],
|
|
94
130
|
color: "primary",
|
|
95
131
|
className: [
|
|
96
132
|
"bg-button-primary-flat-default border-button-primary-flat-default text-button-primary-flat-default fill-button-primary-flat-default",
|
|
@@ -112,7 +148,7 @@ export const buttonVariants = cva([
|
|
|
112
148
|
],
|
|
113
149
|
},
|
|
114
150
|
{
|
|
115
|
-
variant: ["flat", "link"],
|
|
151
|
+
variant: ["flat", "text", "link"],
|
|
116
152
|
color: "secondary",
|
|
117
153
|
className: [
|
|
118
154
|
"bg-button-secondary-flat-default border-button-secondary-flat-default text-button-secondary-flat-default fill-button-secondary-flat-default",
|
|
@@ -134,7 +170,7 @@ export const buttonVariants = cva([
|
|
|
134
170
|
],
|
|
135
171
|
},
|
|
136
172
|
{
|
|
137
|
-
variant: ["flat", "link"],
|
|
173
|
+
variant: ["flat", "text", "link"],
|
|
138
174
|
color: "tertiary",
|
|
139
175
|
className: [
|
|
140
176
|
"bg-button-tertiary-flat-default border-button-tertiary-flat-default text-button-tertiary-flat-default fill-button-tertiary-flat-default",
|
|
@@ -156,7 +192,7 @@ export const buttonVariants = cva([
|
|
|
156
192
|
],
|
|
157
193
|
},
|
|
158
194
|
{
|
|
159
|
-
variant: ["flat", "link"],
|
|
195
|
+
variant: ["flat", "text", "link"],
|
|
160
196
|
color: "info",
|
|
161
197
|
className: [
|
|
162
198
|
"bg-button-info-flat-default border-button-info-flat-default text-button-info-flat-default fill-button-info-flat-default",
|
|
@@ -178,7 +214,7 @@ export const buttonVariants = cva([
|
|
|
178
214
|
],
|
|
179
215
|
},
|
|
180
216
|
{
|
|
181
|
-
variant: ["flat", "link"],
|
|
217
|
+
variant: ["flat", "text", "link"],
|
|
182
218
|
color: "success",
|
|
183
219
|
className: [
|
|
184
220
|
"bg-button-success-flat-default border-button-success-flat-default text-button-success-flat-default fill-button-success-flat-default",
|
|
@@ -200,7 +236,7 @@ export const buttonVariants = cva([
|
|
|
200
236
|
],
|
|
201
237
|
},
|
|
202
238
|
{
|
|
203
|
-
variant: ["flat", "link"],
|
|
239
|
+
variant: ["flat", "text", "link"],
|
|
204
240
|
color: "warning",
|
|
205
241
|
className: [
|
|
206
242
|
"bg-button-warning-flat-default border-button-warning-flat-default text-button-warning-flat-default fill-button-warning-flat-default",
|
|
@@ -222,7 +258,7 @@ export const buttonVariants = cva([
|
|
|
222
258
|
],
|
|
223
259
|
},
|
|
224
260
|
{
|
|
225
|
-
variant: ["flat", "link"],
|
|
261
|
+
variant: ["flat", "text", "link"],
|
|
226
262
|
color: "error",
|
|
227
263
|
className: [
|
|
228
264
|
"bg-button-error-flat-default border-button-error-flat-default text-button-error-flat-default fill-button-error-flat-default",
|
|
@@ -234,7 +270,7 @@ export const buttonVariants = cva([
|
|
|
234
270
|
},
|
|
235
271
|
// --- Disabled --
|
|
236
272
|
{
|
|
237
|
-
variant: ["outline", "flat", "link"],
|
|
273
|
+
variant: ["outline", "flat", "text", "link"],
|
|
238
274
|
disabled: true,
|
|
239
275
|
className: [
|
|
240
276
|
"bg-transparent border-disabled-outline text-disable-outline fill-disable-outline",
|
|
@@ -243,6 +279,7 @@ export const buttonVariants = cva([
|
|
|
243
279
|
],
|
|
244
280
|
defaultVariants: {
|
|
245
281
|
size: "md",
|
|
282
|
+
shape: "round",
|
|
246
283
|
color: "primary",
|
|
247
284
|
variant: "solid",
|
|
248
285
|
fullwidth: true,
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowsUpDownIcon } from "@heroicons/react/16/solid";
|
|
2
3
|
import Button from "./Button";
|
|
3
4
|
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
4
5
|
const meta = {
|
|
5
6
|
title: "Components/Button",
|
|
6
7
|
component: Button,
|
|
7
8
|
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
shape: {
|
|
11
|
+
control: { type: "inline-radio" },
|
|
12
|
+
options: ["round", "capsule"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
8
15
|
parameters: {
|
|
9
16
|
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
10
17
|
layout: "fullscreen",
|
|
@@ -19,6 +26,7 @@ export const Solid = {
|
|
|
19
26
|
title: "Button",
|
|
20
27
|
disabled: false,
|
|
21
28
|
isLoading: false,
|
|
29
|
+
shape: "round",
|
|
22
30
|
},
|
|
23
31
|
render: (args) => {
|
|
24
32
|
const props = Object.assign(Object.assign({}, args), { className: "capitalize" });
|
|
@@ -31,6 +39,7 @@ export const Outline = {
|
|
|
31
39
|
variant: "outline",
|
|
32
40
|
disabled: false,
|
|
33
41
|
isLoading: false,
|
|
42
|
+
shape: "round",
|
|
34
43
|
},
|
|
35
44
|
render: (args) => {
|
|
36
45
|
const props = Object.assign(Object.assign({}, args), { className: "capitalize" });
|
|
@@ -43,6 +52,20 @@ export const Flat = {
|
|
|
43
52
|
variant: "flat",
|
|
44
53
|
disabled: false,
|
|
45
54
|
isLoading: false,
|
|
55
|
+
shape: "round",
|
|
56
|
+
},
|
|
57
|
+
render: (args) => {
|
|
58
|
+
const props = Object.assign(Object.assign({}, args), { className: "capitalize" });
|
|
59
|
+
return (_jsxs("div", { className: "flex gap-2", children: [_jsx(Button, Object.assign({ color: "primary" }, props, { title: "primary" })), _jsx(Button, Object.assign({ color: "secondary" }, props, { title: "secondary" })), _jsx(Button, Object.assign({ color: "tertiary" }, props, { title: "tertiary" })), _jsx(Button, Object.assign({ color: "info" }, props, { title: "info" })), _jsx(Button, Object.assign({ color: "success" }, props, { title: "success" })), _jsx(Button, Object.assign({ color: "warning" }, props, { title: "warning" })), _jsx(Button, Object.assign({ color: "error" }, props, { title: "error" }))] }));
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const Text = {
|
|
63
|
+
args: {
|
|
64
|
+
title: "Button",
|
|
65
|
+
variant: "text",
|
|
66
|
+
disabled: false,
|
|
67
|
+
isLoading: false,
|
|
68
|
+
shape: "round",
|
|
46
69
|
},
|
|
47
70
|
render: (args) => {
|
|
48
71
|
const props = Object.assign(Object.assign({}, args), { className: "capitalize" });
|
|
@@ -55,9 +78,41 @@ export const Link = {
|
|
|
55
78
|
variant: "link",
|
|
56
79
|
disabled: false,
|
|
57
80
|
isLoading: false,
|
|
81
|
+
shape: "round",
|
|
58
82
|
},
|
|
59
83
|
render: (args) => {
|
|
60
84
|
const props = Object.assign(Object.assign({}, args), { className: "capitalize" });
|
|
61
85
|
return (_jsxs("div", { className: "flex gap-2", children: [_jsx(Button, Object.assign({ color: "primary" }, props, { title: "primary" })), _jsx(Button, Object.assign({ color: "secondary" }, props, { title: "secondary" })), _jsx(Button, Object.assign({ color: "tertiary" }, props, { title: "tertiary" })), _jsx(Button, Object.assign({ color: "info" }, props, { title: "info" })), _jsx(Button, Object.assign({ color: "success" }, props, { title: "success" })), _jsx(Button, Object.assign({ color: "warning" }, props, { title: "warning" })), _jsx(Button, Object.assign({ color: "error" }, props, { title: "error" }))] }));
|
|
62
86
|
},
|
|
63
87
|
};
|
|
88
|
+
export const ShapePreview = {
|
|
89
|
+
args: {
|
|
90
|
+
variant: "solid",
|
|
91
|
+
color: "primary",
|
|
92
|
+
},
|
|
93
|
+
render: (args) => (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "w-20 typography-subtitile4", children: "Round" }), _jsx(Button, Object.assign({}, args, { shape: "round", size: "lg", title: "Large" })), _jsx(Button, Object.assign({}, args, { shape: "round", size: "md", title: "Medium" })), _jsx(Button, Object.assign({}, args, { shape: "round", size: "sm", title: "Small" }))] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "w-20 typography-subtitile4", children: "Capsule" }), _jsx(Button, Object.assign({}, args, { shape: "capsule", size: "lg", title: "Large" })), _jsx(Button, Object.assign({}, args, { shape: "capsule", size: "md", title: "Medium" })), _jsx(Button, Object.assign({}, args, { shape: "capsule", size: "sm", title: "Small" }))] })] })),
|
|
94
|
+
};
|
|
95
|
+
const previewColors = ["primary", "secondary", "tertiary", "info", "success", "warning", "error"];
|
|
96
|
+
const previewSizes = ["lg", "md", "sm"];
|
|
97
|
+
const previewSizeLabel = {
|
|
98
|
+
lg: "Large",
|
|
99
|
+
md: "Medium",
|
|
100
|
+
sm: "Small",
|
|
101
|
+
};
|
|
102
|
+
const previewStyles = [
|
|
103
|
+
{ label: "Solid", variant: "solid" },
|
|
104
|
+
{ label: "Outline", variant: "outline" },
|
|
105
|
+
{ label: "Text", variant: "text" },
|
|
106
|
+
];
|
|
107
|
+
const icon = _jsx(ArrowsUpDownIcon, {});
|
|
108
|
+
const previewStates = [
|
|
109
|
+
{ label: "Default", isLoading: false, disabled: false },
|
|
110
|
+
{ label: "Loading", isLoading: true, disabled: false },
|
|
111
|
+
{ label: "Disable", isLoading: false, disabled: true },
|
|
112
|
+
];
|
|
113
|
+
export const FigmaPreview = {
|
|
114
|
+
render: () => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsx("div", { className: "flex flex-col gap-10", children: previewColors.map((color) => (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("h3", { className: "text-xl font-semibold tracking-wide text-text-white capitalize", children: [color, " btn"] }), previewStates.map((state) => (_jsx("div", { className: "grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-2", children: previewStyles.map((style) => (_jsxs("div", { className: "h-full rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-3", children: [_jsxs("span", { className: "text-xs font-semibold tracking-wide text-text-white uppercase", children: [style.label, " (", state.label, ")"] }), _jsx("div", { className: "mt-3 flex flex-col gap-2", children: previewSizes.map((size) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], startIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, title: previewSizeLabel[size], endIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false })] }, size))) })] }, style.label))) }, state.label)))] }, color))) }) })),
|
|
115
|
+
};
|
|
116
|
+
export const FigmaPreviewCapsule = {
|
|
117
|
+
render: () => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsx("div", { className: "flex flex-col gap-10", children: previewColors.map((color) => (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("h3", { className: "text-xl font-semibold tracking-wide text-text-white capitalize", children: [color, " btn"] }), previewStates.map((state) => (_jsx("div", { className: "grid grid-cols-[repeat(3,minmax(0,1fr))] items-stretch gap-4", children: previewStyles.map((style) => (_jsxs("div", { className: "h-full rounded-lg border border-base-bg-stroke1 bg-base-bg1 p-3", children: [_jsxs("span", { className: "text-xs font-semibold tracking-wide text-text-white uppercase", children: [style.label, " (", state.label, ")"] }), _jsx("div", { className: "mt-3 flex flex-col gap-2", children: previewSizes.map((size) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], startIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], isLoading: state.isLoading, disabled: state.disabled, fullwidth: false }), _jsx(Button, { color: color, variant: style.variant, size: size, shape: "capsule", title: previewSizeLabel[size], endIcon: icon, isLoading: state.isLoading, disabled: state.disabled, fullwidth: false })] }, size))) })] }, style.label))) }, state.label)))] }, color))) }) })),
|
|
118
|
+
};
|
|
@@ -10,18 +10,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
16
|
-
import { CheckIcon } from "@heroicons/react/16/solid";
|
|
16
|
+
import { CheckIcon, MinusIcon } from "@heroicons/react/16/solid";
|
|
17
17
|
import { cn } from "@/utils/cn";
|
|
18
18
|
const Checkbox = React.forwardRef((_a, ref) => {
|
|
19
19
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
20
|
-
return (_jsx(CheckboxPrimitive.Root, Object.assign({ ref: ref, className: cn("peer size-4 shrink-0 rounded-[var(--spacing-spacing-xxs,2px)] border border-function-default-solid ring-offset-background", "hover:border-function-default-hover", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:border-state-disable-solid disabled:text-state-disable-outline", {
|
|
21
|
-
"data-[state=checked]:border-function-active-solid data-[state=checked]:bg-function-active-solid data-[state=checked]:text-function-active-icon": !props.disabled,
|
|
22
|
-
"hover:data-[state=checked]:border-function-active-hover hover:data-[state=checked]:bg-function-active-hover": !props.disabled,
|
|
23
|
-
|
|
24
|
-
}, className) }, props, { children: _jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: _jsx(CheckIcon, { className: "size-4" }) }) })));
|
|
20
|
+
return (_jsx(CheckboxPrimitive.Root, Object.assign({ ref: ref, className: cn("peer size-4 shrink-0 cursor-pointer rounded-[var(--spacing-spacing-xxs,2px)] border border-function-default-solid ring-offset-background", "hover:border-function-default-hover", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "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
|
+
"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": !props.disabled,
|
|
22
|
+
"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": !props.disabled,
|
|
23
|
+
}, className) }, props, { children: _jsxs(CheckboxPrimitive.Indicator, { className: cn("flex size-[14px] items-center justify-center text-current", "[&[data-state=checked]_.checkbox-check-icon]:block", "[&[data-state=indeterminate]_.checkbox-minus-icon]:block"), children: [_jsx(CheckIcon, { className: "checkbox-check-icon hidden size-[14px]" }), _jsx(MinusIcon, { className: "checkbox-minus-icon hidden size-[14px]" })] }) })));
|
|
25
24
|
});
|
|
26
25
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
27
26
|
export { Checkbox };
|
|
@@ -29,10 +29,32 @@ export const WithText = {
|
|
|
29
29
|
return (_jsxs("div", { className: "items-top flex space-x-2", children: [_jsx(Checkbox, { id: "terms1" }), _jsxs("div", { className: "grid gap-1.5 leading-none", children: [_jsx("label", { htmlFor: "terms1", className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Accept terms and conditions" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "You agree to our Terms of Service and Privacy Policy." })] })] }));
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
|
-
export const
|
|
32
|
+
export const Disabled = {
|
|
33
33
|
args: {},
|
|
34
34
|
render: (args) => {
|
|
35
35
|
const props = Object.assign({}, args);
|
|
36
36
|
return (_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Checkbox, { id: "terms2", disabled: true }), _jsx("label", { htmlFor: "terms2", className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: "Accept terms and conditions" })] }));
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
|
+
const checkboxPreviewRows = [
|
|
40
|
+
{ label: "Default", checked: false },
|
|
41
|
+
{ label: "Hover", checked: false, className: "!border-function-default-hover" },
|
|
42
|
+
{ label: "Disable", checked: false, disabled: true },
|
|
43
|
+
{ label: "Checked", checked: true },
|
|
44
|
+
{
|
|
45
|
+
label: "Checked - Hover",
|
|
46
|
+
checked: true,
|
|
47
|
+
className: "!data-[state=checked]:border-function-active-hover !data-[state=checked]:bg-function-active-hover",
|
|
48
|
+
},
|
|
49
|
+
{ label: "Checked - Disable", checked: true, disabled: true },
|
|
50
|
+
{ label: "Indeterminate", checked: "indeterminate" },
|
|
51
|
+
{
|
|
52
|
+
label: "Indeterminate - Hover",
|
|
53
|
+
checked: "indeterminate",
|
|
54
|
+
className: "!data-[state=indeterminate]:border-function-active-hover !data-[state=indeterminate]:bg-function-active-hover",
|
|
55
|
+
},
|
|
56
|
+
{ label: "Indeterminate - Disable", checked: "indeterminate", disabled: true },
|
|
57
|
+
];
|
|
58
|
+
export const FigmaPreview = {
|
|
59
|
+
render: () => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsx("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", children: checkboxPreviewRows.map((row) => (_jsxs("div", { className: "grid grid-cols-[160px_16px] items-center gap-4", children: [_jsx("span", { className: "text-sm font-medium text-text-white", children: row.label }), _jsx(Checkbox, { checked: row.checked, disabled: row.disabled, className: row.className })] }, row.label))) }) })),
|
|
60
|
+
};
|
|
@@ -119,6 +119,6 @@ const InputFilter = forwardRef((_a, ref) => {
|
|
|
119
119
|
active: !!values.length,
|
|
120
120
|
disabled,
|
|
121
121
|
});
|
|
122
|
-
return (_jsxs("div", { ref: containerRef, className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx(
|
|
122
|
+
return (_jsxs("div", { ref: containerRef, className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx(Icon, { type: "heroicons", name: "adjustments-horizontal", variant: "outline", color: "inherit", stroke: "inherit", fill: "transparent" }), classes: { endIconWrapper: filterIconClassName } }, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: customInputVariant({ size }), onFocus: handleOnFocus, onKeyDown: handleOnKeyDown })), isFocused && renderOptions()] }));
|
|
123
123
|
});
|
|
124
124
|
export { InputFilter };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
export const filterIconVariant = cva([
|
|
3
3
|
// Base styles
|
|
4
|
-
"absolute
|
|
4
|
+
"absolute flex items-center justify-center cursor-pointer",
|
|
5
5
|
// Border styles
|
|
6
6
|
"border-l border-l-input-default-stroke",
|
|
7
7
|
"peer-hover:border-l-input-active-stroke",
|
|
@@ -20,7 +20,7 @@ const RadioGroup = React.forwardRef((_a, ref) => {
|
|
|
20
20
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
21
21
|
const RadioGroupItem = React.forwardRef((_a, ref) => {
|
|
22
22
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
23
|
-
return (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: ref, className: cn("aspect-square box-border size-4 rounded-full border border-function-default-solid text-function-default-solid", "hover:border-function-default-hover", "focus:outline-none",
|
|
23
|
+
return (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: ref, className: cn("aspect-square box-border size-4 cursor-pointer rounded-full border border-function-default-solid text-function-default-solid", "hover:border-function-default-hover", "focus:outline-none",
|
|
24
24
|
// Disabled state styles
|
|
25
25
|
"data-[disabled]:!border-state-disable-solid data-[disabled]:!fill-state-disable-solid data-[disabled]:!cursor-not-allowed data-[disabled]:!pointer-events-none data-[disabled]:!text-state-disable-solid",
|
|
26
26
|
// Checked state styles
|
|
@@ -22,7 +22,7 @@ export const Default = {
|
|
|
22
22
|
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(RadioGroup, Object.assign({ defaultValue: "option-one" }, props, { children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option-one", id: "option-one" }), _jsx(Label, { htmlFor: "option-one", children: "Option One" })] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option-two", id: "option-two" }), _jsx(Label, { htmlFor: "option-two", children: "Option Two" })] })] })) }));
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
|
-
export const
|
|
25
|
+
export const Disabled = {
|
|
26
26
|
args: {
|
|
27
27
|
disabled: true,
|
|
28
28
|
},
|
|
@@ -40,3 +40,18 @@ export const Horizontal = {
|
|
|
40
40
|
return (_jsxs(RadioGroup, { defaultValue: "option1", className: "flex flex-row space-x-4", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option1", id: "option1" }), _jsx(Label, { htmlFor: "option1", children: "Option 1" })] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option2", id: "option2" }), _jsx(Label, { htmlFor: "option2", children: "Option 2" })] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(RadioGroupItem, { value: "option3", id: "option3" }), _jsx(Label, { htmlFor: "option3", children: "Option 3" })] })] }));
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
+
const radioPreviewRows = [
|
|
44
|
+
{ label: "Default", checked: false },
|
|
45
|
+
{ label: "Hover", checked: false, className: "!border-function-default-hover" },
|
|
46
|
+
{ label: "Disable", checked: false, disabled: true },
|
|
47
|
+
{ label: "Checked", checked: true },
|
|
48
|
+
{
|
|
49
|
+
label: "Checked - Hover",
|
|
50
|
+
checked: true,
|
|
51
|
+
className: "!data-[state=checked]:border-function-active-hover !data-[state=checked]:text-function-active-hover",
|
|
52
|
+
},
|
|
53
|
+
{ label: "Checked - Disable", checked: true, disabled: true },
|
|
54
|
+
];
|
|
55
|
+
export const FigmaPreview = {
|
|
56
|
+
render: () => (_jsx("div", { className: "bg-base-bg2 p-8 min-h-screen", children: _jsx("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", children: radioPreviewRows.map((row) => (_jsxs("div", { className: "grid grid-cols-[160px_16px] items-center gap-4", children: [_jsx("span", { className: "text-sm font-medium text-text-white", children: row.label }), _jsx(RadioGroup, { defaultValue: row.checked ? "option" : undefined, disabled: row.disabled, children: _jsx(RadioGroupItem, { value: "option", className: row.className }) })] }, row.label))) }) })),
|
|
57
|
+
};
|