bonkers-ui 1.0.0 → 1.0.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.
Files changed (71) 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/README.md +1 -1
  6. package/package.json +83 -75
  7. package/postcss.config.js +1 -1
  8. package/src/_colors.json +66 -5
  9. package/src/_font-sizes.json +10 -1
  10. package/src/_samples/check-icon.vue +22 -0
  11. package/src/_samples/icon.vue +19 -0
  12. package/src/_shadow.json +4 -0
  13. package/src/_spacing.json +9 -0
  14. package/src/_styles/colors.css +70 -0
  15. package/src/_styles/font-sizes.css +15 -0
  16. package/src/_styles/shadow.css +7 -0
  17. package/src/_styles/spacing.css +12 -0
  18. package/src/_types/align.ts +8 -0
  19. package/src/_types/colors.ts +58 -0
  20. package/src/_types/sizing.ts +9 -0
  21. package/src/components/ui-button/_typings.ts +5 -0
  22. package/src/components/ui-button/index.ts +2 -3
  23. package/src/components/ui-button/ui-button.stories.ts +58 -10
  24. package/src/components/ui-button/ui-button.test.ts +6 -6
  25. package/src/components/ui-button/ui-button.vue +29 -12
  26. package/src/components/ui-card-cta/index.ts +1 -0
  27. package/src/components/ui-card-cta/ui-card-cta.stories.ts +62 -0
  28. package/src/components/ui-card-cta/ui-card-cta.vue +84 -0
  29. package/src/components/ui-card-simple/index.ts +1 -0
  30. package/src/components/ui-card-simple/ui-card-simple.stories.ts +41 -0
  31. package/src/components/ui-card-simple/ui-card-simple.vue +35 -0
  32. package/src/components/ui-checkbox/intext.ts +1 -0
  33. package/src/components/ui-checkbox/ui-checkbox.stories.ts +62 -0
  34. package/src/components/ui-checkbox/ui-checkbox.vue +152 -0
  35. package/src/components/ui-icon/_typings.ts +3 -0
  36. package/src/components/ui-icon/index.ts +2 -0
  37. package/src/components/ui-icon/ui-icon.stories.ts +46 -0
  38. package/src/components/ui-icon/ui-icon.vue +29 -0
  39. package/src/components/ui-input/_typings.ts +6 -0
  40. package/src/components/ui-input/index.ts +1 -0
  41. package/src/components/ui-input/ui-input.stories.ts +90 -0
  42. package/src/components/ui-input/ui-input.vue +45 -0
  43. package/src/components/ui-radio/index.ts +1 -0
  44. package/src/components/ui-radio/ui-radio.stories.ts +62 -0
  45. package/src/components/ui-radio/ui-radio.vue +71 -0
  46. package/src/components/ui-radio-list-fancy/index.ts +1 -0
  47. package/src/components/ui-radio-list-fancy/ui-radio-item/index.ts +1 -0
  48. package/src/components/ui-radio-list-fancy/ui-radio-item/ui-radio-item.vue +66 -0
  49. package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.stories.ts +38 -0
  50. package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.vue +60 -0
  51. package/src/components/ui-ripple/index.ts +1 -0
  52. package/src/components/ui-ripple/ui-ripple.stories.ts +59 -0
  53. package/src/components/ui-ripple/ui-ripple.vue +88 -0
  54. package/src/components/ui-typography/_typings.ts +56 -0
  55. package/src/components/ui-typography/index.ts +2 -0
  56. package/src/components/ui-typography/ui-typography.stories.ts +80 -0
  57. package/src/components/ui-typography/ui-typography.vue +117 -0
  58. package/src/components/ui-verification-input/index.ts +1 -0
  59. package/src/components/ui-verification-input/ui-verification-input.stories.ts +46 -0
  60. package/src/components/ui-verification-input/ui-verification-input.vue +128 -0
  61. package/src/main.css +7 -12
  62. package/src/stories/assets/code-brackets.svg +1 -1
  63. package/src/stories/colors/colors.stories.ts +1 -1
  64. package/src/stories/colors/ui-colors.vue +78 -24
  65. package/src/stories/helper.ts +5 -0
  66. package/src/stories/spacings/spacings.stories.ts +13 -0
  67. package/src/stories/spacings/ui-spacings.vue +50 -0
  68. package/tailwind.config.js +5 -1
  69. package/tsconfig.json +2 -6
  70. package/vite.config.ts +4 -7
  71. package/src/assets/logo.png +0 -0
