@privyid/persona 0.3.0 → 0.5.0

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 (330) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -0
  3. package/dist/components/app/App.vue +3 -2
  4. package/dist/components/aspect-ratio/index.d.ts +3 -0
  5. package/dist/components/aspect-ratio/index.mjs +21 -0
  6. package/dist/components/aspect-ratio/utils/calculate-ratio.d.ts +7 -0
  7. package/dist/components/aspect-ratio/utils/calculate-ratio.mjs +10 -0
  8. package/dist/components/aspect-ratio/utils/resize-observer.d.ts +1 -0
  9. package/dist/components/aspect-ratio/utils/resize-observer.mjs +22 -0
  10. package/dist/components/avatar/Avatar.vue +1 -1
  11. package/dist/components/avatar/Avatar.vue.d.ts +1 -2
  12. package/dist/components/avatar/index.d.ts +2 -0
  13. package/dist/components/avatar/index.mjs +0 -0
  14. package/dist/components/badge/Badge.vue +33 -58
  15. package/dist/components/badge/Badge.vue.d.ts +1 -2
  16. package/dist/components/badge/index.d.ts +2 -0
  17. package/dist/components/badge/index.mjs +0 -0
  18. package/dist/components/banner/Banner.vue +23 -9
  19. package/dist/components/banner/Banner.vue.d.ts +1 -1
  20. package/dist/components/banner/index.d.ts +1 -0
  21. package/dist/components/banner/index.mjs +0 -0
  22. package/dist/components/button/Button.vue +74 -77
  23. package/dist/components/button/Button.vue.d.ts +1 -3
  24. package/dist/components/button/index.d.ts +3 -0
  25. package/dist/components/button/index.mjs +0 -0
  26. package/dist/components/button-group/ButtonGroup.vue +126 -63
  27. package/dist/components/button-group/ButtonGroup.vue.d.ts +1 -0
  28. package/dist/components/calendar/Calendar.vue +31 -30
  29. package/dist/components/calendar/adapter/adapter.d.ts +7 -0
  30. package/dist/components/calendar/adapter/adapter.mjs +8 -0
  31. package/dist/components/calendar/adapter/date.mjs +6 -4
  32. package/dist/components/calendar/adapter/month.mjs +2 -3
  33. package/dist/components/camera/Camera.vue +383 -0
  34. package/dist/components/camera/Camera.vue.d.ts +94 -0
  35. package/dist/components/camera/adapter/adapter.d.ts +41 -0
  36. package/dist/components/camera/adapter/adapter.mjs +3 -0
  37. package/dist/components/camera/adapter/capture.d.ts +5 -0
  38. package/dist/components/camera/adapter/capture.mjs +12 -0
  39. package/dist/components/camera/adapter/liveness.d.ts +5 -0
  40. package/dist/components/camera/adapter/liveness.mjs +46 -0
  41. package/dist/components/camera/adapter/qr-code.d.ts +2 -0
  42. package/dist/components/camera/adapter/qr-code.mjs +19 -0
  43. package/dist/components/camera/assets/shutter.wav +0 -0
  44. package/dist/components/camera/utils/motion.d.ts +29 -0
  45. package/dist/components/camera/utils/motion.mjs +88 -0
  46. package/dist/components/camera/utils/take-picture.d.ts +1 -0
  47. package/dist/components/camera/utils/take-picture.mjs +14 -0
  48. package/dist/components/caption/Caption.vue +60 -7
  49. package/dist/components/caption/Caption.vue.d.ts +27 -7
  50. package/dist/components/card/Card.vue +14 -8
  51. package/dist/components/card/Card.vue.d.ts +10 -1
  52. package/dist/components/card/CardSection.vue +2 -1
  53. package/dist/components/card/index.d.ts +1 -0
  54. package/dist/components/card/index.mjs +0 -0
  55. package/dist/components/chart/Chart.vue +6 -3
  56. package/dist/components/chart/Chart.vue.d.ts +1 -2
  57. package/dist/components/chart/index.d.ts +2 -0
  58. package/dist/components/chart/index.mjs +0 -0
  59. package/dist/components/chart/{use-chart.d.ts → utils/use-chart.d.ts} +0 -0
  60. package/dist/components/chart/{use-chart.mjs → utils/use-chart.mjs} +0 -0
  61. package/dist/components/checkbox/Checkbox.vue +47 -14
  62. package/dist/components/checkbox/Checkbox.vue.d.ts +0 -4
  63. package/dist/components/checkbox/{use-checkbox.d.ts → index.d.ts} +1 -1
  64. package/dist/components/checkbox/{use-checkbox.mjs → index.mjs} +0 -0
  65. package/dist/components/collapse/Collapse.vue +88 -0
  66. package/dist/components/collapse/Collapse.vue.d.ts +29 -0
  67. package/dist/components/contextual-bar/ContextualBar.vue +292 -0
  68. package/dist/components/contextual-bar/ContextualBar.vue.d.ts +78 -0
  69. package/dist/components/contextual-bar/assets/images/img-background-contextualbar.svg +14 -0
  70. package/dist/components/contextual-bar/assets/images/img-bg-contextualbar.svg +19 -0
  71. package/dist/components/contextual-bar/index.d.ts +1 -0
  72. package/dist/components/contextual-bar/index.mjs +0 -0
  73. package/dist/components/cropper/Cropper.vue +423 -0
  74. package/dist/components/cropper/Cropper.vue.d.ts +149 -0
  75. package/dist/components/cropper/assets/ps-neutral.png +0 -0
  76. package/dist/components/cropper/assets/sample-1.jpg +0 -0
  77. package/dist/components/cropper/utils/crop-image.d.ts +44 -0
  78. package/dist/components/cropper/utils/crop-image.mjs +43 -0
  79. package/dist/components/cropper/utils/use-pinch.d.ts +8 -0
  80. package/dist/components/cropper/utils/use-pinch.mjs +42 -0
  81. package/dist/components/cropper/utils/use-ratio.d.ts +9 -0
  82. package/dist/components/cropper/utils/use-ratio.mjs +24 -0
  83. package/dist/components/datepicker/Datepicker.vue +14 -5
  84. package/dist/components/datepicker/Datepicker.vue.d.ts +9 -0
  85. package/dist/components/dialog/Dialog.vue +2 -0
  86. package/dist/components/dialog/Dialog.vue.d.ts +1 -1
  87. package/dist/components/dialog/DialogFooter.vue +4 -2
  88. package/dist/components/dialog/DialogFooter.vue.d.ts +2 -1
  89. package/dist/components/dialog/index.d.ts +31 -6
  90. package/dist/components/dialog/index.mjs +32 -5
  91. package/dist/components/divider/Divider.vue +22 -2
  92. package/dist/components/dot/Dot.vue +27 -20
  93. package/dist/components/dot/Dot.vue.d.ts +10 -1
  94. package/dist/components/dot/index.d.ts +2 -0
  95. package/dist/components/dot/index.mjs +0 -0
  96. package/dist/components/dropdown/Dropdown.vue +73 -21
  97. package/dist/components/dropdown/Dropdown.vue.d.ts +16 -12
  98. package/dist/components/dropdown/DropdownItem.vue +3 -3
  99. package/dist/components/dropdown/index.d.ts +9 -0
  100. package/dist/components/dropdown/index.mjs +1 -0
  101. package/dist/components/dropdown/utils/use-focus.d.ts +1 -1
  102. package/dist/components/dropdown/utils/use-focus.mjs +4 -2
  103. package/dist/components/dropdown-subitem/DropdownSubitem.vue +12 -12
  104. package/dist/components/dropdown-subitem/DropdownSubitem.vue.d.ts +1 -1
  105. package/dist/components/dropdown-subitem/{use-dropdown-subitem.d.ts → index.d.ts} +0 -0
  106. package/dist/components/dropdown-subitem/{use-dropdown-subitem.mjs → index.mjs} +0 -0
  107. package/dist/components/dropzone/Dropzone.vue +202 -0
  108. package/dist/components/dropzone/Dropzone.vue.d.ts +93 -0
  109. package/dist/components/dropzone/index.d.ts +4 -0
  110. package/dist/components/dropzone/index.mjs +0 -0
  111. package/dist/components/dropzone/utils/accept.d.ts +1 -0
  112. package/dist/components/dropzone/utils/accept.mjs +17 -0
  113. package/dist/components/filterbar/Filterbar.vue +7 -5
  114. package/dist/components/filterbar/Filterbar.vue.d.ts +1 -1
  115. package/dist/components/filterbar/{use-filterbar.d.ts → index.d.ts} +1 -1
  116. package/dist/components/filterbar/{use-filterbar.mjs → index.mjs} +0 -0
  117. package/dist/components/filterbar/pinned/Date.vue +9 -7
  118. package/dist/components/filterbar/pinned/Date.vue.d.ts +1 -1
  119. package/dist/components/filterbar/pinned/Multiselect.vue +16 -13
  120. package/dist/components/filterbar/pinned/Multiselect.vue.d.ts +2 -2
  121. package/dist/components/filterbar/pinned/Select.vue +11 -8
  122. package/dist/components/filterbar/pinned/Select.vue.d.ts +2 -2
  123. package/dist/components/filterbar/pinned/Toggle.vue +2 -1
  124. package/dist/components/filterbar/pinned/Toggle.vue.d.ts +1 -1
  125. package/dist/components/form-group/FormGroup.vue +103 -0
  126. package/dist/components/form-group/FormGroup.vue.d.ts +61 -0
  127. package/dist/components/global/context.d.ts +24 -0
  128. package/dist/components/global/context.mjs +18 -0
  129. package/dist/components/global/router.d.ts +23 -0
  130. package/dist/components/global/router.mjs +7 -0
  131. package/dist/components/global/use-singleton.d.ts +17 -2
  132. package/dist/components/global/use-singleton.mjs +18 -10
  133. package/dist/components/heading/Heading.vue +50 -0
  134. package/dist/components/heading/Heading.vue.d.ts +19 -1
  135. package/dist/components/heading/index.d.ts +3 -0
  136. package/dist/components/heading/index.mjs +0 -0
  137. package/dist/components/input/Input.vue +119 -24
  138. package/dist/components/input/Input.vue.d.ts +38 -2
  139. package/dist/components/input/{use-input.d.ts → index.d.ts} +0 -0
  140. package/dist/components/input/{use-input.mjs → index.mjs} +0 -0
  141. package/dist/components/input-file/InputFile.vue +171 -0
  142. package/dist/components/input-file/InputFile.vue.d.ts +120 -0
  143. package/dist/components/input-group/InputGroup.vue +131 -0
  144. package/dist/components/input-group/InputGroup.vue.d.ts +45 -0
  145. package/dist/components/input-group/InputGroupAddon.vue +43 -0
  146. package/dist/components/input-password/InputPassword.vue +62 -0
  147. package/dist/components/input-password/InputPassword.vue.d.ts +5 -0
  148. package/dist/components/input-password/index.d.ts +2 -0
  149. package/dist/components/input-password/index.mjs +17 -0
  150. package/dist/components/input-pin/InputPin.vue +145 -0
  151. package/dist/components/input-pin/InputPin.vue.d.ts +64 -0
  152. package/dist/components/input-range/InputRange.vue +274 -0
  153. package/dist/components/input-range/InputRange.vue.d.ts +108 -0
  154. package/dist/components/input-range/utils/use-drag.d.ts +3 -0
  155. package/dist/components/input-range/utils/use-drag.mjs +19 -0
  156. package/dist/components/label/Label.vue +29 -41
  157. package/dist/components/label/Label.vue.d.ts +1 -1
  158. package/dist/components/markdown/index.d.ts +20 -0
  159. package/dist/components/markdown/index.mjs +15 -0
  160. package/dist/components/modal/Modal.vue +71 -5
  161. package/dist/components/modal/Modal.vue.d.ts +30 -0
  162. package/dist/components/nav/Nav.vue +16 -14
  163. package/dist/components/nav/Nav.vue.d.ts +3 -4
  164. package/dist/components/nav/NavForm.vue +19 -0
  165. package/dist/components/nav/NavItem.vue +14 -4
  166. package/dist/components/nav/NavItem.vue.d.ts +3 -4
  167. package/dist/components/nav/NavItemDropdown.vue +5 -1
  168. package/dist/components/nav/NavItemDropdown.vue.d.ts +9 -0
  169. package/dist/components/nav/NavSubItem.vue +5 -5
  170. package/dist/components/nav/index.d.ts +2 -0
  171. package/dist/components/nav/index.mjs +0 -0
  172. package/dist/components/navbar/Navbar.vue +143 -0
  173. package/dist/components/navbar/Navbar.vue.d.ts +57 -0
  174. package/dist/components/navbar/NavbarBrand.vue +33 -0
  175. package/dist/components/navbar/NavbarBrand.vue.d.ts +14 -0
  176. package/dist/components/navbar/NavbarNav.vue +109 -0
  177. package/dist/components/navbar/NavbarNav.vue.d.ts +19 -0
  178. package/dist/components/navbar/NavbarToggle.vue +74 -0
  179. package/dist/components/navbar/NavbarToggle.vue.d.ts +6 -0
  180. package/dist/components/navbar/index.d.ts +10 -0
  181. package/dist/components/navbar/index.mjs +1 -0
  182. package/dist/components/navbar-menu/NavbarNavMenu.vue +62 -0
  183. package/dist/components/navbar-menu/NavbarNavMenu.vue.d.ts +16 -0
  184. package/dist/components/overlay/Overlay.vue +8 -3
  185. package/dist/components/overlay/Overlay.vue.d.ts +14 -3
  186. package/dist/components/overlay/{use-overlay.d.ts → index.d.ts} +0 -0
  187. package/dist/components/overlay/{use-overlay.mjs → index.mjs} +0 -0
  188. package/dist/components/progress/Progress.vue +200 -0
  189. package/dist/components/progress/Progress.vue.d.ts +42 -0
  190. package/dist/components/progress/ProgressItem.vue +50 -0
  191. package/dist/components/progress/ProgressItem.vue.d.ts +25 -0
  192. package/dist/components/radio/Radio.vue +88 -31
  193. package/dist/components/radio/Radio.vue.d.ts +6 -6
  194. package/dist/components/radio/{use-radio.d.ts → index.d.ts} +1 -1
  195. package/dist/components/radio/{use-radio.mjs → index.mjs} +0 -0
  196. package/dist/components/select/Select.vue +10 -4
  197. package/dist/components/select/Select.vue.d.ts +11 -2
  198. package/dist/components/select/adapter/adapter.d.ts +1 -1
  199. package/dist/components/select/adapter/async-adapter.d.ts +1 -1
  200. package/dist/components/select/{use-select.d.ts → index.d.ts} +0 -0
  201. package/dist/components/select/{use-select.mjs → index.mjs} +0 -0
  202. package/dist/components/sidebar/Sidebar.vue +3 -3
  203. package/dist/components/sidebar/Sidebar.vue.d.ts +4 -9
  204. package/dist/components/sidebar/SidebarNav.vue +11 -11
  205. package/dist/components/sidebar/SidebarNav.vue.d.ts +2 -2
  206. package/dist/components/sidebar/index.d.ts +9 -0
  207. package/dist/components/sidebar/index.mjs +1 -0
  208. package/dist/components/sidebar-menu/SidebarMenu.vue.d.ts +4 -2
  209. package/dist/components/sidebar-menu/{use-sidebar-menu.d.ts → index.d.ts} +2 -0
  210. package/dist/components/sidebar-menu/{use-sidebar-menu.mjs → index.mjs} +0 -0
  211. package/dist/components/signature-draw/SignatureDraw.vue +1 -1
  212. package/dist/components/signature-draw/SignatureDrawDesktop.vue +5 -5
  213. package/dist/components/signature-draw/SignatureDrawMobile.vue +17 -5
  214. package/dist/components/signature-draw/utils/canvas.d.ts +7 -1
  215. package/dist/components/signature-draw/utils/canvas.mjs +8 -2
  216. package/dist/components/signature-draw/utils/use-draw.mjs +6 -5
  217. package/dist/components/signature-text/SignatureText.vue +1 -1
  218. package/dist/components/signature-text/SignatureText.vue.d.ts +1 -1
  219. package/dist/components/signature-text/utils/formatter.mjs +1 -1
  220. package/dist/components/spinner/Spinner.vue +1 -0
  221. package/dist/components/spinner/SpinnerRing.vue +1 -0
  222. package/dist/components/spread/Spread.vue +55 -0
  223. package/dist/components/spread/Spread.vue.d.ts +14 -0
  224. package/dist/components/steps/Step.vue +55 -0
  225. package/dist/components/steps/Step.vue.d.ts +32 -0
  226. package/dist/components/steps/StepSlider.vue +39 -0
  227. package/dist/components/steps/StepSlider.vue.d.ts +25 -0
  228. package/dist/components/steps/Steps.vue +111 -0
  229. package/dist/components/steps/Steps.vue.d.ts +56 -0
  230. package/dist/components/steps/index.d.ts +26 -0
  231. package/dist/components/steps/index.mjs +52 -0
  232. package/dist/components/steps/utils/hook.d.ts +10 -0
  233. package/dist/components/steps/utils/hook.mjs +34 -0
  234. package/dist/components/strengthbar/Strengthbar.vue +96 -0
  235. package/dist/components/strengthbar/Strengthbar.vue.d.ts +45 -0
  236. package/dist/components/subheading/Subheading.vue +65 -20
  237. package/dist/components/subheading/Subheading.vue.d.ts +23 -5
  238. package/dist/components/subheading/index.d.ts +1 -0
  239. package/dist/components/subheading/index.mjs +0 -0
  240. package/dist/components/table/Table.vue +21 -9
  241. package/dist/components/table/Table.vue.d.ts +1 -1
  242. package/dist/components/table/{use-table.d.ts → index.d.ts} +0 -0
  243. package/dist/components/table/{use-table.mjs → index.mjs} +0 -0
  244. package/dist/components/tabs/TabContent.vue +2 -2
  245. package/dist/components/tabs/Tabs.vue +12 -9
  246. package/dist/components/tabs/Tabs.vue.d.ts +2 -1
  247. package/dist/components/textarea/Textarea.vue +27 -16
  248. package/dist/components/textarea/Textarea.vue.d.ts +10 -1
  249. package/dist/components/toast/Toast.vue +102 -72
  250. package/dist/components/toast/Toast.vue.d.ts +1 -1
  251. package/dist/components/toast/ToastContainer.vue +1 -1
  252. package/dist/components/toast/ToastContainer.vue.d.ts +3 -3
  253. package/dist/components/toast/{use-toast.d.ts → index.d.ts} +1 -1
  254. package/dist/components/toast/index.mjs +6 -0
  255. package/dist/components/toggle/Toggle.vue +17 -21
  256. package/dist/components/tooltip/Tooltip.vue +161 -0
  257. package/dist/components/tooltip/Tooltip.vue.d.ts +51 -0
  258. package/dist/components/tooltip/TooltipContainer.vue +66 -0
  259. package/dist/components/tooltip/TooltipContainer.vue.d.ts +11 -0
  260. package/dist/components/tooltip/index.d.ts +14 -0
  261. package/dist/components/tooltip/index.mjs +82 -0
  262. package/dist/components/tooltip/utils/create-handler.d.ts +9 -0
  263. package/dist/components/tooltip/utils/create-handler.mjs +16 -0
  264. package/dist/components/tooltip/utils/parse-bindings.d.ts +22 -0
  265. package/dist/components/tooltip/utils/parse-bindings.mjs +45 -0
  266. package/dist/components/tour/Tour.vue +105 -0
  267. package/dist/components/tour/Tour.vue.d.ts +11 -0
  268. package/dist/components/tour/TourDialog.vue +204 -0
  269. package/dist/components/tour/TourDialog.vue.d.ts +108 -0
  270. package/dist/components/tour/TourHighlight.vue +57 -0
  271. package/dist/components/tour/TourHighlight.vue.d.ts +15 -0
  272. package/dist/components/tour/core/base.d.ts +59 -0
  273. package/dist/components/tour/core/base.mjs +43 -0
  274. package/dist/components/tour/core/step/action.d.ts +15 -0
  275. package/dist/components/tour/core/step/action.mjs +14 -0
  276. package/dist/components/tour/core/step/conditional.d.ts +26 -0
  277. package/dist/components/tour/core/step/conditional.mjs +69 -0
  278. package/dist/components/tour/core/step/delay.d.ts +8 -0
  279. package/dist/components/tour/core/step/delay.mjs +9 -0
  280. package/dist/components/tour/core/step/dialog.d.ts +11 -0
  281. package/dist/components/tour/core/step/dialog.mjs +25 -0
  282. package/dist/components/tour/core/step/visit.d.ts +9 -0
  283. package/dist/components/tour/core/step/visit.mjs +18 -0
  284. package/dist/components/tour/core/step.d.ts +37 -0
  285. package/dist/components/tour/core/step.mjs +30 -0
  286. package/dist/components/tour/core/story.d.ts +130 -0
  287. package/dist/components/tour/core/story.mjs +85 -0
  288. package/dist/components/tour/core/tour.d.ts +120 -0
  289. package/dist/components/tour/core/tour.mjs +133 -0
  290. package/dist/components/tour/index.d.ts +3 -0
  291. package/dist/components/tour/index.mjs +4 -0
  292. package/dist/components/tour/utils/is-visible.d.ts +2 -0
  293. package/dist/components/tour/utils/is-visible.mjs +35 -0
  294. package/dist/components/tour/utils/use-selector.d.ts +3 -0
  295. package/dist/components/tour/utils/use-selector.mjs +25 -0
  296. package/dist/components/tour/utils/wait-element.d.ts +6 -0
  297. package/dist/components/tour/utils/wait-element.mjs +44 -0
  298. package/dist/components/utils/base64.d.ts +8 -0
  299. package/dist/components/utils/base64.mjs +29 -0
  300. package/dist/components/utils/color.d.ts +6 -1
  301. package/dist/components/utils/color.mjs +4 -0
  302. package/dist/components/utils/value.mjs +2 -1
  303. package/dist/components/utils/vnode.d.ts +14 -1
  304. package/dist/components/utils/vnode.mjs +5 -2
  305. package/dist/components/wizard/Wizard.vue +85 -0
  306. package/dist/components/wizard/Wizard.vue.d.ts +72 -0
  307. package/dist/components/wizard/WizardBody.vue +50 -0
  308. package/dist/components/wizard/WizardBody.vue.d.ts +23 -0
  309. package/dist/components/wizard/WizardHeader.vue +38 -0
  310. package/dist/components/wizard/WizardHeader.vue.d.ts +16 -0
  311. package/dist/components/wizard/WizardStep.vue +20 -0
  312. package/dist/components/wizard/WizardStep.vue.d.ts +34 -0
  313. package/dist/core/index.d.ts +16 -6
  314. package/dist/core/index.mjs +37 -6
  315. package/dist/directive/index.d.ts +3 -0
  316. package/dist/directive/index.mjs +12 -0
  317. package/dist/module.d.ts +9 -2
  318. package/dist/module.json +1 -1
  319. package/dist/module.mjs +1613 -4
  320. package/dist/runtime/plugin.d.ts +2 -0
  321. package/dist/runtime/plugin.mjs +14 -0
  322. package/dist/types.d.ts +5 -1
  323. package/package.json +46 -9
  324. package/dist/components/dialog/use-dialog.d.ts +0 -28
  325. package/dist/components/dialog/use-dialog.mjs +0 -31
  326. package/dist/components/dropdown/utils/use-popper.d.ts +0 -6
  327. package/dist/components/dropdown/utils/use-popper.mjs +0 -32
  328. package/dist/components/input/InputGroup.vue +0 -25
  329. package/dist/components/toast/use-toast.mjs +0 -5
  330. package/dist/core/index.cjs +0 -75
