plugin-ui-for-kzt 0.0.56 → 0.0.58

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.
Files changed (32) hide show
  1. package/dist/components/BaseBadge/BaseBadge.vue.d.ts +1 -1
  2. package/dist/components/BaseButton/BaseButton.vue.d.ts +3 -3
  3. package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +2 -2
  4. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +2 -2
  5. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +2 -2
  6. package/dist/components/BaseField/BaseField.vue.d.ts +2 -2
  7. package/dist/components/BaseInput/BaseInput.vue.d.ts +12 -3
  8. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +9 -2
  9. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +10 -3
  10. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +9 -2
  11. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +9 -2
  12. package/dist/components/BaseInputWithSelector/BaseInputWithSelector.vue.d.ts +9 -0
  13. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +2 -2
  14. package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
  15. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +2 -2
  16. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +2 -2
  17. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +6 -4
  18. package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +7 -0
  19. package/dist/components/BaseTag/BaseTag.vue.d.ts +1 -1
  20. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +9 -2
  21. package/dist/components/BaseToast/BaseToast.vue.d.ts +1 -1
  22. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +2 -2
  23. package/dist/index.js +1 -1
  24. package/dist/sprite.svg +1 -1
  25. package/example/App.vue +61 -46
  26. package/package.json +1 -1
  27. package/src/assets/icons/arrow-down.svg +1 -1
  28. package/src/components/BaseInput/BaseInput.vue +80 -37
  29. package/src/components/BaseInput/README.md +8 -1
  30. package/src/components/BaseInputWithSelector/BaseInputWithSelector.vue +3 -0
  31. package/src/components/BaseSelect/BaseSelect.vue +18 -1
  32. package/src/types/input.d.ts +2 -0
@@ -5,29 +5,36 @@
5
5
  <slot name="left-icon"></slot>
6
6
  </div>
7
7
  <input
8
- :id="id"
9
- :type="type"
10
- :value="modelValue"
11
- v-maska="mask"
12
- v-bind="componentAttrs"
13
- :placeholder="placeholder || ''"
14
- class="base-input__field"
15
- :class="{ 'base-input__field--focusable': focusable }"
16
- @input="handleInput"
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
- <slot name="right-icon"></slot>
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 { 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 'maska/vue';
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 { sizeClassList } = useKitSize(props);
45
- const { stateClassList, stateAttrs } = useKitState(props);
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
- #{$input}__field {
142
- border-color: var(--error-red-light-01);
172
+ #{$input}__field {
173
+ border-color: var(--error-red-light-01);
143
174
 
144
- &--focusable {
145
- @include focused {
146
- border: 1px solid var(--error-red-light-02);
147
- outline: 4px solid var(--effects-error-focus);
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
- #{$input}__icon--right > * {
153
- color: var(--error-red);
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
- width: 16px;
185
- height: 16px;
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
- width: 20px;
217
- height: 20px;
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
- width: 24px;
249
- height: 24px;
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
  })
@@ -289,6 +289,7 @@ const classList = computed( () => [
289
289
  sizeClassList.value,
290
290
  stateClassList.value,
291
291
  styleClassList.value,
292
+ props.variant,
292
293
  {
293
294
  '--is-readonly': props.readonly,
294
295
  '--is-disabled': actualDisabled.value,
@@ -396,7 +397,7 @@ defineSlots<{
396
397
  display: flex;
397
398
  align-items: center;
398
399
  justify-content: center;
399
- color: var(--ui-colors-input-icon-default);
400
+ color: var(--primary-black-500);
400
401
  transition: transform var(--transition);
401
402
  transform: translateY(-50%);
402
403
  }
@@ -534,5 +535,21 @@ defineSlots<{
534
535
  }
535
536
  }
536
537
  }
538
+
539
+ &.variant-blue {
540
+ #{$select} {
541
+ &__header {
542
+ background: var(--primary-blue);
543
+
544
+ &_value {
545
+ color: var(--primary-black-white);
546
+ }
547
+ }
548
+
549
+ &__placeholder, &__arrow {
550
+ color: var(--primary-black-white);
551
+ }
552
+ }
553
+ }
537
554
  }
538
555
  </style>
@@ -8,6 +8,7 @@ export interface InputProps {
8
8
  mask?: string
9
9
  type?: string
10
10
  placeholder?: string
11
+ clearable?: boolean
11
12
  error?: string | boolean;
12
13
  readonly?: boolean
13
14
  tooltipOptions?: ITooltipProps
@@ -64,6 +65,7 @@ export interface ICoreSelectBaseProps {
64
65
  label?: string
65
66
  hint?: string
66
67
  searchable?: boolean
68
+ variant?: 'variant-blue'
67
69
  }
68
70
 
69
71
  export interface ISelectSlotProps {