bitboss-ui 2.0.7 → 2.0.9

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 (413) hide show
  1. package/dist/index.js +139 -138
  2. package/dist/index.js.map +1 -1
  3. package/dist/index10.js +7 -78
  4. package/dist/index10.js.map +1 -1
  5. package/dist/{index100.js → index101.js} +3 -3
  6. package/dist/{index100.js.map → index101.js.map} +1 -1
  7. package/dist/{index102.js → index103.js} +3 -3
  8. package/dist/{index102.js.map → index103.js.map} +1 -1
  9. package/dist/{index104.js → index105.js} +8 -8
  10. package/dist/{index104.js.map → index105.js.map} +1 -1
  11. package/dist/{index106.js → index107.js} +9 -9
  12. package/dist/{index106.js.map → index107.js.map} +1 -1
  13. package/dist/{index108.js → index109.js} +3 -3
  14. package/dist/{index108.js.map → index109.js.map} +1 -1
  15. package/dist/index11.js +74 -35
  16. package/dist/index11.js.map +1 -1
  17. package/dist/{index110.js → index111.js} +3 -3
  18. package/dist/{index110.js.map → index111.js.map} +1 -1
  19. package/dist/{index112.js → index113.js} +3 -3
  20. package/dist/{index112.js.map → index113.js.map} +1 -1
  21. package/dist/{index114.js → index115.js} +3 -3
  22. package/dist/{index114.js.map → index115.js.map} +1 -1
  23. package/dist/{index116.js → index117.js} +8 -8
  24. package/dist/{index116.js.map → index117.js.map} +1 -1
  25. package/dist/{index118.js → index119.js} +2 -2
  26. package/dist/{index118.js.map → index119.js.map} +1 -1
  27. package/dist/index12.js +36 -189
  28. package/dist/index12.js.map +1 -1
  29. package/dist/index121.js +34 -38
  30. package/dist/index121.js.map +1 -1
  31. package/dist/index122.js +38 -38
  32. package/dist/index122.js.map +1 -1
  33. package/dist/index123.js +39 -42
  34. package/dist/index123.js.map +1 -1
  35. package/dist/index124.js +43 -31
  36. package/dist/index124.js.map +1 -1
  37. package/dist/index125.js +35 -2
  38. package/dist/index125.js.map +1 -1
  39. package/dist/index126.js +2 -21
  40. package/dist/index126.js.map +1 -1
  41. package/dist/index127.js +21 -2
  42. package/dist/index127.js.map +1 -1
  43. package/dist/index128.js +2 -312
  44. package/dist/index128.js.map +1 -1
  45. package/dist/index129.js +309 -21
  46. package/dist/index129.js.map +1 -1
  47. package/dist/index13.js +189 -78
  48. package/dist/index13.js.map +1 -1
  49. package/dist/index130.js +24 -2
  50. package/dist/index130.js.map +1 -1
  51. package/dist/index131.js +2 -5
  52. package/dist/index131.js.map +1 -1
  53. package/dist/index132.js +5 -9
  54. package/dist/index132.js.map +1 -1
  55. package/dist/index133.js +8 -5
  56. package/dist/index133.js.map +1 -1
  57. package/dist/index134.js +6 -3
  58. package/dist/index134.js.map +1 -1
  59. package/dist/index135.js +1 -1
  60. package/dist/index136.js +1 -1
  61. package/dist/index137.js +1 -1
  62. package/dist/index138.js +1 -1
  63. package/dist/index139.js +1 -1
  64. package/dist/index14.js +85 -0
  65. package/dist/index14.js.map +1 -0
  66. package/dist/index140.js +1 -1
  67. package/dist/index141.js +1 -1
  68. package/dist/index142.js +1 -1
  69. package/dist/index143.js +1 -1
  70. package/dist/index144.js +1 -1
  71. package/dist/index145.js +1 -1
  72. package/dist/index146.js +1 -1
  73. package/dist/index147.js +1 -1
  74. package/dist/index148.js +1 -1
  75. package/dist/index149.js +1 -1
  76. package/dist/index150.js +1 -1
  77. package/dist/index151.js +1 -1
  78. package/dist/index152.js +1 -1
  79. package/dist/index153.js +1 -1
  80. package/dist/index154.js +1 -1
  81. package/dist/index155.js +1 -1
  82. package/dist/index156.js +1 -1
  83. package/dist/index157.js +1 -1
  84. package/dist/index158.js +1 -1
  85. package/dist/index159.js +1 -1
  86. package/dist/{index15.js → index16.js} +4 -4
  87. package/dist/{index15.js.map → index16.js.map} +1 -1
  88. package/dist/index160.js +2 -2
  89. package/dist/{index162.js → index161.js} +1 -1
  90. package/dist/index161.js.map +1 -0
  91. package/dist/index163.js +6 -0
  92. package/dist/index163.js.map +1 -0
  93. package/dist/index165.js +1 -1
  94. package/dist/index166.js +1 -1
  95. package/dist/index167.js +1 -1
  96. package/dist/index168.js +1 -1
  97. package/dist/index169.js +1 -1
  98. package/dist/index170.js +2 -2
  99. package/dist/index171.js +6 -0
  100. package/dist/index171.js.map +1 -0
  101. package/dist/index173.js +2 -3
  102. package/dist/index173.js.map +1 -1
  103. package/dist/index174.js +1 -1
  104. package/dist/index175.js +1 -1
  105. package/dist/index176.js +1 -1
  106. package/dist/index177.js +1 -1
  107. package/dist/index178.js +1 -1
  108. package/dist/index179.js +1 -1
  109. package/dist/{index17.js → index18.js} +4 -4
  110. package/dist/{index17.js.map → index18.js.map} +1 -1
  111. package/dist/index180.js +1 -1
  112. package/dist/index181.js +1 -1
  113. package/dist/index182.js +1 -1
  114. package/dist/index183.js +1 -1
  115. package/dist/index184.js +1 -1
  116. package/dist/{index186.js → index185.js} +1 -1
  117. package/dist/index185.js.map +1 -0
  118. package/dist/index187.js +6 -0
  119. package/dist/index187.js.map +1 -0
  120. package/dist/index189.js +1 -1
  121. package/dist/index190.js +1 -1
  122. package/dist/index191.js +1 -1
  123. package/dist/index192.js +1 -1
  124. package/dist/index193.js +1 -1
  125. package/dist/index194.js +1 -1
  126. package/dist/index195.js +1 -1
  127. package/dist/index196.js +1 -1
  128. package/dist/index197.js +1 -1
  129. package/dist/index198.js +3 -81
  130. package/dist/index198.js.map +1 -1
  131. package/dist/{index19.js → index20.js} +19 -18
  132. package/dist/{index19.js.map → index20.js.map} +1 -1
  133. package/dist/index200.js +126 -2
  134. package/dist/index200.js.map +1 -1
  135. package/dist/index201.js +5 -4
  136. package/dist/index201.js.map +1 -1
  137. package/dist/index202.js +123 -2
  138. package/dist/index202.js.map +1 -1
  139. package/dist/index203.js +19 -8
  140. package/dist/index203.js.map +1 -1
  141. package/dist/index204.js +14 -124
  142. package/dist/index204.js.map +1 -1
  143. package/dist/index205.js +16 -5
  144. package/dist/index205.js.map +1 -1
  145. package/dist/index206.js +2 -123
  146. package/dist/index206.js.map +1 -1
  147. package/dist/index207.js +2 -19
  148. package/dist/index207.js.map +1 -1
  149. package/dist/index208.js +35 -16
  150. package/dist/index208.js.map +1 -1
  151. package/dist/index209.js +172 -14
  152. package/dist/index209.js.map +1 -1
  153. package/dist/index210.js +6 -2
  154. package/dist/index210.js.map +1 -1
  155. package/dist/index211.js +44 -2
  156. package/dist/index211.js.map +1 -1
  157. package/dist/index213.js +12 -173
  158. package/dist/index213.js.map +1 -1
  159. package/dist/index214.js +5 -6
  160. package/dist/index214.js.map +1 -1
  161. package/dist/index215.js +369 -43
  162. package/dist/index215.js.map +1 -1
  163. package/dist/index216.js +161 -0
  164. package/dist/index216.js.map +1 -0
  165. package/dist/index217.js +84 -13
  166. package/dist/index217.js.map +1 -1
  167. package/dist/index219.js +67 -355
  168. package/dist/index219.js.map +1 -1
  169. package/dist/{index21.js → index22.js} +21 -21
  170. package/dist/{index21.js.map → index22.js.map} +1 -1
  171. package/dist/index220.js +8 -19
  172. package/dist/index220.js.map +1 -1
  173. package/dist/index221.js +3 -27
  174. package/dist/index221.js.map +1 -1
  175. package/dist/index222.js +2 -3
  176. package/dist/index222.js.map +1 -1
  177. package/dist/index223.js +4 -249
  178. package/dist/index223.js.map +1 -1
  179. package/dist/index224.js +2 -52
  180. package/dist/index224.js.map +1 -1
  181. package/dist/index225.js +3 -44
  182. package/dist/index225.js.map +1 -1
  183. package/dist/index226.js +7 -5
  184. package/dist/index226.js.map +1 -1
  185. package/dist/index227.js +19 -49
  186. package/dist/index227.js.map +1 -1
  187. package/dist/index228.js +27 -3
  188. package/dist/index228.js.map +1 -1
  189. package/dist/index229.js +3 -3
  190. package/dist/index229.js.map +1 -1
  191. package/dist/index230.js +249 -7
  192. package/dist/index230.js.map +1 -1
  193. package/dist/index231.js +50 -156
  194. package/dist/index231.js.map +1 -1
  195. package/dist/index232.js +38 -78
  196. package/dist/index232.js.map +1 -1
  197. package/dist/index233.js +8 -0
  198. package/dist/index233.js.map +1 -0
  199. package/dist/index234.js +49 -2
  200. package/dist/index234.js.map +1 -1
  201. package/dist/index235.js +2 -18
  202. package/dist/index235.js.map +1 -1
  203. package/dist/index236.js +2 -106
  204. package/dist/index236.js.map +1 -1
  205. package/dist/index237.js +21 -0
  206. package/dist/index237.js.map +1 -0
  207. package/dist/index238.js +53 -47
  208. package/dist/index238.js.map +1 -1
  209. package/dist/{index23.js → index24.js} +8 -8
  210. package/dist/{index23.js.map → index24.js.map} +1 -1
  211. package/dist/index240.js +100 -2
  212. package/dist/index240.js.map +1 -1
  213. package/dist/index242.js +9 -2
  214. package/dist/index242.js.map +1 -1
  215. package/dist/index243.js +2 -3
  216. package/dist/index243.js.map +1 -1
  217. package/dist/index244.js +3 -6
  218. package/dist/index244.js.map +1 -1
  219. package/dist/index245.js +12 -16
  220. package/dist/index245.js.map +1 -1
  221. package/dist/index246.js +8 -8
  222. package/dist/index246.js.map +1 -1
  223. package/dist/index247.js +9 -23
  224. package/dist/index247.js.map +1 -1
  225. package/dist/index248.js +17 -9
  226. package/dist/index248.js.map +1 -1
  227. package/dist/index257.js +1 -1
  228. package/dist/index258.js +1 -1
  229. package/dist/{index25.js → index26.js} +6 -6
  230. package/dist/{index25.js.map → index26.js.map} +1 -1
  231. package/dist/index263.js +224 -2
  232. package/dist/index263.js.map +1 -1
  233. package/dist/index264.js +4 -2
  234. package/dist/index264.js.map +1 -1
  235. package/dist/index265.js +9 -2
  236. package/dist/index265.js.map +1 -1
  237. package/dist/index266.js +5 -1
  238. package/dist/index266.js.map +1 -1
  239. package/dist/index267.js +16 -2
  240. package/dist/index267.js.map +1 -1
  241. package/dist/index268.js +9 -2
  242. package/dist/index268.js.map +1 -1
  243. package/dist/index269.js +23 -28
  244. package/dist/index269.js.map +1 -1
  245. package/dist/index270.js +199 -21
  246. package/dist/index270.js.map +1 -1
  247. package/dist/index271.js +439 -0
  248. package/dist/index271.js.map +1 -0
  249. package/dist/index272.js +121 -218
  250. package/dist/index272.js.map +1 -1
  251. package/dist/index274.js +5 -200
  252. package/dist/index274.js.map +1 -1
  253. package/dist/index275.js +2 -436
  254. package/dist/index275.js.map +1 -1
  255. package/dist/index276.js +2 -127
  256. package/dist/index276.js.map +1 -1
  257. package/dist/index277.js +2 -5
  258. package/dist/index277.js.map +1 -1
  259. package/dist/index278.js +2 -2
  260. package/dist/index278.js.map +1 -1
  261. package/dist/index279.js +2 -9
  262. package/dist/index279.js.map +1 -1
  263. package/dist/{index27.js → index28.js} +3 -3
  264. package/dist/{index27.js.map → index28.js.map} +1 -1
  265. package/dist/index280.js +2 -69
  266. package/dist/index280.js.map +1 -1
  267. package/dist/index281.js +28 -3
  268. package/dist/index281.js.map +1 -1
  269. package/dist/index282.js +22 -12
  270. package/dist/index282.js.map +1 -1
  271. package/dist/index284.js +2 -17
  272. package/dist/index284.js.map +1 -1
  273. package/dist/index285.js +68 -2
  274. package/dist/index285.js.map +1 -1
  275. package/dist/index287.js +3 -211
  276. package/dist/index287.js.map +1 -1
  277. package/dist/index288.js +211 -15
  278. package/dist/index288.js.map +1 -1
  279. package/dist/index289.js +15 -4
  280. package/dist/index289.js.map +1 -1
  281. package/dist/index290.js +11 -4
  282. package/dist/index290.js.map +1 -1
  283. package/dist/index291.js +34 -58
  284. package/dist/index291.js.map +1 -1
  285. package/dist/index292.js +4 -35
  286. package/dist/index292.js.map +1 -1
  287. package/dist/index293.js +4 -7
  288. package/dist/index293.js.map +1 -1
  289. package/dist/index294.js +57 -17
  290. package/dist/index294.js.map +1 -1
  291. package/dist/index295.js +2 -7
  292. package/dist/index295.js.map +1 -1
  293. package/dist/index296.js +7 -2
  294. package/dist/index296.js.map +1 -1
  295. package/dist/index297.js +6 -10
  296. package/dist/index297.js.map +1 -1
  297. package/dist/index298.js +17 -45
  298. package/dist/index298.js.map +1 -1
  299. package/dist/index299.js +50 -0
  300. package/dist/index299.js.map +1 -0
  301. package/dist/{index29.js → index30.js} +3 -3
  302. package/dist/{index29.js.map → index30.js.map} +1 -1
  303. package/dist/index301.js +416 -42
  304. package/dist/index301.js.map +1 -1
  305. package/dist/index302.js +50 -0
  306. package/dist/index302.js.map +1 -0
  307. package/dist/{index31.js → index32.js} +4 -4
  308. package/dist/{index31.js.map → index32.js.map} +1 -1
  309. package/dist/{index33.js → index34.js} +5 -5
  310. package/dist/{index33.js.map → index34.js.map} +1 -1
  311. package/dist/{index35.js → index36.js} +23 -22
  312. package/dist/{index35.js.map → index36.js.map} +1 -1
  313. package/dist/{index37.js → index38.js} +7 -7
  314. package/dist/{index37.js.map → index38.js.map} +1 -1
  315. package/dist/{index39.js → index40.js} +3 -3
  316. package/dist/{index39.js.map → index40.js.map} +1 -1
  317. package/dist/{index41.js → index42.js} +4 -4
  318. package/dist/{index41.js.map → index42.js.map} +1 -1
  319. package/dist/{index43.js → index44.js} +12 -11
  320. package/dist/{index43.js.map → index44.js.map} +1 -1
  321. package/dist/{index45.js → index46.js} +4 -4
  322. package/dist/{index45.js.map → index46.js.map} +1 -1
  323. package/dist/{index47.js → index48.js} +3 -3
  324. package/dist/{index47.js.map → index48.js.map} +1 -1
  325. package/dist/index5.js +14 -40
  326. package/dist/index5.js.map +1 -1
  327. package/dist/{index49.js → index50.js} +4 -4
  328. package/dist/{index49.js.map → index50.js.map} +1 -1
  329. package/dist/{index51.js → index52.js} +3 -3
  330. package/dist/{index51.js.map → index52.js.map} +1 -1
  331. package/dist/{index53.js → index54.js} +3 -3
  332. package/dist/{index53.js.map → index54.js.map} +1 -1
  333. package/dist/{index55.js → index56.js} +3 -3
  334. package/dist/{index55.js.map → index56.js.map} +1 -1
  335. package/dist/{index57.js → index58.js} +2 -2
  336. package/dist/{index57.js.map → index58.js.map} +1 -1
  337. package/dist/index6.js +38 -76
  338. package/dist/index6.js.map +1 -1
  339. package/dist/{index59.js → index60.js} +14 -13
  340. package/dist/{index59.js.map → index60.js.map} +1 -1
  341. package/dist/{index61.js → index62.js} +3 -3
  342. package/dist/{index61.js.map → index62.js.map} +1 -1
  343. package/dist/{index63.js → index64.js} +3 -3
  344. package/dist/{index63.js.map → index64.js.map} +1 -1
  345. package/dist/{index65.js → index66.js} +5 -5
  346. package/dist/{index65.js.map → index66.js.map} +1 -1
  347. package/dist/{index67.js → index68.js} +3 -3
  348. package/dist/{index67.js.map → index68.js.map} +1 -1
  349. package/dist/index7.js +78 -62
  350. package/dist/index7.js.map +1 -1
  351. package/dist/{index69.js → index70.js} +2 -2
  352. package/dist/{index69.js.map → index70.js.map} +1 -1
  353. package/dist/{index71.js → index72.js} +9 -9
  354. package/dist/{index71.js.map → index72.js.map} +1 -1
  355. package/dist/{index73.js → index74.js} +3 -3
  356. package/dist/{index73.js.map → index74.js.map} +1 -1
  357. package/dist/{index75.js → index76.js} +5 -5
  358. package/dist/{index75.js.map → index76.js.map} +1 -1
  359. package/dist/index78.js +37 -120
  360. package/dist/index78.js.map +1 -1
  361. package/dist/index79.js +130 -0
  362. package/dist/index79.js.map +1 -0
  363. package/dist/index8.js +60 -18
  364. package/dist/index8.js.map +1 -1
  365. package/dist/{index80.js → index81.js} +5 -5
  366. package/dist/{index80.js.map → index81.js.map} +1 -1
  367. package/dist/{index82.js → index83.js} +25 -24
  368. package/dist/{index82.js.map → index83.js.map} +1 -1
  369. package/dist/{index84.js → index85.js} +7 -7
  370. package/dist/{index84.js.map → index85.js.map} +1 -1
  371. package/dist/{index86.js → index87.js} +2 -2
  372. package/dist/{index86.js.map → index87.js.map} +1 -1
  373. package/dist/{index88.js → index89.js} +3 -3
  374. package/dist/{index88.js.map → index89.js.map} +1 -1
  375. package/dist/index9.js +19 -7
  376. package/dist/index9.js.map +1 -1
  377. package/dist/{index90.js → index91.js} +3 -3
  378. package/dist/{index90.js.map → index91.js.map} +1 -1
  379. package/dist/{index92.js → index93.js} +3 -3
  380. package/dist/{index92.js.map → index93.js.map} +1 -1
  381. package/dist/{index94.js → index95.js} +1 -1
  382. package/dist/index95.js.map +1 -0
  383. package/dist/{index96.js → index97.js} +3 -3
  384. package/dist/{index96.js.map → index97.js.map} +1 -1
  385. package/dist/{index98.js → index99.js} +3 -3
  386. package/dist/{index98.js.map → index99.js.map} +1 -1
  387. package/dist/style.css +1 -1
  388. package/package.json +1 -1
  389. package/dist/index120.js +0 -43
  390. package/dist/index120.js.map +0 -1
  391. package/dist/index162.js.map +0 -1
  392. package/dist/index164.js +0 -6
  393. package/dist/index164.js.map +0 -1
  394. package/dist/index172.js +0 -5
  395. package/dist/index172.js.map +0 -1
  396. package/dist/index186.js.map +0 -1
  397. package/dist/index188.js +0 -6
  398. package/dist/index188.js.map +0 -1
  399. package/dist/index212.js +0 -38
  400. package/dist/index212.js.map +0 -1
  401. package/dist/index218.js +0 -8
  402. package/dist/index218.js.map +0 -1
  403. package/dist/index241.js +0 -13
  404. package/dist/index241.js.map +0 -1
  405. package/dist/index283.js +0 -12
  406. package/dist/index283.js.map +0 -1
  407. package/dist/index300.js +0 -424
  408. package/dist/index300.js.map +0 -1
  409. package/dist/index4.js +0 -17
  410. package/dist/index4.js.map +0 -1
  411. package/dist/index77.js +0 -47
  412. package/dist/index77.js.map +0 -1
  413. package/dist/index94.js.map +0 -1
