plugin-ui-for-kzt 0.0.57 → 0.0.59
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 +1 -1
- package/dist/components/BaseButton/BaseButton.vue.d.ts +1 -1
- package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +5 -5
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +2 -2
- package/dist/components/BaseChips/BaseChips.vue.d.ts +2 -0
- package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +1 -1
- package/dist/components/BaseInput/BaseInput.vue.d.ts +12 -3
- package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +13 -6
- package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +11 -4
- package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +9 -2
- package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +9 -2
- package/dist/components/BaseInputWithSelector/BaseInputWithSelector.vue.d.ts +9 -0
- package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +2 -2
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +4 -4
- package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +7 -0
- package/dist/components/BaseTag/BaseTag.vue.d.ts +1 -1
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +9 -2
- package/dist/components/BaseToast/BaseToast.vue.d.ts +1 -1
- package/dist/components/BaseToggle/BaseToggle.vue.d.ts +2 -2
- package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
- package/dist/index.js +1 -1
- package/example/App.vue +39 -2
- package/package.json +1 -1
- package/src/components/BaseChips/BaseChips.vue +233 -139
- package/src/components/BaseChips/README.md +8 -7
- package/src/components/BaseInput/BaseInput.vue +80 -37
- package/src/components/BaseInput/README.md +8 -1
- package/src/components/BaseInputWithSelector/BaseInputWithSelector.vue +3 -0
- package/src/components/BaseSelect/BaseSelect.vue +14 -1
- package/src/components/BaseUpload/BaseUpload.vue +1 -1
- package/src/types/chips.d.ts +1 -0
- package/src/types/input.d.ts +1 -0
|
@@ -5,29 +5,36 @@
|
|
|
5
5
|
<slot name="left-icon"></slot>
|
|
6
6
|
</div>
|
|
7
7
|
<input
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
ref="inputRef"
|
|
9
|
+
:id="id"
|
|
10
|
+
:type="type"
|
|
11
|
+
:value="modelValue"
|
|
12
|
+
v-maska="mask"
|
|
13
|
+
v-bind="componentAttrs"
|
|
14
|
+
:placeholder="placeholder || ''"
|
|
15
|
+
class="base-input__field"
|
|
16
|
+
:class="{ 'base-input__field--focusable': focusable }"
|
|
17
|
+
@input="handleInput"
|
|
17
18
|
/>
|
|
18
|
-
<div v-if="$slots['right-icon']" class="base-input__icon base-input__icon--right">
|
|
19
|
-
<
|
|
19
|
+
<div v-if="$slots['right-icon'] || showClearButton" class="base-input__icon base-input__icon--right">
|
|
20
|
+
<BaseIcon v-if="showClearButton"
|
|
21
|
+
name="close"
|
|
22
|
+
class="base-input__clear-icon"
|
|
23
|
+
@click="clearInput"
|
|
24
|
+
/>
|
|
25
|
+
<slot v-if="$slots['right-icon']" name="right-icon"></slot>
|
|
20
26
|
</div>
|
|
21
27
|
</div>
|
|
22
28
|
</div>
|
|
23
29
|
</template>
|
|
24
30
|
|
|
25
31
|
<script setup lang="ts">
|
|
26
|
-
import {
|
|
27
|
-
import type {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
32
|
+
import {computed, ref, useAttrs, useSlots} from 'vue';
|
|
33
|
+
import type {ICoreInputProps} from '../../types/input';
|
|
34
|
+
import {useKitSize} from '../../composables/kit/size';
|
|
35
|
+
import {useKitState} from '../../composables/kit/state';
|
|
36
|
+
import {vMaska} from 'maska/vue';
|
|
37
|
+
import BaseIcon from '../BaseIcon/BaseIcon.vue';
|
|
31
38
|
|
|
32
39
|
const props = withDefaults(defineProps<ICoreInputProps>(), {
|
|
33
40
|
id: '',
|
|
@@ -36,27 +43,36 @@ const props = withDefaults(defineProps<ICoreInputProps>(), {
|
|
|
36
43
|
modelValue: '',
|
|
37
44
|
placeholder: '',
|
|
38
45
|
mask: '',
|
|
46
|
+
clearable: false,
|
|
39
47
|
focusable: true,
|
|
40
48
|
});
|
|
41
49
|
|
|
42
50
|
const emit: (event: 'update:modelValue', value: string) => void = defineEmits();
|
|
43
51
|
|
|
44
|
-
const {
|
|
45
|
-
const {
|
|
52
|
+
const {sizeClassList} = useKitSize(props);
|
|
53
|
+
const {stateClassList, stateAttrs} = useKitState(props);
|
|
46
54
|
const attrs = useAttrs();
|
|
47
55
|
const slots = useSlots();
|
|
56
|
+
const inputRef = ref<HTMLInputElement | null>(null);
|
|
48
57
|
|
|
49
58
|
const componentAttrs = computed(() => ({
|
|
50
59
|
...attrs,
|
|
51
60
|
...stateAttrs.value,
|
|
52
61
|
}));
|
|
53
62
|
|
|
63
|
+
const showClearButton = computed(() => (
|
|
64
|
+
props.clearable
|
|
65
|
+
&& Boolean(props.modelValue)
|
|
66
|
+
&& !props.readonly
|
|
67
|
+
&& !props.disabled
|
|
68
|
+
));
|
|
69
|
+
|
|
54
70
|
const classList = computed(() => [
|
|
55
71
|
sizeClassList.value,
|
|
56
72
|
stateClassList.value,
|
|
57
73
|
{
|
|
58
74
|
'--icon-left': !!slots['left-icon'],
|
|
59
|
-
'--icon-right': !!slots['right-icon'],
|
|
75
|
+
'--icon-right': !!slots['right-icon'] || showClearButton.value,
|
|
60
76
|
'--is-error': props.error,
|
|
61
77
|
'--is-readonly': props.readonly,
|
|
62
78
|
},
|
|
@@ -66,6 +82,11 @@ function handleInput(event: Event) {
|
|
|
66
82
|
const target = event.target as HTMLInputElement;
|
|
67
83
|
emit('update:modelValue', target.value);
|
|
68
84
|
}
|
|
85
|
+
|
|
86
|
+
function clearInput() {
|
|
87
|
+
emit('update:modelValue', '');
|
|
88
|
+
inputRef.value?.focus();
|
|
89
|
+
}
|
|
69
90
|
</script>
|
|
70
91
|
|
|
71
92
|
<style scoped lang="scss">
|
|
@@ -123,6 +144,16 @@ function handleInput(event: Event) {
|
|
|
123
144
|
color: var(--primary-black-500);
|
|
124
145
|
}
|
|
125
146
|
|
|
147
|
+
&__icon--right {
|
|
148
|
+
display: flex;
|
|
149
|
+
gap: 8px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&__clear-icon {
|
|
153
|
+
color: var(--primary-black-500);
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
}
|
|
156
|
+
|
|
126
157
|
@include is-disabled-state {
|
|
127
158
|
#{$input}__icon--right {
|
|
128
159
|
color: var(--primary-black-400);
|
|
@@ -135,24 +166,24 @@ function handleInput(event: Event) {
|
|
|
135
166
|
top: 50%;
|
|
136
167
|
transform: translateY(-50%);
|
|
137
168
|
}
|
|
138
|
-
|
|
169
|
+
|
|
139
170
|
&.--is-error {
|
|
140
171
|
|
|
141
|
-
|
|
142
|
-
|
|
172
|
+
#{$input}__field {
|
|
173
|
+
border-color: var(--error-red-light-01);
|
|
143
174
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
175
|
+
&--focusable {
|
|
176
|
+
@include focused {
|
|
177
|
+
border: 1px solid var(--error-red-light-02);
|
|
178
|
+
outline: 4px solid var(--effects-error-focus);
|
|
149
179
|
}
|
|
150
180
|
}
|
|
181
|
+
}
|
|
151
182
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
183
|
+
#{$input}__icon--right > * {
|
|
184
|
+
color: var(--error-red);
|
|
155
185
|
}
|
|
186
|
+
}
|
|
156
187
|
|
|
157
188
|
&.--small-size {
|
|
158
189
|
#{$input}__wrapper {
|
|
@@ -181,8 +212,12 @@ function handleInput(event: Event) {
|
|
|
181
212
|
|
|
182
213
|
#{$input}__icon--right {
|
|
183
214
|
right: 14px;
|
|
184
|
-
|
|
185
|
-
|
|
215
|
+
min-height: 16px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
#{$input}__clear-icon {
|
|
219
|
+
width: 20px;
|
|
220
|
+
height: 20px;
|
|
186
221
|
}
|
|
187
222
|
}
|
|
188
223
|
|
|
@@ -213,8 +248,12 @@ function handleInput(event: Event) {
|
|
|
213
248
|
|
|
214
249
|
#{$input}__icon--right {
|
|
215
250
|
right: 14px;
|
|
216
|
-
|
|
217
|
-
|
|
251
|
+
min-height: 20px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
#{$input}__clear-icon {
|
|
255
|
+
width: 24px;
|
|
256
|
+
height: 24px;
|
|
218
257
|
}
|
|
219
258
|
}
|
|
220
259
|
|
|
@@ -245,9 +284,13 @@ function handleInput(event: Event) {
|
|
|
245
284
|
|
|
246
285
|
#{$input}__icon--right {
|
|
247
286
|
right: 16px;
|
|
248
|
-
|
|
249
|
-
|
|
287
|
+
min-height: 24px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
#{$input}__clear-icon {
|
|
291
|
+
width: 32px;
|
|
292
|
+
height: 32px;
|
|
250
293
|
}
|
|
251
294
|
}
|
|
252
295
|
}
|
|
253
|
-
</style>
|
|
296
|
+
</style>
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
- `placeholder: string`
|
|
19
19
|
Текст-заполнитель для поля ввода.
|
|
20
20
|
|
|
21
|
+
- `clearable: boolean`
|
|
22
|
+
Показывает кнопку очистки справа, если значение поля не пустое. Для иконки очистки используется `BaseIcon`.
|
|
23
|
+
|
|
21
24
|
- `error: string | boolean`
|
|
22
25
|
Ошибка, которая будет отображаться под полем ввода. Может быть строкой с сообщением об ошибке или булевым значением, где `true` указывает на наличие ошибки.
|
|
23
26
|
|
|
@@ -34,6 +37,9 @@
|
|
|
34
37
|
- **Иконки слева и справа:**
|
|
35
38
|
Компонент поддерживает иконки слева и справа от поля ввода через слоты `left-icon` и `right-icon`. Это удобно для отображения дополнительных иконок (например, иконки для показа пароля).
|
|
36
39
|
|
|
40
|
+
- **Очистка значения:**
|
|
41
|
+
При `clearable=true` справа появляется кнопка очистки только когда в поле есть текст. Нажатие очищает `v-model`.
|
|
42
|
+
|
|
37
43
|
- **Состояния:**
|
|
38
44
|
Используются CSS-классы для отображения разных состояний поля ввода, таких как фокус, ошибка и состояние "disabled".
|
|
39
45
|
|
|
@@ -54,6 +60,7 @@
|
|
|
54
60
|
<BaseInput
|
|
55
61
|
v-model="inputValue"
|
|
56
62
|
placeholder="Введите текст"
|
|
63
|
+
clearable
|
|
57
64
|
:error="errorMessage"
|
|
58
65
|
:hint="hintMessage"
|
|
59
66
|
:size="'medium'"
|
|
@@ -82,4 +89,4 @@
|
|
|
82
89
|
|
|
83
90
|
---
|
|
84
91
|
|
|
85
|
-
Этот компонент подходит для создания формы с текстовым вводом, где необходимо отображать иконки, подсказки и ошибки, а также поддерживать несколько размеров и состояний.
|
|
92
|
+
Этот компонент подходит для создания формы с текстовым вводом, где необходимо отображать иконки, подсказки и ошибки, а также поддерживать несколько размеров и состояний.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
:modelValue="modelValue"
|
|
7
7
|
:placeholder="placeholder"
|
|
8
8
|
:size="size"
|
|
9
|
+
:clearable="clearable"
|
|
9
10
|
class="base-input-with-selector__input"
|
|
10
11
|
@update:modelValue="handleInput"
|
|
11
12
|
>
|
|
@@ -45,12 +46,14 @@ const props = withDefaults(defineProps<{
|
|
|
45
46
|
label: string;
|
|
46
47
|
value: string | number;
|
|
47
48
|
}[]
|
|
49
|
+
clearable?: boolean
|
|
48
50
|
placeholder?: string
|
|
49
51
|
size?: 'small' | 'medium' | 'large'
|
|
50
52
|
error?: string
|
|
51
53
|
}>(), {
|
|
52
54
|
modelValue: '',
|
|
53
55
|
selectedOptionId: '',
|
|
56
|
+
clearable: false,
|
|
54
57
|
size: 'medium',
|
|
55
58
|
placeholder: '',
|
|
56
59
|
})
|
|
@@ -397,7 +397,7 @@ defineSlots<{
|
|
|
397
397
|
display: flex;
|
|
398
398
|
align-items: center;
|
|
399
399
|
justify-content: center;
|
|
400
|
-
color:
|
|
400
|
+
color: var(--primary-black-500);
|
|
401
401
|
transition: transform var(--transition);
|
|
402
402
|
transform: translateY(-50%);
|
|
403
403
|
}
|
|
@@ -436,6 +436,11 @@ defineSlots<{
|
|
|
436
436
|
|
|
437
437
|
&.--small-size {
|
|
438
438
|
#{$select} {
|
|
439
|
+
|
|
440
|
+
&__wrapper {
|
|
441
|
+
height: v-bind('props.searchable? `40px`: ``');
|
|
442
|
+
}
|
|
443
|
+
|
|
439
444
|
&__header_value, &__placeholder {
|
|
440
445
|
font: var(--typography-text-m-regular);
|
|
441
446
|
}
|
|
@@ -459,6 +464,10 @@ defineSlots<{
|
|
|
459
464
|
|
|
460
465
|
&.--medium-size {
|
|
461
466
|
#{$select} {
|
|
467
|
+
&__wrapper {
|
|
468
|
+
height: v-bind('props.searchable? `48px`: ``');
|
|
469
|
+
}
|
|
470
|
+
|
|
462
471
|
&__header_value, &__placeholder {
|
|
463
472
|
font: var(--typography-text-m-regular);
|
|
464
473
|
}
|
|
@@ -482,6 +491,10 @@ defineSlots<{
|
|
|
482
491
|
|
|
483
492
|
&.--large-size {
|
|
484
493
|
#{$select} {
|
|
494
|
+
&__wrapper {
|
|
495
|
+
height: v-bind('props.searchable? `56px`: ``');
|
|
496
|
+
}
|
|
497
|
+
|
|
485
498
|
&__header_value, &__placeholder {
|
|
486
499
|
font: var(--typography-text-l-regular);
|
|
487
500
|
}
|
package/src/types/chips.d.ts
CHANGED