bonkers-ui 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +2 -1
- package/.husky/pre-commit +1 -0
- package/.storybook/preview.js +17 -1
- package/.stylelintrc +24 -22
- package/package.json +13 -5
- package/postcss.config.js +1 -1
- package/src/_colors.json +66 -5
- package/src/_font-sizes.json +10 -1
- package/src/_samples/check-icon.vue +22 -0
- package/src/_samples/icon.vue +19 -0
- package/src/_shadow.json +4 -0
- package/src/_spacing.json +9 -0
- package/src/_styles/colors.css +70 -0
- package/src/_styles/font-sizes.css +15 -0
- package/src/_styles/shadow.css +7 -0
- package/src/_styles/spacing.css +12 -0
- package/src/_types/align.ts +8 -0
- package/src/_types/colors.ts +58 -0
- package/src/_types/sizing.ts +9 -0
- package/src/components/ui-button/_typings.ts +5 -0
- package/src/components/ui-button/index.ts +1 -3
- package/src/components/ui-button/ui-button.stories.ts +58 -10
- package/src/components/ui-button/ui-button.test.ts +6 -6
- package/src/components/ui-button/ui-button.vue +29 -12
- package/src/components/ui-card-cta/index.ts +1 -0
- package/src/components/ui-card-cta/ui-card-cta.stories.ts +62 -0
- package/src/components/ui-card-cta/ui-card-cta.vue +85 -0
- package/src/components/ui-card-simple/index.ts +1 -0
- package/src/components/ui-card-simple/ui-card-simple.stories.ts +41 -0
- package/src/components/ui-card-simple/ui-card-simple.vue +35 -0
- package/src/components/ui-checkbox/intext.ts +1 -0
- package/src/components/ui-checkbox/ui-checkbox.stories.ts +62 -0
- package/src/components/ui-checkbox/ui-checkbox.vue +152 -0
- package/src/components/ui-icon/_typings.ts +3 -0
- package/src/components/ui-icon/index.ts +2 -0
- package/src/components/ui-icon/ui-icon.stories.ts +46 -0
- package/src/components/ui-icon/ui-icon.vue +29 -0
- package/src/components/ui-input/_typings.ts +6 -0
- package/src/components/ui-input/index.ts +1 -0
- package/src/components/ui-input/ui-input.stories.ts +90 -0
- package/src/components/ui-input/ui-input.vue +45 -0
- package/src/components/ui-radio/index.ts +1 -0
- package/src/components/ui-radio/ui-radio.stories.ts +62 -0
- package/src/components/ui-radio/ui-radio.vue +71 -0
- package/src/components/ui-radio-list-fancy/index.ts +1 -0
- package/src/components/ui-radio-list-fancy/ui-radio-item/index.ts +1 -0
- package/src/components/ui-radio-list-fancy/ui-radio-item/ui-radio-item.vue +66 -0
- package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.stories.ts +38 -0
- package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.vue +60 -0
- package/src/components/ui-ripple/index.ts +1 -0
- package/src/components/ui-ripple/ui-ripple.stories.ts +59 -0
- package/src/components/ui-ripple/ui-ripple.vue +88 -0
- package/src/components/ui-typography/_typings.ts +56 -0
- package/src/components/ui-typography/index.ts +2 -0
- package/src/components/ui-typography/ui-typography.stories.ts +80 -0
- package/src/components/ui-typography/ui-typography.vue +117 -0
- package/src/components/ui-verification-input/index.ts +1 -0
- package/src/components/ui-verification-input/ui-verification-input.stories.ts +46 -0
- package/src/components/ui-verification-input/ui-verification-input.vue +128 -0
- package/src/main.css +7 -12
- package/src/stories/assets/code-brackets.svg +1 -1
- package/src/stories/colors/colors.stories.ts +1 -1
- package/src/stories/colors/ui-colors.vue +78 -24
- package/src/stories/helper.ts +5 -0
- package/src/stories/spacings/spacings.stories.ts +13 -0
- package/src/stories/spacings/ui-spacings.vue +50 -0
- package/tailwind.config.js +5 -1
- package/tsconfig.json +2 -6
- package/vite.config.ts +4 -7
- package/src/assets/logo.png +0 -0
package/.eslintrc.js
CHANGED
package/.husky/pre-commit
CHANGED
package/.storybook/preview.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import {app} from '@storybook/vue3';
|
|
2
|
+
/* import the fontawesome core */
|
|
3
|
+
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
4
|
+
|
|
5
|
+
/* import font awesome icon component */
|
|
6
|
+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
|
7
|
+
|
|
8
|
+
/* import specific icons */
|
|
9
|
+
import { faUserSecret } from '@fortawesome/free-solid-svg-icons';
|
|
10
|
+
import { faFaceSmile } from '@fortawesome/free-regular-svg-icons';
|
|
11
|
+
|
|
12
|
+
/* add icons to the library */
|
|
13
|
+
library.add(faUserSecret, faFaceSmile);
|
|
14
|
+
|
|
15
|
+
import '../src/main.css';
|
|
16
|
+
|
|
17
|
+
app.component('font-awesome-icon', FontAwesomeIcon)
|
|
2
18
|
|
|
3
19
|
export const parameters = {
|
|
4
20
|
darkMode: false,
|
package/.stylelintrc
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
"extends": [
|
|
3
|
+
"stylelint-config-recommended",
|
|
4
|
+
"stylelint-config-standard",
|
|
5
|
+
"stylelint-config-recommended-vue"
|
|
6
|
+
],
|
|
7
|
+
"rules": {
|
|
8
|
+
"at-rule-no-unknown": [
|
|
9
|
+
true,
|
|
10
|
+
{
|
|
11
|
+
"ignoreAtRules": [
|
|
12
|
+
"extends",
|
|
13
|
+
"tailwind"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"indentation": [
|
|
18
|
+
"tab",
|
|
19
|
+
{
|
|
20
|
+
"baseIndentLevel": 1
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"selector-class-pattern": null
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bonkers-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"storybook": "start-storybook -p 6006",
|
|
6
6
|
"build-storybook": "build-storybook",
|
|
7
|
-
"lint:script": "eslint --
|
|
8
|
-
"lint:style": "stylelint ./src/**/*.{css,scss,vue}",
|
|
7
|
+
"lint:script": "eslint --fix './src/**/*.{ts,tsx,vue}'",
|
|
8
|
+
"lint:style": "stylelint --fix './src/**/*.{css,scss,vue}'",
|
|
9
9
|
"lint:markup": "vue-tsc --noEmit",
|
|
10
10
|
"test": "jest",
|
|
11
11
|
"deploy": "gh-pages -d storybook-static",
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
"i": "yarn install --frozen-lockfile"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
+
"@fortawesome/fontawesome-svg-core": "^6.1.1",
|
|
17
|
+
"@fortawesome/free-brands-svg-icons": "^6.1.1",
|
|
18
|
+
"@fortawesome/free-regular-svg-icons": "^6.1.1",
|
|
19
|
+
"@fortawesome/free-solid-svg-icons": "^6.1.1",
|
|
20
|
+
"@fortawesome/vue-fontawesome": "^3.0.1",
|
|
16
21
|
"vue": "^3.2.37"
|
|
17
22
|
},
|
|
18
23
|
"devDependencies": {
|
|
@@ -23,6 +28,7 @@
|
|
|
23
28
|
"@storybook/builder-vite": "^0.1.36",
|
|
24
29
|
"@storybook/vue3": "^6.5.9",
|
|
25
30
|
"@types/jest": "^28.1.3",
|
|
31
|
+
"@types/uuid": "^8.3.4",
|
|
26
32
|
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
27
33
|
"@typescript-eslint/parser": "^5.29.0",
|
|
28
34
|
"@vitejs/plugin-vue": "^2.3.3",
|
|
@@ -70,8 +76,10 @@
|
|
|
70
76
|
}
|
|
71
77
|
},
|
|
72
78
|
"lint-staged": {
|
|
73
|
-
"*.{ts,vue}":
|
|
74
|
-
|
|
79
|
+
"*.{ts,tsx,vue}": [
|
|
80
|
+
"eslint --fix"
|
|
81
|
+
],
|
|
82
|
+
"*.{css,vue,tsx}": "stylelint --fix"
|
|
75
83
|
},
|
|
76
84
|
"license": "MIT"
|
|
77
85
|
}
|
package/postcss.config.js
CHANGED
package/src/_colors.json
CHANGED
|
@@ -1,11 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"white": "var(--color-white)",
|
|
3
3
|
"black": "var(--color-black)",
|
|
4
|
-
"primary": "var(--color-primary)",
|
|
5
|
-
"secondary": "var(--color-secondary)",
|
|
6
|
-
"warning": "var(--color-warning)",
|
|
7
|
-
"error": "var(--color-error)",
|
|
8
4
|
"transparent": "var(--color-transparent)",
|
|
9
|
-
"current": "var(--color-current)"
|
|
5
|
+
"current": "var(--color-current)",
|
|
6
|
+
|
|
7
|
+
"primary": {
|
|
8
|
+
"DEFAULT": "var(--color-primary)",
|
|
9
|
+
"300": "var(--color-primary-300)",
|
|
10
|
+
"400": "var(--color-primary-400)",
|
|
11
|
+
"500": "var(--color-primary-500)",
|
|
12
|
+
"600": "var(--color-primary-600)",
|
|
13
|
+
"700": "var(--color-primary-700)"
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
"primary-alt": {
|
|
17
|
+
"DEFAULT": "var(--color-primary-alt)",
|
|
18
|
+
"300": "var(--color-primary-alt-300)",
|
|
19
|
+
"400": "var(--color-primary-alt-400)",
|
|
20
|
+
"500": "var(--color-primary-alt-500)",
|
|
21
|
+
"600": "var(--color-primary-alt-600)",
|
|
22
|
+
"700": "var(--color-primary-alt-700)"
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
"secondary": {
|
|
26
|
+
"DEFAULT": "var(--color-secondary)",
|
|
27
|
+
"300": "var(--color-secondary-300)",
|
|
28
|
+
"400": "var(--color-secondary-400)",
|
|
29
|
+
"500": "var(--color-secondary-500)",
|
|
30
|
+
"600": "var(--color-secondary-600)",
|
|
31
|
+
"700": "var(--color-secondary-700)"
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"warning": {
|
|
35
|
+
"DEFAULT": "var(--color-warning)",
|
|
36
|
+
"300": "var(--color-warning-300)",
|
|
37
|
+
"400": "var(--color-warning-400)",
|
|
38
|
+
"500": "var(--color-warning-500)",
|
|
39
|
+
"600": "var(--color-warning-600)",
|
|
40
|
+
"700": "var(--color-warning-700)"
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
"error": {
|
|
44
|
+
"DEFAULT": "var(--color-error)",
|
|
45
|
+
"300": "var(--color-error-300)",
|
|
46
|
+
"400": "var(--color-error-400)",
|
|
47
|
+
"500": "var(--color-error-500)",
|
|
48
|
+
"600": "var(--color-error-600)",
|
|
49
|
+
"700": "var(--color-error-700)"
|
|
50
|
+
},
|
|
51
|
+
"accent": {
|
|
52
|
+
"DEFAULT": "var(--color-accent)",
|
|
53
|
+
"300": "var(--color-accent-300)",
|
|
54
|
+
"500": "var(--color-accent-500)",
|
|
55
|
+
"600": "var(--color-accent-600)",
|
|
56
|
+
"700": "var(--color-accent-700)"
|
|
57
|
+
},
|
|
58
|
+
"accent-alt": {
|
|
59
|
+
"DEFAULT": "var(--color-accent)",
|
|
60
|
+
"500": "var(--color-accent-500)"
|
|
61
|
+
},
|
|
62
|
+
"secondary-alt": {
|
|
63
|
+
"DEFAULT": "var(--color-secondary-alt)",
|
|
64
|
+
"200": "var(--color-secondary-alt-200)",
|
|
65
|
+
"300": "var(--color-secondary-alt-300)",
|
|
66
|
+
"400": "var(--color-secondary-alt-400)",
|
|
67
|
+
"500": "var(--color-secondary-alt-500)",
|
|
68
|
+
"600": "var(--color-secondary-alt-600)",
|
|
69
|
+
"700": "var(--color-secondary-alt-700)"
|
|
70
|
+
}
|
|
10
71
|
}
|
|
11
72
|
|
package/src/_font-sizes.json
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"xxs": "var(--font-size-xxs)",
|
|
3
|
+
"xs": "var(--font-size-xs)",
|
|
4
|
+
"sm": "var(--font-size-sm)",
|
|
5
|
+
"m": "var(--font-size-m)",
|
|
6
|
+
"lg": "var(--font-size-lg)",
|
|
7
|
+
"xl": "var(--font-size-xl)",
|
|
8
|
+
"2xl": "var(--font-size-2xl)",
|
|
9
|
+
"3xl": "var(--font-size-3xl)",
|
|
10
|
+
"4xl": "var(--font-size-4xl)",
|
|
11
|
+
"5xl": "var(--font-size-5xl)"
|
|
3
12
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
:width="size"
|
|
4
|
+
:height="size"
|
|
5
|
+
:class="classes"
|
|
6
|
+
viewBox="0 0 16 11"
|
|
7
|
+
fill="none"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
>
|
|
10
|
+
<path
|
|
11
|
+
stroke="currentColor"
|
|
12
|
+
d="M15 2.03125L6.5 10.5312C6.375 10.6875 6.1875 10.75 6 10.75C5.78125 10.75 5.59375 10.6875 5.46875 10.5312L0.96875 6.03125C0.65625 5.75 0.65625 5.28125 0.96875 5C1.25 4.6875 1.71875 4.6875 2 5L6 8.96875L13.9688 1C14.25 0.6875 14.7188 0.6875 15 1C15.3125 1.28125 15.3125 1.75 15 2.03125Z"
|
|
13
|
+
/>
|
|
14
|
+
</svg>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
defineProps<{
|
|
19
|
+
size?: number;
|
|
20
|
+
classes?: string;
|
|
21
|
+
}>();
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<svg
|
|
3
|
+
:width="size"
|
|
4
|
+
:height="size"
|
|
5
|
+
viewBox="0 0 100 100"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
fill="currentColor"
|
|
8
|
+
>
|
|
9
|
+
<path
|
|
10
|
+
d="M50 0L60.9065 23.6694L85.3553 14.6447L76.3306 39.0935L100 50L76.3306 60.9065L85.3553 85.3553L60.9065 76.3306L50 100L39.0935 76.3306L14.6447 85.3553L23.6694 60.9065L0 50L23.6694 39.0935L14.6447 14.6447L39.0935 23.6694L50 0Z"
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
defineProps<{
|
|
17
|
+
size: number
|
|
18
|
+
}>();
|
|
19
|
+
</script>
|
package/src/_shadow.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
@layer base {
|
|
2
|
+
:root {
|
|
3
|
+
/* colors */
|
|
4
|
+
--color-white: white;
|
|
5
|
+
--color-black: black;
|
|
6
|
+
--color-current: currentcolor;
|
|
7
|
+
--color-transparent: transparent;
|
|
8
|
+
|
|
9
|
+
/* colors/primary */
|
|
10
|
+
--color-primary-300: #9adc9e;
|
|
11
|
+
--color-primary-400: #78d17d;
|
|
12
|
+
--color-primary-500: #56c55d;
|
|
13
|
+
--color-primary-600: #459e4a;
|
|
14
|
+
--color-primary-700: #347638;
|
|
15
|
+
--color-primary: var(--color-primary-500);
|
|
16
|
+
|
|
17
|
+
/* colors/primary-alt */
|
|
18
|
+
--color-primary-alt-300: #83e4ad;
|
|
19
|
+
--color-primary-alt-400: #5adb92;
|
|
20
|
+
--color-primary-alt-500: #31d277;
|
|
21
|
+
--color-primary-alt-600: #27a85f;
|
|
22
|
+
--color-primary-alt-700: #1d7e47;
|
|
23
|
+
--color-primary-alt: var(--color-primary-500);
|
|
24
|
+
|
|
25
|
+
/* colors/secondary */
|
|
26
|
+
--color-secondary-300: #848793;
|
|
27
|
+
--color-secondary-400: #5b5f6f;
|
|
28
|
+
--color-secondary-500: #32374b;
|
|
29
|
+
--color-secondary-600: #282c3c;
|
|
30
|
+
--color-secondary-700: #1e212d;
|
|
31
|
+
--color-secondary: var(--color-secondary-500);
|
|
32
|
+
|
|
33
|
+
/* colors/error */
|
|
34
|
+
--color-error-300: #f7989d;
|
|
35
|
+
--color-error-400: #f5767c;
|
|
36
|
+
--color-error-500: #f2545b;
|
|
37
|
+
--color-error-600: #c24349;
|
|
38
|
+
--color-error-700: #913237;
|
|
39
|
+
--color-error: var(--color-error-500);
|
|
40
|
+
|
|
41
|
+
/* colors/warning */
|
|
42
|
+
--color-warning-300: #ffbc9b;
|
|
43
|
+
--color-warning-400: #ffa57a;
|
|
44
|
+
--color-warning-500: #ff8f59;
|
|
45
|
+
--color-warning-600: #cc7247;
|
|
46
|
+
--color-warning-700: #995635;
|
|
47
|
+
--color-warning: var(--color-warning-500);
|
|
48
|
+
|
|
49
|
+
/* colors/accent */
|
|
50
|
+
--color-accent-300: #8e8efa;
|
|
51
|
+
--color-accent-400: #6868f9;
|
|
52
|
+
--color-accent-500: #4242f7;
|
|
53
|
+
--color-accent-600: #3535c6;
|
|
54
|
+
--color-accent-700: #282894;
|
|
55
|
+
--color-accent: var(--color-accent-500);
|
|
56
|
+
|
|
57
|
+
/* colors/accent-alt */
|
|
58
|
+
--color-accent-alt-500: #6236ff;
|
|
59
|
+
--color-accent-alt: var(--color-accent-alt-500);
|
|
60
|
+
|
|
61
|
+
/* colors/secondary-alt */
|
|
62
|
+
--color-secondary-alt-200: #f4f5f8;
|
|
63
|
+
--color-secondary-alt-300: #dfe1e9;
|
|
64
|
+
--color-secondary-alt-400: #b4b8cd;
|
|
65
|
+
--color-secondary-alt-500: #949ab7;
|
|
66
|
+
--color-secondary-alt-600: #767b92;
|
|
67
|
+
--color-secondary-alt-700: #595c6e;
|
|
68
|
+
--color-secondary-alt: var(--color-secondary-alt-500);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@layer base {
|
|
2
|
+
:root {
|
|
3
|
+
/* font sizes */
|
|
4
|
+
--font-size-xxs: 10px;
|
|
5
|
+
--font-size-xs: 12px;
|
|
6
|
+
--font-size-sm: 14px;
|
|
7
|
+
--font-size-m: 16px;
|
|
8
|
+
--font-size-lg: 18px;
|
|
9
|
+
--font-size-xl: 20px;
|
|
10
|
+
--font-size-2xl: 24px;
|
|
11
|
+
--font-size-3xl: 28px;
|
|
12
|
+
--font-size-4xl: 32px;
|
|
13
|
+
--font-size-5xl: 40px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export enum EColors {
|
|
2
|
+
WHITE = "white",
|
|
3
|
+
BLACK = "black",
|
|
4
|
+
TRANSPARENT = "transparent",
|
|
5
|
+
CURRENT = "current",
|
|
6
|
+
|
|
7
|
+
PRIMARY = "primary",
|
|
8
|
+
PRIMARY_300 = "primary-300",
|
|
9
|
+
PRIMARY_400 = "primary-400",
|
|
10
|
+
PRIMARY_500 = "primary-500",
|
|
11
|
+
PRIMARY_600 = "primary-600",
|
|
12
|
+
PRIMARY_700 = "primary-700",
|
|
13
|
+
|
|
14
|
+
PRIMARY_ALT = "primary-alt",
|
|
15
|
+
PRIMARY_ALT_300 = "primary-alt-300",
|
|
16
|
+
PRIMARY_ALT_400 = "primary-alt-400",
|
|
17
|
+
PRIMARY_ALT_500 = "primary-alt-500",
|
|
18
|
+
PRIMARY_ALT_600 = "primary-alt-600",
|
|
19
|
+
PRIMARY_ALT_700 = "primary-alt-700",
|
|
20
|
+
|
|
21
|
+
SECONDARY = "secondary",
|
|
22
|
+
SECONDARY_300 = "secondary-300",
|
|
23
|
+
SECONDARY_400 = "secondary-400",
|
|
24
|
+
SECONDARY_500 = "secondary-500",
|
|
25
|
+
SECONDARY_600 = "secondary-600",
|
|
26
|
+
SECONDARY_700 = "secondary-700",
|
|
27
|
+
|
|
28
|
+
WARNING = "warning",
|
|
29
|
+
WARNING_300 = "warning-300",
|
|
30
|
+
WARNING_400 = "warning-400",
|
|
31
|
+
WARNING_500 = "warning-500",
|
|
32
|
+
WARNING_600 = "warning-600",
|
|
33
|
+
WARNING_700 = "warning-700",
|
|
34
|
+
|
|
35
|
+
ERROR = "error",
|
|
36
|
+
ERROR_300 = "error-300",
|
|
37
|
+
ERROR_400 = "error-400",
|
|
38
|
+
ERROR_500 = "error-500",
|
|
39
|
+
ERROR_600 = "error-600",
|
|
40
|
+
ERROR_700 = "error-700",
|
|
41
|
+
|
|
42
|
+
ACCENT = "accent",
|
|
43
|
+
ACCENT_300 = "accent-300",
|
|
44
|
+
ACCENT_500 = "accent-500",
|
|
45
|
+
ACCENT_600 = "accent-600",
|
|
46
|
+
ACCENT_700 = "accent-700",
|
|
47
|
+
|
|
48
|
+
ACCENT_ALT = "accent-alt",
|
|
49
|
+
ACCENT_ALT_500 = "accent-alt-500",
|
|
50
|
+
|
|
51
|
+
SECONDARY_ALT = "secondary-alt",
|
|
52
|
+
SECONDARY_ALT_200 = "secondary-alt-200",
|
|
53
|
+
SECONDARY_ALT_300 = "secondary-alt-300",
|
|
54
|
+
SECONDARY_ALT_400 = "secondary-alt-400",
|
|
55
|
+
SECONDARY_ALT_500 = "secondary-alt-500",
|
|
56
|
+
SECONDARY_ALT_600 = "secondary-alt-600",
|
|
57
|
+
SECONDARY_ALT_700 = "secondary-alt-700",
|
|
58
|
+
}
|
|
@@ -3,6 +3,11 @@ export enum EButtonTypes {
|
|
|
3
3
|
SECONDARY = "secondary",
|
|
4
4
|
ERROR = "error",
|
|
5
5
|
WARNING = "warning",
|
|
6
|
+
PRIMARY_OVERLAY = "primary-overlay",
|
|
7
|
+
SECONDARY_OVERLAY = "secondary-overlay",
|
|
8
|
+
ERROR_OVERLAY = "error-overlay",
|
|
9
|
+
WARNING_OVERLAY = "warning-overlay",
|
|
10
|
+
LINK = "link",
|
|
6
11
|
}
|
|
7
12
|
export enum EButtonSizes {
|
|
8
13
|
SMALL = "sm",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import UiButton from "
|
|
1
|
+
import UiButton from "../ui-button";
|
|
2
2
|
import { EButtonSizes, EButtonTypes } from "./_typings";
|
|
3
|
-
import { Story } from "@storybook/vue3"
|
|
3
|
+
import { Story } from "@storybook/vue3";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: "Components/ui-button",
|
|
7
7
|
component: UiButton,
|
|
8
8
|
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
9
9
|
argTypes: {
|
|
10
|
-
|
|
10
|
+
className: {
|
|
11
11
|
control: { type: "select" },
|
|
12
12
|
options: ["small", "medium", "large"],
|
|
13
13
|
description: "The button size",
|
|
@@ -22,19 +22,27 @@ export default {
|
|
|
22
22
|
options: Object.values(EButtonSizes),
|
|
23
23
|
description: "The button sizes",
|
|
24
24
|
},
|
|
25
|
+
fullWidth: {
|
|
26
|
+
control: { type: "boolean" },
|
|
27
|
+
description: "The full width size",
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
control: { type: "boolean" },
|
|
31
|
+
description: "Disabled state",
|
|
32
|
+
},
|
|
25
33
|
slot: {
|
|
26
34
|
control: { type: "text" },
|
|
27
35
|
description: "The slot text or component",
|
|
28
36
|
}
|
|
29
37
|
},
|
|
30
|
-
args:{
|
|
38
|
+
args: {
|
|
31
39
|
slot: "default text",
|
|
32
40
|
},
|
|
33
41
|
};
|
|
34
42
|
|
|
35
|
-
type
|
|
43
|
+
type TComponentProps = InstanceType<typeof UiButton>["$props"];
|
|
36
44
|
|
|
37
|
-
const Template: Story<
|
|
45
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
38
46
|
// Components used in your story `template` are defined in the `components` object
|
|
39
47
|
components: { UiButton },
|
|
40
48
|
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
@@ -42,7 +50,43 @@ const Template: Story<MyComponentProps> = (args) => ({
|
|
|
42
50
|
return { args };
|
|
43
51
|
},
|
|
44
52
|
// And then the `args` are bound to your component with `v-bind="args"`
|
|
45
|
-
template:
|
|
53
|
+
template: `
|
|
54
|
+
<ui-button :className="args.className"
|
|
55
|
+
:kind="args.kind"
|
|
56
|
+
:size="args.size"
|
|
57
|
+
:fullWidth="args.fullWidth"
|
|
58
|
+
:disabled="args.disabled"
|
|
59
|
+
>
|
|
60
|
+
${args.slot}
|
|
61
|
+
</ui-button>`,
|
|
62
|
+
});
|
|
63
|
+
const TemplateAll: Story<TComponentProps> = () => ({
|
|
64
|
+
components: { UiButton },
|
|
65
|
+
|
|
66
|
+
setup() {
|
|
67
|
+
return { EButtonSizes, EButtonTypes };
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
template: `
|
|
71
|
+
<div :style="{
|
|
72
|
+
display: 'flex',
|
|
73
|
+
flexWrap: 'wrap'
|
|
74
|
+
}"
|
|
75
|
+
>
|
|
76
|
+
<div
|
|
77
|
+
:style="{margin: '10px'}"
|
|
78
|
+
v-for="kind in EButtonTypes"
|
|
79
|
+
:key="kind"
|
|
80
|
+
>
|
|
81
|
+
<ui-button
|
|
82
|
+
:kind="kind"
|
|
83
|
+
:size="EButtonSizes.MEDIUM"
|
|
84
|
+
>
|
|
85
|
+
{{ kind }}
|
|
86
|
+
</ui-button>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
`,
|
|
46
90
|
});
|
|
47
91
|
|
|
48
92
|
export const Primary = Template.bind({});
|
|
@@ -50,7 +94,11 @@ export const Primary = Template.bind({});
|
|
|
50
94
|
|
|
51
95
|
Primary.args = {
|
|
52
96
|
...Primary,
|
|
53
|
-
|
|
97
|
+
className: "medium",
|
|
54
98
|
kind: EButtonTypes.PRIMARY,
|
|
55
|
-
size: EButtonSizes.MEDIUM
|
|
56
|
-
|
|
99
|
+
size: EButtonSizes.MEDIUM,
|
|
100
|
+
fullWidth: false,
|
|
101
|
+
disabled: false,
|
|
102
|
+
};
|
|
103
|
+
export const Buttons = TemplateAll.bind({});
|
|
104
|
+
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils"
|
|
1
|
+
import { mount, } from "@vue/test-utils";
|
|
2
2
|
import UiButton from "./ui-button.vue";
|
|
3
3
|
|
|
4
4
|
describe("VButton.test.ts", () => {
|
|
5
5
|
it("renders props.msg when passed", () => {
|
|
6
|
-
const
|
|
6
|
+
const className = "message";
|
|
7
7
|
const wrapper = mount(UiButton, {
|
|
8
|
-
props: {
|
|
8
|
+
props: { className },
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
expect(wrapper.classes()).toContain(
|
|
12
|
-
})
|
|
13
|
-
});
|
|
11
|
+
expect(wrapper.classes()).toContain(className);
|
|
12
|
+
},);
|
|
13
|
+
},);
|