@@ -0,0 +1,80 @@
1
+ import { ETypographySizes, ETextWeight, ETextAlign, ETextTransform } from "./_typings";
2
+ import UiTypography from "./ui-typography.vue";
3
+ import { Story } from "@storybook/vue3";
4
+ import { EColors } from "../../_types/colors";
5
+
6
+ export default {
7
+ title: "Components/ui-typography",
8
+ component: UiTypography,
9
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
10
+ argTypes: {
11
+ className: {
12
+ control: { type: "text" },
13
+ description: "The Element classes",
14
+ },
15
+ is: {
16
+ control: { type: "text" },
17
+ description: "The Element component or tag",
18
+ },
19
+ kind: {
20
+ control: { type: "select" },
21
+ options: Object.values(EColors),
22
+ description: "The Element kinds",
23
+ },
24
+ weight: {
25
+ control: { type: "select" },
26
+ options: Object.values(ETextWeight),
27
+ description: "The Element weights",
28
+ },
29
+ align: {
30
+ control: { type: "select" },
31
+ options: Object.values(ETextAlign),
32
+ description: "The Element align",
33
+ },
34
+ textTransform: {
35
+ control: { type: "select" },
36
+ options: Object.values(ETextTransform),
37
+ description: "The Element transform",
38
+ },
39
+ lineHeight: {
40
+ control: { type: "boolean" },
41
+ description: "The Element line height 1.6",
42
+ },
43
+ size: {
44
+ control: { type: "select" },
45
+ options: Object.values(ETypographySizes),
46
+ description: "The Element sizes",
47
+ },
48
+ },
49
+ args: {
50
+ slot: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
51
+ },
52
+ };
53
+
54
+ type TComponentProps = InstanceType<typeof UiTypography>["$props"];
55
+
56
+ const Template: Story<TComponentProps> = (args) => ({
57
+ // Components used in your story `template` are defined in the `components` object
58
+ components: { UiTypography },
59
+ // The story's `args` need to be mapped into the template through the `setup()` method
60
+ setup() {
61
+ return { args };
62
+ },
63
+ // And then the `args` are bound to your component with `v-bind="args"`
64
+ template: `
65
+ <ui-typography v-bind="args">
66
+ ${args.slot}
67
+ </ui-typography>
68
+ `,
69
+ });
70
+
71
+ export const Default = Template.bind({});
72
+
73
+ Default.args = {
74
+ size: ETypographySizes.M,
75
+ weight: ETextWeight.REGULAR,
76
+ align: ETextAlign.LEFT,
77
+ lineHeight: true,
78
+ kind: EColors.PRIMARY,
79
+ is: "p",
80
+ };
@@ -0,0 +1,117 @@
1
+ <template>
2
+ <component
3
+ :is="is || 'p'"
4
+ class="ui-typography"
5
+ :class="[
6
+ 'leading-none',
7
+ (!size || size === ETypographySizes.M) && 'text-m',
8
+ size === ETypographySizes.XXS && 'text-xxs',
9
+ size === ETypographySizes.XS && 'text-xs',
10
+ size === ETypographySizes.SM && 'text-sm',
11
+ size === ETypographySizes.LG && 'text-lg',
12
+ size === ETypographySizes.XL && 'text-xl',
13
+ size === ETypographySizes.XXL && 'text-2xl',
14
+ size === ETypographySizes.XXXL && 'text-3xl',
15
+ size === ETypographySizes.XXXXL && 'text-4xl',
16
+ size === ETypographySizes.XXXXXL && 'text-5xl',
17
+
18
+ kind === EColors.WHITE && 'text-white',
19
+ kind === EColors.BLACK && 'text-black',
20
+ kind === EColors.TRANSPARENT && 'text-transparent',
21
+ kind === EColors.CURRENT && 'text-current',
22
+
23
+ kind === EColors.PRIMARY && 'text-primary',
24
+ kind === EColors.PRIMARY_300 && 'text-primary-300',
25
+ kind === EColors.PRIMARY_400 && 'text-primary-400',
26
+ kind === EColors.PRIMARY_500 && 'text-primary-500',
27
+ kind === EColors.PRIMARY_600 && 'text-primary-600',
28
+ kind === EColors.PRIMARY_700 && 'text-primary-700',
29
+
30
+ kind === EColors.PRIMARY_ALT && 'text-primary',
31
+ kind === EColors.PRIMARY_ALT_300 && 'text-primary-300',
32
+ kind === EColors.PRIMARY_ALT_400 && 'text-primary-400',
33
+ kind === EColors.PRIMARY_ALT_500 && 'text-primary-500',
34
+ kind === EColors.PRIMARY_ALT_600 && 'text-primary-600',
35
+ kind === EColors.PRIMARY_ALT_700 && 'text-primary-700',
36
+
37
+ kind === EColors.SECONDARY && 'text-secondary',
38
+ kind === EColors.SECONDARY_300 && 'text-secondary-300',
39
+ kind === EColors.SECONDARY_400 && 'text-secondary-400',
40
+ kind === EColors.SECONDARY_500 && 'text-secondary-500',
41
+ kind === EColors.SECONDARY_600 && 'text-secondary-600',
42
+ kind === EColors.SECONDARY_700 && 'text-secondary-700',
43
+
44
+ kind === EColors.WARNING && 'text-warning',
45
+ kind === EColors.WARNING_300 && 'text-warning-300',
46
+ kind === EColors.WARNING_400 && 'text-warning-400',
47
+ kind === EColors.WARNING_500 && 'text-warning-500',
48
+ kind === EColors.WARNING_600 && 'text-warning-600',
49
+ kind === EColors.WARNING_700 && 'text-warning-700',
50
+
51
+ kind === EColors.ERROR && 'text-error',
52
+ kind === EColors.ERROR_300 && 'text-error-300',
53
+ kind === EColors.ERROR_400 && 'text-error-400',
54
+ kind === EColors.ERROR_500 && 'text-error-500',
55
+ kind === EColors.ERROR_600 && 'text-error-600',
56
+ kind === EColors.ERROR_700 && 'text-error-700',
57
+
58
+ kind === EColors.ACCENT && 'text-accent',
59
+ kind === EColors.ACCENT_300 && 'text-accent-300',
60
+ kind === EColors.ACCENT_500 && 'text-accent-500',
61
+ kind === EColors.ACCENT_600 && 'text-accent-600',
62
+ kind === EColors.ACCENT_700 && 'text-accent-700',
63
+
64
+ kind === EColors.ACCENT_ALT && 'text-accent-alt',
65
+ kind === EColors.ACCENT_ALT_500 && 'text-accent-alt-500',
66
+
67
+ kind === EColors.SECONDARY_ALT && 'text-secondary-alt',
68
+ kind === EColors.SECONDARY_ALT_200 && 'text-secondary-alt-200',
69
+ kind === EColors.SECONDARY_ALT_300 && 'text-secondary-alt-300',
70
+ kind === EColors.SECONDARY_ALT_400 && 'text-secondary-alt-400',
71
+ kind === EColors.SECONDARY_ALT_500 && 'text-secondary-alt-500',
72
+ kind === EColors.SECONDARY_ALT_600 && 'text-secondary-alt-600',
73
+ kind === EColors.SECONDARY_ALT_700 && 'text-secondary-alt-700',
74
+
75
+ weight === ETextWeight.LIGHT && 'font-light',
76
+ weight === ETextWeight.REGULAR && 'font-medium',
77
+ weight === ETextWeight.SEMI_BOLD && 'font-bold',
78
+ weight === ETextWeight.BOLD && 'font-black',
79
+
80
+ align === ETextAlign.LEFT && 'text-left',
81
+ align === ETextAlign.CENTER && 'text-center',
82
+ align === ETextAlign.RIGHT && 'text-right',
83
+
84
+ textTransform === ETextTransform.LOWERCASE && 'lowercase',
85
+ textTransform === ETextTransform.UPPERCASE && 'uppercase',
86
+
87
+ lineHeight && 'ui-typography_line-height',
88
+
89
+ className
90
+ ]"
91
+ >
92
+ <slot />
93
+ </component>
94
+ </template>
95
+
96
+ <script lang="ts" setup>
97
+ import type { Component } from "vue";
98
+ import { ETextAlign, ETextTransform, ETextWeight, ETypographySizes } from "./_typings";
99
+ import { EColors } from "../../_types/colors";
100
+
101
+ defineProps<{
102
+ className?: string;
103
+ align?: ETextAlign;
104
+ size?: ETypographySizes;
105
+ kind?: EColors;
106
+ weight?: ETextWeight;
107
+ lineHeight?: boolean;
108
+ textTransform?: ETextTransform;
109
+ is?: string | Component;
110
+ }>();
111
+ </script>
112
+
113
+ <style scoped>
114
+ .ui-typography_line-height {
115
+ line-height: var(--base-line-height);
116
+ }
117
+ </style>
@@ -0,0 +1 @@
1
+ export { default } from "./ui-verification-input.vue";
@@ -0,0 +1,46 @@
1
+ import UiVerificationInput from "./ui-verification-input.vue";
2
+ import { Story } from "@storybook/vue3";
3
+
4
+ export default {
5
+ title: "Components/ui-verification-input",
6
+ component: UiVerificationInput,
7
+ // More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
8
+ argTypes: {
9
+ className: {
10
+ control: { type: "text" },
11
+ description: "Inputs custom classes",
12
+ },
13
+ inputsCount: {
14
+ control: { type: "number" },
15
+ description: "Number of inputs",
16
+ },
17
+ type: {
18
+ control: { type: "select" },
19
+ options: ["text"],
20
+ description: "Inputs type",
21
+ },
22
+ },
23
+ args:{
24
+ inputsCount: 4,
25
+ type: "text"
26
+ }
27
+ };
28
+
29
+ type MyComponentProps = InstanceType<typeof UiVerificationInput>["$props"];
30
+
31
+ const Template: Story<MyComponentProps> = (args: MyComponentProps) => ({
32
+ components:{
33
+ UiVerificationInput
34
+ },
35
+ setup() {
36
+ const filedHandler = (payload: string)=>{
37
+ console.log("=--->",payload);
38
+ };
39
+ return { args, filedHandler };
40
+ },
41
+ template: `
42
+ <ui-verification-input @onFiled="filedHandler" :className="args.className" :inputsCount="args.inputsCount" :type="args.type"/>
43
+ `
44
+ });
45
+
46
+ export const Default = Template.bind({});
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div
3
+ class="inputs grid"
4
+ :class="className"
5
+ >
6
+ <div
7
+ v-for="(_, index) in inputsCount"
8
+ :key="index"
9
+ class="input-wrapper"
10
+ >
11
+ <input
12
+ ref="inputsRefs"
13
+ :type="type || 'text'"
14
+ maxlength="1"
15
+ placeholder="&#8226;"
16
+ @input="(e)=>inputHandler(e, index)"
17
+ @focus="focusHandler"
18
+ @paste="handlePaste"
19
+ >
20
+ <div class="bottom-wrapper" />
21
+ </div>
22
+ </div>
23
+ <slot name="button" />
24
+ </template>
25
+
26
+ <script lang="ts" setup>
27
+ import { ref } from "vue";
28
+
29
+ type TProps = {
30
+ className?: string;
31
+ inputsCount: number;
32
+ type?: "text";
33
+ }
34
+
35
+ const props = defineProps<TProps>();
36
+ const emit = defineEmits(["onFiled"]);
37
+
38
+ const inputsRefs = ref<Array<HTMLInputElement | null>>([]);
39
+
40
+ const doSubmit = ()=>{
41
+ const generateString = inputsRefs.value.map(input => input?.value).join("");
42
+ emit("onFiled", generateString);
43
+ };
44
+
45
+ const inputHandler = (event:InputEvent, index:number)=>{
46
+ if(index < props.inputsCount){
47
+ inputsRefs.value[index + 1]?.focus();
48
+ }
49
+
50
+ if(index === props.inputsCount - 1){
51
+ doSubmit();
52
+ }
53
+ };
54
+
55
+ const focusHandler = (e:InputEvent) => {
56
+ if(e.target){
57
+ (e.target as HTMLInputElement).select();
58
+ }
59
+ };
60
+
61
+ const handlePaste = (e:ClipboardEvent) => {
62
+ e.preventDefault();
63
+ const pasteText = e.clipboardData?.getData("text");
64
+ if(pasteText && pasteText.length === props.inputsCount) {
65
+ inputsRefs.value[props.inputsCount - 1]?.focus();
66
+
67
+ inputsRefs.value.forEach((input, index)=>{
68
+ if(input){
69
+ input.value = pasteText[index];
70
+ }
71
+ });
72
+ doSubmit();
73
+ }
74
+
75
+ };
76
+
77
+ </script>
78
+
79
+ <style scoped>
80
+ .inputs {
81
+ grid-template-columns: repeat(auto-fill, 38px);
82
+ grid-gap: 24px;
83
+ }
84
+
85
+ .inputs .input-wrapper {
86
+ position: relative;
87
+ height: 58px;
88
+ }
89
+
90
+ .inputs input {
91
+ width: 100%;
92
+ border: none;
93
+ text-align: center;
94
+ font-size: 36px;
95
+ font-weight: bold;
96
+ outline: none;
97
+
98
+ /* caret-color: var(--color-transparent); */
99
+ }
100
+
101
+ .inputs .input-wrapper .bottom-wrapper {
102
+ position: absolute;
103
+ bottom: 0;
104
+ width: 100%;
105
+ height: 5px;
106
+ background-color: var(--color-secondary-300);
107
+ border-radius: 3px;
108
+ transition: background-color 0.3s ease-in-out;
109
+ }
110
+
111
+ .inputs input:focus ~ .bottom-wrapper {
112
+ background-color: var(--color-primary);
113
+ }
114
+
115
+ .inputs input::placeholder {
116
+ font-size: 55px;
117
+ color: var(--color-secondary-300);
118
+ opacity: 1;
119
+ transform: scale(1);
120
+ transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
121
+ }
122
+
123
+ .inputs input:focus::placeholder {
124
+ opacity: 0;
125
+ transform: scale(0);
126
+ }
127
+
128
+ </style>
package/src/main.css CHANGED
@@ -1,24 +1,19 @@
1
+ @import "./_styles/colors.css";
2
+ @import "./_styles/spacing.css";
3
+ @import "./_styles/font-sizes.css";
4
+ @import "./_styles/shadow.css";
5
+
1
6
  @tailwind base;
