@govtechsg/sgds-web-component 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/card-element.cjs.js +1 -0
- package/base/card-element.cjs.js.map +1 -1
- package/base/card-element.js +1 -0
- package/base/card-element.js.map +1 -1
- package/base/card.cjs.js +1 -0
- package/base/card.cjs.js.map +1 -1
- package/base/card.js +1 -0
- package/base/card.js.map +1 -1
- package/base/dropdown-element.cjs.js +1 -0
- package/base/dropdown-element.cjs.js.map +1 -1
- package/base/dropdown-element.js +1 -0
- package/base/dropdown-element.js.map +1 -1
- package/base/dropdown-list-element.cjs.js +1 -0
- package/base/dropdown-list-element.cjs.js.map +1 -1
- package/base/dropdown-list-element.js +1 -0
- package/base/dropdown-list-element.js.map +1 -1
- package/base/form-check-element.cjs.js +1 -0
- package/base/form-check-element.cjs.js.map +1 -1
- package/base/form-check-element.js +1 -0
- package/base/form-check-element.js.map +1 -1
- package/base/link-element.cjs.js +1 -0
- package/base/link-element.cjs.js.map +1 -1
- package/base/link-element.js +1 -0
- package/base/link-element.js.map +1 -1
- package/base/sgds-element.cjs.js +1 -0
- package/base/sgds-element.cjs.js.map +1 -1
- package/base/sgds-element.cjs2.js +1 -0
- package/base/sgds-element.cjs2.js.map +1 -1
- package/base/sgds-element.js +1 -0
- package/base/sgds-element.js.map +1 -1
- package/base/sgds-element2.js +1 -0
- package/base/sgds-element2.js.map +1 -1
- package/components/Accordion/accordion-item.cjs.js +1 -0
- package/components/Accordion/accordion-item.cjs.js.map +1 -1
- package/components/Accordion/accordion-item.js +1 -0
- package/components/Accordion/accordion-item.js.map +1 -1
- package/components/Accordion/accordion.cjs.js +1 -0
- package/components/Accordion/accordion.cjs.js.map +1 -1
- package/components/Accordion/accordion.js +1 -0
- package/components/Accordion/accordion.js.map +1 -1
- package/components/Accordion/sgds-accordion-item.cjs.js +1 -0
- package/components/Accordion/sgds-accordion-item.cjs.js.map +1 -1
- package/components/Accordion/sgds-accordion-item.js +1 -0
- package/components/Accordion/sgds-accordion-item.js.map +1 -1
- package/components/Accordion/sgds-accordion.cjs.js +1 -0
- package/components/Accordion/sgds-accordion.cjs.js.map +1 -1
- package/components/Accordion/sgds-accordion.js +1 -0
- package/components/Accordion/sgds-accordion.js.map +1 -1
- package/components/ActionCard/action-card.cjs.js +1 -0
- package/components/ActionCard/action-card.cjs.js.map +1 -1
- package/components/ActionCard/action-card.js +1 -0
- package/components/ActionCard/action-card.js.map +1 -1
- package/components/ActionCard/sgds-action-card.cjs.js +1 -0
- package/components/ActionCard/sgds-action-card.cjs.js.map +1 -1
- package/components/ActionCard/sgds-action-card.js +1 -0
- package/components/ActionCard/sgds-action-card.js.map +1 -1
- package/components/Alert/alert-link.cjs.js +1 -0
- package/components/Alert/alert-link.cjs.js.map +1 -1
- package/components/Alert/alert-link.js +1 -0
- package/components/Alert/alert-link.js.map +1 -1
- package/components/Alert/alert.cjs.js +1 -0
- package/components/Alert/alert.cjs.js.map +1 -1
- package/components/Alert/alert.js +1 -0
- package/components/Alert/alert.js.map +1 -1
- package/components/Alert/sgds-alert-heading.cjs.js +1 -0
- package/components/Alert/sgds-alert-heading.cjs.js.map +1 -1
- package/components/Alert/sgds-alert-heading.js +1 -0
- package/components/Alert/sgds-alert-heading.js.map +1 -1
- package/components/Alert/sgds-alert-link.cjs.js +1 -0
- package/components/Alert/sgds-alert-link.cjs.js.map +1 -1
- package/components/Alert/sgds-alert-link.js +1 -0
- package/components/Alert/sgds-alert-link.js.map +1 -1
- package/components/Alert/sgds-alert.cjs.js +1 -0
- package/components/Alert/sgds-alert.cjs.js.map +1 -1
- package/components/Alert/sgds-alert.js +1 -0
- package/components/Alert/sgds-alert.js.map +1 -1
- package/components/Badge/badge.cjs.js +1 -0
- package/components/Badge/badge.cjs.js.map +1 -1
- package/components/Badge/badge.js +1 -0
- package/components/Badge/badge.js.map +1 -1
- package/components/Badge/sgds-badge.cjs.js +1 -0
- package/components/Badge/sgds-badge.cjs.js.map +1 -1
- package/components/Badge/sgds-badge.js +1 -0
- package/components/Badge/sgds-badge.js.map +1 -1
- package/components/Breadcrumb/breadcrumb-item.cjs.js +1 -0
- package/components/Breadcrumb/breadcrumb-item.cjs.js.map +1 -1
- package/components/Breadcrumb/breadcrumb-item.js +1 -0
- package/components/Breadcrumb/breadcrumb-item.js.map +1 -1
- package/components/Breadcrumb/breadcrumb.cjs.js +1 -0
- package/components/Breadcrumb/breadcrumb.cjs.js.map +1 -1
- package/components/Breadcrumb/breadcrumb.js +1 -0
- package/components/Breadcrumb/breadcrumb.js.map +1 -1
- package/components/Breadcrumb/sgds-breadcrumb-item.cjs.js +1 -0
- package/components/Breadcrumb/sgds-breadcrumb-item.cjs.js.map +1 -1
- package/components/Breadcrumb/sgds-breadcrumb-item.js +1 -0
- package/components/Breadcrumb/sgds-breadcrumb-item.js.map +1 -1
- package/components/Breadcrumb/sgds-breadcrumb.cjs.js +1 -0
- package/components/Breadcrumb/sgds-breadcrumb.cjs.js.map +1 -1
- package/components/Breadcrumb/sgds-breadcrumb.js +1 -0
- package/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
- package/components/Button/button.cjs.js +1 -0
- package/components/Button/button.cjs.js.map +1 -1
- package/components/Button/button.js +1 -0
- package/components/Button/button.js.map +1 -1
- package/components/Button/sgds-button.cjs.js +1 -0
- package/components/Button/sgds-button.cjs.js.map +1 -1
- package/components/Button/sgds-button.js +1 -0
- package/components/Button/sgds-button.js.map +1 -1
- package/components/Card/card.cjs.js +1 -0
- package/components/Card/card.cjs.js.map +1 -1
- package/components/Card/card.js +1 -0
- package/components/Card/card.js.map +1 -1
- package/components/Card/sgds-card.cjs.js +1 -0
- package/components/Card/sgds-card.cjs.js.map +1 -1
- package/components/Card/sgds-card.js +1 -0
- package/components/Card/sgds-card.js.map +1 -1
- package/components/Checkbox/checkbox.cjs.js +1 -0
- package/components/Checkbox/checkbox.cjs.js.map +1 -1
- package/components/Checkbox/checkbox.js +1 -0
- package/components/Checkbox/checkbox.js.map +1 -1
- package/components/Checkbox/sgds-checkbox.cjs.js +1 -0
- package/components/Checkbox/sgds-checkbox.cjs.js.map +1 -1
- package/components/Checkbox/sgds-checkbox.js +1 -0
- package/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/components/ComboBox/combo-box.cjs.js +1 -0
- package/components/ComboBox/combo-box.cjs.js.map +1 -1
- package/components/ComboBox/combo-box.js +1 -0
- package/components/ComboBox/combo-box.js.map +1 -1
- package/components/ComboBox/sgds-combo-box.cjs.js +1 -0
- package/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
- package/components/ComboBox/sgds-combo-box.js +1 -0
- package/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/components/Datepicker/datepicker-calendar.cjs.js +1 -0
- package/components/Datepicker/datepicker-calendar.cjs.js.map +1 -1
- package/components/Datepicker/datepicker-calendar.cjs2.js +1 -0
- package/components/Datepicker/datepicker-calendar.cjs2.js.map +1 -1
- package/components/Datepicker/datepicker-calendar.js +1 -0
- package/components/Datepicker/datepicker-calendar.js.map +1 -1
- package/components/Datepicker/datepicker-calendar2.js +1 -0
- package/components/Datepicker/datepicker-calendar2.js.map +1 -1
- package/components/Datepicker/datepicker-header.cjs.js +1 -0
- package/components/Datepicker/datepicker-header.cjs.js.map +1 -1
- package/components/Datepicker/datepicker-header.cjs2.js +1 -0
- package/components/Datepicker/datepicker-header.cjs2.js.map +1 -1
- package/components/Datepicker/datepicker-header.js +1 -0
- package/components/Datepicker/datepicker-header.js.map +1 -1
- package/components/Datepicker/datepicker-header2.js +1 -0
- package/components/Datepicker/datepicker-header2.js.map +1 -1
- package/components/Datepicker/datepicker-input.cjs.js +1 -0
- package/components/Datepicker/datepicker-input.cjs.js.map +1 -1
- package/components/Datepicker/datepicker-input.cjs2.js +1 -0
- package/components/Datepicker/datepicker-input.cjs2.js.map +1 -1
- package/components/Datepicker/datepicker-input.js +1 -0
- package/components/Datepicker/datepicker-input.js.map +1 -1
- package/components/Datepicker/datepicker-input2.js +1 -0
- package/components/Datepicker/datepicker-input2.js.map +1 -1
- package/components/Datepicker/datepicker.cjs.js +1 -0
- package/components/Datepicker/datepicker.cjs.js.map +1 -1
- package/components/Datepicker/datepicker.js +1 -0
- package/components/Datepicker/datepicker.js.map +1 -1
- package/components/Datepicker/sgds-datepicker.cjs.js +1 -0
- package/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
- package/components/Datepicker/sgds-datepicker.js +1 -0
- package/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/components/Drawer/drawer.cjs.js +1 -0
- package/components/Drawer/drawer.cjs.js.map +1 -1
- package/components/Drawer/drawer.js +1 -0
- package/components/Drawer/drawer.js.map +1 -1
- package/components/Drawer/sgds-drawer.cjs.js +1 -0
- package/components/Drawer/sgds-drawer.cjs.js.map +1 -1
- package/components/Drawer/sgds-drawer.js +1 -0
- package/components/Drawer/sgds-drawer.js.map +1 -1
- package/components/Dropdown/dropdown.cjs.js +1 -0
- package/components/Dropdown/dropdown.cjs.js.map +1 -1
- package/components/Dropdown/dropdown.js +1 -0
- package/components/Dropdown/dropdown.js.map +1 -1
- package/components/Dropdown/sgds-dropdown-item.cjs.js +1 -0
- package/components/Dropdown/sgds-dropdown-item.cjs.js.map +1 -1
- package/components/Dropdown/sgds-dropdown-item.js +1 -0
- package/components/Dropdown/sgds-dropdown-item.js.map +1 -1
- package/components/Dropdown/sgds-dropdown.cjs.js +1 -0
- package/components/Dropdown/sgds-dropdown.cjs.js.map +1 -1
- package/components/Dropdown/sgds-dropdown.js +1 -0
- package/components/Dropdown/sgds-dropdown.js.map +1 -1
- package/components/FileUpload/file-upload.cjs.js +1 -0
- package/components/FileUpload/file-upload.cjs.js.map +1 -1
- package/components/FileUpload/file-upload.js +1 -0
- package/components/FileUpload/file-upload.js.map +1 -1
- package/components/FileUpload/sgds-file-upload.cjs.js +1 -0
- package/components/FileUpload/sgds-file-upload.cjs.js.map +1 -1
- package/components/FileUpload/sgds-file-upload.js +1 -0
- package/components/FileUpload/sgds-file-upload.js.map +1 -1
- package/components/Footer/footer.cjs.js +1 -0
- package/components/Footer/footer.cjs.js.map +1 -1
- package/components/Footer/footer.js +1 -0
- package/components/Footer/footer.js.map +1 -1
- package/components/Footer/sgds-footer.cjs.js +1 -0
- package/components/Footer/sgds-footer.cjs.js.map +1 -1
- package/components/Footer/sgds-footer.js +1 -0
- package/components/Footer/sgds-footer.js.map +1 -1
- package/components/Input/input.cjs.js +1 -0
- package/components/Input/input.cjs.js.map +1 -1
- package/components/Input/input.js +1 -0
- package/components/Input/input.js.map +1 -1
- package/components/Input/sgds-input.cjs.js +1 -0
- package/components/Input/sgds-input.cjs.js.map +1 -1
- package/components/Input/sgds-input.js +1 -0
- package/components/Input/sgds-input.js.map +1 -1
- package/components/Mainnav/mainnav-dropdown.cjs.js +1 -0
- package/components/Mainnav/mainnav-dropdown.cjs.js.map +1 -1
- package/components/Mainnav/mainnav-dropdown.js +1 -0
- package/components/Mainnav/mainnav-dropdown.js.map +1 -1
- package/components/Mainnav/mainnav-item.cjs.js +1 -0
- package/components/Mainnav/mainnav-item.cjs.js.map +1 -1
- package/components/Mainnav/mainnav-item.js +1 -0
- package/components/Mainnav/mainnav-item.js.map +1 -1
- package/components/Mainnav/mainnav.cjs.js +1 -0
- package/components/Mainnav/mainnav.cjs.js.map +1 -1
- package/components/Mainnav/mainnav.js +1 -0
- package/components/Mainnav/mainnav.js.map +1 -1
- package/components/Mainnav/sgds-mainnav-dropdown.cjs.js +1 -0
- package/components/Mainnav/sgds-mainnav-dropdown.cjs.js.map +1 -1
- package/components/Mainnav/sgds-mainnav-dropdown.js +1 -0
- package/components/Mainnav/sgds-mainnav-dropdown.js.map +1 -1
- package/components/Mainnav/sgds-mainnav-item.cjs.js +1 -0
- package/components/Mainnav/sgds-mainnav-item.cjs.js.map +1 -1
- package/components/Mainnav/sgds-mainnav-item.js +1 -0
- package/components/Mainnav/sgds-mainnav-item.js.map +1 -1
- package/components/Mainnav/sgds-mainnav.cjs.js +1 -0
- package/components/Mainnav/sgds-mainnav.cjs.js.map +1 -1
- package/components/Mainnav/sgds-mainnav.js +1 -0
- package/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/components/Masthead/masthead.cjs.js +1 -0
- package/components/Masthead/masthead.cjs.js.map +1 -1
- package/components/Masthead/masthead.js +1 -0
- package/components/Masthead/masthead.js.map +1 -1
- package/components/Masthead/sgds-masthead.cjs.js +1 -0
- package/components/Masthead/sgds-masthead.cjs.js.map +1 -1
- package/components/Masthead/sgds-masthead.js +1 -0
- package/components/Masthead/sgds-masthead.js.map +1 -1
- package/components/Modal/modal.cjs.js +1 -0
- package/components/Modal/modal.cjs.js.map +1 -1
- package/components/Modal/modal.js +1 -0
- package/components/Modal/modal.js.map +1 -1
- package/components/Modal/sgds-modal.cjs.js +1 -0
- package/components/Modal/sgds-modal.cjs.js.map +1 -1
- package/components/Modal/sgds-modal.js +1 -0
- package/components/Modal/sgds-modal.js.map +1 -1
- package/components/Pagination/pagination.cjs.js +1 -0
- package/components/Pagination/pagination.cjs.js.map +1 -1
- package/components/Pagination/pagination.js +1 -0
- package/components/Pagination/pagination.js.map +1 -1
- package/components/Pagination/sgds-pagination.cjs.js +1 -0
- package/components/Pagination/sgds-pagination.cjs.js.map +1 -1
- package/components/Pagination/sgds-pagination.js +1 -0
- package/components/Pagination/sgds-pagination.js.map +1 -1
- package/components/Progress/progress-bar.cjs.js +1 -0
- package/components/Progress/progress-bar.cjs.js.map +1 -1
- package/components/Progress/progress-bar.js +1 -0
- package/components/Progress/progress-bar.js.map +1 -1
- package/components/Progress/progress.cjs.js +1 -0
- package/components/Progress/progress.cjs.js.map +1 -1
- package/components/Progress/progress.js +1 -0
- package/components/Progress/progress.js.map +1 -1
- package/components/Progress/sgds-progress-bar.cjs.js +1 -0
- package/components/Progress/sgds-progress-bar.cjs.js.map +1 -1
- package/components/Progress/sgds-progress-bar.js +1 -0
- package/components/Progress/sgds-progress-bar.js.map +1 -1
- package/components/Progress/sgds-progress.cjs.js +1 -0
- package/components/Progress/sgds-progress.cjs.js.map +1 -1
- package/components/Progress/sgds-progress.js +1 -0
- package/components/Progress/sgds-progress.js.map +1 -1
- package/components/QuantityToggle/quantity-toggle.cjs.js +1 -0
- package/components/QuantityToggle/quantity-toggle.cjs.js.map +1 -1
- package/components/QuantityToggle/quantity-toggle.js +1 -0
- package/components/QuantityToggle/quantity-toggle.js.map +1 -1
- package/components/QuantityToggle/sgds-quantity-toggle.cjs.js +1 -0
- package/components/QuantityToggle/sgds-quantity-toggle.cjs.js.map +1 -1
- package/components/QuantityToggle/sgds-quantity-toggle.js +1 -0
- package/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/components/Radio/radio-group.cjs.js +1 -0
- package/components/Radio/radio-group.cjs.js.map +1 -1
- package/components/Radio/radio-group.js +1 -0
- package/components/Radio/radio-group.js.map +1 -1
- package/components/Radio/radio.cjs.js +1 -0
- package/components/Radio/radio.cjs.js.map +1 -1
- package/components/Radio/radio.js +1 -0
- package/components/Radio/radio.js.map +1 -1
- package/components/Radio/sgds-radio-group.cjs.js +1 -0
- package/components/Radio/sgds-radio-group.cjs.js.map +1 -1
- package/components/Radio/sgds-radio-group.js +1 -0
- package/components/Radio/sgds-radio-group.js.map +1 -1
- package/components/Radio/sgds-radio.cjs.js +1 -0
- package/components/Radio/sgds-radio.cjs.js.map +1 -1
- package/components/Radio/sgds-radio.js +1 -0
- package/components/Radio/sgds-radio.js.map +1 -1
- package/components/Sidenav/sgds-sidenav-item.cjs.js +1 -0
- package/components/Sidenav/sgds-sidenav-item.cjs.js.map +1 -1
- package/components/Sidenav/sgds-sidenav-item.js +1 -0
- package/components/Sidenav/sgds-sidenav-item.js.map +1 -1
- package/components/Sidenav/sgds-sidenav-link.cjs.js +1 -0
- package/components/Sidenav/sgds-sidenav-link.cjs.js.map +1 -1
- package/components/Sidenav/sgds-sidenav-link.js +1 -0
- package/components/Sidenav/sgds-sidenav-link.js.map +1 -1
- package/components/Sidenav/sgds-sidenav.cjs.js +1 -0
- package/components/Sidenav/sgds-sidenav.cjs.js.map +1 -1
- package/components/Sidenav/sgds-sidenav.js +1 -0
- package/components/Sidenav/sgds-sidenav.js.map +1 -1
- package/components/Sidenav/sidenav-item.cjs.js +1 -0
- package/components/Sidenav/sidenav-item.cjs.js.map +1 -1
- package/components/Sidenav/sidenav-item.js +1 -0
- package/components/Sidenav/sidenav-item.js.map +1 -1
- package/components/Sidenav/sidenav-link.cjs.js +1 -0
- package/components/Sidenav/sidenav-link.cjs.js.map +1 -1
- package/components/Sidenav/sidenav-link.js +1 -0
- package/components/Sidenav/sidenav-link.js.map +1 -1
- package/components/Sidenav/sidenav.cjs.js +1 -0
- package/components/Sidenav/sidenav.cjs.js.map +1 -1
- package/components/Sidenav/sidenav.js +1 -0
- package/components/Sidenav/sidenav.js.map +1 -1
- package/components/Spinner/sgds-spinner.cjs.js +1 -0
- package/components/Spinner/sgds-spinner.cjs.js.map +1 -1
- package/components/Spinner/sgds-spinner.js +1 -0
- package/components/Spinner/sgds-spinner.js.map +1 -1
- package/components/Spinner/spinner.cjs.js +1 -0
- package/components/Spinner/spinner.cjs.js.map +1 -1
- package/components/Spinner/spinner.js +1 -0
- package/components/Spinner/spinner.js.map +1 -1
- package/components/Stepper/sgds-stepper.cjs.js +1 -0
- package/components/Stepper/sgds-stepper.cjs.js.map +1 -1
- package/components/Stepper/sgds-stepper.js +1 -0
- package/components/Stepper/sgds-stepper.js.map +1 -1
- package/components/Stepper/stepper.cjs.js +1 -0
- package/components/Stepper/stepper.cjs.js.map +1 -1
- package/components/Stepper/stepper.js +1 -0
- package/components/Stepper/stepper.js.map +1 -1
- package/components/Tab/sgds-tab-group.cjs.js +1 -0
- package/components/Tab/sgds-tab-group.cjs.js.map +1 -1
- package/components/Tab/sgds-tab-group.js +1 -0
- package/components/Tab/sgds-tab-group.js.map +1 -1
- package/components/Tab/sgds-tab-panel.cjs.js +1 -0
- package/components/Tab/sgds-tab-panel.cjs.js.map +1 -1
- package/components/Tab/sgds-tab-panel.js +1 -0
- package/components/Tab/sgds-tab-panel.js.map +1 -1
- package/components/Tab/sgds-tab.cjs.js +1 -0
- package/components/Tab/sgds-tab.cjs.js.map +1 -1
- package/components/Tab/sgds-tab.js +1 -0
- package/components/Tab/sgds-tab.js.map +1 -1
- package/components/Tab/tab-group.cjs.js +1 -0
- package/components/Tab/tab-group.cjs.js.map +1 -1
- package/components/Tab/tab-group.js +1 -0
- package/components/Tab/tab-group.js.map +1 -1
- package/components/Tab/tab-panel.cjs.js +1 -0
- package/components/Tab/tab-panel.cjs.js.map +1 -1
- package/components/Tab/tab-panel.js +1 -0
- package/components/Tab/tab-panel.js.map +1 -1
- package/components/Tab/tab.cjs.js +1 -0
- package/components/Tab/tab.cjs.js.map +1 -1
- package/components/Tab/tab.js +1 -0
- package/components/Tab/tab.js.map +1 -1
- package/components/Table/sgds-table.cjs.js +1 -0
- package/components/Table/sgds-table.cjs.js.map +1 -1
- package/components/Table/sgds-table.js +1 -0
- package/components/Table/sgds-table.js.map +1 -1
- package/components/Table/table.cjs.js +1 -0
- package/components/Table/table.cjs.js.map +1 -1
- package/components/Table/table.js +1 -0
- package/components/Table/table.js.map +1 -1
- package/components/Textarea/sgds-textarea.cjs.js +1 -0
- package/components/Textarea/sgds-textarea.cjs.js.map +1 -1
- package/components/Textarea/sgds-textarea.js +1 -0
- package/components/Textarea/sgds-textarea.js.map +1 -1
- package/components/Textarea/textarea.cjs.js +1 -0
- package/components/Textarea/textarea.cjs.js.map +1 -1
- package/components/Textarea/textarea.js +1 -0
- package/components/Textarea/textarea.js.map +1 -1
- package/components/Toast/sgds-toast-container.cjs.js +1 -0
- package/components/Toast/sgds-toast-container.cjs.js.map +1 -1
- package/components/Toast/sgds-toast-container.js +1 -0
- package/components/Toast/sgds-toast-container.js.map +1 -1
- package/components/Toast/sgds-toast.cjs.js +1 -0
- package/components/Toast/sgds-toast.cjs.js.map +1 -1
- package/components/Toast/sgds-toast.js +1 -0
- package/components/Toast/sgds-toast.js.map +1 -1
- package/components/Toast/toast-container.cjs.js +1 -0
- package/components/Toast/toast-container.cjs.js.map +1 -1
- package/components/Toast/toast-container.js +1 -0
- package/components/Toast/toast-container.js.map +1 -1
- package/components/Toast/toast.cjs.js +1 -0
- package/components/Toast/toast.cjs.js.map +1 -1
- package/components/Toast/toast.js +1 -0
- package/components/Toast/toast.js.map +1 -1
- package/components/Tooltip/sgds-tooltip.cjs.js +1 -0
- package/components/Tooltip/sgds-tooltip.cjs.js.map +1 -1
- package/components/Tooltip/sgds-tooltip.js +1 -0
- package/components/Tooltip/sgds-tooltip.js.map +1 -1
- package/components/Tooltip/tooltip.cjs.js +1 -0
- package/components/Tooltip/tooltip.cjs.js.map +1 -1
- package/components/Tooltip/tooltip.js +1 -0
- package/components/Tooltip/tooltip.js.map +1 -1
- package/internals/CloseButton/close-button.cjs.js +1 -0
- package/internals/CloseButton/close-button.cjs.js.map +1 -1
- package/internals/CloseButton/close-button.js +1 -0
- package/internals/CloseButton/close-button.js.map +1 -1
- package/internals/CloseButton/sgds-close-button.cjs.js +1 -0
- package/internals/CloseButton/sgds-close-button.cjs.js.map +1 -1
- package/internals/CloseButton/sgds-close-button.js +1 -0
- package/internals/CloseButton/sgds-close-button.js.map +1 -1
- package/package.json +1 -1
- package/react/accordion/index.cjs.js +1 -0
- package/react/accordion/index.cjs.js.map +1 -1
- package/react/accordion/index.js +1 -0
- package/react/accordion/index.js.map +1 -1
- package/react/accordion-item/index.cjs.js +1 -0
- package/react/accordion-item/index.cjs.js.map +1 -1
- package/react/accordion-item/index.js +1 -0
- package/react/accordion-item/index.js.map +1 -1
- package/react/action-card/index.cjs.js +1 -0
- package/react/action-card/index.cjs.js.map +1 -1
- package/react/action-card/index.js +1 -0
- package/react/action-card/index.js.map +1 -1
- package/react/alert/index.cjs.js +1 -0
- package/react/alert/index.cjs.js.map +1 -1
- package/react/alert/index.js +1 -0
- package/react/alert/index.js.map +1 -1
- package/react/alert-heading/index.cjs.js +1 -0
- package/react/alert-heading/index.cjs.js.map +1 -1
- package/react/alert-heading/index.js +1 -0
- package/react/alert-heading/index.js.map +1 -1
- package/react/alert-link/index.cjs.js +1 -0
- package/react/alert-link/index.cjs.js.map +1 -1
- package/react/alert-link/index.js +1 -0
- package/react/alert-link/index.js.map +1 -1
- package/react/badge/index.cjs.js +1 -0
- package/react/badge/index.cjs.js.map +1 -1
- package/react/badge/index.js +1 -0
- package/react/badge/index.js.map +1 -1
- package/react/breadcrumb/index.cjs.js +1 -0
- package/react/breadcrumb/index.cjs.js.map +1 -1
- package/react/breadcrumb/index.js +1 -0
- package/react/breadcrumb/index.js.map +1 -1
- package/react/breadcrumb-item/index.cjs.js +1 -0
- package/react/breadcrumb-item/index.cjs.js.map +1 -1
- package/react/breadcrumb-item/index.js +1 -0
- package/react/breadcrumb-item/index.js.map +1 -1
- package/react/button/index.cjs.js +1 -0
- package/react/button/index.cjs.js.map +1 -1
- package/react/button/index.js +1 -0
- package/react/button/index.js.map +1 -1
- package/react/card/index.cjs.js +1 -0
- package/react/card/index.cjs.js.map +1 -1
- package/react/card/index.js +1 -0
- package/react/card/index.js.map +1 -1
- package/react/checkbox/index.cjs.js +1 -0
- package/react/checkbox/index.cjs.js.map +1 -1
- package/react/checkbox/index.js +1 -0
- package/react/checkbox/index.js.map +1 -1
- package/react/combo-box/index.cjs.js +1 -0
- package/react/combo-box/index.cjs.js.map +1 -1
- package/react/combo-box/index.js +1 -0
- package/react/combo-box/index.js.map +1 -1
- package/react/datepicker/index.cjs.js +1 -0
- package/react/datepicker/index.cjs.js.map +1 -1
- package/react/datepicker/index.js +1 -0
- package/react/datepicker/index.js.map +1 -1
- package/react/drawer/index.cjs.js +1 -0
- package/react/drawer/index.cjs.js.map +1 -1
- package/react/drawer/index.js +1 -0
- package/react/drawer/index.js.map +1 -1
- package/react/dropdown/index.cjs.js +1 -0
- package/react/dropdown/index.cjs.js.map +1 -1
- package/react/dropdown/index.js +1 -0
- package/react/dropdown/index.js.map +1 -1
- package/react/dropdown-item/index.cjs.js +1 -0
- package/react/dropdown-item/index.cjs.js.map +1 -1
- package/react/dropdown-item/index.js +1 -0
- package/react/dropdown-item/index.js.map +1 -1
- package/react/file-upload/index.cjs.js +1 -0
- package/react/file-upload/index.cjs.js.map +1 -1
- package/react/file-upload/index.js +1 -0
- package/react/file-upload/index.js.map +1 -1
- package/react/footer/index.cjs.js +1 -0
- package/react/footer/index.cjs.js.map +1 -1
- package/react/footer/index.js +1 -0
- package/react/footer/index.js.map +1 -1
- package/react/index.cjs.js +1 -0
- package/react/index.cjs.js.map +1 -1
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/react/input/index.cjs.js +1 -0
- package/react/input/index.cjs.js.map +1 -1
- package/react/input/index.js +1 -0
- package/react/input/index.js.map +1 -1
- package/react/mainnav/index.cjs.js +1 -0
- package/react/mainnav/index.cjs.js.map +1 -1
- package/react/mainnav/index.js +1 -0
- package/react/mainnav/index.js.map +1 -1
- package/react/mainnav-dropdown/index.cjs.js +1 -0
- package/react/mainnav-dropdown/index.cjs.js.map +1 -1
- package/react/mainnav-dropdown/index.js +1 -0
- package/react/mainnav-dropdown/index.js.map +1 -1
- package/react/mainnav-item/index.cjs.js +1 -0
- package/react/mainnav-item/index.cjs.js.map +1 -1
- package/react/mainnav-item/index.js +1 -0
- package/react/mainnav-item/index.js.map +1 -1
- package/react/masthead/index.cjs.js +1 -0
- package/react/masthead/index.cjs.js.map +1 -1
- package/react/masthead/index.js +1 -0
- package/react/masthead/index.js.map +1 -1
- package/react/modal/index.cjs.js +1 -0
- package/react/modal/index.cjs.js.map +1 -1
- package/react/modal/index.js +1 -0
- package/react/modal/index.js.map +1 -1
- package/react/pagination/index.cjs.js +1 -0
- package/react/pagination/index.cjs.js.map +1 -1
- package/react/pagination/index.js +1 -0
- package/react/pagination/index.js.map +1 -1
- package/react/progress/index.cjs.js +1 -0
- package/react/progress/index.cjs.js.map +1 -1
- package/react/progress/index.js +1 -0
- package/react/progress/index.js.map +1 -1
- package/react/progress-bar/index.cjs.js +1 -0
- package/react/progress-bar/index.cjs.js.map +1 -1
- package/react/progress-bar/index.js +1 -0
- package/react/progress-bar/index.js.map +1 -1
- package/react/quantity-toggle/index.cjs.js +1 -0
- package/react/quantity-toggle/index.cjs.js.map +1 -1
- package/react/quantity-toggle/index.js +1 -0
- package/react/quantity-toggle/index.js.map +1 -1
- package/react/radio/index.cjs.js +1 -0
- package/react/radio/index.cjs.js.map +1 -1
- package/react/radio/index.js +1 -0
- package/react/radio/index.js.map +1 -1
- package/react/radio-group/index.cjs.js +1 -0
- package/react/radio-group/index.cjs.js.map +1 -1
- package/react/radio-group/index.js +1 -0
- package/react/radio-group/index.js.map +1 -1
- package/react/sidenav/index.cjs.js +1 -0
- package/react/sidenav/index.cjs.js.map +1 -1
- package/react/sidenav/index.js +1 -0
- package/react/sidenav/index.js.map +1 -1
- package/react/sidenav-item/index.cjs.js +1 -0
- package/react/sidenav-item/index.cjs.js.map +1 -1
- package/react/sidenav-item/index.js +1 -0
- package/react/sidenav-item/index.js.map +1 -1
- package/react/sidenav-link/index.cjs.js +1 -0
- package/react/sidenav-link/index.cjs.js.map +1 -1
- package/react/sidenav-link/index.js +1 -0
- package/react/sidenav-link/index.js.map +1 -1
- package/react/spinner/index.cjs.js +1 -0
- package/react/spinner/index.cjs.js.map +1 -1
- package/react/spinner/index.js +1 -0
- package/react/spinner/index.js.map +1 -1
- package/react/stepper/index.cjs.js +1 -0
- package/react/stepper/index.cjs.js.map +1 -1
- package/react/stepper/index.js +1 -0
- package/react/stepper/index.js.map +1 -1
- package/react/tab/index.cjs.js +1 -0
- package/react/tab/index.cjs.js.map +1 -1
- package/react/tab/index.js +1 -0
- package/react/tab/index.js.map +1 -1
- package/react/tab-group/index.cjs.js +1 -0
- package/react/tab-group/index.cjs.js.map +1 -1
- package/react/tab-group/index.js +1 -0
- package/react/tab-group/index.js.map +1 -1
- package/react/tab-panel/index.cjs.js +1 -0
- package/react/tab-panel/index.cjs.js.map +1 -1
- package/react/tab-panel/index.js +1 -0
- package/react/tab-panel/index.js.map +1 -1
- package/react/table/index.cjs.js +1 -0
- package/react/table/index.cjs.js.map +1 -1
- package/react/table/index.js +1 -0
- package/react/table/index.js.map +1 -1
- package/react/textarea/index.cjs.js +1 -0
- package/react/textarea/index.cjs.js.map +1 -1
- package/react/textarea/index.js +1 -0
- package/react/textarea/index.js.map +1 -1
- package/react/toast/index.cjs.js +1 -0
- package/react/toast/index.cjs.js.map +1 -1
- package/react/toast/index.js +1 -0
- package/react/toast/index.js.map +1 -1
- package/react/toast-container/index.cjs.js +1 -0
- package/react/toast-container/index.cjs.js.map +1 -1
- package/react/toast-container/index.js +1 -0
- package/react/toast-container/index.js.map +1 -1
- package/react/tooltip/index.cjs.js +1 -0
- package/react/tooltip/index.cjs.js.map +1 -1
- package/react/tooltip/index.js +1 -0
- package/react/tooltip/index.js.map +1 -1
- package/styles/anchor.cjs.js +1 -0
- package/styles/anchor.cjs.js.map +1 -1
- package/styles/anchor.js +1 -0
- package/styles/anchor.js.map +1 -1
- package/styles/bg-variants.cjs.js +1 -0
- package/styles/bg-variants.cjs.js.map +1 -1
- package/styles/bg-variants.js +1 -0
- package/styles/bg-variants.js.map +1 -1
- package/styles/border-variants.cjs.js +1 -0
- package/styles/border-variants.cjs.js.map +1 -1
- package/styles/border-variants.js +1 -0
- package/styles/border-variants.js.map +1 -1
- package/styles/feedback.cjs.js +1 -0
- package/styles/feedback.cjs.js.map +1 -1
- package/styles/feedback.js +1 -0
- package/styles/feedback.js.map +1 -1
- package/styles/form-hint.cjs.js +1 -0
- package/styles/form-hint.cjs.js.map +1 -1
- package/styles/form-hint.js +1 -0
- package/styles/form-hint.js.map +1 -1
- package/styles/form-label.cjs.js +1 -0
- package/styles/form-label.cjs.js.map +1 -1
- package/styles/form-label.js +1 -0
- package/styles/form-label.js.map +1 -1
- package/styles/header-class.cjs.js +1 -0
- package/styles/header-class.cjs.js.map +1 -1
- package/styles/header-class.js +1 -0
- package/styles/header-class.js.map +1 -1
- package/styles/paragraph.cjs.js +1 -0
- package/styles/paragraph.cjs.js.map +1 -1
- package/styles/paragraph.js +1 -0
- package/styles/paragraph.js.map +1 -1
- package/styles/svg.cjs.js +1 -0
- package/styles/svg.cjs.js.map +1 -1
- package/styles/svg.js +1 -0
- package/styles/svg.js.map +1 -1
- package/styles/text-variants.cjs.js +1 -0
- package/styles/text-variants.cjs.js.map +1 -1
- package/styles/text-variants.js +1 -0
- package/styles/text-variants.js.map +1 -1
- package/utils/animate.cjs.js +1 -0
- package/utils/animate.cjs.js.map +1 -1
- package/utils/animate.js +1 -0
- package/utils/animate.js.map +1 -1
- package/utils/animation-registry.cjs.js +1 -0
- package/utils/animation-registry.cjs.js.map +1 -1
- package/utils/animation-registry.js +1 -0
- package/utils/animation-registry.js.map +1 -1
- package/utils/breakpoints.cjs.js +1 -0
- package/utils/breakpoints.cjs.js.map +1 -1
- package/utils/breakpoints.js +1 -0
- package/utils/breakpoints.js.map +1 -1
- package/utils/defaultvalue.cjs.js +1 -0
- package/utils/defaultvalue.cjs.js.map +1 -1
- package/utils/defaultvalue.js +1 -0
- package/utils/defaultvalue.js.map +1 -1
- package/utils/event.cjs.js +1 -0
- package/utils/event.cjs.js.map +1 -1
- package/utils/event.js +1 -0
- package/utils/event.js.map +1 -1
- package/utils/form.cjs.js +1 -0
- package/utils/form.cjs.js.map +1 -1
- package/utils/form.js +1 -0
- package/utils/form.js.map +1 -1
- package/utils/generateId.cjs.js +1 -0
- package/utils/generateId.cjs.js.map +1 -1
- package/utils/generateId.js +1 -0
- package/utils/generateId.js.map +1 -1
- package/utils/mergeDeep.cjs.js +1 -0
- package/utils/mergeDeep.cjs.js.map +1 -1
- package/utils/mergeDeep.js +1 -0
- package/utils/mergeDeep.js.map +1 -1
- package/utils/modal.cjs.js +1 -0
- package/utils/modal.cjs.js.map +1 -1
- package/utils/modal.js +1 -0
- package/utils/modal.js.map +1 -1
- package/utils/object.cjs.js +1 -0
- package/utils/object.cjs.js.map +1 -1
- package/utils/object.js +1 -0
- package/utils/object.js.map +1 -1
- package/utils/scroll.cjs.js +1 -0
- package/utils/scroll.cjs.js.map +1 -1
- package/utils/scroll.js +1 -0
- package/utils/scroll.js.map +1 -1
- package/utils/slot.cjs.js +1 -0
- package/utils/slot.cjs.js.map +1 -1
- package/utils/slot.js +1 -0
- package/utils/slot.js.map +1 -1
- package/utils/tabbable.cjs.js +1 -0
- package/utils/tabbable.cjs.js.map +1 -1
- package/utils/tabbable.js +1 -0
- package/utils/tabbable.js.map +1 -1
- package/utils/time.cjs.js +1 -0
- package/utils/time.cjs.js.map +1 -1
- package/utils/time.js +1 -0
- package/utils/time.js.map +1 -1
- package/utils/watch.cjs.js +1 -0
- package/utils/watch.cjs.js.map +1 -1
- package/utils/watch.js +1 -0
- package/utils/watch.js.map +1 -1
package/styles/paragraph.js
CHANGED
package/styles/paragraph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paragraph.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/styles/svg.cjs.js
CHANGED
package/styles/svg.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/styles/svg.js
CHANGED
package/styles/svg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-variants.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text-variants.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
package/styles/text-variants.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { css } from 'lit';
|
|
2
3
|
|
|
3
4
|
var css_248z = css`.text-primary{color:var(--sgds-primary-rgb)!important}.text-secondary{color:var(--sgds-secondary-rgb)!important}.text-success{color:var(--sgds-success-rgb)!important}.text-info{color:var(--sgds-info-rgb)!important}.text-warning{color:var(--sgds-warning-rgb)!important}.text-danger{color:var(--sgds-danger-rgb)!important}.text-light{color:var(--sgds-light-rgb)!important}.text-dark{color:var(--sgds-dark-rgb)!important}.text-muted{color:var(--sgds-secondary-color)!important}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-variants.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text-variants.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
package/utils/animate.cjs.js
CHANGED
package/utils/animate.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.cjs.js","sources":["../../src/utils/animate.ts"],"sourcesContent":["//\n// Animates an element using keyframes. Returns a promise that resolves after the animation completes or gets canceled.\n//\nexport function animateTo(el: HTMLElement, keyframes: Keyframe[], options?: KeyframeAnimationOptions) {\n return new Promise(resolve => {\n if (options?.duration === Infinity) {\n throw new Error(\"Promise-based animations must be finite.\");\n }\n\n const animation = el.animate(keyframes, {\n ...options,\n duration: prefersReducedMotion() ? 0 : options?.duration\n });\n\n animation.addEventListener(\"cancel\", resolve, { once: true });\n animation.addEventListener(\"finish\", resolve, { once: true });\n });\n}\n\n//\n// Parses a CSS duration and returns the number of milliseconds.\n//\nexport function parseDuration(delay: number | string) {\n delay = delay.toString().toLowerCase();\n\n if (delay.indexOf(\"ms\") > -1) {\n return parseFloat(delay);\n }\n\n if (delay.indexOf(\"s\") > -1) {\n return parseFloat(delay) * 1000;\n }\n\n return parseFloat(delay);\n}\n\n//\n// Tells if the user has enabled the \"reduced motion\" setting in their browser or OS.\n//\nexport function prefersReducedMotion() {\n const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n return query.matches;\n}\n\n// We can't animate `height: auto`, but we can calculate the height and shim keyframes by replacing it with the\n// element's scrollHeight before the animation.\nexport function shimKeyframesHeightAuto(keyframes: Keyframe[], calculatedHeight: number) {\n return keyframes.map(keyframe => ({\n ...keyframe,\n height: keyframe.height === \"auto\" ? `${calculatedHeight}px` : keyframe.height\n }));\n}\n\n//\n// Stops all active animations on the target element. Returns a promise that resolves after all animations are canceled.\n//\nexport function stopAnimations(el: HTMLElement) {\n return Promise.all(\n el.getAnimations().map(animation => {\n return new Promise(resolve => {\n const handleAnimationEvent = requestAnimationFrame(resolve);\n\n animation.addEventListener(\"cancel\", () => handleAnimationEvent, { once: true });\n animation.addEventListener(\"finish\", () => handleAnimationEvent, { once: true });\n animation.cancel();\n });\n })\n );\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animate.cjs.js","sources":["../../src/utils/animate.ts"],"sourcesContent":["//\n// Animates an element using keyframes. Returns a promise that resolves after the animation completes or gets canceled.\n//\nexport function animateTo(el: HTMLElement, keyframes: Keyframe[], options?: KeyframeAnimationOptions) {\n return new Promise(resolve => {\n if (options?.duration === Infinity) {\n throw new Error(\"Promise-based animations must be finite.\");\n }\n\n const animation = el.animate(keyframes, {\n ...options,\n duration: prefersReducedMotion() ? 0 : options?.duration\n });\n\n animation.addEventListener(\"cancel\", resolve, { once: true });\n animation.addEventListener(\"finish\", resolve, { once: true });\n });\n}\n\n//\n// Parses a CSS duration and returns the number of milliseconds.\n//\nexport function parseDuration(delay: number | string) {\n delay = delay.toString().toLowerCase();\n\n if (delay.indexOf(\"ms\") > -1) {\n return parseFloat(delay);\n }\n\n if (delay.indexOf(\"s\") > -1) {\n return parseFloat(delay) * 1000;\n }\n\n return parseFloat(delay);\n}\n\n//\n// Tells if the user has enabled the \"reduced motion\" setting in their browser or OS.\n//\nexport function prefersReducedMotion() {\n const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n return query.matches;\n}\n\n// We can't animate `height: auto`, but we can calculate the height and shim keyframes by replacing it with the\n// element's scrollHeight before the animation.\nexport function shimKeyframesHeightAuto(keyframes: Keyframe[], calculatedHeight: number) {\n return keyframes.map(keyframe => ({\n ...keyframe,\n height: keyframe.height === \"auto\" ? `${calculatedHeight}px` : keyframe.height\n }));\n}\n\n//\n// Stops all active animations on the target element. Returns a promise that resolves after all animations are canceled.\n//\nexport function stopAnimations(el: HTMLElement) {\n return Promise.all(\n el.getAnimations().map(animation => {\n return new Promise(resolve => {\n const handleAnimationEvent = requestAnimationFrame(resolve);\n\n animation.addEventListener(\"cancel\", () => handleAnimationEvent, { once: true });\n animation.addEventListener(\"finish\", () => handleAnimationEvent, { once: true });\n animation.cancel();\n });\n })\n );\n}\n"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;SACgB,SAAS,CAAC,EAAe,EAAE,SAAqB,EAAE,OAAkC,EAAA;AAClG,IAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;QAC3B,IAAI,CAAA,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,QAAQ,MAAK,QAAQ,EAAE;AAClC,YAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC7D;AAED,QAAA,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACjC,OAAO,CAAA,EAAA,EACV,QAAQ,EAAE,oBAAoB,EAAE,GAAG,CAAC,GAAG,OAAO,KAAP,IAAA,IAAA,OAAO,KAAP,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,OAAO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AAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACjF,SAAS,CAAC,MAAM,EAAE,CAAC;AACrB,SAAC,CAAC,CAAC;KACJ,CAAC,CACH,CAAC;AACJ;;;;;;;"}
|
package/utils/animate.js
CHANGED
package/utils/animate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.js","sources":["../../src/utils/animate.ts"],"sourcesContent":["//\n// Animates an element using keyframes. Returns a promise that resolves after the animation completes or gets canceled.\n//\nexport function animateTo(el: HTMLElement, keyframes: Keyframe[], options?: KeyframeAnimationOptions) {\n return new Promise(resolve => {\n if (options?.duration === Infinity) {\n throw new Error(\"Promise-based animations must be finite.\");\n }\n\n const animation = el.animate(keyframes, {\n ...options,\n duration: prefersReducedMotion() ? 0 : options?.duration\n });\n\n animation.addEventListener(\"cancel\", resolve, { once: true });\n animation.addEventListener(\"finish\", resolve, { once: true });\n });\n}\n\n//\n// Parses a CSS duration and returns the number of milliseconds.\n//\nexport function parseDuration(delay: number | string) {\n delay = delay.toString().toLowerCase();\n\n if (delay.indexOf(\"ms\") > -1) {\n return parseFloat(delay);\n }\n\n if (delay.indexOf(\"s\") > -1) {\n return parseFloat(delay) * 1000;\n }\n\n return parseFloat(delay);\n}\n\n//\n// Tells if the user has enabled the \"reduced motion\" setting in their browser or OS.\n//\nexport function prefersReducedMotion() {\n const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n return query.matches;\n}\n\n// We can't animate `height: auto`, but we can calculate the height and shim keyframes by replacing it with the\n// element's scrollHeight before the animation.\nexport function shimKeyframesHeightAuto(keyframes: Keyframe[], calculatedHeight: number) {\n return keyframes.map(keyframe => ({\n ...keyframe,\n height: keyframe.height === \"auto\" ? `${calculatedHeight}px` : keyframe.height\n }));\n}\n\n//\n// Stops all active animations on the target element. Returns a promise that resolves after all animations are canceled.\n//\nexport function stopAnimations(el: HTMLElement) {\n return Promise.all(\n el.getAnimations().map(animation => {\n return new Promise(resolve => {\n const handleAnimationEvent = requestAnimationFrame(resolve);\n\n animation.addEventListener(\"cancel\", () => handleAnimationEvent, { once: true });\n animation.addEventListener(\"finish\", () => handleAnimationEvent, { once: true });\n animation.cancel();\n });\n })\n );\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;SACgB,SAAS,CAAC,EAAe,EAAE,SAAqB,EAAE,OAAkC,EAAA;AAClG,IAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;QAC3B,IAAI,CAAA,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,QAAQ,MAAK,QAAQ,EAAE;AAClC,YAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC7D;AAED,QAAA,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EACjC,OAAO,CAAA,EAAA,EACV,QAAQ,EAAE,oBAAoB,EAAE,GAAG,CAAC,GAAG,OAAO,KAAP,IAAA,IAAA,OAAO,KAAP,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,OAAO,CAAE,QAAQ,IACxD,CAAC;AAEH,QAAA,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,QAAA,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAChE,KAAC,CAAC,CAAC;AACL,CAAC;AAmBD;AACA;AACA;SACgB,oBAAoB,GAAA;IAClC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC,OAAO,CAAC;AACvB,CAAC;AAED;AACA;AACgB,SAAA,uBAAuB,CAAC,SAAqB,EAAE,gBAAwB,EAAA;AACrF,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,KAAI,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAC5B,QAAQ,CAAA,EAAA,EACX,MAAM,EAAE,QAAQ,CAAC,MAAM,KAAK,MAAM,GAAG,CAAA,EAAG,gBAAgB,CAAI,EAAA,CAAA,GAAG,QAAQ,CAAC,MAAM,EAAA,CAAA,CAC9E,CAAC,CAAC;AACN,CAAC;AAED;AACA;AACA;AACM,SAAU,cAAc,CAAC,EAAe,EAAA;AAC5C,IAAA,OAAO,OAAO,CAAC,GAAG,CAChB,EAAE,CAAC,aAAa,EAAE,CAAC,GAAG,CAAC,SAAS,IAAG;AACjC,QAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;AAC3B,YAAA,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAE5D,YAAA,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACjF,YAAA,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACjF,SAAS,CAAC,MAAM,EAAE,CAAC;AACrB,SAAC,CAAC,CAAC;KACJ,CAAC,CACH,CAAC;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"animate.js","sources":["../../src/utils/animate.ts"],"sourcesContent":["//\n// Animates an element using keyframes. Returns a promise that resolves after the animation completes or gets canceled.\n//\nexport function animateTo(el: HTMLElement, keyframes: Keyframe[], options?: KeyframeAnimationOptions) {\n return new Promise(resolve => {\n if (options?.duration === Infinity) {\n throw new Error(\"Promise-based animations must be finite.\");\n }\n\n const animation = el.animate(keyframes, {\n ...options,\n duration: prefersReducedMotion() ? 0 : options?.duration\n });\n\n animation.addEventListener(\"cancel\", resolve, { once: true });\n animation.addEventListener(\"finish\", resolve, { once: true });\n });\n}\n\n//\n// Parses a CSS duration and returns the number of milliseconds.\n//\nexport function parseDuration(delay: number | string) {\n delay = delay.toString().toLowerCase();\n\n if (delay.indexOf(\"ms\") > -1) {\n return parseFloat(delay);\n }\n\n if (delay.indexOf(\"s\") > -1) {\n return parseFloat(delay) * 1000;\n }\n\n return parseFloat(delay);\n}\n\n//\n// Tells if the user has enabled the \"reduced motion\" setting in their browser or OS.\n//\nexport function prefersReducedMotion() {\n const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n return query.matches;\n}\n\n// We can't animate `height: auto`, but we can calculate the height and shim keyframes by replacing it with the\n// element's scrollHeight before the animation.\nexport function shimKeyframesHeightAuto(keyframes: Keyframe[], calculatedHeight: number) {\n return keyframes.map(keyframe => ({\n ...keyframe,\n height: keyframe.height === \"auto\" ? `${calculatedHeight}px` : keyframe.height\n }));\n}\n\n//\n// Stops all active animations on the target element. Returns a promise that resolves after all animations are canceled.\n//\nexport function stopAnimations(el: HTMLElement) {\n return Promise.all(\n el.getAnimations().map(animation => {\n return new Promise(resolve => {\n const handleAnimationEvent = requestAnimationFrame(resolve);\n\n animation.addEventListener(\"cancel\", () => handleAnimationEvent, { once: true });\n animation.addEventListener(\"finish\", () => handleAnimationEvent, { once: true });\n animation.cancel();\n });\n })\n );\n}\n"],"names":[],"mappings":";AAAA;AACA;AACA;SACgB,SAAS,CAAC,EAAe,EAAE,SAAqB,EAAE,OAAkC,EAAA;AAClG,IAAA,OAAO,IAAI,OAAO,CAAC,OAAO,IAAG;QAC3B,IAAI,CAAA,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAP,OAAO,CAAE,QAAQ,MAAK,QAAQ,EAAE;AAClC,YAAA,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;SAC7D;AAED,QAAA,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAAC,SAAS,EAAA,MAAA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OAAO,CAAC,CAAC;AAE5D,YAAA,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACjF,YAAA,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,oBAAoB,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACjF,SAAS,CAAC,MAAM,EAAE,CAAC;AACrB,SAAC,CAAC,CAAC;KACJ,CAAC,CACH,CAAC;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-registry.cjs.js","sources":["../../src/utils/animation-registry.ts"],"sourcesContent":["export interface ElementAnimation {\n keyframes: Keyframe[];\n rtlKeyframes?: Keyframe[];\n options?: KeyframeAnimationOptions;\n}\n\nexport interface ElementAnimationMap {\n [animationName: string]: ElementAnimation;\n}\n\nexport interface GetAnimationOptions {\n /**\n * The component's directionality. When set to \"rtl\", `rtlKeyframes` will be preferred over `keyframes` where\n * available using getAnimation().\n */\n dir: string;\n}\n\nconst defaultAnimationRegistry = new Map<string, ElementAnimation>();\nconst customAnimationRegistry = new WeakMap<Element, ElementAnimationMap>();\n\nfunction ensureAnimation(animation: ElementAnimation | null) {\n return animation ?? { keyframes: [], options: { duration: 0 } };\n}\n\n//\n// Given an ElementAnimation, this function returns a new ElementAnimation where the keyframes property reflects either\n// keyframes or rtlKeyframes depending on the specified directionality.\n//\nfunction getLogicalAnimation(animation: ElementAnimation) {\n return animation;\n}\n\n//\n// Gets an element's animation. Falls back to the default if no animation is found.\n//\nexport function getAnimation(el: Element, animationName: string) {\n const customAnimation = customAnimationRegistry.get(el);\n\n // Check for a custom animation\n if (customAnimation?.[animationName]) {\n return getLogicalAnimation(customAnimation[animationName]);\n }\n\n // Check for a default animation\n const defaultAnimation = defaultAnimationRegistry.get(animationName);\n if (defaultAnimation) {\n return getLogicalAnimation(defaultAnimation);\n }\n\n // Fall back to an empty animation\n return {\n keyframes: [],\n options: { duration: 0 }\n };\n}\n\n//\n// Sets a custom animation for the specified element.\n//\nexport function setAnimation(el: Element, animationName: string, animation: ElementAnimation | null) {\n customAnimationRegistry.set(el, { ...customAnimationRegistry.get(el), [animationName]: ensureAnimation(animation) });\n}\n\n//\n// Sets a default animation. Components should use the `name.animation` for primary animations and `name.part.animation`\n// for secondary animations, e.g. `dialog.show` and `dialog.overlay.show`. For modifiers, use `drawer.showTop`.\n//\nexport function setDefaultAnimation(animationName: string, animation: ElementAnimation | null) {\n defaultAnimationRegistry.set(animationName, ensureAnimation(animation));\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animation-registry.cjs.js","sources":["../../src/utils/animation-registry.ts"],"sourcesContent":["export interface ElementAnimation {\n keyframes: Keyframe[];\n rtlKeyframes?: Keyframe[];\n options?: KeyframeAnimationOptions;\n}\n\nexport interface ElementAnimationMap {\n [animationName: string]: ElementAnimation;\n}\n\nexport interface GetAnimationOptions {\n /**\n * The component's directionality. When set to \"rtl\", `rtlKeyframes` will be preferred over `keyframes` where\n * available using getAnimation().\n */\n dir: string;\n}\n\nconst defaultAnimationRegistry = new Map<string, ElementAnimation>();\nconst customAnimationRegistry = new WeakMap<Element, ElementAnimationMap>();\n\nfunction ensureAnimation(animation: ElementAnimation | null) {\n return animation ?? { keyframes: [], options: { duration: 0 } };\n}\n\n//\n// Given an ElementAnimation, this function returns a new ElementAnimation where the keyframes property reflects either\n// keyframes or rtlKeyframes depending on the specified directionality.\n//\nfunction getLogicalAnimation(animation: ElementAnimation) {\n return animation;\n}\n\n//\n// Gets an element's animation. Falls back to the default if no animation is found.\n//\nexport function getAnimation(el: Element, animationName: string) {\n const customAnimation = customAnimationRegistry.get(el);\n\n // Check for a custom animation\n if (customAnimation?.[animationName]) {\n return getLogicalAnimation(customAnimation[animationName]);\n }\n\n // Check for a default animation\n const defaultAnimation = defaultAnimationRegistry.get(animationName);\n if (defaultAnimation) {\n return getLogicalAnimation(defaultAnimation);\n }\n\n // Fall back to an empty animation\n return {\n keyframes: [],\n options: { duration: 0 }\n };\n}\n\n//\n// Sets a custom animation for the specified element.\n//\nexport function setAnimation(el: Element, animationName: string, animation: ElementAnimation | null) {\n customAnimationRegistry.set(el, { ...customAnimationRegistry.get(el), [animationName]: ensureAnimation(animation) });\n}\n\n//\n// Sets a default animation. Components should use the `name.animation` for primary animations and `name.part.animation`\n// for secondary animations, e.g. `dialog.show` and `dialog.overlay.show`. For modifiers, use `drawer.showTop`.\n//\nexport function setDefaultAnimation(animationName: string, animation: ElementAnimation | null) {\n defaultAnimationRegistry.set(animationName, ensureAnimation(animation));\n}\n"],"names":[],"mappings":";;;;;AAkBA,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAA4B,CAAC;AACrE,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAAgC,CAAC;AAE5E,SAAS,eAAe,CAAC,SAAkC,EAAA;AACzD,IAAA,OAAO,SAAS,KAAT,IAAA,IAAA,SAAS,cAAT,SAAS,GAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;AAClE,CAAC;AAED;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,SAA2B,EAAA;AACtD,IAAA,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;AACA;AACA;AACgB,SAAA,YAAY,CAAC,EAAW,EAAE,aAAqB,EAAA;IAC7D,MAAM,eAAe,GAAG,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;IAGxD,IAAI,eAAe,aAAf,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAf,eAAe,CAAG,aAAa,CAAC,EAAE;AACpC,QAAA,OAAO,mBAAmB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;KAC5D;;IAGD,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACrE,IAAI,gBAAgB,EAAE;AACpB,QAAA,OAAO,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;KAC9C;;IAGD,OAAO;AACL,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;KACzB,CAAC;AACJ,CAAC;AASD;AACA;AACA;AACA;AACgB,SAAA,mBAAmB,CAAC,aAAqB,EAAE,SAAkC,EAAA;IAC3F,wBAAwB,CAAC,GAAG,CAAC,aAAa,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1E;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-registry.js","sources":["../../src/utils/animation-registry.ts"],"sourcesContent":["export interface ElementAnimation {\n keyframes: Keyframe[];\n rtlKeyframes?: Keyframe[];\n options?: KeyframeAnimationOptions;\n}\n\nexport interface ElementAnimationMap {\n [animationName: string]: ElementAnimation;\n}\n\nexport interface GetAnimationOptions {\n /**\n * The component's directionality. When set to \"rtl\", `rtlKeyframes` will be preferred over `keyframes` where\n * available using getAnimation().\n */\n dir: string;\n}\n\nconst defaultAnimationRegistry = new Map<string, ElementAnimation>();\nconst customAnimationRegistry = new WeakMap<Element, ElementAnimationMap>();\n\nfunction ensureAnimation(animation: ElementAnimation | null) {\n return animation ?? { keyframes: [], options: { duration: 0 } };\n}\n\n//\n// Given an ElementAnimation, this function returns a new ElementAnimation where the keyframes property reflects either\n// keyframes or rtlKeyframes depending on the specified directionality.\n//\nfunction getLogicalAnimation(animation: ElementAnimation) {\n return animation;\n}\n\n//\n// Gets an element's animation. Falls back to the default if no animation is found.\n//\nexport function getAnimation(el: Element, animationName: string) {\n const customAnimation = customAnimationRegistry.get(el);\n\n // Check for a custom animation\n if (customAnimation?.[animationName]) {\n return getLogicalAnimation(customAnimation[animationName]);\n }\n\n // Check for a default animation\n const defaultAnimation = defaultAnimationRegistry.get(animationName);\n if (defaultAnimation) {\n return getLogicalAnimation(defaultAnimation);\n }\n\n // Fall back to an empty animation\n return {\n keyframes: [],\n options: { duration: 0 }\n };\n}\n\n//\n// Sets a custom animation for the specified element.\n//\nexport function setAnimation(el: Element, animationName: string, animation: ElementAnimation | null) {\n customAnimationRegistry.set(el, { ...customAnimationRegistry.get(el), [animationName]: ensureAnimation(animation) });\n}\n\n//\n// Sets a default animation. Components should use the `name.animation` for primary animations and `name.part.animation`\n// for secondary animations, e.g. `dialog.show` and `dialog.overlay.show`. For modifiers, use `drawer.showTop`.\n//\nexport function setDefaultAnimation(animationName: string, animation: ElementAnimation | null) {\n defaultAnimationRegistry.set(animationName, ensureAnimation(animation));\n}\n"],"names":[],"mappings":"AAkBA,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAA4B,CAAC;AACrE,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAAgC,CAAC;AAE5E,SAAS,eAAe,CAAC,SAAkC,EAAA;AACzD,IAAA,OAAO,SAAS,KAAT,IAAA,IAAA,SAAS,cAAT,SAAS,GAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;AAClE,CAAC;AAED;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,SAA2B,EAAA;AACtD,IAAA,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;AACA;AACA;AACgB,SAAA,YAAY,CAAC,EAAW,EAAE,aAAqB,EAAA;IAC7D,MAAM,eAAe,GAAG,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;IAGxD,IAAI,eAAe,aAAf,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAf,eAAe,CAAG,aAAa,CAAC,EAAE;AACpC,QAAA,OAAO,mBAAmB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;KAC5D;;IAGD,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACrE,IAAI,gBAAgB,EAAE;AACpB,QAAA,OAAO,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;KAC9C;;IAGD,OAAO;AACL,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;KACzB,CAAC;AACJ,CAAC;AASD;AACA;AACA;AACA;AACgB,SAAA,mBAAmB,CAAC,aAAqB,EAAE,SAAkC,EAAA;IAC3F,wBAAwB,CAAC,GAAG,CAAC,aAAa,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1E;;;;"}
|
|
1
|
+
{"version":3,"file":"animation-registry.js","sources":["../../src/utils/animation-registry.ts"],"sourcesContent":["export interface ElementAnimation {\n keyframes: Keyframe[];\n rtlKeyframes?: Keyframe[];\n options?: KeyframeAnimationOptions;\n}\n\nexport interface ElementAnimationMap {\n [animationName: string]: ElementAnimation;\n}\n\nexport interface GetAnimationOptions {\n /**\n * The component's directionality. When set to \"rtl\", `rtlKeyframes` will be preferred over `keyframes` where\n * available using getAnimation().\n */\n dir: string;\n}\n\nconst defaultAnimationRegistry = new Map<string, ElementAnimation>();\nconst customAnimationRegistry = new WeakMap<Element, ElementAnimationMap>();\n\nfunction ensureAnimation(animation: ElementAnimation | null) {\n return animation ?? { keyframes: [], options: { duration: 0 } };\n}\n\n//\n// Given an ElementAnimation, this function returns a new ElementAnimation where the keyframes property reflects either\n// keyframes or rtlKeyframes depending on the specified directionality.\n//\nfunction getLogicalAnimation(animation: ElementAnimation) {\n return animation;\n}\n\n//\n// Gets an element's animation. Falls back to the default if no animation is found.\n//\nexport function getAnimation(el: Element, animationName: string) {\n const customAnimation = customAnimationRegistry.get(el);\n\n // Check for a custom animation\n if (customAnimation?.[animationName]) {\n return getLogicalAnimation(customAnimation[animationName]);\n }\n\n // Check for a default animation\n const defaultAnimation = defaultAnimationRegistry.get(animationName);\n if (defaultAnimation) {\n return getLogicalAnimation(defaultAnimation);\n }\n\n // Fall back to an empty animation\n return {\n keyframes: [],\n options: { duration: 0 }\n };\n}\n\n//\n// Sets a custom animation for the specified element.\n//\nexport function setAnimation(el: Element, animationName: string, animation: ElementAnimation | null) {\n customAnimationRegistry.set(el, { ...customAnimationRegistry.get(el), [animationName]: ensureAnimation(animation) });\n}\n\n//\n// Sets a default animation. Components should use the `name.animation` for primary animations and `name.part.animation`\n// for secondary animations, e.g. `dialog.show` and `dialog.overlay.show`. For modifiers, use `drawer.showTop`.\n//\nexport function setDefaultAnimation(animationName: string, animation: ElementAnimation | null) {\n defaultAnimationRegistry.set(animationName, ensureAnimation(animation));\n}\n"],"names":[],"mappings":";AAkBA,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAA4B,CAAC;AACrE,MAAM,uBAAuB,GAAG,IAAI,OAAO,EAAgC,CAAC;AAE5E,SAAS,eAAe,CAAC,SAAkC,EAAA;AACzD,IAAA,OAAO,SAAS,KAAT,IAAA,IAAA,SAAS,cAAT,SAAS,GAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC;AAClE,CAAC;AAED;AACA;AACA;AACA;AACA,SAAS,mBAAmB,CAAC,SAA2B,EAAA;AACtD,IAAA,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;AACA;AACA;AACgB,SAAA,YAAY,CAAC,EAAW,EAAE,aAAqB,EAAA;IAC7D,MAAM,eAAe,GAAG,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;;IAGxD,IAAI,eAAe,aAAf,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAf,eAAe,CAAG,aAAa,CAAC,EAAE;AACpC,QAAA,OAAO,mBAAmB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC;KAC5D;;IAGD,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACrE,IAAI,gBAAgB,EAAE;AACpB,QAAA,OAAO,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;KAC9C;;IAGD,OAAO;AACL,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;KACzB,CAAC;AACJ,CAAC;AASD;AACA;AACA;AACA;AACgB,SAAA,mBAAmB,CAAC,aAAqB,EAAE,SAAkC,EAAA;IAC3F,wBAAwB,CAAC,GAAG,CAAC,aAAa,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1E;;;;"}
|
package/utils/breakpoints.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.cjs.js","sources":["../../src/utils/breakpoints.ts"],"sourcesContent":["export const LG_BREAKPOINT = 992;\nexport const MD_BREAKPOINT = 768;\nexport const SM_BREAKPOINT = 576;\nexport const XL_BREAKPOINT = 1200;\nexport const XXL_BREAKPOINT = 1400;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"breakpoints.cjs.js","sources":["../../src/utils/breakpoints.ts"],"sourcesContent":["export const LG_BREAKPOINT = 992;\nexport const MD_BREAKPOINT = 768;\nexport const SM_BREAKPOINT = 576;\nexport const XL_BREAKPOINT = 1200;\nexport const XXL_BREAKPOINT = 1400;\n"],"names":[],"mappings":";;;;;AAAO,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,KAAK;AAC3B,MAAM,cAAc,GAAG;;;;;;;;"}
|
package/utils/breakpoints.js
CHANGED
package/utils/breakpoints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.js","sources":["../../src/utils/breakpoints.ts"],"sourcesContent":["export const LG_BREAKPOINT = 992;\nexport const MD_BREAKPOINT = 768;\nexport const SM_BREAKPOINT = 576;\nexport const XL_BREAKPOINT = 1200;\nexport const XXL_BREAKPOINT = 1400;\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,KAAK;AAC3B,MAAM,cAAc,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"breakpoints.js","sources":["../../src/utils/breakpoints.ts"],"sourcesContent":["export const LG_BREAKPOINT = 992;\nexport const MD_BREAKPOINT = 768;\nexport const SM_BREAKPOINT = 576;\nexport const XL_BREAKPOINT = 1200;\nexport const XXL_BREAKPOINT = 1400;\n"],"names":[],"mappings":";AAAO,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,IAAI;AAC1B,MAAM,aAAa,GAAG,KAAK;AAC3B,MAAM,cAAc,GAAG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultvalue.cjs.js","sources":["../../src/utils/defaultvalue.ts"],"sourcesContent":["// @defaultValue decorator\n//\n// Runs when the corresponding attribute of the observed property changes, e.g. after calling Element.setAttribute or after updating\n// the observed property.\n//\n// The decorator checks whether the value of the attribute is different from the value of the property and in that case\n// it saves the new value.\n//\n//\n// Usage:\n//\n// @property({ type: Boolean, reflect: true })\n// checked = false;\n//\n// @defaultValue('checked')\n// defaultChecked = false;\n//\n\nimport { defaultConverter } from \"lit\";\nimport type { ReactiveElement } from \"lit\";\n\nexport const defaultValue =\n (propertyName = \"value\") =>\n (proto: ReactiveElement, key: string) => {\n const ctor = proto.constructor as typeof ReactiveElement;\n\n const attributeChangedCallback = ctor.prototype.attributeChangedCallback;\n ctor.prototype.attributeChangedCallback = function (\n this: ReactiveElement & { [name: string]: unknown },\n name,\n old,\n value\n ) {\n const options = ctor.getPropertyOptions(propertyName);\n const attributeName = (typeof options.attribute === \"string\" ? options.attribute : propertyName).toLowerCase();\n if (name === attributeName) {\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n typeof converter === \"function\" ? converter : converter?.fromAttribute ?? defaultConverter.fromAttribute;\n\n const newValue: unknown = fromAttribute(value, options.type);\n if (this[propertyName] !== newValue) {\n this[key] = newValue;\n }\n }\n attributeChangedCallback.call(this, name, old, value);\n };\n };\n"],"names":["defaultConverter"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultvalue.cjs.js","sources":["../../src/utils/defaultvalue.ts"],"sourcesContent":["// @defaultValue decorator\n//\n// Runs when the corresponding attribute of the observed property changes, e.g. after calling Element.setAttribute or after updating\n// the observed property.\n//\n// The decorator checks whether the value of the attribute is different from the value of the property and in that case\n// it saves the new value.\n//\n//\n// Usage:\n//\n// @property({ type: Boolean, reflect: true })\n// checked = false;\n//\n// @defaultValue('checked')\n// defaultChecked = false;\n//\n\nimport { defaultConverter } from \"lit\";\nimport type { ReactiveElement } from \"lit\";\n\nexport const defaultValue =\n (propertyName = \"value\") =>\n (proto: ReactiveElement, key: string) => {\n const ctor = proto.constructor as typeof ReactiveElement;\n\n const attributeChangedCallback = ctor.prototype.attributeChangedCallback;\n ctor.prototype.attributeChangedCallback = function (\n this: ReactiveElement & { [name: string]: unknown },\n name,\n old,\n value\n ) {\n const options = ctor.getPropertyOptions(propertyName);\n const attributeName = (typeof options.attribute === \"string\" ? options.attribute : propertyName).toLowerCase();\n if (name === attributeName) {\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n typeof converter === \"function\" ? converter : converter?.fromAttribute ?? defaultConverter.fromAttribute;\n\n const newValue: unknown = fromAttribute(value, options.type);\n if (this[propertyName] !== newValue) {\n this[key] = newValue;\n }\n }\n attributeChangedCallback.call(this, name, old, value);\n };\n };\n"],"names":["defaultConverter"],"mappings":";;;;;;;AAAA;AAqBa,MAAA,YAAY,GACvB,CAAC,YAAY,GAAG,OAAO,KACvB,CAAC,KAAsB,EAAE,GAAW,KAAI;AACtC,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,WAAqC,CAAC;AAEzD,IAAA,MAAM,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC;IACzE,IAAI,CAAC,SAAS,CAAC,wBAAwB,GAAG,UAExC,IAAI,EACJ,GAAG,EACH,KAAK,EAAA;;QAEL,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACtD,MAAM,aAAa,GAAG,CAAC,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,EAAE,WAAW,EAAE,CAAC;AAC/G,QAAA,IAAI,IAAI,KAAK,aAAa,EAAE;AAC1B,YAAA,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAIA,oBAAgB,CAAC;YACxD,MAAM,aAAa,GACjB,OAAO,SAAS,KAAK,UAAU,GAAG,SAAS,GAAG,CAAA,EAAA,GAAA,SAAS,KAAT,IAAA,IAAA,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,aAAa,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAAA,oBAAgB,CAAC,aAAa,CAAC;YAE3G,MAAM,QAAQ,GAAY,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7D,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE;AACnC,gBAAA,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;aACtB;SACF;QACD,wBAAwB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AACxD,KAAC,CAAC;AACJ;;;;"}
|
package/utils/defaultvalue.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultvalue.js","sources":["../../src/utils/defaultvalue.ts"],"sourcesContent":["// @defaultValue decorator\n//\n// Runs when the corresponding attribute of the observed property changes, e.g. after calling Element.setAttribute or after updating\n// the observed property.\n//\n// The decorator checks whether the value of the attribute is different from the value of the property and in that case\n// it saves the new value.\n//\n//\n// Usage:\n//\n// @property({ type: Boolean, reflect: true })\n// checked = false;\n//\n// @defaultValue('checked')\n// defaultChecked = false;\n//\n\nimport { defaultConverter } from \"lit\";\nimport type { ReactiveElement } from \"lit\";\n\nexport const defaultValue =\n (propertyName = \"value\") =>\n (proto: ReactiveElement, key: string) => {\n const ctor = proto.constructor as typeof ReactiveElement;\n\n const attributeChangedCallback = ctor.prototype.attributeChangedCallback;\n ctor.prototype.attributeChangedCallback = function (\n this: ReactiveElement & { [name: string]: unknown },\n name,\n old,\n value\n ) {\n const options = ctor.getPropertyOptions(propertyName);\n const attributeName = (typeof options.attribute === \"string\" ? options.attribute : propertyName).toLowerCase();\n if (name === attributeName) {\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n typeof converter === \"function\" ? converter : converter?.fromAttribute ?? defaultConverter.fromAttribute;\n\n const newValue: unknown = fromAttribute(value, options.type);\n if (this[propertyName] !== newValue) {\n this[key] = newValue;\n }\n }\n attributeChangedCallback.call(this, name, old, value);\n };\n };\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultvalue.js","sources":["../../src/utils/defaultvalue.ts"],"sourcesContent":["// @defaultValue decorator\n//\n// Runs when the corresponding attribute of the observed property changes, e.g. after calling Element.setAttribute or after updating\n// the observed property.\n//\n// The decorator checks whether the value of the attribute is different from the value of the property and in that case\n// it saves the new value.\n//\n//\n// Usage:\n//\n// @property({ type: Boolean, reflect: true })\n// checked = false;\n//\n// @defaultValue('checked')\n// defaultChecked = false;\n//\n\nimport { defaultConverter } from \"lit\";\nimport type { ReactiveElement } from \"lit\";\n\nexport const defaultValue =\n (propertyName = \"value\") =>\n (proto: ReactiveElement, key: string) => {\n const ctor = proto.constructor as typeof ReactiveElement;\n\n const attributeChangedCallback = ctor.prototype.attributeChangedCallback;\n ctor.prototype.attributeChangedCallback = function (\n this: ReactiveElement & { [name: string]: unknown },\n name,\n old,\n value\n ) {\n const options = ctor.getPropertyOptions(propertyName);\n const attributeName = (typeof options.attribute === \"string\" ? options.attribute : propertyName).toLowerCase();\n if (name === attributeName) {\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n typeof converter === \"function\" ? converter : converter?.fromAttribute ?? defaultConverter.fromAttribute;\n\n const newValue: unknown = fromAttribute(value, options.type);\n if (this[propertyName] !== newValue) {\n this[key] = newValue;\n }\n }\n attributeChangedCallback.call(this, name, old, value);\n };\n };\n"],"names":[],"mappings":";;;AAAA;AAqBa,MAAA,YAAY,GACvB,CAAC,YAAY,GAAG,OAAO,KACvB,CAAC,KAAsB,EAAE,GAAW,KAAI;AACtC,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,WAAqC,CAAC;AAEzD,IAAA,MAAM,wBAAwB,GAAG,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC;IACzE,IAAI,CAAC,SAAS,CAAC,wBAAwB,GAAG,UAExC,IAAI,EACJ,GAAG,EACH,KAAK,EAAA;;QAEL,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACtD,MAAM,aAAa,GAAG,CAAC,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,EAAE,WAAW,EAAE,CAAC;AAC/G,QAAA,IAAI,IAAI,KAAK,aAAa,EAAE;AAC1B,YAAA,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,gBAAgB,CAAC;YACxD,MAAM,aAAa,GACjB,OAAO,SAAS,KAAK,UAAU,GAAG,SAAS,GAAG,CAAA,EAAA,GAAA,SAAS,KAAT,IAAA,IAAA,SAAS,KAAT,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,SAAS,CAAE,aAAa,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,gBAAgB,CAAC,aAAa,CAAC;YAE3G,MAAM,QAAQ,GAAY,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC7D,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,QAAQ,EAAE;AACnC,gBAAA,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;aACtB;SACF;QACD,wBAAwB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AACxD,KAAC,CAAC;AACJ;;;;"}
|
package/utils/event.cjs.js
CHANGED
package/utils/event.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.cjs.js","sources":["../../src/utils/event.ts"],"sourcesContent":["/** Waits for a specific event to be emitted from an element. Ignores events that bubble up from child elements. */\nexport function waitForEvent(el: HTMLElement, eventName: string) {\n return new Promise<void>(resolve => {\n function done(event: Event) {\n if (event.target === el) {\n el.removeEventListener(eventName, done);\n resolve();\n }\n }\n\n el.addEventListener(eventName, done);\n });\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event.cjs.js","sources":["../../src/utils/event.ts"],"sourcesContent":["/** Waits for a specific event to be emitted from an element. Ignores events that bubble up from child elements. */\nexport function waitForEvent(el: HTMLElement, eventName: string) {\n return new Promise<void>(resolve => {\n function done(event: Event) {\n if (event.target === el) {\n el.removeEventListener(eventName, done);\n resolve();\n }\n }\n\n el.addEventListener(eventName, done);\n });\n}\n"],"names":[],"mappings":";;;;;AAAA;AACgB,SAAA,YAAY,CAAC,EAAe,EAAE,SAAiB,EAAA;AAC7D,IAAA,OAAO,IAAI,OAAO,CAAO,OAAO,IAAG;QACjC,SAAS,IAAI,CAAC,KAAY,EAAA;AACxB,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE;AACvB,gBAAA,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACxC,gBAAA,OAAO,EAAE,CAAC;aACX;SACF;AAED,QAAA,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACvC,KAAC,CAAC,CAAC;AACL;;;;"}
|
package/utils/event.js
CHANGED
package/utils/event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sources":["../../src/utils/event.ts"],"sourcesContent":["/** Waits for a specific event to be emitted from an element. Ignores events that bubble up from child elements. */\nexport function waitForEvent(el: HTMLElement, eventName: string) {\n return new Promise<void>(resolve => {\n function done(event: Event) {\n if (event.target === el) {\n el.removeEventListener(eventName, done);\n resolve();\n }\n }\n\n el.addEventListener(eventName, done);\n });\n}\n"],"names":[],"mappings":"AAAA;AACgB,SAAA,YAAY,CAAC,EAAe,EAAE,SAAiB,EAAA;AAC7D,IAAA,OAAO,IAAI,OAAO,CAAO,OAAO,IAAG;QACjC,SAAS,IAAI,CAAC,KAAY,EAAA;AACxB,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE;AACvB,gBAAA,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACxC,gBAAA,OAAO,EAAE,CAAC;aACX;SACF;AAED,QAAA,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACvC,KAAC,CAAC,CAAC;AACL;;;;"}
|
|
1
|
+
{"version":3,"file":"event.js","sources":["../../src/utils/event.ts"],"sourcesContent":["/** Waits for a specific event to be emitted from an element. Ignores events that bubble up from child elements. */\nexport function waitForEvent(el: HTMLElement, eventName: string) {\n return new Promise<void>(resolve => {\n function done(event: Event) {\n if (event.target === el) {\n el.removeEventListener(eventName, done);\n resolve();\n }\n }\n\n el.addEventListener(eventName, done);\n });\n}\n"],"names":[],"mappings":";AAAA;AACgB,SAAA,YAAY,CAAC,EAAe,EAAE,SAAiB,EAAA;AAC7D,IAAA,OAAO,IAAI,OAAO,CAAO,OAAO,IAAG;QACjC,SAAS,IAAI,CAAC,KAAY,EAAA;AACxB,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE;AACvB,gBAAA,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACxC,gBAAA,OAAO,EAAE,CAAC;aACX;SACF;AAED,QAAA,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACvC,KAAC,CAAC,CAAC;AACL;;;;"}
|
package/utils/form.cjs.js
CHANGED
package/utils/form.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.cjs.js","sources":["../../src/utils/form.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nconst reportValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\n\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n name: (input: HTMLInputElement) => input.name,\n value: (input: HTMLInputElement) => input.value,\n defaultValue: (input: HTMLInputElement) => input.defaultValue,\n disabled: (input: HTMLInputElement) => input.disabled,\n reportValidity: (input: HTMLInputElement) => {\n return typeof input.reportValidity === \"function\" ? input.reportValidity() : true;\n },\n setValue: (input: HTMLInputElement, value: string) => {\n input.value = value;\n },\n ...options\n };\n this.handleFormData = this.handleFormData.bind(this);\n this.handleFormSubmit = this.handleFormSubmit.bind(this);\n this.handleFormReset = this.handleFormReset.bind(this);\n this.reportFormValidity = this.reportFormValidity.bind(this);\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n\n if (this.form) {\n this.form.addEventListener(\"formdata\", this.handleFormData);\n this.form.addEventListener(\"submit\", this.handleFormSubmit);\n this.form.addEventListener(\"reset\", this.handleFormReset);\n\n // Overload the form's reportValidity() method so it looks at Shoelace form controls\n if (!reportValidityOverloads.has(this.form)) {\n reportValidityOverloads.set(this.form, this.form.reportValidity);\n this.form.reportValidity = () => this.reportFormValidity();\n }\n }\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form.removeEventListener(\"formdata\", this.handleFormData);\n this.form.removeEventListener(\"submit\", this.handleFormSubmit);\n this.form.removeEventListener(\"reset\", this.handleFormReset);\n\n // Remove the overload and restore the original method\n if (reportValidityOverloads.has(this.form)) {\n this.form.reportValidity = reportValidityOverloads.get(this.form);\n reportValidityOverloads.delete(this.form);\n }\n\n this.form = undefined;\n }\n }\n\n handleFormData(event: FormDataEvent) {\n const disabled = this.options.disabled(this.host);\n const name = this.options.name(this.host);\n const value = this.options.value(this.host);\n\n if (!disabled && typeof name === \"string\" && typeof value !== \"undefined\") {\n if (Array.isArray(value)) {\n (value as unknown[]).forEach(val => {\n event.formData.append(name, (val as string | number | boolean).toString());\n });\n } else {\n event.formData.append(name, (value as string | number | boolean).toString());\n }\n }\n }\n\n handleFormSubmit(event: Event) {\n const disabled = this.options.disabled(this.host);\n const reportValidity = this.options.reportValidity;\n if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n handleFormReset() {\n this.options.setValue(this.host, this.options.defaultValue(this.host));\n }\n\n reportFormValidity() {\n //\n // Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API\n // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also\n // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using\n // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>(\"*\");\n for (const element of elements) {\n if (typeof element.reportValidity === \"function\") {\n if (!element.reportValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n /** A function that returns the form control's name, which will be submitted with the form data. */\n name: (input: unknown) => string;\n /** A function that returns the form control's current value. */\n value: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's default value. */\n defaultValue: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */\n disabled: (input: unknown) => boolean;\n /**\n * A function that maps to the form control's reportValidity() function. When the control is invalid, this will\n * prevent submission and trigger the browser's constraint violation warning.\n */\n reportValidity: (input: unknown) => boolean;\n\n /** A function that sets the form control's value */\n setValue: (input: unknown, value: unknown) => void;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: string;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n}\n"],"names":[],"mappings":";;;;AAGA,MAAM,uBAAuB,GAA4C,IAAI,OAAO,EAAE,CAAC;MAE1E,oBAAoB,CAAA;IAK/B,WAAY,CAAA,IAAsC,EAAE,OAA8C,EAAA;QAChG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GACV,MAAA,CAAA,MAAA,CAAA,EAAA,IAAI,EAAE,CAAC,KAAuB,KAAI;AAChC,gBAAA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B,EACD,IAAI,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,IAAI,EAC7C,KAAK,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,KAAK,EAC/C,YAAY,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,YAAY,EAC7D,QAAQ,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,QAAQ,EACrD,cAAc,EAAE,CAAC,KAAuB,KAAI;AAC1C,gBAAA,OAAO,OAAO,KAAK,CAAC,cAAc,KAAK,UAAU,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC;aACnF,EACD,QAAQ,EAAE,CAAC,KAAuB,EAAE,KAAa,KAAI;AACnD,gBAAA,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;aACrB,EAAA,EACE,OAAO,CACX,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD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AAC,QAAQ,GAAG,UAAU,CAAC;AACnC,YAAA,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC;AACzB,YAAA,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;AAC1B,YAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC;AACrC,YAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACjC,YAAA,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;;YAGnC,IAAI,OAAO,EAAE;AACX,gBAAA,CAAC,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AAC1E,oBAAA,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC9B,wBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;AACH,iBAAC,CAAC,CAAC;aACJ;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;KACF;;AAGD,IAAA,KAAK,CAAC,OAAuC,EAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"form.cjs.js","sources":["../../src/utils/form.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nconst reportValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\n\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n name: (input: HTMLInputElement) => input.name,\n value: (input: HTMLInputElement) => input.value,\n defaultValue: (input: HTMLInputElement) => input.defaultValue,\n disabled: (input: HTMLInputElement) => input.disabled,\n reportValidity: (input: HTMLInputElement) => {\n return typeof input.reportValidity === \"function\" ? input.reportValidity() : true;\n },\n setValue: (input: HTMLInputElement, value: string) => {\n input.value = value;\n },\n ...options\n };\n this.handleFormData = this.handleFormData.bind(this);\n this.handleFormSubmit = this.handleFormSubmit.bind(this);\n this.handleFormReset = this.handleFormReset.bind(this);\n this.reportFormValidity = this.reportFormValidity.bind(this);\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n\n if (this.form) {\n this.form.addEventListener(\"formdata\", this.handleFormData);\n this.form.addEventListener(\"submit\", this.handleFormSubmit);\n this.form.addEventListener(\"reset\", this.handleFormReset);\n\n // Overload the form's reportValidity() method so it looks at Shoelace form controls\n if (!reportValidityOverloads.has(this.form)) {\n reportValidityOverloads.set(this.form, this.form.reportValidity);\n this.form.reportValidity = () => this.reportFormValidity();\n }\n }\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form.removeEventListener(\"formdata\", this.handleFormData);\n this.form.removeEventListener(\"submit\", this.handleFormSubmit);\n this.form.removeEventListener(\"reset\", this.handleFormReset);\n\n // Remove the overload and restore the original method\n if (reportValidityOverloads.has(this.form)) {\n this.form.reportValidity = reportValidityOverloads.get(this.form);\n reportValidityOverloads.delete(this.form);\n }\n\n this.form = undefined;\n }\n }\n\n handleFormData(event: FormDataEvent) {\n const disabled = this.options.disabled(this.host);\n const name = this.options.name(this.host);\n const value = this.options.value(this.host);\n\n if (!disabled && typeof name === \"string\" && typeof value !== \"undefined\") {\n if (Array.isArray(value)) {\n (value as unknown[]).forEach(val => {\n event.formData.append(name, (val as string | number | boolean).toString());\n });\n } else {\n event.formData.append(name, (value as string | number | boolean).toString());\n }\n }\n }\n\n handleFormSubmit(event: Event) {\n const disabled = this.options.disabled(this.host);\n const reportValidity = this.options.reportValidity;\n if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n handleFormReset() {\n this.options.setValue(this.host, this.options.defaultValue(this.host));\n }\n\n reportFormValidity() {\n //\n // Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API\n // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also\n // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using\n // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>(\"*\");\n for (const element of elements) {\n if (typeof element.reportValidity === \"function\") {\n if (!element.reportValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n /** A function that returns the form control's name, which will be submitted with the form data. */\n name: (input: unknown) => string;\n /** A function that returns the form control's current value. */\n value: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's default value. */\n defaultValue: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */\n disabled: (input: unknown) => boolean;\n /**\n * A function that maps to the form control's reportValidity() function. When the control is invalid, this will\n * prevent submission and trigger the browser's constraint violation warning.\n */\n reportValidity: (input: unknown) => boolean;\n\n /** A function that sets the form control's value */\n setValue: (input: unknown, value: unknown) => void;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: string;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n}\n"],"names":[],"mappings":";;;;;AAGA,MAAM,uBAAuB,GAA4C,IAAI,OAAO,EAAE,CAAC;MAE1E,oBAAoB,CAAA;IAK/B,WAAY,CAAA,IAAsC,EAAE,OAA8C,EAAA;QAChG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,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AA,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC9B,wBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;AACH,iBAAC,CAAC,CAAC;aACJ;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;KACF;;AAGD,IAAA,KAAK,CAAC,OAAuC,EAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
|
package/utils/form.js
CHANGED
package/utils/form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.js","sources":["../../src/utils/form.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nconst reportValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\n\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n name: (input: HTMLInputElement) => input.name,\n value: (input: HTMLInputElement) => input.value,\n defaultValue: (input: HTMLInputElement) => input.defaultValue,\n disabled: (input: HTMLInputElement) => input.disabled,\n reportValidity: (input: HTMLInputElement) => {\n return typeof input.reportValidity === \"function\" ? input.reportValidity() : true;\n },\n setValue: (input: HTMLInputElement, value: string) => {\n input.value = value;\n },\n ...options\n };\n this.handleFormData = this.handleFormData.bind(this);\n this.handleFormSubmit = this.handleFormSubmit.bind(this);\n this.handleFormReset = this.handleFormReset.bind(this);\n this.reportFormValidity = this.reportFormValidity.bind(this);\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n\n if (this.form) {\n this.form.addEventListener(\"formdata\", this.handleFormData);\n this.form.addEventListener(\"submit\", this.handleFormSubmit);\n this.form.addEventListener(\"reset\", this.handleFormReset);\n\n // Overload the form's reportValidity() method so it looks at Shoelace form controls\n if (!reportValidityOverloads.has(this.form)) {\n reportValidityOverloads.set(this.form, this.form.reportValidity);\n this.form.reportValidity = () => this.reportFormValidity();\n }\n }\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form.removeEventListener(\"formdata\", this.handleFormData);\n this.form.removeEventListener(\"submit\", this.handleFormSubmit);\n this.form.removeEventListener(\"reset\", this.handleFormReset);\n\n // Remove the overload and restore the original method\n if (reportValidityOverloads.has(this.form)) {\n this.form.reportValidity = reportValidityOverloads.get(this.form);\n reportValidityOverloads.delete(this.form);\n }\n\n this.form = undefined;\n }\n }\n\n handleFormData(event: FormDataEvent) {\n const disabled = this.options.disabled(this.host);\n const name = this.options.name(this.host);\n const value = this.options.value(this.host);\n\n if (!disabled && typeof name === \"string\" && typeof value !== \"undefined\") {\n if (Array.isArray(value)) {\n (value as unknown[]).forEach(val => {\n event.formData.append(name, (val as string | number | boolean).toString());\n });\n } else {\n event.formData.append(name, (value as string | number | boolean).toString());\n }\n }\n }\n\n handleFormSubmit(event: Event) {\n const disabled = this.options.disabled(this.host);\n const reportValidity = this.options.reportValidity;\n if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n handleFormReset() {\n this.options.setValue(this.host, this.options.defaultValue(this.host));\n }\n\n reportFormValidity() {\n //\n // Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API\n // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also\n // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using\n // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>(\"*\");\n for (const element of elements) {\n if (typeof element.reportValidity === \"function\") {\n if (!element.reportValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n /** A function that returns the form control's name, which will be submitted with the form data. */\n name: (input: unknown) => string;\n /** A function that returns the form control's current value. */\n value: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's default value. */\n defaultValue: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */\n disabled: (input: unknown) => boolean;\n /**\n * A function that maps to the form control's reportValidity() function. When the control is invalid, this will\n * prevent submission and trigger the browser's constraint violation warning.\n */\n reportValidity: (input: unknown) => boolean;\n\n /** A function that sets the form control's value */\n setValue: (input: unknown, value: unknown) => void;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: string;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n}\n"],"names":[],"mappings":"AAGA,MAAM,uBAAuB,GAA4C,IAAI,OAAO,EAAE,CAAC;MAE1E,oBAAoB,CAAA;IAK/B,WAAY,CAAA,IAAsC,EAAE,OAA8C,EAAA;QAChG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GACV,MAAA,CAAA,MAAA,CAAA,EAAA,IAAI,EAAE,CAAC,KAAuB,KAAI;AAChC,gBAAA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B,EACD,IAAI,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,IAAI,EAC7C,KAAK,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,KAAK,EAC/C,YAAY,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,YAAY,EAC7D,QAAQ,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,QAAQ,EACrD,cAAc,EAAE,CAAC,KAAuB,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,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"form.js","sources":["../../src/utils/form.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nconst reportValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\n\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n name: (input: HTMLInputElement) => input.name,\n value: (input: HTMLInputElement) => input.value,\n defaultValue: (input: HTMLInputElement) => input.defaultValue,\n disabled: (input: HTMLInputElement) => input.disabled,\n reportValidity: (input: HTMLInputElement) => {\n return typeof input.reportValidity === \"function\" ? input.reportValidity() : true;\n },\n setValue: (input: HTMLInputElement, value: string) => {\n input.value = value;\n },\n ...options\n };\n this.handleFormData = this.handleFormData.bind(this);\n this.handleFormSubmit = this.handleFormSubmit.bind(this);\n this.handleFormReset = this.handleFormReset.bind(this);\n this.reportFormValidity = this.reportFormValidity.bind(this);\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n\n if (this.form) {\n this.form.addEventListener(\"formdata\", this.handleFormData);\n this.form.addEventListener(\"submit\", this.handleFormSubmit);\n this.form.addEventListener(\"reset\", this.handleFormReset);\n\n // Overload the form's reportValidity() method so it looks at Shoelace form controls\n if (!reportValidityOverloads.has(this.form)) {\n reportValidityOverloads.set(this.form, this.form.reportValidity);\n this.form.reportValidity = () => this.reportFormValidity();\n }\n }\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form.removeEventListener(\"formdata\", this.handleFormData);\n this.form.removeEventListener(\"submit\", this.handleFormSubmit);\n this.form.removeEventListener(\"reset\", this.handleFormReset);\n\n // Remove the overload and restore the original method\n if (reportValidityOverloads.has(this.form)) {\n this.form.reportValidity = reportValidityOverloads.get(this.form);\n reportValidityOverloads.delete(this.form);\n }\n\n this.form = undefined;\n }\n }\n\n handleFormData(event: FormDataEvent) {\n const disabled = this.options.disabled(this.host);\n const name = this.options.name(this.host);\n const value = this.options.value(this.host);\n\n if (!disabled && typeof name === \"string\" && typeof value !== \"undefined\") {\n if (Array.isArray(value)) {\n (value as unknown[]).forEach(val => {\n event.formData.append(name, (val as string | number | boolean).toString());\n });\n } else {\n event.formData.append(name, (value as string | number | boolean).toString());\n }\n }\n }\n\n handleFormSubmit(event: Event) {\n const disabled = this.options.disabled(this.host);\n const reportValidity = this.options.reportValidity;\n if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n\n handleFormReset() {\n this.options.setValue(this.host, this.options.defaultValue(this.host));\n }\n\n reportFormValidity() {\n //\n // Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API\n // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also\n // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using\n // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>(\"*\");\n for (const element of elements) {\n if (typeof element.reportValidity === \"function\") {\n if (!element.reportValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n }\n\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n /** A function that returns the form control's name, which will be submitted with the form data. */\n name: (input: unknown) => string;\n /** A function that returns the form control's current value. */\n value: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's default value. */\n defaultValue: (input: unknown) => unknown | unknown[];\n /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */\n disabled: (input: unknown) => boolean;\n /**\n * A function that maps to the form control's reportValidity() function. When the control is invalid, this will\n * prevent submission and trigger the browser's constraint violation warning.\n */\n reportValidity: (input: unknown) => boolean;\n\n /** A function that sets the form control's value */\n setValue: (input: unknown, value: unknown) => void;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: string;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n}\n"],"names":[],"mappings":";AAGA,MAAM,uBAAuB,GAA4C,IAAI,OAAO,EAAE,CAAC;MAE1E,oBAAoB,CAAA;IAK/B,WAAY,CAAA,IAAsC,EAAE,OAA8C,EAAA;QAChG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GACV,MAAA,CAAA,MAAA,CAAA,EAAA,IAAI,EAAE,CAAC,KAAuB,KAAI;AAChC,gBAAA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B,EACD,IAAI,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,IAAI,EAC7C,KAAK,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,KAAK,EAC/C,YAAY,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,YAAY,EAC7D,QAAQ,EAAE,CAAC,KAAuB,KAAK,KAAK,CAAC,QAAQ,EACrD,cAAc,EAAE,CAAC,KAAuB,KAAI;AAC1C,gBAAA,OAAO,OAAO,KAAK,CAAC,cAAc,KAAK,UAAU,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC;aACnF,EACD,QAAQ,EAAE,CAAC,KAAuB,EAAE,KAAa,KAAI;AACnD,gBAAA,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;aACrB,EAAA,EACE,OAAO,CACX,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,IAAI,C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AAC;AAC1B,YAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC;AACrC,YAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACjC,YAAA,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;;YAGnC,IAAI,OAAO,EAAE;AACX,gBAAA,CAAC,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AAC1E,oBAAA,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC9B,wBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;AACH,iBAAC,CAAC,CAAC;aACJ;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;KACF;;AAGD,IAAA,KAAK,CAAC,OAAuC,EAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
|
package/utils/generateId.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateId.cjs.js","sources":["../../src/utils/generateId.ts"],"sourcesContent":["export default function (componentName = \"\", elementName = \"\"): string {\n return `id-${Math.random().toString().substring(2, 6)}-sgds-${componentName}-${elementName}`;\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateId.cjs.js","sources":["../../src/utils/generateId.ts"],"sourcesContent":["export default function (componentName = \"\", elementName = \"\"): string {\n return `id-${Math.random().toString().substring(2, 6)}-sgds-${componentName}-${elementName}`;\n}\n"],"names":[],"mappings":";;;;;AAAyB,cAAA,EAAA,aAAa,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAA;IAC3D,OAAO,CAAA,GAAA,EAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,MAAA,EAAS,aAAa,CAAI,CAAA,EAAA,WAAW,EAAE,CAAC;AAC/F;;;;"}
|
package/utils/generateId.js
CHANGED
package/utils/generateId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateId.js","sources":["../../src/utils/generateId.ts"],"sourcesContent":["export default function (componentName = \"\", elementName = \"\"): string {\n return `id-${Math.random().toString().substring(2, 6)}-sgds-${componentName}-${elementName}`;\n}\n"],"names":[],"mappings":"AAAyB,cAAA,EAAA,aAAa,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAA;IAC3D,OAAO,CAAA,GAAA,EAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,MAAA,EAAS,aAAa,CAAI,CAAA,EAAA,WAAW,EAAE,CAAC;AAC/F;;;;"}
|
|
1
|
+
{"version":3,"file":"generateId.js","sources":["../../src/utils/generateId.ts"],"sourcesContent":["export default function (componentName = \"\", elementName = \"\"): string {\n return `id-${Math.random().toString().substring(2, 6)}-sgds-${componentName}-${elementName}`;\n}\n"],"names":[],"mappings":";AAAyB,cAAA,EAAA,aAAa,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAA;IAC3D,OAAO,CAAA,GAAA,EAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,MAAA,EAAS,aAAa,CAAI,CAAA,EAAA,WAAW,EAAE,CAAC;AAC/F;;;;"}
|
package/utils/mergeDeep.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeDeep.cjs.js","sources":["../../src/utils/mergeDeep.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { assign, keys } from \"./object\";\nfunction _isObject(item: any) {\n return item && typeof item === \"object\" && item.constructor === Object;\n}\n\nconst mergeDeep = (target: any, source: any) => {\n if (_isObject(target) && _isObject(source)) {\n keys(source).forEach(key => {\n if (_isObject(source[key])) {\n if (!target[key] || !_isObject(target[key])) {\n target[key] = source[key];\n }\n mergeDeep(target[key], source[key]);\n } else {\n assign(target, { [key]: source[key] });\n }\n });\n }\n return target;\n};\n\nexport default mergeDeep;\n"],"names":["keys","assign"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergeDeep.cjs.js","sources":["../../src/utils/mergeDeep.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { assign, keys } from \"./object\";\nfunction _isObject(item: any) {\n return item && typeof item === \"object\" && item.constructor === Object;\n}\n\nconst mergeDeep = (target: any, source: any) => {\n if (_isObject(target) && _isObject(source)) {\n keys(source).forEach(key => {\n if (_isObject(source[key])) {\n if (!target[key] || !_isObject(target[key])) {\n target[key] = source[key];\n }\n mergeDeep(target[key], source[key]);\n } else {\n assign(target, { [key]: source[key] });\n }\n });\n }\n return target;\n};\n\nexport default mergeDeep;\n"],"names":["keys","assign"],"mappings":";;;;;;;AAAA;AAEA,SAAS,SAAS,CAAC,IAAS,EAAA;AAC1B,IAAA,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,CAAC;AACzE,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,MAAW,EAAE,MAAW,KAAI;IAC7C,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;QAC1CA,WAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,IAAG;YACzB,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;AAC1B,gBAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;oBAC3C,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;iBAC3B;gBACD,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;aACrC;iBAAM;AACL,gBAAAC,aAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;aACxC;AACH,SAAC,CAAC,CAAC;KACJ;AACD,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/utils/mergeDeep.js
CHANGED
package/utils/mergeDeep.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mergeDeep.js","sources":["../../src/utils/mergeDeep.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { assign, keys } from \"./object\";\nfunction _isObject(item: any) {\n return item && typeof item === \"object\" && item.constructor === Object;\n}\n\nconst mergeDeep = (target: any, source: any) => {\n if (_isObject(target) && _isObject(source)) {\n keys(source).forEach(key => {\n if (_isObject(source[key])) {\n if (!target[key] || !_isObject(target[key])) {\n target[key] = source[key];\n }\n mergeDeep(target[key], source[key]);\n } else {\n assign(target, { [key]: source[key] });\n }\n });\n }\n return target;\n};\n\nexport default mergeDeep;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mergeDeep.js","sources":["../../src/utils/mergeDeep.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { assign, keys } from \"./object\";\nfunction _isObject(item: any) {\n return item && typeof item === \"object\" && item.constructor === Object;\n}\n\nconst mergeDeep = (target: any, source: any) => {\n if (_isObject(target) && _isObject(source)) {\n keys(source).forEach(key => {\n if (_isObject(source[key])) {\n if (!target[key] || !_isObject(target[key])) {\n target[key] = source[key];\n }\n mergeDeep(target[key], source[key]);\n } else {\n assign(target, { [key]: source[key] });\n }\n });\n }\n return target;\n};\n\nexport default mergeDeep;\n"],"names":[],"mappings":";;;AAAA;AAEA,SAAS,SAAS,CAAC,IAAS,EAAA;AAC1B,IAAA,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM,CAAC;AACzE,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,MAAW,EAAE,MAAW,KAAI;IAC7C,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE;QAC1C,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,IAAG;YACzB,IAAI,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;AAC1B,gBAAA,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;oBAC3C,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;iBAC3B;gBACD,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;aACrC;iBAAM;AACL,gBAAA,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;aACxC;AACH,SAAC,CAAC,CAAC;KACJ;AACD,IAAA,OAAO,MAAM,CAAC;AAChB;;;;"}
|
package/utils/modal.cjs.js
CHANGED
package/utils/modal.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.cjs.js","sources":["../../src/utils/modal.ts"],"sourcesContent":["import { getTabbableBoundary } from \"./tabbable\";\n\nlet activeModals: HTMLElement[] = [];\n\nexport default class Modal {\n element: HTMLElement;\n tabDirection: \"forward\" | \"backward\" = \"forward\";\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.handleFocusIn = this.handleFocusIn.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n }\n\n activate() {\n activeModals.push(this.element);\n document.addEventListener(\"focusin\", this.handleFocusIn);\n document.addEventListener(\"keydown\", this.handleKeyDown);\n document.addEventListener(\"keyup\", this.handleKeyUp);\n }\n\n deactivate() {\n activeModals = activeModals.filter(modal => modal !== this.element);\n document.removeEventListener(\"focusin\", this.handleFocusIn);\n document.removeEventListener(\"keydown\", this.handleKeyDown);\n document.removeEventListener(\"keyup\", this.handleKeyUp);\n }\n\n isActive() {\n // The \"active\" modal is always the most recent one shown\n return activeModals[activeModals.length - 1] === this.element;\n }\n\n checkFocus() {\n if (this.isActive()) {\n if (!this.element.matches(\":focus-within\")) {\n const { start, end } = getTabbableBoundary(this.element);\n const target = this.tabDirection === \"forward\" ? start : end;\n\n if (typeof target?.focus === \"function\") {\n target.focus({ preventScroll: true });\n }\n }\n }\n }\n\n handleFocusIn() {\n this.checkFocus();\n }\n\n handleKeyDown(event: KeyboardEvent) {\n if (event.key === \"Tab\" && event.shiftKey) {\n this.tabDirection = \"backward\";\n\n // Ensure focus remains trapped after the key is pressed\n requestAnimationFrame(() => this.checkFocus());\n }\n }\n\n handleKeyUp() {\n this.tabDirection = \"forward\";\n }\n}\n"],"names":["getTabbableBoundary"],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal.cjs.js","sources":["../../src/utils/modal.ts"],"sourcesContent":["import { getTabbableBoundary } from \"./tabbable\";\n\nlet activeModals: HTMLElement[] = [];\n\nexport default class Modal {\n element: HTMLElement;\n tabDirection: \"forward\" | \"backward\" = \"forward\";\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.handleFocusIn = this.handleFocusIn.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n }\n\n activate() {\n activeModals.push(this.element);\n document.addEventListener(\"focusin\", this.handleFocusIn);\n document.addEventListener(\"keydown\", this.handleKeyDown);\n document.addEventListener(\"keyup\", this.handleKeyUp);\n }\n\n deactivate() {\n activeModals = activeModals.filter(modal => modal !== this.element);\n document.removeEventListener(\"focusin\", this.handleFocusIn);\n document.removeEventListener(\"keydown\", this.handleKeyDown);\n document.removeEventListener(\"keyup\", this.handleKeyUp);\n }\n\n isActive() {\n // The \"active\" modal is always the most recent one shown\n return activeModals[activeModals.length - 1] === this.element;\n }\n\n checkFocus() {\n if (this.isActive()) {\n if (!this.element.matches(\":focus-within\")) {\n const { start, end } = getTabbableBoundary(this.element);\n const target = this.tabDirection === \"forward\" ? start : end;\n\n if (typeof target?.focus === \"function\") {\n target.focus({ preventScroll: true });\n }\n }\n }\n }\n\n handleFocusIn() {\n this.checkFocus();\n }\n\n handleKeyDown(event: KeyboardEvent) {\n if (event.key === \"Tab\" && event.shiftKey) {\n this.tabDirection = \"backward\";\n\n // Ensure focus remains trapped after the key is pressed\n requestAnimationFrame(() => this.checkFocus());\n }\n }\n\n handleKeyUp() {\n this.tabDirection = \"forward\";\n }\n}\n"],"names":["getTabbableBoundary"],"mappings":";;;;;;;AAEA,IAAI,YAAY,GAAkB,EAAE,CAAC;AAEvB,MAAO,KAAK,CAAA;AAIxB,IAAA,WAAA,CAAY,OAAoB,EAAA;QAFhC,IAAY,CAAA,YAAA,GAA2B,SAAS,CAAC;AAG/C,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,GAAG,IAAI,CAA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AAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAN,MAAM,CAAE,KAAK,CAAA,KAAK,UAAU,EAAE;oBACvC,MAAM,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;iBACvC;aACF;SACF;KACF;IAED,aAAa,GAAA;QACX,IAAI,CAAC,UAAU,EAAE,CAAC;KACnB;AAED,IAAA,aAAa,CAAC,KAAoB,EAAA;QAChC,IAAI,KAAK,CAAC,GAAG,KAAK,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE;AACzC,YAAA,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC;;YAG/B,qBAAqB,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;SAChD;KACF;IAED,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;KAC/B;AACF;;;;"}
|
package/utils/modal.js
CHANGED
package/utils/modal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sources":["../../src/utils/modal.ts"],"sourcesContent":["import { getTabbableBoundary } from \"./tabbable\";\n\nlet activeModals: HTMLElement[] = [];\n\nexport default class Modal {\n element: HTMLElement;\n tabDirection: \"forward\" | \"backward\" = \"forward\";\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.handleFocusIn = this.handleFocusIn.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n }\n\n activate() {\n activeModals.push(this.element);\n document.addEventListener(\"focusin\", this.handleFocusIn);\n document.addEventListener(\"keydown\", this.handleKeyDown);\n document.addEventListener(\"keyup\", this.handleKeyUp);\n }\n\n deactivate() {\n activeModals = activeModals.filter(modal => modal !== this.element);\n document.removeEventListener(\"focusin\", this.handleFocusIn);\n document.removeEventListener(\"keydown\", this.handleKeyDown);\n document.removeEventListener(\"keyup\", this.handleKeyUp);\n }\n\n isActive() {\n // The \"active\" modal is always the most recent one shown\n return activeModals[activeModals.length - 1] === this.element;\n }\n\n checkFocus() {\n if (this.isActive()) {\n if (!this.element.matches(\":focus-within\")) {\n const { start, end } = getTabbableBoundary(this.element);\n const target = this.tabDirection === \"forward\" ? start : end;\n\n if (typeof target?.focus === \"function\") {\n target.focus({ preventScroll: true });\n }\n }\n }\n }\n\n handleFocusIn() {\n this.checkFocus();\n }\n\n handleKeyDown(event: KeyboardEvent) {\n if (event.key === \"Tab\" && event.shiftKey) {\n this.tabDirection = \"backward\";\n\n // Ensure focus remains trapped after the key is pressed\n requestAnimationFrame(() => this.checkFocus());\n }\n }\n\n handleKeyUp() {\n this.tabDirection = \"forward\";\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modal.js","sources":["../../src/utils/modal.ts"],"sourcesContent":["import { getTabbableBoundary } from \"./tabbable\";\n\nlet activeModals: HTMLElement[] = [];\n\nexport default class Modal {\n element: HTMLElement;\n tabDirection: \"forward\" | \"backward\" = \"forward\";\n\n constructor(element: HTMLElement) {\n this.element = element;\n this.handleFocusIn = this.handleFocusIn.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleKeyUp = this.handleKeyUp.bind(this);\n }\n\n activate() {\n activeModals.push(this.element);\n document.addEventListener(\"focusin\", this.handleFocusIn);\n document.addEventListener(\"keydown\", this.handleKeyDown);\n document.addEventListener(\"keyup\", this.handleKeyUp);\n }\n\n deactivate() {\n activeModals = activeModals.filter(modal => modal !== this.element);\n document.removeEventListener(\"focusin\", this.handleFocusIn);\n document.removeEventListener(\"keydown\", this.handleKeyDown);\n document.removeEventListener(\"keyup\", this.handleKeyUp);\n }\n\n isActive() {\n // The \"active\" modal is always the most recent one shown\n return activeModals[activeModals.length - 1] === this.element;\n }\n\n checkFocus() {\n if (this.isActive()) {\n if (!this.element.matches(\":focus-within\")) {\n const { start, end } = getTabbableBoundary(this.element);\n const target = this.tabDirection === \"forward\" ? start : end;\n\n if (typeof target?.focus === \"function\") {\n target.focus({ preventScroll: true });\n }\n }\n }\n }\n\n handleFocusIn() {\n this.checkFocus();\n }\n\n handleKeyDown(event: KeyboardEvent) {\n if (event.key === \"Tab\" && event.shiftKey) {\n this.tabDirection = \"backward\";\n\n // Ensure focus remains trapped after the key is pressed\n requestAnimationFrame(() => this.checkFocus());\n }\n }\n\n handleKeyUp() {\n this.tabDirection = \"forward\";\n }\n}\n"],"names":[],"mappings":";;;AAEA,IAAI,YAAY,GAAkB,EAAE,CAAC;AAEvB,MAAO,KAAK,CAAA;AAIxB,IAAA,WAAA,CAAY,OAAoB,EAAA;QAFhC,IAAY,CAAA,YAAA,GAA2B,SAAS,CAAC;AAG/C,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAChD;IAED,QAAQ,GAAA;AACN,QAAA,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACzD,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACzD,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;KACtD;IAED,UAAU,GAAA;AACR,QAAA,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC;QACpE,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5D,QAA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ANGED
package/utils/object.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.cjs.js","sources":["../../src/utils/object.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const assign = (target: any, ...args: any[]) => Object.assign(target, ...args);\nexport const keys = (obj: any) => Object.keys(obj);\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"object.cjs.js","sources":["../../src/utils/object.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const assign = (target: any, ...args: any[]) => Object.assign(target, ...args);\nexport const keys = (obj: any) => Object.keys(obj);\n"],"names":[],"mappings":";;;;;AAAA;MACa,MAAM,GAAG,CAAC,MAAW,EAAE,GAAG,IAAW,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE;AAC/E,MAAM,IAAI,GAAG,CAAC,GAAQ,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG;;;;;"}
|
package/utils/object.js
CHANGED
package/utils/object.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object.js","sources":["../../src/utils/object.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const assign = (target: any, ...args: any[]) => Object.assign(target, ...args);\nexport const keys = (obj: any) => Object.keys(obj);\n"],"names":[],"mappings":"AAAA;MACa,MAAM,GAAG,CAAC,MAAW,EAAE,GAAG,IAAW,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE;AAC/E,MAAM,IAAI,GAAG,CAAC,GAAQ,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG;;;;"}
|
|
1
|
+
{"version":3,"file":"object.js","sources":["../../src/utils/object.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const assign = (target: any, ...args: any[]) => Object.assign(target, ...args);\nexport const keys = (obj: any) => Object.keys(obj);\n"],"names":[],"mappings":";AAAA;MACa,MAAM,GAAG,CAAC,MAAW,EAAE,GAAG,IAAW,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,EAAE;AAC/E,MAAM,IAAI,GAAG,CAAC,GAAQ,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG;;;;"}
|
package/utils/scroll.cjs.js
CHANGED