q2-tecton-elements 1.25.0 → 1.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/cjs/click-elsewhere.cjs.entry.js +5 -1
  2. package/dist/cjs/{index-dc92e71f.js → index-d62f5a7e.js} +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/q2-action-sheet.cjs.entry.js +1 -1
  5. package/dist/cjs/q2-badge_2.cjs.entry.js +2 -2
  6. package/dist/cjs/q2-btn_2.cjs.entry.js +1 -1
  7. package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
  8. package/dist/cjs/q2-card.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
  10. package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
  11. package/dist/cjs/q2-chart-area.cjs.entry.js +1 -1
  12. package/dist/cjs/q2-chart-bar.cjs.entry.js +1 -1
  13. package/dist/cjs/q2-chart-donut.cjs.entry.js +1 -1
  14. package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
  15. package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
  16. package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
  17. package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
  18. package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
  19. package/dist/cjs/q2-icon.cjs.entry.js +1 -1
  20. package/dist/cjs/q2-loc.cjs.entry.js +1 -1
  21. package/dist/cjs/q2-message.cjs.entry.js +1 -1
  22. package/dist/cjs/q2-month-picker.cjs.entry.js +1 -1
  23. package/dist/cjs/q2-optgroup_2.cjs.entry.js +1 -1
  24. package/dist/cjs/q2-option-list_2.cjs.entry.js +109 -42
  25. package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
  26. package/dist/cjs/q2-pill.cjs.entry.js +7 -13
  27. package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
  28. package/dist/cjs/q2-radio.cjs.entry.js +1 -1
  29. package/dist/cjs/q2-section.cjs.entry.js +1 -1
  30. package/dist/cjs/q2-select.cjs.entry.js +11 -4
  31. package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
  32. package/dist/cjs/q2-stepper-vertical.cjs.entry.js +1 -1
  33. package/dist/cjs/q2-stepper.cjs.entry.js +1 -1
  34. package/dist/cjs/q2-tab-container.cjs.entry.js +1 -1
  35. package/dist/cjs/q2-tag.cjs.entry.js +7 -13
  36. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  37. package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
  38. package/dist/collection/components/click-elsewhere/index.js +5 -1
  39. package/dist/collection/components/q2-input/index.js +1 -1
  40. package/dist/collection/components/q2-option-list/index.js +19 -7
  41. package/dist/collection/components/q2-pill/index.js +6 -12
  42. package/dist/collection/components/q2-popover/index.js +92 -36
  43. package/dist/collection/components/q2-popover/styles.css +4 -2
  44. package/dist/collection/components/q2-select/index.js +9 -2
  45. package/dist/collection/components/q2-select/styles.css +0 -4
  46. package/dist/collection/components/q2-tag/index.js +6 -12
  47. package/dist/collection/utils/index.js +1 -1
  48. package/dist/components/index13.js +19 -7
  49. package/dist/components/index14.js +93 -37
  50. package/dist/components/index15.js +1 -1
  51. package/dist/components/index2.js +5 -1
  52. package/dist/components/index8.js +1 -1
  53. package/dist/components/q2-pill.js +6 -12
  54. package/dist/components/q2-select.js +10 -3
  55. package/dist/components/q2-tag.js +6 -12
  56. package/dist/docs.json +1 -1
  57. package/dist/esm/click-elsewhere.entry.js +5 -1
  58. package/dist/esm/{index-d4a87058.js → index-5040cd84.js} +1 -1
  59. package/dist/esm/loader.js +1 -1
  60. package/dist/esm/q2-action-sheet.entry.js +1 -1
  61. package/dist/esm/q2-badge_2.entry.js +2 -2
  62. package/dist/esm/q2-btn_2.entry.js +1 -1
  63. package/dist/esm/q2-calendar.entry.js +1 -1
  64. package/dist/esm/q2-card.entry.js +1 -1
  65. package/dist/esm/q2-carousel-pane.entry.js +1 -1
  66. package/dist/esm/q2-carousel.entry.js +1 -1
  67. package/dist/esm/q2-chart-area.entry.js +1 -1
  68. package/dist/esm/q2-chart-bar.entry.js +1 -1
  69. package/dist/esm/q2-chart-donut.entry.js +1 -1
  70. package/dist/esm/q2-checkbox-group.entry.js +1 -1
  71. package/dist/esm/q2-checkbox.entry.js +1 -1
  72. package/dist/esm/q2-dropdown-item.entry.js +1 -1
  73. package/dist/esm/q2-dropdown.entry.js +1 -1
  74. package/dist/esm/q2-editable-field.entry.js +1 -1
  75. package/dist/esm/q2-icon.entry.js +1 -1
  76. package/dist/esm/q2-loc.entry.js +1 -1
  77. package/dist/esm/q2-message.entry.js +1 -1
  78. package/dist/esm/q2-month-picker.entry.js +1 -1
  79. package/dist/esm/q2-optgroup_2.entry.js +1 -1
  80. package/dist/esm/q2-option-list_2.entry.js +109 -42
  81. package/dist/esm/q2-pagination.entry.js +1 -1
  82. package/dist/esm/q2-pill.entry.js +7 -13
  83. package/dist/esm/q2-radio-group.entry.js +1 -1
  84. package/dist/esm/q2-radio.entry.js +1 -1
  85. package/dist/esm/q2-section.entry.js +1 -1
  86. package/dist/esm/q2-select.entry.js +11 -4
  87. package/dist/esm/q2-stepper-pane.entry.js +1 -1
  88. package/dist/esm/q2-stepper-vertical.entry.js +1 -1
  89. package/dist/esm/q2-stepper.entry.js +1 -1
  90. package/dist/esm/q2-tab-container.entry.js +1 -1
  91. package/dist/esm/q2-tag.entry.js +7 -13
  92. package/dist/esm/q2-tecton-elements.js +1 -1
  93. package/dist/esm/q2-textarea.entry.js +1 -1
  94. package/dist/q2-tecton-elements/p-0a394c3b.entry.js +1 -0
  95. package/dist/q2-tecton-elements/{p-bf0ed24a.entry.js → p-18d9cea8.entry.js} +1 -1
  96. package/dist/q2-tecton-elements/{p-72fc58e7.entry.js → p-1cc42a02.entry.js} +1 -1
  97. package/dist/q2-tecton-elements/{p-ea5383ba.entry.js → p-224d3c31.entry.js} +1 -1
  98. package/dist/q2-tecton-elements/{p-274ec152.entry.js → p-2313e9a9.entry.js} +1 -1
  99. package/dist/q2-tecton-elements/{p-306a4bc7.entry.js → p-2b9c1815.entry.js} +1 -1
  100. package/dist/q2-tecton-elements/{p-7c9bf80a.entry.js → p-30069b63.entry.js} +1 -1
  101. package/dist/q2-tecton-elements/{p-32f44993.entry.js → p-3fe98171.entry.js} +1 -1
  102. package/dist/q2-tecton-elements/{p-2c309c54.entry.js → p-406f8ca9.entry.js} +1 -1
  103. package/dist/q2-tecton-elements/p-471e5d58.entry.js +1 -0
  104. package/dist/q2-tecton-elements/p-721d0aee.entry.js +1 -0
  105. package/dist/q2-tecton-elements/{p-c4a9ab25.entry.js → p-73643653.entry.js} +1 -1
  106. package/dist/q2-tecton-elements/{p-7c168977.entry.js → p-7b124d8c.entry.js} +1 -1
  107. package/dist/q2-tecton-elements/{p-2ba9e1a2.entry.js → p-7d35c1a1.entry.js} +1 -1
  108. package/dist/q2-tecton-elements/{p-2cc70f49.entry.js → p-7eca74d4.entry.js} +1 -1
  109. package/dist/q2-tecton-elements/{p-059065e4.js → p-839ef27d.js} +1 -1
  110. package/dist/q2-tecton-elements/{p-2ceb41c4.entry.js → p-8954cc63.entry.js} +1 -1
  111. package/dist/q2-tecton-elements/{p-4a95f78e.entry.js → p-8b5639a1.entry.js} +1 -1
  112. package/dist/q2-tecton-elements/{p-a64e7eb1.entry.js → p-a1f91d8c.entry.js} +1 -1
  113. package/dist/q2-tecton-elements/{p-6779270e.entry.js → p-a6bfe392.entry.js} +1 -1
  114. package/dist/q2-tecton-elements/{p-83d678c7.entry.js → p-a8258fb1.entry.js} +1 -1
  115. package/dist/q2-tecton-elements/p-aafb9537.entry.js +1 -0
  116. package/dist/q2-tecton-elements/{p-1b95e43f.entry.js → p-bda877fe.entry.js} +1 -1
  117. package/dist/q2-tecton-elements/{p-bff85959.entry.js → p-bea1fda1.entry.js} +1 -1
  118. package/dist/q2-tecton-elements/{p-a3a5b57b.entry.js → p-c01d0332.entry.js} +1 -1
  119. package/dist/q2-tecton-elements/{p-4b48a49d.entry.js → p-c506314d.entry.js} +1 -1
  120. package/dist/q2-tecton-elements/{p-1a744921.entry.js → p-d4909df7.entry.js} +1 -1
  121. package/dist/q2-tecton-elements/{p-3a9aac19.entry.js → p-ece7a1ca.entry.js} +1 -1
  122. package/dist/q2-tecton-elements/p-ee1f3114.entry.js +1 -0
  123. package/dist/q2-tecton-elements/{p-a6296870.entry.js → p-f0a716dd.entry.js} +1 -1
  124. package/dist/q2-tecton-elements/{p-1ea4b8bd.entry.js → p-f3096cce.entry.js} +1 -1
  125. package/dist/q2-tecton-elements/{p-25839309.entry.js → p-f5c9ef75.entry.js} +1 -1
  126. package/dist/q2-tecton-elements/{p-1f3eb04c.entry.js → p-f83d2df5.entry.js} +1 -1
  127. package/dist/q2-tecton-elements/{p-2e938b20.entry.js → p-fa8cb091.entry.js} +1 -1
  128. package/dist/q2-tecton-elements/{p-ad83984e.entry.js → p-fbe8b4c0.entry.js} +1 -1
  129. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  130. package/dist/types/components/click-elsewhere/index.d.ts +1 -0
  131. package/dist/types/components/q2-option-list/index.d.ts +1 -1
  132. package/dist/types/components/q2-pill/index.d.ts +0 -1
  133. package/dist/types/components/q2-popover/index.d.ts +8 -3
  134. package/dist/types/components/q2-select/index.d.ts +1 -0
  135. package/dist/types/components/q2-tag/index.d.ts +0 -1
  136. package/package.json +3 -3
  137. package/dist/q2-tecton-elements/p-3c73ce3f.entry.js +0 -1
  138. package/dist/q2-tecton-elements/p-4b92e44e.entry.js +0 -1
  139. package/dist/q2-tecton-elements/p-5ecb9c27.entry.js +0 -1
  140. package/dist/q2-tecton-elements/p-7ac02ae5.entry.js +0 -1
  141. package/dist/q2-tecton-elements/p-a987402e.entry.js +0 -1
  142. /package/dist/types/workspace/workspace/{Tecton_tecton-production_master → tecton-production_release_1.25.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { o as overrideFocus, n as nextPaint, a as isEventFromElement } from './index15.js';
2
+ import { o as overrideFocus, w as waitForNextPaint, n as nextPaint, a as isEventFromElement } from './index15.js';
3
3
 
4
4
  const stylesCss = "*{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 #33b4ff #06C)}: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{position:relative;width:100%;display:block;line-height:var(--tct-option-list-line-height, var(--t-option-list-line-height, var(--app-line-height, 1.428571429em)))}.content{text-align:start}:host([is-sizeable]) .content{display:block;height:auto}";
5
5
 
@@ -27,10 +27,22 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
27
27
  this.searchOptions(key, true);
28
28
  break;
29
29
  }
