q2-tecton-elements 1.56.3 → 1.56.4
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 +263 -217
- package/dist/cjs/{index-99667782.js → index-905f4c87.js} +1 -5
- package/dist/cjs/index-905f4c87.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-group.cjs.entry.js +2 -2
- package/dist/cjs/q2-action-sheet.cjs.entry.js +2 -2
- package/dist/cjs/q2-avatar.cjs.entry.js +1 -1
- package/dist/cjs/q2-badge_7.cjs.entry.js +4 -4
- package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
- package/dist/cjs/q2-card.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +3 -3
- package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-area.cjs.entry.js +2 -2
- package/dist/cjs/q2-chart-bar.cjs.entry.js +2 -2
- package/dist/cjs/q2-chart-donut.cjs.entry.js +2 -2
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/q2-currency.cjs.entry.js +1 -1
- package/dist/cjs/q2-data-table.cjs.entry.js +1 -1
- package/dist/cjs/q2-detail.cjs.entry.js +2 -2
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +25 -22
- package/dist/cjs/q2-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
- package/dist/cjs/q2-example.cjs.entry.js +1 -1
- package/dist/cjs/q2-file-picker.cjs.entry.js +1 -1
- package/dist/cjs/q2-form.cjs.entry.js +1 -1
- package/dist/cjs/q2-formatted-text.cjs.entry.js +1 -1
- package/dist/cjs/q2-item_3.cjs.entry.js +3 -3
- package/dist/cjs/q2-legend.cjs.entry.js +1 -1
- package/dist/cjs/q2-loc.cjs.entry.js +1 -1
- package/dist/cjs/q2-message.cjs.entry.js +2 -2
- package/dist/cjs/q2-modal.cjs.entry.js +2 -2
- package/dist/cjs/q2-month-picker.cjs.entry.js +3 -3
- package/dist/cjs/q2-optgroup.cjs.entry.js +2 -2
- package/dist/cjs/q2-option-list_2.cjs.entry.js +49 -62
- package/dist/cjs/q2-option-list_2.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-option.cjs.entry.js +1 -1
- package/dist/cjs/q2-pagination.cjs.entry.js +4 -4
- package/dist/cjs/q2-pill.cjs.entry.js +2 -2
- package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-radio.cjs.entry.js +1 -1
- package/dist/cjs/q2-relative-time.cjs.entry.js +2 -2
- package/dist/cjs/q2-resize-observer.cjs.entry.js +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +3 -3
- package/dist/cjs/q2-select.cjs.entry.js +81 -11
- package/dist/cjs/q2-select.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper-vertical.cjs.entry.js +2 -2
- package/dist/cjs/q2-stepper.cjs.entry.js +2 -2
- package/dist/cjs/q2-tag.cjs.entry.js +2 -2
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +2 -2
- package/dist/cjs/q2-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/tecton-tab-pane.cjs.entry.js +2 -2
- 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-calendar/test/q2-calendar-test.e2e.js +2 -2
- package/dist/collection/components/q2-calendar/test/q2-calendar-test.e2e.js.map +1 -1
- 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-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 +25 -21
- package/dist/collection/components/q2-dropdown/q2-dropdown.js.map +1 -1
- package/dist/collection/components/q2-dropdown/test/q2-dropdown-test.e2e.js +34 -32
- package/dist/collection/components/q2-dropdown/test/q2-dropdown-test.e2e.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-pagination/test/q2-pagination-test.e2e.js +1 -0
- package/dist/collection/components/q2-pagination/test/q2-pagination-test.e2e.js.map +1 -1
- 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 +50 -62
- package/dist/collection/components/q2-popover/q2-popover.js.map +1 -1
- package/dist/collection/components/q2-popover/test/q2-popover-test.e2e.js +1 -34
- package/dist/collection/components/q2-popover/test/q2-popover-test.e2e.js.map +1 -1
- package/dist/collection/components/q2-popover/test/q2-popover-test.spec.js +743 -435
- package/dist/collection/components/q2-popover/test/q2-popover-test.spec.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 +96 -14
- package/dist/collection/components/q2-select/q2-select.js.map +1 -1
- package/dist/collection/components/q2-select/test/q2-select-test.spec.js +327 -0
- package/dist/collection/components/q2-select/test/q2-select-test.spec.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-tag/test/q2-tag-test.e2e.js +5 -0
- package/dist/collection/components/q2-tag/test/q2-tag-test.e2e.js.map +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-currency.js +1 -1
- package/dist/components/q2-detail.js +1 -1
- package/dist/components/q2-dropdown.js +24 -21
- 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 +49 -62
- 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 +84 -14
- 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/{index-c215e8ef.js → index-f2a66217.js} +2 -5
- package/dist/esm/index-f2a66217.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-group.entry.js +2 -2
- package/dist/esm/q2-action-sheet.entry.js +2 -2
- package/dist/esm/q2-avatar.entry.js +1 -1
- package/dist/esm/q2-badge_7.entry.js +4 -4
- package/dist/esm/q2-calendar.entry.js +1 -1
- package/dist/esm/q2-card.entry.js +1 -1
- package/dist/esm/q2-carousel-pane.entry.js +3 -3
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-chart-area.entry.js +2 -2
- package/dist/esm/q2-chart-bar.entry.js +2 -2
- package/dist/esm/q2-chart-donut.entry.js +2 -2
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +1 -1
- package/dist/esm/q2-currency.entry.js +1 -1
- package/dist/esm/q2-data-table.entry.js +1 -1
- package/dist/esm/q2-detail.entry.js +2 -2
- package/dist/esm/q2-dropdown-item.entry.js +1 -1
- package/dist/esm/q2-dropdown.entry.js +25 -22
- package/dist/esm/q2-dropdown.entry.js.map +1 -1
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-example.entry.js +1 -1
- package/dist/esm/q2-file-picker.entry.js +1 -1
- package/dist/esm/q2-form.entry.js +1 -1
- package/dist/esm/q2-formatted-text.entry.js +1 -1
- package/dist/esm/q2-item_3.entry.js +3 -3
- package/dist/esm/q2-legend.entry.js +1 -1
- package/dist/esm/q2-loc.entry.js +1 -1
- package/dist/esm/q2-message.entry.js +2 -2
- package/dist/esm/q2-modal.entry.js +2 -2
- package/dist/esm/q2-month-picker.entry.js +3 -3
- package/dist/esm/q2-optgroup.entry.js +2 -2
- package/dist/esm/q2-option-list_2.entry.js +49 -62
- package/dist/esm/q2-option-list_2.entry.js.map +1 -1
- package/dist/esm/q2-option.entry.js +1 -1
- package/dist/esm/q2-pagination.entry.js +4 -4
- package/dist/esm/q2-pill.entry.js +2 -2
- package/dist/esm/q2-radio-group.entry.js +1 -1
- package/dist/esm/q2-radio.entry.js +1 -1
- package/dist/esm/q2-relative-time.entry.js +2 -2
- package/dist/esm/q2-resize-observer.entry.js +1 -1
- package/dist/esm/q2-section.entry.js +3 -3
- package/dist/esm/q2-select.entry.js +82 -12
- package/dist/esm/q2-select.entry.js.map +1 -1
- package/dist/esm/q2-stepper-pane.entry.js +1 -1
- package/dist/esm/q2-stepper-vertical.entry.js +2 -2
- package/dist/esm/q2-stepper.entry.js +2 -2
- package/dist/esm/q2-tag.entry.js +2 -2
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +2 -2
- package/dist/esm/q2-tooltip.entry.js +1 -1
- package/dist/esm/tecton-tab-pane.entry.js +2 -2
- package/dist/q2-tecton-elements/{index-c215e8ef.js → index-f2a66217.js} +2 -6
- package/dist/q2-tecton-elements/index-f2a66217.js.map +1 -0
- package/dist/q2-tecton-elements/q2-action-group.entry.js +4 -4
- package/dist/q2-tecton-elements/q2-action-sheet.entry.js +9 -9
- package/dist/q2-tecton-elements/q2-avatar.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-badge_7.entry.js +42 -42
- package/dist/q2-tecton-elements/q2-calendar.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-card.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-carousel-pane.entry.js +21 -21
- package/dist/q2-tecton-elements/q2-carousel.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-chart-area.entry.js +3 -3
- package/dist/q2-tecton-elements/q2-chart-bar.entry.js +80 -80
- package/dist/q2-tecton-elements/q2-chart-donut.entry.js +7 -7
- package/dist/q2-tecton-elements/q2-checkbox-group.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-checkbox.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-currency.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-data-table.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-detail.entry.js +39 -39
- package/dist/q2-tecton-elements/q2-dropdown-item.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-dropdown.entry.js +79 -75
- package/dist/q2-tecton-elements/q2-dropdown.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-editable-field.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-example.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-file-picker.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-form.entry.js +10 -10
- package/dist/q2-tecton-elements/q2-formatted-text.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-item_3.entry.js +19 -19
- package/dist/q2-tecton-elements/q2-legend.entry.js +2 -2
- package/dist/q2-tecton-elements/q2-loc.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-message.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-modal.entry.js +24 -24
- package/dist/q2-tecton-elements/q2-month-picker.entry.js +67 -67
- package/dist/q2-tecton-elements/q2-optgroup.entry.js +8 -8
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js +236 -241
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-option.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-pagination.entry.js +42 -42
- package/dist/q2-tecton-elements/q2-pill.entry.js +14 -14
- package/dist/q2-tecton-elements/q2-radio-group.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-radio.entry.js +13 -13
- package/dist/q2-tecton-elements/q2-relative-time.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-resize-observer.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-section.entry.js +23 -23
- package/dist/q2-tecton-elements/q2-select.entry.js +146 -88
- package/dist/q2-tecton-elements/q2-select.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-stepper-pane.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-stepper-vertical.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-stepper.entry.js +21 -21
- package/dist/q2-tecton-elements/q2-tag.entry.js +6 -6
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-textarea.entry.js +3 -3
- package/dist/q2-tecton-elements/q2-tooltip.entry.js +1 -1
- package/dist/q2-tecton-elements/tecton-tab-pane.entry.js +6 -6
- package/dist/types/components/q2-dropdown/q2-dropdown.d.ts +6 -4
- package/dist/types/components/q2-popover/q2-popover.d.ts +4 -4
- package/dist/types/components/q2-select/q2-select.d.ts +18 -0
- package/package.json +3 -3
- package/dist/cjs/index-99667782.js.map +0 -1
- package/dist/esm/index-c215e8ef.js.map +0 -1
- package/dist/q2-tecton-elements/index-c215e8ef.js.map +0 -1
|
@@ -92,12 +92,12 @@ export class Q2CarouselPane {
|
|
|
92
92
|
// #region Render Methods
|
|
93
93
|
render() {
|
|
94
94
|
const { label } = this;
|
|
95
|
-
return (h(Host, { key: '
|
|
95
|
+
return (h(Host, { key: '1a77499ae888c697346be0414c6df45f3975445e', class: this.generatePaneClass(this.currentPaneIndex), tabIndex: this.isActivePane ? 0 : -1, role: "group", "aria-roledescription": "slide", "aria-hidden": this.isActivePane ? undefined : 'true', "aria-label": label
|
|
96
96
|
? loc(label)
|
|
97
97
|
: loc('tecton.element.carousel.itemDescription', [
|
|
98
98
|
(this.currentPaneIndex + 1).toString(),
|
|
99
99
|
(this.siblingCount || 0).toString(),
|
|
100
|
-
]), onClick: this.paneClicked }, h("article", { key: '
|
|
100
|
+
]), onClick: this.paneClicked }, h("article", { key: '98132941cf996e6fe0df1bc585502eee86b959c2', class: "q2-carousel-pane-main-content" }, h("slot", { key: '59583e92be8847d63a913e4600ca00e85331a738' }))));
|
|
101
101
|
}
|
|
102
102
|
static get is() { return "q2-carousel-pane"; }
|
|
103
103
|
static get originalStyleUrls() {
|
|
@@ -220,7 +220,7 @@ export class Q2ChartArea {
|
|
|
220
220
|
// #endregion
|
|
221
221
|
// #region Render Methods
|
|
222
222
|
render() {
|
|
223
|
-
return (h("div", { key: '
|
|
223
|
+
return (h("div", { key: 'f7ea47a03ec439bbf8d3eb81887bc4831c71f033', class: "container" }, h("div", { key: 'a7389d4a91cedb3dcfdaebcd5f1559aa96b5d26c', ref: el => (this.chartContainer = el), class: "chart-container", role: "img", "test-id": "areaChartContainer" })));
|
|
224
224
|
}
|
|
225
225
|
static get is() { return "q2-chart-area"; }
|
|
226
226
|
static get encapsulation() { return "shadow"; }
|
|
@@ -156,7 +156,7 @@ export class Q2ChartBar {
|
|
|
156
156
|
// #endregion
|
|
157
157
|
// #region Render Methods
|
|
158
158
|
render() {
|
|
159
|
-
return (h("div", { key: '
|
|
159
|
+
return (h("div", { key: 'e73968847bcf0433512f1cd79c05ba8cb03aa3e7', class: "container" }, h("div", { key: '2f1cf10a7a96b450835f42b901714c7b77a15e80', ref: el => (this.chartContainer = el), class: "chart-container", role: "img", "test-id": "barChartContainer" })));
|
|
160
160
|
}
|
|
161
161
|
static get is() { return "q2-chart-bar"; }
|
|
162
162
|
static get encapsulation() { return "shadow"; }
|
|
@@ -474,7 +474,7 @@ export class Q2ChartDonut {
|
|
|
474
474
|
} })), !!name && h("div", { class: "name" }, name), !isNaN(value) && h("div", { class: "value" }, displayValue))));
|
|
475
475
|
}
|
|
476
476
|
render() {
|
|
477
|
-
return (h("click-elsewhere", { key: '
|
|
477
|
+
return (h("click-elsewhere", { key: 'ad2e2dec992d642ef14412e5e7e129177a302a76', onChange: this.onClickElsewhere }, h("figure", { key: 'e28999ade90c1c38ce06ef9f326be91c269a183e' }, h("div", { key: 'c3a5d4d64c8b5075964fda6e43015d4f1c7ebdf3', class: "container" }, h("div", { key: '4e90a0e625d5f870194191b03a9979cc9ef24dd8', ref: el => (this.chartContainer = el), "aria-describedby": !this.isClickable ? 'center-card-description' : undefined, class: "chart-container", role: "img", "test-id": "chartContainer", onClick: this.onContainerClick, tabIndex: !this.isClickable ? 0 : undefined, onKeyDown: !this.isClickable ? this.onButtonKeyDown : undefined }), this.renderCenterBlock()), this.showLegend && (h("figcaption", { key: 'f75662864d2c89a8b62453b680d4e7d2d22d0273' }, h("q2-legend", { key: '8cd03190c0f90a771b3dc4c9b05a00132e391f2b', class: "legend", data: this.legendData, format: this.format, hoveredItemId: this.legendHoveredId, onClick: this.onLegendClick, onMouseleave: this.onLegendMouseleave, onMouseenter: this.onLegendMouseenter, selectedItemId: this.selectedId }))))));
|
|
478
478
|
}
|
|
479
479
|
static get is() { return "q2-chart-donut"; }
|
|
480
480
|
static get encapsulation() { return "shadow"; }
|
|
@@ -116,7 +116,7 @@ export class Q2Currency {
|
|
|
116
116
|
// #region Render Methods
|
|
117
117
|
render() {
|
|
118
118
|
const { hasPlusMinusSign, plusMinusSign, currencyIsFront, currencySymbol, shouldSuperscriptSymbol, amountCore, fraction, shouldSuperscriptFraction, readableCurrency, currencyClasses, } = this;
|
|
119
|
-
return (h("div", { key: '
|
|
119
|
+
return (h("div", { key: '1e17b6913abdf22d415c3117f3cc5be8ba6f2f9b', "test-id": "q2CurrencyInner", class: currencyClasses, "aria-label": readableCurrency }, hasPlusMinusSign && h("span", { key: 'ac8f8317cb2023a20240908721aaf7abd0199be3' }, plusMinusSign), currencyIsFront && h("span", { key: '63c025e1737efcddf37153cd6347a16ffa2d809a', class: shouldSuperscriptSymbol ? 'superscript' : '' }, currencySymbol), h("span", { key: '4f7db4e62aac2f1c2ea4011f3279199344cf3429' }, amountCore), h("span", { key: '2158f23937b8cb9969ffc2c08eb60e306b34bbf2', class: shouldSuperscriptFraction ? 'superscript' : '' }, fraction), !currencyIsFront && h("span", { key: '8af7b8afc705a073ce16f4c11ddb60e6033252b9', class: shouldSuperscriptSymbol ? 'superscript' : '' }, currencySymbol)));
|
|
120
120
|
}
|
|
121
121
|
static get is() { return "q2-currency"; }
|
|
122
122
|
static get encapsulation() { return "shadow"; }
|
|
@@ -100,7 +100,7 @@ export class Q2Detail {
|
|
|
100
100
|
// #endregion
|
|
101
101
|
// #region Render Methods
|
|
102
102
|
render() {
|
|
103
|
-
return (h("div", { key: '
|
|
103
|
+
return (h("div", { key: 'd5b8c72df149578537a747fef3133a5751205dbf', class: this.detailClasses }, this.hasLabel && (h("div", { key: '0013f9766de1cdd2d50b8b8b2dca76361fbf1b0a', class: this.labelClasses, "aria-describedby": !!this.description ? 'label-description' : undefined }, !!this.label ? loc(this.label) : this.hasLabelSlotContent ? h("slot", { name: "label" }) : '')), this.hasDescripiton && (h("div", { key: 'a225abfc8746aa269a2db8666d629c6a39186493', id: "label-description", class: this.descriptionClasses }, !!this.description ? loc(this.description) : this.hasDefaultSlotContent ? h("slot", null) : ''))));
|
|
104
104
|
}
|
|
105
105
|
static get is() { return "q2-detail"; }
|
|
106
106
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { shouldShowActionSheet, showActionSheetList } from "../../utils/action-sheet";
|
|
2
2
|
import { h, Fragment } from "@stencil/core";
|
|
3
3
|
import { handleAriaLabel, handleRenamedProp, isEventFromElement, loc, overrideFocus, waitForNextPaint, } from "../../utils/index";
|
|
4
|
+
/** @slot control - An optional slot to provide custom content as the clickable interface. The Dropdown **must** have `type="custom"` to use the control slot. */
|
|
4
5
|
export class Q2Dropdown {
|
|
5
6
|
constructor() {
|
|
6
7
|
var _a;
|
|
7
8
|
this.dropdownItemSelector = 'q2-dropdown-item:not([disabled]):not([separator])';
|
|
9
|
+
this.optionSelector = 'q2-option:not([disabled]):not([separator])';
|
|
8
10
|
this.focusToggle = () => {
|
|
9
11
|
this.controlElement.focus();
|
|
10
12
|
};
|
|
13
|
+
this.handleFocusOut = (event) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const relatedTarget = event.relatedTarget;
|
|
16
|
+
if ((_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget))
|
|
17
|
+
return;
|
|
18
|
+
if (this.hostElement.contains(relatedTarget))
|
|
19
|
+
return;
|
|
20
|
+
this.open = false;
|
|
21
|
+
};
|
|
11
22
|
this.onClickElsewhere = (event) => {
|
|
12
23
|
const target = event.target;
|
|
13
24
|
if (target.localName === 'q2-option-list') {
|
|
@@ -21,6 +32,11 @@ export class Q2Dropdown {
|
|
|
21
32
|
popoverElement.open = false;
|
|
22
33
|
}
|
|
23
34
|
};
|
|
35
|
+
this.onPopoverState = (event) => {
|
|
36
|
+
if (event.detail.open)
|
|
37
|
+
return;
|
|
38
|
+
this.controlElement.focus();
|
|
39
|
+
};
|
|
24
40
|
this.onToggleClick = async (event) => {
|
|
25
41
|
event.stopPropagation();
|
|
26
42
|
if (shouldShowActionSheet(this)) {
|
|
@@ -42,20 +58,6 @@ export class Q2Dropdown {
|
|
|
42
58
|
this.optionList.handleExternalKeydown(event);
|
|
43
59
|
}
|
|
44
60
|
};
|
|
45
|
-
this.onPopoverState = (event) => {
|
|
46
|
-
if (event.detail.open)
|
|
47
|
-
return;
|
|
48
|
-
this.controlElement.focus();
|
|
49
|
-
};
|
|
50
|
-
this.handleFocusOut = (event) => {
|
|
51
|
-
var _a;
|
|
52
|
-
const relatedTarget = event.relatedTarget;
|
|
53
|
-
if ((_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget))
|
|
54
|
-
return;
|
|
55
|
-
if (this.hostElement.contains(relatedTarget))
|
|
56
|
-
return;
|
|
57
|
-
this.open = false;
|
|
58
|
-
};
|
|
59
61
|
this.additionalContext = undefined;
|
|
60
62
|
this.alignment = undefined;
|
|
61
63
|
this.ariaLabel = undefined;
|
|
@@ -102,7 +104,9 @@ export class Q2Dropdown {
|
|
|
102
104
|
if (this.open !== open)
|
|
103
105
|
this.open = open;
|
|
104
106
|
(_a = this.popoverElement) === null || _a === void 0 ? void 0 : _a.scrollContainerTo({ top: 0 });
|
|
105
|
-
|
|
107
|
+
if (!open) {
|
|
108
|
+
this.optionList.setActiveElement(null);
|
|
109
|
+
}
|
|
106
110
|
}
|
|
107
111
|
// #endregion
|
|
108
112
|
// #region Public Methods API
|
|
@@ -229,13 +233,13 @@ export class Q2Dropdown {
|
|
|
229
233
|
};
|
|
230
234
|
}
|
|
231
235
|
_clickItem(value) {
|
|
232
|
-
|
|
236
|
+
var _a;
|
|
237
|
+
if (!value || this.disabled)
|
|
233
238
|
return;
|
|
234
239
|
const item = this.hostElement.querySelector(`${this.dropdownItemSelector}[value="${value}"]`);
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
itemBtn.click();
|
|
240
|
+
const option = this.hostElement.querySelector(`${this.optionSelector}[value="${value}"]`);
|
|
241
|
+
(_a = item === null || item === void 0 ? void 0 : item.shadowRoot.querySelector('.dropdown-item')) === null || _a === void 0 ? void 0 : _a.click();
|
|
242
|
+
option === null || option === void 0 ? void 0 : option.click();
|
|
239
243
|
}
|
|
240
244
|
async _handleActionSheet(event) {
|
|
241
245
|
const { value } = await showActionSheetList(this, event);
|
|
@@ -313,7 +317,7 @@ export class Q2Dropdown {
|
|
|
313
317
|
// #region Render Methods
|
|
314
318
|
render() {
|
|
315
319
|
const btnProps = this.toggleButtonProps;
|
|
316
|
-
return (h("click-elsewhere", { key: '
|
|
320
|
+
return (h("click-elsewhere", { key: 'bf4d4da663e9225d757a8411a983073112a53caf', class: this.open ? 'dropdown-open' : '', onChange: this.onClickElsewhere, "test-id": "dropdownContainer" }, h("q2-btn", { key: 'f67bd9f9d0eb7607c95ce39cbcd1c54273948b9c', ref: el => (this.controlElement = el), class: btnProps.className, onClick: this.onToggleClick, onKeyDown: this.onToggleKeydown, fab: btnProps.fab, intent: btnProps.intent, onFocusout: this.handleFocusOut, active: btnProps.active, disabled: btnProps.disabled, ariaExpanded: `${!!btnProps.ariaExpanded}`, label: this.hideLabel && this.label ? loc(this.label) : undefined, hideLabel: this.hideLabel, ariaHasPopup: "menu", "test-id": "dropdownButton", block: this.block, description: loc('tecton.element.dropdown.itemCount', [this.determineDropdownItemCount]) }, this.hasCustomControl ? (h("div", { "test-id": "dropdownControl", class: btnProps.custom ? '' : 'hidden' }, h("slot", { name: "control" }))) : (h(Fragment, null, this.icon ? h("q2-icon", { type: this.icon }) : ' ', this.label && !this.hideLabel && (h("span", { class: "dropdown-button-text" }, loc(this.label)))))), h("q2-popover", { key: '48d3ae90a89d08277a02cbf3588ffc1b33113dba', ref: el => (this.popoverElement = el), controlElement: this.controlElement, open: this.open, "max-height": this.popoverMaxHeight, onFocusout: this.handleFocusOut, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: this.popoverAlignment, mode: this.popoverMode || undefined, block: this.block }, h("q2-option-list", { key: '23f0f0000eaf3bb5a1b3b738c03844f06ffb72c2', onPopoverState: this.onPopoverState, id: "option-list", ref: el => (this.optionList = el), type: "menu", label: loc('tecton.element.optionList.label', [this.optionListLabel]), "no-select": true }, h("slot", { key: '193e517ed0d5bd2893b0931c3782a4920ddcdc5a' })))));
|
|
317
321
|
}
|
|
318
322
|
static get is() { return "q2-dropdown"; }
|
|
319
323
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"q2-dropdown.js","sourceRoot":"","sources":["../../../../src/components/q2-dropdown/q2-dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ","sourcesContent":["import { shouldShowActionSheet, showActionSheetList } from '@/utils/action-sheet';\nimport { Component, ComponentInterface, Prop, Method, Element, Watch, h, Fragment, Listen } from '@stencil/core';\nimport {\n handleAriaLabel,\n handleRenamedProp,\n isEventFromElement,\n loc,\n overrideFocus,\n waitForNextPaint,\n} from 'src/utils';\n\n@Component({ tag: 'q2-dropdown', shadow: true, styleUrl: 'q2-dropdown.scss' })\nexport class Q2Dropdown implements ComponentInterface {\n // #region Own Properties\n\n controlElement?: HTMLQ2BtnElement;\n dropdownItemSelector: string = 'q2-dropdown-item:not([disabled]):not([separator])';\n popoverElement?: HTMLQ2PopoverElement;\n optionList: HTMLQ2OptionListElement;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region Public Property API\n\n @Prop({ reflect: true })\n additionalContext: string;\n\n /** @deprecated */\n @Prop({ reflect: true })\n alignment: 'left' | 'right';\n\n /** @deprecated */\n @Prop({ reflect: true, mutable: true })\n ariaLabel: string;\n\n /** If `true`, component expands to fill the width of its parent element. */\n @Prop({ reflect: true })\n block: boolean;\n\n /**\n * Tells the outlet what the type of object being passed in as contextValue.\n * This will allow for the hierarchy resolution logic to work to determine if an option should or should not be shown.\n *\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n context: string;\n\n /**\n * Passes important information to the outlet (e.g., pass an account id that your platform can use to look up what module to show for that account type).\n *\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n contextValue: string;\n\n /** Indicates the menu cannot be focused or interacted with. */\n @Prop({ reflect: true })\n disabled: boolean;\n\n /**\n * Hide's the field's `<label>` element from view.\n * @warning\n * Only use when a visible label is impractical.\n */\n @Prop({ reflect: true, mutable: true })\n hideLabel: boolean;\n\n /**\n * Instructs the component to use the action sheet workflow for displaying its options.\n *\n * For more information, see [Action Sheets](https://tecton.q2developer.com/guides/action-sheets/).\n */\n @Prop()\n hoist: boolean = !!window.Tecton?.useActionSheets;\n\n /** The icon that will render within the toggle button. You may use any of the `q2-icon` types. */\n @Prop({ reflect: true })\n icon: string;\n\n /**\n * The text that appears within the button.\n * @warning\n * This property should not be used if the `type` is `icon`.\n * @localizable\n */\n @Prop({ reflect: true, mutable: true })\n label: string;\n\n /**\n * Identifies this menu as an outlet. Used in conjunction with context and, optionally, `contextValue`.\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n name: string;\n\n /**\n * Determine whether the popover is open or closed.\n *\n * @readonly\n */\n @Prop({ reflect: true, mutable: true })\n open: boolean;\n\n /** Determines the label that is applied to the option list for accessibility purposes. */\n @Prop()\n optionListLabel: string;\n\n /** @deprecated */\n @Prop({ reflect: true })\n popDirection: 'up' | 'down';\n\n /** Aligns the popover dropdown to the left or right side of the input field. */\n @Prop({ mutable: true })\n popoverAlignment: 'left' | 'right' = 'left'; // being used in dropdown.scss\n\n /**\n * Force the direction of the popover dropdown when it opens.\n * If no value is passed, the component will auto-detect the direction based on available space.\n */\n @Prop({ mutable: true })\n popoverDirection: '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 popoverMaxHeight: number;\n\n /** @deprecated */\n @Prop()\n popoverMinHeight: number;\n\n /**\n * Determines the display mode of the popover.\n *\n * Providing a value of `legacy` instructs the popover to use absolute positioning instead of fixed positioning.\n *\n * @info\n * This is a temporary solution to work around styling issues related to using fixed positioning for the popover\n * when nested inside of elements with transform properties. This will be removed once the popover API is available\n * for use.\n */\n @Prop({ mutable: true })\n popoverMode: 'legacy' = null;\n\n /**\n * Use with `context` to tell the outlet where it appears. It will be matched with the appropriately configured module for that context.\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n resolvedType: string;\n\n /** The type of button used as the menu toggle.\n * @info\n * Type must be \"custom\" to use the custom button slot.\n */\n @Prop({ reflect: true })\n type: 'icon' | 'fab' | 'custom' | 'primary' | 'secondary' | 'neutral' = 'icon';\n\n // #endregion\n // #region Component Lifecycle Events\n\n componentWillLoad() {\n this.popDirectionHandler();\n this.alignmentHandler();\n this.ariaLabelHandler();\n }\n\n componentDidLoad() {\n this.orchestrateResolvedMenuItems();\n overrideFocus(this.hostElement);\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('focus')\n delegateFocus(event: FocusEvent) {\n if (!isEventFromElement(event, this.hostElement)) return;\n this.focusToggle();\n }\n\n @Listen('popoverStateChanged')\n popoverStateChangeHandler({ detail: { open } }: CustomEvent<{ open: boolean }>) {\n if (this.open !== open) this.open = open;\n this.popoverElement?.scrollContainerTo({ top: 0 });\n this.optionList.setActiveElement(null);\n }\n\n // #endregion\n // #region Public Methods API\n\n /**\n * Emulates clicking the dropdown `<button>` to hide the popover if it is showing.\n * @testOnly\n */\n @Method()\n async closePopover() {\n if (!this.open || this.disabled) return;\n this._togglePopover();\n }\n\n /**\n * Emulates clicking the dropdown `<button>` to show the popover if it is hidden.\n * @testOnly\n */\n @Method()\n async openPopover() {\n if (this.open || this.disabled) return;\n this._togglePopover();\n }\n\n /**\n * Emulates opening the dropdown and selecting a [Dropdown Item](https://tecton.q2developer.com/design-system/q2-dropdown-item/).\n *\n * If the dropdown is closed, this will open it before selecting the item.\n *\n * If the value does not match any item's value, this method does nothing.\n * @testOnly\n */\n @Method()\n async selectItem(value: string) {\n const item = this.hostElement.querySelector<HTMLQ2DropdownItemElement>(\n `${this.dropdownItemSelector}[value=\"${value}\"]`\n );\n const itemBtn = item?.shadowRoot.querySelector<HTMLButtonElement>('.dropdown-item');\n if (!item || this.disabled) return;\n if (!this.open) {\n this.controlElement?.click();\n await waitForNextPaint();\n }\n itemBtn.click();\n await waitForNextPaint();\n }\n\n /**\n * Emulates opening the dropdown and selecting a [Dropdown Item](https://tecton.q2developer.com/design-system/q2-dropdown-item/)'s *remove* button.\n *\n * If the dropdown is closed, this will open it before selecting the remove item button.\n *\n * Requirements for this method to work properly:\n * - Provided `value` matches the item's `value` property\n * - Item has the `removable` property enabled\n * @testOnly\n */\n @Method()\n async selectRemoveItem(value: string) {\n const item = this.hostElement.querySelector<HTMLQ2DropdownItemElement>(\n `${this.dropdownItemSelector}[value=\"${value}\"]`\n );\n const removeButton = item?.shadowRoot.querySelector<HTMLButtonElement>('.remove-dropdown-item');\n if (!item || !removeButton || this.disabled) return;\n if (!this.open) {\n this.controlElement?.click();\n await waitForNextPaint();\n }\n removeButton.click();\n await waitForNextPaint();\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('additionalContext')\n additionalContextHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('alignment')\n alignmentHandler() {\n handleRenamedProp(this, 'alignment', 'popoverAlignment');\n }\n\n @Watch('ariaLabel')\n ariaLabelHandler() {\n handleAriaLabel(this);\n }\n\n @Watch('context')\n contextHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('contextValue')\n contextValueHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('name')\n nameHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('popDirection')\n popDirectionHandler() {\n handleRenamedProp(this, 'popDirection', 'popoverDirection');\n }\n\n @Watch('resolvedType')\n resolvedTypeHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n // #endregion\n // #region Local Methods\n\n get determineDropdownItemCount() {\n return this.hostElement.querySelectorAll(this.dropdownItemSelector).length;\n }\n\n get hasCustomControl() {\n return !!this.hostElement.querySelector('[slot=control]');\n }\n\n get toggleButtonProps() {\n const allowedIntents = ['primary', 'secondary', 'neutral'];\n const allowedTypes = ['icon', 'fab', 'custom', ...allowedIntents];\n const type = allowedTypes.includes(this.type) ? this.type : '';\n const icon = type === 'icon';\n const fab = type === 'fab';\n const custom = type === 'custom';\n let intent;\n if (allowedIntents.includes(type)) {\n intent = type === 'neutral' ? type : `workflow-${type}`;\n }\n const active = this.open;\n const disabled = !!this.disabled;\n const ariaExpanded = this.open;\n const className = !icon && !fab && !intent ? 'unstyled' : '';\n\n return {\n icon,\n fab,\n intent,\n active,\n disabled,\n ariaExpanded,\n className,\n custom,\n };\n }\n\n _clickItem(value: string) {\n if (!value) return;\n const item = this.hostElement.querySelector<HTMLQ2DropdownItemElement>(\n `${this.dropdownItemSelector}[value=\"${value}\"]`\n );\n const itemBtn = item?.shadowRoot.querySelector<HTMLButtonElement>('.dropdown-item');\n if (!item || this.disabled) return;\n itemBtn.click();\n }\n\n async _handleActionSheet(event: MouseEvent | KeyboardEvent) {\n const { value } = await showActionSheetList(this, event);\n this._clickItem(value);\n this.controlElement.focus();\n }\n\n _togglePopover() {\n const { controlElement } = this;\n if (!controlElement) return;\n controlElement.click();\n controlElement.focus();\n controlElement.dispatchEvent(new FocusEvent('focus'));\n }\n\n focusToggle = () => {\n this.controlElement.focus();\n };\n\n onClickElsewhere = (event: CustomEvent) => {\n const target = event.target as HTMLElement;\n if (target.localName === 'q2-option-list') {\n event.stopPropagation();\n }\n if (target.localName === 'click-elsewhere') {\n event.stopPropagation();\n const { popoverElement } = this;\n if (!popoverElement) return;\n popoverElement.open = false;\n }\n };\n\n onToggleClick = async (event: MouseEvent) => {\n event.stopPropagation();\n if (shouldShowActionSheet(this)) {\n this._handleActionSheet(event);\n } else {\n await this.popoverElement.toggle();\n }\n };\n\n onToggleKeydown = async (event: KeyboardEvent) => {\n const isTabMetaOrCtrl = event.metaKey || event.ctrlKey || event.key === 'Tab';\n if (isTabMetaOrCtrl) return;\n\n event.preventDefault();\n if (shouldShowActionSheet(this, event)) {\n this._handleActionSheet(event);\n } else {\n this.optionList.handleExternalKeydown(event);\n }\n };\n\n onPopoverState = (event: CustomEvent<{ open: boolean; action: string }>) => {\n if (event.detail.open) return;\n this.controlElement.focus();\n };\n\n handleFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as unknown as HTMLElement;\n if (this.popoverElement?.contains(relatedTarget)) return;\n if (this.hostElement.contains(relatedTarget)) return;\n this.open = false;\n };\n\n orchestrateResolvedMenuItems() {\n if (!this.name || !this.context) {\n // this is only for contextual menu outlets\n this.removeResolvedElements();\n return;\n }\n\n this.resolveMenuItemElements()\n .then(data => {\n this.removeResolvedElements();\n data.forEach(element => {\n this.hostElement.appendChild(element);\n });\n })\n .catch(err => {\n this.removeResolvedElements();\n throw err;\n });\n }\n\n removeResolvedElements() {\n const resolvedElements = this.hostElement.querySelectorAll('q2-dropdown-item.resolved-menu-item');\n resolvedElements.forEach(element => this.hostElement.removeChild(element));\n }\n\n resolveMenu() {\n return (\n this.name &&\n window.TectonElements &&\n window.TectonElements.resolveMenu(this.name, this.contextValue, this.resolvedType, this.additionalContext)\n );\n }\n\n resolveMenuItemElements() {\n return this.resolveMenu().then(datas => {\n return datas.map(menuItemData => {\n let onClickFn;\n let queryParams;\n if (menuItemData['tct-ctxid']) {\n queryParams = {};\n queryParams[menuItemData.contextIdParamName] = menuItemData['tct-ctxid'];\n }\n\n switch (menuItemData.action) {\n case 'navigateTo':\n onClickFn = function () {\n return window.TectonElements?.navigateTo?.(\n menuItemData.featureName,\n menuItemData.moduleName,\n queryParams\n );\n };\n break;\n case 'showOverpanel':\n onClickFn = function () {\n return window.TectonElements?.showOverpanel?.(\n `${menuItemData.featureName}.${menuItemData.moduleName}`,\n queryParams,\n undefined,\n true\n );\n };\n break;\n }\n\n const newDropdownItem = document.createElement('q2-dropdown-item');\n newDropdownItem.setAttribute('value', menuItemData.itemLabel);\n newDropdownItem.classList.add('resolved-menu-item');\n newDropdownItem.textContent = menuItemData.itemLabel;\n newDropdownItem.onclick = onClickFn;\n\n return newDropdownItem;\n });\n });\n }\n\n // #endregion\n // #region Render Methods\n\n render() {\n const btnProps = this.toggleButtonProps;\n\n return (\n <click-elsewhere\n class={this.open ? 'dropdown-open' : ''}\n onChange={this.onClickElsewhere}\n test-id=\"dropdownContainer\"\n >\n <q2-btn\n ref={el => (this.controlElement = el)}\n class={btnProps.className}\n onClick={this.onToggleClick}\n onKeyDown={this.onToggleKeydown}\n fab={btnProps.fab}\n intent={btnProps.intent}\n onFocusout={this.handleFocusOut}\n active={btnProps.active}\n disabled={btnProps.disabled}\n ariaExpanded={`${!!btnProps.ariaExpanded}`}\n label={this.hideLabel && this.label ? loc(this.label) : undefined}\n hideLabel={this.hideLabel}\n ariaHasPopup=\"menu\"\n test-id=\"dropdownButton\"\n block={this.block}\n description={loc('tecton.element.dropdown.itemCount', [this.determineDropdownItemCount])}\n >\n {this.hasCustomControl ? (\n <div\n test-id=\"dropdownControl\"\n class={btnProps.custom ? '' : 'hidden'}\n >\n <slot name=\"control\" />\n </div>\n ) : (\n <Fragment>\n {this.icon ? <q2-icon type={this.icon} /> : ' '}\n {this.label && !this.hideLabel && (\n <span class=\"dropdown-button-text\">{loc(this.label)}</span>\n )}\n </Fragment>\n )}\n </q2-btn>\n <q2-popover\n ref={el => (this.popoverElement = el)}\n controlElement={this.controlElement}\n open={this.open}\n max-height={this.popoverMaxHeight}\n onFocusout={this.handleFocusOut}\n minHeight={this.popoverMinHeight}\n direction={this.popoverDirection}\n align={this.popoverAlignment}\n mode={this.popoverMode || undefined}\n block={this.block}\n >\n <q2-option-list\n onPopoverState={this.onPopoverState}\n id=\"option-list\"\n ref={el => (this.optionList = el)}\n type=\"menu\"\n label={loc('tecton.element.optionList.label', [this.optionListLabel])}\n no-select\n >\n <slot />\n </q2-option-list>\n </q2-popover>\n </click-elsewhere>\n );\n }\n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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGJ","sourcesContent":["import { shouldShowActionSheet, showActionSheetList } from '@/utils/action-sheet';\nimport { Component, ComponentInterface, Prop, Method, Element, Watch, h, Fragment, Listen } from '@stencil/core';\nimport {\n handleAriaLabel,\n handleRenamedProp,\n isEventFromElement,\n loc,\n overrideFocus,\n waitForNextPaint,\n} from 'src/utils';\n\n/** @slot control - An optional slot to provide custom content as the clickable interface. The Dropdown **must** have `type=\"custom\"` to use the control slot. */\n@Component({ tag: 'q2-dropdown', shadow: true, styleUrl: 'q2-dropdown.scss' })\nexport class Q2Dropdown implements ComponentInterface {\n // #region Own Properties\n\n controlElement?: HTMLQ2BtnElement;\n dropdownItemSelector: string = 'q2-dropdown-item:not([disabled]):not([separator])';\n optionSelector: string = 'q2-option:not([disabled]):not([separator])';\n optionList: HTMLQ2OptionListElement;\n popoverElement?: HTMLQ2PopoverElement;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region Public Property API\n\n @Prop({ reflect: true })\n additionalContext: string;\n\n /** @deprecated */\n @Prop({ reflect: true })\n alignment: 'left' | 'right';\n\n /** @deprecated */\n @Prop({ reflect: true, mutable: true })\n ariaLabel: string;\n\n /** If `true`, component expands to fill the width of its parent element. */\n @Prop({ reflect: true })\n block: boolean;\n\n /**\n * Tells the outlet what the type of object being passed in as contextValue.\n * This will allow for the hierarchy resolution logic to work to determine if an option should or should not be shown.\n *\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n context: string;\n\n /**\n * Passes important information to the outlet (e.g., pass an account id that your platform can use to look up what module to show for that account type).\n *\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n contextValue: string;\n\n /** Indicates the menu cannot be focused or interacted with. */\n @Prop({ reflect: true })\n disabled: boolean;\n\n /**\n * Hide's the field's `<label>` element from view.\n * @warning\n * Only use when a visible label is impractical.\n */\n @Prop({ reflect: true, mutable: true })\n hideLabel: boolean;\n\n /**\n * Instructs the component to use the action sheet workflow for displaying its options.\n *\n * For more information, see [Action Sheets](https://tecton.q2developer.com/guides/action-sheets/).\n */\n @Prop()\n hoist: boolean = !!window.Tecton?.useActionSheets;\n\n /** The icon that will render within the toggle button. You may use any of the `q2-icon` types. */\n @Prop({ reflect: true })\n icon: string;\n\n /**\n * The text that appears within the button.\n * @warning\n * This property should not be used if the `type` is `icon`.\n * @localizable\n */\n @Prop({ reflect: true, mutable: true })\n label: string;\n\n /**\n * Identifies this menu as an outlet. Used in conjunction with context and, optionally, `contextValue`.\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n name: string;\n\n /**\n * Determine whether the popover is open or closed.\n *\n * @readonly\n */\n @Prop({ reflect: true, mutable: true })\n open: boolean;\n\n /** Determines the label that is applied to the option list for accessibility purposes. */\n @Prop()\n optionListLabel: string;\n\n /** @deprecated */\n @Prop({ reflect: true })\n popDirection: 'up' | 'down';\n\n /** Aligns the popover dropdown to the left or right side of the input field. */\n @Prop({ mutable: true })\n popoverAlignment: 'left' | 'right' = 'left'; // being used in dropdown.scss\n\n /**\n * Force the direction of the popover dropdown when it opens.\n * If no value is passed, the component will auto-detect the direction based on available space.\n */\n @Prop({ mutable: true })\n popoverDirection: '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 popoverMaxHeight: number;\n\n /** @deprecated */\n @Prop()\n popoverMinHeight: number;\n\n /**\n * Determines the display mode of the popover.\n *\n * Providing a value of `legacy` instructs the popover to use absolute positioning instead of fixed positioning.\n *\n * @info\n * This is a temporary solution to work around styling issues related to using fixed positioning for the popover\n * when nested inside of elements with transform properties. This will be removed once the popover API is available\n * for use.\n */\n @Prop({ mutable: true })\n popoverMode: 'legacy' = null;\n\n /**\n * Use with `context` to tell the outlet where it appears. It will be matched with the appropriately configured module for that context.\n * @info\n * Only applicable when using `<q2-dropdown>` for outlets.\n */\n @Prop({ reflect: true })\n resolvedType: string;\n\n /** The type of button used as the menu toggle.\n * @info\n * Type must be \"custom\" to use the custom button slot.\n */\n @Prop({ reflect: true })\n type: 'icon' | 'fab' | 'custom' | 'primary' | 'secondary' | 'neutral' = 'icon';\n\n // #endregion\n // #region Component Lifecycle Events\n\n componentWillLoad() {\n this.popDirectionHandler();\n this.alignmentHandler();\n this.ariaLabelHandler();\n }\n\n componentDidLoad() {\n this.orchestrateResolvedMenuItems();\n overrideFocus(this.hostElement);\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('focus')\n delegateFocus(event: FocusEvent) {\n if (!isEventFromElement(event, this.hostElement)) return;\n this.focusToggle();\n }\n\n @Listen('popoverStateChanged')\n popoverStateChangeHandler({ detail: { open } }: CustomEvent<{ open: boolean }>) {\n if (this.open !== open) this.open = open;\n this.popoverElement?.scrollContainerTo({ top: 0 });\n if (!open) {\n this.optionList.setActiveElement(null);\n }\n }\n\n // #endregion\n // #region Public Methods API\n\n /**\n * Emulates clicking the dropdown `<button>` to hide the popover if it is showing.\n * @testOnly\n */\n @Method()\n async closePopover() {\n if (!this.open || this.disabled) return;\n this._togglePopover();\n }\n\n /**\n * Emulates clicking the dropdown `<button>` to show the popover if it is hidden.\n * @testOnly\n */\n @Method()\n async openPopover() {\n if (this.open || this.disabled) return;\n this._togglePopover();\n }\n\n /**\n * Emulates opening the dropdown and selecting a [Dropdown Item](https://tecton.q2developer.com/design-system/q2-dropdown-item/).\n *\n * If the dropdown is closed, this will open it before selecting the item.\n *\n * If the value does not match any item's value, this method does nothing.\n * @testOnly\n */\n @Method()\n async selectItem(value: string) {\n const item = this.hostElement.querySelector<HTMLQ2DropdownItemElement>(\n `${this.dropdownItemSelector}[value=\"${value}\"]`\n );\n const itemBtn = item?.shadowRoot.querySelector<HTMLButtonElement>('.dropdown-item');\n if (!item || this.disabled) return;\n if (!this.open) {\n this.controlElement?.click();\n await waitForNextPaint();\n }\n itemBtn.click();\n await waitForNextPaint();\n }\n\n /**\n * Emulates opening the dropdown and selecting a [Dropdown Item](https://tecton.q2developer.com/design-system/q2-dropdown-item/)'s *remove* button.\n *\n * If the dropdown is closed, this will open it before selecting the remove item button.\n *\n * Requirements for this method to work properly:\n * - Provided `value` matches the item's `value` property\n * - Item has the `removable` property enabled\n * @testOnly\n */\n @Method()\n async selectRemoveItem(value: string) {\n const item = this.hostElement.querySelector<HTMLQ2DropdownItemElement>(\n `${this.dropdownItemSelector}[value=\"${value}\"]`\n );\n const removeButton = item?.shadowRoot.querySelector<HTMLButtonElement>('.remove-dropdown-item');\n if (!item || !removeButton || this.disabled) return;\n if (!this.open) {\n this.controlElement?.click();\n await waitForNextPaint();\n }\n removeButton.click();\n await waitForNextPaint();\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('additionalContext')\n additionalContextHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('alignment')\n alignmentHandler() {\n handleRenamedProp(this, 'alignment', 'popoverAlignment');\n }\n\n @Watch('ariaLabel')\n ariaLabelHandler() {\n handleAriaLabel(this);\n }\n\n @Watch('context')\n contextHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('contextValue')\n contextValueHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('name')\n nameHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n @Watch('popDirection')\n popDirectionHandler() {\n handleRenamedProp(this, 'popDirection', 'popoverDirection');\n }\n\n @Watch('resolvedType')\n resolvedTypeHandler() {\n this.orchestrateResolvedMenuItems();\n }\n\n // #endregion\n // #region Local Methods\n\n get determineDropdownItemCount() {\n return this.hostElement.querySelectorAll(this.dropdownItemSelector).length;\n }\n\n get hasCustomControl() {\n return !!this.hostElement.querySelector('[slot=control]');\n }\n\n get toggleButtonProps() {\n const allowedIntents = ['primary', 'secondary', 'neutral'];\n const allowedTypes = ['icon', 'fab', 'custom', ...allowedIntents];\n const type = allowedTypes.includes(this.type) ? this.type : '';\n const icon = type === 'icon';\n const fab = type === 'fab';\n const custom = type === 'custom';\n let intent;\n if (allowedIntents.includes(type)) {\n intent = type === 'neutral' ? type : `workflow-${type}`;\n }\n const active = this.open;\n const disabled = !!this.disabled;\n const ariaExpanded = this.open;\n const className = !icon && !fab && !intent ? 'unstyled' : '';\n\n return {\n icon,\n fab,\n intent,\n active,\n disabled,\n ariaExpanded,\n className,\n custom,\n };\n }\n\n _clickItem(value: string) {\n if (!value || this.disabled) return;\n const item = this.hostElement.querySelector<HTMLQ2DropdownItemElement>(\n `${this.dropdownItemSelector}[value=\"${value}\"]`\n );\n const option = this.hostElement.querySelector<HTMLQ2OptionElement>(`${this.optionSelector}[value=\"${value}\"]`);\n item?.shadowRoot.querySelector<HTMLButtonElement>('.dropdown-item')?.click();\n option?.click();\n }\n\n async _handleActionSheet(event: MouseEvent | KeyboardEvent) {\n const { value } = await showActionSheetList(this, event);\n this._clickItem(value);\n this.controlElement.focus();\n }\n\n _togglePopover() {\n const { controlElement } = this;\n if (!controlElement) return;\n controlElement.click();\n controlElement.focus();\n controlElement.dispatchEvent(new FocusEvent('focus'));\n }\n\n focusToggle = () => {\n this.controlElement.focus();\n };\n\n handleFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as unknown as HTMLElement;\n if (this.popoverElement?.contains(relatedTarget)) return;\n if (this.hostElement.contains(relatedTarget)) return;\n this.open = false;\n };\n\n onClickElsewhere = (event: CustomEvent) => {\n const target = event.target as HTMLElement;\n if (target.localName === 'q2-option-list') {\n event.stopPropagation();\n }\n if (target.localName === 'click-elsewhere') {\n event.stopPropagation();\n const { popoverElement } = this;\n if (!popoverElement) return;\n popoverElement.open = false;\n }\n };\n\n onPopoverState = (event: CustomEvent<{ open: boolean; action: string }>) => {\n if (event.detail.open) return;\n this.controlElement.focus();\n };\n\n onToggleClick = async (event: MouseEvent) => {\n event.stopPropagation();\n if (shouldShowActionSheet(this)) {\n this._handleActionSheet(event);\n } else {\n await this.popoverElement.toggle();\n }\n };\n\n onToggleKeydown = async (event: KeyboardEvent) => {\n const isTabMetaOrCtrl = event.metaKey || event.ctrlKey || event.key === 'Tab';\n if (isTabMetaOrCtrl) return;\n\n event.preventDefault();\n if (shouldShowActionSheet(this, event)) {\n this._handleActionSheet(event);\n } else {\n this.optionList.handleExternalKeydown(event);\n }\n };\n\n orchestrateResolvedMenuItems() {\n if (!this.name || !this.context) {\n // this is only for contextual menu outlets\n this.removeResolvedElements();\n return;\n }\n\n this.resolveMenuItemElements()\n .then(data => {\n this.removeResolvedElements();\n data.forEach(element => {\n this.hostElement.appendChild(element);\n });\n })\n .catch(err => {\n this.removeResolvedElements();\n throw err;\n });\n }\n\n removeResolvedElements() {\n const resolvedElements = this.hostElement.querySelectorAll('q2-dropdown-item.resolved-menu-item');\n resolvedElements.forEach(element => this.hostElement.removeChild(element));\n }\n\n resolveMenu() {\n return (\n this.name &&\n window.TectonElements &&\n window.TectonElements.resolveMenu(this.name, this.contextValue, this.resolvedType, this.additionalContext)\n );\n }\n\n resolveMenuItemElements() {\n return this.resolveMenu().then(datas => {\n return datas.map(menuItemData => {\n let onClickFn;\n let queryParams;\n if (menuItemData['tct-ctxid']) {\n queryParams = {};\n queryParams[menuItemData.contextIdParamName] = menuItemData['tct-ctxid'];\n }\n\n switch (menuItemData.action) {\n case 'navigateTo':\n onClickFn = function () {\n return window.TectonElements?.navigateTo?.(\n menuItemData.featureName,\n menuItemData.moduleName,\n queryParams\n );\n };\n break;\n case 'showOverpanel':\n onClickFn = function () {\n return window.TectonElements?.showOverpanel?.(\n `${menuItemData.featureName}.${menuItemData.moduleName}`,\n queryParams,\n undefined,\n true\n );\n };\n break;\n }\n\n const newDropdownItem = document.createElement('q2-dropdown-item');\n newDropdownItem.setAttribute('value', menuItemData.itemLabel);\n newDropdownItem.classList.add('resolved-menu-item');\n newDropdownItem.textContent = menuItemData.itemLabel;\n newDropdownItem.onclick = onClickFn;\n\n return newDropdownItem;\n });\n });\n }\n\n // #endregion\n // #region Render Methods\n\n render() {\n const btnProps = this.toggleButtonProps;\n\n return (\n <click-elsewhere\n class={this.open ? 'dropdown-open' : ''}\n onChange={this.onClickElsewhere}\n test-id=\"dropdownContainer\"\n >\n <q2-btn\n ref={el => (this.controlElement = el)}\n class={btnProps.className}\n onClick={this.onToggleClick}\n onKeyDown={this.onToggleKeydown}\n fab={btnProps.fab}\n intent={btnProps.intent}\n onFocusout={this.handleFocusOut}\n active={btnProps.active}\n disabled={btnProps.disabled}\n ariaExpanded={`${!!btnProps.ariaExpanded}`}\n label={this.hideLabel && this.label ? loc(this.label) : undefined}\n hideLabel={this.hideLabel}\n ariaHasPopup=\"menu\"\n test-id=\"dropdownButton\"\n block={this.block}\n description={loc('tecton.element.dropdown.itemCount', [this.determineDropdownItemCount])}\n >\n {this.hasCustomControl ? (\n <div\n test-id=\"dropdownControl\"\n class={btnProps.custom ? '' : 'hidden'}\n >\n <slot name=\"control\" />\n </div>\n ) : (\n <Fragment>\n {this.icon ? <q2-icon type={this.icon} /> : ' '}\n {this.label && !this.hideLabel && (\n <span class=\"dropdown-button-text\">{loc(this.label)}</span>\n )}\n </Fragment>\n )}\n </q2-btn>\n <q2-popover\n ref={el => (this.popoverElement = el)}\n controlElement={this.controlElement}\n open={this.open}\n max-height={this.popoverMaxHeight}\n onFocusout={this.handleFocusOut}\n minHeight={this.popoverMinHeight}\n direction={this.popoverDirection}\n align={this.popoverAlignment}\n mode={this.popoverMode || undefined}\n block={this.block}\n >\n <q2-option-list\n onPopoverState={this.onPopoverState}\n id=\"option-list\"\n ref={el => (this.optionList = el)}\n type=\"menu\"\n label={loc('tecton.element.optionList.label', [this.optionListLabel])}\n no-select\n >\n <slot />\n </q2-option-list>\n </q2-popover>\n </click-elsewhere>\n );\n }\n\n // #endregion\n}\n"]}
|
|
@@ -452,7 +452,7 @@ describe('q2-dropdown', () => {
|
|
|
452
452
|
await page.waitForChanges();
|
|
453
453
|
expect(await dropdown.getProperty('open')).toBe(true);
|
|
454
454
|
expect(await popover.getProperty('open')).toBe(true);
|
|
455
|
-
expect(popoverStateChangedSpy).
|
|
455
|
+
expect(popoverStateChangedSpy).toHaveReceivedEvent();
|
|
456
456
|
});
|
|
457
457
|
});
|
|
458
458
|
describe('block', () => {
|
|
@@ -482,18 +482,6 @@ describe('q2-dropdown', () => {
|
|
|
482
482
|
});
|
|
483
483
|
});
|
|
484
484
|
describe('popoverMode', () => {
|
|
485
|
-
it('does not set any mode on the popover (default)', async () => {
|
|
486
|
-
const page = await newSpecPage({
|
|
487
|
-
components: [Q2Popover, Q2Dropdown, Q2DropdownItem],
|
|
488
|
-
html: `
|
|
489
|
-
<q2-dropdown>
|
|
490
|
-
<q2-dropdown-item>Item 1 Text</q2-dropdown-item>
|
|
491
|
-
<q2-dropdown-item>Item 2 Text</q2-dropdown-item>
|
|
492
|
-
</q2-dropdown>
|
|
493
|
-
`,
|
|
494
|
-
});
|
|
495
|
-
expect(page.root.shadowRoot.querySelector('q2-popover').mode).toBeNull();
|
|
496
|
-
});
|
|
497
485
|
it('sets the value of popoverMode as the mode on the popover', async () => {
|
|
498
486
|
const page = await newSpecPage({
|
|
499
487
|
components: [Q2Popover, Q2Dropdown, Q2DropdownItem],
|
|
@@ -555,7 +543,7 @@ describe('q2-dropdown', () => {
|
|
|
555
543
|
const popoverStateChangedSpy = await dropdown.spyOnEvent('popoverStateChanged');
|
|
556
544
|
await dropdown.callMethod('selectItem', 'item-1');
|
|
557
545
|
await page.waitForChanges();
|
|
558
|
-
expect(popoverStateChangedSpy).
|
|
546
|
+
expect(popoverStateChangedSpy).toHaveReceivedEvent();
|
|
559
547
|
});
|
|
560
548
|
it('clicks the item matching the provided value', async () => {
|
|
561
549
|
const clickSpy = await firstOption.spyOnEvent('click');
|
|
@@ -597,7 +585,7 @@ describe('q2-dropdown', () => {
|
|
|
597
585
|
const popoverStateChangedSpy = await dropdown.spyOnEvent('popoverStateChanged');
|
|
598
586
|
await dropdown.callMethod('selectRemoveItem', 'item-1');
|
|
599
587
|
await page.waitForChanges();
|
|
600
|
-
expect(popoverStateChangedSpy).
|
|
588
|
+
expect(popoverStateChangedSpy).toHaveReceivedEvent();
|
|
601
589
|
});
|
|
602
590
|
it('clicks the remove item button corresponding to the provided value', async () => {
|
|
603
591
|
const clickSpy = await firstOption.spyOnEvent('click');
|
|
@@ -614,7 +602,7 @@ describe('q2-dropdown', () => {
|
|
|
614
602
|
await dropdown.callMethod('openPopover');
|
|
615
603
|
await page.waitForChanges();
|
|
616
604
|
expect(await dropdown.getProperty('open')).toBe(true);
|
|
617
|
-
expect(popoverStateChangedSpy).
|
|
605
|
+
expect(popoverStateChangedSpy).toHaveReceivedEvent();
|
|
618
606
|
});
|
|
619
607
|
it('does nothing if the dropdown is disabled', async () => {
|
|
620
608
|
dropdown.setProperty('disabled', true);
|
|
@@ -645,7 +633,7 @@ describe('q2-dropdown', () => {
|
|
|
645
633
|
await dropdown.callMethod('closePopover');
|
|
646
634
|
await page.waitForChanges();
|
|
647
635
|
expect(await dropdown.getProperty('open')).toBe(false);
|
|
648
|
-
expect(popoverStateChangedSpy).
|
|
636
|
+
expect(popoverStateChangedSpy).toHaveReceivedEvent();
|
|
649
637
|
});
|
|
650
638
|
it('does nothing if the dropdown is disabled', async () => {
|
|
651
639
|
dropdown.setProperty('open', true);
|
|
@@ -843,25 +831,27 @@ describe('q2-dropdown', () => {
|
|
|
843
831
|
clickSpy = await firstOption.spyOnEvent('click');
|
|
844
832
|
tctClickSpy = await firstOption.spyOnEvent('tctClick');
|
|
845
833
|
expect(await dropdown.getProperty('open')).toBeUndefined();
|
|
846
|
-
expect(buttonFocusSpy).
|
|
834
|
+
expect(buttonFocusSpy).not.toHaveReceivedEvent();
|
|
847
835
|
expect(popover).not.toHaveAttribute('open');
|
|
848
836
|
expect(dropdownContainer).not.toHaveClass('dropdown-open');
|
|
849
837
|
});
|
|
850
838
|
describe('toggle button behavior', () => {
|
|
851
839
|
describe('when popover is closed', () => {
|
|
852
840
|
it('ArrowUp: opens the popover and focuses last item', async () => {
|
|
841
|
+
await dropdownButton.callMethod('focus');
|
|
853
842
|
await dropdownButton.press('ArrowUp');
|
|
854
843
|
await page.waitForChanges();
|
|
855
844
|
expect(popover).toHaveAttribute('open');
|
|
856
|
-
expect(buttonFocusSpy).
|
|
857
|
-
expect(lastOptionFocusSpy).
|
|
845
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
846
|
+
expect(lastOptionFocusSpy).toHaveReceivedEvent();
|
|
858
847
|
});
|
|
859
848
|
it('ArrowDown: opens the popover and focuses first item', async () => {
|
|
849
|
+
await dropdownButton.callMethod('focus');
|
|
860
850
|
await dropdownButton.press('ArrowDown');
|
|
861
851
|
await page.waitForChanges();
|
|
862
852
|
expect(popover).toHaveAttribute('open');
|
|
863
|
-
expect(buttonFocusSpy).
|
|
864
|
-
expect(firstOptionFocusSpy).
|
|
853
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
854
|
+
expect(firstOptionFocusSpy).toHaveReceivedEvent();
|
|
865
855
|
});
|
|
866
856
|
});
|
|
867
857
|
describe('when popover is open', () => {
|
|
@@ -872,19 +862,21 @@ describe('q2-dropdown', () => {
|
|
|
872
862
|
buttonFocusSpy.events = [];
|
|
873
863
|
});
|
|
874
864
|
it('Escape: closes the popover and focuses toggle button', async () => {
|
|
865
|
+
await dropdownButton.callMethod('focus');
|
|
875
866
|
await dropdownButton.press('Escape');
|
|
876
867
|
await page.waitForChanges();
|
|
877
868
|
expect(popover).not.toHaveAttribute('open');
|
|
878
|
-
expect(buttonFocusSpy).
|
|
869
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
879
870
|
});
|
|
880
871
|
it('Tab: closes the popover and focuses next element in tab order', async () => {
|
|
881
872
|
const outerButton = await page.find('button');
|
|
882
873
|
const outerButtonSpy = await outerButton.spyOnEvent('focus');
|
|
874
|
+
await dropdownButton.callMethod('focus');
|
|
883
875
|
await dropdownButton.press('Tab');
|
|
884
876
|
await page.waitForChanges();
|
|
885
877
|
expect(popover).not.toHaveAttribute('open');
|
|
886
|
-
expect(buttonFocusSpy).
|
|
887
|
-
expect(outerButtonSpy).
|
|
878
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
879
|
+
expect(outerButtonSpy).toHaveReceivedEvent();
|
|
888
880
|
});
|
|
889
881
|
});
|
|
890
882
|
});
|
|
@@ -896,6 +888,7 @@ describe('q2-dropdown', () => {
|
|
|
896
888
|
lastOptionFocusSpy.events = [];
|
|
897
889
|
});
|
|
898
890
|
it('clears active elements when the popover is closed', async () => {
|
|
891
|
+
await dropdownButton.callMethod('focus');
|
|
899
892
|
await dropdownButton.press('ArrowDown');
|
|
900
893
|
await page.waitForChanges();
|
|
901
894
|
expect(popover).toHaveAttribute('open');
|
|
@@ -909,33 +902,39 @@ describe('q2-dropdown', () => {
|
|
|
909
902
|
expect(activeDropdownItem).toBeNull();
|
|
910
903
|
});
|
|
911
904
|
it('Escape: closes the popover and focuses the toggle button', async () => {
|
|
905
|
+
await dropdownButton.callMethod('focus');
|
|
912
906
|
await dropdownButton.press('ArrowDown');
|
|
913
907
|
await page.waitForChanges();
|
|
914
908
|
expect(popover).toHaveAttribute('open');
|
|
915
|
-
expect(buttonFocusSpy).
|
|
916
|
-
expect(firstOptionFocusSpy).
|
|
909
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
910
|
+
expect(firstOptionFocusSpy).toHaveReceivedEvent();
|
|
911
|
+
buttonFocusSpy.events = [];
|
|
917
912
|
await page.keyboard.press('Escape');
|
|
918
913
|
await page.waitForChanges();
|
|
919
914
|
expect(popover).not.toHaveAttribute('open');
|
|
920
|
-
expect(buttonFocusSpy).
|
|
915
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
921
916
|
expect(await getFocusedAttribute(page, 'test-id')).toEqual('dropdownButton');
|
|
922
917
|
});
|
|
923
918
|
it('Tab: closes the popover and focuses next element in tab order', async () => {
|
|
924
919
|
const outerButton = await page.find('button');
|
|
925
920
|
const outerButtonSpy = await outerButton.spyOnEvent('focus');
|
|
921
|
+
await dropdownButton.callMethod('focus');
|
|
926
922
|
await dropdownButton.press('ArrowDown');
|
|
927
923
|
await page.waitForChanges();
|
|
928
924
|
expect(popover).toHaveAttribute('open');
|
|
929
|
-
expect(buttonFocusSpy).
|
|
930
|
-
expect(firstOptionFocusSpy).
|
|
925
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
926
|
+
expect(firstOptionFocusSpy).toHaveReceivedEvent();
|
|
927
|
+
buttonFocusSpy.events = [];
|
|
928
|
+
outerButtonSpy.events = [];
|
|
931
929
|
await page.keyboard.press('Tab');
|
|
932
930
|
await page.waitForChanges();
|
|
933
931
|
expect(popover).not.toHaveAttribute('open');
|
|
934
|
-
expect(buttonFocusSpy).
|
|
935
|
-
expect(outerButtonSpy).
|
|
932
|
+
expect(buttonFocusSpy).toHaveReceivedEvent();
|
|
933
|
+
expect(outerButtonSpy).toHaveReceivedEvent();
|
|
936
934
|
expect(await getFocusedAttribute(page, 'test-id')).toEqual('outer-button');
|
|
937
935
|
});
|
|
938
936
|
it('ArrowUp: focuses the previous dropdown item', async () => {
|
|
937
|
+
await dropdownButton.callMethod('focus');
|
|
939
938
|
await dropdownButton.press('ArrowUp');
|
|
940
939
|
await page.waitForChanges();
|
|
941
940
|
expect(popover).toHaveAttribute('open');
|
|
@@ -946,6 +945,7 @@ describe('q2-dropdown', () => {
|
|
|
946
945
|
expect(firstOptionFocusSpy).toHaveReceivedEventTimes(1);
|
|
947
946
|
});
|
|
948
947
|
it('ArrowDown: focuses the next dropdown item', async () => {
|
|
948
|
+
await dropdownButton.callMethod('focus');
|
|
949
949
|
await dropdownButton.press('ArrowDown');
|
|
950
950
|
await page.waitForChanges();
|
|
951
951
|
expect(popover).toHaveAttribute('open');
|
|
@@ -955,6 +955,7 @@ describe('q2-dropdown', () => {
|
|
|
955
955
|
expect(lastOptionFocusSpy).toHaveReceivedEventTimes(1);
|
|
956
956
|
});
|
|
957
957
|
it('Space: selects the focused option', async () => {
|
|
958
|
+
await dropdownButton.callMethod('focus');
|
|
958
959
|
await dropdownButton.press('ArrowDown');
|
|
959
960
|
await page.waitForChanges();
|
|
960
961
|
expect(popover).toHaveAttribute('open');
|
|
@@ -971,6 +972,7 @@ describe('q2-dropdown', () => {
|
|
|
971
972
|
expect(await getFocusedAttribute(page, 'test-id')).toEqual('dropdownButton');
|
|
972
973
|
});
|
|
973
974
|
it('Enter: selects the focused option', async () => {
|
|
975
|
+
await dropdownButton.callMethod('focus');
|
|
974
976
|
await dropdownButton.press('ArrowDown');
|
|
975
977
|
await page.waitForChanges();
|
|
976
978
|
expect(popover).toHaveAttribute('open');
|