package/dist/index7.js CHANGED
@@ -1,65 +1,81 @@
1
- import { getAsPercentage as p } from "./index126.js";
2
- import { wait as w } from "./index127.js";
3
- import { ref as c, computed as o, onBeforeUnmount as H } from "vue";
4
- const Y = ({
5
- duration: t,
6
- onStart: f,
7
- onFinish: i,
8
- onStop: s
9
- }) => {
10
- if (!t)
11
- throw new Error("You must define a duration for the coundown");
12
- const e = c(t), u = c(0), M = o(() => p(u.value, t)), m = 100, r = c(!1), n = c(!1);
13
- let a;
14
- const I = () => {
15
- u.value === t || r.value && !n.value || (f && f(), n.value = !1, r.value = !0, a = setInterval(() => {
16
- e.value = Math.max(e.value - m, 0), u.value = Math.min(u.value + m, t), e.value === 0 && w(0).then(() => {
17
- clearInterval(a), r.value = !1, s && s(), i && i();
18
- });
19
- }, m));
20
- }, d = () => {
21
- A(), I();
22
- }, A = () => {
23
- a && clearInterval(a), n.value || s && s(), e.value = t, u.value = 0, r.value = !1, n.value = !1;
24
- }, g = () => {
25
- a && clearInterval(a), n.value || s && s(), n.value = !0;
26
- }, y = o(() => {
27
- const l = Math.trunc(e.value / 864e5), v = Math.trunc((e.value - l * 864e5) / 36e5), h = Math.trunc(
28
- (e.value - v * 36e5 - l * 864e5) / 6e4
29
- ), D = Math.trunc(
30
- (e.value - h * 6e4 - v * 36e5 - l * 864e5) / 1e3
31
- );
32
- return {
33
- days: l,
34
- hours: v,
35
- minutes: h,
36
- seconds: D
37
- };
38
- });
39
- return H(() => clearInterval(a)), {
40
- /** Elapsed milliseconds since starting the timer */
41
- elapsed: o(() => u.value),
42
- /** Remaining milliseconds */
43
- remaining: o(() => e.value),
44
- /** Remaining as a formatted object for display */
45
- remainingFormatted: y,
46
- /** Percentage of elapsed time against duration */
47
- progress: M,
48
- /** Starts the timer */
49
- start: I,
50
- /** Reset the timer to intiial state and starts again */
51
- restart: d,
52
- /** Pauses the timer */
53
- pause: g,
54
- /** Reset the timer to initial state, if the timer is running it is stopped */
55
- reset: A,
56
- /** Boolean, is the timer running (paused doesn't change running state) */
57
- running: r,
58
- /** Boolean is the timer paused */
59
- paused: n
60
- };
61
- };
1
+ import { ref as u, watch as c, reactive as x, computed as f } from "vue";
2
+ import { isNil as l } from "./index126.js";
3
+ let r = [];
4
+ const i = u(null);
5
+ c(
6
+ () => i.value,
7
+ () => {
8
+ typeof i.value == "boolean" && (r.forEach((s) => s()), r = []);
9
+ }
10
+ );
11
+ const o = {
12
+ actions: !0,
13
+ description: "",
14
+ loading: !1,
15
+ no: !0,
16
+ noText: "",
17
+ open: !1,
18
+ size: "sm",
19
+ text: "",
20
+ theme: "default",
21
+ title: "",
22
+ yes: !0,
23
+ yesText: ""
24
+ }, d = {
25
+ actions: !0,
26
+ description: "",
27
+ no: !0,
28
+ noText: "Annulla",
29
+ text: "",
30
+ theme: "default",
31
+ title: "",
32
+ yes: !0,
33
+ yesText: "OK"
34
+ }, e = x({
35
+ ...o
36
+ }), m = f(() => [
37
+ {
38
+ text: e.noText,
39
+ handler: () => {
40
+ i.value = !1;
41
+ }
42
+ },
43
+ {
44
+ text: e.yesText,
45
+ handler: () => {
46
+ i.value = !0;
47
+ }
48
+ }
49
+ ]), y = () => ({
50
+ /**
51
+ * The confirm function. It accepts a set of options defining
52
+ * the behavior of the modal and returns `Promise<boolean>`
53
+ * when the user accepts, declines, or ignores the modal.
54
+ */
55
+ confirm: (s) => {
56
+ i.value = null;
57
+ const n = { ...d, ...s }, t = { ...o };
58
+ return t.title = n.title, t.text = n.text, n.description && (t.description = n.description), n.noText && (t.noText = n.noText), n.yesText && (t.yesText = n.yesText), n.size && (t.size = n.size), n.theme && (t.theme = n.theme), l(n.yes) || (t.yes = !!n.yes), l(n.no) || (t.no = !!n.no), l(n.actions) || (t.actions = !!n.actions), e.actions = t.actions, e.description = t.description, e.no = t.no, e.noText = t.noText, e.open = !0, e.size = t.size, e.text = t.text, e.theme = t.theme, e.title = t.title, e.yes = t.yes, e.yesText = t.yesText, new Promise((a) => {
59
+ r.push(() => a(i.value));
60
+ });
61
+ },
62
+ /**
63
+ * Sets the state of the confirm to loading and displays a spinner.
64
+ */
65
+ setLoading: (s = !0) => {
66
+ e.loading = s;
67
+ },
68
+ /**
69
+ * Closes the confirmation modal. It is a manual operation
70
+ * so you can update the state while the modal is still open.
71
+ */
72
+ close: () => (e.description = o.description, e.loading = o.loading, e.noText = o.noText, e.open = o.open, e.text = o.text, e.theme = o.theme, e.title = o.title, e.yesText = o.yesText, i.value = !1, Promise.resolve().then(() => {
73
+ i.value = null;
74
+ }))
75
+ });
62
76
  export {
63
- Y as useCountdown
77
+ m as actions,
78
+ e as state,
79
+ y as useConfirm
64
80
  };
