adnbn-ui 0.0.2 → 0.1.1
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 +1057 -0
- package/package.json +19 -3
- package/.prettierignore +0 -3
- package/.prettierrc +0 -28
- package/.storybook/main.ts +0 -22
- package/.storybook/preview.tsx +0 -100
- package/.storybook/styles/custom.scss +0 -59
- package/.storybook/styles/preview.css +0 -58
- package/.storybook/vitest.setup.ts +0 -9
- package/eslint.config.js +0 -39
- package/src/components/Avatar/Avatar.stories.tsx +0 -118
- package/src/components/Button/Button.stories.tsx +0 -148
- package/src/components/Checkbox/Checkbox.stories.tsx +0 -180
- package/src/components/Drawer/Drawer.stories.tsx +0 -89
- package/src/components/Footer/Footer.stories.tsx +0 -118
- package/src/components/Header/Header.stories.tsx +0 -49
- package/src/components/Highlight/Highlight.stories.tsx +0 -83
- package/src/components/IconButton/IconButton.stories.tsx +0 -179
- package/src/components/Layout/Layout.stories.tsx +0 -88
- package/src/components/List/List.stories.tsx +0 -81
- package/src/components/Modal/Modal.stories.tsx +0 -95
- package/src/components/Odometer/Odometer.stories.tsx +0 -66
- package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -58
- package/src/components/Switch/Switch.stories.tsx +0 -25
- package/src/components/Tag/Tag.stories.tsx +0 -157
- package/src/components/TextArea/TextArea.stories.tsx +0 -145
- package/src/components/TextField/TextField.stories.tsx +0 -177
- package/src/components/Toast/Toast.stories.tsx +0 -209
- package/src/components/Tooltip/Tooltip.stories.tsx +0 -80
- package/src/components/View/View.stories.tsx +0 -47
- package/src/components/ViewDrawer/ViewDrawer.stories.tsx +0 -75
- package/src/components/ViewModal/ViewModal.stories.tsx +0 -68
- package/tsconfig.json +0 -18
- package/vite.config.ts +0 -11
- package/vitest.workspace.ts +0 -19
@@ -1,180 +0,0 @@
|
|
1
|
-
import {useState} from "react";
|
2
|
-
import {Meta, StoryObj} from "@storybook/react";
|
3
|
-
|
4
|
-
import {capitalizeFirstLetter, hideInTable} from "../../utils";
|
5
|
-
|
6
|
-
import CheckboxComponent, {CheckboxRadius, CheckboxSize, CheckboxVariant, CheckedState} from "./Checkbox";
|
7
|
-
|
8
|
-
const variants: (CheckboxVariant | "default")[] = ["default", CheckboxVariant.Classic, CheckboxVariant.Soft];
|
9
|
-
const size: (CheckboxSize | "default")[] = [CheckboxSize.Small, "default", CheckboxSize.Medium, CheckboxSize.Large];
|
10
|
-
const radius: (CheckboxRadius | "default")[] = [CheckboxRadius.Small, "default", CheckboxRadius.Large];
|
11
|
-
|
12
|
-
const meta: Meta<typeof CheckboxComponent> = {
|
13
|
-
title: "Components/Checkbox",
|
14
|
-
component: CheckboxComponent,
|
15
|
-
tags: ["autodocs"],
|
16
|
-
argTypes: {
|
17
|
-
checked: {
|
18
|
-
options: [true, false, "indeterminate"],
|
19
|
-
control: {type: "select"},
|
20
|
-
},
|
21
|
-
variant: {
|
22
|
-
options: variants,
|
23
|
-
control: {type: "select"},
|
24
|
-
},
|
25
|
-
size: {
|
26
|
-
options: size,
|
27
|
-
control: {type: "select"},
|
28
|
-
},
|
29
|
-
radius: {
|
30
|
-
options: radius,
|
31
|
-
control: {type: "select"},
|
32
|
-
},
|
33
|
-
|
34
|
-
checkedIcon: hideInTable,
|
35
|
-
indeterminateIcon: hideInTable,
|
36
|
-
children: hideInTable,
|
37
|
-
className: hideInTable,
|
38
|
-
indicatorClassName: hideInTable,
|
39
|
-
},
|
40
|
-
};
|
41
|
-
|
42
|
-
export default meta;
|
43
|
-
|
44
|
-
export const Checkbox: StoryObj<typeof CheckboxComponent> = {
|
45
|
-
args: {
|
46
|
-
checked: true,
|
47
|
-
disabled: false,
|
48
|
-
variant: CheckboxVariant.Classic,
|
49
|
-
},
|
50
|
-
};
|
51
|
-
|
52
|
-
export const CheckboxClickable = () => {
|
53
|
-
const [checked, setChecked] = useState<CheckedState>("indeterminate");
|
54
|
-
|
55
|
-
return <CheckboxComponent variant={CheckboxVariant.Classic} checked={checked} onCheckedChange={setChecked} />;
|
56
|
-
};
|
57
|
-
|
58
|
-
export const Variant = () => {
|
59
|
-
return (
|
60
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(3, auto)"}}>
|
61
|
-
{variants.map(variant => (
|
62
|
-
<span key={variant} className="item-card__title">
|
63
|
-
{capitalizeFirstLetter(variant)}
|
64
|
-
</span>
|
65
|
-
))}
|
66
|
-
|
67
|
-
{variants.map(variant => (
|
68
|
-
<div key={variant} className="item-card">
|
69
|
-
<CheckboxComponent variant={variant !== "default" ? variant : undefined} checked={false} />
|
70
|
-
</div>
|
71
|
-
))}
|
72
|
-
|
73
|
-
{variants.map(variant => (
|
74
|
-
<div key={variant} className="item-card">
|
75
|
-
<CheckboxComponent variant={variant !== "default" ? variant : undefined} checked={true} />
|
76
|
-
</div>
|
77
|
-
))}
|
78
|
-
|
79
|
-
{variants.map(variant => (
|
80
|
-
<div key={variant} className="item-card">
|
81
|
-
<CheckboxComponent variant={variant !== "default" ? variant : undefined} checked="indeterminate" />
|
82
|
-
</div>
|
83
|
-
))}
|
84
|
-
</div>
|
85
|
-
);
|
86
|
-
};
|
87
|
-
|
88
|
-
export const VariantDisabled = () => {
|
89
|
-
return (
|
90
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(3, auto)"}}>
|
91
|
-
{variants.map(variant => (
|
92
|
-
<span key={variant} className="item-card__title">
|
93
|
-
{capitalizeFirstLetter(variant)}
|
94
|
-
</span>
|
95
|
-
))}
|
96
|
-
|
97
|
-
{variants.map(variant => (
|
98
|
-
<div key={variant} className="item-card">
|
99
|
-
<CheckboxComponent disabled variant={variant !== "default" ? variant : undefined} checked={false} />
|
100
|
-
</div>
|
101
|
-
))}
|
102
|
-
|
103
|
-
{variants.map(variant => (
|
104
|
-
<div key={variant} className="item-card">
|
105
|
-
<CheckboxComponent disabled variant={variant !== "default" ? variant : undefined} checked={true} />
|
106
|
-
</div>
|
107
|
-
))}
|
108
|
-
|
109
|
-
{variants.map(variant => (
|
110
|
-
<div key={variant} className="item-card">
|
111
|
-
<CheckboxComponent
|
112
|
-
disabled
|
113
|
-
variant={variant !== "default" ? variant : undefined}
|
114
|
-
checked="indeterminate"
|
115
|
-
/>
|
116
|
-
</div>
|
117
|
-
))}
|
118
|
-
</div>
|
119
|
-
);
|
120
|
-
};
|
121
|
-
|
122
|
-
export const Size = () => {
|
123
|
-
return (
|
124
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
125
|
-
{size.map(size => (
|
126
|
-
<span key={size} className="item-card__title">
|
127
|
-
{capitalizeFirstLetter(size)}
|
128
|
-
</span>
|
129
|
-
))}
|
130
|
-
|
131
|
-
{size.map(size => (
|
132
|
-
<div key={size} className="item-card">
|
133
|
-
<CheckboxComponent size={size !== "default" ? size : undefined} checked={false} />
|
134
|
-
</div>
|
135
|
-
))}
|
136
|
-
|
137
|
-
{size.map(size => (
|
138
|
-
<div key={size} className="item-card">
|
139
|
-
<CheckboxComponent size={size !== "default" ? size : undefined} checked={true} />
|
140
|
-
</div>
|
141
|
-
))}
|
142
|
-
|
143
|
-
{size.map(size => (
|
144
|
-
<div key={size} className="item-card">
|
145
|
-
<CheckboxComponent size={size !== "default" ? size : undefined} checked="indeterminate" />
|
146
|
-
</div>
|
147
|
-
))}
|
148
|
-
</div>
|
149
|
-
);
|
150
|
-
};
|
151
|
-
|
152
|
-
export const Radius = () => {
|
153
|
-
return (
|
154
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(3, auto)"}}>
|
155
|
-
{radius.map(radius => (
|
156
|
-
<span key={radius} className="item-card__title">
|
157
|
-
{capitalizeFirstLetter(radius)}
|
158
|
-
</span>
|
159
|
-
))}
|
160
|
-
|
161
|
-
{radius.map(radius => (
|
162
|
-
<div key={radius} className="item-card">
|
163
|
-
<CheckboxComponent radius={radius !== "default" ? radius : undefined} checked={false} />
|
164
|
-
</div>
|
165
|
-
))}
|
166
|
-
|
167
|
-
{radius.map(radius => (
|
168
|
-
<div key={radius} className="item-card">
|
169
|
-
<CheckboxComponent radius={radius !== "default" ? radius : undefined} checked={true} />
|
170
|
-
</div>
|
171
|
-
))}
|
172
|
-
|
173
|
-
{radius.map(radius => (
|
174
|
-
<div key={radius} className="item-card">
|
175
|
-
<CheckboxComponent radius={radius !== "default" ? radius : undefined} checked="indeterminate" />
|
176
|
-
</div>
|
177
|
-
))}
|
178
|
-
</div>
|
179
|
-
);
|
180
|
-
};
|
@@ -1,89 +0,0 @@
|
|
1
|
-
import {useState} from "react";
|
2
|
-
import {Meta} from "@storybook/react";
|
3
|
-
|
4
|
-
import {capitalizeFirstLetter, hideInTable} from "../../utils";
|
5
|
-
|
6
|
-
import {Button, List, ListItem} from "../index";
|
7
|
-
|
8
|
-
import DrawerComponent, {DrawerProps, DrawerSide} from "./Drawer";
|
9
|
-
|
10
|
-
const sides: DrawerSide[] = [DrawerSide.Left, DrawerSide.Top, DrawerSide.Bottom, DrawerSide.Right];
|
11
|
-
const items = [
|
12
|
-
{title: "Profile", icon: "👤"},
|
13
|
-
{title: "Messages", icon: "✉️"},
|
14
|
-
{title: "Notifications", icon: "🔔"},
|
15
|
-
{title: "Setting", icon: "⚙️"},
|
16
|
-
{title: "Help", icon: "❓"},
|
17
|
-
{title: "Logout", icon: "🚪"},
|
18
|
-
];
|
19
|
-
|
20
|
-
const meta: Meta<typeof DrawerComponent> = {
|
21
|
-
title: "Components/Drawer",
|
22
|
-
component: DrawerComponent,
|
23
|
-
tags: ["autodocs"],
|
24
|
-
argTypes: {
|
25
|
-
side: {
|
26
|
-
options: sides,
|
27
|
-
control: {type: "select"},
|
28
|
-
},
|
29
|
-
modal: {
|
30
|
-
description:
|
31
|
-
"The modality of the dialog. When set to true, interaction with outside elements will be disabled and only dialog content will be visible to screen readers.",
|
32
|
-
control: {type: "boolean"},
|
33
|
-
type: "boolean",
|
34
|
-
},
|
35
|
-
speed: {
|
36
|
-
type: "number",
|
37
|
-
},
|
38
|
-
className: hideInTable,
|
39
|
-
description: hideInTable,
|
40
|
-
overlayClassName: hideInTable,
|
41
|
-
childrenClassName: hideInTable,
|
42
|
-
},
|
43
|
-
};
|
44
|
-
|
45
|
-
export default meta;
|
46
|
-
|
47
|
-
export const Drawer = (props: DrawerProps & {label?: string}) => {
|
48
|
-
const [open, setOpen] = useState(false);
|
49
|
-
const {label = "Open Drawer", ...other} = props;
|
50
|
-
return (
|
51
|
-
<div>
|
52
|
-
<Button onClick={() => setOpen(true)}>{label}</Button>
|
53
|
-
<DrawerComponent open={open} onOpenChange={setOpen} {...other}>
|
54
|
-
<div
|
55
|
-
style={{
|
56
|
-
boxSizing: "border-box",
|
57
|
-
display: "flex",
|
58
|
-
flexDirection: "column",
|
59
|
-
justifyContent: "space-between",
|
60
|
-
height: "100%",
|
61
|
-
gap: "30px",
|
62
|
-
padding: "20px",
|
63
|
-
}}
|
64
|
-
>
|
65
|
-
<List style={{display: "flex", flexDirection: "column", gap: "15px", overflow: "auto"}}>
|
66
|
-
{items.map(({icon, title}) => (
|
67
|
-
<ListItem left={icon} primary={title} />
|
68
|
-
))}
|
69
|
-
</List>
|
70
|
-
<Button onClick={() => setOpen(false)} style={{width: "auto"}}>
|
71
|
-
Close
|
72
|
-
</Button>
|
73
|
-
</div>
|
74
|
-
</DrawerComponent>
|
75
|
-
</div>
|
76
|
-
);
|
77
|
-
};
|
78
|
-
|
79
|
-
export const Side = () => {
|
80
|
-
return (
|
81
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
82
|
-
{sides.map(side => (
|
83
|
-
<div key={side} className="item-card">
|
84
|
-
<Drawer side={side} label={`${capitalizeFirstLetter(side)} side`} />
|
85
|
-
</div>
|
86
|
-
))}
|
87
|
-
</div>
|
88
|
-
);
|
89
|
-
};
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import {Meta, StoryObj} from "@storybook/react";
|
2
|
-
|
3
|
-
import {hideInTable} from "../../utils";
|
4
|
-
|
5
|
-
import {IconButton, IconButtonSize, IconButtonVariant} from "../index";
|
6
|
-
|
7
|
-
import FooterComponent from "./Footer";
|
8
|
-
|
9
|
-
const meta: Meta<typeof FooterComponent> = {
|
10
|
-
title: "Components/Footer",
|
11
|
-
component: FooterComponent,
|
12
|
-
tags: ["autodocs"],
|
13
|
-
argTypes: {
|
14
|
-
left: hideInTable,
|
15
|
-
right: hideInTable,
|
16
|
-
style: hideInTable,
|
17
|
-
children: hideInTable,
|
18
|
-
className: hideInTable,
|
19
|
-
leftClassName: hideInTable,
|
20
|
-
rightClassName: hideInTable,
|
21
|
-
childrenClassName: hideInTable,
|
22
|
-
},
|
23
|
-
decorators: [
|
24
|
-
Story => (
|
25
|
-
<div
|
26
|
-
style={{
|
27
|
-
display: "flex",
|
28
|
-
flexDirection: "column",
|
29
|
-
background: "var(--bg-secondary-color",
|
30
|
-
width: "380px",
|
31
|
-
height: "300px",
|
32
|
-
borderRadius: "10px",
|
33
|
-
}}
|
34
|
-
>
|
35
|
-
<span style={{flexGrow: 1}} />
|
36
|
-
<Story />
|
37
|
-
</div>
|
38
|
-
),
|
39
|
-
],
|
40
|
-
};
|
41
|
-
|
42
|
-
export default meta;
|
43
|
-
|
44
|
-
export const Footer: StoryObj<typeof FooterComponent> = {
|
45
|
-
args: {
|
46
|
-
shadow: true,
|
47
|
-
reverse: false,
|
48
|
-
style: {paddingTop: "20px"},
|
49
|
-
children: (
|
50
|
-
<div>
|
51
|
-
<div style={{display: "flex", gap: "20px"}}>
|
52
|
-
<IconButton style={{fontSize: "20px"}} tooltip={{content: "Change theme"}}>
|
53
|
-
🌓
|
54
|
-
</IconButton>
|
55
|
-
<IconButton style={{fontSize: "20px"}} tooltip={{content: "Rate Us"}}>
|
56
|
-
❤️
|
57
|
-
</IconButton>
|
58
|
-
</div>
|
59
|
-
<div style={{display: "flex", gap: "20px"}}>
|
60
|
-
<IconButton style={{fontSize: "20px"}} tooltip={{content: "Support Us"}}>
|
61
|
-
💲
|
62
|
-
</IconButton>
|
63
|
-
<IconButton style={{fontSize: "20px"}} tooltip={{content: "FAQ"}}>
|
64
|
-
❓
|
65
|
-
</IconButton>
|
66
|
-
</div>
|
67
|
-
</div>
|
68
|
-
),
|
69
|
-
},
|
70
|
-
};
|
71
|
-
|
72
|
-
export const FooterWithoutChildren: StoryObj<typeof FooterComponent> = {
|
73
|
-
args: {
|
74
|
-
shadow: true,
|
75
|
-
reverse: false,
|
76
|
-
style: {paddingTop: "20px"},
|
77
|
-
left: (
|
78
|
-
<div>
|
79
|
-
<IconButton
|
80
|
-
variant={IconButtonVariant.Contained}
|
81
|
-
size={IconButtonSize.Medium}
|
82
|
-
style={{fontSize: "20px"}}
|
83
|
-
tooltip={{content: "Change theme"}}
|
84
|
-
>
|
85
|
-
🌓
|
86
|
-
</IconButton>
|
87
|
-
<IconButton
|
88
|
-
variant={IconButtonVariant.Contained}
|
89
|
-
size={IconButtonSize.Medium}
|
90
|
-
style={{fontSize: "20px"}}
|
91
|
-
tooltip={{content: "Rate Us"}}
|
92
|
-
>
|
93
|
-
❤️
|
94
|
-
</IconButton>
|
95
|
-
</div>
|
96
|
-
),
|
97
|
-
right: (
|
98
|
-
<div>
|
99
|
-
<IconButton
|
100
|
-
variant={IconButtonVariant.Ghost}
|
101
|
-
size={IconButtonSize.Medium}
|
102
|
-
style={{fontSize: "20px"}}
|
103
|
-
tooltip={{content: "Support Us"}}
|
104
|
-
>
|
105
|
-
💲
|
106
|
-
</IconButton>
|
107
|
-
<IconButton
|
108
|
-
variant={IconButtonVariant.Ghost}
|
109
|
-
size={IconButtonSize.Medium}
|
110
|
-
style={{fontSize: "20px"}}
|
111
|
-
tooltip={{content: "FAQ"}}
|
112
|
-
>
|
113
|
-
❓
|
114
|
-
</IconButton>
|
115
|
-
</div>
|
116
|
-
),
|
117
|
-
},
|
118
|
-
};
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import {Meta, StoryObj} from "@storybook/react";
|
2
|
-
|
3
|
-
import {hideInTable} from "../../utils";
|
4
|
-
|
5
|
-
import HeaderComponent from "./Header";
|
6
|
-
|
7
|
-
const meta: Meta<typeof HeaderComponent> = {
|
8
|
-
title: "Components/Header",
|
9
|
-
component: HeaderComponent,
|
10
|
-
tags: ["autodocs"],
|
11
|
-
argTypes: {
|
12
|
-
before: hideInTable,
|
13
|
-
after: hideInTable,
|
14
|
-
children: hideInTable,
|
15
|
-
className: hideInTable,
|
16
|
-
wrapClassName: hideInTable,
|
17
|
-
titleClassName: hideInTable,
|
18
|
-
beforeClassName: hideInTable,
|
19
|
-
afterClassName: hideInTable,
|
20
|
-
subtitleClassName: hideInTable,
|
21
|
-
childrenClassName: hideInTable,
|
22
|
-
},
|
23
|
-
decorators: [
|
24
|
-
Story => (
|
25
|
-
<div
|
26
|
-
style={{background: "var(--bg-secondary-color", width: "380px", height: "300px", borderRadius: "10px"}}
|
27
|
-
>
|
28
|
-
<Story />
|
29
|
-
</div>
|
30
|
-
),
|
31
|
-
],
|
32
|
-
};
|
33
|
-
|
34
|
-
export default meta;
|
35
|
-
|
36
|
-
export const Header: StoryObj<typeof HeaderComponent> = {
|
37
|
-
args: {
|
38
|
-
title: "Volume Up Plus",
|
39
|
-
subtitle: "Adjust the current tab's volume with the slider. Switch to any audio tab in one click.",
|
40
|
-
},
|
41
|
-
};
|
42
|
-
|
43
|
-
export const WithLogo: StoryObj<typeof HeaderComponent> = {
|
44
|
-
args: {
|
45
|
-
title: "Volume Up Plus",
|
46
|
-
subtitle: "Adjust the current tab's volume with the slider. Switch to any audio tab in one click.",
|
47
|
-
before: "❤️",
|
48
|
-
},
|
49
|
-
};
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import {Meta, StoryObj} from "@storybook/react";
|
2
|
-
|
3
|
-
import {capitalizeFirstLetter, hideInTable} from "../../utils";
|
4
|
-
|
5
|
-
import HighlightComponent, {HighlightColor} from "./Highlight";
|
6
|
-
|
7
|
-
const colors: (HighlightColor | "default")[] = [
|
8
|
-
"default",
|
9
|
-
HighlightColor.Primary,
|
10
|
-
HighlightColor.Secondary,
|
11
|
-
HighlightColor.Accent,
|
12
|
-
];
|
13
|
-
const searchWords = ["Adjust", "volume", "switch", "audio"];
|
14
|
-
const textToHighlight = "Adjust the current tab's volume with the slider. Switch to any audio tab in one click";
|
15
|
-
|
16
|
-
const meta: Meta<typeof HighlightComponent> = {
|
17
|
-
title: "Components/Highlighter",
|
18
|
-
component: HighlightComponent,
|
19
|
-
tags: ["autodocs"],
|
20
|
-
argTypes: {
|
21
|
-
color: {
|
22
|
-
options: colors,
|
23
|
-
control: {type: "select"},
|
24
|
-
},
|
25
|
-
searchWords: {
|
26
|
-
description:
|
27
|
-
"Array of search words. String search terms are automatically cast to RegExps unless autoEscape is true.",
|
28
|
-
},
|
29
|
-
activeIndex: {
|
30
|
-
description: "Specify the match index that should be actively highlighted. Use along with activeClassName",
|
31
|
-
},
|
32
|
-
caseSensitive: {
|
33
|
-
description: "Search should be case sensitive; defaults to false",
|
34
|
-
},
|
35
|
-
textToHighlight: {
|
36
|
-
description: "Text to highlight matches in",
|
37
|
-
},
|
38
|
-
|
39
|
-
style: hideInTable,
|
40
|
-
children: hideInTable,
|
41
|
-
className: hideInTable,
|
42
|
-
},
|
43
|
-
decorators: [
|
44
|
-
Story => (
|
45
|
-
<div style={{color: "var(--text-primary-color"}}>
|
46
|
-
<Story />
|
47
|
-
</div>
|
48
|
-
),
|
49
|
-
],
|
50
|
-
};
|
51
|
-
|
52
|
-
export default meta;
|
53
|
-
|
54
|
-
export const Highlight: StoryObj<typeof HighlightComponent> = {
|
55
|
-
args: {
|
56
|
-
searchWords,
|
57
|
-
textToHighlight,
|
58
|
-
color: undefined,
|
59
|
-
activeIndex: 0,
|
60
|
-
caseSensitive: true,
|
61
|
-
},
|
62
|
-
};
|
63
|
-
|
64
|
-
export const Color = () => {
|
65
|
-
return (
|
66
|
-
<div>
|
67
|
-
{colors.map(color => (
|
68
|
-
<div key={color} style={{margin: "20px", display: "flex", alignItems: "center"}}>
|
69
|
-
<span className="item-card__title" style={{width: "150px"}}>
|
70
|
-
{capitalizeFirstLetter(color)} color
|
71
|
-
</span>
|
72
|
-
|
73
|
-
<HighlightComponent
|
74
|
-
searchWords={searchWords}
|
75
|
-
textToHighlight={textToHighlight}
|
76
|
-
color={color !== "default" ? color : undefined}
|
77
|
-
activeIndex={0}
|
78
|
-
/>
|
79
|
-
</div>
|
80
|
-
))}
|
81
|
-
</div>
|
82
|
-
);
|
83
|
-
};
|
@@ -1,179 +0,0 @@
|
|
1
|
-
import {Meta, StoryObj} from "@storybook/react";
|
2
|
-
|
3
|
-
import {capitalizeFirstLetter, hideInTable} from "../../utils";
|
4
|
-
|
5
|
-
import IconButtonComponent, {IconButtonRadius, IconButtonSize, IconButtonVariant} from "./IconButton";
|
6
|
-
|
7
|
-
const variants: (IconButtonVariant | "default")[] = [
|
8
|
-
"default",
|
9
|
-
IconButtonVariant.Contained,
|
10
|
-
IconButtonVariant.Outlined,
|
11
|
-
IconButtonVariant.Ghost,
|
12
|
-
];
|
13
|
-
const sizes: (IconButtonSize | "default")[] = [
|
14
|
-
IconButtonSize.Small,
|
15
|
-
"default",
|
16
|
-
IconButtonSize.Medium,
|
17
|
-
IconButtonSize.Large,
|
18
|
-
];
|
19
|
-
const radius: (IconButtonRadius | "default")[] = [
|
20
|
-
IconButtonRadius.Small,
|
21
|
-
IconButtonRadius.Medium,
|
22
|
-
IconButtonRadius.Large,
|
23
|
-
"default",
|
24
|
-
];
|
25
|
-
|
26
|
-
const meta: Meta<typeof IconButtonComponent> = {
|
27
|
-
title: "Components/IconButton",
|
28
|
-
component: IconButtonComponent,
|
29
|
-
tags: ["autodocs"],
|
30
|
-
argTypes: {
|
31
|
-
variant: {
|
32
|
-
options: variants,
|
33
|
-
control: {type: "select"},
|
34
|
-
},
|
35
|
-
size: {
|
36
|
-
options: sizes,
|
37
|
-
control: {type: "select"},
|
38
|
-
},
|
39
|
-
radius: {
|
40
|
-
options: radius,
|
41
|
-
control: {type: "select"},
|
42
|
-
},
|
43
|
-
|
44
|
-
after: hideInTable,
|
45
|
-
before: hideInTable,
|
46
|
-
children: hideInTable,
|
47
|
-
afterClassName: hideInTable,
|
48
|
-
beforeClassName: hideInTable,
|
49
|
-
childrenClassName: hideInTable,
|
50
|
-
},
|
51
|
-
};
|
52
|
-
|
53
|
-
export default meta;
|
54
|
-
|
55
|
-
const icon = (
|
56
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
57
|
-
<path
|
58
|
-
d="M12.0002 2L15.1037 8.72839L22.4618 9.60081L17.0218 14.6316L18.4658 21.8992L12.0002 18.28L5.53456 21.8992L6.97862 14.6316L1.53857 9.60081L8.89669 8.72839L12.0002 2Z"
|
59
|
-
stroke="currentColor"
|
60
|
-
stroke-width="2.4"
|
61
|
-
stroke-linejoin="round"
|
62
|
-
/>
|
63
|
-
</svg>
|
64
|
-
);
|
65
|
-
|
66
|
-
export const IconButton: StoryObj<typeof IconButtonComponent> = {
|
67
|
-
args: {
|
68
|
-
children: icon,
|
69
|
-
disabled: false,
|
70
|
-
tooltip: {
|
71
|
-
content: "Rate Us",
|
72
|
-
},
|
73
|
-
},
|
74
|
-
};
|
75
|
-
|
76
|
-
export const Variant = () => {
|
77
|
-
return (
|
78
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(5, auto)"}}>
|
79
|
-
{variants.map(variant => (
|
80
|
-
<div key={variant} className="item-card">
|
81
|
-
<span className="item-card__title">{capitalizeFirstLetter(variant)}</span>
|
82
|
-
<IconButtonComponent variant={variant !== "default" ? variant : undefined}>
|
83
|
-
{icon}
|
84
|
-
</IconButtonComponent>
|
85
|
-
</div>
|
86
|
-
))}
|
87
|
-
</div>
|
88
|
-
);
|
89
|
-
};
|
90
|
-
|
91
|
-
export const VariantDisabled = () => {
|
92
|
-
return (
|
93
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(5, auto)"}}>
|
94
|
-
{variants.map(variant => (
|
95
|
-
<div key={variant} className="item-card">
|
96
|
-
<span className="item-card__title">{capitalizeFirstLetter(variant)}</span>
|
97
|
-
<IconButtonComponent disabled variant={variant !== "default" ? variant : undefined}>
|
98
|
-
{icon}
|
99
|
-
</IconButtonComponent>
|
100
|
-
</div>
|
101
|
-
))}
|
102
|
-
</div>
|
103
|
-
);
|
104
|
-
};
|
105
|
-
|
106
|
-
export const Size = () => {
|
107
|
-
return (
|
108
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
109
|
-
{sizes.map(size => (
|
110
|
-
<div key={size} className="item-card">
|
111
|
-
<span className="item-card__title">{capitalizeFirstLetter(size)}</span>
|
112
|
-
<IconButtonComponent
|
113
|
-
size={size !== "default" ? size : undefined}
|
114
|
-
variant={IconButtonVariant.Contained}
|
115
|
-
>
|
116
|
-
{icon}
|
117
|
-
</IconButtonComponent>
|
118
|
-
</div>
|
119
|
-
))}
|
120
|
-
</div>
|
121
|
-
);
|
122
|
-
};
|
123
|
-
|
124
|
-
export const Radius = () => {
|
125
|
-
return (
|
126
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
127
|
-
{radius.map(radius => (
|
128
|
-
<div key={radius} className="item-card">
|
129
|
-
<span className="item-card__title">{capitalizeFirstLetter(radius)}</span>
|
130
|
-
<IconButtonComponent
|
131
|
-
radius={radius !== "default" ? radius : undefined}
|
132
|
-
variant={IconButtonVariant.Contained}
|
133
|
-
>
|
134
|
-
{icon}
|
135
|
-
</IconButtonComponent>
|
136
|
-
</div>
|
137
|
-
))}
|
138
|
-
</div>
|
139
|
-
);
|
140
|
-
};
|
141
|
-
|
142
|
-
export const VariantSize = () => {
|
143
|
-
return (
|
144
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
145
|
-
{variants.map(variant =>
|
146
|
-
sizes.map(size => (
|
147
|
-
<div key={`${variant}-${size}`}>
|
148
|
-
<IconButtonComponent
|
149
|
-
variant={variant !== "default" ? variant : undefined}
|
150
|
-
size={size !== "default" ? size : undefined}
|
151
|
-
>
|
152
|
-
{icon}
|
153
|
-
</IconButtonComponent>
|
154
|
-
</div>
|
155
|
-
))
|
156
|
-
)}
|
157
|
-
</div>
|
158
|
-
);
|
159
|
-
};
|
160
|
-
|
161
|
-
export const SizeRadius = () => {
|
162
|
-
return (
|
163
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
164
|
-
{sizes.map(size =>
|
165
|
-
radius.map(radius => (
|
166
|
-
<div key={`${radius}-${size}`} className="item-card">
|
167
|
-
<IconButtonComponent
|
168
|
-
variant={IconButtonVariant.Contained}
|
169
|
-
radius={radius !== "default" ? radius : undefined}
|
170
|
-
size={size !== "default" ? size : undefined}
|
171
|
-
>
|
172
|
-
{icon}
|
173
|
-
</IconButtonComponent>
|
174
|
-
</div>
|
175
|
-
))
|
176
|
-
)}
|
177
|
-
</div>
|
178
|
-
);
|
179
|
-
};
|