@dcrackel/hematournamentui 1.0.21 → 1.0.22
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/dist/HemaTouranmentUI-lib.es.js +8 -4
- package/dist/HemaTouranmentUI-lib.umd.js +2 -2
- package/package.json +3 -1
- package/src/index.js +1 -1
- package/src/stories/Atoms/Icon/BaseIcon.test.js +91 -0
- package/src/stories/Atoms/Icon/BaseIcon.vue +1 -0
- package/src/stories/Atoms/RadioGroup/BaseRadioGroup.test.js +49 -0
- package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.test.js +80 -0
- package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.vue +2 -2
- package/src/stories/Templates/Forms/AddTournamentPageOne/AddTournamentPageOne.vue +2 -1
- package/package/.eslintrc.js +0 -18
- package/package/.gitattributes +0 -2
- package/package/.prettierignore +0 -1
- package/package/.storybook/main.js +0 -18
- package/package/.storybook/mockRoutes.js +0 -9
- package/package/.storybook/preview-head.html +0 -1
- package/package/.storybook/preview.js +0 -17
- package/package/LICENSE +0 -21
- package/package/README.md +0 -83
- package/package/index.html +0 -12
- package/package/package.json +0 -49
- package/package/postcss.config.js +0 -6
- package/package/prettier.config.js +0 -10
- package/package/src/assets/default-tournament.png +0 -0
- package/package/src/index.js +0 -15
- package/package/src/main.js +0 -2
- package/package/src/mocks/fileMock.js +0 -1
- package/package/src/mocks/tournamentMock.js +0 -34
- package/package/src/stories/Base/Button/BaseButton.stories.js +0 -69
- package/package/src/stories/Base/Button/BaseButton.test.js +0 -146
- package/package/src/stories/Base/Button/BaseButton.vue +0 -126
- package/package/src/stories/Base/Input/BaseInput.stories.js +0 -28
- package/package/src/stories/Base/Input/BaseInput.test.js +0 -46
- package/package/src/stories/Base/Input/BaseInput.vue +0 -45
- package/package/src/stories/Base/Tag/BaseTag.stories.js +0 -29
- package/package/src/stories/Base/Tag/BaseTag.test.js +0 -42
- package/package/src/stories/Base/Tag/BaseTag.vue +0 -57
- package/package/src/stories/Base/Text/BaseText.stories.js +0 -77
- package/package/src/stories/Base/Text/BaseText.test.js +0 -153
- package/package/src/stories/Base/Text/BaseText.vue +0 -163
- package/package/src/stories/Breadcrumb/Admin/Breadcrumb.stories.js +0 -41
- package/package/src/stories/Breadcrumb/Admin/Breadcrumb.vue +0 -31
- package/package/src/stories/Cards/TournamentCard/Detail/TournamentCardDetail.stories.js +0 -33
- package/package/src/stories/Cards/TournamentCard/Detail/TournamentCardDetail.vue +0 -38
- package/package/src/stories/Cards/TournamentCard/Header/TournamentCardHeader.stories.js +0 -48
- package/package/src/stories/Cards/TournamentCard/Header/TournamentCardHeader.vue +0 -40
- package/package/src/stories/Cards/TournamentCard/TournamentCard.stories.js +0 -37
- package/package/src/stories/Cards/TournamentCard/TournamentCard.vue +0 -35
- package/package/src/stories/Configure.mdx +0 -320
- package/package/src/stories/Containers/Grid/GridContainer.stories.js +0 -47
- package/package/src/stories/Containers/Grid/GridContainer.vue +0 -108
- package/package/src/stories/Filters/FilterAndSortBar/FilterAndSortBar.stories.js +0 -36
- package/package/src/stories/Filters/FilterAndSortBar/FilterAndSortBar.vue +0 -48
- package/package/src/stories/Filters/FilterUpcomingPast/FilterUpcomingPast.stories.js +0 -32
- package/package/src/stories/Filters/FilterUpcomingPast/FilterUpcomingPast.vue +0 -46
- package/package/src/stories/Menu/Admin/AdminLeftMenu.stories.js +0 -28
- package/package/src/stories/Menu/Admin/AdminLeftMenu.vue +0 -57
- package/package/src/stories/Menu/DropDown/DropDownMenu.stories.js +0 -34
- package/package/src/stories/Menu/DropDown/DropDownMenu.vue +0 -51
- package/package/tailwind/output.css +0 -1072
- package/package/tailwind/tailwind.css +0 -4
- package/package/tailwind.config.js +0 -25
- package/package/vite.config.js +0 -23
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import BaseButton from './BaseButton.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Base/BaseButton',
|
|
5
|
-
component: BaseButton,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
argTypes: {
|
|
8
|
-
onClick: {},
|
|
9
|
-
size: {
|
|
10
|
-
control: {
|
|
11
|
-
type: 'select'
|
|
12
|
-
},
|
|
13
|
-
options: ['small', 'medium', 'large']
|
|
14
|
-
},
|
|
15
|
-
iconClass: {
|
|
16
|
-
control: {
|
|
17
|
-
type: 'text'
|
|
18
|
-
},
|
|
19
|
-
defaultValue: ''
|
|
20
|
-
},
|
|
21
|
-
type: {
|
|
22
|
-
control: {
|
|
23
|
-
type: 'select'
|
|
24
|
-
},
|
|
25
|
-
options: ['primary', 'secondary', 'tertiary', 'bright', 'admin']
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export const Primary = {
|
|
30
|
-
args: {
|
|
31
|
-
type: 'primary',
|
|
32
|
-
label: 'Button'
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
export const PrimaryButtonWithIcon = {
|
|
36
|
-
args: {
|
|
37
|
-
type: 'primary',
|
|
38
|
-
label: 'Button',
|
|
39
|
-
iconClass: 'fas fa-check'
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
export const Secondary = {
|
|
43
|
-
args: {
|
|
44
|
-
label: 'Button'
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export const HighlightedButton = {
|
|
48
|
-
args: {
|
|
49
|
-
type: 'bright',
|
|
50
|
-
size: 'large',
|
|
51
|
-
label: 'Button'
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
export const SmallTertiary = {
|
|
55
|
-
args: {
|
|
56
|
-
type: 'tertiary',
|
|
57
|
-
size: 'small',
|
|
58
|
-
label: 'Button'
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const AdminMunuButton = {
|
|
63
|
-
args: {
|
|
64
|
-
type: 'admin',
|
|
65
|
-
size: 'small',
|
|
66
|
-
label: 'Admin Button',
|
|
67
|
-
hoverColor: 'highlightPrimary'
|
|
68
|
-
}
|
|
69
|
-
};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import BaseButton from './BaseButton.vue';
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import { describe, expect, test, it } from "vitest";
|
|
4
|
-
|
|
5
|
-
describe('BaseButton.vue', () => {
|
|
6
|
-
|
|
7
|
-
it('renders the correct label', () => {
|
|
8
|
-
const wrapper = mount(BaseButton, {
|
|
9
|
-
props: { label: 'Test Button', size: 'lg' }
|
|
10
|
-
});
|
|
11
|
-
expect(wrapper.text()).toContain('Test Button');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('renders icon when iconClass is provided', () => {
|
|
15
|
-
const iconClass = 'some-icon-class'
|
|
16
|
-
const wrapper = mount(BaseButton, {
|
|
17
|
-
props: { label: 'Test Button', iconClass: iconClass }
|
|
18
|
-
})
|
|
19
|
-
const iconElement = wrapper.find('i')
|
|
20
|
-
expect(iconElement.classes()).toContain(iconClass)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('emits click event when clicked', async () => {
|
|
24
|
-
const wrapper = mount(BaseButton, {
|
|
25
|
-
props: { label: 'Test Button', size: 'sm' }
|
|
26
|
-
})
|
|
27
|
-
await wrapper.trigger('click')
|
|
28
|
-
expect(wrapper.emitted().click).toHaveLength(1)
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('computes correct classes based on type and size', () => {
|
|
32
|
-
const wrapper = mount(BaseButton, {
|
|
33
|
-
props: { label: 'Test Button', type: 'primary', size: 'md' }
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
const baseTextElement = wrapper.find('[data-testid="base-text"]');
|
|
37
|
-
expect(baseTextElement.classes()).toContain('text-md');
|
|
38
|
-
expect(baseTextElement.classes()).toContain('text-primary');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('computes correct classes based on primary and selected', () => {
|
|
42
|
-
const wrapper = mount(BaseButton, {
|
|
43
|
-
props: { label: 'Test Button', type: 'primary', size: 'md', selected: 'true' }
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
47
|
-
expect(baseTextElement.classes()).toContain('bg-dropdownSelect');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('computes correct classes based secondary type', () => {
|
|
51
|
-
const wrapper = mount(BaseButton, {
|
|
52
|
-
props: { label: 'Test Button', type: 'secondary', size: 'xl' }
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
56
|
-
expect(baseTextElement.classes()).toContain('text-xl');
|
|
57
|
-
expect(baseTextElement.classes()).toContain('bg-secondary');
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('computes correct classes based secondary type and selected', () => {
|
|
61
|
-
const wrapper = mount(BaseButton, {
|
|
62
|
-
props: { label: 'Test Button', type: 'secondary', size: 'xl', selected:true }
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
66
|
-
expect(baseTextElement.classes()).toContain('bg-dropdownSelect');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('computes correct classes based tertiary type', () => {
|
|
70
|
-
const wrapper = mount(BaseButton, {
|
|
71
|
-
props: { label: 'Test Button', type: 'tertiary', size: 'lg' }
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
75
|
-
expect(baseTextElement.classes()).toContain('text-lg');
|
|
76
|
-
expect(baseTextElement.classes()).toContain('bg-tertiary');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('computes correct classes based tertiary type and selected', () => {
|
|
80
|
-
const wrapper = mount(BaseButton, {
|
|
81
|
-
props: { label: 'Test Button', type: 'tertiary', size: 'xl', selected:true }
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
85
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('computes correct classes based bright type', () => {
|
|
89
|
-
const wrapper = mount(BaseButton, {
|
|
90
|
-
props: { label: 'Test Button', type: 'bright', size: 'xs' }
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
94
|
-
expect(baseTextElement.classes()).toContain('text-xs');
|
|
95
|
-
expect(baseTextElement.classes()).toContain('bg-bright');
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('computes correct classes based bright type and selected', () => {
|
|
99
|
-
const wrapper = mount(BaseButton, {
|
|
100
|
-
props: { label: 'Test Button', type: 'bright', size: 'xl', selected:true }
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
104
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('computes correct classes based admin', () => {
|
|
108
|
-
const wrapper = mount(BaseButton, {
|
|
109
|
-
props: { label: 'Test Button', type: 'admin', size: 'xs', hoverColor: 'admin'}
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
113
|
-
expect(baseTextElement.classes()).toContain('text-xs');
|
|
114
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('computes correct classes based admin type and selected', () => {
|
|
118
|
-
const wrapper = mount(BaseButton, {
|
|
119
|
-
props: { label: 'Test Button', type: 'admin', size: 'xl', selected:true }
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
123
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('computes correct classes based admin secondary', () => {
|
|
127
|
-
const wrapper = mount(BaseButton, {
|
|
128
|
-
props: { label: 'Test Button', type: 'adminSecondary', size: 'xs', hoverColor: 'adminSecondary' }
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
132
|
-
expect(baseTextElement.classes()).toContain('text-xs');
|
|
133
|
-
expect(baseTextElement.classes()).toContain('bg-tertiary');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('computes correct classes based admin secondary type and selected', () => {
|
|
137
|
-
const wrapper = mount(BaseButton, {
|
|
138
|
-
props: {label: 'Test Button', type: 'adminSecondary', size: 'xl', selected:true}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
const baseTextElement = wrapper.find('[data-testid="base-button"]');
|
|
142
|
-
expect(baseTextElement.classes()).toContain('text-xl');
|
|
143
|
-
expect(baseTextElement.classes()).toContain('bg-primary');
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
})
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<button data-testid="base-button" :class="classes" type="button" @click="onClick">
|
|
3
|
-
<i v-if="iconClass" :class="iconClass" class="mr-2 hover:text-highlightedClass"></i>
|
|
4
|
-
<BaseText data-testid="base-text" :color="textColor" :size="size" :text="label" weight="normal" />
|
|
5
|
-
</button>
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
import { computed, reactive } from 'vue';
|
|
10
|
-
import BaseText from '../Text/BaseText.vue';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
name: 'base-button',
|
|
14
|
-
components: { BaseText },
|
|
15
|
-
props: {
|
|
16
|
-
label: {
|
|
17
|
-
type: String,
|
|
18
|
-
required: true
|
|
19
|
-
},
|
|
20
|
-
iconClass: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: null
|
|
23
|
-
},
|
|
24
|
-
size: {
|
|
25
|
-
type: String,
|
|
26
|
-
validator: function (value) {
|
|
27
|
-
return ['xs', 'sm', 'md', 'lg', 'xl'].indexOf(value) !== -1;
|
|
28
|
-
},
|
|
29
|
-
default: 'sm'
|
|
30
|
-
},
|
|
31
|
-
type: {
|
|
32
|
-
type: String,
|
|
33
|
-
default: 'primary',
|
|
34
|
-
validator: function (value) {
|
|
35
|
-
return ['primary', 'secondary', 'tertiary', 'bright', 'admin', 'adminSecondary'].indexOf(value) !== -1;
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
selected: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
emits: ['click'],
|
|
44
|
-
|
|
45
|
-
setup(props, { emit }) {
|
|
46
|
-
props = reactive(props);
|
|
47
|
-
return {
|
|
48
|
-
textColor: computed(() => {
|
|
49
|
-
switch (props.type) {
|
|
50
|
-
case 'primary':
|
|
51
|
-
return 'primary';
|
|
52
|
-
case 'secondary':
|
|
53
|
-
return 'secondary';
|
|
54
|
-
case 'tertiary':
|
|
55
|
-
return 'tertiary';
|
|
56
|
-
case 'bright':
|
|
57
|
-
return 'bright';
|
|
58
|
-
case 'admin':
|
|
59
|
-
return 'neutral';
|
|
60
|
-
case 'adminSecondary':
|
|
61
|
-
return 'neutral';
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
classes: computed(() => {
|
|
65
|
-
let baseClasses = 'px-2.5 mx-1 inline-flex ';
|
|
66
|
-
|
|
67
|
-
switch (props.type) {
|
|
68
|
-
case 'primary':
|
|
69
|
-
baseClasses +=
|
|
70
|
-
' py-0.5 items-center gap-2.5 rounded-md text-center shadow border border-dropdownSelect justify-center hover:bg-tertiary';
|
|
71
|
-
props.selected ? baseClasses += ' bg-dropdownSelect' : baseClasses += ' bg-neutral';
|
|
72
|
-
break;
|
|
73
|
-
case 'secondary':
|
|
74
|
-
baseClasses +=
|
|
75
|
-
' py-0.5 items-center gap-2.5 rounded-md text-center shadow justify-center hover:bg-primary text-neutral';
|
|
76
|
-
props.selected ? baseClasses += ' bg-dropdownSelect' : baseClasses += ' bg-secondary';
|
|
77
|
-
break;
|
|
78
|
-
case 'tertiary':
|
|
79
|
-
baseClasses +=
|
|
80
|
-
' py-0.5 items-center gap-2.5 rounded-md text-center justify-center hover:bg-primary text-primary';
|
|
81
|
-
props.selected ? baseClasses += ' bg-primary' : baseClasses += ' bg-tertiary';
|
|
82
|
-
break;
|
|
83
|
-
case 'bright':
|
|
84
|
-
baseClasses +=
|
|
85
|
-
' py-0.5 items-center gap-2.5 rounded-md text-center justify-center hover:bg-primary text-neutral';
|
|
86
|
-
props.selected ? baseClasses += ' bg-primary' : baseClasses += ' bg-bright';
|
|
87
|
-
break;
|
|
88
|
-
case 'admin':
|
|
89
|
-
baseClasses +=
|
|
90
|
-
' py-2 items-center rounded-md gap-2.5 text-center hover:bg-primary my-1 text-neutral hover:bg-primaryHighlight';
|
|
91
|
-
props.selected ? baseClasses += ' bg-primary' : baseClasses += ' bg-primary';
|
|
92
|
-
break;
|
|
93
|
-
case 'adminSecondary':
|
|
94
|
-
baseClasses +=
|
|
95
|
-
' py-0.5 items-center gap-2.5 text-center my-1 pb-0.5 border-b border-secondary hover:border-b hover:border-neutral w-11/12 text-neutral';
|
|
96
|
-
props.selected ? baseClasses += ' bg-primary' : baseClasses += ' bg-tertiary';
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
switch (props.size) {
|
|
101
|
-
case 'xs':
|
|
102
|
-
baseClasses += ' text-xs';
|
|
103
|
-
break;
|
|
104
|
-
case 'sm':
|
|
105
|
-
baseClasses += ' text-sm';
|
|
106
|
-
break;
|
|
107
|
-
case 'md':
|
|
108
|
-
baseClasses += ' text-md';
|
|
109
|
-
break;
|
|
110
|
-
case 'lg':
|
|
111
|
-
baseClasses += ' text-lg';
|
|
112
|
-
break;
|
|
113
|
-
case 'xl':
|
|
114
|
-
baseClasses += ' text-xl';
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return baseClasses;
|
|
119
|
-
}),
|
|
120
|
-
onClick() {
|
|
121
|
-
emit('click');
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
</script>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import BaseInput from './BaseInput.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Base/Input',
|
|
5
|
-
component: BaseInput,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
argTypes: {
|
|
8
|
-
placeholder: { control: 'text' },
|
|
9
|
-
value: { control: 'text' }
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const Template = args => ({
|
|
14
|
-
components: { BaseInput },
|
|
15
|
-
props: Object.keys(args),
|
|
16
|
-
methods: {
|
|
17
|
-
onValueUpdate(newValue) {
|
|
18
|
-
console.log('Value updated:', newValue);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
export const Default = {
|
|
24
|
-
args: {
|
|
25
|
-
placeholder: 'Enter text...',
|
|
26
|
-
value: ''
|
|
27
|
-
}
|
|
28
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import BaseInput from './BaseInput.vue';
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import { describe, expect, test, it } from "vitest";
|
|
4
|
-
|
|
5
|
-
describe('BaseInput.vue', () => {
|
|
6
|
-
|
|
7
|
-
it('renders with default props', () => {
|
|
8
|
-
const wrapper = mount(BaseInput);
|
|
9
|
-
const inputElement = wrapper.find('input');
|
|
10
|
-
|
|
11
|
-
expect(inputElement.attributes('placeholder')).toBe('');
|
|
12
|
-
expect(wrapper.vm.internalValue).toBe('');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('initializes with the correct value prop', () => {
|
|
16
|
-
const initialValue = 'Hello, World!';
|
|
17
|
-
const wrapper = mount(BaseInput, {
|
|
18
|
-
props: {
|
|
19
|
-
value: initialValue
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
expect(wrapper.vm.internalValue).toBe(initialValue);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('updates internalValue when value prop changes', async () => {
|
|
27
|
-
const wrapper = mount(BaseInput);
|
|
28
|
-
await wrapper.setProps({ value: 'New Value' });
|
|
29
|
-
|
|
30
|
-
expect(wrapper.vm.internalValue).toBe('New Value');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('emits update:value with a delay upon input', async () => {
|
|
34
|
-
const wrapper = mount(BaseInput);
|
|
35
|
-
const inputElement = wrapper.find('input');
|
|
36
|
-
|
|
37
|
-
await inputElement.setValue('Test Input');
|
|
38
|
-
|
|
39
|
-
// TODO: Handle timer-related functionality with vitest
|
|
40
|
-
await new Promise(resolve => setTimeout(resolve, 350));
|
|
41
|
-
|
|
42
|
-
expect(wrapper.emitted('update:value')).toBeTruthy();
|
|
43
|
-
expect(wrapper.emitted('update:value')[0]).toEqual(['Test Input']);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<input
|
|
3
|
-
class="appearance-none focus:outline-none w-full text-sm"
|
|
4
|
-
:placeholder="placeholder"
|
|
5
|
-
v-model="internalValue"
|
|
6
|
-
@input="onInput"
|
|
7
|
-
/>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script>
|
|
11
|
-
export default {
|
|
12
|
-
name: 'BaseInput',
|
|
13
|
-
props: {
|
|
14
|
-
placeholder: {
|
|
15
|
-
type: String,
|
|
16
|
-
default: ''
|
|
17
|
-
},
|
|
18
|
-
value: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: ''
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
data() {
|
|
24
|
-
return {
|
|
25
|
-
internalValue: this.value,
|
|
26
|
-
timeout: null
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
watch: {
|
|
31
|
-
value(newValue) {
|
|
32
|
-
this.internalValue = newValue;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
methods: {
|
|
36
|
-
onInput() {
|
|
37
|
-
clearTimeout(this.timeout);
|
|
38
|
-
this.timeout = setTimeout(() => {
|
|
39
|
-
console.log('this.internalValue', this.internalValue)
|
|
40
|
-
this.$emit('update:value', this.internalValue);
|
|
41
|
-
}, 300);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
</script>
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import BaseTag from './BaseTag.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Base/BaseTag',
|
|
5
|
-
component: BaseTag,
|
|
6
|
-
tags: ['autodocs'],
|
|
7
|
-
argTypes: {
|
|
8
|
-
label: {
|
|
9
|
-
control: {
|
|
10
|
-
type: 'text',
|
|
11
|
-
defaultValue: 'Default Label'
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
backgroundColor: {
|
|
15
|
-
control: {
|
|
16
|
-
type: 'select'
|
|
17
|
-
},
|
|
18
|
-
options: ['primary', 'secondary', 'tertiary', 'neutral', 'bright'],
|
|
19
|
-
defaultValue: 'primary'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const Basic = {
|
|
25
|
-
args: {
|
|
26
|
-
label: 'default tag',
|
|
27
|
-
backgroundColor: 'primary'
|
|
28
|
-
}
|
|
29
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import BaseTag from './BaseTag.vue';
|
|
2
|
-
import { mount } from "@vue/test-utils";
|
|
3
|
-
import { describe, expect, test, it } from "vitest";
|
|
4
|
-
|
|
5
|
-
describe('base-tag.vue', () => {
|
|
6
|
-
|
|
7
|
-
it('renders with default classes and primary background color', () => {
|
|
8
|
-
const wrapper = mount(BaseTag, {
|
|
9
|
-
props: { label: 'Test Tag' }
|
|
10
|
-
});
|
|
11
|
-
const tagElement = wrapper.find('div');
|
|
12
|
-
|
|
13
|
-
expect(tagElement.classes()).toContain('cursor-pointer');
|
|
14
|
-
expect(tagElement.classes()).toContain('bg-primary');
|
|
15
|
-
expect(tagElement.text()).toBe('Test Tag');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('renders with specified background color classes', () => {
|
|
19
|
-
const backgrounds = ['primary', 'secondary', 'tertiary', 'neutral', 'bright'];
|
|
20
|
-
|
|
21
|
-
backgrounds.forEach(async (bg) => {
|
|
22
|
-
const wrapper = mount(BaseTag, {
|
|
23
|
-
props: { label: 'Test Tag', backgroundColor: bg }
|
|
24
|
-
});
|
|
25
|
-
const tagElement = wrapper.find('div');
|
|
26
|
-
|
|
27
|
-
expect(tagElement.classes()).toContain(`bg-${bg}`);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('renders with primary background color for unknown values', () => {
|
|
32
|
-
const wrapper = mount(BaseTag, {
|
|
33
|
-
props: { label: 'Test Tag', backgroundColor: 'unknown' }
|
|
34
|
-
});
|
|
35
|
-
const tagElement = wrapper.find('div');
|
|
36
|
-
|
|
37
|
-
expect(tagElement.classes()).toContain('bg-primary');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="classes">{{ label }}</div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import { computed, reactive } from 'vue';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
name: 'base-tag',
|
|
10
|
-
|
|
11
|
-
props: {
|
|
12
|
-
label: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
backgroundColor: {
|
|
17
|
-
type: String,
|
|
18
|
-
validator: function (value) {
|
|
19
|
-
return ['primary', 'secondary', 'tertiary', 'neutral', 'bright'].indexOf(value) !== -1;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
setup(props) {
|
|
25
|
-
props = reactive(props);
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
classes: computed(() => {
|
|
29
|
-
let baseClasses = 'cursor-pointer inline-block py-1 px-3 my-2 ml-3 text-xs font-normal rounded-full text-neutral';
|
|
30
|
-
|
|
31
|
-
switch (props.backgroundColor) {
|
|
32
|
-
case 'primary':
|
|
33
|
-
baseClasses += ' bg-primary';
|
|
34
|
-
break;
|
|
35
|
-
case 'secondary':
|
|
36
|
-
baseClasses += ' bg-secondary';
|
|
37
|
-
break;
|
|
38
|
-
case 'tertiary':
|
|
39
|
-
baseClasses += ' bg-tertiary';
|
|
40
|
-
break;
|
|
41
|
-
case 'neutral':
|
|
42
|
-
baseClasses += ' bg-neutral';
|
|
43
|
-
break;
|
|
44
|
-
case 'bright':
|
|
45
|
-
baseClasses += ' bg-bright';
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
baseClasses += ' bg-primary';
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return baseClasses;
|
|
53
|
-
})
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
</script>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import BaseText from './BaseText.vue';
|
|
2
|
-
export default {
|
|
3
|
-
title: 'Base/BaseText',
|
|
4
|
-
component: BaseText,
|
|
5
|
-
tags: ['autodocs'],
|
|
6
|
-
argTypes: {
|
|
7
|
-
text: {
|
|
8
|
-
control: {
|
|
9
|
-
type: 'text',
|
|
10
|
-
defaultValue: 'Default Text'
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
size: {
|
|
14
|
-
control: {
|
|
15
|
-
type: 'select'
|
|
16
|
-
},
|
|
17
|
-
options: ['xs', 'small', 'medium', 'large', 'xl', '2xl', '3xl'],
|
|
18
|
-
defaultValue: 'medium'
|
|
19
|
-
},
|
|
20
|
-
weight: {
|
|
21
|
-
control: {
|
|
22
|
-
type: 'select'
|
|
23
|
-
},
|
|
24
|
-
options: ['light', 'normal', 'medium', 'semi-bold', 'bold', 'extra-bold'],
|
|
25
|
-
defaultValue: 'normal'
|
|
26
|
-
},
|
|
27
|
-
color: {
|
|
28
|
-
control: {
|
|
29
|
-
type: 'select'
|
|
30
|
-
},
|
|
31
|
-
options: ['neutral', 'quaternary', 'tertiary', 'secondary', 'primary', 'bright'],
|
|
32
|
-
defaultValue: 'primary'
|
|
33
|
-
},
|
|
34
|
-
hoverColor: {
|
|
35
|
-
control: {
|
|
36
|
-
type: 'select'
|
|
37
|
-
},
|
|
38
|
-
options: [
|
|
39
|
-
'primary',
|
|
40
|
-
'quaternary',
|
|
41
|
-
'secondary',
|
|
42
|
-
'tertiary',
|
|
43
|
-
'neutral',
|
|
44
|
-
'bright',
|
|
45
|
-
'none'
|
|
46
|
-
],
|
|
47
|
-
defaultValue: 'none'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const Large = {
|
|
53
|
-
args: {
|
|
54
|
-
size: 'large',
|
|
55
|
-
text: 'Large Text'
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const Medium = {
|
|
60
|
-
args: {
|
|
61
|
-
size: 'medium',
|
|
62
|
-
text: 'Medium Text'
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
export const Small = {
|
|
66
|
-
args: {
|
|
67
|
-
size: 'small',
|
|
68
|
-
text: 'Small Text'
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const TextWithHover = {
|
|
73
|
-
args: {
|
|
74
|
-
...Large.args,
|
|
75
|
-
hoverColor: 'bright'
|
|
76
|
-
}
|
|
77
|
-
};
|