plugin-ui-for-kzt 0.0.17 → 0.0.19
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/components/BaseBadge/BaseBadge.vue.d.ts +49 -0
- package/dist/components/BaseBadge/BaseBadgeGroup.vue.d.ts +30 -0
- package/dist/components/BaseButton/BaseButton.vue.d.ts +3 -1
- package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +1 -1
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +3 -1
- package/dist/components/BaseChips/BaseChips.vue.d.ts +1 -1
- package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +3 -1
- package/dist/components/BaseInput/BaseInput.vue.d.ts +3 -3
- package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +4 -4
- package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +3 -3
- package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +3 -3
- package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +3 -3
- package/dist/components/BaseModal/BaseModal.vue.d.ts +4 -0
- package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +3 -1
- package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +3 -1
- package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +4 -2
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +2 -2
- package/dist/components/BaseTag/BaseTag.vue.d.ts +61 -0
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +8 -8
- package/dist/components/BaseToggle/BaseToggle.vue.d.ts +3 -1
- package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
- package/dist/components/BaseUpload/BaseUpload.vue.d.ts +31 -0
- package/dist/components/{Modal/Modal.vue.d.ts → BaseUpload/ImageModal.vue.d.ts} +2 -10
- package/dist/components/Toaster/Toaster.vue.d.ts +1 -1
- package/dist/composables/kit/state.d.ts +1 -0
- package/dist/composables/useModal.d.ts +7 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +1 -1
- package/dist/plugins/modalPlugin.d.ts +0 -13
- package/dist/sprite.svg +1 -1
- package/dist/store/modal.d.ts +154 -9
- package/example/App.vue +118 -309
- package/example/MyCustomModal.vue +37 -0
- package/package.json +1 -1
- package/src/assets/icons/add.svg +4 -0
- package/src/assets/icons/arrow-up.svg +4 -0
- package/src/assets/icons/close-circle.svg +5 -0
- package/src/assets/icons/close.svg +4 -0
- package/src/assets/icons/document-text.svg +4 -0
- package/src/assets/icons/export.svg +5 -0
- package/src/assets/icons/gallery.svg +5 -0
- package/src/assets/icons/notification-icon.svg +7 -0
- package/src/assets/icons/search-zoom-in.svg +6 -0
- package/src/assets/icons/trash.svg +7 -0
- package/src/assets/icons/upload.svg +5 -0
- package/src/components/BaseBadge/BaseBadge.vue +188 -0
- package/src/components/BaseBadge/BaseBadgeGroup.vue +120 -0
- package/src/components/BaseBadge/README.md +127 -0
- package/src/components/BaseBreadCrumbs/BaseBreadCrumbs.vue +2 -1
- package/src/components/BaseButton/BaseButton.vue +0 -112
- package/src/components/BaseInput/BaseInput.vue +24 -6
- package/src/components/BaseInputCurrency/BaseInputCurrency.vue +94 -53
- package/src/components/BaseInputPhone/BaseInputPhone.vue +41 -0
- package/src/components/BaseModal/BaseModal.vue +189 -0
- package/src/components/BaseSiteInput/BaseSiteInput.vue +43 -1
- package/src/components/BaseTag/BaseTag.vue +245 -0
- package/src/components/BaseTag/README.md +125 -0
- package/src/components/BaseTextarea/BaseTextarea.vue +7 -14
- package/src/components/BaseUpload/BaseUpload.vue +392 -0
- package/src/components/BaseUpload/ImageModal.vue +25 -0
- package/src/composables/kit/state.ts +1 -0
- package/src/composables/useModal.ts +14 -0
- package/src/index.ts +32 -19
- package/src/plugins/modalPlugin.ts +92 -76
- package/src/store/modal.ts +39 -16
- package/src/styles/root.scss +1 -0
- package/src/types/badge.d.ts +19 -0
- package/src/types/modal.d.ts +8 -0
- package/src/types/tag.d.ts +14 -0
- package/src/types/uploadedFile.d.ts +13 -0
- package/src/types/utils.d.ts +2 -1
- package/webpack.config.js +1 -1
- package/dist/types/index.d.ts +0 -5
- package/src/components/Modal/Modal.vue +0 -149
- package/src/components/Modal/README.md +0 -47
- package/src/types/index.ts +0 -7
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<div
|
|
4
|
+
v-for="modal in modals"
|
|
5
|
+
:key="modal.id"
|
|
6
|
+
v-show="modal.isOpen"
|
|
7
|
+
class="base-modal__overlay"
|
|
8
|
+
@click.self="handleOverlayClick(modal.id)"
|
|
9
|
+
>
|
|
10
|
+
<div class="base-modal" @click.stop>
|
|
11
|
+
<div class="base-modal__wrapper">
|
|
12
|
+
<base-icon
|
|
13
|
+
v-if="modal.props?.closable"
|
|
14
|
+
name="close-circle"
|
|
15
|
+
class="base-modal__close"
|
|
16
|
+
size="custom"
|
|
17
|
+
@click="handleClose(modal.id)"
|
|
18
|
+
/>
|
|
19
|
+
<div class="base-modal__content">
|
|
20
|
+
<component :is="modal.component" v-if="modal.component" :modal-props="modal.props" />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</Teleport>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { computed } from 'vue';
|
|
30
|
+
import { useModalStore } from '../../store/modal';
|
|
31
|
+
import BaseIcon from '../BaseIcon/BaseIcon.vue';
|
|
32
|
+
|
|
33
|
+
const modalStore = useModalStore();
|
|
34
|
+
|
|
35
|
+
const modals = computed(() => modalStore.modals);
|
|
36
|
+
|
|
37
|
+
const handleClose = (id: string) => {
|
|
38
|
+
modalStore.closeModal(id);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const handleOverlayClick = (id: string) => {
|
|
42
|
+
const topModal = modals.value[modals.value.length - 1];
|
|
43
|
+
if (topModal?.id === id && topModal.props?.closable) {
|
|
44
|
+
handleClose(id);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<style lang="scss" scoped>
|
|
50
|
+
@import '../../styles/variables';
|
|
51
|
+
@import '../../styles/root';
|
|
52
|
+
|
|
53
|
+
.base-modal__overlay {
|
|
54
|
+
position: fixed;
|
|
55
|
+
top: 0;
|
|
56
|
+
left: 0;
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: 100%;
|
|
59
|
+
background: rgba(0, 0, 0, 0.5);
|
|
60
|
+
display: flex;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
align-items: center;
|
|
63
|
+
z-index: 1000;
|
|
64
|
+
animation: fadeIn 0.3s ease;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.base-modal {
|
|
68
|
+
background: var(--primary-black-white);
|
|
69
|
+
border-radius: var(--corner-radius-m);
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
min-width: 335px;
|
|
72
|
+
transform: scale(0.7);
|
|
73
|
+
animation: slideIn 0.3s ease forwards;
|
|
74
|
+
margin: 0 20px;
|
|
75
|
+
max-height: 90vh;
|
|
76
|
+
|
|
77
|
+
@media #{$tablet} {
|
|
78
|
+
min-width: 588px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&__wrapper {
|
|
82
|
+
position: relative;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
align-items: center;
|
|
87
|
+
max-width: 100%;
|
|
88
|
+
min-height: 224px;
|
|
89
|
+
height: 100%;
|
|
90
|
+
padding: 24px;
|
|
91
|
+
|
|
92
|
+
@media #{$mobile-landscape} {
|
|
93
|
+
padding: 56px 68px;
|
|
94
|
+
min-height: 332px;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&__header {
|
|
99
|
+
display: flex;
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
align-items: center;
|
|
102
|
+
text-align: center;
|
|
103
|
+
color: var(--primary-text-primary);
|
|
104
|
+
font: var(--typography-l-medium);
|
|
105
|
+
|
|
106
|
+
@media #{$mobile-landscape} {
|
|
107
|
+
font: var(--typography-h4-medium);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&__close {
|
|
112
|
+
position: absolute;
|
|
113
|
+
top: 24px;
|
|
114
|
+
right: 24px;
|
|
115
|
+
width: 32px;
|
|
116
|
+
height: 32px;
|
|
117
|
+
border: none;
|
|
118
|
+
background: none;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
color: var(--primary-gray-600);
|
|
121
|
+
|
|
122
|
+
&:hover {
|
|
123
|
+
color: var(--primary-black-900);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media #{$mobile-landscape} {
|
|
127
|
+
width: 48px;
|
|
128
|
+
height: 48px;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&__content {
|
|
133
|
+
max-height: 70vh;
|
|
134
|
+
overflow-y: auto;
|
|
135
|
+
color: var(--primary-text-tertiary);
|
|
136
|
+
font: var(--typography-text-s-regular);
|
|
137
|
+
|
|
138
|
+
@media #{$mobile-landscape} {
|
|
139
|
+
font: var(--typography-text-l-regular);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&__footer {
|
|
144
|
+
display: flex;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
align-items: flex-end;
|
|
147
|
+
flex-grow: 1;
|
|
148
|
+
gap: 24px;
|
|
149
|
+
width: 100%;
|
|
150
|
+
margin-top: 24px;
|
|
151
|
+
|
|
152
|
+
:deep(.base-button) {
|
|
153
|
+
width: 100%;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Анимации
|
|
159
|
+
@keyframes fadeIn {
|
|
160
|
+
from {
|
|
161
|
+
opacity: 0;
|
|
162
|
+
}
|
|
163
|
+
to {
|
|
164
|
+
opacity: 1;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@keyframes slideIn {
|
|
169
|
+
from {
|
|
170
|
+
transform: scale(0.7);
|
|
171
|
+
opacity: 0;
|
|
172
|
+
}
|
|
173
|
+
to {
|
|
174
|
+
transform: scale(1);
|
|
175
|
+
opacity: 1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@keyframes slideOut {
|
|
180
|
+
to {
|
|
181
|
+
transform: scale(0.7);
|
|
182
|
+
opacity: 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.base-modal-leave-active {
|
|
187
|
+
animation: slideOut 0.3s ease reverse;
|
|
188
|
+
}
|
|
189
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="classList">
|
|
3
3
|
<div class="base-site-input__wrapper">
|
|
4
|
-
<div class="base-site-input__url-wrapper">
|
|
4
|
+
<div :class="{ '--is-error' : urlError }" class="base-site-input__url-wrapper">
|
|
5
5
|
<span class="base-site-input__url">
|
|
6
6
|
https://
|
|
7
7
|
</span>
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
import { computed, ref, watch } from 'vue';
|
|
23
23
|
import BaseInput from '../BaseInput/BaseInput.vue';
|
|
24
24
|
import { useKitSize } from '../../composables/kit/size'
|
|
25
|
+
import { useKitState } from '../../composables/kit/state';
|
|
25
26
|
import type { ICorePropsBaseSiteInput } from '../../types/input'
|
|
26
27
|
|
|
27
28
|
const props = withDefaults(defineProps<ICorePropsBaseSiteInput>(),{
|
|
@@ -36,10 +37,15 @@ const emit = defineEmits<{
|
|
|
36
37
|
|
|
37
38
|
const urlError = ref('');
|
|
38
39
|
const { sizeClassList } = useKitSize(props);
|
|
40
|
+
const { stateClassList } = useKitState(props);
|
|
39
41
|
|
|
40
42
|
const classList = computed(() => [
|
|
41
43
|
sizeClassList.value,
|
|
44
|
+
stateClassList.value,
|
|
42
45
|
'base-site-input',
|
|
46
|
+
{
|
|
47
|
+
'--is-has-hint': !!props.hint,
|
|
48
|
+
}
|
|
43
49
|
]);
|
|
44
50
|
|
|
45
51
|
const normalizedValue = computed(() => {
|
|
@@ -108,12 +114,24 @@ watch(modelValue, (value) => {
|
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
&.--small-size {
|
|
117
|
+
&.--is-has-hint, &.--is-error {
|
|
118
|
+
#{$input} {
|
|
119
|
+
&__url-wrapper {
|
|
120
|
+
margin-bottom: 26px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
#{$input} {
|
|
112
126
|
&__url-wrapper{
|
|
113
127
|
height: 40px;
|
|
114
128
|
font: var(--typography-text-m-regular);
|
|
115
129
|
border-top-left-radius: var(--corner-radius-s);
|
|
116
130
|
border-bottom-left-radius: var(--corner-radius-s);
|
|
131
|
+
|
|
132
|
+
&.--is-error {
|
|
133
|
+
margin-bottom: 26px;
|
|
134
|
+
}
|
|
117
135
|
}
|
|
118
136
|
|
|
119
137
|
&__url {
|
|
@@ -128,12 +146,24 @@ watch(modelValue, (value) => {
|
|
|
128
146
|
}
|
|
129
147
|
|
|
130
148
|
&.--medium-size {
|
|
149
|
+
&.--is-has-hint, &.--is-error {
|
|
150
|
+
#{$input} {
|
|
151
|
+
&__url-wrapper {
|
|
152
|
+
margin-bottom: 26px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
131
157
|
#{$input} {
|
|
132
158
|
&__url-wrapper{
|
|
133
159
|
height: 48px;
|
|
134
160
|
font: var(--typography-text-m-regular);
|
|
135
161
|
border-top-left-radius: var(--corner-radius-m);
|
|
136
162
|
border-bottom-left-radius: var(--corner-radius-m);
|
|
163
|
+
|
|
164
|
+
&.--is-error {
|
|
165
|
+
margin-bottom: 26px;
|
|
166
|
+
}
|
|
137
167
|
}
|
|
138
168
|
|
|
139
169
|
&__url {
|
|
@@ -148,12 +178,24 @@ watch(modelValue, (value) => {
|
|
|
148
178
|
}
|
|
149
179
|
|
|
150
180
|
&.--large-size {
|
|
181
|
+
&.--is-has-hint, &.--is-error {
|
|
182
|
+
#{$input} {
|
|
183
|
+
&__url-wrapper {
|
|
184
|
+
margin-bottom: 30px;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
151
189
|
#{$input} {
|
|
152
190
|
&__url-wrapper{
|
|
153
191
|
height: 56px;
|
|
154
192
|
font: var(--typography-text-l-regular);
|
|
155
193
|
border-top-left-radius: var(--corner-radius-m);
|
|
156
194
|
border-bottom-left-radius: var(--corner-radius-m);
|
|
195
|
+
|
|
196
|
+
&.--is-error {
|
|
197
|
+
margin-bottom: 30px;
|
|
198
|
+
}
|
|
157
199
|
}
|
|
158
200
|
|
|
159
201
|
&__url {
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="base-tag" :class="classList">
|
|
3
|
+
<div class="base-tag__wrapper">
|
|
4
|
+
<div class="base-tag__text">{{ text }}</div>
|
|
5
|
+
<div v-if="closable" class="base-tag__icon" @click="handleClose">
|
|
6
|
+
<base-icon name="close" size="custom" />
|
|
7
|
+
</div>
|
|
8
|
+
<div v-if="addingTag" class="base-tag__icon">
|
|
9
|
+
<base-icon name="add" size="custom" class="base-tag__add-icon" @click="handleAddTag" />
|
|
10
|
+
</div>
|
|
11
|
+
<div v-if="isHasAddTag" class="base-tag__input-wrapper">
|
|
12
|
+
<input
|
|
13
|
+
class="base-tag__input"
|
|
14
|
+
type="text"
|
|
15
|
+
v-model="inputText"
|
|
16
|
+
@input="handleInput"
|
|
17
|
+
@keypress.enter="handleCreateTag"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
import { computed, ref } from 'vue';
|
|
26
|
+
import BaseIcon from '../BaseIcon/BaseIcon.vue';
|
|
27
|
+
import type { ICoreTagProps } from '../../types/tag';
|
|
28
|
+
import { useKitSize } from '../../composables/kit/size';
|
|
29
|
+
import { useKitColor } from '../../composables/kit/color';
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(defineProps<ICoreTagProps>(), {
|
|
32
|
+
size: 'medium',
|
|
33
|
+
color: 'primary',
|
|
34
|
+
closable: false,
|
|
35
|
+
isHasAddTag: false,
|
|
36
|
+
addingTag: false,
|
|
37
|
+
text: '',
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const emit = defineEmits<{
|
|
41
|
+
updateInput: [value: ICoreTagProps['inputText']];
|
|
42
|
+
close: [];
|
|
43
|
+
addTag: [];
|
|
44
|
+
}>();
|
|
45
|
+
|
|
46
|
+
const inputText = ref<string>(props.inputText || '');
|
|
47
|
+
|
|
48
|
+
const { sizeClassList } = useKitSize(props);
|
|
49
|
+
const { colorClassList } = useKitColor(props);
|
|
50
|
+
|
|
51
|
+
const classList = computed(() => [
|
|
52
|
+
sizeClassList.value,
|
|
53
|
+
colorClassList.value,
|
|
54
|
+
{'--adding-tag': props.addingTag},
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
const handleClose = () => {
|
|
58
|
+
emit('close');
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handleInput = (event: Event) => {
|
|
62
|
+
const target = event.target as HTMLInputElement;
|
|
63
|
+
emit('updateInput', target.value);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleCreateTag = () => {
|
|
67
|
+
if (inputText.value.trim()) {
|
|
68
|
+
emit('updateInput', inputText.value.trim());
|
|
69
|
+
inputText.value = '';
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const handleAddTag = () => {
|
|
74
|
+
emit('addTag');
|
|
75
|
+
};
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<style scoped lang="scss">
|
|
79
|
+
@import '@/styles/variables';
|
|
80
|
+
@import '@/styles/root';
|
|
81
|
+
|
|
82
|
+
.base-tag {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
|
|
87
|
+
&__wrapper {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
transition: all var(--transition);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&__text {
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
text-overflow: ellipsis;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&__icon {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
margin-left: var(--spacing-xs);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__input-wrapper {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
|
|
110
|
+
.base-tag__input {
|
|
111
|
+
border: none;
|
|
112
|
+
background: transparent;
|
|
113
|
+
outline: none;
|
|
114
|
+
color: var(--primary-blue);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&.--primary-color {
|
|
119
|
+
.base-tag__wrapper {
|
|
120
|
+
background: var(--primary-black-100);
|
|
121
|
+
color: var(--primary-black-700);
|
|
122
|
+
|
|
123
|
+
@include hover {
|
|
124
|
+
background: var(--primary-black-200);
|
|
125
|
+
color: var(--primary-black-900);
|
|
126
|
+
|
|
127
|
+
.base-tag__icon {
|
|
128
|
+
color: var(--primary-black-900);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.base-tag__icon {
|
|
134
|
+
color: var(--primary-black-500);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&.--secondary-color {
|
|
139
|
+
.base-tag__wrapper {
|
|
140
|
+
background: var(--primary-black-white);
|
|
141
|
+
color: var(--primary-black-700); // same
|
|
142
|
+
|
|
143
|
+
@include hover {
|
|
144
|
+
background: var(--primary-black-200);
|
|
145
|
+
color: var(--primary-black-900);
|
|
146
|
+
|
|
147
|
+
.base-tag__icon {
|
|
148
|
+
color: var(--primary-black-900);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.base-tag__icon {
|
|
154
|
+
color: var(--primary-black-500);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&.--adding-tag {
|
|
159
|
+
.base-tag__wrapper {
|
|
160
|
+
color: var(--primary-black-500);
|
|
161
|
+
|
|
162
|
+
@include hover {
|
|
163
|
+
color: var(--primary-black-900);
|
|
164
|
+
|
|
165
|
+
.base-tag__icon {
|
|
166
|
+
color: var(--primary-black-900);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
&.--extra-small-size {
|
|
174
|
+
.base-tag__text,
|
|
175
|
+
.base-tag__input {
|
|
176
|
+
font: var(--typography-text-xs-medium);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.base-tag__wrapper {
|
|
180
|
+
border-radius: var(--corner-radius-xxs);
|
|
181
|
+
padding: var(--spacing-2xs) var(--spacing-s);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.base-tag__icon,
|
|
185
|
+
.base-tag__add-icon {
|
|
186
|
+
width: 12px;
|
|
187
|
+
height: 12px;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&.--small-size {
|
|
192
|
+
.base-tag__text,
|
|
193
|
+
.base-tag__input {
|
|
194
|
+
font: var(--typography-text-s-medium);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.base-tag__wrapper {
|
|
198
|
+
border-radius: var(--corner-radius-xxs);
|
|
199
|
+
padding: var(--spacing-2xs) var(--spacing-s);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.base-tag__icon,
|
|
203
|
+
.base-tag__add-icon {
|
|
204
|
+
width: 14px;
|
|
205
|
+
height: 14px;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&.--medium-size {
|
|
210
|
+
.base-tag__text,
|
|
211
|
+
.base-tag__input {
|
|
212
|
+
font: var(--typography-text-s-medium);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.base-tag__wrapper {
|
|
216
|
+
border-radius: var(--corner-radius-2xs);
|
|
217
|
+
padding: var(--spacing-xs) var(--spacing-2m);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.base-tag__icon,
|
|
221
|
+
.base-tag__add-icon {
|
|
222
|
+
width: 16px;
|
|
223
|
+
height: 16px;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
&.--large-size {
|
|
228
|
+
.base-tag__text,
|
|
229
|
+
.base-tag__input {
|
|
230
|
+
font: var(--typography-text-m-medium);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.base-tag__wrapper {
|
|
234
|
+
border-radius: var(--corner-radius-2xs);
|
|
235
|
+
padding: var(--spacing-xs) var(--spacing-2m);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.base-tag__icon,
|
|
239
|
+
.base-tag__add-icon {
|
|
240
|
+
width: 16px;
|
|
241
|
+
height: 16px;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
</style>
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Компонент BaseTag
|
|
2
|
+
|
|
3
|
+
Компонент `BaseTag` — это переиспользуемый Vue 3 компонент для отображения тегов с настраиваемым текстом, размером, цветом и поведением. Поддерживает закрываемые теги, теги с функцией добавления и поле ввода для создания новых тегов. Компонент следует методологии БЭМ для именования CSS-классов и стилизован с использованием SCSS.
|
|
4
|
+
|
|
5
|
+
## Возможности
|
|
6
|
+
|
|
7
|
+
- **Настраиваемый размер**: Поддерживает четыре варианта размеров: `extra-small`, `small`, `medium`, `large`.
|
|
8
|
+
- **Варианты цветов**: Предлагает цветовые схемы `primary` и `secondary` с эффектами наведения.
|
|
9
|
+
- **Закрываемые теги**: Опционально включает иконку закрытия для вызова события `close`.
|
|
10
|
+
- **Функция добавления тега**: Поддерживает иконку добавления для создания новых тегов.
|
|
11
|
+
- **Поле ввода**: Отображает поле ввода для создания новых тегов, если включен `isHasAddTag`.
|
|
12
|
+
- **Поддержка TypeScript**: Полностью типизирован с использованием TypeScript.
|
|
13
|
+
- **Стилизация по БЭМ**: Использует методологию БЭМ для консистентности и удобства поддержки CSS.
|
|
14
|
+
- **Композаблы**: Использует `useKitSize` и `useKitColor` для модульного управления размером и цветом.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Использование
|
|
18
|
+
|
|
19
|
+
Компонент `BaseTag` можно использовать в разных конфигурациях в зависимости от желаемой функциональности. Ниже приведены примеры типичных случаев использования.
|
|
20
|
+
|
|
21
|
+
### Простой тег
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<template>
|
|
25
|
+
<base-tag text="Пример тега" />
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Отображает тег с текстом "Пример тега" в размере `medium` и цвете `primary`.
|
|
30
|
+
|
|
31
|
+
### Закрываемый тег
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<template>
|
|
35
|
+
<base-tag text="Закрываемый тег" closable @close="handleClose" />
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
const handleClose = () => {
|
|
40
|
+
console.log('Тег закрыт');
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Тег с иконкой закрытия, которая вызывает событие `close` при клике.
|
|
46
|
+
|
|
47
|
+
### Тег с полем ввода
|
|
48
|
+
|
|
49
|
+
```vue
|
|
50
|
+
<template>
|
|
51
|
+
<base-tag
|
|
52
|
+
:isHasAddTag="true"
|
|
53
|
+
v-model:inputText="tagInput"
|
|
54
|
+
@updateInput="updateInput"
|
|
55
|
+
@addTag="createTag"
|
|
56
|
+
/>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { ref } from 'vue';
|
|
61
|
+
|
|
62
|
+
const tagInput = ref('');
|
|
63
|
+
const updateInput = (value: string) => {
|
|
64
|
+
tagInput.value = value;
|
|
65
|
+
};
|
|
66
|
+
const createTag = () => {
|
|
67
|
+
console.log('Новый тег:', tagInput.value);
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Тег с полем ввода для создания новых тегов. Поле ввода отображается, если `isHasAddTag` равно `true`.
|
|
73
|
+
|
|
74
|
+
### Тег с иконкой добавления
|
|
75
|
+
|
|
76
|
+
```vue
|
|
77
|
+
<template>
|
|
78
|
+
<base-tag text="Добавить тег" addingTag @addTag="handleAddTag" />
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup lang="ts">
|
|
82
|
+
const handleAddTag = () => {
|
|
83
|
+
console.log('Инициировано добавление тега');
|
|
84
|
+
};
|
|
85
|
+
</script>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Тег с иконкой добавления, которая вызывает событие `addTag` при клике.
|
|
89
|
+
|
|
90
|
+
## Пропсы
|
|
91
|
+
|
|
92
|
+
| Проп | Тип | По умолчанию | Описание |
|
|
93
|
+
|--------------|----------|--------------|--------------------------------------------------------------------------|
|
|
94
|
+
| `text` | `string` | `''` | Текст, отображаемый в теге. |
|
|
95
|
+
| `size` | `string` | `'medium'` | Размер тега: `extra-small`, `small`, `medium`, `large`. |
|
|
96
|
+
| `color` | `string` | `'primary'` | Цветовая схема: `primary`, `secondary`. |
|
|
97
|
+
| `closable` | `boolean`| `false` | Включает иконку закрытия для удаления тега. |
|
|
98
|
+
| `isHasAddTag`| `boolean`| `false` | Включает поле ввода для создания нового тега. |
|
|
99
|
+
| `addingTag` | `boolean`| `false` | Включает иконку добавления тега. |
|
|
100
|
+
| `inputText` | `string` | `''` | Начальное значение поля ввода (используется с `v-model:inputText`). |
|
|
101
|
+
|
|
102
|
+
## События
|
|
103
|
+
|
|
104
|
+
| Событие | Параметры | Описание |
|
|
105
|
+
|----------------|----------------------|-------------------------------------------------------|
|
|
106
|
+
| `close` | - | Вызывается при клике на иконку закрытия. |
|
|
107
|
+
| `addTag` | - | Вызывается при клике на иконку добавления тега. |
|
|
108
|
+
| `updateInput` | `value: string` | Вызывается при изменении текста в поле ввода. |
|
|
109
|
+
|
|
110
|
+
## Стилизация
|
|
111
|
+
|
|
112
|
+
Модификаторы:
|
|
113
|
+
- `--primary-color`, `--secondary-color` — для цветовых схем.
|
|
114
|
+
- `--extra-small-size`, `--small-size`, `--medium-size`, `--large-size` — для размеров.
|
|
115
|
+
- `--adding-tag` — для стилизации тега с иконкой добавления.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## Зависимости
|
|
119
|
+
|
|
120
|
+
- **`BaseIcon`**: Компонент для отображения иконок (используется для иконок закрытия и добавления).
|
|
121
|
+
- **`useKitSize`**: Композабл для управления размерами.
|
|
122
|
+
- **`useKitColor`**: Композабл для управления цветами.
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|