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.
Files changed (70) hide show
  1. package/.eslintrc.js +2 -1
  2. package/.husky/pre-commit +1 -0
  3. package/.storybook/preview.js +17 -1
  4. package/.stylelintrc +24 -22
  5. package/package.json +13 -5
  6. package/postcss.config.js +1 -1
  7. package/src/_colors.json +66 -5
  8. package/src/_font-sizes.json +10 -1
  9. package/src/_samples/check-icon.vue +22 -0
  10. package/src/_samples/icon.vue +19 -0
  11. package/src/_shadow.json +4 -0
  12. package/src/_spacing.json +9 -0
  13. package/src/_styles/colors.css +70 -0
  14. package/src/_styles/font-sizes.css +15 -0
  15. package/src/_styles/shadow.css +7 -0
  16. package/src/_styles/spacing.css +12 -0
  17. package/src/_types/align.ts +8 -0
  18. package/src/_types/colors.ts +58 -0
  19. package/src/_types/sizing.ts +9 -0
  20. package/src/components/ui-button/_typings.ts +5 -0
  21. package/src/components/ui-button/index.ts +1 -3
  22. package/src/components/ui-button/ui-button.stories.ts +58 -10
  23. package/src/components/ui-button/ui-button.test.ts +6 -6
  24. package/src/components/ui-button/ui-button.vue +29 -12
  25. package/src/components/ui-card-cta/index.ts +1 -0
  26. package/src/components/ui-card-cta/ui-card-cta.stories.ts +62 -0
  27. package/src/components/ui-card-cta/ui-card-cta.vue +85 -0
  28. package/src/components/ui-card-simple/index.ts +1 -0
  29. package/src/components/ui-card-simple/ui-card-simple.stories.ts +41 -0
  30. package/src/components/ui-card-simple/ui-card-simple.vue +35 -0
  31. package/src/components/ui-checkbox/intext.ts +1 -0
  32. package/src/components/ui-checkbox/ui-checkbox.stories.ts +62 -0
  33. package/src/components/ui-checkbox/ui-checkbox.vue +152 -0
  34. package/src/components/ui-icon/_typings.ts +3 -0
  35. package/src/components/ui-icon/index.ts +2 -0
  36. package/src/components/ui-icon/ui-icon.stories.ts +46 -0
  37. package/src/components/ui-icon/ui-icon.vue +29 -0
  38. package/src/components/ui-input/_typings.ts +6 -0
  39. package/src/components/ui-input/index.ts +1 -0
  40. package/src/components/ui-input/ui-input.stories.ts +90 -0
  41. package/src/components/ui-input/ui-input.vue +45 -0
  42. package/src/components/ui-radio/index.ts +1 -0
  43. package/src/components/ui-radio/ui-radio.stories.ts +62 -0
  44. package/src/components/ui-radio/ui-radio.vue +71 -0
  45. package/src/components/ui-radio-list-fancy/index.ts +1 -0
  46. package/src/components/ui-radio-list-fancy/ui-radio-item/index.ts +1 -0
  47. package/src/components/ui-radio-list-fancy/ui-radio-item/ui-radio-item.vue +66 -0
  48. package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.stories.ts +38 -0
  49. package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.vue +60 -0
  50. package/src/components/ui-ripple/index.ts +1 -0
  51. package/src/components/ui-ripple/ui-ripple.stories.ts +59 -0
  52. package/src/components/ui-ripple/ui-ripple.vue +88 -0
  53. package/src/components/ui-typography/_typings.ts +56 -0
  54. package/src/components/ui-typography/index.ts +2 -0
  55. package/src/components/ui-typography/ui-typography.stories.ts +80 -0
  56. package/src/components/ui-typography/ui-typography.vue +117 -0
  57. package/src/components/ui-verification-input/index.ts +1 -0
  58. package/src/components/ui-verification-input/ui-verification-input.stories.ts +46 -0
  59. package/src/components/ui-verification-input/ui-verification-input.vue +128 -0
  60. package/src/main.css +7 -12
  61. package/src/stories/assets/code-brackets.svg +1 -1
  62. package/src/stories/colors/colors.stories.ts +1 -1
  63. package/src/stories/colors/ui-colors.vue +78 -24
  64. package/src/stories/helper.ts +5 -0
  65. package/src/stories/spacings/spacings.stories.ts +13 -0
  66. package/src/stories/spacings/ui-spacings.vue +50 -0
  67. package/tailwind.config.js +5 -1
  68. package/tsconfig.json +2 -6
  69. package/vite.config.ts +4 -7
  70. package/src/assets/logo.png +0 -0