65
81
  //# sourceMappingURL=index7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index7.js","sources":["../src/composables/useCountdown.ts"],"sourcesContent":["import { getAsPercentage } from '@/utilities/functions/percentage';\nimport { wait } from '@/utilities/functions/wait';\nimport { computed, onBeforeUnmount, ref } from 'vue';\n\ntype CounterParams = {\n\t/** Longevity of the countdown in milliseconds */\n\tduration: number;\n\t/** Function called every time the countdown starts or restarts */\n\tonStart?: (...args: any[]) => any;\n\t/** Function called anytime the timer stops or pauses */\n\tonStop?: (...args: any[]) => any;\n\t/** Function called on completion */\n\tonFinish?: (...args: any[]) => any;\n};\nexport const useCountdown = ({\n\tduration,\n\tonStart,\n\tonFinish,\n\tonStop,\n}: CounterParams) => {\n\tif (!duration) {\n\t\tthrow new Error('You must define a duration for the coundown');\n\t}\n\tconst remaining = ref(duration);\n\tconst elapsed = ref(0);\n\tconst progress = computed(() => getAsPercentage(elapsed.value, duration));\n\tconst tick = 100;\n\tconst running = ref(false);\n\tconst paused = ref(false);\n\n\tlet timeoutID: ReturnType<typeof setInterval>;\n\n\tconst start = () => {\n\t\tif (elapsed.value === duration || (running.value && !paused.value)) return;\n\t\tif (onStart) onStart();\n\t\tpaused.value = false;\n\t\trunning.value = true;\n\n\t\ttimeoutID = setInterval(() => {\n\t\t\tremaining.value = Math.max(remaining.value - tick, 0);\n\t\t\telapsed.value = Math.min(elapsed.value + tick, duration);\n\n\t\t\tif (remaining.value === 0) {\n\t\t\t\twait(0).then(() => {\n\t\t\t\t\tclearInterval(timeoutID);\n\t\t\t\t\trunning.value = false;\n\t\t\t\t\tif (onStop) onStop();\n\t\t\t\t\tif (onFinish) onFinish();\n\t\t\t\t});\n\t\t\t}\n\t\t}, tick);\n\t};\n\n\tconst restart = () => {\n\t\treset();\n\t\tstart();\n\t};\n\n\tconst reset = () => {\n\t\tif (timeoutID) clearInterval(timeoutID);\n\t\tif (!paused.value) {\n\t\t\tif (onStop) onStop();\n\t\t}\n\t\tremaining.value = duration;\n\t\telapsed.value = 0;\n\t\trunning.value = false;\n\t\tpaused.value = false;\n\t};\n\n\tconst pause = () => {\n\t\tif (timeoutID) clearInterval(timeoutID);\n\t\tif (!paused.value) {\n\t\t\tif (onStop) onStop();\n\t\t}\n\t\tpaused.value = true;\n\t};\n\n\tconst remainingFormatted = computed(() => {\n\t\tconst msInADay = 1000 * 60 * 60 * 24;\n\t\tconst msInAnHour = 1000 * 60 * 60;\n\t\tconst msInAMinute = 1000 * 60;\n\t\tconst msInASecond = 1000;\n\n\t\tconst days = Math.trunc(remaining.value / msInADay);\n\t\tconst hours = Math.trunc((remaining.value - days * msInADay) / msInAnHour);\n\t\tconst minutes = Math.trunc(\n\t\t\t(remaining.value - hours * msInAnHour - days * msInADay) / msInAMinute\n\t\t);\n\t\tconst seconds = Math.trunc(\n\t\t\t(remaining.value -\n\t\t\t\tminutes * msInAMinute -\n\t\t\t\thours * msInAnHour -\n\t\t\t\tdays * msInADay) /\n\t\t\t\tmsInASecond\n\t\t);\n\t\treturn {\n\t\t\tdays,\n\t\t\thours,\n\t\t\tminutes,\n\t\t\tseconds,\n\t\t};\n\t});\n\n\tonBeforeUnmount(() => clearInterval(timeoutID));\n\n\treturn {\n\t\t/** Elapsed milliseconds since starting the timer */\n\t\telapsed: computed(() => elapsed.value),\n\t\t/** Remaining milliseconds */\n\t\tremaining: computed(() => remaining.value),\n\t\t/** Remaining as a formatted object for display */\n\t\tremainingFormatted,\n\t\t/** Percentage of elapsed time against duration */\n\t\tprogress,\n\t\t/** Starts the timer */\n\t\tstart,\n\t\t/** Reset the timer to intiial state and starts again */\n\t\trestart,\n\t\t/** Pauses the timer */\n\t\tpause,\n\t\t/** Reset the timer to initial state, if the timer is running it is stopped */\n\t\treset,\n\t\t/** Boolean, is the timer running (paused doesn't change running state) */\n\t\trunning,\n\t\t/** Boolean is the timer paused */\n\t\tpaused,\n\t};\n};\n"],"names":["useCountdown","duration","onStart","onFinish","onStop","remaining","ref","elapsed","progress","computed","getAsPercentage","tick","running","paused","timeoutID","start","wait","restart","reset","pause","remainingFormatted","days","hours","minutes","seconds","onBeforeUnmount"],"mappings":";;;AAcO,MAAMA,IAAe,CAAC;AAAA,EAC5B,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AACD,MAAqB;AACpB,MAAI,CAACH;AACE,UAAA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,IAAO,SAAY;AAAA,IAAA,GAEtDG,IAAU,KAAK;AAAA,OACnBnB,EAAU,QACVkB,IAAU,MACVD,IAAQ,OACRD,IAAO,SACP;AAAA,IAAA;AAEK,WAAA;AAAA,MACN,MAAAA;AAAA,MACA,OAAAC;AAAA,MACA,SAAAC;AAAA,MACA,SAAAC;AAAA,IAAA;AAAA,EACD,CACA;AAEe,SAAAC,EAAA,MAAM,cAAcX,CAAS,CAAC,GAEvC;AAAA;AAAA,IAEN,SAASL,EAAS,MAAMF,EAAQ,KAAK;AAAA;AAAA,IAErC,WAAWE,EAAS,MAAMJ,EAAU,KAAK;AAAA;AAAA,IAEzC,oBAAAe;AAAA;AAAA,IAEA,UAAAZ;AAAA;AAAA,IAEA,OAAAO;AAAA;AAAA,IAEA,SAAAE;AAAA;AAAA,IAEA,OAAAE;AAAA;AAAA,IAEA,OAAAD;AAAA;AAAA,IAEA,SAAAN;AAAA;AAAA,IAEA,QAAAC;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"index7.js","sources":["../src/composables/useConfirm.ts"],"sourcesContent":["import { computed, reactive, ref, watch } from 'vue';\nimport { isNil } from '@/utilities/functions/isNil';\nimport type { Sizes } from '@/components/BaseDialog/BaseDialog.vue';\n\ntype State = {\n\tdescription: string;\n\ttheme: string;\n\tloading: boolean;\n\tnoText: string;\n\topen: boolean;\n\ttext: string;\n\ttitle: string;\n\tyesText: string;\n\tyes: boolean;\n\tno: boolean;\n\tactions: boolean;\n\tsize: keyof Sizes;\n};\n\ntype UserOptions = {\n\t/**\n\t * Boolean that sets whether to display or hide the buttons.\n\t * Confirms without actions can only be dismissed by clicking on the overlay or the close button.\n\t */\n\tactions?: State['actions'];\n\t/**\n\t * Description of the content of the modal for accessibility purposes.\n\t */\n\tdescription?: State['description'];\n\t/**\n\t * Boolean that defines whether to display or hide the \"No\" action.\n\t */\n\tno?: State['no'];\n\t/**\n\t * Text content of the \"No\" action.\n\t */\n\tnoText?: State['noText'];\n\t/**\n\t * Text content of the modal.\n\t */\n\ttext: State['text'];\n\t/**\n\t * The name of the theme it applies a css class to BbConfirm for styling.\n\t */\n\ttheme?: State['theme'];\n\t/**\n\t * Tittle of the modal\n\t */\n\ttitle: State['title'];\n\t/**\n\t * Boolean that defines whether to display or hide the \"Yes\" action.\n\t */\n\tyes?: State['yes'];\n\t/**\n\t * Text content of the \"Yes\" action.\n\t */\n\tyesText?: State['yesText'];\n\t/**\n\t * Size of the confirm modal. Use any sizes valid for `BbModal`.\n\t */\n\tsize?: State['size'];\n};\n\n// Stash all instances of current dialogs\nlet subscribers: ((...args: any[]) => any)[] = [];\n\nconst value = ref<boolean | null>(null);\n\nwatch(\n\t() => value.value,\n\t() => {\n\t\tif (typeof value.value === 'boolean') {\n\t\t\t// Every time a dialog is resolved resolve all dialogs\n\t\t\tsubscribers.forEach((fn) => fn());\n\t\t\tsubscribers = [];\n\t\t}\n\t}\n);\n\nconst defaultState: State = {\n\tactions: true,\n\tdescription: '',\n\tloading: false,\n\tno: true,\n\tnoText: '',\n\topen: false,\n\tsize: 'sm',\n\ttext: '',\n\ttheme: 'default',\n\ttitle: '',\n\tyes: true,\n\tyesText: '',\n};\nconst defaultOption: UserOptions = {\n\tactions: true,\n\tdescription: '',\n\tno: true,\n\tnoText: 'Annulla',\n\ttext: '',\n\ttheme: 'default',\n\ttitle: '',\n\tyes: true,\n\tyesText: 'OK',\n};\n\nexport const state = reactive<State>({\n\t...defaultState,\n});\n\nexport const actions = computed(() => [\n\t{\n\t\ttext: state.noText,\n\t\thandler: () => {\n\t\t\tvalue.value = false;\n\t\t},\n\t},\n\t{\n\t\ttext: state.yesText,\n\t\thandler: () => {\n\t\t\tvalue.value = true;\n\t\t},\n\t},\n]);\n\nexport const useConfirm = () => {\n\treturn {\n\t\t/**\n\t\t * The confirm function. It accepts a set of options defining\n\t\t * the behavior of the modal and returns `Promise<boolean>`\n\t\t * when the user accepts, declines, or ignores the modal.\n\t\t */\n\t\tconfirm: (options: UserOptions) => {\n\t\t\tvalue.value = null;\n\t\t\tconst newOptions = { ...defaultOption, ...options };\n\t\t\tconst newState = { ...defaultState };\n\t\t\tnewState.title = newOptions.title;\n\t\t\tnewState.text = newOptions.text;\n\t\t\tif (newOptions.description) newState.description = newOptions.description;\n\t\t\tif (newOptions.noText) newState.noText = newOptions.noText;\n\t\t\tif (newOptions.yesText) newState.yesText = newOptions.yesText;\n\t\t\tif (newOptions.size) newState.size = newOptions.size;\n\t\t\tif (newOptions.theme) newState.theme = newOptions.theme;\n\t\t\tif (!isNil(newOptions.yes)) newState.yes = !!newOptions.yes;\n\t\t\tif (!isNil(newOptions.no)) newState.no = !!newOptions.no;\n\t\t\tif (!isNil(newOptions.actions)) newState.actions = !!newOptions.actions;\n\n\t\t\tstate.actions = newState.actions;\n\t\t\tstate.description = newState.description;\n\t\t\tstate.no = newState.no;\n\t\t\tstate.noText = newState.noText;\n\t\t\tstate.open = true;\n\t\t\tstate.size = newState.size;\n\t\t\tstate.text = newState.text;\n\t\t\tstate.theme = newState.theme;\n\t\t\tstate.title = newState.title;\n\t\t\tstate.yes = newState.yes;\n\t\t\tstate.yesText = newState.yesText;\n\n\t\t\treturn new Promise<boolean>((resolve) => {\n\t\t\t\tsubscribers.push(() => resolve(value.value as boolean));\n\t\t\t});\n\t\t},\n\t\t/**\n\t\t * Sets the state of the confirm to loading and displays a spinner.\n\t\t */\n\t\tsetLoading: (value: boolean = true) => {\n\t\t\tstate.loading = value;\n\t\t},\n\t\t/**\n\t\t * Closes the confirmation modal. It is a manual operation\n\t\t * so you can update the state while the modal is still open.\n\t\t */\n\t\tclose: () => {\n\t\t\tstate.description = defaultState.description;\n\t\t\tstate.loading = defaultState.loading;\n\t\t\tstate.noText = defaultState.noText;\n\t\t\tstate.open = defaultState.open;\n\t\t\tstate.text = defaultState.text;\n\t\t\tstate.theme = defaultState.theme;\n\t\t\tstate.title = defaultState.title;\n\t\t\tstate.yesText = defaultState.yesText;\n\t\t\tvalue.value = false;\n\t\t\treturn Promise.resolve().then(() => {\n\t\t\t\tvalue.value = null;\n\t\t\t});\n\t\t},\n\t};\n};\n"],"names":["subscribers","value","ref","watch","fn","defaultState","defaultOption","state","reactive","actions","computed","useConfirm","options","newOptions","newState","isNil","resolve"],"mappings":";;AAgEA,IAAIA,IAA2C,CAAA;AAE/C,MAAMC,IAAQC,EAAoB,IAAI;AAEtCC;AAAA,EACC,MAAMF,EAAM;AAAA,EACZ,MAAM;AACD,IAAA,OAAOA,EAAM,SAAU,cAE1BD,EAAY,QAAQ,CAACI,MAAOA,EAAI,CAAA,GAChCJ,IAAc,CAAA;AAAA,EAEhB;AACD;AAEA,MAAMK,IAAsB;AAAA,EAC3B,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,SAAS;AACV,GACMC,IAA6B;AAAA,EAClC,SAAS;AAAA,EACT,aAAa;AAAA,EACb,IAAI;AAAA,EACJ,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,SAAS;AACV,GAEaC,IAAQC,EAAgB;AAAA,EACpC,GAAGH;AACJ,CAAC,GAEYI,IAAUC,EAAS,MAAM;AAAA,EACrC;AAAA,IACC,MAAMH,EAAM;AAAA,IACZ,SAAS,MAAM;AACd,MAAAN,EAAM,QAAQ;AAAA,IACf;AAAA,EACD;AAAA,EACA;AAAA,IACC,MAAMM,EAAM;AAAA,IACZ,SAAS,MAAM;AACd,MAAAN,EAAM,QAAQ;AAAA,IACf;AAAA,EACD;AACD,CAAC,GAEYU,IAAa,OAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMN,SAAS,CAACC,MAAyB;AAClC,IAAAX,EAAM,QAAQ;AACd,UAAMY,IAAa,EAAE,GAAGP,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EAAa,OAC3BE,EAAM,UAAUF,EAAa,SAC7BJ,EAAM,QAAQ,IACP,QAAQ,UAAU,KAAK,MAAM;AACnC,IAAAA,EAAM,QAAQ;AAAA,EAAA,CACd;AACF;"}
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as d, computed as u, openBlock as m, createBlock as f, mergeProps as y, withCtx as l, renderSlot as t, normalizeProps as a, guardReactiveProps as r } from "vue";
2
- import $ from "./index23.js";
2
+ import $ from "./index24.js";
3
3
  /* empty css */
