plugin-ui-for-kzt 0.0.33 → 0.0.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugin-ui-for-kzt",
3
- "version": "0.0.33",
3
+ "version": "0.0.37",
4
4
  "description": "plugin-ui for kazaktelekom",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,24 +1,24 @@
1
1
  <template>
2
- <div class="base-tag" :class="classList">
2
+ <div class="base-tag" :class="classList">
3
3
  <div class="base-tag__wrapper">
4
- <div class="base-tag__text">{{ text }}</div>
5
- <div v-if="closable" class="base-tag__icon" @click="handleClose">
6
- <base-icon name="close" size="custom" />
7
- </div>
8
- <div v-if="addingTag" class="base-tag__icon">
9
- <base-icon name="add" size="custom" class="base-tag__add-icon" @click="handleAddTag" />
10
- </div>
11
- <div v-if="isHasAddTag" class="base-tag__input-wrapper">
12
- <input
13
- class="base-tag__input"
14
- type="text"
15
- v-model="inputText"
16
- @input="handleInput"
17
- @keypress.enter="handleCreateTag"
18
- />
19
- </div>
4
+ <div class="base-tag__text">{{ text }}</div>
5
+ <div v-if="closable" class="base-tag__icon" @click="handleClose">
6
+ <base-icon name="close" size="custom"/>
7
+ </div>
8
+ <div v-if="addingTag" class="base-tag__icon">
9
+ <base-icon name="add" size="custom" class="base-tag__add-icon" @click="handleAddTag"/>
10
+ </div>
11
+ <div v-if="isHasAddTag" class="base-tag__input-wrapper">
12
+ <input
13
+ class="base-tag__input"
14
+ type="text"
15
+ v-model="inputText"
16
+ @input="handleInput"
17
+ @keypress.enter="handleCreateTag"
18
+ />
19
+ </div>
20
20
  </div>
21
- </div>
21
+ </div>
22
22
  </template>
23
23
 
24
24
  <script setup lang="ts">
@@ -28,50 +28,50 @@ import type { ICoreTagProps } from '../../types/tag';
28
28
  import { useKitSize } from '../../composables/kit/size';
29
29
  import { useKitColor } from '../../composables/kit/color';
30
30
 
31
- const props = withDefaults(defineProps<ICoreTagProps>(), {
32
- size: 'medium',
33
- color: 'primary',
34
- closable: false,
35
- isHasAddTag: false,
36
- addingTag: false,
37
- text: '',
38
- });
31
+ const props = withDefaults( defineProps<ICoreTagProps>(), {
32
+ size: 'medium',
33
+ color: 'primary',
34
+ closable: false,
35
+ isHasAddTag: false,
36
+ addingTag: false,
37
+ text: '',
38
+ } );
39
39
 
40
40
  const emit = defineEmits<{
41
- updateInput: [value: ICoreTagProps['inputText']];
42
- close: [];
43
- addTag: [];
41
+ updateInput: [value: ICoreTagProps['inputText']];
42
+ close: [];
43
+ addTag: [];
44
44
  }>();
45
45
 
46
- const inputText = ref<string>(props.inputText || '');
46
+ const inputText = ref<string>( props.inputText || '' );
47
47
 
48
- const { sizeClassList } = useKitSize(props);
49
- const { colorClassList } = useKitColor(props);
48
+ const { sizeClassList } = useKitSize( props );
49
+ const { colorClassList } = useKitColor( props );
50
50
 
51
- const classList = computed(() => [
52
- sizeClassList.value,
53
- colorClassList.value,
54
- {'--adding-tag': props.addingTag},
55
- ]);
51
+ const classList = computed( () => [
52
+ sizeClassList.value,
53
+ colorClassList.value,
54
+ { '--adding-tag': props.addingTag },
55
+ ] );
56
56
 
57
57
  const handleClose = () => {
58
- emit('close');
58
+ emit( 'close' );
59
59
  };
60
60
 