2
7
  @tailwind components;
3
8
  @tailwind utilities;
4
9
 
5
10
  @layer base {
6
11
  :root {
7
- --color-white: white;
8
- --color-black: black;
9
- --color-current: currentcolor;
10
- --color-transparent: transparent;
11
- --color-error: #e05f5f;
12
- --color-primary: #75c46a;
13
- --color-secondary: #313449;
14
- --color-warning: #f09664;
15
-
16
12
  /* text */
17
- --base-font-size: 1rem;
18
13
  --base-line-height: 1.6;
19
14
  }
20
15
  }
21
16
 
22
- body * {
23
- line-height: var(--base-line-height);
17
+ body {
18
+ font-family: museo-sans, sans-serif;
24
19
  }
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/code-brackets</title><g id="illustration/code-brackets" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#87E6E5" d="M11.4139325,12 C11.7605938,12 12,12.5059743 12,13.3779712 L12,17.4951758 L6.43502246,23.3839989 C5.85499251,23.9978337 5.85499251,25.0021663 6.43502246,25.6160011 L12,31.5048242 L12,35.6220288 C12,36.4939606 11.7605228,37 11.4139325,37 C11.2725831,37 11.1134406,36.9158987 10.9453839,36.7379973 L0.435022463,25.6160011 C-0.145007488,25.0021663 -0.145007488,23.9978337 0.435022463,23.3839989 L10.9453839,12.2620027 C11.1134051,12.0841663 11.2725831,12 11.4139325,12 Z M36.5860675,12 C36.7274169,12 36.8865594,12.0841013 37.0546161,12.2620027 L47.5649775,23.3839989 C48.1450075,23.9978337 48.1450075,25.0021663 47.5649775,25.6160011 L37.0546161,36.7379973 C36.8865949,36.9158337 36.7274169,37 36.5860675,37 C36.2394062,37 36,36.4940257 36,35.6220288 L36,31.5048242 L41.5649775,25.6160011 C42.1450075,25.0021663 42.1450075,23.9978337 41.5649775,23.3839989 L36,17.4951758 L36,13.3779712 C36,12.5060394 36.2394772,12 36.5860675,12 Z"/><rect id="Rectangle-7-Copy-5" width="35.57" height="4" x="5.009" y="22.662" fill="#A0DB77" rx="2" transform="translate(22.793959, 24.662305) rotate(-75.000000) translate(-22.793959, -24.662305)"/></g></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/code-brackets</title><g id="illustration/code-brackets" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#87E6E5" d="M11.4139325,12 C11.7605938,12 12,12.5059743 12,13.3779712 L12,17.4951758 L6.43502246,23.3839989 C5.85499251,23.9978337 5.85499251,25.0021663 6.43502246,25.6160011 L12,31.5048242 L12,35.6220288 C12,36.4939606 11.7605228,37 11.4139325,37 C11.2725831,37 11.1134406,36.9158987 10.9453839,36.7379973 L0.435022463,25.6160011 C-0.145007488,25.0021663 -0.145007488,23.9978337 0.435022463,23.3839989 L10.9453839,12.2620027 C11.1134051,12.0841663 11.2725831,12 11.4139325,12 Z M36.5860675,12 C36.7274169,12 36.8865594,12.0841013 37.0546161,12.2620027 L47.5649775,23.3839989 C48.1450075,23.9978337 48.1450075,25.0021663 47.5649775,25.6160011 L37.0546161,36.7379973 C36.8865949,36.9158337 36.7274169,37 36.5860675,37 C36.2394062,37 36,36.4940257 36,35.6220288 L36,31.5048242 L41.5649775,25.6160011 C42.1450075,25.0021663 42.1450075,23.9978337 41.5649775,23.3839989 L36,17.4951758 L36,13.3779712 C36,12.5060394 36.2394772,12 36.5860675,12 Z" /><rect id="Rectangle-7-Copy-5" width="35.57" height="4" x="5.009" y="22.662" fill="#A0DB77" rx="2" transform="translate(22.793959, 24.662305) rotate(-75.000000) translate(-22.793959, -24.662305)" /></g></svg>
@@ -3,7 +3,7 @@ import UiColors from "./ui-colors.vue";
3
3
  export default {
4
4
  title: "Example/Colors",
5
5
  component: UiColors,
6
- }
6
+ };
7
7
 