@@ -0,0 +1,120 @@
1
+ import { BaseTourOptions, AbstractTour, TourDirection } from './base';
2
+ /**
3
+ * Basic Tour, it cover all basic tour functionality (prev, next, start, finish)
4
+ */
5
+ export interface TourOptions extends BaseTourOptions {
6
+ /**
7
+ * Enable / disable dismiss button
8
+ * @default true
9
+ */
10
+ dismissable: boolean;
11
+ /**
12
+ * Customize previous button label
13
+ * @default 'Previous'
14
+ */
15
+ prevLabel: string;
16
+ /**
17
+ * Customize next button label
18
+ * @default 'Next'
19
+ */
20
+ nextLabel: string;
21
+ /**
22
+ * Customize dismiss button label
23
+ * @default 'Dismiss'
24
+ */
25
+ dismissLabel: string;
26
+ /**
27
+ * Customize finish button label
28
+ * @default 'Finish'
29
+ */
30
+ finishLabel: string;
31
+ /**
32
+ * Timeout for waiting target element appear
33
+ * @default 3000
34
+ */
35
+ waitTimeout: number;
36
+ /**
37
+ * If true, skip to next step of got an error or timeout
38
+ * If false, Tour will stop immediately
39
+ * @default false
40
+ */
41
+ skipOnError: boolean;
42
+ /**
43
+ * Hook when tour finished
44
+ */
45
+ onFinished?: () => void | Promise<void>;
46
+ }
47
+ export declare class Tour extends AbstractTour<TourOptions> {
48
+ protected index: number;
49
+ protected steps: AbstractTour[];
50
+ protected onFinishedHooks: Array<() => void | Promise<void>>;
51
+ protected parent?: Tour;
52
+ constructor(options?: Partial<TourOptions>);
53
+ /**
54
+ * Get current step index
55
+ */
56
+ getIndex(): number;
57
+ /**
58
+ * Get total Step
59
+ */
60
+ getTotal(): number;
61
+ /**
62
+ * Get list of steps
63
+ */
64
+ getSteps(): AbstractTour[];
65
+ /**
66
+ * Count total step, including Sub-Tour
67
+ */
68
+ getTotalChild(): number;
69
+ /**
70
+ * Calculate real index, including Sub-Tour
71
+ */
72
+ protected getRealIndex(): number;
73
+ /**
74
+ * Get current step instance
75
+ */
76
+ protected getCurrentStep(): AbstractTour<BaseTourOptions>;
77
+ /**
78
+ * Run "on-finished" hooks
79
+ */
80
+ protected runOnFinishedHooks(): Promise<void>;
81
+ /**
82
+ * Execute current step
83
+ */
84
+ protected run(): Promise<void>;
85
+ /**
86
+ * Goto previous step
87
+ */
88
+ prev(skipHook?: boolean): Promise<void>;
89
+ /**
90
+ * Goto next step
91
+ */
92
+ next(skipHook?: boolean): Promise<void>;
93
+ /**
94
+ * Finishing step
95
+ */
96
+ finish(): Promise<void>;
97
+ /**
98
+ * Show and start the tour
99
+ */
100
+ start(index?: number, direction?: TourDirection): Promise<void>;
101
+ /**
102
+ * Hide and stop the tour
103
+ */
104
+ stop(): Promise<void>;
105
+ /**
106
+ * Find index by name or by instance
107
+ * @param id
108
+ */
109
+ protected findIndex(id: AbstractTour['name'] | AbstractTour): number;
110
+ /**
111
+ * Add Tour Step
112
+ * @param step Step instance
113
+ */
114
+ add(step: AbstractTour): this;
115
+ /**
116
+ * Remove Step
117
+ * @param id number of index, name or symbol
118
+ */
119
+ remove(id?: number | AbstractTour['name'] | AbstractTour): void;
120
+ }
@@ -0,0 +1,133 @@
1
+ import defu from "defu";
2
+ import { isNumber } from "lodash-es";
3
+ import {
4
+ AbstractTour,
5
+ TourDirection
6
+ } from "./base";
7
+ export class Tour extends AbstractTour {
8
+ constructor(options) {
9
+ super(options);
10
+ this.index = -1;
11
+ this.steps = [];
12
+ this.onFinishedHooks = [];
13
+ this.options = defu(options, {
14
+ highlight: true,
15
+ dismissable: true,
16
+ prevLabel: "Previous",
17
+ nextLabel: "Next",
18
+ dismissLabel: "Dismiss",
19
+ finishLabel: "Finish",
20
+ waitTimeout: 3e3,
21
+ skipOnError: false
22
+ });
23
+ if (typeof options?.onFinished === "function")
24
+ this.onFinishedHooks.unshift(options.onFinished);
25
+ }
26
+ getIndex() {
27
+ return this.getRealIndex() + (this.parent?.getIndex() ?? 0);
28
+ }
29
+ getTotal() {
30
+ return this.parent?.getTotal() ?? this.getTotalChild();
31
+ }
32
+ getSteps() {
33
+ return this.steps;
34
+ }
35
+ getTotalChild() {
36
+ let total = 0;
37
+ for (const step of this.steps) {
38
+ total += "getTotalChild" in step ? step.getTotalChild() : 1;
39
+ }
40
+ return total;
41
+ }
42
+ getRealIndex() {
43
+ let index = this.index;
44
+ for (let i = 0; i < this.index; i++) {
45
+ const step = this.steps[i];
46
+ if ("getTotalChild" in step)
47
+ index += step.getTotalChild() - 1;
48
+ }
49
+ return index;
50
+ }
51
+ getCurrentStep() {
52
+ return this.steps.at(this.index);
53
+ }
54
+ async runOnFinishedHooks() {
55
+ await Promise.allSettled(this.onFinishedHooks.map((hook) => hook()));
56
+ }
57
+ async run() {
58
+ const step = this.getCurrentStep();
59
+ try {
60
+ await step.setDirection(this.direction).start();
61
+ } catch (error) {
62
+ if (import.meta.env.DEV)
63
+ console.warn(error, step);
64
+ if (this.getOptions().skipOnError || step.getOptions().skipOnError)
65
+ await (this.direction === TourDirection.BACKWARD ? this.prev(true) : this.next(true));
66
+ else if (this.parent)
67
+ throw error;
68
+ else
69
+ await this.stop();
70
+ }
71
+ }
72
+ async prev(skipHook = false) {
73
+ const toIndex = this.index - 1;
74
+ const from = this.steps.at(this.index);
75
+ const to = this.steps.at(toIndex);
76
+ if (toIndex < 0 && this.parent)
77
+ await this.parent.prev();
78
+ else if (toIndex > -1 && (skipHook || await this.runOnPrevHooks(to, from))) {
79
+ await from.stop();
80
+ this.index = toIndex;
81
+ this.direction = TourDirection.BACKWARD;
82
+ await this.run();
83
+ }
84
+ }
85
+ async next(skipHook = false) {
86
+ const toIndex = this.index + 1;
87
+ const from = this.steps.at(this.index);
88
+ const to = this.steps.at(toIndex);
89
+ if (skipHook || await this.runOnNextHooks(to, from)) {
90
+ if (toIndex < this.steps.length) {
91
+ await from.stop();
92
+ this.index = toIndex;
93
+ this.direction = TourDirection.FORWARD;
94
+ await this.run();
95
+ } else
96
+ await this.finish();
97
+ }
98
+ }
99
+ async finish() {
100
+ await this.runOnFinishedHooks();
101
+ await (this.parent ? this.parent.next() : this.stop());
102
+ }
103
+ async start(index = 0, direction = TourDirection.FORWARD) {
104
+ this.index = index;
105
+ this.direction = direction;
106
+ if (this.parent)
107
+ this.attach(this.parent);
108
+ await this.run();
109
+ }
110
+ async stop() {
111
+ await this.getCurrentStep().stop();
112
+ if (this.parent)
113
+ this.detach(this.parent);
114
+ }
115
+ findIndex(id) {
116
+ if (id instanceof AbstractTour)
117
+ return this.steps.indexOf(id);
118
+ return this.steps.findIndex((item) => item.name === id);
119
+ }
120
+ add(step) {
121
+ this.steps.push(step.setParent(this));
122
+ return this;
123
+ }
124
+ remove(id) {
125
+ if (!id && this.parent)
126
+ this.parent.remove(this);
127
+ else {
128
+ const index = isNumber(id) ? id : this.findIndex(id);
129
+ if (index > -1)
130
+ this.steps.splice(index, 1);
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,3 @@
1
+ import { TourOptions } from './core/tour';
2
+ import { TourStory } from './core/story';
3
+ export declare function createTour(options?: TourOptions): TourStory;
@@ -0,0 +1,4 @@
1
+ import { TourStory } from "./core/story.mjs";
2
+ export function createTour(options) {
3
+ return new TourStory(options);
4
+ }
@@ -0,0 +1,2 @@
1
+ export declare function isVisible(target: HTMLElement): boolean;
2
+ export declare function focus(target: HTMLElement, duration?: number): Promise<unknown>;
@@ -0,0 +1,35 @@
1
+ import scrollIntoView from "scroll-into-view";
2
+ export function isVisible(target) {
3
+ if (!(target instanceof Element))
4
+ return false;
5
+ const style = getComputedStyle(target);
6
+ if (style.display === "none")
7
+ return false;
8
+ if (style.visibility !== "visible")
9
+ return false;
10
+ if (Number.parseFloat(style.opacity) < 0.1)
11
+ return false;
12
+ const boundaries = target.getBoundingClientRect();
13
+ if (target.offsetWidth + target.offsetHeight + boundaries.height + boundaries.width === 0)
14
+ return false;
15
+ const posX = boundaries.left + boundaries.width / 2;
16
+ const posY = boundaries.top + boundaries.height / 2;
17
+ const screenWidth = document.documentElement.clientWidth || window.innerWidth;
18
+ const screenHeight = document.documentElement.clientHeight || window.innerHeight;
19
+ if (posX < 0 || posY < 0)
20
+ return false;
21
+ if (posX > screenWidth || posY > screenHeight)
22
+ return false;
23
+ let pointContainer = document.elementFromPoint(posX, posY);
24
+ do {
25
+ if (pointContainer === target)
26
+ return true;
27
+ pointContainer = pointContainer.parentNode;
28
+ } while (pointContainer);
29
+ return false;
30
+ }
31
+ export async function focus(target, duration = 330) {
32
+ return await new Promise((resolve) => {
33
+ scrollIntoView(target, { time: duration }, resolve);
34
+ });
35
+ }
@@ -0,0 +1,3 @@
1
+ import { MaybeRef } from '@vueuse/core';
2
+ import { Ref } from 'vue-demi';
3
+ export declare function useSelector<E extends HTMLElement>(selector: MaybeRef<string>): Readonly<Ref<E>>;
@@ -0,0 +1,25 @@
1
+ import {
2
+ tryOnMounted,
3
+ useMutationObserver
4
+ } from "@vueuse/core";
5
+ import {
6
+ ref,
7
+ watch,
8
+ unref
9
+ } from "vue-demi";
10
+ export function useSelector(selector) {
11
+ const element = ref();
12
+ const body = ref();
13
+ watch(() => unref(selector), (value) => {
14
+ element.value = document.querySelector(value);
15
+ });
16
+ useMutationObserver(body, ([mutation]) => {
17
+ if (mutation.type === "childList")
18
+ element.value = document.querySelector(unref(selector));
19
+ }, { childList: true, subtree: true });
20
+ tryOnMounted(() => {
21
+ body.value = document.body;
22
+ element.value = document.querySelector(unref(selector));
23
+ });
24
+ return element;
25
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Wait element appear
3
+ * @param selector query selector
4
+ * @param timeout wait timeout in millisecond
5
+ */
6
+ export declare function waitElement<Element extends HTMLElement>(selector: string, timeout?: number): Promise<Element>;
@@ -0,0 +1,44 @@
1
+ import { isVisible, focus } from "./is-visible.mjs";
2
+ async function getVisibleElement(selector) {
3
+ const target = document.querySelector(selector);
4
+ if (target) {
5
+ await focus(target);
6
+ if (!isVisible(target))
7
+ throw new Error(`Target: "${selector}" not visible`);
8
+ }
9
+ return target;
10
+ }
11
+ export async function waitElement(selector, timeout = 3e4) {
12
+ return await new Promise((resolve, reject) => {
13
+ let timer;
14
+ const mutation = new MutationObserver(([mutation2]) => {
15
+ if (mutation2.type === "childList") {
16
+ getVisibleElement(selector).then((target) => {
17
+ if (target) {
18
+ cleanup();
19
+ resolve(target);
20
+ }
21
+ }).catch(reject);
22
+ }
23
+ });
24
+ const cleanup = () => {
25
+ if (timer)
26
+ clearTimeout(timer);
27
+ if (mutation)
28
+ mutation.disconnect();
29
+ };
30
+ if (timeout > 0) {
31
+ timer = setTimeout(() => {
32
+ cleanup();
33
+ reject(new Error("Target: timeout"));
34
+ }, timeout);
35
+ }
36
+ mutation.observe(document.body, { childList: true, subtree: true });
37
+ getVisibleElement(selector).then((target) => {
38
+ if (target) {
39
+ cleanup();
40
+ resolve(target);
41
+ }
42
+ }).catch(reject);
43
+ });
44
+ }
@@ -0,0 +1,8 @@
1
+ export declare function toBase64(file: globalThis.File): Promise<string>;
2
+ /**
3
+ * Convert base64 data-uri to File
4
+ * @param dataurl data base64
5
+ * @param filename output's filename
6
+ * @param mimeType output's mimeType
7
+ */
8
+ export declare function fromBase64(dataurl: string, filename?: string, mimeType?: string): globalThis.File;
@@ -0,0 +1,29 @@
1
+ import { format } from "date-fns";
2
+ import { Buffer } from "buffer";
3
+ export function toBase64(file) {
4
+ return new Promise((resolve, reject) => {
5
+ const reader = new FileReader();
6
+ const onLoad = () => {
7
+ cleanup();
8
+ resolve(reader.result);
9
+ };
10
+ const onError = (error) => {
11
+ cleanup();
12
+ reject(error);
13
+ };
14
+ const cleanup = () => {
15
+ reader.removeEventListener("load", onLoad);
16
+ reader.removeEventListener("error", onError);
17
+ };
18
+ reader.addEventListener("load", onLoad);
19
+ reader.addEventListener("error", onError);
20
+ reader.readAsDataURL(file);
21
+ });
22
+ }
23
+ export function fromBase64(dataurl, filename, mimeType) {
24
+ const name = filename ?? format(new Date(), "yyyyMMddHHmmss");
25
+ const [meta, body] = dataurl.split(",");
26
+ const mime = mimeType ?? meta.match(/:(.*?);/)[1];
27
+ const buffer = Buffer.from(body, "base64");
28
+ return new globalThis.File([buffer], name, { type: mime });
29
+ }
@@ -5,8 +5,13 @@ interface RGB {
5
5
  }
6
6
  /**
7
7
  * Parse hex string to R,G,B Object
8
- * @param color RGB Object
8
+ * @param color hex string color
9
9
  * @example toRGB('#6E1E62') // {R: 110, G: 30, B: 98}
10
10
  */
11
11
  export declare function toRGB(color: string): RGB;
12
+ /**
13
+ * Get brightness of color
14
+ * @param color hex string color
15
+ */
16
+ export declare function getBrightness(color: string): number;
12
17
  export {};
@@ -8,3 +8,7 @@ export function toRGB(color) {
8
8
  B: Number.parseInt(b, 16)
9
9
  };
10
10
  }
11
+ export function getBrightness(color) {
12
+ const rgb = toRGB(color);
13
+ return rgb.R * 299 + rgb.G * 587 + rgb.B * 114 / 1e3;
14
+ }
@@ -1,5 +1,6 @@
1
+ import { deepEqual } from "fast-equals";
1
2
  export function isEqual(a, b) {
2
- return JSON.stringify(a) === JSON.stringify(b);
3
+ return deepEqual(a, b);
3
4
  }
4
5
  export function valueIn(array, value) {
5
6
  return array.some((item) => isEqual(item, value));
@@ -1,2 +1,15 @@
1
1
  import { VNode } from 'vue-demi';
2
- export declare function findAllChildren(vnodes: VNode[], name: string): VNode[];
2
+ /**
3
+ * Coerce props's value to boolean
4
+ * @param value prop value
5
+ */
6
+ export declare function toBoolean(value: '' | boolean): boolean;
7
+ /**
8
+ *
9
+ * @param vnodes vnodes tree to be scanned
10
+ * @param names children name(s)
11
+ * @example
12
+ * // Looking for 'Tab' and 'RouteTab'
13
+ * findAllChildren(slots.default(), 'Tab', 'RouteTab')
14
+ */
15
+ export declare function findAllChildren(vnodes: VNode[], ...names: string[]): VNode[];
@@ -1,14 +1,17 @@
1
1
  import {
2
2
  Fragment
3
3
  } from "vue-demi";
4
- export function findAllChildren(vnodes, name) {
4
+ export function toBoolean(value) {
5
+ return value === "" ? true : Boolean(value);
6
+ }
7
+ export function findAllChildren(vnodes, ...names) {
5
8
  const scan = [...vnodes];
6
9
  const result = [];
7
10
  while (scan.length > 0) {
8
11
  const vnode = scan.shift();
9
12
  if (vnode.type === Fragment && Array.isArray(vnode.children))
10
13
  scan.push(...vnode.children);
11
- else if (vnode.type && vnode.type.name === name)
14
+ else if (vnode.type && names.includes(vnode.type.name))
12
15
  result.push(vnode);
13
16
  }
14
17
  return result;
@@ -0,0 +1,85 @@
1
+ <template>
2
+ <div
3
+ class="wizard"
4
+ data-testid="wizard">
5
+ <div class="wizard__header">
6
+ <WizardHeader
7
+ :active="model - 1"
8
+ :variant="variant"
9
+ :title-variant="titleVariant">
10
+ <slot />
11
+ </WizardHeader>
12
+ </div>
13
+ <div class="wizard__body">
14
+ <WizardBody
15
+ v-model="model"
16
+ :keep-alive="keepAlive"
17
+ :on-before-prev="onBeforePrev"
18
+ :on-before-next="onBeforeNext"
19
+ :on-finished="onFinished">
20
+ <slot />
21
+ </WizardBody>
22
+ </div>
23
+ </div>
24
+ </template>
25
+
26
+ <script>
27
+ import { defineComponent } from "vue-demi";
28
+ import WizardHeader from "./WizardHeader.vue";
29
+ import WizardBody from "./WizardBody.vue";
30
+ import { useVModel } from "../input";
31
+ export default defineComponent({
32
+ components: {
33
+ WizardHeader,
34
+ WizardBody
35
+ },
36
+ props: {
37
+ modelValue: {
38
+ type: Number,
39
+ default: 1
40
+ },
41
+ variant: {
42
+ type: String,
43
+ default: "dot"
44
+ },
45
+ titleVariant: {
46
+ type: String,
47
+ default: "specific"
48
+ },
49
+ keepAlive: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ onBeforePrev: {
54
+ type: Function,
55
+ default: void 0
56
+ },
57
+ onBeforeNext: {
58
+ type: Function,
59
+ default: void 0
60
+ },
61
+ onFinished: {
62
+ type: Function,
63
+ default: void 0
64
+ }
65
+ },
66
+ setup(props) {
67
+ const model = useVModel(props);
68
+ return { model };
69
+ }
70
+ });
71
+ </script>
72
+
73
+ <style lang="postcss">
74
+ .wizard {
75
+ @apply flex flex-col w-full space-y-3;
76
+
77
+ &__header {
78
+ @apply flex-shrink-0;
79
+ }
80
+
81
+ &__body {
82
+ @apply flex-grow;
83
+ }
84
+ }
85
+ </style>
@@ -0,0 +1,72 @@
1
+ import { PropType } from 'vue-demi';
2
+ import { TravelHook, FinishedHook } from '../steps';
3
+ declare const _default: import("vue-demi").DefineComponent<{
4
+ modelValue: {
5
+ type: NumberConstructor;
6
+ default: number;
7
+ };
8
+ variant: {
9
+ type: PropType<IconVariant>;
10
+ default: string;
11
+ };
12
+ titleVariant: {
13
+ type: PropType<TitleVariant>;
14
+ default: string;
15
+ };
16
+ keepAlive: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ onBeforePrev: {
21
+ type: PropType<TravelHook>;
22
+ default: any;
23
+ };
24
+ onBeforeNext: {
25
+ type: PropType<TravelHook>;
26
+ default: any;
27
+ };
28
+ onFinished: {
29
+ type: PropType<FinishedHook>;
30
+ default: any;
31
+ };
32
+ }, {
33
+ model: import("vue-demi").Ref<number>;
34
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, {}, string, import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
35
+ modelValue: {
36
+ type: NumberConstructor;
37
+ default: number;
38
+ };
39
+ variant: {
40
+ type: PropType<IconVariant>;
41
+ default: string;
42
+ };
43
+ titleVariant: {
44
+ type: PropType<TitleVariant>;
45
+ default: string;
46
+ };
47
+ keepAlive: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ onBeforePrev: {
52
+ type: PropType<TravelHook>;
53
+ default: any;
54
+ };
55
+ onBeforeNext: {
56
+ type: PropType<TravelHook>;
57
+ default: any;
58
+ };
59
+ onFinished: {
60
+ type: PropType<FinishedHook>;
61
+ default: any;
62
+ };
63
+ }>>, {
64
+ variant: IconVariant;
65
+ modelValue: number;
66
+ titleVariant: TitleVariant;
67
+ onBeforePrev: TravelHook;
68
+ onBeforeNext: TravelHook;
69
+ keepAlive: boolean;
70
+ onFinished: FinishedHook;
71
+ }>;
72
+ export default _default;