4
4
  const b = /* @__PURE__ */ d({
5
5
  __name: "BbDialog",
@@ -58,4 +58,4 @@ const b = /* @__PURE__ */ d({
58
58
  export {
59
59
  b as default
60
60
  };
61
- //# sourceMappingURL=index69.js.map
61
+ //# sourceMappingURL=index70.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index69.js","sources":["../src/components/BbDialog/BbDialog.vue"],"sourcesContent":["<template>\n\t<!-- Events need to be propagated manually -->\n\t<BaseDialog\n\t\tv-bind=\"$props\"\n\t\t:overlay-classes=\"overlayClasses\"\n\t\t@hidden=\"() => $emit('hidden')\"\n\t\t@shown=\"() => $emit('shown')\"\n\t\t@update:model-value=\"(value: boolean) => $emit('update:modelValue', value)\"\n\t\t><template #close=\"data\"><slot name=\"close\" v-bind=\"data\" /></template\n\t\t><template #default=\"data\"><slot name=\"default\" v-bind=\"data\" /></template\n\t\t><template #description=\"data\"\n\t\t\t><slot name=\"description\" v-bind=\"data\" /></template\n\t\t><template #footer=\"data\"><slot name=\"footer\" v-bind=\"data\" /></template\n\t\t><template #header=\"data\"><slot name=\"header\" v-bind=\"data\" /></template\n\t\t><template #title=\"data\"><slot name=\"title\" v-bind=\"data\" /></template>\n\t</BaseDialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport BaseDialog from '../BaseDialog/BaseDialog.vue';\nimport type { Classes } from '@/types/Classes';\nimport type {\n\tBaseDialogProps,\n\tBaseDialogEvents,\n\tBaseDialogSlots,\n} from '../BaseDialog/BaseDialog.vue';\nexport type {\n\tBaseDialogProps as BbDialogProps,\n\tBaseDialogEvents as BbDialogEvents,\n\tSizes,\n} from '../BaseDialog/BaseDialog.vue';\n\nconst props = withDefaults(defineProps<BaseDialogProps>(), {\n\tshowClose: true,\n});\n\ndefineEmits<BaseDialogEvents>();\n\ndefineSlots<BaseDialogSlots>();\n\nconst overlayClasses = computed<Classes>(() => {\n\tlet base: Classes = ['bb-dialog'];\n\tif (props.overlayClasses) {\n\t\tbase = base.concat(props.overlayClasses);\n\t}\n\treturn base;\n});\n</script>\n<style lang=\"postcss\">\n@import '@/assets/css/BbDialog';\n</style>\n"],"names":["props","__props","overlayClasses","computed","base"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,UAAMA,IAAQC,GAQRC,IAAiBC,EAAkB,MAAM;AAC1C,UAAAC,IAAgB,CAAC,WAAW;AAChC,aAAIJ,EAAM,mBACFI,IAAAA,EAAK,OAAOJ,EAAM,cAAc,IAEjCI;AAAA,IAAA,CACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index70.js","sources":["../src/components/BbDialog/BbDialog.vue"],"sourcesContent":["<template>\n\t<!-- Events need to be propagated manually -->\n\t<BaseDialog\n\t\tv-bind=\"$props\"\n\t\t:overlay-classes=\"overlayClasses\"\n\t\t@hidden=\"() => $emit('hidden')\"\n\t\t@shown=\"() => $emit('shown')\"\n\t\t@update:model-value=\"(value: boolean) => $emit('update:modelValue', value)\"\n\t\t><template #close=\"data\"><slot name=\"close\" v-bind=\"data\" /></template\n\t\t><template #default=\"data\"><slot name=\"default\" v-bind=\"data\" /></template\n\t\t><template #description=\"data\"\n\t\t\t><slot name=\"description\" v-bind=\"data\" /></template\n\t\t><template #footer=\"data\"><slot name=\"footer\" v-bind=\"data\" /></template\n\t\t><template #header=\"data\"><slot name=\"header\" v-bind=\"data\" /></template\n\t\t><template #title=\"data\"><slot name=\"title\" v-bind=\"data\" /></template>\n\t</BaseDialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport BaseDialog from '../BaseDialog/BaseDialog.vue';\nimport type { Classes } from '@/types/Classes';\nimport type {\n\tBaseDialogProps,\n\tBaseDialogEvents,\n\tBaseDialogSlots,\n} from '../BaseDialog/BaseDialog.vue';\nexport type {\n\tBaseDialogProps as BbDialogProps,\n\tBaseDialogEvents as BbDialogEvents,\n\tSizes,\n} from '../BaseDialog/BaseDialog.vue';\n\nconst props = withDefaults(defineProps<BaseDialogProps>(), {\n\tshowClose: true,\n});\n\ndefineEmits<BaseDialogEvents>();\n\ndefineSlots<BaseDialogSlots>();\n\nconst overlayClasses = computed<Classes>(() => {\n\tlet base: Classes = ['bb-dialog'];\n\tif (props.overlayClasses) {\n\t\tbase = base.concat(props.overlayClasses);\n\t}\n\treturn base;\n});\n</script>\n<style lang=\"postcss\">\n@import '@/assets/css/BbDialog';\n</style>\n"],"names":["props","__props","overlayClasses","computed","base"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,UAAMA,IAAQC,GAQRC,IAAiBC,EAAkB,MAAM;AAC1C,UAAAC,IAAgB,CAAC,WAAW;AAChC,aAAIJ,EAAM,mBACFI,IAAAA,EAAK,OAAOJ,EAAM,cAAc,IAEjCI;AAAA,IAAA,CACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,13 +1,13 @@
1
1
  import { defineComponent as Y, computed as M, ref as v, openBlock as D, createElementBlock as H, mergeProps as I, createElementVNode as $, renderSlot as _, normalizeProps as Z, guardReactiveProps as ee, unref as c, createBlock as te, Teleport as oe, normalizeClass as ne, normalizeStyle as z, Fragment as N, renderList as ae, createVNode as le, withCtx as se, createCommentVNode as ie } from "vue";
2
- import { findRightIndex as S } from "./index246.js";
3
- import { useFloating as re, arrow as ue } from "./index204.js";
4
- import { useId as de } from "./index8.js";
5
- import { wait as U } from "./index127.js";
6
- import { useIntersectionObserver as ce } from "./index128.js";
7
- import fe from "./index13.js";
2
+ import { findRightIndex as S } from "./index268.js";
3
+ import { useFloating as re, arrow as ue } from "./index200.js";
4
+ import { useId as de } from "./index9.js";
5
+ import { wait as U } from "./index128.js";
6
+ import { useIntersectionObserver as ce } from "./index129.js";
7
+ import fe from "./index14.js";
8
8
  /* empty css */
9
- import V from "./index247.js";
10
- import { autoUpdate as pe, flip as be, offset as me, shift as ve } from "./index219.js";
9
+ import V from "./index269.js";
10
+ import { autoUpdate as pe, flip as be, offset as me, shift as ve } from "./index215.js";
11
11
  const we = ["id", "aria-labelledby"], ye = { class: "bb-dropdown__items-container" }, He = /* @__PURE__ */ Y({
12
12
  __name: "BbDropdown",
13
13
  props: {
@@ -311,4 +311,4 @@ const we = ["id", "aria-labelledby"], ye = { class: "bb-dropdown__items-containe
311
311
  export {
312
312
  He as default
313
313
  };
314
- //# sourceMappingURL=index71.js.map
314
+ //# sourceMappingURL=index72.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index71.js","sources":["../src/components/BbDropdown/BbDropdown.vue"],"sourcesContent":["<template>\n\t<span class=\"bb-dropdown\" v-bind=\"attributes\">\n\t\t<span ref=\"wrapper\" class=\"bb-dropdown__wrapper\">\n\t\t\t<slot\n\t\t\t\tname=\"activator\"\n\t\t\t\tv-bind=\"{\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t'aria-expanded': open,\n\t\t\t\t\t\t'aria-controls': `menu_${id}`,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tonClick,\n\t\t\t\t\t\tonKeydown,\n\t\t\t\t\t\tdisabled,\n\t\t\t\t\t},\n\t\t\t\t\tclosed: closed,\n\t\t\t\t\tclosing: closing,\n\t\t\t\t\tdisabled: disabled,\n\t\t\t\t\topen: open,\n\t\t\t\t\topening: opening,\n\t\t\t\t\tplacement: placement,\n\t\t\t\t}\"\n\t\t\t></slot>\n\t\t</span>\n\t\t<teleport v-if=\"hasOpenedOnce || eager\" to=\"body\">\n\t\t\t<span\n\t\t\t\t:id=\"`menu_${id}`\"\n\t\t\t\tref=\"content\"\n\t\t\t\t:aria-labelledby=\"id\"\n\t\t\t\taria-role=\"menu\"\n\t\t\t\tclass=\"bb-dropdown__bubble-container\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t[`bb-dropdown__bubble-container--${placement}`]: true,\n\t\t\t\t\t[`bb-dropdown__bubble-container--${theme}`]: theme,\n\t\t\t\t\t'bb-dropdown__bubble-container--hidden': closed,\n\t\t\t\t\t'bb-dropdown__bubble-container--closing': closing,\n\t\t\t\t\t'bb-dropdown__bubble-container--opening': opening,\n\t\t\t\t\t'bb-dropdown__bubble-container--open': open,\n\t\t\t\t}\"\n\t\t\t\t:style=\"{\n\t\t\t\t\t...floatingStyles,\n\t\t\t\t\ttransitionDuration: `${props.transitionDuration}ms`,\n\t\t\t\t}\"\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tref=\"bubblearrow\"\n\t\t\t\t\tclass=\"bb-dropdown__arrow\"\n\t\t\t\t\tv-bind=\"arrowAttributes\"\n\t\t\t\t></span>\n\t\t\t\t<span class=\"bb-dropdown__bubble\" :style=\"{ width: `${width}px` }\">\n\t\t\t\t\t<slot\n\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\tname=\"prepend\"\n\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t></slot>\n\t\t\t\t\t<span class=\"bb-dropdown__items-container\">\n\t\t\t\t\t\t<template v-for=\"(item, index) in mappedItems\" :key=\"item.key\">\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t:item=\"items[index]\"\n\t\t\t\t\t\t\t\t:name=\"`item:prepend`\"\n\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t></slot>\n\t\t\t\t\t\t\t<BaseButton\n\t\t\t\t\t\t\t\t:aria-role=\"'menuitem'\"\n\t\t\t\t\t\t\t\tclass=\"bb-dropdown__item\"\n\t\t\t\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t\t\t\t'bb-dropdown__item--first': index === 0,\n\t\t\t\t\t\t\t\t\t'bb-dropdown__item--last': index === items.length - 1,\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t:data-dropdown-item=\"true\"\n\t\t\t\t\t\t\t\tv-bind=\"item\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t\t:item=\"item\"\n\t\t\t\t\t\t\t\t\t:name=\"item.key\"\n\t\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t\t\t:item=\"item\"\n\t\t\t\t\t\t\t\t\t\tname=\"item\"\n\t\t\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t\t\t></slot>\n\t\t\t\t\t\t\t\t</slot>\n\t\t\t\t\t\t\t</BaseButton>\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t:item=\"items[index]\"\n\t\t\t\t\t\t\t\t:name=\"`item:append`\"\n\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t></slot>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</span>\n\t\t\t\t\t<slot\n\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\tname=\"append\"\n\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t></slot>\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</teleport>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport { findRightIndex } from '@/utilities/functions/findRightIndex';\nimport {\n\tuseFloating,\n\tautoUpdate,\n\tflip,\n\tshift,\n\tarrow,\n\toffset,\n} from '@floating-ui/vue';\nimport { useId } from '@/composables/useId';\nimport { wait } from '@/utilities/functions/wait';\nimport { useIntersectionObserver } from '@vueuse/core';\nimport BaseButton from '../BaseButton/BaseButton.vue';\nimport selectors from 'focusable-selectors';\nimport type { BaseButtonProps } from '../BaseButton/BaseButton.vue';\nimport type { CommonProps } from '@/types/CommonProps';\n\nexport type BbDropdownProps = Pick<\n\tCommonProps,\n\t| 'arrowPadding'\n\t| 'block'\n\t| 'disabled'\n\t| 'eager'\n\t| 'id'\n\t| 'offset'\n\t| 'padding'\n\t| 'placement'\n\t| 'theme'\n\t| 'transitionDuration'\n> & {\n\t/**\n\t * Array used to render each dropdown button.\n\t * They can act as `button`, as `a`, or as `router-link`\n\t * as they are based on the functionality provided by\n\t * `BaseButton`\n\t */\n\titems: Item[];\n\t/**\n\t * Width of the dropdown in pixels.\n\t */\n\twidth?: number;\n};\n\ndefineSlots<\n\t{\n\t\tactivator?: (props: {\n\t\t\tprops: {\n\t\t\t\t'aria-expanded': boolean;\n\t\t\t\t'aria-controls': string;\n\t\t\t\tid: string;\n\t\t\t\tonClick: MappedItem['onClick'];\n\t\t\t\tonKeydown: MappedItem['onKeydown'];\n\t\t\t\tdisabled?: BbDropdownProps['disabled'];\n\t\t\t};\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t}) => any;\n\t\tprepend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t}) => any;\n\t\t'item:prepend'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\titem?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\t'item:append'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\tappend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t}) => any;\n\t} & {\n\t\t[key: string]: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t}\n>();\n\nexport type Item = Omit<BaseButtonProps, 'block' | 'tag' | 'type'> & {\n\t/**\n\t * Click handler of the item.\n\t */\n\tonClick?: (...args: any[]) => any;\n\t/**\n\t * Key used to identify the element.\n\t */\n\tkey: string;\n};\n\nexport type MappedItem = Item & {\n\t/**\n\t * Identifier of the element among it's siblings.\n\t */\n\tid: string;\n\t/**\n\t * Keydown event used to handle accessibility.\n\t */\n\tonKeydown: (event: KeyboardEvent) => void;\n};\n\nconst props = withDefaults(defineProps<BbDropdownProps>(), {\n\tarrowPadding: 10,\n\tplacement: 'bottom',\n\ttheme: 'default',\n\ttransitionDuration: 150,\n\twidth: 200,\n\tpadding: 6,\n\toffset: 3,\n});\n\nconst id = props.id ?? `bb_${useId().id.value}`;\n\nconst mappedItems = computed<MappedItem[]>(() => {\n\tlet firstFocusableIndex: number = props.items.findIndex((el) => !el.disabled);\n\tlet lastFocusableIndex: number = findRightIndex(\n\t\tprops.items,\n\t\t(item) => !item.disabled\n\t);\n\n\treturn props.items.map((item, index) => {\n\t\tconst itemid = `${id}-item-${item.key}`;\n\t\tconst { onClick: handler, ...rest } = item;\n\n\t\t/* Id a click handler has been passed close the dropdown\n\t\t * return focus and run the handler\n\t\t */\n\t\tconst onClick = async () => {\n\t\t\tawait closeDropdown();\n\t\t\tconst nextElement = document.querySelector(`#${id}`);\n\t\t\tif (!nextElement) return;\n\t\t\telse if (nextElement instanceof HTMLElement) {\n\t\t\t\tnextElement.focus();\n\t\t\t}\n\t\t\tif (handler) handler();\n\t\t};\n\n\t\t/**\n\t\t * On keydown\n\t\t * arrow down move to the next focusable element if it's not the last\n\t\t * arrow up move to the previous focusable element if it's not the first\n\t\t * on tab search the next focusable element after the button that opens the dropdown\n\t\t * if an element is found focus on that\n\t\t * (the menu is attached to body so it's not in order)\n\t\t */\n\t\tconst onKeydown = (event: KeyboardEvent) => {\n\t\t\tif (\n\t\t\t\tevent.target instanceof HTMLElement &&\n\t\t\t\tevent.target.dataset['dropdownItem']\n\t\t\t) {\n\t\t\t\tif (!content.value) return;\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif (content.value && index !== lastFocusableIndex) {\n\t\t\t\t\t\tconst option = content.value.querySelector(\n\t\t\t\t\t\t\tselectors.map((selector) => `#${itemid} ~ ${selector}`).join(',')\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\t\t\t\toption.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'ArrowUp') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif (content.value && index !== firstFocusableIndex) {\n\t\t\t\t\t\tconst indexOfPrevious = findRightIndex(props.items, (item, i) => {\n\t\t\t\t\t\t\treturn i < index && !item.disabled;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst options = Array.from(\n\t\t\t\t\t\t\tcontent.value.querySelectorAll(`.bb-dropdown__item`)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst option = options[indexOfPrevious];\n\n\t\t\t\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\t\t\t\toption.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\t\tif (index === lastFocusableIndex && !event.shiftKey) {\n\t\t\t\t\t\tconst selector = selectors.join(',');\n\t\t\t\t\t\tconst focusableElements = Array.from(\n\t\t\t\t\t\t\tdocument.querySelectorAll(selector)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst indexOfButton = focusableElements.findIndex(\n\t\t\t\t\t\t\t(el) => el.id === id\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst nextElement = focusableElements[indexOfButton + 1];\n\t\t\t\t\t\tif (!nextElement) return;\n\t\t\t\t\t\telse if (nextElement instanceof HTMLElement) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tcloseDropdown();\n\t\t\t\t\t\t\tnextElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === firstFocusableIndex && event.shiftKey) {\n\t\t\t\t\t\tconst nextElement = document.querySelector(`#${id}`);\n\t\t\t\t\t\tif (!nextElement) return;\n\t\t\t\t\t\telse if (nextElement instanceof HTMLElement) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tnextElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\t...rest,\n\t\t\tdisabled: rest.disabled || props.disabled,\n\t\t\tid: itemid,\n\t\t\tonClick,\n\t\t\tonKeydown,\n\t\t};\n\t});\n});\n\nconst wrapper = ref<HTMLElement>();\nconst content = ref<HTMLElement>();\nconst bubblearrow = ref<HTMLElement>();\n\nconst { floatingStyles, placement, middlewareData } = useFloating(\n\twrapper,\n\tcontent,\n\t{\n\t\tplacement: props.placement,\n\t\twhileElementsMounted: autoUpdate,\n\t\tmiddleware: [\n\t\t\tflip(),\n\t\t\toffset(props.offset),\n\t\t\tshift({ padding: props.padding }),\n\t\t\tarrow({\n\t\t\t\telement: bubblearrow,\n\t\t\t\tpadding: props.arrowPadding,\n\t\t\t}),\n\t\t],\n\t}\n);\n\nuseIntersectionObserver(\n\twrapper,\n\t([{ intersectionRatio }]) => {\n\t\tif (intersectionRatio !== 1 && open.value) closeDropdown();\n\t},\n\t{ threshold: [0, 1] }\n);\n\nconst opening = ref(false);\nconst open = ref(false);\nconst closing = ref(false);\nconst closed = ref(true);\n\nconst arrowAttributes = computed(() => {\n\tif (middlewareData.value.arrow) {\n\t\tconst { x, y } = middlewareData.value.arrow;\n\t\treturn {\n\t\t\tstyle: {\n\t\t\t\tleft: `${x}px`,\n\t\t\t\ttop: `${y}px`,\n\t\t\t},\n\t\t};\n\t}\n\treturn undefined;\n});\n\n/* On click of the trigger attach elements */\nconst onClick = () => {\n\tif (opening.value || closing.value) return;\n\tif (open.value) {\n\t\tcloseDropdown();\n\t} else {\n\t\topenDropdown();\n\t}\n};\n\nconst onKeydown = async (event: KeyboardEvent) => {\n\tlet firstFocusableIndex: number = props.items.findIndex((el) => !el.disabled);\n\tlet lastFocusableIndex: number = findRightIndex(\n\t\tprops.items,\n\t\t(item) => !item.disabled\n\t);\n\tif (event.key === 'ArrowDown') {\n\t\tevent.preventDefault();\n\t\tif (closing.value || opening.value) return;\n\t\tif (closed.value) {\n\t\t\tawait openDropdown();\n\t\t}\n\t\tif (\n\t\t\tcontent.value &&\n\t\t\tmappedItems.value.length &&\n\t\t\tfirstFocusableIndex !== -1\n\t\t) {\n\t\t\tconst idToFocus = mappedItems.value[firstFocusableIndex].id;\n\t\t\tconst option = content.value.querySelector(`#${idToFocus}`);\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\toption.focus();\n\t\t\t}\n\t\t}\n\t} else if (event.key === 'ArrowUp') {\n\t\tevent.preventDefault();\n\t\tif (closing.value || opening.value) return;\n\t\tif (closed.value) {\n\t\t\tawait openDropdown();\n\t\t}\n\t\tif (\n\t\t\tcontent.value &&\n\t\t\tmappedItems.value.length &&\n\t\t\tlastFocusableIndex !== -1\n\t\t) {\n\t\t\tconst idToFocus = mappedItems.value[lastFocusableIndex].id;\n\t\t\tconst option = content.value.querySelector(`#${idToFocus}`);\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\toption.focus();\n\t\t\t}\n\t\t}\n\t} else if (event.key === 'Tab') {\n\t\tif (open.value && !event.shiftKey) {\n\t\t\tevent.preventDefault();\n\t\t\tif (\n\t\t\t\tcontent.value &&\n\t\t\t\tmappedItems.value.length &&\n\t\t\t\tfirstFocusableIndex !== -1\n\t\t\t) {\n\t\t\t\tconst idToFocus = mappedItems.value[firstFocusableIndex].id;\n\t\t\t\tconst option = content.value.querySelector(`#${idToFocus}`);\n\t\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\t\toption.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst onClickDocument = (event: Event) => {\n\tconst target = event.target;\n\tif (!target) return;\n\tif (target instanceof HTMLElement) {\n\t\tlet isOutside = true;\n\n\t\tif (wrapper.value) {\n\t\t\tif (wrapper.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\t\tif (content.value) {\n\t\t\tif (content.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\n\t\tif (isOutside) {\n\t\t\tcloseDropdown();\n\t\t}\n\t}\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tconst target = event.target;\n\tif (!target) return;\n\tif (target instanceof HTMLElement) {\n\t\tlet isOutside = true;\n\n\t\tif (wrapper.value) {\n\t\t\tif (wrapper.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\t\tif (content.value) {\n\t\t\tif (content.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\n\t\tif (isOutside) {\n\t\t\tcloseDropdown();\n\t\t}\n\t}\n};\n\nconst onEsc = (event: KeyboardEvent) => {\n\tif (open.value) {\n\t\tif (event.key === 'Escape') {\n\t\t\tif (document.activeElement?.id !== id) {\n\t\t\t\tconst button = document.querySelector(`#${id}`);\n\t\t\t\tif (button instanceof HTMLElement) {\n\t\t\t\t\tbutton.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t\tcloseDropdown();\n\t\t}\n\t}\n};\nconst hasOpenedOnce = ref(false);\nconst openDropdown = async () => {\n\thasOpenedOnce.value = true;\n\tclosed.value = false;\n\tclosing.value = false;\n\topening.value = true;\n\tawait wait(50);\n\topen.value = true;\n\topening.value = false;\n\t/* Attach listeners to document so we don't have to track them one by one */\n\tdocument.addEventListener('click', onClickDocument, { passive: true });\n\tdocument.addEventListener('focusin', onDocumentFocus, { passive: true });\n\tdocument.addEventListener('keydown', onEsc, { passive: true });\n};\n\nconst closeDropdown = async () => {\n\topen.value = false;\n\topening.value = false;\n\tclosing.value = true;\n\tawait wait(props.transitionDuration);\n\tclosing.value = false;\n\tclosed.value = true;\n\tdocument.removeEventListener('click', onClickDocument);\n\tdocument.removeEventListener('focusin', onDocumentFocus);\n\tdocument.removeEventListener('keydown', onEsc);\n};\n\nconst attributes = computed(() => {\n\tconst classes = {\n\t\t'bb-dropdown--block': props.block,\n\t\t[`bb-dropdown--theme-${props.theme}`]: props.theme,\n\t};\n\treturn {\n\t\tclass: classes,\n\t};\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BbDropdown';\n</style>\n"],"names":["props","__props","id","useId","mappedItems","computed","firstFocusableIndex","el","lastFocusableIndex","findRightIndex","item","index","itemid","handler","rest","onClick","closeDropdown","nextElement","onKeydown","event","content","option","selectors","selector","indexOfPrevious","i","focusableElements","indexOfButton","wrapper","ref","bubblearrow","floatingStyles","placement","middlewareData","useFloating","autoUpdate","flip","offset","shift","arrow","useIntersectionObserver","intersectionRatio","open","opening","closing","closed","arrowAttributes","x","y","openDropdown","idToFocus","onClickDocument","target","isOutside","onDocumentFocus","onEsc","_a","button","hasOpenedOnce","wait","attributes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8RA,UAAMA,IAAQC,GAURC,IAAKF,EAAM,MAAM,MAAMG,KAAQ,GAAG,KAAK,IAEvCC,IAAcC,EAAuB,MAAM;AAC5C,UAAAC,IAA8BN,EAAM,MAAM,UAAU,CAACO,MAAO,CAACA,EAAG,QAAQ,GACxEC,IAA6BC;AAAA,QAChCT,EAAM;AAAA,QACN,CAACU,MAAS,CAACA,EAAK;AAAA,MAAA;AAGjB,aAAOV,EAAM,MAAM,IAAI,CAACU,GAAMC,MAAU;AACvC,cAAMC,IAAS,GAAGV,CAAE,SAASQ,EAAK,GAAG,IAC/B,EAAE,SAASG,GAAS,GAAGC,MAASJ,GAKhCK,IAAU,YAAY;AAC3B,gBAAMC,EAAc;AACpB,gBAAMC,IAAc,SAAS,cAAc,IAAIf,CAAE,EAAE;AACnD,cAAKe,EAAa,CACTA,aAAuB,eAC/BA,EAAY,MAAM;AAAA,cAFD;AAIlB,UAAIJ,KAAiBA;QAAA,GAWhBK,IAAY,CAACC,MAAyB;AAC3C,cACCA,EAAM,kBAAkB,eACxBA,EAAM,OAAO,QAAQ,cACpB;AACG,gBAAA,CAACC,EAAQ,MAAO;AAChB,gBAAAD,EAAM,QAAQ;AAEb,kBADJA,EAAM,eAAe,GACjBC,EAAQ,SAAST,MAAUH,GAAoB;AAC5C,sBAAAa,IAASD,EAAQ,MAAM;AAAA,kBAC5BE,EAAU,IAAI,CAACC,MAAa,IAAIX,CAAM,MAAMW,CAAQ,EAAE,EAAE,KAAK,GAAG;AAAA,gBAAA;AAE7D,gBAAAF,KAAUA,aAAkB,eAC/BA,EAAO,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,IAAA,GAGxCK,IAAavD,EAAS,OAKpB;AAAA,MACN,OALe;AAAA,QACf,sBAAsBL,EAAM;AAAA,QAC5B,CAAC,sBAAsBA,EAAM,KAAK,EAAE,GAAGA,EAAM;AAAA,MAAA;AAAA,IAGtC,EAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index72.js","sources":["../src/components/BbDropdown/BbDropdown.vue"],"sourcesContent":["<template>\n\t<span class=\"bb-dropdown\" v-bind=\"attributes\">\n\t\t<span ref=\"wrapper\" class=\"bb-dropdown__wrapper\">\n\t\t\t<slot\n\t\t\t\tname=\"activator\"\n\t\t\t\tv-bind=\"{\n\t\t\t\t\tprops: {\n\t\t\t\t\t\t'aria-expanded': open,\n\t\t\t\t\t\t'aria-controls': `menu_${id}`,\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tonClick,\n\t\t\t\t\t\tonKeydown,\n\t\t\t\t\t\tdisabled,\n\t\t\t\t\t},\n\t\t\t\t\tclosed: closed,\n\t\t\t\t\tclosing: closing,\n\t\t\t\t\tdisabled: disabled,\n\t\t\t\t\topen: open,\n\t\t\t\t\topening: opening,\n\t\t\t\t\tplacement: placement,\n\t\t\t\t}\"\n\t\t\t></slot>\n\t\t</span>\n\t\t<teleport v-if=\"hasOpenedOnce || eager\" to=\"body\">\n\t\t\t<span\n\t\t\t\t:id=\"`menu_${id}`\"\n\t\t\t\tref=\"content\"\n\t\t\t\t:aria-labelledby=\"id\"\n\t\t\t\taria-role=\"menu\"\n\t\t\t\tclass=\"bb-dropdown__bubble-container\"\n\t\t\t\t:class=\"{\n\t\t\t\t\t[`bb-dropdown__bubble-container--${placement}`]: true,\n\t\t\t\t\t[`bb-dropdown__bubble-container--${theme}`]: theme,\n\t\t\t\t\t'bb-dropdown__bubble-container--hidden': closed,\n\t\t\t\t\t'bb-dropdown__bubble-container--closing': closing,\n\t\t\t\t\t'bb-dropdown__bubble-container--opening': opening,\n\t\t\t\t\t'bb-dropdown__bubble-container--open': open,\n\t\t\t\t}\"\n\t\t\t\t:style=\"{\n\t\t\t\t\t...floatingStyles,\n\t\t\t\t\ttransitionDuration: `${props.transitionDuration}ms`,\n\t\t\t\t}\"\n\t\t\t>\n\t\t\t\t<span\n\t\t\t\t\tref=\"bubblearrow\"\n\t\t\t\t\tclass=\"bb-dropdown__arrow\"\n\t\t\t\t\tv-bind=\"arrowAttributes\"\n\t\t\t\t></span>\n\t\t\t\t<span class=\"bb-dropdown__bubble\" :style=\"{ width: `${width}px` }\">\n\t\t\t\t\t<slot\n\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\tname=\"prepend\"\n\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t></slot>\n\t\t\t\t\t<span class=\"bb-dropdown__items-container\">\n\t\t\t\t\t\t<template v-for=\"(item, index) in mappedItems\" :key=\"item.key\">\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t:item=\"items[index]\"\n\t\t\t\t\t\t\t\t:name=\"`item:prepend`\"\n\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t></slot>\n\t\t\t\t\t\t\t<BaseButton\n\t\t\t\t\t\t\t\t:aria-role=\"'menuitem'\"\n\t\t\t\t\t\t\t\tclass=\"bb-dropdown__item\"\n\t\t\t\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t\t\t\t'bb-dropdown__item--first': index === 0,\n\t\t\t\t\t\t\t\t\t'bb-dropdown__item--last': index === items.length - 1,\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t:data-dropdown-item=\"true\"\n\t\t\t\t\t\t\t\tv-bind=\"item\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t\t:item=\"item\"\n\t\t\t\t\t\t\t\t\t:name=\"item.key\"\n\t\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t\t\t:item=\"item\"\n\t\t\t\t\t\t\t\t\t\tname=\"item\"\n\t\t\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t\t\t></slot>\n\t\t\t\t\t\t\t\t</slot>\n\t\t\t\t\t\t\t</BaseButton>\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t\t:disabled=\"item.disabled\"\n\t\t\t\t\t\t\t\t:index=\"index\"\n\t\t\t\t\t\t\t\t:item=\"items[index]\"\n\t\t\t\t\t\t\t\t:name=\"`item:append`\"\n\t\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t\t\t:text=\"item.text\"\n\t\t\t\t\t\t\t></slot>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</span>\n\t\t\t\t\t<slot\n\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\tname=\"append\"\n\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t></slot>\n\t\t\t\t</span>\n\t\t\t</span>\n\t\t</teleport>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport { findRightIndex } from '@/utilities/functions/findRightIndex';\nimport {\n\tuseFloating,\n\tautoUpdate,\n\tflip,\n\tshift,\n\tarrow,\n\toffset,\n} from '@floating-ui/vue';\nimport { useId } from '@/composables/useId';\nimport { wait } from '@/utilities/functions/wait';\nimport { useIntersectionObserver } from '@vueuse/core';\nimport BaseButton from '../BaseButton/BaseButton.vue';\nimport selectors from 'focusable-selectors';\nimport type { BaseButtonProps } from '../BaseButton/BaseButton.vue';\nimport type { CommonProps } from '@/types/CommonProps';\n\nexport type BbDropdownProps = Pick<\n\tCommonProps,\n\t| 'arrowPadding'\n\t| 'block'\n\t| 'disabled'\n\t| 'eager'\n\t| 'id'\n\t| 'offset'\n\t| 'padding'\n\t| 'placement'\n\t| 'theme'\n\t| 'transitionDuration'\n> & {\n\t/**\n\t * Array used to render each dropdown button.\n\t * They can act as `button`, as `a`, or as `router-link`\n\t * as they are based on the functionality provided by\n\t * `BaseButton`\n\t */\n\titems: Item[];\n\t/**\n\t * Width of the dropdown in pixels.\n\t */\n\twidth?: number;\n};\n\ndefineSlots<\n\t{\n\t\tactivator?: (props: {\n\t\t\tprops: {\n\t\t\t\t'aria-expanded': boolean;\n\t\t\t\t'aria-controls': string;\n\t\t\t\tid: string;\n\t\t\t\tonClick: MappedItem['onClick'];\n\t\t\t\tonKeydown: MappedItem['onKeydown'];\n\t\t\t\tdisabled?: BbDropdownProps['disabled'];\n\t\t\t};\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t}) => any;\n\t\tprepend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t}) => any;\n\t\t'item:prepend'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\titem?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\t'item:append'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\tappend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t}) => any;\n\t} & {\n\t\t[key: string]: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t}\n>();\n\nexport type Item = Omit<BaseButtonProps, 'block' | 'tag' | 'type'> & {\n\t/**\n\t * Click handler of the item.\n\t */\n\tonClick?: (...args: any[]) => any;\n\t/**\n\t * Key used to identify the element.\n\t */\n\tkey: string;\n};\n\nexport type MappedItem = Item & {\n\t/**\n\t * Identifier of the element among it's siblings.\n\t */\n\tid: string;\n\t/**\n\t * Keydown event used to handle accessibility.\n\t */\n\tonKeydown: (event: KeyboardEvent) => void;\n};\n\nconst props = withDefaults(defineProps<BbDropdownProps>(), {\n\tarrowPadding: 10,\n\tplacement: 'bottom',\n\ttheme: 'default',\n\ttransitionDuration: 150,\n\twidth: 200,\n\tpadding: 6,\n\toffset: 3,\n});\n\nconst id = props.id ?? `bb_${useId().id.value}`;\n\nconst mappedItems = computed<MappedItem[]>(() => {\n\tlet firstFocusableIndex: number = props.items.findIndex((el) => !el.disabled);\n\tlet lastFocusableIndex: number = findRightIndex(\n\t\tprops.items,\n\t\t(item) => !item.disabled\n\t);\n\n\treturn props.items.map((item, index) => {\n\t\tconst itemid = `${id}-item-${item.key}`;\n\t\tconst { onClick: handler, ...rest } = item;\n\n\t\t/* Id a click handler has been passed close the dropdown\n\t\t * return focus and run the handler\n\t\t */\n\t\tconst onClick = async () => {\n\t\t\tawait closeDropdown();\n\t\t\tconst nextElement = document.querySelector(`#${id}`);\n\t\t\tif (!nextElement) return;\n\t\t\telse if (nextElement instanceof HTMLElement) {\n\t\t\t\tnextElement.focus();\n\t\t\t}\n\t\t\tif (handler) handler();\n\t\t};\n\n\t\t/**\n\t\t * On keydown\n\t\t * arrow down move to the next focusable element if it's not the last\n\t\t * arrow up move to the previous focusable element if it's not the first\n\t\t * on tab search the next focusable element after the button that opens the dropdown\n\t\t * if an element is found focus on that\n\t\t * (the menu is attached to body so it's not in order)\n\t\t */\n\t\tconst onKeydown = (event: KeyboardEvent) => {\n\t\t\tif (\n\t\t\t\tevent.target instanceof HTMLElement &&\n\t\t\t\tevent.target.dataset['dropdownItem']\n\t\t\t) {\n\t\t\t\tif (!content.value) return;\n\t\t\t\tif (event.key === 'ArrowDown') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif (content.value && index !== lastFocusableIndex) {\n\t\t\t\t\t\tconst option = content.value.querySelector(\n\t\t\t\t\t\t\tselectors.map((selector) => `#${itemid} ~ ${selector}`).join(',')\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\t\t\t\toption.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'ArrowUp') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif (content.value && index !== firstFocusableIndex) {\n\t\t\t\t\t\tconst indexOfPrevious = findRightIndex(props.items, (item, i) => {\n\t\t\t\t\t\t\treturn i < index && !item.disabled;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tconst options = Array.from(\n\t\t\t\t\t\t\tcontent.value.querySelectorAll(`.bb-dropdown__item`)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tconst option = options[indexOfPrevious];\n\n\t\t\t\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\t\t\t\toption.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\t\tif (index === lastFocusableIndex && !event.shiftKey) {\n\t\t\t\t\t\tconst selector = selectors.join(',');\n\t\t\t\t\t\tconst focusableElements = Array.from(\n\t\t\t\t\t\t\tdocument.querySelectorAll(selector)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst indexOfButton = focusableElements.findIndex(\n\t\t\t\t\t\t\t(el) => el.id === id\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst nextElement = focusableElements[indexOfButton + 1];\n\t\t\t\t\t\tif (!nextElement) return;\n\t\t\t\t\t\telse if (nextElement instanceof HTMLElement) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tcloseDropdown();\n\t\t\t\t\t\t\tnextElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === firstFocusableIndex && event.shiftKey) {\n\t\t\t\t\t\tconst nextElement = document.querySelector(`#${id}`);\n\t\t\t\t\t\tif (!nextElement) return;\n\t\t\t\t\t\telse if (nextElement instanceof HTMLElement) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tnextElement.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\t...rest,\n\t\t\tdisabled: rest.disabled || props.disabled,\n\t\t\tid: itemid,\n\t\t\tonClick,\n\t\t\tonKeydown,\n\t\t};\n\t});\n});\n\nconst wrapper = ref<HTMLElement>();\nconst content = ref<HTMLElement>();\nconst bubblearrow = ref<HTMLElement>();\n\nconst { floatingStyles, placement, middlewareData } = useFloating(\n\twrapper,\n\tcontent,\n\t{\n\t\tplacement: props.placement,\n\t\twhileElementsMounted: autoUpdate,\n\t\tmiddleware: [\n\t\t\tflip(),\n\t\t\toffset(props.offset),\n\t\t\tshift({ padding: props.padding }),\n\t\t\tarrow({\n\t\t\t\telement: bubblearrow,\n\t\t\t\tpadding: props.arrowPadding,\n\t\t\t}),\n\t\t],\n\t}\n);\n\nuseIntersectionObserver(\n\twrapper,\n\t([{ intersectionRatio }]) => {\n\t\tif (intersectionRatio !== 1 && open.value) closeDropdown();\n\t},\n\t{ threshold: [0, 1] }\n);\n\nconst opening = ref(false);\nconst open = ref(false);\nconst closing = ref(false);\nconst closed = ref(true);\n\nconst arrowAttributes = computed(() => {\n\tif (middlewareData.value.arrow) {\n\t\tconst { x, y } = middlewareData.value.arrow;\n\t\treturn {\n\t\t\tstyle: {\n\t\t\t\tleft: `${x}px`,\n\t\t\t\ttop: `${y}px`,\n\t\t\t},\n\t\t};\n\t}\n\treturn undefined;\n});\n\n/* On click of the trigger attach elements */\nconst onClick = () => {\n\tif (opening.value || closing.value) return;\n\tif (open.value) {\n\t\tcloseDropdown();\n\t} else {\n\t\topenDropdown();\n\t}\n};\n\nconst onKeydown = async (event: KeyboardEvent) => {\n\tlet firstFocusableIndex: number = props.items.findIndex((el) => !el.disabled);\n\tlet lastFocusableIndex: number = findRightIndex(\n\t\tprops.items,\n\t\t(item) => !item.disabled\n\t);\n\tif (event.key === 'ArrowDown') {\n\t\tevent.preventDefault();\n\t\tif (closing.value || opening.value) return;\n\t\tif (closed.value) {\n\t\t\tawait openDropdown();\n\t\t}\n\t\tif (\n\t\t\tcontent.value &&\n\t\t\tmappedItems.value.length &&\n\t\t\tfirstFocusableIndex !== -1\n\t\t) {\n\t\t\tconst idToFocus = mappedItems.value[firstFocusableIndex].id;\n\t\t\tconst option = content.value.querySelector(`#${idToFocus}`);\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\toption.focus();\n\t\t\t}\n\t\t}\n\t} else if (event.key === 'ArrowUp') {\n\t\tevent.preventDefault();\n\t\tif (closing.value || opening.value) return;\n\t\tif (closed.value) {\n\t\t\tawait openDropdown();\n\t\t}\n\t\tif (\n\t\t\tcontent.value &&\n\t\t\tmappedItems.value.length &&\n\t\t\tlastFocusableIndex !== -1\n\t\t) {\n\t\t\tconst idToFocus = mappedItems.value[lastFocusableIndex].id;\n\t\t\tconst option = content.value.querySelector(`#${idToFocus}`);\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\toption.focus();\n\t\t\t}\n\t\t}\n\t} else if (event.key === 'Tab') {\n\t\tif (open.value && !event.shiftKey) {\n\t\t\tevent.preventDefault();\n\t\t\tif (\n\t\t\t\tcontent.value &&\n\t\t\t\tmappedItems.value.length &&\n\t\t\t\tfirstFocusableIndex !== -1\n\t\t\t) {\n\t\t\t\tconst idToFocus = mappedItems.value[firstFocusableIndex].id;\n\t\t\t\tconst option = content.value.querySelector(`#${idToFocus}`);\n\t\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\t\toption.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst onClickDocument = (event: Event) => {\n\tconst target = event.target;\n\tif (!target) return;\n\tif (target instanceof HTMLElement) {\n\t\tlet isOutside = true;\n\n\t\tif (wrapper.value) {\n\t\t\tif (wrapper.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\t\tif (content.value) {\n\t\t\tif (content.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\n\t\tif (isOutside) {\n\t\t\tcloseDropdown();\n\t\t}\n\t}\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n\tconst target = event.target;\n\tif (!target) return;\n\tif (target instanceof HTMLElement) {\n\t\tlet isOutside = true;\n\n\t\tif (wrapper.value) {\n\t\t\tif (wrapper.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\t\tif (content.value) {\n\t\t\tif (content.value.contains(target)) {\n\t\t\t\tisOutside = false;\n\t\t\t}\n\t\t}\n\n\t\tif (isOutside) {\n\t\t\tcloseDropdown();\n\t\t}\n\t}\n};\n\nconst onEsc = (event: KeyboardEvent) => {\n\tif (open.value) {\n\t\tif (event.key === 'Escape') {\n\t\t\tif (document.activeElement?.id !== id) {\n\t\t\t\tconst button = document.querySelector(`#${id}`);\n\t\t\t\tif (button instanceof HTMLElement) {\n\t\t\t\t\tbutton.focus();\n\t\t\t\t}\n\t\t\t}\n\t\t\tcloseDropdown();\n\t\t}\n\t}\n};\nconst hasOpenedOnce = ref(false);\nconst openDropdown = async () => {\n\thasOpenedOnce.value = true;\n\tclosed.value = false;\n\tclosing.value = false;\n\topening.value = true;\n\tawait wait(50);\n\topen.value = true;\n\topening.value = false;\n\t/* Attach listeners to document so we don't have to track them one by one */\n\tdocument.addEventListener('click', onClickDocument, { passive: true });\n\tdocument.addEventListener('focusin', onDocumentFocus, { passive: true });\n\tdocument.addEventListener('keydown', onEsc, { passive: true });\n};\n\nconst closeDropdown = async () => {\n\topen.value = false;\n\topening.value = false;\n\tclosing.value = true;\n\tawait wait(props.transitionDuration);\n\tclosing.value = false;\n\tclosed.value = true;\n\tdocument.removeEventListener('click', onClickDocument);\n\tdocument.removeEventListener('focusin', onDocumentFocus);\n\tdocument.removeEventListener('keydown', onEsc);\n};\n\nconst attributes = computed(() => {\n\tconst classes = {\n\t\t'bb-dropdown--block': props.block,\n\t\t[`bb-dropdown--theme-${props.theme}`]: props.theme,\n\t};\n\treturn {\n\t\tclass: classes,\n\t};\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BbDropdown';\n</style>\n"],"names":["props","__props","id","useId","mappedItems","computed","firstFocusableIndex","el","lastFocusableIndex","findRightIndex","item","index","itemid","handler","rest","onClick","closeDropdown","nextElement","onKeydown","event","content","option","selectors","selector","indexOfPrevious","i","focusableElements","indexOfButton","wrapper","ref","bubblearrow","floatingStyles","placement","middlewareData","useFloating","autoUpdate","flip","offset","shift","arrow","useIntersectionObserver","intersectionRatio","open","opening","closing","closed","arrowAttributes","x","y","openDropdown","idToFocus","onClickDocument","target","isOutside","onDocumentFocus","onEsc","_a","button","hasOpenedOnce","wait","attributes"],"mappings":";;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as c, computed as v, openBlock as B, createElementBlock as k, normalizeClass as y, createVNode as l, mergeProps as h, withCtx as o, renderSlot as d, createSlots as C, createElementVNode as m, toDisplayString as P, normalizeProps as n, guardReactiveProps as a, renderList as D } from "vue";
2
- import g from "./index13.js";
2
+ import g from "./index14.js";
3
3
  /* empty css */
4
- import L from "./index71.js";
4
+ import L from "./index72.js";
5
5
  /* empty css */
6
6
  const S = { class: "bb-dropdown-button__dropdown-label" }, _ = /* @__PURE__ */ m("svg", {
7
7
  class: "bb-dropdown-button__dropdown-chevron",
@@ -127,4 +127,4 @@ const S = { class: "bb-dropdown-button__dropdown-label" }, _ = /* @__PURE__ */ m
127
127
  export {
128
128
  R as default
129
129
  };
130
- //# sourceMappingURL=index73.js.map
130
+ //# sourceMappingURL=index74.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index73.js","sources":["../src/components/BbDropdownButton/BbDropdownButton.vue"],"sourcesContent":["<template>\n\t<span\n\t\tclass=\"bb-dropdown-button\"\n\t\t:class=\"{\n\t\t\t'bb-dropdown-button--block': block,\n\t\t\t[`bb-dropdown-button--theme-${props.theme}`]: props.theme,\n\t\t}\"\n\t>\n\t\t<BaseButton v-bind=\"mainBtn\" class=\"bb-dropdown-button__main-btn\">\n\t\t\t<slot\n\t\t\t\t:disabled=\"mainBtn.disabled\"\n\t\t\t\tname=\"left-btn\"\n\t\t\t\t:text=\"mainBtn.text\"\n\t\t\t></slot>\n\t\t</BaseButton>\n\t\t<BbDropdown\n\t\t\t:id=\"id\"\n\t\t\t:arrow-padding=\"arrowPadding\"\n\t\t\t:disabled=\"disabled\"\n\t\t\t:eager=\"eager\"\n\t\t\t:items=\"items\"\n\t\t\t:offset=\"offset\"\n\t\t\t:padding=\"padding\"\n\t\t\t:placement=\"placement\"\n\t\t\t:theme=\"theme\"\n\t\t\t:transition-duration=\"transitionDuration\"\n\t\t\t:width=\"width\"\n\t\t>\n\t\t\t<template\n\t\t\t\t#activator=\"{\n\t\t\t\t\tprops,\n\t\t\t\t\topening,\n\t\t\t\t\topen,\n\t\t\t\t\tclosed,\n\t\t\t\t\tclosing,\n\t\t\t\t\tdisabled,\n\t\t\t\t\tplacement,\n\t\t\t\t}\"\n\t\t\t>\n\t\t\t\t<slot\n\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\tname=\"activator\"\n\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t:props=\"props\"\n\t\t\t\t>\n\t\t\t\t\t<BaseButton v-bind=\"props\" class=\"bb-dropdown-button__dropdown-btn\">\n\t\t\t\t\t\t<span class=\"bb-dropdown-button__dropdown-label\"\n\t\t\t\t\t\t\t>{{ open || opening ? 'Chiudi' : 'Apri' }} il menu</span\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\t\tname=\"right-btn\"\n\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tclass=\"bb-dropdown-button__dropdown-chevron\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6l1.41 1.41Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/></svg></slot></BaseButton></slot\n\t\t\t></template>\n\t\t\t<template #prepend=\"data\"><slot name=\"prepend\" v-bind=\"data\" /></template>\n\t\t\t<template #item:prepend=\"data\">\n\t\t\t\t<slot name=\"item:prepend\" v-bind=\"data\" />\n\t\t\t</template>\n\t\t\t<template #item=\"data\"><slot name=\"item\" v-bind=\"data\" /></template>\n\t\t\t<template v-for=\"item in items\" #[item.key]=\"data\">\n\t\t\t\t<slot :name=\"item.key\" v-bind=\"data\" />\n\t\t\t</template>\n\t\t\t<template #item:append=\"data\">\n\t\t\t\t<slot name=\"item:append\" v-bind=\"data\" />\n\t\t\t</template>\n\t\t\t<template #append=\"data\"><slot name=\"append\" v-bind=\"data\" /></template>\n\t\t</BbDropdown>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport BaseButton from '../BaseButton/BaseButton.vue';\nimport BbDropdown from '../BbDropdown/BbDropdown.vue';\nimport type { BbDropdownProps, MappedItem } from '../BbDropdown/BbDropdown.vue';\n\nexport type BbDropdownButtonProps = Pick<\n\tBbDropdownProps,\n\t| 'arrowPadding'\n\t| 'block'\n\t| 'disabled'\n\t| 'eager'\n\t| 'id'\n\t| 'items'\n\t| 'offset'\n\t| 'padding'\n\t| 'placement'\n\t| 'theme'\n\t| 'transitionDuration'\n\t| 'width'\n>;\n\nconst props = withDefaults(defineProps<BbDropdownButtonProps>(), {\n\ttheme: 'default',\n});\n\ndefineSlots<\n\t{\n\t\t'left-btn'?: (props: {\n\t\t\tdisabled?: boolean;\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\tactivator?: (props: {\n\t\t\tprops: {\n\t\t\t\t'aria-expanded': boolean;\n\t\t\t\t'aria-controls': string;\n\t\t\t\tid: string;\n\t\t\t\tonClick: MappedItem['onClick'];\n\t\t\t\tonKeydown: MappedItem['onKeydown'];\n\t\t\t\tdisabled?: BbDropdownButtonProps['disabled'];\n\t\t\t};\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t\tprepend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t\t'item:prepend'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\titem?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\t'item:append'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\tappend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t\t'right-btn'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t} & {\n\t\t[key: string]: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t}\n>();\n\nconst mainBtn = computed(() => {\n\tconst base = { ...props.items[0] };\n\tbase.disabled = base.disabled || props.disabled;\n\treturn base;\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BbDropdownButton';\n</style>\n"],"names":["props","__props","mainBtn","computed","base"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GA,UAAMA,IAAQC,GAkGRC,IAAUC,EAAS,MAAM;AAC9B,YAAMC,IAAO,EAAE,GAAGJ,EAAM,MAAM,CAAC,EAAE;AAC5B,aAAAI,EAAA,WAAWA,EAAK,YAAYJ,EAAM,UAChCI;AAAA,IAAA,CACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index74.js","sources":["../src/components/BbDropdownButton/BbDropdownButton.vue"],"sourcesContent":["<template>\n\t<span\n\t\tclass=\"bb-dropdown-button\"\n\t\t:class=\"{\n\t\t\t'bb-dropdown-button--block': block,\n\t\t\t[`bb-dropdown-button--theme-${props.theme}`]: props.theme,\n\t\t}\"\n\t>\n\t\t<BaseButton v-bind=\"mainBtn\" class=\"bb-dropdown-button__main-btn\">\n\t\t\t<slot\n\t\t\t\t:disabled=\"mainBtn.disabled\"\n\t\t\t\tname=\"left-btn\"\n\t\t\t\t:text=\"mainBtn.text\"\n\t\t\t></slot>\n\t\t</BaseButton>\n\t\t<BbDropdown\n\t\t\t:id=\"id\"\n\t\t\t:arrow-padding=\"arrowPadding\"\n\t\t\t:disabled=\"disabled\"\n\t\t\t:eager=\"eager\"\n\t\t\t:items=\"items\"\n\t\t\t:offset=\"offset\"\n\t\t\t:padding=\"padding\"\n\t\t\t:placement=\"placement\"\n\t\t\t:theme=\"theme\"\n\t\t\t:transition-duration=\"transitionDuration\"\n\t\t\t:width=\"width\"\n\t\t>\n\t\t\t<template\n\t\t\t\t#activator=\"{\n\t\t\t\t\tprops,\n\t\t\t\t\topening,\n\t\t\t\t\topen,\n\t\t\t\t\tclosed,\n\t\t\t\t\tclosing,\n\t\t\t\t\tdisabled,\n\t\t\t\t\tplacement,\n\t\t\t\t}\"\n\t\t\t>\n\t\t\t\t<slot\n\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\tname=\"activator\"\n\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t:props=\"props\"\n\t\t\t\t>\n\t\t\t\t\t<BaseButton v-bind=\"props\" class=\"bb-dropdown-button__dropdown-btn\">\n\t\t\t\t\t\t<span class=\"bb-dropdown-button__dropdown-label\"\n\t\t\t\t\t\t\t>{{ open || opening ? 'Chiudi' : 'Apri' }} il menu</span\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t:closed=\"closed\"\n\t\t\t\t\t\t\t:closing=\"closing\"\n\t\t\t\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t\t\t\tname=\"right-btn\"\n\t\t\t\t\t\t\t:open=\"open\"\n\t\t\t\t\t\t\t:opening=\"opening\"\n\t\t\t\t\t\t\t:placement=\"placement\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tclass=\"bb-dropdown-button__dropdown-chevron\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<path\n\t\t\t\t\t\t\t\t\td=\"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6l-6 6l1.41 1.41Z\"\n\t\t\t\t\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\t\t\t\t/></svg></slot></BaseButton></slot\n\t\t\t></template>\n\t\t\t<template #prepend=\"data\"><slot name=\"prepend\" v-bind=\"data\" /></template>\n\t\t\t<template #item:prepend=\"data\">\n\t\t\t\t<slot name=\"item:prepend\" v-bind=\"data\" />\n\t\t\t</template>\n\t\t\t<template #item=\"data\"><slot name=\"item\" v-bind=\"data\" /></template>\n\t\t\t<template v-for=\"item in items\" #[item.key]=\"data\">\n\t\t\t\t<slot :name=\"item.key\" v-bind=\"data\" />\n\t\t\t</template>\n\t\t\t<template #item:append=\"data\">\n\t\t\t\t<slot name=\"item:append\" v-bind=\"data\" />\n\t\t\t</template>\n\t\t\t<template #append=\"data\"><slot name=\"append\" v-bind=\"data\" /></template>\n\t\t</BbDropdown>\n\t</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport BaseButton from '../BaseButton/BaseButton.vue';\nimport BbDropdown from '../BbDropdown/BbDropdown.vue';\nimport type { BbDropdownProps, MappedItem } from '../BbDropdown/BbDropdown.vue';\n\nexport type BbDropdownButtonProps = Pick<\n\tBbDropdownProps,\n\t| 'arrowPadding'\n\t| 'block'\n\t| 'disabled'\n\t| 'eager'\n\t| 'id'\n\t| 'items'\n\t| 'offset'\n\t| 'padding'\n\t| 'placement'\n\t| 'theme'\n\t| 'transitionDuration'\n\t| 'width'\n>;\n\nconst props = withDefaults(defineProps<BbDropdownButtonProps>(), {\n\ttheme: 'default',\n});\n\ndefineSlots<\n\t{\n\t\t'left-btn'?: (props: {\n\t\t\tdisabled?: boolean;\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\tactivator?: (props: {\n\t\t\tprops: {\n\t\t\t\t'aria-expanded': boolean;\n\t\t\t\t'aria-controls': string;\n\t\t\t\tid: string;\n\t\t\t\tonClick: MappedItem['onClick'];\n\t\t\t\tonKeydown: MappedItem['onKeydown'];\n\t\t\t\tdisabled?: BbDropdownButtonProps['disabled'];\n\t\t\t};\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t\tprepend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t\t'item:prepend'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\titem?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\t'item:append'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t\tappend?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t\t'right-btn'?: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: boolean;\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t}) => any;\n\t} & {\n\t\t[key: string]: (props: {\n\t\t\tclosed: boolean;\n\t\t\tclosing: boolean;\n\t\t\tdisabled?: MappedItem['disabled'];\n\t\t\tindex: number;\n\t\t\titem: BbDropdownButtonProps['items'][number];\n\t\t\topen: boolean;\n\t\t\topening: boolean;\n\t\t\tplacement: BbDropdownButtonProps['placement'];\n\t\t\ttext: MappedItem['text'];\n\t\t}) => any;\n\t}\n>();\n\nconst mainBtn = computed(() => {\n\tconst base = { ...props.items[0] };\n\tbase.disabled = base.disabled || props.disabled;\n\treturn base;\n});\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BbDropdownButton';\n</style>\n"],"names":["props","__props","mainBtn","computed","base"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GA,UAAMA,IAAQC,GAkGRC,IAAUC,EAAS,MAAM;AAC9B,YAAMC,IAAO,EAAE,GAAGJ,EAAM,MAAM,CAAC,EAAE;AAC5B,aAAAI,EAAA,WAAWA,EAAK,YAAYJ,EAAM,UAChCI;AAAA,IAAA,CACP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as j, ref as g, watch as x, computed as m, openBlock as V, createBlock as G, resolveDynamicComponent as K, normalizeClass as O, withCtx as M, createElementVNode as c, withModifiers as y, renderSlot as U, normalizeProps as Y, guardReactiveProps as Z, createTextVNode as J, unref as Q, createVNode as W, createElementBlock as F, Fragment as X, renderList as ee, toDisplayString as te } from "vue";
2
- import { findInTree as ae } from "./index245.js";
3
- import { useId as re } from "./index8.js";
4
- import oe from "./index123.js";
2
+ import { findInTree as ae } from "./index267.js";
3
+ import { useId as re } from "./index9.js";
4
+ import oe from "./index124.js";
5
5
  /* empty css */
6
6
  const le = ["accept", "autofocus", "disabled", "multiple"], se = {
7
7
  "aria-hidden": "true",
@@ -56,7 +56,7 @@ const le = ["accept", "autofocus", "disabled", "multiple"], se = {
56
56
  const r = t.accept[a];
57
57
  if (r.includes("/")) e.push(r);
58
58
  else {
59
- b || (b = (await import("./index244.js")).default);
59
+ b || (b = (await import("./index266.js")).default);
60
60
  const o = b.getType(r);
61
61
  if (!o)
62
62
  throw new Error(
@@ -221,4 +221,4 @@ const le = ["accept", "autofocus", "disabled", "multiple"], se = {
221
221
  export {
222
222
  fe as default
223
223
  };
224
- //# sourceMappingURL=index75.js.map
224
+ //# sourceMappingURL=index76.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index75.js","sources":["../src/components/BbDropzone/BbDropzone.vue"],"sourcesContent":["<template>\n\t<component :is=\"tag\" :id=\"containerId\" :class=\"classes\">\n\t\t<label\n\t\t\t@dragenter.prevent=\"setDragging\"\n\t\t\t@dragleave.prevent=\"unsetDragging\"\n\t\t\t@dragover.prevent=\"onDragOver\"\n\t\t\t@drop.prevent=\"onDrop\"\n\t\t>\n\t\t\t<input\n\t\t\t\t:accept=\"acceptedMimeTypesString\"\n\t\t\t\t:autofocus=\"autofocus\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:multiple=\"multiple\"\n\t\t\t\ttype=\"file\"\n\t\t\t\t@blur=\"onBlur\"\n\t\t\t\t@change=\"onChange\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t/>\n\t\t\t<slot v-bind=\"slotAttributes\"></slot>\n\t\t</label>\n\t\t<label aria-hidden=\"true\" class=\"bb-dropzone__submittable-label\">\n\t\t\tServer files\n\t\t\t<input\n\t\t\t\t:id=\"id\"\n\t\t\t\tref=\"submittable\"\n\t\t\t\tclass=\"bb-dropzone__submittable-input\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:multiple=\"multiple\"\n\t\t\t\t:name=\"name\"\n\t\t\t\ttype=\"file\"\n\t\t\t/>\n\t\t</label>\n\n\t\t<span class=\"bb-dropzone__errors\">\n\t\t\t<BbSmoothHeight tag=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tv-for=\"error in computedErrors\"\n\t\t\t\t\t:key=\"error\"\n\t\t\t\t\tclass=\"bb-dropzone__error\"\n\t\t\t\t\t>{{ error }}</span\n\t\t\t\t>\n\t\t\t</BbSmoothHeight>\n\t\t</span>\n\t</component>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue';\nimport { findInTree } from '@/utilities/functions/findInTree';\nimport { useId } from '@/composables/useId';\nimport BbSmoothHeight from '../BbSmoothHeight/BbSmoothHeight.vue';\nimport type { CommonProps, NonVoidElementTag } from '@/types/CommonProps';\n\nexport type DropZoneError = ReturnType<\n\t(typeof createError)[keyof typeof createError]\n>;\n\nexport type BbDropzoneProps = Pick<\n\tCommonProps,\n\t'autofocus' | 'disabled' | 'errors' | 'hasErrors' | 'id' | 'multiple' | 'name'\n> & {\n\t/**\n\t * Array of mime-types or extensions to filter selectable files.\n\t */\n\taccept?: string[];\n\t/**\n\t * Maximum number of acceptable files\n\t */\n\tmaxFiles?: number;\n\t/**\n\t * Max size of the files in bytes.\n\t */\n\tmaxSize?: number;\n\t/**\n\t * Used by v-model.\n\t */\n\tmodelValue: any;\n} & NonVoidElementTag;\n\n// This is the dynamic import for mime\nlet mime: any;\n\nconst props = withDefaults(defineProps<BbDropzoneProps>(), {\n\ttag: 'div',\n});\n\nexport type BbDropzoneEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'error', data: DropZoneError): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'update:modelValue', data: any): void;\n};\nconst emit = defineEmits<BbDropzoneEvents>();\n\ndefineSlots<{\n\tdefault?: (props: { dragging: boolean; focused: boolean; id: string }) => any;\n}>();\n\nconst submittable = ref<any | null>(null);\n\nif (props.accept) {\n\tif (!Array.isArray(props.accept)) {\n\t\tthrow new Error('Property accept is not an array');\n\t}\n}\nif (props.multiple) {\n\tif (!Array.isArray(props.modelValue)) {\n\t\tthrow new Error(\n\t\t\t'Component is set to multiple but modelValue is not an array'\n\t\t);\n\t}\n}\n\nconst hasFocus = ref(false);\nconst onFocus = (event: FocusEvent) => {\n\thasFocus.value = true;\n\temit('focus', event);\n};\nconst onBlur = (event: FocusEvent) => {\n\thasFocus.value = false;\n\temit('blur', event);\n};\n\n/** Allow dropzone to be submittable (this is flimsy and might break) */\nwatch(\n\t() => props.modelValue,\n\t() => {\n\t\tlet container = new DataTransfer();\n\t\tif (Array.isArray(props.modelValue)) {\n\t\t\tif (props.modelValue.length) {\n\t\t\t\tprops.modelValue.forEach((file) => container.items.add(file));\n\t\t\t}\n\t\t} else {\n\t\t\tif (props.modelValue) container.items.add(props.modelValue);\n\t\t}\n\t\tif (submittable.value) {\n\t\t\tif (container.items.length) {\n\t\t\t\tsubmittable.value.files = container.files;\n\t\t\t} else {\n\t\t\t\tsubmittable.value.files = null;\n\t\t\t}\n\t\t}\n\t}\n);\n\nconst acceptedMimeTypes = ref<string[]>([]);\nconst acceptedMimeTypesString = computed(() =>\n\tacceptedMimeTypes.value.join(',')\n);\nwatch(\n\t() => props.accept,\n\tasync () => {\n\t\tif (props.accept) {\n\t\t\tlet accumulated = [];\n\t\t\tfor (let i = 0; i < props.accept.length; i++) {\n\t\t\t\tconst element = props.accept[i];\n\t\t\t\tif (element.includes('/')) accumulated.push(element);\n\t\t\t\telse {\n\t\t\t\t\tif (!mime) {\n\t\t\t\t\t\tconst mod = await import('mime');\n\t\t\t\t\t\tmime = mod.default;\n\t\t\t\t\t}\n\t\t\t\t\tconst foundMime = mime.getType(element);\n\t\t\t\t\tif (!foundMime) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Could not detect the correct mime associated with ${element}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\taccumulated.push(foundMime);\n\t\t\t\t}\n\t\t\t}\n\t\t\tacceptedMimeTypes.value = accumulated;\n\t\t}\n\t},\n\t{ immediate: true }\n);\n\n/**\n * Component state\n */\nconst id = props.id || `${useId().id.value}`;\nconst containerId = `bb_dz_${id}`;\n\nconst dragging = ref(false);\n// Add a timeout to prevent browser flickering\nlet draggingTimeout: ReturnType<typeof setTimeout>;\n\nconst classes = computed(() => {\n\treturn {\n\t\t'bb-dropzone': true,\n\t\t'bb-dropzone--errors': hasErrors.value,\n\t\t'bb-dropzone--dragging': dragging.value,\n\t};\n});\nconst slotAttributes = computed(() => {\n\treturn {\n\t\tdragging: dragging.value,\n\t\tfocused: hasFocus.value,\n\t\tid: id,\n\t};\n});\n\n/**\n * Component handlers\n */\nconst onDrop = (event: DragEvent) => {\n\tdragging.value = false;\n\n\tif (event.dataTransfer) {\n\t\tevent.stopImmediatePropagation();\n\t\tlet files;\n\t\tfiles = Array.from(event.dataTransfer.files);\n\t\tfiles = parseFiles(files);\n\t\tif (props.multiple) {\n\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\temit('update:modelValue', [...props.modelValue, ...files]);\n\t\t\t}\n\t\t} else {\n\t\t\tfiles = files[0];\n\t\t\temit('update:modelValue', files);\n\t\t}\n\t\tif (event.currentTarget instanceof HTMLLabelElement) {\n\t\t\tconst innerInput = event.currentTarget.querySelector('input[type=file]');\n\t\t\tif (innerInput instanceof HTMLInputElement) {\n\t\t\t\tinnerInput.focus();\n\t\t\t}\n\t\t}\n\t}\n};\nconst onChange = (event: Event) => {\n\tif (event.target instanceof HTMLInputElement) {\n\t\tif (event.target.files) {\n\t\t\tlet files;\n\t\t\tfiles = parseFiles(Array.from(event.target.files));\n\t\t\tif (props.multiple) {\n\t\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\t\temit('update:modelValue', [...props.modelValue, ...files]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfiles = files[0];\n\t\t\t\temit('update:modelValue', files);\n\t\t\t}\n\t\t}\n\t\tevent.target.value = '';\n\t\tevent.target.files = null;\n\t}\n};\n\nconst parseFiles = (files: File[]) => {\n\treturn files.filter((file, index) => {\n\t\t// Sizecheck\n\t\tif (props.maxSize) {\n\t\t\tlet passing = file.size <= props.maxSize;\n\t\t\tif (!passing) {\n\t\t\t\temit('error', createError.maxSize(file));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// Uniqueness check\n\t\tlet alreadyExists = false;\n\t\tif (props.modelValue) {\n\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\talreadyExists = props.modelValue.some((current) =>\n\t\t\t\t\tcompareFiles(current, file)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\talreadyExists = compareFiles(props.modelValue, file);\n\t\t\t}\n\t\t}\n\t\tif (alreadyExists) {\n\t\t\temit('error', createError.uniqueness(file));\n\t\t\treturn false;\n\t\t}\n\t\t// Mime type check\n\t\tif (props.accept) {\n\t\t\tconst mimePassed = acceptedMimeTypes.value.some((mime) => {\n\t\t\t\tlet found = false;\n\t\t\t\tif (mime.includes('*'))\n\t\t\t\t\tfound = found || mime.split('/')[0] === file.type.split('/')[0];\n\t\t\t\telse found = found || mime === file.type;\n\t\t\t\treturn found;\n\t\t\t});\n\t\t\tif (!mimePassed) {\n\t\t\t\temit('error', createError.accept(file));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// Max files check\n\t\tif (props.maxFiles) {\n\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\tif (props.modelValue.length + index + 1 > props.maxFiles) {\n\t\t\t\t\temit(\n\t\t\t\t\t\t'error',\n\t\t\t\t\t\tcreateError.maxFiles(file, props.modelValue.length + index + 1)\n\t\t\t\t\t);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t});\n};\n\nconst onDragOver = (event: Event) => {\n\t// Find the closest dropzone in case of nested dropzones\n\tconst target = event.target;\n\tif (target instanceof HTMLElement) {\n\t\tconst closestDropzone = findInTree([target], 'parentElement', (el) =>\n\t\t\tel.classList.contains('bb-dropzone')\n\t\t);\n\t\tif (closestDropzone) {\n\t\t\t/* When dragging over this dropzone set as dragging */\n\t\t\tif (closestDropzone.id === containerId) {\n\t\t\t\tsetDragging();\n\t\t\t\t/* When dragging over a nested dropzone do not highlight this dropzone */\n\t\t\t} else {\n\t\t\t\tunsetDragging();\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst setDragging = () => {\n\tclearTimeout(draggingTimeout);\n\tdragging.value = true;\n};\n\nconst unsetDragging = () => {\n\tdraggingTimeout = setTimeout(() => {\n\t\tdragging.value = false;\n\t}, 100);\n};\n\nconst bytesToUnit = (bytes: number, decimals = 2) => {\n\tif (!bytes) return '0 B';\n\tconst k = 1024;\n\tconst dm = decimals || 0;\n\tconst sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\tconst i = Math.floor(Math.log(bytes) / Math.log(k));\n\treturn parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n};\n\n/**\n * Returns true if files are identical by the properties that are accessible\n * @param file The file to check\n * @param otherFile The file to check against\n */\nconst compareFiles = (file: File, otherFile: File) => {\n\tconst properties: (keyof File)[] = ['name', 'size', 'lastModified', 'type'];\n\treturn !properties.some((key) => file[key] !== otherFile[key]);\n};\n\n/**\n * Helper that creates errors based on component properties\n */\nconst createError = {\n\tmaxSize: (file: File) => {\n\t\t// Todo update to isNil\n\t\tif (props.maxSize) {\n\t\t\treturn {\n\t\t\t\ttype: 'maxSize',\n\t\t\t\tfile: file,\n\t\t\t\tformattedMaxSize: bytesToUnit(+props.maxSize),\n\t\t\t\tformattedSize: bytesToUnit(file.size),\n\t\t\t\tfilename: file.name,\n\t\t\t} as const;\n\t\t} else\n\t\t\tthrow new Error(\n\t\t\t\t'Requested to create an error for maxSize without providing a maxSize.'\n\t\t\t);\n\t},\n\tuniqueness: (file: File) => {\n\t\treturn {\n\t\t\ttype: 'uniqueness',\n\t\t\tfile: file,\n\t\t\tfilename: file.name,\n\t\t} as const;\n\t},\n\taccept: (file: File) => {\n\t\treturn {\n\t\t\ttype: 'accept',\n\t\t\tfile: file,\n\t\t\tacceptedMimeTypes: acceptedMimeTypes.value,\n\t\t\tmimeType: file.type,\n\t\t\tfilename: file.name,\n\t\t} as const;\n\t},\n\tmaxFiles: (file: File, totalFiles: number) => {\n\t\treturn {\n\t\t\ttype: 'maxFiles',\n\t\t\tfile: file,\n\t\t\tmaxFiles: props.maxFiles,\n\t\t\ttotalFiles,\n\t\t\tfilename: file.name,\n\t\t} as const;\n\t},\n};\n\nconst computedErrors = computed(() => {\n\treturn props.errors ? ([] as string[]).concat(props.errors) : [];\n});\n\nconst hasErrors = computed(\n\t() => Boolean(computedErrors.value.length) || props.hasErrors\n);\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BbDropzone';\n</style>\n"],"names":["mime","props","__props","emit","__emit","submittable","ref","hasFocus","onFocus","event","onBlur","watch","container","file","acceptedMimeTypes","acceptedMimeTypesString","computed","accumulated","i","element","foundMime","id","useId","containerId","dragging","draggingTimeout","classes","hasErrors","slotAttributes","onDrop","files","parseFiles","innerInput","onChange","index","createError","alreadyExists","current","compareFiles","found","onDragOver","target","closestDropzone","findInTree","el","setDragging","unsetDragging","bytesToUnit","bytes","decimals","k","dm","sizes","otherFile","key","totalFiles","computedErrors"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAgFI,QAAAA;AAEJ,UAAMC,IA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Z,EAAM;AACF,iBAAA;AAAA,YACN,MAAM;AAAA,YACN,MAAAY;AAAA,YACA,kBAAkBkC,EAAY,CAAC9C,EAAM,OAAO;AAAA,YAC5C,eAAe8C,EAAYlC,EAAK,IAAI;AAAA,YACpC,UAAUA,EAAK;AAAA,UAAA;AAGhB,cAAM,IAAI;AAAA,UACT;AAAA,QAAA;AAAA,MAEH;AAAA,MACA,YAAY,CAACA,OACL;AAAA,QACN,MAAM;AAAA,QACN,MAAAA;AAAA,QACA,UAAUA,EAAK;AAAA,MAAA;AAAA,MAGjB,QAAQ,CAACA,OACD;AAAA,QACN,MAAM;AAAA,QACN,MAAAA;AAAA,QACA,mBAAmBC,EAAkB;AAAA,QACrC,UAAUD,EAAK;AAAA,QACf,UAAUA,EAAK;AAAA,MAAA;AAAA,MAGjB,UAAU,CAACA,GAAY0C,OACf;AAAA,QACN,MAAM;AAAA,QACN,MAAA1C;AAAA,QACA,UAAUZ,EAAM;AAAA,QAChB,YAAAsD;AAAA,QACA,UAAU1C,EAAK;AAAA,MAAA;AAAA,IAEjB,GAGK2C,IAAiBxC,EAAS,MACxBf,EAAM,SAAU,CAAC,EAAe,OAAOA,EAAM,MAAM,IAAI,EAC9D,GAEK0B,IAAYX;AAAA,MACjB,MAAM,EAAQwC,EAAe,MAAM,UAAWvD,EAAM;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index76.js","sources":["../src/components/BbDropzone/BbDropzone.vue"],"sourcesContent":["<template>\n\t<component :is=\"tag\" :id=\"containerId\" :class=\"classes\">\n\t\t<label\n\t\t\t@dragenter.prevent=\"setDragging\"\n\t\t\t@dragleave.prevent=\"unsetDragging\"\n\t\t\t@dragover.prevent=\"onDragOver\"\n\t\t\t@drop.prevent=\"onDrop\"\n\t\t>\n\t\t\t<input\n\t\t\t\t:accept=\"acceptedMimeTypesString\"\n\t\t\t\t:autofocus=\"autofocus\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:multiple=\"multiple\"\n\t\t\t\ttype=\"file\"\n\t\t\t\t@blur=\"onBlur\"\n\t\t\t\t@change=\"onChange\"\n\t\t\t\t@focus=\"onFocus\"\n\t\t\t/>\n\t\t\t<slot v-bind=\"slotAttributes\"></slot>\n\t\t</label>\n\t\t<label aria-hidden=\"true\" class=\"bb-dropzone__submittable-label\">\n\t\t\tServer files\n\t\t\t<input\n\t\t\t\t:id=\"id\"\n\t\t\t\tref=\"submittable\"\n\t\t\t\tclass=\"bb-dropzone__submittable-input\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:multiple=\"multiple\"\n\t\t\t\t:name=\"name\"\n\t\t\t\ttype=\"file\"\n\t\t\t/>\n\t\t</label>\n\n\t\t<span class=\"bb-dropzone__errors\">\n\t\t\t<BbSmoothHeight tag=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tv-for=\"error in computedErrors\"\n\t\t\t\t\t:key=\"error\"\n\t\t\t\t\tclass=\"bb-dropzone__error\"\n\t\t\t\t\t>{{ error }}</span\n\t\t\t\t>\n\t\t\t</BbSmoothHeight>\n\t\t</span>\n\t</component>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue';\nimport { findInTree } from '@/utilities/functions/findInTree';\nimport { useId } from '@/composables/useId';\nimport BbSmoothHeight from '../BbSmoothHeight/BbSmoothHeight.vue';\nimport type { CommonProps, NonVoidElementTag } from '@/types/CommonProps';\n\nexport type DropZoneError = ReturnType<\n\t(typeof createError)[keyof typeof createError]\n>;\n\nexport type BbDropzoneProps = Pick<\n\tCommonProps,\n\t'autofocus' | 'disabled' | 'errors' | 'hasErrors' | 'id' | 'multiple' | 'name'\n> & {\n\t/**\n\t * Array of mime-types or extensions to filter selectable files.\n\t */\n\taccept?: string[];\n\t/**\n\t * Maximum number of acceptable files\n\t */\n\tmaxFiles?: number;\n\t/**\n\t * Max size of the files in bytes.\n\t */\n\tmaxSize?: number;\n\t/**\n\t * Used by v-model.\n\t */\n\tmodelValue: any;\n} & NonVoidElementTag;\n\n// This is the dynamic import for mime\nlet mime: any;\n\nconst props = withDefaults(defineProps<BbDropzoneProps>(), {\n\ttag: 'div',\n});\n\nexport type BbDropzoneEvents = {\n\t(e: 'blur', event: FocusEvent): void;\n\t(e: 'error', data: DropZoneError): void;\n\t(e: 'focus', event: FocusEvent): void;\n\t(e: 'update:modelValue', data: any): void;\n};\nconst emit = defineEmits<BbDropzoneEvents>();\n\ndefineSlots<{\n\tdefault?: (props: { dragging: boolean; focused: boolean; id: string }) => any;\n}>();\n\nconst submittable = ref<any | null>(null);\n\nif (props.accept) {\n\tif (!Array.isArray(props.accept)) {\n\t\tthrow new Error('Property accept is not an array');\n\t}\n}\nif (props.multiple) {\n\tif (!Array.isArray(props.modelValue)) {\n\t\tthrow new Error(\n\t\t\t'Component is set to multiple but modelValue is not an array'\n\t\t);\n\t}\n}\n\nconst hasFocus = ref(false);\nconst onFocus = (event: FocusEvent) => {\n\thasFocus.value = true;\n\temit('focus', event);\n};\nconst onBlur = (event: FocusEvent) => {\n\thasFocus.value = false;\n\temit('blur', event);\n};\n\n/** Allow dropzone to be submittable (this is flimsy and might break) */\nwatch(\n\t() => props.modelValue,\n\t() => {\n\t\tlet container = new DataTransfer();\n\t\tif (Array.isArray(props.modelValue)) {\n\t\t\tif (props.modelValue.length) {\n\t\t\t\tprops.modelValue.forEach((file) => container.items.add(file));\n\t\t\t}\n\t\t} else {\n\t\t\tif (props.modelValue) container.items.add(props.modelValue);\n\t\t}\n\t\tif (submittable.value) {\n\t\t\tif (container.items.length) {\n\t\t\t\tsubmittable.value.files = container.files;\n\t\t\t} else {\n\t\t\t\tsubmittable.value.files = null;\n\t\t\t}\n\t\t}\n\t}\n);\n\nconst acceptedMimeTypes = ref<string[]>([]);\nconst acceptedMimeTypesString = computed(() =>\n\tacceptedMimeTypes.value.join(',')\n);\nwatch(\n\t() => props.accept,\n\tasync () => {\n\t\tif (props.accept) {\n\t\t\tlet accumulated = [];\n\t\t\tfor (let i = 0; i < props.accept.length; i++) {\n\t\t\t\tconst element = props.accept[i];\n\t\t\t\tif (element.includes('/')) accumulated.push(element);\n\t\t\t\telse {\n\t\t\t\t\tif (!mime) {\n\t\t\t\t\t\tconst mod = await import('mime');\n\t\t\t\t\t\tmime = mod.default;\n\t\t\t\t\t}\n\t\t\t\t\tconst foundMime = mime.getType(element);\n\t\t\t\t\tif (!foundMime) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Could not detect the correct mime associated with ${element}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\taccumulated.push(foundMime);\n\t\t\t\t}\n\t\t\t}\n\t\t\tacceptedMimeTypes.value = accumulated;\n\t\t}\n\t},\n\t{ immediate: true }\n);\n\n/**\n * Component state\n */\nconst id = props.id || `${useId().id.value}`;\nconst containerId = `bb_dz_${id}`;\n\nconst dragging = ref(false);\n// Add a timeout to prevent browser flickering\nlet draggingTimeout: ReturnType<typeof setTimeout>;\n\nconst classes = computed(() => {\n\treturn {\n\t\t'bb-dropzone': true,\n\t\t'bb-dropzone--errors': hasErrors.value,\n\t\t'bb-dropzone--dragging': dragging.value,\n\t};\n});\nconst slotAttributes = computed(() => {\n\treturn {\n\t\tdragging: dragging.value,\n\t\tfocused: hasFocus.value,\n\t\tid: id,\n\t};\n});\n\n/**\n * Component handlers\n */\nconst onDrop = (event: DragEvent) => {\n\tdragging.value = false;\n\n\tif (event.dataTransfer) {\n\t\tevent.stopImmediatePropagation();\n\t\tlet files;\n\t\tfiles = Array.from(event.dataTransfer.files);\n\t\tfiles = parseFiles(files);\n\t\tif (props.multiple) {\n\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\temit('update:modelValue', [...props.modelValue, ...files]);\n\t\t\t}\n\t\t} else {\n\t\t\tfiles = files[0];\n\t\t\temit('update:modelValue', files);\n\t\t}\n\t\tif (event.currentTarget instanceof HTMLLabelElement) {\n\t\t\tconst innerInput = event.currentTarget.querySelector('input[type=file]');\n\t\t\tif (innerInput instanceof HTMLInputElement) {\n\t\t\t\tinnerInput.focus();\n\t\t\t}\n\t\t}\n\t}\n};\nconst onChange = (event: Event) => {\n\tif (event.target instanceof HTMLInputElement) {\n\t\tif (event.target.files) {\n\t\t\tlet files;\n\t\t\tfiles = parseFiles(Array.from(event.target.files));\n\t\t\tif (props.multiple) {\n\t\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\t\temit('update:modelValue', [...props.modelValue, ...files]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfiles = files[0];\n\t\t\t\temit('update:modelValue', files);\n\t\t\t}\n\t\t}\n\t\tevent.target.value = '';\n\t\tevent.target.files = null;\n\t}\n};\n\nconst parseFiles = (files: File[]) => {\n\treturn files.filter((file, index) => {\n\t\t// Sizecheck\n\t\tif (props.maxSize) {\n\t\t\tlet passing = file.size <= props.maxSize;\n\t\t\tif (!passing) {\n\t\t\t\temit('error', createError.maxSize(file));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// Uniqueness check\n\t\tlet alreadyExists = false;\n\t\tif (props.modelValue) {\n\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\talreadyExists = props.modelValue.some((current) =>\n\t\t\t\t\tcompareFiles(current, file)\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\talreadyExists = compareFiles(props.modelValue, file);\n\t\t\t}\n\t\t}\n\t\tif (alreadyExists) {\n\t\t\temit('error', createError.uniqueness(file));\n\t\t\treturn false;\n\t\t}\n\t\t// Mime type check\n\t\tif (props.accept) {\n\t\t\tconst mimePassed = acceptedMimeTypes.value.some((mime) => {\n\t\t\t\tlet found = false;\n\t\t\t\tif (mime.includes('*'))\n\t\t\t\t\tfound = found || mime.split('/')[0] === file.type.split('/')[0];\n\t\t\t\telse found = found || mime === file.type;\n\t\t\t\treturn found;\n\t\t\t});\n\t\t\tif (!mimePassed) {\n\t\t\t\temit('error', createError.accept(file));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t// Max files check\n\t\tif (props.maxFiles) {\n\t\t\tif (Array.isArray(props.modelValue)) {\n\t\t\t\tif (props.modelValue.length + index + 1 > props.maxFiles) {\n\t\t\t\t\temit(\n\t\t\t\t\t\t'error',\n\t\t\t\t\t\tcreateError.maxFiles(file, props.modelValue.length + index + 1)\n\t\t\t\t\t);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t});\n};\n\nconst onDragOver = (event: Event) => {\n\t// Find the closest dropzone in case of nested dropzones\n\tconst target = event.target;\n\tif (target instanceof HTMLElement) {\n\t\tconst closestDropzone = findInTree([target], 'parentElement', (el) =>\n\t\t\tel.classList.contains('bb-dropzone')\n\t\t);\n\t\tif (closestDropzone) {\n\t\t\t/* When dragging over this dropzone set as dragging */\n\t\t\tif (closestDropzone.id === containerId) {\n\t\t\t\tsetDragging();\n\t\t\t\t/* When dragging over a nested dropzone do not highlight this dropzone */\n\t\t\t} else {\n\t\t\t\tunsetDragging();\n\t\t\t}\n\t\t}\n\t}\n};\n\nconst setDragging = () => {\n\tclearTimeout(draggingTimeout);\n\tdragging.value = true;\n};\n\nconst unsetDragging = () => {\n\tdraggingTimeout = setTimeout(() => {\n\t\tdragging.value = false;\n\t}, 100);\n};\n\nconst bytesToUnit = (bytes: number, decimals = 2) => {\n\tif (!bytes) return '0 B';\n\tconst k = 1024;\n\tconst dm = decimals || 0;\n\tconst sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\tconst i = Math.floor(Math.log(bytes) / Math.log(k));\n\treturn parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n};\n\n/**\n * Returns true if files are identical by the properties that are accessible\n * @param file The file to check\n * @param otherFile The file to check against\n */\nconst compareFiles = (file: File, otherFile: File) => {\n\tconst properties: (keyof File)[] = ['name', 'size', 'lastModified', 'type'];\n\treturn !properties.some((key) => file[key] !== otherFile[key]);\n};\n\n/**\n * Helper that creates errors based on component properties\n */\nconst createError = {\n\tmaxSize: (file: File) => {\n\t\t// Todo update to isNil\n\t\tif (props.maxSize) {\n\t\t\treturn {\n\t\t\t\ttype: 'maxSize',\n\t\t\t\tfile: file,\n\t\t\t\tformattedMaxSize: bytesToUnit(+props.maxSize),\n\t\t\t\tformattedSize: bytesToUnit(file.size),\n\t\t\t\tfilename: file.name,\n\t\t\t} as const;\n\t\t} else\n\t\t\tthrow new Error(\n\t\t\t\t'Requested to create an error for maxSize without providing a maxSize.'\n\t\t\t);\n\t},\n\tuniqueness: (file: File) => {\n\t\treturn {\n\t\t\ttype: 'uniqueness',\n\t\t\tfile: file,\n\t\t\tfilename: file.name,\n\t\t} as const;\n\t},\n\taccept: (file: File) => {\n\t\treturn {\n\t\t\ttype: 'accept',\n\t\t\tfile: file,\n\t\t\tacceptedMimeTypes: acceptedMimeTypes.value,\n\t\t\tmimeType: file.type,\n\t\t\tfilename: file.name,\n\t\t} as const;\n\t},\n\tmaxFiles: (file: File, totalFiles: number) => {\n\t\treturn {\n\t\t\ttype: 'maxFiles',\n\t\t\tfile: file,\n\t\t\tmaxFiles: props.maxFiles,\n\t\t\ttotalFiles,\n\t\t\tfilename: file.name,\n\t\t} as const;\n\t},\n};\n\nconst computedErrors = computed(() => {\n\treturn props.errors ? ([] as string[]).concat(props.errors) : [];\n});\n\nconst hasErrors = computed(\n\t() => Boolean(computedErrors.value.length) || props.hasErrors\n);\n</script>\n\n<style lang=\"postcss\">\n@import '@/assets/css/BbDropzone';\n</style>\n"],"names":["mime","props","__props","emit","__emit","submittable","ref","hasFocus","onFocus","event","onBlur","watch","container","file","acceptedMimeTypes","acceptedMimeTypesString","computed","accumulated","i","element","foundMime","id","useId","containerId","dragging","draggingTimeout","classes","hasErrors","slotAttributes","onDrop","files","parseFiles","innerInput","onChange","index","createError","alreadyExists","current","compareFiles","found","onDragOver","target","closestDropzone","findInTree","el","setDragging","unsetDragging","byt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