@volverjs/ui-vue 0.0.10-beta.58 → 0.0.10-beta.59

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 (88) hide show
  1. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +2 -2
  2. package/dist/components/VvAccordion/index.d.ts +2 -2
  3. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +10 -10
  4. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +14 -14
  6. package/dist/components/VvAccordionGroup/index.d.ts +5 -5
  7. package/dist/components/VvAction/VvAction.vue.d.ts +2 -2
  8. package/dist/components/VvAction/index.d.ts +1 -1
  9. package/dist/components/VvAlert/VvAlert.vue.d.ts +8 -8
  10. package/dist/components/VvAlert/index.d.ts +3 -4
  11. package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +11 -11
  12. package/dist/components/VvAlertGroup/index.d.ts +5 -5
  13. package/dist/components/VvAvatar/VvAvatar.vue.d.ts +2 -2
  14. package/dist/components/VvAvatar/index.d.ts +1 -1
  15. package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +6 -6
  16. package/dist/components/VvAvatarGroup/index.d.ts +3 -3
  17. package/dist/components/VvBadge/VvBadge.vue.d.ts +2 -2
  18. package/dist/components/VvBadge/index.d.ts +1 -1
  19. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +15 -15
  20. package/dist/components/VvBreadcrumb/index.d.ts +2 -2
  21. package/dist/components/VvButton/VvButton.vue.d.ts +8 -8
  22. package/dist/components/VvButton/index.d.ts +2 -2
  23. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +6 -6
  24. package/dist/components/VvButtonGroup/index.d.ts +3 -3
  25. package/dist/components/VvCard/VvCard.vue.d.ts +2 -2
  26. package/dist/components/VvCard/index.d.ts +1 -1
  27. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +3 -3
  28. package/dist/components/VvCheckbox/index.d.ts +1 -1
  29. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +6 -6
  30. package/dist/components/VvCheckboxGroup/index.d.ts +2 -2
  31. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +560 -219
  32. package/dist/components/VvCombobox/index.d.ts +241 -21
  33. package/dist/components/VvDialog/VvDialog.vue.d.ts +2 -2
  34. package/dist/components/VvDialog/index.d.ts +1 -1
  35. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +272 -37
  36. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +8 -16
  37. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +2 -2
  38. package/dist/components/VvDropdown/index.d.ts +117 -9
  39. package/dist/components/VvIcon/VvIcon.vue.d.ts +1 -1
  40. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +19 -19
  41. package/dist/components/VvInputFile/index.d.ts +8 -8
  42. package/dist/components/VvInputText/VvInputClearAction.d.ts +3 -3
  43. package/dist/components/VvInputText/VvInputPasswordAction.d.ts +5 -5
  44. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  45. package/dist/components/VvInputText/VvInputText.es.js +16 -16
  46. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  47. package/dist/components/VvInputText/VvInputText.vue.d.ts +21 -21
  48. package/dist/components/VvInputText/index.d.ts +24 -7
  49. package/dist/components/VvNav/VvNav.vue.d.ts +13 -13
  50. package/dist/components/VvNav/index.d.ts +2 -2
  51. package/dist/components/VvProgress/VvProgress.vue.d.ts +2 -2
  52. package/dist/components/VvProgress/index.d.ts +1 -1
  53. package/dist/components/VvRadio/VvRadio.vue.d.ts +3 -3
  54. package/dist/components/VvRadio/index.d.ts +1 -1
  55. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +6 -6
  56. package/dist/components/VvRadioGroup/index.d.ts +2 -2
  57. package/dist/components/VvSelect/VvSelect.vue.d.ts +183 -62
  58. package/dist/components/VvSelect/index.d.ts +8 -8
  59. package/dist/components/VvTab/VvTab.vue.d.ts +15 -15
  60. package/dist/components/VvTab/index.d.ts +3 -3
  61. package/dist/components/VvTextarea/VvTextarea.es.js +10 -10
  62. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  63. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +11 -11
  64. package/dist/components/VvTextarea/index.d.ts +9 -6
  65. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +4 -4
  66. package/dist/components/VvTooltip/index.d.ts +1 -1
  67. package/dist/components/index.es.js +16 -16
  68. package/dist/components/index.umd.js +1 -1
  69. package/dist/composables/alert/useAlert.d.ts +12 -12
  70. package/dist/composables/dropdown/useDropdownContextmenu.d.ts +1 -1
  71. package/dist/composables/dropdown/useDropdownVirtualElement.d.ts +1 -1
  72. package/dist/composables/group/useGroupStateInject.d.ts +1 -1
  73. package/dist/composables/useBlurhash.d.ts +1 -1
  74. package/dist/composables/useOptions.d.ts +3 -3
  75. package/dist/composables/usePersistence.d.ts +1 -1
  76. package/dist/icons.es.js +3 -3
  77. package/dist/icons.umd.js +1 -1
  78. package/dist/props/index.d.ts +121 -14
  79. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +362 -298
  80. package/dist/test/expect.d.ts +1 -0
  81. package/dist/utils/DateUtilities.d.ts +9 -0
  82. package/dist/utils/ObjectUtilities.d.ts +1 -1
  83. package/package.json +30 -30
  84. package/src/assets/icons/detailed.json +1 -1
  85. package/src/assets/icons/normal.json +1 -1
  86. package/src/assets/icons/simple.json +1 -1
  87. package/src/composables/usePersistence.ts +13 -12
  88. package/src/utils/DateUtilities.ts +24 -7
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'vue'
2
2
  import { StorageType } from '@/constants'
