plugin-ui-for-kzt 0.0.20 → 0.0.21
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/BaseButton/BaseButton.vue.d.ts +2 -0
- package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +0 -8
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +2 -0
- package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +2 -0
- package/dist/components/BaseInput/BaseInput.vue.d.ts +15 -17
- package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +14 -12
- package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +9 -7
- package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +12 -7
- package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +12 -7
- package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +2 -0
- package/dist/components/BaseRadio/BaseRadio.vue.d.ts +2 -0
- package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +2 -0
- package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +7 -11
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +12 -7
- package/dist/components/BaseToggle/BaseToggle.vue.d.ts +2 -0
- package/dist/composables/kit/state.d.ts +2 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/example/App.vue +30 -185
- package/package.json +1 -1
- package/src/components/BaseInput/BaseInput.vue +228 -162
- package/src/components/BaseInputCalendar/BaseInputCalendar.vue +7 -10
- package/src/components/BaseInputCurrency/BaseInputCurrency.vue +78 -39
- package/src/components/BaseInputEmail/BaseInputEmail.vue +4 -2
- package/src/components/BaseInputPhone/BaseInputPhone.vue +89 -29
- package/src/components/BaseSegmentedButtons/BaseSegmentedButtons.vue +1 -0
- package/src/components/BaseSelect/BaseSelect.vue +52 -9
- package/src/components/BaseSiteInput/BaseSiteInput.vue +63 -11
- package/src/components/BaseTextarea/BaseTextarea.vue +30 -3
- package/src/composables/kit/state.ts +2 -1
- package/src/index.ts +2 -5
- package/src/styles/index.scss +2 -87
- package/src/styles/root.scss +0 -1
- package/src/styles/variables.scss +1 -2
- package/src/types/button.d.ts +1 -0
- package/src/types/calendar.d.ts +0 -2
- package/src/types/input.d.ts +8 -26
- package/src/types/utils.d.ts +1 -0
- package/dist/components/BaseField/BaseField.vue.d.ts +0 -98
- package/src/components/BaseField/BaseField.vue +0 -184
- package/src/components/BaseField/README.md +0 -85
- package/src/types/field.d.ts +0 -12
|
@@ -1,42 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
<div class="base-input" :class="classList">
|
|
3
|
+
<label class="base-input__label" :for="id">
|
|
4
|
+
<span v-if="label" class="base-input__label-text">{{ label }}</span>
|
|
5
|
+
|
|
6
|
+
<div class="base-input__wrapper">
|
|
7
|
+
<div v-if="$slots['left-icon']" class="base-input__icon base-input__icon--left">
|
|
8
|
+
<slot name="left-icon"></slot>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<input
|
|
12
|
+
:id="id"
|
|
13
|
+
:type="type"
|
|
14
|
+
:value="modelValue"
|
|
15
|
+
v-maska="mask"
|
|
16
|
+
v-bind="componentAttrs"
|
|
17
|
+
:placeholder="placeholder || ''"
|
|
18
|
+
class="base-input__field"
|
|
19
|
+
@input="handleInput"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<div v-if="$slots['right-icon']" class="base-input__icon base-input__icon--right">
|
|
23
|
+
<slot name="right-icon"></slot>
|
|
24
|
+
</div>
|
|
20
25
|
</div>
|
|
26
|
+
|
|
27
|
+
<transition name="error">
|
|
28
|
+
<div v-if="(error && typeof error === 'string') || hint" class="base-input__hint">
|
|
29
|
+
{{ error || hint }}
|
|
30
|
+
</div>
|
|
31
|
+
</transition>
|
|
32
|
+
</label>
|
|
21
33
|
</div>
|
|
22
|
-
</div>
|
|
23
34
|
</template>
|
|
24
35
|
|
|
25
36
|
<script setup lang="ts">
|
|
26
37
|
import { computed, useAttrs, useSlots } from 'vue';
|
|
27
|
-
import type { ICoreInputProps } from '../../types/input'
|
|
28
|
-
import { useKitSize } from '../../composables/kit/size'
|
|
29
|
-
import { useKitState } from '../../composables/kit/state'
|
|
30
|
-
import { vMaska } from
|
|
38
|
+
import type { ICoreInputProps } from '../../types/input'
|
|
39
|
+
import { useKitSize } from '../../composables/kit/size'
|
|
40
|
+
import { useKitState } from '../../composables/kit/state'
|
|
41
|
+
import { vMaska } from "maska/vue"
|
|
31
42
|
|
|
32
43
|
const props = withDefaults(defineProps<ICoreInputProps>(), {
|
|
33
|
-
id: '',
|
|
34
44
|
size: 'medium',
|
|
35
45
|
type: 'text',
|
|
36
46
|
modelValue: '',
|
|
37
|
-
placeholder: '',
|
|
47
|
+
placeholder: '' as string,
|
|
48
|
+
error: '',
|
|
49
|
+
hint: '',
|
|
38
50
|
mask: '',
|
|
39
|
-
focusable: true,
|
|
40
51
|
});
|
|
41
52
|
|
|
42
53
|
const emit: (event: 'update:modelValue', value: string) => void = defineEmits();
|
|
@@ -44,21 +55,22 @@ const emit: (event: 'update:modelValue', value: string) => void = defineEmits();
|
|
|
44
55
|
const { sizeClassList } = useKitSize(props);
|
|
45
56
|
const { stateClassList, stateAttrs } = useKitState(props);
|
|
46
57
|
const attrs = useAttrs();
|
|
47
|
-
const slots = useSlots();
|
|
48
58
|
|
|
49
59
|
const componentAttrs = computed(() => ({
|
|
50
60
|
...attrs,
|
|
51
61
|
...stateAttrs.value,
|
|
52
62
|
}));
|
|
53
63
|
|
|
64
|
+
const slots = useSlots();
|
|
65
|
+
|
|
54
66
|
const classList = computed(() => [
|
|
55
67
|
sizeClassList.value,
|
|
56
68
|
stateClassList.value,
|
|
69
|
+
|
|
57
70
|
{
|
|
71
|
+
'--is-readonly': props.readonly,
|
|
58
72
|
'--icon-left': !!slots['left-icon'],
|
|
59
73
|
'--icon-right': !!slots['right-icon'],
|
|
60
|
-
'--is-error': props.error,
|
|
61
|
-
'--is-readonly': props.readonly,
|
|
62
74
|
},
|
|
63
75
|
]);
|
|
64
76
|
|
|
@@ -72,81 +84,94 @@ function handleInput(event: Event) {
|
|
|
72
84
|
@import '../../styles/variables';
|
|
73
85
|
@import '../../styles/root';
|
|
74
86
|
|
|
75
|
-
.base-input {
|
|
76
|
-
width: 100%;
|
|
77
|
-
$input: &;
|
|
78
|
-
|
|
79
|
-
&__wrapper {
|
|
80
|
-
position: relative;
|
|
81
|
-
display: flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
width: 100%;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&__field {
|
|
87
|
-
flex: 1;
|
|
87
|
+
.base-input {
|
|
88
88
|
width: 100%;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
color: var(--primary-text-tertiary);
|
|
89
|
+
$input: &;
|
|
90
|
+
|
|
91
|
+
&__wrapper {
|
|
92
|
+
position: relative;
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
align-items: flex-start;
|
|
96
|
+
width: 100%;
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
&__field {
|
|
100
|
+
flex: 1;
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: 100%;
|
|
103
|
+
color: var(--primary-text-primary);
|
|
104
|
+
background: var(--bg-light);
|
|
105
|
+
border: 1px solid var(--primary-black-300);
|
|
106
|
+
outline: none;
|
|
107
|
+
transition: all var(--transition);
|
|
108
|
+
|
|
109
|
+
&::placeholder {
|
|
106
110
|
color: var(--primary-text-tertiary);
|
|
107
|
-
background: var(--primary-black-100);
|
|
108
111
|
}
|
|
109
|
-
}
|
|
110
112
|
|
|
111
|
-
|
|
113
|
+
@include pressed {
|
|
114
|
+
color: var(--primary-blue);
|
|
115
|
+
}
|
|
116
|
+
|
|
112
117
|
@include focused {
|
|
113
118
|
border: 1px solid var(--primary-blue-500);
|
|
114
119
|
outline: 4px solid var(--effects-primary-focus);
|
|
115
120
|
}
|
|
121
|
+
|
|
122
|
+
@include is-disabled-state {
|
|
123
|
+
& {
|
|
124
|
+
color: var(--primary-text-tertiary);
|
|
125
|
+
background: var(--primary-black-100);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
116
128
|
}
|
|
117
|
-
}
|
|
118
129
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
&__icon {
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
color: var(--primary-black-500);
|
|
135
|
+
}
|
|
125
136
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
color: var(--primary-black-400);
|
|
137
|
+
&__hint {
|
|
138
|
+
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
129
139
|
}
|
|
130
|
-
}
|
|
131
140
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
@include is-disabled-state {
|
|
142
|
+
#{$input}__icon--right {
|
|
143
|
+
color: var(--primary-black-400);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#{$input}__hint {
|
|
147
|
+
color: var(--primary-text-secondary);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&__icon--left, &__icon--right {
|
|
152
|
+
position: absolute;
|
|
153
|
+
top: 50%;
|
|
154
|
+
transform: translateY(-50%);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&__label {
|
|
158
|
+
display: flex;
|
|
159
|
+
flex-direction: column;
|
|
160
|
+
gap: 6px;
|
|
161
|
+
width: 100%;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&__label-text {
|
|
165
|
+
color: var(--primary-text-primary);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
&.--is-error {
|
|
169
|
+
#{$input}__hint {
|
|
170
|
+
color: var(--error-red);
|
|
171
|
+
}
|
|
140
172
|
|
|
141
173
|
#{$input}__field {
|
|
142
174
|
border-color: var(--error-red-light-01);
|
|
143
|
-
|
|
144
|
-
&--focusable {
|
|
145
|
-
@include focused {
|
|
146
|
-
border: 1px solid var(--error-red-light-02);
|
|
147
|
-
outline: 4px solid var(--effects-error-focus);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
175
|
}
|
|
151
176
|
|
|
152
177
|
#{$input}__icon--right > * {
|
|
@@ -154,100 +179,141 @@ function handleInput(event: Event) {
|
|
|
154
179
|
}
|
|
155
180
|
}
|
|
156
181
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
182
|
+
&.--small-size {
|
|
183
|
+
#{$input} {
|
|
184
|
+
&__label {
|
|
185
|
+
font: var(--typography-text-s-medium);
|
|
186
|
+
}
|
|
161
187
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
188
|
+
&__hint {
|
|
189
|
+
font: var(--typography-text-s-regular);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
167
192
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
193
|
+
#{$input}__wrapper {
|
|
194
|
+
height: 40px;
|
|
195
|
+
}
|
|
171
196
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
197
|
+
#{$input}__field {
|
|
198
|
+
padding: 8px 14px;
|
|
199
|
+
font: var(--typography-text-m-regular);
|
|
200
|
+
border-radius: 10px;
|
|
201
|
+
}
|
|
175
202
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
height: 20px;
|
|
180
|
-
}
|
|
203
|
+
&.--icon-left #{$input}__field {
|
|
204
|
+
padding-left: 42px;
|
|
205
|
+
}
|
|
181
206
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
height: 16px;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
207
|
+
&.--icon-right #{$input}__field {
|
|
208
|
+
padding-right: 38px;
|
|
209
|
+
}
|
|
188
210
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
211
|
+
#{$input}__icon--left {
|
|
212
|
+
left: 14px;
|
|
213
|
+
width: 20px;
|
|
214
|
+
height: 20px;
|
|
215
|
+
}
|
|
193
216
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
217
|
+
#{$input}__icon--right {
|
|
218
|
+
right: 14px;
|
|
219
|
+
width: 16px;
|
|
220
|
+
height: 16px;
|
|
221
|
+
}
|
|
198
222
|
}
|
|
199
223
|
|
|
200
|
-
&.--
|
|
201
|
-
|
|
202
|
-
|
|
224
|
+
&.--medium-size {
|
|
225
|
+
#{$input} {
|
|
226
|
+
&__label {
|
|
227
|
+
font: var(--typography-text-s-medium);
|
|
228
|
+
}
|
|
203
229
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
230
|
+
&__hint {
|
|
231
|
+
font: var(--typography-text-s-regular);
|
|
232
|
+
}
|
|
207
233
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
height: 24px;
|
|
212
|
-
}
|
|
234
|
+
&__wrapper {
|
|
235
|
+
height: 48px;
|
|
236
|
+
}
|
|
213
237
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
238
|
+
&__field {
|
|
239
|
+
padding: 12px 14px;
|
|
240
|
+
font: var(--typography-text-m-regular);
|
|
241
|
+
border-radius: 12px;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
220
244
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
245
|
+
&.--icon-left #{$input}__field {
|
|
246
|
+
padding-left: 46px;
|
|
247
|
+
}
|
|
225
248
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
border-radius: 12px;
|
|
230
|
-
}
|
|
249
|
+
&.--icon-right #{$input}__field {
|
|
250
|
+
padding-right: 42px;
|
|
251
|
+
}
|
|
231
252
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
253
|
+
#{$input}__icon--left {
|
|
254
|
+
left: 14px;
|
|
255
|
+
width: 24px;
|
|
256
|
+
height: 24px;
|
|
257
|
+
}
|
|
235
258
|
|
|
236
|
-
|
|
237
|
-
|
|
259
|
+
#{$input}__icon--right {
|
|
260
|
+
right: 14px;
|
|
261
|
+
width: 20px;
|
|
262
|
+
height: 20px;
|
|
263
|
+
}
|
|
238
264
|
}
|
|
239
265
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
266
|
+
&.--large-size {
|
|
267
|
+
#{$input} {
|
|
268
|
+
&__label {
|
|
269
|
+
font: var(--typography-text-m-medium);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
&__hint {
|
|
273
|
+
font: var(--typography-text-m-regular);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
&__wrapper {
|
|
277
|
+
height: 56px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&__field {
|
|
281
|
+
padding: 14px 16px;
|
|
282
|
+
font: var(--typography-text-l-regular);
|
|
283
|
+
border-radius: 12px;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
&.--icon-left #{$input}__field {
|
|
288
|
+
padding-left: 56px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
&.--icon-right #{$input}__field {
|
|
292
|
+
padding-right: 48px;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
#{$input}__icon--left {
|
|
296
|
+
left: 16px;
|
|
297
|
+
width: 32px;
|
|
298
|
+
height: 32px;
|
|
299
|
+
}
|
|
245
300
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
301
|
+
#{$input}__icon--right {
|
|
302
|
+
right: 16px;
|
|
303
|
+
width: 24px;
|
|
304
|
+
height: 24px;
|
|
305
|
+
}
|
|
250
306
|
}
|
|
251
307
|
}
|
|
252
|
-
|
|
253
|
-
|
|
308
|
+
.error-enter-active,
|
|
309
|
+
.error-leave-active {
|
|
310
|
+
transition: opacity 0.3s ease, transform 0.3s ease;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.error-enter-from,
|
|
314
|
+
.error-leave-to {
|
|
315
|
+
opacity: 0;
|
|
316
|
+
transform: translateY(10px);
|
|
317
|
+
max-height: 0;
|
|
318
|
+
}
|
|
319
|
+
</style>
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
:range="range"
|
|
7
7
|
:size="size"
|
|
8
8
|
:min-date="minDate"
|
|
9
|
-
:id="id"
|
|
10
9
|
>
|
|
11
10
|
<base-input
|
|
12
|
-
v-bind="{ ...$props }"
|
|
11
|
+
v-bind="{ ...$props, ...$attrs }"
|
|
13
12
|
:model-value="formattedValue"
|
|
13
|
+
:error="errorMessage || props.error"
|
|
14
14
|
@update:model-value="handleInputUpdate"
|
|
15
15
|
>
|
|
16
16
|
<template #['left-icon']>
|
|
@@ -37,14 +37,13 @@ const props = withDefaults(defineProps<TCoreInputCalendarProps>(), {
|
|
|
37
37
|
type: 'text',
|
|
38
38
|
modelValue: '',
|
|
39
39
|
placeholder: '',
|
|
40
|
+
error: '',
|
|
41
|
+
hint: '',
|
|
40
42
|
range: false,
|
|
41
43
|
minDate: null,
|
|
42
44
|
});
|
|
43
45
|
|
|
44
|
-
const emit = defineEmits
|
|
45
|
-
'update:modelValue': [value: string],
|
|
46
|
-
'validationError': [value: string],
|
|
47
|
-
}>();
|
|
46
|
+
const emit: (event: 'update:modelValue', value: string) => void = defineEmits();
|
|
48
47
|
|
|
49
48
|
const inputValue = ref<string>('');
|
|
50
49
|
|
|
@@ -202,18 +201,16 @@ function handleInputUpdate(value: string) {
|
|
|
202
201
|
|
|
203
202
|
inputValue.value = filteredValue;
|
|
204
203
|
emit('update:modelValue', filteredValue);
|
|
205
|
-
emit('validationError', validation.value);
|
|
206
204
|
|
|
207
205
|
const parsed = parseDateString(filteredValue);
|
|
208
206
|
if (parsed) {
|
|
209
207
|
const formatted = formatDateRange(parsed);
|
|
210
208
|
inputValue.value = formatted;
|
|
211
209
|
emit('update:modelValue', formatted);
|
|
212
|
-
emit('validationError', validation.value);
|
|
213
210
|
}
|
|
214
211
|
}
|
|
215
212
|
|
|
216
|
-
const
|
|
213
|
+
const errorMessage = computed<string>(() => {
|
|
217
214
|
if (!inputValue.value) {
|
|
218
215
|
return '';
|
|
219
216
|
}
|
|
@@ -236,7 +233,7 @@ const validation = computed<string>(() => {
|
|
|
236
233
|
|
|
237
234
|
<style scoped lang="scss">
|
|
238
235
|
.base-input-calendar {
|
|
239
|
-
width:
|
|
236
|
+
width: max-content;
|
|
240
237
|
|
|
241
238
|
&__wrapper {
|
|
242
239
|
position: relative;
|