@7pmlabs/design-system 0.3.2 → 0.3.4

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 (344) hide show
  1. package/README.md +5 -5
  2. package/dist/design-system100.js +1 -1
  3. package/dist/design-system100.js.map +1 -1
  4. package/dist/design-system100.mjs +59 -2164
  5. package/dist/design-system100.mjs.map +1 -1
  6. package/dist/design-system101.js +1 -1
  7. package/dist/design-system101.js.map +1 -1
  8. package/dist/design-system101.mjs +2164 -59
  9. package/dist/design-system101.mjs.map +1 -1
  10. package/dist/design-system102.js +1 -1
  11. package/dist/design-system102.js.map +1 -1
  12. package/dist/design-system102.mjs +1103 -75
  13. package/dist/design-system102.mjs.map +1 -1
  14. package/dist/design-system103.js +1 -1
  15. package/dist/design-system103.js.map +1 -1
  16. package/dist/design-system103.mjs +24 -5
  17. package/dist/design-system103.mjs.map +1 -1
  18. package/dist/design-system105.js +1 -1
  19. package/dist/design-system105.js.map +1 -1
  20. package/dist/design-system105.mjs +2 -4
  21. package/dist/design-system105.mjs.map +1 -1
  22. package/dist/design-system106.js +1 -1
  23. package/dist/design-system106.js.map +1 -1
  24. package/dist/design-system106.mjs +4 -8
  25. package/dist/design-system106.mjs.map +1 -1
  26. package/dist/design-system107.js +1 -1
  27. package/dist/design-system107.js.map +1 -1
  28. package/dist/design-system107.mjs +7 -6
  29. package/dist/design-system107.mjs.map +1 -1
  30. package/dist/design-system108.js +1 -1
  31. package/dist/design-system108.js.map +1 -1
  32. package/dist/design-system108.mjs +7 -2
  33. package/dist/design-system108.mjs.map +1 -1
  34. package/dist/design-system109.js +1 -1
  35. package/dist/design-system109.mjs +2 -2
  36. package/dist/design-system11.js +1 -1
  37. package/dist/design-system11.js.map +1 -1
  38. package/dist/design-system11.mjs +41 -47
  39. package/dist/design-system11.mjs.map +1 -1
  40. package/dist/design-system110.js +1 -1
  41. package/dist/design-system110.mjs +2 -2
  42. package/dist/design-system12.js +7 -1
  43. package/dist/design-system12.js.map +1 -1
  44. package/dist/design-system12.mjs +83 -72
  45. package/dist/design-system12.mjs.map +1 -1
  46. package/dist/design-system120.js +1 -1
  47. package/dist/design-system120.mjs +1 -1
  48. package/dist/design-system122.js +1 -1
  49. package/dist/design-system122.mjs +1 -1
  50. package/dist/design-system123.js +1 -1
  51. package/dist/design-system123.mjs +6 -6
  52. package/dist/design-system126.js +1 -1
  53. package/dist/design-system126.mjs +3 -3
  54. package/dist/design-system13.js +7 -1
  55. package/dist/design-system13.js.map +1 -1
  56. package/dist/design-system13.mjs +101 -90
  57. package/dist/design-system13.mjs.map +1 -1
  58. package/dist/design-system131.js +1 -1
  59. package/dist/design-system131.mjs +1 -1
  60. package/dist/design-system136.js +1 -1
  61. package/dist/design-system136.mjs +2 -2
  62. package/dist/design-system138.js +1 -1
  63. package/dist/design-system138.mjs +1 -1
  64. package/dist/design-system14.js +1 -1
  65. package/dist/design-system14.js.map +1 -1
  66. package/dist/design-system14.mjs +46 -42
  67. package/dist/design-system14.mjs.map +1 -1
  68. package/dist/design-system140.js +1 -1
  69. package/dist/design-system140.js.map +1 -1
  70. package/dist/design-system140.mjs +2 -12
  71. package/dist/design-system140.mjs.map +1 -1
  72. package/dist/design-system141.js +1 -1
  73. package/dist/design-system141.js.map +1 -1
  74. package/dist/design-system141.mjs +11 -7
  75. package/dist/design-system141.mjs.map +1 -1
  76. package/dist/design-system142.js +1 -1
  77. package/dist/design-system142.js.map +1 -1
  78. package/dist/design-system142.mjs +7 -9
  79. package/dist/design-system142.mjs.map +1 -1
  80. package/dist/design-system143.js +1 -1
  81. package/dist/design-system143.js.map +1 -1
  82. package/dist/design-system143.mjs +9 -5
  83. package/dist/design-system143.mjs.map +1 -1
  84. package/dist/design-system144.js +1 -1
  85. package/dist/design-system144.js.map +1 -1
  86. package/dist/design-system144.mjs +6 -10
  87. package/dist/design-system144.mjs.map +1 -1
  88. package/dist/design-system145.js +1 -1
  89. package/dist/design-system145.js.map +1 -1
  90. package/dist/design-system145.mjs +10 -2
  91. package/dist/design-system145.mjs.map +1 -1
  92. package/dist/design-system147.js +1 -1
  93. package/dist/design-system147.mjs +1 -1
  94. package/dist/design-system148.js +1 -1
  95. package/dist/design-system148.mjs +1 -1
  96. package/dist/design-system151.js +1 -1
  97. package/dist/design-system151.mjs +1 -1
  98. package/dist/design-system152.js +1 -1
  99. package/dist/design-system152.mjs +2 -2
  100. package/dist/design-system153.js +1 -1
  101. package/dist/design-system153.mjs +1 -1
  102. package/dist/design-system154.js +1 -1
  103. package/dist/design-system154.mjs +2 -2
  104. package/dist/design-system157.js +1 -1
  105. package/dist/design-system157.mjs +1 -1
  106. package/dist/design-system16.js +1 -1
  107. package/dist/design-system16.js.map +1 -1
  108. package/dist/design-system16.mjs +1 -1
  109. package/dist/design-system16.mjs.map +1 -1
  110. package/dist/design-system161.js +1 -1
  111. package/dist/design-system161.js.map +1 -1
  112. package/dist/design-system161.mjs +3 -2
  113. package/dist/design-system161.mjs.map +1 -1
  114. package/dist/design-system162.js +1 -1
  115. package/dist/design-system162.js.map +1 -1
  116. package/dist/design-system162.mjs +4 -3
  117. package/dist/design-system162.mjs.map +1 -1
  118. package/dist/design-system163.js +1 -1
  119. package/dist/design-system163.js.map +1 -1
  120. package/dist/design-system163.mjs +13 -4
  121. package/dist/design-system163.mjs.map +1 -1
  122. package/dist/design-system164.js +1 -1
  123. package/dist/design-system164.js.map +1 -1
  124. package/dist/design-system164.mjs +4 -12
  125. package/dist/design-system164.mjs.map +1 -1
  126. package/dist/design-system165.js +1 -1
  127. package/dist/design-system165.js.map +1 -1
  128. package/dist/design-system165.mjs +4 -5
  129. package/dist/design-system165.mjs.map +1 -1
  130. package/dist/design-system166.js +1 -1
  131. package/dist/design-system166.js.map +1 -1
  132. package/dist/design-system166.mjs +5 -4
  133. package/dist/design-system166.mjs.map +1 -1
  134. package/dist/design-system167.js +1 -1
  135. package/dist/design-system167.js.map +1 -1
  136. package/dist/design-system167.mjs +5 -5
  137. package/dist/design-system167.mjs.map +1 -1
  138. package/dist/design-system168.js +1 -1
  139. package/dist/design-system168.js.map +1 -1
  140. package/dist/design-system168.mjs +4 -4
  141. package/dist/design-system168.mjs.map +1 -1
  142. package/dist/design-system169.js +1 -1
  143. package/dist/design-system169.js.map +1 -1
  144. package/dist/design-system169.mjs +5 -5
  145. package/dist/design-system169.mjs.map +1 -1
  146. package/dist/design-system17.js +1 -1
  147. package/dist/design-system17.js.map +1 -1
  148. package/dist/design-system17.mjs +118 -113
  149. package/dist/design-system17.mjs.map +1 -1
  150. package/dist/design-system170.js +1 -1
  151. package/dist/design-system170.js.map +1 -1
  152. package/dist/design-system170.mjs +4 -4
  153. package/dist/design-system170.mjs.map +1 -1
  154. package/dist/design-system171.js +1 -1
  155. package/dist/design-system171.js.map +1 -1
  156. package/dist/design-system171.mjs +15 -5
  157. package/dist/design-system171.mjs.map +1 -1
  158. package/dist/design-system172.js +1 -1
  159. package/dist/design-system172.js.map +1 -1
  160. package/dist/design-system172.mjs +13 -14
  161. package/dist/design-system172.mjs.map +1 -1
  162. package/dist/design-system173.js +1 -1
  163. package/dist/design-system173.js.map +1 -1
  164. package/dist/design-system173.mjs +8 -13
  165. package/dist/design-system173.mjs.map +1 -1
  166. package/dist/design-system174.js +1 -1
  167. package/dist/design-system174.js.map +1 -1
  168. package/dist/design-system174.mjs +4 -9
  169. package/dist/design-system174.mjs.map +1 -1
  170. package/dist/design-system175.js +1 -1
  171. package/dist/design-system175.js.map +1 -1
  172. package/dist/design-system175.mjs +6 -4
  173. package/dist/design-system175.mjs.map +1 -1
  174. package/dist/design-system176.js +1 -1
  175. package/dist/design-system176.js.map +1 -1
  176. package/dist/design-system176.mjs +5 -5
  177. package/dist/design-system176.mjs.map +1 -1
  178. package/dist/design-system177.js +1 -1
  179. package/dist/design-system177.js.map +1 -1
  180. package/dist/design-system177.mjs +5 -5
  181. package/dist/design-system177.mjs.map +1 -1
  182. package/dist/design-system178.js +1 -1
  183. package/dist/design-system178.js.map +1 -1
  184. package/dist/design-system178.mjs +7 -5
  185. package/dist/design-system178.mjs.map +1 -1
  186. package/dist/design-system179.js +1 -1
  187. package/dist/design-system179.js.map +1 -1
  188. package/dist/design-system179.mjs +17 -7
  189. package/dist/design-system179.mjs.map +1 -1
  190. package/dist/design-system18.js +1 -1
  191. package/dist/design-system18.js.map +1 -1
  192. package/dist/design-system18.mjs +4 -9
  193. package/dist/design-system18.mjs.map +1 -1
  194. package/dist/design-system180.js +1 -1
  195. package/dist/design-system180.js.map +1 -1
  196. package/dist/design-system180.mjs +10 -17
  197. package/dist/design-system180.mjs.map +1 -1
  198. package/dist/design-system181.js +1 -1
  199. package/dist/design-system181.js.map +1 -1
  200. package/dist/design-system181.mjs +5 -10
  201. package/dist/design-system181.mjs.map +1 -1
  202. package/dist/design-system182.js +1 -1
  203. package/dist/design-system182.js.map +1 -1
  204. package/dist/design-system182.mjs +3 -4
  205. package/dist/design-system182.mjs.map +1 -1
  206. package/dist/design-system183.js +1 -1
  207. package/dist/design-system183.js.map +1 -1
  208. package/dist/design-system183.mjs +4 -4
  209. package/dist/design-system183.mjs.map +1 -1
  210. package/dist/design-system184.js +1 -1
  211. package/dist/design-system184.js.map +1 -1
  212. package/dist/design-system184.mjs +5 -4
  213. package/dist/design-system184.mjs.map +1 -1
  214. package/dist/design-system185.js +1 -1
  215. package/dist/design-system185.js.map +1 -1
  216. package/dist/design-system185.mjs +6 -5
  217. package/dist/design-system185.mjs.map +1 -1
  218. package/dist/design-system186.js +1 -1
  219. package/dist/design-system186.js.map +1 -1
  220. package/dist/design-system186.mjs +11 -7
  221. package/dist/design-system186.mjs.map +1 -1
  222. package/dist/design-system187.js +1 -1
  223. package/dist/design-system187.js.map +1 -1
  224. package/dist/design-system187.mjs +2 -11
  225. package/dist/design-system187.mjs.map +1 -1
  226. package/dist/design-system188.js +1 -1
  227. package/dist/design-system188.mjs +1 -1
  228. package/dist/design-system19.js +2 -2
  229. package/dist/design-system19.js.map +1 -1
  230. package/dist/design-system19.mjs +77 -65
  231. package/dist/design-system19.mjs.map +1 -1
  232. package/dist/design-system194.js +1 -1
  233. package/dist/design-system194.mjs +2 -2
  234. package/dist/design-system199.js +1 -1
  235. package/dist/design-system199.mjs +1 -1
  236. package/dist/design-system20.js +1 -1
  237. package/dist/design-system20.js.map +1 -1
  238. package/dist/design-system20.mjs +2 -2
  239. package/dist/design-system20.mjs.map +1 -1
  240. package/dist/design-system21.js +1 -1
  241. package/dist/design-system21.js.map +1 -1
  242. package/dist/design-system21.mjs +108 -101
  243. package/dist/design-system21.mjs.map +1 -1
  244. package/dist/design-system22.js +1 -1
  245. package/dist/design-system22.js.map +1 -1
  246. package/dist/design-system22.mjs +1 -1
  247. package/dist/design-system22.mjs.map +1 -1
  248. package/dist/design-system23.js +1 -1
  249. package/dist/design-system23.js.map +1 -1
  250. package/dist/design-system23.mjs +2 -2
  251. package/dist/design-system23.mjs.map +1 -1
  252. package/dist/design-system24.js +1 -1
  253. package/dist/design-system24.js.map +1 -1
  254. package/dist/design-system24.mjs +3 -8
  255. package/dist/design-system24.mjs.map +1 -1
  256. package/dist/design-system25.js +1 -1
  257. package/dist/design-system25.mjs +2 -2
  258. package/dist/design-system27.js +1 -1
  259. package/dist/design-system27.mjs +2 -2
  260. package/dist/design-system28.js +1 -1
  261. package/dist/design-system28.mjs +2 -2
  262. package/dist/design-system30.js.map +1 -1
  263. package/dist/design-system30.mjs.map +1 -1
  264. package/dist/design-system32.js +1 -1
  265. package/dist/design-system32.mjs +3 -3
  266. package/dist/design-system39.js +1 -1
  267. package/dist/design-system39.mjs +1 -1
  268. package/dist/design-system40.js +1 -1
  269. package/dist/design-system40.js.map +1 -1
  270. package/dist/design-system40.mjs +80 -83
  271. package/dist/design-system40.mjs.map +1 -1
  272. package/dist/design-system41.js +1 -1
  273. package/dist/design-system41.js.map +1 -1
  274. package/dist/design-system41.mjs +53 -34
  275. package/dist/design-system41.mjs.map +1 -1
  276. package/dist/design-system42.js +1 -1
  277. package/dist/design-system42.mjs +2 -2
  278. package/dist/design-system45.js +1 -1
  279. package/dist/design-system45.mjs +3 -3
  280. package/dist/design-system46.js.map +1 -1
  281. package/dist/design-system46.mjs.map +1 -1
  282. package/dist/design-system54.js +1 -1
  283. package/dist/design-system54.js.map +1 -1
  284. package/dist/design-system54.mjs +83 -67
  285. package/dist/design-system54.mjs.map +1 -1
  286. package/dist/design-system59.js +1 -1
  287. package/dist/design-system59.js.map +1 -1
  288. package/dist/design-system59.mjs +1 -1
  289. package/dist/design-system59.mjs.map +1 -1
  290. package/dist/design-system61.js.map +1 -1
  291. package/dist/design-system61.mjs.map +1 -1
  292. package/dist/design-system70.js +1 -1
  293. package/dist/design-system70.js.map +1 -1
  294. package/dist/design-system70.mjs +1 -1
  295. package/dist/design-system70.mjs.map +1 -1
  296. package/dist/design-system81.js +1 -1
  297. package/dist/design-system81.js.map +1 -1
  298. package/dist/design-system81.mjs +1 -1
  299. package/dist/design-system81.mjs.map +1 -1
  300. package/dist/design-system87.js +1 -1
  301. package/dist/design-system87.js.map +1 -1
  302. package/dist/design-system87.mjs +1 -1
  303. package/dist/design-system87.mjs.map +1 -1
  304. package/dist/design-system89.js +1 -1
  305. package/dist/design-system89.js.map +1 -1
  306. package/dist/design-system89.mjs +4 -4
  307. package/dist/design-system89.mjs.map +1 -1
  308. package/dist/design-system97.js +1 -1
  309. package/dist/design-system97.js.map +1 -1
  310. package/dist/design-system97.mjs +67 -16
  311. package/dist/design-system97.mjs.map +1 -1
  312. package/dist/design-system98.js +1 -1
  313. package/dist/design-system98.js.map +1 -1
  314. package/dist/design-system98.mjs +17 -1103
  315. package/dist/design-system98.mjs.map +1 -1
  316. package/dist/design-system99.js +1 -1
  317. package/dist/design-system99.js.map +1 -1
  318. package/dist/design-system99.mjs +5 -24
  319. package/dist/design-system99.mjs.map +1 -1
  320. package/dist/style.css +1 -1
  321. package/dist/types/components/BButton.vue.d.ts +2 -28
  322. package/dist/types/components/BCarousel/BCarousel.vue.d.ts +4 -2
  323. package/dist/types/components/BCheckbox.vue.d.ts +4 -2
  324. package/dist/types/components/BCollapse.vue.d.ts +4 -2
  325. package/dist/types/components/BCurrencyField.vue.d.ts +10 -5
  326. package/dist/types/components/BDatePicker.vue.d.ts +4 -2
  327. package/dist/types/components/BDateRangePicker.vue.d.ts +4 -2
  328. package/dist/types/components/BImagePicker/BImagePicker.vue.d.ts +6 -3
  329. package/dist/types/components/BImagePicker/BImagePreview.vue.d.ts +4 -2
  330. package/dist/types/components/BModal/BModal.vue.d.ts +4 -2
  331. package/dist/types/components/BModal/BModalContainer.vue.d.ts +4 -2
  332. package/dist/types/components/BMultiSelect.vue.d.ts +12 -6
  333. package/dist/types/components/BOtpField/BOtpField.vue.d.ts +10 -5
  334. package/dist/types/components/BOtpField/BOtpFieldBox.vue.d.ts +14 -7
  335. package/dist/types/components/BPagination.vue.d.ts +6 -3
  336. package/dist/types/components/BRadio.vue.d.ts +6 -3
  337. package/dist/types/components/BSelect.vue.d.ts +12 -6
  338. package/dist/types/components/BTabs/BTabs.vue.d.ts +4 -2
  339. package/dist/types/components/BTextField.vue.d.ts +24 -9
  340. package/dist/types/components/BTextarea.vue.d.ts +4 -2
  341. package/dist/types/components/BToast/BToast.vue.d.ts +4 -2
  342. package/dist/types/components/BToast/BToastItem.vue.d.ts +13 -14
  343. package/dist/types/components/BTooltip.vue.d.ts +4 -2
  344. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"design-system81.js","sources":["../src/components/BTabs/BTabs.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-22ce07e0\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-flex ds-flex-wrap ds-overflow-hidden ds-rounded-lg ds-border ds-border-gray-100 ds-bg-gray-100\" }\nconst _hoisted_2 = [\"onClick\"]\nconst _hoisted_3 = [\"id\"]\n\nimport type { BTabsHeader } from '@/types';\nimport { v4 as uuid } from 'uuid';\nimport { computed, nextTick, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTabsProps {\n /**\n * Array of header objects.\n */\n headers: BTabsHeader[];\n /**\n * Index of tab.\n */\n modelValue?: number;\n /**\n * CSS of header.\n */\n headerCssClass?: string;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTabs',\n props: {\n headers: {},\n modelValue: { default: undefined },\n headerCssClass: { default: '' }\n },\n emits: ['update:modelValue'],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\nconst tabContainer = ref<HTMLElement | null>(null);\nconst tabHeaders = ref<HTMLElement[] | null>(null);\nconst tabs = ref<Element[] | null>(null);\nconst activeTabIndex = ref(0);\n\n/**\n * Data\n */\nconst mValue = ref(0);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\nconst tabBodyId = computed(() => `id-${uuid()}`);\n\n/**\n * Watch\n */\nwatch(value, (val) => {\n selectTab(val);\n});\nwatch(\n () => props.headers,\n () => {\n nextTick(() => {\n initTabs();\n });\n },\n);\n\n/**\n * Methods\n */\nconst onClickTabHeader = (index: number) => {\n value.value = index;\n};\nconst selectTab = (index: number) => {\n if (tabs.value && tabHeaders.value) {\n // Set activeTabIndex item to the index of the element clicked\n activeTabIndex.value = index;\n // Remove any active classes\n [...tabs.value, ...tabHeaders.value].forEach((t) => {\n t.classList.remove('active');\n });\n // Add active classes where appropriate, to the active element\n if (\n tabs.value[activeTabIndex.value] &&\n tabHeaders.value[activeTabIndex.value]\n ) {\n tabs.value[activeTabIndex.value].classList.add('active');\n tabHeaders.value[activeTabIndex.value].classList.add('active');\n } else {\n // Nearest element if desired index is not found\n const nearestIndex = activeTabIndex.value - 1;\n if (nearestIndex >= 0) {\n tabs.value[nearestIndex].classList.add('active');\n tabHeaders.value[nearestIndex].classList.add('active');\n }\n }\n }\n};\nconst initTabs = () => {\n if (tabContainer.value) {\n // Selects all elements with the class '.tab', which are direct children of element with the id 'tabBodyId'\n tabs.value = [\n ...(tabContainer.value.querySelectorAll(\n `#${tabBodyId.value} > .tab`,\n ) as any),\n ];\n tabs.value.forEach((tab) => {\n if (tab.classList.contains('active')) {\n activeTabIndex.value = tabs.value!.indexOf(tab);\n }\n });\n selectTab(activeTabIndex.value);\n }\n};\n\n/**\n * Lifecycle Hooks\n */\nonMounted(() => {\n initTabs();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n ref_key: \"tabContainer\",\n ref: tabContainer\n }, [\n _renderSlot(_ctx.$slots, \"headers-prepend\", {}, undefined, true),\n _createElementVNode(\"ul\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.headers, (header, index) => {\n return (_openBlock(), _createElementBlock(\"li\", {\n key: index,\n ref_for: true,\n ref_key: \"tabHeaders\",\n ref: tabHeaders,\n class: _normalizeClass([[\n _ctx.headerCssClass,\n header.disabled ? 'ds-pointer-events-none ds-text-black/40' : '',\n ], \"tab-header ds-min-w-[5rem] ds-flex-1 ds-cursor-pointer ds-rounded-lg ds-p-2 ds-text-center ds-text-sm ds-font-medium ds-capitalize hover:ds-bg-slate-50 hover:ds-text-primary-t\"]),\n onClick: ($event: any) => (onClickTabHeader(index))\n }, _toDisplayString(header.text), 11, _hoisted_2))\n }), 128))\n ]),\n _renderSlot(_ctx.$slots, \"headers-append\", {}, undefined, true),\n _createElementVNode(\"div\", {\n id: tabBodyId.value,\n class: \"ds-w-full\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true)\n ], 8, _hoisted_3)\n ], 512))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","emit","props","tabContainer","ref","tabHeaders","tabs","activeTabIndex","mValue","value","computed","val","tabBodyId","uuid","watch","selectTab","nextTick","initTabs","onClickTabHeader","index","t","nearestIndex","tab","onMounted","_ctx","_cache","_openBlock","_createElementBlock","_renderSlot","_createElementVNode","_Fragment","_renderList","header","_normalizeClass","$event","_toDisplayString"],"mappings":"sEAIMA,EAAa,CAAE,MAAO,qGACtBC,EAAa,CAAC,SAAS,EACvBC,EAAa,CAAC,IAAI,EAwBIC,EAAiBC,kBAAA,CAC3C,OAAQ,QACR,MAAO,CACL,QAAS,CAAC,EACV,WAAY,CAAE,QAAS,MAAU,EACjC,eAAgB,CAAE,QAAS,EAAG,CAChC,EACA,MAAO,CAAC,mBAAmB,EAC3B,MAAMC,EAAc,CAAE,KAAAC,GAAQ,CAEhC,MAAMC,EAAQF,EASRG,EAAeC,MAAwB,IAAI,EAC3CC,EAAaD,MAA0B,IAAI,EAC3CE,EAAOF,MAAsB,IAAI,EACjCG,EAAiBH,MAAI,CAAC,EAKtBI,EAASJ,MAAI,CAAC,EACdK,EAAQC,EAAAA,SAAS,CACrB,KAAM,CACJ,OAAOR,EAAM,aAAe,OAAYA,EAAM,WAAaM,EAAO,KACpE,EACA,IAAIG,EAAK,CACHT,EAAM,aAAe,OACvBD,EAAK,oBAAqBU,CAAG,EAE7BH,EAAO,MAAQG,CAEnB,CAAA,CACD,EACKC,EAAYF,EAAAA,SAAS,IAAM,MAAMG,EAAA,CAAM,EAAE,EAKzCC,QAAAL,EAAQE,GAAQ,CACpBI,EAAUJ,CAAG,CAAA,CACd,EACDG,EAAA,MACE,IAAMZ,EAAM,QACZ,IAAM,CACJc,EAAAA,SAAS,IAAM,CACJC,GAAA,CACV,CACH,CAAA,EAMI,MAAAC,EAAoBC,GAAkB,CAC1CV,EAAM,MAAQU,CAAA,EAEVJ,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ACL,QAAS,GACT,QAAS,aACT,IAAKd,EACL,MAAO4B,iBAAgB,CAAC,CACxBT,EAAK,eACLQ,EAAO,SAAW,0CAA4C,EAChE,EAAG,iLAAiL,CAAC,EACnL,QAAUE,GAAiBhB,EAAiBC,CAAK,CAAA,EAChDgB,EAAAA,gBAAiBH,EAAO,IAAI,EAAG,GAAIpC,CAAU,EACjD,EAAG,GAAG,EAAA,CACR,EACDgC,aAAYJ,EAAK,OAAQ,iBAAkB,CAAA,EAAI,OAAW,EAAI,EAC9DK,EAAAA,mBAAoB,MAAO,CACzB,GAAIjB,EAAU,MACd,MAAO,WAAA,EACN,CACDgB,aAAYJ,EAAK,OAAQ,UAAW,CAAA,EAAI,OAAW,EAAI,CAAA,EACtD,EAAG3B,CAAU,GACf,GAAG,EAER,CAEA,CAAC"}