30
- this.setDefaultActiveElement();
30
+ else if (this.role === 'menu') {
31
+ this.activeIndex = 0;
32
+ this.openDropdownWithActiveElement(0);
33
+ }
34
+ else {
35
+ this.setDefaultActiveElement();
36
+ }
31
37
  break;
32
38
  case 'Enter':
33
- this.setDefaultActiveElement();
39
+ if (this.role === 'menu') {
40
+ this.activeIndex = 0;
41
+ this.openDropdownWithActiveElement(0);
42
+ }
43
+ else {
44
+ this.setDefaultActiveElement();
45
+ }
34
46
  break;
35
47
  case 'ArrowUp':
36
48
  event.preventDefault();
@@ -271,16 +283,16 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
271
283
  const activeOption = this.allOptions[this.activeIndex];
272
284
  activeOption === null || activeOption === void 0 ? void 0 : activeOption.scrollIntoView({ block: 'nearest' });
273
285
  }
274
- openDropdownWithActiveElement(activeIndex) {
286
+ async openDropdownWithActiveElement(activeIndex) {
275
287
  if (this.disabled)
276
288
  return;
277
289
  this.activeIndex = activeIndex;
278
290
  this.popoverState.emit({ open: true, action: 'open' });
291
+ await waitForNextPaint();
279
292
  this.setActiveOption();
293
+ await waitForNextPaint();
280
294
  this.setFocusedOption();
281
- nextPaint(() => {
282
- this.scrollToActiveOption();
283
- });
295
+ this.scrollToActiveOption();
284
296
  }
285
297
  getDefaultActiveIndex() {
286
298
  const { allOptions } = this;
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { n as nextPaint, r as resizeIframe } from './index15.js';
2
+ import { r as resizeIframe, w as waitForNextPaint } from './index15.js';
3
3
 
4
- const stylesCss = "*{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 #33b4ff #06C)}: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:block;width:100%}:host([align=right]){display:block;position:absolute;right:0;text-align:end;left:unset}.container{display:none;overflow:hidden;opacity:0;height:0;position:absolute;top:var(--tct-popover-top, var(--t-popover-top, initial));visibility:hidden;background-color:var(--tct-popover-background-color, var(--t-popover-background-color, var(--app-white, #ffffff)));color:var(--tct-popover-text-color, var(--t-popover-text-color, var(--t-text, #4d4d4d)));z-index:var(--tct-popover-z-index, var(--t-popover-z-index, 100));width:max-content;min-width:var(--tct-popover-min-width, var(--t-popover-min-width, 135px));box-shadow:var(--tct-popover-box-shadow, var(--t-popover-box-shadow, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3))));text-align:start;left:0;transition:opacity var(--app-tween-1, 0.2s ease);border-radius:var(--tct-popover-border-radius, var(--t-popover-border-radius, 0));max-height:var(--comp-pop-max-height);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.container::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.container::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.container::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}:host([block]) .container{left:unset;right:unset;width:100%;min-width:unset}:host([align=right]) .container{right:0;text-align:end;left:unset}:host([open]) .container{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}.container.up{bottom:var(--comp-pop-offset)}click-elsewhere{position:relative;display:block}.content{height:auto}";
4
+ const stylesCss = "*{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 #33b4ff #06C)}: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:block;width:100%}:host([align=right]){display:block;position:absolute;right:0;text-align:end;left:unset}.container{display:none;overflow:hidden;opacity:0;height:0;position:absolute;top:var(--tct-popover-top, var(--t-popover-top, initial));visibility:hidden;background-color:var(--tct-popover-background-color, var(--t-popover-background-color, var(--app-white, #ffffff)));color:var(--tct-popover-text-color, var(--t-popover-text-color, var(--t-text, #4d4d4d)));z-index:var(--tct-popover-z-index, var(--t-popover-z-index, 100));width:max-content;min-width:var(--tct-popover-min-width, var(--t-popover-min-width, 135px));box-shadow:var(--tct-popover-box-shadow, var(--t-popover-box-shadow, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3))));text-align:start;left:0;transition:opacity var(--app-tween-1, 0.2s ease), max-height var(--app-tween-1, 0.2s ease);border-radius:var(--tct-popover-border-radius, var(--t-popover-border-radius, 0));max-height:var(--comp-pop-max-height);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.container::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.container::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.container::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}:host([block]) .container{left:unset;right:unset;width:100%;min-width:unset}:host([align=right]) .container{right:0;text-align:end;left:unset}.container :host([open]){display:block}:host([open]) .container.show{height:auto;overflow:auto;opacity:1;visibility:visible}.container.up{bottom:var(--comp-pop-offset)}click-elsewhere{position:relative;display:block}.content{height:auto}";
5
5
 
6
6
  const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -10,29 +10,35 @@ const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
10
  this.__attachShadow();
11
11
  this.popoverStateChanged = createEvent(this, "popoverStateChanged", 7);
12
12
  this.scheduledAfterRender = [];
13
+ /// Helpers ///
14
+ this.viewPortChanged = () => {
15
+ if (!this.open)
16
+ return;
17
+ this.determinePopDirection();
18
+ };
13
19
  this.direction = undefined;
14
20
  this.align = undefined;
15
21
  this.open = undefined;
16
22
  this.block = undefined;
17
23
  this.minHeight = undefined;
18
24
  this.controlElement = undefined;
19
- this.privateDirection = 'down';
25
+ this.currentDirection = undefined;
26
+ this.show = false;
20
27
  }
21
28
  /// Lifecycle hooks ///
22
29
  componentDidLoad() {
23
30
  if (this.open)
24
31
  this.determinePopDirection();
25
32
  }
26
- componentWillRender() {
27
- if (this.containerElement && this.open)
28
- nextPaint(() => this.determinePopDirection());
29
- }
30
33
  componentDidRender() {
31
34
  setTimeout(() => {
32
35
  this.scheduledAfterRender.forEach(fn => fn());
33
36
  this.scheduledAfterRender = [];
34
37
  }, 25);
35
38
  }
39
+ disconnectedCallback() {
40
+ this.removeViewportListeners();
41
+ }
36
42
  /// Methods ///
37
43
  async toggle() {
38
44
  this.open = !this.open;
@@ -41,6 +47,21 @@ const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
41
47
  openChanged(open) {
42
48
  this.popoverStateChanged.emit({ open });
43
49
  this.scheduledAfterRender.push(resizeIframe);
50
+ if (open) {
51
+ this.addViewportListeners();
52
+ this.determinePopDirection();
53
+ }
54
+ else {
55
+ this.removeViewportListeners();
56
+ // Reset currentDirection after close transition completes
57
+ this.containerElement.addEventListener('transitionend', () => {
58
+ if (this.open)
59
+ return;
60
+ this.currentDirection = undefined;
61
+ this.containerElement.style.removeProperty('--comp-pop-max-height');
62
+ }, { once: true });
63
+ this.show = false;
64
+ }
44
65
  }
45
66
  /// Listeners ///
46
67
  popoverStateHandler(event) {
@@ -50,48 +71,80 @@ const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
50
71
  this.open = open;
51
72
  event.stopPropagation();
52
73
  }
53
- /// Helpers ///
54
- determinePopDirection() {
55
- var _a, _b, _c, _d, _e;
56
- const { containerElement, contentElement, direction, controlElement } = this;
74
+ addViewportListeners() {
75
+ // window.visualViewport.addEventListener('scroll', this.viewPortChanged);
76
+ window.visualViewport.addEventListener('resize', this.viewPortChanged);
77
+ }
78
+ removeViewportListeners() {
79
+ // window.visualViewport.removeEventListener('scroll', this.viewPortChanged);
80
+ window.visualViewport.removeEventListener('resize', this.viewPortChanged);
81
+ }
82
+ async setDirectionAndShow(direction) {
83
+ if (direction === 'up') {
84
+ this.determinePopOffset();
85
+ }
86
+ this.currentDirection = direction;
87
+ this.show = true;
88
+ }
89
+ async determinePopDirection() {
90
+ var _a, _b, _c, _d, _e, _f, _g;
91
+ const { containerElement, contentElement, direction, controlElement, currentDirection } = this;
57
92
  if (containerElement)
58
93
  containerElement.style.maxHeight = null;
59
- if (direction) {
60
- return (this.privateDirection = direction);
61
- }
62
- const contentHeight = contentElement.clientHeight;
94
+ // If direction defined, use it
95
+ if (direction)
96
+ return this.setDirectionAndShow(direction);
97
+ // Set the container to block so we can get the height
98
+ containerElement.style.setProperty('display', 'block');
99
+ await waitForNextPaint();
100
+ // Determine the dimensions of the control element
63
101
  const { top: topOffset, height } = (_a = controlElement === null || controlElement === void 0 ? void 0 : controlElement.getBoundingClientRect()) !== null && _a !== void 0 ? _a : {
64
102
  top: 0,
65
103
  height: 0,
66
104
  };
67
- const scrollY = ((_c = (_b = window.Tecton) === null || _b === void 0 ? void 0 : _b.platformDimensions) === null || _c === void 0 ? void 0 : _c.scrollY) || 0;
68
- const innerHeight = ((_e = (_d = window.Tecton) === null || _d === void 0 ? void 0 : _d.platformDimensions) === null || _e === void 0 ? void 0 : _e.innerHeight) || window.innerHeight;
105
+ const contentHeight = contentElement.clientHeight;
106
+ const scrollY = ((_c = (_b = window.Tecton) === null || _b === void 0 ? void 0 : _b.platformDimensions) === null || _c === void 0 ? void 0 : _c.scrollY) ||
107
+ ((_d = window.visualViewport) === null || _d === void 0 ? void 0 : _d.offsetTop) || // Only Android Chrome provides this which we need when scrolled
108
+ 0;
109
+ const innerHeight = ((_f = (_e = window.Tecton) === null || _e === void 0 ? void 0 : _e.platformDimensions) === null || _f === void 0 ? void 0 : _f.innerHeight) || ((_g = window.visualViewport) === null || _g === void 0 ? void 0 : _g.height) || window.innerHeight;
69
110
  const bottomOffset = scrollY + innerHeight - topOffset - height;
70
111
  const canShowFullSizeBelow = bottomOffset > contentHeight;
71
112
  const canShowFullSizeAbove = contentHeight <= topOffset;
72
- // Prefer full size above or below
73
- if (canShowFullSizeBelow) {
74
- return (this.privateDirection = 'down');
75
- }
76
- else if (canShowFullSizeAbove || !this.minHeight) {
77
- this.determinePopOffset();
78
- return (this.privateDirection = 'up');
79
- }
80
- // If full size will not fit and minHeight is set, then make as tall as possible
113
+ let determinedDirection;
114
+ // Show the full-size popover below or above if it will fit
115
+ if (currentDirection === 'down' && canShowFullSizeBelow)
116
+ return this.setDirectionAndShow('down');
117
+ else if (currentDirection === 'up' && canShowFullSizeAbove)
118
+ return this.setDirectionAndShow('up');
119
+ else if (currentDirection === undefined && canShowFullSizeBelow)
120
+ determinedDirection = 'down';
121
+ else if (currentDirection === undefined && canShowFullSizeAbove)
122
+ determinedDirection = 'up';
123
+ if (determinedDirection)
124
+ return this.setDirectionAndShow(determinedDirection);
125
+ // If full size will not fit then make it as tall as possible
81
126
  const { minHeight = 150 } = this;
82
127
  const displayBuffer = 5;
83
- const canShowSmallBelow = bottomOffset >= minHeight + displayBuffer;
84
- if (canShowSmallBelow) {
85
- const maxBelowHeight = Math.max(bottomOffset - displayBuffer, minHeight);
86
- containerElement.style.setProperty('--comp-pop-max-height', `${maxBelowHeight}px`);
87
- return (this.privateDirection = 'down');
128
+ const canShowMinHeightBelow = bottomOffset >= minHeight + displayBuffer;
129
+ let maxHeight;
130
+ if (currentDirection === 'down') {
131
+ maxHeight = Math.max(bottomOffset - displayBuffer, minHeight);
132
+ determinedDirection = 'down';
133
+ }
134
+ else if (currentDirection === 'up') {
135
+ maxHeight = Math.max(topOffset - displayBuffer, minHeight);
136
+ determinedDirection = 'up';
137
+ }
138
+ else if (canShowMinHeightBelow) {
139
+ maxHeight = Math.max(bottomOffset - displayBuffer, minHeight);
140
+ determinedDirection = 'down';
88
141
  }
89
142
  else {
90
- const maxAboveHeight = Math.max(topOffset, minHeight);
91
- containerElement.style.setProperty('--comp-pop-max-height', `${maxAboveHeight}px`);
92
- this.determinePopOffset();
93
- return (this.privateDirection = 'up');
143
+ maxHeight = Math.max(topOffset - scrollY - displayBuffer, minHeight);
144
+ determinedDirection = 'up';
94
145
  }
146
+ containerElement.style.setProperty('--comp-pop-max-height', `${maxHeight}px`);
147
+ return this.setDirectionAndShow(determinedDirection);
95
148
  }
96
149
  determinePopOffset() {
97
150
  var _a;
@@ -101,7 +154,9 @@ const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
101
154
  }
102
155
  /// DOM ///
103
156
  render() {
104
- const containerClasses = ['container', this.privateDirection];
157
+ const containerClasses = ['container', this.currentDirection];
158
+ if (this.show)
159
+ containerClasses.push('show');
105
160
  return (h("div", { ref: el => (this.containerElement = el), class: containerClasses.join(' '), role: "menu" }, h("div", { ref: el => (this.contentElement = el), class: "content" }, h("slot", null))));
106
161
  }
107
162
  get hostElement() { return this; }
@@ -116,7 +171,8 @@ const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
116
171
  "block": [516],
117
172
  "minHeight": [2, "min-height"],
118
173
  "controlElement": [16],
119
- "privateDirection": [32],
174
+ "currentDirection": [32],
175
+ "show": [32],
120
176
  "toggle": [64]
121
177
  }, [[0, "popoverState", "popoverStateHandler"]]]);
122
178
  function defineCustomElement() {
@@ -465,7 +465,7 @@ function isHostLosingFocus(event, hostElement) {
465
465
  return false;
466
466
  };
467
467
  if (!(elementGainingFocus instanceof HTMLElement))
468
- return false;
468
+ return true;
469
469
  return !isElementNestedInHostElement(elementGainingFocus);
470
470
  }
471
471
  function isRelatedTargetWithinHost(event, element) {
@@ -29,7 +29,11 @@ const ClickElsewhere = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
29
29
  }
30
30
  };
