@vc-shell/framework 1.0.39 → 1.0.40

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 (212) hide show
  1. package/core/composables/usePermissions/index.ts +1 -1
  2. package/core/composables/useSettings/index.ts +31 -5
  3. package/core/types/index.ts +12 -12
  4. package/dist/core/composables/useSettings/index.d.ts +10 -1
  5. package/dist/core/composables/useSettings/index.d.ts.map +1 -1
  6. package/dist/core/types/index.d.ts.map +1 -1
  7. package/dist/framework.js +69 -69
  8. package/dist/framework.js.map +1 -1
  9. package/dist/index.d.ts +3 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/shared/blade-navigation/types/index.d.ts.map +1 -1
  12. package/dist/style.css +1 -1
  13. package/dist/tsconfig.tsbuildinfo +1 -1
  14. package/dist/ui/components/atoms/vc-badge/index.d.ts +5 -0
  15. package/dist/ui/components/atoms/vc-badge/index.d.ts.map +1 -0
  16. package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts +28 -0
  17. package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts.map +1 -0
  18. package/dist/{components → ui/components}/atoms/vc-badge/vc-badge.stories.d.ts +0 -0
  19. package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts.map +1 -0
  20. package/dist/ui/components/atoms/vc-button/index.d.ts +5 -0
  21. package/dist/ui/components/atoms/vc-button/index.d.ts.map +1 -0
  22. package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts +28 -0
  23. package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts.map +1 -0
  24. package/dist/{components → ui/components}/atoms/vc-button/vc-button.stories.d.ts +0 -0
  25. package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts.map +1 -0
  26. package/dist/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.stories.d.ts +0 -0
  27. package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -0
  28. package/dist/{components → ui/components}/atoms/vc-container/vc-container.stories.d.ts +0 -0
  29. package/dist/ui/components/atoms/vc-container/vc-container.stories.d.ts.map +1 -0
  30. package/dist/{components → ui/components}/atoms/vc-hint/vc-hint.stories.d.ts +0 -0
  31. package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts.map +1 -0
  32. package/dist/{components → ui/components}/atoms/vc-icon/vc-icon.stories.d.ts +0 -0
  33. package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts.map +1 -0
  34. package/dist/{components → ui/components}/atoms/vc-image/vc-image.stories.d.ts +0 -0
  35. package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts.map +1 -0
  36. package/dist/{components → ui/components}/atoms/vc-label/vc-label.stories.d.ts +0 -0
  37. package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts.map +1 -0
  38. package/dist/{components → ui/components}/atoms/vc-link/vc-link.stories.d.ts +0 -0
  39. package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts.map +1 -0
  40. package/dist/{components → ui/components}/atoms/vc-progress/vc-progress.stories.d.ts +0 -0
  41. package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts.map +1 -0
  42. package/dist/{components → ui/components}/atoms/vc-status/vc-status.stories.d.ts +0 -0
  43. package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts.map +1 -0
  44. package/dist/{components → ui/components}/atoms/vc-switch/vc-switch.stories.d.ts +0 -0
  45. package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -0
  46. package/dist/{components → ui/components}/index.d.ts +4 -3
  47. package/dist/ui/components/index.d.ts.map +1 -0
  48. package/dist/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts +0 -0
  49. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +1 -0
  50. package/dist/{components → ui/components}/molecules/vc-form/vc-form.stories.d.ts +0 -0
  51. package/dist/ui/components/molecules/vc-form/vc-form.stories.d.ts.map +1 -0
  52. package/dist/ui/components/molecules/vc-input/index.d.ts +5 -0
  53. package/dist/ui/components/molecules/vc-input/index.d.ts.map +1 -0
  54. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts +140 -0
  55. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts.map +1 -0
  56. package/dist/ui/components/molecules/vc-input-currency/index.d.ts +5 -0
  57. package/dist/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -0
  58. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts +124 -0
  59. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts.map +1 -0
  60. package/dist/{components → ui/components}/molecules/vc-pagination/vc-pagination.stories.d.ts +0 -0
  61. package/dist/ui/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +1 -0
  62. package/dist/{components → ui/components}/molecules/vc-rating/vc-rating.stories.d.ts +0 -0
  63. package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts.map +1 -0
  64. package/dist/ui/components/molecules/vc-select/index.d.ts +5 -0
  65. package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -0
  66. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts +207 -0
  67. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts.map +1 -0
  68. package/dist/{components → ui/components}/molecules/vc-textarea/vc-textarea.stories.d.ts +0 -0
  69. package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +1 -0
  70. package/dist/{components → ui/components}/organisms/vc-app/vc-app.stories.d.ts +0 -0
  71. package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts.map +1 -0
  72. package/dist/{components → ui/components}/organisms/vc-blade/vc-blade.stories.d.ts +0 -0
  73. package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts.map +1 -0
  74. package/dist/{components → ui/components}/organisms/vc-login-form/vc-login-form.stories.d.ts +0 -0
  75. package/dist/ui/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +1 -0
  76. package/dist/{components → ui/components}/organisms/vc-popup/vc-popup.stories.d.ts +0 -0
  77. package/dist/ui/components/organisms/vc-popup/vc-popup.stories.d.ts.map +1 -0
  78. package/dist/{components → ui/components}/organisms/vc-table/vc-table.stories.d.ts +0 -0
  79. package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -0
  80. package/dist/ui/types/index.d.ts +13 -0
  81. package/dist/ui/types/index.d.ts.map +1 -0
  82. package/dist/ui/types/ts-helpers.d.ts +13 -0
  83. package/dist/ui/types/ts-helpers.d.ts.map +1 -0
  84. package/dist/vite.config.d.ts.map +1 -1
  85. package/package.json +27 -10
  86. package/shared/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +9 -9
  87. package/shared/assets/components/assets-details/assets-details.vue +12 -12
  88. package/shared/blade-navigation/composables/useBladeNavigation/index.ts +4 -4
  89. package/shared/blade-navigation/types/index.ts +25 -25
  90. package/tailwind.config.js +4 -3
  91. package/ui/components/atoms/vc-badge/index.ts +7 -0
  92. package/ui/components/atoms/vc-badge/vc-badge-model.ts +30 -0
  93. package/{components → ui/components}/atoms/vc-badge/vc-badge.stories.ts +0 -0
  94. package/ui/components/atoms/vc-badge/vc-badge.vue +57 -0
  95. package/ui/components/atoms/vc-button/index.ts +7 -0
  96. package/ui/components/atoms/vc-button/vc-button-model.ts +30 -0
  97. package/{components → ui/components}/atoms/vc-button/vc-button.stories.ts +0 -0
  98. package/{components → ui/components}/atoms/vc-button/vc-button.vue +54 -54
  99. package/{components → ui/components}/atoms/vc-card/vc-card.vue +15 -15
  100. package/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.stories.ts +0 -0
  101. package/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.vue +21 -21
  102. package/{components → ui/components}/atoms/vc-col/vc-col.vue +2 -2
  103. package/{components → ui/components}/atoms/vc-container/vc-container.stories.ts +0 -0
  104. package/{components → ui/components}/atoms/vc-container/vc-container.vue +21 -19
  105. package/{components → ui/components}/atoms/vc-hint/vc-hint.stories.ts +0 -0
  106. package/{components → ui/components}/atoms/vc-hint/vc-hint.vue +1 -1
  107. package/{components → ui/components}/atoms/vc-icon/vc-icon.stories.ts +0 -0
  108. package/{components → ui/components}/atoms/vc-icon/vc-icon.vue +1 -1
  109. package/{components → ui/components}/atoms/vc-image/vc-image.stories.ts +0 -0
  110. package/{components → ui/components}/atoms/vc-image/vc-image.vue +9 -9
  111. package/{components → ui/components}/atoms/vc-info-row/vc-info-row.vue +3 -3
  112. package/{components → ui/components}/atoms/vc-label/vc-label.stories.ts +0 -0
  113. package/{components → ui/components}/atoms/vc-label/vc-label.vue +6 -6
  114. package/{components → ui/components}/atoms/vc-link/vc-link.stories.ts +0 -0
  115. package/{components → ui/components}/atoms/vc-link/vc-link.vue +3 -3
  116. package/ui/components/atoms/vc-loading/vc-loading.vue +33 -0
  117. package/{components → ui/components}/atoms/vc-progress/vc-progress.stories.ts +0 -0
  118. package/{components → ui/components}/atoms/vc-progress/vc-progress.vue +2 -2
  119. package/{components → ui/components}/atoms/vc-row/vc-row.vue +1 -1
  120. package/{components → ui/components}/atoms/vc-status/vc-status.stories.ts +0 -0
  121. package/{components → ui/components}/atoms/vc-status/vc-status.vue +4 -4
  122. package/{components → ui/components}/atoms/vc-status-icon/vc-status-icon.vue +3 -3
  123. package/{components → ui/components}/atoms/vc-switch/vc-switch.stories.ts +0 -0
  124. package/{components → ui/components}/atoms/vc-switch/vc-switch.vue +10 -10
  125. package/{components → ui/components}/atoms/vc-widget/vc-widget.vue +12 -12
  126. package/{components → ui/components}/index.ts +4 -3
  127. package/{components → ui/components}/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +17 -17
  128. package/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +0 -0
  129. package/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +1 -1
  130. package/{components/molecules/vc-input → ui/components/molecules/vc-currency-input}/vc-input.vue +30 -37
  131. package/{components → ui/components}/molecules/vc-editor/vc-editor.vue +4 -4
  132. package/{components → ui/components}/molecules/vc-file-upload/vc-file-upload.vue +6 -6
  133. package/{components → ui/components}/molecules/vc-form/vc-form.stories.ts +0 -0
  134. package/{components → ui/components}/molecules/vc-form/vc-form.vue +0 -0
  135. package/ui/components/molecules/vc-input/index.ts +8 -0
  136. package/ui/components/molecules/vc-input/vc-input-model.ts +150 -0
  137. package/ui/components/molecules/vc-input/vc-input.vue +324 -0
  138. package/ui/components/molecules/vc-input-currency/index.ts +8 -0
  139. package/ui/components/molecules/vc-input-currency/vc-input-currency-model.ts +128 -0
  140. package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +86 -0
  141. package/{components → ui/components}/molecules/vc-multivalue/vc-multivalue.vue +41 -41
  142. package/{components → ui/components}/molecules/vc-notification/vc-notification.vue +5 -5
  143. package/{components → ui/components}/molecules/vc-pagination/vc-pagination.stories.ts +0 -0
  144. package/{components → ui/components}/molecules/vc-pagination/vc-pagination.vue +24 -24
  145. package/{components → ui/components}/molecules/vc-rating/vc-rating.stories.ts +0 -0
  146. package/{components → ui/components}/molecules/vc-rating/vc-rating.vue +6 -6
  147. package/ui/components/molecules/vc-select/index.ts +7 -0
  148. package/ui/components/molecules/vc-select/vc-select-model.ts +216 -0
  149. package/ui/components/molecules/vc-select/vc-select.vue +727 -0
  150. package/{components → ui/components}/molecules/vc-slider/vc-slider.vue +12 -12
  151. package/{components → ui/components}/molecules/vc-textarea/vc-textarea.stories.ts +0 -0
  152. package/{components → ui/components}/molecules/vc-textarea/vc-textarea.vue +17 -17
  153. package/{components → ui/components}/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +20 -16
  154. package/{components → ui/components}/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +31 -31
  155. package/{components → ui/components}/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +9 -9
  156. package/{components → ui/components}/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +11 -11
  157. package/{components → ui/components}/organisms/vc-app/vc-app.stories.ts +0 -0
  158. package/{components → ui/components}/organisms/vc-app/vc-app.vue +9 -11
  159. package/{components → ui/components}/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +10 -10
  160. package/{components → ui/components}/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +17 -17
  161. package/{components → ui/components}/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +4 -4
  162. package/{components → ui/components}/organisms/vc-blade/vc-blade.stories.ts +0 -0
  163. package/{components → ui/components}/organisms/vc-blade/vc-blade.vue +5 -5
  164. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +426 -0
  165. package/{components → ui/components}/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +12 -12
  166. package/{components → ui/components}/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +9 -9
  167. package/{components → ui/components}/organisms/vc-gallery/vc-gallery.vue +6 -6
  168. package/{components → ui/components}/organisms/vc-login-form/vc-login-form.stories.ts +6 -6
  169. package/{components → ui/components}/organisms/vc-login-form/vc-login-form.vue +5 -5
  170. package/{components → ui/components}/organisms/vc-popup/vc-popup.stories.ts +0 -0
  171. package/{components → ui/components}/organisms/vc-popup/vc-popup.vue +13 -13
  172. package/{components → ui/components}/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +6 -6
  173. package/{components → ui/components}/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue +3 -3
  174. package/{components → ui/components}/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +13 -13
  175. package/{components → ui/components}/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +23 -23
  176. package/{components → ui/components}/organisms/vc-table/vc-table.stories.ts +3 -3
  177. package/{components → ui/components}/organisms/vc-table/vc-table.vue +42 -42
  178. package/ui/types/index.ts +38 -0
  179. package/ui/types/ts-helpers.ts +46 -0
  180. package/components/atoms/vc-badge/vc-badge.vue +0 -63
  181. package/components/atoms/vc-loading/vc-loading.vue +0 -30
  182. package/components/molecules/vc-input/vc-input.stories.ts +0 -26
  183. package/components/molecules/vc-select/vc-select.stories.ts +0 -25
  184. package/components/molecules/vc-select/vc-select.vue +0 -402
  185. package/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +0 -292
  186. package/dist/components/atoms/vc-badge/vc-badge.stories.d.ts.map +0 -1
  187. package/dist/components/atoms/vc-button/vc-button.stories.d.ts.map +0 -1
  188. package/dist/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +0 -1
  189. package/dist/components/atoms/vc-container/vc-container.stories.d.ts.map +0 -1
  190. package/dist/components/atoms/vc-hint/vc-hint.stories.d.ts.map +0 -1
  191. package/dist/components/atoms/vc-icon/vc-icon.stories.d.ts.map +0 -1
  192. package/dist/components/atoms/vc-image/vc-image.stories.d.ts.map +0 -1
  193. package/dist/components/atoms/vc-label/vc-label.stories.d.ts.map +0 -1
  194. package/dist/components/atoms/vc-link/vc-link.stories.d.ts.map +0 -1
  195. package/dist/components/atoms/vc-progress/vc-progress.stories.d.ts.map +0 -1
  196. package/dist/components/atoms/vc-status/vc-status.stories.d.ts.map +0 -1
  197. package/dist/components/atoms/vc-switch/vc-switch.stories.d.ts.map +0 -1
  198. package/dist/components/index.d.ts.map +0 -1
  199. package/dist/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +0 -1
  200. package/dist/components/molecules/vc-form/vc-form.stories.d.ts.map +0 -1
  201. package/dist/components/molecules/vc-input/vc-input.stories.d.ts +0 -7
  202. package/dist/components/molecules/vc-input/vc-input.stories.d.ts.map +0 -1
  203. package/dist/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +0 -1
  204. package/dist/components/molecules/vc-rating/vc-rating.stories.d.ts.map +0 -1
  205. package/dist/components/molecules/vc-select/vc-select.stories.d.ts +0 -7
  206. package/dist/components/molecules/vc-select/vc-select.stories.d.ts.map +0 -1
  207. package/dist/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +0 -1
  208. package/dist/components/organisms/vc-app/vc-app.stories.d.ts.map +0 -1
  209. package/dist/components/organisms/vc-blade/vc-blade.stories.d.ts.map +0 -1
  210. package/dist/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +0 -1
  211. package/dist/components/organisms/vc-popup/vc-popup.stories.d.ts.map +0 -1
  212. package/dist/components/organisms/vc-table/vc-table.stories.d.ts.map +0 -1