1
+ {"version":3,"file":"design-system81.js","sources":["../src/components/BTabs/BTabs.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-0e61b97f\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-flex ds-flex-wrap ds-overflow-hidden ds-rounded-lg ds-border ds-border-gray-100 ds-bg-gray-100\" }\nconst _hoisted_2 = [\"onClick\"]\nconst _hoisted_3 = [\"id\"]\n\nimport type { BTabsHeader } from '@/types';\nimport { v4 as uuid } from 'uuid';\nimport { computed, nextTick, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTabsProps {\n /**\n * Array of header objects.\n */\n headers: BTabsHeader[];\n /**\n * Index of tab.\n */\n modelValue?: number;\n /**\n * CSS of header.\n */\n headerCssClass?: string;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTabs',\n props: {\n headers: {},\n modelValue: { default: undefined },\n headerCssClass: { default: '' }\n },\n emits: [\"update:modelValue\"],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst tabContainer = ref<HTMLElement | null>(null);\nconst tabHeaders = ref<HTMLElement[] | null>(null);\nconst tabs = ref<Element[] | null>(null);\nconst activeTabIndex = ref(0);\nconst mValue = ref(0);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\nconst tabBodyId = computed(() => `id-${uuid()}`);\n\n/**\n * Watch\n */\nwatch(value, (val) => {\n selectTab(val);\n});\nwatch(\n () => props.headers,\n () => {\n nextTick(() => {\n initTabs();\n });\n },\n);\n\n/**\n * Methods\n */\nconst onClickTabHeader = (index: number) => {\n value.value = index;\n};\nconst selectTab = (index: number) => {\n if (tabs.value && tabHeaders.value) {\n // Set activeTabIndex item to the index of the element clicked\n activeTabIndex.value = index;\n // Remove any active classes\n [...tabs.value, ...tabHeaders.value].forEach((t) => {\n t.classList.remove('active');\n });\n // Add active classes where appropriate, to the active element\n if (\n tabs.value[activeTabIndex.value] &&\n tabHeaders.value[activeTabIndex.value]\n ) {\n tabs.value[activeTabIndex.value].classList.add('active');\n tabHeaders.value[activeTabIndex.value].classList.add('active');\n } else {\n // Nearest element if desired index is not found\n const nearestIndex = activeTabIndex.value - 1;\n if (nearestIndex >= 0) {\n tabs.value[nearestIndex].classList.add('active');\n tabHeaders.value[nearestIndex].classList.add('active');\n }\n }\n }\n};\nconst initTabs = () => {\n if (tabContainer.value) {\n // Selects all elements with the class '.tab', which are direct children of element with the id 'tabBodyId'\n tabs.value = [\n ...(tabContainer.value.querySelectorAll(\n `#${tabBodyId.value} > .tab`,\n ) as any),\n ];\n tabs.value.forEach((tab) => {\n if (tab.classList.contains('active')) {\n activeTabIndex.value = tabs.value!.indexOf(tab);\n }\n });\n selectTab(activeTabIndex.value);\n }\n};\n\n/**\n * Lifecycle Hooks\n */\nonMounted(() => {\n initTabs();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n ref_key: \"tabContainer\",\n ref: tabContainer\n }, [\n _renderSlot(_ctx.$slots, \"headers-prepend\", {}, undefined, true),\n _createElementVNode(\"ul\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.headers, (header, index) => {\n return (_openBlock(), _createElementBlock(\"li\", {\n key: index,\n ref_for: true,\n ref_key: \"tabHeaders\",\n ref: tabHeaders,\n class: _normalizeClass([[\n _ctx.headerCssClass,\n header.disabled ? 'ds-pointer-events-none ds-text-black/40' : '',\n ], \"tab-header ds-min-w-[5rem] ds-flex-1 ds-cursor-pointer ds-rounded-lg ds-p-2 ds-text-center ds-text-sm ds-font-medium ds-capitalize hover:ds-bg-slate-50 hover:ds-text-primary-t\"]),\n onClick: ($event: any) => (onClickTabHeader(index))\n }, _toDisplayString(header.text), 11, _hoisted_2))\n }), 128))\n ]),\n _renderSlot(_ctx.$slots, \"headers-append\", {}, undefined, true),\n _createElementVNode(\"div\", {\n id: tabBodyId.value,\n class: \"ds-w-full\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true)\n ], 8, _hoisted_3)\n ], 512))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","emit","props","tabContainer","ref","tabHeaders","tabs","activeTabIndex","mValue","value","computed","val","tabBodyId","uuid","watch","selectTab","nextTick","initTabs","onClickTabHeader","index","t","nearestIndex","tab","onMounted","_ctx","_cache","_openBlock","_createElementBlock","_renderSlot","_createElementVNode","_Fragment","_renderList","header","_normalizeClass","$event","_toDisplayString"],"mappings":"sEAIMA,EAAa,CAAE,MAAO,qGACtBC,EAAa,CAAC,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IjB,EAAU,MACd,MAAO,WAAA,EACN,CACDgB,aAAYJ,EAAK,OAAQ,UAAW,CAAA,EAAI,OAAW,EAAI,CAAA,EACtD,EAAG3B,CAAU,GACf,GAAG,EAER,CAEA,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as V, ref as d, computed as C, watch as k, nextTick as L, onMounted as T, openBlock as n, createElementBlock as u, renderSlot as i, createElementVNode as _, Fragment as $, renderList as w, normalizeClass as B, toDisplayString as E } from "vue";
2
- import H from "./design-system97.mjs";
2
+ import H from "./design-system98.mjs";
3
3
  const I = { class: "ds-flex ds-flex-wrap ds-overflow-hidden ds-rounded-lg ds-border ds-border-gray-100 ds-bg-gray-100" }, S = ["onClick"], z = ["id"], F = /* @__PURE__ */ V({
4
4
  __name: "BTabs",
5
5
  props: {
@@ -1 +1 @@
1
- {"version":3,"file":"design-system81.mjs","sources":["../src/components/BTabs/BTabs.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-22ce07e0\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-flex ds-flex-wrap ds-overflow-hidden ds-rounded-lg ds-border ds-border-gray-100 ds-bg-gray-100\" }\nconst _hoisted_2 = [\"onClick\"]\nconst _hoisted_3 = [\"id\"]\n\nimport type { BTabsHeader } from '@/types';\nimport { v4 as uuid } from 'uuid';\nimport { computed, nextTick, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTabsProps {\n /**\n * Array of header objects.\n */\n headers: BTabsHeader[];\n /**\n * Index of tab.\n */\n modelValue?: number;\n /**\n * CSS of header.\n */\n headerCssClass?: string;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTabs',\n props: {\n headers: {},\n modelValue: { default: undefined },\n headerCssClass: { default: '' }\n },\n emits: ['update:modelValue'],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\nconst tabContainer = ref<HTMLElement | null>(null);\nconst tabHeaders = ref<HTMLElement[] | null>(null);\nconst tabs = ref<Element[] | null>(null);\nconst activeTabIndex = ref(0);\n\n/**\n * Data\n */\nconst mValue = ref(0);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\nconst tabBodyId = computed(() => `id-${uuid()}`);\n\n/**\n * Watch\n */\nwatch(value, (val) => {\n selectTab(val);\n});\nwatch(\n () => props.headers,\n () => {\n nextTick(() => {\n initTabs();\n });\n },\n);\n\n/**\n * Methods\n */\nconst onClickTabHeader = (index: number) => {\n value.value = index;\n};\nconst selectTab = (index: number) => {\n if (tabs.value && tabHeaders.value) {\n // Set activeTabIndex item to the index of the element clicked\n activeTabIndex.value = index;\n // Remove any active classes\n [...tabs.value, ...tabHeaders.value].forEach((t) => {\n t.classList.remove('active');\n });\n // Add active classes where appropriate, to the active element\n if (\n tabs.value[activeTabIndex.value] &&\n tabHeaders.value[activeTabIndex.value]\n ) {\n tabs.value[activeTabIndex.value].classList.add('active');\n tabHeaders.value[activeTabIndex.value].classList.add('active');\n } else {\n // Nearest element if desired index is not found\n const nearestIndex = activeTabIndex.value - 1;\n if (nearestIndex >= 0) {\n tabs.value[nearestIndex].classList.add('active');\n tabHeaders.value[nearestIndex].classList.add('active');\n }\n }\n }\n};\nconst initTabs = () => {\n if (tabContainer.value) {\n // Selects all elements with the class '.tab', which are direct children of element with the id 'tabBodyId'\n tabs.value = [\n ...(tabContainer.value.querySelectorAll(\n `#${tabBodyId.value} > .tab`,\n ) as any),\n ];\n tabs.value.forEach((tab) => {\n if (tab.classList.contains('active')) {\n activeTabIndex.value = tabs.value!.indexOf(tab);\n }\n });\n selectTab(activeTabIndex.value);\n }\n};\n\n/**\n * Lifecycle Hooks\n */\nonMounted(() => {\n initTabs();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n ref_key: \"tabContainer\",\n ref: tabContainer\n }, [\n _renderSlot(_ctx.$slots, \"headers-prepend\", {}, undefined, true),\n _createElementVNode(\"ul\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.headers, (header, index) => {\n return (_openBlock(), _createElementBlock(\"li\", {\n key: index,\n ref_for: true,\n ref_key: \"tabHeaders\",\n ref: tabHeaders,\n class: _normalizeClass([[\n _ctx.headerCssClass,\n header.disabled ? 'ds-pointer-events-none ds-text-black/40' : '',\n ], \"tab-header ds-min-w-[5rem] ds-flex-1 ds-cursor-pointer ds-rounded-lg ds-p-2 ds-text-center ds-text-sm ds-font-medium ds-capitalize hover:ds-bg-slate-50 hover:ds-text-primary-t\"]),\n onClick: ($event: any) => (onClickTabHeader(index))\n }, _toDisplayString(header.text), 11, _hoisted_2))\n }), 128))\n ]),\n _renderSlot(_ctx.$slots, \"headers-append\", {}, undefined, true),\n _createElementVNode(\"div\", {\n id: tabBodyId.value,\n class: \"ds-w-full\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true)\n ], 8, _hoisted_3)\n ], 512))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","emit","props","tabContainer","ref","tabHeaders","tabs","activeTabIndex","mValue","value","computed","val","tabBodyId","uuid","watch","selectTab","nextTick","initTabs","onClickTabHeader","index","t","nearestIndex","tab","onMounted","_ctx","_cache","_openBlock","_createElementBlock","_renderSlot","_createElementVNode","_Fragment","_renderList","header","_normalizeClass","$event","_toDisplayString"],"mappings":";;AAIA,MAAMA,IAAa,EAAE,OAAO,uG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;AAAA,YACLQ,EAAO,WAAW,4CAA4C;AAAA,UAChE,GAAG,iLAAiL,CAAC;AAAA,UACnL,SAAS,CAACE,MAAiBhB,EAAiBC,CAAK;AAAA,QAAA,GAChDgB,EAAiBH,EAAO,IAAI,GAAG,IAAIpC,CAAU,EACjD,GAAG,GAAG;AAAA,MAAA,CACR;AAAA,MACDgC,EAAYJ,EAAK,QAAQ,kBAAkB,CAAA,GAAI,QAAW,EAAI;AAAA,MAC9DK,EAAoB,OAAO;AAAA,QACzB,IAAIjB,EAAU;AAAA,QACd,OAAO;AAAA,MAAA,GACN;AAAA,QACDgB,EAAYJ,EAAK,QAAQ,WAAW,CAAA,GAAI,QAAW,EAAI;AAAA,MAAA,GACtD,GAAG3B,CAAU;AAAA,OACf,GAAG;AAAA,EAER;AAEA,CAAC;"}
1
+ {"version":3,"file":"design-system81.mjs","sources":["../src/components/BTabs/BTabs.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-0e61b97f\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-flex ds-flex-wrap ds-overflow-hidden ds-rounded-lg ds-border ds-border-gray-100 ds-bg-gray-100\" }\nconst _hoisted_2 = [\"onClick\"]\nconst _hoisted_3 = [\"id\"]\n\nimport type { BTabsHeader } from '@/types';\nimport { v4 as uuid } from 'uuid';\nimport { computed, nextTick, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTabsProps {\n /**\n * Array of header objects.\n */\n headers: BTabsHeader[];\n /**\n * Index of tab.\n */\n modelValue?: number;\n /**\n * CSS of header.\n */\n headerCssClass?: string;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTabs',\n props: {\n headers: {},\n modelValue: { default: undefined },\n headerCssClass: { default: '' }\n },\n emits: [\"update:modelValue\"],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst tabContainer = ref<HTMLElement | null>(null);\nconst tabHeaders = ref<HTMLElement[] | null>(null);\nconst tabs = ref<Element[] | null>(null);\nconst activeTabIndex = ref(0);\nconst mValue = ref(0);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\nconst tabBodyId = computed(() => `id-${uuid()}`);\n\n/**\n * Watch\n */\nwatch(value, (val) => {\n selectTab(val);\n});\nwatch(\n () => props.headers,\n () => {\n nextTick(() => {\n initTabs();\n });\n },\n);\n\n/**\n * Methods\n */\nconst onClickTabHeader = (index: number) => {\n value.value = index;\n};\nconst selectTab = (index: number) => {\n if (tabs.value && tabHeaders.value) {\n // Set activeTabIndex item to the index of the element clicked\n activeTabIndex.value = index;\n // Remove any active classes\n [...tabs.value, ...tabHeaders.value].forEach((t) => {\n t.classList.remove('active');\n });\n // Add active classes where appropriate, to the active element\n if (\n tabs.value[activeTabIndex.value] &&\n tabHeaders.value[activeTabIndex.value]\n ) {\n tabs.value[activeTabIndex.value].classList.add('active');\n tabHeaders.value[activeTabIndex.value].classList.add('active');\n } else {\n // Nearest element if desired index is not found\n const nearestIndex = activeTabIndex.value - 1;\n if (nearestIndex >= 0) {\n tabs.value[nearestIndex].classList.add('active');\n tabHeaders.value[nearestIndex].classList.add('active');\n }\n }\n }\n};\nconst initTabs = () => {\n if (tabContainer.value) {\n // Selects all elements with the class '.tab', which are direct children of element with the id 'tabBodyId'\n tabs.value = [\n ...(tabContainer.value.querySelectorAll(\n `#${tabBodyId.value} > .tab`,\n ) as any),\n ];\n tabs.value.forEach((tab) => {\n if (tab.classList.contains('active')) {\n activeTabIndex.value = tabs.value!.indexOf(tab);\n }\n });\n selectTab(activeTabIndex.value);\n }\n};\n\n/**\n * Lifecycle Hooks\n */\nonMounted(() => {\n initTabs();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n ref_key: \"tabContainer\",\n ref: tabContainer\n }, [\n _renderSlot(_ctx.$slots, \"headers-prepend\", {}, undefined, true),\n _createElementVNode(\"ul\", _hoisted_1, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.headers, (header, index) => {\n return (_openBlock(), _createElementBlock(\"li\", {\n key: index,\n ref_for: true,\n ref_key: \"tabHeaders\",\n ref: tabHeaders,\n class: _normalizeClass([[\n _ctx.headerCssClass,\n header.disabled ? 'ds-pointer-events-none ds-text-black/40' : '',\n ], \"tab-header ds-min-w-[5rem] ds-flex-1 ds-cursor-pointer ds-rounded-lg ds-p-2 ds-text-center ds-text-sm ds-font-medium ds-capitalize hover:ds-bg-slate-50 hover:ds-text-primary-t\"]),\n onClick: ($event: any) => (onClickTabHeader(index))\n }, _toDisplayString(header.text), 11, _hoisted_2))\n }), 128))\n ]),\n _renderSlot(_ctx.$slots, \"headers-append\", {}, undefined, true),\n _createElementVNode(\"div\", {\n id: tabBodyId.value,\n class: \"ds-w-full\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true)\n ], 8, _hoisted_3)\n ], 512))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","emit","props","tabContainer","ref","tabHeaders","tabs","activeTabIndex","mValue","value","computed","val","tabBodyId","uuid","watch","selectTab","nextTick","initTabs","onClickTabHeader","index","t","nearestIndex","tab","onMounted","_ctx","_cache","_openBlock","_createElementBlock","_renderSlot","_createElementVNode","_Fragment","_renderList","header","_normalizeClass","$event","_toDisplayString"],"mappings":";;AAIA,MAAMA,IAAa,EAAE,OAAO,uGACtBC,IA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ACLQ,EAAO,WAAW,4CAA4C;AAAA,UAChE,GAAG,iLAAiL,CAAC;AAAA,UACnL,SAAS,CAACE,MAAiBhB,EAAiBC,CAAK;AAAA,QAAA,GAChDgB,EAAiBH,EAAO,IAAI,GAAG,IAAIpC,CAAU,EACjD,GAAG,GAAG;AAAA,MAAA,CACR;AAAA,MACDgC,EAAYJ,EAAK,QAAQ,kBAAkB,CAAA,GAAI,QAAW,EAAI;AAAA,MAC9DK,EAAoB,OAAO;AAAA,QACzB,IAAIjB,EAAU;AAAA,QACd,OAAO;AAAA,MAAA,GACN;AAAA,QACDgB,EAAYJ,EAAK,QAAQ,WAAW,CAAA,GAAI,QAAW,EAAI;AAAA,MAAA,GACtD,GAAG3B,CAAU;AAAA,OACf,GAAG;AAAA,EAER;AAEA,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("vue"),a=require("./design-system5.js"),y=r=>(e.pushScopeId("data-v-65d47649"),r=r(),e.popScopeId(),r),L={class:"ds-relative"},V=y(()=>e.createElementVNode("div",{class:"tooltip-arrow","data-popper-arrow":""},null,-1)),_=e.defineComponent({__name:"BTooltip",props:{modelValue:{type:Boolean,default:!1},position:{default:a.BTooltipPosition.Top},openEvent:{default:a.BTooltipOpenEvent.Hover}},emits:["update:modelValue"],setup(r,{emit:b}){const n=r,o=e.ref(null),s=e.ref(null),v=e.ref(!1),l=e.computed({get(){return n.modelValue!==void 0?n.modelValue:v.value},set(t){n.modelValue!==void 0?b("update:modelValue",t):v.value=t}});e.watch(()=>n.position,()=>{w(),E()}),e.watch(()=>n.openEvent,()=>{h(),k()});const c=()=>{l.value=!l.value},p=()=>{l.value=!0},g=()=>{l.value=!1},m=()=>{l.value=!0},f=()=>{l.value=!1},w=()=>{s.value&&(s.value.style.top="",s.value.style.right="",s.value.style.bottom="",s.value.style.left="")},E=()=>{if(s.value)switch(n.position){case a.BTooltipPosition.Bottom:s.value.style.top="4px";break;case a.BTooltipPosition.Top:default:s.value.style.bottom="24px";break}},k=()=>{var t,u,i,d,B;switch(n.openEvent){case a.BTooltipOpenEvent.Click:(t=o.value)==null||t.addEventListener("click",c);break;case a.BTooltipOpenEvent.Focus:(u=o.value)==null||u.addEventListener("focus",p),(i=o.value)==null||i.addEventListener("focusout",g);break;case a.BTooltipOpenEvent.Hover:default:(d=o.value)==null||d.addEventListener("mouseover",m),(B=o.value)==null||B.addEventListener("mouseleave",f);break}},h=()=>{var t,u,i,d;(t=o.value)==null||t.removeEventListener("click",c),(u=o.value)==null||u.removeEventListener("focus",p),(i=o.value)==null||i.removeEventListener("mouseover",m),(d=o.value)==null||d.removeEventListener("mouseleave",f)};return e.onMounted(()=>{k(),E()}),e.onBeforeUnmount(()=>{h()}),(t,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"toggleRef",ref:o,class:"ds-inline"},[e.renderSlot(t.$slots,"toggle",{},void 0,!0)],512),e.withDirectives(e.createElementVNode("div",L,[e.createElementVNode("div",{ref_key:"contentRef",ref:s,class:"ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/[0.65] ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300"},[e.renderSlot(t.$slots,"default",{},void 0,!0),V],512)],512),[[e.vShow,l.value]])],64))}});module.exports=_;
1
+ "use strict";const e=require("vue"),a=require("./design-system5.js"),y=r=>(e.pushScopeId("data-v-bf99da80"),r=r(),e.popScopeId(),r),L={class:"ds-relative"},V=y(()=>e.createElementVNode("div",{class:"tooltip-arrow","data-popper-arrow":""},null,-1)),_=e.defineComponent({__name:"BTooltip",props:{modelValue:{type:Boolean,default:!1},position:{default:a.BTooltipPosition.Top},openEvent:{default:a.BTooltipOpenEvent.Hover}},emits:["update:modelValue"],setup(r,{emit:b}){const n=r,o=e.ref(null),s=e.ref(null),v=e.ref(!1),l=e.computed({get(){return n.modelValue!==void 0?n.modelValue:v.value},set(t){n.modelValue!==void 0?b("update:modelValue",t):v.value=t}});e.watch(()=>n.position,()=>{w(),E()}),e.watch(()=>n.openEvent,()=>{h(),k()});const c=()=>{l.value=!l.value},p=()=>{l.value=!0},g=()=>{l.value=!1},m=()=>{l.value=!0},f=()=>{l.value=!1},w=()=>{s.value&&(s.value.style.top="",s.value.style.right="",s.value.style.bottom="",s.value.style.left="")},E=()=>{if(s.value)switch(n.position){case a.BTooltipPosition.Bottom:s.value.style.top="4px";break;case a.BTooltipPosition.Top:default:s.value.style.bottom="24px";break}},k=()=>{var t,u,i,d,B;switch(n.openEvent){case a.BTooltipOpenEvent.Click:(t=o.value)==null||t.addEventListener("click",c);break;case a.BTooltipOpenEvent.Focus:(u=o.value)==null||u.addEventListener("focus",p),(i=o.value)==null||i.addEventListener("focusout",g);break;case a.BTooltipOpenEvent.Hover:default:(d=o.value)==null||d.addEventListener("mouseover",m),(B=o.value)==null||B.addEventListener("mouseleave",f);break}},h=()=>{var t,u,i,d;(t=o.value)==null||t.removeEventListener("click",c),(u=o.value)==null||u.removeEventListener("focus",p),(i=o.value)==null||i.removeEventListener("mouseover",m),(d=o.value)==null||d.removeEventListener("mouseleave",f)};return e.onMounted(()=>{k(),E()}),e.onBeforeUnmount(()=>{h()}),(t,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{ref_key:"toggleRef",ref:o,class:"ds-inline"},[e.renderSlot(t.$slots,"toggle",{},void 0,!0)],512),e.withDirectives(e.createElementVNode("div",L,[e.createElementVNode("div",{ref_key:"contentRef",ref:s,class:"ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/[0.65] ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300"},[e.renderSlot(t.$slots,"default",{},void 0,!0),V],512)],512),[[e.vShow,l.value]])],64))}});module.exports=_;
2
2
  //# sourceMappingURL=design-system87.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"design-system87.js","sources":["../src/components/BTooltip.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createElementVNode as _createElementVNode, vShow as _vShow, withDirectives as _withDirectives, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-65d47649\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-relative\" }\nconst _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"div\", {\n class: \"tooltip-arrow\",\n \"data-popper-arrow\": \"\"\n}, null, -1))\n\nimport { BTooltipOpenEvent, BTooltipPosition } from '@/constants/Enums';\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTooltipProps {\n modelValue?: boolean;\n /**\n * Position of opened tooltip compare to its toggle.\n */\n position?: `${BTooltipPosition}`;\n /**\n * Event to open tooltip.\n */\n openEvent?: `${BTooltipOpenEvent}`;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTooltip',\n props: {\n modelValue: { type: Boolean, default: false },\n position: { default: BTooltipPosition.Top },\n openEvent: { default: BTooltipOpenEvent.Hover }\n },\n emits: ['update:modelValue'],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst toggleRef = ref<HTMLDivElement | null>(null);\nconst contentRef = ref<HTMLDivElement | null>(null);\nconst mValue = ref(false);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val: boolean) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\n\n/**\n * Watch\n */\nwatch(\n () => props.position,\n () => {\n resetContentPosition();\n ensureContentPosition();\n },\n);\nwatch(\n () => props.openEvent,\n () => {\n clearEventListeners();\n ensureEventListeners();\n },\n);\n\n/**\n * Methods\n */\nconst onClick = () => {\n value.value = !value.value;\n};\nconst onFocus = () => {\n value.value = true;\n};\nconst onFocusOut = () => {\n value.value = false;\n};\nconst onHover = () => {\n value.value = true;\n};\nconst onHoverOut = () => {\n value.value = false;\n};\nconst resetContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n contentRef.value.style.top = '';\n contentRef.value.style.right = '';\n contentRef.value.style.bottom = '';\n contentRef.value.style.left = '';\n};\nconst ensureContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n\n switch (props.position) {\n case BTooltipPosition.Bottom:\n contentRef.value.style.top = '4px';\n break;\n case BTooltipPosition.Top:\n default:\n contentRef.value.style.bottom = '24px';\n break;\n }\n};\nconst ensureEventListeners = () => {\n switch (props.openEvent) {\n case BTooltipOpenEvent.Click:\n toggleRef.value?.addEventListener('click', onClick);\n break;\n case BTooltipOpenEvent.Focus:\n toggleRef.value?.addEventListener('focus', onFocus);\n toggleRef.value?.addEventListener('focusout', onFocusOut);\n break;\n case BTooltipOpenEvent.Hover:\n default:\n toggleRef.value?.addEventListener('mouseover', onHover);\n toggleRef.value?.addEventListener('mouseleave', onHoverOut);\n break;\n }\n};\nconst clearEventListeners = () => {\n toggleRef.value?.removeEventListener('click', onClick);\n toggleRef.value?.removeEventListener('focus', onFocus);\n toggleRef.value?.removeEventListener('mouseover', onHover);\n toggleRef.value?.removeEventListener('mouseleave', onHoverOut);\n};\n\n/**\n * Lifecycle hooks\n */\nonMounted(() => {\n ensureEventListeners();\n ensureContentPosition();\n});\nonBeforeUnmount(() => {\n clearEventListeners();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(_Fragment, null, [\n _createElementVNode(\"div\", {\n ref_key: \"toggleRef\",\n ref: toggleRef,\n class: \"ds-inline\"\n }, [\n _renderSlot(_ctx.$slots, \"toggle\", {}, undefined, true)\n ], 512),\n _withDirectives(_createElementVNode(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", {\n ref_key: \"contentRef\",\n ref: contentRef,\n class: \"ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/[0.65] ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true),\n _hoisted_2\n ], 512)\n ], 512), [\n [_vShow, value.value]\n ])\n ], 64))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_createElementVNode","_sfc_main","_defineComponent","BTooltipPosition","BTooltipOpenEvent","__props","emit","props","toggleRef","ref","contentRef","mValue","value","computed","val","watch","resetContentPosition","ensureContentPosition","clearEventListeners","ensureEventListeners","onClick","onFocus","onFocusOut","onHover","onHoverOut","_a","_b","_c","_d","_e","onMounted","onBeforeUnmount","_ctx","_cache","_openBlock","_createElementBlock","_Fragment","_renderSlot","_withDirectives","_vShow"],"mappings":"qEAGMA,MAAqBC,EAAa,YAAA,iBAAiB,EAAEC,EAAEA,IAAIC,EAAAA,aAAcD,GACzEE,EAAa,CAAE,MAAO,eACtBC,EAA2BL,EAAa,IAAmBM,EAAA,mBAAoB,MAAO,CAC1F,MAAO,gBACP,oBAAqB,EACvB,EAAG,KAAM,EAAE,CAAC,EAoBgBC,EAAiBC,kBAAA,CAC3C,OAAQ,WACR,MAAO,CACL,WAAY,CAAE,KAAM,QAAS,QAAS,EAAM,EAC5C,SAAU,CAAE,QAASC,EAAA,iBAAiB,GAAI,EAC1C,UAAW,CAAE,QAASC,EAAA,kBAAkB,KAAM,CAChD,EACA,MAAO,CAAC,mBAAmB,EAC3B,MAAMC,EAAc,CAAE,KAAAC,GAAQ,CAEhC,MAAMC,EAAQF,EAYRG,EAAYC,MAA2B,IAAI,EAC3CC,EAAaD,MAA2B,IAAI,EAC5CE,EAASF,MAAI,EAAK,EAClBG,EAAQC,EAAAA,SAAS,CACrB,KAAM,CACJ,OAAON,EAAM,aAAe,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wB,EAAApB,EAAA,QAAA,MAAAoB,EAAO,iBAAiB,YAAaL,IACrCM,EAAArB,EAAA,QAAA,MAAAqB,EAAO,iBAAiB,aAAcL,GAChD,KACJ,CAAA,EAEIN,EAAsB,IAAM,cACtBO,EAAAjB,EAAA,QAAA,MAAAiB,EAAO,oBAAoB,QAASL,IACpCM,EAAAlB,EAAA,QAAA,MAAAkB,EAAO,oBAAoB,QAASL,IACpCM,EAAAnB,EAAA,QAAA,MAAAmB,EAAO,oBAAoB,YAAaJ,IACxCK,EAAApB,EAAA,QAAA,MAAAoB,EAAO,oBAAoB,aAAcJ,EAAU,EAM/DM,OAAAA,EAAAA,UAAU,IAAM,CACOX,IACCF,GAAA,CACvB,EACDc,EAAAA,gBAAgB,IAAM,CACAb,GAAA,CACrB,EAEM,CAACc,EAAUC,KACRC,YAAW,EAAGC,qBAAoBC,EAAAA,SAAW,KAAM,CACzDpC,EAAAA,mBAAoB,MAAO,CACzB,QAAS,YACT,IAAKQ,EACL,MAAO,WAAA,EACN,CACD6B,aAAYL,EAAK,OAAQ,SAAU,CAAA,EAAI,OAAW,EAAI,GACrD,GAAG,EACNM,iBAAgBtC,EAAAA,mBAAoB,MAAOF,EAAY,CACrDE,EAAAA,mBAAoB,MAAO,CACzB,QAAS,aACT,IAAKU,EACL,MAAO,iLAAA,EACN,CACD2B,aAAYL,EAAK,OAAQ,UAAW,CAAA,EAAI,OAAW,EAAI,EACvDjC,GACC,GAAG,CACR,EAAG,GAAG,EAAG,CACP,CAACwC,EAAQ,MAAA3B,EAAM,KAAK,CAAA,CACrB,GACA,EAAE,EAEP,CAEA,CAAC"}
1
+ {"version":3,"file":"design-system87.js","sources":["../src/components/BTooltip.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createElementVNode as _createElementVNode, vShow as _vShow, withDirectives as _withDirectives, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-bf99da80\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-relative\" }\nconst _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"div\", {\n class: \"tooltip-arrow\",\n \"data-popper-arrow\": \"\"\n}, null, -1))\n\nimport { BTooltipOpenEvent, BTooltipPosition } from '@/constants/Enums';\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTooltipProps {\n modelValue?: boolean;\n /**\n * Position of opened tooltip compare to its toggle.\n */\n position?: `${BTooltipPosition}`;\n /**\n * Event to open tooltip.\n */\n openEvent?: `${BTooltipOpenEvent}`;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTooltip',\n props: {\n modelValue: { type: Boolean, default: false },\n position: { default: BTooltipPosition.Top },\n openEvent: { default: BTooltipOpenEvent.Hover }\n },\n emits: [\"update:modelValue\"],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst toggleRef = ref<HTMLDivElement | null>(null);\nconst contentRef = ref<HTMLDivElement | null>(null);\nconst mValue = ref(false);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val: boolean) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\n\n/**\n * Watch\n */\nwatch(\n () => props.position,\n () => {\n resetContentPosition();\n ensureContentPosition();\n },\n);\nwatch(\n () => props.openEvent,\n () => {\n clearEventListeners();\n ensureEventListeners();\n },\n);\n\n/**\n * Methods\n */\nconst onClick = () => {\n value.value = !value.value;\n};\nconst onFocus = () => {\n value.value = true;\n};\nconst onFocusOut = () => {\n value.value = false;\n};\nconst onHover = () => {\n value.value = true;\n};\nconst onHoverOut = () => {\n value.value = false;\n};\nconst resetContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n contentRef.value.style.top = '';\n contentRef.value.style.right = '';\n contentRef.value.style.bottom = '';\n contentRef.value.style.left = '';\n};\nconst ensureContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n\n switch (props.position) {\n case BTooltipPosition.Bottom:\n contentRef.value.style.top = '4px';\n break;\n case BTooltipPosition.Top:\n default:\n contentRef.value.style.bottom = '24px';\n break;\n }\n};\nconst ensureEventListeners = () => {\n switch (props.openEvent) {\n case BTooltipOpenEvent.Click:\n toggleRef.value?.addEventListener('click', onClick);\n break;\n case BTooltipOpenEvent.Focus:\n toggleRef.value?.addEventListener('focus', onFocus);\n toggleRef.value?.addEventListener('focusout', onFocusOut);\n break;\n case BTooltipOpenEvent.Hover:\n default:\n toggleRef.value?.addEventListener('mouseover', onHover);\n toggleRef.value?.addEventListener('mouseleave', onHoverOut);\n break;\n }\n};\nconst clearEventListeners = () => {\n toggleRef.value?.removeEventListener('click', onClick);\n toggleRef.value?.removeEventListener('focus', onFocus);\n toggleRef.value?.removeEventListener('mouseover', onHover);\n toggleRef.value?.removeEventListener('mouseleave', onHoverOut);\n};\n\n/**\n * Lifecycle hooks\n */\nonMounted(() => {\n ensureEventListeners();\n ensureContentPosition();\n});\nonBeforeUnmount(() => {\n clearEventListeners();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(_Fragment, null, [\n _createElementVNode(\"div\", {\n ref_key: \"toggleRef\",\n ref: toggleRef,\n class: \"ds-inline\"\n }, [\n _renderSlot(_ctx.$slots, \"toggle\", {}, undefined, true)\n ], 512),\n _withDirectives(_createElementVNode(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", {\n ref_key: \"contentRef\",\n ref: contentRef,\n class: \"ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/[0.65] ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true),\n _hoisted_2\n ], 512)\n ], 512), [\n [_vShow, value.value]\n ])\n ], 64))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_createElementVNode","_sfc_main","_defineComponent","BTooltipPosition","BTooltipOpenEvent","__props","emit","props","toggleRef","ref","contentRef","mValue","value","computed","val","watch","resetContentPosition","ensureContentPosition","clearEventListeners","ensureEventListeners","onClick","onFocus","onFocusOut","onHover","onHoverOut","_a","_b","_c","_d","_e","onMounted","onBeforeUnmount","_ctx","_cache","_openBlock","_createElementBlock","_Fragment","_renderSlot","_withDirectives","_vShow"],"mappings":"qEAGMA,MAAqBC,EAAa,YAAA,iBAAiB,EAAEC,EAAEA,IAAIC,EAAAA,aAAcD,GACzEE,EAAa,CAAE,MAAO,eACtBC,EAA2BL,EAAa,IAAmBM,EAAA,mBAAoB,MAAO,CAC1F,MAAO,gBACP,oBAAqB,EACvB,EAAG,KAAM,EAAE,CAAC,EAoBgBC,EAAiBC,kBAAA,CAC3C,OAAQ,WACR,MAAO,CACL,WAAY,CAAE,KAAM,QAAS,QAAS,EAAM,EAC5C,SAAU,CAAE,QAASC,EAAA,iBAAiB,GAAI,EAC1C,UAAW,CAAE,QAASC,EAAA,kBAAkB,KAAM,CAChD,EACA,MAAO,CAAC,mBAAmB,EAC3B,MAAMC,EAAc,CAAE,KAAAC,GAAQ,CAEhC,MAAMC,EAAQF,EAYRG,EAAYC,MAA2B,IAAI,EAC3CC,EAAaD,MAA2B,IAAI,EAC5CE,EAASF,MAAI,EAAK,EAClBG,EAAQC,EAAAA,SAAS,CACrB,KAAM,CACJ,OAAON,EAAM,aAAe,OAAYA,EAAM,WAAaI,EAAO,KACpE,EACA,IAAIG,EAAc,CACZP,EAAM,aAAe,OACvBD,EAAK,oBAAqBQ,CAAG,EAE7BH,EAAO,MAAQG,CAEnB,CAAA,CACD,EAKDC,EAAA,MACE,IAAMR,EAAM,SAC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AA,MAAAiB,EAAO,oBAAoB,QAASL,IACpCM,EAAAlB,EAAA,QAAA,MAAAkB,EAAO,oBAAoB,QAASL,IACpCM,EAAAnB,EAAA,QAAA,MAAAmB,EAAO,oBAAoB,YAAaJ,IACxCK,EAAApB,EAAA,QAAA,MAAAoB,EAAO,oBAAoB,aAAcJ,EAAU,EAM/DM,OAAAA,EAAAA,UAAU,IAAM,CACOX,IACCF,GAAA,CACvB,EACDc,EAAAA,gBAAgB,IAAM,CACAb,GAAA,CACrB,EAEM,CAACc,EAAUC,KACRC,YAAW,EAAGC,qBAAoBC,EAAAA,SAAW,KAAM,CACzDpC,EAAAA,mBAAoB,MAAO,CACzB,QAAS,YACT,IAAKQ,EACL,MAAO,WAAA,EACN,CACD6B,aAAYL,EAAK,OAAQ,SAAU,CAAA,EAAI,OAAW,EAAI,GACrD,GAAG,EACNM,iBAAgBtC,EAAAA,mBAAoB,MAAOF,EAAY,CACrDE,EAAAA,mBAAoB,MAAO,CACzB,QAAS,aACT,IAAKU,EACL,MAAO,iLAAA,EACN,CACD2B,aAAYL,EAAK,OAAQ,UAAW,CAAA,EAAI,OAAW,EAAI,EACvDjC,GACC,GAAG,CACR,EAAG,GAAG,EAAG,CACP,CAACwC,EAAQ,MAAA3B,EAAM,KAAK,CAAA,CACrB,GACA,EAAE,EAEP,CAEA,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as x, ref as v, computed as C, watch as L, onMounted as S, onBeforeUnmount as T, openBlock as F, createElementBlock as H, Fragment as R, createElementVNode as d, renderSlot as _, withDirectives as I, vShow as O, pushScopeId as P, popScopeId as $ } from "vue";
2
2
  import { BTooltipPosition as c, BTooltipOpenEvent as i } from "./design-system5.mjs";
3
- const z = (a) => (P("data-v-65d47649"), a = a(), $(), a), D = { class: "ds-relative" }, M = /* @__PURE__ */ z(() => /* @__PURE__ */ d("div", {
3
+ const z = (a) => (P("data-v-bf99da80"), a = a(), $(), a), D = { class: "ds-relative" }, M = /* @__PURE__ */ z(() => /* @__PURE__ */ d("div", {
4
4
  class: "tooltip-arrow",
5
5
  "data-popper-arrow": ""
6
6
  }, null, -1)), j = /* @__PURE__ */ x({
@@ -1 +1 @@
1
- {"version":3,"file":"design-system87.mjs","sources":["../src/components/BTooltip.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createElementVNode as _createElementVNode, vShow as _vShow, withDirectives as _withDirectives, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-65d47649\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-relative\" }\nconst _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"div\", {\n class: \"tooltip-arrow\",\n \"data-popper-arrow\": \"\"\n}, null, -1))\n\nimport { BTooltipOpenEvent, BTooltipPosition } from '@/constants/Enums';\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTooltipProps {\n modelValue?: boolean;\n /**\n * Position of opened tooltip compare to its toggle.\n */\n position?: `${BTooltipPosition}`;\n /**\n * Event to open tooltip.\n */\n openEvent?: `${BTooltipOpenEvent}`;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTooltip',\n props: {\n modelValue: { type: Boolean, default: false },\n position: { default: BTooltipPosition.Top },\n openEvent: { default: BTooltipOpenEvent.Hover }\n },\n emits: ['update:modelValue'],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst toggleRef = ref<HTMLDivElement | null>(null);\nconst contentRef = ref<HTMLDivElement | null>(null);\nconst mValue = ref(false);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val: boolean) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\n\n/**\n * Watch\n */\nwatch(\n () => props.position,\n () => {\n resetContentPosition();\n ensureContentPosition();\n },\n);\nwatch(\n () => props.openEvent,\n () => {\n clearEventListeners();\n ensureEventListeners();\n },\n);\n\n/**\n * Methods\n */\nconst onClick = () => {\n value.value = !value.value;\n};\nconst onFocus = () => {\n value.value = true;\n};\nconst onFocusOut = () => {\n value.value = false;\n};\nconst onHover = () => {\n value.value = true;\n};\nconst onHoverOut = () => {\n value.value = false;\n};\nconst resetContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n contentRef.value.style.top = '';\n contentRef.value.style.right = '';\n contentRef.value.style.bottom = '';\n contentRef.value.style.left = '';\n};\nconst ensureContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n\n switch (props.position) {\n case BTooltipPosition.Bottom:\n contentRef.value.style.top = '4px';\n break;\n case BTooltipPosition.Top:\n default:\n contentRef.value.style.bottom = '24px';\n break;\n }\n};\nconst ensureEventListeners = () => {\n switch (props.openEvent) {\n case BTooltipOpenEvent.Click:\n toggleRef.value?.addEventListener('click', onClick);\n break;\n case BTooltipOpenEvent.Focus:\n toggleRef.value?.addEventListener('focus', onFocus);\n toggleRef.value?.addEventListener('focusout', onFocusOut);\n break;\n case BTooltipOpenEvent.Hover:\n default:\n toggleRef.value?.addEventListener('mouseover', onHover);\n toggleRef.value?.addEventListener('mouseleave', onHoverOut);\n break;\n }\n};\nconst clearEventListeners = () => {\n toggleRef.value?.removeEventListener('click', onClick);\n toggleRef.value?.removeEventListener('focus', onFocus);\n toggleRef.value?.removeEventListener('mouseover', onHover);\n toggleRef.value?.removeEventListener('mouseleave', onHoverOut);\n};\n\n/**\n * Lifecycle hooks\n */\nonMounted(() => {\n ensureEventListeners();\n ensureContentPosition();\n});\nonBeforeUnmount(() => {\n clearEventListeners();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(_Fragment, null, [\n _createElementVNode(\"div\", {\n ref_key: \"toggleRef\",\n ref: toggleRef,\n class: \"ds-inline\"\n }, [\n _renderSlot(_ctx.$slots, \"toggle\", {}, undefined, true)\n ], 512),\n _withDirectives(_createElementVNode(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", {\n ref_key: \"contentRef\",\n ref: contentRef,\n class: \"ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/[0.65] ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true),\n _hoisted_2\n ], 512)\n ], 512), [\n [_vShow, value.value]\n ])\n ], 64))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_createElementVNode","_sfc_main","_defineComponent","BTooltipPosition","BTooltipOpenEvent","__props","emit","props","toggleRef","ref","contentRef","mValue","value","computed","val","watch","resetContentPosition","ensureContentPosition","clearEventListeners","ensureEventListeners","onClick","onFocus","onFocusOut","onHover","onHoverOut","_a","_b","_c","_d","_e","onMounted","onBeforeUnmount","_ctx","_cache","_openBlock","_createElementBlock","_Fragment","_renderSlot","_withDirectives","_vShow"],"mappings":";;AAGA,MAAMA,IAAe,QAAMC,EAAa,iBAAiB,GAAEC,IAAEA,KAAIC,KAAcD,IACzEE,IAAa,EAAE,OAAO,iBACtBC,IAA2B,gBAAAL,EAAa,MAAmBM,gBAAAA,EAAoB,OAAO;AAAA,EAC1F,OAAO;AAAA,EACP,qBAAqB;AACvB,GAAG,MAAM,EAAE,CAAC,GAoBgBC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,YAAY,EAAE,MAAM,SAAS,SAAS,GAAM;AAAA,IAC5C,UAAU,EAAE,SAASC,EAAiB,IAAI;AAAA,IAC1C,WAAW,EAAE,SAASC,EAAkB,MAAM;AAAA,EAChD;AAAA,EACA,OAAO,C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AAO;AAAA,UACzB,SAAS;AAAA,UACT,KAAKU;AAAA,UACL,OAAO;AAAA,QAAA,GACN;AAAA,UACD2B,EAAYL,EAAK,QAAQ,WAAW,CAAA,GAAI,QAAW,EAAI;AAAA,UACvDjC;AAAA,WACC,GAAG;AAAA,MACR,GAAG,GAAG,GAAG;AAAA,QACP,CAACwC,GAAQ3B,EAAM,KAAK;AAAA,MAAA,CACrB;AAAA,OACA,EAAE;AAAA,EAEP;AAEA,CAAC;"}
1
+ {"version":3,"file":"design-system87.mjs","sources":["../src/components/BTooltip.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, createElementVNode as _createElementVNode, vShow as _vShow, withDirectives as _withDirectives, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-bf99da80\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-relative\" }\nconst _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"div\", {\n class: \"tooltip-arrow\",\n \"data-popper-arrow\": \"\"\n}, null, -1))\n\nimport { BTooltipOpenEvent, BTooltipPosition } from '@/constants/Enums';\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface BTooltipProps {\n modelValue?: boolean;\n /**\n * Position of opened tooltip compare to its toggle.\n */\n position?: `${BTooltipPosition}`;\n /**\n * Event to open tooltip.\n */\n openEvent?: `${BTooltipOpenEvent}`;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BTooltip',\n props: {\n modelValue: { type: Boolean, default: false },\n position: { default: BTooltipPosition.Top },\n openEvent: { default: BTooltipOpenEvent.Hover }\n },\n emits: [\"update:modelValue\"],\n setup(__props: any, { emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst toggleRef = ref<HTMLDivElement | null>(null);\nconst contentRef = ref<HTMLDivElement | null>(null);\nconst mValue = ref(false);\nconst value = computed({\n get() {\n return props.modelValue !== undefined ? props.modelValue : mValue.value;\n },\n set(val: boolean) {\n if (props.modelValue !== undefined) {\n emit('update:modelValue', val);\n } else {\n mValue.value = val;\n }\n },\n});\n\n/**\n * Watch\n */\nwatch(\n () => props.position,\n () => {\n resetContentPosition();\n ensureContentPosition();\n },\n);\nwatch(\n () => props.openEvent,\n () => {\n clearEventListeners();\n ensureEventListeners();\n },\n);\n\n/**\n * Methods\n */\nconst onClick = () => {\n value.value = !value.value;\n};\nconst onFocus = () => {\n value.value = true;\n};\nconst onFocusOut = () => {\n value.value = false;\n};\nconst onHover = () => {\n value.value = true;\n};\nconst onHoverOut = () => {\n value.value = false;\n};\nconst resetContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n contentRef.value.style.top = '';\n contentRef.value.style.right = '';\n contentRef.value.style.bottom = '';\n contentRef.value.style.left = '';\n};\nconst ensureContentPosition = () => {\n if (!contentRef.value) {\n return;\n }\n\n switch (props.position) {\n case BTooltipPosition.Bottom:\n contentRef.value.style.top = '4px';\n break;\n case BTooltipPosition.Top:\n default:\n contentRef.value.style.bottom = '24px';\n break;\n }\n};\nconst ensureEventListeners = () => {\n switch (props.openEvent) {\n case BTooltipOpenEvent.Click:\n toggleRef.value?.addEventListener('click', onClick);\n break;\n case BTooltipOpenEvent.Focus:\n toggleRef.value?.addEventListener('focus', onFocus);\n toggleRef.value?.addEventListener('focusout', onFocusOut);\n break;\n case BTooltipOpenEvent.Hover:\n default:\n toggleRef.value?.addEventListener('mouseover', onHover);\n toggleRef.value?.addEventListener('mouseleave', onHoverOut);\n break;\n }\n};\nconst clearEventListeners = () => {\n toggleRef.value?.removeEventListener('click', onClick);\n toggleRef.value?.removeEventListener('focus', onFocus);\n toggleRef.value?.removeEventListener('mouseover', onHover);\n toggleRef.value?.removeEventListener('mouseleave', onHoverOut);\n};\n\n/**\n * Lifecycle hooks\n */\nonMounted(() => {\n ensureEventListeners();\n ensureContentPosition();\n});\nonBeforeUnmount(() => {\n clearEventListeners();\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(_Fragment, null, [\n _createElementVNode(\"div\", {\n ref_key: \"toggleRef\",\n ref: toggleRef,\n class: \"ds-inline\"\n }, [\n _renderSlot(_ctx.$slots, \"toggle\", {}, undefined, true)\n ], 512),\n _withDirectives(_createElementVNode(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", {\n ref_key: \"contentRef\",\n ref: contentRef,\n class: \"ds-absolute ds-z-10 ds-inline-block ds-rounded-lg ds-bg-black/[0.65] ds-px-3 ds-py-2 ds-text-sm ds-font-medium ds-text-white ds-shadow-sm ds-transition-opacity ds-duration-300\"\n }, [\n _renderSlot(_ctx.$slots, \"default\", {}, undefined, true),\n _hoisted_2\n ], 512)\n ], 512), [\n [_vShow, value.value]\n ])\n ], 64))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_createElementVNode","_sfc_main","_defineComponent","BTooltipPosition","BTooltipOpenEvent","__props","emit","props","toggleRef","ref","contentRef","mValue","value","computed","val","watch","resetContentPosition","ensureContentPosition","clearEventListeners","ensureEventListeners","onClick","onFocus","onFocusOut","onHover","onHoverOut","_a","_b","_c","_d","_e","onMounted","onBeforeUnmount","_ctx","_cache","_openBlock","_createElementBlock","_Fragment","_renderSlot","_withDirectives","_vShow"],"mappings":";;AAGA,MAAMA,IAAe,QAAMC,EAAa,iBAAiB,GAAEC,IAAEA,KAAIC,KAAcD,IACzEE,IAAa,EAAE,OAAO,iBACtBC,IAA2B,gBAAAL,EAAa,MAAmBM,gBAAAA,EAAoB,OAAO;AAAA,EAC1F,OAAO;AAAA,EACP,qBAAqB;AACvB,GAAG,MAAM,EAAE,CAAC,GAoBgBC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAA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AAKQ;AAAA,QACL,OAAO;AAAA,MAAA,GACN;AAAA,QACD6B,EAAYL,EAAK,QAAQ,UAAU,CAAA,GAAI,QAAW,EAAI;AAAA,SACrD,GAAG;AAAA,MACNM,EAAgBtC,EAAoB,OAAOF,GAAY;AAAA,QACrDE,EAAoB,OAAO;AAAA,UACzB,SAAS;AAAA,UACT,KAAKU;AAAA,UACL,OAAO;AAAA,QAAA,GACN;AAAA,UACD2B,EAAYL,EAAK,QAAQ,WAAW,CAAA,GAAI,QAAW,EAAI;AAAA,UACvDjC;AAAA,WACC,GAAG;AAAA,MACR,GAAG,GAAG,GAAG;AAAA,QACP,CAACwC,GAAQ3B,EAAM,KAAK;AAAA,MAAA,CACrB;AAAA,OACA,EAAE;AAAA,EAEP;AAEA,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("vue"),h=require("./design-system4.js"),L=require("./design-system48.js"),P=require("./design-system104.js"),j=require("./design-system46.js"),A=require("./design-system3.js"),$=require("./design-system31.js"),U=require("./design-system11.js"),H=require("./design-system30.js"),O=require("./design-system97.js"),G=require("./design-system99.js"),J=d=>(t.pushScopeId("data-v-0ad5e718"),d=d(),t.popScopeId(),d),K={class:"ds-w-full"},Q={class:"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow"},W={key:0,class:"ds-flex ds-flex-wrap ds-justify-center ds-gap-1"},X=["onClick","onDragenter","onDragstart","onDrop"],Y=["src"],Z={class:"ds-flex ds-flex-wrap ds-justify-center"},ee=J(()=>t.createElementVNode("svg",{class:"ds-absolute -ds-bottom-[3px] ds-left-0 ds-h-4 ds-w-4 ds-fill-primary-t",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},[t.createElementVNode("path",{d:"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z"})],-1)),te=["accept","multiple"],ae=t.defineComponent({__name:"BImagePicker",props:{inputId:{default:""},modelValue:{},label:{default:""},multiple:{type:Boolean,default:!1},maxFileSize:{default:20},hideDetails:{type:Boolean,default:!1},required:{type:Boolean,default:!1},requiredErrorMessage:{default:""},validationRules:{default:void 0}},emits:["update:modelValue","change"],setup(d,{expose:y,emit:c}){const l=d,{t:p}=L.useI18n(),m=t.ref(null),_=t.ref(0),n=t.computed({get(){return l.modelValue},set(e){c("update:modelValue",e)}}),g=t.ref(!0),v=t.ref(!0),i=t.ref({visible:!1,url:""}),f=t.computed(()=>h.FileImageTypes.join(", ")),V=t.computed(()=>l.inputId||`id-${O()}`),k={validateRule:e=>!!e&&e.length>0,errorMessage:()=>l.requiredErrorMessage||p("ds.global.field_required")},B={validateRule:()=>g.value,errorMessage:()=>p("ds.components.base.image_picker.file_types_valid",{types:f.value})},D={validateRule:()=>v.value,errorMessage:()=>p("ds.components.base.image_picker.file_size_valid",{size:l.maxFileSize})},w=t.computed(()=>{let e=[];return l.required&&e.push(k),l.validationRules&&(e=e.concat(l.validationRules)),e.push(B),e.push(D),e.length?e:void 0}),{validate:u,validationResult:C}=A.useValidationField(V.value,n,w.value);y({validate:u});const I=(e,a)=>{_.value=e,a.target.classList.add("dragging"),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("index",e.toString())},b=e=>{e.target.classList.remove("dragging")},E=(e,a)=>{const s=a.target;_.value!==e&&s.classList.add("dropped-target")},q=e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},x=e=>{e.target.classList.remove("dropped-target")},F=(e,a)=>{a.preventDefault(),a.target.classList.remove("dropped-target");const r=parseInt(a.dataTransfer.getData("index")),o=n.value[r];n.value.splice(r,1),n.value.splice(e,0,o),c("change"),u()},N=()=>{var e;(e=m.value)==null||e.click()},R=e=>{let a=e.target.files||e.dataTransfer.files;a.length&&S(a)},S=e=>{Array.from(e).forEach(a=>{if(g.value=h.FileImageTypes.includes(a.type),v.value=z(a.size)<=l.maxFileSize,g.value&&v.value){let s=new FileReader;s.onload=r=>{l.multiple?n.value.push({url:r.target.result,file:a,type:a.type}):n.value.splice(0,1,{url:r.target.result,file:a,type:a.type}),c("change"),u()},s.readAsDataURL(a)}else u()})},T=(e,a)=>{e.stopPropagation(),n.value.splice(a,1),c("change"),u()},z=e=>e/1024**2,M=e=>{i.value.url=e.url,i.value.visible=!0};return(e,a)=>(t.openBlock(),t.createElementBlock("div",K,[t.createVNode($,{label:l.label},null,8,["label"]),t.createElementVNode("div",Q,[t.unref(G)(n.value)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",W,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,(s,r)=>(t.openBlock(),t.createElementBlock("div",{key:r,class:"draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",draggable:"true",onClick:o=>M(s),onDragend:b,onDragenter:o=>E(r,o),onDragleave:x,onDragover:q,onDragstart:o=>I(r,o),onDrop:o=>F(r,o)},[t.createElementVNode("img",{src:s.url,alt:"image",class:"ds-h-full ds-w-full ds-rounded-lg"},null,8,Y),t.createVNode(P,{class:"ds-right-1 ds-top-1 ds-h-8 ds-w-8",onClick:o=>T(o,r)},null,8,["onClick"])],40,X))),128))])),t.createElementVNode("div",Z,[t.createVNode(U,{onClick:N},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.$t("ds.components.base.image_picker.select_image")),1)]),"append-icon":t.withCtx(()=>[ee]),_:1}),t.createElementVNode("input",{ref_key:"inputRef",ref:m,accept:f.value,multiple:l.multiple,class:"ds-hidden",type:"file",onChange:R},null,40,te)])]),l.hideDetails?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(H,{key:0,"error-message":t.unref(C).errorMessage(),class:"mt-1"},null,8,["error-message"])),t.createVNode(j,{modelValue:i.value.visible,"onUpdate:modelValue":a[0]||(a[0]=s=>i.value.visible=s),url:i.value.url},null,8,["modelValue","url"])]))}});module.exports=ae;
1
+ "use strict";const t=require("vue"),h=require("./design-system4.js"),L=require("./design-system48.js"),P=require("./design-system104.js"),j=require("./design-system46.js"),A=require("./design-system3.js"),$=require("./design-system31.js"),U=require("./design-system11.js"),H=require("./design-system30.js"),O=require("./design-system98.js"),G=require("./design-system103.js"),J=d=>(t.pushScopeId("data-v-91ede486"),d=d(),t.popScopeId(),d),K={class:"ds-w-full"},Q={class:"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow"},W={key:0,class:"ds-flex ds-flex-wrap ds-justify-center ds-gap-1"},X=["onClick","onDragenter","onDragstart","onDrop"],Y=["src"],Z={class:"ds-flex ds-flex-wrap ds-justify-center"},ee=J(()=>t.createElementVNode("svg",{class:"ds-absolute -ds-bottom-[3px] ds-left-0 ds-h-4 ds-w-4 ds-fill-primary-t",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},[t.createElementVNode("path",{d:"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z"})],-1)),te=["accept","multiple"],ae=t.defineComponent({__name:"BImagePicker",props:{inputId:{default:""},modelValue:{},label:{default:""},multiple:{type:Boolean,default:!1},maxFileSize:{default:20},hideDetails:{type:Boolean,default:!1},required:{type:Boolean,default:!1},requiredErrorMessage:{default:""},validationRules:{default:void 0}},emits:["change","update:modelValue"],setup(d,{expose:y,emit:c}){const l=d,{t:p}=L.useI18n(),m=t.ref(null),_=t.ref(0),n=t.computed({get(){return l.modelValue},set(e){c("update:modelValue",e)}}),g=t.ref(!0),v=t.ref(!0),i=t.ref({visible:!1,url:""}),f=t.computed(()=>h.FileImageTypes.join(", ")),V=t.computed(()=>l.inputId||`id-${O()}`),k={validateRule:e=>!!e&&e.length>0,errorMessage:()=>l.requiredErrorMessage||p("ds.global.field_required")},B={validateRule:()=>g.value,errorMessage:()=>p("ds.components.base.image_picker.file_types_valid",{types:f.value})},D={validateRule:()=>v.value,errorMessage:()=>p("ds.components.base.image_picker.file_size_valid",{size:l.maxFileSize})},w=t.computed(()=>{let e=[];return l.required&&e.push(k),l.validationRules&&(e=e.concat(l.validationRules)),e.push(B),e.push(D),e.length?e:void 0}),{validate:u,validationResult:C}=A.useValidationField(V.value,n,w.value);y({validate:u});const I=(e,a)=>{_.value=e,a.target.classList.add("dragging"),a.dataTransfer.effectAllowed="move",a.dataTransfer.setData("index",e.toString())},b=e=>{e.target.classList.remove("dragging")},E=(e,a)=>{const s=a.target;_.value!==e&&s.classList.add("dropped-target")},q=e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},x=e=>{e.target.classList.remove("dropped-target")},F=(e,a)=>{a.preventDefault(),a.target.classList.remove("dropped-target");const r=parseInt(a.dataTransfer.getData("index")),o=n.value[r];n.value.splice(r,1),n.value.splice(e,0,o),c("change"),u()},N=()=>{var e;(e=m.value)==null||e.click()},R=e=>{let a=e.target.files||e.dataTransfer.files;a.length&&S(a)},S=e=>{Array.from(e).forEach(a=>{if(g.value=h.FileImageTypes.includes(a.type),v.value=z(a.size)<=l.maxFileSize,g.value&&v.value){let s=new FileReader;s.onload=r=>{l.multiple?n.value.push({url:r.target.result,file:a,type:a.type}):n.value.splice(0,1,{url:r.target.result,file:a,type:a.type}),c("change"),u()},s.readAsDataURL(a)}else u()})},T=(e,a)=>{e.stopPropagation(),n.value.splice(a,1),c("change"),u()},z=e=>e/1024**2,M=e=>{i.value.url=e.url,i.value.visible=!0};return(e,a)=>(t.openBlock(),t.createElementBlock("div",K,[t.createVNode($,{label:l.label},null,8,["label"]),t.createElementVNode("div",Q,[t.unref(G)(n.value)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",W,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.value,(s,r)=>(t.openBlock(),t.createElementBlock("div",{key:r,class:"draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",draggable:"true",onClick:o=>M(s),onDragend:b,onDragenter:o=>E(r,o),onDragleave:x,onDragover:q,onDragstart:o=>I(r,o),onDrop:o=>F(r,o)},[t.createElementVNode("img",{src:s.url,alt:"image",class:"ds-h-full ds-w-full ds-rounded-lg"},null,8,Y),t.createVNode(P,{class:"ds-right-1 ds-top-1 ds-h-8 ds-w-8",onClick:o=>T(o,r)},null,8,["onClick"])],40,X))),128))])),t.createElementVNode("div",Z,[t.createVNode(U,{onClick:N},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.$t("ds.components.base.image_picker.select_image")),1)]),"append-icon":t.withCtx(()=>[ee]),_:1}),t.createElementVNode("input",{ref_key:"inputRef",ref:m,accept:f.value,multiple:l.multiple,class:"ds-hidden",type:"file",onChange:R},null,40,te)])]),l.hideDetails?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(H,{key:0,"error-message":t.unref(C).errorMessage(),class:"mt-1"},null,8,["error-message"])),t.createVNode(j,{modelValue:i.value.visible,"onUpdate:modelValue":a[0]||(a[0]=s=>i.value.visible=s),url:i.value.url},null,8,["modelValue","url"])]))}});module.exports=ae;
2
2
  //# sourceMappingURL=design-system89.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"design-system89.js","sources":["../src/components/BImagePicker/BImagePicker.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-0ad5e718\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-w-full\" }\nconst _hoisted_2 = { class: \"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"ds-flex ds-flex-wrap ds-justify-center ds-gap-1\"\n}\nconst _hoisted_4 = [\"onClick\", \"onDragenter\", \"onDragstart\", \"onDrop\"]\nconst _hoisted_5 = [\"src\"]\nconst _hoisted_6 = { class: \"ds-flex ds-flex-wrap ds-justify-center\" }\nconst _hoisted_7 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-absolute -ds-bottom-[3px] ds-left-0 ds-h-4 ds-w-4 ds-fill-primary-t\",\n viewBox: \"0 0 512 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z\" })\n], -1))\nconst _hoisted_8 = [\"accept\", \"multiple\"]\n\nimport { FileImageTypes } from '@/constants/Common';\nimport type { FileItemRead } from '@/types';\nimport { isEmpty } from 'lodash-es';\nimport { v4 as uuid } from 'uuid';\nimport { computed, ref } from 'vue';\nimport { useI18n } from 'vue-i18n';\nimport BImagePickerCloseButton from './BImagePickerCloseButton.vue';\nimport ImagePreview from './BImagePreview.vue';\nimport type { ValidationRule } from '@/composables/Validation';\nimport { useValidationField } from '@/composables/Validation';\nimport BLabel from '../BLabel.vue';\nimport BButton from '../BButton.vue';\nimport BErrorMessage from '../BErrorMessage.vue';\n\n/**\n * Props\n */\nexport interface Props {\n inputId?: string;\n modelValue: FileItemRead[];\n label?: string;\n multiple?: boolean;\n maxFileSize?: number;\n hideDetails?: boolean;\n required?: boolean;\n requiredErrorMessage?: string;\n validationRules?: ValidationRule[];\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BImagePicker',\n props: {\n inputId: { default: '' },\n modelValue: {},\n label: { default: '' },\n multiple: { type: Boolean, default: false },\n maxFileSize: { default: 20 },\n hideDetails: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n requiredErrorMessage: { default: '' },\n validationRules: { default: undefined }\n },\n emits: ['update:modelValue', 'change'],\n setup(__props: any, { expose: __expose, emit }) {\n\nconst props = __props;\n\n/**\n * Drag & Drop: https://www.w3schools.com/jsref/event_ondragover.asp\n */\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst { t } = useI18n();\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst draggedIndex = ref(0);\nconst value = computed({\n get() {\n return props.modelValue;\n },\n set(val) {\n emit('update:modelValue', val);\n },\n});\nconst fileTypesValid = ref(true);\nconst fileSizeValid = ref(true);\nconst previewImage = ref({\n visible: false,\n url: '',\n});\nconst allowedTypes = computed(() => FileImageTypes.join(', '));\nconst id = computed(() => props.inputId || `id-${uuid()}`);\nconst validateRequired: ValidationRule = {\n validateRule: (val: FileItemRead[]) => !!val && val.length > 0,\n errorMessage: () =>\n props.requiredErrorMessage || t('ds.global.field_required'),\n};\nconst validateFileTypesValid: ValidationRule = {\n validateRule: () => fileTypesValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_types_valid', {\n types: allowedTypes.value,\n }),\n};\nconst validateFileSizeValid: ValidationRule = {\n validateRule: () => fileSizeValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_size_valid', {\n size: props.maxFileSize,\n }),\n};\nconst vRules = computed(() => {\n let result: ValidationRule[] = [];\n\n if (props.required) {\n result.push(validateRequired);\n }\n if (props.validationRules) {\n result = result.concat(props.validationRules);\n }\n result.push(validateFileTypesValid);\n result.push(validateFileSizeValid);\n\n return result.length ? result : undefined;\n});\nconst { validate, validationResult } = useValidationField(\n id.value,\n value,\n vRules.value,\n);\n__expose({ validate });\n\n/**\n * Methods\n */\n/* Events fired on the drag target */\nconst handleDragStart = (index: number, e: DragEvent) => {\n draggedIndex.value = index;\n const target = e.target as HTMLDivElement;\n target.classList.add('dragging');\n e.dataTransfer!.effectAllowed = 'move';\n e.dataTransfer!.setData('index', index.toString());\n};\nconst handleDragEnd = (e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n target.classList.remove('dragging');\n};\n/* Events fired on the drop target */\nconst handleDragEnter = (index: number, e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n if (draggedIndex.value !== index) {\n target.classList.add('dropped-target');\n }\n};\nconst handleDragOver = (e: DragEvent) => {\n // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element\n e.preventDefault();\n e.dataTransfer!.dropEffect = 'move';\n};\nconst handleDragLeave = (e: DragEvent) => {\n // When the draggable p element leaves the droptarget, reset the style\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n};\nconst handleDrop = (index: number, e: DragEvent) => {\n e.preventDefault();\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n const draggedIndex = parseInt(e.dataTransfer!.getData('index'));\n const draggedImg = value.value[draggedIndex];\n value.value.splice(draggedIndex, 1);\n value.value.splice(index, 0, draggedImg);\n\n emit('change');\n validate();\n};\nconst openFileDialog = () => {\n inputRef.value?.click();\n};\nconst onChangeInput = (e: any) => {\n let fileList: FileList = e.target.files || e.dataTransfer.files;\n if (!fileList.length) {\n return;\n }\n createFileImages(fileList);\n};\nconst createFileImages = (fileList: FileList) => {\n Array.from(fileList).forEach((file) => {\n fileTypesValid.value = FileImageTypes.includes(file.type);\n fileSizeValid.value = convertToMB(file.size) <= props.maxFileSize;\n\n if (fileTypesValid.value && fileSizeValid.value) {\n let reader: any = new FileReader();\n\n reader.onload = (f: any) => {\n if (props.multiple) {\n value.value.push({\n url: f.target.result,\n file,\n type: file.type,\n });\n } else {\n value.value.splice(0, 1, {\n url: f.target.result,\n file,\n type: file.type,\n });\n }\n\n emit('change');\n validate();\n };\n\n reader.readAsDataURL(file);\n } else {\n validate();\n }\n });\n};\nconst removeFileImage = (e: Event, index: number) => {\n e.stopPropagation();\n value.value.splice(index, 1);\n\n emit('change');\n validate();\n};\nconst convertToMB = (numberOfBytes: number) => numberOfBytes / 1024 ** 2;\nconst preview = (item: FileItemRead) => {\n previewImage.value.url = item.url;\n previewImage.value.visible = true;\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(BLabel, {\n label: props.label\n }, null, 8, [\"label\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n (!_unref(isEmpty)(value.value))\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_3, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(value.value, (item, index) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n key: index,\n class: \"draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: ($event: any) => (preview(item)),\n onDragend: handleDragEnd,\n onDragenter: ($event: any) => (handleDragEnter(index, $event)),\n onDragleave: handleDragLeave,\n onDragover: handleDragOver,\n onDragstart: ($event: any) => (handleDragStart(index, $event)),\n onDrop: ($event: any) => (handleDrop(index, $event))\n }, [\n _createElementVNode(\"img\", {\n src: item.url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_5),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: (e) => removeFileImage(e, index)\n }, null, 8, [\"onClick\"])\n ], 40, _hoisted_4))\n }), 128))\n ]))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"div\", _hoisted_6, [\n _createVNode(BButton, { onClick: openFileDialog }, {\n default: _withCtx(() => [\n _createTextVNode(_toDisplayString(_ctx.$t('ds.components.base.image_picker.select_image')), 1)\n ]),\n \"append-icon\": _withCtx(() => [\n _hoisted_7\n ]),\n _: 1\n }),\n _createElementVNode(\"input\", {\n ref_key: \"inputRef\",\n ref: inputRef,\n accept: allowedTypes.value,\n multiple: props.multiple,\n class: \"ds-hidden\",\n type: \"file\",\n onChange: onChangeInput\n }, null, 40, _hoisted_8)\n ])\n ]),\n (!props.hideDetails)\n ? (_openBlock(), _createBlock(BErrorMessage, {\n key: 0,\n \"error-message\": _unref(validationResult).errorMessage(),\n class: \"mt-1\"\n }, null, 8, [\"error-message\"]))\n : _createCommentVNode(\"\", true),\n _createVNode(ImagePreview, {\n modelValue: previewImage.value.visible,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((previewImage.value.visible) = $event)),\n url: previewImage.value.url\n }, null, 8, [\"modelValue\", \"url\"])\n ]))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_createElementVNode","_hoisted_8","_sfc_main","_defineComponent","__props","__expose","emit","props","t","useI18n","inputRef","ref","draggedIndex","value","computed","val","fileTypesValid","fileSizeValid","previewImage","allowedTypes","FileImageTypes","id","uuid","validateRequired","validateFileTypesValid","validateFileSizeValid","vRules","result","validate","validationResult","useValidationField","handleDragStart","index","e","handleDragEnd","handleDragEnter","target","handleDragOver","handleDragLeave","handleDrop","draggedImg","openFileDialog","_a","onChangeInput","fileList","createFileImages","file","convertToMB","reader","f","removeFileImage","numberOfBytes","preview","item","_ctx","_cache","_openBlock","_createElementBlock","_createVNode","BLabel","_unref","isEmpty","_createCommentVNode","_Fragment","_renderList","$event","BImagePickerCloseButton","BButton","_withCtx","_createTextVNode","_toDisplayString","_createBlock","BErrorMessage","ImagePreview"],"mappings":"uXAGMA,MAAqBC,EAAa,YAAA,iBAAiB,EAAEC,EAAEA,IAAIC,EAAAA,aAAcD,GACzEE,EAAa,CAAE,MAAO,aACtBC,EAAa,CAAE,MAAO,yEACtBC,EAAa,CACjB,IAAK,EACL,MAAO,iDACT,EACMC,EAAa,CAAC,UAAW,cAAe,cAAe,QAAQ,EAC/DC,EAAa,CAAC,KAAK,EACnBC,EAAa,CAAE,MAAO,0CACtBC,GAA2BV,EAAa,IAAmBW,EAAA,mBAAoB,MAAO,CAC1F,MAAO,yEACP,QAAS,cACT,MAAO,4BACT,EAAG,CACgCA,EAAAA,mBAAA,OAAQ,CAAE,EAAG,wgBAAygB,CACzjB,EAAG,EAAE,CAAC,EACAC,GAAa,CAAC,SAAU,UAAU,EA+BZC,GAAiBC,kBAAA,CAC3C,OAAQ,eACR,MAAO,CACL,QAAS,CAAE,QAAS,EAAG,EACvB,WAAY,CAAC,EACb,MAAO,CAAE,QAAS,EA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e,EAAAA,YAAaC,EAAe,CACzC,IAAK,EACL,gBAAiBZ,EAAA,MAAO/B,CAAgB,EAAE,aAAa,EACvD,MAAO,MAAA,EACN,KAAM,EAAG,CAAC,eAAe,CAAC,GAEjC6B,EAAAA,YAAae,EAAc,CACzB,WAAYvD,EAAa,MAAM,QAC/B,sBAAuBqC,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKU,GAAkB/C,EAAa,MAAM,QAAW+C,GAClG,IAAK/C,EAAa,MAAM,KACvB,KAAM,EAAG,CAAC,aAAc,KAAK,CAAC,CAAA,CAClC,EAEH,CAEA,CAAC"}
1
+ {"version":3,"file":"design-system89.js","sources":["../src/components/BImagePicker/BImagePicker.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-91ede486\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-w-full\" }\nconst _hoisted_2 = { class: \"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"ds-flex ds-flex-wrap ds-justify-center ds-gap-1\"\n}\nconst _hoisted_4 = [\"onClick\", \"onDragenter\", \"onDragstart\", \"onDrop\"]\nconst _hoisted_5 = [\"src\"]\nconst _hoisted_6 = { class: \"ds-flex ds-flex-wrap ds-justify-center\" }\nconst _hoisted_7 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-absolute -ds-bottom-[3px] ds-left-0 ds-h-4 ds-w-4 ds-fill-primary-t\",\n viewBox: \"0 0 512 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z\" })\n], -1))\nconst _hoisted_8 = [\"accept\", \"multiple\"]\n\nimport { FileImageTypes } from '@/constants/Common';\nimport type { FileItemRead } from '@/types';\nimport { isEmpty } from 'lodash-es';\nimport { v4 as uuid } from 'uuid';\nimport { computed, ref } from 'vue';\nimport { useI18n } from 'vue-i18n';\nimport BImagePickerCloseButton from './BImagePickerCloseButton.vue';\nimport ImagePreview from './BImagePreview.vue';\nimport type { ValidationRule } from '@/composables/Validation';\nimport { useValidationField } from '@/composables/Validation';\nimport BLabel from '../BLabel.vue';\nimport BButton from '../BButton.vue';\nimport BErrorMessage from '../BErrorMessage.vue';\n\n/**\n * Props\n */\nexport interface Props {\n inputId?: string;\n modelValue: FileItemRead[];\n label?: string;\n multiple?: boolean;\n maxFileSize?: number;\n hideDetails?: boolean;\n required?: boolean;\n requiredErrorMessage?: string;\n validationRules?: ValidationRule[];\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BImagePicker',\n props: {\n inputId: { default: '' },\n modelValue: {},\n label: { default: '' },\n multiple: { type: Boolean, default: false },\n maxFileSize: { default: 20 },\n hideDetails: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n requiredErrorMessage: { default: '' },\n validationRules: { default: undefined }\n },\n emits: [\"change\", \"update:modelValue\"],\n setup(__props: any, { expose: __expose, emit }) {\n\nconst props = __props;\n\n/**\n * Drag & Drop: https://www.w3schools.com/jsref/event_ondragover.asp\n */\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst { t } = useI18n();\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst draggedIndex = ref(0);\nconst value = computed({\n get() {\n return props.modelValue;\n },\n set(val) {\n emit('update:modelValue', val);\n },\n});\nconst fileTypesValid = ref(true);\nconst fileSizeValid = ref(true);\nconst previewImage = ref({\n visible: false,\n url: '',\n});\nconst allowedTypes = computed(() => FileImageTypes.join(', '));\nconst id = computed(() => props.inputId || `id-${uuid()}`);\nconst validateRequired: ValidationRule = {\n validateRule: (val: FileItemRead[]) => !!val && val.length > 0,\n errorMessage: () =>\n props.requiredErrorMessage || t('ds.global.field_required'),\n};\nconst validateFileTypesValid: ValidationRule = {\n validateRule: () => fileTypesValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_types_valid', {\n types: allowedTypes.value,\n }),\n};\nconst validateFileSizeValid: ValidationRule = {\n validateRule: () => fileSizeValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_size_valid', {\n size: props.maxFileSize,\n }),\n};\nconst vRules = computed(() => {\n let result: ValidationRule[] = [];\n\n if (props.required) {\n result.push(validateRequired);\n }\n if (props.validationRules) {\n result = result.concat(props.validationRules);\n }\n result.push(validateFileTypesValid);\n result.push(validateFileSizeValid);\n\n return result.length ? result : undefined;\n});\nconst { validate, validationResult } = useValidationField(\n id.value,\n value,\n vRules.value,\n);\n__expose({ validate });\n\n/**\n * Methods\n */\n/* Events fired on the drag target */\nconst handleDragStart = (index: number, e: DragEvent) => {\n draggedIndex.value = index;\n const target = e.target as HTMLDivElement;\n target.classList.add('dragging');\n e.dataTransfer!.effectAllowed = 'move';\n e.dataTransfer!.setData('index', index.toString());\n};\nconst handleDragEnd = (e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n target.classList.remove('dragging');\n};\n/* Events fired on the drop target */\nconst handleDragEnter = (index: number, e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n if (draggedIndex.value !== index) {\n target.classList.add('dropped-target');\n }\n};\nconst handleDragOver = (e: DragEvent) => {\n // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element\n e.preventDefault();\n e.dataTransfer!.dropEffect = 'move';\n};\nconst handleDragLeave = (e: DragEvent) => {\n // When the draggable p element leaves the droptarget, reset the style\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n};\nconst handleDrop = (index: number, e: DragEvent) => {\n e.preventDefault();\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n const draggedIndex = parseInt(e.dataTransfer!.getData('index'));\n const draggedImg = value.value[draggedIndex];\n value.value.splice(draggedIndex, 1);\n value.value.splice(index, 0, draggedImg);\n\n emit('change');\n validate();\n};\nconst openFileDialog = () => {\n inputRef.value?.click();\n};\nconst onChangeInput = (e: any) => {\n let fileList: FileList = e.target.files || e.dataTransfer.files;\n if (!fileList.length) {\n return;\n }\n createFileImages(fileList);\n};\nconst createFileImages = (fileList: FileList) => {\n Array.from(fileList).forEach((file) => {\n fileTypesValid.value = FileImageTypes.includes(file.type);\n fileSizeValid.value = convertToMB(file.size) <= props.maxFileSize;\n\n if (fileTypesValid.value && fileSizeValid.value) {\n let reader: any = new FileReader();\n\n reader.onload = (f: any) => {\n if (props.multiple) {\n value.value.push({\n url: f.target.result,\n file,\n type: file.type,\n });\n } else {\n value.value.splice(0, 1, {\n url: f.target.result,\n file,\n type: file.type,\n });\n }\n\n emit('change');\n validate();\n };\n\n reader.readAsDataURL(file);\n } else {\n validate();\n }\n });\n};\nconst removeFileImage = (e: Event, index: number) => {\n e.stopPropagation();\n value.value.splice(index, 1);\n\n emit('change');\n validate();\n};\nconst convertToMB = (numberOfBytes: number) => numberOfBytes / 1024 ** 2;\nconst preview = (item: FileItemRead) => {\n previewImage.value.url = item.url;\n previewImage.value.visible = true;\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(BLabel, {\n label: props.label\n }, null, 8, [\"label\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n (!_unref(isEmpty)(value.value))\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_3, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(value.value, (item, index) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n key: index,\n class: \"draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: ($event: any) => (preview(item)),\n onDragend: handleDragEnd,\n onDragenter: ($event: any) => (handleDragEnter(index, $event)),\n onDragleave: handleDragLeave,\n onDragover: handleDragOver,\n onDragstart: ($event: any) => (handleDragStart(index, $event)),\n onDrop: ($event: any) => (handleDrop(index, $event))\n }, [\n _createElementVNode(\"img\", {\n src: item.url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_5),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: (e) => removeFileImage(e, index)\n }, null, 8, [\"onClick\"])\n ], 40, _hoisted_4))\n }), 128))\n ]))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"div\", _hoisted_6, [\n _createVNode(BButton, { onClick: openFileDialog }, {\n default: _withCtx(() => [\n _createTextVNode(_toDisplayString(_ctx.$t('ds.components.base.image_picker.select_image')), 1)\n ]),\n \"append-icon\": _withCtx(() => [\n _hoisted_7\n ]),\n _: 1\n }),\n _createElementVNode(\"input\", {\n ref_key: \"inputRef\",\n ref: inputRef,\n accept: allowedTypes.value,\n multiple: props.multiple,\n class: \"ds-hidden\",\n type: \"file\",\n onChange: onChangeInput\n }, null, 40, _hoisted_8)\n ])\n ]),\n (!props.hideDetails)\n ? (_openBlock(), _createBlock(BErrorMessage, {\n key: 0,\n \"error-message\": _unref(validationResult).errorMessage(),\n class: \"mt-1\"\n }, null, 8, [\"error-message\"]))\n : _createCommentVNode(\"\", true),\n _createVNode(ImagePreview, {\n modelValue: previewImage.value.visible,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((previewImage.value.visible) = $event)),\n url: previewImage.value.url\n }, null, 8, [\"modelValue\", \"url\"])\n ]))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_createElementVNode","_hoisted_8","_sfc_main","_defineComponent","__props","__expose","emit","props","t","useI18n","inputRef","ref","draggedIndex","value","computed","val","fileTypesValid","fileSizeValid","previewImage","allowedTypes","FileImageTypes","id","uuid","validateRequired","validateFileTypesValid","validateFileSizeValid","vRules","result","validate","validationResult","useValidationField","handleDragStart","index","e","handleDragEnd","handleDragEnter","target","handleDragOver","handleDragLeave","handleDrop","draggedImg","openFileDialog","_a","onChangeInput","fileList","createFileImages","file","convertToMB","reader","f","removeFileImage","numberOfBytes","preview","item","_ctx","_cache","_openBlock","_createElementBlock","_createVNode","BLabel","_unref","isEmpty","_createCommentVNode","_Fragment","_renderList","$event","BImagePickerCloseButton","BButton","_withCtx","_createTextVNode","_toDisplayString","_createBlock","BErrorMessage","ImagePreview"],"mappings":"wXAGMA,MAAqBC,EAAa,YAAA,iBAAiB,EAAEC,EAAEA,IAAIC,EAAAA,aAAcD,GACzEE,EAAa,CAAE,MAAO,aACtBC,EAAa,CAAE,MAAO,yEACtBC,EAAa,CACjB,IAAK,EACL,MAAO,iDACT,EACMC,EAAa,CAAC,UAAW,cAAe,cAAe,QAAQ,EAC/DC,EAAa,CAAC,KAAK,EACnBC,EAAa,CAAE,MAAO,0CACtBC,GAA2BV,EAAa,IAAmBW,EAAA,mBAAoB,MAAO,CAC1F,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,CAAA,CACJ,EACDC,EAAAA,mBAAoB,QAAS,CAC3B,QAAS,WACT,IAAKU,EACL,OAAQS,EAAa,MACrB,SAAUZ,EAAM,SAChB,MAAO,YACP,KAAM,OACN,SAAUoC,CAAA,EACT,KAAM,GAAI1C,EAAU,CAAA,CACxB,CAAA,CACF,EACCM,EAAM,YAMJuD,EAAoB,mBAAA,GAAI,EAAI,GAL3BN,EAAW,UAAA,EAAGe,EAAAA,YAAaC,EAAe,CACzC,IAAK,EACL,gBAAiBZ,EAAA,MAAO/B,CAAgB,EAAE,aAAa,EACvD,MAAO,MAAA,EACN,KAAM,EAAG,CAAC,eAAe,CAAC,GAEjC6B,EAAAA,YAAae,EAAc,CACzB,WAAYvD,EAAa,MAAM,QAC/B,sBAAuBqC,EAAO,CAAC,IAAMA,EAAO,CAAC,EAAKU,GAAkB/C,EAAa,MAAM,QAAW+C,GAClG,IAAK/C,EAAa,MAAM,KACvB,KAAM,EAAG,CAAC,aAAc,KAAK,CAAC,CAAA,CAClC,EAEH,CAEA,CAAC"}
@@ -7,9 +7,9 @@ import { useValidationField as le } from "./design-system3.mjs";
7
7
  import se from "./design-system31.mjs";
8
8
  import re from "./design-system11.mjs";
9
9
  import oe from "./design-system30.mjs";
10
- import de from "./design-system97.mjs";
11
- import ne from "./design-system99.mjs";
12
- const ie = (n) => (Y("data-v-0ad5e718"), n = n(), Z(), n), ue = { class: "ds-w-full" }, ce = { class: "ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow" }, pe = {
10
+ import de from "./design-system98.mjs";
11
+ import ne from "./design-system103.mjs";
12
+ const ie = (n) => (Y("data-v-91ede486"), n = n(), Z(), n), ue = { class: "ds-w-full" }, ce = { class: "ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow" }, pe = {
13
13
  key: 0,
14
14
  class: "ds-flex ds-flex-wrap ds-justify-center ds-gap-1"
15
15
  }, ge = ["onClick", "onDragenter", "onDragstart", "onDrop"], me = ["src"], ve = { class: "ds-flex ds-flex-wrap ds-justify-center" }, fe = /* @__PURE__ */ ie(() => /* @__PURE__ */ d("svg", {
@@ -31,7 +31,7 @@ const ie = (n) => (Y("data-v-0ad5e718"), n = n(), Z(), n), ue = { class: "ds-w-f
31
31
  requiredErrorMessage: { default: "" },
32
32
  validationRules: { default: void 0 }
33
33
  },
34
- emits: ["update:modelValue", "change"],
34
+ emits: ["change", "update:modelValue"],
35
35
  setup(n, { expose: x, emit: g }) {
36
36
  const a = n, { t: h } = ee(), D = c(null), w = c(0), o = m({
37
37
  get() {
@@ -1 +1 @@
1
- {"version":3,"file":"design-system89.mjs","sources":["../src/components/BImagePicker/BImagePicker.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-0ad5e718\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-w-full\" }\nconst _hoisted_2 = { class: \"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"ds-flex ds-flex-wrap ds-justify-center ds-gap-1\"\n}\nconst _hoisted_4 = [\"onClick\", \"onDragenter\", \"onDragstart\", \"onDrop\"]\nconst _hoisted_5 = [\"src\"]\nconst _hoisted_6 = { class: \"ds-flex ds-flex-wrap ds-justify-center\" }\nconst _hoisted_7 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-absolute -ds-bottom-[3px] ds-left-0 ds-h-4 ds-w-4 ds-fill-primary-t\",\n viewBox: \"0 0 512 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z\" })\n], -1))\nconst _hoisted_8 = [\"accept\", \"multiple\"]\n\nimport { FileImageTypes } from '@/constants/Common';\nimport type { FileItemRead } from '@/types';\nimport { isEmpty } from 'lodash-es';\nimport { v4 as uuid } from 'uuid';\nimport { computed, ref } from 'vue';\nimport { useI18n } from 'vue-i18n';\nimport BImagePickerCloseButton from './BImagePickerCloseButton.vue';\nimport ImagePreview from './BImagePreview.vue';\nimport type { ValidationRule } from '@/composables/Validation';\nimport { useValidationField } from '@/composables/Validation';\nimport BLabel from '../BLabel.vue';\nimport BButton from '../BButton.vue';\nimport BErrorMessage from '../BErrorMessage.vue';\n\n/**\n * Props\n */\nexport interface Props {\n inputId?: string;\n modelValue: FileItemRead[];\n label?: string;\n multiple?: boolean;\n maxFileSize?: number;\n hideDetails?: boolean;\n required?: boolean;\n requiredErrorMessage?: string;\n validationRules?: ValidationRule[];\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BImagePicker',\n props: {\n inputId: { default: '' },\n modelValue: {},\n label: { default: '' },\n multiple: { type: Boolean, default: false },\n maxFileSize: { default: 20 },\n hideDetails: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n requiredErrorMessage: { default: '' },\n validationRules: { default: undefined }\n },\n emits: ['update:modelValue', 'change'],\n setup(__props: any, { expose: __expose, emit }) {\n\nconst props = __props;\n\n/**\n * Drag & Drop: https://www.w3schools.com/jsref/event_ondragover.asp\n */\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst { t } = useI18n();\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst draggedIndex = ref(0);\nconst value = computed({\n get() {\n return props.modelValue;\n },\n set(val) {\n emit('update:modelValue', val);\n },\n});\nconst fileTypesValid = ref(true);\nconst fileSizeValid = ref(true);\nconst previewImage = ref({\n visible: false,\n url: '',\n});\nconst allowedTypes = computed(() => FileImageTypes.join(', '));\nconst id = computed(() => props.inputId || `id-${uuid()}`);\nconst validateRequired: ValidationRule = {\n validateRule: (val: FileItemRead[]) => !!val && val.length > 0,\n errorMessage: () =>\n props.requiredErrorMessage || t('ds.global.field_required'),\n};\nconst validateFileTypesValid: ValidationRule = {\n validateRule: () => fileTypesValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_types_valid', {\n types: allowedTypes.value,\n }),\n};\nconst validateFileSizeValid: ValidationRule = {\n validateRule: () => fileSizeValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_size_valid', {\n size: props.maxFileSize,\n }),\n};\nconst vRules = computed(() => {\n let result: ValidationRule[] = [];\n\n if (props.required) {\n result.push(validateRequired);\n }\n if (props.validationRules) {\n result = result.concat(props.validationRules);\n }\n result.push(validateFileTypesValid);\n result.push(validateFileSizeValid);\n\n return result.length ? result : undefined;\n});\nconst { validate, validationResult } = useValidationField(\n id.value,\n value,\n vRules.value,\n);\n__expose({ validate });\n\n/**\n * Methods\n */\n/* Events fired on the drag target */\nconst handleDragStart = (index: number, e: DragEvent) => {\n draggedIndex.value = index;\n const target = e.target as HTMLDivElement;\n target.classList.add('dragging');\n e.dataTransfer!.effectAllowed = 'move';\n e.dataTransfer!.setData('index', index.toString());\n};\nconst handleDragEnd = (e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n target.classList.remove('dragging');\n};\n/* Events fired on the drop target */\nconst handleDragEnter = (index: number, e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n if (draggedIndex.value !== index) {\n target.classList.add('dropped-target');\n }\n};\nconst handleDragOver = (e: DragEvent) => {\n // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element\n e.preventDefault();\n e.dataTransfer!.dropEffect = 'move';\n};\nconst handleDragLeave = (e: DragEvent) => {\n // When the draggable p element leaves the droptarget, reset the style\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n};\nconst handleDrop = (index: number, e: DragEvent) => {\n e.preventDefault();\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n const draggedIndex = parseInt(e.dataTransfer!.getData('index'));\n const draggedImg = value.value[draggedIndex];\n value.value.splice(draggedIndex, 1);\n value.value.splice(index, 0, draggedImg);\n\n emit('change');\n validate();\n};\nconst openFileDialog = () => {\n inputRef.value?.click();\n};\nconst onChangeInput = (e: any) => {\n let fileList: FileList = e.target.files || e.dataTransfer.files;\n if (!fileList.length) {\n return;\n }\n createFileImages(fileList);\n};\nconst createFileImages = (fileList: FileList) => {\n Array.from(fileList).forEach((file) => {\n fileTypesValid.value = FileImageTypes.includes(file.type);\n fileSizeValid.value = convertToMB(file.size) <= props.maxFileSize;\n\n if (fileTypesValid.value && fileSizeValid.value) {\n let reader: any = new FileReader();\n\n reader.onload = (f: any) => {\n if (props.multiple) {\n value.value.push({\n url: f.target.result,\n file,\n type: file.type,\n });\n } else {\n value.value.splice(0, 1, {\n url: f.target.result,\n file,\n type: file.type,\n });\n }\n\n emit('change');\n validate();\n };\n\n reader.readAsDataURL(file);\n } else {\n validate();\n }\n });\n};\nconst removeFileImage = (e: Event, index: number) => {\n e.stopPropagation();\n value.value.splice(index, 1);\n\n emit('change');\n validate();\n};\nconst convertToMB = (numberOfBytes: number) => numberOfBytes / 1024 ** 2;\nconst preview = (item: FileItemRead) => {\n previewImage.value.url = item.url;\n previewImage.value.visible = true;\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(BLabel, {\n label: props.label\n }, null, 8, [\"label\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n (!_unref(isEmpty)(value.value))\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_3, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(value.value, (item, index) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n key: index,\n class: \"draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: ($event: any) => (preview(item)),\n onDragend: handleDragEnd,\n onDragenter: ($event: any) => (handleDragEnter(index, $event)),\n onDragleave: handleDragLeave,\n onDragover: handleDragOver,\n onDragstart: ($event: any) => (handleDragStart(index, $event)),\n onDrop: ($event: any) => (handleDrop(index, $event))\n }, [\n _createElementVNode(\"img\", {\n src: item.url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_5),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: (e) => removeFileImage(e, index)\n }, null, 8, [\"onClick\"])\n ], 40, _hoisted_4))\n }), 128))\n ]))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"div\", _hoisted_6, [\n _createVNode(BButton, { onClick: openFileDialog }, {\n default: _withCtx(() => [\n _createTextVNode(_toDisplayString(_ctx.$t('ds.components.base.image_picker.select_image')), 1)\n ]),\n \"append-icon\": _withCtx(() => [\n _hoisted_7\n ]),\n _: 1\n }),\n _createElementVNode(\"input\", {\n ref_key: \"inputRef\",\n ref: inputRef,\n accept: allowedTypes.value,\n multiple: props.multiple,\n class: \"ds-hidden\",\n type: \"file\",\n onChange: onChangeInput\n }, null, 40, _hoisted_8)\n ])\n ]),\n (!props.hideDetails)\n ? (_openBlock(), _createBlock(BErrorMessage, {\n key: 0,\n \"error-message\": _unref(validationResult).errorMessage(),\n class: \"mt-1\"\n }, null, 8, [\"error-message\"]))\n : _createCommentVNode(\"\", true),\n _createVNode(ImagePreview, {\n modelValue: previewImage.value.visible,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((previewImage.value.visible) = $event)),\n url: previewImage.value.url\n }, null, 8, [\"modelValue\", \"url\"])\n ]))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","_popScopeId","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_createElementVNode","_hoisted_8","_sfc_main","_defineComponent","__props","__expose","emit","props","t","useI18n","inputRef","ref","draggedIndex","value","computed","val","fileTypesValid","fileSizeValid","previewImage","allowedTypes","FileImageTypes","id","uuid","validateRequired","validateFileTypesValid","validateFileSizeValid","vRules","result","validate","validationResult","useValidationField","handleDragStart","index","e","handleDragEnd","handleDragEnter","target","handleDragOver","handleDragLeave","handleDrop","draggedImg","openFileDialog","_a","onChangeInput","fileList","createFileImages","file","convertToMB","reader","f","removeFileImage","numberOfBytes","preview","item","_ctx","_cache","_openBlock","_createElementBlock","_createVNode","BLabel","_unref","isEmpty","_createCommentVNode","_Fragment","_renderList","$event","BImagePickerCloseButton","BButton","_withCtx","_createTextVNode","_toDisplayString","_createBlock","BErrorMessage","ImagePreview"],"mappings":";;;;;;;;;;;AAGA,MAAMA,KAAe,QAAMC,EAAa,iBAAiB,GAAE,IAAE,KAAIC,KAAc,IACzEC,KAAa,EAAE,OAAO,eACtBC,KAAa,EAAE,OAAO,2EACtBC,KAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,KAAa,CAAC,WAAW,eAAe,eAAe,QAAQ,GAC/DC,KAAa,CAAC,KAAK,GACnBC,KAAa,EAAE,OAAO,4CACtBC,KAA2B,gBAAAT,GAAa,MAAmBU,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EAAa,MAAM,UAAW+C;AAAA,QAClG,KAAK/C,EAAa,MAAM;AAAA,SACvB,MAAM,GAAG,CAAC,cAAc,KAAK,CAAC;AAAA,IAAA,CAClC;AAAA,EAEH;AAEA,CAAC;"}
1
+ {"version":3,"file":"design-system89.mjs","sources":["../src/components/BImagePicker/BImagePicker.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-91ede486\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"ds-w-full\" }\nconst _hoisted_2 = { class: \"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"ds-flex ds-flex-wrap ds-justify-center ds-gap-1\"\n}\nconst _hoisted_4 = [\"onClick\", \"onDragenter\", \"onDragstart\", \"onDrop\"]\nconst _hoisted_5 = [\"src\"]\nconst _hoisted_6 = { class: \"ds-flex ds-flex-wrap ds-justify-center\" }\nconst _hoisted_7 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-absolute -ds-bottom-[3px] ds-left-0 ds-h-4 ds-w-4 ds-fill-primary-t\",\n viewBox: \"0 0 512 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z\" })\n], -1))\nconst _hoisted_8 = [\"accept\", \"multiple\"]\n\nimport { FileImageTypes } from '@/constants/Common';\nimport type { FileItemRead } from '@/types';\nimport { isEmpty } from 'lodash-es';\nimport { v4 as uuid } from 'uuid';\nimport { computed, ref } from 'vue';\nimport { useI18n } from 'vue-i18n';\nimport BImagePickerCloseButton from './BImagePickerCloseButton.vue';\nimport ImagePreview from './BImagePreview.vue';\nimport type { ValidationRule } from '@/composables/Validation';\nimport { useValidationField } from '@/composables/Validation';\nimport BLabel from '../BLabel.vue';\nimport BButton from '../BButton.vue';\nimport BErrorMessage from '../BErrorMessage.vue';\n\n/**\n * Props\n */\nexport interface Props {\n inputId?: string;\n modelValue: FileItemRead[];\n label?: string;\n multiple?: boolean;\n maxFileSize?: number;\n hideDetails?: boolean;\n required?: boolean;\n requiredErrorMessage?: string;\n validationRules?: ValidationRule[];\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BImagePicker',\n props: {\n inputId: { default: '' },\n modelValue: {},\n label: { default: '' },\n multiple: { type: Boolean, default: false },\n maxFileSize: { default: 20 },\n hideDetails: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n requiredErrorMessage: { default: '' },\n validationRules: { default: undefined }\n },\n emits: [\"change\", \"update:modelValue\"],\n setup(__props: any, { expose: __expose, emit }) {\n\nconst props = __props;\n\n/**\n * Drag & Drop: https://www.w3schools.com/jsref/event_ondragover.asp\n */\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst { t } = useI18n();\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst draggedIndex = ref(0);\nconst value = computed({\n get() {\n return props.modelValue;\n },\n set(val) {\n emit('update:modelValue', val);\n },\n});\nconst fileTypesValid = ref(true);\nconst fileSizeValid = ref(true);\nconst previewImage = ref({\n visible: false,\n url: '',\n});\nconst allowedTypes = computed(() => FileImageTypes.join(', '));\nconst id = computed(() => props.inputId || `id-${uuid()}`);\nconst validateRequired: ValidationRule = {\n validateRule: (val: FileItemRead[]) => !!val && val.length > 0,\n errorMessage: () =>\n props.requiredErrorMessage || t('ds.global.field_required'),\n};\nconst validateFileTypesValid: ValidationRule = {\n validateRule: () => fileTypesValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_types_valid', {\n types: allowedTypes.value,\n }),\n};\nconst validateFileSizeValid: ValidationRule = {\n validateRule: () => fileSizeValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_size_valid', {\n size: props.maxFileSize,\n }),\n};\nconst vRules = computed(() => {\n let result: ValidationRule[] = [];\n\n if (props.required) {\n result.push(validateRequired);\n }\n if (props.validationRules) {\n result = result.concat(props.validationRules);\n }\n result.push(validateFileTypesValid);\n result.push(validateFileSizeValid);\n\n return result.length ? result : undefined;\n});\nconst { validate, validationResult } = useValidationField(\n id.value,\n value,\n vRules.value,\n);\n__expose({ validate });\n\n/**\n * Methods\n */\n/* Events fired on the drag target */\nconst handleDragStart = (index: number, e: DragEvent) => {\n draggedIndex.value = index;\n const target = e.target as HTMLDivElement;\n target.classList.add('dragging');\n e.dataTransfer!.effectAllowed = 'move';\n e.dataTransfer!.setData('index', index.toString());\n};\nconst handleDragEnd = (e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n target.classList.remove('dragging');\n};\n/* Events fired on the drop target */\nconst handleDragEnter = (index: number, e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n if (draggedIndex.value !== index) {\n target.classList.add('dropped-target');\n }\n};\nconst handleDragOver = (e: DragEvent) => {\n // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element\n e.preventDefault();\n e.dataTransfer!.dropEffect = 'move';\n};\nconst handleDragLeave = (e: DragEvent) => {\n // When the draggable p element leaves the droptarget, reset the style\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n};\nconst handleDrop = (index: number, e: DragEvent) => {\n e.preventDefault();\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n const draggedIndex = parseInt(e.dataTransfer!.getData('index'));\n const draggedImg = value.value[draggedIndex];\n value.value.splice(draggedIndex, 1);\n value.value.splice(index, 0, draggedImg);\n\n emit('change');\n validate();\n};\nconst openFileDialog = () => {\n inputRef.value?.click();\n};\nconst onChangeInput = (e: any) => {\n let fileList: FileList = e.target.files || e.dataTransfer.files;\n if (!fileList.length) {\n return;\n }\n createFileImages(fileList);\n};\nconst createFileImages = (fileList: FileList) => {\n Array.from(fileList).forEach((file) => {\n fileTypesValid.value = FileImageTypes.includes(file.type);\n fileSizeValid.value = convertToMB(file.size) <= props.maxFileSize;\n\n if (fileTypesValid.value && fileSizeValid.value) {\n let reader: any = new FileReader();\n\n reader.onload = (f: any) => {\n if (props.multiple) {\n value.value.push({\n url: f.target.result,\n file,\n type: file.type,\n });\n } else {\n value.value.splice(0, 1, {\n url: f.target.result,\n file,\n type: file.type,\n });\n }\n\n emit('change');\n validate();\n };\n\n reader.readAsDataURL(file);\n } else {\n validate();\n }\n });\n};\nconst removeFileImage = (e: Event, index: number) => {\n e.stopPropagation();\n value.value.splice(index, 1);\n\n emit('change');\n validate();\n};\nconst convertToMB = (numberOfBytes: number) => numberOfBytes / 1024 ** 2;\nconst preview = (item: FileItemRead) => {\n previewImage.value.url = item.url;\n previewImage.value.visible = true;\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(BLabel, {\n label: props.label\n }, null, 8, [\"label\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n (!_unref(isEmpty)(value.value))\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_3, [\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(value.value, (item, index) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n key: index,\n class: \"draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: ($event: any) => (preview(item)),\n onDragend: handleDragEnd,\n onDragenter: ($event: any) => (handleDragEnter(index, $event)),\n onDragleave: handleDragLeave,\n onDragover: handleDragOver,\n onDragstart: ($event: any) => (handleDragStart(index, $event)),\n onDrop: ($event: any) => (handleDrop(index, $event))\n }, [\n _createElementVNode(\"img\", {\n src: item.url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_5),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: (e) => removeFileImage(e, index)\n }, null, 8, [\"onClick\"])\n ], 40, _hoisted_4))\n }), 128))\n ]))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"div\", _hoisted_6, [\n _createVNode(BButton, { onClick: openFileDialog }, {\n default: _withCtx(() => [\n _createTextVNode(_toDisplayString(_ctx.$t('ds.components.base.image_picker.select_image')), 1)\n ]),\n \"append-icon\": _withCtx(() => [\n _hoisted_7\n ]),\n _: 1\n }),\n _createElementVNode(\"input\", {\n ref_key: \"inputRef\",\n ref: inputRef,\n accept: allowedTypes.value,\n multiple: props.multiple,\n class: \"ds-hidden\",\n type: \"file\",\n onChange: onChangeInput\n }, null, 40, _hoisted_8)\n ])\n ]),\n (!props.hideDetails)\n ? (_openBlock(), _createBlock(BErrorMessage, {\n key: 0,\n \"error-message\": _unref(validationResult).errorMessage(),\n class: \"mt-1\"\n }, null, 8, [\"error-message\"]))\n : _createCommentVNode(\"\", true),\n _createVNode(ImagePreview, {\n modelValue: previewImage.value.visible,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((previewImage.value.visible) = $event)),\n url: previewImage.value.url\n }, null, 8, [\"modelValue\", \"url\"])\n ]))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","_popScopeId","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_createElementVNode","_hoisted_8","_sfc_main","_defineComponent","__props","__expose","emit","props","t","useI18n","inputRef","ref","draggedIndex","value","computed","val","fileTypesValid","fileSizeValid","previewImage","allowedTypes","FileImageTypes","id","uuid","validateRequired","validateFileTypesValid","validateFileSizeValid","vRules","result","validate","validationResult","useValidationField","handleDragStart","index","e","handleDragEnd","handleDragEnter","target","handleDragOver","handleDragLeave","handleDrop","draggedImg","openFileDialog","_a","onChangeInput","fileList","createFileImages","file","convertToMB","reader","f","removeFileImage","numberOfBytes","preview","item","_ctx","_cache","_openBlock","_createElementBlock","_createVNode","BLabel","_unref","isEmpty","_createCommentVNode","_Fragment","_renderList","$event","BImagePickerCloseButton","BButton","_withCtx","_createTextVNode","_toDisplayString","_createBlock","BErrorMessage","ImagePreview"],"mappings":";;;;;;;;;;;AAGA,MAAMA,KAAe,QAAMC,EAAa,iBAAiB,GAAE,IAAE,KAAIC,KAAc,IACzEC,KAAa,EAAE,OAAO,eACtBC,KAAa,EAAE,OAAO,2EACtBC,KAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,KAAa,CAAC,WAAW,eAAe,eAAe,QAAQ,GAC/DC,KAAa,CAAC,KAAK,GACnBC,KAAa,EAAE,OAAO,4CACtBC,KAA2B,gBAAAT,GAAa,MAAmBU,gBAAAA,EAAoB,OAAO;AAAA,EAC1F,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AACT,GAAG;AAAA,EACgCA,gBAAAA,EAAA,QAAQ,EAAE,GAAG,ygBAAygB;AACzjB,GAAG,EAAE,CAAC,GACAC,KAAa,CAAC,UAAU,UAAU,GA+BZC,KAAiBC,gBAAAA,EAAA;AAAA,EAC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GAAA,MAAM,GAAG,CAAC,SAAS,CAAC;AAAA,UAAA,GACtB,IAAIpC,EAAU,EAClB,GAAG,GAAG;AAAA,QAAA,CACR;AAAA,QAELI,EAAoB,OAAOF,IAAY;AAAA,UACrC4D,EAAaS,IAAS,EAAE,SAAS1B,KAAkB;AAAA,YACjD,SAAS2B,EAAS,MAAM;AAAA,cACtBC,EAAiBC,EAAiBhB,EAAK,GAAG,8CAA8C,CAAC,GAAG,CAAC;AAAA,YAAA,CAC9F;AAAA,YACD,eAAec,EAAS,MAAM;AAAA,cAC5BrE;AAAA,YAAA,CACD;AAAA,YACD,GAAG;AAAA,UAAA,CACJ;AAAA,UACDC,EAAoB,SAAS;AAAA,YAC3B,SAAS;AAAA,YACT,KAAKU;AAAA,YACL,QAAQS,EAAa;AAAA,YACrB,UAAUZ,EAAM;AAAA,YAChB,OAAO;AAAA,YACP,MAAM;AAAA,YACN,UAAUoC;AAAA,UAAA,GACT,MAAM,IAAI1C,EAAU;AAAA,QAAA,CACxB;AAAA,MAAA,CACF;AAAA,MACCM,EAAM,cAMJuD,EAAoB,IAAI,EAAI,KAL3BN,EAAW,GAAGe,EAAaC,IAAe;AAAA,QACzC,KAAK;AAAA,QACL,iBAAiBZ,EAAO/B,CAAgB,EAAE,aAAa;AAAA,QACvD,OAAO;AAAA,MAAA,GACN,MAAM,GAAG,CAAC,eAAe,CAAC;AAAA,MAEjC6B,EAAae,IAAc;AAAA,QACzB,YAAYvD,EAAa,MAAM;AAAA,QAC/B,uBAAuBqC,EAAO,CAAC,MAAMA,EAAO,CAAC,IAAI,CAACU,MAAkB/C,EAAa,MAAM,UAAW+C;AAAA,QAClG,KAAK/C,EAAa,MAAM;AAAA,SACvB,MAAM,GAAG,CAAC,cAAc,KAAK,CAAC;AAAA,IAAA,CAClC;AAAA,EAEH;AAEA,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";const c=require("./design-system105.js"),u=require("./design-system106.js"),a=require("./design-system107.js");function x(n,e,t){if(c.randomUUID&&!e&&!n)return c.randomUUID();n=n||{};const r=n.random||(n.rng||u)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){t=t||0;for(let i=0;i<16;++i)e[t+i]=r[i];return e}return a.unsafeStringify(r)}module.exports=x;
1
+ "use strict";const l=require("vue"),k=["disabled"],w=l.defineComponent({__name:"BOtpFieldBox",props:{value:{default:""},focus:{type:Boolean,default:!1},isDisabled:{type:Boolean,default:!1}},emits:["on-change","on-keydown","on-keyup","on-paste","on-focus","on-blur"],setup(c,{expose:d,emit:t}){const u=c,n=l.ref(u.value||""),o=l.ref(null),a=["0","1","2","3","4","5","6","7","8","9"],r=()=>{if(!a.includes(n.value)){n.value="";return}return n.value=n.value.toString(),n.value.length>1&&(n.value=n.value.slice(0,1)),t("on-change",n.value)},i=e=>{u.isDisabled&&e.preventDefault();const s=e;["Alt","Control","Meta","Backspace","ArrowLeft","ArrowRight","v",...a].includes(s.key)?t("on-keydown",e):s.preventDefault()},f=e=>{t("on-keyup",e)},p=e=>{t("on-paste",e)},v=()=>(o.value.select(),t("on-focus")),h=()=>t("on-blur"),y=()=>{o.value.focus(),o.value.select()};return l.watch(()=>u.value,(e,s)=>{e!==s&&(n.value=e)}),l.watch(()=>u.focus,(e,s)=>{s!==e&&o.value&&u.focus&&(o.value.focus(),o.value.select())}),l.onMounted(()=>{o.value&&u.focus&&(o.value.focus(),o.value.select())}),d({focus:y}),(e,s)=>l.withDirectives((l.openBlock(),l.createElementBlock("input",{ref_key:"inputRef",ref:o,"onUpdate:modelValue":s[0]||(s[0]=g=>n.value=g),disabled:e.isDisabled,class:"ds-h-11 ds-w-11 ds-rounded-lg ds-border ds-text-center ds-drop-shadow-light ds-transition-all ds-duration-200",inputmode:"numeric",maxlength:"1",onBlur:h,onFocus:v,onInput:r,onKeydown:i,onKeyup:f,onPaste:p},null,40,k)),[[l.vModelText,n.value]])}});module.exports=w;
2
2
  //# sourceMappingURL=design-system97.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"design-system97.js","sources":["../node_modules/uuid/dist/esm-browser/v4.js"],"sourcesContent":["import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;"],"names":["v4","options","buf","offset","native","rnds","rng","unsafeStringify"],"mappings":"4HAIA,SAASA,EAAGC,EAASC,EAAKC,EAAQ,CAChC,GAAIC,EAAO,YAAc,CAACF,GAAO,CAACD,EAChC,OAAOG,EAAO,aAGhBH,EAAUA,GAAW,GACrB,MAAMI,EAAOJ,EAAQ,SAAWA,EAAQ,KAAOK,KAK/C,GAHAD,EAAK,CAAC,EAAIA,EAAK,CAAC,EAAI,GAAO,GAC3BA,EAAK,CAAC,EAAIA,EAAK,CAAC,EAAI,GAAO,IAEvBH,EAAK,CACPC,EAASA,GAAU,EAEnB,QAAS,EAAI,EAAG,EAAI,GAAI,EAAE,EACxBD,EAAIC,EAAS,CAAC,EAAIE,EAAK,CAAC,EAG1B,OAAOH,CACR,CAED,OAAOK,EAAAA,gBAAgBF,CAAI,CAC7B","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"design-system97.js","sources":["../src/components/BOtpField/BOtpFieldBox.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { vModelText as _vModelText, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = [\"disabled\"]\n\nimport { onMounted, ref, type Ref, watch } from 'vue';\n\n/**\n * Props\n */\nexport interface Props {\n value?: string;\n focus?: boolean;\n isDisabled?: boolean;\n}\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BOtpFieldBox',\n props: {\n value: { default: '' },\n focus: { type: Boolean, default: false },\n isDisabled: { type: Boolean, default: false }\n },\n emits: [\"on-change\", \"on-keydown\", \"on-keyup\", \"on-paste\", \"on-focus\", \"on-blur\"],\n setup(__props: any, { expose: __expose, emit }) {\n\nconst props = __props;\n\n\n\n/**\n * Events\n */\n\n\n/**\n * Data\n */\nconst model = ref(props.value || '');\nconst inputRef = ref<HTMLInputElement | null>(null) as Ref<HTMLInputElement>;\nconst digits = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\n\n/**\n * Methods\n */\nconst handleOnChange = () => {\n if (!digits.includes(model.value)) {\n model.value = '';\n return;\n }\n\n model.value = model.value.toString();\n if (model.value.length > 1) {\n model.value = model.value.slice(0, 1);\n }\n return emit('on-change', model.value);\n};\n\nconst handleOnKeyDown = (event: KeyboardEvent) => {\n if (props.isDisabled) {\n event.preventDefault();\n }\n // Only allow characters 0-9, DEL, Backspace, Enter, Right and Left Arrows, and Pasting\n const keyEvent = event;\n if (\n [\n 'Alt',\n 'Control',\n 'Meta',\n 'Backspace',\n 'ArrowLeft',\n 'ArrowRight',\n 'v',\n ...digits,\n ].includes(keyEvent.key)\n ) {\n emit('on-keydown', event);\n } else {\n keyEvent.preventDefault();\n }\n};\nconst handleOnKeyUp = (event: KeyboardEvent) => {\n emit('on-keyup', event);\n};\nconst handleOnPaste = (event: ClipboardEvent) => {\n emit('on-paste', event);\n};\nconst handleOnFocus = () => {\n inputRef.value.select();\n return emit('on-focus');\n};\nconst handleOnBlur = () => emit('on-blur');\nconst focusFn = () => {\n inputRef.value.focus();\n inputRef.value.select();\n};\n\n/**\n * Watch\n */\nwatch(\n () => props.value,\n (newValue, oldValue) => {\n if (newValue !== oldValue) {\n model.value = newValue;\n }\n },\n);\nwatch(\n () => props.focus,\n (newFocusValue, oldFocusValue) => {\n // Check if focusedInput changed\n // Prevent calling function if input already in focus\n if (oldFocusValue !== newFocusValue && inputRef.value && props.focus) {\n inputRef.value.focus();\n inputRef.value.select();\n }\n },\n);\n\n/**\n * Lifecycle Hooks\n */\nonMounted(() => {\n if (inputRef.value && props.focus) {\n inputRef.value.focus();\n inputRef.value.select();\n }\n});\n\n__expose({ focus: focusFn });\n\nreturn (_ctx: any,_cache: any) => {\n return _withDirectives((_openBlock(), _createElementBlock(\"input\", {\n ref_key: \"inputRef\",\n ref: inputRef,\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((model).value = $event)),\n disabled: _ctx.isDisabled,\n class: \"ds-h-11 ds-w-11 ds-rounded-lg ds-border ds-text-center ds-drop-shadow-light ds-transition-all ds-duration-200\",\n inputmode: \"numeric\",\n maxlength: \"1\",\n onBlur: handleOnBlur,\n onFocus: handleOnFocus,\n onInput: handleOnChange,\n onKeydown: handleOnKeyDown,\n onKeyup: handleOnKeyUp,\n onPaste: handleOnPaste\n }, null, 40, _hoisted_1)), [\n [_vModelText, model.value]\n ])\n}\n}\n\n})"],"names":["_hoisted_1","_sfc_main","_defineComponent","__props","__expose","emit","props","model","ref","inputRef","digits","handleOnChange","handleOnKeyDown","event","keyEvent","handleOnKeyUp","handleOnPaste","handleOnFocus","handleOnBlur","focusFn","watch","newValue","oldValue","newFocusValue","oldFocusValue","onMounted","_ctx","_cache","_withDirectives","_openBlock","_createElementBlock","$event","_vModelText"],"mappings":"oCAGMA,EAAa,CAAC,UAAU,EAaFC,EAAiBC,kBAAA,CAC3C,OAAQ,eACR,MAAO,CACL,MAAO,CAAE,QAAS,EAAG,EACrB,MAAO,CAAE,KAAM,QAAS,QAAS,EAAM,EACvC,WAAY,CAAE,KAAM,QAAS,QAAS,EAAM,CAC9C,EACA,MAAO,CAAC,YAAa,aAAc,WAAY,WAAY,WAAY,SAAS,EAChF,MAAMC,EAAc,CAAE,OAAQC,EAAU,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