31
31
  }
32
- componentWillLoad() {
32
+ /* TODO: Stencil/Rollup is having issues compiling without this here. Will try to remove in future Stencil upgrade. */
33
+ /* tslint:disable:no-empty */
34
+ componentWillLoad() { }
35
+ /* tslint:enable:no-empty */
36
+ connectedCallback() {
33
37
  this.mouseEventList.forEach((eventName) => {
34
38
  document.addEventListener(eventName, this.mouseHandler);
35
39
  });
@@ -3232,7 +3232,7 @@ const Q2Input = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
3232
3232
  }
3233
3233
  /* tslint:disable:cyclomatic-complexity */
3234
3234
  inputContainerDOM() {
3235
- return (h("div", { class: "input-container" }, h("div", { class: "input-icons-container-left" }, this.formattedValueObject.prefix && (h("span", { class: "input-prefix" }, this.formattedValueObject.prefix)), this.computedIconLeft && (h("q2-icon", { type: this.computedIconLeft, class: this.computedClassForIconLeft })), this.showIconSeparator && h("div", { class: "vertical-separator" }), this.hasError && this.type === 'currency' && (h("q2-icon", { type: "error", class: "icon-error" }))), this.pseudo ? this.pseudoInputDOM() : this.standardInputDOM(), h("div", { class: "input-icons-container-right" }, this.canClear && (h("q2-btn", { class: "btn-clear", ariaLabel: loc('tecton.element.input.clear', [this.label]), "test-id": "clearButton", onClick: this.onClearInput }, h("q2-icon", { type: "close", class: "icon-clear" }))), ['password', 'text', 'ssn'].includes(this.type) && this.showVisibilityToggle && (h("q2-btn", { class: "btn-visibility-toggle", "test-id": "toggleVisibilityButton", onClick: this.onToggleVisibility }, this.visibilityToggleText)), this.formattedValueObject.suffix && (h("span", { class: "input-suffix" }, this.formattedValueObject.suffix)), this.badgeValue && (h("q2-badge", { size: "large", theme: this.badgeTheme }, this.badgeValue)), this.iconRight && !this.formattedValueObject.suffix && (h("q2-icon", { type: this.iconRight, class: "icon-right" })), this.hasError && this.type !== 'currency' && (h("q2-icon", { type: "error", class: "icon-error" })))));
3235
+ return (h("div", { class: "input-container", tabindex: -1 }, h("div", { class: "input-icons-container-left" }, this.formattedValueObject.prefix && (h("span", { class: "input-prefix" }, this.formattedValueObject.prefix)), this.computedIconLeft && (h("q2-icon", { type: this.computedIconLeft, class: this.computedClassForIconLeft })), this.showIconSeparator && h("div", { class: "vertical-separator" }), this.hasError && this.type === 'currency' && (h("q2-icon", { type: "error", class: "icon-error" }))), this.pseudo ? this.pseudoInputDOM() : this.standardInputDOM(), h("div", { class: "input-icons-container-right" }, this.canClear && (h("q2-btn", { class: "btn-clear", ariaLabel: loc('tecton.element.input.clear', [this.label]), "test-id": "clearButton", onClick: this.onClearInput }, h("q2-icon", { type: "close", class: "icon-clear" }))), ['password', 'text', 'ssn'].includes(this.type) && this.showVisibilityToggle && (h("q2-btn", { class: "btn-visibility-toggle", "test-id": "toggleVisibilityButton", onClick: this.onToggleVisibility }, this.visibilityToggleText)), this.formattedValueObject.suffix && (h("span", { class: "input-suffix" }, this.formattedValueObject.suffix)), this.badgeValue && (h("q2-badge", { size: "large", theme: this.badgeTheme }, this.badgeValue)), this.iconRight && !this.formattedValueObject.suffix && (h("q2-icon", { type: this.iconRight, class: "icon-right" })), this.hasError && this.type !== 'currency' && (h("q2-icon", { type: "error", class: "icon-error" })))));
3236
3236
  }
3237
3237
  /* tslint:enable:cyclomatic-complexity */
3238
3238
  /* tslint:disable:cyclomatic-complexity */
@@ -16,7 +16,6 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
16
16
  this.change = createEvent(this, "change", 7);
17
17
  var _a;
18
18
  this.scheduledAfterRender = [];
19
- this.activateFirstOption = false;
20
19
  /// Helpers ///
21
20
  this.updateSelectedOptionElements = async () => {
22
21
  var _a;
@@ -43,7 +42,6 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
43
42
  if (this.disabled)
44
43
  return;
45
44
  if (this.hasOptions) {
46
- this.activateFirstOption = false;
47
45
  if (shouldShowActionSheet(this)) {
48
46
  this.executeActionSheet(event);
49
47
  }
@@ -64,13 +62,13 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
64
62
  }
65
63
  };
66
64
  this.handleKeydown = async (event) => {
65
+ event.preventDefault();
67
66
  if (!this.hasOptions || this.disabled)
68
67
  return;
69
68
  if (shouldShowActionSheet(this, event)) {
70
69
  this.executeActionSheet(event);
71
70
  }
72
71
  else {
73
- this.activateFirstOption = true;
74
72
  this.optionList.handleExternalKeydown(event);
75
73
  }
76
74
  };
@@ -169,14 +167,10 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
169
167
  popoverStateHandler({ detail: { open } }) {
170
168
  if (this.open !== open)
171
169
  this.open = open;
172
- if (open && this.activateFirstOption) {
173
- this.optionList.focus();
174
- this.activateFirstOption = false;
175
- }
176
- else {
177
- this.optionList.setActiveElement(null);
178
- this.primaryBtn.focus();
179
- }
170
+ if (open)
171
+ return;
172
+ this.optionList.setActiveElement(null);
173
+ this.primaryBtn.focus();
180
174
  }
181
175
  /// DOM ///
182
176
  generateIcon() {
@@ -193,7 +187,7 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
193
187
  wrapperClassNames.push('has-icon');
194
188
  if (hasOptions)
195
189
  wrapperClassNames.push('has-options');
196
- return (h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' ') }, h("div", { class: "btn-height-wrapper", ref: el => (this.primaryBtnWrapper = el), onClick: this.handleWrapperClick, tabIndex: -1 }, h("button", { class: "btn-primary", "test-id": "btn-control", type: "button", ref: el => (this.primaryBtn = el), onClick: this.handleClick, onKeyDown: this.handleKeydown, disabled: this.disabled, "aria-selected": !hasOptions && active ? 'true' : 'false', "aria-roledescription": !hasOptions && 'filter', "aria-controls": hasOptions && 'option-list', "aria-haspopup": hasOptions && 'true', "aria-expanded": (hasOptions && `${!!open}`) || undefined, "aria-label": this.maxLength && this.buttonContent }, this.truncatedButtonContent, !hasOptions && active && h("span", { class: "sr" }, "(", loc('tecton.element.pill.active'), ")"))), this.generateIcon()), this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.primaryBtnWrapper, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { ref: el => (this.optionList = el), id: "option-list", onChange: this.handleChange, multiple: this.multiple, selectedOptions: this.selectedOptions, onReady: () => this.updateSelectedOptionElements() }, h("slot", null))))));
190
+ return (h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' ') }, h("div", { class: "btn-height-wrapper", ref: el => (this.primaryBtnWrapper = el), onClick: this.handleWrapperClick, tabIndex: -1 }, h("button", { class: "btn-primary", "test-id": "btn-control", type: "button", ref: el => (this.primaryBtn = el), onClick: this.handleClick, onKeyDown: this.handleKeydown, disabled: this.disabled, "aria-selected": !hasOptions && active ? 'true' : 'false', "aria-roledescription": !hasOptions && 'filter', "aria-controls": hasOptions && 'option-list', "aria-haspopup": hasOptions && 'true', "aria-expanded": (hasOptions && `${!!open}`) || undefined, "aria-label": this.maxLength && this.buttonContent }, this.truncatedButtonContent, !hasOptions && active && h("span", { class: "sr" }, "(", loc('tecton.element.pill.active'), ")"))), this.generateIcon()), this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.primaryBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { role: "menu", ref: el => (this.optionList = el), id: "option-list", onChange: this.handleChange, multiple: this.multiple, selectedOptions: this.selectedOptions, onReady: () => this.updateSelectedOptionElements() }, h("slot", null))))));
197
191
  }