8
8
  const Template = () => ({
9
9
  components: { UiColors },
@@ -1,42 +1,96 @@
1
1
  <template>
2
- <ul class="colors grid gap-4">
2
+ <h2 class="font-bold">
3
+ Base colors:
4
+ </h2>
5
+ <ul class="colors grid gap-md">
3
6
  <li
4
- v-for="(value, key, index) in colors"
7
+ v-for="(value, key) in colors"
5
8
  :key="key"
6
9
  class="grid"
10
+ :class="typeof value === 'object' && 'grid_inner'"
7
11
  >
8
- <span
9
- ref="colorRefs"
10
- :class="`h-24 rounded-md`"
11
- :style="{
12
- backgroundColor: value
13
- }"
14
- />
15
- {{ key }}
16
- <br>
17
- {{ getBackgroundColor(index) }}
18
- <br>
19
- {{ value }}
12
+ <div v-if="typeof value === 'object'">
13
+ <h2 class="font-bold">
14
+ {{ key }}:
15
+ </h2>
16
+
17
+ <ul
18
+ class="colors grid gap-md"
19
+ >
20
+ <li
21
+ v-for="(value2, key2) in value"
22
+ :key="key2"
23
+ class="grid"
24
+ >
25
+ <span
26
+ class="block h-xxl w-xxl rounded-full relative"
27
+ :style="{
28
+ backgroundColor: value2
29
+ }"
30
+ />
31
+ <b :style="{margin: '15px 0', display: 'block'}">
32
+ {{ key2 }}
33
+ </b>
34
+ <p>
35
+ ({{ getCssVariableValue(value2) }})
36
+ </p>
37
+ <p>
38
+ {{ value2 }};
39
+ </p>
40
+ </li>
41
+ </ul>
42
+ </div>
43
+ <div v-else>
44
+ <span
45
+ class="block h-xxl w-xxl rounded-full relative"
46
+ :style="{
47
+ backgroundColor: value
48
+ }"
49
+ />
50
+ <b :style="{margin: '15px 0', display: 'block'}">
51
+ {{ key }}
52
+ </b>
53
+ <p>
54
+ ({{ getCssVariableValue(value) }})
55
+ </p>
56
+ <p>
57
+ {{ value }};
58
+ </p>
59
+ </div>
20
60
  </li>
