@patternfly/elements 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +8857 -8783
- package/form-control.css +127 -0
- package/package.json +12 -25
- package/pf-accordion/pf-accordion-header.css +23 -0
- package/pf-accordion/pf-accordion-header.d.ts +52 -43
- package/pf-accordion/pf-accordion-header.js +130 -87
- package/pf-accordion/pf-accordion-header.js.map +1 -1
- package/pf-accordion/pf-accordion-panel.css +15 -0
- package/pf-accordion/pf-accordion-panel.d.ts +27 -25
- package/pf-accordion/pf-accordion-panel.js +29 -43
- package/pf-accordion/pf-accordion-panel.js.map +1 -1
- package/pf-accordion/pf-accordion.d.ts +122 -65
- package/pf-accordion/pf-accordion.js +283 -94
- package/pf-accordion/pf-accordion.js.map +1 -1
- package/pf-accordion/test/pf-accordion.e2e.js +12 -0
- package/pf-accordion/test/pf-accordion.e2e.js.map +1 -1
- package/pf-accordion/test/pf-accordion.spec.js +366 -350
- package/pf-accordion/test/pf-accordion.spec.js.map +1 -1
- package/pf-avatar/pf-avatar.css +50 -24
- package/pf-avatar/pf-avatar.d.ts +29 -3
- package/pf-avatar/pf-avatar.js +51 -9
- package/pf-avatar/pf-avatar.js.map +1 -1
- package/pf-avatar/test/pf-avatar.e2e.js +12 -0
- package/pf-avatar/test/pf-avatar.e2e.js.map +1 -1
- package/pf-avatar/test/pf-avatar.spec.js +2 -3
- package/pf-avatar/test/pf-avatar.spec.js.map +1 -1
- package/pf-back-to-top/pf-back-to-top.css +10 -0
- package/pf-back-to-top/pf-back-to-top.d.ts +14 -18
- package/pf-back-to-top/pf-back-to-top.js +9 -30
- package/pf-back-to-top/pf-back-to-top.js.map +1 -1
- package/pf-back-to-top/test/pf-back-to-top.e2e.js +12 -0
- package/pf-back-to-top/test/pf-back-to-top.e2e.js.map +1 -1
- package/pf-background-image/pf-background-image.d.ts +4 -4
- package/pf-background-image/pf-background-image.js +1 -12
- package/pf-background-image/pf-background-image.js.map +1 -1
- package/pf-background-image/test/pf-background-image.e2e.js +12 -0
- package/pf-background-image/test/pf-background-image.e2e.js.map +1 -1
- package/pf-badge/pf-badge.css +4 -0
- package/pf-badge/pf-badge.d.ts +26 -22
- package/pf-badge/pf-badge.js +14 -27
- package/pf-badge/pf-badge.js.map +1 -1
- package/pf-badge/test/pf-badge.e2e.js +12 -0
- package/pf-badge/test/pf-badge.e2e.js.map +1 -1
- package/pf-banner/pf-banner.d.ts +16 -16
- package/pf-banner/pf-banner.js +1 -24
- package/pf-banner/pf-banner.js.map +1 -1
- package/pf-banner/test/pf-banner.e2e.js +12 -0
- package/pf-banner/test/pf-banner.e2e.js.map +1 -1
- package/pf-button/pf-button.css +22 -12
- package/pf-button/pf-button.d.ts +128 -122
- package/pf-button/pf-button.js +95 -172
- package/pf-button/pf-button.js.map +1 -1
- package/pf-button/test/pf-button.e2e.js +12 -0
- package/pf-button/test/pf-button.e2e.js.map +1 -1
- package/pf-card/pf-card.css +172 -43
- package/pf-card/pf-card.d.ts +41 -38
- package/pf-card/pf-card.js +37 -54
- package/pf-card/pf-card.js.map +1 -1
- package/pf-card/test/pf-card.e2e.js +12 -0
- package/pf-card/test/pf-card.e2e.js.map +1 -1
- package/pf-chip/pf-chip-group.css +9 -6
- package/pf-chip/pf-chip-group.d.ts +27 -14
- package/pf-chip/pf-chip-group.js +65 -94
- package/pf-chip/pf-chip-group.js.map +1 -1
- package/pf-chip/pf-chip.d.ts +20 -9
- package/pf-chip/pf-chip.js +1 -8
- package/pf-chip/pf-chip.js.map +1 -1
- package/pf-chip/test/pf-chip-group.spec.js +42 -22
- package/pf-chip/test/pf-chip-group.spec.js.map +1 -1
- package/pf-chip/test/pf-chip.e2e.js +12 -0
- package/pf-chip/test/pf-chip.e2e.js.map +1 -1
- package/pf-clipboard-copy/pf-clipboard-copy.css +83 -85
- package/pf-clipboard-copy/pf-clipboard-copy.d.ts +53 -18
- package/pf-clipboard-copy/pf-clipboard-copy.js +55 -44
- package/pf-clipboard-copy/pf-clipboard-copy.js.map +1 -1
- package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js +12 -0
- package/pf-clipboard-copy/test/pf-clipboard-copy.e2e.js.map +1 -1
- package/pf-code-block/pf-code-block.css +7 -4
- package/pf-code-block/pf-code-block.d.ts +4 -25
- package/pf-code-block/pf-code-block.js +44 -23
- package/pf-code-block/pf-code-block.js.map +1 -1
- package/pf-code-block/test/pf-code-block.e2e.js +12 -0
- package/pf-code-block/test/pf-code-block.e2e.js.map +1 -1
- package/pf-dropdown/context.d.ts +2 -3
- package/pf-dropdown/context.js.map +1 -1
- package/pf-dropdown/pf-dropdown-group.d.ts +3 -9
- package/pf-dropdown/pf-dropdown-group.js +1 -5
- package/pf-dropdown/pf-dropdown-group.js.map +1 -1
- package/pf-dropdown/pf-dropdown-item.d.ts +21 -27
- package/pf-dropdown/pf-dropdown-item.js +1 -37
- package/pf-dropdown/pf-dropdown-item.js.map +1 -1
- package/pf-dropdown/pf-dropdown-menu.d.ts +4 -10
- package/pf-dropdown/pf-dropdown-menu.js +23 -23
- package/pf-dropdown/pf-dropdown-menu.js.map +1 -1
- package/pf-dropdown/pf-dropdown.d.ts +8 -24
- package/pf-dropdown/pf-dropdown.js +1 -26
- package/pf-dropdown/pf-dropdown.js.map +1 -1
- package/pf-dropdown/test/pf-dropdown.e2e.js +12 -0
- package/pf-dropdown/test/pf-dropdown.e2e.js.map +1 -1
- package/pf-icon/pf-icon.css +22 -0
- package/pf-icon/pf-icon.d.ts +93 -4
- package/pf-icon/pf-icon.js +191 -13
- package/pf-icon/pf-icon.js.map +1 -1
- package/pf-icon/test/pf-icon.e2e.js +12 -0
- package/pf-icon/test/pf-icon.e2e.js.map +1 -1
- package/pf-icon/test/pf-icon.spec.js +102 -88
- package/pf-icon/test/pf-icon.spec.js.map +1 -1
- package/pf-jump-links/pf-jump-links-item.d.ts +4 -11
- package/pf-jump-links/pf-jump-links-item.js +8 -15
- package/pf-jump-links/pf-jump-links-item.js.map +1 -1
- package/pf-jump-links/pf-jump-links-list.d.ts +2 -2
- package/pf-jump-links/pf-jump-links-list.js +1 -5
- package/pf-jump-links/pf-jump-links-list.js.map +1 -1
- package/pf-jump-links/pf-jump-links.d.ts +2 -2
- package/pf-jump-links/pf-jump-links.js +23 -62
- package/pf-jump-links/pf-jump-links.js.map +1 -1
- package/pf-jump-links/test/pf-jump-links.e2e.js +12 -0
- package/pf-jump-links/test/pf-jump-links.e2e.js.map +1 -1
- package/pf-label/pf-label.css +38 -5
- package/pf-label/pf-label.d.ts +65 -69
- package/pf-label/pf-label.js +49 -90
- package/pf-label/pf-label.js.map +1 -1
- package/pf-label/test/pf-label.e2e.js +12 -0
- package/pf-label/test/pf-label.e2e.js.map +1 -1
- package/pf-label/test/pf-label.spec.js +26 -16
- package/pf-label/test/pf-label.spec.js.map +1 -1
- package/pf-modal/pf-modal.d.ts +17 -22
- package/pf-modal/pf-modal.js +13 -39
- package/pf-modal/pf-modal.js.map +1 -1
- package/pf-modal/test/pf-modal.e2e.js +12 -0
- package/pf-modal/test/pf-modal.e2e.js.map +1 -1
- package/pf-panel/pf-panel.d.ts +31 -3
- package/pf-panel/pf-panel.js +1 -10
- package/pf-panel/pf-panel.js.map +1 -1
- package/pf-panel/test/pf-panel.e2e.js +12 -0
- package/pf-panel/test/pf-panel.e2e.js.map +1 -1
- package/pf-popover/pf-popover.d.ts +66 -84
- package/pf-popover/pf-popover.js +33 -150
- package/pf-popover/pf-popover.js.map +1 -1
- package/pf-popover/test/pf-popover.e2e.js +12 -0
- package/pf-popover/test/pf-popover.e2e.js.map +1 -1
- package/pf-popover/test/pf-popover.spec.js +0 -11
- package/pf-popover/test/pf-popover.spec.js.map +1 -1
- package/pf-progress/pf-progress.d.ts +40 -40
- package/pf-progress/pf-progress.js +1 -61
- package/pf-progress/pf-progress.js.map +1 -1
- package/pf-progress/test/pf-progress.e2e.js +12 -0
- package/pf-progress/test/pf-progress.e2e.js.map +1 -1
- package/pf-progress-stepper/pf-progress-step.d.ts +2 -3
- package/pf-progress-stepper/pf-progress-step.js +4 -14
- package/pf-progress-stepper/pf-progress-step.js.map +1 -1
- package/pf-progress-stepper/pf-progress-stepper.d.ts +118 -2
- package/pf-progress-stepper/pf-progress-stepper.js +10 -12
- package/pf-progress-stepper/pf-progress-stepper.js.map +1 -1
- package/pf-progress-stepper/test/pf-progress-stepper.e2e.js +12 -0
- package/pf-progress-stepper/test/pf-progress-stepper.e2e.js.map +1 -1
- package/pf-select/pf-option-group.d.ts +2 -2
- package/pf-select/pf-option-group.js +1 -5
- package/pf-select/pf-option-group.js.map +1 -1
- package/pf-select/pf-option.css +1 -1
- package/pf-select/pf-option.d.ts +4 -4
- package/pf-select/pf-option.js +20 -30
- package/pf-select/pf-option.js.map +1 -1
- package/pf-select/pf-select.css +14 -6
- package/pf-select/pf-select.d.ts +183 -40
- package/pf-select/pf-select.js +185 -260
- package/pf-select/pf-select.js.map +1 -1
- package/pf-select/test/pf-select.e2e.js +12 -0
- package/pf-select/test/pf-select.e2e.js.map +1 -1
- package/pf-select/test/pf-select.spec.js +1292 -613
- package/pf-select/test/pf-select.spec.js.map +1 -1
- package/pf-spinner/pf-spinner.css +27 -17
- package/pf-spinner/pf-spinner.d.ts +21 -17
- package/pf-spinner/pf-spinner.js +20 -24
- package/pf-spinner/pf-spinner.js.map +1 -1
- package/pf-spinner/test/pf-spinner.e2e.js +12 -0
- package/pf-spinner/test/pf-spinner.e2e.js.map +1 -1
- package/pf-switch/pf-switch.css +39 -13
- package/pf-switch/pf-switch.d.ts +48 -34
- package/pf-switch/pf-switch.js +114 -43
- package/pf-switch/pf-switch.js.map +1 -1
- package/pf-switch/test/pf-switch.e2e.js +12 -0
- package/pf-switch/test/pf-switch.e2e.js.map +1 -1
- package/pf-table/pf-caption.d.ts +2 -2
- package/pf-table/pf-caption.js +1 -4
- package/pf-table/pf-caption.js.map +1 -1
- package/pf-table/pf-table.d.ts +424 -424
- package/pf-table/pf-table.js +7 -645
- package/pf-table/pf-table.js.map +1 -1
- package/pf-table/pf-tbody.d.ts +2 -2
- package/pf-table/pf-tbody.js +1 -4
- package/pf-table/pf-tbody.js.map +1 -1
- package/pf-table/pf-td.d.ts +2 -2
- package/pf-table/pf-td.js +1 -4
- package/pf-table/pf-td.js.map +1 -1
- package/pf-table/pf-th.d.ts +2 -2
- package/pf-table/pf-th.js +1 -4
- package/pf-table/pf-th.js.map +1 -1
- package/pf-table/pf-thead.d.ts +2 -2
- package/pf-table/pf-thead.js +1 -4
- package/pf-table/pf-thead.js.map +1 -1
- package/pf-table/pf-tr.d.ts +1 -1
- package/pf-table/pf-tr.js +1 -4
- package/pf-table/pf-tr.js.map +1 -1
- package/pf-table/test/pf-table.e2e.js +12 -0
- package/pf-table/test/pf-table.e2e.js.map +1 -1
- package/pf-tabs/context.d.ts +2 -3
- package/pf-tabs/context.js.map +1 -1
- package/pf-tabs/pf-tab-panel.d.ts +3 -5
- package/pf-tabs/pf-tab-panel.js +1 -7
- package/pf-tabs/pf-tab-panel.js.map +1 -1
- package/pf-tabs/pf-tab.d.ts +37 -37
- package/pf-tabs/pf-tab.js +16 -54
- package/pf-tabs/pf-tab.js.map +1 -1
- package/pf-tabs/pf-tabs.d.ts +36 -37
- package/pf-tabs/pf-tabs.js +40 -78
- package/pf-tabs/pf-tabs.js.map +1 -1
- package/pf-tabs/test/pf-tabs.e2e.js +12 -0
- package/pf-tabs/test/pf-tabs.e2e.js.map +1 -1
- package/pf-tabs/test/pf-tabs.spec.js +11 -12
- package/pf-tabs/test/pf-tabs.spec.js.map +1 -1
- package/pf-text-area/pf-text-area.d.ts +128 -134
- package/pf-text-area/pf-text-area.js +7 -131
- package/pf-text-area/pf-text-area.js.map +1 -1
- package/pf-text-area/test/pf-text-area.e2e.js +12 -0
- package/pf-text-area/test/pf-text-area.e2e.js.map +1 -1
- package/pf-text-input/pf-text-input.d.ts +129 -135
- package/pf-text-input/pf-text-input.js +7 -132
- package/pf-text-input/pf-text-input.js.map +1 -1
- package/pf-text-input/test/pf-text-input.e2e.js +12 -0
- package/pf-text-input/test/pf-text-input.e2e.js.map +1 -1
- package/pf-tile/pf-tile.d.ts +21 -20
- package/pf-tile/pf-tile.js +18 -35
- package/pf-tile/pf-tile.js.map +1 -1
- package/pf-tile/test/pf-tile.e2e.js +12 -0
- package/pf-tile/test/pf-tile.e2e.js.map +1 -1
- package/pf-timestamp/pf-timestamp.d.ts +2 -2
- package/pf-timestamp/pf-timestamp.js +1 -3
- package/pf-timestamp/pf-timestamp.js.map +1 -1
- package/pf-timestamp/test/pf-timestamp.e2e.js +12 -0
- package/pf-timestamp/test/pf-timestamp.e2e.js.map +1 -1
- package/pf-tooltip/pf-tooltip.d.ts +51 -50
- package/pf-tooltip/pf-tooltip.js +26 -106
- package/pf-tooltip/pf-tooltip.js.map +1 -1
- package/pf-tooltip/test/pf-tooltip.e2e.js +12 -0
- package/pf-tooltip/test/pf-tooltip.e2e.js.map +1 -1
- package/pfe.min.js +1194 -1002
- package/pfe.min.js.map +4 -4
- package/react/pf-accordion/pf-accordion-header.js +2 -2
- package/react/pf-accordion/pf-accordion-panel.js +2 -2
- package/react/pf-accordion/pf-accordion.js +2 -2
- package/react/pf-avatar/pf-avatar.d.ts +1 -1
- package/react/pf-avatar/pf-avatar.js +5 -3
- package/react/pf-back-to-top/pf-back-to-top.js +2 -2
- package/react/pf-background-image/pf-background-image.js +2 -2
- package/react/pf-badge/pf-badge.js +2 -2
- package/react/pf-banner/pf-banner.js +2 -2
- package/react/pf-button/pf-button.js +2 -2
- package/react/pf-card/pf-card.js +2 -2
- package/react/pf-chip/pf-chip-group.js +2 -2
- package/react/pf-chip/pf-chip.js +2 -2
- package/react/pf-clipboard-copy/pf-clipboard-copy.d.ts +1 -1
- package/react/pf-clipboard-copy/pf-clipboard-copy.js +5 -3
- package/react/pf-code-block/pf-code-block.js +2 -2
- package/react/pf-dropdown/pf-dropdown-group.js +2 -2
- package/react/pf-dropdown/pf-dropdown-item.js +2 -2
- package/react/pf-dropdown/pf-dropdown-menu.js +2 -2
- package/react/pf-dropdown/pf-dropdown.js +2 -2
- package/react/pf-icon/pf-icon.js +2 -2
- package/react/pf-jump-links/pf-jump-links-item.js +2 -2
- package/react/pf-jump-links/pf-jump-links-list.js +2 -2
- package/react/pf-jump-links/pf-jump-links.js +2 -2
- package/react/pf-label/pf-label.js +2 -2
- package/react/pf-modal/pf-modal.js +2 -2
- package/react/pf-panel/pf-panel.js +2 -2
- package/react/pf-popover/pf-popover.js +2 -2
- package/react/pf-progress/pf-progress.js +2 -2
- package/react/pf-progress-stepper/pf-progress-step.js +2 -2
- package/react/pf-progress-stepper/pf-progress-stepper.js +2 -2
- package/react/pf-select/pf-option-group.js +2 -2
- package/react/pf-select/pf-option.js +2 -2
- package/react/pf-select/pf-select.d.ts +1 -1
- package/react/pf-select/pf-select.js +2 -3
- package/react/pf-spinner/pf-spinner.js +2 -2
- package/react/pf-switch/pf-switch.js +2 -2
- package/react/pf-table/pf-caption.js +2 -2
- package/react/pf-table/pf-table.js +2 -2
- package/react/pf-table/pf-tbody.js +2 -2
- package/react/pf-table/pf-td.js +2 -2
- package/react/pf-table/pf-th.js +2 -2
- package/react/pf-table/pf-thead.js +2 -2
- package/react/pf-table/pf-tr.js +2 -2
- package/react/pf-tabs/pf-tab-panel.js +2 -2
- package/react/pf-tabs/pf-tab.js +2 -2
- package/react/pf-tabs/pf-tabs.js +2 -2
- package/react/pf-text-area/pf-text-area.js +2 -2
- package/react/pf-text-input/pf-text-input.js +2 -2
- package/react/pf-tile/pf-tile.js +2 -2
- package/react/pf-timestamp/pf-timestamp.js +2 -2
- package/react/pf-tooltip/pf-tooltip.js +2 -2
- package/pf-accordion/BaseAccordion.d.ts +0 -61
- package/pf-accordion/BaseAccordion.js +0 -269
- package/pf-accordion/BaseAccordion.js.map +0 -1
- package/pf-accordion/BaseAccordionHeader.css +0 -39
- package/pf-accordion/BaseAccordionHeader.d.ts +0 -29
- package/pf-accordion/BaseAccordionHeader.js +0 -128
- package/pf-accordion/BaseAccordionHeader.js.map +0 -1
- package/pf-accordion/BaseAccordionPanel.css +0 -27
- package/pf-accordion/BaseAccordionPanel.d.ts +0 -7
- package/pf-accordion/BaseAccordionPanel.js +0 -33
- package/pf-accordion/BaseAccordionPanel.js.map +0 -1
- package/pf-avatar/BaseAvatar.css +0 -13
- package/pf-avatar/BaseAvatar.d.ts +0 -23
- package/pf-avatar/BaseAvatar.js +0 -62
- package/pf-avatar/BaseAvatar.js.map +0 -1
- package/pf-back-to-top/demo/demo.css +0 -25
- package/pf-badge/BaseBadge.css +0 -6
- package/pf-badge/BaseBadge.d.ts +0 -18
- package/pf-badge/BaseBadge.js +0 -16
- package/pf-badge/BaseBadge.js.map +0 -1
- package/pf-button/BaseButton.css +0 -68
- package/pf-button/BaseButton.d.ts +0 -51
- package/pf-button/BaseButton.js +0 -84
- package/pf-button/BaseButton.js.map +0 -1
- package/pf-card/BaseCard.css +0 -36
- package/pf-card/BaseCard.d.ts +0 -24
- package/pf-card/BaseCard.js +0 -51
- package/pf-card/BaseCard.js.map +0 -1
- package/pf-clipboard-copy/BaseClipboardCopy.css +0 -6
- package/pf-clipboard-copy/BaseClipboardCopy.d.ts +0 -18
- package/pf-clipboard-copy/BaseClipboardCopy.js +0 -25
- package/pf-clipboard-copy/BaseClipboardCopy.js.map +0 -1
- package/pf-code-block/BaseCodeBlock.css +0 -7
- package/pf-code-block/BaseCodeBlock.d.ts +0 -8
- package/pf-code-block/BaseCodeBlock.js +0 -22
- package/pf-code-block/BaseCodeBlock.js.map +0 -1
- package/pf-icon/BaseIcon.css +0 -22
- package/pf-icon/BaseIcon.d.ts +0 -41
- package/pf-icon/BaseIcon.js +0 -144
- package/pf-icon/BaseIcon.js.map +0 -1
- package/pf-label/BaseLabel.css +0 -44
- package/pf-label/BaseLabel.d.ts +0 -30
- package/pf-label/BaseLabel.js +0 -29
- package/pf-label/BaseLabel.js.map +0 -1
- package/pf-spinner/BaseSpinner.css +0 -20
- package/pf-spinner/BaseSpinner.d.ts +0 -27
- package/pf-spinner/BaseSpinner.js +0 -45
- package/pf-spinner/BaseSpinner.js.map +0 -1
- package/pf-switch/BaseSwitch.css +0 -36
- package/pf-switch/BaseSwitch.d.ts +0 -19
- package/pf-switch/BaseSwitch.js +0 -109
- package/pf-switch/BaseSwitch.js.map +0 -1
- package/pf-tabs/BaseTab.css +0 -60
- package/pf-tabs/BaseTab.d.ts +0 -32
- package/pf-tabs/BaseTab.js +0 -83
- package/pf-tabs/BaseTab.js.map +0 -1
- package/pf-tabs/BaseTabPanel.css +0 -7
- package/pf-tabs/BaseTabPanel.d.ts +0 -7
- package/pf-tabs/BaseTabPanel.js +0 -36
- package/pf-tabs/BaseTabPanel.js.map +0 -1
- package/pf-tabs/BaseTabs.css +0 -86
- package/pf-tabs/BaseTabs.d.ts +0 -38
- package/pf-tabs/BaseTabs.js +0 -221
- package/pf-tabs/BaseTabs.js.map +0 -1
- package/pf-tile/BaseTile.d.ts +0 -13
- package/pf-tile/BaseTile.js +0 -28
- package/pf-tile/BaseTile.js.map +0 -1
- package/pf-tooltip/BaseTooltip.css +0 -70
- package/pf-tooltip/BaseTooltip.d.ts +0 -16
- package/pf-tooltip/BaseTooltip.js +0 -54
- package/pf-tooltip/BaseTooltip.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { test } from '@playwright/test';
|
|
2
2
|
import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
|
|
3
|
+
import { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';
|
|
3
4
|
const tagName = 'pf-tile';
|
|
4
5
|
test.describe(tagName, () => {
|
|
5
6
|
test('snapshot', async ({ page }) => {
|
|
@@ -7,5 +8,16 @@ test.describe(tagName, () => {
|
|
|
7
8
|
await componentPage.navigate();
|
|
8
9
|
await componentPage.snapshot();
|
|
9
10
|
});
|
|
11
|
+
test('ssr', async ({ browser }) => {
|
|
12
|
+
const fixture = new SSRPage({
|
|
13
|
+
tagName,
|
|
14
|
+
browser,
|
|
15
|
+
demoDir: new URL('../demo/', import.meta.url),
|
|
16
|
+
importSpecifiers: [
|
|
17
|
+
`@patternfly/elements/${tagName}/${tagName}.js`,
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
await fixture.snapshots();
|
|
21
|
+
});
|
|
10
22
|
});
|
|
11
23
|
//# sourceMappingURL=pf-tile.e2e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pf-tile.e2e.js","sourceRoot":"","sources":["pf-tile.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"pf-tile.e2e.js","sourceRoot":"","sources":["pf-tile.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAE3E,MAAM,OAAO,GAAG,SAAS,CAAC;AAE1B,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;IAEH,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;YAC1B,OAAO;YACP,OAAO;YACP,OAAO,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;YAC7C,gBAAgB,EAAE;gBAChB,wBAAwB,OAAO,IAAI,OAAO,KAAK;aAChD;SACF,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';\nimport { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';\n\nconst tagName = 'pf-tile';\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 test('ssr', async ({ browser }) => {\n const fixture = new SSRPage({\n tagName,\n browser,\n demoDir: new URL('../demo/', import.meta.url),\n importSpecifiers: [\n `@patternfly/elements/${tagName}/${tagName}.js`,\n ],\n });\n await fixture.snapshots();\n });\n});\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PropertyValues } from 'lit';
|
|
1
|
+
import type { PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import { type DateTimeFormat } from '@patternfly/pfe-core/controllers/timestamp-controller.js';
|
|
4
4
|
/**
|
|
@@ -21,7 +21,7 @@ export declare class PfTimestamp extends LitElement {
|
|
|
21
21
|
get time(): string;
|
|
22
22
|
connectedCallback(): void;
|
|
23
23
|
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
24
|
-
render():
|
|
24
|
+
render(): TemplateResult<1>;
|
|
25
25
|
}
|
|
26
26
|
declare global {
|
|
27
27
|
interface HTMLElementTagNameMap {
|
|
@@ -11,9 +11,6 @@ const BooleanStringConverter = {
|
|
|
11
11
|
return !value || value === 'true';
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* A **timestamp** provides consistent formats for displaying date and time values.
|
|
16
|
-
*/
|
|
17
14
|
let PfTimestamp = class PfTimestamp extends LitElement {
|
|
18
15
|
constructor() {
|
|
19
16
|
super(...arguments);
|
|
@@ -50,6 +47,7 @@ let PfTimestamp = class PfTimestamp extends LitElement {
|
|
|
50
47
|
};
|
|
51
48
|
_PfTimestamp_timestamp = new WeakMap();
|
|
52
49
|
PfTimestamp.styles = [style];
|
|
50
|
+
PfTimestamp.version = "4.0.0";
|
|
53
51
|
__decorate([
|
|
54
52
|
property({ reflect: true, attribute: 'date-format' })
|
|
55
53
|
], PfTimestamp.prototype, "dateFormat", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pf-timestamp.js","sourceRoot":"","sources":["pf-timestamp.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EACL,mBAAmB,GAEpB,MAAM,0DAA0D,CAAC;;;AAIlE,MAAM,sBAAsB,GAA8B;IACxD,aAAa,CAAC,KAAK;QACjB,OAAO,CAAC,KAAK,IAAI,KAAK,KAAK,MAAM,CAAC;IACpC,CAAC;CACF,CAAC;
|
|
1
|
+
{"version":3,"file":"pf-timestamp.js","sourceRoot":"","sources":["pf-timestamp.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EACL,mBAAmB,GAEpB,MAAM,0DAA0D,CAAC;;;AAIlE,MAAM,sBAAsB,GAA8B;IACxD,aAAa,CAAC,KAAK;QACjB,OAAO,CAAC,KAAK,IAAI,KAAK,KAAK,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,CAAC;+CAA6B;AAE5B;IAAtD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;+CAA6B;AAEnD;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iDAAuB;AAEI;IAAzD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;kDAAwB;AAEpD;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAAiB;AAED;IAA3C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAoB;AAEnB;IAA3C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wCAAe;AAMvD;IAJF,QAAQ,CAAC;QACR,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,sBAAsB;KAClC,CAAC;2CAAkB;AAGpB;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAG3B;AA1BU,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW","sourcesContent":["import type { ComplexAttributeConverter, PropertyValues, TemplateResult } from 'lit';\n\nimport { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport {\n TimestampController,\n type DateTimeFormat,\n} from '@patternfly/pfe-core/controllers/timestamp-controller.js';\n\nimport style from './pf-timestamp.css';\n\nconst BooleanStringConverter: ComplexAttributeConverter = {\n fromAttribute(value) {\n return !value || value === 'true';\n },\n};\n\n/**\n * A **timestamp** provides consistent formats for displaying date and time values.\n */\n@customElement('pf-timestamp')\nexport class PfTimestamp extends LitElement {\n static readonly styles: CSSStyleSheet[] = [style];\n\n @property({ reflect: true, attribute: 'date-format' }) dateFormat?: DateTimeFormat;\n\n @property({ reflect: true, attribute: 'time-format' }) timeFormat?: DateTimeFormat;\n\n @property({ attribute: false }) customFormat?: object;\n\n @property({ reflect: true, attribute: 'display-suffix' }) displaySuffix?: string;\n\n @property({ reflect: true }) locale?: string;\n\n @property({ reflect: true, type: Boolean }) relative?: boolean;\n\n @property({ reflect: true, type: Boolean }) utc?: boolean;\n\n @property({\n reflect: true,\n attribute: 'hour-12',\n converter: BooleanStringConverter,\n }) hour12?: boolean;\n\n @property({ reflect: true })\n get date(): string {\n return this.#timestamp.localeString;\n }\n\n set date(string) {\n this.#timestamp.date = new Date(string);\n }\n\n get isoString(): string {\n return this.#timestamp.isoString;\n }\n\n get time(): string {\n return this.#timestamp.time;\n }\n\n #timestamp = new TimestampController(this);\n\n connectedCallback(): void {\n super.connectedCallback();\n if (this.hasAttribute('date')) {\n this.#timestamp.date = new Date(this.getAttribute('date')!);\n }\n }\n\n willUpdate(changedProperties: PropertyValues<this>): void {\n for (const [prop] of changedProperties) {\n this.#timestamp.set(prop, this[prop as keyof this]);\n }\n }\n\n render(): TemplateResult<1> {\n return html`\n <time datetime=\"${this.#timestamp.isoString}\">${this.#timestamp.time}</time>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-timestamp': PfTimestamp;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { test } from '@playwright/test';
|
|
2
2
|
import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
|
|
3
|
+
import { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';
|
|
3
4
|
const tagName = 'pf-timestamp';
|
|
4
5
|
test.describe(tagName, () => {
|
|
5
6
|
test('snapshot', async ({ page }) => {
|
|
@@ -8,5 +9,16 @@ test.describe(tagName, () => {
|
|
|
8
9
|
await page.$eval('#realtime', el => el.closest('section')?.remove());
|
|
9
10
|
await componentPage.snapshot();
|
|
10
11
|
});
|
|
12
|
+
test('ssr', async ({ browser }) => {
|
|
13
|
+
const fixture = new SSRPage({
|
|
14
|
+
tagName,
|
|
15
|
+
browser,
|
|
16
|
+
demoDir: new URL('../demo/', import.meta.url),
|
|
17
|
+
importSpecifiers: [
|
|
18
|
+
`@patternfly/elements/${tagName}/${tagName}.js`,
|
|
19
|
+
],
|
|
20
|
+
});
|
|
21
|
+
await fixture.snapshots();
|
|
22
|
+
});
|
|
11
23
|
});
|
|
12
24
|
//# sourceMappingURL=pf-timestamp.e2e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pf-timestamp.e2e.js","sourceRoot":"","sources":["pf-timestamp.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"pf-timestamp.e2e.js","sourceRoot":"","sources":["pf-timestamp.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAE3E,MAAM,OAAO,GAAG,cAAc,CAAC;AAE/B,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,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACrE,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;YAC1B,OAAO;YACP,OAAO;YACP,OAAO,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;YAC7C,gBAAgB,EAAE;gBAChB,wBAAwB,OAAO,IAAI,OAAO,KAAK;aAChD;SACF,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';\nimport { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';\n\nconst tagName = 'pf-timestamp';\n\ntest.describe(tagName, () => {\n test('snapshot', async ({ page }) => {\n const componentPage = new PfeDemoPage(page, tagName);\n await componentPage.navigate();\n await page.$eval('#realtime', el => el.closest('section')?.remove());\n await componentPage.snapshot();\n });\n\n test('ssr', async ({ browser }) => {\n const fixture = new SSRPage({\n tagName,\n browser,\n demoDir: new URL('../demo/', import.meta.url),\n importSpecifiers: [\n `@patternfly/elements/${tagName}/${tagName}.js`,\n ],\n });\n await fixture.snapshots();\n });\n});\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PropertyValues } from 'lit';
|
|
1
|
+
import type { PropertyValues, TemplateResult } from 'lit';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
3
|
import { type Placement } from '@patternfly/pfe-core/controllers/floating-dom-controller.js';
|
|
4
4
|
/**
|
|
@@ -12,78 +12,78 @@ import { type Placement } from '@patternfly/pfe-core/controllers/floating-dom-co
|
|
|
12
12
|
* This slot renders the content that will be displayed inside of the tooltip.
|
|
13
13
|
* Typically this would include a string of text without any additional elements.
|
|
14
14
|
* This element is wrapped with a div inside of the component to give it the stylings and background colors.
|
|
15
|
-
* @cssprop {<color>} --pf-c-tooltip__content--BackgroundColor
|
|
15
|
+
* @cssprop {<color>} [--pf-c-tooltip__content--BackgroundColor=#1b1d21]
|
|
16
16
|
* Sets the background color for the tooltip content.
|
|
17
|
-
*
|
|
18
|
-
* @cssprop {<color>} --pf-c-tooltip__content--Color
|
|
17
|
+
*
|
|
18
|
+
* @cssprop {<color>} [--pf-c-tooltip__content--Color=#e0e0e0]
|
|
19
19
|
* Sets the font color for the tooltip content.
|
|
20
|
-
*
|
|
21
|
-
* @cssprop {<number>} --pf-c-tooltip--line-height
|
|
20
|
+
*
|
|
21
|
+
* @cssprop {<number>} [--pf-c-tooltip--line-height=1.5]
|
|
22
22
|
* Sets the font color for the tooltip content.
|
|
23
|
-
*
|
|
24
|
-
* @cssprop {<length>} --pf-c-tooltip--MaxWidth
|
|
23
|
+
*
|
|
24
|
+
* @cssprop {<length>} [--pf-c-tooltip--MaxWidth=18.75rem]
|
|
25
25
|
* Maximum width for the tooltip.
|
|
26
|
-
*
|
|
27
|
-
* @cssprop --pf-c-tooltip--BoxShadow
|
|
26
|
+
*
|
|
27
|
+
* @cssprop [--pf-c-tooltip--BoxShadow=0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)]
|
|
28
28
|
* Box shadow for the tooltip.
|
|
29
|
-
*
|
|
30
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingTop
|
|
29
|
+
*
|
|
30
|
+
* @cssprop {<length>} [--pf-c-tooltip__content--PaddingTop=0.5rem]
|
|
31
31
|
* Top padding for the tooltip.
|
|
32
|
-
*
|
|
33
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingRight
|
|
32
|
+
*
|
|
33
|
+
* @cssprop {<length>} [--pf-c-tooltip__content--PaddingRight=0.5rem]
|
|
34
34
|
* Right padding for the tooltip.
|
|
35
|
-
*
|
|
36
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingBottom
|
|
35
|
+
*
|
|
36
|
+
* @cssprop {<length>} [--pf-c-tooltip__content--PaddingBottom=0.5rem]
|
|
37
37
|
* Bottom padding for the tooltip.
|
|
38
|
-
*
|
|
39
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingLeft
|
|
38
|
+
*
|
|
39
|
+
* @cssprop {<length>} [--pf-c-tooltip__content--PaddingLeft=0.5rem]
|
|
40
40
|
* Left Padding for the tooltip.
|
|
41
|
-
*
|
|
42
|
-
* @cssprop --pf-c-tooltip__content--FontSize
|
|
41
|
+
*
|
|
42
|
+
* @cssprop [--pf-c-tooltip__content--FontSize=0.875rem]
|
|
43
43
|
* Font size for the tooltip content.
|
|
44
|
-
*
|
|
45
|
-
* @cssprop {<length>} --pf-c-tooltip__arrow--Width
|
|
44
|
+
*
|
|
45
|
+
* @cssprop {<length>} [--pf-c-tooltip__arrow--Width=0.5rem]
|
|
46
46
|
* Tooltip arrow width.
|
|
47
|
-
*
|
|
48
|
-
* @cssprop {<length>} --pf-c-tooltip__arrow--Height
|
|
47
|
+
*
|
|
48
|
+
* @cssprop {<length>} [--pf-c-tooltip__arrow--Height=0.5rem]
|
|
49
49
|
* Tooltip arrow height.
|
|
50
|
-
*
|
|
51
|
-
* @cssprop --pf-c-tooltip__arrow--m-top--TranslateX
|
|
50
|
+
*
|
|
51
|
+
* @cssprop [--pf-c-tooltip__arrow--m-top--TranslateX=-50]
|
|
52
52
|
* Positions the tooltip arrow along the x axis for `top` positioned arrows.
|
|
53
|
-
*
|
|
54
|
-
* @cssprop --pf-c-tooltip__arrow--m-top--TranslateY
|
|
53
|
+
*
|
|
54
|
+
* @cssprop [--pf-c-tooltip__arrow--m-top--TranslateY=50]
|
|
55
55
|
* Positions the tooltip arrow along the y axis for `top` positioned arrows.
|
|
56
|
-
*
|
|
57
|
-
* @cssprop --pf-c-tooltip__arrow--m-top--Rotate
|
|
56
|
+
*
|
|
57
|
+
* @cssprop [--pf-c-tooltip__arrow--m-top--Rotate=45deg]
|
|
58
58
|
* Rotates the tooltip arrow based on degrees of movement for `top` positioned arrows.
|
|
59
|
-
*
|
|
60
|
-
* @cssprop --pf-c-tooltip__arrow--m-right--TranslateX
|
|
59
|
+
*
|
|
60
|
+
* @cssprop [--pf-c-tooltip__arrow--m-right--TranslateX=-50]
|
|
61
61
|
* Positions the tooltip arrow along the x axis for `right` positioned arrows.
|
|
62
|
-
*
|
|
63
|
-
* @cssprop --pf-c-tooltip__arrow--m-right--TranslateY
|
|
62
|
+
*
|
|
63
|
+
* @cssprop [--pf-c-tooltip__arrow--m-right--TranslateY=-50]
|
|
64
64
|
* Positions the tooltip arrow along the y axis for `right` positioned arrows.
|
|
65
|
-
*
|
|
66
|
-
* @cssprop --pf-c-tooltip__arrow--m-right--Rotate
|
|
65
|
+
*
|
|
66
|
+
* @cssprop [--pf-c-tooltip__arrow--m-right--Rotate=45deg]
|
|
67
67
|
* Rotates the tooltip arrow based on degrees of movement for `right` positioned arrows.
|
|
68
|
-
*
|
|
69
|
-
* @cssprop --pf-c-tooltip__arrow--m-bottom--TranslateX
|
|
68
|
+
*
|
|
69
|
+
* @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateX=-50]
|
|
70
70
|
* Positions the tooltip arrow along the x axis for `bottom` positioned arrows.
|
|
71
|
-
*
|
|
72
|
-
* @cssprop --pf-c-tooltip__arrow--m-bottom--TranslateY
|
|
71
|
+
*
|
|
72
|
+
* @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateY=-50]
|
|
73
73
|
* Positions the tooltip arrow along the y axis for `bottom` positioned arrows.
|
|
74
|
-
*
|
|
75
|
-
* @cssprop --pf-c-tooltip__arrow--m-bottom--Rotate
|
|
74
|
+
*
|
|
75
|
+
* @cssprop [--pf-c-tooltip__arrow--m-bottom--Rotate=45deg]
|
|
76
76
|
* Rotates the tooltip arrow based on degrees of movement for `bottom` positioned arrows.
|
|
77
|
-
*
|
|
78
|
-
* @cssprop --pf-c-tooltip__arrow--m-left--TranslateX
|
|
77
|
+
*
|
|
78
|
+
* @cssprop [--pf-c-tooltip__arrow--m-left--TranslateX=50]
|
|
79
79
|
* Positions the tooltip arrow along the x axis for `left` positioned arrows.
|
|
80
|
-
*
|
|
81
|
-
* @cssprop --pf-c-tooltip__arrow--m-left--TranslateY
|
|
80
|
+
*
|
|
81
|
+
* @cssprop [--pf-c-tooltip__arrow--m-left--TranslateY=-50]
|
|
82
82
|
* Positions the tooltip arrow along the y axis for `left` positioned arrows.
|
|
83
|
-
*
|
|
84
|
-
* @cssprop --pf-c-tooltip__arrow--m-left--Rotate
|
|
83
|
+
*
|
|
84
|
+
* @cssprop [--pf-c-tooltip__arrow--m-left--Rotate=45deg]
|
|
85
85
|
* Rotates the tooltip arrow based on degrees of movement for `left` positioned arrows.
|
|
86
|
-
*
|
|
86
|
+
*
|
|
87
87
|
*/
|
|
88
88
|
export declare class PfTooltip extends LitElement {
|
|
89
89
|
#private;
|
|
@@ -106,9 +106,10 @@ export declare class PfTooltip extends LitElement {
|
|
|
106
106
|
/**
|
|
107
107
|
* Removes event listeners from the old trigger element and attaches
|
|
108
108
|
* them to the new trigger element.
|
|
109
|
+
* @param changed changed properties
|
|
109
110
|
*/
|
|
110
111
|
willUpdate(changed: PropertyValues<this>): void;
|
|
111
|
-
render():
|
|
112
|
+
render(): TemplateResult<1>;
|
|
112
113
|
show(): Promise<void>;
|
|
113
114
|
hide(): Promise<void>;
|
|
114
115
|
}
|
package/pf-tooltip/pf-tooltip.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _PfTooltip_instances, _PfTooltip_invoker_get, _PfTooltip_content_get, _PfTooltip_referenceTrigger, _PfTooltip_float, _PfTooltip_invokerChanged, _PfTooltip_getReferenceTrigger, _PfTooltip_updateTrigger;
|
|
2
2
|
import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from "tslib";
|
|
3
|
-
import { LitElement, html } from 'lit';
|
|
3
|
+
import { LitElement, html, isServer } from 'lit';
|
|
4
4
|
import { customElement } from 'lit/decorators/custom-element.js';
|
|
5
5
|
import { property } from 'lit/decorators/property.js';
|
|
6
6
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
@@ -12,90 +12,6 @@ import { css } from "lit";
|
|
|
12
12
|
const styles = css `:host {\n --_timestamp-text-decoration: underline dashed 1px;\n --_timestamp-text-underline-offset: 4px;\n display: inline;\n}\n\n* { box-sizing: border-box; }\n\n#container {\n display: inline-flex;\n position: relative;\n max-width: 100%;\n --_floating-arrow-size: var(--pf-c-tooltip__arrow--Width, 0.5rem);\n}\n\n#tooltip,\n#tooltip::after {\n position: absolute;\n}\n\n#tooltip {\n --_timestamp-text-decoration: none;\n --_timestamp-text-underline-offset: initial;\n display: block;\n opacity: 0;\n pointer-events: none;\n z-index: 10000;\n transition: opacity 300ms cubic-bezier(0.54, 1.5, 0.38, 1.11) 0s;\n text-align: center;\n word-break: break-word;\n translate: var(--_floating-content-translate);\n max-width: calc(100vw - 10px);\n width: max-content;\n top: 0;\n left: 0;\n will-change: opacity;\n line-height: var(--pf-c-tooltip--line-height, 1.5);\n max-width: var(--pf-c-tooltip--MaxWidth, 18.75rem);\n box-shadow: var(--pf-c-tooltip--BoxShadow,\n var(--pf-global--BoxShadow--md,\n 0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12),\n 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)));\n padding:\n var(--pf-c-tooltip__content--PaddingTop,\n var(--pf-global--spacer--sm, 0.5rem))\n var(--pf-c-tooltip__content--PaddingRight,\n var(--pf-global--spacer--sm, 0.5rem))\n var(--pf-c-tooltip__content--PaddingBottom,\n var(--pf-global--spacer--sm, 0.5rem))\n var(--pf-c-tooltip__content--PaddingLeft,\n var(--pf-global--spacer--sm, 0.5rem));\n font-size: var(--pf-c-tooltip__content--FontSize,\n var(--pf-global--FontSize--sm, 0.875rem));\n color: var(--pf-c-tooltip__content--Color,\n var(--pf-global--Color--light-100, #ffffff));\n background-color: var(--pf-c-tooltip__content--BackgroundColor,\n var(--pf-global--BackgroundColor--dark-100, #151515));\n}\n\n#tooltip::after {\n display: block;\n content: '';\n rotate: 45deg;\n width: var(--_floating-arrow-size);\n height: var(--_floating-arrow-size);\n will-change: left top right bottom;\n background-color: var(--pf-c-tooltip__content--BackgroundColor,\n var(--pf-global--BackgroundColor--dark-100, #151515));\n}\n\n.open #tooltip {\n opacity: 1;\n}\n\n/* LEFT */\n.left #tooltip::after { right: calc(-0.5 * var(--_floating-arrow-size)); }\n.left.center #tooltip::after { top: calc(50% - 0.5 * var(--_floating-arrow-size)); }\n.left.start #tooltip::after { top: var(--_floating-arrow-size); }\n.left.end #tooltip::after { bottom: var(--_floating-arrow-size); }\n\n/* TOP */\n.top #tooltip::after { top: calc(100% - 0.5 * var(--_floating-arrow-size)); }\n.top.center #tooltip::after { right: calc(50% - 0.5 * var(--_floating-arrow-size)); }\n.top.start #tooltip::after { left: var(--_floating-arrow-size); }\n.top.end #tooltip::after { right: var(--_floating-arrow-size); }\n\n/* RIGHT */\n.right #tooltip::after { right: calc(100% - 0.5 * var(--_floating-arrow-size)); }\n.right.center #tooltip::after { top: calc(50% - 0.5 * var(--_floating-arrow-size)); }\n.right.start #tooltip::after { top: var(--_floating-arrow-size); }\n.right.end #tooltip::after { bottom: var(--_floating-arrow-size); }\n\n/* BOTTOM */\n.bottom #tooltip::after { bottom: calc(100% - 0.5 * var(--_floating-arrow-size)); }\n.bottom.center #tooltip::after { right: calc(50% - 0.5 * var(--_floating-arrow-size)); }\n.bottom.start #tooltip::after { left: var(--_floating-arrow-size); }\n.bottom.end #tooltip::after { right: var(--_floating-arrow-size); }\n\n`;
|
|
13
13
|
const EnterEvents = ['focusin', 'tap', 'click', 'mouseenter'];
|
|
14
14
|
const ExitEvents = ['focusout', 'blur', 'mouseleave'];
|
|
15
|
-
/**
|
|
16
|
-
* A **tooltip** is in-app messaging used to identify elements on a page with short,
|
|
17
|
-
* clarifying text.
|
|
18
|
-
* @summary Toggle the visibility of helpful or contextual information.
|
|
19
|
-
* @slot
|
|
20
|
-
* This slot wraps around the element that should be used to invoke the tooltip content to display.
|
|
21
|
-
* Typically this would be an icon, button, or other small sized element.
|
|
22
|
-
* @slot content
|
|
23
|
-
* This slot renders the content that will be displayed inside of the tooltip.
|
|
24
|
-
* Typically this would include a string of text without any additional elements.
|
|
25
|
-
* This element is wrapped with a div inside of the component to give it the stylings and background colors.
|
|
26
|
-
* @cssprop {<color>} --pf-c-tooltip__content--BackgroundColor
|
|
27
|
-
* Sets the background color for the tooltip content.
|
|
28
|
-
* {@default `#1b1d21`}
|
|
29
|
-
* @cssprop {<color>} --pf-c-tooltip__content--Color
|
|
30
|
-
* Sets the font color for the tooltip content.
|
|
31
|
-
* {@default `#e0e0e0`}
|
|
32
|
-
* @cssprop {<number>} --pf-c-tooltip--line-height
|
|
33
|
-
* Sets the font color for the tooltip content.
|
|
34
|
-
* {@default `1.5`}
|
|
35
|
-
* @cssprop {<length>} --pf-c-tooltip--MaxWidth
|
|
36
|
-
* Maximum width for the tooltip.
|
|
37
|
-
* {@default `18.75rem`}
|
|
38
|
-
* @cssprop --pf-c-tooltip--BoxShadow
|
|
39
|
-
* Box shadow for the tooltip.
|
|
40
|
-
* {@default `0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)`}
|
|
41
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingTop
|
|
42
|
-
* Top padding for the tooltip.
|
|
43
|
-
* {@default `0.5rem`}
|
|
44
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingRight
|
|
45
|
-
* Right padding for the tooltip.
|
|
46
|
-
* {@default `0.5rem`}
|
|
47
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingBottom
|
|
48
|
-
* Bottom padding for the tooltip.
|
|
49
|
-
* {@default `0.5rem`}
|
|
50
|
-
* @cssprop {<length>} --pf-c-tooltip__content--PaddingLeft
|
|
51
|
-
* Left Padding for the tooltip.
|
|
52
|
-
* {@default `0.5rem`}
|
|
53
|
-
* @cssprop --pf-c-tooltip__content--FontSize
|
|
54
|
-
* Font size for the tooltip content.
|
|
55
|
-
* {@default `0.875rem`}
|
|
56
|
-
* @cssprop {<length>} --pf-c-tooltip__arrow--Width
|
|
57
|
-
* Tooltip arrow width.
|
|
58
|
-
* {@default `0.5rem`}
|
|
59
|
-
* @cssprop {<length>} --pf-c-tooltip__arrow--Height
|
|
60
|
-
* Tooltip arrow height.
|
|
61
|
-
* {@default `0.5rem`}
|
|
62
|
-
* @cssprop --pf-c-tooltip__arrow--m-top--TranslateX
|
|
63
|
-
* Positions the tooltip arrow along the x axis for `top` positioned arrows.
|
|
64
|
-
* {@default `-50%`}
|
|
65
|
-
* @cssprop --pf-c-tooltip__arrow--m-top--TranslateY
|
|
66
|
-
* Positions the tooltip arrow along the y axis for `top` positioned arrows.
|
|
67
|
-
* {@default `50%`}
|
|
68
|
-
* @cssprop --pf-c-tooltip__arrow--m-top--Rotate
|
|
69
|
-
* Rotates the tooltip arrow based on degrees of movement for `top` positioned arrows.
|
|
70
|
-
* {@default `45deg`}
|
|
71
|
-
* @cssprop --pf-c-tooltip__arrow--m-right--TranslateX
|
|
72
|
-
* Positions the tooltip arrow along the x axis for `right` positioned arrows.
|
|
73
|
-
* {@default `-50%`}
|
|
74
|
-
* @cssprop --pf-c-tooltip__arrow--m-right--TranslateY
|
|
75
|
-
* Positions the tooltip arrow along the y axis for `right` positioned arrows.
|
|
76
|
-
* {@default `-50%`}
|
|
77
|
-
* @cssprop --pf-c-tooltip__arrow--m-right--Rotate
|
|
78
|
-
* Rotates the tooltip arrow based on degrees of movement for `right` positioned arrows.
|
|
79
|
-
* {@default `45deg`}
|
|
80
|
-
* @cssprop --pf-c-tooltip__arrow--m-bottom--TranslateX
|
|
81
|
-
* Positions the tooltip arrow along the x axis for `bottom` positioned arrows.
|
|
82
|
-
* {@default `-50%`}
|
|
83
|
-
* @cssprop --pf-c-tooltip__arrow--m-bottom--TranslateY
|
|
84
|
-
* Positions the tooltip arrow along the y axis for `bottom` positioned arrows.
|
|
85
|
-
* {@default `-50%`}
|
|
86
|
-
* @cssprop --pf-c-tooltip__arrow--m-bottom--Rotate
|
|
87
|
-
* Rotates the tooltip arrow based on degrees of movement for `bottom` positioned arrows.
|
|
88
|
-
* {@default `45deg`}
|
|
89
|
-
* @cssprop --pf-c-tooltip__arrow--m-left--TranslateX
|
|
90
|
-
* Positions the tooltip arrow along the x axis for `left` positioned arrows.
|
|
91
|
-
* {@default `50%`}
|
|
92
|
-
* @cssprop --pf-c-tooltip__arrow--m-left--TranslateY
|
|
93
|
-
* Positions the tooltip arrow along the y axis for `left` positioned arrows.
|
|
94
|
-
* {@default `-50%`}
|
|
95
|
-
* @cssprop --pf-c-tooltip__arrow--m-left--Rotate
|
|
96
|
-
* Rotates the tooltip arrow based on degrees of movement for `left` positioned arrows.
|
|
97
|
-
* {@default `45deg`}
|
|
98
|
-
*/
|
|
99
15
|
let PfTooltip = class PfTooltip extends LitElement {
|
|
100
16
|
constructor() {
|
|
101
17
|
super(...arguments);
|
|
@@ -129,6 +45,7 @@ let PfTooltip = class PfTooltip extends LitElement {
|
|
|
129
45
|
/**
|
|
130
46
|
* Removes event listeners from the old trigger element and attaches
|
|
131
47
|
* them to the new trigger element.
|
|
48
|
+
* @param changed changed properties
|
|
132
49
|
*/
|
|
133
50
|
willUpdate(changed) {
|
|
134
51
|
if (changed.has('trigger')) {
|
|
@@ -190,32 +107,35 @@ _PfTooltip_getReferenceTrigger = function _PfTooltip_getReferenceTrigger() {
|
|
|
190
107
|
.getElementById(this.trigger?.normalize() ?? '');
|
|
191
108
|
};
|
|
192
109
|
_PfTooltip_updateTrigger = function _PfTooltip_updateTrigger() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
this
|
|
200
|
-
|
|
110
|
+
if (!isServer) {
|
|
111
|
+
const oldReferenceTrigger = __classPrivateFieldGet(this, _PfTooltip_referenceTrigger, "f");
|
|
112
|
+
__classPrivateFieldSet(this, _PfTooltip_referenceTrigger, this.trigger instanceof HTMLElement ? this.trigger
|
|
113
|
+
: typeof this.trigger === 'string' ? __classPrivateFieldGet(this, _PfTooltip_instances, "m", _PfTooltip_getReferenceTrigger).call(this)
|
|
114
|
+
: null, "f");
|
|
115
|
+
for (const evt of EnterEvents) {
|
|
116
|
+
if (__classPrivateFieldGet(this, _PfTooltip_referenceTrigger, "f")) {
|
|
117
|
+
this.removeEventListener(evt, this.show);
|
|
118
|
+
__classPrivateFieldGet(this, _PfTooltip_referenceTrigger, "f").addEventListener(evt, this.show);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
oldReferenceTrigger?.removeEventListener(evt, this.show);
|
|
122
|
+
this.addEventListener(evt, this.show);
|
|
123
|
+
}
|
|
201
124
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
oldReferenceTrigger?.removeEventListener(evt, this.hide);
|
|
214
|
-
this.addEventListener(evt, this.hide);
|
|
125
|
+
for (const evt of ExitEvents) {
|
|
126
|
+
if (__classPrivateFieldGet(this, _PfTooltip_referenceTrigger, "f")) {
|
|
127
|
+
this.removeEventListener(evt, this.hide);
|
|
128
|
+
__classPrivateFieldGet(this, _PfTooltip_referenceTrigger, "f").addEventListener(evt, this.hide);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
oldReferenceTrigger?.removeEventListener(evt, this.hide);
|
|
132
|
+
this.addEventListener(evt, this.hide);
|
|
133
|
+
}
|
|
215
134
|
}
|
|
216
135
|
}
|
|
217
136
|
};
|
|
218
137
|
PfTooltip.styles = [styles];
|
|
138
|
+
PfTooltip.version = "4.0.0";
|
|
219
139
|
__decorate([
|
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6B;AAG5B;IAAX,QAAQ,EAAE;0CAAkB;AAGsB;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;yCAAgB;AAEtD;IAAX,QAAQ,EAAE;0CAA4B;AAWpC;IAHF,QAAQ,CAAC;QACR,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,mBAAmB;KAC/B,CAAC;+CAA4B;AAwGjB;IAAZ,KAAK;qCAYL;AAEY;IAAZ,KAAK;qCAEL;AA/IU,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAgJrB","sourcesContent":["import type { PropertyValues } from 'lit';\nimport { LitElement, html } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport {\n FloatingDOMController,\n type Placement,\n} from '@patternfly/pfe-core/controllers/floating-dom-controller.js';\n\nimport { bound } from '@patternfly/pfe-core/decorators/bound.js';\n\nimport { StringListConverter } from '@patternfly/pfe-core';\n\n\nimport styles from './pf-tooltip.css';\n\nconst EnterEvents = ['focusin', 'tap', 'click', 'mouseenter'];\nconst ExitEvents = ['focusout', 'blur', 'mouseleave'];\n\n/**\n * A **tooltip** is in-app messaging used to identify elements on a page with short,\n * clarifying text.\n * @summary Toggle the visibility of helpful or contextual information.\n * @slot\n * This slot wraps around the element that should be used to invoke the tooltip content to display.\n * Typically this would be an icon, button, or other small sized element.\n * @slot content\n * This slot renders the content that will be displayed inside of the tooltip.\n * Typically this would include a string of text without any additional elements.\n * This element is wrapped with a div inside of the component to give it the stylings and background colors.\n * @cssprop {<color>} --pf-c-tooltip__content--BackgroundColor\n * Sets the background color for the tooltip content.\n * {@default `#1b1d21`}\n * @cssprop {<color>} --pf-c-tooltip__content--Color\n * Sets the font color for the tooltip content.\n * {@default `#e0e0e0`}\n * @cssprop {<number>} --pf-c-tooltip--line-height\n * Sets the font color for the tooltip content.\n * {@default `1.5`}\n * @cssprop {<length>} --pf-c-tooltip--MaxWidth\n * Maximum width for the tooltip.\n * {@default `18.75rem`}\n * @cssprop --pf-c-tooltip--BoxShadow\n * Box shadow for the tooltip.\n * {@default `0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)`}\n * @cssprop {<length>} --pf-c-tooltip__content--PaddingTop\n * Top padding for the tooltip.\n * {@default `0.5rem`}\n * @cssprop {<length>} --pf-c-tooltip__content--PaddingRight\n * Right padding for the tooltip.\n * {@default `0.5rem`}\n * @cssprop {<length>} --pf-c-tooltip__content--PaddingBottom\n * Bottom padding for the tooltip.\n * {@default `0.5rem`}\n * @cssprop {<length>} --pf-c-tooltip__content--PaddingLeft\n * Left Padding for the tooltip.\n * {@default `0.5rem`}\n * @cssprop --pf-c-tooltip__content--FontSize\n * Font size for the tooltip content.\n * {@default `0.875rem`}\n * @cssprop {<length>} --pf-c-tooltip__arrow--Width\n * Tooltip arrow width.\n * {@default `0.5rem`}\n * @cssprop {<length>} --pf-c-tooltip__arrow--Height\n * Tooltip arrow height.\n * {@default `0.5rem`}\n * @cssprop --pf-c-tooltip__arrow--m-top--TranslateX\n * Positions the tooltip arrow along the x axis for `top` positioned arrows.\n * {@default `-50%`}\n * @cssprop --pf-c-tooltip__arrow--m-top--TranslateY\n * Positions the tooltip arrow along the y axis for `top` positioned arrows.\n * {@default `50%`}\n * @cssprop --pf-c-tooltip__arrow--m-top--Rotate\n * Rotates the tooltip arrow based on degrees of movement for `top` positioned arrows.\n * {@default `45deg`}\n * @cssprop --pf-c-tooltip__arrow--m-right--TranslateX\n * Positions the tooltip arrow along the x axis for `right` positioned arrows.\n * {@default `-50%`}\n * @cssprop --pf-c-tooltip__arrow--m-right--TranslateY\n * Positions the tooltip arrow along the y axis for `right` positioned arrows.\n * {@default `-50%`}\n * @cssprop --pf-c-tooltip__arrow--m-right--Rotate\n * Rotates the tooltip arrow based on degrees of movement for `right` positioned arrows.\n * {@default `45deg`}\n * @cssprop --pf-c-tooltip__arrow--m-bottom--TranslateX\n * Positions the tooltip arrow along the x axis for `bottom` positioned arrows.\n * {@default `-50%`}\n * @cssprop --pf-c-tooltip__arrow--m-bottom--TranslateY\n * Positions the tooltip arrow along the y axis for `bottom` positioned arrows.\n * {@default `-50%`}\n * @cssprop --pf-c-tooltip__arrow--m-bottom--Rotate\n * Rotates the tooltip arrow based on degrees of movement for `bottom` positioned arrows.\n * {@default `45deg`}\n * @cssprop --pf-c-tooltip__arrow--m-left--TranslateX\n * Positions the tooltip arrow along the x axis for `left` positioned arrows.\n * {@default `50%`}\n * @cssprop --pf-c-tooltip__arrow--m-left--TranslateY\n * Positions the tooltip arrow along the y axis for `left` positioned arrows.\n * {@default `-50%`}\n * @cssprop --pf-c-tooltip__arrow--m-left--Rotate\n * Rotates the tooltip arrow based on degrees of movement for `left` positioned arrows.\n * {@default `45deg`}\n */\n@customElement('pf-tooltip')\nexport class PfTooltip extends LitElement {\n static readonly styles = [styles];\n\n /** The position of the tooltip, relative to the invoking content */\n @property() position: Placement = 'top';\n\n /** Tooltip content. Overridden by the content slot */\n @property() content?: string;\n\n /** If false, prevents the tooltip from trying to remain in view by flipping itself when necessary */\n @property({ type: Boolean, attribute: 'no-flip' }) noFlip = false;\n\n @property() trigger?: string | Element;\n\n /**\n * The flip order when flip is enabled and the initial position is not possible.\n * There are 12 options: `top`, `bottom`, `left`, `right`, `top-start`, `top-end`,\n * `bottom-start`, `bottom-end`, `left-start`, `left-end`,`right-start`, `right-end`.\n * The default is [oppositePlacement], where only the opposite placement is tried.\n */\n @property({\n attribute: 'flip-behavior',\n converter: StringListConverter,\n }) flipBehavior?: Placement[];\n\n get #invoker(): HTMLSlotElement | null {\n return this.shadowRoot?.querySelector('#invoker') ?? null;\n }\n\n get #content(): HTMLElement | null {\n return this.shadowRoot?.querySelector('#tooltip') ?? null;\n }\n\n #referenceTrigger?: HTMLElement | null;\n\n #float = new FloatingDOMController(this, {\n content: (): HTMLElement | null | undefined => this.#content,\n invoker: (): HTMLElement | null | undefined => {\n if (this.#referenceTrigger) {\n return this.#referenceTrigger;\n } else if (this.#invoker instanceof HTMLSlotElement\n && this.#invoker.assignedElements().length > 0) {\n return this.#invoker.assignedElements().at(0) as HTMLElement;\n } else {\n return this.#invoker;\n }\n },\n });\n\n override connectedCallback() {\n super.connectedCallback();\n this.#invokerChanged();\n this.#updateTrigger();\n }\n\n /**\n * Removes event listeners from the old trigger element and attaches\n * them to the new trigger element.\n */\n override willUpdate(changed: PropertyValues<this>) {\n if (changed.has('trigger')) {\n this.#updateTrigger();\n }\n }\n\n override render() {\n const { alignment, anchor, open, styles } = this.#float;\n\n const blockInvoker =\n this.#invoker?.assignedElements().length === 0\n && this.#invoker?.assignedNodes().length > 0;\n const display = blockInvoker ? 'block' : 'contents';\n\n return html`\n <div id=\"container\"\n style=\"${styleMap(styles)}\"\n class=\"${classMap({ open,\n [anchor]: !!anchor,\n [alignment]: !!alignment })}\">\n <div role=\"tooltip\"\n style=\"${styleMap({ display })}\"\n aria-labelledby=\"tooltip\">\n <slot id=\"invoker\" @slotchange=\"${this.#invokerChanged}\"></slot>\n </div>\n <div aria-hidden=\"${String(!open) as 'true' | 'false'}\">\n <slot id=\"tooltip\" name=\"content\">${this.content}</slot>\n </div>\n </div>\n `;\n }\n\n /** the invoker slot should render at block level if it only has text nodes */\n #invokerChanged() {\n this.requestUpdate();\n }\n\n #getReferenceTrigger() {\n return (this.getRootNode() as Document | ShadowRoot)\n .getElementById(this.trigger?.normalize() ?? '');\n }\n\n #updateTrigger() {\n const oldReferenceTrigger = this.#referenceTrigger;\n this.#referenceTrigger =\n this.trigger instanceof HTMLElement ? this.trigger\n : typeof this.trigger === 'string' ? this.#getReferenceTrigger()\n : null;\n for (const evt of EnterEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.show);\n this.#referenceTrigger.addEventListener(evt, this.show);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.show);\n this.addEventListener(evt, this.show);\n }\n }\n for (const evt of ExitEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.hide);\n this.#referenceTrigger.addEventListener(evt, this.hide);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.hide);\n this.addEventListener(evt, this.hide);\n }\n }\n }\n\n @bound async show() {\n await this.updateComplete;\n const placement = this.position;\n const offset =\n !placement?.match(/top|bottom/) ? 15\n : { mainAxis: 15, alignmentAxis: -4 };\n await this.#float.show({\n offset,\n placement,\n flip: !this.noFlip,\n fallbackPlacements: this.flipBehavior,\n });\n }\n\n @bound async hide() {\n await this.#float.hide();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-tooltip': PfTooltip;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pf-tooltip.js","sourceRoot":"","sources":["pf-tooltip.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EACL,qBAAqB,GAEtB,MAAM,6DAA6D,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;;;AAI3D,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AAC9D,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AAuF/C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU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A,IAAI,mCAAkB,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1D,CAAC;iBAAM,CAAC;gBACN,mBAAmB,EAAE,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzD,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AA/He,gBAAM,GAAoB,CAAC,MAAM,CAAC,AAA5B,CAA6B;;AAGvC;IAAX,QAAQ,EAAE;2CAA6B;AAG5B;IAAX,QAAQ,EAAE;0CAAkB;AAGsB;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;yCAAgB;AAEtD;IAAX,QAAQ,EAAE;0CAA4B;AAWpC;IAHF,QAAQ,CAAC;QACR,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,mBAAmB;KAC/B,CAAC;+CAA4B;AA2GjB;IAAZ,KAAK;qCAYL;AAEY;IAAZ,KAAK;qCAEL;AAlJU,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS","sourcesContent":["import type { PropertyValues, TemplateResult } from 'lit';\nimport { LitElement, html, isServer } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport {\n FloatingDOMController,\n type Placement,\n} from '@patternfly/pfe-core/controllers/floating-dom-controller.js';\n\nimport { bound } from '@patternfly/pfe-core/decorators/bound.js';\n\nimport { StringListConverter } from '@patternfly/pfe-core';\n\nimport styles from './pf-tooltip.css';\n\nconst EnterEvents = ['focusin', 'tap', 'click', 'mouseenter'];\nconst ExitEvents = ['focusout', 'blur', 'mouseleave'];\n\n/**\n * A **tooltip** is in-app messaging used to identify elements on a page with short,\n * clarifying text.\n * @summary Toggle the visibility of helpful or contextual information.\n * @slot\n * This slot wraps around the element that should be used to invoke the tooltip content to display.\n * Typically this would be an icon, button, or other small sized element.\n * @slot content\n * This slot renders the content that will be displayed inside of the tooltip.\n * Typically this would include a string of text without any additional elements.\n * This element is wrapped with a div inside of the component to give it the stylings and background colors.\n * @cssprop {<color>} [--pf-c-tooltip__content--BackgroundColor=#1b1d21]\n * Sets the background color for the tooltip content.\n *\n * @cssprop {<color>} [--pf-c-tooltip__content--Color=#e0e0e0]\n * Sets the font color for the tooltip content.\n *\n * @cssprop {<number>} [--pf-c-tooltip--line-height=1.5]\n * Sets the font color for the tooltip content.\n *\n * @cssprop {<length>} [--pf-c-tooltip--MaxWidth=18.75rem]\n * Maximum width for the tooltip.\n *\n * @cssprop [--pf-c-tooltip--BoxShadow=0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)]\n * Box shadow for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingTop=0.5rem]\n * Top padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingRight=0.5rem]\n * Right padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingBottom=0.5rem]\n * Bottom padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingLeft=0.5rem]\n * Left Padding for the tooltip.\n *\n * @cssprop [--pf-c-tooltip__content--FontSize=0.875rem]\n * Font size for the tooltip content.\n *\n * @cssprop {<length>} [--pf-c-tooltip__arrow--Width=0.5rem]\n * Tooltip arrow width.\n *\n * @cssprop {<length>} [--pf-c-tooltip__arrow--Height=0.5rem]\n * Tooltip arrow height.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--TranslateY=50]\n * Positions the tooltip arrow along the y axis for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--TranslateX=50]\n * Positions the tooltip arrow along the x axis for `left` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `left` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `left` positioned arrows.\n *\n */\n@customElement('pf-tooltip')\nexport class PfTooltip extends LitElement {\n static readonly styles: CSSStyleSheet[] = [styles];\n\n /** The position of the tooltip, relative to the invoking content */\n @property() position: Placement = 'top';\n\n /** Tooltip content. Overridden by the content slot */\n @property() content?: string;\n\n /** If false, prevents the tooltip from trying to remain in view by flipping itself when necessary */\n @property({ type: Boolean, attribute: 'no-flip' }) noFlip = false;\n\n @property() trigger?: string | Element;\n\n /**\n * The flip order when flip is enabled and the initial position is not possible.\n * There are 12 options: `top`, `bottom`, `left`, `right`, `top-start`, `top-end`,\n * `bottom-start`, `bottom-end`, `left-start`, `left-end`,`right-start`, `right-end`.\n * The default is [oppositePlacement], where only the opposite placement is tried.\n */\n @property({\n attribute: 'flip-behavior',\n converter: StringListConverter,\n }) flipBehavior?: Placement[];\n\n get #invoker(): HTMLSlotElement | null {\n return this.shadowRoot?.querySelector('#invoker') ?? null;\n }\n\n get #content(): HTMLElement | null {\n return this.shadowRoot?.querySelector('#tooltip') ?? null;\n }\n\n #referenceTrigger?: HTMLElement | null;\n\n #float = new FloatingDOMController(this, {\n content: (): HTMLElement | null | undefined => this.#content,\n invoker: (): HTMLElement | null | undefined => {\n if (this.#referenceTrigger) {\n return this.#referenceTrigger;\n } else if (this.#invoker instanceof HTMLSlotElement\n && this.#invoker.assignedElements().length > 0) {\n return this.#invoker.assignedElements().at(0) as HTMLElement;\n } else {\n return this.#invoker;\n }\n },\n });\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#invokerChanged();\n this.#updateTrigger();\n }\n\n /**\n * Removes event listeners from the old trigger element and attaches\n * them to the new trigger element.\n * @param changed changed properties\n */\n override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('trigger')) {\n this.#updateTrigger();\n }\n }\n\n override render(): TemplateResult<1> {\n const { alignment, anchor, open, styles } = this.#float;\n\n const blockInvoker =\n this.#invoker?.assignedElements().length === 0\n && this.#invoker?.assignedNodes().length > 0;\n const display = blockInvoker ? 'block' : 'contents';\n\n return html`\n <div id=\"container\"\n style=\"${styleMap(styles)}\"\n class=\"${classMap({ open,\n [anchor]: !!anchor,\n [alignment]: !!alignment })}\">\n <div role=\"tooltip\"\n style=\"${styleMap({ display })}\"\n aria-labelledby=\"tooltip\">\n <slot id=\"invoker\" @slotchange=\"${this.#invokerChanged}\"></slot>\n </div>\n <div aria-hidden=\"${String(!open) as 'true' | 'false'}\">\n <slot id=\"tooltip\" name=\"content\">${this.content}</slot>\n </div>\n </div>\n `;\n }\n\n /** the invoker slot should render at block level if it only has text nodes */\n #invokerChanged() {\n this.requestUpdate();\n }\n\n #getReferenceTrigger() {\n return (this.getRootNode() as Document | ShadowRoot)\n .getElementById(this.trigger?.normalize() ?? '');\n }\n\n #updateTrigger() {\n if (!isServer) {\n const oldReferenceTrigger = this.#referenceTrigger;\n this.#referenceTrigger =\n this.trigger instanceof HTMLElement ? this.trigger\n : typeof this.trigger === 'string' ? this.#getReferenceTrigger()\n : null;\n for (const evt of EnterEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.show);\n this.#referenceTrigger.addEventListener(evt, this.show);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.show);\n this.addEventListener(evt, this.show);\n }\n }\n for (const evt of ExitEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.hide);\n this.#referenceTrigger.addEventListener(evt, this.hide);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.hide);\n this.addEventListener(evt, this.hide);\n }\n }\n }\n }\n\n @bound async show(): Promise<void> {\n await this.updateComplete;\n const placement = this.position;\n const offset =\n !placement?.match(/top|bottom/) ? 15\n : { mainAxis: 15, alignmentAxis: -4 };\n await this.#float.show({\n offset,\n placement,\n flip: !this.noFlip,\n fallbackPlacements: this.flipBehavior,\n });\n }\n\n @bound async hide(): Promise<void> {\n await this.#float.hide();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-tooltip': PfTooltip;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { test } from '@playwright/test';
|
|
2
2
|
import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
|
|
3
|
+
import { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';
|
|
3
4
|
const tagName = 'pf-tooltip';
|
|
4
5
|
test.describe(tagName, () => {
|
|
5
6
|
test('snapshot', async ({ page }) => {
|
|
@@ -7,5 +8,16 @@ test.describe(tagName, () => {
|
|
|
7
8
|
await componentPage.navigate();
|
|
8
9
|
await componentPage.snapshot();
|
|
9
10
|
});
|
|
11
|
+
test('ssr', async ({ browser }) => {
|
|
12
|
+
const fixture = new SSRPage({
|
|
13
|
+
tagName,
|
|
14
|
+
browser,
|
|
15
|
+
demoDir: new URL('../demo/', import.meta.url),
|
|
16
|
+
importSpecifiers: [
|
|
17
|
+
`@patternfly/elements/${tagName}/${tagName}.js`,
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
await fixture.snapshots();
|
|
21
|
+
});
|
|
10
22
|
});
|
|
11
23
|
//# sourceMappingURL=pf-tooltip.e2e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pf-tooltip.e2e.js","sourceRoot":"","sources":["pf-tooltip.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;
|
|
1
|
+
{"version":3,"file":"pf-tooltip.e2e.js","sourceRoot":"","sources":["pf-tooltip.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,kDAAkD,CAAC;AAE3E,MAAM,OAAO,GAAG,YAAY,CAAC;AAE7B,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;IAEH,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;YAC1B,OAAO;YACP,OAAO;YACP,OAAO,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;YAC7C,gBAAgB,EAAE;gBAChB,wBAAwB,OAAO,IAAI,OAAO,KAAK;aAChD;SACF,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test } from '@playwright/test';\nimport { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';\nimport { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';\n\nconst tagName = 'pf-tooltip';\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 test('ssr', async ({ browser }) => {\n const fixture = new SSRPage({\n tagName,\n browser,\n demoDir: new URL('../demo/', import.meta.url),\n importSpecifiers: [\n `@patternfly/elements/${tagName}/${tagName}.js`,\n ],\n });\n await fixture.snapshots();\n });\n});\n"]}
|