q2-tecton-elements 1.46.1 → 1.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/click-elsewhere_2.cjs.entry.js +48 -14
- package/dist/cjs/click-elsewhere_2.cjs.entry.js.map +1 -1
- package/dist/cjs/{index-0e15dc8d.js → index-a93362ed.js} +3 -3
- package/dist/cjs/index-a93362ed.js.map +1 -0
- package/dist/cjs/{index-59fb7c74.js → index-c385e32f.js} +1 -1
- package/dist/cjs/{index-59fb7c74.js.map → index-c385e32f.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +1 -1
- package/dist/cjs/q2-btn_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-calendar.cjs.entry.js +18 -4
- package/dist/cjs/q2-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-card.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-area.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-bar.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-donut.cjs.entry.js +9 -7
- package/dist/cjs/q2-chart-donut.cjs.entry.js.map +1 -1
- 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-data-table.cjs.entry.js +9 -6
- package/dist/cjs/q2-data-table.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-detail.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +14 -5
- package/dist/cjs/q2-dropdown-item.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +37 -28
- package/dist/cjs/q2-editable-field.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-icon.cjs.entry.js +1 -1
- package/dist/cjs/q2-input.cjs.entry.js +22 -3
- package/dist/cjs/q2-input.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-item.cjs.entry.js +2 -2
- package/dist/cjs/q2-item.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-legend.cjs.entry.js +1 -1
- package/dist/cjs/q2-legend.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-list.cjs.entry.js +1 -1
- package/dist/cjs/q2-loc.cjs.entry.js +1 -1
- package/dist/cjs/q2-message.cjs.entry.js +1 -1
- package/dist/cjs/q2-month-picker.cjs.entry.js +1 -1
- package/dist/cjs/q2-optgroup.cjs.entry.js +1 -1
- package/dist/cjs/q2-option-list.cjs.entry.js +3 -4
- package/dist/cjs/q2-option-list.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
- package/dist/cjs/q2-pill.cjs.entry.js +1 -1
- 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 +35 -18
- package/dist/cjs/q2-relative-time.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +3 -3
- package/dist/cjs/q2-section.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-select.cjs.entry.js +11 -4
- 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 +1 -1
- package/dist/cjs/q2-stepper.cjs.entry.js +3 -3
- package/dist/cjs/q2-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-tab-container.cjs.entry.js +2 -2
- package/dist/cjs/q2-tab-container.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-tag.cjs.entry.js +1 -1
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
- package/dist/cjs/q2-tooltip.cjs.entry.js +1 -1
- package/dist/collection/components/q2-calendar/q2-calendar.js +16 -2
- package/dist/collection/components/q2-calendar/q2-calendar.js.map +1 -1
- package/dist/collection/components/q2-chart-donut/q2-chart-donut.js +8 -6
- package/dist/collection/components/q2-chart-donut/q2-chart-donut.js.map +1 -1
- package/dist/collection/components/q2-data-table/q2-data-table.css +15 -1
- package/dist/collection/components/q2-data-table/q2-data-table.js +34 -14
- package/dist/collection/components/q2-data-table/q2-data-table.js.map +1 -1
- package/dist/collection/components/q2-dropdown-item/q2-dropdown-item.js +22 -5
- package/dist/collection/components/q2-dropdown-item/q2-dropdown-item.js.map +1 -1
- package/dist/collection/components/q2-editable-field/q2-editable-field.js +41 -29
- package/dist/collection/components/q2-editable-field/q2-editable-field.js.map +1 -1
- package/dist/collection/components/q2-icon/assets/icon-file-list.json +1 -0
- package/dist/collection/components/q2-icon/assets/standard.symbol.svg +1 -1
- package/dist/collection/components/q2-input/q2-input.js +123 -5
- package/dist/collection/components/q2-input/q2-input.js.map +1 -1
- package/dist/collection/components/q2-item/q2-item.js +1 -1
- package/dist/collection/components/q2-item/q2-item.js.map +1 -1
- package/dist/collection/components/q2-legend/q2-legend.css +1 -1
- package/dist/collection/components/q2-option-list/q2-option-list.js +4 -5
- package/dist/collection/components/q2-option-list/q2-option-list.js.map +1 -1
- package/dist/collection/components/q2-popover/q2-popover.js +47 -13
- package/dist/collection/components/q2-popover/q2-popover.js.map +1 -1
- package/dist/collection/components/q2-relative-time/q2-relative-time.js +79 -25
- package/dist/collection/components/q2-relative-time/q2-relative-time.js.map +1 -1
- package/dist/collection/components/q2-section/q2-section.js +7 -4
- package/dist/collection/components/q2-section/q2-section.js.map +1 -1
- package/dist/collection/components/q2-select/q2-select.js +16 -3
- package/dist/collection/components/q2-select/q2-select.js.map +1 -1
- package/dist/collection/components/q2-stepper/q2-stepper.js +2 -2
- package/dist/collection/components/q2-stepper/q2-stepper.js.map +1 -1
- package/dist/collection/components/q2-stepper-pane/q2-stepper-pane.js +2 -2
- package/dist/collection/components/q2-tab-container/q2-tab-container.css +2 -1
- package/dist/collection/utils/index.js +2 -2
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/index2.js.map +1 -1
- package/dist/components/q2-calendar.js +16 -2
- package/dist/components/q2-calendar.js.map +1 -1
- package/dist/components/q2-chart-donut.js +8 -6
- package/dist/components/q2-chart-donut.js.map +1 -1
- package/dist/components/q2-data-table.js +10 -6
- package/dist/components/q2-data-table.js.map +1 -1
- package/dist/components/q2-dropdown-item2.js +16 -6
- package/dist/components/q2-dropdown-item2.js.map +1 -1
- package/dist/components/q2-editable-field.js +37 -28
- package/dist/components/q2-editable-field.js.map +1 -1
- package/dist/components/q2-input2.js +26 -3
- package/dist/components/q2-input2.js.map +1 -1
- package/dist/components/q2-item.js +1 -1
- package/dist/components/q2-item.js.map +1 -1
- package/dist/components/q2-legend2.js +1 -1
- package/dist/components/q2-legend2.js.map +1 -1
- package/dist/components/q2-option-list2.js +2 -3
- package/dist/components/q2-option-list2.js.map +1 -1
- package/dist/components/q2-popover2.js +47 -13
- package/dist/components/q2-popover2.js.map +1 -1
- package/dist/components/q2-relative-time.js +37 -18
- package/dist/components/q2-relative-time.js.map +1 -1
- package/dist/components/q2-section.js +2 -2
- package/dist/components/q2-section.js.map +1 -1
- package/dist/components/q2-select2.js +11 -4
- package/dist/components/q2-select2.js.map +1 -1
- package/dist/components/q2-stepper.js +2 -2
- package/dist/components/q2-stepper.js.map +1 -1
- package/dist/components/q2-tab-container.js +1 -1
- package/dist/components/q2-tab-container.js.map +1 -1
- package/dist/esm/click-elsewhere_2.entry.js +48 -14
- package/dist/esm/click-elsewhere_2.entry.js.map +1 -1
- package/dist/esm/{index-0a702dd6.js → index-3c5cd75e.js} +3 -3
- package/dist/esm/index-3c5cd75e.js.map +1 -0
- package/dist/esm/{index-c99c4cc6.js → index-f0dfb099.js} +1 -1
- package/dist/esm/{index-c99c4cc6.js.map → index-f0dfb099.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-sheet.entry.js +1 -1
- package/dist/esm/q2-btn_2.entry.js +1 -1
- package/dist/esm/q2-calendar.entry.js +18 -4
- package/dist/esm/q2-calendar.entry.js.map +1 -1
- package/dist/esm/q2-card.entry.js +1 -1
- package/dist/esm/q2-carousel-pane.entry.js +1 -1
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-chart-area.entry.js +1 -1
- package/dist/esm/q2-chart-bar.entry.js +1 -1
- package/dist/esm/q2-chart-donut.entry.js +9 -7
- package/dist/esm/q2-chart-donut.entry.js.map +1 -1
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +1 -1
- package/dist/esm/q2-data-table.entry.js +9 -6
- package/dist/esm/q2-data-table.entry.js.map +1 -1
- package/dist/esm/q2-detail.entry.js +1 -1
- package/dist/esm/q2-dropdown-item.entry.js +14 -5
- package/dist/esm/q2-dropdown-item.entry.js.map +1 -1
- package/dist/esm/q2-dropdown.entry.js +1 -1
- package/dist/esm/q2-editable-field.entry.js +37 -28
- package/dist/esm/q2-editable-field.entry.js.map +1 -1
- package/dist/esm/q2-icon.entry.js +1 -1
- package/dist/esm/q2-input.entry.js +22 -3
- package/dist/esm/q2-input.entry.js.map +1 -1
- package/dist/esm/q2-item.entry.js +2 -2
- package/dist/esm/q2-item.entry.js.map +1 -1
- package/dist/esm/q2-legend.entry.js +1 -1
- package/dist/esm/q2-legend.entry.js.map +1 -1
- package/dist/esm/q2-list.entry.js +1 -1
- package/dist/esm/q2-loc.entry.js +1 -1
- package/dist/esm/q2-message.entry.js +1 -1
- package/dist/esm/q2-month-picker.entry.js +1 -1
- package/dist/esm/q2-optgroup.entry.js +1 -1
- package/dist/esm/q2-option-list.entry.js +3 -4
- package/dist/esm/q2-option-list.entry.js.map +1 -1
- package/dist/esm/q2-pagination.entry.js +1 -1
- package/dist/esm/q2-pill.entry.js +1 -1
- 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 +35 -18
- package/dist/esm/q2-relative-time.entry.js.map +1 -1
- package/dist/esm/q2-section.entry.js +3 -3
- package/dist/esm/q2-section.entry.js.map +1 -1
- package/dist/esm/q2-select.entry.js +11 -4
- 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 +1 -1
- package/dist/esm/q2-stepper.entry.js +3 -3
- package/dist/esm/q2-stepper.entry.js.map +1 -1
- package/dist/esm/q2-tab-container.entry.js +2 -2
- package/dist/esm/q2-tab-container.entry.js.map +1 -1
- package/dist/esm/q2-tag.entry.js +1 -1
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +1 -1
- package/dist/esm/q2-tooltip.entry.js +1 -1
- package/dist/q2-tecton-elements/assets/icon-file-list.json +1 -0
- package/dist/q2-tecton-elements/assets/standard.symbol.svg +1 -1
- package/dist/q2-tecton-elements/p-11982614.entry.js +2 -0
- package/dist/q2-tecton-elements/p-11982614.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-57bf9342.entry.js → p-1b89b9c3.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-2a248a3f.entry.js → p-1d824cdf.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-0bc47914.entry.js → p-23183c61.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-24719520.entry.js +2 -0
- package/dist/q2-tecton-elements/p-24719520.entry.js.map +1 -0
- package/dist/q2-tecton-elements/p-24d96969.entry.js +2 -0
- package/dist/q2-tecton-elements/p-24d96969.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-f1265647.entry.js → p-2d6a9a94.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-30296b0e.entry.js +2 -0
- package/dist/q2-tecton-elements/p-30296b0e.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-4570ff06.entry.js → p-30d70f4a.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-d60ccf2f.entry.js → p-32b56406.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-d60ccf2f.entry.js.map → p-32b56406.entry.js.map} +1 -1
- package/dist/q2-tecton-elements/{p-79df783e.entry.js → p-33af97b0.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-47868d6d.entry.js → p-35cc1039.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-6559c942.js → p-3c42c90f.js} +1 -1
- package/dist/q2-tecton-elements/{p-dc057a9c.entry.js → p-3f665c56.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-12326313.entry.js → p-3fe532bc.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-43236cac.entry.js +2 -0
- package/dist/q2-tecton-elements/p-43236cac.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-ef441885.entry.js → p-4b47816d.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-bf32fd9c.entry.js → p-4f7e6e79.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-4f7e6e79.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-e762526f.entry.js → p-56dd051a.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-56dd051a.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-d635e39f.entry.js → p-63038a54.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-e27a23fc.entry.js → p-66ae329f.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-6986a60e.entry.js +2 -0
- package/dist/q2-tecton-elements/p-6986a60e.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-dd670d63.entry.js → p-6fdda37e.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-6fdda37e.entry.js.map +1 -0
- package/dist/q2-tecton-elements/p-75bb43b2.entry.js +2 -0
- package/dist/q2-tecton-elements/p-75bb43b2.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-4f2dfb4d.entry.js → p-76be9cad.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-4194d6ed.entry.js → p-7cbb989e.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-81b76d40.entry.js → p-7dafc5da.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-2132da06.entry.js → p-81bb9436.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-84190698.js +2 -0
- package/dist/q2-tecton-elements/p-84190698.js.map +1 -0
- package/dist/q2-tecton-elements/{p-515d424b.entry.js → p-8a00552f.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-d8fba914.entry.js → p-8fc099f5.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-9a71bd16.entry.js +2 -0
- package/dist/q2-tecton-elements/p-9a71bd16.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-fe3c62e0.entry.js → p-9eafabd5.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-ac9414a6.entry.js → p-a03c29f3.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-2c57a367.entry.js → p-a891571c.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-f2251261.entry.js → p-abe30d0c.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-18ec54c0.entry.js → p-ca17f7ca.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-bc141c5b.entry.js → p-ca43e917.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-16891e51.entry.js → p-d75e4752.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-dd18416f.entry.js +2 -0
- package/dist/q2-tecton-elements/p-dd18416f.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-ca7ad3c3.entry.js → p-f18caa3f.entry.js} +2 -2
- package/dist/q2-tecton-elements/{p-85003c5b.entry.js → p-f4b28e89.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-f4b28e89.entry.js.map +1 -0
- package/dist/q2-tecton-elements/{p-32e57e9f.entry.js → p-fb7dd7ab.entry.js} +2 -2
- package/dist/q2-tecton-elements/p-fb7dd7ab.entry.js.map +1 -0
- 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/test/elements/q2-calendar-test.e2e.js +33 -35
- package/dist/test/elements/q2-calendar-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-chart-donut-test.e2e.js +9 -1
- package/dist/test/elements/q2-chart-donut-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-data-table-test.e2e.js +107 -11
- package/dist/test/elements/q2-data-table-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-dropdown-item-test.e2e.js +183 -104
- package/dist/test/elements/q2-dropdown-item-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-editable-field-test.e2e.js +436 -418
- package/dist/test/elements/q2-editable-field-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-input-test.e2e.js +53 -0
- package/dist/test/elements/q2-input-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-popover-test.spec.js +162 -31
- package/dist/test/elements/q2-popover-test.spec.js.map +1 -1
- package/dist/test/elements/q2-relative-time-test.e2e.js +65 -40
- package/dist/test/elements/q2-relative-time-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-select-test.e2e.js +94 -29
- package/dist/test/elements/q2-select-test.e2e.js.map +1 -1
- package/dist/test/elements/q2-stepper-test.e2e.js +23 -0
- package/dist/test/elements/q2-stepper-test.e2e.js.map +1 -1
- package/dist/types/components/q2-input/q2-input.d.ts +38 -1
- package/dist/types/components/q2-popover/q2-popover.d.ts +2 -0
- package/dist/types/components/q2-relative-time/q2-relative-time.d.ts +25 -11
- package/dist/types/components/q2-section/q2-section.d.ts +10 -2
- package/dist/types/components.d.ts +81 -24
- package/dist/types/workspace/workspace/{tecton-production_release_1.46.x → _Gitlab_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cjs/index-0e15dc8d.js.map +0 -1
- package/dist/esm/index-0a702dd6.js.map +0 -1
- package/dist/q2-tecton-elements/p-245ad08f.entry.js +0 -2
- package/dist/q2-tecton-elements/p-245ad08f.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-32e57e9f.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-36398b59.entry.js +0 -2
- package/dist/q2-tecton-elements/p-36398b59.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-42302f6f.js +0 -2
- package/dist/q2-tecton-elements/p-42302f6f.js.map +0 -1
- package/dist/q2-tecton-elements/p-65ed80a5.entry.js +0 -2
- package/dist/q2-tecton-elements/p-65ed80a5.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-85003c5b.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-97a98211.entry.js +0 -2
- package/dist/q2-tecton-elements/p-97a98211.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-aec64fcb.entry.js +0 -2
- package/dist/q2-tecton-elements/p-aec64fcb.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-be101dcf.entry.js +0 -2
- package/dist/q2-tecton-elements/p-be101dcf.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-bf32fd9c.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-ca0d7eb3.entry.js +0 -2
- package/dist/q2-tecton-elements/p-ca0d7eb3.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-ca7dad64.entry.js +0 -2
- package/dist/q2-tecton-elements/p-ca7dad64.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-dd670d63.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-e762526f.entry.js.map +0 -1
- package/dist/q2-tecton-elements/p-f45b3488.entry.js +0 -2
- package/dist/q2-tecton-elements/p-f45b3488.entry.js.map +0 -1
- /package/dist/q2-tecton-elements/{p-57bf9342.entry.js.map → p-1b89b9c3.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-2a248a3f.entry.js.map → p-1d824cdf.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-0bc47914.entry.js.map → p-23183c61.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-f1265647.entry.js.map → p-2d6a9a94.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-4570ff06.entry.js.map → p-30d70f4a.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-79df783e.entry.js.map → p-33af97b0.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-47868d6d.entry.js.map → p-35cc1039.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-6559c942.js.map → p-3c42c90f.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-dc057a9c.entry.js.map → p-3f665c56.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-12326313.entry.js.map → p-3fe532bc.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-ef441885.entry.js.map → p-4b47816d.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-d635e39f.entry.js.map → p-63038a54.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-e27a23fc.entry.js.map → p-66ae329f.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-4f2dfb4d.entry.js.map → p-76be9cad.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-4194d6ed.entry.js.map → p-7cbb989e.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-81b76d40.entry.js.map → p-7dafc5da.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-2132da06.entry.js.map → p-81bb9436.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-515d424b.entry.js.map → p-8a00552f.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-d8fba914.entry.js.map → p-8fc099f5.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-fe3c62e0.entry.js.map → p-9eafabd5.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-ac9414a6.entry.js.map → p-a03c29f3.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-2c57a367.entry.js.map → p-a891571c.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-f2251261.entry.js.map → p-abe30d0c.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-18ec54c0.entry.js.map → p-ca17f7ca.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-bc141c5b.entry.js.map → p-ca43e917.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-16891e51.entry.js.map → p-d75e4752.entry.js.map} +0 -0
- /package/dist/q2-tecton-elements/{p-ca7ad3c3.entry.js.map → p-f18caa3f.entry.js.map} +0 -0
- /package/dist/types/workspace/workspace/{tecton-production_release_1.46.x → _Gitlab_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/elements/q2-detail/slot-component.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"q2-popover2.js","mappings":";;;AAAA,MAAM,YAAY,GAAG,wgFAAwgF,CAAC;AAC9hF,wBAAe,YAAY;;MCed,SAAS;;;;;;;;;QAyClB,kBAAa,GAAG,EAAE,CAAC;;QAGnB,uBAAkB,GAAY,KAAK,CAAC;;QA4EpC,oBAAe,GAAG;YACd,IAAI,IAAI,CAAC,SAAS,EAAE;gBAChB,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;aACvD;SACJ,CAAC;QAEF,oBAAe,GAAG;YACd,IAAI,CAAC,IAAI,CAAC,IAAI;gBAAE,OAAO;YACvB,IAAI,CAAC,qBAAqB,EAAE,CAAC;SAChC,CAAC;QAEF,+BAA0B,GAAG;YACzB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAC/B,IAAI,CAAC,eAAe,EAAE,CAAC;SAC1B,CAAC;QAoBF,0BAAqB,GAAG;;YACpB,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;YACpE,MAAM,EACF,GAAG,EAAE,U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CAAC,CAAC;iBACrF;gBACD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;gBAC/B,MAAM;YACV,KAAK,MAAM;gBACP,IAAI,qBAAqB,EAAE;oBACvB,gBAAgB,CAAC,KAAK,CAAC,WAAW,CAAC,uBAAuB,EAAE,GAAG,aAAa,IAAI,CAAC,CAAC;iBACrF;gBACD,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;gBACjC,MAAM;SAGb;KACJ;;IAGD,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,QACI,4DACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,aACzB,gBAAgB,IAExB,4DACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,KAAK,EAAC,SAAS,IAEf,8DAAQ,CACN,CACJ,EACR;KACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/q2-popover/q2-popover.scss?tag=q2-popover&encapsulation=shadow","src/components/q2-popover/q2-popover.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n.container {\n display: none;\n}\n\n.show {\n display: block;\n position: fixed;\n z-index: var-list(--tct-popover-z-index, 50);\n margin: 0;\n padding: 0;\n overflow: auto;\n background: var-list(--tct-popover-background, --app-white, #ffffff);\n color: var-list(--tct-popover-font-color, --t-text, #4d4d4d);\n min-width: var-list(--tct-popover-min-width, 135px);\n margin-block: var-list(--tct-popover-margin-block, 0);\n box-shadow: var-list(--tct-popover-box-shadow, --app-shadow-1, unquote('0 2px 4px rgba(0, 0, 0, 0.3)'));\n border-width: var-list(--tct-popover-border-width, 0);\n border-style: solid;\n border-color: var-list(--tct-popover-border-color, transparent);\n border-radius: var-list(--tct-popover-border-radius, 0);\n // the following --comp variables are set via JS\n max-height: var(--comp-pop-max-height);\n left: var(--comp-pop-left);\n opacity: var(--comp-pop-opacity, 0);\n\n :host([block]) & {\n right: unset;\n width: var(--comp-pop-width);\n min-width: var-list(--tct-popover-min-width, unset);\n }\n\n :host([align='left']) & {\n left: var(--comp-pop-left);\n right: unset;\n }\n\n :host([align='right']) & {\n right: var(--comp-pop-right);\n left: unset;\n }\n\n &.down {\n top: var-list(--tct-popover-top, --comp-pop-top);\n bottom: unset;\n }\n\n &.up {\n top: unset;\n bottom: var(--comp-pop-bottom);\n }\n\n &.legacy {\n position: absolute;\n }\n\n @include tiny-scrollbar();\n}\n\nclick-elsewhere {\n position: relative;\n display: block;\n}\n","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@Component({ tag: 'q2-popover', shadow: true, styleUrl: 'q2-popover.scss' })\nexport class Q2Popover implements ComponentInterface {\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 }) direction: 'up' | 'down';\n\n /** Aligns the popover to the left or right side of the control element. */\n @Prop({ reflect: true }) align: 'left' | 'right';\n\n /** Controls whether the popover is open or closed. */\n @Prop({ reflect: true, mutable: true }) open: boolean;\n\n /** Indicates the popover will match the width of its parent element. */\n @Prop({ reflect: true }) block: boolean;\n\n /** The element that controls the popover's behavior. */\n @Prop() controlElement: HTMLElement;\n\n @Prop() mode: 'legacy' = null;\n\n /** @deprecated */\n @Prop() minHeight: number;\n\n @Element() hostElement: HTMLElement;\n\n /**\n * Emitted when the popover is opened or closed.\n */\n @Event() popoverStateChanged: EventEmitter<{ open: boolean }>;\n\n @State() currentDirection: 'down' | 'up' = undefined;\n // remove `show` when Popover API is supported in iOS\n @State() show: boolean = false;\n\n containerElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n\n /**\n * The number of pixels to leave between the popover and the edge of the viewport\n */\n displayBuffer = 10;\n\n /** remove when Popover API is supported in iOS */\n orientationChanged: boolean = false;\n\n /// Lifecycle hooks ///\n componentDidLoad() {\n this.handleMinHeight();\n if (this.open) this.determinePopDirection();\n }\n\n disconnectedCallback() {\n this.removeViewportListeners();\n }\n\n /// Methods ///\n @Method()\n async toggle() {\n this.open = !this.open;\n }\n\n @Method()\n async scrollContainerTo(options: ScrollToOptions) {\n this.containerElement.scrollTo(options);\n }\n\n /// Watchers ///\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 this.show = false;\n await waitForNextPaint();\n this.clearCSSProperties();\n }\n }\n\n @Watch('minHeight')\n minHeightProvided() {\n this.handleMinHeight();\n }\n\n /// Listeners ///\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 /// Getters ///\n get actualDirection(): '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 isModule() {\n const isIframe = window !== window.top;\n const hasPlatformDimensions = Object.keys(window.Tecton?.platformDimensions ?? {}).length > 0;\n return isIframe && hasPlatformDimensions;\n }\n\n /// Helpers ///\n handleMinHeight = () => {\n if (this.minHeight) {\n handleDeprecationWarning(this, 'minHeight', 'prop');\n }\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 addViewportListeners() {\n window.addEventListener('resize', this.viewPortOrientationChanged);\n // #region remove when Popover API is supported in iOS\n window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });\n screen?.orientation?.addEventListener('change', this.viewPortOrientationChanged);\n window.addEventListener('orientationchange', this.viewPortOrientationChanged);\n // #endregion\n }\n\n removeViewportListeners() {\n window.removeEventListener('resize', this.viewPortOrientationChanged);\n // #region remove when Popover API is supported in iOS\n window.removeEventListener('scroll', this.viewPortChanged);\n screen?.orientation?.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n window.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n // #endregion\n }\n\n setFixedCSSProperties = async () => {\n const { controlElement, containerElement, currentDirection } = 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;\n const popoverRight: number = window.visualViewport.width - controlRight;\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('--comp-pop-right', `${popoverRight}px`);\n\n if (currentDirection === 'up') {\n containerElement.style.setProperty('--comp-pop-bottom', `${window.visualViewport.height - controlTop}px`);\n }\n if (currentDirection === 'down') {\n containerElement.style.setProperty('--comp-pop-top', `${controlBottom}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 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 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 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 this.show = true;\n if (this.mode === 'legacy') {\n this.setAbsoluteCSSProperties();\n } else {\n this.setFixedCSSProperties();\n }\n }\n\n async determinePopDirection() {\n const { containerElement, controlElement, actualDirection, 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 platformDimensions = window.Tecton?.platformDimensions;\n const distanceToIframeBottom = window.visualViewport.height - controlBottom;\n const viewableSpaceBelow =\n platformDimensions.innerHeight - (platformDimensions.outletOffset + controlBottom);\n const isIframeShorterThanWindow = distanceToIframeBottom < viewableSpaceBelow;\n windowHeight = platformDimensions.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 =\n (platformDimensions.outletOffset > 0 ? controlTop : controlTop + platformDimensions.outletOffset) -\n 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 || actualDirection || directionWithMostSpace;\n\n switch (currentOrDetermineDirection) {\n case 'up':\n if (shouldUpdateMaxHeight) {\n containerElement.style.setProperty('--comp-pop-max-height', `${maxSpaceAbove}px`);\n }\n this.setDirectionAndShow('up');\n break;\n case 'down':\n if (shouldUpdateMaxHeight) {\n containerElement.style.setProperty('--comp-pop-max-height', `${maxSpaceBelow}px`);\n }\n this.setDirectionAndShow('down');\n break;\n default:\n break;\n }\n }\n\n /// DOM ///\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 >\n <div\n ref={el => (this.contentElement = el)}\n class=\"content\"\n >\n <slot />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"q2-popover2.js","mappings":";;;AAAA,MAAM,YAAY,GAAG,wgFAAwgF,C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AAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5D,QACI,4DACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,aACzB,gBAAgB,IAExB,4DACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,KAAK,EAAC,SAAS,IAEf,8DAAQ,CACN,CACJ,EACR;KACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/q2-popover/q2-popover.scss?tag=q2-popover&encapsulation=shadow","src/components/q2-popover/q2-popover.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n.container {\n display: none;\n}\n\n.show {\n display: block;\n position: fixed;\n z-index: var-list(--tct-popover-z-index, 50);\n margin: 0;\n padding: 0;\n overflow: auto;\n background: var-list(--tct-popover-background, --app-white, #ffffff);\n color: var-list(--tct-popover-font-color, --t-text, #4d4d4d);\n min-width: var-list(--tct-popover-min-width, 135px);\n margin-block: var-list(--tct-popover-margin-block, 0);\n box-shadow: var-list(--tct-popover-box-shadow, --app-shadow-1, unquote('0 2px 4px rgba(0, 0, 0, 0.3)'));\n border-width: var-list(--tct-popover-border-width, 0);\n border-style: solid;\n border-color: var-list(--tct-popover-border-color, transparent);\n border-radius: var-list(--tct-popover-border-radius, 0);\n // the following --comp variables are set via JS\n max-height: var(--comp-pop-max-height);\n left: var(--comp-pop-left);\n opacity: var(--comp-pop-opacity, 0);\n\n :host([block]) & {\n right: unset;\n width: var(--comp-pop-width);\n min-width: var-list(--tct-popover-min-width, unset);\n }\n\n :host([align='left']) & {\n left: var(--comp-pop-left);\n right: unset;\n }\n\n :host([align='right']) & {\n right: var(--comp-pop-right);\n left: unset;\n }\n\n &.down {\n top: var-list(--tct-popover-top, --comp-pop-top);\n bottom: unset;\n }\n\n &.up {\n top: unset;\n bottom: var(--comp-pop-bottom);\n }\n\n &.legacy {\n position: absolute;\n }\n\n @include tiny-scrollbar();\n}\n\nclick-elsewhere {\n position: relative;\n display: block;\n}\n","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@Component({ tag: 'q2-popover', shadow: true, styleUrl: 'q2-popover.scss' })\nexport class Q2Popover implements ComponentInterface {\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 }) direction: 'up' | 'down';\n\n /** Aligns the popover to the left or right side of the control element. */\n @Prop({ reflect: true }) align: 'left' | 'right';\n\n /** Controls whether the popover is open or closed. */\n @Prop({ reflect: true, mutable: true }) open: boolean;\n\n /** Indicates the popover will match the width of its parent element. */\n @Prop({ reflect: true }) block: boolean;\n\n /** The element that controls the popover's behavior. */\n @Prop() controlElement: HTMLElement;\n\n @Prop() mode: 'legacy' = null;\n\n /** @deprecated */\n @Prop() minHeight: number;\n\n @Element() hostElement: HTMLElement;\n\n /**\n * Emitted when the popover is opened or closed.\n */\n @Event() popoverStateChanged: EventEmitter<{ open: boolean }>;\n\n @State() currentDirection: 'down' | 'up' = undefined;\n // remove `show` when Popover API is supported in iOS\n @State() show: boolean = false;\n\n containerElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n rootElementRect: DOMRect;\n\n /**\n * The number of pixels to leave between the popover and the edge of the viewport\n */\n displayBuffer = 10;\n\n /** remove when Popover API is supported in iOS */\n orientationChanged: boolean = false;\n\n /// Lifecycle hooks ///\n componentDidLoad() {\n this.handleMinHeight();\n if (this.open) this.determinePopDirection();\n }\n\n disconnectedCallback() {\n this.removeViewportListeners();\n }\n\n /// Methods ///\n @Method()\n async toggle() {\n this.open = !this.open;\n }\n\n @Method()\n async scrollContainerTo(options: ScrollToOptions) {\n this.containerElement.scrollTo(options);\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 /// Watchers ///\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 @Watch('minHeight')\n minHeightProvided() {\n this.handleMinHeight();\n }\n\n /// Listeners ///\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 /// Getters ///\n get actualDirection(): '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 isModule() {\n const isIframe = window !== window.top;\n const hasPlatformDimensions = Object.keys(window.Tecton?.platformDimensions ?? {}).length > 0;\n return isIframe && hasPlatformDimensions;\n }\n\n /// Helpers ///\n handleMinHeight = () => {\n if (this.minHeight) {\n handleDeprecationWarning(this, 'minHeight', 'prop');\n }\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 addViewportListeners() {\n window.addEventListener('resize', this.viewPortOrientationChanged);\n // #region remove when Popover API is supported in iOS\n window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });\n screen?.orientation?.addEventListener('change', this.viewPortOrientationChanged);\n window.addEventListener('orientationchange', this.viewPortOrientationChanged);\n // #endregion\n }\n\n removeViewportListeners() {\n window.removeEventListener('resize', this.viewPortOrientationChanged);\n // #region remove when Popover API is supported in iOS\n window.removeEventListener('scroll', this.viewPortChanged);\n screen?.orientation?.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n window.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n // #endregion\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 containerElement.style.setProperty(\n '--comp-pop-bottom',\n `${rootElementRect.height + rootElementRect.top - controlTop}px`\n );\n }\n if (currentDirection === 'down') {\n containerElement.style.setProperty('--comp-pop-top', `${controlBottom - rootElementRect.top}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 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 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 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 async determinePopDirection() {\n const { containerElement, controlElement, actualDirection, 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 || actualDirection || directionWithMostSpace;\n\n switch (currentOrDetermineDirection) {\n case 'up':\n if (shouldUpdateMaxHeight) {\n containerElement.style.setProperty('--comp-pop-max-height', `${maxSpaceAbove}px`);\n }\n this.setDirectionAndShow('up');\n break;\n case 'down':\n if (shouldUpdateMaxHeight) {\n containerElement.style.setProperty('--comp-pop-max-height', `${maxSpaceBelow}px`);\n }\n this.setDirectionAndShow('down');\n break;\n default:\n break;\n }\n }\n\n /// DOM ///\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 >\n <div\n ref={el => (this.contentElement = el)}\n class=\"content\"\n >\n <slot />\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Fragment } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as dateFns } from './index3.js';
|
|
3
|
+
import { l as loc } from './index2.js';
|
|
3
4
|
|
|
4
5
|
const q2RelativeTimeCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:inline}";
|
|
5
6
|
const Q2RelativeTimeStyle0 = q2RelativeTimeCss;
|
|
@@ -41,21 +42,29 @@ const Q2RelativeTime$1 = /*@__PURE__*/ proxyCustomElement(class Q2RelativeTime e
|
|
|
41
42
|
get shouldShow() {
|
|
42
43
|
return !!this.displayedMessage;
|
|
43
44
|
}
|
|
44
|
-
get
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
get handleDate() {
|
|
49
|
-
if (!this.validDate)
|
|
45
|
+
get isValidDate() {
|
|
46
|
+
const date = new Date(this.date);
|
|
47
|
+
const isValid = dateFns.isValid(date);
|
|
48
|
+
if (!isValid)
|
|
50
49
|
console.warn('Error: Invalid date provided to q2-relative-time.');
|
|
50
|
+
return isValid;
|
|
51
|
+
}
|
|
52
|
+
get dateObject() {
|
|
51
53
|
return new Date(this.date);
|
|
52
54
|
}
|
|
53
|
-
get
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
get isBaseDateProvided() {
|
|
56
|
+
return this.baseDate !== undefined;
|
|
57
|
+
}
|
|
58
|
+
get isValidBaseDate() {
|
|
59
|
+
const date = new Date(this.baseDate);
|
|
60
|
+
const isValid = dateFns.isValid(date);
|
|
61
|
+
if (!isValid && this.isBaseDateProvided) {
|
|
62
|
+
console.warn('Error: Invalid baseDate provided to q2-relative-time.');
|
|
63
|
+
}
|
|
64
|
+
return isValid;
|
|
56
65
|
}
|
|
57
|
-
get
|
|
58
|
-
if (this.
|
|
66
|
+
get baseDateObject() {
|
|
67
|
+
if (this.isBaseDateProvided && this.isValidBaseDate) {
|
|
59
68
|
this.trimSuffix = true;
|
|
60
69
|
this.sync = false;
|
|
61
70
|
return new Date(this.baseDate);
|
|
@@ -72,7 +81,7 @@ const Q2RelativeTime$1 = /*@__PURE__*/ proxyCustomElement(class Q2RelativeTime e
|
|
|
72
81
|
return false;
|
|
73
82
|
}
|
|
74
83
|
get handleNumeric() {
|
|
75
|
-
if (this.
|
|
84
|
+
if (this.isValidBaseDate)
|
|
76
85
|
return 'always';
|
|
77
86
|
return this.numeric;
|
|
78
87
|
}
|
|
@@ -89,13 +98,13 @@ const Q2RelativeTime$1 = /*@__PURE__*/ proxyCustomElement(class Q2RelativeTime e
|
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
updateMessage() {
|
|
92
|
-
const {
|
|
93
|
-
if (!
|
|
101
|
+
const { isValidDate, isBaseDateProvided, isValidBaseDate, dateObject, baseDateObject, locale, handleNumeric, messageFormat, isValidUnit, unit, trimSuffix, } = this;
|
|
102
|
+
if (!isValidDate || (isBaseDateProvided && !isValidBaseDate)) {
|
|
94
103
|
this.sync = false;
|
|
95
|
-
this.displayedMessage = '
|
|
104
|
+
this.displayedMessage = loc('tecton.element.relativeTime.invalidDate');
|
|
96
105
|
return;
|
|
97
106
|
}
|
|
98
|
-
const message = dateFns.intlFormatDistance(new Date(
|
|
107
|
+
const message = dateFns.intlFormatDistance(new Date(dateObject), new Date(baseDateObject), {
|
|
99
108
|
locale,
|
|
100
109
|
localeMatcher: 'best fit',
|
|
101
110
|
numeric: handleNumeric,
|
|
@@ -118,10 +127,18 @@ const Q2RelativeTime$1 = /*@__PURE__*/ proxyCustomElement(class Q2RelativeTime e
|
|
|
118
127
|
async displayedMessageValue() {
|
|
119
128
|
return this.displayedMessage;
|
|
120
129
|
}
|
|
130
|
+
/** Checks the provided date prop is a valid date. */
|
|
131
|
+
async validDateProp() {
|
|
132
|
+
return this.isValidDate;
|
|
133
|
+
}
|
|
134
|
+
/** Checks the provided baseDate prop is a valid date. */
|
|
135
|
+
async validBaseDateProp() {
|
|
136
|
+
return this.isValidBaseDate;
|
|
137
|
+
}
|
|
121
138
|
/// DOM ///
|
|
122
139
|
render() {
|
|
123
140
|
const { shouldShow, displayedMessage } = this;
|
|
124
|
-
return h(Fragment, { key: '
|
|
141
|
+
return h(Fragment, { key: 'bc05bc398a991b70bb5c19adde0d739768db76cd' }, shouldShow ? h("time", { dateTime: displayedMessage }, displayedMessage) : null);
|
|
125
142
|
}
|
|
126
143
|
get hostElement() { return this; }
|
|
127
144
|
static get watchers() { return {
|
|
@@ -143,7 +160,9 @@ const Q2RelativeTime$1 = /*@__PURE__*/ proxyCustomElement(class Q2RelativeTime e
|
|
|
143
160
|
"date": [513],
|
|
144
161
|
"unit": [513],
|
|
145
162
|
"displayedMessage": [32],
|
|
146
|
-
"displayedMessageValue": [64]
|
|
163
|
+
"displayedMessageValue": [64],
|
|
164
|
+
"validDateProp": [64],
|
|
165
|
+
"validBaseDateProp": [64]
|
|
147
166
|
}, undefined, {
|
|
148
167
|
"sync": ["syncUpdated"],
|
|
149
168
|
"messageFormat": ["updateMessage"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"q2-relative-time.js","mappings":";;;AAAA,MAAM,iBAAiB,GAAG,8qBAA8qB,CAAC;AACzsB,6BAA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;QAEH,IAAI,UAAU,EAAE;YACZ,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SACrD;aAAM;YACH,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;SACnC;KACJ;;IAGD,WAAW,CAAC,OAAe;QACvB,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;KAC9D;;;IAKD,MAAM,qBAAqB;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC;KAChC;;IAID,MAAM;QACF,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;QAE9C,OAAO,EAAC,QAAQ,uDAAE,UAAU,GAAG,YAAM,QAAQ,EAAE,gBAAgB,IAAG,gBAAgB,CAAQ,GAAG,IAAI,CAAY,CAAC;KACjH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Q2RelativeTime","isValidDate","intlFormatDistance"],"sources":["src/components/q2-relative-time/q2-relative-time.scss?tag=q2-relative-time&encapsulation=shadow","src/components/q2-relative-time/q2-relative-time.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n:host {\n display: inline;\n}\n","import { Component, Prop, State, Method, Watch, Element, h, ComponentInterface, Fragment } from '@stencil/core';\nimport { isValid as isValidDate, intlFormatDistance } from 'date-fns';\n\n@Component({ tag: 'q2-relative-time', shadow: true, styleUrl: 'q2-relative-time.scss' })\nexport class Q2RelativeTime implements ComponentInterface {\n /**\n * If you want to compare two specific dates, you can provide a valid `date` and `baseDate`, and the component will tell you the elapsed time between the two dates.\n * If `baseDate` is not provided, the date and time at render will be used instead and - if `sync` is true - updated every second to reflect the time between the `date` value and now.\n * @warning\n * - Requires a valid `date` value.\n * - Providing a valid `baseDate` will disable `sync` and remove the \"in\"/\"ago\" suffixes in the time message.\n * - Must be a valid ISO date string.\n */\n @Prop({ reflect: true }) baseDate: Date | string;\n\n /**\n * The language used for the relative time message.\n * @info\n * It is recommended to use the BCP 47 Language Tags in the ['language-extlang' format](https://www.w3.org/International/articles/language-tags/).\n */\n @Prop({ reflect: true }) locale: string = document.documentElement.lang || 'en-US';\n\n /** The length of the relative time message. */\n @Prop({ reflect: true }) messageFormat: 'long' | 'short' | 'narrow' = 'short';\n\n /** Set this to `always` to force the use of numeric values (e.g. \"1 day ago\") rather than relative ones (e.g. \"yesterday\") in the time message. */\n @Prop({ reflect: true }) numeric: 'always' | 'auto' = 'auto';\n\n /**\n * Keep the displayed message updated as time passes in the webpage.\n * @warning\n * If a valid `baseDate` is provided, `sync` will be set to `false`.\n */\n @Prop({ reflect: true, mutable: true }) sync: boolean = true;\n\n /**\n * The date you want to calculate relative time from.\n * @warning\n * Must be a valid ISO date string.\n */\n @Prop({ reflect: true }) date: Date | string;\n\n /** Force the unit of measurement. */\n @Prop({ reflect: true }) unit: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'quarter' | 'year';\n\n /**\n * @private\n * Used to manage the sync timer that updates the time since the component was connected to the DOM.\n * Will be set to null if a valid `baseDate` is provided.\n */\n syncTimer = null;\n\n /** @private Will be set to true if a valid `baseDate` is provided. */\n trimSuffix: boolean = false;\n\n @State() displayedMessage: string;\n\n @Element() hostElement: HTMLElement;\n\n /// Lifecycle Hooks ///\n\n componentWillLoad(): void | Promise<void> {\n this.updateMessage();\n }\n\n connectedCallback(): void {\n this.syncUpdated();\n }\n\n disconnectedCallback(): void {\n window.clearInterval(this.syncTimer);\n this.syncTimer = null;\n }\n\n /// Getters ///\n get shouldShow(): boolean {\n return !!this.displayedMessage;\n }\n\n get validDate(): boolean {\n const targetDate = new Date(this.date);\n return isValidDate(targetDate);\n }\n\n get handleDate(): Date {\n if (!this.validDate) console.warn('Error: Invalid date provided to q2-relative-time.');\n return new Date(this.date);\n }\n\n get validBaseDate(): boolean {\n const baseDate = new Date(this.baseDate);\n return isValidDate(baseDate);\n }\n\n get handleBaseDate(): Date {\n if (this.validBaseDate) {\n this.trimSuffix = true;\n this.sync = false;\n return new Date(this.baseDate);\n } else {\n this.trimSuffix = false;\n this.sync = true;\n return new Date();\n }\n }\n\n get isValidUnit(): boolean {\n if (['second', 'minute', 'hour', 'day', 'month', 'quarter', 'year'].includes(this.unit)) return true;\n return false;\n }\n\n get handleNumeric(): 'always' | 'auto' {\n if (this.validBaseDate) return 'always';\n return this.numeric;\n }\n\n /// Watchers ///\n @Watch('sync')\n syncUpdated() {\n if (this.sync) {\n this.syncTimer = window.setInterval(() => {\n this.updateMessage();\n }, 1000);\n } else {\n window.clearInterval(this.syncTimer);\n this.syncTimer = null;\n }\n }\n\n @Watch('messageFormat')\n @Watch('locale')\n @Watch('date')\n @Watch('baseDate')\n @Watch('numeric')\n @Watch('unit')\n updateMessage() {\n const {\n validDate,\n handleDate,\n handleBaseDate,\n locale,\n handleNumeric,\n messageFormat,\n isValidUnit,\n unit,\n trimSuffix,\n } = this;\n\n if (!validDate) {\n this.sync = false;\n this.displayedMessage = 'Invalid Date Provided';\n return;\n }\n\n const message = intlFormatDistance(new Date(handleDate), new Date(handleBaseDate), {\n locale,\n localeMatcher: 'best fit',\n numeric: handleNumeric,\n style: messageFormat,\n unit: isValidUnit ? unit : null,\n });\n\n if (trimSuffix) {\n this.displayedMessage = this.trimMessage(message);\n } else {\n this.displayedMessage = message;\n }\n }\n\n /// Helpers ///\n trimMessage(message: string): string {\n return message.replace(/^in\\s?/, '').replace(/\\sago$/, '');\n }\n\n /// Methods ///\n /** Retrieves the value of the displayed messages. */\n @Method()\n async displayedMessageValue(): Promise<string> {\n return this.displayedMessage;\n }\n\n /// DOM ///\n\n render() {\n const { shouldShow, displayedMessage } = this;\n\n return <Fragment>{shouldShow ? <time dateTime={displayedMessage}>{displayedMessage}</time> : null}</Fragment>;\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"q2-relative-time.js","mappings":";;;;AAAA,MAAM,iBA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relative-time&encapsulation=shadow","src/components/q2-relative-time/q2-relative-time.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n:host {\n display: inline;\n}\n","import { Component, Prop, State, Method, Watch, Element, h, ComponentInterface, Fragment } from '@stencil/core';\nimport { isValid as isValidDate, intlFormatDistance } from 'date-fns';\nimport { loc } from '../../utils';\n\n@Component({ tag: 'q2-relative-time', shadow: true, styleUrl: 'q2-relative-time.scss' })\nexport class Q2RelativeTime implements ComponentInterface {\n /**\n * If you want to display the length of time between two specific dates, you can provide a valid `date` and `baseDate`, and the component will display the length of time between the two dates.\n *\n * If `baseDate` is not provided, the date and time at render will be used instead and - if `sync` is true - updated every second to reflect the time between the `date` value and the time at render.\n *\n * @warning\n * - Requires a valid `date` value.\n * - If the provided `baseDate` is invalid, the component will display \"Invalid Date\" and a warning message will be printed in the console.\n * - Providing a valid `baseDate` will disable `sync` and remove the \"in\"/\"ago\" suffixes in the time message.\n * - Must be a valid ISO date string.\n */\n @Prop({ reflect: true }) baseDate: Date | string;\n\n /**\n * The language used for the displayed message.\n * @info\n * It is recommended to use the BCP 47 Language Tags in the [\"language-extlang\" format](https://www.w3.org/International/articles/language-tags/).\n */\n @Prop({ reflect: true }) locale: string = document.documentElement.lang || 'en-US';\n\n /** The length of the relative time message. */\n @Prop({ reflect: true }) messageFormat: 'long' | 'short' | 'narrow' = 'short';\n\n /**\n * Determines if the displayed message will use numeric or relative values.\n *@info\n * Set this property to `always` to force the use of numeric values (e.g. \"1 day ago\") rather than relative ones (e.g. \"yesterday\").\n */\n @Prop({ reflect: true }) numeric: 'always' | 'auto' = 'auto';\n\n /**\n * Keep the displayed message updated as time passes in the webpage.\n * @warning\n * If a valid `baseDate` is provided, `sync` will be set to `false`.\n */\n @Prop({ reflect: true, mutable: true }) sync: boolean = true;\n\n /**\n * The date you want to calculate relative time from.\n *\n * @warning\n * - Must be a valid ISO date string.\n * - If the provided `date` is invalid, the component will display \"Invalid Date\" and a warning message will be printed in the console.\n */\n @Prop({ reflect: true }) date: Date | string;\n\n /** Enforces the use of the provided unit of measurement in the displayed message. */\n @Prop({ reflect: true }) unit: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'quarter' | 'year';\n\n /**\n * @private\n * Used to manage the sync timer that updates the time since the component was connected to the DOM.\n * Will be set to null if a valid `baseDate` is provided.\n */\n syncTimer = null;\n\n /** @private Will be set to true if a valid `baseDate` is provided. */\n trimSuffix: boolean = false;\n\n @State() displayedMessage: string;\n\n @Element() hostElement: HTMLElement;\n\n /// Lifecycle Hooks ///\n\n componentWillLoad(): void | Promise<void> {\n this.updateMessage();\n }\n\n connectedCallback(): void {\n this.syncUpdated();\n }\n\n disconnectedCallback(): void {\n window.clearInterval(this.syncTimer);\n this.syncTimer = null;\n }\n\n /// Getters ///\n get shouldShow(): boolean {\n return !!this.displayedMessage;\n }\n\n get isValidDate(): boolean {\n const date = new Date(this.date);\n const isValid = isValidDate(date);\n if (!isValid) console.warn('Error: Invalid date provided to q2-relative-time.');\n return isValid;\n }\n\n get dateObject(): Date {\n return new Date(this.date);\n }\n\n get isBaseDateProvided(): boolean {\n return this.baseDate !== undefined;\n }\n\n get isValidBaseDate(): boolean {\n const date = new Date(this.baseDate);\n const isValid = isValidDate(date);\n if (!isValid && this.isBaseDateProvided) {\n console.warn('Error: Invalid baseDate provided to q2-relative-time.');\n }\n return isValid;\n }\n\n get baseDateObject(): Date {\n if (this.isBaseDateProvided && this.isValidBaseDate) {\n this.trimSuffix = true;\n this.sync = false;\n return new Date(this.baseDate);\n } else {\n this.trimSuffix = false;\n this.sync = true;\n return new Date();\n }\n }\n\n get isValidUnit(): boolean {\n if (['second', 'minute', 'hour', 'day', 'month', 'quarter', 'year'].includes(this.unit)) return true;\n return false;\n }\n\n get handleNumeric(): 'always' | 'auto' {\n if (this.isValidBaseDate) return 'always';\n return this.numeric;\n }\n\n /// Watchers ///\n @Watch('sync')\n syncUpdated() {\n if (this.sync) {\n this.syncTimer = window.setInterval(() => {\n this.updateMessage();\n }, 1000);\n } else {\n window.clearInterval(this.syncTimer);\n this.syncTimer = null;\n }\n }\n\n @Watch('messageFormat')\n @Watch('locale')\n @Watch('date')\n @Watch('baseDate')\n @Watch('numeric')\n @Watch('unit')\n updateMessage() {\n const {\n isValidDate,\n isBaseDateProvided,\n isValidBaseDate,\n dateObject,\n baseDateObject,\n locale,\n handleNumeric,\n messageFormat,\n isValidUnit,\n unit,\n trimSuffix,\n } = this;\n\n if (!isValidDate || (isBaseDateProvided && !isValidBaseDate)) {\n this.sync = false;\n this.displayedMessage = loc('tecton.element.relativeTime.invalidDate');\n return;\n }\n\n const message = intlFormatDistance(new Date(dateObject), new Date(baseDateObject), {\n locale,\n localeMatcher: 'best fit',\n numeric: handleNumeric,\n style: messageFormat,\n unit: isValidUnit ? unit : null,\n });\n\n if (trimSuffix) {\n this.displayedMessage = this.trimMessage(message);\n } else {\n this.displayedMessage = message;\n }\n }\n\n /// Helpers ///\n trimMessage(message: string): string {\n return message.replace(/^in\\s?/, '').replace(/\\sago$/, '');\n }\n\n /// Methods ///\n /** Retrieves the value of the displayed messages. */\n @Method()\n async displayedMessageValue(): Promise<string> {\n return this.displayedMessage;\n }\n\n /** Checks the provided date prop is a valid date. */\n @Method()\n async validDateProp(): Promise<boolean> {\n return this.isValidDate;\n }\n\n /** Checks the provided baseDate prop is a valid date. */\n @Method()\n async validBaseDateProp(): Promise<boolean> {\n return this.isValidBaseDate;\n }\n\n /// DOM ///\n\n render() {\n const { shouldShow, displayedMessage } = this;\n\n return <Fragment>{shouldShow ? <time dateTime={displayedMessage}>{displayedMessage}</time> : null}</Fragment>;\n }\n}\n"],"version":3}
|
|
@@ -164,9 +164,9 @@ const Q2Section$1 = /*@__PURE__*/ proxyCustomElement(class Q2Section extends HTM
|
|
|
164
164
|
wrapperClasses.push('is-transitioning');
|
|
165
165
|
}
|
|
166
166
|
const showDefaultHeader = !this.hasYieldedHeader && !!this.label;
|
|
167
|
-
return (h("section", { key: '
|
|
167
|
+
return (h("section", { key: '245c8a2da4a8c8ae1787d91c9b35872105912e95', class: "wrapper" }, h("header", { key: 'bfc10eaaa837d4a8cb49bc3f4397288d546f9e67', class: hasHeader ? 'has-header' : '' }, h("div", { key: 'd25b05626ca123afb549ec16c1ce5bec625db4d7', class: "header-content", id: this.titleId, onClick: this.collapsible && this.onHeaderClick }, showDefaultHeader && h("h2", { key: 'f2f8c57e3af85b954096e2e25ebef50bd7b79cb0', class: "title" }, loc(this.label)), h("div", { key: 'efd8d321da74b310a48c0c7457d30c4e2386611e', ref: el => (this.headerSlotWrapper = el), class: "header-slot-wrapper" }, h("slot", { key: 'ceb27324426a2b7db0d91ce275fa18df588ada1d', ref: (el) => (this.headerSlot = el), name: "q2-section-header" }))), this.collapsible && !this.noCollapseIcon && (h("q2-btn", { key: 'a3e309075ca001daddcd645b9160837155ce7506', 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: '3f349cda906286b7a346a9bc9fa6688f47a5392f', type: "chevron-up" })))), h("div", { key: '974f2eaa3ff5e607561154906ec4b58f44f2bd84', class: wrapperClasses.join(' '), id: this.contentId, "aria-labelledby": this.titleId, role: "region", onTransitionEnd: this.onTransitionEnd, style: this.collapsible && {
|
|
168
168
|
height: this.contentHeight,
|
|
169
|
-
} }, h("div", { key: '
|
|
169
|
+
} }, h("div", { key: '63e20753fdfca17b6022903d38a22d0f61ea439d', ref: el => (this.contentContainer = el), class: "content", tabindex: "-1" }, h("slot", { key: '08150c784b5a0d2ca7af67bbc5763754c165564f', ref: (el) => (this.contentSlot = el) })))));
|
|
170
170
|
}
|
|
171
171
|
get hostElement() { return this; }
|
|
172
172
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"q2-section.js","mappings":";;;;;;AAAA,MAAM,YAAY,GAAG,4kHAA4kH,CAAC;AAClmH,wB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AK,EAAC,qBAAqB,IAE3B,6DACI,GAAG,EAAE,CAAC,EAAmB,MAAM,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC,EACpD,IAAI,EAAC,mBAAmB,GAC1B,CACA,CACJ,EACL,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,cAAc,KACrC,+DACI,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,2CAA2C,CAAC,EACrE,YAAY,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,EAClC,YAAY,EAAE,IAAI,CAAC,SAAS,aACpB,cAAc,sBAEtB,OAAO,EAAE,IAAI,CAAC,aAAa,IAE3B,gEAAS,IAAI,EAAC,YAAY,GAAG,CACxB,CACZ,CACI,EACT,4DACI,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAC/B,EAAE,EAAE,IAAI,CAAC,SAAS,qBACD,IAAI,CAAC,OAAO,EAC7B,IAAI,EAAC,QAAQ,EACb,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,KAAK,EACD,IAAI,CAAC,WAAW,IAAI;gBAChB,MAAM,EAAE,IAAI,CAAC,aAAa;aAC7B,IAGL,4DACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAC,SAAS,EACf,QAAQ,EAAC,IAAI,IAEb,6DAAM,GAAG,EAAE,CAAC,EAAmB,MAAM,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,GAAI,CAC7D,CACJ,CACA,EACZ;KACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Q2Section"],"sources":["src/components/q2-section/q2-section.scss?tag=q2-section&encapsulation=shadow","src/components/q2-section/q2-section.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions.scss';\n\n:host {\n display: block;\n background: var-list(\n --tct-section-background,\n var-prefixer(section-background-color),\n var-prefixer(section-bg),\n --app-white,\n #ffffff\n );\n color: var-list(var-prefixer(section-font-color), --t-text, #4d4d4d);\n border-radius: var-list(var-prefixer(section-border-radius), --app-border-radius-1, 3px);\n margin: var-list(var-prefixer(section-margin), --app-scale-3x, 15px);\n border-width: var-list(--tct-section-border-width, 0);\n border-style: var-list(--tct-section-border-style, solid);\n border-color: var-list(--tct-section-border-color, none);\n\n @media screen and (max-width: 767px) {\n --comp-default-margin: var(--app-scale-3x, 15px) 0;\n margin: var-list(var-prefixer(section-margin), --comp-default-margin);\n }\n\n @media print {\n --comp-default-print-margin: var(--app-scale-3x, 15px) 0;\n margin: var-list(--tct-section-print-margin, --comp-default-print-margin);\n }\n}\n\n.wrapper {\n --comp-tween: #{var-list(var-prefixer(section-tween), --app-tween-1, unquote('0.2s ease'))};\n --comp-default-wrapper-padding: var(--app-scale-1x, 5px) 0;\n display: block;\n padding: var-list(var-prefixer(section-wrapper-padding), --comp-default-wrapper-padding);\n\n &:hover {\n box-shadow: var-list(var-prefixer(section-wrapper-hover-box-shadow), inherit);\n }\n\n :host([collapsible]) & {\n --comp-tween: #{var-list(var-prefixer(section-tween), --app-tween-2, unquote('0.4s ease'))};\n }\n}\n\nheader {\n --comp-default-header-padding: 0 var(--app-scale-3x, 15px);\n padding: var-list(var-prefixer(section-header-padding), --comp-default-header-padding);\n display: flex;\n\n @media print {\n padding: var-list(--tct-section-header-print-padding, 0);\n }\n\n &.has-header {\n min-height: var-list(var-prefixer(section-header-min-height), 44px);\n }\n}\n\n.header-content {\n flex: 1 1 100%;\n min-width: 0;\n align-self: center;\n\n :host([collapsible]) & {\n cursor: pointer;\n }\n}\n\n.title {\n margin: var-list(--tct-section-title-margin, 0);\n font-size: var-list(--tct-section-title-font-size, 20px);\n font-weight: var-list(--tct-section-title-font-weight, 600);\n text-transform: var-list(--tct-section-title-text-transform, uppercase);\n letter-spacing: var-list(--tct-section-title-letter-spacing, 0.5px);\n}\n\nq2-icon {\n transition: transform var(--comp-tween);\n\n :host(:not([expanded])) &,\n :host([expanded='false']) & {\n transform: rotate(180deg);\n }\n}\n\n.content-wrapper {\n height: auto;\n\n &.is-closed {\n display: none;\n overflow: hidden;\n }\n\n &.is-transitioning {\n overflow: hidden;\n }\n\n :host([collapsible]) & {\n transition: height var(--comp-tween);\n }\n}\n\n.content {\n --comp-default-content-padding: var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);\n padding: var-list(var-prefixer(section-content-padding), --comp-default-content-padding);\n\n @media print {\n padding: var-list(--tct-section-content-print-padding, 0);\n }\n\n &:focus {\n box-shadow: none;\n }\n\n :host([collapsible]) :host(:not([expanded])) & {\n visibility: hidden;\n }\n}\n","import {\n Component,\n ComponentInterface,\n Prop,\n Element,\n Listen,\n State,\n Watch,\n h,\n Event,\n EventEmitter,\n} from '@stencil/core';\nimport { isEventFromElement, loc, nextPaint, overrideFocus, resizeIframe } from 'src/utils';\n\n@Component({ tag: 'q2-section', shadow: true, styleUrl: 'q2-section.scss' })\nexport class Q2Section implements ComponentInterface {\n /** Determines if the section is collapsible. */\n @Prop({ reflect: true }) collapsible: boolean;\n\n /** Indicates if the `q2-section` is in an expanded state or not. */\n @Prop({ reflect: true, mutable: true }) expanded: boolean;\n\n /** The text to display above the `q2-section`. Renders as an `<h2>` element. */\n @Prop({ reflect: true }) label: string;\n\n /** Determines if the collapse chevron icon should show in the `q2-section` header. */\n @Prop({ reflect: true }) noCollapseIcon: boolean;\n\n @Element() hostElement: HTMLElement;\n @State() contentHeight: string;\n @State() hideContent: boolean = false;\n @State() hasYieldedHeader: boolean = false;\n\n titleId: string = 'title';\n contentId: string = 'content';\n resizerFn: NodeJS.Timer | undefined;\n headerSlotMutationObserver: MutationObserver;\n contentSlotMutationObserver: MutationObserver;\n contentContainer: HTMLDivElement;\n headerSlotWrapper: HTMLDivElement;\n headerSlot: HTMLSlotElement;\n contentSlot: HTMLSlotElement;\n\n componentWillLoad() {\n this.onHeaderSlotChange();\n const { collapsible, expanded } = this;\n this.contentHeight = collapsible && expanded ? undefined : '0px';\n this.hideContent = !expanded;\n }\n\n componentDidLoad() {\n this.addHeaderSlotListener();\n this.addContentSlotListener();\n overrideFocus(this.hostElement);\n }\n\n disconnectedCallback() {\n this.removeHeaderSlotListener();\n this.removeContentSlotListener();\n }\n\n /// Listeners ///\n @Listen('change')\n defaultChangeHandler(event: CustomEvent) {\n if (event.target === this.hostElement && !this.hostElement.onchange && !!event.detail) {\n this.expanded = event.detail.expanded;\n }\n }\n\n @Listen('focus')\n delegateFocus(event: FocusEvent) {\n if (!isEventFromElement(event, this.hostElement)) return;\n this.contentContainer.focus();\n }\n\n /// Watchers ///\n @Watch('expanded')\n async expandedObserver(expanded: boolean) {\n this.clearResizeInterval();\n this.resizerFn = setInterval(resizeIframe, 5);\n\n if (expanded) {\n this.expandSection();\n } else {\n this.collapseSection();\n }\n }\n\n async collapseSection() {\n this.contentHeight = this.contentContainerHeight;\n await nextPaint(() => {\n this.contentHeight = this.currentHeight;\n });\n }\n\n async expandSection() {\n this.hideContent = false;\n await nextPaint(() => {\n this.contentHeight = this.currentHeight;\n });\n }\n\n @Watch('collapsible')\n collapsibleObserver() {\n this.contentHeight = this.currentHeight;\n }\n\n /// Events ///\n /**\n * Emitted when the section is expanded or collapsed.\n * @legacyEvent\n */\n @Event() change: EventEmitter<{ expanded: boolean }>;\n\n /// Event Handlers ///\n onHeaderClick = () => {\n this.change.emit({\n expanded: !this.expanded,\n });\n };\n\n onTransitionEnd = () => {\n if (this.expanded) {\n this.contentHeight = undefined;\n } else {\n this.hideContent = true;\n }\n\n setTimeout(() => {\n // This gives enough time for all values to get passed over\n // Previously, the interval was never cleared and the fn was called indefinitely then filtered\n // Will revisit in TCT-599\n this.clearResizeInterval();\n }, 1000);\n };\n\n onHeaderSlotChange = () => {\n const hasSlotContent = !!this.hostElement.querySelector('[slot=\"q2-section-header\"]');\n\n if (this.hasYieldedHeader !== hasSlotContent) {\n this.hasYieldedHeader = !!hasSlotContent;\n }\n };\n\n /// Getters ///\n get currentHeight() {\n const { collapsible, expanded } = this;\n if (!collapsible) {\n return null;\n } else if (expanded) {\n return this.contentContainerHeight;\n } else {\n return '0';\n }\n }\n\n get contentContainerHeight() {\n return `${this.contentContainer.offsetHeight || 0}px`;\n }\n\n /// Helpers ///\n clearResizeInterval = () => {\n this.resizerFn && clearInterval(this.resizerFn);\n };\n\n addHeaderSlotListener = () => {\n if (this.headerSlot) {\n this.headerSlot.addEventListener('slotchange', this.onHeaderSlotChange);\n return;\n }\n\n const observer = new MutationObserver(this.onHeaderSlotChange);\n observer.observe(this.headerSlotWrapper, { childList: true });\n this.headerSlotMutationObserver = observer;\n };\n\n removeHeaderSlotListener = () => {\n if (this.headerSlot) {\n this.headerSlot.removeEventListener('slotchange', this.onHeaderSlotChange);\n return;\n }\n\n this.headerSlotMutationObserver.disconnect();\n };\n\n addContentSlotListener = () => {\n if (this.contentSlot) {\n this.contentSlot.addEventListener('slotchange', resizeIframe);\n return;\n }\n\n const observer = new MutationObserver(resizeIframe);\n observer.observe(this.contentContainer, { childList: true, subtree: true });\n this.contentSlotMutationObserver = observer;\n };\n\n removeContentSlotListener = () => {\n if (this.contentSlot) {\n this.contentSlot.removeEventListener('slotchange', resizeIframe);\n return;\n }\n this.contentSlotMutationObserver.disconnect();\n };\n\n render() {\n const hasHeader = this.label || this.hasYieldedHeader;\n const wrapperClasses = ['content-wrapper'];\n const { collapsible, hideContent, contentHeight } = this;\n if (collapsible) {\n if (hideContent) wrapperClasses.push('is-closed');\n else if (contentHeight) wrapperClasses.push('is-transitioning');\n }\n\n const showDefaultHeader = !this.hasYieldedHeader && !!this.label;\n\n return (\n <section class=\"wrapper\">\n <header class={hasHeader ? 'has-header' : ''}>\n <div\n class=\"header-content\"\n id={this.titleId}\n onClick={this.collapsible && this.onHeaderClick}\n >\n {showDefaultHeader && <h2 class=\"title\">{loc(this.label)}</h2>}\n <div\n ref={el => (this.headerSlotWrapper = el)}\n class=\"header-slot-wrapper\"\n >\n <slot\n ref={(el: HTMLSlotElement) => (this.headerSlot = el)}\n name=\"q2-section-header\"\n />\n </div>\n </div>\n {this.collapsible && !this.noCollapseIcon && (\n <q2-btn\n label={loc(this.label || 'tecton.element.section.defaultToggleLabel')}\n ariaExpanded={`${!!this.expanded}`}\n ariaControls={this.contentId}\n test-id=\"toggleButton\"\n hide-label\n onClick={this.onHeaderClick}\n >\n <q2-icon type=\"chevron-up\" />\n </q2-btn>\n )}\n </header>\n <div\n class={wrapperClasses.join(' ')}\n id={this.contentId}\n aria-labelledby={this.titleId}\n role=\"region\"\n onTransitionEnd={this.onTransitionEnd}\n style={\n this.collapsible && {\n height: this.contentHeight,\n }\n }\n >\n <div\n ref={el => (this.contentContainer = el)}\n class=\"content\"\n tabindex=\"-1\"\n >\n <slot ref={(el: HTMLSlotElement) => (this.contentSlot = el)} />\n </div>\n </div>\n </section>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"q2-section.js","mappings":";;;;;;AAAA,MAAM,YAAY,GAAG,4kHAA4kH,CAAC;AAClmH,wBAAe,YAAY;;MCcdA,WAAS;;;;;;QA0BlB,YAAO,GAAW,OAAO,CAAC;QAC1B,cAAS,GAAW,SAAS,CAAC;;QAiF9B,kBAAa,GAAG;YACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBACb,QAAQ,EAAE,CAAC,IAAI,CAAC,QAAQ;aAC3B,CAAC,CAAC;SACN,CAAC;QAEF,oBAAe,GAAG;YACd,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;aAClC;iBAAM;gBACH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;aAC3B;YAED,UAAU,CAAC;;;;gBAIP,IAAI,CAAC,mBAAmB,EAAE,CAAC;aAC9B,EAAE,IAAI,CAAC,CAAC;SACZ,CAAC;QAEF,uBAAkB,GAAG;YACjB,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,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AO,EAC7B,IAAI,EAAC,QAAQ,EACb,eAAe,EAAE,IAAI,CAAC,eAAe,EACrC,KAAK,EACD,IAAI,CAAC,WAAW,IAAI;gBAChB,MAAM,EAAE,IAAI,CAAC,aAAa;aAC7B,IAGL,4DACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAC,SAAS,EACf,QAAQ,EAAC,IAAI,IAEb,6DAAM,GAAG,EAAE,CAAC,EAAmB,MAAM,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,GAAI,CAC7D,CACJ,CACA,EACZ;KACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["Q2Section"],"sources":["src/components/q2-section/q2-section.scss?tag=q2-section&encapsulation=shadow","src/components/q2-section/q2-section.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions.scss';\n\n:host {\n display: block;\n background: var-list(\n --tct-section-background,\n var-prefixer(section-background-color),\n var-prefixer(section-bg),\n --app-white,\n #ffffff\n );\n color: var-list(var-prefixer(section-font-color), --t-text, #4d4d4d);\n border-radius: var-list(var-prefixer(section-border-radius), --app-border-radius-1, 3px);\n margin: var-list(var-prefixer(section-margin), --app-scale-3x, 15px);\n border-width: var-list(--tct-section-border-width, 0);\n border-style: var-list(--tct-section-border-style, solid);\n border-color: var-list(--tct-section-border-color, none);\n\n @media screen and (max-width: 767px) {\n --comp-default-margin: var(--app-scale-3x, 15px) 0;\n margin: var-list(var-prefixer(section-margin), --comp-default-margin);\n }\n\n @media print {\n --comp-default-print-margin: var(--app-scale-3x, 15px) 0;\n margin: var-list(--tct-section-print-margin, --comp-default-print-margin);\n }\n}\n\n.wrapper {\n --comp-tween: #{var-list(var-prefixer(section-tween), --app-tween-1, unquote('0.2s ease'))};\n --comp-default-wrapper-padding: var(--app-scale-1x, 5px) 0;\n display: block;\n padding: var-list(var-prefixer(section-wrapper-padding), --comp-default-wrapper-padding);\n\n &:hover {\n box-shadow: var-list(var-prefixer(section-wrapper-hover-box-shadow), inherit);\n }\n\n :host([collapsible]) & {\n --comp-tween: #{var-list(var-prefixer(section-tween), --app-tween-2, unquote('0.4s ease'))};\n }\n}\n\nheader {\n --comp-default-header-padding: 0 var(--app-scale-3x, 15px);\n padding: var-list(var-prefixer(section-header-padding), --comp-default-header-padding);\n display: flex;\n\n @media print {\n padding: var-list(--tct-section-header-print-padding, 0);\n }\n\n &.has-header {\n min-height: var-list(var-prefixer(section-header-min-height), 44px);\n }\n}\n\n.header-content {\n flex: 1 1 100%;\n min-width: 0;\n align-self: center;\n\n :host([collapsible]) & {\n cursor: pointer;\n }\n}\n\n.title {\n margin: var-list(--tct-section-title-margin, 0);\n font-size: var-list(--tct-section-title-font-size, 20px);\n font-weight: var-list(--tct-section-title-font-weight, 600);\n text-transform: var-list(--tct-section-title-text-transform, uppercase);\n letter-spacing: var-list(--tct-section-title-letter-spacing, 0.5px);\n}\n\nq2-icon {\n transition: transform var(--comp-tween);\n\n :host(:not([expanded])) &,\n :host([expanded='false']) & {\n transform: rotate(180deg);\n }\n}\n\n.content-wrapper {\n height: auto;\n\n &.is-closed {\n display: none;\n overflow: hidden;\n }\n\n &.is-transitioning {\n overflow: hidden;\n }\n\n :host([collapsible]) & {\n transition: height var(--comp-tween);\n }\n}\n\n.content {\n --comp-default-content-padding: var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);\n padding: var-list(var-prefixer(section-content-padding), --comp-default-content-padding);\n\n @media print {\n padding: var-list(--tct-section-content-print-padding, 0);\n }\n\n &:focus {\n box-shadow: none;\n }\n\n :host([collapsible]) :host(:not([expanded])) & {\n visibility: hidden;\n }\n}\n","import {\n Component,\n ComponentInterface,\n Prop,\n Element,\n Listen,\n State,\n Watch,\n h,\n Event,\n EventEmitter,\n} from '@stencil/core';\nimport { isEventFromElement, loc, nextPaint, overrideFocus, resizeIframe } from 'src/utils';\n\n@Component({ tag: 'q2-section', shadow: true, styleUrl: 'q2-section.scss' })\nexport class Q2Section implements ComponentInterface {\n /** Determines if the section is collapsible. */\n @Prop({ reflect: true }) collapsible: boolean;\n\n /** Indicates if the `q2-section` is in an expanded state or not. */\n @Prop({ reflect: true, mutable: true }) expanded: boolean;\n\n /**\n * The text to display above the `q2-section`. Renders as an `<h2>` element.\n *\n * It is also used to provided an `aria-label` for the toggle button when the component is collapsible.\n *\n * @warning\n * If you are providing a custom header, setting this property is still strongly encouraged for the purposes of\n * accessibility.\n */\n @Prop({ reflect: true }) label: string;\n\n /** Determines if the collapse chevron icon should show in the `q2-section` header. */\n @Prop({ reflect: true }) noCollapseIcon: boolean;\n\n @Element() hostElement: HTMLElement;\n @State() contentHeight: string;\n @State() hideContent: boolean = false;\n @State() hasYieldedHeader: boolean = false;\n\n titleId: string = 'title';\n contentId: string = 'content';\n resizerFn: NodeJS.Timeout | undefined;\n headerSlotMutationObserver: MutationObserver;\n contentSlotMutationObserver: MutationObserver;\n contentContainer: HTMLDivElement;\n headerSlotWrapper: HTMLDivElement;\n headerSlot: HTMLSlotElement;\n contentSlot: HTMLSlotElement;\n\n componentWillLoad() {\n this.onHeaderSlotChange();\n const { collapsible, expanded } = this;\n this.contentHeight = collapsible && expanded ? undefined : '0px';\n this.hideContent = !expanded;\n }\n\n componentDidLoad() {\n this.addHeaderSlotListener();\n this.addContentSlotListener();\n overrideFocus(this.hostElement);\n }\n\n disconnectedCallback() {\n this.removeHeaderSlotListener();\n this.removeContentSlotListener();\n }\n\n /// Listeners ///\n @Listen('change')\n defaultChangeHandler(event: CustomEvent) {\n if (event.target === this.hostElement && !this.hostElement.onchange && !!event.detail) {\n this.expanded = event.detail.expanded;\n }\n }\n\n @Listen('focus')\n delegateFocus(event: FocusEvent) {\n if (!isEventFromElement(event, this.hostElement)) return;\n this.contentContainer.focus();\n }\n\n /// Watchers ///\n @Watch('expanded')\n async expandedObserver(expanded: boolean) {\n this.clearResizeInterval();\n this.resizerFn = setInterval(resizeIframe, 5);\n\n if (expanded) {\n this.expandSection();\n } else {\n this.collapseSection();\n }\n }\n\n async collapseSection() {\n this.contentHeight = this.contentContainerHeight;\n await nextPaint(() => {\n this.contentHeight = this.currentHeight;\n });\n }\n\n async expandSection() {\n this.hideContent = false;\n await nextPaint(() => {\n this.contentHeight = this.currentHeight;\n });\n }\n\n @Watch('collapsible')\n collapsibleObserver() {\n this.contentHeight = this.currentHeight;\n }\n\n /// Events ///\n /**\n * Emitted when the section is expanded or collapsed.\n * @legacyEvent\n */\n @Event() change: EventEmitter<{ expanded: boolean }>;\n\n /// Event Handlers ///\n onHeaderClick = () => {\n this.change.emit({\n expanded: !this.expanded,\n });\n };\n\n onTransitionEnd = () => {\n if (this.expanded) {\n this.contentHeight = undefined;\n } else {\n this.hideContent = true;\n }\n\n setTimeout(() => {\n // This gives enough time for all values to get passed over\n // Previously, the interval was never cleared and the fn was called indefinitely then filtered\n // Will revisit in TCT-599\n this.clearResizeInterval();\n }, 1000);\n };\n\n onHeaderSlotChange = () => {\n const hasSlotContent = !!this.hostElement.querySelector('[slot=\"q2-section-header\"]');\n\n if (this.hasYieldedHeader !== hasSlotContent) {\n this.hasYieldedHeader = !!hasSlotContent;\n }\n };\n\n /// Getters ///\n get currentHeight() {\n const { collapsible, expanded } = this;\n if (!collapsible) {\n return null;\n } else if (expanded) {\n return this.contentContainerHeight;\n } else {\n return '0';\n }\n }\n\n get contentContainerHeight() {\n return `${this.contentContainer.offsetHeight || 0}px`;\n }\n\n /// Helpers ///\n clearResizeInterval = () => {\n this.resizerFn && clearInterval(this.resizerFn);\n };\n\n addHeaderSlotListener = () => {\n if (this.headerSlot) {\n this.headerSlot.addEventListener('slotchange', this.onHeaderSlotChange);\n return;\n }\n\n const observer = new MutationObserver(this.onHeaderSlotChange);\n observer.observe(this.headerSlotWrapper, { childList: true });\n this.headerSlotMutationObserver = observer;\n };\n\n removeHeaderSlotListener = () => {\n if (this.headerSlot) {\n this.headerSlot.removeEventListener('slotchange', this.onHeaderSlotChange);\n return;\n }\n\n this.headerSlotMutationObserver.disconnect();\n };\n\n addContentSlotListener = () => {\n if (this.contentSlot) {\n this.contentSlot.addEventListener('slotchange', resizeIframe);\n return;\n }\n\n const observer = new MutationObserver(resizeIframe);\n observer.observe(this.contentContainer, { childList: true, subtree: true });\n this.contentSlotMutationObserver = observer;\n };\n\n removeContentSlotListener = () => {\n if (this.contentSlot) {\n this.contentSlot.removeEventListener('slotchange', resizeIframe);\n return;\n }\n this.contentSlotMutationObserver.disconnect();\n };\n\n render() {\n const hasHeader = this.label || this.hasYieldedHeader;\n const wrapperClasses = ['content-wrapper'];\n const { collapsible, hideContent, contentHeight } = this;\n if (collapsible) {\n if (hideContent) wrapperClasses.push('is-closed');\n else if (contentHeight) wrapperClasses.push('is-transitioning');\n }\n\n const showDefaultHeader = !this.hasYieldedHeader && !!this.label;\n\n return (\n <section class=\"wrapper\">\n <header class={hasHeader ? 'has-header' : ''}>\n <div\n class=\"header-content\"\n id={this.titleId}\n onClick={this.collapsible && this.onHeaderClick}\n >\n {showDefaultHeader && <h2 class=\"title\">{loc(this.label)}</h2>}\n <div\n ref={el => (this.headerSlotWrapper = el)}\n class=\"header-slot-wrapper\"\n >\n <slot\n ref={(el: HTMLSlotElement) => (this.headerSlot = el)}\n name=\"q2-section-header\"\n />\n </div>\n </div>\n {this.collapsible && !this.noCollapseIcon && (\n <q2-btn\n label={loc(this.label || 'tecton.element.section.defaultToggleLabel')}\n ariaExpanded={`${!!this.expanded}`}\n ariaControls={this.contentId}\n test-id=\"toggleButton\"\n hide-label\n onClick={this.onHeaderClick}\n >\n <q2-icon type=\"chevron-up\" />\n </q2-btn>\n )}\n </header>\n <div\n class={wrapperClasses.join(' ')}\n id={this.contentId}\n aria-labelledby={this.titleId}\n role=\"region\"\n onTransitionEnd={this.onTransitionEnd}\n style={\n this.collapsible && {\n height: this.contentHeight,\n }\n }\n >\n <div\n ref={el => (this.contentContainer = el)}\n class=\"content\"\n tabindex=\"-1\"\n >\n <slot ref={(el: HTMLSlotElement) => (this.contentSlot = el)} />\n </div>\n </div>\n </section>\n );\n }\n}\n"],"version":3}
|
|
@@ -90,6 +90,11 @@ const Q2Select = /*@__PURE__*/ proxyCustomElement(class Q2Select extends HTMLEle
|
|
|
90
90
|
'Escape',
|
|
91
91
|
'Tab',
|
|
92
92
|
];
|
|
93
|
+
if (this.searchable && (key === ' ' || key === 'Enter') && this.inputField.value == '') {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
if (!this.open)
|
|
96
|
+
this.openDropdownWithoutActiveElement();
|
|
97
|
+
}
|
|
93
98
|
if (this.searchable && !keysForOptionListToHandle.includes(key))
|
|
94
99
|
return;
|
|
95
100
|
if (this.shouldClearSearchText(event))
|
|
@@ -392,6 +397,9 @@ const Q2Select = /*@__PURE__*/ proxyCustomElement(class Q2Select extends HTMLEle
|
|
|
392
397
|
this.selectedOptions = [];
|
|
393
398
|
}
|
|
394
399
|
}
|
|
400
|
+
onClearHandler() {
|
|
401
|
+
this.clearValue();
|
|
402
|
+
}
|
|
395
403
|
onHostElementInput(event) {
|
|
396
404
|
if (!this.searchable || event.target !== this.hostElement || this.hostElement.oninput)
|
|
397
405
|
return;
|
|
@@ -587,12 +595,11 @@ const Q2Select = /*@__PURE__*/ proxyCustomElement(class Q2Select extends HTMLEle
|
|
|
587
595
|
}
|
|
588
596
|
render() {
|
|
589
597
|
var _a;
|
|
590
|
-
|
|
591
|
-
return (h("click-elsewhere", { key: 'a3fbee9295ca05dbb4856eebf5e6fb53a9f9e2a3', class: this.wrapperClasses, onChange: this.clickedElsewhere }, h("div", { key: 'a50de81a29cca3188898f6d4b6e16cbbfb6839f4', "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("q2-input", { key: '6059e00c0d5b86920a9193b9bf3bd06d0de27d92', 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) &&
|
|
598
|
+
return (h("click-elsewhere", { key: '421fc4811bdf2f8cfb899ee9823ce20e3301032c', class: this.wrapperClasses, onChange: this.clickedElsewhere }, h("div", { key: '1a2b96c2e6dbacfa7dcc8918ff4acab71046dc8d', "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("q2-input", { key: 'fd678010a8f0d53a4d93c265204bedf72679221a', 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) &&
|
|
592
599
|
this.errors.length > 0 &&
|
|
593
600
|
this.errors.map(error => loc(error))) ||
|
|
594
601
|
(this.invalid && ['tecton.element.select.invalid']) ||
|
|
595
|
-
[], disabled: this.disabled, optional: this.optional, readonly: this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${this.open}`, ariaControls: "option-list", ariaHaspopup: "listbox",
|
|
602
|
+
[], 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: '26f8c78fb455e7fc9451018ed2745ab53018c270', class: "custom-display-content", hidden: !this.hasCustomDisplay || !!this.searchText, onClick: this.onCustomDisplayClick }, h("slot", { key: '4f76ab176fbd88b99aab88ad9e9a3cb87ccb943b', name: "q2-select-display" })), this.optionsDropdown()));
|
|
596
603
|
}
|
|
597
604
|
optionsDropdown() {
|
|
598
605
|
return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.innerInputContainer, open: this.open, 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.visibilityToggle())), h("div", { class: "popover-bottom-container", hidden: !this.hasPopoverBottom, tabindex: "-1" }, h("slot", { name: "popover-bottom" }))));
|
|
@@ -649,7 +656,7 @@ const Q2Select = /*@__PURE__*/ proxyCustomElement(class Q2Select extends HTMLEle
|
|
|
649
656
|
"closePopover": [64],
|
|
650
657
|
"setValue": [64],
|
|
651
658
|
"searchOptions": [64]
|
|
652
|
-
}, [[0, "keydown", "keydownHandler"], [0, "change", "onHostElementChange"], [0, "input", "onHostElementInput"], [0, "focus", "delegateFocus"], [0, "focusout", "handleFocusout"], [0, "displayChanged", "handleSelectedDisplay"]], {
|
|
659
|
+
}, [[0, "keydown", "keydownHandler"], [0, "change", "onHostElementChange"], [0, "clear", "onClearHandler"], [0, "input", "onHostElementInput"], [0, "focus", "delegateFocus"], [0, "focusout", "handleFocusout"], [0, "displayChanged", "handleSelectedDisplay"]], {
|
|
653
660
|
"value": ["buildStructuredSelectedOptions", "valueUpdated"],
|
|
654
661
|
"selectedOptions": ["buildStructuredSelectedOptions"],
|
|
655
662
|
"ariaLabel": ["ariaLabelObserver"],
|