21
61
  </ul>
22
62
  </template>
23
63
 
24
64
  <script lang="ts" setup>
25
- import { ref } from "vue";
26
65
  import colors from "../../_colors.json";
27
-
28
- const colorRefs = ref<Array<Element | null>>([]);
29
-
30
- const getBackgroundColor = (index: number) => {
31
- const element = colorRefs.value[index];
32
- if (element) {
33
- return window.getComputedStyle(element, null).getPropertyValue("background-color");
34
- }
35
- }
66
+ import { getCssVariableValue } from "../helper";
36
67
  </script>
37
68
 
38
69
  <style scoped>
39
70
  .colors {
40
71
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
41
72
  }
73
+
74
+ .grid_inner {
75
+ grid-column: 1/-1;
76
+ }
77
+
78
+ h2 {
79
+ font-size: 30px;
80
+ margin: 20px 0;
81
+ }
82
+
83
+ .rounded-full::before {
84
+ content: "";
85
+ display: block;
86
+ height: 100%;
87
+ width: 100%;
88
+ position: absolute;
89
+ top: 0;
90
+ left: 0;
91
+ border: 2px dotted rgb(0 0 0 / 41%);
92
+ border-radius: 50%;
93
+ transform: scale(1.05);
94
+ z-index: -1;
95
+ }
42
96
  </style>
