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
package/package.json
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
{
|
2
2
|
"name": "adnbn-ui",
|
3
|
-
"version": "0.
|
4
|
-
"description": "UI
|
5
|
-
"
|
3
|
+
"version": "0.1.1",
|
4
|
+
"description": "A comprehensive React UI component library designed exclusively for the AddonBone browser extension framework with customizable theming and consistent design patterns",
|
5
|
+
"keywords": [
|
6
|
+
"react",
|
7
|
+
"ui",
|
8
|
+
"components",
|
9
|
+
"adnbn",
|
10
|
+
"addonbone",
|
11
|
+
"browser-extension",
|
12
|
+
"theme",
|
13
|
+
"customizable",
|
14
|
+
"typescript",
|
15
|
+
"design-system"
|
16
|
+
],
|
17
|
+
"author": "Addon Bone",
|
6
18
|
"license": "MIT",
|
7
19
|
"type": "module",
|
8
20
|
"exports": {
|
@@ -56,6 +68,8 @@
|
|
56
68
|
"playwright": "^1.51.0",
|
57
69
|
"rspack-plugin-virtual-module": "^1.0.0",
|
58
70
|
"storybook": "^8.6.4",
|
71
|
+
"react": "^19.1.0",
|
72
|
+
"react-dom": "^19.1.0",
|
59
73
|
"typescript": "~5.7.2",
|
60
74
|
"typescript-eslint": "^8.24.1",
|
61
75
|
"vite": "^6.2.1",
|
@@ -63,6 +77,8 @@
|
|
63
77
|
"prettier": "^3.5.3"
|
64
78
|
},
|
65
79
|
"peerDependencies": {
|
80
|
+
"@types/react": "*",
|
81
|
+
"@types/react-dom": "*",
|
66
82
|
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
|
67
83
|
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
|
68
84
|
},
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"semi": true,
|
3
|
-
"trailingComma": "es5",
|
4
|
-
"singleQuote": false,
|
5
|
-
"printWidth": 120,
|
6
|
-
"tabWidth": 4,
|
7
|
-
"useTabs": false,
|
8
|
-
"bracketSpacing": false,
|
9
|
-
"arrowParens": "avoid",
|
10
|
-
"endOfLine": "lf",
|
11
|
-
"overrides": [
|
12
|
-
{
|
13
|
-
"files": "*.json",
|
14
|
-
"options": {
|
15
|
-
"tabWidth": 2,
|
16
|
-
"bracketSpacing": true,
|
17
|
-
"bracketSameLine": false,
|
18
|
-
"printWidth": 40
|
19
|
-
}
|
20
|
-
},
|
21
|
-
{
|
22
|
-
"files": "*.scss",
|
23
|
-
"options": {
|
24
|
-
"tabWidth": 2
|
25
|
-
}
|
26
|
-
}
|
27
|
-
]
|
28
|
-
}
|
package/.storybook/main.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
import path from "path";
|
2
|
-
import {mergeConfig} from "vite";
|
3
|
-
import type {StorybookConfig} from "@storybook/react-vite";
|
4
|
-
|
5
|
-
const config: StorybookConfig = {
|
6
|
-
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
7
|
-
addons: ["@storybook/addon-essentials"],
|
8
|
-
framework: {
|
9
|
-
name: "@storybook/react-vite",
|
10
|
-
options: {},
|
11
|
-
},
|
12
|
-
viteFinal: config => {
|
13
|
-
return mergeConfig(config, {
|
14
|
-
resolve: {
|
15
|
-
alias: {
|
16
|
-
"adnbn-ui-config": path.resolve("src", "config", "default.ts"),
|
17
|
-
},
|
18
|
-
},
|
19
|
-
});
|
20
|
-
},
|
21
|
-
};
|
22
|
-
export default config;
|
package/.storybook/preview.tsx
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
import React, {useEffect} from "react";
|
2
|
-
import type {Preview, StoryContext, StoryFn} from "@storybook/react";
|
3
|
-
import {ThemeProvider} from "../src/providers";
|
4
|
-
import "./styles/preview.css";
|
5
|
-
|
6
|
-
const ThemeDecorator = (Story: StoryFn, context: StoryContext) => {
|
7
|
-
const dir = context.globals.dir || "ltr";
|
8
|
-
const theme = context.globals.theme || "light";
|
9
|
-
const cssVariables = context.globals.cssVariables || "default";
|
10
|
-
|
11
|
-
useEffect(() => {
|
12
|
-
document.documentElement.setAttribute("dir", dir);
|
13
|
-
return () => {
|
14
|
-
document.documentElement.removeAttribute("dir");
|
15
|
-
};
|
16
|
-
}, [dir]);
|
17
|
-
|
18
|
-
useEffect(() => {
|
19
|
-
document.documentElement.setAttribute("theme", theme);
|
20
|
-
return () => {
|
21
|
-
document.documentElement.removeAttribute("theme");
|
22
|
-
};
|
23
|
-
}, [theme]);
|
24
|
-
|
25
|
-
useEffect(() => {
|
26
|
-
if (cssVariables === "default") return;
|
27
|
-
|
28
|
-
const linkElement = document.createElement("link");
|
29
|
-
linkElement.rel = "stylesheet";
|
30
|
-
linkElement.href = "../.storybook/styles/custom.scss";
|
31
|
-
document.head.appendChild(linkElement);
|
32
|
-
|
33
|
-
return () => {
|
34
|
-
document.head.removeChild(linkElement);
|
35
|
-
};
|
36
|
-
}, [cssVariables]);
|
37
|
-
|
38
|
-
return (
|
39
|
-
<ThemeProvider>
|
40
|
-
<div className="story-wrapper">{Story(context.args, context)}</div>
|
41
|
-
</ThemeProvider>
|
42
|
-
);
|
43
|
-
};
|
44
|
-
|
45
|
-
const globalTypes = {
|
46
|
-
dir: {
|
47
|
-
name: "Direction",
|
48
|
-
description: "Choose direction",
|
49
|
-
defaultValue: "ltr",
|
50
|
-
toolbar: {
|
51
|
-
icon: "transfer",
|
52
|
-
items: [
|
53
|
-
{value: "ltr", title: "Left to right"},
|
54
|
-
{value: "rtl", title: "Right to left"},
|
55
|
-
],
|
56
|
-
showName: true,
|
57
|
-
},
|
58
|
-
},
|
59
|
-
theme: {
|
60
|
-
name: "Theme",
|
61
|
-
description: "Global theme for components",
|
62
|
-
defaultValue: "light",
|
63
|
-
toolbar: {
|
64
|
-
icon: "star",
|
65
|
-
items: [
|
66
|
-
{value: "light", title: "Light theme"},
|
67
|
-
{value: "dark", title: "Dark theme"},
|
68
|
-
],
|
69
|
-
showName: true,
|
70
|
-
},
|
71
|
-
},
|
72
|
-
cssVariables: {
|
73
|
-
name: "CSS Variables",
|
74
|
-
description: "Choose CSS variables set",
|
75
|
-
defaultValue: "default",
|
76
|
-
toolbar: {
|
77
|
-
icon: "paintbrush",
|
78
|
-
items: [
|
79
|
-
{value: "default", title: "Default Variables"},
|
80
|
-
{value: "custom", title: "Custom Variables"},
|
81
|
-
],
|
82
|
-
showName: true,
|
83
|
-
},
|
84
|
-
},
|
85
|
-
};
|
86
|
-
|
87
|
-
const preview: Preview = {
|
88
|
-
parameters: {
|
89
|
-
controls: {
|
90
|
-
matchers: {
|
91
|
-
color: /(background|color)$/i,
|
92
|
-
date: /Date$/i,
|
93
|
-
},
|
94
|
-
},
|
95
|
-
},
|
96
|
-
decorators: [ThemeDecorator],
|
97
|
-
globalTypes,
|
98
|
-
};
|
99
|
-
|
100
|
-
export default preview;
|
@@ -1,59 +0,0 @@
|
|
1
|
-
@use "../../src/styles/mixins" as theme;
|
2
|
-
|
3
|
-
@include theme.light {
|
4
|
-
--button-height-sm: 20px;
|
5
|
-
--button-height: 25px;
|
6
|
-
--button-height-md: 30px;
|
7
|
-
--button-height-lg: 40px;
|
8
|
-
|
9
|
-
--switch-border-radius: 5px;
|
10
|
-
--switch-width: 40px;
|
11
|
-
--switch-height: 20px;
|
12
|
-
--switch-thumb-width: 20px;
|
13
|
-
--switch-thumb-height: 16px;
|
14
|
-
|
15
|
-
--tooltip-border-radius: 10px;
|
16
|
-
--tooltip-padding: 5px 10px;
|
17
|
-
|
18
|
-
--toast-viewport-padding: 5px;
|
19
|
-
|
20
|
-
/* Common colors */
|
21
|
-
--primary-color: #29a383;
|
22
|
-
--secondary-color: #20573e;
|
23
|
-
--accent-color: #f76b15;
|
24
|
-
|
25
|
-
--bg-primary-color: #f5f6f7;
|
26
|
-
|
27
|
-
--text-primary-color: #111111;
|
28
|
-
|
29
|
-
/* Components colors */
|
30
|
-
--avatar-fallback-bg-color: #ffe7b3;
|
31
|
-
--avatar-fallback-color: #2e2f3b;
|
32
|
-
|
33
|
-
--icon-button-color: #004074;
|
34
|
-
--icon-button-bg-color: #70b8ff;
|
35
|
-
--icon-button-border-color: #c2e6ff;
|
36
|
-
--icon-button-color-hover: #104d87;
|
37
|
-
--icon-button-bg-color-hover: #70b8ff;
|
38
|
-
|
39
|
-
--tooltip-bg-color: #a39073;
|
40
|
-
}
|
41
|
-
|
42
|
-
@include theme.dark {
|
43
|
-
/* Common colors */
|
44
|
-
--bg-primary-color: #191919;
|
45
|
-
|
46
|
-
--text-primary-color: #b4b4b4;
|
47
|
-
|
48
|
-
/* Components colors */
|
49
|
-
--avatar-fallback-bg-color: #3f2700;
|
50
|
-
--avatar-fallback-color: #f5f6f7;
|
51
|
-
|
52
|
-
--icon-button-color: #0bd8b6;
|
53
|
-
--icon-button-bg-color: #023b37;
|
54
|
-
--icon-button-border-color: #084843;
|
55
|
-
--icon-button-color-hover: #adf0dd;
|
56
|
-
--icon-button-bg-color-hover: #0b3b2c;
|
57
|
-
|
58
|
-
--tooltip-bg-color: #d4b3a5;
|
59
|
-
}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
height: 100%;
|
3
|
-
width: 100%;
|
4
|
-
padding: 0 !important;
|
5
|
-
}
|
6
|
-
|
7
|
-
body.sb-main-padded {
|
8
|
-
height: 100vh;
|
9
|
-
}
|
10
|
-
|
11
|
-
.docs-story > div {
|
12
|
-
padding: 0;
|
13
|
-
overflow: hidden;
|
14
|
-
}
|
15
|
-
|
16
|
-
.docs-story .innerZoomElementWrapper > div {
|
17
|
-
width: 100%;
|
18
|
-
border: none !important;
|
19
|
-
}
|
20
|
-
|
21
|
-
#storybook-root {
|
22
|
-
height: 100%;
|
23
|
-
display: flex;
|
24
|
-
justify-content: center;
|
25
|
-
align-items: center;
|
26
|
-
}
|
27
|
-
|
28
|
-
/*Custom classes*/
|
29
|
-
.story-wrapper {
|
30
|
-
font-family: "Arial", sans-serif;
|
31
|
-
box-sizing: border-box;
|
32
|
-
width: 100%;
|
33
|
-
height: 100%;
|
34
|
-
padding: 50px 30px;
|
35
|
-
display: flex;
|
36
|
-
justify-content: center;
|
37
|
-
align-items: center;
|
38
|
-
background: var(--bg-primary-color);
|
39
|
-
}
|
40
|
-
|
41
|
-
.grid-wrapper {
|
42
|
-
display: grid;
|
43
|
-
gap: 25px;
|
44
|
-
justify-content: center;
|
45
|
-
align-items: center;
|
46
|
-
}
|
47
|
-
|
48
|
-
.item-card {
|
49
|
-
display: flex;
|
50
|
-
flex-direction: column;
|
51
|
-
gap: 15px;
|
52
|
-
justify-content: center;
|
53
|
-
align-items: center;
|
54
|
-
}
|
55
|
-
|
56
|
-
.item-card__title {
|
57
|
-
color: var(--text-primary-color);
|
58
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
import {beforeAll} from "vitest";
|
2
|
-
import {setProjectAnnotations} from "@storybook/react";
|
3
|
-
import * as projectAnnotations from "./preview";
|
4
|
-
|
5
|
-
// This is an important step to apply the right configuration when testing your stories.
|
6
|
-
// More info at: https://storybook.js.org/docs/api/portable-stories/portable-stories-vitest#setprojectannotations
|
7
|
-
const project = setProjectAnnotations([projectAnnotations]);
|
8
|
-
|
9
|
-
beforeAll(project.beforeAll);
|
package/eslint.config.js
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
import js from "@eslint/js";
|
2
|
-
import tseslint from "typescript-eslint";
|
3
|
-
|
4
|
-
import globals from "globals";
|
5
|
-
|
6
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
7
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
8
|
-
|
9
|
-
export default tseslint.config(
|
10
|
-
{
|
11
|
-
ignores: [
|
12
|
-
"dist",
|
13
|
-
"addon",
|
14
|
-
".adnbn",
|
15
|
-
"build",
|
16
|
-
"node_modules",
|
17
|
-
"coverage",
|
18
|
-
".storybook",
|
19
|
-
"public",
|
20
|
-
"*.config.js"
|
21
|
-
]
|
22
|
-
},
|
23
|
-
{
|
24
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
25
|
-
files: ["**/*.{ts,tsx}"],
|
26
|
-
languageOptions: {
|
27
|
-
ecmaVersion: 2020,
|
28
|
-
globals: globals.browser,
|
29
|
-
},
|
30
|
-
plugins: {
|
31
|
-
"react-hooks": reactHooks,
|
32
|
-
"react-refresh": reactRefresh,
|
33
|
-
},
|
34
|
-
rules: {
|
35
|
-
...reactHooks.configs.recommended.rules,
|
36
|
-
"react-refresh/only-export-components": "off",
|
37
|
-
},
|
38
|
-
}
|
39
|
-
);
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import {Meta, StoryObj} from "@storybook/react";
|
2
|
-
|
3
|
-
import {capitalizeFirstLetter, hideInTable} from "../../utils";
|
4
|
-
|
5
|
-
import AvatarComponent, {AvatarRadius, AvatarSize} from "./Avatar";
|
6
|
-
|
7
|
-
const sizes: (AvatarSize | "default")[] = [AvatarSize.Small, "default", AvatarSize.Medium, AvatarSize.Large];
|
8
|
-
const radius: (AvatarRadius | "default")[] = [AvatarRadius.Small, AvatarRadius.Medium, AvatarRadius.Large, "default"];
|
9
|
-
|
10
|
-
const meta: Meta<typeof AvatarComponent> = {
|
11
|
-
title: "Components/Avatar",
|
12
|
-
component: AvatarComponent,
|
13
|
-
tags: ["autodocs"],
|
14
|
-
argTypes: {
|
15
|
-
size: {
|
16
|
-
options: sizes,
|
17
|
-
control: {type: "select"},
|
18
|
-
},
|
19
|
-
radius: {
|
20
|
-
options: radius,
|
21
|
-
control: {type: "select"},
|
22
|
-
},
|
23
|
-
fallbackClassName: hideInTable,
|
24
|
-
imageClassName: hideInTable,
|
25
|
-
children: hideInTable,
|
26
|
-
},
|
27
|
-
};
|
28
|
-
|
29
|
-
export default meta;
|
30
|
-
|
31
|
-
export const Avatar: StoryObj<typeof AvatarComponent> = {
|
32
|
-
args: {
|
33
|
-
src: "https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80",
|
34
|
-
fallback: "CT",
|
35
|
-
},
|
36
|
-
};
|
37
|
-
|
38
|
-
export const AvatarRadiusGrid = () => {
|
39
|
-
return (
|
40
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
41
|
-
{radius.map(radius => (
|
42
|
-
<div key={radius} className="item-card">
|
43
|
-
<span className="item-card__title">{capitalizeFirstLetter(radius)}</span>
|
44
|
-
<AvatarComponent
|
45
|
-
src="https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80"
|
46
|
-
radius={radius !== "default" ? radius : undefined}
|
47
|
-
fallback="CT"
|
48
|
-
/>
|
49
|
-
</div>
|
50
|
-
))}
|
51
|
-
</div>
|
52
|
-
);
|
53
|
-
};
|
54
|
-
|
55
|
-
export const Size = () => {
|
56
|
-
return (
|
57
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
58
|
-
{sizes.map(size => (
|
59
|
-
<div key={size} className="item-card">
|
60
|
-
<span className="item-card__title">{capitalizeFirstLetter(size)}</span>
|
61
|
-
<AvatarComponent
|
62
|
-
src="https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80"
|
63
|
-
size={size !== "default" ? size : undefined}
|
64
|
-
fallback="CT"
|
65
|
-
/>
|
66
|
-
</div>
|
67
|
-
))}
|
68
|
-
</div>
|
69
|
-
);
|
70
|
-
};
|
71
|
-
|
72
|
-
export const SizeWithSVG = () => {
|
73
|
-
return (
|
74
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
75
|
-
{sizes.map(size => (
|
76
|
-
<div key={size} className="item-card">
|
77
|
-
<span className="item-card__title">{capitalizeFirstLetter(size)}</span>
|
78
|
-
<AvatarComponent
|
79
|
-
src="https://freesvg.org/img/Female-Avatar-5.png"
|
80
|
-
size={size !== "default" ? size : undefined}
|
81
|
-
fallback="CT"
|
82
|
-
/>
|
83
|
-
</div>
|
84
|
-
))}
|
85
|
-
</div>
|
86
|
-
);
|
87
|
-
};
|
88
|
-
|
89
|
-
export const SizeWithFallback = () => {
|
90
|
-
return (
|
91
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
92
|
-
{sizes.map(size => (
|
93
|
-
<div key={size} className="item-card">
|
94
|
-
<span className="item-card__title">{capitalizeFirstLetter(size)}</span>
|
95
|
-
<AvatarComponent src="" size={size !== "default" ? size : undefined} fallback="CT" />
|
96
|
-
</div>
|
97
|
-
))}
|
98
|
-
</div>
|
99
|
-
);
|
100
|
-
};
|
101
|
-
|
102
|
-
export const SizeRadius = () => {
|
103
|
-
return (
|
104
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
105
|
-
{sizes.map(size =>
|
106
|
-
radius.map(radius => (
|
107
|
-
<div key={`${radius}-${size}`} className="item-card">
|
108
|
-
<AvatarComponent
|
109
|
-
src="https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80"
|
110
|
-
radius={radius !== "default" ? radius : undefined}
|
111
|
-
size={size !== "default" ? size : undefined}
|
112
|
-
/>
|
113
|
-
</div>
|
114
|
-
))
|
115
|
-
)}
|
116
|
-
</div>
|
117
|
-
);
|
118
|
-
};
|
@@ -1,148 +0,0 @@
|
|
1
|
-
import {Meta, StoryObj} from "@storybook/react";
|
2
|
-
|
3
|
-
import {capitalizeFirstLetter, hideInTable} from "../../utils";
|
4
|
-
|
5
|
-
import ButtonComponent, {ButtonColor, ButtonRadius, ButtonSize, ButtonVariant} from "./Button";
|
6
|
-
|
7
|
-
const variants: ButtonVariant[] = [ButtonVariant.Contained, ButtonVariant.Outlined, ButtonVariant.Text];
|
8
|
-
const colors: (ButtonColor | "default")[] = ["default", ButtonColor.Primary, ButtonColor.Secondary, ButtonColor.Accent];
|
9
|
-
const sizes: (ButtonSize | "default")[] = [ButtonSize.Small, "default", ButtonSize.Medium, ButtonSize.Large];
|
10
|
-
const radius: (ButtonRadius | "default")[] = [
|
11
|
-
ButtonRadius.Small,
|
12
|
-
"default",
|
13
|
-
ButtonRadius.Medium,
|
14
|
-
ButtonRadius.Large,
|
15
|
-
ButtonRadius.Full,
|
16
|
-
];
|
17
|
-
|
18
|
-
const meta: Meta<typeof ButtonComponent> = {
|
19
|
-
title: "Components/Button",
|
20
|
-
component: ButtonComponent,
|
21
|
-
tags: ["autodocs"],
|
22
|
-
argTypes: {
|
23
|
-
variant: {
|
24
|
-
options: variants,
|
25
|
-
control: {type: "select"},
|
26
|
-
},
|
27
|
-
color: {
|
28
|
-
options: colors,
|
29
|
-
control: {type: "select"},
|
30
|
-
},
|
31
|
-
size: {
|
32
|
-
options: sizes,
|
33
|
-
control: {type: "select"},
|
34
|
-
},
|
35
|
-
radius: {
|
36
|
-
options: radius,
|
37
|
-
control: {type: "select"},
|
38
|
-
},
|
39
|
-
|
40
|
-
after: hideInTable,
|
41
|
-
before: hideInTable,
|
42
|
-
afterClassName: hideInTable,
|
43
|
-
beforeClassName: hideInTable,
|
44
|
-
childrenClassName: hideInTable,
|
45
|
-
},
|
46
|
-
};
|
47
|
-
|
48
|
-
export default meta;
|
49
|
-
|
50
|
-
export const Button: StoryObj<typeof ButtonComponent> = {
|
51
|
-
args: {
|
52
|
-
children: "Button",
|
53
|
-
},
|
54
|
-
};
|
55
|
-
|
56
|
-
export const VariantColor = () => {
|
57
|
-
return (
|
58
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
59
|
-
{variants.map(variant =>
|
60
|
-
colors.map(color => (
|
61
|
-
<div key={`${variant}-${color}`}>
|
62
|
-
<ButtonComponent variant={variant} color={color !== "default" ? color : undefined}>
|
63
|
-
{capitalizeFirstLetter(color)}
|
64
|
-
</ButtonComponent>
|
65
|
-
</div>
|
66
|
-
))
|
67
|
-
)}
|
68
|
-
</div>
|
69
|
-
);
|
70
|
-
};
|
71
|
-
|
72
|
-
export const VariantColorDisabled = () => {
|
73
|
-
return (
|
74
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
75
|
-
{variants.map(variant =>
|
76
|
-
colors.map(color => (
|
77
|
-
<div key={`${variant}-${color}`}>
|
78
|
-
<ButtonComponent disabled variant={variant} color={color !== "default" ? color : undefined}>
|
79
|
-
{capitalizeFirstLetter(color)}
|
80
|
-
</ButtonComponent>
|
81
|
-
</div>
|
82
|
-
))
|
83
|
-
)}
|
84
|
-
</div>
|
85
|
-
);
|
86
|
-
};
|
87
|
-
|
88
|
-
export const VariantSize = () => {
|
89
|
-
return (
|
90
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(4, auto)"}}>
|
91
|
-
{variants.map(variant =>
|
92
|
-
sizes.map(size => (
|
93
|
-
<div key={`${variant}-${size}`}>
|
94
|
-
<ButtonComponent variant={variant} size={size !== "default" ? size : undefined}>
|
95
|
-
{capitalizeFirstLetter(size)}
|
96
|
-
</ButtonComponent>
|
97
|
-
</div>
|
98
|
-
))
|
99
|
-
)}
|
100
|
-
</div>
|
101
|
-
);
|
102
|
-
};
|
103
|
-
|
104
|
-
export const VariantRadius = () => {
|
105
|
-
return (
|
106
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(5, auto)"}}>
|
107
|
-
{variants.map(variant =>
|
108
|
-
radius.map(radius => (
|
109
|
-
<div key={`${variant}-${radius}`}>
|
110
|
-
<ButtonComponent variant={variant} radius={radius !== "default" ? radius : undefined}>
|
111
|
-
{capitalizeFirstLetter(radius)}
|
112
|
-
</ButtonComponent>
|
113
|
-
</div>
|
114
|
-
))
|
115
|
-
)}
|
116
|
-
</div>
|
117
|
-
);
|
118
|
-
};
|
119
|
-
|
120
|
-
export const SizeRadius = () => {
|
121
|
-
return (
|
122
|
-
<div className="grid-wrapper" style={{gridTemplateColumns: "repeat(5, auto)"}}>
|
123
|
-
<span className="item-card__title"> Radius \ Size </span>
|
124
|
-
{sizes.map(size => (
|
125
|
-
<span key={size} className="item-card__title">
|
126
|
-
{capitalizeFirstLetter(size)} size
|
127
|
-
</span>
|
128
|
-
))}
|
129
|
-
{radius.map(radius => (
|
130
|
-
<>
|
131
|
-
<span key={radius} className="item-card__title">
|
132
|
-
{capitalizeFirstLetter(radius)} radius
|
133
|
-
</span>
|
134
|
-
{sizes.map(size => (
|
135
|
-
<div key={`${size}-${radius}`} className="item-card">
|
136
|
-
<ButtonComponent
|
137
|
-
size={size !== "default" ? size : undefined}
|
138
|
-
radius={radius !== "default" ? radius : undefined}
|
139
|
-
>
|
140
|
-
Button
|
141
|
-
</ButtonComponent>
|
142
|
-
</div>
|
143
|
-
))}
|
144
|
-
</>
|
145
|
-
))}
|
146
|
-
</div>
|
147
|
-
);
|
148
|
-
};
|