@@ -0,0 +1,150 @@
1
+ import { VNode } from "vue";
2
+
3
+ export interface VcInputProps {
4
+ /**
5
+ * Model of the component; Use with a listener for 'update:model-value' event OR use v-model directive
6
+ */
7
+ modelValue?: string | number | Date | null;
8
+ /**
9
+ * Input label text
10
+ */
11
+ label?: string | undefined;
12
+ /**
13
+ * Input placeholder text
14
+ */
15
+ placeholder?: string | undefined;
16
+ /**
17
+ * Input type
18
+ * Default value: text
19
+ */
20
+ type?:
21
+ | "text"
22
+ | "password"
23
+ | "email"
24
+ | "tel"
25
+ | "number"
26
+ | "url"
27
+ | "time"
28
+ | "date"
29
+ | "datetime-local"
30
+ | undefined;
31
+ /**
32
+ * Input description (hint) text below input component
33
+ */
34
+ hint?: string | undefined;
35
+ /**
36
+ * Appends clearable icon when a value is set;
37
+ * When clicked, model becomes null
38
+ */
39
+ clearable?: boolean | undefined;
40
+ /**
41
+ * Prefix
42
+ */
43
+ prefix?: string | undefined;
44
+ /**
45
+ * Suffix
46
+ */
47
+ suffix?: string | undefined;
48
+ /**
49
+ * Used to specify the name of the control; If not specified, it takes the value 'Field'
50
+ */
51
+ name?: string | undefined;
52
+ /**
53
+ * Signals the user a process is in progress by displaying a spinner
54
+ */
55
+ loading?: boolean | undefined;
56
+ /**
57
+ * Debounce amount (in milliseconds) when updating model
58
+ */
59
+ debounce?: string | number | undefined;
60
+ /**
61
+ * Put component in disabled mode
62
+ */
63
+ disabled?: boolean | undefined;
64
+ /**
65
+ * Focus field on initial component render
66
+ */
67
+ autofocus?: boolean | undefined;
68
+ /**
69
+ * Does field have validation errors?
70
+ */
71
+ error?: boolean | undefined;
72
+ /**
73
+ * Validation error message (gets displayed only if 'error' is set to 'true')
74
+ */
75
+ errorMessage?: string | undefined;
76
+ /**
77
+ * Specify a max length of model
78
+ * Default value: 1024
79
+ */
80
+ maxlength?: string | number | undefined;
81
+ /**
82
+ * Input tooltip information
83
+ */
84
+ tooltip?: string | undefined;
85
+ /**
86
+ * Input required state
87
+ */
88
+ required?: boolean | undefined;
89
+ }
90
+ export interface VcInputEmits {
91
+ /**
92
+ * Emitted when the component needs to change the model; Is also used by v-model
93
+ * @param event Emitted event name
94
+ * @param value New model value
95
+ */
96
+ (event: "update:modelValue", value: string | number | Date | null): void;
97
+ }
98
+ export interface VcInputSlots {
99
+ /**
100
+ * Slot for controls
101
+ * @param scope
102
+ */
103
+ control: (scope: {
104
+ /**
105
+ * Field is editable
106
+ */
107
+ editable: boolean;
108
+ /**
109
+ * Field has focus
110
+ */
111
+ focused: boolean;
112
+ /**
113
+ * Field's value
114
+ */
115
+ modelValue: string | number | Date | null;
116
+ /**
117
+ * Function that emits an @input event in the context of the field
118
+ * @param value Value to be emitted
119
+ */
120
+ emitValue: (value: string | number | Date | null) => void;
121
+ /**
122
+ * Field placeholder text
123
+ */
124
+ placeholder?: string | undefined;
125
+ }) => VNode[];
126
+ /**
127
+ * Prepend outer field
128
+ */
129
+ prepend: () => VNode[];
130
+ /**
131
+ * Prepend inner field
132
+ */
133
+ "prepend-inner": () => VNode[];
134
+ /**
135
+ * Append to inner field
136
+ */
137
+ "append-inner": () => VNode[];
138
+ /**
139
+ * Append outer field
140
+ */
141
+ append: () => VNode[];
142
+ /**
143
+ * Slot for errors
144
+ */
145
+ error: () => VNode[];
146
+ /**
147
+ * Slot for hint text
148
+ */
149
+ hint: () => VNode[];
150
+ }
@@ -0,0 +1,324 @@
1
+ <template>
2
+ <div
3
+ class="vc-input"
4
+ :class="[
5
+ `vc-input_${type}`,
6
+ {
7
+ 'vc-input_clearable': clearable,
8
+ 'vc-input_error': error,
9
+ 'vc-input_disabled': disabled,
10
+ 'tw-pb-[20px]': error || hint,
11
+ },
12
+ ]"
13
+ >
14
+ <!-- Input label -->
15
+ <VcLabel v-if="label" class="tw-mb-2" :required="required">
16
+ <span>{{ label }}</span>
17
+ <template v-if="tooltip" v-slot:tooltip>{{ tooltip }}</template>
18
+ </VcLabel>
19
+
20
+ <div class="tw-flex tw-flex-nowrap tw-items-start">
21
+ <div class="tw-relative tw-flex tw-flex-auto tw-text-left">
22
+ <div
23
+ class="tw-flex tw-items-center tw-flex-nowrap tw-pr-3"
24
+ v-if="$slots['prepend']"
25
+ >
26
+ <slot name="prepend"></slot>
27
+ </div>
28
+ <div
29
+ class="tw-flex tw-flex-col tw-flex-nowrap tw-flex-auto tw-relative"
30
+ >
31
+ <div class="vc-input__field-wrapper">
32
+ <div class="tw-flex tw-flex-nowrap tw-flex-auto tw-h-full">
33
+ <div
34
+ class="tw-flex tw-items-center tw-flex-nowrap tw-pr-3"
35
+ v-if="$slots['prepend-inner']"
36
+ >
37
+ <slot name="prepend-inner"></slot>
38
+ </div>
39
+ <div class="vc-input__field">
40
+ <div
41
+ class="tw-flex tw-items-center tw-flex-wrap tw-pr-3 tw-pointer-events-none"
42
+ v-if="prefix"
43
+ >
44
+ {{ prefix }}
45
+ </div>
46
+ <slot
47
+ name="control"
48
+ :editable="disabled"
49
+ :focused="autofocus"
50
+ :modelValue="temp"
51
+ :emitValue="emitValue"
52
+ :placeholder="placeholder"
53
+ >
54
+ <input
55
+ :placeholder="placeholder"
56
+ :type="internalType"
57
+ v-model="temp"
58
+ :disabled="disabled"
59
+ @input="onInput"
60
+ ref="inputRef"
61
+ :name="name"
62
+ :maxlength="maxlength"
63
+ :autofocus="autofocus"
64
+ :max="maxDate"
65
+ class="vc-input__input"
66
+ />
67
+ </slot>
68
+ <div
69
+ class="tw-flex tw-items-center tw-flex-wrap tw-pl-3 tw-pointer-events-none"
70
+ v-if="suffix"
71
+ >
72
+ {{ suffix }}
73
+ </div>
74
+ <div
75
+ v-if="
76
+ clearable && modelValue && !disabled && type !== 'password'
77
+ "
78
+ class="vc-input__clear"
79
+ @click="onReset"
80
+ >
81
+ <VcIcon size="s" icon="fas fa-times"></VcIcon>
82
+ </div>
83
+
84
+ <div
85
+ class="vc-input__showhide"
86
+ v-if="type === 'password' && internalType === 'password'"
87
+ @click="internalType = 'text'"
88
+ >
89
+ <VcIcon size="s" icon="fas fa-eye-slash"></VcIcon>
90
+ </div>
91
+
92
+ <div
93
+ class="vc-input__showhide"
94
+ v-if="type === 'password' && internalType === 'text'"
95
+ @click="internalType = 'password'"
96
+ >
97
+ <VcIcon size="s" icon="fas fa-eye"></VcIcon>
98
+ </div>
99
+ </div>
100
+
101
+ <div
102
+ class="tw-flex tw-items-center tw-flex-nowrap tw-pl-3"
103
+ v-if="$slots['append-inner']"
104
+ >
105
+ <slot name="append-inner"></slot>
106
+ </div>
107
+ <div
108
+ class="tw-flex tw-items-center tw-flex-nowrap tw-pl-3"
109
+ v-if="loading"
110
+ >
111
+ <VcIcon
112
+ icon="fas fa-spinner tw-animate-spin"
113
+ class="tw-text-[var(--input-clear-color)]"
114
+ size="m"
115
+ ></VcIcon>
116
+ </div>
117
+ </div>
118
+ </div>
119
+ <div
120
+ class="tw-absolute tw-translate-y-full tw-left-0 tw-right-0 tw-bottom-0 tw-min-h-[20px]"
121
+ >
122
+ <Transition name="slide-up" mode="out-in">
123
+ <div v-if="error">
124
+ <slot name="error">
125
+ <VcHint class="vc-input__error" v-if="errorMessage">
126
+ {{ errorMessage }}
127
+ </VcHint>
128
+ </slot>
129
+ </div>
130
+ <div v-else>
131
+ <slot name="hint">
132
+ <VcHint class="vc-input__desc" v-if="hint">
133
+ {{ hint }}
134
+ </VcHint>
135
+ </slot>
136
+ </div>
137
+ </Transition>
138
+ </div>
139
+ </div>
140
+
141
+ <div
142
+ class="tw-flex tw-items-center tw-flex-nowrap tw-pl-3"
143
+ v-if="$slots['append']"
144
+ >
145
+ <slot name="append"></slot>
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </template>
151
+
152
+ <script lang="ts" setup>
153
+ import { computed, ref, unref, watch } from "vue";
154
+ import { VcInputProps, VcInputEmits } from "./vc-input-model";
155
+
156
+ const props = withDefaults(defineProps<VcInputProps>(), {
157
+ modelValue: null,
158
+ clearable: false,
159
+ required: false,
160
+ disabled: false,
161
+ type: "text",
162
+ name: "Field",
163
+ maxlength: "1024",
164
+ });
165
+
166
+ const emit = defineEmits<VcInputEmits>();
167
+
168
+ let emitTimer;
169
+ let emitValueFn;
170
+ const temp = ref();
171
+ const inputRef = ref();
172
+
173
+ const internalType = ref(unref(props.type));
174
+
175
+ const maxDate = computed(() => props.type === "date" && "9999-12-31");
176
+
177
+ watch(
178
+ () => props.modelValue,
179
+ () => {
180
+ if (temp.value !== props.modelValue) {
181
+ temp.value = props.modelValue;
182
+ }
183
+ },
184
+ { immediate: true }
185
+ );
186
+
187
+ // Handle input event and emit changes
188
+ function onInput(e: Event) {
189
+ if (!e || !e.target) {
190
+ return;
191
+ }
192
+
193
+ const newValue = (e.target as HTMLInputElement).value;
194
+ emitValue(newValue);
195
+ }
196
+
197
+ function emitValue(val) {
198
+ emitValueFn = () => {
199
+ if (props.modelValue !== val) {
200
+ emit("update:modelValue", val);
201
+ }
202
+ emitValueFn = undefined;
203
+ };
204
+
205
+ if (props.debounce !== undefined) {
206
+ clearTimeout(emitTimer);
207
+ emitTimer = setTimeout(emitValueFn, +props.debounce);
208
+ } else {
209
+ emitValueFn();
210
+ }
211
+ }
212
+
213
+ // Handle input event to properly reset value and emit changes
214
+ function onReset() {
215
+ temp.value = null;
216
+ emit("update:modelValue", null);
217
+ }
218
+ </script>
219
+
220
+ <style lang="scss">
221
+ :root {
222
+ --input-height: 38px;
223
+ --input-border-radius: 3px;
224
+ --input-border-color: #d3dbe9;
225
+ --input-border-color-error: #f14e4e;
226
+ --input-background-color: #ffffff;
227
+ --input-placeholder-color: #a5a5a5;
228
+ --input-clear-color: #43b0e6;
229
+ --input-clear-color-hover: #319ed4;
230
+ }
231
+
232
+ .vc-input {
233
+ @apply tw-overflow-hidden;
234
+
235
+ &_date,
236
+ &_datetime-local {
237
+ .vc-app_mobile & {
238
+ @apply tw-max-w-full;
239
+ }
240
+ }
241
+
242
+ &__field-wrapper {
243
+ @apply tw-px-3 tw-relative tw-flex tw-flex-nowrap tw-w-full tw-outline-none tw-h-[var(--input-height)] tw-min-w-0 tw-box-border tw-grow tw-border tw-border-solid tw-border-[color:var(--input-border-color)] tw-rounded-[var(--input-border-radius)] tw-bg-[color:var(--input-background-color)];
244
+ }
245
+
246
+ &_error &__field-wrapper {
247
+ @apply tw-border tw-border-solid tw-border-[color:var(--input-border-color-error)];
248
+ }
249
+
250
+ &__error {
251
+ @apply tw-mt-1 [--hint-color:var(--input-border-color-error)];
252
+ }
253
+
254
+ &__desc {
255
+ @apply tw-text-[color:var(--input-placeholder-color)] tw-mt-1 tw-break-words tw-p-0;
256
+ }
257
+
258
+ &__input {
259
+ &:-webkit-autofill,
260
+ &:-webkit-autofill:focus {
261
+ transition: background-color 600000s 0s, color 600000s 0s;
262
+ }
263
+ &[data-autocompleted] {
264
+ background-color: transparent !important;
265
+ }
266
+ }
267
+
268
+ &__field {
269
+ @apply tw-w-auto tw-min-w-0 tw-max-w-full tw-relative tw-flex tw-flex-row tw-flex-auto tw-flex-nowrap [height:inherit];
270
+ input {
271
+ @apply tw-border-none tw-outline-none tw-h-full tw-min-w-0 tw-w-full tw-box-border tw-grow;
272
+
273
+ &::-webkit-input-placeholder {
274
+ @apply tw-text-[color:var(--input-placeholder-color)];
275
+ }
276
+
277
+ &::-moz-placeholder {
278
+ @apply tw-text-[color:var(--input-placeholder-color)];
279
+ }
280
+
281
+ &::-ms-placeholder {
282
+ @apply tw-text-[color:var(--input-placeholder-color)];
283
+ }
284
+
285
+ &::placeholder {
286
+ @apply tw-text-[color:var(--input-placeholder-color)];
287
+ }
288
+
289
+ &::-ms-reveal,
290
+ &::-ms-clear {
291
+ @apply tw-hidden;
292
+ }
293
+ }
294
+ }
295
+
296
+ &__clear {
297
+ @apply tw-cursor-pointer tw-text-[color:var(--input-clear-color)] hover:tw-text-[color:var(--input-clear-color-hover)] tw-flex tw-items-center tw-pl-3;
298
+ }
299
+
300
+ &__showhide {
301
+ @apply tw-cursor-pointer tw-text-[color:var(--input-placeholder-color)] hover:tw-text-[color:var(--input-clear-color-hover)] tw-pl-3 tw-flex tw-items-center;
302
+ }
303
+
304
+ &_disabled &__field-wrapper,
305
+ &_disabled &__field {
306
+ @apply tw-bg-[#fafafa] tw-text-[#424242];
307
+ }
308
+ }
309
+
310
+ .slide-up-enter-active,
311
+ .slide-up-leave-active {
312
+ transition: all 0.25s ease-out;
313
+ }
314
+
315
+ .slide-up-enter-from {
316
+ opacity: 0;
317
+ transform: translateY(5px);
318
+ }
319
+
320
+ .slide-up-leave-to {
321
+ opacity: 0;
322
+ transform: translateY(-5px);
323
+ }
324
+ </style>
@@ -0,0 +1,8 @@
1
+ import { ComponentPublicInstance } from "vue";
2
+ import { VcInputCurrencyProps } from "./vc-input-currency-model";
3
+ import { ComponentConstructor } from "@/ui/types/ts-helpers";
4
+ import InputCurrency from "./vc-input-currency.vue";
5
+
6
+ export const VcInputCurrency: ComponentConstructor<
7
+ ComponentPublicInstance<VcInputCurrencyProps>
8
+ > = InputCurrency;
@@ -0,0 +1,128 @@
1
+ import { VNode } from "vue";
2
+
3
+ export type OptionProp =
4
+ | ((option: string | Record<string, unknown>) => string)
5
+ | string
6
+ | undefined;
7
+
8
+ export interface VcInputCurrencyProps {
9
+ /**
10
+ * Model of the currency component; Use with a listener for 'update:price' event OR use v-model:price directive
11
+ */
12
+ modelValue?: string | number | Date | null;
13
+ /**
14
+ * Input label text
15
+ */
16
+ label?: string | undefined;
17
+ /**
18
+ * Input placeholder text
19
+ */
20
+ placeholder?: string | undefined;
21
+ /**
22
+ * Input description (hint) text below input component
23
+ */
24
+ hint?: string | undefined;
25
+ /**
26
+ * Appends clearable icon when a value is set;
27
+ * When clicked, model becomes null
28
+ */
29
+ clearable?: boolean | undefined;
30
+ /**
31
+ * Prefix
32
+ */
33
+ prefix?: string | undefined;
34
+ /**
35
+ * Suffix
36
+ */
37
+ suffix?: string | undefined;
38
+ /**
39
+ * Used to specify the name of the control; If not specified, it takes the value 'Field'
40
+ */
41
+ name?: string | undefined;
42
+ /**
43
+ * Signals the user a process is in progress by displaying a spinner
44
+ */
45
+ loading?: boolean | undefined;
46
+ /**
47
+ * Debounce amount (in milliseconds) for search input
48
+ * Default: 0
49
+ */
50
+ debounce?: string | number | undefined;
51
+ /**
52
+ * Put component in disabled mode
53
+ */
54
+ disabled?: boolean | undefined;
55
+ /**
56
+ * Focus field on initial component render
57
+ */
58
+ autofocus?: boolean | undefined;
59
+ /**
60
+ * Does field have validation errors?
61
+ */
62
+ error?: boolean | undefined;
63
+ /**
64
+ * Validation error message (gets displayed only if 'error' is set to 'true')
65
+ */
66
+ errorMessage?: string | undefined;
67
+ /**
68
+ * Specify a max length of model
69
+ * Default value: 1024
70
+ */
71
+ maxlength?: string | number | undefined;
72
+ /**
73
+ * Input tooltip information
74
+ */
75
+ tooltip?: string | undefined;
76
+ /**
77
+ * Input required state
78
+ */
79
+ required?: boolean | undefined;
80
+ /**
81
+ * Option label
82
+ */
83
+ option?: string | undefined;
84
+ /**
85
+ * Available options that the user can select from.
86
+ * Default value: []
87
+ */
88
+ options?: any[] | undefined;
89
+ /**
90
+ * Property of option which holds the 'value'
91
+ * Default value: id
92
+ * @param option The current option being processed
93
+ * @returns Value of the current option
94
+ */
95
+ optionValue?: OptionProp;
96
+ /**
97
+ * Property of option which holds the 'label'
98
+ * Default value: title
99
+ * @param option The current option being processed
100
+ * @returns Label of the current option
101
+ */
102
+ optionLabel?: OptionProp;
103
+ }
104
+ export interface VcInputCurrencyEmits {
105
+ /**
106
+ * Emitted when the component needs to change the model; Is also used by v-model
107
+ * @param event Emitted event name
108
+ * @param value New model value
109
+ */
110
+ (event: "update:modelValue", value: string | number | null): void;
111
+ /**
112
+ * Emitted when the component needs to change the options model; Is also used by v-model:option
113
+ * @param event Emitted event name
114
+ * @param value New model value
115
+ */
116
+ (event: "update:option", value: string | number | null): void;
117
+ }
118
+ export interface VcInputCurrencySlots {
119
+ /**
120
+ * Slot for custom dropdown open handler
121
+ */
122
+ button: (scope: {
123
+ /**
124
+ * Dropdown open/close handler
125
+ */
126
+ toggleHandler: () => void;
127
+ }) => VNode[];
128
+ }
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <VcSelect
3
+ :options="options"
4
+ :option-label="optionLabel"
5
+ :option-value="optionValue"
6
+ :searchable="true"
7
+ :autofocus="true"
8
+ :debounce="debounce"
9
+ :label="label"
10
+ :required="required"
11
+ :model-value="option"
12
+ @update:modelValue="$emit('update:option', $event)"
13
+ >
14
+ <template v-slot:control="{ toggleHandler }">
15
+ <VcInput
16
+ :placeholder="placeholder"
17
+ :model-value="modelValue"
18
+ :hint="hint"
19
+ :clearable="clearable"
20
+ :prefix="prefix"
21
+ :suffix="suffix"
22
+ :name="name"
23
+ :loading="loading"
24
+ :disabled="disabled"
25
+ :autofocus="autofocus"
26
+ :error="error"
27
+ :error-message="errorMessage"
28
+ :maxlength="maxlength"
29
+ :tooltip="tooltip"
30
+ class="tw-w-full"
31
+ @update:modelValue="$emit('update:modelValue', +$event)"
32
+ >
33
+ <template v-slot:append-inner>
34
+ <slot name="button" :toggleHandler="toggleHandler">
35
+ <button
36
+ class="tw-text-[#43b0e6] tw-not-italic tw-font-medium tw-text-[13px] tw-leading-[20px] tw-cursor-pointer"
37
+ @click.stop.prevent="toggleHandler"
38
+ >
39
+ {{ option }}
40
+ </button>
41
+ </slot>
42
+ </template>
43
+ <template v-slot:control="{ placeholder }">
44
+ <input type="text" ref="inputRef" :placeholder="placeholder" />
45
+ </template>
46
+ </VcInput>
47
+ </template>
48
+ </VcSelect>
49
+ </template>
50
+
51
+ <script lang="ts" setup>
52
+ import {
53
+ VcInputCurrencyEmits,
54
+ VcInputCurrencyProps,
55
+ } from "./vc-input-currency-model";
56
+ import { useCurrencyInput, CurrencyDisplay } from "vue-currency-input";
57
+ import { watch } from "vue";
58
+
59
+ const props = withDefaults(defineProps<VcInputCurrencyProps>(), {
60
+ debounce: 0,
61
+ });
62
+
63
+ defineEmits<VcInputCurrencyEmits>();
64
+
65
+ const { inputRef, setOptions } = useCurrencyInput({
66
+ locale: navigator.language,
67
+ currency: props.option || "USD",
68
+ autoSign: false,
69
+ currencyDisplay: CurrencyDisplay.hidden,
70
+ hideGroupingSeparatorOnFocus: false,
71
+ });
72
+
73
+ // Change currency settings
74
+ watch(
75
+ () => props.option,
76
+ (newVal) => {
77
+ setOptions({
78
+ locale: navigator.language,
79
+ currency: newVal,
80
+ autoSign: false,
81
+ currencyDisplay: CurrencyDisplay.hidden,
82
+ hideGroupingSeparatorOnFocus: false,
83
+ });
84
+ }
85
+ );
86
+ </script>