@@ -0,0 +1,5 @@
1
+ export const getCssVariableValue = (variable:string) => {
2
+ const cssVariable = variable.match(/\((.*)\)/)?.pop() || "";
3
+
4
+ return getComputedStyle(window.document.body).getPropertyValue(cssVariable);
5
+ };
@@ -0,0 +1,13 @@
1
+ import UiSpacings from "./ui-spacings.vue";
2
+
3
+ export default {
4
+ title: "Example/Spacings",
5
+ component: UiSpacings,
6
+ };
7
+
8
+ const Template = () => ({
9
+ components: { UiSpacings },
10
+ template: `<ui-spacings/>`,
11
+ });
12
+
13
+ export const Spacings = Template();
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <div
3
+ ref="spacingsRef"
4
+ class="flex flex-row flex-wrap gap-md"
5
+ >
6
+ <div
7
+ v-for="spacing in spacingKeys"
8
+ :key="spacing"
9
+ class="block"
10
+ >
11
+ <div class="grid gap-sm">
12
+ <div>
13
+ <b>
14
+ {{
15
+ getCssVariableValue(spacings[spacing])
16
+ }}
17
+ </b>
18
+ <br>
19
+ <br>
20
+ {{ spacing }}
21
+ <br>
22
+ {{ spacings[spacing] }}
23
+ </div>
24
+
25
+ <div
26
+ :style="{
27
+ width: spacings[spacing],
28
+ height: spacings[spacing],
29
+ border: '1px solid #ccc'
30
+ }"
31
+ />
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <script lang="ts" setup>
38
+ import spacings from "../../_spacing.json";
39
+ import { getCssVariableValue } from "../helper";
40
+
41
+ const spacingKeys = Object.keys(spacings);
42
+
43
+ </script>
44
+
45
+ <style scoped>
46
+ .block {
47
+ border: 2px solid #ccc;
48
+ padding: 20px;
49
+ }
50
+ </style>
@@ -1,13 +1,17 @@
1
1
  const colors = require("./src/_colors.json");
