@antify/ui 2.5.7 → 3.0.0

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 (37) hide show
  1. package/dist/components/AntAccordion.vue +5 -6
  2. package/dist/components/AntAccordionItem.vue +5 -7
  3. package/dist/components/AntAlert.vue +53 -54
  4. package/dist/components/AntButton.vue +60 -62
  5. package/dist/components/AntCard.vue +10 -11
  6. package/dist/components/AntIcon.vue +8 -8
  7. package/dist/components/AntKeycap.vue +15 -15
  8. package/dist/components/AntListGroup.vue +10 -10
  9. package/dist/components/AntModal.vue +5 -5
  10. package/dist/components/AntPagination.vue +38 -40
  11. package/dist/components/AntSkeleton.vue +5 -25
  12. package/dist/components/__stories/AntListGroup.stories.js +6 -9
  13. package/dist/components/__stories/AntListGroup.stories.mjs +6 -9
  14. package/dist/components/__stories/AntListGroupItem.stories.js +1 -1
  15. package/dist/components/__stories/AntListGroupItem.stories.mjs +1 -1
  16. package/dist/components/inputs/AntCheckbox.vue +8 -9
  17. package/dist/components/inputs/AntColorInput/AntColorInput.vue +5 -10
  18. package/dist/components/inputs/AntImageInput.vue +34 -36
  19. package/dist/components/inputs/AntRadio.vue +8 -9
  20. package/dist/components/inputs/AntSelect.vue +64 -63
  21. package/dist/components/inputs/AntSwitch.vue +26 -27
  22. package/dist/components/inputs/AntSwitcher.vue +12 -11
  23. package/dist/components/inputs/AntTagInput.vue +6 -10
  24. package/dist/components/inputs/AntTextarea.vue +5 -9
  25. package/dist/components/inputs/Elements/AntBaseInput.vue +60 -60
  26. package/dist/components/inputs/__stories/AntCheckbox.stories.js +41 -14
  27. package/dist/components/inputs/__stories/AntCheckbox.stories.mjs +41 -14
  28. package/dist/components/table/AntTable.vue +11 -7
  29. package/dist/components/table/AntTableSkeleton.vue +5 -1
  30. package/dist/components/tabs/AntTabItem.vue +5 -7
  31. package/dist/composables/index.d.ts +1 -0
  32. package/dist/composables/index.js +11 -0
  33. package/dist/composables/index.mjs +1 -0
  34. package/dist/composables/useFlickerProtection.d.ts +22 -0
  35. package/dist/composables/useFlickerProtection.js +48 -0
  36. package/dist/composables/useFlickerProtection.mjs +48 -0
  37. package/package.json +1 -1
