@patternfly/elements 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +490 -484
- package/package.json +1 -1
- package/pf-accordion/BaseAccordion.js +2 -1
- package/pf-accordion/BaseAccordion.js.map +1 -1
- package/pf-accordion/BaseAccordionHeader.js +4 -1
- package/pf-accordion/BaseAccordionHeader.js.map +1 -1
- package/pf-accordion/BaseAccordionPanel.d.ts +1 -1
- package/pf-accordion/pf-accordion-header.d.ts +1 -1
- package/pf-accordion/pf-accordion.d.ts +0 -5
- package/pf-accordion/pf-accordion.js +0 -5
- package/pf-accordion/pf-accordion.js.map +1 -1
- package/pf-accordion/test/pf-accordion.e2e.d.ts +1 -0
- package/pf-accordion/test/pf-accordion.e2e.js +11 -0
- package/pf-accordion/test/pf-accordion.e2e.js.map +1 -0
- package/pf-accordion/test/pf-accordion.spec.d.ts +1 -0
- package/pf-accordion/test/pf-accordion.spec.js +1222 -0
- package/pf-accordion/test/pf-accordion.spec.js.map +1 -0
- package/pf-avatar/BaseAvatar.d.ts +1 -1
- package/pf-avatar/test/pf-avatar.e2e.d.ts +1 -0
- package/pf-avatar/test/pf-avatar.e2e.js +11 -0
- package/pf-avatar/test/pf-avatar.e2e.js.map +1 -0
- package/pf-avatar/test/pf-avatar.spec.d.ts +1 -0
- package/pf-avatar/test/pf-avatar.spec.js +45 -0
- package/pf-avatar/test/pf-avatar.spec.js.map +1 -0
- package/pf-back-to-top/demo/demo.css +25 -0
- package/pf-back-to-top/pf-back-to-top.d.ts +1 -1
- package/pf-back-to-top/test/pf-back-to-top.e2e.d.ts +1 -0
- package/pf-back-to-top/test/pf-back-to-top.e2e.js +11 -0
- package/pf-back-to-top/test/pf-back-to-top.e2e.js.map +1 -0
- package/pf-back-to-top/test/pf-back-to-top.spec.d.ts +1 -0
- package/pf-back-to-top/test/pf-back-to-top.spec.js +267 -0
- package/pf-back-to-top/test/pf-back-to-top.spec.js.map +1 -0
- package/pf-background-image/pf-background-image.d.ts +1 -4
- package/pf-background-image/pf-background-image.js +1 -4
- package/pf-background-image/pf-background-image.js.map +1 -1
- package/pf-background-image/test/pf-background-image.e2e.d.ts +1 -0
- package/pf-background-image/test/pf-background-image.e2e.js +11 -0
- package/pf-background-image/test/pf-background-image.e2e.js.map +1 -0
- package/pf-background-image/test/pf-background-image.spec.d.ts +1 -0
- package/pf-background-image/test/pf-background-image.spec.js +89 -0
- package/pf-background-image/test/pf-background-image.spec.js.map +1 -0
- package/pf-badge/BaseBadge.d.ts +1 -1
- package/pf-badge/test/pf-badge.e2e.d.ts +1 -0
- package/pf-badge/test/pf-badge.e2e.js +11 -0
- package/pf-badge/test/pf-badge.e2e.js.map +1 -0
- package/pf-badge/test/pf-badge.spec.d.ts +1 -0
- package/pf-badge/test/pf-badge.spec.js +52 -0
- package/pf-badge/test/pf-badge.spec.js.map +1 -0
- package/pf-banner/pf-banner.d.ts +1 -10
- package/pf-banner/pf-banner.js +0 -9
- package/pf-banner/pf-banner.js.map +1 -1
- package/pf-banner/test/pf-banner.e2e.d.ts +1 -0
- package/pf-banner/test/pf-banner.e2e.js +11 -0
- package/pf-banner/test/pf-banner.e2e.js.map +1 -0
- package/pf-banner/test/pf-banner.spec.d.ts +1 -0
- package/pf-banner/test/pf-banner.spec.js +81 -0
- package/pf-banner/test/pf-banner.spec.js.map +1 -0
- package/pf-button/BaseButton.d.ts +7 -2
- package/pf-button/BaseButton.js +4 -1
- package/pf-button/BaseButton.js.map +1 -1
- package/pf-button/pf-button.d.ts +1 -17
- package/pf-button/pf-button.js +10 -18
- package/pf-button/pf-button.js.map +1 -1
- package/pf-button/test/pf-button.e2e.d.ts +1 -0
- package/pf-button/test/pf-button.e2e.js +11 -0
- package/pf-button/test/pf-button.e2e.js.map +1 -0
- package/pf-button/test/pf-button.spec.d.ts +1 -0
- package/pf-button/test/pf-button.spec.js +124 -0
- package/pf-button/test/pf-button.spec.js.map +1 -0
- package/pf-card/BaseCard.d.ts +1 -1
- package/pf-card/test/pf-card.e2e.d.ts +1 -0
- package/pf-card/test/pf-card.e2e.js +11 -0
- package/pf-card/test/pf-card.e2e.js.map +1 -0
- package/pf-card/test/pf-card.spec.d.ts +1 -0
- package/pf-card/test/pf-card.spec.js +160 -0
- package/pf-card/test/pf-card.spec.js.map +1 -0
- package/pf-chip/pf-chip-group.d.ts +8 -5
- package/pf-chip/pf-chip-group.js +10 -10
- package/pf-chip/pf-chip-group.js.map +1 -1
- package/pf-chip/pf-chip.d.ts +8 -5
- package/pf-chip/pf-chip.js +4 -4
- package/pf-chip/pf-chip.js.map +1 -1
- package/pf-chip/test/pf-chip-group.spec.d.ts +1 -0
- package/pf-chip/test/pf-chip-group.spec.js +189 -0
- package/pf-chip/test/pf-chip-group.spec.js.map +1 -0
- package/pf-chip/test/pf-chip.e2e.d.ts +1 -0
- package/pf-chip/test/pf-chip.e2e.js +11 -0
- package/pf-chip/test/pf-chip.e2e.js.map +1 -0
- package/pf-chip/test/pf-chip.spec.d.ts +1 -0
- package/pf-chip/test/pf-chip.spec.js +116 -0
- package/pf-chip/test/pf-chip.spec.js.map +1 -0
- package/pf-clipboard-copy/pf-clipboard-copy.css +4 -0
- package/pf-clipboard-copy/pf-clipboard-copy.d.ts +8 -3
- package/pf-clipboard-copy/pf-clipboard-copy.js +6 -4
- package/pf-clipboard-copy/pf-clipboard-copy.js.map +1 -1
- package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.d.ts +1 -0
- package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js +11 -0
- package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js.map +1 -0
- package/pf-clipboard-copy/test/pf-clipboard-copy.spec.d.ts +1 -0
- package/pf-clipboard-copy/test/pf-clipboard-copy.spec.js +103 -0
- package/pf-clipboard-copy/test/pf-clipboard-copy.spec.js.map +1 -0
- package/pf-code-block/BaseCodeBlock.js +2 -2
- package/pf-code-block/BaseCodeBlock.js.map +1 -1
- package/pf-code-block/pf-code-block.d.ts +1 -1
- package/pf-code-block/test/pf-code-block.e2e.d.ts +1 -0
- package/pf-code-block/test/pf-code-block.e2e.js +11 -0
- package/pf-code-block/test/pf-code-block.e2e.js.map +1 -0
- package/pf-code-block/test/pf-code-block.spec.d.ts +1 -0
- package/pf-code-block/test/pf-code-block.spec.js +89 -0
- package/pf-code-block/test/pf-code-block.spec.js.map +1 -0
- package/pf-dropdown/pf-dropdown-group.d.ts +1 -1
- package/pf-dropdown/pf-dropdown-group.js +4 -1
- package/pf-dropdown/pf-dropdown-group.js.map +1 -1
- package/pf-dropdown/pf-dropdown-item.d.ts +1 -2
- package/pf-dropdown/pf-dropdown-item.js +4 -2
- package/pf-dropdown/pf-dropdown-item.js.map +1 -1
- package/pf-dropdown/pf-dropdown-menu.d.ts +1 -2
- package/pf-dropdown/pf-dropdown-menu.js +8 -6
- package/pf-dropdown/pf-dropdown-menu.js.map +1 -1
- package/pf-dropdown/pf-dropdown.d.ts +8 -6
- package/pf-dropdown/pf-dropdown.js +11 -11
- package/pf-dropdown/pf-dropdown.js.map +1 -1
- package/pf-dropdown/test/pf-dropdown.e2e.d.ts +1 -0
- package/pf-dropdown/test/pf-dropdown.e2e.js +11 -0
- package/pf-dropdown/test/pf-dropdown.e2e.js.map +1 -0
- package/pf-dropdown/test/pf-dropdown.spec.d.ts +1 -0
- package/pf-dropdown/test/pf-dropdown.spec.js +129 -0
- package/pf-dropdown/test/pf-dropdown.spec.js.map +1 -0
- package/pf-icon/BaseIcon.d.ts +1 -2
- package/pf-icon/BaseIcon.js +3 -4
- package/pf-icon/BaseIcon.js.map +1 -1
- package/pf-icon/demo/icons/rh/boba-tea.js +5 -0
- package/pf-icon/demo/icons/rh/lifecycle.js +3 -0
- package/pf-icon/test/pf-icon.e2e.d.ts +1 -0
- package/pf-icon/test/pf-icon.e2e.js +11 -0
- package/pf-icon/test/pf-icon.e2e.js.map +1 -0
- package/pf-icon/test/pf-icon.spec.d.ts +1 -0
- package/pf-icon/test/pf-icon.spec.js +130 -0
- package/pf-icon/test/pf-icon.spec.js.map +1 -0
- package/pf-icon/test/rh-icon-aed.js +2 -0
- package/pf-icon/test/rh-icon-api.js +2 -0
- package/pf-icon/test/rh-icon-atom.js +2 -0
- package/pf-icon/test/rh-icon-bike.js +2 -0
- package/pf-jump-links/pf-jump-links-item.d.ts +8 -2
- package/pf-jump-links/pf-jump-links-item.js +4 -1
- package/pf-jump-links/pf-jump-links-item.js.map +1 -1
- package/pf-jump-links/pf-jump-links-list.d.ts +1 -1
- package/pf-jump-links/pf-jump-links.d.ts +1 -7
- package/pf-jump-links/pf-jump-links.js +1 -7
- package/pf-jump-links/pf-jump-links.js.map +1 -1
- package/pf-jump-links/test/pf-jump-links.e2e.d.ts +1 -0
- package/pf-jump-links/test/pf-jump-links.e2e.js +11 -0
- package/pf-jump-links/test/pf-jump-links.e2e.js.map +1 -0
- package/pf-jump-links/test/pf-jump-links.spec.d.ts +1 -0
- package/pf-jump-links/test/pf-jump-links.spec.js +85 -0
- package/pf-jump-links/test/pf-jump-links.spec.js.map +1 -0
- package/pf-label/BaseLabel.d.ts +1 -1
- package/pf-label/pf-label.d.ts +10 -24
- package/pf-label/pf-label.js +4 -21
- package/pf-label/pf-label.js.map +1 -1
- package/pf-label/test/pf-label.e2e.d.ts +1 -0
- package/pf-label/test/pf-label.e2e.js +11 -0
- package/pf-label/test/pf-label.e2e.js.map +1 -0
- package/pf-label/test/pf-label.spec.d.ts +1 -0
- package/pf-label/test/pf-label.spec.js +111 -0
- package/pf-label/test/pf-label.spec.js.map +1 -0
- package/pf-modal/pf-modal.d.ts +1 -6
- package/pf-modal/pf-modal.js +6 -8
- package/pf-modal/pf-modal.js.map +1 -1
- package/pf-modal/test/pf-modal.e2e.d.ts +1 -0
- package/pf-modal/test/pf-modal.e2e.js +13 -0
- package/pf-modal/test/pf-modal.e2e.js.map +1 -0
- package/pf-modal/test/pf-modal.spec.d.ts +1 -0
- package/pf-modal/test/pf-modal.spec.js +197 -0
- package/pf-modal/test/pf-modal.spec.js.map +1 -0
- package/pf-panel/pf-panel.d.ts +1 -1
- package/pf-panel/test/pf-panel.e2e.d.ts +1 -0
- package/pf-panel/test/pf-panel.e2e.js +11 -0
- package/pf-panel/test/pf-panel.e2e.js.map +1 -0
- package/pf-panel/test/pf-panel.spec.d.ts +1 -0
- package/pf-panel/test/pf-panel.spec.js +22 -0
- package/pf-panel/test/pf-panel.spec.js.map +1 -0
- package/pf-popover/pf-popover.d.ts +1 -5
- package/pf-popover/pf-popover.js +12 -7
- package/pf-popover/pf-popover.js.map +1 -1
- package/pf-popover/test/pf-popover.e2e.d.ts +1 -0
- package/pf-popover/test/pf-popover.e2e.js +11 -0
- package/pf-popover/test/pf-popover.e2e.js.map +1 -0
- package/pf-popover/test/pf-popover.spec.d.ts +1 -0
- package/pf-popover/test/pf-popover.spec.js +233 -0
- package/pf-popover/test/pf-popover.spec.js.map +1 -0
- package/pf-progress/demo/kitchen-sink.css +4 -0
- package/pf-progress/pf-progress.d.ts +1 -22
- package/pf-progress/pf-progress.js +1 -22
- package/pf-progress/pf-progress.js.map +1 -1
- package/pf-progress/test/pf-progress.e2e.d.ts +1 -0
- package/pf-progress/test/pf-progress.e2e.js +11 -0
- package/pf-progress/test/pf-progress.e2e.js.map +1 -0
- package/pf-progress/test/pf-progress.spec.d.ts +1 -0
- package/pf-progress/test/pf-progress.spec.js +45 -0
- package/pf-progress/test/pf-progress.spec.js.map +1 -0
- package/pf-progress-stepper/pf-progress-step.d.ts +1 -1
- package/pf-progress-stepper/pf-progress-stepper.d.ts +1 -1
- package/pf-progress-stepper/test/pf-progress-stepper.e2e.d.ts +1 -0
- package/pf-progress-stepper/test/pf-progress-stepper.e2e.js +11 -0
- package/pf-progress-stepper/test/pf-progress-stepper.e2e.js.map +1 -0
- package/pf-progress-stepper/test/pf-progress-stepper.spec.d.ts +1 -0
- package/pf-progress-stepper/test/pf-progress-stepper.spec.js +18 -0
- package/pf-progress-stepper/test/pf-progress-stepper.spec.js.map +1 -0
- package/pf-select/pf-option-group.d.ts +1 -1
- package/pf-select/pf-option-group.js +2 -0
- package/pf-select/pf-option-group.js.map +1 -1
- package/pf-select/pf-option.d.ts +1 -2
- package/pf-select/pf-option.js +3 -4
- package/pf-select/pf-option.js.map +1 -1
- package/pf-select/pf-select.d.ts +8 -3
- package/pf-select/pf-select.js +51 -21
- package/pf-select/pf-select.js.map +1 -1
- package/pf-select/test/pf-select.e2e.d.ts +1 -0
- package/pf-select/test/pf-select.e2e.js +11 -0
- package/pf-select/test/pf-select.e2e.js.map +1 -0
- package/pf-select/test/pf-select.spec.d.ts +1 -0
- package/pf-select/test/pf-select.spec.js +866 -0
- package/pf-select/test/pf-select.spec.js.map +1 -0
- package/pf-spinner/BaseSpinner.d.ts +1 -2
- package/pf-spinner/BaseSpinner.js +2 -4
- package/pf-spinner/BaseSpinner.js.map +1 -1
- package/pf-spinner/pf-spinner.d.ts +2 -2
- package/pf-spinner/pf-spinner.js +8 -1
- package/pf-spinner/pf-spinner.js.map +1 -1
- package/pf-spinner/test/pf-spinner.e2e.d.ts +1 -0
- package/pf-spinner/test/pf-spinner.e2e.js +11 -0
- package/pf-spinner/test/pf-spinner.e2e.js.map +1 -0
- package/pf-spinner/test/pf-spinner.spec.d.ts +1 -0
- package/pf-spinner/test/pf-spinner.spec.js +64 -0
- package/pf-spinner/test/pf-spinner.spec.js.map +1 -0
- package/pf-switch/BaseSwitch.d.ts +1 -1
- package/pf-switch/BaseSwitch.js +3 -3
- package/pf-switch/BaseSwitch.js.map +1 -1
- package/pf-switch/test/pf-switch.e2e.d.ts +1 -0
- package/pf-switch/test/pf-switch.e2e.js +11 -0
- package/pf-switch/test/pf-switch.e2e.js.map +1 -0
- package/pf-switch/test/pf-switch.spec.d.ts +1 -0
- package/pf-switch/test/pf-switch.spec.js +191 -0
- package/pf-switch/test/pf-switch.spec.js.map +1 -0
- package/pf-table/pf-caption.d.ts +1 -1
- package/pf-table/pf-table.d.ts +1 -3
- package/pf-table/pf-table.js +2 -4
- package/pf-table/pf-table.js.map +1 -1
- package/pf-table/pf-tbody.d.ts +1 -1
- package/pf-table/pf-td.d.ts +1 -1
- package/pf-table/pf-th.d.ts +1 -1
- package/pf-table/pf-th.js +3 -3
- package/pf-table/pf-th.js.map +1 -1
- package/pf-table/pf-thead.d.ts +1 -1
- package/pf-table/pf-tr.d.ts +1 -1
- package/pf-table/pf-tr.js +4 -4
- package/pf-table/pf-tr.js.map +1 -1
- package/pf-table/test/pf-table.e2e.d.ts +1 -0
- package/pf-table/test/pf-table.e2e.js +11 -0
- package/pf-table/test/pf-table.e2e.js.map +1 -0
- package/pf-table/test/pf-table.spec.d.ts +1 -0
- package/pf-table/test/pf-table.spec.js +17 -0
- package/pf-table/test/pf-table.spec.js.map +1 -0
- package/pf-tabs/BaseTab.d.ts +2 -2
- package/pf-tabs/BaseTab.js +4 -1
- package/pf-tabs/BaseTab.js.map +1 -1
- package/pf-tabs/BaseTabPanel.d.ts +1 -1
- package/pf-tabs/BaseTabs.d.ts +1 -3
- package/pf-tabs/BaseTabs.js +11 -12
- package/pf-tabs/BaseTabs.js.map +1 -1
- package/pf-tabs/pf-tab-panel.d.ts +1 -1
- package/pf-tabs/pf-tab.d.ts +1 -17
- package/pf-tabs/pf-tab.js +0 -16
- package/pf-tabs/pf-tab.js.map +1 -1
- package/pf-tabs/pf-tabs.d.ts +1 -12
- package/pf-tabs/pf-tabs.js +2 -13
- package/pf-tabs/pf-tabs.js.map +1 -1
- package/pf-tabs/test/pf-tabs.e2e.d.ts +1 -0
- package/pf-tabs/test/pf-tabs.e2e.js +13 -0
- package/pf-tabs/test/pf-tabs.e2e.js.map +1 -0
- package/pf-tabs/test/pf-tabs.spec.d.ts +1 -0
- package/pf-tabs/test/pf-tabs.spec.js +285 -0
- package/pf-tabs/test/pf-tabs.spec.js.map +1 -0
- package/pf-text-area/pf-text-area.d.ts +1 -2
- package/pf-text-area/pf-text-area.js +5 -5
- package/pf-text-area/pf-text-area.js.map +1 -1
- package/pf-text-area/test/pf-text-area.e2e.d.ts +1 -0
- package/pf-text-area/test/pf-text-area.e2e.js +11 -0
- package/pf-text-area/test/pf-text-area.e2e.js.map +1 -0
- package/pf-text-area/test/pf-text-area.spec.d.ts +1 -0
- package/pf-text-area/test/pf-text-area.spec.js +89 -0
- package/pf-text-area/test/pf-text-area.spec.js.map +1 -0
- package/pf-text-input/demo/demo.css +6 -0
- package/pf-text-input/pf-text-input.d.ts +8 -3
- package/pf-text-input/pf-text-input.js +4 -2
- package/pf-text-input/pf-text-input.js.map +1 -1
- package/pf-text-input/test/pf-text-input.e2e.d.ts +1 -0
- package/pf-text-input/test/pf-text-input.e2e.js +11 -0
- package/pf-text-input/test/pf-text-input.e2e.js.map +1 -0
- package/pf-text-input/test/pf-text-input.spec.d.ts +1 -0
- package/pf-text-input/test/pf-text-input.spec.js +20 -0
- package/pf-text-input/test/pf-text-input.spec.js.map +1 -0
- package/pf-tile/BaseTile.d.ts +1 -1
- package/pf-tile/pf-tile.d.ts +0 -12
- package/pf-tile/pf-tile.js +0 -12
- package/pf-tile/pf-tile.js.map +1 -1
- package/pf-tile/test/pf-tile.e2e.d.ts +1 -0
- package/pf-tile/test/pf-tile.e2e.js +11 -0
- package/pf-tile/test/pf-tile.e2e.js.map +1 -0
- package/pf-tile/test/pf-tile.spec.d.ts +1 -0
- package/pf-tile/test/pf-tile.spec.js +54 -0
- package/pf-tile/test/pf-tile.spec.js.map +1 -0
- package/pf-timestamp/pf-timestamp.d.ts +1 -1
- package/pf-timestamp/pf-timestamp.js +5 -1
- package/pf-timestamp/pf-timestamp.js.map +1 -1
- package/pf-timestamp/test/pf-timestamp.e2e.d.ts +1 -0
- package/pf-timestamp/test/pf-timestamp.e2e.js +12 -0
- package/pf-timestamp/test/pf-timestamp.e2e.js.map +1 -0
- package/pf-timestamp/test/pf-timestamp.spec.d.ts +1 -0
- package/pf-timestamp/test/pf-timestamp.spec.js +156 -0
- package/pf-timestamp/test/pf-timestamp.spec.js.map +1 -0
- package/pf-tooltip/BaseTooltip.d.ts +1 -1
- package/pf-tooltip/pf-tooltip.d.ts +1 -4
- package/pf-tooltip/pf-tooltip.js +6 -7
- package/pf-tooltip/pf-tooltip.js.map +1 -1
- package/pf-tooltip/test/pf-tooltip.e2e.d.ts +1 -0
- package/pf-tooltip/test/pf-tooltip.e2e.js +11 -0
- package/pf-tooltip/test/pf-tooltip.e2e.js.map +1 -0
- package/pf-tooltip/test/pf-tooltip.spec.d.ts +1 -0
- package/pf-tooltip/test/pf-tooltip.spec.js +53 -0
- package/pf-tooltip/test/pf-tooltip.spec.js.map +1 -0
- package/pfe.min.js +273 -266
- package/pfe.min.js.map +3 -3
- package/pf-accordion/README.md +0 -44
- package/pf-avatar/README.md +0 -31
- package/pf-back-to-top/README.md +0 -32
- package/pf-background-image/README.md +0 -37
- package/pf-badge/README.md +0 -57
- package/pf-banner/README.md +0 -60
- package/pf-button/README.md +0 -61
- package/pf-card/README.md +0 -34
- package/pf-chip/README.md +0 -20
- package/pf-clipboard-copy/README.md +0 -8
- package/pf-code-block/README.md +0 -77
- package/pf-dropdown/README.md +0 -46
- package/pf-icon/README.md +0 -86
- package/pf-icon/icons/fab/readme.svg +0 -1
- package/pf-jump-links/README.md +0 -27
- package/pf-label/README.md +0 -61
- package/pf-modal/README.md +0 -63
- package/pf-panel/README.md +0 -10
- package/pf-popover/README.md +0 -48
- package/pf-progress/README.md +0 -33
- package/pf-progress-stepper/README.md +0 -41
- package/pf-select/README.md +0 -21
- package/pf-spinner/README.md +0 -46
- package/pf-switch/README.md +0 -91
- package/pf-table/README.md +0 -43
- package/pf-tabs/README.md +0 -40
- package/pf-text-area/README.md +0 -11
- package/pf-text-input/README.md +0 -9
- package/pf-tile/README.md +0 -12
- package/pf-timestamp/README.md +0 -64
- package/pf-tooltip/README.md +0 -64
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { html, expect } from '@open-wc/testing';
|
|
2
|
+
import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';
|
|
3
|
+
import { PfProgressStepper } from '@patternfly/elements/pf-progress-stepper/pf-progress-stepper.js';
|
|
4
|
+
import { PfProgressStep } from '../pf-progress-step.js';
|
|
5
|
+
describe('<pf-progress-stepper>', function () {
|
|
6
|
+
it('imperatively instantiates', function () {
|
|
7
|
+
expect(document.createElement('pf-progress-stepper')).to.be.an.instanceof(PfProgressStepper);
|
|
8
|
+
expect(document.createElement('pf-progress-step')).to.be.an.instanceof(PfProgressStep);
|
|
9
|
+
});
|
|
10
|
+
it('it should upgrade', async function () {
|
|
11
|
+
const el = await createFixture(html `<pf-progress-stepper></pf-progress-stepper>`);
|
|
12
|
+
expect(el)
|
|
13
|
+
.to.be.an.instanceOf(customElements.get('pf-progress-stepper'))
|
|
14
|
+
.and
|
|
15
|
+
.to.be.an.instanceOf(PfProgressStepper);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=pf-progress-stepper.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pf-progress-stepper.spec.js","sourceRoot":"","sources":["pf-progress-stepper.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,QAAQ,CAAC,uBAAuB,EAAE;IAChC,EAAE,CAAC,2BAA2B,EAAE;QAC9B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAC7F,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,KAAK;QAC3B,MAAM,EAAE,GAAG,MAAM,aAAa,CAAoB,IAAI,CAAA,6CAA6C,CAAC,CAAC;QACrG,MAAM,CAAC,EAAE,CAAC;aACL,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;aAC9D,GAAG;aACH,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, expect } from '@open-wc/testing';\n\nimport { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';\n\nimport { PfProgressStepper } from '@patternfly/elements/pf-progress-stepper/pf-progress-stepper.js';\nimport { PfProgressStep } from '../pf-progress-step.js';\n\ndescribe('<pf-progress-stepper>', function() {\n it('imperatively instantiates', function() {\n expect(document.createElement('pf-progress-stepper')).to.be.an.instanceof(PfProgressStepper);\n expect(document.createElement('pf-progress-step')).to.be.an.instanceof(PfProgressStep);\n });\n\n it('it should upgrade', async function() {\n const el = await createFixture<PfProgressStepper>(html`<pf-progress-stepper></pf-progress-stepper>`);\n expect(el)\n .to.be.an.instanceOf(customElements.get('pf-progress-stepper'))\n .and\n .to.be.an.instanceOf(PfProgressStepper);\n });\n});\n"]}
|
|
@@ -11,7 +11,7 @@ export declare class PfOptionGroup extends LitElement {
|
|
|
11
11
|
label?: string;
|
|
12
12
|
/** whether group is disabled */
|
|
13
13
|
disabled: boolean;
|
|
14
|
-
render(): import("lit").TemplateResult<1>;
|
|
14
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
15
15
|
}
|
|
16
16
|
declare global {
|
|
17
17
|
interface HTMLElementTagNameMap {
|
|
@@ -17,6 +17,8 @@ let PfOptionGroup = class PfOptionGroup extends LitElement {
|
|
|
17
17
|
super(...arguments);
|
|
18
18
|
/** whether group is disabled */
|
|
19
19
|
this.disabled = false;
|
|
20
|
+
// for the role
|
|
21
|
+
// eslint-disable-next-line no-unused-private-class-members
|
|
20
22
|
_PfOptionGroup_internals.set(this, InternalsController.of(this, { role: 'group' }));
|
|
21
23
|
}
|
|
22
24
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pf-option-group.js","sourceRoot":"","sources":["pf-option-group.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;;;AAI/F;;;;GAIG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAML,gCAAgC;QACY,aAAQ,GAAG,KAAK,CAAC;QAE7D,mCAAa,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAC;IAa/D,CAAC;IAXC,MAAM;QACJ,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAC1B,OAAO,IAAI,CAAA;;;uBAGQ,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;6BAChB,IAAI,CAAC,KAAK;;qBAElB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;KACtC,CAAC;IACJ,CAAC;;;
|
|
1
|
+
{"version":3,"file":"pf-option-group.js","sourceRoot":"","sources":["pf-option-group.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;;;AAI/F;;;;GAIG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAML,gCAAgC;QACY,aAAQ,GAAG,KAAK,CAAC;QAE7D,eAAe;QACf,2DAA2D;QAC3D,mCAAa,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAC;IAa/D,CAAC;IAXC,MAAM;QACJ,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAC1B,OAAO,IAAI,CAAA;;;uBAGQ,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;6BAChB,IAAI,CAAC,KAAK;;qBAElB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;KACtC,CAAC;IACJ,CAAC;;;AAtBe,oBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAGtB;IAAX,QAAQ,EAAE;4CAAgB;AAGiB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkB;AAPlD,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAwBzB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\n\nimport styles from './pf-option-group.css';\n\n/**\n * Group of options within a listbox\n * @slot - `<pf-option>` or `<hr>` elements\n * @slot label - Group label. Overrides the `label` attribute.\n */\n@customElement('pf-option-group')\nexport class PfOptionGroup extends LitElement {\n static readonly styles = [styles];\n\n /** Group description. Overridden by `label` slot. */\n @property() label?: string;\n\n /** whether group is disabled */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n // for the role\n // eslint-disable-next-line no-unused-private-class-members\n #internals = InternalsController.of(this, { role: 'group' });\n\n render() {\n const { disabled } = this;\n return html`\n <div id=\"label-container\"\n role=\"presentation\">\n <slot class=\"${classMap({ disabled })}\"\n name=\"label\">${this.label}</slot>\n </div>\n <slot class=\"${classMap({ disabled })}\"></slot>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-option-group': PfOptionGroup;\n }\n}\n"]}
|
package/pf-select/pf-option.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { LitElement, type PropertyValues } from 'lit';
|
|
2
2
|
/**
|
|
3
3
|
* Option within a listbox
|
|
4
|
-
*
|
|
5
4
|
* @slot -
|
|
6
5
|
* option text
|
|
7
6
|
* @slot icon
|
|
@@ -35,7 +34,7 @@ export declare class PfOption extends LitElement {
|
|
|
35
34
|
set setSize(setSize: number | null);
|
|
36
35
|
get setSize(): number | null;
|
|
37
36
|
connectedCallback(): void;
|
|
38
|
-
render(): import("lit").TemplateResult<1>;
|
|
37
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
39
38
|
willUpdate(changed: PropertyValues<this>): void;
|
|
40
39
|
/**
|
|
41
40
|
* text content within option (used for filtering)
|
package/pf-select/pf-option.js
CHANGED
|
@@ -11,7 +11,6 @@ import { css } from "lit";
|
|
|
11
11
|
const styles = css `:host {\n display: block;\n}\n\n:host([hidden]),\n*[hidden] {\n display: none !important;\n}\n\n:host([disabled]) {\n pointer-events: none !important;\n cursor: not-allowed !important;\n}\n\n:host(:focus) #outer,\n:host(:hover) #outer,\n:host([aria-selected="true"]) {\n background-color: #e0e0e0;\n}\n\n#outer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: flex-start;\n padding: var(--pf-global--spacer--sm, 0.5rem) var(--pf-global--spacer--md, 1rem);\n min-height: calc(44px - 2 * var(--pf-global--spacer--sm, 0.5rem));\n min-width: calc(44px - 2 * var(--pf-global--spacer--md, 1rem));\n}\n\n#outer.active {\n background-color: var(--_active-descendant-color, var(--pf-theme--color--surface--lighter, #f0f0f0));\n}\n\n:host([disabled]) #outer {\n color: var(--pf-global--Color--dark-200, #6a6e73) !important;\n}\n\ninput[type="checkbox"] {\n margin-inline-end: 1em;\n display: var(--_pf-option-checkboxes-display, none);\n pointer-events: none;\n flex: 0 0 auto;\n}\n\nspan {\n flex: 1 1 auto;\n}\n\nsvg {\n font-size: var(--pf-c-select__menu-item-icon--FontSize, var(--pf-global--icon--FontSize--sm, 0.675rem));\n color: var(--_svg-color, var(--pf-theme--color--accent, #0066cc));\n width: 1em;\n height: 1em;\n margin-inline-start: 1em;\n text-align: right;\n flex: 0 0 auto;\n display: var(--_pf-option-svg-display, block);\n}\n\n#description {\n display: block;\n flex: 1 0 100%;\n}\n\nslot[name="description"] {\n font-size: var(--pf-global--FontSize--xs, 0.75rem);\n color: var(--pf-global--Color--dark-200, #6a6e73);\n}\n\n::slotted([slot="icon"]) {\n margin-inline-end: 0.5em;\n}\n\n`;
|
|
12
12
|
/**
|
|
13
13
|
* Option within a listbox
|
|
14
|
-
*
|
|
15
14
|
* @slot -
|
|
16
15
|
* option text
|
|
17
16
|
* @slot icon
|
|
@@ -35,7 +34,7 @@ let PfOption = class PfOption extends LitElement {
|
|
|
35
34
|
}
|
|
36
35
|
/** form value for this option */
|
|
37
36
|
get value() {
|
|
38
|
-
return __classPrivateFieldGet(this, _PfOption_value, "f") ?? this.textContent ?? '';
|
|
37
|
+
return (__classPrivateFieldGet(this, _PfOption_value, "f") ?? this.textContent ?? '').trim();
|
|
39
38
|
}
|
|
40
39
|
set value(v) {
|
|
41
40
|
__classPrivateFieldSet(this, _PfOption_value, v, "f");
|
|
@@ -100,9 +99,9 @@ let PfOption = class PfOption extends LitElement {
|
|
|
100
99
|
`;
|
|
101
100
|
}
|
|
102
101
|
willUpdate(changed) {
|
|
103
|
-
if (changed.has('selected')
|
|
102
|
+
if (changed.has('selected')
|
|
104
103
|
// don't fire on initialization
|
|
105
|
-
!(changed.get('selected') === undefined) && this.selected === false) {
|
|
104
|
+
&& !(changed.get('selected') === undefined) && this.selected === false) {
|
|
106
105
|
__classPrivateFieldGet(this, _PfOption_internals, "f").ariaSelected = this.selected ? 'true' : 'false';
|
|
107
106
|
}
|
|
108
107
|
if (changed.has('disabled')) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pf-option.js","sourceRoot":"","sources":["pf-option.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;;;AAI/F
|
|
1
|
+
{"version":3,"file":"pf-option.js","sourceRoot":"","sources":["pf-option.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;;;AA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M,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzE,CAAC;;;;AA9Ge,eAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAGU;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAI7D;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCAG3B;AAO4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAGjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCAAgB;AAGhC;IAAX,QAAQ,EAAE;6CAAkB;AAGrB;IADP,kBAAkB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAClB;AA1BnB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAgHpB","sourcesContent":["import { LitElement, html, type PropertyValues } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { queryAssignedNodes } from 'lit/decorators/query-assigned-nodes.js';\nimport { property } from 'lit/decorators/property.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\n\nimport styles from './pf-option.css';\n\n/**\n * Option within a listbox\n * @slot -\n * option text\n * @slot icon\n * optional icon\n * @slot description\n * optional description\n */\n@customElement('pf-option')\nexport class PfOption extends LitElement {\n static readonly styles = [styles];\n\n /** whether option is disabled */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** form value for this option */\n @property({ reflect: true })\n get value() {\n return (this.#value ?? this.textContent ?? '').trim();\n }\n\n set value(v: string) {\n this.#value = v;\n }\n\n /** whether option is selected */\n @property({ type: Boolean }) selected = false;\n\n /** whether option is active descendant */\n @property({ type: Boolean }) active = false;\n\n /** Optional option description; overridden by description slot. */\n @property() description = '';\n\n @queryAssignedNodes({ slot: '', flatten: true })\n private _slottedText!: Node[];\n\n /**\n * this option's position relative to the other options\n */\n set posInSet(posInSet: number | null) {\n this.#internals.ariaPosInSet = `${Math.max(0, posInSet ?? 0)}`;\n }\n\n get posInSet() {\n const parsed = parseInt(this.#internals.ariaPosInSet ?? '0');\n return Number.isNaN(parsed) ? null : parsed;\n }\n\n /**\n * total number of options\n */\n set setSize(setSize: number | null) {\n this.#internals.ariaSetSize = `${Math.max(0, setSize ?? 0)}`;\n }\n\n get setSize() {\n try {\n const int = parseInt(this.#internals.ariaSetSize ?? '0');\n if (Number.isNaN(int)) {\n return 0;\n } else {\n return int;\n }\n } catch {\n return 0;\n }\n }\n\n #value?: string;\n\n #internals = InternalsController.of(this, { role: 'option' });\n\n override connectedCallback() {\n super.connectedCallback();\n this.id ||= getRandomId();\n }\n\n render() {\n const { disabled, active } = this;\n return html`\n <div id=\"outer\" class=\"${classMap({ active, disabled })}\">\n <input type=\"checkbox\"\n aria-hidden=\"true\"\n role=\"presentation\"\n tabindex=\"-1\"\n ?checked=\"${this.selected}\"\n ?disabled=\"${this.disabled}\">\n <slot name=\"icon\"></slot>\n <span>\n <slot name=\"create\"></slot>\n <slot></slot>\n </span>\n <svg ?hidden=\"${!this.selected}\"\n viewBox=\"0 0 512 512\"\n fill=\"currentColor\"\n aria-hidden=\"true\">\n <path d=\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"></path>\n </svg>\n <slot id=\"description\" name=\"description\">${this.description ?? ''}</slot>\n </div>\n `;\n }\n\n willUpdate(changed: PropertyValues<this>) {\n if (changed.has('selected')\n // don't fire on initialization\n && !(changed.get('selected') === undefined) && this.selected === false) {\n this.#internals.ariaSelected = this.selected ? 'true' : 'false';\n }\n if (changed.has('disabled')) {\n this.#internals.ariaDisabled = String(!!this.disabled);\n }\n }\n\n /**\n * text content within option (used for filtering)\n */\n get optionText() {\n return this._slottedText.map(node => node.textContent).join('').trim();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-option': PfOption;\n }\n}\n"]}
|
package/pf-select/pf-select.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export declare class PfSelectChangeEvent extends Event {
|
|
|
14
14
|
* A select component consists of a toggle control to open and close a menu of actions or links.
|
|
15
15
|
* Selects differ from dropdowns in that they persist selection,
|
|
16
16
|
* whereas dropdowns are typically used to present a list of actions or links.
|
|
17
|
-
*
|
|
18
17
|
* @slot - insert `pf-option` and/or `pf-option-groups` here
|
|
19
18
|
* @slot placeholder - placeholder text for the select. Overrides the `placeholder` attribute.
|
|
20
19
|
* @fires open - when the menu toggles open
|
|
@@ -23,7 +22,13 @@ export declare class PfSelectChangeEvent extends Event {
|
|
|
23
22
|
export declare class PfSelect extends LitElement {
|
|
24
23
|
#private;
|
|
25
24
|
static readonly styles: CSSStyleSheet[];
|
|
26
|
-
static readonly shadowRootOptions:
|
|
25
|
+
static readonly shadowRootOptions: {
|
|
26
|
+
delegatesFocus: boolean;
|
|
27
|
+
mode: ShadowRootMode;
|
|
28
|
+
slotAssignment?: SlotAssignmentMode | undefined;
|
|
29
|
+
customElements?: CustomElementRegistry | undefined;
|
|
30
|
+
registry?: CustomElementRegistry | undefined;
|
|
31
|
+
};
|
|
27
32
|
static readonly formAssociated = true;
|
|
28
33
|
/** Variant of rendered Select */
|
|
29
34
|
variant: 'single' | 'checkbox';
|
|
@@ -75,7 +80,7 @@ export declare class PfSelect extends LitElement {
|
|
|
75
80
|
get options(): PfOption[];
|
|
76
81
|
private _toggle?;
|
|
77
82
|
willUpdate(changed: PropertyValues<this>): void;
|
|
78
|
-
render(): import("lit").TemplateResult<1>;
|
|
83
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
79
84
|
updated(changed: PropertyValues<this>): void;
|
|
80
85
|
firstUpdated(): void;
|
|
81
86
|
/**
|
package/pf-select/pf-select.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _PfSelect_instances, _PfSelect_internals, _PfSelect_float, _PfSelect_listbox, _PfSelect_lastSelected, _PfSelect_listboxElement_get, _PfSelect_hasBadge_get,
|
|
1
|
+
var _PfSelect_instances, _PfSelect_internals, _PfSelect_float, _PfSelect_slots, _PfSelect_listbox, _PfSelect_lastSelected, _PfSelect_listboxElement_get, _PfSelect_hasBadge_get, _PfSelect_buttonLabel_get, _PfSelect_variantChanged, _PfSelect_expandedChanged, _PfSelect_selectedChanged, _PfSelect_onListboxKeydown, _PfSelect_onListboxFocusout, _PfSelect_onButtonKeydown, _PfSelect_onListboxSlotchange, _PfSelect_onChipRemove, _PfSelect_onTypeaheadInput, _PfSelect_computePlaceholderText;
|
|
2
2
|
import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from "tslib";
|
|
3
3
|
import { LitElement, html } from 'lit';
|
|
4
4
|
import { customElement } from 'lit/decorators/custom-element.js';
|
|
@@ -11,10 +11,11 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
|
11
11
|
import { ListboxController } from '@patternfly/pfe-core/controllers/listbox-controller.js';
|
|
12
12
|
import { RovingTabindexController } from '@patternfly/pfe-core/controllers/roving-tabindex-controller.js';
|
|
13
13
|
import { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';
|
|
14
|
-
import { FloatingDOMController } from '@patternfly/pfe-core/controllers/floating-dom-controller.js';
|
|
14
|
+
import { FloatingDOMController, } from '@patternfly/pfe-core/controllers/floating-dom-controller.js';
|
|
15
15
|
import { PfOption } from './pf-option.js';
|
|
16
16
|
import { css } from "lit";
|
|
17
17
|
const styles = css `:host {\n font-family: var(--pf-global--FontFamily--sans-serif, "RedHatTextUpdated", "Overpass", overpass, helvetica, arial, sans-serif);\n font-size: var(--pf-global--FontSize--md, 16px);\n font-weight: var(--pf-global--FontWeight--normal, 400);\n\tcolor: var(--pf-global--Color--100, #151515);\n --_pf-option-checkboxes-display: none;\n --_pf-option-svg-display: block;\n\t--pf-c-select__toggle--PaddingTop: var(--pf-global--spacer--form-element, 0.375rem);\n\t--pf-c-select__toggle--PaddingRight: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__toggle--PaddingBottom: var(--pf-global--spacer--form-element, 0.375rem);\n\t--pf-c-select__toggle--PaddingLeft: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__toggle--MinWidth: var(--pf-global--target-size--MinWidth, 44px);\n\t--pf-c-select__toggle--FontSize: var(--pf-global--FontSize--md, 1rem);\n\t--pf-c-select__toggle--FontWeight: var(--pf-global--FontWeight--normal, 400);\n\t--pf-c-select__toggle--LineHeight: var(--pf-global--LineHeight--md, 1.5);\n\t--pf-c-select__toggle--BackgroundColor: var(--pf-global--BackgroundColor--100, #fff);\n\t--pf-c-select__toggle--before--BorderTopWidth: var(--pf-global--BorderWidth--sm, 1px);\n\t--pf-c-select__toggle--before--BorderRightWidth: var(--pf-global--BorderWidth--sm, 1px);\n\t--pf-c-select__toggle--before--BorderBottomWidth: var(--pf-global--BorderWidth--sm, 1px);\n\t--pf-c-select__toggle--before--BorderLeftWidth: var(--pf-global--BorderWidth--sm, 1px);\n\t--pf-c-select__toggle--before--BorderWidth: initial;\n\t--pf-c-select__toggle--before--BorderTopColor: var(--pf-global--BorderColor--300, #f0f0f0);\n\t--pf-c-select__toggle--before--BorderRightColor: var(--pf-global--BorderColor--300, #f0f0f0);\n\t--pf-c-select__toggle--before--BorderBottomColor: var(--pf-global--BorderColor--200, #8a8d90);\n\t--pf-c-select__toggle--before--BorderLeftColor: var(--pf-global--BorderColor--300, #f0f0f0);\n\t--pf-c-select__toggle--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__toggle--hover--before--BorderBottomColor: var(--pf-global--active-color--100, #06c);\n\t--pf-c-select__toggle--focus--before--BorderBottomColor: var(--pf-global--active-color--100, #06c);\n\t--pf-c-select__toggle--focus--before--BorderBottomWidth: var(--pf-global--BorderWidth--md, 2px);\n\t--pf-c-select__toggle--active--before--BorderBottomColor: var(--pf-global--active-color--100, #06c);\n\t--pf-c-select__toggle--active--before--BorderBottomWidth: var(--pf-global--BorderWidth--md, 2px);\n\t--pf-c-select__toggle--m-expanded--before--BorderBottomColor: var(--pf-global--active-color--100, #06c);\n\t--pf-c-select__toggle--m-expanded--before--BorderBottomWidth: var(--pf-global--BorderWidth--md, 2px);\n\t--pf-c-select__toggle--disabled--BackgroundColor: var(--pf-global--disabled-color--300, #f0f0f0);\n\t--pf-c-select__toggle--m-plain--before--BorderColor: transparent;\n\t--pf-c-select__toggle--m-placeholder--Color: transparent;\n\t--pf-c-select--m-invalid__toggle--before--BorderBottomColor: var(--pf-global--danger-color--100, #c9190b);\n\t--pf-c-select--m-invalid__toggle--before--BorderBottomWidth: var(--pf-global--BorderWidth--md, 2px);\n\t--pf-c-select--m-invalid__toggle--hover--before--BorderBottomColor: var(--pf-global--danger-color--100, #c9190b);\n\t--pf-c-select--m-invalid__toggle--focus--before--BorderBottomColor: var(--pf-global--danger-color--100, #c9190b);\n\t--pf-c-select--m-invalid__toggle--active--before--BorderBottomColor: var(--pf-global--danger-color--100, #c9190b);\n\t--pf-c-select--m-invalid__toggle--m-expanded--before--BorderBottomColor: var(--pf-global--danger-color--100, #c9190b);\n\t--pf-c-select--m-invalid__toggle-status-icon--Color: var(--pf-global--danger-color--100, #c9190b);\n\t--pf-c-select--m-success__toggle--before--BorderBottomColor: var(--pf-global--success-color--100, #3e8635);\n\t--pf-c-select--m-success__toggle--before--BorderBottomWidth: var(--pf-global--BorderWidth--md, 2px);\n\t--pf-c-select--m-success__toggle--hover--before--BorderBottomColor: var(--pf-global--success-color--100, #3e8635);\n\t--pf-c-select--m-success__toggle--focus--before--BorderBottomColor: var(--pf-global--success-color--100, #3e8635);\n\t--pf-c-select--m-success__toggle--active--before--BorderBottomColor: var(--pf-global--success-color--100, #3e8635);\n\t--pf-c-select--m-success__toggle--m-expanded--before--BorderBottomColor: var(--pf-global--success-color--100, #3e8635);\n\t--pf-c-select--m-success__toggle-status-icon--Color: var(--pf-global--success-color--100, #3e8635);\n\t--pf-c-select--m-warning__toggle--before--BorderBottomColor: var(--pf-global--warning-color--100, #f0ab00);\n\t--pf-c-select--m-warning__toggle--before--BorderBottomWidth: var(--pf-global--BorderWidth--md, 2px);\n\t--pf-c-select--m-warning__toggle--hover--before--BorderBottomColor: var(--pf-global--warning-color--100, #f0ab00);\n\t--pf-c-select--m-warning__toggle--focus--before--BorderBottomColor: var(--pf-global--warning-color--100, #f0ab00);\n\t--pf-c-select--m-warning__toggle--active--before--BorderBottomColor: var(--pf-global--warning-color--100, #f0ab00);\n\t--pf-c-select--m-warning__toggle--m-expanded--before--BorderBottomColor: var(--pf-global--warning-color--100, #f0ab00);\n\t--pf-c-select--m-warning__toggle-status-icon--Color: var(--pf-global--warning-color--100, #f0ab00);\n\t--pf-c-select__toggle-wrapper--not-last-child--MarginRight: var(--pf-global--spacer--xs, 0.25rem);\n\t--pf-c-select__toggle-wrapper--MaxWidth: calc(100% - var(--pf-global--spacer--lg, 1.5rem));\n\t--pf-c-select__toggle-wrapper--c-chip-group--MarginTop: 0.3125rem;\n\t--pf-c-select__toggle-wrapper--c-chip-group--MarginBottom: 0.3125rem;\n\t--pf-c-select__toggle-typeahead--FlexBasis: 10em;\n\t--pf-c-select__toggle-typeahead--BackgroundColor: transparent;\n\t--pf-c-select__toggle-typeahead--BorderTop: var(--pf-global--BorderWidth--sm, 1px) solid transparent;\n\t--pf-c-select__toggle-typeahead--BorderRight: none;\n\t--pf-c-select__toggle-typeahead--BorderLeft: none;\n\t--pf-c-select__toggle-typeahead--MinWidth: 7.5rem;\n\t--pf-c-select__toggle-typeahead--focus--PaddingBottom: calc(var(--pf-global--spacer--form-element, 0.375rem) - var(--pf-global--BorderWidth--md));\n\t--pf-c-select__toggle--m-placeholder__toggle-text--Color: var(--pf-global--Color--dark-200, #6a6e73);\n\t--pf-c-select__toggle-icon--toggle-text--MarginLeft: var(--pf-global--spacer--xs, 0.25rem);\n\t--pf-c-select__toggle-badge--PaddingLeft: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__toggle-status-icon--MarginLeft: var(--pf-global--spacer--xs, 0.25rem);\n\t--pf-c-select__toggle-status-icon--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__toggle-arrow--MarginLeft: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__toggle-arrow--MarginRight: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__toggle-arrow--with-clear--MarginLeft: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__toggle-arrow--m-top--m-expanded__toggle-arrow--Rotate: 180deg;\n\t--pf-c-select--m-plain__toggle-arrow--Color: var(--pf-global--Color--200, #6a6e73);\n\t--pf-c-select--m-plain--hover__toggle-arrow--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__toggle-clear--PaddingRight: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__toggle-clear--PaddingLeft: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__toggle-clear--toggle-button--PaddingLeft: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__toggle-button--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__menu--BackgroundColor: var(--pf-global--BackgroundColor--light-100, #fff);\n\t--pf-c-select__menu--BoxShadow: var(--pf-global--BoxShadow--md, 0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06));\n\t--pf-c-select__menu--PaddingTop: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu--PaddingBottom: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu--Top: calc(100% + var(--pf-global--spacer--xs, 0.25rem));\n\t--pf-c-select__menu--ZIndex: var(--pf-global--ZIndex--sm, 200);\n\t--pf-c-select__menu--Width: auto;\n\t--pf-c-select__menu--MinWidth: 100%;\n\t--pf-c-select__menu--m-top--TranslateY: calc(-100% - var(--pf-global--spacer--xs, 0.25rem));\n\t--pf-c-select__list-item--m-loading--PaddingTop: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu-item--PaddingTop: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu-item--PaddingRight: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-item--m-selected--PaddingRight: var(--pf-global--spacer--2xl, 3rem);\n\t--pf-c-select__menu-item--PaddingBottom: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu-item--PaddingLeft: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-item--FontSize: var(--pf-global--FontSize--md, 1rem);\n\t--pf-c-select__menu-item--FontWeight: var(--pf-global--FontWeight--normal, 400);\n\t--pf-c-select__menu-item--LineHeight: var(--pf-global--LineHeight--md, 1.5);\n\t--pf-c-select__menu-item--Color: var(--pf-global--Color--dark-100, #151515);\n\t--pf-c-select__menu-item--disabled--Color: var(--pf-global--Color--dark-200, #6a6e73);\n\t--pf-c-select__menu-item--Width: 100%;\n\t--pf-c-select__menu-item--hover--BackgroundColor: var(--pf-global--BackgroundColor--light-300, #f0f0f0);\n\t--pf-c-select__menu-item--focus--BackgroundColor: var(--pf-global--BackgroundColor--light-300, #f0f0f0);\n\t--pf-c-select__menu-item--disabled--BackgroundColor: transparent;\n\t--pf-c-select__menu-item--m-link--Width: auto;\n\t--pf-c-select__menu-item--m-link--hover--BackgroundColor: transparent;\n\t--pf-c-select__menu-item--m-link--focus--BackgroundColor: transparent;\n\t--pf-c-select__menu-item--m-action--Color: var(--pf-global--Color--200, #6a6e73);\n\t--pf-c-select__menu-item--m-action--hover--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__menu-item--m-action--focus--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__menu-item--m-action--disabled--Color: var(--pf-global--disabled-color--200, #d2d2d2);\n\t--pf-c-select__menu-item--m-action--Width: auto;\n\t--pf-c-select__menu-item--m-action--FontSize: var(--pf-global--icon--FontSize--sm, 0.625rem);\n\t--pf-c-select__menu-item--m-action--hover--BackgroundColor: transparent;\n\t--pf-c-select__menu-item--m-action--focus--BackgroundColor: transparent;\n\t--pf-c-select__menu-item--hover__menu-item--m-action--Color: var(--pf-global--Color--200, #6a6e73);\n\t--pf-c-select__menu-item--m-favorite-action--Color: var(--pf-global--Color--200, #6a6e73);\n\t--pf-c-select__menu-item--m-favorite-action--hover--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__menu-item--m-favorite-action--focus--Color: var(--pf-global--Color--100, #151515);\n\t--pf-c-select__menu-wrapper--m-favorite__menu-item--m-favorite-action--Color: var(--pf-global--palette--gold-400, #f0ab00);\n\t--pf-c-select__menu-wrapper--m-favorite__menu-item--m-favorite-action--hover--Color: var(--pf-global--palette--gold-500, #c58c00);\n\t--pf-c-select__menu-wrapper--m-favorite__menu-item--m-favorite-action--focus--Color: var(--pf-global--palette--gold-500, #c58c00);\n\t--pf-c-select__menu-item--m-load--Color: var(--pf-global--link--Color, #06c);\n\t--pf-c-select__menu-item-icon--Color: var(--pf-global--active-color--100, #06c);\n\t--pf-c-select__menu-item-icon--FontSize: var(--pf-global--icon--FontSize--sm, 0.625rem);\n\t--pf-c-select__menu-item-icon--Right: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-item-icon--Top: 50%;\n\t--pf-c-select__menu-item-icon--TranslateY: -50%;\n\t--pf-c-select__menu-item-action-icon--MinHeight: calc(var(--pf-c-select__menu-item--FontSize) * var(--pf-c-select__menu-item--LineHeight));\n\t--pf-c-select__menu-item--match--FontWeight: var(--pf-global--FontWeight--bold, 700);\n\t--pf-c-select__menu-search--PaddingTop: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu-search--PaddingRight: var(--pf-c-select__menu-item--PaddingRight);\n\t--pf-c-select__menu-search--PaddingBottom: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-search--PaddingLeft: var(--pf-c-select__menu-item--PaddingLeft);\n\t--pf-c-select__menu-group--menu-group--PaddingTop: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu-group-title--PaddingTop: var(--pf-c-select__menu-item--PaddingTop);\n\t--pf-c-select__menu-group-title--PaddingRight: var(--pf-c-select__menu-item--PaddingRight);\n\t--pf-c-select__menu-group-title--PaddingBottom: var(--pf-c-select__menu-item--PaddingBottom);\n\t--pf-c-select__menu-group-title--PaddingLeft: var(--pf-c-select__menu-item--PaddingLeft);\n\t--pf-c-select__menu-group-title--FontSize: var(--pf-global--FontSize--xs, 0.75rem);\n\t--pf-c-select__menu-group-title--FontWeight: var(--pf-global--FontWeight--normal, 400);\n\t--pf-c-select__menu-group-title--Color: var(--pf-global--Color--dark-200, #6a6e73);\n\t--pf-c-select__menu-item-count--MarginLeft: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-item-count--FontSize: var(--pf-global--FontSize--sm, 0.875rem);\n\t--pf-c-select__menu-item-count--Color: var(--pf-global--Color--200, #6a6e73);\n\t--pf-c-select__menu-item--disabled__menu-item-count--Color: var(--pf-global--Color--dark-200, #6a6e73);\n\t--pf-c-select__menu-item-description--FontSize: var(--pf-global--FontSize--xs, 0.75rem);\n\t--pf-c-select__menu-item-description--Color: var(--pf-global--Color--200, #6a6e73);\n\t--pf-c-select__menu-item-description--PaddingRight: var(--pf-c-select__menu-item--PaddingRight);\n\t--pf-c-select__menu-item-main--PaddingRight: var(--pf-c-select__menu-item--PaddingRight);\n\t--pf-c-select__menu-item--m-selected__menu-item-main--PaddingRight: var(--pf-c-select__menu-item--m-selected--PaddingRight);\n\t--pf-c-select__menu-footer--BoxShadow: var(--pf-global--BoxShadow--sm-top, 0 -0.125rem 0.25rem -0.0625rem rgba(3, 3, 3, 0.16));\n\t--pf-c-select__menu-footer--PaddingTop: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-footer--PaddingRight: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-footer--PaddingBottom: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-footer--PaddingLeft: var(--pf-global--spacer--md, 1rem);\n\t--pf-c-select__menu-footer--MarginTop: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select__menu-footer--MarginBottom: calc(var(--pf-global--spacer--sm, 0.5rem) * -1);\n\t--pf-c-select-menu--c-divider--MarginTop: var(--pf-global--spacer--sm, 0.5rem);\n\t--pf-c-select-menu--c-divider--MarginBottom: var(--pf-global--spacer--sm, 0.5rem);\n}\n\n:host, #outer {\n display: flex;\n flex-direction: column;\n align-items: stretch;\n}\n\n:host([hidden]),\n*[hidden] {\n display: none !important;\n}\n\n:host([disabled]) {\n pointer-events: none !important;\n}\n\n#outer.disabled {\n color: var(--pf-global--Color--dark-200, #6a6e73) !important;\n}\n\n#outer {\n position: relative;\n}\n\n/* TODO(bennyp): see if we can get rid of this wrapping node, for perf reasons */\n#listbox-container {\n display: inline-flex;\n border: 1px solid var(--pf-global--BorderColor--100, #d2d2d2);\n position: absolute;\n background-color: var(--pf-theme--color--surface--lightest, #fff) !important;\n opacity: 0;\n --_active-descendant-color: var(--pf-theme--color--surface--lighter, #f0f0f0) !important\n}\n\n#outer.expanded #listbox-container {\n opacity: 1;\n z-index: 9999 !important;\n}\n\n#listbox {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n}\n\n#listbox slot.disabled {\n color: var(--pf-c-list__item-icon--Color, #6a6e73) !important;\n background-color: var(--pf-theme--color--surface--lighter, #f0f0f0) !important;\n border-color: var(--pf-theme--color--surface--lighter, #f0f0f0) !important;\n pointer-events: none;\n cursor: not-allowed;;\n --_active-descendant-color: transparent;\n --_svg-color: var(--pf-c-list__item-icon--Color, #6a6e73) !important;\n}\n\n\n#toggle {\n background-color: var(--pf-theme--color--surface--lightest, #fff) !important;\n}\n\n#toggle,\n#toggle-button,\n#toggle-input {\n display: flex;\n align-items: center;\n font-family: var(--pf-global--FontFamily--sans-serif, "RedHatTextUpdated", "Overpass", overpass, helvetica, arial, sans-serif);\n font-size: var(--pf-global--FontSize--md, 16px);\n font-weight: var(--pf-global--FontWeight--normal, 400);\n line-height: 1.6;\n}\n\n#toggle {\n border: 1px solid var(--pf-global--BorderColor--100, #d2d2d2);\n border-bottom-color: var(--pf-theme--color--text, #151515);\n justify-content: space-between;\n}\n\n.expanded #toggle {\n border-bottom-width: 2px;\n border-bottom-color: var(--pf-theme--color--accent, #0066cc);\n}\n\n.disabled #toggle {\n color: var(--pf-global--Color--dark-200, #6a6e73) !important;\n background-color: var(--pf-theme--color--surface--lighter, #f0f0f0) !important;\n border-color: var(--pf-theme--color--surface--lighter, #f0f0f0) !important;\n}\n\n#toggle-input,\n#toggle-button {\n background: transparent;\n border: none;\n text-align: left;\n border-radius: 0;\n flex: 1 0 auto;\n min-height: 44px;\n min-width: 44px;\n}\n\n#toggle-input {\n justify-content: space-between;\n padding: var(--pf-global--spacer--xs, 0.25rem) var(--pf-global--spacer--sm, 0.5rem);\n}\n\n.disabled #toggle-input {\n pointer-events: none;\n}\n\n#toggle-button {\n color: currentColor;\n background-color: transparent;\n justify-content: flex-end;\n padding: var(--pf-global--spacer--sm, 0.5rem);\n}\n\n#outer.typeahead #toggle-button {\n flex: 0 0 auto;\n}\n\n#toggle-badge {\n flex: 1 0 auto;\n margin-inline-start: 0.25em;\n}\n\n#toggle-text {\n flex: 1 1 auto;\n}\n\n#toggle-text.badge {\n flex: 0 1 auto;\n}\n\npf-badge {\n padding: 0;\n}\n\n#toggle svg {\n width: 1em;\n height: 1em;\n flex: 0 0 auto;\n margin-inline-start: 1em;\n}\n\n#description {\n display: block;\n}\n\n#listbox.checkboxes {\n --_pf-option-checkboxes-display: inline;\n --_pf-option-svg-display: none;\n}\n\n::slotted(pf-option-group + hr) {\n display: none !important;\n}\n\n::slotted(hr:has(+ pf-option-group)) {\n display: none !important;\n}\n\n.offscreen {\n position: absolute;\n left: -99999;\n width: 0;\n height: 0;\n opacity: 0;\n overflow: hidden;\n}\n\n::slotted(hr) {\n --pf-c-divider--BorderWidth--base: var(--pf-global--BorderWidth--sm, 1px);\n --pf-c-divider--BorderColor--base: var(--pf-c-divider--BackgroundColor);\n --pf-c-divider--Height: var(--pf-c-divider--BorderWidth--base);\n --pf-c-divider--BackgroundColor: var(--pf-global--BorderColor--100, #d2d2d2);\n --pf-c-divider--after--BackgroundColor: var(--pf-c-divider--BorderColor--base);\n --pf-c-divider--after--FlexBasis: 100%;\n --pf-c-divider--after--Inset: 0%;\n --pf-c-divider--m-vertical--after--FlexBasis: 100%;\n --pf-c-divider--m-horizontal--Display: flex;\n --pf-c-divider--m-horizontal--FlexDirection: row;\n --pf-c-divider--m-horizontal--after--Height: var(--pf-c-divider--Height);\n --pf-c-divider--m-horizontal--after--Width: auto;\n --pf-c-divider--m-vertical--Display: inline-flex;\n --pf-c-divider--m-vertical--FlexDirection: column;\n --pf-c-divider--m-vertical--after--Height: auto;\n --pf-c-divider--m-vertical--after--Width: var(--pf-c-divider--BorderWidth--base);\n --pf-hidden-visible--visible--Display: var(--pf-c-divider--Display);\n --pf-c-divider--Display: var(--pf-c-divider--m-horizontal--Display);\n --pf-c-divider--FlexDirection: var(--pf-c-divider--m-horizontal--FlexDirection);\n --pf-c-divider--after--Width: var(--pf-c-divider--m-horizontal--after--Width);\n --pf-c-divider--after--Height: var(--pf-c-divider--m-horizontal--after--Height);\n display: var(--pf-c-divider--Display, flex);\n\tflex-direction: var(--pf-c-divider--FlexDirection);\n\tborder: 0;\n width: 100%;\n margin-top: var(--pf-c-select-menu--c-divider--MarginTop);\n margin-bottom: var(--pf-c-select-menu--c-divider--MarginBottom);\n}\n\n::slotted(hr)::after {\n content: '';\n width: var(--pf-c-divider--after--Width, 100%) !important;\n height: var(--pf-c-divider--after--Height, 1px);\n background-color: var(--pf-c-divider--after--BackgroundColor);\n flex: 1 0 100%;\n}\n`;
|
|
18
|
+
import { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';
|
|
18
19
|
export class PfSelectChangeEvent extends Event {
|
|
19
20
|
constructor() {
|
|
20
21
|
super('change', { bubbles: true });
|
|
@@ -30,7 +31,6 @@ export class PfSelectChangeEvent extends Event {
|
|
|
30
31
|
* A select component consists of a toggle control to open and close a menu of actions or links.
|
|
31
32
|
* Selects differ from dropdowns in that they persist selection,
|
|
32
33
|
* whereas dropdowns are typically used to present a list of actions or links.
|
|
33
|
-
*
|
|
34
34
|
* @slot - insert `pf-option` and/or `pf-option-groups` here
|
|
35
35
|
* @slot placeholder - placeholder text for the select. Overrides the `placeholder` attribute.
|
|
36
36
|
* @fires open - when the menu toggles open
|
|
@@ -44,6 +44,7 @@ let PfSelect = class PfSelect extends LitElement {
|
|
|
44
44
|
_PfSelect_float.set(this, new FloatingDOMController(this, {
|
|
45
45
|
content: () => this.shadowRoot?.getElementById('listbox-container') ?? null,
|
|
46
46
|
}));
|
|
47
|
+
_PfSelect_slots.set(this, new SlotController(this, null, 'placeholder'));
|
|
47
48
|
_PfSelect_listbox.set(this, void 0); /* | ListboxActiveDescendantController */
|
|
48
49
|
/** Variant of rendered Select */
|
|
49
50
|
this.variant = 'single';
|
|
@@ -124,20 +125,14 @@ let PfSelect = class PfSelect extends LitElement {
|
|
|
124
125
|
const { anchor = 'bottom', alignment = 'start', styles = {} } = __classPrivateFieldGet(this, _PfSelect_float, "f");
|
|
125
126
|
const { computedLabelText } = __classPrivateFieldGet(this, _PfSelect_internals, "f");
|
|
126
127
|
const { height, width } = this.getBoundingClientRect() || {};
|
|
128
|
+
const buttonLabel = __classPrivateFieldGet(this, _PfSelect_instances, "a", _PfSelect_buttonLabel_get);
|
|
127
129
|
const hasBadge = __classPrivateFieldGet(this, _PfSelect_instances, "a", _PfSelect_hasBadge_get);
|
|
128
130
|
const selectedOptions = __classPrivateFieldGet(this, _PfSelect_listbox, "f")?.selectedOptions ?? [];
|
|
129
131
|
const typeahead = variant.startsWith('typeahead');
|
|
130
132
|
const checkboxes = variant === 'checkbox';
|
|
131
133
|
const offscreen = typeahead && 'offscreen';
|
|
132
134
|
const badge = hasBadge && 'badge';
|
|
133
|
-
const
|
|
134
|
-
this.querySelector('[slot=placeholder]')
|
|
135
|
-
?.assignedNodes()
|
|
136
|
-
?.reduce((acc, node) => `${acc}${node.textContent}`, '') ||
|
|
137
|
-
this.variant === 'checkbox' ? 'Options' : 'Select a value';
|
|
138
|
-
const buttonLabel = (this.variant === 'checkbox' ? null
|
|
139
|
-
// : this.variant === 'typeaheadmulti' ? `${this.#valueTextArray.length} ${this.itemsSelectedText}`
|
|
140
|
-
: __classPrivateFieldGet(this, _PfSelect_instances, "a", _PfSelect_valueTextArray_get).at(0)) ?? placeholder;
|
|
135
|
+
const hasSelection = !!(Array.isArray(this.selected) ? this.selected.length : this.selected);
|
|
141
136
|
return html `
|
|
142
137
|
<div id="outer"
|
|
143
138
|
style="${styleMap(styles)}"
|
|
@@ -168,7 +163,7 @@ let PfSelect = class PfSelect extends LitElement {
|
|
|
168
163
|
<button id="toggle-button"
|
|
169
164
|
role="combobox"
|
|
170
165
|
aria-hidden="${typeahead.toString()}"
|
|
171
|
-
aria-
|
|
166
|
+
aria-label="${ifDefined(this.accessibleLabel || __classPrivateFieldGet(this, _PfSelect_internals, "f").computedLabelText || undefined)}"
|
|
172
167
|
aria-describedby="placeholder"
|
|
173
168
|
aria-controls="listbox"
|
|
174
169
|
aria-haspopup="listbox"
|
|
@@ -176,7 +171,7 @@ let PfSelect = class PfSelect extends LitElement {
|
|
|
176
171
|
@keydown="${__classPrivateFieldGet(this, _PfSelect_instances, "m", _PfSelect_onButtonKeydown)}"
|
|
177
172
|
@click="${() => !typeahead && this.toggle()}"
|
|
178
173
|
tabindex="${ifDefined(typeahead ? -1 : undefined)}">
|
|
179
|
-
<span style="display: contents;"
|
|
174
|
+
<span id="button-text" style="display: contents;">
|
|
180
175
|
<span id="toggle-text"
|
|
181
176
|
class="${classMap({ offscreen, badge })}">${buttonLabel}</span>${!hasBadge ? '' : html `
|
|
182
177
|
<span id="toggle-badge">
|
|
@@ -200,7 +195,10 @@ let PfSelect = class PfSelect extends LitElement {
|
|
|
200
195
|
@focusout="${__classPrivateFieldGet(this, _PfSelect_instances, "m", _PfSelect_onListboxFocusout)}"
|
|
201
196
|
@keydown="${__classPrivateFieldGet(this, _PfSelect_instances, "m", _PfSelect_onListboxKeydown)}"
|
|
202
197
|
class="${classMap({ checkboxes })}">
|
|
203
|
-
<pf-option id="placeholder"
|
|
198
|
+
<pf-option id="placeholder"
|
|
199
|
+
disabled
|
|
200
|
+
aria-hidden="${ifDefined(hasSelection ? 'true' : undefined)}"
|
|
201
|
+
?hidden="${!this.placeholder && !__classPrivateFieldGet(this, _PfSelect_slots, "f").hasSlotted('placeholder')}">
|
|
204
202
|
<slot name="placeholder">${this.placeholder}</slot>
|
|
205
203
|
</pf-option>
|
|
206
204
|
<slot @slotchange="${__classPrivateFieldGet(this, _PfSelect_instances, "m", _PfSelect_onListboxSlotchange)}"></slot>
|
|
@@ -260,6 +258,7 @@ let PfSelect = class PfSelect extends LitElement {
|
|
|
260
258
|
};
|
|
261
259
|
_PfSelect_internals = new WeakMap();
|
|
262
260
|
_PfSelect_float = new WeakMap();
|
|
261
|
+
_PfSelect_slots = new WeakMap();
|
|
263
262
|
_PfSelect_listbox = new WeakMap();
|
|
264
263
|
_PfSelect_lastSelected = new WeakMap();
|
|
265
264
|
_PfSelect_instances = new WeakSet();
|
|
@@ -270,8 +269,24 @@ _PfSelect_hasBadge_get = function _PfSelect_hasBadge_get() {
|
|
|
270
269
|
// NOTE: revisit this in v5
|
|
271
270
|
return this.variant === 'checkbox' && !this.checkboxSelectionBadgeHidden;
|
|
272
271
|
};
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
_PfSelect_buttonLabel_get = function _PfSelect_buttonLabel_get() {
|
|
273
|
+
switch (this.variant) {
|
|
274
|
+
// TODO: implement typeaheadmulti with ActiveDescendantController
|
|
275
|
+
// case 'typeaheadmulti':
|
|
276
|
+
// return `${this.#listbox?.selectedOptions?.length ?? 0} ${this.itemsSelectedText}`
|
|
277
|
+
case 'checkbox':
|
|
278
|
+
return __classPrivateFieldGet(this, _PfSelect_listbox, "f")
|
|
279
|
+
?.selectedOptions
|
|
280
|
+
?.map?.(option => option.optionText || '')
|
|
281
|
+
?.join(' ')
|
|
282
|
+
?.trim()
|
|
283
|
+
|| __classPrivateFieldGet(this, _PfSelect_instances, "m", _PfSelect_computePlaceholderText).call(this)
|
|
284
|
+
|| 'Options';
|
|
285
|
+
default:
|
|
286
|
+
return (this.selected ? this.value : '')
|
|
287
|
+
|| __classPrivateFieldGet(this, _PfSelect_instances, "m", _PfSelect_computePlaceholderText).call(this)
|
|
288
|
+
|| 'Select a value';
|
|
289
|
+
}
|
|
275
290
|
};
|
|
276
291
|
_PfSelect_variantChanged = function _PfSelect_variantChanged() {
|
|
277
292
|
__classPrivateFieldGet(this, _PfSelect_listbox, "f")?.hostDisconnected();
|
|
@@ -344,9 +359,9 @@ _PfSelect_onListboxFocusout = function _PfSelect_onListboxFocusout(event) {
|
|
|
344
359
|
case 'checkbox':
|
|
345
360
|
if (this.expanded) {
|
|
346
361
|
const root = this.getRootNode();
|
|
347
|
-
if (root instanceof ShadowRoot
|
|
348
|
-
root instanceof Document
|
|
349
|
-
!this.options.includes(event.relatedTarget)) {
|
|
362
|
+
if (root instanceof ShadowRoot
|
|
363
|
+
|| root instanceof Document
|
|
364
|
+
&& !this.options.includes(event.relatedTarget)) {
|
|
350
365
|
this.hide();
|
|
351
366
|
}
|
|
352
367
|
}
|
|
@@ -383,8 +398,21 @@ _PfSelect_onTypeaheadInput = function _PfSelect_onTypeaheadInput() {
|
|
|
383
398
|
// }
|
|
384
399
|
// TODO: handle hiding && aria hiding options
|
|
385
400
|
};
|
|
401
|
+
_PfSelect_computePlaceholderText = function _PfSelect_computePlaceholderText() {
|
|
402
|
+
return this.placeholder
|
|
403
|
+
|| this.querySelector('[slot=placeholder]')
|
|
404
|
+
?.assignedNodes()
|
|
405
|
+
?.reduce((acc, node) => `${acc}${node.textContent}`, '')?.trim()
|
|
406
|
+
|| __classPrivateFieldGet(this, _PfSelect_listbox, "f")?.options
|
|
407
|
+
?.filter(x => x !== this.shadowRoot?.getElementById('placeholder'))
|
|
408
|
+
?.at(0)?.value
|
|
409
|
+
|| '';
|
|
410
|
+
};
|
|
386
411
|
PfSelect.styles = [styles];
|
|
387
|
-
PfSelect.shadowRootOptions = {
|
|
412
|
+
PfSelect.shadowRootOptions = {
|
|
413
|
+
...LitElement.shadowRootOptions,
|
|
414
|
+
delegatesFocus: true,
|
|
415
|
+
};
|
|
388
416
|
PfSelect.formAssociated = true;
|
|
389
417
|
__decorate([
|
|
390
418
|
property()
|
|
@@ -393,7 +421,9 @@ __decorate([
|
|
|
393
421
|
property({ attribute: 'accessible-label' })
|
|
394
422
|
], PfSelect.prototype, "accessibleLabel", void 0);
|
|
395
423
|
__decorate([
|
|
396
|
-
property({
|
|
424
|
+
property({
|
|
425
|
+
attribute: 'accessible-current-selections-label',
|
|
426
|
+
})
|
|
397
427
|
], PfSelect.prototype, "accessibleCurrentSelectionsLabel", void 0);
|
|
398
428
|
__decorate([
|
|
399
429
|
property({ attribute: 'items-selected-text' })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pf-select.js","sourceRoot":"","sources":["pf-select.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO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AAE,SAAS,EAAE,qCAAqC,EAAE,CAAC;kEAAyD;AAKxE;IAA/C,QAAQ,CAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;mDAAsC;AAKzC;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAKjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAKN;IAAtD,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAoB;AAK9D;IAAX,QAAQ,EAAE;uCAAgB;AAGf;IAAX,QAAQ,EAAE;6CAAsB;AAOJ;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAgC;AAMzD;IAHF,QAAQ,CAAC;QACR,SAAS,EAAE,iCAAiC;QAC5C,IAAI,EAAE,OAAO;KACd,CAAC;8DAAsC;AAiCP;IAAhC,KAAK,CAAC,gBAAgB,CAAC;yCAAqC;AApGlD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA+ZpB","sourcesContent":["import type { PfChipRemoveEvent } from '@patternfly/elements/pf-chip/pf-chip.js';\n\nimport { LitElement, html, type PropertyValues } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { ListboxController } from '@patternfly/pfe-core/controllers/listbox-controller.js';\nimport { RovingTabindexController } from '@patternfly/pfe-core/controllers/roving-tabindex-controller.js';\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\nimport { FloatingDOMController, type Placement } from '@patternfly/pfe-core/controllers/floating-dom-controller.js';\n\nimport { PfOption } from './pf-option.js';\n\nimport styles from './pf-select.css';\n\nexport interface PfSelectUserOptions {\n id: string;\n value: string;\n}\n\nexport class PfSelectChangeEvent extends Event {\n constructor() {\n super('change', { bubbles: true });\n }\n}\n\n// NOTE: this file contains numerous // comments, which ordinarily would be deleted\n// They are here to save the work already done on typeahead, which has a much more complex\n// accessibility model, and which is planned for the next release\n// * @fires filter - when the filter value changes. used to perform custom filtering\n\n/**\n * A select list enables users to select one or more items from a list.\n *\n * A select component consists of a toggle control to open and close a menu of actions or links.\n * Selects differ from dropdowns in that they persist selection,\n * whereas dropdowns are typically used to present a list of actions or links.\n *\n * @slot - insert `pf-option` and/or `pf-option-groups` here\n * @slot placeholder - placeholder text for the select. Overrides the `placeholder` attribute.\n * @fires open - when the menu toggles open\n * @fires close - when the menu toggles closed\n */\n@customElement('pf-select')\nexport class PfSelect extends LitElement {\n static readonly styles = [styles];\n\n static override readonly shadowRootOptions: ShadowRootInit = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n static readonly formAssociated = true;\n\n #internals = InternalsController.of(this);\n\n #float = new FloatingDOMController(this, {\n content: () => this.shadowRoot?.getElementById('listbox-container') ?? null,\n });\n\n #listbox?: ListboxController<PfOption>; /* | ListboxActiveDescendantController */\n\n /** Variant of rendered Select */\n @property() variant: 'single' | 'checkbox' /* | 'typeahead' | 'typeaheadmulti' */ = 'single';\n\n /**\n * Accessible label for the select\n */\n @property({ attribute: 'accessible-label' }) accessibleLabel?: string;\n\n /**\n * Accessible label for chip group used to describe chips\n */\n @property({ attribute: 'accessible-current-selections-label' }) accessibleCurrentSelectionsLabel = 'Current selections';\n\n /**\n * multi listbox button text\n */\n @property({ attribute: 'items-selected-text' }) itemsSelectedText = 'items selected';\n\n /**\n * whether select is disabled\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Whether the select listbox is expanded\n */\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n /**\n * enable to flip listbox when it reaches boundary\n */\n @property({ attribute: 'enable-flip', type: Boolean }) enableFlip = false;\n\n // @property() filter = '';\n\n /** Current form value */\n @property() value?: string;\n\n /** Placeholder entry. Overridden by the `placeholder` slot */\n @property() placeholder?: string;\n\n /**\n * Indicates initial popover position.\n * There are 6 options: `bottom`, `top`, `top-start`, `top-end`, `bottom-start`, `bottom-end`.\n * Default is `bottom`.\n */\n @property({ reflect: true }) position: Placement = 'bottom';\n\n /** Flag indicating if selection badge should be hidden for checkbox variant,default false */\n @property({\n attribute: 'checkbox-selection-badge-hidden',\n type: Boolean,\n }) checkboxSelectionBadgeHidden = false;\n\n // @property({ attribute: false }) customFilter?: (option: PfOption) => boolean;\n\n /**\n * Single select option value for single select menus,\n * or array of select option values for multi select.\n */\n set selected(optionsList: PfOption | PfOption[]) {\n this.#listbox?.setValue(optionsList);\n }\n\n get selected(): PfOption | PfOption[] | undefined {\n return this.#listbox?.value;\n }\n\n /**\n * array of slotted options\n */\n get options(): PfOption[] {\n const opts = Array.from(this.querySelectorAll('pf-option'));\n const placeholder = this.shadowRoot?.getElementById('placeholder') as PfOption | null;\n if (placeholder) {\n return [placeholder, ...opts];\n } else {\n return opts;\n }\n }\n\n // @query('pf-chip-group') private _chipGroup?: PfChipGroup;\n\n // @query('#toggle-input') private _input?: HTMLInputElement;\n\n @query('#toggle-button') private _toggle?: HTMLButtonElement;\n\n #lastSelected = this.selected;\n\n get #listboxElement() {\n return this.shadowRoot?.getElementById('listbox') ?? null;\n }\n\n /**\n * whether select has badge for number of selected items\n */\n get #hasBadge() {\n // NOTE: revisit this in v5\n return this.variant === 'checkbox' && !this.checkboxSelectionBadgeHidden;\n }\n\n /**\n * array of text content from listbox's array of selected options\n */\n get #valueTextArray() {\n return this.#listbox?.selectedOptions.map(option => option.optionText || '') ?? [];\n }\n\n override willUpdate(changed: PropertyValues<this>) {\n if (this.variant === 'checkbox') {\n import('@patternfly/elements/pf-badge/pf-badge.js');\n }\n if (changed.has('variant')) {\n this.#variantChanged();\n }\n if (changed.has('value')) {\n this.#internals.setFormValue(this.value ?? '');\n }\n if (changed.has('disabled')) {\n this.#listbox!.disabled = this.disabled;\n }\n // TODO: handle filtering in the element, not the controller\n // if (changed.has('filter')) {\n // this.#listbox.filter = this.filter;\n // }\n }\n\n render() {\n const { disabled, expanded, variant } = this;\n const { anchor = 'bottom', alignment = 'start', styles = {} } = this.#float;\n const { computedLabelText } = this.#internals;\n const { height, width } = this.getBoundingClientRect() || {};\n const hasBadge = this.#hasBadge;\n const selectedOptions = this.#listbox?.selectedOptions ?? [];\n const typeahead = variant.startsWith('typeahead');\n const checkboxes = variant === 'checkbox';\n const offscreen = typeahead && 'offscreen';\n const badge = hasBadge && 'badge';\n\n\n const placeholder =\n this.placeholder ||\n this.querySelector<HTMLSlotElement>('[slot=placeholder]')\n ?.assignedNodes()\n ?.reduce((acc, node) => `${acc}${node.textContent}`, '') ||\n this.variant === 'checkbox' ? 'Options' : 'Select a value';\n const buttonLabel = (this.variant === 'checkbox' ? null\n // : this.variant === 'typeaheadmulti' ? `${this.#valueTextArray.length} ${this.itemsSelectedText}`\n : this.#valueTextArray.at(0)) ?? placeholder;\n\n return html`\n <div id=\"outer\"\n style=\"${styleMap(styles)}\"\n class=\"${classMap({\n disabled,\n typeahead,\n expanded,\n [anchor]: !!anchor,\n [alignment]: !!alignment,\n })}\">\n <div id=\"toggle\">\n ${!(typeahead && selectedOptions.length < 1) ? '' : html`\n <pf-chip-group label=\"${this.accessibleCurrentSelectionsLabel}\">\n ${repeat(selectedOptions, opt => opt.id, opt => html`\n <pf-chip id=\"chip-${opt.textContent}\"\n .readonly=\"${this.disabled}\"\n @remove=\"${this.#onChipRemove.bind(this, opt)}\">${opt.textContent}</pf-chip>`)}\n </pf-chip-group>`}\n ${!typeahead ? '' : /* TODO: aria attrs */ html`\n <input id=\"toggle-input\"\n aria-label=\"${this.accessibleLabel ?? (computedLabelText || buttonLabel)}\"\n aria-autocomplete=\"both\"\n ?disabled=\"${disabled}\"\n ?hidden=\"${!typeahead}\"\n placeholder=\"${buttonLabel}\"\n @input=\"${this.#onTypeaheadInput}\">\n `}\n <button id=\"toggle-button\"\n role=\"combobox\"\n aria-hidden=\"${typeahead.toString() as 'true' | 'false'}\"\n aria-labelledby=\"button-text\"\n aria-describedby=\"placeholder\"\n aria-controls=\"listbox\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"${String(this.expanded) as 'true' | 'false'}\"\n @keydown=\"${this.#onButtonKeydown}\"\n @click=\"${() => !typeahead && this.toggle()}\"\n tabindex=\"${ifDefined(typeahead ? -1 : undefined)}\">\n <span style=\"display: contents;\" id=\"button-text\">\n <span id=\"toggle-text\"\n class=\"${classMap({ offscreen, badge })}\">${buttonLabel}</span>${!hasBadge ? '' : html`\n <span id=\"toggle-badge\">\n <pf-badge number=\"${selectedOptions.length}\">${selectedOptions.length}</pf-badge>\n </span>`}\n </span>\n <svg viewBox=\"0 0 320 512\"\n fill=\"currentColor\"\n aria-hidden=\"true\">\n <path d=\"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z\"></path>\n </svg>\n </button>\n </div>\n <div id=\"listbox-container\"\n ?hidden=\"${!expanded}\"\n style=\"${styleMap({\n marginTop: `${height || 0}px`,\n width: width ? `${width}px` : 'auto',\n })}\">\n <div id=\"listbox\"\n @focusout=\"${this.#onListboxFocusout}\"\n @keydown=\"${this.#onListboxKeydown}\"\n class=\"${classMap({ checkboxes })}\">\n <pf-option id=\"placeholder\" disabled>\n <slot name=\"placeholder\">${this.placeholder}</slot>\n </pf-option>\n <slot @slotchange=\"${this.#onListboxSlotchange}\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n\n override updated(changed: PropertyValues<this>) {\n if (changed.has('expanded')) {\n this.#expandedChanged();\n }\n if (changed.has('value')) {\n this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));\n }\n // whether select has removable chips for selected items\n // NOTE: revisit this in v5\n // const hasChips = this.variant === 'typeaheadmulti';\n // reset input if chip has been added\n // if (this.hasChips && this._input?.value) {\n // const chip = this.shadowRoot?.querySelector(`pf-chip#chip-${this._input?.value}`) as HTMLElement;\n // if (chip && this._chipGroup) {\n // this._chipGroup.focusOnChip(chip);\n // this._input.value = '';\n // }\n // }\n }\n\n firstUpdated() {\n // kick the renderer to that the placeholder gets picked up\n this.requestUpdate();\n // TODO: don't do filtering in the controller\n // if (this.variant === 'typeaheadmulti') {\n // this.#listbox.filter = this.filter;\n // }\n }\n\n #variantChanged() {\n this.#listbox?.hostDisconnected();\n const getHTMLElement = () => this.#listboxElement;\n switch (this.variant) {\n // TODO\n // case 'typeahead':\n // case 'typeaheadmulti':\n // this.#controller = new ListboxController.of<PfOption>(this, {\n // multi: this.variant==='typeaheadmulti',\n // a11yController: ActiveDescendantController.of(this)\n // });\n // break;\n default:\n this.#listbox = ListboxController.of<PfOption>(this, {\n multi: this.variant === 'checkbox',\n getHTMLElement,\n isSelected: option => option.selected,\n requestSelect: (option, selected) => {\n this.#lastSelected = this.selected;\n option.selected = !option.disabled && !!selected;\n this.#selectedChanged();\n return true;\n },\n a11yController: RovingTabindexController.of(this, {\n getHTMLElement,\n getItems: () => this.options,\n }),\n });\n break;\n }\n }\n\n async #expandedChanged() {\n const will = this.expanded ? 'close' : 'open';\n this.dispatchEvent(new Event(will));\n if (this.expanded) {\n await this.#float.show({ placement: this.position || 'bottom', flip: !!this.enableFlip });\n const focusableItem = this.#listbox?.activeItem ?? this.#listbox?.nextItem;\n focusableItem?.focus();\n } else if (this.#lastSelected === this.selected) {\n await this.#float.hide();\n this._toggle?.focus();\n }\n }\n\n async #selectedChanged() {\n await this.updateComplete;\n this.value = [this.selected]\n .flat()\n .filter(x => !!x)\n .map(x => x!.value)\n .join();\n this.dispatchEvent(new PfSelectChangeEvent());\n switch (this.variant) {\n case 'single':\n this.hide();\n this._toggle?.focus();\n }\n }\n\n #onListboxKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'Escape':\n this.hide();\n this._toggle?.focus();\n }\n }\n\n #onListboxFocusout(event: FocusEvent) {\n switch (this.variant) {\n case 'single':\n case 'checkbox':\n if (this.expanded) {\n const root = this.getRootNode();\n if (root instanceof ShadowRoot ||\n root instanceof Document &&\n !this.options.includes(event.relatedTarget as PfOption)\n ) {\n this.hide();\n }\n }\n }\n }\n\n #onButtonKeydown(event: KeyboardEvent) {\n switch (this.variant) {\n case 'single':\n case 'checkbox':\n switch (event.key) {\n case 'ArrowDown':\n this.show();\n }\n }\n }\n\n #onListboxSlotchange() {\n this.#listbox?.setOptions(this.options);\n this.options.forEach((option, index, options) => {\n option.setSize = options.length;\n option.posInSet = index;\n });\n }\n\n /**\n * handles chip's remove button clicking\n * @param opt chip text to be removed from values\n */\n #onChipRemove(opt: PfOption, event: PfChipRemoveEvent) {\n // if (event.chip) {\n // opt.selected = false;\n // this._input?.focus();\n // }\n }\n\n /**\n * handles typeahead combobox input event\n */\n #onTypeaheadInput() {\n // update filter\n // if (this.filter !== this._input?.value) {\n // this.filter = this._input?.value || '';\n // this.show();\n // }\n // TODO: handle hiding && aria hiding options\n }\n\n /**\n * Opens the dropdown\n */\n async show() {\n this.expanded = true;\n await this.updateComplete;\n }\n\n /**\n * Closes listbox\n */\n async hide() {\n this.expanded = false;\n await this.updateComplete;\n }\n\n /**\n * toggles popup based on current state\n */\n async toggle() {\n this.expanded = !this.expanded;\n await this.updateComplete;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-select': PfSelect;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pf-select.js","sourceRoot":"","sources":["pf-select.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC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;0CAAkB;AAKN;IAAtD,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAoB;AAK9D;IAAX,QAAQ,EAAE;uCAAgB;AAGf;IAAX,QAAQ,EAAE;6CAAsB;AAOJ;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAgC;AAMzD;IAHF,QAAQ,CAAC;QACR,SAAS,EAAE,iCAAiC;QAC5C,IAAI,EAAE,OAAO;KACd,CAAC;8DAAsC;AAiCP;IAAhC,KAAK,CAAC,gBAAgB,CAAC;yCAAqC;AA3GlD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAwbpB","sourcesContent":["import type { PfChipRemoveEvent } from '@patternfly/elements/pf-chip/pf-chip.js';\n\nimport { LitElement, html, type PropertyValues } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { ListboxController } from '@patternfly/pfe-core/controllers/listbox-controller.js';\nimport { RovingTabindexController } from '@patternfly/pfe-core/controllers/roving-tabindex-controller.js';\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\nimport {\n FloatingDOMController,\n type Placement,\n} from '@patternfly/pfe-core/controllers/floating-dom-controller.js';\n\nimport { PfOption } from './pf-option.js';\n\nimport styles from './pf-select.css';\nimport { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';\n\nexport interface PfSelectUserOptions {\n id: string;\n value: string;\n}\n\nexport class PfSelectChangeEvent extends Event {\n constructor() {\n super('change', { bubbles: true });\n }\n}\n\n// NOTE: this file contains numerous // comments, which ordinarily would be deleted\n// They are here to save the work already done on typeahead, which has a much more complex\n// accessibility model, and which is planned for the next release\n// * @fires filter - when the filter value changes. used to perform custom filtering\n\n/**\n * A select list enables users to select one or more items from a list.\n *\n * A select component consists of a toggle control to open and close a menu of actions or links.\n * Selects differ from dropdowns in that they persist selection,\n * whereas dropdowns are typically used to present a list of actions or links.\n * @slot - insert `pf-option` and/or `pf-option-groups` here\n * @slot placeholder - placeholder text for the select. Overrides the `placeholder` attribute.\n * @fires open - when the menu toggles open\n * @fires close - when the menu toggles closed\n */\n@customElement('pf-select')\nexport class PfSelect extends LitElement {\n static readonly styles = [styles];\n\n static override readonly shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n static readonly formAssociated = true;\n\n #internals = InternalsController.of(this);\n\n #float = new FloatingDOMController(this, {\n content: () => this.shadowRoot?.getElementById('listbox-container') ?? null,\n });\n\n #slots = new SlotController(this, null, 'placeholder');\n\n #listbox?: ListboxController<PfOption>; /* | ListboxActiveDescendantController */\n\n /** Variant of rendered Select */\n @property() variant: 'single' | 'checkbox' /* | 'typeahead' | 'typeaheadmulti' */ = 'single';\n\n /**\n * Accessible label for the select\n */\n @property({ attribute: 'accessible-label' }) accessibleLabel?: string;\n\n /**\n * Accessible label for chip group used to describe chips\n */\n @property({\n attribute: 'accessible-current-selections-label',\n }) accessibleCurrentSelectionsLabel = 'Current selections';\n\n /**\n * multi listbox button text\n */\n @property({ attribute: 'items-selected-text' }) itemsSelectedText = 'items selected';\n\n /**\n * whether select is disabled\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /**\n * Whether the select listbox is expanded\n */\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n /**\n * enable to flip listbox when it reaches boundary\n */\n @property({ attribute: 'enable-flip', type: Boolean }) enableFlip = false;\n\n // @property() filter = '';\n\n /** Current form value */\n @property() value?: string;\n\n /** Placeholder entry. Overridden by the `placeholder` slot */\n @property() placeholder?: string;\n\n /**\n * Indicates initial popover position.\n * There are 6 options: `bottom`, `top`, `top-start`, `top-end`, `bottom-start`, `bottom-end`.\n * Default is `bottom`.\n */\n @property({ reflect: true }) position: Placement = 'bottom';\n\n /** Flag indicating if selection badge should be hidden for checkbox variant,default false */\n @property({\n attribute: 'checkbox-selection-badge-hidden',\n type: Boolean,\n }) checkboxSelectionBadgeHidden = false;\n\n // @property({ attribute: false }) customFilter?: (option: PfOption) => boolean;\n\n /**\n * Single select option value for single select menus,\n * or array of select option values for multi select.\n */\n set selected(optionsList: PfOption | PfOption[]) {\n this.#listbox?.setValue(optionsList);\n }\n\n get selected(): PfOption | PfOption[] | undefined {\n return this.#listbox?.value;\n }\n\n /**\n * array of slotted options\n */\n get options(): PfOption[] {\n const opts = Array.from(this.querySelectorAll('pf-option'));\n const placeholder = this.shadowRoot?.getElementById('placeholder') as PfOption | null;\n if (placeholder) {\n return [placeholder, ...opts];\n } else {\n return opts;\n }\n }\n\n // @query('pf-chip-group') private _chipGroup?: PfChipGroup;\n\n // @query('#toggle-input') private _input?: HTMLInputElement;\n\n @query('#toggle-button') private _toggle?: HTMLButtonElement;\n\n #lastSelected = this.selected;\n\n get #listboxElement() {\n return this.shadowRoot?.getElementById('listbox') ?? null;\n }\n\n /**\n * whether select has badge for number of selected items\n */\n get #hasBadge() {\n // NOTE: revisit this in v5\n return this.variant === 'checkbox' && !this.checkboxSelectionBadgeHidden;\n }\n\n get #buttonLabel() {\n switch (this.variant) {\n // TODO: implement typeaheadmulti with ActiveDescendantController\n // case 'typeaheadmulti':\n // return `${this.#listbox?.selectedOptions?.length ?? 0} ${this.itemsSelectedText}`\n case 'checkbox':\n return this.#listbox\n ?.selectedOptions\n ?.map?.(option => option.optionText || '')\n ?.join(' ')\n ?.trim()\n || this.#computePlaceholderText()\n || 'Options';\n default:\n return (this.selected ? this.value : '')\n || this.#computePlaceholderText()\n || 'Select a value';\n }\n }\n\n override willUpdate(changed: PropertyValues<this>) {\n if (this.variant === 'checkbox') {\n import('@patternfly/elements/pf-badge/pf-badge.js');\n }\n if (changed.has('variant')) {\n this.#variantChanged();\n }\n if (changed.has('value')) {\n this.#internals.setFormValue(this.value ?? '');\n }\n if (changed.has('disabled')) {\n this.#listbox!.disabled = this.disabled;\n }\n // TODO: handle filtering in the element, not the controller\n // if (changed.has('filter')) {\n // this.#listbox.filter = this.filter;\n // }\n }\n\n override render() {\n const { disabled, expanded, variant } = this;\n const { anchor = 'bottom', alignment = 'start', styles = {} } = this.#float;\n const { computedLabelText } = this.#internals;\n const { height, width } = this.getBoundingClientRect() || {};\n const buttonLabel = this.#buttonLabel;\n const hasBadge = this.#hasBadge;\n const selectedOptions = this.#listbox?.selectedOptions ?? [];\n const typeahead = variant.startsWith('typeahead');\n const checkboxes = variant === 'checkbox';\n const offscreen = typeahead && 'offscreen';\n const badge = hasBadge && 'badge';\n const hasSelection = !!(Array.isArray(this.selected) ? this.selected.length : this.selected);\n\n return html`\n <div id=\"outer\"\n style=\"${styleMap(styles)}\"\n class=\"${classMap({\n disabled,\n typeahead,\n expanded,\n [anchor]: !!anchor,\n [alignment]: !!alignment,\n })}\">\n <div id=\"toggle\">\n ${!(typeahead && selectedOptions.length < 1) ? '' : html`\n <pf-chip-group label=\"${this.accessibleCurrentSelectionsLabel}\">\n ${repeat(selectedOptions, opt => opt.id, opt => html`\n <pf-chip id=\"chip-${opt.textContent}\"\n .readonly=\"${this.disabled}\"\n @remove=\"${this.#onChipRemove.bind(this, opt)}\">${opt.textContent}</pf-chip>`)}\n </pf-chip-group>`}\n ${!typeahead ? '' : /* TODO: aria attrs */ html`\n <input id=\"toggle-input\"\n aria-label=\"${this.accessibleLabel ?? (computedLabelText || buttonLabel)}\"\n aria-autocomplete=\"both\"\n ?disabled=\"${disabled}\"\n ?hidden=\"${!typeahead}\"\n placeholder=\"${buttonLabel}\"\n @input=\"${this.#onTypeaheadInput}\">\n `}\n <button id=\"toggle-button\"\n role=\"combobox\"\n aria-hidden=\"${typeahead.toString() as 'true' | 'false'}\"\n aria-label=\"${ifDefined(this.accessibleLabel || this.#internals.computedLabelText || undefined)}\"\n aria-describedby=\"placeholder\"\n aria-controls=\"listbox\"\n aria-haspopup=\"listbox\"\n aria-expanded=\"${String(this.expanded) as 'true' | 'false'}\"\n @keydown=\"${this.#onButtonKeydown}\"\n @click=\"${() => !typeahead && this.toggle()}\"\n tabindex=\"${ifDefined(typeahead ? -1 : undefined)}\">\n <span id=\"button-text\" style=\"display: contents;\">\n <span id=\"toggle-text\"\n class=\"${classMap({ offscreen, badge })}\">${buttonLabel}</span>${!hasBadge ? '' : html`\n <span id=\"toggle-badge\">\n <pf-badge number=\"${selectedOptions.length}\">${selectedOptions.length}</pf-badge>\n </span>`}\n </span>\n <svg viewBox=\"0 0 320 512\"\n fill=\"currentColor\"\n aria-hidden=\"true\">\n <path d=\"M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z\"></path>\n </svg>\n </button>\n </div>\n <div id=\"listbox-container\"\n ?hidden=\"${!expanded}\"\n style=\"${styleMap({\n marginTop: `${height || 0}px`,\n width: width ? `${width}px` : 'auto',\n })}\">\n <div id=\"listbox\"\n @focusout=\"${this.#onListboxFocusout}\"\n @keydown=\"${this.#onListboxKeydown}\"\n class=\"${classMap({ checkboxes })}\">\n <pf-option id=\"placeholder\"\n disabled\n aria-hidden=\"${ifDefined(hasSelection ? 'true' : undefined)}\"\n ?hidden=\"${!this.placeholder && !this.#slots.hasSlotted('placeholder')}\">\n <slot name=\"placeholder\">${this.placeholder}</slot>\n </pf-option>\n <slot @slotchange=\"${this.#onListboxSlotchange}\"></slot>\n </div>\n </div>\n </div>\n `;\n }\n\n override updated(changed: PropertyValues<this>) {\n if (changed.has('expanded')) {\n this.#expandedChanged();\n }\n if (changed.has('value')) {\n this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));\n }\n // whether select has removable chips for selected items\n // NOTE: revisit this in v5\n // const hasChips = this.variant === 'typeaheadmulti';\n // reset input if chip has been added\n // if (this.hasChips && this._input?.value) {\n // const chip = this.shadowRoot?.querySelector(`pf-chip#chip-${this._input?.value}`) as HTMLElement;\n // if (chip && this._chipGroup) {\n // this._chipGroup.focusOnChip(chip);\n // this._input.value = '';\n // }\n // }\n }\n\n override firstUpdated() {\n // kick the renderer to that the placeholder gets picked up\n this.requestUpdate();\n // TODO: don't do filtering in the controller\n // if (this.variant === 'typeaheadmulti') {\n // this.#listbox.filter = this.filter;\n // }\n }\n\n #variantChanged() {\n this.#listbox?.hostDisconnected();\n const getHTMLElement = () => this.#listboxElement;\n switch (this.variant) {\n // TODO\n // case 'typeahead':\n // case 'typeaheadmulti':\n // this.#controller = new ListboxController.of<PfOption>(this, {\n // multi: this.variant==='typeaheadmulti',\n // a11yController: ActiveDescendantController.of(this)\n // });\n // break;\n default:\n this.#listbox = ListboxController.of<PfOption>(this, {\n multi: this.variant === 'checkbox',\n getHTMLElement,\n isSelected: option => option.selected,\n requestSelect: (option, selected) => {\n this.#lastSelected = this.selected;\n option.selected = !option.disabled && !!selected;\n this.#selectedChanged();\n return true;\n },\n a11yController: RovingTabindexController.of(this, {\n getHTMLElement,\n getItems: () => this.options,\n }),\n });\n break;\n }\n }\n\n async #expandedChanged() {\n const will = this.expanded ? 'close' : 'open';\n this.dispatchEvent(new Event(will));\n if (this.expanded) {\n await this.#float.show({ placement: this.position || 'bottom', flip: !!this.enableFlip });\n const focusableItem = this.#listbox?.activeItem ?? this.#listbox?.nextItem;\n focusableItem?.focus();\n } else if (this.#lastSelected === this.selected) {\n await this.#float.hide();\n this._toggle?.focus();\n }\n }\n\n async #selectedChanged() {\n await this.updateComplete;\n this.value = [this.selected]\n .flat()\n .filter(x => !!x)\n .map(x => x!.value)\n .join();\n this.dispatchEvent(new PfSelectChangeEvent());\n switch (this.variant) {\n case 'single':\n this.hide();\n this._toggle?.focus();\n }\n }\n\n #onListboxKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'Escape':\n this.hide();\n this._toggle?.focus();\n }\n }\n\n #onListboxFocusout(event: FocusEvent) {\n switch (this.variant) {\n case 'single':\n case 'checkbox':\n if (this.expanded) {\n const root = this.getRootNode();\n if (root instanceof ShadowRoot\n || root instanceof Document\n && !this.options.includes(event.relatedTarget as PfOption)\n ) {\n this.hide();\n }\n }\n }\n }\n\n #onButtonKeydown(event: KeyboardEvent) {\n switch (this.variant) {\n case 'single':\n case 'checkbox':\n switch (event.key) {\n case 'ArrowDown':\n this.show();\n }\n }\n }\n\n #onListboxSlotchange() {\n this.#listbox?.setOptions(this.options);\n this.options.forEach((option, index, options) => {\n option.setSize = options.length;\n option.posInSet = index;\n });\n }\n\n /**\n * handles chip's remove button clicking\n * @param opt chip text to be removed from values\n */\n #onChipRemove(opt: PfOption, event: PfChipRemoveEvent) {\n // if (event.chip) {\n // opt.selected = false;\n // this._input?.focus();\n // }\n }\n\n /**\n * handles typeahead combobox input event\n */\n #onTypeaheadInput() {\n // update filter\n // if (this.filter !== this._input?.value) {\n // this.filter = this._input?.value || '';\n // this.show();\n // }\n // TODO: handle hiding && aria hiding options\n }\n\n #computePlaceholderText() {\n return this.placeholder\n || this.querySelector<HTMLSlotElement>('[slot=placeholder]')\n ?.assignedNodes()\n ?.reduce((acc, node) => `${acc}${node.textContent}`, '')?.trim()\n || this.#listbox?.options\n ?.filter(x => x !== this.shadowRoot?.getElementById('placeholder'))\n ?.at(0)?.value\n || '';\n }\n\n /**\n * Opens the dropdown\n */\n async show() {\n this.expanded = true;\n await this.updateComplete;\n }\n\n /**\n * Closes listbox\n */\n async hide() {\n this.expanded = false;\n await this.updateComplete;\n }\n\n /**\n * toggles popup based on current state\n */\n async toggle() {\n this.expanded = !this.expanded;\n await this.updateComplete;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-select': PfSelect;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { test } from '@playwright/test';
|
|
2
|
+
import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
|
|
3
|
+
const tagName = 'pf-select';
|
|
4
|
+
test.describe(tagName, () => {
|
|
5
|
+
test('snapshot', async ({ page }) => {
|
|
6
|
+
const componentPage = new PfeDemoPage(page, tagName);
|
|
7
|
+
await componentPage.navigate();
|
|
8
|
+
await componentPage.snapshot();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=pf-select.e2e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pf-select.e2e.js","sourceRoot":"","sources":["pf-select.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAEnF,MAAM,OAAO,GAAG,WAAW,CAAC;AAE5B,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IAC1B,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QAClC,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;QAC/B,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';\n\nconst tagName = 'pf-select';\n\ntest.describe(tagName, () => {\n test('snapshot', async ({ page }) => {\n const componentPage = new PfeDemoPage(page, tagName);\n await componentPage.navigate();\n await componentPage.snapshot();\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|