plugin-ui-for-kzt 0.0.21 → 0.0.23

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 (57) hide show
  1. package/dist/components/BaseBadge/BaseBadge.vue.d.ts +1 -1
  2. package/dist/components/BaseButton/BaseButton.vue.d.ts +1 -3
  3. package/dist/components/BaseCalendar/BaseCalendar.vue.d.ts +9 -1
  4. package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +1 -3
  5. package/dist/components/BaseDropdown/BaseDropdown.vue.d.ts +1 -3
  6. package/dist/components/BaseField/BaseField.vue.d.ts +98 -0
  7. package/dist/components/BaseInput/BaseInput.vue.d.ts +19 -17
  8. package/dist/components/BaseInputCalendar/BaseInputCalendar.vue.d.ts +15 -17
  9. package/dist/components/BaseInputCurrency/BaseInputCurrency.vue.d.ts +10 -12
  10. package/dist/components/BaseInputEmail/BaseInputEmail.vue.d.ts +9 -14
  11. package/dist/components/BaseInputPhone/BaseInputPhone.vue.d.ts +9 -14
  12. package/dist/components/BaseOpenedListItem/BaseOpenedListItem.vue.d.ts +1 -3
  13. package/dist/components/BasePagination/BasePagination.vue.d.ts +1 -1
  14. package/dist/components/BaseRadio/BaseRadio.vue.d.ts +1 -3
  15. package/dist/components/BaseSegmentedButtons/BaseSegmentedButtons.vue.d.ts +1 -3
  16. package/dist/components/BaseSelect/BaseSelect.vue.d.ts +1 -1
  17. package/dist/components/BaseSiteInput/BaseSiteInput.vue.d.ts +11 -7
  18. package/dist/components/BaseTabs/BaseTabs.vue.d.ts +25 -0
  19. package/dist/components/BaseTag/BaseTag.vue.d.ts +1 -1
  20. package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +9 -14
  21. package/dist/components/BaseToggle/BaseToggle.vue.d.ts +1 -3
  22. package/dist/components/BaseTooltip/BaseTooltip.vue.d.ts +1 -1
  23. package/dist/components/BaseUpload/BaseUpload.vue.d.ts +11 -0
  24. package/dist/components/BaseUpload/CropModal.vue.d.ts +9 -0
  25. package/dist/composables/kit/state.d.ts +1 -2
  26. package/dist/index.d.ts +3 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.LICENSE.txt +15 -0
  29. package/example/App.vue +37 -31
  30. package/example/TestImage.vue +6 -0
  31. package/package.json +2 -1
  32. package/src/components/BaseCheckbox/BaseCheckbox.vue +76 -46
  33. package/src/components/BaseField/BaseField.vue +184 -0
  34. package/src/components/BaseField/README.md +85 -0
  35. package/src/components/BaseInput/BaseInput.vue +162 -228
  36. package/src/components/BaseInputCalendar/BaseInputCalendar.vue +10 -7
  37. package/src/components/BaseInputCurrency/BaseInputCurrency.vue +39 -78
  38. package/src/components/BaseInputEmail/BaseInputEmail.vue +2 -4
  39. package/src/components/BaseInputPhone/BaseInputPhone.vue +29 -89
  40. package/src/components/BaseRadio/BaseRadio.vue +266 -233
  41. package/src/components/BaseSelect/BaseSelect.vue +9 -52
  42. package/src/components/BaseSiteInput/BaseSiteInput.vue +11 -63
  43. package/src/components/BaseTabs/BaseTabs.vue +193 -0
  44. package/src/components/BaseTextarea/BaseTextarea.vue +3 -30
  45. package/src/components/BaseUpload/BaseUpload.vue +35 -1
  46. package/src/components/BaseUpload/CropModal.vue +210 -0
  47. package/src/composables/kit/state.ts +1 -2
  48. package/src/index.ts +8 -2
  49. package/src/styles/index.scss +87 -2
  50. package/src/styles/root.scss +1 -0
  51. package/src/styles/variables.scss +2 -1
  52. package/src/types/calendar.d.ts +2 -0
  53. package/src/types/field.d.ts +12 -0
  54. package/src/types/input.d.ts +26 -8
  55. package/src/types/tab.d.ts +17 -0
  56. package/src/types/uploadedFile.d.ts +7 -0
  57. package/src/types/utils.d.ts +0 -1
@@ -1,30 +1,32 @@
1
1
  <template>
2
2
  <div :class="classList">
3
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
- id="input-currency"
8
- type="text"
9
- :modelValue="modelValue"
10
- v-bind="componentAttrs"
11
- v-maska
12
- :data-maska="selectedOption.mask"
13
- :size="size"
14
- :placeholder="placeholder || '0.00'"
15
- class="base-input-currency__input"
16
- @update:modelValue="handleInput"
17
- ></base-input>
18
- </div>
19
- <base-select
20
- id="select-currency"
21
- v-model="selectedOptionId"
22
- :options="optionsCurrency"
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"
23
13
  :size="size"
