@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,71 @@
|
|
|
1
|
+
import { type EasingFunction } from 'bezier-easing';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
/**
|
|
4
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0.25, 0.1, 0.25, 1).
|
|
5
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease
|
|
6
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
7
|
+
*/
|
|
8
|
+
export declare const ease: EasingFunction;
|
|
9
|
+
/**
|
|
10
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0.42, 0, 1, 1).
|
|
11
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease-in
|
|
12
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
13
|
+
*/
|
|
14
|
+
export declare const easeIn: EasingFunction;
|
|
15
|
+
/**
|
|
16
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0, 0, 0.58, 1).
|
|
17
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease-out
|
|
18
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
19
|
+
*/
|
|
20
|
+
export declare const easeOut: EasingFunction;
|
|
21
|
+
/**
|
|
22
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0.42, 0, 0.58, 1).
|
|
23
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease-in-out
|
|
24
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
25
|
+
*/
|
|
26
|
+
export declare const easeInOut: EasingFunction;
|
|
27
|
+
/**
|
|
28
|
+
* This easing function will match the CSS `cubic-bezier()` easing function using a cubic Bezier curve defined by the points (0, 0, 1, 1).
|
|
29
|
+
* @param x1 A number between 0 and 1 that defines the x-coordinate of the first control point of the cubic Bezier curve.
|
|
30
|
+
* @param y1 A number between 0 and 1 that defines the y-coordinate of the first control point of the cubic Bezier curve.
|
|
31
|
+
* @param x2 A number between 0 and 1 that defines the x-coordinate of the second control point of the cubic Bezier curve.
|
|
32
|
+
* @param y2 A number between 0 and 1 that defines the y-coordinate of the second control point of the cubic Bezier curve.
|
|
33
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/cubic-bezier
|
|
34
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
35
|
+
*/
|
|
36
|
+
export declare const cubicBezier: (x1: number, y1: number, x2: number, y2: number) => EasingFunction;
|
|
37
|
+
/**
|
|
38
|
+
* A utility function that wraps the `clsx` function to remove duplicate class names and reserve the order of appearance.
|
|
39
|
+
* @param args - The same input parameters as the `clsx` function.
|
|
40
|
+
* @returns A string containing unique class names.
|
|
41
|
+
*/
|
|
42
|
+
export declare function uniqueClsx(...args: Parameters<typeof clsx>): string;
|
|
43
|
+
export type CSSProperties = {
|
|
44
|
+
[key: string]: string | number;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Converts a JavaScript style object to a CSS string
|
|
48
|
+
* @param {CSSProperties} styleObj - Object with camelCase style properties
|
|
49
|
+
* @returns {string} CSS string with kebab-case properties
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* const styleObj = {
|
|
53
|
+
* backgroundColor: 'red',
|
|
54
|
+
* fontSize: '16px',
|
|
55
|
+
* marginTop: '10px'
|
|
56
|
+
* };
|
|
57
|
+
* const cssString = toStyle(styleObj);
|
|
58
|
+
* console.log(cssString); // "background-color: red; font-size: 16px; margin-top: 10px"
|
|
59
|
+
*/
|
|
60
|
+
export declare function toStyle(styleObj: CSSProperties): string;
|
|
61
|
+
/**
|
|
62
|
+
* Converts a CSS string to a JavaScript style object
|
|
63
|
+
* @param {string|null|undefined} cssString - CSS string with kebab-case properties
|
|
64
|
+
* @returns {CSSProperties} Object with camelCase style properties
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* const cssString = "background-color: red; font-size: 16px; margin-top: 10px";
|
|
68
|
+
* const styleObj = fromStyle(cssString);
|
|
69
|
+
* console.log(styleObj); // { backgroundColor: 'red', fontSize: '16px', marginTop: '10px' }
|
|
70
|
+
*/
|
|
71
|
+
export declare function fromStyle(cssString: string | null | undefined): CSSProperties;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import BezierEasing, {} from 'bezier-easing';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
/**
|
|
4
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0.25, 0.1, 0.25, 1).
|
|
5
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease
|
|
6
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
7
|
+
*/
|
|
8
|
+
export const ease = BezierEasing(0.25, 0.1, 0.25, 1);
|
|
9
|
+
/**
|
|
10
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0.42, 0, 1, 1).
|
|
11
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease-in
|
|
12
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
13
|
+
*/
|
|
14
|
+
export const easeIn = BezierEasing(0.42, 0, 1, 1);
|
|
15
|
+
/**
|
|
16
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0, 0, 0.58, 1).
|
|
17
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease-out
|
|
18
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
19
|
+
*/
|
|
20
|
+
export const easeOut = BezierEasing(0, 0, 0.58, 1);
|
|
21
|
+
/**
|
|
22
|
+
* This easing function will match the CSS `ease-in-out` easing function using a cubic Bezier curve defined by the points (0.42, 0, 0.58, 1).
|
|
23
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function#ease-in-out
|
|
24
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
25
|
+
*/
|
|
26
|
+
export const easeInOut = BezierEasing(0.42, 0, 0.58, 1);
|
|
27
|
+
/**
|
|
28
|
+
* This easing function will match the CSS `cubic-bezier()` easing function using a cubic Bezier curve defined by the points (0, 0, 1, 1).
|
|
29
|
+
* @param x1 A number between 0 and 1 that defines the x-coordinate of the first control point of the cubic Bezier curve.
|
|
30
|
+
* @param y1 A number between 0 and 1 that defines the y-coordinate of the first control point of the cubic Bezier curve.
|
|
31
|
+
* @param x2 A number between 0 and 1 that defines the x-coordinate of the second control point of the cubic Bezier curve.
|
|
32
|
+
* @param y2 A number between 0 and 1 that defines the y-coordinate of the second control point of the cubic Bezier curve.
|
|
33
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/cubic-bezier
|
|
34
|
+
* @returns {EasingFunction} The easing function: (input: number): number;
|
|
35
|
+
*/
|
|
36
|
+
export const cubicBezier = (x1, y1, x2, y2) => {
|
|
37
|
+
return BezierEasing(x1, y1, x2, y2);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A utility function that wraps the `clsx` function to remove duplicate class names and reserve the order of appearance.
|
|
41
|
+
* @param args - The same input parameters as the `clsx` function.
|
|
42
|
+
* @returns A string containing unique class names.
|
|
43
|
+
*/
|
|
44
|
+
export function uniqueClsx(...args) {
|
|
45
|
+
const classString = clsx(...args);
|
|
46
|
+
// Early return for empty strings
|
|
47
|
+
if (!classString) {
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
// Using a regex split will normalize whitespace and split simultaneously...
|
|
51
|
+
const classes = classString.split(/\s+/);
|
|
52
|
+
const seen = new Set();
|
|
53
|
+
const result = [];
|
|
54
|
+
for (let i = 0; i < classes.length; i++) {
|
|
55
|
+
const cls = classes[i];
|
|
56
|
+
if (cls && !seen.has(cls)) {
|
|
57
|
+
seen.add(cls);
|
|
58
|
+
result.push(cls);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return result.join(' ');
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Converts a JavaScript style object to a CSS string
|
|
65
|
+
* @param {CSSProperties} styleObj - Object with camelCase style properties
|
|
66
|
+
* @returns {string} CSS string with kebab-case properties
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const styleObj = {
|
|
70
|
+
* backgroundColor: 'red',
|
|
71
|
+
* fontSize: '16px',
|
|
72
|
+
* marginTop: '10px'
|
|
73
|
+
* };
|
|
74
|
+
* const cssString = toStyle(styleObj);
|
|
75
|
+
* console.log(cssString); // "background-color: red; font-size: 16px; margin-top: 10px"
|
|
76
|
+
*/
|
|
77
|
+
export function toStyle(styleObj) {
|
|
78
|
+
if (!styleObj || typeof styleObj !== 'object') {
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
return Object.entries(styleObj)
|
|
82
|
+
.map(([key, value]) => {
|
|
83
|
+
// Convert camelCase to kebab-case (e.g., flexDirection to flex-direction)
|
|
84
|
+
const kebabKey = key.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`);
|
|
85
|
+
return `${kebabKey}: ${value}`;
|
|
86
|
+
})
|
|
87
|
+
.join(';');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Converts a CSS string to a JavaScript style object
|
|
91
|
+
* @param {string|null|undefined} cssString - CSS string with kebab-case properties
|
|
92
|
+
* @returns {CSSProperties} Object with camelCase style properties
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* const cssString = "background-color: red; font-size: 16px; margin-top: 10px";
|
|
96
|
+
* const styleObj = fromStyle(cssString);
|
|
97
|
+
* console.log(styleObj); // { backgroundColor: 'red', fontSize: '16px', marginTop: '10px' }
|
|
98
|
+
*/
|
|
99
|
+
export function fromStyle(cssString) {
|
|
100
|
+
if (!cssString || typeof cssString !== 'string') {
|
|
101
|
+
return {};
|
|
102
|
+
}
|
|
103
|
+
const styleObj = {};
|
|
104
|
+
// Split the string by semicolons and process each style declaration
|
|
105
|
+
cssString.split(';').forEach((declaration) => {
|
|
106
|
+
// Skip empty declarations
|
|
107
|
+
if (!declaration.trim()) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
// Split the declaration into property and value
|
|
111
|
+
const [property, ...valueParts] = declaration.split(':');
|
|
112
|
+
// Handle case where there might be colons in the value (like in data URLs)
|
|
113
|
+
const value = valueParts.join(':').trim();
|
|
114
|
+
const trimmedProperty = property?.trim();
|
|
115
|
+
if (!trimmedProperty || !value) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let camelProperty;
|
|
119
|
+
// Special handling for CSS custom properties (variables)
|
|
120
|
+
if (trimmedProperty.startsWith('--')) {
|
|
121
|
+
// Keep CSS variables as-is, don't convert to camelCase
|
|
122
|
+
camelProperty = trimmedProperty;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// Convert kebab-case to camelCase (e.g., flex-direction to flexDirection)
|
|
126
|
+
camelProperty = trimmedProperty.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
127
|
+
}
|
|
128
|
+
// Try to convert numeric strings to numbers, but not for CSS variables or var() functions
|
|
129
|
+
const parsedValue = !isNaN(Number(value)) && value.trim() !== '' && !value.includes('var(') ? Number(value) : value;
|
|
130
|
+
styleObj[camelProperty] = parsedValue;
|
|
131
|
+
});
|
|
132
|
+
return styleObj;
|
|
133
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the value of an attribute from an HTML element
|
|
3
|
+
* @param element - The HTML element
|
|
4
|
+
* @param attribute - The attribute name
|
|
5
|
+
* @returns The attribute value or null if not found
|
|
6
|
+
*/
|
|
7
|
+
export declare const getAttribute: (element: HTMLElement | null | undefined, attribute: string) => string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if an HTML element has a specific attribute
|
|
10
|
+
* @param element - The HTML element
|
|
11
|
+
* @param attribute - The attribute name
|
|
12
|
+
* @returns Whether the element has the attribute
|
|
13
|
+
*/
|
|
14
|
+
export declare const hasAttribute: (element: HTMLElement | null | undefined, attribute: string) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if the given element has focus.
|
|
17
|
+
* @param element - The HTML element to check
|
|
18
|
+
* @returns {boolean} True if the element has focus, false otherwise
|
|
19
|
+
*/
|
|
20
|
+
export declare const hasFocus: (element: HTMLElement | null | undefined) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if an HTML element is disabled.
|
|
23
|
+
* @param element - The HTML element to check
|
|
24
|
+
* @returns {boolean} True if the element is disabled, false otherwise.
|
|
25
|
+
*/
|
|
26
|
+
export declare const isDisabled: (element: HTMLElement | null | undefined) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Checks if the document is in RTL (right-to-left) mode
|
|
29
|
+
* @returns {boolean} True if the document is in RTL mode, false otherwise
|
|
30
|
+
*/
|
|
31
|
+
export declare const isRTL: () => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Removes an attribute from an HTML element
|
|
34
|
+
* @param element - The HTML element
|
|
35
|
+
* @param attribute - The attribute name
|
|
36
|
+
*/
|
|
37
|
+
export declare const removeAttribute: (element: HTMLElement | null | undefined, attribute: string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Sets an attribute on an HTML element
|
|
40
|
+
* @param element - The HTML element
|
|
41
|
+
* @param attribute - The attribute name
|
|
42
|
+
* @param value - The attribute value
|
|
43
|
+
*/
|
|
44
|
+
export declare const setAttribute: (element: HTMLElement | null | undefined, attribute: string, value: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Toggles an attribute on an HTML element
|
|
47
|
+
* @param element - The HTML element
|
|
48
|
+
* @param attribute - The attribute name
|
|
49
|
+
* @param defaultValue - The default value to set when adding the attribute
|
|
50
|
+
*/
|
|
51
|
+
export declare const toggleAttribute: (element: HTMLElement | null | undefined, attribute: string, defaultValue?: string) => void;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the value of an attribute from an HTML element
|
|
3
|
+
* @param element - The HTML element
|
|
4
|
+
* @param attribute - The attribute name
|
|
5
|
+
* @returns The attribute value or null if not found
|
|
6
|
+
*/
|
|
7
|
+
export const getAttribute = (element, attribute) => {
|
|
8
|
+
if (!element) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return element.getAttribute(attribute);
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Checks if an HTML element has a specific attribute
|
|
15
|
+
* @param element - The HTML element
|
|
16
|
+
* @param attribute - The attribute name
|
|
17
|
+
* @returns Whether the element has the attribute
|
|
18
|
+
*/
|
|
19
|
+
export const hasAttribute = (element, attribute) => {
|
|
20
|
+
if (!element) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return element.hasAttribute(attribute);
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the given element has focus.
|
|
27
|
+
* @param element - The HTML element to check
|
|
28
|
+
* @returns {boolean} True if the element has focus, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
export const hasFocus = (element) => {
|
|
31
|
+
if (!element) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return element === document.activeElement;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Checks if an HTML element is disabled.
|
|
38
|
+
* @param element - The HTML element to check
|
|
39
|
+
* @returns {boolean} True if the element is disabled, false otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export const isDisabled = (element) => {
|
|
42
|
+
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
if (element.classList.contains('disabled')) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
// Check if it's an input, button, or other element with a disabled property
|
|
49
|
+
if ('disabled' in element) {
|
|
50
|
+
return element.disabled;
|
|
51
|
+
}
|
|
52
|
+
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Checks if the document is in RTL (right-to-left) mode
|
|
56
|
+
* @returns {boolean} True if the document is in RTL mode, false otherwise
|
|
57
|
+
*/
|
|
58
|
+
export const isRTL = () => typeof document !== 'undefined' && document.documentElement.dir === 'rtl';
|
|
59
|
+
/**
|
|
60
|
+
* Removes an attribute from an HTML element
|
|
61
|
+
* @param element - The HTML element
|
|
62
|
+
* @param attribute - The attribute name
|
|
63
|
+
*/
|
|
64
|
+
export const removeAttribute = (element, attribute) => {
|
|
65
|
+
if (!element) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
element.removeAttribute(attribute);
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Sets an attribute on an HTML element
|
|
72
|
+
* @param element - The HTML element
|
|
73
|
+
* @param attribute - The attribute name
|
|
74
|
+
* @param value - The attribute value
|
|
75
|
+
*/
|
|
76
|
+
export const setAttribute = (element, attribute, value) => {
|
|
77
|
+
if (!element) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
element.setAttribute(attribute, value);
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Toggles an attribute on an HTML element
|
|
84
|
+
* @param element - The HTML element
|
|
85
|
+
* @param attribute - The attribute name
|
|
86
|
+
* @param defaultValue - The default value to set when adding the attribute
|
|
87
|
+
*/
|
|
88
|
+
export const toggleAttribute = (element, attribute, defaultValue = '') => {
|
|
89
|
+
if (!element) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (hasAttribute(element, attribute)) {
|
|
93
|
+
removeAttribute(element, attribute);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
setAttribute(element, attribute, defaultValue);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Nav } from '../Nav/index.js';
|
|
2
|
+
import type { Tab } from '../Tab/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Manages the state for the Nav root component.
|
|
5
|
+
* Handles the tracking of active nav links and provides methods to set them.
|
|
6
|
+
* Supports both tab and non-tab navigation.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NavRootState {
|
|
9
|
+
#private;
|
|
10
|
+
readonly props: Nav.RootProps;
|
|
11
|
+
constructor(props: Nav.RootProps);
|
|
12
|
+
isNavLinkActive(navLinkId: string): boolean;
|
|
13
|
+
registerNavLinkState(linkState: NavLinkState): void;
|
|
14
|
+
setNavLinkActive(navLinkId: string): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Manages the state for an individual Nav link.
|
|
18
|
+
* Tracks active state and provides methods to handle clicks.
|
|
19
|
+
*/
|
|
20
|
+
export declare class NavLinkState {
|
|
21
|
+
readonly props: Nav.LinkProps;
|
|
22
|
+
readonly root: TabRootState | NavRootState;
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
ariaControls: string | undefined;
|
|
25
|
+
readonly isTab: boolean;
|
|
26
|
+
constructor(props: Nav.LinkProps, root: TabRootState | NavRootState);
|
|
27
|
+
onclick(event: Event): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Manages the state for the Tab root component.
|
|
31
|
+
* Handles the tracking of active tab panes and provides methods to set them.
|
|
32
|
+
*/
|
|
33
|
+
export declare class TabRootState {
|
|
34
|
+
#private;
|
|
35
|
+
readonly props: Tab.RootProps;
|
|
36
|
+
constructor(props: Tab.RootProps);
|
|
37
|
+
isNavLinkActive(navLinkId: string): boolean;
|
|
38
|
+
isTabPaneActive(tabPaneId: string): boolean;
|
|
39
|
+
registerNavLinkState(linkState: NavLinkState): void;
|
|
40
|
+
registerTabPaneState(paneState: TabPaneState): void;
|
|
41
|
+
setNavLinkActive(navLinkId: string): void;
|
|
42
|
+
setTabPaneActive(tabPaneId: string): void;
|
|
43
|
+
getAriaLabelledBy(tabPaneId: string): string | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Manages the state for an individual Tab pane.
|
|
47
|
+
* Tracks active state and provides methods to handle clicks.
|
|
48
|
+
*/
|
|
49
|
+
export declare class TabPaneState {
|
|
50
|
+
readonly props: Tab.PaneProps;
|
|
51
|
+
readonly root: TabRootState;
|
|
52
|
+
isActive: boolean;
|
|
53
|
+
ariaLabelledBy: string | undefined;
|
|
54
|
+
constructor(props: Tab.PaneProps, root: TabRootState);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Checks if the Tab root context exists.
|
|
58
|
+
* @returns True if the Tab root context exists, false otherwise.
|
|
59
|
+
*/
|
|
60
|
+
export declare const doesTabRootContextExists: () => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Creates and initializes the Nav root state.
|
|
63
|
+
* This function is used to set up the context for the Nav component.
|
|
64
|
+
* @param props - The props for the Nav root component.
|
|
65
|
+
* @returns The created NavRootState instance.
|
|
66
|
+
*/
|
|
67
|
+
export declare function initNavRootState(props: Nav.RootProps): NavRootState;
|
|
68
|
+
/**
|
|
69
|
+
* Creates and initializes the Tab root state.
|
|
70
|
+
* This function is used to set up the context for the Tab component.
|
|
71
|
+
* @param props - The props for the Tab root component.
|
|
72
|
+
* @returns The created TabRootState instance.
|
|
73
|
+
*/
|
|
74
|
+
export declare function initTabRootState(props: Tab.RootProps): TabRootState;
|
|
75
|
+
/**
|
|
76
|
+
* Creates and initializes the Nav link state.
|
|
77
|
+
* This function is used to set up the context for the Nav link component.
|
|
78
|
+
* @param props - The props for the Nav link component.
|
|
79
|
+
* @returns The created NavLinkState instance.
|
|
80
|
+
*/
|
|
81
|
+
export declare function initNavLinkState(props: Nav.LinkProps): NavLinkState;
|
|
82
|
+
/**
|
|
83
|
+
* Creates and initializes the Tab pane state.
|
|
84
|
+
* This function is used to set up the context for the Tab pane component.
|
|
85
|
+
* @param props - The props for the Tab pane component.
|
|
86
|
+
* @returns The created TabPaneState instance.
|
|
87
|
+
*/
|
|
88
|
+
export declare function initTabPaneState(props: Tab.PaneProps): TabPaneState;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Context } from './index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Manages the state for the Nav root component.
|
|
4
|
+
* Handles the tracking of active nav links and provides methods to set them.
|
|
5
|
+
* Supports both tab and non-tab navigation.
|
|
6
|
+
*/
|
|
7
|
+
export class NavRootState {
|
|
8
|
+
props;
|
|
9
|
+
#activeNavLinkId = $state('');
|
|
10
|
+
#navLinkStates = [];
|
|
11
|
+
constructor(props) {
|
|
12
|
+
this.props = props;
|
|
13
|
+
this.isNavLinkActive = this.isNavLinkActive.bind(this);
|
|
14
|
+
this.registerNavLinkState = this.registerNavLinkState.bind(this);
|
|
15
|
+
this.setNavLinkActive = this.setNavLinkActive.bind(this);
|
|
16
|
+
}
|
|
17
|
+
isNavLinkActive(navLinkId) {
|
|
18
|
+
return this.#activeNavLinkId === navLinkId;
|
|
19
|
+
}
|
|
20
|
+
registerNavLinkState(linkState) {
|
|
21
|
+
this.#navLinkStates.push(linkState);
|
|
22
|
+
}
|
|
23
|
+
setNavLinkActive(navLinkId) {
|
|
24
|
+
this.#activeNavLinkId = navLinkId;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Manages the state for an individual Nav link.
|
|
29
|
+
* Tracks active state and provides methods to handle clicks.
|
|
30
|
+
*/
|
|
31
|
+
export class NavLinkState {
|
|
32
|
+
props;
|
|
33
|
+
root;
|
|
34
|
+
isActive = $derived.by(() => this.root.isNavLinkActive(this.props.id || ''));
|
|
35
|
+
ariaControls = $derived.by(() => (this.isTab ? this.props.href?.replace('#', '') : undefined));
|
|
36
|
+
isTab;
|
|
37
|
+
constructor(props, root) {
|
|
38
|
+
this.props = props;
|
|
39
|
+
this.root = root;
|
|
40
|
+
this.onclick = this.onclick.bind(this);
|
|
41
|
+
this.isTab = root instanceof TabRootState;
|
|
42
|
+
if (this.props.isActive) {
|
|
43
|
+
this.root.setNavLinkActive(this.props.id || '');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
onclick(event) {
|
|
47
|
+
if (this.isTab && this.root instanceof TabRootState) {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
event.stopImmediatePropagation();
|
|
50
|
+
const tabPaneId = this.props.href?.replace('#', '');
|
|
51
|
+
if (tabPaneId) {
|
|
52
|
+
this.root.setNavLinkActive(this.props.id || '');
|
|
53
|
+
this.root.setTabPaneActive(tabPaneId);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else if (this.props.href === '#' || this.props.href === '#!') {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
event.stopImmediatePropagation();
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.root.setNavLinkActive(this.props.id || '');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Manages the state for the Tab root component.
|
|
67
|
+
* Handles the tracking of active tab panes and provides methods to set them.
|
|
68
|
+
*/
|
|
69
|
+
export class TabRootState {
|
|
70
|
+
props;
|
|
71
|
+
#activeNavLinkId = $state('');
|
|
72
|
+
#activeTabPaneId = $state('');
|
|
73
|
+
#navLinkStates = [];
|
|
74
|
+
#tabPaneStates = [];
|
|
75
|
+
constructor(props) {
|
|
76
|
+
this.props = props;
|
|
77
|
+
this.isNavLinkActive = this.isNavLinkActive.bind(this);
|
|
78
|
+
this.isTabPaneActive = this.isTabPaneActive.bind(this);
|
|
79
|
+
this.registerNavLinkState = this.registerNavLinkState.bind(this);
|
|
80
|
+
this.registerTabPaneState = this.registerTabPaneState.bind(this);
|
|
81
|
+
this.setNavLinkActive = this.setNavLinkActive.bind(this);
|
|
82
|
+
this.setTabPaneActive = this.setTabPaneActive.bind(this);
|
|
83
|
+
}
|
|
84
|
+
isNavLinkActive(navLinkId) {
|
|
85
|
+
return this.#activeNavLinkId === navLinkId;
|
|
86
|
+
}
|
|
87
|
+
isTabPaneActive(tabPaneId) {
|
|
88
|
+
return this.#activeTabPaneId === tabPaneId;
|
|
89
|
+
}
|
|
90
|
+
registerNavLinkState(linkState) {
|
|
91
|
+
this.#navLinkStates.push(linkState);
|
|
92
|
+
}
|
|
93
|
+
registerTabPaneState(paneState) {
|
|
94
|
+
this.#tabPaneStates.push(paneState);
|
|
95
|
+
}
|
|
96
|
+
setNavLinkActive(navLinkId) {
|
|
97
|
+
this.#activeNavLinkId = navLinkId;
|
|
98
|
+
}
|
|
99
|
+
setTabPaneActive(tabPaneId) {
|
|
100
|
+
this.#activeTabPaneId = tabPaneId;
|
|
101
|
+
}
|
|
102
|
+
getAriaLabelledBy(tabPaneId) {
|
|
103
|
+
const navLink = this.#navLinkStates.find((link) => link.props.href === `#${tabPaneId}`);
|
|
104
|
+
return navLink ? navLink.props.id || undefined : undefined;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Manages the state for an individual Tab pane.
|
|
109
|
+
* Tracks active state and provides methods to handle clicks.
|
|
110
|
+
*/
|
|
111
|
+
export class TabPaneState {
|
|
112
|
+
props;
|
|
113
|
+
root;
|
|
114
|
+
isActive = $derived.by(() => this.root.isTabPaneActive(this.props.id || ''));
|
|
115
|
+
ariaLabelledBy = $derived.by(() => this.root.getAriaLabelledBy(this.props.id || ''));
|
|
116
|
+
constructor(props, root) {
|
|
117
|
+
this.props = props;
|
|
118
|
+
this.root = root;
|
|
119
|
+
if (this.props.isActive) {
|
|
120
|
+
this.root.setTabPaneActive(this.props.id || '');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const NavRootContext = new Context('nav-root');
|
|
125
|
+
const TabRootContext = new Context('tab-root');
|
|
126
|
+
/**
|
|
127
|
+
* Checks if the Tab root context exists.
|
|
128
|
+
* @returns True if the Tab root context exists, false otherwise.
|
|
129
|
+
*/
|
|
130
|
+
export const doesTabRootContextExists = () => TabRootContext.exists();
|
|
131
|
+
/**
|
|
132
|
+
* Creates and initializes the Nav root state.
|
|
133
|
+
* This function is used to set up the context for the Nav component.
|
|
134
|
+
* @param props - The props for the Nav root component.
|
|
135
|
+
* @returns The created NavRootState instance.
|
|
136
|
+
*/
|
|
137
|
+
export function initNavRootState(props) {
|
|
138
|
+
const rootState = new NavRootState(props);
|
|
139
|
+
return NavRootContext.set(rootState);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Creates and initializes the Tab root state.
|
|
143
|
+
* This function is used to set up the context for the Tab component.
|
|
144
|
+
* @param props - The props for the Tab root component.
|
|
145
|
+
* @returns The created TabRootState instance.
|
|
146
|
+
*/
|
|
147
|
+
export function initTabRootState(props) {
|
|
148
|
+
const rootState = new TabRootState(props);
|
|
149
|
+
return TabRootContext.set(rootState);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Creates and initializes the Nav link state.
|
|
153
|
+
* This function is used to set up the context for the Nav link component.
|
|
154
|
+
* @param props - The props for the Nav link component.
|
|
155
|
+
* @returns The created NavLinkState instance.
|
|
156
|
+
*/
|
|
157
|
+
export function initNavLinkState(props) {
|
|
158
|
+
if (TabRootContext.exists()) {
|
|
159
|
+
const rootState = TabRootContext.get();
|
|
160
|
+
const linkState = new NavLinkState(props, rootState);
|
|
161
|
+
rootState.registerNavLinkState(linkState);
|
|
162
|
+
return linkState;
|
|
163
|
+
}
|
|
164
|
+
else if (!NavRootContext.exists()) {
|
|
165
|
+
throw new Error('Nav.Link requires Nav.Root or Tab.Root context. Please ensure either the Nav.Root or Tab.Root is initialized before Nav.Link.');
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const rootState = NavRootContext.get();
|
|
169
|
+
const linkState = new NavLinkState(props, rootState);
|
|
170
|
+
rootState.registerNavLinkState(linkState);
|
|
171
|
+
return linkState;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Creates and initializes the Tab pane state.
|
|
176
|
+
* This function is used to set up the context for the Tab pane component.
|
|
177
|
+
* @param props - The props for the Tab pane component.
|
|
178
|
+
* @returns The created TabPaneState instance.
|
|
179
|
+
*/
|
|
180
|
+
export function initTabPaneState(props) {
|
|
181
|
+
if (!TabRootContext.exists()) {
|
|
182
|
+
throw new Error('Tab.Pane requires Tab.Root context. Please ensure Tab.Root is initialized before Tab.Pane.');
|
|
183
|
+
}
|
|
184
|
+
const rootState = TabRootContext.get();
|
|
185
|
+
const paneState = new TabPaneState(props, rootState);
|
|
186
|
+
rootState.registerTabPaneState(paneState);
|
|
187
|
+
return paneState;
|
|
188
|
+
}
|