61
- const handleInput = (event: Event) => {
62
- const target = event.target as HTMLInputElement;
63
- emit('updateInput', target.value);
61
+ const handleInput = ( event: Event ) => {
62
+ const target = event.target as HTMLInputElement;
63
+ emit( 'updateInput', target.value );
64
64
  };
65
65
 
66
66
  const handleCreateTag = () => {
67
- if (inputText.value.trim()) {
68
- emit('updateInput', inputText.value.trim());
69
- inputText.value = '';
70
- }
67
+ if ( inputText.value.trim() ) {
68
+ emit( 'updateInput', inputText.value.trim() );
69
+ inputText.value = '';
70
+ }
71
71
  };
72
72
 
73
73
  const handleAddTag = () => {
74
- emit('addTag');
74
+ emit( 'addTag' );
75
75
  };
76
76
  </script>
77
77
 
@@ -80,166 +80,169 @@ const handleAddTag = () => {
80
80
  @import '@/styles/root';
81
81
 
82
82
  .base-tag {
83
- display: inline-flex;
83
+ display: inline-flex;
84
+ align-items: center;
85
+ cursor: pointer;
86
+
87
+ &__wrapper {
88
+ display: flex;
89
+ align-items: center;
90
+ transition: all var(--transition);
91
+ gap: 7px;
92
+ }
93
+
94
+ &__text {
95
+ //white-space: nowrap;
96
+ overflow: hidden;
97
+ text-overflow: ellipsis;
98
+ width: 100%;
99
+ }
100
+
101
+ &__icon {
102
+ display: flex;
84
103
  align-items: center;
85
- cursor: pointer;
104
+ justify-content: center;
105
+ }
86
106
 
87
- &__wrapper {
88
- display: flex;
89
- align-items: center;
90
- transition: all var(--transition);
91
- }
107
+ &__input-wrapper {
108
+ display: flex;
109
+ align-items: center;
92
110
 
93
- &__text {
94
- white-space: nowrap;
95
- overflow: hidden;
96
- text-overflow: ellipsis;
111
+ .base-tag__input {
112
+ border: none;
113
+ background: transparent;
114
+ outline: none;
115
+ color: var(--primary-blue);
97
116
  }
117
+ }
98
118
 
99
- &__icon {
100
- display: flex;
101
- align-items: center;
102
- justify-content: center;
103
- margin-left: var(--spacing-xs);
104
- }
119
+ &.--primary-color {
120
+ .base-tag__wrapper {
121
+ background: var(--primary-black-100);
122
+ color: var(--primary-black-700);
105
123
 
106
- &__input-wrapper {
107
- display: flex;
108
- align-items: center;
124
+ @include hover {
125
+ background: var(--primary-black-200);
126
+ color: var(--primary-black-900);
109
127
 
110
- .base-tag__input {
111
- border: none;
112
- background: transparent;
113
- outline: none;
114
- color: var(--primary-blue);
128
+ .base-tag__icon {
129
+ color: var(--primary-black-900);
115
130
  }
131
+ }
116
132
  }
117
133
 
118
- &.--primary-color {
119
- .base-tag__wrapper {
120
- background: var(--primary-black-100);
121
- color: var(--primary-black-700);
134
+ .base-tag__icon {
135
+ color: var(--primary-black-500);
136
+ }
137
+ }
122
138
 
123
- @include hover {
124
- background: var(--primary-black-200);
125
- color: var(--primary-black-900);
139
+ &.--secondary-color {
140
+ .base-tag__wrapper {
141
+ background: var(--primary-black-white);
142
+ color: var(--primary-black-700); // same
126
143
 
127
- .base-tag__icon {
128
- color: var(--primary-black-900);
129
- }
130
- }
131
- }
144
+ @include hover {
145
+ background: var(--primary-black-200);
146
+ color: var(--primary-black-900);
132
147
 
133
148
  .base-tag__icon {
134
- color: var(--primary-black-500);
149
+ color: var(--primary-black-900);
135
150
  }
151
+ }
136
152
  }
137
153
 
138
- &.--secondary-color {
139
- .base-tag__wrapper {
140
- background: var(--primary-black-white);
141
- color: var(--primary-black-700); // same
154
+ .base-tag__icon {
155
+ color: var(--primary-black-500);
156
+ }
157
+ }
142
158
 
143
- @include hover {
144
- background: var(--primary-black-200);
145
- color: var(--primary-black-900);
159
+ &.--adding-tag {
160
+ .base-tag__wrapper {
161
+ color: var(--primary-black-500);
146
162
 
147
- .base-tag__icon {
148
- color: var(--primary-black-900);
149
- }
150
- }
151
- }
163
+ @include hover {
164
+ color: var(--primary-black-900);
152
165
 
153
166
  .base-tag__icon {
154
- color: var(--primary-black-500);
167
+ color: var(--primary-black-900);
155
168
  }
169
+ }
156
170
  }
171
+ }
157
172
 
158
- &.--adding-tag {
159
- .base-tag__wrapper {
160
- color: var(--primary-black-500);
161
173
 
162
- @include hover {
163
- color: var(--primary-black-900);
164
-
165
- .base-tag__icon {
166
- color: var(--primary-black-900);
167
- }
168
- }
169
- }
174
+ &.--extra-small-size {
175
+ .base-tag__text,
176
+ .base-tag__input {
177
+ font: var(--typography-text-xs-medium);
170
178
  }
171
179
 
180
+ .base-tag__wrapper {
181
+ border-radius: var(--corner-radius-xxs);
182
+ padding: var(--spacing-2xs) var(--spacing-s);
183
+ }
172
184
 
173
- &.--extra-small-size {
174
- .base-tag__text,
175
- .base-tag__input {
176
- font: var(--typography-text-xs-medium);
177
- }
178
-
179
- .base-tag__wrapper {
180
- border-radius: var(--corner-radius-xxs);
181
- padding: var(--spacing-2xs) var(--spacing-s);
182
- }
183
-
184
- .base-tag__icon,
185
- .base-tag__add-icon {
186
- width: 12px;
187
- height: 12px;
188
- }
185
+ .base-tag__icon,
186
+ .base-tag__add-icon {
187
+ width: 12px;
188
+ height: 12px;
189
+ margin-top: 4px;
189
190
  }
191
+ }
190
192
 
191
- &.--small-size {
192
- .base-tag__text,
193
- .base-tag__input {
194
- font: var(--typography-text-s-medium);
195
- }
193
+ &.--small-size {
194
+ .base-tag__text,
195
+ .base-tag__input {
196
+ font: var(--typography-text-s-medium);
197
+ }
196
198
 
197
- .base-tag__wrapper {
198
- border-radius: var(--corner-radius-xxs);
199
- padding: var(--spacing-2xs) var(--spacing-s);
200
- }
199
+ .base-tag__wrapper {
200
+ border-radius: var(--corner-radius-xxs);
201
+ padding: var(--spacing-2xs) var(--spacing-s);
202
+ }
201
203
 
202
- .base-tag__icon,
203
- .base-tag__add-icon {
204
- width: 14px;
205
- height: 14px;
206
- }
204
+ .base-tag__icon,
205
+ .base-tag__add-icon {
206
+ width: 14px;
207
+ height: 14px;
208
+ margin-top: 4px;
207
209
  }
210
+ }
208
211
 
209
- &.--medium-size {
210
- .base-tag__text,
211
- .base-tag__input {
212
- font: var(--typography-text-s-medium);
213
- }
212
+ &.--medium-size {
213
+ .base-tag__text,
214
+ .base-tag__input {
215
+ font: var(--typography-text-s-medium);
216
+ }
214
217
 
215
- .base-tag__wrapper {
216
- border-radius: var(--corner-radius-2xs);
217
- padding: var(--spacing-xs) var(--spacing-2m);
218
- }
218
+ .base-tag__wrapper {
219
+ border-radius: var(--corner-radius-2xs);
220
+ padding: var(--spacing-xs) var(--spacing-2m);
221
+ }
219
222
 
220
- .base-tag__icon,
221
- .base-tag__add-icon {
222
- width: 16px;
223
- height: 16px;
224
- }
223
+ .base-tag__icon,
224
+ .base-tag__add-icon {
225
+ width: 16px;
226
+ height: 16px;
225
227
  }
228
+ }
226
229
 
227
- &.--large-size {
228
- .base-tag__text,
229
- .base-tag__input {
230
- font: var(--typography-text-m-medium);
231
- }
230
+ &.--large-size {
231
+ .base-tag__text,
232
+ .base-tag__input {
233
+ font: var(--typography-text-m-medium);
234
+ }
232
235
 
233
- .base-tag__wrapper {
234
- border-radius: var(--corner-radius-2xs);
235
- padding: var(--spacing-xs) var(--spacing-2m);
236
- }
236
+ .base-tag__wrapper {
237
+ border-radius: var(--corner-radius-2xs);
238
+ padding: var(--spacing-xs) var(--spacing-2m);
239
+ }
237
240
 
238
- .base-tag__icon,
239
- .base-tag__add-icon {
240
- width: 16px;
241
- height: 16px;
242
- }
241
+ .base-tag__icon,
242
+ .base-tag__add-icon {
243
+ width: 16px;
244
+ height: 16px;
243
245
  }
246
+ }
244
247
  }
245
248
  </style>
@@ -286,6 +286,18 @@ const getImagePreview = (file: File) => {
286
286
  watch(uploadedFiles, (newFiles) => {
287
287
  emit('update:files', newFiles);
288
288
  }, { deep: true });
289
+
290
+ watch(() => props.files,
291
+ (newFiles) => {
292
+ if(!newFiles) return;
293
+
294
+ uploadedFiles.value = [...newFiles];
295
+ },
296
+ {
297
+ immediate: true,
298
+ deep: true,
299
+ }
300
+ )
289
301
  </script>
290
302
 
291
303
  <style lang="scss" scoped>
@@ -17,4 +17,5 @@ export interface IpropsUpload {
17
17
  cropTexts?: CropTexts; // Тексты для кнопок в модальном окне кропа
18
18
  onUpload?: (files: UploadedFile[]) => void; // Callback при загрузке файлов
19
19
  onError?: (error: string) => void; // Callback при ошибке загрузки
20
+ files?: UploadedFile[];
20
21
  }