@govtechsg/sgds-web-component 3.0.0-rc.6 → 3.0.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/Masthead/index.js +2 -2
- package/README.md +2 -2
- package/base/button.js +1 -1
- package/base/card-element.d.ts +0 -3
- package/base/card-element.js +0 -3
- package/base/card-element.js.map +1 -1
- package/base/card.js +1 -1
- package/base/sgds-element2.js +1 -1
- package/components/Accordion/accordion-item.js +1 -1
- package/components/Accordion/accordion.js +1 -1
- package/components/Accordion/index.umd.js +137 -145
- package/components/Accordion/index.umd.js.map +1 -1
- package/components/Accordion/sgds-accordion-item.js +1 -5
- package/components/Accordion/sgds-accordion-item.js.map +1 -1
- package/components/Accordion/sgds-accordion.js +1 -6
- package/components/Accordion/sgds-accordion.js.map +1 -1
- package/components/Alert/alert.js +1 -1
- package/components/Alert/index.umd.js +3 -3
- package/components/Badge/badge.js +1 -1
- package/components/Badge/index.umd.js +3 -3
- package/components/Breadcrumb/breadcrumb-item.js +1 -1
- package/components/Breadcrumb/index.umd.js +19 -7
- package/components/Breadcrumb/index.umd.js.map +1 -1
- package/components/Button/button.js +1 -1
- package/components/Button/index.umd.js +3 -3
- package/components/Card/card.js +1 -1
- package/components/Card/index.umd.js +6 -9
- package/components/Card/index.umd.js.map +1 -1
- package/components/Card/sgds-card.d.ts +3 -3
- package/components/Card/sgds-card.js +3 -3
- package/components/Card/sgds-card.js.map +1 -1
- package/components/Checkbox/checkbox.js +1 -1
- package/components/Checkbox/index.umd.js +3 -3
- package/components/ComboBox/combo-box-item2.js +1 -1
- package/components/ComboBox/combo-box.js +1 -1
- package/components/ComboBox/index.umd.js +14 -9
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/ComboBox/sgds-combo-box.d.ts +6 -1
- package/components/ComboBox/sgds-combo-box.js +6 -1
- package/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/components/Datepicker/datepicker-calendar2.js +1 -1
- package/components/Datepicker/datepicker.js +1 -1
- package/components/Datepicker/index.umd.js +9 -9
- package/components/DescriptionList/description-list-group.js +1 -1
- package/components/DescriptionList/description-list.js +1 -1
- package/components/DescriptionList/index.umd.js +18 -20
- package/components/DescriptionList/index.umd.js.map +1 -1
- package/components/DescriptionList/sgds-description-list-group.d.ts +1 -1
- package/components/DescriptionList/sgds-description-list-group.js +11 -11
- package/components/DescriptionList/sgds-description-list-group.js.map +1 -1
- package/components/DescriptionList/sgds-description-list.js +4 -6
- package/components/DescriptionList/sgds-description-list.js.map +1 -1
- package/components/Divider/divider.js +1 -1
- package/components/Divider/index.umd.js +2 -2
- package/components/Drawer/drawer.js +1 -1
- package/components/Drawer/index.umd.js +31 -136
- package/components/Drawer/index.umd.js.map +1 -1
- package/components/Drawer/sgds-drawer.d.ts +3 -32
- package/components/Drawer/sgds-drawer.js +16 -73
- package/components/Drawer/sgds-drawer.js.map +1 -1
- package/components/Dropdown/dropdown-item.js +1 -1
- package/components/Dropdown/dropdown-menu.js +1 -1
- package/components/Dropdown/index.umd.js +3 -3
- package/components/Dropdown/index.umd.js.map +1 -1
- package/components/Dropdown/sgds-dropdown-item.d.ts +2 -1
- package/components/Dropdown/sgds-dropdown-item.js.map +1 -1
- package/components/FileUpload/file-upload.js +1 -1
- package/components/FileUpload/index.umd.js +8 -8
- package/components/FileUpload/index.umd.js.map +1 -1
- package/components/FileUpload/sgds-file-upload.js +2 -2
- package/components/FileUpload/sgds-file-upload.js.map +1 -1
- package/components/Footer/footer-item.js +1 -1
- package/components/Footer/footer.js +1 -1
- package/components/Footer/index.umd.js +3 -3
- package/components/Icon/index.umd.js +1 -1
- package/components/IconButton/index.umd.js +2 -2
- package/components/IconList/index.umd.js +1 -1
- package/components/Input/index.umd.js +4 -4
- package/components/Input/input.js +1 -1
- package/components/Link/index.umd.js +15 -3
- package/components/Link/index.umd.js.map +1 -1
- package/components/Link/link.js +1 -1
- package/components/Link/sgds-link.d.ts +2 -1
- package/components/Link/sgds-link.js +13 -1
- package/components/Link/sgds-link.js.map +1 -1
- package/components/Mainnav/index.umd.js +74 -93
- package/components/Mainnav/index.umd.js.map +1 -1
- package/components/Mainnav/mainnav-dropdown.js +1 -1
- package/components/Mainnav/mainnav-item.js +1 -1
- package/components/Mainnav/mainnav.js +1 -1
- package/components/Mainnav/sgds-mainnav-dropdown.d.ts +1 -4
- package/components/Mainnav/sgds-mainnav-dropdown.js +24 -37
- package/components/Mainnav/sgds-mainnav-dropdown.js.map +1 -1
- package/components/Mainnav/sgds-mainnav-item.d.ts +9 -2
- package/components/Mainnav/sgds-mainnav-item.js +58 -3
- package/components/Mainnav/sgds-mainnav-item.js.map +1 -1
- package/components/Mainnav/sgds-mainnav.js +7 -6
- package/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/components/Masthead/index.umd.js +2 -2
- package/components/Masthead/masthead.js +1 -1
- package/components/Modal/index.umd.js +3 -3
- package/components/Modal/modal.js +1 -1
- package/components/Pagination/index.umd.js +4 -4
- package/components/Pagination/pagination.js +1 -1
- package/components/ProgressBar/index.umd.js +3 -3
- package/components/ProgressBar/index.umd.js.map +1 -1
- package/components/ProgressBar/progress-bar.js +1 -1
- package/components/ProgressBar/sgds-progress-bar.d.ts +1 -1
- package/components/ProgressBar/sgds-progress-bar.js +1 -1
- package/components/ProgressBar/sgds-progress-bar.js.map +1 -1
- package/components/QuantityToggle/index.umd.js +5 -10
- package/components/QuantityToggle/index.umd.js.map +1 -1
- package/components/QuantityToggle/sgds-quantity-toggle.d.ts +0 -2
- package/components/QuantityToggle/sgds-quantity-toggle.js +0 -5
- package/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/components/Radio/index.umd.js +3 -3
- package/components/Radio/radio.js +1 -1
- package/components/Sidenav/index.umd.js +40 -44
- package/components/Sidenav/index.umd.js.map +1 -1
- package/components/Sidenav/sgds-sidenav-item.d.ts +14 -16
- package/components/Sidenav/sgds-sidenav-item.js +39 -43
- package/components/Sidenav/sgds-sidenav-item.js.map +1 -1
- package/components/Sidenav/sidenav-item.js +1 -1
- package/components/Sidenav/sidenav-link.js +1 -1
- package/components/Skeleton/index.umd.js +2 -2
- package/components/Skeleton/skeleton.js +1 -1
- package/components/Spinner/index.umd.js +2 -2
- package/components/Spinner/spinner.js +1 -1
- package/components/Stepper/index.umd.js +2 -2
- package/components/Stepper/stepper.js +1 -1
- package/components/Switch/index.umd.js +2 -2
- package/components/Switch/switch.js +1 -1
- package/components/Tab/index.umd.js +2 -2
- package/components/Tab/tab.js +1 -1
- package/components/Table/index.umd.js +63 -205
- package/components/Table/index.umd.js.map +1 -1
- package/components/Table/sgds-table.d.ts +12 -55
- package/components/Table/sgds-table.js +59 -201
- package/components/Table/sgds-table.js.map +1 -1
- package/components/Table/table.js +1 -1
- package/components/TableOfContents/index.d.ts +6 -0
- package/components/TableOfContents/index.js +4 -0
- package/components/TableOfContents/index.js.map +1 -0
- package/components/TableOfContents/index.umd.js +3995 -0
- package/components/TableOfContents/index.umd.js.map +1 -0
- package/components/TableOfContents/sgds-table-of-contents.d.ts +13 -0
- package/components/TableOfContents/sgds-table-of-contents.js +25 -0
- package/components/TableOfContents/sgds-table-of-contents.js.map +1 -0
- package/components/TableOfContents/table-of-contents.js +6 -0
- package/components/TableOfContents/table-of-contents.js.map +1 -0
- package/components/Textarea/index.umd.js +3 -3
- package/components/Textarea/textarea.js +1 -1
- package/components/Toast/index.umd.js +3 -3
- package/components/Toast/toast.js +1 -1
- package/components/Tooltip/index.umd.js +2 -2
- package/components/Tooltip/tooltip.js +1 -1
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/index.umd.js +2694 -3016
- package/components/index.umd.js.map +1 -1
- package/css/grid.css +110 -0
- package/css/reboot.css +7 -7
- package/css/sgds.css +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.umd.js +2949 -3271
- package/index.umd.js.map +1 -1
- package/internals/CloseButton/close-button.js +1 -1
- package/internals/OverflowMenu/overflow-menu.js +1 -1
- package/package.json +1 -1
- package/react/base/button.cjs.js +1 -1
- package/react/base/button.js +1 -1
- package/react/base/card-element.cjs.js +0 -3
- package/react/base/card-element.cjs.js.map +1 -1
- package/react/base/card-element.js +0 -3
- package/react/base/card-element.js.map +1 -1
- package/react/base/card.cjs.js +1 -1
- package/react/base/card.js +1 -1
- package/react/base/sgds-element.cjs2.js +1 -1
- package/react/base/sgds-element2.js +1 -1
- package/react/components/Accordion/accordion-item.cjs.js +1 -1
- package/react/components/Accordion/accordion-item.js +1 -1
- package/react/components/Accordion/accordion.cjs.js +1 -1
- package/react/components/Accordion/accordion.js +1 -1
- package/react/components/Accordion/sgds-accordion-item.cjs.js +1 -5
- package/react/components/Accordion/sgds-accordion-item.cjs.js.map +1 -1
- package/react/components/Accordion/sgds-accordion-item.js +1 -5
- package/react/components/Accordion/sgds-accordion-item.js.map +1 -1
- package/react/components/Accordion/sgds-accordion.cjs.js +1 -6
- package/react/components/Accordion/sgds-accordion.cjs.js.map +1 -1
- package/react/components/Accordion/sgds-accordion.js +1 -6
- package/react/components/Accordion/sgds-accordion.js.map +1 -1
- package/react/components/Alert/alert.cjs.js +1 -1
- package/react/components/Alert/alert.js +1 -1
- package/react/components/Badge/badge.cjs.js +1 -1
- package/react/components/Badge/badge.js +1 -1
- package/react/components/Breadcrumb/breadcrumb-item.cjs.js +1 -1
- package/react/components/Breadcrumb/breadcrumb-item.js +1 -1
- package/react/components/Button/button.cjs.js +1 -1
- package/react/components/Button/button.js +1 -1
- package/react/components/Card/card.cjs.js +1 -1
- package/react/components/Card/card.js +1 -1
- package/react/components/Card/sgds-card.cjs.js +3 -3
- package/react/components/Card/sgds-card.cjs.js.map +1 -1
- package/react/components/Card/sgds-card.js +3 -3
- package/react/components/Card/sgds-card.js.map +1 -1
- package/react/components/Checkbox/checkbox.cjs.js +1 -1
- package/react/components/Checkbox/checkbox.js +1 -1
- package/react/components/ComboBox/combo-box-item.cjs2.js +1 -1
- package/react/components/ComboBox/combo-box-item2.js +1 -1
- package/react/components/ComboBox/combo-box.cjs.js +1 -1
- package/react/components/ComboBox/combo-box.js +1 -1
- package/react/components/ComboBox/sgds-combo-box.cjs.js +6 -1
- package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.js +6 -1
- package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/react/components/Datepicker/datepicker-calendar.cjs2.js +1 -1
- package/react/components/Datepicker/datepicker-calendar2.js +1 -1
- package/react/components/Datepicker/datepicker.cjs.js +1 -1
- package/react/components/Datepicker/datepicker.js +1 -1
- package/react/components/DescriptionList/description-list-group.cjs.js +1 -1
- package/react/components/DescriptionList/description-list-group.js +1 -1
- package/react/components/DescriptionList/description-list.cjs.js +1 -1
- package/react/components/DescriptionList/description-list.js +1 -1
- package/react/components/DescriptionList/sgds-description-list-group.cjs.js +11 -11
- package/react/components/DescriptionList/sgds-description-list-group.cjs.js.map +1 -1
- package/react/components/DescriptionList/sgds-description-list-group.js +11 -11
- package/react/components/DescriptionList/sgds-description-list-group.js.map +1 -1
- package/react/components/DescriptionList/sgds-description-list.cjs.js +4 -6
- package/react/components/DescriptionList/sgds-description-list.cjs.js.map +1 -1
- package/react/components/DescriptionList/sgds-description-list.js +4 -6
- package/react/components/DescriptionList/sgds-description-list.js.map +1 -1
- package/react/components/Divider/divider.cjs.js +1 -1
- package/react/components/Divider/divider.js +1 -1
- package/react/components/Drawer/drawer.cjs.js +1 -1
- package/react/components/Drawer/drawer.js +1 -1
- package/react/components/Drawer/sgds-drawer.cjs.js +15 -72
- package/react/components/Drawer/sgds-drawer.cjs.js.map +1 -1
- package/react/components/Drawer/sgds-drawer.js +16 -73
- package/react/components/Drawer/sgds-drawer.js.map +1 -1
- package/react/components/Dropdown/dropdown-item.cjs.js +1 -1
- package/react/components/Dropdown/dropdown-item.js +1 -1
- package/react/components/Dropdown/dropdown-menu.cjs.js +1 -1
- package/react/components/Dropdown/dropdown-menu.js +1 -1
- package/react/components/Dropdown/sgds-dropdown-item.cjs.js.map +1 -1
- package/react/components/Dropdown/sgds-dropdown-item.js.map +1 -1
- package/react/components/FileUpload/file-upload.cjs.js +1 -1
- package/react/components/FileUpload/file-upload.js +1 -1
- package/react/components/FileUpload/sgds-file-upload.cjs.js +2 -2
- package/react/components/FileUpload/sgds-file-upload.cjs.js.map +1 -1
- package/react/components/FileUpload/sgds-file-upload.js +2 -2
- package/react/components/FileUpload/sgds-file-upload.js.map +1 -1
- package/react/components/Footer/footer-item.cjs.js +1 -1
- package/react/components/Footer/footer-item.js +1 -1
- package/react/components/Footer/footer.cjs.js +1 -1
- package/react/components/Footer/footer.js +1 -1
- package/react/components/Input/input.cjs.js +1 -1
- package/react/components/Input/input.js +1 -1
- package/react/components/Link/link.cjs.js +1 -1
- package/react/components/Link/link.js +1 -1
- package/react/components/Link/sgds-link.cjs.js +13 -1
- package/react/components/Link/sgds-link.cjs.js.map +1 -1
- package/react/components/Link/sgds-link.js +13 -1
- package/react/components/Link/sgds-link.js.map +1 -1
- package/react/components/Mainnav/mainnav-dropdown.cjs.js +1 -1
- package/react/components/Mainnav/mainnav-dropdown.js +1 -1
- package/react/components/Mainnav/mainnav-item.cjs.js +1 -1
- package/react/components/Mainnav/mainnav-item.js +1 -1
- package/react/components/Mainnav/mainnav.cjs.js +1 -1
- package/react/components/Mainnav/mainnav.js +1 -1
- package/react/components/Mainnav/sgds-mainnav-dropdown.cjs.js +23 -36
- package/react/components/Mainnav/sgds-mainnav-dropdown.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav-dropdown.js +24 -37
- package/react/components/Mainnav/sgds-mainnav-dropdown.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav-item.cjs.js +58 -3
- package/react/components/Mainnav/sgds-mainnav-item.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav-item.js +58 -3
- package/react/components/Mainnav/sgds-mainnav-item.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.cjs.js +7 -6
- package/react/components/Mainnav/sgds-mainnav.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.js +7 -6
- package/react/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/react/components/Masthead/masthead.cjs.js +1 -1
- package/react/components/Masthead/masthead.js +1 -1
- package/react/components/Modal/modal.cjs.js +1 -1
- package/react/components/Modal/modal.js +1 -1
- package/react/components/Pagination/pagination.cjs.js +1 -1
- package/react/components/Pagination/pagination.js +1 -1
- package/react/components/ProgressBar/progress-bar.cjs.js +1 -1
- package/react/components/ProgressBar/progress-bar.js +1 -1
- package/react/components/ProgressBar/sgds-progress-bar.cjs.js +1 -1
- package/react/components/ProgressBar/sgds-progress-bar.cjs.js.map +1 -1
- package/react/components/ProgressBar/sgds-progress-bar.js +1 -1
- package/react/components/ProgressBar/sgds-progress-bar.js.map +1 -1
- package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js +0 -5
- package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js.map +1 -1
- package/react/components/QuantityToggle/sgds-quantity-toggle.js +0 -5
- package/react/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
- package/react/components/Radio/radio.cjs.js +1 -1
- package/react/components/Radio/radio.js +1 -1
- package/react/components/Sidenav/sgds-sidenav-item.cjs.js +37 -41
- package/react/components/Sidenav/sgds-sidenav-item.cjs.js.map +1 -1
- package/react/components/Sidenav/sgds-sidenav-item.js +39 -43
- package/react/components/Sidenav/sgds-sidenav-item.js.map +1 -1
- package/react/components/Sidenav/sidenav-item.cjs.js +1 -1
- package/react/components/Sidenav/sidenav-item.js +1 -1
- package/react/components/Sidenav/sidenav-link.cjs.js +1 -1
- package/react/components/Sidenav/sidenav-link.js +1 -1
- package/react/components/Skeleton/skeleton.cjs.js +1 -1
- package/react/components/Skeleton/skeleton.js +1 -1
- package/react/components/Spinner/spinner.cjs.js +1 -1
- package/react/components/Spinner/spinner.js +1 -1
- package/react/components/Stepper/stepper.cjs.js +1 -1
- package/react/components/Stepper/stepper.js +1 -1
- package/react/components/Switch/switch.cjs.js +1 -1
- package/react/components/Switch/switch.js +1 -1
- package/react/components/Tab/tab.cjs.js +1 -1
- package/react/components/Tab/tab.js +1 -1
- package/react/components/Table/sgds-table.cjs.js +59 -201
- package/react/components/Table/sgds-table.cjs.js.map +1 -1
- package/react/components/Table/sgds-table.js +59 -201
- package/react/components/Table/sgds-table.js.map +1 -1
- package/react/components/Table/table.cjs.js +1 -1
- package/react/components/Table/table.js +1 -1
- package/react/components/TableOfContents/sgds-table-of-contents.cjs.js +31 -0
- package/react/components/TableOfContents/sgds-table-of-contents.cjs.js.map +1 -0
- package/react/components/TableOfContents/sgds-table-of-contents.js +26 -0
- package/react/components/TableOfContents/sgds-table-of-contents.js.map +1 -0
- package/react/components/TableOfContents/table-of-contents.cjs.js +11 -0
- package/react/components/TableOfContents/table-of-contents.cjs.js.map +1 -0
- package/react/components/TableOfContents/table-of-contents.js +7 -0
- package/react/components/TableOfContents/table-of-contents.js.map +1 -0
- package/react/components/Textarea/textarea.cjs.js +1 -1
- package/react/components/Textarea/textarea.js +1 -1
- package/react/components/Toast/toast.cjs.js +1 -1
- package/react/components/Toast/toast.js +1 -1
- package/react/components/Tooltip/tooltip.cjs.js +1 -1
- package/react/components/Tooltip/tooltip.js +1 -1
- package/react/index.cjs.js +94 -94
- package/react/index.d.ts +1 -1
- package/react/index.js +1 -1
- package/react/internals/CloseButton/close-button.cjs.js +1 -1
- package/react/internals/CloseButton/close-button.js +1 -1
- package/react/internals/OverflowMenu/overflow-menu.cjs.js +1 -1
- package/react/internals/OverflowMenu/overflow-menu.js +1 -1
- package/react/styles/feedback.cjs.js +1 -1
- package/react/styles/feedback.js +1 -1
- package/react/{action-card → table-of-contents}/index.cjs.js +5 -7
- package/react/table-of-contents/index.cjs.js.map +1 -0
- package/react/{action-card → table-of-contents}/index.js +5 -7
- package/react/table-of-contents/index.js.map +1 -0
- package/styles/feedback.js +1 -1
- package/themes/day.css +113 -105
- package/themes/night.css +117 -109
- package/themes/root.css +92 -85
- package/base/link-element.js +0 -55
- package/base/link-element.js.map +0 -1
- package/components/ActionCard/action-card.js +0 -6
- package/components/ActionCard/action-card.js.map +0 -1
- package/components/ActionCard/index.d.ts +0 -6
- package/components/ActionCard/index.js +0 -5
- package/components/ActionCard/index.js.map +0 -1
- package/components/ActionCard/index.umd.js +0 -5860
- package/components/ActionCard/index.umd.js.map +0 -1
- package/components/ActionCard/sgds-action-card.d.ts +0 -54
- package/components/ActionCard/sgds-action-card.js +0 -148
- package/components/ActionCard/sgds-action-card.js.map +0 -1
- package/react/action-card/index.cjs.js.map +0 -1
- package/react/action-card/index.js.map +0 -1
- package/react/base/link-element.cjs.js +0 -60
- package/react/base/link-element.cjs.js.map +0 -1
- package/react/base/link-element.js +0 -56
- package/react/base/link-element.js.map +0 -1
- package/react/components/ActionCard/action-card.cjs.js +0 -11
- package/react/components/ActionCard/action-card.cjs.js.map +0 -1
- package/react/components/ActionCard/action-card.js +0 -7
- package/react/components/ActionCard/action-card.js.map +0 -1
- package/react/components/ActionCard/sgds-action-card.cjs.js +0 -154
- package/react/components/ActionCard/sgds-action-card.cjs.js.map +0 -1
- package/react/components/ActionCard/sgds-action-card.js +0 -149
- package/react/components/ActionCard/sgds-action-card.js.map +0 -1
- /package/react/{action-card → table-of-contents}/index.d.ts +0 -0
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var lit = require('lit');
|
|
7
7
|
|
|
8
|
-
var css_248z = lit.css`:host{
|
|
8
|
+
var css_248z = lit.css`:host{display:contents}.drawer{height:100%;inset-inline-start:0;overflow:hidden;pointer-events:none;top:0;width:100%}.drawer-fixed{position:fixed;z-index:1100}.drawer-panel{background-color:var(--sgds-surface-default);display:flex;flex-direction:column;gap:var(--sgds-gap-2-xl);max-height:100%;max-width:100%;overflow:auto;padding:var(--sgds-padding-4-xl) var(--sgds-padding-3-xl);pointer-events:all;position:absolute;z-index:2}.drawer-panel:focus{outline:none}.drawer-top .drawer-panel{bottom:auto;height:var(--sgds-dimension-512);inset-inline-end:auto;inset-inline-start:0;top:0;width:100%}.drawer-end .drawer-panel{bottom:auto;height:100%;inset-inline-end:0;inset-inline-start:auto;top:0;width:var(--sgds-dimension-512)}.drawer-bottom .drawer-panel{bottom:0;height:var(--sgds-dimension-512);inset-inline-end:auto;inset-inline-start:0;top:auto;width:100%}.drawer-start .drawer-panel{bottom:auto;height:100%;inset-inline-end:auto;inset-inline-start:0;top:0;width:var(--sgds-dimension-512)}.drawer-header{display:flex;flex-direction:column;gap:var(--sgds-gap-sm)}slot[name=title]::slotted(*){--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-font-size-6:var(--sgds-font-size-4);color:var(--sgds-color-default)!important;font-size:var(--sgds-font-size-6,var(--sgds-font-size-4));margin-bottom:var(--sgds-margin-2-xs,var(--sgds-margin-none))}slot[name=description]::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);color:var(--sgds-color-subtle);margin-bottom:var(--sgds-paragraph-spacing-xl,var(--sgds-margin-none))}sgds-close-button{position:absolute;right:32px;top:32px}.drawer-body{-webkit-overflow-scrolling:touch;display:block;flex:1 1 auto;overflow:auto}.drawer-overlay{background-color:var(--sgds-bg-overlay);bottom:0;display:block;left:0;pointer-events:all;position:fixed;right:0;top:0}.drawer-contained .drawer-overlay{display:none}@media screen and (max-width:768px){.drawer-panel{padding:var(--sgds-padding-3-xl) var(--sgds-padding-lg)}sgds-close-button{right:20px;top:20px}}`;
|
|
9
9
|
|
|
10
10
|
exports["default"] = css_248z;
|
|
11
11
|
//# sourceMappingURL=drawer.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
|
|
4
|
-
var css_248z = css`:host{
|
|
4
|
+
var css_248z = css`:host{display:contents}.drawer{height:100%;inset-inline-start:0;overflow:hidden;pointer-events:none;top:0;width:100%}.drawer-fixed{position:fixed;z-index:1100}.drawer-panel{background-color:var(--sgds-surface-default);display:flex;flex-direction:column;gap:var(--sgds-gap-2-xl);max-height:100%;max-width:100%;overflow:auto;padding:var(--sgds-padding-4-xl) var(--sgds-padding-3-xl);pointer-events:all;position:absolute;z-index:2}.drawer-panel:focus{outline:none}.drawer-top .drawer-panel{bottom:auto;height:var(--sgds-dimension-512);inset-inline-end:auto;inset-inline-start:0;top:0;width:100%}.drawer-end .drawer-panel{bottom:auto;height:100%;inset-inline-end:0;inset-inline-start:auto;top:0;width:var(--sgds-dimension-512)}.drawer-bottom .drawer-panel{bottom:0;height:var(--sgds-dimension-512);inset-inline-end:auto;inset-inline-start:0;top:auto;width:100%}.drawer-start .drawer-panel{bottom:auto;height:100%;inset-inline-end:auto;inset-inline-start:0;top:0;width:var(--sgds-dimension-512)}.drawer-header{display:flex;flex-direction:column;gap:var(--sgds-gap-sm)}slot[name=title]::slotted(*){--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-font-size-6:var(--sgds-font-size-4);color:var(--sgds-color-default)!important;font-size:var(--sgds-font-size-6,var(--sgds-font-size-4));margin-bottom:var(--sgds-margin-2-xs,var(--sgds-margin-none))}slot[name=description]::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);color:var(--sgds-color-subtle);margin-bottom:var(--sgds-paragraph-spacing-xl,var(--sgds-margin-none))}sgds-close-button{position:absolute;right:32px;top:32px}.drawer-body{-webkit-overflow-scrolling:touch;display:block;flex:1 1 auto;overflow:auto}.drawer-overlay{background-color:var(--sgds-bg-overlay);bottom:0;display:block;left:0;pointer-events:all;position:fixed;right:0;top:0}.drawer-contained .drawer-overlay{display:none}@media screen and (max-width:768px){.drawer-panel{padding:var(--sgds-padding-3-xl) var(--sgds-padding-lg)}sgds-close-button{right:20px;top:20px}}`;
|
|
5
5
|
|
|
6
6
|
export { css_248z as default };
|
|
7
7
|
//# sourceMappingURL=drawer.js.map
|
|
@@ -7,13 +7,11 @@ var tslib = require('tslib');
|
|
|
7
7
|
var lit = require('lit');
|
|
8
8
|
var decorators_js = require('lit/decorators.js');
|
|
9
9
|
var classMap_js = require('lit/directives/class-map.js');
|
|
10
|
-
var ifDefined_js = require('lit/directives/if-defined.js');
|
|
11
10
|
var sgdsElement = require('../../base/sgds-element.cjs.js');
|
|
12
11
|
var animate = require('../../utils/animate.cjs.js');
|
|
13
12
|
var animationRegistry = require('../../utils/animation-registry.cjs.js');
|
|
14
13
|
var event = require('../../utils/event.cjs.js');
|
|
15
14
|
var scroll = require('../../utils/scroll.cjs.js');
|
|
16
|
-
var slot = require('../../utils/slot.cjs.js');
|
|
17
15
|
var watch = require('../../utils/watch.cjs.js');
|
|
18
16
|
var drawer = require('./drawer.cjs.js');
|
|
19
17
|
var sgdsCloseButton = require('../../internals/CloseButton/sgds-close-button.cjs.js');
|
|
@@ -21,10 +19,9 @@ var sgdsCloseButton = require('../../internals/CloseButton/sgds-close-button.cjs
|
|
|
21
19
|
/**
|
|
22
20
|
* @summary Drawers slide in from a container to expose additional options and information.
|
|
23
21
|
*
|
|
24
|
-
* @slot - The drawer's main content
|
|
25
|
-
* @slot
|
|
26
|
-
* @slot
|
|
27
|
-
* @slot footer - The drawer's footer, usually one or more buttons representing various options.
|
|
22
|
+
* @slot default - The drawer's main content
|
|
23
|
+
* @slot title - The title of the drawer
|
|
24
|
+
* @slot description - The description of the drawer
|
|
28
25
|
*
|
|
29
26
|
* @event sgds-show - Emitted when the drawer opens.
|
|
30
27
|
* @event sgds-after-show - Emitted after the drawer opens and all animations are complete.
|
|
@@ -37,38 +34,15 @@ var sgdsCloseButton = require('../../internals/CloseButton/sgds-close-button.cjs
|
|
|
37
34
|
* `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in
|
|
38
35
|
* destructive behavior such as data loss.
|
|
39
36
|
*
|
|
40
|
-
* @csspart base - The component's base wrapper.
|
|
41
|
-
* @csspart overlay - The overlay that covers the screen behind the drawer.
|
|
42
|
-
* @csspart panel - The drawer's panel (where the drawer and its content are rendered).
|
|
43
|
-
* @csspart header - The drawer's header. This element wraps the title and header actions.
|
|
44
|
-
* @csspart header-actions - Optional actions to add to the header.
|
|
45
|
-
* @csspart title - The drawer's title.
|
|
46
|
-
* @csspart close-button - The close button.
|
|
47
|
-
* @csspart body - The drawer's body.
|
|
48
|
-
* @csspart footer - The drawer's footer.
|
|
49
|
-
*
|
|
50
|
-
* @cssproperty --drawer-size - The preferred size of the drawer. This will be applied to the drawer's width or height
|
|
51
|
-
* depending on its `placement`. Note that the drawer will shrink to accommodate smaller screens.
|
|
52
|
-
* @cssproperty --drawer-padding - The amount of padding to use for the header, body and footer
|
|
53
|
-
* @cssproperty --drawer-bg - The drawer's background color.
|
|
54
|
-
* @cssproperty --drawer-button-gap - The drawer's flex gap between buttons.
|
|
55
|
-
*
|
|
56
37
|
*/
|
|
57
38
|
class SgdsDrawer extends sgdsElement["default"] {
|
|
58
39
|
constructor() {
|
|
59
40
|
super(...arguments);
|
|
60
|
-
/** @internal */
|
|
61
|
-
this.hasSlotController = new slot.HasSlotController(this, "footer");
|
|
62
41
|
/**
|
|
63
42
|
* Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can
|
|
64
43
|
* use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.
|
|
65
44
|
*/
|
|
66
45
|
this.open = false;
|
|
67
|
-
/**
|
|
68
|
-
* The drawer's label as displayed in the header. You should always include a relevant label even when using
|
|
69
|
-
* `noHeader`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.
|
|
70
|
-
*/
|
|
71
|
-
this.label = "";
|
|
72
46
|
/** The direction from which the drawer will open. */
|
|
73
47
|
this.placement = "end";
|
|
74
48
|
/**
|
|
@@ -76,11 +50,6 @@ class SgdsDrawer extends sgdsElement["default"] {
|
|
|
76
50
|
* its parent element, set this attribute and add `position: relative` to the parent.
|
|
77
51
|
*/
|
|
78
52
|
this.contained = false;
|
|
79
|
-
/**
|
|
80
|
-
* Removes the header. This will also remove the default close button, so please ensure you provide an easy,
|
|
81
|
-
* accessible way for users to dismiss the drawer.
|
|
82
|
-
*/
|
|
83
|
-
this.noHeader = false;
|
|
84
53
|
this.handleDocumentKeyDown = (event) => {
|
|
85
54
|
if (this.open && !this.contained && event.key === "Escape") {
|
|
86
55
|
event.stopPropagation();
|
|
@@ -229,7 +198,6 @@ class SgdsDrawer extends sgdsElement["default"] {
|
|
|
229
198
|
render() {
|
|
230
199
|
return lit.html `
|
|
231
200
|
<div
|
|
232
|
-
part="base"
|
|
233
201
|
class=${classMap_js.classMap({
|
|
234
202
|
drawer: true,
|
|
235
203
|
"drawer-open": this.open,
|
|
@@ -238,47 +206,28 @@ class SgdsDrawer extends sgdsElement["default"] {
|
|
|
238
206
|
"drawer-bottom": this.placement === "bottom",
|
|
239
207
|
"drawer-start": this.placement === "start",
|
|
240
208
|
"drawer-contained": this.contained,
|
|
241
|
-
"drawer-fixed": !this.contained
|
|
242
|
-
"drawer-has-footer": this.hasSlotController.test("footer")
|
|
209
|
+
"drawer-fixed": !this.contained
|
|
243
210
|
})}
|
|
244
211
|
>
|
|
245
|
-
<div
|
|
212
|
+
<div class="drawer-overlay" @click=${() => this.requestClose("overlay")} tabindex="-1"></div>
|
|
246
213
|
|
|
247
214
|
<div
|
|
248
|
-
part="panel"
|
|
249
215
|
class="drawer-panel"
|
|
250
216
|
role="dialog"
|
|
251
217
|
aria-modal="true"
|
|
252
218
|
aria-hidden=${this.open ? "false" : "true"}
|
|
253
|
-
aria-label=${ifDefined_js.ifDefined(this.noHeader ? this.label : undefined)}
|
|
254
|
-
aria-labelledby=${ifDefined_js.ifDefined(!this.noHeader ? "title" : undefined)}
|
|
255
219
|
tabindex="0"
|
|
256
220
|
>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
part="close-button"
|
|
268
|
-
class="drawer-close"
|
|
269
|
-
aria-label="close drawer"
|
|
270
|
-
@click="${() => this.requestClose("close-button")}"
|
|
271
|
-
></sgds-close-button>
|
|
272
|
-
</div>
|
|
273
|
-
</header>
|
|
274
|
-
`
|
|
275
|
-
: lit.nothing}
|
|
276
|
-
|
|
277
|
-
<slot part="body" class="drawer-body"></slot>
|
|
278
|
-
|
|
279
|
-
<footer part="footer" class="drawer-footer">
|
|
280
|
-
<slot name="footer"></slot>
|
|
281
|
-
</footer>
|
|
221
|
+
<header class="drawer-header">
|
|
222
|
+
<slot name="title"></slot>
|
|
223
|
+
<slot name="description"></slot>
|
|
224
|
+
<sgds-close-button
|
|
225
|
+
class="drawer-close"
|
|
226
|
+
aria-label="close drawer"
|
|
227
|
+
@click="${() => this.requestClose("close-button")}"
|
|
228
|
+
></sgds-close-button>
|
|
229
|
+
</header>
|
|
230
|
+
<slot class="drawer-body"></slot>
|
|
282
231
|
</div>
|
|
283
232
|
</div>
|
|
284
233
|
`;
|
|
@@ -301,18 +250,12 @@ tslib.__decorate([
|
|
|
301
250
|
tslib.__decorate([
|
|
302
251
|
decorators_js.property({ type: Boolean, reflect: true })
|
|
303
252
|
], SgdsDrawer.prototype, "open", void 0);
|
|
304
|
-
tslib.__decorate([
|
|
305
|
-
decorators_js.property({ type: String, reflect: true })
|
|
306
|
-
], SgdsDrawer.prototype, "label", void 0);
|
|
307
253
|
tslib.__decorate([
|
|
308
254
|
decorators_js.property({ type: String, reflect: true })
|
|
309
255
|
], SgdsDrawer.prototype, "placement", void 0);
|
|
310
256
|
tslib.__decorate([
|
|
311
257
|
decorators_js.property({ type: Boolean, reflect: true })
|
|
312
258
|
], SgdsDrawer.prototype, "contained", void 0);
|
|
313
|
-
tslib.__decorate([
|
|
314
|
-
decorators_js.property({ type: Boolean, reflect: true })
|
|
315
|
-
], SgdsDrawer.prototype, "noHeader", void 0);
|
|
316
259
|
tslib.__decorate([
|
|
317
260
|
watch.watch("open", { waitUntilFirstUpdate: true })
|
|
318
261
|
], SgdsDrawer.prototype, "handleOpenChange", null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-drawer.cjs.js","sources":["../../../../src/components/Drawer/sgds-drawer.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, query } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { animateTo, stopAnimations } from \"../../utils/animate.js\";\nimport { getAnimation, setDefaultAnimation } from \"../../utils/animation-registry.js\";\nimport { waitForEvent } from \"../../utils/event.js\";\nimport { lockBodyScrolling, unlockBodyScrolling } from \"../../utils/scroll.js\";\nimport { HasSlotController } from \"../../utils/slot.js\";\nimport { watch } from \"../../utils/watch.js\";\nimport drawerStyles from \"./drawer.css\";\nimport SgdsCloseButton from \"../../internals/CloseButton/sgds-close-button\";\n\n/**\n * @summary Drawers slide in from a container to expose additional options and information.\n *\n * @slot - The drawer's main content.\n * @slot label - The drawer's label. Alternatively, you can use the `label` attribute.\n * @slot header-actions - Optional actions to add to the header.\n * @slot footer - The drawer's footer, usually one or more buttons representing various options.\n *\n * @event sgds-show - Emitted when the drawer opens.\n * @event sgds-after-show - Emitted after the drawer opens and all animations are complete.\n * @event sgds-hide - Emitted when the drawer closes.\n * @event sgds-after-hide - Emitted after the drawer closes and all animations are complete.\n * @event sgds-initial-focus - Emitted when the drawer opens and is ready to receive focus. Calling\n * `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.\n * @event {{ source: 'close-button' | 'keyboard' | 'overlay' }} sgds-request-close - Emitted when the user attempts to\n * close the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling\n * `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in\n * destructive behavior such as data loss.\n *\n * @csspart base - The component's base wrapper.\n * @csspart overlay - The overlay that covers the screen behind the drawer.\n * @csspart panel - The drawer's panel (where the drawer and its content are rendered).\n * @csspart header - The drawer's header. This element wraps the title and header actions.\n * @csspart header-actions - Optional actions to add to the header.\n * @csspart title - The drawer's title.\n * @csspart close-button - The close button.\n * @csspart body - The drawer's body.\n * @csspart footer - The drawer's footer.\n *\n * @cssproperty --drawer-size - The preferred size of the drawer. This will be applied to the drawer's width or height\n * depending on its `placement`. Note that the drawer will shrink to accommodate smaller screens.\n * @cssproperty --drawer-padding - The amount of padding to use for the header, body and footer\n * @cssproperty --drawer-bg - The drawer's background color.\n * @cssproperty --drawer-button-gap - The drawer's flex gap between buttons.\n *\n */\nexport class SgdsDrawer extends SgdsElement {\n static styles = [...SgdsElement.styles, drawerStyles];\n /**@internal */\n static dependencies = {\n \"sgds-close-button\": SgdsCloseButton\n };\n /** @internal */\n private readonly hasSlotController = new HasSlotController(this, \"footer\");\n /** @internal */\n private originalTrigger: HTMLElement | null;\n /** @internal */\n @query(\".drawer\") drawer: HTMLElement;\n /** @internal */\n @query(\".drawer-panel\") panel: HTMLElement;\n /** @internal */\n @query(\".drawer-overlay\") overlay: HTMLElement;\n\n /**\n * Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\n * use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /**\n * The drawer's label as displayed in the header. You should always include a relevant label even when using\n * `noHeader`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n */\n @property({ type: String, reflect: true }) label = \"\";\n\n /** The direction from which the drawer will open. */\n @property({ type: String, reflect: true }) placement: \"top\" | \"end\" | \"bottom\" | \"start\" = \"end\";\n\n /**\n * By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\n * its parent element, set this attribute and add `position: relative` to the parent.\n */\n @property({ type: Boolean, reflect: true }) contained = false;\n\n /**\n * Removes the header. This will also remove the default close button, so please ensure you provide an easy,\n * accessible way for users to dismiss the drawer.\n */\n @property({ type: Boolean, reflect: true }) noHeader = false;\n\n firstUpdated() {\n this.drawer.hidden = !this.open;\n\n if (this.open) {\n this.addOpenListeners();\n\n if (!this.contained) {\n lockBodyScrolling(this);\n }\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n unlockBodyScrolling(this);\n }\n\n private uppercaseFirstLetter(string: string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n }\n\n private requestClose(source: \"close-button\" | \"keyboard\" | \"overlay\") {\n const slRequestClose = this.emit(\"sgds-request-close\", {\n cancelable: true,\n detail: { source }\n });\n\n if (slRequestClose.defaultPrevented) {\n const animation = getAnimation(this, \"drawer.denyClose\");\n animateTo(this.panel, animation.keyframes, animation.options);\n return;\n }\n\n this.hide();\n }\n\n private addOpenListeners() {\n document.addEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n private removeOpenListeners() {\n document.removeEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n private handleDocumentKeyDown = (event: KeyboardEvent) => {\n if (this.open && !this.contained && event.key === \"Escape\") {\n event.stopPropagation();\n this.requestClose(\"keyboard\");\n }\n };\n\n @watch(\"open\", { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit(\"sgds-show\");\n this.addOpenListeners();\n this.originalTrigger = document.activeElement as HTMLElement;\n\n // Lock body scrolling only if the drawer isn't contained\n if (!this.contained) {\n lockBodyScrolling(this);\n }\n\n // When the drawer is shown, Safari will attempt to set focus on whatever element has autofocus. This causes the\n // drawer's animation to jitter, so we'll temporarily remove the attribute, call `focus({ preventScroll: true })`\n // ourselves, and add the attribute back afterwards.\n //\n // Related: https://github.com/shoelace-style/shoelace/issues/693\n //\n const autoFocusTarget = this.querySelector(\"[autofocus]\");\n if (autoFocusTarget) {\n autoFocusTarget.removeAttribute(\"autofocus\");\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n this.drawer.hidden = false;\n\n // Set initial focus\n requestAnimationFrame(() => {\n const slInitialFocus = this.emit(\"sgds-initial-focus\", { cancelable: true });\n\n if (!slInitialFocus.defaultPrevented) {\n // Set focus to the autofocus target and restore the attribute\n if (autoFocusTarget) {\n (autoFocusTarget as HTMLInputElement).focus({ preventScroll: true });\n } else {\n this.panel.focus({ preventScroll: true });\n }\n }\n\n // Restore the autofocus attribute\n if (autoFocusTarget) {\n autoFocusTarget.setAttribute(\"autofocus\", \"\");\n }\n });\n\n const panelAnimation = getAnimation(this, `drawer.show${this.uppercaseFirstLetter(this.placement)}`);\n const overlayAnimation = getAnimation(this, \"drawer.overlay.show\");\n await Promise.all([\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)\n ]);\n\n this.emit(\"sgds-after-show\");\n } else {\n // Hide\n this.emit(\"sgds-hide\");\n this.removeOpenListeners();\n\n if (!this.contained) {\n unlockBodyScrolling(this);\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n const panelAnimation = getAnimation(this, `drawer.hide${this.uppercaseFirstLetter(this.placement)}`);\n const overlayAnimation = getAnimation(this, \"drawer.overlay.hide\");\n\n // Animate the overlay and the panel at the same time. Because animation durations might be different, we need to\n // hide each one individually when the animation finishes, otherwise the first one that finishes will reappear\n // unexpectedly. We'll unhide them after all animations have completed.\n await Promise.all([\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {\n this.overlay.hidden = true;\n }),\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {\n this.panel.hidden = true;\n })\n ]);\n\n this.drawer.hidden = true;\n\n // Now that the dialog is hidden, restore the overlay and panel for next time\n this.overlay.hidden = false;\n this.panel.hidden = false;\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (typeof trigger?.focus === \"function\") {\n setTimeout(() => trigger.focus());\n }\n\n this.emit(\"sgds-after-hide\");\n }\n }\n\n @watch(\"contained\", { waitUntilFirstUpdate: true })\n handleNoModalChange() {\n if (this.open && !this.contained) {\n lockBodyScrolling(this);\n }\n\n if (this.open && this.contained) {\n unlockBodyScrolling(this);\n }\n }\n\n /** Shows the drawer. */\n public async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, \"sgds-after-show\");\n }\n\n /** Hides the drawer */\n public async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, \"sgds-after-hide\");\n }\n\n render() {\n return html`\n <div\n part=\"base\"\n class=${classMap({\n drawer: true,\n \"drawer-open\": this.open,\n \"drawer-top\": this.placement === \"top\",\n \"drawer-end\": this.placement === \"end\",\n \"drawer-bottom\": this.placement === \"bottom\",\n \"drawer-start\": this.placement === \"start\",\n \"drawer-contained\": this.contained,\n \"drawer-fixed\": !this.contained,\n \"drawer-has-footer\": this.hasSlotController.test(\"footer\")\n })}\n >\n <div part=\"overlay\" class=\"drawer-overlay\" @click=${() => this.requestClose(\"overlay\")} tabindex=\"-1\"></div>\n\n <div\n part=\"panel\"\n class=\"drawer-panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden=${this.open ? \"false\" : \"true\"}\n aria-label=${ifDefined(this.noHeader ? this.label : undefined)}\n aria-labelledby=${ifDefined(!this.noHeader ? \"title\" : undefined)}\n tabindex=\"0\"\n >\n ${!this.noHeader\n ? html`\n <header part=\"header\" class=\"drawer-header\">\n <h2 part=\"title\" class=\"drawer-title\" id=\"title\">\n <!-- If there's no label, use an invisible character to prevent the header from collapsing -->\n <slot name=\"label\"> ${this.label.length > 0 ? this.label : String.fromCharCode(65279)} </slot>\n </h2>\n <div part=\"header-actions\" class=\"drawer-header-actions\">\n <slot name=\"header-actions\"></slot>\n <sgds-close-button\n part=\"close-button\"\n class=\"drawer-close\"\n aria-label=\"close drawer\"\n @click=\"${() => this.requestClose(\"close-button\")}\"\n ></sgds-close-button>\n </div>\n </header>\n `\n : nothing}\n\n <slot part=\"body\" class=\"drawer-body\"></slot>\n\n <footer part=\"footer\" class=\"drawer-footer\">\n <slot name=\"footer\"></slot>\n </footer>\n </div>\n </div>\n `;\n }\n}\n\n// Top\nsetDefaultAnimation(\"drawer.showTop\", {\n keyframes: [\n { opacity: 0, translate: \"0 -100%\" },\n { opacity: 1, translate: \"0 0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideTop\", {\n keyframes: [\n { opacity: 1, translate: \"0 0\" },\n { opacity: 0, translate: \"0 -100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// End\nsetDefaultAnimation(\"drawer.showEnd\", {\n keyframes: [\n { opacity: 0, translate: \"100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: \"-100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideEnd\", {\n keyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"100%\" }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"-100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// Bottom\nsetDefaultAnimation(\"drawer.showBottom\", {\n keyframes: [\n { opacity: 0, translate: \"0 100%\" },\n { opacity: 1, translate: \"0 0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideBottom\", {\n keyframes: [\n { opacity: 1, translate: \"0 0\" },\n { opacity: 0, translate: \"0 100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// Start\nsetDefaultAnimation(\"drawer.showStart\", {\n keyframes: [\n { opacity: 0, translate: \"-100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: \"100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideStart\", {\n keyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"-100%\" }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// Deny close\nsetDefaultAnimation(\"drawer.denyClose\", {\n keyframes: [{ scale: 1 }, { scale: 1.01 }, { scale: 1 }],\n options: { duration: 250 }\n});\n\n// Overlay\nsetDefaultAnimation(\"drawer.overlay.show\", {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 250 }\n});\n\nsetDefaultAnimation(\"drawer.overlay.hide\", {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 250 }\n});\n\nexport default SgdsDrawer;\n"],"names":["SgdsElement","HasSlotController","lockBodyScrolling","unlockBodyScrolling","getAnimation","animateTo","stopAnimations","waitForEvent","html","classMap","ifDefined","nothing","drawerStyles","SgdsCloseButton","__decorate","query","property","watch","setDefaultAnimation"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCG;AACG,MAAO,UAAW,SAAQA,sBAAW,CAAA;AAA3C,IAAA,WAAA,GAAA;;;QAOmB,IAAiB,CAAA,iBAAA,GAAG,IAAIC,sBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAU3E;;;AAGG;QACyC,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;AAEzD;;;AAGG;QACwC,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAGX,IAAS,CAAA,SAAA,GAAuC,KAAK,CAAC;AAEjG;;;AAGG;QACyC,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;AAE9D;;;AAGG;QACyC,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AA8CrD,QAAA,IAAA,CAAA,qBAAqB,GAAG,CAAC,KAAoB,KAAI;AACvD,YAAA,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;gBAC1D,KAAK,CAAC,eAAe,EAAE,CAAC;AACxB,g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E;AACT,QAAA,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;AAC9B,QAAA,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;AACnC,KAAA;AACD,IAAA,YAAY,EAAE;AACZ,QAAA,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;AAC9B,QAAA,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE;AAClC,KAAA;IACD,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;AAC3C,CAAA,CAAC,CAAC;AAEH;AACAA,qCAAmB,CAAC,kBAAkB,EAAE;AACtC,IAAA,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACxD,IAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;AAC3B,CAAA,CAAC,CAAC;AAEH;AACAA,qCAAmB,CAAC,qBAAqB,EAAE;AACzC,IAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC3C,IAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;AAC3B,CAAA,CAAC,CAAC;AAEHA,qCAAmB,CAAC,qBAAqB,EAAE;AACzC,IAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC3C,IAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;AAC3B,CAAA,CAAC;;;;;"}
|
|
1
|
+
{"version":3,"file":"sgds-drawer.cjs.js","sources":["../../../../src/components/Drawer/sgds-drawer.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property, query } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { animateTo, stopAnimations } from \"../../utils/animate.js\";\nimport { getAnimation, setDefaultAnimation } from \"../../utils/animation-registry.js\";\nimport { waitForEvent } from \"../../utils/event.js\";\nimport { lockBodyScrolling, unlockBodyScrolling } from \"../../utils/scroll.js\";\nimport { watch } from \"../../utils/watch.js\";\nimport drawerStyles from \"./drawer.css\";\nimport SgdsCloseButton from \"../../internals/CloseButton/sgds-close-button\";\n\n/**\n * @summary Drawers slide in from a container to expose additional options and information.\n *\n * @slot default - The drawer's main content\n * @slot title - The title of the drawer\n * @slot description - The description of the drawer\n *\n * @event sgds-show - Emitted when the drawer opens.\n * @event sgds-after-show - Emitted after the drawer opens and all animations are complete.\n * @event sgds-hide - Emitted when the drawer closes.\n * @event sgds-after-hide - Emitted after the drawer closes and all animations are complete.\n * @event sgds-initial-focus - Emitted when the drawer opens and is ready to receive focus. Calling\n * `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.\n * @event {{ source: 'close-button' | 'keyboard' | 'overlay' }} sgds-request-close - Emitted when the user attempts to\n * close the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling\n * `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in\n * destructive behavior such as data loss.\n *\n */\nexport class SgdsDrawer extends SgdsElement {\n static styles = [...SgdsElement.styles, drawerStyles];\n /**@internal */\n static dependencies = {\n \"sgds-close-button\": SgdsCloseButton\n };\n\n /** @internal */\n private originalTrigger: HTMLElement | null;\n /** @internal */\n @query(\".drawer\") drawer: HTMLElement;\n /** @internal */\n @query(\".drawer-panel\") panel: HTMLElement;\n /** @internal */\n @query(\".drawer-overlay\") overlay: HTMLElement;\n\n /**\n * Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\n * use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n */\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** The direction from which the drawer will open. */\n @property({ type: String, reflect: true }) placement: \"top\" | \"end\" | \"bottom\" | \"start\" = \"end\";\n\n /**\n * By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\n * its parent element, set this attribute and add `position: relative` to the parent.\n */\n @property({ type: Boolean, reflect: true }) contained = false;\n\n firstUpdated() {\n this.drawer.hidden = !this.open;\n\n if (this.open) {\n this.addOpenListeners();\n\n if (!this.contained) {\n lockBodyScrolling(this);\n }\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n unlockBodyScrolling(this);\n }\n\n private uppercaseFirstLetter(string: string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n }\n\n private requestClose(source: \"close-button\" | \"keyboard\" | \"overlay\") {\n const slRequestClose = this.emit(\"sgds-request-close\", {\n cancelable: true,\n detail: { source }\n });\n\n if (slRequestClose.defaultPrevented) {\n const animation = getAnimation(this, \"drawer.denyClose\");\n animateTo(this.panel, animation.keyframes, animation.options);\n return;\n }\n\n this.hide();\n }\n\n private addOpenListeners() {\n document.addEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n private removeOpenListeners() {\n document.removeEventListener(\"keydown\", this.handleDocumentKeyDown);\n }\n\n private handleDocumentKeyDown = (event: KeyboardEvent) => {\n if (this.open && !this.contained && event.key === \"Escape\") {\n event.stopPropagation();\n this.requestClose(\"keyboard\");\n }\n };\n\n @watch(\"open\", { waitUntilFirstUpdate: true })\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.emit(\"sgds-show\");\n this.addOpenListeners();\n this.originalTrigger = document.activeElement as HTMLElement;\n\n // Lock body scrolling only if the drawer isn't contained\n if (!this.contained) {\n lockBodyScrolling(this);\n }\n\n // When the drawer is shown, Safari will attempt to set focus on whatever element has autofocus. This causes the\n // drawer's animation to jitter, so we'll temporarily remove the attribute, call `focus({ preventScroll: true })`\n // ourselves, and add the attribute back afterwards.\n //\n // Related: https://github.com/shoelace-style/shoelace/issues/693\n //\n const autoFocusTarget = this.querySelector(\"[autofocus]\");\n if (autoFocusTarget) {\n autoFocusTarget.removeAttribute(\"autofocus\");\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n this.drawer.hidden = false;\n\n // Set initial focus\n requestAnimationFrame(() => {\n const slInitialFocus = this.emit(\"sgds-initial-focus\", { cancelable: true });\n\n if (!slInitialFocus.defaultPrevented) {\n // Set focus to the autofocus target and restore the attribute\n if (autoFocusTarget) {\n (autoFocusTarget as HTMLInputElement).focus({ preventScroll: true });\n } else {\n this.panel.focus({ preventScroll: true });\n }\n }\n\n // Restore the autofocus attribute\n if (autoFocusTarget) {\n autoFocusTarget.setAttribute(\"autofocus\", \"\");\n }\n });\n\n const panelAnimation = getAnimation(this, `drawer.show${this.uppercaseFirstLetter(this.placement)}`);\n const overlayAnimation = getAnimation(this, \"drawer.overlay.show\");\n await Promise.all([\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)\n ]);\n\n this.emit(\"sgds-after-show\");\n } else {\n // Hide\n this.emit(\"sgds-hide\");\n this.removeOpenListeners();\n\n if (!this.contained) {\n unlockBodyScrolling(this);\n }\n\n await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);\n const panelAnimation = getAnimation(this, `drawer.hide${this.uppercaseFirstLetter(this.placement)}`);\n const overlayAnimation = getAnimation(this, \"drawer.overlay.hide\");\n\n // Animate the overlay and the panel at the same time. Because animation durations might be different, we need to\n // hide each one individually when the animation finishes, otherwise the first one that finishes will reappear\n // unexpectedly. We'll unhide them after all animations have completed.\n await Promise.all([\n animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {\n this.overlay.hidden = true;\n }),\n animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {\n this.panel.hidden = true;\n })\n ]);\n\n this.drawer.hidden = true;\n\n // Now that the dialog is hidden, restore the overlay and panel for next time\n this.overlay.hidden = false;\n this.panel.hidden = false;\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (typeof trigger?.focus === \"function\") {\n setTimeout(() => trigger.focus());\n }\n\n this.emit(\"sgds-after-hide\");\n }\n }\n\n @watch(\"contained\", { waitUntilFirstUpdate: true })\n handleNoModalChange() {\n if (this.open && !this.contained) {\n lockBodyScrolling(this);\n }\n\n if (this.open && this.contained) {\n unlockBodyScrolling(this);\n }\n }\n\n /** Shows the drawer. */\n public async show() {\n if (this.open) {\n return undefined;\n }\n\n this.open = true;\n return waitForEvent(this, \"sgds-after-show\");\n }\n\n /** Hides the drawer */\n public async hide() {\n if (!this.open) {\n return undefined;\n }\n\n this.open = false;\n return waitForEvent(this, \"sgds-after-hide\");\n }\n\n render() {\n return html`\n <div\n class=${classMap({\n drawer: true,\n \"drawer-open\": this.open,\n \"drawer-top\": this.placement === \"top\",\n \"drawer-end\": this.placement === \"end\",\n \"drawer-bottom\": this.placement === \"bottom\",\n \"drawer-start\": this.placement === \"start\",\n \"drawer-contained\": this.contained,\n \"drawer-fixed\": !this.contained\n })}\n >\n <div class=\"drawer-overlay\" @click=${() => this.requestClose(\"overlay\")} tabindex=\"-1\"></div>\n\n <div\n class=\"drawer-panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden=${this.open ? \"false\" : \"true\"}\n tabindex=\"0\"\n >\n <header class=\"drawer-header\">\n <slot name=\"title\"></slot>\n <slot name=\"description\"></slot>\n <sgds-close-button\n class=\"drawer-close\"\n aria-label=\"close drawer\"\n @click=\"${() => this.requestClose(\"close-button\")}\"\n ></sgds-close-button>\n </header>\n <slot class=\"drawer-body\"></slot>\n </div>\n </div>\n `;\n }\n}\n\n// Top\nsetDefaultAnimation(\"drawer.showTop\", {\n keyframes: [\n { opacity: 0, translate: \"0 -100%\" },\n { opacity: 1, translate: \"0 0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideTop\", {\n keyframes: [\n { opacity: 1, translate: \"0 0\" },\n { opacity: 0, translate: \"0 -100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// End\nsetDefaultAnimation(\"drawer.showEnd\", {\n keyframes: [\n { opacity: 0, translate: \"100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: \"-100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideEnd\", {\n keyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"100%\" }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"-100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// Bottom\nsetDefaultAnimation(\"drawer.showBottom\", {\n keyframes: [\n { opacity: 0, translate: \"0 100%\" },\n { opacity: 1, translate: \"0 0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideBottom\", {\n keyframes: [\n { opacity: 1, translate: \"0 0\" },\n { opacity: 0, translate: \"0 100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// Start\nsetDefaultAnimation(\"drawer.showStart\", {\n keyframes: [\n { opacity: 0, translate: \"-100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n rtlKeyframes: [\n { opacity: 0, translate: \"100%\" },\n { opacity: 1, translate: \"0\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\nsetDefaultAnimation(\"drawer.hideStart\", {\n keyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"-100%\" }\n ],\n rtlKeyframes: [\n { opacity: 1, translate: \"0\" },\n { opacity: 0, translate: \"100%\" }\n ],\n options: { duration: 250, easing: \"ease\" }\n});\n\n// Deny close\nsetDefaultAnimation(\"drawer.denyClose\", {\n keyframes: [{ scale: 1 }, { scale: 1.01 }, { scale: 1 }],\n options: { duration: 250 }\n});\n\n// Overlay\nsetDefaultAnimation(\"drawer.overlay.show\", {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n options: { duration: 250 }\n});\n\nsetDefaultAnimation(\"drawer.overlay.hide\", {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n options: { duration: 250 }\n});\n\nexport default SgdsDrawer;\n"],"names":["SgdsElement","lockBodyScrolling","unlockBodyScrolling","getAnimation","animateTo","stopAnimations","waitForEvent","html","classMap","drawerStyles","SgdsCloseButton","__decorate","query","property","watch","setDefaultAnimation"],"mappings":";;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;AAkBG;AACG,MAAO,UAAW,SAAQA,sBAAW,CAAA;AAA3C,IAAA,WAAA,GAAA;;AAgBE;;;AAGG;QACyC,IAAI,CAAA,IAAA,GAAG,KAAK,CAAC;;QAGd,IAAS,CAAA,SAAA,GAAuC,KAAK,CAAC;AAEjG;;;AAGG;QACyC,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;AA8CtD,QAAA,IAAA,CAAA,qBAAqB,GAAG,CAAC,KAAoB,KAAI;AACvD,YAAA,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;gBAC1D,KAAK,CAAC,eAAe,EAAE,CAAC;AACxB,gBAAA,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;aAC/B;AACH,SAAC,CAAC;KAqKH;IAtNC,YAAY,GAAA;QACV,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;AAEhC,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,gBAAgB,EAAE,CAAC;AAExB,YAAA,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnBC,wBAAiB,CAAC,IAAI,CAAC,CAAC;aACzB;SACF;KACF;IAED,oBAAoB,GAAA;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7BC,0BAAm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C9B,QAAA,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;AACnC,KAAA;AACD,IAAA,YAAY,EAAE;AACZ,QAAA,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE;AAC9B,QAAA,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE;AAClC,KAAA;IACD,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE;AAC3C,CAAA,CAAC,CAAC;AAEH;AACAA,qCAAmB,CAAC,kBAAkB,EAAE;AACtC,IAAA,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AACxD,IAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;AAC3B,CAAA,CAAC,CAAC;AAEH;AACAA,qCAAmB,CAAC,qBAAqB,EAAE;AACzC,IAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC3C,IAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;AAC3B,CAAA,CAAC,CAAC;AAEHA,qCAAmB,CAAC,qBAAqB,EAAE;AACzC,IAAA,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC3C,IAAA,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE;AAC3B,CAAA,CAAC;;;;;"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __decorate } from 'tslib';
|
|
3
|
-
import { html
|
|
3
|
+
import { html } from 'lit';
|
|
4
4
|
import { query, property } from 'lit/decorators.js';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
7
6
|
import SgdsElement from '../../base/sgds-element.js';
|
|
8
7
|
import { animateTo, stopAnimations } from '../../utils/animate.js';
|
|
9
8
|
import { setDefaultAnimation, getAnimation } from '../../utils/animation-registry.js';
|
|
10
9
|
import { waitForEvent } from '../../utils/event.js';
|
|
11
10
|
import { lockBodyScrolling, unlockBodyScrolling } from '../../utils/scroll.js';
|
|
12
|
-
import { HasSlotController } from '../../utils/slot.js';
|
|
13
11
|
import { watch } from '../../utils/watch.js';
|
|
14
12
|
import css_248z from './drawer.js';
|
|
15
13
|
import { SgdsCloseButton } from '../../internals/CloseButton/sgds-close-button.js';
|
|
@@ -17,10 +15,9 @@ import { SgdsCloseButton } from '../../internals/CloseButton/sgds-close-button.j
|
|
|
17
15
|
/**
|
|
18
16
|
* @summary Drawers slide in from a container to expose additional options and information.
|
|
19
17
|
*
|
|
20
|
-
* @slot - The drawer's main content
|
|
21
|
-
* @slot
|
|
22
|
-
* @slot
|
|
23
|
-
* @slot footer - The drawer's footer, usually one or more buttons representing various options.
|
|
18
|
+
* @slot default - The drawer's main content
|
|
19
|
+
* @slot title - The title of the drawer
|
|
20
|
+
* @slot description - The description of the drawer
|
|
24
21
|
*
|
|
25
22
|
* @event sgds-show - Emitted when the drawer opens.
|
|
26
23
|
* @event sgds-after-show - Emitted after the drawer opens and all animations are complete.
|
|
@@ -33,38 +30,15 @@ import { SgdsCloseButton } from '../../internals/CloseButton/sgds-close-button.j
|
|
|
33
30
|
* `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in
|
|
34
31
|
* destructive behavior such as data loss.
|
|
35
32
|
*
|
|
36
|
-
* @csspart base - The component's base wrapper.
|
|
37
|
-
* @csspart overlay - The overlay that covers the screen behind the drawer.
|
|
38
|
-
* @csspart panel - The drawer's panel (where the drawer and its content are rendered).
|
|
39
|
-
* @csspart header - The drawer's header. This element wraps the title and header actions.
|
|
40
|
-
* @csspart header-actions - Optional actions to add to the header.
|
|
41
|
-
* @csspart title - The drawer's title.
|
|
42
|
-
* @csspart close-button - The close button.
|
|
43
|
-
* @csspart body - The drawer's body.
|
|
44
|
-
* @csspart footer - The drawer's footer.
|
|
45
|
-
*
|
|
46
|
-
* @cssproperty --drawer-size - The preferred size of the drawer. This will be applied to the drawer's width or height
|
|
47
|
-
* depending on its `placement`. Note that the drawer will shrink to accommodate smaller screens.
|
|
48
|
-
* @cssproperty --drawer-padding - The amount of padding to use for the header, body and footer
|
|
49
|
-
* @cssproperty --drawer-bg - The drawer's background color.
|
|
50
|
-
* @cssproperty --drawer-button-gap - The drawer's flex gap between buttons.
|
|
51
|
-
*
|
|
52
33
|
*/
|
|
53
34
|
class SgdsDrawer extends SgdsElement {
|
|
54
35
|
constructor() {
|
|
55
36
|
super(...arguments);
|
|
56
|
-
/** @internal */
|
|
57
|
-
this.hasSlotController = new HasSlotController(this, "footer");
|
|
58
37
|
/**
|
|
59
38
|
* Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can
|
|
60
39
|
* use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.
|
|
61
40
|
*/
|
|
62
41
|
this.open = false;
|
|
63
|
-
/**
|
|
64
|
-
* The drawer's label as displayed in the header. You should always include a relevant label even when using
|
|
65
|
-
* `noHeader`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.
|
|
66
|
-
*/
|
|
67
|
-
this.label = "";
|
|
68
42
|
/** The direction from which the drawer will open. */
|
|
69
43
|
this.placement = "end";
|
|
70
44
|
/**
|
|
@@ -72,11 +46,6 @@ class SgdsDrawer extends SgdsElement {
|
|
|
72
46
|
* its parent element, set this attribute and add `position: relative` to the parent.
|
|
73
47
|
*/
|
|
74
48
|
this.contained = false;
|
|
75
|
-
/**
|
|
76
|
-
* Removes the header. This will also remove the default close button, so please ensure you provide an easy,
|
|
77
|
-
* accessible way for users to dismiss the drawer.
|
|
78
|
-
*/
|
|
79
|
-
this.noHeader = false;
|
|
80
49
|
this.handleDocumentKeyDown = (event) => {
|
|
81
50
|
if (this.open && !this.contained && event.key === "Escape") {
|
|
82
51
|
event.stopPropagation();
|
|
@@ -225,7 +194,6 @@ class SgdsDrawer extends SgdsElement {
|
|
|
225
194
|
render() {
|
|
226
195
|
return html `
|
|
227
196
|
<div
|
|
228
|
-
part="base"
|
|
229
197
|
class=${classMap({
|
|
230
198
|
drawer: true,
|
|
231
199
|
"drawer-open": this.open,
|
|
@@ -234,47 +202,28 @@ class SgdsDrawer extends SgdsElement {
|
|
|
234
202
|
"drawer-bottom": this.placement === "bottom",
|
|
235
203
|
"drawer-start": this.placement === "start",
|
|
236
204
|
"drawer-contained": this.contained,
|
|
237
|
-
"drawer-fixed": !this.contained
|
|
238
|
-
"drawer-has-footer": this.hasSlotController.test("footer")
|
|
205
|
+
"drawer-fixed": !this.contained
|
|
239
206
|
})}
|
|
240
207
|
>
|
|
241
|
-
<div
|
|
208
|
+
<div class="drawer-overlay" @click=${() => this.requestClose("overlay")} tabindex="-1"></div>
|
|
242
209
|
|
|
243
210
|
<div
|
|
244
|
-
part="panel"
|
|
245
211
|
class="drawer-panel"
|
|
246
212
|
role="dialog"
|
|
247
213
|
aria-modal="true"
|
|
248
214
|
aria-hidden=${this.open ? "false" : "true"}
|
|
249
|
-
aria-label=${ifDefined(this.noHeader ? this.label : undefined)}
|
|
250
|
-
aria-labelledby=${ifDefined(!this.noHeader ? "title" : undefined)}
|
|
251
215
|
tabindex="0"
|
|
252
216
|
>
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
part="close-button"
|
|
264
|
-
class="drawer-close"
|
|
265
|
-
aria-label="close drawer"
|
|
266
|
-
@click="${() => this.requestClose("close-button")}"
|
|
267
|
-
></sgds-close-button>
|
|
268
|
-
</div>
|
|
269
|
-
</header>
|
|
270
|
-
`
|
|
271
|
-
: nothing}
|
|
272
|
-
|
|
273
|
-
<slot part="body" class="drawer-body"></slot>
|
|
274
|
-
|
|
275
|
-
<footer part="footer" class="drawer-footer">
|
|
276
|
-
<slot name="footer"></slot>
|
|
277
|
-
</footer>
|
|
217
|
+
<header class="drawer-header">
|
|
218
|
+
<slot name="title"></slot>
|
|
219
|
+
<slot name="description"></slot>
|
|
220
|
+
<sgds-close-button
|
|
221
|
+
class="drawer-close"
|
|
222
|
+
aria-label="close drawer"
|
|
223
|
+
@click="${() => this.requestClose("close-button")}"
|
|
224
|
+
></sgds-close-button>
|
|
225
|
+
</header>
|
|
226
|
+
<slot class="drawer-body"></slot>
|
|
278
227
|
</div>
|
|
279
228
|
</div>
|
|
280
229
|
`;
|
|
@@ -297,18 +246,12 @@ __decorate([
|
|
|
297
246
|
__decorate([
|
|
298
247
|
property({ type: Boolean, reflect: true })
|
|
299
248
|
], SgdsDrawer.prototype, "open", void 0);
|
|
300
|
-
__decorate([
|
|
301
|
-
property({ type: String, reflect: true })
|
|
302
|
-
], SgdsDrawer.prototype, "label", void 0);
|
|
303
249
|
__decorate([
|
|
304
250
|
property({ type: String, reflect: true })
|
|
305
251
|
], SgdsDrawer.prototype, "placement", void 0);
|
|
306
252
|
__decorate([
|
|
307
253
|
property({ type: Boolean, reflect: true })
|
|
308
254
|
], SgdsDrawer.prototype, "contained", void 0);
|
|
309
|
-
__decorate([
|
|
310
|
-
property({ type: Boolean, reflect: true })
|
|
311
|
-
], SgdsDrawer.prototype, "noHeader", void 0);
|
|
312
255
|
__decorate([
|
|
313
256
|
watch("open", { waitUntilFirstUpdate: true })
|
|
314
257
|
], SgdsDrawer.prototype, "handleOpenChange", null);
|