plugin-ui-for-kzt 0.0.57 → 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 +2 -2
  2. package/dist/components/BaseButton/BaseButton.vue.d.ts +7 -3
  3. package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +7 -7
  4. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +8 -4
  5. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +7 -3
  6. package/dist/components/BaseField/BaseField.vue.d.ts +3 -3
  7. package/dist/components/BaseInput/BaseInput.vue.d.ts +14 -5
  8. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +15 -8
  9. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +13 -6
  10. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +11 -4
  11. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +11 -4
  12. package/dist/components/BaseInputWithSelector/BaseInputWithSelector.vue.d.ts +9 -0
  13. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +6 -2
  14. package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
  15. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +8 -4
  16. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +6 -2
  17. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +15 -7
  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 +11 -4
  21. package/dist/components/BaseToast/BaseToast.vue.d.ts +1 -1
  22. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +8 -4
  23. package/dist/index.js +1 -1
  24. package/dist/store/modal.d.ts +13 -13
  25. package/example/App.vue +39 -2
  26. package/package.json +1 -1
  27. package/src/components/BaseInput/BaseInput.vue +80 -37
  28. package/src/components/BaseInput/README.md +8 -1
  29. package/src/components/BaseInputWithSelector/BaseInputWithSelector.vue +3 -0
  30. package/src/components/BaseSelect/BaseSelect.vue +1 -1
  31. package/src/types/input.d.ts +1 -0
  32. package/.claude/settings.local.json +0 -7
@@ -36,7 +36,7 @@ export declare const useModalStore: import("pinia").StoreDefinition<"modal", {
36
36
  template?: string | object | undefined;
37
37
  render?: Function | undefined;
38
38
  components?: Record<string, import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions, {}, any>> | undefined;
39
- directives?: Record<string, import("vue").Directive<any, any, string, string>> | undefined;
39
+ directives?: Record<string, import("vue").Directive<any, any, string, any>> | undefined;
40
40
  inheritAttrs?: boolean | undefined;
41
41
  emits?: any;
42
42
  slots?: {} | undefined;
@@ -113,18 +113,18 @@ export declare const useModalStore: import("pinia").StoreDefinition<"modal", {
113
113
  filters?: Record<string, Function> | undefined;
114
114
  mixins?: any[] | undefined;
115
115
  extends?: any;
116
- beforeCreate?: (() => void) | undefined;
117
- created?: (() => void) | undefined;
118
- beforeMount?: (() => void) | undefined;
119
- mounted?: (() => void) | undefined;
120
- beforeUpdate?: (() => void) | undefined;
121
- updated?: (() => void) | undefined;
122
- activated?: (() => void) | undefined;
123
- deactivated?: (() => void) | undefined;
124
- beforeDestroy?: (() => void) | undefined;
125
- beforeUnmount?: (() => void) | undefined;
126
- destroyed?: (() => void) | undefined;
127
- unmounted?: (() => void) | undefined;
116
+ beforeCreate?: (() => any) | undefined;
117
+ created?: (() => any) | undefined;
118
+ beforeMount?: (() => any) | undefined;
119
+ mounted?: (() => any) | undefined;
120
+ beforeUpdate?: (() => any) | undefined;
121
+ updated?: (() => any) | undefined;
122
+ activated?: (() => any) | undefined;
123
+ deactivated?: (() => any) | undefined;
124
+ beforeDestroy?: (() => any) | undefined;
125
+ beforeUnmount?: (() => any) | undefined;
126
+ destroyed?: (() => any) | undefined;
127
+ unmounted?: (() => any) | undefined;
128
128
  renderTracked?: ((e: import("vue").DebuggerEvent) => void) | undefined;
129
129
  renderTriggered?: ((e: import("vue").DebuggerEvent) => void) | undefined;
130
130
  errorCaptured?: ((err: unknown, instance: import("vue").ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
package/example/App.vue CHANGED
@@ -8,6 +8,20 @@
8
8
  />
9
9
  </div>
10
10
  <section>
11
+ <BaseInput
12
+ id="input-default"
13
+ v-model="demoValues.inputDefault"
14
+ placeholder="Default input"
15
+ />
16
+
17
+ <BaseInput
18
+ id="input-clearable"
19
+ v-model="demoValues.inputClearable"
20
+ placeholder="Clearable input"
21
+ size="small"
22
+ clearable
23
+ />
24
+
11
25
  <BaseInputCalendar
12
26
  id="input-calendar"
13
27
  v-model="demoValues.calendar"
@@ -38,7 +52,25 @@
38
52
  placeholder="Поиск..."
39
53
  >
40
54
  <template #left-icon>
41
- <BaseIcon name="search" size="extra-small"/>
55
+ <BaseIcon name="search" size="large"/>
56
+ </template>
57
+ </BaseInputWithSelector>
58
+
59
+ <BaseInputWithSelector
60
+ v-model="clearableSearch"
61
+ v-model:selectedOptionId="clearableSearchType"
62
+ size="small"
63
+ clearable
64
+ :options="[
65
+ { id: 'iin', name: 'ИИН', value: 'iin' },
66
+ { id: 'bin', name: 'БИН', value: 'bin' },
67
+ { id: 'number', name: '#', value: '#' },
68
+ ]"
69
+ @search="handleSearch"
70
+ placeholder="Clearable search..."
71
+ >
72
+ <template #left-icon>
73
+ <BaseIcon name="search" size="large"/>
42
74
  </template>
43
75
  </BaseInputWithSelector>
44
76
  </div>
@@ -51,11 +83,14 @@ import BaseInputCalendar from '../src/components/BaseInputCalendar/BaseInputCale
51
83
  import MyCustomModal from './MyCustomModal.vue';
52
84
  import BaseIcon from "../src/components/BaseIcon/BaseIcon.vue";
53
85
  import BaseInputWithSelector from "../src/components/BaseInputWithSelector/BaseInputWithSelector.vue";
86
+ import BaseInput from "../src/components/BaseInput/BaseInput.vue";
54
87
 
55
88
  const { open } = useModal();
56
89
 
57
90
  const search = ref<string>( '' );
58
91
  const searchType = ref<string | number>( "iin" );
92
+ const clearableSearch = ref<string>( 'Search text' );
93
+ const clearableSearchType = ref<string | number>( "bin" );
59
94
 
60
95
  function handleSearch( { value, type }: { value: string; type: string | number } ) {
61
96
  console.log( 'DEBOUNCED SEARCH:', value, type )
@@ -70,6 +105,8 @@ const iconOptions = [
70
105
 
71
106
  const demoValues = ref( {
72
107
  icons: iconOptions[0].id,
108
+ inputDefault: '',
109
+ inputClearable: 'Text to clear',
73
110
  textarea: 'Тестовый текст',
74
111
  calendar: new Date(),
75
112
  calendarDisabled: new Date(),
@@ -125,4 +162,4 @@ const demoValues = ref( {
125
162
  gap: var(--spacing-xs);
126
163
  justify-content: flex-end;
127
164
  }
128
- </style>
165
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugin-ui-for-kzt",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "description": "plugin-ui for kazaktelekom",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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
  })
@@ -397,7 +397,7 @@ defineSlots<{
397
397
  display: flex;
398
398
  align-items: center;
399
399
  justify-content: center;
400
- color: #667085;
400
+ color: var(--primary-black-500);
401
401
  transition: transform var(--transition);
402
402
  transform: translateY(-50%);
403
403
  }
@@ -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
@@ -1,7 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(npm run build:*)"
5
- ]
6
- }
7
- }