q2-tecton-elements 1.53.2 → 1.53.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/click-elsewhere_2.cjs.entry.js +19 -14
- package/dist/cjs/click-elsewhere_2.cjs.entry.js.map +1 -1
- package/dist/cjs/{index-76f63767.js → index-eec39d23.js} +68 -1
- package/dist/cjs/index-eec39d23.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +1 -1
- package/dist/cjs/q2-badge_7.cjs.entry.js +1 -1
- package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
- package/dist/cjs/q2-card.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +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 +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 +1 -1
- package/dist/cjs/q2-detail.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +4 -2
- package/dist/cjs/q2-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
- package/dist/cjs/q2-file-picker.cjs.entry.js +1 -1
- package/dist/cjs/q2-item_3.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 +1 -1
- package/dist/cjs/q2-option.cjs.entry.js +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 +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +1 -1
- package/dist/cjs/q2-select.cjs.entry.js +51 -3
- 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 +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-dropdown/q2-dropdown.js +3 -1
- package/dist/collection/components/q2-dropdown/q2-dropdown.js.map +1 -1
- package/dist/collection/components/q2-pill/test/q2-pill-test.e2e.js +1 -1
- package/dist/collection/components/q2-pill/test/q2-pill-test.e2e.js.map +1 -1
- package/dist/collection/components/q2-popover/q2-popover.js +19 -14
- package/dist/collection/components/q2-popover/q2-popover.js.map +1 -1
- package/dist/collection/components/q2-popover/test/q2-popover-test.spec.js +230 -147
- package/dist/collection/components/q2-popover/test/q2-popover-test.spec.js.map +1 -1
- package/dist/collection/components/q2-select/q2-select.js +57 -3
- package/dist/collection/components/q2-select/q2-select.js.map +1 -1
- package/dist/collection/components/q2-select/test/q2-select-test.spec.js +146 -6
- package/dist/collection/components/q2-select/test/q2-select-test.spec.js.map +1 -1
- package/dist/collection/utils/index.js +71 -0
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/components/index2.js +66 -1
- package/dist/components/index2.js.map +1 -1
- package/dist/components/q2-dropdown.js +3 -1
- package/dist/components/q2-dropdown.js.map +1 -1
- package/dist/components/q2-popover2.js +19 -14
- package/dist/components/q2-popover2.js.map +1 -1
- package/dist/components/q2-select2.js +52 -4
- package/dist/components/q2-select2.js.map +1 -1
- package/dist/esm/click-elsewhere_2.entry.js +19 -14
- package/dist/esm/click-elsewhere_2.entry.js.map +1 -1
- package/dist/esm/{index-504f1a9e.js → index-52ca69b4.js} +67 -2
- package/dist/esm/index-52ca69b4.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-group.entry.js +1 -1
- package/dist/esm/q2-action-sheet.entry.js +1 -1
- package/dist/esm/q2-badge_7.entry.js +1 -1
- package/dist/esm/q2-calendar.entry.js +1 -1
- package/dist/esm/q2-card.entry.js +1 -1
- package/dist/esm/q2-carousel-pane.entry.js +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 +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 +1 -1
- package/dist/esm/q2-detail.entry.js +1 -1
- package/dist/esm/q2-dropdown-item.entry.js +1 -1
- package/dist/esm/q2-dropdown.entry.js +4 -2
- package/dist/esm/q2-dropdown.entry.js.map +1 -1
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-file-picker.entry.js +1 -1
- package/dist/esm/q2-item_3.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 +1 -1
- package/dist/esm/q2-option.entry.js +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 +1 -1
- package/dist/esm/q2-section.entry.js +1 -1
- package/dist/esm/q2-select.entry.js +51 -3
- 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 +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/jest.setup.js +11 -0
- package/dist/jest.setup.js.map +1 -1
- package/dist/q2-tecton-elements/click-elsewhere_2.entry.js +139 -134
- package/dist/q2-tecton-elements/click-elsewhere_2.entry.js.map +1 -1
- package/dist/q2-tecton-elements/{index-504f1a9e.js → index-52ca69b4.js} +121 -61
- package/dist/q2-tecton-elements/index-52ca69b4.js.map +1 -0
- package/dist/q2-tecton-elements/q2-action-group.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-action-sheet.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-badge_7.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-calendar.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-card.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-carousel-pane.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-carousel.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-chart-area.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-chart-bar.entry.js +78 -78
- package/dist/q2-tecton-elements/q2-chart-donut.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-checkbox-group.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-checkbox.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-data-table.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-detail.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-dropdown-item.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-dropdown.entry.js +13 -11
- package/dist/q2-tecton-elements/q2-dropdown.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-editable-field.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-file-picker.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-item_3.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-loc.entry.js +4 -4
- package/dist/q2-tecton-elements/q2-message.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-month-picker.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-optgroup.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-option-list.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-option.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-pagination.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-pill.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-radio-group.entry.js +5 -5
- package/dist/q2-tecton-elements/q2-radio.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-relative-time.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-section.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-select.entry.js +64 -17
- package/dist/q2-tecton-elements/q2-select.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-stepper-pane.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-stepper-vertical.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-stepper.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-tag.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js.map +1 -1
- package/dist/q2-tecton-elements/q2-textarea.entry.js +1 -1
- package/dist/q2-tecton-elements/q2-tooltip.entry.js +1 -1
- package/dist/types/builds/q2e/development/tecton/tecton/packages/q2-tecton-elements/.stencil/jest.setup.d.ts +9 -0
- package/dist/types/components/q2-select/q2-select.d.ts +10 -0
- package/dist/types/utils/index.d.ts +7 -0
- package/package.json +3 -3
- package/dist/cjs/index-76f63767.js.map +0 -1
- package/dist/esm/index-504f1a9e.js.map +0 -1
- package/dist/q2-tecton-elements/index-504f1a9e.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e7e68b1e.js');
|
|
6
|
-
const index$1 = require('./index-
|
|
6
|
+
const index$1 = require('./index-eec39d23.js');
|
|
7
7
|
|
|
8
8
|
const ClickElsewhere = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -137,7 +137,7 @@ const Q2Popover = class {
|
|
|
137
137
|
containerElement.style.setProperty('--comp-pop-opacity', '1');
|
|
138
138
|
};
|
|
139
139
|
this.setPopoverAPICSSProperties = async () => {
|
|
140
|
-
var _a, _b, _c
|
|
140
|
+
var _a, _b, _c;
|
|
141
141
|
const { controlElement, containerElement, currentDirection, isModule, align } = this;
|
|
142
142
|
const { top: controlTop, bottom: controlBottom, left: controlLeft, right: controlRight, } = (_b = (_a = controlElement === null || controlElement === void 0 ? void 0 : controlElement.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(controlElement)) !== null && _b !== void 0 ? _b : {
|
|
143
143
|
top: 0,
|
|
@@ -162,7 +162,7 @@ const Q2Popover = class {
|
|
|
162
162
|
containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop}px`);
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
165
|
-
containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop -
|
|
165
|
+
containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop - window.scrollY}px`);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
if (currentDirection === 'down') {
|
|
@@ -170,7 +170,7 @@ const Q2Popover = class {
|
|
|
170
170
|
containerElement.style.setProperty('--comp-pop-top', `${controlBottom}px`);
|
|
171
171
|
}
|
|
172
172
|
else {
|
|
173
|
-
containerElement.style.setProperty('--comp-pop-top', `${controlBottom +
|
|
173
|
+
containerElement.style.setProperty('--comp-pop-top', `${controlBottom + window.scrollY}px`);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
// Wait for one paint to prevent layout thrashing
|
|
@@ -289,7 +289,9 @@ const Q2Popover = class {
|
|
|
289
289
|
var _a;
|
|
290
290
|
window.addEventListener('resize', this.viewPortOrientationChanged);
|
|
291
291
|
visualViewport === null || visualViewport === void 0 ? void 0 : visualViewport.addEventListener('resize', this.viewPortChanged);
|
|
292
|
-
|
|
292
|
+
if (index$1.isInScrollableContainer(this.hostElement) && !index$1.isMobile()) {
|
|
293
|
+
window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });
|
|
294
|
+
}
|
|
293
295
|
(_a = screen === null || screen === void 0 ? void 0 : screen.orientation) === null || _a === void 0 ? void 0 : _a.addEventListener('orientationchange', this.viewPortOrientationChanged);
|
|
294
296
|
window.addEventListener('orientationchange', this.viewPortOrientationChanged);
|
|
295
297
|
}
|
|
@@ -317,20 +319,23 @@ const Q2Popover = class {
|
|
|
317
319
|
let maxSpaceAbove;
|
|
318
320
|
let maxSpaceBelow;
|
|
319
321
|
if (isModule) {
|
|
320
|
-
const { outletOffset = 0, innerHeight = window.innerHeight } = ((_c = window.Tecton) === null || _c === void 0 ? void 0 : _c.platformDimensions) || {};
|
|
321
|
-
const distanceToIframeBottom = window.
|
|
322
|
-
|
|
322
|
+
const { outletOffset = 0, innerHeight = window.innerHeight, top: topBarHeight = 0, bottom: bottomBarHeight = 0, } = ((_c = window.Tecton) === null || _c === void 0 ? void 0 : _c.platformDimensions) || {};
|
|
323
|
+
const distanceToIframeBottom = window.innerHeight - controlBottom;
|
|
324
|
+
// controlElement position visually on the page
|
|
325
|
+
const visualControlTop = outletOffset > 0 ? controlTop : controlTop + outletOffset - topBarHeight;
|
|
326
|
+
const visualControlBottom = outletOffset + controlBottom - topBarHeight;
|
|
327
|
+
// visual space around the controlElement
|
|
328
|
+
const viewableSpaceAbove = visualControlTop;
|
|
329
|
+
const viewableSpaceBelow = innerHeight - bottomBarHeight - visualControlBottom;
|
|
330
|
+
// calculate space above and below controlElement
|
|
323
331
|
const isIframeShorterThanWindow = distanceToIframeBottom < viewableSpaceBelow;
|
|
324
|
-
|
|
325
|
-
// If the top of the module is below the top of the window we just use the controlTop
|
|
326
|
-
// Otherwise we need to add the outletOffset to the controlTop
|
|
327
|
-
maxSpaceAbove = (outletOffset > 0 ? controlTop : controlTop + outletOffset) - displayBuffer;
|
|
332
|
+
maxSpaceAbove = viewableSpaceAbove - displayBuffer;
|
|
328
333
|
maxSpaceBelow = isIframeShorterThanWindow
|
|
329
334
|
? distanceToIframeBottom - displayBuffer
|
|
330
335
|
: viewableSpaceBelow - displayBuffer;
|
|
331
336
|
}
|
|
332
337
|
else {
|
|
333
|
-
windowHeight = window.
|
|
338
|
+
windowHeight = window.innerHeight;
|
|
334
339
|
maxSpaceAbove = controlTop - displayBuffer;
|
|
335
340
|
maxSpaceBelow = windowHeight - controlBottom - displayBuffer;
|
|
336
341
|
}
|
|
@@ -393,7 +398,7 @@ const Q2Popover = class {
|
|
|
393
398
|
containerClasses.push('block');
|
|
394
399
|
if (this.mode === 'legacy')
|
|
395
400
|
containerClasses.push('legacy');
|
|
396
|
-
return (index.h("div", { key: '
|
|
401
|
+
return (index.h("div", { key: '4cd26a6c090a6fb5b56d2fa6464143f74998c215', ref: el => (this.containerElement = el), class: containerClasses.join(' '), "test-id": "outerContainer", tabIndex: -1, popover: "manual" }, index.h("div", { key: '545c376ca96c14e129a8f60fadac3a3264b916cf', ref: el => (this.contentElement = el), class: "content" }, index.h("slot", { key: '9a2824ab9023f34a2b3a56a76ace4df6a91b5ec6' }))));
|
|
397
402
|
}
|
|
398
403
|
get hostElement() { return index.getElement(this); }
|
|
399
404
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"click-elsewhere.q2-popover.entry.cjs.js","mappings":";;;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IAAI;YAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,KAAK;YAAE,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;YAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5D,QACIC,kEACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,aACzB,gBAAgB,EACxB,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAC,MAAM,IAEdA,kEACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,KAAK,EAAC,SAAS,IAEfA,oEAAQ,CACN,CACJ,EACR;KACL;;;;;;;;;;;;","names":["handleDeprecationWarning","waitForNextPaint","h"],"sources":["src/components/click-elsewhere/click-elsewhere.tsx","src/components/q2-popover/q2-popover.scss?tag=q2-popover&encapsulation=shadow","src/components/q2-popover/q2-popover.tsx"],"sourcesContent":["import { Component, ComponentInterface, Element, Event, EventEmitter } from '@stencil/core';\n\n@Component({\n tag: 'click-elsewhere',\n shadow: false,\n})\nexport class ClickElsewhere implements ComponentInterface {\n // #region Own Properties\n\n isCurrentlyFocused: boolean = false;\n /**\n * Listens for mouse and window events that happen outside this click-elsewhere element so we can close popovers when users click outside them\n */\n mouseEventList: string[] = ['mousedown', 'dragstart', 'touchstart'];\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region Events\n\n /**\n * Emitted when the user clicks outside the element\n */\n @Event()\n change: EventEmitter;\n\n // #endregion\n // #region Component Lifecycle Events\n\n /* tslint:enable:no-empty */\n\n connectedCallback() {\n this.mouseEventList.forEach((eventName: string) => {\n document.addEventListener(eventName, this.mouseHandler);\n });\n window.addEventListener('blur', this.windowBlurHandler);\n }\n\n disconnectedCallback() {\n this.mouseEventList.forEach((eventName: string) => {\n document.removeEventListener(eventName, this.mouseHandler);\n });\n window.removeEventListener('blur', this.windowBlurHandler);\n }\n\n /* TODO: Stencil/Rollup is having issues compiling without this here. Will try to remove in future Stencil upgrade. */\n /* tslint:disable:no-empty */\n componentWillLoad() {}\n\n // #endregion\n // #region Local Methods\n\n findActiveElement(): Element | null {\n let workingElement = document.activeElement!;\n while (true) {\n if (!workingElement || !workingElement.shadowRoot) {\n return workingElement;\n }\n workingElement = workingElement.shadowRoot.activeElement;\n }\n }\n\n mouseHandler = (event: Event): void => {\n const isCurrentlyFocused = this.shadowContains(this.findActiveElement());\n const aboutToBeFocused =\n this.shadowContains(this.shadowEventTarget(event)) || this.originatesInSlots(event.target as Element);\n\n if (!aboutToBeFocused && (this.isCurrentlyFocused || isCurrentlyFocused)) {\n this.isCurrentlyFocused = false;\n this.change.emit();\n return;\n }\n this.isCurrentlyFocused = aboutToBeFocused || isCurrentlyFocused;\n };\n\n originatesInSlots(target: Element): boolean {\n const slots = this.hostElement.querySelectorAll('slot');\n for (const currentSlot of Array.from(slots)) {\n const lightNodes =\n (currentSlot && currentSlot.assignedNodes && currentSlot.assignedNodes()) ||\n this.hostElement.childNodes;\n\n for (const currentNode of Array.from(lightNodes)) {\n if (currentNode.contains(target)) {\n return true;\n }\n }\n }\n return false;\n }\n\n shadowContains(child: any): boolean {\n /**\n * shadow-dom enabled version of Node.contains()\n */\n\n while (true) {\n if (child === this.hostElement) {\n return true;\n }\n if (!child) {\n return false;\n }\n child = child.parentNode || child.host;\n }\n }\n\n shadowEventTarget(event: any): Element {\n return event.composedPath()[0] || event.target;\n }\n\n windowBlurHandler = (): void => {\n this.isCurrentlyFocused = false;\n this.change.emit();\n };\n}\n","@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n.legacy {\n &.container {\n display: none;\n }\n\n &.show {\n display: block;\n z-index: var-list(--tct-popover-z-index, 50);\n }\n}\n\n:popover-open,\n.show {\n position: absolute;\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(\n --tct-popover-box-shadow,\n --app-shadow-1,\n unquote('0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14)')\n );\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 --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 &.block {\n right: unset;\n width: var(--comp-pop-width);\n min-width: var-list(--tct-popover-min-width, unset);\n }\n\n &.left {\n left: var(--comp-pop-left);\n right: unset;\n }\n\n &.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 @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 // #region Own Properties\n\n containerElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n /**\n * The number of pixels to leave between the popover and the edge of the viewport\n */\n displayBuffer = 10;\n orientationChanged: boolean = false;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n currentDirection: 'down' | 'up' = undefined;\n\n // remove `show` when Popover API is supported in iOS\n @State()\n show: boolean = false;\n\n // #endregion\n // #region Public Property API\n\n /** Aligns the popover to the left or right side of the control element. */\n @Prop({ reflect: true })\n align: 'left' | 'right' = 'left';\n\n /** Indicates the popover will match the width of its parent element. */\n @Prop({ reflect: true })\n block: boolean;\n\n /** The element that controls the popover's behavior. */\n @Prop()\n controlElement: HTMLElement;\n\n /**\n * Force the direction of the popover when it opens.\n * If no value is passed, the component will auto-detect the direction based on available space.\n */\n @Prop({ reflect: true })\n direction: 'up' | 'down';\n\n /**\n * Force the maximum height of the popover. This value will be interpreted as pixels.\n * If no value is passed, or the value exceeds available space, the component will auto-detect the maximum height based on available space.\n */\n @Prop()\n maxHeight: number;\n\n /** @deprecated */\n @Prop()\n minHeight: number;\n\n @Prop()\n mode: 'legacy' = null;\n\n /** Controls whether the popover is open or closed. */\n @Prop({ reflect: true, mutable: true })\n open: boolean;\n\n // #endregion\n // #region Events\n\n /**\n * Emitted when the popover is opened or closed.\n */\n @Event()\n popoverStateChanged: EventEmitter<{ open: boolean }>;\n\n // #endregion\n // #region Component Lifecycle Events\n\n disconnectedCallback() {\n this.removeViewportListeners();\n this.containerElement.removeEventListener('toggle', this.handlePopoverToggleEvent);\n this.containerElement = null;\n this.contentElement = null;\n this.controlElement = null;\n }\n\n componentWillLoad() {\n if (!this.supportsPopoverAPI) {\n console.warn(\n 'The Popover API is not supported in this browser. Please update your browser to the latest version. The component will use legacy mode.'\n );\n this.mode = 'legacy';\n }\n }\n\n componentDidLoad() {\n this.handleMinHeight();\n if (this.supportsPopoverAPI) this.containerElement.addEventListener('toggle', this.handlePopoverToggleEvent);\n if (this.open) this.determinePopDirection();\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('popoverState')\n popoverStateHandler(event: CustomEvent<{ open: boolean }>) {\n const {\n detail: { open },\n } = event;\n if (open === this.open) return;\n\n this.open = open;\n event.stopPropagation();\n }\n\n // #endregion\n // #region Public Methods API\n\n @Method()\n async scrollContainerTo(options: ScrollToOptions) {\n this.containerElement.scrollTo(options);\n }\n\n @Method()\n async toggle() {\n this.open = !this.open;\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('minHeight')\n minHeightProvided() {\n this.handleMinHeight();\n }\n\n @Watch('open')\n async openChanged(open: boolean) {\n this.popoverStateChanged.emit({ open });\n\n if (open) {\n this.addViewportListeners();\n this.determinePopDirection();\n } else {\n this.removeViewportListeners();\n this.currentDirection = undefined;\n if (this.mode === 'legacy' || !this.supportsPopoverAPI) {\n this.show = false;\n } else {\n this.containerElement.hidePopover();\n }\n\n await waitForNextPaint();\n this.clearCSSProperties();\n }\n }\n\n // #endregion\n // #region Local Methods\n\n get isModule() {\n const isIframe = window !== window.top;\n const hasPlatformDimensions = Object.keys(window.Tecton?.platformDimensions ?? {}).length > 0;\n return isIframe && hasPlatformDimensions;\n }\n\n get providedDirection(): 'up' | 'down' | undefined {\n const { direction } = this;\n switch (direction) {\n case 'up':\n case 'down':\n return direction;\n default:\n return undefined;\n }\n }\n\n get supportsPopoverAPI(): boolean {\n return Object.hasOwn(HTMLElement.prototype, 'popover');\n }\n\n get validatedMaxHeight(): number | undefined {\n const { maxHeight } = this;\n return isNaN(maxHeight) ? undefined : maxHeight;\n }\n\n addViewportListeners() {\n window.addEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.addEventListener('resize', this.viewPortChanged);\n window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });\n screen?.orientation?.addEventListener('orientationchange', this.viewPortOrientationChanged);\n window.addEventListener('orientationchange', this.viewPortOrientationChanged);\n }\n\n clearCSSProperties() {\n this.containerElement.style.removeProperty('--comp-pop-max-height');\n this.containerElement.style.removeProperty('--comp-pop-top');\n this.containerElement.style.removeProperty('--comp-pop-bottom');\n this.containerElement.style.removeProperty('--comp-pop-left');\n this.containerElement.style.removeProperty('--comp-pop-right');\n this.containerElement.style.removeProperty('--comp-pop-width');\n this.containerElement.style.removeProperty('--comp-pop-opacity');\n }\n\n async determinePopDirection() {\n const { containerElement, controlElement, providedDirection, displayBuffer } = this;\n if (containerElement) containerElement.style.maxHeight = null;\n\n await waitForNextPaint();\n\n const { isModule } = this;\n const { top: controlTop, bottom: controlBottom } = controlElement?.getBoundingClientRect?.() ?? {\n top: 0,\n bottom: 0,\n };\n\n let windowHeight: number;\n let maxSpaceAbove: number;\n let maxSpaceBelow: number;\n\n if (isModule) {\n const { outletOffset = 0, innerHeight = window.innerHeight } = window.Tecton?.platformDimensions || {};\n const distanceToIframeBottom = window.visualViewport.height - controlBottom;\n const viewableSpaceBelow = innerHeight - (outletOffset + controlBottom);\n const isIframeShorterThanWindow = distanceToIframeBottom < viewableSpaceBelow;\n windowHeight = innerHeight;\n // If the top of the module is below the top of the window we just use the controlTop\n // Otherwise we need to add the outletOffset to the controlTop\n maxSpaceAbove = (outletOffset > 0 ? controlTop : controlTop + outletOffset) - displayBuffer;\n maxSpaceBelow = isIframeShorterThanWindow\n ? distanceToIframeBottom - displayBuffer\n : viewableSpaceBelow - displayBuffer;\n } else {\n windowHeight = window.visualViewport.height;\n maxSpaceAbove = controlTop - displayBuffer;\n maxSpaceBelow = windowHeight - controlBottom - displayBuffer;\n }\n\n const directionWithMostSpace: 'up' | 'down' = maxSpaceAbove > maxSpaceBelow ? 'up' : 'down';\n\n // We do not want to update the max height once the popover is open unless the page orientation shifts (resize or mobile use cases)\n const shouldUpdateMaxHeight =\n !containerElement.style.getPropertyValue('--comp-pop-max-height') || this.orientationChanged;\n // we do not want to constantly update the max-height after an orientation change, so we switch this back to false\n this.orientationChanged = false;\n const currentOrDetermineDirection = this.currentDirection || providedDirection || directionWithMostSpace;\n\n switch (currentOrDetermineDirection) {\n case 'up':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceAbove;\n const maxHeight = Math.min(maxSpaceAbove, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('up');\n break;\n case 'down':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceBelow;\n const maxHeight = Math.min(maxSpaceBelow, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('down');\n break;\n default:\n break;\n }\n }\n\n handleMinHeight = () => {\n if (this.minHeight) {\n handleDeprecationWarning(this, 'minHeight', 'prop');\n }\n };\n\n handlePopoverToggleEvent = (event: ToggleEvent) => {\n this.popoverStateChanged.emit({ open: event.newState === 'open' });\n };\n\n removeViewportListeners() {\n window.removeEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.removeEventListener('resize', this.viewPortChanged);\n window.removeEventListener('scroll', this.viewPortChanged, { capture: true });\n screen?.orientation?.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n window.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n }\n\n setAbsoluteCSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, align } = this;\n\n if (align === 'right') {\n containerElement.style.setProperty('--comp-pop-right', '0');\n containerElement.style.setProperty('--comp-pop-left', 'unset');\n } else {\n containerElement.style.setProperty('--comp-pop-left', '0');\n containerElement.style.setProperty('--comp-pop-right', 'unset');\n }\n\n if (this.block) {\n containerElement.style.setProperty('--comp-pop-width', '100%');\n }\n\n if (currentDirection === 'up') {\n const controlStyle = getComputedStyle(controlElement);\n const controlSize =\n parseInt(controlStyle.height || '0') +\n parseInt(controlStyle.borderTopWidth || '0') +\n parseInt(controlStyle.borderBottomWidth || '0');\n\n containerElement.style.setProperty('--comp-pop-bottom', `${controlSize}px`);\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n setDirectionAndShow(direction: 'up' | 'down') {\n // Due to some runtime inconsistency across devices/browsers we need to add one more check here because the\n // popover can be closed between the time the popover is opened and the time the direction is determined\n const isOpen = this.open;\n if (!isOpen) return;\n\n this.currentDirection = direction;\n if (this.mode === 'legacy' || !this.supportsPopoverAPI) {\n this.show = true;\n this.setAbsoluteCSSProperties();\n } else {\n this.setPopoverAPICSSProperties();\n this.containerElement.showPopover();\n }\n }\n\n setPopoverAPICSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, isModule, align } = this;\n const {\n top: controlTop,\n bottom: controlBottom,\n left: controlLeft,\n right: controlRight,\n } = controlElement?.getBoundingClientRect?.() ?? {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n };\n\n const popoverLeft: number = controlLeft;\n const popoverRight: number = window?.visualViewport?.width - controlRight;\n\n if (align === 'right') {\n containerElement.style.setProperty('--comp-pop-right', `${popoverRight - window.scrollX}px`);\n containerElement.style.setProperty('--comp-pop-left', 'unset');\n } else {\n containerElement.style.setProperty('--comp-pop-left', `${popoverLeft + window.scrollX}px`);\n containerElement.style.setProperty('--comp-pop-right', 'unset');\n }\n\n if (this.block) containerElement.style.setProperty('--comp-pop-width', `${controlElement?.offsetWidth || 0}px`);\n\n if (currentDirection === 'up') {\n if (isModule) {\n containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop}px`);\n } else {\n containerElement.style.setProperty(\n '--comp-pop-bottom',\n `${window.innerHeight - controlTop - window?.visualViewport?.offsetTop - window.scrollY}px`\n );\n }\n }\n\n if (currentDirection === 'down') {\n if (isModule) {\n containerElement.style.setProperty('--comp-pop-top', `${controlBottom}px`);\n } else {\n containerElement.style.setProperty(\n '--comp-pop-top',\n `${controlBottom + (window?.visualViewport?.offsetTop ?? 0) + window.scrollY}px`\n );\n }\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n viewPortChanged = () => {\n if (!this.open) return;\n this.determinePopDirection();\n };\n\n viewPortOrientationChanged = () => {\n this.orientationChanged = true;\n this.viewPortChanged();\n };\n\n // #endregion\n // #region Render Methods\n\n render() {\n const containerClasses = ['container', this.currentDirection, this.align];\n if (this.show) containerClasses.push('show');\n if (this.block) containerClasses.push('block');\n if (this.mode === 'legacy') containerClasses.push('legacy');\n\n return (\n <div\n ref={el => (this.containerElement = el)}\n class={containerClasses.join(' ')}\n test-id=\"outerContainer\"\n tabIndex={-1}\n popover=\"auto\"\n >\n <div\n ref={el => (this.contentElement = el)}\n class=\"content\"\n >\n <slot />\n </div>\n </div>\n );\n }\n\n // #endregion\n}\n"],"version":3}
|
|
1
|
+
{"file":"click-elsewhere.q2-popover.entry.cjs.js","mappings":";;;;;;;MAMa,cAAc;IAJ3B;;;;QAOI,uBAAkB,GAAY,KAAK,CAAC;;;;QAIpC,mBAAc,GAAa,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QAqDpE,iBAAY,GAAG,CAAC,KAAY;YACxB,MAAM,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;YACzE,MAAM,gBAAgB,GAClB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAiB,CAAC,CAAC;YAE1G,IAAI,CAAC,gBAAgB,KAAK,IAAI,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,EAAE;gBACtE,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;gBAChC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACnB,OAAO;aACV;YACD,IAAI,CAAC,kBAAkB,GAAG,gBAAgB,IAAI,kBAAkB,CAAC;SACpE,CAAC;QAsCF,sBAAiB,GAAG;YAChB,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;SACtB,CAAC;KACL;;;;IApFG,iBAAiB;QACb,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,SAAiB;YAC1C,QAAQ,CAAC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AAC;QAClC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YACpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC,wBAAwB,EAAE,CAAC;SACnC;aAAM;YACH,IAAI,CAAC,0BAA0B,EAAE,CAAC;YAClC,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAAC;SACvC;KACJ;;;IAkED,MAAM;QACF,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1E,IAAI,IAAI,CAAC,IAAI;YAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,IAAI,IAAI,CAAC,KAAK;YAAE,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;YAAE,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE5D,QACIG,kEACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC,EACvC,KAAK,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,aACzB,gBAAgB,EACxB,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAC,QAAQ,IAEhBA,kEACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,EACrC,KAAK,EAAC,SAAS,IAEfA,oEAAQ,CACN,CACJ,EACR;KACL;;;;;;;;;;;;","names":["handleDeprecationWarning","waitForNextPaint","isInScrollableContainer","isMobile","h"],"sources":["src/components/click-elsewhere/click-elsewhere.tsx","src/components/q2-popover/q2-popover.scss?tag=q2-popover&encapsulation=shadow","src/components/q2-popover/q2-popover.tsx"],"sourcesContent":["import { Component, ComponentInterface, Element, Event, EventEmitter } from '@stencil/core';\n\n@Component({\n tag: 'click-elsewhere',\n shadow: false,\n})\nexport class ClickElsewhere implements ComponentInterface {\n // #region Own Properties\n\n isCurrentlyFocused: boolean = false;\n /**\n * Listens for mouse and window events that happen outside this click-elsewhere element so we can close popovers when users click outside them\n */\n mouseEventList: string[] = ['mousedown', 'dragstart', 'touchstart'];\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region Events\n\n /**\n * Emitted when the user clicks outside the element\n */\n @Event()\n change: EventEmitter;\n\n // #endregion\n // #region Component Lifecycle Events\n\n /* tslint:enable:no-empty */\n\n connectedCallback() {\n this.mouseEventList.forEach((eventName: string) => {\n document.addEventListener(eventName, this.mouseHandler);\n });\n window.addEventListener('blur', this.windowBlurHandler);\n }\n\n disconnectedCallback() {\n this.mouseEventList.forEach((eventName: string) => {\n document.removeEventListener(eventName, this.mouseHandler);\n });\n window.removeEventListener('blur', this.windowBlurHandler);\n }\n\n /* TODO: Stencil/Rollup is having issues compiling without this here. Will try to remove in future Stencil upgrade. */\n /* tslint:disable:no-empty */\n componentWillLoad() {}\n\n // #endregion\n // #region Local Methods\n\n findActiveElement(): Element | null {\n let workingElement = document.activeElement!;\n while (true) {\n if (!workingElement || !workingElement.shadowRoot) {\n return workingElement;\n }\n workingElement = workingElement.shadowRoot.activeElement;\n }\n }\n\n mouseHandler = (event: Event): void => {\n const isCurrentlyFocused = this.shadowContains(this.findActiveElement());\n const aboutToBeFocused =\n this.shadowContains(this.shadowEventTarget(event)) || this.originatesInSlots(event.target as Element);\n\n if (!aboutToBeFocused && (this.isCurrentlyFocused || isCurrentlyFocused)) {\n this.isCurrentlyFocused = false;\n this.change.emit();\n return;\n }\n this.isCurrentlyFocused = aboutToBeFocused || isCurrentlyFocused;\n };\n\n originatesInSlots(target: Element): boolean {\n const slots = this.hostElement.querySelectorAll('slot');\n for (const currentSlot of Array.from(slots)) {\n const lightNodes =\n (currentSlot && currentSlot.assignedNodes && currentSlot.assignedNodes()) ||\n this.hostElement.childNodes;\n\n for (const currentNode of Array.from(lightNodes)) {\n if (currentNode.contains(target)) {\n return true;\n }\n }\n }\n return false;\n }\n\n shadowContains(child: any): boolean {\n /**\n * shadow-dom enabled version of Node.contains()\n */\n\n while (true) {\n if (child === this.hostElement) {\n return true;\n }\n if (!child) {\n return false;\n }\n child = child.parentNode || child.host;\n }\n }\n\n shadowEventTarget(event: any): Element {\n return event.composedPath()[0] || event.target;\n }\n\n windowBlurHandler = (): void => {\n this.isCurrentlyFocused = false;\n this.change.emit();\n };\n}\n","@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n.legacy {\n &.container {\n display: none;\n }\n\n &.show {\n display: block;\n z-index: var-list(--tct-popover-z-index, 50);\n }\n}\n\n:popover-open,\n.show {\n position: absolute;\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(\n --tct-popover-box-shadow,\n --app-shadow-1,\n unquote('0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14)')\n );\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 --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 &.block {\n right: unset;\n width: var(--comp-pop-width);\n min-width: var-list(--tct-popover-min-width, unset);\n }\n\n &.left {\n left: var(--comp-pop-left);\n right: unset;\n }\n\n &.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 @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, isMobile, isInScrollableContainer } from '../../utils';\n\n@Component({ tag: 'q2-popover', shadow: true, styleUrl: 'q2-popover.scss' })\nexport class Q2Popover implements ComponentInterface {\n // #region Own Properties\n\n containerElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n /**\n * The number of pixels to leave between the popover and the edge of the viewport\n */\n displayBuffer = 10;\n orientationChanged: boolean = false;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n currentDirection: 'down' | 'up' = undefined;\n\n // remove `show` when Popover API is supported in iOS\n @State()\n show: boolean = false;\n\n // #endregion\n // #region Public Property API\n\n /** Aligns the popover to the left or right side of the control element. */\n @Prop({ reflect: true })\n align: 'left' | 'right' = 'left';\n\n /** Indicates the popover will match the width of its parent element. */\n @Prop({ reflect: true })\n block: boolean;\n\n /** The element that controls the popover's behavior. */\n @Prop()\n controlElement: HTMLElement;\n\n /**\n * Force the direction of the popover when it opens.\n * If no value is passed, the component will auto-detect the direction based on available space.\n */\n @Prop({ reflect: true })\n direction: 'up' | 'down';\n\n /**\n * Force the maximum height of the popover. This value will be interpreted as pixels.\n * If no value is passed, or the value exceeds available space, the component will auto-detect the maximum height based on available space.\n */\n @Prop()\n maxHeight: number;\n\n /** @deprecated */\n @Prop()\n minHeight: number;\n\n @Prop()\n mode: 'legacy' = null;\n\n /** Controls whether the popover is open or closed. */\n @Prop({ reflect: true, mutable: true })\n open: boolean;\n\n // #endregion\n // #region Events\n\n /**\n * Emitted when the popover is opened or closed.\n */\n @Event()\n popoverStateChanged: EventEmitter<{ open: boolean }>;\n\n // #endregion\n // #region Component Lifecycle Events\n\n disconnectedCallback() {\n this.removeViewportListeners();\n this.containerElement.removeEventListener('toggle', this.handlePopoverToggleEvent);\n this.containerElement = null;\n this.contentElement = null;\n this.controlElement = null;\n }\n\n componentWillLoad() {\n if (!this.supportsPopoverAPI) {\n console.warn(\n 'The Popover API is not supported in this browser. Please update your browser to the latest version. The component will use legacy mode.'\n );\n this.mode = 'legacy';\n }\n }\n\n componentDidLoad() {\n this.handleMinHeight();\n if (this.supportsPopoverAPI) this.containerElement.addEventListener('toggle', this.handlePopoverToggleEvent);\n if (this.open) this.determinePopDirection();\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('popoverState')\n popoverStateHandler(event: CustomEvent<{ open: boolean }>) {\n const {\n detail: { open },\n } = event;\n if (open === this.open) return;\n\n this.open = open;\n event.stopPropagation();\n }\n\n // #endregion\n // #region Public Methods API\n\n @Method()\n async scrollContainerTo(options: ScrollToOptions) {\n this.containerElement.scrollTo(options);\n }\n\n @Method()\n async toggle() {\n this.open = !this.open;\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('minHeight')\n minHeightProvided() {\n this.handleMinHeight();\n }\n\n @Watch('open')\n async openChanged(open: boolean) {\n this.popoverStateChanged.emit({ open });\n\n if (open) {\n this.addViewportListeners();\n this.determinePopDirection();\n } else {\n this.removeViewportListeners();\n this.currentDirection = undefined;\n if (this.mode === 'legacy' || !this.supportsPopoverAPI) {\n this.show = false;\n } else {\n this.containerElement.hidePopover();\n }\n\n await waitForNextPaint();\n this.clearCSSProperties();\n }\n }\n\n // #endregion\n // #region Local Methods\n\n get isModule() {\n const isIframe = window !== window.top;\n const hasPlatformDimensions = Object.keys(window.Tecton?.platformDimensions ?? {}).length > 0;\n return isIframe && hasPlatformDimensions;\n }\n\n get providedDirection(): 'up' | 'down' | undefined {\n const { direction } = this;\n switch (direction) {\n case 'up':\n case 'down':\n return direction;\n default:\n return undefined;\n }\n }\n\n get supportsPopoverAPI(): boolean {\n return Object.hasOwn(HTMLElement.prototype, 'popover');\n }\n\n get validatedMaxHeight(): number | undefined {\n const { maxHeight } = this;\n return isNaN(maxHeight) ? undefined : maxHeight;\n }\n\n addViewportListeners() {\n window.addEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.addEventListener('resize', this.viewPortChanged);\n if (isInScrollableContainer(this.hostElement) && !isMobile()) {\n window.addEventListener('scroll', this.viewPortChanged, { passive: true, capture: true });\n }\n screen?.orientation?.addEventListener('orientationchange', this.viewPortOrientationChanged);\n window.addEventListener('orientationchange', this.viewPortOrientationChanged);\n }\n\n clearCSSProperties() {\n this.containerElement.style.removeProperty('--comp-pop-max-height');\n this.containerElement.style.removeProperty('--comp-pop-top');\n this.containerElement.style.removeProperty('--comp-pop-bottom');\n this.containerElement.style.removeProperty('--comp-pop-left');\n this.containerElement.style.removeProperty('--comp-pop-right');\n this.containerElement.style.removeProperty('--comp-pop-width');\n this.containerElement.style.removeProperty('--comp-pop-opacity');\n }\n\n async determinePopDirection() {\n const { containerElement, controlElement, providedDirection, displayBuffer } = this;\n if (containerElement) containerElement.style.maxHeight = null;\n 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 if (isModule) {\n const {\n outletOffset = 0,\n innerHeight = window.innerHeight,\n top: topBarHeight = 0,\n bottom: bottomBarHeight = 0,\n } = window.Tecton?.platformDimensions || {};\n\n const distanceToIframeBottom = window.innerHeight - controlBottom;\n\n // controlElement position visually on the page\n const visualControlTop = outletOffset > 0 ? controlTop : controlTop + outletOffset - topBarHeight;\n const visualControlBottom = outletOffset + controlBottom - topBarHeight;\n\n // visual space around the controlElement\n const viewableSpaceAbove = visualControlTop;\n const viewableSpaceBelow = innerHeight - bottomBarHeight - visualControlBottom;\n\n // calculate space above and below controlElement\n const isIframeShorterThanWindow = distanceToIframeBottom < viewableSpaceBelow;\n maxSpaceAbove = viewableSpaceAbove - displayBuffer;\n maxSpaceBelow = isIframeShorterThanWindow\n ? distanceToIframeBottom - displayBuffer\n : viewableSpaceBelow - displayBuffer;\n } else {\n windowHeight = window.innerHeight;\n maxSpaceAbove = controlTop - displayBuffer;\n maxSpaceBelow = windowHeight - controlBottom - displayBuffer;\n }\n\n const directionWithMostSpace: 'up' | 'down' = maxSpaceAbove > maxSpaceBelow ? 'up' : 'down';\n\n // We do not want to update the max height once the popover is open unless the page orientation shifts (resize or mobile use cases)\n const shouldUpdateMaxHeight =\n !containerElement.style.getPropertyValue('--comp-pop-max-height') || this.orientationChanged;\n // we do not want to constantly update the max-height after an orientation change, so we switch this back to false\n this.orientationChanged = false;\n const currentOrDetermineDirection = this.currentDirection || providedDirection || directionWithMostSpace;\n\n switch (currentOrDetermineDirection) {\n case 'up':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceAbove;\n const maxHeight = Math.min(maxSpaceAbove, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('up');\n break;\n case 'down':\n if (shouldUpdateMaxHeight) {\n const priorityMaxHeight = this.validatedMaxHeight || maxSpaceBelow;\n const maxHeight = Math.min(maxSpaceBelow, priorityMaxHeight);\n containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);\n }\n this.setDirectionAndShow('down');\n break;\n default:\n break;\n }\n }\n\n handleMinHeight = () => {\n if (this.minHeight) {\n handleDeprecationWarning(this, 'minHeight', 'prop');\n }\n };\n\n handlePopoverToggleEvent = (event: ToggleEvent) => {\n this.popoverStateChanged.emit({ open: event.newState === 'open' });\n };\n\n removeViewportListeners() {\n window.removeEventListener('resize', this.viewPortOrientationChanged);\n visualViewport?.removeEventListener('resize', this.viewPortChanged);\n window.removeEventListener('scroll', this.viewPortChanged, { capture: true });\n screen?.orientation?.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n window.removeEventListener('orientationchange', this.viewPortOrientationChanged);\n }\n\n setAbsoluteCSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, align } = this;\n\n if (align === 'right') {\n containerElement.style.setProperty('--comp-pop-right', '0');\n containerElement.style.setProperty('--comp-pop-left', 'unset');\n } else {\n containerElement.style.setProperty('--comp-pop-left', '0');\n containerElement.style.setProperty('--comp-pop-right', 'unset');\n }\n\n if (this.block) {\n containerElement.style.setProperty('--comp-pop-width', '100%');\n }\n\n if (currentDirection === 'up') {\n const controlStyle = getComputedStyle(controlElement);\n const controlSize =\n parseInt(controlStyle.height || '0') +\n parseInt(controlStyle.borderTopWidth || '0') +\n parseInt(controlStyle.borderBottomWidth || '0');\n\n containerElement.style.setProperty('--comp-pop-bottom', `${controlSize}px`);\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n setDirectionAndShow(direction: 'up' | 'down') {\n // Due to some runtime inconsistency across devices/browsers we need to add one more check here because the\n // popover can be closed between the time the popover is opened and the time the direction is determined\n const isOpen = this.open;\n if (!isOpen) return;\n\n this.currentDirection = direction;\n if (this.mode === 'legacy' || !this.supportsPopoverAPI) {\n this.show = true;\n this.setAbsoluteCSSProperties();\n } else {\n this.setPopoverAPICSSProperties();\n this.containerElement.showPopover();\n }\n }\n\n setPopoverAPICSSProperties = async () => {\n const { controlElement, containerElement, currentDirection, isModule, align } = this;\n const {\n top: controlTop,\n bottom: controlBottom,\n left: controlLeft,\n right: controlRight,\n } = controlElement?.getBoundingClientRect?.() ?? {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n };\n\n const popoverLeft: number = controlLeft;\n const popoverRight: number = window?.visualViewport?.width - controlRight;\n\n if (align === 'right') {\n containerElement.style.setProperty('--comp-pop-right', `${popoverRight - window.scrollX}px`);\n containerElement.style.setProperty('--comp-pop-left', 'unset');\n } else {\n containerElement.style.setProperty('--comp-pop-left', `${popoverLeft + window.scrollX}px`);\n containerElement.style.setProperty('--comp-pop-right', 'unset');\n }\n\n if (this.block) containerElement.style.setProperty('--comp-pop-width', `${controlElement?.offsetWidth || 0}px`);\n\n if (currentDirection === 'up') {\n if (isModule) {\n containerElement.style.setProperty('--comp-pop-bottom', `${window.innerHeight - controlTop}px`);\n } else {\n containerElement.style.setProperty(\n '--comp-pop-bottom',\n `${window.innerHeight - controlTop - window.scrollY}px`\n );\n }\n }\n\n if (currentDirection === 'down') {\n if (isModule) {\n containerElement.style.setProperty('--comp-pop-top', `${controlBottom}px`);\n } else {\n containerElement.style.setProperty('--comp-pop-top', `${controlBottom + window.scrollY}px`);\n }\n }\n\n // Wait for one paint to prevent layout thrashing\n await waitForNextPaint();\n containerElement.style.setProperty('--comp-pop-opacity', '1');\n };\n\n viewPortChanged = () => {\n if (!this.open) return;\n this.determinePopDirection();\n };\n\n viewPortOrientationChanged = () => {\n this.orientationChanged = true;\n this.viewPortChanged();\n };\n\n // #endregion\n // #region Render Methods\n\n render() {\n const containerClasses = ['container', this.currentDirection, this.align];\n if (this.show) containerClasses.push('show');\n if (this.block) containerClasses.push('block');\n if (this.mode === 'legacy') containerClasses.push('legacy');\n\n return (\n <div\n ref={el => (this.containerElement = el)}\n class={containerClasses.join(' ')}\n test-id=\"outerContainer\"\n tabIndex={-1}\n popover=\"manual\"\n >\n <div\n ref={el => (this.contentElement = el)}\n class=\"content\"\n >\n <slot />\n </div>\n </div>\n );\n }\n\n // #endregion\n}\n"],"version":3}
|
|
@@ -14,6 +14,37 @@ const debounce = (fn, delay = 300) => {
|
|
|
14
14
|
function isMobile() {
|
|
15
15
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile|IEMobile|Windows Phone|Opera Mini/i.test(navigator.userAgent);
|
|
16
16
|
}
|
|
17
|
+
function isInScrollableContainer(element) {
|
|
18
|
+
let current = element;
|
|
19
|
+
while (current && current !== document.body && current !== document.documentElement) {
|
|
20
|
+
// Move to parent
|
|
21
|
+
if (current.parentElement) {
|
|
22
|
+
current = current.parentElement;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// Try to cross shadow DOM boundary
|
|
26
|
+
const root = current.getRootNode();
|
|
27
|
+
if (root && root.host) {
|
|
28
|
+
current = root.host;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const style = window.getComputedStyle(current);
|
|
35
|
+
const hasScrollableOverflow = style.overflow === 'scroll' ||
|
|
36
|
+
style.overflow === 'auto' ||
|
|
37
|
+
style.overflowX === 'scroll' ||
|
|
38
|
+
style.overflowX === 'auto' ||
|
|
39
|
+
style.overflowY === 'scroll' ||
|
|
40
|
+
style.overflowY === 'auto';
|
|
41
|
+
const hasOverflowingContent = current.scrollHeight > current.clientHeight || current.scrollWidth > current.clientWidth;
|
|
42
|
+
if (hasScrollableOverflow && hasOverflowingContent) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
17
48
|
function isRelatedTargetWithinHost(event, element) {
|
|
18
49
|
return event.relatedTarget !== element && !element.contains(event.relatedTarget);
|
|
19
50
|
}
|
|
@@ -67,6 +98,40 @@ function loc(key, subs) {
|
|
|
67
98
|
}
|
|
68
99
|
return (_c = (_b = window === null || window === void 0 ? void 0 : window.TectonElements) === null || _b === void 0 ? void 0 : _b.loc(key, subs)) !== null && _c !== void 0 ? _c : key;
|
|
69
100
|
}
|
|
101
|
+
function getBrowserInfo() {
|
|
102
|
+
const userAgent = navigator.userAgent;
|
|
103
|
+
let browserName = 'Unknown';
|
|
104
|
+
let browserVersion = 'Unknown';
|
|
105
|
+
if (userAgent.includes('Firefox')) {
|
|
106
|
+
browserName = 'Firefox';
|
|
107
|
+
const match = userAgent.match(/Firefox\/(\d+\.\d+)/);
|
|
108
|
+
if (match && match[1]) {
|
|
109
|
+
browserVersion = match[1];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else if (userAgent.includes('Chrome') && !userAgent.includes('Edg')) {
|
|
113
|
+
browserName = 'Chrome';
|
|
114
|
+
const match = userAgent.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/);
|
|
115
|
+
if (match && match[1]) {
|
|
116
|
+
browserVersion = match[1];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else if (userAgent.includes('Safari') && !userAgent.includes('Chrome')) {
|
|
120
|
+
browserName = 'Safari';
|
|
121
|
+
const match = userAgent.match(/Version\/(\d+\.\d+)/);
|
|
122
|
+
if (match && match[1]) {
|
|
123
|
+
browserVersion = match[1];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (userAgent.includes('Edg')) {
|
|
127
|
+
browserName = 'Edge';
|
|
128
|
+
const match = userAgent.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/);
|
|
129
|
+
if (match && match[1]) {
|
|
130
|
+
browserVersion = match[1];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { name: browserName, version: browserVersion };
|
|
134
|
+
}
|
|
70
135
|
function renderLabel(target) {
|
|
71
136
|
const { label, hideLabel, optional, readonly } = target;
|
|
72
137
|
const labelClasses = ['input-label'];
|
|
@@ -276,6 +341,7 @@ exports.createGuid = createGuid;
|
|
|
276
341
|
exports.debounce = debounce;
|
|
277
342
|
exports.getAllText = getAllText;
|
|
278
343
|
exports.getAriaValueFromProp = getAriaValueFromProp;
|
|
344
|
+
exports.getBrowserInfo = getBrowserInfo;
|
|
279
345
|
exports.handleAriaLabel = handleAriaLabel;
|
|
280
346
|
exports.handleColor = handleColor;
|
|
281
347
|
exports.handleDeprecationWarning = handleDeprecationWarning;
|
|
@@ -283,6 +349,7 @@ exports.handleRenamedProp = handleRenamedProp;
|
|
|
283
349
|
exports.hasSlotContent = hasSlotContent;
|
|
284
350
|
exports.isEventFromElement = isEventFromElement;
|
|
285
351
|
exports.isFirefox = isFirefox;
|
|
352
|
+
exports.isInScrollableContainer = isInScrollableContainer;
|
|
286
353
|
exports.isMobile = isMobile;
|
|
287
354
|
exports.isRelatedTargetWithinHost = isRelatedTargetWithinHost;
|
|
288
355
|
exports.isTouchDevice = isTouchDevice;
|
|
@@ -296,4 +363,4 @@ exports.resizeIframe = resizeIframe;
|
|
|
296
363
|
exports.setMessageHeight = setMessageHeight;
|
|
297
364
|
exports.waitForNextPaint = waitForNextPaint;
|
|
298
365
|
|
|
299
|
-
//# sourceMappingURL=index-
|
|
366
|
+
//# sourceMappingURL=index-eec39d23.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"index-eec39d23.js","mappings":";;;;MAgBa,QAAQ,GAAG,CAAsD,EAAK,EAAE,QAAgB,GAAG;IACpG,IAAI,OAAsC,CAAC;IAC3C,OAAO,UAAU,GAAG,IAAmB;QACnC,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,GAAG,UAAU,CAAC;YACjB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;SACf,EAAE,KAAK,CAAC,CAAC;KACb,CAAC;AACN,EAAE;SAUc,QAAQ;IACpB,OAAO,qFAAqF,CAAC,IAAI,CAC7F,SAAS,CAAC,SAAS,CACtB,CAAC;AACN,CAAC;SAEe,uBAAuB,CAAC,OAAO;IAC3C,IAAI,OAAO,GAAG,OAAO,CAAC;IAEtB,OAAO,OAAO,IAAI,OAAO,KAAK,QAAQ,CAAC,IAAI,IAAI,OAAO,KAAK,QAAQ,CAAC,eAAe,EAAE;;QAEjF,IAAI,OAAO,CAAC,aAAa,EAAE;YACvB,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;SACnC;aAAM;;YAEH,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;YACnC,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE;gBACnB,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;aACvB;iBAAM;gBACH,MAAM;aACT;SACJ;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,qBAAqB,GACvB,KAAK,CAAC,QAAQ,KAAK,QAAQ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;;;;;;;;;;;;;;;;;;;;;","names":["h"],"sources":["src/utils/index.tsx"],"sourcesContent":["import { h } from '@stencil/core';\nimport { Q2Btn } from 'src/components/q2-btn/q2-btn';\nimport { Q2Calendar } from 'src/components/q2-calendar/q2-calendar';\nimport { Q2Carousel } from 'src/components/q2-carousel/q2-carousel';\nimport { Q2Checkbox } from 'src/components/q2-checkbox/q2-checkbox';\nimport { Q2CheckboxGroup } from 'src/components/q2-checkbox-group/q2-checkbox-group';\nimport { Q2RadioGroup } from 'src/components/q2-radio-group/q2-radio-group';\nimport { Q2Dropdown } from 'src/components/q2-dropdown/q2-dropdown';\nimport { Q2DropdownItem } from 'src/components/q2-dropdown-item/q2-dropdown-item';\nimport { Q2EditableField } from 'src/components/q2-editable-field/q2-editable-field';\nimport { Q2Input } from 'src/components/q2-input/q2-input';\nimport { Q2Loading } from 'src/components/q2-loading/q2-loading';\nimport { Q2Radio } from 'src/components/q2-radio/q2-radio';\nimport { Q2Select } from 'src/components/q2-select/q2-select';\nimport { FormFieldTypes, IDict } from 'src/util';\n\nexport const debounce = <F extends (...args: Parameters<F>) => ReturnType<F>>(fn: F, delay: number = 300) => {\n let timeout: ReturnType<typeof setTimeout>;\n return function (...args: Parameters<F>) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n fn(...args);\n }, delay);\n };\n};\n\nexport function isAndroid(): boolean {\n return /Android/i.test(navigator.userAgent);\n}\n\nexport function isIOS(): boolean {\n return /iPad|iPhone|iPod/.test(navigator.userAgent);\n}\n\nexport function isMobile(): boolean {\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|Mobile|IEMobile|Windows Phone|Opera Mini/i.test(\n navigator.userAgent\n );\n}\n\nexport function isInScrollableContainer(element) {\n let current = element;\n\n while (current && current !== document.body && current !== document.documentElement) {\n // Move to parent\n if (current.parentElement) {\n current = current.parentElement;\n } else {\n // Try to cross shadow DOM boundary\n const root = current.getRootNode();\n if (root && root.host) {\n current = root.host;\n } else {\n break;\n }\n }\n\n const style = window.getComputedStyle(current);\n const hasScrollableOverflow =\n style.overflow === 'scroll' ||\n style.overflow === 'auto' ||\n style.overflowX === 'scroll' ||\n style.overflowX === 'auto' ||\n style.overflowY === 'scroll' ||\n style.overflowY === 'auto';\n\n const hasOverflowingContent =\n current.scrollHeight > current.clientHeight || current.scrollWidth > current.clientWidth;\n\n if (hasScrollableOverflow && hasOverflowingContent) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function isHostLosingFocus(event: FocusEvent, hostElement: HTMLElement) {\n const type = event.type;\n const focusInTypes = ['focusin', 'focus'];\n const isFocusIn = focusInTypes.includes(type);\n\n // on focusin: `target` is element losing focus, `relatedTarget` is element gaining focus\n // on focusout: `target` is element gaining focus, `relatedTarget` is element losing focus\n const elementGainingFocus = isFocusIn ? event.target : event.relatedTarget;\n\n const isElementNestedInHostElement = (element: HTMLElement) => {\n if (element === hostElement) return true;\n if (element.parentElement) {\n return isElementNestedInHostElement(element.parentElement);\n }\n return false;\n };\n\n if (!(elementGainingFocus instanceof HTMLElement)) return true;\n return !isElementNestedInHostElement(elementGainingFocus);\n}\n\nexport function isRelatedTargetWithinHost(event: FocusEvent, element: HTMLElement) {\n return event.relatedTarget !== element && !element.contains(event.relatedTarget as Node);\n}\n\nexport function isEventFromElement(event: Event, element: HTMLElement): boolean {\n return event.composedPath?.()[0] === element;\n}\n\nexport function overrideFocus(hostElement: HTMLElement) {\n hostElement.focus = () => hostElement?.dispatchEvent(new FocusEvent('focus', { bubbles: false }));\n}\n\nexport function isFirefox() {\n const userAgent = navigator.userAgent.toLowerCase();\n return userAgent.includes('firefox');\n}\n\nexport function isTouchDevice() {\n return 'ontouchstart' in window || navigator.maxTouchPoints > 0;\n}\n\nexport function isSafari() {\n const userAgent = navigator.userAgent.toLowerCase();\n return userAgent.includes('safari') && !userAgent.includes('chrome');\n}\n\n/**\n * Returns the value of a prop if it is defined and included in the `validValues`\n * array. This is used primarily to prevent Vue wrappers from setting aria props\n * to \"Symbol()\" when the prop is not set.\n */\nexport function getAriaValueFromProp(prop: string, validValues?: string[]) {\n if (prop === undefined) return prop;\n if (!validValues) return prop !== 'Symbol()' ? prop : undefined;\n return validValues.includes(prop) || prop === '' ? prop : undefined;\n}\n\nlet guid: number = 1000;\nexport function createGuid(): number {\n return guid++;\n}\n\nexport function nextPaint(fn: (value?: unknown) => void) {\n requestAnimationFrame(() => {\n requestAnimationFrame(fn);\n });\n}\n\nexport function isVisible(element: HTMLElement) {\n return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;\n}\n\nexport function waitForNextPaint() {\n return new Promise(resolve => nextPaint(resolve));\n}\n\nexport function capitalize(value: string) {\n return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;\n}\n\nexport function pick(props: string[]): (obj: object) => object {\n return obj => {\n return props.reduce((memo, prop) => {\n return {\n ...memo,\n [prop]: obj[prop],\n };\n }, {});\n };\n}\n\nexport function loc(key: string, subs?: IDict<any> | string[]) {\n if (!key) return '';\n if (window.Tecton?.noStrings === true) {\n return key;\n }\n return window?.TectonElements?.loc(key, subs) ?? key;\n}\n\nexport function getBrowserInfo() {\n const userAgent = navigator.userAgent;\n let browserName = 'Unknown';\n let browserVersion = 'Unknown';\n\n if (userAgent.includes('Firefox')) {\n browserName = 'Firefox';\n const match = userAgent.match(/Firefox\\/(\\d+\\.\\d+)/);\n if (match && match[1]) {\n browserVersion = match[1];\n }\n } else if (userAgent.includes('Chrome') && !userAgent.includes('Edg')) {\n browserName = 'Chrome';\n const match = userAgent.match(/Chrome\\/(\\d+\\.\\d+\\.\\d+\\.\\d+)/);\n if (match && match[1]) {\n browserVersion = match[1];\n }\n } else if (userAgent.includes('Safari') && !userAgent.includes('Chrome')) {\n browserName = 'Safari';\n const match = userAgent.match(/Version\\/(\\d+\\.\\d+)/);\n if (match && match[1]) {\n browserVersion = match[1];\n }\n } else if (userAgent.includes('Edg')) {\n browserName = 'Edge';\n const match = userAgent.match(/Chrome\\/(\\d+\\.\\d+\\.\\d+\\.\\d+)/);\n if (match && match[1]) {\n browserVersion = match[1];\n }\n }\n\n return { name: browserName, version: browserVersion };\n}\n\nexport function renderLabel(target: FormFieldTypes | Q2RadioGroup | Q2CheckboxGroup) {\n const { label, hideLabel, optional, readonly } = target;\n const labelClasses: string[] = ['input-label'];\n let helpText = '';\n\n let shouldHideLabel = hideLabel;\n if (!shouldHideLabel) {\n const labelSlotElements = target.hostElement.querySelectorAll<HTMLSlotElement>('[slot=\"label\"]');\n const hasSlotContent = labelSlotElements.length > 0;\n const hasLabel = !!label;\n\n shouldHideLabel = hasLabel || hasSlotContent ? false : true;\n }\n\n if (shouldHideLabel) labelClasses.push('sr');\n if (optional) {\n helpText = <span class=\"optional-tag\">{loc('tecton.element.input.optional')}</span>;\n }\n if (readonly) {\n helpText = <span class=\"optional-tag\">{loc('tecton.element.input.readonly')}</span>;\n labelClasses.push('readonly-field');\n }\n return (\n <label\n htmlFor={target.inputId}\n class={labelClasses.join(' ')}\n >\n <slot name=\"label\">\n {label ? loc(label) : undefined}\n {helpText}\n </slot>\n </label>\n );\n}\n\nexport function hasSlotContent(target: HTMLElement, slotName: string) {\n return target.querySelector(`[slot=\"${slotName}\"]`) !== null;\n}\n\nexport function handleAriaLabel(\n target:\n | Q2Input\n | Q2Select\n | Q2Radio\n | Q2Checkbox\n | Q2EditableField\n | Q2Dropdown\n | Q2DropdownItem\n | Q2Loading\n | Q2Carousel\n | Q2Calendar\n | Q2Btn\n) {\n const { ariaLabel } = target;\n if (!ariaLabel) return;\n\n // If empty ariaLabel prop is set to primitive symbol by framework wrapper, set ariaLabel to undefined and return\n const FW_WRAPPERS_EMPTY_PROP = Symbol().toString();\n if (ariaLabel === FW_WRAPPERS_EMPTY_PROP) {\n target.ariaLabel = undefined;\n return;\n }\n\n // If ariaLabel is set, set hideLabel to true and set label to ariaLabel\n if ('hideLabel' in target) target.hideLabel = true;\n target.label = loc(ariaLabel);\n target.ariaLabel = undefined;\n}\n\n/**\n * Handles when a prop has been renamed on a component without introducing a breaking change.\n */\nexport function handleRenamedProp(target: object, oldProp: string, newProp: string, removeOldProp?: boolean) {\n if (typeof target[oldProp] === 'undefined') return;\n\n // If old prop has value, aka set in component, call handleDeprecationWarning()\n if (target[oldProp]) {\n handleDeprecationWarning(target, oldProp, 'prop');\n }\n\n target[newProp] = target[oldProp];\n\n if (removeOldProp) {\n delete target[oldProp];\n }\n}\n\nexport function handleDeprecationWarning(\n target: object,\n deprecatedItemName: string,\n deprecatedItemType: 'function' | 'prop' | 'method' | 'event'\n) {\n if (window.location.hostname === 'localhost' || window.location.host === 'stack.q2developer.com') {\n if (target[deprecatedItemName] === 'undefined') return;\n\n const componentName = target.constructor.name.toLowerCase().slice(2);\n\n switch (deprecatedItemType) {\n case 'prop':\n if (deprecatedItemName === 'size' && componentName === 'btn') {\n console.warn(\n `The property of size in q2-btn should not be typeof number, or typeof string containing a number. This functionality will be deprecated in an upcoming release. Instead, please use the value 'undefined', or typeof string with any of the following values: \"small\" / \"medium\" / \"large\" `\n );\n } else {\n console.warn(\n `The property ${deprecatedItemName} in q2-${componentName} has been marked for deprecation and will be removed in an upcoming major release.`\n );\n }\n break;\n\n case 'function':\n console.warn(\n `The function ${deprecatedItemName} in ${componentName} has been marked for deprecation and will be removed in an upcoming major release.`\n );\n break;\n\n case 'method':\n console.warn(\n `The method ${deprecatedItemName} in ${componentName} has been marked for deprecation and will be removed in an upcoming major release.`\n );\n break;\n\n case 'event':\n console.warn(\n `The event ${deprecatedItemName} in ${componentName} has been marked for deprecation and will be removed in an upcoming major release.`\n );\n break;\n\n default:\n console.error(\n `handleDeprecationWarning --> No type found for desired deprecation: ${deprecatedItemName} in q2-${componentName}: deprecatedItemType = ${deprecatedItemName}`\n );\n }\n }\n}\n\nexport function renderMessages(target: FormFieldTypes) {\n const type = target.hasError ? 'danger' : 'info';\n\n return (\n <div class=\"messages-container\">\n <q2-message\n appearance=\"minimal\"\n description\n type={type}\n test-id=\"message\"\n >\n <ul id={target.inputDescribedBy}>\n {target.messages.map(message => (\n <li test-id=\"messageListItem\">{loc(message)}</li>\n ))}\n </ul>\n </q2-message>\n </div>\n );\n}\n\nexport function setMessageHeight(target: FormFieldTypes) {\n const messageContainer = (target.hostElement.shadowRoot as ShadowRoot).querySelector<HTMLDivElement>(\n '.messages-container'\n );\n const q2Message = messageContainer.querySelector('q2-message');\n nextPaint(() => {\n const height = target.showMessages && target.hasFocus ? q2Message.getBoundingClientRect().height : 0;\n\n if (messageContainer.style.getPropertyValue('height') === `${height}px`) return;\n\n if (height === 0) {\n q2Message.classList.add('invisible');\n messageContainer.style.removeProperty('height');\n } else {\n q2Message.classList.remove('invisible');\n messageContainer.style.setProperty('height', `${height}px`);\n }\n });\n}\n\nexport const resizeIframe = () => {\n return window.TectonElements?.resizeIframe?.();\n};\n\n// Handling color attribute (deprecated)\nexport const handleColor = (target: Q2Btn) => {\n if (!target.intent && ['primary', 'secondary'].includes(target.color)) {\n target.intent = `workflow-${target.color}` as HTMLQ2BtnElement['intent'];\n target.color = undefined;\n }\n};\n\n/**\n * Gets all translated text content from an element, including shadow DOM content\n *\n * @param {Element} element - The element to extract text from\n * @param {Object} options - Configuration options\n * @param {boolean} [options.trim=true] - Whether to trim whitespace\n * @param {boolean} [options.normalizeWhitespace=false] - Whether to normalize whitespace\n * @param {boolean} [options.skipComponentReady=false] - Skip waiting for components (for test environments)\n * @return {Promise<string>} All translated text content in DOM order\n */\nexport const getAllText = async (element, options = {}) => {\n if (!element) return '';\n\n const opts = {\n trim: true,\n normalizeWhitespace: false,\n skipComponentReady: false,\n ...options,\n };\n\n const nodesToSkip = new Set(['STYLE', 'SCRIPT', 'NOSCRIPT', 'TEMPLATE', '#comment']);\n const processedNodes = new WeakSet();\n let result = '';\n\n async function processNode(node) {\n if (processedNodes.has(node) || nodesToSkip.has(node.nodeName)) return;\n\n processedNodes.add(node);\n\n // Handle text nodes\n if (node.nodeType === Node.TEXT_NODE) {\n const text = opts.trim ? node.textContent.trim() : node.textContent;\n\n if (text) {\n // Add space between adjacent text nodes if needed\n if (result && !result.endsWith(' ') && !text.startsWith(' ')) {\n result += ' ';\n }\n\n // Translate the text\n result += opts.skipComponentReady ? window.TectonElements?.loc(text) : loc(text);\n }\n return;\n }\n\n // Handle element nodes\n if (node.nodeType === Node.ELEMENT_NODE) {\n // Wait for Stencil component if needed\n const isStencilComponent = node.nodeName.startsWith('Q2-') && typeof node.componentOnReady === 'function';\n\n if (isStencilComponent && !opts.skipComponentReady) {\n await node.componentOnReady();\n }\n\n // Process children in light DOM\n for (const child of node.childNodes) {\n await processNode(child);\n }\n\n // Process shadow DOM if present\n if (node.shadowRoot) {\n for (const shadowChild of node.shadowRoot.childNodes) {\n await processNode(shadowChild);\n }\n }\n\n // Handle slot elements with assigned nodes\n if (node.nodeName === 'SLOT' && typeof node.assignedNodes === 'function') {\n const assignedNodes = node.assignedNodes();\n\n if (assignedNodes.length > 0) {\n for (const assigned of assignedNodes) {\n if (!processedNodes.has(assigned)) {\n await processNode(assigned);\n }\n }\n } else {\n // Process slot fallback content\n for (const fallback of node.childNodes) {\n if (!processedNodes.has(fallback)) {\n await processNode(fallback);\n }\n }\n }\n }\n }\n }\n\n await processNode(element);\n\n // Apply final formatting\n if (opts.trim) {\n result = result.trim();\n }\n\n if (opts.normalizeWhitespace) {\n result = result.replace(/\\s+/g, ' ');\n }\n\n return result;\n};\n"],"version":3}
|