@carbon/web-components 2.10.0 → 2.11.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{16-c82d5cfd.js → 16-486ace1a.js} +6 -6
- package/dist/{16-86616f6a.js → 16-51a594ce.js} +6 -6
- package/dist/16-656090c0.js +73 -0
- package/dist/{16-9bfd003b.js → 16-71872213.js} +6 -6
- package/dist/{16-e3da4022.js → 16-730a41a2.js} +6 -6
- package/dist/{16-6f99b9d8.js → 16-83a1cd89.js} +6 -6
- package/dist/{16-b507d4ba.js → 16-b73c677b.js} +6 -6
- package/dist/{16-3e28b02c.js → 16-d1c73001.js} +6 -6
- package/dist/{16-8688d7b7.js → 20-d069d8da.js} +6 -6
- package/dist/accordion.min.js +12 -12
- package/dist/ai-skeleton.min.js +6 -6
- package/dist/breadcrumb.min.js +6 -6
- package/dist/{button-690db41b.js → button-21c75bab.js} +6 -6
- package/dist/{button-set-4d1a3543.js → button-set-69863a24.js} +6 -6
- package/dist/{button-skeleton-efe28069.js → button-skeleton-1abc1fd8.js} +7 -7
- package/dist/button.min.js +6 -6
- package/dist/carbon-element-4ca9803f.js +5 -5
- package/dist/chat-button.min.js +6 -6
- package/dist/checkbox-d0a3a79f.js +109 -0
- package/dist/checkbox.min.js +6 -6
- package/dist/{class-map-40d6e892.js → class-map-5edb95da.js} +7 -7
- package/dist/code-snippet.min.js +14 -14
- package/dist/collection-helpers-4e32fe16.js +5 -5
- package/dist/combo-box.min.js +6 -6
- package/dist/{content-switcher-item-557f043e.js → content-switcher-item-5b8dd42f.js} +6 -6
- package/dist/content-switcher.min.js +6 -6
- package/dist/{copy-button-77c9a2be.js → copy-button-0cfa83bd.js} +6 -6
- package/dist/copy-button.min.js +6 -6
- package/dist/custom-element-975be15f.js +5 -5
- package/dist/data-table.min.js +8 -8
- package/dist/date-picker.min.js +6 -6
- package/dist/{defineProperty-1c81c535.js → defineProperty-e448b551.js} +6 -6
- package/dist/directive-e2d48b9c.js +5 -5
- package/dist/dropdown-item-91b3dc95.js +148 -0
- package/dist/dropdown.min.js +6 -6
- package/dist/file-uploader.min.js +6 -6
- package/dist/{floating-menu-ee49fedd.js → floating-menu-46199beb.js} +7 -7
- package/dist/floating-menu.min.js +6 -6
- package/dist/{focus-28af17cd.js → focus-e70d1cbe.js} +7 -7
- package/dist/form-group.min.js +6 -6
- package/dist/form.min.js +6 -6
- package/dist/{get-d229c408.js → get-52a048b1.js} +6 -6
- package/dist/{host-listener-1093b8af.js → host-listener-b6a3d690.js} +7 -7
- package/dist/{icon-button-8c199f5d.js → icon-button-37322eeb.js} +6 -6
- package/dist/icon-button.min.js +6 -6
- package/dist/{if-defined-87ba0c08.js → if-defined-2e09d22b.js} +6 -6
- package/dist/{if-non-empty-a1c6e0fe.js → if-non-empty-20ce3c96.js} +7 -7
- package/dist/inline-loading.min.js +6 -6
- package/dist/{layer-c557b485.js → layer-0633200a.js} +6 -6
- package/dist/layer.min.js +6 -6
- package/dist/{link-49d03ffa.js → link-dc6f9b4e.js} +9 -9
- package/dist/link.min.js +6 -6
- package/dist/list.min.js +6 -6
- package/dist/{loading-358d36a7.js → loading-2604f4ad.js} +6 -6
- package/dist/{loading-icon-4d90d624.js → loading-icon-85b7e502.js} +8 -8
- package/dist/loading.min.js +6 -6
- package/dist/{modal-label-f7bb6b21.js → modal-label-d53c98de.js} +10 -10
- package/dist/modal.min.js +6 -6
- package/dist/multi-select.min.js +9 -9
- package/dist/notification.min.js +14 -14
- package/dist/number-input.min.js +6 -6
- package/dist/{objectSpread2-97102dd8.js → objectSpread2-46e4de7a.js} +6 -6
- package/dist/on-6c264d49.js +5 -5
- package/dist/overflow-menu.min.js +6 -6
- package/dist/pagination.min.js +6 -6
- package/dist/{popover-content-2a2998fe.js → popover-content-11101167.js} +6 -6
- package/dist/popover-controller-cc6ccb74.js +73 -0
- package/dist/popover.min.js +6 -6
- package/dist/progress-bar.min.js +6 -6
- package/dist/progress-indicator.min.js +6 -6
- package/dist/query-5f833318.js +5 -5
- package/dist/query-assigned-elements-73bd2544.js +5 -5
- package/dist/radio-button.min.js +6 -6
- package/dist/{radio-group-manager-aa09b989.js → radio-group-manager-de7f9ab3.js} +6 -6
- package/dist/{search-d48abba3.js → search-1b5a2d87.js} +6 -6
- package/dist/search.min.js +6 -6
- package/dist/{select-item-ddced627.js → select-item-4ebf72a0.js} +6 -6
- package/dist/select.min.js +15 -15
- package/dist/{settings-2211e02a.js → settings-97cd1c3a.js} +6 -6
- package/dist/shared-enums-c6fe8c39.js +5 -5
- package/dist/side-panel.min.js +7 -7
- package/dist/{skeleton-icon-0f8941b3.js → skeleton-icon-bfc7d5c8.js} +6 -6
- package/dist/skeleton-icon.min.js +6 -6
- package/dist/{skeleton-placeholder-80d37e68.js → skeleton-placeholder-403f26a3.js} +6 -6
- package/dist/skeleton-placeholder.min.js +6 -6
- package/dist/{skeleton-text-2f44cf41.js → skeleton-text-9d02604f.js} +6 -6
- package/dist/skeleton-text.min.js +6 -6
- package/dist/skip-to-content.min.js +7 -7
- package/dist/slider.min.js +6 -6
- package/dist/slug.min.js +6 -6
- package/dist/{spread-c0d6f8ee.js → spread-d515f3f1.js} +7 -7
- package/dist/stack.min.js +6 -6
- package/dist/state-ddd29b9d.js +5 -5
- package/dist/structured-list.min.js +9 -9
- package/dist/tabs.min.js +7 -7
- package/dist/tag.min.js +9 -9
- package/dist/tearsheet.min.js +9 -9
- package/dist/{text-input-06f2796d.js → text-input-672028f4.js} +6 -6
- package/dist/text-input.min.js +6 -6
- package/dist/textarea.min.js +10 -10
- package/dist/tile.min.js +6 -6
- package/dist/toggle-tip.min.js +6 -6
- package/dist/toggle.min.js +6 -6
- package/dist/{toggletip-586fce1e.js → toggletip-b1b58c28.js} +7 -7
- package/dist/{tooltip-content-7e00430f.js → tooltip-content-51c6ffbc.js} +6 -6
- package/dist/tooltip.min.js +6 -6
- package/dist/ui-shell.min.js +19 -19
- package/dist/validity-d86ffa4f.js +5 -5
- package/es/components/accordion/accordion-item-skeleton.js.map +1 -1
- package/es/components/accordion/accordion-item.d.ts +47 -44
- 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.js.map +1 -1
- package/es/components/ai-skeleton/ai-skeleton-icon.js.map +1 -1
- package/es/components/ai-skeleton/ai-skeleton-placeholder.js.map +1 -1
- package/es/components/ai-skeleton/ai-skeleton-text.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb-item.js.map +1 -1
- package/es/components/breadcrumb/breadcrumb-link.js.map +1 -1
- 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.js.map +1 -1
- package/es/components/button/button-set-base.js.map +1 -1
- package/es/components/button/button-set.js.map +1 -1
- package/es/components/button/button-skeleton.js.map +1 -1
- package/es/components/button/button.d.ts +99 -92
- package/es/components/button/button.js.map +1 -1
- package/es/components/chat-button/chat-button-skeleton.js.map +1 -1
- package/es/components/chat-button/chat-button.js.map +1 -1
- package/es/components/checkbox/checkbox-group.d.ts +2 -1
- package/es/components/checkbox/checkbox-group.js.map +1 -1
- package/es/components/checkbox/checkbox-skeleton.js.map +1 -1
- package/es/components/checkbox/checkbox.css.js +1 -1
- package/es/components/checkbox/checkbox.d.ts +97 -90
- package/es/components/checkbox/checkbox.js.map +1 -1
- package/es/components/code-snippet/code-snippet-skeleton.js.map +1 -1
- package/es/components/code-snippet/code-snippet.d.ts +49 -45
- package/es/components/code-snippet/code-snippet.js.map +1 -1
- 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.js.map +1 -1
- package/es/components/content-switcher/content-switcher-item.d.ts +49 -45
- package/es/components/content-switcher/content-switcher-item.js.map +1 -1
- package/es/components/content-switcher/content-switcher.js.map +1 -1
- package/es/components/copy/copy.js.map +1 -1
- package/es/components/copy-button/copy-button.d.ts +47 -44
- package/es/components/copy-button/copy-button.js.map +1 -1
- package/es/components/data-table/data-table.css.js +1 -1
- package/es/components/data-table/table-batch-actions.js.map +1 -1
- package/es/components/data-table/table-body.js.map +1 -1
- package/es/components/data-table/table-cell-content.js.map +1 -1
- package/es/components/data-table/table-cell.js.map +1 -1
- package/es/components/data-table/table-expanded-row.d.ts +49 -46
- package/es/components/data-table/table-expanded-row.js.map +1 -1
- package/es/components/data-table/table-head.js.map +1 -1
- package/es/components/data-table/table-header-cell.d.ts +49 -45
- package/es/components/data-table/table-header-cell.js.map +1 -1
- package/es/components/data-table/table-header-description.js.map +1 -1
- package/es/components/data-table/table-header-row.js.map +1 -1
- package/es/components/data-table/table-header-title.js.map +1 -1
- package/es/components/data-table/table-row.d.ts +97 -91
- 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.js.map +1 -1
- package/es/components/data-table/table-toolbar-search.d.ts +51 -47
- package/es/components/data-table/table-toolbar-search.js.map +1 -1
- package/es/components/data-table/table-toolbar.js.map +1 -1
- package/es/components/data-table/table.d.ts +49 -46
- 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/date-picker-input-skeleton.js.map +1 -1
- package/es/components/date-picker/date-picker-input.d.ts +49 -45
- package/es/components/date-picker/date-picker-input.js.map +1 -1
- package/es/components/date-picker/date-picker.d.ts +98 -92
- package/es/components/date-picker/date-picker.js.map +1 -1
- package/es/components/dropdown/dropdown-item.js.map +1 -1
- 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 +196 -183
- package/es/components/dropdown/dropdown.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 +49 -46
- package/es/components/file-uploader/file-uploader-button.js.map +1 -1
- package/es/components/file-uploader/file-uploader-drop-container.d.ts +49 -46
- package/es/components/file-uploader/file-uploader-drop-container.js.map +1 -1
- package/es/components/file-uploader/file-uploader-item.js.map +1 -1
- package/es/components/file-uploader/file-uploader-skeleton.js.map +1 -1
- package/es/components/file-uploader/file-uploader.js.map +1 -1
- package/es/components/floating-menu/floating-menu.d.ts +100 -93
- package/es/components/floating-menu/floating-menu.js.map +1 -1
- package/es/components/form/form-item.js.map +1 -1
- package/es/components/form-group/form-group.js.map +1 -1
- package/es/components/icon-button/icon-button.js.map +1 -1
- package/es/components/inline-loading/inline-loading.js.map +1 -1
- package/es/components/layer/layer.js.map +1 -1
- package/es/components/link/link.d.ts +49 -45
- package/es/components/link/link.js.map +1 -1
- package/es/components/list/list-item.js.map +1 -1
- package/es/components/list/ordered-list.js.map +1 -1
- package/es/components/list/unordered-list.js.map +1 -1
- package/es/components/loading/loading-icon.js.map +1 -1
- package/es/components/loading/loading.js.map +1 -1
- package/es/components/modal/modal-body-content.js.map +1 -1
- package/es/components/modal/modal-body.js.map +1 -1
- package/es/components/modal/modal-close-button.d.ts +49 -45
- package/es/components/modal/modal-close-button.js.map +1 -1
- package/es/components/modal/modal-footer-button.js.map +1 -1
- package/es/components/modal/modal-footer.js.map +1 -1
- package/es/components/modal/modal-header.js.map +1 -1
- package/es/components/modal/modal-heading.js.map +1 -1
- 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 +49 -46
- package/es/components/modal/modal.js.map +1 -1
- 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.js.map +1 -1
- package/es/components/notification/actionable-notification-button.js.map +1 -1
- package/es/components/notification/actionable-notification.d.ts +49 -46
- package/es/components/notification/actionable-notification.js.map +1 -1
- package/es/components/notification/inline-notification.d.ts +47 -44
- package/es/components/notification/inline-notification.js.map +1 -1
- package/es/components/notification/toast-notification.js.map +1 -1
- package/es/components/number-input/number-input-skeleton.js.map +1 -1
- package/es/components/number-input/number-input.d.ts +2 -1
- package/es/components/number-input/number-input.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu-body.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu-item.d.ts +49 -45
- package/es/components/overflow-menu/overflow-menu-item.js.map +1 -1
- package/es/components/overflow-menu/overflow-menu.d.ts +97 -91
- package/es/components/overflow-menu/overflow-menu.js.map +1 -1
- package/es/components/pagination/pagination.d.ts +98 -91
- package/es/components/pagination/pagination.js.map +1 -1
- package/es/components/popover/popover-content.js.map +1 -1
- package/es/components/popover/popover.js.map +1 -1
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/progress-indicator/progress-indicator-skeleton.js.map +1 -1
- package/es/components/progress-indicator/progress-indicator.js.map +1 -1
- package/es/components/progress-indicator/progress-step-skeleton.js.map +1 -1
- package/es/components/progress-indicator/progress-step.d.ts +49 -45
- package/es/components/progress-indicator/progress-step.js.map +1 -1
- package/es/components/radio-button/radio-button-group.d.ts +98 -92
- package/es/components/radio-button/radio-button-group.js.map +1 -1
- package/es/components/radio-button/radio-button-skeleton.js.map +1 -1
- package/es/components/radio-button/radio-button.d.ts +99 -92
- package/es/components/radio-button/radio-button.js.map +1 -1
- package/es/components/search/search-skeleton.js.map +1 -1
- package/es/components/search/search.d.ts +148 -138
- package/es/components/search/search.js.map +1 -1
- package/es/components/select/select-item-group.js.map +1 -1
- package/es/components/select/select-item.js.map +1 -1
- package/es/components/select/select-skeleton.js.map +1 -1
- package/es/components/select/select.d.ts +51 -47
- package/es/components/select/select.js.map +1 -1
- package/es/components/side-panel/side-panel.css.js +1 -1
- package/es/components/side-panel/side-panel.d.ts +49 -46
- package/es/components/side-panel/side-panel.js.map +1 -1
- package/es/components/skeleton-icon/skeleton-icon.js.map +1 -1
- package/es/components/skeleton-placeholder/skeleton-placeholder.js.map +1 -1
- package/es/components/skeleton-text/skeleton-text.js.map +1 -1
- package/es/components/skip-to-content/skip-to-content.d.ts +49 -45
- package/es/components/skip-to-content/skip-to-content.js.map +1 -1
- package/es/components/slider/slider-input.d.ts +49 -45
- package/es/components/slider/slider-input.js.map +1 -1
- package/es/components/slider/slider-skeleton.js.map +1 -1
- package/es/components/slider/slider.d.ts +148 -138
- package/es/components/slider/slider.js.map +1 -1
- package/es/components/slug/slug-action-button.js.map +1 -1
- package/es/components/slug/slug.css.js +1 -1
- package/es/components/slug/slug.js.map +1 -1
- package/es/components/stack/stack.js.map +1 -1
- package/es/components/structured-list/structured-list-body.js.map +1 -1
- package/es/components/structured-list/structured-list-cell.js.map +1 -1
- package/es/components/structured-list/structured-list-head.js.map +1 -1
- package/es/components/structured-list/structured-list-header-cell-skeleton.js.map +1 -1
- package/es/components/structured-list/structured-list-header-cell.js.map +1 -1
- package/es/components/structured-list/structured-list-header-row.js.map +1 -1
- package/es/components/structured-list/structured-list-row.d.ts +49 -46
- 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 +49 -45
- package/es/components/structured-list/structured-list.js.map +1 -1
- package/es/components/tabs/tab-skeleton.js.map +1 -1
- package/es/components/tabs/tab.js.map +1 -1
- 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 +49 -46
- package/es/components/tabs/tabs.js.map +1 -1
- package/es/components/tag/tag.css.js +1 -1
- package/es/components/tag/tag.d.ts +97 -91
- package/es/components/tag/tag.js.map +1 -1
- package/es/components/tearsheet/tearsheet.css.js +1 -1
- package/es/components/tearsheet/tearsheet.d.ts +49 -46
- package/es/components/tearsheet/tearsheet.js.map +1 -1
- package/es/components/text-input/text-input-skeleton.js.map +1 -1
- package/es/components/text-input/text-input.d.ts +98 -91
- package/es/components/text-input/text-input.js.map +1 -1
- 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 +2 -1
- package/es/components/textarea/textarea.js.map +1 -1
- package/es/components/tile/clickable-tile.js.map +1 -1
- package/es/components/tile/expandable-tile.d.ts +97 -91
- package/es/components/tile/expandable-tile.js.map +1 -1
- package/es/components/tile/radio-tile.js.map +1 -1
- package/es/components/tile/selectable-tile.d.ts +99 -92
- package/es/components/tile/selectable-tile.js.map +1 -1
- package/es/components/tile/tile-group.d.ts +49 -46
- package/es/components/tile/tile-group.js.map +1 -1
- package/es/components/tile/tile.css.js +1 -1
- package/es/components/tile/tile.js.map +1 -1
- package/es/components/toggle/toggle.d.ts +50 -49
- package/es/components/toggle/toggle.js.map +1 -1
- package/es/components/toggle-tip/toggletip.css.js +1 -1
- package/es/components/toggle-tip/toggletip.d.ts +99 -92
- package/es/components/toggle-tip/toggletip.js.map +1 -1
- package/es/components/tooltip/tooltip-content.js.map +1 -1
- package/es/components/tooltip/tooltip.d.ts +49 -46
- package/es/components/tooltip/tooltip.js.map +1 -1
- package/es/components/ui-shell/header-global-action.d.ts +2 -1
- package/es/components/ui-shell/header-global-action.js.map +1 -1
- package/es/components/ui-shell/header-menu-button.d.ts +49 -45
- package/es/components/ui-shell/header-menu-button.js.map +1 -1
- package/es/components/ui-shell/header-menu-item.js.map +1 -1
- package/es/components/ui-shell/header-menu.d.ts +99 -92
- package/es/components/ui-shell/header-menu.js.map +1 -1
- package/es/components/ui-shell/header-name.d.ts +49 -45
- package/es/components/ui-shell/header-name.js.map +1 -1
- package/es/components/ui-shell/header-nav-item.d.ts +49 -45
- package/es/components/ui-shell/header-nav-item.js.map +1 -1
- package/es/components/ui-shell/header-nav.js.map +1 -1
- package/es/components/ui-shell/header-panel.d.ts +2 -1
- package/es/components/ui-shell/header-panel.js.map +1 -1
- package/es/components/ui-shell/header-side-nav-items.js.map +1 -1
- package/es/components/ui-shell/header.js.map +1 -1
- package/es/components/ui-shell/side-nav-divider.js.map +1 -1
- package/es/components/ui-shell/side-nav-items.js.map +1 -1
- package/es/components/ui-shell/side-nav-link.d.ts +49 -45
- package/es/components/ui-shell/side-nav-link.js.map +1 -1
- package/es/components/ui-shell/side-nav-menu-item.d.ts +49 -45
- package/es/components/ui-shell/side-nav-menu-item.js.map +1 -1
- package/es/components/ui-shell/side-nav-menu.d.ts +49 -45
- package/es/components/ui-shell/side-nav-menu.js.map +1 -1
- package/es/components/ui-shell/side-nav.d.ts +50 -56
- package/es/components/ui-shell/side-nav.js +5 -47
- package/es/components/ui-shell/side-nav.js.map +1 -1
- package/es/components/ui-shell/switcher-divider.js.map +1 -1
- package/es/components/ui-shell/switcher-item.d.ts +49 -45
- package/es/components/ui-shell/switcher-item.js.map +1 -1
- package/es/components/ui-shell/switcher.d.ts +2 -1
- package/es/components/ui-shell/switcher.js.map +1 -1
- package/es/globals/controllers/popover-controller.js.map +1 -1
- package/es/globals/decorators/carbon-element.js.map +1 -1
- package/es/globals/internal/storybook-cdn.js.map +1 -1
- package/es/globals/mixins/focus.d.ts +47 -44
- package/es/globals/mixins/form.d.ts +48 -45
- package/es/globals/mixins/host-listener.d.ts +48 -45
- package/es/globals/mixins/host-listener.js.map +1 -1
- package/es/globals/mixins/validity.d.ts +48 -45
- package/es/globals/scss/themes.css.js +1 -1
- package/es/globals/settings.js.map +1 -1
- package/es/polyfills/toggle-class.js.map +1 -1
- package/lib/components-react-node/accordion/accordion-item-skeleton.js +2 -2
- package/lib/components-react-node/accordion/accordion-item.js +2 -2
- package/lib/components-react-node/accordion/accordion-skeleton.js +2 -2
- package/lib/components-react-node/accordion/accordion.js +2 -2
- package/lib/components-react-node/ai-skeleton/ai-skeleton-icon.js +2 -2
- package/lib/components-react-node/ai-skeleton/ai-skeleton-placeholder.js +2 -2
- package/lib/components-react-node/ai-skeleton/ai-skeleton-text.js +2 -2
- package/lib/components-react-node/breadcrumb/breadcrumb-item.js +2 -2
- package/lib/components-react-node/breadcrumb/breadcrumb-link.js +2 -2
- package/lib/components-react-node/breadcrumb/breadcrumb-overflow-menu.js +2 -2
- package/lib/components-react-node/breadcrumb/breadcrumb-skeleton.js +2 -2
- package/lib/components-react-node/breadcrumb/breadcrumb.js +2 -2
- package/lib/components-react-node/button/button-set-base.js +2 -2
- package/lib/components-react-node/button/button-set.js +2 -2
- package/lib/components-react-node/button/button-skeleton.js +2 -2
- package/lib/components-react-node/button/button.js +2 -2
- package/lib/components-react-node/chat-button/chat-button-skeleton.js +2 -2
- package/lib/components-react-node/chat-button/chat-button.js +2 -2
- package/lib/components-react-node/checkbox/checkbox-group.js +2 -2
- package/lib/components-react-node/checkbox/checkbox-skeleton.js +2 -2
- package/lib/components-react-node/checkbox/checkbox.js +2 -2
- package/lib/components-react-node/code-snippet/code-snippet-skeleton.js +2 -2
- package/lib/components-react-node/code-snippet/code-snippet.js +2 -2
- package/lib/components-react-node/combo-box/combo-box-item.js +2 -2
- package/lib/components-react-node/combo-box/combo-box.js +2 -2
- package/lib/components-react-node/content-switcher/content-switcher-item.js +2 -2
- package/lib/components-react-node/content-switcher/content-switcher.js +2 -2
- package/lib/components-react-node/copy/copy.js +2 -2
- package/lib/components-react-node/copy-button/copy-button.js +2 -2
- package/lib/components-react-node/data-table/table-batch-actions.js +2 -2
- package/lib/components-react-node/data-table/table-body.js +2 -2
- package/lib/components-react-node/data-table/table-cell-content.js +2 -2
- package/lib/components-react-node/data-table/table-cell.js +2 -2
- package/lib/components-react-node/data-table/table-expanded-row.js +2 -2
- package/lib/components-react-node/data-table/table-head.js +2 -2
- package/lib/components-react-node/data-table/table-header-cell.js +2 -2
- package/lib/components-react-node/data-table/table-header-description.js +2 -2
- package/lib/components-react-node/data-table/table-header-row.js +2 -2
- package/lib/components-react-node/data-table/table-header-title.js +2 -2
- package/lib/components-react-node/data-table/table-row.js +2 -2
- package/lib/components-react-node/data-table/table-skeleton.js +2 -2
- package/lib/components-react-node/data-table/table-toolbar-content.js +2 -2
- package/lib/components-react-node/data-table/table-toolbar-search.js +2 -2
- package/lib/components-react-node/data-table/table-toolbar.js +2 -2
- package/lib/components-react-node/data-table/table.js +2 -2
- package/lib/components-react-node/date-picker/date-picker-input-skeleton.js +2 -2
- package/lib/components-react-node/date-picker/date-picker-input.js +2 -2
- package/lib/components-react-node/date-picker/date-picker.js +2 -2
- package/lib/components-react-node/dropdown/dropdown-item.js +2 -2
- package/lib/components-react-node/dropdown/dropdown-skeleton.js +2 -2
- package/lib/components-react-node/dropdown/dropdown.js +2 -2
- package/lib/components-react-node/file-uploader/demo-file-uploader.js +2 -2
- package/lib/components-react-node/file-uploader/file-uploader-button.js +2 -2
- package/lib/components-react-node/file-uploader/file-uploader-drop-container.js +2 -2
- package/lib/components-react-node/file-uploader/file-uploader-item.js +2 -2
- package/lib/components-react-node/file-uploader/file-uploader-skeleton.js +2 -2
- package/lib/components-react-node/file-uploader/file-uploader.js +2 -2
- package/lib/components-react-node/form/form-item.js +2 -2
- package/lib/components-react-node/form-group/form-group.js +2 -2
- package/lib/components-react-node/icon-button/icon-button.js +2 -2
- package/lib/components-react-node/inline-loading/inline-loading.js +2 -2
- package/lib/components-react-node/layer/layer.js +2 -2
- package/lib/components-react-node/link/link.js +2 -2
- package/lib/components-react-node/list/list-item.js +2 -2
- package/lib/components-react-node/list/ordered-list.js +2 -2
- package/lib/components-react-node/list/unordered-list.js +2 -2
- package/lib/components-react-node/loading/loading.js +2 -2
- package/lib/components-react-node/modal/modal-body-content.js +2 -2
- package/lib/components-react-node/modal/modal-body.js +2 -2
- package/lib/components-react-node/modal/modal-close-button.js +2 -2
- package/lib/components-react-node/modal/modal-footer-button.js +2 -2
- package/lib/components-react-node/modal/modal-footer.js +2 -2
- package/lib/components-react-node/modal/modal-header.js +2 -2
- package/lib/components-react-node/modal/modal-heading.js +2 -2
- package/lib/components-react-node/modal/modal-label.js +2 -2
- package/lib/components-react-node/modal/modal.js +2 -2
- package/lib/components-react-node/multi-select/multi-select-item.js +2 -2
- package/lib/components-react-node/multi-select/multi-select.js +2 -2
- package/lib/components-react-node/notification/actionable-notification-button.js +2 -2
- package/lib/components-react-node/notification/actionable-notification.js +2 -2
- package/lib/components-react-node/notification/inline-notification.js +2 -2
- package/lib/components-react-node/notification/toast-notification.js +2 -2
- package/lib/components-react-node/number-input/number-input-skeleton.js +2 -2
- package/lib/components-react-node/number-input/number-input.js +2 -2
- package/lib/components-react-node/overflow-menu/overflow-menu-body.js +2 -2
- package/lib/components-react-node/overflow-menu/overflow-menu-item.js +2 -2
- package/lib/components-react-node/overflow-menu/overflow-menu.js +2 -2
- package/lib/components-react-node/pagination/pagination.js +2 -2
- package/lib/components-react-node/popover/popover-content.js +2 -2
- package/lib/components-react-node/popover/popover.js +2 -2
- package/lib/components-react-node/progress-bar/progress-bar.js +2 -2
- package/lib/components-react-node/progress-indicator/progress-indicator-skeleton.js +2 -2
- package/lib/components-react-node/progress-indicator/progress-indicator.js +2 -2
- package/lib/components-react-node/progress-indicator/progress-step-skeleton.js +2 -2
- package/lib/components-react-node/progress-indicator/progress-step.js +2 -2
- package/lib/components-react-node/radio-button/radio-button-group.js +2 -2
- package/lib/components-react-node/radio-button/radio-button-skeleton.js +2 -2
- package/lib/components-react-node/radio-button/radio-button.js +2 -2
- package/lib/components-react-node/search/search-skeleton.js +2 -2
- package/lib/components-react-node/search/search.js +2 -2
- package/lib/components-react-node/select/select-item-group.js +2 -2
- package/lib/components-react-node/select/select-item.js +2 -2
- package/lib/components-react-node/select/select-skeleton.js +2 -2
- package/lib/components-react-node/select/select.js +2 -2
- package/lib/components-react-node/side-panel/side-panel.js +2 -2
- package/lib/components-react-node/skeleton-icon/skeleton-icon.js +2 -2
- package/lib/components-react-node/skeleton-placeholder/skeleton-placeholder.js +2 -2
- package/lib/components-react-node/skeleton-text/skeleton-text.js +2 -2
- package/lib/components-react-node/skip-to-content/skip-to-content.js +2 -2
- package/lib/components-react-node/slider/slider-input.js +2 -2
- package/lib/components-react-node/slider/slider-skeleton.js +2 -2
- package/lib/components-react-node/slider/slider.js +2 -2
- package/lib/components-react-node/slug/slug-action-button.js +2 -2
- package/lib/components-react-node/slug/slug.js +2 -2
- package/lib/components-react-node/stack/stack.js +2 -2
- package/lib/components-react-node/structured-list/structured-list-body.js +2 -2
- package/lib/components-react-node/structured-list/structured-list-cell.js +2 -2
- package/lib/components-react-node/structured-list/structured-list-head.js +2 -2
- package/lib/components-react-node/structured-list/structured-list-header-cell-skeleton.js +2 -2
- package/lib/components-react-node/structured-list/structured-list-header-cell.js +2 -2
- package/lib/components-react-node/structured-list/structured-list-header-row.js +2 -2
- package/lib/components-react-node/structured-list/structured-list-row.js +2 -2
- package/lib/components-react-node/structured-list/structured-list.js +2 -2
- package/lib/components-react-node/tabs/tab-skeleton.js +2 -2
- package/lib/components-react-node/tabs/tab.js +2 -2
- package/lib/components-react-node/tabs/tabs-skeleton.js +2 -2
- package/lib/components-react-node/tabs/tabs.js +2 -2
- package/lib/components-react-node/tag/tag.js +2 -2
- package/lib/components-react-node/tearsheet/tearsheet.js +2 -2
- package/lib/components-react-node/text-input/text-input-skeleton.js +2 -2
- package/lib/components-react-node/text-input/text-input.js +2 -2
- package/lib/components-react-node/textarea/textarea-skeleton.js +2 -2
- package/lib/components-react-node/textarea/textarea.js +2 -2
- package/lib/components-react-node/tile/clickable-tile.js +2 -2
- package/lib/components-react-node/tile/expandable-tile.js +2 -2
- package/lib/components-react-node/tile/radio-tile.js +2 -2
- package/lib/components-react-node/tile/selectable-tile.js +2 -2
- package/lib/components-react-node/tile/tile-group.js +2 -2
- package/lib/components-react-node/tile/tile.js +2 -2
- package/lib/components-react-node/toggle/toggle.js +2 -2
- package/lib/components-react-node/toggle-tip/toggletip.js +2 -2
- package/lib/components-react-node/tooltip/tooltip-content.js +2 -2
- package/lib/components-react-node/tooltip/tooltip.js +2 -2
- package/lib/components-react-node/ui-shell/header-global-action.js +2 -2
- package/lib/components-react-node/ui-shell/header-menu-button.js +2 -2
- package/lib/components-react-node/ui-shell/header-menu-item.js +2 -2
- package/lib/components-react-node/ui-shell/header-menu.js +2 -2
- package/lib/components-react-node/ui-shell/header-name.js +2 -2
- package/lib/components-react-node/ui-shell/header-nav-item.js +2 -2
- package/lib/components-react-node/ui-shell/header-nav.js +2 -2
- package/lib/components-react-node/ui-shell/header-panel.js +2 -2
- package/lib/components-react-node/ui-shell/header-side-nav-items.js +2 -2
- package/lib/components-react-node/ui-shell/header.js +2 -2
- package/lib/components-react-node/ui-shell/side-nav-divider.js +2 -2
- package/lib/components-react-node/ui-shell/side-nav-items.js +2 -2
- package/lib/components-react-node/ui-shell/side-nav-link.js +2 -2
- package/lib/components-react-node/ui-shell/side-nav-menu-item.js +2 -2
- package/lib/components-react-node/ui-shell/side-nav-menu.js +2 -2
- package/lib/components-react-node/ui-shell/side-nav.js +2 -2
- package/lib/components-react-node/ui-shell/switcher-divider.js +2 -2
- package/lib/components-react-node/ui-shell/switcher-item.js +2 -2
- package/lib/components-react-node/ui-shell/switcher.js +2 -2
- package/lib/globals/controllers/popover-controller.js.map +1 -1
- package/lib/globals/settings.js.map +1 -1
- package/package.json +4 -4
- package/dist/20-7dd70a15.js +0 -73
- package/dist/checkbox-6b1a3bff.js +0 -109
- package/dist/dropdown-item-4c020a7d.js +0 -148
- package/dist/popover-controller-0c0475fc.js +0 -73
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.js","names":["classMap","html","property","query","Close16","prefix","findIndex","forEach","CDSDropdown","DROPDOWN_KEYBOARD_ACTION","styles","carbonElement","customElement","ifDefined","ifNonEmpty","DROPDOWN_DIRECTION","DROPDOWN_SIZE","CDSComboBox","_decorate","_initialize","_CDSDropdown","constructor","args","F","d","kind","key","value","decorators","_testItemWithQueryText","item","itemMatches","_defaultItemMatches","_filterInputNode","queryText","textContent","toLowerCase","indexOf","_handleInput","_filterInputValue","length","setAttribute","removeAttribute","items","querySelectorAll","selectorItem","index","i","_this$_itemMenu","menuRect","_itemMenu","getBoundingClientRect","itemRect","isViewable","top","bottom","clientHeight","scrollTop","scrollBot","Math","abs","highlighted","filterInput","open","requestUpdate","_handleClickInner","event","_this$_selectionButto","target","_selectionButtonNode","contains","_handleUserInitiatedClearInput","_get","_getPrototypeOf","prototype","call","_handleKeypressInner","_this$_selectionButto2","action","getAction","TRIGGERING","focus","_handleUserInitiatedSelectItem","_selectionShouldChange","_selectionDidChange","itemToSelect","selectorItemSelected","selected","_handleUserInitiatedToggle","_renderLabel","disabled","inputLabel","label","readOnly","_activeDescendant","activeDescendant","filterInputValue","handleInput","inputClasses","activeDescendantFallback","_items$","id","_t","_","String","_renderFollowingLabel","clearSelectionLabel","undefined","_t2","attribute","shouldUpdate","changedProperties","_selectedItemContent","selectedItemContent","has","updated","_listBoxNode","listBoxNode","classList","add","static","Set","selectorItemHighlighted","eventBeforeToggle","eventToggle","eventBeforeSelect","eventSelect"],"sources":["components/combo-box/combo-box.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2024\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 { classMap } from 'lit/directives/class-map.js';\nimport { TemplateResult, html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport Close16 from '@carbon/icons/lib/close/16';\nimport { prefix } from '../../globals/settings';\nimport { findIndex, forEach } from '../../globals/internal/collection-helpers';\nimport CDSDropdown, { DROPDOWN_KEYBOARD_ACTION } from '../dropdown/dropdown';\nimport CDSComboBoxItem from './combo-box-item';\nimport styles from './combo-box.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport ifNonEmpty from '../../globals/directives/if-non-empty';\n\nexport { DROPDOWN_DIRECTION, DROPDOWN_SIZE } from '../dropdown/dropdown';\n\n/**\n * Combo box.\n *\n * @element cds-combo-box\n * @fires cds-combo-box-beingselected\n * The custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires cds-combo-box-beingtoggled\n * The custom event fired before the open state of this combo box is toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated toggling.\n * @fires cds-combo-box-selected - The custom event fired after a combo box item is selected upon a user gesture.\n * @fires cds-combo-box-toggled - The custom event fired after the open state of this combo box is toggled upon a user gesture.\n */\n@customElement(`${prefix}-combo-box`)\nclass CDSComboBox extends CDSDropdown {\n /**\n * The text content that should be set to the `<input>` for filtering.\n */\n protected _filterInputValue = '';\n\n protected _shouldTriggerBeFocusable = false;\n\n /**\n * The `<input>` for filtering.\n */\n @query('input')\n private _filterInputNode!: HTMLInputElement;\n\n /**\n * The menu containing all selectable items.\n */\n @query('#menu-body')\n private _itemMenu!: HTMLElement;\n\n /**\n * The selection button.\n */\n @query('#selection-button')\n private _selectionButtonNode!: HTMLElement;\n\n /**\n * @param item A combo box item.\n * @returns `true` if the given combo box item matches the query text user types.\n */\n protected _testItemWithQueryText(item) {\n return (this.itemMatches || this._defaultItemMatches)(\n item,\n this._filterInputNode.value\n );\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * The default item matching callback.\n *\n * @param item The combo box item.\n * @param queryText The query text user types.\n * @returns `true` if the given combo box item matches the given query text.\n */\n protected _defaultItemMatches(\n item: CDSComboBoxItem,\n queryText: string\n ): boolean {\n return (\n item.textContent!.toLowerCase().indexOf(queryText.toLowerCase()) >= 0\n );\n }\n /* eslint-enable class-methods-use-this */\n\n /**\n * Handles `input` event on the `<input>` for filtering.\n */\n protected _handleInput() {\n if (this._filterInputValue.length != 0) {\n this.setAttribute('isClosable', '');\n } else {\n this.removeAttribute('isClosable');\n }\n\n const items = this.querySelectorAll(\n (this.constructor as typeof CDSComboBox).selectorItem\n );\n const index = !this._filterInputNode.value\n ? -1\n : findIndex(items, this._testItemWithQueryText, this);\n forEach(items, (item, i) => {\n if (i === index) {\n const menuRect = this._itemMenu?.getBoundingClientRect();\n const itemRect = item.getBoundingClientRect();\n\n if (menuRect && itemRect) {\n const isViewable =\n menuRect!.top <= itemRect?.top &&\n itemRect?.bottom <= menuRect?.top + this._itemMenu!.clientHeight;\n if (!isViewable) {\n const scrollTop = itemRect?.top - menuRect?.top;\n const scrollBot = itemRect?.bottom - menuRect?.bottom;\n\n if (Math.abs(scrollTop) < Math.abs(scrollBot)) {\n this._itemMenu!.scrollTop += scrollTop;\n } else {\n this._itemMenu!.scrollTop += scrollBot;\n }\n }\n }\n }\n (item as CDSComboBoxItem).highlighted = i === index;\n });\n const { _filterInputNode: filterInput } = this;\n this._filterInputValue = !filterInput ? '' : filterInput.value;\n this.open = true;\n this.requestUpdate(); // If the only change is to `_filterInputValue`, auto-update doesn't happen\n }\n\n protected _handleClickInner(event: MouseEvent) {\n const { target } = event as any;\n if (this._selectionButtonNode?.contains(target)) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleClickInner(event);\n }\n }\n\n protected _handleKeypressInner(event: KeyboardEvent) {\n const { key } = event;\n const action = (this.constructor as typeof CDSDropdown).getAction(key);\n const { TRIGGERING } = DROPDOWN_KEYBOARD_ACTION;\n if (\n this._selectionButtonNode?.contains(event.target as Node) &&\n // Space key should be handled by `<input>` unless \"clear selection\" button has focus\n (action === TRIGGERING || key === ' ')\n ) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleKeypressInner(event);\n }\n }\n\n /**\n * Handles user-initiated clearing the `<input>` for filtering.\n */\n protected _handleUserInitiatedClearInput() {\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof CDSComboBox).selectorItem\n ),\n (item) => {\n (item as CDSComboBoxItem).highlighted = false;\n }\n );\n this._filterInputValue = '';\n this._filterInputNode.focus();\n this._handleUserInitiatedSelectItem();\n }\n\n protected _handleUserInitiatedSelectItem(item?: CDSComboBoxItem) {\n if (item && !this._selectionShouldChange(item)) {\n // Escape hatch for `shouldUpdate()` logic that updates `._filterInputValue()` when selection changes,\n // given we want to update the `<input>` and close the dropdown even if selection doesn't update.\n // Use case:\n // 1. Select the 2nd item in combo box drop down\n // 2. Type some text in the `<input>`\n // 3. Re-select the 2nd item in combo box drop down,\n // the `<input>` has to updated with the 2nd item and the dropdown should be closed,\n // even if there is no change in the selected value\n this._filterInputValue = item.textContent || '';\n this.open = false;\n this.requestUpdate();\n }\n super._handleUserInitiatedSelectItem(item);\n }\n\n protected _selectionDidChange(itemToSelect?: CDSComboBoxItem) {\n this.value = !itemToSelect ? '' : itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof CDSDropdown).selectorItemSelected\n ),\n (item) => {\n (item as CDSComboBoxItem).selected = false;\n item.setAttribute('aria-selected', 'false');\n }\n );\n if (itemToSelect) {\n itemToSelect.selected = true;\n itemToSelect.setAttribute('aria-selected', 'true');\n }\n this._handleUserInitiatedToggle(false);\n }\n\n protected _renderLabel(): TemplateResult {\n const {\n disabled,\n inputLabel,\n label,\n open,\n readOnly,\n value,\n _activeDescendant: activeDescendant,\n _filterInputValue: filterInputValue,\n _handleInput: handleInput,\n } = this;\n\n const inputClasses = classMap({\n [`${prefix}--text-input`]: true,\n [`${prefix}--text-input--empty`]: !value,\n });\n\n let activeDescendantFallback: string | undefined;\n if (open && !activeDescendant) {\n const constructor = this.constructor as typeof CDSDropdown;\n const items = this.querySelectorAll(constructor.selectorItem);\n activeDescendantFallback = items[0]?.id;\n }\n\n return html`\n <input\n id=\"trigger-button\"\n class=\"${inputClasses}\"\n ?disabled=${disabled}\n placeholder=\"${label}\"\n .value=${filterInputValue}\n role=\"combobox\"\n aria-label=\"${ifNonEmpty(inputLabel)}\"\n aria-controls=\"menu-body\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n aria-expanded=\"${String(open)}\"\n aria-activedescendant=\"${ifDefined(\n open ? activeDescendant ?? activeDescendantFallback : ''\n )}\"\n ?readonly=${readOnly}\n @input=${handleInput} />\n `;\n }\n\n protected _renderFollowingLabel(): TemplateResult | void {\n const { clearSelectionLabel, _filterInputValue: filterInputValue } = this;\n\n if (filterInputValue.length != 0) {\n this.setAttribute('isClosable', '');\n } else {\n this.removeAttribute('isClosable');\n }\n\n return filterInputValue.length === 0\n ? undefined\n : html`\n <div\n id=\"selection-button\"\n role=\"button\"\n class=\"${prefix}--list-box__selection\"\n tabindex=\"0\"\n title=\"${clearSelectionLabel}\">\n ${Close16({ 'aria-label': clearSelectionLabel })}\n </div>\n `;\n }\n\n /**\n * The `aria-label` attribute for the icon to clear selection.\n */\n @property({ attribute: 'clear-selection-label' })\n clearSelectionLabel = 'Clear selection';\n\n /**\n * The `aria-label` attribute for the `<input>` for filtering.\n */\n @property({ attribute: 'input-label' })\n inputLabel = '';\n\n /**\n * The custom item matching callback.\n */\n @property({ attribute: false })\n itemMatches!: (item: CDSComboBoxItem, queryText: string) => boolean;\n\n shouldUpdate(changedProperties) {\n super.shouldUpdate(changedProperties);\n const { _selectedItemContent: selectedItemContent } = this;\n if (selectedItemContent && changedProperties.has('value')) {\n this._filterInputValue = selectedItemContent?.textContent || '';\n }\n return true;\n }\n\n updated(changedProperties) {\n super.updated(changedProperties);\n const { _listBoxNode: listBoxNode } = this;\n if (listBoxNode) {\n listBoxNode.classList.add(`${prefix}--combo-box`);\n }\n }\n\n // For combo box, open/selection with space key is disabled given the input box should take it over\n static TRIGGER_KEYS = new Set(['Enter']);\n\n /**\n * A selector that will return highlighted items.\n */\n static get selectorItemHighlighted() {\n return `${prefix}-combo-box-item[highlighted]`;\n }\n\n /**\n * A selector that will return combo box items.\n */\n static get selectorItem() {\n return `${prefix}-combo-box-item`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-combo-box-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before this combo box item is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling this combo box item.\n */\n static get eventBeforeToggle() {\n return `${prefix}-combo-box-beingtoggled`;\n }\n\n /**\n * The name of the custom event fired after this combo box item is toggled upon a user gesture.\n */\n static get eventToggle() {\n return `${prefix}-combo-box-toggled`;\n }\n\n /**\n * The name of the custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-combo-box-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a combo box item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-combo-box-selected`;\n }\n\n static styles = styles;\n}\n\nexport default CDSComboBox;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,6BAA6B;AACtD,SAAyBC,IAAI,QAAQ,KAAK;AAC1C,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;AACnD,OAAOC,OAAO,MAAM,sBAA4B;AAChD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,SAAS,EAAEC,OAAO,QAAQ,2CAA2C;AAC9E,OAAOC,WAAW,IAAIC,wBAAwB,QAAQ,sBAAsB;AAE5E,OAAOC,MAAM,MAAM,sBAAkB;AACrC,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;AACxF,SAASC,SAAS,QAAQ,8BAA8B;AACxD,OAAOC,UAAU,MAAM,uCAAuC;AAE9D,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,sBAAsB;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,IAcMC,WAAW,GAAAC,SAAA,EADhBN,aAAa,CAAE,GAAEP,MAAO,YAAW,CAAC,aAAAc,WAAA,EAAAC,YAAA;EAArC,MACMH,WAAW,SAAAG,YAAA,CAAqB;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EA+UtC;EAAC;IAAAI,CAAA,EA/UKN,WAAW;IAAAO,CAAA;MAAAC,IAAA;MAAAC,GAAA;MAAAC,MAAA;QAAA,OAIe,EAAE;MAAA;IAAA;MAAAF,IAAA;MAAAC,GAAA;MAAAC,MAAA;QAAA,OAEM,KAAK;MAAA;IAAA;MAAAF,IAAA;MAAAG,UAAA,GAK1CzB,KAAK,CAAC,OAAO,CA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ExC;AACF;AACA;MACE,SAAA+F,wBAAA,EAAqC;QACnC,OAAQ,GAAErH,MAAO,8BAA6B;MAChD;;MAEA;AACF;AACA;IAFE;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,KAAA,EAGA,SAAAkB,aAAA,EAA0B;QACxB,OAAQ,GAAExC,MAAO,iBAAgB;MACnC;;MAEA;AACF;AACA;IAFE;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,KAAA,EAGA,SAAA2D,qBAAA,EAAkC;QAChC,OAAQ,GAAEjF,MAAO,2BAA0B;MAC7C;;MAEA;AACF;AACA;AACA;IAHE;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,KAAA,EAIA,SAAAgG,kBAAA,EAA+B;QAC7B,OAAQ,GAAEtH,MAAO,yBAAwB;MAC3C;;MAEA;AACF;AACA;IAFE;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,KAAA,EAGA,SAAAiG,YAAA,EAAyB;QACvB,OAAQ,GAAEvH,MAAO,oBAAmB;MACtC;;MAEA;AACF;AACA;AACA;IAHE;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,KAAA,EAIA,SAAAkG,kBAAA,EAA+B;QAC7B,OAAQ,GAAExH,MAAO,0BAAyB;MAC5C;;MAEA;AACF;AACA;IAFE;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,KAAA,EAGA,SAAAmG,YAAA,EAAyB;QACvB,OAAQ,GAAEzH,MAAO,qBAAoB;MACvC;IAAC;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,MAAA;QAAA,OAEejB,MAAM;MAAA;IAAA;EAAA;AAAA,GA9UEF,WAAW;AAiVrC,eAAeS,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"combo-box.js","names":["classMap","html","property","query","Close16","prefix","findIndex","forEach","CDSDropdown","DROPDOWN_KEYBOARD_ACTION","styles","carbonElement","customElement","ifDefined","ifNonEmpty","DROPDOWN_DIRECTION","DROPDOWN_SIZE","CDSComboBox","_decorate","_initialize","_CDSDropdown","constructor","args","F","d","kind","key","value","decorators","_testItemWithQueryText","item","itemMatches","_defaultItemMatches","_filterInputNode","queryText","textContent","toLowerCase","indexOf","_handleInput","_filterInputValue","length","setAttribute","removeAttribute","items","querySelectorAll","selectorItem","index","i","_this$_itemMenu","menuRect","_itemMenu","getBoundingClientRect","itemRect","isViewable","top","bottom","clientHeight","scrollTop","scrollBot","Math","abs","highlighted","filterInput","open","requestUpdate","_handleClickInner","event","_this$_selectionButto","target","_selectionButtonNode","contains","_handleUserInitiatedClearInput","_get","_getPrototypeOf","prototype","call","_handleKeypressInner","_this$_selectionButto2","action","getAction","TRIGGERING","focus","_handleUserInitiatedSelectItem","_selectionShouldChange","_selectionDidChange","itemToSelect","selectorItemSelected","selected","_handleUserInitiatedToggle","_renderLabel","disabled","inputLabel","label","readOnly","_activeDescendant","activeDescendant","filterInputValue","handleInput","inputClasses","activeDescendantFallback","_items$","id","_t","_","String","_renderFollowingLabel","clearSelectionLabel","undefined","_t2","attribute","shouldUpdate","changedProperties","_selectedItemContent","selectedItemContent","has","updated","_listBoxNode","listBoxNode","classList","add","static","Set","selectorItemHighlighted","eventBeforeToggle","eventToggle","eventBeforeSelect","eventSelect"],"sources":["components/combo-box/combo-box.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2024\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 { classMap } from 'lit/directives/class-map.js';\nimport { TemplateResult, html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport Close16 from '@carbon/icons/lib/close/16';\nimport { prefix } from '../../globals/settings';\nimport { findIndex, forEach } from '../../globals/internal/collection-helpers';\nimport CDSDropdown, { DROPDOWN_KEYBOARD_ACTION } from '../dropdown/dropdown';\nimport CDSComboBoxItem from './combo-box-item';\nimport styles from './combo-box.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport ifNonEmpty from '../../globals/directives/if-non-empty';\n\nexport { DROPDOWN_DIRECTION, DROPDOWN_SIZE } from '../dropdown/dropdown';\n\n/**\n * Combo box.\n *\n * @element cds-combo-box\n * @fires cds-combo-box-beingselected\n * The custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires cds-combo-box-beingtoggled\n * The custom event fired before the open state of this combo box is toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated toggling.\n * @fires cds-combo-box-selected - The custom event fired after a combo box item is selected upon a user gesture.\n * @fires cds-combo-box-toggled - The custom event fired after the open state of this combo box is toggled upon a user gesture.\n */\n@customElement(`${prefix}-combo-box`)\nclass CDSComboBox extends CDSDropdown {\n /**\n * The text content that should be set to the `<input>` for filtering.\n */\n protected _filterInputValue = '';\n\n protected _shouldTriggerBeFocusable = false;\n\n /**\n * The `<input>` for filtering.\n */\n @query('input')\n private _filterInputNode!: HTMLInputElement;\n\n /**\n * The menu containing all selectable items.\n */\n @query('#menu-body')\n private _itemMenu!: HTMLElement;\n\n /**\n * The selection button.\n */\n @query('#selection-button')\n private _selectionButtonNode!: HTMLElement;\n\n /**\n * @param item A combo box item.\n * @returns `true` if the given combo box item matches the query text user types.\n */\n protected _testItemWithQueryText(item) {\n return (this.itemMatches || this._defaultItemMatches)(\n item,\n this._filterInputNode.value\n );\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * The default item matching callback.\n *\n * @param item The combo box item.\n * @param queryText The query text user types.\n * @returns `true` if the given combo box item matches the given query text.\n */\n protected _defaultItemMatches(\n item: CDSComboBoxItem,\n queryText: string\n ): boolean {\n return (\n item.textContent!.toLowerCase().indexOf(queryText.toLowerCase()) >= 0\n );\n }\n /* eslint-enable class-methods-use-this */\n\n /**\n * Handles `input` event on the `<input>` for filtering.\n */\n protected _handleInput() {\n if (this._filterInputValue.length != 0) {\n this.setAttribute('isClosable', '');\n } else {\n this.removeAttribute('isClosable');\n }\n\n const items = this.querySelectorAll(\n (this.constructor as typeof CDSComboBox).selectorItem\n );\n const index = !this._filterInputNode.value\n ? -1\n : findIndex(items, this._testItemWithQueryText, this);\n forEach(items, (item, i) => {\n if (i === index) {\n const menuRect = this._itemMenu?.getBoundingClientRect();\n const itemRect = item.getBoundingClientRect();\n\n if (menuRect && itemRect) {\n const isViewable =\n menuRect!.top <= itemRect?.top &&\n itemRect?.bottom <= menuRect?.top + this._itemMenu!.clientHeight;\n if (!isViewable) {\n const scrollTop = itemRect?.top - menuRect?.top;\n const scrollBot = itemRect?.bottom - menuRect?.bottom;\n\n if (Math.abs(scrollTop) < Math.abs(scrollBot)) {\n this._itemMenu!.scrollTop += scrollTop;\n } else {\n this._itemMenu!.scrollTop += scrollBot;\n }\n }\n }\n }\n (item as CDSComboBoxItem).highlighted = i === index;\n });\n const { _filterInputNode: filterInput } = this;\n this._filterInputValue = !filterInput ? '' : filterInput.value;\n this.open = true;\n this.requestUpdate(); // If the only change is to `_filterInputValue`, auto-update doesn't happen\n }\n\n protected _handleClickInner(event: MouseEvent) {\n const { target } = event as any;\n if (this._selectionButtonNode?.contains(target)) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleClickInner(event);\n }\n }\n\n protected _handleKeypressInner(event: KeyboardEvent) {\n const { key } = event;\n const action = (this.constructor as typeof CDSDropdown).getAction(key);\n const { TRIGGERING } = DROPDOWN_KEYBOARD_ACTION;\n if (\n this._selectionButtonNode?.contains(event.target as Node) &&\n // Space key should be handled by `<input>` unless \"clear selection\" button has focus\n (action === TRIGGERING || key === ' ')\n ) {\n this._handleUserInitiatedClearInput();\n } else {\n super._handleKeypressInner(event);\n }\n }\n\n /**\n * Handles user-initiated clearing the `<input>` for filtering.\n */\n protected _handleUserInitiatedClearInput() {\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof CDSComboBox).selectorItem\n ),\n (item) => {\n (item as CDSComboBoxItem).highlighted = false;\n }\n );\n this._filterInputValue = '';\n this._filterInputNode.focus();\n this._handleUserInitiatedSelectItem();\n }\n\n protected _handleUserInitiatedSelectItem(item?: CDSComboBoxItem) {\n if (item && !this._selectionShouldChange(item)) {\n // Escape hatch for `shouldUpdate()` logic that updates `._filterInputValue()` when selection changes,\n // given we want to update the `<input>` and close the dropdown even if selection doesn't update.\n // Use case:\n // 1. Select the 2nd item in combo box drop down\n // 2. Type some text in the `<input>`\n // 3. Re-select the 2nd item in combo box drop down,\n // the `<input>` has to updated with the 2nd item and the dropdown should be closed,\n // even if there is no change in the selected value\n this._filterInputValue = item.textContent || '';\n this.open = false;\n this.requestUpdate();\n }\n super._handleUserInitiatedSelectItem(item);\n }\n\n protected _selectionDidChange(itemToSelect?: CDSComboBoxItem) {\n this.value = !itemToSelect ? '' : itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof CDSDropdown).selectorItemSelected\n ),\n (item) => {\n (item as CDSComboBoxItem).selected = false;\n item.setAttribute('aria-selected', 'false');\n }\n );\n if (itemToSelect) {\n itemToSelect.selected = true;\n itemToSelect.setAttribute('aria-selected', 'true');\n }\n this._handleUserInitiatedToggle(false);\n }\n\n protected _renderLabel(): TemplateResult {\n const {\n disabled,\n inputLabel,\n label,\n open,\n readOnly,\n value,\n _activeDescendant: activeDescendant,\n _filterInputValue: filterInputValue,\n _handleInput: handleInput,\n } = this;\n\n const inputClasses = classMap({\n [`${prefix}--text-input`]: true,\n [`${prefix}--text-input--empty`]: !value,\n });\n\n let activeDescendantFallback: string | undefined;\n if (open && !activeDescendant) {\n const constructor = this.constructor as typeof CDSDropdown;\n const items = this.querySelectorAll(constructor.selectorItem);\n activeDescendantFallback = items[0]?.id;\n }\n\n return html`\n <input\n id=\"trigger-button\"\n class=\"${inputClasses}\"\n ?disabled=${disabled}\n placeholder=\"${label}\"\n .value=${filterInputValue}\n role=\"combobox\"\n aria-label=\"${ifNonEmpty(inputLabel)}\"\n aria-controls=\"menu-body\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n aria-expanded=\"${String(open)}\"\n aria-activedescendant=\"${ifDefined(\n open ? activeDescendant ?? activeDescendantFallback : ''\n )}\"\n ?readonly=${readOnly}\n @input=${handleInput} />\n `;\n }\n\n protected _renderFollowingLabel(): TemplateResult | void {\n const { clearSelectionLabel, _filterInputValue: filterInputValue } = this;\n\n if (filterInputValue.length != 0) {\n this.setAttribute('isClosable', '');\n } else {\n this.removeAttribute('isClosable');\n }\n\n return filterInputValue.length === 0\n ? undefined\n : html`\n <div\n id=\"selection-button\"\n role=\"button\"\n class=\"${prefix}--list-box__selection\"\n tabindex=\"0\"\n title=\"${clearSelectionLabel}\">\n ${Close16({ 'aria-label': clearSelectionLabel })}\n </div>\n `;\n }\n\n /**\n * The `aria-label` attribute for the icon to clear selection.\n */\n @property({ attribute: 'clear-selection-label' })\n clearSelectionLabel = 'Clear selection';\n\n /**\n * The `aria-label` attribute for the `<input>` for filtering.\n */\n @property({ attribute: 'input-label' })\n inputLabel = '';\n\n /**\n * The custom item matching callback.\n */\n @property({ attribute: false })\n itemMatches!: (item: CDSComboBoxItem, queryText: string) => boolean;\n\n shouldUpdate(changedProperties) {\n super.shouldUpdate(changedProperties);\n const { _selectedItemContent: selectedItemContent } = this;\n if (selectedItemContent && changedProperties.has('value')) {\n this._filterInputValue = selectedItemContent?.textContent || '';\n }\n return true;\n }\n\n updated(changedProperties) {\n super.updated(changedProperties);\n const { _listBoxNode: listBoxNode } = this;\n if (listBoxNode) {\n listBoxNode.classList.add(`${prefix}--combo-box`);\n }\n }\n\n // For combo box, open/selection with space key is disabled given the input box should take it over\n static TRIGGER_KEYS = new Set(['Enter']);\n\n /**\n * A selector that will return highlighted items.\n */\n static get selectorItemHighlighted() {\n return `${prefix}-combo-box-item[highlighted]`;\n }\n\n /**\n * A selector that will return combo box items.\n */\n static get selectorItem() {\n return `${prefix}-combo-box-item`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-combo-box-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before this combo box item is being toggled upon a user gesture.\n * Cancellation of this event stops the user-initiated action of toggling this combo box item.\n */\n static get eventBeforeToggle() {\n return `${prefix}-combo-box-beingtoggled`;\n }\n\n /**\n * The name of the custom event fired after this combo box item is toggled upon a user gesture.\n */\n static get eventToggle() {\n return `${prefix}-combo-box-toggled`;\n }\n\n /**\n * The name of the custom event fired before a combo box item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-combo-box-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a combo box item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-combo-box-selected`;\n }\n\n static styles = styles;\n}\n\nexport default CDSComboBox;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,6BAA6B;AACtD,SAAyBC,IAAI,QAAQ,KAAK;AAC1C,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;AACnD,OAAOC,OAAO,MAAM,sBAA4B;AAChD,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,SAAS,EAAEC,OAAO,QAAQ,2CAA2C;AAC9E,OAAOC,WAAW,IAAIC,wBAAwB,QAAQ,sBAAsB;AAE5E,OAAOC,MAAM,MAAM,sBAAkB;AACrC,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;AACxF,SAASC,SAAS,QAAQ,8BAA8B;AACxD,OAAOC,UAAU,MAAM,uCAAuC;AAE9D,SAASC,kBAAkB,EAAEC,aAAa,QAAQ,sBAAsB;;AAExE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,IAcMC,WAAW,GAAAC,SAAA,EADhBN,aAAa,CAAC,GAAGP,MAAM,YAAY,CAAC,aAAAc,WAAA,EAA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MACvC;IAAC;MAAAoB,IAAA;MAAA+F,MAAA;MAAA9F,GAAA;MAAAC,MAAA;QAAA,OAEejB,MAAM;MAAA;IAAA;EAAA;AAAA,GA9UEF,WAAW;AAiVrC,eAAeS,WAAW","ignoreList":[]}
|
|
@@ -33,11 +33,11 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
33
33
|
click(): void;
|
|
34
34
|
hidePopover(): void;
|
|
35
35
|
showPopover(): void;
|
|
36
|
-
togglePopover(force?: boolean
|
|
37
|
-
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions
|
|
38
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions
|
|
39
|
-
removeEventListener<
|
|
40
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions
|
|
36
|
+
togglePopover(force?: boolean): boolean;
|
|
37
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
38
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
39
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
40
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
41
41
|
readonly attributes: NamedNodeMap;
|
|
42
42
|
readonly classList: DOMTokenList;
|
|
43
43
|
className: string;
|
|
@@ -62,10 +62,10 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
62
62
|
slot: string;
|
|
63
63
|
readonly tagName: string;
|
|
64
64
|
attachShadow(init: ShadowRootInit): ShadowRoot;
|
|
65
|
-
checkVisibility(options?: CheckVisibilityOptions
|
|
66
|
-
closest<
|
|
67
|
-
closest<
|
|
68
|
-
closest<
|
|
65
|
+
checkVisibility(options?: CheckVisibilityOptions): boolean;
|
|
66
|
+
closest<K extends keyof HTMLElementTagNameMap>(selector: K): HTMLElementTagNameMap[K] | null;
|
|
67
|
+
closest<K extends keyof SVGElementTagNameMap>(selector: K): SVGElementTagNameMap[K] | null;
|
|
68
|
+
closest<K extends keyof MathMLElementTagNameMap>(selector: K): MathMLElementTagNameMap[K] | null;
|
|
69
69
|
closest<E extends Element = Element>(selectors: string): E | null;
|
|
70
70
|
computedStyleMap(): StylePropertyMapReadOnly;
|
|
71
71
|
getAttribute(qualifiedName: string): string | null;
|
|
@@ -76,10 +76,10 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
76
76
|
getBoundingClientRect(): DOMRect;
|
|
77
77
|
getClientRects(): DOMRectList;
|
|
78
78
|
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
|
|
79
|
-
getElementsByTagName<
|
|
80
|
-
getElementsByTagName<
|
|
81
|
-
getElementsByTagName<
|
|
82
|
-
getElementsByTagName<
|
|
79
|
+
getElementsByTagName<K extends keyof HTMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementTagNameMap[K]>;
|
|
80
|
+
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
|
|
81
|
+
getElementsByTagName<K extends keyof MathMLElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<MathMLElementTagNameMap[K]>;
|
|
82
|
+
getElementsByTagName<K extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;
|
|
83
83
|
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
|
|
84
84
|
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
|
|
85
85
|
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
|
|
@@ -97,21 +97,22 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
97
97
|
removeAttribute(qualifiedName: string): void;
|
|
98
98
|
removeAttributeNS(namespace: string | null, localName: string): void;
|
|
99
99
|
removeAttributeNode(attr: Attr): Attr;
|
|
100
|
-
requestFullscreen(options?: FullscreenOptions
|
|
100
|
+
requestFullscreen(options?: FullscreenOptions): Promise<void>;
|
|
101
101
|
requestPointerLock(): void;
|
|
102
|
-
scroll(options?: ScrollToOptions
|
|
102
|
+
scroll(options?: ScrollToOptions): void;
|
|
103
103
|
scroll(x: number, y: number): void;
|
|
104
|
-
scrollBy(options?: ScrollToOptions
|
|
104
|
+
scrollBy(options?: ScrollToOptions): void;
|
|
105
105
|
scrollBy(x: number, y: number): void;
|
|
106
|
-
scrollIntoView(arg?: boolean | ScrollIntoViewOptions
|
|
107
|
-
scrollTo(options?: ScrollToOptions
|
|
106
|
+
scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
|
|
107
|
+
scrollTo(options?: ScrollToOptions): void;
|
|
108
108
|
scrollTo(x: number, y: number): void;
|
|
109
109
|
setAttribute(qualifiedName: string, value: string): void;
|
|
110
110
|
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
|
|
111
111
|
setAttributeNode(attr: Attr): Attr | null;
|
|
112
112
|
setAttributeNodeNS(attr: Attr): Attr | null;
|
|
113
|
+
setHTMLUnsafe(html: string): void;
|
|
113
114
|
setPointerCapture(pointerId: number): void;
|
|
114
|
-
toggleAttribute(qualifiedName: string, force?: boolean
|
|
115
|
+
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
|
|
115
116
|
webkitMatchesSelector(selectors: string): boolean;
|
|
116
117
|
readonly baseURI: string;
|
|
117
118
|
readonly childNodes: NodeListOf<ChildNode>;
|
|
@@ -127,20 +128,20 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
127
128
|
readonly previousSibling: ChildNode | null;
|
|
128
129
|
textContent: string | null;
|
|
129
130
|
appendChild<T extends Node>(node: T): T;
|
|
130
|
-
cloneNode(deep?: boolean
|
|
131
|
+
cloneNode(deep?: boolean): Node;
|
|
131
132
|
compareDocumentPosition(other: Node): number;
|
|
132
133
|
contains(other: Node | null): boolean;
|
|
133
|
-
getRootNode(options?: GetRootNodeOptions
|
|
134
|
+
getRootNode(options?: GetRootNodeOptions): Node;
|
|
134
135
|
hasChildNodes(): boolean;
|
|
135
|
-
insertBefore<
|
|
136
|
+
insertBefore<T extends Node>(node: T, child: Node | null): T;
|
|
136
137
|
isDefaultNamespace(namespace: string | null): boolean;
|
|
137
138
|
isEqualNode(otherNode: Node | null): boolean;
|
|
138
139
|
isSameNode(otherNode: Node | null): boolean;
|
|
139
140
|
lookupNamespaceURI(prefix: string | null): string | null;
|
|
140
141
|
lookupPrefix(namespace: string | null): string | null;
|
|
141
142
|
normalize(): void;
|
|
142
|
-
removeChild<
|
|
143
|
-
replaceChild<
|
|
143
|
+
removeChild<T extends Node>(child: T): T;
|
|
144
|
+
replaceChild<T extends Node>(node: Node, child: T): T;
|
|
144
145
|
readonly ELEMENT_NODE: 1;
|
|
145
146
|
readonly ATTRIBUTE_NODE: 2;
|
|
146
147
|
readonly TEXT_NODE: 3;
|
|
@@ -162,6 +163,8 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
162
163
|
dispatchEvent(event: Event): boolean;
|
|
163
164
|
ariaAtomic: string | null;
|
|
164
165
|
ariaAutoComplete: string | null;
|
|
166
|
+
ariaBrailleLabel: string | null;
|
|
167
|
+
ariaBrailleRoleDescription: string | null;
|
|
165
168
|
ariaBusy: string | null;
|
|
166
169
|
ariaChecked: string | null;
|
|
167
170
|
ariaColCount: string | null;
|
|
@@ -199,12 +202,12 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
199
202
|
ariaValueNow: string | null;
|
|
200
203
|
ariaValueText: string | null;
|
|
201
204
|
role: string | null;
|
|
202
|
-
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions
|
|
203
|
-
getAnimations(options?: GetAnimationsOptions
|
|
204
|
-
after(...nodes: (
|
|
205
|
-
before(...nodes: (
|
|
205
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation;
|
|
206
|
+
getAnimations(options?: GetAnimationsOptions): Animation[];
|
|
207
|
+
after(...nodes: (Node | string)[]): void;
|
|
208
|
+
before(...nodes: (Node | string)[]): void;
|
|
206
209
|
remove(): void;
|
|
207
|
-
replaceWith(...nodes: (
|
|
210
|
+
replaceWith(...nodes: (Node | string)[]): void;
|
|
208
211
|
innerHTML: string;
|
|
209
212
|
readonly nextElementSibling: Element | null;
|
|
210
213
|
readonly previousElementSibling: Element | null;
|
|
@@ -212,19 +215,19 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
212
215
|
readonly children: HTMLCollection;
|
|
213
216
|
readonly firstElementChild: Element | null;
|
|
214
217
|
readonly lastElementChild: Element | null;
|
|
215
|
-
append(...nodes: (
|
|
216
|
-
prepend(...nodes: (
|
|
217
|
-
querySelector<
|
|
218
|
-
querySelector<
|
|
219
|
-
querySelector<
|
|
220
|
-
querySelector<
|
|
221
|
-
querySelector<
|
|
222
|
-
querySelectorAll<
|
|
223
|
-
querySelectorAll<
|
|
224
|
-
querySelectorAll<
|
|
225
|
-
querySelectorAll<
|
|
226
|
-
querySelectorAll<
|
|
227
|
-
replaceChildren(...nodes: (
|
|
218
|
+
append(...nodes: (Node | string)[]): void;
|
|
219
|
+
prepend(...nodes: (Node | string)[]): void;
|
|
220
|
+
querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
|
|
221
|
+
querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
|
|
222
|
+
querySelector<K extends keyof MathMLElementTagNameMap>(selectors: K): MathMLElementTagNameMap[K] | null;
|
|
223
|
+
querySelector<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): HTMLElementDeprecatedTagNameMap[K] | null;
|
|
224
|
+
querySelector<E extends Element = Element>(selectors: string): E | null;
|
|
225
|
+
querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
|
|
226
|
+
querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
|
|
227
|
+
querySelectorAll<K extends keyof MathMLElementTagNameMap>(selectors: K): NodeListOf<MathMLElementTagNameMap[K]>;
|
|
228
|
+
querySelectorAll<K extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;
|
|
229
|
+
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
|
|
230
|
+
replaceChildren(...nodes: (Node | string)[]): void;
|
|
228
231
|
readonly assignedSlot: HTMLSlotElement | null;
|
|
229
232
|
readonly attributeStyleMap: StylePropertyMap;
|
|
230
233
|
readonly style: CSSStyleDeclaration;
|
|
@@ -295,7 +298,7 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
295
298
|
onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
296
299
|
onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
297
300
|
onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null;
|
|
298
|
-
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent
|
|
301
|
+
onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null;
|
|
299
302
|
onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
300
303
|
onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null;
|
|
301
304
|
onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null;
|
|
@@ -330,7 +333,7 @@ declare const CDSContentSwitcherItem_base: {
|
|
|
330
333
|
onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null;
|
|
331
334
|
autofocus: boolean;
|
|
332
335
|
readonly dataset: DOMStringMap;
|
|
333
|
-
nonce?: string
|
|
336
|
+
nonce?: string;
|
|
334
337
|
tabIndex: number;
|
|
335
338
|
blur(): void;
|
|
336
339
|
};
|
|
@@ -399,7 +402,8 @@ export default class CDSContentSwitcherItem extends CDSContentSwitcherItem_base
|
|
|
399
402
|
static shadowRootOptions: {
|
|
400
403
|
delegatesFocus: boolean;
|
|
401
404
|
mode: ShadowRootMode;
|
|
402
|
-
|
|
405
|
+
serializable?: boolean;
|
|
406
|
+
slotAssignment?: SlotAssignmentMode;
|
|
403
407
|
};
|
|
404
408
|
static styles: any;
|
|
405
409
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-switcher-item.js","names":["classMap","ifDefined","LitElement","html","property","prefix","FocusMixin","styles","carbonElement","customElement","CDSContentSwitcherItem","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","decorators","type","Boolean","reflect","key","value","attribute","String","updated","changedProperties","_this$shadowRoot","shadowRoot","querySelector","classList","add","_renderTooltipContent","_t","_","shouldUpdate","has","selected","target","doc","getRootNode","targetNode","getElementById","toggleAttribute","render","disabled","className","switcherItem","_t2","icon","align","closeOnActivation","enterDelayMs","leaveDelayMs","_t3","static","_objectSpread","shadowRootOptions","delegatesFocus","default"],"sources":["components/content-switcher/content-switcher-item.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 { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\n/**\n * Content switcher button.\n *\n * @element cds-content-switcher-item\n */\n@customElement(`${prefix}-content-switcher-item`)\nexport default class CDSContentSwitcherItem extends FocusMixin(LitElement) {\n /**\n * `true` if this content switcher item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` to hide the divider at the left.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-divider' })\n hideDivider = false;\n\n /**\n * `true` if the content switcher button should be selected.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The element ID of target panel.\n */\n @property()\n target!: string;\n\n /**\n * The `value` attribute that is set to the parent `<cds-content-switcher>`\n * when this content switcher item is selected.\n */\n @property()\n value = '';\n\n /**\n * `true` if the content switcher button should be icon-only.\n */\n @property({ type: Boolean, reflect: true })\n icon = false;\n\n /**\n * Specify how the trigger should align with the tooltip for icon-only\n * switcher item\n */\n @property({ reflect: true, type: String })\n align = 'top';\n\n /**\n * Determines whether the tooltip should close when inner content is\n * activated (click, Enter or Space)\n */\n @property({ attribute: 'close-on-activation', reflect: true, type: Boolean })\n closeOnActivation = true;\n\n /**\n * Specify the duration in milliseconds to delay before displaying the\n * tooltip for icon-only switcher item\n */\n enterDelayMs = 100;\n\n /**\n * Specify the duration in milliseconds to delay before hiding the tooltip\n * for icon-only switcher-item\n *\n * TODO: match upstream value once #10471 is resolved\n */\n leaveDelayMs = 100;\n\n updated(changedProperties) {\n if (changedProperties) {\n this.shadowRoot\n ?.querySelector(`${prefix}-tooltip`)\n ?.shadowRoot?.querySelector(`.${prefix}--tooltip`)\n ?.classList.add(`${prefix}--icon-tooltip`);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n protected _renderTooltipContent() {\n return html`\n <cds-tooltip-content>\n <slot name=\"tooltip-content\"></slot>\n </cds-tooltip-content>\n `;\n }\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('selected') || changedProperties.has('target')) {\n const { selected, target } = this;\n if (target) {\n const doc = this.getRootNode() as HTMLDocument;\n // `doc` can be an element if such element is orphaned\n const targetNode = doc?.getElementById(target);\n targetNode?.toggleAttribute('hidden', !selected);\n }\n }\n return true;\n }\n\n render() {\n const { disabled, selected, target } = this;\n const className = classMap({\n [`${prefix}--content-switcher-btn`]: true,\n [`${prefix}--content-switcher--selected`]: selected,\n });\n const switcherItem = html`<button\n type=\"button\"\n role=\"tab\"\n class=\"${className}\"\n ?disabled=\"${disabled}\"\n tabindex=\"${selected ? '0' : '-1'}\"\n aria-controls=\"${ifDefined(target)}\"\n aria-selected=\"${Boolean(selected)}\">\n <span class=\"${prefix}--content-switcher__label\"><slot></slot></span>\n </button>`;\n\n if (this.icon) {\n const { align, closeOnActivation, enterDelayMs, leaveDelayMs } = this;\n return html`<cds-tooltip\n align=${align}\n close-on-activation=\"${closeOnActivation}\"\n enter-delay-ms=${enterDelayMs}\n leave-delay-ms=${leaveDelayMs}>\n ${switcherItem} ${this._renderTooltipContent()}\n </cds-tooltip>`;\n }\n return switcherItem;\n }\n\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n static styles = styles;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,6BAA6B;AACtD,SAASC,SAAS,QAAQ,8BAA8B;AACxD,SAASC,UAAU,EAAEC,IAAI,QAAQ,KAAK;AACtC,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,OAAOC,UAAU,MAAM,4BAA4B;AACnD,OAAOC,MAAM,MAAM,6BAAyB;AAC5C,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;;AAExF;AACA;AACA;AACA;AACA;AAJA,IAMqBC,sBAAsB,GAAAC,SAAA,EAD1CF,aAAa,
|
|
1
|
+
{"version":3,"file":"content-switcher-item.js","names":["classMap","ifDefined","LitElement","html","property","prefix","FocusMixin","styles","carbonElement","customElement","CDSContentSwitcherItem","_decorate","_initialize","_FocusMixin","constructor","args","F","d","kind","decorators","type","Boolean","reflect","key","value","attribute","String","updated","changedProperties","_this$shadowRoot","shadowRoot","querySelector","classList","add","_renderTooltipContent","_t","_","shouldUpdate","has","selected","target","doc","getRootNode","targetNode","getElementById","toggleAttribute","render","disabled","className","switcherItem","_t2","icon","align","closeOnActivation","enterDelayMs","leaveDelayMs","_t3","static","_objectSpread","shadowRootOptions","delegatesFocus","default"],"sources":["components/content-switcher/content-switcher-item.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 { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\n/**\n * Content switcher button.\n *\n * @element cds-content-switcher-item\n */\n@customElement(`${prefix}-content-switcher-item`)\nexport default class CDSContentSwitcherItem extends FocusMixin(LitElement) {\n /**\n * `true` if this content switcher item should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * `true` to hide the divider at the left.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-divider' })\n hideDivider = false;\n\n /**\n * `true` if the content switcher button should be selected.\n *\n * @private\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * The element ID of target panel.\n */\n @property()\n target!: string;\n\n /**\n * The `value` attribute that is set to the parent `<cds-content-switcher>`\n * when this content switcher item is selected.\n */\n @property()\n value = '';\n\n /**\n * `true` if the content switcher button should be icon-only.\n */\n @property({ type: Boolean, reflect: true })\n icon = false;\n\n /**\n * Specify how the trigger should align with the tooltip for icon-only\n * switcher item\n */\n @property({ reflect: true, type: String })\n align = 'top';\n\n /**\n * Determines whether the tooltip should close when inner content is\n * activated (click, Enter or Space)\n */\n @property({ attribute: 'close-on-activation', reflect: true, type: Boolean })\n closeOnActivation = true;\n\n /**\n * Specify the duration in milliseconds to delay before displaying the\n * tooltip for icon-only switcher item\n */\n enterDelayMs = 100;\n\n /**\n * Specify the duration in milliseconds to delay before hiding the tooltip\n * for icon-only switcher-item\n *\n * TODO: match upstream value once #10471 is resolved\n */\n leaveDelayMs = 100;\n\n updated(changedProperties) {\n if (changedProperties) {\n this.shadowRoot\n ?.querySelector(`${prefix}-tooltip`)\n ?.shadowRoot?.querySelector(`.${prefix}--tooltip`)\n ?.classList.add(`${prefix}--icon-tooltip`);\n }\n }\n\n // eslint-disable-next-line class-methods-use-this\n protected _renderTooltipContent() {\n return html`\n <cds-tooltip-content>\n <slot name=\"tooltip-content\"></slot>\n </cds-tooltip-content>\n `;\n }\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('selected') || changedProperties.has('target')) {\n const { selected, target } = this;\n if (target) {\n const doc = this.getRootNode() as HTMLDocument;\n // `doc` can be an element if such element is orphaned\n const targetNode = doc?.getElementById(target);\n targetNode?.toggleAttribute('hidden', !selected);\n }\n }\n return true;\n }\n\n render() {\n const { disabled, selected, target } = this;\n const className = classMap({\n [`${prefix}--content-switcher-btn`]: true,\n [`${prefix}--content-switcher--selected`]: selected,\n });\n const switcherItem = html`<button\n type=\"button\"\n role=\"tab\"\n class=\"${className}\"\n ?disabled=\"${disabled}\"\n tabindex=\"${selected ? '0' : '-1'}\"\n aria-controls=\"${ifDefined(target)}\"\n aria-selected=\"${Boolean(selected)}\">\n <span class=\"${prefix}--content-switcher__label\"><slot></slot></span>\n </button>`;\n\n if (this.icon) {\n const { align, closeOnActivation, enterDelayMs, leaveDelayMs } = this;\n return html`<cds-tooltip\n align=${align}\n close-on-activation=\"${closeOnActivation}\"\n enter-delay-ms=${enterDelayMs}\n leave-delay-ms=${leaveDelayMs}>\n ${switcherItem} ${this._renderTooltipContent()}\n </cds-tooltip>`;\n }\n return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AA,SAArDQ,sBAAsB,IAAAmD,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-switcher.js","names":["LitElement","html","property","prefix","forEach","indexOf","NAVIGATION_DIRECTION","CONTENT_SWITCHER_SIZE","styles","carbonElement","customElement","capIndex","index","length","CDSContentSwitcher","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleHover","target","type","selectorItem","items","querySelectorAll","closest","nextIndex","elem","i","hideDivider","selectorItemSelected","selectedItem","querySelector","nextItem","_getNextItem","_getCurrentItem","_items$index","selectorItemEnabled","containerItem","currentItem","direction","currentIndex","_handleClick","_handleUserInitiatedSelectItem","_handleKeydown","_navigate","item","disabled","init","bubbles","composed","detail","beforeSelectEvent","CustomEvent","eventBeforeSelect","_objectSpread","cancelable","dispatchEvent","_selectionDidChange","afterSelectEvent","eventSelect","requestUpdate","itemToSelect","selected","Promise","resolve","then","focus","decorators","reflect","REGULAR","Boolean","attribute","shouldUpdate","changedProperties","has","selectorIconItem","iconOnly","_handleSlotchange","static","render","handleHover","handleKeydown","handleSlotchange","_t","_","default"],"sources":["components/content-switcher/content-switcher.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2024\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 { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport { forEach, indexOf } from '../../globals/internal/collection-helpers';\nimport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';\nimport CDSContentSwitcherItem from './content-switcher-item';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };\n\n/**\n * @param index The index\n * @param length The length of the array.\n * @returns The new index, adjusting overflow/underflow.\n */\nconst capIndex = (index: number, length: number) => {\n if (index < 0) {\n return length - 1;\n }\n if (index >= length) {\n return 0;\n }\n return index;\n};\n\n/**\n * Content switcher.\n *\n * @element cds-content-switcher\n * @fires cds-content-switcher-beingselected\n * The custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires cds-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.\n */\n@customElement(`${prefix}-content-switcher`)\nexport default class CDSContentSwitcher extends LitElement {\n /**\n * Handles `mouseover`/`mouseout` events on `<slot>`.\n *\n * @param event The event.\n * @param event.target The event target.\n * @param event.type The event type.\n */\n private _handleHover({ target, type }: MouseEvent) {\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index =\n type !== 'mouseover'\n ? -1\n : indexOf(items, (target as Element).closest(selectorItem)!);\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<cds-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as CDSContentSwitcherItem).hideDivider = i === nextIndex;\n });\n\n const { selectorItemSelected } = this\n .constructor as typeof CDSContentSwitcher;\n const selectedItem = this.querySelector(selectorItemSelected);\n const nextItem = this._getNextItem(\n selectedItem as CDSContentSwitcherItem,\n 1\n );\n (nextItem as CDSContentSwitcherItem).hideDivider = true;\n }\n\n /**\n * @param target The current event target.\n * @returns The item to be selected.\n */\n protected _getCurrentItem(target: HTMLElement) {\n const items = this.querySelectorAll(\n (this.constructor as typeof CDSContentSwitcher).selectorItemEnabled\n );\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n const containerItem = target.closest(\n selectorItem\n ) as CDSContentSwitcherItem;\n const index = indexOf(items, containerItem);\n return items[index] ?? null;\n }\n\n /**\n * @param currentItem The currently selected item.\n * @param direction The navigation direction.\n * @returns The item to be selected.\n */\n protected _getNextItem(\n currentItem: CDSContentSwitcherItem,\n direction: number\n ) {\n const items = this.querySelectorAll(\n (this.constructor as typeof CDSContentSwitcher).selectorItemEnabled\n );\n const currentIndex = indexOf(items, currentItem);\n const nextIndex = capIndex(currentIndex + direction, items.length);\n return nextIndex === currentIndex ? null : items[nextIndex];\n }\n\n /**\n * Handles `click` event on content switcher item.\n *\n * @param event The event.\n * @param event.target The event target.\n */\n protected _handleClick({ target }: MouseEvent) {\n const currentItem = this._getCurrentItem(target as HTMLElement);\n this._handleUserInitiatedSelectItem(currentItem as CDSContentSwitcherItem);\n }\n\n /**\n * Handles `keydown` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n * @param event.key The event key.\n */\n protected _handleKeydown({ key }: KeyboardEvent) {\n if (key in NAVIGATION_DIRECTION) {\n this._navigate(NAVIGATION_DIRECTION[key]);\n }\n }\n\n /**\n * Handles user-initiated selection of a content switcher item.\n *\n * @param [item] The content switcher item user wants to select.\n */\n protected _handleUserInitiatedSelectItem(item: CDSContentSwitcherItem) {\n if (!item.disabled && item.value !== this.value) {\n const init = {\n bubbles: true,\n composed: true,\n detail: {\n item,\n },\n };\n const constructor = this.constructor as typeof CDSContentSwitcher;\n const beforeSelectEvent = new CustomEvent(constructor.eventBeforeSelect, {\n ...init,\n cancelable: true,\n });\n if (this.dispatchEvent(beforeSelectEvent)) {\n this._selectionDidChange(item);\n const afterSelectEvent = new CustomEvent(constructor.eventSelect, init);\n this.dispatchEvent(afterSelectEvent);\n }\n }\n }\n\n /**\n * Navigates through content switcher items.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n */\n protected _navigate(direction: number) {\n const { selectorItemSelected } = this\n .constructor as typeof CDSContentSwitcher;\n const nextItem = this._getNextItem(\n this.querySelector(selectorItemSelected) as CDSContentSwitcherItem,\n direction\n );\n if (nextItem) {\n this._handleUserInitiatedSelectItem(nextItem as CDSContentSwitcherItem);\n this.requestUpdate();\n }\n }\n\n /**\n * A callback that runs after change in content switcher selection upon user interaction is confirmed.\n *\n * @param itemToSelect A content switcher item.\n */\n protected _selectionDidChange(itemToSelect: CDSContentSwitcherItem) {\n this.value = itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof CDSContentSwitcher).selectorItemSelected\n ),\n (item) => {\n (item as CDSContentSwitcherItem).selected = false;\n }\n );\n itemToSelect.selected = true;\n // Waits for rendering with the new state that updates `tabindex`\n Promise.resolve().then(() => {\n itemToSelect.focus();\n\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index = indexOf(\n items,\n (itemToSelect as Element).closest(selectorItem)!\n );\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<cds-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as CDSContentSwitcherItem).hideDivider = i === nextIndex;\n });\n });\n }\n\n /**\n * The value of the selected item.\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * Content switcher size.\n */\n @property({ reflect: true })\n size = CONTENT_SWITCHER_SIZE.REGULAR;\n\n /**\n * Icon only.\n */\n @property({ type: Boolean, reflect: true, attribute: 'icon' })\n iconOnly = false;\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('value')) {\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n (elem as CDSContentSwitcherItem).selected =\n (elem as CDSContentSwitcherItem).value === this.value;\n });\n }\n const { selectorIconItem } = this.constructor as typeof CDSContentSwitcher;\n if (this.querySelector(selectorIconItem)) {\n this.iconOnly = true;\n }\n return true;\n }\n\n _handleSlotchange() {\n const { selectorItemSelected } = this\n .constructor as typeof CDSContentSwitcher;\n const selectedItem = this.querySelector(selectorItemSelected);\n const nextItem = this._getNextItem(\n selectedItem as CDSContentSwitcherItem,\n 1\n );\n\n // Specifies child `<cds-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (nextItem as CDSContentSwitcherItem).hideDivider = true;\n }\n\n /**\n * A selector that will return content switcher items.\n */\n static get selectorItem() {\n return `${prefix}-content-switcher-item`;\n }\n\n /**\n * A selector that will return content switcher icon items.\n */\n static get selectorIconItem() {\n return `${prefix}-content-switcher-item[icon]`;\n }\n\n /**\n * A selector that will return enabled content switcher items.\n */\n static get selectorItemEnabled() {\n return `${prefix}-content-switcher-item:not([disabled])`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-content-switcher-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-content-switcher-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a content switcher item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-content-switcher-selected`;\n }\n\n render() {\n const {\n _handleHover: handleHover,\n _handleKeydown: handleKeydown,\n _handleSlotchange: handleSlotchange,\n } = this;\n return html`\n <slot\n @click=\"${this._handleClick}\"\n @keydown=\"${handleKeydown}\"\n @mouseover=\"${handleHover}\"\n @mouseout=\"${handleHover}\"\n @slotchange=${handleSlotchange}></slot>\n `;\n }\n\n static styles = styles;\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,IAAI,QAAQ,KAAK;AACtC,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,OAAO,EAAEC,OAAO,QAAQ,2CAA2C;AAC5E,SAASC,oBAAoB,EAAEC,qBAAqB,QAAQ,QAAQ;AAEpE,OAAOC,MAAM,MAAM,6BAAyB;AAC5C,SAASC,aAAa,IAAIC,aAAa,QAAQ,yCAAyC;AAExF,SAASJ,oBAAoB,EAAEC,qBAAqB;;AAEpD;AACA;AACA;AACA;AACA;AACA,MAAMI,QAAQ,GAAGA,CAACC,KAAa,EAAEC,MAAc,KAAK;EAClD,IAAID,KAAK,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AAC,KAAA,EAED,SAAA8D,OAAA,EAAS;QACP,MAAM;UACJ7D,YAAY,EAAE8D,WAAW;UACzBrC,cAAc,EAAEsC,aAAa;UAC7BJ,iBAAiB,EAAEK;QACrB,CAAC,GAAG,IAAI;QACR,OAAOxF,IAAI,CAAAyF,EAAA,KAAAA,EAAA,GAAAC,CAAC;AAChB;AACA,kBAAgB,CAAoB;AACpC,oBAAkB,CAAgB;AAClC,sBAAoB,CAAc;AAClC,qBAAmB,CAAc;AACjC,sBAAoB,CAAmB;AACvC,KAAI,GALc,IAAI,CAAC3C,YAAY,EACfwC,aAAa,EACXD,WAAW,EACZA,WAAW,EACVE,gBAAgB;MAEpC;IAAC;MAAAnE,IAAA;MAAA+D,MAAA;MAAA9D,GAAA;MAAAC,MAAA;QAAA,OAEehB,MAAM;MAAA;IAAA;EAAA;AAAA,GAlRwBR,UAAU;AAAA,SAArCc,kBAAkB,IAAA8E,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"content-switcher.js","names":["LitElement","html","property","prefix","forEach","indexOf","NAVIGATION_DIRECTION","CONTENT_SWITCHER_SIZE","styles","carbonElement","customElement","capIndex","index","length","CDSContentSwitcher","_decorate","_initialize","_LitElement","constructor","args","F","d","kind","key","value","_handleHover","target","type","selectorItem","items","querySelectorAll","closest","nextIndex","elem","i","hideDivider","selectorItemSelected","selectedItem","querySelector","nextItem","_getNextItem","_getCurrentItem","_items$index","selectorItemEnabled","containerItem","currentItem","direction","currentIndex","_handleClick","_handleUserInitiatedSelectItem","_handleKeydown","_navigate","item","disabled","init","bubbles","composed","detail","beforeSelectEvent","CustomEvent","eventBeforeSelect","_objectSpread","cancelable","dispatchEvent","_selectionDidChange","afterSelectEvent","eventSelect","requestUpdate","itemToSelect","selected","Promise","resolve","then","focus","decorators","reflect","REGULAR","Boolean","attribute","shouldUpdate","changedProperties","has","selectorIconItem","iconOnly","_handleSlotchange","static","render","handleHover","handleKeydown","handleSlotchange","_t","_","default"],"sources":["components/content-switcher/content-switcher.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2024\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 { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport { forEach, indexOf } from '../../globals/internal/collection-helpers';\nimport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE } from './defs';\nimport CDSContentSwitcherItem from './content-switcher-item';\nimport styles from './content-switcher.scss';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport { NAVIGATION_DIRECTION, CONTENT_SWITCHER_SIZE };\n\n/**\n * @param index The index\n * @param length The length of the array.\n * @returns The new index, adjusting overflow/underflow.\n */\nconst capIndex = (index: number, length: number) => {\n if (index < 0) {\n return length - 1;\n }\n if (index >= length) {\n return 0;\n }\n return index;\n};\n\n/**\n * Content switcher.\n *\n * @element cds-content-switcher\n * @fires cds-content-switcher-beingselected\n * The custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires cds-content-switcher-selected - The custom event fired after a a content switcher item is selected upon a user gesture.\n */\n@customElement(`${prefix}-content-switcher`)\nexport default class CDSContentSwitcher extends LitElement {\n /**\n * Handles `mouseover`/`mouseout` events on `<slot>`.\n *\n * @param event The event.\n * @param event.target The event target.\n * @param event.type The event type.\n */\n private _handleHover({ target, type }: MouseEvent) {\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index =\n type !== 'mouseover'\n ? -1\n : indexOf(items, (target as Element).closest(selectorItem)!);\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<cds-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as CDSContentSwitcherItem).hideDivider = i === nextIndex;\n });\n\n const { selectorItemSelected } = this\n .constructor as typeof CDSContentSwitcher;\n const selectedItem = this.querySelector(selectorItemSelected);\n const nextItem = this._getNextItem(\n selectedItem as CDSContentSwitcherItem,\n 1\n );\n (nextItem as CDSContentSwitcherItem).hideDivider = true;\n }\n\n /**\n * @param target The current event target.\n * @returns The item to be selected.\n */\n protected _getCurrentItem(target: HTMLElement) {\n const items = this.querySelectorAll(\n (this.constructor as typeof CDSContentSwitcher).selectorItemEnabled\n );\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n const containerItem = target.closest(\n selectorItem\n ) as CDSContentSwitcherItem;\n const index = indexOf(items, containerItem);\n return items[index] ?? null;\n }\n\n /**\n * @param currentItem The currently selected item.\n * @param direction The navigation direction.\n * @returns The item to be selected.\n */\n protected _getNextItem(\n currentItem: CDSContentSwitcherItem,\n direction: number\n ) {\n const items = this.querySelectorAll(\n (this.constructor as typeof CDSContentSwitcher).selectorItemEnabled\n );\n const currentIndex = indexOf(items, currentItem);\n const nextIndex = capIndex(currentIndex + direction, items.length);\n return nextIndex === currentIndex ? null : items[nextIndex];\n }\n\n /**\n * Handles `click` event on content switcher item.\n *\n * @param event The event.\n * @param event.target The event target.\n */\n protected _handleClick({ target }: MouseEvent) {\n const currentItem = this._getCurrentItem(target as HTMLElement);\n this._handleUserInitiatedSelectItem(currentItem as CDSContentSwitcherItem);\n }\n\n /**\n * Handles `keydown` event on the top-level element in the shadow DOM.\n *\n * @param event The event.\n * @param event.key The event key.\n */\n protected _handleKeydown({ key }: KeyboardEvent) {\n if (key in NAVIGATION_DIRECTION) {\n this._navigate(NAVIGATION_DIRECTION[key]);\n }\n }\n\n /**\n * Handles user-initiated selection of a content switcher item.\n *\n * @param [item] The content switcher item user wants to select.\n */\n protected _handleUserInitiatedSelectItem(item: CDSContentSwitcherItem) {\n if (!item.disabled && item.value !== this.value) {\n const init = {\n bubbles: true,\n composed: true,\n detail: {\n item,\n },\n };\n const constructor = this.constructor as typeof CDSContentSwitcher;\n const beforeSelectEvent = new CustomEvent(constructor.eventBeforeSelect, {\n ...init,\n cancelable: true,\n });\n if (this.dispatchEvent(beforeSelectEvent)) {\n this._selectionDidChange(item);\n const afterSelectEvent = new CustomEvent(constructor.eventSelect, init);\n this.dispatchEvent(afterSelectEvent);\n }\n }\n }\n\n /**\n * Navigates through content switcher items.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n */\n protected _navigate(direction: number) {\n const { selectorItemSelected } = this\n .constructor as typeof CDSContentSwitcher;\n const nextItem = this._getNextItem(\n this.querySelector(selectorItemSelected) as CDSContentSwitcherItem,\n direction\n );\n if (nextItem) {\n this._handleUserInitiatedSelectItem(nextItem as CDSContentSwitcherItem);\n this.requestUpdate();\n }\n }\n\n /**\n * A callback that runs after change in content switcher selection upon user interaction is confirmed.\n *\n * @param itemToSelect A content switcher item.\n */\n protected _selectionDidChange(itemToSelect: CDSContentSwitcherItem) {\n this.value = itemToSelect.value;\n forEach(\n this.querySelectorAll(\n (this.constructor as typeof CDSContentSwitcher).selectorItemSelected\n ),\n (item) => {\n (item as CDSContentSwitcherItem).selected = false;\n }\n );\n itemToSelect.selected = true;\n // Waits for rendering with the new state that updates `tabindex`\n Promise.resolve().then(() => {\n itemToSelect.focus();\n\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n const items = this.querySelectorAll(selectorItem);\n const index = indexOf(\n items,\n (itemToSelect as Element).closest(selectorItem)!\n );\n const nextIndex = index < 0 ? index : index + 1;\n forEach(this.querySelectorAll(selectorItem), (elem, i) => {\n // Specifies child `<cds-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (elem as CDSContentSwitcherItem).hideDivider = i === nextIndex;\n });\n });\n }\n\n /**\n * The value of the selected item.\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * Content switcher size.\n */\n @property({ reflect: true })\n size = CONTENT_SWITCHER_SIZE.REGULAR;\n\n /**\n * Icon only.\n */\n @property({ type: Boolean, reflect: true, attribute: 'icon' })\n iconOnly = false;\n\n shouldUpdate(changedProperties) {\n if (changedProperties.has('value')) {\n const { selectorItem } = this.constructor as typeof CDSContentSwitcher;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n (elem as CDSContentSwitcherItem).selected =\n (elem as CDSContentSwitcherItem).value === this.value;\n });\n }\n const { selectorIconItem } = this.constructor as typeof CDSContentSwitcher;\n if (this.querySelector(selectorIconItem)) {\n this.iconOnly = true;\n }\n return true;\n }\n\n _handleSlotchange() {\n const { selectorItemSelected } = this\n .constructor as typeof CDSContentSwitcher;\n const selectedItem = this.querySelector(selectorItemSelected);\n const nextItem = this._getNextItem(\n selectedItem as CDSContentSwitcherItem,\n 1\n );\n\n // Specifies child `<cds-content-switcher-item>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n (nextItem as CDSContentSwitcherItem).hideDivider = true;\n }\n\n /**\n * A selector that will return content switcher items.\n */\n static get selectorItem() {\n return `${prefix}-content-switcher-item`;\n }\n\n /**\n * A selector that will return content switcher icon items.\n */\n static get selectorIconItem() {\n return `${prefix}-content-switcher-item[icon]`;\n }\n\n /**\n * A selector that will return enabled content switcher items.\n */\n static get selectorItemEnabled() {\n return `${prefix}-content-switcher-item:not([disabled])`;\n }\n\n /**\n * A selector that will return selected items.\n */\n static get selectorItemSelected() {\n return `${prefix}-content-switcher-item[selected]`;\n }\n\n /**\n * The name of the custom event fired before a content switcher item is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-content-switcher-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a content switcher item is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-content-switcher-selected`;\n }\n\n render() {\n const {\n _handleHover: handleHover,\n _handleKeydown: handleKeydown,\n _handleSlotchange: handleSlotchange,\n } = this;\n return html`\n <slot\n @click=\"${this._handleClick}\"\n @keydown=\"${handleKeydown}\"\n @mouseover=\"${handleHover}\"\n @mouseout=\"${handleHover}\"\n @slotchange=${handleSlotchange}></sl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AGxC,MAAM,wCAAwC;MAC1D;;MAEA;AACF;AACA;IAFE;MAAAmB,IAAA;MAAA+D,MAAA;MAAA9D,GAAA;MAAAC,KAAA,EAGA,SAAAY,qBAAA,EAAkC;QAChC,OAAO,GAAGjC,MAAM,kCAAkC;MACpD;;MAEA;AACF;AACA;AACA;IAHE;MAAAmB,IAAA;MAAA+D,MAAA;MAAA9D,GAAA;MAAAC,KAAA,EAIA,SAAAoC,kBAAA,EAA+B;QAC7B,OAAO,GAAGzD,MAAM,iCAAiC;MACnD;;MAEA;AACF;AACA;IAFE;MAAAmB,IAAA;MAAA+D,MAAA;MAAA9D,GAAA;MAAAC,KAAA,EAGA,SAAA0C,YAAA,EAAyB;QACvB,OAAO,GAAG/D,MAAM,4BAA4B;MAC9C;IAAC;MAAAmB,IAAA;MAAAC,GAAA;MAAAC,KAAA,EAED,SAAA8D,OAAA,EAAS;QACP,MAAM;UACJ7D,YAAY,EAAE8D,WAAW;UACzBrC,cAAc,EAAEsC,aAAa;UAC7BJ,iBAAiB,EAAEK;QACrB,CAAC,GAAG,IAAI;QACR,OAAOxF,IAAI,CAAAyF,EAAA,KAAAA,EAAA,GAAAC,CAAA;AACf;AACA,kBAFe;AACf,oBADe;AACf,sBADe;AACf,qBADe;AACf,sBADe;AACf,KADe,GAEG,IAAI,CAAC3C,YAAY,EACfwC,aAAa,EACXD,WAAW,EACZA,WAAW,EACVE,gBAAgB;MAEpC;IAAC;MAAAnE,IAAA;MAAA+D,MAAA;MAAA9D,GAAA;MAAAC,MAAA;QAAA,OAEehB,MAAM;MAAA;IAAA;EAAA;AAAA,GAlRwBR,UAAU;AAAA,SAArCc,kBAAkB,IAAA8E,OAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.js","names":["html","property","customElement","prefix","styles","CDSIconButton","CDSCopy","_decorate","_initialize","_CDSIconButton","constructor","args","F","d","kind","key","value","timeoutId","timeout","_this$shadowRoot","buttonClasses","shadowRoot","querySelector","classList","clearTimeout","undefined","_showFeedback","add","_animation","requestUpdate","setTimeout","remove","_createHandleFeedbackTooltip","_handleClickButton","_handleFeedbackTooltip","feedbackTimeout","decorators","type","Number","attribute","_renderTooltipContent","_t","_","feedback","_t2","connectedCallback","closeOnActivation","align","addEventListener","_get","_getPrototypeOf","prototype","call","updated","changedProperties","_this$shadowRoot2","_this$shadowRoot4","_this$parentNode","_this$shadowRoot3","setAttribute","parentNode","host","textContent","static"],"sources":["components/copy/copy.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 { html } from 'lit';\nimport { property, customElement } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport styles from '../copy-button/copy-button.scss';\nimport CDSIconButton from '../icon-button/icon-button';\n\n/**\n * Copy.\n *\n * @element cds-copy\n */\n@customElement(`${prefix}-copy`)\nclass CDSCopy extends CDSIconButton {\n /**\n * `true` to show the feedback tooltip.\n */\n private _showFeedback = false;\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _animation = '';\n\n private _createHandleFeedbackTooltip = () => {\n let timeoutId: number | void;\n return (timeout: number) => {\n const buttonClasses = this.shadowRoot?.querySelector('button')?.classList;\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n this._showFeedback = true;\n buttonClasses?.add(`${prefix}--copy-btn--animating`);\n this._animation = 'fade-in';\n buttonClasses?.add(`${prefix}--copy-btn--${this._animation}`);\n this.requestUpdate();\n timeoutId = setTimeout(() => {\n this._showFeedback = false;\n this._animation = 'fade-out';\n buttonClasses?.remove(`${prefix}--copy-btn--fade-in`);\n buttonClasses?.add(`${prefix}--copy-btn--${this._animation}`);\n this.requestUpdate();\n }, timeout) as unknown as number;\n };\n };\n\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleFeedbackTooltip = this._createHandleFeedbackTooltip();\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickButton() {\n this._handleFeedbackTooltip(this.feedbackTimeout);\n }\n\n /**\n * Specify the string that is displayed when the button is clicked and the content is copi\n */\n @property()\n feedback = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip should remain.\n */\n @property({ type: Number, attribute: 'feedback-timeout' })\n feedbackTimeout = 2000;\n\n // eslint-disable-next-line class-methods-use-this\n protected _renderTooltipContent() {\n return html`\n <cds-tooltip-content>\n ${this._showFeedback\n ? this.feedback\n : html`<slot name=\"tooltip-content\"></slot>`}\n </cds-tooltip-content>\n `;\n }\n\n connectedCallback() {\n this.closeOnActivation = false;\n this.align = 'bottom';\n\n this.addEventListener('click', this._handleClickButton);\n\n super.connectedCallback();\n }\n\n updated(changedProperties) {\n this.shadowRoot\n ?.querySelector('button')\n ?.addEventListener('animationend', () => {\n if (this._animation === 'fade-out') {\n const buttonClasses =\n this.shadowRoot?.querySelector('button')?.classList;\n buttonClasses?.remove(`${prefix}--copy-btn--animating`);\n buttonClasses?.remove(`${prefix}--copy-btn--${this._animation}`);\n this._animation = '';\n }\n });\n\n super.updated(changedProperties);\n\n this.shadowRoot\n ?.querySelector('button') // @ts-ignore: TS thinks `host` doesn't exist on `parentNode`\n ?.setAttribute('aria-label', this.parentNode?.host.textContent);\n }\n\n static styles = styles;\n}\n\nexport default CDSCopy;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,KAAK;AAC1B,SAASC,QAAQ,EAAEC,aAAa,QAAQ,mBAAmB;AAC3D,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,OAAOC,MAAM,MAAM,qCAAiC;AACpD,OAAOC,aAAa,MAAM,4BAA4B;;AAEtD;AACA;AACA;AACA;AACA;AAJA,IAMMC,OAAO,GAAAC,SAAA,EADZL,aAAa,
|
|
1
|
+
{"version":3,"file":"copy.js","names":["html","property","customElement","prefix","styles","CDSIconButton","CDSCopy","_decorate","_initialize","_CDSIconButton","constructor","args","F","d","kind","key","value","timeoutId","timeout","_this$shadowRoot","buttonClasses","shadowRoot","querySelector","classList","clearTimeout","undefined","_showFeedback","add","_animation","requestUpdate","setTimeout","remove","_createHandleFeedbackTooltip","_handleClickButton","_handleFeedbackTooltip","feedbackTimeout","decorators","type","Number","attribute","_renderTooltipContent","_t","_","feedback","_t2","connectedCallback","closeOnActivation","align","addEventListener","_get","_getPrototypeOf","prototype","call","updated","changedProperties","_this$shadowRoot2","_this$shadowRoot4","_this$parentNode","_this$shadowRoot3","setAttribute","parentNode","host","textContent","static"],"sources":["components/copy/copy.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 { html } from 'lit';\nimport { property, customElement } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport styles from '../copy-button/copy-button.scss';\nimport CDSIconButton from '../icon-button/icon-button';\n\n/**\n * Copy.\n *\n * @element cds-copy\n */\n@customElement(`${prefix}-copy`)\nclass CDSCopy extends CDSIconButton {\n /**\n * `true` to show the feedback tooltip.\n */\n private _showFeedback = false;\n\n /**\n * `true` to show the feedback tooltip.\n */\n private _animation = '';\n\n private _createHandleFeedbackTooltip = () => {\n let timeoutId: number | void;\n return (timeout: number) => {\n const buttonClasses = this.shadowRoot?.querySelector('button')?.classList;\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = undefined;\n }\n this._showFeedback = true;\n buttonClasses?.add(`${prefix}--copy-btn--animating`);\n this._animation = 'fade-in';\n buttonClasses?.add(`${prefix}--copy-btn--${this._animation}`);\n this.requestUpdate();\n timeoutId = setTimeout(() => {\n this._showFeedback = false;\n this._animation = 'fade-out';\n buttonClasses?.remove(`${prefix}--copy-btn--fade-in`);\n buttonClasses?.add(`${prefix}--copy-btn--${this._animation}`);\n this.requestUpdate();\n }, timeout) as unknown as number;\n };\n };\n\n /**\n * Handles showing/hiding the feedback tooltip.\n */\n private _handleFeedbackTooltip = this._createHandleFeedbackTooltip();\n\n /**\n * Handles `click` event on the copy button.\n */\n private _handleClickButton() {\n this._handleFeedbackTooltip(this.feedbackTimeout);\n }\n\n /**\n * Specify the string that is displayed when the button is clicked and the content is copi\n */\n @property()\n feedback = 'Copied!';\n\n /**\n * The number in milliseconds to determine how long the tooltip should remain.\n */\n @property({ type: Number, attribute: 'feedback-timeout' })\n feedbackTimeout = 2000;\n\n // eslint-disable-next-line class-methods-use-this\n protected _renderTooltipContent() {\n return html`\n <cds-tooltip-content>\n ${this._showFeedback\n ? this.feedback\n : html`<slot name=\"tooltip-content\"></slot>`}\n </cds-tooltip-content>\n `;\n }\n\n connectedCallback() {\n this.closeOnActivation = false;\n this.align = 'bottom';\n\n this.addEventListener('click', this._handleClickButton);\n\n super.connectedCallback();\n }\n\n updated(changedProperties) {\n this.shadowRoot\n ?.querySelector('button')\n ?.addEventListener('animationend', () => {\n if (this._animation === 'fade-out') {\n const buttonClasses =\n this.shadowRoot?.querySelector('button')?.classList;\n buttonClasses?.remove(`${prefix}--copy-btn--animating`);\n buttonClasses?.remove(`${prefix}--copy-btn--${this._animation}`);\n this._animation = '';\n }\n });\n\n super.updated(changedProperties);\n\n this.shadowRoot\n ?.querySelector('button') // @ts-ignore: TS thinks `host` doesn't exist on `parentNode`\n ?.setAttribute('aria-label', this.parentNode?.host.textContent);\n }\n\n static styles = styles;\n}\n\nexport default CDSCopy;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,KAAK;AAC1B,SAASC,QAAQ,EAAEC,aAAa,QAAQ,mBAAmB;AAC3D,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,OAAOC,MAAM,MAAM,qCAAiC;AACpD,OAAOC,aAAa,MAAM,4BAA4B;;AAEtD;AACA;AACA;AACA;AACA;AAJA,IAMMC,OAAO,GAAAC,SAAA,EADZL,aAAa,CA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