2
2
  const fontSize = require("./src/_font-sizes.json");
3
+ const spacing = require("./src/_spacing.json");
4
+ const boxShadow = require("./src/_shadow.json");
3
5
 
4
6
  module.exports = {
5
7
  darkMode: "class",
6
8
  content: ["**/*.{vue, css, js, ts}"],
7
9
  theme: {
8
10
  colors,
11
+ spacing,
9
12
  fontSize,
13
+ boxShadow,
10
14
  extend: {},
11
15
  },
12
16
  plugins: [],
13
- }
17
+ };
package/tsconfig.json CHANGED
@@ -18,11 +18,6 @@
18
18
  "allowSyntheticDefaultImports": true,
19
19
  "sourceMap": true,
20
20
  "baseUrl": ".",
21
- "paths": {
22
- "@/*": [
23
- "src/*"
24
- ]
25
- },
26
21
  "lib": [
27
22
  "esnext",
28
23
  "dom",
@@ -36,7 +31,8 @@
36
31
  "src/**/*.vue"
37
32
  ],
38
33
  "exclude": [
39
- "node_modules"
34
+ "node_modules",
35
+ "**/*.stories.ts"
40
36
  ],
41
37
  "references": [
42
38
  {
package/vite.config.ts CHANGED
@@ -1,15 +1,12 @@
1
- import { defineConfig } from "vite"
2
- import vue from "@vitejs/plugin-vue"
3
- import { resolve } from "path"
1
+ import { defineConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
4
3
 
5
4
  // https://vitejs.dev/config/
6
5
  export default defineConfig({
7
6
  resolve: {
8
- alias: {
9
- "@": resolve(__dirname, "src")
10
- }
7
+ alias: {}
11
8
  },
12
9
  plugins: [vue({
13
10
  reactivityTransform: true
14
11
  })]
15
- })
12
+ });
Binary file