cornet-ui 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +95 -0
- package/components/Actions/du-button/du-button.types.ts +14 -0
- package/components/Actions/du-button/du-button.vue +149 -0
- package/components/Actions/du-dropdown/du-dropdown.types.ts +15 -0
- package/components/Actions/du-dropdown/du-dropdown.vue +75 -0
- package/components/Actions/du-fab/du-fab.types.ts +28 -0
- package/components/Actions/du-fab/du-fab.vue +270 -0
- package/components/Actions/du-modal/du-modal.types.ts +10 -0
- package/components/Actions/du-modal/du-modal.vue +123 -0
- package/components/Actions/du-swap/du-swap.types.ts +3 -0
- package/components/Actions/du-swap/du-swap.vue +68 -0
- package/components/DataDisplay/du-accordion/du-accordion-item.vue +37 -0
- package/components/DataDisplay/du-accordion/du-accordion.types.ts +15 -0
- package/components/DataDisplay/du-accordion/du-accordion.vue +73 -0
- package/components/DataDisplay/du-avatar/du-avatar.types.ts +59 -0
- package/components/DataDisplay/du-avatar/du-avatar.vue +139 -0
- package/components/DataDisplay/du-badge/du-badge.types.ts +21 -0
- package/components/DataDisplay/du-badge/du-badge.vue +81 -0
- package/components/DataDisplay/du-card/du-card.types.ts +18 -0
- package/components/DataDisplay/du-card/du-card.vue +86 -0
- package/components/DataDisplay/du-carousel/du-carousel-item.vue +11 -0
- package/components/DataDisplay/du-carousel/du-carousel.types.ts +15 -0
- package/components/DataDisplay/du-carousel/du-carousel.vue +46 -0
- package/components/DataDisplay/du-chat/du-chat-item.vue +56 -0
- package/components/DataDisplay/du-chat/du-chat.types.ts +31 -0
- package/components/DataDisplay/du-chat/du-chat.vue +71 -0
- package/components/DataDisplay/du-collapse/du-collapse.types.ts +15 -0
- package/components/DataDisplay/du-collapse/du-collapse.vue +59 -0
- package/components/DataDisplay/du-countdown/du-countdown-group.vue +88 -0
- package/components/DataDisplay/du-countdown/du-countdown.types.ts +15 -0
- package/components/DataDisplay/du-countdown/du-countdown.vue +180 -0
- package/components/DataDisplay/du-diff/du-diff.types.ts +9 -0
- package/components/DataDisplay/du-diff/du-diff.vue +44 -0
- package/components/DataDisplay/du-kbd/du-kbd.types.ts +9 -0
- package/components/DataDisplay/du-kbd/du-kbd.vue +21 -0
- package/components/DataDisplay/du-list/du-list-row.vue +12 -0
- package/components/DataDisplay/du-list/du-list.types.ts +3 -0
- package/components/DataDisplay/du-list/du-list.vue +11 -0
- package/components/DataDisplay/du-stat/du-stat.types.ts +12 -0
- package/components/DataDisplay/du-stat/du-stat.vue +28 -0
- package/components/DataDisplay/du-stats/du-stats.types.ts +3 -0
- package/components/DataDisplay/du-stats/du-stats.vue +91 -0
- package/components/DataDisplay/du-status/du-status.types.ts +21 -0
- package/components/DataDisplay/du-status/du-status.vue +51 -0
- package/components/DataDisplay/du-table/du-table-item.types.ts +6 -0
- package/components/DataDisplay/du-table/du-table-item.vue +24 -0
- package/components/DataDisplay/du-table/du-table.types.ts +26 -0
- package/components/DataDisplay/du-table/du-table.vue +125 -0
- package/components/DataDisplay/du-timeline/du-timeline-item.vue +85 -0
- package/components/DataDisplay/du-timeline/du-timeline.types.ts +22 -0
- package/components/DataDisplay/du-timeline/du-timeline.vue +138 -0
- package/components/DataInput/du-checkbox/du-checkbox.types.ts +17 -0
- package/components/DataInput/du-checkbox/du-checkbox.vue +40 -0
- package/components/DataInput/du-fieldset/du-fieldset.types.ts +4 -0
- package/components/DataInput/du-fieldset/du-fieldset.vue +16 -0
- package/components/DataInput/du-file-input/du-file-input.types.ts +29 -0
- package/components/DataInput/du-file-input/du-file-input.vue +31 -0
- package/components/DataInput/du-filter/du-filter.types.ts +30 -0
- package/components/DataInput/du-filter/du-filter.vue +47 -0
- package/components/DataInput/du-input-field/du-input-field.types.ts +43 -0
- package/components/DataInput/du-input-field/du-input-field.vue +47 -0
- package/components/DataInput/du-label/du-label.types.ts +3 -0
- package/components/DataInput/du-label/du-label.vue +28 -0
- package/components/DataInput/du-label-input-validator/du-label-input-validator.types.ts +7 -0
- package/components/DataInput/du-label-input-validator/du-label-input-validator.vue +51 -0
- package/components/DataInput/du-radio/du-radio.types.ts +15 -0
- package/components/DataInput/du-radio/du-radio.vue +27 -0
- package/components/DataInput/du-range/du-range.types.ts +18 -0
- package/components/DataInput/du-range/du-range.vue +60 -0
- package/components/DataInput/du-rating/du-rating-item.vue +65 -0
- package/components/DataInput/du-rating/du-rating.types.ts +46 -0
- package/components/DataInput/du-rating/du-rating.vue +127 -0
- package/components/DataInput/du-search/du-search.types.ts +44 -0
- package/components/DataInput/du-search/du-search.vue +425 -0
- package/components/DataInput/du-select/du-select.types.ts +31 -0
- package/components/DataInput/du-select/du-select.vue +384 -0
- package/components/DataInput/du-text-area/du-text-area.types.ts +11 -0
- package/components/DataInput/du-text-area/du-text-area.vue +41 -0
- package/components/Feedback/du-alert/du-alert.types.ts +16 -0
- package/components/Feedback/du-alert/du-alert.vue +113 -0
- package/components/Feedback/du-loading/du-loading.types.ts +11 -0
- package/components/Feedback/du-loading/du-loading.vue +33 -0
- package/components/Feedback/du-progress/du-progress.types.ts +8 -0
- package/components/Feedback/du-progress/du-progress.vue +23 -0
- package/components/Feedback/du-radial-progress/du-radial-progress.types.ts +9 -0
- package/components/Feedback/du-radial-progress/du-radial-progress.vue +64 -0
- package/components/Feedback/du-skeleton/du-skeleton.types.ts +3 -0
- package/components/Feedback/du-skeleton/du-skeleton.vue +11 -0
- package/components/Feedback/du-toast/du-toast.types.ts +11 -0
- package/components/Feedback/du-toast/du-toast.vue +54 -0
- package/components/Feedback/du-tooltip/du-tooltip.types.ts +12 -0
- package/components/Feedback/du-tooltip/du-tooltip.vue +55 -0
- package/components/Layout/du-drawer/du-drawer.types.ts +27 -0
- package/components/Layout/du-drawer/du-drawer.vue +224 -0
- package/components/Layout/du-join/du-join.types.ts +7 -0
- package/components/Layout/du-join/du-join.vue +31 -0
- package/components/Navigation/du-breadcrumbs/du-breadcrumbs.types.ts +13 -0
- package/components/Navigation/du-breadcrumbs/du-breadcrumbs.vue +79 -0
- package/components/Navigation/du-button-link/du-button-link.types.ts +17 -0
- package/components/Navigation/du-button-link/du-button-link.vue +77 -0
- package/components/Navigation/du-dock/du-dock.types.ts +19 -0
- package/components/Navigation/du-dock/du-dock.vue +73 -0
- package/components/Navigation/du-link/du-link.types.ts +7 -0
- package/components/Navigation/du-link/du-link.vue +25 -0
- package/components/Navigation/du-menu/du-menu-item.vue +160 -0
- package/components/Navigation/du-menu/du-menu.types.ts +33 -0
- package/components/Navigation/du-menu/du-menu.vue +87 -0
- package/components/Navigation/du-navbar/du-navbar.types.ts +3 -0
- package/components/Navigation/du-navbar/du-navbar.vue +21 -0
- package/components/Navigation/du-pagination/du-pagination.types.ts +30 -0
- package/components/Navigation/du-pagination/du-pagination.vue +186 -0
- package/components/Navigation/du-step-item/du-step-item.types.ts +9 -0
- package/components/Navigation/du-step-item/du-step-item.vue +46 -0
- package/components/Navigation/du-steps/du-steps.types.ts +20 -0
- package/components/Navigation/du-steps/du-steps.vue +85 -0
- package/components/Navigation/du-tabs/du-tabs.types.ts +25 -0
- package/components/Navigation/du-tabs/du-tabs.vue +96 -0
- package/composables/useSizeProps.ts +26 -0
- package/composables/useVariantProps.ts +18 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/Actions/du-button/du-button.js +5 -0
- package/dist/components/Actions/du-button/du-button.types.d.ts +4 -0
- package/dist/components/Actions/du-button/du-button.vue.d.ts +58 -0
- package/dist/components/Actions/du-button/du-button.vue_vue_type_script_setup_true_lang.js +98 -0
- package/dist/components/Actions/du-dropdown/du-dropdown.js +5 -0
- package/dist/components/Actions/du-dropdown/du-dropdown.types.d.ts +4 -0
- package/dist/components/Actions/du-dropdown/du-dropdown.vue.d.ts +33 -0
- package/dist/components/Actions/du-dropdown/du-dropdown.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/components/Actions/du-fab/du-fab.js +5 -0
- package/dist/components/Actions/du-fab/du-fab.types.d.ts +24 -0
- package/dist/components/Actions/du-fab/du-fab.vue.d.ts +87 -0
- package/dist/components/Actions/du-fab/du-fab.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/Actions/du-modal/du-modal.js +5 -0
- package/dist/components/Actions/du-modal/du-modal.types.d.ts +2 -0
- package/dist/components/Actions/du-modal/du-modal.vue.d.ts +48 -0
- package/dist/components/Actions/du-modal/du-modal.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/Actions/du-swap/du-swap.js +5 -0
- package/dist/components/Actions/du-swap/du-swap.types.d.ts +2 -0
- package/dist/components/Actions/du-swap/du-swap.vue.d.ts +36 -0
- package/dist/components/Actions/du-swap/du-swap.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/components/DataDisplay/du-accordion/du-accordion-item.js +5 -0
- package/dist/components/DataDisplay/du-accordion/du-accordion-item.vue.d.ts +24 -0
- package/dist/components/DataDisplay/du-accordion/du-accordion-item.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/DataDisplay/du-accordion/du-accordion.js +5 -0
- package/dist/components/DataDisplay/du-accordion/du-accordion.types.d.ts +8 -0
- package/dist/components/DataDisplay/du-accordion/du-accordion.vue.d.ts +45 -0
- package/dist/components/DataDisplay/du-accordion/du-accordion.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/components/DataDisplay/du-avatar/du-avatar.js +7 -0
- package/dist/components/DataDisplay/du-avatar/du-avatar.types.d.ts +12 -0
- package/dist/components/DataDisplay/du-avatar/du-avatar.vue.d.ts +38 -0
- package/dist/components/DataDisplay/du-avatar/du-avatar.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/DataDisplay/du-avatar/du-avatar.vue_vue_type_style_index_0_scoped_fdc61ebe_lang.css +1 -0
- package/dist/components/DataDisplay/du-badge/du-badge.js +5 -0
- package/dist/components/DataDisplay/du-badge/du-badge.types.d.ts +4 -0
- package/dist/components/DataDisplay/du-badge/du-badge.vue.d.ts +32 -0
- package/dist/components/DataDisplay/du-badge/du-badge.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/components/DataDisplay/du-card/du-card.js +5 -0
- package/dist/components/DataDisplay/du-card/du-card.types.d.ts +4 -0
- package/dist/components/DataDisplay/du-card/du-card.vue.d.ts +43 -0
- package/dist/components/DataDisplay/du-card/du-card.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/components/DataDisplay/du-carousel/du-carousel-item.js +5 -0
- package/dist/components/DataDisplay/du-carousel/du-carousel-item.vue.d.ts +16 -0
- package/dist/components/DataDisplay/du-carousel/du-carousel-item.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/components/DataDisplay/du-carousel/du-carousel.js +5 -0
- package/dist/components/DataDisplay/du-carousel/du-carousel.types.d.ts +9 -0
- package/dist/components/DataDisplay/du-carousel/du-carousel.vue.d.ts +27 -0
- package/dist/components/DataDisplay/du-carousel/du-carousel.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/components/DataDisplay/du-chat/du-chat-item.js +5 -0
- package/dist/components/DataDisplay/du-chat/du-chat-item.vue.d.ts +32 -0
- package/dist/components/DataDisplay/du-chat/du-chat-item.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/DataDisplay/du-chat/du-chat.js +5 -0
- package/dist/components/DataDisplay/du-chat/du-chat.types.d.ts +18 -0
- package/dist/components/DataDisplay/du-chat/du-chat.vue.d.ts +38 -0
- package/dist/components/DataDisplay/du-chat/du-chat.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/components/DataDisplay/du-collapse/du-collapse.js +5 -0
- package/dist/components/DataDisplay/du-collapse/du-collapse.types.d.ts +8 -0
- package/dist/components/DataDisplay/du-collapse/du-collapse.vue.d.ts +33 -0
- package/dist/components/DataDisplay/du-collapse/du-collapse.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/components/DataDisplay/du-countdown/du-countdown-group.js +5 -0
- package/dist/components/DataDisplay/du-countdown/du-countdown-group.vue.d.ts +23 -0
- package/dist/components/DataDisplay/du-countdown/du-countdown-group.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/components/DataDisplay/du-countdown/du-countdown.js +5 -0
- package/dist/components/DataDisplay/du-countdown/du-countdown.types.d.ts +8 -0
- package/dist/components/DataDisplay/du-countdown/du-countdown.vue.d.ts +27 -0
- package/dist/components/DataDisplay/du-countdown/du-countdown.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/components/DataDisplay/du-diff/du-diff.js +5 -0
- package/dist/components/DataDisplay/du-diff/du-diff.types.d.ts +2 -0
- package/dist/components/DataDisplay/du-diff/du-diff.vue.d.ts +25 -0
- package/dist/components/DataDisplay/du-diff/du-diff.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/DataDisplay/du-kbd/du-kbd.js +5 -0
- package/dist/components/DataDisplay/du-kbd/du-kbd.types.d.ts +2 -0
- package/dist/components/DataDisplay/du-kbd/du-kbd.vue.d.ts +19 -0
- package/dist/components/DataDisplay/du-kbd/du-kbd.vue_vue_type_script_setup_true_lang.js +13 -0
- package/dist/components/DataDisplay/du-list/du-list-row.js +5 -0
- package/dist/components/DataDisplay/du-list/du-list-row.vue.d.ts +17 -0
- package/dist/components/DataDisplay/du-list/du-list-row.vue_vue_type_script_setup_true_lang.js +22 -0
- package/dist/components/DataDisplay/du-list/du-list.js +5 -0
- package/dist/components/DataDisplay/du-list/du-list.types.d.ts +3 -0
- package/dist/components/DataDisplay/du-list/du-list.vue.d.ts +14 -0
- package/dist/components/DataDisplay/du-list/du-list.vue_vue_type_script_setup_true_lang.js +12 -0
- package/dist/components/DataDisplay/du-stat/du-stat.js +5 -0
- package/dist/components/DataDisplay/du-stat/du-stat.types.d.ts +12 -0
- package/dist/components/DataDisplay/du-stat/du-stat.vue.d.ts +27 -0
- package/dist/components/DataDisplay/du-stat/du-stat.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/DataDisplay/du-stats/du-stats.js +7 -0
- package/dist/components/DataDisplay/du-stats/du-stats.types.d.ts +2 -0
- package/dist/components/DataDisplay/du-stats/du-stats.vue.d.ts +40 -0
- package/dist/components/DataDisplay/du-stats/du-stats.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/components/DataDisplay/du-stats/du-stats.vue_vue_type_style_index_0_scoped_db955aa9_lang.css +1 -0
- package/dist/components/DataDisplay/du-status/du-status.js +5 -0
- package/dist/components/DataDisplay/du-status/du-status.types.d.ts +4 -0
- package/dist/components/DataDisplay/du-status/du-status.vue.d.ts +16 -0
- package/dist/components/DataDisplay/du-status/du-status.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/components/DataDisplay/du-table/du-table-item.js +5 -0
- package/dist/components/DataDisplay/du-table/du-table-item.types.d.ts +6 -0
- package/dist/components/DataDisplay/du-table/du-table-item.vue.d.ts +19 -0
- package/dist/components/DataDisplay/du-table/du-table-item.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/DataDisplay/du-table/du-table.js +5 -0
- package/dist/components/DataDisplay/du-table/du-table.types.d.ts +23 -0
- package/dist/components/DataDisplay/du-table/du-table.vue.d.ts +42 -0
- package/dist/components/DataDisplay/du-table/du-table.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/components/DataDisplay/du-timeline/du-timeline-item.js +5 -0
- package/dist/components/DataDisplay/du-timeline/du-timeline-item.vue.d.ts +34 -0
- package/dist/components/DataDisplay/du-timeline/du-timeline-item.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/components/DataDisplay/du-timeline/du-timeline.js +5 -0
- package/dist/components/DataDisplay/du-timeline/du-timeline.types.d.ts +12 -0
- package/dist/components/DataDisplay/du-timeline/du-timeline.vue.d.ts +61 -0
- package/dist/components/DataDisplay/du-timeline/du-timeline.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/components/DataInput/du-checkbox/du-checkbox.js +5 -0
- package/dist/components/DataInput/du-checkbox/du-checkbox.types.d.ts +14 -0
- package/dist/components/DataInput/du-checkbox/du-checkbox.vue.d.ts +19 -0
- package/dist/components/DataInput/du-checkbox/du-checkbox.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/components/DataInput/du-fieldset/du-fieldset.js +5 -0
- package/dist/components/DataInput/du-fieldset/du-fieldset.types.d.ts +4 -0
- package/dist/components/DataInput/du-fieldset/du-fieldset.vue.d.ts +14 -0
- package/dist/components/DataInput/du-fieldset/du-fieldset.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/components/DataInput/du-file-input/du-file-input.js +5 -0
- package/dist/components/DataInput/du-file-input/du-file-input.types.d.ts +10 -0
- package/dist/components/DataInput/du-file-input/du-file-input.vue.d.ts +9 -0
- package/dist/components/DataInput/du-file-input/du-file-input.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/components/DataInput/du-filter/du-filter.js +5 -0
- package/dist/components/DataInput/du-filter/du-filter.types.d.ts +27 -0
- package/dist/components/DataInput/du-filter/du-filter.vue.d.ts +17 -0
- package/dist/components/DataInput/du-filter/du-filter.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/DataInput/du-input-field/du-input-field.js +5 -0
- package/dist/components/DataInput/du-input-field/du-input-field.types.d.ts +26 -0
- package/dist/components/DataInput/du-input-field/du-input-field.vue.d.ts +21 -0
- package/dist/components/DataInput/du-input-field/du-input-field.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/components/DataInput/du-label/du-label.js +5 -0
- package/dist/components/DataInput/du-label/du-label.types.d.ts +3 -0
- package/dist/components/DataInput/du-label/du-label.vue.d.ts +14 -0
- package/dist/components/DataInput/du-label/du-label.vue_vue_type_script_setup_true_lang.js +19 -0
- package/dist/components/DataInput/du-label-input-validator/du-label-input-validator.js +5 -0
- package/dist/components/DataInput/du-label-input-validator/du-label-input-validator.types.d.ts +5 -0
- package/dist/components/DataInput/du-label-input-validator/du-label-input-validator.vue.d.ts +37 -0
- package/dist/components/DataInput/du-label-input-validator/du-label-input-validator.vue_vue_type_script_setup_true_lang.js +90 -0
- package/dist/components/DataInput/du-radio/du-radio.js +5 -0
- package/dist/components/DataInput/du-radio/du-radio.types.d.ts +12 -0
- package/dist/components/DataInput/du-radio/du-radio.vue.d.ts +9 -0
- package/dist/components/DataInput/du-radio/du-radio.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/components/DataInput/du-range/du-range.js +5 -0
- package/dist/components/DataInput/du-range/du-range.types.d.ts +15 -0
- package/dist/components/DataInput/du-range/du-range.vue.d.ts +20 -0
- package/dist/components/DataInput/du-range/du-range.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/components/DataInput/du-rating/du-rating-item.js +5 -0
- package/dist/components/DataInput/du-rating/du-rating-item.vue.d.ts +15 -0
- package/dist/components/DataInput/du-rating/du-rating-item.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/DataInput/du-rating/du-rating.js +5 -0
- package/dist/components/DataInput/du-rating/du-rating.types.d.ts +38 -0
- package/dist/components/DataInput/du-rating/du-rating.vue.d.ts +34 -0
- package/dist/components/DataInput/du-rating/du-rating.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/DataInput/du-search/du-search.js +5 -0
- package/dist/components/DataInput/du-search/du-search.types.d.ts +40 -0
- package/dist/components/DataInput/du-search/du-search.vue.d.ts +52 -0
- package/dist/components/DataInput/du-search/du-search.vue_vue_type_script_setup_true_lang.js +270 -0
- package/dist/components/DataInput/du-select/du-select.js +7 -0
- package/dist/components/DataInput/du-select/du-select.types.d.ts +28 -0
- package/dist/components/DataInput/du-select/du-select.vue.d.ts +60 -0
- package/dist/components/DataInput/du-select/du-select.vue_vue_type_script_setup_true_lang.js +321 -0
- package/dist/components/DataInput/du-select/du-select.vue_vue_type_style_index_0_scoped_2bcf0acd_lang.css +1 -0
- package/dist/components/DataInput/du-text-area/du-text-area.js +5 -0
- package/dist/components/DataInput/du-text-area/du-text-area.types.d.ts +10 -0
- package/dist/components/DataInput/du-text-area/du-text-area.vue.d.ts +15 -0
- package/dist/components/DataInput/du-text-area/du-text-area.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/components/Feedback/du-alert/du-alert.js +5 -0
- package/dist/components/Feedback/du-alert/du-alert.types.d.ts +14 -0
- package/dist/components/Feedback/du-alert/du-alert.vue.d.ts +25 -0
- package/dist/components/Feedback/du-alert/du-alert.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/components/Feedback/du-loading/du-loading.js +5 -0
- package/dist/components/Feedback/du-loading/du-loading.types.d.ts +9 -0
- package/dist/components/Feedback/du-loading/du-loading.vue.d.ts +8 -0
- package/dist/components/Feedback/du-loading/du-loading.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/Feedback/du-progress/du-progress.js +5 -0
- package/dist/components/Feedback/du-progress/du-progress.types.d.ts +7 -0
- package/dist/components/Feedback/du-progress/du-progress.vue.d.ts +9 -0
- package/dist/components/Feedback/du-progress/du-progress.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/components/Feedback/du-radial-progress/du-radial-progress.js +7 -0
- package/dist/components/Feedback/du-radial-progress/du-radial-progress.types.d.ts +8 -0
- package/dist/components/Feedback/du-radial-progress/du-radial-progress.vue.d.ts +19 -0
- package/dist/components/Feedback/du-radial-progress/du-radial-progress.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/components/Feedback/du-radial-progress/du-radial-progress.vue_vue_type_style_index_0_scoped_4d489040_lang.css +1 -0
- package/dist/components/Feedback/du-skeleton/du-skeleton.js +5 -0
- package/dist/components/Feedback/du-skeleton/du-skeleton.types.d.ts +3 -0
- package/dist/components/Feedback/du-skeleton/du-skeleton.vue.d.ts +14 -0
- package/dist/components/Feedback/du-skeleton/du-skeleton.vue_vue_type_script_setup_true_lang.js +12 -0
- package/dist/components/Feedback/du-toast/du-toast.js +5 -0
- package/dist/components/Feedback/du-toast/du-toast.types.d.ts +9 -0
- package/dist/components/Feedback/du-toast/du-toast.vue.d.ts +20 -0
- package/dist/components/Feedback/du-toast/du-toast.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/components/Feedback/du-tooltip/du-tooltip.js +5 -0
- package/dist/components/Feedback/du-tooltip/du-tooltip.types.d.ts +10 -0
- package/dist/components/Feedback/du-tooltip/du-tooltip.vue.d.ts +22 -0
- package/dist/components/Feedback/du-tooltip/du-tooltip.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/components/Layout/du-drawer/du-drawer.js +5 -0
- package/dist/components/Layout/du-drawer/du-drawer.types.d.ts +23 -0
- package/dist/components/Layout/du-drawer/du-drawer.vue.d.ts +58 -0
- package/dist/components/Layout/du-drawer/du-drawer.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/components/Layout/du-join/du-join.js +5 -0
- package/dist/components/Layout/du-join/du-join.types.d.ts +6 -0
- package/dist/components/Layout/du-join/du-join.vue.d.ts +17 -0
- package/dist/components/Layout/du-join/du-join.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/components/Navigation/du-breadcrumbs/du-breadcrumbs.js +7 -0
- package/dist/components/Navigation/du-breadcrumbs/du-breadcrumbs.types.d.ts +11 -0
- package/dist/components/Navigation/du-breadcrumbs/du-breadcrumbs.vue.d.ts +6 -0
- package/dist/components/Navigation/du-breadcrumbs/du-breadcrumbs.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/components/Navigation/du-breadcrumbs/du-breadcrumbs.vue_vue_type_style_index_0_scoped_9364edec_lang.css +1 -0
- package/dist/components/Navigation/du-button-link/du-button-link.js +5 -0
- package/dist/components/Navigation/du-button-link/du-button-link.types.d.ts +16 -0
- package/dist/components/Navigation/du-button-link/du-button-link.vue.d.ts +27 -0
- package/dist/components/Navigation/du-button-link/du-button-link.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/Navigation/du-dock/du-dock.js +5 -0
- package/dist/components/Navigation/du-dock/du-dock.types.d.ts +16 -0
- package/dist/components/Navigation/du-dock/du-dock.vue.d.ts +59 -0
- package/dist/components/Navigation/du-dock/du-dock.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/components/Navigation/du-link/du-link.js +5 -0
- package/dist/components/Navigation/du-link/du-link.types.d.ts +6 -0
- package/dist/components/Navigation/du-link/du-link.vue.d.ts +18 -0
- package/dist/components/Navigation/du-link/du-link.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/components/Navigation/du-menu/du-menu-item.js +5 -0
- package/dist/components/Navigation/du-menu/du-menu-item.vue.d.ts +17 -0
- package/dist/components/Navigation/du-menu/du-menu-item.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/Navigation/du-menu/du-menu.js +6 -0
- package/dist/components/Navigation/du-menu/du-menu.types.d.ts +29 -0
- package/dist/components/Navigation/du-menu/du-menu.vue.d.ts +26 -0
- package/dist/components/Navigation/du-menu/du-menu.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/components/Navigation/du-menu/du-menu.vue_vue_type_style_index_0_lang.css +1 -0
- package/dist/components/Navigation/du-navbar/du-navbar.js +5 -0
- package/dist/components/Navigation/du-navbar/du-navbar.types.d.ts +2 -0
- package/dist/components/Navigation/du-navbar/du-navbar.vue.d.ts +20 -0
- package/dist/components/Navigation/du-navbar/du-navbar.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/components/Navigation/du-pagination/du-pagination.js +7 -0
- package/dist/components/Navigation/du-pagination/du-pagination.types.d.ts +29 -0
- package/dist/components/Navigation/du-pagination/du-pagination.vue.d.ts +51 -0
- package/dist/components/Navigation/du-pagination/du-pagination.vue_vue_type_script_setup_true_lang.js +156 -0
- package/dist/components/Navigation/du-pagination/du-pagination.vue_vue_type_style_index_0_scoped_7407b690_lang.css +1 -0
- package/dist/components/Navigation/du-step-item/du-step-item.js +5 -0
- package/dist/components/Navigation/du-step-item/du-step-item.types.d.ts +8 -0
- package/dist/components/Navigation/du-step-item/du-step-item.vue.d.ts +24 -0
- package/dist/components/Navigation/du-step-item/du-step-item.vue_vue_type_script_setup_true_lang.js +27 -0
- package/dist/components/Navigation/du-steps/du-steps.js +5 -0
- package/dist/components/Navigation/du-steps/du-steps.types.d.ts +17 -0
- package/dist/components/Navigation/du-steps/du-steps.vue.d.ts +40 -0
- package/dist/components/Navigation/du-steps/du-steps.vue_vue_type_script_setup_true_lang.js +44 -0
- package/dist/components/Navigation/du-tabs/du-tabs.js +5 -0
- package/dist/components/Navigation/du-tabs/du-tabs.types.d.ts +22 -0
- package/dist/components/Navigation/du-tabs/du-tabs.vue.d.ts +50 -0
- package/dist/components/Navigation/du-tabs/du-tabs.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/composables/useSizeProps.d.ts +15 -0
- package/dist/composables/useSizeProps.js +22 -0
- package/dist/composables/useVariantProps.d.ts +14 -0
- package/dist/composables/useVariantProps.js +7 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +65 -0
- package/dist/plugin-vite.d.ts +64 -0
- package/dist/plugin-vite.js +137 -0
- package/dist/types/index.d.ts +58 -0
- package/index.css +5 -0
- package/index.ts +69 -0
- package/package.json +99 -0
- package/plugin-vite.ts +286 -0
- package/types/index.ts +59 -0
- package/types/types.sh +80 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { inject, computed } from "vue";
|
|
3
|
+
import { type RatingItemProps, type RatingItemEmits } from "./du-rating.types";
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(
|
|
6
|
+
defineProps<RatingItemProps>(),
|
|
7
|
+
{
|
|
8
|
+
value: 0,
|
|
9
|
+
checked: false,
|
|
10
|
+
disabled: false,
|
|
11
|
+
shape: "star-2",
|
|
12
|
+
halfMask: undefined,
|
|
13
|
+
customClass: "",
|
|
14
|
+
},
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits<RatingItemEmits>();
|
|
18
|
+
|
|
19
|
+
const ratingName = inject("ratingName", "");
|
|
20
|
+
|
|
21
|
+
const handleChange = () => {
|
|
22
|
+
emit("change", props.value);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const shapeClass = computed(() => {
|
|
26
|
+
switch (props.shape) {
|
|
27
|
+
case "star":
|
|
28
|
+
return "mask-star";
|
|
29
|
+
case "star-2":
|
|
30
|
+
return "mask-star-2";
|
|
31
|
+
case "heart":
|
|
32
|
+
return "mask-heart";
|
|
33
|
+
case "circle":
|
|
34
|
+
return "mask-circle";
|
|
35
|
+
default:
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const maskClass = computed(() => {
|
|
41
|
+
const classes = ["mask", shapeClass.value, props.color];
|
|
42
|
+
|
|
43
|
+
if (props.halfMask) {
|
|
44
|
+
classes.push((props.halfMask == 1)?`mask-half-1`:`mask-half-2`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (props.customClass) {
|
|
48
|
+
classes.push(props.customClass);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return classes;
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<input
|
|
57
|
+
type="radio"
|
|
58
|
+
:name="ratingName"
|
|
59
|
+
:class="maskClass"
|
|
60
|
+
:checked="checked"
|
|
61
|
+
@click="handleChange"
|
|
62
|
+
:disabled="disabled"
|
|
63
|
+
:aria-label="`${value} star`"
|
|
64
|
+
/>
|
|
65
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Size } from "../../../composables/useSizeProps";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export const RATING_SIZES = ["rating-xs", "rating-sm", "rating-md", "rating-lg", "rating-xl"] as const;
|
|
5
|
+
export type RatingSize = (typeof RATING_SIZES)[number];
|
|
6
|
+
export interface RatingItem {
|
|
7
|
+
value: number;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const DU_RATING_SHAPES = ["star", "star-2", "heart", "circle"] as const;
|
|
12
|
+
export type RatingShape = (typeof DU_RATING_SHAPES)[number];
|
|
13
|
+
|
|
14
|
+
export interface RatingProps {
|
|
15
|
+
modelValue?: number;
|
|
16
|
+
items?: RatingItem[];
|
|
17
|
+
count?: number;
|
|
18
|
+
name?: string;
|
|
19
|
+
halfStar?: boolean;
|
|
20
|
+
clearable?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
size?: Size;
|
|
23
|
+
shape?: RatingShape;
|
|
24
|
+
color?: string;
|
|
25
|
+
customClass?: string;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface RatingItemProps {
|
|
30
|
+
value?: number;
|
|
31
|
+
checked?: boolean;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
shape?: RatingShape;
|
|
34
|
+
color?: string;
|
|
35
|
+
halfMask?: 1 | 2;
|
|
36
|
+
customClass?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface RatingEmits {
|
|
40
|
+
(e: "update:modelValue", value: number): void;
|
|
41
|
+
(e: "change", value: number): void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RatingItemEmits {
|
|
45
|
+
(e: "change", value: number): void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, provide, ref, watch } from "vue";
|
|
3
|
+
import { useSizeMapping } from "../../../composables/useSizeProps";
|
|
4
|
+
import DuRatingItem from "./du-rating-item.vue";
|
|
5
|
+
import { type RatingProps, type RatingEmits } from "./du-rating.types";
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<RatingProps>(),
|
|
9
|
+
{
|
|
10
|
+
modelValue: 0,
|
|
11
|
+
items: undefined,
|
|
12
|
+
count: 5,
|
|
13
|
+
name: undefined,
|
|
14
|
+
halfStar: false,
|
|
15
|
+
clearable: false,
|
|
16
|
+
disabled: false,
|
|
17
|
+
shape: "star-2",
|
|
18
|
+
color: "bg-secondary",
|
|
19
|
+
customClass: "",
|
|
20
|
+
size: "md"
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const emit = defineEmits<RatingEmits>();
|
|
25
|
+
|
|
26
|
+
const internalValue = ref(props.modelValue);
|
|
27
|
+
|
|
28
|
+
watch(
|
|
29
|
+
() => props.modelValue,
|
|
30
|
+
(newValue) => {
|
|
31
|
+
internalValue.value = newValue;
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const ratingName = computed(() => {
|
|
36
|
+
return props.name || `rating-${Math.random().toString(36).substring(2, 9)}`;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
provide("ratingName", ratingName.value);
|
|
40
|
+
|
|
41
|
+
const { sizeClass } = useSizeMapping(props, "rating");
|
|
42
|
+
|
|
43
|
+
const handleChange = (value: number) => {
|
|
44
|
+
if (props.disabled) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (value === internalValue.value && props.clearable) {
|
|
48
|
+
internalValue.value = 0;
|
|
49
|
+
emit("update:modelValue", 0);
|
|
50
|
+
emit("change", 0);
|
|
51
|
+
} else {
|
|
52
|
+
internalValue.value = value;
|
|
53
|
+
emit("update:modelValue", value);
|
|
54
|
+
emit("change", value);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const ratingClass = computed(() => {
|
|
59
|
+
const classes = ["rating"];
|
|
60
|
+
|
|
61
|
+
if (props.halfStar) {
|
|
62
|
+
classes.push("rating-half");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (sizeClass.value) {
|
|
66
|
+
classes.push(sizeClass.value);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (props.customClass) {
|
|
70
|
+
classes.push(props.customClass);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return classes;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
defineExpose({
|
|
77
|
+
value: computed(() => internalValue.value),
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<template>
|
|
82
|
+
<!-- Dynamic items mode -->
|
|
83
|
+
<div v-if="items && !$slots.default" :class="ratingClass">
|
|
84
|
+
<template v-for="(item, index) in items" :key="index">
|
|
85
|
+
<DuRatingItem
|
|
86
|
+
:value="item.value"
|
|
87
|
+
:checked="internalValue === item.value"
|
|
88
|
+
:shape="shape"
|
|
89
|
+
:color="color"
|
|
90
|
+
:half-mask="(halfStar && index % 2 === 0) ? 1 : (halfStar && index % 2 === 1) ? 2 : undefined"
|
|
91
|
+
:disabled="disabled"
|
|
92
|
+
@change="handleChange"
|
|
93
|
+
/>
|
|
94
|
+
</template>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<!-- Auto-generated mode -->
|
|
98
|
+
<div v-else-if="count > 0 && !$slots.default" :class="ratingClass">
|
|
99
|
+
<template v-for="i in count" :key="i">
|
|
100
|
+
<DuRatingItem
|
|
101
|
+
v-if="halfStar"
|
|
102
|
+
:value="i - 0.5"
|
|
103
|
+
:checked="internalValue === i - 0.5"
|
|
104
|
+
:shape="shape"
|
|
105
|
+
:color="color"
|
|
106
|
+
:half-mask="1"
|
|
107
|
+
:disabled="disabled"
|
|
108
|
+
@change="handleChange"
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
<DuRatingItem
|
|
112
|
+
:value="i"
|
|
113
|
+
:checked="internalValue === i"
|
|
114
|
+
:shape="shape"
|
|
115
|
+
:color="color"
|
|
116
|
+
:half-mask="halfStar ? 2 : undefined"
|
|
117
|
+
:disabled="disabled"
|
|
118
|
+
@change="handleChange"
|
|
119
|
+
/>
|
|
120
|
+
</template>
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<!-- Manual mode -->
|
|
124
|
+
<div v-else :class="ratingClass">
|
|
125
|
+
<slot></slot>
|
|
126
|
+
</div>
|
|
127
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type Size } from "../../../composables/useSizeProps"
|
|
2
|
+
import { type Variant } from "../../../composables/useVariantProps"
|
|
3
|
+
|
|
4
|
+
export const SEARCH_VARIANTS = ['default', 'input-primary', 'input-secondary', 'input-accent', 'input-info', 'input-success', 'input-warning', 'input-error'] as const
|
|
5
|
+
export const SEARCH_SIZES = ['default', 'input-xs', 'input-sm', 'input-md', 'input-lg', 'input-xl'] as const
|
|
6
|
+
|
|
7
|
+
export type SEARCHVariant = (typeof SEARCH_VARIANTS)[number]
|
|
8
|
+
export type SEARCHSize = (typeof SEARCH_SIZES)[number]
|
|
9
|
+
|
|
10
|
+
export interface SearchOption {
|
|
11
|
+
id: any
|
|
12
|
+
name: string
|
|
13
|
+
[key: string]: any
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SEARCHProps {
|
|
17
|
+
modelValue?: any | any[]
|
|
18
|
+
name: string
|
|
19
|
+
id: string
|
|
20
|
+
placeholder?: string
|
|
21
|
+
listValues: SearchOption[]
|
|
22
|
+
limit?: number
|
|
23
|
+
addOption?: boolean
|
|
24
|
+
/** Label prefix shown before the query in the "add option" entry (default: 'Add') */
|
|
25
|
+
addOptionText?: string
|
|
26
|
+
/** Text shown when no option matches the query (default: 'No results') */
|
|
27
|
+
noResultsText?: string
|
|
28
|
+
autoCommit?: boolean
|
|
29
|
+
/** Disables internal filtering — results come from an external search */
|
|
30
|
+
remoteSearch?: boolean
|
|
31
|
+
/** Option key used as the displayed label (default: 'name') */
|
|
32
|
+
labelBy?: string
|
|
33
|
+
type?: string
|
|
34
|
+
required?: boolean
|
|
35
|
+
pattern?: string
|
|
36
|
+
multiple?: boolean
|
|
37
|
+
size?: Size
|
|
38
|
+
subSize?: Size
|
|
39
|
+
variant?: Variant
|
|
40
|
+
ghost?: boolean
|
|
41
|
+
disabled?: boolean
|
|
42
|
+
customClass?: string
|
|
43
|
+
clearable?: boolean
|
|
44
|
+
}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, computed, reactive, nextTick, onMounted, onBeforeUnmount, watch } from "vue"
|
|
3
|
+
import { useSizeMapping, type Size } from "../../../composables/useSizeProps"
|
|
4
|
+
import { useVariantMapping } from "../../../composables/useVariantProps"
|
|
5
|
+
import type { SEARCHProps, SearchOption } from "./du-search.types"
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(defineProps<SEARCHProps>(), {
|
|
8
|
+
size: "default",
|
|
9
|
+
subSize: undefined,
|
|
10
|
+
variant: "default",
|
|
11
|
+
type: "text",
|
|
12
|
+
ghost: false,
|
|
13
|
+
disabled: false,
|
|
14
|
+
addOption: false,
|
|
15
|
+
addOptionText: 'Add',
|
|
16
|
+
noResultsText: 'No results',
|
|
17
|
+
autoCommit: false,
|
|
18
|
+
remoteSearch: false,
|
|
19
|
+
labelBy: "name",
|
|
20
|
+
required: false,
|
|
21
|
+
multiple: false,
|
|
22
|
+
clearable: false,
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const { sizeClass } = useSizeMapping(props, 'input')
|
|
26
|
+
const subSizeProps = reactive({ get size(): Size { return props.subSize ?? props.size } })
|
|
27
|
+
const { sizeClass: subSizeClass } = useSizeMapping(subSizeProps, 'menu')
|
|
28
|
+
const { colorClass } = useVariantMapping(props, 'input')
|
|
29
|
+
|
|
30
|
+
const computedInputClass = computed(() => {
|
|
31
|
+
const classes = ['input', 'input-bordered', 'w-full', 'focus:invalid:input-error']
|
|
32
|
+
|
|
33
|
+
if (props.size !== 'default' && sizeClass.value) {
|
|
34
|
+
classes.push(sizeClass.value)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (props.variant !== 'default' && colorClass.value !== 'input-default') {
|
|
38
|
+
classes.push(colorClass.value)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (props.ghost) {
|
|
42
|
+
classes.push('input-ghost')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (props.customClass) {
|
|
46
|
+
classes.push(props.customClass)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return classes.join(' ')
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const emit = defineEmits<{
|
|
53
|
+
'update:modelValue': [value: any]
|
|
54
|
+
select: [option: SearchOption]
|
|
55
|
+
remove: [option: SearchOption]
|
|
56
|
+
add: [option: SearchOption]
|
|
57
|
+
query: [query: string]
|
|
58
|
+
}>()
|
|
59
|
+
|
|
60
|
+
const labelField = computed(() => props.labelBy ?? "name")
|
|
61
|
+
|
|
62
|
+
const selectedValues = ref<any[]>([])
|
|
63
|
+
watch(
|
|
64
|
+
() => props.modelValue,
|
|
65
|
+
(val) => {
|
|
66
|
+
if (props.multiple) {
|
|
67
|
+
selectedValues.value = Array.isArray(val) ? [...val] : []
|
|
68
|
+
} else {
|
|
69
|
+
selectedValues.value = val ? [val] : []
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{ immediate: true }
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
const open = ref(false)
|
|
76
|
+
const query = ref("")
|
|
77
|
+
const highlightedIndex = ref(-1)
|
|
78
|
+
const isEditing = ref(false)
|
|
79
|
+
const root = ref<HTMLElement | null>(null)
|
|
80
|
+
const listId = `du-search-list-${Math.random().toString(36).slice(2, 9)}`
|
|
81
|
+
|
|
82
|
+
const queryValue = computed(() =>
|
|
83
|
+
query.value === "" ? null : { id: null, name: query.value }
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
const filteredValues = computed(() => {
|
|
87
|
+
let values = props.listValues
|
|
88
|
+
if (query.value && !props.remoteSearch) {
|
|
89
|
+
values = values.filter((el) =>
|
|
90
|
+
el.name.toLowerCase().includes(query.value.toLowerCase())
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
if (props.limit) {
|
|
94
|
+
return values.slice(0, props.limit)
|
|
95
|
+
}
|
|
96
|
+
return values
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
const inputValue = computed(() => {
|
|
100
|
+
if (props.multiple) {
|
|
101
|
+
const selectedPart = selectedValues.value.map((v) => v[labelField.value]).join(", ")
|
|
102
|
+
if (selectedPart && query.value) {
|
|
103
|
+
return `${selectedPart}, ${query.value}`
|
|
104
|
+
} else if (selectedPart) {
|
|
105
|
+
return selectedPart
|
|
106
|
+
} else {
|
|
107
|
+
return query.value
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (isEditing.value) {
|
|
111
|
+
return query.value
|
|
112
|
+
}
|
|
113
|
+
return selectedValues.value[0]?.[labelField.value] || ""
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
function isSelected(option: SearchOption) {
|
|
117
|
+
if (props.multiple) {
|
|
118
|
+
return selectedValues.value.some((v) => v.id === option.id && v.name === option.name)
|
|
119
|
+
} else {
|
|
120
|
+
const selected = selectedValues.value[0]
|
|
121
|
+
return selected && selected.id === option.id && selected.name === option.name
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function updateModel() {
|
|
126
|
+
if (props.multiple) {
|
|
127
|
+
emit("update:modelValue", [...selectedValues.value])
|
|
128
|
+
} else {
|
|
129
|
+
emit("update:modelValue", selectedValues.value[0] ?? null)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function selectValue(val: any) {
|
|
134
|
+
const isNew = props.addOption && val.id === null
|
|
135
|
+
if (props.multiple) {
|
|
136
|
+
if (!selectedValues.value.find((v) => v.id === val.id && v.name === val.name)) {
|
|
137
|
+
selectedValues.value.push(val)
|
|
138
|
+
if (isNew) emit("add", val)
|
|
139
|
+
else emit("select", val)
|
|
140
|
+
updateModel()
|
|
141
|
+
}
|
|
142
|
+
query.value = ""
|
|
143
|
+
} else {
|
|
144
|
+
selectedValues.value = [val]
|
|
145
|
+
if (isNew) emit("add", val)
|
|
146
|
+
else emit("select", val)
|
|
147
|
+
updateModel()
|
|
148
|
+
open.value = false
|
|
149
|
+
query.value = ""
|
|
150
|
+
isEditing.value = false
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function deselectValue(val: SearchOption) {
|
|
155
|
+
if (props.multiple) {
|
|
156
|
+
const idx = selectedValues.value.findIndex((v) => v.id === val.id && v.name === val.name)
|
|
157
|
+
if (idx > -1) {
|
|
158
|
+
selectedValues.value.splice(idx, 1)
|
|
159
|
+
emit('remove', val)
|
|
160
|
+
updateModel()
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
selectedValues.value = []
|
|
164
|
+
updateModel()
|
|
165
|
+
open.value = false
|
|
166
|
+
query.value = ''
|
|
167
|
+
isEditing.value = false
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function handleOptionClick(val: SearchOption) {
|
|
172
|
+
if (props.clearable && isSelected(val)) {
|
|
173
|
+
deselectValue(val)
|
|
174
|
+
} else {
|
|
175
|
+
selectValue(val)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function onInput(e: Event) {
|
|
180
|
+
const val = (e.target as HTMLInputElement).value
|
|
181
|
+
|
|
182
|
+
// In single mode, start editing as soon as the user types
|
|
183
|
+
if (!props.multiple) {
|
|
184
|
+
isEditing.value = true
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (props.multiple) {
|
|
188
|
+
// Rebuild the selected-values part of the input
|
|
189
|
+
const selectedPart = selectedValues.value.map((v) => v.name).join(", ")
|
|
190
|
+
|
|
191
|
+
// Extract the query by stripping the selected-values part
|
|
192
|
+
let newQuery = ""
|
|
193
|
+
if (selectedPart && val.startsWith(selectedPart)) {
|
|
194
|
+
// Strip the selected part plus the trailing comma and space
|
|
195
|
+
const remainder = val.slice(selectedPart.length)
|
|
196
|
+
if (remainder.startsWith(", ")) {
|
|
197
|
+
newQuery = remainder.slice(2) // Strip ", "
|
|
198
|
+
} else if (remainder === "") {
|
|
199
|
+
newQuery = ""
|
|
200
|
+
} else {
|
|
201
|
+
// Editing right after the selected values
|
|
202
|
+
newQuery = remainder
|
|
203
|
+
}
|
|
204
|
+
} else if (!selectedPart) {
|
|
205
|
+
// No selected value, the whole input is the query
|
|
206
|
+
newQuery = val
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// A comma in the query adds a new value
|
|
210
|
+
if (newQuery.includes(",")) {
|
|
211
|
+
const parts = newQuery.split(",").map((p) => p.trim()).filter(Boolean)
|
|
212
|
+
const lastPart = parts.pop()
|
|
213
|
+
|
|
214
|
+
for (const part of parts) {
|
|
215
|
+
const match = props.listValues.find(
|
|
216
|
+
(o) => o.name.toLowerCase() === part.toLowerCase()
|
|
217
|
+
)
|
|
218
|
+
if (match && !selectedValues.value.some((v) => v.id === match.id)) {
|
|
219
|
+
selectedValues.value.push(match)
|
|
220
|
+
emit("select", match)
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
updateModel()
|
|
224
|
+
query.value = lastPart ?? ""
|
|
225
|
+
} else {
|
|
226
|
+
query.value = newQuery
|
|
227
|
+
}
|
|
228
|
+
} else {
|
|
229
|
+
query.value = val
|
|
230
|
+
// In single mode, an empty input clears the selection
|
|
231
|
+
if (val === "") {
|
|
232
|
+
selectedValues.value = []
|
|
233
|
+
updateModel()
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
emit("query", query.value)
|
|
238
|
+
open.value = true
|
|
239
|
+
highlightedIndex.value = 0
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function onKeydown(e: KeyboardEvent) {
|
|
243
|
+
const len =
|
|
244
|
+
filteredValues.value.length + (props.addOption && queryValue.value ? 1 : 0)
|
|
245
|
+
|
|
246
|
+
if (!open.value && ["ArrowDown", "ArrowUp", "Enter", " "].includes(e.key)) {
|
|
247
|
+
open.value = true
|
|
248
|
+
e.preventDefault()
|
|
249
|
+
return
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (e.key === "ArrowDown") {
|
|
253
|
+
highlightedIndex.value = (highlightedIndex.value + 1 + len) % len
|
|
254
|
+
scrollHighlightedIntoView()
|
|
255
|
+
e.preventDefault()
|
|
256
|
+
} else if (e.key === "ArrowUp") {
|
|
257
|
+
highlightedIndex.value = (highlightedIndex.value - 1 + len) % len
|
|
258
|
+
scrollHighlightedIntoView()
|
|
259
|
+
e.preventDefault()
|
|
260
|
+
} else if (e.key === "Enter") {
|
|
261
|
+
if (highlightedIndex.value >= 0 && highlightedIndex.value < len) {
|
|
262
|
+
if (props.addOption && queryValue.value) {
|
|
263
|
+
if (highlightedIndex.value === 0) {
|
|
264
|
+
selectValue(queryValue.value)
|
|
265
|
+
} else {
|
|
266
|
+
handleOptionClick(filteredValues.value[highlightedIndex.value - 1])
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
handleOptionClick(filteredValues.value[highlightedIndex.value])
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
e.preventDefault()
|
|
273
|
+
} else if (e.key === "Escape") {
|
|
274
|
+
open.value = false
|
|
275
|
+
highlightedIndex.value = -1
|
|
276
|
+
// In single mode, stop editing
|
|
277
|
+
if (!props.multiple && isEditing.value) {
|
|
278
|
+
// If the query is empty, keep the selection empty
|
|
279
|
+
if (query.value === "") {
|
|
280
|
+
selectedValues.value = []
|
|
281
|
+
updateModel()
|
|
282
|
+
}
|
|
283
|
+
isEditing.value = false
|
|
284
|
+
query.value = ""
|
|
285
|
+
}
|
|
286
|
+
e.preventDefault()
|
|
287
|
+
} else if (e.key === "Backspace" && props.multiple) {
|
|
288
|
+
// Only remove a selected value when the query is empty
|
|
289
|
+
if (query.value === "" && selectedValues.value.length > 0) {
|
|
290
|
+
const removed = selectedValues.value.pop()
|
|
291
|
+
emit("remove", removed)
|
|
292
|
+
updateModel()
|
|
293
|
+
e.preventDefault()
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function scrollHighlightedIntoView() {
|
|
299
|
+
nextTick(() => {
|
|
300
|
+
const list = root.value?.querySelector(`#${listId}`)
|
|
301
|
+
const active = list?.querySelectorAll("li")[highlightedIndex.value]
|
|
302
|
+
if (active && "scrollIntoView" in active) {
|
|
303
|
+
; (active as HTMLElement).scrollIntoView({ block: "nearest" })
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function commitQuery() {
|
|
309
|
+
if (query.value === "") {
|
|
310
|
+
selectedValues.value = []
|
|
311
|
+
updateModel()
|
|
312
|
+
return
|
|
313
|
+
}
|
|
314
|
+
const match = props.listValues.find(
|
|
315
|
+
o => String(o[labelField.value]).toLowerCase() === query.value.toLowerCase()
|
|
316
|
+
)
|
|
317
|
+
if (match) {
|
|
318
|
+
selectValue(match)
|
|
319
|
+
} else if (props.remoteSearch && props.listValues.length > 0) {
|
|
320
|
+
// Remote search: select the best (first) result
|
|
321
|
+
selectValue(props.listValues[0])
|
|
322
|
+
} else if (props.addOption) {
|
|
323
|
+
selectValue({ id: null, name: query.value })
|
|
324
|
+
} else {
|
|
325
|
+
selectedValues.value = []
|
|
326
|
+
updateModel()
|
|
327
|
+
}
|
|
328
|
+
isEditing.value = false
|
|
329
|
+
query.value = ""
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function onBlurCleanup() {
|
|
333
|
+
if (!props.multiple && isEditing.value) {
|
|
334
|
+
if (props.autoCommit) {
|
|
335
|
+
commitQuery()
|
|
336
|
+
} else {
|
|
337
|
+
if (query.value === "") {
|
|
338
|
+
selectedValues.value = []
|
|
339
|
+
updateModel()
|
|
340
|
+
}
|
|
341
|
+
isEditing.value = false
|
|
342
|
+
query.value = ""
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function onClickOutside(e: MouseEvent) {
|
|
348
|
+
if (!root.value) return
|
|
349
|
+
if (!root.value.contains(e.target as Node)) {
|
|
350
|
+
open.value = false
|
|
351
|
+
onBlurCleanup()
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function onFocusOut(_e: FocusEvent) {
|
|
356
|
+
setTimeout(() => {
|
|
357
|
+
if (!root.value) return
|
|
358
|
+
|
|
359
|
+
const activeElement = document.activeElement
|
|
360
|
+
if (!activeElement || !root.value.contains(activeElement)) {
|
|
361
|
+
open.value = false
|
|
362
|
+
onBlurCleanup()
|
|
363
|
+
}
|
|
364
|
+
}, 0)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function onFocus(_e: FocusEvent) {
|
|
368
|
+
if (!open.value) {
|
|
369
|
+
open.value = true
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
onMounted(() => {
|
|
374
|
+
document.addEventListener("click", onClickOutside)
|
|
375
|
+
root.value?.addEventListener('focusout', onFocusOut)
|
|
376
|
+
})
|
|
377
|
+
onBeforeUnmount(() => {
|
|
378
|
+
document.removeEventListener("click", onClickOutside)
|
|
379
|
+
root.value?.removeEventListener('focusout', onFocusOut)
|
|
380
|
+
})
|
|
381
|
+
</script>
|
|
382
|
+
|
|
383
|
+
<template>
|
|
384
|
+
<div ref="root" class="relative" role="combobox" :aria-expanded="open" :aria-owns="listId" @focus="onFocus">
|
|
385
|
+
<input :id="id" :name="name" :type="props.type" :required="props.required" :pattern="props.pattern"
|
|
386
|
+
:placeholder="placeholder" :class="computedInputClass" :disabled="props.disabled" autocomplete="off"
|
|
387
|
+
:value="inputValue" @input="onInput" @focus="open = true" @keydown="onKeydown" aria-autocomplete="list"
|
|
388
|
+
:aria-controls="listId" />
|
|
389
|
+
|
|
390
|
+
<transition enter-active-class="transition ease-out duration-100" enter-from-class="opacity-0 scale-95"
|
|
391
|
+
enter-to-class="opacity-100 scale-100" leave-active-class="transition ease-in duration-75"
|
|
392
|
+
leave-from-class="opacity-100 scale-100" leave-to-class="opacity-0 scale-95">
|
|
393
|
+
<ul v-if="open" :id="listId"
|
|
394
|
+
class=" dropdown-content absolute mt-1 max-h-60 w-full overflow-auto rounded-box bg-base-100 shadow z-50 menu flex-nowrap gap-0.5"
|
|
395
|
+
:class="[subSizeClass]"
|
|
396
|
+
role="listbox">
|
|
397
|
+
<li v-if="props.addOption && queryValue" class="cursor-pointer rounded" :class="{
|
|
398
|
+
'bg-base-300': highlightedIndex === 0
|
|
399
|
+
}" role="option" :aria-selected="(highlightedIndex === 0)" @mousedown="selectValue(queryValue)">
|
|
400
|
+
<slot name="add-option" :query="query">{{ addOptionText }} "{{ query }}"</slot>
|
|
401
|
+
</li>
|
|
402
|
+
|
|
403
|
+
<li v-if="!props.addOption && filteredValues.length === 0" class=" text-gray-400">
|
|
404
|
+
<slot name="no-results">{{ noResultsText }}</slot>
|
|
405
|
+
</li>
|
|
406
|
+
|
|
407
|
+
<li v-for="(val, i) in filteredValues" :key="val.id" class="block w-full rounded-box" :class="{
|
|
408
|
+
'bg-primary text-primary-content': isSelected(val),
|
|
409
|
+
'bg-base-300': highlightedIndex === (props.addOption && queryValue ? i + 1 : i) && !isSelected(val),
|
|
410
|
+
'bg-primary/75': isSelected(val) && highlightedIndex === (props.addOption && queryValue ? i + 1 : i)
|
|
411
|
+
}" role="option" :aria-selected="(highlightedIndex === (props.addOption && queryValue ? i + 1 : i))"
|
|
412
|
+
@mousedown="handleOptionClick(val)"
|
|
413
|
+
@mouseover.prevent="highlightedIndex = (props.addOption && queryValue ? i + 1 : i)">
|
|
414
|
+
<a class="flex items-center gap-3 bg-transparent">
|
|
415
|
+
<slot name="option" :option="val" :index="i">
|
|
416
|
+
{{ val[labelField] }}
|
|
417
|
+
</slot>
|
|
418
|
+
<span v-if="clearable && isSelected(val)" class="ml-auto opacity-60 hover:opacity-100" aria-hidden="true">✕</span>
|
|
419
|
+
</a>
|
|
420
|
+
|
|
421
|
+
</li>
|
|
422
|
+
</ul>
|
|
423
|
+
</transition>
|
|
424
|
+
</div>
|
|
425
|
+
</template>
|