package/.eslintrc.js CHANGED
@@ -66,5 +66,6 @@ module.exports = {
66
66
  "maxEOF": 0
67
67
  }
68
68
  ],
69
+ semi: ["error", "always"]
69
70
  }
70
- }
71
+ };
package/.husky/pre-commit CHANGED
@@ -2,4 +2,5 @@
2
2
  . "$(dirname -- "$0")/_/husky.sh"
3
3
 
4
4
  yarn lint-staged
5
+ yarn typecheck
5
6
  yarn test
@@ -1,4 +1,20 @@
1
- import '../src/main.css'
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
- "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
- "baseIndentLevel": 1
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.1",
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 --ext .ts,vue,js --ignore-path .gitignore .",
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}": "eslint --fix && typecheck && test",
74
- "*.{css,scss,vue,ts}": "stylelint --fix"
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
@@ -2,4 +2,4 @@ module.exports = {
2
2
  plugins: {
3
3
  tailwindcss: {},
4
4
  }
5
- }
5
+ };
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
 
@@ -1,3 +1,12 @@
1
1
  {
2
- "base": "var(--base-font-size)"
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>
@@ -0,0 +1,4 @@
1
+ {
2
+ "m": "var(--shadow-size-m)",
3
+ "border-primary": "var(--shadow-border-primary)"
4
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "xxs": "var(--xxs)",
3
+ "xs": "var(--xs)",
4
+ "sm": "var(--sm)",
5
+ "md": "var(--md)",
6
+ "lg": "var(--lg)",
7
+ "xl": "var(--xl)",
8
+ "xxl": "var(--xxl)"
9
+ }
@@ -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,7 @@
1
+ @layer base {
2
+ :root {
3
+ /* shadow sizes */
4
+ --shadow-size-m: 0 2px 4px 0 rgb(180 184 205 / 50%);
5
+ --shadow-border-primary: 0 0 0 4px var(--color-primary-300);
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ @layer base {
2
+ :root {
3
+ /* spacing */
4
+ --xxs: 4px;
5
+ --xs: 8px;
6
+ --sm: 16px;
7
+ --md: 24px;
8
+ --lg: 40px;
9
+ --xl: 80px;
10
+ --xxl: 120px;
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ export enum EJustify {
2
+ START = "start",
3
+ END = "end",
4
+ CENTER = "center",
5
+ BETWEEN = "between",
6
+ AROUND = "around",
7
+ EVENLY = "evenly",
8
+ }
@@ -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
+ }
@@ -0,0 +1,9 @@
1
+ export enum ESize {
2
+ XXS = "xxs",
3
+ XS = "xs",
4
+ SM = "sm",
5
+ MD = "md",
6
+ LG = "lg",
7
+ XL = "xl",
8
+ XXL = "xxl",
9
+ }
@@ -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,3 +1 @@
1
- import VButton from "./ui-button.vue";
2
-
3
- export default VButton;
1
+ export { default } from "./ui-button.vue";
@@ -1,13 +1,13 @@
1
- import UiButton from "./ui-button.vue";
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
- classes: {
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 MyComponentProps = InstanceType<typeof UiButton>["$props"];
43
+ type TComponentProps = InstanceType<typeof UiButton>["$props"];
36
44
 
37
- const Template: Story<MyComponentProps> = (args) => ({
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: `<ui-button v-bind="args">${args.slot}</ui-button>`,
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
- classes: "medium",
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 classes = "message";
6
+ const className = "message";
7
7
  const wrapper = mount(UiButton, {
8
- props: { classes }
8
+ props: { className },
9
9
  });
10
10
 
11
- expect(wrapper.classes()).toContain(classes);
12
- })
13
- });
11
+ expect(wrapper.classes()).toContain(className);
12
+ },);
13
+ },);