3
- import { computed, isRef, ref, unref, watch } from 'vue'
3
+ import { isRef, ref, unref, watch } from 'vue'
4
4
 
5
5
  export function usePersistence<T>(storageKey: Ref<string | undefined> | undefined, storageType: Ref<`${StorageType}`> | `${StorageType}` = StorageType.local, defaultValue?: T) {
6
6
  const localValue: Ref<T | undefined> = ref()
@@ -26,6 +26,9 @@ export function usePersistence<T>(storageKey: Ref<string | undefined> | undefine
26
26
  storageValue?.value ?? localValue.value,
27
27
  storage,
28
28
  )
29
+ if (storageValue.value) {
30
+ localValue.value = storageValue.value
31
+ }
29
32
  return
30
33
  }
31
34
  storageValue = undefined
@@ -61,16 +64,14 @@ export function usePersistence<T>(storageKey: Ref<string | undefined> | undefine
61
64
  }
62
65
  })
63
66
 
64
- return computed<T | undefined>({
65
- get: () => {
66
- return storageValue?.value ?? localValue.value
67
- },
68
- set: (value) => {
69
- if (storageValue) {
70
- storageValue.value = value
71
- return
72
- }
73
- localValue.value = value
74
- },
67
+ watch(localValue, (newValue) => {
68
+ if (storageValue) {
69
+ storageValue.value = newValue
70
+ }
71
+ }, {
72
+ deep: true,
73
+ immediate: true,
75
74
  })
75
+
76
+ return localValue
76
77
  }
@@ -1,7 +1,18 @@
1
+ /**
2
+ * Pads a number with leading zero if less than 10
3
+ * @param num - Number to pad
4
+ * @returns Padded number as string
5
+ * @example
6
+ * padTwoDigits(5) // '05'
7
+ */
8
+ const padTwoDigits = (num: number) => num.toString().padStart(2, '0')
9
+
1
10
  /**
2
11
  * Checks if a string is a valid ISO date string
3
12
  * @param dateString
4
13
  * @returns True if valid ISO date string
14
+ * @example
15
+ * isDateIsoString('2021-12-31T23:59:59') // true
5
16
  */
6
17
  export function isDateIsoString(dateString: unknown) {
7
18
  if (typeof dateString !== 'string') {
@@ -21,6 +32,10 @@ export function isDateIsoString(dateString: unknown) {
21
32
  * @param typeOfInput - Type of HTML input element
22
33
  * @param withSeconds - Include seconds in time value
23
34
  * @returns String value for input element
35
+ * @example
36
+ * getInputValueFromDate(new Date(), 'date') // '2021-12-31'
37
+ * getInputValueFromDate(new Date(), 'time') // '23:59'
38
+ * getInputValueFromDate(new Date(), 'datetime-local') // '2021-12-31T23:59'
24
39
  */
25
40
  export function getInputValueFromDate(date: Date | string, typeOfInput: 'date' | 'time' | 'month' | 'datetime-local' = 'date', withSeconds?: boolean) {
26
41
  if (typeof date === 'string') {
@@ -32,18 +47,17 @@ export function getInputValueFromDate(date: Date | string, typeOfInput: 'date' |
32
47
  if (Number.isNaN(currentDate.getTime())) {
33
48
  return ''
34
49
  }
35
- const span = (num: number) => num.toString().padStart(2, '0')
36
- let toReturn = `${currentDate.getFullYear()}-${span(currentDate.getMonth() + 1)}`
50
+ let toReturn = `${currentDate.getFullYear()}-${padTwoDigits(currentDate.getMonth() + 1)}`
37
51
  if (typeOfInput === 'month') {
38
52
  return toReturn
39
53
  }
40
- toReturn += `-${span(currentDate.getDate())}`
54
+ toReturn += `-${padTwoDigits(currentDate.getDate())}`
41
55
  if (typeOfInput === 'date') {
42
56
  return toReturn
43
57
  }
44
58
  const time = withSeconds
45
- ? `${span(currentDate.getHours())}:${span(currentDate.getMinutes())}:${span(currentDate.getSeconds())}`
46
- : `${span(currentDate.getHours())}:${span(currentDate.getMinutes())}`
59
+ ? `${padTwoDigits(currentDate.getHours())}:${padTwoDigits(currentDate.getMinutes())}:${padTwoDigits(currentDate.getSeconds())}`
60
+ : `${padTwoDigits(currentDate.getHours())}:${padTwoDigits(currentDate.getMinutes())}`
47
61
  if (typeOfInput === 'time') {
48
62
  return time
49
63
  }
@@ -56,6 +70,9 @@ export function getInputValueFromDate(date: Date | string, typeOfInput: 'date' |
56
70
  * @param typeOfInput - Type of HTML input element
57
71
  * @returns Date object or null if invalid
58
72
  * @throws Error for invalid input format
73
+ * @example
74
+ * getDateFromInputValue('2021-12-31', 'date') // Date('2021-12-31T00:00:00')
75
+ * getDateFromInputValue('23:59', 'time') // Date('2021-12-31T23:59:00')
59
76
  */
60
77
  export function getDateFromInputValue(value: string, typeOfInput: 'date' | 'time' | 'month' | 'datetime-local' = 'date') {
61
78
  if (!value?.trim()) {
@@ -84,9 +101,9 @@ export function getDateFromInputValue(value: string, typeOfInput: 'date' | 'time
84
101
  throw new Error('Invalid time format. Expected: HH:mm or HH:mm:ss')
85
102
  }
86
103
  if (value.length === 8) {
87
- return new Date(`${currentYear}-${currentMonth + 1}-${currentDate}T${value}`)
104
+ return new Date(`${currentYear}-${padTwoDigits(currentMonth + 1)}-${padTwoDigits(currentDate)}T${value}`)
88
105
  }
89
- return new Date(`${currentYear}-${currentMonth + 1}-${currentDate}T${value}:00`)
106
+ return new Date(`${currentYear}-${padTwoDigits(currentMonth + 1)}-${padTwoDigits(currentDate)}T${value}:00`)
90
107
  }
91
108
  if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2})?$/.test(value)) {
92
109
  throw new Error('Invalid datetime format. Expected: YYYY-MM-DDThh:mm or YYYY-MM-DDThh:mm:ss')