@firstnoodle-ui/bui 0.0.13
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/LICENSE +21 -0
- package/dist/bui.css +1 -0
- package/dist/components/application-wrapper/ApplicationWrapper.vue.d.ts +17 -0
- package/dist/components/application-wrapper/index.d.ts +1 -0
- package/dist/components/aside-section-label/AsideSectionLabel.vue.d.ts +5 -0
- package/dist/components/aside-section-label/index.d.ts +1 -0
- package/dist/components/button/Button.vue.d.ts +52 -0
- package/dist/components/button/NotificationBadge.vue.d.ts +5 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/button-group/ButtonGroup.vue.d.ts +29 -0
- package/dist/components/button-group/index.d.ts +1 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +18 -0
- package/dist/components/checkbox/CircleIndicator.vue.d.ts +6 -0
- package/dist/components/checkbox/DefaultIndicator.vue.d.ts +6 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/collapse/Collapse.vue.d.ts +50 -0
- package/dist/components/collapse/index.d.ts +1 -0
- package/dist/components/confirm-cancel/ConfirmCancel.vue.d.ts +36 -0
- package/dist/components/confirm-cancel/index.d.ts +1 -0
- package/dist/components/data-point/DataPoint.vue.d.ts +2 -0
- package/dist/components/data-point/index.d.ts +1 -0
- package/dist/components/dialog/Dialog.vue.d.ts +128 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/fade-in-up/FadeInUp.vue.d.ts +21 -0
- package/dist/components/fade-in-up/index.d.ts +1 -0
- package/dist/components/first-paint/FirstPaint.vue.d.ts +20 -0
- package/dist/components/first-paint/index.d.ts +1 -0
- package/dist/components/flexbox/Flexbox.vue.d.ts +31 -0
- package/dist/components/flexbox/index.d.ts +1 -0
- package/dist/components/horizontal-layout/Aside.vue.d.ts +48 -0
- package/dist/components/horizontal-layout/HorizontalLayout.vue.d.ts +48 -0
- package/dist/components/horizontal-layout/index.d.ts +2 -0
- package/dist/components/icon/Icon.vue.d.ts +6 -0
- package/dist/components/icon/index.d.ts +1 -0
- package/dist/components/index.d.ts +38 -0
- package/dist/components/input/Input.vue.d.ts +26 -0
- package/dist/components/input/index.d.ts +1 -0
- package/dist/components/load-spinner/LoadSpinner.vue.d.ts +2 -0
- package/dist/components/load-spinner/index.d.ts +1 -0
- package/dist/components/modal/Modal.vue.d.ts +135 -0
- package/dist/components/modal/index.d.ts +1 -0
- package/dist/components/nav-item/NavItem.vue.d.ts +43 -0
- package/dist/components/nav-item/index.d.ts +1 -0
- package/dist/components/notification/Notification.vue.d.ts +14 -0
- package/dist/components/notification/index.d.ts +1 -0
- package/dist/components/pagination/Pagination.vue.d.ts +13 -0
- package/dist/components/pagination/index.d.ts +1 -0
- package/dist/components/pill/Pill.vue.d.ts +32 -0
- package/dist/components/pill/index.d.ts +2 -0
- package/dist/components/pill/pill-types.d.ts +2 -0
- package/dist/components/pop-confirm/PopConfirm.vue.d.ts +357 -0
- package/dist/components/pop-confirm/index.d.ts +1 -0
- package/dist/components/pop-select/FooterButton.vue.d.ts +2 -0
- package/dist/components/pop-select/PopSelect.vue.d.ts +51 -0
- package/dist/components/pop-select/ResultFilters.vue.d.ts +20 -0
- package/dist/components/pop-select/enums.d.ts +7 -0
- package/dist/components/pop-select/index.d.ts +2 -0
- package/dist/components/pop-select/option.vue.d.ts +39 -0
- package/dist/components/popper/Popper.vue.d.ts +79 -0
- package/dist/components/popper/PopperContent.vue.d.ts +17 -0
- package/dist/components/popper/index.d.ts +2 -0
- package/dist/components/popper/middleware.d.ts +10 -0
- package/dist/components/screen-overlay/ScreenOverlay.vue.d.ts +31 -0
- package/dist/components/screen-overlay/index.d.ts +1 -0
- package/dist/components/scrollbar/Bar.vue.d.ts +19 -0
- package/dist/components/scrollbar/ScrollBottomLoader.vue.d.ts +25 -0
- package/dist/components/scrollbar/Scrollbar.vue.d.ts +62 -0
- package/dist/components/scrollbar/enums.d.ts +3 -0
- package/dist/components/scrollbar/index.d.ts +2 -0
- package/dist/components/scrollbar/scrollbarWidth.d.ts +1 -0
- package/dist/components/scrollbar/types.d.ts +27 -0
- package/dist/components/side-over/SideOver.vue.d.ts +43 -0
- package/dist/components/side-over/index.d.ts +1 -0
- package/dist/components/status-select/StatusSelect.vue.d.ts +2 -0
- package/dist/components/status-select/index.d.ts +1 -0
- package/dist/components/switch/Switch.vue.d.ts +17 -0
- package/dist/components/switch/index.d.ts +1 -0
- package/dist/components/tab/Tab.vue.d.ts +22 -0
- package/dist/components/tab/index.d.ts +1 -0
- package/dist/components/tag/Tag.vue.d.ts +29 -0
- package/dist/components/tag/index.d.ts +1 -0
- package/dist/components/text-editor/TextEditor.vue.d.ts +79 -0
- package/dist/components/text-editor/components/Dialog.vue.d.ts +17 -0
- package/dist/components/text-editor/components/FormattingButton.vue.d.ts +19 -0
- package/dist/components/text-editor/components/InsertLinkDialog.vue.d.ts +57 -0
- package/dist/components/text-editor/components/InsertTextDialog.vue.d.ts +54 -0
- package/dist/components/text-editor/components/index.d.ts +3 -0
- package/dist/components/text-editor/index.d.ts +1 -0
- package/dist/components/text-highlight/TextHighlight.vue.d.ts +16 -0
- package/dist/components/text-highlight/index.d.ts +1 -0
- package/dist/components/text-viewer/TextViewer.vue.d.ts +17 -0
- package/dist/components/text-viewer/index.d.ts +1 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +42 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/types.d.ts +64 -0
- package/dist/components/vertical-layout/RunningSection.vue.d.ts +31 -0
- package/dist/components/vertical-layout/VerticalLayout.vue.d.ts +32 -0
- package/dist/components/vertical-layout/index.d.ts +3 -0
- package/dist/components/vertical-layout/types.d.ts +2 -0
- package/dist/components/window-frame/WindowFrame.vue.d.ts +21 -0
- package/dist/components/window-frame/index.d.ts +1 -0
- package/dist/composables/index.d.ts +5 -0
- package/dist/composables/useClickOutside.d.ts +5 -0
- package/dist/composables/useEscapeKey.d.ts +1 -0
- package/dist/composables/useMounted.d.ts +3 -0
- package/dist/composables/useNextFrame.d.ts +3 -0
- package/dist/composables/useTrapFocus.d.ts +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +20754 -0
- package/dist/utils/array.d.ts +5 -0
- package/dist/utils/clamp.d.ts +1 -0
- package/dist/utils/debounce.d.ts +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/scrollIntoView.d.ts +1 -0
- package/dist/utils/scrollbarWidth.d.ts +1 -0
- package/package.json +65 -0
- package/src/components/application-wrapper/ApplicationWrapper.vue +8 -0
- package/src/components/application-wrapper/index.ts +1 -0
- package/src/components/aside-section-label/AsideSectionLabel.vue +16 -0
- package/src/components/aside-section-label/index.ts +1 -0
- package/src/components/button/Button.vue +245 -0
- package/src/components/button/NotificationBadge.vue +15 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button-group/ButtonGroup.vue +97 -0
- package/src/components/button-group/index.ts +1 -0
- package/src/components/checkbox/Checkbox.vue +52 -0
- package/src/components/checkbox/CircleIndicator.vue +27 -0
- package/src/components/checkbox/DefaultIndicator.vue +22 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/collapse/Collapse.vue +120 -0
- package/src/components/collapse/index.ts +1 -0
- package/src/components/confirm-cancel/ConfirmCancel.vue +79 -0
- package/src/components/confirm-cancel/index.ts +1 -0
- package/src/components/data-point/DataPoint.vue +5 -0
- package/src/components/data-point/index.ts +1 -0
- package/src/components/dialog/Dialog.vue +70 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/fade-in-up/FadeInUp.vue +17 -0
- package/src/components/fade-in-up/index.ts +1 -0
- package/src/components/first-paint/FirstPaint.vue +21 -0
- package/src/components/first-paint/index.ts +1 -0
- package/src/components/first-paint/style.scss +23 -0
- package/src/components/flexbox/Flexbox.vue +50 -0
- package/src/components/flexbox/index.ts +1 -0
- package/src/components/horizontal-layout/Aside.vue +113 -0
- package/src/components/horizontal-layout/HorizontalLayout.vue +118 -0
- package/src/components/horizontal-layout/index.ts +2 -0
- package/src/components/icon/Icon.vue +1159 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/icon/utils/combine-svgs.cjs +55 -0
- package/src/components/icon/utils/combined-svgs.txt +1150 -0
- package/src/components/icon/utils/svgs/admin.svg +16 -0
- package/src/components/icon/utils/svgs/arrow-deviate.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-down-plus.svg +4 -0
- package/src/components/icon/utils/svgs/arrow-down.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-from.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-left.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-move.svg +15 -0
- package/src/components/icon/utils/svgs/arrow-right.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-sub.svg +3 -0
- package/src/components/icon/utils/svgs/arrow-trend.svg +15 -0
- package/src/components/icon/utils/svgs/arrow-up-plus.svg +4 -0
- package/src/components/icon/utils/svgs/arrow-up.svg +3 -0
- package/src/components/icon/utils/svgs/authority.svg +5 -0
- package/src/components/icon/utils/svgs/beams.svg +5 -0
- package/src/components/icon/utils/svgs/bell.svg +15 -0
- package/src/components/icon/utils/svgs/bold.svg +3 -0
- package/src/components/icon/utils/svgs/box.svg +5 -0
- package/src/components/icon/utils/svgs/building.svg +15 -0
- package/src/components/icon/utils/svgs/bullet-list.svg +8 -0
- package/src/components/icon/utils/svgs/calendar.svg +21 -0
- package/src/components/icon/utils/svgs/camera.svg +5 -0
- package/src/components/icon/utils/svgs/categories.svg +3 -0
- package/src/components/icon/utils/svgs/check-circled.svg +16 -0
- package/src/components/icon/utils/svgs/check-outline.svg +15 -0
- package/src/components/icon/utils/svgs/check.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-down.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-left-double.svg +4 -0
- package/src/components/icon/utils/svgs/chevron-left.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-right-double.svg +4 -0
- package/src/components/icon/utils/svgs/chevron-right.svg +3 -0
- package/src/components/icon/utils/svgs/chevron-up.svg +3 -0
- package/src/components/icon/utils/svgs/clock.svg +4 -0
- package/src/components/icon/utils/svgs/close-outline.svg +3 -0
- package/src/components/icon/utils/svgs/close.svg +3 -0
- package/src/components/icon/utils/svgs/columns.svg +3 -0
- package/src/components/icon/utils/svgs/conclusion.svg +17 -0
- package/src/components/icon/utils/svgs/copy.svg +16 -0
- package/src/components/icon/utils/svgs/crosshair.svg +15 -0
- package/src/components/icon/utils/svgs/dash.svg +3 -0
- package/src/components/icon/utils/svgs/dashboard.svg +3 -0
- package/src/components/icon/utils/svgs/delete.svg +4 -0
- package/src/components/icon/utils/svgs/delta.svg +3 -0
- package/src/components/icon/utils/svgs/download.svg +3 -0
- package/src/components/icon/utils/svgs/drag.svg +8 -0
- package/src/components/icon/utils/svgs/drilldown.svg +8 -0
- package/src/components/icon/utils/svgs/edit.svg +16 -0
- package/src/components/icon/utils/svgs/envelope.svg +3 -0
- package/src/components/icon/utils/svgs/error.svg +3 -0
- package/src/components/icon/utils/svgs/export-document.svg +16 -0
- package/src/components/icon/utils/svgs/filter.svg +6 -0
- package/src/components/icon/utils/svgs/filters.svg +4 -0
- package/src/components/icon/utils/svgs/flag.svg +3 -0
- package/src/components/icon/utils/svgs/folder.svg +15 -0
- package/src/components/icon/utils/svgs/frequency.svg +3 -0
- package/src/components/icon/utils/svgs/fullscreen-off.svg +3 -0
- package/src/components/icon/utils/svgs/fullscreen-on.svg +3 -0
- package/src/components/icon/utils/svgs/graduate.svg +3 -0
- package/src/components/icon/utils/svgs/hamburger.svg +5 -0
- package/src/components/icon/utils/svgs/handshake.svg +15 -0
- package/src/components/icon/utils/svgs/heading-1.svg +4 -0
- package/src/components/icon/utils/svgs/heading-2.svg +4 -0
- package/src/components/icon/utils/svgs/heading.svg +3 -0
- package/src/components/icon/utils/svgs/home.svg +3 -0
- package/src/components/icon/utils/svgs/id-card.svg +6 -0
- package/src/components/icon/utils/svgs/id.svg +4 -0
- package/src/components/icon/utils/svgs/indent-left.svg +7 -0
- package/src/components/icon/utils/svgs/indent-right.svg +7 -0
- package/src/components/icon/utils/svgs/information.svg +17 -0
- package/src/components/icon/utils/svgs/italics.svg +3 -0
- package/src/components/icon/utils/svgs/itenary.svg +11 -0
- package/src/components/icon/utils/svgs/keyboard.svg +11 -0
- package/src/components/icon/utils/svgs/lightning.svg +15 -0
- package/src/components/icon/utils/svgs/link.svg +4 -0
- package/src/components/icon/utils/svgs/list-collapse.svg +6 -0
- package/src/components/icon/utils/svgs/list-expand.svg +6 -0
- package/src/components/icon/utils/svgs/location.svg +4 -0
- package/src/components/icon/utils/svgs/lock-locked.svg +4 -0
- package/src/components/icon/utils/svgs/lock-unlocked.svg +4 -0
- package/src/components/icon/utils/svgs/magnifying-glass.svg +15 -0
- package/src/components/icon/utils/svgs/map.svg +3 -0
- package/src/components/icon/utils/svgs/megaphone.svg +3 -0
- package/src/components/icon/utils/svgs/message.svg +15 -0
- package/src/components/icon/utils/svgs/microscope.svg +3 -0
- package/src/components/icon/utils/svgs/moon.svg +3 -0
- package/src/components/icon/utils/svgs/new-document.svg +4 -0
- package/src/components/icon/utils/svgs/news.svg +15 -0
- package/src/components/icon/utils/svgs/numbered-list.svg +7 -0
- package/src/components/icon/utils/svgs/open-link.svg +16 -0
- package/src/components/icon/utils/svgs/options.svg +5 -0
- package/src/components/icon/utils/svgs/page.svg +7 -0
- package/src/components/icon/utils/svgs/paper-plane.svg +15 -0
- package/src/components/icon/utils/svgs/paper.svg +3 -0
- package/src/components/icon/utils/svgs/pen-and-paper.svg +4 -0
- package/src/components/icon/utils/svgs/phase.svg +15 -0
- package/src/components/icon/utils/svgs/photo.svg +4 -0
- package/src/components/icon/utils/svgs/pie-chart.svg +3 -0
- package/src/components/icon/utils/svgs/plus.svg +3 -0
- package/src/components/icon/utils/svgs/point-left.svg +3 -0
- package/src/components/icon/utils/svgs/point-up.svg +3 -0
- package/src/components/icon/utils/svgs/popup.svg +16 -0
- package/src/components/icon/utils/svgs/question.svg +17 -0
- package/src/components/icon/utils/svgs/radio-tower.svg +3 -0
- package/src/components/icon/utils/svgs/recycle.svg +3 -0
- package/src/components/icon/utils/svgs/redo.svg +3 -0
- package/src/components/icon/utils/svgs/refresh.svg +3 -0
- package/src/components/icon/utils/svgs/route.svg +3 -0
- package/src/components/icon/utils/svgs/rows.svg +3 -0
- package/src/components/icon/utils/svgs/scope.svg +7 -0
- package/src/components/icon/utils/svgs/settings.svg +16 -0
- package/src/components/icon/utils/svgs/share.svg +11 -0
- package/src/components/icon/utils/svgs/sign-in.svg +4 -0
- package/src/components/icon/utils/svgs/sign-up.svg +3 -0
- package/src/components/icon/utils/svgs/sort-down.svg +20 -0
- package/src/components/icon/utils/svgs/sort-up.svg +20 -0
- package/src/components/icon/utils/svgs/sort.svg +7 -0
- package/src/components/icon/utils/svgs/square-solid.svg +3 -0
- package/src/components/icon/utils/svgs/star-solid.svg +15 -0
- package/src/components/icon/utils/svgs/star.svg +15 -0
- package/src/components/icon/utils/svgs/stop-watch.svg +5 -0
- package/src/components/icon/utils/svgs/structure.svg +3 -0
- package/src/components/icon/utils/svgs/sun.svg +23 -0
- package/src/components/icon/utils/svgs/table.svg +3 -0
- package/src/components/icon/utils/svgs/tag.svg +15 -0
- package/src/components/icon/utils/svgs/team.svg +15 -0
- package/src/components/icon/utils/svgs/telescope.svg +15 -0
- package/src/components/icon/utils/svgs/trash.svg +6 -0
- package/src/components/icon/utils/svgs/triangle-angle.svg +3 -0
- package/src/components/icon/utils/svgs/triangle-side.svg +3 -0
- package/src/components/icon/utils/svgs/underline.svg +4 -0
- package/src/components/icon/utils/svgs/undo.svg +3 -0
- package/src/components/icon/utils/svgs/user.svg +16 -0
- package/src/components/icon/utils/svgs/venn.svg +3 -0
- package/src/components/icon/utils/svgs/video.svg +3 -0
- package/src/components/icon/utils/svgs/visibility-off-alt.svg +19 -0
- package/src/components/icon/utils/svgs/visibility-off.svg +3 -0
- package/src/components/icon/utils/svgs/visibility-on.svg +16 -0
- package/src/components/icon/utils/svgs/warning.svg +5 -0
- package/src/components/index.ts +38 -0
- package/src/components/input/Input.vue +87 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/load-spinner/LoadSpinner.vue +13 -0
- package/src/components/load-spinner/index.ts +1 -0
- package/src/components/modal/Modal.vue +111 -0
- package/src/components/modal/index.ts +1 -0
- package/src/components/nav-item/NavItem.vue +62 -0
- package/src/components/nav-item/index.ts +1 -0
- package/src/components/notification/Notification.vue +34 -0
- package/src/components/notification/index.ts +1 -0
- package/src/components/pagination/Pagination.vue +72 -0
- package/src/components/pagination/index.ts +1 -0
- package/src/components/pill/Pill.vue +52 -0
- package/src/components/pill/index.ts +2 -0
- package/src/components/pill/pill-types.ts +2 -0
- package/src/components/pop-confirm/PopConfirm.vue +69 -0
- package/src/components/pop-confirm/index.ts +1 -0
- package/src/components/pop-select/FooterButton.vue +5 -0
- package/src/components/pop-select/PopSelect.vue +346 -0
- package/src/components/pop-select/ResultFilters.vue +31 -0
- package/src/components/pop-select/enums.ts +7 -0
- package/src/components/pop-select/index.ts +2 -0
- package/src/components/pop-select/option.vue +51 -0
- package/src/components/popper/Popper.vue +239 -0
- package/src/components/popper/PopperContent.vue +5 -0
- package/src/components/popper/index.ts +2 -0
- package/src/components/popper/middleware.ts +19 -0
- package/src/components/screen-overlay/ScreenOverlay.vue +53 -0
- package/src/components/screen-overlay/index.ts +1 -0
- package/src/components/scrollbar/Bar.vue +106 -0
- package/src/components/scrollbar/ScrollBottomLoader.vue +25 -0
- package/src/components/scrollbar/Scrollbar.vue +220 -0
- package/src/components/scrollbar/enums.ts +23 -0
- package/src/components/scrollbar/index.ts +2 -0
- package/src/components/scrollbar/scrollbarWidth.ts +26 -0
- package/src/components/scrollbar/style.scss +75 -0
- package/src/components/scrollbar/types.ts +32 -0
- package/src/components/side-over/SideOver.vue +87 -0
- package/src/components/side-over/index.ts +1 -0
- package/src/components/status-select/StatusIndicator.vue +78 -0
- package/src/components/status-select/StatusSelect.vue +62 -0
- package/src/components/status-select/index.ts +1 -0
- package/src/components/switch/Switch.vue +52 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/tab/Tab.vue +59 -0
- package/src/components/tab/index.ts +1 -0
- package/src/components/tag/Tag.vue +34 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/text-editor/TextEditor.vue +399 -0
- package/src/components/text-editor/components/Dialog.vue +11 -0
- package/src/components/text-editor/components/FormattingButton.vue +46 -0
- package/src/components/text-editor/components/InsertLinkDialog.vue +81 -0
- package/src/components/text-editor/components/InsertTextDialog.vue +36 -0
- package/src/components/text-editor/components/index.ts +3 -0
- package/src/components/text-editor/index.ts +1 -0
- package/src/components/text-highlight/TextHighlight.vue +113 -0
- package/src/components/text-highlight/index.ts +1 -0
- package/src/components/text-viewer/TextViewer.vue +5 -0
- package/src/components/text-viewer/index.ts +1 -0
- package/src/components/tooltip/Tooltip.vue +54 -0
- package/src/components/tooltip/index.ts +1 -0
- package/src/components/types.ts +221 -0
- package/src/components/vertical-layout/RunningSection.vue +54 -0
- package/src/components/vertical-layout/VerticalLayout.vue +37 -0
- package/src/components/vertical-layout/index.ts +3 -0
- package/src/components/vertical-layout/types.ts +2 -0
- package/src/components/window-frame/WindowFrame.vue +20 -0
- package/src/components/window-frame/index.ts +1 -0
- package/src/composables/index.ts +5 -0
- package/src/composables/useClickOutside.ts +48 -0
- package/src/composables/useEscapeKey.ts +12 -0
- package/src/composables/useMounted.ts +7 -0
- package/src/composables/useNextFrame.ts +10 -0
- package/src/composables/useTrapFocus.ts +61 -0
- package/src/index.ts +5 -0
- package/src/main.css +116 -0
- package/src/utils/array.ts +11 -0
- package/src/utils/clamp.ts +1 -0
- package/src/utils/debounce.ts +8 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/scrollIntoView.ts +25 -0
- package/src/utils/scrollbarWidth.ts +27 -0
- package/tsconfig.app.json +4 -0
- package/tsconfig.json +11 -0
- package/tsconfig.node.json +21 -0
- package/vite.config.ts +27 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TPopSelectOption } from "../types";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { BIcon, BPopSelect, BTooltip } from "../";
|
|
5
|
+
import { range } from "../../utils";
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
noBorders?: boolean;
|
|
10
|
+
currentPage: number;
|
|
11
|
+
lastPage: number;
|
|
12
|
+
}>(),
|
|
13
|
+
{
|
|
14
|
+
noBorders: false,
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits(["change"]);
|
|
19
|
+
|
|
20
|
+
const pageOptions = computed((): TPopSelectOption[] => {
|
|
21
|
+
return range(0, props.lastPage).map((num: number) => ({ label: `${num + 1}` }));
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const shared
|
|
25
|
+
= "relative inline-flex items-center h-8 bg-primary text-sm text-primary hover:bg-sand-grey-15 focus:z-10 focus:outline-hidden focus-visible:bg-sand-grey-40 active:scale-[0.98]";
|
|
26
|
+
|
|
27
|
+
const arrowClasses = computed(() => {
|
|
28
|
+
return props.noBorders
|
|
29
|
+
? `${shared} px-2 rounded-lg border border-transparent focus-visible:border-true-blue`
|
|
30
|
+
: `${shared} px-2 border border-default focus-visible:border-true-blue`;
|
|
31
|
+
});
|
|
32
|
+
const triggerClasses = computed(() => {
|
|
33
|
+
return props.noBorders ? `${shared} px-3 rounded-lg` : `${shared} -ml-px px-3 border border-default focus-visible:border-true-blue`;
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const onChange = (direction: -1 | 1) => {
|
|
37
|
+
let targetPage = props.currentPage + direction;
|
|
38
|
+
if (targetPage > props.lastPage) targetPage = 1;
|
|
39
|
+
if (targetPage < 1) targetPage = props.lastPage;
|
|
40
|
+
emit("change", targetPage);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const onPageSelect = (pageOption: TPopSelectOption) => {
|
|
44
|
+
emit("change", pageOption.label);
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<nav class="relative z-0 inline-flex">
|
|
50
|
+
<BTooltip text="Previous page" :delay="500">
|
|
51
|
+
<button rel="prev" aria-label="previous page" class="rounded-l-lg" :class="[arrowClasses]" @click="onChange(-1)">
|
|
52
|
+
<BIcon name="chevron-left" />
|
|
53
|
+
</button>
|
|
54
|
+
</BTooltip>
|
|
55
|
+
<BPopSelect same-width-as-trigger :value="currentPage" :options="pageOptions" @select="onPageSelect">
|
|
56
|
+
<template #trigger>
|
|
57
|
+
<BTooltip text="current / total" :delay="500">
|
|
58
|
+
<button :class="triggerClasses">
|
|
59
|
+
<span class="">{{ currentPage }}</span>
|
|
60
|
+
<span class="px-2">/</span>
|
|
61
|
+
<span class="">{{ lastPage }}</span>
|
|
62
|
+
</button>
|
|
63
|
+
</BTooltip>
|
|
64
|
+
</template>
|
|
65
|
+
</BPopSelect>
|
|
66
|
+
<BTooltip text="Next page" :delay="500">
|
|
67
|
+
<button rel="next" aria-label="next page" class="-ml-px rounded-r-lg" :class="[arrowClasses]" @click="onChange(1)">
|
|
68
|
+
<BIcon name="chevron-right" />
|
|
69
|
+
</button>
|
|
70
|
+
</BTooltip>
|
|
71
|
+
</nav>
|
|
72
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BPagination } from "./Pagination.vue";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { BIcon } from "../";
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(
|
|
5
|
+
defineProps<{
|
|
6
|
+
deletable?: boolean;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
stopPropagation?: boolean;
|
|
9
|
+
}>(),
|
|
10
|
+
{
|
|
11
|
+
deletable: false,
|
|
12
|
+
selected: false,
|
|
13
|
+
stopPropagation: false,
|
|
14
|
+
},
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits(["click", "delete"]);
|
|
18
|
+
|
|
19
|
+
const onClick = (event: Event) => {
|
|
20
|
+
if (props.stopPropagation) {
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
}
|
|
24
|
+
emit("click");
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// TODO key.enter event stopPropagation
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<button
|
|
32
|
+
class="h-7 px-2 inline-flex items-center space-x-1 rounded-lg focus:outline-hidden border border-transparent focus-visible:border-true-blue"
|
|
33
|
+
:class="{
|
|
34
|
+
'bg-light-blue text-white hover:bg-light-blue-darker': selected,
|
|
35
|
+
'bg-light-blue-40 text-light-blue hover:bg-light-blue-15 hover:text-light-blue-darker': !selected,
|
|
36
|
+
}"
|
|
37
|
+
@click="onClick"
|
|
38
|
+
>
|
|
39
|
+
<span class="truncate"><slot /></span>
|
|
40
|
+
<button
|
|
41
|
+
v-if="deletable"
|
|
42
|
+
class="w-4 h-4 flex items-center justify-center rounded-md focus:outline-hidden border border-transparent focus-visible:border-true-blue opacity-75 hover:opacity-100"
|
|
43
|
+
:class="{
|
|
44
|
+
'hover:bg-black/20 hover:bg-opacity-20': selected,
|
|
45
|
+
'hover:bg-light-blue hover:text-light-blue-15': !selected,
|
|
46
|
+
}"
|
|
47
|
+
@click.stop.prevent="emit('delete')"
|
|
48
|
+
>
|
|
49
|
+
<BIcon name="close" />
|
|
50
|
+
</button>
|
|
51
|
+
</button>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Placement } from "@floating-ui/dom";
|
|
3
|
+
import type { TButtonType } from "../types";
|
|
4
|
+
import { nextTick, ref } from "vue";
|
|
5
|
+
import { BButton, BPopper, BPopperContent } from "../";
|
|
6
|
+
import { useTrapFocus } from "../../";
|
|
7
|
+
|
|
8
|
+
withDefaults(
|
|
9
|
+
defineProps<{
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
cancelType?: TButtonType;
|
|
12
|
+
confirmLabel?: string;
|
|
13
|
+
confirmType?: TButtonType;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
placement?: Placement;
|
|
16
|
+
tagName?: string;
|
|
17
|
+
}>(),
|
|
18
|
+
{
|
|
19
|
+
cancelLabel: "Cancel",
|
|
20
|
+
cancelType: "primary",
|
|
21
|
+
confirmLabel: "Confirm",
|
|
22
|
+
confirmType: "error",
|
|
23
|
+
disabled: false,
|
|
24
|
+
placement: "bottom",
|
|
25
|
+
tagName: "span",
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const emit = defineEmits(["cancel", "close", "confirm"]);
|
|
30
|
+
|
|
31
|
+
const popperRef = ref<typeof BPopper>();
|
|
32
|
+
const contentRef = ref<HTMLDivElement>();
|
|
33
|
+
const { trapFocus } = useTrapFocus(contentRef);
|
|
34
|
+
|
|
35
|
+
const close = () => {
|
|
36
|
+
emit("close");
|
|
37
|
+
popperRef.value && popperRef.value.close();
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const onOpen = () => nextTick(trapFocus);
|
|
41
|
+
|
|
42
|
+
const onCancel = () => {
|
|
43
|
+
close();
|
|
44
|
+
emit("cancel");
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const onConfirm = () => {
|
|
48
|
+
close();
|
|
49
|
+
emit("confirm");
|
|
50
|
+
};
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<BPopper ref="popperRef" trigger="click" :placement="placement" @open="onOpen" @close="close">
|
|
55
|
+
<template #default="slotProps">
|
|
56
|
+
<div class="inline-flex">
|
|
57
|
+
<slot name="reference" :visible="slotProps && slotProps.visible" />
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
<template #content>
|
|
61
|
+
<BPopperContent>
|
|
62
|
+
<div ref="contentRef" class="flex flex-col px-2 py-2 space-y-2">
|
|
63
|
+
<BButton bordered :type="cancelType" :label="cancelLabel" @click="onCancel" />
|
|
64
|
+
<BButton bordered :label="confirmLabel" :type="confirmType" @click="onConfirm" />
|
|
65
|
+
</div>
|
|
66
|
+
</BPopperContent>
|
|
67
|
+
</template>
|
|
68
|
+
</BPopper>
|
|
69
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as BPopConfirm } from "./PopConfirm.vue";
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends TPopSelectOption">
|
|
2
|
+
import type { Placement } from "@floating-ui/dom";
|
|
3
|
+
import type { TIcon, TPopSelectOption, TPopSelectResultFilter } from "../types";
|
|
4
|
+
import { computed, nextTick, onBeforeMount, ref, useSlots, watch, withDefaults } from "vue";
|
|
5
|
+
import { BIcon, BLoadSpinner, BPopper, BPopperContent, BScrollbar, BTextHighlight } from "../";
|
|
6
|
+
import { useNextFrame } from "../../composables";
|
|
7
|
+
import { debounce, scrollIntoView } from "../../utils";
|
|
8
|
+
import { State } from "./enums.ts";
|
|
9
|
+
import PopSelectOption from "./option.vue";
|
|
10
|
+
import ResultFilters from "./ResultFilters.vue";
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(
|
|
13
|
+
defineProps<{
|
|
14
|
+
resetOnClose?: boolean;
|
|
15
|
+
debounceMs?: number;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
emptyStateIcon?: TIcon;
|
|
18
|
+
emptyStateText?: string;
|
|
19
|
+
filterable?: boolean;
|
|
20
|
+
fixedHeight?: boolean;
|
|
21
|
+
keepOpen?: boolean;
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
loadingText?: string;
|
|
24
|
+
options: T[];
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
placement?: Placement;
|
|
27
|
+
popperWidthClass?: string;
|
|
28
|
+
// eslint-disable-next-line ts/no-unsafe-function-type
|
|
29
|
+
remoteMethod?: Function | null;
|
|
30
|
+
resultFilters?: TPopSelectResultFilter<T>[];
|
|
31
|
+
rootClass?: string;
|
|
32
|
+
sameWidthAsElement?: HTMLElement;
|
|
33
|
+
sameWidthAsTrigger?: boolean;
|
|
34
|
+
selected?: TPopSelectOption | TPopSelectOption[];
|
|
35
|
+
triggerClass?: string;
|
|
36
|
+
}>(),
|
|
37
|
+
{
|
|
38
|
+
resetOnClose: false,
|
|
39
|
+
debounceMs: 300,
|
|
40
|
+
disabled: false,
|
|
41
|
+
emptyStateIcon: "keyboard",
|
|
42
|
+
emptyStateText: "Type to search",
|
|
43
|
+
filterable: false,
|
|
44
|
+
fixedHeight: false,
|
|
45
|
+
keepOpen: false,
|
|
46
|
+
loading: false,
|
|
47
|
+
loadingText: "Loading...",
|
|
48
|
+
placeholder: "Search",
|
|
49
|
+
placement: "bottom-start",
|
|
50
|
+
remoteMethod: null,
|
|
51
|
+
sameWidthAsTrigger: false,
|
|
52
|
+
},
|
|
53
|
+
);
|
|
54
|
+
const emit = defineEmits(["close", "save-custom", "select"]);
|
|
55
|
+
const slots = useSlots() as ReturnType<typeof useSlots>;
|
|
56
|
+
|
|
57
|
+
const hoveredOption = ref<TPopSelectOption | null>(null);
|
|
58
|
+
const localOptions = ref<TPopSelectOption[]>([]);
|
|
59
|
+
const currentQuery = ref("");
|
|
60
|
+
|
|
61
|
+
const contentRef = ref<typeof BPopperContent>();
|
|
62
|
+
const errorRef = ref<HTMLElement>();
|
|
63
|
+
const inputRef = ref<HTMLInputElement>();
|
|
64
|
+
const optionsRef = ref();
|
|
65
|
+
const popperRef = ref<typeof BPopper>();
|
|
66
|
+
const scrollbarRef = ref<typeof BScrollbar>();
|
|
67
|
+
|
|
68
|
+
const localResultFilters = ref<TPopSelectResultFilter<T>[]>(props.resultFilters || []);
|
|
69
|
+
const selectedResultFilter = ref<TPopSelectResultFilter<T> | null>(props.resultFilters ? props.resultFilters[0] : null);
|
|
70
|
+
|
|
71
|
+
const { nextFrame } = useNextFrame();
|
|
72
|
+
|
|
73
|
+
const selectedOptions = computed(() => {
|
|
74
|
+
if (!props.selected) return [];
|
|
75
|
+
return Array.isArray(props.selected) ? props.selected : [props.selected];
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const allOptionsDisabled = computed(() => {
|
|
79
|
+
return localOptions.value.every((option: TPopSelectOption) => option.disabled as boolean);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const emptyState = computed(() => {
|
|
83
|
+
return !currentQuery.value.length && !localOptions.value.length;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const noSearchResults = computed(() => {
|
|
87
|
+
return currentQuery.value.length && !localOptions.value.length;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const state = computed(() => {
|
|
91
|
+
if (errorRef.value) return State.ERROR;
|
|
92
|
+
if (props.loading) return State.LOADING;
|
|
93
|
+
if (noSearchResults.value && !props.loading) return State.NO_MATCH;
|
|
94
|
+
if (emptyState.value && !props.loading) return State.IDLE;
|
|
95
|
+
if (localOptions.value.length && !props.loading) return State.MATCH;
|
|
96
|
+
return undefined;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const updateLocalOptions = (options: T[]) => {
|
|
100
|
+
localOptions.value = selectedResultFilter.value ? options.filter(selectedResultFilter.value.execute) : options;
|
|
101
|
+
|
|
102
|
+
// update counts
|
|
103
|
+
if (props.resultFilters) {
|
|
104
|
+
localResultFilters.value.forEach((filter) => {
|
|
105
|
+
filter.count = options.filter(filter.execute).length;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
watch(
|
|
111
|
+
() => props.options,
|
|
112
|
+
(newValue: T[]) => {
|
|
113
|
+
updateLocalOptions(newValue);
|
|
114
|
+
hoveredOption.value = null;
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
onBeforeMount(() => {
|
|
119
|
+
if (props.filterable && props.remoteMethod) {
|
|
120
|
+
console.warn("[PopSelect] should not have both \"filterable\" and \"remoteMethod\" props at the same time");
|
|
121
|
+
}
|
|
122
|
+
updateLocalOptions(props.options);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// triggers onClose event when popper is closed
|
|
126
|
+
const close = () => popperRef.value!.close();
|
|
127
|
+
const focus = () => popperRef.value!.open();
|
|
128
|
+
|
|
129
|
+
const onOpen = async () => {
|
|
130
|
+
nextFrame(() => {
|
|
131
|
+
if (scrollbarRef.value) {
|
|
132
|
+
nextFrame(() => scrollbarRef.value!.update());
|
|
133
|
+
}
|
|
134
|
+
if (inputRef.value) {
|
|
135
|
+
nextFrame(() => inputRef.value!.focus());
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const onClose = () => {
|
|
141
|
+
if (props.keepOpen) return;
|
|
142
|
+
|
|
143
|
+
hoveredOption.value = null;
|
|
144
|
+
|
|
145
|
+
if (props.resetOnClose) {
|
|
146
|
+
currentQuery.value = "";
|
|
147
|
+
props.remoteMethod ? props.remoteMethod("") : updateLocalOptions([]);
|
|
148
|
+
selectedResultFilter.value = props.resultFilters ? props.resultFilters[0] : null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
emit("close");
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const onSelect = (option: TPopSelectOption) => {
|
|
155
|
+
emit("select", option);
|
|
156
|
+
if (!props.keepOpen) close();
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const filterOptions = (query: string) => (localOptions.value = props.options.filter(o => o.label.toLowerCase().includes(query.toLowerCase())));
|
|
160
|
+
|
|
161
|
+
const onQuery = async (event: Event) => {
|
|
162
|
+
const query = (event.target as HTMLInputElement).value;
|
|
163
|
+
|
|
164
|
+
hoveredOption.value = null;
|
|
165
|
+
|
|
166
|
+
if (props.filterable) {
|
|
167
|
+
filterOptions(query);
|
|
168
|
+
}
|
|
169
|
+
else if (props.remoteMethod) {
|
|
170
|
+
await props.remoteMethod(query);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const debounceOnQuery = debounce(onQuery, props.debounceMs);
|
|
175
|
+
|
|
176
|
+
const onOptionHover = (label: string) => {
|
|
177
|
+
hoveredOption.value = localOptions.value.find(o => o.label === label) || null;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const scrollToOption = (option: TPopSelectOption) => {
|
|
181
|
+
if (!optionsRef.value.length) return;
|
|
182
|
+
|
|
183
|
+
const target = optionsRef.value[localOptions.value.findIndex(o => o.label === option.label)].$el;
|
|
184
|
+
|
|
185
|
+
if (scrollbarRef.value && target) {
|
|
186
|
+
const menu: HTMLElement | null = scrollbarRef.value.$el.querySelector(".scrollbar__wrap");
|
|
187
|
+
if (menu) {
|
|
188
|
+
scrollIntoView(menu, target);
|
|
189
|
+
scrollbarRef.value.handleScroll();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const navigateOptions = async (direction: "next" | "prev") => {
|
|
195
|
+
if (localOptions.value.length === 0) return;
|
|
196
|
+
|
|
197
|
+
let hoverIndex = localOptions.value.findIndex(o => o.label === hoveredOption.value?.label);
|
|
198
|
+
|
|
199
|
+
if (!allOptionsDisabled.value) {
|
|
200
|
+
if (direction === "next") {
|
|
201
|
+
hoverIndex++;
|
|
202
|
+
if (hoverIndex === localOptions.value.length) {
|
|
203
|
+
hoverIndex = 0;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (direction === "prev") {
|
|
207
|
+
hoverIndex--;
|
|
208
|
+
if (hoverIndex < 0) {
|
|
209
|
+
hoverIndex = localOptions.value.length - 1;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
hoveredOption.value = localOptions.value[hoverIndex];
|
|
213
|
+
|
|
214
|
+
if (hoveredOption.value.disabled === true) {
|
|
215
|
+
navigateOptions(direction);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
await nextTick();
|
|
219
|
+
|
|
220
|
+
if (hoveredOption.value) {
|
|
221
|
+
scrollToOption(hoveredOption.value);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const selectOption = () => {
|
|
227
|
+
if (hoveredOption.value) {
|
|
228
|
+
onSelect(hoveredOption.value);
|
|
229
|
+
}
|
|
230
|
+
else if (currentQuery.value.length) {
|
|
231
|
+
emit("save-custom", currentQuery.value);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const onResultFilterChange = (filter: TPopSelectResultFilter<T>) => {
|
|
236
|
+
selectedResultFilter.value = filter;
|
|
237
|
+
updateLocalOptions(props.options);
|
|
238
|
+
inputRef.value!.focus();
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
defineExpose({ close, focus });
|
|
242
|
+
</script>
|
|
243
|
+
|
|
244
|
+
<template>
|
|
245
|
+
<BPopper
|
|
246
|
+
ref="popperRef"
|
|
247
|
+
trigger="click"
|
|
248
|
+
:placement="placement"
|
|
249
|
+
:disabled="disabled"
|
|
250
|
+
:popper-width-class="popperWidthClass"
|
|
251
|
+
:same-width-as-element="sameWidthAsElement"
|
|
252
|
+
:same-width-as-trigger="sameWidthAsTrigger"
|
|
253
|
+
:root-class="rootClass"
|
|
254
|
+
:trigger-class="triggerClass"
|
|
255
|
+
@close="onClose"
|
|
256
|
+
@open="onOpen"
|
|
257
|
+
>
|
|
258
|
+
<template #default="slotProps">
|
|
259
|
+
<slot name="trigger" :disabled="disabled" :visible="slotProps && slotProps.visible" />
|
|
260
|
+
</template>
|
|
261
|
+
|
|
262
|
+
<template #content>
|
|
263
|
+
<BPopperContent ref="contentRef" class="flex flex-col" :class="{ 'h-72': fixedHeight }">
|
|
264
|
+
<header v-if="filterable || remoteMethod || resultFilters" class="border-b border-default">
|
|
265
|
+
<header v-if="filterable || remoteMethod" class="flex items-center w-full px-3 space-x-2 bg-light overflow-hidden">
|
|
266
|
+
<BIcon name="magnifying-glass" class="text-light-blue" />
|
|
267
|
+
<input
|
|
268
|
+
ref="inputRef"
|
|
269
|
+
v-model="currentQuery"
|
|
270
|
+
type="text"
|
|
271
|
+
class="w-full h-8 text-sm leading-none bg-light rounded-tr-lg focus:outline-hidden"
|
|
272
|
+
:placeholder="placeholder"
|
|
273
|
+
@click.stop.prevent
|
|
274
|
+
@input="debounceOnQuery"
|
|
275
|
+
@keydown.down.prevent="navigateOptions('next')"
|
|
276
|
+
@keydown.up.prevent="navigateOptions('prev')"
|
|
277
|
+
@keydown.enter.prevent="selectOption"
|
|
278
|
+
@keydown.esc.stop.prevent="onClose"
|
|
279
|
+
>
|
|
280
|
+
</header>
|
|
281
|
+
<ResultFilters
|
|
282
|
+
v-if="resultFilters"
|
|
283
|
+
show-counts
|
|
284
|
+
:filters="localResultFilters"
|
|
285
|
+
:selected="selectedResultFilter"
|
|
286
|
+
@change="onResultFilterChange"
|
|
287
|
+
/>
|
|
288
|
+
</header>
|
|
289
|
+
|
|
290
|
+
<div v-if="$slots.error" ref="errorRef" class="flex-1 bg-light h-full">
|
|
291
|
+
<slot name="error" />
|
|
292
|
+
</div>
|
|
293
|
+
<div v-else-if="state === State.LOADING" class="flex-1">
|
|
294
|
+
<div class="flex items-center space-x-2 bg-light text-tertiary py-3 px-3">
|
|
295
|
+
<BLoadSpinner class="w-4 h-4 text-granite-grey" />
|
|
296
|
+
<span class="italic leading-none text-sm">{{ loadingText }}</span>
|
|
297
|
+
</div>
|
|
298
|
+
</div>
|
|
299
|
+
<div v-else-if="state === State.NO_MATCH" class="flex-1">
|
|
300
|
+
<div class="flex space-x-2 bg-light text-tertiary py-3 px-3">
|
|
301
|
+
<div class="w-4 h-4 text-center leading-none">
|
|
302
|
+
...
|
|
303
|
+
</div>
|
|
304
|
+
<span class="italic leading-none text-sm">Nothing matches your input</span>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
<div v-else-if="state === State.IDLE" class="flex-1">
|
|
308
|
+
<div class="flex items-center space-x-2 bg-light text-tertiary py-3 px-3">
|
|
309
|
+
<BIcon :name="emptyStateIcon" />
|
|
310
|
+
<span class="italic leading-none text-sm">{{ emptyStateText }}</span>
|
|
311
|
+
</div>
|
|
312
|
+
<div class="h-8 w-full bg-light" />
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<BScrollbar v-else-if="state === State.MATCH" ref="scrollbarRef">
|
|
316
|
+
<div class="max-h-60 bg-light">
|
|
317
|
+
<PopSelectOption
|
|
318
|
+
v-for="option in localOptions"
|
|
319
|
+
ref="optionsRef"
|
|
320
|
+
:key="option.id || option.label"
|
|
321
|
+
:disabled="option.disabled"
|
|
322
|
+
:label="option.label"
|
|
323
|
+
:hovered-option="hoveredOption"
|
|
324
|
+
:selected="selectedOptions.includes(option)"
|
|
325
|
+
@focus="onOptionHover"
|
|
326
|
+
@hover="onOptionHover"
|
|
327
|
+
@click="onSelect(option)"
|
|
328
|
+
>
|
|
329
|
+
<div class="flex items-center space-x-2">
|
|
330
|
+
<BIcon v-if="option.icon" :name="option.icon" />
|
|
331
|
+
<BTextHighlight bold underline :value="option.label" :highlight="currentQuery" />
|
|
332
|
+
</div>
|
|
333
|
+
<div v-if="option.meta" class="text-secondary">
|
|
334
|
+
{{ option.meta }}
|
|
335
|
+
</div>
|
|
336
|
+
</PopSelectOption>
|
|
337
|
+
</div>
|
|
338
|
+
</BScrollbar>
|
|
339
|
+
|
|
340
|
+
<footer v-if="slots.footer" class="flex-none border-t border-default bg-light">
|
|
341
|
+
<slot name="footer" />
|
|
342
|
+
</footer>
|
|
343
|
+
</BPopperContent>
|
|
344
|
+
</template>
|
|
345
|
+
</BPopper>
|
|
346
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends TPopSelectOption">
|
|
2
|
+
import type { TPopSelectOption, TPopSelectResultFilter } from "../types";
|
|
3
|
+
import { BPill } from "../";
|
|
4
|
+
|
|
5
|
+
withDefaults(defineProps<{
|
|
6
|
+
selected: TPopSelectResultFilter<T> | null;
|
|
7
|
+
showCounts?: boolean;
|
|
8
|
+
filters: TPopSelectResultFilter<T>[];
|
|
9
|
+
}>(), {
|
|
10
|
+
showCounts: false,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const emit = defineEmits(["change"]);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<section class="flex items-center px-2 pb-2 space-x-2">
|
|
18
|
+
<BPill
|
|
19
|
+
v-for="filter in filters"
|
|
20
|
+
:key="filter.name"
|
|
21
|
+
:selected="Boolean(selected && selected.name === filter.name)"
|
|
22
|
+
stop-propagation
|
|
23
|
+
@click="emit('change', filter)"
|
|
24
|
+
>
|
|
25
|
+
<span class="flex items-center space-x-1">
|
|
26
|
+
<span>{{ filter.name }}</span>
|
|
27
|
+
<span v-if="showCounts && filter.count" class="text-xs opacity-75">{{ `(${filter.count})` }}</span>
|
|
28
|
+
</span>
|
|
29
|
+
</BPill>
|
|
30
|
+
</section>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TPopSelectOption } from "../types";
|
|
3
|
+
import { computed, ref } from "vue";
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<{
|
|
7
|
+
label: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
hoveredOption: TPopSelectOption | null;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
}>(),
|
|
12
|
+
{
|
|
13
|
+
disabled: false,
|
|
14
|
+
selected: false,
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits(["click", "focus", "hover"]);
|
|
19
|
+
|
|
20
|
+
const root = ref();
|
|
21
|
+
|
|
22
|
+
const highlighted = computed(() => {
|
|
23
|
+
return props.hoveredOption && props.hoveredOption.label === props.label;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const onOptionClick = () => {
|
|
27
|
+
if (props.disabled) return;
|
|
28
|
+
emit("click");
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div
|
|
34
|
+
ref="root"
|
|
35
|
+
tabindex="0"
|
|
36
|
+
class="flex items-center justify-between w-full h-8 px-3 space-x-2 text-sm focus:outline-hidden"
|
|
37
|
+
:class="{
|
|
38
|
+
'cursor-not-allowed text-muted ': disabled,
|
|
39
|
+
'cursor-pointer text-primary hover:bg-blue-100 focus:bg-blue-100': !disabled && !selected,
|
|
40
|
+
'cursor-pointer text-light-blue font-medium hover:bg-blue-100 focus:bg-blue-100': selected,
|
|
41
|
+
'bg-blue-100': highlighted,
|
|
42
|
+
'bg-light': !highlighted,
|
|
43
|
+
}"
|
|
44
|
+
@click="onOptionClick"
|
|
45
|
+
@keydown.enter.prevent="onOptionClick"
|
|
46
|
+
@mouseover="emit('hover', label)"
|
|
47
|
+
@focus="emit('focus', label)"
|
|
48
|
+
>
|
|
49
|
+
<slot />
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|