@pine-ds/core 3.0.3 → 3.2.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/index.d.ts +20 -0
- package/components/index.js +10 -0
- package/components/index.js.map +1 -1
- package/components/index2.js +1 -1
- package/components/index2.js.map +1 -1
- package/components/mock-pds-modal.d.ts +11 -0
- package/components/mock-pds-modal.js +108 -0
- package/components/mock-pds-modal.js.map +1 -0
- package/components/pds-alert.d.ts +11 -0
- package/components/pds-alert.js +107 -0
- package/components/pds-alert.js.map +1 -0
- package/components/pds-avatar.js +1 -1
- package/components/pds-box.js +1 -110
- package/components/pds-box.js.map +1 -1
- package/components/pds-box2.js +115 -0
- package/components/pds-box2.js.map +1 -0
- package/components/pds-button2.js +31 -5
- package/components/pds-button2.js.map +1 -1
- package/components/pds-checkbox2.js +9 -3
- package/components/pds-checkbox2.js.map +1 -1
- package/components/pds-chip.js +1 -1
- package/components/pds-copytext.js +2 -2
- package/components/pds-copytext.js.map +1 -1
- package/components/pds-divider.js +1 -1
- package/components/pds-dropdown-menu-item.d.ts +11 -0
- package/components/pds-dropdown-menu-item.js +117 -0
- package/components/pds-dropdown-menu-item.js.map +1 -0
- package/components/pds-dropdown-menu-separator.d.ts +11 -0
- package/components/pds-dropdown-menu-separator.js +44 -0
- package/components/pds-dropdown-menu-separator.js.map +1 -0
- package/components/pds-dropdown-menu.d.ts +11 -0
- package/components/pds-dropdown-menu.js +1600 -0
- package/components/pds-dropdown-menu.js.map +1 -0
- package/components/pds-icon2.js +103 -7
- package/components/pds-icon2.js.map +1 -1
- package/components/pds-image.js +2 -2
- package/components/pds-input.js +4 -4
- package/components/pds-link.js +1 -67
- package/components/pds-link.js.map +1 -1
- package/components/pds-link2.js +85 -0
- package/components/pds-link2.js.map +1 -0
- package/components/pds-loader2.js +1 -1
- package/components/pds-modal-content.d.ts +11 -0
- package/components/pds-modal-content.js +111 -0
- package/components/pds-modal-content.js.map +1 -0
- package/components/pds-modal-footer.d.ts +11 -0
- package/components/pds-modal-footer.js +35 -0
- package/components/pds-modal-footer.js.map +1 -0
- package/components/pds-modal-header.d.ts +11 -0
- package/components/pds-modal-header.js +35 -0
- package/components/pds-modal-header.js.map +1 -0
- package/components/pds-modal.d.ts +11 -0
- package/components/pds-modal.js +278 -0
- package/components/pds-modal.js.map +1 -0
- package/components/pds-popover.js +33 -1
- package/components/pds-popover.js.map +1 -1
- package/components/pds-progress.js +1 -1
- package/components/pds-radio.js +3 -3
- package/components/pds-row.js +1 -1
- package/components/pds-select.js +2 -2
- package/components/pds-sortable-item.js +1 -1
- package/components/pds-sortable.js +1 -1
- package/components/pds-switch.js +8 -3
- package/components/pds-switch.js.map +1 -1
- package/components/pds-tab.js +3 -3
- package/components/pds-table-body.js +1 -1
- package/components/pds-table-cell2.js +2 -2
- package/components/pds-table-head-cell2.js +2 -2
- package/components/pds-table-head.js +1 -1
- package/components/pds-table-row.js +1 -1
- package/components/pds-table.js +1 -1
- package/components/pds-tabpanel.js +1 -1
- package/components/pds-tabs.js +1 -1
- package/components/pds-text.js +1 -53
- package/components/pds-text.js.map +1 -1
- package/components/pds-text2.js +58 -0
- package/components/pds-text2.js.map +1 -0
- package/components/pds-textarea.js +4 -4
- package/components/pds-toast.d.ts +11 -0
- package/components/pds-toast.js +137 -0
- package/components/pds-toast.js.map +1 -0
- package/components/pds-tooltip.js +283 -81
- package/components/pds-tooltip.js.map +1 -1
- package/components/utils.js +3 -2
- package/components/utils.js.map +1 -1
- package/dist/cjs/{index-Br1YlNK2.js → index-CG2Rr2io.js} +3 -3
- package/dist/cjs/index-CG2Rr2io.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mock-pds-modal.cjs.entry.js +86 -0
- package/dist/cjs/mock-pds-modal.cjs.entry.js.map +1 -0
- package/dist/cjs/mock-pds-modal.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-accordion.cjs.entry.js +1 -1
- package/dist/cjs/pds-alert.cjs.entry.js +66 -0
- package/dist/cjs/pds-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-alert.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-avatar.cjs.entry.js +2 -2
- package/dist/cjs/pds-box.cjs.entry.js +2 -2
- package/dist/cjs/pds-box.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-box.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-button.cjs.entry.js +33 -7
- package/dist/cjs/pds-button.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-button.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-checkbox.cjs.entry.js +10 -4
- package/dist/cjs/pds-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-checkbox.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-chip.cjs.entry.js +2 -2
- package/dist/cjs/pds-copytext.cjs.entry.js +3 -3
- package/dist/cjs/pds-copytext.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-copytext.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-divider.cjs.entry.js +1 -1
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +82 -0
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-dropdown-menu-item.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +25 -0
- package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-dropdown-menu-separator.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-dropdown-menu.cjs.entry.js +1574 -0
- package/dist/cjs/pds-dropdown-menu.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-dropdown-menu.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-icon.cjs.entry.js +102 -7
- package/dist/cjs/pds-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-icon.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-image.cjs.entry.js +2 -2
- package/dist/cjs/pds-input.cjs.entry.js +6 -6
- package/dist/cjs/pds-link.cjs.entry.js +16 -4
- package/dist/cjs/pds-link.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-link.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-loader.cjs.entry.js +1 -1
- package/dist/cjs/pds-modal-content.cjs.entry.js +93 -0
- package/dist/cjs/pds-modal-content.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-modal-content.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-modal-footer.cjs.entry.js +20 -0
- package/dist/cjs/pds-modal-footer.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-modal-footer.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-modal-header.cjs.entry.js +20 -0
- package/dist/cjs/pds-modal-header.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-modal-header.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-modal.cjs.entry.js +253 -0
- package/dist/cjs/pds-modal.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-modal.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-popover.cjs.entry.js +33 -1
- package/dist/cjs/pds-popover.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-popover.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-progress.cjs.entry.js +1 -1
- package/dist/cjs/pds-radio.cjs.entry.js +4 -4
- package/dist/cjs/pds-row.cjs.entry.js +1 -1
- package/dist/cjs/pds-select.cjs.entry.js +3 -3
- package/dist/cjs/pds-sortable-item.cjs.entry.js +2 -2
- package/dist/cjs/pds-sortable.cjs.entry.js +1 -1
- package/dist/cjs/pds-switch.cjs.entry.js +9 -4
- package/dist/cjs/pds-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-switch.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-tab.cjs.entry.js +3 -3
- package/dist/cjs/pds-table-body.cjs.entry.js +1 -1
- package/dist/cjs/pds-table-cell.cjs.entry.js +2 -2
- package/dist/cjs/pds-table-head-cell.cjs.entry.js +3 -3
- package/dist/cjs/pds-table-head.cjs.entry.js +1 -1
- package/dist/cjs/pds-table-row.cjs.entry.js +1 -1
- package/dist/cjs/pds-table.cjs.entry.js +1 -1
- package/dist/cjs/pds-tabpanel.cjs.entry.js +1 -1
- package/dist/cjs/pds-tabs.cjs.entry.js +1 -1
- package/dist/cjs/pds-text.cjs.entry.js +2 -2
- package/dist/cjs/pds-text.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-text.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-textarea.cjs.entry.js +6 -6
- package/dist/cjs/pds-toast.cjs.entry.js +104 -0
- package/dist/cjs/pds-toast.cjs.entry.js.map +1 -0
- package/dist/cjs/pds-toast.entry.cjs.js.map +1 -0
- package/dist/cjs/pds-tooltip.cjs.entry.js +281 -79
- package/dist/cjs/pds-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/pds-tooltip.entry.cjs.js.map +1 -1
- package/dist/cjs/pine-core.cjs.js +1 -1
- package/dist/cjs/{utils-CQKIgzWg.js → utils-jWx-Mf12.js} +5 -4
- package/dist/cjs/utils-jWx-Mf12.js.map +1 -0
- package/dist/collection/collection-manifest.json +10 -0
- package/dist/collection/components/pds-alert/pds-alert.css +108 -0
- package/dist/collection/components/pds-alert/pds-alert.js +198 -0
- package/dist/collection/components/pds-alert/pds-alert.js.map +1 -0
- package/dist/collection/components/pds-alert/pds-alert.tokens.css +32 -0
- package/dist/collection/components/pds-alert/stories/pds-alert.stories.js +97 -0
- package/dist/collection/components/pds-avatar/pds-avatar.js +1 -1
- package/dist/collection/components/pds-box/pds-box.js +8 -8
- package/dist/collection/components/pds-box/pds-box.js.map +1 -1
- package/dist/collection/components/pds-button/pds-button.css +7 -11
- package/dist/collection/components/pds-button/pds-button.js +37 -5
- package/dist/collection/components/pds-button/pds-button.js.map +1 -1
- package/dist/collection/components/pds-button/stories/pds-button.stories.js +46 -11
- package/dist/collection/components/pds-checkbox/pds-checkbox.js +9 -3
- package/dist/collection/components/pds-checkbox/pds-checkbox.js.map +1 -1
- package/dist/collection/components/pds-chip/pds-chip.js +1 -1
- package/dist/collection/components/pds-chip/stories/pds-chip.stories.js +1 -1
- package/dist/collection/components/pds-copytext/pds-copytext.css +1 -1
- package/dist/collection/components/pds-copytext/pds-copytext.js +1 -1
- package/dist/collection/components/pds-divider/pds-divider.js +1 -1
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.css +68 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js +219 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js.map +1 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.css +4 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.js +72 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.js.map +1 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.css +16 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +328 -0
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js.map +1 -0
- package/dist/collection/components/pds-dropdown-menu/stories/pds-dropdown-menu.stories.js +44 -0
- package/dist/collection/components/pds-icon/stories/pds-icon.stories.js +1 -1
- package/dist/collection/components/pds-image/pds-image.js +2 -2
- package/dist/collection/components/pds-input/pds-input.js +4 -4
- package/dist/collection/components/pds-link/pds-link.css +23 -9
- package/dist/collection/components/pds-link/pds-link.js +33 -2
- package/dist/collection/components/pds-link/pds-link.js.map +1 -1
- package/dist/collection/components/pds-link/stories/pds-link.stories.js +15 -2
- package/dist/collection/components/pds-loader/pds-loader.js +1 -1
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.css +27 -0
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js +125 -0
- package/dist/collection/components/pds-modal/pds-modal-content/pds-modal-content.js.map +1 -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 +18 -0
- package/dist/collection/components/pds-modal/pds-modal-footer/pds-modal-footer.js.map +1 -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 +18 -0
- package/dist/collection/components/pds-modal/pds-modal-header/pds-modal-header.js.map +1 -0
- package/dist/collection/components/pds-modal/pds-modal.css +79 -0
- package/dist/collection/components/pds-modal/pds-modal.js +426 -0
- package/dist/collection/components/pds-modal/pds-modal.js.map +1 -0
- package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +415 -0
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js +256 -0
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js.map +1 -0
- package/dist/collection/components/pds-popover/pds-popover.js +33 -1
- package/dist/collection/components/pds-popover/pds-popover.js.map +1 -1
- package/dist/collection/components/pds-popover/stories/pds-popover.stories.js +4 -5
- package/dist/collection/components/pds-progress/pds-progress.js +1 -1
- package/dist/collection/components/pds-radio/pds-radio.js +3 -3
- package/dist/collection/components/pds-row/pds-row.js +1 -1
- package/dist/collection/components/pds-select/pds-select.js +2 -2
- package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js +1 -1
- package/dist/collection/components/pds-sortable/pds-sortable.js +1 -1
- package/dist/collection/components/pds-switch/pds-switch.js +8 -3
- package/dist/collection/components/pds-switch/pds-switch.js.map +1 -1
- package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js +1 -1
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.js +2 -2
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js +1 -1
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +2 -2
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js +1 -1
- package/dist/collection/components/pds-table/pds-table.js +1 -1
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.js +3 -3
- package/dist/collection/components/pds-tabs/pds-tabpanel/pds-tabpanel.js +1 -1
- package/dist/collection/components/pds-tabs/pds-tabs.js +1 -1
- package/dist/collection/components/pds-text/pds-text.js +2 -2
- package/dist/collection/components/pds-text/pds-text.js.map +1 -1
- package/dist/collection/components/pds-textarea/pds-textarea.js +4 -4
- package/dist/collection/components/pds-toast/pds-toast.css +153 -0
- package/dist/collection/components/pds-toast/pds-toast.js +263 -0
- package/dist/collection/components/pds-toast/pds-toast.js.map +1 -0
- package/dist/collection/components/pds-toast/stories/pds-toast.stories.js +103 -0
- package/dist/collection/components/pds-tooltip/pds-tooltip.css +2 -12
- package/dist/collection/components/pds-tooltip/pds-tooltip.js +211 -26
- package/dist/collection/components/pds-tooltip/pds-tooltip.js.map +1 -1
- package/dist/collection/components/pds-tooltip/stories/pds-tooltip.stories.js +7 -3
- package/dist/collection/utils/interfaces.js +2 -0
- package/dist/collection/utils/interfaces.js.map +1 -0
- package/dist/collection/utils/overlay.js +66 -49
- package/dist/collection/utils/overlay.js.map +1 -1
- package/dist/collection/utils/utils.js +3 -2
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/docs.json +1670 -268
- package/dist/esm/{index-mVZRKoXd.js → index-_4gljHh-.js} +3 -3
- package/dist/esm/index-_4gljHh-.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mock-pds-modal.entry.js +84 -0
- package/dist/esm/mock-pds-modal.entry.js.map +1 -0
- package/dist/esm/pds-accordion.entry.js +1 -1
- package/dist/esm/pds-alert.entry.js +64 -0
- package/dist/esm/pds-alert.entry.js.map +1 -0
- package/dist/esm/pds-avatar.entry.js +2 -2
- package/dist/esm/pds-box.entry.js +2 -2
- package/dist/esm/pds-box.entry.js.map +1 -1
- package/dist/esm/pds-button.entry.js +33 -7
- package/dist/esm/pds-button.entry.js.map +1 -1
- package/dist/esm/pds-checkbox.entry.js +11 -5
- package/dist/esm/pds-checkbox.entry.js.map +1 -1
- package/dist/esm/pds-chip.entry.js +2 -2
- package/dist/esm/pds-copytext.entry.js +3 -3
- package/dist/esm/pds-copytext.entry.js.map +1 -1
- package/dist/esm/pds-divider.entry.js +1 -1
- package/dist/esm/pds-dropdown-menu-item.entry.js +80 -0
- package/dist/esm/pds-dropdown-menu-item.entry.js.map +1 -0
- package/dist/esm/pds-dropdown-menu-separator.entry.js +23 -0
- package/dist/esm/pds-dropdown-menu-separator.entry.js.map +1 -0
- package/dist/esm/pds-dropdown-menu.entry.js +1572 -0
- package/dist/esm/pds-dropdown-menu.entry.js.map +1 -0
- package/dist/esm/pds-icon.entry.js +102 -7
- package/dist/esm/pds-icon.entry.js.map +1 -1
- package/dist/esm/pds-image.entry.js +2 -2
- package/dist/esm/pds-input.entry.js +6 -6
- package/dist/esm/pds-link.entry.js +16 -4
- package/dist/esm/pds-link.entry.js.map +1 -1
- package/dist/esm/pds-loader.entry.js +1 -1
- package/dist/esm/pds-modal-content.entry.js +91 -0
- package/dist/esm/pds-modal-content.entry.js.map +1 -0
- package/dist/esm/pds-modal-footer.entry.js +18 -0
- package/dist/esm/pds-modal-footer.entry.js.map +1 -0
- package/dist/esm/pds-modal-header.entry.js +18 -0
- package/dist/esm/pds-modal-header.entry.js.map +1 -0
- package/dist/esm/pds-modal.entry.js +251 -0
- package/dist/esm/pds-modal.entry.js.map +1 -0
- package/dist/esm/pds-popover.entry.js +33 -1
- package/dist/esm/pds-popover.entry.js.map +1 -1
- package/dist/esm/pds-progress.entry.js +1 -1
- package/dist/esm/pds-radio.entry.js +4 -4
- package/dist/esm/pds-row.entry.js +1 -1
- package/dist/esm/pds-select.entry.js +3 -3
- package/dist/esm/pds-sortable-item.entry.js +2 -2
- package/dist/esm/pds-sortable.entry.js +1 -1
- package/dist/esm/pds-switch.entry.js +9 -4
- package/dist/esm/pds-switch.entry.js.map +1 -1
- package/dist/esm/pds-tab.entry.js +3 -3
- package/dist/esm/pds-table-body.entry.js +1 -1
- package/dist/esm/pds-table-cell.entry.js +2 -2
- package/dist/esm/pds-table-head-cell.entry.js +3 -3
- package/dist/esm/pds-table-head.entry.js +1 -1
- package/dist/esm/pds-table-row.entry.js +1 -1
- package/dist/esm/pds-table.entry.js +1 -1
- package/dist/esm/pds-tabpanel.entry.js +1 -1
- package/dist/esm/pds-tabs.entry.js +1 -1
- package/dist/esm/pds-text.entry.js +2 -2
- package/dist/esm/pds-text.entry.js.map +1 -1
- package/dist/esm/pds-textarea.entry.js +6 -6
- package/dist/esm/pds-toast.entry.js +102 -0
- package/dist/esm/pds-toast.entry.js.map +1 -0
- package/dist/esm/pds-tooltip.entry.js +281 -79
- package/dist/esm/pds-tooltip.entry.js.map +1 -1
- package/dist/esm/pine-core.js +1 -1
- package/dist/esm/{utils-Dw9B1JDC.js → utils-DkabwBZT.js} +5 -4
- package/dist/esm/utils-DkabwBZT.js.map +1 -0
- package/dist/esm-es5/{index-mVZRKoXd.js → index-_4gljHh-.js} +1 -1
- package/dist/esm-es5/index-_4gljHh-.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mock-pds-modal.entry.js +2 -0
- package/dist/esm-es5/mock-pds-modal.entry.js.map +1 -0
- package/dist/esm-es5/pds-accordion.entry.js +1 -1
- package/dist/esm-es5/pds-alert.entry.js +2 -0
- package/dist/esm-es5/pds-alert.entry.js.map +1 -0
- package/dist/esm-es5/pds-avatar.entry.js +1 -1
- package/dist/esm-es5/pds-box.entry.js +1 -1
- package/dist/esm-es5/pds-box.entry.js.map +1 -1
- package/dist/esm-es5/pds-button.entry.js +1 -1
- package/dist/esm-es5/pds-button.entry.js.map +1 -1
- package/dist/esm-es5/pds-checkbox.entry.js +1 -1
- package/dist/esm-es5/pds-checkbox.entry.js.map +1 -1
- package/dist/esm-es5/pds-chip.entry.js +1 -1
- package/dist/esm-es5/pds-copytext.entry.js +1 -1
- package/dist/esm-es5/pds-copytext.entry.js.map +1 -1
- package/dist/esm-es5/pds-divider.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu-item.entry.js +2 -0
- package/dist/esm-es5/pds-dropdown-menu-item.entry.js.map +1 -0
- package/dist/esm-es5/pds-dropdown-menu-separator.entry.js +2 -0
- package/dist/esm-es5/pds-dropdown-menu-separator.entry.js.map +1 -0
- package/dist/esm-es5/pds-dropdown-menu.entry.js +2 -0
- package/dist/esm-es5/pds-dropdown-menu.entry.js.map +1 -0
- package/dist/esm-es5/pds-icon.entry.js +1 -1
- package/dist/esm-es5/pds-icon.entry.js.map +1 -1
- package/dist/esm-es5/pds-image.entry.js +1 -1
- package/dist/esm-es5/pds-input.entry.js +1 -1
- package/dist/esm-es5/pds-link.entry.js +1 -1
- package/dist/esm-es5/pds-link.entry.js.map +1 -1
- package/dist/esm-es5/pds-loader.entry.js +1 -1
- package/dist/esm-es5/pds-modal-content.entry.js +2 -0
- package/dist/esm-es5/pds-modal-content.entry.js.map +1 -0
- package/dist/esm-es5/pds-modal-footer.entry.js +2 -0
- package/dist/esm-es5/pds-modal-footer.entry.js.map +1 -0
- package/dist/esm-es5/pds-modal-header.entry.js +2 -0
- package/dist/esm-es5/pds-modal-header.entry.js.map +1 -0
- package/dist/esm-es5/pds-modal.entry.js +2 -0
- package/dist/esm-es5/pds-modal.entry.js.map +1 -0
- package/dist/esm-es5/pds-popover.entry.js +1 -1
- package/dist/esm-es5/pds-popover.entry.js.map +1 -1
- package/dist/esm-es5/pds-progress.entry.js +1 -1
- package/dist/esm-es5/pds-radio.entry.js +1 -1
- package/dist/esm-es5/pds-row.entry.js +1 -1
- package/dist/esm-es5/pds-select.entry.js +1 -1
- package/dist/esm-es5/pds-sortable-item.entry.js +1 -1
- package/dist/esm-es5/pds-sortable.entry.js +1 -1
- package/dist/esm-es5/pds-switch.entry.js +1 -1
- package/dist/esm-es5/pds-switch.entry.js.map +1 -1
- package/dist/esm-es5/pds-tab.entry.js +1 -1
- package/dist/esm-es5/pds-table-body.entry.js +1 -1
- package/dist/esm-es5/pds-table-cell.entry.js +1 -1
- package/dist/esm-es5/pds-table-head-cell.entry.js +1 -1
- package/dist/esm-es5/pds-table-head.entry.js +1 -1
- package/dist/esm-es5/pds-table-row.entry.js +1 -1
- package/dist/esm-es5/pds-table.entry.js +1 -1
- package/dist/esm-es5/pds-tabpanel.entry.js +1 -1
- package/dist/esm-es5/pds-tabs.entry.js +1 -1
- package/dist/esm-es5/pds-text.entry.js +1 -1
- package/dist/esm-es5/pds-text.entry.js.map +1 -1
- package/dist/esm-es5/pds-textarea.entry.js +1 -1
- package/dist/esm-es5/pds-toast.entry.js +2 -0
- package/dist/esm-es5/pds-toast.entry.js.map +1 -0
- package/dist/esm-es5/pds-tooltip.entry.js +1 -1
- package/dist/esm-es5/pds-tooltip.entry.js.map +1 -1
- package/dist/esm-es5/pine-core.js +1 -1
- package/dist/esm-es5/utils-DkabwBZT.js +2 -0
- package/dist/esm-es5/utils-DkabwBZT.js.map +1 -0
- package/dist/pine-core/mock-pds-modal.entry.esm.js.map +1 -0
- package/dist/pine-core/{p-ad69e5f9.system.entry.js → p-0069abf8.system.entry.js} +2 -2
- package/dist/pine-core/{p-a14c8ab4.system.entry.js → p-03d8cb4c.system.entry.js} +2 -2
- package/dist/pine-core/{p-2ab26d3d.system.entry.js → p-04df41d7.system.entry.js} +2 -2
- package/dist/pine-core/{p-0486ad57.entry.js → p-0572825b.entry.js} +2 -2
- package/dist/pine-core/{p-d2110923.system.entry.js → p-111e7da2.system.entry.js} +2 -2
- package/dist/pine-core/p-121e03ad.system.entry.js +2 -0
- package/dist/pine-core/p-121e03ad.system.entry.js.map +1 -0
- package/dist/pine-core/p-1224c874.entry.js +2 -0
- package/dist/pine-core/{p-b2bbc362.entry.js → p-146fcd44.entry.js} +2 -2
- package/dist/pine-core/{p-abcce8af.entry.js → p-17d3fa8b.entry.js} +2 -2
- package/dist/pine-core/p-1b109c01.entry.js +2 -0
- package/dist/pine-core/p-1b109c01.entry.js.map +1 -0
- package/dist/pine-core/p-1bd715ee.system.entry.js +2 -0
- package/dist/pine-core/p-1bd715ee.system.entry.js.map +1 -0
- package/dist/pine-core/{p-e4ea5041.system.entry.js → p-1eec6bea.system.entry.js} +2 -2
- package/dist/pine-core/p-21c3aaeb.entry.js +2 -0
- package/dist/pine-core/{p-f439922f.entry.js → p-2296c34f.entry.js} +2 -2
- package/dist/pine-core/{p-f439922f.entry.js.map → p-2296c34f.entry.js.map} +1 -1
- package/dist/pine-core/{p-5c396e75.entry.js → p-24607f93.entry.js} +2 -2
- package/dist/pine-core/p-28e28f42.system.entry.js +2 -0
- package/dist/pine-core/p-28e28f42.system.entry.js.map +1 -0
- package/dist/pine-core/p-29ad0b86.entry.js +2 -0
- package/dist/pine-core/p-29ad0b86.entry.js.map +1 -0
- package/dist/pine-core/{p-c0f0b368.system.entry.js → p-30142a25.system.entry.js} +2 -2
- package/dist/pine-core/p-32bd3e33.entry.js +2 -0
- package/dist/pine-core/p-32bd3e33.entry.js.map +1 -0
- package/dist/pine-core/{p-8305cd4d.entry.js → p-367e188f.entry.js} +2 -2
- package/dist/pine-core/{p-6147b1ea.system.entry.js → p-3798a631.system.entry.js} +2 -2
- package/dist/pine-core/p-3D0orTx_.system.js.map +1 -0
- package/dist/pine-core/p-3e91dccd.entry.js +2 -0
- package/dist/pine-core/p-3e91dccd.entry.js.map +1 -0
- package/dist/pine-core/{p-3fdbda99.system.entry.js → p-3f82ac77.system.entry.js} +2 -2
- package/dist/pine-core/p-4288c861.entry.js +2 -0
- package/dist/pine-core/p-4288c861.entry.js.map +1 -0
- package/dist/pine-core/p-47a7a65b.entry.js +2 -0
- package/dist/pine-core/p-47a7a65b.entry.js.map +1 -0
- package/dist/pine-core/{p-42f1190a.system.entry.js → p-48e76945.system.entry.js} +2 -2
- package/dist/pine-core/p-49265849.system.entry.js +2 -0
- package/dist/pine-core/p-49265849.system.entry.js.map +1 -0
- package/dist/pine-core/{p-b9f99fc9.entry.js → p-4ff0838c.entry.js} +2 -2
- package/dist/pine-core/p-513c16c7.entry.js +2 -0
- package/dist/pine-core/p-513c16c7.entry.js.map +1 -0
- package/dist/pine-core/{p-820faa91.system.entry.js → p-596e0292.system.entry.js} +2 -2
- package/dist/pine-core/p-5acda4ac.system.entry.js +2 -0
- package/dist/pine-core/p-5acda4ac.system.entry.js.map +1 -0
- package/dist/pine-core/p-5c4aceb7.entry.js +2 -0
- package/dist/pine-core/p-5c4aceb7.entry.js.map +1 -0
- package/dist/pine-core/{p-598ade79.entry.js → p-5e1e7762.entry.js} +2 -2
- package/dist/pine-core/p-624db3d6.system.entry.js +2 -0
- package/dist/pine-core/p-624db3d6.system.entry.js.map +1 -0
- package/dist/pine-core/{p-d0780ca1.system.entry.js → p-6a2296e6.system.entry.js} +2 -2
- package/dist/pine-core/{p-b68cb43d.system.entry.js → p-71265b2a.system.entry.js} +2 -2
- package/dist/pine-core/p-71f01676.system.entry.js +2 -0
- package/dist/pine-core/p-71f01676.system.entry.js.map +1 -0
- package/dist/pine-core/{p-a5587332.entry.js → p-722012ac.entry.js} +2 -2
- package/dist/pine-core/p-722012ac.entry.js.map +1 -0
- package/dist/pine-core/{p-98181fa8.system.entry.js → p-730221a8.system.entry.js} +2 -2
- package/dist/pine-core/{p-a97952fc.system.entry.js → p-73412ca9.system.entry.js} +2 -2
- package/dist/pine-core/{p-a97952fc.system.entry.js.map → p-73412ca9.system.entry.js.map} +1 -1
- package/dist/pine-core/{p-91dadcbe.entry.js → p-742d4490.entry.js} +2 -2
- package/dist/pine-core/p-761946a0.entry.js +2 -0
- package/dist/pine-core/p-761946a0.entry.js.map +1 -0
- package/dist/pine-core/{p-950427b2.entry.js → p-77c3a10d.entry.js} +2 -2
- package/dist/pine-core/{p-fed4c0c0.system.entry.js → p-78cb1c40.system.entry.js} +2 -2
- package/dist/pine-core/{p-1d92261f.system.entry.js → p-78fb945e.system.entry.js} +2 -2
- package/dist/pine-core/p-7b38e384.system.entry.js +2 -0
- package/dist/pine-core/{p-9d0c1b2e.system.entry.js.map → p-7b38e384.system.entry.js.map} +1 -1
- package/dist/pine-core/p-7e92ec48.system.entry.js +2 -0
- package/dist/pine-core/p-7e92ec48.system.entry.js.map +1 -0
- package/dist/pine-core/{p-13b9ed06.system.entry.js → p-7ff213bb.system.entry.js} +2 -2
- package/dist/pine-core/{p-9e9d3a2b.entry.js → p-8023086c.entry.js} +2 -2
- package/dist/pine-core/p-83252078.system.entry.js +2 -0
- package/dist/pine-core/{p-bedddd53.entry.js → p-833f08f3.entry.js} +2 -2
- package/dist/pine-core/p-83c632f6.system.entry.js +2 -0
- package/dist/pine-core/p-83c632f6.system.entry.js.map +1 -0
- package/dist/pine-core/p-83ffc1cc.entry.js +2 -0
- package/dist/pine-core/p-83ffc1cc.entry.js.map +1 -0
- package/dist/pine-core/p-85ff1482.entry.js +2 -0
- package/dist/pine-core/{p-d5838288.entry.js.map → p-85ff1482.entry.js.map} +1 -1
- package/dist/pine-core/{p-12bee2e5.entry.js → p-86d388a2.entry.js} +2 -2
- package/dist/pine-core/p-929bb7ab.system.entry.js +2 -0
- package/dist/pine-core/p-929bb7ab.system.entry.js.map +1 -0
- package/dist/pine-core/p-942fa145.system.entry.js +2 -0
- package/dist/pine-core/p-942fa145.system.entry.js.map +1 -0
- package/dist/pine-core/{p-e045e337.system.entry.js → p-984578f8.system.entry.js} +2 -2
- package/dist/pine-core/{p-e281ac09.entry.js → p-99b5e1a5.entry.js} +2 -2
- package/dist/pine-core/{p-BFPxUBwH.system.js.map → p-B-pTdYoP.system.js.map} +1 -1
- package/dist/pine-core/p-B2gfQpwn.system.js.map +1 -0
- package/dist/pine-core/{p-Bd19LaTb.system.js → p-B4W0_y2p.system.js} +1 -1
- package/dist/pine-core/p-B4W0_y2p.system.js.map +1 -0
- package/dist/pine-core/{p-CDhmuxC9.system.js.map → p-B5JFBYFw.system.js.map} +1 -1
- package/dist/pine-core/p-B5LBNcOw.system.js.map +1 -0
- package/dist/pine-core/{p-B46WXJMn.system.js.map → p-BHZ6CSg4.system.js.map} +1 -1
- package/dist/pine-core/{p-Dlv6r83m.system.js.map → p-BO1OsmVU.system.js.map} +1 -1
- package/dist/pine-core/{p-Cj21y714.system.js.map → p-BOJnNd1p.system.js.map} +1 -1
- package/dist/pine-core/p-BVUeEWjl.system.js.map +1 -0
- package/dist/pine-core/{p-C94EgDFz.system.js → p-BhPuKJbQ.system.js} +2 -2
- package/dist/pine-core/p-BhPuKJbQ.system.js.map +1 -0
- package/dist/pine-core/p-Bo6FQRlR.system.js.map +1 -0
- package/dist/pine-core/{p-kMnJefdU.system.js.map → p-Bs9Nyvj2.system.js.map} +1 -1
- package/dist/pine-core/p-BsL2GDnH.system.js +1 -1
- package/dist/pine-core/p-C-oNYS10.system.js.map +1 -0
- package/dist/pine-core/p-C3ud771n.system.js.map +1 -0
- package/dist/pine-core/{p-C0hVtnK2.system.js.map → p-CDIHBBTC.system.js.map} +1 -1
- package/dist/pine-core/p-CLNi-hRD.system.js.map +1 -0
- package/dist/pine-core/{p-BjCOR1Nn.system.js.map → p-CV405yTU.system.js.map} +1 -1
- package/dist/pine-core/p-CWtKi9tV.system.js.map +1 -0
- package/dist/pine-core/{p-BoNavS-S.system.js.map → p-CcsZC7UR.system.js.map} +1 -1
- package/dist/pine-core/p-CiDIFl28.system.js.map +1 -0
- package/dist/pine-core/{p-BYgoXBct.system.js.map → p-Cj2r1nL6.system.js.map} +1 -1
- package/dist/pine-core/{p-w3zTyPF1.system.js.map → p-CnPERKGo.system.js.map} +1 -1
- package/dist/pine-core/p-CsM74dxm.system.js.map +1 -0
- package/dist/pine-core/{p-CFcYB49C.system.js.map → p-CtAVdPaE.system.js.map} +1 -1
- package/dist/pine-core/{p-qXPbJ8Ls.system.js.map → p-CzKqvFNN.system.js.map} +1 -1
- package/dist/pine-core/{p-CmTz2SvK.system.js.map → p-D-4Xbxlj.system.js.map} +1 -1
- package/dist/pine-core/{p-BVNW4NmT.system.js.map → p-D5vuiRx2.system.js.map} +1 -1
- package/dist/pine-core/p-D8DRYw9w.system.js.map +1 -0
- package/dist/pine-core/{p-DVVPJPOu.system.js.map → p-D9LPgNmN.system.js.map} +1 -1
- package/dist/pine-core/{p-DY5LpFEG.system.js.map → p-DEsea81X.system.js.map} +1 -1
- package/dist/pine-core/p-DKSZziVY.system.js.map +1 -0
- package/dist/pine-core/{p-CLIVqKy5.system.js.map → p-DN9puCWI.system.js.map} +1 -1
- package/dist/pine-core/{p-C0cdB2AV.system.js.map → p-DS7q5AvX.system.js.map} +1 -1
- package/dist/pine-core/{p-BSINexOf.system.js.map → p-DV_GadHU.system.js.map} +1 -1
- package/dist/pine-core/{p-BgcVBzVE.system.js.map → p-DbVkYdnF.system.js.map} +1 -1
- package/dist/pine-core/{p-eKz-xVcI.system.js.map → p-Derxa-nn.system.js.map} +1 -1
- package/dist/pine-core/{p-BW-n3jjz.system.js.map → p-DgOMN0Ur.system.js.map} +1 -1
- package/dist/pine-core/p-DiJV28pi.system.js.map +1 -0
- package/dist/pine-core/p-DkabwBZT.js +2 -0
- package/dist/pine-core/p-DkabwBZT.js.map +1 -0
- package/dist/pine-core/p-DyQ_s5MV.system.js.map +1 -0
- package/dist/pine-core/p-HBgo7i_E.system.js.map +1 -0
- package/dist/pine-core/{p-BUZBNCHp.system.js.map → p-M2Hhmwex.system.js.map} +1 -1
- package/dist/pine-core/p-PkSWq78_.system.js.map +1 -0
- package/dist/pine-core/{p-mVZRKoXd.js → p-_4gljHh-.js} +1 -1
- package/dist/pine-core/p-_4gljHh-.js.map +1 -0
- package/dist/pine-core/{p-1995a0f8.system.entry.js → p-a2572675.system.entry.js} +2 -2
- package/dist/pine-core/{p-85073252.system.entry.js → p-a394645a.system.entry.js} +2 -2
- package/dist/pine-core/p-a52b1413.entry.js +2 -0
- package/dist/pine-core/p-a52b1413.entry.js.map +1 -0
- package/dist/pine-core/{p-dae339c3.entry.js → p-abec6606.entry.js} +2 -2
- package/dist/pine-core/p-b2796d3c.system.entry.js +2 -0
- package/dist/pine-core/p-b2796d3c.system.entry.js.map +1 -0
- package/dist/pine-core/{p-5db706e1.entry.js → p-b3d05184.entry.js} +2 -2
- package/dist/pine-core/{p-b902f535.entry.js → p-b7ba6316.entry.js} +2 -2
- package/dist/pine-core/p-b9c13f99.entry.js +2 -0
- package/dist/pine-core/p-b9c13f99.entry.js.map +1 -0
- package/dist/pine-core/{p-14ca569b.entry.js → p-bcc4edaa.entry.js} +2 -2
- package/dist/pine-core/{p-1178485a.system.entry.js → p-bd04212c.system.entry.js} +2 -2
- package/dist/pine-core/{p-1178485a.system.entry.js.map → p-bd04212c.system.entry.js.map} +1 -1
- package/dist/pine-core/{p-9cdd57de.entry.js → p-c0f74199.entry.js} +2 -2
- package/dist/pine-core/{p-ed8c3064.system.entry.js → p-c1b0f921.system.entry.js} +2 -2
- package/dist/pine-core/{p-68de979e.entry.js → p-c4294be2.entry.js} +2 -2
- package/dist/pine-core/p-cd2cd116.entry.js +2 -0
- package/dist/pine-core/p-cd2cd116.entry.js.map +1 -0
- package/dist/pine-core/p-d1b222f5.entry.js +2 -0
- package/dist/pine-core/p-d1b222f5.entry.js.map +1 -0
- package/dist/pine-core/{p-7b6b354a.system.entry.js → p-d2ccda59.system.entry.js} +2 -2
- package/dist/pine-core/p-d6ac2862.system.entry.js +2 -0
- package/dist/pine-core/p-d6ac2862.system.entry.js.map +1 -0
- package/dist/pine-core/{p-040f3c92.system.entry.js → p-e09a3682.system.entry.js} +2 -2
- package/dist/pine-core/{p-792355e6.entry.js → p-e2dc81c0.entry.js} +2 -2
- package/dist/pine-core/p-e6d6e103.entry.js +2 -0
- package/dist/pine-core/p-e6d6e103.entry.js.map +1 -0
- package/dist/pine-core/{p-6c21bcb0.system.entry.js → p-e9d972db.system.entry.js} +2 -2
- package/dist/pine-core/p-e9d972db.system.entry.js.map +1 -0
- package/dist/pine-core/p-ef9ed75a.system.entry.js +2 -0
- package/dist/pine-core/p-ef9ed75a.system.entry.js.map +1 -0
- package/dist/pine-core/{p-4b59cae8.entry.js → p-f256dd8a.entry.js} +2 -2
- package/dist/pine-core/{p-4b59cae8.entry.js.map → p-f256dd8a.entry.js.map} +1 -1
- package/dist/pine-core/p-f2c807ac.entry.js +2 -0
- package/dist/pine-core/p-f2c807ac.entry.js.map +1 -0
- package/dist/pine-core/{p-eda0dc79.entry.js → p-f47133fd.entry.js} +2 -2
- package/dist/pine-core/p-f4fff209.system.entry.js +2 -0
- package/dist/pine-core/p-f4fff209.system.entry.js.map +1 -0
- package/dist/pine-core/p-f9e01886.system.entry.js +2 -0
- package/dist/pine-core/p-f9e01886.system.entry.js.map +1 -0
- package/dist/pine-core/{p-DhYEBuMP.system.js.map → p-xgOOHGQo.system.js.map} +1 -1
- package/dist/pine-core/p-yku4NLl6.system.js.map +1 -0
- package/dist/pine-core/pds-alert.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-box.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-button.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-checkbox.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-copytext.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-dropdown-menu-item.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-dropdown-menu-separator.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-dropdown-menu.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-icon.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-link.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-modal-content.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-modal-footer.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-modal-header.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-modal.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-popover.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-switch.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-text.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-toast.entry.esm.js.map +1 -0
- package/dist/pine-core/pds-tooltip.entry.esm.js.map +1 -1
- package/dist/pine-core/pine-core.esm.js +1 -1
- package/dist/types/components/pds-alert/pds-alert.d.ts +39 -0
- package/dist/types/components/pds-box/pds-box.d.ts +6 -6
- package/dist/types/components/pds-button/pds-button.d.ts +8 -1
- package/dist/types/components/pds-checkbox/pds-checkbox.d.ts +3 -0
- package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.d.ts +43 -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 +33 -0
- package/dist/types/components/pds-link/pds-link.d.ts +5 -0
- package/dist/types/components/pds-modal/pds-modal-content/pds-modal-content.d.ts +25 -0
- package/dist/types/components/pds-modal/pds-modal-footer/pds-modal-footer.d.ts +3 -0
- package/dist/types/components/pds-modal/pds-modal-header/pds-modal-header.d.ts +3 -0
- package/dist/types/components/pds-modal/pds-modal.d.ts +72 -0
- package/dist/types/components/pds-modal/test/mock-pds-modal.d.ts +63 -0
- package/dist/types/components/pds-switch/pds-switch.d.ts +2 -0
- package/dist/types/components/pds-toast/pds-toast.d.ts +57 -0
- package/dist/types/components/pds-tooltip/pds-tooltip.d.ts +28 -3
- package/dist/types/components.d.ts +543 -16
- package/dist/types/utils/interfaces.d.ts +6 -0
- package/dist/types/utils/overlay.d.ts +3 -3
- package/dist/types/utils/utils.d.ts +1 -1
- package/hydrate/index.js +3093 -324
- package/hydrate/index.mjs +3093 -324
- package/package.json +6 -2
- package/dist/cjs/index-Br1YlNK2.js.map +0 -1
- package/dist/cjs/utils-CQKIgzWg.js.map +0 -1
- package/dist/esm/index-mVZRKoXd.js.map +0 -1
- package/dist/esm/utils-Dw9B1JDC.js.map +0 -1
- package/dist/esm-es5/index-mVZRKoXd.js.map +0 -1
- package/dist/esm-es5/utils-Dw9B1JDC.js +0 -2
- package/dist/esm-es5/utils-Dw9B1JDC.js.map +0 -1
- package/dist/pine-core/p-012c4d8b.entry.js +0 -2
- package/dist/pine-core/p-012c4d8b.entry.js.map +0 -1
- package/dist/pine-core/p-1d690915.entry.js +0 -2
- package/dist/pine-core/p-294f9b1f.entry.js +0 -2
- package/dist/pine-core/p-3be0323a.system.entry.js +0 -2
- package/dist/pine-core/p-3be0323a.system.entry.js.map +0 -1
- package/dist/pine-core/p-433c6687.system.entry.js +0 -2
- package/dist/pine-core/p-433c6687.system.entry.js.map +0 -1
- package/dist/pine-core/p-545ccff7.system.entry.js +0 -2
- package/dist/pine-core/p-545ccff7.system.entry.js.map +0 -1
- package/dist/pine-core/p-5c9e1a3d.system.entry.js +0 -2
- package/dist/pine-core/p-5c9e1a3d.system.entry.js.map +0 -1
- package/dist/pine-core/p-6c21bcb0.system.entry.js.map +0 -1
- package/dist/pine-core/p-722989ee.entry.js +0 -2
- package/dist/pine-core/p-722989ee.entry.js.map +0 -1
- package/dist/pine-core/p-768e754e.system.entry.js +0 -2
- package/dist/pine-core/p-768e754e.system.entry.js.map +0 -1
- package/dist/pine-core/p-953f619f.system.entry.js +0 -2
- package/dist/pine-core/p-9d0c1b2e.system.entry.js +0 -2
- package/dist/pine-core/p-BBpt-9kK.system.js.map +0 -1
- package/dist/pine-core/p-BUD-iaLL.system.js.map +0 -1
- package/dist/pine-core/p-Bd19LaTb.system.js.map +0 -1
- package/dist/pine-core/p-C94EgDFz.system.js.map +0 -1
- package/dist/pine-core/p-CIzJqNxZ.system.js.map +0 -1
- package/dist/pine-core/p-CbNKHcsJ.system.js.map +0 -1
- package/dist/pine-core/p-CdkqpuKd.system.js.map +0 -1
- package/dist/pine-core/p-Chrs_Qxi.system.js.map +0 -1
- package/dist/pine-core/p-DhwO1z4v.system.js.map +0 -1
- package/dist/pine-core/p-Dw9B1JDC.js +0 -2
- package/dist/pine-core/p-Dw9B1JDC.js.map +0 -1
- package/dist/pine-core/p-a5587332.entry.js.map +0 -1
- package/dist/pine-core/p-aa955b03.entry.js +0 -2
- package/dist/pine-core/p-aa955b03.entry.js.map +0 -1
- package/dist/pine-core/p-amsdFwC6.system.js.map +0 -1
- package/dist/pine-core/p-b41dee6f.system.entry.js +0 -2
- package/dist/pine-core/p-b41dee6f.system.entry.js.map +0 -1
- package/dist/pine-core/p-d5838288.entry.js +0 -2
- package/dist/pine-core/p-e7bf0be9.entry.js +0 -2
- package/dist/pine-core/p-e7bf0be9.entry.js.map +0 -1
- package/dist/pine-core/p-f1156360.entry.js +0 -2
- package/dist/pine-core/p-f1156360.entry.js.map +0 -1
- package/dist/pine-core/p-f4898d4f.entry.js +0 -2
- package/dist/pine-core/p-f4898d4f.entry.js.map +0 -1
- package/dist/pine-core/p-mVZRKoXd.js.map +0 -1
- /package/dist/pine-core/{p-ad69e5f9.system.entry.js.map → p-0069abf8.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-a14c8ab4.system.entry.js.map → p-03d8cb4c.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-2ab26d3d.system.entry.js.map → p-04df41d7.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-0486ad57.entry.js.map → p-0572825b.entry.js.map} +0 -0
- /package/dist/pine-core/{p-d2110923.system.entry.js.map → p-111e7da2.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-1d690915.entry.js.map → p-1224c874.entry.js.map} +0 -0
- /package/dist/pine-core/{p-b2bbc362.entry.js.map → p-146fcd44.entry.js.map} +0 -0
- /package/dist/pine-core/{p-abcce8af.entry.js.map → p-17d3fa8b.entry.js.map} +0 -0
- /package/dist/pine-core/{p-e4ea5041.system.entry.js.map → p-1eec6bea.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-294f9b1f.entry.js.map → p-21c3aaeb.entry.js.map} +0 -0
- /package/dist/pine-core/{p-5c396e75.entry.js.map → p-24607f93.entry.js.map} +0 -0
- /package/dist/pine-core/{p-c0f0b368.system.entry.js.map → p-30142a25.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-8305cd4d.entry.js.map → p-367e188f.entry.js.map} +0 -0
- /package/dist/pine-core/{p-6147b1ea.system.entry.js.map → p-3798a631.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-3fdbda99.system.entry.js.map → p-3f82ac77.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-42f1190a.system.entry.js.map → p-48e76945.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-b9f99fc9.entry.js.map → p-4ff0838c.entry.js.map} +0 -0
- /package/dist/pine-core/{p-820faa91.system.entry.js.map → p-596e0292.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-598ade79.entry.js.map → p-5e1e7762.entry.js.map} +0 -0
- /package/dist/pine-core/{p-d0780ca1.system.entry.js.map → p-6a2296e6.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-b68cb43d.system.entry.js.map → p-71265b2a.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-98181fa8.system.entry.js.map → p-730221a8.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-91dadcbe.entry.js.map → p-742d4490.entry.js.map} +0 -0
- /package/dist/pine-core/{p-950427b2.entry.js.map → p-77c3a10d.entry.js.map} +0 -0
- /package/dist/pine-core/{p-fed4c0c0.system.entry.js.map → p-78cb1c40.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-1d92261f.system.entry.js.map → p-78fb945e.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-13b9ed06.system.entry.js.map → p-7ff213bb.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-9e9d3a2b.entry.js.map → p-8023086c.entry.js.map} +0 -0
- /package/dist/pine-core/{p-953f619f.system.entry.js.map → p-83252078.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-bedddd53.entry.js.map → p-833f08f3.entry.js.map} +0 -0
- /package/dist/pine-core/{p-12bee2e5.entry.js.map → p-86d388a2.entry.js.map} +0 -0
- /package/dist/pine-core/{p-e045e337.system.entry.js.map → p-984578f8.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-e281ac09.entry.js.map → p-99b5e1a5.entry.js.map} +0 -0
- /package/dist/pine-core/{p-1995a0f8.system.entry.js.map → p-a2572675.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-85073252.system.entry.js.map → p-a394645a.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-dae339c3.entry.js.map → p-abec6606.entry.js.map} +0 -0
- /package/dist/pine-core/{p-5db706e1.entry.js.map → p-b3d05184.entry.js.map} +0 -0
- /package/dist/pine-core/{p-b902f535.entry.js.map → p-b7ba6316.entry.js.map} +0 -0
- /package/dist/pine-core/{p-14ca569b.entry.js.map → p-bcc4edaa.entry.js.map} +0 -0
- /package/dist/pine-core/{p-9cdd57de.entry.js.map → p-c0f74199.entry.js.map} +0 -0
- /package/dist/pine-core/{p-ed8c3064.system.entry.js.map → p-c1b0f921.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-68de979e.entry.js.map → p-c4294be2.entry.js.map} +0 -0
- /package/dist/pine-core/{p-7b6b354a.system.entry.js.map → p-d2ccda59.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-040f3c92.system.entry.js.map → p-e09a3682.system.entry.js.map} +0 -0
- /package/dist/pine-core/{p-792355e6.entry.js.map → p-e2dc81c0.entry.js.map} +0 -0
- /package/dist/pine-core/{p-eda0dc79.entry.js.map → p-f47133fd.entry.js.map} +0 -0
package/hydrate/index.js
CHANGED
|
@@ -3073,7 +3073,104 @@ var registerHost = (elm, cmpMeta) => {
|
|
|
3073
3073
|
};
|
|
3074
3074
|
var styles = /* @__PURE__ */ new Map();
|
|
3075
3075
|
|
|
3076
|
-
|
|
3076
|
+
const pdsModalCss$1 = ".pds-modal__backdrop{-ms-flex-align:start;align-items:flex-start;background-color:rgba(0, 0, 0, 0.4);border:0;display:-ms-flexbox;display:flex;height:100%;inset:0;-ms-flex-pack:center;justify-content:center;margin:0;max-height:100%;max-width:100%;opacity:0;padding:0;position:fixed;-webkit-transition:opacity 0.2s ease, visibility 0.2s ease;transition:opacity 0.2s ease, visibility 0.2s ease;visibility:hidden;width:100%;z-index:1000}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}}pds-modal .pds-modal__backdrop{z-index:1001}.pds-modal__backdrop::-webkit-backdrop{background:transparent}.pds-modal__backdrop::-ms-backdrop{background:transparent}.pds-modal__backdrop::backdrop{background:transparent}.pds-modal__backdrop.open{opacity:1;visibility:visible}.pds-modal{background:var(--pine-color-background-container);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow-400);box-shadow:var(--pine-box-shadow-400);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:var(--pine-dimension-md);max-height:calc(100vh - (6vh + 96px));width:100%}@media (min-width: 992px){.pds-modal{-webkit-margin-before:6vh;margin-block-start:6vh}}@media (min-width: 1200px){.pds-modal{-webkit-margin-before:8vh;margin-block-start:8vh}}.pds-modal--sm{max-width:520px}.pds-modal--md{max-width:700px}.pds-modal--lg{max-width:900px}.pds-modal--fullscreen{border-radius:0;height:100%;margin:0;max-height:100vh;max-width:100%}.pds-modal--fullscreen .pds-modal-content{-ms-flex:1;flex:1}";
|
|
3077
|
+
|
|
3078
|
+
/**
|
|
3079
|
+
* Mock PdsModal component for testing purposes
|
|
3080
|
+
* This component mimics the real PdsModal but without using the Popover API
|
|
3081
|
+
*/
|
|
3082
|
+
class MockPdsModal {
|
|
3083
|
+
constructor(hostRef) {
|
|
3084
|
+
registerInstance(this, hostRef);
|
|
3085
|
+
this.pdsModalOpen = createEvent(this, "pdsModalOpen");
|
|
3086
|
+
this.pdsModalClose = createEvent(this, "pdsModalClose");
|
|
3087
|
+
this.pdsModalBackdropClick = createEvent(this, "pdsModalBackdropClick");
|
|
3088
|
+
/**
|
|
3089
|
+
* The size of the modal
|
|
3090
|
+
*/
|
|
3091
|
+
this.size = 'md';
|
|
3092
|
+
// Modal content is always scrollable by default
|
|
3093
|
+
/**
|
|
3094
|
+
* Whether the modal can be dismissed by clicking the backdrop
|
|
3095
|
+
*/
|
|
3096
|
+
this.backdropDismiss = true;
|
|
3097
|
+
// Native dialog element always closes on Escape key press, so no closeOnEsc property is needed
|
|
3098
|
+
/**
|
|
3099
|
+
* Whether the modal is open
|
|
3100
|
+
*/
|
|
3101
|
+
this.open = false;
|
|
3102
|
+
}
|
|
3103
|
+
/**
|
|
3104
|
+
* Shows the modal
|
|
3105
|
+
*/
|
|
3106
|
+
async showModal() {
|
|
3107
|
+
this.open = true;
|
|
3108
|
+
this.pdsModalOpen.emit();
|
|
3109
|
+
}
|
|
3110
|
+
/**
|
|
3111
|
+
* Hides the modal
|
|
3112
|
+
*/
|
|
3113
|
+
async hideModal() {
|
|
3114
|
+
this.open = false;
|
|
3115
|
+
this.pdsModalClose.emit();
|
|
3116
|
+
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Listen for click events on the backdrop
|
|
3119
|
+
*/
|
|
3120
|
+
// Using direct method instead of @Listen to avoid ESLint warning
|
|
3121
|
+
handleBackdropClick(event) {
|
|
3122
|
+
const backdrop = this.el.querySelector('.pds-modal__backdrop');
|
|
3123
|
+
// Check if the click was directly on the backdrop (not on a child element)
|
|
3124
|
+
if (event.target === backdrop && this.backdropDismiss === true) {
|
|
3125
|
+
this.pdsModalBackdropClick.emit();
|
|
3126
|
+
this.hideModal();
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
/**
|
|
3130
|
+
* Listen for keydown events to handle Escape key
|
|
3131
|
+
* Native dialog element always closes on Escape key press
|
|
3132
|
+
*/
|
|
3133
|
+
// Using direct method instead of @Listen to avoid ESLint warning
|
|
3134
|
+
handleKeyDown(event) {
|
|
3135
|
+
if (event.key === 'Escape' && this.open === true) {
|
|
3136
|
+
this.hideModal();
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
componentDidLoad() {
|
|
3140
|
+
// No need to do anything in componentDidLoad for the mock
|
|
3141
|
+
}
|
|
3142
|
+
render() {
|
|
3143
|
+
const modalClasses = {
|
|
3144
|
+
'pds-modal': true,
|
|
3145
|
+
[`pds-modal--${this.size}`]: true,
|
|
3146
|
+
'pds-modal--scrollable': true, // Always scrollable by default
|
|
3147
|
+
};
|
|
3148
|
+
const backdropClasses = {
|
|
3149
|
+
'pds-modal__backdrop': true,
|
|
3150
|
+
'open': this.open,
|
|
3151
|
+
};
|
|
3152
|
+
return (hAsync("div", { key: 'fb141b585e21257f4e2b1e189211ffd8fdbf5f21', class: backdropClasses }, hAsync("div", { key: '2431265c962c17042b79e59e8799159c0af79bba', class: modalClasses, role: "dialog", "aria-modal": "true", "aria-labelledby": this.componentId ? `${this.componentId}-heading` : null }, hAsync("div", { key: '122d233ca19497ccd8541474343442391a9fd60b', class: "pds-modal__header" }, hAsync("slot", { key: 'abb92bd56f45ac7a1007649952eb6351dbe1193d', name: "header" })), hAsync("div", { key: 'fb096821bccb813311f3047bb33a81374808a99d', class: "pds-modal-content" }, hAsync("slot", { key: '79400555ec3420db6eda65f12b90060b5507c96e' })), hAsync("div", { key: '60462c314237b4b573c222df26aa41073437f298', class: "pds-modal__footer" }, hAsync("slot", { key: '9253219fc90477c4c86df974f4a6a196f693e548', name: "footer" })))));
|
|
3153
|
+
}
|
|
3154
|
+
get el() { return getElement(this); }
|
|
3155
|
+
static get style() { return pdsModalCss$1; }
|
|
3156
|
+
static get cmpMeta() { return {
|
|
3157
|
+
"$flags$": 4,
|
|
3158
|
+
"$tagName$": "mock-pds-modal",
|
|
3159
|
+
"$members$": {
|
|
3160
|
+
"componentId": [1, "component-id"],
|
|
3161
|
+
"size": [1],
|
|
3162
|
+
"backdropDismiss": [4, "backdrop-dismiss"],
|
|
3163
|
+
"open": [1028],
|
|
3164
|
+
"showModal": [64],
|
|
3165
|
+
"hideModal": [64]
|
|
3166
|
+
},
|
|
3167
|
+
"$listeners$": undefined,
|
|
3168
|
+
"$lazyBundleId$": "-",
|
|
3169
|
+
"$attrsToReflect$": []
|
|
3170
|
+
}; }
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
/* pds-icons v9.4.3, ES Modules */
|
|
3077
3174
|
|
|
3078
3175
|
const caretDown = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' class='pdsicon'><path fill-rule='evenodd' d='M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414'/></svg>";
|
|
3079
3176
|
const checkCircleFilled = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' class='pdsicon'><path fill-rule='evenodd' d='M12 1C5.925 1 1 5.925 1 12s4.925 11 11 11 11-4.925 11-11S18.075 1 12 1m5.207 8.707a1 1 0 0 0-1.414-1.414L10.5 13.586l-2.293-2.293a1 1 0 0 0-1.414 1.414l3 3a1 1 0 0 0 1.414 0z'/></svg>";
|
|
@@ -3139,6 +3236,82 @@ class PdsAccordion {
|
|
|
3139
3236
|
}; }
|
|
3140
3237
|
}
|
|
3141
3238
|
|
|
3239
|
+
const pdsAlertTokensCss = ":host{--pine-alert-color-background:var(--pine-color-grey-150);--pine-alert-color-border:var(--pine-color-grey-300);--pine-alert-color-dismiss:var(--pine-color-grey-900);--pine-alert-color-dismiss-hover:var(--pine-color-grey-300);--pine-alert-color-icon:var(--pine-color-grey-700);--pine-alert-color-text:var(--pine-color-grey-950);--pine-alert-color-danger-background:var(--pine-color-red-150);--pine-alert-color-danger-border:var(--pine-color-red-300);--pine-alert-color-danger-dismiss:var(--pine-color-red-900);--pine-alert-color-danger-dismiss-hover:var(--pine-color-red-300);--pine-alert-color-danger-icon:var(--pine-color-red-700);--pine-alert-color-danger-text:var(--pine-color-red-950);--pine-alert-color-info-background:var(--pine-color-blue-150);--pine-alert-color-info-border:var(--pine-color-blue-300);--pine-alert-color-info-dismiss:var(--pine-color-blue-900);--pine-alert-color-info-dismiss-hover:var(--pine-color-blue-300);--pine-alert-color-info-icon:var(--pine-color-blue-700);--pine-alert-color-info-text:var(--pine-color-blue-950);--pine-alert-color-success-background:var(--pine-color-green-150);--pine-alert-color-success-border:var(--pine-color-green-300);--pine-alert-color-success-dismiss:var(--pine-color-green-900);--pine-alert-color-success-dismiss-hover:var(--pine-color-green-300);--pine-alert-color-success-icon:var(--pine-color-green-700);--pine-alert-color-success-text:var(--pine-color-green-950);--pine-alert-color-warning-background:var(--pine-color-yellow-150);--pine-alert-color-warning-border:var(--pine-color-yellow-300);--pine-alert-color-warning-dismiss:var(--pine-color-yellow-900);--pine-alert-color-warning-dismiss-hover:var(--pine-color-yellow-300);--pine-alert-color-warning-icon:var(--pine-color-yellow-700);--pine-alert-color-warning-text:var(--pine-color-yellow-950)}";
|
|
3240
|
+
|
|
3241
|
+
const pdsAlertCss = ":host{display:block;line-height:1;width:100%}.pds-alert__container{--pds-alert-icon-size:var(--pine-dimension-sm);--pds-alert-border-dismiss-outline:2px solid var(--pds-alert-color-dismiss);--pds-alert-background:var(--pine-alert-color-background);--pds-alert-border-color:var(--pine-alert-color-border);--pds-alert-color-icon:var(--pine-alert-color-icon);--pds-alert-color-text:var(--pine-alert-color-text);--pds-alert-color-dismiss:var(--pine-alert-color-dismiss);--pds-alert-background-dismiss-hover:var(--pine-alert-color-dismiss-hover)}.pds-alert__container--danger{--pds-alert-background:var(--pine-alert-color-danger-background);--pds-alert-border-color:var(--pine-alert-color-danger-border);--pds-alert-color-icon:var(--pine-alert-color-danger-icon);--pds-alert-color-text:var(--pine-alert-color-danger-text);--pds-alert-color-dismiss:var(--pine-alert-color-danger-dismiss);--pds-alert-background-dismiss-hover:var(--pine-alert-color-danger-dismiss-hover)}.pds-alert__container--info{--pds-alert-background:var(--pine-alert-color-info-background);--pds-alert-border-color:var(--pine-alert-color-info-border);--pds-alert-color-icon:var(--pine-alert-color-info-icon);--pds-alert-color-text:var(--pine-alert-color-info-text);--pds-alert-color-dismiss:var(--pine-alert-color-info-dismiss);--pds-alert-background-dismiss-hover:var(--pine-alert-color-info-dismiss-hover)}.pds-alert__container--success{--pds-alert-background:var(--pine-alert-color-success-background);--pds-alert-border-color:var(--pine-alert-color-success-border);--pds-alert-color-icon:var(--pine-alert-color-success-icon);--pds-alert-color-text:var(--pine-alert-color-success-text);--pds-alert-color-dismiss:var(--pine-alert-color-success-dismiss);--pds-alert-background-dismiss-hover:var(--pine-alert-color-success-dismiss-hover)}.pds-alert__container--warning{--pds-alert-background:var(--pine-alert-color-warning-background);--pds-alert-border-color:var(--pine-alert-color-warning-border);--pds-alert-color-icon:var(--pine-alert-color-warning-icon);--pds-alert-color-text:var(--pine-alert-color-warning-text);--pds-alert-color-dismiss:var(--pine-alert-color-warning-dismiss);--pds-alert-background-dismiss-hover:var(--pine-alert-color-warning-dismiss-hover)}.pds-alert__icon{-webkit-margin-before:var(--pine-dimension-2xs);margin-block-start:var(--pine-dimension-2xs)}.pds-alert__icon--small{-webkit-margin-before:calc(var(--pine-dimension-2xs) / 2);margin-block-start:calc(var(--pine-dimension-2xs) / 2)}.pds-alert__content-wrapper{-ms-flex:1;flex:1;min-width:0;overflow:hidden;width:100%}.pds-alert__dismiss{-ms-flex-align:center;align-items:center;background:none;border:0;border-radius:var(--pine-border-radius-full);cursor:pointer;display:-ms-flexbox;display:flex;height:var(--pine-dimension-250);-ms-flex-pack:center;justify-content:center;padding:var(--pine-dimension-xs);width:var(--pine-dimension-250)}.pds-alert__dismiss:hover{background:var(--pds-alert-background-dismiss-hover);opacity:0.8}.pds-alert__dismiss:focus-visible{outline:var(--pds-alert-border-dismiss-outline)}.pds-alert__description--small{-ms-flex:1 1 auto;flex:1 1 auto;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pds-alert__actions{-webkit-margin-before:var(--pine-dimension-sm);margin-block-start:var(--pine-dimension-sm)}.pds-alert__actions--small{-ms-flex-negative:0;flex-shrink:0;-webkit-margin-start:auto;margin-inline-start:auto;white-space:nowrap}";
|
|
3242
|
+
|
|
3243
|
+
/**
|
|
3244
|
+
* @slot actions - Slot for alert actions.
|
|
3245
|
+
*/
|
|
3246
|
+
class PdsAlert {
|
|
3247
|
+
constructor(hostRef) {
|
|
3248
|
+
registerInstance(this, hostRef);
|
|
3249
|
+
this.pdsAlertDismissClick = createEvent(this, "pdsAlertDismissClick");
|
|
3250
|
+
/**
|
|
3251
|
+
* If true, the alert is displayed in a smaller size and description text is truncated. Heading is not displayed.
|
|
3252
|
+
*/
|
|
3253
|
+
this.small = false;
|
|
3254
|
+
/**
|
|
3255
|
+
* If true, shows the dismiss button. If false, the dismiss button is hidden.
|
|
3256
|
+
* @defaultValue false
|
|
3257
|
+
*/
|
|
3258
|
+
this.dismissible = false;
|
|
3259
|
+
/**
|
|
3260
|
+
* Sets the style variant of the alert.
|
|
3261
|
+
* @defaultValue 'default'
|
|
3262
|
+
*/
|
|
3263
|
+
this.variant = 'default';
|
|
3264
|
+
this.hasActionsContent = false;
|
|
3265
|
+
this.handleCloseClick = () => {
|
|
3266
|
+
this.pdsAlertDismissClick.emit();
|
|
3267
|
+
};
|
|
3268
|
+
}
|
|
3269
|
+
componentWillRender() {
|
|
3270
|
+
// Check if the actions slot has any content.
|
|
3271
|
+
// If not, hide the actions container to prevent empty space.
|
|
3272
|
+
const actionsSlot = this.el.querySelector('[slot="actions"]');
|
|
3273
|
+
this.hasActionsContent = !!actionsSlot;
|
|
3274
|
+
}
|
|
3275
|
+
renderActions(isSmall) {
|
|
3276
|
+
return (hAsync("pds-box", { class: isSmall ? "pds-alert__actions--small" : "pds-alert__actions", gap: "sm", flex: isSmall ? "none" : undefined, "align-items": isSmall ? undefined : "center" }, hAsync("slot", { name: "actions" })));
|
|
3277
|
+
}
|
|
3278
|
+
renderContent() {
|
|
3279
|
+
if (this.small) {
|
|
3280
|
+
return (hAsync("pds-box", { display: "flex", gap: "md", "align-items": "center" }, hAsync("pds-text", { truncate: this.small, class: "pds-alert__description--small", color: "var(--pds-alert-color-text)", tag: "p" }, hAsync("slot", null)), this.hasActionsContent && this.renderActions(true)));
|
|
3281
|
+
}
|
|
3282
|
+
return (hAsync("div", null, hAsync("pds-text", { class: "pds-alert__description", color: "var(--pds-alert-color-text)", tag: "p" }, hAsync("slot", null)), this.hasActionsContent && this.renderActions(false)));
|
|
3283
|
+
}
|
|
3284
|
+
render() {
|
|
3285
|
+
const iconMap = {
|
|
3286
|
+
danger: 'warning-filled',
|
|
3287
|
+
default: 'info-circle-filled',
|
|
3288
|
+
info: 'info-circle-filled',
|
|
3289
|
+
success: 'check-circle-filled',
|
|
3290
|
+
warning: 'info-circle-filled',
|
|
3291
|
+
};
|
|
3292
|
+
// Get the icon name based on the current variant
|
|
3293
|
+
const iconName = iconMap[this.variant] || iconMap.default;
|
|
3294
|
+
return (hAsync(Host, { key: 'ccb4b954c20b4fedfe1336737a412753bf3c78a2', class: "pds-alert", id: this.componentId, variant: this.variant }, hAsync("pds-box", { key: '6feafdc553ab9854542cb53035486a0caa1f3348', class: `pds-alert__container pds-alert__container--${this.variant}`, "background-color": "var(--pds-alert-background)", "border-color": "var(--pds-alert-border-color)", "border-radius": "md", border: true, display: "block", padding: "md" }, hAsync("pds-box", { key: '86b160e97ac4724434b09cd832f7cdc61834a520', gap: "sm", display: "flex" }, hAsync("pds-icon", { key: 'c2f61f894b3f63915259e298dd9d973b719880c9', class: `pds-alert__icon ${this.small ? 'pds-alert__icon--small' : ''}`, color: "var(--pds-alert-color-icon)", icon: iconName, size: "var(--pds-alert-icon-size)" }), hAsync("pds-box", { key: '07926a4d7d6a1795edd2055ce9ae3d853982fe98', class: "pds-alert__content-wrapper", direction: "column", gap: "xs", flex: "grow" }, this.heading && !this.small && (hAsync("pds-text", { key: '2267241b05890cb4b955cd5418b26f30abd0503c', class: "pds-alert__heading", color: "var(--pds-alert-color-text)", size: "h5", tag: "h3", weight: "medium" }, this.heading)), this.renderContent()), this.dismissible && (hAsync("button", { key: 'bdc435db71e60d9233e97821ea10012f509cae26', class: "pds-alert__dismiss", type: "button", "aria-label": "Dismiss alert", onClick: this.handleCloseClick }, hAsync("pds-icon", { key: '22f013acfafafa6c32da9aa696bef8a8d3c633c0', icon: "remove", size: "var(--pds-alert-icon-size)", "aria-hidden": "true", color: "var(--pds-alert-color-dismiss)" })))))));
|
|
3295
|
+
}
|
|
3296
|
+
get el() { return getElement(this); }
|
|
3297
|
+
static get style() { return pdsAlertTokensCss + pdsAlertCss; }
|
|
3298
|
+
static get cmpMeta() { return {
|
|
3299
|
+
"$flags$": 9,
|
|
3300
|
+
"$tagName$": "pds-alert",
|
|
3301
|
+
"$members$": {
|
|
3302
|
+
"componentId": [1, "component-id"],
|
|
3303
|
+
"heading": [1],
|
|
3304
|
+
"small": [4],
|
|
3305
|
+
"dismissible": [4],
|
|
3306
|
+
"variant": [1],
|
|
3307
|
+
"hasActionsContent": [32]
|
|
3308
|
+
},
|
|
3309
|
+
"$listeners$": undefined,
|
|
3310
|
+
"$lazyBundleId$": "-",
|
|
3311
|
+
"$attrsToReflect$": []
|
|
3312
|
+
}; }
|
|
3313
|
+
}
|
|
3314
|
+
|
|
3142
3315
|
const pdsAvatarCss = ":host{display:inline-block}div{--color-background-container:var(--pine-color-mercury-050);-ms-flex-align:center;align-items:center;background-color:var(--color-background-container);border-radius:var(--border-radius-admin-round, var(--pine-border-radius-full));display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;position:relative}:host(.pds-avatar--admin) div{--border-radius-admin-round:var(--pine-dimension-150);border-radius:var(--border-radius-admin-round)}:host(.pds-avatar--has-image) div{background:transparent}@supports selector(:has){div:has(img){background-color:transparent}}.pds-avatar__button{-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:var(--pine-dimension-none);border-radius:var(--pine-border-radius-full);cursor:pointer;display:-ms-flexbox;display:flex;padding:var(--pine-dimension-none)}.pds-avatar__button:focus-visible{outline:var(--pine-outline-focus)}.pds-avatar__badge{background-color:var(--pine-color-background-container);border:var(--pine-border);border-color:var(--pine-color-secondary);border-radius:var(--pine-border-radius-round);inset-block-end:var(--pine-dimension-none);inset-inline-end:var(--pine-dimension-none);position:absolute}img{border-radius:var(--border-radius-admin-round, var(--pine-border-radius-full));height:100%;-o-object-fit:cover;object-fit:cover;width:100%}";
|
|
3143
3316
|
|
|
3144
3317
|
/**
|
|
@@ -3224,7 +3397,7 @@ class PdsAvatar {
|
|
|
3224
3397
|
}
|
|
3225
3398
|
}
|
|
3226
3399
|
render() {
|
|
3227
|
-
return (hAsync(Host, { key: '
|
|
3400
|
+
return (hAsync(Host, { key: 'c19584898e4613085f6e6b8e227e7181eb4c8f1b', id: this.componentId, class: Object.assign({}, this.classNames()) }, this.renderAvatar()));
|
|
3228
3401
|
}
|
|
3229
3402
|
static get style() { return pdsAvatarCss; }
|
|
3230
3403
|
static get cmpMeta() { return {
|
|
@@ -3296,8 +3469,8 @@ class PdsBox {
|
|
|
3296
3469
|
this.sizeLg == undefined &&
|
|
3297
3470
|
this.sizeXl == undefined ? 'pds-box' : ''}
|
|
3298
3471
|
`;
|
|
3299
|
-
const boxInlineStyles = Object.assign(Object.assign(Object.assign(Object.assign({}, (this.backgroundColor && { '--color-background-box': this.backgroundColor })), (this.borderColor && { '--color-border-box': this.borderColor })), (this.minHeight && { '--sizing-min-height-box': this.minHeight })), (this.minWidth && { '--sizing-min-
|
|
3300
|
-
return (hAsync(Host, { key: '
|
|
3472
|
+
const boxInlineStyles = Object.assign(Object.assign(Object.assign(Object.assign({}, (this.backgroundColor && { '--color-background-box': this.backgroundColor })), (this.borderColor && { '--color-border-box': this.borderColor })), (this.minHeight && { '--sizing-min-height-box': this.minHeight })), (this.minWidth && { '--sizing-min-width-box': this.minWidth }));
|
|
3473
|
+
return (hAsync(Host, { key: '5a16a73506e9322444b85626dc71dceacbfac263', class: boxClasses, style: boxInlineStyles }));
|
|
3301
3474
|
}
|
|
3302
3475
|
static get style() { return pdsBoxCss; }
|
|
3303
3476
|
static get cmpMeta() { return {
|
|
@@ -3365,11 +3538,11 @@ const debounce = (func, wait = 0) => {
|
|
|
3365
3538
|
timer = setTimeout(func, wait, ...args);
|
|
3366
3539
|
};
|
|
3367
3540
|
};
|
|
3368
|
-
const setColor = (color) => {
|
|
3541
|
+
const setColor = (color, customColors) => {
|
|
3369
3542
|
var _a;
|
|
3370
3543
|
if (!color)
|
|
3371
3544
|
return;
|
|
3372
|
-
const
|
|
3545
|
+
const defaultColors = {
|
|
3373
3546
|
primary: 'var(--pine-color-text-primary)',
|
|
3374
3547
|
secondary: 'var(--pine-color-text-secondary)',
|
|
3375
3548
|
neutral: 'var(--pine-color-text-neutral)',
|
|
@@ -3379,12 +3552,13 @@ const setColor = (color) => {
|
|
|
3379
3552
|
success: 'var(--pine-color-text-success)',
|
|
3380
3553
|
warning: 'var(--pine-color-text-warning)',
|
|
3381
3554
|
};
|
|
3555
|
+
const colors = customColors || defaultColors;
|
|
3382
3556
|
return {
|
|
3383
3557
|
'--color': (_a = colors[color]) !== null && _a !== void 0 ? _a : (color.startsWith('--') ? `var(${color})` : color)
|
|
3384
3558
|
};
|
|
3385
3559
|
};
|
|
3386
3560
|
|
|
3387
|
-
const pdsButtonCss = ":host{--button-dimension:40px;--color-border-default:transparent;--color-border-disabled:transparent;--color-border-focus:transparent;--color-border-hover:transparent;--button-loader-color:var(--color-text-default);display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle}:host([full-width=true]){display:-ms-flexbox;display:flex;width:100%}:host([full-width=true]) button{-ms-flex-pack:center;justify-content:center;width:100%}:host([full-width=true]) .pds-button__content{-ms-flex-pack:center;justify-content:center;text-align:center}:host([loading=true]){cursor:wait;pointer-events:none}:host([disabled=true]){pointer-events:none}.pds-button{--pds-loader-color:var(--color-text-default);-ms-flex-align:center;align-items:center;background-color:var(--color-background-default);border:var(--pine-border);border-color:var(--color-border-default);border-radius:var(--pine-border-radius-full);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--color-text-default);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body-brand-label);letter-spacing:var(--pine-letter-spacing);min-height:var(--button-dimension);padding:var(--pine-dimension-xs) var(--pine-dimension-sm);text-decoration:none}.pds-button pds-icon{color:currentColor;fill:currentColor
|
|
3561
|
+
const pdsButtonCss = ":host{--button-dimension:40px;--color-border-default:transparent;--color-border-disabled:transparent;--color-border-focus:transparent;--color-border-hover:transparent;--button-loader-color:var(--color-text-default);display:-ms-inline-flexbox;display:inline-flex;vertical-align:middle}:host([full-width=true]){display:-ms-flexbox;display:flex;width:100%}:host([full-width=true]) button{-ms-flex-pack:center;justify-content:center;width:100%}:host([full-width=true]) .pds-button__content{-ms-flex-pack:center;justify-content:center;text-align:center}:host([loading=true]){cursor:wait;pointer-events:none}:host([disabled=true]){pointer-events:none}.pds-button{--pds-loader-color:var(--color-text-default);-ms-flex-align:center;align-items:center;background-color:var(--color-background-default);border:var(--pine-border);border-color:var(--color-border-default);border-radius:var(--pine-border-radius-full);-webkit-box-sizing:border-box;box-sizing:border-box;color:var(--color-text-default);cursor:pointer;display:-ms-flexbox;display:flex;font:var(--pine-typography-body-brand-label);letter-spacing:var(--pine-letter-spacing);min-height:var(--button-dimension);padding:var(--pine-dimension-xs) var(--pine-dimension-sm);text-decoration:none}.pds-button pds-icon{color:currentColor;fill:currentColor}.pds-button:hover{background-color:var(--color-background-hover);border-color:var(--color-border-hover)}.pds-button:focus-visible{border-color:var(--color-border-focus);outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}.pds-button:disabled{background-color:var(--color-background-disabled);border-color:var(--color-border-disabled);color:var(--color-text-disabled);pointer-events:none}.pds-button--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-text-default:var(--pine-color-text-primary);--color-text-disabled:var(--pine-color-text-primary-disabled);--color-outline:var(--pine-color-focus-ring);--button-loader-color:var(--pine-color-text-primary)}.pds-button--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-text-default:var(--pine-color-text-primary);--color-text-disabled:var(--pine-color-text-accent-disabled);--color-outline:var(--pine-color-focus-ring);--button-loader-color:var(--pine-color-text-primary)}.pds-button--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-text-default:var(--pine-color-text-primary);--color-text-disabled:var(--pine-color-text-danger-disabled);--color-outline:var(--pine-color-focus-ring-danger);--button-loader-color:var(--pine-color-text-primary)}.pds-button--destructive:focus-visible{outline-color:var(--pine-color-focus-ring-danger)}.pds-button--secondary,.pds-button--disclosure{--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-disabled:var(--pine-color-border-disabled);--color-border-focus:var(--pine-color-border);--color-border-hover:var(--pine-color-border-hover);--color-border-default: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);--button-loader-color:var(--pine-color-text-secondary)}.pds-button--secondary:hover,.pds-button--disclosure:hover{background-color:var(--pine-color-secondary-hover)}.pds-button--unstyled{--color-background-default:transparent;--color-background-hover:transparent;--color-background-disabled:transparent;--color-text-default:inherit;--button-loader-color:inherit;border-width:var(--pine-dimension-none);margin:var(--pine-dimension-none);min-height:auto;padding:var(--pine-dimension-none);width:inherit}.pds-button__content{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;gap:var(--pine-dimension-xs);position:relative;width:100%}.pds-button__icon{display:-ms-inline-flexbox;display:inline-flex}.pds-button__text{-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex}.pds-button__icon--hidden,.pds-button__text--hidden{opacity:0}.pds-button__loader{height:var(--pine-dimension-250);left:50%;position:absolute;top:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%);width:var(--pine-dimension-250)}.pds-button--loading{cursor:wait;pointer-events:none}.pds-button--loading .pds-button__loader pds-loader{--loader-color:var(--button-loader-color)}.pds-button--icon-only{-ms-flex-align:center;align-items:center;border-radius:var(--pine-border-radius-full);height:var(--button-dimension);-ms-flex-pack:center;justify-content:center;min-height:var(--button-dimension);min-width:var(--button-dimension);padding:var(--pine-dimension-xs);width:var(--button-dimension)}.pds-button--icon-only .pds-button__content{height:100%;-ms-flex-pack:center;justify-content:center;width:100%}.pds-button--icon-only .pds-button__text--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}";
|
|
3388
3562
|
|
|
3389
3563
|
/**
|
|
3390
3564
|
* @part button - Exposes the button element for styling.
|
|
@@ -3392,6 +3566,9 @@ const pdsButtonCss = ":host{--button-dimension:40px;--color-border-default:trans
|
|
|
3392
3566
|
* @part button-text - Exposes the button text for styling.
|
|
3393
3567
|
* @part caret - Exposes the caret icon component for styling. Appears only on the disclosure variant.
|
|
3394
3568
|
* @part icon - Exposes the icon component for styling.
|
|
3569
|
+
* @slot (default) - Button text.
|
|
3570
|
+
* @slot start - Content to display before the button text.
|
|
3571
|
+
* @slot end - Content to display after the button text.
|
|
3395
3572
|
*/
|
|
3396
3573
|
class PdsButton {
|
|
3397
3574
|
constructor(hostRef) {
|
|
@@ -3408,8 +3585,9 @@ class PdsButton {
|
|
|
3408
3585
|
*/
|
|
3409
3586
|
this.fullWidth = false;
|
|
3410
3587
|
/**
|
|
3411
|
-
* Displays
|
|
3588
|
+
* Displays a leading icon in the button. DEPRECATED.
|
|
3412
3589
|
* @defaultValue null
|
|
3590
|
+
* @deprecated Use `start` slot instead.
|
|
3413
3591
|
*/
|
|
3414
3592
|
this.icon = null;
|
|
3415
3593
|
/**
|
|
@@ -3468,6 +3646,33 @@ class PdsButton {
|
|
|
3468
3646
|
}
|
|
3469
3647
|
return classNames.join(' ');
|
|
3470
3648
|
}
|
|
3649
|
+
hasSlotContent(slotName) {
|
|
3650
|
+
const elements = this.el.querySelectorAll(`[slot="${slotName}"]`);
|
|
3651
|
+
return elements.length > 0;
|
|
3652
|
+
}
|
|
3653
|
+
renderStartContent() {
|
|
3654
|
+
const hasIcon = this.icon && this.variant !== 'disclosure';
|
|
3655
|
+
const hasStartSlot = this.hasSlotContent('start');
|
|
3656
|
+
if (Boolean(hasIcon)) {
|
|
3657
|
+
return (hAsync("pds-icon", { class: this.loading ? 'pds-button__icon--hidden' : '', name: this.icon, part: "icon", "aria-hidden": "true" }));
|
|
3658
|
+
}
|
|
3659
|
+
else if (Boolean(hasStartSlot)) {
|
|
3660
|
+
return hAsync("span", { class: `pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}` }, hAsync("slot", { name: "start" }));
|
|
3661
|
+
}
|
|
3662
|
+
return null;
|
|
3663
|
+
}
|
|
3664
|
+
renderEndContent() {
|
|
3665
|
+
if (this.iconOnly) {
|
|
3666
|
+
return null;
|
|
3667
|
+
}
|
|
3668
|
+
if (this.variant === 'disclosure') {
|
|
3669
|
+
return (hAsync("pds-icon", { class: this.loading ? 'pds-button__icon--hidden' : '', icon: caretDown, part: "caret", "aria-hidden": "true" }));
|
|
3670
|
+
}
|
|
3671
|
+
else if (this.hasSlotContent('end')) {
|
|
3672
|
+
return hAsync("span", { class: `pds-button__icon ${this.loading ? 'pds-button__icon--hidden' : ''}` }, hAsync("slot", { name: "end" }));
|
|
3673
|
+
}
|
|
3674
|
+
return null;
|
|
3675
|
+
}
|
|
3471
3676
|
render() {
|
|
3472
3677
|
// Common props for both button and anchor elements
|
|
3473
3678
|
const commonProps = {
|
|
@@ -3483,9 +3688,7 @@ class PdsButton {
|
|
|
3483
3688
|
const ContentElement = this.href ? 'a' : 'button';
|
|
3484
3689
|
// Hide text when loading or iconOnly is true
|
|
3485
3690
|
const hideText = this.loading || this.iconOnly;
|
|
3486
|
-
const content = (hAsync("div", { class: "pds-button__content", part: "button-content" }, this.
|
|
3487
|
-
hAsync("pds-icon", { class: this.loading ? 'pds-button__icon--hidden' : '', name: this.icon, part: "icon", "aria-hidden": "true" }), hAsync("span", { class: `pds-button__text ${hideText ? 'pds-button__text--hidden' : ''}`, part: "button-text" }, hAsync("slot", null)), this.loading && (hAsync("span", { class: "pds-button__loader" }, hAsync("pds-loader", { "is-loading": true, size: "var(--pine-font-size-body-2xl)", variant: "spinner" }, "Loading..."))), this.variant === 'disclosure' &&
|
|
3488
|
-
hAsync("pds-icon", { class: this.loading ? 'pds-button__icon--hidden' : '', icon: caretDown, part: "caret", "aria-hidden": "true" })));
|
|
3691
|
+
const content = (hAsync("div", { class: "pds-button__content", part: "button-content" }, this.renderStartContent(), hAsync("span", { class: `pds-button__text ${hideText ? 'pds-button__text--hidden' : ''}`, part: "button-text" }, hAsync("slot", null)), this.loading && (hAsync("span", { class: "pds-button__loader" }, hAsync("pds-loader", { "is-loading": true, size: "var(--pine-font-size-body-2xl)", variant: "spinner" }, "Loading..."))), this.renderEndContent()));
|
|
3489
3692
|
return (hAsync(Host, { "aria-disabled": this.disabled ? 'true' : null, id: this.componentId, onClick: this.handleClick, variant: this.variant }, hAsync(ContentElement, Object.assign({}, attributes()), content)));
|
|
3490
3693
|
}
|
|
3491
3694
|
get el() { return getElement(this); }
|
|
@@ -3541,6 +3744,87 @@ const isRequired = (target, component) => {
|
|
|
3541
3744
|
}
|
|
3542
3745
|
};
|
|
3543
3746
|
|
|
3747
|
+
/**
|
|
3748
|
+
* Inherit attributes from the host element
|
|
3749
|
+
* @param el - Host element
|
|
3750
|
+
* @param attributes - Array of attributes to inherit
|
|
3751
|
+
*/
|
|
3752
|
+
const inheritAttributes$1 = (el, attributes = []) => {
|
|
3753
|
+
const attributeObject = {};
|
|
3754
|
+
attributes.forEach((attr) => {
|
|
3755
|
+
if (el.hasAttribute(attr)) {
|
|
3756
|
+
const value = el.getAttribute(attr);
|
|
3757
|
+
if (value !== null) {
|
|
3758
|
+
attributeObject[attr] = el.getAttribute(attr);
|
|
3759
|
+
}
|
|
3760
|
+
el.removeAttribute(attr);
|
|
3761
|
+
}
|
|
3762
|
+
});
|
|
3763
|
+
return attributeObject;
|
|
3764
|
+
};
|
|
3765
|
+
/**
|
|
3766
|
+
* List of available ARIA attributes + `role`.
|
|
3767
|
+
* Removed deprecated attributes.
|
|
3768
|
+
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes
|
|
3769
|
+
*/
|
|
3770
|
+
const ariaAttributes = [
|
|
3771
|
+
'role',
|
|
3772
|
+
'aria-activedescendant',
|
|
3773
|
+
'aria-atomic',
|
|
3774
|
+
'aria-autocomplete',
|
|
3775
|
+
'aria-braillelabel',
|
|
3776
|
+
'aria-brailleroledescription',
|
|
3777
|
+
'aria-busy',
|
|
3778
|
+
'aria-checked',
|
|
3779
|
+
'aria-colcount',
|
|
3780
|
+
'aria-colindex',
|
|
3781
|
+
'aria-colindextext',
|
|
3782
|
+
'aria-colspan',
|
|
3783
|
+
'aria-controls',
|
|
3784
|
+
'aria-current',
|
|
3785
|
+
'aria-describedby',
|
|
3786
|
+
'aria-description',
|
|
3787
|
+
'aria-details',
|
|
3788
|
+
'aria-disabled',
|
|
3789
|
+
'aria-errormessage',
|
|
3790
|
+
'aria-expanded',
|
|
3791
|
+
'aria-flowto',
|
|
3792
|
+
'aria-haspopup',
|
|
3793
|
+
'aria-hidden',
|
|
3794
|
+
'aria-invalid',
|
|
3795
|
+
'aria-keyshortcuts',
|
|
3796
|
+
'aria-label',
|
|
3797
|
+
'aria-labelledby',
|
|
3798
|
+
'aria-level',
|
|
3799
|
+
'aria-live',
|
|
3800
|
+
'aria-multiline',
|
|
3801
|
+
'aria-multiselectable',
|
|
3802
|
+
'aria-orientation',
|
|
3803
|
+
'aria-owns',
|
|
3804
|
+
'aria-placeholder',
|
|
3805
|
+
'aria-posinset',
|
|
3806
|
+
'aria-pressed',
|
|
3807
|
+
'aria-readonly',
|
|
3808
|
+
'aria-relevant',
|
|
3809
|
+
'aria-required',
|
|
3810
|
+
'aria-roledescription',
|
|
3811
|
+
'aria-rowcount',
|
|
3812
|
+
'aria-rowindex',
|
|
3813
|
+
'aria-rowindextext',
|
|
3814
|
+
'aria-rowspan',
|
|
3815
|
+
'aria-selected',
|
|
3816
|
+
'aria-setsize',
|
|
3817
|
+
'aria-sort',
|
|
3818
|
+
'aria-valuemax',
|
|
3819
|
+
'aria-valuemin',
|
|
3820
|
+
'aria-valuenow',
|
|
3821
|
+
'aria-valuetext',
|
|
3822
|
+
];
|
|
3823
|
+
const inheritAriaAttributes = (el, ignoreList) => {
|
|
3824
|
+
let attributesToInherit = ariaAttributes;
|
|
3825
|
+
return inheritAttributes$1(el, attributesToInherit);
|
|
3826
|
+
};
|
|
3827
|
+
|
|
3544
3828
|
const labelCss$5 = ":host{display:inline-block}:host([aria-disabled=true]) label{color:var(--pine-color-text-label-disabled)}:host([aria-readonly=true]) label{color:var(--pine-color-text-label-readonly)}label{color:var(--pine-color-text-label);font:var(--pine-typography-body-medium);letter-spacing:var(--pine-letter-spacing)}";
|
|
3545
3829
|
|
|
3546
3830
|
const pdsCheckboxCss = ":host{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-flow:row wrap;flex-flow:row wrap}:host(.is-invalid) input{border-color:var(--pine-color-border-danger)}:host(.is-invalid) input:checked{background:var(--pine-color-danger)}:host(.is-invalid) input:checked:hover{background:var(--pine-color-danger-hover);border-color:var(--pine-color-border-danger-hover)}:host(.is-invalid) input:focus-visible{outline-color:var(--pine-color-focus-ring-danger)}:host(.is-invalid) label,:host(.is-invalid) .pds-checkbox__message--error{color:var(--pine-color-text-message-danger)}:host(.is-indeterminate) input{background:var(--pine-color-accent);border-color:var(--pine-color-accent)}:host(.is-indeterminate) input:hover{background:var(--pine-color-accent);border-color:var(--pine-color-accent-hover)}:host(.is-indeterminate) input::after{border:1px solid var(--pine-color-secondary);-webkit-border-after:var(--pine-border-width-none);border-block-end:var(--pine-border-width-none);-webkit-border-before:var(--pine-border-width-none);border-block-start:var(--pine-border-width-none);-webkit-border-start:var(--pine-border-width-none);border-inline-start:var(--pine-border-width-none);content:\"\";display:block;height:7px;left:50%;position:absolute;top:50%;-webkit-transform:rotate(90deg) translate3d(-103%, 32%, 0);transform:rotate(90deg) translate3d(-103%, 32%, 0);width:4px}input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pine-color-background-container);border:var(--pine-border);border-radius:var(--pine-dimension-2xs);-ms-flex:none;flex:none;height:var(--pine-dimension-sm);margin:0;-webkit-margin-before:var(--pine-dimension-025);margin-block-start:var(--pine-dimension-025);position:relative;width:var(--pine-dimension-sm)}input:hover{background:var(--pine-color-background-container-hover);border:var(--pine-border-hover)}input:checked{background:var(--pine-color-accent);border-color:var(--pine-color-accent)}input:checked:hover{background:var(--pine-color-accent-hover);border-color:var(--pine-color-accent-hover)}input:checked::after{border:1px solid var(--pine-color-secondary);-webkit-border-before:var(--pine-border-width-none);border-block-start:var(--pine-border-width-none);-webkit-border-start:var(--pine-border-width-none);border-inline-start:var(--pine-border-width-none);content:\"\";display:block;height:7px;left:50%;position:absolute;top:50%;-webkit-transform:rotate(43deg) translate3d(-110%, -30%, 0);transform:rotate(43deg) translate3d(-110%, -30%, 0);width:4px}input:disabled{background:var(--pine-color-background-container-disabled);border-color:var(--pine-color-border-disabled);cursor:not-allowed}input:disabled:checked{background:var(--pine-color-background-container-disabled);border-color:var(--pine-color-border-disabled)}input:disabled:checked::after{border-color:var(--pine-color-grey-300)}input:disabled+label{cursor:not-allowed}input:disabled~.pds-checkbox__message{color:var(--pine-color-text-disabled)}input:focus-visible{outline:var(--pine-outline-focus)}label{display:-ms-flexbox;display:flex;gap:var(--pine-dimension-xs)}.visually-hidden{border:0;clip:rect(0 0 0 0);-webkit-clip-path:polygon(0 0, 0 0, 0 0);clip-path:polygon(0 0, 0 0, 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pds-checkbox__message{color:var(--pine-color-text-message);-webkit-margin-before:6px;margin-block-start:6px;-webkit-margin-start:var(--pine-dimension-md);margin-inline-start:var(--pine-dimension-md);width:100%}.pds-checkbox__message--error{display:-ms-flexbox;display:flex;font-size:var(--pine-font-size-085);gap:var(--pine-dimension-050)}.pds-checkbox__message--error pds-icon{-webkit-margin-before:var(--pine-dimension-025);margin-block-start:var(--pine-dimension-025)}";
|
|
@@ -3550,6 +3834,7 @@ class PdsCheckbox {
|
|
|
3550
3834
|
registerInstance(this, hostRef);
|
|
3551
3835
|
this.pdsCheckboxChange = createEvent(this, "pdsCheckboxChange");
|
|
3552
3836
|
this.pdsCheckboxInput = createEvent(this, "pdsCheckboxInput");
|
|
3837
|
+
this.inheritedAttributes = {};
|
|
3553
3838
|
/**
|
|
3554
3839
|
* It determines whether or not the checkbox is checked.
|
|
3555
3840
|
*/
|
|
@@ -3588,11 +3873,15 @@ class PdsCheckbox {
|
|
|
3588
3873
|
}
|
|
3589
3874
|
return classNames.join(' ');
|
|
3590
3875
|
}
|
|
3876
|
+
componentWillLoad() {
|
|
3877
|
+
this.inheritedAttributes = Object.assign({}, inheritAriaAttributes(this.el));
|
|
3878
|
+
}
|
|
3591
3879
|
render() {
|
|
3592
|
-
return (hAsync(Host, { key: '
|
|
3593
|
-
hAsync("div", { key: '
|
|
3594
|
-
hAsync("div", { key: '
|
|
3880
|
+
return (hAsync(Host, { key: 'a60ffb7c96f1d15735f263cb55cd982fbfcbe729', class: this.classNames() }, hAsync("label", { key: '6ed2c8670cded5165761374362d9f1e9f386a4d2', htmlFor: this.componentId }, hAsync("input", Object.assign({ key: '0661b30a9af3bd8ee83b2f3ceb249810a78f19a5', type: "checkbox", "aria-describedby": assignDescription(this.componentId, this.invalid, this.errorMessage || this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, id: this.componentId, indeterminate: this.indeterminate, name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onChange: this.handleCheckboxChange, onInput: this.handleInput }, this.inheritedAttributes)), hAsync("span", { key: 'b16d78ead4da7ebdffb0f37127bdacf8b1538f86', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), this.helperMessage &&
|
|
3881
|
+
hAsync("div", { key: '78e88b11ba9e2759264e08ff0ce9e16c9cf67170', class: 'pds-checkbox__message', id: messageId(this.componentId, 'helper') }, this.helperMessage), this.errorMessage &&
|
|
3882
|
+
hAsync("div", { key: '0ba7d2bd2b4f6c996eecdd103abe3fb6497e4376', class: `pds-checkbox__message pds-checkbox__message--error`, id: messageId(this.componentId, 'error'), "aria-live": "assertive" }, hAsync("pds-icon", { key: '65a94316603638e5230de0644fc8ca60e9543b63', icon: danger, size: "small" }), this.errorMessage)));
|
|
3595
3883
|
}
|
|
3884
|
+
get el() { return getElement(this); }
|
|
3596
3885
|
static get watchers() { return {
|
|
3597
3886
|
"checked": ["updateIndeterminate"]
|
|
3598
3887
|
}; }
|
|
@@ -3674,7 +3963,7 @@ class PdsChip {
|
|
|
3674
3963
|
return chipContent;
|
|
3675
3964
|
}
|
|
3676
3965
|
render() {
|
|
3677
|
-
return (hAsync(Host, { key: '
|
|
3966
|
+
return (hAsync(Host, { key: 'b1987e434a5b9dcc4a5536660822bcb9c1f79e4f', class: this.classNames(), id: this.componentId }, this.setChipContent(), this.variant === 'tag' && (hAsync("button", { key: '8f658cd564e86297a9b988d6080135e6d612be36', class: "pds-chip__close", type: "button", onClick: this.handleCloseClick, "aria-label": "Remove" }, hAsync("pds-icon", { key: '32266c84697e0ffa3ff5d2e554cdf6b7e598d0e6', icon: remove, size: "12px" })))));
|
|
3678
3967
|
}
|
|
3679
3968
|
static get style() { return pdsChipTokensCss + pdsChipCss; }
|
|
3680
3969
|
static get cmpMeta() { return {
|
|
@@ -3693,7 +3982,7 @@ class PdsChip {
|
|
|
3693
3982
|
}; }
|
|
3694
3983
|
}
|
|
3695
3984
|
|
|
3696
|
-
const pdsCopytextCss = ":host(.pds-copytext){--copytext-color-background-hover:var(--pine-color-grey-200)}:host(.pds-copytext) pds-button{-ms-flex-align:center;align-items:center;background:var(--pine-color-secondary);border-radius:var(--pine-border-radius-full);border-width:var(--pine-dimension-none);display:-ms-inline-flexbox;display:inline-flex;font-family:var(--pine-font-family-heading);font-size:var(--pine-font-size-body-md);font-weight:var(--pine-font-weight-body-medium);letter-spacing:var(--pine-letter-spacing);line-height:var(--pine-line-height-body);max-width:100%;padding:var(--pine-dimension-2xs) var(--pine-dimension-xs)}:host(.pds-copytext) pds-button::part(button){-webkit-padding-end:calc(var(--pine-dimension-xs) / 2);padding-inline-end:calc(var(--pine-dimension-xs) / 2)}:host(.pds-copytext) pds-button::part(button):hover{background-color:var(--copytext-color-background-hover);color:var(--pine-color-text-secondary-hover)}:host(.pds-copytext) pds-button span{font-weight:var(--pine-font-weight-medium);-webkit-margin-end:var(--pine-dimension-xs);margin-inline-end:var(--pine-dimension-xs);white-space:nowrap}:host(.pds-copytext) pds-button :nth-child(2){-ms-flex-negative:0;flex-shrink:0}:host(.pds-copytext):host(.pds-copytext--bordered){border-width:var(--pine-dimension-none);padding:var(--pine-dimension-none)}:host(.pds-copytext):host(.pds-copytext--bordered) pds-button{padding:var(--pine-dimension-none)}:host(.pds-copytext):host(.pds-copytext--bordered)::part(button):hover{background-color:transparent}:host(.pds-copytext):host(.pds-copytext--bordered) span{border:var(--pine-border);border-radius:var(--pine-border-radius-full);-webkit-margin-end:var(--pine-dimension-sm);margin-inline-end:var(--pine-dimension-sm);padding-block:var(--pine-dimension-xs);padding-inline:var(--pine-dimension-sm)}:host(.pds-copytext):host(.pds-copytext--bordered) :hover span{border:var(--pine-border-hover)}:host(.pds-copytext):host(.pds-copytext--full-width) pds-button,:host(.pds-copytext):host(.pds-copytext--truncated) pds-button{display:-ms-inline-flexbox;display:inline-flex;min-width:auto;width:100%}:host(.pds-copytext):host(.pds-copytext--full-width) pds-button::part(button-content),:host(.pds-copytext):host(.pds-copytext--full-width) pds-button::part(button-text),:host(.pds-copytext):host(.pds-copytext--truncated) pds-button::part(button-content),:host(.pds-copytext):host(.pds-copytext--truncated) pds-button::part(button-text){-ms-flex-negative:1;flex-shrink:1;width:100%}:host(.pds-copytext):host(.pds-copytext--full-width) pds-button span,:host(.pds-copytext):host(.pds-copytext--truncated) pds-button span{text-align:
|
|
3985
|
+
const pdsCopytextCss = ":host(.pds-copytext){--copytext-color-background-hover:var(--pine-color-grey-200)}:host(.pds-copytext) pds-button{-ms-flex-align:center;align-items:center;background:var(--pine-color-secondary);border-radius:var(--pine-border-radius-full);border-width:var(--pine-dimension-none);display:-ms-inline-flexbox;display:inline-flex;font-family:var(--pine-font-family-heading);font-size:var(--pine-font-size-body-md);font-weight:var(--pine-font-weight-body-medium);letter-spacing:var(--pine-letter-spacing);line-height:var(--pine-line-height-body);max-width:100%;padding:var(--pine-dimension-2xs) var(--pine-dimension-xs)}:host(.pds-copytext) pds-button::part(button){-webkit-padding-end:calc(var(--pine-dimension-xs) / 2);padding-inline-end:calc(var(--pine-dimension-xs) / 2)}:host(.pds-copytext) pds-button::part(button):hover{background-color:var(--copytext-color-background-hover);color:var(--pine-color-text-secondary-hover)}:host(.pds-copytext) pds-button span{font-weight:var(--pine-font-weight-medium);-webkit-margin-end:var(--pine-dimension-xs);margin-inline-end:var(--pine-dimension-xs);white-space:nowrap}:host(.pds-copytext) pds-button :nth-child(2){-ms-flex-negative:0;flex-shrink:0}:host(.pds-copytext):host(.pds-copytext--bordered){border-width:var(--pine-dimension-none);padding:var(--pine-dimension-none)}:host(.pds-copytext):host(.pds-copytext--bordered) pds-button{padding:var(--pine-dimension-none)}:host(.pds-copytext):host(.pds-copytext--bordered)::part(button):hover{background-color:transparent}:host(.pds-copytext):host(.pds-copytext--bordered) span{border:var(--pine-border);border-radius:var(--pine-border-radius-full);-webkit-margin-end:var(--pine-dimension-sm);margin-inline-end:var(--pine-dimension-sm);padding-block:var(--pine-dimension-xs);padding-inline:var(--pine-dimension-sm)}:host(.pds-copytext):host(.pds-copytext--bordered) :hover span{border:var(--pine-border-hover)}:host(.pds-copytext):host(.pds-copytext--full-width) pds-button,:host(.pds-copytext):host(.pds-copytext--truncated) pds-button{display:-ms-inline-flexbox;display:inline-flex;min-width:auto;width:100%}:host(.pds-copytext):host(.pds-copytext--full-width) pds-button::part(button-content),:host(.pds-copytext):host(.pds-copytext--full-width) pds-button::part(button-text),:host(.pds-copytext):host(.pds-copytext--truncated) pds-button::part(button-content),:host(.pds-copytext):host(.pds-copytext--truncated) pds-button::part(button-text){-ms-flex-negative:1;flex-shrink:1;width:100%}:host(.pds-copytext):host(.pds-copytext--full-width) pds-button span,:host(.pds-copytext):host(.pds-copytext--truncated) pds-button span{text-align:start;width:100%}:host(.pds-copytext):host(.pds-copytext--full-width) pds-button{-ms-flex-pack:justify;justify-content:space-between}:host(.pds-copytext):host(.pds-copytext--truncated) pds-button span{overflow:hidden;text-overflow:ellipsis}";
|
|
3697
3986
|
|
|
3698
3987
|
class PdsCopytext {
|
|
3699
3988
|
constructor(hostRef) {
|
|
@@ -3743,7 +4032,7 @@ class PdsCopytext {
|
|
|
3743
4032
|
return classNames.join(' ');
|
|
3744
4033
|
}
|
|
3745
4034
|
render() {
|
|
3746
|
-
return (hAsync(Host, { key: '
|
|
4035
|
+
return (hAsync(Host, { key: '46c38faeba9b70d2e510a4b6af08866577936478', class: this.classNames(), id: this.componentId }, hAsync("pds-button", { key: '6e28c11a9a7a57f4c256b0283b64ec655a897f65', type: "button", variant: "unstyled", onClick: this.handleClick }, hAsync("span", { key: '6818451171f85fd6ad63f07c69871082d3fcba4e' }, this.value), hAsync("pds-icon", { key: '05e683d7b28575d924d6af482e6ce4c3cfee3f05', icon: copy, size: "16px" }))));
|
|
3747
4036
|
}
|
|
3748
4037
|
static get style() { return pdsCopytextCss; }
|
|
3749
4038
|
static get cmpMeta() { return {
|
|
@@ -3785,7 +4074,7 @@ class PdsDivider {
|
|
|
3785
4074
|
return classNames.join(' ');
|
|
3786
4075
|
}
|
|
3787
4076
|
render() {
|
|
3788
|
-
return (hAsync(Host, { key: '
|
|
4077
|
+
return (hAsync(Host, { key: 'ee48ee45e0463abbd3cb7aa686f8d86928830ccb', id: this.componentId }, hAsync("hr", { key: '4af739f85e502a7d9bff1b3581c283cb6ee53a0e', class: this.classNames() })));
|
|
3789
4078
|
}
|
|
3790
4079
|
static get style() { return pdsDividerCss; }
|
|
3791
4080
|
static get cmpMeta() { return {
|
|
@@ -3802,59 +4091,1841 @@ class PdsDivider {
|
|
|
3802
4091
|
}; }
|
|
3803
4092
|
}
|
|
3804
4093
|
|
|
3805
|
-
const getName = (iconName, icon) => {
|
|
3806
|
-
if (!iconName && icon && !isSrc(icon)) {
|
|
3807
|
-
iconName = icon;
|
|
3808
|
-
}
|
|
3809
|
-
if (isStr(iconName)) {
|
|
3810
|
-
iconName = toLower(iconName);
|
|
3811
|
-
}
|
|
3812
|
-
if (!isStr(iconName) || iconName.trim() === '') {
|
|
3813
|
-
return null;
|
|
3814
|
-
}
|
|
3815
|
-
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
|
3816
|
-
if (invalidChars != '') {
|
|
3817
|
-
return null;
|
|
3818
|
-
}
|
|
3819
|
-
return iconName;
|
|
3820
|
-
};
|
|
3821
|
-
const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
|
|
3822
|
-
const isStr = (val) => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3823
|
-
const toLower = (val) => val.toLowerCase();
|
|
3824
4094
|
/**
|
|
3825
|
-
*
|
|
3826
|
-
*
|
|
3827
|
-
* the `title` attribute that developers set directly on `pds-input`. This
|
|
3828
|
-
* helper function should be called in componentWillLoad and assigned to a variable
|
|
3829
|
-
* that is later used in the render function.
|
|
3830
|
-
*
|
|
3831
|
-
* This does not need to be reactive as changing attributes on the host element
|
|
3832
|
-
* does not trigger a re-render.
|
|
4095
|
+
* Custom positioning reference element.
|
|
4096
|
+
* @see https://floating-ui.com/docs/virtual-elements
|
|
3833
4097
|
*/
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
4098
|
+
|
|
4099
|
+
const min = Math.min;
|
|
4100
|
+
const max = Math.max;
|
|
4101
|
+
const round = Math.round;
|
|
4102
|
+
const createCoords = v => ({
|
|
4103
|
+
x: v,
|
|
4104
|
+
y: v
|
|
4105
|
+
});
|
|
4106
|
+
const oppositeSideMap = {
|
|
4107
|
+
left: 'right',
|
|
4108
|
+
right: 'left',
|
|
4109
|
+
bottom: 'top',
|
|
4110
|
+
top: 'bottom'
|
|
4111
|
+
};
|
|
4112
|
+
const oppositeAlignmentMap = {
|
|
4113
|
+
start: 'end',
|
|
4114
|
+
end: 'start'
|
|
3846
4115
|
};
|
|
4116
|
+
function clamp(start, value, end) {
|
|
4117
|
+
return max(start, min(value, end));
|
|
4118
|
+
}
|
|
4119
|
+
function evaluate(value, param) {
|
|
4120
|
+
return typeof value === 'function' ? value(param) : value;
|
|
4121
|
+
}
|
|
4122
|
+
function getSide(placement) {
|
|
4123
|
+
return placement.split('-')[0];
|
|
4124
|
+
}
|
|
4125
|
+
function getAlignment(placement) {
|
|
4126
|
+
return placement.split('-')[1];
|
|
4127
|
+
}
|
|
4128
|
+
function getOppositeAxis(axis) {
|
|
4129
|
+
return axis === 'x' ? 'y' : 'x';
|
|
4130
|
+
}
|
|
4131
|
+
function getAxisLength(axis) {
|
|
4132
|
+
return axis === 'y' ? 'height' : 'width';
|
|
4133
|
+
}
|
|
4134
|
+
function getSideAxis(placement) {
|
|
4135
|
+
return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';
|
|
4136
|
+
}
|
|
4137
|
+
function getAlignmentAxis(placement) {
|
|
4138
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
4139
|
+
}
|
|
4140
|
+
function getAlignmentSides(placement, rects, rtl) {
|
|
4141
|
+
if (rtl === void 0) {
|
|
4142
|
+
rtl = false;
|
|
4143
|
+
}
|
|
4144
|
+
const alignment = getAlignment(placement);
|
|
4145
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
4146
|
+
const length = getAxisLength(alignmentAxis);
|
|
4147
|
+
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
4148
|
+
if (rects.reference[length] > rects.floating[length]) {
|
|
4149
|
+
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
4150
|
+
}
|
|
4151
|
+
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
4152
|
+
}
|
|
4153
|
+
function getExpandedPlacements(placement) {
|
|
4154
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
4155
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
4156
|
+
}
|
|
4157
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
4158
|
+
return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
|
|
4159
|
+
}
|
|
4160
|
+
function getSideList(side, isStart, rtl) {
|
|
4161
|
+
const lr = ['left', 'right'];
|
|
4162
|
+
const rl = ['right', 'left'];
|
|
4163
|
+
const tb = ['top', 'bottom'];
|
|
4164
|
+
const bt = ['bottom', 'top'];
|
|
4165
|
+
switch (side) {
|
|
4166
|
+
case 'top':
|
|
4167
|
+
case 'bottom':
|
|
4168
|
+
if (rtl) return isStart ? rl : lr;
|
|
4169
|
+
return isStart ? lr : rl;
|
|
4170
|
+
case 'left':
|
|
4171
|
+
case 'right':
|
|
4172
|
+
return isStart ? tb : bt;
|
|
4173
|
+
default:
|
|
4174
|
+
return [];
|
|
4175
|
+
}
|
|
4176
|
+
}
|
|
4177
|
+
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
4178
|
+
const alignment = getAlignment(placement);
|
|
4179
|
+
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
4180
|
+
if (alignment) {
|
|
4181
|
+
list = list.map(side => side + "-" + alignment);
|
|
4182
|
+
if (flipAlignment) {
|
|
4183
|
+
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
return list;
|
|
4187
|
+
}
|
|
4188
|
+
function getOppositePlacement(placement) {
|
|
4189
|
+
return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
|
|
4190
|
+
}
|
|
4191
|
+
function expandPaddingObject(padding) {
|
|
4192
|
+
return {
|
|
4193
|
+
top: 0,
|
|
4194
|
+
right: 0,
|
|
4195
|
+
bottom: 0,
|
|
4196
|
+
left: 0,
|
|
4197
|
+
...padding
|
|
4198
|
+
};
|
|
4199
|
+
}
|
|
4200
|
+
function getPaddingObject(padding) {
|
|
4201
|
+
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
4202
|
+
top: padding,
|
|
4203
|
+
right: padding,
|
|
4204
|
+
bottom: padding,
|
|
4205
|
+
left: padding
|
|
4206
|
+
};
|
|
4207
|
+
}
|
|
4208
|
+
function rectToClientRect(rect) {
|
|
4209
|
+
const {
|
|
4210
|
+
x,
|
|
4211
|
+
y,
|
|
4212
|
+
width,
|
|
4213
|
+
height
|
|
4214
|
+
} = rect;
|
|
4215
|
+
return {
|
|
4216
|
+
width,
|
|
4217
|
+
height,
|
|
4218
|
+
top: y,
|
|
4219
|
+
left: x,
|
|
4220
|
+
right: x + width,
|
|
4221
|
+
bottom: y + height,
|
|
4222
|
+
x,
|
|
4223
|
+
y
|
|
4224
|
+
};
|
|
4225
|
+
}
|
|
3847
4226
|
|
|
3848
|
-
|
|
4227
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
4228
|
+
let {
|
|
4229
|
+
reference,
|
|
4230
|
+
floating
|
|
4231
|
+
} = _ref;
|
|
4232
|
+
const sideAxis = getSideAxis(placement);
|
|
4233
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
4234
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
4235
|
+
const side = getSide(placement);
|
|
4236
|
+
const isVertical = sideAxis === 'y';
|
|
4237
|
+
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
4238
|
+
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
4239
|
+
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
4240
|
+
let coords;
|
|
4241
|
+
switch (side) {
|
|
4242
|
+
case 'top':
|
|
4243
|
+
coords = {
|
|
4244
|
+
x: commonX,
|
|
4245
|
+
y: reference.y - floating.height
|
|
4246
|
+
};
|
|
4247
|
+
break;
|
|
4248
|
+
case 'bottom':
|
|
4249
|
+
coords = {
|
|
4250
|
+
x: commonX,
|
|
4251
|
+
y: reference.y + reference.height
|
|
4252
|
+
};
|
|
4253
|
+
break;
|
|
4254
|
+
case 'right':
|
|
4255
|
+
coords = {
|
|
4256
|
+
x: reference.x + reference.width,
|
|
4257
|
+
y: commonY
|
|
4258
|
+
};
|
|
4259
|
+
break;
|
|
4260
|
+
case 'left':
|
|
4261
|
+
coords = {
|
|
4262
|
+
x: reference.x - floating.width,
|
|
4263
|
+
y: commonY
|
|
4264
|
+
};
|
|
4265
|
+
break;
|
|
4266
|
+
default:
|
|
4267
|
+
coords = {
|
|
4268
|
+
x: reference.x,
|
|
4269
|
+
y: reference.y
|
|
4270
|
+
};
|
|
4271
|
+
}
|
|
4272
|
+
switch (getAlignment(placement)) {
|
|
4273
|
+
case 'start':
|
|
4274
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
4275
|
+
break;
|
|
4276
|
+
case 'end':
|
|
4277
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
4278
|
+
break;
|
|
4279
|
+
}
|
|
4280
|
+
return coords;
|
|
4281
|
+
}
|
|
3849
4282
|
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
4283
|
+
/**
|
|
4284
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
4285
|
+
* next to a given reference element.
|
|
4286
|
+
*
|
|
4287
|
+
* This export does not have any `platform` interface logic. You will need to
|
|
4288
|
+
* write one for the platform you are using Floating UI with.
|
|
4289
|
+
*/
|
|
4290
|
+
const computePosition$1 = async (reference, floating, config) => {
|
|
4291
|
+
const {
|
|
4292
|
+
placement = 'bottom',
|
|
4293
|
+
strategy = 'absolute',
|
|
4294
|
+
middleware = [],
|
|
4295
|
+
platform
|
|
4296
|
+
} = config;
|
|
4297
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
4298
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
4299
|
+
let rects = await platform.getElementRects({
|
|
4300
|
+
reference,
|
|
4301
|
+
floating,
|
|
4302
|
+
strategy
|
|
4303
|
+
});
|
|
4304
|
+
let {
|
|
4305
|
+
x,
|
|
4306
|
+
y
|
|
4307
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
4308
|
+
let statefulPlacement = placement;
|
|
4309
|
+
let middlewareData = {};
|
|
4310
|
+
let resetCount = 0;
|
|
4311
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
4312
|
+
const {
|
|
4313
|
+
name,
|
|
4314
|
+
fn
|
|
4315
|
+
} = validMiddleware[i];
|
|
4316
|
+
const {
|
|
4317
|
+
x: nextX,
|
|
4318
|
+
y: nextY,
|
|
4319
|
+
data,
|
|
4320
|
+
reset
|
|
4321
|
+
} = await fn({
|
|
4322
|
+
x,
|
|
4323
|
+
y,
|
|
4324
|
+
initialPlacement: placement,
|
|
4325
|
+
placement: statefulPlacement,
|
|
4326
|
+
strategy,
|
|
4327
|
+
middlewareData,
|
|
4328
|
+
rects,
|
|
4329
|
+
platform,
|
|
4330
|
+
elements: {
|
|
4331
|
+
reference,
|
|
4332
|
+
floating
|
|
4333
|
+
}
|
|
4334
|
+
});
|
|
4335
|
+
x = nextX != null ? nextX : x;
|
|
4336
|
+
y = nextY != null ? nextY : y;
|
|
4337
|
+
middlewareData = {
|
|
4338
|
+
...middlewareData,
|
|
4339
|
+
[name]: {
|
|
4340
|
+
...middlewareData[name],
|
|
4341
|
+
...data
|
|
4342
|
+
}
|
|
4343
|
+
};
|
|
4344
|
+
if (reset && resetCount <= 50) {
|
|
4345
|
+
resetCount++;
|
|
4346
|
+
if (typeof reset === 'object') {
|
|
4347
|
+
if (reset.placement) {
|
|
4348
|
+
statefulPlacement = reset.placement;
|
|
4349
|
+
}
|
|
4350
|
+
if (reset.rects) {
|
|
4351
|
+
rects = reset.rects === true ? await platform.getElementRects({
|
|
4352
|
+
reference,
|
|
4353
|
+
floating,
|
|
4354
|
+
strategy
|
|
4355
|
+
}) : reset.rects;
|
|
4356
|
+
}
|
|
4357
|
+
({
|
|
4358
|
+
x,
|
|
4359
|
+
y
|
|
4360
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
4361
|
+
}
|
|
4362
|
+
i = -1;
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
return {
|
|
4366
|
+
x,
|
|
4367
|
+
y,
|
|
4368
|
+
placement: statefulPlacement,
|
|
4369
|
+
strategy,
|
|
4370
|
+
middlewareData
|
|
4371
|
+
};
|
|
4372
|
+
};
|
|
4373
|
+
|
|
4374
|
+
/**
|
|
4375
|
+
* Resolves with an object of overflow side offsets that determine how much the
|
|
4376
|
+
* element is overflowing a given clipping boundary on each side.
|
|
4377
|
+
* - positive = overflowing the boundary by that number of pixels
|
|
4378
|
+
* - negative = how many pixels left before it will overflow
|
|
4379
|
+
* - 0 = lies flush with the boundary
|
|
4380
|
+
* @see https://floating-ui.com/docs/detectOverflow
|
|
4381
|
+
*/
|
|
4382
|
+
async function detectOverflow(state, options) {
|
|
4383
|
+
var _await$platform$isEle;
|
|
4384
|
+
if (options === void 0) {
|
|
4385
|
+
options = {};
|
|
4386
|
+
}
|
|
4387
|
+
const {
|
|
4388
|
+
x,
|
|
4389
|
+
y,
|
|
4390
|
+
platform,
|
|
4391
|
+
rects,
|
|
4392
|
+
elements,
|
|
4393
|
+
strategy
|
|
4394
|
+
} = state;
|
|
4395
|
+
const {
|
|
4396
|
+
boundary = 'clippingAncestors',
|
|
4397
|
+
rootBoundary = 'viewport',
|
|
4398
|
+
elementContext = 'floating',
|
|
4399
|
+
altBoundary = false,
|
|
4400
|
+
padding = 0
|
|
4401
|
+
} = evaluate(options, state);
|
|
4402
|
+
const paddingObject = getPaddingObject(padding);
|
|
4403
|
+
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
4404
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
4405
|
+
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
4406
|
+
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
4407
|
+
boundary,
|
|
4408
|
+
rootBoundary,
|
|
4409
|
+
strategy
|
|
4410
|
+
}));
|
|
4411
|
+
const rect = elementContext === 'floating' ? {
|
|
4412
|
+
x,
|
|
4413
|
+
y,
|
|
4414
|
+
width: rects.floating.width,
|
|
4415
|
+
height: rects.floating.height
|
|
4416
|
+
} : rects.reference;
|
|
4417
|
+
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
4418
|
+
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
4419
|
+
x: 1,
|
|
4420
|
+
y: 1
|
|
4421
|
+
} : {
|
|
4422
|
+
x: 1,
|
|
4423
|
+
y: 1
|
|
4424
|
+
};
|
|
4425
|
+
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
4426
|
+
elements,
|
|
4427
|
+
rect,
|
|
4428
|
+
offsetParent,
|
|
4429
|
+
strategy
|
|
4430
|
+
}) : rect);
|
|
4431
|
+
return {
|
|
4432
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
4433
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
4434
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
4435
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
4436
|
+
};
|
|
4437
|
+
}
|
|
4438
|
+
|
|
4439
|
+
/**
|
|
4440
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
4441
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
4442
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
4443
|
+
* @see https://floating-ui.com/docs/flip
|
|
4444
|
+
*/
|
|
4445
|
+
const flip$1 = function (options) {
|
|
4446
|
+
if (options === void 0) {
|
|
4447
|
+
options = {};
|
|
4448
|
+
}
|
|
4449
|
+
return {
|
|
4450
|
+
name: 'flip',
|
|
4451
|
+
options,
|
|
4452
|
+
async fn(state) {
|
|
4453
|
+
var _middlewareData$arrow, _middlewareData$flip;
|
|
4454
|
+
const {
|
|
4455
|
+
placement,
|
|
4456
|
+
middlewareData,
|
|
4457
|
+
rects,
|
|
4458
|
+
initialPlacement,
|
|
4459
|
+
platform,
|
|
4460
|
+
elements
|
|
4461
|
+
} = state;
|
|
4462
|
+
const {
|
|
4463
|
+
mainAxis: checkMainAxis = true,
|
|
4464
|
+
crossAxis: checkCrossAxis = true,
|
|
4465
|
+
fallbackPlacements: specifiedFallbackPlacements,
|
|
4466
|
+
fallbackStrategy = 'bestFit',
|
|
4467
|
+
fallbackAxisSideDirection = 'none',
|
|
4468
|
+
flipAlignment = true,
|
|
4469
|
+
...detectOverflowOptions
|
|
4470
|
+
} = evaluate(options, state);
|
|
4471
|
+
|
|
4472
|
+
// If a reset by the arrow was caused due to an alignment offset being
|
|
4473
|
+
// added, we should skip any logic now since `flip()` has already done its
|
|
4474
|
+
// work.
|
|
4475
|
+
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
4476
|
+
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
4477
|
+
return {};
|
|
4478
|
+
}
|
|
4479
|
+
const side = getSide(placement);
|
|
4480
|
+
const initialSideAxis = getSideAxis(initialPlacement);
|
|
4481
|
+
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
4482
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
4483
|
+
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
4484
|
+
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
4485
|
+
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
4486
|
+
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
4487
|
+
}
|
|
4488
|
+
const placements = [initialPlacement, ...fallbackPlacements];
|
|
4489
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
4490
|
+
const overflows = [];
|
|
4491
|
+
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
4492
|
+
if (checkMainAxis) {
|
|
4493
|
+
overflows.push(overflow[side]);
|
|
4494
|
+
}
|
|
4495
|
+
if (checkCrossAxis) {
|
|
4496
|
+
const sides = getAlignmentSides(placement, rects, rtl);
|
|
4497
|
+
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
4498
|
+
}
|
|
4499
|
+
overflowsData = [...overflowsData, {
|
|
4500
|
+
placement,
|
|
4501
|
+
overflows
|
|
4502
|
+
}];
|
|
4503
|
+
|
|
4504
|
+
// One or more sides is overflowing.
|
|
4505
|
+
if (!overflows.every(side => side <= 0)) {
|
|
4506
|
+
var _middlewareData$flip2, _overflowsData$filter;
|
|
4507
|
+
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
4508
|
+
const nextPlacement = placements[nextIndex];
|
|
4509
|
+
if (nextPlacement) {
|
|
4510
|
+
var _overflowsData$;
|
|
4511
|
+
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
4512
|
+
const hasInitialMainAxisOverflow = ((_overflowsData$ = overflowsData[0]) == null ? void 0 : _overflowsData$.overflows[0]) > 0;
|
|
4513
|
+
if (!ignoreCrossAxisOverflow || hasInitialMainAxisOverflow) {
|
|
4514
|
+
// Try next placement and re-run the lifecycle.
|
|
4515
|
+
return {
|
|
4516
|
+
data: {
|
|
4517
|
+
index: nextIndex,
|
|
4518
|
+
overflows: overflowsData
|
|
4519
|
+
},
|
|
4520
|
+
reset: {
|
|
4521
|
+
placement: nextPlacement
|
|
4522
|
+
}
|
|
4523
|
+
};
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4526
|
+
|
|
4527
|
+
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
4528
|
+
// then find the placement that fits the best on the main crossAxis side.
|
|
4529
|
+
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
4530
|
+
|
|
4531
|
+
// Otherwise fallback.
|
|
4532
|
+
if (!resetPlacement) {
|
|
4533
|
+
switch (fallbackStrategy) {
|
|
4534
|
+
case 'bestFit':
|
|
4535
|
+
{
|
|
4536
|
+
var _overflowsData$filter2;
|
|
4537
|
+
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
4538
|
+
if (hasFallbackAxisSideDirection) {
|
|
4539
|
+
const currentSideAxis = getSideAxis(d.placement);
|
|
4540
|
+
return currentSideAxis === initialSideAxis ||
|
|
4541
|
+
// Create a bias to the `y` side axis due to horizontal
|
|
4542
|
+
// reading directions favoring greater width.
|
|
4543
|
+
currentSideAxis === 'y';
|
|
4544
|
+
}
|
|
4545
|
+
return true;
|
|
4546
|
+
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
4547
|
+
if (placement) {
|
|
4548
|
+
resetPlacement = placement;
|
|
4549
|
+
}
|
|
4550
|
+
break;
|
|
4551
|
+
}
|
|
4552
|
+
case 'initialPlacement':
|
|
4553
|
+
resetPlacement = initialPlacement;
|
|
4554
|
+
break;
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
if (placement !== resetPlacement) {
|
|
4558
|
+
return {
|
|
4559
|
+
reset: {
|
|
4560
|
+
placement: resetPlacement
|
|
4561
|
+
}
|
|
4562
|
+
};
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
return {};
|
|
4566
|
+
}
|
|
4567
|
+
};
|
|
4568
|
+
};
|
|
4569
|
+
|
|
4570
|
+
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
4571
|
+
// Derivable.
|
|
4572
|
+
|
|
4573
|
+
async function convertValueToCoords(state, options) {
|
|
4574
|
+
const {
|
|
4575
|
+
placement,
|
|
4576
|
+
platform,
|
|
4577
|
+
elements
|
|
4578
|
+
} = state;
|
|
4579
|
+
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
4580
|
+
const side = getSide(placement);
|
|
4581
|
+
const alignment = getAlignment(placement);
|
|
4582
|
+
const isVertical = getSideAxis(placement) === 'y';
|
|
4583
|
+
const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
|
|
4584
|
+
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
4585
|
+
const rawValue = evaluate(options, state);
|
|
4586
|
+
|
|
4587
|
+
// eslint-disable-next-line prefer-const
|
|
4588
|
+
let {
|
|
4589
|
+
mainAxis,
|
|
4590
|
+
crossAxis,
|
|
4591
|
+
alignmentAxis
|
|
4592
|
+
} = typeof rawValue === 'number' ? {
|
|
4593
|
+
mainAxis: rawValue,
|
|
4594
|
+
crossAxis: 0,
|
|
4595
|
+
alignmentAxis: null
|
|
4596
|
+
} : {
|
|
4597
|
+
mainAxis: rawValue.mainAxis || 0,
|
|
4598
|
+
crossAxis: rawValue.crossAxis || 0,
|
|
4599
|
+
alignmentAxis: rawValue.alignmentAxis
|
|
4600
|
+
};
|
|
4601
|
+
if (alignment && typeof alignmentAxis === 'number') {
|
|
4602
|
+
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
4603
|
+
}
|
|
4604
|
+
return isVertical ? {
|
|
4605
|
+
x: crossAxis * crossAxisMulti,
|
|
4606
|
+
y: mainAxis * mainAxisMulti
|
|
4607
|
+
} : {
|
|
4608
|
+
x: mainAxis * mainAxisMulti,
|
|
4609
|
+
y: crossAxis * crossAxisMulti
|
|
4610
|
+
};
|
|
4611
|
+
}
|
|
4612
|
+
|
|
4613
|
+
/**
|
|
4614
|
+
* Modifies the placement by translating the floating element along the
|
|
4615
|
+
* specified axes.
|
|
4616
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
4617
|
+
* object may be passed.
|
|
4618
|
+
* @see https://floating-ui.com/docs/offset
|
|
4619
|
+
*/
|
|
4620
|
+
const offset$1 = function (options) {
|
|
4621
|
+
if (options === void 0) {
|
|
4622
|
+
options = 0;
|
|
4623
|
+
}
|
|
4624
|
+
return {
|
|
4625
|
+
name: 'offset',
|
|
4626
|
+
options,
|
|
4627
|
+
async fn(state) {
|
|
4628
|
+
var _middlewareData$offse, _middlewareData$arrow;
|
|
4629
|
+
const {
|
|
4630
|
+
x,
|
|
4631
|
+
y,
|
|
4632
|
+
placement,
|
|
4633
|
+
middlewareData
|
|
4634
|
+
} = state;
|
|
4635
|
+
const diffCoords = await convertValueToCoords(state, options);
|
|
4636
|
+
|
|
4637
|
+
// If the placement is the same and the arrow caused an alignment offset
|
|
4638
|
+
// then we don't need to change the positioning coordinates.
|
|
4639
|
+
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
4640
|
+
return {};
|
|
4641
|
+
}
|
|
4642
|
+
return {
|
|
4643
|
+
x: x + diffCoords.x,
|
|
4644
|
+
y: y + diffCoords.y,
|
|
4645
|
+
data: {
|
|
4646
|
+
...diffCoords,
|
|
4647
|
+
placement
|
|
4648
|
+
}
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4651
|
+
};
|
|
4652
|
+
};
|
|
4653
|
+
|
|
4654
|
+
/**
|
|
4655
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
4656
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
4657
|
+
* @see https://floating-ui.com/docs/shift
|
|
4658
|
+
*/
|
|
4659
|
+
const shift$1 = function (options) {
|
|
4660
|
+
if (options === void 0) {
|
|
4661
|
+
options = {};
|
|
4662
|
+
}
|
|
4663
|
+
return {
|
|
4664
|
+
name: 'shift',
|
|
4665
|
+
options,
|
|
4666
|
+
async fn(state) {
|
|
4667
|
+
const {
|
|
4668
|
+
x,
|
|
4669
|
+
y,
|
|
4670
|
+
placement
|
|
4671
|
+
} = state;
|
|
4672
|
+
const {
|
|
4673
|
+
mainAxis: checkMainAxis = true,
|
|
4674
|
+
crossAxis: checkCrossAxis = false,
|
|
4675
|
+
limiter = {
|
|
4676
|
+
fn: _ref => {
|
|
4677
|
+
let {
|
|
4678
|
+
x,
|
|
4679
|
+
y
|
|
4680
|
+
} = _ref;
|
|
4681
|
+
return {
|
|
4682
|
+
x,
|
|
4683
|
+
y
|
|
4684
|
+
};
|
|
4685
|
+
}
|
|
4686
|
+
},
|
|
4687
|
+
...detectOverflowOptions
|
|
4688
|
+
} = evaluate(options, state);
|
|
4689
|
+
const coords = {
|
|
4690
|
+
x,
|
|
4691
|
+
y
|
|
4692
|
+
};
|
|
4693
|
+
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
4694
|
+
const crossAxis = getSideAxis(getSide(placement));
|
|
4695
|
+
const mainAxis = getOppositeAxis(crossAxis);
|
|
4696
|
+
let mainAxisCoord = coords[mainAxis];
|
|
4697
|
+
let crossAxisCoord = coords[crossAxis];
|
|
4698
|
+
if (checkMainAxis) {
|
|
4699
|
+
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
4700
|
+
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
4701
|
+
const min = mainAxisCoord + overflow[minSide];
|
|
4702
|
+
const max = mainAxisCoord - overflow[maxSide];
|
|
4703
|
+
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
4704
|
+
}
|
|
4705
|
+
if (checkCrossAxis) {
|
|
4706
|
+
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
4707
|
+
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
4708
|
+
const min = crossAxisCoord + overflow[minSide];
|
|
4709
|
+
const max = crossAxisCoord - overflow[maxSide];
|
|
4710
|
+
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
4711
|
+
}
|
|
4712
|
+
const limitedCoords = limiter.fn({
|
|
4713
|
+
...state,
|
|
4714
|
+
[mainAxis]: mainAxisCoord,
|
|
4715
|
+
[crossAxis]: crossAxisCoord
|
|
4716
|
+
});
|
|
4717
|
+
return {
|
|
4718
|
+
...limitedCoords,
|
|
4719
|
+
data: {
|
|
4720
|
+
x: limitedCoords.x - x,
|
|
4721
|
+
y: limitedCoords.y - y,
|
|
4722
|
+
enabled: {
|
|
4723
|
+
[mainAxis]: checkMainAxis,
|
|
4724
|
+
[crossAxis]: checkCrossAxis
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4728
|
+
}
|
|
4729
|
+
};
|
|
4730
|
+
};
|
|
4731
|
+
|
|
4732
|
+
function hasWindow() {
|
|
4733
|
+
return typeof window !== 'undefined';
|
|
4734
|
+
}
|
|
4735
|
+
function getNodeName(node) {
|
|
4736
|
+
if (isNode(node)) {
|
|
4737
|
+
return (node.nodeName || '').toLowerCase();
|
|
4738
|
+
}
|
|
4739
|
+
// Mocked nodes in testing environments may not be instances of Node. By
|
|
4740
|
+
// returning `#document` an infinite loop won't occur.
|
|
4741
|
+
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
4742
|
+
return '#document';
|
|
4743
|
+
}
|
|
4744
|
+
function getWindow(node) {
|
|
4745
|
+
var _node$ownerDocument;
|
|
4746
|
+
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
4747
|
+
}
|
|
4748
|
+
function getDocumentElement(node) {
|
|
4749
|
+
var _ref;
|
|
4750
|
+
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
4751
|
+
}
|
|
4752
|
+
function isNode(value) {
|
|
4753
|
+
if (!hasWindow()) {
|
|
4754
|
+
return false;
|
|
4755
|
+
}
|
|
4756
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
4757
|
+
}
|
|
4758
|
+
function isElement(value) {
|
|
4759
|
+
if (!hasWindow()) {
|
|
4760
|
+
return false;
|
|
4761
|
+
}
|
|
4762
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
4763
|
+
}
|
|
4764
|
+
function isHTMLElement(value) {
|
|
4765
|
+
if (!hasWindow()) {
|
|
4766
|
+
return false;
|
|
4767
|
+
}
|
|
4768
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
4769
|
+
}
|
|
4770
|
+
function isShadowRoot(value) {
|
|
4771
|
+
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
4772
|
+
return false;
|
|
4773
|
+
}
|
|
4774
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
4775
|
+
}
|
|
4776
|
+
function isOverflowElement(element) {
|
|
4777
|
+
const {
|
|
4778
|
+
overflow,
|
|
4779
|
+
overflowX,
|
|
4780
|
+
overflowY,
|
|
4781
|
+
display
|
|
4782
|
+
} = getComputedStyle$1(element);
|
|
4783
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
|
|
4784
|
+
}
|
|
4785
|
+
function isTableElement(element) {
|
|
4786
|
+
return ['table', 'td', 'th'].includes(getNodeName(element));
|
|
4787
|
+
}
|
|
4788
|
+
function isTopLayer(element) {
|
|
4789
|
+
return [':popover-open', ':modal'].some(selector => {
|
|
4790
|
+
try {
|
|
4791
|
+
return element.matches(selector);
|
|
4792
|
+
} catch (e) {
|
|
4793
|
+
return false;
|
|
4794
|
+
}
|
|
4795
|
+
});
|
|
4796
|
+
}
|
|
4797
|
+
function isContainingBlock(elementOrCss) {
|
|
4798
|
+
const webkit = isWebKit();
|
|
4799
|
+
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
4800
|
+
|
|
4801
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
4802
|
+
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
4803
|
+
return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
|
|
4804
|
+
}
|
|
4805
|
+
function getContainingBlock(element) {
|
|
4806
|
+
let currentNode = getParentNode(element);
|
|
4807
|
+
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
4808
|
+
if (isContainingBlock(currentNode)) {
|
|
4809
|
+
return currentNode;
|
|
4810
|
+
} else if (isTopLayer(currentNode)) {
|
|
4811
|
+
return null;
|
|
4812
|
+
}
|
|
4813
|
+
currentNode = getParentNode(currentNode);
|
|
4814
|
+
}
|
|
4815
|
+
return null;
|
|
4816
|
+
}
|
|
4817
|
+
function isWebKit() {
|
|
4818
|
+
if (typeof CSS === 'undefined' || !CSS.supports) return false;
|
|
4819
|
+
return CSS.supports('-webkit-backdrop-filter', 'none');
|
|
4820
|
+
}
|
|
4821
|
+
function isLastTraversableNode(node) {
|
|
4822
|
+
return ['html', 'body', '#document'].includes(getNodeName(node));
|
|
4823
|
+
}
|
|
4824
|
+
function getComputedStyle$1(element) {
|
|
4825
|
+
return getWindow(element).getComputedStyle(element);
|
|
4826
|
+
}
|
|
4827
|
+
function getNodeScroll(element) {
|
|
4828
|
+
if (isElement(element)) {
|
|
4829
|
+
return {
|
|
4830
|
+
scrollLeft: element.scrollLeft,
|
|
4831
|
+
scrollTop: element.scrollTop
|
|
4832
|
+
};
|
|
4833
|
+
}
|
|
4834
|
+
return {
|
|
4835
|
+
scrollLeft: element.scrollX,
|
|
4836
|
+
scrollTop: element.scrollY
|
|
4837
|
+
};
|
|
4838
|
+
}
|
|
4839
|
+
function getParentNode(node) {
|
|
4840
|
+
if (getNodeName(node) === 'html') {
|
|
4841
|
+
return node;
|
|
4842
|
+
}
|
|
4843
|
+
const result =
|
|
4844
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
4845
|
+
node.assignedSlot ||
|
|
4846
|
+
// DOM Element detected.
|
|
4847
|
+
node.parentNode ||
|
|
4848
|
+
// ShadowRoot detected.
|
|
4849
|
+
isShadowRoot(node) && node.host ||
|
|
4850
|
+
// Fallback.
|
|
4851
|
+
getDocumentElement(node);
|
|
4852
|
+
return isShadowRoot(result) ? result.host : result;
|
|
4853
|
+
}
|
|
4854
|
+
function getNearestOverflowAncestor(node) {
|
|
4855
|
+
const parentNode = getParentNode(node);
|
|
4856
|
+
if (isLastTraversableNode(parentNode)) {
|
|
4857
|
+
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
4858
|
+
}
|
|
4859
|
+
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
4860
|
+
return parentNode;
|
|
4861
|
+
}
|
|
4862
|
+
return getNearestOverflowAncestor(parentNode);
|
|
4863
|
+
}
|
|
4864
|
+
function getOverflowAncestors(node, list, traverseIframes) {
|
|
4865
|
+
var _node$ownerDocument2;
|
|
4866
|
+
if (list === void 0) {
|
|
4867
|
+
list = [];
|
|
4868
|
+
}
|
|
4869
|
+
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
4870
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
4871
|
+
const win = getWindow(scrollableAncestor);
|
|
4872
|
+
if (isBody) {
|
|
4873
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], []);
|
|
4874
|
+
}
|
|
4875
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, []));
|
|
4876
|
+
}
|
|
4877
|
+
function getFrameElement(win) {
|
|
4878
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
4879
|
+
}
|
|
4880
|
+
|
|
4881
|
+
function getCssDimensions(element) {
|
|
4882
|
+
const css = getComputedStyle$1(element);
|
|
4883
|
+
// In testing environments, the `width` and `height` properties are empty
|
|
4884
|
+
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
4885
|
+
let width = parseFloat(css.width) || 0;
|
|
4886
|
+
let height = parseFloat(css.height) || 0;
|
|
4887
|
+
const hasOffset = isHTMLElement(element);
|
|
4888
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
4889
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
4890
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
4891
|
+
if (shouldFallback) {
|
|
4892
|
+
width = offsetWidth;
|
|
4893
|
+
height = offsetHeight;
|
|
4894
|
+
}
|
|
4895
|
+
return {
|
|
4896
|
+
width,
|
|
4897
|
+
height,
|
|
4898
|
+
$: shouldFallback
|
|
4899
|
+
};
|
|
4900
|
+
}
|
|
4901
|
+
|
|
4902
|
+
function unwrapElement(element) {
|
|
4903
|
+
return !isElement(element) ? element.contextElement : element;
|
|
4904
|
+
}
|
|
4905
|
+
|
|
4906
|
+
function getScale(element) {
|
|
4907
|
+
const domElement = unwrapElement(element);
|
|
4908
|
+
if (!isHTMLElement(domElement)) {
|
|
4909
|
+
return createCoords(1);
|
|
4910
|
+
}
|
|
4911
|
+
const rect = domElement.getBoundingClientRect();
|
|
4912
|
+
const {
|
|
4913
|
+
width,
|
|
4914
|
+
height,
|
|
4915
|
+
$
|
|
4916
|
+
} = getCssDimensions(domElement);
|
|
4917
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
4918
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
4919
|
+
|
|
4920
|
+
// 0, NaN, or Infinity should always fallback to 1.
|
|
4921
|
+
|
|
4922
|
+
if (!x || !Number.isFinite(x)) {
|
|
4923
|
+
x = 1;
|
|
4924
|
+
}
|
|
4925
|
+
if (!y || !Number.isFinite(y)) {
|
|
4926
|
+
y = 1;
|
|
4927
|
+
}
|
|
4928
|
+
return {
|
|
4929
|
+
x,
|
|
4930
|
+
y
|
|
4931
|
+
};
|
|
4932
|
+
}
|
|
4933
|
+
|
|
4934
|
+
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
4935
|
+
function getVisualOffsets(element) {
|
|
4936
|
+
const win = getWindow(element);
|
|
4937
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
4938
|
+
return noOffsets;
|
|
4939
|
+
}
|
|
4940
|
+
return {
|
|
4941
|
+
x: win.visualViewport.offsetLeft,
|
|
4942
|
+
y: win.visualViewport.offsetTop
|
|
4943
|
+
};
|
|
4944
|
+
}
|
|
4945
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
4946
|
+
if (isFixed === void 0) {
|
|
4947
|
+
isFixed = false;
|
|
4948
|
+
}
|
|
4949
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
4950
|
+
return false;
|
|
4951
|
+
}
|
|
4952
|
+
return isFixed;
|
|
4953
|
+
}
|
|
4954
|
+
|
|
4955
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
4956
|
+
if (includeScale === void 0) {
|
|
4957
|
+
includeScale = false;
|
|
4958
|
+
}
|
|
4959
|
+
if (isFixedStrategy === void 0) {
|
|
4960
|
+
isFixedStrategy = false;
|
|
4961
|
+
}
|
|
4962
|
+
const clientRect = element.getBoundingClientRect();
|
|
4963
|
+
const domElement = unwrapElement(element);
|
|
4964
|
+
let scale = createCoords(1);
|
|
4965
|
+
if (includeScale) {
|
|
4966
|
+
if (offsetParent) {
|
|
4967
|
+
if (isElement(offsetParent)) {
|
|
4968
|
+
scale = getScale(offsetParent);
|
|
4969
|
+
}
|
|
4970
|
+
} else {
|
|
4971
|
+
scale = getScale(element);
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
4975
|
+
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
4976
|
+
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
4977
|
+
let width = clientRect.width / scale.x;
|
|
4978
|
+
let height = clientRect.height / scale.y;
|
|
4979
|
+
if (domElement) {
|
|
4980
|
+
const win = getWindow(domElement);
|
|
4981
|
+
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
4982
|
+
let currentWin = win;
|
|
4983
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
4984
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
4985
|
+
const iframeScale = getScale(currentIFrame);
|
|
4986
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
4987
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
4988
|
+
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
4989
|
+
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
4990
|
+
x *= iframeScale.x;
|
|
4991
|
+
y *= iframeScale.y;
|
|
4992
|
+
width *= iframeScale.x;
|
|
4993
|
+
height *= iframeScale.y;
|
|
4994
|
+
x += left;
|
|
4995
|
+
y += top;
|
|
4996
|
+
currentWin = getWindow(currentIFrame);
|
|
4997
|
+
currentIFrame = getFrameElement(currentWin);
|
|
4998
|
+
}
|
|
4999
|
+
}
|
|
5000
|
+
return rectToClientRect({
|
|
5001
|
+
width,
|
|
5002
|
+
height,
|
|
5003
|
+
x,
|
|
5004
|
+
y
|
|
5005
|
+
});
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5008
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
5009
|
+
// incorrect for RTL.
|
|
5010
|
+
function getWindowScrollBarX(element, rect) {
|
|
5011
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
5012
|
+
if (!rect) {
|
|
5013
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
5014
|
+
}
|
|
5015
|
+
return rect.left + leftScroll;
|
|
5016
|
+
}
|
|
5017
|
+
|
|
5018
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
5019
|
+
if (ignoreScrollbarX === void 0) {
|
|
5020
|
+
ignoreScrollbarX = false;
|
|
5021
|
+
}
|
|
5022
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
5023
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
|
|
5024
|
+
// RTL <body> scrollbar.
|
|
5025
|
+
getWindowScrollBarX(documentElement, htmlRect));
|
|
5026
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
5027
|
+
return {
|
|
5028
|
+
x,
|
|
5029
|
+
y
|
|
5030
|
+
};
|
|
5031
|
+
}
|
|
5032
|
+
|
|
5033
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
5034
|
+
let {
|
|
5035
|
+
elements,
|
|
5036
|
+
rect,
|
|
5037
|
+
offsetParent,
|
|
5038
|
+
strategy
|
|
5039
|
+
} = _ref;
|
|
5040
|
+
const isFixed = strategy === 'fixed';
|
|
5041
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
5042
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
5043
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
5044
|
+
return rect;
|
|
5045
|
+
}
|
|
5046
|
+
let scroll = {
|
|
5047
|
+
scrollLeft: 0,
|
|
5048
|
+
scrollTop: 0
|
|
5049
|
+
};
|
|
5050
|
+
let scale = createCoords(1);
|
|
5051
|
+
const offsets = createCoords(0);
|
|
5052
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
5053
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5054
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5055
|
+
scroll = getNodeScroll(offsetParent);
|
|
5056
|
+
}
|
|
5057
|
+
if (isHTMLElement(offsetParent)) {
|
|
5058
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
5059
|
+
scale = getScale(offsetParent);
|
|
5060
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
5061
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
5062
|
+
}
|
|
5063
|
+
}
|
|
5064
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
5065
|
+
return {
|
|
5066
|
+
width: rect.width * scale.x,
|
|
5067
|
+
height: rect.height * scale.y,
|
|
5068
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
5069
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
5070
|
+
};
|
|
5071
|
+
}
|
|
5072
|
+
|
|
5073
|
+
function getClientRects(element) {
|
|
5074
|
+
return Array.from(element.getClientRects());
|
|
5075
|
+
}
|
|
5076
|
+
|
|
5077
|
+
// Gets the entire size of the scrollable document area, even extending outside
|
|
5078
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
5079
|
+
function getDocumentRect(element) {
|
|
5080
|
+
const html = getDocumentElement(element);
|
|
5081
|
+
const scroll = getNodeScroll(element);
|
|
5082
|
+
const body = element.ownerDocument.body;
|
|
5083
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
5084
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
5085
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
5086
|
+
const y = -scroll.scrollTop;
|
|
5087
|
+
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
5088
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
5089
|
+
}
|
|
5090
|
+
return {
|
|
5091
|
+
width,
|
|
5092
|
+
height,
|
|
5093
|
+
x,
|
|
5094
|
+
y
|
|
5095
|
+
};
|
|
5096
|
+
}
|
|
5097
|
+
|
|
5098
|
+
function getViewportRect(element, strategy) {
|
|
5099
|
+
const win = getWindow(element);
|
|
5100
|
+
const html = getDocumentElement(element);
|
|
5101
|
+
const visualViewport = win.visualViewport;
|
|
5102
|
+
let width = html.clientWidth;
|
|
5103
|
+
let height = html.clientHeight;
|
|
5104
|
+
let x = 0;
|
|
5105
|
+
let y = 0;
|
|
5106
|
+
if (visualViewport) {
|
|
5107
|
+
width = visualViewport.width;
|
|
5108
|
+
height = visualViewport.height;
|
|
5109
|
+
const visualViewportBased = isWebKit();
|
|
5110
|
+
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
5111
|
+
x = visualViewport.offsetLeft;
|
|
5112
|
+
y = visualViewport.offsetTop;
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
return {
|
|
5116
|
+
width,
|
|
5117
|
+
height,
|
|
5118
|
+
x,
|
|
5119
|
+
y
|
|
5120
|
+
};
|
|
5121
|
+
}
|
|
5122
|
+
|
|
5123
|
+
// Returns the inner client rect, subtracting scrollbars if present.
|
|
5124
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
5125
|
+
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
5126
|
+
const top = clientRect.top + element.clientTop;
|
|
5127
|
+
const left = clientRect.left + element.clientLeft;
|
|
5128
|
+
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
5129
|
+
const width = element.clientWidth * scale.x;
|
|
5130
|
+
const height = element.clientHeight * scale.y;
|
|
5131
|
+
const x = left * scale.x;
|
|
5132
|
+
const y = top * scale.y;
|
|
5133
|
+
return {
|
|
5134
|
+
width,
|
|
5135
|
+
height,
|
|
5136
|
+
x,
|
|
5137
|
+
y
|
|
5138
|
+
};
|
|
5139
|
+
}
|
|
5140
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
5141
|
+
let rect;
|
|
5142
|
+
if (clippingAncestor === 'viewport') {
|
|
5143
|
+
rect = getViewportRect(element, strategy);
|
|
5144
|
+
} else if (clippingAncestor === 'document') {
|
|
5145
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
5146
|
+
} else if (isElement(clippingAncestor)) {
|
|
5147
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
5148
|
+
} else {
|
|
5149
|
+
const visualOffsets = getVisualOffsets(element);
|
|
5150
|
+
rect = {
|
|
5151
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
5152
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
5153
|
+
width: clippingAncestor.width,
|
|
5154
|
+
height: clippingAncestor.height
|
|
5155
|
+
};
|
|
5156
|
+
}
|
|
5157
|
+
return rectToClientRect(rect);
|
|
5158
|
+
}
|
|
5159
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
5160
|
+
const parentNode = getParentNode(element);
|
|
5161
|
+
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
5162
|
+
return false;
|
|
5163
|
+
}
|
|
5164
|
+
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
5165
|
+
}
|
|
5166
|
+
|
|
5167
|
+
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
5168
|
+
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
5169
|
+
// of the given element up the tree.
|
|
5170
|
+
function getClippingElementAncestors(element, cache) {
|
|
5171
|
+
const cachedResult = cache.get(element);
|
|
5172
|
+
if (cachedResult) {
|
|
5173
|
+
return cachedResult;
|
|
5174
|
+
}
|
|
5175
|
+
let result = getOverflowAncestors(element, []).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
5176
|
+
let currentContainingBlockComputedStyle = null;
|
|
5177
|
+
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
5178
|
+
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
5179
|
+
|
|
5180
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
5181
|
+
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
5182
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
5183
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
5184
|
+
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
5185
|
+
currentContainingBlockComputedStyle = null;
|
|
5186
|
+
}
|
|
5187
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
5188
|
+
if (shouldDropCurrentNode) {
|
|
5189
|
+
// Drop non-containing blocks.
|
|
5190
|
+
result = result.filter(ancestor => ancestor !== currentNode);
|
|
5191
|
+
} else {
|
|
5192
|
+
// Record last containing block for next iteration.
|
|
5193
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
5194
|
+
}
|
|
5195
|
+
currentNode = getParentNode(currentNode);
|
|
5196
|
+
}
|
|
5197
|
+
cache.set(element, result);
|
|
5198
|
+
return result;
|
|
5199
|
+
}
|
|
5200
|
+
|
|
5201
|
+
// Gets the maximum area that the element is visible in due to any number of
|
|
5202
|
+
// clipping ancestors.
|
|
5203
|
+
function getClippingRect(_ref) {
|
|
5204
|
+
let {
|
|
5205
|
+
element,
|
|
5206
|
+
boundary,
|
|
5207
|
+
rootBoundary,
|
|
5208
|
+
strategy
|
|
5209
|
+
} = _ref;
|
|
5210
|
+
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
5211
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
5212
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
5213
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
5214
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
5215
|
+
accRect.top = max(rect.top, accRect.top);
|
|
5216
|
+
accRect.right = min(rect.right, accRect.right);
|
|
5217
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
5218
|
+
accRect.left = max(rect.left, accRect.left);
|
|
5219
|
+
return accRect;
|
|
5220
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
5221
|
+
return {
|
|
5222
|
+
width: clippingRect.right - clippingRect.left,
|
|
5223
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
5224
|
+
x: clippingRect.left,
|
|
5225
|
+
y: clippingRect.top
|
|
5226
|
+
};
|
|
5227
|
+
}
|
|
5228
|
+
|
|
5229
|
+
function getDimensions(element) {
|
|
5230
|
+
const {
|
|
5231
|
+
width,
|
|
5232
|
+
height
|
|
5233
|
+
} = getCssDimensions(element);
|
|
5234
|
+
return {
|
|
5235
|
+
width,
|
|
5236
|
+
height
|
|
5237
|
+
};
|
|
5238
|
+
}
|
|
5239
|
+
|
|
5240
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
5241
|
+
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
5242
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
5243
|
+
const isFixed = strategy === 'fixed';
|
|
5244
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
5245
|
+
let scroll = {
|
|
5246
|
+
scrollLeft: 0,
|
|
5247
|
+
scrollTop: 0
|
|
5248
|
+
};
|
|
5249
|
+
const offsets = createCoords(0);
|
|
5250
|
+
|
|
5251
|
+
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
5252
|
+
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
5253
|
+
function setLeftRTLScrollbarOffset() {
|
|
5254
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
5255
|
+
}
|
|
5256
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5257
|
+
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
5258
|
+
scroll = getNodeScroll(offsetParent);
|
|
5259
|
+
}
|
|
5260
|
+
if (isOffsetParentAnElement) {
|
|
5261
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
5262
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
5263
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
5264
|
+
} else if (documentElement) {
|
|
5265
|
+
setLeftRTLScrollbarOffset();
|
|
5266
|
+
}
|
|
5267
|
+
}
|
|
5268
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
5269
|
+
setLeftRTLScrollbarOffset();
|
|
5270
|
+
}
|
|
5271
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
5272
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
5273
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
5274
|
+
return {
|
|
5275
|
+
x,
|
|
5276
|
+
y,
|
|
5277
|
+
width: rect.width,
|
|
5278
|
+
height: rect.height
|
|
5279
|
+
};
|
|
5280
|
+
}
|
|
5281
|
+
|
|
5282
|
+
function isStaticPositioned(element) {
|
|
5283
|
+
return getComputedStyle$1(element).position === 'static';
|
|
5284
|
+
}
|
|
5285
|
+
|
|
5286
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
5287
|
+
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
5288
|
+
return null;
|
|
5289
|
+
}
|
|
5290
|
+
if (polyfill) {
|
|
5291
|
+
return polyfill(element);
|
|
5292
|
+
}
|
|
5293
|
+
let rawOffsetParent = element.offsetParent;
|
|
5294
|
+
|
|
5295
|
+
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
5296
|
+
// while Chrome and Safari return the <body> element. The <body> element must
|
|
5297
|
+
// be used to perform the correct calculations even if the <html> element is
|
|
5298
|
+
// non-static.
|
|
5299
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
5300
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
5301
|
+
}
|
|
5302
|
+
return rawOffsetParent;
|
|
5303
|
+
}
|
|
5304
|
+
|
|
5305
|
+
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
5306
|
+
// such as table ancestors and cross browser bugs.
|
|
5307
|
+
function getOffsetParent(element, polyfill) {
|
|
5308
|
+
const win = getWindow(element);
|
|
5309
|
+
if (isTopLayer(element)) {
|
|
5310
|
+
return win;
|
|
5311
|
+
}
|
|
5312
|
+
if (!isHTMLElement(element)) {
|
|
5313
|
+
let svgOffsetParent = getParentNode(element);
|
|
5314
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
5315
|
+
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
5316
|
+
return svgOffsetParent;
|
|
5317
|
+
}
|
|
5318
|
+
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
5319
|
+
}
|
|
5320
|
+
return win;
|
|
5321
|
+
}
|
|
5322
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
5323
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
5324
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
5325
|
+
}
|
|
5326
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
5327
|
+
return win;
|
|
5328
|
+
}
|
|
5329
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
5330
|
+
}
|
|
5331
|
+
|
|
5332
|
+
const getElementRects = async function (data) {
|
|
5333
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
5334
|
+
const getDimensionsFn = this.getDimensions;
|
|
5335
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
5336
|
+
return {
|
|
5337
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
5338
|
+
floating: {
|
|
5339
|
+
x: 0,
|
|
5340
|
+
y: 0,
|
|
5341
|
+
width: floatingDimensions.width,
|
|
5342
|
+
height: floatingDimensions.height
|
|
5343
|
+
}
|
|
5344
|
+
};
|
|
5345
|
+
};
|
|
5346
|
+
|
|
5347
|
+
function isRTL$1(element) {
|
|
5348
|
+
return getComputedStyle$1(element).direction === 'rtl';
|
|
5349
|
+
}
|
|
5350
|
+
|
|
5351
|
+
const platform = {
|
|
5352
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
5353
|
+
getDocumentElement,
|
|
5354
|
+
getClippingRect,
|
|
5355
|
+
getOffsetParent,
|
|
5356
|
+
getElementRects,
|
|
5357
|
+
getClientRects,
|
|
5358
|
+
getDimensions,
|
|
5359
|
+
getScale,
|
|
5360
|
+
isElement,
|
|
5361
|
+
isRTL: isRTL$1
|
|
5362
|
+
};
|
|
5363
|
+
|
|
5364
|
+
/**
|
|
5365
|
+
* Modifies the placement by translating the floating element along the
|
|
5366
|
+
* specified axes.
|
|
5367
|
+
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
5368
|
+
* object may be passed.
|
|
5369
|
+
* @see https://floating-ui.com/docs/offset
|
|
5370
|
+
*/
|
|
5371
|
+
const offset = offset$1;
|
|
5372
|
+
|
|
5373
|
+
/**
|
|
5374
|
+
* Optimizes the visibility of the floating element by shifting it in order to
|
|
5375
|
+
* keep it in view when it will overflow the clipping boundary.
|
|
5376
|
+
* @see https://floating-ui.com/docs/shift
|
|
5377
|
+
*/
|
|
5378
|
+
const shift = shift$1;
|
|
5379
|
+
|
|
5380
|
+
/**
|
|
5381
|
+
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
5382
|
+
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
5383
|
+
* clipping boundary. Alternative to `autoPlacement`.
|
|
5384
|
+
* @see https://floating-ui.com/docs/flip
|
|
5385
|
+
*/
|
|
5386
|
+
const flip = flip$1;
|
|
5387
|
+
|
|
5388
|
+
/**
|
|
5389
|
+
* Computes the `x` and `y` coordinates that will place the floating element
|
|
5390
|
+
* next to a given reference element.
|
|
5391
|
+
*/
|
|
5392
|
+
const computePosition = (reference, floating, options) => {
|
|
5393
|
+
// This caches the expensive `getClippingElementAncestors` function so that
|
|
5394
|
+
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
5395
|
+
// single call. If other functions become expensive, we can add them as well.
|
|
5396
|
+
const cache = new Map();
|
|
5397
|
+
const mergedOptions = {
|
|
5398
|
+
platform,
|
|
5399
|
+
...options
|
|
5400
|
+
};
|
|
5401
|
+
const platformWithCache = {
|
|
5402
|
+
...mergedOptions.platform,
|
|
5403
|
+
_c: cache
|
|
5404
|
+
};
|
|
5405
|
+
return computePosition$1(reference, floating, {
|
|
5406
|
+
...mergedOptions,
|
|
5407
|
+
platform: platformWithCache
|
|
5408
|
+
});
|
|
5409
|
+
};
|
|
5410
|
+
|
|
5411
|
+
const pdsDropdownMenuCss = ":host{display:block}.is-hidden{display:none}.pds-dropdown-menu--panel{background-color:var(--pine-color-background-container);left:var(--pine-dimension-none);min-width:170px;padding:var(--pine-dimension-xs);position:absolute;z-index:9999}";
|
|
5412
|
+
|
|
5413
|
+
class PdsDropdownMenu {
|
|
5414
|
+
constructor(hostRef) {
|
|
5415
|
+
registerInstance(this, hostRef);
|
|
5416
|
+
this.isOpen = false;
|
|
5417
|
+
this.menuItems = [];
|
|
5418
|
+
this.currentFocusIndex = -1;
|
|
5419
|
+
/**
|
|
5420
|
+
* The placement of the dropdown panel relative to the trigger.
|
|
5421
|
+
*/
|
|
5422
|
+
this.placement = 'bottom-start';
|
|
5423
|
+
this.handleTriggerSlotChange = (event) => {
|
|
5424
|
+
this.slotEl = event.target;
|
|
5425
|
+
// Get all elements assigned to this slot
|
|
5426
|
+
const assignedElements = this.slotEl.assignedElements();
|
|
5427
|
+
this.triggerEl = assignedElements[0];
|
|
5428
|
+
this.triggerEl.onclick = this.handleClick;
|
|
5429
|
+
// Add accessibility attributes to trigger
|
|
5430
|
+
this.triggerEl.setAttribute('aria-haspopup', 'menu');
|
|
5431
|
+
this.triggerEl.setAttribute('aria-expanded', 'false');
|
|
5432
|
+
};
|
|
5433
|
+
this.handleSlotChange = (event) => {
|
|
5434
|
+
this.slotEl = event.target;
|
|
5435
|
+
// Get all elements assigned to this slot
|
|
5436
|
+
const assignedElements = this.slotEl.assignedElements();
|
|
5437
|
+
// ensure assignedElements only contains pds-dropdown-menu-item or pds-dropdown-menu-separator
|
|
5438
|
+
// if there are other elements, throw an error
|
|
5439
|
+
const invalidElements = assignedElements.filter(el => el.tagName.toLowerCase() !== 'pds-dropdown-menu-item' && el.tagName.toLowerCase() !== 'pds-dropdown-menu-separator');
|
|
5440
|
+
if (invalidElements.length > 0) {
|
|
5441
|
+
throw new Error(`pds-dropdown-menu only accepts pds-dropdown-menu-item and pds-dropdown-menu-separator elements`);
|
|
5442
|
+
}
|
|
5443
|
+
// Store all menu items for keyboard navigation
|
|
5444
|
+
this.menuItems = assignedElements.filter(el => el.tagName.toLowerCase() === 'pds-dropdown-menu-item');
|
|
5445
|
+
};
|
|
5446
|
+
// Toggle dropdown open/closed
|
|
5447
|
+
this.toggleDropdown = () => {
|
|
5448
|
+
this.isOpen = !this.isOpen;
|
|
5449
|
+
if (this.isOpen) {
|
|
5450
|
+
this.openDropdown();
|
|
5451
|
+
}
|
|
5452
|
+
else {
|
|
5453
|
+
this.closeDropdown();
|
|
5454
|
+
}
|
|
5455
|
+
};
|
|
5456
|
+
// Open the dropdown and position it
|
|
5457
|
+
this.openDropdown = () => {
|
|
5458
|
+
var _a;
|
|
5459
|
+
computePosition(this.triggerEl, this.panelEl, {
|
|
5460
|
+
placement: this.placement,
|
|
5461
|
+
middleware: [offset(6), flip(), shift({ padding: 5 })],
|
|
5462
|
+
}).then(({ x, y }) => {
|
|
5463
|
+
Object.assign(this.panelEl.style, {
|
|
5464
|
+
left: `${x}px`,
|
|
5465
|
+
top: `${y}px`,
|
|
5466
|
+
});
|
|
5467
|
+
});
|
|
5468
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('pds-box').classList.remove('is-hidden');
|
|
5469
|
+
this.isOpen = true;
|
|
5470
|
+
// Update ARIA attributes
|
|
5471
|
+
this.triggerEl.setAttribute('aria-expanded', 'true');
|
|
5472
|
+
};
|
|
5473
|
+
// Close the dropdown
|
|
5474
|
+
this.closeDropdown = () => {
|
|
5475
|
+
var _a;
|
|
5476
|
+
(_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('pds-box').classList.add('is-hidden');
|
|
5477
|
+
this.isOpen = false;
|
|
5478
|
+
// Update ARIA attributes
|
|
5479
|
+
this.triggerEl.setAttribute('aria-expanded', 'false');
|
|
5480
|
+
// Reset focus index
|
|
5481
|
+
this.currentFocusIndex = -1;
|
|
5482
|
+
// Return focus to trigger
|
|
5483
|
+
this.triggerEl.focus();
|
|
5484
|
+
};
|
|
5485
|
+
// Handle click on the trigger element
|
|
5486
|
+
this.handleClick = () => {
|
|
5487
|
+
this.toggleDropdown();
|
|
5488
|
+
};
|
|
5489
|
+
}
|
|
5490
|
+
componentDidRender() {
|
|
5491
|
+
var _a;
|
|
5492
|
+
this.panelEl = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('pds-box');
|
|
5493
|
+
}
|
|
5494
|
+
// Get the index of the currently focused menu item
|
|
5495
|
+
getFocusedItemIndex() {
|
|
5496
|
+
const activeElement = document.activeElement;
|
|
5497
|
+
if (!activeElement)
|
|
5498
|
+
return -1;
|
|
5499
|
+
return this.menuItems.findIndex(item => item === activeElement);
|
|
5500
|
+
}
|
|
5501
|
+
// Focus a specific menu item by index
|
|
5502
|
+
focusItemByIndex(index) {
|
|
5503
|
+
var _a, _b, _c, _d;
|
|
5504
|
+
if (index >= 0 && index < this.menuItems.length) {
|
|
5505
|
+
this.currentFocusIndex = index;
|
|
5506
|
+
// Focus the inner button/link instead of the host element
|
|
5507
|
+
const menuItem = this.menuItems[index];
|
|
5508
|
+
const innerButton = (_a = menuItem.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('button');
|
|
5509
|
+
const innerLink = (_d = (_c = (_b = menuItem.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('pds-link')) === null || _c === void 0 ? void 0 : _c.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('a');
|
|
5510
|
+
if (innerButton) {
|
|
5511
|
+
return innerButton.focus();
|
|
5512
|
+
}
|
|
5513
|
+
else if (innerLink) {
|
|
5514
|
+
return innerLink.focus();
|
|
5515
|
+
}
|
|
5516
|
+
else {
|
|
5517
|
+
// Fallback to focusing the host if we can't find the inner element
|
|
5518
|
+
menuItem.focus();
|
|
5519
|
+
}
|
|
5520
|
+
}
|
|
5521
|
+
}
|
|
5522
|
+
// Focus the next menu item
|
|
5523
|
+
focusNextItem() {
|
|
5524
|
+
let nextIndex = (this.currentFocusIndex + 1) % this.menuItems.length;
|
|
5525
|
+
// Skip disabled items
|
|
5526
|
+
let attempts = 0;
|
|
5527
|
+
const maxAttempts = this.menuItems.length;
|
|
5528
|
+
while (attempts < maxAttempts && this.menuItems[nextIndex].disabled) {
|
|
5529
|
+
nextIndex = (nextIndex + 1) % this.menuItems.length;
|
|
5530
|
+
attempts++;
|
|
5531
|
+
}
|
|
5532
|
+
// Only focus if we found a non-disabled item
|
|
5533
|
+
if (attempts < maxAttempts) {
|
|
5534
|
+
this.focusItemByIndex(nextIndex);
|
|
5535
|
+
}
|
|
5536
|
+
}
|
|
5537
|
+
// Focus the previous menu item
|
|
5538
|
+
focusPreviousItem() {
|
|
5539
|
+
let prevIndex = this.currentFocusIndex <= 0
|
|
5540
|
+
? this.menuItems.length - 1
|
|
5541
|
+
: this.currentFocusIndex - 1;
|
|
5542
|
+
// Skip disabled items
|
|
5543
|
+
let attempts = 0;
|
|
5544
|
+
const maxAttempts = this.menuItems.length;
|
|
5545
|
+
while (attempts < maxAttempts && this.menuItems[prevIndex].disabled) {
|
|
5546
|
+
prevIndex = prevIndex <= 0 ? this.menuItems.length - 1 : prevIndex - 1;
|
|
5547
|
+
attempts++;
|
|
5548
|
+
}
|
|
5549
|
+
// Only focus if we found a non-disabled item
|
|
5550
|
+
if (attempts < maxAttempts) {
|
|
5551
|
+
this.focusItemByIndex(prevIndex);
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
// Handle keyboard events for the dropdown
|
|
5555
|
+
handleKeyDown(event) {
|
|
5556
|
+
if (!this.isOpen)
|
|
5557
|
+
return;
|
|
5558
|
+
switch (event.key) {
|
|
5559
|
+
case 'Escape':
|
|
5560
|
+
event.preventDefault();
|
|
5561
|
+
this.closeDropdown();
|
|
5562
|
+
break;
|
|
5563
|
+
case 'ArrowDown':
|
|
5564
|
+
event.preventDefault();
|
|
5565
|
+
this.focusNextItem();
|
|
5566
|
+
break;
|
|
5567
|
+
case 'ArrowUp':
|
|
5568
|
+
event.preventDefault();
|
|
5569
|
+
this.focusPreviousItem();
|
|
5570
|
+
break;
|
|
5571
|
+
case 'Home':
|
|
5572
|
+
event.preventDefault();
|
|
5573
|
+
if (this.menuItems.length > 0) {
|
|
5574
|
+
// Find first non-disabled item
|
|
5575
|
+
let firstIndex = 0;
|
|
5576
|
+
while (firstIndex < this.menuItems.length && this.menuItems[firstIndex].disabled) {
|
|
5577
|
+
firstIndex++;
|
|
5578
|
+
}
|
|
5579
|
+
if (firstIndex < this.menuItems.length) {
|
|
5580
|
+
this.focusItemByIndex(firstIndex);
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5583
|
+
break;
|
|
5584
|
+
case 'End':
|
|
5585
|
+
event.preventDefault();
|
|
5586
|
+
if (this.menuItems.length > 0) {
|
|
5587
|
+
// Find last non-disabled item
|
|
5588
|
+
let lastIndex = this.menuItems.length - 1;
|
|
5589
|
+
while (lastIndex >= 0 && this.menuItems[lastIndex].disabled) {
|
|
5590
|
+
lastIndex--;
|
|
5591
|
+
}
|
|
5592
|
+
if (lastIndex >= 0) {
|
|
5593
|
+
this.focusItemByIndex(lastIndex);
|
|
5594
|
+
}
|
|
5595
|
+
}
|
|
5596
|
+
break;
|
|
5597
|
+
case 'Tab':
|
|
5598
|
+
if (event.shiftKey) {
|
|
5599
|
+
// Let Shift+Tab navigate naturally from first item to trigger
|
|
5600
|
+
// For all other items, move to previous item
|
|
5601
|
+
const currentIndex = this.getFocusedItemIndex();
|
|
5602
|
+
if (currentIndex > 0) {
|
|
5603
|
+
// If not on first item, prevent default and go to previous item
|
|
5604
|
+
event.preventDefault();
|
|
5605
|
+
this.focusPreviousItem(); // Use our method that skips disabled items
|
|
5606
|
+
}
|
|
5607
|
+
// If on first item or no item, let natural tab order move back to trigger
|
|
5608
|
+
}
|
|
5609
|
+
else {
|
|
5610
|
+
// Forward Tab navigation
|
|
5611
|
+
const activeElement = document.activeElement;
|
|
5612
|
+
const isTriggerFocused = activeElement === this.triggerEl;
|
|
5613
|
+
const currentIndex = this.getFocusedItemIndex();
|
|
5614
|
+
if (isTriggerFocused && this.menuItems.length > 0) {
|
|
5615
|
+
// If trigger is focused, move to first non-disabled menu item
|
|
5616
|
+
event.preventDefault();
|
|
5617
|
+
// Find the first non-disabled item
|
|
5618
|
+
let firstFocusableIndex = 0;
|
|
5619
|
+
while (firstFocusableIndex < this.menuItems.length && this.menuItems[firstFocusableIndex].disabled) {
|
|
5620
|
+
firstFocusableIndex++;
|
|
5621
|
+
}
|
|
5622
|
+
if (firstFocusableIndex < this.menuItems.length) {
|
|
5623
|
+
this.focusItemByIndex(firstFocusableIndex);
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5626
|
+
else if (currentIndex === -1 && this.menuItems.length > 0) {
|
|
5627
|
+
// If no menu item is focused, focus the first non-disabled one
|
|
5628
|
+
event.preventDefault();
|
|
5629
|
+
// Find the first non-disabled item
|
|
5630
|
+
let firstFocusableIndex = 0;
|
|
5631
|
+
while (firstFocusableIndex < this.menuItems.length && this.menuItems[firstFocusableIndex].disabled) {
|
|
5632
|
+
firstFocusableIndex++;
|
|
5633
|
+
}
|
|
5634
|
+
if (firstFocusableIndex < this.menuItems.length) {
|
|
5635
|
+
this.focusItemByIndex(firstFocusableIndex);
|
|
5636
|
+
}
|
|
5637
|
+
}
|
|
5638
|
+
else if (currentIndex !== -1) {
|
|
5639
|
+
// Use our method that skips disabled items
|
|
5640
|
+
event.preventDefault();
|
|
5641
|
+
this.focusNextItem();
|
|
5642
|
+
}
|
|
5643
|
+
}
|
|
5644
|
+
break;
|
|
5645
|
+
}
|
|
5646
|
+
}
|
|
5647
|
+
// Handle clicks outside the dropdown to close it
|
|
5648
|
+
handleWindowClick(event) {
|
|
5649
|
+
if (this.isOpen && !this.host.contains(event.target) && event.target !== this.triggerEl) {
|
|
5650
|
+
this.closeDropdown();
|
|
5651
|
+
}
|
|
5652
|
+
}
|
|
5653
|
+
render() {
|
|
5654
|
+
return (hAsync(Host, { key: '492d6a2baba8c0cf5e05a6c34b774900f5da6886', id: this.componentId }, hAsync("slot", { key: '9d57ee287cff289693c941410bcc62bb9fb1da95', name: "trigger", onSlotchange: this.handleTriggerSlotChange }), hAsync("pds-box", { key: '62ae569a3bf7f958c01cfe1a74d174e413763f72', "border-radius": "sm", display: "flex", direction: "column", class: "pds-dropdown-menu--panel is-hidden", shadow: "100", role: "menu", "aria-orientation": "vertical" }, hAsync("slot", { key: 'ea6d26124c06683e4fde23bc29f955cb04468d7a', onSlotchange: this.handleSlotChange }))));
|
|
5655
|
+
}
|
|
5656
|
+
get host() { return getElement(this); }
|
|
5657
|
+
static get style() { return pdsDropdownMenuCss; }
|
|
5658
|
+
static get cmpMeta() { return {
|
|
5659
|
+
"$flags$": 9,
|
|
5660
|
+
"$tagName$": "pds-dropdown-menu",
|
|
5661
|
+
"$members$": {
|
|
5662
|
+
"componentId": [1, "component-id"],
|
|
5663
|
+
"placement": [1],
|
|
5664
|
+
"currentFocusIndex": [32]
|
|
5665
|
+
},
|
|
5666
|
+
"$listeners$": [[8, "keydown", "handleKeyDown"], [8, "click", "handleWindowClick"]],
|
|
5667
|
+
"$lazyBundleId$": "-",
|
|
5668
|
+
"$attrsToReflect$": []
|
|
5669
|
+
}; }
|
|
5670
|
+
}
|
|
5671
|
+
|
|
5672
|
+
const pdsDropdownMenuItemCss = ":host{cursor:pointer;display:-ms-flexbox;display:flex;width:100%;}:host(.is-disabled){cursor:not-allowed !important;opacity:0.5 !important}:host(.is-disabled) .pds-dropdown-menu-item__content{cursor:not-allowed !important;pointer-events:none !important}.pds-dropdown-menu-item__content{-ms-flex-align:center;align-items:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;border-radius:var(--pine-dimension-xs);display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;font:var(--pine-typography-body-medium);gap:var(--pine-dimension-xs);margin:calc(var(--pine-border-width) + 2px);padding:var(--pine-dimension-xs);text-align:start;width:100%;}.pds-dropdown-menu-item__content:hover{background-color:var(--pine-color-grey-150);color:var(--pine-color-text-hover)}.pds-dropdown-menu-item__content:focus,.pds-dropdown-menu-item__content:focus-visible,.pds-dropdown-menu-item__content.has-focus{outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width)}:host(.destructive) .pds-dropdown-menu-item__content{-ms-flex-align:center;align-items:center;color:var(--pine-color-danger)}:host(.destructive) .pds-dropdown-menu-item__content:hover{background-color:var(--pine-color-danger-disabled);color:var(--pine-color-danger-hover)}:host(.destructive) .pds-dropdown-menu-item__content:focus,:host(.destructive) .pds-dropdown-menu-item__content:focus-visible,:host(.destructive) .pds-dropdown-menu-item__content.has-focus{background-color:var(--pine-color-danger-disabled);outline:var(--pine-outline-focus-danger);outline-offset:var(--pine-border-width)}pds-link::part(link):focus,pds-link::part(link):focus-visible{-webkit-box-shadow:none;box-shadow:none;outline:none}pds-link::part(link){display:block;margin-inline:calc(var(--pine-dimension-xs) * -1);padding-inline:var(--pine-dimension-xs);width:100%}";
|
|
5673
|
+
|
|
5674
|
+
class PdsDropdownMenuItem {
|
|
5675
|
+
constructor(hostRef) {
|
|
5676
|
+
registerInstance(this, hostRef);
|
|
5677
|
+
this.pdsClick = createEvent(this, "pdsClick");
|
|
5678
|
+
/**
|
|
5679
|
+
* It determines whether or not the dropdown-item is destructive.
|
|
5680
|
+
* @defaultValue false
|
|
5681
|
+
*/
|
|
5682
|
+
this.destructive = false;
|
|
5683
|
+
/**
|
|
5684
|
+
* It determines whether or not the dropdown-item is disabled.
|
|
5685
|
+
* @defaultValue false
|
|
5686
|
+
*/
|
|
5687
|
+
this.disabled = false;
|
|
5688
|
+
this.hasFocus = false;
|
|
5689
|
+
this.handleFocus = () => {
|
|
5690
|
+
this.hasFocus = true;
|
|
5691
|
+
};
|
|
5692
|
+
this.handleBlur = () => {
|
|
5693
|
+
this.hasFocus = false;
|
|
5694
|
+
};
|
|
5695
|
+
this.handleKeyDown = (event) => {
|
|
5696
|
+
// Handle keyboard events
|
|
5697
|
+
if (!this.disabled && (event.key === 'Enter')) {
|
|
5698
|
+
// Only prevent default for button elements or Space key
|
|
5699
|
+
// For links with Enter key, we want the default navigation behavior
|
|
5700
|
+
if (!this.href) {
|
|
5701
|
+
event.preventDefault();
|
|
5702
|
+
}
|
|
5703
|
+
this.handleClick();
|
|
5704
|
+
}
|
|
5705
|
+
};
|
|
5706
|
+
}
|
|
5707
|
+
/**
|
|
5708
|
+
* Trigger the click event
|
|
5709
|
+
*/
|
|
5710
|
+
async clickItem() {
|
|
5711
|
+
this.handleClick();
|
|
5712
|
+
}
|
|
5713
|
+
;
|
|
5714
|
+
handleClick() {
|
|
5715
|
+
var _a;
|
|
5716
|
+
// Filter only pds-dropdown-menu-item elements and find the index of the current item
|
|
5717
|
+
const menuItems = Array.from(this.host.parentNode.children).filter((child) => child.tagName.toLowerCase() === 'pds-dropdown-menu-item');
|
|
5718
|
+
const itemIndex = menuItems.indexOf(this.host);
|
|
5719
|
+
// Get the text content from the slotted content
|
|
5720
|
+
const content = ((_a = this.host.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
5721
|
+
this.pdsClick.emit({
|
|
5722
|
+
itemIndex,
|
|
5723
|
+
item: this.host,
|
|
5724
|
+
content
|
|
5725
|
+
});
|
|
5726
|
+
}
|
|
5727
|
+
renderElement() {
|
|
5728
|
+
if (this.href !== undefined) {
|
|
5729
|
+
return (hAsync("pds-link", { href: this.disabled ? null : this.href, class: {
|
|
5730
|
+
'pds-dropdown-menu-item__content': true,
|
|
5731
|
+
'has-focus': this.hasFocus
|
|
5732
|
+
}, tabIndex: this.disabled ? -1 : 0, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, "aria-disabled": this.disabled ? 'true' : null }, hAsync("slot", null)));
|
|
5733
|
+
}
|
|
5734
|
+
return (hAsync("button", { class: {
|
|
5735
|
+
'pds-dropdown-menu-item__content': true,
|
|
5736
|
+
'has-focus': this.hasFocus
|
|
5737
|
+
}, tabIndex: this.disabled ? -1 : 0, type: "button", onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur, disabled: this.disabled, "aria-disabled": this.disabled ? 'true' : null }, hAsync("slot", null)));
|
|
5738
|
+
}
|
|
5739
|
+
render() {
|
|
5740
|
+
return (hAsync(Host, { key: 'b27f62c0f1cfe56e777b1a875b93954d4c9da00d', id: this.componentId, class: { 'is-disabled': this.disabled, 'destructive': !this.disabled && this.destructive }, onClick: () => !this.disabled && this.handleClick(), role: "none", tabIndex: -1, "aria-disabled": this.disabled ? 'true' : null }, this.renderElement()));
|
|
5741
|
+
}
|
|
5742
|
+
get host() { return getElement(this); }
|
|
5743
|
+
static get style() { return pdsDropdownMenuItemCss; }
|
|
5744
|
+
static get cmpMeta() { return {
|
|
5745
|
+
"$flags$": 9,
|
|
5746
|
+
"$tagName$": "pds-dropdown-menu-item",
|
|
5747
|
+
"$members$": {
|
|
5748
|
+
"componentId": [1, "component-id"],
|
|
5749
|
+
"destructive": [4],
|
|
5750
|
+
"disabled": [4],
|
|
5751
|
+
"href": [1],
|
|
5752
|
+
"hasFocus": [32],
|
|
5753
|
+
"clickItem": [64]
|
|
5754
|
+
},
|
|
5755
|
+
"$listeners$": undefined,
|
|
5756
|
+
"$lazyBundleId$": "-",
|
|
5757
|
+
"$attrsToReflect$": []
|
|
5758
|
+
}; }
|
|
5759
|
+
}
|
|
5760
|
+
|
|
5761
|
+
const pdsDropdownMenuSeparatorCss = ":host hr{border:1px solid var(--pine-color-border);margin-block:var(--pine-dimension-xs)}";
|
|
5762
|
+
|
|
5763
|
+
class PdsDropdownMenuSeparator {
|
|
5764
|
+
constructor(hostRef) {
|
|
5765
|
+
registerInstance(this, hostRef);
|
|
5766
|
+
/**
|
|
5767
|
+
* It determines whether or not the dropdown-item is disabled.
|
|
5768
|
+
* @defaultValue false
|
|
5769
|
+
*/
|
|
5770
|
+
this.disabled = false;
|
|
5771
|
+
}
|
|
5772
|
+
render() {
|
|
5773
|
+
return (hAsync(Host, { key: '71b19470921b7848e5f0c44ef82aa0d9f8ef2017', id: this.componentId }, hAsync("hr", { key: 'efc84b6b3f3f35421c0af863fb2d4636e542773e' })));
|
|
5774
|
+
}
|
|
5775
|
+
static get style() { return pdsDropdownMenuSeparatorCss; }
|
|
5776
|
+
static get cmpMeta() { return {
|
|
5777
|
+
"$flags$": 9,
|
|
5778
|
+
"$tagName$": "pds-dropdown-menu-separator",
|
|
5779
|
+
"$members$": {
|
|
5780
|
+
"componentId": [1, "component-id"],
|
|
5781
|
+
"disabled": [4]
|
|
5782
|
+
},
|
|
5783
|
+
"$listeners$": undefined,
|
|
5784
|
+
"$lazyBundleId$": "-",
|
|
5785
|
+
"$attrsToReflect$": []
|
|
5786
|
+
}; }
|
|
5787
|
+
}
|
|
5788
|
+
|
|
5789
|
+
const getName = (iconName, icon) => {
|
|
5790
|
+
if (!iconName && icon && !isSrc(icon)) {
|
|
5791
|
+
iconName = icon;
|
|
5792
|
+
}
|
|
5793
|
+
if (isStr(iconName)) {
|
|
5794
|
+
iconName = toLower(iconName);
|
|
5795
|
+
}
|
|
5796
|
+
if (!isStr(iconName) || iconName.trim() === '') {
|
|
5797
|
+
return null;
|
|
5798
|
+
}
|
|
5799
|
+
const invalidChars = iconName.replace(/[a-z]|-|\d/gi, '');
|
|
5800
|
+
if (invalidChars != '') {
|
|
5801
|
+
return null;
|
|
5802
|
+
}
|
|
5803
|
+
return iconName;
|
|
5804
|
+
};
|
|
5805
|
+
/**
|
|
5806
|
+
* Returns `true` if the document or host element
|
|
5807
|
+
* has a `dir` set to `rtl`. The host value will always
|
|
5808
|
+
* take priority over the root document value.
|
|
5809
|
+
*/
|
|
5810
|
+
const isRTL = (hostEl) => {
|
|
5811
|
+
if (hostEl) {
|
|
5812
|
+
if (hostEl.dir !== '') {
|
|
5813
|
+
return hostEl.dir.toLowerCase() === 'rtl';
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
return (document === null || document === void 0 ? void 0 : document.dir.toLowerCase()) === 'rtl';
|
|
5817
|
+
};
|
|
5818
|
+
const isSrc = (str) => str.length > 0 && /(\/|\.)/.test(str);
|
|
5819
|
+
const isStr = (val) => typeof val === 'string'; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
5820
|
+
const toLower = (val) => val.toLowerCase();
|
|
5821
|
+
/**
|
|
5822
|
+
* Elements inside of web components sometimes need to inherit global attributes
|
|
5823
|
+
* set on the host. For example, the inner input in `pds-input` should inherit
|
|
5824
|
+
* the `title` attribute that developers set directly on `pds-input`. This
|
|
5825
|
+
* helper function should be called in componentWillLoad and assigned to a variable
|
|
5826
|
+
* that is later used in the render function.
|
|
5827
|
+
*
|
|
5828
|
+
* This does not need to be reactive as changing attributes on the host element
|
|
5829
|
+
* does not trigger a re-render.
|
|
5830
|
+
*/
|
|
5831
|
+
const inheritAttributes = (el, attributes = []) => {
|
|
5832
|
+
const attributeObject = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
5833
|
+
attributes.forEach(attr => {
|
|
5834
|
+
if (el.hasAttribute(attr)) {
|
|
5835
|
+
const value = el.getAttribute(attr);
|
|
5836
|
+
if (value !== null) {
|
|
5837
|
+
attributeObject[attr] = el.getAttribute(attr);
|
|
5838
|
+
}
|
|
5839
|
+
el.removeAttribute(attr);
|
|
5840
|
+
}
|
|
5841
|
+
});
|
|
5842
|
+
return attributeObject;
|
|
5843
|
+
};
|
|
5844
|
+
/**
|
|
5845
|
+
* Determines if an icon should be flipped when RTL is enabled
|
|
5846
|
+
* @param iconName - The name of the icon to check
|
|
5847
|
+
* @param hostEl - Optional host element to check for RTL direction
|
|
5848
|
+
* @returns {boolean} - True if the icon should be flipped in RTL mode, false otherwise
|
|
5849
|
+
*/
|
|
5850
|
+
const shouldRtlFlipIcon = (iconName, hostEl) => {
|
|
5851
|
+
// First check if we're in RTL mode
|
|
5852
|
+
const rtlEnabled = isRTL(hostEl);
|
|
5853
|
+
// Only flip if we're in RTL mode and the icon is in the flip list
|
|
5854
|
+
return rtlEnabled && ICONS_TO_FLIP.includes(iconName);
|
|
5855
|
+
};
|
|
5856
|
+
/**
|
|
5857
|
+
* Array of available icon names
|
|
5858
|
+
*/
|
|
5859
|
+
const ICONS_TO_FLIP = [
|
|
5860
|
+
'align-horizontal-bottom',
|
|
5861
|
+
'align-horizontal-center',
|
|
5862
|
+
'align-horizontal-top',
|
|
5863
|
+
'align-left',
|
|
5864
|
+
'align-right',
|
|
5865
|
+
'align-vertical-left',
|
|
5866
|
+
'align-vertical-right',
|
|
5867
|
+
'arrow-corner',
|
|
5868
|
+
'arrow-left',
|
|
5869
|
+
'arrow-right',
|
|
5870
|
+
'calendar-schedule',
|
|
5871
|
+
'caret-left',
|
|
5872
|
+
'caret-right',
|
|
5873
|
+
'cart',
|
|
5874
|
+
'cart-add',
|
|
5875
|
+
'comment',
|
|
5876
|
+
'comment-no',
|
|
5877
|
+
'conversation',
|
|
5878
|
+
'copy',
|
|
5879
|
+
'copy-07',
|
|
5880
|
+
'delete-key',
|
|
5881
|
+
'delete-x',
|
|
5882
|
+
'downsell',
|
|
5883
|
+
'drawer-collapse',
|
|
5884
|
+
'drawer-expand',
|
|
5885
|
+
'duplicate',
|
|
5886
|
+
'feedback',
|
|
5887
|
+
'file-lock',
|
|
5888
|
+
'file-search',
|
|
5889
|
+
'form-field',
|
|
5890
|
+
'form-filled',
|
|
5891
|
+
'left-small',
|
|
5892
|
+
'launch',
|
|
5893
|
+
'list-bullet',
|
|
5894
|
+
'list-numbers',
|
|
5895
|
+
'margin-left',
|
|
5896
|
+
'margin-right',
|
|
5897
|
+
'move-left',
|
|
5898
|
+
'move-right',
|
|
5899
|
+
'newsletter-2',
|
|
5900
|
+
'one-off-session',
|
|
5901
|
+
'quote',
|
|
5902
|
+
'redo',
|
|
5903
|
+
'reset-password',
|
|
5904
|
+
'right-small',
|
|
5905
|
+
'send-message',
|
|
5906
|
+
'share',
|
|
5907
|
+
'super-admin',
|
|
5908
|
+
'tablet-landscape',
|
|
5909
|
+
'undo',
|
|
5910
|
+
'user-star',
|
|
5911
|
+
'user-star-filled',
|
|
5912
|
+
'users',
|
|
5913
|
+
'users-filled',
|
|
5914
|
+
'users-tone'
|
|
5915
|
+
];
|
|
5916
|
+
|
|
5917
|
+
const pdsIconCss = ":host{--dimension-icon-height:16px;--dimension-icon-width:16px;--color-icon-fill:currentColor;contain:strict;display:inline-block;fill:var(--color-icon-fill);-ms-flex-negative:0;flex-shrink:0;height:var(--dimension-icon-height);width:var(--dimension-icon-width)}:host .pdsicon{fill:var(--color-icon-fill)}.pds-icon-fill-none{fill:none}.icon-inner,.pds-icon,svg{display:block;height:100%;width:100%}:host(.flip-rtl):host-context([dir=rtl]) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.flip-rtl:dir(rtl)) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.flip-rtl:dir(ltr)) .icon-inner{-webkit-transform:scaleX(1);transform:scaleX(1)}";
|
|
5918
|
+
|
|
5919
|
+
class PdsIcon {
|
|
5920
|
+
constructor(hostRef) {
|
|
5921
|
+
registerInstance(this, hostRef);
|
|
5922
|
+
this.didLoadIcon = false;
|
|
5923
|
+
this.iconName = null;
|
|
5924
|
+
this.inheritedAttributes = {}; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
3854
5925
|
this.isVisible = false;
|
|
3855
5926
|
/**
|
|
3856
5927
|
* The size of the icon. This can be
|
|
3857
|
-
* 'small', 'regular', 'medium', large, or a
|
|
5928
|
+
* 'small', 'regular', 'medium', 'large', or a
|
|
3858
5929
|
* custom value (40px, 1rem, etc)
|
|
3859
5930
|
*
|
|
3860
5931
|
*/
|
|
@@ -3881,9 +5952,12 @@ class PdsIcon {
|
|
|
3881
5952
|
}
|
|
3882
5953
|
componentDidLoad() {
|
|
3883
5954
|
this.setCSSVariables();
|
|
5955
|
+
if (!this.didLoadIcon) {
|
|
5956
|
+
this.loadIcon();
|
|
5957
|
+
}
|
|
3884
5958
|
}
|
|
3885
5959
|
componentWillLoad() {
|
|
3886
|
-
this.inheritedAttributes = inheritAttributes
|
|
5960
|
+
this.inheritedAttributes = inheritAttributes(this.el, ['aria-label']);
|
|
3887
5961
|
this.setCSSVariables();
|
|
3888
5962
|
}
|
|
3889
5963
|
setCSSVariables() {
|
|
@@ -3907,14 +5981,18 @@ class PdsIcon {
|
|
|
3907
5981
|
this.setCSSVariables();
|
|
3908
5982
|
}
|
|
3909
5983
|
loadIcon() {
|
|
3910
|
-
|
|
3911
|
-
if (
|
|
3912
|
-
this.ariaLabel =
|
|
5984
|
+
this.iconName = getName(this.name, this.icon);
|
|
5985
|
+
if (this.iconName) {
|
|
5986
|
+
this.ariaLabel = this.iconName.replace(/\-/g, ' ');
|
|
3913
5987
|
}
|
|
3914
5988
|
}
|
|
3915
5989
|
render() {
|
|
3916
|
-
const { ariaLabel, inheritedAttributes } = this;
|
|
3917
|
-
|
|
5990
|
+
const { ariaLabel, flipRtl, iconName, inheritedAttributes } = this;
|
|
5991
|
+
const shouldIconAutoFlip = iconName
|
|
5992
|
+
? shouldRtlFlipIcon(iconName, this.el) && flipRtl !== false
|
|
5993
|
+
: false;
|
|
5994
|
+
const shouldFlip = flipRtl || shouldIconAutoFlip;
|
|
5995
|
+
return (hAsync(Host, Object.assign({ key: 'bc8e46daa75df27a8039e0e767bdb43164ad7d4c', "aria-label": ariaLabel !== undefined && !this.hasAriaHidden() ? ariaLabel : null, alt: "", role: "img", class: Object.assign(Object.assign({}, createColorClasses(this.color)), { 'flip-rtl': shouldFlip, 'icon-rtl': shouldFlip && isRTL(this.el) }) }, inheritedAttributes), (hAsync("div", { class: "icon-inner" }))));
|
|
3918
5996
|
}
|
|
3919
5997
|
/*****
|
|
3920
5998
|
* Private Methods
|
|
@@ -3941,6 +6019,7 @@ class PdsIcon {
|
|
|
3941
6019
|
"$tagName$": "pds-icon",
|
|
3942
6020
|
"$members$": {
|
|
3943
6021
|
"color": [1],
|
|
6022
|
+
"flipRtl": [4, "flip-rtl"],
|
|
3944
6023
|
"icon": [8],
|
|
3945
6024
|
"name": [513],
|
|
3946
6025
|
"size": [513],
|
|
@@ -3982,9 +6061,9 @@ class PdsImage {
|
|
|
3982
6061
|
this.loading = 'eager';
|
|
3983
6062
|
}
|
|
3984
6063
|
render() {
|
|
3985
|
-
return (hAsync(Host, { key: '
|
|
6064
|
+
return (hAsync(Host, { key: 'a706be22398297ae7087239a3dc7474ae17ab358', class: {
|
|
3986
6065
|
'pds-image': true,
|
|
3987
|
-
}, id: this.componentId }, hAsync("img", { key: '
|
|
6066
|
+
}, id: this.componentId }, hAsync("img", { key: '37a465ed175ae298e174370246885fb6d7837112', alt: this.alt, height: this.height, loading: this.loading, sizes: this.sizes, src: this.src, srcset: this.srcset, width: this.width })));
|
|
3988
6067
|
}
|
|
3989
6068
|
static get style() { return pdsImageCss; }
|
|
3990
6069
|
static get cmpMeta() { return {
|
|
@@ -4006,87 +6085,6 @@ class PdsImage {
|
|
|
4006
6085
|
}; }
|
|
4007
6086
|
}
|
|
4008
6087
|
|
|
4009
|
-
/**
|
|
4010
|
-
* Inherit attributes from the host element
|
|
4011
|
-
* @param el - Host element
|
|
4012
|
-
* @param attributes - Array of attributes to inherit
|
|
4013
|
-
*/
|
|
4014
|
-
const inheritAttributes = (el, attributes = []) => {
|
|
4015
|
-
const attributeObject = {};
|
|
4016
|
-
attributes.forEach((attr) => {
|
|
4017
|
-
if (el.hasAttribute(attr)) {
|
|
4018
|
-
const value = el.getAttribute(attr);
|
|
4019
|
-
if (value !== null) {
|
|
4020
|
-
attributeObject[attr] = el.getAttribute(attr);
|
|
4021
|
-
}
|
|
4022
|
-
el.removeAttribute(attr);
|
|
4023
|
-
}
|
|
4024
|
-
});
|
|
4025
|
-
return attributeObject;
|
|
4026
|
-
};
|
|
4027
|
-
/**
|
|
4028
|
-
* List of available ARIA attributes + `role`.
|
|
4029
|
-
* Removed deprecated attributes.
|
|
4030
|
-
* https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes
|
|
4031
|
-
*/
|
|
4032
|
-
const ariaAttributes = [
|
|
4033
|
-
'role',
|
|
4034
|
-
'aria-activedescendant',
|
|
4035
|
-
'aria-atomic',
|
|
4036
|
-
'aria-autocomplete',
|
|
4037
|
-
'aria-braillelabel',
|
|
4038
|
-
'aria-brailleroledescription',
|
|
4039
|
-
'aria-busy',
|
|
4040
|
-
'aria-checked',
|
|
4041
|
-
'aria-colcount',
|
|
4042
|
-
'aria-colindex',
|
|
4043
|
-
'aria-colindextext',
|
|
4044
|
-
'aria-colspan',
|
|
4045
|
-
'aria-controls',
|
|
4046
|
-
'aria-current',
|
|
4047
|
-
'aria-describedby',
|
|
4048
|
-
'aria-description',
|
|
4049
|
-
'aria-details',
|
|
4050
|
-
'aria-disabled',
|
|
4051
|
-
'aria-errormessage',
|
|
4052
|
-
'aria-expanded',
|
|
4053
|
-
'aria-flowto',
|
|
4054
|
-
'aria-haspopup',
|
|
4055
|
-
'aria-hidden',
|
|
4056
|
-
'aria-invalid',
|
|
4057
|
-
'aria-keyshortcuts',
|
|
4058
|
-
'aria-label',
|
|
4059
|
-
'aria-labelledby',
|
|
4060
|
-
'aria-level',
|
|
4061
|
-
'aria-live',
|
|
4062
|
-
'aria-multiline',
|
|
4063
|
-
'aria-multiselectable',
|
|
4064
|
-
'aria-orientation',
|
|
4065
|
-
'aria-owns',
|
|
4066
|
-
'aria-placeholder',
|
|
4067
|
-
'aria-posinset',
|
|
4068
|
-
'aria-pressed',
|
|
4069
|
-
'aria-readonly',
|
|
4070
|
-
'aria-relevant',
|
|
4071
|
-
'aria-required',
|
|
4072
|
-
'aria-roledescription',
|
|
4073
|
-
'aria-rowcount',
|
|
4074
|
-
'aria-rowindex',
|
|
4075
|
-
'aria-rowindextext',
|
|
4076
|
-
'aria-rowspan',
|
|
4077
|
-
'aria-selected',
|
|
4078
|
-
'aria-setsize',
|
|
4079
|
-
'aria-sort',
|
|
4080
|
-
'aria-valuemax',
|
|
4081
|
-
'aria-valuemin',
|
|
4082
|
-
'aria-valuenow',
|
|
4083
|
-
'aria-valuetext',
|
|
4084
|
-
];
|
|
4085
|
-
const inheritAriaAttributes = (el, ignoreList) => {
|
|
4086
|
-
let attributesToInherit = ariaAttributes;
|
|
4087
|
-
return inheritAttributes(el, attributesToInherit);
|
|
4088
|
-
};
|
|
4089
|
-
|
|
4090
6088
|
const pdsInputTokensCss$1 = ":host{--pine-input-color-background-danger:var(--pine-color-red-050)}";
|
|
4091
6089
|
|
|
4092
6090
|
const labelCss$4 = ":host{display:inline-block}:host([aria-disabled=true]) label{color:var(--pine-color-text-label-disabled)}:host([aria-readonly=true]) label{color:var(--pine-color-text-label-readonly)}label{color:var(--pine-color-text-label);font:var(--pine-typography-body-medium);letter-spacing:var(--pine-letter-spacing)}";
|
|
@@ -4209,10 +6207,10 @@ class PdsInput {
|
|
|
4209
6207
|
return classNames.join(' ');
|
|
4210
6208
|
}
|
|
4211
6209
|
render() {
|
|
4212
|
-
return (hAsync(Host, { key: '
|
|
4213
|
-
hAsync("label", { key: '
|
|
4214
|
-
hAsync("p", { key: '
|
|
4215
|
-
hAsync("p", { key: '
|
|
6210
|
+
return (hAsync(Host, { key: 'a2a05a1e0d3e7722c1dc3dea957facaf5ef24c3c', "aria-disabled": this.disabled ? 'true' : null, "aria-readonly": this.readonly ? 'true' : null }, hAsync("div", { key: 'd95ad9600e7d80050bf41503a2eb9ccb91f77893', class: "pds-input" }, this.label &&
|
|
6211
|
+
hAsync("label", { key: 'b5772c8283fe3c8899235c432bbabd36012c2aef', class: "pds-input__label", htmlFor: this.componentId }, this.label), hAsync("input", Object.assign({ key: '65a2ff8c31ebf545caf755609fa2f3e95cdd1098', class: this.inputClassNames(), ref: (input) => this.nativeInput = input, "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, disabled: this.disabled, id: this.componentId, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, type: this.type, value: this.value, onInput: this.onInputEvent, onChange: this.onChangeEvent, onBlur: this.onBlurEvent, onFocus: this.onFocusEvent, onCompositionstart: this.onCompositionStart, onCompositionend: this.onCompositionEnd }, this.inheritedAttributes)), this.helperMessage &&
|
|
6212
|
+
hAsync("p", { key: 'a7a30bc28a0e9aa16ebd842b8b3851569f556591', class: "pds-input__helper-message", id: messageId(this.componentId, 'helper') }, this.helperMessage), this.errorMessage &&
|
|
6213
|
+
hAsync("p", { key: '3ffc19523e9378534e665ba52247935e924d4168', class: "pds-input__error-message", id: messageId(this.componentId, 'error'), "aria-live": "assertive" }, hAsync("pds-icon", { key: '6961e5735ffe279414ea5333224baa72561697d5', icon: danger, size: "small" }), this.errorMessage))));
|
|
4216
6214
|
}
|
|
4217
6215
|
get el() { return getElement(this); }
|
|
4218
6216
|
static get watchers() { return {
|
|
@@ -4247,7 +6245,7 @@ class PdsInput {
|
|
|
4247
6245
|
}; }
|
|
4248
6246
|
}
|
|
4249
6247
|
|
|
4250
|
-
const pdsLinkCss = ":host{display:inline}:host pds-icon{-webkit-margin-start:var(--pine-dimension-2xs);margin-inline-start:var(--pine-dimension-2xs)}.pds-link{-ms-flex-align:center;align-items:center;color:var(--pine-color-text);display:-ms-inline-flexbox;display:inline-flex;font-weight:var(--pine-font-weight-medium)}.pds-link:focus-visible{border-radius:var(--pine-dimension-2xs);outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width-thick);position:relative}.pds-link--sm{font-size:var(--pine-font-size-body-xs)}.pds-link--sm pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--md{font-size:var(--pine-font-size-body-sm)}.pds-link--md pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--lg{font-size:var(--pine-font-size-body-md)}.pds-link--lg pds-icon{height:var(--pine-dimension-sm);width:var(--pine-dimension-sm)}.pds-link--plain{text-decoration:none}.pds-link--plain:hover{color:var(--pine-color-text-hover);text-decoration:underline}
|
|
6248
|
+
const pdsLinkCss = ":host{display:inline}:host pds-icon{-webkit-margin-start:var(--pine-dimension-2xs);margin-inline-start:var(--pine-dimension-2xs)}.pds-link{-ms-flex-align:center;align-items:center;color:var(--color, var(--pine-color-text));display:-ms-inline-flexbox;display:inline-flex;font-weight:var(--pine-font-weight-medium)}.pds-link:focus-visible{border-radius:var(--pine-dimension-2xs);outline:var(--pine-outline-focus);outline-offset:var(--pine-border-width-thick);position:relative}.pds-link:hover{color:var(--color, var(--pine-color-text-hover));text-decoration:none}:host([color=secondary]) .pds-link{color:var(--pine-color-text-primary)}:host([color=secondary]) .pds-link:hover{color:var(--pine-color-grey-150)}:host([color=accent]) .pds-link{color:var(--pine-color-accent)}:host([color=accent]) .pds-link:hover{color:var(--pine-color-accent-hover)}:host([color=danger]) .pds-link{color:var(--pine-color-danger)}:host([color=danger]) .pds-link:hover{color:var(--pine-color-danger-hover)}.pds-link--sm{font-size:var(--pine-font-size-body-xs)}.pds-link--sm pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--md{font-size:var(--pine-font-size-body-sm)}.pds-link--md pds-icon{height:var(--pine-dimension-xs);width:var(--pine-dimension-xs)}.pds-link--lg{font-size:var(--pine-font-size-body-md)}.pds-link--lg pds-icon{height:var(--pine-dimension-sm);width:var(--pine-dimension-sm)}.pds-link--plain{text-decoration:none}.pds-link--plain:hover{color:var(--pine-color-text-hover);text-decoration:underline}";
|
|
4251
6249
|
|
|
4252
6250
|
/**
|
|
4253
6251
|
* @part link - Link element styles.
|
|
@@ -4282,20 +6280,360 @@ class PdsLink {
|
|
|
4282
6280
|
}
|
|
4283
6281
|
return classNames.join(' ');
|
|
4284
6282
|
}
|
|
6283
|
+
setLinkStyles() {
|
|
6284
|
+
if (!this.color)
|
|
6285
|
+
return;
|
|
6286
|
+
const linkColors = {
|
|
6287
|
+
secondary: 'var(--pine-color-text-primary)',
|
|
6288
|
+
accent: 'var(--pine-color-accent)',
|
|
6289
|
+
danger: 'var(--pine-color-danger)',
|
|
6290
|
+
};
|
|
6291
|
+
const linkStyles = setColor(this.color, linkColors);
|
|
6292
|
+
return linkStyles;
|
|
6293
|
+
}
|
|
6294
|
+
render() {
|
|
6295
|
+
return (hAsync("a", { key: 'bd418a8fd35a3f3b7e240c09f9dcae3bdaa49013', class: this.classNames(), href: this.href, id: this.componentId, part: "link", target: this.external ? '_blank' : undefined, style: this.setLinkStyles() }, hAsync("slot", { key: '45aa4d6d1b2daaf4413227e39811595073f65744' }, this.href), this.external &&
|
|
6296
|
+
hAsync("pds-icon", { key: '4b8dec593ddefb68278e3c102174ec24b63680f6', icon: launch, size: this.fontSize })));
|
|
6297
|
+
}
|
|
6298
|
+
static get style() { return pdsLinkCss; }
|
|
6299
|
+
static get cmpMeta() { return {
|
|
6300
|
+
"$flags$": 9,
|
|
6301
|
+
"$tagName$": "pds-link",
|
|
6302
|
+
"$members$": {
|
|
6303
|
+
"color": [1],
|
|
6304
|
+
"componentId": [1, "component-id"],
|
|
6305
|
+
"external": [4],
|
|
6306
|
+
"variant": [1],
|
|
6307
|
+
"fontSize": [1, "font-size"],
|
|
6308
|
+
"href": [1]
|
|
6309
|
+
},
|
|
6310
|
+
"$listeners$": undefined,
|
|
6311
|
+
"$lazyBundleId$": "-",
|
|
6312
|
+
"$attrsToReflect$": []
|
|
6313
|
+
}; }
|
|
6314
|
+
}
|
|
6315
|
+
|
|
6316
|
+
const pdsLoaderCss = ":host{--loader-color:var(--pine-color-brand);-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--pine-dimension-xs)}:host(.pds-loader--hidden),.pds-loader--hidden{border-width:0;clip:rect(0, 0, 0, 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.pds-loader--spinner svg{--number-spinner-timing:2s;--number-spinner-path-timing:1.5s;-webkit-animation:rotate var(--number-spinner-timing) linear infinite;animation:rotate var(--number-spinner-timing) linear infinite;color:var(--loader-color)}.pds-loader__spinner-path{stroke-width:8px}@-webkit-keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.pds-loader--typing{--number-typing-timing:1s;--opacity-typing-dot-default:0.4;--opacity-typing-dot-active:1;-ms-flex-align:center;align-items:center;background-color:var(--pine-color-background-container-disabled);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow);box-shadow:var(--pine-box-shadow);display:-ms-inline-flexbox;display:inline-flex;gap:var(--pine-dimension-2xs);margin-block:var(--pine-dimension-none);margin-inline:auto;padding-block:15px;padding-inline:20px;position:relative}.pds-loader--typing span{background-color:var(--pine-color-border-hover);block-size:6px;border-radius:var(--pine-border-radius-full);inline-size:6px;opacity:var(--opacity-typing-dot-default)}.pds-loader--typing span:nth-of-type(1){-webkit-animation:var(--number-typing-timing) typing infinite 0.3333s;animation:var(--number-typing-timing) typing infinite 0.3333s}.pds-loader--typing span:nth-of-type(2){-webkit-animation:var(--number-typing-timing) typing infinite 0.6666s;animation:var(--number-typing-timing) typing infinite 0.6666s}.pds-loader--typing span:nth-of-type(3){-webkit-animation:var(--number-typing-timing) typing infinite 0.9999s;animation:var(--number-typing-timing) typing infinite 0.9999s}@-webkit-keyframes typing{50%{opacity:var(--opacity-typing-dot-active);-webkit-transform:scale(1.25);transform:scale(1.25)}}@keyframes typing{50%{opacity:var(--opacity-typing-dot-active);-webkit-transform:scale(1.25);transform:scale(1.25)}}.pds-loader__label{--typography-label-default:var(--pine-font-weight-medium) var(--pine-font-size-body-md)/var(--pine-line-height-body) var(--pine-font-family-body);font:var(--typography-label-default)}";
|
|
6317
|
+
|
|
6318
|
+
/**
|
|
6319
|
+
* @slot label - Default slot for Loader label text.
|
|
6320
|
+
*/
|
|
6321
|
+
class PdsLoader {
|
|
6322
|
+
constructor(hostRef) {
|
|
6323
|
+
registerInstance(this, hostRef);
|
|
6324
|
+
/**
|
|
6325
|
+
* If false, the loader will be hidden.
|
|
6326
|
+
*/
|
|
6327
|
+
this.isLoading = true;
|
|
6328
|
+
/**
|
|
6329
|
+
* Determines whether the loader should display a label.
|
|
6330
|
+
*/
|
|
6331
|
+
this.showLabel = false;
|
|
6332
|
+
/**
|
|
6333
|
+
* Sets the size of the spinner loader. Value can be preset or custom.
|
|
6334
|
+
*/
|
|
6335
|
+
this.size = 'md';
|
|
6336
|
+
/**
|
|
6337
|
+
* Determines the type of loader.
|
|
6338
|
+
*/
|
|
6339
|
+
this.variant = 'spinner';
|
|
6340
|
+
this.style = () => {
|
|
6341
|
+
if (this.size !== undefined) {
|
|
6342
|
+
return {
|
|
6343
|
+
height: this.loaderSize(),
|
|
6344
|
+
width: this.loaderSize(),
|
|
6345
|
+
};
|
|
6346
|
+
}
|
|
6347
|
+
};
|
|
6348
|
+
}
|
|
6349
|
+
loaderSize() {
|
|
6350
|
+
const sizes = {
|
|
6351
|
+
xs: '24px',
|
|
6352
|
+
sm: '32px',
|
|
6353
|
+
md: '48px',
|
|
6354
|
+
lg: '64px',
|
|
6355
|
+
xl: '80px',
|
|
6356
|
+
};
|
|
6357
|
+
if (sizes[this.size]) {
|
|
6358
|
+
return sizes[this.size];
|
|
6359
|
+
}
|
|
6360
|
+
else {
|
|
6361
|
+
return this.size;
|
|
6362
|
+
}
|
|
6363
|
+
}
|
|
6364
|
+
render() {
|
|
6365
|
+
return (hAsync(Host, { key: '1885f34a4ea3b114fac209f543680e531059bbbc', class: `pds-loader ${this.isLoading ? '' : 'pds-loader--hidden'}`, "aria-hidden": !this.isLoading, "aria-busy": this.isLoading, "aria-live": "polite" }, this.variant === 'spinner' && (hAsync("div", { key: '179e5c12cf4b049fc065034f0a6658ad6ddd9040', class: "pds-loader--spinner" }, hAsync("svg", { key: '8f4ba909fc4b9fe64ea7ea37ff26ae1d835292ae', style: this.style(), viewBox: "0 0 200 200", fill: "none" }, hAsync("defs", { key: 'ded765d5064790ad53f65a7e831e86367ce394ee' }, hAsync("linearGradient", { key: 'a8d3bca4fb569a52e61fd3908512803b2020dc38', id: "spinner-secondHalf" }, hAsync("stop", { key: '5c573e2545c778350b7481a4f2f468f4ae8094c0', offset: "0%", "stop-opacity": "0", "stop-color": "currentColor" }), hAsync("stop", { key: '99ade176b1d6a84f4ae8a4d3b2c9e98954dbb519', offset: "100%", "stop-opacity": "0.5", "stop-color": "currentColor" })), hAsync("linearGradient", { key: '3730c343c31190b037d0a6401a89b63640250f4a', id: "spinner-firstHalf" }, hAsync("stop", { key: 'f989c168a08aec3cb0b3f3bbfc71483b1991aff3', offset: "0%", "stop-opacity": "1", "stop-color": "currentColor" }), hAsync("stop", { key: '2ef58c6b7ec9058856b0fa30158182e4262396c6', offset: "100%", "stop-opacity": "0.5", "stop-color": "currentColor" }))), hAsync("g", { key: '6421330f6d04f90f24207057a67e03a38985d63b', class: "pds-loader__spinner-path" }, hAsync("path", { key: '594bf9e8c6b5c311ba2f461f873f6e5e9b6ccf27', stroke: "url(#spinner-secondHalf)", d: "M 4 100 A 96 96 0 0 1 196 100" }), hAsync("path", { key: 'd44edd943fe5ffd3d8708232a0ca16a254e688e4', stroke: "url(#spinner-firstHalf)", d: "M 196 100 A 96 96 0 0 1 4 100" }), hAsync("path", { key: 'ed3a5152042d5970dfa01d560ad234a8401702ca', stroke: "currentColor", "stroke-linecap": "round", d: "M 4 100 A 96 96 0 0 1 4 98" }))))), this.variant === 'typing' && (hAsync("div", { key: 'b7c4a013453a7233b8a9090b614b1ef0e5234ccd', class: "pds-loader--typing" }, hAsync("span", { key: '41408b1e02d88e80f8aa0468f607aad34015ff38' }), hAsync("span", { key: 'c41fc78a3160a72875301b968da6229351953e30' }), hAsync("span", { key: '02d33e3953dc291e60f293ac2c5906229decc4b9' }))), hAsync("div", { key: '2e767fdad673b59d07ab1aa02aeb002eb1930d24', class: `pds-loader__label ${this.showLabel ? '' : 'pds-loader--hidden'}` }, hAsync("slot", { key: '27956937cf99517d73c8a465457fde1c0c985c15', name: "label" }, "Loading..."))));
|
|
6366
|
+
}
|
|
6367
|
+
static get style() { return pdsLoaderCss; }
|
|
6368
|
+
static get cmpMeta() { return {
|
|
6369
|
+
"$flags$": 9,
|
|
6370
|
+
"$tagName$": "pds-loader",
|
|
6371
|
+
"$members$": {
|
|
6372
|
+
"isLoading": [4, "is-loading"],
|
|
6373
|
+
"showLabel": [4, "show-label"],
|
|
6374
|
+
"size": [513],
|
|
6375
|
+
"variant": [1]
|
|
6376
|
+
},
|
|
6377
|
+
"$listeners$": undefined,
|
|
6378
|
+
"$lazyBundleId$": "-",
|
|
6379
|
+
"$attrsToReflect$": [["size", "size"]]
|
|
6380
|
+
}; }
|
|
6381
|
+
}
|
|
6382
|
+
|
|
6383
|
+
const pdsModalCss = ".pds-modal__backdrop{-ms-flex-align:start;align-items:flex-start;background-color:rgba(0, 0, 0, 0.4);border:0;display:-ms-flexbox;display:flex;height:100%;inset:0;-ms-flex-pack:center;justify-content:center;margin:0;max-height:100%;max-width:100%;opacity:0;padding:0;position:fixed;-webkit-transition:opacity 0.2s ease, visibility 0.2s ease;transition:opacity 0.2s ease, visibility 0.2s ease;visibility:hidden;width:100%;z-index:1000}@supports ((-webkit-backdrop-filter: blur(3px)) or (backdrop-filter: blur(3px))){.pds-modal__backdrop{-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}}pds-modal .pds-modal__backdrop{z-index:1001}.pds-modal__backdrop::-webkit-backdrop{background:transparent}.pds-modal__backdrop::-ms-backdrop{background:transparent}.pds-modal__backdrop::backdrop{background:transparent}.pds-modal__backdrop.open{opacity:1;visibility:visible}.pds-modal{background:var(--pine-color-background-container);border-radius:var(--pine-dimension-sm);-webkit-box-shadow:var(--pine-box-shadow-400);box-shadow:var(--pine-box-shadow-400);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;margin:var(--pine-dimension-md);max-height:calc(100vh - (6vh + 96px));width:100%}@media (min-width: 992px){.pds-modal{-webkit-margin-before:6vh;margin-block-start:6vh}}@media (min-width: 1200px){.pds-modal{-webkit-margin-before:8vh;margin-block-start:8vh}}.pds-modal--sm{max-width:520px}.pds-modal--md{max-width:700px}.pds-modal--lg{max-width:900px}.pds-modal--fullscreen{border-radius:0;height:100%;margin:0;max-height:100vh;max-width:100%}.pds-modal--fullscreen .pds-modal-content{-ms-flex:1;flex:1}";
|
|
6384
|
+
|
|
6385
|
+
class PdsModal {
|
|
6386
|
+
constructor(hostRef) {
|
|
6387
|
+
registerInstance(this, hostRef);
|
|
6388
|
+
this.pdsModalOpen = createEvent(this, "pdsModalOpen");
|
|
6389
|
+
this.pdsModalClose = createEvent(this, "pdsModalClose");
|
|
6390
|
+
this.focusableElements = [];
|
|
6391
|
+
/**
|
|
6392
|
+
* Whether the modal can be dismissed by clicking the backdrop
|
|
6393
|
+
* @default true
|
|
6394
|
+
*/
|
|
6395
|
+
this.backdropDismiss = true;
|
|
6396
|
+
/**
|
|
6397
|
+
* Whether the modal is open
|
|
6398
|
+
* @default false
|
|
6399
|
+
*/
|
|
6400
|
+
this.open = false;
|
|
6401
|
+
/**
|
|
6402
|
+
* The size of the modal
|
|
6403
|
+
* @default 'md'
|
|
6404
|
+
*/
|
|
6405
|
+
this.size = 'md';
|
|
6406
|
+
/**
|
|
6407
|
+
* Stores the list of focusable elements in the modal
|
|
6408
|
+
*/
|
|
6409
|
+
this.focusableElementsArray = [];
|
|
6410
|
+
this.handleBackdropClick = (e) => {
|
|
6411
|
+
if (!this.backdropDismiss || !this.open)
|
|
6412
|
+
return;
|
|
6413
|
+
if (e.target.classList.contains('pds-modal__backdrop')) {
|
|
6414
|
+
e.stopPropagation();
|
|
6415
|
+
// Only close if this is the innermost modal
|
|
6416
|
+
if (this.isInnermostModal()) {
|
|
6417
|
+
this.hideModal();
|
|
6418
|
+
}
|
|
6419
|
+
}
|
|
6420
|
+
};
|
|
6421
|
+
this.handleKeyDown = (e) => {
|
|
6422
|
+
// If the modal is not open, don't handle any keyboard events
|
|
6423
|
+
if (!this.open)
|
|
6424
|
+
return;
|
|
6425
|
+
// Handle Escape key to close the modal
|
|
6426
|
+
if (e.key === 'Escape') {
|
|
6427
|
+
// Only close if this is the innermost modal
|
|
6428
|
+
if (this.isInnermostModal()) {
|
|
6429
|
+
e.preventDefault();
|
|
6430
|
+
this.hideModal();
|
|
6431
|
+
}
|
|
6432
|
+
return;
|
|
6433
|
+
}
|
|
6434
|
+
// Handle Tab key for focus trapping
|
|
6435
|
+
if (e.key === 'Tab') {
|
|
6436
|
+
// If there are no focusable elements, do nothing
|
|
6437
|
+
if (this.focusableElements.length === 0)
|
|
6438
|
+
return;
|
|
6439
|
+
// Get the first and last focusable elements
|
|
6440
|
+
const firstFocusableElement = this.focusableElements[0];
|
|
6441
|
+
const lastFocusableElement = this.focusableElements[this.focusableElements.length - 1];
|
|
6442
|
+
// Get the current active element
|
|
6443
|
+
const activeElement = document.activeElement;
|
|
6444
|
+
// Check if we need to wrap focus
|
|
6445
|
+
const isFirstElement = activeElement === firstFocusableElement ||
|
|
6446
|
+
firstFocusableElement.contains(activeElement);
|
|
6447
|
+
const isLastElement = activeElement === lastFocusableElement ||
|
|
6448
|
+
lastFocusableElement.contains(activeElement);
|
|
6449
|
+
// If shift + tab is pressed and focus is on the first element, move to the last element
|
|
6450
|
+
if (e.shiftKey && isFirstElement) {
|
|
6451
|
+
e.preventDefault();
|
|
6452
|
+
this.focusElement(lastFocusableElement);
|
|
6453
|
+
}
|
|
6454
|
+
// If tab is pressed and focus is on the last element, move to the first element
|
|
6455
|
+
else if (!e.shiftKey && isLastElement) {
|
|
6456
|
+
e.preventDefault();
|
|
6457
|
+
this.focusElement(firstFocusableElement);
|
|
6458
|
+
}
|
|
6459
|
+
}
|
|
6460
|
+
};
|
|
6461
|
+
}
|
|
6462
|
+
componentDidLoad() {
|
|
6463
|
+
this.modalRef = this.el.querySelector('.pds-modal__backdrop');
|
|
6464
|
+
// Add keyboard event listener
|
|
6465
|
+
document.addEventListener('keydown', this.handleKeyDown);
|
|
6466
|
+
}
|
|
6467
|
+
disconnectedCallback() {
|
|
6468
|
+
// Clean up event listener
|
|
6469
|
+
document.removeEventListener('keydown', this.handleKeyDown);
|
|
6470
|
+
}
|
|
6471
|
+
handleOpenChange(newValue) {
|
|
6472
|
+
if (newValue) {
|
|
6473
|
+
this.showModal();
|
|
6474
|
+
}
|
|
6475
|
+
else {
|
|
6476
|
+
this.hideModal();
|
|
6477
|
+
}
|
|
6478
|
+
}
|
|
6479
|
+
/**
|
|
6480
|
+
* Updates the list of focusable elements in the modal
|
|
6481
|
+
*/
|
|
6482
|
+
updateFocusableElements() {
|
|
6483
|
+
if (!this.modalRef)
|
|
6484
|
+
return;
|
|
6485
|
+
// Get all focusable elements within the modal
|
|
6486
|
+
const selector = [
|
|
6487
|
+
'a[href]',
|
|
6488
|
+
'button:not([disabled])',
|
|
6489
|
+
'input:not([disabled])',
|
|
6490
|
+
'select:not([disabled])',
|
|
6491
|
+
'textarea:not([disabled])',
|
|
6492
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
6493
|
+
'pds-button:not([disabled])',
|
|
6494
|
+
'pds-link:not([disabled])',
|
|
6495
|
+
'pds-input:not([disabled])',
|
|
6496
|
+
'pds-checkbox:not([disabled])',
|
|
6497
|
+
'pds-radio:not([disabled])',
|
|
6498
|
+
'pds-switch:not([disabled])',
|
|
6499
|
+
'pds-select:not([disabled])',
|
|
6500
|
+
].join(',');
|
|
6501
|
+
this.focusableElements = Array.from(this.modalRef.querySelectorAll(selector));
|
|
6502
|
+
// Filter out elements with display: none or visibility: hidden
|
|
6503
|
+
this.focusableElements = this.focusableElements.filter(el => {
|
|
6504
|
+
const style = window.getComputedStyle(el);
|
|
6505
|
+
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
6506
|
+
});
|
|
6507
|
+
}
|
|
6508
|
+
/**
|
|
6509
|
+
* Sets focus to the first focusable element in the modal
|
|
6510
|
+
*/
|
|
6511
|
+
setInitialFocus() {
|
|
6512
|
+
if (this.focusableElements.length === 0)
|
|
6513
|
+
return;
|
|
6514
|
+
// Focus the first focusable element
|
|
6515
|
+
const firstElement = this.focusableElements[0];
|
|
6516
|
+
// For web components, we need to ensure they're properly focused
|
|
6517
|
+
this.focusElement(firstElement);
|
|
6518
|
+
}
|
|
6519
|
+
/**
|
|
6520
|
+
* Helper method to focus an element, with special handling for web components
|
|
6521
|
+
*/
|
|
6522
|
+
focusElement(element) {
|
|
6523
|
+
if (!element)
|
|
6524
|
+
return;
|
|
6525
|
+
try {
|
|
6526
|
+
// Try standard focus first
|
|
6527
|
+
element.focus();
|
|
6528
|
+
// Check if focus worked
|
|
6529
|
+
setTimeout(() => {
|
|
6530
|
+
if (document.activeElement !== element) {
|
|
6531
|
+
// For web components, try to find a focusable element inside
|
|
6532
|
+
if (element.shadowRoot) {
|
|
6533
|
+
const focusableInShadow = element.shadowRoot.querySelector('button, [tabindex], input, a[href]');
|
|
6534
|
+
if (focusableInShadow) {
|
|
6535
|
+
focusableInShadow.focus();
|
|
6536
|
+
}
|
|
6537
|
+
}
|
|
6538
|
+
}
|
|
6539
|
+
}, 0);
|
|
6540
|
+
}
|
|
6541
|
+
catch (error) {
|
|
6542
|
+
console.error('Error focusing element:', error);
|
|
6543
|
+
}
|
|
6544
|
+
}
|
|
6545
|
+
/**
|
|
6546
|
+
* Opens the modal
|
|
6547
|
+
*/
|
|
6548
|
+
async showModal() {
|
|
6549
|
+
if (this.modalRef) {
|
|
6550
|
+
try {
|
|
6551
|
+
// Store the currently focused element to restore focus when modal closes
|
|
6552
|
+
this.previousActiveElement = document.activeElement;
|
|
6553
|
+
// Use native dialog showModal method which makes the rest of the page inert
|
|
6554
|
+
this.modalRef.showModal();
|
|
6555
|
+
this.open = true;
|
|
6556
|
+
// Update focusable elements and set initial focus
|
|
6557
|
+
// Using a longer timeout to ensure all components are fully rendered
|
|
6558
|
+
setTimeout(() => {
|
|
6559
|
+
this.updateFocusableElements();
|
|
6560
|
+
this.setInitialFocus();
|
|
6561
|
+
this.pdsModalOpen.emit();
|
|
6562
|
+
}, 100);
|
|
6563
|
+
}
|
|
6564
|
+
catch (error) {
|
|
6565
|
+
console.error('Failed to show modal:', error);
|
|
6566
|
+
}
|
|
6567
|
+
}
|
|
6568
|
+
}
|
|
6569
|
+
/**
|
|
6570
|
+
* Closes the modal
|
|
6571
|
+
*/
|
|
6572
|
+
async hideModal() {
|
|
6573
|
+
if (this.modalRef) {
|
|
6574
|
+
try {
|
|
6575
|
+
this.modalRef.close();
|
|
6576
|
+
this.open = false;
|
|
6577
|
+
// Restore focus to the element that was focused before the modal was opened
|
|
6578
|
+
if (this.previousActiveElement && typeof this.previousActiveElement.focus === 'function') {
|
|
6579
|
+
this.previousActiveElement.focus();
|
|
6580
|
+
}
|
|
6581
|
+
this.pdsModalClose.emit();
|
|
6582
|
+
}
|
|
6583
|
+
catch (error) {
|
|
6584
|
+
console.error('Failed to hide modal:', error);
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
/**
|
|
6589
|
+
* Gets the z-index of a modal's backdrop element
|
|
6590
|
+
*/
|
|
6591
|
+
getBackdropZIndex(modal) {
|
|
6592
|
+
const backdrop = modal.querySelector('.pds-modal__backdrop');
|
|
6593
|
+
return backdrop ? parseInt(getComputedStyle(backdrop).zIndex, 10) : -1;
|
|
6594
|
+
}
|
|
6595
|
+
/**
|
|
6596
|
+
* Checks if this modal is the innermost (highest z-index) modal
|
|
6597
|
+
*/
|
|
6598
|
+
isInnermostModal() {
|
|
6599
|
+
// Find all open modals
|
|
6600
|
+
const openModals = Array.from(document.querySelectorAll('pds-modal')).filter(modal => modal.open);
|
|
6601
|
+
if (openModals.length === 0)
|
|
6602
|
+
return false;
|
|
6603
|
+
// Get this modal's backdrop element
|
|
6604
|
+
const thisBackdrop = this.el.querySelector('.pds-modal__backdrop');
|
|
6605
|
+
if (!thisBackdrop)
|
|
6606
|
+
return false;
|
|
6607
|
+
// Get computed z-index of all open modal backdrops
|
|
6608
|
+
const modalZIndexes = openModals.map(modal => this.getBackdropZIndex(modal));
|
|
6609
|
+
// Get the highest z-index
|
|
6610
|
+
const maxZIndex = Math.max(...modalZIndexes);
|
|
6611
|
+
// Check if this modal's backdrop has the highest z-index
|
|
6612
|
+
const thisZIndex = this.getBackdropZIndex(this.el);
|
|
6613
|
+
return thisZIndex === maxZIndex;
|
|
6614
|
+
}
|
|
4285
6615
|
render() {
|
|
4286
|
-
return (hAsync("
|
|
4287
|
-
|
|
6616
|
+
return (hAsync("dialog", { key: 'c27d56b7717f739fb8ed7a243e0715a806ed3b0c', class: {
|
|
6617
|
+
'pds-modal__backdrop': true,
|
|
6618
|
+
'open': this.open
|
|
6619
|
+
}, "aria-modal": "true", "aria-labelledby": `${this.componentId}-heading`, onClick: this.handleBackdropClick }, hAsync("div", { key: '083bfc9fa7ec82b9f5deb9b49f19d10abfc5c912', class: `pds-modal pds-modal--${this.size} pds-modal--scrollable` }, hAsync("slot", { key: '2c47ddf024a9b1b7824de478f8d15a4af74627bb' }))));
|
|
4288
6620
|
}
|
|
4289
|
-
|
|
6621
|
+
get el() { return getElement(this); }
|
|
6622
|
+
static get watchers() { return {
|
|
6623
|
+
"open": ["handleOpenChange"]
|
|
6624
|
+
}; }
|
|
6625
|
+
static get style() { return pdsModalCss; }
|
|
4290
6626
|
static get cmpMeta() { return {
|
|
4291
|
-
"$flags$":
|
|
4292
|
-
"$tagName$": "pds-
|
|
6627
|
+
"$flags$": 4,
|
|
6628
|
+
"$tagName$": "pds-modal",
|
|
4293
6629
|
"$members$": {
|
|
6630
|
+
"backdropDismiss": [4, "backdrop-dismiss"],
|
|
4294
6631
|
"componentId": [1, "component-id"],
|
|
4295
|
-
"
|
|
4296
|
-
"
|
|
4297
|
-
"
|
|
4298
|
-
"
|
|
6632
|
+
"open": [1028],
|
|
6633
|
+
"size": [1],
|
|
6634
|
+
"focusableElementsArray": [32],
|
|
6635
|
+
"showModal": [64],
|
|
6636
|
+
"hideModal": [64]
|
|
4299
6637
|
},
|
|
4300
6638
|
"$listeners$": undefined,
|
|
4301
6639
|
"$lazyBundleId$": "-",
|
|
@@ -4303,70 +6641,139 @@ class PdsLink {
|
|
|
4303
6641
|
}; }
|
|
4304
6642
|
}
|
|
4305
6643
|
|
|
4306
|
-
const
|
|
6644
|
+
const pdsModalContentCss = "pds-modal-content{display:block;-ms-flex:1 1 auto;flex:1 1 auto;overflow-y:auto;width:100%}pds-modal-content:has(.pds-modal-content--border-none){border:0}pds-modal-content:has(.pds-modal-content--border-both){-webkit-border-after:1px solid var(--pine-color-grey-200);border-block-end:1px solid var(--pine-color-grey-200);-webkit-border-before:1px solid var(--pine-color-grey-200);border-block-start:1px solid var(--pine-color-grey-200)}pds-modal-content:has(.pds-modal-content--border-top){-webkit-border-before:1px solid var(--pine-color-grey-200);border-block-start:1px solid var(--pine-color-grey-200)}pds-modal-content:has(.pds-modal-content--border-bottom){-webkit-border-after:1px solid var(--pine-color-grey-200);border-block-end:1px solid var(--pine-color-grey-200)}.pds-modal-content{display:block;-ms-flex:1 1 auto;flex:1 1 auto;min-height:0;overflow-y:auto;width:100%}";
|
|
4307
6645
|
|
|
4308
|
-
|
|
4309
|
-
* @slot label - Default slot for Loader label text.
|
|
4310
|
-
*/
|
|
4311
|
-
class PdsLoader {
|
|
6646
|
+
class PdsModalContent {
|
|
4312
6647
|
constructor(hostRef) {
|
|
4313
6648
|
registerInstance(this, hostRef);
|
|
4314
6649
|
/**
|
|
4315
|
-
*
|
|
4316
|
-
|
|
4317
|
-
this.isLoading = true;
|
|
4318
|
-
/**
|
|
4319
|
-
* Determines whether the loader should display a label.
|
|
4320
|
-
*/
|
|
4321
|
-
this.showLabel = false;
|
|
4322
|
-
/**
|
|
4323
|
-
* Sets the size of the spinner loader. Value can be preset or custom.
|
|
4324
|
-
*/
|
|
4325
|
-
this.size = 'md';
|
|
4326
|
-
/**
|
|
4327
|
-
* Determines the type of loader.
|
|
6650
|
+
* The border style for the content area. Automatically set based on available space of the modal content.
|
|
6651
|
+
* @default 'none'
|
|
4328
6652
|
*/
|
|
4329
|
-
this.
|
|
4330
|
-
this.
|
|
4331
|
-
if (this.size !== undefined) {
|
|
4332
|
-
return {
|
|
4333
|
-
height: this.loaderSize(),
|
|
4334
|
-
width: this.loaderSize(),
|
|
4335
|
-
};
|
|
4336
|
-
}
|
|
4337
|
-
};
|
|
6653
|
+
this.border = 'none';
|
|
6654
|
+
this.contentMaxHeight = '60vh';
|
|
4338
6655
|
}
|
|
4339
|
-
|
|
4340
|
-
const
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
6656
|
+
componentDidLoad() {
|
|
6657
|
+
const slotContent = this.el.firstElementChild;
|
|
6658
|
+
const isScrollable = slotContent.scrollHeight > slotContent.clientHeight;
|
|
6659
|
+
this.border = isScrollable ? 'both' : 'none';
|
|
6660
|
+
this.calculateMaxHeight();
|
|
6661
|
+
window.addEventListener('resize', this.calculateMaxHeight.bind(this));
|
|
6662
|
+
}
|
|
6663
|
+
disconnectedCallback() {
|
|
6664
|
+
window.removeEventListener('resize', this.calculateMaxHeight.bind(this));
|
|
6665
|
+
if (this.mutationObserver) {
|
|
6666
|
+
this.mutationObserver.disconnect();
|
|
4349
6667
|
}
|
|
4350
|
-
|
|
4351
|
-
|
|
6668
|
+
}
|
|
6669
|
+
/**
|
|
6670
|
+
* Calculates the max-height based on header and footer heights
|
|
6671
|
+
*/
|
|
6672
|
+
calculateMaxHeight() {
|
|
6673
|
+
// Find the modal element (parent of this component)
|
|
6674
|
+
const modalElement = this.el.closest('pds-modal');
|
|
6675
|
+
if (!modalElement)
|
|
6676
|
+
return;
|
|
6677
|
+
setTimeout(() => {
|
|
6678
|
+
// Find header and footer elements
|
|
6679
|
+
const headerElement = modalElement.querySelector('pds-modal-header');
|
|
6680
|
+
const footerElement = modalElement.querySelector('pds-modal-footer');
|
|
6681
|
+
// Get header and footer heights
|
|
6682
|
+
const headerHeight = headerElement ? headerElement.offsetHeight : 0;
|
|
6683
|
+
const footerHeight = footerElement ? footerElement.offsetHeight : 0;
|
|
6684
|
+
// Set the max-height as a calculation
|
|
6685
|
+
if (headerHeight > 0 || footerHeight > 0) {
|
|
6686
|
+
// Calculate the available height by subtracting:
|
|
6687
|
+
// 1. Header and footer heights
|
|
6688
|
+
// 2. Modal padding (48px)
|
|
6689
|
+
// 3. Additional space for modal positioning (6vh)
|
|
6690
|
+
// 4. Extra adjustment for perfect fit (50px)
|
|
6691
|
+
const viewportAdjustment = Math.round(window.innerHeight * 0.06); // 6vh approximation
|
|
6692
|
+
const totalReduction = headerHeight + footerHeight + 48 + viewportAdjustment + 50;
|
|
6693
|
+
// Set the content max height
|
|
6694
|
+
this.contentMaxHeight = `calc(100vh - ${totalReduction}px)`;
|
|
6695
|
+
// Apply the style directly to ensure it takes effect
|
|
6696
|
+
const contentElement = this.el.querySelector('.pds-modal-content');
|
|
6697
|
+
if (contentElement) {
|
|
6698
|
+
contentElement.style.maxHeight = this.contentMaxHeight;
|
|
6699
|
+
}
|
|
6700
|
+
}
|
|
6701
|
+
else {
|
|
6702
|
+
this.contentMaxHeight = '60vh'; // Default fallback
|
|
6703
|
+
}
|
|
6704
|
+
}, 100); // Delay to ensure DOM is fully rendered
|
|
6705
|
+
// Set up mutation observer if not already done
|
|
6706
|
+
if (!this.mutationObserver && modalElement) {
|
|
6707
|
+
this.mutationObserver = new MutationObserver(() => {
|
|
6708
|
+
this.calculateMaxHeight();
|
|
6709
|
+
});
|
|
6710
|
+
// Observe changes to the modal's children
|
|
6711
|
+
this.mutationObserver.observe(modalElement, {
|
|
6712
|
+
childList: true,
|
|
6713
|
+
subtree: true,
|
|
6714
|
+
attributes: true,
|
|
6715
|
+
attributeFilter: ['style', 'class']
|
|
6716
|
+
});
|
|
4352
6717
|
}
|
|
4353
6718
|
}
|
|
4354
6719
|
render() {
|
|
4355
|
-
return (hAsync(Host, { key: '
|
|
6720
|
+
return (hAsync(Host, { key: '4ff98a386d18f5047752cf8915fa30ea3b6805e2' }, hAsync("div", { key: '686b6fc2263664f7b5f8178827c9e9ae9d53d086', class: {
|
|
6721
|
+
'pds-modal-content': true,
|
|
6722
|
+
[`pds-modal-content--border-${this.border}`]: true
|
|
6723
|
+
}, style: { maxHeight: this.contentMaxHeight }, tabindex: "-1" }, hAsync("slot", { key: '4531f6ba4c499c9404704c9d3a59e1b9ef4744f9' }))));
|
|
4356
6724
|
}
|
|
4357
|
-
|
|
6725
|
+
get el() { return getElement(this); }
|
|
6726
|
+
static get style() { return pdsModalContentCss; }
|
|
4358
6727
|
static get cmpMeta() { return {
|
|
4359
|
-
"$flags$":
|
|
4360
|
-
"$tagName$": "pds-
|
|
6728
|
+
"$flags$": 4,
|
|
6729
|
+
"$tagName$": "pds-modal-content",
|
|
4361
6730
|
"$members$": {
|
|
4362
|
-
"
|
|
4363
|
-
"
|
|
4364
|
-
"size": [513],
|
|
4365
|
-
"variant": [1]
|
|
6731
|
+
"border": [513],
|
|
6732
|
+
"contentMaxHeight": [32]
|
|
4366
6733
|
},
|
|
4367
6734
|
"$listeners$": undefined,
|
|
4368
6735
|
"$lazyBundleId$": "-",
|
|
4369
|
-
"$attrsToReflect$": [["
|
|
6736
|
+
"$attrsToReflect$": [["border", "border"]]
|
|
6737
|
+
}; }
|
|
6738
|
+
}
|
|
6739
|
+
|
|
6740
|
+
const pdsModalFooterCss = "pds-modal-footer{display:block;width:100%}.pds-modal__footer{width:100%}";
|
|
6741
|
+
|
|
6742
|
+
class PdsModalFooter {
|
|
6743
|
+
constructor(hostRef) {
|
|
6744
|
+
registerInstance(this, hostRef);
|
|
6745
|
+
}
|
|
6746
|
+
render() {
|
|
6747
|
+
return (hAsync("footer", { key: 'ea47425a063c04c1cdff3481fc09f32bd65b7679', class: "pds-modal__footer" }, hAsync("slot", { key: '55c560cb8cca95687eb04ba727ae45542ef2209f' })));
|
|
6748
|
+
}
|
|
6749
|
+
static get style() { return pdsModalFooterCss; }
|
|
6750
|
+
static get cmpMeta() { return {
|
|
6751
|
+
"$flags$": 4,
|
|
6752
|
+
"$tagName$": "pds-modal-footer",
|
|
6753
|
+
"$members$": undefined,
|
|
6754
|
+
"$listeners$": undefined,
|
|
6755
|
+
"$lazyBundleId$": "-",
|
|
6756
|
+
"$attrsToReflect$": []
|
|
6757
|
+
}; }
|
|
6758
|
+
}
|
|
6759
|
+
|
|
6760
|
+
const pdsModalHeaderCss = "pds-modal-header{display:block;width:100%}.pds-modal__header{width:100%}";
|
|
6761
|
+
|
|
6762
|
+
class PdsModalHeader {
|
|
6763
|
+
constructor(hostRef) {
|
|
6764
|
+
registerInstance(this, hostRef);
|
|
6765
|
+
}
|
|
6766
|
+
render() {
|
|
6767
|
+
return (hAsync("header", { key: '63d1121b84d10ea99354d07b029b7625d52d9095', class: "pds-modal__header" }, hAsync("slot", { key: 'dd08fc600f122e422ccd3161bc558f3b9cc075f9' })));
|
|
6768
|
+
}
|
|
6769
|
+
static get style() { return pdsModalHeaderCss; }
|
|
6770
|
+
static get cmpMeta() { return {
|
|
6771
|
+
"$flags$": 4,
|
|
6772
|
+
"$tagName$": "pds-modal-header",
|
|
6773
|
+
"$members$": undefined,
|
|
6774
|
+
"$listeners$": undefined,
|
|
6775
|
+
"$lazyBundleId$": "-",
|
|
6776
|
+
"$attrsToReflect$": []
|
|
4370
6777
|
}; }
|
|
4371
6778
|
}
|
|
4372
6779
|
|
|
@@ -4424,27 +6831,59 @@ class PdsPopover {
|
|
|
4424
6831
|
const offset = 8;
|
|
4425
6832
|
switch (this.placement) {
|
|
4426
6833
|
case 'top':
|
|
6834
|
+
top = triggerRect.top - popoverRect.height - offset;
|
|
6835
|
+
left = triggerRect.left + (triggerRect.width - popoverRect.width) / 2;
|
|
6836
|
+
break;
|
|
6837
|
+
case 'top-start':
|
|
4427
6838
|
top = triggerRect.top - popoverRect.height - offset;
|
|
4428
6839
|
left = triggerRect.left;
|
|
4429
6840
|
break;
|
|
6841
|
+
case 'top-end':
|
|
6842
|
+
top = triggerRect.top - popoverRect.height - offset;
|
|
6843
|
+
left = triggerRect.right - popoverRect.width;
|
|
6844
|
+
break;
|
|
4430
6845
|
case 'right':
|
|
6846
|
+
top = triggerRect.top + (triggerRect.height - popoverRect.height) / 2;
|
|
6847
|
+
left = triggerRect.right + offset;
|
|
6848
|
+
break;
|
|
6849
|
+
case 'right-start':
|
|
4431
6850
|
top = triggerRect.top;
|
|
4432
6851
|
left = triggerRect.right + offset;
|
|
4433
6852
|
break;
|
|
6853
|
+
case 'right-end':
|
|
6854
|
+
top = triggerRect.bottom - popoverRect.height;
|
|
6855
|
+
left = triggerRect.right + offset;
|
|
6856
|
+
break;
|
|
4434
6857
|
case 'bottom':
|
|
6858
|
+
top = triggerRect.bottom + offset;
|
|
6859
|
+
left = triggerRect.left + (triggerRect.width - popoverRect.width) / 2;
|
|
6860
|
+
break;
|
|
6861
|
+
case 'bottom-start':
|
|
4435
6862
|
top = triggerRect.bottom + offset;
|
|
4436
6863
|
left = triggerRect.left;
|
|
4437
6864
|
break;
|
|
6865
|
+
case 'bottom-end':
|
|
6866
|
+
top = triggerRect.bottom + offset;
|
|
6867
|
+
left = triggerRect.right - popoverRect.width;
|
|
6868
|
+
break;
|
|
4438
6869
|
case 'left':
|
|
6870
|
+
top = triggerRect.top + (triggerRect.height - popoverRect.height) / 2;
|
|
6871
|
+
left = triggerRect.left - popoverRect.width - offset;
|
|
6872
|
+
break;
|
|
6873
|
+
case 'left-start':
|
|
4439
6874
|
top = triggerRect.top;
|
|
4440
6875
|
left = triggerRect.left - popoverRect.width - offset;
|
|
4441
6876
|
break;
|
|
6877
|
+
case 'left-end':
|
|
6878
|
+
top = triggerRect.bottom - popoverRect.height;
|
|
6879
|
+
left = triggerRect.left - popoverRect.width - offset;
|
|
6880
|
+
break;
|
|
4442
6881
|
}
|
|
4443
6882
|
popoverEl.style.top = `${top}px`;
|
|
4444
6883
|
popoverEl.style.left = `${left}px`;
|
|
4445
6884
|
}
|
|
4446
6885
|
render() {
|
|
4447
|
-
return (hAsync(Host, { key: '
|
|
6886
|
+
return (hAsync(Host, { key: 'b150645b71d528055c6cd6cf2ff9c898c3fe1f3f' }, hAsync("button", { key: '3090efe8ffd85d0d3e4d5dc5f54147a5aff61fb9', class: "pds-popover__trigger", popoverTarget: this.componentId, popoverTargetAction: this.popoverTargetAction, onClick: this.handleClick }, this.text), hAsync("div", { key: '6e9b4af0278507b6f8bf4b5f2d8c3a2891f974b6', class: `pds-popover ${this.active ? 'pds-popover--active' : ''}`, id: this.componentId, popover: this.popoverType, style: { maxWidth: `${this.maxWidth}px` } }, hAsync("slot", { key: 'f4303d3f3aca19314413b86d3973c8d9f1477e8f' }))));
|
|
4448
6887
|
}
|
|
4449
6888
|
get el() { return getElement(this); }
|
|
4450
6889
|
static get style() { return pdsPopoverCss; }
|
|
@@ -4488,7 +6927,7 @@ class PdsProgress {
|
|
|
4488
6927
|
this.showPercent = false;
|
|
4489
6928
|
}
|
|
4490
6929
|
render() {
|
|
4491
|
-
return (hAsync(Host, { key: '
|
|
6930
|
+
return (hAsync(Host, { key: '71ce602dccee62ee76ef51c3994af86829399452', class: this.animated ? { 'is-animated': this.animated } : '' }, hAsync("div", { key: 'c26188786bcfd4d6f039050032cd48982327355e', class: "pds-progress" }, hAsync("label", { key: 'e18f75dae8fcf3fde684156638cc47f9d5e253dd', class: "pds-progress__label", htmlFor: this.componentId }, this.label), hAsync("progress", { key: '37a5bb5609e25912c006a89dd0bbc244cfa5896b', id: this.componentId, max: "100", style: this.fillColor ? { '--color-progress-fill': this.fillColor } : {}, value: this.percent })), this.showPercent && hAsync("div", { key: '68e859cafbcf74c74fc3b72a5347fb03eda83556', class: "pds-progress__percentage" }, this.percent, "%")));
|
|
4492
6931
|
}
|
|
4493
6932
|
static get style() { return pdsProgressCss; }
|
|
4494
6933
|
static get cmpMeta() { return {
|
|
@@ -4556,9 +6995,9 @@ class PdsRadio {
|
|
|
4556
6995
|
return classNames.join(' ');
|
|
4557
6996
|
}
|
|
4558
6997
|
render() {
|
|
4559
|
-
return (hAsync(Host, { key: '
|
|
4560
|
-
hAsync("div", { key: '
|
|
4561
|
-
hAsync("div", { key: '
|
|
6998
|
+
return (hAsync(Host, { key: 'a31d9cd94150a104a83595043dc003fa5d9779a2', class: this.classNames() }, hAsync("label", { key: '1d71e515a00c25bbaac7d0420f4a4ee6a5189836', htmlFor: this.componentId }, hAsync("input", { key: '800b2bbf703e68fbf60f62d6c28228759d976436', "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, type: "radio", id: this.componentId, name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled, onChange: this.handleRadioChange }), hAsync("span", { key: '33c241168498b07a25dfc5ac6f9244eb3ce93547', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), this.helperMessage &&
|
|
6999
|
+
hAsync("div", { key: 'f159de72b68a0f1bf07abb52d50a0d6d89b4f766', class: 'pds-radio__message', id: messageId(this.componentId, 'helper') }, this.helperMessage), this.errorMessage &&
|
|
7000
|
+
hAsync("div", { key: 'fb5877c78e519db27964308c1607ab58fc2fcb08', class: `pds-radio__message pds-radio__message--error`, id: messageId(this.componentId, 'error'), "aria-live": "assertive" }, hAsync("pds-icon", { key: '1385571ed511a800778d64edf48e2853a1c4793e', icon: danger, size: "small" }), this.errorMessage)));
|
|
4562
7001
|
}
|
|
4563
7002
|
static get style() { return labelCss$3 + pdsRadioCss; }
|
|
4564
7003
|
static get cmpMeta() { return {
|
|
@@ -4620,7 +7059,7 @@ class PdsRow {
|
|
|
4620
7059
|
})), (this.minHeight && {
|
|
4621
7060
|
'min-height': this.minHeight,
|
|
4622
7061
|
}));
|
|
4623
|
-
return hAsync(Host, { key: '
|
|
7062
|
+
return hAsync(Host, { key: '2e962d6f8edd5023b3d8d7c8192e4f4ea2b2d2be', class: `pds-row ${rowClasses}`, style: rowInlineStyles });
|
|
4624
7063
|
}
|
|
4625
7064
|
static get style() { return pdsRowCss; }
|
|
4626
7065
|
static get cmpMeta() { return {
|
|
@@ -4761,8 +7200,8 @@ class PdsSelect {
|
|
|
4761
7200
|
return classNames.join(' ');
|
|
4762
7201
|
}
|
|
4763
7202
|
render() {
|
|
4764
|
-
return (hAsync(Host, { key: '
|
|
4765
|
-
hAsync("label", { key: '
|
|
7203
|
+
return (hAsync(Host, { key: '2d39b1eac389e27eea511728ef668d4d548d0c09', "aria-disabled": this.disabled ? 'true' : null, class: this.classNames() }, hAsync("div", { key: 'c0c4e64a19b7b11e0d64d94cbc529be7e455b12a', class: "pds-select" }, this.label &&
|
|
7204
|
+
hAsync("label", { key: '9eadfcc4e6fd6d42f718eb0ad1542f7c03b67052', htmlFor: this.componentId }, this.label), hAsync("select", { key: 'eb1d368ed4f765dead79f6101265e922bd06ca94', autocomplete: this.autocomplete || undefined, class: "pds-select__field", disabled: this.disabled, id: this.componentId, multiple: this.multiple, name: this.name, onChange: this.onSelectUpdate, required: this.required, ref: (el) => (this.selectEl = el) }), hAsync("div", { key: '1dcbfe5d51e55af333e80bb99995cef1693f36c1', "aria-hidden": "true", class: "hidden", ref: (el) => (this.slotContainer = el) }, hAsync("slot", { key: '4d0c76c632e9588dc178c859be5ef1fd474fa191', onSlotchange: this.handleSlotChange })), this.renderMessages(), !this.multiple && hAsync("pds-icon", { key: '954d31034ed522ba128c9048998e92553592d12f', class: "pds-select__select-icon", icon: enlarge }))));
|
|
4766
7205
|
}
|
|
4767
7206
|
static get watchers() { return {
|
|
4768
7207
|
"value": ["valueChanged"]
|
|
@@ -7501,7 +9940,7 @@ class PdsSortable {
|
|
|
7501
9940
|
Sortable.create(this.el, sortableOptions);
|
|
7502
9941
|
}
|
|
7503
9942
|
render() {
|
|
7504
|
-
return (hAsync(Host, { key: '
|
|
9943
|
+
return (hAsync(Host, { key: 'cbbd28ad002093f627befee44c5ae911f86b0221', class: this.classNames(), id: this.componentId }, hAsync("slot", { key: 'f4ef09a82d8e47b471a2463912fd37ac3b9b383f' })));
|
|
7505
9944
|
}
|
|
7506
9945
|
get el() { return getElement(this); }
|
|
7507
9946
|
static get style() { return pdsSortableCss; }
|
|
@@ -7548,7 +9987,7 @@ class PdsSortableItem {
|
|
|
7548
9987
|
}
|
|
7549
9988
|
}
|
|
7550
9989
|
render() {
|
|
7551
|
-
return (hAsync(Host, { key: '
|
|
9990
|
+
return (hAsync(Host, { key: 'b54ef05cc6a8f2dd3c6f7f971b32bd4566738600', class: "pds-sortable-item", id: this.componentId }, this.showHandle && (hAsync("div", { key: 'fa402ec9c8ad9a75a73a23c28d2a5101bcf3d170', class: "pds-sortable-item__handle" }, hAsync("pds-icon", { key: 'def73620ade698eccc0fb8abb4dfeb5b7de46c95', icon: handle }))), hAsync("slot", { key: 'd9dfcc135b7bd8bf893360798baa30297d4fb4ea' }), this.enableActions && (hAsync("div", { key: 'd0852370b35b213238739cea2aa1c3dcd91cbd9d', class: "pds-sortable-item__actions" }, hAsync("slot", { key: 'cbf966a4c56be43ced57e200b91d64e68f5077d9', name: "sortable-item-actions" })))));
|
|
7552
9991
|
}
|
|
7553
9992
|
get el() { return getElement(this); }
|
|
7554
9993
|
static get style() { return pdsSortableItemCss; }
|
|
@@ -7574,6 +10013,7 @@ class PdsSwitch {
|
|
|
7574
10013
|
constructor(hostRef) {
|
|
7575
10014
|
registerInstance(this, hostRef);
|
|
7576
10015
|
this.pdsSwitchChange = createEvent(this, "pdsSwitchChange");
|
|
10016
|
+
this.inheritedAttributes = {};
|
|
7577
10017
|
/**
|
|
7578
10018
|
* Determines the input 'checked' state.
|
|
7579
10019
|
*/
|
|
@@ -7608,10 +10048,13 @@ class PdsSwitch {
|
|
|
7608
10048
|
return switchClasses;
|
|
7609
10049
|
};
|
|
7610
10050
|
}
|
|
10051
|
+
componentWillLoad() {
|
|
10052
|
+
this.inheritedAttributes = Object.assign({}, inheritAriaAttributes(this.el));
|
|
10053
|
+
}
|
|
7611
10054
|
render() {
|
|
7612
|
-
return (hAsync(Host, { key: '
|
|
7613
|
-
hAsync("div", { key: '
|
|
7614
|
-
hAsync("div", { key: '
|
|
10055
|
+
return (hAsync(Host, { key: '04755f80f89f4eff8d44f8c8e76e6020f6be65fb', class: this.switchClassNames(), "aria-disabled": this.disabled ? 'true' : null }, hAsync("label", { key: 'cdf1c4d58c640954ada9d50b4832fa26094b3476', htmlFor: this.componentId }, hAsync("input", Object.assign({ key: 'f141885523b649f8dca4e9fe11494ebf640510bc', "aria-describedby": assignDescription(this.componentId, this.invalid, this.errorMessage || this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, checked: this.checked, class: "pds-switch__input", disabled: this.disabled, id: this.componentId, name: this.name ? this.name : this.componentId, onChange: this.onSwitchUpdate, required: this.required, type: "checkbox", value: this.value }, this.inheritedAttributes)), hAsync("span", { key: 'f80b28bd0904dfae3a4e7b46bfecc46c82843764', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), this.helperMessage &&
|
|
10056
|
+
hAsync("div", { key: '7b60b9c273f4773f9d0e90fd8132dc979c088183', class: `pds-switch__message`, id: messageId(this.componentId, 'helper') }, this.helperMessage), this.errorMessage &&
|
|
10057
|
+
hAsync("div", { key: '9d068c8da41e985ff63851a909f985a80bdabf89', class: `pds-switch__message pds-switch__message--error`, id: messageId(this.componentId, 'error'), "aria-live": "assertive" }, hAsync("pds-icon", { key: '14a69e6ce04e3434f440f19d6ea0e9b347a9b352', icon: danger, size: "small" }), this.errorMessage)));
|
|
7615
10058
|
}
|
|
7616
10059
|
get el() { return getElement(this); }
|
|
7617
10060
|
static get style() { return labelCss$1 + pdsSwitchCss; }
|
|
@@ -7653,9 +10096,9 @@ class PdsTab {
|
|
|
7653
10096
|
this.pdsTabClick.emit([index, parentComponentId]);
|
|
7654
10097
|
}
|
|
7655
10098
|
render() {
|
|
7656
|
-
const availabilityTabEdgeInlineStart = (hAsync("span", { key: '
|
|
7657
|
-
const availabilityTabEdgeInlineEnd = (hAsync("span", { key: '
|
|
7658
|
-
return (hAsync(Host, { key: '
|
|
10099
|
+
const availabilityTabEdgeInlineStart = (hAsync("span", { key: '5256039455be2b9e0dbfd18caf5a7a4f6ca2f047', class: "pds-tab-edge", role: "presentation" }));
|
|
10100
|
+
const availabilityTabEdgeInlineEnd = (hAsync("span", { key: 'c65bc9ccb5a43ee1c1f634fa19c4ac6d66259747', class: "pds-tab-edge pds-tab-edge--end", role: "presentation" }));
|
|
10101
|
+
return (hAsync(Host, { key: '0f379e0d4cce1590dc917196dd520b26bb5e89d9', variant: this.variant, slot: "tabs", index: this.index }, hAsync("button", { key: '70b033b21ff9093b2393565c026ff4954d74dbf3', role: "tab", id: this.parentComponentId + "__" + this.name, "aria-controls": this.parentComponentId + "__" + this.name + "-panel", tabindex: this.selected ? "0" : "-1", "aria-selected": this.selected ? "true" : "false", class: this.selected ? "pds-tab is-active" : "pds-tab", onClick: this.onTabClick.bind(this, this.index, this.parentComponentId) }, this.variant === "availability" && availabilityTabEdgeInlineStart, this.variant === "availability" && availabilityTabEdgeInlineEnd, hAsync("div", { key: 'b01547140256199ec4e829a83e11ea27d059e0ea', class: "pds-tab__content" }, hAsync("slot", { key: '7dce311009731af53a4b6fff4af6e90f91a060a7' })))));
|
|
7659
10102
|
}
|
|
7660
10103
|
get el() { return getElement(this); }
|
|
7661
10104
|
static get style() { return pdsTabCss; }
|
|
@@ -7764,7 +10207,7 @@ class PdsTable {
|
|
|
7764
10207
|
headerCheckbox.indeterminate = !allSelectedRows && !noneSelectedRows;
|
|
7765
10208
|
}
|
|
7766
10209
|
render() {
|
|
7767
|
-
return (hAsync(Host, { key: '
|
|
10210
|
+
return (hAsync(Host, { key: 'b874cdb2b0f0dcc313befdd557d5ce4203a183ac', class: this.classNames(), id: this.componentId, role: "grid", selectable: this.selectable, tabindex: "0" }, hAsync("slot", { key: '52bcce99761712662828ba5a708155410de6e15d' })));
|
|
7768
10211
|
}
|
|
7769
10212
|
get el() { return getElement(this); }
|
|
7770
10213
|
static get style() { return pdsTableCss; }
|
|
@@ -7793,7 +10236,7 @@ class PdsTableBody {
|
|
|
7793
10236
|
registerInstance(this, hostRef);
|
|
7794
10237
|
}
|
|
7795
10238
|
render() {
|
|
7796
|
-
return (hAsync(Host, { key: '
|
|
10239
|
+
return (hAsync(Host, { key: 'ec68d794fd59876a83f40077d29e97af4366f19a', role: "rowgroup" }, hAsync("slot", { key: '9d052cdf3c0ea8afa86a6900d492c9de5c9adaf1' })));
|
|
7797
10240
|
}
|
|
7798
10241
|
static get style() { return pdsTableBodyCss; }
|
|
7799
10242
|
static get cmpMeta() { return {
|
|
@@ -7847,11 +10290,11 @@ class PdsTableCell {
|
|
|
7847
10290
|
return classNames.join(' ');
|
|
7848
10291
|
}
|
|
7849
10292
|
render() {
|
|
7850
|
-
return (hAsync(Host, { key: '
|
|
10293
|
+
return (hAsync(Host, { key: 'f86b2ae5eaee0f3bcb1cd55951a0e83bce4ccfca', class: this.classNames(), role: "gridcell", style: this.tableRef &&
|
|
7851
10294
|
this.tableRef.fixedColumn &&
|
|
7852
10295
|
this.tableRef.selectable
|
|
7853
10296
|
? { '--fixed-cell-position': '40px' }
|
|
7854
|
-
: {} }, hAsync("slot", { key: '
|
|
10297
|
+
: {} }, hAsync("slot", { key: '347d6487bc869bf9903c5e1fb8b05ca29d6e6d50' })));
|
|
7855
10298
|
}
|
|
7856
10299
|
get hostElement() { return getElement(this); }
|
|
7857
10300
|
static get style() { return pdsTableCellCss; }
|
|
@@ -7912,7 +10355,7 @@ class PdsTableHead {
|
|
|
7912
10355
|
}
|
|
7913
10356
|
}
|
|
7914
10357
|
render() {
|
|
7915
|
-
return (hAsync(Host, { key: '
|
|
10358
|
+
return (hAsync(Host, { key: 'f74bfa35afc2f26957ffff431c5438fbb159e15b', role: "row" }, this.tableRef && this.tableRef.selectable && (hAsync("pds-table-head-cell", { key: '13bcfb69c1e8ab696ba702d39209944fa97f34ea', part: this.tableRef.selectable ? 'checkbox-cell' : '' }, hAsync("pds-checkbox", { key: '898170f579ad89627621bb693908b1b04ca25f83', componentId: this.generateUniqueId(), indeterminate: this.indeterminate, onInput: this.handleInput, label: "Select All Rows", hideLabel: true, checked: this.isSelected }))), hAsync("slot", { key: 'd7dc459310c32ee112e05df947b8c9da57180035' })));
|
|
7916
10359
|
}
|
|
7917
10360
|
get hostElement() { return getElement(this); }
|
|
7918
10361
|
static get style() { return pdsTableHeadCss; }
|
|
@@ -7994,11 +10437,11 @@ class PdsTableHeadCell {
|
|
|
7994
10437
|
return classNames.join(' ');
|
|
7995
10438
|
}
|
|
7996
10439
|
render() {
|
|
7997
|
-
return (hAsync(Host, { key: '
|
|
10440
|
+
return (hAsync(Host, { key: '9f9138f88914add530416fbf776d5a68685a3fab', class: this.classNames(), role: "columnheader", onClick: this.toggleSort, style: this.tableRef &&
|
|
7998
10441
|
this.tableRef.fixedColumn &&
|
|
7999
10442
|
this.tableRef.selectable
|
|
8000
10443
|
? { '--fixed-cell-position': '40px' }
|
|
8001
|
-
: {} }, hAsync("slot", { key: '
|
|
10444
|
+
: {} }, hAsync("slot", { key: '84d3c20fc656b468d6c46cc9f5a8c49071af7d04' }), this.sortable && (hAsync("pds-icon", { key: '4ad357565f9542604c16ade571bc5e55b4fa1077', icon: this.sortingDirection === 'asc' ? upSmall : downSmall }))));
|
|
8002
10445
|
}
|
|
8003
10446
|
get hostElement() { return getElement(this); }
|
|
8004
10447
|
static get style() { return pdsTableHeadCellCss; }
|
|
@@ -8064,7 +10507,7 @@ class PdsTableRow {
|
|
|
8064
10507
|
}
|
|
8065
10508
|
}
|
|
8066
10509
|
render() {
|
|
8067
|
-
return (hAsync(Host, { key: '
|
|
10510
|
+
return (hAsync(Host, { key: 'd3ebaeea3a8007634ea821da5a458189a36837a7', class: this.classNames(), role: "row" }, this.tableRef && this.tableRef.selectable && (hAsync("pds-table-cell", { key: '62705fadc9cdb18de2eebd4c608c0dffa119cfba', part: this.tableRef.fixedColumn ? 'checkbox-cell' : '', class: this.tableRef.selectable ? 'has-checkbox' : '' }, hAsync("pds-checkbox", { key: '19e01d4eef0657f7e34a5a9061e568a18eb9b7c6', componentId: this.generateUniqueId(), onClick: this.handleClick, indeterminate: this.indeterminate, label: "Select Row", hideLabel: true, checked: this.isSelected }))), hAsync("slot", { key: '59b3c28a61f36f9ea6e891876bf007590a7cce51' })));
|
|
8068
10511
|
}
|
|
8069
10512
|
get hostElement() { return getElement(this); }
|
|
8070
10513
|
static get style() { return pdsTableRowCss; }
|
|
@@ -8093,7 +10536,7 @@ class PdsTabpanel {
|
|
|
8093
10536
|
this.selected = false; // eslint-disable-line @stencil-community/strict-mutable
|
|
8094
10537
|
}
|
|
8095
10538
|
render() {
|
|
8096
|
-
return (hAsync(Host, { key: '
|
|
10539
|
+
return (hAsync(Host, { key: 'fe7548d8da3149d13d23b41d6860beb1f351b3c6', slot: "tabpanels" }, hAsync("div", { key: 'bf50bfc20be721ba467ff22ba24f0410153223f5', role: "tabpanel", id: this.parentComponentId + "__" + this.name + '-panel', tabindex: "0", "aria-labelledby": this.parentComponentId + "__" + this.name, class: this.selected ? "pds-tabpanel is-active" : "pds-tabpanel" }, hAsync("slot", { key: '3de1657e963e7e9fca81fac07f78edc064cd86e7' }))));
|
|
8097
10540
|
}
|
|
8098
10541
|
get el() { return getElement(this); }
|
|
8099
10542
|
static get style() { return pdsTabpanelCss; }
|
|
@@ -8194,7 +10637,7 @@ class PdsTabs {
|
|
|
8194
10637
|
this.passPropsToChildren();
|
|
8195
10638
|
}
|
|
8196
10639
|
render() {
|
|
8197
|
-
return (hAsync(Host, { key: '
|
|
10640
|
+
return (hAsync(Host, { key: '571b33280e4473d1a8bef6e90103c4d42a29ed03', "active-tab-name": this.activeTabName, class: this.classNames(), id: this.componentId }, hAsync("div", { key: 'c50a6cd3b8a06e13ff14626258769b7918f57ed0', class: "pds-tabs__tablist", role: "tablist", "aria-label": this.tablistLabel }, hAsync("slot", { key: '1fcbefc41181ce48f2a109ee0703d03f9975784f', name: "tabs" })), hAsync("slot", { key: '9762d5533cbbea5672f2a4235b90b3a766066179', name: "tabpanels" })));
|
|
8198
10641
|
}
|
|
8199
10642
|
get el() { return getElement(this); }
|
|
8200
10643
|
static get style() { return pdsTabsCss; }
|
|
@@ -8234,7 +10677,7 @@ class PdsText {
|
|
|
8234
10677
|
${this.weight !== undefined && this.weight.trim() !== '' ? `pds-text--weight-${this.weight}` : ''}
|
|
8235
10678
|
${this.decoration !== undefined && this.decoration.trim() !== '' ? `pds-text--decoration-${this.decoration}` : ''}
|
|
8236
10679
|
`;
|
|
8237
|
-
return (hAsync(Tag, { key: '
|
|
10680
|
+
return (hAsync(Tag, { key: 'dbb51692cc782fcef771390934ca6efc7a2728b9', style: this.color && setColor(this.color), class: typeClasses }, hAsync("slot", { key: '9e7351a9de468132a213f3e26c20c8ca894881a8' })));
|
|
8238
10681
|
}
|
|
8239
10682
|
get el() { return getElement(this); }
|
|
8240
10683
|
static get style() { return pdsTextCss; }
|
|
@@ -8250,11 +10693,11 @@ class PdsText {
|
|
|
8250
10693
|
"size": [1],
|
|
8251
10694
|
"weight": [1],
|
|
8252
10695
|
"tag": [1],
|
|
8253
|
-
"truncate": [
|
|
10696
|
+
"truncate": [516]
|
|
8254
10697
|
},
|
|
8255
10698
|
"$listeners$": undefined,
|
|
8256
10699
|
"$lazyBundleId$": "-",
|
|
8257
|
-
"$attrsToReflect$": []
|
|
10700
|
+
"$attrsToReflect$": [["truncate", "truncate"]]
|
|
8258
10701
|
}; }
|
|
8259
10702
|
}
|
|
8260
10703
|
|
|
@@ -8380,17 +10823,17 @@ class PdsTextarea {
|
|
|
8380
10823
|
this.debounceChanged();
|
|
8381
10824
|
}
|
|
8382
10825
|
componentWillLoad() {
|
|
8383
|
-
this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el)), inheritAttributes(this.el));
|
|
10826
|
+
this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el)), inheritAttributes$1(this.el));
|
|
8384
10827
|
}
|
|
8385
10828
|
componentDidLoad() {
|
|
8386
10829
|
this.originalPdsInput = this.pdsInput;
|
|
8387
10830
|
}
|
|
8388
10831
|
render() {
|
|
8389
10832
|
const value = this.getValue();
|
|
8390
|
-
return (hAsync(Host, { key: '
|
|
8391
|
-
hAsync("label", { key: '
|
|
8392
|
-
hAsync("p", { key: '
|
|
8393
|
-
hAsync("p", { key: '
|
|
10833
|
+
return (hAsync(Host, { key: 'a7db5e94c424af94616faae520aa8f39ee23cedd', "aria-disabled": this.disabled ? 'true' : null, "aria-readonly": this.readonly ? 'true' : null }, hAsync("div", { key: '26c4a0b5e464e648f627c6de6d948a159e1b4603', class: "pds-textarea" }, this.label &&
|
|
10834
|
+
hAsync("label", { key: 'b32a15274079ba8fdb4d911dfc4915da9437a57a', htmlFor: this.componentId }, this.label), hAsync("textarea", Object.assign({ key: '6348ed57813a044849a8de53a172f9f724d7b00e', ref: (el) => this.nativeTextarea = el, "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, class: this.textareaClassNames(), disabled: this.disabled, id: this.componentId, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, rows: this.rows, onBlur: this.onBlur, onChange: this.onTextareaChange, onFocus: this.onFocus, onInput: this.onInput }, this.inheritedAttributes), value), this.helperMessage &&
|
|
10835
|
+
hAsync("p", { key: '0f9a7606295b5d020e4762f2dc66bc920a60f8da', class: "pds-textarea__helper-message", id: messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
|
|
10836
|
+
hAsync("p", { key: 'badc7d45069955709993c594ed9792c7cdc8727b', "aria-live": "assertive", class: "pds-textarea__error-message", id: messageId(this.componentId, 'error') }, hAsync("pds-icon", { key: '460955036713315d8dd7b125a50b09d0cb1a282d', icon: danger, size: "small" }), this.errorMessage))));
|
|
8394
10837
|
}
|
|
8395
10838
|
get el() { return getElement(this); }
|
|
8396
10839
|
static get watchers() { return {
|
|
@@ -8425,75 +10868,205 @@ class PdsTextarea {
|
|
|
8425
10868
|
}; }
|
|
8426
10869
|
}
|
|
8427
10870
|
|
|
10871
|
+
const pdsToastCss = ":host{--animation-duration:0.3s;--animation-timing:cubic-bezier(0.4, 0, 0.2, 1);--padding-inline:var(--pine-dimension-md);--padding-inline-desktop:var(--pine-dimension-2xl);--sizing-height-default:68px;--sizing-min-width:calc(var(--sizing-total-width) - (var(--padding-inline) * 2));--sizing-min-width-desktop:calc(var(--sizing-total-width) - (var(--padding-inline-desktop) * 2));--sizing-total-width:350px;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;font:var(--pine-typography-body-medium)}.pds-toast{-ms-flex-align:center;align-items:center;-webkit-animation:pds-toast-animate-in var(--animation-duration) var(--animation-timing);animation:pds-toast-animate-in var(--animation-duration) var(--animation-timing);background-color:var(--pine-color-primary);border-radius:var(--pine-dimension-xs);-webkit-box-shadow:var(--pine-box-shadow);box-shadow:var(--pine-box-shadow);color:var(--pine-color-text-primary);display:-ms-flexbox;display:flex;height:var(--sizing-height-default);-ms-flex-pack:start;justify-content:flex-start;-webkit-margin-after:var(--pine-dimension-2xs);margin-block-end:var(--pine-dimension-2xs);max-width:90vw;min-width:var(--sizing-min-width);padding:0 var(--padding-inline);position:relative;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}@media screen and (max-width: 767px){.pds-toast{height:36px;max-width:calc(100vw - var(--pine-dimension-2xs) * 2);min-width:auto;padding-inline:var(--pine-dimension-2xs)}}.pds-toast--danger{background-color:var(--pine-color-danger)}.pds-toast--loading .pds-toast__loader{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-webkit-margin-end:var(--pine-dimension-sm);margin-inline-end:var(--pine-dimension-sm);position:relative}.pds-toast--loading .pds-toast__loader-spinner{-webkit-animation:pds-toast-rotate 2s linear infinite;animation:pds-toast-rotate 2s linear infinite;height:20px;width:20px}.pds-toast--loading .pds-toast__loader-path{-webkit-animation:pds-toast-dash 1.5s ease-in-out infinite;animation:pds-toast-dash 1.5s ease-in-out infinite;stroke-dasharray:1, 200;stroke-dashoffset:0;stroke-linecap:round}.pds-toast__icon{color:var(--pine-color-text-primary);display:-ms-inline-flexbox;display:inline-flex;-webkit-margin-end:var(--pine-dimension-sm);margin-inline-end:var(--pine-dimension-sm)}.pds-toast__message{font:var(--pine-typography-body-sm-medium);-webkit-margin-end:auto;margin-inline-end:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pds-toast__message ::slotted(a){color:var(--pine-color-text-primary);-webkit-margin-start:var(--pine-dimension-xs);margin-inline-start:var(--pine-dimension-xs);opacity:0.7;text-decoration:underline}.pds-toast__message ::slotted(a):hover,.pds-toast__message ::slotted(a):focus-visible{opacity:1}.pds-toast__message ::slotted(a):focus-visible{outline:2px solid var(--pine-color-text-primary);outline-offset:2px}.pds-toast__button{-ms-flex-align:center;align-items:center;background:none;border:0;border-radius:var(--pine-border-radius-full);color:inherit;cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-webkit-margin-start:var(--pine-dimension-md);margin-inline-start:var(--pine-dimension-md);opacity:0.7;padding:0;white-space:nowrap}.pds-toast__button:hover,.pds-toast__button:focus{opacity:1}.pds-toast__button:focus{outline:var(--pine-outline-focus);outline-offset:var(--pine-dimension-2xs)}@-webkit-keyframes pds-toast-animate-in{from{opacity:0;-webkit-transform:translateY(100%);transform:translateY(100%)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes pds-toast-animate-in{from{opacity:0;-webkit-transform:translateY(100%);transform:translateY(100%)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes pds-toast-animate-out{from{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}to{opacity:0;-webkit-transform:translateY(100%);transform:translateY(100%)}}@keyframes pds-toast-animate-out{from{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}to{opacity:0;-webkit-transform:translateY(100%);transform:translateY(100%)}}@-webkit-keyframes pds-toast-rotate{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes pds-toast-rotate{to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes pds-toast-dash{0%{stroke-dasharray:1, 200;stroke-dashoffset:0}50%{stroke-dasharray:89, 200;stroke-dashoffset:-35}100%{stroke-dasharray:89, 200;stroke-dashoffset:-124}}@keyframes pds-toast-dash{0%{stroke-dasharray:1, 200;stroke-dashoffset:0}50%{stroke-dasharray:89, 200;stroke-dashoffset:-35}100%{stroke-dasharray:89, 200;stroke-dashoffset:-124}}:host([hidden]) .pds-toast,.pds-toast--animating-out{-webkit-animation:pds-toast-animate-out var(--animation-duration) var(--animation-timing) forwards;animation:pds-toast-animate-out var(--animation-duration) var(--animation-timing) forwards;pointer-events:none;}";
|
|
10872
|
+
|
|
10873
|
+
class PdsToast {
|
|
10874
|
+
constructor(hostRef) {
|
|
10875
|
+
registerInstance(this, hostRef);
|
|
10876
|
+
this.pdsToastDismissed = createEvent(this, "pdsToastDismissed");
|
|
10877
|
+
/**
|
|
10878
|
+
* Whether the toast can be dismissed manually via the close button.
|
|
10879
|
+
* Note: This only controls manual dismissal. Auto-dismissal via duration still applies.
|
|
10880
|
+
* @default true
|
|
10881
|
+
*/
|
|
10882
|
+
this.dismissible = true;
|
|
10883
|
+
/**
|
|
10884
|
+
* The duration in milliseconds to show the toast before auto-dismissing.
|
|
10885
|
+
* Set to 0 to disable auto-dismiss.
|
|
10886
|
+
* @default 4500
|
|
10887
|
+
*/
|
|
10888
|
+
this.duration = 4500;
|
|
10889
|
+
/**
|
|
10890
|
+
* The type of toast to display.
|
|
10891
|
+
* - default: Grey background (default)
|
|
10892
|
+
* - danger: Red background
|
|
10893
|
+
* - loading: With spinner animation
|
|
10894
|
+
* @default 'default'
|
|
10895
|
+
*/
|
|
10896
|
+
this.type = 'default';
|
|
10897
|
+
/**
|
|
10898
|
+
* Whether the toast is currently visible.
|
|
10899
|
+
*/
|
|
10900
|
+
this.isVisible = true;
|
|
10901
|
+
/**
|
|
10902
|
+
* Whether the toast is animating out.
|
|
10903
|
+
*/
|
|
10904
|
+
this.isAnimatingOut = false;
|
|
10905
|
+
}
|
|
10906
|
+
componentDidLoad() {
|
|
10907
|
+
if (this.duration > 0) {
|
|
10908
|
+
this.startDismissTimer();
|
|
10909
|
+
}
|
|
10910
|
+
}
|
|
10911
|
+
disconnectedCallback() {
|
|
10912
|
+
this.cleanup();
|
|
10913
|
+
}
|
|
10914
|
+
handleDurationChange(newDuration) {
|
|
10915
|
+
if (this.dismissTimer) {
|
|
10916
|
+
window.clearTimeout(this.dismissTimer);
|
|
10917
|
+
this.dismissTimer = undefined;
|
|
10918
|
+
}
|
|
10919
|
+
if (newDuration > 0) {
|
|
10920
|
+
this.startDismissTimer();
|
|
10921
|
+
}
|
|
10922
|
+
}
|
|
10923
|
+
async dismiss() {
|
|
10924
|
+
// Start the animation out
|
|
10925
|
+
this.isAnimatingOut = true;
|
|
10926
|
+
// Wait for animation to complete before hiding and cleanup
|
|
10927
|
+
await new Promise((resolve) => setTimeout(resolve, 300)); // Match --animation-duration
|
|
10928
|
+
this.isVisible = false;
|
|
10929
|
+
this.cleanup();
|
|
10930
|
+
this.pdsToastDismissed.emit({ componentId: this.componentId });
|
|
10931
|
+
}
|
|
10932
|
+
// Private methods
|
|
10933
|
+
cleanup() {
|
|
10934
|
+
if (this.dismissTimer) {
|
|
10935
|
+
window.clearTimeout(this.dismissTimer);
|
|
10936
|
+
this.dismissTimer = undefined;
|
|
10937
|
+
}
|
|
10938
|
+
}
|
|
10939
|
+
startDismissTimer() {
|
|
10940
|
+
this.dismissTimer = window.setTimeout(() => {
|
|
10941
|
+
this.dismiss();
|
|
10942
|
+
}, this.duration);
|
|
10943
|
+
}
|
|
10944
|
+
renderIcon() {
|
|
10945
|
+
// Loading type takes priority
|
|
10946
|
+
if (this.type === 'loading') {
|
|
10947
|
+
return (hAsync("div", { class: "pds-toast__loader" }, hAsync("svg", { class: "pds-toast__loader-spinner", viewBox: "25 25 50 50", "aria-hidden": "true" }, hAsync("circle", { class: "pds-toast__loader-path", cx: "50", cy: "50", r: "20", fill: "none", stroke: "currentColor", "stroke-width": "4", "stroke-linecap": "round" }))));
|
|
10948
|
+
}
|
|
10949
|
+
// Return icon if provided, otherwise undefined (which renders as nothing)
|
|
10950
|
+
return this.icon && hAsync("pds-icon", { name: this.icon, class: "pds-toast__icon" });
|
|
10951
|
+
}
|
|
10952
|
+
render() {
|
|
10953
|
+
return (hAsync(Host, { key: 'c950cf3a269952f6048f79e5c6c793c65ff2b89a', hidden: !this.isVisible }, hAsync("div", { key: '0cec10124aecec0c7af86b460165a577c65d1571', class: {
|
|
10954
|
+
'pds-toast': true,
|
|
10955
|
+
[`pds-toast--${this.type}`]: this.type !== 'default',
|
|
10956
|
+
'pds-toast--animating-out': this.isAnimatingOut
|
|
10957
|
+
}, role: "alert", "aria-live": "polite" }, this.renderIcon(), hAsync("span", { key: '5dda529f788df94ed0e444924fb11a1061a20dd1', class: "pds-toast__message" }, hAsync("slot", { key: '29a6c93dbf14f92b1375eff7a3c8f4556babe67a' })), this.dismissible && (hAsync("button", { key: 'f3bcbcacceb5ef2b1d2127d408879e2a95418230', type: "button", class: "pds-toast__button", onClick: () => {
|
|
10958
|
+
this.dismiss();
|
|
10959
|
+
}, "aria-label": "Dismiss message" }, hAsync("pds-icon", { key: '1ea48def81a89dc7ba38f493abb0107632005075', name: "remove" }))))));
|
|
10960
|
+
}
|
|
10961
|
+
static get watchers() { return {
|
|
10962
|
+
"duration": ["handleDurationChange"]
|
|
10963
|
+
}; }
|
|
10964
|
+
static get style() { return pdsToastCss; }
|
|
10965
|
+
static get cmpMeta() { return {
|
|
10966
|
+
"$flags$": 9,
|
|
10967
|
+
"$tagName$": "pds-toast",
|
|
10968
|
+
"$members$": {
|
|
10969
|
+
"componentId": [1, "component-id"],
|
|
10970
|
+
"dismissible": [4],
|
|
10971
|
+
"duration": [2],
|
|
10972
|
+
"icon": [1],
|
|
10973
|
+
"type": [1],
|
|
10974
|
+
"isVisible": [32],
|
|
10975
|
+
"isAnimatingOut": [32],
|
|
10976
|
+
"dismiss": [64]
|
|
10977
|
+
},
|
|
10978
|
+
"$listeners$": undefined,
|
|
10979
|
+
"$lazyBundleId$": "-",
|
|
10980
|
+
"$attrsToReflect$": []
|
|
10981
|
+
}; }
|
|
10982
|
+
}
|
|
10983
|
+
|
|
8428
10984
|
const positionTooltip = ({ elem, elemPlacement, overlay, offset = 8 }) => {
|
|
8429
|
-
if (elem
|
|
8430
|
-
return;
|
|
10985
|
+
if (elem === null || overlay === null)
|
|
10986
|
+
return false;
|
|
10987
|
+
if (typeof elemPlacement !== 'string' || elemPlacement.trim() === '') {
|
|
10988
|
+
return false;
|
|
10989
|
+
}
|
|
8431
10990
|
const rect = elem.getBoundingClientRect();
|
|
8432
10991
|
const contentRect = overlay.getBoundingClientRect();
|
|
8433
|
-
//
|
|
8434
|
-
|
|
8435
|
-
|
|
10992
|
+
// Reset styles
|
|
10993
|
+
overlay.style.top = '';
|
|
10994
|
+
overlay.style.left = '';
|
|
10995
|
+
overlay.style.right = '';
|
|
10996
|
+
overlay.style.bottom = '';
|
|
10997
|
+
overlay.style.transform = '';
|
|
10998
|
+
// Use fixed positioning for portal overlays
|
|
10999
|
+
overlay.style.position = 'fixed';
|
|
11000
|
+
// Detect if the trigger is a span with only text or a text node
|
|
11001
|
+
let isTextTrigger = false;
|
|
11002
|
+
if (elem.childNodes.length === 1 && elem.childNodes[0].nodeType === Node.TEXT_NODE) {
|
|
11003
|
+
isTextTrigger = true;
|
|
11004
|
+
}
|
|
11005
|
+
else if (elem.childNodes.length === 1 && elem.childNodes[0].nodeType === Node.ELEMENT_NODE) {
|
|
11006
|
+
const child = elem.childNodes[0];
|
|
11007
|
+
if (child.tagName === 'SPAN' && child.childNodes.length === 1 && child.childNodes[0].nodeType === Node.TEXT_NODE) {
|
|
11008
|
+
isTextTrigger = true;
|
|
11009
|
+
}
|
|
11010
|
+
}
|
|
8436
11011
|
switch (true) {
|
|
8437
|
-
case elemPlacement.includes(
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
overlay.style.
|
|
11012
|
+
case elemPlacement.includes('right'):
|
|
11013
|
+
if (isTextTrigger) {
|
|
11014
|
+
// Align to the bottom of the trigger for text triggers
|
|
11015
|
+
overlay.style.top = `${rect.bottom - contentRect.height / 2}px`;
|
|
11016
|
+
}
|
|
11017
|
+
else {
|
|
11018
|
+
overlay.style.top = `${rect.top + rect.height / 2 - contentRect.height / 2}px`;
|
|
8444
11019
|
}
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
overlay.style.top =
|
|
8448
|
-
|
|
11020
|
+
overlay.style.left = `${rect.right + offset}px`;
|
|
11021
|
+
if (elemPlacement.includes('start')) {
|
|
11022
|
+
overlay.style.top = `${rect.top}px`;
|
|
11023
|
+
}
|
|
11024
|
+
if (elemPlacement.includes('end')) {
|
|
11025
|
+
overlay.style.top = `${rect.bottom - contentRect.height}px`;
|
|
8449
11026
|
}
|
|
8450
11027
|
break;
|
|
8451
|
-
case elemPlacement.includes(
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
overlay.style.top =
|
|
8457
|
-
|
|
11028
|
+
case elemPlacement.includes('left'):
|
|
11029
|
+
if (isTextTrigger) {
|
|
11030
|
+
overlay.style.top = `${rect.bottom - contentRect.height / 2}px`;
|
|
11031
|
+
}
|
|
11032
|
+
else {
|
|
11033
|
+
overlay.style.top = `${rect.top + rect.height / 2 - contentRect.height / 2}px`;
|
|
11034
|
+
}
|
|
11035
|
+
overlay.style.left = `${rect.left - contentRect.width - offset}px`;
|
|
11036
|
+
if (elemPlacement.includes('start')) {
|
|
11037
|
+
overlay.style.top = `${rect.top}px`;
|
|
8458
11038
|
}
|
|
8459
|
-
if (elemPlacement.includes(
|
|
8460
|
-
overlay.style.
|
|
8461
|
-
overlay.style.top = 'initial';
|
|
8462
|
-
overlay.style.transform = 'translateY(0)';
|
|
11039
|
+
if (elemPlacement.includes('end')) {
|
|
11040
|
+
overlay.style.top = `${rect.bottom - contentRect.height}px`;
|
|
8463
11041
|
}
|
|
8464
11042
|
break;
|
|
8465
|
-
case elemPlacement.includes(
|
|
8466
|
-
overlay.style.top =
|
|
8467
|
-
overlay.style.left =
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
overlay.style.left = '0';
|
|
8471
|
-
overlay.style.transform = 'translateX(0)';
|
|
11043
|
+
case elemPlacement.includes('bottom'):
|
|
11044
|
+
overlay.style.top = `${rect.bottom + offset}px`;
|
|
11045
|
+
overlay.style.left = `${rect.left + rect.width / 2 - contentRect.width / 2}px`;
|
|
11046
|
+
if (elemPlacement.includes('start')) {
|
|
11047
|
+
overlay.style.left = `${rect.left}px`;
|
|
8472
11048
|
}
|
|
8473
|
-
if (elemPlacement.includes(
|
|
8474
|
-
overlay.style.left =
|
|
8475
|
-
overlay.style.right = '
|
|
8476
|
-
overlay.style.transform = 'translateX(0)';
|
|
11049
|
+
if (elemPlacement.includes('end')) {
|
|
11050
|
+
overlay.style.left = `${rect.right - contentRect.width}px`;
|
|
11051
|
+
overlay.style.right = 'initial';
|
|
8477
11052
|
}
|
|
8478
11053
|
break;
|
|
8479
|
-
case elemPlacement.includes(
|
|
8480
|
-
overlay.style.top =
|
|
8481
|
-
overlay.style.left =
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
overlay.style.left = '0';
|
|
8485
|
-
overlay.style.transform = 'translateX(0)';
|
|
11054
|
+
case elemPlacement.includes('top'):
|
|
11055
|
+
overlay.style.top = `${rect.top - contentRect.height - offset}px`;
|
|
11056
|
+
overlay.style.left = `${rect.left + rect.width / 2 - contentRect.width / 2}px`;
|
|
11057
|
+
if (elemPlacement.includes('start')) {
|
|
11058
|
+
overlay.style.left = `${rect.left}px`;
|
|
8486
11059
|
}
|
|
8487
|
-
if (elemPlacement.includes(
|
|
8488
|
-
overlay.style.left =
|
|
8489
|
-
overlay.style.right = '
|
|
8490
|
-
overlay.style.transform = 'translateX(0)';
|
|
11060
|
+
if (elemPlacement.includes('end')) {
|
|
11061
|
+
overlay.style.left = `${rect.right - contentRect.width}px`;
|
|
11062
|
+
overlay.style.right = 'initial';
|
|
8491
11063
|
}
|
|
8492
11064
|
break;
|
|
8493
11065
|
}
|
|
11066
|
+
return true;
|
|
8494
11067
|
};
|
|
8495
11068
|
|
|
8496
|
-
const pdsTooltipCss = "
|
|
11069
|
+
const pdsTooltipCss = ".pds-tooltip{--tooltip-border-width-arrow-down:var(--tooltip-sizing-arrow) var(--tooltip-sizing-arrow) 0;--tooltip-border-width-arrow-left:var(--tooltip-sizing-arrow) var(--tooltip-sizing-arrow) var(--tooltip-sizing-arrow) 0;--tooltip-border-width-arrow-right:var(--tooltip-sizing-arrow) 0 var(--tooltip-sizing-arrow) var(--tooltip-sizing-arrow);--tooltip-border-width-arrow-up:0 var(--tooltip-sizing-arrow) var(--tooltip-sizing-arrow);--tooltip-sizing-arrow:6px;--tooltip-sizing-arrow-offset:14px;--tooltip-dimension-max-width:320px}.pds-tooltip__content{background-color:var(--pine-color-primary);border-radius:calc(var(--pine-dimension-xs) * 1.25);-webkit-box-shadow:var(--pine-box-shadow);box-shadow:var(--pine-box-shadow);color:var(--pine-color-text-primary);max-width:var(--tooltip-dimension-max-width);opacity:0;padding:var(--pine-dimension-xs) calc(var(--pine-dimension-md) / 2);position:absolute;visibility:hidden;width:-webkit-max-content;width:-moz-max-content;width:max-content}.pds-tooltip--is-open .pds-tooltip__content{opacity:1;visibility:visible;z-index:1}.pds-tooltip.pds-tooltip--has-html-content .pds-tooltip__content{width:auto}.pds-tooltip__content::after{border-color:transparent;border-right-color:transparent;border-style:solid;border-width:var(--tooltip-border-width-arrow-left);content:\"\";height:0;position:absolute;width:0}.pds-tooltip--right .pds-tooltip__content::after{border-inline-end-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-left);left:calc(var(--tooltip-sizing-arrow) * -1);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.pds-tooltip--right-end .pds-tooltip__content::after{border-inline-end-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-left);bottom:var(--tooltip-sizing-arrow-offset);left:calc(var(--tooltip-sizing-arrow) * -1);top:initial}.pds-tooltip--right-start .pds-tooltip__content::after{border-inline-end-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-left);left:calc(var(--tooltip-sizing-arrow) * -1);top:var(--tooltip-sizing-arrow-offset)}.pds-tooltip--top .pds-tooltip__content::after{border-block-start-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-down);bottom:calc(var(--tooltip-sizing-arrow) * -1);left:50%;top:initial;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.pds-tooltip--top-start .pds-tooltip__content::after{border-block-start-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-down);bottom:calc(var(--tooltip-sizing-arrow) * -1);left:var(--tooltip-sizing-arrow-offset);top:initial}.pds-tooltip--top-end .pds-tooltip__content::after{border-block-start-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-down);bottom:calc(var(--tooltip-sizing-arrow) * -1);left:initial;right:var(--tooltip-sizing-arrow-offset);top:initial}.pds-tooltip--left .pds-tooltip__content::after{border-inline-start-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-right);left:initial;right:calc(var(--tooltip-sizing-arrow) * -1);top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.pds-tooltip--left-end .pds-tooltip__content::after{border-inline-start-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-right);bottom:var(--tooltip-sizing-arrow-offset);left:initial;right:calc(var(--tooltip-sizing-arrow) * -1);top:initial}.pds-tooltip--left-start .pds-tooltip__content::after{border-inline-start-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-right);left:initial;right:calc(var(--tooltip-sizing-arrow) * -1);top:var(--tooltip-sizing-arrow-offset)}.pds-tooltip--bottom .pds-tooltip__content::after{border-block-end-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-up);left:50%;top:calc(var(--tooltip-sizing-arrow) * -1);-webkit-transform:translateX(-50%);transform:translateX(-50%)}.pds-tooltip--bottom-end .pds-tooltip__content::after{border-block-end-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-up);left:initial;right:var(--tooltip-sizing-arrow-offset);top:calc(var(--tooltip-sizing-arrow) * -1)}.pds-tooltip--bottom-start .pds-tooltip__content::after{border-block-end-color:var(--pine-color-primary);border-width:var(--tooltip-border-width-arrow-up);left:var(--tooltip-sizing-arrow-offset);top:calc(var(--tooltip-sizing-arrow) * -1)}.pds-tooltip--no-arrow .pds-tooltip__content::after{border-width:0}";
|
|
8497
11070
|
|
|
8498
11071
|
/**
|
|
8499
11072
|
* @slot (default) - The tooltip's target element
|
|
@@ -8502,6 +11075,16 @@ const pdsTooltipCss = ":host{--tooltip-border-width-arrow-down:var(--tooltip-siz
|
|
|
8502
11075
|
class PdsTooltip {
|
|
8503
11076
|
constructor(hostRef) {
|
|
8504
11077
|
registerInstance(this, hostRef);
|
|
11078
|
+
/**
|
|
11079
|
+
* Internal state: true if the tooltip was opened by user interaction (hover/focus),
|
|
11080
|
+
* false if opened via the `opened` prop or currently closed.
|
|
11081
|
+
*/
|
|
11082
|
+
this._isInteractiveOpen = false;
|
|
11083
|
+
this.portalEl = null;
|
|
11084
|
+
this.triggerEl = null;
|
|
11085
|
+
this.contentDiv = null;
|
|
11086
|
+
this.slotMutationObserver = null;
|
|
11087
|
+
this.overlayResizeObserver = null;
|
|
8505
11088
|
/**
|
|
8506
11089
|
* Determines when the tooltip is open
|
|
8507
11090
|
* @defaultValue false
|
|
@@ -8533,44 +11116,80 @@ class PdsTooltip {
|
|
|
8533
11116
|
*/
|
|
8534
11117
|
this.opened = false;
|
|
8535
11118
|
this.handleHide = () => {
|
|
11119
|
+
if (this.opened && !this._isInteractiveOpen) {
|
|
11120
|
+
return;
|
|
11121
|
+
}
|
|
8536
11122
|
this.hideTooltip();
|
|
11123
|
+
this._isInteractiveOpen = false;
|
|
8537
11124
|
};
|
|
8538
11125
|
this.handleShow = () => {
|
|
11126
|
+
if (this.opened && !this._isInteractiveOpen) {
|
|
11127
|
+
return;
|
|
11128
|
+
}
|
|
11129
|
+
this._isInteractiveOpen = true;
|
|
8539
11130
|
this.showTooltip();
|
|
8540
11131
|
};
|
|
8541
11132
|
this.handlePageShow = () => {
|
|
11133
|
+
if (this.opened && !this._isInteractiveOpen) {
|
|
11134
|
+
return;
|
|
11135
|
+
}
|
|
8542
11136
|
this.opened = false;
|
|
11137
|
+
this._isInteractiveOpen = false;
|
|
11138
|
+
};
|
|
11139
|
+
this.handleScroll = () => {
|
|
11140
|
+
if (this.opened) {
|
|
11141
|
+
if (!this._isInteractiveOpen) {
|
|
11142
|
+
this.repositionPortal();
|
|
11143
|
+
}
|
|
11144
|
+
else {
|
|
11145
|
+
this.hideTooltip();
|
|
11146
|
+
this._isInteractiveOpen = false;
|
|
11147
|
+
}
|
|
11148
|
+
}
|
|
11149
|
+
};
|
|
11150
|
+
this.handleSpaNavigation = () => {
|
|
11151
|
+
if (this.opened && !this._isInteractiveOpen) {
|
|
11152
|
+
return;
|
|
11153
|
+
}
|
|
11154
|
+
this.hideTooltip();
|
|
11155
|
+
this._isInteractiveOpen = false;
|
|
8543
11156
|
};
|
|
8544
11157
|
}
|
|
8545
|
-
handleOpenToggle() {
|
|
8546
|
-
if (
|
|
8547
|
-
this.
|
|
8548
|
-
}
|
|
8549
|
-
else {
|
|
8550
|
-
this.handleHide();
|
|
11158
|
+
handleOpenToggle(newValue, oldValue) {
|
|
11159
|
+
if (newValue === false && oldValue === true) {
|
|
11160
|
+
this._isInteractiveOpen = false;
|
|
8551
11161
|
}
|
|
8552
11162
|
}
|
|
8553
11163
|
componentWillLoad() {
|
|
8554
|
-
|
|
8555
|
-
this.showTooltip();
|
|
8556
|
-
}
|
|
8557
|
-
this.el.addEventListener('blur', this.handleHide, true);
|
|
8558
|
-
this.el.addEventListener('focus', this.handleShow, true);
|
|
11164
|
+
this._isInteractiveOpen = false;
|
|
8559
11165
|
}
|
|
8560
11166
|
componentDidLoad() {
|
|
8561
|
-
// fix for Safari iOS back button issue
|
|
8562
11167
|
window.addEventListener('pageshow', this.handlePageShow);
|
|
11168
|
+
this.triggerEl = this.el.querySelector('.pds-tooltip__trigger');
|
|
11169
|
+
const contentSlotWrapper = this.el.querySelector('.pds-tooltip__content-slot-wrapper');
|
|
11170
|
+
if (contentSlotWrapper !== null) {
|
|
11171
|
+
this.slotMutationObserver = new MutationObserver(() => {
|
|
11172
|
+
if (this.opened && this.portalEl !== null) {
|
|
11173
|
+
this.removePortal();
|
|
11174
|
+
this.createPortal();
|
|
11175
|
+
}
|
|
11176
|
+
});
|
|
11177
|
+
this.slotMutationObserver.observe(contentSlotWrapper, { childList: true, subtree: false });
|
|
11178
|
+
}
|
|
8563
11179
|
return () => {
|
|
8564
11180
|
window.removeEventListener('pageshow', this.handlePageShow);
|
|
11181
|
+
if (this.slotMutationObserver !== null) {
|
|
11182
|
+
this.slotMutationObserver.disconnect();
|
|
11183
|
+
}
|
|
8565
11184
|
};
|
|
8566
11185
|
}
|
|
8567
|
-
componentDidUpdate() {
|
|
8568
|
-
if (this.opened) {
|
|
8569
|
-
this.showTooltip();
|
|
8570
|
-
}
|
|
8571
|
-
}
|
|
8572
11186
|
componentDidRender() {
|
|
8573
|
-
|
|
11187
|
+
if (this.opened && this.portalEl === null) {
|
|
11188
|
+
this.createPortal();
|
|
11189
|
+
}
|
|
11190
|
+
else if (!this.opened && this.portalEl !== null) {
|
|
11191
|
+
this.removePortal();
|
|
11192
|
+
}
|
|
8574
11193
|
}
|
|
8575
11194
|
/**
|
|
8576
11195
|
* Shows the tooltip by enabling the opened property
|
|
@@ -8584,14 +11203,152 @@ class PdsTooltip {
|
|
|
8584
11203
|
async hideTooltip() {
|
|
8585
11204
|
this.opened = false;
|
|
8586
11205
|
}
|
|
11206
|
+
/**
|
|
11207
|
+
* Determines the most accurate HTML element to use as the anchor for positioning the tooltip.
|
|
11208
|
+
* If `htmlContent` is false, it attempts to find the actual element slotted as the trigger.
|
|
11209
|
+
* Otherwise, or if no specific element is found, it defaults to the span wrapper around the trigger slot.
|
|
11210
|
+
* This helps with precise alignment.
|
|
11211
|
+
*/
|
|
11212
|
+
determinePositioningAnchor() {
|
|
11213
|
+
let positioningAnchor = this.triggerEl;
|
|
11214
|
+
if (this.triggerEl !== null) {
|
|
11215
|
+
const children = this.triggerEl.childNodes;
|
|
11216
|
+
for (let i = 0; i < children.length; i++) {
|
|
11217
|
+
const childNode = children[i];
|
|
11218
|
+
if (childNode.nodeType === Node.ELEMENT_NODE) {
|
|
11219
|
+
positioningAnchor = childNode;
|
|
11220
|
+
break; // Found the first element, use it as the anchor
|
|
11221
|
+
}
|
|
11222
|
+
}
|
|
11223
|
+
}
|
|
11224
|
+
// If no ELEMENT_NODE is found within this.triggerEl (e.g., if trigger is just text),
|
|
11225
|
+
// positioningAnchor will correctly remain this.triggerEl (the span).
|
|
11226
|
+
return positioningAnchor;
|
|
11227
|
+
}
|
|
11228
|
+
/**
|
|
11229
|
+
* Centralized method to calculate and apply the tooltip's position.
|
|
11230
|
+
* Uses the determined anchor element and the current content dimensions.
|
|
11231
|
+
*/
|
|
11232
|
+
repositionPortal() {
|
|
11233
|
+
const anchor = this.determinePositioningAnchor();
|
|
11234
|
+
if (anchor !== null && this.contentDiv !== null) {
|
|
11235
|
+
positionTooltip({ elem: anchor, elemPlacement: this.placement, overlay: this.contentDiv });
|
|
11236
|
+
const placementParts = this.placement.split('-');
|
|
11237
|
+
const primaryPlacement = placementParts[0];
|
|
11238
|
+
const isCardinalCenterPlacement = placementParts.length === 1;
|
|
11239
|
+
if (isCardinalCenterPlacement) {
|
|
11240
|
+
const anchorRect = anchor.getBoundingClientRect();
|
|
11241
|
+
const overlayRect = this.contentDiv.getBoundingClientRect();
|
|
11242
|
+
if (primaryPlacement === 'left' || primaryPlacement === 'right') {
|
|
11243
|
+
const currentOverlayTop = parseFloat(this.contentDiv.style.top || '0');
|
|
11244
|
+
const anchorCenterY = anchorRect.top + (anchorRect.height / 2);
|
|
11245
|
+
const overlayCenterY = overlayRect.top + (overlayRect.height / 2);
|
|
11246
|
+
const adjustmentY = anchorCenterY - overlayCenterY;
|
|
11247
|
+
if (Math.abs(adjustmentY) > 0.5) {
|
|
11248
|
+
this.contentDiv.style.top = `${currentOverlayTop + adjustmentY}px`;
|
|
11249
|
+
}
|
|
11250
|
+
}
|
|
11251
|
+
else if (primaryPlacement === 'top' || primaryPlacement === 'bottom') {
|
|
11252
|
+
const currentOverlayLeft = parseFloat(this.contentDiv.style.left || '0');
|
|
11253
|
+
const anchorCenterX = anchorRect.left + (anchorRect.width / 2);
|
|
11254
|
+
const overlayCenterX = overlayRect.left + (overlayRect.width / 2);
|
|
11255
|
+
const adjustmentX = anchorCenterX - overlayCenterX;
|
|
11256
|
+
if (Math.abs(adjustmentX) > 0.5) {
|
|
11257
|
+
this.contentDiv.style.left = `${currentOverlayLeft + adjustmentX}px`;
|
|
11258
|
+
}
|
|
11259
|
+
}
|
|
11260
|
+
}
|
|
11261
|
+
}
|
|
11262
|
+
}
|
|
11263
|
+
createPortal() {
|
|
11264
|
+
if (this.portalEl !== null)
|
|
11265
|
+
return;
|
|
11266
|
+
this.portalEl = document.createElement('div');
|
|
11267
|
+
this.portalEl.className = `pds-tooltip pds-tooltip--${this.placement} ${this.htmlContent ? 'pds-tooltip--has-html-content' : ''} ${this.opened ? 'pds-tooltip--is-open' : ''} ${this.hasArrow ? '' : 'pds-tooltip--no-arrow'}`;
|
|
11268
|
+
this.portalEl.style.position = 'fixed';
|
|
11269
|
+
this.portalEl.style.zIndex = '9999';
|
|
11270
|
+
if (this.portalEl.id === '') {
|
|
11271
|
+
this.portalEl.id = this.componentId || this.el.id || `pds-tooltip-portal-${PdsTooltip.instanceCounter++}`;
|
|
11272
|
+
}
|
|
11273
|
+
if (this.portalEl.getAttribute('id') !== this.portalEl.id) {
|
|
11274
|
+
this.portalEl.setAttribute('id', this.portalEl.id);
|
|
11275
|
+
}
|
|
11276
|
+
this.portalEl.setAttribute('role', 'tooltip');
|
|
11277
|
+
this.portalEl.setAttribute('aria-hidden', this.opened ? 'false' : 'true');
|
|
11278
|
+
this.portalEl.setAttribute('aria-live', this.opened ? 'polite' : 'off');
|
|
11279
|
+
this.portalEl.style.maxWidth = this.maxWidth;
|
|
11280
|
+
this.contentDiv = document.createElement('div');
|
|
11281
|
+
this.contentDiv.className = 'pds-tooltip__content';
|
|
11282
|
+
this.contentDiv.setAttribute('aria-hidden', this.opened ? 'false' : 'true');
|
|
11283
|
+
this.contentDiv.setAttribute('aria-live', this.opened ? 'polite' : 'off');
|
|
11284
|
+
this.contentDiv.setAttribute('role', 'tooltip');
|
|
11285
|
+
this.contentDiv.style.maxWidth = this.maxWidth;
|
|
11286
|
+
const contentSlotWrapper = this.el.querySelector('.pds-tooltip__content-slot-wrapper');
|
|
11287
|
+
const slottedContentContainer = contentSlotWrapper === null || contentSlotWrapper === void 0 ? void 0 : contentSlotWrapper.querySelector('[slot="content"]');
|
|
11288
|
+
let hasSlottedContent = false;
|
|
11289
|
+
if (slottedContentContainer !== null) {
|
|
11290
|
+
const childrenToClone = Array.from(slottedContentContainer.childNodes);
|
|
11291
|
+
if (childrenToClone.length > 0) {
|
|
11292
|
+
const hasMeaningfulNode = childrenToClone.some(node => {
|
|
11293
|
+
var _a;
|
|
11294
|
+
return node.nodeType === Node.ELEMENT_NODE ||
|
|
11295
|
+
(node.nodeType === Node.TEXT_NODE && ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== '');
|
|
11296
|
+
});
|
|
11297
|
+
if (hasMeaningfulNode) {
|
|
11298
|
+
hasSlottedContent = true;
|
|
11299
|
+
childrenToClone.forEach((node /*, index*/) => {
|
|
11300
|
+
var _a;
|
|
11301
|
+
if (node.nodeType === Node.ELEMENT_NODE || (node.nodeType === Node.TEXT_NODE && ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== '')) {
|
|
11302
|
+
this.contentDiv.appendChild(node.cloneNode(true));
|
|
11303
|
+
}
|
|
11304
|
+
});
|
|
11305
|
+
}
|
|
11306
|
+
}
|
|
11307
|
+
}
|
|
11308
|
+
if (!hasSlottedContent) {
|
|
11309
|
+
if (this.content !== '') {
|
|
11310
|
+
this.contentDiv.textContent = this.content;
|
|
11311
|
+
}
|
|
11312
|
+
}
|
|
11313
|
+
this.portalEl.appendChild(this.contentDiv);
|
|
11314
|
+
document.body.appendChild(this.portalEl);
|
|
11315
|
+
this.repositionPortal();
|
|
11316
|
+
if (this.contentDiv !== null) {
|
|
11317
|
+
this.overlayResizeObserver = new ResizeObserver(() => {
|
|
11318
|
+
this.repositionPortal();
|
|
11319
|
+
});
|
|
11320
|
+
this.overlayResizeObserver.observe(this.contentDiv);
|
|
11321
|
+
}
|
|
11322
|
+
// Add global listeners when portal is created
|
|
11323
|
+
window.addEventListener('scroll', this.handleScroll, true);
|
|
11324
|
+
window.addEventListener('popstate', this.handleSpaNavigation, true);
|
|
11325
|
+
window.addEventListener('hashchange', this.handleSpaNavigation, true);
|
|
11326
|
+
// Add ARIA attribute to trigger, now that portalEl and its ID are confirmed
|
|
11327
|
+
if (this.triggerEl !== null && this.portalEl.id !== '') {
|
|
11328
|
+
this.triggerEl.setAttribute('aria-describedby', this.portalEl.id);
|
|
11329
|
+
}
|
|
11330
|
+
}
|
|
11331
|
+
removePortal() {
|
|
11332
|
+
if (this.overlayResizeObserver !== null && this.contentDiv !== null) {
|
|
11333
|
+
this.overlayResizeObserver.unobserve(this.contentDiv);
|
|
11334
|
+
this.overlayResizeObserver = null;
|
|
11335
|
+
}
|
|
11336
|
+
if (this.portalEl !== null) {
|
|
11337
|
+
window.removeEventListener('scroll', this.handleScroll, true);
|
|
11338
|
+
window.removeEventListener('popstate', this.handleSpaNavigation, true);
|
|
11339
|
+
window.removeEventListener('hashchange', this.handleSpaNavigation, true);
|
|
11340
|
+
document.body.removeChild(this.portalEl);
|
|
11341
|
+
this.portalEl = null;
|
|
11342
|
+
}
|
|
11343
|
+
// Remove ARIA attribute from trigger
|
|
11344
|
+
if (this.triggerEl !== null) {
|
|
11345
|
+
this.triggerEl.removeAttribute('aria-describedby');
|
|
11346
|
+
}
|
|
11347
|
+
this.contentDiv = null;
|
|
11348
|
+
}
|
|
8587
11349
|
render() {
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
pds-tooltip--${this.placement}
|
|
8591
|
-
${this.htmlContent ? 'pds-tooltip--has-html-content' : ''}
|
|
8592
|
-
${this.opened ? 'pds-tooltip--is-open' : ''}
|
|
8593
|
-
${this.hasArrow ? '' : 'pds-tooltip--no-arrow'}
|
|
8594
|
-
` }, hAsync("span", { key: '33e96cb4f46ebc418f79971047a37fc5c3498e0d', "aria-describedby": this.componentId, class: "pds-tooltip__trigger" }, hAsync("slot", { key: 'cca7b5d50e2cbc0f839a46caa5a5dc8a79f1cb15' })), hAsync("div", { key: '22c666894f7835629e00e9c2c3964bcaf63000ae', class: "pds-tooltip__content", "aria-hidden": this.opened ? 'false' : 'true', "aria-live": this.opened ? 'polite' : 'off', id: this.componentId, ref: (el) => (this.contentEl = el), role: "tooltip", style: { maxWidth: this.maxWidth } }, hAsync("slot", { key: '83a805d9eef71ac261a03d56853ccc8ac7bfe818', name: "content" }), this.content))));
|
|
11350
|
+
const hostId = this.componentId || undefined;
|
|
11351
|
+
return (hAsync(Host, { key: '0fe2bea1ea0e8eaeb5879644694a2e129f1f4898', id: hostId, class: { 'pds-tooltip--is-open': this.opened } }, hAsync("span", { key: 'f26feb3c37957573d3b6b0a55091b2e7012ae31b', class: "pds-tooltip__trigger", onMouseEnter: this.handleShow, onMouseLeave: this.handleHide, onFocus: this.handleShow, onBlur: this.handleHide, ref: el => this.triggerEl = el }, hAsync("slot", { key: 'c7940e3aa7f17fc5d5fcdedc0a624204ceed291c' })), hAsync("div", { key: '0c8dc83e3b7f8c1337aae8641d80f63c0866c348', class: "pds-tooltip__content-slot-wrapper", style: { display: 'none' } }, hAsync("slot", { key: '2f6701768c0debdd69673da3ad7dc34b8b237f6a', name: "content" }))));
|
|
8595
11352
|
}
|
|
8596
11353
|
get el() { return getElement(this); }
|
|
8597
11354
|
static get watchers() { return {
|
|
@@ -8599,7 +11356,7 @@ class PdsTooltip {
|
|
|
8599
11356
|
}; }
|
|
8600
11357
|
static get style() { return pdsTooltipCss; }
|
|
8601
11358
|
static get cmpMeta() { return {
|
|
8602
|
-
"$flags$":
|
|
11359
|
+
"$flags$": 4,
|
|
8603
11360
|
"$tagName$": "pds-tooltip",
|
|
8604
11361
|
"$members$": {
|
|
8605
11362
|
"content": [1],
|
|
@@ -8609,6 +11366,7 @@ class PdsTooltip {
|
|
|
8609
11366
|
"placement": [513],
|
|
8610
11367
|
"maxWidth": [1, "max-width"],
|
|
8611
11368
|
"opened": [1540],
|
|
11369
|
+
"_isInteractiveOpen": [32],
|
|
8612
11370
|
"isOpen": [32],
|
|
8613
11371
|
"showTooltip": [64],
|
|
8614
11372
|
"hideTooltip": [64]
|
|
@@ -8618,9 +11376,12 @@ class PdsTooltip {
|
|
|
8618
11376
|
"$attrsToReflect$": [["placement", "placement"], ["opened", "opened"]]
|
|
8619
11377
|
}; }
|
|
8620
11378
|
}
|
|
11379
|
+
PdsTooltip.instanceCounter = 0;
|
|
8621
11380
|
|
|
8622
11381
|
registerComponents([
|
|
11382
|
+
MockPdsModal,
|
|
8623
11383
|
PdsAccordion,
|
|
11384
|
+
PdsAlert,
|
|
8624
11385
|
PdsAvatar,
|
|
8625
11386
|
PdsBox,
|
|
8626
11387
|
PdsButton,
|
|
@@ -8628,11 +11389,18 @@ registerComponents([
|
|
|
8628
11389
|
PdsChip,
|
|
8629
11390
|
PdsCopytext,
|
|
8630
11391
|
PdsDivider,
|
|
11392
|
+
PdsDropdownMenu,
|
|
11393
|
+
PdsDropdownMenuItem,
|
|
11394
|
+
PdsDropdownMenuSeparator,
|
|
8631
11395
|
PdsIcon,
|
|
8632
11396
|
PdsImage,
|
|
8633
11397
|
PdsInput,
|
|
8634
11398
|
PdsLink,
|
|
8635
11399
|
PdsLoader,
|
|
11400
|
+
PdsModal,
|
|
11401
|
+
PdsModalContent,
|
|
11402
|
+
PdsModalFooter,
|
|
11403
|
+
PdsModalHeader,
|
|
8636
11404
|
PdsPopover,
|
|
8637
11405
|
PdsProgress,
|
|
8638
11406
|
PdsRadio,
|
|
@@ -8652,6 +11420,7 @@ registerComponents([
|
|
|
8652
11420
|
PdsTabs,
|
|
8653
11421
|
PdsText,
|
|
8654
11422
|
PdsTextarea,
|
|
11423
|
+
PdsToast,
|
|
8655
11424
|
PdsTooltip,
|
|
8656
11425
|
]);
|
|
8657
11426
|
|