@leaflink/stash 51.10.0 → 51.11.1

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 (370) hide show
  1. package/dist/Accordion.js.map +1 -1
  2. package/dist/Accordion.vue.d.ts +37 -6
  3. package/dist/ActionsDropdown.js +2 -2
  4. package/dist/ActionsDropdown.js.map +1 -1
  5. package/dist/ActionsDropdown.vue.d.ts +74 -0
  6. package/dist/AddressSelect.js +60 -56
  7. package/dist/AddressSelect.js.map +1 -1
  8. package/dist/AddressSelect.vue.d.ts +65 -8
  9. package/dist/Alert.js.map +1 -1
  10. package/dist/Alert.vue.d.ts +41 -4
  11. package/dist/AppNavigationItem.js.map +1 -1
  12. package/dist/AppNavigationItem.vue.d.ts +31 -4
  13. package/dist/AppSidebar.js.map +1 -1
  14. package/dist/AppSidebar.vue.d.ts +35 -8
  15. package/dist/AppTopbar.js +1 -1
  16. package/dist/AppTopbar.js.map +1 -1
  17. package/dist/AppTopbar.vue.d.ts +33 -4
  18. package/dist/Avatar.js.map +1 -1
  19. package/dist/Avatar.vue.d.ts +44 -5
  20. package/dist/Backdrop.js.map +1 -1
  21. package/dist/Backdrop.vue.d.ts +1 -1
  22. package/dist/Badge.js.map +1 -1
  23. package/dist/Badge.vue.d.ts +55 -6
  24. package/dist/Box.vue.d.ts +36 -3
  25. package/dist/Box.vue_vue_type_script_setup_true_lang-rFnvwLVY.js.map +1 -1
  26. package/dist/Button.js.map +1 -1
  27. package/dist/Button.vue.d.ts +50 -5
  28. package/dist/ButtonGroup.js +37 -33
  29. package/dist/ButtonGroup.js.map +1 -1
  30. package/dist/ButtonGroup.vue.d.ts +39 -6
  31. package/dist/Card.js.map +1 -1
  32. package/dist/Card.vue.d.ts +32 -5
  33. package/dist/CardContent.js.map +1 -1
  34. package/dist/CardContent.vue.d.ts +1 -1
  35. package/dist/CardFooter.js.map +1 -1
  36. package/dist/CardFooter.vue.d.ts +1 -1
  37. package/dist/CardHeader.js.map +1 -1
  38. package/dist/CardHeader.vue.d.ts +15 -2
  39. package/dist/CardMedia.js.map +1 -1
  40. package/dist/CardMedia.vue.d.ts +15 -2
  41. package/dist/Carousel.js +72 -66
  42. package/dist/Carousel.js.map +1 -1
  43. package/dist/Carousel.vue.d.ts +10 -10
  44. package/dist/Checkbox.js.map +1 -1
  45. package/dist/Checkbox.vue.d.ts +53 -8
  46. package/dist/ChevronToggle.vue.d.ts +34 -7
  47. package/dist/ChevronToggle.vue_vue_type_script_setup_true_lang-Ce_qOXfR.js.map +1 -1
  48. package/dist/Chip.js.map +1 -1
  49. package/dist/Chip.vue.d.ts +52 -10
  50. package/dist/ConfirmationCodeInput.js +44 -40
  51. package/dist/ConfirmationCodeInput.js.map +1 -1
  52. package/dist/ConfirmationCodeInput.vue.d.ts +43 -8
  53. package/dist/ContextSwitcher.js.map +1 -1
  54. package/dist/ContextSwitcher.vue.d.ts +41 -6
  55. package/dist/Copy.js.map +1 -1
  56. package/dist/Copy.vue.d.ts +34 -3
  57. package/dist/CurrencyInput.js +21 -20
  58. package/dist/CurrencyInput.js.map +1 -1
  59. package/dist/CurrencyInput.vue.d.ts +46 -125
  60. package/dist/CustomRender.js.map +1 -1
  61. package/dist/DataView.js +96 -94
  62. package/dist/DataView.js.map +1 -1
  63. package/dist/DataView.keys-aSOnA4AD.js.map +1 -1
  64. package/dist/DataView.vue.d.ts +57 -12
  65. package/dist/DataViewFilters.js +139 -127
  66. package/dist/DataViewFilters.js.map +1 -1
  67. package/dist/DataViewFilters.keys-BLu07FiP.js.map +1 -1
  68. package/dist/DataViewFilters.vue.d.ts +54 -9
  69. package/dist/DataViewSortButton.js +2 -2
  70. package/dist/DataViewSortButton.js.map +1 -1
  71. package/dist/DataViewSortButton.vue.d.ts +30 -3
  72. package/dist/DataViewToolbar.js +151 -83
  73. package/dist/DataViewToolbar.js.map +1 -1
  74. package/dist/DataViewToolbar.vue.d.ts +40 -5
  75. package/dist/DatePicker.js +4636 -4524
  76. package/dist/DatePicker.js.map +1 -1
  77. package/dist/DatePicker.vue.d.ts +79 -30
  78. package/dist/DescriptionList.js.map +1 -1
  79. package/dist/DescriptionList.vue.d.ts +32 -3
  80. package/dist/DescriptionListDetail.js.map +1 -1
  81. package/dist/DescriptionListDetail.vue.d.ts +1 -1
  82. package/dist/DescriptionListGroup.js.map +1 -1
  83. package/dist/DescriptionListGroup.vue.d.ts +1 -1
  84. package/dist/DescriptionListTerm.js.map +1 -1
  85. package/dist/DescriptionListTerm.vue.d.ts +1 -1
  86. package/dist/Dialog.js.map +1 -1
  87. package/dist/Dialog.vue.d.ts +53 -10
  88. package/dist/Divider.js.map +1 -1
  89. package/dist/Dropdown.js +95 -89
  90. package/dist/Dropdown.js.map +1 -1
  91. package/dist/Dropdown.vue.d.ts +48 -12
  92. package/dist/EmptyState.js +1 -1
  93. package/dist/EmptyState.js.map +1 -1
  94. package/dist/EmptyState.vue.d.ts +62 -5
  95. package/dist/Expand.vue.d.ts +40 -10
  96. package/dist/Expand.vue_vue_type_script_setup_true_lang-CiONJfAp.js.map +1 -1
  97. package/dist/Field.vue.d.ts +53 -4
  98. package/dist/Field.vue_vue_type_script_setup_true_lang-DI6z3AE9.js.map +1 -1
  99. package/dist/FileUpload.js +74 -72
  100. package/dist/FileUpload.js.map +1 -1
  101. package/dist/FileUpload.vue.d.ts +44 -10
  102. package/dist/FilterChip.js.map +1 -1
  103. package/dist/FilterChip.vue.d.ts +41 -6
  104. package/dist/FilterDrawerItem.js +21 -21
  105. package/dist/FilterDrawerItem.js.map +1 -1
  106. package/dist/FilterDrawerItem.vue.d.ts +23 -6
  107. package/dist/FilterDropdown.js +69 -63
  108. package/dist/FilterDropdown.js.map +1 -1
  109. package/dist/FilterDropdown.vue.d.ts +35 -122
  110. package/dist/FilterSelect.js.map +1 -1
  111. package/dist/FilterSelect.vue.d.ts +31 -4
  112. package/dist/Filters.js +164 -157
  113. package/dist/Filters.js.map +1 -1
  114. package/dist/Filters.vue.d.ts +2190 -0
  115. package/dist/HttpError.js +7 -7
  116. package/dist/HttpError.js.map +1 -1
  117. package/dist/HttpError.vue.d.ts +41 -4
  118. package/dist/Icon.js +17 -17
  119. package/dist/Icon.js.map +1 -1
  120. package/dist/Icon.vue.d.ts +36 -3
  121. package/dist/IconLabel.js.map +1 -1
  122. package/dist/IconLabel.vue.d.ts +40 -5
  123. package/dist/Illustration.js +2 -2
  124. package/dist/Illustration.vue.d.ts +42 -3
  125. package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js → Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js} +11 -11
  126. package/dist/{Illustration.vue_vue_type_script_setup_true_lang-BVzzNsRt.js.map → Illustration.vue_vue_type_script_setup_true_lang-BrqEF8xe.js.map} +1 -1
  127. package/dist/Image.js +2 -2
  128. package/dist/Image.vue.d.ts +40 -5
  129. package/dist/{Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js → Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js} +41 -37
  130. package/dist/{Image.vue_vue_type_script_setup_true_lang-Dg2Zk2r2.js.map → Image.vue_vue_type_script_setup_true_lang-D5u4av0_.js.map} +1 -1
  131. package/dist/InlineEdit.js.map +1 -1
  132. package/dist/InlineEdit.vue.d.ts +47 -126
  133. package/dist/Input.js.map +1 -1
  134. package/dist/Input.vue.d.ts +45 -12
  135. package/dist/InputOptions.js +69 -66
  136. package/dist/InputOptions.js.map +1 -1
  137. package/dist/InputOptions.vue.d.ts +55 -10
  138. package/dist/IntegrationIcon.js +7 -7
  139. package/dist/IntegrationIcon.js.map +1 -1
  140. package/dist/IntegrationIcon.vue.d.ts +36 -3
  141. package/dist/Label.vue.d.ts +42 -3
  142. package/dist/Label.vue_vue_type_script_setup_true_lang-CNquF3AP.js.map +1 -1
  143. package/dist/LicenseChip.js.map +1 -1
  144. package/dist/LicenseChip.vue.d.ts +30 -3
  145. package/dist/ListItem.js.map +1 -1
  146. package/dist/ListItem.vue.d.ts +294 -0
  147. package/dist/ListItemCell.js.map +1 -1
  148. package/dist/ListItemCell.vue.d.ts +21 -0
  149. package/dist/ListView.js +7 -4
  150. package/dist/ListView.js.map +1 -1
  151. package/dist/ListView.types.d.ts +29 -0
  152. package/dist/ListView.vue.d.ts +5496 -0
  153. package/dist/Loading.js +2 -2
  154. package/dist/Loading.js.map +1 -1
  155. package/dist/Loading.vue.d.ts +1 -1
  156. package/dist/Logo.js +1 -1
  157. package/dist/Logo.vue.d.ts +41 -6
  158. package/dist/{Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.js → Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js} +17 -17
  159. package/dist/Logo.vue_vue_type_script_setup_true_lang-Dz8c98sc.js.map +1 -0
  160. package/dist/Menu.js.map +1 -1
  161. package/dist/Menu.vue.d.ts +1 -1
  162. package/dist/MenuItem.js.map +1 -1
  163. package/dist/MenuItem.vue.d.ts +1 -1
  164. package/dist/MenusPlugin-Bk6UW6o9.js +12 -0
  165. package/dist/{MenusPlugin-B4jpNe7x.js.map → MenusPlugin-Bk6UW6o9.js.map} +1 -1
  166. package/dist/Metric.js.map +1 -1
  167. package/dist/Metric.vue.d.ts +34 -3
  168. package/dist/Modal.js +64 -62
  169. package/dist/Modal.js.map +1 -1
  170. package/dist/Modal.vue.d.ts +60 -13
  171. package/dist/Modals.js +18 -17
  172. package/dist/Modals.js.map +1 -1
  173. package/dist/ModalsPlugin.js +11 -11
  174. package/dist/ModalsPlugin.js.map +1 -1
  175. package/dist/Module.js.map +1 -1
  176. package/dist/Module.keys-CEsrW2f0.js.map +1 -1
  177. package/dist/Module.types-B1FfGGac.js.map +1 -1
  178. package/dist/Module.vue.d.ts +29 -2
  179. package/dist/ModuleContent.js.map +1 -1
  180. package/dist/ModuleContent.vue.d.ts +3 -3
  181. package/dist/ModuleFooter.js.map +1 -1
  182. package/dist/ModuleFooter.vue.d.ts +1 -1
  183. package/dist/ModuleHeader.js.map +1 -1
  184. package/dist/ModuleHeader.vue.d.ts +39 -5
  185. package/dist/MoreActions.js +491 -0
  186. package/dist/MoreActions.js.map +1 -0
  187. package/dist/MoreActions.vue.d.ts +126 -0
  188. package/dist/ObfuscateText.js.map +1 -1
  189. package/dist/ObfuscateText.vue.d.ts +40 -3
  190. package/dist/PageContent.js.map +1 -1
  191. package/dist/PageContent.vue.d.ts +30 -3
  192. package/dist/PageHeader.js.map +1 -1
  193. package/dist/PageHeader.vue.d.ts +35 -6
  194. package/dist/PageNavigation.js +50 -50
  195. package/dist/PageNavigation.js.map +1 -1
  196. package/dist/PageNavigation.vue.d.ts +36 -7
  197. package/dist/Paginate.js.map +1 -1
  198. package/dist/Paginate.vue.d.ts +40 -5
  199. package/dist/PlaidLink.js.map +1 -1
  200. package/dist/PlaidLink.vue.d.ts +49 -12
  201. package/dist/QuickAction.js.map +1 -1
  202. package/dist/QuickAction.vue.d.ts +15 -2
  203. package/dist/Radio.js.map +1 -1
  204. package/dist/Radio.vue.d.ts +93 -0
  205. package/dist/RadioGroup.js +101 -94
  206. package/dist/RadioGroup.js.map +1 -1
  207. package/dist/RadioGroup.vue.d.ts +42 -116
  208. package/dist/RadioNew.js +99 -96
  209. package/dist/RadioNew.js.map +1 -1
  210. package/dist/RadioNew.vue.d.ts +48 -7
  211. package/dist/RangeInput.js.map +1 -1
  212. package/dist/RangeInput.vue.d.ts +1 -1
  213. package/dist/SearchBar.js +39 -38
  214. package/dist/SearchBar.js.map +1 -1
  215. package/dist/SearchBar.vue.d.ts +44 -127
  216. package/dist/SectionHeader.js.map +1 -1
  217. package/dist/SectionHeader.vue.d.ts +36 -5
  218. package/dist/Select.js +183 -171
  219. package/dist/Select.js.map +1 -1
  220. package/dist/Select.vue.d.ts +102 -23
  221. package/dist/SelectStatus.js +38 -38
  222. package/dist/SelectStatus.js.map +1 -1
  223. package/dist/SelectStatus.vue.d.ts +46 -226
  224. package/dist/Skeleton.js.map +1 -1
  225. package/dist/Skeleton.vue.d.ts +34 -3
  226. package/dist/Step.js +44 -44
  227. package/dist/Step.js.map +1 -1
  228. package/dist/Step.vue.d.ts +43 -4
  229. package/dist/Stepper.js.map +1 -1
  230. package/dist/Stepper.vue.d.ts +44 -9
  231. package/dist/Switch.js.map +1 -1
  232. package/dist/Switch.vue.d.ts +47 -8
  233. package/dist/Tab.js +9 -9
  234. package/dist/Tab.js.map +1 -1
  235. package/dist/Tab.vue.d.ts +15 -2
  236. package/dist/TabPanel.js.map +1 -1
  237. package/dist/TabPanel.vue.d.ts +30 -3
  238. package/dist/Table.js +59 -53
  239. package/dist/Table.js.map +1 -1
  240. package/dist/Table.keys-LHQf6FEH.js.map +1 -1
  241. package/dist/Table.vue.d.ts +50 -3
  242. package/dist/TableCell.js +1 -1
  243. package/dist/TableCell.js.map +1 -1
  244. package/dist/TableCell.vue.d.ts +32 -3
  245. package/dist/TableHeaderCell.js +1 -1
  246. package/dist/TableHeaderCell.js.map +1 -1
  247. package/dist/TableHeaderCell.vue.d.ts +30 -3
  248. package/dist/TableHeaderRow.js +1 -1
  249. package/dist/TableHeaderRow.js.map +1 -1
  250. package/dist/TableHeaderRow.vue.d.ts +34 -5
  251. package/dist/TableRow.js +44 -43
  252. package/dist/TableRow.js.map +1 -1
  253. package/dist/TableRow.vue.d.ts +48 -7
  254. package/dist/Tabs.js +2 -2
  255. package/dist/Tabs.vue.d.ts +31 -122
  256. package/dist/Tabs.vue_vue_type_script_setup_true_lang-BlJVDr7o.js +78 -0
  257. package/dist/Tabs.vue_vue_type_script_setup_true_lang-BlJVDr7o.js.map +1 -0
  258. package/dist/TextEditor.js +2420 -2414
  259. package/dist/TextEditor.js.map +1 -1
  260. package/dist/TextEditor.vue.d.ts +39 -8
  261. package/dist/Textarea.js +32 -29
  262. package/dist/Textarea.js.map +1 -1
  263. package/dist/Textarea.vue.d.ts +44 -9
  264. package/dist/Thumbnail.js +1 -1
  265. package/dist/Thumbnail.js.map +1 -1
  266. package/dist/Thumbnail.vue.d.ts +4 -4
  267. package/dist/ThumbnailEmpty.js.map +1 -1
  268. package/dist/ThumbnailEmpty.vue.d.ts +1 -1
  269. package/dist/ThumbnailGroup.js.map +1 -1
  270. package/dist/ThumbnailGroup.keys-EJ4qFNhx.js.map +1 -1
  271. package/dist/ThumbnailGroup.vue.d.ts +22 -26
  272. package/dist/Timeline.js.map +1 -1
  273. package/dist/Timeline.vue.d.ts +32 -3
  274. package/dist/TimelineItem.js.map +1 -1
  275. package/dist/TimelineItem.vue.d.ts +1 -1
  276. package/dist/Toast.js.map +1 -1
  277. package/dist/Toast.vue.d.ts +30 -3
  278. package/dist/Toasts.js.map +1 -1
  279. package/dist/ToastsPlugin.js +11 -11
  280. package/dist/ToastsPlugin.js.map +1 -1
  281. package/dist/Tooltip.js +30 -29
  282. package/dist/Tooltip.js.map +1 -1
  283. package/dist/Tooltip.vue.d.ts +43 -11
  284. package/dist/colors-DDDVvqfQ.js.map +1 -1
  285. package/dist/components.css +1 -1
  286. package/dist/constants.js.map +1 -1
  287. package/dist/directives/autofocus.js.map +1 -1
  288. package/dist/directives/clickoutside.js.map +1 -1
  289. package/dist/directives/observe.js.map +1 -1
  290. package/dist/directives/sticky.js.map +1 -1
  291. package/dist/directives/tooltip.js +3 -3
  292. package/dist/directives/tooltip.js.map +1 -1
  293. package/dist/directives/viewable.js +44 -39
  294. package/dist/directives/viewable.js.map +1 -1
  295. package/dist/{floating-ui.vue-CL01Y9ER.js → floating-ui.vue-pzUuloyX.js} +2 -2
  296. package/dist/{floating-ui.vue-CL01Y9ER.js.map → floating-ui.vue-pzUuloyX.js.map} +1 -1
  297. package/dist/formatDateTime-Dz8bXV0R.js +1418 -0
  298. package/dist/{formatDateTime-DG7kBc2T.js.map → formatDateTime-Dz8bXV0R.js.map} +1 -1
  299. package/dist/index-C14LhAwV.js +294 -0
  300. package/dist/{index-GUu9zvbg.js.map → index-C14LhAwV.js.map} +1 -1
  301. package/dist/index-D6bxWkZ1.js.map +1 -1
  302. package/dist/index.js +104 -99
  303. package/dist/index.js.map +1 -1
  304. package/dist/isDefined-DzVx0B6k.js.map +1 -1
  305. package/dist/keys-BEdEsanp.js.map +1 -1
  306. package/dist/keys-C8Zfr_By.js.map +1 -1
  307. package/dist/locale.js.map +1 -1
  308. package/dist/misc-CHQs-G03.js.map +1 -1
  309. package/dist/obfuscateText.d.ts +1 -1
  310. package/dist/parseISO-wlfIB_QJ.js.map +1 -1
  311. package/dist/searchFuzzy-DRasJ33G.js +409 -0
  312. package/dist/{searchFuzzy-DBDE6jkd.js.map → searchFuzzy-DRasJ33G.js.map} +1 -1
  313. package/dist/statusLevels-D8EgtE_L.js.map +1 -1
  314. package/dist/storage.js.map +1 -1
  315. package/dist/tailwind-base.d.ts +18 -0
  316. package/dist/tailwind-base.js +18 -8
  317. package/dist/tailwind-base.js.map +1 -1
  318. package/dist/toTimeZone-Coq1oPTt.js.map +1 -1
  319. package/dist/useConfirmBeforeClosing.js.map +1 -1
  320. package/dist/useDialog.d.ts +2 -2
  321. package/dist/useDialog.js +25 -21
  322. package/dist/useDialog.js.map +1 -1
  323. package/dist/useGoogleMaps.js +110 -108
  324. package/dist/useGoogleMaps.js.map +1 -1
  325. package/dist/useMediaQuery.d.ts +6 -0
  326. package/dist/useMediaQuery.js +15 -11
  327. package/dist/useMediaQuery.js.map +1 -1
  328. package/dist/useModals.d.ts +1 -1
  329. package/dist/useModals.js.map +1 -1
  330. package/dist/usePaginationStats-d_q39naC.js.map +1 -1
  331. package/dist/usePlaidLink.js +27 -20
  332. package/dist/usePlaidLink.js.map +1 -1
  333. package/dist/useScriptTag.js.map +1 -1
  334. package/dist/useSearch.js +13 -13
  335. package/dist/useSearch.js.map +1 -1
  336. package/dist/useSelection.js +56 -56
  337. package/dist/useSelection.js.map +1 -1
  338. package/dist/useSortable.js +63 -54
  339. package/dist/useSortable.js.map +1 -1
  340. package/dist/useStepper.d.ts +2 -2
  341. package/dist/useStepper.js +40 -36
  342. package/dist/useStepper.js.map +1 -1
  343. package/dist/useToasts.js +23 -23
  344. package/dist/useToasts.js.map +1 -1
  345. package/dist/useValidation.js +100 -96
  346. package/dist/useValidation.js.map +1 -1
  347. package/dist/utils/calculateElementOverflow.js +4 -4
  348. package/dist/utils/calculateElementOverflow.js.map +1 -1
  349. package/dist/utils/colorScheme.js.map +1 -1
  350. package/dist/utils/createQueryString.js.map +1 -1
  351. package/dist/utils/createValidDate.js.map +1 -1
  352. package/dist/utils/formatDateTime.js +1 -1
  353. package/dist/utils/getContrastingTextColor.js.map +1 -1
  354. package/dist/utils/helpers.js.map +1 -1
  355. package/dist/utils/i18n.js.map +1 -1
  356. package/dist/utils/normalizeDate.js.map +1 -1
  357. package/dist/utils/obfuscateText.js +6 -6
  358. package/dist/utils/obfuscateText.js.map +1 -1
  359. package/dist/utils/searchFuzzy.js +1 -1
  360. package/dist/utils/storage.js +23 -23
  361. package/dist/utils/storage.js.map +1 -1
  362. package/package.json +12 -12
  363. package/tailwind-base.ts +11 -0
  364. package/dist/Logo.vue_vue_type_script_setup_true_lang-Y3iE9utm.js.map +0 -1
  365. package/dist/MenusPlugin-B4jpNe7x.js +0 -12
  366. package/dist/Tabs.vue_vue_type_script_setup_true_lang-Dprx064Y.js +0 -156
  367. package/dist/Tabs.vue_vue_type_script_setup_true_lang-Dprx064Y.js.map +0 -1
  368. package/dist/formatDateTime-DG7kBc2T.js +0 -1414
  369. package/dist/index-GUu9zvbg.js +0 -128
  370. package/dist/searchFuzzy-DBDE6jkd.js +0 -408
