@vc-shell/framework 1.0.38 → 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 (256) hide show
  1. package/core/api/index.ts +1 -0
  2. package/core/api/platform.ts +8332 -0
  3. package/core/composables/index.ts +8 -0
  4. package/core/composables/useAutosave/index.ts +57 -0
  5. package/core/composables/useFunctions/debounce.ts +18 -0
  6. package/core/composables/useFunctions/delay.ts +7 -0
  7. package/core/composables/useFunctions/index.ts +21 -0
  8. package/core/composables/useFunctions/once.ts +14 -0
  9. package/core/composables/useFunctions/sleep.ts +4 -0
  10. package/core/composables/useFunctions/throttle.ts +17 -0
  11. package/core/composables/useI18n/index.ts +28 -0
  12. package/core/composables/useLogger/index.ts +24 -0
  13. package/core/composables/useNotifications/index.ts +116 -0
  14. package/core/composables/usePermissions/index.ts +32 -0
  15. package/core/composables/useSettings/index.ts +62 -0
  16. package/core/composables/useUser/index.ts +266 -0
  17. package/core/directives/autofocus/index.ts +9 -0
  18. package/core/directives/click-outside/index.ts +21 -0
  19. package/core/directives/index.ts +4 -0
  20. package/core/directives/loading/index.ts +28 -0
  21. package/core/directives/permissions/index.ts +20 -0
  22. package/core/plugins/index.ts +1 -0
  23. package/core/plugins/validation/index.ts +2 -0
  24. package/core/plugins/validation/rules.ts +196 -0
  25. package/core/types/index.ts +92 -0
  26. package/core/utilities/camelToSnake.ts +7 -0
  27. package/core/utilities/index.ts +1 -0
  28. package/dist/core/composables/useNotifications/index.d.ts +1 -1
  29. package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
  30. package/dist/core/composables/useSettings/index.d.ts +10 -1
  31. package/dist/core/composables/useSettings/index.d.ts.map +1 -1
  32. package/dist/core/composables/useUser/index.d.ts +2 -2
  33. package/dist/core/composables/useUser/index.d.ts.map +1 -1
  34. package/dist/core/plugins/validation/index.d.ts.map +1 -1
  35. package/dist/core/types/index.d.ts +1 -1
  36. package/dist/core/types/index.d.ts.map +1 -1
  37. package/dist/framework.js +72 -99
  38. package/dist/framework.js.map +1 -1
  39. package/dist/index.d.ts +3 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts +1 -1
  42. package/dist/shared/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
  43. package/dist/shared/app-switcher/index.d.ts +2 -2
  44. package/dist/shared/app-switcher/index.d.ts.map +1 -1
  45. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts +1 -1
  46. package/dist/shared/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
  47. package/dist/shared/blade-navigation/types/index.d.ts +1 -1
  48. package/dist/shared/blade-navigation/types/index.d.ts.map +1 -1
  49. package/dist/style.css +1 -1
  50. package/dist/tsconfig.tsbuildinfo +1 -0
  51. package/dist/ui/components/atoms/vc-badge/index.d.ts +5 -0
  52. package/dist/ui/components/atoms/vc-badge/index.d.ts.map +1 -0
  53. package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts +28 -0
  54. package/dist/ui/components/atoms/vc-badge/vc-badge-model.d.ts.map +1 -0
  55. package/dist/{components → ui/components}/atoms/vc-badge/vc-badge.stories.d.ts +0 -0
  56. package/dist/ui/components/atoms/vc-badge/vc-badge.stories.d.ts.map +1 -0
  57. package/dist/ui/components/atoms/vc-button/index.d.ts +5 -0
  58. package/dist/ui/components/atoms/vc-button/index.d.ts.map +1 -0
  59. package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts +28 -0
  60. package/dist/ui/components/atoms/vc-button/vc-button-model.d.ts.map +1 -0
  61. package/dist/{components → ui/components}/atoms/vc-button/vc-button.stories.d.ts +0 -0
  62. package/dist/ui/components/atoms/vc-button/vc-button.stories.d.ts.map +1 -0
  63. package/dist/{components → ui/components}/atoms/vc-checkbox/vc-checkbox.stories.d.ts +0 -0
  64. package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +1 -0
  65. package/dist/{components → ui/components}/atoms/vc-container/vc-container.stories.d.ts +0 -0
  66. package/dist/ui/components/atoms/vc-container/vc-container.stories.d.ts.map +1 -0
  67. package/dist/{components → ui/components}/atoms/vc-hint/vc-hint.stories.d.ts +0 -0
  68. package/dist/ui/components/atoms/vc-hint/vc-hint.stories.d.ts.map +1 -0
  69. package/dist/{components → ui/components}/atoms/vc-icon/vc-icon.stories.d.ts +0 -0
  70. package/dist/ui/components/atoms/vc-icon/vc-icon.stories.d.ts.map +1 -0
  71. package/dist/{components → ui/components}/atoms/vc-image/vc-image.stories.d.ts +0 -0
  72. package/dist/ui/components/atoms/vc-image/vc-image.stories.d.ts.map +1 -0
  73. package/dist/{components → ui/components}/atoms/vc-label/vc-label.stories.d.ts +0 -0
  74. package/dist/ui/components/atoms/vc-label/vc-label.stories.d.ts.map +1 -0
  75. package/dist/{components → ui/components}/atoms/vc-link/vc-link.stories.d.ts +0 -0
  76. package/dist/ui/components/atoms/vc-link/vc-link.stories.d.ts.map +1 -0
  77. package/dist/{components → ui/components}/atoms/vc-progress/vc-progress.stories.d.ts +0 -0
  78. package/dist/ui/components/atoms/vc-progress/vc-progress.stories.d.ts.map +1 -0
  79. package/dist/{components → ui/components}/atoms/vc-status/vc-status.stories.d.ts +0 -0
  80. package/dist/ui/components/atoms/vc-status/vc-status.stories.d.ts.map +1 -0
  81. package/dist/{components → ui/components}/atoms/vc-switch/vc-switch.stories.d.ts +0 -0
  82. package/dist/ui/components/atoms/vc-switch/vc-switch.stories.d.ts.map +1 -0
  83. package/dist/{components → ui/components}/index.d.ts +4 -3
  84. package/dist/ui/components/index.d.ts.map +1 -0
  85. package/dist/{components → ui/components}/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts +0 -0
  86. package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +1 -0
  87. package/dist/{components → ui/components}/molecules/vc-form/vc-form.stories.d.ts +0 -0
  88. package/dist/ui/components/molecules/vc-form/vc-form.stories.d.ts.map +1 -0
  89. package/dist/ui/components/molecules/vc-input/index.d.ts +5 -0
  90. package/dist/ui/components/molecules/vc-input/index.d.ts.map +1 -0
  91. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts +140 -0
  92. package/dist/ui/components/molecules/vc-input/vc-input-model.d.ts.map +1 -0
  93. package/dist/ui/components/molecules/vc-input-currency/index.d.ts +5 -0
  94. package/dist/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -0
  95. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts +124 -0
  96. package/dist/ui/components/molecules/vc-input-currency/vc-input-currency-model.d.ts.map +1 -0
  97. package/dist/{components → ui/components}/molecules/vc-pagination/vc-pagination.stories.d.ts +0 -0
  98. package/dist/ui/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +1 -0
  99. package/dist/{components → ui/components}/molecules/vc-rating/vc-rating.stories.d.ts +0 -0
  100. package/dist/ui/components/molecules/vc-rating/vc-rating.stories.d.ts.map +1 -0
  101. package/dist/ui/components/molecules/vc-select/index.d.ts +5 -0
  102. package/dist/ui/components/molecules/vc-select/index.d.ts.map +1 -0
  103. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts +207 -0
  104. package/dist/ui/components/molecules/vc-select/vc-select-model.d.ts.map +1 -0
  105. package/dist/{components → ui/components}/molecules/vc-textarea/vc-textarea.stories.d.ts +0 -0
  106. package/dist/ui/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +1 -0
  107. package/dist/{components → ui/components}/organisms/vc-app/vc-app.stories.d.ts +0 -0
  108. package/dist/ui/components/organisms/vc-app/vc-app.stories.d.ts.map +1 -0
  109. package/dist/{components → ui/components}/organisms/vc-blade/vc-blade.stories.d.ts +0 -0
  110. package/dist/ui/components/organisms/vc-blade/vc-blade.stories.d.ts.map +1 -0
  111. package/dist/{components → ui/components}/organisms/vc-login-form/vc-login-form.stories.d.ts +0 -0
  112. package/dist/ui/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +1 -0
  113. package/dist/{components → ui/components}/organisms/vc-popup/vc-popup.stories.d.ts +0 -0
  114. package/dist/ui/components/organisms/vc-popup/vc-popup.stories.d.ts.map +1 -0
  115. package/dist/{components → ui/components}/organisms/vc-table/vc-table.stories.d.ts +0 -0
  116. package/dist/ui/components/organisms/vc-table/vc-table.stories.d.ts.map +1 -0
  117. package/dist/ui/types/index.d.ts +13 -0
  118. package/dist/ui/types/index.d.ts.map +1 -0
  119. package/dist/ui/types/ts-helpers.d.ts +13 -0
  120. package/dist/ui/types/ts-helpers.d.ts.map +1 -0
  121. package/dist/vite.config.d.ts.map +1 -1
  122. package/package.json +30 -10
  123. package/shared/app-switcher/components/index.ts +1 -0
  124. package/shared/app-switcher/components/vc-app-switcher/vc-app-switcher.vue +90 -0
  125. package/shared/app-switcher/composables/index.ts +1 -0
  126. package/shared/app-switcher/composables/useAppSwitcher/index.ts +54 -0
  127. package/shared/app-switcher/index.ts +14 -0
  128. package/shared/assets/components/assets-details/assets-details.vue +138 -0
  129. package/shared/assets/components/index.ts +1 -0
  130. package/shared/assets/index.ts +19 -0
  131. package/shared/assets/locales/en.json +29 -0
  132. package/shared/assets/locales/index.ts +2 -0
  133. package/shared/blade-navigation/components/index.ts +1 -0
  134. package/shared/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +84 -0
  135. package/shared/blade-navigation/composables/index.ts +1 -0
  136. package/shared/blade-navigation/composables/useBladeNavigation/index.ts +216 -0
  137. package/shared/blade-navigation/index.ts +15 -0
  138. package/shared/blade-navigation/types/index.ts +52 -0
  139. package/shared/index.ts +16 -0
  140. package/tailwind.config.js +4 -3
  141. package/ui/components/atoms/vc-badge/index.ts +7 -0
  142. package/ui/components/atoms/vc-badge/vc-badge-model.ts +30 -0
  143. package/ui/components/atoms/vc-badge/vc-badge.stories.ts +27 -0
  144. package/ui/components/atoms/vc-badge/vc-badge.vue +57 -0
  145. package/ui/components/atoms/vc-button/index.ts +7 -0
  146. package/ui/components/atoms/vc-button/vc-button-model.ts +30 -0
  147. package/ui/components/atoms/vc-button/vc-button.stories.ts +34 -0
  148. package/ui/components/atoms/vc-button/vc-button.vue +219 -0
  149. package/ui/components/atoms/vc-card/vc-card.vue +137 -0
  150. package/ui/components/atoms/vc-checkbox/vc-checkbox.stories.ts +25 -0
  151. package/ui/components/atoms/vc-checkbox/vc-checkbox.vue +130 -0
  152. package/ui/components/atoms/vc-col/vc-col.vue +22 -0
  153. package/ui/components/atoms/vc-container/vc-container.stories.ts +31 -0
  154. package/ui/components/atoms/vc-container/vc-container.vue +222 -0
  155. package/ui/components/atoms/vc-hint/vc-hint.stories.ts +23 -0
  156. package/ui/components/atoms/vc-hint/vc-hint.vue +11 -0
  157. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +32 -0
  158. package/ui/components/atoms/vc-icon/vc-icon.vue +36 -0
  159. package/ui/components/atoms/vc-image/vc-image.stories.ts +40 -0
  160. package/ui/components/atoms/vc-image/vc-image.vue +122 -0
  161. package/ui/components/atoms/vc-info-row/vc-info-row.vue +42 -0
  162. package/ui/components/atoms/vc-label/vc-label.stories.ts +23 -0
  163. package/ui/components/atoms/vc-label/vc-label.vue +49 -0
  164. package/ui/components/atoms/vc-link/vc-link.stories.ts +30 -0
  165. package/ui/components/atoms/vc-link/vc-link.vue +46 -0
  166. package/ui/components/atoms/vc-loading/vc-loading.vue +33 -0
  167. package/ui/components/atoms/vc-progress/vc-progress.stories.ts +25 -0
  168. package/ui/components/atoms/vc-progress/vc-progress.vue +65 -0
  169. package/ui/components/atoms/vc-row/vc-row.vue +13 -0
  170. package/ui/components/atoms/vc-status/vc-status.stories.ts +26 -0
  171. package/ui/components/atoms/vc-status/vc-status.vue +78 -0
  172. package/ui/components/atoms/vc-status-icon/vc-status-icon.vue +21 -0
  173. package/ui/components/atoms/vc-switch/vc-switch.stories.ts +27 -0
  174. package/ui/components/atoms/vc-switch/vc-switch.vue +100 -0
  175. package/ui/components/atoms/vc-widget/vc-widget.vue +85 -0
  176. package/ui/components/index.ts +44 -0
  177. package/ui/components/molecules/vc-breadcrumbs/_internal/vc-breadcrumbs-item/vc-breadcrumbs-item.vue +103 -0
  178. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.ts +39 -0
  179. package/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue +21 -0
  180. package/ui/components/molecules/vc-currency-input/vc-input.vue +436 -0
  181. package/ui/components/molecules/vc-editor/vc-editor.vue +117 -0
  182. package/ui/components/molecules/vc-file-upload/vc-file-upload.vue +134 -0
  183. package/ui/components/molecules/vc-form/vc-form.stories.ts +23 -0
  184. package/ui/components/molecules/vc-form/vc-form.vue +5 -0
  185. package/ui/components/molecules/vc-input/index.ts +8 -0
  186. package/ui/components/molecules/vc-input/vc-input-model.ts +150 -0
  187. package/ui/components/molecules/vc-input/vc-input.vue +324 -0
  188. package/ui/components/molecules/vc-input-currency/index.ts +8 -0
  189. package/ui/components/molecules/vc-input-currency/vc-input-currency-model.ts +128 -0
  190. package/ui/components/molecules/vc-input-currency/vc-input-currency.vue +86 -0
  191. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +447 -0
  192. package/ui/components/molecules/vc-notification/vc-notification.vue +101 -0
  193. package/ui/components/molecules/vc-pagination/vc-pagination.stories.ts +23 -0
  194. package/ui/components/molecules/vc-pagination/vc-pagination.vue +169 -0
  195. package/ui/components/molecules/vc-rating/vc-rating.stories.ts +23 -0
  196. package/ui/components/molecules/vc-rating/vc-rating.vue +77 -0
  197. package/ui/components/molecules/vc-select/index.ts +7 -0
  198. package/ui/components/molecules/vc-select/vc-select-model.ts +216 -0
  199. package/ui/components/molecules/vc-select/vc-select.vue +727 -0
  200. package/ui/components/molecules/vc-slider/vc-slider.vue +106 -0
  201. package/ui/components/molecules/vc-textarea/vc-textarea.stories.ts +23 -0
  202. package/ui/components/molecules/vc-textarea/vc-textarea.vue +155 -0
  203. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +150 -0
  204. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +148 -0
  205. package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +157 -0
  206. package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +110 -0
  207. package/ui/components/organisms/vc-app/vc-app.stories.ts +75 -0
  208. package/ui/components/organisms/vc-app/vc-app.vue +169 -0
  209. package/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue +126 -0
  210. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +223 -0
  211. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +67 -0
  212. package/ui/components/organisms/vc-blade/vc-blade.stories.ts +46 -0
  213. package/ui/components/organisms/vc-blade/vc-blade.vue +87 -0
  214. package/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue +426 -0
  215. package/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue +123 -0
  216. package/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue +93 -0
  217. package/ui/components/organisms/vc-gallery/vc-gallery.vue +186 -0
  218. package/ui/components/organisms/vc-login-form/vc-login-form.stories.ts +55 -0
  219. package/ui/components/organisms/vc-login-form/vc-login-form.vue +48 -0
  220. package/ui/components/organisms/vc-popup/vc-popup.stories.ts +23 -0
  221. package/ui/components/organisms/vc-popup/vc-popup.vue +97 -0
  222. package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +113 -0
  223. package/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue +29 -0
  224. package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +152 -0
  225. package/ui/components/organisms/vc-table/_internal/vc-table-mobile-item/vc-table-mobile-item.vue +272 -0
  226. package/ui/components/organisms/vc-table/vc-table.stories.ts +99 -0
  227. package/ui/components/organisms/vc-table/vc-table.vue +638 -0
  228. package/ui/types/index.ts +38 -0
  229. package/ui/types/ts-helpers.ts +46 -0
  230. package/dist/components/atoms/vc-badge/vc-badge.stories.d.ts.map +0 -1
  231. package/dist/components/atoms/vc-button/vc-button.stories.d.ts.map +0 -1
  232. package/dist/components/atoms/vc-checkbox/vc-checkbox.stories.d.ts.map +0 -1
  233. package/dist/components/atoms/vc-container/vc-container.stories.d.ts.map +0 -1
  234. package/dist/components/atoms/vc-hint/vc-hint.stories.d.ts.map +0 -1
  235. package/dist/components/atoms/vc-icon/vc-icon.stories.d.ts.map +0 -1
  236. package/dist/components/atoms/vc-image/vc-image.stories.d.ts.map +0 -1
  237. package/dist/components/atoms/vc-label/vc-label.stories.d.ts.map +0 -1
  238. package/dist/components/atoms/vc-link/vc-link.stories.d.ts.map +0 -1
  239. package/dist/components/atoms/vc-progress/vc-progress.stories.d.ts.map +0 -1
  240. package/dist/components/atoms/vc-status/vc-status.stories.d.ts.map +0 -1
  241. package/dist/components/atoms/vc-switch/vc-switch.stories.d.ts.map +0 -1
  242. package/dist/components/index.d.ts.map +0 -1
  243. package/dist/components/molecules/vc-breadcrumbs/vc-breadcrumbs.stories.d.ts.map +0 -1
  244. package/dist/components/molecules/vc-form/vc-form.stories.d.ts.map +0 -1
  245. package/dist/components/molecules/vc-input/vc-input.stories.d.ts +0 -7
  246. package/dist/components/molecules/vc-input/vc-input.stories.d.ts.map +0 -1
  247. package/dist/components/molecules/vc-pagination/vc-pagination.stories.d.ts.map +0 -1
  248. package/dist/components/molecules/vc-rating/vc-rating.stories.d.ts.map +0 -1
  249. package/dist/components/molecules/vc-select/vc-select.stories.d.ts +0 -7
  250. package/dist/components/molecules/vc-select/vc-select.stories.d.ts.map +0 -1
  251. package/dist/components/molecules/vc-textarea/vc-textarea.stories.d.ts.map +0 -1
  252. package/dist/components/organisms/vc-app/vc-app.stories.d.ts.map +0 -1
  253. package/dist/components/organisms/vc-blade/vc-blade.stories.d.ts.map +0 -1
  254. package/dist/components/organisms/vc-login-form/vc-login-form.stories.d.ts.map +0 -1
  255. package/dist/components/organisms/vc-popup/vc-popup.stories.d.ts.map +0 -1
  256. package/dist/components/organisms/vc-table/vc-table.stories.d.ts.map +0 -1
