@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,43 @@
1
+ <template>
2
+ <div class="input-group__addon">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <style lang="postcss">
8
+ .input-group {
9
+ &__addon {
10
+ @apply flex items-center text-muted rounded border border-solid border-muted outline-none bg-default;
11
+
12
+ .input-group--xs > & {
13
+ @apply text-xs px-3 py-2;
14
+ }
15
+
16
+ .input-group--sm > & {
17
+ @apply px-3 py-2;
18
+ }
19
+
20
+ .input-group--md > & {
21
+ @apply px-3 py-3;
22
+ }
23
+
24
+ .input-group--lg > & {
25
+ @apply px-3 py-4;
26
+ }
27
+
28
+ .state--error &,
29
+ .input-group--error & {
30
+ @apply border-danger-emphasis;
31
+
32
+ &:focus {
33
+ @apply ring-danger border-danger-emphasis;
34
+ }
35
+ }
36
+
37
+ .state--disabled &,
38
+ .input-group--disabled & {
39
+ @apply bg-muted border-muted pointer-events-none text-muted;
40
+ }
41
+ }
42
+ }
43
+ </style>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <p-input
3
+ class="input-password"
4
+ :type="isShow ? 'text' : 'password'">
5
+ <template #append>
6
+ <IconHide
7
+ v-if="isShow"
8
+ class="input-password__toggle"
9
+ @click.prevent.stop="toggle" />
10
+ <IconShow
11
+ v-else
12
+ class="input-password__toggle"
13
+ @click.prevent.stop="toggle" />
14
+ </template>
15
+ </p-input>
16
+ </template>
17
+
18
+ <script>
19
+ import pInput from "../input/Input.vue";
20
+ import IconShow from "@carbon/icons-vue/lib/view/16";
21
+ import IconHide from "@carbon/icons-vue/lib/view--off/16";
22
+ import { defineComponent, ref } from "vue-demi";
23
+ export default defineComponent({
24
+ components: {
25
+ pInput,
26
+ IconShow,
27
+ IconHide
28
+ },
29
+ setup() {
30
+ const isShow = ref(false);
31
+ function toggle() {
32
+ isShow.value = !isShow.value;
33
+ }
34
+ return {
35
+ isShow,
36
+ toggle
37
+ };
38
+ }
39
+ });
40
+ </script>
41
+
42
+ <style lang="postcss">
43
+ .input-password {
44
+ @apply pr-9;
45
+
46
+ &__toggle {
47
+ @apply absolute right-3 top-1/2 -translate-y-1/2 cursor-pointer z-1;
48
+
49
+ .input--disabled ~ & {
50
+ @apply pointer-events-none text-muted;
51
+ }
52
+ }
53
+
54
+ &.input--clearable {
55
+ @apply pr-14;
56
+
57
+ + .input__clear {
58
+ @apply right-9;
59
+ }
60
+ }
61
+ }
62
+ </style>
@@ -0,0 +1,5 @@
1
+ declare const _default: import("vue-demi").DefineComponent<{}, {
2
+ isShow: import("vue-demi").Ref<boolean>;
3
+ toggle: () => void;
4
+ }, {}, {}, {}, 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<{}>>, {}>;
5
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { MaybeRef } from '@vueuse/core';
2
+ export declare function usePasswordStrength(input: MaybeRef<string>): import("vue-demi").Ref<number>;
@@ -0,0 +1,17 @@
1
+ import { watchDebounced } from "@vueuse/core";
2
+ import {
3
+ ref,
4
+ unref
5
+ } from "vue-demi";
6
+ export function usePasswordStrength(input) {
7
+ const score = ref(0);
8
+ watchDebounced(() => unref(input), async (value) => {
9
+ if (value) {
10
+ const { default: zxcvbn } = await import("zxcvbn");
11
+ const result = zxcvbn(value);
12
+ score.value = Math.round(result.score / 4 * 6 + 1);
13
+ } else
14
+ score.value = 0;
15
+ }, { debounce: 300 });
16
+ return score;
17
+ }
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <div
3
+ ref="root"
4
+ data-testid="input-pin"
5
+ class="input-pin"
6
+ :class="classNames">
7
+ <p-input
8
+ v-for="i in num"
9
+ :key="i"
10
+ maxlength="1"
11
+ v-bind="$attrs"
12
+ :model-value="getValue(i - 1)"
13
+ :clearable="false"
14
+ :readonly="readonly"
15
+ :disabled="disabled"
16
+ :error="error"
17
+ @input="setValue(i - 1, $event)"
18
+ @focus.passive="onFocus"
19
+ @keyup.delete.passive="onDelete"
20
+ @keyup.left.passive="prevFocus"
21
+ @keyup.right.passive="nextFocus"
22
+ @paste.passive="onPaste" />
23
+ </div>
24
+ </template>
25
+
26
+ <script>
27
+ import pInput from "../input/Input.vue";
28
+ import {
29
+ computed,
30
+ defineComponent,
31
+ toRef,
32
+ ref
33
+ } from "vue-demi";
34
+ import {
35
+ syncRef,
36
+ templateRef,
37
+ useToNumber
38
+ } from "@vueuse/core";
39
+ import { useFocus } from "../dropdown/utils/use-focus";
40
+ export default defineComponent({
41
+ components: { pInput },
42
+ inheritAttrs: false,
43
+ props: {
44
+ modelValue: {
45
+ type: String,
46
+ default: ""
47
+ },
48
+ length: {
49
+ type: [Number, String],
50
+ default: 5
51
+ },
52
+ disabled: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ readonly: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ error: {
61
+ type: Boolean,
62
+ default: false
63
+ }
64
+ },
65
+ models: {
66
+ prop: "modelValue",
67
+ event: "update:modelValue"
68
+ },
69
+ emits: ["update:modelValue", "clear"],
70
+ setup(props, { emit }) {
71
+ const root = templateRef("root");
72
+ const num = useToNumber(toRef(props, "length"));
73
+ const localModel = ref([...props.modelValue].slice(0, num.value).map((val) => val.trim()));
74
+ const classNames = computed(() => {
75
+ const result = [];
76
+ if (props.disabled)
77
+ result.push("input-pin--disabled");
78
+ if (props.readonly)
79
+ result.push("input-pin--readonly");
80
+ if (props.error)
81
+ result.push("input-pin--error", "state--error");
82
+ return result;
83
+ });
84
+ const { next: nextFocus, prev: prevFocus } = useFocus(root, false);
85
+ const model = computed({
86
+ get() {
87
+ return [...props.modelValue].slice(0, num.value);
88
+ },
89
+ set(value) {
90
+ const text = value.map((val) => val || " ").join("").trimEnd();
91
+ emit("update:modelValue", text);
92
+ }
93
+ });
94
+ syncRef(localModel, model, { deep: true });
95
+ function getValue(index) {
96
+ return localModel.value.at(index);
97
+ }
98
+ function setValue(index, event) {
99
+ const target = event.target;
100
+ const value = target.value;
101
+ localModel.value[index] = value;
102
+ if (root.value) {
103
+ if (value)
104
+ nextFocus();
105
+ else
106
+ prevFocus();
107
+ }
108
+ }
109
+ function onFocus(event) {
110
+ event.target.select();
111
+ }
112
+ function onDelete(event) {
113
+ if (root.value && !event.target.value)
114
+ prevFocus();
115
+ }
116
+ function onPaste(event) {
117
+ localModel.value = [...event.clipboardData.getData("Text")].slice(0, num.value);
118
+ }
119
+ return {
120
+ classNames,
121
+ num,
122
+ localModel,
123
+ getValue,
124
+ setValue,
125
+ onFocus,
126
+ onDelete,
127
+ onPaste,
128
+ nextFocus,
129
+ prevFocus
130
+ };
131
+ }
132
+ });
133
+ </script>
134
+
135
+ <style lang="postcss">
136
+ .input-pin {
137
+ @apply flex flex-row space-x-4;
138
+
139
+ .input__form {
140
+ -webkit-touch-callout: none;
141
+
142
+ @apply text-center;
143
+ }
144
+ }
145
+ </style>
@@ -0,0 +1,64 @@
1
+ declare const _default: import("vue-demi").DefineComponent<{
2
+ modelValue: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ length: {
7
+ type: (StringConstructor | NumberConstructor)[];
8
+ default: number;
9
+ };
10
+ disabled: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ readonly: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ error: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ }, {
23
+ classNames: import("vue-demi").ComputedRef<string[]>;
24
+ num: import("vue-demi").ComputedRef<number>;
25
+ localModel: import("vue-demi").Ref<string[]>;
26
+ getValue: (index: number) => string;
27
+ setValue: (index: number, event: InputEvent) => void;
28
+ onFocus: (event: InputEvent) => void;
29
+ onDelete: (event: InputEvent) => void;
30
+ onPaste: (event: ClipboardEvent) => void;
31
+ nextFocus: () => void;
32
+ prevFocus: () => void;
33
+ }, unknown, {}, {}, import("vue-demi").ComponentOptionsMixin, import("vue-demi").ComponentOptionsMixin, ("update:modelValue" | "clear")[], "update:modelValue" | "clear", import("vue-demi").VNodeProps & import("vue-demi").AllowedComponentProps & import("vue-demi").ComponentCustomProps, Readonly<import("vue-demi").ExtractPropTypes<{
34
+ modelValue: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ length: {
39
+ type: (StringConstructor | NumberConstructor)[];
40
+ default: number;
41
+ };
42
+ disabled: {
43
+ type: BooleanConstructor;
44
+ default: boolean;
45
+ };
46
+ readonly: {
47
+ type: BooleanConstructor;
48
+ default: boolean;
49
+ };
50
+ error: {
51
+ type: BooleanConstructor;
52
+ default: boolean;
53
+ };
54
+ }>> & {
55
+ "onUpdate:modelValue"?: (...args: any[]) => any;
56
+ onClear?: (...args: any[]) => any;
57
+ }, {
58
+ error: boolean;
59
+ length: string | number;
60
+ disabled: boolean;
61
+ modelValue: string;
62
+ readonly: boolean;
63
+ }>;
64
+ export default _default;
@@ -0,0 +1,274 @@
1
+ <template>
2
+ <div
3
+ data-testid="input-range"
4
+ class="input-range"
5
+ :class="classNames">
6
+ <div
7
+ ref="track"
8
+ class="input-range__tracks">
9
+ <!-- Lower Track -->
10
+ <div
11
+ v-show="multiple"
12
+ data-testid="track-lower"
13
+ class="input-range__track input-range__track-lower"
14
+ :style="lowerStyle"
15
+ @click="onClickLowerTrack" />
16
+ <!-- Active Track -->
17
+ <div
18
+ ref="track-active"
19
+ data-testid="track-active"
20
+ class="input-range__track input-range__track-active"
21
+ :style="upperStyle"
22
+ @click="onClickActiveTrack">
23
+ <div
24
+ v-show="multiple"
25
+ ref="thumb-start"
26
+ data-testid="thumb-start"
27
+ class="input-range__thumb input-range__thumb-start" />
28
+ <div
29
+ ref="thumb-end"
30
+ data-testid="thumb-end"
31
+ class="input-range__thumb input-range__thumb-end" />
32
+ </div>
33
+ <!-- Upper Track -->
34
+ <div
35
+ data-testid="track-upper"
36
+ class="input-range__track input-range__track-upper"
37
+ @click="onClickUpperTrack" />
38
+ </div>
39
+ </div>
40
+ </template>
41
+
42
+ <script>
43
+ import {
44
+ syncRef,
45
+ templateRef,
46
+ useElementBounding,
47
+ useToNumber
48
+ } from "@vueuse/core";
49
+ import { useClamp } from "@vueuse/math";
50
+ import {
51
+ computed,
52
+ defineComponent,
53
+ ref,
54
+ toRef,
55
+ watch
56
+ } from "vue-demi";
57
+ import useDrag from "./utils/use-drag";
58
+ export default defineComponent({
59
+ props: {
60
+ modelValue: {
61
+ type: [Number, Array],
62
+ default: void 0
63
+ },
64
+ start: {
65
+ type: Number,
66
+ default: void 0
67
+ },
68
+ end: {
69
+ type: Number,
70
+ default: void 0
71
+ },
72
+ step: {
73
+ type: [String, Number],
74
+ default: 1
75
+ },
76
+ min: {
77
+ type: [String, Number],
78
+ default: 0
79
+ },
80
+ max: {
81
+ type: [String, Number],
82
+ default: 100
83
+ },
84
+ multiple: {
85
+ type: Boolean,
86
+ default: false
87
+ },
88
+ disabled: {
89
+ type: Boolean,
90
+ default: false
91
+ },
92
+ readonly: {
93
+ type: Boolean,
94
+ default: false
95
+ },
96
+ error: {
97
+ type: Boolean,
98
+ default: false
99
+ }
100
+ },
101
+ models: {
102
+ prop: "modelValue",
103
+ event: "update:modelValue"
104
+ },
105
+ emits: [
106
+ "change",
107
+ "update:modelValue",
108
+ "update:end",
109
+ "update:start"
110
+ ],
111
+ setup(props, { emit }) {
112
+ const track = templateRef("track");
113
+ const thumbStart = templateRef("thumb-start");
114
+ const thumbEnd = templateRef("thumb-end");
115
+ const min = useToNumber(toRef(props, "min"));
116
+ const max = useToNumber(toRef(props, "max"));
117
+ const step = useToNumber(toRef(props, "step"));
118
+ const localStart = ref(Array.isArray(props.modelValue) ? props.modelValue[0] : props.start ?? min.value);
119
+ const localEnd = ref(Array.isArray(props.modelValue) ? props.modelValue[1] : props.end ?? props.modelValue ?? max.value);
120
+ const minDrag = computed(() => props.multiple ? localStart.value + step.value : min.value);
121
+ const maxDrag = computed(() => props.multiple ? localEnd.value - step.value : max.value);
122
+ const start = useClamp(localStart.value, min, maxDrag);
123
+ const end = useClamp(localEnd.value, minDrag, max);
124
+ const { width, left } = useElementBounding(track);
125
+ const startValue = computed({
126
+ get() {
127
+ if (Array.isArray(props.modelValue))
128
+ return props.modelValue[0];
129
+ return props.start ?? min.value;
130
+ },
131
+ set(value) {
132
+ emit("update:start", value);
133
+ }
134
+ });
135
+ const endValue = computed({
136
+ get() {
137
+ if (Array.isArray(props.modelValue))
138
+ return props.modelValue[1];
139
+ if (Number.isFinite(props.modelValue))
140
+ return props.modelValue;
141
+ return props.end ?? max.value;
142
+ },
143
+ set(value) {
144
+ emit("update:end", value);
145
+ }
146
+ });
147
+ const startPercentage = computed(() => {
148
+ return (start.value - min.value) / (max.value - min.value) * 100;
149
+ });
150
+ const endPercentage = computed(() => {
151
+ return (end.value - min.value) / (max.value - min.value) * 100;
152
+ });
153
+ const classNames = computed(() => {
154
+ const result = [];
155
+ if (props.disabled)
156
+ result.push("input-range--disabled");
157
+ if (props.readonly)
158
+ result.push("input-range--readonly");
159
+ if (props.error)
160
+ result.push("input-range--error", "state--error");
161
+ return result;
162
+ });
163
+ const lowerStyle = computed(() => {
164
+ return { width: `${startPercentage.value}%` };
165
+ });
166
+ const upperStyle = computed(() => {
167
+ return { width: `${endPercentage.value - startPercentage.value}%` };
168
+ });
169
+ function getValue(event) {
170
+ const offset = event.pageX - left.value;
171
+ const percent = offset / width.value;
172
+ const value = percent * (max.value - min.value) + min.value;
173
+ const nearest = Math.round(value / step.value) * step.value;
174
+ return nearest;
175
+ }
176
+ function onClickLowerTrack(event) {
177
+ if (!props.disabled && !props.readonly)
178
+ start.value = getValue(event);
179
+ }
180
+ function onClickActiveTrack(event) {
181
+ if (!props.disabled && !props.readonly) {
182
+ const value = getValue(event);
183
+ if (props.multiple) {
184
+ const ds = Math.abs(value - start.value);
185
+ const de = Math.abs(value - end.value);
186
+ if (ds < de) {
187
+ start.value = value;
188
+ return;
189
+ }
190
+ }
191
+ end.value = value;
192
+ }
193
+ }
194
+ function onClickUpperTrack(event) {
195
+ if (!props.disabled && !props.readonly)
196
+ end.value = getValue(event);
197
+ }
198
+ useDrag(thumbStart, (event) => {
199
+ if (!props.disabled && !props.readonly)
200
+ start.value = getValue(event);
201
+ });
202
+ useDrag(thumbEnd, (event) => {
203
+ if (!props.disabled && !props.readonly)
204
+ end.value = getValue(event);
205
+ });
206
+ syncRef(start, startValue);
207
+ syncRef(end, endValue);
208
+ watch([start, end], ([startVal, endVal]) => {
209
+ localStart.value = startVal;
210
+ localEnd.value = endVal;
211
+ if (props.multiple) {
212
+ emit("update:modelValue", [startVal, endVal]);
213
+ emit("change", [startVal, endVal]);
214
+ } else {
215
+ emit("update:modelValue", endVal);
216
+ emit("change", endVal);
217
+ }
218
+ });
219
+ return {
220
+ classNames,
221
+ lowerStyle,
222
+ upperStyle,
223
+ onClickLowerTrack,
224
+ onClickActiveTrack,
225
+ onClickUpperTrack
226
+ };
227
+ }
228
+ });
229
+ </script>
230
+
231
+ <style lang="postcss">
232
+ .input-range {
233
+ @apply py-2 w-full;
234
+
235
+ &__tracks {
236
+ @apply relative flex w-full bg-subtle cursor-pointer overflow-visible rounded;
237
+ }
238
+
239
+ &__track {
240
+ @apply h-2 rounded;
241
+
242
+ &-active {
243
+ @apply bg-accent-emphasis relative text-center;
244
+ }
245
+
246
+ &-upper {
247
+ @apply flex-grow;
248
+ }
249
+ }
250
+
251
+ &__thumb {
252
+ @apply w-4 h-4 rounded-full bg-default shadow-sm absolute top-1/2 bottom-0 -translate-y-1/2 border border-gray-25;
253
+ @apply touch-none select-none;
254
+
255
+ &:hover,
256
+ &:active {
257
+ @apply ring ring-accent border-accent-emphasis;
258
+ }
259
+
260
+ &-start {
261
+ @apply -left-2;
262
+ }
263
+
264
+ &-end {
265
+ @apply -right-2;
266
+ }
267
+ }
268
+
269
+ &:disabled,
270
+ &--disabled {
271
+ @apply opacity-50 pointer-events-none;
272
+ }
273
+ }
274
+ </style>