@@ -1,66 +1,70 @@
1
- import { ref as f, computed as p, readonly as A } from "vue";
2
- function C(v = {
1
+ import { ref as f, computed as p, readonly as w } from "vue";
2
+ function E(v = {
3
3
  linear: !1,
4
4
  activeStep: -1,
5
5
  activeSubstep: -1,
6
6
  steps: []
7
7
  }) {
8
- const u = f(v.steps ? v.steps : []), n = p(() => u.value.length), e = f(
8
+ const a = f(v.steps ? v.steps : []), o = p(() => a.value.length), e = f(
9
9
  v.activeStep !== null && v.activeStep !== void 0 ? v.activeStep : -1
10
10
  ), l = f(
11
11
  v.activeSubstep !== null && v.activeSubstep !== void 0 ? v.activeSubstep : -1
12
- ), o = p(() => Array.from(v.ref?.value?.children || [])), S = p(() => o.value[e.value]);
13
- function s(a) {
14
- return !!u.value[a].substeps.length;
12
+ ), S = p(() => {
13
+ var u, t;
14
+ return Array.from(((t = (u = v.ref) == null ? void 0 : u.value) == null ? void 0 : t.children) || []);
15
+ }), m = p(() => S.value[e.value]);
16
+ function s(u) {
17
+ return !!a.value[u].substeps.length;
15
18
  }
16
- function m() {
17
- const a = e.value === -1, t = e.value === u.value.length - 1;
18
- if (a)
19
+ function b() {
20
+ const u = e.value === -1, t = e.value === a.value.length - 1;
21
+ if (u)
19
22
  e.value++, s(e.value) && l.value++;
20
23
  else if (t)
21
24
  if (s(e.value)) {
22
- const c = l.value === -1, r = l.value === u.value[e.value].substeps.length - 1;
23
- c ? l.value++ : r ? (u.value[e.value].substeps[l.value].completed = !0, l.value = -1, u.value[e.value].completed = !0, e.value = -1) : (u.value[e.value].substeps[l.value].completed = !0, l.value++);
25
+ const i = l.value === -1, c = l.value === a.value[e.value].substeps.length - 1;
26
+ i ? l.value++ : c ? (a.value[e.value].substeps[l.value].completed = !0, l.value = -1, a.value[e.value].completed = !0, e.value = -1) : (a.value[e.value].substeps[l.value].completed = !0, l.value++);
24
27
  } else
25
- u.value[e.value].completed = !0, e.value = -1;
28
+ a.value[e.value].completed = !0, e.value = -1;
26
29
  else if (s(e.value)) {
27
- const c = l.value === -1, r = l.value === u.value[e.value].substeps.length - 1;
28
- c ? l.value++ : r ? (u.value[e.value].substeps[l.value].completed = !0, l.value = -1, u.value[e.value].completed = !0, e.value++, s(e.value) && l.value === -1 && l.value++) : (u.value[e.value].substeps[l.value].completed = !0, l.value++);
30
+ const i = l.value === -1, c = l.value === a.value[e.value].substeps.length - 1;
31
+ i ? l.value++ : c ? (a.value[e.value].substeps[l.value].completed = !0, l.value = -1, a.value[e.value].completed = !0, e.value++, s(e.value) && l.value === -1 && l.value++) : (a.value[e.value].substeps[l.value].completed = !0, l.value++);
29
32
  } else
30
- u.value[e.value].completed = !0, e.value++, s(e.value) && l.value === -1 && l.value++;
33
+ a.value[e.value].completed = !0, e.value++, s(e.value) && l.value === -1 && l.value++;
31
34
  }
32
- function b() {
33
- e.value !== -1 && (s(e.value) ? l.value === 0 ? (e.value--, l.value--, e.value >= 0 && s(e.value) && (l.value = u.value[e.value].substeps.length - 1)) : l.value-- : (e.value--, e.value >= 0 && s(e.value) && (l.value = u.value[e.value].substeps.length - 1)));
35
+ function h() {
36
+ e.value !== -1 && (s(e.value) ? l.value === 0 ? (e.value--, l.value--, e.value >= 0 && s(e.value) && (l.value = a.value[e.value].substeps.length - 1)) : l.value-- : (e.value--, e.value >= 0 && s(e.value) && (l.value = a.value[e.value].substeps.length - 1)));
34
37
  }
35
- function h(a, t = -1) {
36
- v.linear ? (i(a - 1) || a === 0) && (s(a) && (t <= 0 ? l.value = 0 : i(a, t - 1) && (l.value = t)), e.value = a) : (e.value = a, s(a) && (t < 0 ? l.value = 0 : l.value = t));
38
+ function g(u, t = -1) {
39
+ v.linear ? (r(u - 1) || u === 0) && (s(u) && (t <= 0 ? l.value = 0 : r(u, t - 1) && (l.value = t)), e.value = u) : (e.value = u, s(u) && (t < 0 ? l.value = 0 : l.value = t));
37
40
  }
38
- function i(a, t = -1) {
39
- return t >= 0 ? u.value[a]?.substeps[t]?.completed : u.value[a]?.completed;
41
+ function r(u, t = -1) {
42
+ var i, c, n;
43
+ return t >= 0 ? (c = (i = a.value[u]) == null ? void 0 : i.substeps[t]) == null ? void 0 : c.completed : (n = a.value[u]) == null ? void 0 : n.completed;
40
44
  }
41
- function g(a, t = -1) {
42
- return t >= 0 ? e.value === a && l.value === t : e.value === a;
45
+ function d(u, t = -1) {
46
+ return t >= 0 ? e.value === u && l.value === t : e.value === u;
43
47
  }
44
- function d(a = !1) {
45
- if (a && !u.value.length)
48
+ function A(u = !1) {
49
+ if (u && !a.value.length)
46
50
  throw new Error("Cannot register a substep without a parent step.");
47
- a ? u.value[u.value.length - 1].substeps.push({ completed: !1 }) : u.value.push({ completed: !1, substeps: [] });
51
+ u ? a.value[a.value.length - 1].substeps.push({ completed: !1 }) : a.value.push({ completed: !1, substeps: [] });
48
52
  }
49
53
  return {
50
- steps: A(u),
51
- stepCount: n,
52
- activeStepElement: S,
54
+ steps: w(a),
55
+ stepCount: o,
56
+ activeStepElement: m,
53
57
  activeStepIndex: e,
54
58
  activeSubstepIndex: l,
55
- registerStep: d,
56
- next: m,
57
- back: b,
58
- goTo: h,
59
- isStepActive: g,
60
- isStepCompleted: i
59
+ registerStep: A,
60
+ next: b,
61
+ back: h,
62
+ goTo: g,
63
+ isStepActive: d,
64
+ isStepCompleted: r
61
65
  };
62
66
  }
63
67
  export {
64
- C as default
68
+ E as default
65
69
  };
66
70
  //# sourceMappingURL=useStepper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStepper.js","sources":["../src/composables/useStepper/useStepper.ts"],"sourcesContent":["import { computed, readonly, Ref, ref } from 'vue';\n\nexport interface StepDefinition {\n completed: boolean;\n substeps: Array<Omit<StepDefinition, 'substeps'>>;\n}\n\nexport interface StepperOptions {\n /**\n * If true, the stepper will prevent skipping steps\n */\n linear?: boolean;\n /**\n * The index of the active step\n */\n activeStep?: number;\n /**\n * The index of the active substep\n */\n activeSubstep?: number;\n /**\n * The stepper representation as an array of steps and substeps\n */\n steps?: Array<StepDefinition>;\n /**\n * A ref to the stepper element\n */\n ref?: Ref<HTMLUListElement | null>;\n}\n\nexport default function useStepper(\n options: StepperOptions = {\n linear: false,\n activeStep: -1,\n activeSubstep: -1,\n steps: [],\n },\n) {\n /**\n * The steps and substeps of the stepper, so we can keep track of their state.\n * Can be populated with the `steps` option, or via the `registerStep` function.\n */\n const steps = ref<Array<StepDefinition>>(options.steps ? options.steps : []);\n\n const stepCount = computed(() => steps.value.length);\n\n const activeStepIndex = ref(\n options.activeStep !== null && options.activeStep !== undefined ? options.activeStep : -1,\n );\n const activeSubstepIndex = ref(\n options.activeSubstep !== null && options.activeSubstep !== undefined ? options.activeSubstep : -1,\n );\n\n const stepElements = computed(() => {\n return Array.from((options.ref?.value?.children || []) as HTMLCollectionOf<HTMLLIElement>);\n });\n\n const activeStepElement = computed(() => stepElements.value[activeStepIndex.value]);\n\n /**\n * Returns true if the step at the given index has substeps\n * @param stepIndex The index of the step to check\n */\n function stepHasSubsteps(stepIndex: number): boolean {\n return !!steps.value[stepIndex].substeps.length;\n }\n\n /**\n * Goes to the next step or substep, while flagging the current one as completed.\n * If the current step has substeps, it will go to the next substep if there are any, or to the next substep.\n * And if the next step has substeps, automatically goes to the first substep\n */\n function next(): void {\n const hasNoActiveStep = activeStepIndex.value === -1;\n const isLastStep = activeStepIndex.value === steps.value.length - 1;\n\n // If there is no active step, we want to activate the first step\n if (hasNoActiveStep) {\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep\n if (stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value++;\n }\n } else if (isLastStep) {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to reset the step and substep to -1\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n // If there are no substeps, we want to complete the current step and reset the step to -1\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n }\n } else {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to go to the next step\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n }\n }\n }\n\n function back(): void {\n // We don't want to go back if there is no active step\n if (activeStepIndex.value === -1) {\n return;\n }\n\n if (stepHasSubsteps(activeStepIndex.value)) {\n // If the active substep is the first one, we want to go back to the previous step\n if (activeSubstepIndex.value === 0) {\n activeStepIndex.value--;\n activeSubstepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n } else {\n activeSubstepIndex.value--;\n }\n } else {\n activeStepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n }\n }\n\n /**\n * Navigates to a specific step and substep.\n */\n function goTo(stepIndex: number, substepIndex = -1): void {\n // A linear stepper prevents navigation to incomplete steps\n if (options.linear) {\n if (isStepCompleted(stepIndex - 1) || stepIndex === 0) {\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex <= 0) {\n activeSubstepIndex.value = 0;\n } else if (isStepCompleted(stepIndex, substepIndex - 1)) {\n activeSubstepIndex.value = substepIndex;\n }\n }\n activeStepIndex.value = stepIndex;\n }\n } else {\n activeStepIndex.value = stepIndex;\n\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex < 0) {\n activeSubstepIndex.value = 0;\n } else {\n activeSubstepIndex.value = substepIndex;\n }\n }\n }\n }\n\n /**\n * Returns true if the step is completed.\n * if the substep index is provided, check if the substep is completed.\n */\n function isStepCompleted(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return steps.value[stepIndex]?.substeps[substepIndex]?.completed;\n } else {\n return steps.value[stepIndex]?.completed;\n }\n }\n\n /**\n * Returns true if the step is active.\n * if the substep index is provided, check both if the step and the substep are active.\n */\n function isStepActive(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return activeStepIndex.value === stepIndex && activeSubstepIndex.value === substepIndex;\n } else {\n return activeStepIndex.value === stepIndex;\n }\n }\n\n /**\n * Registers a new step or substep into the steps array\n */\n function registerStep(nested = false): void {\n if (nested && !steps.value.length) {\n throw new Error('Cannot register a substep without a parent step.');\n }\n\n if (nested) {\n steps.value[steps.value.length - 1].substeps.push({ completed: false });\n } else {\n steps.value.push({ completed: false, substeps: [] });\n }\n }\n\n return {\n steps: readonly(steps),\n stepCount,\n activeStepElement,\n activeStepIndex,\n activeSubstepIndex,\n registerStep,\n next,\n back,\n goTo,\n isStepActive,\n isStepCompleted,\n };\n}\n"],"names":["useStepper","options","steps","ref","stepCount","computed","activeStepIndex","activeSubstepIndex","stepElements","activeStepElement","stepHasSubsteps","stepIndex","next","hasNoActiveStep","isLastStep","hasNoActiveSubstep","isLastSubstep","back","goTo","substepIndex","isStepCompleted","isStepActive","registerStep","nested","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/composables/useStepper/useStepper.ts"],"sourcesContent":["import { computed, readonly, Ref, ref } from 'vue';\n\nexport interface StepDefinition {\n completed: boolean;\n substeps: Array<Omit<StepDefinition, 'substeps'>>;\n}\n\nexport interface StepperOptions {\n /**\n * If true, the stepper will prevent skipping steps\n */\n linear?: boolean;\n /**\n * The index of the active step\n */\n activeStep?: number;\n /**\n * The index of the active substep\n */\n activeSubstep?: number;\n /**\n * The stepper representation as an array of steps and substeps\n */\n steps?: Array<StepDefinition>;\n /**\n * A ref to the stepper element\n */\n ref?: Ref<HTMLUListElement | null>;\n}\n\nexport default function useStepper(\n options: StepperOptions = {\n linear: false,\n activeStep: -1,\n activeSubstep: -1,\n steps: [],\n },\n) {\n /**\n * The steps and substeps of the stepper, so we can keep track of their state.\n * Can be populated with the `steps` option, or via the `registerStep` function.\n */\n const steps = ref<Array<StepDefinition>>(options.steps ? options.steps : []);\n\n const stepCount = computed(() => steps.value.length);\n\n const activeStepIndex = ref(\n options.activeStep !== null && options.activeStep !== undefined ? options.activeStep : -1,\n );\n const activeSubstepIndex = ref(\n options.activeSubstep !== null && options.activeSubstep !== undefined ? options.activeSubstep : -1,\n );\n\n const stepElements = computed(() => {\n return Array.from((options.ref?.value?.children || []) as HTMLCollectionOf<HTMLLIElement>);\n });\n\n const activeStepElement = computed(() => stepElements.value[activeStepIndex.value]);\n\n /**\n * Returns true if the step at the given index has substeps\n * @param stepIndex The index of the step to check\n */\n function stepHasSubsteps(stepIndex: number): boolean {\n return !!steps.value[stepIndex].substeps.length;\n }\n\n /**\n * Goes to the next step or substep, while flagging the current one as completed.\n * If the current step has substeps, it will go to the next substep if there are any, or to the next substep.\n * And if the next step has substeps, automatically goes to the first substep\n */\n function next(): void {\n const hasNoActiveStep = activeStepIndex.value === -1;\n const isLastStep = activeStepIndex.value === steps.value.length - 1;\n\n // If there is no active step, we want to activate the first step\n if (hasNoActiveStep) {\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep\n if (stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value++;\n }\n } else if (isLastStep) {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to reset the step and substep to -1\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n // If there are no substeps, we want to complete the current step and reset the step to -1\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value = -1;\n }\n } else {\n if (stepHasSubsteps(activeStepIndex.value)) {\n const hasNoActiveSubstep = activeSubstepIndex.value === -1;\n const isLastSubstep = activeSubstepIndex.value === steps.value[activeStepIndex.value].substeps.length - 1;\n\n // if there are no active substeps, we want to activate the first substep\n if (hasNoActiveSubstep) {\n activeSubstepIndex.value++;\n // if the active substep is the last one, we want to go to the next step\n } else if (isLastSubstep) {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value = -1;\n\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n // if there are more substeps, we want to complete the current one and proceed to the next substep\n } else {\n steps.value[activeStepIndex.value].substeps[activeSubstepIndex.value].completed = true;\n activeSubstepIndex.value++;\n }\n } else {\n steps.value[activeStepIndex.value].completed = true;\n activeStepIndex.value++;\n\n // If the step we just navigated to has substeps, we want to activate the first substep right away\n if (stepHasSubsteps(activeStepIndex.value) && activeSubstepIndex.value === -1) {\n activeSubstepIndex.value++;\n }\n }\n }\n }\n\n function back(): void {\n // We don't want to go back if there is no active step\n if (activeStepIndex.value === -1) {\n return;\n }\n\n if (stepHasSubsteps(activeStepIndex.value)) {\n // If the active substep is the first one, we want to go back to the previous step\n if (activeSubstepIndex.value === 0) {\n activeStepIndex.value--;\n activeSubstepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n } else {\n activeSubstepIndex.value--;\n }\n } else {\n activeStepIndex.value--;\n\n // If the step that we just navigated to has substeps, we want to navigate to the last substep\n if (activeStepIndex.value >= 0 && stepHasSubsteps(activeStepIndex.value)) {\n activeSubstepIndex.value = steps.value[activeStepIndex.value].substeps.length - 1;\n }\n }\n }\n\n /**\n * Navigates to a specific step and substep.\n */\n function goTo(stepIndex: number, substepIndex = -1): void {\n // A linear stepper prevents navigation to incomplete steps\n if (options.linear) {\n if (isStepCompleted(stepIndex - 1) || stepIndex === 0) {\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex <= 0) {\n activeSubstepIndex.value = 0;\n } else if (isStepCompleted(stepIndex, substepIndex - 1)) {\n activeSubstepIndex.value = substepIndex;\n }\n }\n activeStepIndex.value = stepIndex;\n }\n } else {\n activeStepIndex.value = stepIndex;\n\n if (stepHasSubsteps(stepIndex)) {\n if (substepIndex < 0) {\n activeSubstepIndex.value = 0;\n } else {\n activeSubstepIndex.value = substepIndex;\n }\n }\n }\n }\n\n /**\n * Returns true if the step is completed.\n * if the substep index is provided, check if the substep is completed.\n */\n function isStepCompleted(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return steps.value[stepIndex]?.substeps[substepIndex]?.completed;\n } else {\n return steps.value[stepIndex]?.completed;\n }\n }\n\n /**\n * Returns true if the step is active.\n * if the substep index is provided, check both if the step and the substep are active.\n */\n function isStepActive(stepIndex: number, substepIndex = -1): boolean {\n if (substepIndex >= 0) {\n return activeStepIndex.value === stepIndex && activeSubstepIndex.value === substepIndex;\n } else {\n return activeStepIndex.value === stepIndex;\n }\n }\n\n /**\n * Registers a new step or substep into the steps array\n */\n function registerStep(nested = false): void {\n if (nested && !steps.value.length) {\n throw new Error('Cannot register a substep without a parent step.');\n }\n\n if (nested) {\n steps.value[steps.value.length - 1].substeps.push({ completed: false });\n } else {\n steps.value.push({ completed: false, substeps: [] });\n }\n }\n\n return {\n steps: readonly(steps),\n stepCount,\n activeStepElement,\n activeStepIndex,\n activeSubstepIndex,\n registerStep,\n next,\n back,\n goTo,\n isStepActive,\n isStepCompleted,\n };\n}\n"],"names":["useStepper","options","steps","ref","stepCount","computed","activeStepIndex","activeSubstepIndex","stepElements","_b","_a","activeStepElement","stepHasSubsteps","stepIndex","next","hasNoActiveStep","isLastStep","hasNoActiveSubstep","isLastSubstep","back","goTo","substepIndex","isStepCompleted","_c","isStepActive","registerStep","nested","readonly"],"mappings":";AA8BA,SAAwBA,EACtBC,IAA0B;AAAA,EACxB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,OAAO,CAAA;AACT,GACA;AAKA,QAAMC,IAAQC,EAA2BF,EAAQ,QAAQA,EAAQ,QAAQ,EAAE,GAErEG,IAAYC,EAAS,MAAMH,EAAM,MAAM,MAAM,GAE7CI,IAAkBH;AAAA,IACtBF,EAAQ,eAAe,QAAQA,EAAQ,eAAe,SAAYA,EAAQ,aAAa;AAAA,EACzF,GACMM,IAAqBJ;AAAA,IACzBF,EAAQ,kBAAkB,QAAQA,EAAQ,kBAAkB,SAAYA,EAAQ,gBAAgB;AAAA,EAClG,GAEMO,IAAeH,EAAS,MAAM;;AAClC,WAAO,MAAM,OAAMI,KAAAC,IAAAT,EAAQ,QAAR,gBAAAS,EAAa,UAAb,gBAAAD,E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gD,aAEhDc,IAAArB,EAAM,MAAMW,CAAS,MAArB,gBAAAU,EAAwB;AAAA,EACjC;AAOO,WAAAC,EAAaX,GAAmBQ,IAAe,IAAa;AACnE,WAAIA,KAAgB,IACXf,EAAgB,UAAUO,KAAaN,EAAmB,UAAUc,IAEpEf,EAAgB,UAAUO;AAAA,EACnC;AAMO,WAAAY,EAAaC,IAAS,IAAa;AAC1C,QAAIA,KAAU,CAACxB,EAAM,MAAM;AACnB,YAAA,IAAI,MAAM,kDAAkD;AAGpE,IAAIwB,IACIxB,EAAA,MAAMA,EAAM,MAAM,SAAS,CAAC,EAAE,SAAS,KAAK,EAAE,WAAW,GAAA,CAAO,IAEhEA,EAAA,MAAM,KAAK,EAAE,WAAW,IAAO,UAAU,CAAA,GAAI;AAAA,EACrD;AAGK,SAAA;AAAA,IACL,OAAOyB,EAASzB,CAAK;AAAA,IACrB,WAAAE;AAAA,IACA,mBAAAO;AAAA,IACA,iBAAAL;AAAA,IACA,oBAAAC;AAAA,IACA,cAAAkB;AAAA,IACA,MAAAX;AAAA,IACA,MAAAK;AAAA,IACA,MAAAC;AAAA,IACA,cAAAI;AAAA,IACA,iBAAAF;AAAA,EACF;AACF;"}
package/dist/useToasts.js CHANGED
@@ -2,38 +2,38 @@ import l from "lodash-es/merge";
2
2
  import T from "lodash-es/uniqueId";
3
3
  import { ref as h, reactive as y, readonly as b } from "vue";
4
4
  const w = 5e3, n = h([]);
5
- function M(c = { timeout: w }) {
6
- function s(o) {
7
- const e = typeof o == "string" ? o : void 0, { group: i = void 0, status: t = void 0 } = typeof o == "object" ? o : {};
8
- if (!e && (!i || !t))
5
+ function M(s = { timeout: w }) {
6
+ function c(e) {
7
+ const o = typeof e == "string" ? e : void 0, { group: i = void 0, status: t = void 0 } = typeof e == "object" ? e : {};
8
+ if (!o && (!i || !t))
9
9
  throw new Error("Must provide either a toast ID or both group and type");
10
- const r = i && t ? `toast-${t}-${i}` : String(e), f = n.value.findIndex(({ id: g }) => g === r);
10
+ const r = i && t ? `toast-${t}-${i}` : String(o), f = n.value.findIndex(({ id: g }) => g === r);
11
11
  f !== -1 && n.value.splice(f, 1);
12
12
  }
13
- function u(o, e, i) {
14
- const t = l({}, c, i), r = t?.group ? `toast-${e}-${t.group}` : T("toast-");
15
- if (!(t?.group && n.value.some(({ id: f }) => f === r)))
13
+ function u(e, o, i) {
14
+ const t = l({}, s, i), r = t != null && t.group ? `toast-${o}-${t.group}` : T("toast-");
15
+ if (!(t != null && t.group && n.value.some(({ id: f }) => f === r)))
16
16
  return n.value.push({
17
- text: o,
17
+ text: e,
18
18
  id: r,
19
- status: e,
19
+ status: o,
20
20
  offsetTop: t.offsetTop
21
- }), typeof t.timeout == "number" && setTimeout(() => s(r), Math.abs(t.timeout)), r;
21
+ }), typeof t.timeout == "number" && setTimeout(() => c(r), Math.abs(t.timeout)), r;
22
22
  }
23
23
  function a() {
24
24
  n.value = [];
25
25
  }
26
- function m(o, e) {
27
- return u(o, "error", e);
26
+ function m(e, o) {
27
+ return u(e, "error", o);
28
28
  }
29
- function p(o, e) {
30
- return u(o, "info", e);
29
+ function v(e, o) {
30
+ return u(e, "info", o);
31
31
  }
32
- function v(o, e) {
33
- return u(o, "success", e);
32
+ function d(e, o) {
33
+ return u(e, "success", o);
34
34
  }
35
- function d(o, e) {
36
- return u(o, "warning", e);
35
+ function p(e, o) {
36
+ return u(e, "warning", o);
37
37
  }
38
38
  return y({
39
39
  /**
@@ -43,7 +43,7 @@ function M(c = { timeout: w }) {
43
43
  /**
44
44
  * Removes an active/visible toast by id or by group and type.
45
45
  */
46
- remove: s,
46
+ remove: c,
47
47
  /**
48
48
  * Creates a new toast and makes it active/visible.
49
49
  */
@@ -59,15 +59,15 @@ function M(c = { timeout: w }) {
59
59
  /**
60
60
  * Creates a new "info" toast.
61
61
  */
62
- info: p,
62
+ info: v,
63
63
  /**
64
64
  * Creates a new "success" toast.
65
65
  */
66
- success: v,
66
+ success: d,
67
67
  /**
68
68
  * Creates a new "warning" toast.
69
69
  */
70
- warning: d
70
+ warning: p
71
71
  });
72
72
  }
73
73
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"useToasts.js","sources":["../src/composables/useToasts/useToasts.ts"],"sourcesContent":["import merge from 'lodash-es/merge';\nimport uniqueId from 'lodash-es/uniqueId';\nimport { reactive, readonly, ref, RenderFunction } from 'vue';\n\nimport { StatusSeverity } from '../../../types/statusLevels';\n\nexport const DEFAULT_TIMEOUT = 5000;\n\nexport type Toast = {\n id: string;\n text: string | RenderFunction;\n status: StatusSeverity;\n offsetTop?: string;\n};\n\nexport interface ToastOptions {\n /**\n * The timeout in milliseconds before the toast is automatically dismissed. If set to `false`, the toast will persist until the user clicks on it.\n * @default DEFAULT_TIMEOUT\n */\n timeout?: number | boolean;\n /**\n * A group name ensures only one toast with the same group and status is visible at any given time.\n * Toasts with the same group but different statuses will be treated as separate and will display concurrently.\n */\n group?: string;\n /**\n * The container distance from the top of the viewport.\n */\n offsetTop?: string;\n}\n\ntype ToastIdOrUndefined<O extends ToastOptions | undefined> = O extends { id: string }\n ? Toast['id'] | undefined\n : Toast['id'];\n\nconst active = ref<Toast[]>([]);\n\nexport default function useToasts(globalOptions: Omit<ToastOptions, 'group'> = { timeout: DEFAULT_TIMEOUT }) {\n // method overloads\n function remove(toastId: Toast['id']): void;\n function remove(options: { group: string; status: StatusSeverity }): void;\n function remove(toastIdOrOptions: Toast['id'] | { group: string; status: StatusSeverity }) {\n const toastId = typeof toastIdOrOptions === 'string' ? toastIdOrOptions : undefined;\n const { group = undefined, status = undefined } = typeof toastIdOrOptions === 'object' ? toastIdOrOptions : {};\n\n if (!toastId && (!group || !status)) {\n throw new Error('Must provide either a toast ID or both group and type');\n }\n\n const idToRemove = group && status ? `toast-${status}-${group}` : String(toastId);\n const index = active.value.findIndex(({ id }) => id === idToRemove);\n if (index === -1) {\n return;\n }\n\n active.value.splice(index, 1);\n }\n\n // method overloads\n function create(text: Toast['text'], status: StatusSeverity, options?: Omit<ToastOptions, 'group'>): Toast['id'];\n function create(\n text: Toast['text'],\n status: StatusSeverity,\n options: ToastOptions & { id: string },\n ): Toast['id'] | undefined;\n function create(text: Toast['text'], status: StatusSeverity, localOptions?: ToastOptions): Toast['id'] | undefined {\n const options = merge({}, globalOptions, localOptions);\n\n const id = options?.group ? `toast-${status}-${options.group}` : uniqueId('toast-');\n if (options?.group && active.value.some(({ id: existingId }) => existingId === id)) {\n return;\n }\n\n active.value.push({\n text,\n id,\n status,\n offsetTop: options.offsetTop,\n });\n\n if (typeof options.timeout === 'number') {\n setTimeout(() => remove(id), Math.abs(options.timeout));\n }\n\n return id;\n }\n\n function removeAll() {\n active.value = [];\n }\n\n function error<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'error', options);\n }\n\n function info<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'info', options);\n }\n\n function success<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'success', options);\n }\n\n function warning<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'warning', options);\n }\n\n return reactive({\n /**\n * The list of toasts that are currently visible.\n */\n active: readonly(active),\n\n /**\n * Removes an active/visible toast by id or by group and type.\n */\n remove,\n\n /**\n * Creates a new toast and makes it active/visible.\n */\n create,\n\n /**\n * Removes all active/visible toasts.\n */\n removeAll,\n\n /**\n * Creates a new \"error\" toast.\n */\n error,\n\n /**\n * Creates a new \"info\" toast.\n */\n info,\n\n /**\n * Creates a new \"success\" toast.\n */\n success,\n\n /**\n * Creates a new \"warning\" toast.\n */\n warning,\n });\n}\n"],"names":["DEFAULT_TIMEOUT","active","ref","useToasts","globalOptions","remove","toastIdOrOptions","toastId","group","status","idToRemove","index","id","create","text","localOptions","options","merge","uniqueId","existingId","removeAll","error","info","success","warning","reactive","readonly"],"mappings":";;;AAMO,MAAMA,IAAkB,KA8BzBC,IAASC,EAAa,EAAE;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C7F,WAAOH,EAAOC,GAAM,QAAQE,CAAO;AAAA,EACrC;AAEA,WAASO,EAAgCT,GAAqBE,GAAoC;AAChG,WAAOH,EAAOC,GAAM,WAAWE,CAAO;AAAA,EACxC;AAEA,WAASQ,EAAgCV,GAAqBE,GAAoC;AAChG,WAAOH,EAAOC,GAAM,WAAWE,CAAO;AAAA,EACxC;AAEA,SAAOS,EAAS;AAAA;AAAA;AAAA;AAAA,IAId,QAAQC,EAASzB,CAAM;AAAA;AAAA;AAAA;AAAA,IAKvB,QAAAI;AAAA;AAAA;AAAA;AAAA,IAKA,QAAAQ;AAAA;AAAA;AAAA;AAAA,IAKA,WAAAO;AAAA;AAAA;AAAA;AAAA,IAKA,OAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,MAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,SAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,SAAAC;AAAA,EAAA,CACD;AACH;"}
1
+ {"version":3,"file":"useToasts.js","sources":["../src/composables/useToasts/useToasts.ts"],"sourcesContent":["import merge from 'lodash-es/merge';\nimport uniqueId from 'lodash-es/uniqueId';\nimport { reactive, readonly, ref, RenderFunction } from 'vue';\n\nimport { StatusSeverity } from '../../../types/statusLevels';\n\nexport const DEFAULT_TIMEOUT = 5000;\n\nexport type Toast = {\n id: string;\n text: string | RenderFunction;\n status: StatusSeverity;\n offsetTop?: string;\n};\n\nexport interface ToastOptions {\n /**\n * The timeout in milliseconds before the toast is automatically dismissed. If set to `false`, the toast will persist until the user clicks on it.\n * @default DEFAULT_TIMEOUT\n */\n timeout?: number | boolean;\n /**\n * A group name ensures only one toast with the same group and status is visible at any given time.\n * Toasts with the same group but different statuses will be treated as separate and will display concurrently.\n */\n group?: string;\n /**\n * The container distance from the top of the viewport.\n */\n offsetTop?: string;\n}\n\ntype ToastIdOrUndefined<O extends ToastOptions | undefined> = O extends { id: string }\n ? Toast['id'] | undefined\n : Toast['id'];\n\nconst active = ref<Toast[]>([]);\n\nexport default function useToasts(globalOptions: Omit<ToastOptions, 'group'> = { timeout: DEFAULT_TIMEOUT }) {\n // method overloads\n function remove(toastId: Toast['id']): void;\n function remove(options: { group: string; status: StatusSeverity }): void;\n function remove(toastIdOrOptions: Toast['id'] | { group: string; status: StatusSeverity }) {\n const toastId = typeof toastIdOrOptions === 'string' ? toastIdOrOptions : undefined;\n const { group = undefined, status = undefined } = typeof toastIdOrOptions === 'object' ? toastIdOrOptions : {};\n\n if (!toastId && (!group || !status)) {\n throw new Error('Must provide either a toast ID or both group and type');\n }\n\n const idToRemove = group && status ? `toast-${status}-${group}` : String(toastId);\n const index = active.value.findIndex(({ id }) => id === idToRemove);\n if (index === -1) {\n return;\n }\n\n active.value.splice(index, 1);\n }\n\n // method overloads\n function create(text: Toast['text'], status: StatusSeverity, options?: Omit<ToastOptions, 'group'>): Toast['id'];\n function create(\n text: Toast['text'],\n status: StatusSeverity,\n options: ToastOptions & { id: string },\n ): Toast['id'] | undefined;\n function create(text: Toast['text'], status: StatusSeverity, localOptions?: ToastOptions): Toast['id'] | undefined {\n const options = merge({}, globalOptions, localOptions);\n\n const id = options?.group ? `toast-${status}-${options.group}` : uniqueId('toast-');\n if (options?.group && active.value.some(({ id: existingId }) => existingId === id)) {\n return;\n }\n\n active.value.push({\n text,\n id,\n status,\n offsetTop: options.offsetTop,\n });\n\n if (typeof options.timeout === 'number') {\n setTimeout(() => remove(id), Math.abs(options.timeout));\n }\n\n return id;\n }\n\n function removeAll() {\n active.value = [];\n }\n\n function error<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'error', options);\n }\n\n function info<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'info', options);\n }\n\n function success<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'success', options);\n }\n\n function warning<O extends ToastOptions>(text: Toast['text'], options?: O): ToastIdOrUndefined<O> {\n return create(text, 'warning', options);\n }\n\n return reactive({\n /**\n * The list of toasts that are currently visible.\n */\n active: readonly(active),\n\n /**\n * Removes an active/visible toast by id or by group and type.\n */\n remove,\n\n /**\n * Creates a new toast and makes it active/visible.\n */\n create,\n\n /**\n * Removes all active/visible toasts.\n */\n removeAll,\n\n /**\n * Creates a new \"error\" toast.\n */\n error,\n\n /**\n * Creates a new \"info\" toast.\n */\n info,\n\n /**\n * Creates a new \"success\" toast.\n */\n success,\n\n /**\n * Creates a new \"warning\" toast.\n */\n warning,\n });\n}\n"],"names":["DEFAULT_TIMEOUT","active","ref","useToasts","globalOptions","remove","toastIdOrOptions","toastId","group","status","idToRemove","index","id","create","text","localOptions","options","merge","uniqueId","existingId","removeAll","error","info","success","warning","reactive","readonly"],"mappings":";;;AAMO,MAAMA,IAAkB,KA8BzBC,IAASC,EAAa,EAAE;AAE9B,SAAwBC,EAAUC,IAA6C,EAAE,SAASJ,KAAmB;AAI3G,WAASK,EAAOC,GAA2E;AACzF,UAAMC,IAAU,OAAOD,KAAqB,WAAWA,IAAmB,QACpE,EAAE,OAAAE,IAAQ,QAAW,QAAAC,IAAS,WAAc,OAAOH,KAAqB,WAAWA,IAAmB,CAAC;AAE7G,QAAI,CAACC,MAAY,CAACC,KAAS,CAACC;AACpB,YAAA,IAAI,MAAM,uDAAuD;AAGnE,UAAAC,IAAaF,KAASC,IAAS,SAASA,CAAM,IAAID,CAAK,KAAK,OAAOD,CAAO,GAC1EI,IAAQV,EAAO,MAAM,UAAU,CAAC,EAAE,IAAAW,EAAA,MAASA,MAAOF,CAAU;AAClE,IAAIC,MAAU,MAIPV,EAAA,MAAM,OAAOU,GAAO,CAAC;AAAA,EAAA;AAUrB,WAAAE,EAAOC,GAAqBL,GAAwBM,GAAsD;AACjH,UAAMC,IAAUC,EAAM,IAAIb,GAAeW,CAAY,GAE/CH,IAAKI,KAAA,QAAAA,EAAS,QAAQ,SAASP,CAAM,IAAIO,EAAQ,KAAK,KAAKE,EAAS,QAAQ;AAClF,QAAI,EAAAF,KAAA,QAAAA,EAAS,SAASf,EAAO,MAAM,KAAK,CAAC,EAAE,IAAIkB,EAAW,MAAMA,MAAeP,CAAE;AAIjF,aAAAX,EAAO,MAAM,KAAK;AAAA,QAChB,MAAAa;AAAA,QACA,IAAAF;AAAA,QACA,QAAAH;AAAA,QACA,WAAWO,EAAQ;AAAA,MAAA,CACpB,GAEG,OAAOA,EAAQ,WAAY,YAClB,WAAA,MAAMX,EAAOO,CAAE,GAAG,KAAK,IAAII,EAAQ,OAAO,CAAC,GAGjDJ;AAAA,EAAA;AAGT,WAASQ,IAAY;AACnB,IAAAnB,EAAO,QAAQ,CAAC;AAAA,EAAA;AAGT,WAAAoB,EAA8BP,GAAqBE,GAAoC;AACvF,WAAAH,EAAOC,GAAM,SAASE,CAAO;AAAA,EAAA;AAG7B,WAAAM,EAA6BR,GAAqBE,GAAoC;AACtF,WAAAH,EAAOC,GAAM,QAAQE,CAAO;AAAA,EAAA;AAG5B,WAAAO,EAAgCT,GAAqBE,GAAoC;AACzF,WAAAH,EAAOC,GAAM,WAAWE,CAAO;AAAA,EAAA;AAG/B,WAAAQ,EAAgCV,GAAqBE,GAAoC;AACzF,WAAAH,EAAOC,GAAM,WAAWE,CAAO;AAAA,EAAA;AAGxC,SAAOS,EAAS;AAAA;AAAA;AAAA;AAAA,IAId,QAAQC,EAASzB,CAAM;AAAA;AAAA;AAAA;AAAA,IAKvB,QAAAI;AAAA;AAAA;AAAA;AAAA,IAKA,QAAAQ;AAAA;AAAA;AAAA;AAAA,IAKA,WAAAO;AAAA;AAAA;AAAA;AAAA,IAKA,OAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,MAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,SAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,SAAAC;AAAA,EAAA,CACD;AACH;"}
@@ -1,30 +1,30 @@
1
1
  import O from "lodash-es/debounce";
2
- import E from "lodash-es/get";
3
- import { toValue as u, computed as c, ref as V, watch as F, reactive as I, nextTick as w, readonly as S } from "vue";
4
- import { DECIMAL_PRECISION as L, DEBOUNCE as A } from "./constants.js";
2
+ import V from "lodash-es/get";
3
+ import { toValue as u, computed as c, ref as N, watch as L, reactive as I, nextTick as w, readonly as E } from "vue";
4
+ import { DECIMAL_PRECISION as A, DEBOUNCE as q } from "./constants.js";
5
5
  import { t as f } from "./locale.js";
6
6
  import { i as l } from "./isDefined-DzVx0B6k.js";
7
- import q from "lodash-es/round";
8
- function D(e) {
7
+ import D from "lodash-es/round";
8
+ function j(e) {
9
9
  return e && e.constructor && typeof e.constructor.isBuffer == "function" && e.constructor.isBuffer(e);
10
10
  }
11
- function j(e) {
11
+ function C(e) {
12
12
  return e;
13
13
  }
14
- function C(e, t) {
14
+ function F(e, t) {
15
15
  t = t || {};
16
- const i = t.delimiter || ".", s = t.maxDepth, a = t.transformKey || j, m = {};
17
- function h(v, y, g) {
18
- g = g || 1, Object.keys(v).forEach(function(p) {
19
- const n = v[p], N = t.safe && Array.isArray(n), r = Object.prototype.toString.call(n), o = D(n), b = r === "[object Object]" || r === "[object Array]", d = y ? y + i + a(p) : a(p);
20
- if (!N && !o && b && Object.keys(n).length && (!t.maxDepth || g < s))
21
- return h(n, d, g + 1);
22
- m[d] = n;
16
+ const i = t.delimiter || ".", o = t.maxDepth, s = t.transformKey || C, m = {};
17
+ function v(h, y, g) {
18
+ g = g || 1, Object.keys(h).forEach(function(p) {
19
+ const r = h[p], x = t.safe && Array.isArray(r), n = Object.prototype.toString.call(r), a = j(r), b = n === "[object Object]" || n === "[object Array]", d = y ? y + i + s(p) : s(p);
20
+ if (!x && !a && b && Object.keys(r).length && (!t.maxDepth || g < o))
21
+ return v(r, d, g + 1);
22
+ m[d] = r;
23
23
  });
24
24
  }
25
- return h(e), m;
25
+ return v(e), m;
26
26
  }
27
- function P(e = {}) {
27
+ function Y(e = {}) {
28
28
  return {
29
29
  name: "email",
30
30
  validator(t) {
@@ -33,20 +33,20 @@ function P(e = {}) {
33
33
  message: e.message || f("ll.validation.email")
34
34
  };
35
35
  }
36
- function Y(e) {
36
+ function _(e) {
37
37
  return {
38
38
  name: "maxLength",
39
39
  validator(t) {
40
- const i = u(e.max), s = u(t);
41
- if (!l(s))
40
+ const i = u(e.max), o = u(t);
41
+ if (!l(o))
42
42
  return !0;
43
- let a = String(s);
44
- return e.trim && (a = a.trim()), a.length <= i;
43
+ let s = String(o);
44
+ return e.trim && (s = s.trim()), s.length <= i;
45
45
  },
46
46
  message: e.message || (() => f("ll.validation.maxLength", { max: String(u(e.max)) }))
47
47
  };
48
48
  }
49
- function _(e) {
49
+ function z(e) {
50
50
  return {
51
51
  name: "maxValue",
52
52
  validator(t) {
@@ -56,20 +56,20 @@ function _(e) {
56
56
  message: e.message || (() => f("ll.validation.maxValue", { max: String(u(e.max)) }))
57
57
  };
58
58
  }
59
- function z(e) {
59
+ function G(e) {
60
60
  return {
61
61
  name: "minLength",
62
62
  validator(t) {
63
- const i = u(e.min), s = u(t);
64
- if (!l(s))
63
+ const i = u(e.min), o = u(t);
64
+ if (!l(o))
65
65
  return !0;
66
- let a = String(s);
67
- return e.trim && (a = a.trim()), a.length >= i;
66
+ let s = String(o);
67
+ return e.trim && (s = s.trim()), s.length >= i;
68
68
  },
69
69
  message: e.message || (() => f("ll.validation.minLength", { min: String(u(e.min)) }))
70
70
  };
71
71
  }
72
- function G(e) {
72
+ function H(e) {
73
73
  return {
74
74
  name: "minValue",
75
75
  validator(t) {
@@ -79,7 +79,7 @@ function G(e) {
79
79
  message: e.message || (() => f("ll.validation.minValue", { min: String(u(e.min)) }))
80
80
  };
81
81
  }
82
- function H(e) {
82
+ function J(e) {
83
83
  return {
84
84
  name: "pattern",
85
85
  validator(t) {
@@ -95,7 +95,7 @@ function H(e) {
95
95
  }
96
96
  };
97
97
  }
98
- function J(e = {}) {
98
+ function Q(e = {}) {
99
99
  return {
100
100
  name: "positiveNumber",
101
101
  validator(t) {
@@ -104,17 +104,17 @@ function J(e = {}) {
104
104
  message: e.message || f("ll.validation.positiveNumber")
105
105
  };
106
106
  }
107
- function Q(e = {}) {
107
+ function X(e = {}) {
108
108
  return {
109
109
  name: "price",
110
110
  validator(t) {
111
111
  const i = Number(t);
112
- return !l(t) || i !== 1 / 0 && i >= 0 && i === q(i, L.CURRENCY);
112
+ return !l(t) || i !== 1 / 0 && i >= 0 && i === D(i, A.CURRENCY);
113
113
  },
114
114
  message: e.message || f("ll.validation.price")
115
115
  };
116
116
  }
117
- function X(e = {}) {
117
+ function Z(e = {}) {
118
118
  return {
119
119
  name: "required",
120
120
  validator(t) {
@@ -123,7 +123,7 @@ function X(e = {}) {
123
123
  message: e.message || f("ll.validation.required")
124
124
  };
125
125
  }
126
- function Z(e = {}) {
126
+ function W(e = {}) {
127
127
  return {
128
128
  name: "wholeNumber",
129
129
  validator(t) {
@@ -136,93 +136,97 @@ function ee({
136
136
  rules: e,
137
137
  values: t
138
138
  }) {
139
- const s = c(() => Object.keys(C(e, { safe: !0 }))).value.reduce(
140
- (r, o) => {
141
- const b = V(E(u(t), o)), d = (T) => {
142
- b.value = E(u(t), T);
143
- }, x = O(() => {
144
- d(o);
145
- }, A.FAST);
146
- return F(
147
- () => E(u(t), o),
139
+ const o = c(() => Object.keys(F(e, { safe: !0 }))).value.reduce(
140
+ (n, a) => {
141
+ const b = N(V(u(t), a)), d = (T) => {
142
+ b.value = V(u(t), T);
143
+ }, S = O(() => {
144
+ d(a);
145
+ }, q.FAST);
146
+ return L(
147
+ () => V(u(t), a),
148
148
  () => {
149
- x();
149
+ S();
150
150
  }
151
- ), r[o] = B({
152
- fieldName: o,
151
+ ), n[a] = B({
152
+ fieldName: a,
153
153
  fieldValue: b,
154
154
  flush: () => {
155
- x.cancel(), d(o);
155
+ S.cancel(), d(a);
156
156
  },
157
- rules: E(e, o)
158
- }), r;
157
+ rules: V(e, a)
158
+ }), n;
159
159
  },
160
160
  {}
161
- ), a = c(() => Object.values(s)), m = c(() => a.value.some((r) => r.errors.length > 0)), h = c(() => a.value.some((r) => r.isTouched)), v = c(() => a.value.filter((r) => r.isDirty));
161
+ ), s = c(() => Object.values(o)), m = c(() => s.value.some((n) => n.errors.length > 0)), v = c(() => s.value.some((n) => n.isTouched)), h = c(() => s.value.filter((n) => n.isDirty));
162
162
  return I({
163
- validate: async function({ preventScroll: r } = {}) {
164
- if (a.value.forEach((o) => {
165
- o.setTouched(!1), o.setTouched(!0);
166
- }), await w(), m.value && !r) {
167
- const b = Object.entries(s).find(([, x]) => x.errorMessage)?.[0] || "", d = document?.querySelector(`[name=${b}]`);
163
+ validate: async function({ preventScroll: n } = {}) {
164
+ if (s.value.forEach((a) => {
165
+ a.setTouched(!1), a.setTouched(!0);
166
+ }), await w(), m.value && !n) {
167
+ const a = Object.entries(o).find(([, S]) => S.errorMessage), b = (a == null ? void 0 : a[0]) || "", d = document == null ? void 0 : document.querySelector(`[name=${b}]`);
168
168
  d && d.scrollIntoView({ behavior: "smooth" });
169
169
  }
170
170
  return !m.value;
171
171
  },
172
- getError: function(r) {
173
- return s[r]?.errorMessage || "";
172
+ getError: function(n) {
173
+ var a;
174
+ return ((a = o[n]) == null ? void 0 : a.errorMessage) || "";
174
175
  },
175
- touch: function(r) {
176
- if (!s[r])
177
- throw new Error(`In touch: fieldName "${r}" does not exist in the validation fields.`);
178
- s[r].setTouched();
176
+ touch: function(n) {
177
+ if (!o[n])
178
+ throw new Error(`In touch: fieldName "${n}" does not exist in the validation fields.`);
179
+ o[n].setTouched();
179
180
  },
180
181
  setAllUntouched: async function() {
181
- await w(), a.value.forEach((r) => {
182
- r.setTouched(!1);
182
+ await w(), s.value.forEach((n) => {
183
+ n.setTouched(!1);
183
184
  });
184
185
  },
185
- setInitialValues: function(r) {
186
- a.value.forEach((o) => {
187
- o.setInitialValue(r[o.name]);
186
+ setInitialValues: function(n) {
187
+ s.value.forEach((a) => {
188
+ a.setInitialValue(n[a.name]);
188
189
  });
189
190
  },
190
- fields: s,
191
- dirtyFields: v,
191
+ fields: o,
192
+ dirtyFields: h,
192
193
  hasErrors: m,
193
- someTouched: h
194
+ someTouched: v
194
195
  });
195
196
  }
196
197
  function B({
197
198
  fieldName: e,
198
199
  fieldValue: t,
199
200
  rules: i,
200
- flush: s
201
+ flush: o
201
202
  }) {
202
- const a = V(t.value), m = V(!1), h = c(() => (t.value ?? "") !== (a.value ?? "")), v = c(() => m.value ? i.map((n) => ({
203
+ const s = N(t.value), m = N(!1), v = c(() => (t.value ?? "") !== (s.value ?? "")), h = c(() => m.value ? i.map((r) => ({
203
204
  fieldName: e,
204
- ruleName: n.name,
205
- isValid: n.validator(t.value),
206
- message: typeof n.message == "function" ? n.message(t.value) : n.message
205
+ ruleName: r.name,
206
+ isValid: r.validator(t.value),
207
+ message: typeof r.message == "function" ? r.message(t.value) : r.message
207
208
  })) : []), y = c(
208
- () => v.value.filter((n) => !n.isValid).map((n) => ({
209
- ruleName: n.ruleName,
210
- message: n.message
209
+ () => h.value.filter((r) => !r.isValid).map((r) => ({
210
+ ruleName: r.ruleName,
211
+ message: r.message
211
212
  }))
212
213
  );
213
- function g(n = !0) {
214
- s(), m.value = n;
214
+ function g(r = !0) {
215
+ o(), m.value = r;
215
216
  }
216
- function p(n) {
217
- a.value = n;
217
+ function p(r) {
218
+ s.value = r;
218
219
  }
219
220
  return I({
220
221
  name: e,
221
- currentValue: S(t),
222
- initialValue: S(a),
223
- isTouched: S(m),
224
- isDirty: S(h),
225
- errorMessage: c(() => y.value?.[0]?.message || ""),
222
+ currentValue: E(t),
223
+ initialValue: E(s),
224
+ isTouched: E(m),
225
+ isDirty: E(v),
226
+ errorMessage: c(() => {
227
+ var r, x;
228
+ return ((x = (r = y.value) == null ? void 0 : r[0]) == null ? void 0 : x.message) || "";
229
+ }),
226
230
  errors: y,
227
231
  setInitialValue: p,
228
232
  setTouched: g
@@ -230,16 +234,16 @@ function B({
230
234
  }
231
235
  export {
232
236
  ee as default,
233
- P as email,
237
+ Y as email,
234
238
  l as isDefined,
235
- Y as maxLength,
236
- _ as maxValue,
237
- z as minLength,
238
- G as minValue,
239
- H as pattern,
240
- J as positiveNumber,
241
- Q as price,
242
- X as required,
243
- Z as wholeNumber
239
+ _ as maxLength,
240
+ z as maxValue,
241
+ G as minLength,
242
+ H as minValue,
243
+ J as pattern,
244
+ Q as positiveNumber,
245
+ X as price,
246
+ Z as required,
247
+ W as wholeNumber
244
248
  };
245
249
  //# sourceMappingURL=useValidation.js.map