@carbon/web-components 2.0.0-rc.2 → 2.0.0-rc.3
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/custom-elements.json +267 -52
- package/es/components/accordion/accordion-item.d.ts.map +1 -1
- package/es/components/accordion/accordion-item.js +3 -2
- package/es/components/accordion/accordion-item.js.map +1 -1
- package/es/components/accordion/accordion-skeleton.js.map +1 -1
- package/es/components/accordion/accordion.css.js +1 -1
- package/es/components/accordion/accordion.d.ts.map +1 -1
- package/es/components/accordion/accordion.js +2 -1
- package/es/components/accordion/accordion.js.map +1 -1
- package/es/components/accordion/accordion.rtl.css.js +1 -1
- package/es/components/accordion/defs.d.ts +1 -1
- package/es/components/accordion/defs.d.ts.map +1 -1
- package/es/components/accordion/defs.js +1 -1
- package/es/components/accordion/defs.js.map +1 -1
- package/es/components/accordion/index.d.ts +1 -1
- package/es/components/accordion/index.d.ts.map +1 -1
- package/es/components/accordion/index.js +1 -1
- package/es/components/accordion/index.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb-item.d.ts.map +1 -1
- package/es/components/breadcrumb/breadcrumb-item.js +2 -6
- package/es/components/breadcrumb/breadcrumb-item.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb-link.d.ts.map +1 -1
- package/es/components/breadcrumb/breadcrumb-link.js +2 -6
- package/es/components/breadcrumb/breadcrumb-link.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb-overflow-menu.d.ts.map +1 -1
- package/es/components/breadcrumb/breadcrumb-overflow-menu.js +2 -6
- package/es/components/breadcrumb/breadcrumb-overflow-menu.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb-skeleton.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb.css.js +1 -1
- package/es/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/es/components/breadcrumb/breadcrumb.js +3 -6
- package/es/components/breadcrumb/breadcrumb.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb.rtl.css.js +1 -1
- package/es/components/breadcrumb/index.d.ts +1 -1
- package/es/components/breadcrumb/index.d.ts.map +1 -1
- package/es/components/breadcrumb/index.js +1 -1
- package/es/components/breadcrumb/index.js.map +1 -1
- package/es/components/button/button-set.js.map +1 -1
- package/es/components/button/button-skeleton.d.ts.map +1 -1
- package/es/components/button/button-skeleton.js +2 -4
- package/es/components/button/button-skeleton.js.map +1 -1
- package/es/components/button/button.css.js +1 -1
- package/es/components/button/button.d.ts.map +1 -1
- package/es/components/button/button.js +4 -2
- package/es/components/button/button.js.map +1 -1
- package/es/components/button/button.rtl.css.js +1 -1
- package/es/components/button/defs.d.ts +1 -1
- package/es/components/button/defs.d.ts.map +1 -1
- package/es/components/button/defs.js +1 -1
- package/es/components/button/defs.js.map +1 -1
- package/es/components/button/index.d.ts +1 -1
- package/es/components/button/index.d.ts.map +1 -1
- package/es/components/button/index.js +1 -1
- package/es/components/button/index.js.map +1 -1
- package/es/components/checkbox/checkbox.css.js +1 -1
- package/es/components/checkbox/checkbox.d.ts.map +1 -1
- package/es/components/checkbox/checkbox.js +3 -9
- package/es/components/checkbox/checkbox.js.map +1 -1
- package/es/components/checkbox/checkbox.rtl.css.js +1 -1
- package/es/components/checkbox/index.d.ts +1 -1
- package/es/components/checkbox/index.d.ts.map +1 -1
- package/es/components/checkbox/index.js +1 -1
- package/es/components/checkbox/index.js.map +1 -1
- package/es/components/code-snippet/code-snippet-skeleton.d.ts.map +1 -1
- package/es/components/code-snippet/code-snippet-skeleton.js +3 -4
- package/es/components/code-snippet/code-snippet-skeleton.js.map +1 -1
- package/es/components/code-snippet/code-snippet.css.js +1 -1
- package/es/components/code-snippet/code-snippet.d.ts.map +1 -1
- package/es/components/code-snippet/code-snippet.js +2 -1
- package/es/components/code-snippet/code-snippet.js.map +1 -1
- package/es/components/code-snippet/code-snippet.rtl.css.js +1 -1
- package/es/components/code-snippet/defs.d.ts +1 -1
- package/es/components/code-snippet/defs.d.ts.map +1 -1
- package/es/components/code-snippet/defs.js +1 -1
- package/es/components/code-snippet/defs.js.map +1 -1
- package/es/components/code-snippet/index.d.ts +1 -1
- package/es/components/code-snippet/index.d.ts.map +1 -1
- package/es/components/code-snippet/index.js +1 -1
- package/es/components/code-snippet/index.js.map +1 -1
- package/es/components/combo-box/combo-box-item.d.ts.map +1 -1
- package/es/components/combo-box/combo-box-item.js +2 -6
- package/es/components/combo-box/combo-box-item.js.map +1 -1
- package/es/components/combo-box/combo-box.css.js +1 -1
- package/es/components/combo-box/combo-box.d.ts.map +1 -1
- package/es/components/combo-box/combo-box.js +2 -1
- package/es/components/combo-box/combo-box.js.map +1 -1
- package/es/components/combo-box/combo-box.rtl.css.js +1 -1
- package/es/components/combo-box/index.d.ts +1 -1
- package/es/components/combo-box/index.d.ts.map +1 -1
- package/es/components/combo-box/index.js +1 -1
- package/es/components/combo-box/index.js.map +1 -1
- package/es/components/content-switcher/content-switcher-item.d.ts.map +1 -1
- package/es/components/content-switcher/content-switcher-item.js +3 -6
- package/es/components/content-switcher/content-switcher-item.js.map +1 -1
- package/es/components/content-switcher/content-switcher.css.js +1 -1
- package/es/components/content-switcher/content-switcher.d.ts.map +1 -1
- package/es/components/content-switcher/content-switcher.js +2 -1
- package/es/components/content-switcher/content-switcher.js.map +1 -1
- package/es/components/content-switcher/content-switcher.rtl.css.js +1 -1
- package/es/components/content-switcher/defs.d.ts +1 -1
- package/es/components/content-switcher/defs.d.ts.map +1 -1
- package/es/components/content-switcher/defs.js +1 -1
- package/es/components/content-switcher/defs.js.map +1 -1
- package/es/components/content-switcher/index.d.ts +1 -1
- package/es/components/content-switcher/index.d.ts.map +1 -1
- package/es/components/content-switcher/index.js +1 -1
- package/es/components/content-switcher/index.js.map +1 -1
- package/es/components/copy/copy.js.map +1 -1
- package/es/components/copy-button/copy-button.css.js +1 -1
- package/es/components/copy-button/copy-button.js.map +1 -1
- package/es/components/copy-button/copy-button.rtl.css.js +1 -1
- package/es/components/copy-button/index.d.ts +1 -1
- package/es/components/copy-button/index.d.ts.map +1 -1
- package/es/components/copy-button/index.js +1 -1
- package/es/components/copy-button/index.js.map +1 -1
- package/es/components/data-table/data-table.css.js +1 -1
- package/es/components/data-table/data-table.rtl.css.js +1 -1
- package/es/components/data-table/index.d.ts +1 -1
- package/es/components/data-table/index.d.ts.map +1 -1
- package/es/components/data-table/index.js +1 -1
- package/es/components/data-table/index.js.map +1 -1
- package/es/components/data-table/table-batch-actions.d.ts.map +1 -1
- package/es/components/data-table/table-batch-actions.js +3 -7
- package/es/components/data-table/table-batch-actions.js.map +1 -1
- package/es/components/data-table/table-body.d.ts.map +1 -1
- package/es/components/data-table/table-body.js +3 -6
- package/es/components/data-table/table-body.js.map +1 -1
- package/es/components/data-table/table-cell.d.ts.map +1 -1
- package/es/components/data-table/table-cell.js +3 -7
- package/es/components/data-table/table-cell.js.map +1 -1
- package/es/components/data-table/table-expanded-row.d.ts.map +1 -1
- package/es/components/data-table/table-expanded-row.js +2 -1
- package/es/components/data-table/table-expanded-row.js.map +1 -1
- package/es/components/data-table/table-head.d.ts.map +1 -1
- package/es/components/data-table/table-head.js +2 -6
- package/es/components/data-table/table-head.js.map +1 -1
- package/es/components/data-table/table-header-cell.d.ts.map +1 -1
- package/es/components/data-table/table-header-cell.js +2 -1
- package/es/components/data-table/table-header-cell.js.map +1 -1
- package/es/components/data-table/table-header-row.d.ts.map +1 -1
- package/es/components/data-table/table-header-row.js +1 -1
- package/es/components/data-table/table-header-row.js.map +1 -1
- package/es/components/data-table/table-row.d.ts.map +1 -1
- package/es/components/data-table/table-row.js +3 -2
- package/es/components/data-table/table-row.js.map +1 -1
- package/es/components/data-table/table-skeleton.js.map +1 -1
- package/es/components/data-table/table-toolbar-content.d.ts.map +1 -1
- package/es/components/data-table/table-toolbar-content.js +4 -7
- package/es/components/data-table/table-toolbar-content.js.map +1 -1
- package/es/components/data-table/table-toolbar-search.d.ts.map +1 -1
- package/es/components/data-table/table-toolbar-search.js +3 -7
- package/es/components/data-table/table-toolbar-search.js.map +1 -1
- package/es/components/data-table/table-toolbar.d.ts +0 -8
- package/es/components/data-table/table-toolbar.d.ts.map +1 -1
- package/es/components/data-table/table-toolbar.js +3 -30
- package/es/components/data-table/table-toolbar.js.map +1 -1
- package/es/components/data-table/table.d.ts.map +1 -1
- package/es/components/data-table/table.js +3 -3
- package/es/components/data-table/table.js.map +1 -1
- package/es/components/date-picker/append-to-plugin.js.map +1 -1
- package/es/components/date-picker/css-class-plugin.js.map +1 -1
- package/es/components/date-picker/date-picker-input-skeleton.d.ts.map +1 -1
- package/es/components/date-picker/date-picker-input-skeleton.js +3 -4
- package/es/components/date-picker/date-picker-input-skeleton.js.map +1 -1
- package/es/components/date-picker/date-picker-input.d.ts.map +1 -1
- package/es/components/date-picker/date-picker-input.js +2 -1
- package/es/components/date-picker/date-picker-input.js.map +1 -1
- package/es/components/date-picker/date-picker.css.js +1 -1
- package/es/components/date-picker/date-picker.d.ts.map +1 -1
- package/es/components/date-picker/date-picker.js +7 -4
- package/es/components/date-picker/date-picker.js.map +1 -1
- package/es/components/date-picker/date-picker.rtl.css.js +1 -1
- package/es/components/date-picker/defs.d.ts +1 -1
- package/es/components/date-picker/defs.d.ts.map +1 -1
- package/es/components/date-picker/defs.js +1 -1
- package/es/components/date-picker/defs.js.map +1 -1
- package/es/components/date-picker/fix-events-plugin.js +9 -0
- package/es/components/date-picker/fix-events-plugin.js.map +1 -1
- package/es/components/date-picker/focus-plugin.d.ts.map +1 -1
- package/es/components/date-picker/focus-plugin.js +14 -4
- package/es/components/date-picker/focus-plugin.js.map +1 -1
- package/es/components/date-picker/icon-plugin.js.map +1 -1
- package/es/components/date-picker/index.d.ts +1 -1
- package/es/components/date-picker/index.d.ts.map +1 -1
- package/es/components/date-picker/index.js +1 -1
- package/es/components/date-picker/index.js.map +1 -1
- package/es/components/date-picker/iso-date.js.map +1 -1
- package/es/components/date-picker/month-select-plugin.js.map +1 -1
- package/es/components/date-picker/range-plugin.d.ts +21 -6
- package/es/components/date-picker/range-plugin.d.ts.map +1 -1
- package/es/components/date-picker/range-plugin.js +51 -17
- package/es/components/date-picker/range-plugin.js.map +1 -1
- package/es/components/date-picker/shadow-dom-events-plugin.js.map +1 -1
- package/es/components/date-picker/state-handshake-plugin.js.map +1 -1
- package/es/components/dropdown/defs.d.ts +1 -1
- package/es/components/dropdown/defs.d.ts.map +1 -1
- package/es/components/dropdown/defs.js +1 -1
- package/es/components/dropdown/defs.js.map +1 -1
- package/es/components/dropdown/dropdown-item.d.ts.map +1 -1
- package/es/components/dropdown/dropdown-item.js +3 -7
- package/es/components/dropdown/dropdown-item.js.map +1 -1
- package/es/components/dropdown/dropdown-skeleton.d.ts.map +1 -1
- package/es/components/dropdown/dropdown-skeleton.js +2 -4
- package/es/components/dropdown/dropdown-skeleton.js.map +1 -1
- package/es/components/dropdown/dropdown.css.js +1 -1
- package/es/components/dropdown/dropdown.d.ts +1 -3
- package/es/components/dropdown/dropdown.d.ts.map +1 -1
- package/es/components/dropdown/dropdown.js +2 -1
- package/es/components/dropdown/dropdown.js.map +1 -1
- package/es/components/dropdown/dropdown.rtl.css.js +1 -1
- package/es/components/dropdown/index.d.ts +1 -1
- package/es/components/dropdown/index.d.ts.map +1 -1
- package/es/components/dropdown/index.js +1 -1
- package/es/components/dropdown/index.js.map +1 -1
- package/es/components/file-uploader/defs.d.ts +1 -1
- package/es/components/file-uploader/defs.d.ts.map +1 -1
- package/es/components/file-uploader/defs.js +1 -1
- package/es/components/file-uploader/defs.js.map +1 -1
- package/es/components/file-uploader/demo-file-uploader.js.map +1 -1
- package/es/components/file-uploader/file-uploader-button.d.ts.map +1 -1
- package/es/components/file-uploader/file-uploader-button.js +1 -0
- package/es/components/file-uploader/file-uploader-button.js.map +1 -1
- package/es/components/file-uploader/file-uploader-drop-container.d.ts.map +1 -1
- package/es/components/file-uploader/file-uploader-drop-container.js +2 -1
- package/es/components/file-uploader/file-uploader-drop-container.js.map +1 -1
- package/es/components/file-uploader/file-uploader-item.d.ts.map +1 -1
- package/es/components/file-uploader/file-uploader-item.js +2 -1
- package/es/components/file-uploader/file-uploader-item.js.map +1 -1
- package/es/components/file-uploader/file-uploader.css.js +1 -1
- package/es/components/file-uploader/file-uploader.d.ts.map +1 -1
- package/es/components/file-uploader/file-uploader.js +3 -8
- package/es/components/file-uploader/file-uploader.js.map +1 -1
- package/es/components/file-uploader/file-uploader.rtl.css.js +1 -1
- package/es/components/file-uploader/index.d.ts +1 -1
- package/es/components/file-uploader/index.d.ts.map +1 -1
- package/es/components/file-uploader/index.js +1 -1
- package/es/components/file-uploader/index.js.map +1 -1
- package/es/components/floating-menu/defs.d.ts +1 -1
- package/es/components/floating-menu/defs.d.ts.map +1 -1
- package/es/components/floating-menu/defs.js +1 -1
- package/es/components/floating-menu/defs.js.map +1 -1
- package/es/components/floating-menu/floating-menu-trigger.d.ts +1 -1
- package/es/components/floating-menu/floating-menu-trigger.d.ts.map +1 -1
- package/es/components/floating-menu/floating-menu.js +9 -2
- package/es/components/floating-menu/floating-menu.js.map +1 -1
- package/es/components/floating-menu/index.d.ts +1 -1
- package/es/components/floating-menu/index.d.ts.map +1 -1
- package/es/components/floating-menu/index.js +1 -1
- package/es/components/floating-menu/index.js.map +1 -1
- package/es/components/form/form-item.css.js +1 -1
- package/es/components/form/form-item.d.ts.map +1 -1
- package/es/components/form/form-item.js +2 -6
- package/es/components/form/form-item.js.map +1 -1
- package/es/components/form/form-item.rtl.css.js +1 -1
- package/es/components/form/index.d.ts +1 -1
- package/es/components/form/index.d.ts.map +1 -1
- package/es/components/form/index.js +1 -1
- package/es/components/form/index.js.map +1 -1
- package/es/components/form-group/form-group.css.js +1 -1
- package/es/components/form-group/form-group.rtl.css.js +1 -1
- package/es/components/icon-button/icon-button.css.js +1 -1
- package/es/components/icon-button/icon-button.js.map +1 -1
- package/es/components/icon-button/icon-button.rtl.css.js +1 -1
- package/es/components/inline-loading/defs.d.ts +1 -1
- package/es/components/inline-loading/defs.d.ts.map +1 -1
- package/es/components/inline-loading/defs.js +1 -1
- package/es/components/inline-loading/defs.js.map +1 -1
- package/es/components/inline-loading/index.d.ts +1 -1
- package/es/components/inline-loading/index.d.ts.map +1 -1
- package/es/components/inline-loading/index.js +1 -1
- package/es/components/inline-loading/index.js.map +1 -1
- package/es/components/inline-loading/inline-loading.css.js +1 -1
- package/es/components/inline-loading/inline-loading.d.ts.map +1 -1
- package/es/components/inline-loading/inline-loading.js +2 -1
- package/es/components/inline-loading/inline-loading.js.map +1 -1
- package/es/components/inline-loading/inline-loading.rtl.css.js +1 -1
- package/es/components/layer/layer.js.map +1 -1
- package/es/components/link/index.d.ts +1 -1
- package/es/components/link/index.d.ts.map +1 -1
- package/es/components/link/index.js +1 -1
- package/es/components/link/index.js.map +1 -1
- package/es/components/link/link.d.ts.map +1 -1
- package/es/components/link/link.js +3 -4
- package/es/components/link/link.js.map +1 -1
- package/es/components/list/index.d.ts +1 -1
- package/es/components/list/index.d.ts.map +1 -1
- package/es/components/list/index.js +1 -1
- package/es/components/list/index.js.map +1 -1
- package/es/components/list/list-item.d.ts.map +1 -1
- package/es/components/list/list-item.js +3 -7
- package/es/components/list/list-item.js.map +1 -1
- package/es/components/list/ordered-list.d.ts.map +1 -1
- package/es/components/list/ordered-list.js +2 -1
- package/es/components/list/ordered-list.js.map +1 -1
- package/es/components/list/unordered-list.d.ts.map +1 -1
- package/es/components/list/unordered-list.js +3 -4
- package/es/components/list/unordered-list.js.map +1 -1
- package/es/components/loading/defs.d.ts +1 -1
- package/es/components/loading/defs.d.ts.map +1 -1
- package/es/components/loading/defs.js +1 -1
- package/es/components/loading/defs.js.map +1 -1
- package/es/components/loading/index.d.ts +1 -1
- package/es/components/loading/index.d.ts.map +1 -1
- package/es/components/loading/index.js +1 -1
- package/es/components/loading/index.js.map +1 -1
- package/es/components/loading/loading.css.js +1 -1
- package/es/components/loading/loading.d.ts.map +1 -1
- package/es/components/loading/loading.js +3 -6
- package/es/components/loading/loading.js.map +1 -1
- package/es/components/loading/loading.rtl.css.js +1 -1
- package/es/components/loading/types.d.ts +1 -1
- package/es/components/loading/types.d.ts.map +1 -1
- package/es/components/loading/types.js +1 -1
- package/es/components/loading/types.js.map +1 -1
- package/es/components/modal/defs.d.ts +1 -1
- package/es/components/modal/defs.d.ts.map +1 -1
- package/es/components/modal/defs.js +1 -1
- package/es/components/modal/defs.js.map +1 -1
- package/es/components/modal/index.d.ts +1 -1
- package/es/components/modal/index.d.ts.map +1 -1
- package/es/components/modal/index.js +1 -1
- package/es/components/modal/index.js.map +1 -1
- package/es/components/modal/modal-body.d.ts.map +1 -1
- package/es/components/modal/modal-body.js +2 -6
- package/es/components/modal/modal-body.js.map +1 -1
- package/es/components/modal/modal-close-button.d.ts.map +1 -1
- package/es/components/modal/modal-close-button.js +3 -8
- package/es/components/modal/modal-close-button.js.map +1 -1
- package/es/components/modal/modal-footer-button.d.ts.map +1 -1
- package/es/components/modal/modal-footer-button.js +2 -6
- package/es/components/modal/modal-footer-button.js.map +1 -1
- package/es/components/modal/modal-footer.d.ts.map +1 -1
- package/es/components/modal/modal-footer.js +3 -6
- package/es/components/modal/modal-footer.js.map +1 -1
- package/es/components/modal/modal-header.d.ts.map +1 -1
- package/es/components/modal/modal-header.js +2 -6
- package/es/components/modal/modal-header.js.map +1 -1
- package/es/components/modal/modal-heading.d.ts.map +1 -1
- package/es/components/modal/modal-heading.js +2 -6
- package/es/components/modal/modal-heading.js.map +1 -1
- package/es/components/modal/modal-label.d.ts.map +1 -1
- package/es/components/modal/modal-label.js +2 -6
- package/es/components/modal/modal-label.js.map +1 -1
- package/es/components/modal/modal.css.js +1 -1
- package/es/components/modal/modal.d.ts.map +1 -1
- package/es/components/modal/modal.js +2 -1
- package/es/components/modal/modal.js.map +1 -1
- package/es/components/modal/modal.rtl.css.js +1 -1
- package/es/components/multi-select/multi-select-item.d.ts.map +1 -1
- package/es/components/multi-select/multi-select-item.js +3 -6
- package/es/components/multi-select/multi-select-item.js.map +1 -1
- package/es/components/multi-select/multi-select.css.js +1 -1
- package/es/components/multi-select/multi-select.d.ts.map +1 -1
- package/es/components/multi-select/multi-select.js +2 -1
- package/es/components/multi-select/multi-select.js.map +1 -1
- package/es/components/multi-select/multi-select.rtl.css.js +1 -1
- package/es/components/notification/actionable-notification-button.js.map +1 -1
- package/es/components/notification/actionable-notification.css.js +1 -1
- package/es/components/notification/actionable-notification.js.map +1 -1
- package/es/components/notification/actionable-notification.rtl.css.js +1 -1
- package/es/components/notification/inline-notification.css.js +1 -1
- package/es/components/notification/inline-notification.d.ts.map +1 -1
- package/es/components/notification/inline-notification.js +2 -1
- package/es/components/notification/inline-notification.js.map +1 -1
- package/es/components/notification/inline-notification.rtl.css.js +1 -1
- package/es/components/notification/toast-notification.css.js +1 -1
- package/es/components/notification/toast-notification.d.ts.map +1 -1
- package/es/components/notification/toast-notification.js +2 -1
- package/es/components/notification/toast-notification.js.map +1 -1
- package/es/components/notification/toast-notification.rtl.css.js +1 -1
- package/es/components/number-input/number-input-skeleton.d.ts.map +1 -1
- package/es/components/number-input/number-input-skeleton.js +3 -4
- package/es/components/number-input/number-input-skeleton.js.map +1 -1
- package/es/components/number-input/number-input.css.js +1 -1
- package/es/components/number-input/number-input.d.ts.map +1 -1
- package/es/components/number-input/number-input.js +2 -1
- package/es/components/number-input/number-input.js.map +1 -1
- package/es/components/number-input/number-input.rtl.css.js +1 -1
- package/es/components/overflow-menu/overflow-menu-body.d.ts.map +1 -1
- package/es/components/overflow-menu/overflow-menu-body.js +2 -1
- package/es/components/overflow-menu/overflow-menu-body.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu-item.d.ts.map +1 -1
- package/es/components/overflow-menu/overflow-menu-item.js +2 -1
- package/es/components/overflow-menu/overflow-menu-item.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu.css.js +1 -1
- package/es/components/overflow-menu/overflow-menu.d.ts.map +1 -1
- package/es/components/overflow-menu/overflow-menu.js +2 -4
- package/es/components/overflow-menu/overflow-menu.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu.rtl.css.js +1 -1
- package/es/components/pagination/pagination.css.js +1 -1
- package/es/components/pagination/pagination.d.ts.map +1 -1
- package/es/components/pagination/pagination.js +12 -6
- package/es/components/pagination/pagination.js.map +1 -1
- package/es/components/pagination/pagination.rtl.css.js +1 -1
- package/es/components/popover/popover.css.js +1 -1
- package/es/components/popover/popover.js.map +1 -1
- package/es/components/popover/popover.rtl.css.js +1 -1
- package/es/components/progress-bar/progress-bar.css.js +1 -1
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/progress-bar/progress-bar.rtl.css.js +1 -1
- package/es/components/progress-indicator/progress-indicator-skeleton.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-indicator-skeleton.js +3 -4
- package/es/components/progress-indicator/progress-indicator-skeleton.js.map +1 -1
- package/es/components/progress-indicator/progress-indicator.css.js +1 -1
- package/es/components/progress-indicator/progress-indicator.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-indicator.js +3 -6
- package/es/components/progress-indicator/progress-indicator.js.map +1 -1
- package/es/components/progress-indicator/progress-indicator.rtl.css.js +1 -1
- package/es/components/progress-indicator/progress-step-skeleton.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-step-skeleton.js +3 -2
- package/es/components/progress-indicator/progress-step-skeleton.js.map +1 -1
- package/es/components/progress-indicator/progress-step.d.ts.map +1 -1
- package/es/components/progress-indicator/progress-step.js +2 -1
- package/es/components/progress-indicator/progress-step.js.map +1 -1
- package/es/components/radio-button/radio-button-group.d.ts +23 -1
- package/es/components/radio-button/radio-button-group.d.ts.map +1 -1
- package/es/components/radio-button/radio-button-group.js +111 -11
- package/es/components/radio-button/radio-button-group.js.map +1 -1
- package/es/components/radio-button/radio-button-skeleton.d.ts.map +1 -1
- package/es/components/radio-button/radio-button-skeleton.js +2 -4
- package/es/components/radio-button/radio-button-skeleton.js.map +1 -1
- package/es/components/radio-button/radio-button.css.js +1 -1
- package/es/components/radio-button/radio-button.d.ts +4 -0
- package/es/components/radio-button/radio-button.d.ts.map +1 -1
- package/es/components/radio-button/radio-button.js +20 -1
- package/es/components/radio-button/radio-button.js.map +1 -1
- package/es/components/radio-button/radio-button.rtl.css.js +1 -1
- package/es/components/search/search-skeleton.d.ts.map +1 -1
- package/es/components/search/search-skeleton.js +3 -4
- package/es/components/search/search-skeleton.js.map +1 -1
- package/es/components/search/search.css.js +1 -1
- package/es/components/search/search.d.ts.map +1 -1
- package/es/components/search/search.js +3 -12
- package/es/components/search/search.js.map +1 -1
- package/es/components/search/search.rtl.css.js +1 -1
- package/es/components/select/select-item-group.d.ts.map +1 -1
- package/es/components/select/select-item-group.js +2 -1
- package/es/components/select/select-item-group.js.map +1 -1
- package/es/components/select/select-item.d.ts.map +1 -1
- package/es/components/select/select-item.js +2 -1
- package/es/components/select/select-item.js.map +1 -1
- package/es/components/select/select.css.js +1 -1
- package/es/components/select/select.d.ts.map +1 -1
- package/es/components/select/select.js +3 -9
- package/es/components/select/select.js.map +1 -1
- package/es/components/select/select.rtl.css.js +1 -1
- package/es/components/skeleton-placeholder/skeleton-placeholder.d.ts.map +1 -1
- package/es/components/skeleton-placeholder/skeleton-placeholder.js +2 -6
- package/es/components/skeleton-placeholder/skeleton-placeholder.js.map +1 -1
- package/es/components/skeleton-text/skeleton-text.d.ts.map +1 -1
- package/es/components/skeleton-text/skeleton-text.js +2 -1
- package/es/components/skeleton-text/skeleton-text.js.map +1 -1
- package/es/components/skip-to-content/skip-to-content.css.js +1 -1
- package/es/components/skip-to-content/skip-to-content.d.ts.map +1 -1
- package/es/components/skip-to-content/skip-to-content.js +3 -6
- package/es/components/skip-to-content/skip-to-content.js.map +1 -1
- package/es/components/skip-to-content/skip-to-content.rtl.css.js +1 -1
- package/es/components/slider/slider-input.d.ts +4 -0
- package/es/components/slider/slider-input.d.ts.map +1 -1
- package/es/components/slider/slider-input.js +35 -15
- package/es/components/slider/slider-input.js.map +1 -1
- package/es/components/slider/slider-skeleton.d.ts.map +1 -1
- package/es/components/slider/slider-skeleton.js +2 -4
- package/es/components/slider/slider-skeleton.js.map +1 -1
- package/es/components/slider/slider.css.js +1 -1
- package/es/components/slider/slider.d.ts +17 -0
- package/es/components/slider/slider.d.ts.map +1 -1
- package/es/components/slider/slider.js +94 -7
- package/es/components/slider/slider.js.map +1 -1
- package/es/components/slider/slider.rtl.css.js +1 -1
- package/es/components/stack/defs.js.map +1 -1
- package/es/components/structured-list/structured-list-body.d.ts.map +1 -1
- package/es/components/structured-list/structured-list-body.js +1 -1
- package/es/components/structured-list/structured-list-body.js.map +1 -1
- package/es/components/structured-list/structured-list-cell.d.ts.map +1 -1
- package/es/components/structured-list/structured-list-cell.js +2 -6
- package/es/components/structured-list/structured-list-cell.js.map +1 -1
- package/es/components/structured-list/structured-list-head.d.ts.map +1 -1
- package/es/components/structured-list/structured-list-head.js +1 -1
- package/es/components/structured-list/structured-list-head.js.map +1 -1
- package/es/components/structured-list/structured-list-header-cell-skeleton.d.ts.map +1 -1
- package/es/components/structured-list/structured-list-header-cell-skeleton.js +2 -4
- package/es/components/structured-list/structured-list-header-cell-skeleton.js.map +1 -1
- package/es/components/structured-list/structured-list-header-cell.d.ts.map +1 -1
- package/es/components/structured-list/structured-list-header-cell.js +2 -6
- package/es/components/structured-list/structured-list-header-cell.js.map +1 -1
- package/es/components/structured-list/structured-list-header-row.d.ts.map +1 -1
- package/es/components/structured-list/structured-list-header-row.js +2 -1
- package/es/components/structured-list/structured-list-header-row.js.map +1 -1
- package/es/components/structured-list/structured-list-row.d.ts +0 -3
- package/es/components/structured-list/structured-list-row.d.ts.map +1 -1
- package/es/components/structured-list/structured-list-row.js +3 -4
- package/es/components/structured-list/structured-list-row.js.map +1 -1
- package/es/components/structured-list/structured-list.css.js +1 -1
- package/es/components/structured-list/structured-list.d.ts.map +1 -1
- package/es/components/structured-list/structured-list.js +3 -6
- package/es/components/structured-list/structured-list.js.map +1 -1
- package/es/components/structured-list/structured-list.rtl.css.js +1 -1
- package/es/components/tabs/tab-skeleton.d.ts.map +1 -1
- package/es/components/tabs/tab-skeleton.js +2 -4
- package/es/components/tabs/tab-skeleton.js.map +1 -1
- package/es/components/tabs/tab.d.ts.map +1 -1
- package/es/components/tabs/tab.js +3 -6
- package/es/components/tabs/tab.js.map +1 -1
- package/es/components/tabs/tabs-skeleton.d.ts.map +1 -1
- package/es/components/tabs/tabs-skeleton.js +2 -4
- package/es/components/tabs/tabs-skeleton.js.map +1 -1
- package/es/components/tabs/tabs.css.js +1 -1
- package/es/components/tabs/tabs.d.ts.map +1 -1
- package/es/components/tabs/tabs.js +3 -8
- package/es/components/tabs/tabs.js.map +1 -1
- package/es/components/tabs/tabs.rtl.css.js +1 -1
- package/es/components/tag/tag.css.js +1 -1
- package/es/components/tag/tag.d.ts.map +1 -1
- package/es/components/tag/tag.js +2 -1
- package/es/components/tag/tag.js.map +1 -1
- package/es/components/tag/tag.rtl.css.js +1 -1
- package/es/components/text-input/text-input.css.js +1 -1
- package/es/components/text-input/text-input.d.ts +4 -4
- package/es/components/text-input/text-input.d.ts.map +1 -1
- package/es/components/text-input/text-input.js +13 -12
- package/es/components/text-input/text-input.js.map +1 -1
- package/es/components/text-input/text-input.rtl.css.js +1 -1
- package/es/components/textarea/textarea-skeleton.d.ts.map +1 -1
- package/es/components/textarea/textarea-skeleton.js +2 -4
- package/es/components/textarea/textarea-skeleton.js.map +1 -1
- package/es/components/textarea/textarea.css.js +1 -1
- package/es/components/textarea/textarea.d.ts.map +1 -1
- package/es/components/textarea/textarea.js +12 -14
- package/es/components/textarea/textarea.js.map +1 -1
- package/es/components/textarea/textarea.rtl.css.js +1 -1
- package/es/components/tile/clickable-tile.d.ts.map +1 -1
- package/es/components/tile/clickable-tile.js +3 -6
- package/es/components/tile/clickable-tile.js.map +1 -1
- package/es/components/tile/expandable-tile.d.ts.map +1 -1
- package/es/components/tile/expandable-tile.js +2 -1
- package/es/components/tile/expandable-tile.js.map +1 -1
- package/es/components/tile/radio-tile.d.ts.map +1 -1
- package/es/components/tile/radio-tile.js +2 -6
- package/es/components/tile/radio-tile.js.map +1 -1
- package/es/components/tile/selectable-tile.d.ts +3 -1
- package/es/components/tile/selectable-tile.d.ts.map +1 -1
- package/es/components/tile/selectable-tile.js +2 -1
- package/es/components/tile/selectable-tile.js.map +1 -1
- package/es/components/tile/tile-group.d.ts.map +1 -1
- package/es/components/tile/tile-group.js +3 -4
- package/es/components/tile/tile-group.js.map +1 -1
- package/es/components/tile/tile.css.js +1 -1
- package/es/components/tile/tile.d.ts.map +1 -1
- package/es/components/tile/tile.js +2 -1
- package/es/components/tile/tile.js.map +1 -1
- package/es/components/tile/tile.rtl.css.js +1 -1
- package/es/components/toggle/toggle.css.js +1 -1
- package/es/components/toggle/toggle.d.ts.map +1 -1
- package/es/components/toggle/toggle.js +2 -1
- package/es/components/toggle/toggle.js.map +1 -1
- package/es/components/toggle/toggle.rtl.css.js +1 -1
- package/es/components/toggle-tip/toggletip.css.js +1 -1
- package/es/components/toggle-tip/toggletip.js.map +1 -1
- package/es/components/toggle-tip/toggletip.rtl.css.js +1 -1
- package/es/components/tooltip/tooltip.css.js +1 -1
- package/es/components/tooltip/tooltip.d.ts +0 -1
- package/es/components/tooltip/tooltip.d.ts.map +1 -1
- package/es/components/tooltip/tooltip.js +3 -2
- package/es/components/tooltip/tooltip.js.map +1 -1
- package/es/components/tooltip/tooltip.rtl.css.js +1 -1
- package/es/components/ui-shell/header-global-action.d.ts +16 -1
- package/es/components/ui-shell/header-global-action.d.ts.map +1 -1
- package/es/components/ui-shell/header-global-action.js +92 -8
- package/es/components/ui-shell/header-global-action.js.map +1 -1
- package/es/components/ui-shell/header-menu-button.d.ts.map +1 -1
- package/es/components/ui-shell/header-menu-button.js +3 -9
- package/es/components/ui-shell/header-menu-button.js.map +1 -1
- package/es/components/ui-shell/header-menu-item.d.ts.map +1 -1
- package/es/components/ui-shell/header-menu-item.js +1 -1
- package/es/components/ui-shell/header-menu-item.js.map +1 -1
- package/es/components/ui-shell/header-menu.d.ts +1 -1
- package/es/components/ui-shell/header-menu.d.ts.map +1 -1
- package/es/components/ui-shell/header-menu.js +11 -17
- package/es/components/ui-shell/header-menu.js.map +1 -1
- package/es/components/ui-shell/header-name.d.ts.map +1 -1
- package/es/components/ui-shell/header-name.js +3 -8
- package/es/components/ui-shell/header-name.js.map +1 -1
- package/es/components/ui-shell/header-nav-item.d.ts +8 -0
- package/es/components/ui-shell/header-nav-item.d.ts.map +1 -1
- package/es/components/ui-shell/header-nav-item.js +32 -11
- package/es/components/ui-shell/header-nav-item.js.map +1 -1
- package/es/components/ui-shell/header-nav.d.ts.map +1 -1
- package/es/components/ui-shell/header-nav.js +2 -1
- package/es/components/ui-shell/header-nav.js.map +1 -1
- package/es/components/ui-shell/header.css.js +1 -1
- package/es/components/ui-shell/header.d.ts.map +1 -1
- package/es/components/ui-shell/header.js +1 -1
- package/es/components/ui-shell/header.js.map +1 -1
- package/es/components/ui-shell/header.rtl.css.js +1 -1
- package/es/components/ui-shell/index.d.ts +12 -11
- package/es/components/ui-shell/index.d.ts.map +1 -1
- package/es/components/ui-shell/index.js +12 -11
- package/es/components/ui-shell/index.js.map +1 -1
- package/es/components/ui-shell/side-nav-divider.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-divider.js +1 -1
- package/es/components/ui-shell/side-nav-divider.js.map +1 -1
- package/es/components/ui-shell/side-nav-items.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-items.js +1 -1
- package/es/components/ui-shell/side-nav-items.js.map +1 -1
- package/es/components/ui-shell/side-nav-link.d.ts +8 -0
- package/es/components/ui-shell/side-nav-link.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-link.js +33 -11
- package/es/components/ui-shell/side-nav-link.js.map +1 -1
- package/es/components/ui-shell/side-nav-menu-item.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-menu-item.js +3 -8
- package/es/components/ui-shell/side-nav-menu-item.js.map +1 -1
- package/es/components/ui-shell/side-nav-menu.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav-menu.js +3 -13
- package/es/components/ui-shell/side-nav-menu.js.map +1 -1
- package/es/components/ui-shell/side-nav.css.js +1 -1
- package/es/components/ui-shell/side-nav.d.ts +5 -0
- package/es/components/ui-shell/side-nav.d.ts.map +1 -1
- package/es/components/ui-shell/side-nav.js +16 -2
- package/es/components/ui-shell/side-nav.js.map +1 -1
- package/es/components/ui-shell/side-nav.rtl.css.js +1 -1
- package/es/components/ui-shell/switcher-item.js.map +1 -1
- package/es/globals/decorators/carbon-element.d.ts +235 -0
- package/es/globals/decorators/carbon-element.d.ts.map +1 -0
- package/es/globals/decorators/carbon-element.js +429 -0
- package/es/globals/decorators/carbon-element.js.map +1 -0
- package/es/globals/decorators/host-listener.js.map +1 -1
- package/es/globals/directives/spread.d.ts +1 -1
- package/es/globals/directives/spread.d.ts.map +1 -1
- package/es/globals/directives/spread.js +1 -1
- package/es/globals/directives/spread.js.map +1 -1
- package/es/globals/internal/radio-group-manager.js +3 -4
- package/es/globals/internal/radio-group-manager.js.map +1 -1
- package/es/globals/internal/storybook-cdn.d.ts +1 -1
- package/es/globals/internal/storybook-cdn.d.ts.map +1 -1
- package/es/globals/internal/storybook-cdn.js +3 -3
- package/es/globals/internal/storybook-cdn.js.map +1 -1
- package/es/globals/mixins/focus.js.map +1 -1
- package/es/globals/mixins/form.js +6 -1
- package/es/globals/mixins/form.js.map +1 -1
- package/es/globals/mixins/host-listener.js.map +1 -1
- package/es/globals/mixins/temp-layout.css.js +12 -0
- package/es/globals/mixins/temp-layout.rtl.css.js +12 -0
- package/es/globals/mixins/validity.js +16 -0
- package/es/globals/mixins/validity.js.map +1 -1
- package/es/globals/wrappers/createReactCustomElementType.js +17 -0
- package/es/globals/wrappers/createReactCustomElementType.js.map +1 -1
- package/es/polyfills/toggle-class.js.map +1 -1
- package/lib/components/accordion/defs.js +1 -1
- package/lib/components/accordion/defs.js.map +1 -1
- package/lib/components/button/defs.js +1 -1
- package/lib/components/button/defs.js.map +1 -1
- package/lib/components/code-snippet/defs.js +1 -1
- package/lib/components/code-snippet/defs.js.map +1 -1
- package/lib/components/content-switcher/defs.js +1 -1
- package/lib/components/content-switcher/defs.js.map +1 -1
- package/lib/components/date-picker/defs.js +1 -1
- package/lib/components/date-picker/defs.js.map +1 -1
- package/lib/components/dropdown/defs.js +1 -1
- package/lib/components/dropdown/defs.js.map +1 -1
- package/lib/components/file-uploader/defs.js +1 -1
- package/lib/components/file-uploader/defs.js.map +1 -1
- package/lib/components/floating-menu/defs.js +1 -1
- package/lib/components/floating-menu/defs.js.map +1 -1
- package/lib/components/inline-loading/defs.js +1 -1
- package/lib/components/inline-loading/defs.js.map +1 -1
- package/lib/components/loading/defs.js +1 -1
- package/lib/components/loading/defs.js.map +1 -1
- package/lib/components/modal/defs.js +1 -1
- package/lib/components/modal/defs.js.map +1 -1
- package/lib/components/stack/defs.js.map +1 -1
- package/lib/globals/wrappers/createReactCustomElementType.js +16 -0
- package/lib/globals/wrappers/createReactCustomElementType.js.map +1 -1
- package/package.json +17 -16
- package/scss/components/accordion/accordion.scss +10 -5
- package/scss/components/breadcrumb/breadcrumb.scss +7 -0
- package/scss/components/button/button.scss +7 -2
- package/scss/components/code-snippet/code-snippet.scss +6 -8
- package/scss/components/combo-box/combo-box.scss +0 -10
- package/scss/components/content-switcher/content-switcher.scss +8 -21
- package/scss/components/copy-button/copy-button.scss +3 -3
- package/scss/components/data-table/_table-action.scss +4 -0
- package/scss/components/data-table/_table-core.scss +0 -2
- package/scss/components/data-table/data-table.scss +0 -1
- package/scss/components/date-picker/date-picker.scss +0 -3
- package/scss/components/dropdown/dropdown.scss +1 -2
- package/scss/components/file-uploader/file-uploader.scss +3 -5
- package/scss/components/icon-button/icon-button.scss +5 -0
- package/scss/components/inline-loading/inline-loading.scss +0 -3
- package/scss/components/modal/modal.scss +1 -4
- package/scss/components/multi-select/multi-select.scss +0 -3
- package/scss/components/notification/actionable-notification.scss +69 -24
- package/scss/components/notification/inline-notification.scss +76 -25
- package/scss/components/notification/toast-notification.scss +43 -27
- package/scss/components/number-input/number-input.scss +0 -3
- package/scss/components/overflow-menu/overflow-menu.scss +8 -3
- package/scss/components/pagination/pagination.scss +8 -3
- package/scss/components/popover/popover.scss +4 -2
- package/scss/components/progress-bar/progress-bar.scss +0 -5
- package/scss/components/progress-indicator/progress-indicator.scss +0 -3
- package/scss/components/radio-button/radio-button.scss +24 -1
- package/scss/components/search/search.scss +33 -3
- package/scss/components/select/select.scss +0 -3
- package/scss/components/slider/slider.scss +2 -3
- package/scss/components/structured-list/structured-list.scss +0 -5
- package/scss/components/tag/tag.scss +10 -5
- package/scss/components/text-input/text-input.scss +2 -2
- package/scss/components/textarea/textarea.scss +0 -3
- package/scss/components/tile/tile.scss +7 -8
- package/scss/components/tooltip/tooltip.scss +4 -4
- package/scss/components/ui-shell/header.scss +13 -3
- package/scss/components/ui-shell/side-nav.scss +0 -5
- package/scss/globals/mixins/temp-layout.scss +36 -0
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
*
|
|
5
|
+
* Copyright IBM Corp. 2019, 2023
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license
|
|
13
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
14
|
+
* This code may only be used under the BSD style license found at
|
|
15
|
+
* http://polymer.github.io/LICENSE.txt
|
|
16
|
+
* The complete set of authors may be found at
|
|
17
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
18
|
+
* The complete set of contributors may be found at
|
|
19
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
20
|
+
* Code distributed by Google as part of the polymer project is also
|
|
21
|
+
* subject to an additional IP rights grant found at
|
|
22
|
+
* http://polymer.github.io/PATENTS.txt
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* IMPORTANT: For compatibility with tsickle and the Closure Compiler, all
|
|
27
|
+
* property decorators (but not class decorators) in this file that have
|
|
28
|
+
* an @ExportDecoratedItems annotation must be defined as a regular function,
|
|
29
|
+
* not an arrow function.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
// From the TC39 Decorators proposal
|
|
33
|
+
|
|
34
|
+
// From the TC39 Decorators proposal
|
|
35
|
+
|
|
36
|
+
const legacyCustomElement = (tagName, clazz) => {
|
|
37
|
+
try {
|
|
38
|
+
window.customElements.define(tagName, clazz);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.warn(`Attempting to re-define ${tagName}`);
|
|
41
|
+
}
|
|
42
|
+
// Cast as any because TS doesn't recognize the return type as being a
|
|
43
|
+
// subtype of the decorated class when clazz is typed as
|
|
44
|
+
// `Constructor<HTMLElement>` for some reason.
|
|
45
|
+
// `Constructor<HTMLElement>` is helpful to make sure the decorator is
|
|
46
|
+
// applied to elements however.
|
|
47
|
+
// tslint:disable-next-line:no-any
|
|
48
|
+
return clazz;
|
|
49
|
+
};
|
|
50
|
+
const standardCustomElement = (tagName, descriptor) => {
|
|
51
|
+
const {
|
|
52
|
+
kind,
|
|
53
|
+
elements
|
|
54
|
+
} = descriptor;
|
|
55
|
+
return {
|
|
56
|
+
kind,
|
|
57
|
+
elements,
|
|
58
|
+
// This callback is called once the class is otherwise fully defined
|
|
59
|
+
finisher(clazz) {
|
|
60
|
+
try {
|
|
61
|
+
window.customElements.define(tagName, clazz);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.warn(`Attempting to re-define ${tagName}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Class decorator factory that defines the decorated class as a custom element.
|
|
71
|
+
*
|
|
72
|
+
* ```
|
|
73
|
+
* @customElement('my-element')
|
|
74
|
+
* class MyElement {
|
|
75
|
+
* render() {
|
|
76
|
+
* return html``;
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @category Decorator
|
|
82
|
+
* @param tagName The name of the custom element to define.
|
|
83
|
+
*/
|
|
84
|
+
export const carbonElement = tagName => classOrDescriptor => typeof classOrDescriptor === 'function' ? legacyCustomElement(tagName, classOrDescriptor) : standardCustomElement(tagName, classOrDescriptor);
|
|
85
|
+
const standardProperty = (options, element) => {
|
|
86
|
+
// When decorating an accessor, pass it through and add property metadata.
|
|
87
|
+
// Note, the `hasOwnProperty` check in `createProperty` ensures we don't
|
|
88
|
+
// stomp over the user's accessor.
|
|
89
|
+
if (element.kind === 'method' && element.descriptor && !('value' in element.descriptor)) {
|
|
90
|
+
return _objectSpread(_objectSpread({}, element), {}, {
|
|
91
|
+
finisher(clazz) {
|
|
92
|
+
clazz.createProperty(element.key, options);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
// createProperty() takes care of defining the property, but we still
|
|
97
|
+
// must return some kind of descriptor, so return a descriptor for an
|
|
98
|
+
// unused prototype field. The finisher calls createProperty().
|
|
99
|
+
return {
|
|
100
|
+
kind: 'field',
|
|
101
|
+
key: Symbol(),
|
|
102
|
+
placement: 'own',
|
|
103
|
+
descriptor: {},
|
|
104
|
+
// When @babel/plugin-proposal-decorators implements initializers,
|
|
105
|
+
// do this instead of the initializer below. See:
|
|
106
|
+
// https://github.com/babel/babel/issues/9260 extras: [
|
|
107
|
+
// {
|
|
108
|
+
// kind: 'initializer',
|
|
109
|
+
// placement: 'own',
|
|
110
|
+
// initializer: descriptor.initializer,
|
|
111
|
+
// }
|
|
112
|
+
// ],
|
|
113
|
+
initializer() {
|
|
114
|
+
if (typeof element.initializer === 'function') {
|
|
115
|
+
this[element.key] = element.initializer.call(this);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
finisher(clazz) {
|
|
119
|
+
clazz.createProperty(element.key, options);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const legacyProperty = (options, proto, name) => {
|
|
125
|
+
proto.constructor.createProperty(name, options);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A property decorator which creates a LitElement property which reflects a
|
|
130
|
+
* corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be
|
|
131
|
+
* supplied to configure property features.
|
|
132
|
+
*
|
|
133
|
+
* This decorator should only be used for public fields. Private or protected
|
|
134
|
+
* fields should use the [[`internalProperty`]] decorator.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* class MyElement {
|
|
139
|
+
* @property({ type: Boolean })
|
|
140
|
+
* clicked = false;
|
|
141
|
+
* }
|
|
142
|
+
* ```
|
|
143
|
+
* @category Decorator
|
|
144
|
+
* @ExportDecoratedItems
|
|
145
|
+
*/
|
|
146
|
+
export function property(options) {
|
|
147
|
+
// tslint:disable-next-line:no-any decorator
|
|
148
|
+
return (protoOrDescriptor, name) => name !== undefined ? legacyProperty(options, protoOrDescriptor, name) : standardProperty(options, protoOrDescriptor);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Declares a private or protected property that still triggers updates to the
|
|
152
|
+
* element when it changes.
|
|
153
|
+
*
|
|
154
|
+
* Properties declared this way must not be used from HTML or HTML templating
|
|
155
|
+
* systems, they're solely for properties internal to the element. These
|
|
156
|
+
* properties may be renamed by optimization tools like the Closure Compiler.
|
|
157
|
+
*
|
|
158
|
+
* @category Decorator
|
|
159
|
+
* @deprecated `internalProperty` has been renamed to `state` in lit-element
|
|
160
|
+
* 3.0. Please update to `state` now to be compatible with 3.0.
|
|
161
|
+
*/
|
|
162
|
+
export function internalProperty(options) {
|
|
163
|
+
return property({
|
|
164
|
+
attribute: false,
|
|
165
|
+
hasChanged: options === null || options === void 0 ? void 0 : options.hasChanged
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Declares a private or protected property that still triggers updates to the
|
|
171
|
+
* element when it changes.
|
|
172
|
+
*
|
|
173
|
+
* Properties declared this way must not be used from HTML or HTML templating
|
|
174
|
+
* systems, they're solely for properties internal to the element. These
|
|
175
|
+
* properties may be renamed by optimization tools like the Closure Compiler.
|
|
176
|
+
*
|
|
177
|
+
* @category Decorator
|
|
178
|
+
*/
|
|
179
|
+
export const state = options => internalProperty(options);
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A property decorator that converts a class property into a getter that
|
|
183
|
+
* executes a querySelector on the element's renderRoot.
|
|
184
|
+
*
|
|
185
|
+
* @param selector A DOMString containing one or more selectors to match.
|
|
186
|
+
* @param cache An optional boolean which when true performs the DOM query only
|
|
187
|
+
* once and caches the result.
|
|
188
|
+
* @see: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
|
|
189
|
+
* @example
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* class MyElement {
|
|
193
|
+
* @query('#first')
|
|
194
|
+
* first;
|
|
195
|
+
*
|
|
196
|
+
* render() {
|
|
197
|
+
* return html`
|
|
198
|
+
* <div id="first"></div>
|
|
199
|
+
* <div id="second"></div>
|
|
200
|
+
* `;
|
|
201
|
+
* }
|
|
202
|
+
* }
|
|
203
|
+
* ```
|
|
204
|
+
* @category Decorator
|
|
205
|
+
*/
|
|
206
|
+
export function query(selector, cache) {
|
|
207
|
+
return (protoOrDescriptor, name) => {
|
|
208
|
+
const descriptor = {
|
|
209
|
+
get() {
|
|
210
|
+
return this.renderRoot.querySelector(selector);
|
|
211
|
+
},
|
|
212
|
+
enumerable: true,
|
|
213
|
+
configurable: true
|
|
214
|
+
};
|
|
215
|
+
if (cache) {
|
|
216
|
+
const prop = name !== undefined ? name : protoOrDescriptor.key;
|
|
217
|
+
const key = typeof prop === 'symbol' ? Symbol() : `__${prop}`;
|
|
218
|
+
descriptor.get = function () {
|
|
219
|
+
if (this[key] === undefined) {
|
|
220
|
+
this[key] = this.renderRoot.querySelector(selector);
|
|
221
|
+
}
|
|
222
|
+
return this[key];
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Note, in the future, we may extend this decorator to support the use case
|
|
230
|
+
// where the queried element may need to do work to become ready to interact
|
|
231
|
+
// with (e.g. load some implementation code). If so, we might elect to
|
|
232
|
+
// add a second argument defining a function that can be run to make the
|
|
233
|
+
// queried element loaded/updated/ready.
|
|
234
|
+
/**
|
|
235
|
+
* A property decorator that converts a class property into a getter that
|
|
236
|
+
* returns a promise that resolves to the result of a querySelector on the
|
|
237
|
+
* element's renderRoot done after the element's `updateComplete` promise
|
|
238
|
+
* resolves. When the queried property may change with element state, this
|
|
239
|
+
* decorator can be used instead of requiring users to await the
|
|
240
|
+
* `updateComplete` before accessing the property.
|
|
241
|
+
*
|
|
242
|
+
* @param selector A DOMString containing one or more selectors to match.
|
|
243
|
+
* @see: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* class MyElement {
|
|
247
|
+
* @queryAsync('#first')
|
|
248
|
+
* first;
|
|
249
|
+
*
|
|
250
|
+
* render() {
|
|
251
|
+
* return html`
|
|
252
|
+
* <div id="first"></div>
|
|
253
|
+
* <div id="second"></div>
|
|
254
|
+
* `;
|
|
255
|
+
* }
|
|
256
|
+
* }
|
|
257
|
+
*
|
|
258
|
+
* // external usage
|
|
259
|
+
* async doSomethingWithFirst() {
|
|
260
|
+
* (await aMyElement.first).doSomething();
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
263
|
+
* @category Decorator
|
|
264
|
+
*/
|
|
265
|
+
export function queryAsync(selector) {
|
|
266
|
+
return (protoOrDescriptor, name) => {
|
|
267
|
+
const descriptor = {
|
|
268
|
+
async get() {
|
|
269
|
+
await this.updateComplete;
|
|
270
|
+
return this.renderRoot.querySelector(selector);
|
|
271
|
+
},
|
|
272
|
+
enumerable: true,
|
|
273
|
+
configurable: true
|
|
274
|
+
};
|
|
275
|
+
return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* A property decorator that converts a class property into a getter
|
|
281
|
+
* that executes a querySelectorAll on the element's renderRoot.
|
|
282
|
+
*
|
|
283
|
+
* @param selector A DOMString containing one or more selectors to match.
|
|
284
|
+
* @see:
|
|
285
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll
|
|
286
|
+
* @example
|
|
287
|
+
* ```ts
|
|
288
|
+
* class MyElement {
|
|
289
|
+
* @queryAll('div')
|
|
290
|
+
* divs;
|
|
291
|
+
*
|
|
292
|
+
* render() {
|
|
293
|
+
* return html`
|
|
294
|
+
* <div id="first"></div>
|
|
295
|
+
* <div id="second"></div>
|
|
296
|
+
* `;
|
|
297
|
+
* }
|
|
298
|
+
* }
|
|
299
|
+
* ```
|
|
300
|
+
* @category Decorator
|
|
301
|
+
*/
|
|
302
|
+
export function queryAll(selector) {
|
|
303
|
+
return (protoOrDescriptor, name) => {
|
|
304
|
+
const descriptor = {
|
|
305
|
+
get() {
|
|
306
|
+
return this.renderRoot.querySelectorAll(selector);
|
|
307
|
+
},
|
|
308
|
+
enumerable: true,
|
|
309
|
+
configurable: true
|
|
310
|
+
};
|
|
311
|
+
return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
const legacyQuery = (descriptor, proto, name) => {
|
|
315
|
+
Object.defineProperty(proto, name, descriptor);
|
|
316
|
+
};
|
|
317
|
+
const standardQuery = (descriptor, element) => ({
|
|
318
|
+
kind: 'method',
|
|
319
|
+
placement: 'prototype',
|
|
320
|
+
key: element.key,
|
|
321
|
+
descriptor
|
|
322
|
+
});
|
|
323
|
+
const standardEventOptions = (options, element) => {
|
|
324
|
+
return _objectSpread(_objectSpread({}, element), {}, {
|
|
325
|
+
finisher(clazz) {
|
|
326
|
+
Object.assign(
|
|
327
|
+
// @ts-ignore TS2769: No overload matches this call.
|
|
328
|
+
clazz.prototype[element.key], options);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
const legacyEventOptions =
|
|
333
|
+
// tslint:disable-next-line:no-any legacy decorator
|
|
334
|
+
(options, proto, name) => {
|
|
335
|
+
Object.assign(proto[name], options);
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Adds event listener options to a method used as an event listener in a
|
|
340
|
+
* lit-html template.
|
|
341
|
+
*
|
|
342
|
+
* @param options An object that specifies event listener options as accepted by
|
|
343
|
+
* `EventTarget#addEventListener` and `EventTarget#removeEventListener`.
|
|
344
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
|
|
345
|
+
* Current browsers support the `capture`, `passive`, and `once` options. See:
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* class MyElement {
|
|
349
|
+
* clicked = false;
|
|
350
|
+
*
|
|
351
|
+
* render() {
|
|
352
|
+
* return html`
|
|
353
|
+
* <div @click=${this._onClick}`>
|
|
354
|
+
* <button></button>
|
|
355
|
+
* </div>
|
|
356
|
+
* `;
|
|
357
|
+
* }
|
|
358
|
+
*
|
|
359
|
+
* @eventOptions({capture: true})
|
|
360
|
+
* _onClick(e) {
|
|
361
|
+
* this.clicked = true;
|
|
362
|
+
* }
|
|
363
|
+
* }
|
|
364
|
+
* ```
|
|
365
|
+
* @category Decorator
|
|
366
|
+
*/
|
|
367
|
+
export function eventOptions(options) {
|
|
368
|
+
// Return value typed as any to prevent TypeScript from complaining that
|
|
369
|
+
// standard decorator function signature does not match TypeScript decorator
|
|
370
|
+
// signature
|
|
371
|
+
// TODO(kschaaf): unclear why it was only failing on this decorator and not
|
|
372
|
+
// the others
|
|
373
|
+
return (protoOrDescriptor, name) => name !== undefined ? legacyEventOptions(options, protoOrDescriptor, name) : standardEventOptions(options, protoOrDescriptor); // tslint:disable-next-line:no-any decorator
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// x-browser support for matches
|
|
377
|
+
// tslint:disable-next-line:no-any
|
|
378
|
+
const ElementProto = Element.prototype;
|
|
379
|
+
const legacyMatches = ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* A property decorator that converts a class property into a getter that
|
|
383
|
+
* returns the `assignedNodes` of the given named `slot`. Note, the type of
|
|
384
|
+
* this property should be annotated as `NodeListOf<HTMLElement>`.
|
|
385
|
+
*
|
|
386
|
+
* @param slotName A string name of the slot.
|
|
387
|
+
* @param flatten A boolean which when true flattens the assigned nodes,
|
|
388
|
+
* meaning any assigned nodes that are slot elements are replaced with their
|
|
389
|
+
* assigned nodes.
|
|
390
|
+
* @param selector A string which filters the results to elements that match
|
|
391
|
+
* the given css selector.
|
|
392
|
+
* @example
|
|
393
|
+
* ```ts
|
|
394
|
+
* class MyElement {
|
|
395
|
+
* @queryAssignedNodes('list', true, '.item')
|
|
396
|
+
* listItems;
|
|
397
|
+
*
|
|
398
|
+
* render() {
|
|
399
|
+
* return html`
|
|
400
|
+
* <slot name="list"></slot>
|
|
401
|
+
* `;
|
|
402
|
+
* }
|
|
403
|
+
* }
|
|
404
|
+
* ```
|
|
405
|
+
* @category Decorator
|
|
406
|
+
*/
|
|
407
|
+
export function queryAssignedNodes(slotName = '', flatten = false, selector = '') {
|
|
408
|
+
return (protoOrDescriptor, name) => {
|
|
409
|
+
const descriptor = {
|
|
410
|
+
get() {
|
|
411
|
+
const slotSelector = `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;
|
|
412
|
+
const slot = this.renderRoot.querySelector(slotSelector);
|
|
413
|
+
let nodes = slot && slot.assignedNodes({
|
|
414
|
+
flatten
|
|
415
|
+
});
|
|
416
|
+
if (nodes && selector) {
|
|
417
|
+
nodes = nodes.filter(node => node.nodeType === Node.ELEMENT_NODE && (
|
|
418
|
+
// tslint:disable-next-line:no-any testing existence on older browsers
|
|
419
|
+
node.matches ? node.matches(selector) : legacyMatches.call(node, selector)));
|
|
420
|
+
}
|
|
421
|
+
return nodes;
|
|
422
|
+
},
|
|
423
|
+
enumerable: true,
|
|
424
|
+
configurable: true
|
|
425
|
+
};
|
|
426
|
+
return name !== undefined ? legacyQuery(descriptor, protoOrDescriptor, name) : standardQuery(descriptor, protoOrDescriptor);
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
//# sourceMappingURL=carbon-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carbon-element.js","names":["legacyCustomElement","tagName","clazz","window","customElements","define","error","console","warn","standardCustomElement","descriptor","kind","elements","finisher","carbonElement","classOrDescriptor","standardProperty","options","element","_objectSpread","createProperty","key","Symbol","placement","initializer","call","legacyProperty","proto","name","constructor","property","protoOrDescriptor","undefined","internalProperty","attribute","hasChanged","state","query","selector","cache","get","renderRoot","querySelector","enumerable","configurable","prop","legacyQuery","standardQuery","queryAsync","updateComplete","queryAll","querySelectorAll","Object","defineProperty","standardEventOptions","assign","prototype","legacyEventOptions","eventOptions","ElementProto","Element","legacyMatches","msMatchesSelector","webkitMatchesSelector","queryAssignedNodes","slotName","flatten","slotSelector","slot","nodes","assignedNodes","filter","node","nodeType","Node","ELEMENT_NODE","matches"],"sources":["globals/decorators/carbon-element.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure Compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport { LitElement } from 'lit';\n\nimport {\n PropertyDeclaration,\n ReactiveElement,\n} from '@lit/reactive-element/reactive-element';\n\nexport type Constructor<T> = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T;\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field' | 'method';\n key: PropertyKey;\n placement: 'static' | 'prototype' | 'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement = (\n tagName: string,\n clazz: Constructor<HTMLElement>\n) => {\n try {\n window.customElements.define(tagName, clazz);\n } catch (error) {\n console.warn(`Attempting to re-define ${tagName}`);\n }\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n};\n\nconst standardCustomElement = (\n tagName: string,\n descriptor: ClassDescriptor\n) => {\n const { kind, elements } = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n try {\n window.customElements.define(tagName, clazz);\n } catch (error) {\n console.warn(`Attempting to re-define ${tagName}`);\n }\n },\n };\n};\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```\n * @customElement('my-element')\n * class MyElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n *\n * @category Decorator\n * @param tagName The name of the custom element to define.\n */\nexport const carbonElement =\n (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement> | ClassDescriptor) =>\n typeof classOrDescriptor === 'function'\n ? legacyCustomElement(tagName, classOrDescriptor)\n : standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty = (\n options: PropertyDeclaration,\n element: ClassElement\n) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (\n element.kind === 'method' &&\n element.descriptor &&\n !('value' in element.descriptor)\n ) {\n return {\n ...element,\n finisher(clazz: typeof ReactiveElement) {\n clazz.createProperty(element.key, options);\n },\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n initializer(this: { [key: string]: unknown }) {\n if (typeof element.initializer === 'function') {\n this[element.key as string] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof ReactiveElement) {\n clazz.createProperty(element.key, options);\n },\n };\n }\n};\n\nconst legacyProperty = (\n options: PropertyDeclaration,\n proto: Object,\n name: PropertyKey\n) => {\n (proto.constructor as typeof ReactiveElement).createProperty(name, options);\n};\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be\n * supplied to configure property features.\n *\n * This decorator should only be used for public fields. Private or protected\n * fields should use the [[`internalProperty`]] decorator.\n *\n * @example\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object | ClassElement, name?: PropertyKey): any =>\n name !== undefined\n ? legacyProperty(options!, protoOrDescriptor as Object, name)\n : standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n *\n * @category Decorator\n * @deprecated `internalProperty` has been renamed to `state` in lit-element\n * 3.0. Please update to `state` now to be compatible with 3.0.\n */\nexport function internalProperty(options?: InternalPropertyDeclaration) {\n return property({ attribute: false, hasChanged: options?.hasChanged });\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like the Closure Compiler.\n *\n * @category Decorator\n */\nexport const state = (options?: InternalPropertyDeclaration) =>\n internalProperty(options);\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n * @see: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n * @example\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return (\n protoOrDescriptor: Object | ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey\n ): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const prop =\n name !== undefined ? name : (protoOrDescriptor as ClassElement).key;\n const key = typeof prop === 'symbol' ? Symbol() : `__${prop}`;\n descriptor.get = function (this: LitElement) {\n if (\n (this as unknown as { [key: string]: Element | null })[\n key as string\n ] === undefined\n ) {\n (this as unknown as { [key: string]: Element | null })[\n key as string\n ] = this.renderRoot.querySelector(selector);\n }\n return (this as unknown as { [key: string]: Element | null })[\n key as string\n ];\n };\n }\n return name !== undefined\n ? legacyQuery(descriptor, protoOrDescriptor as Object, name)\n : standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @see: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n * @example\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return (\n protoOrDescriptor: Object | ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey\n ): any => {\n const descriptor = {\n async get(this: LitElement) {\n await this.updateComplete;\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return name !== undefined\n ? legacyQuery(descriptor, protoOrDescriptor as Object, name)\n : standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @see:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n * @example\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return (\n protoOrDescriptor: Object | ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey\n ): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelectorAll(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return name !== undefined\n ? legacyQuery(descriptor, protoOrDescriptor as Object, name)\n : standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst legacyQuery = (\n descriptor: PropertyDescriptor,\n proto: Object,\n name: PropertyKey\n) => {\n Object.defineProperty(proto, name, descriptor);\n};\n\nconst standardQuery = (\n descriptor: PropertyDescriptor,\n element: ClassElement\n) => ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n});\n\nconst standardEventOptions = (\n options: AddEventListenerOptions,\n element: ClassElement\n) => {\n return {\n ...element,\n finisher(clazz: typeof ReactiveElement) {\n Object.assign(\n // @ts-ignore TS2769: No overload matches this call.\n clazz.prototype[element.key as keyof ReactiveElement],\n options\n );\n },\n };\n};\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * @example\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}`>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n return ((protoOrDescriptor: Object | ClassElement, name?: string) =>\n name !== undefined\n ? legacyEventOptions(options, protoOrDescriptor as Object, name)\n : standardEventOptions(\n options,\n protoOrDescriptor as ClassElement\n )) as any; // tslint:disable-next-line:no-any decorator\n}\n\n// x-browser support for matches\n// tslint:disable-next-line:no-any\nconst ElementProto = Element.prototype as any;\nconst legacyMatches =\n ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`. Note, the type of\n * this property should be annotated as `NodeListOf<HTMLElement>`.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A string which filters the results to elements that match\n * the given css selector.\n * @example\n * ```ts\n * class MyElement {\n * @queryAssignedNodes('list', true, '.item')\n * listItems;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAssignedNodes(\n slotName = '',\n flatten = false,\n selector = ''\n) {\n return (\n protoOrDescriptor: Object | ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey\n ): any => {\n const descriptor = {\n get(this: LitElement) {\n const slotSelector = `slot${\n slotName ? `[name=${slotName}]` : ':not([name])'\n }`;\n const slot = this.renderRoot.querySelector(slotSelector);\n let nodes =\n slot && (slot as HTMLSlotElement).assignedNodes({ flatten });\n if (nodes && selector) {\n nodes = nodes.filter(\n (node) =>\n node.nodeType === Node.ELEMENT_NODE &&\n // tslint:disable-next-line:no-any testing existence on older browsers\n ((node as any).matches\n ? (node as Element).matches(selector)\n : legacyMatches.call(node as Element, selector))\n );\n }\n return nodes;\n },\n enumerable: true,\n configurable: true,\n };\n return name !== undefined\n ? legacyQuery(descriptor, protoOrDescriptor as Object, name)\n : standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAcA;;AAOA;;AAWA,MAAMA,mBAAmB,GAAGA,CAC1BC,OAAe,EACfC,KAA+B,KAC5B;EACH,IAAI;IACFC,MAAM,CAACC,cAAc,CAACC,MAAM,CAACJ,OAAO,EAAEC,KAAK,CAAC;EAC9C,CAAC,CAAC,OAAOI,KAAK,EAAE;IACdC,OAAO,CAACC,IAAI,CAAE,2BAA0BP,OAAQ,EAAC,CAAC;EACpD;EACA;EACA;EACA;EACA;EACA;EACA;EACA,OAAOC,KAAK;AACd,CAAC;AAED,MAAMO,qBAAqB,GAAGA,CAC5BR,OAAe,EACfS,UAA2B,KACxB;EACH,MAAM;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAGF,UAAU;EACrC,OAAO;IACLC,IAAI;IACJC,QAAQ;IACR;IACAC,QAAQA,CAACX,KAA+B,EAAE;MACxC,IAAI;QACFC,MAAM,CAACC,cAAc,CAACC,MAAM,CAACJ,OAAO,EAAEC,KAAK,CAAC;MAC9C,CAAC,CAAC,OAAOI,KAAK,EAAE;QACdC,OAAO,CAACC,IAAI,CAAE,2BAA0BP,OAAQ,E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KA,IAAI,CAAqBE,aAAa,CAAC;UAAEJ;QAAQ,CAAC,CAAC;QAC9D,IAAIG,KAAK,IAAI/B,QAAQ,EAAE;UACrB+B,KAAK,GAAGA,KAAK,CAACE,MAAM,CACjBC,IAAI,IACHA,IAAI,CAACC,QAAQ,KAAKC,IAAI,CAACC,YAAY;UACnC;UACEH,IAAI,CAASI,OAAO,GACjBJ,IAAI,CAAaI,OAAO,CAACtC,QAAQ,CAAC,GACnCuB,aAAa,CAACpC,IAAI,CAAC+C,IAAI,EAAalC,QAAQ,CAAC,CACrD,CAAC;QACH;QACA,OAAO+B,KAAK;MACd,CAAC;MACD1B,UAAU,EAAE,IAAI;MAChBC,YAAY,EAAE;IAChB,CAAC;IACD,OAAOhB,IAAI,KAAKI,SAAS,GACrBc,WAAW,CAACpC,UAAU,EAAEqB,iBAAiB,EAAYH,IAAI,CAAC,GAC1DmB,aAAa,CAACrC,UAAU,EAAEqB,iBAAiC,CAAC;EAClE,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-listener.js","names":["setHostListener","type","options","Clazz","name","hostListeners","_hostListeners","Error","HostListenerStandard","descriptor","kind","key","placement","_objectSpread","finisher","HostListener","targetOrDescriptor","constructor"],"sources":["globals/decorators/host-listener.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Puts an event listener to an internal table for `@HostListener()`.\n *\n * @param type\n * The event type. Can be prefixed with `document:` or `window:`.\n * The event listener is attached to host element's owner document or its default view in such case.\n * @param options The event listener options.\n * @param Clazz The target class.\n * @param name The method name in the given target class that works as the event listener.\n */\nconst setHostListener = (\n type: string,\n options: boolean | AddEventListenerOptions,\n Clazz,\n name: string\n) => {\n const hostListeners = Clazz._hostListeners;\n if (!hostListeners) {\n throw new Error(\n 'The method `@HostListener()` is defined on has to be of a class that has `HostListerMixin`.'\n );\n }\n if (!hostListeners[name]) {\n hostListeners[name] = {};\n }\n hostListeners[name][type] = { options };\n};\n\n/**\n * @param type\n * The event type. Can be prefixed with `document:` or `window:`.\n * The event listener is attached to host element's owner document or its default view in such case.\n * @param options The event listener options.\n * @param descriptor The original class element descriptor of the event listener method.\n * @returns The updated class element descriptor with `@HostListener()` decorator.\n */\nconst HostListenerStandard = (\n type: string,\n options: boolean | AddEventListenerOptions,\n descriptor\n) => {\n const { kind, key, placement } = descriptor;\n if (\n !(\n (kind === 'method' && placement === 'prototype') ||\n (kind === 'field' && placement === 'own')\n )\n ) {\n throw new Error(\n '`@HostListener()` must be defined on instance methods, but you may have defined it on static, field, etc.'\n );\n }\n return {\n ...descriptor,\n finisher(Clazz) {\n setHostListener(type, options, Clazz, key);\n },\n };\n};\n\n/**\n * A decorator to add event listener to the host element, or its `document`/`window`, of a custom element.\n * The `target` must extend `HostListenerMixin`.\n *\n * @param type\n * The event type. Can be prefixed with `document:` or `window:`.\n * The event listener is attached to host element's owner document or its default view in such case.\n * @param options The event listener options.\n */\nconst HostListener =\n (type: string, options?: boolean | AddEventListenerOptions) =>\n (targetOrDescriptor, name: string) =>\n typeof name !== 'undefined'\n ? setHostListener(type, options!, targetOrDescriptor.constructor, name)\n : HostListenerStandard(type, options!, targetOrDescriptor);\n\nexport default HostListener;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,eAAe,GAAGA,CACtBC,IAAY,EACZC,OAA0C,EAC1CC,KAAK,EACLC,IAAY,KACT;EACH,MAAMC,aAAa,GAAGF,KAAK,CAACG,cAAc;EAC1C,IAAI,CAACD,aAAa,EAAE;IAClB,MAAM,IAAIE,KAAK,CACb,
|
|
1
|
+
{"version":3,"file":"host-listener.js","names":["setHostListener","type","options","Clazz","name","hostListeners","_hostListeners","Error","HostListenerStandard","descriptor","kind","key","placement","_objectSpread","finisher","HostListener","targetOrDescriptor","constructor"],"sources":["globals/decorators/host-listener.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2022\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * Puts an event listener to an internal table for `@HostListener()`.\n *\n * @param type\n * The event type. Can be prefixed with `document:` or `window:`.\n * The event listener is attached to host element's owner document or its default view in such case.\n * @param options The event listener options.\n * @param Clazz The target class.\n * @param name The method name in the given target class that works as the event listener.\n */\nconst setHostListener = (\n type: string,\n options: boolean | AddEventListenerOptions,\n Clazz,\n name: string\n) => {\n const hostListeners = Clazz._hostListeners;\n if (!hostListeners) {\n throw new Error(\n 'The method `@HostListener()` is defined on has to be of a class that has `HostListerMixin`.'\n );\n }\n if (!hostListeners[name]) {\n hostListeners[name] = {};\n }\n hostListeners[name][type] = { options };\n};\n\n/**\n * @param type\n * The event type. Can be prefixed with `document:` or `window:`.\n * The event listener is attached to host element's owner document or its default view in such case.\n * @param options The event listener options.\n * @param descriptor The original class element descriptor of the event listener method.\n * @returns The updated class element descriptor with `@HostListener()` decorator.\n */\nconst HostListenerStandard = (\n type: string,\n options: boolean | AddEventListenerOptions,\n descriptor\n) => {\n const { kind, key, placement } = descriptor;\n if (\n !(\n (kind === 'method' && placement === 'prototype') ||\n (kind === 'field' && placement === 'own')\n )\n ) {\n throw new Error(\n '`@HostListener()` must be defined on instance methods, but you may have defined it on static, field, etc.'\n );\n }\n return {\n ...descriptor,\n finisher(Clazz) {\n setHostListener(type, options, Clazz, key);\n },\n };\n};\n\n/**\n * A decorator to add event listener to the host element, or its `document`/`window`, of a custom element.\n * The `target` must extend `HostListenerMixin`.\n *\n * @param type\n * The event type. Can be prefixed with `document:` or `window:`.\n * The event listener is attached to host element's owner document or its default view in such case.\n * @param options The event listener options.\n */\nconst HostListener =\n (type: string, options?: boolean | AddEventListenerOptions) =>\n (targetOrDescriptor, name: string) =>\n typeof name !== 'undefined'\n ? setHostListener(type, options!, targetOrDescriptor.constructor, name)\n : HostListenerStandard(type, options!, targetOrDescriptor);\n\nexport default HostListener;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,eAAe,GAAGA,CACtBC,IAAY,EACZC,OAA0C,EAC1CC,KAAK,EACLC,IAAY,KACT;EACH,MAAMC,aAAa,GAAGF,KAAK,CAACG,cAAc;EAC1C,IAAI,CAACD,aAAa,EAAE;IAClB,MAAM,IAAIE,KAAK,CACb,6FACF,CAAC;EACH;EACA,IAAI,CAACF,aAAa,CAACD,IAAI,CAAC,EAAE;IACxBC,aAAa,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC;EAC1B;EACAC,aAAa,CAACD,IAAI,CAAC,CAACH,IAAI,CAAC,GAAG;IAAEC;EAAQ,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,oBAAoB,GAAGA,CAC3BP,IAAY,EACZC,OAA0C,EAC1CO,UAAU,KACP;EACH,MAAM;IAAEC,IAAI;IAAEC,GAAG;IAAEC;EAAU,CAAC,GAAGH,UAAU;EAC3C,IACE,EACGC,IAAI,KAAK,QAAQ,IAAIE,SAAS,KAAK,WAAW,IAC9CF,IAAI,KAAK,OAAO,IAAIE,SAAS,KAAK,KAAM,CAC1C,EACD;IACA,MAAM,IAAIL,KAAK,CACb,2GACF,CAAC;EACH;EACA,OAAAM,aAAA,CAAAA,aAAA,KACKJ,UAAU;IACbK,QAAQA,CAACX,KAAK,EAAE;MACdH,eAAe,CAACC,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAEQ,GAAG,CAAC;IAC5C;EAAC;AAEL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,YAAY,GAChBA,CAACd,IAAY,EAAEC,OAA2C,KAC1D,CAACc,kBAAkB,EAAEZ,IAAY,KAC/B,OAAOA,IAAI,KAAK,WAAW,GACvBJ,eAAe,CAACC,IAAI,EAAEC,OAAO,EAAGc,kBAAkB,CAACC,WAAW,EAAEb,IAAI,CAAC,GACrEI,oBAAoB,CAACP,IAAI,EAAEC,OAAO,EAAGc,kBAAkB,CAAC;AAEhE,eAAeD,YAAY"}
|
|
@@ -31,7 +31,7 @@ declare class SpreadDirective extends Directive {
|
|
|
31
31
|
* in the update() function.
|
|
32
32
|
*
|
|
33
33
|
* @param attributesInfo The key-value pair to be set as the attribute name/value pairs.
|
|
34
|
-
* @returns
|
|
34
|
+
* @returns the attributes info
|
|
35
35
|
*/
|
|
36
36
|
render(attributesInfo: AttributesInfo): AttributesInfo;
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["globals/directives/spread.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,SAAS,EACT,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAQD;;;;;;GAMG;AACH,cAAM,eAAgB,SAAQ,SAAS;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;IA8BvE;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,EAAE,cAAc;CAGtC;AAED,QAAA,MAAM,MAAM,0GAA6B,CAAC;AAE1C,eAAe,MAAM,CAAC","file":"spread.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n AttributePart,\n Directive,\n DirectiveParameters,\n} from 'lit/directive.js';\nimport { directive } from 'lit/async-directive.js';\n\nexport interface AttributesInfo {\n readonly [name: string]: string;\n}\n\n/**\n * Stores the ClassInfo object applied to a given AttributePart.\n * Used to unset existing values when a new ClassInfo object is applied.\n */\nconst attributesMapCache = new WeakMap();\n\n/**\n * A directive that applies attributes from a key-value pairs.\n * This must be used in the `...` name and must be the only part used in the attribute.\n * It applies the key-value pairs in the `attributesInfo` argument\n * and sets them as attribute name/value pairs.\n *\n */\nclass SpreadDirective extends Directive {\n /**\n * The update function that handles the attribute setting.\n *\n * @param part an object with an API to manage the element's DOM\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns the render function\n */\n update(part: AttributePart, [attributesInfo]: DirectiveParameters<this>) {\n const { element } = part;\n\n // Removes old attributes that are no longer there\n const oldAttributesInfo = attributesMapCache.get(part);\n if (oldAttributesInfo) {\n Object.keys(oldAttributesInfo).forEach((name) => {\n if (!(name in attributesInfo)) {\n element.removeAttribute(name);\n }\n });\n }\n\n // Adds new attributes\n Object.keys(attributesInfo).forEach((name) => {\n const value = attributesInfo[name];\n if (\n (!oldAttributesInfo || !Object.is(value, oldAttributesInfo[name])) &&\n typeof value !== 'undefined'\n ) {\n element.setAttribute(name, value);\n }\n });\n\n // Updates the cache\n attributesMapCache.set(part, attributesInfo);\n\n return this.render(attributesInfo);\n }\n\n /**\n * The rendering function that simply takes in the arguments to be used\n * in the update() function.\n *\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns\n */\n render(attributesInfo: AttributesInfo) {\n return attributesInfo;\n }\n}\n\nconst spread = directive(SpreadDirective);\n\nexport default spread;\n"]}
|
|
1
|
+
{"version":3,"sources":["globals/directives/spread.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,SAAS,EACT,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAQD;;;;;;GAMG;AACH,cAAM,eAAgB,SAAQ,SAAS;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,cAAc,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC;IA8BvE;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,EAAE,cAAc;CAGtC;AAED,QAAA,MAAM,MAAM,0GAA6B,CAAC;AAE1C,eAAe,MAAM,CAAC","file":"spread.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n AttributePart,\n Directive,\n DirectiveParameters,\n} from 'lit/directive.js';\nimport { directive } from 'lit/async-directive.js';\n\nexport interface AttributesInfo {\n readonly [name: string]: string;\n}\n\n/**\n * Stores the ClassInfo object applied to a given AttributePart.\n * Used to unset existing values when a new ClassInfo object is applied.\n */\nconst attributesMapCache = new WeakMap();\n\n/**\n * A directive that applies attributes from a key-value pairs.\n * This must be used in the `...` name and must be the only part used in the attribute.\n * It applies the key-value pairs in the `attributesInfo` argument\n * and sets them as attribute name/value pairs.\n *\n */\nclass SpreadDirective extends Directive {\n /**\n * The update function that handles the attribute setting.\n *\n * @param part an object with an API to manage the element's DOM\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns the render function\n */\n update(part: AttributePart, [attributesInfo]: DirectiveParameters<this>) {\n const { element } = part;\n\n // Removes old attributes that are no longer there\n const oldAttributesInfo = attributesMapCache.get(part);\n if (oldAttributesInfo) {\n Object.keys(oldAttributesInfo).forEach((name) => {\n if (!(name in attributesInfo)) {\n element.removeAttribute(name);\n }\n });\n }\n\n // Adds new attributes\n Object.keys(attributesInfo).forEach((name) => {\n const value = attributesInfo[name];\n if (\n (!oldAttributesInfo || !Object.is(value, oldAttributesInfo[name])) &&\n typeof value !== 'undefined'\n ) {\n element.setAttribute(name, value);\n }\n });\n\n // Updates the cache\n attributesMapCache.set(part, attributesInfo);\n\n return this.render(attributesInfo);\n }\n\n /**\n * The rendering function that simply takes in the arguments to be used\n * in the update() function.\n *\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns the attributes info\n */\n render(attributesInfo: AttributesInfo) {\n return attributesInfo;\n }\n}\n\nconst spread = directive(SpreadDirective);\n\nexport default spread;\n"]}
|
|
@@ -63,7 +63,7 @@ class SpreadDirective extends Directive {
|
|
|
63
63
|
* in the update() function.
|
|
64
64
|
*
|
|
65
65
|
* @param attributesInfo The key-value pair to be set as the attribute name/value pairs.
|
|
66
|
-
* @returns
|
|
66
|
+
* @returns the attributes info
|
|
67
67
|
*/
|
|
68
68
|
render(attributesInfo) {
|
|
69
69
|
return attributesInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spread.js","names":["Directive","directive","attributesMapCache","WeakMap","SpreadDirective","update","part","attributesInfo","element","oldAttributesInfo","get","Object","keys","forEach","name","removeAttribute","value","is","setAttribute","set","render","spread"],"sources":["globals/directives/spread.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n AttributePart,\n Directive,\n DirectiveParameters,\n} from 'lit/directive.js';\nimport { directive } from 'lit/async-directive.js';\n\nexport interface AttributesInfo {\n readonly [name: string]: string;\n}\n\n/**\n * Stores the ClassInfo object applied to a given AttributePart.\n * Used to unset existing values when a new ClassInfo object is applied.\n */\nconst attributesMapCache = new WeakMap();\n\n/**\n * A directive that applies attributes from a key-value pairs.\n * This must be used in the `...` name and must be the only part used in the attribute.\n * It applies the key-value pairs in the `attributesInfo` argument\n * and sets them as attribute name/value pairs.\n *\n */\nclass SpreadDirective extends Directive {\n /**\n * The update function that handles the attribute setting.\n *\n * @param part an object with an API to manage the element's DOM\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns the render function\n */\n update(part: AttributePart, [attributesInfo]: DirectiveParameters<this>) {\n const { element } = part;\n\n // Removes old attributes that are no longer there\n const oldAttributesInfo = attributesMapCache.get(part);\n if (oldAttributesInfo) {\n Object.keys(oldAttributesInfo).forEach((name) => {\n if (!(name in attributesInfo)) {\n element.removeAttribute(name);\n }\n });\n }\n\n // Adds new attributes\n Object.keys(attributesInfo).forEach((name) => {\n const value = attributesInfo[name];\n if (\n (!oldAttributesInfo || !Object.is(value, oldAttributesInfo[name])) &&\n typeof value !== 'undefined'\n ) {\n element.setAttribute(name, value);\n }\n });\n\n // Updates the cache\n attributesMapCache.set(part, attributesInfo);\n\n return this.render(attributesInfo);\n }\n\n /**\n * The rendering function that simply takes in the arguments to be used\n * in the update() function.\n *\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns\n */\n render(attributesInfo: AttributesInfo) {\n return attributesInfo;\n }\n}\n\nconst spread = directive(SpreadDirective);\n\nexport default spread;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,SAAS,QAEJ,kBAAkB;AACzB,SAASC,SAAS,QAAQ,wBAAwB;AAMlD;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,IAAIC,OAAO,
|
|
1
|
+
{"version":3,"file":"spread.js","names":["Directive","directive","attributesMapCache","WeakMap","SpreadDirective","update","part","attributesInfo","element","oldAttributesInfo","get","Object","keys","forEach","name","removeAttribute","value","is","setAttribute","set","render","spread"],"sources":["globals/directives/spread.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n AttributePart,\n Directive,\n DirectiveParameters,\n} from 'lit/directive.js';\nimport { directive } from 'lit/async-directive.js';\n\nexport interface AttributesInfo {\n readonly [name: string]: string;\n}\n\n/**\n * Stores the ClassInfo object applied to a given AttributePart.\n * Used to unset existing values when a new ClassInfo object is applied.\n */\nconst attributesMapCache = new WeakMap();\n\n/**\n * A directive that applies attributes from a key-value pairs.\n * This must be used in the `...` name and must be the only part used in the attribute.\n * It applies the key-value pairs in the `attributesInfo` argument\n * and sets them as attribute name/value pairs.\n *\n */\nclass SpreadDirective extends Directive {\n /**\n * The update function that handles the attribute setting.\n *\n * @param part an object with an API to manage the element's DOM\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns the render function\n */\n update(part: AttributePart, [attributesInfo]: DirectiveParameters<this>) {\n const { element } = part;\n\n // Removes old attributes that are no longer there\n const oldAttributesInfo = attributesMapCache.get(part);\n if (oldAttributesInfo) {\n Object.keys(oldAttributesInfo).forEach((name) => {\n if (!(name in attributesInfo)) {\n element.removeAttribute(name);\n }\n });\n }\n\n // Adds new attributes\n Object.keys(attributesInfo).forEach((name) => {\n const value = attributesInfo[name];\n if (\n (!oldAttributesInfo || !Object.is(value, oldAttributesInfo[name])) &&\n typeof value !== 'undefined'\n ) {\n element.setAttribute(name, value);\n }\n });\n\n // Updates the cache\n attributesMapCache.set(part, attributesInfo);\n\n return this.render(attributesInfo);\n }\n\n /**\n * The rendering function that simply takes in the arguments to be used\n * in the update() function.\n *\n * @param attributesInfo The key-value pair to be set as the attribute name/value pairs.\n * @returns the attributes info\n */\n render(attributesInfo: AttributesInfo) {\n return attributesInfo;\n }\n}\n\nconst spread = directive(SpreadDirective);\n\nexport default spread;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAEEA,SAAS,QAEJ,kBAAkB;AACzB,SAASC,SAAS,QAAQ,wBAAwB;AAMlD;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,IAAIC,OAAO,CAAC,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,SAASJ,SAAS,CAAC;EACtC;AACF;AACA;AACA;AACA;AACA;AACA;EACEK,MAAMA,CAACC,IAAmB,EAAE,CAACC,cAAc,CAA4B,EAAE;IACvE,MAAM;MAAEC;IAAQ,CAAC,GAAGF,IAAI;;IAExB;IACA,MAAMG,iBAAiB,GAAGP,kBAAkB,CAACQ,GAAG,CAACJ,IAAI,CAAC;IACtD,IAAIG,iBAAiB,EAAE;MACrBE,MAAM,CAACC,IAAI,CAACH,iBAAiB,CAAC,CAACI,OAAO,CAAEC,IAAI,IAAK;QAC/C,IAAI,EAAEA,IAAI,IAAIP,cAAc,CAAC,EAAE;UAC7BC,OAAO,CAACO,eAAe,CAACD,IAAI,CAAC;QAC/B;MACF,CAAC,CAAC;IACJ;;IAEA;IACAH,MAAM,CAACC,IAAI,CAACL,cAAc,CAAC,CAACM,OAAO,CAAEC,IAAI,IAAK;MAC5C,MAAME,KAAK,GAAGT,cAAc,CAACO,IAAI,CAAC;MAClC,IACE,CAAC,CAACL,iBAAiB,IAAI,CAACE,MAAM,CAACM,EAAE,CAACD,KAAK,EAAEP,iBAAiB,CAACK,IAAI,CAAC,CAAC,KACjE,OAAOE,KAAK,KAAK,WAAW,EAC5B;QACAR,OAAO,CAACU,YAAY,CAACJ,IAAI,EAAEE,KAAK,CAAC;MACnC;IACF,CAAC,CAAC;;IAEF;IACAd,kBAAkB,CAACiB,GAAG,CAACb,IAAI,EAAEC,cAAc,CAAC;IAE5C,OAAO,IAAI,CAACa,MAAM,CAACb,cAAc,CAAC;EACpC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEa,MAAMA,CAACb,cAA8B,EAAE;IACrC,OAAOA,cAAc;EACvB;AACF;AAEA,MAAMc,MAAM,GAAGpB,SAAS,CAACG,eAAe,CAAC;AAEzC,eAAeiB,MAAM"}
|
|
@@ -21,11 +21,10 @@ export let NAVIGATION_DIRECTION;
|
|
|
21
21
|
* There must be only one instance for one document.
|
|
22
22
|
*/
|
|
23
23
|
class RadioGroupManager {
|
|
24
|
-
/**
|
|
25
|
-
* Radio groups, keyed by their names.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
24
|
constructor(document) {
|
|
25
|
+
/**
|
|
26
|
+
* Radio groups, keyed by their names.
|
|
27
|
+
*/
|
|
29
28
|
_defineProperty(this, "_groups", {});
|
|
30
29
|
this.constructor._instances.set(document, this);
|
|
31
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group-manager.js","names":["NAVIGATION_DIRECTION","RadioGroupManager","constructor","document","_defineProperty","_instances","set","shouldBeFocusable","radio","checked","name","group","_groups","hasSelectedItemInGroup","Array","from","some","item","isFirstInGroup","size","getSortedGroup","sort","lhs","rhs","comparisonResult","compareDocumentPosition","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_CONTAINED_BY","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","add","groups","Set","delete","select","readOnly","tabIndex","focus","forEach","navigate","direction","sortedGroup","newIndex","indexOf","length","get","found","WeakMap"],"sources":["globals/internal/radio-group-manager.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * The navigation direction.\n */\nexport enum NAVIGATION_DIRECTION {\n /**\n * Navigating backward.\n */\n BACKWARD = -1,\n\n /**\n * Navigating forward.\n */\n FORWARD = 1,\n}\n\nexport interface ManagedRadioButtonDelegate {\n /**\n * `true` if this radio button is selected.\n */\n checked: boolean;\n\n /**\n * The tab index.\n */\n tabIndex: number;\n\n /**\n * The name of the radio group.\n */\n name: string;\n\n /**\n * @param other A node to compare this radio button's DOM position in document with.\n * @returns\n * An integer value, the same format as `Node.compareDocumentPosition` does,\n * whose bits represent the calling this radio button's relationship to the given node within the document.\n */\n compareDocumentPosition(other: ManagedRadioButtonDelegate): number;\n\n /**\n * Focuses on the radio button.\n */\n focus(): void;\n}\n\ntype ManagedRadioButton = HTMLInputElement | ManagedRadioButtonDelegate;\n\n/**\n * An object that manages radio groups in a document.\n * There must be only one instance for one document.\n */\nclass RadioGroupManager {\n /**\n * Radio groups, keyed by their names.\n */\n private _groups: { [name: string]: Set<ManagedRadioButton> } = {};\n\n private constructor(document: Document) {\n (this.constructor as typeof RadioGroupManager)._instances.set(\n document,\n this\n );\n }\n\n /**\n * @param radio A radio button.\n * @returns\n * `true` if the given radio button should be focusable, which is either:\n * - The radio button is selected\n * - No radio button is selected and the radio button is first one in the radio group\n */\n shouldBeFocusable(radio: ManagedRadioButton) {\n if (radio.checked) {\n return true;\n }\n const { name } = radio;\n const group = this._groups[name];\n const hasSelectedItemInGroup =\n group && Array.from(group).some((item) => item.checked);\n if (hasSelectedItemInGroup) {\n return false;\n }\n const isFirstInGroup =\n !group || group.size === 1 || this.getSortedGroup(radio)[0] === radio;\n return isFirstInGroup;\n }\n\n /**\n * @param radio A radio button.\n * @returns The sorted radio group the given radio button is in.\n */\n getSortedGroup(radio: ManagedRadioButton) {\n const group = this._groups[radio.name];\n return (\n group &&\n Array.from(group).sort((lhs, rhs) => {\n const comparisonResult = (\n lhs as ManagedRadioButtonDelegate\n ).compareDocumentPosition(rhs as ManagedRadioButtonDelegate);\n // eslint-disable-next-line no-bitwise\n if (\n comparisonResult & Node.DOCUMENT_POSITION_FOLLOWING ||\n comparisonResult & Node.DOCUMENT_POSITION_CONTAINED_BY\n ) {\n return -1;\n }\n // eslint-disable-next-line no-bitwise\n if (\n comparisonResult & Node.DOCUMENT_POSITION_PRECEDING ||\n comparisonResult & Node.DOCUMENT_POSITION_CONTAINS\n ) {\n return 1;\n }\n return 0;\n })\n );\n }\n\n /**\n * Manages a radio button.\n *\n * @param radio The radio button to manage.\n * @returns This object.\n */\n add(radio: ManagedRadioButton) {\n const { name } = radio;\n if (name) {\n const groups = this._groups;\n if (!groups[name]) {\n groups[name] = new Set<ManagedRadioButton>();\n }\n groups[name].add(radio);\n }\n return this;\n }\n\n /**\n * Unmanages a radio button.\n *\n * @param radio The radio button to unmanage.\n * @param name The old name of the radio button to unmanage.\n * @returns `true` if `element` was actually managed.\n */\n delete(radio: ManagedRadioButton, name: string = radio.name) {\n const group = this._groups[name];\n return !group ? false : group.delete(radio);\n }\n\n /**\n * Selects or focuses on a radio button.\n *\n * @param radio The radio button to select.\n * @param readOnly optional if radio button has readOnly.\n */\n select(radio: ManagedRadioButton, readOnly?: boolean) {\n const group = this._groups[radio.name];\n if (group) {\n // Updates the state of the one being selected up-front to avoid the state of no radio button is selected\n radio.checked = !readOnly || true;\n radio.tabIndex = 0;\n radio.focus();\n group.forEach((item) => {\n if (radio !== item) {\n item.checked = readOnly || false;\n item.tabIndex = -1;\n }\n });\n }\n }\n\n /**\n * @param radio The currently selected radio button.\n * @param direction The direction to navigate to.\n * @returns The radio button that should be selected next.\n */\n navigate(radio: ManagedRadioButton, direction: NAVIGATION_DIRECTION) {\n const sortedGroup = this.getSortedGroup(radio);\n let newIndex = sortedGroup.indexOf(radio) + direction;\n if (newIndex < 0) {\n newIndex = sortedGroup.length - 1;\n } else if (newIndex >= sortedGroup.length) {\n newIndex = 0;\n }\n return sortedGroup[newIndex];\n }\n\n /**\n * `RadioGroupManager` instances associated with documents.\n */\n private static _instances = new WeakMap();\n\n /**\n * @param document A document element.\n * @returns The `RadioGroupManager` instance associated with the given document.\n */\n static get(document: Document) {\n const found = this._instances.get(document);\n return found || new RadioGroupManager(document);\n }\n}\n\nexport default RadioGroupManager;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,oBAAoB;AAU/B,WAVWA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,KAApBA,oBAAoB;AA4ChC;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"radio-group-manager.js","names":["NAVIGATION_DIRECTION","RadioGroupManager","constructor","document","_defineProperty","_instances","set","shouldBeFocusable","radio","checked","name","group","_groups","hasSelectedItemInGroup","Array","from","some","item","isFirstInGroup","size","getSortedGroup","sort","lhs","rhs","comparisonResult","compareDocumentPosition","Node","DOCUMENT_POSITION_FOLLOWING","DOCUMENT_POSITION_CONTAINED_BY","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","add","groups","Set","delete","select","readOnly","tabIndex","focus","forEach","navigate","direction","sortedGroup","newIndex","indexOf","length","get","found","WeakMap"],"sources":["globals/internal/radio-group-manager.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2023\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/**\n * The navigation direction.\n */\nexport enum NAVIGATION_DIRECTION {\n /**\n * Navigating backward.\n */\n BACKWARD = -1,\n\n /**\n * Navigating forward.\n */\n FORWARD = 1,\n}\n\nexport interface ManagedRadioButtonDelegate {\n /**\n * `true` if this radio button is selected.\n */\n checked: boolean;\n\n /**\n * The tab index.\n */\n tabIndex: number;\n\n /**\n * The name of the radio group.\n */\n name: string;\n\n /**\n * @param other A node to compare this radio button's DOM position in document with.\n * @returns\n * An integer value, the same format as `Node.compareDocumentPosition` does,\n * whose bits represent the calling this radio button's relationship to the given node within the document.\n */\n compareDocumentPosition(other: ManagedRadioButtonDelegate): number;\n\n /**\n * Focuses on the radio button.\n */\n focus(): void;\n}\n\ntype ManagedRadioButton = HTMLInputElement | ManagedRadioButtonDelegate;\n\n/**\n * An object that manages radio groups in a document.\n * There must be only one instance for one document.\n */\nclass RadioGroupManager {\n /**\n * Radio groups, keyed by their names.\n */\n private _groups: { [name: string]: Set<ManagedRadioButton> } = {};\n\n private constructor(document: Document) {\n (this.constructor as typeof RadioGroupManager)._instances.set(\n document,\n this\n );\n }\n\n /**\n * @param radio A radio button.\n * @returns\n * `true` if the given radio button should be focusable, which is either:\n * - The radio button is selected\n * - No radio button is selected and the radio button is first one in the radio group\n */\n shouldBeFocusable(radio: ManagedRadioButton) {\n if (radio.checked) {\n return true;\n }\n const { name } = radio;\n const group = this._groups[name];\n const hasSelectedItemInGroup =\n group && Array.from(group).some((item) => item.checked);\n if (hasSelectedItemInGroup) {\n return false;\n }\n const isFirstInGroup =\n !group || group.size === 1 || this.getSortedGroup(radio)[0] === radio;\n return isFirstInGroup;\n }\n\n /**\n * @param radio A radio button.\n * @returns The sorted radio group the given radio button is in.\n */\n getSortedGroup(radio: ManagedRadioButton) {\n const group = this._groups[radio.name];\n return (\n group &&\n Array.from(group).sort((lhs, rhs) => {\n const comparisonResult = (\n lhs as ManagedRadioButtonDelegate\n ).compareDocumentPosition(rhs as ManagedRadioButtonDelegate);\n // eslint-disable-next-line no-bitwise\n if (\n comparisonResult & Node.DOCUMENT_POSITION_FOLLOWING ||\n comparisonResult & Node.DOCUMENT_POSITION_CONTAINED_BY\n ) {\n return -1;\n }\n // eslint-disable-next-line no-bitwise\n if (\n comparisonResult & Node.DOCUMENT_POSITION_PRECEDING ||\n comparisonResult & Node.DOCUMENT_POSITION_CONTAINS\n ) {\n return 1;\n }\n return 0;\n })\n );\n }\n\n /**\n * Manages a radio button.\n *\n * @param radio The radio button to manage.\n * @returns This object.\n */\n add(radio: ManagedRadioButton) {\n const { name } = radio;\n if (name) {\n const groups = this._groups;\n if (!groups[name]) {\n groups[name] = new Set<ManagedRadioButton>();\n }\n groups[name].add(radio);\n }\n return this;\n }\n\n /**\n * Unmanages a radio button.\n *\n * @param radio The radio button to unmanage.\n * @param name The old name of the radio button to unmanage.\n * @returns `true` if `element` was actually managed.\n */\n delete(radio: ManagedRadioButton, name: string = radio.name) {\n const group = this._groups[name];\n return !group ? false : group.delete(radio);\n }\n\n /**\n * Selects or focuses on a radio button.\n *\n * @param radio The radio button to select.\n * @param readOnly optional if radio button has readOnly.\n */\n select(radio: ManagedRadioButton, readOnly?: boolean) {\n const group = this._groups[radio.name];\n if (group) {\n // Updates the state of the one being selected up-front to avoid the state of no radio button is selected\n radio.checked = !readOnly || true;\n radio.tabIndex = 0;\n radio.focus();\n group.forEach((item) => {\n if (radio !== item) {\n item.checked = readOnly || false;\n item.tabIndex = -1;\n }\n });\n }\n }\n\n /**\n * @param radio The currently selected radio button.\n * @param direction The direction to navigate to.\n * @returns The radio button that should be selected next.\n */\n navigate(radio: ManagedRadioButton, direction: NAVIGATION_DIRECTION) {\n const sortedGroup = this.getSortedGroup(radio);\n let newIndex = sortedGroup.indexOf(radio) + direction;\n if (newIndex < 0) {\n newIndex = sortedGroup.length - 1;\n } else if (newIndex >= sortedGroup.length) {\n newIndex = 0;\n }\n return sortedGroup[newIndex];\n }\n\n /**\n * `RadioGroupManager` instances associated with documents.\n */\n private static _instances = new WeakMap();\n\n /**\n * @param document A document element.\n * @returns The `RadioGroupManager` instance associated with the given document.\n */\n static get(document: Document) {\n const found = this._instances.get(document);\n return found || new RadioGroupManager(document);\n }\n}\n\nexport default RadioGroupManager;\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,oBAAoB;AAU/B,WAVWA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;EAApBA,oBAAoB,CAApBA,oBAAoB;AAAA,GAApBA,oBAAoB,KAApBA,oBAAoB;AA4ChC;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,CAAC;EAMdC,WAAWA,CAACC,QAAkB,EAAE;IALxC;AACF;AACA;IAFEC,eAAA,kBAG+D,CAAC,CAAC;IAG9D,IAAI,CAACF,WAAW,CAA8BG,UAAU,CAACC,GAAG,CAC3DH,QAAQ,EACR,IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEI,iBAAiBA,CAACC,KAAyB,EAAE;IAC3C,IAAIA,KAAK,CAACC,OAAO,EAAE;MACjB,OAAO,IAAI;IACb;IACA,MAAM;MAAEC;IAAK,CAAC,GAAGF,KAAK;IACtB,MAAMG,KAAK,GAAG,IAAI,CAACC,OAAO,CAACF,IAAI,CAAC;IAChC,MAAMG,sBAAsB,GAC1BF,KAAK,IAAIG,KAAK,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,IAAI,CAAEC,IA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