@pine-ds/core 5.0.0-mercury.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/aria-references.js +1 -0
- package/components/attributes.js +1 -0
- package/components/closest.js +1 -11
- package/components/floating-ui.dom.js +1 -0
- package/components/form.js +1 -0
- package/components/i18n-format.js +1 -0
- package/components/index.d.ts +51 -0
- package/components/index.js +1 -33
- package/components/index2.js +1 -14
- package/components/keep-hydrated.js +1 -0
- package/components/mock-pds-modal.d.ts +11 -0
- package/components/mock-pds-modal.js +1 -0
- package/components/pds-accordion.js +1 -68
- package/components/pds-alert.d.ts +11 -0
- package/components/pds-alert.js +1 -0
- package/components/pds-avatar.js +1 -103
- package/components/pds-box.js +1 -124
- package/components/pds-box2.js +1 -0
- package/components/pds-button.js +1 -8
- package/components/pds-button2.js +1 -84
- package/components/pds-checkbox.js +1 -8
- package/components/pds-checkbox2.js +1 -101
- package/components/pds-chip.js +1 -78
- package/components/pds-chip2.js +1 -0
- package/components/pds-combobox.d.ts +11 -0
- package/components/pds-combobox.js +2 -0
- package/components/pds-container.d.ts +11 -0
- package/components/pds-container.js +1 -0
- package/components/pds-copytext.js +1 -88
- package/components/pds-datepicker.d.ts +11 -0
- package/components/pds-datepicker.js +1 -0
- package/components/pds-divider.js +1 -54
- package/components/pds-drawer-content.d.ts +11 -0
- package/components/pds-drawer-content.js +1 -0
- package/components/pds-drawer-footer.d.ts +11 -0
- package/components/pds-drawer-footer.js +1 -0
- package/components/pds-drawer-header.d.ts +11 -0
- package/components/pds-drawer-header.js +1 -0
- package/components/pds-drawer.d.ts +11 -0
- package/components/pds-drawer.js +1 -0
- package/components/pds-dropdown-menu-item.d.ts +11 -0
- package/components/pds-dropdown-menu-item.js +1 -0
- package/components/pds-dropdown-menu-separator.d.ts +11 -0
- package/components/pds-dropdown-menu-separator.js +1 -0
- package/components/pds-dropdown-menu.d.ts +11 -0
- package/components/pds-dropdown-menu.js +1 -0
- package/components/pds-filter.d.ts +11 -0
- package/components/pds-filter.js +1 -0
- package/components/pds-filters.d.ts +11 -0
- package/components/pds-filters.js +1 -0
- package/components/pds-icon.js +1 -8
- package/components/pds-icon2.js +1 -370
- package/components/pds-image.js +1 -55
- package/components/pds-input.js +1 -72
- package/components/pds-input2.js +1 -0
- package/components/pds-link.js +1 -65
- package/components/pds-link2.js +1 -0
- package/components/pds-loader.js +1 -68
- package/components/pds-loader2.js +1 -0
- package/components/pds-modal-content.d.ts +11 -0
- package/components/pds-modal-content.js +1 -0
- package/components/pds-modal-footer.d.ts +11 -0
- package/components/pds-modal-footer.js +1 -0
- package/components/pds-modal-header.d.ts +11 -0
- package/components/pds-modal-header.js +1 -0
- package/components/pds-modal.d.ts +11 -0
- package/components/pds-modal.js +1 -0
- package/components/pds-modal2.js +1 -0
- package/components/pds-multiselect.d.ts +11 -0
- package/components/pds-multiselect.js +1 -0
- package/components/pds-popover.d.ts +11 -0
- package/components/pds-popover.js +1 -0
- package/components/pds-progress.js +1 -49
- package/components/pds-property.d.ts +11 -0
- package/components/pds-property.js +1 -0
- package/components/pds-radio-group.d.ts +11 -0
- package/components/pds-radio-group.js +1 -0
- package/components/pds-radio.js +1 -78
- package/components/pds-row.js +1 -72
- package/components/pds-select.d.ts +11 -0
- package/components/pds-select.js +1 -0
- package/components/pds-sortable-item.js +1 -58
- package/components/pds-sortable.js +3 -2718
- package/components/pds-switch.js +1 -82
- package/components/pds-tab.js +1 -53
- package/components/pds-table-body.js +1 -36
- package/components/pds-table-cell.js +1 -8
- package/components/pds-table-cell2.js +1 -72
- package/components/pds-table-head-cell.js +1 -8
- package/components/pds-table-head-cell2.js +1 -98
- package/components/pds-table-head.js +1 -90
- package/components/pds-table-row.js +1 -95
- package/components/pds-table.js +1 -124
- package/components/pds-tabpanel.js +1 -45
- package/components/pds-tabs.js +1 -119
- package/components/pds-text.d.ts +11 -0
- package/components/pds-text.js +1 -0
- package/components/pds-text2.js +1 -0
- package/components/pds-textarea.js +1 -82
- package/components/pds-toast.d.ts +11 -0
- package/components/pds-toast.js +1 -0
- package/components/pds-tooltip.js +1 -178
- package/components/portal-target.js +1 -0
- package/components/reconnected-content.js +1 -0
- package/components/reflected-attribute-default.js +1 -0
- package/components/scroll.js +1 -0
- package/components/sortable-label.js +1 -0
- package/components/tabbable.js +1 -0
- package/components/truncation-tooltip.js +1 -0
- package/components/utils.js +1 -0
- package/dist/cjs/aria-references-CUmqibnO.js +54 -0
- package/dist/cjs/attributes-Cgbkw6gO.js +188 -0
- package/dist/cjs/closest-D0qyYtJ3.js +20 -0
- package/dist/cjs/floating-ui.dom-Dw41zbyY.js +1715 -0
- package/dist/cjs/form-MhwfKTuo.js +69 -0
- package/dist/cjs/i18n-format-BD0PmYzT.js +65 -0
- package/dist/cjs/index-BDnbr0DK.js +39 -0
- package/dist/cjs/index-D9iJuJCP.js +2950 -0
- package/dist/cjs/index.cjs.js +21 -2
- package/dist/cjs/keep-hydrated-AKoh0DG4.js +197 -0
- package/dist/cjs/loader.cjs.js +4 -8
- package/dist/cjs/mock-pds-modal.cjs.entry.js +92 -0
- package/dist/cjs/pds-accordion.cjs.entry.js +16 -14
- package/dist/cjs/pds-alert.cjs.entry.js +88 -0
- package/dist/cjs/pds-avatar.cjs.entry.js +123 -28
- package/dist/cjs/pds-box.cjs.entry.js +143 -58
- package/dist/cjs/pds-button.cjs.entry.js +234 -25
- package/dist/cjs/pds-checkbox.cjs.entry.js +102 -26
- package/dist/cjs/pds-chip.cjs.entry.js +226 -23
- package/dist/cjs/pds-combobox.cjs.entry.js +4500 -0
- package/dist/cjs/pds-container.cjs.entry.js +37 -0
- package/dist/cjs/pds-copytext.cjs.entry.js +98 -17
- package/dist/cjs/pds-datepicker.cjs.entry.js +2139 -0
- package/dist/cjs/pds-divider.cjs.entry.js +16 -11
- package/dist/cjs/pds-drawer-content.cjs.entry.js +24 -0
- package/dist/cjs/pds-drawer-footer.cjs.entry.js +24 -0
- package/dist/cjs/pds-drawer-header.cjs.entry.js +24 -0
- package/dist/cjs/pds-drawer.cjs.entry.js +156 -0
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +151 -0
- package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +23 -0
- package/dist/cjs/pds-dropdown-menu.cjs.entry.js +453 -0
- package/dist/cjs/pds-filter.cjs.entry.js +512 -0
- package/dist/cjs/pds-filters.cjs.entry.js +18 -0
- package/dist/cjs/pds-icon.cjs.entry.js +334 -44
- package/dist/cjs/pds-image.cjs.entry.js +158 -16
- package/dist/cjs/pds-input.cjs.entry.js +300 -26
- package/dist/cjs/pds-link.cjs.entry.js +50 -13
- package/dist/cjs/pds-loader.cjs.entry.js +49 -14
- package/dist/cjs/pds-modal-content.cjs.entry.js +199 -0
- package/dist/cjs/pds-modal-footer.cjs.entry.js +24 -0
- package/dist/cjs/pds-modal-header.cjs.entry.js +24 -0
- package/dist/cjs/pds-modal.cjs.entry.js +592 -0
- package/dist/cjs/pds-multiselect.cjs.entry.js +1384 -0
- package/dist/cjs/pds-popover.cjs.entry.js +1103 -0
- package/dist/cjs/pds-progress.cjs.entry.js +30 -12
- package/dist/cjs/pds-property.cjs.entry.js +22 -0
- package/dist/cjs/pds-radio-group.cjs.entry.js +260 -0
- package/dist/cjs/pds-radio.cjs.entry.js +101 -23
- package/dist/cjs/pds-row.cjs.entry.js +50 -21
- package/dist/cjs/pds-select.cjs.entry.js +380 -0
- package/dist/cjs/pds-sortable-item.cjs.entry.js +59 -11
- package/dist/cjs/pds-sortable.cjs.entry.js +504 -119
- package/dist/cjs/pds-switch.cjs.entry.js +185 -27
- package/dist/cjs/pds-tab.cjs.entry.js +78 -16
- package/dist/cjs/pds-table-body.cjs.entry.js +5 -9
- package/dist/cjs/pds-table-cell.cjs.entry.js +150 -19
- package/dist/cjs/pds-table-head-cell.cjs.entry.js +222 -30
- package/dist/cjs/pds-table-head.cjs.entry.js +17 -13
- package/dist/cjs/pds-table-row.cjs.entry.js +104 -16
- package/dist/cjs/pds-table.cjs.entry.js +434 -22
- package/dist/cjs/pds-tabpanel.cjs.entry.js +32 -13
- package/dist/cjs/pds-tabs.cjs.entry.js +206 -18
- package/dist/cjs/pds-text.cjs.entry.js +141 -0
- package/dist/cjs/pds-textarea.cjs.entry.js +318 -29
- package/dist/cjs/pds-toast.cjs.entry.js +156 -0
- package/dist/cjs/pds-tooltip.cjs.entry.js +401 -110
- package/dist/cjs/pine-core.cjs.js +8 -10
- package/dist/cjs/portal-target-e8WQ6dLx.js +70 -0
- package/dist/cjs/reconnected-content-CpnEQcTp.js +29 -0
- package/dist/cjs/reflected-attribute-default-DVYHG6O1.js +44 -0
- package/dist/cjs/scroll-2XcoE_6Q.js +79 -0
- package/dist/cjs/sortable-label-DOcJrHvA.js +37 -0
- package/dist/cjs/tabbable-BrrrGvdG.js +86 -0
- package/dist/cjs/truncation-tooltip-CM5HgRHh.js +430 -0
- package/dist/cjs/utils-BhRmyxT8.js +121 -0
- package/dist/collection/collection-manifest.json +30 -3
- package/dist/collection/components/_internal/pds-label/pds-label.js +0 -1
- package/dist/collection/components/pds-accordion/pds-accordion.css +24 -29
- package/dist/collection/components/pds-accordion/pds-accordion.js +36 -9
- package/dist/collection/components/pds-accordion/stories/pds-accordion.stories.js +12 -18
- package/dist/collection/components/pds-alert/pds-alert.css +141 -0
- package/dist/collection/components/pds-alert/pds-alert.js +291 -0
- package/dist/collection/components/pds-alert/pds-alert.tokens.css +85 -0
- package/dist/collection/components/pds-alert/stories/pds-alert.stories.js +114 -0
- package/dist/collection/components/pds-avatar/pds-avatar.css +56 -23
- package/dist/collection/components/pds-avatar/pds-avatar.js +284 -32
- package/dist/collection/components/pds-avatar/stories/pds-avatar.stories.js +41 -3
- package/dist/collection/components/pds-box/pds-box.css +5520 -264
- package/dist/collection/components/pds-box/pds-box.js +2854 -252
- package/dist/collection/components/pds-box/stories/pds-box.stories.js +86 -30
- package/dist/collection/components/pds-button/pds-button.css +255 -93
- package/dist/collection/components/pds-button/pds-button.js +470 -40
- package/dist/collection/components/pds-button/stories/pds-button.stories.js +242 -16
- package/dist/collection/components/pds-checkbox/checkbox-interface.js +0 -1
- package/dist/collection/components/pds-checkbox/pds-checkbox.css +168 -60
- package/dist/collection/components/pds-checkbox/pds-checkbox.js +186 -54
- package/dist/collection/components/pds-checkbox/stories/pds-checkbox.stories.js +45 -15
- package/dist/collection/components/pds-chip/pds-chip.css +239 -114
- package/dist/collection/components/pds-chip/pds-chip.js +437 -60
- package/dist/collection/components/pds-chip/pds-chip.tokens.css +69 -0
- package/dist/collection/components/pds-chip/stories/pds-chip.stories.js +164 -24
- package/dist/collection/components/pds-combobox/combobox-interface.js +1 -0
- package/dist/collection/components/pds-combobox/grouped-options-panel.js +318 -0
- package/dist/collection/components/pds-combobox/pds-combobox.css +953 -0
- package/dist/collection/components/pds-combobox/pds-combobox.js +3839 -0
- package/dist/collection/components/pds-combobox/stories/pds-combobox.stories.js +934 -0
- package/dist/collection/components/pds-container/pds-container.css +26 -0
- package/dist/collection/components/pds-container/pds-container.js +111 -0
- package/dist/collection/components/pds-container/stories/pds-container.stories.js +89 -0
- package/dist/collection/components/pds-copytext/pds-copytext.css +39 -51
- package/dist/collection/components/pds-copytext/pds-copytext.js +116 -23
- package/dist/collection/components/pds-copytext/stories/pds-copytext.stories.js +6 -12
- package/dist/collection/components/pds-datepicker/calendar-portal.js +99 -0
- package/dist/collection/components/pds-datepicker/date-utils.js +174 -0
- package/dist/collection/components/pds-datepicker/datepicker-interface.js +1 -0
- package/dist/collection/components/pds-datepicker/pds-datepicker.css +547 -0
- package/dist/collection/components/pds-datepicker/pds-datepicker.js +2505 -0
- package/dist/collection/components/pds-datepicker/presets.js +131 -0
- package/dist/collection/components/pds-datepicker/stories/pds-datepicker.stories.js +206 -0
- package/dist/collection/components/pds-datepicker/value.js +296 -0
- package/dist/collection/components/pds-divider/pds-divider.css +71 -40
- package/dist/collection/components/pds-divider/pds-divider.js +47 -11
- package/dist/collection/components/pds-divider/stories/pds-divider.stories.js +7 -2
- package/dist/collection/components/pds-drawer/pds-drawer-content/pds-drawer-content.css +22 -0
- package/dist/collection/components/pds-drawer/pds-drawer-content/pds-drawer-content.js +27 -0
- package/dist/collection/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.css +15 -0
- package/dist/collection/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.js +27 -0
- package/dist/collection/components/pds-drawer/pds-drawer-header/pds-drawer-header.css +15 -0
- package/dist/collection/components/pds-drawer/pds-drawer-header/pds-drawer-header.js +27 -0
- package/dist/collection/components/pds-drawer/pds-drawer.css +47 -0
- package/dist/collection/components/pds-drawer/pds-drawer.js +405 -0
- package/dist/collection/components/pds-drawer/stories/pds-drawer.stories.js +77 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.css +93 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js +398 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.css +7 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.js +71 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.css +68 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +545 -0
- package/dist/collection/components/pds-dropdown-menu/stories/pds-dropdown-menu.stories.js +100 -0
- package/dist/collection/components/pds-filters/pds-filter/filter-interface.js +1 -0
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.css +200 -0
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.js +756 -0
- package/dist/collection/components/pds-filters/pds-filter/stories/pds-filter.stories.js +87 -0
- package/dist/collection/components/pds-filters/pds-filters.css +10 -0
- package/dist/collection/components/pds-filters/pds-filters.js +44 -0
- package/dist/collection/components/pds-filters/stories/pds-filters.stories.js +34 -0
- package/dist/collection/components/pds-icon/stories/pds-icon.stories.js +2 -2
- package/dist/collection/components/pds-image/image-interface.js +1 -0
- package/dist/collection/components/pds-image/pds-image.css +13 -1
- package/dist/collection/components/pds-image/pds-image.js +297 -31
- package/dist/collection/components/pds-image/stories/pds-image.stories.js +124 -8
- package/dist/collection/components/pds-input/input-interface.js +1 -0
- package/dist/collection/components/pds-input/pds-input.css +275 -63
- package/dist/collection/components/pds-input/pds-input.js +687 -57
- package/dist/collection/components/pds-input/pds-input.tokens.css +3 -0
- package/dist/collection/components/pds-input/stories/pds-input.stories.js +310 -14
- package/dist/collection/components/pds-link/pds-link.css +45 -30
- package/dist/collection/components/pds-link/pds-link.js +332 -19
- package/dist/collection/components/pds-link/stories/pds-link.stories.js +82 -4
- package/dist/collection/components/pds-loader/pds-loader.css +17 -30
- package/dist/collection/components/pds-loader/pds-loader.js +62 -14
- package/dist/collection/components/pds-loader/stories/pds-loader.stories.js +3 -5
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.css +25 -0
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js +235 -0
- package/dist/collection/components/pds-modal/pds-modal-footer/pds-modal-footer.css +8 -0
- package/dist/collection/components/pds-modal/pds-modal-footer/pds-modal-footer.js +27 -0
- package/dist/collection/components/pds-modal/pds-modal-header/pds-modal-header.css +8 -0
- package/dist/collection/components/pds-modal/pds-modal-header/pds-modal-header.js +27 -0
- package/dist/collection/components/pds-modal/pds-modal.css +142 -0
- package/dist/collection/components/pds-modal/pds-modal.js +852 -0
- package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +745 -0
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js +286 -0
- package/dist/collection/components/pds-multiselect/multiselect-interface.js +1 -0
- package/dist/collection/components/pds-multiselect/pds-multiselect.css +365 -0
- package/dist/collection/components/pds-multiselect/pds-multiselect.js +2597 -0
- package/dist/collection/components/pds-multiselect/stories/pds-multiselect.stories.js +866 -0
- package/dist/collection/components/pds-popover/pds-popover.css +16 -0
- package/dist/collection/components/pds-popover/pds-popover.js +1347 -0
- package/dist/collection/components/pds-popover/popover-interface.js +1 -0
- package/dist/collection/components/pds-popover/stories/pds-popover.stories.js +117 -0
- package/dist/collection/components/pds-progress/pds-progress.css +11 -24
- package/dist/collection/components/pds-progress/pds-progress.js +49 -16
- package/dist/collection/components/pds-progress/stories/pds-progress.stories.js +2 -4
- package/dist/collection/components/pds-property/pds-property.css +4 -0
- package/dist/collection/components/pds-property/pds-property.js +70 -0
- package/dist/collection/components/pds-property/stories/pds-property.stories.js +16 -0
- package/dist/collection/components/pds-radio/pds-radio.css +285 -54
- package/dist/collection/components/pds-radio/pds-radio.js +226 -53
- package/dist/collection/components/pds-radio/stories/pds-radio.stories.js +66 -19
- package/dist/collection/components/pds-radio-group/pds-radio-group.css +45 -0
- package/dist/collection/components/pds-radio-group/pds-radio-group.js +514 -0
- package/dist/collection/components/pds-radio-group/radio-group-interface.js +1 -0
- package/dist/collection/components/pds-radio-group/stories/pds-radio-group.stories.js +179 -0
- package/dist/collection/components/pds-row/pds-row.css +10 -9
- package/dist/collection/components/pds-row/pds-row.js +132 -30
- package/dist/collection/components/pds-row/stories/pds-row.stories.js +27 -24
- package/dist/collection/components/pds-select/pds-select.css +168 -0
- package/dist/collection/components/pds-select/pds-select.js +728 -0
- package/dist/collection/components/pds-select/pds-select.tokens.css +3 -0
- package/dist/collection/components/pds-select/stories/pds-select.stories.js +205 -0
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.css +64 -26
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js +87 -10
- package/dist/collection/components/pds-sortable/pds-sortable-item/stories/pds-sortable-item.stories.js +0 -2
- package/dist/collection/components/pds-sortable/pds-sortable.css +2 -4
- package/dist/collection/components/pds-sortable/pds-sortable.js +571 -17
- package/dist/collection/components/pds-sortable/sortable-interface.js +0 -1
- package/dist/collection/components/pds-sortable/sortable-label.js +33 -0
- package/dist/collection/components/pds-sortable/stories/pds-sortable.stories.js +49 -13
- package/dist/collection/components/pds-switch/pds-switch.css +60 -59
- package/dist/collection/components/pds-switch/pds-switch.js +268 -63
- package/dist/collection/components/pds-switch/stories/pds-switch.stories.js +90 -28
- package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js +4 -2
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.css +36 -19
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.js +193 -15
- package/dist/collection/components/pds-table/pds-table-cell/stories/pds-table-cell.stories.js +22 -7
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.css +22 -5
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js +75 -11
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.css +57 -25
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +328 -24
- package/dist/collection/components/pds-table/pds-table-head-cell/stories/pds-table-head-cell.stories.js +12 -7
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.css +14 -5
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js +118 -13
- package/dist/collection/components/pds-table/pds-table-row/stories/pds-table-row.stories.js +3 -9
- package/dist/collection/components/pds-table/pds-table.css +106 -17
- package/dist/collection/components/pds-table/pds-table.js +576 -44
- package/dist/collection/components/pds-table/stories/pds-table.stories.js +428 -33
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.css +102 -60
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.js +240 -18
- package/dist/collection/components/pds-tabs/pds-tab/stories/pds-tab.stories.js +15 -0
- package/dist/collection/components/pds-tabs/pds-tabpanel/pds-tabpanel.css +15 -2
- package/dist/collection/components/pds-tabs/pds-tabpanel/pds-tabpanel.js +68 -12
- package/dist/collection/components/pds-tabs/pds-tabpanel/stories/pds-tabpanel.stories.js +15 -0
- package/dist/collection/components/pds-tabs/pds-tabs.css +31 -11
- package/dist/collection/components/pds-tabs/pds-tabs.js +301 -30
- package/dist/collection/components/pds-tabs/stories/pds-tabs.stories.js +70 -27
- package/dist/collection/components/pds-text/pds-text.css +207 -0
- package/dist/collection/components/pds-text/pds-text.js +328 -0
- package/dist/collection/components/pds-text/stories/pds-text.stories.js +141 -0
- package/dist/collection/components/pds-textarea/pds-textarea.css +127 -57
- package/dist/collection/components/pds-textarea/pds-textarea.js +598 -57
- package/dist/collection/components/pds-textarea/stories/pds-textarea.stories.js +101 -25
- package/dist/collection/components/pds-textarea/textarea-interface.js +0 -1
- package/dist/collection/components/pds-toast/pds-toast.css +167 -0
- package/dist/collection/components/pds-toast/pds-toast.js +362 -0
- package/dist/collection/components/pds-toast/stories/pds-toast.stories.js +98 -0
- package/dist/collection/components/pds-tooltip/pds-tooltip.css +73 -79
- package/dist/collection/components/pds-tooltip/pds-tooltip.js +451 -80
- package/dist/collection/components/pds-tooltip/stories/pds-tooltip.stories.js +52 -24
- package/dist/collection/global/pine-global.js +6 -0
- package/dist/collection/global/pine-ui-global.js +0 -1
- package/dist/collection/global/styles/utils/label.css +17 -0
- package/dist/collection/i18n/i18n-format.js +59 -0
- package/dist/collection/i18n/index.js +1 -0
- package/dist/collection/index.js +3 -1
- package/dist/collection/utils/aria-references.js +48 -0
- package/dist/collection/utils/attributes.js +180 -0
- package/dist/collection/utils/closest.js +8 -1
- package/dist/collection/utils/css.js +41 -0
- package/dist/collection/utils/form.js +41 -8
- package/dist/collection/utils/interfaces.js +1 -0
- package/dist/collection/utils/keep-hydrated.js +188 -0
- package/dist/collection/utils/overlay.js +66 -50
- package/dist/collection/utils/portal-target.js +64 -0
- package/dist/collection/utils/reconnected-content.js +25 -0
- package/dist/collection/utils/reflected-attribute-default.js +40 -0
- package/dist/collection/utils/scroll.js +77 -0
- package/dist/collection/utils/tabbable.js +82 -0
- package/dist/collection/utils/test/axe.js +106 -0
- package/dist/collection/utils/test/host-strip.js +50 -0
- package/dist/collection/utils/test/reconnect-safety.js +31 -0
- package/dist/collection/utils/test/reduced-motion.js +78 -0
- package/dist/collection/utils/truncation-tooltip.js +422 -0
- package/dist/collection/utils/types.js +18 -2
- package/dist/collection/utils/utils.js +109 -4
- package/dist/docs.d.ts +45 -0
- package/dist/docs.json +25718 -2809
- package/dist/esm/aria-references-CNn1lObg.js +50 -0
- package/dist/esm/attributes-CD8knu3a.js +183 -0
- package/dist/esm/closest-DHPzKMVS.js +17 -0
- package/dist/esm/floating-ui.dom-Cuc0DYlm.js +1706 -0
- package/dist/esm/form-BuRbS7Hp.js +63 -0
- package/dist/esm/i18n-format-BJgZHCWe.js +61 -0
- package/dist/esm/index-4_RRPJTO.js +2938 -0
- package/dist/esm/index-B0DXTeeV.js +21 -0
- package/dist/esm/index.js +21 -2
- package/dist/esm/keep-hydrated-BgNaWLoS.js +190 -0
- package/dist/esm/loader.js +4 -6
- package/dist/esm/mock-pds-modal.entry.js +90 -0
- package/dist/esm/pds-accordion.entry.js +16 -12
- package/dist/esm/pds-alert.entry.js +86 -0
- package/dist/esm/pds-avatar.entry.js +123 -26
- package/dist/esm/pds-box.entry.js +143 -56
- package/dist/esm/pds-button.entry.js +233 -22
- package/dist/esm/pds-checkbox.entry.js +103 -25
- package/dist/esm/pds-chip.entry.js +227 -22
- package/dist/esm/pds-combobox.entry.js +4498 -0
- package/dist/esm/pds-container.entry.js +35 -0
- package/dist/esm/pds-copytext.entry.js +98 -15
- package/dist/esm/pds-datepicker.entry.js +2137 -0
- package/dist/esm/pds-divider.entry.js +16 -9
- package/dist/esm/pds-drawer-content.entry.js +22 -0
- package/dist/esm/pds-drawer-footer.entry.js +22 -0
- package/dist/esm/pds-drawer-header.entry.js +22 -0
- package/dist/esm/pds-drawer.entry.js +154 -0
- package/dist/esm/pds-dropdown-menu-item.entry.js +149 -0
- package/dist/esm/pds-dropdown-menu-separator.entry.js +21 -0
- package/dist/esm/pds-dropdown-menu.entry.js +451 -0
- package/dist/esm/pds-filter.entry.js +510 -0
- package/dist/esm/pds-filters.entry.js +16 -0
- package/dist/esm/pds-icon.entry.js +334 -42
- package/dist/esm/pds-image.entry.js +158 -14
- package/dist/esm/pds-input.entry.js +301 -25
- package/dist/esm/pds-link.entry.js +50 -11
- package/dist/esm/pds-loader.entry.js +49 -12
- package/dist/esm/pds-modal-content.entry.js +197 -0
- package/dist/esm/pds-modal-footer.entry.js +22 -0
- package/dist/esm/pds-modal-header.entry.js +22 -0
- package/dist/esm/pds-modal.entry.js +590 -0
- package/dist/esm/pds-multiselect.entry.js +1382 -0
- package/dist/esm/pds-popover.entry.js +1101 -0
- package/dist/esm/pds-progress.entry.js +30 -10
- package/dist/esm/pds-property.entry.js +20 -0
- package/dist/esm/pds-radio-group.entry.js +258 -0
- package/dist/esm/pds-radio.entry.js +102 -22
- package/dist/esm/pds-row.entry.js +50 -19
- package/dist/esm/pds-select.entry.js +378 -0
- package/dist/esm/pds-sortable-item.entry.js +59 -9
- package/dist/esm/pds-sortable.entry.js +504 -117
- package/dist/esm/pds-switch.entry.js +186 -26
- package/dist/esm/pds-tab.entry.js +78 -14
- package/dist/esm/pds-table-body.entry.js +5 -7
- package/dist/esm/pds-table-cell.entry.js +150 -17
- package/dist/esm/pds-table-head-cell.entry.js +222 -28
- package/dist/esm/pds-table-head.entry.js +17 -11
- package/dist/esm/pds-table-row.entry.js +104 -14
- package/dist/esm/pds-table.entry.js +434 -20
- package/dist/esm/pds-tabpanel.entry.js +32 -11
- package/dist/esm/pds-tabs.entry.js +206 -16
- package/dist/esm/pds-text.entry.js +139 -0
- package/dist/esm/pds-textarea.entry.js +319 -28
- package/dist/esm/pds-toast.entry.js +154 -0
- package/dist/esm/pds-tooltip.entry.js +401 -108
- package/dist/esm/pine-core.js +6 -7
- package/dist/esm/portal-target-CKRzRKdO.js +66 -0
- package/dist/esm/reconnected-content-RFpTWV6r.js +27 -0
- package/dist/esm/reflected-attribute-default-t3idJwV0.js +42 -0
- package/dist/esm/scroll-DtgUQhjl.js +75 -0
- package/dist/esm/sortable-label-PItnzVVR.js +35 -0
- package/dist/esm/tabbable-C6ZWpp3v.js +84 -0
- package/dist/esm/truncation-tooltip-CkIWm6Z-.js +425 -0
- package/dist/esm/utils-OYK5-nwe.js +114 -0
- package/dist/esm-es5/aria-references-CNn1lObg.js +1 -0
- package/dist/esm-es5/attributes-CD8knu3a.js +1 -0
- package/dist/esm-es5/closest-DHPzKMVS.js +1 -0
- package/dist/esm-es5/floating-ui.dom-Cuc0DYlm.js +1 -0
- package/dist/esm-es5/form-BuRbS7Hp.js +1 -0
- package/dist/esm-es5/i18n-format-BJgZHCWe.js +1 -0
- package/dist/esm-es5/index-4_RRPJTO.js +2 -0
- package/dist/esm-es5/index-B0DXTeeV.js +1 -0
- package/dist/esm-es5/index.js +1 -2
- package/dist/esm-es5/keep-hydrated-BgNaWLoS.js +1 -0
- package/dist/esm-es5/loader.js +1 -2
- package/dist/esm-es5/mock-pds-modal.entry.js +1 -0
- package/dist/esm-es5/pds-accordion.entry.js +1 -2
- package/dist/esm-es5/pds-alert.entry.js +1 -0
- package/dist/esm-es5/pds-avatar.entry.js +1 -2
- package/dist/esm-es5/pds-box.entry.js +1 -2
- package/dist/esm-es5/pds-button.entry.js +1 -2
- package/dist/esm-es5/pds-checkbox.entry.js +1 -2
- package/dist/esm-es5/pds-chip.entry.js +1 -2
- package/dist/esm-es5/pds-combobox.entry.js +2 -0
- package/dist/esm-es5/pds-container.entry.js +1 -0
- package/dist/esm-es5/pds-copytext.entry.js +1 -2
- package/dist/esm-es5/pds-datepicker.entry.js +1 -0
- package/dist/esm-es5/pds-divider.entry.js +1 -2
- package/dist/esm-es5/pds-drawer-content.entry.js +1 -0
- package/dist/esm-es5/pds-drawer-footer.entry.js +1 -0
- package/dist/esm-es5/pds-drawer-header.entry.js +1 -0
- package/dist/esm-es5/pds-drawer.entry.js +1 -0
- package/dist/esm-es5/pds-dropdown-menu-item.entry.js +1 -0
- package/dist/esm-es5/pds-dropdown-menu-separator.entry.js +1 -0
- package/dist/esm-es5/pds-dropdown-menu.entry.js +1 -0
- package/dist/esm-es5/pds-filter.entry.js +1 -0
- package/dist/esm-es5/pds-filters.entry.js +1 -0
- package/dist/esm-es5/pds-icon.entry.js +1 -2
- package/dist/esm-es5/pds-image.entry.js +1 -2
- package/dist/esm-es5/pds-input.entry.js +1 -2
- package/dist/esm-es5/pds-link.entry.js +1 -2
- package/dist/esm-es5/pds-loader.entry.js +1 -2
- package/dist/esm-es5/pds-modal-content.entry.js +1 -0
- package/dist/esm-es5/pds-modal-footer.entry.js +1 -0
- package/dist/esm-es5/pds-modal-header.entry.js +1 -0
- package/dist/esm-es5/pds-modal.entry.js +1 -0
- package/dist/esm-es5/pds-multiselect.entry.js +1 -0
- package/dist/esm-es5/pds-popover.entry.js +1 -0
- package/dist/esm-es5/pds-progress.entry.js +1 -2
- package/dist/esm-es5/pds-property.entry.js +1 -0
- package/dist/esm-es5/pds-radio-group.entry.js +1 -0
- package/dist/esm-es5/pds-radio.entry.js +1 -2
- package/dist/esm-es5/pds-row.entry.js +1 -2
- package/dist/esm-es5/pds-select.entry.js +1 -0
- package/dist/esm-es5/pds-sortable-item.entry.js +1 -2
- package/dist/esm-es5/pds-sortable.entry.js +3 -4
- package/dist/esm-es5/pds-switch.entry.js +1 -2
- package/dist/esm-es5/pds-tab.entry.js +1 -2
- package/dist/esm-es5/pds-table-body.entry.js +1 -2
- package/dist/esm-es5/pds-table-cell.entry.js +1 -2
- package/dist/esm-es5/pds-table-head-cell.entry.js +1 -2
- package/dist/esm-es5/pds-table-head.entry.js +1 -2
- package/dist/esm-es5/pds-table-row.entry.js +1 -2
- package/dist/esm-es5/pds-table.entry.js +1 -2
- package/dist/esm-es5/pds-tabpanel.entry.js +1 -2
- package/dist/esm-es5/pds-tabs.entry.js +1 -2
- package/dist/esm-es5/pds-text.entry.js +1 -0
- package/dist/esm-es5/pds-textarea.entry.js +1 -2
- package/dist/esm-es5/pds-toast.entry.js +1 -0
- package/dist/esm-es5/pds-tooltip.entry.js +1 -2
- package/dist/esm-es5/pine-core.js +1 -2
- package/dist/esm-es5/portal-target-CKRzRKdO.js +1 -0
- package/dist/esm-es5/reconnected-content-RFpTWV6r.js +1 -0
- package/dist/esm-es5/reflected-attribute-default-t3idJwV0.js +1 -0
- package/dist/esm-es5/scroll-DtgUQhjl.js +1 -0
- package/dist/esm-es5/sortable-label-PItnzVVR.js +1 -0
- package/dist/esm-es5/tabbable-C6ZWpp3v.js +1 -0
- package/dist/esm-es5/truncation-tooltip-CkIWm6Z-.js +1 -0
- package/dist/esm-es5/utils-OYK5-nwe.js +1 -0
- package/dist/pine-core/index.esm.js +1 -2
- package/dist/pine-core/p-053ff8eb.system.entry.js +1 -0
- package/dist/pine-core/p-08b9e3ad.entry.js +1 -0
- package/dist/pine-core/p-0ac4262e.system.entry.js +1 -0
- package/dist/pine-core/p-0e1b8bd1.system.entry.js +1 -0
- package/dist/pine-core/p-12fdc65f.entry.js +1 -0
- package/dist/pine-core/p-1765a41b.system.entry.js +1 -0
- package/dist/pine-core/p-18524c25.entry.js +1 -0
- package/dist/pine-core/p-191eb9e5.system.entry.js +1 -0
- package/dist/pine-core/p-1c584a20.entry.js +1 -0
- package/dist/pine-core/p-1d4ecc35.entry.js +7 -0
- package/dist/pine-core/p-1e0c9738.system.entry.js +1 -0
- package/dist/pine-core/p-1fb1ca3d.entry.js +1 -0
- package/dist/pine-core/p-2482e4ab.system.entry.js +1 -0
- package/dist/pine-core/p-2cc7c682.entry.js +1 -0
- package/dist/pine-core/p-2f15e85f.entry.js +1 -0
- package/dist/pine-core/p-3306dc5a.system.entry.js +1 -0
- package/dist/pine-core/p-3338fc2e.entry.js +1 -0
- package/dist/pine-core/p-33da254f.system.entry.js +1 -0
- package/dist/pine-core/p-34d22a45.system.entry.js +1 -0
- package/dist/pine-core/p-35b90796.entry.js +1 -0
- package/dist/pine-core/p-38148f5b.entry.js +1 -0
- package/dist/pine-core/p-39264dfb.system.entry.js +1 -0
- package/dist/pine-core/p-3aed0418.system.entry.js +1 -0
- package/dist/pine-core/p-3dd879fd.entry.js +1 -0
- package/dist/pine-core/p-3f1c05cd.system.entry.js +1 -0
- package/dist/pine-core/p-3fc9ef80.system.entry.js +1 -0
- package/dist/pine-core/p-4125a4a6.system.entry.js +1 -0
- package/dist/pine-core/p-42376f2c.entry.js +1 -0
- package/dist/pine-core/p-4263038f.entry.js +1 -0
- package/dist/pine-core/p-47df9e9f.system.entry.js +3 -0
- package/dist/pine-core/p-55a4659a.system.entry.js +1 -0
- package/dist/pine-core/p-563baadd.system.entry.js +1 -0
- package/dist/pine-core/p-57af5c29.system.entry.js +1 -0
- package/dist/pine-core/p-587bd9ed.entry.js +1 -0
- package/dist/pine-core/p-5c7dfa7a.entry.js +1 -0
- package/dist/pine-core/p-5db87fda.system.entry.js +1 -0
- package/dist/pine-core/p-5eb0c78c.system.entry.js +1 -0
- package/dist/pine-core/p-6017afb5.system.entry.js +1 -0
- package/dist/pine-core/p-63d47dd4.system.entry.js +1 -0
- package/dist/pine-core/p-66e61921.system.entry.js +1 -0
- package/dist/pine-core/p-67999353.entry.js +1 -0
- package/dist/pine-core/p-68328afc.entry.js +1 -0
- package/dist/pine-core/p-6a965119.entry.js +1 -0
- package/dist/pine-core/p-6fdc6df9.system.entry.js +1 -0
- package/dist/pine-core/p-72668673.system.entry.js +1 -0
- package/dist/pine-core/p-765f4207.entry.js +1 -0
- package/dist/pine-core/p-77530cf2.entry.js +1 -0
- package/dist/pine-core/p-77a22399.entry.js +1 -0
- package/dist/pine-core/p-783127bf.entry.js +1 -0
- package/dist/pine-core/p-7a51f15e.entry.js +1 -0
- package/dist/pine-core/p-7b978fff.system.entry.js +1 -0
- package/dist/pine-core/p-82f7eed1.entry.js +1 -0
- package/dist/pine-core/p-863ff553.system.entry.js +1 -0
- package/dist/pine-core/p-87a32ded.system.entry.js +1 -0
- package/dist/pine-core/p-87cadd6f.system.entry.js +8 -0
- package/dist/pine-core/p-8db554fe.entry.js +1 -0
- package/dist/pine-core/p-8e7e7bba.entry.js +1 -0
- package/dist/pine-core/p-907c69e9.system.entry.js +1 -0
- package/dist/pine-core/p-90f83a5b.system.entry.js +1 -0
- package/dist/pine-core/p-931a0ccd.system.entry.js +1 -0
- package/dist/pine-core/p-94fd9595.entry.js +1 -0
- package/dist/pine-core/p-96bccf85.system.entry.js +1 -0
- package/dist/pine-core/p-9a63bf72.entry.js +1 -0
- package/dist/pine-core/p-9d983e09.system.entry.js +1 -0
- package/dist/pine-core/p-9da10cfb.system.entry.js +1 -0
- package/dist/pine-core/p-9e005996.entry.js +1 -0
- package/dist/pine-core/p-B0DXTeeV.js +1 -0
- package/dist/pine-core/p-BJgZHCWe.js +1 -0
- package/dist/pine-core/p-BK1sLRfg.system.js +2 -0
- package/dist/pine-core/p-BNTlHhoO.system.js +1 -0
- package/dist/pine-core/p-BSRFZB4I.system.js +1 -0
- package/dist/pine-core/p-BZ1l3LGl.system.js +1 -0
- package/dist/pine-core/p-BZsj6eAn.system.js +1 -0
- package/dist/pine-core/p-BbXp4qBM.system.js +1 -0
- package/dist/pine-core/p-BgNaWLoS.js +1 -0
- package/dist/pine-core/p-Bkho_oFB.system.js +1 -0
- package/dist/pine-core/p-BlJQebvG.system.js +1 -0
- package/dist/pine-core/p-BuRbS7Hp.js +1 -0
- package/dist/pine-core/p-BxIzb-Wc.system.js +1 -0
- package/dist/pine-core/p-C35-349-.system.js +1 -0
- package/dist/pine-core/p-C6ZWpp3v.js +1 -0
- package/dist/pine-core/p-CANeE7Ss.system.js +1 -0
- package/dist/pine-core/p-CIe1DGXa.system.js +1 -0
- package/dist/pine-core/p-CKRzRKdO.js +1 -0
- package/dist/pine-core/p-CNn1lObg.js +1 -0
- package/dist/pine-core/p-CQJ44c6o.system.js +1 -0
- package/dist/pine-core/p-Cuc0DYlm.js +1 -0
- package/dist/pine-core/p-DHPzKMVS.js +1 -0
- package/dist/pine-core/p-DVra397g.system.js +1 -0
- package/dist/pine-core/p-DtgUQhjl.js +1 -0
- package/dist/pine-core/p-Dv9QBmIF.js +1 -0
- package/dist/pine-core/p-Dx8tEj0U.system.js +1 -0
- package/dist/pine-core/p-M31tvpDN.js +2 -0
- package/dist/pine-core/p-OYK5-nwe.js +1 -0
- package/dist/pine-core/p-PItnzVVR.js +1 -0
- package/dist/pine-core/p-RFpTWV6r.js +1 -0
- package/dist/pine-core/p-VPGVqK3P.system.js +1 -0
- package/dist/pine-core/p-XK45dzWR.system.js +1 -0
- package/dist/pine-core/p-a0fa77b1.system.entry.js +1 -0
- package/dist/pine-core/p-a149af29.entry.js +1 -0
- package/dist/pine-core/p-a1575919.entry.js +1 -0
- package/dist/pine-core/p-a20d9eca.system.entry.js +1 -0
- package/dist/pine-core/p-a5782d99.entry.js +1 -0
- package/dist/pine-core/p-a9eaf160.system.entry.js +1 -0
- package/dist/pine-core/p-aae96744.entry.js +1 -0
- package/dist/pine-core/p-b379d9bc.system.entry.js +1 -0
- package/dist/pine-core/p-b96bdff6.entry.js +1 -0
- package/dist/pine-core/p-badde164.entry.js +1 -0
- package/dist/pine-core/p-bbd9ab75.entry.js +1 -0
- package/dist/pine-core/p-biShcgLI.js +1 -0
- package/dist/pine-core/p-c12b5cd7.system.entry.js +1 -0
- package/dist/pine-core/p-c2afe4f3.system.entry.js +1 -0
- package/dist/pine-core/p-c65f4eaa.system.entry.js +1 -0
- package/dist/pine-core/p-c6c5ada6.system.entry.js +1 -0
- package/dist/pine-core/p-c76d8b9e.system.entry.js +1 -0
- package/dist/pine-core/p-c89ea2d3.entry.js +1 -0
- package/dist/pine-core/p-ce9fa14b.entry.js +1 -0
- package/dist/pine-core/p-d4b0122f.system.entry.js +1 -0
- package/dist/pine-core/p-d61a0fe8.system.entry.js +1 -0
- package/dist/pine-core/p-d7d7a4e1.entry.js +1 -0
- package/dist/pine-core/p-d85d50cb.entry.js +1 -0
- package/dist/pine-core/p-daa802f1.entry.js +2 -0
- package/dist/pine-core/p-de3f4a28.system.entry.js +1 -0
- package/dist/pine-core/p-e00777da.system.entry.js +1 -0
- package/dist/pine-core/p-e2a1a49a.system.entry.js +1 -0
- package/dist/pine-core/p-e334af06.entry.js +1 -0
- package/dist/pine-core/p-e4216ff6.entry.js +1 -0
- package/dist/pine-core/p-e68044b3.entry.js +1 -0
- package/dist/pine-core/p-e75d8bc1.entry.js +1 -0
- package/dist/pine-core/p-e871cfce.entry.js +1 -0
- package/dist/pine-core/p-e92d0f0f.system.entry.js +1 -0
- package/dist/pine-core/p-eab165b9.system.entry.js +1 -0
- package/dist/pine-core/p-eabc4bd8.entry.js +1 -0
- package/dist/pine-core/p-eeYeEogd.system.js +1 -0
- package/dist/pine-core/p-eee042d3.entry.js +1 -0
- package/dist/pine-core/p-ef9f84f2.system.entry.js +1 -0
- package/dist/pine-core/p-f026af73.entry.js +1 -0
- package/dist/pine-core/p-f0509c8e.entry.js +1 -0
- package/dist/pine-core/p-f1252e72.system.entry.js +1 -0
- package/dist/pine-core/p-f3496fd1.entry.js +1 -0
- package/dist/pine-core/p-f65127f1.entry.js +1 -0
- package/dist/pine-core/p-f90f4be7.system.entry.js +1 -0
- package/dist/pine-core/p-f99bd77f.entry.js +1 -0
- package/dist/pine-core/p-fda791df.entry.js +1 -0
- package/dist/pine-core/p-t3idJwV0.js +1 -0
- package/dist/pine-core/p-wB2y8gR7.system.js +1 -0
- package/dist/pine-core/pine-core.css +1 -1
- package/dist/pine-core/pine-core.esm.js +1 -2
- package/dist/pine-core/pine-core.js +1 -1
- package/dist/scripts/vscode-custom-data-generator.js +406 -0
- package/dist/scripts/vscode-settings-patcher.cjs +89 -0
- package/dist/types/components/pds-accordion/pds-accordion.d.ts +9 -1
- package/dist/types/components/pds-alert/pds-alert.d.ts +62 -0
- package/dist/types/components/pds-avatar/pds-avatar.d.ts +53 -3
- package/dist/types/components/pds-box/pds-box.d.ts +495 -16
- package/dist/types/components/pds-button/pds-button.d.ts +91 -13
- package/dist/types/components/pds-checkbox/pds-checkbox.d.ts +43 -9
- package/dist/types/components/pds-chip/pds-chip.d.ts +77 -14
- package/dist/types/components/pds-combobox/combobox-interface.d.ts +73 -0
- package/dist/types/components/pds-combobox/grouped-options-panel.d.ts +128 -0
- package/dist/types/components/pds-combobox/pds-combobox.d.ts +714 -0
- package/dist/types/components/pds-container/pds-container.d.ts +22 -0
- package/dist/types/components/pds-copytext/pds-copytext.d.ts +20 -5
- package/dist/types/components/pds-datepicker/calendar-portal.d.ts +36 -0
- package/dist/types/components/pds-datepicker/date-utils.d.ts +67 -0
- package/dist/types/components/pds-datepicker/datepicker-interface.d.ts +47 -0
- package/dist/types/components/pds-datepicker/pds-datepicker.d.ts +515 -0
- package/dist/types/components/pds-datepicker/presets.d.ts +24 -0
- package/dist/types/components/pds-datepicker/value.d.ts +59 -0
- package/dist/types/components/pds-divider/pds-divider.d.ts +10 -2
- package/dist/types/components/pds-drawer/pds-drawer-content/pds-drawer-content.d.ts +9 -0
- package/dist/types/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.d.ts +9 -0
- package/dist/types/components/pds-drawer/pds-drawer-header/pds-drawer-header.d.ts +9 -0
- package/dist/types/components/pds-drawer/pds-drawer.d.ts +89 -0
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.d.ts +87 -0
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.d.ts +13 -0
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu.d.ts +60 -0
- package/dist/types/components/pds-filters/pds-filter/filter-interface.d.ts +19 -0
- package/dist/types/components/pds-filters/pds-filter/pds-filter.d.ts +135 -0
- package/dist/types/components/pds-filters/pds-filters.d.ts +11 -0
- package/dist/types/components/pds-image/image-interface.d.ts +12 -0
- package/dist/types/components/pds-image/pds-image.d.ts +75 -11
- package/dist/types/components/pds-input/input-interface.d.ts +12 -0
- package/dist/types/components/pds-input/pds-input.d.ts +174 -9
- package/dist/types/components/pds-link/pds-link.d.ts +81 -11
- package/dist/types/components/pds-loader/pds-loader.d.ts +10 -3
- package/dist/types/components/pds-modal/pds-modal-content/pds-modal-content.d.ts +43 -0
- package/dist/types/components/pds-modal/pds-modal-footer/pds-modal-footer.d.ts +9 -0
- package/dist/types/components/pds-modal/pds-modal-header/pds-modal-header.d.ts +9 -0
- package/dist/types/components/pds-modal/pds-modal.d.ts +152 -0
- package/dist/types/components/pds-modal/test/mock-pds-modal.d.ts +68 -0
- package/dist/types/components/pds-multiselect/multiselect-interface.d.ts +61 -0
- package/dist/types/components/pds-multiselect/pds-multiselect.d.ts +402 -0
- package/dist/types/components/pds-popover/pds-popover.d.ts +292 -0
- package/dist/types/components/pds-popover/popover-interface.d.ts +4 -0
- package/dist/types/components/pds-progress/pds-progress.d.ts +6 -2
- package/dist/types/components/pds-property/pds-property.d.ts +14 -0
- package/dist/types/components/pds-radio/pds-radio.d.ts +42 -11
- package/dist/types/components/pds-radio-group/pds-radio-group.d.ts +84 -0
- package/dist/types/components/pds-radio-group/radio-group-interface.d.ts +5 -0
- package/dist/types/components/pds-row/pds-row.d.ts +17 -2
- package/dist/types/components/pds-select/pds-select.d.ts +182 -0
- package/dist/types/components/pds-sortable/pds-sortable-item/pds-sortable-item.d.ts +14 -3
- package/dist/types/components/pds-sortable/pds-sortable.d.ts +99 -4
- package/dist/types/components/pds-sortable/sortable-interface.d.ts +3 -1
- package/dist/types/components/pds-sortable/sortable-label.d.ts +7 -0
- package/dist/types/components/pds-switch/pds-switch.d.ts +51 -17
- package/dist/types/components/pds-table/pds-table-body/pds-table-body.d.ts +3 -0
- package/dist/types/components/pds-table/pds-table-cell/pds-table-cell.d.ts +40 -1
- package/dist/types/components/pds-table/pds-table-head/pds-table-head.d.ts +19 -2
- package/dist/types/components/pds-table/pds-table-head-cell/pds-table-head-cell.d.ts +73 -2
- package/dist/types/components/pds-table/pds-table-row/pds-table-row.d.ts +27 -4
- package/dist/types/components/pds-table/pds-table.d.ts +138 -12
- package/dist/types/components/pds-tabs/pds-tab/pds-tab.d.ts +55 -0
- package/dist/types/components/pds-tabs/pds-tabpanel/pds-tabpanel.d.ts +12 -0
- package/dist/types/components/pds-tabs/pds-tabs.d.ts +45 -5
- package/dist/types/components/pds-text/pds-text.d.ts +61 -0
- package/dist/types/components/pds-textarea/pds-textarea.d.ts +140 -15
- package/dist/types/components/pds-textarea/textarea-interface.d.ts +5 -1
- package/dist/types/components/pds-toast/pds-toast.d.ts +83 -0
- package/dist/types/components/pds-tooltip/pds-tooltip.d.ts +80 -20
- package/dist/types/components.d.ts +7070 -1247
- package/dist/types/global/pine-global.d.ts +2 -0
- package/dist/types/home/runner/work/pine/pine/libs/core/.stencil/scripts/vscode-custom-data-generator.d.ts +6 -0
- package/dist/types/i18n/i18n-format.d.ts +38 -0
- package/dist/types/i18n/index.d.ts +2 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +195 -8
- package/dist/types/utils/aria-references.d.ts +28 -0
- package/dist/types/utils/attributes.d.ts +44 -0
- package/dist/types/utils/closest.d.ts +2 -0
- package/dist/types/utils/css.d.ts +7 -0
- package/dist/types/utils/form.d.ts +23 -1
- package/dist/types/utils/interfaces.d.ts +6 -0
- package/dist/types/utils/keep-hydrated.d.ts +56 -0
- package/dist/types/utils/overlay.d.ts +3 -3
- package/dist/types/utils/portal-target.d.ts +17 -0
- package/dist/types/utils/reconnected-content.d.ts +14 -0
- package/dist/types/utils/reflected-attribute-default.d.ts +31 -0
- package/dist/types/utils/scroll.d.ts +21 -0
- package/dist/types/utils/tabbable.d.ts +2 -0
- package/dist/types/utils/test/axe.d.ts +81 -0
- package/dist/types/utils/test/host-strip.d.ts +10 -0
- package/dist/types/utils/test/reconnect-safety.d.ts +11 -0
- package/dist/types/utils/test/reduced-motion.d.ts +30 -0
- package/dist/types/utils/truncation-tooltip.d.ts +88 -0
- package/dist/types/utils/types.d.ts +13 -2
- package/dist/types/utils/utils.d.ts +37 -2
- package/dist/vscode.html-data.json +11913 -0
- package/hydrate/index.d.ts +58 -7
- package/hydrate/index.js +29932 -3726
- package/hydrate/index.mjs +29929 -3725
- package/package.json +52 -26
- package/readme.md +26 -55
- package/components/closest.js.map +0 -1
- package/components/index.js.map +0 -1
- package/components/index2.js.map +0 -1
- package/components/pds-accordion.js.map +0 -1
- package/components/pds-avatar.js.map +0 -1
- package/components/pds-box.js.map +0 -1
- package/components/pds-button.js.map +0 -1
- package/components/pds-button2.js.map +0 -1
- package/components/pds-checkbox.js.map +0 -1
- package/components/pds-checkbox2.js.map +0 -1
- package/components/pds-chip.js.map +0 -1
- package/components/pds-copytext.js.map +0 -1
- package/components/pds-divider.js.map +0 -1
- package/components/pds-icon.js.map +0 -1
- package/components/pds-icon2.js.map +0 -1
- package/components/pds-image.js.map +0 -1
- package/components/pds-input.js.map +0 -1
- package/components/pds-label.js +0 -39
- package/components/pds-label.js.map +0 -1
- package/components/pds-link.js.map +0 -1
- package/components/pds-loader.js.map +0 -1
- package/components/pds-progress.js.map +0 -1
- package/components/pds-radio.js.map +0 -1
- package/components/pds-row.js.map +0 -1
- package/components/pds-sortable-item.js.map +0 -1
- package/components/pds-sortable.js.map +0 -1
- package/components/pds-switch.js.map +0 -1
- package/components/pds-tab.js.map +0 -1
- package/components/pds-table-body.js.map +0 -1
- package/components/pds-table-cell.js.map +0 -1
- package/components/pds-table-cell2.js.map +0 -1
- package/components/pds-table-head-cell.js.map +0 -1
- package/components/pds-table-head-cell2.js.map +0 -1
- package/components/pds-table-head.js.map +0 -1
- package/components/pds-table-row.js.map +0 -1
- package/components/pds-table.js.map +0 -1
- package/components/pds-tabpanel.js.map +0 -1
- package/components/pds-tabs.js.map +0 -1
- package/components/pds-textarea.js.map +0 -1
- package/components/pds-tooltip.js.map +0 -1
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/closest-b45138d3.js +0 -13
- package/dist/cjs/closest-b45138d3.js.map +0 -1
- package/dist/cjs/index-46fb0736.js +0 -1956
- package/dist/cjs/index-46fb0736.js.map +0 -1
- package/dist/cjs/index-de3f0730.js +0 -24
- package/dist/cjs/index-de3f0730.js.map +0 -1
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/cjs/loader.cjs.js.map +0 -1
- package/dist/cjs/pds-accordion.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-avatar.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-box.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-button.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-checkbox.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-chip.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-copytext.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-divider.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-icon.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-image.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-input.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-label-7aabdc4e.js +0 -44
- package/dist/cjs/pds-label-7aabdc4e.js.map +0 -1
- package/dist/cjs/pds-link.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-loader.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-progress.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-radio.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-row.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-sortable-item.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-sortable.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-switch.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-tab.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-table-body.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-table-cell.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-table-head-cell.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-table-head.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-table-row.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-table.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-tabpanel.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-tabs.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-textarea.cjs.entry.js.map +0 -1
- package/dist/cjs/pds-tooltip.cjs.entry.js.map +0 -1
- package/dist/cjs/pine-core.cjs.js.map +0 -1
- package/dist/collection/components/_internal/pds-label/pds-label.js.map +0 -1
- package/dist/collection/components/pds-accordion/pds-accordion.js.map +0 -1
- package/dist/collection/components/pds-avatar/pds-avatar.js.map +0 -1
- package/dist/collection/components/pds-box/pds-box.js.map +0 -1
- package/dist/collection/components/pds-button/pds-button.js.map +0 -1
- package/dist/collection/components/pds-checkbox/checkbox-interface.js.map +0 -1
- package/dist/collection/components/pds-checkbox/pds-checkbox.js.map +0 -1
- package/dist/collection/components/pds-chip/pds-chip.js.map +0 -1
- package/dist/collection/components/pds-copytext/pds-copytext.js.map +0 -1
- package/dist/collection/components/pds-divider/pds-divider.js.map +0 -1
- package/dist/collection/components/pds-image/pds-image.js.map +0 -1
- package/dist/collection/components/pds-input/pds-input.js.map +0 -1
- package/dist/collection/components/pds-link/pds-link.js.map +0 -1
- package/dist/collection/components/pds-loader/pds-loader.js.map +0 -1
- package/dist/collection/components/pds-progress/pds-progress.js.map +0 -1
- package/dist/collection/components/pds-radio/pds-radio.js.map +0 -1
- package/dist/collection/components/pds-row/pds-row.js.map +0 -1
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js.map +0 -1
- package/dist/collection/components/pds-sortable/pds-sortable.js.map +0 -1
- package/dist/collection/components/pds-sortable/sortable-interface.js.map +0 -1
- package/dist/collection/components/pds-switch/pds-switch.js.map +0 -1
- package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js.map +0 -1
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.js.map +0 -1
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js.map +0 -1
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js.map +0 -1
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js.map +0 -1
- package/dist/collection/components/pds-table/pds-table.js.map +0 -1
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.js.map +0 -1
- package/dist/collection/components/pds-tabs/pds-tabpanel/pds-tabpanel.js.map +0 -1
- package/dist/collection/components/pds-tabs/pds-tabs.js.map +0 -1
- package/dist/collection/components/pds-textarea/pds-textarea.js.map +0 -1
- package/dist/collection/components/pds-textarea/textarea-interface.js.map +0 -1
- package/dist/collection/components/pds-tooltip/pds-tooltip.js.map +0 -1
- package/dist/collection/global/pine-ui-global.js.map +0 -1
- package/dist/collection/index.js.map +0 -1
- package/dist/collection/stories/_helpers/index.js +0 -15
- package/dist/collection/stories/_helpers/index.js.map +0 -1
- package/dist/collection/utils/closest.js.map +0 -1
- package/dist/collection/utils/form.js.map +0 -1
- package/dist/collection/utils/overlay.js.map +0 -1
- package/dist/collection/utils/types.js.map +0 -1
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/closest-d2d192be.js +0 -11
- package/dist/esm/closest-d2d192be.js.map +0 -1
- package/dist/esm/index-2a33b470.js +0 -1927
- package/dist/esm/index-2a33b470.js.map +0 -1
- package/dist/esm/index-a1e2f9af.js +0 -14
- package/dist/esm/index-a1e2f9af.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/loader.js.map +0 -1
- package/dist/esm/pds-accordion.entry.js.map +0 -1
- package/dist/esm/pds-avatar.entry.js.map +0 -1
- package/dist/esm/pds-box.entry.js.map +0 -1
- package/dist/esm/pds-button.entry.js.map +0 -1
- package/dist/esm/pds-checkbox.entry.js.map +0 -1
- package/dist/esm/pds-chip.entry.js.map +0 -1
- package/dist/esm/pds-copytext.entry.js.map +0 -1
- package/dist/esm/pds-divider.entry.js.map +0 -1
- package/dist/esm/pds-icon.entry.js.map +0 -1
- package/dist/esm/pds-image.entry.js.map +0 -1
- package/dist/esm/pds-input.entry.js.map +0 -1
- package/dist/esm/pds-label-31a5848b.js +0 -39
- package/dist/esm/pds-label-31a5848b.js.map +0 -1
- package/dist/esm/pds-link.entry.js.map +0 -1
- package/dist/esm/pds-loader.entry.js.map +0 -1
- package/dist/esm/pds-progress.entry.js.map +0 -1
- package/dist/esm/pds-radio.entry.js.map +0 -1
- package/dist/esm/pds-row.entry.js.map +0 -1
- package/dist/esm/pds-sortable-item.entry.js.map +0 -1
- package/dist/esm/pds-sortable.entry.js.map +0 -1
- package/dist/esm/pds-switch.entry.js.map +0 -1
- package/dist/esm/pds-tab.entry.js.map +0 -1
- package/dist/esm/pds-table-body.entry.js.map +0 -1
- package/dist/esm/pds-table-cell.entry.js.map +0 -1
- package/dist/esm/pds-table-head-cell.entry.js.map +0 -1
- package/dist/esm/pds-table-head.entry.js.map +0 -1
- package/dist/esm/pds-table-row.entry.js.map +0 -1
- package/dist/esm/pds-table.entry.js.map +0 -1
- package/dist/esm/pds-tabpanel.entry.js.map +0 -1
- package/dist/esm/pds-tabs.entry.js.map +0 -1
- package/dist/esm/pds-textarea.entry.js.map +0 -1
- package/dist/esm/pds-tooltip.entry.js.map +0 -1
- package/dist/esm/pine-core.js.map +0 -1
- package/dist/esm-es5/app-globals-0f993ce5.js +0 -2
- package/dist/esm-es5/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm-es5/closest-d2d192be.js +0 -2
- package/dist/esm-es5/closest-d2d192be.js.map +0 -1
- package/dist/esm-es5/index-2a33b470.js +0 -3
- package/dist/esm-es5/index-2a33b470.js.map +0 -1
- package/dist/esm-es5/index-a1e2f9af.js +0 -2
- package/dist/esm-es5/index-a1e2f9af.js.map +0 -1
- package/dist/esm-es5/index.js.map +0 -1
- package/dist/esm-es5/loader.js.map +0 -1
- package/dist/esm-es5/pds-accordion.entry.js.map +0 -1
- package/dist/esm-es5/pds-avatar.entry.js.map +0 -1
- package/dist/esm-es5/pds-box.entry.js.map +0 -1
- package/dist/esm-es5/pds-button.entry.js.map +0 -1
- package/dist/esm-es5/pds-checkbox.entry.js.map +0 -1
- package/dist/esm-es5/pds-chip.entry.js.map +0 -1
- package/dist/esm-es5/pds-copytext.entry.js.map +0 -1
- package/dist/esm-es5/pds-divider.entry.js.map +0 -1
- package/dist/esm-es5/pds-icon.entry.js.map +0 -1
- package/dist/esm-es5/pds-image.entry.js.map +0 -1
- package/dist/esm-es5/pds-input.entry.js.map +0 -1
- package/dist/esm-es5/pds-label-31a5848b.js +0 -2
- package/dist/esm-es5/pds-label-31a5848b.js.map +0 -1
- package/dist/esm-es5/pds-link.entry.js.map +0 -1
- package/dist/esm-es5/pds-loader.entry.js.map +0 -1
- package/dist/esm-es5/pds-progress.entry.js.map +0 -1
- package/dist/esm-es5/pds-radio.entry.js.map +0 -1
- package/dist/esm-es5/pds-row.entry.js.map +0 -1
- package/dist/esm-es5/pds-sortable-item.entry.js.map +0 -1
- package/dist/esm-es5/pds-sortable.entry.js.map +0 -1
- package/dist/esm-es5/pds-switch.entry.js.map +0 -1
- package/dist/esm-es5/pds-tab.entry.js.map +0 -1
- package/dist/esm-es5/pds-table-body.entry.js.map +0 -1
- package/dist/esm-es5/pds-table-cell.entry.js.map +0 -1
- package/dist/esm-es5/pds-table-head-cell.entry.js.map +0 -1
- package/dist/esm-es5/pds-table-head.entry.js.map +0 -1
- package/dist/esm-es5/pds-table-row.entry.js.map +0 -1
- package/dist/esm-es5/pds-table.entry.js.map +0 -1
- package/dist/esm-es5/pds-tabpanel.entry.js.map +0 -1
- package/dist/esm-es5/pds-tabs.entry.js.map +0 -1
- package/dist/esm-es5/pds-textarea.entry.js.map +0 -1
- package/dist/esm-es5/pds-tooltip.entry.js.map +0 -1
- package/dist/esm-es5/pine-core.js.map +0 -1
- package/dist/pine-core/index.esm.js.map +0 -1
- package/dist/pine-core/p-06c33261.system.entry.js +0 -2
- package/dist/pine-core/p-06c33261.system.entry.js.map +0 -1
- package/dist/pine-core/p-07f80cb6.entry.js +0 -2
- package/dist/pine-core/p-07f80cb6.entry.js.map +0 -1
- package/dist/pine-core/p-09b1c7f1.system.entry.js +0 -2
- package/dist/pine-core/p-09b1c7f1.system.entry.js.map +0 -1
- package/dist/pine-core/p-0a4b1ce9.system.entry.js +0 -2
- package/dist/pine-core/p-0a4b1ce9.system.entry.js.map +0 -1
- package/dist/pine-core/p-0b541f88.js +0 -3
- package/dist/pine-core/p-0b541f88.js.map +0 -1
- package/dist/pine-core/p-0b77685e.js +0 -2
- package/dist/pine-core/p-0b77685e.js.map +0 -1
- package/dist/pine-core/p-0d6fafef.system.entry.js +0 -2
- package/dist/pine-core/p-0d6fafef.system.entry.js.map +0 -1
- package/dist/pine-core/p-0e1c0d03.entry.js +0 -8
- package/dist/pine-core/p-0e1c0d03.entry.js.map +0 -1
- package/dist/pine-core/p-0e936138.entry.js +0 -2
- package/dist/pine-core/p-0e936138.entry.js.map +0 -1
- package/dist/pine-core/p-143795e5.system.entry.js +0 -2
- package/dist/pine-core/p-143795e5.system.entry.js.map +0 -1
- package/dist/pine-core/p-1f2b0be3.system.entry.js +0 -2
- package/dist/pine-core/p-1f2b0be3.system.entry.js.map +0 -1
- package/dist/pine-core/p-224a435b.system.js +0 -2
- package/dist/pine-core/p-224a435b.system.js.map +0 -1
- package/dist/pine-core/p-31056348.system.entry.js +0 -2
- package/dist/pine-core/p-31056348.system.entry.js.map +0 -1
- package/dist/pine-core/p-32498622.system.entry.js +0 -2
- package/dist/pine-core/p-32498622.system.entry.js.map +0 -1
- package/dist/pine-core/p-3261fdf5.system.entry.js +0 -2
- package/dist/pine-core/p-3261fdf5.system.entry.js.map +0 -1
- package/dist/pine-core/p-32e41e3d.system.entry.js +0 -2
- package/dist/pine-core/p-32e41e3d.system.entry.js.map +0 -1
- package/dist/pine-core/p-34631565.system.js +0 -2
- package/dist/pine-core/p-34631565.system.js.map +0 -1
- package/dist/pine-core/p-3ba3d44c.entry.js +0 -2
- package/dist/pine-core/p-3ba3d44c.entry.js.map +0 -1
- package/dist/pine-core/p-46161cec.entry.js +0 -2
- package/dist/pine-core/p-46161cec.entry.js.map +0 -1
- package/dist/pine-core/p-4f69a7b7.entry.js +0 -2
- package/dist/pine-core/p-4f69a7b7.entry.js.map +0 -1
- package/dist/pine-core/p-50a23474.entry.js +0 -2
- package/dist/pine-core/p-50a23474.entry.js.map +0 -1
- package/dist/pine-core/p-511bf308.entry.js +0 -2
- package/dist/pine-core/p-511bf308.entry.js.map +0 -1
- package/dist/pine-core/p-52515d64.system.entry.js +0 -2
- package/dist/pine-core/p-52515d64.system.entry.js.map +0 -1
- package/dist/pine-core/p-56ba5cbf.system.js +0 -2
- package/dist/pine-core/p-56ba5cbf.system.js.map +0 -1
- package/dist/pine-core/p-5a384517.entry.js +0 -2
- package/dist/pine-core/p-5a384517.entry.js.map +0 -1
- package/dist/pine-core/p-5bee6677.system.entry.js +0 -2
- package/dist/pine-core/p-5bee6677.system.entry.js.map +0 -1
- package/dist/pine-core/p-5df76e04.system.js +0 -2
- package/dist/pine-core/p-5df76e04.system.js.map +0 -1
- package/dist/pine-core/p-62ec9a0f.system.entry.js +0 -2
- package/dist/pine-core/p-62ec9a0f.system.entry.js.map +0 -1
- package/dist/pine-core/p-6a7a864f.entry.js +0 -2
- package/dist/pine-core/p-6a7a864f.entry.js.map +0 -1
- package/dist/pine-core/p-6ae2f0f5.entry.js +0 -2
- package/dist/pine-core/p-6ae2f0f5.entry.js.map +0 -1
- package/dist/pine-core/p-6e146962.entry.js +0 -2
- package/dist/pine-core/p-6e146962.entry.js.map +0 -1
- package/dist/pine-core/p-6ff9ebfa.entry.js +0 -2
- package/dist/pine-core/p-6ff9ebfa.entry.js.map +0 -1
- package/dist/pine-core/p-701ba882.entry.js +0 -2
- package/dist/pine-core/p-701ba882.entry.js.map +0 -1
- package/dist/pine-core/p-73eb1722.entry.js +0 -2
- package/dist/pine-core/p-73eb1722.entry.js.map +0 -1
- package/dist/pine-core/p-78c6c37a.system.entry.js +0 -2
- package/dist/pine-core/p-78c6c37a.system.entry.js.map +0 -1
- package/dist/pine-core/p-79ca4ab9.system.entry.js +0 -2
- package/dist/pine-core/p-79ca4ab9.system.entry.js.map +0 -1
- package/dist/pine-core/p-7c33a02e.entry.js +0 -2
- package/dist/pine-core/p-7c33a02e.entry.js.map +0 -1
- package/dist/pine-core/p-7dac515e.system.entry.js +0 -2
- package/dist/pine-core/p-7dac515e.system.entry.js.map +0 -1
- package/dist/pine-core/p-7ea6838b.system.entry.js +0 -2
- package/dist/pine-core/p-7ea6838b.system.entry.js.map +0 -1
- package/dist/pine-core/p-7ebfdef4.system.entry.js +0 -2
- package/dist/pine-core/p-7ebfdef4.system.entry.js.map +0 -1
- package/dist/pine-core/p-829777e4.system.entry.js +0 -2
- package/dist/pine-core/p-829777e4.system.entry.js.map +0 -1
- package/dist/pine-core/p-8317c6c2.js +0 -2
- package/dist/pine-core/p-8317c6c2.js.map +0 -1
- package/dist/pine-core/p-8469b65a.entry.js +0 -2
- package/dist/pine-core/p-8469b65a.entry.js.map +0 -1
- package/dist/pine-core/p-8d8de5fd.entry.js +0 -2
- package/dist/pine-core/p-8d8de5fd.entry.js.map +0 -1
- package/dist/pine-core/p-8df8debd.entry.js +0 -2
- package/dist/pine-core/p-8df8debd.entry.js.map +0 -1
- package/dist/pine-core/p-8f73bf14.system.entry.js +0 -2
- package/dist/pine-core/p-8f73bf14.system.entry.js.map +0 -1
- package/dist/pine-core/p-8fbec4fe.system.js +0 -2
- package/dist/pine-core/p-8fbec4fe.system.js.map +0 -1
- package/dist/pine-core/p-909b305c.system.entry.js +0 -2
- package/dist/pine-core/p-909b305c.system.entry.js.map +0 -1
- package/dist/pine-core/p-936d96ec.system.entry.js +0 -9
- package/dist/pine-core/p-936d96ec.system.entry.js.map +0 -1
- package/dist/pine-core/p-9583e6d5.entry.js +0 -2
- package/dist/pine-core/p-9583e6d5.entry.js.map +0 -1
- package/dist/pine-core/p-96c750d1.entry.js +0 -2
- package/dist/pine-core/p-96c750d1.entry.js.map +0 -1
- package/dist/pine-core/p-a03e587c.entry.js +0 -2
- package/dist/pine-core/p-a03e587c.entry.js.map +0 -1
- package/dist/pine-core/p-a79a8159.entry.js +0 -2
- package/dist/pine-core/p-a79a8159.entry.js.map +0 -1
- package/dist/pine-core/p-a962fe8e.entry.js +0 -2
- package/dist/pine-core/p-a962fe8e.entry.js.map +0 -1
- package/dist/pine-core/p-ac228abf.entry.js +0 -2
- package/dist/pine-core/p-ac228abf.entry.js.map +0 -1
- package/dist/pine-core/p-ad4238c9.system.entry.js +0 -2
- package/dist/pine-core/p-ad4238c9.system.entry.js.map +0 -1
- package/dist/pine-core/p-af7df3c2.system.entry.js +0 -2
- package/dist/pine-core/p-af7df3c2.system.entry.js.map +0 -1
- package/dist/pine-core/p-b18b20f4.system.js +0 -2
- package/dist/pine-core/p-b18b20f4.system.js.map +0 -1
- package/dist/pine-core/p-b4518566.entry.js +0 -2
- package/dist/pine-core/p-b4518566.entry.js.map +0 -1
- package/dist/pine-core/p-b5c7e02a.entry.js +0 -2
- package/dist/pine-core/p-b5c7e02a.entry.js.map +0 -1
- package/dist/pine-core/p-bc20946b.system.entry.js +0 -2
- package/dist/pine-core/p-bc20946b.system.entry.js.map +0 -1
- package/dist/pine-core/p-c52d0465.system.entry.js +0 -2
- package/dist/pine-core/p-c52d0465.system.entry.js.map +0 -1
- package/dist/pine-core/p-c84cc2f8.system.entry.js +0 -2
- package/dist/pine-core/p-c84cc2f8.system.entry.js.map +0 -1
- package/dist/pine-core/p-ca239d59.system.entry.js +0 -2
- package/dist/pine-core/p-ca239d59.system.entry.js.map +0 -1
- package/dist/pine-core/p-cfacf2e0.system.entry.js +0 -2
- package/dist/pine-core/p-cfacf2e0.system.entry.js.map +0 -1
- package/dist/pine-core/p-e1255160.js +0 -2
- package/dist/pine-core/p-e1255160.js.map +0 -1
- package/dist/pine-core/p-e4b3115c.entry.js +0 -2
- package/dist/pine-core/p-e4b3115c.entry.js.map +0 -1
- package/dist/pine-core/p-e60fccc0.js +0 -2
- package/dist/pine-core/p-e60fccc0.js.map +0 -1
- package/dist/pine-core/p-eb56f262.system.entry.js +0 -2
- package/dist/pine-core/p-eb56f262.system.entry.js.map +0 -1
- package/dist/pine-core/p-ec484bf6.entry.js +0 -2
- package/dist/pine-core/p-ec484bf6.entry.js.map +0 -1
- package/dist/pine-core/p-f59d4a46.entry.js +0 -2
- package/dist/pine-core/p-f59d4a46.entry.js.map +0 -1
- package/dist/pine-core/p-f74c489d.system.js +0 -3
- package/dist/pine-core/p-f74c489d.system.js.map +0 -1
- package/dist/pine-core/pine-core.esm.js.map +0 -1
- package/dist/pine-core/svg/access-key.svg +0 -1
- package/dist/pine-core/svg/add-circle.svg +0 -1
- package/dist/pine-core/svg/add-image.svg +0 -1
- package/dist/pine-core/svg/add-small.svg +0 -1
- package/dist/pine-core/svg/add-square.svg +0 -1
- package/dist/pine-core/svg/add.svg +0 -1
- package/dist/pine-core/svg/advanced.svg +0 -1
- package/dist/pine-core/svg/ai-sparkle.svg +0 -1
- package/dist/pine-core/svg/ai-writer-filled.svg +0 -1
- package/dist/pine-core/svg/ai-writer.svg +0 -1
- package/dist/pine-core/svg/align-center.svg +0 -1
- package/dist/pine-core/svg/align-justify.svg +0 -1
- package/dist/pine-core/svg/align-left.svg +0 -1
- package/dist/pine-core/svg/align-right.svg +0 -1
- package/dist/pine-core/svg/app-store.svg +0 -1
- package/dist/pine-core/svg/archive.svg +0 -1
- package/dist/pine-core/svg/arrow-corner.svg +0 -1
- package/dist/pine-core/svg/arrow-down.svg +0 -1
- package/dist/pine-core/svg/arrow-left.svg +0 -1
- package/dist/pine-core/svg/arrow-right.svg +0 -1
- package/dist/pine-core/svg/arrow-up.svg +0 -1
- package/dist/pine-core/svg/assessment.svg +0 -1
- package/dist/pine-core/svg/at-sign.svg +0 -1
- package/dist/pine-core/svg/attach.svg +0 -1
- package/dist/pine-core/svg/automations.svg +0 -1
- package/dist/pine-core/svg/ban.svg +0 -1
- package/dist/pine-core/svg/bank.svg +0 -1
- package/dist/pine-core/svg/bar-chart-10-tone.svg +0 -1
- package/dist/pine-core/svg/bell-01-tone.svg +0 -1
- package/dist/pine-core/svg/bell.svg +0 -1
- package/dist/pine-core/svg/block.svg +0 -1
- package/dist/pine-core/svg/blog-filled.svg +0 -1
- package/dist/pine-core/svg/blog.svg +0 -1
- package/dist/pine-core/svg/bold.svg +0 -1
- package/dist/pine-core/svg/broadcast.svg +0 -1
- package/dist/pine-core/svg/bulb.svg +0 -1
- package/dist/pine-core/svg/button.svg +0 -1
- package/dist/pine-core/svg/calendar-date.svg +0 -1
- package/dist/pine-core/svg/calendar-schedule.svg +0 -1
- package/dist/pine-core/svg/calendar-simple.svg +0 -1
- package/dist/pine-core/svg/card-amex.svg +0 -1
- package/dist/pine-core/svg/card-android.svg +0 -1
- package/dist/pine-core/svg/card-apple.svg +0 -1
- package/dist/pine-core/svg/card-diners-club.svg +0 -1
- package/dist/pine-core/svg/card-discover.svg +0 -1
- package/dist/pine-core/svg/card-generic.svg +0 -1
- package/dist/pine-core/svg/card-gpay.svg +0 -1
- package/dist/pine-core/svg/card-mastercard.svg +0 -1
- package/dist/pine-core/svg/card-paypal.svg +0 -1
- package/dist/pine-core/svg/card-stripe.svg +0 -1
- package/dist/pine-core/svg/card-update.svg +0 -1
- package/dist/pine-core/svg/card-visa.svg +0 -1
- package/dist/pine-core/svg/caret-down.svg +0 -1
- package/dist/pine-core/svg/caret-left.svg +0 -1
- package/dist/pine-core/svg/caret-right.svg +0 -1
- package/dist/pine-core/svg/caret-up.svg +0 -1
- package/dist/pine-core/svg/cart-add.svg +0 -1
- package/dist/pine-core/svg/cart.svg +0 -1
- package/dist/pine-core/svg/certificate.svg +0 -1
- package/dist/pine-core/svg/chart-filled.svg +0 -1
- package/dist/pine-core/svg/chart.svg +0 -1
- package/dist/pine-core/svg/check-circle-filled.svg +0 -1
- package/dist/pine-core/svg/check-circle.svg +0 -1
- package/dist/pine-core/svg/check.svg +0 -1
- package/dist/pine-core/svg/circle-1.svg +0 -1
- package/dist/pine-core/svg/circle-2.svg +0 -1
- package/dist/pine-core/svg/circle-3.svg +0 -1
- package/dist/pine-core/svg/circle-4.svg +0 -1
- package/dist/pine-core/svg/circle-5.svg +0 -1
- package/dist/pine-core/svg/circle-6.svg +0 -1
- package/dist/pine-core/svg/circle-7.svg +0 -1
- package/dist/pine-core/svg/circle-8.svg +0 -1
- package/dist/pine-core/svg/circle-9.svg +0 -1
- package/dist/pine-core/svg/circle-a.svg +0 -1
- package/dist/pine-core/svg/circle-b.svg +0 -1
- package/dist/pine-core/svg/circle-dashed.svg +0 -1
- package/dist/pine-core/svg/clapperboard-tone.svg +0 -1
- package/dist/pine-core/svg/clock.svg +0 -1
- package/dist/pine-core/svg/closed-captions.svg +0 -1
- package/dist/pine-core/svg/cloud-upload.svg +0 -1
- package/dist/pine-core/svg/code-block.svg +0 -1
- package/dist/pine-core/svg/code.svg +0 -1
- package/dist/pine-core/svg/color.svg +0 -1
- package/dist/pine-core/svg/columns.svg +0 -1
- package/dist/pine-core/svg/comment-no.svg +0 -1
- package/dist/pine-core/svg/comment.svg +0 -1
- package/dist/pine-core/svg/connect.svg +0 -1
- package/dist/pine-core/svg/contact.svg +0 -1
- package/dist/pine-core/svg/conversation.svg +0 -1
- package/dist/pine-core/svg/copy.svg +0 -1
- package/dist/pine-core/svg/coupon.svg +0 -1
- package/dist/pine-core/svg/course-filled.svg +0 -1
- package/dist/pine-core/svg/course.svg +0 -1
- package/dist/pine-core/svg/creator-studio-filled.svg +0 -1
- package/dist/pine-core/svg/creator-studio.svg +0 -1
- package/dist/pine-core/svg/credit-card-02-tone.svg +0 -1
- package/dist/pine-core/svg/cube-01-tone.svg +0 -1
- package/dist/pine-core/svg/cursor-pointer.svg +0 -1
- package/dist/pine-core/svg/cursor.svg +0 -1
- package/dist/pine-core/svg/custom-field.svg +0 -1
- package/dist/pine-core/svg/customize.svg +0 -1
- package/dist/pine-core/svg/danger-filled.svg +0 -1
- package/dist/pine-core/svg/danger.svg +0 -1
- package/dist/pine-core/svg/delete-circle.svg +0 -1
- package/dist/pine-core/svg/delete-key.svg +0 -1
- package/dist/pine-core/svg/delete-x.svg +0 -1
- package/dist/pine-core/svg/dollar.svg +0 -1
- package/dist/pine-core/svg/dot-menu-horizontal.svg +0 -1
- package/dist/pine-core/svg/dots-horizontal-tone.svg +0 -1
- package/dist/pine-core/svg/down-small.svg +0 -1
- package/dist/pine-core/svg/download.svg +0 -1
- package/dist/pine-core/svg/downsell.svg +0 -1
- package/dist/pine-core/svg/draft.svg +0 -1
- package/dist/pine-core/svg/drawer-collapse.svg +0 -1
- package/dist/pine-core/svg/drawer-expand.svg +0 -1
- package/dist/pine-core/svg/drop.svg +0 -1
- package/dist/pine-core/svg/duplicate.svg +0 -1
- package/dist/pine-core/svg/editor-filled.svg +0 -1
- package/dist/pine-core/svg/editor.svg +0 -1
- package/dist/pine-core/svg/email-activity.svg +0 -1
- package/dist/pine-core/svg/emoji.svg +0 -1
- package/dist/pine-core/svg/enlarge-vertical.svg +0 -1
- package/dist/pine-core/svg/enlarge.svg +0 -1
- package/dist/pine-core/svg/expand.svg +0 -1
- package/dist/pine-core/svg/favorite.svg +0 -1
- package/dist/pine-core/svg/feedback.svg +0 -1
- package/dist/pine-core/svg/file-02.svg +0 -1
- package/dist/pine-core/svg/file-money.svg +0 -1
- package/dist/pine-core/svg/file.svg +0 -1
- package/dist/pine-core/svg/filter.svg +0 -1
- package/dist/pine-core/svg/flag.svg +0 -1
- package/dist/pine-core/svg/flash-filled.svg +0 -1
- package/dist/pine-core/svg/flash.svg +0 -1
- package/dist/pine-core/svg/floppy-disk.svg +0 -1
- package/dist/pine-core/svg/folder-group.svg +0 -1
- package/dist/pine-core/svg/folder.svg +0 -1
- package/dist/pine-core/svg/form-field.svg +0 -1
- package/dist/pine-core/svg/form-filled.svg +0 -1
- package/dist/pine-core/svg/form.svg +0 -1
- package/dist/pine-core/svg/fullscreen.svg +0 -1
- package/dist/pine-core/svg/funnel.svg +0 -1
- package/dist/pine-core/svg/gear-filled.svg +0 -1
- package/dist/pine-core/svg/gear.svg +0 -1
- package/dist/pine-core/svg/grant-offer.svg +0 -1
- package/dist/pine-core/svg/handle-2-vertical.svg +0 -1
- package/dist/pine-core/svg/handle-2.svg +0 -1
- package/dist/pine-core/svg/handle.svg +0 -1
- package/dist/pine-core/svg/hashtag.svg +0 -1
- package/dist/pine-core/svg/hd-video.svg +0 -1
- package/dist/pine-core/svg/heading-1.svg +0 -1
- package/dist/pine-core/svg/heading-2.svg +0 -1
- package/dist/pine-core/svg/heading-3.svg +0 -1
- package/dist/pine-core/svg/heading-4.svg +0 -1
- package/dist/pine-core/svg/heading-5.svg +0 -1
- package/dist/pine-core/svg/heading-6.svg +0 -1
- package/dist/pine-core/svg/heading-large.svg +0 -1
- package/dist/pine-core/svg/heading-small.svg +0 -1
- package/dist/pine-core/svg/headset-tone.svg +0 -1
- package/dist/pine-core/svg/headset.svg +0 -1
- package/dist/pine-core/svg/help-filled.svg +0 -1
- package/dist/pine-core/svg/help.svg +0 -1
- package/dist/pine-core/svg/home-02-tone.svg +0 -1
- package/dist/pine-core/svg/home-alt.svg +0 -1
- package/dist/pine-core/svg/home-filled.svg +0 -1
- package/dist/pine-core/svg/home.svg +0 -1
- package/dist/pine-core/svg/horizontal-line.svg +0 -1
- package/dist/pine-core/svg/image.svg +0 -1
- package/dist/pine-core/svg/info-circle-filled.svg +0 -1
- package/dist/pine-core/svg/info-circle.svg +0 -1
- package/dist/pine-core/svg/ios-battery.svg +0 -1
- package/dist/pine-core/svg/ios-data.svg +0 -1
- package/dist/pine-core/svg/ios-wifi.svg +0 -1
- package/dist/pine-core/svg/italic.svg +0 -1
- package/dist/pine-core/svg/kajabi-filled.svg +0 -1
- package/dist/pine-core/svg/kajabi.svg +0 -1
- package/dist/pine-core/svg/klarna.svg +0 -1
- package/dist/pine-core/svg/lab.svg +0 -1
- package/dist/pine-core/svg/launch.svg +0 -1
- package/dist/pine-core/svg/layout-grid.svg +0 -1
- package/dist/pine-core/svg/layout-list.svg +0 -1
- package/dist/pine-core/svg/left-small.svg +0 -1
- package/dist/pine-core/svg/list-bullet.svg +0 -1
- package/dist/pine-core/svg/list-details.svg +0 -1
- package/dist/pine-core/svg/list-numbers.svg +0 -1
- package/dist/pine-core/svg/location.svg +0 -1
- package/dist/pine-core/svg/lock-alt.svg +0 -1
- package/dist/pine-core/svg/lock.svg +0 -1
- package/dist/pine-core/svg/logo-afterpay.svg +0 -1
- package/dist/pine-core/svg/logo-facebook-round.svg +0 -1
- package/dist/pine-core/svg/logo-facebook.svg +0 -1
- package/dist/pine-core/svg/logo-instagram.svg +0 -1
- package/dist/pine-core/svg/logo-linkedin.svg +0 -1
- package/dist/pine-core/svg/logo-tiktok.svg +0 -1
- package/dist/pine-core/svg/logo-twitter-x.svg +0 -1
- package/dist/pine-core/svg/logo-twitter.svg +0 -1
- package/dist/pine-core/svg/logo-youtube.svg +0 -1
- package/dist/pine-core/svg/loop.svg +0 -1
- package/dist/pine-core/svg/mail-01-tone.svg +0 -1
- package/dist/pine-core/svg/mail-filled.svg +0 -1
- package/dist/pine-core/svg/mail-open.svg +0 -1
- package/dist/pine-core/svg/mail.svg +0 -1
- package/dist/pine-core/svg/map.svg +0 -1
- package/dist/pine-core/svg/mapped.svg +0 -1
- package/dist/pine-core/svg/margin-left.svg +0 -1
- package/dist/pine-core/svg/margin-right.svg +0 -1
- package/dist/pine-core/svg/marker-filled.svg +0 -1
- package/dist/pine-core/svg/marker.svg +0 -1
- package/dist/pine-core/svg/megaphone-filled.svg +0 -1
- package/dist/pine-core/svg/megaphone.svg +0 -1
- package/dist/pine-core/svg/menu-alt.svg +0 -1
- package/dist/pine-core/svg/menu-bordered.svg +0 -1
- package/dist/pine-core/svg/menu.svg +0 -1
- package/dist/pine-core/svg/merge.svg +0 -1
- package/dist/pine-core/svg/microphone-off.svg +0 -1
- package/dist/pine-core/svg/microphone.svg +0 -1
- package/dist/pine-core/svg/monitor-03-tone.svg +0 -1
- package/dist/pine-core/svg/monitor-filled.svg +0 -1
- package/dist/pine-core/svg/monitor.svg +0 -1
- package/dist/pine-core/svg/more-menu-filled.svg +0 -1
- package/dist/pine-core/svg/more-menu.svg +0 -1
- package/dist/pine-core/svg/move-left.svg +0 -1
- package/dist/pine-core/svg/move-right.svg +0 -1
- package/dist/pine-core/svg/multi-pay.svg +0 -1
- package/dist/pine-core/svg/newsletter-2.svg +0 -1
- package/dist/pine-core/svg/newsletter.svg +0 -1
- package/dist/pine-core/svg/one-off-session.svg +0 -1
- package/dist/pine-core/svg/one-time.svg +0 -1
- package/dist/pine-core/svg/packages.svg +0 -1
- package/dist/pine-core/svg/pause-circle.svg +0 -1
- package/dist/pine-core/svg/pause.svg +0 -1
- package/dist/pine-core/svg/payout.svg +0 -1
- package/dist/pine-core/svg/pen.svg +0 -1
- package/dist/pine-core/svg/phone-02-tone.svg +0 -1
- package/dist/pine-core/svg/phone-portrait.svg +0 -1
- package/dist/pine-core/svg/phone-toolbar-filled.svg +0 -1
- package/dist/pine-core/svg/phone-toolbar.svg +0 -1
- package/dist/pine-core/svg/play-circle.svg +0 -1
- package/dist/pine-core/svg/play-outline.svg +0 -1
- package/dist/pine-core/svg/play-store.svg +0 -1
- package/dist/pine-core/svg/play.svg +0 -1
- package/dist/pine-core/svg/plug.svg +0 -1
- package/dist/pine-core/svg/premium.svg +0 -1
- package/dist/pine-core/svg/present.svg +0 -1
- package/dist/pine-core/svg/preview-off.svg +0 -1
- package/dist/pine-core/svg/preview-on.svg +0 -1
- package/dist/pine-core/svg/product-filled.svg +0 -1
- package/dist/pine-core/svg/product.svg +0 -1
- package/dist/pine-core/svg/question-circle.svg +0 -1
- package/dist/pine-core/svg/quote.svg +0 -1
- package/dist/pine-core/svg/redo.svg +0 -1
- package/dist/pine-core/svg/refresh.svg +0 -1
- package/dist/pine-core/svg/remove-circle.svg +0 -1
- package/dist/pine-core/svg/remove.svg +0 -1
- package/dist/pine-core/svg/rename.svg +0 -1
- package/dist/pine-core/svg/reset-password.svg +0 -1
- package/dist/pine-core/svg/restore.svg +0 -1
- package/dist/pine-core/svg/right-small.svg +0 -1
- package/dist/pine-core/svg/rocket-filled.svg +0 -1
- package/dist/pine-core/svg/rocket.svg +0 -1
- package/dist/pine-core/svg/round-dollar.svg +0 -1
- package/dist/pine-core/svg/rows.svg +0 -1
- package/dist/pine-core/svg/scissor.svg +0 -1
- package/dist/pine-core/svg/screen-share-off.svg +0 -1
- package/dist/pine-core/svg/screen-share-on.svg +0 -1
- package/dist/pine-core/svg/search-md-tone.svg +0 -1
- package/dist/pine-core/svg/search-small.svg +0 -1
- package/dist/pine-core/svg/search.svg +0 -1
- package/dist/pine-core/svg/send-message.svg +0 -1
- package/dist/pine-core/svg/sequences.svg +0 -1
- package/dist/pine-core/svg/settings-01-tone.svg +0 -1
- package/dist/pine-core/svg/share.svg +0 -1
- package/dist/pine-core/svg/skipped.svg +0 -1
- package/dist/pine-core/svg/slash-divider.svg +0 -1
- package/dist/pine-core/svg/speaker.svg +0 -1
- package/dist/pine-core/svg/stack.svg +0 -1
- package/dist/pine-core/svg/star.svg +0 -1
- package/dist/pine-core/svg/stars-01-tone.svg +0 -1
- package/dist/pine-core/svg/stop.svg +0 -1
- package/dist/pine-core/svg/stopwatch.svg +0 -1
- package/dist/pine-core/svg/strikethrough.svg +0 -1
- package/dist/pine-core/svg/subscript.svg +0 -1
- package/dist/pine-core/svg/subscriptions.svg +0 -1
- package/dist/pine-core/svg/super-admin.svg +0 -1
- package/dist/pine-core/svg/superscript.svg +0 -1
- package/dist/pine-core/svg/sync.svg +0 -1
- package/dist/pine-core/svg/tablet-landscape.svg +0 -1
- package/dist/pine-core/svg/tablet-portrait.svg +0 -1
- package/dist/pine-core/svg/tag-filled.svg +0 -1
- package/dist/pine-core/svg/tag.svg +0 -1
- package/dist/pine-core/svg/text-styles.svg +0 -1
- package/dist/pine-core/svg/theme-store-filled.svg +0 -1
- package/dist/pine-core/svg/theme-store.svg +0 -1
- package/dist/pine-core/svg/thumb-down-filled.svg +0 -1
- package/dist/pine-core/svg/thumb-down.svg +0 -1
- package/dist/pine-core/svg/thumb-up-filled.svg +0 -1
- package/dist/pine-core/svg/thumb-up.svg +0 -1
- package/dist/pine-core/svg/trash.svg +0 -1
- package/dist/pine-core/svg/trophy-filled.svg +0 -1
- package/dist/pine-core/svg/trophy.svg +0 -1
- package/dist/pine-core/svg/underline.svg +0 -1
- package/dist/pine-core/svg/undo.svg +0 -1
- package/dist/pine-core/svg/unlock.svg +0 -1
- package/dist/pine-core/svg/unmapped.svg +0 -1
- package/dist/pine-core/svg/up-small.svg +0 -1
- package/dist/pine-core/svg/upload.svg +0 -1
- package/dist/pine-core/svg/url.svg +0 -1
- package/dist/pine-core/svg/user-circle-filled.svg +0 -1
- package/dist/pine-core/svg/user-circle.svg +0 -1
- package/dist/pine-core/svg/user-filled.svg +0 -1
- package/dist/pine-core/svg/user-star-filled.svg +0 -1
- package/dist/pine-core/svg/user-star.svg +0 -1
- package/dist/pine-core/svg/user.svg +0 -1
- package/dist/pine-core/svg/users-02-tone.svg +0 -1
- package/dist/pine-core/svg/users-alt.svg +0 -1
- package/dist/pine-core/svg/users-filled.svg +0 -1
- package/dist/pine-core/svg/users.svg +0 -1
- package/dist/pine-core/svg/video-off.svg +0 -1
- package/dist/pine-core/svg/video-on.svg +0 -1
- package/dist/pine-core/svg/warning-filled.svg +0 -1
- package/dist/pine-core/svg/warning.svg +0 -1
- package/dist/pine-core/svg/window-paragraph.svg +0 -1
- package/dist/pine-core/svg/world.svg +0 -1
- package/dist/pine-core/svg/wrench.svg +0 -1
- package/dist/types/stories/_helpers/index.d.ts +0 -12
- package/loader/package.json +0 -11
|
@@ -0,0 +1,4498 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-4_RRPJTO.js';
|
|
2
|
+
import { i as isSpecTest, m as messageId, a as assignDescription } from './form-BuRbS7Hp.js';
|
|
3
|
+
import { a as autoUpdate, c as computePosition, o as offset, f as flip, s as shift, b as size, h as hide } from './floating-ui.dom-Cuc0DYlm.js';
|
|
4
|
+
import { c as cancelDebouncedEvent, d as debounceEvent, f as flushDebouncedEvent } from './utils-OYK5-nwe.js';
|
|
5
|
+
import { a as closest } from './closest-DHPzKMVS.js';
|
|
6
|
+
import './keep-hydrated-BgNaWLoS.js';
|
|
7
|
+
|
|
8
|
+
/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
entries,
|
|
12
|
+
setPrototypeOf,
|
|
13
|
+
isFrozen,
|
|
14
|
+
getPrototypeOf,
|
|
15
|
+
getOwnPropertyDescriptor
|
|
16
|
+
} = Object;
|
|
17
|
+
let {
|
|
18
|
+
freeze,
|
|
19
|
+
seal,
|
|
20
|
+
create
|
|
21
|
+
} = Object; // eslint-disable-line import/no-mutable-exports
|
|
22
|
+
let {
|
|
23
|
+
apply,
|
|
24
|
+
construct
|
|
25
|
+
} = typeof Reflect !== 'undefined' && Reflect;
|
|
26
|
+
if (!freeze) {
|
|
27
|
+
freeze = function freeze(x) {
|
|
28
|
+
return x;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (!seal) {
|
|
32
|
+
seal = function seal(x) {
|
|
33
|
+
return x;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (!apply) {
|
|
37
|
+
apply = function apply(func, thisArg) {
|
|
38
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
39
|
+
args[_key - 2] = arguments[_key];
|
|
40
|
+
}
|
|
41
|
+
return func.apply(thisArg, args);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (!construct) {
|
|
45
|
+
construct = function construct(Func) {
|
|
46
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
47
|
+
args[_key2 - 1] = arguments[_key2];
|
|
48
|
+
}
|
|
49
|
+
return new Func(...args);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const arrayForEach = unapply(Array.prototype.forEach);
|
|
53
|
+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
54
|
+
const arrayPop = unapply(Array.prototype.pop);
|
|
55
|
+
const arrayPush = unapply(Array.prototype.push);
|
|
56
|
+
const arraySplice = unapply(Array.prototype.splice);
|
|
57
|
+
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
58
|
+
const stringToString = unapply(String.prototype.toString);
|
|
59
|
+
const stringMatch = unapply(String.prototype.match);
|
|
60
|
+
const stringReplace = unapply(String.prototype.replace);
|
|
61
|
+
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
62
|
+
const stringTrim = unapply(String.prototype.trim);
|
|
63
|
+
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
64
|
+
const regExpTest = unapply(RegExp.prototype.test);
|
|
65
|
+
const typeErrorCreate = unconstruct(TypeError);
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
68
|
+
*
|
|
69
|
+
* @param func - The function to be wrapped and called.
|
|
70
|
+
* @returns A new function that calls the given function with a specified thisArg and arguments.
|
|
71
|
+
*/
|
|
72
|
+
function unapply(func) {
|
|
73
|
+
return function (thisArg) {
|
|
74
|
+
if (thisArg instanceof RegExp) {
|
|
75
|
+
thisArg.lastIndex = 0;
|
|
76
|
+
}
|
|
77
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
78
|
+
args[_key3 - 1] = arguments[_key3];
|
|
79
|
+
}
|
|
80
|
+
return apply(func, thisArg, args);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
85
|
+
*
|
|
86
|
+
* @param func - The constructor function to be wrapped and called.
|
|
87
|
+
* @returns A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
88
|
+
*/
|
|
89
|
+
function unconstruct(Func) {
|
|
90
|
+
return function () {
|
|
91
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
92
|
+
args[_key4] = arguments[_key4];
|
|
93
|
+
}
|
|
94
|
+
return construct(Func, args);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Add properties to a lookup table
|
|
99
|
+
*
|
|
100
|
+
* @param set - The set to which elements will be added.
|
|
101
|
+
* @param array - The array containing elements to be added to the set.
|
|
102
|
+
* @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
103
|
+
* @returns The modified set with added elements.
|
|
104
|
+
*/
|
|
105
|
+
function addToSet(set, array) {
|
|
106
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
|
|
107
|
+
if (setPrototypeOf) {
|
|
108
|
+
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
109
|
+
// independent of any properties defined on Object.prototype.
|
|
110
|
+
// Prevent prototype setters from intercepting set as a this value.
|
|
111
|
+
setPrototypeOf(set, null);
|
|
112
|
+
}
|
|
113
|
+
let l = array.length;
|
|
114
|
+
while (l--) {
|
|
115
|
+
let element = array[l];
|
|
116
|
+
if (typeof element === 'string') {
|
|
117
|
+
const lcElement = transformCaseFunc(element);
|
|
118
|
+
if (lcElement !== element) {
|
|
119
|
+
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
120
|
+
if (!isFrozen(array)) {
|
|
121
|
+
array[l] = lcElement;
|
|
122
|
+
}
|
|
123
|
+
element = lcElement;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
set[element] = true;
|
|
127
|
+
}
|
|
128
|
+
return set;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Clean up an array to harden against CSPP
|
|
132
|
+
*
|
|
133
|
+
* @param array - The array to be cleaned.
|
|
134
|
+
* @returns The cleaned version of the array
|
|
135
|
+
*/
|
|
136
|
+
function cleanArray(array) {
|
|
137
|
+
for (let index = 0; index < array.length; index++) {
|
|
138
|
+
const isPropertyExist = objectHasOwnProperty(array, index);
|
|
139
|
+
if (!isPropertyExist) {
|
|
140
|
+
array[index] = null;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return array;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Shallow clone an object
|
|
147
|
+
*
|
|
148
|
+
* @param object - The object to be cloned.
|
|
149
|
+
* @returns A new object that copies the original.
|
|
150
|
+
*/
|
|
151
|
+
function clone(object) {
|
|
152
|
+
const newObject = create(null);
|
|
153
|
+
for (const [property, value] of entries(object)) {
|
|
154
|
+
const isPropertyExist = objectHasOwnProperty(object, property);
|
|
155
|
+
if (isPropertyExist) {
|
|
156
|
+
if (Array.isArray(value)) {
|
|
157
|
+
newObject[property] = cleanArray(value);
|
|
158
|
+
} else if (value && typeof value === 'object' && value.constructor === Object) {
|
|
159
|
+
newObject[property] = clone(value);
|
|
160
|
+
} else {
|
|
161
|
+
newObject[property] = value;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return newObject;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
169
|
+
*
|
|
170
|
+
* @param object - The object to look up the getter function in its prototype chain.
|
|
171
|
+
* @param prop - The property name for which to find the getter function.
|
|
172
|
+
* @returns The getter function found in the prototype chain or a fallback function.
|
|
173
|
+
*/
|
|
174
|
+
function lookupGetter(object, prop) {
|
|
175
|
+
while (object !== null) {
|
|
176
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
177
|
+
if (desc) {
|
|
178
|
+
if (desc.get) {
|
|
179
|
+
return unapply(desc.get);
|
|
180
|
+
}
|
|
181
|
+
if (typeof desc.value === 'function') {
|
|
182
|
+
return unapply(desc.value);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
object = getPrototypeOf(object);
|
|
186
|
+
}
|
|
187
|
+
function fallbackValue() {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return fallbackValue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
194
|
+
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
195
|
+
const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
|
196
|
+
// List of SVG elements that are disallowed by default.
|
|
197
|
+
// We still need to know them so that we can do namespace
|
|
198
|
+
// checks properly in case one wants to add them to
|
|
199
|
+
// allow-list.
|
|
200
|
+
const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
201
|
+
const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
|
|
202
|
+
// Similarly to SVG, we want to know all MathML elements,
|
|
203
|
+
// even those that we disallow by default.
|
|
204
|
+
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
205
|
+
const text = freeze(['#text']);
|
|
206
|
+
|
|
207
|
+
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
208
|
+
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
209
|
+
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
210
|
+
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
211
|
+
|
|
212
|
+
// eslint-disable-next-line unicorn/better-regex
|
|
213
|
+
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
214
|
+
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
215
|
+
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
|
|
216
|
+
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
|
|
217
|
+
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
218
|
+
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
219
|
+
);
|
|
220
|
+
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
221
|
+
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
222
|
+
);
|
|
223
|
+
const DOCTYPE_NAME = seal(/^html$/i);
|
|
224
|
+
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
225
|
+
|
|
226
|
+
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
|
|
227
|
+
__proto__: null,
|
|
228
|
+
ARIA_ATTR: ARIA_ATTR,
|
|
229
|
+
ATTR_WHITESPACE: ATTR_WHITESPACE,
|
|
230
|
+
CUSTOM_ELEMENT: CUSTOM_ELEMENT,
|
|
231
|
+
DATA_ATTR: DATA_ATTR,
|
|
232
|
+
DOCTYPE_NAME: DOCTYPE_NAME,
|
|
233
|
+
ERB_EXPR: ERB_EXPR,
|
|
234
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
235
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
236
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
237
|
+
TMPLIT_EXPR: TMPLIT_EXPR
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
241
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
|
242
|
+
const NODE_TYPE = {
|
|
243
|
+
element: 1,
|
|
244
|
+
text: 3,
|
|
245
|
+
// Deprecated
|
|
246
|
+
progressingInstruction: 7,
|
|
247
|
+
comment: 8,
|
|
248
|
+
document: 9};
|
|
249
|
+
const getGlobal = function getGlobal() {
|
|
250
|
+
return typeof window === 'undefined' ? null : window;
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Creates a no-op policy for internal use only.
|
|
254
|
+
* Don't export this function outside this module!
|
|
255
|
+
* @param trustedTypes The policy factory.
|
|
256
|
+
* @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
|
|
257
|
+
* @return The policy created (or null, if Trusted Types
|
|
258
|
+
* are not supported or creating the policy failed).
|
|
259
|
+
*/
|
|
260
|
+
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
261
|
+
if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
// Allow the callers to control the unique policy name
|
|
265
|
+
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
266
|
+
// Policy creation with duplicate names throws in Trusted Types.
|
|
267
|
+
let suffix = null;
|
|
268
|
+
const ATTR_NAME = 'data-tt-policy-suffix';
|
|
269
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
|
270
|
+
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
271
|
+
}
|
|
272
|
+
const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
|
273
|
+
try {
|
|
274
|
+
return trustedTypes.createPolicy(policyName, {
|
|
275
|
+
createHTML(html) {
|
|
276
|
+
return html;
|
|
277
|
+
},
|
|
278
|
+
createScriptURL(scriptUrl) {
|
|
279
|
+
return scriptUrl;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
} catch (_) {
|
|
283
|
+
// Policy creation failed (most likely another DOMPurify script has
|
|
284
|
+
// already run). Skip creating the policy, as this will only cause errors
|
|
285
|
+
// if TT are enforced.
|
|
286
|
+
console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
const _createHooksMap = function _createHooksMap() {
|
|
291
|
+
return {
|
|
292
|
+
afterSanitizeAttributes: [],
|
|
293
|
+
afterSanitizeElements: [],
|
|
294
|
+
afterSanitizeShadowDOM: [],
|
|
295
|
+
beforeSanitizeAttributes: [],
|
|
296
|
+
beforeSanitizeElements: [],
|
|
297
|
+
beforeSanitizeShadowDOM: [],
|
|
298
|
+
uponSanitizeAttribute: [],
|
|
299
|
+
uponSanitizeElement: [],
|
|
300
|
+
uponSanitizeShadowNode: []
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
function createDOMPurify() {
|
|
304
|
+
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
305
|
+
const DOMPurify = root => createDOMPurify(root);
|
|
306
|
+
DOMPurify.version = '3.3.3';
|
|
307
|
+
DOMPurify.removed = [];
|
|
308
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
309
|
+
// Not running in a browser, provide a factory function
|
|
310
|
+
// so that you can pass your own Window
|
|
311
|
+
DOMPurify.isSupported = false;
|
|
312
|
+
return DOMPurify;
|
|
313
|
+
}
|
|
314
|
+
let {
|
|
315
|
+
document
|
|
316
|
+
} = window;
|
|
317
|
+
const originalDocument = document;
|
|
318
|
+
const currentScript = originalDocument.currentScript;
|
|
319
|
+
const {
|
|
320
|
+
DocumentFragment,
|
|
321
|
+
HTMLTemplateElement,
|
|
322
|
+
Node,
|
|
323
|
+
Element,
|
|
324
|
+
NodeFilter,
|
|
325
|
+
NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
|
|
326
|
+
HTMLFormElement,
|
|
327
|
+
DOMParser,
|
|
328
|
+
trustedTypes
|
|
329
|
+
} = window;
|
|
330
|
+
const ElementPrototype = Element.prototype;
|
|
331
|
+
const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
332
|
+
const remove = lookupGetter(ElementPrototype, 'remove');
|
|
333
|
+
const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
334
|
+
const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
335
|
+
const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
|
|
336
|
+
// As per issue #47, the web-components registry is inherited by a
|
|
337
|
+
// new document created via createHTMLDocument. As per the spec
|
|
338
|
+
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
339
|
+
// a new empty registry is used when creating a template contents owner
|
|
340
|
+
// document, so we use that as our parent document to ensure nothing
|
|
341
|
+
// is inherited.
|
|
342
|
+
if (typeof HTMLTemplateElement === 'function') {
|
|
343
|
+
const template = document.createElement('template');
|
|
344
|
+
if (template.content && template.content.ownerDocument) {
|
|
345
|
+
document = template.content.ownerDocument;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
let trustedTypesPolicy;
|
|
349
|
+
let emptyHTML = '';
|
|
350
|
+
const {
|
|
351
|
+
implementation,
|
|
352
|
+
createNodeIterator,
|
|
353
|
+
createDocumentFragment,
|
|
354
|
+
getElementsByTagName
|
|
355
|
+
} = document;
|
|
356
|
+
const {
|
|
357
|
+
importNode
|
|
358
|
+
} = originalDocument;
|
|
359
|
+
let hooks = _createHooksMap();
|
|
360
|
+
/**
|
|
361
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
362
|
+
*/
|
|
363
|
+
DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
|
|
364
|
+
const {
|
|
365
|
+
MUSTACHE_EXPR,
|
|
366
|
+
ERB_EXPR,
|
|
367
|
+
TMPLIT_EXPR,
|
|
368
|
+
DATA_ATTR,
|
|
369
|
+
ARIA_ATTR,
|
|
370
|
+
IS_SCRIPT_OR_DATA,
|
|
371
|
+
ATTR_WHITESPACE,
|
|
372
|
+
CUSTOM_ELEMENT
|
|
373
|
+
} = EXPRESSIONS;
|
|
374
|
+
let {
|
|
375
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
376
|
+
} = EXPRESSIONS;
|
|
377
|
+
/**
|
|
378
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
379
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
380
|
+
*/
|
|
381
|
+
/* allowed element names */
|
|
382
|
+
let ALLOWED_TAGS = null;
|
|
383
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
384
|
+
/* Allowed attribute names */
|
|
385
|
+
let ALLOWED_ATTR = null;
|
|
386
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
|
387
|
+
/*
|
|
388
|
+
* Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
|
|
389
|
+
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
390
|
+
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
391
|
+
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
392
|
+
*/
|
|
393
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
394
|
+
tagNameCheck: {
|
|
395
|
+
writable: true,
|
|
396
|
+
configurable: false,
|
|
397
|
+
enumerable: true,
|
|
398
|
+
value: null
|
|
399
|
+
},
|
|
400
|
+
attributeNameCheck: {
|
|
401
|
+
writable: true,
|
|
402
|
+
configurable: false,
|
|
403
|
+
enumerable: true,
|
|
404
|
+
value: null
|
|
405
|
+
},
|
|
406
|
+
allowCustomizedBuiltInElements: {
|
|
407
|
+
writable: true,
|
|
408
|
+
configurable: false,
|
|
409
|
+
enumerable: true,
|
|
410
|
+
value: false
|
|
411
|
+
}
|
|
412
|
+
}));
|
|
413
|
+
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
414
|
+
let FORBID_TAGS = null;
|
|
415
|
+
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
416
|
+
let FORBID_ATTR = null;
|
|
417
|
+
/* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
|
|
418
|
+
const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
419
|
+
tagCheck: {
|
|
420
|
+
writable: true,
|
|
421
|
+
configurable: false,
|
|
422
|
+
enumerable: true,
|
|
423
|
+
value: null
|
|
424
|
+
},
|
|
425
|
+
attributeCheck: {
|
|
426
|
+
writable: true,
|
|
427
|
+
configurable: false,
|
|
428
|
+
enumerable: true,
|
|
429
|
+
value: null
|
|
430
|
+
}
|
|
431
|
+
}));
|
|
432
|
+
/* Decide if ARIA attributes are okay */
|
|
433
|
+
let ALLOW_ARIA_ATTR = true;
|
|
434
|
+
/* Decide if custom data attributes are okay */
|
|
435
|
+
let ALLOW_DATA_ATTR = true;
|
|
436
|
+
/* Decide if unknown protocols are okay */
|
|
437
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
438
|
+
/* Decide if self-closing tags in attributes are allowed.
|
|
439
|
+
* Usually removed due to a mXSS issue in jQuery 3.0 */
|
|
440
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
441
|
+
/* Output should be safe for common template engines.
|
|
442
|
+
* This means, DOMPurify removes data attributes, mustaches and ERB
|
|
443
|
+
*/
|
|
444
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
445
|
+
/* Output should be safe even for XML used within HTML and alike.
|
|
446
|
+
* This means, DOMPurify removes comments when containing risky content.
|
|
447
|
+
*/
|
|
448
|
+
let SAFE_FOR_XML = true;
|
|
449
|
+
/* Decide if document with <html>... should be returned */
|
|
450
|
+
let WHOLE_DOCUMENT = false;
|
|
451
|
+
/* Track whether config is already set on this instance of DOMPurify. */
|
|
452
|
+
let SET_CONFIG = false;
|
|
453
|
+
/* Decide if all elements (e.g. style, script) must be children of
|
|
454
|
+
* document.body. By default, browsers might move them to document.head */
|
|
455
|
+
let FORCE_BODY = false;
|
|
456
|
+
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
|
457
|
+
* string (or a TrustedHTML object if Trusted Types are supported).
|
|
458
|
+
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
|
459
|
+
*/
|
|
460
|
+
let RETURN_DOM = false;
|
|
461
|
+
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
|
462
|
+
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
463
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
464
|
+
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
465
|
+
* case Trusted Types are not supported */
|
|
466
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
467
|
+
/* Output should be free from DOM clobbering attacks?
|
|
468
|
+
* This sanitizes markups named with colliding, clobberable built-in DOM APIs.
|
|
469
|
+
*/
|
|
470
|
+
let SANITIZE_DOM = true;
|
|
471
|
+
/* Achieve full DOM Clobbering protection by isolating the namespace of named
|
|
472
|
+
* properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
|
|
473
|
+
*
|
|
474
|
+
* HTML/DOM spec rules that enable DOM Clobbering:
|
|
475
|
+
* - Named Access on Window (§7.3.3)
|
|
476
|
+
* - DOM Tree Accessors (§3.1.5)
|
|
477
|
+
* - Form Element Parent-Child Relations (§4.10.3)
|
|
478
|
+
* - Iframe srcdoc / Nested WindowProxies (§4.8.5)
|
|
479
|
+
* - HTMLCollection (§4.2.10.2)
|
|
480
|
+
*
|
|
481
|
+
* Namespace isolation is implemented by prefixing `id` and `name` attributes
|
|
482
|
+
* with a constant string, i.e., `user-content-`
|
|
483
|
+
*/
|
|
484
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
485
|
+
const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
|
|
486
|
+
/* Keep element content when removing element? */
|
|
487
|
+
let KEEP_CONTENT = true;
|
|
488
|
+
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
489
|
+
* of importing it into a new Document and returning a sanitized copy */
|
|
490
|
+
let IN_PLACE = false;
|
|
491
|
+
/* Allow usage of profiles like html, svg and mathMl */
|
|
492
|
+
let USE_PROFILES = {};
|
|
493
|
+
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
494
|
+
let FORBID_CONTENTS = null;
|
|
495
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
496
|
+
/* Tags that are safe for data: URIs */
|
|
497
|
+
let DATA_URI_TAGS = null;
|
|
498
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
499
|
+
/* Attributes safe for values like "javascript:" */
|
|
500
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
501
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
502
|
+
const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
503
|
+
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
504
|
+
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
505
|
+
/* Document namespace */
|
|
506
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
507
|
+
let IS_EMPTY_INPUT = false;
|
|
508
|
+
/* Allowed XHTML+XML namespaces */
|
|
509
|
+
let ALLOWED_NAMESPACES = null;
|
|
510
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
511
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
512
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
|
|
513
|
+
// Certain elements are allowed in both SVG and HTML
|
|
514
|
+
// namespace. We need to specify them explicitly
|
|
515
|
+
// so that they don't get erroneously deleted from
|
|
516
|
+
// HTML namespace.
|
|
517
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
518
|
+
/* Parsing of strict XHTML documents */
|
|
519
|
+
let PARSER_MEDIA_TYPE = null;
|
|
520
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
521
|
+
const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
522
|
+
let transformCaseFunc = null;
|
|
523
|
+
/* Keep a reference to config to pass to hooks */
|
|
524
|
+
let CONFIG = null;
|
|
525
|
+
/* Ideally, do not touch anything below this line */
|
|
526
|
+
/* ______________________________________________ */
|
|
527
|
+
const formElement = document.createElement('form');
|
|
528
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
529
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* _parseConfig
|
|
533
|
+
*
|
|
534
|
+
* @param cfg optional config literal
|
|
535
|
+
*/
|
|
536
|
+
// eslint-disable-next-line complexity
|
|
537
|
+
const _parseConfig = function _parseConfig() {
|
|
538
|
+
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
539
|
+
if (CONFIG && CONFIG === cfg) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
/* Shield configuration object from tampering */
|
|
543
|
+
if (!cfg || typeof cfg !== 'object') {
|
|
544
|
+
cfg = {};
|
|
545
|
+
}
|
|
546
|
+
/* Shield configuration object from prototype pollution */
|
|
547
|
+
cfg = clone(cfg);
|
|
548
|
+
PARSER_MEDIA_TYPE =
|
|
549
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
550
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
551
|
+
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
552
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
553
|
+
/* Set configuration parameters */
|
|
554
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
555
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
556
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
557
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
558
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
559
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
560
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
561
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
562
|
+
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
563
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
564
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
565
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
566
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
|
|
567
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
|
|
568
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
|
|
569
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
|
570
|
+
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
|
571
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
|
572
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
|
|
573
|
+
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
|
574
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
|
575
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
|
|
576
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
577
|
+
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
578
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
|
579
|
+
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
580
|
+
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
|
581
|
+
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
|
582
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
583
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
584
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
585
|
+
}
|
|
586
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
|
587
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
|
588
|
+
}
|
|
589
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
|
|
590
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
591
|
+
}
|
|
592
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
593
|
+
ALLOW_DATA_ATTR = false;
|
|
594
|
+
}
|
|
595
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
596
|
+
RETURN_DOM = true;
|
|
597
|
+
}
|
|
598
|
+
/* Parse profile info */
|
|
599
|
+
if (USE_PROFILES) {
|
|
600
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
601
|
+
ALLOWED_ATTR = create(null);
|
|
602
|
+
if (USE_PROFILES.html === true) {
|
|
603
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
604
|
+
addToSet(ALLOWED_ATTR, html);
|
|
605
|
+
}
|
|
606
|
+
if (USE_PROFILES.svg === true) {
|
|
607
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
608
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
609
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
610
|
+
}
|
|
611
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
612
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
613
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
614
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
615
|
+
}
|
|
616
|
+
if (USE_PROFILES.mathMl === true) {
|
|
617
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
618
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
619
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
/* Prevent function-based ADD_ATTR / ADD_TAGS from leaking across calls */
|
|
623
|
+
if (!objectHasOwnProperty(cfg, 'ADD_TAGS')) {
|
|
624
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
625
|
+
}
|
|
626
|
+
if (!objectHasOwnProperty(cfg, 'ADD_ATTR')) {
|
|
627
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
628
|
+
}
|
|
629
|
+
/* Merge configuration parameters */
|
|
630
|
+
if (cfg.ADD_TAGS) {
|
|
631
|
+
if (typeof cfg.ADD_TAGS === 'function') {
|
|
632
|
+
EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
633
|
+
} else {
|
|
634
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
635
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
636
|
+
}
|
|
637
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
if (cfg.ADD_ATTR) {
|
|
641
|
+
if (typeof cfg.ADD_ATTR === 'function') {
|
|
642
|
+
EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
643
|
+
} else {
|
|
644
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
645
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
646
|
+
}
|
|
647
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
651
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
652
|
+
}
|
|
653
|
+
if (cfg.FORBID_CONTENTS) {
|
|
654
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
655
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
656
|
+
}
|
|
657
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
658
|
+
}
|
|
659
|
+
if (cfg.ADD_FORBID_CONTENTS) {
|
|
660
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
661
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
662
|
+
}
|
|
663
|
+
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
664
|
+
}
|
|
665
|
+
/* Add #text in case KEEP_CONTENT is set to true */
|
|
666
|
+
if (KEEP_CONTENT) {
|
|
667
|
+
ALLOWED_TAGS['#text'] = true;
|
|
668
|
+
}
|
|
669
|
+
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
670
|
+
if (WHOLE_DOCUMENT) {
|
|
671
|
+
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
|
672
|
+
}
|
|
673
|
+
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
674
|
+
if (ALLOWED_TAGS.table) {
|
|
675
|
+
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
676
|
+
delete FORBID_TAGS.tbody;
|
|
677
|
+
}
|
|
678
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
679
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
|
|
680
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
681
|
+
}
|
|
682
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
|
|
683
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
684
|
+
}
|
|
685
|
+
// Overwrite existing TrustedTypes policy.
|
|
686
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
687
|
+
// Sign local variables required by `sanitize`.
|
|
688
|
+
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
689
|
+
} else {
|
|
690
|
+
// Uninitialized policy, attempt to initialize the internal dompurify policy.
|
|
691
|
+
if (trustedTypesPolicy === undefined) {
|
|
692
|
+
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
693
|
+
}
|
|
694
|
+
// If creating the internal policy succeeded sign internal variables.
|
|
695
|
+
if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
|
|
696
|
+
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
// Prevent further manipulation of configuration.
|
|
700
|
+
// Not available in IE8, Safari 5, etc.
|
|
701
|
+
if (freeze) {
|
|
702
|
+
freeze(cfg);
|
|
703
|
+
}
|
|
704
|
+
CONFIG = cfg;
|
|
705
|
+
};
|
|
706
|
+
/* Keep track of all possible SVG and MathML tags
|
|
707
|
+
* so that we can perform the namespace checks
|
|
708
|
+
* correctly. */
|
|
709
|
+
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
710
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
711
|
+
/**
|
|
712
|
+
* @param element a DOM element whose namespace is being checked
|
|
713
|
+
* @returns Return false if the element has a
|
|
714
|
+
* namespace that a spec-compliant parser would never
|
|
715
|
+
* return. Return true otherwise.
|
|
716
|
+
*/
|
|
717
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
718
|
+
let parent = getParentNode(element);
|
|
719
|
+
// In JSDOM, if we're inside shadow DOM, then parentNode
|
|
720
|
+
// can be null. We just simulate parent in this case.
|
|
721
|
+
if (!parent || !parent.tagName) {
|
|
722
|
+
parent = {
|
|
723
|
+
namespaceURI: NAMESPACE,
|
|
724
|
+
tagName: 'template'
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
728
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
729
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
730
|
+
return false;
|
|
731
|
+
}
|
|
732
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
733
|
+
// The only way to switch from HTML namespace to SVG
|
|
734
|
+
// is via <svg>. If it happens via any other tag, then
|
|
735
|
+
// it should be killed.
|
|
736
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
737
|
+
return tagName === 'svg';
|
|
738
|
+
}
|
|
739
|
+
// The only way to switch from MathML to SVG is via`
|
|
740
|
+
// svg if parent is either <annotation-xml> or MathML
|
|
741
|
+
// text integration points.
|
|
742
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
743
|
+
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
744
|
+
}
|
|
745
|
+
// We only allow elements that are defined in SVG
|
|
746
|
+
// spec. All others are disallowed in SVG namespace.
|
|
747
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
748
|
+
}
|
|
749
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
750
|
+
// The only way to switch from HTML namespace to MathML
|
|
751
|
+
// is via <math>. If it happens via any other tag, then
|
|
752
|
+
// it should be killed.
|
|
753
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
754
|
+
return tagName === 'math';
|
|
755
|
+
}
|
|
756
|
+
// The only way to switch from SVG to MathML is via
|
|
757
|
+
// <math> and HTML integration points
|
|
758
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
759
|
+
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
760
|
+
}
|
|
761
|
+
// We only allow elements that are defined in MathML
|
|
762
|
+
// spec. All others are disallowed in MathML namespace.
|
|
763
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
764
|
+
}
|
|
765
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
766
|
+
// The only way to switch from SVG to HTML is via
|
|
767
|
+
// HTML integration points, and from MathML to HTML
|
|
768
|
+
// is via MathML text integration points
|
|
769
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
// We disallow tags that are specific for MathML
|
|
776
|
+
// or SVG and should never appear in HTML namespace
|
|
777
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
778
|
+
}
|
|
779
|
+
// For XHTML and XML documents that support custom namespaces
|
|
780
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
781
|
+
return true;
|
|
782
|
+
}
|
|
783
|
+
// The code should never reach this place (this means
|
|
784
|
+
// that the element somehow got namespace that is not
|
|
785
|
+
// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
|
|
786
|
+
// Return false just in case.
|
|
787
|
+
return false;
|
|
788
|
+
};
|
|
789
|
+
/**
|
|
790
|
+
* _forceRemove
|
|
791
|
+
*
|
|
792
|
+
* @param node a DOM node
|
|
793
|
+
*/
|
|
794
|
+
const _forceRemove = function _forceRemove(node) {
|
|
795
|
+
arrayPush(DOMPurify.removed, {
|
|
796
|
+
element: node
|
|
797
|
+
});
|
|
798
|
+
try {
|
|
799
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
800
|
+
getParentNode(node).removeChild(node);
|
|
801
|
+
} catch (_) {
|
|
802
|
+
remove(node);
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
/**
|
|
806
|
+
* _removeAttribute
|
|
807
|
+
*
|
|
808
|
+
* @param name an Attribute name
|
|
809
|
+
* @param element a DOM node
|
|
810
|
+
*/
|
|
811
|
+
const _removeAttribute = function _removeAttribute(name, element) {
|
|
812
|
+
try {
|
|
813
|
+
arrayPush(DOMPurify.removed, {
|
|
814
|
+
attribute: element.getAttributeNode(name),
|
|
815
|
+
from: element
|
|
816
|
+
});
|
|
817
|
+
} catch (_) {
|
|
818
|
+
arrayPush(DOMPurify.removed, {
|
|
819
|
+
attribute: null,
|
|
820
|
+
from: element
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
element.removeAttribute(name);
|
|
824
|
+
// We void attribute values for unremovable "is" attributes
|
|
825
|
+
if (name === 'is') {
|
|
826
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
827
|
+
try {
|
|
828
|
+
_forceRemove(element);
|
|
829
|
+
} catch (_) {}
|
|
830
|
+
} else {
|
|
831
|
+
try {
|
|
832
|
+
element.setAttribute(name, '');
|
|
833
|
+
} catch (_) {}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
/**
|
|
838
|
+
* _initDocument
|
|
839
|
+
*
|
|
840
|
+
* @param dirty - a string of dirty markup
|
|
841
|
+
* @return a DOM, filled with the dirty markup
|
|
842
|
+
*/
|
|
843
|
+
const _initDocument = function _initDocument(dirty) {
|
|
844
|
+
/* Create a HTML document */
|
|
845
|
+
let doc = null;
|
|
846
|
+
let leadingWhitespace = null;
|
|
847
|
+
if (FORCE_BODY) {
|
|
848
|
+
dirty = '<remove></remove>' + dirty;
|
|
849
|
+
} else {
|
|
850
|
+
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
|
851
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
852
|
+
leadingWhitespace = matches && matches[0];
|
|
853
|
+
}
|
|
854
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
|
|
855
|
+
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
856
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
857
|
+
}
|
|
858
|
+
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
859
|
+
/*
|
|
860
|
+
* Use the DOMParser API by default, fallback later if needs be
|
|
861
|
+
* DOMParser not work for svg when has multiple root element.
|
|
862
|
+
*/
|
|
863
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
864
|
+
try {
|
|
865
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
866
|
+
} catch (_) {}
|
|
867
|
+
}
|
|
868
|
+
/* Use createHTMLDocument in case DOMParser is not available */
|
|
869
|
+
if (!doc || !doc.documentElement) {
|
|
870
|
+
doc = implementation.createDocument(NAMESPACE, 'template', null);
|
|
871
|
+
try {
|
|
872
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
873
|
+
} catch (_) {
|
|
874
|
+
// Syntax error if dirtyPayload is invalid xml
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
const body = doc.body || doc.documentElement;
|
|
878
|
+
if (dirty && leadingWhitespace) {
|
|
879
|
+
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
880
|
+
}
|
|
881
|
+
/* Work on whole document or just its body */
|
|
882
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
883
|
+
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
|
884
|
+
}
|
|
885
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
|
|
889
|
+
*
|
|
890
|
+
* @param root The root element or node to start traversing on.
|
|
891
|
+
* @return The created NodeIterator
|
|
892
|
+
*/
|
|
893
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
894
|
+
return createNodeIterator.call(root.ownerDocument || root, root,
|
|
895
|
+
// eslint-disable-next-line no-bitwise
|
|
896
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* _isClobbered
|
|
900
|
+
*
|
|
901
|
+
* @param element element to check for clobbering attacks
|
|
902
|
+
* @return true if clobbered, false if safe
|
|
903
|
+
*/
|
|
904
|
+
const _isClobbered = function _isClobbered(element) {
|
|
905
|
+
return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
|
|
906
|
+
};
|
|
907
|
+
/**
|
|
908
|
+
* Checks whether the given object is a DOM node.
|
|
909
|
+
*
|
|
910
|
+
* @param value object to check whether it's a DOM node
|
|
911
|
+
* @return true is object is a DOM node
|
|
912
|
+
*/
|
|
913
|
+
const _isNode = function _isNode(value) {
|
|
914
|
+
return typeof Node === 'function' && value instanceof Node;
|
|
915
|
+
};
|
|
916
|
+
function _executeHooks(hooks, currentNode, data) {
|
|
917
|
+
arrayForEach(hooks, hook => {
|
|
918
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* _sanitizeElements
|
|
923
|
+
*
|
|
924
|
+
* @protect nodeName
|
|
925
|
+
* @protect textContent
|
|
926
|
+
* @protect removeChild
|
|
927
|
+
* @param currentNode to check for permission to exist
|
|
928
|
+
* @return true if node was killed, false if left alive
|
|
929
|
+
*/
|
|
930
|
+
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
931
|
+
let content = null;
|
|
932
|
+
/* Execute a hook if present */
|
|
933
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
934
|
+
/* Check if element is clobbered or can clobber */
|
|
935
|
+
if (_isClobbered(currentNode)) {
|
|
936
|
+
_forceRemove(currentNode);
|
|
937
|
+
return true;
|
|
938
|
+
}
|
|
939
|
+
/* Now let's check the element's type and name */
|
|
940
|
+
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
941
|
+
/* Execute a hook if present */
|
|
942
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
943
|
+
tagName,
|
|
944
|
+
allowedTags: ALLOWED_TAGS
|
|
945
|
+
});
|
|
946
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
947
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
948
|
+
_forceRemove(currentNode);
|
|
949
|
+
return true;
|
|
950
|
+
}
|
|
951
|
+
/* Remove any occurrence of processing instructions */
|
|
952
|
+
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
953
|
+
_forceRemove(currentNode);
|
|
954
|
+
return true;
|
|
955
|
+
}
|
|
956
|
+
/* Remove any kind of possibly harmful comments */
|
|
957
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
958
|
+
_forceRemove(currentNode);
|
|
959
|
+
return true;
|
|
960
|
+
}
|
|
961
|
+
/* Remove element if anything forbids its presence */
|
|
962
|
+
if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
|
|
963
|
+
/* Check if we have a custom element to handle */
|
|
964
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
965
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
966
|
+
return false;
|
|
967
|
+
}
|
|
968
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
|
969
|
+
return false;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
/* Keep content except for bad-listed elements */
|
|
973
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
974
|
+
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
975
|
+
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
976
|
+
if (childNodes && parentNode) {
|
|
977
|
+
const childCount = childNodes.length;
|
|
978
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
979
|
+
const childClone = cloneNode(childNodes[i], true);
|
|
980
|
+
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
981
|
+
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
_forceRemove(currentNode);
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
/* Check whether element has a valid namespace */
|
|
989
|
+
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
990
|
+
_forceRemove(currentNode);
|
|
991
|
+
return true;
|
|
992
|
+
}
|
|
993
|
+
/* Make sure that older browsers don't get fallback-tag mXSS */
|
|
994
|
+
if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
995
|
+
_forceRemove(currentNode);
|
|
996
|
+
return true;
|
|
997
|
+
}
|
|
998
|
+
/* Sanitize element content to be template-safe */
|
|
999
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
1000
|
+
/* Get the element's text content */
|
|
1001
|
+
content = currentNode.textContent;
|
|
1002
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1003
|
+
content = stringReplace(content, expr, ' ');
|
|
1004
|
+
});
|
|
1005
|
+
if (currentNode.textContent !== content) {
|
|
1006
|
+
arrayPush(DOMPurify.removed, {
|
|
1007
|
+
element: currentNode.cloneNode()
|
|
1008
|
+
});
|
|
1009
|
+
currentNode.textContent = content;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
/* Execute a hook if present */
|
|
1013
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
1014
|
+
return false;
|
|
1015
|
+
};
|
|
1016
|
+
/**
|
|
1017
|
+
* _isValidAttribute
|
|
1018
|
+
*
|
|
1019
|
+
* @param lcTag Lowercase tag name of containing element.
|
|
1020
|
+
* @param lcName Lowercase attribute name.
|
|
1021
|
+
* @param value Attribute value.
|
|
1022
|
+
* @return Returns true if `value` is valid, otherwise false.
|
|
1023
|
+
*/
|
|
1024
|
+
// eslint-disable-next-line complexity
|
|
1025
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
1026
|
+
/* FORBID_ATTR must always win, even if ADD_ATTR predicate would allow it */
|
|
1027
|
+
if (FORBID_ATTR[lcName]) {
|
|
1028
|
+
return false;
|
|
1029
|
+
}
|
|
1030
|
+
/* Make sure attribute cannot clobber */
|
|
1031
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
1032
|
+
return false;
|
|
1033
|
+
}
|
|
1034
|
+
/* Allow valid data-* attributes: At least one character after "-"
|
|
1035
|
+
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
1036
|
+
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
1037
|
+
We don't need to check the value; it's always URI safe. */
|
|
1038
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
1039
|
+
if (
|
|
1040
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1041
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1042
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1043
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
|
|
1044
|
+
// Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1045
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1046
|
+
lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
|
|
1047
|
+
return false;
|
|
1048
|
+
}
|
|
1049
|
+
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
1050
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
|
|
1051
|
+
return false;
|
|
1052
|
+
} else ;
|
|
1053
|
+
return true;
|
|
1054
|
+
};
|
|
1055
|
+
/**
|
|
1056
|
+
* _isBasicCustomElement
|
|
1057
|
+
* checks if at least one dash is included in tagName, and it's not the first char
|
|
1058
|
+
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
1059
|
+
*
|
|
1060
|
+
* @param tagName name of the tag of the node to sanitize
|
|
1061
|
+
* @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
1062
|
+
*/
|
|
1063
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
1064
|
+
return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
|
|
1065
|
+
};
|
|
1066
|
+
/**
|
|
1067
|
+
* _sanitizeAttributes
|
|
1068
|
+
*
|
|
1069
|
+
* @protect attributes
|
|
1070
|
+
* @protect nodeName
|
|
1071
|
+
* @protect removeAttribute
|
|
1072
|
+
* @protect setAttribute
|
|
1073
|
+
*
|
|
1074
|
+
* @param currentNode to sanitize
|
|
1075
|
+
*/
|
|
1076
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
1077
|
+
/* Execute a hook if present */
|
|
1078
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
1079
|
+
const {
|
|
1080
|
+
attributes
|
|
1081
|
+
} = currentNode;
|
|
1082
|
+
/* Check if we have attributes; if not we might have a text node */
|
|
1083
|
+
if (!attributes || _isClobbered(currentNode)) {
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
const hookEvent = {
|
|
1087
|
+
attrName: '',
|
|
1088
|
+
attrValue: '',
|
|
1089
|
+
keepAttr: true,
|
|
1090
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
1091
|
+
forceKeepAttr: undefined
|
|
1092
|
+
};
|
|
1093
|
+
let l = attributes.length;
|
|
1094
|
+
/* Go backwards over all attributes; safely remove bad ones */
|
|
1095
|
+
while (l--) {
|
|
1096
|
+
const attr = attributes[l];
|
|
1097
|
+
const {
|
|
1098
|
+
name,
|
|
1099
|
+
namespaceURI,
|
|
1100
|
+
value: attrValue
|
|
1101
|
+
} = attr;
|
|
1102
|
+
const lcName = transformCaseFunc(name);
|
|
1103
|
+
const initValue = attrValue;
|
|
1104
|
+
let value = name === 'value' ? initValue : stringTrim(initValue);
|
|
1105
|
+
/* Execute a hook if present */
|
|
1106
|
+
hookEvent.attrName = lcName;
|
|
1107
|
+
hookEvent.attrValue = value;
|
|
1108
|
+
hookEvent.keepAttr = true;
|
|
1109
|
+
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
1110
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
1111
|
+
value = hookEvent.attrValue;
|
|
1112
|
+
/* Full DOM Clobbering protection via namespace isolation,
|
|
1113
|
+
* Prefix id and name attributes with `user-content-`
|
|
1114
|
+
*/
|
|
1115
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
1116
|
+
// Remove the attribute with this value
|
|
1117
|
+
_removeAttribute(name, currentNode);
|
|
1118
|
+
// Prefix the value and later re-create the attribute with the sanitized value
|
|
1119
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1120
|
+
}
|
|
1121
|
+
/* Work around a security issue with comments inside attributes */
|
|
1122
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
|
|
1123
|
+
_removeAttribute(name, currentNode);
|
|
1124
|
+
continue;
|
|
1125
|
+
}
|
|
1126
|
+
/* Make sure we cannot easily use animated hrefs, even if animations are allowed */
|
|
1127
|
+
if (lcName === 'attributename' && stringMatch(value, 'href')) {
|
|
1128
|
+
_removeAttribute(name, currentNode);
|
|
1129
|
+
continue;
|
|
1130
|
+
}
|
|
1131
|
+
/* Did the hooks approve of the attribute? */
|
|
1132
|
+
if (hookEvent.forceKeepAttr) {
|
|
1133
|
+
continue;
|
|
1134
|
+
}
|
|
1135
|
+
/* Did the hooks approve of the attribute? */
|
|
1136
|
+
if (!hookEvent.keepAttr) {
|
|
1137
|
+
_removeAttribute(name, currentNode);
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1140
|
+
/* Work around a security issue in jQuery 3.0 */
|
|
1141
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
1142
|
+
_removeAttribute(name, currentNode);
|
|
1143
|
+
continue;
|
|
1144
|
+
}
|
|
1145
|
+
/* Sanitize attribute content to be template-safe */
|
|
1146
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
1147
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1148
|
+
value = stringReplace(value, expr, ' ');
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
/* Is `value` valid for this attribute? */
|
|
1152
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
1153
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
1154
|
+
_removeAttribute(name, currentNode);
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
/* Handle attributes that require Trusted Types */
|
|
1158
|
+
if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
|
|
1159
|
+
if (namespaceURI) ; else {
|
|
1160
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
1161
|
+
case 'TrustedHTML':
|
|
1162
|
+
{
|
|
1163
|
+
value = trustedTypesPolicy.createHTML(value);
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1166
|
+
case 'TrustedScriptURL':
|
|
1167
|
+
{
|
|
1168
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
|
1169
|
+
break;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
/* Handle invalid data-* attribute set by try-catching it */
|
|
1175
|
+
if (value !== initValue) {
|
|
1176
|
+
try {
|
|
1177
|
+
if (namespaceURI) {
|
|
1178
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
1179
|
+
} else {
|
|
1180
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
1181
|
+
currentNode.setAttribute(name, value);
|
|
1182
|
+
}
|
|
1183
|
+
if (_isClobbered(currentNode)) {
|
|
1184
|
+
_forceRemove(currentNode);
|
|
1185
|
+
} else {
|
|
1186
|
+
arrayPop(DOMPurify.removed);
|
|
1187
|
+
}
|
|
1188
|
+
} catch (_) {
|
|
1189
|
+
_removeAttribute(name, currentNode);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
/* Execute a hook if present */
|
|
1194
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
1195
|
+
};
|
|
1196
|
+
/**
|
|
1197
|
+
* _sanitizeShadowDOM
|
|
1198
|
+
*
|
|
1199
|
+
* @param fragment to iterate over recursively
|
|
1200
|
+
*/
|
|
1201
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
1202
|
+
let shadowNode = null;
|
|
1203
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
1204
|
+
/* Execute a hook if present */
|
|
1205
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
1206
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
1207
|
+
/* Execute a hook if present */
|
|
1208
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
1209
|
+
/* Sanitize tags and elements */
|
|
1210
|
+
_sanitizeElements(shadowNode);
|
|
1211
|
+
/* Check attributes next */
|
|
1212
|
+
_sanitizeAttributes(shadowNode);
|
|
1213
|
+
/* Deep shadow DOM detected */
|
|
1214
|
+
if (shadowNode.content instanceof DocumentFragment) {
|
|
1215
|
+
_sanitizeShadowDOM(shadowNode.content);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
/* Execute a hook if present */
|
|
1219
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
1220
|
+
};
|
|
1221
|
+
// eslint-disable-next-line complexity
|
|
1222
|
+
DOMPurify.sanitize = function (dirty) {
|
|
1223
|
+
let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1224
|
+
let body = null;
|
|
1225
|
+
let importedNode = null;
|
|
1226
|
+
let currentNode = null;
|
|
1227
|
+
let returnNode = null;
|
|
1228
|
+
/* Make sure we have a string to sanitize.
|
|
1229
|
+
DO NOT return early, as this will return the wrong type if
|
|
1230
|
+
the user has requested a DOM object rather than a string */
|
|
1231
|
+
IS_EMPTY_INPUT = !dirty;
|
|
1232
|
+
if (IS_EMPTY_INPUT) {
|
|
1233
|
+
dirty = '<!-->';
|
|
1234
|
+
}
|
|
1235
|
+
/* Stringify, in case dirty is an object */
|
|
1236
|
+
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
1237
|
+
if (typeof dirty.toString === 'function') {
|
|
1238
|
+
dirty = dirty.toString();
|
|
1239
|
+
if (typeof dirty !== 'string') {
|
|
1240
|
+
throw typeErrorCreate('dirty is not a string, aborting');
|
|
1241
|
+
}
|
|
1242
|
+
} else {
|
|
1243
|
+
throw typeErrorCreate('toString is not a function');
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
/* Return dirty HTML if DOMPurify cannot run */
|
|
1247
|
+
if (!DOMPurify.isSupported) {
|
|
1248
|
+
return dirty;
|
|
1249
|
+
}
|
|
1250
|
+
/* Assign config vars */
|
|
1251
|
+
if (!SET_CONFIG) {
|
|
1252
|
+
_parseConfig(cfg);
|
|
1253
|
+
}
|
|
1254
|
+
/* Clean up removed elements */
|
|
1255
|
+
DOMPurify.removed = [];
|
|
1256
|
+
/* Check if dirty is correctly typed for IN_PLACE */
|
|
1257
|
+
if (typeof dirty === 'string') {
|
|
1258
|
+
IN_PLACE = false;
|
|
1259
|
+
}
|
|
1260
|
+
if (IN_PLACE) {
|
|
1261
|
+
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
1262
|
+
if (dirty.nodeName) {
|
|
1263
|
+
const tagName = transformCaseFunc(dirty.nodeName);
|
|
1264
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
1265
|
+
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
} else if (dirty instanceof Node) {
|
|
1269
|
+
/* If dirty is a DOM element, append to an empty document to avoid
|
|
1270
|
+
elements being stripped by the parser */
|
|
1271
|
+
body = _initDocument('<!---->');
|
|
1272
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
1273
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
|
|
1274
|
+
/* Node is already a body, use as is */
|
|
1275
|
+
body = importedNode;
|
|
1276
|
+
} else if (importedNode.nodeName === 'HTML') {
|
|
1277
|
+
body = importedNode;
|
|
1278
|
+
} else {
|
|
1279
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
1280
|
+
body.appendChild(importedNode);
|
|
1281
|
+
}
|
|
1282
|
+
} else {
|
|
1283
|
+
/* Exit directly if we have nothing to do */
|
|
1284
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
|
1285
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
1286
|
+
dirty.indexOf('<') === -1) {
|
|
1287
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
1288
|
+
}
|
|
1289
|
+
/* Initialize the document to work on */
|
|
1290
|
+
body = _initDocument(dirty);
|
|
1291
|
+
/* Check we have a DOM node from the data */
|
|
1292
|
+
if (!body) {
|
|
1293
|
+
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
1297
|
+
if (body && FORCE_BODY) {
|
|
1298
|
+
_forceRemove(body.firstChild);
|
|
1299
|
+
}
|
|
1300
|
+
/* Get node iterator */
|
|
1301
|
+
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
|
1302
|
+
/* Now start iterating over the created document */
|
|
1303
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
1304
|
+
/* Sanitize tags and elements */
|
|
1305
|
+
_sanitizeElements(currentNode);
|
|
1306
|
+
/* Check attributes next */
|
|
1307
|
+
_sanitizeAttributes(currentNode);
|
|
1308
|
+
/* Shadow DOM detected, sanitize it */
|
|
1309
|
+
if (currentNode.content instanceof DocumentFragment) {
|
|
1310
|
+
_sanitizeShadowDOM(currentNode.content);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
/* If we sanitized `dirty` in-place, return it. */
|
|
1314
|
+
if (IN_PLACE) {
|
|
1315
|
+
return dirty;
|
|
1316
|
+
}
|
|
1317
|
+
/* Return sanitized string or DOM */
|
|
1318
|
+
if (RETURN_DOM) {
|
|
1319
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
1320
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
1321
|
+
while (body.firstChild) {
|
|
1322
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
1323
|
+
returnNode.appendChild(body.firstChild);
|
|
1324
|
+
}
|
|
1325
|
+
} else {
|
|
1326
|
+
returnNode = body;
|
|
1327
|
+
}
|
|
1328
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
|
1329
|
+
/*
|
|
1330
|
+
AdoptNode() is not used because internal state is not reset
|
|
1331
|
+
(e.g. the past names map of a HTMLFormElement), this is safe
|
|
1332
|
+
in theory but we would rather not risk another attack vector.
|
|
1333
|
+
The state that is cloned by importNode() is explicitly defined
|
|
1334
|
+
by the specs.
|
|
1335
|
+
*/
|
|
1336
|
+
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
1337
|
+
}
|
|
1338
|
+
return returnNode;
|
|
1339
|
+
}
|
|
1340
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
1341
|
+
/* Serialize doctype if allowed */
|
|
1342
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
1343
|
+
serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
|
|
1344
|
+
}
|
|
1345
|
+
/* Sanitize final string template-safe */
|
|
1346
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
1347
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1348
|
+
serializedHTML = stringReplace(serializedHTML, expr, ' ');
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
1352
|
+
};
|
|
1353
|
+
DOMPurify.setConfig = function () {
|
|
1354
|
+
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1355
|
+
_parseConfig(cfg);
|
|
1356
|
+
SET_CONFIG = true;
|
|
1357
|
+
};
|
|
1358
|
+
DOMPurify.clearConfig = function () {
|
|
1359
|
+
CONFIG = null;
|
|
1360
|
+
SET_CONFIG = false;
|
|
1361
|
+
};
|
|
1362
|
+
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
1363
|
+
/* Initialize shared config vars if necessary. */
|
|
1364
|
+
if (!CONFIG) {
|
|
1365
|
+
_parseConfig({});
|
|
1366
|
+
}
|
|
1367
|
+
const lcTag = transformCaseFunc(tag);
|
|
1368
|
+
const lcName = transformCaseFunc(attr);
|
|
1369
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
1370
|
+
};
|
|
1371
|
+
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
|
1372
|
+
if (typeof hookFunction !== 'function') {
|
|
1373
|
+
return;
|
|
1374
|
+
}
|
|
1375
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
1376
|
+
};
|
|
1377
|
+
DOMPurify.removeHook = function (entryPoint, hookFunction) {
|
|
1378
|
+
if (hookFunction !== undefined) {
|
|
1379
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
1380
|
+
return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
1381
|
+
}
|
|
1382
|
+
return arrayPop(hooks[entryPoint]);
|
|
1383
|
+
};
|
|
1384
|
+
DOMPurify.removeHooks = function (entryPoint) {
|
|
1385
|
+
hooks[entryPoint] = [];
|
|
1386
|
+
};
|
|
1387
|
+
DOMPurify.removeAllHooks = function () {
|
|
1388
|
+
hooks = _createHooksMap();
|
|
1389
|
+
};
|
|
1390
|
+
return DOMPurify;
|
|
1391
|
+
}
|
|
1392
|
+
var purify = createDOMPurify();
|
|
1393
|
+
|
|
1394
|
+
/** The optgroup an option sits in, or null for an ungrouped option. */
|
|
1395
|
+
function parentOptgroupOf(option) {
|
|
1396
|
+
const parent = option === null || option === void 0 ? void 0 : option.parentElement;
|
|
1397
|
+
return parent !== null && parent !== undefined && parent.tagName === 'OPTGROUP' ? parent : null;
|
|
1398
|
+
}
|
|
1399
|
+
/** A Pine icon name: letters, digits and hyphens, such as `hashtag`. Never a URL or file path. */
|
|
1400
|
+
const PINE_ICON_NAME = /^[a-z0-9-]+$/i;
|
|
1401
|
+
/**
|
|
1402
|
+
* An optgroup's `data-icon` when it's a Pine icon name, or null. One definition of a usable group
|
|
1403
|
+
* icon for every mode, checked here rather than trusting `pds-icon` to reject anything else; it is
|
|
1404
|
+
* only ever passed to `pds-icon` as `name`.
|
|
1405
|
+
*/
|
|
1406
|
+
function groupIconOf(optgroup) {
|
|
1407
|
+
return iconOf(optgroup);
|
|
1408
|
+
}
|
|
1409
|
+
/** An option's `data-icon` when it's a Pine icon name, or null; the same check as a group's. */
|
|
1410
|
+
function optionIconOf(option) {
|
|
1411
|
+
return iconOf(option);
|
|
1412
|
+
}
|
|
1413
|
+
/** Every `pds-chip` sentiment: a sentiment added to `ChipSentimentType` fails to compile until it's listed. */
|
|
1414
|
+
const BADGE_SENTIMENTS = {
|
|
1415
|
+
accent: true,
|
|
1416
|
+
brand: true,
|
|
1417
|
+
danger: true,
|
|
1418
|
+
info: true,
|
|
1419
|
+
neutral: true,
|
|
1420
|
+
solid: true,
|
|
1421
|
+
subtle: true,
|
|
1422
|
+
success: true,
|
|
1423
|
+
warning: true,
|
|
1424
|
+
};
|
|
1425
|
+
const isBadgeSentiment = (value) => value !== null && Object.prototype.hasOwnProperty.call(BADGE_SENTIMENTS, value);
|
|
1426
|
+
/**
|
|
1427
|
+
* An option's badge from its `data-badge*` attributes, or null without a label. An unknown
|
|
1428
|
+
* sentiment falls back to `neutral`, and an icon that isn't a Pine icon name is dropped: the
|
|
1429
|
+
* badge is a `pds-chip`, whose `icon` also loads URLs.
|
|
1430
|
+
*/
|
|
1431
|
+
function optionBadgeOf(option) {
|
|
1432
|
+
return badgeOf(option);
|
|
1433
|
+
}
|
|
1434
|
+
/** An optgroup's badge from its `data-badge*` attributes, or null; the same check as an option's. */
|
|
1435
|
+
function groupBadgeOf(optgroup) {
|
|
1436
|
+
return badgeOf(optgroup);
|
|
1437
|
+
}
|
|
1438
|
+
function badgeOf(element) {
|
|
1439
|
+
var _a;
|
|
1440
|
+
const label = (_a = element.getAttribute('data-badge')) === null || _a === void 0 ? void 0 : _a.trim();
|
|
1441
|
+
if (label === undefined || label === '')
|
|
1442
|
+
return null;
|
|
1443
|
+
const sentiment = element.getAttribute('data-badge-sentiment');
|
|
1444
|
+
const icon = element.getAttribute('data-badge-icon');
|
|
1445
|
+
return {
|
|
1446
|
+
label,
|
|
1447
|
+
sentiment: isBadgeSentiment(sentiment) ? sentiment : 'neutral',
|
|
1448
|
+
icon: icon !== null && PINE_ICON_NAME.test(icon) ? icon : null,
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function iconOf(element) {
|
|
1452
|
+
const icon = element.getAttribute('data-icon');
|
|
1453
|
+
return icon !== null && PINE_ICON_NAME.test(icon) ? icon : null;
|
|
1454
|
+
}
|
|
1455
|
+
/** An option is disabled by its own `disabled` or its optgroup's, as in a native select. */
|
|
1456
|
+
function isOptionDisabled(option) {
|
|
1457
|
+
var _a;
|
|
1458
|
+
if (option === null || option === undefined)
|
|
1459
|
+
return false;
|
|
1460
|
+
return option.hasAttribute('disabled') || ((_a = parentOptgroupOf(option)) === null || _a === void 0 ? void 0 : _a.hasAttribute('disabled')) === true;
|
|
1461
|
+
}
|
|
1462
|
+
/** A group with no option left to choose. It still opens, so its options can be seen. */
|
|
1463
|
+
function isGroupDisabled(group) {
|
|
1464
|
+
return group.options.every(({ option }) => isOptionDisabled(option));
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* Groups the combobox's filtered items for the panel: each optgroup becomes one entry holding its
|
|
1468
|
+
* options, and ungrouped options stay where they are. Indexes count options in list order, the
|
|
1469
|
+
* same as the inline listbox, so `data-option-index` means the same thing in every mode.
|
|
1470
|
+
*
|
|
1471
|
+
* `position`, when given, orders the entries instead: an ungrouped option or an optgroup it knows
|
|
1472
|
+
* goes where it reports, and the rest keep their place after those. Options from the `options` prop
|
|
1473
|
+
* use it, so a row the data lists between two groups is drawn between them.
|
|
1474
|
+
*/
|
|
1475
|
+
function buildPanelEntries(items, position) {
|
|
1476
|
+
const entries = [];
|
|
1477
|
+
const groups = new Map();
|
|
1478
|
+
let index = 0;
|
|
1479
|
+
items.forEach(item => {
|
|
1480
|
+
if (item.tagName !== 'OPTION')
|
|
1481
|
+
return;
|
|
1482
|
+
const option = item;
|
|
1483
|
+
const optgroup = parentOptgroupOf(option);
|
|
1484
|
+
if (optgroup !== null) {
|
|
1485
|
+
let group = groups.get(optgroup);
|
|
1486
|
+
if (!group) {
|
|
1487
|
+
group = { optgroup, label: optgroup.label, icon: groupIconOf(optgroup), badge: groupBadgeOf(optgroup), options: [] };
|
|
1488
|
+
groups.set(optgroup, group);
|
|
1489
|
+
entries.push({ kind: 'group', group });
|
|
1490
|
+
}
|
|
1491
|
+
group.options.push({ option, index: index++ });
|
|
1492
|
+
}
|
|
1493
|
+
else {
|
|
1494
|
+
entries.push({ kind: 'option', option, index: index++ });
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1497
|
+
if (position === undefined)
|
|
1498
|
+
return entries;
|
|
1499
|
+
const at = (entry) => { var _a; return (_a = position(entry.kind === 'group' ? entry.group.optgroup : entry.option)) !== null && _a !== void 0 ? _a : Infinity; };
|
|
1500
|
+
// Array.prototype.sort is stable, so entries with no position keep their order.
|
|
1501
|
+
return entries.sort((a, b) => {
|
|
1502
|
+
const [first, second] = [at(a), at(b)];
|
|
1503
|
+
return first === second ? 0 : first < second ? -1 : 1;
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
/** The label of the optgroup an option sits in, or null for an ungrouped option. */
|
|
1507
|
+
function groupLabelOf(option) {
|
|
1508
|
+
var _a, _b;
|
|
1509
|
+
return (_b = (_a = parentOptgroupOf(option)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : null;
|
|
1510
|
+
}
|
|
1511
|
+
/**
|
|
1512
|
+
* The items Up and Down move through from `current`, one tree level at a time: the panel's rows
|
|
1513
|
+
* (groups and ungrouped options), or the open group's options. Drilled into a group, its row
|
|
1514
|
+
* (drawn as the row back) comes first, above its options, as a tree draws a parent above its children.
|
|
1515
|
+
* Disabled options and groups stay in it, as the APG listbox and tree patterns advise, so they're
|
|
1516
|
+
* announced as unavailable rather than hidden from the keyboard.
|
|
1517
|
+
*/
|
|
1518
|
+
function panelColumn(entries, openGroup, current, drilledIn) {
|
|
1519
|
+
const open = openGroup === null ? undefined : findGroup(entries, openGroup);
|
|
1520
|
+
if (open !== undefined) {
|
|
1521
|
+
const options = open.options.map(({ index }) => index);
|
|
1522
|
+
if (drilledIn)
|
|
1523
|
+
return [open.optgroup, ...options];
|
|
1524
|
+
if (typeof current === 'number' && options.includes(current))
|
|
1525
|
+
return options;
|
|
1526
|
+
}
|
|
1527
|
+
return entries.map(entry => (entry.kind === 'group' ? entry.group.optgroup : entry.index));
|
|
1528
|
+
}
|
|
1529
|
+
/** The panel's group for an optgroup, if it's showing. */
|
|
1530
|
+
function findGroup(entries, optgroup) {
|
|
1531
|
+
for (const entry of entries) {
|
|
1532
|
+
if (entry.kind === 'group' && entry.group.optgroup === optgroup)
|
|
1533
|
+
return entry.group;
|
|
1534
|
+
}
|
|
1535
|
+
return undefined;
|
|
1536
|
+
}
|
|
1537
|
+
/** Moving from one group row to another waits this long, so a diagonal trip into the flyout doesn't switch groups. */
|
|
1538
|
+
const SWITCH_DELAY_MS = 120;
|
|
1539
|
+
/** Leaving a group (into the gap beside its flyout, say) waits this long before closing it. */
|
|
1540
|
+
const CLOSE_DELAY_MS = 200;
|
|
1541
|
+
/** Space between the panel's edge and the flyout: --pine-dimension-050 (4px), per the Figma frames. */
|
|
1542
|
+
const FLYOUT_GAP_PX = 4;
|
|
1543
|
+
/** How close the flyout may come to the viewport edge: --pine-dimension-100 (8px). */
|
|
1544
|
+
const VIEWPORT_PADDING_PX = 8;
|
|
1545
|
+
/** A flyout never shrinks below roughly three rows, even when little space is left. */
|
|
1546
|
+
const MIN_FLYOUT_HEIGHT_PX = 120;
|
|
1547
|
+
/**
|
|
1548
|
+
* Opens and closes a group's flyout with hover intent, and keeps the open flyout positioned beside
|
|
1549
|
+
* its group row. The flyout renders inside the row, so moving the pointer into it never leaves
|
|
1550
|
+
* the row; the delays cover the gap between panel and flyout and diagonal moves across rows.
|
|
1551
|
+
*/
|
|
1552
|
+
/**
|
|
1553
|
+
* Scrolls `el` into view inside `container` only. A flyout option needs this: the flyout is `fixed`
|
|
1554
|
+
* beside the panel but sits inside it in the DOM, so `scrollIntoView` would also scroll the panel
|
|
1555
|
+
* and the page, moving the flyout's row out from under it.
|
|
1556
|
+
*/
|
|
1557
|
+
function scrollIntoViewWithin(container, el) {
|
|
1558
|
+
const bounds = container.getBoundingClientRect();
|
|
1559
|
+
const rect = el.getBoundingClientRect();
|
|
1560
|
+
if (rect.top < bounds.top) {
|
|
1561
|
+
container.scrollTop -= bounds.top - rect.top;
|
|
1562
|
+
}
|
|
1563
|
+
else if (rect.bottom > bounds.bottom) {
|
|
1564
|
+
container.scrollTop += rect.bottom - bounds.bottom;
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
class FlyoutController {
|
|
1568
|
+
constructor(getOpenGroup, setOpenGroup) {
|
|
1569
|
+
this.getOpenGroup = getOpenGroup;
|
|
1570
|
+
this.setOpenGroup = setOpenGroup;
|
|
1571
|
+
}
|
|
1572
|
+
/** Pointer entered a group row (or its flyout, which sits inside it). */
|
|
1573
|
+
enter(label) {
|
|
1574
|
+
this.clearClose();
|
|
1575
|
+
const open = this.getOpenGroup();
|
|
1576
|
+
if (open === label) {
|
|
1577
|
+
this.clearSwitch();
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
if (open === null) {
|
|
1581
|
+
this.setOpenGroup(label);
|
|
1582
|
+
return;
|
|
1583
|
+
}
|
|
1584
|
+
this.clearSwitch();
|
|
1585
|
+
this.switchTimer = setTimeout(() => {
|
|
1586
|
+
this.switchTimer = undefined;
|
|
1587
|
+
this.setOpenGroup(label);
|
|
1588
|
+
}, SWITCH_DELAY_MS);
|
|
1589
|
+
}
|
|
1590
|
+
/** Pointer left a group row and its flyout. */
|
|
1591
|
+
leave(label) {
|
|
1592
|
+
this.clearSwitch();
|
|
1593
|
+
if (this.getOpenGroup() !== label)
|
|
1594
|
+
return;
|
|
1595
|
+
this.clearClose();
|
|
1596
|
+
this.closeTimer = setTimeout(() => {
|
|
1597
|
+
this.closeTimer = undefined;
|
|
1598
|
+
if (this.getOpenGroup() === label)
|
|
1599
|
+
this.setOpenGroup(null);
|
|
1600
|
+
}, CLOSE_DELAY_MS);
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* A click or tap on a group row opens it. It never closes it: on desktop the hover that preceded
|
|
1604
|
+
* the click has already opened it, and touch browsers fire an emulated mouseenter and then click
|
|
1605
|
+
* in the same tap. Closing happens on leaving the row or closing the panel.
|
|
1606
|
+
*/
|
|
1607
|
+
open(label) {
|
|
1608
|
+
this.clearTimers();
|
|
1609
|
+
this.setOpenGroup(label);
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Keeps `flyout` beside `row`: horizontally against the panel's edge, vertically so its first
|
|
1613
|
+
* option lines up with the row. `fixed` positioning so the panel's scrolling can't clip it,
|
|
1614
|
+
* including when the panel is portaled into a dialog.
|
|
1615
|
+
*/
|
|
1616
|
+
position(row, panel, flyout) {
|
|
1617
|
+
if (this.positionedFlyout === flyout && this.stopAutoUpdate)
|
|
1618
|
+
return;
|
|
1619
|
+
this.stopPositioning();
|
|
1620
|
+
this.positionedFlyout = flyout;
|
|
1621
|
+
const reference = {
|
|
1622
|
+
getBoundingClientRect: () => {
|
|
1623
|
+
const panelRect = panel.getBoundingClientRect();
|
|
1624
|
+
const rowRect = row.getBoundingClientRect();
|
|
1625
|
+
return {
|
|
1626
|
+
x: panelRect.x,
|
|
1627
|
+
y: rowRect.y,
|
|
1628
|
+
left: panelRect.left,
|
|
1629
|
+
right: panelRect.right,
|
|
1630
|
+
top: rowRect.top,
|
|
1631
|
+
bottom: rowRect.bottom,
|
|
1632
|
+
width: panelRect.width,
|
|
1633
|
+
height: rowRect.height,
|
|
1634
|
+
};
|
|
1635
|
+
},
|
|
1636
|
+
contextElement: row,
|
|
1637
|
+
};
|
|
1638
|
+
// The flyout's own top padding, so its first option, not its edge, lines up with the row.
|
|
1639
|
+
const flyoutPaddingTop = parseFloat(getComputedStyle(flyout).paddingTop) || 0;
|
|
1640
|
+
const update = () => computePosition(reference, flyout, {
|
|
1641
|
+
placement: 'right-start',
|
|
1642
|
+
strategy: 'fixed',
|
|
1643
|
+
middleware: [
|
|
1644
|
+
offset({ mainAxis: FLYOUT_GAP_PX, crossAxis: -flyoutPaddingTop }),
|
|
1645
|
+
flip({ fallbackPlacements: ['left-start'] }),
|
|
1646
|
+
shift({ padding: VIEWPORT_PADDING_PX }),
|
|
1647
|
+
// A long group scrolls inside the flyout instead of running off the viewport.
|
|
1648
|
+
size({
|
|
1649
|
+
padding: VIEWPORT_PADDING_PX,
|
|
1650
|
+
apply({ availableHeight }) {
|
|
1651
|
+
flyout.style.maxHeight = `${Math.max(availableHeight, MIN_FLYOUT_HEIGHT_PX)}px`;
|
|
1652
|
+
},
|
|
1653
|
+
}),
|
|
1654
|
+
// Hidden with its row when the panel scrolls the row out of view.
|
|
1655
|
+
hide({ strategy: 'referenceHidden' }),
|
|
1656
|
+
],
|
|
1657
|
+
}).then(({ x, y, middlewareData }) => {
|
|
1658
|
+
var _a;
|
|
1659
|
+
// It starts hidden (see the stylesheet) so it never flashes in the row before it's placed.
|
|
1660
|
+
Object.assign(flyout.style, {
|
|
1661
|
+
position: 'fixed',
|
|
1662
|
+
left: `${x}px`,
|
|
1663
|
+
top: `${y}px`,
|
|
1664
|
+
visibility: ((_a = middlewareData.hide) === null || _a === void 0 ? void 0 : _a.referenceHidden) === true ? 'hidden' : 'visible',
|
|
1665
|
+
});
|
|
1666
|
+
const reveal = this.pendingReveal;
|
|
1667
|
+
this.pendingReveal = undefined;
|
|
1668
|
+
if (reveal !== undefined && flyout.contains(reveal))
|
|
1669
|
+
scrollIntoViewWithin(flyout, reveal);
|
|
1670
|
+
});
|
|
1671
|
+
this.stopAutoUpdate = autoUpdate(reference, flyout, () => {
|
|
1672
|
+
void update();
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Scrolls `option` into view inside its flyout. Before the flyout's first placement its height
|
|
1677
|
+
* isn't capped yet, so the option looks visible; it's revealed again once the placement lands.
|
|
1678
|
+
*/
|
|
1679
|
+
reveal(flyout, option) {
|
|
1680
|
+
scrollIntoViewWithin(flyout, option);
|
|
1681
|
+
if (flyout.style.maxHeight === '')
|
|
1682
|
+
this.pendingReveal = option;
|
|
1683
|
+
}
|
|
1684
|
+
stopPositioning() {
|
|
1685
|
+
var _a;
|
|
1686
|
+
(_a = this.stopAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1687
|
+
this.stopAutoUpdate = undefined;
|
|
1688
|
+
this.positionedFlyout = undefined;
|
|
1689
|
+
this.pendingReveal = undefined;
|
|
1690
|
+
}
|
|
1691
|
+
/** The panel closed or the component left the page. */
|
|
1692
|
+
reset() {
|
|
1693
|
+
this.clearTimers();
|
|
1694
|
+
this.stopPositioning();
|
|
1695
|
+
}
|
|
1696
|
+
clearTimers() {
|
|
1697
|
+
this.clearSwitch();
|
|
1698
|
+
this.clearClose();
|
|
1699
|
+
}
|
|
1700
|
+
clearSwitch() {
|
|
1701
|
+
if (this.switchTimer !== undefined)
|
|
1702
|
+
clearTimeout(this.switchTimer);
|
|
1703
|
+
this.switchTimer = undefined;
|
|
1704
|
+
}
|
|
1705
|
+
clearClose() {
|
|
1706
|
+
if (this.closeTimer !== undefined)
|
|
1707
|
+
clearTimeout(this.closeTimer);
|
|
1708
|
+
this.closeTimer = undefined;
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
const pdsComboboxCss = () => `:host{display:block}:host([truncate]){display:block;min-width:0}:host([aria-disabled=true]) .pds-combobox__input-icon{color:var(--pine-color-text-disabled);pointer-events:none}.pds-combobox{position:relative}.pds-combobox__label{color:var(--pine-color-text-label);display:block;font:var(--pine-typography-body-medium);letter-spacing:var(--pine-letter-spacing);-webkit-margin-after:var(--pine-dimension-2xs);margin-block-end:var(--pine-dimension-2xs)}.pds-combobox__input-wrapper{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;position:relative;width:100%}.pds-combobox__input{background:var(--pine-color-background-container);border:var(--pine-border);border-radius:var(--pine-dimension-125);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--pine-color-text-strong);-ms-flex:1;flex:1;font:var(--pine-typography-body);padding:var(--pine-dimension-xs) var(--pine-dimension-450) var(--pine-dimension-xs) var(--pine-dimension-150);-webkit-transition:border-color var(--pine-motion-duration-base) ease;transition:border-color var(--pine-motion-duration-base) ease;width:100%}.pds-combobox__input:hover:not(:disabled){border-color:var(--pine-color-border-hover)}.pds-combobox__input:disabled{background:var(--pine-color-background-container-disabled);border-color:var(--pine-color-border-disabled);color:var(--pine-color-text-disabled);cursor:not-allowed}.pds-combobox__input:disabled::-webkit-input-placeholder{color:var(--pine-color-text-placeholder-disabled)}.pds-combobox__input:disabled::-moz-placeholder{color:var(--pine-color-text-placeholder-disabled)}.pds-combobox__input:disabled:-ms-input-placeholder{color:var(--pine-color-text-placeholder-disabled)}.pds-combobox__input:disabled::-ms-input-placeholder{color:var(--pine-color-text-placeholder-disabled)}.pds-combobox__input:disabled::placeholder{color:var(--pine-color-text-placeholder-disabled)}.pds-combobox__input:focus-visible{border-color:var(--pine-color-border-active);outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-combobox__input::-webkit-input-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__input::-moz-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__input:-ms-input-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__input::-ms-input-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__input::placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__input.pds-combobox__input--invalid{background:var(--pine-color-red-050);border-color:var(--pine-color-border-danger)}:host-context([data-theme=dark]) .pds-combobox__input.pds-combobox__input--invalid{background:var(--pine-color-red-950)}.pds-combobox__input.pds-combobox__input--invalid:hover:not(:disabled){border-color:var(--pine-color-border-danger)}.pds-combobox__input.pds-combobox__input--invalid:focus-visible{outline-color:var(--pine-color-focus-ring-danger)}.pds-combobox__input-icon{color:var(--pine-color-text-secondary);inset-inline-end:var(--pine-dimension-150);pointer-events:none;position:absolute;z-index:calc(var(--pine-z-index-raised) - 1)}.pds-combobox__helper{color:var(--pine-color-text-message);font:var(--pine-typography-body-sm-medium);-webkit-margin-before:var(--pine-dimension-2xs);margin-block-start:var(--pine-dimension-2xs)}.pds-combobox__error{-ms-flex-align:start;align-items:flex-start;color:var(--pine-color-text-message-danger);display:-ms-flexbox;display:flex;font:var(--pine-typography-body-sm-medium);gap:var(--pine-dimension-2xs);-webkit-margin-before:var(--pine-dimension-2xs);margin-block-start:var(--pine-dimension-2xs)}.pds-combobox__error pds-icon{-ms-flex-negative:0;flex-shrink:0;-webkit-margin-before:var(--pine-dimension-025);margin-block-start:var(--pine-dimension-025)}.pds-combobox__listbox{--pds-combobox-open-from:calc(var(--pine-dimension-2xs) * -1);-webkit-animation:pds-combobox-open var(--pine-motion-duration-base) var(--pine-motion-easing-out);animation:pds-combobox-open var(--pine-motion-duration-base) var(--pine-motion-easing-out);background:var(--pine-color-background-overlay);border:0;border-radius:var(--pine-dimension-125);-webkit-box-shadow:var(--pine-box-shadow);box-shadow:var(--pine-box-shadow);-webkit-box-sizing:border-box;box-sizing:border-box;list-style:none;margin:0;min-width:calc(220px + var(--pine-dimension-xs) * 2);overflow-y:auto;padding:var(--pine-dimension-xs);position:absolute;width:calc(236px + var(--pine-dimension-xs) * 2);z-index:var(--pine-z-index-raised)}.pds-combobox__listbox[data-placement^=top]{--pds-combobox-open-from:var(--pine-dimension-2xs)}@-webkit-keyframes pds-combobox-open{0%{-webkit-margin-before:var(--pds-combobox-open-from);margin-block-start:var(--pds-combobox-open-from);opacity:0}40%{opacity:1}}@keyframes pds-combobox-open{0%{-webkit-margin-before:var(--pds-combobox-open-from);margin-block-start:var(--pds-combobox-open-from);opacity:0}40%{opacity:1}}.pds-combobox__option{-ms-flex-align:center;align-items:center;background:transparent;border-radius:var(--pine-dimension-xs);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body);-ms-flex-pack:justify;justify-content:space-between;padding:var(--pine-dimension-xs) var(--pine-dimension-sm);position:relative;-webkit-transition:background 0.15s;transition:background 0.15s}.pds-combobox__option:focus-visible{outline:0}.pds-combobox__option.pds-combobox__option--layout .pds-combobox__option-layout-wrapper{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;width:100%}.pds-combobox__option:last-child{-webkit-margin-after:0;margin-block-end:0}.pds-combobox__option--highlighted{background:var(--pine-color-background-muted)}.pds-combobox__option--disabled,.pds-combobox__group-row--disabled>.pds-combobox__group-row-trigger,.pds-combobox__group-back--disabled>.pds-combobox__group-back-trigger,.pds-combobox__group--disabled>.pds-combobox__group-label{color:var(--pine-color-text-disabled)}.pds-combobox__option--disabled{cursor:not-allowed}.pds-combobox__option--disabled .pds-combobox__option-chip,.pds-combobox__option--disabled .pds-combobox__option-layout-wrapper,.pds-combobox__option--disabled .pds-combobox__option-badge,.pds-combobox__group-row--disabled>.pds-combobox__group-row-trigger>.pds-combobox__group-badge,.pds-combobox__group--disabled>.pds-combobox__group-label>.pds-combobox__group-badge{opacity:0.5}.pds-combobox__option-label{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs);min-width:0;overflow-wrap:anywhere}.pds-combobox__option-icon{-ms-flex-negative:0;flex-shrink:0}.pds-combobox__option-chip{min-width:0;overflow-wrap:anywhere}.pds-combobox__listbox--truncate .pds-combobox__option-label{-ms-flex:1 1 auto;flex:1 1 auto;overflow-wrap:normal}.pds-combobox__listbox--truncate .pds-combobox__option-check{-ms-flex-negative:0;flex-shrink:0}.pds-combobox__option--with-badge{-webkit-column-gap:var(--pine-dimension-xs);-moz-column-gap:var(--pine-dimension-xs);column-gap:var(--pine-dimension-xs)}.pds-combobox__option-badge,.pds-combobox__group-badge{-ms-flex-negative:0;flex-shrink:0;isolation:isolate;margin-block:calc(var(--pine-dimension-025) * -1);-webkit-margin-start:auto;margin-inline-start:auto}.pds-combobox__option--with-badge .pds-combobox__option-check{-webkit-margin-start:calc(var(--pine-dimension-150) - var(--pine-dimension-xs));margin-inline-start:calc(var(--pine-dimension-150) - var(--pine-dimension-xs))}.pds-combobox__option-check{color:currentColor;font-size:var(--pine-dimension-150);-webkit-margin-start:var(--pine-dimension-150);margin-inline-start:var(--pine-dimension-150)}.pds-combobox__group-label{color:var(--pine-color-text-tertiary);cursor:default;font:var(--pine-typography-heading-caption);-webkit-margin-after:var(--pine-dimension-2xs);margin-block-end:var(--pine-dimension-2xs);-webkit-margin-before:var(--pine-dimension-150);margin-block-start:var(--pine-dimension-150);padding:var(--pine-dimension-2xs) var(--pine-dimension-sm);text-transform:uppercase}.pds-combobox__group-label:first-child{-webkit-margin-before:0;margin-block-start:0}.pds-combobox__group{list-style:none;-webkit-margin-before:var(--pine-dimension-150);margin-block-start:var(--pine-dimension-150)}.pds-combobox__group:first-child{-webkit-margin-before:0;margin-block-start:0}.pds-combobox__group-list{list-style:none;margin:0;padding:0}.pds-combobox__listbox--grouped .pds-combobox__group-list{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.pds-combobox__group-label--with-icon{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs)}.pds-combobox__group-icon{-ms-flex-negative:0;flex-shrink:0}.pds-combobox__group-label--with-badge{-ms-flex-align:center;align-items:center;-webkit-column-gap:var(--pine-dimension-xs);-moz-column-gap:var(--pine-dimension-xs);column-gap:var(--pine-dimension-xs);display:-ms-flexbox;display:flex}.pds-combobox__group-label-text{min-width:0;overflow-wrap:anywhere}.pds-combobox__group-label>.pds-combobox__group-badge{margin-block:calc(var(--pine-dimension-xs) * -1);text-transform:none}.pds-combobox__group-row{list-style:none;position:relative}.pds-combobox__group-row-trigger{-ms-flex-align:center;align-items:center;border-radius:var(--pine-dimension-xs);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body);gap:var(--pine-dimension-xs);-ms-flex-pack:justify;justify-content:space-between;padding:var(--pine-dimension-xs) var(--pine-dimension-150);-webkit-transition:background 0.15s;transition:background 0.15s}.pds-combobox__group-row--open>.pds-combobox__group-row-trigger,.pds-combobox__group-row--highlighted>.pds-combobox__group-row-trigger,.pds-combobox__group-back--highlighted>.pds-combobox__group-row-trigger{background:var(--pine-color-background-muted)}.pds-combobox__listbox--pointer-hover .pds-combobox__group-row-trigger:hover{background:var(--pine-color-background-muted)}.pds-combobox__listbox--drill-in,.pds-combobox__listbox--drill-out{overflow-x:hidden}.pds-combobox__listbox--drill-in,.pds-combobox__listbox--drill-out:dir(rtl),.pds-combobox__panel-search--drill-out:dir(rtl){--pds-combobox-drill-from:var(--pine-dimension-sm)}.pds-combobox__listbox--drill-out,.pds-combobox__listbox--drill-in:dir(rtl),.pds-combobox__panel-search--drill-out{--pds-combobox-drill-from:calc(var(--pine-dimension-sm) * -1)}.pds-combobox__listbox--drill-in .pds-combobox__drill-in-options>li,.pds-combobox__listbox--drill-in .pds-combobox__group-back-trigger>*,.pds-combobox__listbox--drill-out>li,.pds-combobox__panel-search--drill-out>*{-webkit-animation:pds-combobox-drill var(--pine-motion-duration-slow) var(--pine-motion-easing-out);animation:pds-combobox-drill var(--pine-motion-duration-slow) var(--pine-motion-easing-out)}@-webkit-keyframes pds-combobox-drill{from{opacity:0;-webkit-transform:translateX(var(--pds-combobox-drill-from));transform:translateX(var(--pds-combobox-drill-from))}}@keyframes pds-combobox-drill{from{opacity:0;-webkit-transform:translateX(var(--pds-combobox-drill-from));transform:translateX(var(--pds-combobox-drill-from))}}.pds-combobox__listbox--height-glide{-webkit-animation:pds-combobox-open var(--pine-motion-duration-base) var(--pine-motion-easing-out), pds-combobox-height-glide var(--pine-motion-duration-base) var(--pine-motion-easing-out);animation:pds-combobox-open var(--pine-motion-duration-base) var(--pine-motion-easing-out), pds-combobox-height-glide var(--pine-motion-duration-base) var(--pine-motion-easing-out)}.pds-combobox__listbox--height-glide,.pds-combobox__listbox--height-glide .pds-combobox__listbox-options,.pds-combobox__listbox--height-glide .pds-combobox__drill-in-options,.pds-combobox__listbox--height-hold,.pds-combobox__listbox--height-hold .pds-combobox__listbox-options,.pds-combobox__listbox--height-hold .pds-combobox__drill-in-options{overflow-y:hidden}@-webkit-keyframes pds-combobox-height-glide{from{height:var(--pds-combobox-glide-from)}to{height:var(--pds-combobox-glide-to)}}@keyframes pds-combobox-height-glide{from{height:var(--pds-combobox-glide-from)}to{height:var(--pds-combobox-glide-to)}}.pds-combobox__group-row--keyboard>.pds-combobox__group-row-trigger,.pds-combobox__group-back--keyboard>.pds-combobox__group-row-trigger,.pds-combobox__option.pds-combobox__option--keyboard{outline:var(--pine-outline-focus);outline-offset:calc(var(--pine-border-width) * -2)}.pds-combobox__group-row-label{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs);min-width:0;overflow-wrap:anywhere}.pds-combobox__group-row-caret{-ms-flex-negative:0;flex-shrink:0}.pds-combobox__listbox--grouped,.pds-combobox__flyout{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:var(--pine-dimension-2xs)}.pds-combobox__listbox--grouped .pds-combobox__option,.pds-combobox__listbox--grouped .pds-combobox__group-label{padding-inline:var(--pine-dimension-150)}.pds-combobox__listbox--grouped .pds-combobox__group-label{font:var(--pine-typography-body-sm);margin-block:0;padding-block:var(--pine-dimension-xs) var(--pine-dimension-2xs);text-transform:none}.pds-combobox__listbox--grouped .pds-combobox__group{-webkit-margin-before:0;margin-block-start:0}.pds-combobox__flyout{background:var(--pine-color-background-overlay);border-radius:var(--pine-dimension-125);-webkit-box-shadow:var(--pine-box-shadow);box-shadow:var(--pine-box-shadow);-webkit-box-sizing:border-box;box-sizing:border-box;list-style:none;margin:0;overflow-y:auto;position:fixed;visibility:hidden;width:-webkit-max-content;width:-moz-max-content;width:max-content;z-index:1}.pds-combobox__listbox.pds-combobox__listbox--grouped{min-width:calc(220px + var(--pine-dimension-2xs) * 2);width:calc(236px + var(--pine-dimension-2xs) * 2)}.pds-combobox__listbox.pds-combobox__listbox--with-search{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;min-width:220px;overflow:hidden;padding:0;width:236px}.pds-combobox__listbox-options{-ms-flex:1;flex:1;list-style:none;margin:0;min-height:0;overflow-y:auto;padding:var(--pine-dimension-xs)}.pds-combobox__listbox-options.pds-combobox__listbox--grouped{padding:var(--pine-dimension-2xs)}.pds-combobox__panel-search{-ms-flex-align:center;align-items:center;-webkit-border-after:var(--pine-border);border-block-end:var(--pine-border);border-block-end-color:var(--pine-color-border-active);display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;gap:var(--pine-dimension-xs);padding:var(--pine-dimension-150) var(--pine-dimension-sm)}.pds-combobox__panel-search pds-icon{color:var(--pine-color-text-muted);-ms-flex-negative:0;flex-shrink:0}.pds-combobox__panel-search-input{background:transparent;border:0;color:var(--pine-color-text-strong);-ms-flex:1;flex:1;font:var(--pine-typography-body);letter-spacing:var(--pine-letter-spacing);min-width:0;outline:none;padding:0}.pds-combobox__panel-search-input::-webkit-input-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__panel-search-input::-moz-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__panel-search-input:-ms-input-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__panel-search-input::-ms-input-placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__panel-search-input::placeholder{color:var(--pine-color-text-placeholder)}.pds-combobox__listbox--grouped.pds-combobox__listbox--grouped:has(>.pds-combobox__group-back){display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:0}.pds-combobox__listbox.pds-combobox__listbox--grouped:has(>.pds-combobox__group-back){min-width:220px;width:236px}.pds-combobox__group-back{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;list-style:none;min-height:0}.pds-combobox__group-back-trigger{-ms-flex-negative:0;flex-shrink:0;-ms-flex-pack:start;justify-content:flex-start}.pds-combobox__listbox-options--drilled-in:focus{outline:none}:where(.pds-combobox__listbox--grouped) .pds-combobox__group-back-trigger{background-color:var(--pine-color-background-overlay);-webkit-border-after:var(--pine-border);border-block-end:var(--pine-border);border-block-end-color:var(--pine-color-border-active);border-radius:0;color:var(--pine-color-text-secondary);font:var(--pine-typography-body);letter-spacing:var(--pine-letter-spacing);padding:var(--pine-dimension-150) var(--pine-dimension-sm);position:relative}:where(.pds-combobox__listbox--grouped) .pds-combobox__group-back-trigger .pds-combobox__group-row-caret{margin-inline:calc(var(--pine-dimension-2xs) * -1) var(--pine-dimension-2xs)}.pds-combobox__listbox--grouped .pds-combobox__group-back>.pds-combobox__group-back-trigger{isolation:isolate}.pds-combobox__listbox--grouped .pds-combobox__group-back>.pds-combobox__group-back-trigger::before{border-radius:var(--pine-dimension-xs);content:"";inset:var(--pine-dimension-2xs);position:absolute;-webkit-transition:background 0.15s;transition:background 0.15s;z-index:-1}.pds-combobox__listbox--pointer-hover.pds-combobox__listbox--grouped .pds-combobox__group-back>.pds-combobox__group-back-trigger:hover,.pds-combobox__listbox--grouped .pds-combobox__group-back--highlighted>.pds-combobox__group-back-trigger{background-color:var(--pine-color-background-overlay)}.pds-combobox__listbox--pointer-hover.pds-combobox__listbox--grouped .pds-combobox__group-back>.pds-combobox__group-back-trigger:hover::before,.pds-combobox__listbox--grouped .pds-combobox__group-back--highlighted>.pds-combobox__group-back-trigger::before{background:var(--pine-color-background-muted)}.pds-combobox__listbox--grouped .pds-combobox__group-back--keyboard>.pds-combobox__group-back-trigger{outline:none}.pds-combobox__listbox--grouped .pds-combobox__group-back--keyboard>.pds-combobox__group-back-trigger::before{outline:var(--pine-outline-focus);outline-offset:calc(var(--pine-border-width) * -2)}.pds-combobox__drill-in-options{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;list-style:none;margin:0;min-height:0;overflow-x:hidden;overflow-y:auto;padding:var(--pine-dimension-2xs)}.visually-hidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:polygon(0 0, 0 0, 0 0);clip-path:polygon(0 0, 0 0, 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pds-combobox__loading{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;padding:var(--pine-dimension-150)}.pds-combobox__empty{color:var(--pine-color-text-tertiary);padding:var(--pine-dimension-150) var(--pine-dimension-sm);text-align:center}.pds-combobox__load-more{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;padding:var(--pine-dimension-150)}:host(.pds-combobox-dropdown-portal) .pds-combobox__listbox{position:fixed;z-index:var(--pine-z-index-priority)}.pds-combobox__button-trigger{-ms-flex-align:center;align-items:center;background:var(--color-background-default, var(--pine-color-secondary));border:var(--pine-border);border-radius:var(--pine-border-radius-full);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--color-text-default, var(--pine-color-text-inverse-emphasis));cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body);-ms-flex-pack:justify;justify-content:space-between;min-height:var(--pine-dimension-450);outline:none;padding:0 var(--pine-dimension-sm);-webkit-transition:border-color 0.15s, background 0.15s, -webkit-box-shadow 0.15s;transition:border-color 0.15s, background 0.15s, -webkit-box-shadow 0.15s;transition:border-color 0.15s, box-shadow 0.15s, background 0.15s;transition:border-color 0.15s, box-shadow 0.15s, background 0.15s, -webkit-box-shadow 0.15s;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.pds-combobox__button-trigger .pds-combobox__button-trigger-layout-wrapper{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1}.pds-combobox__button-trigger .trigger-content{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;width:100%}.pds-combobox__button-trigger:focus-visible{border-color:var(--color-border-focus, var(--pine-color-border));-webkit-box-shadow:0 0 0 2px var(--color-outline, var(--pine-color-focus-ring));box-shadow:0 0 0 2px var(--color-outline, var(--pine-color-focus-ring))}.pds-combobox__button-trigger:hover{background:var(--color-background-hover, var(--pine-color-secondary-hover));border-color:var(--color-border-hover, var(--pine-color-border-hover))}.pds-combobox__button-trigger[aria-disabled=true],.pds-combobox__button-trigger:disabled{background:var(--color-background-disabled, var(--pine-color-secondary-disabled));border-color:var(--color-border-disabled, var(--pine-color-border-disabled));color:var(--color-text-disabled, var(--pine-color-text-secondary-disabled));cursor:not-allowed;opacity:0.6}.pds-combobox__button-trigger-label{color:inherit;-ms-flex:1 1 auto;flex:1 1 auto;min-width:0;overflow-wrap:anywhere;text-align:start}.pds-combobox__button-trigger-label--with-icon{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs)}.pds-combobox__button-trigger-label--value-in{-webkit-animation:pds-combobox-value-in var(--pine-motion-duration-base) var(--pine-motion-easing-out);animation:pds-combobox-value-in var(--pine-motion-duration-base) var(--pine-motion-easing-out)}@-webkit-keyframes pds-combobox-value-in{from{opacity:0}}@keyframes pds-combobox-value-in{from{opacity:0}}.pds-combobox__button-trigger-icon{block-size:var(--pine-dimension-sm);-ms-flex-negative:0;flex-shrink:0;inline-size:var(--pine-dimension-sm)}.pds-combobox__button-trigger--truncate{max-width:100%}.pds-combobox__button-trigger--truncate .pds-combobox__button-trigger-label{overflow-wrap:normal}.pds-combobox__button-trigger--truncate .pds-combobox__button-trigger-chevron{-ms-flex-negative:0;flex-shrink:0}.pds-combobox__button-trigger-text,.pds-combobox__listbox--truncate .pds-combobox__option-text{display:block;-ms-flex:1 1 auto;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pds-combobox__button-trigger--input-shape{border-radius:var(--pine-dimension-125);font:var(--pine-typography-body);letter-spacing:var(--pine-letter-spacing);min-height:var(--pine-dimension-450);padding:calc(var(--pine-dimension-xs) - var(--pine-border-width)) var(--pine-dimension-150)}.pds-combobox__button-trigger--secondary.pds-combobox__button-trigger--input-shape{--color-background-hover:var(--pine-color-secondary)}.pds-combobox__button-trigger--secondary.pds-combobox__button-trigger--input-shape:not([aria-disabled=true]) .pds-combobox__button-trigger-label--placeholder{color:var(--pine-color-text-muted)}.pds-combobox__button-trigger-chevron{color:currentColor;-webkit-margin-start:var(--pine-dimension-150);margin-inline-start:var(--pine-dimension-150)}.pds-combobox__button-trigger--primary{--color-background-default:var(--pine-color-primary);--color-background-hover:var(--pine-color-primary-hover);--color-background-disabled:var(--pine-color-primary-disabled);--color-border-default:var(--pine-color-primary);--color-border-hover:var(--pine-color-primary-hover);--color-border-disabled:var(--pine-color-primary-disabled);--color-border-focus:var(--pine-color-primary);--color-text-default:var(--pine-color-text-primary);--color-text-disabled:var(--pine-color-text-primary-disabled);--color-outline:var(--pine-color-focus-ring)}.pds-combobox__button-trigger--accent{--color-background-default:var(--pine-color-accent);--color-background-hover:var(--pine-color-accent-hover);--color-background-disabled:var(--pine-color-accent-disabled);--color-border-default:var(--pine-color-accent);--color-border-hover:var(--pine-color-accent-hover);--color-border-disabled:var(--pine-color-accent-disabled);--color-border-focus:var(--pine-color-accent);--color-text-default:var(--pine-color-text-primary);--color-text-disabled:var(--pine-color-text-accent-disabled);--color-outline:var(--pine-color-focus-ring)}.pds-combobox__button-trigger--secondary{--color-background-default:var(--pine-color-secondary);--color-background-hover:var(--pine-color-secondary-hover);--color-background-disabled:var(--pine-color-secondary-disabled);--color-border-default:var(--pine-color-border);--color-border-hover:var(--pine-color-border-hover);--color-border-disabled:var(--pine-color-border-disabled);--color-border-focus:var(--pine-color-border);--color-text-default:var(--pine-color-text-secondary);--color-text-disabled:var(--pine-color-text-secondary-disabled);--color-outline:var(--pine-color-focus-ring)}.pds-combobox__button-trigger--destructive{--color-background-default:var(--pine-color-danger);--color-background-hover:var(--pine-color-danger-hover);--color-background-disabled:var(--pine-color-danger-disabled);--color-border-default:var(--pine-color-danger);--color-border-hover:var(--pine-color-danger-hover);--color-border-disabled:var(--pine-color-danger-disabled);--color-border-focus:var(--pine-color-danger);--color-text-default:var(--pine-color-white);--color-text-disabled:var(--pine-color-text-danger-disabled);--color-outline:var(--pine-color-focus-ring-danger)}[data-layout]{border-radius:var(--pine-dimension-125);padding-block:var(--pine-dimension-xs)}.pds-combobox__chip-trigger{-ms-flex-align:center;align-items:center;border-radius:var(--pine-dimension-sm);-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;font:var(--pine-typography-body-medium);-ms-flex-pack:justify;justify-content:space-between;outline:none;padding-block:var(--pine-dimension-025);padding-inline:var(--pine-dimension-150);-webkit-transition:all 0.15s ease;transition:all 0.15s ease;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.pds-combobox__chip-trigger .pds-combobox__chip-trigger-layout-wrapper{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1}.pds-combobox__chip-trigger .trigger-content{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;width:100%}.pds-combobox__chip-trigger:focus-visible{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-combobox__chip-trigger[aria-disabled=true]{cursor:not-allowed;opacity:0.6}.pds-combobox__chip-trigger-label{color:inherit;-ms-flex:1 1 auto;flex:1 1 auto;text-align:start}.pds-combobox__chip-trigger-chevron{color:currentColor;-webkit-margin-start:var(--pine-dimension-150);margin-inline-start:var(--pine-dimension-150)}.pds-combobox__chip-trigger-icon{-webkit-margin-end:var(--pine-dimension-2xs);margin-inline-end:var(--pine-dimension-2xs)}.pds-combobox__chip-trigger--neutral,.pds-combobox__chip-trigger--accent,.pds-combobox__chip-trigger--success,.pds-combobox__chip-trigger--warning,.pds-combobox__chip-trigger--danger,.pds-combobox__chip-trigger--info{background:var(--chip-bg);border:var(--pine-border-width) solid var(--chip-border);color:var(--chip-text)}.pds-combobox__chip-trigger--neutral:hover:not([aria-disabled=true]),.pds-combobox__chip-trigger--accent:hover:not([aria-disabled=true]),.pds-combobox__chip-trigger--success:hover:not([aria-disabled=true]),.pds-combobox__chip-trigger--warning:hover:not([aria-disabled=true]),.pds-combobox__chip-trigger--danger:hover:not([aria-disabled=true]),.pds-combobox__chip-trigger--info:hover:not([aria-disabled=true]){background:var(--chip-bg-hover)}.pds-combobox__chip-trigger--neutral:focus-visible,.pds-combobox__chip-trigger--accent:focus-visible,.pds-combobox__chip-trigger--success:focus-visible,.pds-combobox__chip-trigger--warning:focus-visible,.pds-combobox__chip-trigger--danger:focus-visible,.pds-combobox__chip-trigger--info:focus-visible{border-color:var(--chip-border)}.pds-combobox__chip-trigger--neutral{--chip-bg:var(--pine-chip-color-neutral);--chip-bg-hover:var(--pine-chip-color-neutral-hover);--chip-border:var(--pine-chip-color-neutral-hover);--chip-text:var(--pine-color-text-neutral)}.pds-combobox__chip-trigger--accent{--chip-bg:var(--pine-chip-color-accent);--chip-bg-hover:var(--pine-chip-color-accent-hover);--chip-border:var(--pine-chip-color-accent-hover);--chip-text:var(--pine-color-text-accent)}.pds-combobox__chip-trigger--success{--chip-bg:var(--pine-chip-color-success);--chip-bg-hover:var(--pine-chip-color-success-hover);--chip-border:var(--pine-chip-color-success-hover);--chip-text:var(--pine-color-text-success)}.pds-combobox__chip-trigger--warning{--chip-bg:var(--pine-chip-color-warning);--chip-bg-hover:var(--pine-chip-color-warning-hover);--chip-border:var(--pine-chip-color-warning-hover);--chip-text:var(--pine-color-text-warning)}.pds-combobox__chip-trigger--danger{--chip-bg:var(--pine-chip-color-danger);--chip-bg-hover:var(--pine-chip-color-danger-hover);--chip-border:var(--pine-chip-color-danger-hover);--chip-text:var(--pine-color-text-danger)}.pds-combobox__chip-trigger--info{--chip-bg:var(--pine-chip-color-info);--chip-bg-hover:var(--pine-chip-color-info-hover);--chip-border:var(--pine-chip-color-info-hover);--chip-text:var(--pine-color-text-info)}.pds-combobox__chip-trigger--brand{background:-webkit-gradient(linear, left top, right top, from(#FF3E14), to(#6B62F2));background:linear-gradient(90deg, #FF3E14 0%, #6B62F2 100%);border:0;color:var(--pine-color-text-neutral);padding:1px;position:relative}.pds-combobox__chip-trigger--brand .pds-combobox__chip-trigger-label{background:rgba(255, 255, 255, 0.9);border-radius:calc(var(--pine-dimension-sm) - 1px);color:var(--pine-color-text-neutral);font-weight:var(--pine-font-weight-medium);padding:var(--pine-dimension-025) var(--pine-dimension-150);position:relative;z-index:1}.pds-combobox__chip-trigger--brand .pds-combobox__chip-trigger-chevron{position:relative;z-index:1}.pds-combobox__chip-trigger--brand:hover:not([aria-disabled=true]) .pds-combobox__chip-trigger-label{background:rgba(255, 255, 255, 0.8)}.pds-combobox__chip-trigger--dropdown:not(.pds-combobox__chip-trigger--brand){padding:var(--pine-dimension-none)}.pds-combobox__chip-trigger--dropdown:not(.pds-combobox__chip-trigger--brand) .pds-combobox__chip-trigger-label{padding:var(--pine-dimension-025) var(--pine-dimension-150)}.pds-combobox__chip-trigger--large .pds-combobox__chip-trigger-label{font-family:var(--pine-font-family-heading);font-size:var(--pine-font-size-heading-6);font-weight:var(--pine-font-weight-medium);letter-spacing:var(--pine-letter-spacing-heading-6)}.pds-combobox__chip-trigger--dot .pds-combobox__chip-trigger-label::before{border:var(--pine-border-width) solid transparent;border-radius:var(--pine-border-radius-full);content:"";display:inline-block;height:var(--pine-dimension-2xs);-webkit-margin-end:var(--pine-dimension-2xs);margin-inline-end:var(--pine-dimension-2xs);width:var(--pine-dimension-2xs)}`;
|
|
1713
|
+
|
|
1714
|
+
const PdsCombobox = class {
|
|
1715
|
+
constructor(hostRef) {
|
|
1716
|
+
registerInstance(this, hostRef);
|
|
1717
|
+
this.pdsComboboxChange = createEvent(this, "pdsComboboxChange");
|
|
1718
|
+
this.pdsComboboxSearch = createEvent(this, "pdsComboboxSearch");
|
|
1719
|
+
this.pdsComboboxLoadOptions = createEvent(this, "pdsComboboxLoadOptions");
|
|
1720
|
+
/**
|
|
1721
|
+
* Enable custom layout content for options. Options with data-layout attribute will render their HTML content.
|
|
1722
|
+
* ⚠️ Security Warning: Only use with trusted content. Basic XSS protection is applied, but avoid user-generated content.
|
|
1723
|
+
* @default false
|
|
1724
|
+
*/
|
|
1725
|
+
this.customOptionLayouts = false;
|
|
1726
|
+
/**
|
|
1727
|
+
* Enable custom layout content for the button trigger via the trigger-content slot.
|
|
1728
|
+
* When true, uses slot content for initial state but updates dynamically with selected option layout.
|
|
1729
|
+
* ⚠️ Security Warning: Only use with trusted content. Basic XSS protection is applied, but avoid user-generated content.
|
|
1730
|
+
* @default false
|
|
1731
|
+
*/
|
|
1732
|
+
this.customTriggerContent = false;
|
|
1733
|
+
/**
|
|
1734
|
+
* If true, the combobox is disabled.
|
|
1735
|
+
*/
|
|
1736
|
+
this.disabled = false;
|
|
1737
|
+
/**
|
|
1738
|
+
* Placement of the dropdown relative to the trigger.
|
|
1739
|
+
* @default 'bottom-start'
|
|
1740
|
+
*/
|
|
1741
|
+
this.dropdownPlacement = 'bottom-start';
|
|
1742
|
+
/**
|
|
1743
|
+
* Where to mount the dropdown listbox (`host` or `body`, sometimes called “append to body”).
|
|
1744
|
+
* Use `body` inside scrollable containers (for example modals) so the list is not clipped by
|
|
1745
|
+
* `overflow: hidden` ancestors. The portal is appended to the nearest `<dialog>` when present
|
|
1746
|
+
* (including `pds-modal` / `showModal()`), using a composed ascent so shadow DOM and slot
|
|
1747
|
+
* boundaries do not hide the dialog from discovery; otherwise it is appended to `document.body`.
|
|
1748
|
+
* Keyboard focus stays on the trigger, or moves to the panel's own search field, so modal focus
|
|
1749
|
+
* traps keep working. The mounted dropdown renders in its own shadow root with the combobox's
|
|
1750
|
+
* styles, so it needs no global CSS and page CSS can't reach it: customize it with custom
|
|
1751
|
+
* properties on `pds-combobox`. Its reading direction, language, theme and custom properties are
|
|
1752
|
+
* taken from the combobox when it opens. Custom `empty` and `loading` slots are not supported when
|
|
1753
|
+
* `body` is used; the default empty and loading content is shown instead.
|
|
1754
|
+
* @default 'host'
|
|
1755
|
+
*/
|
|
1756
|
+
this.dropdownMount = 'host';
|
|
1757
|
+
/**
|
|
1758
|
+
* Accessible prefix for the row that returns to the group list when `group-display` is
|
|
1759
|
+
* `drill-in`, read before the open group's label. Pass a translated string to localize it; defaults to English.
|
|
1760
|
+
* @defaultValue 'Back'
|
|
1761
|
+
*/
|
|
1762
|
+
this.drillInBackLabel = 'Back';
|
|
1763
|
+
/**
|
|
1764
|
+
* Text shown when no options match the search. Pass a translated string to localize it; defaults to English.
|
|
1765
|
+
* @defaultValue 'No options found'
|
|
1766
|
+
*/
|
|
1767
|
+
this.noOptionsFoundLabel = 'No options found';
|
|
1768
|
+
/**
|
|
1769
|
+
* Maximum width of a group's flyout when `group-display` is `flyout`. Any valid CSS width
|
|
1770
|
+
* value, including its padding.
|
|
1771
|
+
* @default '388px'
|
|
1772
|
+
*/
|
|
1773
|
+
this.flyoutMaxWidth = '388px';
|
|
1774
|
+
/**
|
|
1775
|
+
* Minimum width of a group's flyout when `group-display` is `flyout`. Any valid CSS width
|
|
1776
|
+
* value, including its padding. The flyout is as wide as its options, between this and
|
|
1777
|
+
* `flyout-max-width`.
|
|
1778
|
+
* @default '288px'
|
|
1779
|
+
*/
|
|
1780
|
+
this.flyoutMinWidth = '288px';
|
|
1781
|
+
/**
|
|
1782
|
+
* How option groups (`<optgroup>`, or the `group` field of `options`) are shown in the dropdown.
|
|
1783
|
+
* `inline` lists each group's label above its options. `flyout` lists the groups, and opens a
|
|
1784
|
+
* group's options in a panel beside it on hover or click; while searching, the matching options
|
|
1785
|
+
* are listed under their group labels, and search also matches group labels. `flyout` groups
|
|
1786
|
+
* by `<optgroup>` (or `group`) only: options under a `<pds-text>` heading are listed ungrouped.
|
|
1787
|
+
* `drill-in` lists the groups too, but a click replaces the list with that group's options and a
|
|
1788
|
+
* row back to the groups; use it where nothing can open beside the dropdown, such as a side
|
|
1789
|
+
* panel. `flyout` falls back to `drill-in` when there is no room for a flyout on either side.
|
|
1790
|
+
* @default 'inline'
|
|
1791
|
+
*/
|
|
1792
|
+
this.groupDisplay = 'inline';
|
|
1793
|
+
/**
|
|
1794
|
+
* Visually hides the label text for instances where only the combobox should be displayed.
|
|
1795
|
+
* The visible `<label>` is omitted (same pattern as `pds-select`) so label spacing does not reserve layout;
|
|
1796
|
+
* the trigger uses `aria-label` so the name stays available to assistive technology.
|
|
1797
|
+
*/
|
|
1798
|
+
this.hideLabel = false;
|
|
1799
|
+
/**
|
|
1800
|
+
* Determines the combobox mode: 'filter' (filter options as you type) or 'select-only' (show all options).
|
|
1801
|
+
* In filter mode, reopening the menu while the input still shows the label of the selected option temporarily lists
|
|
1802
|
+
* all options until you type (so you can switch to a different choice without clearing the field first).
|
|
1803
|
+
* @default 'filter'
|
|
1804
|
+
*/
|
|
1805
|
+
this.mode = 'filter';
|
|
1806
|
+
/**
|
|
1807
|
+
* Shows a search field at the top of the dropdown for the `button` and `chip` triggers, which
|
|
1808
|
+
* can't be typed into. Search filters the options the same way typing in the `input` trigger
|
|
1809
|
+
* does; in a grouped display it also matches group labels.
|
|
1810
|
+
* @default false
|
|
1811
|
+
*/
|
|
1812
|
+
this.panelSearch = false;
|
|
1813
|
+
/**
|
|
1814
|
+
* Accessible label for the search input inside the dropdown panel (`panel-search`). Pass a translated string to localize it; defaults to English.
|
|
1815
|
+
* @defaultValue 'Search options'
|
|
1816
|
+
*/
|
|
1817
|
+
this.searchOptionsLabel = 'Search options';
|
|
1818
|
+
/**
|
|
1819
|
+
* Placeholder text for the search input inside the dropdown panel (`panel-search`). Pass a translated string to localize it; defaults to English.
|
|
1820
|
+
* @defaultValue 'Find...'
|
|
1821
|
+
*/
|
|
1822
|
+
this.searchPlaceholder = 'Find...';
|
|
1823
|
+
/**
|
|
1824
|
+
* Determines the combobox trigger: 'input' (editable input), 'button' (button-like, non-editable), or 'chip' (chip-like, non-editable).
|
|
1825
|
+
* @default 'input'
|
|
1826
|
+
*/
|
|
1827
|
+
this.trigger = 'input';
|
|
1828
|
+
/**
|
|
1829
|
+
* Width of the trigger (button or input). Any valid CSS width value.
|
|
1830
|
+
* @default 'fit-content'
|
|
1831
|
+
*/
|
|
1832
|
+
this.triggerWidth = 'fit-content';
|
|
1833
|
+
/**
|
|
1834
|
+
* The visual variant for the button trigger. Matches Pine button variants.
|
|
1835
|
+
* @default 'secondary'
|
|
1836
|
+
*/
|
|
1837
|
+
this.triggerVariant = 'secondary';
|
|
1838
|
+
/**
|
|
1839
|
+
* The shape of the button trigger. Use 'input' to render the trigger with input-like styling
|
|
1840
|
+
* (subtle border radius, input height) for use in form or filter rows alongside PdsSelect and PdsMultiselect.
|
|
1841
|
+
* @default 'pill'
|
|
1842
|
+
*/
|
|
1843
|
+
this.triggerShape = 'pill';
|
|
1844
|
+
/**
|
|
1845
|
+
* Determines whether the button trigger's label and the option labels should truncate and display with an ellipsis.
|
|
1846
|
+
* When a label overflows, a `title` showing the full label will appear on hover.
|
|
1847
|
+
* Chip options, custom layouts and group rows aren't affected.
|
|
1848
|
+
* @defaultValue false
|
|
1849
|
+
*/
|
|
1850
|
+
this.truncate = false;
|
|
1851
|
+
/**
|
|
1852
|
+
* The sentiment for the chip trigger. Matches Pine chip sentiments.
|
|
1853
|
+
* @default 'neutral'
|
|
1854
|
+
*/
|
|
1855
|
+
this.chipSentiment = 'neutral';
|
|
1856
|
+
/**
|
|
1857
|
+
* Whether the chip trigger should be displayed in a larger size.
|
|
1858
|
+
* @default false
|
|
1859
|
+
*/
|
|
1860
|
+
this.chipLarge = false;
|
|
1861
|
+
/**
|
|
1862
|
+
* Whether a dot should be displayed on the chip trigger.
|
|
1863
|
+
* @default false
|
|
1864
|
+
*/
|
|
1865
|
+
this.chipDot = false;
|
|
1866
|
+
/**
|
|
1867
|
+
* The `value` of the selected option.
|
|
1868
|
+
*/
|
|
1869
|
+
this.value = '';
|
|
1870
|
+
/**
|
|
1871
|
+
* HTTP method for async requests.
|
|
1872
|
+
*/
|
|
1873
|
+
this.asyncMethod = 'GET';
|
|
1874
|
+
/**
|
|
1875
|
+
* Debounce delay in milliseconds for search/fetch.
|
|
1876
|
+
*/
|
|
1877
|
+
this.debounce = 300;
|
|
1878
|
+
/**
|
|
1879
|
+
* Timeout in milliseconds for async fetch requests.
|
|
1880
|
+
*/
|
|
1881
|
+
this.fetchTimeout = 30000;
|
|
1882
|
+
/**
|
|
1883
|
+
* Whether the component is currently loading async options.
|
|
1884
|
+
*/
|
|
1885
|
+
this.loading = false;
|
|
1886
|
+
/**
|
|
1887
|
+
* Internal state for the display text shown in the input/trigger
|
|
1888
|
+
*/
|
|
1889
|
+
this.displayText = '';
|
|
1890
|
+
/**
|
|
1891
|
+
* Internal state for filtered options and group labels
|
|
1892
|
+
*/
|
|
1893
|
+
this.filteredItems = [];
|
|
1894
|
+
/**
|
|
1895
|
+
* Internal state for the currently highlighted option index
|
|
1896
|
+
*/
|
|
1897
|
+
this.highlightedIndex = -1;
|
|
1898
|
+
/**
|
|
1899
|
+
* Internal state for dropdown open/close
|
|
1900
|
+
*/
|
|
1901
|
+
this.isOpen = false;
|
|
1902
|
+
/**
|
|
1903
|
+
* The optgroup whose flyout is open, when `groupDisplay` is `flyout`.
|
|
1904
|
+
*/
|
|
1905
|
+
this.openGroup = null;
|
|
1906
|
+
/**
|
|
1907
|
+
* Which way drill-in just moved, so the list slides that way: `in` to a group, `out` back to the
|
|
1908
|
+
* groups. Cleared once the slide ends, so later renders don't animate.
|
|
1909
|
+
*/
|
|
1910
|
+
this.drillDirection = null;
|
|
1911
|
+
/**
|
|
1912
|
+
* The group row highlighted in the grouped panel. It counts only while no option is
|
|
1913
|
+
* highlighted (`highlightedIndex` is -1); see `highlightedGroupRow`.
|
|
1914
|
+
*/
|
|
1915
|
+
this.highlightedGroup = null;
|
|
1916
|
+
/** The keys, not the pointer, moved the highlight last; the focus ring shows only then. */
|
|
1917
|
+
this.keyboardNavigating = false;
|
|
1918
|
+
/**
|
|
1919
|
+
* A drill-in group row the first arrow showed rather than moved past. `aria-activedescendant`
|
|
1920
|
+
* already pointed at it, so the status region says it instead.
|
|
1921
|
+
*/
|
|
1922
|
+
this.revealedGroupLabel = null;
|
|
1923
|
+
/**
|
|
1924
|
+
* The pointer in the panel can hover: a mouse or pen, not touch. Touch browsers keep a tapped row
|
|
1925
|
+
* hovered, so group rows shade on `:hover` only for a pointer that can hover. Checked on the
|
|
1926
|
+
* pointer itself rather than `(hover: hover)`, which a touch-first device with a trackpad fails.
|
|
1927
|
+
*/
|
|
1928
|
+
this.pointerCanHover = true;
|
|
1929
|
+
/**
|
|
1930
|
+
* What's typed in the dropdown's own search field (`panelSearch`).
|
|
1931
|
+
*/
|
|
1932
|
+
this.panelQuery = '';
|
|
1933
|
+
/**
|
|
1934
|
+
* `groupDisplay` is `flyout` but there's no room beside the dropdown, so groups drill in instead.
|
|
1935
|
+
*/
|
|
1936
|
+
this.flyoutFallback = false;
|
|
1937
|
+
/**
|
|
1938
|
+
* Internal state for the currently selected option
|
|
1939
|
+
*/
|
|
1940
|
+
this.selectedOption = null;
|
|
1941
|
+
/**
|
|
1942
|
+
* Internal state for the sanitized layout content of the selected option
|
|
1943
|
+
*/
|
|
1944
|
+
this.selectedOptionLayoutContent = '';
|
|
1945
|
+
/**
|
|
1946
|
+
* Internal state to track chip properties for automatic rendering
|
|
1947
|
+
*/
|
|
1948
|
+
this.selectedOptionChipProps = null;
|
|
1949
|
+
/**
|
|
1950
|
+
* Internal state for async options.
|
|
1951
|
+
*/
|
|
1952
|
+
this.internalOptions = [];
|
|
1953
|
+
/**
|
|
1954
|
+
* Internal state for current page (pagination).
|
|
1955
|
+
*/
|
|
1956
|
+
this.currentPage = 1;
|
|
1957
|
+
/**
|
|
1958
|
+
* Internal state for hasMore (pagination).
|
|
1959
|
+
*/
|
|
1960
|
+
this.hasMore = false;
|
|
1961
|
+
this.optionEls = [];
|
|
1962
|
+
this.allItems = [];
|
|
1963
|
+
this.portalEl = null;
|
|
1964
|
+
/** The portal's shadow root, which holds the dropdown and a copy of the combobox's styles. */
|
|
1965
|
+
this.portalRoot = null;
|
|
1966
|
+
this.bodyPortalAutoUpdateActive = false;
|
|
1967
|
+
this.isUpdatingFromSelection = false;
|
|
1968
|
+
this.flyout = new FlyoutController(() => this.openGroup, group => {
|
|
1969
|
+
this.openGroup = group;
|
|
1970
|
+
});
|
|
1971
|
+
/** The groups in the flyout panel's last render, so a row's index finds its optgroup. */
|
|
1972
|
+
this.renderedGroups = [];
|
|
1973
|
+
/**
|
|
1974
|
+
* Where each ungrouped option and optgroup built from the `options` prop came in the data, so
|
|
1975
|
+
* the flyout and drill-in panels draw them in that order. Slotted markup is already in order.
|
|
1976
|
+
*/
|
|
1977
|
+
this.panelPositions = new WeakMap();
|
|
1978
|
+
/** Room for a flyout was checked for this open. */
|
|
1979
|
+
this.flyoutRoomChecked = false;
|
|
1980
|
+
/** The highlighted option sits in a flyout that hasn't rendered yet; focus it after the next render. */
|
|
1981
|
+
this.pendingOptionFocus = false;
|
|
1982
|
+
/** Group rows' DOM ids, stable across renders so `aria-activedescendant` can point at a row. */
|
|
1983
|
+
this.groupIds = new WeakMap();
|
|
1984
|
+
this.groupIdCount = 0;
|
|
1985
|
+
/**
|
|
1986
|
+
* In filter mode, after choosing an option the input still shows the label and would
|
|
1987
|
+
* otherwise filter the list to matching substrings only. While this flag is true,
|
|
1988
|
+
* the list shows every option until the user types (then normal filtering applies).
|
|
1989
|
+
*/
|
|
1990
|
+
this.expandFilterListWhileOpen = false;
|
|
1991
|
+
this.onHeightGlideCancel = (event) => {
|
|
1992
|
+
const panel = this.listboxEl;
|
|
1993
|
+
if (event.animationName !== 'pds-combobox-height-glide' || event.target !== panel)
|
|
1994
|
+
return;
|
|
1995
|
+
// Turning around mid-glide cancels the old glide as the new one starts; only a glide with none
|
|
1996
|
+
// left running cleans up.
|
|
1997
|
+
const running = panel.getAnimations().some(a => a.animationName === 'pds-combobox-height-glide');
|
|
1998
|
+
// A drill waiting to render glides from here next; it cleans up then.
|
|
1999
|
+
if (!running && this.drillFromHeight === undefined)
|
|
2000
|
+
this.endHeightGlide();
|
|
2001
|
+
};
|
|
2002
|
+
this.onPanelPointer = (event) => {
|
|
2003
|
+
const canHover = event.pointerType !== 'touch';
|
|
2004
|
+
if (this.pointerCanHover !== canHover)
|
|
2005
|
+
this.pointerCanHover = canHover;
|
|
2006
|
+
};
|
|
2007
|
+
this.onDrillAnimationEnd = (event) => {
|
|
2008
|
+
// Only the component's own ends (the slide by name, the glide by its target): slotted consumer
|
|
2009
|
+
// content can animate inside the list too.
|
|
2010
|
+
if (event.animationName === 'pds-combobox-drill')
|
|
2011
|
+
this.drillDirection = null;
|
|
2012
|
+
if (event.animationName === 'pds-combobox-height-glide' && event.target === this.listboxEl && this.drillFromHeight === undefined) {
|
|
2013
|
+
this.endHeightGlide();
|
|
2014
|
+
}
|
|
2015
|
+
};
|
|
2016
|
+
/** `<label for>` only works on the input trigger; for a div trigger a click on the label focuses it. */
|
|
2017
|
+
this.onLabelClick = () => {
|
|
2018
|
+
var _a;
|
|
2019
|
+
if (this.trigger !== 'input' && !this.disabled) {
|
|
2020
|
+
(_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
/** The query behind the options loaded from `async-url`. */
|
|
2024
|
+
this.lastFetchedQuery = '';
|
|
2025
|
+
this.handleInput = (e) => {
|
|
2026
|
+
const target = e.target;
|
|
2027
|
+
this.clearExpandFilterList();
|
|
2028
|
+
this.displayText = target.value;
|
|
2029
|
+
this.isOpen = true;
|
|
2030
|
+
this.filterOptions();
|
|
2031
|
+
// Emit search event for consumer-managed async
|
|
2032
|
+
this.pdsComboboxSearch.emit({ query: this.displayText });
|
|
2033
|
+
// Fetch from async URL if configured
|
|
2034
|
+
if (this.asyncUrl) {
|
|
2035
|
+
this.debouncedFetchAsyncOptions(this.displayText, 1);
|
|
2036
|
+
}
|
|
2037
|
+
setTimeout(() => this.openDropdownPositioning(), 0);
|
|
2038
|
+
};
|
|
2039
|
+
this.handleInputClick = () => {
|
|
2040
|
+
// Open dropdown when input is clicked (but not when tabbed into)
|
|
2041
|
+
if (!this.isOpen) {
|
|
2042
|
+
this.isOpen = true;
|
|
2043
|
+
this.prepareExpandFilterListOnOpen();
|
|
2044
|
+
this.filterOptions();
|
|
2045
|
+
// Trigger initial fetch if async and no options loaded yet
|
|
2046
|
+
if (this.asyncUrl && this.internalOptions.length === 0) {
|
|
2047
|
+
this.debouncedFetchAsyncOptions(this.displayText, 1);
|
|
2048
|
+
}
|
|
2049
|
+
this.setInitialHighlightedIndex();
|
|
2050
|
+
setTimeout(() => {
|
|
2051
|
+
this.openDropdownPositioning();
|
|
2052
|
+
if (this.trigger === 'input' && this.expandFilterListWhileOpen && this.inputEl) {
|
|
2053
|
+
this.inputEl.select();
|
|
2054
|
+
}
|
|
2055
|
+
}, 0);
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
this.handleKeyDown = (e) => {
|
|
2059
|
+
if (!this.isOpen && (e.key === 'ArrowDown' || e.key === 'ArrowUp' || (e.altKey && e.key === 'ArrowDown'))) {
|
|
2060
|
+
e.preventDefault();
|
|
2061
|
+
this.keyboardNavigating = true;
|
|
2062
|
+
this.isOpen = true;
|
|
2063
|
+
this.prepareExpandFilterListOnOpen();
|
|
2064
|
+
this.filterOptions();
|
|
2065
|
+
// Set highlighted index immediately for testing
|
|
2066
|
+
this.setInitialHighlightedIndex();
|
|
2067
|
+
setTimeout(() => {
|
|
2068
|
+
this.openDropdownPositioning();
|
|
2069
|
+
// For input trigger, keep focus on input and use aria-activedescendant
|
|
2070
|
+
// For button trigger, move focus to first option for keyboard navigation
|
|
2071
|
+
if (this.trigger === 'input') {
|
|
2072
|
+
this.focusFirstOption();
|
|
2073
|
+
}
|
|
2074
|
+
else {
|
|
2075
|
+
this.focusFirstOptionForArrowKeys();
|
|
2076
|
+
}
|
|
2077
|
+
}, 0);
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
if (!this.isOpen) {
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
if (this.handleGroupedPanelKey(e))
|
|
2084
|
+
return;
|
|
2085
|
+
// The input trigger's text keeps Space, Home and End while the grouped panel shows.
|
|
2086
|
+
if (this.showsGroupedPanel && this.trigger === 'input' && (e.key === ' ' || e.key === 'Home' || e.key === 'End'))
|
|
2087
|
+
return;
|
|
2088
|
+
// Get only the option elements (skip group labels) for navigation
|
|
2089
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
2090
|
+
switch (e.key) {
|
|
2091
|
+
case 'ArrowDown':
|
|
2092
|
+
e.preventDefault();
|
|
2093
|
+
// If no option is highlighted, start at the first
|
|
2094
|
+
this.highlightOptionAt(selectableOptions, this.highlightedIndex < 0 ? 0 : this.highlightedIndex + 1);
|
|
2095
|
+
break;
|
|
2096
|
+
case 'ArrowUp':
|
|
2097
|
+
e.preventDefault();
|
|
2098
|
+
// If no option is highlighted, start at the last
|
|
2099
|
+
this.highlightOptionAt(selectableOptions, this.highlightedIndex < 0 ? selectableOptions.length - 1 : this.highlightedIndex - 1);
|
|
2100
|
+
break;
|
|
2101
|
+
case 'Home':
|
|
2102
|
+
e.preventDefault();
|
|
2103
|
+
this.highlightOptionAt(selectableOptions, 0);
|
|
2104
|
+
break;
|
|
2105
|
+
case 'End':
|
|
2106
|
+
e.preventDefault();
|
|
2107
|
+
this.highlightOptionAt(selectableOptions, selectableOptions.length - 1);
|
|
2108
|
+
break;
|
|
2109
|
+
case 'PageDown':
|
|
2110
|
+
e.preventDefault();
|
|
2111
|
+
this.highlightOptionAt(selectableOptions, this.highlightedIndex + 10);
|
|
2112
|
+
break;
|
|
2113
|
+
case 'PageUp':
|
|
2114
|
+
e.preventDefault();
|
|
2115
|
+
this.highlightOptionAt(selectableOptions, this.highlightedIndex - 10);
|
|
2116
|
+
break;
|
|
2117
|
+
case 'Enter':
|
|
2118
|
+
case ' ': {
|
|
2119
|
+
e.preventDefault();
|
|
2120
|
+
// An option in a flyout the pointer has since closed isn't on screen; don't choose it.
|
|
2121
|
+
if (this.showsGroupedPanel && this.activeDescendantId === undefined)
|
|
2122
|
+
break;
|
|
2123
|
+
const option = selectableOptions[this.highlightedIndex];
|
|
2124
|
+
if (option !== undefined && !isOptionDisabled(option)) {
|
|
2125
|
+
this.handleOptionClick(option);
|
|
2126
|
+
this.restoreFocusToTrigger();
|
|
2127
|
+
}
|
|
2128
|
+
break;
|
|
2129
|
+
}
|
|
2130
|
+
case 'Escape':
|
|
2131
|
+
e.preventDefault();
|
|
2132
|
+
this.isOpen = false;
|
|
2133
|
+
this.highlightedIndex = -1;
|
|
2134
|
+
this.clearExpandFilterList();
|
|
2135
|
+
this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
|
|
2136
|
+
this.restoreFocusToTrigger();
|
|
2137
|
+
break;
|
|
2138
|
+
case 'Tab':
|
|
2139
|
+
// Allow normal tab behavior to close dropdown and move focus
|
|
2140
|
+
this.isOpen = false;
|
|
2141
|
+
this.highlightedIndex = -1;
|
|
2142
|
+
this.clearExpandFilterList();
|
|
2143
|
+
this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
|
|
2144
|
+
break;
|
|
2145
|
+
}
|
|
2146
|
+
};
|
|
2147
|
+
// Track if we're in arrow-key navigation mode (focus should move between options)
|
|
2148
|
+
this.isArrowKeyNavigationMode = false;
|
|
2149
|
+
// Event handler for option click
|
|
2150
|
+
this.onOptionClick = (event) => {
|
|
2151
|
+
const idx = Number(event.currentTarget.getAttribute('data-option-index'));
|
|
2152
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
2153
|
+
const option = selectableOptions[idx];
|
|
2154
|
+
if (isOptionDisabled(option))
|
|
2155
|
+
return;
|
|
2156
|
+
this.handleOptionClick(option);
|
|
2157
|
+
// The search field closes with the panel; send focus back to the trigger instead of losing it.
|
|
2158
|
+
// (Enter and Space already restore focus in the key handler.)
|
|
2159
|
+
if (this.usesPanelSearch)
|
|
2160
|
+
this.restoreFocusToTrigger();
|
|
2161
|
+
};
|
|
2162
|
+
this.onButtonTriggerMouseEnter = (event) => {
|
|
2163
|
+
this.syncTitle(event.currentTarget, '.pds-combobox__button-trigger-text');
|
|
2164
|
+
};
|
|
2165
|
+
// Event handler for mouse enter on option
|
|
2166
|
+
this.onOptionMouseEnter = (event) => {
|
|
2167
|
+
const row = event.currentTarget;
|
|
2168
|
+
if (this.truncate)
|
|
2169
|
+
this.syncTitle(row, '.pds-combobox__option-text');
|
|
2170
|
+
this.highlightedIndex = Number(row.getAttribute('data-option-index'));
|
|
2171
|
+
this.keyboardNavigating = false;
|
|
2172
|
+
};
|
|
2173
|
+
this.onGroupRowMouseEnter = (event) => {
|
|
2174
|
+
const group = this.groupFromEvent(event);
|
|
2175
|
+
if (group !== null)
|
|
2176
|
+
this.flyout.enter(group);
|
|
2177
|
+
};
|
|
2178
|
+
this.onGroupRowMouseLeave = (event) => {
|
|
2179
|
+
const group = this.groupFromEvent(event);
|
|
2180
|
+
if (group !== null)
|
|
2181
|
+
this.flyout.leave(group);
|
|
2182
|
+
};
|
|
2183
|
+
// The pointer highlights a group's row as it does an option, so the keys carry on from there.
|
|
2184
|
+
this.onGroupRowTriggerMouseEnter = (event) => {
|
|
2185
|
+
const group = this.groupFromEvent(event);
|
|
2186
|
+
if (group !== null)
|
|
2187
|
+
this.highlightGroupRowByPointer(group);
|
|
2188
|
+
};
|
|
2189
|
+
this.onGroupBackMouseEnter = () => {
|
|
2190
|
+
if (this.openGroup !== null)
|
|
2191
|
+
this.highlightGroupRowByPointer(this.openGroup);
|
|
2192
|
+
};
|
|
2193
|
+
this.onGroupRowClick = (event) => {
|
|
2194
|
+
var _a;
|
|
2195
|
+
const group = this.groupFromEvent(event);
|
|
2196
|
+
if (group === null)
|
|
2197
|
+
return;
|
|
2198
|
+
this.flyout.open(group);
|
|
2199
|
+
// Highlight the group's first option, so the arrow keys carry on from the group just opened
|
|
2200
|
+
// rather than from wherever the highlight was before.
|
|
2201
|
+
const first = (_a = this.renderedGroups.find(entry => entry.optgroup === group)) === null || _a === void 0 ? void 0 : _a.options[0];
|
|
2202
|
+
if (first !== undefined) {
|
|
2203
|
+
this.highlightedIndex = first.index;
|
|
2204
|
+
this.updateAriaActiveDescendant();
|
|
2205
|
+
}
|
|
2206
|
+
};
|
|
2207
|
+
// Prevent blur on mousedown
|
|
2208
|
+
this.onOptionMouseDown = (event) => {
|
|
2209
|
+
event.preventDefault();
|
|
2210
|
+
};
|
|
2211
|
+
// Event handler for option keyboard events
|
|
2212
|
+
this.onOptionKeyDown = (event) => {
|
|
2213
|
+
// Delegate to main keyboard handler
|
|
2214
|
+
this.handleKeyDown(event);
|
|
2215
|
+
};
|
|
2216
|
+
// Handler for button trigger click
|
|
2217
|
+
this.onButtonTriggerClick = () => {
|
|
2218
|
+
// The button and chip triggers are divs, so a click reaches them even while disabled.
|
|
2219
|
+
if (this.disabled)
|
|
2220
|
+
return;
|
|
2221
|
+
this.isOpen = !this.isOpen;
|
|
2222
|
+
if (this.isOpen) {
|
|
2223
|
+
this.prepareExpandFilterListOnOpen();
|
|
2224
|
+
this.filterOptions();
|
|
2225
|
+
this.fetchAsyncOptionsOnOpen();
|
|
2226
|
+
// Set highlighted index and prepare for keyboard navigation
|
|
2227
|
+
this.setInitialHighlightedIndex();
|
|
2228
|
+
// For button trigger, prepare for arrow-key navigation mode
|
|
2229
|
+
this.isArrowKeyNavigationMode = true;
|
|
2230
|
+
setTimeout(() => this.openDropdownPositioning(), 0);
|
|
2231
|
+
}
|
|
2232
|
+
else {
|
|
2233
|
+
// Reset navigation mode when closing
|
|
2234
|
+
this.clearExpandFilterList();
|
|
2235
|
+
this.isArrowKeyNavigationMode = false;
|
|
2236
|
+
}
|
|
2237
|
+
};
|
|
2238
|
+
// Handler for button trigger keyboard events
|
|
2239
|
+
this.onButtonTriggerKeyDown = (e) => {
|
|
2240
|
+
// Disabled takes it out of the tab order, but setFocus() or a click can still focus it.
|
|
2241
|
+
if (this.disabled) {
|
|
2242
|
+
// Keep Space from scrolling the page, as on a native disabled button.
|
|
2243
|
+
if (e.key === ' ')
|
|
2244
|
+
e.preventDefault();
|
|
2245
|
+
return;
|
|
2246
|
+
}
|
|
2247
|
+
// Escape closes an open group before the dropdown. Other keys reach the tree through handleKeyDown.
|
|
2248
|
+
if (this.isOpen && e.key === 'Escape' && this.handleGroupedPanelKey(e))
|
|
2249
|
+
return;
|
|
2250
|
+
if ((e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown' || e.key === 'ArrowUp') && !this.isOpen) {
|
|
2251
|
+
e.preventDefault();
|
|
2252
|
+
e.stopPropagation(); // Prevent the event from bubbling and triggering click
|
|
2253
|
+
this.keyboardNavigating = true;
|
|
2254
|
+
this.isOpen = true;
|
|
2255
|
+
this.prepareExpandFilterListOnOpen();
|
|
2256
|
+
this.filterOptions();
|
|
2257
|
+
this.fetchAsyncOptionsOnOpen();
|
|
2258
|
+
// Set highlighted index immediately
|
|
2259
|
+
this.setInitialHighlightedIndex();
|
|
2260
|
+
setTimeout(() => {
|
|
2261
|
+
this.openDropdownPositioning();
|
|
2262
|
+
// For all button trigger keyboard opening, focus the first option so subsequent navigation works
|
|
2263
|
+
this.focusFirstOptionForArrowKeys();
|
|
2264
|
+
}, 0);
|
|
2265
|
+
}
|
|
2266
|
+
else if (e.key === 'Escape') {
|
|
2267
|
+
// Only an open dropdown claims Escape; a closed one leaves it to a modal or popover around it.
|
|
2268
|
+
if (this.isOpen) {
|
|
2269
|
+
e.preventDefault();
|
|
2270
|
+
this.isOpen = false;
|
|
2271
|
+
this.highlightedIndex = -1;
|
|
2272
|
+
this.clearExpandFilterList();
|
|
2273
|
+
this.updateAriaActiveDescendant(); // Clear aria-activedescendant
|
|
2274
|
+
this.restoreFocusToTrigger();
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
else if (this.isOpen) {
|
|
2278
|
+
// Delegate other keys to main keyboard handler when dropdown is open
|
|
2279
|
+
this.handleKeyDown(e);
|
|
2280
|
+
}
|
|
2281
|
+
};
|
|
2282
|
+
// Handler for button trigger keyup events - prevents space key from triggering synthetic click
|
|
2283
|
+
this.onButtonTriggerKeyUp = (e) => {
|
|
2284
|
+
if (e.key === ' ') {
|
|
2285
|
+
e.preventDefault();
|
|
2286
|
+
e.stopPropagation();
|
|
2287
|
+
}
|
|
2288
|
+
};
|
|
2289
|
+
// Close dropdown when focus leaves the combobox
|
|
2290
|
+
this.onComboboxFocusOut = (event) => {
|
|
2291
|
+
var _a, _b, _c;
|
|
2292
|
+
const relatedTarget = event.relatedTarget;
|
|
2293
|
+
const isRelatedTargetInListbox = relatedTarget &&
|
|
2294
|
+
(((_a = this.listboxEl) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget)) || ((_b = this.portalEl) === null || _b === void 0 ? void 0 : _b.contains(relatedTarget)));
|
|
2295
|
+
// `contains` doesn't cross into the shadow root, where the trigger lives; with panel search,
|
|
2296
|
+
// focus leaves the search field for the trigger whenever it's clicked to close.
|
|
2297
|
+
const isRelatedTargetInCombobox = relatedTarget !== null && (this.el.contains(relatedTarget) || !!((_c = this.el.shadowRoot) === null || _c === void 0 ? void 0 : _c.contains(relatedTarget)));
|
|
2298
|
+
// Don't close if focus is moving to an option in the listbox or staying within the combobox
|
|
2299
|
+
if (!isRelatedTargetInCombobox && !isRelatedTargetInListbox) {
|
|
2300
|
+
this.isOpen = false;
|
|
2301
|
+
this.highlightedIndex = -1;
|
|
2302
|
+
this.clearExpandFilterList();
|
|
2303
|
+
this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
|
|
2304
|
+
this.updateAriaActiveDescendant(); // Clear aria-activedescendant
|
|
2305
|
+
// If there's a selected option but the display text doesn't match, restore the selected option's display text
|
|
2306
|
+
if (this.selectedOption && this.displayText !== this.getOptionLabel(this.selectedOption)) {
|
|
2307
|
+
this.displayText = this.getOptionLabel(this.selectedOption);
|
|
2308
|
+
// The @Watch('selectedOption') will handle value and form internals if needed
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
};
|
|
2312
|
+
/** A pick that fills the field from its placeholder fades in; a value it loads with doesn't. */
|
|
2313
|
+
this.fadesValueIn = false;
|
|
2314
|
+
this.handleScroll = (e) => {
|
|
2315
|
+
if (!this.asyncUrl || !this.hasMore || this.loading)
|
|
2316
|
+
return;
|
|
2317
|
+
const target = e.target;
|
|
2318
|
+
const scrollBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
|
|
2319
|
+
// Load more when near bottom (within 50px)
|
|
2320
|
+
if (scrollBottom < 50) {
|
|
2321
|
+
this.pdsComboboxLoadOptions.emit({
|
|
2322
|
+
query: this.activeQuery,
|
|
2323
|
+
page: this.currentPage + 1,
|
|
2324
|
+
});
|
|
2325
|
+
this.debouncedFetchAsyncOptions(this.activeQuery, this.currentPage + 1);
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
// A press on the panel's padding, captions or status rows keeps focus in the search field;
|
|
2329
|
+
// otherwise it would blur the field, closing a portaled panel or stranding the keys.
|
|
2330
|
+
this.onPanelMouseDown = (event) => {
|
|
2331
|
+
if (event.target !== this.panelSearchEl)
|
|
2332
|
+
event.preventDefault();
|
|
2333
|
+
};
|
|
2334
|
+
this.onPanelSearchInput = (event) => {
|
|
2335
|
+
this.setPanelQuery(event.target.value);
|
|
2336
|
+
};
|
|
2337
|
+
// Space, Home and End edit the search text rather than moving through the options.
|
|
2338
|
+
this.onPanelSearchKeyDown = (event) => {
|
|
2339
|
+
if (event.key === ' ' || event.key === 'Home' || event.key === 'End')
|
|
2340
|
+
return;
|
|
2341
|
+
if (this.handlePanelTab(event))
|
|
2342
|
+
return;
|
|
2343
|
+
this.handleKeyDown(event);
|
|
2344
|
+
};
|
|
2345
|
+
/**
|
|
2346
|
+
* Keys in the list while a drilled-in group hides the search field. Backspace, like ArrowLeft,
|
|
2347
|
+
* steps back to the groups; a character starts a search of the whole list. Characters typed
|
|
2348
|
+
* before the search field renders and takes focus still land on the list, so they add to the
|
|
2349
|
+
* query rather than starting it again.
|
|
2350
|
+
*/
|
|
2351
|
+
this.onPanelTreeKeyDown = (event) => {
|
|
2352
|
+
if (this.handlePanelTab(event))
|
|
2353
|
+
return;
|
|
2354
|
+
if (event.key === 'Backspace') {
|
|
2355
|
+
event.preventDefault();
|
|
2356
|
+
if (!this.leaveDrilledInGroup() && this.panelQuery !== '')
|
|
2357
|
+
this.setPanelQuery(this.panelQuery.slice(0, -1));
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
// AltGr (Ctrl+Alt on Windows) and Option on macOS type characters too; Meta and Ctrl alone are
|
|
2361
|
+
// shortcuts.
|
|
2362
|
+
if (event.key.length === 1 && event.key !== ' ' && !event.metaKey && (!event.ctrlKey || event.altKey)) {
|
|
2363
|
+
event.preventDefault();
|
|
2364
|
+
this.flyout.reset();
|
|
2365
|
+
// The query first, so leaving the group reads as search results, not a slide back.
|
|
2366
|
+
this.setPanelQuery(this.panelQuery + event.key);
|
|
2367
|
+
this.openGroup = null;
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
this.handleKeyDown(event);
|
|
2371
|
+
};
|
|
2372
|
+
this.onGroupBackClick = () => {
|
|
2373
|
+
this.leaveDrilledInGroup();
|
|
2374
|
+
};
|
|
2375
|
+
}
|
|
2376
|
+
connectedCallback() {
|
|
2377
|
+
// Initialize ElementInternals for form association (only once per element instance)
|
|
2378
|
+
if (this.el.attachInternals && !this.internals) {
|
|
2379
|
+
this.internals = this.el.attachInternals();
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Form Associated Custom Elements API: Called when the form is disabled
|
|
2384
|
+
*/
|
|
2385
|
+
formDisabledCallback(disabled) {
|
|
2386
|
+
// Also fires when this element's own `disabled` attribute is merely present, even as the
|
|
2387
|
+
// literal string "false" (a consumer's or React's attribute serialization can write that) —
|
|
2388
|
+
// the platform treats any value as disabled, independent of fieldset state. A real disabled
|
|
2389
|
+
// fieldset ancestor confirms this is genuinely that, not this element's own attribute.
|
|
2390
|
+
if (disabled && !this.el.closest('fieldset[disabled]'))
|
|
2391
|
+
return;
|
|
2392
|
+
this.disabled = disabled;
|
|
2393
|
+
}
|
|
2394
|
+
componentWillLoad() {
|
|
2395
|
+
this.originalSearchEmitter = this.pdsComboboxSearch;
|
|
2396
|
+
this.updateOptions();
|
|
2397
|
+
}
|
|
2398
|
+
componentDidLoad() {
|
|
2399
|
+
var _a, _b, _c;
|
|
2400
|
+
this.setupDebounce();
|
|
2401
|
+
// Check for value-based preselection if no option is selected yet
|
|
2402
|
+
if (!this.selectedOption && this.value && this.optionEls.length > 0) {
|
|
2403
|
+
const matchingOption = this.optionEls.find(opt => opt.value === this.value);
|
|
2404
|
+
if (matchingOption) {
|
|
2405
|
+
this.setSelectedOption(matchingOption);
|
|
2406
|
+
// Update the display text to show the option's text content
|
|
2407
|
+
this.displayText = this.getOptionLabel(matchingOption);
|
|
2408
|
+
// Keep this.value as the actual option value
|
|
2409
|
+
// this.value remains unchanged (already matches matchingOption.value)
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
// Initialize form value with current value
|
|
2413
|
+
this.updateFormValue((_c = (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : this.value) !== null && _c !== void 0 ? _c : '');
|
|
2414
|
+
}
|
|
2415
|
+
disconnectedCallback() {
|
|
2416
|
+
var _a;
|
|
2417
|
+
if (this.deferredPortalTeardownId !== undefined) {
|
|
2418
|
+
clearTimeout(this.deferredPortalTeardownId);
|
|
2419
|
+
this.deferredPortalTeardownId = undefined;
|
|
2420
|
+
}
|
|
2421
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
2422
|
+
cancelDebouncedEvent(this.pdsComboboxSearch);
|
|
2423
|
+
this.clearAsyncFetchState();
|
|
2424
|
+
this.removeBodyPortal();
|
|
2425
|
+
this.flyout.reset();
|
|
2426
|
+
}
|
|
2427
|
+
componentDidRender() {
|
|
2428
|
+
var _a;
|
|
2429
|
+
if (this.usesBodyPortal && this.isOpen) {
|
|
2430
|
+
this.syncBodyPortal();
|
|
2431
|
+
}
|
|
2432
|
+
// Opening places the dropdown a tick later, which can run before the dropdown has rendered and
|
|
2433
|
+
// then skips it, leaving it without its dropdown-width and max-height. Place a newly rendered
|
|
2434
|
+
// dropdown here too.
|
|
2435
|
+
if (this.isOpen && this.triggerEl && this.listboxEl && this.listboxEl !== this.placedListboxEl) {
|
|
2436
|
+
this.placedListboxEl = this.listboxEl;
|
|
2437
|
+
void this.positionDropdown();
|
|
2438
|
+
}
|
|
2439
|
+
this.glideDrillHeight();
|
|
2440
|
+
const row = (_a = this.listboxEl) === null || _a === void 0 ? void 0 : _a.querySelector('.pds-combobox__group-row--open');
|
|
2441
|
+
const flyoutEl = row === null || row === void 0 ? void 0 : row.querySelector('.pds-combobox__flyout');
|
|
2442
|
+
if (this.isOpen && this.listboxEl && row && flyoutEl) {
|
|
2443
|
+
this.flyout.position(row, this.listboxEl, flyoutEl);
|
|
2444
|
+
}
|
|
2445
|
+
else {
|
|
2446
|
+
this.flyout.stopPositioning();
|
|
2447
|
+
}
|
|
2448
|
+
if (this.pendingOptionFocus) {
|
|
2449
|
+
this.pendingOptionFocus = false;
|
|
2450
|
+
this.updateOptionFocus();
|
|
2451
|
+
}
|
|
2452
|
+
// Panel search keeps focus in the search field, or in the list while a group hides the field.
|
|
2453
|
+
const panelFocusEl = this.hidesPanelSearch ? this.panelTreeEl : this.panelSearchEl;
|
|
2454
|
+
if (this.isOpen && this.usesPanelSearch && panelFocusEl && panelFocusEl !== this.panelFocusEl) {
|
|
2455
|
+
this.focusPanel(panelFocusEl);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
// A `title` only while the text is cut, measured on hover. On the span, not the option or trigger,
|
|
2459
|
+
// so it isn't read again as their description.
|
|
2460
|
+
syncTitle(el, selector) {
|
|
2461
|
+
const text = el.querySelector(selector);
|
|
2462
|
+
if (!text)
|
|
2463
|
+
return;
|
|
2464
|
+
if (text.scrollWidth > text.clientWidth) {
|
|
2465
|
+
text.title = text.textContent || '';
|
|
2466
|
+
}
|
|
2467
|
+
else {
|
|
2468
|
+
text.removeAttribute('title');
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
/**
|
|
2472
|
+
* Scrolls just enough to show `el`, as `scrollIntoView({ block: 'nearest' })` does. In the drill-in
|
|
2473
|
+
* panel it scrolls the list alone, and never sideways: while a drill-in slide offsets a row past
|
|
2474
|
+
* the list's edge, `scrollIntoView` also scrolls the list horizontally to reach it, which eats most
|
|
2475
|
+
* of the slide. It doesn't scroll the page or a scrolling ancestor.
|
|
2476
|
+
*/
|
|
2477
|
+
scrollIntoViewNearest(el, smooth) {
|
|
2478
|
+
const behavior = smooth ? 'smooth' : 'auto';
|
|
2479
|
+
if (!this.showsGroupedPanel || this.effectiveGroupDisplay !== 'drill-in') {
|
|
2480
|
+
el.scrollIntoView({ block: 'nearest', behavior });
|
|
2481
|
+
return;
|
|
2482
|
+
}
|
|
2483
|
+
// The row back is the drilled-in header, above the scrolling options: always in view.
|
|
2484
|
+
if (el.classList.contains('pds-combobox__group-back-trigger'))
|
|
2485
|
+
return;
|
|
2486
|
+
const list = this.scrollListEl;
|
|
2487
|
+
if (!list)
|
|
2488
|
+
return;
|
|
2489
|
+
const offset = el.getBoundingClientRect().top - list.getBoundingClientRect().top - list.clientTop;
|
|
2490
|
+
const top = list.scrollTop + offset;
|
|
2491
|
+
const bottom = list.scrollTop + offset + el.offsetHeight - list.clientHeight;
|
|
2492
|
+
const target = top < list.scrollTop ? top : bottom > list.scrollTop ? bottom : null;
|
|
2493
|
+
if (target !== null)
|
|
2494
|
+
list.scrollTo({ top: target, behavior });
|
|
2495
|
+
}
|
|
2496
|
+
/**
|
|
2497
|
+
* The element that scrolls the panel's rows. Every layer is a header (the search field, or a
|
|
2498
|
+
* drilled-in group's row back) above the rows that scroll: drilled in, the group's options;
|
|
2499
|
+
* otherwise the list under the search field, or the panel itself.
|
|
2500
|
+
*/
|
|
2501
|
+
get scrollListEl() {
|
|
2502
|
+
var _a;
|
|
2503
|
+
const list = this.usesPanelSearch ? this.panelTreeEl : this.listboxEl;
|
|
2504
|
+
return (_a = list === null || list === void 0 ? void 0 : list.querySelector('.pds-combobox__group-back > .pds-combobox__drill-in-options')) !== null && _a !== void 0 ? _a : list;
|
|
2505
|
+
}
|
|
2506
|
+
focusPanel(el) {
|
|
2507
|
+
var _a, _b;
|
|
2508
|
+
this.panelFocusEl = el;
|
|
2509
|
+
// Before the dropdown is positioned it sits in the page's flow; don't scroll to it.
|
|
2510
|
+
el.focus({ preventScroll: true });
|
|
2511
|
+
// A search started by typing in the list carries its first character; type on after it.
|
|
2512
|
+
if (el === this.panelSearchEl && this.panelQuery !== '') {
|
|
2513
|
+
(_b = (_a = this.panelSearchEl).setSelectionRange) === null || _b === void 0 ? void 0 : _b.call(_a, this.panelQuery.length, this.panelQuery.length);
|
|
2514
|
+
}
|
|
2515
|
+
this.updateAriaActiveDescendant();
|
|
2516
|
+
}
|
|
2517
|
+
/** Switching display mode leaves no flyout or hover timer from the last one. */
|
|
2518
|
+
groupDisplayChanged() {
|
|
2519
|
+
this.flyout.reset();
|
|
2520
|
+
this.openGroup = null;
|
|
2521
|
+
// The reset isn't a drill-out, so it doesn't slide either.
|
|
2522
|
+
this.drillDirection = null;
|
|
2523
|
+
this.endHeightGlide();
|
|
2524
|
+
}
|
|
2525
|
+
openGroupChanged(next, previous) {
|
|
2526
|
+
this.handPanelFocusToList();
|
|
2527
|
+
this.revealedGroupLabel = null;
|
|
2528
|
+
// Only moves between the drill-in panel's views slide; search results don't.
|
|
2529
|
+
if (!this.isOpen || this.effectiveGroupDisplay !== 'drill-in' || !this.showsGroupedPanel)
|
|
2530
|
+
return;
|
|
2531
|
+
if (next !== null && previous === null)
|
|
2532
|
+
this.drillDirection = 'in';
|
|
2533
|
+
else if (next === null && previous !== null)
|
|
2534
|
+
this.drillDirection = 'out';
|
|
2535
|
+
else
|
|
2536
|
+
return;
|
|
2537
|
+
// The views differ in height; measured now, before the next one renders, so it can glide.
|
|
2538
|
+
const panel = this.listboxEl;
|
|
2539
|
+
if (!panel)
|
|
2540
|
+
return;
|
|
2541
|
+
const from = panel.getBoundingClientRect().height;
|
|
2542
|
+
this.drillFromHeight = from;
|
|
2543
|
+
// Pinned there until componentDidRender measures the new view, however late: a child component
|
|
2544
|
+
// that renders late could otherwise let the browser paint the new view at its full height first.
|
|
2545
|
+
panel.style.height = `${from}px`;
|
|
2546
|
+
panel.classList.add('pds-combobox__listbox--height-hold');
|
|
2547
|
+
this.syncPanelOverflow();
|
|
2548
|
+
}
|
|
2549
|
+
releaseHeightHold() {
|
|
2550
|
+
const panel = this.listboxEl;
|
|
2551
|
+
panel === null || panel === void 0 ? void 0 : panel.style.removeProperty('height');
|
|
2552
|
+
panel === null || panel === void 0 ? void 0 : panel.classList.remove('pds-combobox__listbox--height-hold');
|
|
2553
|
+
}
|
|
2554
|
+
/**
|
|
2555
|
+
* Hands the dropdown's height before and after a drill to the SCSS glide. Neither is known ahead,
|
|
2556
|
+
* so they're measured: CSS can't animate to the height its content turns out to be.
|
|
2557
|
+
*/
|
|
2558
|
+
glideDrillHeight() {
|
|
2559
|
+
const from = this.drillFromHeight;
|
|
2560
|
+
this.drillFromHeight = undefined;
|
|
2561
|
+
const panel = this.listboxEl;
|
|
2562
|
+
if (from === undefined || !panel)
|
|
2563
|
+
return;
|
|
2564
|
+
// A drill back mid-glide starts from where the last one is now, then measures the real height.
|
|
2565
|
+
this.releaseHeightHold();
|
|
2566
|
+
panel.classList.remove('pds-combobox__listbox--height-glide');
|
|
2567
|
+
this.syncPanelOverflow();
|
|
2568
|
+
const to = panel.getBoundingClientRect().height;
|
|
2569
|
+
if (Math.abs(to - from) < 1) {
|
|
2570
|
+
this.endHeightGlide();
|
|
2571
|
+
return;
|
|
2572
|
+
}
|
|
2573
|
+
panel.style.setProperty('--pds-combobox-glide-from', `${from}px`);
|
|
2574
|
+
panel.style.setProperty('--pds-combobox-glide-to', `${to}px`);
|
|
2575
|
+
panel.classList.add('pds-combobox__listbox--height-glide');
|
|
2576
|
+
this.syncPanelOverflow();
|
|
2577
|
+
// A glide cut short without ending (the panel hidden mid-way) still cleans up. JSX has no
|
|
2578
|
+
// `onAnimationCancel`; adding the same listener again is a no-op.
|
|
2579
|
+
panel.addEventListener('animationcancel', this.onHeightGlideCancel);
|
|
2580
|
+
}
|
|
2581
|
+
/** Ends a glide, and a drill still waiting to glide, so nothing starts once it renders. */
|
|
2582
|
+
endHeightGlide() {
|
|
2583
|
+
this.drillFromHeight = undefined;
|
|
2584
|
+
this.releaseHeightHold();
|
|
2585
|
+
const panel = this.listboxEl;
|
|
2586
|
+
panel === null || panel === void 0 ? void 0 : panel.classList.remove('pds-combobox__listbox--height-glide');
|
|
2587
|
+
this.syncPanelOverflow();
|
|
2588
|
+
panel === null || panel === void 0 ? void 0 : panel.style.removeProperty('--pds-combobox-glide-from');
|
|
2589
|
+
panel === null || panel === void 0 ? void 0 : panel.style.removeProperty('--pds-combobox-glide-to');
|
|
2590
|
+
panel === null || panel === void 0 ? void 0 : panel.removeEventListener('animationcancel', this.onHeightGlideCancel);
|
|
2591
|
+
}
|
|
2592
|
+
/**
|
|
2593
|
+
* With `max-height`, the panel's own scroll, set inline so it outranks the stylesheet: hidden under a
|
|
2594
|
+
* fixed search field, and while the height glides (so no scrollbar flashes), otherwise auto.
|
|
2595
|
+
*/
|
|
2596
|
+
syncPanelOverflow() {
|
|
2597
|
+
var _a;
|
|
2598
|
+
if (((_a = this.maxHeight) !== null && _a !== void 0 ? _a : '') === '' || !this.listboxEl)
|
|
2599
|
+
return;
|
|
2600
|
+
const gliding = this.listboxEl.classList.contains('pds-combobox__listbox--height-glide') ||
|
|
2601
|
+
this.listboxEl.classList.contains('pds-combobox__listbox--height-hold');
|
|
2602
|
+
this.listboxEl.style.overflowY = this.usesPanelSearch || gliding ? 'hidden' : 'auto';
|
|
2603
|
+
}
|
|
2604
|
+
/** A flyout with no room beside the dropdown drills in, which can hide the focused search field too. */
|
|
2605
|
+
flyoutFallbackChanged() {
|
|
2606
|
+
this.handPanelFocusToList();
|
|
2607
|
+
}
|
|
2608
|
+
/**
|
|
2609
|
+
* Drilling into a group hides the search field, so focus moves to the list before the field
|
|
2610
|
+
* unmounts: focus lost with it would leave the combobox and close the dropdown.
|
|
2611
|
+
*/
|
|
2612
|
+
handPanelFocusToList() {
|
|
2613
|
+
if (this.isOpen && this.hidesPanelSearch && this.panelTreeEl)
|
|
2614
|
+
this.focusPanel(this.panelTreeEl);
|
|
2615
|
+
}
|
|
2616
|
+
disabledChanged(disabled) {
|
|
2617
|
+
var _a, _b, _c, _d, _e;
|
|
2618
|
+
if (!disabled || !this.isOpen)
|
|
2619
|
+
return;
|
|
2620
|
+
const shadowActive = (_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) !== null && _b !== void 0 ? _b : null;
|
|
2621
|
+
const focusInDropdown = !!((_d = (_c = this.portalEl) === null || _c === void 0 ? void 0 : _c.shadowRoot) === null || _d === void 0 ? void 0 : _d.activeElement) || (!!shadowActive && !!((_e = this.listboxEl) === null || _e === void 0 ? void 0 : _e.contains(shadowActive)));
|
|
2622
|
+
this.isOpen = false;
|
|
2623
|
+
this.highlightedIndex = -1;
|
|
2624
|
+
this.isArrowKeyNavigationMode = false;
|
|
2625
|
+
this.clearExpandFilterList();
|
|
2626
|
+
this.updateAriaActiveDescendant();
|
|
2627
|
+
// Closing removes the search field or option that held focus. A button or chip trigger can still
|
|
2628
|
+
// take it (aria-disabled), so focus doesn't fall to the page; a disabled input can't, as natively.
|
|
2629
|
+
if (focusInDropdown && this.trigger !== 'input')
|
|
2630
|
+
this.restoreFocusToTrigger();
|
|
2631
|
+
}
|
|
2632
|
+
isOpenChanged(isOpen) {
|
|
2633
|
+
if (!isOpen) {
|
|
2634
|
+
this.endHeightGlide();
|
|
2635
|
+
this.revealedGroupLabel = null;
|
|
2636
|
+
this.drillDirection = null;
|
|
2637
|
+
this.openGroup = null;
|
|
2638
|
+
this.highlightedGroup = null;
|
|
2639
|
+
this.keyboardNavigating = false;
|
|
2640
|
+
this.flyout.reset();
|
|
2641
|
+
if (this.panelQuery !== '') {
|
|
2642
|
+
// The field reopens empty, so tell consumers who filter `options` from this event.
|
|
2643
|
+
this.panelQuery = '';
|
|
2644
|
+
this.pdsComboboxSearch.emit({ query: '' });
|
|
2645
|
+
}
|
|
2646
|
+
// And with `async-url`, start loading the unsearched list now, so it's ready by the reopen.
|
|
2647
|
+
if (this.usesPanelSearch && this.asyncUrl && this.lastFetchedQuery !== '') {
|
|
2648
|
+
this.debouncedFetchAsyncOptions('', 1);
|
|
2649
|
+
}
|
|
2650
|
+
this.panelFocusEl = undefined;
|
|
2651
|
+
this.flyoutRoomChecked = false;
|
|
2652
|
+
this.flyoutFallback = false;
|
|
2653
|
+
}
|
|
2654
|
+
if (isOpen && this.deferredPortalTeardownId !== undefined) {
|
|
2655
|
+
clearTimeout(this.deferredPortalTeardownId);
|
|
2656
|
+
this.deferredPortalTeardownId = undefined;
|
|
2657
|
+
}
|
|
2658
|
+
if (isOpen && this.usesBodyPortal) {
|
|
2659
|
+
// Rapid reopen can cancel deferred teardown while the portal still holds the previous
|
|
2660
|
+
// listbox node; clear portal state before the next render attaches the new listbox, and
|
|
2661
|
+
// reset Floating UI autoUpdate bookkeeping.
|
|
2662
|
+
this.removeBodyPortal();
|
|
2663
|
+
}
|
|
2664
|
+
if (!isOpen && this.usesBodyPortal) {
|
|
2665
|
+
if (this.deferredPortalTeardownId !== undefined) {
|
|
2666
|
+
clearTimeout(this.deferredPortalTeardownId);
|
|
2667
|
+
}
|
|
2668
|
+
this.deferredPortalTeardownId = setTimeout(() => {
|
|
2669
|
+
this.deferredPortalTeardownId = undefined;
|
|
2670
|
+
if (!this.el.isConnected) {
|
|
2671
|
+
return;
|
|
2672
|
+
}
|
|
2673
|
+
if (!this.isOpen) {
|
|
2674
|
+
this.removeBodyPortal();
|
|
2675
|
+
}
|
|
2676
|
+
}, 0);
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
if (!isOpen) {
|
|
2680
|
+
this.removeBodyPortal();
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
get usesBodyPortal() {
|
|
2684
|
+
return this.dropdownMount === 'body';
|
|
2685
|
+
}
|
|
2686
|
+
get labelId() {
|
|
2687
|
+
return `${this.componentId}-label`;
|
|
2688
|
+
}
|
|
2689
|
+
/** One check for "the `<label>` is rendered", so the label and the reference to it can't disagree. */
|
|
2690
|
+
get hasVisibleLabel() {
|
|
2691
|
+
return Boolean(this.label) && !this.hideLabel;
|
|
2692
|
+
}
|
|
2693
|
+
/**
|
|
2694
|
+
* The button and chip triggers are `div`s, which `<label for>` can't name, so they point at the
|
|
2695
|
+
* visible label instead. With `hide-label` there is no visible label and `aria-label` names them.
|
|
2696
|
+
* With panel search the trigger is a button, which has no value, so its own text (the selection
|
|
2697
|
+
* or placeholder) joins the label in its name.
|
|
2698
|
+
*/
|
|
2699
|
+
get triggerLabelledBy() {
|
|
2700
|
+
if (!this.hasVisibleLabel)
|
|
2701
|
+
return undefined;
|
|
2702
|
+
return this.usesPanelSearch ? `${this.labelId} ${this.componentId}` : this.labelId;
|
|
2703
|
+
}
|
|
2704
|
+
/** The div triggers' `aria-label` when the label is hidden; with panel search it names the selection too. */
|
|
2705
|
+
get triggerAriaLabel() {
|
|
2706
|
+
if (!this.hideLabel)
|
|
2707
|
+
return undefined;
|
|
2708
|
+
const shown = this.selectedLabel || this.placeholder;
|
|
2709
|
+
return this.usesPanelSearch && shown ? `${this.label}, ${shown}` : this.label;
|
|
2710
|
+
}
|
|
2711
|
+
get listboxId() {
|
|
2712
|
+
return `${this.componentId}-listbox`;
|
|
2713
|
+
}
|
|
2714
|
+
optionDomId(optionIndex) {
|
|
2715
|
+
return `${this.componentId}-option-${optionIndex}`;
|
|
2716
|
+
}
|
|
2717
|
+
groupDomId(optgroup) {
|
|
2718
|
+
let id = this.groupIds.get(optgroup);
|
|
2719
|
+
if (id === undefined) {
|
|
2720
|
+
id = `${this.componentId}-group-${this.groupIdCount++}`;
|
|
2721
|
+
this.groupIds.set(optgroup, id);
|
|
2722
|
+
}
|
|
2723
|
+
return id;
|
|
2724
|
+
}
|
|
2725
|
+
setupDebounce() {
|
|
2726
|
+
const { pdsComboboxSearch, debounce, originalSearchEmitter } = this;
|
|
2727
|
+
this.pdsComboboxSearch = debounce === undefined
|
|
2728
|
+
? originalSearchEmitter !== null && originalSearchEmitter !== void 0 ? originalSearchEmitter : pdsComboboxSearch
|
|
2729
|
+
: debounceEvent(pdsComboboxSearch, debounce);
|
|
2730
|
+
// After the swap, so an emit made while flushing goes to the new emitter, not the old one.
|
|
2731
|
+
flushDebouncedEvent(pdsComboboxSearch);
|
|
2732
|
+
}
|
|
2733
|
+
optionsChanged() {
|
|
2734
|
+
if (this.options) {
|
|
2735
|
+
this.internalOptions = [...this.options];
|
|
2736
|
+
this.updateOptionsFromAsync();
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
handleValueChange() {
|
|
2740
|
+
this.filterOptions();
|
|
2741
|
+
// Sync with form internals for form association
|
|
2742
|
+
this.updateFormValue(this.value);
|
|
2743
|
+
// Find and select option that matches the value (for external value changes)
|
|
2744
|
+
// Only do this if we're not already updating from a selection
|
|
2745
|
+
if (!this.isUpdatingFromSelection && this.value && this.optionEls.length > 0) {
|
|
2746
|
+
const currentSelectedValue = this.selectedOption ? this.selectedOption.value : null;
|
|
2747
|
+
// If the value doesn't match the currently selected option's value, we need to update
|
|
2748
|
+
if (this.value !== currentSelectedValue) {
|
|
2749
|
+
const matchingOption = this.optionEls.find(opt => opt.value === this.value);
|
|
2750
|
+
if (matchingOption) {
|
|
2751
|
+
this.isUpdatingFromSelection = true;
|
|
2752
|
+
this.setSelectedOption(matchingOption);
|
|
2753
|
+
// Update the display text to show the option's text content
|
|
2754
|
+
this.displayText = this.getOptionLabel(matchingOption);
|
|
2755
|
+
// Keep this.value as the actual option value (already correct)
|
|
2756
|
+
this.isUpdatingFromSelection = false;
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
handleSelectedOptionChange() {
|
|
2762
|
+
// Update the layout content when selected option changes
|
|
2763
|
+
this.selectedOptionLayoutContent = this.selectedOption && this.isOptionLayout(this.selectedOption)
|
|
2764
|
+
? this.getOptionLayoutContent(this.selectedOption)
|
|
2765
|
+
: '';
|
|
2766
|
+
// Update chip properties for automatic rendering when selected option changes
|
|
2767
|
+
this.selectedOptionChipProps = this.selectedOption && this.isOptionChip(this.selectedOption)
|
|
2768
|
+
? this.getOptionChipProps(this.selectedOption)
|
|
2769
|
+
: null;
|
|
2770
|
+
// Update display text when selected option changes
|
|
2771
|
+
if (this.selectedOption) {
|
|
2772
|
+
this.displayText = this.getOptionLabel(this.selectedOption);
|
|
2773
|
+
this.value = this.selectedOption.value;
|
|
2774
|
+
// Update form internals with the actual option value
|
|
2775
|
+
this.updateFormValue(this.selectedOption.value);
|
|
2776
|
+
}
|
|
2777
|
+
else {
|
|
2778
|
+
this.displayText = '';
|
|
2779
|
+
this.value = '';
|
|
2780
|
+
this.updateFormValue('');
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
updateFormValue(value) {
|
|
2784
|
+
if (isSpecTest())
|
|
2785
|
+
return;
|
|
2786
|
+
if (this.internals && this.internals.setFormValue) {
|
|
2787
|
+
this.internals.setFormValue(value);
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
clearAsyncFetchState() {
|
|
2791
|
+
var _a;
|
|
2792
|
+
if (this.fetchDebounceTimer !== undefined) {
|
|
2793
|
+
window.clearTimeout(this.fetchDebounceTimer);
|
|
2794
|
+
this.fetchDebounceTimer = undefined;
|
|
2795
|
+
}
|
|
2796
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
2797
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
2798
|
+
this.fetchTimeoutTimer = undefined;
|
|
2799
|
+
}
|
|
2800
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
2801
|
+
this.abortController = undefined;
|
|
2802
|
+
}
|
|
2803
|
+
debouncedFetchAsyncOptions(query, page = 1) {
|
|
2804
|
+
var _a;
|
|
2805
|
+
if (!this.asyncUrl)
|
|
2806
|
+
return;
|
|
2807
|
+
if (this.fetchDebounceTimer !== undefined) {
|
|
2808
|
+
window.clearTimeout(this.fetchDebounceTimer);
|
|
2809
|
+
}
|
|
2810
|
+
const delay = Math.max(0, (_a = this.debounce) !== null && _a !== void 0 ? _a : 0);
|
|
2811
|
+
this.fetchDebounceTimer = window.setTimeout(() => {
|
|
2812
|
+
this.fetchDebounceTimer = undefined;
|
|
2813
|
+
this.fetchOptions(query, page);
|
|
2814
|
+
}, delay);
|
|
2815
|
+
}
|
|
2816
|
+
async fetchOptions(query, page = 1) {
|
|
2817
|
+
var _a;
|
|
2818
|
+
if (!this.asyncUrl)
|
|
2819
|
+
return;
|
|
2820
|
+
// Abort any pending request and clear existing timeout
|
|
2821
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
2822
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
2823
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
2824
|
+
this.fetchTimeoutTimer = undefined;
|
|
2825
|
+
}
|
|
2826
|
+
this.abortController = new AbortController();
|
|
2827
|
+
this.loading = true;
|
|
2828
|
+
// Set up timeout for fetch request
|
|
2829
|
+
this.fetchTimeoutTimer = window.setTimeout(() => {
|
|
2830
|
+
var _a;
|
|
2831
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
2832
|
+
this.fetchTimeoutTimer = undefined;
|
|
2833
|
+
}, this.fetchTimeout);
|
|
2834
|
+
try {
|
|
2835
|
+
// Guard against malformed asyncUrl
|
|
2836
|
+
let url;
|
|
2837
|
+
try {
|
|
2838
|
+
url = new URL(this.asyncUrl, window.location.origin);
|
|
2839
|
+
}
|
|
2840
|
+
catch (urlError) {
|
|
2841
|
+
throw new TypeError(`Invalid asyncUrl: ${this.asyncUrl}`);
|
|
2842
|
+
}
|
|
2843
|
+
if (this.asyncMethod === 'GET') {
|
|
2844
|
+
url.searchParams.set('search', query);
|
|
2845
|
+
url.searchParams.set('page', String(page));
|
|
2846
|
+
}
|
|
2847
|
+
const response = await fetch(url.toString(), Object.assign({ method: this.asyncMethod, signal: this.abortController.signal, headers: {
|
|
2848
|
+
'Content-Type': 'application/json',
|
|
2849
|
+
'Accept': 'application/json',
|
|
2850
|
+
} }, (this.asyncMethod === 'POST' && {
|
|
2851
|
+
body: JSON.stringify({ search: query, page }),
|
|
2852
|
+
})));
|
|
2853
|
+
// Clear timeout on successful response
|
|
2854
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
2855
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
2856
|
+
this.fetchTimeoutTimer = undefined;
|
|
2857
|
+
}
|
|
2858
|
+
if (!response.ok)
|
|
2859
|
+
throw new Error('Failed to fetch options');
|
|
2860
|
+
const data = await response.json();
|
|
2861
|
+
const formattedResults = data.results.map(item => {
|
|
2862
|
+
// If formatResult is provided, use it
|
|
2863
|
+
if (this.formatResult) {
|
|
2864
|
+
return this.formatResult(item);
|
|
2865
|
+
}
|
|
2866
|
+
// Defensive check: ensure item is an object before spreading
|
|
2867
|
+
if (typeof item === 'object' && item !== null) {
|
|
2868
|
+
return Object.assign({ id: item.id, text: item.text }, item);
|
|
2869
|
+
}
|
|
2870
|
+
// Handle primitives by converting to safe shape
|
|
2871
|
+
return {
|
|
2872
|
+
id: String(item),
|
|
2873
|
+
text: String(item),
|
|
2874
|
+
};
|
|
2875
|
+
});
|
|
2876
|
+
if (page === 1) {
|
|
2877
|
+
this.internalOptions = formattedResults;
|
|
2878
|
+
// Only once its results have loaded: a failed or aborted fetch leaves the last query's.
|
|
2879
|
+
this.lastFetchedQuery = query;
|
|
2880
|
+
}
|
|
2881
|
+
else {
|
|
2882
|
+
this.internalOptions = [...this.internalOptions, ...formattedResults];
|
|
2883
|
+
}
|
|
2884
|
+
this.hasMore = data.totalCount ? this.internalOptions.length < data.totalCount : false;
|
|
2885
|
+
this.currentPage = page;
|
|
2886
|
+
// Update DOM options from async data
|
|
2887
|
+
this.updateOptionsFromAsync();
|
|
2888
|
+
}
|
|
2889
|
+
catch (error) {
|
|
2890
|
+
// Clear timeout on error
|
|
2891
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
2892
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
2893
|
+
this.fetchTimeoutTimer = undefined;
|
|
2894
|
+
}
|
|
2895
|
+
if (error.name !== 'AbortError') {
|
|
2896
|
+
console.error('PdsCombobox: Failed to fetch options', error);
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
finally {
|
|
2900
|
+
this.loading = false;
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
updateOptionsFromAsync() {
|
|
2904
|
+
var _a;
|
|
2905
|
+
if (!this.asyncUrl && !this.options)
|
|
2906
|
+
return;
|
|
2907
|
+
// Clear existing slot-based options when using async
|
|
2908
|
+
this.optionEls = [];
|
|
2909
|
+
this.allItems = [];
|
|
2910
|
+
// Create option elements from async data. Grouped options are nested in an optgroup, as
|
|
2911
|
+
// slotted markup would be, so grouping, filtering and labels work the same either way. Each
|
|
2912
|
+
// group is listed where it first appears with all of its options, even when the data
|
|
2913
|
+
// interleaves groups, so an option never renders under another group's label. Ungrouped
|
|
2914
|
+
// options come first, so none reads as part of the group above it. The flyout and drill-in
|
|
2915
|
+
// panels draw groups as rows, where that can't happen, so they keep the data's order instead.
|
|
2916
|
+
const asyncOptions = this.options || this.internalOptions;
|
|
2917
|
+
const groups = new Map();
|
|
2918
|
+
const ungrouped = [];
|
|
2919
|
+
const groupEntries = [];
|
|
2920
|
+
this.panelPositions = new WeakMap();
|
|
2921
|
+
asyncOptions.forEach((opt, position) => {
|
|
2922
|
+
const optionEl = document.createElement('option');
|
|
2923
|
+
optionEl.value = String(opt.id);
|
|
2924
|
+
optionEl.textContent = opt.text;
|
|
2925
|
+
if (opt.disabled === true)
|
|
2926
|
+
optionEl.setAttribute('disabled', '');
|
|
2927
|
+
// Only strings group an option or name an icon; anything else from JS is ignored, not coerced.
|
|
2928
|
+
if (typeof opt.icon === 'string' && opt.icon !== '')
|
|
2929
|
+
optionEl.setAttribute('data-icon', opt.icon);
|
|
2930
|
+
this.setBadgeAttributes(optionEl, opt.badge);
|
|
2931
|
+
if (typeof opt.group !== 'string' || opt.group === '') {
|
|
2932
|
+
ungrouped.push(optionEl);
|
|
2933
|
+
this.panelPositions.set(optionEl, position);
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
let optgroup = groups.get(opt.group);
|
|
2937
|
+
if (!optgroup) {
|
|
2938
|
+
optgroup = document.createElement('optgroup');
|
|
2939
|
+
optgroup.label = opt.group;
|
|
2940
|
+
groups.set(opt.group, optgroup);
|
|
2941
|
+
groupEntries.push(optgroup);
|
|
2942
|
+
this.panelPositions.set(optgroup, position);
|
|
2943
|
+
}
|
|
2944
|
+
if (!optgroup.hasAttribute('data-icon') && typeof opt.groupIcon === 'string' && opt.groupIcon !== '') {
|
|
2945
|
+
optgroup.setAttribute('data-icon', opt.groupIcon);
|
|
2946
|
+
}
|
|
2947
|
+
if (!optgroup.hasAttribute('data-badge'))
|
|
2948
|
+
this.setBadgeAttributes(optgroup, opt.groupBadge);
|
|
2949
|
+
optgroup.appendChild(optionEl);
|
|
2950
|
+
});
|
|
2951
|
+
[...ungrouped, ...groupEntries].forEach(entry => {
|
|
2952
|
+
if (entry.tagName === 'OPTGROUP') {
|
|
2953
|
+
this.allItems.push(entry);
|
|
2954
|
+
Array.from(entry.children).forEach(child => {
|
|
2955
|
+
this.optionEls.push(child);
|
|
2956
|
+
this.allItems.push(child);
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
else {
|
|
2960
|
+
this.optionEls.push(entry);
|
|
2961
|
+
this.allItems.push(entry);
|
|
2962
|
+
}
|
|
2963
|
+
});
|
|
2964
|
+
// A rebuild replaces every optgroup. Follow the open group to its new element by label, so the
|
|
2965
|
+
// flyout stays open across reloads and pagination, or close it if the group is gone. The hover
|
|
2966
|
+
// timers still hold the old element, so they're cleared either way. filterOptions, below,
|
|
2967
|
+
// resets the highlight.
|
|
2968
|
+
if (this.openGroup !== null && !groupEntries.includes(this.openGroup)) {
|
|
2969
|
+
this.flyout.reset();
|
|
2970
|
+
this.openGroup = (_a = groups.get(this.openGroup.label)) !== null && _a !== void 0 ? _a : null;
|
|
2971
|
+
}
|
|
2972
|
+
// Re-apply the selection to the rebuilt options: when `value` is set before async options have
|
|
2973
|
+
// loaded, and after any rebuild, which detaches the previously selected option element.
|
|
2974
|
+
if (this.value && (!this.selectedOption || !this.optionEls.includes(this.selectedOption))) {
|
|
2975
|
+
const matchingOption = this.optionEls.find(opt => opt.value === this.value);
|
|
2976
|
+
if (matchingOption) {
|
|
2977
|
+
// Relinking a selection keeps the same value, so it keeps any text being typed too, which
|
|
2978
|
+
// the selectedOption watcher would otherwise reset to the label.
|
|
2979
|
+
const typed = this.selectedOption ? this.displayText : undefined;
|
|
2980
|
+
this.setSelectedOption(matchingOption);
|
|
2981
|
+
if (typed !== undefined)
|
|
2982
|
+
this.displayText = typed;
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
this.filterOptions();
|
|
2986
|
+
}
|
|
2987
|
+
updateOptions() {
|
|
2988
|
+
var _a;
|
|
2989
|
+
// Skip slot-based options if using async
|
|
2990
|
+
if (this.asyncUrl || this.options) {
|
|
2991
|
+
this.updateOptionsFromAsync();
|
|
2992
|
+
return;
|
|
2993
|
+
}
|
|
2994
|
+
// Get all elements from the slot. Before the first render there's no slot yet, so read the
|
|
2995
|
+
// host's own children that it will hold (through any slot passing options on): otherwise a
|
|
2996
|
+
// combobox created with a `value`, such as a form re-rendered after a pick, paints its
|
|
2997
|
+
// placeholder for a frame, until `slotchange` finds the selected option.
|
|
2998
|
+
const slot = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot[name="option"], slot:not([name])');
|
|
2999
|
+
const allElements = slot
|
|
3000
|
+
? slot.assignedElements({ flatten: true })
|
|
3001
|
+
: Array.from(this.el.children)
|
|
3002
|
+
.filter(el => !el.getAttribute('slot'))
|
|
3003
|
+
.flatMap(el => (el.tagName === 'SLOT' ? el.assignedElements({ flatten: true }) : [el]));
|
|
3004
|
+
// Separate options from group labels and flatten optgroups
|
|
3005
|
+
this.allItems = [];
|
|
3006
|
+
this.optionEls = [];
|
|
3007
|
+
allElements.forEach(el => {
|
|
3008
|
+
if (el.tagName === 'OPTION') {
|
|
3009
|
+
this.optionEls.push(el);
|
|
3010
|
+
this.allItems.push(el);
|
|
3011
|
+
}
|
|
3012
|
+
else if (el.tagName === 'OPTGROUP') {
|
|
3013
|
+
const optgroup = el;
|
|
3014
|
+
this.allItems.push(optgroup);
|
|
3015
|
+
// Add optgroup children (options)
|
|
3016
|
+
Array.from(optgroup.children).forEach(child => {
|
|
3017
|
+
if (child.tagName === 'OPTION') {
|
|
3018
|
+
this.optionEls.push(child);
|
|
3019
|
+
this.allItems.push(child);
|
|
3020
|
+
}
|
|
3021
|
+
});
|
|
3022
|
+
}
|
|
3023
|
+
else if (el.tagName === 'PDS-TEXT') {
|
|
3024
|
+
this.allItems.push(el);
|
|
3025
|
+
}
|
|
3026
|
+
});
|
|
3027
|
+
// Set initial selected option based on value property
|
|
3028
|
+
let initialSelected = null;
|
|
3029
|
+
// Check if value property matches any option
|
|
3030
|
+
if (this.value) {
|
|
3031
|
+
initialSelected = this.optionEls.find(opt => opt.value === this.value) || null;
|
|
3032
|
+
if (initialSelected) {
|
|
3033
|
+
// Update the display text to show the option's text content
|
|
3034
|
+
this.displayText = this.getOptionLabel(initialSelected);
|
|
3035
|
+
// Keep this.value as the actual option value (already correct)
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
// For chip triggers, ensure we always have a selected option
|
|
3039
|
+
const firstEnabled = this.optionEls.find(opt => !isOptionDisabled(opt));
|
|
3040
|
+
if (initialSelected === null && this.trigger === 'chip' && firstEnabled !== undefined) {
|
|
3041
|
+
initialSelected = firstEnabled;
|
|
3042
|
+
this.value = initialSelected.value;
|
|
3043
|
+
this.displayText = this.getOptionLabel(initialSelected);
|
|
3044
|
+
console.warn('PDS Combobox: Chip triggers should always have a selected option. Automatically selected the first enabled option.');
|
|
3045
|
+
}
|
|
3046
|
+
// Update selection if we found a different selected option or if we don't have one
|
|
3047
|
+
if (initialSelected && initialSelected !== this.selectedOption) {
|
|
3048
|
+
this.setSelectedOption(initialSelected);
|
|
3049
|
+
}
|
|
3050
|
+
else if (!this.selectedOption && initialSelected) {
|
|
3051
|
+
this.setSelectedOption(initialSelected);
|
|
3052
|
+
}
|
|
3053
|
+
this.filterOptions();
|
|
3054
|
+
}
|
|
3055
|
+
// Helper method to get option label, falling back to text content if no label attribute
|
|
3056
|
+
getOptionLabel(option) {
|
|
3057
|
+
return option.label || option.textContent || '';
|
|
3058
|
+
}
|
|
3059
|
+
// Helper method to get option layout content
|
|
3060
|
+
getOptionLayoutContent(option) {
|
|
3061
|
+
return this.sanitizeHtml(option.innerHTML || '');
|
|
3062
|
+
}
|
|
3063
|
+
// HTML sanitization using DOMPurify library to prevent XSS attacks
|
|
3064
|
+
sanitizeHtml(html) {
|
|
3065
|
+
// Configure DOMPurify to allow Pine Design System components while removing dangerous content
|
|
3066
|
+
const config = {
|
|
3067
|
+
// Allow all custom elements (including pds-* components)
|
|
3068
|
+
CUSTOM_ELEMENT_HANDLING: {
|
|
3069
|
+
tagNameCheck: (tagName) => {
|
|
3070
|
+
// Allow all pds-* tags and standard safe HTML tags
|
|
3071
|
+
return tagName.startsWith('pds-') || /^[a-z]+$/i.test(tagName);
|
|
3072
|
+
},
|
|
3073
|
+
attributeNameCheck: (attr) => {
|
|
3074
|
+
// Allow standard HTML attributes, data-* attributes, and Pine component attributes
|
|
3075
|
+
return /^[a-zA-Z][a-zA-Z0-9-]*$/.test(attr) || attr.startsWith('data-') || attr.startsWith('aria-');
|
|
3076
|
+
},
|
|
3077
|
+
allowCustomizedBuiltInElements: false,
|
|
3078
|
+
},
|
|
3079
|
+
// Allow standard safe attributes
|
|
3080
|
+
ALLOW_DATA_ATTR: true,
|
|
3081
|
+
ALLOW_ARIA_ATTR: true,
|
|
3082
|
+
// Specifically forbid dangerous tags
|
|
3083
|
+
FORBID_TAGS: ['script', 'iframe', 'object', 'embed', 'form', 'input', 'textarea', 'select', 'button', 'style'],
|
|
3084
|
+
// Forbid all event handler attributes
|
|
3085
|
+
FORBID_ATTR: [
|
|
3086
|
+
'onerror', 'onload', 'onclick', 'onmouseover', 'onmouseout', 'onmousemove',
|
|
3087
|
+
'onfocus', 'onblur', 'onchange', 'onsubmit', 'onkeydown', 'onkeyup', 'onkeypress',
|
|
3088
|
+
'onmousedown', 'onmouseup', 'ondblclick', 'oncontextmenu', 'onscroll'
|
|
3089
|
+
],
|
|
3090
|
+
// Safe protocol whitelist
|
|
3091
|
+
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,
|
|
3092
|
+
};
|
|
3093
|
+
return purify.sanitize(html, config);
|
|
3094
|
+
}
|
|
3095
|
+
// Helper method to check if option should render as layout
|
|
3096
|
+
isOptionLayout(option) {
|
|
3097
|
+
return this.customOptionLayouts && option.hasAttribute('data-layout');
|
|
3098
|
+
}
|
|
3099
|
+
// Helper method to check if option has chip attributes (new automatic approach)
|
|
3100
|
+
isOptionChip(option) {
|
|
3101
|
+
return option.hasAttribute('chip-sentiment') ||
|
|
3102
|
+
option.hasAttribute('chip-large') ||
|
|
3103
|
+
option.hasAttribute('chip-icon') ||
|
|
3104
|
+
option.hasAttribute('chip-dot');
|
|
3105
|
+
}
|
|
3106
|
+
// Helper method to get chip properties from option attributes
|
|
3107
|
+
getOptionChipProps(option) {
|
|
3108
|
+
return {
|
|
3109
|
+
sentiment: option.getAttribute('chip-sentiment') || 'neutral',
|
|
3110
|
+
large: option.hasAttribute('chip-large'),
|
|
3111
|
+
icon: option.getAttribute('chip-icon') || undefined,
|
|
3112
|
+
dot: option.hasAttribute('chip-dot')
|
|
3113
|
+
};
|
|
3114
|
+
}
|
|
3115
|
+
// Helper method to check if option is selected (single source of truth)
|
|
3116
|
+
isOptionSelected(option) {
|
|
3117
|
+
return this.selectedOption === option;
|
|
3118
|
+
}
|
|
3119
|
+
// Helper method to set selected option (centralized state management)
|
|
3120
|
+
setSelectedOption(option) {
|
|
3121
|
+
this.selectedOption = option;
|
|
3122
|
+
// Immediately update chip properties for automatic rendering to ensure reactivity
|
|
3123
|
+
if (option && this.isOptionChip(option)) {
|
|
3124
|
+
this.selectedOptionChipProps = this.getOptionChipProps(option);
|
|
3125
|
+
}
|
|
3126
|
+
else {
|
|
3127
|
+
this.selectedOptionChipProps = null;
|
|
3128
|
+
}
|
|
3129
|
+
// Immediately update layout content too, the same way: the @Watch('selectedOption') below
|
|
3130
|
+
// isn't active yet the first time this runs, during componentWillLoad's initial selection,
|
|
3131
|
+
// so a preselected layout option would otherwise show its plain label until some later change
|
|
3132
|
+
// triggers the watcher.
|
|
3133
|
+
this.selectedOptionLayoutContent = option && this.isOptionLayout(option)
|
|
3134
|
+
? this.getOptionLayoutContent(option)
|
|
3135
|
+
: '';
|
|
3136
|
+
}
|
|
3137
|
+
filterOptions() {
|
|
3138
|
+
// A new list replaces the rows a slide or height glide was animating, so their end events may
|
|
3139
|
+
// never come.
|
|
3140
|
+
this.drillDirection = null;
|
|
3141
|
+
this.endHeightGlide();
|
|
3142
|
+
// Ensure allItems includes optionEls if not already populated (for edge cases)
|
|
3143
|
+
if (this.allItems.length === 0 && this.optionEls.length > 0) {
|
|
3144
|
+
this.allItems = [...this.optionEls];
|
|
3145
|
+
}
|
|
3146
|
+
const searchesPanel = this.usesPanelSearch;
|
|
3147
|
+
if ((this.mode === 'select-only' && !searchesPanel) || this.expandFilterListWhileOpen || (searchesPanel && this.panelQuery === '')) {
|
|
3148
|
+
this.filteredItems = [...this.allItems];
|
|
3149
|
+
}
|
|
3150
|
+
else {
|
|
3151
|
+
const val = (searchesPanel ? this.panelQuery : this.displayText).toLowerCase();
|
|
3152
|
+
const filteredOptions = this.optionEls.filter(option => {
|
|
3153
|
+
// Outside inline mode a group's label is part of what search matches, so "tag" finds
|
|
3154
|
+
// every option in the Tag group.
|
|
3155
|
+
if (this.groupDisplay !== 'inline') {
|
|
3156
|
+
const groupLabel = groupLabelOf(option);
|
|
3157
|
+
if (groupLabel !== null && groupLabel.toLowerCase().includes(val))
|
|
3158
|
+
return true;
|
|
3159
|
+
}
|
|
3160
|
+
// `data-search-text`, when set, is what search matches, so an option can be found by more
|
|
3161
|
+
// than its label without a custom layout. A layout option otherwise matches its text.
|
|
3162
|
+
const searchText = option.getAttribute('data-search-text');
|
|
3163
|
+
if (searchText)
|
|
3164
|
+
return searchText.toLowerCase().includes(val);
|
|
3165
|
+
if (this.isOptionLayout(option))
|
|
3166
|
+
return (option.textContent || '').toLowerCase().includes(val);
|
|
3167
|
+
return this.getOptionLabel(option).toLowerCase().includes(val);
|
|
3168
|
+
});
|
|
3169
|
+
// Rebuild filtered items maintaining group structure - simplified approach
|
|
3170
|
+
this.filteredItems = [];
|
|
3171
|
+
let currentGroupLabel = null;
|
|
3172
|
+
this.allItems.forEach(item => {
|
|
3173
|
+
if (item.tagName === 'OPTGROUP' || item.tagName === 'PDS-TEXT') {
|
|
3174
|
+
currentGroupLabel = item;
|
|
3175
|
+
}
|
|
3176
|
+
else if (item.tagName === 'OPTION' && filteredOptions.includes(item)) {
|
|
3177
|
+
const optionEl = item;
|
|
3178
|
+
const parent = optionEl.parentElement;
|
|
3179
|
+
let labelToUse = null;
|
|
3180
|
+
if (parent && parent.tagName === 'OPTGROUP') {
|
|
3181
|
+
// Only use the actual parent optgroup as label
|
|
3182
|
+
labelToUse = parent;
|
|
3183
|
+
}
|
|
3184
|
+
else if (currentGroupLabel && currentGroupLabel.tagName === 'PDS-TEXT') {
|
|
3185
|
+
// Allow pds-text to label subsequent top-level options until another label appears
|
|
3186
|
+
labelToUse = currentGroupLabel;
|
|
3187
|
+
}
|
|
3188
|
+
if (labelToUse && !this.filteredItems.includes(labelToUse)) {
|
|
3189
|
+
this.filteredItems.push(labelToUse);
|
|
3190
|
+
}
|
|
3191
|
+
this.filteredItems.push(optionEl);
|
|
3192
|
+
}
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
this.highlightedIndex = -1;
|
|
3196
|
+
this.highlightedGroup = null;
|
|
3197
|
+
}
|
|
3198
|
+
clearExpandFilterList() {
|
|
3199
|
+
this.expandFilterListWhileOpen = false;
|
|
3200
|
+
}
|
|
3201
|
+
/**
|
|
3202
|
+
* When reopening the dropdown in filter mode with the input still showing the
|
|
3203
|
+
* committed selection label, show the full option list until the user edits the query.
|
|
3204
|
+
*/
|
|
3205
|
+
prepareExpandFilterListOnOpen() {
|
|
3206
|
+
if (this.mode === 'filter' &&
|
|
3207
|
+
this.selectedOption &&
|
|
3208
|
+
this.displayText === this.getOptionLabel(this.selectedOption)) {
|
|
3209
|
+
this.expandFilterListWhileOpen = true;
|
|
3210
|
+
}
|
|
3211
|
+
else {
|
|
3212
|
+
this.expandFilterListWhileOpen = false;
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
positionDropdown() {
|
|
3216
|
+
var _a;
|
|
3217
|
+
if (!this.triggerEl || !this.listboxEl) {
|
|
3218
|
+
return;
|
|
3219
|
+
}
|
|
3220
|
+
const strategy = this.usesBodyPortal ? 'fixed' : 'absolute';
|
|
3221
|
+
const zIndex = this.usesBodyPortal
|
|
3222
|
+
? 'var(--pine-z-index-priority)'
|
|
3223
|
+
: 'var(--pine-z-index-raised)';
|
|
3224
|
+
// Unset, the panel's own width applies, which differs with its padding (see the dropdown panel styles).
|
|
3225
|
+
this.listboxEl.style.width = (_a = this.dropdownWidth) !== null && _a !== void 0 ? _a : '';
|
|
3226
|
+
if (this.maxHeight) {
|
|
3227
|
+
this.listboxEl.style.maxHeight = this.maxHeight;
|
|
3228
|
+
// With panel search, the options list scrolls under a fixed search field.
|
|
3229
|
+
this.syncPanelOverflow();
|
|
3230
|
+
}
|
|
3231
|
+
return computePosition(this.triggerEl, this.listboxEl, {
|
|
3232
|
+
placement: this.dropdownPlacement,
|
|
3233
|
+
strategy,
|
|
3234
|
+
middleware: [offset(8), flip(), shift({ padding: 5 })],
|
|
3235
|
+
}).then(({ x, y, placement }) => {
|
|
3236
|
+
if (!this.listboxEl) {
|
|
3237
|
+
return;
|
|
3238
|
+
}
|
|
3239
|
+
// Where it landed after flipping, so the opening motion moves away from the field.
|
|
3240
|
+
this.listboxEl.dataset.placement = placement;
|
|
3241
|
+
Object.assign(this.listboxEl.style, {
|
|
3242
|
+
left: `${x}px`,
|
|
3243
|
+
top: `${y}px`,
|
|
3244
|
+
position: strategy,
|
|
3245
|
+
zIndex,
|
|
3246
|
+
});
|
|
3247
|
+
this.checkFlyoutRoom();
|
|
3248
|
+
});
|
|
3249
|
+
}
|
|
3250
|
+
/**
|
|
3251
|
+
* Once per open, after the dropdown is placed: with no room for a flyout on either side of it,
|
|
3252
|
+
* `flyout` drills in instead. `flyout-min-width` is resolved through CSS, so any length works.
|
|
3253
|
+
*/
|
|
3254
|
+
checkFlyoutRoom() {
|
|
3255
|
+
if (!this.isOpen || this.groupDisplay !== 'flyout' || this.flyoutRoomChecked || !this.listboxEl)
|
|
3256
|
+
return;
|
|
3257
|
+
this.flyoutRoomChecked = true;
|
|
3258
|
+
const probe = document.createElement('div');
|
|
3259
|
+
// Fixed, like the flyout, so a percentage resolves against the viewport as the flyout's does.
|
|
3260
|
+
probe.style.cssText = 'position:fixed;visibility:hidden;width:0;';
|
|
3261
|
+
probe.style.minWidth = this.flyoutMinWidth;
|
|
3262
|
+
this.listboxEl.appendChild(probe);
|
|
3263
|
+
const needed = parseFloat(getComputedStyle(probe).minWidth);
|
|
3264
|
+
probe.remove();
|
|
3265
|
+
const rect = this.listboxEl.getBoundingClientRect();
|
|
3266
|
+
const room = Math.max(window.innerWidth - rect.right, rect.left);
|
|
3267
|
+
const fallback = Number.isFinite(needed) && needed > 0 && rect.width > 0 && room < needed;
|
|
3268
|
+
if (fallback !== this.flyoutFallback)
|
|
3269
|
+
this.flyoutFallback = fallback;
|
|
3270
|
+
}
|
|
3271
|
+
openDropdownPositioning() {
|
|
3272
|
+
if (!this.triggerEl || !this.listboxEl) {
|
|
3273
|
+
return;
|
|
3274
|
+
}
|
|
3275
|
+
void this.positionDropdown();
|
|
3276
|
+
}
|
|
3277
|
+
startBodyPortalAutoUpdate() {
|
|
3278
|
+
if (this.bodyPortalAutoUpdateActive || !this.triggerEl || !this.listboxEl) {
|
|
3279
|
+
return;
|
|
3280
|
+
}
|
|
3281
|
+
this.cleanupPositionAutoUpdate = autoUpdate(this.triggerEl, this.listboxEl, () => {
|
|
3282
|
+
void this.positionDropdown();
|
|
3283
|
+
});
|
|
3284
|
+
this.bodyPortalAutoUpdateActive = true;
|
|
3285
|
+
}
|
|
3286
|
+
stopBodyPortalAutoUpdate() {
|
|
3287
|
+
var _a;
|
|
3288
|
+
(_a = this.cleanupPositionAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
3289
|
+
this.cleanupPositionAutoUpdate = undefined;
|
|
3290
|
+
this.bodyPortalAutoUpdateActive = false;
|
|
3291
|
+
}
|
|
3292
|
+
getPortalMountRoot() {
|
|
3293
|
+
var _a;
|
|
3294
|
+
return (_a = this.findNearestDialogForPortal(this.el)) !== null && _a !== void 0 ? _a : document.body;
|
|
3295
|
+
}
|
|
3296
|
+
/**
|
|
3297
|
+
* Resolves the native `<dialog>` to host the portaled listbox so it stays in the same top layer
|
|
3298
|
+
* as `showModal()`. `Element.closest('dialog')` stops at shadow boundaries and can miss a
|
|
3299
|
+
* dialog that only wraps slotted content; this walks assigned slots and shadow hosts, and
|
|
3300
|
+
* falls back to `pds-modal`'s dialog when the combobox lives inside that subtree.
|
|
3301
|
+
*/
|
|
3302
|
+
findNearestDialogForPortal(from) {
|
|
3303
|
+
const seen = new Set();
|
|
3304
|
+
let current = from;
|
|
3305
|
+
while (current && !seen.has(current)) {
|
|
3306
|
+
seen.add(current);
|
|
3307
|
+
if (current.nodeType === Node.ELEMENT_NODE && current.localName === 'dialog') {
|
|
3308
|
+
return current;
|
|
3309
|
+
}
|
|
3310
|
+
if (current.nodeType === Node.ELEMENT_NODE) {
|
|
3311
|
+
const assigned = current.assignedSlot;
|
|
3312
|
+
if (assigned) {
|
|
3313
|
+
current = assigned;
|
|
3314
|
+
continue;
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
const parent = current.parentNode;
|
|
3318
|
+
if (parent) {
|
|
3319
|
+
current = parent instanceof ShadowRoot ? parent.host : parent;
|
|
3320
|
+
continue;
|
|
3321
|
+
}
|
|
3322
|
+
break;
|
|
3323
|
+
}
|
|
3324
|
+
const pineModal = from.closest('pds-modal');
|
|
3325
|
+
if (pineModal) {
|
|
3326
|
+
const pineDialog = pineModal.querySelector('dialog');
|
|
3327
|
+
if (pineDialog) {
|
|
3328
|
+
return pineDialog;
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
return null;
|
|
3332
|
+
}
|
|
3333
|
+
ensureBodyPortal() {
|
|
3334
|
+
if (this.portalEl !== null) {
|
|
3335
|
+
const target = this.getPortalMountRoot();
|
|
3336
|
+
if (this.portalEl.parentElement !== target) {
|
|
3337
|
+
target.appendChild(this.portalEl);
|
|
3338
|
+
// What differs from the new parent may not be what differed from the old one.
|
|
3339
|
+
this.copyPortalContext();
|
|
3340
|
+
}
|
|
3341
|
+
return this.portalEl;
|
|
3342
|
+
}
|
|
3343
|
+
this.portalEl = document.createElement('div');
|
|
3344
|
+
this.portalEl.className = 'pds-combobox-dropdown-portal';
|
|
3345
|
+
// The copied stylesheet's `:host` rules match this div too; keep it out of layout. It still
|
|
3346
|
+
// passes `dir` and the theme down.
|
|
3347
|
+
this.portalEl.style.display = 'contents';
|
|
3348
|
+
this.portalRoot = this.portalEl.attachShadow({ mode: 'open' });
|
|
3349
|
+
this.getPortalMountRoot().appendChild(this.portalEl);
|
|
3350
|
+
this.copyPortalContext();
|
|
3351
|
+
return this.portalEl;
|
|
3352
|
+
}
|
|
3353
|
+
/**
|
|
3354
|
+
* Gives the portal what the dropdown would otherwise get inside the combobox: its styles (so it
|
|
3355
|
+
* needs no global CSS), the reading direction and language, a theme set on an ancestor, and
|
|
3356
|
+
* custom properties set between the combobox and where the portal mounts. A snapshot: the portal
|
|
3357
|
+
* is rebuilt on every open, so a theme switched while it's open applies from the next open.
|
|
3358
|
+
*/
|
|
3359
|
+
copyPortalContext() {
|
|
3360
|
+
var _a, _b, _c;
|
|
3361
|
+
const portal = this.portalEl;
|
|
3362
|
+
const root = this.portalRoot;
|
|
3363
|
+
const source = this.el.shadowRoot;
|
|
3364
|
+
if (!portal || !root)
|
|
3365
|
+
return;
|
|
3366
|
+
if ((_a = source === null || source === void 0 ? void 0 : source.adoptedStyleSheets) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3367
|
+
root.adoptedStyleSheets = source.adoptedStyleSheets;
|
|
3368
|
+
}
|
|
3369
|
+
else if (source && !root.querySelector('style')) {
|
|
3370
|
+
source.querySelectorAll('style').forEach(style => root.appendChild(style.cloneNode(true)));
|
|
3371
|
+
}
|
|
3372
|
+
const computed = getComputedStyle(this.el);
|
|
3373
|
+
portal.dir = computed.direction || 'ltr';
|
|
3374
|
+
const lang = (_b = closest('[lang]', this.el)) === null || _b === void 0 ? void 0 : _b.getAttribute('lang');
|
|
3375
|
+
if (lang)
|
|
3376
|
+
portal.lang = lang;
|
|
3377
|
+
const theme = (_c = closest('[data-theme]', this.el)) === null || _c === void 0 ? void 0 : _c.getAttribute('data-theme');
|
|
3378
|
+
if (theme)
|
|
3379
|
+
portal.setAttribute('data-theme', theme);
|
|
3380
|
+
const outside = portal.parentElement ? getComputedStyle(portal.parentElement) : null;
|
|
3381
|
+
for (let i = 0; i < computed.length; i++) {
|
|
3382
|
+
const property = computed[i];
|
|
3383
|
+
if (!property.startsWith('--'))
|
|
3384
|
+
continue;
|
|
3385
|
+
const value = computed.getPropertyValue(property);
|
|
3386
|
+
if (outside && value === outside.getPropertyValue(property))
|
|
3387
|
+
continue;
|
|
3388
|
+
portal.style.setProperty(property, value.trim());
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
syncBodyPortal() {
|
|
3392
|
+
if (!this.listboxEl) {
|
|
3393
|
+
return;
|
|
3394
|
+
}
|
|
3395
|
+
this.ensureBodyPortal();
|
|
3396
|
+
const root = this.portalRoot;
|
|
3397
|
+
for (const stale of Array.from(root.children)) {
|
|
3398
|
+
if (stale !== this.listboxEl && stale.tagName !== 'STYLE') {
|
|
3399
|
+
stale.remove();
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
if (this.listboxEl.parentNode !== root) {
|
|
3403
|
+
root.appendChild(this.listboxEl);
|
|
3404
|
+
void this.positionDropdown();
|
|
3405
|
+
this.startBodyPortalAutoUpdate();
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
removeBodyPortal() {
|
|
3409
|
+
var _a;
|
|
3410
|
+
this.stopBodyPortalAutoUpdate();
|
|
3411
|
+
if ((_a = this.portalEl) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
3412
|
+
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
3413
|
+
}
|
|
3414
|
+
this.portalEl = null;
|
|
3415
|
+
this.portalRoot = null;
|
|
3416
|
+
if (this.listboxEl && !this.listboxEl.isConnected) {
|
|
3417
|
+
this.listboxEl = undefined;
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
/**
|
|
3421
|
+
* The tree keys in the grouped panel. Up, Down, Home, End, PageUp and PageDown move within one
|
|
3422
|
+
* level; Right, Enter or Space opens a group at its first option; Left, or Escape, closes the
|
|
3423
|
+
* open group back to its row. Returns false for keys the listbox handling covers, such as
|
|
3424
|
+
* Enter on an option.
|
|
3425
|
+
*/
|
|
3426
|
+
handleGroupedPanelKey(e) {
|
|
3427
|
+
if (!this.showsGroupedPanel)
|
|
3428
|
+
return false;
|
|
3429
|
+
const highlightShown = this.keyboardNavigating;
|
|
3430
|
+
this.keyboardNavigating = true;
|
|
3431
|
+
// In the input trigger, Left and Right still move the caret through typed text, and Space,
|
|
3432
|
+
// Home and End edit it, as they do in the panel's search field.
|
|
3433
|
+
if (this.trigger === 'input') {
|
|
3434
|
+
if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight') && this.displayText !== '')
|
|
3435
|
+
return false;
|
|
3436
|
+
if (e.key === ' ' || e.key === 'Home' || e.key === 'End')
|
|
3437
|
+
return false;
|
|
3438
|
+
}
|
|
3439
|
+
const entries = this.panelEntries();
|
|
3440
|
+
const drilledIn = this.effectiveGroupDisplay === 'drill-in' && this.openGroup !== null;
|
|
3441
|
+
const current = this.currentPanelItem();
|
|
3442
|
+
const column = panelColumn(entries, this.openGroup, current, drilledIn);
|
|
3443
|
+
if (column.length === 0)
|
|
3444
|
+
return false;
|
|
3445
|
+
const position = current === null ? -1 : column.indexOf(current);
|
|
3446
|
+
// Drill-in doesn't shade a group row the pointer or a click-open highlighted, so the first Up or
|
|
3447
|
+
// Down shows that row rather than moving past one the user never saw.
|
|
3448
|
+
const unseenRow = !highlightShown && this.effectiveGroupDisplay === 'drill-in' && current !== null && typeof current !== 'number' && current !== this.openGroup;
|
|
3449
|
+
const moveTo = (to) => {
|
|
3450
|
+
e.preventDefault();
|
|
3451
|
+
this.highlightPanelItem(column[Math.max(0, Math.min(column.length - 1, to))]);
|
|
3452
|
+
this.revealedGroupLabel = null;
|
|
3453
|
+
return true;
|
|
3454
|
+
};
|
|
3455
|
+
const reveal = () => {
|
|
3456
|
+
e.preventDefault();
|
|
3457
|
+
// The row's name, badge and all, as the row itself is named.
|
|
3458
|
+
const optgroup = current;
|
|
3459
|
+
const badge = groupBadgeOf(optgroup);
|
|
3460
|
+
this.revealedGroupLabel = badge === null ? optgroup.label : `${optgroup.label}, ${badge.label}`;
|
|
3461
|
+
return true;
|
|
3462
|
+
};
|
|
3463
|
+
switch (e.key) {
|
|
3464
|
+
case 'ArrowDown':
|
|
3465
|
+
return unseenRow ? reveal() : moveTo(position < 0 ? 0 : position + 1);
|
|
3466
|
+
case 'ArrowUp':
|
|
3467
|
+
return unseenRow ? reveal() : moveTo(position < 0 ? column.length - 1 : position - 1);
|
|
3468
|
+
case 'Home':
|
|
3469
|
+
return moveTo(0);
|
|
3470
|
+
case 'End':
|
|
3471
|
+
return moveTo(column.length - 1);
|
|
3472
|
+
case 'PageDown':
|
|
3473
|
+
return moveTo(position < 0 ? 0 : position + 10);
|
|
3474
|
+
case 'PageUp':
|
|
3475
|
+
return moveTo(position < 0 ? column.length - 1 : position - 10);
|
|
3476
|
+
case 'ArrowRight':
|
|
3477
|
+
case 'Enter':
|
|
3478
|
+
case ' ': {
|
|
3479
|
+
if (current === null || typeof current === 'number')
|
|
3480
|
+
return false;
|
|
3481
|
+
e.preventDefault();
|
|
3482
|
+
if (!drilledIn || current !== this.openGroup) {
|
|
3483
|
+
this.expandGroup(entries, current);
|
|
3484
|
+
}
|
|
3485
|
+
else if (e.key === 'ArrowRight') {
|
|
3486
|
+
// On the row back of a drilled-in group: down into its options.
|
|
3487
|
+
if (column.length > 1)
|
|
3488
|
+
this.highlightPanelItem(column[1]);
|
|
3489
|
+
}
|
|
3490
|
+
else {
|
|
3491
|
+
this.leaveDrilledInGroup();
|
|
3492
|
+
}
|
|
3493
|
+
return true;
|
|
3494
|
+
}
|
|
3495
|
+
case 'ArrowLeft':
|
|
3496
|
+
case 'Escape': {
|
|
3497
|
+
// Escape with no group open closes the panel, through the listbox handling.
|
|
3498
|
+
if (this.openGroup === null)
|
|
3499
|
+
return false;
|
|
3500
|
+
e.preventDefault();
|
|
3501
|
+
this.collapseToGroup(this.openGroup);
|
|
3502
|
+
return true;
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
return false;
|
|
3506
|
+
}
|
|
3507
|
+
/**
|
|
3508
|
+
* Where the keyboard is in the grouped panel. An option highlighted in a group that has since
|
|
3509
|
+
* closed (the pointer left its flyout) counts as its group's row, so the keys carry on from
|
|
3510
|
+
* what's showing rather than from an option that isn't.
|
|
3511
|
+
*/
|
|
3512
|
+
currentPanelItem() {
|
|
3513
|
+
if (this.highlightedIndex < 0)
|
|
3514
|
+
return this.highlightedGroup;
|
|
3515
|
+
const selectable = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
3516
|
+
const group = parentOptgroupOf(selectable[this.highlightedIndex]);
|
|
3517
|
+
return group !== null && group !== this.openGroup ? group : this.highlightedIndex;
|
|
3518
|
+
}
|
|
3519
|
+
/**
|
|
3520
|
+
* Highlights the option at `index`, kept within the list. Disabled options can be highlighted,
|
|
3521
|
+
* so assistive tech announces them as unavailable, but not chosen.
|
|
3522
|
+
*/
|
|
3523
|
+
highlightOptionAt(options, index) {
|
|
3524
|
+
if (options.length === 0)
|
|
3525
|
+
return;
|
|
3526
|
+
// Only the keys move it, so it shows the keyboard's ring, as in the grouped panel.
|
|
3527
|
+
this.keyboardNavigating = true;
|
|
3528
|
+
this.highlightedIndex = Math.max(0, Math.min(options.length - 1, index));
|
|
3529
|
+
this.updateOptionFocus();
|
|
3530
|
+
}
|
|
3531
|
+
/** Highlights a group row or an option, opening or closing flyouts to match. */
|
|
3532
|
+
highlightPanelItem(item) {
|
|
3533
|
+
if (typeof item === 'number') {
|
|
3534
|
+
this.highlightedIndex = item;
|
|
3535
|
+
}
|
|
3536
|
+
else {
|
|
3537
|
+
this.highlightedIndex = -1;
|
|
3538
|
+
this.highlightedGroup = item;
|
|
3539
|
+
}
|
|
3540
|
+
this.updateOptionFocus();
|
|
3541
|
+
}
|
|
3542
|
+
expandGroup(entries, optgroup) {
|
|
3543
|
+
var _a;
|
|
3544
|
+
this.flyout.open(optgroup);
|
|
3545
|
+
const first = (_a = findGroup(entries, optgroup)) === null || _a === void 0 ? void 0 : _a.options[0];
|
|
3546
|
+
if (first !== undefined)
|
|
3547
|
+
this.highlightPanelItem(first.index);
|
|
3548
|
+
// Its options render after this change; scroll to the first one then.
|
|
3549
|
+
this.pendingOptionFocus = true;
|
|
3550
|
+
}
|
|
3551
|
+
/** Closes the open group and highlights its row, as a tree's Left does from a child. */
|
|
3552
|
+
collapseToGroup(optgroup) {
|
|
3553
|
+
this.flyout.reset();
|
|
3554
|
+
this.openGroup = null;
|
|
3555
|
+
this.highlightPanelItem(optgroup);
|
|
3556
|
+
// The row renders after this change (in drill-in it replaces the row back); scroll to it then.
|
|
3557
|
+
this.pendingOptionFocus = true;
|
|
3558
|
+
}
|
|
3559
|
+
/**
|
|
3560
|
+
* Sets focus on the native input element.
|
|
3561
|
+
*/
|
|
3562
|
+
async setFocus() {
|
|
3563
|
+
var _a;
|
|
3564
|
+
if (this.inputEl) {
|
|
3565
|
+
this.inputEl.focus();
|
|
3566
|
+
}
|
|
3567
|
+
else {
|
|
3568
|
+
(_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3572
|
+
* Sets the initial highlighted index when dropdown opens. Highlights the selected option unless
|
|
3573
|
+
* it's disabled. Otherwise highlights the first enabled option, or, in the grouped panel, the
|
|
3574
|
+
* first row with something to choose, or nothing when every option is disabled.
|
|
3575
|
+
*/
|
|
3576
|
+
setInitialHighlightedIndex() {
|
|
3577
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
3578
|
+
if (selectableOptions.length === 0) {
|
|
3579
|
+
this.highlightedIndex = -1;
|
|
3580
|
+
return;
|
|
3581
|
+
}
|
|
3582
|
+
// If there's a selected option, find its index in the filtered options. A disabled one can be
|
|
3583
|
+
// the value, as in a native select, but it isn't highlighted.
|
|
3584
|
+
if (this.selectedOption && !isOptionDisabled(this.selectedOption)) {
|
|
3585
|
+
const selectedIndex = selectableOptions.findIndex(option => option === this.selectedOption);
|
|
3586
|
+
if (selectedIndex >= 0) {
|
|
3587
|
+
this.highlightedIndex = selectedIndex;
|
|
3588
|
+
// In the grouped panel, open on the selection's group, however the dropdown was opened, and
|
|
3589
|
+
// scroll the selection into view once its group has rendered.
|
|
3590
|
+
if (this.showsGroupedPanel) {
|
|
3591
|
+
this.openGroup = parentOptgroupOf(this.selectedOption);
|
|
3592
|
+
// Opening on the selection isn't drilling in, so it doesn't slide.
|
|
3593
|
+
this.drillDirection = null;
|
|
3594
|
+
this.pendingOptionFocus = true;
|
|
3595
|
+
}
|
|
3596
|
+
return;
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
// In the grouped panel, the first row with something to choose: a group stays closed until
|
|
3600
|
+
// it's opened.
|
|
3601
|
+
if (this.showsGroupedPanel) {
|
|
3602
|
+
const first = this.panelEntries().find(entry => entry.kind === 'group' ? !isGroupDisabled(entry.group) : !isOptionDisabled(entry.option));
|
|
3603
|
+
this.highlightedIndex = (first === null || first === void 0 ? void 0 : first.kind) === 'option' ? first.index : -1;
|
|
3604
|
+
this.highlightedGroup = (first === null || first === void 0 ? void 0 : first.kind) === 'group' ? first.group.optgroup : null;
|
|
3605
|
+
return;
|
|
3606
|
+
}
|
|
3607
|
+
// No selected option or selected option not in filtered results, highlight the first enabled option
|
|
3608
|
+
this.highlightedIndex = selectableOptions.findIndex(option => !isOptionDisabled(option));
|
|
3609
|
+
}
|
|
3610
|
+
/**
|
|
3611
|
+
* Focus management helper - moves focus to the first option when dropdown opens
|
|
3612
|
+
*/
|
|
3613
|
+
focusFirstOption() {
|
|
3614
|
+
if (this.isOpen) {
|
|
3615
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
3616
|
+
if (selectableOptions.length > 0) {
|
|
3617
|
+
this.setInitialHighlightedIndex();
|
|
3618
|
+
// DON'T focus the option elements - keep focus on trigger and use aria-activedescendant
|
|
3619
|
+
// This prevents the focusout event that was closing the dropdown
|
|
3620
|
+
// But still call updateOptionFocus for scrolling
|
|
3621
|
+
if (this.listboxEl) {
|
|
3622
|
+
this.updateOptionFocus();
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
/**
|
|
3628
|
+
* Focus management helper - actually focuses the first option when opened via arrow keys
|
|
3629
|
+
*/
|
|
3630
|
+
focusFirstOptionForArrowKeys() {
|
|
3631
|
+
if (!this.isOpen) {
|
|
3632
|
+
return;
|
|
3633
|
+
}
|
|
3634
|
+
// Body-mounted listboxes stay outside modal focus traps; keep focus on the trigger.
|
|
3635
|
+
if (this.usesBodyPortal) {
|
|
3636
|
+
this.isArrowKeyNavigationMode = true;
|
|
3637
|
+
this.focusFirstOption();
|
|
3638
|
+
return;
|
|
3639
|
+
}
|
|
3640
|
+
this.isArrowKeyNavigationMode = true;
|
|
3641
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
3642
|
+
if (selectableOptions.length > 0) {
|
|
3643
|
+
this.setInitialHighlightedIndex();
|
|
3644
|
+
// By index, through the same path as arrowing: it opens the option's flyout group first
|
|
3645
|
+
// when it isn't rendered, and highlights it once it is.
|
|
3646
|
+
this.updateOptionFocus();
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
/**
|
|
3650
|
+
* Focus management helper - updates visual state and scrolling for the currently highlighted option
|
|
3651
|
+
* Note: We don't actually focus the option to prevent focusout events that close the dropdown
|
|
3652
|
+
*/
|
|
3653
|
+
updateOptionFocus() {
|
|
3654
|
+
var _a;
|
|
3655
|
+
if (this.listboxEl === undefined || this.listboxEl === null)
|
|
3656
|
+
return;
|
|
3657
|
+
// A row highlighted outright; an option highlighted in a closed group opens it below instead.
|
|
3658
|
+
const groupRow = this.showsGroupedPanel && this.highlightedIndex < 0 ? this.highlightedGroup : null;
|
|
3659
|
+
if (groupRow !== null) {
|
|
3660
|
+
// Arrowing onto another row closes a flyout that hover left open.
|
|
3661
|
+
if (this.effectiveGroupDisplay === 'flyout' && this.openGroup !== null && this.openGroup !== groupRow) {
|
|
3662
|
+
this.flyout.reset();
|
|
3663
|
+
this.openGroup = null;
|
|
3664
|
+
}
|
|
3665
|
+
// Matched by id, not a selector: componentId is consumer text and may not be selector-safe.
|
|
3666
|
+
const id = this.groupDomId(groupRow);
|
|
3667
|
+
const row = Array.from(this.listboxEl.querySelectorAll('[role="treeitem"]'))
|
|
3668
|
+
.find(item => item.id === id);
|
|
3669
|
+
// The row's trigger, not its item: the row back's item wraps the group's options, and showing
|
|
3670
|
+
// all of a group taller than the list would scroll the row back itself out of view.
|
|
3671
|
+
const trigger = Array.from((_a = row === null || row === void 0 ? void 0 : row.children) !== null && _a !== void 0 ? _a : []).find(child => child.classList.contains('pds-combobox__group-row-trigger'));
|
|
3672
|
+
if (trigger)
|
|
3673
|
+
this.scrollIntoViewNearest(trigger, false);
|
|
3674
|
+
this.updateAriaActiveDescendant();
|
|
3675
|
+
return;
|
|
3676
|
+
}
|
|
3677
|
+
if (this.highlightedIndex < 0)
|
|
3678
|
+
return;
|
|
3679
|
+
// In the flyout panel only the open group's options are rendered: open the highlighted
|
|
3680
|
+
// option's group, and finish once it has rendered. Through the controller, so a hover timer
|
|
3681
|
+
// left running by the pointer can't close or switch the group the keys just moved into.
|
|
3682
|
+
if (this.showsGroupedPanel) {
|
|
3683
|
+
const selectable = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
3684
|
+
const group = parentOptgroupOf(selectable[this.highlightedIndex]);
|
|
3685
|
+
const changed = group !== this.openGroup;
|
|
3686
|
+
if (group !== null) {
|
|
3687
|
+
this.flyout.open(group);
|
|
3688
|
+
}
|
|
3689
|
+
else {
|
|
3690
|
+
this.flyout.reset();
|
|
3691
|
+
this.openGroup = null;
|
|
3692
|
+
}
|
|
3693
|
+
if (changed) {
|
|
3694
|
+
this.pendingOptionFocus = true;
|
|
3695
|
+
return;
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
const optionElements = this.listboxEl.querySelectorAll('[role="option"]');
|
|
3699
|
+
// By index, not position: the flyout panel renders only some options.
|
|
3700
|
+
const currentOption = this.listboxEl.querySelector(`[data-option-index="${this.highlightedIndex}"]`);
|
|
3701
|
+
if (currentOption) {
|
|
3702
|
+
// Check if any option currently has focus OR if we're in arrow-key navigation mode
|
|
3703
|
+
const hasOptionFocus = Array.from(optionElements).some(el => el === document.activeElement);
|
|
3704
|
+
// The panel's search field keeps focus and points at the option with aria-activedescendant,
|
|
3705
|
+
// and so does the trigger over the grouped panel, whose group rows can't take focus and
|
|
3706
|
+
// whose options are hidden while a flyout is placed.
|
|
3707
|
+
const shouldFocusOption = !this.usesBodyPortal &&
|
|
3708
|
+
!this.usesPanelSearch &&
|
|
3709
|
+
!this.showsGroupedPanel &&
|
|
3710
|
+
(hasOptionFocus || this.isArrowKeyNavigationMode);
|
|
3711
|
+
if (shouldFocusOption) {
|
|
3712
|
+
optionElements.forEach(option => {
|
|
3713
|
+
option.setAttribute('tabindex', '-1');
|
|
3714
|
+
});
|
|
3715
|
+
currentOption.setAttribute('tabindex', '0');
|
|
3716
|
+
currentOption.focus();
|
|
3717
|
+
}
|
|
3718
|
+
// Always scroll the option into view; in a flyout, by scrolling the flyout alone.
|
|
3719
|
+
const flyout = currentOption.closest('.pds-combobox__flyout');
|
|
3720
|
+
if (flyout) {
|
|
3721
|
+
this.flyout.reveal(flyout, currentOption);
|
|
3722
|
+
}
|
|
3723
|
+
else {
|
|
3724
|
+
this.scrollIntoViewNearest(currentOption, true);
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
// Always update aria-activedescendant on the trigger element
|
|
3728
|
+
this.updateAriaActiveDescendant();
|
|
3729
|
+
}
|
|
3730
|
+
/** The highlighted group row in the grouped panel, or null while an option is highlighted. */
|
|
3731
|
+
get highlightedGroupRow() {
|
|
3732
|
+
if (!this.showsGroupedPanel)
|
|
3733
|
+
return null;
|
|
3734
|
+
if (this.highlightedIndex < 0)
|
|
3735
|
+
return this.highlightedGroup;
|
|
3736
|
+
// An option left highlighted in a flyout that has since closed shows as its group's row.
|
|
3737
|
+
const current = this.currentPanelItem();
|
|
3738
|
+
return typeof current === 'number' ? null : current;
|
|
3739
|
+
}
|
|
3740
|
+
/**
|
|
3741
|
+
* The id of the highlighted option or group row, only while it's rendered. In the flyout panel
|
|
3742
|
+
* an option in a closed group isn't in the DOM, and drilled into a group the other groups' rows
|
|
3743
|
+
* aren't; `aria-activedescendant` must not point at a missing element.
|
|
3744
|
+
*/
|
|
3745
|
+
get activeDescendantId() {
|
|
3746
|
+
if (!this.isOpen)
|
|
3747
|
+
return undefined;
|
|
3748
|
+
const groupRow = this.highlightedGroupRow;
|
|
3749
|
+
if (groupRow !== null) {
|
|
3750
|
+
const drilledIntoAnother = this.effectiveGroupDisplay === 'drill-in' && this.openGroup !== null && this.openGroup !== groupRow;
|
|
3751
|
+
return drilledIntoAnother ? undefined : this.groupDomId(groupRow);
|
|
3752
|
+
}
|
|
3753
|
+
if (this.highlightedIndex < 0)
|
|
3754
|
+
return undefined;
|
|
3755
|
+
if (this.showsGroupedPanel) {
|
|
3756
|
+
const selectable = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
3757
|
+
const group = parentOptgroupOf(selectable[this.highlightedIndex]);
|
|
3758
|
+
if (group !== null && group !== this.openGroup)
|
|
3759
|
+
return undefined;
|
|
3760
|
+
}
|
|
3761
|
+
return this.optionDomId(this.highlightedIndex);
|
|
3762
|
+
}
|
|
3763
|
+
/** Points the focused element's aria-activedescendant at the highlighted option, or clears it. */
|
|
3764
|
+
updateAriaActiveDescendant() {
|
|
3765
|
+
// With panel search, the element with focus owns it, not the trigger: the search field, or
|
|
3766
|
+
// the list while a drilled-in group hides the field.
|
|
3767
|
+
const target = this.usesPanelSearch ? (this.hidesPanelSearch ? this.panelTreeEl : this.panelSearchEl) : this.triggerEl;
|
|
3768
|
+
if (!target)
|
|
3769
|
+
return;
|
|
3770
|
+
const id = this.activeDescendantId;
|
|
3771
|
+
if (id !== undefined) {
|
|
3772
|
+
target.setAttribute('aria-activedescendant', id);
|
|
3773
|
+
}
|
|
3774
|
+
else {
|
|
3775
|
+
target.removeAttribute('aria-activedescendant');
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
/**
|
|
3779
|
+
* Focus management helper - restores focus to the trigger element
|
|
3780
|
+
*/
|
|
3781
|
+
restoreFocusToTrigger() {
|
|
3782
|
+
setTimeout(() => {
|
|
3783
|
+
if (this.inputEl) {
|
|
3784
|
+
this.inputEl.focus();
|
|
3785
|
+
}
|
|
3786
|
+
else if (this.triggerEl) {
|
|
3787
|
+
this.triggerEl.focus();
|
|
3788
|
+
}
|
|
3789
|
+
}, 0);
|
|
3790
|
+
}
|
|
3791
|
+
/**
|
|
3792
|
+
* Gets the value of the currently selected option.
|
|
3793
|
+
*/
|
|
3794
|
+
async getSelectedValue() {
|
|
3795
|
+
return this.selectedOption ? this.selectedOption.value : null;
|
|
3796
|
+
}
|
|
3797
|
+
/**
|
|
3798
|
+
* Clears the selected value and resets the component. Works while disabled too, as setting a
|
|
3799
|
+
* native control's value from script does.
|
|
3800
|
+
*/
|
|
3801
|
+
async clear() {
|
|
3802
|
+
const hadValue = this.value !== '' || this.displayText !== '';
|
|
3803
|
+
this.displayText = '';
|
|
3804
|
+
this.setSelectedOption(null);
|
|
3805
|
+
this.value = '';
|
|
3806
|
+
this.filterOptions();
|
|
3807
|
+
this.updateFormValue('');
|
|
3808
|
+
if (hadValue) {
|
|
3809
|
+
this.pdsComboboxChange.emit({ value: '' });
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
// Group rows in the flyout panel carry their group's index, as options carry theirs.
|
|
3813
|
+
groupFromEvent(event) {
|
|
3814
|
+
var _a, _b;
|
|
3815
|
+
const index = Number(event.currentTarget.getAttribute('data-group-index'));
|
|
3816
|
+
return (_b = (_a = this.renderedGroups[index]) === null || _a === void 0 ? void 0 : _a.optgroup) !== null && _b !== void 0 ? _b : null;
|
|
3817
|
+
}
|
|
3818
|
+
highlightGroupRowByPointer(group) {
|
|
3819
|
+
this.highlightedIndex = -1;
|
|
3820
|
+
this.highlightedGroup = group;
|
|
3821
|
+
this.keyboardNavigating = false;
|
|
3822
|
+
// So revealing this row again later is announced again.
|
|
3823
|
+
this.revealedGroupLabel = null;
|
|
3824
|
+
}
|
|
3825
|
+
// Get the label of the selected option
|
|
3826
|
+
get selectedLabel() {
|
|
3827
|
+
return this.displayText || '';
|
|
3828
|
+
}
|
|
3829
|
+
// Get the layout content of the selected option for button trigger
|
|
3830
|
+
get selectedLayoutContent() {
|
|
3831
|
+
return this.selectedOptionLayoutContent;
|
|
3832
|
+
}
|
|
3833
|
+
// Check if selected option has layout
|
|
3834
|
+
get selectedHasLayout() {
|
|
3835
|
+
return this.selectedOption ? this.isOptionLayout(this.selectedOption) : false;
|
|
3836
|
+
}
|
|
3837
|
+
// Extract chip sentiment from selected option's attributes, layout content, or slotted trigger content
|
|
3838
|
+
get selectedChipSentiment() {
|
|
3839
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
3840
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
3841
|
+
const sentiment = this.selectedOption.getAttribute('chip-sentiment');
|
|
3842
|
+
if (sentiment)
|
|
3843
|
+
return sentiment;
|
|
3844
|
+
}
|
|
3845
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
3846
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
3847
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
3848
|
+
const sentiment = chipElement === null || chipElement === void 0 ? void 0 : chipElement.getAttribute('sentiment');
|
|
3849
|
+
if (sentiment)
|
|
3850
|
+
return sentiment;
|
|
3851
|
+
}
|
|
3852
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
3853
|
+
if (this.customTriggerContent) {
|
|
3854
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
3855
|
+
if (slottedChip) {
|
|
3856
|
+
const sentiment = slottedChip.getAttribute('sentiment');
|
|
3857
|
+
if (sentiment)
|
|
3858
|
+
return sentiment;
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
// Fallback: Use component props
|
|
3862
|
+
return this.chipSentiment;
|
|
3863
|
+
}
|
|
3864
|
+
// Extract chip large from selected option's attributes, layout content, or slotted trigger content
|
|
3865
|
+
get selectedChipLarge() {
|
|
3866
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
3867
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
3868
|
+
if (this.selectedOption.hasAttribute('chip-large'))
|
|
3869
|
+
return true;
|
|
3870
|
+
}
|
|
3871
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
3872
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
3873
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
3874
|
+
if ((chipElement === null || chipElement === void 0 ? void 0 : chipElement.getAttribute('size')) === 'lg')
|
|
3875
|
+
return true;
|
|
3876
|
+
}
|
|
3877
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
3878
|
+
if (this.customTriggerContent) {
|
|
3879
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
3880
|
+
if (slottedChip && slottedChip.getAttribute('size') === 'lg') {
|
|
3881
|
+
return true;
|
|
3882
|
+
}
|
|
3883
|
+
}
|
|
3884
|
+
// Fallback: Use component props
|
|
3885
|
+
return this.chipLarge;
|
|
3886
|
+
}
|
|
3887
|
+
// Extract chip icon from selected option's attributes, layout content, or slotted trigger content
|
|
3888
|
+
get selectedChipIcon() {
|
|
3889
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
3890
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
3891
|
+
const icon = this.selectedOption.getAttribute('chip-icon');
|
|
3892
|
+
if (icon)
|
|
3893
|
+
return icon;
|
|
3894
|
+
}
|
|
3895
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
3896
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
3897
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
3898
|
+
const icon = chipElement === null || chipElement === void 0 ? void 0 : chipElement.getAttribute('icon');
|
|
3899
|
+
if (icon)
|
|
3900
|
+
return icon;
|
|
3901
|
+
}
|
|
3902
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
3903
|
+
if (this.customTriggerContent) {
|
|
3904
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
3905
|
+
if (slottedChip) {
|
|
3906
|
+
const icon = slottedChip.getAttribute('icon');
|
|
3907
|
+
if (icon)
|
|
3908
|
+
return icon;
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3911
|
+
// Fallback: Use component props
|
|
3912
|
+
return this.chipIcon;
|
|
3913
|
+
}
|
|
3914
|
+
// Extract chip dot from selected option's attributes, layout content, or slotted trigger content
|
|
3915
|
+
get selectedChipDot() {
|
|
3916
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
3917
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
3918
|
+
if (this.selectedOption.hasAttribute('chip-dot'))
|
|
3919
|
+
return true;
|
|
3920
|
+
}
|
|
3921
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
3922
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
3923
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
3924
|
+
if (chipElement === null || chipElement === void 0 ? void 0 : chipElement.hasAttribute('dot'))
|
|
3925
|
+
return true;
|
|
3926
|
+
}
|
|
3927
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
3928
|
+
if (this.customTriggerContent) {
|
|
3929
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
3930
|
+
if (slottedChip && slottedChip.hasAttribute('dot')) {
|
|
3931
|
+
return true;
|
|
3932
|
+
}
|
|
3933
|
+
}
|
|
3934
|
+
// Fallback: Use component props
|
|
3935
|
+
return this.chipDot;
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* With `async-url`, fetches when the button trigger opens: the first page if nothing has loaded.
|
|
3939
|
+
* The panel's search field opens empty, so results left from the last search are refetched for
|
|
3940
|
+
* an empty query.
|
|
3941
|
+
*/
|
|
3942
|
+
fetchAsyncOptionsOnOpen() {
|
|
3943
|
+
if (!this.asyncUrl)
|
|
3944
|
+
return;
|
|
3945
|
+
if (this.usesPanelSearch && (this.internalOptions.length === 0 || this.lastFetchedQuery !== '')) {
|
|
3946
|
+
this.debouncedFetchAsyncOptions('', 1);
|
|
3947
|
+
}
|
|
3948
|
+
else if (this.internalOptions.length === 0) {
|
|
3949
|
+
this.debouncedFetchAsyncOptions(this.displayText, 1);
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
handleOptionClick(option) {
|
|
3953
|
+
if (isOptionDisabled(option))
|
|
3954
|
+
return;
|
|
3955
|
+
if (this.selectedIcon === null)
|
|
3956
|
+
this.fadesValueIn = true;
|
|
3957
|
+
// Update reactive state - single source of truth
|
|
3958
|
+
// The @Watch('selectedOption') will handle displayText, value, and form internals
|
|
3959
|
+
this.setSelectedOption(option);
|
|
3960
|
+
this.isOpen = false;
|
|
3961
|
+
this.clearExpandFilterList();
|
|
3962
|
+
this.pdsComboboxChange.emit({ value: option.value });
|
|
3963
|
+
}
|
|
3964
|
+
/** The row shown while options load: at the top of the list, or of a drilled-in group's options. */
|
|
3965
|
+
renderLoadingRow() {
|
|
3966
|
+
if (!this.loading)
|
|
3967
|
+
return null;
|
|
3968
|
+
const hasSlottedLoading = !this.usesBodyPortal && !!this.el.querySelector('[slot="loading"]');
|
|
3969
|
+
return (h("li", { class: "pds-combobox__loading", role: "presentation" }, hasSlottedLoading ? h("slot", { name: "loading" }) : h("pds-loader", { size: "small" })));
|
|
3970
|
+
}
|
|
3971
|
+
/** The row after the last option while more can load, inside whatever scrolls them. */
|
|
3972
|
+
renderLoadMoreRow() {
|
|
3973
|
+
if (!this.hasMore || this.loading)
|
|
3974
|
+
return null;
|
|
3975
|
+
return (h("li", { class: "pds-combobox__load-more", role: "presentation" }, h("pds-loader", { size: "small" })));
|
|
3976
|
+
}
|
|
3977
|
+
/** Drilled into a group: the group and its place among the panel's entries; otherwise null. */
|
|
3978
|
+
drilledInEntry(entries) {
|
|
3979
|
+
if (this.effectiveGroupDisplay !== 'drill-in' || this.openGroup === null)
|
|
3980
|
+
return null;
|
|
3981
|
+
const position = entries.findIndex(entry => entry.kind === 'group' && entry.group.optgroup === this.openGroup);
|
|
3982
|
+
const open = entries[position];
|
|
3983
|
+
return (open === null || open === void 0 ? void 0 : open.kind) === 'group' ? { group: open.group, position } : null;
|
|
3984
|
+
}
|
|
3985
|
+
renderDropdown() {
|
|
3986
|
+
if (!this.isOpen) {
|
|
3987
|
+
return null;
|
|
3988
|
+
}
|
|
3989
|
+
const hasSlottedEmpty = !this.usesBodyPortal && !!this.el.querySelector('[slot="empty"]');
|
|
3990
|
+
// Drilled in, the group's options scroll under the row back, so their loading rows go with them.
|
|
3991
|
+
const drilledIn = this.showsGroupedPanel && this.drilledInEntry(this.panelEntries()) !== null;
|
|
3992
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
3993
|
+
const withSearch = this.usesPanelSearch;
|
|
3994
|
+
// While a drilled-in group hides the search field, the list takes focus in its place.
|
|
3995
|
+
const listTakesFocus = this.hidesPanelSearch;
|
|
3996
|
+
const list = (h("ul", { key: "panel-list", class: {
|
|
3997
|
+
'pds-combobox__listbox': !withSearch,
|
|
3998
|
+
'pds-combobox__listbox-options': withSearch,
|
|
3999
|
+
'pds-combobox__listbox-options--drilled-in': listTakesFocus,
|
|
4000
|
+
'pds-combobox__listbox--grouped': this.groupDisplay !== 'inline',
|
|
4001
|
+
'pds-combobox__listbox--drill-in': this.drillDirection === 'in',
|
|
4002
|
+
'pds-combobox__listbox--drill-out': this.drillDirection === 'out',
|
|
4003
|
+
'pds-combobox__listbox--pointer-hover': this.pointerCanHover,
|
|
4004
|
+
'pds-combobox__listbox--truncate': this.truncate,
|
|
4005
|
+
}, onAnimationEnd: this.onDrillAnimationEnd, onPointerMove: this.onPanelPointer, onPointerDown: this.onPanelPointer, role: this.showsGroupedPanel ? 'tree' : 'listbox', id: this.listboxId, "aria-label": this.label || 'Options', "aria-multiselectable": "false",
|
|
4006
|
+
// Focusable but out of the tab order with panel search, so it can take focus when a
|
|
4007
|
+
// drilled-in group hides the field. Dropping it while focused would blur the list and close.
|
|
4008
|
+
tabIndex: withSearch ? -1 : undefined, "aria-activedescendant": listTakesFocus ? this.activeDescendantId : undefined, onKeyDown: withSearch ? this.onPanelTreeKeyDown : undefined, ref: el => {
|
|
4009
|
+
if (withSearch)
|
|
4010
|
+
this.panelTreeEl = el;
|
|
4011
|
+
else
|
|
4012
|
+
this.listboxEl = el;
|
|
4013
|
+
}, onScroll: this.handleScroll }, !drilledIn && this.renderLoadingRow(), !this.loading && this.filteredItems.length === 0 && (h("li", { class: "pds-combobox__empty", role: "presentation" }, hasSlottedEmpty ? (h("slot", { name: "empty" })) : (h("span", null, this.noOptionsFoundLabel)))), this.showsGroupedPanel ? this.renderGroupedPanel() : this.renderListboxItems(selectableOptions.length), !drilledIn && this.renderLoadMoreRow()));
|
|
4014
|
+
if (!withSearch)
|
|
4015
|
+
return list;
|
|
4016
|
+
// The search field sits above the list; the wrapper is what's positioned and portaled.
|
|
4017
|
+
return (h("div", { class: "pds-combobox__listbox pds-combobox__listbox--with-search", ref: el => (this.listboxEl = el), onAnimationEnd: this.onDrillAnimationEnd, onMouseDown: this.onPanelMouseDown,
|
|
4018
|
+
// Portaled, the panel sits outside .pds-combobox, so its focusout wouldn't reach that handler.
|
|
4019
|
+
onFocusout: this.usesBodyPortal ? this.onComboboxFocusOut : undefined }, !listTakesFocus && this.renderPanelSearch(), list));
|
|
4020
|
+
}
|
|
4021
|
+
/**
|
|
4022
|
+
* The listbox's items. Each optgroup's options sit in a `group` named for it, as in
|
|
4023
|
+
* `pds-multiselect`, so assistive tech announces the group on entering it; a `pds-text` label
|
|
4024
|
+
* stays a caption above the options that follow it.
|
|
4025
|
+
*/
|
|
4026
|
+
renderListboxItems(setSize) {
|
|
4027
|
+
const rendered = [];
|
|
4028
|
+
let optionIndex = 0;
|
|
4029
|
+
let group = null;
|
|
4030
|
+
const closeGroup = () => {
|
|
4031
|
+
if (group === null)
|
|
4032
|
+
return;
|
|
4033
|
+
const { optgroup, key, options, members } = group;
|
|
4034
|
+
const groupIcon = groupIconOf(optgroup);
|
|
4035
|
+
const badge = groupBadgeOf(optgroup);
|
|
4036
|
+
// As in the grouped displays: disabled when there's nothing left in it to choose.
|
|
4037
|
+
const disabled = members.length > 0 && members.every(member => isOptionDisabled(member));
|
|
4038
|
+
rendered.push(h("li", { key: key, class: { 'pds-combobox__group': true, 'pds-combobox__group--disabled': disabled }, role: "group", "aria-label": badge === null ? optgroup.label : `${optgroup.label}, ${badge.label}`, "aria-disabled": disabled ? 'true' : undefined }, h("div", { class: {
|
|
4039
|
+
'pds-combobox__group-label': true,
|
|
4040
|
+
'pds-combobox__group-label--with-icon': groupIcon !== null,
|
|
4041
|
+
'pds-combobox__group-label--with-badge': badge !== null,
|
|
4042
|
+
}, "aria-hidden": "true" }, groupIcon !== null && (
|
|
4043
|
+
// `name`, not `icon`: `icon` also loads URLs and data: SVGs, unsanitized.
|
|
4044
|
+
h("pds-icon", { name: groupIcon, size: "small", "aria-hidden": "true", class: "pds-combobox__group-icon" })), badge === null ? optgroup.label : h("span", { class: "pds-combobox__group-label-text" }, optgroup.label), this.renderBadge(badge, 'pds-combobox__group-badge')), h("ul", { class: "pds-combobox__group-list", role: "presentation" }, options)));
|
|
4045
|
+
group = null;
|
|
4046
|
+
};
|
|
4047
|
+
this.filteredItems.forEach((item, itemIdx) => {
|
|
4048
|
+
if (item.tagName === 'OPTGROUP') {
|
|
4049
|
+
closeGroup();
|
|
4050
|
+
group = { optgroup: item, key: `optgroup-${itemIdx}`, options: [], members: [] };
|
|
4051
|
+
}
|
|
4052
|
+
else if (item.tagName === 'PDS-TEXT') {
|
|
4053
|
+
closeGroup();
|
|
4054
|
+
rendered.push(h("li", { key: `pds-text-${itemIdx}`, class: "pds-combobox__group-label", role: "presentation" }, item.textContent));
|
|
4055
|
+
}
|
|
4056
|
+
else if (item.tagName === 'OPTION') {
|
|
4057
|
+
const option = item;
|
|
4058
|
+
if (group !== null && parentOptgroupOf(option) !== group.optgroup)
|
|
4059
|
+
closeGroup();
|
|
4060
|
+
const rendering = this.renderOption(option, optionIndex, { posinset: optionIndex + 1, setsize: setSize });
|
|
4061
|
+
optionIndex++;
|
|
4062
|
+
if (group !== null) {
|
|
4063
|
+
group.options.push(rendering);
|
|
4064
|
+
group.members.push(option);
|
|
4065
|
+
}
|
|
4066
|
+
else {
|
|
4067
|
+
rendered.push(rendering);
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
});
|
|
4071
|
+
closeGroup();
|
|
4072
|
+
return rendered;
|
|
4073
|
+
}
|
|
4074
|
+
/** `panelSearch` applies to the triggers that can't be typed into. */
|
|
4075
|
+
get usesPanelSearch() {
|
|
4076
|
+
return this.panelSearch && this.trigger !== 'input';
|
|
4077
|
+
}
|
|
4078
|
+
/** `groupDisplay`, with `flyout` drilling in when there's no room beside the dropdown. */
|
|
4079
|
+
get effectiveGroupDisplay() {
|
|
4080
|
+
return this.groupDisplay === 'flyout' && this.flyoutFallback ? 'drill-in' : this.groupDisplay;
|
|
4081
|
+
}
|
|
4082
|
+
/**
|
|
4083
|
+
* The popup's role, for the triggers' `aria-haspopup`: a `tree` while the grouped panel shows
|
|
4084
|
+
* groups, and a `listbox` of options otherwise, search results included.
|
|
4085
|
+
*/
|
|
4086
|
+
get popupRole() {
|
|
4087
|
+
return this.showsGroupedPanel ? 'tree' : 'listbox';
|
|
4088
|
+
}
|
|
4089
|
+
/**
|
|
4090
|
+
* The input trigger's `aria-haspopup`. While closed it names what opening shows: the full list,
|
|
4091
|
+
* so the grouped panel in a grouped display, even though the input still holds the selection's
|
|
4092
|
+
* label.
|
|
4093
|
+
*/
|
|
4094
|
+
get inputPopupRole() {
|
|
4095
|
+
if (this.isOpen)
|
|
4096
|
+
return this.popupRole;
|
|
4097
|
+
return this.effectiveGroupDisplay === 'inline' ? 'listbox' : 'tree';
|
|
4098
|
+
}
|
|
4099
|
+
/**
|
|
4100
|
+
* The button and chip triggers' `aria-haspopup`. With panel search the trigger opens the panel,
|
|
4101
|
+
* which starts as a tree in a grouped display, so typing in the panel doesn't change it.
|
|
4102
|
+
*/
|
|
4103
|
+
get triggerPopupRole() {
|
|
4104
|
+
if (!this.usesPanelSearch)
|
|
4105
|
+
return this.popupRole;
|
|
4106
|
+
return this.groupDisplay === 'inline' ? 'listbox' : 'tree';
|
|
4107
|
+
}
|
|
4108
|
+
/**
|
|
4109
|
+
* Drilled into a group with panel search: the group's row back takes the search field's place,
|
|
4110
|
+
* since one group's options don't need searching. Typing searches the whole list again.
|
|
4111
|
+
*/
|
|
4112
|
+
get hidesPanelSearch() {
|
|
4113
|
+
return this.usesPanelSearch && this.showsGroupedPanel && this.effectiveGroupDisplay === 'drill-in' && this.openGroup !== null;
|
|
4114
|
+
}
|
|
4115
|
+
/** The grouped panel is showing groups rather than search results. */
|
|
4116
|
+
get showsGroupedPanel() {
|
|
4117
|
+
if (this.effectiveGroupDisplay === 'inline')
|
|
4118
|
+
return false;
|
|
4119
|
+
const searching = this.usesPanelSearch
|
|
4120
|
+
? this.panelQuery !== ''
|
|
4121
|
+
: this.mode === 'filter' && !this.expandFilterListWhileOpen && this.displayText !== '';
|
|
4122
|
+
return !searching;
|
|
4123
|
+
}
|
|
4124
|
+
setPanelQuery(query) {
|
|
4125
|
+
this.panelQuery = query;
|
|
4126
|
+
this.clearExpandFilterList();
|
|
4127
|
+
this.filterOptions();
|
|
4128
|
+
this.pdsComboboxSearch.emit({ query: this.panelQuery });
|
|
4129
|
+
if (this.asyncUrl !== undefined && this.asyncUrl !== '') {
|
|
4130
|
+
this.debouncedFetchAsyncOptions(this.panelQuery, 1);
|
|
4131
|
+
}
|
|
4132
|
+
// The list changes size, so place the dropdown again, as typing in the input trigger does.
|
|
4133
|
+
setTimeout(() => this.openDropdownPositioning(), 0);
|
|
4134
|
+
}
|
|
4135
|
+
/** What's being searched: the panel's field, or the input trigger's text. */
|
|
4136
|
+
get activeQuery() {
|
|
4137
|
+
return this.usesPanelSearch ? this.panelQuery : this.displayText;
|
|
4138
|
+
}
|
|
4139
|
+
// Tab closes the dropdown and lands on the trigger, as Escape does: the focused field or list is
|
|
4140
|
+
// about to unmount, so the browser can't tab on from it. The next Tab continues from the trigger.
|
|
4141
|
+
handlePanelTab(event) {
|
|
4142
|
+
if (event.key !== 'Tab')
|
|
4143
|
+
return false;
|
|
4144
|
+
event.preventDefault();
|
|
4145
|
+
this.handleKeyDown(event);
|
|
4146
|
+
this.restoreFocusToTrigger();
|
|
4147
|
+
return true;
|
|
4148
|
+
}
|
|
4149
|
+
/** Returns from a drilled-in group to the group list; false when not drilled in. */
|
|
4150
|
+
leaveDrilledInGroup() {
|
|
4151
|
+
if (!this.showsGroupedPanel || this.effectiveGroupDisplay !== 'drill-in' || this.openGroup === null)
|
|
4152
|
+
return false;
|
|
4153
|
+
this.collapseToGroup(this.openGroup);
|
|
4154
|
+
return true;
|
|
4155
|
+
}
|
|
4156
|
+
renderPanelSearch() {
|
|
4157
|
+
return (h("div", { key: "panel-search", class: {
|
|
4158
|
+
'pds-combobox__panel-search': true,
|
|
4159
|
+
// Coming back from a group, the search field slides in with the groups.
|
|
4160
|
+
'pds-combobox__panel-search--drill-out': this.drillDirection === 'out',
|
|
4161
|
+
} }, h("pds-icon", { name: "search", size: "regular", "aria-hidden": "true" }), h("input", { ref: el => (this.panelSearchEl = el), type: "text", class: "pds-combobox__panel-search-input", placeholder: this.searchPlaceholder, value: this.panelQuery, role: "combobox", "aria-label": this.searchOptionsLabel, "aria-haspopup": this.popupRole, "aria-controls": this.listboxId, "aria-autocomplete": "list", "aria-expanded": "true", "aria-activedescendant": this.activeDescendantId, autocomplete: "off", onInput: this.onPanelSearchInput, onKeyDown: this.onPanelSearchKeyDown })));
|
|
4162
|
+
}
|
|
4163
|
+
/**
|
|
4164
|
+
* An option, as a listbox `option` or, given a tree `level`, a `treeitem`. `posinset` and
|
|
4165
|
+
* `setsize` place it among its siblings.
|
|
4166
|
+
*/
|
|
4167
|
+
renderOption(option, index, { posinset, setsize, level }) {
|
|
4168
|
+
const isSelected = this.isOptionSelected(option);
|
|
4169
|
+
const isHighlighted = this.highlightedIndex === index;
|
|
4170
|
+
const isLayout = this.isOptionLayout(option);
|
|
4171
|
+
const isChip = this.isOptionChip(option);
|
|
4172
|
+
const isDisabled = isOptionDisabled(option);
|
|
4173
|
+
const tree = level !== undefined;
|
|
4174
|
+
const badge = isLayout || isChip ? null : optionBadgeOf(option);
|
|
4175
|
+
return (h("li", { key: option.value, id: this.optionDomId(index), role: tree ? 'treeitem' : 'option', "aria-selected": isSelected ? 'true' : tree ? undefined : 'false', "aria-disabled": isDisabled ? 'true' : undefined, "aria-level": level, "aria-setsize": setsize, "aria-posinset": posinset, "aria-label": isLayout || isChip
|
|
4176
|
+
? option.getAttribute('aria-label') || this.getOptionLabel(option)
|
|
4177
|
+
: badge && `${this.getOptionLabel(option)}, ${badge.label}`, tabindex: this.usesBodyPortal || this.usesPanelSearch || tree ? '-1' : isHighlighted ? '0' : '-1', class: {
|
|
4178
|
+
'pds-combobox__option': true,
|
|
4179
|
+
'pds-combobox__option--highlighted': isHighlighted,
|
|
4180
|
+
// The keyboard's place, as on the group rows (`--keyboard`).
|
|
4181
|
+
'pds-combobox__option--keyboard': isHighlighted && this.keyboardNavigating,
|
|
4182
|
+
'pds-combobox__option--layout': isLayout,
|
|
4183
|
+
'pds-combobox__option--chip': isChip,
|
|
4184
|
+
'pds-combobox__option--disabled': isDisabled,
|
|
4185
|
+
'pds-combobox__option--with-badge': badge !== null,
|
|
4186
|
+
}, "data-option-index": index, onMouseDown: this.onOptionMouseDown, onClick: this.onOptionClick, onMouseEnter: this.onOptionMouseEnter, onKeyDown: this.onOptionKeyDown }, isLayout ? (h("pds-box", { class: "pds-combobox__option-layout-wrapper", innerHTML: this.getOptionLayoutContent(option) })) : isChip ? (this.renderOptionChip(option)) : ([this.renderOptionLabel(option), this.renderOptionBadge(option)]), isSelected && h("pds-icon", { icon: "check", size: "regular", "aria-hidden": "true", class: "pds-combobox__option-check" })));
|
|
4187
|
+
}
|
|
4188
|
+
/** Copies an `options` badge to an option's or optgroup's `data-badge*` attributes; only strings count. */
|
|
4189
|
+
setBadgeAttributes(element, badge) {
|
|
4190
|
+
if (typeof badge !== 'object' || badge === null)
|
|
4191
|
+
return;
|
|
4192
|
+
const { label, sentiment, icon } = badge;
|
|
4193
|
+
if (typeof label !== 'string' || label.trim() === '')
|
|
4194
|
+
return;
|
|
4195
|
+
element.setAttribute('data-badge', label);
|
|
4196
|
+
if (typeof sentiment === 'string')
|
|
4197
|
+
element.setAttribute('data-badge-sentiment', sentiment);
|
|
4198
|
+
if (typeof icon === 'string')
|
|
4199
|
+
element.setAttribute('data-badge-icon', icon);
|
|
4200
|
+
}
|
|
4201
|
+
/** An option's badge, after its text. */
|
|
4202
|
+
renderOptionBadge(option) {
|
|
4203
|
+
return this.renderBadge(optionBadgeOf(option), 'pds-combobox__option-badge');
|
|
4204
|
+
}
|
|
4205
|
+
/** A badge as a `pds-chip`: after an option's text, or a group's label. */
|
|
4206
|
+
renderBadge(badge, className) {
|
|
4207
|
+
var _a;
|
|
4208
|
+
if (badge === null)
|
|
4209
|
+
return null;
|
|
4210
|
+
return (h("pds-chip", { size: "sm", sentiment: badge.sentiment,
|
|
4211
|
+
// A Pine icon name only, checked by optionBadgeOf; pds-chip's `icon` also loads URLs.
|
|
4212
|
+
icon: (_a = badge.icon) !== null && _a !== void 0 ? _a : undefined,
|
|
4213
|
+
// A long label, often a translated one, truncates rather than squeezing the option's text.
|
|
4214
|
+
maxWidth: "50%", class: className }, badge.label));
|
|
4215
|
+
}
|
|
4216
|
+
/**
|
|
4217
|
+
* An option's text, after its `data-icon` when it has one. Beside a badge the text is always
|
|
4218
|
+
* wrapped, so it can shrink and wrap rather than push the badge out of the row.
|
|
4219
|
+
*/
|
|
4220
|
+
renderOptionLabel(option) {
|
|
4221
|
+
const icon = optionIconOf(option);
|
|
4222
|
+
const label = this.truncate ? (h("span", { key: this.getOptionLabel(option), class: "pds-combobox__option-text" }, this.getOptionLabel(option))) : this.getOptionLabel(option);
|
|
4223
|
+
if (icon === null) {
|
|
4224
|
+
return optionBadgeOf(option) === null ? label : h("span", { class: "pds-combobox__option-label" }, label);
|
|
4225
|
+
}
|
|
4226
|
+
return (h("span", { class: "pds-combobox__option-label" }, h("pds-icon", { name: icon, size: "regular", "aria-hidden": "true", class: "pds-combobox__option-icon" }), label));
|
|
4227
|
+
}
|
|
4228
|
+
/** The grouped panel's rows, in the order the panel draws them and the keyboard moves through. */
|
|
4229
|
+
panelEntries() {
|
|
4230
|
+
// Slotted markup is already in order; only options from data record positions.
|
|
4231
|
+
if (this.options === undefined && !this.asyncUrl)
|
|
4232
|
+
return buildPanelEntries(this.filteredItems);
|
|
4233
|
+
return buildPanelEntries(this.filteredItems, element => this.panelPositions.get(element));
|
|
4234
|
+
}
|
|
4235
|
+
/**
|
|
4236
|
+
* `flyout`: one row per group, its options in a flyout beside it. `drill-in`: the same rows, and
|
|
4237
|
+
* an opened group replaces them with its row, drawn as a row back, above its options. Either way
|
|
4238
|
+
* it's a tree: the rows and ungrouped options are level 1, a group's options level 2.
|
|
4239
|
+
*/
|
|
4240
|
+
renderGroupedPanel() {
|
|
4241
|
+
const entries = this.panelEntries();
|
|
4242
|
+
const setsize = entries.length;
|
|
4243
|
+
const drilled = this.drilledInEntry(entries);
|
|
4244
|
+
if (drilled)
|
|
4245
|
+
return this.renderGroupBackRow(drilled.group, { posinset: drilled.position + 1, setsize });
|
|
4246
|
+
this.renderedGroups = [];
|
|
4247
|
+
return entries.map((entry, position) => {
|
|
4248
|
+
const placement = { posinset: position + 1, setsize };
|
|
4249
|
+
if (entry.kind === 'option')
|
|
4250
|
+
return this.renderOption(entry.option, entry.index, Object.assign(Object.assign({}, placement), { level: 1 }));
|
|
4251
|
+
this.renderedGroups.push(entry.group);
|
|
4252
|
+
return this.renderGroupRow(entry.group, this.renderedGroups.length - 1, placement);
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4255
|
+
/** A group's options, as its children in the tree. */
|
|
4256
|
+
renderGroupOptions(group) {
|
|
4257
|
+
return group.options.map(({ option, index }, position) => this.renderOption(option, index, { posinset: position + 1, setsize: group.options.length, level: 2 }));
|
|
4258
|
+
}
|
|
4259
|
+
/**
|
|
4260
|
+
* Drilled into a group: its treeitem, expanded. Its row reads as a way back ("Back: Tag") and
|
|
4261
|
+
* leads its options. It leaves out the group's badge: the row is a way back, not a group to
|
|
4262
|
+
* choose, and the badge was on the row that opened it. An option's own badge still shows.
|
|
4263
|
+
*/
|
|
4264
|
+
renderGroupBackRow(group, { posinset, setsize }) {
|
|
4265
|
+
const id = this.groupDomId(group.optgroup);
|
|
4266
|
+
const disabled = isGroupDisabled(group);
|
|
4267
|
+
return (h("li", { key: "group-back", id: id, class: {
|
|
4268
|
+
'pds-combobox__group-back': true,
|
|
4269
|
+
'pds-combobox__group-back--disabled': disabled,
|
|
4270
|
+
// As the group rows: shaded for the keys, and by `:hover` for the pointer.
|
|
4271
|
+
'pds-combobox__group-back--highlighted': this.keyboardNavigating && this.highlightedGroupRow === group.optgroup,
|
|
4272
|
+
'pds-combobox__group-back--keyboard': this.keyboardNavigating && this.highlightedGroupRow === group.optgroup,
|
|
4273
|
+
}, role: "treeitem", "aria-expanded": "true", "aria-disabled": disabled ? 'true' : undefined, "aria-level": 1, "aria-posinset": posinset, "aria-setsize": setsize, "aria-labelledby": `${id}-label` }, h("div", { class: "pds-combobox__group-row-trigger pds-combobox__group-back-trigger", onMouseDown: this.onOptionMouseDown, onMouseEnter: this.onGroupBackMouseEnter, onClick: this.onGroupBackClick }, h("span", { class: "pds-combobox__group-row-label", id: `${id}-label` }, h("pds-icon", { name: "caret-left", size: "regular", "aria-hidden": "true", class: "pds-combobox__group-row-caret" }), h("span", { class: "visually-hidden" }, this.drillInBackLabel, ": "), group.label)), h("ul", { class: "pds-combobox__drill-in-options", role: "group", "aria-label": group.label, onScroll: this.handleScroll }, this.renderLoadingRow(), this.renderGroupOptions(group), this.renderLoadMoreRow())));
|
|
4274
|
+
}
|
|
4275
|
+
renderGroupRow(group, groupIndex, { posinset, setsize }) {
|
|
4276
|
+
const flyout = this.effectiveGroupDisplay === 'flyout';
|
|
4277
|
+
const isOpen = flyout && this.openGroup === group.optgroup;
|
|
4278
|
+
// `--has-selection` is a state hook only (tests read it), not styled. The fill follows
|
|
4279
|
+
// `--highlighted` (always in flyout, in drill-in only for the keys) and a flyout's `--open` row.
|
|
4280
|
+
const hasSelection = flyout && group.options.some(({ option }) => this.isOptionSelected(option));
|
|
4281
|
+
const isCurrent = this.highlightedGroupRow === group.optgroup;
|
|
4282
|
+
const disabled = isGroupDisabled(group);
|
|
4283
|
+
const id = this.groupDomId(group.optgroup);
|
|
4284
|
+
return (h("li", { key: `group-${groupIndex}`, id: id, class: {
|
|
4285
|
+
'pds-combobox__group-row': true,
|
|
4286
|
+
'pds-combobox__group-row--open': isOpen,
|
|
4287
|
+
'pds-combobox__group-row--has-selection': hasSelection,
|
|
4288
|
+
'pds-combobox__group-row--highlighted': isCurrent && (flyout || this.keyboardNavigating),
|
|
4289
|
+
'pds-combobox__group-row--keyboard': isCurrent && this.keyboardNavigating,
|
|
4290
|
+
'pds-combobox__group-row--disabled': disabled,
|
|
4291
|
+
}, role: "treeitem", "aria-expanded": isOpen ? 'true' : 'false', "aria-disabled": disabled ? 'true' : undefined, "aria-level": 1, "aria-posinset": posinset, "aria-setsize": setsize, "aria-labelledby": group.badge === null ? `${id}-label` : undefined, "aria-label": group.badge === null ? undefined : `${group.label}, ${group.badge.label}`, "data-group-index": groupIndex, onMouseEnter: flyout ? this.onGroupRowMouseEnter : undefined, onMouseLeave: flyout ? this.onGroupRowMouseLeave : undefined }, h("div", { class: "pds-combobox__group-row-trigger", "data-group-index": groupIndex, onMouseDown: this.onOptionMouseDown, onMouseEnter: this.onGroupRowTriggerMouseEnter, onClick: this.onGroupRowClick }, h("span", { class: "pds-combobox__group-row-label", id: `${id}-label` }, group.icon !== null && (
|
|
4292
|
+
// `name`, not `icon`: `icon` also loads URLs and data: SVGs, unsanitized.
|
|
4293
|
+
h("pds-icon", { name: group.icon, size: "regular", "aria-hidden": "true", class: "pds-combobox__group-icon" })), group.label), this.renderBadge(group.badge, 'pds-combobox__group-badge'), h("pds-icon", { name: "caret-right", size: "regular", "aria-hidden": "true", class: "pds-combobox__group-row-caret" })), isOpen && (h("ul", { class: "pds-combobox__flyout", role: "group", "aria-label": group.label, style: { minWidth: this.flyoutMinWidth, maxWidth: this.flyoutMaxWidth } }, this.renderGroupOptions(group)))));
|
|
4294
|
+
}
|
|
4295
|
+
// Helper method to render the caret icon
|
|
4296
|
+
renderCaretIcon() {
|
|
4297
|
+
return h("pds-icon", { icon: "caret-down", "aria-hidden": "true", class: "pds-combobox__button-trigger-chevron" });
|
|
4298
|
+
}
|
|
4299
|
+
// Helper method to render layout content
|
|
4300
|
+
renderLayoutContent() {
|
|
4301
|
+
return (h("div", { class: "pds-combobox__button-trigger-layout-wrapper", innerHTML: this.selectedLayoutContent }));
|
|
4302
|
+
}
|
|
4303
|
+
// Helper method to render default text content
|
|
4304
|
+
renderDefaultContent() {
|
|
4305
|
+
const icon = this.selectedIcon;
|
|
4306
|
+
return (h("span", { class: {
|
|
4307
|
+
'pds-combobox__button-trigger-label': true,
|
|
4308
|
+
'pds-combobox__button-trigger-label--placeholder': !this.selectedLabel,
|
|
4309
|
+
'pds-combobox__button-trigger-label--with-icon': icon !== null,
|
|
4310
|
+
'pds-combobox__button-trigger-label--value-in': icon !== null && this.fadesValueIn,
|
|
4311
|
+
} }, icon !== null && (
|
|
4312
|
+
// `name`, not `icon`: `icon` also loads URLs and data: SVGs, unsanitized.
|
|
4313
|
+
h("pds-icon", { name: icon, size: "regular", "aria-hidden": "true", class: "pds-combobox__button-trigger-icon" })), this.truncate ? (
|
|
4314
|
+
// Keyed so a new label drops a stale `title`.
|
|
4315
|
+
h("span", { key: this.selectedLabel || this.placeholder, class: "pds-combobox__button-trigger-text" }, this.selectedLabel || this.placeholder)) : (this.selectedLabel || this.placeholder)));
|
|
4316
|
+
}
|
|
4317
|
+
/** The selection's icon for the button trigger: the option's own, or else its group's. */
|
|
4318
|
+
get selectedIcon() {
|
|
4319
|
+
var _a;
|
|
4320
|
+
const option = this.selectedOption;
|
|
4321
|
+
if (!option)
|
|
4322
|
+
return null;
|
|
4323
|
+
const optgroup = parentOptgroupOf(option);
|
|
4324
|
+
return (_a = optionIconOf(option)) !== null && _a !== void 0 ? _a : (optgroup !== null ? groupIconOf(optgroup) : null);
|
|
4325
|
+
}
|
|
4326
|
+
// Helper method to check if we should show layout content
|
|
4327
|
+
shouldShowLayoutContent() {
|
|
4328
|
+
return this.selectedHasLayout && !!this.selectedLayoutContent;
|
|
4329
|
+
}
|
|
4330
|
+
// Helper method to build chip trigger CSS classes
|
|
4331
|
+
getChipTriggerClass() {
|
|
4332
|
+
const classes = ['pds-combobox__chip-trigger'];
|
|
4333
|
+
// Add sentiment class
|
|
4334
|
+
classes.push(`pds-combobox__chip-trigger--${this.selectedChipSentiment}`);
|
|
4335
|
+
// Always use dropdown variant for chip triggers
|
|
4336
|
+
classes.push('pds-combobox__chip-trigger--dropdown');
|
|
4337
|
+
// Add large class if needed
|
|
4338
|
+
if (this.selectedChipLarge) {
|
|
4339
|
+
classes.push('pds-combobox__chip-trigger--large');
|
|
4340
|
+
}
|
|
4341
|
+
// Add dot class if needed
|
|
4342
|
+
if (this.selectedChipDot) {
|
|
4343
|
+
classes.push('pds-combobox__chip-trigger--dot');
|
|
4344
|
+
}
|
|
4345
|
+
return classes.join(' ');
|
|
4346
|
+
}
|
|
4347
|
+
renderButtonTriggerContent() {
|
|
4348
|
+
// Case 1: Custom trigger content with layout priority
|
|
4349
|
+
if (this.customTriggerContent) {
|
|
4350
|
+
if (this.shouldShowLayoutContent()) {
|
|
4351
|
+
return [this.renderLayoutContent(), this.renderCaretIcon()];
|
|
4352
|
+
}
|
|
4353
|
+
// Fall back to slot content when no layout is available
|
|
4354
|
+
return h("slot", { name: "trigger-content" });
|
|
4355
|
+
}
|
|
4356
|
+
// Case 2: Standard mode with layout content
|
|
4357
|
+
if (this.shouldShowLayoutContent()) {
|
|
4358
|
+
return [this.renderLayoutContent(), this.renderCaretIcon()];
|
|
4359
|
+
}
|
|
4360
|
+
// Case 3: Standard mode with default text content
|
|
4361
|
+
return [this.renderDefaultContent(), this.renderCaretIcon()];
|
|
4362
|
+
}
|
|
4363
|
+
renderChipTriggerContent() {
|
|
4364
|
+
// Case 1: Custom trigger content with layout priority
|
|
4365
|
+
if (this.customTriggerContent) {
|
|
4366
|
+
if (this.shouldShowLayoutContent()) {
|
|
4367
|
+
// When using custom layouts, the chip handles its own dropdown arrow
|
|
4368
|
+
return this.renderChipTriggerLayoutContent();
|
|
4369
|
+
}
|
|
4370
|
+
// Fall back to slot content when no layout is available - chip handles its own dropdown arrow
|
|
4371
|
+
return h("slot", { name: "trigger-content" });
|
|
4372
|
+
}
|
|
4373
|
+
// Case 2: Standard mode with layout content
|
|
4374
|
+
if (this.shouldShowLayoutContent()) {
|
|
4375
|
+
// When using custom layouts, the chip handles its own dropdown arrow
|
|
4376
|
+
return this.renderChipTriggerLayoutContent();
|
|
4377
|
+
}
|
|
4378
|
+
// Case 3: Automatic chip mode - selected option has chip attributes
|
|
4379
|
+
if (this.selectedOption && this.selectedOptionChipProps) {
|
|
4380
|
+
// Render as chip automatically - chip handles its own dropdown arrow
|
|
4381
|
+
return this.renderSelectedOptionAsChip();
|
|
4382
|
+
}
|
|
4383
|
+
// Case 4: Standard mode with default text content
|
|
4384
|
+
return [
|
|
4385
|
+
this.renderChipTriggerDefaultContent(),
|
|
4386
|
+
this.renderCaretIcon()
|
|
4387
|
+
];
|
|
4388
|
+
}
|
|
4389
|
+
// Helper method to render selected option as chip for trigger (automatic approach)
|
|
4390
|
+
renderSelectedOptionAsChip() {
|
|
4391
|
+
if (!this.selectedOption || !this.selectedOptionChipProps)
|
|
4392
|
+
return null;
|
|
4393
|
+
return (h("pds-chip", { sentiment: this.selectedOptionChipProps.sentiment, variant: "dropdown" // Always use dropdown variant for triggers
|
|
4394
|
+
,
|
|
4395
|
+
size: this.selectedOptionChipProps.large ? 'lg' : undefined, icon: this.selectedOptionChipProps.icon, dot: this.selectedOptionChipProps.dot, class: "pds-combobox__chip-trigger-auto" }, this.getOptionLabel(this.selectedOption)));
|
|
4396
|
+
}
|
|
4397
|
+
// Helper method to render chip trigger layout content
|
|
4398
|
+
renderChipTriggerLayoutContent() {
|
|
4399
|
+
return (h("div", { class: "pds-combobox__chip-trigger-layout-wrapper", innerHTML: this.getModifiedLayoutContentForTrigger() }));
|
|
4400
|
+
}
|
|
4401
|
+
// Helper method to modify layout content for trigger use (ensure dropdown variant)
|
|
4402
|
+
getModifiedLayoutContentForTrigger() {
|
|
4403
|
+
let content = this.selectedLayoutContent;
|
|
4404
|
+
// If the content contains a pds-chip, ensure it has variant="dropdown"
|
|
4405
|
+
if (content.includes('<pds-chip')) {
|
|
4406
|
+
// Use a temporary div to parse and modify the HTML
|
|
4407
|
+
const tempDiv = document.createElement('div');
|
|
4408
|
+
tempDiv.innerHTML = content;
|
|
4409
|
+
const chipElement = tempDiv.querySelector('pds-chip');
|
|
4410
|
+
if (chipElement) {
|
|
4411
|
+
chipElement.setAttribute('variant', 'dropdown');
|
|
4412
|
+
content = tempDiv.innerHTML;
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
return content;
|
|
4416
|
+
}
|
|
4417
|
+
// Helper method to render chip trigger default content
|
|
4418
|
+
renderChipTriggerDefaultContent() {
|
|
4419
|
+
return (h("span", { class: "pds-combobox__chip-trigger-label" }, this.selectedChipIcon && h("pds-icon", { icon: this.selectedChipIcon, "aria-hidden": "true", class: "pds-combobox__chip-trigger-icon" }), this.selectedLabel || this.placeholder));
|
|
4420
|
+
}
|
|
4421
|
+
// Helper method to render option as chip (new automatic approach)
|
|
4422
|
+
renderOptionChip(option) {
|
|
4423
|
+
const chipProps = this.getOptionChipProps(option);
|
|
4424
|
+
return (h("pds-chip", { sentiment: chipProps.sentiment, variant: "text" // Dropdown options use text variant, not dropdown
|
|
4425
|
+
,
|
|
4426
|
+
size: chipProps.large ? 'lg' : undefined, icon: chipProps.icon, dot: chipProps.dot, class: "pds-combobox__option-chip" }, this.getOptionLabel(option)));
|
|
4427
|
+
}
|
|
4428
|
+
// Mirrors pds-multiselect and pds-select: an error message on its own puts the
|
|
4429
|
+
// field in an invalid state, so assistive tech agrees with the visual treatment.
|
|
4430
|
+
isInvalid() {
|
|
4431
|
+
return Boolean(this.invalid) || Boolean(this.errorMessage);
|
|
4432
|
+
}
|
|
4433
|
+
renderMessages() {
|
|
4434
|
+
const hasErrorMessage = Boolean(this.errorMessage);
|
|
4435
|
+
const showHelperMessage = Boolean(this.helperMessage) && !hasErrorMessage;
|
|
4436
|
+
return [
|
|
4437
|
+
showHelperMessage && (h("p", { class: "pds-combobox__helper", id: messageId(this.componentId, 'helper') }, this.helperMessage)),
|
|
4438
|
+
hasErrorMessage && (h("p", { class: "pds-combobox__error", id: messageId(this.componentId, 'error'), "aria-live": "assertive" }, h("pds-icon", { icon: "danger", size: "small", "aria-hidden": "true" }), this.errorMessage)),
|
|
4439
|
+
];
|
|
4440
|
+
}
|
|
4441
|
+
render() {
|
|
4442
|
+
var _a;
|
|
4443
|
+
const triggerClass = [
|
|
4444
|
+
'pds-combobox__button-trigger',
|
|
4445
|
+
`pds-combobox__button-trigger--${this.triggerVariant}`,
|
|
4446
|
+
this.triggerShape === 'input' && 'pds-combobox__button-trigger--input-shape',
|
|
4447
|
+
this.truncate && 'pds-combobox__button-trigger--truncate',
|
|
4448
|
+
]
|
|
4449
|
+
.filter(Boolean)
|
|
4450
|
+
.join(' ');
|
|
4451
|
+
return (h(Host, { key: '3a7f09752d2dff0fbf653852cd9ea474a44c61d5', "aria-disabled": this.disabled ? 'true' : null }, h("div", { key: '56d3bf86655abfd945228ee0bc3a556a6ad766b3', class: "pds-combobox", tabIndex: -1, onFocusout: this.onComboboxFocusOut, part: "combobox" }, this.hasVisibleLabel && (h("label", { key: 'a07f37d62bca1b15df3aa258d94c0df4609b93b3', htmlFor: this.trigger === 'input' ? this.componentId : undefined, id: this.labelId, class: "pds-combobox__label", onClick: this.onLabelClick }, this.label)), this.trigger === 'input' ? (h("div", { class: "pds-combobox__input-wrapper", style: { width: this.triggerWidth } }, h("input", { ref: el => {
|
|
4452
|
+
this.inputEl = el;
|
|
4453
|
+
this.triggerEl = el;
|
|
4454
|
+
}, class: {
|
|
4455
|
+
'pds-combobox__input': true,
|
|
4456
|
+
'pds-combobox__input--invalid': this.isInvalid(),
|
|
4457
|
+
}, type: "text", role: "combobox", "aria-autocomplete": "list", "aria-haspopup": this.inputPopupRole === 'tree' ? 'tree' : undefined, "aria-controls": this.listboxId, "aria-describedby": assignDescription(this.componentId, this.isInvalid(), this.helperMessage, this.errorMessage), "aria-invalid": this.isInvalid() ? 'true' : undefined, "aria-activedescendant": this.usesPanelSearch ? undefined : this.activeDescendantId, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, id: this.componentId, value: this.displayText, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleInput, onClick: this.handleInputClick, onKeyDown: this.handleKeyDown, autocomplete: "off", part: "input" }), h("pds-icon", { icon: "enlarge", "aria-hidden": "true", class: "pds-combobox__input-icon" }))) : this.trigger === 'chip' ? (h("div", { class: this.getChipTriggerClass(), style: { width: this.triggerWidth }, role: this.usesPanelSearch ? 'button' : 'combobox', "aria-haspopup": this.triggerPopupRole, "aria-controls": this.listboxId, "aria-describedby": assignDescription(this.componentId, this.isInvalid(), this.helperMessage, this.errorMessage), "aria-invalid": this.isInvalid() ? 'true' : undefined, "aria-activedescendant": this.usesPanelSearch ? undefined : this.activeDescendantId, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.triggerAriaLabel, "aria-labelledby": this.triggerLabelledBy, id: this.componentId, tabIndex: this.disabled ? -1 : 0, onClick: this.onButtonTriggerClick, "data-layout": this.customTriggerContent, onKeyDown: this.onButtonTriggerKeyDown, onKeyUp: this.onButtonTriggerKeyUp, ref: el => (this.triggerEl = el), part: "chip-trigger" }, this.renderChipTriggerContent())) : (h("div", { class: triggerClass, style: { width: this.triggerWidth }, role: this.usesPanelSearch ? 'button' : 'combobox', "aria-haspopup": this.triggerPopupRole, "aria-controls": this.listboxId, "aria-describedby": assignDescription(this.componentId, this.isInvalid(), this.helperMessage, this.errorMessage), "aria-invalid": this.isInvalid() ? 'true' : undefined, "aria-activedescendant": this.usesPanelSearch ? undefined : this.activeDescendantId, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.triggerAriaLabel, "aria-labelledby": this.triggerLabelledBy, id: this.componentId, tabIndex: this.disabled ? -1 : 0, onClick: this.onButtonTriggerClick, "data-layout": this.customTriggerContent, onKeyDown: this.onButtonTriggerKeyDown, onKeyUp: this.onButtonTriggerKeyUp, onMouseEnter: this.truncate ? this.onButtonTriggerMouseEnter : undefined, ref: el => (this.triggerEl = el), part: "button-trigger" }, this.renderButtonTriggerContent())), this.renderMessages(), h("div", { key: '0c0accd76b79aba9fa3072eb68800102d458d0a7', style: { display: 'none' } }, h("slot", { key: 'be9cc4c897788342bbc96321f033ed4fd97e80ff', onSlotchange: () => this.updateOptions() })), this.renderDropdown(), this.groupDisplay !== 'inline' && [
|
|
4458
|
+
h("span", { key: "drill-status", class: "visually-hidden", role: "status", "aria-live": "polite" }, this.isOpen && this.effectiveGroupDisplay === 'drill-in' && this.openGroup !== null ? this.openGroup.label : ''),
|
|
4459
|
+
// Its own region: sharing one, revealing a row then opening it would leave the text the
|
|
4460
|
+
// same, and opening the group would go unannounced.
|
|
4461
|
+
h("span", { key: "reveal-status", class: "visually-hidden", role: "status", "aria-live": "polite" }, this.isOpen ? (_a = this.revealedGroupLabel) !== null && _a !== void 0 ? _a : '' : ''),
|
|
4462
|
+
])));
|
|
4463
|
+
}
|
|
4464
|
+
static get formAssociated() { return true; }
|
|
4465
|
+
get el() { return getElement(this); }
|
|
4466
|
+
static get watchers() { return {
|
|
4467
|
+
"groupDisplay": [{
|
|
4468
|
+
"groupDisplayChanged": 0
|
|
4469
|
+
}],
|
|
4470
|
+
"openGroup": [{
|
|
4471
|
+
"openGroupChanged": 0
|
|
4472
|
+
}],
|
|
4473
|
+
"flyoutFallback": [{
|
|
4474
|
+
"flyoutFallbackChanged": 0
|
|
4475
|
+
}],
|
|
4476
|
+
"disabled": [{
|
|
4477
|
+
"disabledChanged": 0
|
|
4478
|
+
}],
|
|
4479
|
+
"isOpen": [{
|
|
4480
|
+
"isOpenChanged": 0
|
|
4481
|
+
}],
|
|
4482
|
+
"debounce": [{
|
|
4483
|
+
"setupDebounce": 0
|
|
4484
|
+
}],
|
|
4485
|
+
"options": [{
|
|
4486
|
+
"optionsChanged": 0
|
|
4487
|
+
}],
|
|
4488
|
+
"value": [{
|
|
4489
|
+
"handleValueChange": 0
|
|
4490
|
+
}],
|
|
4491
|
+
"selectedOption": [{
|
|
4492
|
+
"handleSelectedOptionChange": 0
|
|
4493
|
+
}]
|
|
4494
|
+
}; }
|
|
4495
|
+
};
|
|
4496
|
+
PdsCombobox.style = pdsComboboxCss();
|
|
4497
|
+
|
|
4498
|
+
export { PdsCombobox as pds_combobox };
|