24
- :error="error"
25
- class="base-input-currency__select"
14
+ :placeholder="placeholder || '0.00'"
15
+ :focusable="false"
16
+ class="base-input-currency__input"
17
+ @update:modelValue="handleInput"
26
18
  />
27
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>
28
30
  </div>
29
31
  </template>
30
32
 
@@ -35,7 +37,7 @@ import BaseInput from '../BaseInput/BaseInput.vue';
35
37
  import BaseSelect from '../BaseSelect/BaseSelect.vue';
36
38
  import { useKitState } from '../../composables/kit/state';
37
39
  import { useKitSize } from '../../composables/kit/size';
38
- import type { ICoreInputProps } from '../../types/input';
40
+ import type { ICoreInputProps, IOptionsCurrency } from '../../types/input';
39
41
 
40
42
  const props = withDefaults(defineProps<ICoreInputProps>(), {
41
43
  size: 'medium',
@@ -43,24 +45,23 @@ const props = withDefaults(defineProps<ICoreInputProps>(), {
43
45
  modelValue: '',
44
46
  placeholder: '0.00',
45
47
  error: '',
46
- hint: '',
47
48
  });
48
49
 
49
50
  const emit: (event: 'update:modelValue', value: string) => void = defineEmits();
50
51
 
51
- const optionsCurrency = ref([
52
- { id: '1', name: 'KZT', value: 'kzt', mask: '# ##0.##', symbol: '₸' },
53
- { id: '2', name: 'RUB', value: 'rub', mask: '# ##0.##', symbol: '₽' },
54
- { id: '3', name: 'KGS', value: 'kgs', mask: '# ##0.##', symbol: '⃀' },
55
- { id: '4', name: 'UZS', value: 'uzs', mask: '# ##0.##', symbol: 'сў' },
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: 'сў' },
56
57
  ]);
57
58
 
58
- const selectedOption = ref(optionsCurrency.value[0]);
59
+ const selectedOption = ref<IOptionsCurrency>(optionsCurrency.value[0]);
59
60
 
60
- const selectedOptionId = ref(selectedOption.value.id);
61
+ const selectedOptionId = ref<IOptionsCurrency['id']>(selectedOption.value.id);
61
62
 
62
- watch(selectedOptionId, (newId) => {
63
- const newOption = optionsCurrency.value.find((option) => option.id === newId);
63
+ watch(selectedOptionId, (newId: IOptionsCurrency['id']) => {
64
+ const newOption = optionsCurrency.value.find((option: IOptionsCurrency) => option.id === newId);
64
65
  if (newOption) {
65
66
  selectedOption.value = newOption;
66
67
  }
@@ -71,21 +72,16 @@ const { sizeClassList } = useKitSize(props);
71
72
  const attrs = useAttrs();
72
73
 
73
74
  const componentAttrs = computed(() => ({
74
- ...attrs,
75
- ...stateAttrs.value,
76
- label: props.label,
77
- error: props.error,
78
- hint: props.hint,
79
- placeholder: props.placeholder,
75
+ ...attrs,
76
+ ...stateAttrs.value,
77
+ error: props.error,
78
+ placeholder: props.placeholder,
80
79
  }));
81
80
 
82
81
  const classList = computed(() => [
83
82
  stateClassList.value,
84
83
  sizeClassList.value,
85
- 'base-input-currency',
86
- {
87
- '--is-has-hint': !!props.hint,
88
- }
84
+ 'base-input-currency'
89
85
  ]);
90
86
 
91
87
  const modelValue = computed({
@@ -116,6 +112,7 @@ width: 100%;
116
112
  &__input-container {
117
113
  display: flex;
118
114
  align-items: center;
115
+ flex-grow: 1;
119
116
  }
120
117
 
121
118
  &__symbol {
@@ -153,14 +150,6 @@ width: 100%;
153
150
  }
154
151
 
155
152
  &.--small-size {
156
- &.--is-has-hint {
157
- #{$input} {
158
- &__select {
159
- margin-bottom: 26px;
160
- }
161
- }
162
- }
163
-
164
153
  #{$input} {
165
154
  :deep(.base-select) {
166
155
  width: 71px;
@@ -169,10 +158,6 @@ width: 100%;
169
158
  &__symbol {
170
159
  font-size: var(--typography-text-s-regular);
171
160
  }
172
-
173
- &.--is-error {
174
- margin-bottom: 26px;
175
- }
176
161
  }
177
162
 
178
163
  :deep(.base-input__field) {
@@ -181,14 +166,6 @@ width: 100%;
181
166
  }
182
167
 
183
168
  &.--medium-size {
184
- &.--is-has-hint {
185
- #{$input} {
186
- &__select {
187
- margin-bottom: 26px;
188
- }
189
- }
190
- }
191
-
192
169
  #{$input} {
193
170
  :deep(.base-select) {
194
171
  width: 75px;
@@ -197,10 +174,6 @@ width: 100%;
197
174
  &__symbol {
198
175
  font-size: var(--typography-text-m-regular);
199
176
  }
200
-
201
- &.--is-error {
202
- margin-bottom: 26px;
203
- }
204
177
  }
205
178
 
206
179
  :deep(.base-input__field) {
@@ -209,14 +182,6 @@ width: 100%;
209
182
  }
210
183
 
211
184
  &.--large-size {
212
- &.--is-has-hint {
213
- #{$input} {
214
- &__select {
215
- margin-bottom: 30px;
216
- }
217
- }
218
- }
219
-
220
185
  #{$input} {
221
186
  :deep(.base-select) {
222
187
  width: 87px;
@@ -225,10 +190,6 @@ width: 100%;
225
190
  &__symbol {
226
191
  font-size: var(--typography-text-l-regular);
227
192
  }
228
-
229
- &.--is-error {
230
- margin-bottom: 30px;
231
- }
232
193
  }
233
194
 
234
195
  :deep(.base-input__field) {
@@ -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: max-content;
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 }: ICoreButtonProps">
13
- <base-icon
14
- :name="item.icon"
15
- :size="size"
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 ICoreButtonProps {
43
- item:{
44
- icon:string
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: '' as string,
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: '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' },
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
- const newOption = optionsPhone.value.find((option) => option.id === newId);
71
- if (newOption) {
72
- selectedOption.value = newOption;
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,24 +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
- hint: props.hint,
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',
93
- {
94
- '--is-has-hint': !!props.hint,
95
- }
91
+ 'base-input-phone'
96
92
  ]);
97
93
 
98
94
  const modelValue = computed({
99
- get: () => props.modelValue,
100
- set: value => emit('update:modelValue', value),
95
+ get: () => props.modelValue,
96
+ set: value => emit('update:modelValue', value),
101
97
  });
102
98
  const handleInput = (value: string) => {
103
99
  emit('update:modelValue', value);
@@ -126,11 +122,7 @@ const handleInput = (value: string) => {
126
122
  :deep(.base-input__field) {
127
123
  border-top-left-radius: 0 !important;
128
124
  border-bottom-left-radius: 0 !important;
129
- border-left: none;
130
- }
131
-
132
- :deep(.base-select__hint) {
133
- display: none;
125
+ border-left: none !important;
134
126
  }
135
127
  }
136
128
 
@@ -143,79 +135,27 @@ const handleInput = (value: string) => {
143
135
  }
144
136
 
145
137
  &.--small-size {
146
- &.--is-has-hint {
147
- #{$input} {
148
- &__select {
149
- margin-bottom: 26px;
150
- }
151
- }
152
- }
153
-
154
138
  #{$input} {
155
139
  :deep(.base-select) {
156
140
  width: 71px;
157
141
  }
158
-
159
- &__select {
160
- &.--is-error {
161
- margin-bottom: 26px;
162
- }
163
- }
164
- }
165
- :deep(.base-input__label-text),
166
- :deep(.base-input__hint) {
167
- transform: translateX(-54px);
168
142
  }
169
143
  }
170
144
 
171
145
  &.--medium-size {
172
- &.--is-has-hint {
173
- #{$input} {
174
- &__select {
175
- margin-bottom: 26px;
176
- }
177
- }
178
- }
179
-
180
146
  #{$input} {
181
147
  &__select {
182
148
  width: 75px;
183
-
184
- &.--is-error {
185
- margin-bottom: 26px;
186
- }
187
149
  }
188
150
  }
189
-
190
- :deep(.base-input__label-text),
191
- :deep(.base-input__hint) {
192
- transform: translateX(-75px);
193
- }
194
151
  }
195
152
 
196
153
  &.--large-size {
197
- &.--is-has-hint {
198
- #{$input} {
199
- &__select {
200
- margin-bottom: 30px;
201
- }
202
- }
203
- }
204
-
205
154
  #{$input} {
206
155
  &__select {
207
156
  width: 87px;
208
-
209
- &.--is-error {
210
- margin-bottom: 30px;
211
- }
212
157
  }
213
158
  }
214
-
215
- :deep(.base-input__label-text),
216
- :deep(.base-input__hint) {
217
- transform: translateX(-86px);
218
- }
219
159
  }
220
160
  }
221
161
  </style>