@pine-ds/core 4.0.0-mercury.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +41 -0
- package/components/index.js +1 -33
- package/components/index2.js +1 -14
- 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-divider.js +1 -54
- 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-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-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/reconnected-content.js +1 -0
- package/components/scroll.js +1 -0
- package/components/truncation-tooltip.js +1 -0
- package/components/utils.js +1 -0
- package/dist/cjs/attributes-oNMnBEnP.js +85 -0
- package/dist/cjs/closest-BZXvuB_Y.js +11 -0
- package/dist/cjs/floating-ui.dom-BZk7Blsu.js +1635 -0
- package/dist/cjs/form-MhwfKTuo.js +69 -0
- package/dist/cjs/i18n-format-CrpIhahc.js +64 -0
- package/dist/cjs/index-BMV0nzMk.js +31 -0
- package/dist/cjs/index-CuQil7H0.js +2926 -0
- package/dist/cjs/index.cjs.js +0 -4
- package/dist/cjs/loader.cjs.js +3 -8
- package/dist/cjs/mock-pds-modal.cjs.entry.js +91 -0
- package/dist/cjs/pds-accordion.cjs.entry.js +15 -14
- package/dist/cjs/pds-alert.cjs.entry.js +74 -0
- package/dist/cjs/pds-avatar.cjs.entry.js +92 -25
- package/dist/cjs/pds-box.cjs.entry.js +111 -38
- package/dist/cjs/pds-button.cjs.entry.js +169 -25
- package/dist/cjs/pds-checkbox.cjs.entry.js +66 -26
- package/dist/cjs/pds-chip.cjs.entry.js +157 -23
- package/dist/cjs/pds-combobox.cjs.entry.js +2905 -0
- package/dist/cjs/pds-container.cjs.entry.js +36 -0
- package/dist/cjs/pds-copytext.cjs.entry.js +72 -17
- package/dist/cjs/pds-divider.cjs.entry.js +15 -11
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +85 -0
- package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +22 -0
- package/dist/cjs/pds-dropdown-menu.cjs.entry.js +318 -0
- package/dist/cjs/pds-filter.cjs.entry.js +489 -0
- package/dist/cjs/pds-filters.cjs.entry.js +17 -0
- package/dist/cjs/pds-icon.cjs.entry.js +273 -40
- package/dist/cjs/pds-image.cjs.entry.js +15 -16
- package/dist/cjs/pds-input.cjs.entry.js +296 -26
- package/dist/cjs/pds-link.cjs.entry.js +41 -13
- package/dist/cjs/pds-loader.cjs.entry.js +21 -14
- package/dist/cjs/pds-modal-content.cjs.entry.js +196 -0
- package/dist/cjs/pds-modal-footer.cjs.entry.js +23 -0
- package/dist/cjs/pds-modal-header.cjs.entry.js +23 -0
- package/dist/cjs/pds-modal.cjs.entry.js +297 -0
- package/dist/cjs/pds-multiselect.cjs.entry.js +1068 -0
- package/dist/cjs/pds-popover.cjs.entry.js +571 -0
- package/dist/cjs/pds-progress.cjs.entry.js +16 -12
- package/dist/cjs/pds-property.cjs.entry.js +21 -0
- package/dist/cjs/pds-radio-group.cjs.entry.js +193 -0
- package/dist/cjs/pds-radio.cjs.entry.js +79 -23
- package/dist/cjs/pds-row.cjs.entry.js +35 -17
- package/dist/cjs/pds-select.cjs.entry.js +256 -0
- package/dist/cjs/pds-sortable-item.cjs.entry.js +26 -11
- package/dist/cjs/pds-sortable.cjs.entry.js +139 -117
- package/dist/cjs/pds-switch.cjs.entry.js +78 -26
- package/dist/cjs/pds-tab.cjs.entry.js +66 -16
- package/dist/cjs/pds-table-body.cjs.entry.js +4 -9
- package/dist/cjs/pds-table-cell.cjs.entry.js +107 -17
- package/dist/cjs/pds-table-head-cell.cjs.entry.js +169 -26
- package/dist/cjs/pds-table-head.cjs.entry.js +16 -13
- package/dist/cjs/pds-table-row.cjs.entry.js +103 -16
- package/dist/cjs/pds-table.cjs.entry.js +178 -22
- package/dist/cjs/pds-tabpanel.cjs.entry.js +19 -13
- package/dist/cjs/pds-tabs.cjs.entry.js +88 -17
- package/dist/cjs/pds-text.cjs.entry.js +122 -0
- package/dist/cjs/pds-textarea.cjs.entry.js +311 -29
- package/dist/cjs/pds-toast.cjs.entry.js +145 -0
- package/dist/cjs/pds-tooltip.cjs.entry.js +318 -109
- package/dist/cjs/pine-core.cjs.js +7 -10
- package/dist/cjs/reconnected-content-CpnEQcTp.js +29 -0
- package/dist/cjs/scroll-2XcoE_6Q.js +79 -0
- package/dist/cjs/truncation-tooltip-CVzAha5B.js +246 -0
- package/dist/cjs/utils-7jx8T2mW.js +76 -0
- package/dist/collection/collection-manifest.json +23 -2
- 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 +35 -8
- package/dist/collection/components/pds-accordion/stories/pds-accordion.stories.js +12 -18
- package/dist/collection/components/pds-alert/pds-alert.css +131 -0
- package/dist/collection/components/pds-alert/pds-alert.js +255 -0
- package/dist/collection/components/pds-alert/pds-alert.tokens.css +85 -0
- package/dist/collection/components/pds-alert/stories/pds-alert.stories.js +110 -0
- package/dist/collection/components/pds-avatar/pds-avatar.css +56 -23
- package/dist/collection/components/pds-avatar/pds-avatar.js +226 -24
- package/dist/collection/components/pds-avatar/stories/pds-avatar.stories.js +38 -2
- package/dist/collection/components/pds-box/pds-box.css +5435 -263
- package/dist/collection/components/pds-box/pds-box.js +2796 -231
- package/dist/collection/components/pds-box/stories/pds-box.stories.js +20 -6
- package/dist/collection/components/pds-button/pds-button.css +256 -93
- package/dist/collection/components/pds-button/pds-button.js +404 -39
- package/dist/collection/components/pds-button/stories/pds-button.stories.js +228 -16
- package/dist/collection/components/pds-checkbox/checkbox-interface.js +0 -1
- package/dist/collection/components/pds-checkbox/pds-checkbox.css +68 -58
- package/dist/collection/components/pds-checkbox/pds-checkbox.js +112 -46
- package/dist/collection/components/pds-checkbox/stories/pds-checkbox.stories.js +8 -16
- package/dist/collection/components/pds-chip/pds-chip.css +185 -114
- package/dist/collection/components/pds-chip/pds-chip.js +330 -60
- package/dist/collection/components/pds-chip/pds-chip.tokens.css +53 -0
- package/dist/collection/components/pds-chip/stories/pds-chip.stories.js +109 -24
- package/dist/collection/components/pds-combobox/combobox-interface.js +1 -0
- package/dist/collection/components/pds-combobox/pds-combobox.css +499 -0
- package/dist/collection/components/pds-combobox/pds-combobox.js +2347 -0
- package/dist/collection/components/pds-combobox/stories/pds-combobox.stories.js +485 -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 +90 -21
- package/dist/collection/components/pds-copytext/stories/pds-copytext.stories.js +6 -12
- package/dist/collection/components/pds-divider/pds-divider.css +71 -40
- package/dist/collection/components/pds-divider/pds-divider.js +46 -10
- package/dist/collection/components/pds-divider/stories/pds-divider.stories.js +7 -2
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.css +76 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js +291 -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 +52 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +394 -0
- package/dist/collection/components/pds-dropdown-menu/stories/pds-dropdown-menu.stories.js +38 -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 +199 -0
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.js +739 -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/pds-image.css +3 -2
- package/dist/collection/components/pds-image/pds-image.js +54 -29
- package/dist/collection/components/pds-image/stories/pds-image.stories.js +8 -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 +678 -56
- package/dist/collection/components/pds-input/pds-input.tokens.css +3 -0
- package/dist/collection/components/pds-input/stories/pds-input.stories.js +309 -14
- package/dist/collection/components/pds-link/pds-link.css +45 -30
- package/dist/collection/components/pds-link/pds-link.js +305 -19
- package/dist/collection/components/pds-link/stories/pds-link.stories.js +29 -4
- package/dist/collection/components/pds-loader/pds-loader.css +17 -30
- package/dist/collection/components/pds-loader/pds-loader.js +31 -11
- 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 +230 -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 +23 -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 +23 -0
- package/dist/collection/components/pds-modal/pds-modal.css +122 -0
- package/dist/collection/components/pds-modal/pds-modal.js +516 -0
- package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +731 -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 +324 -0
- package/dist/collection/components/pds-multiselect/pds-multiselect.js +2153 -0
- package/dist/collection/components/pds-multiselect/stories/pds-multiselect.stories.js +731 -0
- package/dist/collection/components/pds-popover/pds-popover.css +10 -0
- package/dist/collection/components/pds-popover/pds-popover.js +802 -0
- package/dist/collection/components/pds-popover/popover-interface.js +1 -0
- package/dist/collection/components/pds-popover/stories/pds-popover.stories.js +86 -0
- package/dist/collection/components/pds-progress/pds-progress.css +11 -24
- package/dist/collection/components/pds-progress/pds-progress.js +34 -14
- 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 +219 -54
- package/dist/collection/components/pds-radio/pds-radio.js +179 -51
- package/dist/collection/components/pds-radio/stories/pds-radio.stories.js +47 -15
- package/dist/collection/components/pds-radio-group/pds-radio-group.css +45 -0
- package/dist/collection/components/pds-radio-group/pds-radio-group.js +447 -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 +134 -0
- package/dist/collection/components/pds-row/pds-row.css +10 -9
- package/dist/collection/components/pds-row/pds-row.js +115 -26
- package/dist/collection/components/pds-row/stories/pds-row.stories.js +16 -14
- package/dist/collection/components/pds-select/pds-select.css +168 -0
- package/dist/collection/components/pds-select/pds-select.js +602 -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 +26 -26
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js +32 -7
- 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 +77 -12
- package/dist/collection/components/pds-sortable/sortable-interface.js +0 -1
- package/dist/collection/components/pds-sortable/stories/pds-sortable.stories.js +22 -13
- package/dist/collection/components/pds-switch/pds-switch.css +56 -58
- package/dist/collection/components/pds-switch/pds-switch.js +142 -70
- package/dist/collection/components/pds-switch/stories/pds-switch.stories.js +11 -28
- package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js +1 -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 +128 -13
- 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 +71 -11
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.css +46 -25
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +236 -20
- 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 +114 -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 +98 -17
- package/dist/collection/components/pds-table/pds-table.js +285 -41
- package/dist/collection/components/pds-table/stories/pds-table.stories.js +297 -27
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.css +102 -60
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.js +226 -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 +53 -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 +180 -25
- package/dist/collection/components/pds-tabs/stories/pds-tabs.stories.js +69 -26
- package/dist/collection/components/pds-text/pds-text.css +207 -0
- package/dist/collection/components/pds-text/pds-text.js +293 -0
- package/dist/collection/components/pds-text/stories/pds-text.stories.js +125 -0
- package/dist/collection/components/pds-textarea/pds-textarea.css +127 -57
- package/dist/collection/components/pds-textarea/pds-textarea.js +591 -57
- package/dist/collection/components/pds-textarea/stories/pds-textarea.stories.js +112 -25
- package/dist/collection/components/pds-textarea/textarea-interface.js +0 -1
- package/dist/collection/components/pds-toast/pds-toast.css +153 -0
- package/dist/collection/components/pds-toast/pds-toast.js +330 -0
- package/dist/collection/components/pds-toast/stories/pds-toast.stories.js +95 -0
- package/dist/collection/components/pds-tooltip/pds-tooltip.css +63 -81
- package/dist/collection/components/pds-tooltip/pds-tooltip.js +366 -78
- package/dist/collection/components/pds-tooltip/stories/pds-tooltip.stories.js +22 -24
- 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 +1 -1
- package/dist/collection/utils/attributes.js +83 -0
- package/dist/collection/utils/closest.js +0 -1
- package/dist/collection/utils/form.js +41 -8
- package/dist/collection/utils/interfaces.js +1 -0
- package/dist/collection/utils/overlay.js +66 -50
- package/dist/collection/utils/reconnected-content.js +25 -0
- package/dist/collection/utils/scroll.js +77 -0
- package/dist/collection/utils/test/axe.js +106 -0
- package/dist/collection/utils/test/reconnect-safety.js +31 -0
- package/dist/collection/utils/truncation-tooltip.js +241 -0
- package/dist/collection/utils/types.js +18 -2
- package/dist/collection/utils/utils.js +66 -4
- package/dist/docs.d.ts +45 -0
- package/dist/docs.json +22531 -3270
- package/dist/esm/attributes-C0M1gTKv.js +82 -0
- package/dist/esm/closest-DnUJodVd.js +9 -0
- package/dist/esm/floating-ui.dom-DDtwbwIl.js +1628 -0
- package/dist/esm/form-BuRbS7Hp.js +63 -0
- package/dist/esm/i18n-format-BKsJZTyn.js +61 -0
- package/dist/esm/index-Bu9gFIxM.js +17 -0
- package/dist/esm/index-CTLu1TM4.js +2915 -0
- package/dist/esm/index.js +0 -2
- package/dist/esm/loader.js +3 -6
- package/dist/esm/mock-pds-modal.entry.js +89 -0
- package/dist/esm/pds-accordion.entry.js +15 -12
- package/dist/esm/pds-alert.entry.js +72 -0
- package/dist/esm/pds-avatar.entry.js +92 -23
- package/dist/esm/pds-box.entry.js +111 -36
- package/dist/esm/pds-button.entry.js +168 -22
- package/dist/esm/pds-checkbox.entry.js +67 -25
- package/dist/esm/pds-chip.entry.js +158 -22
- package/dist/esm/pds-combobox.entry.js +2903 -0
- package/dist/esm/pds-container.entry.js +34 -0
- package/dist/esm/pds-copytext.entry.js +72 -15
- package/dist/esm/pds-divider.entry.js +15 -9
- package/dist/esm/pds-dropdown-menu-item.entry.js +83 -0
- package/dist/esm/pds-dropdown-menu-separator.entry.js +20 -0
- package/dist/esm/pds-dropdown-menu.entry.js +316 -0
- package/dist/esm/pds-filter.entry.js +487 -0
- package/dist/esm/pds-filters.entry.js +15 -0
- package/dist/esm/pds-icon.entry.js +273 -38
- package/dist/esm/pds-image.entry.js +15 -14
- package/dist/esm/pds-input.entry.js +297 -25
- package/dist/esm/pds-link.entry.js +41 -11
- package/dist/esm/pds-loader.entry.js +21 -12
- package/dist/esm/pds-modal-content.entry.js +194 -0
- package/dist/esm/pds-modal-footer.entry.js +21 -0
- package/dist/esm/pds-modal-header.entry.js +21 -0
- package/dist/esm/pds-modal.entry.js +295 -0
- package/dist/esm/pds-multiselect.entry.js +1066 -0
- package/dist/esm/pds-popover.entry.js +569 -0
- package/dist/esm/pds-progress.entry.js +16 -10
- package/dist/esm/pds-property.entry.js +19 -0
- package/dist/esm/pds-radio-group.entry.js +191 -0
- package/dist/esm/pds-radio.entry.js +80 -22
- package/dist/esm/pds-row.entry.js +35 -15
- package/dist/esm/pds-select.entry.js +254 -0
- package/dist/esm/pds-sortable-item.entry.js +26 -9
- package/dist/esm/pds-sortable.entry.js +139 -115
- package/dist/esm/pds-switch.entry.js +79 -25
- package/dist/esm/pds-tab.entry.js +66 -14
- package/dist/esm/pds-table-body.entry.js +4 -7
- package/dist/esm/pds-table-cell.entry.js +107 -15
- package/dist/esm/pds-table-head-cell.entry.js +169 -24
- package/dist/esm/pds-table-head.entry.js +16 -11
- package/dist/esm/pds-table-row.entry.js +103 -14
- package/dist/esm/pds-table.entry.js +178 -20
- package/dist/esm/pds-tabpanel.entry.js +19 -11
- package/dist/esm/pds-tabs.entry.js +88 -15
- package/dist/esm/pds-text.entry.js +120 -0
- package/dist/esm/pds-textarea.entry.js +312 -28
- package/dist/esm/pds-toast.entry.js +143 -0
- package/dist/esm/pds-tooltip.entry.js +318 -107
- package/dist/esm/pine-core.js +5 -7
- package/dist/esm/reconnected-content-RFpTWV6r.js +27 -0
- package/dist/esm/scroll-DtgUQhjl.js +75 -0
- package/dist/esm/truncation-tooltip-Blk4GigP.js +244 -0
- package/dist/esm/utils-tJa4KYNO.js +71 -0
- package/dist/esm-es5/attributes-C0M1gTKv.js +1 -0
- package/dist/esm-es5/closest-DnUJodVd.js +1 -0
- package/dist/esm-es5/floating-ui.dom-DDtwbwIl.js +1 -0
- package/dist/esm-es5/form-BuRbS7Hp.js +1 -0
- package/dist/esm-es5/i18n-format-BKsJZTyn.js +1 -0
- package/dist/esm-es5/index-Bu9gFIxM.js +1 -0
- package/dist/esm-es5/index-CTLu1TM4.js +2 -0
- package/dist/esm-es5/index.js +0 -2
- 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-divider.entry.js +1 -2
- 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/reconnected-content-RFpTWV6r.js +1 -0
- package/dist/esm-es5/scroll-DtgUQhjl.js +1 -0
- package/dist/esm-es5/truncation-tooltip-Blk4GigP.js +1 -0
- package/dist/esm-es5/utils-tJa4KYNO.js +1 -0
- package/dist/pine-core/index.esm.js +0 -2
- package/dist/pine-core/p-04a30a2d.system.entry.js +1 -0
- package/dist/pine-core/p-056667f0.entry.js +1 -0
- package/dist/pine-core/p-08151143.system.entry.js +1 -0
- package/dist/pine-core/p-0d73d473.entry.js +1 -0
- package/dist/pine-core/p-0e89a189.entry.js +1 -0
- package/dist/pine-core/p-0fcda1ec.entry.js +1 -0
- package/dist/pine-core/p-12ec8186.system.entry.js +1 -0
- package/dist/pine-core/p-1649dd61.system.entry.js +1 -0
- package/dist/pine-core/p-1ba361cb.entry.js +1 -0
- package/dist/pine-core/p-1e952dbb.entry.js +7 -0
- package/dist/pine-core/p-210f0994.system.entry.js +1 -0
- package/dist/pine-core/p-222ff58e.system.entry.js +1 -0
- package/dist/pine-core/p-226232a7.system.entry.js +1 -0
- package/dist/pine-core/p-228a9068.system.entry.js +1 -0
- package/dist/pine-core/p-2af19aa7.entry.js +1 -0
- package/dist/pine-core/p-2d4b9253.entry.js +1 -0
- package/dist/pine-core/p-2e214db6.entry.js +1 -0
- package/dist/pine-core/p-2fd71a0c.entry.js +1 -0
- package/dist/pine-core/p-3050c66f.entry.js +1 -0
- package/dist/pine-core/p-33de0eb7.system.entry.js +1 -0
- package/dist/pine-core/p-3aec9079.entry.js +1 -0
- package/dist/pine-core/p-3b9e77b3.entry.js +1 -0
- package/dist/pine-core/p-3cdc1a5b.entry.js +1 -0
- package/dist/pine-core/p-460aa66f.system.entry.js +1 -0
- package/dist/pine-core/p-463eb0e6.system.entry.js +1 -0
- package/dist/pine-core/p-46f0dda5.system.entry.js +1 -0
- package/dist/pine-core/p-4923a3fe.entry.js +1 -0
- package/dist/pine-core/p-4d6944aa.entry.js +1 -0
- package/dist/pine-core/p-4dad0878.entry.js +1 -0
- package/dist/pine-core/p-4faff617.entry.js +1 -0
- package/dist/pine-core/p-50e0f726.system.entry.js +1 -0
- package/dist/pine-core/p-520f7a5b.entry.js +1 -0
- package/dist/pine-core/p-53999cd6.system.entry.js +1 -0
- package/dist/pine-core/p-544ccf67.entry.js +1 -0
- package/dist/pine-core/p-5c239f0a.entry.js +1 -0
- package/dist/pine-core/p-5d585aa8.entry.js +1 -0
- package/dist/pine-core/p-6089d811.entry.js +1 -0
- package/dist/pine-core/p-611f68b7.system.entry.js +1 -0
- package/dist/pine-core/p-63f5f66f.system.entry.js +1 -0
- package/dist/pine-core/p-65557500.entry.js +1 -0
- package/dist/pine-core/p-714bfdbd.entry.js +1 -0
- package/dist/pine-core/p-7691a875.system.entry.js +3 -0
- package/dist/pine-core/p-7a1971ec.entry.js +1 -0
- package/dist/pine-core/p-7b1e3e91.entry.js +1 -0
- package/dist/pine-core/p-7c18e9e8.system.entry.js +8 -0
- package/dist/pine-core/p-85434de8.system.entry.js +1 -0
- package/dist/pine-core/p-86bc2a0c.entry.js +1 -0
- package/dist/pine-core/p-8702635d.system.entry.js +1 -0
- package/dist/pine-core/p-897fe88c.entry.js +1 -0
- package/dist/pine-core/p-8e6a8a8e.entry.js +1 -0
- package/dist/pine-core/p-902b3e8b.system.entry.js +1 -0
- package/dist/pine-core/p-9187c26c.system.entry.js +1 -0
- package/dist/pine-core/p-92c79ed4.system.entry.js +1 -0
- package/dist/pine-core/p-92ef1608.system.entry.js +1 -0
- package/dist/pine-core/p-9487ff20.system.entry.js +1 -0
- package/dist/pine-core/p-9507eb49.system.entry.js +1 -0
- package/dist/pine-core/p-97198cb6.system.entry.js +1 -0
- package/dist/pine-core/p-9a7294e7.system.entry.js +1 -0
- package/dist/pine-core/p-9b68669f.entry.js +1 -0
- package/dist/pine-core/p-9fd1e8f4.system.entry.js +1 -0
- package/dist/pine-core/p-BG6uGRQj.system.js +1 -0
- package/dist/pine-core/p-BKsJZTyn.js +1 -0
- package/dist/pine-core/p-BNSGedhN.js +1 -0
- package/dist/pine-core/p-BbXp4qBM.system.js +1 -0
- package/dist/pine-core/p-BhQhw0S3.system.js +1 -0
- package/dist/pine-core/p-Bjc6fc_Y.system.js +1 -0
- package/dist/pine-core/p-BrLs99ML.system.js +1 -0
- package/dist/pine-core/p-Bu9gFIxM.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-C0M1gTKv.js +1 -0
- package/dist/pine-core/p-CRCxGYgw.system.js +1 -0
- package/dist/pine-core/p-CTLu1TM4.js +2 -0
- package/dist/pine-core/p-Cr7-rJtJ.system.js +1 -0
- package/dist/pine-core/p-DAIsVNlL.system.js +2 -0
- package/dist/pine-core/p-DDtwbwIl.js +1 -0
- package/dist/pine-core/p-DVra397g.system.js +1 -0
- package/dist/pine-core/p-DnUJodVd.js +1 -0
- package/dist/pine-core/p-Dr-FzkdE.system.js +1 -0
- package/dist/pine-core/p-DtgUQhjl.js +1 -0
- package/dist/pine-core/p-RFpTWV6r.js +1 -0
- package/dist/pine-core/p-YWpyar7R.system.js +1 -0
- package/dist/pine-core/p-a3c4c0ee.entry.js +1 -0
- package/dist/pine-core/p-a53222f7.entry.js +1 -0
- package/dist/pine-core/p-a7eabc0c.system.entry.js +1 -0
- package/dist/pine-core/p-a8ab4d9b.entry.js +1 -0
- package/dist/pine-core/p-a9e54964.entry.js +1 -0
- package/dist/pine-core/p-aa208514.entry.js +1 -0
- package/dist/pine-core/p-ae296598.entry.js +1 -0
- package/dist/pine-core/p-aecaff12.entry.js +1 -0
- package/dist/pine-core/p-af4a24d9.entry.js +1 -0
- package/dist/pine-core/p-afd07d5b.entry.js +1 -0
- package/dist/pine-core/p-b0531455.entry.js +1 -0
- package/dist/pine-core/p-b109de2e.entry.js +1 -0
- package/dist/pine-core/p-b17fa86a.system.entry.js +1 -0
- package/dist/pine-core/p-b255d3b7.entry.js +1 -0
- package/dist/pine-core/p-b52deffb.entry.js +1 -0
- package/dist/pine-core/p-b6c2090f.system.entry.js +1 -0
- package/dist/pine-core/p-ba8bd9dc.system.entry.js +1 -0
- package/dist/pine-core/p-bba759f8.system.entry.js +1 -0
- package/dist/pine-core/p-bf3afa16.system.entry.js +1 -0
- package/dist/pine-core/p-bfa640f4.system.entry.js +1 -0
- package/dist/pine-core/p-c0753d9f.entry.js +1 -0
- package/dist/pine-core/p-c09dab1a.system.entry.js +1 -0
- package/dist/pine-core/p-c713ffc6.system.entry.js +1 -0
- package/dist/pine-core/p-ce63f726.system.entry.js +1 -0
- package/dist/pine-core/p-ce79321b.system.entry.js +1 -0
- package/dist/pine-core/p-cf72e9b1.system.entry.js +1 -0
- package/dist/pine-core/p-d157a33a.entry.js +1 -0
- package/dist/pine-core/p-d27ef352.system.entry.js +1 -0
- package/dist/pine-core/p-d415bb01.entry.js +2 -0
- package/dist/pine-core/p-d54af26c.system.entry.js +1 -0
- package/dist/pine-core/p-d804d37b.system.entry.js +1 -0
- package/dist/pine-core/p-e11795db.system.entry.js +1 -0
- package/dist/pine-core/p-e1653d75.system.entry.js +1 -0
- package/dist/pine-core/p-e16dfb32.system.entry.js +1 -0
- package/dist/pine-core/p-e450eb27.system.entry.js +1 -0
- package/dist/pine-core/p-eb4058ed.system.entry.js +1 -0
- package/dist/pine-core/p-f09ce49e.entry.js +1 -0
- package/dist/pine-core/p-f35596cd.entry.js +1 -0
- package/dist/pine-core/p-f3683be8.entry.js +1 -0
- package/dist/pine-core/p-fcf91f14.system.entry.js +1 -0
- package/dist/pine-core/p-kYMYDfJY.system.js +1 -0
- package/dist/pine-core/p-tJa4KYNO.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 +8 -0
- package/dist/types/components/pds-alert/pds-alert.d.ts +51 -0
- package/dist/types/components/pds-avatar/pds-avatar.d.ts +38 -0
- package/dist/types/components/pds-box/pds-box.d.ts +475 -14
- package/dist/types/components/pds-button/pds-button.d.ts +70 -12
- package/dist/types/components/pds-checkbox/pds-checkbox.d.ts +11 -1
- package/dist/types/components/pds-chip/pds-chip.d.ts +62 -13
- package/dist/types/components/pds-combobox/combobox-interface.d.ts +23 -0
- package/dist/types/components/pds-combobox/pds-combobox.d.ts +372 -0
- package/dist/types/components/pds-container/pds-container.d.ts +22 -0
- package/dist/types/components/pds-copytext/pds-copytext.d.ts +14 -4
- package/dist/types/components/pds-divider/pds-divider.d.ts +9 -1
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.d.ts +66 -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 +39 -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 +133 -0
- package/dist/types/components/pds-filters/pds-filters.d.ts +11 -0
- package/dist/types/components/pds-image/pds-image.d.ts +7 -3
- package/dist/types/components/pds-input/input-interface.d.ts +12 -0
- package/dist/types/components/pds-input/pds-input.d.ts +163 -8
- package/dist/types/components/pds-link/pds-link.d.ts +73 -11
- package/dist/types/components/pds-loader/pds-loader.d.ts +2 -1
- package/dist/types/components/pds-modal/pds-modal-content/pds-modal-content.d.ts +38 -0
- package/dist/types/components/pds-modal/pds-modal-footer/pds-modal-footer.d.ts +5 -0
- package/dist/types/components/pds-modal/pds-modal-header/pds-modal-header.d.ts +5 -0
- package/dist/types/components/pds-modal/pds-modal.d.ts +88 -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 +42 -0
- package/dist/types/components/pds-multiselect/pds-multiselect.d.ts +326 -0
- package/dist/types/components/pds-popover/pds-popover.d.ts +179 -0
- package/dist/types/components/pds-popover/popover-interface.d.ts +4 -0
- package/dist/types/components/pds-property/pds-property.d.ts +14 -0
- package/dist/types/components/pds-radio/pds-radio.d.ts +30 -9
- package/dist/types/components/pds-radio-group/pds-radio-group.d.ts +73 -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 +10 -2
- package/dist/types/components/pds-select/pds-select.d.ts +146 -0
- package/dist/types/components/pds-sortable/pds-sortable-item/pds-sortable-item.d.ts +1 -0
- package/dist/types/components/pds-sortable/pds-sortable.d.ts +10 -2
- package/dist/types/components/pds-sortable/sortable-interface.d.ts +3 -1
- package/dist/types/components/pds-switch/pds-switch.d.ts +24 -19
- package/dist/types/components/pds-table/pds-table-cell/pds-table-cell.d.ts +26 -1
- package/dist/types/components/pds-table/pds-table-head/pds-table-head.d.ts +15 -2
- package/dist/types/components/pds-table/pds-table-head-cell/pds-table-head-cell.d.ts +52 -2
- package/dist/types/components/pds-table/pds-table-row/pds-table-row.d.ts +23 -4
- package/dist/types/components/pds-table/pds-table.d.ts +62 -10
- package/dist/types/components/pds-tabs/pds-tab/pds-tab.d.ts +49 -0
- package/dist/types/components/pds-tabs/pds-tabpanel/pds-tabpanel.d.ts +6 -0
- package/dist/types/components/pds-tabs/pds-tabs.d.ts +27 -3
- package/dist/types/components/pds-text/pds-text.d.ts +55 -0
- package/dist/types/components/pds-textarea/pds-textarea.d.ts +138 -15
- package/dist/types/components/pds-textarea/textarea-interface.d.ts +5 -1
- package/dist/types/components/pds-toast/pds-toast.d.ts +70 -0
- package/dist/types/components/pds-tooltip/pds-tooltip.d.ts +45 -19
- package/dist/types/components.d.ts +5600 -1197
- 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 +1 -0
- package/dist/types/stencil-public-runtime.d.ts +195 -8
- package/dist/types/utils/attributes.d.ts +10 -0
- package/dist/types/utils/form.d.ts +23 -1
- package/dist/types/utils/interfaces.d.ts +6 -0
- package/dist/types/utils/overlay.d.ts +3 -3
- package/dist/types/utils/reconnected-content.d.ts +14 -0
- package/dist/types/utils/scroll.d.ts +21 -0
- package/dist/types/utils/test/axe.d.ts +81 -0
- package/dist/types/utils/test/reconnect-safety.d.ts +11 -0
- package/dist/types/utils/truncation-tooltip.d.ts +21 -0
- package/dist/types/utils/types.d.ts +8 -2
- package/dist/types/utils/utils.d.ts +14 -2
- package/dist/vscode.html-data.json +10944 -0
- package/hydrate/index.d.ts +58 -7
- package/hydrate/index.js +21570 -3575
- package/hydrate/index.mjs +21568 -3575
- package/package.json +47 -25
- package/readme.md +1 -1
- 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-3aa152c6.entry.js +0 -2
- package/dist/pine-core/p-3aa152c6.entry.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-6d9edf7d.system.entry.js +0 -2
- package/dist/pine-core/p-6d9edf7d.system.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-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-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,2905 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CuQil7H0.js');
|
|
4
|
+
var form = require('./form-MhwfKTuo.js');
|
|
5
|
+
var floatingUi_dom = require('./floating-ui.dom-BZk7Blsu.js');
|
|
6
|
+
var utils = require('./utils-7jx8T2mW.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
|
+
const pdsComboboxCss = () => `:host{display:block}: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-medium);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{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);list-style:none;margin:0;min-width:220px;overflow-y:auto;padding:var(--pine-dimension-xs);position:absolute;z-index:var(--pine-z-index-raised)}.pds-combobox__option{-ms-flex-align:center;align-items:center;background:transparent;border-radius:var(--pine-dimension-125);color:var(--pine-color-text-secondary);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body-medium);-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[aria-selected=true]{background:var(--pine-color-background-muted)}.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.pds-combobox__option--chip .pds-combobox__option-chip{-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,.pds-combobox__option[selected],.pds-combobox__option--selected{background:var(--pine-color-background-muted)}.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__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)}.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);color:var(--color-text-default, var(--pine-color-text-inverse-emphasis));cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body-medium);-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;text-align:start}.pds-combobox__button-trigger--input-shape{border-radius:var(--pine-dimension-125);min-height:var(--pine-dimension-500)}.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-white);--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)}.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}[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);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)}`;
|
|
1395
|
+
|
|
1396
|
+
const PdsCombobox = class {
|
|
1397
|
+
constructor(hostRef) {
|
|
1398
|
+
index.registerInstance(this, hostRef);
|
|
1399
|
+
this.pdsComboboxChange = index.createEvent(this, "pdsComboboxChange");
|
|
1400
|
+
this.pdsComboboxSearch = index.createEvent(this, "pdsComboboxSearch");
|
|
1401
|
+
this.pdsComboboxLoadOptions = index.createEvent(this, "pdsComboboxLoadOptions");
|
|
1402
|
+
/**
|
|
1403
|
+
* Enable custom layout content for options. Options with data-layout attribute will render their HTML content.
|
|
1404
|
+
* ⚠️ Security Warning: Only use with trusted content. Basic XSS protection is applied, but avoid user-generated content.
|
|
1405
|
+
* @default false
|
|
1406
|
+
*/
|
|
1407
|
+
this.customOptionLayouts = false;
|
|
1408
|
+
/**
|
|
1409
|
+
* Enable custom layout content for the button trigger via the trigger-content slot.
|
|
1410
|
+
* When true, uses slot content for initial state but updates dynamically with selected option layout.
|
|
1411
|
+
* ⚠️ Security Warning: Only use with trusted content. Basic XSS protection is applied, but avoid user-generated content.
|
|
1412
|
+
* @default false
|
|
1413
|
+
*/
|
|
1414
|
+
this.customTriggerContent = false;
|
|
1415
|
+
/**
|
|
1416
|
+
* If true, the combobox is disabled.
|
|
1417
|
+
*/
|
|
1418
|
+
this.disabled = false;
|
|
1419
|
+
/**
|
|
1420
|
+
* Placement of the dropdown relative to the trigger.
|
|
1421
|
+
* @default 'bottom-start'
|
|
1422
|
+
*/
|
|
1423
|
+
this.dropdownPlacement = 'bottom-start';
|
|
1424
|
+
/**
|
|
1425
|
+
* Width of the dropdown. Any valid CSS width value.
|
|
1426
|
+
* @default '236px'
|
|
1427
|
+
*/
|
|
1428
|
+
this.dropdownWidth = '236px';
|
|
1429
|
+
/**
|
|
1430
|
+
* Where to mount the dropdown listbox (`host` or `body`, sometimes called “append to body”).
|
|
1431
|
+
* Use `body` inside scrollable containers (for example modals) so the list is not clipped by
|
|
1432
|
+
* `overflow: hidden` ancestors. The portal is appended to the nearest `<dialog>` when present
|
|
1433
|
+
* (including `pds-modal` / `showModal()`), using a composed ascent so shadow DOM and slot
|
|
1434
|
+
* boundaries do not hide the dialog from discovery; otherwise it is appended to `document.body`.
|
|
1435
|
+
* Keyboard focus remains on the trigger via
|
|
1436
|
+
* `aria-activedescendant` so modal focus traps continue to work. Custom `empty` and `loading`
|
|
1437
|
+
* slots are not supported when `body` is used; the default empty and loading content is shown instead.
|
|
1438
|
+
* @default 'host'
|
|
1439
|
+
*/
|
|
1440
|
+
this.dropdownMount = 'host';
|
|
1441
|
+
/**
|
|
1442
|
+
* Visually hides the label text for instances where only the combobox should be displayed.
|
|
1443
|
+
* The visible `<label>` is omitted (same pattern as `pds-select`) so label spacing does not reserve layout;
|
|
1444
|
+
* the trigger uses `aria-label` so the name stays available to assistive technology.
|
|
1445
|
+
*/
|
|
1446
|
+
this.hideLabel = false;
|
|
1447
|
+
/**
|
|
1448
|
+
* Determines the combobox mode: 'filter' (filter options as you type) or 'select-only' (show all options).
|
|
1449
|
+
* In filter mode, reopening the menu while the input still shows the label of the selected option temporarily lists
|
|
1450
|
+
* all options until you type (so you can switch to a different choice without clearing the field first).
|
|
1451
|
+
* @default 'filter'
|
|
1452
|
+
*/
|
|
1453
|
+
this.mode = 'filter';
|
|
1454
|
+
/**
|
|
1455
|
+
* Determines the combobox trigger: 'input' (editable input), 'button' (button-like, non-editable), or 'chip' (chip-like, non-editable).
|
|
1456
|
+
* @default 'input'
|
|
1457
|
+
*/
|
|
1458
|
+
this.trigger = 'input';
|
|
1459
|
+
/**
|
|
1460
|
+
* Width of the trigger (button or input). Any valid CSS width value.
|
|
1461
|
+
* @default 'fit-content'
|
|
1462
|
+
*/
|
|
1463
|
+
this.triggerWidth = 'fit-content';
|
|
1464
|
+
/**
|
|
1465
|
+
* The visual variant for the button trigger. Matches Pine button variants.
|
|
1466
|
+
* @default 'secondary'
|
|
1467
|
+
*/
|
|
1468
|
+
this.triggerVariant = 'secondary';
|
|
1469
|
+
/**
|
|
1470
|
+
* The shape of the button trigger. Use 'input' to render the trigger with input-like styling
|
|
1471
|
+
* (subtle border radius, input height) for use in form or filter rows alongside PdsSelect and PdsMultiselect.
|
|
1472
|
+
* @default 'pill'
|
|
1473
|
+
*/
|
|
1474
|
+
this.triggerShape = 'pill';
|
|
1475
|
+
/**
|
|
1476
|
+
* The sentiment for the chip trigger. Matches Pine chip sentiments.
|
|
1477
|
+
* @default 'neutral'
|
|
1478
|
+
*/
|
|
1479
|
+
this.chipSentiment = 'neutral';
|
|
1480
|
+
/**
|
|
1481
|
+
* Whether the chip trigger should be displayed in a larger size.
|
|
1482
|
+
* @default false
|
|
1483
|
+
*/
|
|
1484
|
+
this.chipLarge = false;
|
|
1485
|
+
/**
|
|
1486
|
+
* Whether a dot should be displayed on the chip trigger.
|
|
1487
|
+
* @default false
|
|
1488
|
+
*/
|
|
1489
|
+
this.chipDot = false;
|
|
1490
|
+
/**
|
|
1491
|
+
* The value of the combobox input.
|
|
1492
|
+
*/
|
|
1493
|
+
this.value = '';
|
|
1494
|
+
/**
|
|
1495
|
+
* HTTP method for async requests.
|
|
1496
|
+
*/
|
|
1497
|
+
this.asyncMethod = 'GET';
|
|
1498
|
+
/**
|
|
1499
|
+
* Debounce delay in milliseconds for search/fetch.
|
|
1500
|
+
*/
|
|
1501
|
+
this.debounce = 300;
|
|
1502
|
+
/**
|
|
1503
|
+
* Timeout in milliseconds for async fetch requests.
|
|
1504
|
+
*/
|
|
1505
|
+
this.fetchTimeout = 30000;
|
|
1506
|
+
/**
|
|
1507
|
+
* Whether the component is currently loading async options.
|
|
1508
|
+
*/
|
|
1509
|
+
this.loading = false;
|
|
1510
|
+
/**
|
|
1511
|
+
* Internal state for the display text shown in the input/trigger
|
|
1512
|
+
*/
|
|
1513
|
+
this.displayText = '';
|
|
1514
|
+
/**
|
|
1515
|
+
* Internal state for filtered options and group labels
|
|
1516
|
+
*/
|
|
1517
|
+
this.filteredItems = [];
|
|
1518
|
+
/**
|
|
1519
|
+
* Internal state for the currently highlighted option index
|
|
1520
|
+
*/
|
|
1521
|
+
this.highlightedIndex = -1;
|
|
1522
|
+
/**
|
|
1523
|
+
* Internal state for dropdown open/close
|
|
1524
|
+
*/
|
|
1525
|
+
this.isOpen = false;
|
|
1526
|
+
/**
|
|
1527
|
+
* Internal state for the currently selected option
|
|
1528
|
+
*/
|
|
1529
|
+
this.selectedOption = null;
|
|
1530
|
+
/**
|
|
1531
|
+
* Internal state for the sanitized layout content of the selected option
|
|
1532
|
+
*/
|
|
1533
|
+
this.selectedOptionLayoutContent = '';
|
|
1534
|
+
/**
|
|
1535
|
+
* Internal state to track chip properties for automatic rendering
|
|
1536
|
+
*/
|
|
1537
|
+
this.selectedOptionChipProps = null;
|
|
1538
|
+
/**
|
|
1539
|
+
* Internal state for async options.
|
|
1540
|
+
*/
|
|
1541
|
+
this.internalOptions = [];
|
|
1542
|
+
/**
|
|
1543
|
+
* Internal state for current page (pagination).
|
|
1544
|
+
*/
|
|
1545
|
+
this.currentPage = 1;
|
|
1546
|
+
/**
|
|
1547
|
+
* Internal state for hasMore (pagination).
|
|
1548
|
+
*/
|
|
1549
|
+
this.hasMore = false;
|
|
1550
|
+
this.optionEls = [];
|
|
1551
|
+
this.allItems = [];
|
|
1552
|
+
this.portalEl = null;
|
|
1553
|
+
this.bodyPortalAutoUpdateActive = false;
|
|
1554
|
+
this.isUpdatingFromSelection = false;
|
|
1555
|
+
/**
|
|
1556
|
+
* In filter mode, after choosing an option the input still shows the label and would
|
|
1557
|
+
* otherwise filter the list to matching substrings only. While this flag is true,
|
|
1558
|
+
* the list shows every option until the user types (then normal filtering applies).
|
|
1559
|
+
*/
|
|
1560
|
+
this.expandFilterListWhileOpen = false;
|
|
1561
|
+
this.handleInput = (e) => {
|
|
1562
|
+
const target = e.target;
|
|
1563
|
+
this.clearExpandFilterList();
|
|
1564
|
+
this.displayText = target.value;
|
|
1565
|
+
this.isOpen = true;
|
|
1566
|
+
this.filterOptions();
|
|
1567
|
+
// Emit search event for consumer-managed async
|
|
1568
|
+
this.pdsComboboxSearch.emit({ query: this.displayText });
|
|
1569
|
+
// Fetch from async URL if configured
|
|
1570
|
+
if (this.asyncUrl) {
|
|
1571
|
+
this.debouncedFetchAsyncOptions(this.displayText, 1);
|
|
1572
|
+
}
|
|
1573
|
+
setTimeout(() => this.openDropdownPositioning(), 0);
|
|
1574
|
+
};
|
|
1575
|
+
this.handleInputClick = () => {
|
|
1576
|
+
// Open dropdown when input is clicked (but not when tabbed into)
|
|
1577
|
+
if (!this.isOpen) {
|
|
1578
|
+
this.isOpen = true;
|
|
1579
|
+
this.prepareExpandFilterListOnOpen();
|
|
1580
|
+
this.filterOptions();
|
|
1581
|
+
// Trigger initial fetch if async and no options loaded yet
|
|
1582
|
+
if (this.asyncUrl && this.internalOptions.length === 0) {
|
|
1583
|
+
this.debouncedFetchAsyncOptions(this.displayText, 1);
|
|
1584
|
+
}
|
|
1585
|
+
this.setInitialHighlightedIndex();
|
|
1586
|
+
setTimeout(() => {
|
|
1587
|
+
this.openDropdownPositioning();
|
|
1588
|
+
if (this.trigger === 'input' && this.expandFilterListWhileOpen && this.inputEl) {
|
|
1589
|
+
this.inputEl.select();
|
|
1590
|
+
}
|
|
1591
|
+
}, 0);
|
|
1592
|
+
}
|
|
1593
|
+
};
|
|
1594
|
+
this.handleKeyDown = (e) => {
|
|
1595
|
+
if (!this.isOpen && (e.key === 'ArrowDown' || e.key === 'ArrowUp' || (e.altKey && e.key === 'ArrowDown'))) {
|
|
1596
|
+
e.preventDefault();
|
|
1597
|
+
this.isOpen = true;
|
|
1598
|
+
this.prepareExpandFilterListOnOpen();
|
|
1599
|
+
this.filterOptions();
|
|
1600
|
+
// Set highlighted index immediately for testing
|
|
1601
|
+
this.setInitialHighlightedIndex();
|
|
1602
|
+
setTimeout(() => {
|
|
1603
|
+
this.openDropdownPositioning();
|
|
1604
|
+
// For input trigger, keep focus on input and use aria-activedescendant
|
|
1605
|
+
// For button trigger, move focus to first option for keyboard navigation
|
|
1606
|
+
if (this.trigger === 'input') {
|
|
1607
|
+
this.focusFirstOption();
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
this.focusFirstOptionForArrowKeys();
|
|
1611
|
+
}
|
|
1612
|
+
}, 0);
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
if (!this.isOpen) {
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
// Get only the option elements (skip group labels) for navigation
|
|
1619
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
1620
|
+
switch (e.key) {
|
|
1621
|
+
case 'ArrowDown':
|
|
1622
|
+
e.preventDefault();
|
|
1623
|
+
// If no option is highlighted and we have options, start at 0
|
|
1624
|
+
if (this.highlightedIndex < 0 && selectableOptions.length > 0) {
|
|
1625
|
+
this.highlightedIndex = 0;
|
|
1626
|
+
}
|
|
1627
|
+
else {
|
|
1628
|
+
this.highlightedIndex = Math.min(this.highlightedIndex + 1, selectableOptions.length - 1);
|
|
1629
|
+
}
|
|
1630
|
+
this.updateOptionFocus();
|
|
1631
|
+
break;
|
|
1632
|
+
case 'ArrowUp':
|
|
1633
|
+
e.preventDefault();
|
|
1634
|
+
// If no option is highlighted and we have options, start at last option
|
|
1635
|
+
if (this.highlightedIndex < 0 && selectableOptions.length > 0) {
|
|
1636
|
+
this.highlightedIndex = selectableOptions.length - 1;
|
|
1637
|
+
}
|
|
1638
|
+
else {
|
|
1639
|
+
this.highlightedIndex = Math.max(this.highlightedIndex - 1, 0);
|
|
1640
|
+
}
|
|
1641
|
+
this.updateOptionFocus();
|
|
1642
|
+
break;
|
|
1643
|
+
case 'Home':
|
|
1644
|
+
e.preventDefault();
|
|
1645
|
+
if (selectableOptions.length > 0) {
|
|
1646
|
+
this.highlightedIndex = 0;
|
|
1647
|
+
this.updateOptionFocus();
|
|
1648
|
+
}
|
|
1649
|
+
break;
|
|
1650
|
+
case 'End':
|
|
1651
|
+
e.preventDefault();
|
|
1652
|
+
if (selectableOptions.length > 0) {
|
|
1653
|
+
this.highlightedIndex = selectableOptions.length - 1;
|
|
1654
|
+
this.updateOptionFocus();
|
|
1655
|
+
}
|
|
1656
|
+
break;
|
|
1657
|
+
case 'PageDown':
|
|
1658
|
+
e.preventDefault();
|
|
1659
|
+
if (selectableOptions.length > 0) {
|
|
1660
|
+
const nextIndex = Math.min(this.highlightedIndex + 10, selectableOptions.length - 1);
|
|
1661
|
+
this.highlightedIndex = nextIndex;
|
|
1662
|
+
this.updateOptionFocus();
|
|
1663
|
+
}
|
|
1664
|
+
break;
|
|
1665
|
+
case 'PageUp':
|
|
1666
|
+
e.preventDefault();
|
|
1667
|
+
if (selectableOptions.length > 0) {
|
|
1668
|
+
const prevIndex = Math.max(this.highlightedIndex - 10, 0);
|
|
1669
|
+
this.highlightedIndex = prevIndex;
|
|
1670
|
+
this.updateOptionFocus();
|
|
1671
|
+
}
|
|
1672
|
+
break;
|
|
1673
|
+
case 'Enter':
|
|
1674
|
+
e.preventDefault();
|
|
1675
|
+
if (this.highlightedIndex >= 0 && this.highlightedIndex < selectableOptions.length) {
|
|
1676
|
+
this.handleOptionClick(selectableOptions[this.highlightedIndex]);
|
|
1677
|
+
this.restoreFocusToTrigger();
|
|
1678
|
+
}
|
|
1679
|
+
break;
|
|
1680
|
+
case ' ':
|
|
1681
|
+
e.preventDefault();
|
|
1682
|
+
if (this.highlightedIndex >= 0 && this.highlightedIndex < selectableOptions.length) {
|
|
1683
|
+
this.handleOptionClick(selectableOptions[this.highlightedIndex]);
|
|
1684
|
+
this.restoreFocusToTrigger();
|
|
1685
|
+
}
|
|
1686
|
+
break;
|
|
1687
|
+
case 'Escape':
|
|
1688
|
+
e.preventDefault();
|
|
1689
|
+
this.isOpen = false;
|
|
1690
|
+
this.highlightedIndex = -1;
|
|
1691
|
+
this.clearExpandFilterList();
|
|
1692
|
+
this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
|
|
1693
|
+
this.restoreFocusToTrigger();
|
|
1694
|
+
break;
|
|
1695
|
+
case 'Tab':
|
|
1696
|
+
// Allow normal tab behavior to close dropdown and move focus
|
|
1697
|
+
this.isOpen = false;
|
|
1698
|
+
this.highlightedIndex = -1;
|
|
1699
|
+
this.clearExpandFilterList();
|
|
1700
|
+
this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
|
|
1701
|
+
break;
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
// Track if we're in arrow-key navigation mode (focus should move between options)
|
|
1705
|
+
this.isArrowKeyNavigationMode = false;
|
|
1706
|
+
// Event handler for option click
|
|
1707
|
+
this.onOptionClick = (event) => {
|
|
1708
|
+
const idx = Number(event.currentTarget.getAttribute('data-option-index'));
|
|
1709
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
1710
|
+
const option = selectableOptions[idx];
|
|
1711
|
+
this.handleOptionClick(option);
|
|
1712
|
+
};
|
|
1713
|
+
// Event handler for mouse enter on option
|
|
1714
|
+
this.onOptionMouseEnter = (event) => {
|
|
1715
|
+
const idx = Number(event.currentTarget.getAttribute('data-option-index'));
|
|
1716
|
+
this.highlightedIndex = idx;
|
|
1717
|
+
};
|
|
1718
|
+
// Prevent blur on mousedown
|
|
1719
|
+
this.onOptionMouseDown = (event) => {
|
|
1720
|
+
event.preventDefault();
|
|
1721
|
+
};
|
|
1722
|
+
// Event handler for option keyboard events
|
|
1723
|
+
this.onOptionKeyDown = (event) => {
|
|
1724
|
+
// Delegate to main keyboard handler
|
|
1725
|
+
this.handleKeyDown(event);
|
|
1726
|
+
};
|
|
1727
|
+
// Handler for button trigger click
|
|
1728
|
+
this.onButtonTriggerClick = () => {
|
|
1729
|
+
this.isOpen = !this.isOpen;
|
|
1730
|
+
if (this.isOpen) {
|
|
1731
|
+
this.prepareExpandFilterListOnOpen();
|
|
1732
|
+
this.filterOptions();
|
|
1733
|
+
// Trigger initial fetch if async and no options loaded yet
|
|
1734
|
+
if (this.asyncUrl && this.internalOptions.length === 0) {
|
|
1735
|
+
this.debouncedFetchAsyncOptions(this.displayText, 1);
|
|
1736
|
+
}
|
|
1737
|
+
// Set highlighted index and prepare for keyboard navigation
|
|
1738
|
+
this.setInitialHighlightedIndex();
|
|
1739
|
+
// For button trigger, prepare for arrow-key navigation mode
|
|
1740
|
+
this.isArrowKeyNavigationMode = true;
|
|
1741
|
+
setTimeout(() => this.openDropdownPositioning(), 0);
|
|
1742
|
+
}
|
|
1743
|
+
else {
|
|
1744
|
+
// Reset navigation mode when closing
|
|
1745
|
+
this.clearExpandFilterList();
|
|
1746
|
+
this.isArrowKeyNavigationMode = false;
|
|
1747
|
+
}
|
|
1748
|
+
};
|
|
1749
|
+
// Handler for button trigger keyboard events
|
|
1750
|
+
this.onButtonTriggerKeyDown = (e) => {
|
|
1751
|
+
if ((e.key === 'Enter' || e.key === ' ' || e.key === 'ArrowDown' || e.key === 'ArrowUp') && !this.isOpen) {
|
|
1752
|
+
e.preventDefault();
|
|
1753
|
+
e.stopPropagation(); // Prevent the event from bubbling and triggering click
|
|
1754
|
+
this.isOpen = true;
|
|
1755
|
+
this.prepareExpandFilterListOnOpen();
|
|
1756
|
+
this.filterOptions();
|
|
1757
|
+
// Set highlighted index immediately
|
|
1758
|
+
this.setInitialHighlightedIndex();
|
|
1759
|
+
setTimeout(() => {
|
|
1760
|
+
this.openDropdownPositioning();
|
|
1761
|
+
// For all button trigger keyboard opening, focus the first option so subsequent navigation works
|
|
1762
|
+
this.focusFirstOptionForArrowKeys();
|
|
1763
|
+
}, 0);
|
|
1764
|
+
}
|
|
1765
|
+
else if (e.key === 'Escape') {
|
|
1766
|
+
e.preventDefault();
|
|
1767
|
+
if (this.isOpen) {
|
|
1768
|
+
this.isOpen = false;
|
|
1769
|
+
this.highlightedIndex = -1;
|
|
1770
|
+
this.clearExpandFilterList();
|
|
1771
|
+
this.updateAriaActiveDescendant(); // Clear aria-activedescendant
|
|
1772
|
+
this.restoreFocusToTrigger();
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
else if (this.isOpen) {
|
|
1776
|
+
// Delegate other keys to main keyboard handler when dropdown is open
|
|
1777
|
+
this.handleKeyDown(e);
|
|
1778
|
+
}
|
|
1779
|
+
};
|
|
1780
|
+
// Handler for button trigger keyup events - prevents space key from triggering synthetic click
|
|
1781
|
+
this.onButtonTriggerKeyUp = (e) => {
|
|
1782
|
+
if (e.key === ' ') {
|
|
1783
|
+
e.preventDefault();
|
|
1784
|
+
e.stopPropagation();
|
|
1785
|
+
}
|
|
1786
|
+
};
|
|
1787
|
+
// Close dropdown when focus leaves the combobox
|
|
1788
|
+
this.onComboboxFocusOut = (event) => {
|
|
1789
|
+
var _a, _b;
|
|
1790
|
+
const relatedTarget = event.relatedTarget;
|
|
1791
|
+
const isRelatedTargetInListbox = relatedTarget &&
|
|
1792
|
+
(((_a = this.listboxEl) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget)) || ((_b = this.portalEl) === null || _b === void 0 ? void 0 : _b.contains(relatedTarget)));
|
|
1793
|
+
const isRelatedTargetInCombobox = this.el.contains(relatedTarget);
|
|
1794
|
+
// Don't close if focus is moving to an option in the listbox or staying within the combobox
|
|
1795
|
+
if (!isRelatedTargetInCombobox && !isRelatedTargetInListbox) {
|
|
1796
|
+
this.isOpen = false;
|
|
1797
|
+
this.highlightedIndex = -1;
|
|
1798
|
+
this.clearExpandFilterList();
|
|
1799
|
+
this.isArrowKeyNavigationMode = false; // Reset arrow-key navigation mode
|
|
1800
|
+
this.updateAriaActiveDescendant(); // Clear aria-activedescendant
|
|
1801
|
+
// If there's a selected option but the display text doesn't match, restore the selected option's display text
|
|
1802
|
+
if (this.selectedOption && this.displayText !== this.getOptionLabel(this.selectedOption)) {
|
|
1803
|
+
this.displayText = this.getOptionLabel(this.selectedOption);
|
|
1804
|
+
// The @Watch('selectedOption') will handle value and form internals if needed
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
this.handleScroll = (e) => {
|
|
1809
|
+
if (!this.asyncUrl || !this.hasMore || this.loading)
|
|
1810
|
+
return;
|
|
1811
|
+
const target = e.target;
|
|
1812
|
+
const scrollBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
|
|
1813
|
+
// Load more when near bottom (within 50px)
|
|
1814
|
+
if (scrollBottom < 50) {
|
|
1815
|
+
this.pdsComboboxLoadOptions.emit({
|
|
1816
|
+
query: this.displayText,
|
|
1817
|
+
page: this.currentPage + 1,
|
|
1818
|
+
});
|
|
1819
|
+
this.debouncedFetchAsyncOptions(this.displayText, this.currentPage + 1);
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
connectedCallback() {
|
|
1824
|
+
// Initialize ElementInternals for form association (only once per element instance)
|
|
1825
|
+
if (this.el.attachInternals && !this.internals) {
|
|
1826
|
+
this.internals = this.el.attachInternals();
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
componentWillLoad() {
|
|
1830
|
+
this.originalSearchEmitter = this.pdsComboboxSearch;
|
|
1831
|
+
this.updateOptions();
|
|
1832
|
+
}
|
|
1833
|
+
componentDidLoad() {
|
|
1834
|
+
var _a, _b, _c;
|
|
1835
|
+
this.setupDebounce();
|
|
1836
|
+
// Check for value-based preselection if no option is selected yet
|
|
1837
|
+
if (!this.selectedOption && this.value && this.optionEls.length > 0) {
|
|
1838
|
+
const matchingOption = this.optionEls.find(opt => opt.value === this.value);
|
|
1839
|
+
if (matchingOption) {
|
|
1840
|
+
this.setSelectedOption(matchingOption);
|
|
1841
|
+
// Update the display text to show the option's text content
|
|
1842
|
+
this.displayText = this.getOptionLabel(matchingOption);
|
|
1843
|
+
// Keep this.value as the actual option value
|
|
1844
|
+
// this.value remains unchanged (already matches matchingOption.value)
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
// Initialize form value with current value
|
|
1848
|
+
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 : '');
|
|
1849
|
+
}
|
|
1850
|
+
disconnectedCallback() {
|
|
1851
|
+
var _a;
|
|
1852
|
+
if (this.deferredPortalTeardownId !== undefined) {
|
|
1853
|
+
clearTimeout(this.deferredPortalTeardownId);
|
|
1854
|
+
this.deferredPortalTeardownId = undefined;
|
|
1855
|
+
}
|
|
1856
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
1857
|
+
this.clearAsyncFetchState();
|
|
1858
|
+
this.removeBodyPortal();
|
|
1859
|
+
}
|
|
1860
|
+
componentDidRender() {
|
|
1861
|
+
if (this.usesBodyPortal && this.isOpen) {
|
|
1862
|
+
this.syncBodyPortal();
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
isOpenChanged(isOpen) {
|
|
1866
|
+
if (isOpen && this.deferredPortalTeardownId !== undefined) {
|
|
1867
|
+
clearTimeout(this.deferredPortalTeardownId);
|
|
1868
|
+
this.deferredPortalTeardownId = undefined;
|
|
1869
|
+
}
|
|
1870
|
+
if (isOpen && this.usesBodyPortal) {
|
|
1871
|
+
// Rapid reopen can cancel deferred teardown while the portal still holds the previous
|
|
1872
|
+
// listbox node; clear portal state before the next render attaches the new listbox, and
|
|
1873
|
+
// reset Floating UI autoUpdate bookkeeping.
|
|
1874
|
+
this.removeBodyPortal();
|
|
1875
|
+
}
|
|
1876
|
+
if (!isOpen && this.usesBodyPortal) {
|
|
1877
|
+
if (this.deferredPortalTeardownId !== undefined) {
|
|
1878
|
+
clearTimeout(this.deferredPortalTeardownId);
|
|
1879
|
+
}
|
|
1880
|
+
this.deferredPortalTeardownId = setTimeout(() => {
|
|
1881
|
+
this.deferredPortalTeardownId = undefined;
|
|
1882
|
+
if (!this.el.isConnected) {
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
if (!this.isOpen) {
|
|
1886
|
+
this.removeBodyPortal();
|
|
1887
|
+
}
|
|
1888
|
+
}, 0);
|
|
1889
|
+
return;
|
|
1890
|
+
}
|
|
1891
|
+
if (!isOpen) {
|
|
1892
|
+
this.removeBodyPortal();
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
get usesBodyPortal() {
|
|
1896
|
+
return this.dropdownMount === 'body';
|
|
1897
|
+
}
|
|
1898
|
+
get listboxId() {
|
|
1899
|
+
return `${this.componentId}-listbox`;
|
|
1900
|
+
}
|
|
1901
|
+
optionDomId(optionIndex) {
|
|
1902
|
+
return `${this.componentId}-option-${optionIndex}`;
|
|
1903
|
+
}
|
|
1904
|
+
setupDebounce() {
|
|
1905
|
+
const { pdsComboboxSearch, debounce, originalSearchEmitter } = this;
|
|
1906
|
+
this.pdsComboboxSearch = debounce === undefined
|
|
1907
|
+
? originalSearchEmitter !== null && originalSearchEmitter !== void 0 ? originalSearchEmitter : pdsComboboxSearch
|
|
1908
|
+
: utils.debounceEvent(pdsComboboxSearch, debounce);
|
|
1909
|
+
}
|
|
1910
|
+
optionsChanged() {
|
|
1911
|
+
if (this.options) {
|
|
1912
|
+
this.internalOptions = [...this.options];
|
|
1913
|
+
this.updateOptionsFromAsync();
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
handleValueChange() {
|
|
1917
|
+
this.filterOptions();
|
|
1918
|
+
// Sync with form internals for form association
|
|
1919
|
+
this.updateFormValue(this.value);
|
|
1920
|
+
// Find and select option that matches the value (for external value changes)
|
|
1921
|
+
// Only do this if we're not already updating from a selection
|
|
1922
|
+
if (!this.isUpdatingFromSelection && this.value && this.optionEls.length > 0) {
|
|
1923
|
+
const currentSelectedValue = this.selectedOption ? this.selectedOption.value : null;
|
|
1924
|
+
// If the value doesn't match the currently selected option's value, we need to update
|
|
1925
|
+
if (this.value !== currentSelectedValue) {
|
|
1926
|
+
const matchingOption = this.optionEls.find(opt => opt.value === this.value);
|
|
1927
|
+
if (matchingOption) {
|
|
1928
|
+
this.isUpdatingFromSelection = true;
|
|
1929
|
+
this.setSelectedOption(matchingOption);
|
|
1930
|
+
// Update the display text to show the option's text content
|
|
1931
|
+
this.displayText = this.getOptionLabel(matchingOption);
|
|
1932
|
+
// Keep this.value as the actual option value (already correct)
|
|
1933
|
+
this.isUpdatingFromSelection = false;
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
handleSelectedOptionChange() {
|
|
1939
|
+
// Update the layout content when selected option changes
|
|
1940
|
+
this.selectedOptionLayoutContent = this.selectedOption && this.isOptionLayout(this.selectedOption)
|
|
1941
|
+
? this.getOptionLayoutContent(this.selectedOption)
|
|
1942
|
+
: '';
|
|
1943
|
+
// Update chip properties for automatic rendering when selected option changes
|
|
1944
|
+
this.selectedOptionChipProps = this.selectedOption && this.isOptionChip(this.selectedOption)
|
|
1945
|
+
? this.getOptionChipProps(this.selectedOption)
|
|
1946
|
+
: null;
|
|
1947
|
+
// Update display text when selected option changes
|
|
1948
|
+
if (this.selectedOption) {
|
|
1949
|
+
this.displayText = this.getOptionLabel(this.selectedOption);
|
|
1950
|
+
this.value = this.selectedOption.value;
|
|
1951
|
+
// Update form internals with the actual option value
|
|
1952
|
+
this.updateFormValue(this.selectedOption.value);
|
|
1953
|
+
}
|
|
1954
|
+
else {
|
|
1955
|
+
this.displayText = '';
|
|
1956
|
+
this.value = '';
|
|
1957
|
+
this.updateFormValue('');
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
updateFormValue(value) {
|
|
1961
|
+
if (form.isSpecTest())
|
|
1962
|
+
return;
|
|
1963
|
+
if (this.internals && this.internals.setFormValue) {
|
|
1964
|
+
this.internals.setFormValue(value);
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
clearAsyncFetchState() {
|
|
1968
|
+
var _a;
|
|
1969
|
+
if (this.fetchDebounceTimer !== undefined) {
|
|
1970
|
+
window.clearTimeout(this.fetchDebounceTimer);
|
|
1971
|
+
this.fetchDebounceTimer = undefined;
|
|
1972
|
+
}
|
|
1973
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
1974
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
1975
|
+
this.fetchTimeoutTimer = undefined;
|
|
1976
|
+
}
|
|
1977
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
1978
|
+
this.abortController = undefined;
|
|
1979
|
+
}
|
|
1980
|
+
debouncedFetchAsyncOptions(query, page = 1) {
|
|
1981
|
+
var _a;
|
|
1982
|
+
if (!this.asyncUrl)
|
|
1983
|
+
return;
|
|
1984
|
+
if (this.fetchDebounceTimer !== undefined) {
|
|
1985
|
+
window.clearTimeout(this.fetchDebounceTimer);
|
|
1986
|
+
}
|
|
1987
|
+
const delay = Math.max(0, (_a = this.debounce) !== null && _a !== void 0 ? _a : 0);
|
|
1988
|
+
this.fetchDebounceTimer = window.setTimeout(() => {
|
|
1989
|
+
this.fetchDebounceTimer = undefined;
|
|
1990
|
+
this.fetchOptions(query, page);
|
|
1991
|
+
}, delay);
|
|
1992
|
+
}
|
|
1993
|
+
async fetchOptions(query, page = 1) {
|
|
1994
|
+
var _a;
|
|
1995
|
+
if (!this.asyncUrl)
|
|
1996
|
+
return;
|
|
1997
|
+
// Abort any pending request and clear existing timeout
|
|
1998
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
1999
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
2000
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
2001
|
+
this.fetchTimeoutTimer = undefined;
|
|
2002
|
+
}
|
|
2003
|
+
this.abortController = new AbortController();
|
|
2004
|
+
this.loading = true;
|
|
2005
|
+
// Set up timeout for fetch request
|
|
2006
|
+
this.fetchTimeoutTimer = window.setTimeout(() => {
|
|
2007
|
+
var _a;
|
|
2008
|
+
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
2009
|
+
this.fetchTimeoutTimer = undefined;
|
|
2010
|
+
}, this.fetchTimeout);
|
|
2011
|
+
try {
|
|
2012
|
+
// Guard against malformed asyncUrl
|
|
2013
|
+
let url;
|
|
2014
|
+
try {
|
|
2015
|
+
url = new URL(this.asyncUrl, window.location.origin);
|
|
2016
|
+
}
|
|
2017
|
+
catch (urlError) {
|
|
2018
|
+
throw new TypeError(`Invalid asyncUrl: ${this.asyncUrl}`);
|
|
2019
|
+
}
|
|
2020
|
+
if (this.asyncMethod === 'GET') {
|
|
2021
|
+
url.searchParams.set('search', query);
|
|
2022
|
+
url.searchParams.set('page', String(page));
|
|
2023
|
+
}
|
|
2024
|
+
const response = await fetch(url.toString(), Object.assign({ method: this.asyncMethod, signal: this.abortController.signal, headers: {
|
|
2025
|
+
'Content-Type': 'application/json',
|
|
2026
|
+
'Accept': 'application/json',
|
|
2027
|
+
} }, (this.asyncMethod === 'POST' && {
|
|
2028
|
+
body: JSON.stringify({ search: query, page }),
|
|
2029
|
+
})));
|
|
2030
|
+
// Clear timeout on successful response
|
|
2031
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
2032
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
2033
|
+
this.fetchTimeoutTimer = undefined;
|
|
2034
|
+
}
|
|
2035
|
+
if (!response.ok)
|
|
2036
|
+
throw new Error('Failed to fetch options');
|
|
2037
|
+
const data = await response.json();
|
|
2038
|
+
const formattedResults = data.results.map(item => {
|
|
2039
|
+
// If formatResult is provided, use it
|
|
2040
|
+
if (this.formatResult) {
|
|
2041
|
+
return this.formatResult(item);
|
|
2042
|
+
}
|
|
2043
|
+
// Defensive check: ensure item is an object before spreading
|
|
2044
|
+
if (typeof item === 'object' && item !== null) {
|
|
2045
|
+
return Object.assign({ id: item.id, text: item.text }, item);
|
|
2046
|
+
}
|
|
2047
|
+
// Handle primitives by converting to safe shape
|
|
2048
|
+
return {
|
|
2049
|
+
id: String(item),
|
|
2050
|
+
text: String(item),
|
|
2051
|
+
};
|
|
2052
|
+
});
|
|
2053
|
+
if (page === 1) {
|
|
2054
|
+
this.internalOptions = formattedResults;
|
|
2055
|
+
}
|
|
2056
|
+
else {
|
|
2057
|
+
this.internalOptions = [...this.internalOptions, ...formattedResults];
|
|
2058
|
+
}
|
|
2059
|
+
this.hasMore = data.totalCount ? this.internalOptions.length < data.totalCount : false;
|
|
2060
|
+
this.currentPage = page;
|
|
2061
|
+
// Update DOM options from async data
|
|
2062
|
+
this.updateOptionsFromAsync();
|
|
2063
|
+
}
|
|
2064
|
+
catch (error) {
|
|
2065
|
+
// Clear timeout on error
|
|
2066
|
+
if (this.fetchTimeoutTimer !== undefined) {
|
|
2067
|
+
window.clearTimeout(this.fetchTimeoutTimer);
|
|
2068
|
+
this.fetchTimeoutTimer = undefined;
|
|
2069
|
+
}
|
|
2070
|
+
if (error.name !== 'AbortError') {
|
|
2071
|
+
console.error('PdsCombobox: Failed to fetch options', error);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
finally {
|
|
2075
|
+
this.loading = false;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
updateOptionsFromAsync() {
|
|
2079
|
+
if (!this.asyncUrl && !this.options)
|
|
2080
|
+
return;
|
|
2081
|
+
// Clear existing slot-based options when using async
|
|
2082
|
+
this.optionEls = [];
|
|
2083
|
+
this.allItems = [];
|
|
2084
|
+
// Create option elements from async data
|
|
2085
|
+
const asyncOptions = this.options || this.internalOptions;
|
|
2086
|
+
asyncOptions.forEach(opt => {
|
|
2087
|
+
const optionEl = document.createElement('option');
|
|
2088
|
+
optionEl.value = String(opt.id);
|
|
2089
|
+
optionEl.textContent = opt.text;
|
|
2090
|
+
this.optionEls.push(optionEl);
|
|
2091
|
+
this.allItems.push(optionEl);
|
|
2092
|
+
});
|
|
2093
|
+
// Re-apply preselection if a value is set but no option has been selected yet.
|
|
2094
|
+
// This handles the case where `value` is set before async options have loaded.
|
|
2095
|
+
if (this.value && !this.selectedOption) {
|
|
2096
|
+
const matchingOption = this.optionEls.find(opt => opt.value === this.value);
|
|
2097
|
+
if (matchingOption) {
|
|
2098
|
+
this.setSelectedOption(matchingOption);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
this.filterOptions();
|
|
2102
|
+
}
|
|
2103
|
+
updateOptions() {
|
|
2104
|
+
var _a;
|
|
2105
|
+
// Skip slot-based options if using async
|
|
2106
|
+
if (this.asyncUrl || this.options) {
|
|
2107
|
+
this.updateOptionsFromAsync();
|
|
2108
|
+
return;
|
|
2109
|
+
}
|
|
2110
|
+
// Get all elements from the slot
|
|
2111
|
+
const slot = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot[name="option"], slot:not([name])');
|
|
2112
|
+
if (slot) {
|
|
2113
|
+
const allElements = slot.assignedElements({ flatten: true });
|
|
2114
|
+
// Separate options from group labels and flatten optgroups
|
|
2115
|
+
this.allItems = [];
|
|
2116
|
+
this.optionEls = [];
|
|
2117
|
+
allElements.forEach(el => {
|
|
2118
|
+
if (el.tagName === 'OPTION') {
|
|
2119
|
+
this.optionEls.push(el);
|
|
2120
|
+
this.allItems.push(el);
|
|
2121
|
+
}
|
|
2122
|
+
else if (el.tagName === 'OPTGROUP') {
|
|
2123
|
+
const optgroup = el;
|
|
2124
|
+
this.allItems.push(optgroup);
|
|
2125
|
+
// Add optgroup children (options)
|
|
2126
|
+
Array.from(optgroup.children).forEach(child => {
|
|
2127
|
+
if (child.tagName === 'OPTION') {
|
|
2128
|
+
this.optionEls.push(child);
|
|
2129
|
+
this.allItems.push(child);
|
|
2130
|
+
}
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
else if (el.tagName === 'PDS-TEXT') {
|
|
2134
|
+
this.allItems.push(el);
|
|
2135
|
+
}
|
|
2136
|
+
});
|
|
2137
|
+
// Set initial selected option based on value property
|
|
2138
|
+
let initialSelected = null;
|
|
2139
|
+
// Check if value property matches any option
|
|
2140
|
+
if (this.value) {
|
|
2141
|
+
initialSelected = this.optionEls.find(opt => opt.value === this.value) || null;
|
|
2142
|
+
if (initialSelected) {
|
|
2143
|
+
// Update the display text to show the option's text content
|
|
2144
|
+
this.displayText = this.getOptionLabel(initialSelected);
|
|
2145
|
+
// Keep this.value as the actual option value (already correct)
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
// For chip triggers, ensure we always have a selected option
|
|
2149
|
+
if (!initialSelected && this.trigger === 'chip' && this.optionEls.length > 0) {
|
|
2150
|
+
initialSelected = this.optionEls[0]; // Select first option as default
|
|
2151
|
+
this.value = initialSelected.value;
|
|
2152
|
+
this.displayText = this.getOptionLabel(initialSelected);
|
|
2153
|
+
console.warn('PDS Combobox: Chip triggers should always have a selected option. Automatically selected the first option.');
|
|
2154
|
+
}
|
|
2155
|
+
// Update selection if we found a different selected option or if we don't have one
|
|
2156
|
+
if (initialSelected && initialSelected !== this.selectedOption) {
|
|
2157
|
+
this.setSelectedOption(initialSelected);
|
|
2158
|
+
}
|
|
2159
|
+
else if (!this.selectedOption && initialSelected) {
|
|
2160
|
+
this.setSelectedOption(initialSelected);
|
|
2161
|
+
}
|
|
2162
|
+
this.filterOptions();
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
// Helper method to get option label, falling back to text content if no label attribute
|
|
2166
|
+
getOptionLabel(option) {
|
|
2167
|
+
return option.label || option.textContent || '';
|
|
2168
|
+
}
|
|
2169
|
+
// Helper method to get option layout content
|
|
2170
|
+
getOptionLayoutContent(option) {
|
|
2171
|
+
return this.sanitizeHtml(option.innerHTML || '');
|
|
2172
|
+
}
|
|
2173
|
+
// HTML sanitization using DOMPurify library to prevent XSS attacks
|
|
2174
|
+
sanitizeHtml(html) {
|
|
2175
|
+
// Configure DOMPurify to allow Pine Design System components while removing dangerous content
|
|
2176
|
+
const config = {
|
|
2177
|
+
// Allow all custom elements (including pds-* components)
|
|
2178
|
+
CUSTOM_ELEMENT_HANDLING: {
|
|
2179
|
+
tagNameCheck: (tagName) => {
|
|
2180
|
+
// Allow all pds-* tags and standard safe HTML tags
|
|
2181
|
+
return tagName.startsWith('pds-') || /^[a-z]+$/i.test(tagName);
|
|
2182
|
+
},
|
|
2183
|
+
attributeNameCheck: (attr) => {
|
|
2184
|
+
// Allow standard HTML attributes, data-* attributes, and Pine component attributes
|
|
2185
|
+
return /^[a-zA-Z][a-zA-Z0-9-]*$/.test(attr) || attr.startsWith('data-') || attr.startsWith('aria-');
|
|
2186
|
+
},
|
|
2187
|
+
allowCustomizedBuiltInElements: false,
|
|
2188
|
+
},
|
|
2189
|
+
// Allow standard safe attributes
|
|
2190
|
+
ALLOW_DATA_ATTR: true,
|
|
2191
|
+
ALLOW_ARIA_ATTR: true,
|
|
2192
|
+
// Specifically forbid dangerous tags
|
|
2193
|
+
FORBID_TAGS: ['script', 'iframe', 'object', 'embed', 'form', 'input', 'textarea', 'select', 'button', 'style'],
|
|
2194
|
+
// Forbid all event handler attributes
|
|
2195
|
+
FORBID_ATTR: [
|
|
2196
|
+
'onerror', 'onload', 'onclick', 'onmouseover', 'onmouseout', 'onmousemove',
|
|
2197
|
+
'onfocus', 'onblur', 'onchange', 'onsubmit', 'onkeydown', 'onkeyup', 'onkeypress',
|
|
2198
|
+
'onmousedown', 'onmouseup', 'ondblclick', 'oncontextmenu', 'onscroll'
|
|
2199
|
+
],
|
|
2200
|
+
// Safe protocol whitelist
|
|
2201
|
+
ALLOWED_URI_REGEXP: /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,
|
|
2202
|
+
};
|
|
2203
|
+
return purify.sanitize(html, config);
|
|
2204
|
+
}
|
|
2205
|
+
// Helper method to check if option should render as layout
|
|
2206
|
+
isOptionLayout(option) {
|
|
2207
|
+
return this.customOptionLayouts && option.hasAttribute('data-layout');
|
|
2208
|
+
}
|
|
2209
|
+
// Helper method to check if option has chip attributes (new automatic approach)
|
|
2210
|
+
isOptionChip(option) {
|
|
2211
|
+
return option.hasAttribute('chip-sentiment') ||
|
|
2212
|
+
option.hasAttribute('chip-large') ||
|
|
2213
|
+
option.hasAttribute('chip-icon') ||
|
|
2214
|
+
option.hasAttribute('chip-dot');
|
|
2215
|
+
}
|
|
2216
|
+
// Helper method to get chip properties from option attributes
|
|
2217
|
+
getOptionChipProps(option) {
|
|
2218
|
+
return {
|
|
2219
|
+
sentiment: option.getAttribute('chip-sentiment') || 'neutral',
|
|
2220
|
+
large: option.hasAttribute('chip-large'),
|
|
2221
|
+
icon: option.getAttribute('chip-icon') || undefined,
|
|
2222
|
+
dot: option.hasAttribute('chip-dot')
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
2225
|
+
// Helper method to check if option is selected (single source of truth)
|
|
2226
|
+
isOptionSelected(option) {
|
|
2227
|
+
return this.selectedOption === option;
|
|
2228
|
+
}
|
|
2229
|
+
// Helper method to set selected option (centralized state management)
|
|
2230
|
+
setSelectedOption(option) {
|
|
2231
|
+
this.selectedOption = option;
|
|
2232
|
+
// Immediately update chip properties for automatic rendering to ensure reactivity
|
|
2233
|
+
if (option && this.isOptionChip(option)) {
|
|
2234
|
+
this.selectedOptionChipProps = this.getOptionChipProps(option);
|
|
2235
|
+
}
|
|
2236
|
+
else {
|
|
2237
|
+
this.selectedOptionChipProps = null;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
filterOptions() {
|
|
2241
|
+
// Ensure allItems includes optionEls if not already populated (for edge cases)
|
|
2242
|
+
if (this.allItems.length === 0 && this.optionEls.length > 0) {
|
|
2243
|
+
this.allItems = [...this.optionEls];
|
|
2244
|
+
}
|
|
2245
|
+
if (this.mode === 'select-only' || this.expandFilterListWhileOpen) {
|
|
2246
|
+
this.filteredItems = [...this.allItems];
|
|
2247
|
+
}
|
|
2248
|
+
else {
|
|
2249
|
+
const val = this.displayText.toLowerCase();
|
|
2250
|
+
const filteredOptions = this.optionEls.filter(option => {
|
|
2251
|
+
// For layout options, search both text content and data-search-text attribute
|
|
2252
|
+
if (this.isOptionLayout(option)) {
|
|
2253
|
+
const searchText = option.getAttribute('data-search-text') || option.textContent || '';
|
|
2254
|
+
return searchText.toLowerCase().includes(val);
|
|
2255
|
+
}
|
|
2256
|
+
return this.getOptionLabel(option).toLowerCase().includes(val);
|
|
2257
|
+
});
|
|
2258
|
+
// Rebuild filtered items maintaining group structure - simplified approach
|
|
2259
|
+
this.filteredItems = [];
|
|
2260
|
+
let currentGroupLabel = null;
|
|
2261
|
+
this.allItems.forEach(item => {
|
|
2262
|
+
if (item.tagName === 'OPTGROUP' || item.tagName === 'PDS-TEXT') {
|
|
2263
|
+
currentGroupLabel = item;
|
|
2264
|
+
}
|
|
2265
|
+
else if (item.tagName === 'OPTION' && filteredOptions.includes(item)) {
|
|
2266
|
+
const optionEl = item;
|
|
2267
|
+
const parent = optionEl.parentElement;
|
|
2268
|
+
let labelToUse = null;
|
|
2269
|
+
if (parent && parent.tagName === 'OPTGROUP') {
|
|
2270
|
+
// Only use the actual parent optgroup as label
|
|
2271
|
+
labelToUse = parent;
|
|
2272
|
+
}
|
|
2273
|
+
else if (currentGroupLabel && currentGroupLabel.tagName === 'PDS-TEXT') {
|
|
2274
|
+
// Allow pds-text to label subsequent top-level options until another label appears
|
|
2275
|
+
labelToUse = currentGroupLabel;
|
|
2276
|
+
}
|
|
2277
|
+
if (labelToUse && !this.filteredItems.includes(labelToUse)) {
|
|
2278
|
+
this.filteredItems.push(labelToUse);
|
|
2279
|
+
}
|
|
2280
|
+
this.filteredItems.push(optionEl);
|
|
2281
|
+
}
|
|
2282
|
+
});
|
|
2283
|
+
}
|
|
2284
|
+
this.highlightedIndex = -1;
|
|
2285
|
+
}
|
|
2286
|
+
clearExpandFilterList() {
|
|
2287
|
+
this.expandFilterListWhileOpen = false;
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* When reopening the dropdown in filter mode with the input still showing the
|
|
2291
|
+
* committed selection label, show the full option list until the user edits the query.
|
|
2292
|
+
*/
|
|
2293
|
+
prepareExpandFilterListOnOpen() {
|
|
2294
|
+
if (this.mode === 'filter' &&
|
|
2295
|
+
this.selectedOption &&
|
|
2296
|
+
this.displayText === this.getOptionLabel(this.selectedOption)) {
|
|
2297
|
+
this.expandFilterListWhileOpen = true;
|
|
2298
|
+
}
|
|
2299
|
+
else {
|
|
2300
|
+
this.expandFilterListWhileOpen = false;
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
positionDropdown() {
|
|
2304
|
+
if (!this.triggerEl || !this.listboxEl) {
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
const strategy = this.usesBodyPortal ? 'fixed' : 'absolute';
|
|
2308
|
+
const zIndex = this.usesBodyPortal
|
|
2309
|
+
? 'var(--pine-z-index-priority)'
|
|
2310
|
+
: 'var(--pine-z-index-raised)';
|
|
2311
|
+
this.listboxEl.style.width = this.dropdownWidth;
|
|
2312
|
+
if (this.maxHeight) {
|
|
2313
|
+
this.listboxEl.style.maxHeight = this.maxHeight;
|
|
2314
|
+
this.listboxEl.style.overflowY = 'auto';
|
|
2315
|
+
}
|
|
2316
|
+
return floatingUi_dom.computePosition(this.triggerEl, this.listboxEl, {
|
|
2317
|
+
placement: this.dropdownPlacement,
|
|
2318
|
+
strategy,
|
|
2319
|
+
middleware: [floatingUi_dom.offset(12), floatingUi_dom.flip(), floatingUi_dom.shift({ padding: 5 })],
|
|
2320
|
+
}).then(({ x, y }) => {
|
|
2321
|
+
if (!this.listboxEl) {
|
|
2322
|
+
return;
|
|
2323
|
+
}
|
|
2324
|
+
Object.assign(this.listboxEl.style, {
|
|
2325
|
+
left: `${x}px`,
|
|
2326
|
+
top: `${y}px`,
|
|
2327
|
+
position: strategy,
|
|
2328
|
+
zIndex,
|
|
2329
|
+
});
|
|
2330
|
+
});
|
|
2331
|
+
}
|
|
2332
|
+
openDropdownPositioning() {
|
|
2333
|
+
if (!this.triggerEl || !this.listboxEl) {
|
|
2334
|
+
return;
|
|
2335
|
+
}
|
|
2336
|
+
void this.positionDropdown();
|
|
2337
|
+
}
|
|
2338
|
+
startBodyPortalAutoUpdate() {
|
|
2339
|
+
if (this.bodyPortalAutoUpdateActive || !this.triggerEl || !this.listboxEl) {
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
|
+
this.cleanupPositionAutoUpdate = floatingUi_dom.autoUpdate(this.triggerEl, this.listboxEl, () => {
|
|
2343
|
+
void this.positionDropdown();
|
|
2344
|
+
});
|
|
2345
|
+
this.bodyPortalAutoUpdateActive = true;
|
|
2346
|
+
}
|
|
2347
|
+
stopBodyPortalAutoUpdate() {
|
|
2348
|
+
var _a;
|
|
2349
|
+
(_a = this.cleanupPositionAutoUpdate) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
2350
|
+
this.cleanupPositionAutoUpdate = undefined;
|
|
2351
|
+
this.bodyPortalAutoUpdateActive = false;
|
|
2352
|
+
}
|
|
2353
|
+
getPortalMountRoot() {
|
|
2354
|
+
var _a;
|
|
2355
|
+
return (_a = this.findNearestDialogForPortal(this.el)) !== null && _a !== void 0 ? _a : document.body;
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Resolves the native `<dialog>` to host the portaled listbox so it stays in the same top layer
|
|
2359
|
+
* as `showModal()`. `Element.closest('dialog')` stops at shadow boundaries and can miss a
|
|
2360
|
+
* dialog that only wraps slotted content; this walks assigned slots and shadow hosts, and
|
|
2361
|
+
* falls back to `pds-modal`'s dialog when the combobox lives inside that subtree.
|
|
2362
|
+
*/
|
|
2363
|
+
findNearestDialogForPortal(from) {
|
|
2364
|
+
const seen = new Set();
|
|
2365
|
+
let current = from;
|
|
2366
|
+
while (current && !seen.has(current)) {
|
|
2367
|
+
seen.add(current);
|
|
2368
|
+
if (current.nodeType === Node.ELEMENT_NODE && current.localName === 'dialog') {
|
|
2369
|
+
return current;
|
|
2370
|
+
}
|
|
2371
|
+
if (current.nodeType === Node.ELEMENT_NODE) {
|
|
2372
|
+
const assigned = current.assignedSlot;
|
|
2373
|
+
if (assigned) {
|
|
2374
|
+
current = assigned;
|
|
2375
|
+
continue;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
const parent = current.parentNode;
|
|
2379
|
+
if (parent) {
|
|
2380
|
+
current = parent instanceof ShadowRoot ? parent.host : parent;
|
|
2381
|
+
continue;
|
|
2382
|
+
}
|
|
2383
|
+
break;
|
|
2384
|
+
}
|
|
2385
|
+
const pineModal = from.closest('pds-modal');
|
|
2386
|
+
if (pineModal) {
|
|
2387
|
+
const pineDialog = pineModal.querySelector('dialog');
|
|
2388
|
+
if (pineDialog) {
|
|
2389
|
+
return pineDialog;
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
return null;
|
|
2393
|
+
}
|
|
2394
|
+
ensureBodyPortal() {
|
|
2395
|
+
if (this.portalEl !== null) {
|
|
2396
|
+
const target = this.getPortalMountRoot();
|
|
2397
|
+
if (this.portalEl.parentElement !== target) {
|
|
2398
|
+
target.appendChild(this.portalEl);
|
|
2399
|
+
}
|
|
2400
|
+
return this.portalEl;
|
|
2401
|
+
}
|
|
2402
|
+
this.portalEl = document.createElement('div');
|
|
2403
|
+
this.portalEl.className = 'pds-combobox-dropdown-portal';
|
|
2404
|
+
this.getPortalMountRoot().appendChild(this.portalEl);
|
|
2405
|
+
return this.portalEl;
|
|
2406
|
+
}
|
|
2407
|
+
syncBodyPortal() {
|
|
2408
|
+
if (!this.listboxEl) {
|
|
2409
|
+
return;
|
|
2410
|
+
}
|
|
2411
|
+
const portal = this.ensureBodyPortal();
|
|
2412
|
+
for (const stale of Array.from(portal.children)) {
|
|
2413
|
+
if (stale !== this.listboxEl) {
|
|
2414
|
+
stale.remove();
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
if (this.listboxEl.parentElement !== portal) {
|
|
2418
|
+
portal.appendChild(this.listboxEl);
|
|
2419
|
+
void this.positionDropdown();
|
|
2420
|
+
this.startBodyPortalAutoUpdate();
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
removeBodyPortal() {
|
|
2424
|
+
var _a;
|
|
2425
|
+
this.stopBodyPortalAutoUpdate();
|
|
2426
|
+
if ((_a = this.portalEl) === null || _a === void 0 ? void 0 : _a.parentNode) {
|
|
2427
|
+
this.portalEl.parentNode.removeChild(this.portalEl);
|
|
2428
|
+
}
|
|
2429
|
+
this.portalEl = null;
|
|
2430
|
+
if (this.listboxEl && !this.listboxEl.isConnected) {
|
|
2431
|
+
this.listboxEl = undefined;
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* Sets focus on the native input element.
|
|
2436
|
+
*/
|
|
2437
|
+
async setFocus() {
|
|
2438
|
+
var _a;
|
|
2439
|
+
if (this.inputEl) {
|
|
2440
|
+
this.inputEl.focus();
|
|
2441
|
+
}
|
|
2442
|
+
else {
|
|
2443
|
+
(_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* Sets the initial highlighted index when dropdown opens.
|
|
2448
|
+
* If there's a selected option, highlight it. Otherwise, highlight the first option.
|
|
2449
|
+
*/
|
|
2450
|
+
setInitialHighlightedIndex() {
|
|
2451
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
2452
|
+
if (selectableOptions.length === 0) {
|
|
2453
|
+
this.highlightedIndex = -1;
|
|
2454
|
+
return;
|
|
2455
|
+
}
|
|
2456
|
+
// If there's a selected option, find its index in the filtered options
|
|
2457
|
+
if (this.selectedOption) {
|
|
2458
|
+
const selectedIndex = selectableOptions.findIndex(option => option === this.selectedOption);
|
|
2459
|
+
if (selectedIndex >= 0) {
|
|
2460
|
+
this.highlightedIndex = selectedIndex;
|
|
2461
|
+
return;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
// No selected option or selected option not in filtered results, highlight first option
|
|
2465
|
+
this.highlightedIndex = 0;
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* Focus management helper - moves focus to the first option when dropdown opens
|
|
2469
|
+
*/
|
|
2470
|
+
focusFirstOption() {
|
|
2471
|
+
if (this.isOpen) {
|
|
2472
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
2473
|
+
if (selectableOptions.length > 0) {
|
|
2474
|
+
this.setInitialHighlightedIndex();
|
|
2475
|
+
// DON'T focus the option elements - keep focus on trigger and use aria-activedescendant
|
|
2476
|
+
// This prevents the focusout event that was closing the dropdown
|
|
2477
|
+
// But still call updateOptionFocus for scrolling
|
|
2478
|
+
if (this.listboxEl) {
|
|
2479
|
+
this.updateOptionFocus();
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
/**
|
|
2485
|
+
* Focus management helper - actually focuses the first option when opened via arrow keys
|
|
2486
|
+
*/
|
|
2487
|
+
focusFirstOptionForArrowKeys() {
|
|
2488
|
+
if (!this.isOpen) {
|
|
2489
|
+
return;
|
|
2490
|
+
}
|
|
2491
|
+
// Body-mounted listboxes stay outside modal focus traps; keep focus on the trigger.
|
|
2492
|
+
if (this.usesBodyPortal) {
|
|
2493
|
+
this.isArrowKeyNavigationMode = true;
|
|
2494
|
+
this.focusFirstOption();
|
|
2495
|
+
return;
|
|
2496
|
+
}
|
|
2497
|
+
this.isArrowKeyNavigationMode = true;
|
|
2498
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
2499
|
+
if (selectableOptions.length > 0) {
|
|
2500
|
+
this.setInitialHighlightedIndex();
|
|
2501
|
+
if (this.listboxEl) {
|
|
2502
|
+
const optionElements = this.listboxEl.querySelectorAll('[role="option"]');
|
|
2503
|
+
const highlightedOption = optionElements[this.highlightedIndex];
|
|
2504
|
+
if (highlightedOption) {
|
|
2505
|
+
optionElements.forEach(option => {
|
|
2506
|
+
option.setAttribute('tabindex', '-1');
|
|
2507
|
+
});
|
|
2508
|
+
highlightedOption.setAttribute('tabindex', '0');
|
|
2509
|
+
highlightedOption.focus();
|
|
2510
|
+
highlightedOption.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
this.updateAriaActiveDescendant();
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Focus management helper - updates visual state and scrolling for the currently highlighted option
|
|
2518
|
+
* Note: We don't actually focus the option to prevent focusout events that close the dropdown
|
|
2519
|
+
*/
|
|
2520
|
+
updateOptionFocus() {
|
|
2521
|
+
if (!this.listboxEl || this.highlightedIndex < 0)
|
|
2522
|
+
return;
|
|
2523
|
+
const optionElements = this.listboxEl.querySelectorAll('[role="option"]');
|
|
2524
|
+
const currentOption = optionElements[this.highlightedIndex];
|
|
2525
|
+
if (currentOption) {
|
|
2526
|
+
// Check if any option currently has focus OR if we're in arrow-key navigation mode
|
|
2527
|
+
const hasOptionFocus = Array.from(optionElements).some(el => el === document.activeElement);
|
|
2528
|
+
const shouldFocusOption = !this.usesBodyPortal && (hasOptionFocus || this.isArrowKeyNavigationMode);
|
|
2529
|
+
if (shouldFocusOption) {
|
|
2530
|
+
optionElements.forEach(option => {
|
|
2531
|
+
option.setAttribute('tabindex', '-1');
|
|
2532
|
+
});
|
|
2533
|
+
currentOption.setAttribute('tabindex', '0');
|
|
2534
|
+
currentOption.focus();
|
|
2535
|
+
}
|
|
2536
|
+
// Always scroll the option into view
|
|
2537
|
+
currentOption.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
|
|
2538
|
+
}
|
|
2539
|
+
// Always update aria-activedescendant on the trigger element
|
|
2540
|
+
this.updateAriaActiveDescendant();
|
|
2541
|
+
}
|
|
2542
|
+
/**
|
|
2543
|
+
* Updates aria-activedescendant on the trigger element
|
|
2544
|
+
*/
|
|
2545
|
+
updateAriaActiveDescendant() {
|
|
2546
|
+
if (this.triggerEl && this.highlightedIndex >= 0) {
|
|
2547
|
+
this.triggerEl.setAttribute('aria-activedescendant', this.optionDomId(this.highlightedIndex));
|
|
2548
|
+
}
|
|
2549
|
+
else if (this.triggerEl) {
|
|
2550
|
+
this.triggerEl.removeAttribute('aria-activedescendant');
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
/**
|
|
2554
|
+
* Focus management helper - restores focus to the trigger element
|
|
2555
|
+
*/
|
|
2556
|
+
restoreFocusToTrigger() {
|
|
2557
|
+
setTimeout(() => {
|
|
2558
|
+
if (this.inputEl) {
|
|
2559
|
+
this.inputEl.focus();
|
|
2560
|
+
}
|
|
2561
|
+
else if (this.triggerEl) {
|
|
2562
|
+
this.triggerEl.focus();
|
|
2563
|
+
}
|
|
2564
|
+
}, 0);
|
|
2565
|
+
}
|
|
2566
|
+
/**
|
|
2567
|
+
* Gets the value of the currently selected option.
|
|
2568
|
+
*/
|
|
2569
|
+
async getSelectedValue() {
|
|
2570
|
+
return this.selectedOption ? this.selectedOption.value : null;
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* Clears the selected value and resets the component.
|
|
2574
|
+
*/
|
|
2575
|
+
async clear() {
|
|
2576
|
+
const hadValue = this.value !== '' || this.displayText !== '';
|
|
2577
|
+
this.displayText = '';
|
|
2578
|
+
this.setSelectedOption(null);
|
|
2579
|
+
this.value = '';
|
|
2580
|
+
this.filterOptions();
|
|
2581
|
+
this.updateFormValue('');
|
|
2582
|
+
if (hadValue) {
|
|
2583
|
+
this.pdsComboboxChange.emit({ value: '' });
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2586
|
+
// Get the label of the selected option
|
|
2587
|
+
get selectedLabel() {
|
|
2588
|
+
return this.displayText || '';
|
|
2589
|
+
}
|
|
2590
|
+
// Get the layout content of the selected option for button trigger
|
|
2591
|
+
get selectedLayoutContent() {
|
|
2592
|
+
return this.selectedOptionLayoutContent;
|
|
2593
|
+
}
|
|
2594
|
+
// Check if selected option has layout
|
|
2595
|
+
get selectedHasLayout() {
|
|
2596
|
+
return this.selectedOption ? this.isOptionLayout(this.selectedOption) : false;
|
|
2597
|
+
}
|
|
2598
|
+
// Extract chip sentiment from selected option's attributes, layout content, or slotted trigger content
|
|
2599
|
+
get selectedChipSentiment() {
|
|
2600
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
2601
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
2602
|
+
const sentiment = this.selectedOption.getAttribute('chip-sentiment');
|
|
2603
|
+
if (sentiment)
|
|
2604
|
+
return sentiment;
|
|
2605
|
+
}
|
|
2606
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
2607
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
2608
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
2609
|
+
const sentiment = chipElement === null || chipElement === void 0 ? void 0 : chipElement.getAttribute('sentiment');
|
|
2610
|
+
if (sentiment)
|
|
2611
|
+
return sentiment;
|
|
2612
|
+
}
|
|
2613
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
2614
|
+
if (this.customTriggerContent) {
|
|
2615
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
2616
|
+
if (slottedChip) {
|
|
2617
|
+
const sentiment = slottedChip.getAttribute('sentiment');
|
|
2618
|
+
if (sentiment)
|
|
2619
|
+
return sentiment;
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
// Fallback: Use component props
|
|
2623
|
+
return this.chipSentiment;
|
|
2624
|
+
}
|
|
2625
|
+
// Extract chip large from selected option's attributes, layout content, or slotted trigger content
|
|
2626
|
+
get selectedChipLarge() {
|
|
2627
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
2628
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
2629
|
+
if (this.selectedOption.hasAttribute('chip-large'))
|
|
2630
|
+
return true;
|
|
2631
|
+
}
|
|
2632
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
2633
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
2634
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
2635
|
+
if ((chipElement === null || chipElement === void 0 ? void 0 : chipElement.getAttribute('size')) === 'lg')
|
|
2636
|
+
return true;
|
|
2637
|
+
}
|
|
2638
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
2639
|
+
if (this.customTriggerContent) {
|
|
2640
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
2641
|
+
if (slottedChip && slottedChip.getAttribute('size') === 'lg') {
|
|
2642
|
+
return true;
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
// Fallback: Use component props
|
|
2646
|
+
return this.chipLarge;
|
|
2647
|
+
}
|
|
2648
|
+
// Extract chip icon from selected option's attributes, layout content, or slotted trigger content
|
|
2649
|
+
get selectedChipIcon() {
|
|
2650
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
2651
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
2652
|
+
const icon = this.selectedOption.getAttribute('chip-icon');
|
|
2653
|
+
if (icon)
|
|
2654
|
+
return icon;
|
|
2655
|
+
}
|
|
2656
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
2657
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
2658
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
2659
|
+
const icon = chipElement === null || chipElement === void 0 ? void 0 : chipElement.getAttribute('icon');
|
|
2660
|
+
if (icon)
|
|
2661
|
+
return icon;
|
|
2662
|
+
}
|
|
2663
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
2664
|
+
if (this.customTriggerContent) {
|
|
2665
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
2666
|
+
if (slottedChip) {
|
|
2667
|
+
const icon = slottedChip.getAttribute('icon');
|
|
2668
|
+
if (icon)
|
|
2669
|
+
return icon;
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
// Fallback: Use component props
|
|
2673
|
+
return this.chipIcon;
|
|
2674
|
+
}
|
|
2675
|
+
// Extract chip dot from selected option's attributes, layout content, or slotted trigger content
|
|
2676
|
+
get selectedChipDot() {
|
|
2677
|
+
// First priority: Check selected option's chip attributes (new automatic approach)
|
|
2678
|
+
if (this.selectedOption && this.isOptionChip(this.selectedOption)) {
|
|
2679
|
+
if (this.selectedOption.hasAttribute('chip-dot'))
|
|
2680
|
+
return true;
|
|
2681
|
+
}
|
|
2682
|
+
// Second priority: Check selected option's layout content (existing custom layout approach)
|
|
2683
|
+
if (this.selectedOption && this.isOptionLayout(this.selectedOption)) {
|
|
2684
|
+
const chipElement = this.selectedOption.querySelector('pds-chip');
|
|
2685
|
+
if (chipElement === null || chipElement === void 0 ? void 0 : chipElement.hasAttribute('dot'))
|
|
2686
|
+
return true;
|
|
2687
|
+
}
|
|
2688
|
+
// Third priority: Check if we have custom trigger content with a chip (initial state)
|
|
2689
|
+
if (this.customTriggerContent) {
|
|
2690
|
+
const slottedChip = this.el.querySelector('pds-chip[slot="trigger-content"]');
|
|
2691
|
+
if (slottedChip && slottedChip.hasAttribute('dot')) {
|
|
2692
|
+
return true;
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
// Fallback: Use component props
|
|
2696
|
+
return this.chipDot;
|
|
2697
|
+
}
|
|
2698
|
+
handleOptionClick(option) {
|
|
2699
|
+
// Update reactive state - single source of truth
|
|
2700
|
+
// The @Watch('selectedOption') will handle displayText, value, and form internals
|
|
2701
|
+
this.setSelectedOption(option);
|
|
2702
|
+
this.isOpen = false;
|
|
2703
|
+
this.clearExpandFilterList();
|
|
2704
|
+
this.pdsComboboxChange.emit({ value: option.value });
|
|
2705
|
+
}
|
|
2706
|
+
renderDropdown() {
|
|
2707
|
+
if (!this.isOpen) {
|
|
2708
|
+
return null;
|
|
2709
|
+
}
|
|
2710
|
+
const hasSlottedEmpty = !this.usesBodyPortal && !!this.el.querySelector('[slot="empty"]');
|
|
2711
|
+
const hasSlottedLoading = !this.usesBodyPortal && !!this.el.querySelector('[slot="loading"]');
|
|
2712
|
+
let optionIndex = 0;
|
|
2713
|
+
const selectableOptions = this.filteredItems.filter(item => item.tagName === 'OPTION');
|
|
2714
|
+
return (index.h("ul", { class: "pds-combobox__listbox", role: "listbox", id: this.listboxId, "aria-label": this.label || 'Options', "aria-multiselectable": "false", ref: el => (this.listboxEl = el), onScroll: this.handleScroll }, this.loading && (index.h("li", { class: "pds-combobox__loading", role: "presentation" }, hasSlottedLoading ? (index.h("slot", { name: "loading" })) : (index.h("pds-loader", { size: "small" })))), !this.loading && this.filteredItems.length === 0 && (index.h("li", { class: "pds-combobox__empty", role: "presentation" }, hasSlottedEmpty ? (index.h("slot", { name: "empty" })) : (index.h("span", null, "No options found")))), this.filteredItems.map((item, itemIdx) => {
|
|
2715
|
+
if (item.tagName === 'OPTGROUP') {
|
|
2716
|
+
const optgroup = item;
|
|
2717
|
+
return (index.h("li", { key: `optgroup-${itemIdx}`, class: "pds-combobox__group-label", role: "presentation", "aria-label": optgroup.label }, optgroup.label));
|
|
2718
|
+
}
|
|
2719
|
+
else if (item.tagName === 'PDS-TEXT') {
|
|
2720
|
+
const pdsText = item;
|
|
2721
|
+
return (index.h("li", { key: `pds-text-${itemIdx}`, class: "pds-combobox__group-label", role: "presentation" }, pdsText.textContent));
|
|
2722
|
+
}
|
|
2723
|
+
else if (item.tagName === 'OPTION') {
|
|
2724
|
+
const option = item;
|
|
2725
|
+
const isSelected = this.isOptionSelected(option);
|
|
2726
|
+
const isHighlighted = this.highlightedIndex === optionIndex;
|
|
2727
|
+
const isLayout = this.isOptionLayout(option);
|
|
2728
|
+
const isChip = this.isOptionChip(option);
|
|
2729
|
+
const currentOptionIndex = optionIndex++;
|
|
2730
|
+
return (index.h("li", { key: option.value, id: this.optionDomId(currentOptionIndex), role: "option", "aria-selected": isSelected ? 'true' : 'false', "aria-setsize": selectableOptions.length, "aria-posinset": currentOptionIndex + 1, "aria-label": isLayout || isChip ? option.getAttribute('aria-label') || this.getOptionLabel(option) : undefined, tabindex: this.usesBodyPortal ? '-1' : isHighlighted ? '0' : '-1', class: {
|
|
2731
|
+
'pds-combobox__option': true,
|
|
2732
|
+
'pds-combobox__option--highlighted': isHighlighted,
|
|
2733
|
+
'pds-combobox__option--layout': isLayout,
|
|
2734
|
+
'pds-combobox__option--chip': isChip,
|
|
2735
|
+
}, "data-option-index": currentOptionIndex, onMouseDown: this.onOptionMouseDown, onClick: this.onOptionClick, onMouseEnter: this.onOptionMouseEnter, onKeyDown: this.onOptionKeyDown }, isLayout ? (index.h("pds-box", { class: "pds-combobox__option-layout-wrapper", innerHTML: this.getOptionLayoutContent(option) })) : isChip ? (this.renderOptionChip(option)) : (this.getOptionLabel(option)), isSelected && index.h("pds-icon", { icon: "check", size: "regular", class: "pds-combobox__option-check" })));
|
|
2736
|
+
}
|
|
2737
|
+
return null;
|
|
2738
|
+
}), this.hasMore && !this.loading && (index.h("li", { class: "pds-combobox__load-more", role: "presentation" }, index.h("pds-loader", { size: "small" })))));
|
|
2739
|
+
}
|
|
2740
|
+
// Helper method to render the caret icon
|
|
2741
|
+
renderCaretIcon() {
|
|
2742
|
+
return index.h("pds-icon", { icon: "caret-down", "aria-hidden": "true", class: "pds-combobox__button-trigger-chevron" });
|
|
2743
|
+
}
|
|
2744
|
+
// Helper method to render layout content
|
|
2745
|
+
renderLayoutContent() {
|
|
2746
|
+
return (index.h("div", { class: "pds-combobox__button-trigger-layout-wrapper", innerHTML: this.selectedLayoutContent }));
|
|
2747
|
+
}
|
|
2748
|
+
// Helper method to render default text content
|
|
2749
|
+
renderDefaultContent() {
|
|
2750
|
+
return (index.h("span", { class: "pds-combobox__button-trigger-label" }, this.selectedLabel || this.placeholder));
|
|
2751
|
+
}
|
|
2752
|
+
// Helper method to check if we should show layout content
|
|
2753
|
+
shouldShowLayoutContent() {
|
|
2754
|
+
return this.selectedHasLayout && !!this.selectedLayoutContent;
|
|
2755
|
+
}
|
|
2756
|
+
// Helper method to build chip trigger CSS classes
|
|
2757
|
+
getChipTriggerClass() {
|
|
2758
|
+
const classes = ['pds-combobox__chip-trigger'];
|
|
2759
|
+
// Add sentiment class
|
|
2760
|
+
classes.push(`pds-combobox__chip-trigger--${this.selectedChipSentiment}`);
|
|
2761
|
+
// Always use dropdown variant for chip triggers
|
|
2762
|
+
classes.push('pds-combobox__chip-trigger--dropdown');
|
|
2763
|
+
// Add large class if needed
|
|
2764
|
+
if (this.selectedChipLarge) {
|
|
2765
|
+
classes.push('pds-combobox__chip-trigger--large');
|
|
2766
|
+
}
|
|
2767
|
+
// Add dot class if needed
|
|
2768
|
+
if (this.selectedChipDot) {
|
|
2769
|
+
classes.push('pds-combobox__chip-trigger--dot');
|
|
2770
|
+
}
|
|
2771
|
+
return classes.join(' ');
|
|
2772
|
+
}
|
|
2773
|
+
renderButtonTriggerContent() {
|
|
2774
|
+
// Case 1: Custom trigger content with layout priority
|
|
2775
|
+
if (this.customTriggerContent) {
|
|
2776
|
+
if (this.shouldShowLayoutContent()) {
|
|
2777
|
+
return [this.renderLayoutContent(), this.renderCaretIcon()];
|
|
2778
|
+
}
|
|
2779
|
+
// Fall back to slot content when no layout is available
|
|
2780
|
+
return index.h("slot", { name: "trigger-content" });
|
|
2781
|
+
}
|
|
2782
|
+
// Case 2: Standard mode with layout content
|
|
2783
|
+
if (this.shouldShowLayoutContent()) {
|
|
2784
|
+
return [this.renderLayoutContent(), this.renderCaretIcon()];
|
|
2785
|
+
}
|
|
2786
|
+
// Case 3: Standard mode with default text content
|
|
2787
|
+
return [this.renderDefaultContent(), this.renderCaretIcon()];
|
|
2788
|
+
}
|
|
2789
|
+
renderChipTriggerContent() {
|
|
2790
|
+
// Case 1: Custom trigger content with layout priority
|
|
2791
|
+
if (this.customTriggerContent) {
|
|
2792
|
+
if (this.shouldShowLayoutContent()) {
|
|
2793
|
+
// When using custom layouts, the chip handles its own dropdown arrow
|
|
2794
|
+
return this.renderChipTriggerLayoutContent();
|
|
2795
|
+
}
|
|
2796
|
+
// Fall back to slot content when no layout is available - chip handles its own dropdown arrow
|
|
2797
|
+
return index.h("slot", { name: "trigger-content" });
|
|
2798
|
+
}
|
|
2799
|
+
// Case 2: Standard mode with layout content
|
|
2800
|
+
if (this.shouldShowLayoutContent()) {
|
|
2801
|
+
// When using custom layouts, the chip handles its own dropdown arrow
|
|
2802
|
+
return this.renderChipTriggerLayoutContent();
|
|
2803
|
+
}
|
|
2804
|
+
// Case 3: Automatic chip mode - selected option has chip attributes
|
|
2805
|
+
if (this.selectedOption && this.selectedOptionChipProps) {
|
|
2806
|
+
// Render as chip automatically - chip handles its own dropdown arrow
|
|
2807
|
+
return this.renderSelectedOptionAsChip();
|
|
2808
|
+
}
|
|
2809
|
+
// Case 4: Standard mode with default text content
|
|
2810
|
+
return [
|
|
2811
|
+
this.renderChipTriggerDefaultContent(),
|
|
2812
|
+
this.renderCaretIcon()
|
|
2813
|
+
];
|
|
2814
|
+
}
|
|
2815
|
+
// Helper method to render selected option as chip for trigger (automatic approach)
|
|
2816
|
+
renderSelectedOptionAsChip() {
|
|
2817
|
+
if (!this.selectedOption || !this.selectedOptionChipProps)
|
|
2818
|
+
return null;
|
|
2819
|
+
return (index.h("pds-chip", { sentiment: this.selectedOptionChipProps.sentiment, variant: "dropdown" // Always use dropdown variant for triggers
|
|
2820
|
+
,
|
|
2821
|
+
size: this.selectedOptionChipProps.large ? 'lg' : undefined, icon: this.selectedOptionChipProps.icon, dot: this.selectedOptionChipProps.dot, class: "pds-combobox__chip-trigger-auto" }, this.getOptionLabel(this.selectedOption)));
|
|
2822
|
+
}
|
|
2823
|
+
// Helper method to render chip trigger layout content
|
|
2824
|
+
renderChipTriggerLayoutContent() {
|
|
2825
|
+
return (index.h("div", { class: "pds-combobox__chip-trigger-layout-wrapper", innerHTML: this.getModifiedLayoutContentForTrigger() }));
|
|
2826
|
+
}
|
|
2827
|
+
// Helper method to modify layout content for trigger use (ensure dropdown variant)
|
|
2828
|
+
getModifiedLayoutContentForTrigger() {
|
|
2829
|
+
let content = this.selectedLayoutContent;
|
|
2830
|
+
// If the content contains a pds-chip, ensure it has variant="dropdown"
|
|
2831
|
+
if (content.includes('<pds-chip')) {
|
|
2832
|
+
// Use a temporary div to parse and modify the HTML
|
|
2833
|
+
const tempDiv = document.createElement('div');
|
|
2834
|
+
tempDiv.innerHTML = content;
|
|
2835
|
+
const chipElement = tempDiv.querySelector('pds-chip');
|
|
2836
|
+
if (chipElement) {
|
|
2837
|
+
chipElement.setAttribute('variant', 'dropdown');
|
|
2838
|
+
content = tempDiv.innerHTML;
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
return content;
|
|
2842
|
+
}
|
|
2843
|
+
// Helper method to render chip trigger default content
|
|
2844
|
+
renderChipTriggerDefaultContent() {
|
|
2845
|
+
return (index.h("span", { class: "pds-combobox__chip-trigger-label" }, this.selectedChipIcon && index.h("pds-icon", { icon: this.selectedChipIcon, class: "pds-combobox__chip-trigger-icon" }), this.selectedLabel || this.placeholder));
|
|
2846
|
+
}
|
|
2847
|
+
// Helper method to render option as chip (new automatic approach)
|
|
2848
|
+
renderOptionChip(option) {
|
|
2849
|
+
const chipProps = this.getOptionChipProps(option);
|
|
2850
|
+
return (index.h("pds-chip", { sentiment: chipProps.sentiment, variant: "text" // Dropdown options use text variant, not dropdown
|
|
2851
|
+
,
|
|
2852
|
+
size: chipProps.large ? 'lg' : undefined, icon: chipProps.icon, dot: chipProps.dot, class: "pds-combobox__option-chip" }, this.getOptionLabel(option)));
|
|
2853
|
+
}
|
|
2854
|
+
// Mirrors pds-multiselect and pds-select: an error message on its own puts the
|
|
2855
|
+
// field in an invalid state, so assistive tech agrees with the visual treatment.
|
|
2856
|
+
isInvalid() {
|
|
2857
|
+
return Boolean(this.invalid) || Boolean(this.errorMessage);
|
|
2858
|
+
}
|
|
2859
|
+
renderMessages() {
|
|
2860
|
+
const hasErrorMessage = Boolean(this.errorMessage);
|
|
2861
|
+
const showHelperMessage = Boolean(this.helperMessage) && !hasErrorMessage;
|
|
2862
|
+
return [
|
|
2863
|
+
showHelperMessage && (index.h("p", { class: "pds-combobox__helper", id: form.messageId(this.componentId, 'helper') }, this.helperMessage)),
|
|
2864
|
+
hasErrorMessage && (index.h("p", { class: "pds-combobox__error", id: form.messageId(this.componentId, 'error'), "aria-live": "assertive" }, index.h("pds-icon", { icon: "danger", size: "small", "aria-hidden": "true" }), this.errorMessage)),
|
|
2865
|
+
];
|
|
2866
|
+
}
|
|
2867
|
+
render() {
|
|
2868
|
+
const triggerClass = [
|
|
2869
|
+
'pds-combobox__button-trigger',
|
|
2870
|
+
`pds-combobox__button-trigger--${this.triggerVariant}`,
|
|
2871
|
+
this.triggerShape === 'input' && 'pds-combobox__button-trigger--input-shape',
|
|
2872
|
+
]
|
|
2873
|
+
.filter(Boolean)
|
|
2874
|
+
.join(' ');
|
|
2875
|
+
return (index.h(index.Host, { key: 'a39df3c86a29028344943bd3a2828d5e99106d77', "aria-disabled": this.disabled ? 'true' : null }, index.h("div", { key: '32cdb8ce31f9d7c9eac8f995cd233fe6f4d9dfc3', class: "pds-combobox", tabIndex: -1, onFocusout: this.onComboboxFocusOut, part: "combobox" }, this.label && !this.hideLabel && (index.h("label", { key: '64ed7fe37082e2f895daae0090ae3dfac472e3c3', htmlFor: this.componentId, class: "pds-combobox__label" }, this.label)), this.trigger === 'input' ? (index.h("div", { class: "pds-combobox__input-wrapper", style: { width: this.triggerWidth } }, index.h("input", { ref: el => {
|
|
2876
|
+
this.inputEl = el;
|
|
2877
|
+
this.triggerEl = el;
|
|
2878
|
+
}, class: {
|
|
2879
|
+
'pds-combobox__input': true,
|
|
2880
|
+
'pds-combobox__input--invalid': this.isInvalid(),
|
|
2881
|
+
}, type: "text", role: "combobox", "aria-autocomplete": "list", "aria-controls": this.listboxId, "aria-describedby": form.assignDescription(this.componentId, this.isInvalid(), this.helperMessage, this.errorMessage), "aria-invalid": this.isInvalid() ? 'true' : undefined, "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? this.optionDomId(this.highlightedIndex) : undefined, "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" }), index.h("pds-icon", { icon: "enlarge", "aria-hidden": "true", class: "pds-combobox__input-icon" }))) : this.trigger === 'chip' ? (index.h("div", { class: this.getChipTriggerClass(), style: { width: this.triggerWidth }, role: "combobox", "aria-haspopup": "listbox", "aria-controls": this.listboxId, "aria-describedby": form.assignDescription(this.componentId, this.isInvalid(), this.helperMessage, this.errorMessage), "aria-invalid": this.isInvalid() ? 'true' : undefined, "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? this.optionDomId(this.highlightedIndex) : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, 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())) : (index.h("div", { class: triggerClass, style: { width: this.triggerWidth }, role: "combobox", "aria-haspopup": "listbox", "aria-controls": this.listboxId, "aria-describedby": form.assignDescription(this.componentId, this.isInvalid(), this.helperMessage, this.errorMessage), "aria-invalid": this.isInvalid() ? 'true' : undefined, "aria-activedescendant": this.isOpen && this.highlightedIndex >= 0 ? this.optionDomId(this.highlightedIndex) : undefined, "aria-expanded": this.isOpen ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-label": this.hideLabel ? this.label : undefined, 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: "button-trigger" }, this.renderButtonTriggerContent())), this.renderMessages(), index.h("div", { key: '48041c41a39987f2f4093bd048d6c495ea69514b', style: { display: 'none' } }, index.h("slot", { key: '5f4d95fefbd3dbdb33ecb25af593c9429df0e10b', onSlotchange: () => this.updateOptions() })), this.renderDropdown())));
|
|
2882
|
+
}
|
|
2883
|
+
static get formAssociated() { return true; }
|
|
2884
|
+
get el() { return index.getElement(this); }
|
|
2885
|
+
static get watchers() { return {
|
|
2886
|
+
"isOpen": [{
|
|
2887
|
+
"isOpenChanged": 0
|
|
2888
|
+
}],
|
|
2889
|
+
"debounce": [{
|
|
2890
|
+
"setupDebounce": 0
|
|
2891
|
+
}],
|
|
2892
|
+
"options": [{
|
|
2893
|
+
"optionsChanged": 0
|
|
2894
|
+
}],
|
|
2895
|
+
"value": [{
|
|
2896
|
+
"handleValueChange": 0
|
|
2897
|
+
}],
|
|
2898
|
+
"selectedOption": [{
|
|
2899
|
+
"handleSelectedOptionChange": 0
|
|
2900
|
+
}]
|
|
2901
|
+
}; }
|
|
2902
|
+
};
|
|
2903
|
+
PdsCombobox.style = pdsComboboxCss();
|
|
2904
|
+
|
|
2905
|
+
exports.pds_combobox = PdsCombobox;
|