@@ -197,25 +197,24 @@ onMounted(() => {
197
197
  </div>
198
198
 
199
199
  <AntSkeleton
200
- v-if="skeleton"
200
+ :visible="skeleton"
201
201
  absolute
202
202
  rounded
203
203
  />
204
204
  </div>
205
205
 
206
206
  <div
207
- class="relative flex items-center"
207
+ class="flex items-center"
208
208
  :class="props.size === Size.md ? 'h-5' : 'h-4'"
209
209
  >
210
- <span :class="contentClasses">
211
- <slot />
212
- </span>
213
-
214
210
  <AntSkeleton
215
- v-if="skeleton"
216
- absolute
211
+ :visible="skeleton"
217
212
  rounded
218
- />
213
+ >
214
+ <span :class="contentClasses">
215
+ <slot />
216
+ </span>
217
+ </AntSkeleton>
219
218
  </div>
220
219
  </div>
221
220
  </AntField>
@@ -181,8 +181,10 @@ onMounted(() => {
181
181
  <div
182
182
  :class="containerClasses"
183
183
  >
184
- <div
185
- class="relative"
184
+ <AntSkeleton
185
+ :visible="skeleton"
186
+ :grouped="hasRemoveButton ? Grouped.left : Grouped.none"
187
+ rounded
186
188
  >
187
189
  <div
188
190
  ref="itemRef"
@@ -198,14 +200,7 @@ onMounted(() => {
198
200
  readonly
199
201
  />
200
202
  </div>
201
-
202
- <AntSkeleton
203
- v-if="skeleton"
204
- absolute
205
- :grouped="hasRemoveButton ? Grouped.left : Grouped.none"
206
- rounded
207
- />
208
- </div>
203
+ </AntSkeleton>
209
204
 
210
205
  <AntButton
211
206
  v-if="hasRemoveButton"
@@ -160,36 +160,35 @@ onBeforeUnmount(() => {
160
160
  :class="{'cursor-pointer': !disabled && !skeleton}"
161
161
  >
162
162
  <div>
163
- <div class="h-[70px] w-[70px] bg-gray-100 rounded-full overflow-hidden flex items-center justify-center relative">
164
- <img
165
- v-if="src && !skeleton"
166
- :src="src"
167
- alt="Image"
168
- class="h-full w-full object-cover"
169
- >
170
-
171
- <AntIcon
172
- v-else
173
- class="text-base-300"
174
- :size="IconSize.xl3"
175
- :icon="faImage"
176
- />
163
+ <AntSkeleton
164
+ :visible="skeleton"
165
+ rounded-full
166
+ >
167
+ <div class="h-[70px] w-[70px] bg-gray-100 rounded-full overflow-hidden flex items-center justify-center">
168
+ <img
169
+ v-if="src"
170
+ :src="src"
171
+ alt="Image"
172
+ class="h-full w-full object-cover"
173
+ >
177
174
 
178
- <div
179
- v-if="loading"
180
- class="absolute flex items-center justify-center inset-0 bg-base-600/50 rounded-full"
181
- >
182
- <AntSpinner
183
- :state="State.primary"
175
+ <AntIcon
176
+ v-else
177
+ class="text-base-300"
178
+ :size="IconSize.xl3"
179
+ :icon="faImage"
184
180
  />
185
- </div>
186
181
 
187
- <AntSkeleton
188
- v-if="skeleton"
189
- absolute
190
- rounded-full
191
- />
192
- </div>
182
+ <div
183
+ v-if="loading"
184
+ class="absolute flex items-center justify-center inset-0 bg-base-600/50 rounded-full"
185
+ >
186
+ <AntSpinner
187
+ :state="State.primary"
188
+ />
189
+ </div>
190
+ </div>
191
+ </AntSkeleton>
193
192
  </div>
194
193
 
195
194
  <div class="flex flex-col gap-2.5 w-full">
@@ -204,15 +203,14 @@ onBeforeUnmount(() => {
204
203
  @change="handleFileChange"
205
204
  >
206
205
 
207
- <span class="text-sm text-for-white-bg-font relative">
208
- Upload Image
209
-
210
- <AntSkeleton
211
- v-if="skeleton"
212
- absolute
213
- rounded
214
- />
215
- </span>
206
+ <AntSkeleton
207
+ :visible="skeleton"
208
+ rounded
209
+ >
210
+ <span class="text-sm text-for-white-bg-font">
211
+ Upload Image
212
+ </span>
213
+ </AntSkeleton>
216
214
 
217
215
  <div
218
216
  class="absolute top-0 left-0 w-full h-full border bg-transparent"
@@ -201,25 +201,24 @@ onMounted(() => {
201
201
  >
202
202
 
203
203
  <AntSkeleton
204
- v-if="skeleton"
204
+ :visible="skeleton"
205
205
  absolute
206
206
  rounded-full
207
207
  />
208
208
  </div>
209
209
 
210
210
  <div
211
- class="relative flex items-center"
211
+ class="flex items-center"
212
212
  :class="valueSize"
213
213
  >
214
- <span :class="valueClass">
215
- {{ value.label }}
216
- </span>
217
-
218
214
  <AntSkeleton
219
- v-if="skeleton"
220
- absolute
215
+ :visible="skeleton"
221
216
  rounded
222
- />
217
+ >
218
+ <span :class="valueClass">
219
+ {{ value.label }}
220
+ </span>
221
+ </AntSkeleton>
223
222
  </div>
224
223
  </div>
225
224
  </AntField>
@@ -260,13 +260,6 @@ function onClickRemoveButton() {
260
260
  class="relative w-full"
261
261
  :class="{'cursor-pointer': !skeleton && !readonly}"
262
262
  >
263
- <AntSkeleton
264
- v-if="skeleton"
265
- absolute
266
- rounded
267
- :grouped="skeletonGrouped"
268
- />
269
-
270
263
  <input
271
264
  v-model="_modelValue"
272
265
  type="hidden"
@@ -297,70 +290,78 @@ function onClickRemoveButton() {
297
290
  v-bind="{...props}"
298
291
  />
299
292
  </template>
300
- <!-- Input -->
301
- <div
302
- ref="inputRef"
303
- :class="inputClasses"
304
- :tabindex="disabled || readonly ? -1 : 0"
305
- v-bind="$attrs"
306
- @mousedown="onClickSelectInput"
307
- @click="() => inputRef?.focus()"
308
- @blur="onBlur"
293
+
294
+ <AntSkeleton
295
+ :visible="skeleton"
296
+ rounded
297
+ :grouped="skeletonGrouped"
298
+ class="w-full"
309
299
  >
300
+ <!-- Input -->
310
301
  <div
311
- v-if="_modelValue === null && placeholder !== undefined"
312
- :class="placeholderClasses"
302
+ ref="inputRef"
303
+ :class="inputClasses"
304
+ :tabindex="disabled || readonly ? -1 : 0"
305
+ v-bind="$attrs"
306
+ @mousedown="onClickSelectInput"
307
+ @click="() => inputRef?.focus()"
308
+ @blur="onBlur"
313
309
  >
314
- {{ placeholder }}
315
- </div>
310
+ <div
311
+ v-if="_modelValue === null && placeholder !== undefined"
312
+ :class="placeholderClasses"
313
+ >
314
+ {{ placeholder }}
315
+ </div>
316
316
 
317
- <div
318
- v-else-if="_modelValue === null && label !== undefined"
319
- :class="placeholderClasses"
320
- >
321
- {{ label }}
322
- </div>
317
+ <div
318
+ v-else-if="_modelValue === null && label !== undefined"
319
+ :class="placeholderClasses"
320
+ >
321
+ {{ label }}
322
+ </div>
323
323
 
324
- <div
325
- v-else
326
- class="flex items-center select-none overflow-hidden w-full"
327
- :class="{
328
- 'gap-1': size === Size.xs2,
329
- 'gap1.5': size === Size.xs,
330
- 'gap-1.5': size === Size.sm,
331
- 'gap-2': size === Size.md,
332
- 'gap-2.5': size === Size.lg,
333
- }"
334
- >
335
- <slot
336
- v-if="selectedOption !== null"
337
- name="contentLeft"
338
- v-bind="selectedOption"
339
- />
340
- <div class="text-ellipsis overflow-hidden whitespace-nowrap w-full text-black">
341
- {{ valueLabel }}
324
+ <div
325
+ v-else
326
+ class="flex items-center select-none overflow-hidden w-full"
327
+ :class="{
328
+ 'gap-1': size === Size.xs2,
329
+ 'gap1.5': size === Size.xs,
330
+ 'gap-1.5': size === Size.sm,
331
+ 'gap-2': size === Size.md,
332
+ 'gap-2.5': size === Size.lg,
333
+ }"
334
+ >
335
+ <slot
336
+ v-if="selectedOption !== null"
337
+ name="contentLeft"
338
+ v-bind="selectedOption"
339
+ />
340
+ <div class="text-ellipsis overflow-hidden whitespace-nowrap w-full text-black">
341
+ {{ valueLabel }}
342
+ </div>
343
+ <slot
344
+ v-if="selectedOption !== null"
345
+ name="contentRight"
346
+ v-bind="selectedOption"
347
+ />
342
348
  </div>
343
- <slot
344
- v-if="selectedOption !== null"
345
- name="contentRight"
346
- v-bind="selectedOption"
347
- />
348
- </div>
349
349
 
350
- <AntIcon
351
- v-if="isOpen"
352
- :icon="faChevronUp"
353
- :size="iconSize"
354
- :class="arrowClasses"
355
- />
350
+ <AntIcon
351
+ v-if="isOpen"
352
+ :icon="faChevronUp"
353
+ :size="iconSize"
354
+ :class="arrowClasses"
355
+ />
356
356
 
357
- <AntIcon
358
- v-else
359
- :icon="faChevronDown"
360
- :size="iconSize"
361
- :class="arrowClasses"
362
- />
363
- </div>
357
+ <AntIcon
358
+ v-else
359
+ :icon="faChevronDown"
360
+ :size="iconSize"
361
+ :class="arrowClasses"
362
+ />
363
+ </div>
364
+ </AntSkeleton>
364
365
  </AntSelectMenu>
365
366
  </div>
366
367
 
@@ -157,33 +157,32 @@ function onBlur(e: FocusEvent) {
157
157
  :messages="messages"
158
158
  :expanded="false"
159
159
  >
160
- <div class="relative w-fit flex items-center gap-1.5">
161
- <div class="relative w-fit flex items-center">
162
- <button
163
- v-bind="$attrs"
164
- type="button"
165
- :class="buttonClasses"
166
- role="switch"
167
- :aria-checked="!!_value"
168
- :disabled="disabled"
169
- :tabindex="hasInputState ? -1 : 0"
170
- @click="changeValue"
171
- @blur="onBlur"
172
- >
173
- <span
174
- aria-hidden="true"
175
- :class="ballClasses"
160
+ <div class="w-fit flex items-center gap-1.5">
161
+ <AntSkeleton
162
+ :visible="skeleton"
163
+ rounded-full
164
+ >
165
+ <div class="relative w-fit flex items-center">
166
+ <button
167
+ v-bind="$attrs"
168
+ type="button"
169
+ :class="buttonClasses"
170
+ role="switch"
171
+ :aria-checked="!!_value"
172
+ :disabled="disabled"
173
+ :tabindex="hasInputState ? -1 : 0"
174
+ @click="changeValue"
175
+ @blur="onBlur"
176
176
  >
177
- <slot name="icon" />
178
- </span>
179
- </button>
180
-
181
- <AntSkeleton
182
- v-if="skeleton"
183
- absolute
184
- rounded-full
185
- />
186
- </div>
177
+ <span
178
+ aria-hidden="true"
179
+ :class="ballClasses"
180
+ >
181
+ <slot name="icon" />
182
+ </span>
183
+ </button>
184
+ </div>
185
+ </AntSkeleton>
187
186
 
188
187
  <div
189
188
  v-if="hasSlotContent($slots['default'])"
@@ -195,7 +194,7 @@ function onBlur(e: FocusEvent) {
195
194
  </span>
196
195
 
197
196
  <AntSkeleton
198
- v-if="skeleton"
197
+ :visible="skeleton"
199
198
  absolute
200
199
  rounded
201
200
  class="l-1.5"
@@ -181,18 +181,19 @@ onMounted(() => {
181
181
  @click="prevOption"
182
182
  @blur="onBlur"
183
183
  />
184
- <div class="grow relative">
185
- <div :class="itemClasses">
186
- {{ typeof _value === 'string' ? _value : _value.label }}
187
- </div>
188
184
 
189
- <AntSkeleton
190
- v-if="skeleton"
191
- absolute
192
- :grouped="Grouped.center"
193
- rounded
194
- />
195
- </div>
185
+ <AntSkeleton
186
+ :visible="skeleton"
187
+ :grouped="Grouped.center"
188
+ rounded
189
+ class="grow"
190
+ >
191
+ <div class="grow">
192
+ <div :class="itemClasses">
193
+ {{ typeof _value === 'string' ? _value : _value.label }}
194
+ </div>
195
+ </div>
196
+ </AntSkeleton>
196
197
 
197
198
  <AntButton
198
199
  :icon-left="faChevronRight"
@@ -272,16 +272,12 @@ onMounted(() => {
272
272
  :expanded="expanded"
273
273
  :messages="messages"
274
274
  >
275
- <div
276
- class="relative w-full"
275
+ <AntSkeleton
276
+ :visible="skeleton"
277
+ rounded
278
+ :grouped="skeletonGrouped"
279
+ class="w-full"
277
280
  >
278
- <AntSkeleton
279
- v-if="skeleton"
280
- absolute
281
- rounded
282
- :grouped="skeletonGrouped"
283
- />
284
-
285
281
  <div
286
282
  v-on-click-outside="onClickOutside"
287
283
  :class="inputContainerClasses"
@@ -347,7 +343,7 @@ onMounted(() => {
347
343
  </span>
348
344
  </template>
349
345
  </AntSelectMenu>
350
- </div>
346
+ </AntSkeleton>
351
347
  </AntField>
352
348
  </div>
353
349
  </template>
@@ -193,7 +193,10 @@ defineExpose({
193
193
  :messages="messages"
194
194
  :expanded-height="!resize"
195
195
  >
196
- <div
196
+ <AntSkeleton
197
+ :visible="skeleton"
198
+ :grouped="grouped"
199
+ rounded
197
200
  class="block relative w-full h-full"
198
201
  :class="{...{'-mr-px': grouped !== Grouped.none}, ..._wrapperClass}"
199
202
  >
@@ -219,13 +222,6 @@ defineExpose({
219
222
  :color="iconColor"
220
223
  />
221
224
  </div>
222
-
223
- <AntSkeleton
224
- v-if="skeleton"
225
- absolute
226
- :grouped="grouped"
227
- rounded
228
- />
229
- </div>
225
+ </AntSkeleton>
230
226
  </AntField>
231
227
  </template>
@@ -231,72 +231,72 @@ function onClickClearIcon() {
231
231
  class="block relative w-full h-fit"
232
232
  :class="_wrapperClass"
233
233
  >
234
- <div
235
- v-if="iconLeft"
236
- class="absolute h-full flex items-center justify-center z-20"
237
- :class="{
238
- 'w-6': size === Size.xs2,
239
- 'w-7': size === Size.sm,
240
- 'w-8': size === Size.xs,
241
- 'w-9': size === Size.md,
242
- 'w-10': size === Size.lg,
243
- 'opacity-50': disabled,
244
- }"
245
- >
246
- <AntIcon
247
- :icon="iconLeft"
248
- :size="inputIconSize"
249
- color="text-for-white-bg-font"
250
- />
251
- </div>
252
-
253
- <input
254
- ref="_inputRef"
255
- v-model="_modelValue"
256
- :class="inputClasses"
257
- :type="type"
258
- :placeholder="placeholder"
259
- :disabled="disabled || skeleton"
260
- :readonly="readonly"
261
- :tabindex="hasInputState ? -1 : 0"
262
- :min="min"
263
- :max="max"
264
- title=""
265
- v-bind="$attrs"
266
- @blur="onBlur"
267
- >
268
-
269
- <div
270
- v-if="(nullable && _modelValue !== null && _modelValue !== '') || (showIcon && icon) || hasSlotContent(slot['icon-right'])"
271
- class="absolute h-full flex items-center justify-center right-0 top-0 transition-all z-20"
272
- :class="{'w-6': size === Size.xs2, 'w-7': size === Size.xs, 'w-8': size === Size.sm, 'w-9': size === Size.md, 'w-10': size === Size.lg}"
234
+ <AntSkeleton
235
+ :visible="skeleton"
236
+ :grouped="grouped"
237
+ rounded
238
+ class="w-full"
273
239
  >
274
- <slot name="icon-right">
240
+ <div
241
+ v-if="iconLeft"
242
+ class="absolute h-full flex items-center justify-center z-20"
243
+ :class="{
244
+ 'w-6': size === Size.xs2,
245
+ 'w-7': size === Size.sm,
246
+ 'w-8': size === Size.xs,
247
+ 'w-9': size === Size.md,
248
+ 'w-10': size === Size.lg,
249
+ 'opacity-50': disabled,
250
+ }"
251
+ >
275
252
  <AntIcon
276
- v-if="nullable && _modelValue !== null && _modelValue !== ''"
277
- :icon="faXmark"
278
- :class="{'cursor-pointer': !disabled, ...iconClasses}"
279
- :color="iconColorClass"
253
+ :icon="iconLeft"
280
254
  :size="inputIconSize"
281
- @click="() => onClickClearIcon()"
255
+ color="text-for-white-bg-font"
282
256
  />
257
+ </div>
283
258
 
284
- <AntIcon
285
- v-else-if="showIcon && icon"
286
- :icon="icon"
287
- :color="iconColorClass"
288
- :class="iconClasses"
289
- :size="inputIconSize"
290
- />
291
- </slot>
292
- </div>
259
+ <input
260
+ ref="_inputRef"
261
+ v-model="_modelValue"
262
+ :class="inputClasses"
263
+ :type="type"
264
+ :placeholder="placeholder"
265
+ :disabled="disabled || skeleton"
266
+ :readonly="readonly"
267
+ :tabindex="hasInputState ? -1 : 0"
268
+ :min="min"
269
+ :max="max"
270
+ title=""
271
+ v-bind="$attrs"
272
+ @blur="onBlur"
273
+ >
293
274
 
294
- <AntSkeleton
295
- v-if="skeleton"
296
- absolute
297
- :grouped="grouped"
298
- rounded
299
- />
275
+ <div
276
+ v-if="(nullable && _modelValue !== null && _modelValue !== '') || (showIcon && icon) || hasSlotContent(slot['icon-right'])"
277
+ class="absolute h-full flex items-center justify-center right-0 top-0 transition-all z-20"
278
+ :class="{'w-6': size === Size.xs2, 'w-7': size === Size.xs, 'w-8': size === Size.sm, 'w-9': size === Size.md, 'w-10': size === Size.lg}"
279
+ >
280
+ <slot name="icon-right">
281
+ <AntIcon
282
+ v-if="nullable && _modelValue !== null && _modelValue !== ''"
283
+ :icon="faXmark"
284
+ :class="{'cursor-pointer': !disabled, ...iconClasses}"
285
+ :color="iconColorClass"
286
+ :size="inputIconSize"
287
+ @click="() => onClickClearIcon()"
288
+ />
289
+
290
+ <AntIcon
291
+ v-else-if="showIcon && icon"
292
+ :icon="icon"
293
+ :color="iconColorClass"
294
+ :class="iconClasses"
295
+ :size="inputIconSize"
296
+ />
297
+ </slot>
298
+ </div>
299
+ </AntSkeleton>
300
300
  </div>
301
301
  </template>
302
302