q2-tecton-elements 1.57.0 → 1.57.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/dist/bundle-report.json +484 -459
- package/dist/cjs/click-elsewhere.cjs.entry.js +1 -1
- package/dist/cjs/{index-Ct37J3sm.js → index-DRPUzMCR.js} +3 -7
- package/dist/{q2-tecton-elements/index-DHD1Dbkd.js.map → cjs/index-DRPUzMCR.js.map} +1 -1
- package/dist/cjs/{index-DwY8j6jj.js → index-zMAVnBYO.js} +116 -12
- package/dist/cjs/index-zMAVnBYO.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/q2-action-group_2.cjs.entry.js +4 -4
- package/dist/cjs/q2-action-sheet.cjs.entry.js +3 -3
- package/dist/cjs/q2-avatar.cjs.entry.js +2 -2
- package/dist/cjs/q2-badge_7.cjs.entry.js +6 -6
- package/dist/cjs/q2-calendar.cjs.entry.js +2 -2
- package/dist/cjs/q2-card.cjs.entry.js +2 -2
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +4 -4
- package/dist/cjs/q2-carousel.cjs.entry.js +2 -2
- package/dist/cjs/q2-chart-area.cjs.entry.js +3 -3
- package/dist/cjs/q2-chart-bar.cjs.entry.js +3 -3
- package/dist/cjs/q2-chart-donut.cjs.entry.js +3 -3
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +2 -2
- package/dist/cjs/q2-checkbox.cjs.entry.js +2 -2
- package/dist/cjs/q2-context.cjs.entry.js +3 -3
- package/dist/cjs/q2-currency.cjs.entry.js +2 -2
- package/dist/cjs/q2-data-table.cjs.entry.js +2 -2
- package/dist/cjs/q2-detail.cjs.entry.js +3 -3
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +2 -2
- package/dist/cjs/q2-dropdown.cjs.entry.js +6 -4
- package/dist/cjs/q2-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-dropdown.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +2 -2
- package/dist/cjs/q2-example.cjs.entry.js +2 -2
- package/dist/cjs/q2-file-picker.cjs.entry.js +2 -2
- package/dist/cjs/q2-form.cjs.entry.js +2 -2
- package/dist/cjs/q2-formatted-text.cjs.entry.js +2 -2
- package/dist/cjs/q2-grid-area.cjs.entry.js +1 -1
- package/dist/cjs/q2-grid.cjs.entry.js +1 -1
- package/dist/cjs/q2-item.cjs.entry.js +3 -3
- package/dist/cjs/q2-legend.cjs.entry.js +2 -2
- package/dist/cjs/q2-link_2.cjs.entry.js +3 -3
- package/dist/cjs/q2-loading-element.cjs.entry.js +2 -2
- package/dist/cjs/q2-loc.cjs.entry.js +2 -2
- package/dist/cjs/q2-message.cjs.entry.js +3 -3
- package/dist/cjs/q2-modal.cjs.entry.js +3 -3
- package/dist/cjs/q2-month-picker.cjs.entry.js +4 -4
- package/dist/cjs/q2-optgroup.cjs.entry.js +3 -3
- package/dist/cjs/q2-option-list.q2-popover.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-option-list_2.cjs.entry.js +53 -62
- package/dist/cjs/q2-option-list_2.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-option.cjs.entry.js +2 -2
- package/dist/cjs/q2-pagination.cjs.entry.js +5 -5
- package/dist/cjs/q2-pill.cjs.entry.js +3 -3
- package/dist/cjs/q2-radio-group.cjs.entry.js +2 -2
- package/dist/cjs/q2-radio.cjs.entry.js +2 -2
- package/dist/cjs/q2-relative-time.cjs.entry.js +3 -3
- package/dist/cjs/q2-section.cjs.entry.js +4 -4
- package/dist/cjs/q2-select.cjs.entry.js +81 -24
- package/dist/cjs/q2-select.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-select.entry.cjs.js.map +1 -1
- package/dist/cjs/q2-stepper-pane.cjs.entry.js +2 -2
- package/dist/cjs/q2-stepper-vertical.cjs.entry.js +3 -3
- package/dist/cjs/q2-stepper.cjs.entry.js +3 -3
- package/dist/cjs/q2-tag.cjs.entry.js +3 -3
- package/dist/cjs/q2-tecton-elements.cjs.js +23 -2
- package/dist/cjs/q2-tecton-elements.cjs.js.map +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +3 -3
- package/dist/cjs/q2-tooltip.cjs.entry.js +2 -2
- package/dist/cjs/{shapes-DYFTrUXB.js → shapes-DDw2Fhwn.js} +3 -3
- package/dist/cjs/{shapes-DYFTrUXB.js.map → shapes-DDw2Fhwn.js.map} +1 -1
- package/dist/cjs/tecton-tab-pane.cjs.entry.js +3 -3
- package/dist/collection/components/q2-action-group/q2-action-group.js +1 -1
- package/dist/collection/components/q2-action-sheet/q2-action-sheet.js +1 -1
- package/dist/collection/components/q2-avatar/q2-avatar.js +1 -1
- package/dist/collection/components/q2-calendar/q2-month-picker.js +2 -2
- package/dist/collection/components/q2-carousel-pane/q2-carousel-pane.js +2 -2
- package/dist/collection/components/q2-chart-area/q2-chart-area.js +1 -1
- package/dist/collection/components/q2-chart-bar/q2-chart-bar.js +1 -1
- package/dist/collection/components/q2-chart-donut/q2-chart-donut.js +1 -1
- package/dist/collection/components/q2-context/q2-context.js +1 -1
- package/dist/collection/components/q2-currency/q2-currency.js +1 -1
- package/dist/collection/components/q2-detail/q2-detail.js +1 -1
- package/dist/collection/components/q2-dropdown/q2-dropdown.js +4 -2
- package/dist/collection/components/q2-dropdown/q2-dropdown.js.map +1 -1
- package/dist/collection/components/q2-example/q2-example.js +1 -1
- package/dist/collection/components/q2-form/q2-form.js +1 -1
- package/dist/collection/components/q2-formatted-text/q2-formatted-text.js +1 -1
- package/dist/collection/components/q2-input/q2-input.js +1 -1
- package/dist/collection/components/q2-item/q2-item.js +1 -1
- package/dist/collection/components/q2-legend/q2-legend.js +1 -1
- package/dist/collection/components/q2-list/q2-list.js +1 -1
- package/dist/collection/components/q2-message/q2-message.js +1 -1
- package/dist/collection/components/q2-modal/q2-modal.js +1 -1
- package/dist/collection/components/q2-optgroup/q2-optgroup.js +1 -1
- package/dist/collection/components/q2-pagination/q2-pagination.js +3 -3
- package/dist/collection/components/q2-pill/q2-pill.js +1 -1
- package/dist/collection/components/q2-popover/q2-popover.css +18 -10
- package/dist/collection/components/q2-popover/q2-popover.js +53 -61
- package/dist/collection/components/q2-popover/q2-popover.js.map +1 -1
- package/dist/collection/components/q2-relative-time/q2-relative-time.js +1 -1
- package/dist/collection/components/q2-resize-observer/q2-resize-observer.js +1 -1
- package/dist/collection/components/q2-section/q2-section.js +2 -2
- package/dist/collection/components/q2-select/q2-select.js +89 -25
- package/dist/collection/components/q2-select/q2-select.js.map +1 -1
- package/dist/collection/components/q2-stepper/q2-stepper.js +1 -1
- package/dist/collection/components/q2-stepper-vertical/q2-stepper-vertical.js +1 -1
- package/dist/collection/components/q2-tab-container/q2-tab-container.js +1 -1
- package/dist/collection/components/q2-tab-pane/q2-tab-pane.js +1 -1
- package/dist/collection/components/q2-tag/q2-tag.js +1 -1
- package/dist/collection/components/q2-textarea/q2-textarea.js +1 -1
- package/dist/collection/components/tecton-tab-pane/tecton-tab-pane.js +2 -2
- package/dist/components/index2.js +1 -4
- package/dist/components/index2.js.map +1 -1
- package/dist/components/q2-action-group2.js +1 -1
- package/dist/components/q2-action-sheet.js +1 -1
- package/dist/components/q2-avatar2.js +1 -1
- package/dist/components/q2-carousel-pane.js +2 -2
- package/dist/components/q2-chart-area.js +1 -1
- package/dist/components/q2-chart-bar.js +1 -1
- package/dist/components/q2-chart-donut.js +1 -1
- package/dist/components/q2-context.js +1 -1
- package/dist/components/q2-currency.js +1 -1
- package/dist/components/q2-detail.js +1 -1
- package/dist/components/q2-dropdown.js +4 -2
- package/dist/components/q2-dropdown.js.map +1 -1
- package/dist/components/q2-example.js +1 -1
- package/dist/components/q2-form.js +1 -1
- package/dist/components/q2-formatted-text.js +1 -1
- package/dist/components/q2-input2.js +1 -1
- package/dist/components/q2-item2.js +1 -1
- package/dist/components/q2-legend2.js +1 -1
- package/dist/components/q2-list2.js +1 -1
- package/dist/components/q2-message2.js +1 -1
- package/dist/components/q2-modal.js +1 -1
- package/dist/components/q2-month-picker.js +2 -2
- package/dist/components/q2-optgroup2.js +1 -1
- package/dist/components/q2-pagination.js +3 -3
- package/dist/components/q2-pill.js +1 -1
- package/dist/components/q2-popover2.js +52 -61
- package/dist/components/q2-popover2.js.map +1 -1
- package/dist/components/q2-relative-time.js +1 -1
- package/dist/components/q2-resize-observer2.js +1 -1
- package/dist/components/q2-section.js +2 -2
- package/dist/components/q2-select2.js +83 -26
- package/dist/components/q2-select2.js.map +1 -1
- package/dist/components/q2-stepper-vertical.js +1 -1
- package/dist/components/q2-stepper.js +1 -1
- package/dist/components/q2-tab-container.js +1 -1
- package/dist/components/q2-tab-pane.js +1 -1
- package/dist/components/q2-tag.js +1 -1
- package/dist/components/q2-textarea.js +1 -1
- package/dist/components/tecton-tab-pane.js +2 -2
- package/dist/esm/click-elsewhere.entry.js +1 -1
- package/dist/esm/{index-YFPMNbDm.js → index-C7zSUT3M.js} +116 -13
- package/dist/esm/index-C7zSUT3M.js.map +1 -0
- package/dist/esm/{index-DHD1Dbkd.js → index-y0xcWkDl.js} +4 -7
- package/dist/esm/{index-DHD1Dbkd.js.map → index-y0xcWkDl.js.map} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/q2-action-group_2.entry.js +4 -4
- package/dist/esm/q2-action-sheet.entry.js +3 -3
- package/dist/esm/q2-avatar.entry.js +2 -2
- package/dist/esm/q2-badge_7.entry.js +6 -6
- package/dist/esm/q2-calendar.entry.js +2 -2
- package/dist/esm/q2-card.entry.js +2 -2
- package/dist/esm/q2-carousel-pane.entry.js +4 -4
- package/dist/esm/q2-carousel.entry.js +2 -2
- package/dist/esm/q2-chart-area.entry.js +3 -3
- package/dist/esm/q2-chart-bar.entry.js +3 -3
- package/dist/esm/q2-chart-donut.entry.js +3 -3
- package/dist/esm/q2-checkbox-group.entry.js +2 -2
- package/dist/esm/q2-checkbox.entry.js +2 -2
- package/dist/esm/q2-context.entry.js +3 -3
- package/dist/esm/q2-currency.entry.js +2 -2
- package/dist/esm/q2-data-table.entry.js +2 -2
- package/dist/esm/q2-detail.entry.js +3 -3
- package/dist/esm/q2-dropdown-item.entry.js +2 -2
- package/dist/esm/q2-dropdown.entry.js +6 -4
- package/dist/esm/q2-dropdown.entry.js.map +1 -1
- package/dist/esm/q2-editable-field.entry.js +2 -2
- package/dist/esm/q2-example.entry.js +2 -2
- package/dist/esm/q2-file-picker.entry.js +2 -2
- package/dist/esm/q2-form.entry.js +2 -2
- package/dist/esm/q2-formatted-text.entry.js +2 -2
- package/dist/esm/q2-grid-area.entry.js +1 -1
- package/dist/esm/q2-grid.entry.js +1 -1
- package/dist/esm/q2-item.entry.js +3 -3
- package/dist/esm/q2-legend.entry.js +2 -2
- package/dist/esm/q2-link_2.entry.js +3 -3
- package/dist/esm/q2-loading-element.entry.js +2 -2
- package/dist/esm/q2-loc.entry.js +2 -2
- package/dist/esm/q2-message.entry.js +3 -3
- package/dist/esm/q2-modal.entry.js +3 -3
- package/dist/esm/q2-month-picker.entry.js +4 -4
- package/dist/esm/q2-optgroup.entry.js +3 -3
- package/dist/esm/q2-option-list.q2-popover.entry.js.map +1 -1
- package/dist/esm/q2-option-list_2.entry.js +53 -62
- package/dist/esm/q2-option-list_2.entry.js.map +1 -1
- package/dist/esm/q2-option.entry.js +2 -2
- package/dist/esm/q2-pagination.entry.js +5 -5
- package/dist/esm/q2-pill.entry.js +3 -3
- package/dist/esm/q2-radio-group.entry.js +2 -2
- package/dist/esm/q2-radio.entry.js +2 -2
- package/dist/esm/q2-relative-time.entry.js +3 -3
- package/dist/esm/q2-section.entry.js +4 -4
- package/dist/esm/q2-select.entry.js +81 -24
- package/dist/esm/q2-select.entry.js.map +1 -1
- package/dist/esm/q2-stepper-pane.entry.js +2 -2
- package/dist/esm/q2-stepper-vertical.entry.js +3 -3
- package/dist/esm/q2-stepper.entry.js +3 -3
- package/dist/esm/q2-tag.entry.js +3 -3
- package/dist/esm/q2-tecton-elements.js +24 -3
- package/dist/esm/q2-tecton-elements.js.map +1 -1
- package/dist/esm/q2-textarea.entry.js +3 -3
- package/dist/esm/q2-tooltip.entry.js +2 -2
- package/dist/esm/{shapes-B9jYz1VS.js → shapes-DO0UnuKe.js} +3 -3
- package/dist/esm/{shapes-B9jYz1VS.js.map → shapes-DO0UnuKe.js.map} +1 -1
- package/dist/esm/tecton-tab-pane.entry.js +3 -3
- package/dist/q2-tecton-elements/click-elsewhere.entry.js +1 -1
- package/dist/q2-tecton-elements/{index-YFPMNbDm.js → index-C7zSUT3M.js} +559 -450
- package/dist/q2-tecton-elements/index-C7zSUT3M.js.map +1 -0
- package/dist/q2-tecton-elements/{index-DHD1Dbkd.js → index-y0xcWkDl.js} +4 -8
- package/dist/{cjs/index-Ct37J3sm.js.map → q2-tecton-elements/index-y0xcWkDl.js.map} +1 -1
- package/dist/q2-tecton-elements/q2-action-group_2.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-action-sheet.entry.js +10 -10
- package/dist/q2-tecton-elements/q2-avatar.entry.js +7 -7
- package/dist/q2-tecton-elements/q2-badge_7.entry.js +75 -75
- package/dist/q2-tecton-elements/q2-calendar.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-card.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-carousel-pane.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-carousel.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-chart-area.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-chart-bar.entry.js +4 -4
- package/dist/q2-tecton-elements/q2-chart-donut.entry.js +70 -70
- package/dist/q2-tecton-elements/q2-checkbox-group.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-checkbox.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-context.entry.js +13 -13
- package/dist/q2-tecton-elements/q2-currency.entry.js +7 -7
- package/dist/q2-tecton-elements/q2-data-table.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-detail.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-dropdown-item.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-dropdown.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-dropdown.entry.js +69 -67
- package/dist/q2-tecton-elements/q2-dropdown.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-editable-field.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-example.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-file-picker.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-form.entry.js +3 -3
- package/dist/q2-tecton-elements/q2-formatted-text.entry.js +3 -3
- package/dist/q2-tecton-elements/q2-grid-area.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-grid.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-item.entry.js +14 -14
- package/dist/q2-tecton-elements/q2-legend.entry.js +3 -3
- package/dist/q2-tecton-elements/q2-link_2.entry.js +8 -8
- package/dist/q2-tecton-elements/q2-loading-element.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-loc.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-message.entry.js +21 -21
- package/dist/q2-tecton-elements/q2-modal.entry.js +23 -23
- package/dist/q2-tecton-elements/q2-month-picker.entry.js +67 -67
- package/dist/q2-tecton-elements/q2-optgroup.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-option-list.q2-popover.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js +208 -210
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-option.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-pagination.entry.js +26 -26
- package/dist/q2-tecton-elements/q2-pill.entry.js +23 -23
- package/dist/q2-tecton-elements/q2-radio-group.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-radio.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-relative-time.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-section.entry.js +22 -22
- package/dist/q2-tecton-elements/q2-select.entry.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-select.entry.js +141 -96
- package/dist/q2-tecton-elements/q2-select.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-stepper-pane.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-stepper-vertical.entry.js +20 -20
- package/dist/q2-tecton-elements/q2-stepper.entry.js +14 -14
- package/dist/q2-tecton-elements/q2-tag.entry.js +12 -12
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +31 -9
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-textarea.entry.js +4 -4
- package/dist/q2-tecton-elements/q2-tooltip.entry.js +2 -2
- package/dist/q2-tecton-elements/{shapes-B9jYz1VS.js → shapes-DO0UnuKe.js} +3 -3
- package/dist/q2-tecton-elements/{shapes-B9jYz1VS.js.map → shapes-DO0UnuKe.js.map} +1 -1
- package/dist/q2-tecton-elements/tecton-tab-pane.entry.js +7 -7
- package/dist/types/components/q2-popover/q2-popover.d.ts +4 -4
- package/dist/types/components/q2-select/q2-select.d.ts +13 -3
- package/dist/types/components.d.ts +2 -0
- package/package.json +3 -3
- package/dist/cjs/index-DwY8j6jj.js.map +0 -1
- package/dist/esm/index-YFPMNbDm.js.map +0 -1
- package/dist/q2-tecton-elements/index-YFPMNbDm.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, } from "@stencil/core";
|
|
2
|
-
import { handleDeprecationWarning, waitForNextPaint
|
|
2
|
+
import { handleDeprecationWarning, waitForNextPaint } from "../../utils";
|
|
3
3
|
/**
|
|
4
4
|
* ***********
|
|
5
5
|
* * WARNING *
|
|
@@ -29,19 +29,25 @@ export class Q2Popover {
|
|
|
29
29
|
* The number of pixels to leave between the popover and the edge of the viewport
|
|
30
30
|
*/
|
|
31
31
|
this.displayBuffer = 10;
|
|
32
|
-
/** remove when Popover API is supported in iOS */
|
|
33
32
|
this.orientationChanged = false;
|
|
34
33
|
// #endregion
|
|
35
34
|
// #region State Properties
|
|
36
35
|
this.currentDirection = undefined;
|
|
37
36
|
// remove `show` when Popover API is supported in iOS
|
|
38
37
|
this.show = false;
|
|
38
|
+
// #endregion
|
|
39
|
+
// #region Public Property API
|
|
40
|
+
/** Aligns the popover to the left or right side of the control element. */
|
|
41
|
+
this.align = 'left';
|
|
39
42
|
this.mode = null;
|
|
40
43
|
this.handleMinHeight = () => {
|
|
41
44
|
if (this.minHeight) {
|
|
42
45
|
handleDeprecationWarning(this, 'minHeight', 'prop');
|
|
43
46
|
}
|
|
44
47
|
};
|
|
48
|
+
this.handlePopoverToggleEvent = (event) => {
|
|
49
|
+
this.popoverStateChanged.emit({ open: event.newState === 'open' });
|
|
50
|
+
};
|
|
45
51
|
this.setAbsoluteCSSProperties = async () => {
|
|
46
52
|
const { controlElement, containerElement, currentDirection, align } = this;
|
|
47
53
|
if (align === 'right') {
|
|
@@ -66,34 +72,41 @@ export class Q2Popover {
|
|
|
66
72
|
await waitForNextPaint();
|
|
67
73
|
containerElement.style.setProperty('--comp-pop-opacity', '1');
|
|
68
74
|
};
|
|
69
|
-
this.
|
|
70
|
-
var _a, _b, _c, _d;
|
|
71
|
-
const { controlElement, containerElement, currentDirection,
|
|
75
|
+
this.setPopoverAPICSSProperties = async () => {
|
|
76
|
+
var _a, _b, _c, _d, _e, _f;
|
|
77
|
+
const { controlElement, containerElement, currentDirection, isModule, align } = this;
|
|
72
78
|
const { top: controlTop, bottom: controlBottom, left: controlLeft, right: controlRight, } = (_b = (_a = controlElement === null || controlElement === void 0 ? void 0 : controlElement.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(controlElement)) !== null && _b !== void 0 ? _b : {
|
|
73
79
|
top: 0,
|
|
74
80
|
bottom: 0,
|
|
75
81
|
left: 0,
|
|
76
82
|
right: 0,
|
|
77
83
|
};
|
|
78
|
-
const popoverLeft = controlLeft
|
|
84
|
+
const popoverLeft = controlLeft;
|
|
85
|
+
const popoverRight = ((_c = window === null || window === void 0 ? void 0 : window.visualViewport) === null || _c === void 0 ? void 0 : _c.width) - controlRight;
|
|
86
|
+
if (align === 'right') {
|
|
87
|
+
containerElement.style.setProperty('--comp-pop-right', `${popoverRight - window.scrollX}px`);
|
|
88
|
+
containerElement.style.setProperty('--comp-pop-left', 'unset');
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
containerElement.style.setProperty('--comp-pop-left', `${popoverLeft + window.scrollX}px`);
|
|
92
|
+
containerElement.style.setProperty('--comp-pop-right', 'unset');
|
|
93
|
+
}
|
|
79
94
|
if (this.block)
|
|
80
95
|
containerElement.style.setProperty('--comp-pop-width', `${(controlElement === null || controlElement === void 0 ? void 0 : controlElement.offsetWidth) || 0}px`);
|
|
81
|
-
containerElement.style.setProperty('--comp-pop-left', `${popoverLeft}px`);
|
|
82
|
-
containerElement.style.setProperty('--comp-pop-right', `${rootElementRect.width + rootElementRect.left - controlRight}px`);
|
|
83
96
|
if (currentDirection === 'up') {
|
|
84
|
-
if (
|
|
97
|
+
if (isModule) {
|
|
85
98
|
containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop}px`);
|
|
86
99
|
}
|
|
87
100
|
else {
|
|
88
|
-
containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop - ((
|
|
101
|
+
containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop - ((_d = window === null || window === void 0 ? void 0 : window.visualViewport) === null || _d === void 0 ? void 0 : _d.offsetTop) - window.scrollY}px`);
|
|
89
102
|
}
|
|
90
103
|
}
|
|
91
104
|
if (currentDirection === 'down') {
|
|
92
|
-
if (
|
|
105
|
+
if (isModule) {
|
|
93
106
|
containerElement.style.setProperty('--comp-pop-top', `${controlBottom}px`);
|
|
94
107
|
}
|
|
95
108
|
else {
|
|
96
|
-
containerElement.style.setProperty('--comp-pop-top', `${controlBottom
|
|
109
|
+
containerElement.style.setProperty('--comp-pop-top', `${controlBottom + ((_f = (_e = window === null || window === void 0 ? void 0 : window.visualViewport) === null || _e === void 0 ? void 0 : _e.offsetTop) !== null && _f !== void 0 ? _f : 0) + window.scrollY}px`);
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
// Wait for one paint to prevent layout thrashing
|
|
@@ -114,13 +127,21 @@ export class Q2Popover {
|
|
|
114
127
|
// #region Component Lifecycle Events
|
|
115
128
|
disconnectedCallback() {
|
|
116
129
|
this.removeViewportListeners();
|
|
130
|
+
this.containerElement.removeEventListener('toggle', this.handlePopoverToggleEvent);
|
|
117
131
|
this.containerElement = null;
|
|
118
132
|
this.contentElement = null;
|
|
119
133
|
this.controlElement = null;
|
|
120
|
-
|
|
134
|
+
}
|
|
135
|
+
componentWillLoad() {
|
|
136
|
+
if (!this.supportsPopoverAPI) {
|
|
137
|
+
console.warn('The Popover API is not supported in this browser. Please update your browser to the latest version. The component will use legacy mode.');
|
|
138
|
+
this.mode = 'legacy';
|
|
139
|
+
}
|
|
121
140
|
}
|
|
122
141
|
componentDidLoad() {
|
|
123
142
|
this.handleMinHeight();
|
|
143
|
+
if (this.supportsPopoverAPI)
|
|
144
|
+
this.containerElement.addEventListener('toggle', this.handlePopoverToggleEvent);
|
|
124
145
|
if (this.open)
|
|
125
146
|
this.determinePopDirection();
|
|
126
147
|
}
|
|
@@ -147,7 +168,6 @@ export class Q2Popover {
|
|
|
147
168
|
this.handleMinHeight();
|
|
148
169
|
}
|
|
149
170
|
async openChanged(open) {
|
|
150
|
-
this.setRootElement();
|
|
151
171
|
this.popoverStateChanged.emit({ open });
|
|
152
172
|
if (open) {
|
|
153
173
|
this.addViewportListeners();
|
|
@@ -156,7 +176,12 @@ export class Q2Popover {
|
|
|
156
176
|
else {
|
|
157
177
|
this.removeViewportListeners();
|
|
158
178
|
this.currentDirection = undefined;
|
|
159
|
-
this.
|
|
179
|
+
if (this.mode === 'legacy' || !this.supportsPopoverAPI) {
|
|
180
|
+
this.show = false;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
this.containerElement.hidePopover();
|
|
184
|
+
}
|
|
160
185
|
await waitForNextPaint();
|
|
161
186
|
this.clearCSSProperties();
|
|
162
187
|
}
|
|
@@ -179,6 +204,9 @@ export class Q2Popover {
|
|
|
179
204
|
return undefined;
|
|
180
205
|
}
|
|
181
206
|
}
|
|
207
|
+
get supportsPopoverAPI() {
|
|
208
|
+
return Object.hasOwn(HTMLElement.prototype, 'popover');
|
|
209
|
+
}
|
|
182
210
|
get validatedMaxHeight() {
|
|
183
211
|
const { maxHeight } = this;
|
|
184
212
|
return isNaN(maxHeight) ? undefined : maxHeight;
|
|
@@ -187,11 +215,9 @@ export class Q2Popover {
|
|
|
187
215
|
var _a;
|
|
188
216
|
window.addEventListener('resize', this.viewPortOrientationChanged);
|
|
189
217
|
visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.addEventListener('resize', this.viewPortChanged);
|
|
190
|
-
// #region remove when Popover API is supported in iOS
|
|
191
218
|
window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });
|
|
192
219
|
(_a = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || _a === void 0 ? void 0 : _a.addEventListener('orientationchange', this.viewPortOrientationChanged);
|
|
193
220
|
window.addEventListener('orientationchange', this.viewPortOrientationChanged);
|
|
194
|
-
// #endregion
|
|
195
221
|
}
|
|
196
222
|
clearCSSProperties() {
|
|
197
223
|
this.containerElement.style.removeProperty('--comp-pop-max-height');
|
|
@@ -265,72 +291,37 @@ export class Q2Popover {
|
|
|
265
291
|
var _a;
|
|
266
292
|
window.removeEventListener('resize', this.viewPortOrientationChanged);
|
|
267
293
|
visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.removeEventListener('resize', this.viewPortChanged);
|
|
268
|
-
// #region remove when Popover API is supported in iOS
|
|
269
294
|
window.removeEventListener('scroll', this.viewPortChanged, { capture: true });
|
|
270
295
|
(_a = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || _a === void 0 ? void 0 : _a.removeEventListener('orientationchange', this.viewPortOrientationChanged);
|
|
271
296
|
window.removeEventListener('orientationchange', this.viewPortOrientationChanged);
|
|
272
|
-
// #endregion
|
|
273
297
|
}
|
|
274
298
|
setDirectionAndShow(direction) {
|
|
275
|
-
this.setRootElement();
|
|
276
299
|
// Due to some runtime inconsistency across devices/browsers we need to add one more check here because the
|
|
277
300
|
// popover can be closed between the time the popover is opened and the time the direction is determined
|
|
278
301
|
const isOpen = this.open;
|
|
279
302
|
if (!isOpen)
|
|
280
303
|
return;
|
|
281
304
|
this.currentDirection = direction;
|
|
282
|
-
this.
|
|
283
|
-
|
|
305
|
+
if (this.mode === 'legacy' || !this.supportsPopoverAPI) {
|
|
306
|
+
this.show = true;
|
|
284
307
|
this.setAbsoluteCSSProperties();
|
|
285
308
|
}
|
|
286
309
|
else {
|
|
287
|
-
this.
|
|
310
|
+
this.setPopoverAPICSSProperties();
|
|
311
|
+
this.containerElement.showPopover();
|
|
288
312
|
}
|
|
289
313
|
}
|
|
290
|
-
setRootElement() {
|
|
291
|
-
let currentElement = this.hostElement;
|
|
292
|
-
while (currentElement && currentElement !== document.documentElement) {
|
|
293
|
-
const computedStyle = window.getComputedStyle(currentElement);
|
|
294
|
-
// Check if the element has any styles applied that create a new containg block
|
|
295
|
-
if (computedStyle.transform !== 'none' ||
|
|
296
|
-
computedStyle.filter !== 'none' ||
|
|
297
|
-
computedStyle.perspective !== 'none' ||
|
|
298
|
-
computedStyle.containerType !== 'normal' ||
|
|
299
|
-
['transform', 'perspective', 'filter'].includes(computedStyle.willChange) ||
|
|
300
|
-
['layout', 'paint', 'strict', 'content'].includes(computedStyle.contain)) {
|
|
301
|
-
this.rootElementRect = currentElement.getBoundingClientRect();
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
const rootNode = currentElement.getRootNode();
|
|
305
|
-
const isRootNodeWebComponent = typeof ShadowRoot !== 'undefined' &&
|
|
306
|
-
rootNode instanceof ShadowRoot &&
|
|
307
|
-
rootNode.host instanceof HTMLElement;
|
|
308
|
-
if (isRootNodeWebComponent) {
|
|
309
|
-
currentElement = rootNode.host;
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
currentElement = currentElement.parentElement;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
// Return the document's bounding rect if no element is found
|
|
316
|
-
this.rootElementRect = {
|
|
317
|
-
top: 0,
|
|
318
|
-
bottom: 0,
|
|
319
|
-
left: 0,
|
|
320
|
-
right: 0,
|
|
321
|
-
height: window.visualViewport.height,
|
|
322
|
-
width: window.visualViewport.width,
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
314
|
// #endregion
|
|
326
315
|
// #region Render Methods
|
|
327
316
|
render() {
|
|
328
|
-
const containerClasses = ['container', this.currentDirection];
|
|
317
|
+
const containerClasses = ['container', this.currentDirection, this.align];
|
|
329
318
|
if (this.show)
|
|
330
319
|
containerClasses.push('show');
|
|
320
|
+
if (this.block)
|
|
321
|
+
containerClasses.push('block');
|
|
331
322
|
if (this.mode === 'legacy')
|
|
332
323
|
containerClasses.push('legacy');
|
|
333
|
-
return (h("div", { key: '
|
|
324
|
+
return (h("div", { key: 'c9bbcb53ba8f8bb8879d96cd2f828943dea32b92', ref: el => (this.containerElement = el), class: containerClasses.join(' '), "test-id": "outerContainer", tabIndex: -1, popover: "auto" }, h("div", { key: '4088186bfb7b320fcd8836bcef40b90a685caf9e', ref: el => (this.contentElement = el), class: "content" }, h("slot", { key: '0876866b03a8708a0b401df638d3146263afc141' }))));
|
|
334
325
|
}
|
|
335
326
|
static get is() { return "q2-popover"; }
|
|
336
327
|
static get encapsulation() { return "shadow"; }
|
|
@@ -363,7 +354,8 @@ export class Q2Popover {
|
|
|
363
354
|
},
|
|
364
355
|
"getter": false,
|
|
365
356
|
"setter": false,
|
|
366
|
-
"reflect": true
|
|
357
|
+
"reflect": true,
|
|
358
|
+
"defaultValue": "'left'"
|
|
367
359
|
},
|
|
368
360
|
"block": {
|
|
369
361
|
"type": "boolean",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"q2-popover.js","sourceRoot":"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K;SAC1B,CAAC;IACjB,CAAC;IAYD,aAAa;IACb,yBAAyB;IAEzB,MAAM;QACF,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,IAAI;YAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;YAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5D,OAAO,CACH,4DACI,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,aACzB,gBAAgB,EACxB,QAAQ,EAAE,CAAC,CAAC;YAEZ,4DACI,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,KAAK,EAAC,SAAS;gBAEf,8DAAQ,CACN,CACJ,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ","sourcesContent":["import {\n Component,\n Prop,\n h,\n ComponentInterface,\n Element,\n Watch,\n Method,\n Listen,\n EventEmitter,\n Event,\n State,\n} from '@stencil/core';\nimport { handleDeprecationWarning, waitForNextPaint, isAndroid } from '../../utils';\n\n/**\n * ***********\n * * WARNING *\n * ***********\n * Touching this file obligates you to manually test thoroughly, because Puppeteer can't capture every edgecase.\n *\n * Each of the following Scenarios must be tested on each Device, in each Environment.\n *\n * Scenarios:\n * - Q2 Select non-typeable\n * - Q2 Select typeable\n *\n * Devices:\n * - iOS Safari\n * - Android Chrome\n * - MacOS Safari\n * - Chrome\n * - Firefox\n *\n * Environments:\n * - Standard (Outside of Iframe)\n * - SDK Extension (Inside of Iframe)\n */\n\n@Component({ tag: 'q2-popover', shadow: true, styleUrl: 'q2-popover.scss' })\nexport class Q2Popover implements ComponentInterface {\n // #region Own Properties\n\n containerElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n /**\n * The number of pixels to leave between the popover and the edge of the viewport\n */\n displayBuffer = 10;\n /** remove when Popover API is supported in iOS */\n orientationChanged: boolean = false;\n rootElementRect: DOMRect;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n currentDirection: 'down' | 'up' = undefined;\n\n // remove `show` when Popover API is supported in iOS\n @State()\n show: boolean = false;\n\n // #endregion\n // #region Public Property API\n\n /** Aligns the popover to the left or right side of the control element. */\n @Prop({ reflect: true })\n align: 'left' | 'right';\n\n /** Indicates the popover will match the width of its parent element. */\n @Prop({ reflect: true })\n block: boolean;\n\n /** The element that controls the popover's behavior. */\n @Prop()\n controlElement: HTMLElement;\n\n /**\n * Force the direction of the popover when it opens.\n * If no value is passed, the component will auto-detect the direction based on available space.\n */\n @Prop({ reflect: true })\n direction: 'up' | 'down';\n\n /**\n * Force the maximum height of the popover. This value will be interpreted as pixels.\n * If no value is passed, or the value exceeds available space, the component will auto-detect the maximum height based on available space.\n */\n @Prop()\n maxHeight: number;\n\n /** @deprecated */\n @Prop()\n minHeight: number;\n\n @Prop()\n mode: 'legacy' = null;\n\n /** Controls whether the popover is open or closed. */\n @Prop({ reflect: true, mutable: true })\n open: boolean;\n\n // #endregion\n // #region Events\n\n /**\n * Emitted when the popover is opened or closed.\n */\n @Event()\n popoverStateChanged: EventEmitter<{ open: boolean }>;\n\n // #endregion\n // #region Component Lifecycle Events\n\n disconnectedCallback() {\n this.removeViewportListeners();\n this.containerElement = null;\n this.contentElement = null;\n this.controlElement = null;\n this.rootElementRect = null;\n }\n\n componentDidLoad() {\n this.handleMinHeight();\n if (this.open) this.determinePopDirection();\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('popoverState')\n popoverStateHandler(event: CustomEvent<{ open: boolean }>) {\n const {\n detail: { open },\n } = event;\n if (open === this.open) return;\n\n this.open = open;\n event.stopPropagation();\n }\n\n // #endregion\n // #region Public Methods API\n\n @Method()\n async scrollContainerTo(options: ScrollToOptions) {\n this.containerElement.scrollTo(options);\n }\n\n @Method()\n async toggle() {\n this.open = !this.open;\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('minHeight')\n minHeightProvided() {\n this.handleMinHeight();\n }\n\n @Watch('open')\n async openChanged(open: boolean) {\n this.setRootElement();\n this.popoverStateChanged.emit({ open });\n\n if (open) {\n this.addViewportListeners();\n this.determinePopDirection();\n } else {\n this.removeViewportListeners();\n this.currentDirection = undefined;\n this.show = false;\n await waitForNextPaint();\n this.clearCSSProperties();\n }\n }\n\n // #endregion\n // #region Local Methods\n\n get isModule() {\n const isIframe = window !== window.top;\n const hasPlatformDimensions = Object.keys(window.Tecton?.platformDimensions ?? {}).length > 0;\n return isIframe && hasPlatformDimensions;\n }\n\n get providedDirection(): 'up' | 'down' | undefined {\n const { direction } = this;\n switch (direction) {\n case 'up':\n case 'down':\n return direction;\n default:\n return undefined;\n }\n }\n\n get validatedMaxHeight(): number | undefined {\n const { maxHeight } = this;\n return isNaN(maxHeight) ? undefined : maxHeight;\n }\n\n addViewportListeners() {\n window.addEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.addEventListener('resize', this.viewPortChanged);\n // #region remove when Popover API is supported in iOS\n window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });\n screen?.orientation?.addEventListener('orientationchange', this.viewPortOrientationChanged);\n window.addEventListener('orientationchange', this.viewPortOrientationChanged);\n\n // #endregion\n }\n\n clearCSSProperties() {\n this.containerElement.style.removeProperty('--comp-pop-max-height');\n this.containerElement.style.removeProperty('--comp-pop-top');\n this.containerElement.style.removeProperty('--comp-pop-bottom');\n this.containerElement.style.removeProperty('--comp-pop-left');\n this.containerElement.style.removeProperty('--comp-pop-right');\n this.containerElement.style.removeProperty('--comp-pop-width');\n this.containerElement.style.removeProperty('--comp-pop-opacity');\n }\n\n async determinePopDirection() {\n const { containerElement, controlElement, providedDirection, displayBuffer } = this;\n if (containerElement) containerElement.style.maxHeight = null;\n\n await waitForNextPaint();\n\n const { isModule } = this;\n const { top: controlTop, bottom: controlBottom } = controlElement?.getBoundingClientRect?.() ?? {\n top: 0,\n bottom: 0,\n };\n\n let windowHeight: number;\n let maxSpaceAbove: number;\n let maxSpaceBelow: number;\n\n if (isModule) {\n const { outletOffset = 0, innerHeight = window.innerHeight } = window.Tecton?.platformDimensions || {};\n const distanceToIframeBottom = window.visualViewport.height - controlBottom;\n const viewableSpaceBelow = innerHeight - (outletOffset + controlBottom);\n const isIframeShorterThanWindow = distanceToIframeBottom < viewableSpaceBelow;\n windowHeight = innerHeight;\n // If the top of the module is below the top of the window we just use the controlTop\n // Otherwise we need to add the outletOffset to the controlTop\n maxSpaceAbove = (outletOffset > 0 ? controlTop : controlTop + outletOffset) - displayBuffer;\n maxSpaceBelow = isIframeShorterThanWindow\n ? distanceToIframeBottom - displayBuffer\n : viewableSpaceBelow - displayBuffer;\n } else {\n windowHeight = window.visualViewport.height;\n maxSpaceAbove = controlTop - displayBuffer;\n maxSpaceBelow = windowHeight - controlBottom - displayBuffer;\n }\n\n const directionWithMostSpace: 'up' | 'down' = maxSpaceAbove > maxSpaceBelow ? 'up' : 'down';\n\n // We do not want to update the max height once the popover is open unless the page orientation shifts (resize or mobile use cases)\n const shouldUpdateMaxHeight =\n !containerElement.style.getPropertyValue('--comp-pop-max-height') || this.orientationChanged;\n // we do not want to constantly update the max-height after an orientation change, so we switch this back to false\n this.orientationChanged = false;\n const currentOrDetermineDirection = this.currentDirection || providedDirection || directionWithMostSpace;\n\n switch (currentOrDetermineDirection) {\n case 'up':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceAbove;\n const maxHeight = Math.min(maxSpaceAbove, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('up');\n break;\n case 'down':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceBelow;\n const maxHeight = Math.min(maxSpaceBelow, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('down');\n break;\n default:\n break;\n }\n }\n\n handleMinHeight = () => {\n if (this.minHeight) {\n handleDeprecationWarning(this, 'minHeight', 'prop');\n }\n };\n\n removeViewportListeners() {\n window.removeEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.removeEventListener('resize', this.viewPortChanged);\n // #region remove when Popover API is supported in iOS\n window.removeEventListener('scroll', this.viewPortChanged, { capture: true });\n screen?.orientation?.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n window.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n\n // #endregion\n }\n\n setAbsoluteCSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, align } = this;\n\n if (align === 'right') {\n containerElement.style.setProperty('--comp-pop-right', '0');\n containerElement.style.setProperty('--comp-pop-left', 'unset');\n } else {\n containerElement.style.setProperty('--comp-pop-left', '0');\n containerElement.style.setProperty('--comp-pop-right', 'unset');\n }\n\n if (this.block) {\n containerElement.style.setProperty('--comp-pop-width', '100%');\n }\n\n if (currentDirection === 'up') {\n const controlStyle = getComputedStyle(controlElement);\n const controlSize =\n parseInt(controlStyle.height || '0') +\n parseInt(controlStyle.borderTopWidth || '0') +\n parseInt(controlStyle.borderBottomWidth || '0');\n\n containerElement.style.setProperty('--comp-pop-bottom', `${controlSize}px`);\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n setDirectionAndShow(direction: 'up' | 'down') {\n this.setRootElement();\n // Due to some runtime inconsistency across devices/browsers we need to add one more check here because the\n // popover can be closed between the time the popover is opened and the time the direction is determined\n const isOpen = this.open;\n if (!isOpen) return;\n\n this.currentDirection = direction;\n this.show = true;\n if (this.mode === 'legacy') {\n this.setAbsoluteCSSProperties();\n } else {\n this.setFixedCSSProperties();\n }\n }\n\n setFixedCSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, rootElementRect } = this;\n const {\n top: controlTop,\n bottom: controlBottom,\n left: controlLeft,\n right: controlRight,\n } = controlElement?.getBoundingClientRect?.() ?? {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n };\n const popoverLeft: number = controlLeft - rootElementRect.left;\n\n if (this.block) containerElement.style.setProperty('--comp-pop-width', `${controlElement?.offsetWidth || 0}px`);\n containerElement.style.setProperty('--comp-pop-left', `${popoverLeft}px`);\n containerElement.style.setProperty(\n '--comp-pop-right',\n `${rootElementRect.width + rootElementRect.left - controlRight}px`\n );\n\n if (currentDirection === 'up') {\n if (isAndroid()) {\n containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop}px`);\n } else {\n containerElement.style.setProperty(\n '--comp-pop-bottom',\n `${window.innerHeight - controlTop - (window?.visualViewport.offsetTop ?? 0)}px`\n );\n }\n }\n if (currentDirection === 'down') {\n if (isAndroid()) {\n containerElement.style.setProperty('--comp-pop-top', `${controlBottom}px`);\n } else {\n containerElement.style.setProperty(\n '--comp-pop-top',\n `${controlBottom - rootElementRect.top + (window?.visualViewport.offsetTop ?? 0)}px`\n );\n }\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n setRootElement() {\n let currentElement: HTMLElement = this.hostElement;\n\n while (currentElement && currentElement !== document.documentElement) {\n const computedStyle = window.getComputedStyle(currentElement);\n\n // Check if the element has any styles applied that create a new containg block\n if (\n computedStyle.transform !== 'none' ||\n computedStyle.filter !== 'none' ||\n computedStyle.perspective !== 'none' ||\n computedStyle.containerType !== 'normal' ||\n ['transform', 'perspective', 'filter'].includes(computedStyle.willChange) ||\n ['layout', 'paint', 'strict', 'content'].includes(computedStyle.contain)\n ) {\n this.rootElementRect = currentElement.getBoundingClientRect();\n return;\n }\n\n const rootNode = currentElement.getRootNode();\n const isRootNodeWebComponent =\n typeof ShadowRoot !== 'undefined' &&\n rootNode instanceof ShadowRoot &&\n rootNode.host instanceof HTMLElement;\n if (isRootNodeWebComponent) {\n currentElement = rootNode.host;\n } else {\n currentElement = currentElement.parentElement;\n }\n }\n\n // Return the document's bounding rect if no element is found\n this.rootElementRect = {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n height: window.visualViewport.height,\n width: window.visualViewport.width,\n } as DOMRect;\n }\n\n viewPortChanged = () => {\n if (!this.open) return;\n this.determinePopDirection();\n };\n\n viewPortOrientationChanged = () => {\n this.orientationChanged = true;\n this.viewPortChanged();\n };\n\n // #endregion\n // #region Render Methods\n\n render() {\n const containerClasses = ['container', this.currentDirection];\n if (this.show) containerClasses.push('show');\n if (this.mode === 'legacy') containerClasses.push('legacy');\n\n return (\n <div\n ref={el => (this.containerElement = el)}\n class={containerClasses.join(' ')}\n test-id=\"outerContainer\"\n tabIndex={-1}\n >\n <div\n ref={el => (this.contentElement = el)}\n class=\"content\"\n >\n <slot />\n </div>\n </div>\n );\n }\n\n // #endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"q2-popover.js","sourceRoot":"","sources":["../../../../src/components/q2-popover/q2-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,IAAI,EACJ,CAAC,EAED,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EAEN,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAA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AAI,CAAC,IAAI,KAAK,QAAQ;YAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5D,OAAO,CACH,4DACI,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,aACzB,gBAAgB,EACxB,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAC,MAAM;YAEd,4DACI,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,KAAK,EAAC,SAAS;gBAEf,8DAAQ,CACN,CACJ,CACT,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ","sourcesContent":["import {\n Component,\n Prop,\n h,\n ComponentInterface,\n Element,\n Watch,\n Method,\n Listen,\n EventEmitter,\n Event,\n State,\n} from '@stencil/core';\nimport { handleDeprecationWarning, waitForNextPaint } from '../../utils';\n\n/**\n * ***********\n * * WARNING *\n * ***********\n * Touching this file obligates you to manually test thoroughly, because Puppeteer can't capture every edgecase.\n *\n * Each of the following Scenarios must be tested on each Device, in each Environment.\n *\n * Scenarios:\n * - Q2 Select non-typeable\n * - Q2 Select typeable\n *\n * Devices:\n * - iOS Safari\n * - Android Chrome\n * - MacOS Safari\n * - Chrome\n * - Firefox\n *\n * Environments:\n * - Standard (Outside of Iframe)\n * - SDK Extension (Inside of Iframe)\n */\n\n@Component({ tag: 'q2-popover', shadow: true, styleUrl: 'q2-popover.scss' })\nexport class Q2Popover implements ComponentInterface {\n // #region Own Properties\n\n containerElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n /**\n * The number of pixels to leave between the popover and the edge of the viewport\n */\n displayBuffer = 10;\n orientationChanged: boolean = false;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n currentDirection: 'down' | 'up' = undefined;\n\n // remove `show` when Popover API is supported in iOS\n @State()\n show: boolean = false;\n\n // #endregion\n // #region Public Property API\n\n /** Aligns the popover to the left or right side of the control element. */\n @Prop({ reflect: true })\n align: 'left' | 'right' = 'left';\n\n /** Indicates the popover will match the width of its parent element. */\n @Prop({ reflect: true })\n block: boolean;\n\n /** The element that controls the popover's behavior. */\n @Prop()\n controlElement: HTMLElement;\n\n /**\n * Force the direction of the popover when it opens.\n * If no value is passed, the component will auto-detect the direction based on available space.\n */\n @Prop({ reflect: true })\n direction: 'up' | 'down';\n\n /**\n * Force the maximum height of the popover. This value will be interpreted as pixels.\n * If no value is passed, or the value exceeds available space, the component will auto-detect the maximum height based on available space.\n */\n @Prop()\n maxHeight: number;\n\n /** @deprecated */\n @Prop()\n minHeight: number;\n\n @Prop()\n mode: 'legacy' = null;\n\n /** Controls whether the popover is open or closed. */\n @Prop({ reflect: true, mutable: true })\n open: boolean;\n\n // #endregion\n // #region Events\n\n /**\n * Emitted when the popover is opened or closed.\n */\n @Event()\n popoverStateChanged: EventEmitter<{ open: boolean }>;\n\n // #endregion\n // #region Component Lifecycle Events\n\n disconnectedCallback() {\n this.removeViewportListeners();\n this.containerElement.removeEventListener('toggle', this.handlePopoverToggleEvent);\n this.containerElement = null;\n this.contentElement = null;\n this.controlElement = null;\n }\n\n componentWillLoad() {\n if (!this.supportsPopoverAPI) {\n console.warn(\n 'The Popover API is not supported in this browser. Please update your browser to the latest version. The component will use legacy mode.'\n );\n this.mode = 'legacy';\n }\n }\n\n componentDidLoad() {\n this.handleMinHeight();\n if (this.supportsPopoverAPI) this.containerElement.addEventListener('toggle', this.handlePopoverToggleEvent);\n if (this.open) this.determinePopDirection();\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('popoverState')\n popoverStateHandler(event: CustomEvent<{ open: boolean }>) {\n const {\n detail: { open },\n } = event;\n if (open === this.open) return;\n\n this.open = open;\n event.stopPropagation();\n }\n\n // #endregion\n // #region Public Methods API\n\n @Method()\n async scrollContainerTo(options: ScrollToOptions) {\n this.containerElement.scrollTo(options);\n }\n\n @Method()\n async toggle() {\n this.open = !this.open;\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('minHeight')\n minHeightProvided() {\n this.handleMinHeight();\n }\n\n @Watch('open')\n async openChanged(open: boolean) {\n this.popoverStateChanged.emit({ open });\n\n if (open) {\n this.addViewportListeners();\n this.determinePopDirection();\n } else {\n this.removeViewportListeners();\n this.currentDirection = undefined;\n if (this.mode === 'legacy' || !this.supportsPopoverAPI) {\n this.show = false;\n } else {\n this.containerElement.hidePopover();\n }\n\n await waitForNextPaint();\n this.clearCSSProperties();\n }\n }\n\n // #endregion\n // #region Local Methods\n\n get isModule() {\n const isIframe = window !== window.top;\n const hasPlatformDimensions = Object.keys(window.Tecton?.platformDimensions ?? {}).length > 0;\n return isIframe && hasPlatformDimensions;\n }\n\n get providedDirection(): 'up' | 'down' | undefined {\n const { direction } = this;\n switch (direction) {\n case 'up':\n case 'down':\n return direction;\n default:\n return undefined;\n }\n }\n\n get supportsPopoverAPI(): boolean {\n return Object.hasOwn(HTMLElement.prototype, 'popover');\n }\n\n get validatedMaxHeight(): number | undefined {\n const { maxHeight } = this;\n return isNaN(maxHeight) ? undefined : maxHeight;\n }\n\n addViewportListeners() {\n window.addEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.addEventListener('resize', this.viewPortChanged);\n window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });\n screen?.orientation?.addEventListener('orientationchange', this.viewPortOrientationChanged);\n window.addEventListener('orientationchange', this.viewPortOrientationChanged);\n }\n\n clearCSSProperties() {\n this.containerElement.style.removeProperty('--comp-pop-max-height');\n this.containerElement.style.removeProperty('--comp-pop-top');\n this.containerElement.style.removeProperty('--comp-pop-bottom');\n this.containerElement.style.removeProperty('--comp-pop-left');\n this.containerElement.style.removeProperty('--comp-pop-right');\n this.containerElement.style.removeProperty('--comp-pop-width');\n this.containerElement.style.removeProperty('--comp-pop-opacity');\n }\n\n async determinePopDirection() {\n const { containerElement, controlElement, providedDirection, displayBuffer } = this;\n if (containerElement) containerElement.style.maxHeight = null;\n\n await waitForNextPaint();\n\n const { isModule } = this;\n const { top: controlTop, bottom: controlBottom } = controlElement?.getBoundingClientRect?.() ?? {\n top: 0,\n bottom: 0,\n };\n\n let windowHeight: number;\n let maxSpaceAbove: number;\n let maxSpaceBelow: number;\n\n if (isModule) {\n const { outletOffset = 0, innerHeight = window.innerHeight } = window.Tecton?.platformDimensions || {};\n const distanceToIframeBottom = window.visualViewport.height - controlBottom;\n const viewableSpaceBelow = innerHeight - (outletOffset + controlBottom);\n const isIframeShorterThanWindow = distanceToIframeBottom < viewableSpaceBelow;\n windowHeight = innerHeight;\n // If the top of the module is below the top of the window we just use the controlTop\n // Otherwise we need to add the outletOffset to the controlTop\n maxSpaceAbove = (outletOffset > 0 ? controlTop : controlTop + outletOffset) - displayBuffer;\n maxSpaceBelow = isIframeShorterThanWindow\n ? distanceToIframeBottom - displayBuffer\n : viewableSpaceBelow - displayBuffer;\n } else {\n windowHeight = window.visualViewport.height;\n maxSpaceAbove = controlTop - displayBuffer;\n maxSpaceBelow = windowHeight - controlBottom - displayBuffer;\n }\n\n const directionWithMostSpace: 'up' | 'down' = maxSpaceAbove > maxSpaceBelow ? 'up' : 'down';\n\n // We do not want to update the max height once the popover is open unless the page orientation shifts (resize or mobile use cases)\n const shouldUpdateMaxHeight =\n !containerElement.style.getPropertyValue('--comp-pop-max-height') || this.orientationChanged;\n // we do not want to constantly update the max-height after an orientation change, so we switch this back to false\n this.orientationChanged = false;\n const currentOrDetermineDirection = this.currentDirection || providedDirection || directionWithMostSpace;\n\n switch (currentOrDetermineDirection) {\n case 'up':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceAbove;\n const maxHeight = Math.min(maxSpaceAbove, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('up');\n break;\n case 'down':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceBelow;\n const maxHeight = Math.min(maxSpaceBelow, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('down');\n break;\n default:\n break;\n }\n }\n\n handleMinHeight = () => {\n if (this.minHeight) {\n handleDeprecationWarning(this, 'minHeight', 'prop');\n }\n };\n\n handlePopoverToggleEvent = (event: ToggleEvent) => {\n this.popoverStateChanged.emit({ open: event.newState === 'open' });\n };\n\n removeViewportListeners() {\n window.removeEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.removeEventListener('resize', this.viewPortChanged);\n window.removeEventListener('scroll', this.viewPortChanged, { capture: true });\n screen?.orientation?.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n window.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n }\n\n setAbsoluteCSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, align } = this;\n\n if (align === 'right') {\n containerElement.style.setProperty('--comp-pop-right', '0');\n containerElement.style.setProperty('--comp-pop-left', 'unset');\n } else {\n containerElement.style.setProperty('--comp-pop-left', '0');\n containerElement.style.setProperty('--comp-pop-right', 'unset');\n }\n\n if (this.block) {\n containerElement.style.setProperty('--comp-pop-width', '100%');\n }\n\n if (currentDirection === 'up') {\n const controlStyle = getComputedStyle(controlElement);\n const controlSize =\n parseInt(controlStyle.height || '0') +\n parseInt(controlStyle.borderTopWidth || '0') +\n parseInt(controlStyle.borderBottomWidth || '0');\n\n containerElement.style.setProperty('--comp-pop-bottom', `${controlSize}px`);\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n setDirectionAndShow(direction: 'up' | 'down') {\n // Due to some runtime inconsistency across devices/browsers we need to add one more check here because the\n // popover can be closed between the time the popover is opened and the time the direction is determined\n const isOpen = this.open;\n if (!isOpen) return;\n\n this.currentDirection = direction;\n if (this.mode === 'legacy' || !this.supportsPopoverAPI) {\n this.show = true;\n this.setAbsoluteCSSProperties();\n } else {\n this.setPopoverAPICSSProperties();\n this.containerElement.showPopover();\n }\n }\n\n setPopoverAPICSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, isModule, align } = this;\n const {\n top: controlTop,\n bottom: controlBottom,\n left: controlLeft,\n right: controlRight,\n } = controlElement?.getBoundingClientRect?.() ?? {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n };\n\n const popoverLeft: number = controlLeft;\n const popoverRight: number = window?.visualViewport?.width - controlRight;\n\n if (align === 'right') {\n containerElement.style.setProperty('--comp-pop-right', `${popoverRight - window.scrollX}px`);\n containerElement.style.setProperty('--comp-pop-left', 'unset');\n } else {\n containerElement.style.setProperty('--comp-pop-left', `${popoverLeft + window.scrollX}px`);\n containerElement.style.setProperty('--comp-pop-right', 'unset');\n }\n\n if (this.block) containerElement.style.setProperty('--comp-pop-width', `${controlElement?.offsetWidth || 0}px`);\n\n if (currentDirection === 'up') {\n if (isModule) {\n containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop}px`);\n } else {\n containerElement.style.setProperty(\n '--comp-pop-bottom',\n `${window.innerHeight - controlTop - window?.visualViewport?.offsetTop - window.scrollY}px`\n );\n }\n }\n\n if (currentDirection === 'down') {\n if (isModule) {\n containerElement.style.setProperty('--comp-pop-top', `${controlBottom}px`);\n } else {\n containerElement.style.setProperty(\n '--comp-pop-top',\n `${controlBottom + (window?.visualViewport?.offsetTop ?? 0) + window.scrollY}px`\n );\n }\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n viewPortChanged = () => {\n if (!this.open) return;\n this.determinePopDirection();\n };\n\n viewPortOrientationChanged = () => {\n this.orientationChanged = true;\n this.viewPortChanged();\n };\n\n // #endregion\n // #region Render Methods\n\n render() {\n const containerClasses = ['container', this.currentDirection, this.align];\n if (this.show) containerClasses.push('show');\n if (this.block) containerClasses.push('block');\n if (this.mode === 'legacy') containerClasses.push('legacy');\n\n return (\n <div\n ref={el => (this.containerElement = el)}\n class={containerClasses.join(' ')}\n test-id=\"outerContainer\"\n tabIndex={-1}\n popover=\"auto\"\n >\n <div\n ref={el => (this.contentElement = el)}\n class=\"content\"\n >\n <slot />\n </div>\n </div>\n );\n }\n\n // #endregion\n}\n"]}
|
|
@@ -148,7 +148,7 @@ export class Q2RelativeTime {
|
|
|
148
148
|
// #region Render Methods
|
|
149
149
|
render() {
|
|
150
150
|
const { shouldShow, displayedMessage } = this;
|
|
151
|
-
return h(Fragment, { key: '
|
|
151
|
+
return h(Fragment, { key: '67e5d3fb5bef2fe8abac62da9888700fb6b789dd' }, shouldShow ? h("time", { dateTime: displayedMessage }, displayedMessage) : null);
|
|
152
152
|
}
|
|
153
153
|
static get is() { return "q2-relative-time"; }
|
|
154
154
|
static get encapsulation() { return "shadow"; }
|
|
@@ -71,7 +71,7 @@ export class Q2ResizeObserver {
|
|
|
71
71
|
// #endregion
|
|
72
72
|
// #region Render Methods
|
|
73
73
|
render() {
|
|
74
|
-
return h("slot", { key: '
|
|
74
|
+
return h("slot", { key: '093aaf3b1503ff3de3a0240b992497492afd6df1', onSlotchange: this.handleSlotChange });
|
|
75
75
|
}
|
|
76
76
|
static get is() { return "q2-resize-observer"; }
|
|
77
77
|
static get encapsulation() { return "shadow"; }
|
|
@@ -180,9 +180,9 @@ export class Q2Section {
|
|
|
180
180
|
wrapperClasses.push('is-transitioning');
|
|
181
181
|
}
|
|
182
182
|
const showDefaultHeader = !this.hasYieldedHeader && !!this.label;
|
|
183
|
-
return (h("section", { key: '
|
|
183
|
+
return (h("section", { key: '50128c435b407661e87390b4a4cda567f1784ad1', class: "wrapper" }, h("header", { key: 'b1e4f5da065e2ae0a0310547020def177819f14e', class: hasHeader ? 'has-header' : '' }, h("div", { key: 'a0cc7819d695de252cce4c36c408a10474c120b2', class: "header-content", id: this.titleId, onClick: this.collapsible && this.onHeaderClick }, showDefaultHeader && h("h2", { key: 'fe42b0f36e70ab9cb03b07574a75c4f46681f031', class: "title" }, loc(this.label)), h("div", { key: '047178d274fcc6907a9aa81edc66bd285c00dc8c', ref: el => (this.headerSlotWrapper = el), class: "header-slot-wrapper" }, h("slot", { key: '63fd4ef8219d436425bd8477e021518e72989587', ref: (el) => (this.headerSlot = el), name: "q2-section-header" }))), this.collapsible && !this.noCollapseIcon && (h("q2-btn", { key: '3517c005e8a7bd6ba92fb7333c91a7d4f15c755c', label: loc(this.label || 'tecton.element.section.defaultToggleLabel'), ariaExpanded: `${!!this.expanded}`, ariaControls: this.contentId, "test-id": "toggleButton", "hide-label": true, onClick: this.onHeaderClick }, h("q2-icon", { key: '4a33e0265677b621f71dd7587e3c0bb270b29707', type: "chevron-up" })))), h("div", { key: '1cba7d25a2f9e89e8a67715700f6ded50c25ef15', class: wrapperClasses.join(' '), id: this.contentId, "aria-labelledby": this.titleId, role: "region", onTransitionEnd: this.onTransitionEnd, style: this.collapsible && {
|
|
184
184
|
height: this.contentHeight,
|
|
185
|
-
} }, h("div", { key: '
|
|
185
|
+
} }, h("div", { key: '8c9ef9733c45987fbf25292414254765910ec7f6', ref: el => (this.contentContainer = el), class: "content", tabindex: "-1" }, h("slot", { key: 'ae56752db16f4365c2639529e0890695b3f15dfd', ref: (el) => (this.contentSlot = el) })))));
|
|
186
186
|
}
|
|
187
187
|
static get is() { return "q2-section"; }
|
|
188
188
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h, } from "@stencil/core";
|
|
2
|
-
import { createGuid, handleAriaLabel, isEventFromElement, isRelatedTargetWithinHost, loc, overrideFocus, waitForNextPaint, } from "../../utils";
|
|
1
|
+
import { h, Fragment, } from "@stencil/core";
|
|
2
|
+
import { createGuid, handleAriaLabel, isEventFromElement, isMobile, isRelatedTargetWithinHost, loc, overrideFocus, waitForNextPaint, } from "../../utils";
|
|
3
3
|
import { shouldShowActionSheet, showActionSheetList } from "../../utils/action-sheet";
|
|
4
4
|
/**
|
|
5
5
|
* @slot popover-top - An optional slot to display custom content persistently at the top of the popover. This is **not** compatible with the action sheet workflow.
|
|
@@ -9,8 +9,9 @@ import { shouldShowActionSheet, showActionSheetList } from "../../utils/action-s
|
|
|
9
9
|
export class Q2Select {
|
|
10
10
|
constructor() {
|
|
11
11
|
var _a;
|
|
12
|
-
|
|
12
|
+
// #region Own Properties
|
|
13
13
|
this.guid = createGuid();
|
|
14
|
+
this.scheduledAfterRender = [];
|
|
14
15
|
// #endregion
|
|
15
16
|
// #region State Properties
|
|
16
17
|
this.hasCustomDisplay = false;
|
|
@@ -75,6 +76,48 @@ export class Q2Select {
|
|
|
75
76
|
if (target.localName !== 'click-elsewhere')
|
|
76
77
|
return;
|
|
77
78
|
event.stopPropagation();
|
|
79
|
+
const { popoverElement } = this;
|
|
80
|
+
if (!popoverElement)
|
|
81
|
+
return;
|
|
82
|
+
popoverElement.open = false;
|
|
83
|
+
};
|
|
84
|
+
this.destroyEventListeners = () => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (!isMobile())
|
|
87
|
+
return;
|
|
88
|
+
(_a = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || _a === void 0 ? void 0 : _a.removeEventListener('change', this.handleOrientationChange);
|
|
89
|
+
window.removeEventListener('resize', this.handleOrientationChange);
|
|
90
|
+
visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.removeEventListener('resize', this.handleOrientationChange);
|
|
91
|
+
};
|
|
92
|
+
this.handleOrientationChange = () => {
|
|
93
|
+
var _a, _b, _c;
|
|
94
|
+
if (!isMobile())
|
|
95
|
+
return;
|
|
96
|
+
let isLandscape;
|
|
97
|
+
if (this.isModule) {
|
|
98
|
+
isLandscape = (_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.platformDimensions.orientationType.includes('landscape');
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
isLandscape = (_c = (_b = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.includes('landscape');
|
|
102
|
+
}
|
|
103
|
+
if (isLandscape && this.searchable)
|
|
104
|
+
this.searchable = false;
|
|
105
|
+
if (!isLandscape)
|
|
106
|
+
this.searchable = this.originalSearchable;
|
|
107
|
+
};
|
|
108
|
+
this.initEventListeners = () => {
|
|
109
|
+
var _a;
|
|
110
|
+
if (!isMobile())
|
|
111
|
+
return;
|
|
112
|
+
(_a = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || _a === void 0 ? void 0 : _a.addEventListener('change', this.handleOrientationChange);
|
|
113
|
+
window.addEventListener('resize', this.handleOrientationChange);
|
|
114
|
+
visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.addEventListener('resize', this.handleOrientationChange);
|
|
115
|
+
};
|
|
116
|
+
this.initMutationObserver = () => {
|
|
117
|
+
const observer = new MutationObserver(this.onMutationObserved);
|
|
118
|
+
observer.observe(this.hostElement, { childList: true, subtree: true });
|
|
119
|
+
this.mutationObserver = observer;
|
|
120
|
+
this.onMutationObserved();
|
|
78
121
|
};
|
|
79
122
|
this.inputBlurHandler = () => {
|
|
80
123
|
this.inputFocused = false;
|
|
@@ -213,17 +256,18 @@ export class Q2Select {
|
|
|
213
256
|
var _a;
|
|
214
257
|
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
215
258
|
this.mutationObserver = null;
|
|
259
|
+
this.destroyEventListeners();
|
|
216
260
|
}
|
|
217
261
|
componentWillLoad() {
|
|
262
|
+
this.originalSearchable = this.searchable;
|
|
218
263
|
handleAriaLabel(this);
|
|
264
|
+
this.handleOrientationChange();
|
|
219
265
|
this.buildStructuredSelectedOptions();
|
|
220
266
|
this.handleMultilineOptionsUpdate(this.multilineOptions, false);
|
|
221
267
|
}
|
|
222
268
|
componentDidLoad() {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
this.mutationObserver = observer;
|
|
226
|
-
this.onMutationObserved();
|
|
269
|
+
this.initMutationObserver();
|
|
270
|
+
this.initEventListeners();
|
|
227
271
|
overrideFocus(this.hostElement);
|
|
228
272
|
setTimeout(() => this.checkSelectedDisplay(), 0);
|
|
229
273
|
this.setCustomLabel();
|
|
@@ -307,6 +351,10 @@ export class Q2Select {
|
|
|
307
351
|
keydownHandler(event) {
|
|
308
352
|
this.inputKeydownHandler(event);
|
|
309
353
|
}
|
|
354
|
+
popoverStateChanged({ detail: { open } }) {
|
|
355
|
+
if (this.open !== open)
|
|
356
|
+
this.open = open;
|
|
357
|
+
}
|
|
310
358
|
// #endregion
|
|
311
359
|
// #region Public Methods API
|
|
312
360
|
/**
|
|
@@ -410,9 +458,6 @@ export class Q2Select {
|
|
|
410
458
|
}
|
|
411
459
|
// #endregion
|
|
412
460
|
// #region Local Methods
|
|
413
|
-
get inputId() {
|
|
414
|
-
return `select-guid-${this.guid}`;
|
|
415
|
-
}
|
|
416
461
|
get badgeValue() {
|
|
417
462
|
var _a, _b;
|
|
418
463
|
if (!this.multiple)
|
|
@@ -439,6 +484,15 @@ export class Q2Select {
|
|
|
439
484
|
var _a, _b;
|
|
440
485
|
return (_b = (_a = this.inputField) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.input-field');
|
|
441
486
|
}
|
|
487
|
+
get inputId() {
|
|
488
|
+
return `select-guid-${this.guid}`;
|
|
489
|
+
}
|
|
490
|
+
get isModule() {
|
|
491
|
+
var _a, _b;
|
|
492
|
+
const isIframe = window !== window.top;
|
|
493
|
+
const hasPlatformDimensions = Object.keys((_b = (_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.platformDimensions) !== null && _b !== void 0 ? _b : {}).length > 0;
|
|
494
|
+
return isIframe && hasPlatformDimensions;
|
|
495
|
+
}
|
|
442
496
|
get optionElements() {
|
|
443
497
|
return Array.from(this.hostElement.querySelectorAll('q2-option'));
|
|
444
498
|
}
|
|
@@ -504,14 +558,6 @@ export class Q2Select {
|
|
|
504
558
|
'');
|
|
505
559
|
}
|
|
506
560
|
}
|
|
507
|
-
setCustomLabel() {
|
|
508
|
-
var _a;
|
|
509
|
-
const customLabel = this.hostElement.querySelector('[slot="label"]');
|
|
510
|
-
if (customLabel) {
|
|
511
|
-
(_a = this.inputField) === null || _a === void 0 ? void 0 : _a.appendChild(customLabel.cloneNode(true));
|
|
512
|
-
this.hostElement.removeChild(customLabel);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
561
|
checkSelectedDisplay() {
|
|
516
562
|
// This prevents an undefined property error when the spec tests are run
|
|
517
563
|
try {
|
|
@@ -613,6 +659,14 @@ export class Q2Select {
|
|
|
613
659
|
this.optionList.setActiveElement(null);
|
|
614
660
|
this.open = true;
|
|
615
661
|
}
|
|
662
|
+
setCustomLabel() {
|
|
663
|
+
var _a;
|
|
664
|
+
const customLabel = this.hostElement.querySelector('[slot="label"]');
|
|
665
|
+
if (customLabel) {
|
|
666
|
+
(_a = this.inputField) === null || _a === void 0 ? void 0 : _a.appendChild(customLabel.cloneNode(true));
|
|
667
|
+
this.hostElement.removeChild(customLabel);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
616
670
|
setStatusMessage(message) {
|
|
617
671
|
clearTimeout(this.statusMessageTimer);
|
|
618
672
|
this.statusMessage = '';
|
|
@@ -645,6 +699,14 @@ export class Q2Select {
|
|
|
645
699
|
renderOptionsDropdown() {
|
|
646
700
|
return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.innerInputContainer, open: this.open, "max-height": this.popoverMaxHeight, minHeight: this.popoverMinHeight, direction: this.popDirection, mode: this.popoverMode || undefined, block: true }, h("div", { class: "popover-content" }, h("q2-option-list", { onPopoverState: this.onPopoverState, ref: el => (this.optionList = el), type: "listbox", id: "option-list", "show-selected": this.showSelected, label: this.listLabel, multiple: this.multiple, selectedOptions: this.structuredSelectedOptions, onChange: this.onOptionListChange }, h("slot", null)), h("div", { class: "popover-top-container", ref: el => (this.popoverTopContainer = el), hidden: !this.multiple && !this.hasPopoverTop, tabindex: "-1" }, h("slot", { name: "popover-top" }), this.multiple && this.renderVisibilityToggle())), h("div", { class: "popover-bottom-container", hidden: !this.hasPopoverBottom, tabindex: "-1" }, h("slot", { name: "popover-bottom" }))));
|
|
647
701
|
}
|
|
702
|
+
renderSelectField() {
|
|
703
|
+
var _a;
|
|
704
|
+
return (h(Fragment, null, h("div", { "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("q2-input", { ref: el => (this.inputField = el), class: "q2-select-input", label: (this.label && loc(this.label)) || '', value: this.selectedDisplay, clearable: (this.clearable && (!!this.value || !!((_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length))) || undefined, errors: (Array.isArray(this.errors) &&
|
|
705
|
+
this.errors.length > 0 &&
|
|
706
|
+
this.errors.map(error => loc(error))) ||
|
|
707
|
+
(this.invalid && ['tecton.element.select.invalid']) ||
|
|
708
|
+
[], disabled: this.disabled, optional: this.optional, readonly: !!this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${this.open}`, ariaControls: "option-list", ariaHaspopup: "listbox", "test-id": "toggleDropdown", "hide-messages": true, iconRight: "chevron-down", onClick: this.inputClickHandler, onInput: this.inputInputHandler, onKeyDown: this.inputKeydownHandler, onFocus: this.inputFocusHandler, onBlur: this.inputBlurHandler, onChange: this.inputChangeHandler, badgeValue: this.badgeValue, badgeTheme: this.inputFocused ? 'primary' : undefined, _role: "combobox", _preventEntry: !this.searchable }, this.renderCustomDisplay()), h("div", { class: "custom-display-content", hidden: !this.hasCustomDisplay || !!this.searchText, onClick: this.onCustomDisplayClick }, h("slot", { name: "q2-select-display" })), this.renderOptionsDropdown()));
|
|
709
|
+
}
|
|
648
710
|
renderVisibilityToggle() {
|
|
649
711
|
var _a, _b;
|
|
650
712
|
const selectedOptionsCount = (_b = (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
@@ -654,12 +716,7 @@ export class Q2Select {
|
|
|
654
716
|
]), checked: showSelected, "test-id": "selectedOptionsButton", onClick: this.showSelectedOptions, onKeyDown: this.visibilityToggleKeyDown }), h("label", { htmlFor: "selected" }, loc('tecton.element.select.multiHeader.selected', [selectedOptionsCount]))))));
|
|
655
717
|
}
|
|
656
718
|
render() {
|
|
657
|
-
|
|
658
|
-
return (h("click-elsewhere", { key: '9012638fc034ef91325cc8fd61f5f7bf61ab840f', class: this.wrapperClasses, onChange: this.clickedElsewhere }, h("div", { key: 'debfae57bbd0e979c81ad525fb750821bf25af73', "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("q2-input", { key: 'bf2ec67e3fd0ee4a806898bd3eae337eaf245020', ref: el => (this.inputField = el), class: "q2-select-input", label: (this.label && loc(this.label)) || '', value: this.selectedDisplay, clearable: (this.clearable && (!!this.value || !!((_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length))) || undefined, errors: (Array.isArray(this.errors) &&
|
|
659
|
-
this.errors.length > 0 &&
|
|
660
|
-
this.errors.map(error => loc(error))) ||
|
|
661
|
-
(this.invalid && ['tecton.element.select.invalid']) ||
|
|
662
|
-
[], disabled: this.disabled, optional: this.optional, readonly: !!this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${this.open}`, ariaControls: "option-list", ariaHaspopup: "listbox", "test-id": "toggleDropdown", "hide-messages": true, iconRight: "chevron-down", onClick: this.inputClickHandler, onInput: this.inputInputHandler, onKeyDown: this.inputKeydownHandler, onFocus: this.inputFocusHandler, onBlur: this.inputBlurHandler, onChange: this.inputChangeHandler, badgeValue: this.badgeValue, badgeTheme: this.inputFocused ? 'primary' : undefined, _role: "combobox", _preventEntry: !this.searchable }, this.renderCustomDisplay()), h("div", { key: '9ef1609d3dbe4f364298e0e960dfc8baa561dc4f', class: "custom-display-content", hidden: !this.hasCustomDisplay || !!this.searchText, onClick: this.onCustomDisplayClick }, h("slot", { key: 'aaa9302d930c0c52e80cd1765bfc94cefd7d30b5', name: "q2-select-display" })), this.renderOptionsDropdown()));
|
|
719
|
+
return (h("click-elsewhere", { key: '6b0afb6d5ce0f7233266a7b808714e33a1ccf243', class: this.wrapperClasses, onChange: this.clickedElsewhere }, this.renderSelectField()));
|
|
663
720
|
}
|
|
664
721
|
static get is() { return "q2-select"; }
|
|
665
722
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1055,7 +1112,7 @@ export class Q2Select {
|
|
|
1055
1112
|
"searchable": {
|
|
1056
1113
|
"type": "boolean",
|
|
1057
1114
|
"attribute": "searchable",
|
|
1058
|
-
"mutable":
|
|
1115
|
+
"mutable": true,
|
|
1059
1116
|
"complexType": {
|
|
1060
1117
|
"original": "boolean",
|
|
1061
1118
|
"resolved": "boolean",
|
|
@@ -1321,7 +1378,14 @@ export class Q2Select {
|
|
|
1321
1378
|
"target": undefined,
|
|
1322
1379
|
"capture": false,
|
|
1323
1380
|
"passive": false
|
|
1381
|
+
}, {
|
|
1382
|
+
"name": "popoverStateChanged",
|
|
1383
|
+
"method": "popoverStateChanged",
|
|
1384
|
+
"target": undefined,
|
|
1385
|
+
"capture": false,
|
|
1386
|
+
"passive": false
|
|
1324
1387
|
}];
|
|
1325
1388
|
}
|
|
1326
1389
|
}
|
|
1390
|
+
// #endregion
|
|
1327
1391
|
//# sourceMappingURL=q2-select.js.map
|