@@ -0,0 +1,222 @@
1
+ <template>
2
+ <div
3
+ :class="[
4
+ 'vc-container',
5
+ {
6
+ 'vc-container_shadow': shadow && scroll,
7
+ 'vc-container_nopadding': noPadding,
8
+ },
9
+ ]"
10
+ @touchstart="touchStart"
11
+ @touchmove="touchMove"
12
+ @touchend="touchEnd"
13
+ >
14
+ <div
15
+ ref="component"
16
+ class="vc-container__inner"
17
+ :style="{
18
+ transform: dist ? `translate3d(0, ${dist}px, 0)` : '',
19
+ }"
20
+ >
21
+ <div
22
+ class="vc-container__overscroll"
23
+ :class="{ 'vc-container__overscroll_passed': status === 'loosing' }"
24
+ :style="{ height: dist ? `${dist}px` : '0px' }"
25
+ >
26
+ <VcIcon
27
+ icon="fas fa-spinner"
28
+ :style="{ 'tw-font-size': `${dist / 2}px` }"
29
+ class="vc-container__overscroll-icon"
30
+ ></VcIcon>
31
+ </div>
32
+ <slot></slot>
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <script lang="ts" setup>
38
+ import { ref, onMounted, computed, nextTick } from "vue";
39
+ const props = defineProps({
40
+ shadow: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+
45
+ noPadding: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+
50
+ usePtr: {
51
+ type: Boolean,
52
+ default: false,
53
+ },
54
+ });
55
+ const emit = defineEmits(["scroll:ptr", "scroll:infinite"]);
56
+ const component = ref<HTMLElement>();
57
+ const scroll = ref(false);
58
+ const startY = ref(0);
59
+ const ceiling = ref();
60
+ const pullDist = ref(60);
61
+ const dist = ref(0);
62
+ const status = ref("normal");
63
+ const delta = ref(0);
64
+
65
+ onMounted(() => {
66
+ const observer = new ResizeObserver(() => {
67
+ scroll.value = (component.value &&
68
+ component.value.clientHeight < component.value.scrollHeight) as boolean;
69
+ });
70
+
71
+ if (component.value) {
72
+ observer.observe(component.value);
73
+ }
74
+ });
75
+
76
+ const touchable = computed(
77
+ () => status.value !== "refresh" && status.value !== "success"
78
+ );
79
+
80
+ const scrollTop = () => {
81
+ if (component.value) {
82
+ component.value.scroll(0, 0);
83
+ }
84
+ };
85
+
86
+ function touchStart(e: TouchEvent): void {
87
+ if (!touchable.value) {
88
+ return;
89
+ }
90
+ checkPullStart(e);
91
+ }
92
+
93
+ function touchMove(e: TouchEvent): void {
94
+ if (props.usePtr) {
95
+ const touch = e.touches[0];
96
+ if (!touchable.value) {
97
+ return;
98
+ }
99
+
100
+ if (!ceiling.value) {
101
+ checkPullStart(e);
102
+ }
103
+
104
+ delta.value = touch.clientY - startY.value;
105
+
106
+ if (ceiling.value && delta.value >= 0 && delta.value < 80) {
107
+ e.preventDefault();
108
+
109
+ setStatus(ease(delta.value));
110
+ }
111
+ }
112
+ }
113
+
114
+ function touchEnd(): void {
115
+ if (delta.value && touchable.value) {
116
+ if (status.value === "loosing") {
117
+ nextTick(() => emit("scroll:ptr"));
118
+ }
119
+ setStatus(0);
120
+ }
121
+ }
122
+
123
+ function getScrollTop(el: HTMLElement) {
124
+ const top = el.scrollTop;
125
+
126
+ return Math.max(top, 0);
127
+ }
128
+
129
+ function checkPullStart(e: TouchEvent) {
130
+ ceiling.value = getScrollTop(component.value as HTMLElement) === 0;
131
+
132
+ if (ceiling.value) {
133
+ startY.value = e.touches[0].clientY;
134
+ }
135
+ }
136
+
137
+ function setStatus(distance: number) {
138
+ let stat;
139
+ if (distance === 0) {
140
+ stat = "normal";
141
+ } else {
142
+ stat = distance < pullDist.value ? "pulling" : "loosing";
143
+ }
144
+ dist.value = distance;
145
+ if (stat !== status.value) {
146
+ status.value = stat;
147
+ }
148
+ }
149
+
150
+ function ease(distance: number) {
151
+ const pullDistance = +pullDist.value;
152
+ if (distance > pullDistance) {
153
+ if (distance < pullDistance * 2) {
154
+ distance = pullDistance + (distance - pullDistance) / 2;
155
+ } else {
156
+ distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
157
+ }
158
+ }
159
+ return Math.round(distance);
160
+ }
161
+
162
+ defineExpose({
163
+ scrollTop,
164
+ component,
165
+ });
166
+ </script>
167
+
168
+ <style lang="scss">
169
+ :root {
170
+ --container-scroll-color: #e1eff9;
171
+ --container-scroll-color-hover: #cce4f5;
172
+ --container-scroll-width: 8px;
173
+ --container-scroll-padding: 8px;
174
+ --container-scroll-shadow: 0 3px 2px rgba(0, 0, 0, 0.1) inset,
175
+ 0 -3px 2px rgba(0, 0, 0, 0.1) inset;
176
+ }
177
+
178
+ .vc-container {
179
+ @apply tw-w-full tw-h-full tw-overflow-hidden tw-box-border tw-flex tw-flex-col tw-relative;
180
+
181
+ &_shadow {
182
+ @apply tw-shadow-[0_3px_2px_rgba(0,0,0,0.1)_inset];
183
+ }
184
+
185
+ &__overscroll {
186
+ @apply tw-relative tw-w-full tw-flex tw-items-start tw-justify-center tw-overflow-hidden;
187
+
188
+ &-icon {
189
+ @apply tw-text-[color:#a1c0d4] tw-animate-spin;
190
+ }
191
+
192
+ &_passed &-icon {
193
+ @apply tw-text-[#43b0e6];
194
+ }
195
+ }
196
+
197
+ &__inner {
198
+ @apply tw-relative tw-overflow-y-auto tw-overflow-x-hidden
199
+ tw-flex-1 tw-p-[var(--container-scroll-padding)]
200
+ tw-transition-transform [scrollbar-color:var(--container-scroll-color)] [scrollbar-width:thin];
201
+
202
+ &::-webkit-scrollbar {
203
+ @apply tw-w-[var(--container-scroll-width)] tw-bg-transparent;
204
+ }
205
+
206
+ &::-webkit-scrollbar-track {
207
+ @apply tw-bg-transparent;
208
+ }
209
+
210
+ &::-webkit-scrollbar-thumb {
211
+ @apply tw-bg-[color:var(--container-scroll-color)]
212
+ tw-rounded-[calc(var(--container-scroll-width)/2)]
213
+ tw-overflow-x-hidden
214
+ hover:tw-bg-[color:var(--container-scroll-color-hover)];
215
+ }
216
+ }
217
+
218
+ &_nopadding &__inner {
219
+ @apply tw-p-0;
220
+ }
221
+ }
222
+ </style>
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Hint component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcHint from "./vc-hint.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-hint",
10
+ component: VcHint,
11
+ };
12
+
13
+ const Template: Story = (args) => ({
14
+ components: { VcHint },
15
+ setup() {
16
+ return { args };
17
+ },
18
+ template: '<vc-hint v-bind="args">This is a hint</vc-hint>',
19
+ });
20
+
21
+ export const Hint = Template.bind({});
22
+ Hint.storyName = "vc-hint";
23
+ Hint.args = {};
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div class="tw-text-[color:var(--hint-color)] tw-text-xs">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <style lang="scss">
8
+ :root {
9
+ --hint-color: #a5a5a5;
10
+ }
11
+ </style>
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Icon component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcIcon from "./vc-icon.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-icon",
10
+ component: VcIcon,
11
+ argTypes: {
12
+ size: {
13
+ options: ["xs", "s", "m", "l", "xl"],
14
+ control: { type: "radio" },
15
+ },
16
+ },
17
+ };
18
+
19
+ const Template: Story = (args) => ({
20
+ components: { VcIcon },
21
+ setup() {
22
+ return { args };
23
+ },
24
+ template: '<vc-icon v-bind="args"></vc-icon>',
25
+ });
26
+
27
+ export const Icon = Template.bind({});
28
+ Icon.storyName = "vc-icon";
29
+ Icon.args = {
30
+ icon: "fas fa-star",
31
+ size: "m",
32
+ };
@@ -0,0 +1,36 @@
1
+ <template>
2
+ <i :class="`vc-icon vc-icon_${size} ${icon.toLowerCase()}`" />
3
+ </template>
4
+
5
+ <script lang="ts" setup>
6
+ export interface Props {
7
+ icon?: string;
8
+ size?: "xs" | "s" | "m" | "l" | "xl" | "xxl";
9
+ }
10
+
11
+ withDefaults(defineProps<Props>(), {
12
+ icon: "fas fa-square-full",
13
+ size: "m",
14
+ });
15
+ </script>
16
+
17
+ <style lang="scss">
18
+ :root {
19
+ --icon-size-xs: 12px;
20
+ --icon-size-s: 14px;
21
+ --icon-size-m: 18px;
22
+ --icon-size-l: 20px;
23
+ --icon-size-xl: 22px;
24
+ --icon-size-xxl: 30px;
25
+ }
26
+
27
+ $sizes: xs, s, m, l, xl, xxl;
28
+
29
+ .vc-icon {
30
+ @each $size in $sizes {
31
+ &_#{$size} {
32
+ @apply tw-text-[length:var(--icon-size-#{$size})];
33
+ }
34
+ }
35
+ }
36
+ </style>
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Image component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcImage from "./vc-image.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-image",
10
+ component: VcImage,
11
+ argTypes: {
12
+ aspect: {
13
+ options: ["1x1", "3x2", "4x3", "16x9"],
14
+ control: { type: "radio" },
15
+ },
16
+ size: {
17
+ options: ["auto", "xs", "s", "m", "l", "xl"],
18
+ control: { type: "radio" },
19
+ },
20
+ },
21
+ };
22
+
23
+ const Template: Story = (args) => ({
24
+ components: { VcImage },
25
+ setup() {
26
+ return { args };
27
+ },
28
+ template:
29
+ '<div style="width: 400px"><vc-image v-bind="args"></vc-image></div>',
30
+ });
31
+
32
+ export const Image = Template.bind({});
33
+ Image.storyName = "vc-image";
34
+ Image.args = {
35
+ aspect: "1x1",
36
+ rounded: false,
37
+ clickable: false,
38
+ src: "https://placekitten.com/800/600",
39
+ size: "auto",
40
+ };
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <div class="vc-image" :class="[`vc-image_${size}`]">
3
+ <div
4
+ :class="[
5
+ `vc-image_${aspect}`,
6
+ {
7
+ 'tw-rounded-full tw-pb-[var(--image-padding-bottom-1x1)]': rounded,
8
+ 'tw-rounded-[3px] tw-border tw-border-solid tw-border-[color:#efefef]': bordered,
9
+ 'tw-cursor-pointer': clickable,
10
+ },
11
+ 'tw-relative',
12
+ ]"
13
+ :style="imageHandler"
14
+ @click="onClick"
15
+ >
16
+ <div
17
+ v-if="!src"
18
+ class="tw-absolute tw-w-full tw-h-full tw-flex tw-items-center tw-justify-center tw-text-[#83a3be]"
19
+ >
20
+ <VcIcon icon="fas fa-image" size="xl"></VcIcon>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <script lang="ts" setup>
27
+ import { computed } from "vue";
28
+
29
+ const props = defineProps({
30
+ aspect: {
31
+ type: String,
32
+ default: "1x1",
33
+ },
34
+
35
+ rounded: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+
40
+ bordered: {
41
+ type: Boolean,
42
+ default: false,
43
+ },
44
+
45
+ clickable: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+
50
+ src: {
51
+ type: String,
52
+ default: undefined,
53
+ },
54
+
55
+ size: {
56
+ type: String,
57
+ default: "auto",
58
+ },
59
+
60
+ background: {
61
+ type: String,
62
+ default: "cover",
63
+ },
64
+ });
65
+
66
+ const emit = defineEmits(["click"]);
67
+
68
+ const imageHandler = computed(() => {
69
+ if (props.src) {
70
+ return `background: url(${encodeURI(props.src)}) center / ${
71
+ props.background
72
+ } no-repeat`;
73
+ }
74
+ return undefined;
75
+ });
76
+
77
+ function onClick(): void {
78
+ if (props.clickable) {
79
+ emit("click");
80
+ }
81
+ }
82
+ </script>
83
+
84
+ <style lang="scss">
85
+ :root {
86
+ --image-size-xs: 32px;
87
+ --image-size-s: 48px;
88
+ --image-size-m: 64px;
89
+ --image-size-l: 96px;
90
+ --image-size-xl: 128px;
91
+ --image-size-xxl: 145px;
92
+ }
93
+
94
+ $aspects: (
95
+ 1x1: 100%,
96
+ 16x9: 56.25%,
97
+ 4x3: 75%,
98
+ 3x2: 66.66%,
99
+ );
100
+
101
+ $paddings: xs, s, m, l, xl, xxl;
102
+
103
+ .vc-image {
104
+ @apply tw-inline-block tw-relative;
105
+
106
+ @each $name, $aspect in $aspects {
107
+ &_#{$name} {
108
+ @apply tw-pb-[#{$aspect}];
109
+ }
110
+ }
111
+
112
+ @each $padding in $paddings {
113
+ &_#{$padding} {
114
+ @apply tw-w-[var(--image-size-#{$padding})];
115
+ }
116
+ }
117
+
118
+ &_auto {
119
+ @apply tw-w-full;
120
+ }
121
+ }
122
+ </style>
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div class="tw-mb-[11px] last-of-type:tw-mb-0">
3
+ <VcRow>
4
+ <VcCol>
5
+ <VcLabel>
6
+ <span>{{ label }}</span>
7
+ <template v-if="tooltip" v-slot:tooltip>{{ tooltip }}</template>
8
+ </VcLabel>
9
+ </VcCol>
10
+ <VcCol size="2">
11
+ <p class="tw-m-0" v-if="type === 'default'">{{ value }}</p>
12
+ <VcLink v-else-if="type === 'email'">{{ value }}</VcLink>
13
+ </VcCol>
14
+ </VcRow>
15
+ </div>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import { VcLabel, VcRow, VcCol } from "@/ui/components";
20
+
21
+ defineProps({
22
+ label: {
23
+ type: String,
24
+ default: "",
25
+ },
26
+
27
+ value: {
28
+ type: String,
29
+ default: "",
30
+ },
31
+
32
+ tooltip: {
33
+ type: String,
34
+ default: "",
35
+ },
36
+
37
+ type: {
38
+ type: String,
39
+ default: "default",
40
+ },
41
+ });
42
+ </script>
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Label component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcLabel from "./vc-label.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-label",
10
+ component: VcLabel,
11
+ };
12
+
13
+ const Template: Story = (args) => ({
14
+ components: { VcLabel },
15
+ setup() {
16
+ return { args };
17
+ },
18
+ template: '<vc-label v-bind="args">This is a label</vc-label>',
19
+ });
20
+
21
+ export const Label = Template.bind({});
22
+ Label.storyName = "vc-label";
23
+ Label.args = {};
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div class= "tw-flex tw-flex-nowrap tw-font-bold">
3
+ <span><slot></slot></span>
4
+ <span v-if="required" class="tw-text-[color:var(--label-required-color)] tw-ml-1"
5
+ >*</span
6
+ >
7
+ <span v-if="$slots['tooltip']" class="tw-grow tw-basis-0 tw-ml-1">
8
+ <VcIcon
9
+ class="tw-text-[color:var(--label-tooltip-color)]"
10
+ :icon="tooltipIcon"
11
+ size="s"
12
+ @mouseenter="tooltipVisible = true"
13
+ @mouseleave="tooltipVisible = false"
14
+ ></VcIcon>
15
+ <span
16
+ class="tw-absolute tw-z-10 tw-bg-white tw-border tw-border-solid tw-border-[color:#eef0f2] tw-shadow-[1px_1px_8px_rgba(126,142,157,0.25)] tw-rounded-[3px] tw-text-[color:#8e9daa] tw-font-normal tw-py-1 tw-px-2 tw-ml-4"
17
+ v-if="tooltipVisible"
18
+ >
19
+ <slot name="tooltip"></slot>
20
+ </span>
21
+ </span>
22
+ </div>
23
+ </template>
24
+
25
+ <script lang="ts" setup>
26
+ import { VcIcon } from "@/ui/components";
27
+ import { ref } from "vue";
28
+
29
+ defineProps({
30
+ required: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+
35
+ tooltipIcon: {
36
+ type: String,
37
+ default: "fas fa-info-circle",
38
+ },
39
+ });
40
+
41
+ const tooltipVisible = ref(false);
42
+ </script>
43
+
44
+ <style lang="scss">
45
+ :root {
46
+ --label-required-color: #f14e4e;
47
+ --label-tooltip-color: #d3e0ee;
48
+ }
49
+ </style>
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Link component.
3
+ * @author Iurii A Taranov <me@flanker72.ru>
4
+ */
5
+ import { Story } from "@storybook/vue3";
6
+ import VcLink from "./vc-link.vue";
7
+
8
+ export default {
9
+ title: "atoms/vc-link",
10
+ component: VcLink,
11
+ argTypes: {
12
+ click: { action: "click", name: "click" },
13
+ },
14
+ };
15
+
16
+ const Template: Story = (args) => ({
17
+ components: { VcLink },
18
+ setup() {
19
+ return { args };
20
+ },
21
+ template: '<vc-link v-bind="args">This is a link</vc-link>',
22
+ });
23
+
24
+ export const Link = Template.bind({});
25
+ Link.storyName = "vc-link";
26
+ Link.args = {
27
+ to: undefined,
28
+ active: false,
29
+ disabled: false,
30
+ };
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div
3
+ class="vc-link"
4
+ :class="{
5
+ 'tw-text-[color:var(--link-text-color-active)] tw-no-underline': active,
6
+ 'tw-cursor-not-allowed tw-text-[color:var(--link-text-color-disabled)] hover:tw-text-[color:var(--link-text-color-disabled)] tw-no-underline':
7
+ disabled,
8
+ }"
9
+ @click="onClick"
10
+ >
11
+ <slot></slot>
12
+ </div>
13
+ </template>
14
+
15
+ <script lang="ts" setup>
16
+ const props = defineProps({
17
+ active: {
18
+ type: Boolean,
19
+ default: false,
20
+ },
21
+
22
+ disabled: {
23
+ type: Boolean,
24
+ default: false,
25
+ },
26
+ });
27
+ const emit = defineEmits(["click"]);
28
+ function onClick(): void {
29
+ if (!props.disabled) {
30
+ emit("click");
31
+ }
32
+ }
33
+ </script>
34
+
35
+ <style lang="scss">
36
+ :root {
37
+ --link-text-color: hsl(200, 77%, 58%);
38
+ --link-text-color-hover: hsl(200, 77%, 48%);
39
+ --link-text-color-active: hsl(200, 77%, 48%);
40
+ --link-text-color-disabled: hsl(200, 77%, 73%);
41
+ }
42
+
43
+ .vc-link {
44
+ @apply tw-text-[color:var(--link-text-color)] tw-no-underline tw-cursor-pointer tw-transition tw-duration-200 tw-inline-block hover:tw-text-[color:var(--link-text-color-hover)] hover:tw-underline;
45
+ }
46
+ </style>