@volverjs/ui-vue 0.0.10-beta.45 → 0.0.10-beta.47

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 (54) hide show
  1. package/dist/components/VvAvatar/VvAvatar.es.js +1 -6
  2. package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
  3. package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +2 -7
  4. package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
  5. package/dist/components/VvBadge/VvBadge.es.js +1 -6
  6. package/dist/components/VvBadge/VvBadge.umd.js +1 -1
  7. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +1 -6
  8. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  9. package/dist/components/VvButton/VvButton.es.js +0 -22
  10. package/dist/components/VvButton/VvButton.umd.js +1 -1
  11. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -6
  12. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  13. package/dist/components/VvCard/VvCard.es.js +1 -6
  14. package/dist/components/VvCard/VvCard.umd.js +1 -1
  15. package/dist/components/VvCheckbox/VvCheckbox.es.js +0 -22
  16. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  17. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +0 -22
  18. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  19. package/dist/components/VvCombobox/VvCombobox.es.js +0 -22
  20. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  21. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +18 -18
  22. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +8 -8
  23. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +0 -5
  24. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  25. package/dist/components/VvIcon/VvIcon.es.js +1 -6
  26. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  27. package/dist/components/VvInputFile/VvInputFile.es.js +10 -26
  28. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  29. package/dist/components/VvInputText/VvInputText.es.js +19 -4
  30. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  31. package/dist/components/VvInputText/VvInputText.vue.d.ts +3 -3
  32. package/dist/components/VvNav/VvNav.es.js +0 -5
  33. package/dist/components/VvNav/VvNav.umd.js +1 -1
  34. package/dist/components/VvRadio/VvRadio.es.js +0 -22
  35. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  36. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +0 -22
  37. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  38. package/dist/components/VvSelect/VvSelect.vue.d.ts +2 -2
  39. package/dist/components/VvTab/VvTab.es.js +0 -5
  40. package/dist/components/VvTab/VvTab.umd.js +1 -1
  41. package/dist/components/index.es.js +29 -30
  42. package/dist/components/index.umd.js +1 -1
  43. package/dist/composables/alert/useAlert.d.ts +46 -46
  44. package/dist/composables/index.es.js +4 -4
  45. package/dist/composables/index.umd.js +1 -1
  46. package/dist/icons.es.js +3 -3
  47. package/dist/icons.umd.js +1 -1
  48. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +20 -20
  49. package/package.json +36 -36
  50. package/src/assets/icons/detailed.json +1 -1
  51. package/src/assets/icons/normal.json +1 -1
  52. package/src/assets/icons/simple.json +1 -1
  53. package/src/components/VvInputFile/VvInputFile.vue +10 -4
  54. package/src/components/VvInputText/VvInputText.vue +21 -7
@@ -224,11 +224,17 @@ onBeforeUnmount(() => {
224
224
  }
225
225
  })
226
226
 
227
- function sizeInKiB(size?: number) {
228
- if (!size) {
227
+ function formatBytes(bytes?: number, decimals?: number) {
228
+ if (!bytes) {
229
229
  return
230
230
  }
231
- return Math.floor(size / 1024)
231
+ if (bytes === 0)
232
+ return '0 Bytes'
233
+ const k = 1024
234
+ const dm = !decimals ? 2 : decimals <= 0 ? 0 : decimals
235
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
236
+ const i = Math.floor(Math.log(bytes) / Math.log(k))
237
+ return `${Number.parseFloat((bytes / (k ** i)).toFixed(dm))} ${sizes[i]}`
232
238
  }
233
239
 
234
240
  function onClickDownloadFile(file: File | UploadedFile) {
@@ -376,7 +382,7 @@ export default {
376
382
  {{ file.name }}
377
383
  </div>
378
384
  <small class="vv-input-file__item-info">
379
- {{ sizeInKiB(file.size) }} KB
385
+ {{ formatBytes(file.size) }}
380
386
  </small>
381
387
  <button
382
388
  v-if="!readonly"
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import type { InputHTMLAttributes } from 'vue'
3
3
  import { useIMask } from 'vue-imask'
4
+ import type { MaskedNumberOptions } from 'imask'
4
5
  import HintSlotFactory from '../common/HintSlot'
5
6
  import VvIcon from '../VvIcon/VvIcon.vue'
6
7
  import { ACTION_ICONS } from '../VvIcon'
@@ -66,10 +67,24 @@ const NEGATIVE_ZERO_REGEX = /^-0?[.,]?[0*]?$/
66
67
  const maskReady = ref(false)
67
68
  const { el, mask, typed, masked, unmasked } = useIMask(
68
69
  computed(
69
- () =>
70
- props.iMask ?? {
71
- mask: /./,
72
- },
70
+ () => {
71
+ if (!props.iMask) {
72
+ return {
73
+ mask: /./,
74
+ }
75
+ }
76
+ if (props.iMask.mask === Number) {
77
+ const toReturn = { ...props.iMask } as MaskedNumberOptions
78
+ if (props.min) {
79
+ toReturn.min = Number(props.min)
80
+ }
81
+ if (props.max) {
82
+ toReturn.max = Number(props.max)
83
+ }
84
+ return toReturn
85
+ }
86
+ return props.iMask
87
+ },
73
88
  ),
74
89
  {
75
90
  emit,
@@ -269,7 +284,7 @@ const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER)
269
284
  function onStepUp() {
270
285
  if (isClickable.value) {
271
286
  if (props.iMask) {
272
- typed.value = typed.value + Number(step?.value ?? 1)
287
+ typed.value = Number(typed.value) + Number(step?.value ?? 1)
273
288
  return
274
289
  }
275
290
  inputEl.value.stepUp()
@@ -279,8 +294,7 @@ function onStepUp() {
279
294
  function onStepDown() {
280
295
  if (isClickable.value) {
281
296
  if (props.iMask) {
282
- typed.value = typed.value - Number(step?.value ?? 1)
283
-
297
+ typed.value = Number(typed.value) - Number(step?.value ?? 1)
284
298
  return
285
299
  }
286
300
  inputEl.value.stepDown()