@privyid/persona 1.1.2 → 1.2.1-rc.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.
- package/dist/module.d.cts +2 -0
- package/dist/module.d.mts +2 -27
- package/dist/module.json +12 -0
- package/dist/module.mjs +13 -92
- package/dist/types.d.mts +13 -0
- package/package.json +25 -27
- package/dist/components/accordion/Accordion.vue +0 -121
- package/dist/components/accordion/AccordionItem.vue +0 -250
- package/dist/components/accordion/AccordionItems.vue +0 -50
- package/dist/components/accordion/AccordionItems.vue.d.ts +0 -41
- package/dist/components/accordion/index.d.ts +0 -7
- package/dist/components/accordion/index.mjs +0 -3
- package/dist/components/aspect-ratio/index.d.ts +0 -3
- package/dist/components/aspect-ratio/index.mjs +0 -21
- package/dist/components/aspect-ratio/utils/calculate-ratio.d.ts +0 -7
- package/dist/components/aspect-ratio/utils/calculate-ratio.mjs +0 -10
- package/dist/components/aspect-ratio/utils/resize-observer.d.ts +0 -1
- package/dist/components/aspect-ratio/utils/resize-observer.mjs +0 -22
- package/dist/components/avatar/Avatar.vue +0 -193
- package/dist/components/avatar/AvatarGroup.vue +0 -42
- package/dist/components/avatar/AvatarTruncate.vue +0 -33
- package/dist/components/avatar/AvatarTruncate.vue.d.ts +0 -31
- package/dist/components/avatar/assets/avatar-old.png +0 -0
- package/dist/components/avatar/assets/avatar.png +0 -0
- package/dist/components/avatar/index.d.ts +0 -2
- package/dist/components/avatar/index.mjs +0 -0
- package/dist/components/avatar/utils/color-hash.d.ts +0 -2
- package/dist/components/avatar/utils/color-hash.mjs +0 -22
- package/dist/components/avatar/utils/create-image.d.ts +0 -5
- package/dist/components/avatar/utils/create-image.mjs +0 -19
- package/dist/components/avatar/utils/load-image.d.ts +0 -1
- package/dist/components/avatar/utils/load-image.mjs +0 -22
- package/dist/components/badge/Badge.vue +0 -218
- package/dist/components/badge/index.d.ts +0 -1
- package/dist/components/badge/index.mjs +0 -0
- package/dist/components/banner/Banner.vue +0 -213
- package/dist/components/banner/index.d.ts +0 -1
- package/dist/components/banner/index.mjs +0 -0
- package/dist/components/breadcrumbs/Breadcrumb.vue +0 -62
- package/dist/components/breadcrumbs/BreadcrumbItem.vue +0 -95
- package/dist/components/breadcrumbs/BreadcrumbItemDropdown.vue +0 -78
- package/dist/components/breadcrumbs/index.d.ts +0 -11
- package/dist/components/breadcrumbs/index.mjs +0 -3
- package/dist/components/button/Button.vue +0 -422
- package/dist/components/button/index.d.ts +0 -5
- package/dist/components/button/index.mjs +0 -0
- package/dist/components/button-group/ButtonGroup.vue +0 -220
- package/dist/components/button-group/index.d.ts +0 -6
- package/dist/components/button-group/index.mjs +0 -1
- package/dist/components/calendar/Calendar.vue +0 -465
- package/dist/components/calendar/adapter/adapter.d.ts +0 -32
- package/dist/components/calendar/adapter/adapter.mjs +0 -43
- package/dist/components/calendar/adapter/date.d.ts +0 -2
- package/dist/components/calendar/adapter/date.mjs +0 -86
- package/dist/components/calendar/adapter/month.d.ts +0 -2
- package/dist/components/calendar/adapter/month.mjs +0 -66
- package/dist/components/calendar/adapter/year.d.ts +0 -2
- package/dist/components/calendar/adapter/year.mjs +0 -63
- package/dist/components/camera/Camera.vue +0 -416
- package/dist/components/camera/adapter/adapter.d.ts +0 -41
- package/dist/components/camera/adapter/adapter.mjs +0 -3
- package/dist/components/camera/adapter/capture.d.ts +0 -5
- package/dist/components/camera/adapter/capture.mjs +0 -12
- package/dist/components/camera/adapter/liveness.d.ts +0 -5
- package/dist/components/camera/adapter/liveness.mjs +0 -46
- package/dist/components/camera/adapter/qr-code.d.ts +0 -2
- package/dist/components/camera/adapter/qr-code.mjs +0 -19
- package/dist/components/camera/assets/shutter.wav +0 -0
- package/dist/components/camera/utils/motion.d.ts +0 -29
- package/dist/components/camera/utils/motion.mjs +0 -88
- package/dist/components/camera/utils/take-picture.d.ts +0 -1
- package/dist/components/camera/utils/take-picture.mjs +0 -14
- package/dist/components/caption/Caption.vue +0 -122
- package/dist/components/caption/index.d.ts +0 -1
- package/dist/components/caption/index.mjs +0 -0
- package/dist/components/card/Card.vue +0 -354
- package/dist/components/card/CardSection.vue +0 -81
- package/dist/components/card/index.d.ts +0 -2
- package/dist/components/card/index.mjs +0 -0
- package/dist/components/carousel/Carousel.vue +0 -202
- package/dist/components/carousel/CarouselBody.vue +0 -18
- package/dist/components/carousel/CarouselItem.vue +0 -10
- package/dist/components/carousel/index.d.ts +0 -4
- package/dist/components/carousel/index.mjs +0 -1
- package/dist/components/chart/Chart.vue +0 -155
- package/dist/components/chart/ChartSet.vue +0 -32
- package/dist/components/chart/ChartVal.vue +0 -36
- package/dist/components/chart/adapter/adapter.d.ts +0 -7
- package/dist/components/chart/adapter/adapter.mjs +0 -3
- package/dist/components/chart/adapter/bubble.d.ts +0 -2
- package/dist/components/chart/adapter/bubble.mjs +0 -26
- package/dist/components/chart/adapter/index.d.ts +0 -3
- package/dist/components/chart/adapter/index.mjs +0 -16
- package/dist/components/chart/adapter/line.d.ts +0 -2
- package/dist/components/chart/adapter/line.mjs +0 -66
- package/dist/components/chart/adapter/pie.d.ts +0 -2
- package/dist/components/chart/adapter/pie.mjs +0 -34
- package/dist/components/chart/index.d.ts +0 -2
- package/dist/components/chart/index.mjs +0 -0
- package/dist/components/chart/utils/use-chart.d.ts +0 -2
- package/dist/components/chart/utils/use-chart.mjs +0 -9
- package/dist/components/checkbox/Checkbox.vue +0 -232
- package/dist/components/checkbox/icon/IconCheckbox.vue +0 -13
- package/dist/components/checkbox/icon/IconInderteminate.vue +0 -12
- package/dist/components/checkbox/index.d.ts +0 -7
- package/dist/components/checkbox/index.mjs +0 -34
- package/dist/components/collapse/Collapse.vue +0 -71
- package/dist/components/contextual-bar/ContextualBar.vue +0 -461
- package/dist/components/contextual-bar/index.d.ts +0 -1
- package/dist/components/contextual-bar/index.mjs +0 -0
- package/dist/components/cropper/Cropper.vue +0 -446
- package/dist/components/cropper/index.d.ts +0 -1
- package/dist/components/cropper/index.mjs +0 -3
- package/dist/components/cropper/utils/crop-image.d.ts +0 -44
- package/dist/components/cropper/utils/crop-image.mjs +0 -43
- package/dist/components/cropper/utils/use-pinch.d.ts +0 -8
- package/dist/components/cropper/utils/use-pinch.mjs +0 -50
- package/dist/components/cropper/utils/use-preview.d.ts +0 -3
- package/dist/components/cropper/utils/use-preview.mjs +0 -21
- package/dist/components/cropper/utils/use-ratio.d.ts +0 -9
- package/dist/components/cropper/utils/use-ratio.mjs +0 -24
- package/dist/components/datepicker/Datepicker.vue +0 -235
- package/dist/components/dialog/Dialog.vue +0 -149
- package/dist/components/dialog/DialogFooter.vue +0 -138
- package/dist/components/dialog/index.d.ts +0 -52
- package/dist/components/dialog/index.mjs +0 -86
- package/dist/components/divider/Divider.vue +0 -65
- package/dist/components/dot/Dot.vue +0 -103
- package/dist/components/dot/index.d.ts +0 -1
- package/dist/components/dot/index.mjs +0 -0
- package/dist/components/dropdown/Dropdown.vue +0 -441
- package/dist/components/dropdown/DropdownHeader.vue +0 -33
- package/dist/components/dropdown/DropdownItem.vue +0 -103
- package/dist/components/dropdown/DropdownText.vue +0 -34
- package/dist/components/dropdown/index.d.ts +0 -10
- package/dist/components/dropdown/index.mjs +0 -1
- package/dist/components/dropdown/utils/use-focus.d.ts +0 -5
- package/dist/components/dropdown/utils/use-focus.mjs +0 -22
- package/dist/components/dropdown-subitem/DropdownSubitem.vue +0 -182
- package/dist/components/dropdown-subitem/index.d.ts +0 -12
- package/dist/components/dropdown-subitem/index.mjs +0 -1
- package/dist/components/dropzone/Dropzone.vue +0 -261
- package/dist/components/dropzone/index.d.ts +0 -4
- package/dist/components/dropzone/index.mjs +0 -0
- package/dist/components/dropzone/utils/accept.d.ts +0 -1
- package/dist/components/dropzone/utils/accept.mjs +0 -17
- package/dist/components/filterbar/Filterbar.vue +0 -103
- package/dist/components/filterbar/Filterbar.vue.d.ts +0 -40
- package/dist/components/filterbar/index.d.ts +0 -45
- package/dist/components/filterbar/index.mjs +0 -7
- package/dist/components/filterbar/pinned/PinnedDate.vue +0 -100
- package/dist/components/filterbar/pinned/PinnedDate.vue.d.ts +0 -72
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue +0 -113
- package/dist/components/filterbar/pinned/PinnedMultiselect.vue.d.ts +0 -48
- package/dist/components/filterbar/pinned/PinnedSelect.vue +0 -100
- package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +0 -47
- package/dist/components/filterbar/pinned/PinnedToggle.vue +0 -77
- package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +0 -59
- package/dist/components/form-group/FormGroup.vue +0 -169
- package/dist/components/global/router.d.ts +0 -24
- package/dist/components/global/router.mjs +0 -7
- package/dist/components/global/store.d.ts +0 -49
- package/dist/components/global/store.mjs +0 -52
- package/dist/components/global/types.d.ts +0 -4
- package/dist/components/global/types.mjs +0 -0
- package/dist/components/global/use-singleton.d.ts +0 -21
- package/dist/components/global/use-singleton.mjs +0 -60
- package/dist/components/global/utils/queue.d.ts +0 -16
- package/dist/components/global/utils/queue.mjs +0 -35
- package/dist/components/heading/Heading.vue +0 -140
- package/dist/components/heading/index.d.ts +0 -3
- package/dist/components/heading/index.mjs +0 -0
- package/dist/components/input/Input.vue +0 -243
- package/dist/components/input/index.d.ts +0 -6
- package/dist/components/input/index.mjs +0 -25
- package/dist/components/input/utils/accept.d.ts +0 -26
- package/dist/components/input/utils/accept.mjs +0 -81
- package/dist/components/input-color/index.d.ts +0 -1
- package/dist/components/input-color/index.mjs +0 -0
- package/dist/components/input-color/inputColor.vue +0 -264
- package/dist/components/input-file/InputFile.vue +0 -221
- package/dist/components/input-group/InputGroup.vue +0 -188
- package/dist/components/input-group/InputGroupAddon.vue +0 -42
- package/dist/components/input-group/index.d.ts +0 -6
- package/dist/components/input-group/index.mjs +0 -1
- package/dist/components/input-password/InputPassword.vue +0 -110
- package/dist/components/input-password/index.d.ts +0 -2
- package/dist/components/input-password/index.mjs +0 -17
- package/dist/components/input-pin/InputPin.vue +0 -170
- package/dist/components/input-pin/index.d.ts +0 -6
- package/dist/components/input-pin/index.mjs +0 -3
- package/dist/components/input-range/InputRange.vue +0 -303
- package/dist/components/input-range/utils/use-drag.d.ts +0 -3
- package/dist/components/input-range/utils/use-drag.mjs +0 -26
- package/dist/components/label/Label.vue +0 -265
- package/dist/components/label/index.d.ts +0 -1
- package/dist/components/label/index.mjs +0 -0
- package/dist/components/list-group/ListGroup.vue +0 -75
- package/dist/components/list-group/ListGroupItem.vue +0 -88
- package/dist/components/list-group/index.d.ts +0 -1
- package/dist/components/list-group/index.mjs +0 -0
- package/dist/components/main/Main.vue +0 -66
- package/dist/components/markdown/index.d.ts +0 -29
- package/dist/components/markdown/index.mjs +0 -25
- package/dist/components/meta.json +0 -171
- package/dist/components/modal/Modal.vue +0 -546
- package/dist/components/modal/index.d.ts +0 -1
- package/dist/components/modal/index.mjs +0 -0
- package/dist/components/nav/Nav.vue +0 -416
- package/dist/components/nav/NavCollapse.vue +0 -66
- package/dist/components/nav/NavForm.vue +0 -23
- package/dist/components/nav/NavItem.vue +0 -187
- package/dist/components/nav/NavItemDropdown.vue +0 -120
- package/dist/components/nav/NavSubItem.vue +0 -194
- package/dist/components/nav/NavText.vue +0 -19
- package/dist/components/nav/index.d.ts +0 -2
- package/dist/components/nav/index.mjs +0 -0
- package/dist/components/navbar/Navbar.vue +0 -284
- package/dist/components/navbar/NavbarBrand.vue +0 -31
- package/dist/components/navbar/NavbarNav.vue +0 -114
- package/dist/components/navbar/NavbarToggle.vue +0 -72
- package/dist/components/navbar/index.d.ts +0 -9
- package/dist/components/navbar/index.mjs +0 -1
- package/dist/components/navbar-menu/NavbarNavMenu.vue +0 -59
- package/dist/components/notify/Notify.vue +0 -51
- package/dist/components/notify/NotifyGroup.vue +0 -244
- package/dist/components/notify/NotifyItem.vue +0 -45
- package/dist/components/notify/index.d.ts +0 -20
- package/dist/components/notify/index.mjs +0 -18
- package/dist/components/overlay/Overlay.vue +0 -68
- package/dist/components/overlay/assets/icon-white.svg +0 -1
- package/dist/components/overlay/index.d.ts +0 -2
- package/dist/components/overlay/index.mjs +0 -8
- package/dist/components/overlay/utils/use-loading.d.ts +0 -4
- package/dist/components/overlay/utils/use-loading.mjs +0 -28
- package/dist/components/page/Page.vue +0 -106
- package/dist/components/pagination/Pagination.vue +0 -415
- package/dist/components/pagination/index.d.ts +0 -14
- package/dist/components/pagination/index.mjs +0 -38
- package/dist/components/pagination/utils/calculate-page.d.ts +0 -11
- package/dist/components/pagination/utils/calculate-page.mjs +0 -48
- package/dist/components/pdf-helipad/PdfHelipad.vue +0 -147
- package/dist/components/pdf-helipad/index.d.ts +0 -7
- package/dist/components/pdf-helipad/index.mjs +0 -0
- package/dist/components/pdf-helipad/utils/use-drag.d.ts +0 -3
- package/dist/components/pdf-helipad/utils/use-drag.mjs +0 -38
- package/dist/components/pdf-object/PdfObject.vue +0 -348
- package/dist/components/pdf-object/PdfObjectAddon.vue +0 -55
- package/dist/components/pdf-object/PdfObjectDebugger.vue +0 -70
- package/dist/components/pdf-object/PdfObjects.vue +0 -39
- package/dist/components/pdf-object/index.d.ts +0 -63
- package/dist/components/pdf-object/index.mjs +0 -110
- package/dist/components/pdf-object/utils/overlap.d.ts +0 -51
- package/dist/components/pdf-object/utils/overlap.mjs +0 -54
- package/dist/components/pdf-object/utils/position.d.ts +0 -64
- package/dist/components/pdf-object/utils/position.mjs +0 -48
- package/dist/components/pdf-object/utils/use-drag.d.ts +0 -9
- package/dist/components/pdf-object/utils/use-drag.mjs +0 -69
- package/dist/components/pdf-object/utils/use-drop.d.ts +0 -7
- package/dist/components/pdf-object/utils/use-drop.mjs +0 -57
- package/dist/components/pdf-object/utils/use-resize.d.ts +0 -17
- package/dist/components/pdf-object/utils/use-resize.mjs +0 -90
- package/dist/components/pdf-object/utils/use-selector.d.ts +0 -4
- package/dist/components/pdf-object/utils/use-selector.mjs +0 -26
- package/dist/components/pdf-text/PdfText.vue +0 -138
- package/dist/components/pdf-text/utils/text-to-image.d.ts +0 -68
- package/dist/components/pdf-text/utils/text-to-image.mjs +0 -120
- package/dist/components/pdf-viewer/PdfError.vue +0 -74
- package/dist/components/pdf-viewer/PdfLoading.vue +0 -24
- package/dist/components/pdf-viewer/PdfNavigation.vue +0 -169
- package/dist/components/pdf-viewer/PdfViewer.vue +0 -377
- package/dist/components/pdf-viewer/assets/pdf-loading.svg +0 -1
- package/dist/components/pdf-viewer/index.d.ts +0 -25
- package/dist/components/pdf-viewer/index.mjs +0 -24
- package/dist/components/pdf-viewer/utils/pdfjs.d.ts +0 -68
- package/dist/components/pdf-viewer/utils/pdfjs.mjs +0 -54
- package/dist/components/pdf-viewer/utils/use-idle.d.ts +0 -2
- package/dist/components/pdf-viewer/utils/use-idle.mjs +0 -25
- package/dist/components/pdf-viewer/utils/use-sticky.d.ts +0 -6
- package/dist/components/pdf-viewer/utils/use-sticky.mjs +0 -49
- package/dist/components/pdf-viewer/utils/use-viewer.d.ts +0 -27
- package/dist/components/pdf-viewer/utils/use-viewer.mjs +0 -191
- package/dist/components/popover/Popover.vue +0 -131
- package/dist/components/popover/index.d.ts +0 -17
- package/dist/components/popover/index.mjs +0 -52
- package/dist/components/popup/Popup.vue +0 -428
- package/dist/components/popup/index.d.ts +0 -38
- package/dist/components/popup/index.mjs +0 -31
- package/dist/components/progress/Progress.vue +0 -221
- package/dist/components/progress/ProgressItem.vue +0 -56
- package/dist/components/progress/index.d.ts +0 -2
- package/dist/components/progress/index.mjs +0 -0
- package/dist/components/progress-indicator/ProgressIndicator.vue +0 -132
- package/dist/components/progressbar/Progressbar.vue +0 -113
- package/dist/components/progressbar/index.d.ts +0 -7
- package/dist/components/progressbar/index.mjs +0 -11
- package/dist/components/pspdfkit/PspdfHelipad.vue +0 -165
- package/dist/components/pspdfkit/PspdfObject.vue +0 -341
- package/dist/components/pspdfkit/PspdfObjectAddon.vue +0 -30
- package/dist/components/pspdfkit/PspdfObjects.vue +0 -30
- package/dist/components/pspdfkit/PspdfViewer.vue +0 -257
- package/dist/components/pspdfkit/css/custom.css +0 -345
- package/dist/components/pspdfkit/index.d.ts +0 -8
- package/dist/components/pspdfkit/index.mjs +0 -7
- package/dist/components/pspdfkit/utils/position.d.ts +0 -1
- package/dist/components/pspdfkit/utils/position.mjs +0 -5
- package/dist/components/pspdfkit/utils/pspdfkit.d.ts +0 -17
- package/dist/components/pspdfkit/utils/pspdfkit.mjs +0 -53
- package/dist/components/pspdfkit/utils/use-drop.d.ts +0 -2
- package/dist/components/pspdfkit/utils/use-drop.mjs +0 -41
- package/dist/components/pspdfkit/utils/use-viewer.d.ts +0 -17
- package/dist/components/pspdfkit/utils/use-viewer.mjs +0 -167
- package/dist/components/qrcode/Qrcode.vue +0 -174
- package/dist/components/qrcode/index.d.ts +0 -1
- package/dist/components/qrcode/index.mjs +0 -0
- package/dist/components/radio/Radio.vue +0 -304
- package/dist/components/radio/index.d.ts +0 -7
- package/dist/components/radio/index.mjs +0 -16
- package/dist/components/richtext/Richtext.vue +0 -295
- package/dist/components/richtext/RichtextToolbarAdvance.vue +0 -37
- package/dist/components/richtext/RichtextToolbarSimple.vue +0 -158
- package/dist/components/richtext/control/RichtextControlFontFamily.vue +0 -56
- package/dist/components/richtext/control/RichtextControlFontSize.vue +0 -81
- package/dist/components/richtext/control/RichtextControlHighlight.vue +0 -135
- package/dist/components/richtext/control/RichtextControlHistory.vue +0 -27
- package/dist/components/richtext/control/RichtextControlImage.vue +0 -34
- package/dist/components/richtext/control/RichtextControlLink.vue +0 -53
- package/dist/components/richtext/control/RichtextControlList.vue +0 -45
- package/dist/components/richtext/control/RichtextControlTable.vue +0 -106
- package/dist/components/richtext/control/RichtextControlTextAlign.vue +0 -90
- package/dist/components/richtext/control/RichtextControlTextFormat.vue +0 -49
- package/dist/components/richtext/control/RichtextControlTextHeading.vue +0 -101
- package/dist/components/richtext/index.d.ts +0 -7
- package/dist/components/richtext/index.mjs +0 -7
- package/dist/components/richtext/popup/RichtextPopupImageEdit.vue +0 -65
- package/dist/components/richtext/popup/RichtextPopupLinkDetail.vue +0 -95
- package/dist/components/richtext/popup/RichtextPopupLinkEdit.vue +0 -74
- package/dist/components/richtext/tiptap/image-align.d.ts +0 -43
- package/dist/components/richtext/tiptap/image-align.mjs +0 -60
- package/dist/components/ringbar/Ringbar.vue +0 -158
- package/dist/components/ringbar/index.d.ts +0 -1
- package/dist/components/ringbar/index.mjs +0 -0
- package/dist/components/select/Select.vue +0 -576
- package/dist/components/select/SelectInput.vue +0 -123
- package/dist/components/select/SelectTags.vue +0 -58
- package/dist/components/select/adapter/adapter.d.ts +0 -17
- package/dist/components/select/adapter/adapter.mjs +0 -20
- package/dist/components/select/adapter/async-adapter.d.ts +0 -17
- package/dist/components/select/adapter/async-adapter.mjs +0 -61
- package/dist/components/select/adapter/basic-adapter.d.ts +0 -5
- package/dist/components/select/adapter/basic-adapter.mjs +0 -13
- package/dist/components/select/adapter/fuzzy-adapter.d.ts +0 -2
- package/dist/components/select/adapter/fuzzy-adapter.mjs +0 -24
- package/dist/components/select/index.d.ts +0 -15
- package/dist/components/select/index.mjs +0 -20
- package/dist/components/select/utils/use-on-scroll.d.ts +0 -2
- package/dist/components/select/utils/use-on-scroll.mjs +0 -9
- package/dist/components/select/utils/use-on-typing.d.ts +0 -3
- package/dist/components/select/utils/use-on-typing.mjs +0 -8
- package/dist/components/sheet/Sheet.vue +0 -230
- package/dist/components/shimmer/Shimmer.vue +0 -123
- package/dist/components/shimmer/index.d.ts +0 -2
- package/dist/components/shimmer/index.mjs +0 -10
- package/dist/components/sidebar/Sidebar.vue +0 -249
- package/dist/components/sidebar/SidebarBrand.vue +0 -108
- package/dist/components/sidebar/SidebarContent.vue +0 -21
- package/dist/components/sidebar/SidebarContent.vue.d.ts +0 -16
- package/dist/components/sidebar/SidebarNav.vue +0 -260
- package/dist/components/sidebar/index.d.ts +0 -9
- package/dist/components/sidebar/index.mjs +0 -1
- package/dist/components/sidebar-menu/SidebarMenu.vue +0 -123
- package/dist/components/sidebar-menu/SidebarMenuItem.vue +0 -70
- package/dist/components/sidebar-menu/index.d.ts +0 -138
- package/dist/components/sidebar-menu/index.mjs +0 -44
- package/dist/components/signature-draw/SignatureDraw.vue +0 -101
- package/dist/components/signature-draw/SignatureDrawDesktop.vue +0 -165
- package/dist/components/signature-draw/SignatureDrawMobile.vue +0 -244
- package/dist/components/signature-draw/utils/canvas.d.ts +0 -41
- package/dist/components/signature-draw/utils/canvas.mjs +0 -55
- package/dist/components/signature-draw/utils/image.d.ts +0 -7
- package/dist/components/signature-draw/utils/image.mjs +0 -23
- package/dist/components/signature-draw/utils/smooth-line.d.ts +0 -36
- package/dist/components/signature-draw/utils/smooth-line.mjs +0 -56
- package/dist/components/signature-draw/utils/straight-line.d.ts +0 -8
- package/dist/components/signature-draw/utils/straight-line.mjs +0 -24
- package/dist/components/signature-draw/utils/use-draw.d.ts +0 -7
- package/dist/components/signature-draw/utils/use-draw.mjs +0 -29
- package/dist/components/signature-text/SignatureText.vue +0 -138
- package/dist/components/signature-text/utils/formatter.d.ts +0 -2
- package/dist/components/signature-text/utils/formatter.mjs +0 -8
- package/dist/components/signature-text/utils/generate-text.d.ts +0 -8
- package/dist/components/signature-text/utils/generate-text.mjs +0 -28
- package/dist/components/signature-text/utils/load-font.d.ts +0 -1
- package/dist/components/signature-text/utils/load-font.mjs +0 -22
- package/dist/components/spinner/Spinner.vue +0 -156
- package/dist/components/spinner/SpinnerRing.vue +0 -34
- package/dist/components/spinner/SpinnerRinggo.vue +0 -64
- package/dist/components/spread/Spread.vue +0 -52
- package/dist/components/steps/Step.vue +0 -49
- package/dist/components/steps/StepSlider.vue +0 -37
- package/dist/components/steps/StepSlider.vue.d.ts +0 -34
- package/dist/components/steps/Steps.vue +0 -150
- package/dist/components/steps/index.d.ts +0 -30
- package/dist/components/steps/index.mjs +0 -53
- package/dist/components/steps/utils/hook.d.ts +0 -10
- package/dist/components/steps/utils/hook.mjs +0 -35
- package/dist/components/strengthbar/Strengthbar.vue +0 -97
- package/dist/components/subheading/Subheading.vue +0 -148
- package/dist/components/subheading/index.d.ts +0 -1
- package/dist/components/subheading/index.mjs +0 -0
- package/dist/components/table/Table.vue +0 -391
- package/dist/components/table/Table.vue.d.ts +0 -174
- package/dist/components/table/index.d.ts +0 -49
- package/dist/components/table/index.mjs +0 -37
- package/dist/components/table-flex/TableFlex.vue +0 -341
- package/dist/components/table-static/TableStatic.vue +0 -458
- package/dist/components/table-static/TableStaticRoot.vue +0 -42
- package/dist/components/table-static/TableStaticSort.vue +0 -23
- package/dist/components/table-static/index.d.ts +0 -64
- package/dist/components/table-static/index.mjs +0 -24
- package/dist/components/tabs/Tab.vue +0 -34
- package/dist/components/tabs/TabContent.vue +0 -53
- package/dist/components/tabs/TabContent.vue.d.ts +0 -33
- package/dist/components/tabs/Tabs.vue +0 -234
- package/dist/components/text/Text.vue +0 -235
- package/dist/components/text/index.d.ts +0 -2
- package/dist/components/text/index.mjs +0 -0
- package/dist/components/textarea/Textarea.vue +0 -188
- package/dist/components/time/Time.vue +0 -257
- package/dist/components/time/TimeItem.vue +0 -117
- package/dist/components/time/index.d.ts +0 -19
- package/dist/components/time/index.mjs +0 -53
- package/dist/components/time/utils/index.d.ts +0 -9
- package/dist/components/time/utils/index.mjs +0 -82
- package/dist/components/timepicker/Timepicker.vue +0 -230
- package/dist/components/toast/Toast.vue +0 -269
- package/dist/components/toast/index.d.ts +0 -50
- package/dist/components/toast/index.mjs +0 -44
- package/dist/components/toggle/Toggle.vue +0 -239
- package/dist/components/tooltip/Tooltip.vue +0 -172
- package/dist/components/tooltip/TooltipContainer.vue +0 -89
- package/dist/components/tooltip/index.d.ts +0 -17
- package/dist/components/tooltip/index.mjs +0 -113
- package/dist/components/tooltip/utils/create-handler.d.ts +0 -9
- package/dist/components/tooltip/utils/create-handler.mjs +0 -16
- package/dist/components/tooltip/utils/on-hover.d.ts +0 -23
- package/dist/components/tooltip/utils/on-hover.mjs +0 -42
- package/dist/components/tooltip/utils/parse-bindings.d.ts +0 -23
- package/dist/components/tooltip/utils/parse-bindings.mjs +0 -47
- package/dist/components/tour/Tour.vue +0 -112
- package/dist/components/tour/TourDialog.vue +0 -207
- package/dist/components/tour/TourHighlight.vue +0 -58
- package/dist/components/tour/core/base.d.ts +0 -59
- package/dist/components/tour/core/base.mjs +0 -69
- package/dist/components/tour/core/step/action.d.ts +0 -15
- package/dist/components/tour/core/step/action.mjs +0 -14
- package/dist/components/tour/core/step/conditional.d.ts +0 -25
- package/dist/components/tour/core/step/conditional.mjs +0 -57
- package/dist/components/tour/core/step/delay.d.ts +0 -8
- package/dist/components/tour/core/step/delay.mjs +0 -9
- package/dist/components/tour/core/step/dialog.d.ts +0 -11
- package/dist/components/tour/core/step/dialog.mjs +0 -25
- package/dist/components/tour/core/step/visit.d.ts +0 -9
- package/dist/components/tour/core/step/visit.mjs +0 -15
- package/dist/components/tour/core/step.d.ts +0 -37
- package/dist/components/tour/core/step.mjs +0 -46
- package/dist/components/tour/core/story.d.ts +0 -130
- package/dist/components/tour/core/story.mjs +0 -166
- package/dist/components/tour/core/tour.d.ts +0 -126
- package/dist/components/tour/core/tour.mjs +0 -196
- package/dist/components/tour/index.d.ts +0 -3
- package/dist/components/tour/index.mjs +0 -4
- package/dist/components/tour/utils/focus.d.ts +0 -1
- package/dist/components/tour/utils/focus.mjs +0 -6
- package/dist/components/tour/utils/is-visible.d.ts +0 -1
- package/dist/components/tour/utils/is-visible.mjs +0 -29
- package/dist/components/tour/utils/wait-element.d.ts +0 -6
- package/dist/components/tour/utils/wait-element.mjs +0 -45
- package/dist/components/truncate/Truncate.vue +0 -75
- package/dist/components/utils/array.d.ts +0 -2
- package/dist/components/utils/array.mjs +0 -19
- package/dist/components/utils/base64.d.ts +0 -8
- package/dist/components/utils/base64.mjs +0 -35
- package/dist/components/utils/color.d.ts +0 -17
- package/dist/components/utils/color.mjs +0 -14
- package/dist/components/utils/date.d.ts +0 -22
- package/dist/components/utils/date.mjs +0 -14
- package/dist/components/utils/value.d.ts +0 -8
- package/dist/components/utils/value.mjs +0 -7
- package/dist/components/utils/vnode.d.ts +0 -15
- package/dist/components/utils/vnode.mjs +0 -18
- package/dist/components/wizard/Wizard.vue +0 -84
- package/dist/components/wizard/WizardBody.vue +0 -50
- package/dist/components/wizard/WizardHeader.vue +0 -38
- package/dist/components/wizard/WizardHeader.vue.d.ts +0 -16
- package/dist/components/wizard/WizardStep.vue +0 -31
- package/dist/core/index.d.ts +0 -43
- package/dist/core/index.mjs +0 -148
- package/dist/directive/index.d.ts +0 -3
- package/dist/directive/index.mjs +0 -12
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -27
- package/dist/runtime/plugins/persona.d.ts +0 -2
- package/dist/runtime/plugins/persona.js +0 -35
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="tagName"
|
|
4
|
-
data-testid="dropdown-item"
|
|
5
|
-
class="dropdown__item"
|
|
6
|
-
:class="classNames"
|
|
7
|
-
:href="href"
|
|
8
|
-
:disabled="disabled"
|
|
9
|
-
@click="handleOnClick">
|
|
10
|
-
<slot>
|
|
11
|
-
{{ text }}
|
|
12
|
-
</slot>
|
|
13
|
-
</component>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script lang="ts" setup>
|
|
17
|
-
import type { PropType } from 'vue-demi'
|
|
18
|
-
import {
|
|
19
|
-
inject,
|
|
20
|
-
computed,
|
|
21
|
-
} from 'vue-demi'
|
|
22
|
-
import { DROPDOWN_CONTEXT } from '.'
|
|
23
|
-
import type { TagVariant } from '../button'
|
|
24
|
-
import type { RouteLocationRaw } from 'vue-router'
|
|
25
|
-
|
|
26
|
-
const props = defineProps({
|
|
27
|
-
text: {
|
|
28
|
-
type : String,
|
|
29
|
-
default: '',
|
|
30
|
-
},
|
|
31
|
-
href: {
|
|
32
|
-
type : [String, Object] as PropType<RouteLocationRaw>,
|
|
33
|
-
default: undefined,
|
|
34
|
-
},
|
|
35
|
-
active: {
|
|
36
|
-
type : Boolean,
|
|
37
|
-
default: false,
|
|
38
|
-
},
|
|
39
|
-
disabled: {
|
|
40
|
-
type : Boolean,
|
|
41
|
-
default: false,
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
const emit = defineEmits<{
|
|
46
|
-
'click': [Event],
|
|
47
|
-
}>()
|
|
48
|
-
|
|
49
|
-
const context = inject(DROPDOWN_CONTEXT, undefined, true)
|
|
50
|
-
|
|
51
|
-
function handleOnClick (event: Event) {
|
|
52
|
-
emit('click', event)
|
|
53
|
-
|
|
54
|
-
if ((context?.close && !event.defaultPrevented) || (event.defaultPrevented && props.href))
|
|
55
|
-
context.close()
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const classNames = computed(() => {
|
|
59
|
-
const result: string[] = ['']
|
|
60
|
-
|
|
61
|
-
if (props.active)
|
|
62
|
-
result.push('dropdown__item--active')
|
|
63
|
-
|
|
64
|
-
return result
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
const tagName = computed(() => {
|
|
68
|
-
let tag: TagVariant = 'button'
|
|
69
|
-
|
|
70
|
-
if (props.href)
|
|
71
|
-
tag = 'a'
|
|
72
|
-
|
|
73
|
-
return tag
|
|
74
|
-
})
|
|
75
|
-
</script>
|
|
76
|
-
|
|
77
|
-
<style lang="postcss">
|
|
78
|
-
.dropdown__item {
|
|
79
|
-
@apply px-4 py-2 block cursor-pointer text-default w-full select-none text-left;
|
|
80
|
-
@apply dark:text-dark-default;
|
|
81
|
-
|
|
82
|
-
&:is(a) {
|
|
83
|
-
@apply no-underline hover:no-underline hover:text-default;
|
|
84
|
-
@apply hover:dark:text-dark-default;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&:hover,
|
|
88
|
-
&:focus-visible {
|
|
89
|
-
@apply bg-default-alpha text-default;
|
|
90
|
-
@apply dark:bg-dark-default-alpha dark:text-dark-default;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&&--active,
|
|
94
|
-
&.selected {
|
|
95
|
-
@apply bg-default-alpha text-default;
|
|
96
|
-
@apply dark:bg-dark-default-alpha cursor-default dark:text-dark-default;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&:disabled {
|
|
100
|
-
@apply opacity-50 pointer-events-none;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
</style>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
data-testid="dropdown-text"
|
|
4
|
-
class="dropdown__item dropdown__item--text">
|
|
5
|
-
<slot />
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
<style lang="postcss">
|
|
9
|
-
.dropdown__item {
|
|
10
|
-
&--text {
|
|
11
|
-
@apply cursor-text text-subtle hover:text-subtle;
|
|
12
|
-
@apply dark:text-dark-subtle dark:hover:text-dark-subtle;
|
|
13
|
-
|
|
14
|
-
&:has(.checkbox, .radio) {
|
|
15
|
-
@apply py-0 px-0;
|
|
16
|
-
|
|
17
|
-
.checkbox,
|
|
18
|
-
.radio {
|
|
19
|
-
@apply py-2 px-4;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&:not(:has(.checkbox, .radio)) {
|
|
24
|
-
@apply hover:bg-transparent;
|
|
25
|
-
@apply dark:hover:bg-transparent;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.checkbox,
|
|
29
|
-
.radio {
|
|
30
|
-
@apply flex;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
</style>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Ref, InjectionKey } from 'vue-demi';
|
|
2
|
-
export type MenuSizeVariant = 'sm' | 'md' | 'lg' | 'xl' | 'auto';
|
|
3
|
-
interface DropdownContext {
|
|
4
|
-
close: () => void;
|
|
5
|
-
open: () => void;
|
|
6
|
-
toggle: () => void;
|
|
7
|
-
isOpen: Ref<boolean>;
|
|
8
|
-
}
|
|
9
|
-
export declare const DROPDOWN_CONTEXT: InjectionKey<DropdownContext>;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DROPDOWN_CONTEXT = Symbol("DROPDOWN_CONTEXT");
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { clamp } from "lodash-es";
|
|
2
|
-
import { focusable } from "tabbable";
|
|
3
|
-
export function useFocus(target, loop = true) {
|
|
4
|
-
function travel(step) {
|
|
5
|
-
const elements = focusable(target.value);
|
|
6
|
-
const index = elements.indexOf(document.activeElement);
|
|
7
|
-
const nextIndex = loop ? (index + step) % elements.length : clamp(index + step, 0, elements.length - 1);
|
|
8
|
-
const targetFocus = elements.at(nextIndex);
|
|
9
|
-
if (targetFocus !== void 0)
|
|
10
|
-
targetFocus.focus();
|
|
11
|
-
}
|
|
12
|
-
function next() {
|
|
13
|
-
travel(1);
|
|
14
|
-
}
|
|
15
|
-
function prev() {
|
|
16
|
-
travel(-1);
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
next,
|
|
20
|
-
prev
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Transition
|
|
3
|
-
:name="transition"
|
|
4
|
-
mode="out-in">
|
|
5
|
-
<div
|
|
6
|
-
:key="tree._level"
|
|
7
|
-
data-testid="dropdown-subitem"
|
|
8
|
-
class="dropdown__subitem">
|
|
9
|
-
<template
|
|
10
|
-
v-if="canBack">
|
|
11
|
-
<DropdownItem
|
|
12
|
-
key="btn-back"
|
|
13
|
-
data-testid="dropdown-back"
|
|
14
|
-
class="dropdown__subitem__btn dropdown__subitem__btn--back"
|
|
15
|
-
@click.prevent="back()">
|
|
16
|
-
<slot name="button-back">
|
|
17
|
-
<IconBack class="dropdown__subitem__next" />
|
|
18
|
-
<div class="dropdown__group-content" />
|
|
19
|
-
</slot>
|
|
20
|
-
</DropdownItem>
|
|
21
|
-
</template>
|
|
22
|
-
|
|
23
|
-
<template v-if="!isRoot">
|
|
24
|
-
<DropdownItem
|
|
25
|
-
key="btn-next"
|
|
26
|
-
class="dropdown__subitem__btn"
|
|
27
|
-
@click.prevent="handleOnClick">
|
|
28
|
-
<div class="dropdown__subitem__content">
|
|
29
|
-
<slot
|
|
30
|
-
name="button-content"
|
|
31
|
-
:next="next"
|
|
32
|
-
:back="back">
|
|
33
|
-
{{ text }}
|
|
34
|
-
</slot>
|
|
35
|
-
</div>
|
|
36
|
-
<IconNext
|
|
37
|
-
v-if="!noCaret"
|
|
38
|
-
data-testid="dropdown-subitem-next"
|
|
39
|
-
class="dropdown__subitem__next" />
|
|
40
|
-
</DropdownItem>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<template v-else>
|
|
44
|
-
<component
|
|
45
|
-
:is="view" />
|
|
46
|
-
</template>
|
|
47
|
-
</div>
|
|
48
|
-
</Transition>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script lang="ts" setup>
|
|
52
|
-
import DropdownItem from '../dropdown/DropdownItem.vue'
|
|
53
|
-
import IconNext from '@privyid/persona-icon/vue/chevron-right/16.vue'
|
|
54
|
-
import IconBack from '@privyid/persona-icon/vue/arrow-left/16.vue'
|
|
55
|
-
import type { VNode } from 'vue-demi'
|
|
56
|
-
import {
|
|
57
|
-
inject,
|
|
58
|
-
provide,
|
|
59
|
-
ref,
|
|
60
|
-
shallowRef,
|
|
61
|
-
computed,
|
|
62
|
-
watch,
|
|
63
|
-
} from 'vue-demi'
|
|
64
|
-
import type { DropdownContext } from '.'
|
|
65
|
-
import { DROPDOWN_TREE } from '.'
|
|
66
|
-
|
|
67
|
-
defineProps({
|
|
68
|
-
text: {
|
|
69
|
-
type : String,
|
|
70
|
-
default: '',
|
|
71
|
-
},
|
|
72
|
-
noCaret: {
|
|
73
|
-
type : Boolean,
|
|
74
|
-
default: false,
|
|
75
|
-
},
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
const slots = defineSlots<{
|
|
79
|
-
'button-back'(): VNode[],
|
|
80
|
-
'button-content'(props: {
|
|
81
|
-
next: () => void,
|
|
82
|
-
back: () => void,
|
|
83
|
-
}): VNode[],
|
|
84
|
-
}>()
|
|
85
|
-
|
|
86
|
-
const emit = defineEmits<{
|
|
87
|
-
'click': [MouseEvent],
|
|
88
|
-
}>()
|
|
89
|
-
|
|
90
|
-
const context = inject(DROPDOWN_TREE, undefined, true)
|
|
91
|
-
const transition = ref<'slide-left' | 'slide-right' | 'none'>('slide-left')
|
|
92
|
-
|
|
93
|
-
const isRoot = computed(() => {
|
|
94
|
-
return context === undefined
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
const tree: DropdownContext['tree'] = context?.tree ?? shallowRef({
|
|
98
|
-
_level: 0,
|
|
99
|
-
slots : slots,
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
const next: DropdownContext['next'] = () => {
|
|
103
|
-
tree.value = {
|
|
104
|
-
_level: tree.value._level + 1,
|
|
105
|
-
prev : tree.value,
|
|
106
|
-
slots : slots,
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const back: DropdownContext['back'] = () => {
|
|
111
|
-
if (tree.value.prev)
|
|
112
|
-
tree.value = tree.value.prev
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const view = computed(() => {
|
|
116
|
-
return tree.value.slots.default
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
const canBack = computed(() => {
|
|
120
|
-
return Boolean(isRoot.value && tree.value.prev)
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
watch(tree, (value, oldValue) => {
|
|
124
|
-
transition.value = value._level > oldValue._level
|
|
125
|
-
? 'slide-left'
|
|
126
|
-
: 'slide-right'
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
if (isRoot.value) {
|
|
130
|
-
provide(DROPDOWN_TREE, {
|
|
131
|
-
tree,
|
|
132
|
-
next,
|
|
133
|
-
back,
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function reset () {
|
|
138
|
-
if (isRoot.value) {
|
|
139
|
-
tree.value = {
|
|
140
|
-
prev : undefined,
|
|
141
|
-
_level: 0,
|
|
142
|
-
slots : slots,
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function handleOnClick () {
|
|
148
|
-
const event = new MouseEvent('click')
|
|
149
|
-
|
|
150
|
-
emit('click', event)
|
|
151
|
-
|
|
152
|
-
if (!event.defaultPrevented)
|
|
153
|
-
next()
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
defineExpose({
|
|
157
|
-
reset,
|
|
158
|
-
next,
|
|
159
|
-
back,
|
|
160
|
-
})
|
|
161
|
-
</script>
|
|
162
|
-
|
|
163
|
-
<style lang="postcss">
|
|
164
|
-
.dropdown__subitem {
|
|
165
|
-
&__btn {
|
|
166
|
-
@apply flex items-center space-x-1;
|
|
167
|
-
|
|
168
|
-
&--back {
|
|
169
|
-
@apply shrink-0;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
&__content {
|
|
174
|
-
@apply grow;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&__next,
|
|
178
|
-
&__back {
|
|
179
|
-
@apply shrink-0;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
</style>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { InjectionKey, ShallowRef, Slots } from 'vue-demi';
|
|
2
|
-
export interface DropdownNode {
|
|
3
|
-
_level: number;
|
|
4
|
-
prev?: DropdownNode;
|
|
5
|
-
slots: Slots;
|
|
6
|
-
}
|
|
7
|
-
export interface DropdownContext {
|
|
8
|
-
tree: ShallowRef<DropdownNode>;
|
|
9
|
-
next: () => void;
|
|
10
|
-
back: () => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const DROPDOWN_TREE: InjectionKey<DropdownContext>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const DROPDOWN_TREE = Symbol("DropdownTree");
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<label
|
|
3
|
-
class="dropzone"
|
|
4
|
-
:class="[classNames, containerClass]"
|
|
5
|
-
data-testid="dropzone"
|
|
6
|
-
@drop.prevent="onDrop"
|
|
7
|
-
@dragover.prevent
|
|
8
|
-
@dragenter.prevent="isDragover = true"
|
|
9
|
-
@dragleave.prevent="isDragover = false"
|
|
10
|
-
@mouseover="isHovered = true"
|
|
11
|
-
@mouseout="isHovered = false">
|
|
12
|
-
<input
|
|
13
|
-
ref="input"
|
|
14
|
-
data-testid="dropzone-input"
|
|
15
|
-
class="dropzone__input"
|
|
16
|
-
type="file"
|
|
17
|
-
:multiple="multiple !== false"
|
|
18
|
-
:accept="accept"
|
|
19
|
-
:disabled="(disabled || readonly)"
|
|
20
|
-
v-bind="$attrs"
|
|
21
|
-
@change="onChange">
|
|
22
|
-
<slot
|
|
23
|
-
:is-dragover="isDragover"
|
|
24
|
-
:is-hovered="isHovered"
|
|
25
|
-
:disabled="disabled"
|
|
26
|
-
:readonly="readonly"
|
|
27
|
-
:model="model"
|
|
28
|
-
:raw-model="rawModel"
|
|
29
|
-
:browse="browse"
|
|
30
|
-
:clear="clear" />
|
|
31
|
-
</label>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script lang="ts" setup>
|
|
35
|
-
import acceptFile from './utils/accept'
|
|
36
|
-
import type { PropType, VNode } from 'vue-demi'
|
|
37
|
-
import {
|
|
38
|
-
computed,
|
|
39
|
-
nextTick,
|
|
40
|
-
ref,
|
|
41
|
-
toRef,
|
|
42
|
-
} from 'vue-demi'
|
|
43
|
-
import { useVModel } from '../input'
|
|
44
|
-
import { toBase64 } from '../utils/base64'
|
|
45
|
-
import { useToNumber } from '@vueuse/shared'
|
|
46
|
-
import { watchIgnorable } from '@vueuse/core'
|
|
47
|
-
import type { ModelModifier, MultipleType } from '.'
|
|
48
|
-
|
|
49
|
-
defineOptions({ inheritAttrs: false })
|
|
50
|
-
|
|
51
|
-
const props = defineProps({
|
|
52
|
-
modelValue: {
|
|
53
|
-
type: [
|
|
54
|
-
globalThis.File,
|
|
55
|
-
Array,
|
|
56
|
-
String,
|
|
57
|
-
] as PropType<globalThis.File | globalThis.File[] | string | string[]>,
|
|
58
|
-
default: undefined,
|
|
59
|
-
},
|
|
60
|
-
modelModifiers: {
|
|
61
|
-
type : Object as PropType<ModelModifier>,
|
|
62
|
-
default: () => ({} as ModelModifier),
|
|
63
|
-
},
|
|
64
|
-
multiple: {
|
|
65
|
-
type : [Boolean, String] as PropType<boolean | MultipleType>,
|
|
66
|
-
default: false,
|
|
67
|
-
},
|
|
68
|
-
maxlength: {
|
|
69
|
-
type : [Number, String],
|
|
70
|
-
default: undefined,
|
|
71
|
-
},
|
|
72
|
-
accept: {
|
|
73
|
-
type : String,
|
|
74
|
-
default: '',
|
|
75
|
-
},
|
|
76
|
-
clearOnCancel: {
|
|
77
|
-
type : Boolean,
|
|
78
|
-
default: false,
|
|
79
|
-
},
|
|
80
|
-
disabled: {
|
|
81
|
-
type : Boolean,
|
|
82
|
-
default: false,
|
|
83
|
-
},
|
|
84
|
-
readonly: {
|
|
85
|
-
type : Boolean,
|
|
86
|
-
default: false,
|
|
87
|
-
},
|
|
88
|
-
containerClass: {
|
|
89
|
-
type: [
|
|
90
|
-
String,
|
|
91
|
-
Array,
|
|
92
|
-
Object,
|
|
93
|
-
],
|
|
94
|
-
default: undefined,
|
|
95
|
-
},
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
const emit = defineEmits<{
|
|
99
|
-
'update:modelValue': [unknown],
|
|
100
|
-
'change': [unknown],
|
|
101
|
-
'cancel': [],
|
|
102
|
-
}>()
|
|
103
|
-
|
|
104
|
-
const model = useVModel(props)
|
|
105
|
-
const rawModel = ref<globalThis.File | globalThis.File[]>()
|
|
106
|
-
const input = ref<HTMLInputElement>()
|
|
107
|
-
const maxlength = useToNumber(toRef(props, 'maxlength'), { method: 'parseInt' })
|
|
108
|
-
|
|
109
|
-
const isDragover = ref(false)
|
|
110
|
-
const isHovered = ref(false)
|
|
111
|
-
|
|
112
|
-
const classNames = computed(() => {
|
|
113
|
-
const result: string[] = []
|
|
114
|
-
|
|
115
|
-
if (isDragover.value)
|
|
116
|
-
result.push('dropzone--dragover')
|
|
117
|
-
|
|
118
|
-
if (isHovered.value)
|
|
119
|
-
result.push('dropzone--hover')
|
|
120
|
-
|
|
121
|
-
if (props.disabled)
|
|
122
|
-
result.push('dropzone--disabled')
|
|
123
|
-
|
|
124
|
-
if (props.readonly)
|
|
125
|
-
result.push('dropzone--readonly')
|
|
126
|
-
|
|
127
|
-
return result
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
const { ignoreUpdates } = watchIgnorable(() => props.modelValue, (value) => {
|
|
131
|
-
if (value) {
|
|
132
|
-
if (Array.isArray(value))
|
|
133
|
-
rawModel.value = value.filter((item) => item instanceof globalThis.File)
|
|
134
|
-
else {
|
|
135
|
-
if (value instanceof globalThis.File)
|
|
136
|
-
rawModel.value = value
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}, { immediate: true })
|
|
140
|
-
|
|
141
|
-
function browse () {
|
|
142
|
-
input.value.value = ''
|
|
143
|
-
input.value.click()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function clear () {
|
|
147
|
-
input.value.value = ''
|
|
148
|
-
rawModel.value = undefined
|
|
149
|
-
model.value = undefined
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function onDrop (event: DragEvent) {
|
|
153
|
-
if (!props.disabled && !props.readonly) {
|
|
154
|
-
const files = event.dataTransfer.files
|
|
155
|
-
|
|
156
|
-
isDragover.value = false
|
|
157
|
-
|
|
158
|
-
handleFiles(files)
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function onChange (event: Event) {
|
|
163
|
-
const target = event.target as HTMLInputElement
|
|
164
|
-
const files = target.files
|
|
165
|
-
|
|
166
|
-
handleFiles(files)
|
|
167
|
-
|
|
168
|
-
if (props.multiple === 'append') {
|
|
169
|
-
/* Issue with multiselect with same file(s), need to be reset */
|
|
170
|
-
nextTick(() => {
|
|
171
|
-
target.value = ''
|
|
172
|
-
})
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function filesToBase64 (files: globalThis.File | globalThis.File[]): Promise<string | string[]> {
|
|
177
|
-
if (Array.isArray(files))
|
|
178
|
-
return Promise.all(files.map((file) => toBase64(file)))
|
|
179
|
-
|
|
180
|
-
return toBase64(files)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
async function handleFiles (fileList: globalThis.FileList) {
|
|
184
|
-
if (fileList.length > 0) {
|
|
185
|
-
// eslint-disable-next-line unicorn/prefer-spread
|
|
186
|
-
const files = acceptFile(props.accept, Array.from(fileList))
|
|
187
|
-
const file = props.multiple === false ? files.at(0) : files
|
|
188
|
-
|
|
189
|
-
let value: typeof props.modelValue = file
|
|
190
|
-
|
|
191
|
-
// multiple="append"
|
|
192
|
-
if (props.multiple === 'append' && Array.isArray(model.value))
|
|
193
|
-
value = [...model.value as globalThis.File[], ...value as globalThis.File[]]
|
|
194
|
-
|
|
195
|
-
// maxlength
|
|
196
|
-
if (Number.isInteger(maxlength.value) && Array.isArray(value))
|
|
197
|
-
value = value.slice(0, maxlength.value)
|
|
198
|
-
|
|
199
|
-
// keep original value before converting base64
|
|
200
|
-
rawModel.value = value
|
|
201
|
-
|
|
202
|
-
// v-model.base64
|
|
203
|
-
if (props.modelModifiers.base64)
|
|
204
|
-
value = await filesToBase64(file)
|
|
205
|
-
|
|
206
|
-
ignoreUpdates(() => {
|
|
207
|
-
model.value = value
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
emit('change', value)
|
|
211
|
-
} else {
|
|
212
|
-
if (props.clearOnCancel)
|
|
213
|
-
clear()
|
|
214
|
-
|
|
215
|
-
emit('cancel')
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
defineExpose({
|
|
220
|
-
browse,
|
|
221
|
-
clear,
|
|
222
|
-
input,
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
defineSlots<{
|
|
226
|
-
'default'(props: {
|
|
227
|
-
isDragover: boolean,
|
|
228
|
-
isHovered: boolean,
|
|
229
|
-
disabled: boolean,
|
|
230
|
-
readonly: boolean,
|
|
231
|
-
model: unknown,
|
|
232
|
-
rawModel: File | File[],
|
|
233
|
-
browse: () => void,
|
|
234
|
-
clear: () => void,
|
|
235
|
-
}): VNode[],
|
|
236
|
-
}>()
|
|
237
|
-
</script>
|
|
238
|
-
|
|
239
|
-
<style lang="postcss">
|
|
240
|
-
.dropzone {
|
|
241
|
-
@apply cursor-pointer block w-full relative;
|
|
242
|
-
|
|
243
|
-
&__input {
|
|
244
|
-
@apply absolute w-[.1px] h-[.1px] opacity-0 overflow-hidden -z-1 bottom-0 right-0;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
* {
|
|
248
|
-
@apply pointer-events-none;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
&:disabled,
|
|
252
|
-
&--disabled {
|
|
253
|
-
@apply pointer-events-none;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
a,
|
|
257
|
-
button {
|
|
258
|
-
@apply pointer-events-auto;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
</style>
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function attrAccept(accept: string, files: globalThis.File[]): globalThis.File[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default function attrAccept(accept, files) {
|
|
2
|
-
if (!accept)
|
|
3
|
-
return files;
|
|
4
|
-
return files.filter((file) => {
|
|
5
|
-
const fileName = String(file.name).toLowerCase();
|
|
6
|
-
const mimeType = String(file.type).toLowerCase();
|
|
7
|
-
const acceptedTypes = accept.split(",");
|
|
8
|
-
return acceptedTypes.some((type) => {
|
|
9
|
-
const validType = type.trim().toLowerCase();
|
|
10
|
-
if (validType.charAt(0) === ".")
|
|
11
|
-
return fileName.endsWith(validType);
|
|
12
|
-
if (validType.endsWith("/*"))
|
|
13
|
-
return mimeType.replace(/\/.*$/, "") === validType.replace(/\/.*$/, "");
|
|
14
|
-
return mimeType === validType;
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
}
|