plugin-ui-for-kzt 0.0.18 → 0.0.20
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/BaseCalendar/BaseCalendar.vue.d.ts +9 -1
- package/dist/components/BaseField/BaseField.vue.d.ts +98 -0
- package/dist/components/BaseInput/BaseInput.vue.d.ts +16 -14
- package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +13 -15
- package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +7 -9
- package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +7 -12
- package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +7 -12
- package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +11 -7
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +7 -12
- package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
- package/dist/composables/kit/state.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/example/App.vue +172 -133
- package/package.json +1 -1
- package/src/components/BaseField/BaseField.vue +184 -0
- package/src/components/BaseField/README.md +85 -0
- package/src/components/BaseInput/BaseInput.vue +161 -210
- package/src/components/BaseInputCalendar/BaseInputCalendar.vue +10 -7
- package/src/components/BaseInputCurrency/BaseInputCurrency.vue +56 -54
- package/src/components/BaseInputEmail/BaseInputEmail.vue +2 -4
- package/src/components/BaseInputPhone/BaseInputPhone.vue +29 -48
- package/src/components/BaseSelect/BaseSelect.vue +9 -52
- package/src/components/BaseSiteInput/BaseSiteInput.vue +10 -20
- package/src/components/BaseTextarea/BaseTextarea.vue +3 -30
- package/src/components/BaseUpload/BaseUpload.vue +1 -1
- package/src/composables/kit/state.ts +1 -1
- package/src/index.ts +5 -2
- package/src/styles/index.scss +87 -2
- package/src/styles/root.scss +1 -0
- package/src/styles/variables.scss +2 -1
- package/src/types/calendar.d.ts +2 -0
- package/src/types/field.d.ts +12 -0
- package/src/types/input.d.ts +26 -8
- package/webpack.config.js +1 -1
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="classList">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
<div :class="classList">
|
|
3
|
+
<div class="base-input-currency__wrapper">
|
|
4
|
+
<div class="base-input-currency__input-container">
|
|
5
|
+
<span class="base-input-currency__symbol">{{ selectedOption.symbol }}</span>
|
|
6
|
+
<base-input
|
|
7
|
+
type="text"
|
|
8
|
+
:id="id"
|
|
9
|
+
:modelValue="modelValue"
|
|
10
|
+
v-bind="componentAttrs"
|
|
11
|
+
v-maska
|
|
12
|
+
:data-maska="selectedOption.mask"
|
|
13
|
+
:size="size"
|
|
14
|
+
:placeholder="placeholder || '0.00'"
|
|
15
|
+
:focusable="false"
|
|
16
|
+
class="base-input-currency__input"
|
|
17
|
+
@update:modelValue="handleInput"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
<base-select
|
|
21
|
+
id="select-currency"
|
|
22
|
+
v-model="selectedOptionId"
|
|
23
|
+
:options="optionsCurrency"
|
|
24
|
+
:size="size"
|
|
25
|
+
:error="error"
|
|
26
|
+
class="base-input-currency__select"
|
|
27
|
+
>
|
|
28
|
+
</base-select>
|
|
29
|
+
</div>
|
|
18
30
|
</div>
|
|
19
|
-
<base-select
|
|
20
|
-
id="select-currency"
|
|
21
|
-
v-model="selectedOptionId"
|
|
22
|
-
:options="optionsCurrency"
|
|
23
|
-
:size="size"
|
|
24
|
-
:error="error"
|
|
25
|
-
class="base-input-currency__select"
|
|
26
|
-
>
|
|
27
|
-
</base-select>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
31
|
</template>
|
|
31
32
|
|
|
32
33
|
<script setup lang="ts">
|
|
@@ -36,35 +37,34 @@ import BaseInput from '../BaseInput/BaseInput.vue';
|
|
|
36
37
|
import BaseSelect from '../BaseSelect/BaseSelect.vue';
|
|
37
38
|
import { useKitState } from '../../composables/kit/state';
|
|
38
39
|
import { useKitSize } from '../../composables/kit/size';
|
|
39
|
-
import type { ICoreInputProps } from '../../types/input';
|
|
40
|
+
import type { ICoreInputProps, IOptionsCurrency } from '../../types/input';
|
|
40
41
|
|
|
41
42
|
const props = withDefaults(defineProps<ICoreInputProps>(), {
|
|
42
|
-
size: 'medium',
|
|
43
|
-
type: 'text',
|
|
44
|
-
modelValue: '',
|
|
45
|
-
placeholder: '0.00',
|
|
46
|
-
error: '',
|
|
47
|
-
hint: '',
|
|
43
|
+
size: 'medium',
|
|
44
|
+
type: 'text',
|
|
45
|
+
modelValue: '',
|
|
46
|
+
placeholder: '0.00',
|
|
47
|
+
error: '',
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
const emit: (event: 'update:modelValue', value: string) => void = defineEmits();
|
|
51
51
|
|
|
52
|
-
const optionsCurrency = ref([
|
|
53
|
-
{ id: '1', name: 'KZT', value: '
|
|
54
|
-
{ id: '2', name: 'RUB', value: '
|
|
55
|
-
{ id: '3', name: 'KGS', value: '
|
|
56
|
-
{ id: '4', name: 'UZS', value: '
|
|
52
|
+
const optionsCurrency = ref<IOptionsCurrency[]>([
|
|
53
|
+
{ id: '1', name: 'KZT', value: 'KZT', mask: '# ##0.##', symbol: '₸' },
|
|
54
|
+
{ id: '2', name: 'RUB', value: 'RUB', mask: '# ##0.##', symbol: '₽' },
|
|
55
|
+
{ id: '3', name: 'KGS', value: 'KGS', mask: '# ##0.##', symbol: '⃀' },
|
|
56
|
+
{ id: '4', name: 'UZS', value: 'UZS', mask: '# ##0.##', symbol: 'сў' },
|
|
57
57
|
]);
|
|
58
58
|
|
|
59
|
-
const selectedOption = ref(optionsCurrency.value[0]);
|
|
59
|
+
const selectedOption = ref<IOptionsCurrency>(optionsCurrency.value[0]);
|
|
60
60
|
|
|
61
|
-
const selectedOptionId = ref(selectedOption.value.id);
|
|
61
|
+
const selectedOptionId = ref<IOptionsCurrency['id']>(selectedOption.value.id);
|
|
62
62
|
|
|
63
|
-
watch(selectedOptionId, (newId) => {
|
|
64
|
-
const newOption = optionsCurrency.value.find((option) => option.id === newId);
|
|
65
|
-
if (newOption) {
|
|
66
|
-
|
|
67
|
-
}
|
|
63
|
+
watch(selectedOptionId, (newId: IOptionsCurrency['id']) => {
|
|
64
|
+
const newOption = optionsCurrency.value.find((option: IOptionsCurrency) => option.id === newId);
|
|
65
|
+
if (newOption) {
|
|
66
|
+
selectedOption.value = newOption;
|
|
67
|
+
}
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
const { stateClassList, stateAttrs } = useKitState(props);
|
|
@@ -74,25 +74,23 @@ const attrs = useAttrs();
|
|
|
74
74
|
const componentAttrs = computed(() => ({
|
|
75
75
|
...attrs,
|
|
76
76
|
...stateAttrs.value,
|
|
77
|
-
label: props.label,
|
|
78
77
|
error: props.error,
|
|
79
|
-
hint: props.hint,
|
|
80
78
|
placeholder: props.placeholder,
|
|
81
79
|
}));
|
|
82
80
|
|
|
83
81
|
const classList = computed(() => [
|
|
84
|
-
stateClassList.value,
|
|
85
|
-
sizeClassList.value,
|
|
86
|
-
'base-input-currency'
|
|
82
|
+
stateClassList.value,
|
|
83
|
+
sizeClassList.value,
|
|
84
|
+
'base-input-currency'
|
|
87
85
|
]);
|
|
88
86
|
|
|
89
87
|
const modelValue = computed({
|
|
90
|
-
get: () => props.modelValue,
|
|
91
|
-
set: (value) => emit('update:modelValue', value),
|
|
88
|
+
get: () => props.modelValue,
|
|
89
|
+
set: (value) => emit('update:modelValue', value),
|
|
92
90
|
});
|
|
93
91
|
|
|
94
92
|
const handleInput = (value: string) => {
|
|
95
|
-
emit('update:modelValue', value);
|
|
93
|
+
emit('update:modelValue', value);
|
|
96
94
|
};
|
|
97
95
|
</script>
|
|
98
96
|
|
|
@@ -114,6 +112,7 @@ width: 100%;
|
|
|
114
112
|
&__input-container {
|
|
115
113
|
display: flex;
|
|
116
114
|
align-items: center;
|
|
115
|
+
flex-grow: 1;
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
&__symbol {
|
|
@@ -155,6 +154,7 @@ width: 100%;
|
|
|
155
154
|
:deep(.base-select) {
|
|
156
155
|
width: 71px;
|
|
157
156
|
}
|
|
157
|
+
|
|
158
158
|
&__symbol {
|
|
159
159
|
font-size: var(--typography-text-s-regular);
|
|
160
160
|
}
|
|
@@ -170,6 +170,7 @@ width: 100%;
|
|
|
170
170
|
:deep(.base-select) {
|
|
171
171
|
width: 75px;
|
|
172
172
|
}
|
|
173
|
+
|
|
173
174
|
&__symbol {
|
|
174
175
|
font-size: var(--typography-text-m-regular);
|
|
175
176
|
}
|
|
@@ -185,6 +186,7 @@ width: 100%;
|
|
|
185
186
|
:deep(.base-select) {
|
|
186
187
|
width: 87px;
|
|
187
188
|
}
|
|
189
|
+
|
|
188
190
|
&__symbol {
|
|
189
191
|
font-size: var(--typography-text-l-regular);
|
|
190
192
|
}
|
|
@@ -47,8 +47,6 @@ const props = withDefaults(defineProps<ICoreInputProps>(), {
|
|
|
47
47
|
type: 'email',
|
|
48
48
|
modelValue: '',
|
|
49
49
|
placeholder: '' as string,
|
|
50
|
-
error: '',
|
|
51
|
-
hint: '',
|
|
52
50
|
});
|
|
53
51
|
|
|
54
52
|
const emit = defineEmits<{
|
|
@@ -64,7 +62,7 @@ function onUpdateModelValue(value: string) {
|
|
|
64
62
|
emit('update:modelValue', value);
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
const emailError = ref('');
|
|
65
|
+
const emailError = ref<string>('');
|
|
68
66
|
|
|
69
67
|
watch(modelValue, (value) => {
|
|
70
68
|
if (!/^[\w\-.]+@(?:[\w\-]+\.)+[\w\-]{2,4}$/.test(String(value))) {
|
|
@@ -77,7 +75,7 @@ watch(modelValue, (value) => {
|
|
|
77
75
|
|
|
78
76
|
<style scoped lang="scss">
|
|
79
77
|
.base-input-email {
|
|
80
|
-
width:
|
|
78
|
+
width: 100%;
|
|
81
79
|
|
|
82
80
|
&__tooltip-container {
|
|
83
81
|
position: relative;
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
:error="error"
|
|
10
10
|
class="base-input-phone__select"
|
|
11
11
|
>
|
|
12
|
-
<template #iconItem="{ item }:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
<template #iconItem="{ item }: IIconProps">
|
|
13
|
+
<base-icon
|
|
14
|
+
:name="item.icon"
|
|
15
|
+
:size="size"
|
|
16
|
+
/>
|
|
17
17
|
</template>
|
|
18
18
|
</base-select>
|
|
19
19
|
<base-input
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
:mask="selectedOption.mask"
|
|
25
25
|
:size="size"
|
|
26
26
|
:placeholder="placeholder || ''"
|
|
27
|
+
:focusable="false"
|
|
27
28
|
class="base-input-phone__input"
|
|
28
29
|
@update:modelValue="handleInput"
|
|
29
30
|
></base-input>
|
|
@@ -37,40 +38,39 @@ import BaseInput from '../BaseInput/BaseInput.vue';
|
|
|
37
38
|
import BaseSelect from '../BaseSelect/BaseSelect.vue';
|
|
38
39
|
import { useKitState } from '../../composables/kit/state';
|
|
39
40
|
import { useKitSize } from '../../composables/kit/size';
|
|
40
|
-
import type { ICoreInputProps } from '../../types/input';
|
|
41
|
+
import type { ICoreInputProps, IOptionsPhone } from '../../types/input';
|
|
41
42
|
|
|
42
|
-
interface
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
interface IIconProps {
|
|
44
|
+
item:{
|
|
45
|
+
icon:string
|
|
46
|
+
}
|
|
46
47
|
}
|
|
48
|
+
|
|
47
49
|
const props = withDefaults(defineProps<ICoreInputProps>(), {
|
|
48
50
|
size: 'medium',
|
|
49
51
|
type: 'text',
|
|
50
52
|
modelValue: '',
|
|
51
|
-
placeholder: ''
|
|
52
|
-
error: '',
|
|
53
|
-
hint: '',
|
|
53
|
+
placeholder: '',
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
const emit: (event: 'update:modelValue', value: string) => void = defineEmits();
|
|
57
57
|
|
|
58
|
-
const optionsPhone = ref([
|
|
59
|
-
{ id: '1', name: 'KZ', value: '
|
|
60
|
-
{ id: '2', name: 'RU', value: '
|
|
61
|
-
{ id: '3', name: 'KG', value: '
|
|
62
|
-
{ id: '4', name: 'UZ', value: '
|
|
58
|
+
const optionsPhone = ref<IOptionsPhone[]>([
|
|
59
|
+
{ id: '1', name: 'KZ', value: 'KZ', mask: '+7 (###) ###-##-##', icon: 'KZ' },
|
|
60
|
+
{ id: '2', name: 'RU', value: 'RU', mask: '+7 (###) ###-##-##', icon: 'RU' },
|
|
61
|
+
{ id: '3', name: 'KG', value: 'KG', mask:'+996 (###) ###-###', icon: 'KG' },
|
|
62
|
+
{ id: '4', name: 'UZ', value: 'UZ', mask: '+998 (##) ###-##-##', icon: 'UZ' },
|
|
63
63
|
]);
|
|
64
64
|
|
|
65
|
-
const selectedOption = ref(optionsPhone.value[0]);
|
|
65
|
+
const selectedOption = ref<IOptionsPhone>(optionsPhone.value[0]);
|
|
66
66
|
|
|
67
|
-
const selectedOptionId = ref(selectedOption.value.id);
|
|
67
|
+
const selectedOptionId = ref<IOptionsPhone['id']>(selectedOption.value.id);
|
|
68
68
|
|
|
69
69
|
watch(selectedOptionId, (newId) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const newOption = optionsPhone.value.find((option) => option.id === newId);
|
|
71
|
+
if (newOption) {
|
|
72
|
+
selectedOption.value = newOption;
|
|
73
|
+
}
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
const { stateClassList, stateAttrs } = useKitState(props);
|
|
@@ -80,21 +80,20 @@ const attrs = useAttrs();
|
|
|
80
80
|
const componentAttrs = computed(() => ({
|
|
81
81
|
...attrs,
|
|
82
82
|
...stateAttrs.value,
|
|
83
|
-
label: props.label,
|
|
84
83
|
error: props.error,
|
|
85
|
-
|
|
84
|
+
focusable: props.focusable,
|
|
86
85
|
placeholder: props.placeholder,
|
|
87
86
|
}));
|
|
88
87
|
|
|
89
88
|
const classList = computed(() => [
|
|
90
89
|
stateClassList.value,
|
|
91
90
|
sizeClassList.value,
|
|
92
|
-
'base-input-phone'
|
|
91
|
+
'base-input-phone'
|
|
93
92
|
]);
|
|
94
93
|
|
|
95
94
|
const modelValue = computed({
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
get: () => props.modelValue,
|
|
96
|
+
set: value => emit('update:modelValue', value),
|
|
98
97
|
});
|
|
99
98
|
const handleInput = (value: string) => {
|
|
100
99
|
emit('update:modelValue', value);
|
|
@@ -123,11 +122,7 @@ const handleInput = (value: string) => {
|
|
|
123
122
|
:deep(.base-input__field) {
|
|
124
123
|
border-top-left-radius: 0 !important;
|
|
125
124
|
border-bottom-left-radius: 0 !important;
|
|
126
|
-
border-left: none;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
:deep(.base-select__hint) {
|
|
130
|
-
display: none;
|
|
125
|
+
border-left: none !important;
|
|
131
126
|
}
|
|
132
127
|
}
|
|
133
128
|
|
|
@@ -145,10 +140,6 @@ const handleInput = (value: string) => {
|
|
|
145
140
|
width: 71px;
|
|
146
141
|
}
|
|
147
142
|
}
|
|
148
|
-
:deep(.base-input__label-text),
|
|
149
|
-
:deep(.base-input__hint) {
|
|
150
|
-
transform: translateX(-54px);
|
|
151
|
-
}
|
|
152
143
|
}
|
|
153
144
|
|
|
154
145
|
&.--medium-size {
|
|
@@ -157,11 +148,6 @@ const handleInput = (value: string) => {
|
|
|
157
148
|
width: 75px;
|
|
158
149
|
}
|
|
159
150
|
}
|
|
160
|
-
|
|
161
|
-
:deep(.base-input__label-text),
|
|
162
|
-
:deep(.base-input__hint) {
|
|
163
|
-
transform: translateX(-75px);
|
|
164
|
-
}
|
|
165
151
|
}
|
|
166
152
|
|
|
167
153
|
&.--large-size {
|
|
@@ -170,11 +156,6 @@ const handleInput = (value: string) => {
|
|
|
170
156
|
width: 87px;
|
|
171
157
|
}
|
|
172
158
|
}
|
|
173
|
-
|
|
174
|
-
:deep(.base-input__label-text),
|
|
175
|
-
:deep(.base-input__hint) {
|
|
176
|
-
transform: translateX(-86px);
|
|
177
|
-
}
|
|
178
159
|
}
|
|
179
160
|
}
|
|
180
161
|
</style>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="base-select" :class="[classList]">
|
|
3
3
|
<div class="base-select__wrapper">
|
|
4
|
-
<label v-if="label" :for="id" class="base-select__label">{{ label }}</label>
|
|
5
|
-
|
|
6
4
|
<base-dropdown
|
|
7
5
|
v-model="dropdownVisible"
|
|
8
6
|
transition-name="top"
|
|
@@ -17,7 +15,7 @@
|
|
|
17
15
|
>
|
|
18
16
|
<slot
|
|
19
17
|
name="header"
|
|
20
|
-
:value="actualOption"
|
|
18
|
+
:value="actualOption ? [actualOption] : undefined"
|
|
21
19
|
>
|
|
22
20
|
<div v-if="$slots.headerIcon" class="base-select__header_prefix_icon">
|
|
23
21
|
<slot name="headerIcon" />
|
|
@@ -63,7 +61,7 @@
|
|
|
63
61
|
key-field="id"
|
|
64
62
|
class="base-select__list"
|
|
65
63
|
>
|
|
66
|
-
<template #default="{ item, index, active } :
|
|
64
|
+
<template #default="{ item, index, active } : ISelectSlotProps">
|
|
67
65
|
<dynamic-scroller-item
|
|
68
66
|
:item="item"
|
|
69
67
|
:active="active"
|
|
@@ -90,10 +88,6 @@
|
|
|
90
88
|
</div>
|
|
91
89
|
</template>
|
|
92
90
|
</base-dropdown>
|
|
93
|
-
|
|
94
|
-
<div v-if="(error && typeof error === 'string') || hint" class="base-select__hint">
|
|
95
|
-
{{ error || hint }}
|
|
96
|
-
</div>
|
|
97
91
|
</div>
|
|
98
92
|
</div>
|
|
99
93
|
</template>
|
|
@@ -102,20 +96,13 @@
|
|
|
102
96
|
import { computed, ref, watch } from 'vue';
|
|
103
97
|
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css';
|
|
104
98
|
import { DynamicScroller, DynamicScrollerItem } from 'vue-virtual-scroller';
|
|
105
|
-
import type { ICoreSelectProps, TSelectValue, ICoreSelectBaseProps } from '../../types/input';
|
|
99
|
+
import type { ICoreSelectProps, TSelectValue, ICoreSelectBaseProps, ICoreSelectOption, ISelectSlotProps } from '../../types/input';
|
|
106
100
|
import BaseDropdown from '../BaseDropdown/BaseDropdown.vue';
|
|
107
101
|
import BaseOpenedListItem from '../BaseOpenedListItem/BaseOpenedListItem.vue';
|
|
108
102
|
import { useKitSize } from '../../composables/kit/size';
|
|
109
103
|
import { useKitState } from '../../composables/kit/state';
|
|
110
104
|
import { useKitStyle } from '../../composables/kit/style';
|
|
111
105
|
|
|
112
|
-
// Определяем тип для slotProps
|
|
113
|
-
interface SlotProps {
|
|
114
|
-
item: ICoreSelectBaseProps;
|
|
115
|
-
index: number;
|
|
116
|
-
active: boolean;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
106
|
const props = withDefaults(defineProps<ICoreSelectProps & {
|
|
120
107
|
modelValue?: TSelectValue
|
|
121
108
|
}>(), {
|
|
@@ -130,11 +117,11 @@ const emit = defineEmits<{
|
|
|
130
117
|
|
|
131
118
|
const actualValue = ref<TSelectValue>(props.modelValue ?? '');
|
|
132
119
|
const actualOption = computed(() =>
|
|
133
|
-
props.options?.find((item:
|
|
120
|
+
props.options?.find((item: ICoreSelectOption) => item?.id === actualValue.value) || null
|
|
134
121
|
);
|
|
135
122
|
|
|
136
123
|
watch(() => props.modelValue, (val) => {
|
|
137
|
-
actualValue.value = val;
|
|
124
|
+
actualValue.value = val ?? '';
|
|
138
125
|
}, { immediate: true });
|
|
139
126
|
|
|
140
127
|
function handleInput(value: TSelectValue) {
|
|
@@ -152,7 +139,7 @@ const { styleClassList } = useKitStyle(props);
|
|
|
152
139
|
const listItemAttrs = computed(() => (item: ICoreSelectBaseProps) => ({
|
|
153
140
|
icon: item.icon,
|
|
154
141
|
active: actualValue.value === item.id,
|
|
155
|
-
title: item.name ||
|
|
142
|
+
title: item.name || '',
|
|
156
143
|
style: item.style,
|
|
157
144
|
disabled: item.disabled,
|
|
158
145
|
class: 'base-select__item',
|
|
@@ -170,8 +157,10 @@ const classList = computed(() => [
|
|
|
170
157
|
]);
|
|
171
158
|
|
|
172
159
|
defineSlots<{
|
|
173
|
-
default(props:
|
|
160
|
+
default(props: ISelectSlotProps): any;
|
|
174
161
|
iconItem(props: { item: ICoreSelectBaseProps }): any;
|
|
162
|
+
header(props: { value: ICoreSelectProps['options'] }): any;
|
|
163
|
+
headerIcon(): any;
|
|
175
164
|
}>();
|
|
176
165
|
</script>
|
|
177
166
|
|
|
@@ -205,14 +194,6 @@ defineSlots<{
|
|
|
205
194
|
}
|
|
206
195
|
|
|
207
196
|
&.--is-error {
|
|
208
|
-
#{$select}__hint {
|
|
209
|
-
color: var(--error-red);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
#{$select}__label {
|
|
213
|
-
border-color: var(--error-red-light-01);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
197
|
#{$select}__arrow > * {
|
|
217
198
|
color: var(--error-red);
|
|
218
199
|
}
|
|
@@ -276,14 +257,6 @@ defineSlots<{
|
|
|
276
257
|
|
|
277
258
|
&.--small-size {
|
|
278
259
|
#{$select} {
|
|
279
|
-
&__label {
|
|
280
|
-
font: var(--typography-text-s-medium);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
&__hint {
|
|
284
|
-
font: var(--typography-text-s-regular);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
260
|
&__header_value {
|
|
288
261
|
font: var(--typography-text-m-regular);
|
|
289
262
|
}
|
|
@@ -307,14 +280,6 @@ defineSlots<{
|
|
|
307
280
|
|
|
308
281
|
&.--medium-size {
|
|
309
282
|
#{$select} {
|
|
310
|
-
&__label {
|
|
311
|
-
font: var(--typography-text-s-medium);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
&__hint {
|
|
315
|
-
font: var(--typography-text-s-regular);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
283
|
&__header_value {
|
|
319
284
|
font: var(--typography-text-m-regular);
|
|
320
285
|
}
|
|
@@ -333,14 +298,6 @@ defineSlots<{
|
|
|
333
298
|
|
|
334
299
|
&.--large-size {
|
|
335
300
|
#{$select} {
|
|
336
|
-
&__label {
|
|
337
|
-
font: var(--typography-text-m-medium);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
&__hint {
|
|
341
|
-
font: var(--typography-text-m-regular);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
301
|
&__header_value {
|
|
345
302
|
font: var(--typography-text-l-regular);
|
|
346
303
|
}
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
<base-input
|
|
10
10
|
v-bind="{...$props, ...$attrs}"
|
|
11
11
|
v-model="modelValue"
|
|
12
|
-
id="
|
|
12
|
+
:id="id"
|
|
13
13
|
type="url"
|
|
14
14
|
:error="urlError || props.error"
|
|
15
|
+
class="base-site-input__input"
|
|
15
16
|
@update:modelValue="onUpdateModelValue"
|
|
16
17
|
/>
|
|
17
18
|
</div>
|
|
@@ -27,19 +28,19 @@ import type { ICorePropsBaseSiteInput } from '../../types/input'
|
|
|
27
28
|
const props = withDefaults(defineProps<ICorePropsBaseSiteInput>(),{
|
|
28
29
|
size: 'medium',
|
|
29
30
|
modelValue: '',
|
|
30
|
-
|
|
31
|
+
focusable: true,
|
|
31
32
|
})
|
|
32
33
|
|
|
33
34
|
const emit = defineEmits<{
|
|
34
35
|
(event: 'update:modelValue', value: string): void;
|
|
35
36
|
}>();
|
|
36
37
|
|
|
37
|
-
const urlError = ref('');
|
|
38
|
+
const urlError = ref<string>('');
|
|
38
39
|
const { sizeClassList } = useKitSize(props);
|
|
39
40
|
|
|
40
41
|
const classList = computed(() => [
|
|
41
42
|
sizeClassList.value,
|
|
42
|
-
'base-site-input'
|
|
43
|
+
'base-site-input'
|
|
43
44
|
]);
|
|
44
45
|
|
|
45
46
|
const normalizedValue = computed(() => {
|
|
@@ -76,7 +77,7 @@ watch(modelValue, (value) => {
|
|
|
76
77
|
.base-site-input {
|
|
77
78
|
$input: &;
|
|
78
79
|
|
|
79
|
-
width:
|
|
80
|
+
width: 100%;
|
|
80
81
|
|
|
81
82
|
&__wrapper {
|
|
82
83
|
display: flex;
|
|
@@ -91,6 +92,10 @@ watch(modelValue, (value) => {
|
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
|
|
95
|
+
&__input {
|
|
96
|
+
flex-grow: 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
94
99
|
&__url {
|
|
95
100
|
color: var(--primary-text-tertiary);
|
|
96
101
|
}
|
|
@@ -120,11 +125,6 @@ watch(modelValue, (value) => {
|
|
|
120
125
|
padding: var(--spacing-s) var(--spacing-m) var(--spacing-s) var(--spacing-2l);
|
|
121
126
|
}
|
|
122
127
|
}
|
|
123
|
-
|
|
124
|
-
:deep(.base-input__label-text),
|
|
125
|
-
:deep(.base-input__hint) {
|
|
126
|
-
transform: translateX(-75px);
|
|
127
|
-
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
&.--medium-size {
|
|
@@ -140,11 +140,6 @@ watch(modelValue, (value) => {
|
|
|
140
140
|
padding: var(--spacing-m) var(--spacing-m) var(--spacing-m) var(--spacing-2l);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
:deep(.base-input__label-text),
|
|
145
|
-
:deep(.base-input__hint) {
|
|
146
|
-
transform: translateX(-75px);
|
|
147
|
-
}
|
|
148
143
|
}
|
|
149
144
|
|
|
150
145
|
&.--large-size {
|
|
@@ -160,11 +155,6 @@ watch(modelValue, (value) => {
|
|
|
160
155
|
padding: var(--spacing-2l) var(--spacing-m) var(--spacing-2l) var(--spacing-l);
|
|
161
156
|
}
|
|
162
157
|
}
|
|
163
|
-
|
|
164
|
-
:deep(.base-input__label-text),
|
|
165
|
-
:deep(.base-input__hint) {
|
|
166
|
-
transform: translateX(-83px);
|
|
167
|
-
}
|
|
168
158
|
}
|
|
169
159
|
}
|
|
170
160
|
</style>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="base-textarea" :class="classList">
|
|
3
|
-
<
|
|
4
|
-
<span v-if="label" class="base-textarea__label-text">{{ label }}</span>
|
|
5
|
-
|
|
3
|
+
<div class="base-textarea__wrapper">
|
|
6
4
|
<div class="base-textarea__wrapper">
|
|
7
5
|
<textarea
|
|
8
6
|
:id="id"
|
|
@@ -17,11 +15,7 @@
|
|
|
17
15
|
{{ modelValue.length }}/{{ maxLength }}
|
|
18
16
|
</span>
|
|
19
17
|
</div>
|
|
20
|
-
|
|
21
|
-
<div v-if="(error && typeof error === 'string') || hint" class="base-textarea__hint">
|
|
22
|
-
{{ error || hint }}
|
|
23
|
-
</div>
|
|
24
|
-
</label>
|
|
18
|
+
</div>
|
|
25
19
|
</div>
|
|
26
20
|
</template>
|
|
27
21
|
|
|
@@ -34,8 +28,6 @@ import { useKitSize } from '../../composables/kit/size';
|
|
|
34
28
|
const props = withDefaults(defineProps<ICoreTextareaProps & { maxLength?: number }>(), {
|
|
35
29
|
modelValue: '',
|
|
36
30
|
placeholder: '' as string,
|
|
37
|
-
error: '',
|
|
38
|
-
hint: '',
|
|
39
31
|
size: 'medium',
|
|
40
32
|
});
|
|
41
33
|
|
|
@@ -73,11 +65,6 @@ function handleInput(event: Event) {
|
|
|
73
65
|
resize: none;
|
|
74
66
|
}
|
|
75
67
|
|
|
76
|
-
&__hint {
|
|
77
|
-
align-self: flex-start;
|
|
78
|
-
font: var(--typography-text-s-regular);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
68
|
&__wrapper {
|
|
82
69
|
display: flex;
|
|
83
70
|
position: relative;
|
|
@@ -113,10 +100,6 @@ function handleInput(event: Event) {
|
|
|
113
100
|
color: var(--primary-text-tertiary);
|
|
114
101
|
background: var(--primary-black-100);
|
|
115
102
|
}
|
|
116
|
-
|
|
117
|
-
#{$textarea}__hint {
|
|
118
|
-
color: var(--primary-text-secondary);
|
|
119
|
-
}
|
|
120
103
|
}
|
|
121
104
|
}
|
|
122
105
|
|
|
@@ -126,7 +109,7 @@ function handleInput(event: Event) {
|
|
|
126
109
|
color: var(--primary-text-quaternary);
|
|
127
110
|
}
|
|
128
111
|
|
|
129
|
-
&
|
|
112
|
+
&__wrapper {
|
|
130
113
|
display: flex;
|
|
131
114
|
flex-direction: column;
|
|
132
115
|
gap: 6px;
|
|
@@ -135,17 +118,7 @@ function handleInput(event: Event) {
|
|
|
135
118
|
height: 100%;
|
|
136
119
|
}
|
|
137
120
|
|
|
138
|
-
&__label-text {
|
|
139
|
-
align-self: flex-start;
|
|
140
|
-
font: var(--typography-text-s-medium);
|
|
141
|
-
color: var(--primary-text-primary);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
121
|
&.--is-error {
|
|
145
|
-
#{$textarea}__hint {
|
|
146
|
-
color: var(--error-red);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
122
|
#{$textarea}__field {
|
|
150
123
|
border-color: var(--error-red-light-01);
|
|
151
124
|
|
|
@@ -152,7 +152,7 @@ const handleFileUpload = (event: Event) => {
|
|
|
152
152
|
Array.from(files).forEach((file) => {
|
|
153
153
|
const fileExtension = `.${file.name.split('.').pop()?.toLowerCase() || ''}`;
|
|
154
154
|
if (!props.acceptedFormats.includes(fileExtension)) {
|
|
155
|
-
errorMessage.value = `Недопустимый формат файла: ${file.name}.
|
|
155
|
+
errorMessage.value = `Недопустимый формат файла: ${file.name}. Допустимый: ${props.acceptedFormats.join(', ')}.`;
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
158
|
|