198
192
  get hostElement() { return this; }
199
193
  static get watchers() { return {
@@ -10,7 +10,7 @@ import { d as defineCustomElement$4 } from './index9.js';
10
10
  import { d as defineCustomElement$3 } from './index13.js';
11
11
  import { d as defineCustomElement$2 } from './index14.js';
12
12
 
13
- const stylesCss = "*{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 #33b4ff #06C)}: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}.q2-element-dropdown{display:none;position:absolute;background-color:var(--app-white, #ffffff);color:var(--t-text, #4d4d4d);left:0;width:100%;z-index:100;margin-top:1px;box-shadow:var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3));height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity var(--app-tween-1, 0.2s ease);border-radius:var(--tct-dropdown-border-radius, --t-dropdown-border-radius, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.q2-element-dropdown::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.q2-element-dropdown::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown.sizable{display:block;height:auto}.dropdown-open .q2-element-dropdown{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}:host([alignment=right]) .q2-element-dropdown{left:auto;right:0}:host([block]) q2-btn,:host([block]){display:block}:host{display:block;margin-top:var(--tct-select-margin-top, var(--app-scale-4, 30px));margin-bottom:var(--tct-select-margin-bottom, var(--app-scale-4, 30px))}.q2-select-container{position:relative;display:block}.q2-select-input{margin:0;--tct-input-min-height:var(--tct-select-input-min-height, var(--t-select-input-min-height));--tct-input-max-height:var(--tct-select-input-max-height, var(--t-select-input-max-height, none))}::slotted([slot=_selected-display]){width:100%;min-height:var(--comp-selected-display-height, 44px)}.custom-display-content{position:absolute;bottom:0;left:calc(var(--tct-scale-2, var(--app-scale-2x, 10px)) + 1px);height:44px;width:calc(100% - 34px - var(--tct-scale-3, var(--app-scale-3x, 15px)));overflow:hidden;cursor:pointer;transition:left var(--tct-tween-2, var(--app-tween-1, 0.2s ease))}.custom-display-content:not([hidden]){display:flex;align-items:center}.is-searchable.is-focused .custom-display-content,.is-searchable .custom-display-content:active{left:calc(var(--tct-scale-3, var(--app-scale-3x, 15px)) + 1px)}.has-error .custom-display-content{width:calc(100% - 68px - var(--tct-scale-3, var(--app-scale-3x, 15px)))}.multi-select-header{padding:var(--tct-scale-1, var(--app-scale-1x, 5px)) var(--tct-scale-2, var(--app-scale-2x, 10px));position:sticky;top:0;z-index:5;background:var(--app-white);display:inline-grid;grid-template-columns:repeat(3, auto);gap:var(--app-scale-2x, 10px);align-items:center}.q2-element-dropdown.dropup{bottom:var(--comp-dropup-offset)}";
13
+ const stylesCss = "*{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 #33b4ff #06C)}: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}.q2-element-dropdown{display:none;position:absolute;background-color:var(--app-white, #ffffff);color:var(--t-text, #4d4d4d);left:0;width:100%;z-index:100;margin-top:1px;box-shadow:var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3));height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity var(--app-tween-1, 0.2s ease);border-radius:var(--tct-dropdown-border-radius, --t-dropdown-border-radius, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.q2-element-dropdown::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.q2-element-dropdown::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown.sizable{display:block;height:auto}.dropdown-open .q2-element-dropdown{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}:host([alignment=right]) .q2-element-dropdown{left:auto;right:0}:host([block]) q2-btn,:host([block]){display:block}:host{display:block;margin-top:var(--tct-select-margin-top, var(--app-scale-4, 30px));margin-bottom:var(--tct-select-margin-bottom, var(--app-scale-4, 30px))}.q2-select-container{position:relative;display:block}.q2-select-input{margin:0;--tct-input-min-height:var(--tct-select-input-min-height, var(--t-select-input-min-height));--tct-input-max-height:var(--tct-select-input-max-height, var(--t-select-input-max-height, none))}::slotted([slot=_selected-display]){width:100%;min-height:var(--comp-selected-display-height, 44px)}.custom-display-content{position:absolute;bottom:0;left:calc(var(--tct-scale-2, var(--app-scale-2x, 10px)) + 1px);height:44px;width:calc(100% - 34px - var(--tct-scale-3, var(--app-scale-3x, 15px)));overflow:hidden;cursor:pointer;transition:left var(--tct-tween-2, var(--app-tween-1, 0.2s ease))}.custom-display-content:not([hidden]){display:flex;align-items:center}.is-searchable.is-focused .custom-display-content,.is-searchable .custom-display-content:active{left:calc(var(--tct-scale-3, var(--app-scale-3x, 15px)) + 1px)}.has-error .custom-display-content{width:calc(100% - 68px - var(--tct-scale-3, var(--app-scale-3x, 15px)))}.multi-select-header{padding:var(--tct-scale-1, var(--app-scale-1x, 5px)) var(--tct-scale-2, var(--app-scale-2x, 10px));position:sticky;top:0;z-index:5;background:var(--app-white);display:inline-grid;grid-template-columns:repeat(3, auto);gap:var(--app-scale-2x, 10px);align-items:center}";
14
14
 
15
15
  const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
16
16
  constructor() {
@@ -186,6 +186,10 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
186
186
  this.mutationObserver = null;
187
187
  }
188
188
  /// Getters ///
189
+ get innerInputField() {
190
+ var _a, _b;
191
+ return (_b = (_a = this.inputField) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.input-field');
192
+ }
189
193
  get badgeValue() {
190
194
  var _a, _b;
191
195
  if (!this.multiple)
@@ -199,7 +203,10 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
199
203
  get popoverMinHeight() {
200
204
  const { minRows } = this;
201
205
  const firstOption = this.hostElement.querySelector('q2-option:not([hidden])');
202
- const minHeight = firstOption ? window.getComputedStyle(firstOption).minHeight : '44px';
206
+ let minHeight = firstOption && window.getComputedStyle(firstOption).minHeight;
207
+ // Safari doesn't return a min-height for non-visible items
208
+ if (!minHeight || minHeight === '0px')
209
+ minHeight = '44px';
203
210
  return minRows * parseInt(minHeight);
204
211
  }
205
212
  get selectedDisplay() {
@@ -466,7 +473,7 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
466
473
  [], disabled: this.disabled, optional: this.optional, readonly: this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${!!this.open}`, ariaOwns: "option-list", ariaHaspopup: "listbox", role: this.searchable ? 'combobox' : null, pseudo: showAsPseudo, "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 }, this.renderCustomDisplay()), h("div", { class: "custom-display-content", hidden: !this.hasCustomDisplay || !!this.searchText, onClick: this.onCustomDisplayClick }, h("slot", { name: "q2-select-display" })), this.optionsDropdown()));
467
474
  }
468
475
  optionsDropdown() {
469
- return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.inputField, open: this.open, minHeight: this.popoverMinHeight, direction: this.popDirection, onPopoverStateChanged: this.popoverStateChanged, block: true }, this.multiple ? this.visibilityToggle() : '', h("q2-option-list", { ref: el => (this.optionList = el), id: "option-list", "show-selected": this.showSelected, multiple: this.multiple, selectedOptions: this.structuredSelectedOptions, onChange: this.onOptionListChange }, h("slot", null))));
476
+ return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.innerInputField, open: this.open, minHeight: this.popoverMinHeight, direction: this.popDirection, onPopoverStateChanged: this.popoverStateChanged, block: true }, this.multiple ? this.visibilityToggle() : '', h("q2-option-list", { ref: el => (this.optionList = el), id: "option-list", "show-selected": this.showSelected, multiple: this.multiple, selectedOptions: this.structuredSelectedOptions, onChange: this.onOptionListChange }, h("slot", null))));
470
477
  }
471
478
  visibilityToggle() {
472
479
  var _a, _b;
@@ -15,7 +15,6 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
15
  this.__attachShadow();
16
16
  this.click = createEvent(this, "click", 7);
17
17
  var _a;
18
- this.activateFirstOption = false;
19
18
  /// Getters ///
20
19
  /// Helpers
21
20
  this.determineHasOptions = () => {
@@ -39,7 +38,6 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
39
38
  };
40
39
  this.handleClick = async (event) => {
41
40
  event.stopPropagation();
42
- this.activateFirstOption = false;
43
41
  if (shouldShowActionSheet(this)) {
44
42
  const { value } = await showActionSheetList(this, event);
45
43
  this.click.emit({ value });
@@ -49,7 +47,7 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
49
47
  }
50
48
  };
51
49
  this.handleKeydown = async (event) => {
52
- this.activateFirstOption = true;
50
+ event.preventDefault();
53
51
  if (shouldShowActionSheet(this, event)) {
54
52
  const { value } = await showActionSheetList(this, event);
55
53
  this.click.emit({ value });
@@ -101,14 +99,10 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
101
99
  popoverStateHandler({ detail: { open } }) {
102
100
  if (this.open !== open)
103
101
  this.open = open;
104
- if (open && this.activateFirstOption) {
105
- this.optionList.focus();
106
- this.activateFirstOption = false;
107
- }
108
- else {
109
- this.optionList.setActiveElement(null);
110
- this.dropdownBtn.focus();
111
- }
102
+ if (open)
103
+ return;
104
+ this.optionList.setActiveElement(null);
105
+ this.dropdownBtn.focus();
112
106
  }
113
107
  /// DOM ///
114
108
  render() {
@@ -116,7 +110,7 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
116
110
  const wrapperClassNames = ['tag-wrapper'];
117
111
  if (hasOptions)
118
112
  wrapperClassNames.push('has-options');
119
- return (h(Host, { role: "listitem" }, h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' '), onClick: e => e.stopPropagation() }, h("div", { class: "tag" }, this.label), this.hasOptions && (h("div", { class: "btn-wrapper", onClick: this.handleWrapperClick }, h("button", { ref: el => (this.dropdownBtn = el), "test-id": "btn-control", onClick: this.handleClick, onKeyDown: this.handleKeydown, onFocusout: this.handleButtonFocusout, "aria-controls": "option-list", "aria-haspopup": "true", "aria-expanded": open ? 'true' : 'false', "aria-label": loc('tecton.element.tag.viewOptions') }, h("q2-icon", { type: "options" }))))), this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.dropdownBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { id: "option-list", ref: el => (this.optionList = el), onChange: this.handleChange, align: "right", type: "menu", "no-select": true }, h("slot", null)))))));
113
+ return (h(Host, { role: "listitem" }, h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' '), onClick: e => e.stopPropagation() }, h("div", { class: "tag" }, this.label), this.hasOptions && (h("div", { class: "btn-wrapper", onClick: this.handleWrapperClick }, h("button", { ref: el => (this.dropdownBtn = el), "test-id": "btn-control", onClick: this.handleClick, onKeyDown: this.handleKeydown, onFocusout: this.handleButtonFocusout, "aria-controls": "option-list", "aria-haspopup": "true", "aria-expanded": open ? 'true' : 'false', "aria-label": loc('tecton.element.tag.viewOptions') }, h("q2-icon", { type: "options" }))))), this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.dropdownBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { id: "option-list", role: "menu", ref: el => (this.optionList = el), onChange: this.handleChange, align: "right", type: "menu", "no-select": true }, h("slot", null)))))));
120
114
  }
121
115
  get hostElement() { return this; }
122
116
  static get style() { return stylesCss; }
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-04-18T17:33:21",
2
+ "timestamp": "2023-04-28T16:28:31",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.19.2",
@@ -28,7 +28,11 @@ const ClickElsewhere = class {
28
28
  }
29
29
  };
30
30
  }
31
- componentWillLoad() {
31
+ /* TODO: Stencil/Rollup is having issues compiling without this here. Will try to remove in future Stencil upgrade. */
32
+ /* tslint:disable:no-empty */
33
+ componentWillLoad() { }
34
+ /* tslint:enable:no-empty */
35
+ connectedCallback() {
32
36
  this.mouseEventList.forEach((eventName) => {
33
37
  document.addEventListener(eventName, this.mouseHandler);
34
38
  });
@@ -465,7 +465,7 @@ function isHostLosingFocus(event, hostElement) {
465
465
  return false;
466
466
  };
467
467
  if (!(elementGainingFocus instanceof HTMLElement))
468
- return false;
468
+ return true;
469
469
  return !isElementNestedInHostElement(elementGainingFocus);
470
470
  }
471
471
  function isRelatedTargetWithinHost(event, element) {