@winkintel/bootstrap-svelte 0.0.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.md +202 -0
- package/README.md +221 -0
- package/dist/Accordion/accordion-body.svelte +8 -0
- package/dist/Accordion/accordion-body.svelte.d.ts +4 -0
- package/dist/Accordion/accordion-button.svelte +25 -0
- package/dist/Accordion/accordion-button.svelte.d.ts +4 -0
- package/dist/Accordion/accordion-collapse.svelte +18 -0
- package/dist/Accordion/accordion-collapse.svelte.d.ts +4 -0
- package/dist/Accordion/accordion-header.svelte +8 -0
- package/dist/Accordion/accordion-header.svelte.d.ts +4 -0
- package/dist/Accordion/accordion-item.svelte +33 -0
- package/dist/Accordion/accordion-item.svelte.d.ts +4 -0
- package/dist/Accordion/accordion.svelte +65 -0
- package/dist/Accordion/accordion.svelte.d.ts +51 -0
- package/dist/Accordion/accordion.svelte.js +139 -0
- package/dist/Accordion/composition.d.ts +7 -0
- package/dist/Accordion/composition.js +6 -0
- package/dist/Accordion/index.d.ts +1 -0
- package/dist/Accordion/index.js +1 -0
- package/dist/Accordion/types.d.ts +15 -0
- package/dist/Accordion/types.js +1 -0
- package/dist/Alert/alert.svelte +73 -0
- package/dist/Alert/alert.svelte.d.ts +46 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/index.js +2 -0
- package/dist/Alert/types.d.ts +11 -0
- package/dist/Alert/types.js +1 -0
- package/dist/Badge/badge.svelte +42 -0
- package/dist/Badge/badge.svelte.d.ts +36 -0
- package/dist/Badge/index.d.ts +2 -0
- package/dist/Badge/index.js +2 -0
- package/dist/Badge/types.d.ts +28 -0
- package/dist/Badge/types.js +24 -0
- package/dist/Breadcrumb/breadcrumb-item.svelte +66 -0
- package/dist/Breadcrumb/breadcrumb-item.svelte.d.ts +30 -0
- package/dist/Breadcrumb/breadcrumb.svelte +57 -0
- package/dist/Breadcrumb/breadcrumb.svelte.d.ts +34 -0
- package/dist/Breadcrumb/breadcrumb.svelte.js +41 -0
- package/dist/Breadcrumb/composition.d.ts +3 -0
- package/dist/Breadcrumb/composition.js +2 -0
- package/dist/Breadcrumb/index.d.ts +1 -0
- package/dist/Breadcrumb/index.js +1 -0
- package/dist/Breadcrumb/types.d.ts +9 -0
- package/dist/Breadcrumb/types.js +1 -0
- package/dist/BreakpointListener/breakpoint-listener.svelte +54 -0
- package/dist/BreakpointListener/breakpoint-listener.svelte.d.ts +4 -0
- package/dist/BreakpointListener/index.d.ts +2 -0
- package/dist/BreakpointListener/index.js +2 -0
- package/dist/BreakpointListener/types.d.ts +30 -0
- package/dist/BreakpointListener/types.js +20 -0
- package/dist/Button/button.svelte +87 -0
- package/dist/Button/button.svelte.d.ts +59 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/index.js +2 -0
- package/dist/Button/types.d.ts +26 -0
- package/dist/Button/types.js +1 -0
- package/dist/ButtonGroup/button-check.svelte +70 -0
- package/dist/ButtonGroup/button-check.svelte.d.ts +35 -0
- package/dist/ButtonGroup/button-group.svelte +51 -0
- package/dist/ButtonGroup/button-group.svelte.d.ts +43 -0
- package/dist/ButtonGroup/button-toolbar.svelte +36 -0
- package/dist/ButtonGroup/button-toolbar.svelte.d.ts +28 -0
- package/dist/ButtonGroup/index.d.ts +4 -0
- package/dist/ButtonGroup/index.js +4 -0
- package/dist/ButtonGroup/types.d.ts +21 -0
- package/dist/ButtonGroup/types.js +1 -0
- package/dist/Card/card-body.svelte +10 -0
- package/dist/Card/card-body.svelte.d.ts +3 -0
- package/dist/Card/card-footer.svelte +10 -0
- package/dist/Card/card-footer.svelte.d.ts +3 -0
- package/dist/Card/card-group.svelte +10 -0
- package/dist/Card/card-group.svelte.d.ts +3 -0
- package/dist/Card/card-header.svelte +10 -0
- package/dist/Card/card-header.svelte.d.ts +3 -0
- package/dist/Card/card-img-overlay.svelte +10 -0
- package/dist/Card/card-img-overlay.svelte.d.ts +3 -0
- package/dist/Card/card-img.svelte +12 -0
- package/dist/Card/card-img.svelte.d.ts +4 -0
- package/dist/Card/card-link.svelte +10 -0
- package/dist/Card/card-link.svelte.d.ts +4 -0
- package/dist/Card/card-subtitle.svelte +11 -0
- package/dist/Card/card-subtitle.svelte.d.ts +4 -0
- package/dist/Card/card-text.svelte +10 -0
- package/dist/Card/card-text.svelte.d.ts +3 -0
- package/dist/Card/card-title.svelte +11 -0
- package/dist/Card/card-title.svelte.d.ts +4 -0
- package/dist/Card/card.svelte +45 -0
- package/dist/Card/card.svelte.d.ts +38 -0
- package/dist/Card/composition.d.ts +12 -0
- package/dist/Card/composition.js +11 -0
- package/dist/Card/index.d.ts +1 -0
- package/dist/Card/index.js +1 -0
- package/dist/Card/types.d.ts +22 -0
- package/dist/Card/types.js +1 -0
- package/dist/Carousel/carousel-caption.svelte +30 -0
- package/dist/Carousel/carousel-caption.svelte.d.ts +22 -0
- package/dist/Carousel/carousel-control-next.svelte +35 -0
- package/dist/Carousel/carousel-control-next.svelte.d.ts +21 -0
- package/dist/Carousel/carousel-control-prev.svelte +35 -0
- package/dist/Carousel/carousel-control-prev.svelte.d.ts +21 -0
- package/dist/Carousel/carousel-indicator-button.svelte +41 -0
- package/dist/Carousel/carousel-indicator-button.svelte.d.ts +21 -0
- package/dist/Carousel/carousel-indicators.svelte +33 -0
- package/dist/Carousel/carousel-indicators.svelte.d.ts +25 -0
- package/dist/Carousel/carousel-inner.svelte +30 -0
- package/dist/Carousel/carousel-inner.svelte.d.ts +22 -0
- package/dist/Carousel/carousel-item.svelte +138 -0
- package/dist/Carousel/carousel-item.svelte.d.ts +28 -0
- package/dist/Carousel/carousel.svelte +140 -0
- package/dist/Carousel/carousel.svelte.d.ts +46 -0
- package/dist/Carousel/carousel.svelte.js +551 -0
- package/dist/Carousel/composition.d.ts +9 -0
- package/dist/Carousel/composition.js +8 -0
- package/dist/Carousel/index.d.ts +1 -0
- package/dist/Carousel/index.js +1 -0
- package/dist/Carousel/types.d.ts +74 -0
- package/dist/Carousel/types.js +1 -0
- package/dist/CloseButton/close-button.svelte +32 -0
- package/dist/CloseButton/close-button.svelte.d.ts +29 -0
- package/dist/CloseButton/index.d.ts +2 -0
- package/dist/CloseButton/index.js +2 -0
- package/dist/CloseButton/types.d.ts +6 -0
- package/dist/CloseButton/types.js +1 -0
- package/dist/Col/col.svelte +133 -0
- package/dist/Col/col.svelte.d.ts +60 -0
- package/dist/Col/index.d.ts +2 -0
- package/dist/Col/index.js +2 -0
- package/dist/Col/types.d.ts +30 -0
- package/dist/Col/types.js +1 -0
- package/dist/Collapse/collapse-aria-attachment.svelte.d.ts +3 -0
- package/dist/Collapse/collapse-aria-attachment.svelte.js +32 -0
- package/dist/Collapse/collapse.svelte +63 -0
- package/dist/Collapse/collapse.svelte.d.ts +45 -0
- package/dist/Collapse/index.d.ts +3 -0
- package/dist/Collapse/index.js +3 -0
- package/dist/Collapse/transition.d.ts +5 -0
- package/dist/Collapse/transition.js +75 -0
- package/dist/Collapse/types.d.ts +18 -0
- package/dist/Collapse/types.js +1 -0
- package/dist/Container/container.svelte +46 -0
- package/dist/Container/container.svelte.d.ts +36 -0
- package/dist/Container/index.d.ts +2 -0
- package/dist/Container/index.js +2 -0
- package/dist/Container/types.d.ts +8 -0
- package/dist/Container/types.js +1 -0
- package/dist/Dropdown/composition.d.ts +8 -0
- package/dist/Dropdown/composition.js +7 -0
- package/dist/Dropdown/dropdown-divider.svelte +23 -0
- package/dist/Dropdown/dropdown-divider.svelte.d.ts +18 -0
- package/dist/Dropdown/dropdown-header.svelte +27 -0
- package/dist/Dropdown/dropdown-header.svelte.d.ts +19 -0
- package/dist/Dropdown/dropdown-item-text.svelte +26 -0
- package/dist/Dropdown/dropdown-item-text.svelte.d.ts +18 -0
- package/dist/Dropdown/dropdown-item.svelte +86 -0
- package/dist/Dropdown/dropdown-item.svelte.d.ts +24 -0
- package/dist/Dropdown/dropdown-menu.svelte +82 -0
- package/dist/Dropdown/dropdown-menu.svelte.d.ts +27 -0
- package/dist/Dropdown/dropdown-toggle.svelte +67 -0
- package/dist/Dropdown/dropdown-toggle.svelte.d.ts +24 -0
- package/dist/Dropdown/dropdown.svelte +106 -0
- package/dist/Dropdown/dropdown.svelte.d.ts +34 -0
- package/dist/Dropdown/dropdown.svelte.js +435 -0
- package/dist/Dropdown/index.d.ts +1 -0
- package/dist/Dropdown/index.js +1 -0
- package/dist/Dropdown/types.d.ts +47 -0
- package/dist/Dropdown/types.js +1 -0
- package/dist/Form/composition.d.ts +34 -0
- package/dist/Form/composition.js +33 -0
- package/dist/Form/form-check-input.svelte +92 -0
- package/dist/Form/form-check-input.svelte.d.ts +48 -0
- package/dist/Form/form-check-label.svelte +26 -0
- package/dist/Form/form-check-label.svelte.d.ts +21 -0
- package/dist/Form/form-check.svelte +55 -0
- package/dist/Form/form-check.svelte.d.ts +50 -0
- package/dist/Form/form-color-input.svelte +54 -0
- package/dist/Form/form-color-input.svelte.d.ts +30 -0
- package/dist/Form/form-date-input.svelte +64 -0
- package/dist/Form/form-date-input.svelte.d.ts +46 -0
- package/dist/Form/form-datetime-local-input.svelte +60 -0
- package/dist/Form/form-datetime-local-input.svelte.d.ts +45 -0
- package/dist/Form/form-email-input.svelte +64 -0
- package/dist/Form/form-email-input.svelte.d.ts +46 -0
- package/dist/Form/form-feedback.svelte +36 -0
- package/dist/Form/form-feedback.svelte.d.ts +26 -0
- package/dist/Form/form-file-input.svelte +43 -0
- package/dist/Form/form-file-input.svelte.d.ts +30 -0
- package/dist/Form/form-floating.svelte +44 -0
- package/dist/Form/form-floating.svelte.d.ts +38 -0
- package/dist/Form/form-helper-text.svelte +35 -0
- package/dist/Form/form-helper-text.svelte.d.ts +29 -0
- package/dist/Form/form-hidden-input.svelte +18 -0
- package/dist/Form/form-hidden-input.svelte.d.ts +16 -0
- package/dist/Form/form-image-input.svelte +30 -0
- package/dist/Form/form-image-input.svelte.d.ts +26 -0
- package/dist/Form/form-input-group-text.svelte +47 -0
- package/dist/Form/form-input-group-text.svelte.d.ts +42 -0
- package/dist/Form/form-input-group.svelte +52 -0
- package/dist/Form/form-input-group.svelte.d.ts +43 -0
- package/dist/Form/form-input-label.svelte +33 -0
- package/dist/Form/form-input-label.svelte.d.ts +28 -0
- package/dist/Form/form-month-input.svelte +63 -0
- package/dist/Form/form-month-input.svelte.d.ts +48 -0
- package/dist/Form/form-number-input.svelte +62 -0
- package/dist/Form/form-number-input.svelte.d.ts +47 -0
- package/dist/Form/form-password-input.svelte +60 -0
- package/dist/Form/form-password-input.svelte.d.ts +41 -0
- package/dist/Form/form-radio-input.svelte +47 -0
- package/dist/Form/form-radio-input.svelte.d.ts +41 -0
- package/dist/Form/form-radio-label.svelte +41 -0
- package/dist/Form/form-radio-label.svelte.d.ts +35 -0
- package/dist/Form/form-range-input.svelte +43 -0
- package/dist/Form/form-range-input.svelte.d.ts +39 -0
- package/dist/Form/form-search-input.svelte +63 -0
- package/dist/Form/form-search-input.svelte.d.ts +45 -0
- package/dist/Form/form-select.svelte +85 -0
- package/dist/Form/form-select.svelte.d.ts +59 -0
- package/dist/Form/form-switch-input.svelte +54 -0
- package/dist/Form/form-switch-input.svelte.d.ts +41 -0
- package/dist/Form/form-switch-label.svelte +25 -0
- package/dist/Form/form-switch-label.svelte.d.ts +19 -0
- package/dist/Form/form-telephone-input.svelte +129 -0
- package/dist/Form/form-telephone-input.svelte.d.ts +55 -0
- package/dist/Form/form-text-area.svelte +57 -0
- package/dist/Form/form-text-area.svelte.d.ts +38 -0
- package/dist/Form/form-text-input.svelte +55 -0
- package/dist/Form/form-text-input.svelte.d.ts +37 -0
- package/dist/Form/form-time-input.svelte +62 -0
- package/dist/Form/form-time-input.svelte.d.ts +47 -0
- package/dist/Form/form-url-input.svelte +60 -0
- package/dist/Form/form-url-input.svelte.d.ts +45 -0
- package/dist/Form/form-week-Input.svelte +62 -0
- package/dist/Form/form-week-Input.svelte.d.ts +47 -0
- package/dist/Form/form.svelte +37 -0
- package/dist/Form/form.svelte.d.ts +23 -0
- package/dist/Form/index.d.ts +1 -0
- package/dist/Form/index.js +1 -0
- package/dist/Form/types.d.ts +168 -0
- package/dist/Form/types.js +1 -0
- package/dist/ListGroup/composition.d.ts +4 -0
- package/dist/ListGroup/composition.js +3 -0
- package/dist/ListGroup/index.d.ts +1 -0
- package/dist/ListGroup/index.js +1 -0
- package/dist/ListGroup/list-group-item-action.svelte +50 -0
- package/dist/ListGroup/list-group-item-action.svelte.d.ts +23 -0
- package/dist/ListGroup/list-group-item.svelte +58 -0
- package/dist/ListGroup/list-group-item.svelte.d.ts +51 -0
- package/dist/ListGroup/list-group.svelte +83 -0
- package/dist/ListGroup/list-group.svelte.d.ts +68 -0
- package/dist/ListGroup/types.d.ts +20 -0
- package/dist/ListGroup/types.js +1 -0
- package/dist/Modal/composition.d.ts +8 -0
- package/dist/Modal/composition.js +7 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +1 -0
- package/dist/Modal/modal-body.svelte +27 -0
- package/dist/Modal/modal-body.svelte.d.ts +19 -0
- package/dist/Modal/modal-content.svelte +35 -0
- package/dist/Modal/modal-content.svelte.d.ts +27 -0
- package/dist/Modal/modal-dialog.svelte +65 -0
- package/dist/Modal/modal-dialog.svelte.d.ts +52 -0
- package/dist/Modal/modal-footer.svelte +28 -0
- package/dist/Modal/modal-footer.svelte.d.ts +20 -0
- package/dist/Modal/modal-header.svelte +50 -0
- package/dist/Modal/modal-header.svelte.d.ts +29 -0
- package/dist/Modal/modal-title.svelte +45 -0
- package/dist/Modal/modal-title.svelte.d.ts +26 -0
- package/dist/Modal/modal.svelte +233 -0
- package/dist/Modal/modal.svelte.d.ts +52 -0
- package/dist/Modal/modal.svelte.js +86 -0
- package/dist/Modal/types.d.ts +31 -0
- package/dist/Modal/types.js +1 -0
- package/dist/Nav/composition.d.ts +4 -0
- package/dist/Nav/composition.js +3 -0
- package/dist/Nav/index.d.ts +1 -0
- package/dist/Nav/index.js +1 -0
- package/dist/Nav/nav-item.svelte +25 -0
- package/dist/Nav/nav-item.svelte.d.ts +18 -0
- package/dist/Nav/nav-link.svelte +77 -0
- package/dist/Nav/nav-link.svelte.d.ts +22 -0
- package/dist/Nav/nav.svelte +93 -0
- package/dist/Nav/nav.svelte.d.ts +56 -0
- package/dist/Nav/types.d.ts +26 -0
- package/dist/Nav/types.js +1 -0
- package/dist/Navbar/composition.d.ts +8 -0
- package/dist/Navbar/composition.js +7 -0
- package/dist/Navbar/index.d.ts +1 -0
- package/dist/Navbar/index.js +1 -0
- package/dist/Navbar/navbar-brand.svelte +55 -0
- package/dist/Navbar/navbar-brand.svelte.d.ts +48 -0
- package/dist/Navbar/navbar-collapse.svelte +76 -0
- package/dist/Navbar/navbar-collapse.svelte.d.ts +55 -0
- package/dist/Navbar/navbar-nav.svelte +66 -0
- package/dist/Navbar/navbar-nav.svelte.d.ts +53 -0
- package/dist/Navbar/navbar-text.svelte +36 -0
- package/dist/Navbar/navbar-text.svelte.d.ts +28 -0
- package/dist/Navbar/navbar-toggler-icon.svelte +34 -0
- package/dist/Navbar/navbar-toggler-icon.svelte.d.ts +28 -0
- package/dist/Navbar/navbar-toggler.svelte +75 -0
- package/dist/Navbar/navbar-toggler.svelte.d.ts +48 -0
- package/dist/Navbar/navbar.svelte +116 -0
- package/dist/Navbar/navbar.svelte.d.ts +88 -0
- package/dist/Navbar/types.d.ts +23 -0
- package/dist/Navbar/types.js +1 -0
- package/dist/Offcanvas/composition.d.ts +5 -0
- package/dist/Offcanvas/composition.js +4 -0
- package/dist/Offcanvas/index.d.ts +1 -0
- package/dist/Offcanvas/index.js +1 -0
- package/dist/Offcanvas/offcanvas-body.svelte +25 -0
- package/dist/Offcanvas/offcanvas-body.svelte.d.ts +19 -0
- package/dist/Offcanvas/offcanvas-header.svelte +39 -0
- package/dist/Offcanvas/offcanvas-header.svelte.d.ts +20 -0
- package/dist/Offcanvas/offcanvas-title.svelte +31 -0
- package/dist/Offcanvas/offcanvas-title.svelte.d.ts +25 -0
- package/dist/Offcanvas/offcanvas.svelte +220 -0
- package/dist/Offcanvas/offcanvas.svelte.d.ts +61 -0
- package/dist/Offcanvas/types.d.ts +25 -0
- package/dist/Offcanvas/types.js +1 -0
- package/dist/Pagination/composition.d.ts +4 -0
- package/dist/Pagination/composition.js +3 -0
- package/dist/Pagination/index.d.ts +1 -0
- package/dist/Pagination/index.js +1 -0
- package/dist/Pagination/pagination-item.svelte +81 -0
- package/dist/Pagination/pagination-item.svelte.d.ts +35 -0
- package/dist/Pagination/pagination-link.svelte +45 -0
- package/dist/Pagination/pagination-link.svelte.d.ts +25 -0
- package/dist/Pagination/pagination.svelte +60 -0
- package/dist/Pagination/pagination.svelte.d.ts +37 -0
- package/dist/Pagination/pagination.svelte.js +117 -0
- package/dist/Pagination/types.d.ts +19 -0
- package/dist/Pagination/types.js +1 -0
- package/dist/Placeholder/composition.d.ts +3 -0
- package/dist/Placeholder/composition.js +2 -0
- package/dist/Placeholder/index.d.ts +1 -0
- package/dist/Placeholder/index.js +1 -0
- package/dist/Placeholder/placeholder-item.svelte +53 -0
- package/dist/Placeholder/placeholder-item.svelte.d.ts +48 -0
- package/dist/Placeholder/placeholder.svelte +37 -0
- package/dist/Placeholder/placeholder.svelte.d.ts +32 -0
- package/dist/Placeholder/types.d.ts +12 -0
- package/dist/Placeholder/types.js +1 -0
- package/dist/Popover/composition.d.ts +4 -0
- package/dist/Popover/composition.js +3 -0
- package/dist/Popover/index.d.ts +1 -0
- package/dist/Popover/index.js +1 -0
- package/dist/Popover/popover-body.svelte +10 -0
- package/dist/Popover/popover-body.svelte.d.ts +3 -0
- package/dist/Popover/popover-header.svelte +11 -0
- package/dist/Popover/popover-header.svelte.d.ts +4 -0
- package/dist/Popover/popover.svelte +74 -0
- package/dist/Popover/popover.svelte.d.ts +53 -0
- package/dist/Popover/types.d.ts +20 -0
- package/dist/Popover/types.js +1 -0
- package/dist/Portal/index.d.ts +2 -0
- package/dist/Portal/index.js +2 -0
- package/dist/Portal/portal-host.svelte +5 -0
- package/dist/Portal/portal-host.svelte.d.ts +7 -0
- package/dist/Portal/portal.svelte +69 -0
- package/dist/Portal/portal.svelte.d.ts +32 -0
- package/dist/Portal/types.d.ts +6 -0
- package/dist/Portal/types.js +1 -0
- package/dist/Progress/index.d.ts +3 -0
- package/dist/Progress/index.js +3 -0
- package/dist/Progress/progress-bar.svelte +101 -0
- package/dist/Progress/progress-bar.svelte.d.ts +39 -0
- package/dist/Progress/progress-stacked.svelte +34 -0
- package/dist/Progress/progress-stacked.svelte.d.ts +24 -0
- package/dist/Progress/progress.svelte.d.ts +31 -0
- package/dist/Progress/progress.svelte.js +52 -0
- package/dist/Progress/types.d.ts +40 -0
- package/dist/Progress/types.js +1 -0
- package/dist/Row/index.d.ts +2 -0
- package/dist/Row/index.js +2 -0
- package/dist/Row/row.svelte +75 -0
- package/dist/Row/row.svelte.d.ts +46 -0
- package/dist/Row/types.d.ts +12 -0
- package/dist/Row/types.js +1 -0
- package/dist/Scrollspy/index.d.ts +2 -0
- package/dist/Scrollspy/index.js +2 -0
- package/dist/Scrollspy/scrollspy-attachment.svelte.d.ts +10 -0
- package/dist/Scrollspy/scrollspy-attachment.svelte.js +122 -0
- package/dist/Scrollspy/types.d.ts +9 -0
- package/dist/Scrollspy/types.js +1 -0
- package/dist/Spinner/index.d.ts +2 -0
- package/dist/Spinner/index.js +2 -0
- package/dist/Spinner/spinner.svelte +77 -0
- package/dist/Spinner/spinner.svelte.d.ts +70 -0
- package/dist/Spinner/types.d.ts +9 -0
- package/dist/Spinner/types.js +1 -0
- package/dist/Tab/composition.d.ts +5 -0
- package/dist/Tab/composition.js +4 -0
- package/dist/Tab/index.d.ts +1 -0
- package/dist/Tab/index.js +1 -0
- package/dist/Tab/tab-content.svelte +29 -0
- package/dist/Tab/tab-content.svelte.d.ts +23 -0
- package/dist/Tab/tab-nav-link.svelte +69 -0
- package/dist/Tab/tab-nav-link.svelte.d.ts +22 -0
- package/dist/Tab/tab-pane.svelte +72 -0
- package/dist/Tab/tab-pane.svelte.d.ts +26 -0
- package/dist/Tab/tab.svelte +63 -0
- package/dist/Tab/tab.svelte.d.ts +50 -0
- package/dist/Tab/types.d.ts +18 -0
- package/dist/Tab/types.js +1 -0
- package/dist/Table/composition.d.ts +9 -0
- package/dist/Table/composition.js +8 -0
- package/dist/Table/index.d.ts +1 -0
- package/dist/Table/index.js +1 -0
- package/dist/Table/table-body.svelte +30 -0
- package/dist/Table/table-body.svelte.d.ts +23 -0
- package/dist/Table/table-caption.svelte +20 -0
- package/dist/Table/table-caption.svelte.d.ts +15 -0
- package/dist/Table/table-data.svelte +30 -0
- package/dist/Table/table-data.svelte.d.ts +19 -0
- package/dist/Table/table-foot.svelte +31 -0
- package/dist/Table/table-foot.svelte.d.ts +24 -0
- package/dist/Table/table-head.svelte +31 -0
- package/dist/Table/table-head.svelte.d.ts +24 -0
- package/dist/Table/table-header.svelte +38 -0
- package/dist/Table/table-header.svelte.d.ts +17 -0
- package/dist/Table/table-row.svelte +34 -0
- package/dist/Table/table-row.svelte.d.ts +23 -0
- package/dist/Table/table.svelte +154 -0
- package/dist/Table/table.svelte.d.ts +98 -0
- package/dist/Table/table.svelte.js +92 -0
- package/dist/Table/types.d.ts +43 -0
- package/dist/Table/types.js +1 -0
- package/dist/Toast/composition.d.ts +5 -0
- package/dist/Toast/composition.js +4 -0
- package/dist/Toast/index.d.ts +1 -0
- package/dist/Toast/index.js +1 -0
- package/dist/Toast/toast-body.svelte +26 -0
- package/dist/Toast/toast-body.svelte.d.ts +18 -0
- package/dist/Toast/toast-container.svelte +44 -0
- package/dist/Toast/toast-container.svelte.d.ts +36 -0
- package/dist/Toast/toast-header.svelte +56 -0
- package/dist/Toast/toast-header.svelte.d.ts +36 -0
- package/dist/Toast/toast.svelte +112 -0
- package/dist/Toast/toast.svelte.d.ts +54 -0
- package/dist/Toast/toast.svelte.js +83 -0
- package/dist/Toast/types.d.ts +53 -0
- package/dist/Toast/types.js +19 -0
- package/dist/Tooltip/composition.d.ts +3 -0
- package/dist/Tooltip/composition.js +2 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/index.js +1 -0
- package/dist/Tooltip/tooltip-inner.svelte +10 -0
- package/dist/Tooltip/tooltip-inner.svelte.d.ts +4 -0
- package/dist/Tooltip/tooltip.svelte +213 -0
- package/dist/Tooltip/tooltip.svelte.d.ts +54 -0
- package/dist/Tooltip/types.d.ts +43 -0
- package/dist/Tooltip/types.js +1 -0
- package/dist/common/context.d.ts +47 -0
- package/dist/common/context.js +70 -0
- package/dist/common/css.d.ts +71 -0
- package/dist/common/css.js +133 -0
- package/dist/common/dom.d.ts +51 -0
- package/dist/common/dom.js +98 -0
- package/dist/common/index.d.ts +6 -0
- package/dist/common/index.js +5 -0
- package/dist/common/nav-tab.svelte.d.ts +88 -0
- package/dist/common/nav-tab.svelte.js +188 -0
- package/dist/common/navbar-offcanvas.svelte.d.ts +101 -0
- package/dist/common/navbar-offcanvas.svelte.js +228 -0
- package/dist/common/noop.d.ts +4 -0
- package/dist/common/noop.js +4 -0
- package/dist/common/scrollbar.d.ts +20 -0
- package/dist/common/scrollbar.js +53 -0
- package/dist/common/types.d.ts +143 -0
- package/dist/common/types.js +40 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +33 -0
- package/package.json +105 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { isRTL } from '../common/dom.js';
|
|
2
|
+
import { Context } from '../common/index.js';
|
|
3
|
+
import { createPopper } from '@popperjs/core';
|
|
4
|
+
import { tick } from 'svelte';
|
|
5
|
+
export class DropdownRootState {
|
|
6
|
+
props;
|
|
7
|
+
#activeItemIndex = $state(-1); // Zero-based index for active item
|
|
8
|
+
#autoClose = $state(true); // Determines how the dropdown should close (default is true, meaning it closes on any click outside).
|
|
9
|
+
#direction = $state('dropdown');
|
|
10
|
+
#display = $state('dynamic');
|
|
11
|
+
#elementRef = $state(null);
|
|
12
|
+
#isButtonGroup = $state(false);
|
|
13
|
+
#isNavItem = $state(false);
|
|
14
|
+
#isShown = $state(false);
|
|
15
|
+
#items = $state([]);
|
|
16
|
+
ariaLabelledBy = $state(undefined); // Used for accessibility, linking the dropdown to a label.
|
|
17
|
+
constructor(props) {
|
|
18
|
+
this.props = props;
|
|
19
|
+
this.#autoClose = this.props.autoClose !== undefined ? this.props.autoClose : true; // Default to true if not specified.
|
|
20
|
+
this.#direction = this.props.direction || 'dropdown';
|
|
21
|
+
this.#display = this.props.display || 'dynamic';
|
|
22
|
+
this.#elementRef = this.props.elementRef || null;
|
|
23
|
+
this.#isButtonGroup = this.props.isButtonGroup || false;
|
|
24
|
+
// Bind the method to ensure `this` context is correct when passed as a callback.
|
|
25
|
+
this.focusOnNextItem = this.focusOnNextItem.bind(this);
|
|
26
|
+
this.focusOnPreviousItem = this.focusOnPreviousItem.bind(this);
|
|
27
|
+
this.registerItem = this.registerItem.bind(this);
|
|
28
|
+
this.toggleIsShown = this.toggleIsShown.bind(this);
|
|
29
|
+
}
|
|
30
|
+
get activeItemIndex() {
|
|
31
|
+
return this.#activeItemIndex;
|
|
32
|
+
}
|
|
33
|
+
set activeItemIndex(index) {
|
|
34
|
+
this.#activeItemIndex = index;
|
|
35
|
+
}
|
|
36
|
+
get autoClose() {
|
|
37
|
+
return this.#autoClose;
|
|
38
|
+
}
|
|
39
|
+
set autoClose(autoClose) {
|
|
40
|
+
this.#autoClose = autoClose;
|
|
41
|
+
}
|
|
42
|
+
get direction() {
|
|
43
|
+
return this.#direction;
|
|
44
|
+
}
|
|
45
|
+
set direction(direction) {
|
|
46
|
+
this.#direction = direction;
|
|
47
|
+
}
|
|
48
|
+
get display() {
|
|
49
|
+
return this.#display;
|
|
50
|
+
}
|
|
51
|
+
set display(display) {
|
|
52
|
+
this.#display = display;
|
|
53
|
+
}
|
|
54
|
+
get elementRef() {
|
|
55
|
+
return this.#elementRef;
|
|
56
|
+
}
|
|
57
|
+
set elementRef(element) {
|
|
58
|
+
// The root element reference, typically the dropdown toggle button or a wrapper.
|
|
59
|
+
// This is used by Popper.js to position the dropdown menu.
|
|
60
|
+
this.#elementRef = element;
|
|
61
|
+
if (this.#elementRef) {
|
|
62
|
+
const parentElement = this.#elementRef.parentElement;
|
|
63
|
+
this.#isNavItem = parentElement ? parentElement.classList.contains('navbar-nav') : false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
get hasItems() {
|
|
67
|
+
return this.#items.length > 0;
|
|
68
|
+
}
|
|
69
|
+
get isButtonGroup() {
|
|
70
|
+
return this.#isButtonGroup;
|
|
71
|
+
}
|
|
72
|
+
set isButtonGroup(isButtonGroup) {
|
|
73
|
+
this.#isButtonGroup = isButtonGroup;
|
|
74
|
+
}
|
|
75
|
+
get isNavItem() {
|
|
76
|
+
return this.#isNavItem;
|
|
77
|
+
}
|
|
78
|
+
get isShown() {
|
|
79
|
+
return this.#isShown;
|
|
80
|
+
}
|
|
81
|
+
focusOnNextItem() {
|
|
82
|
+
if (this.#items.length === 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.#activeItemIndex = (this.#activeItemIndex + 1) % this.#items.length;
|
|
86
|
+
this.#items[this.#activeItemIndex]?.props.elementRef?.focus();
|
|
87
|
+
}
|
|
88
|
+
focusOnPreviousItem() {
|
|
89
|
+
if (this.#items.length === 0) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.#activeItemIndex = (this.#activeItemIndex - 1 + this.#items.length) % this.#items.length;
|
|
93
|
+
this.#items[this.#activeItemIndex]?.props.elementRef?.focus();
|
|
94
|
+
}
|
|
95
|
+
registerItem(item) {
|
|
96
|
+
item.itemIndex = this.#items.length; // Set the item's index based on current length.
|
|
97
|
+
this.#items.push(item);
|
|
98
|
+
}
|
|
99
|
+
toggleIsShown(event) {
|
|
100
|
+
if (!this.#isShown) {
|
|
101
|
+
this.props.onShow?.(event);
|
|
102
|
+
}
|
|
103
|
+
if (this.#isShown) {
|
|
104
|
+
this.props.onHide?.(event);
|
|
105
|
+
}
|
|
106
|
+
this.#isShown = !this.#isShown;
|
|
107
|
+
this.#activeItemIndex = -1; // Reset active item index when toggling visibility.
|
|
108
|
+
if (this.#isShown) {
|
|
109
|
+
this.props.onShown?.(event);
|
|
110
|
+
}
|
|
111
|
+
if (!this.#isShown) {
|
|
112
|
+
this.props.onHidden?.(event);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export class DropdownToggleState {
|
|
117
|
+
props;
|
|
118
|
+
root;
|
|
119
|
+
// Derives its shown state directly from the root state.
|
|
120
|
+
isShown = $derived.by(() => this.root.isShown);
|
|
121
|
+
constructor(props, root) {
|
|
122
|
+
this.props = props;
|
|
123
|
+
this.root = root;
|
|
124
|
+
// Bind the method to ensure `this` context is correct when used as an event handler.
|
|
125
|
+
this.onclick = this.onclick.bind(this);
|
|
126
|
+
this.onkeydown = this.onkeydown.bind(this);
|
|
127
|
+
if (this.props.isSplit && !this.root.isButtonGroup) {
|
|
128
|
+
// If the toggle is a split button, the root must be treated as a button group
|
|
129
|
+
// to ensure correct Bootstrap styling and layout.
|
|
130
|
+
this.root.isButtonGroup = true;
|
|
131
|
+
}
|
|
132
|
+
this.root.ariaLabelledBy = this.props.id || undefined; // Set the aria-labelledby attribute for accessibility.
|
|
133
|
+
}
|
|
134
|
+
onclick(event) {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
this.root.toggleIsShown(event);
|
|
137
|
+
}
|
|
138
|
+
onkeydown(event) {
|
|
139
|
+
handleKeydown(event, this.root);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export class DropdownMenuState {
|
|
143
|
+
props;
|
|
144
|
+
root;
|
|
145
|
+
// Private
|
|
146
|
+
#autoClose = $derived.by(() => this.root?.autoClose);
|
|
147
|
+
#elementRef = $state(null); // Reference to the dropdown menu element itself.
|
|
148
|
+
#isEnd = $state(false);
|
|
149
|
+
#popperInstance = null;
|
|
150
|
+
#popperOffset = $state([0, 2]);
|
|
151
|
+
#popperPlacement = $state(undefined);
|
|
152
|
+
#rootElementRef = $derived.by(() => this.root?.elementRef); // Reference to the root dropdown element, used for Popper.js positioning.
|
|
153
|
+
// Public
|
|
154
|
+
isShown = $derived.by(() => this.root.isShown); // Derives its shown state directly from the root state.
|
|
155
|
+
ariaLabelledBy = $derived.by(() => this.root.ariaLabelledBy);
|
|
156
|
+
constructor(props, root) {
|
|
157
|
+
this.props = props;
|
|
158
|
+
this.root = root;
|
|
159
|
+
this.#elementRef = this.props.elementRef || null;
|
|
160
|
+
this.#isEnd = this.props.isEnd || false;
|
|
161
|
+
this.#popperOffset = this.props.offset || [0, 2];
|
|
162
|
+
// Bind methods to ensure `this` context is correct when passed as callbacks or event handlers.
|
|
163
|
+
this.bodyOnclick = this.bodyOnclick.bind(this);
|
|
164
|
+
this.createPopperInstance = this.createPopperInstance.bind(this);
|
|
165
|
+
this.destroyPopper = this.destroyPopper.bind(this);
|
|
166
|
+
this.determinePopperPlacement = this.determinePopperPlacement.bind(this);
|
|
167
|
+
this.dispose = this.dispose.bind(this);
|
|
168
|
+
this.syncIsEndWithRoot = this.syncIsEndWithRoot.bind(this);
|
|
169
|
+
// Ensure the dropdown menu's end alignment is consistent with the root's direction.
|
|
170
|
+
this.syncIsEndWithRoot();
|
|
171
|
+
// Effect to manage the Popper.js instance lifecycle.
|
|
172
|
+
// It creates the instance when the menu is shown and elements are available,
|
|
173
|
+
// and implicitly handles destruction/recreation if dependencies change.
|
|
174
|
+
$effect(() => {
|
|
175
|
+
if (this.#rootElementRef && this.#elementRef && this.isShown) {
|
|
176
|
+
this.createPopperInstance();
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
get autoClose() {
|
|
181
|
+
return this.#autoClose;
|
|
182
|
+
}
|
|
183
|
+
get elementRef() {
|
|
184
|
+
return this.#elementRef;
|
|
185
|
+
}
|
|
186
|
+
set elementRef(element) {
|
|
187
|
+
this.#elementRef = element;
|
|
188
|
+
}
|
|
189
|
+
get isEnd() {
|
|
190
|
+
return this.#isEnd;
|
|
191
|
+
}
|
|
192
|
+
set isEnd(isEnd) {
|
|
193
|
+
this.#isEnd = isEnd;
|
|
194
|
+
// Ensure the dropdown menu's end alignment is consistent with the root's direction.
|
|
195
|
+
this.syncIsEndWithRoot();
|
|
196
|
+
}
|
|
197
|
+
get popperOffset() {
|
|
198
|
+
return this.#popperOffset;
|
|
199
|
+
}
|
|
200
|
+
set popperOffset(offset) {
|
|
201
|
+
this.#popperOffset = offset;
|
|
202
|
+
// Recreate the Popper instance to apply the new offset.
|
|
203
|
+
this.createPopperInstance();
|
|
204
|
+
}
|
|
205
|
+
get popperPlacement() {
|
|
206
|
+
return this.#popperPlacement;
|
|
207
|
+
}
|
|
208
|
+
// Handles clicks on the document body to close the dropdown when clicking outside.
|
|
209
|
+
bodyOnclick(event) {
|
|
210
|
+
if (!this.isShown) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const target = event.target;
|
|
214
|
+
// Check if the click occurred within this specific dropdown instance.
|
|
215
|
+
// This prevents closing if a click happens inside the dropdown menu or on its toggle.
|
|
216
|
+
const nearestDropdown = target.closest(`#${this.root.props.id}`);
|
|
217
|
+
if (nearestDropdown && nearestDropdown.id === this.root.props.id) {
|
|
218
|
+
// The click is within the current dropdown, so do nothing.
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
// Only close on outside clicks if autoClose is true or 'outside'
|
|
222
|
+
// false: only close on toggle click (ignore body clicks)
|
|
223
|
+
// 'inside': only close on item/toggle clicks (ignore body clicks)
|
|
224
|
+
// 'outside': close on toggle/body clicks (ignore item clicks)
|
|
225
|
+
// true: close on any click (toggle, item, or body)
|
|
226
|
+
if (this.autoClose === true || this.autoClose === 'outside') {
|
|
227
|
+
this.root.toggleIsShown(event);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// Cleans up resources, particularly the Popper.js instance and element references.
|
|
231
|
+
dispose() {
|
|
232
|
+
this.destroyPopper();
|
|
233
|
+
this.#elementRef = null;
|
|
234
|
+
this.#rootElementRef = null; // Clearing derived state source if it were directly settable.
|
|
235
|
+
this.#popperInstance = null;
|
|
236
|
+
}
|
|
237
|
+
createPopperInstance() {
|
|
238
|
+
this.destroyPopper();
|
|
239
|
+
if (!this.#elementRef || !this.#rootElementRef) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
this.#popperPlacement = this.determinePopperPlacement();
|
|
243
|
+
const popperConfig = {
|
|
244
|
+
placement: this.#popperPlacement,
|
|
245
|
+
modifiers: this.determinePopperModifiers()
|
|
246
|
+
};
|
|
247
|
+
this.#popperInstance = createPopper(this.#rootElementRef, this.#elementRef, popperConfig);
|
|
248
|
+
}
|
|
249
|
+
determinePopperModifiers() {
|
|
250
|
+
const isStaticDisplay = this.root.isNavItem || this.root.display === 'static';
|
|
251
|
+
if (isStaticDisplay) {
|
|
252
|
+
return [
|
|
253
|
+
{
|
|
254
|
+
name: 'applyStyles', // Disables Popper.js styles, allowing Bootstrap to handle positioning.
|
|
255
|
+
enabled: false
|
|
256
|
+
}
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
return [
|
|
260
|
+
{
|
|
261
|
+
name: 'preventOverflow',
|
|
262
|
+
enabled: true,
|
|
263
|
+
options: {
|
|
264
|
+
boundary: 'clippingParents' // Ensures the dropdown stays within viewport boundaries
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
name: 'offset', // Adds a small offset between the toggle and the menu
|
|
269
|
+
enabled: true,
|
|
270
|
+
options: {
|
|
271
|
+
offset: this.#popperOffset
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
}
|
|
276
|
+
// Determines the appropriate Popper.js placement based on the dropdown's direction
|
|
277
|
+
// and whether the UI is in Right-To-Left (RTL) mode.
|
|
278
|
+
determinePopperPlacement() {
|
|
279
|
+
const _isRTL = isRTL();
|
|
280
|
+
// Define placement mappings for better maintainability
|
|
281
|
+
const placementMap = {
|
|
282
|
+
dropend: { ltr: 'right-start', rtl: 'left-start' },
|
|
283
|
+
dropstart: { ltr: 'left-start', rtl: 'right-start' },
|
|
284
|
+
'dropup-center': { ltr: 'top', rtl: 'top' },
|
|
285
|
+
'dropup-end': { ltr: 'top-end', rtl: 'top-start' },
|
|
286
|
+
dropup: { ltr: 'top-start', rtl: 'top-end' },
|
|
287
|
+
'dropdown-center': { ltr: 'bottom', rtl: 'bottom' },
|
|
288
|
+
'dropdown-end': { ltr: 'bottom-end', rtl: 'bottom-start' }
|
|
289
|
+
};
|
|
290
|
+
const direction = this.root.direction;
|
|
291
|
+
const mapping = placementMap[direction];
|
|
292
|
+
if (mapping) {
|
|
293
|
+
return _isRTL ? mapping.rtl : mapping.ltr;
|
|
294
|
+
}
|
|
295
|
+
// Default placement if the direction is not in the map (e.g., 'dropdown').
|
|
296
|
+
// For 'dropdown', the default is 'bottom-start' (LTR) or 'bottom-end' (RTL).
|
|
297
|
+
return _isRTL ? 'bottom-end' : 'bottom-start';
|
|
298
|
+
}
|
|
299
|
+
destroyPopper() {
|
|
300
|
+
if (!this.#popperInstance) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
this.#popperInstance.destroy();
|
|
304
|
+
this.#popperInstance = null;
|
|
305
|
+
}
|
|
306
|
+
syncIsEndWithRoot() {
|
|
307
|
+
const currentDirection = this.root.direction;
|
|
308
|
+
const configuredDirection = this.root.props.direction ?? 'dropdown';
|
|
309
|
+
const hasCompatibleDirection = currentDirection.endsWith('-end') || configuredDirection.endsWith('-end');
|
|
310
|
+
// If the menu is aligned to the end, but the root direction doesn't reflect this,
|
|
311
|
+
// update the root direction to ensure consistent behavior and styling.
|
|
312
|
+
if (this.#isEnd && !hasCompatibleDirection) {
|
|
313
|
+
const direction = currentDirection;
|
|
314
|
+
if (direction === 'dropdown' || direction === 'dropdown-center') {
|
|
315
|
+
this.root.direction = 'dropdown-end';
|
|
316
|
+
}
|
|
317
|
+
else if (direction === 'dropup' || direction === 'dropup-center') {
|
|
318
|
+
this.root.direction = 'dropup-end';
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
// Default to dropdown-end if the current direction is unusual (e.g., dropstart/dropend with isEnd).
|
|
322
|
+
this.root.direction = 'dropdown-end';
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
export class DropdownItemState {
|
|
328
|
+
props;
|
|
329
|
+
root;
|
|
330
|
+
#autoClose = $derived.by(() => this.root?.autoClose);
|
|
331
|
+
#itemIndex = $state(-1); // The index of this item within the dropdown, set when registered with the root.
|
|
332
|
+
constructor(props, root) {
|
|
333
|
+
this.props = props;
|
|
334
|
+
this.root = root;
|
|
335
|
+
// Bind the method to ensure `this` context is correct when used as an event handler.
|
|
336
|
+
this.onclick = this.onclick.bind(this);
|
|
337
|
+
this.onfocus = this.onfocus.bind(this);
|
|
338
|
+
this.onkeydown = this.onkeydown.bind(this);
|
|
339
|
+
}
|
|
340
|
+
get autoClose() {
|
|
341
|
+
return this.#autoClose;
|
|
342
|
+
}
|
|
343
|
+
get itemIndex() {
|
|
344
|
+
return this.#itemIndex;
|
|
345
|
+
}
|
|
346
|
+
set itemIndex(index) {
|
|
347
|
+
this.#itemIndex = index;
|
|
348
|
+
}
|
|
349
|
+
// When a dropdown item is clicked, it should typically close the dropdown.
|
|
350
|
+
onclick(event) {
|
|
351
|
+
// Only close on item clicks if autoClose is true or 'inside'
|
|
352
|
+
// false: only close on toggle click (ignore item clicks)
|
|
353
|
+
// 'inside': close on item/toggle clicks (ignore body clicks)
|
|
354
|
+
// 'outside': only close on toggle/body clicks (ignore item clicks)
|
|
355
|
+
// true: close on any click (toggle, item, or body)
|
|
356
|
+
if (this.autoClose === true || this.autoClose === 'inside') {
|
|
357
|
+
this.root.toggleIsShown(event);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
onfocus(_event) {
|
|
361
|
+
this.root.activeItemIndex = this.#itemIndex;
|
|
362
|
+
}
|
|
363
|
+
onkeydown(event) {
|
|
364
|
+
handleKeydown(event, this.root);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
// Svelte Context key for sharing the DropdownRootState.
|
|
368
|
+
const DropdownRootContext = new Context('dropdown-root');
|
|
369
|
+
// Initializes and provides the DropdownRootState via Svelte Context.
|
|
370
|
+
// This allows child components (Toggle, Menu, Item) to access and interact with the root state.
|
|
371
|
+
export function initDropdownRootState(props) {
|
|
372
|
+
const rootState = new DropdownRootState(props);
|
|
373
|
+
return DropdownRootContext.set(rootState);
|
|
374
|
+
}
|
|
375
|
+
// Initializes DropdownToggleState, ensuring it has access to the DropdownRootState from context.
|
|
376
|
+
export function initDropdownToggleState(props) {
|
|
377
|
+
if (!DropdownRootContext.exists()) {
|
|
378
|
+
throw new Error('DropdownRootState must be initialized before DropdownToggleState');
|
|
379
|
+
}
|
|
380
|
+
const rootState = DropdownRootContext.get();
|
|
381
|
+
return new DropdownToggleState(props, rootState);
|
|
382
|
+
}
|
|
383
|
+
// Initializes DropdownMenuState, ensuring it has access to the DropdownRootState from context.
|
|
384
|
+
export function initDropdownMenuState(props) {
|
|
385
|
+
if (!DropdownRootContext.exists()) {
|
|
386
|
+
// Changed error message to reflect DropdownMenuState dependency
|
|
387
|
+
throw new Error('DropdownRootState must be initialized before DropdownMenuState');
|
|
388
|
+
}
|
|
389
|
+
const rootState = DropdownRootContext.get();
|
|
390
|
+
return new DropdownMenuState(props, rootState);
|
|
391
|
+
}
|
|
392
|
+
// Initializes DropdownItemState, ensuring it has access to the DropdownRootState from context.
|
|
393
|
+
export function initDropdownItemState(props) {
|
|
394
|
+
if (!DropdownRootContext.exists()) {
|
|
395
|
+
throw new Error('DropdownRootState must be initialized before DropdownItemState');
|
|
396
|
+
}
|
|
397
|
+
const rootState = DropdownRootContext.get();
|
|
398
|
+
const itemState = new DropdownItemState(props, rootState);
|
|
399
|
+
rootState.registerItem(itemState);
|
|
400
|
+
return itemState;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Handles keyboard navigation for the toggle and items within the dropdown.
|
|
404
|
+
* Supports opening the dropdown with ArrowUp/ArrowDown and navigating between items.
|
|
405
|
+
*
|
|
406
|
+
* @param event KeyboardEvent
|
|
407
|
+
* @param root DropdownRootState
|
|
408
|
+
*/
|
|
409
|
+
function handleKeydown(event, root) {
|
|
410
|
+
const { key } = event;
|
|
411
|
+
const isUpOrDownEvent = ['ArrowUp', 'ArrowDown'].includes(event.key);
|
|
412
|
+
if (isUpOrDownEvent && !root.isShown) {
|
|
413
|
+
event.preventDefault();
|
|
414
|
+
root.toggleIsShown(event);
|
|
415
|
+
// Wait for the dropdown to be shown and items to be rendered before focusing.
|
|
416
|
+
tick().then(() => {
|
|
417
|
+
if (key === 'ArrowDown') {
|
|
418
|
+
root.focusOnNextItem();
|
|
419
|
+
}
|
|
420
|
+
else if (key === 'ArrowUp') {
|
|
421
|
+
root.focusOnPreviousItem();
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
if (key === 'ArrowDown') {
|
|
427
|
+
event.preventDefault();
|
|
428
|
+
root.focusOnNextItem();
|
|
429
|
+
}
|
|
430
|
+
else if (key === 'ArrowUp') {
|
|
431
|
+
event.preventDefault();
|
|
432
|
+
root.focusOnPreviousItem();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Dropdown from './composition.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as Dropdown from './composition.js';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ButtonRootProps } from '../Button/index.js';
|
|
2
|
+
import type { AnchorElement, DivElement, HeadingElement, HeadingLevels, ListItemElement, PopperOffset, SpanElement, UListElement } from '../common/types.js';
|
|
3
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
4
|
+
export type DropdownAutoClose = boolean | 'inside' | 'outside';
|
|
5
|
+
export type DropdownDisplay = 'dynamic' | 'static';
|
|
6
|
+
export type DropdownDirection = 'dropdown' | 'dropdown-center' | 'dropdown-end' | 'dropup' | 'dropup-center' | 'dropup-end' | 'dropend' | 'dropstart';
|
|
7
|
+
export type DropdownMenuContainer = string | HTMLElement | false;
|
|
8
|
+
export type DropdownRootProps = DivElement & {
|
|
9
|
+
autoClose?: DropdownAutoClose;
|
|
10
|
+
direction?: DropdownDirection;
|
|
11
|
+
display?: DropdownDisplay;
|
|
12
|
+
isButtonGroup?: boolean;
|
|
13
|
+
onHide?: EventListener;
|
|
14
|
+
onHidden?: EventListener;
|
|
15
|
+
onShow?: EventListener;
|
|
16
|
+
onShown?: EventListener;
|
|
17
|
+
};
|
|
18
|
+
export type DropdownToggleProps = ButtonRootProps & {
|
|
19
|
+
isSplit?: boolean;
|
|
20
|
+
onclick?: EventListener;
|
|
21
|
+
onkeydown?: EventListener;
|
|
22
|
+
};
|
|
23
|
+
export type DropdownMenuProps = UListElement & {
|
|
24
|
+
container?: DropdownMenuContainer;
|
|
25
|
+
isDark?: boolean;
|
|
26
|
+
isEnd?: boolean;
|
|
27
|
+
offset?: PopperOffset;
|
|
28
|
+
};
|
|
29
|
+
export type DropdownItemProps = AnchorElement & {
|
|
30
|
+
href?: HTMLAnchorAttributes['href'];
|
|
31
|
+
isActive?: boolean;
|
|
32
|
+
isDisabled?: boolean;
|
|
33
|
+
listItemProps?: ListItemElement;
|
|
34
|
+
onclick?: EventListener;
|
|
35
|
+
onfocus?: EventListener;
|
|
36
|
+
onkeydown?: EventListener;
|
|
37
|
+
};
|
|
38
|
+
export type DropdownHeaderProps = HeadingElement & {
|
|
39
|
+
level?: HeadingLevels;
|
|
40
|
+
listItemProps?: ListItemElement;
|
|
41
|
+
};
|
|
42
|
+
export type DropdownDividerProps = DivElement & {
|
|
43
|
+
listItemProps?: ListItemElement;
|
|
44
|
+
};
|
|
45
|
+
export type DropdownTextProps = SpanElement & {
|
|
46
|
+
listItemProps?: ListItemElement;
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { default as CheckInput } from './form-check-input.svelte';
|
|
2
|
+
export { default as CheckLabel } from './form-check-label.svelte';
|
|
3
|
+
export { default as Check } from './form-check.svelte';
|
|
4
|
+
export { default as ColorInput } from './form-color-input.svelte';
|
|
5
|
+
export { default as DateInput } from './form-date-input.svelte';
|
|
6
|
+
export { default as DatetimeLocalInput } from './form-datetime-local-input.svelte';
|
|
7
|
+
export { default as EmailInput } from './form-email-input.svelte';
|
|
8
|
+
export { default as Feedback } from './form-feedback.svelte';
|
|
9
|
+
export { default as FileInput } from './form-file-input.svelte';
|
|
10
|
+
export { default as Floating } from './form-floating.svelte';
|
|
11
|
+
export { default as HelperText } from './form-helper-text.svelte';
|
|
12
|
+
export { default as HiddenInput } from './form-hidden-input.svelte';
|
|
13
|
+
export { default as ImageInput } from './form-image-input.svelte';
|
|
14
|
+
export { default as InputGroupText } from './form-input-group-text.svelte';
|
|
15
|
+
export { default as InputGroup } from './form-input-group.svelte';
|
|
16
|
+
export { default as InputLabel } from './form-input-label.svelte';
|
|
17
|
+
export { default as MonthInput } from './form-month-input.svelte';
|
|
18
|
+
export { default as NumberInput } from './form-number-input.svelte';
|
|
19
|
+
export { default as PasswordInput } from './form-password-input.svelte';
|
|
20
|
+
export { default as RadioInput } from './form-radio-input.svelte';
|
|
21
|
+
export { default as RadioLabel } from './form-radio-label.svelte';
|
|
22
|
+
export { default as RangeInput } from './form-range-input.svelte';
|
|
23
|
+
export { default as SearchInput } from './form-search-input.svelte';
|
|
24
|
+
export { default as Select } from './form-select.svelte';
|
|
25
|
+
export { default as SwitchInput } from './form-switch-input.svelte';
|
|
26
|
+
export { default as SwitchLabel } from './form-switch-label.svelte';
|
|
27
|
+
export { default as TelephoneInput } from './form-telephone-input.svelte';
|
|
28
|
+
export { default as TextArea } from './form-text-area.svelte';
|
|
29
|
+
export { default as TextInput } from './form-text-input.svelte';
|
|
30
|
+
export { default as TimeInput } from './form-time-input.svelte';
|
|
31
|
+
export { default as UrlInput } from './form-url-input.svelte';
|
|
32
|
+
export { default as WeekInput } from './form-week-Input.svelte';
|
|
33
|
+
export { default as Root } from './form.svelte';
|
|
34
|
+
export type { FormCheckInputProps as CheckInputProps, FormCheckLabelProps as CheckLabelProps, FormCheckProps as CheckProps, FormColorInputProps as ColorInputProps, FormDateInputProps as DateInputProps, FormDatetimeLocalInputProps as DatetimeLocalInputProps, FormEmailInputProps as EmailInputProps, FormFeedbackProps as FeedbackProps, FormFileInputProps as FileInputProps, FormFloatingProps as FloatingProps, FormHelperTextProps as HelperTextProps, FormHiddenInputProps as HiddenInputProps, FormImageInputProps as ImageInputProps, FormInputGroupProps as InputGroupProps, FormInputGroupTextProps as InputGroupTextProps, FormInputLabelProps as InputLabelProps, FormMonthInputProps as MonthInputProps, FormNumberInputProps as NumberInputProps, FormPasswordInputProps as PasswordInputProps, FormRadioInputProps as RadioInputProps, FormRadioLabelProps as RadioLabelProps, FormRangeInputProps as RangeInputProps, FormRootProps as RootProps, FormSearchInputProps as SearchInputProps, FormSelectProps as SelectProps, FormSwitchInputProps as SwitchInputProps, FormSwitchLabelProps as SwitchLabelProps, FormTelephoneInputProps as TelephoneInputProps, FormTextAreaProps as TextAreaProps, FormTextInputProps as TextInputProps, FormTimeInputProps as TimeInputProps, FormUrlInputProps as UrlInputProps, FormWeekInputProps as WeekInputProps } from './types.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { default as CheckInput } from './form-check-input.svelte';
|
|
2
|
+
export { default as CheckLabel } from './form-check-label.svelte';
|
|
3
|
+
export { default as Check } from './form-check.svelte';
|
|
4
|
+
export { default as ColorInput } from './form-color-input.svelte';
|
|
5
|
+
export { default as DateInput } from './form-date-input.svelte';
|
|
6
|
+
export { default as DatetimeLocalInput } from './form-datetime-local-input.svelte';
|
|
7
|
+
export { default as EmailInput } from './form-email-input.svelte';
|
|
8
|
+
export { default as Feedback } from './form-feedback.svelte';
|
|
9
|
+
export { default as FileInput } from './form-file-input.svelte';
|
|
10
|
+
export { default as Floating } from './form-floating.svelte';
|
|
11
|
+
export { default as HelperText } from './form-helper-text.svelte';
|
|
12
|
+
export { default as HiddenInput } from './form-hidden-input.svelte';
|
|
13
|
+
export { default as ImageInput } from './form-image-input.svelte';
|
|
14
|
+
export { default as InputGroupText } from './form-input-group-text.svelte';
|
|
15
|
+
export { default as InputGroup } from './form-input-group.svelte';
|
|
16
|
+
export { default as InputLabel } from './form-input-label.svelte';
|
|
17
|
+
export { default as MonthInput } from './form-month-input.svelte';
|
|
18
|
+
export { default as NumberInput } from './form-number-input.svelte';
|
|
19
|
+
export { default as PasswordInput } from './form-password-input.svelte';
|
|
20
|
+
export { default as RadioInput } from './form-radio-input.svelte';
|
|
21
|
+
export { default as RadioLabel } from './form-radio-label.svelte';
|
|
22
|
+
export { default as RangeInput } from './form-range-input.svelte';
|
|
23
|
+
export { default as SearchInput } from './form-search-input.svelte';
|
|
24
|
+
export { default as Select } from './form-select.svelte';
|
|
25
|
+
export { default as SwitchInput } from './form-switch-input.svelte';
|
|
26
|
+
export { default as SwitchLabel } from './form-switch-label.svelte';
|
|
27
|
+
export { default as TelephoneInput } from './form-telephone-input.svelte';
|
|
28
|
+
export { default as TextArea } from './form-text-area.svelte';
|
|
29
|
+
export { default as TextInput } from './form-text-input.svelte';
|
|
30
|
+
export { default as TimeInput } from './form-time-input.svelte';
|
|
31
|
+
export { default as UrlInput } from './form-url-input.svelte';
|
|
32
|
+
export { default as WeekInput } from './form-week-Input.svelte';
|
|
33
|
+
export { default as Root } from './form.svelte';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
## Form.CheckInput
|
|
4
|
+
Bootstrap-styled checkbox input component for boolean selections.
|
|
5
|
+
|
|
6
|
+
@example
|
|
7
|
+
```svelte
|
|
8
|
+
// Default checkbox
|
|
9
|
+
<Form.Check>
|
|
10
|
+
<Form.CheckInput id="checkDefault" name="checkDefault" value="" />
|
|
11
|
+
<Form.CheckLabel for="checkDefault">Default checkbox</Form.CheckLabel>
|
|
12
|
+
</Form.Check>
|
|
13
|
+
|
|
14
|
+
// Checked checkbox
|
|
15
|
+
<Form.Check>
|
|
16
|
+
<Form.CheckInput checked id="checkChecked" name="checkChecked" value="" />
|
|
17
|
+
<Form.CheckLabel for="checkChecked">Checked checkbox</Form.CheckLabel>
|
|
18
|
+
</Form.Check>
|
|
19
|
+
|
|
20
|
+
// Disabled checkbox
|
|
21
|
+
<Form.Check>
|
|
22
|
+
<Form.CheckInput disabled id="checkDisabled" name="checkDisabled" value="" />
|
|
23
|
+
<Form.CheckLabel for="checkDisabled">Disabled checkbox</Form.CheckLabel>
|
|
24
|
+
</Form.Check>
|
|
25
|
+
|
|
26
|
+
// Disabled and checked checkbox
|
|
27
|
+
<Form.Check>
|
|
28
|
+
<Form.CheckInput checked disabled id="checkDisabledChecked" name="checkDisabledChecked" value="" />
|
|
29
|
+
<Form.CheckLabel for="checkDisabledChecked">Disabled checked checkbox</Form.CheckLabel>
|
|
30
|
+
</Form.Check>
|
|
31
|
+
|
|
32
|
+
// Indeterminate checkbox
|
|
33
|
+
<Form.Check>
|
|
34
|
+
<Form.CheckInput id="checkReadonly" isIndeterminate={true} name="checkReadonly" value="" />
|
|
35
|
+
<Form.CheckLabel for="checkReadonly">Indeterminate checkbox</Form.CheckLabel>
|
|
36
|
+
</Form.Check>
|
|
37
|
+
```
|
|
38
|
+
### Props
|
|
39
|
+
- `checked` (boolean): Optional. Binds the checkbox state. If undefined, the checkbox is unchecked.
|
|
40
|
+
- `class` (string): Optional. Additional CSS classes to apply to the checkbox.
|
|
41
|
+
- `elementRef` (HTMLInputElement): Optional. Reference to the checkbox DOM element.
|
|
42
|
+
- `isIndeterminate` (boolean): Optional. Sets the checkbox to indeterminate state when true.
|
|
43
|
+
- `isInvalid` (boolean): Optional. Indicates whether the input is invalid. If undefined, no validation styles are applied.
|
|
44
|
+
- `isValid` (boolean): Optional. Indicates whether the input is valid. If undefined, no validation styles are applied.
|
|
45
|
+
-->
|
|
46
|
+
<script lang="ts">import { noop, uniqueClsx } from '../common/index.js';
|
|
47
|
+
let { checked = $bindable(false), class: classValues, elementRef = $bindable(null), group = $bindable(null), isIndeterminate, isInvalid, isValid, onchange = noop, value = undefined, ...restOfProps } = $props();
|
|
48
|
+
let classes = $derived(uniqueClsx('form-check-input', {
|
|
49
|
+
'is-valid': isValid,
|
|
50
|
+
'is-invalid': isInvalid
|
|
51
|
+
}, classValues));
|
|
52
|
+
const handleChange = (event) => {
|
|
53
|
+
if (group !== null) {
|
|
54
|
+
if (!Array.isArray(group)) {
|
|
55
|
+
console.warn('Form.CheckInput: `group` prop should be an array when used for grouped inputs.');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const isIncluded = group.includes(value);
|
|
59
|
+
if (!isIncluded) {
|
|
60
|
+
// Add the value to the group array
|
|
61
|
+
group = [...group, value];
|
|
62
|
+
}
|
|
63
|
+
else if (isIncluded) {
|
|
64
|
+
// Remove the value from the group array
|
|
65
|
+
group = group.filter((val) => val !== value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (onchange !== null) {
|
|
69
|
+
onchange(event);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
$effect(() => {
|
|
73
|
+
if (elementRef && isIndeterminate !== undefined) {
|
|
74
|
+
elementRef.indeterminate = isIndeterminate;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
$effect(() => {
|
|
78
|
+
if (group !== null && Array.isArray(group)) {
|
|
79
|
+
checked = group.includes(value);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<input
|
|
85
|
+
aria-invalid={isInvalid === true ? 'true' : isValid === true ? 'false' : undefined}
|
|
86
|
+
bind:this={elementRef}
|
|
87
|
+
bind:checked
|
|
88
|
+
class={classes}
|
|
89
|
+
onchange={handleChange}
|
|
90
|
+
type="checkbox"
|
|
91
|
+
{value}
|
|
92
|
+
{...restOfProps} />
|