q2-tecton-elements 1.23.0-alpha.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/cjs/action-sheet-4b366e9a.js +84 -0
  2. package/dist/cjs/charting-d02cba1f.js +3127 -0
  3. package/dist/cjs/{index-3518c78c.js → index-e00b4210.js} +33 -7
  4. package/dist/cjs/{installCanvasRenderer-b4d10c92.js → installCanvasRenderer-6c4fbcc9.js} +230 -1130
  5. package/dist/cjs/installLabelLayout-d6b548fe.js +1048 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/q2-action-sheet.cjs.entry.js +218 -0
  8. package/dist/cjs/q2-badge_2.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-btn_2.cjs.entry.js +2 -2
  10. package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
  11. package/dist/cjs/q2-card.cjs.entry.js +2 -2
  12. package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
  13. package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
  14. package/dist/cjs/q2-chart-area.cjs.entry.js +4569 -0
  15. package/dist/cjs/q2-chart-bar.cjs.entry.js +25 -3133
  16. package/dist/cjs/q2-chart-donut.cjs.entry.js +9 -8
  17. package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
  18. package/dist/cjs/q2-checkbox.cjs.entry.js +2 -2
  19. package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
  20. package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
  21. package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
  22. package/dist/cjs/q2-icon.cjs.entry.js +1 -1
  23. package/dist/cjs/q2-loading-element.cjs.entry.js +1 -1
  24. package/dist/cjs/q2-loc.cjs.entry.js +1 -1
  25. package/dist/cjs/q2-message.cjs.entry.js +1 -1
  26. package/dist/cjs/q2-month-picker.cjs.entry.js +1 -1
  27. package/dist/cjs/q2-optgroup_2.cjs.entry.js +93 -0
  28. package/dist/cjs/q2-option-list_2.cjs.entry.js +230 -88
  29. package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
  30. package/dist/cjs/q2-pill.cjs.entry.js +57 -18
  31. package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
  32. package/dist/cjs/q2-radio.cjs.entry.js +1 -1
  33. package/dist/cjs/q2-section.cjs.entry.js +1 -1
  34. package/dist/cjs/q2-select.cjs.entry.js +149 -409
  35. package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
  36. package/dist/cjs/q2-stepper-vertical.cjs.entry.js +1 -1
  37. package/dist/cjs/q2-stepper.cjs.entry.js +1 -1
  38. package/dist/cjs/q2-tab-container.cjs.entry.js +1 -1
  39. package/dist/cjs/q2-tag.cjs.entry.js +21 -6
  40. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  41. package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
  42. package/dist/collection/collection-manifest.json +2 -0
  43. package/dist/collection/components/q2-action-sheet/index.js +345 -0
  44. package/dist/collection/components/q2-action-sheet/styles.css +215 -0
  45. package/dist/collection/components/q2-card/index.js +1 -1
  46. package/dist/collection/components/q2-chart-area/index.js +622 -0
  47. package/dist/collection/components/q2-chart-area/styles.css +82 -0
  48. package/dist/collection/components/q2-chart-bar/index.js +4 -4
  49. package/dist/collection/components/q2-chart-bar/styles.css +3 -6
  50. package/dist/collection/components/q2-chart-donut/index.js +1 -1
  51. package/dist/collection/components/q2-checkbox/index.js +2 -2
  52. package/dist/collection/components/q2-checkbox/styles.css +1 -0
  53. package/dist/collection/components/q2-dropdown/index.js +1 -1
  54. package/dist/collection/components/q2-loading/index.js +1 -1
  55. package/dist/collection/components/q2-loading/skeleton/q2-loading-element/styles.css +4 -0
  56. package/dist/collection/components/q2-loading/styles.css +4 -0
  57. package/dist/collection/components/q2-optgroup/styles.css +2 -2
  58. package/dist/collection/components/q2-option/index.js +1 -56
  59. package/dist/collection/components/q2-option/styles.css +7 -0
  60. package/dist/collection/components/q2-option-list/index.js +290 -102
  61. package/dist/collection/components/q2-pill/index.js +79 -18
  62. package/dist/collection/components/q2-pill/styles.css +1 -2
  63. package/dist/collection/components/q2-popover/index.js +21 -5
  64. package/dist/collection/components/q2-popover/styles.css +10 -67
  65. package/dist/collection/components/q2-radio/index.js +2 -2
  66. package/dist/collection/components/q2-select/index.js +197 -427
  67. package/dist/collection/components/q2-select/styles.css +5 -11
  68. package/dist/collection/components/q2-tag/index.js +38 -5
  69. package/dist/collection/utils/action-sheet.js +79 -0
  70. package/dist/collection/utils/index.js +31 -7
  71. package/dist/components/action-sheet.js +81 -0
  72. package/dist/components/charting.js +3113 -0
  73. package/dist/components/index.d.ts +2 -0
  74. package/dist/components/index.js +2 -0
  75. package/dist/components/index10.js +1 -1
  76. package/dist/components/index11.js +42 -353
  77. package/dist/components/index12.js +44 -97
  78. package/dist/components/index13.js +495 -580
  79. package/dist/components/index14.js +137 -0
  80. package/dist/components/index15.js +626 -0
  81. package/dist/components/index5.js +1 -1
  82. package/dist/components/index6.js +1 -1
  83. package/dist/components/index7.js +1 -1
  84. package/dist/components/index8.js +1 -1
  85. package/dist/components/index9.js +3 -3
  86. package/dist/components/installCanvasRenderer.js +188 -1123
  87. package/dist/components/installLabelLayout.js +1042 -0
  88. package/dist/components/q2-action-sheet.d.ts +11 -0
  89. package/dist/components/q2-action-sheet.js +282 -0
  90. package/dist/components/q2-calendar.js +1 -1
  91. package/dist/components/q2-card.js +2 -2
  92. package/dist/components/q2-carousel-pane.js +1 -1
  93. package/dist/components/q2-carousel.js +1 -1
  94. package/dist/components/q2-chart-area.d.ts +11 -0
  95. package/dist/components/q2-chart-area.js +4604 -0
  96. package/dist/components/q2-chart-bar.js +11 -3119
  97. package/dist/components/q2-chart-donut.js +4 -3
  98. package/dist/components/q2-checkbox-group.js +1 -1
  99. package/dist/components/q2-checkbox.js +2 -2
  100. package/dist/components/q2-dropdown.js +2 -2
  101. package/dist/components/q2-editable-field.js +1 -1
  102. package/dist/components/q2-loading-element.js +1 -1
  103. package/dist/components/q2-loc.js +1 -1
  104. package/dist/components/q2-month-picker.js +1 -1
  105. package/dist/components/q2-optgroup.js +1 -70
  106. package/dist/components/q2-option-list.js +1 -1
  107. package/dist/components/q2-option.js +1 -76
  108. package/dist/components/q2-pagination.js +1 -1
  109. package/dist/components/q2-pill.js +62 -21
  110. package/dist/components/q2-popover.js +1 -1
  111. package/dist/components/q2-radio-group.js +1 -1
  112. package/dist/components/q2-radio.js +3 -3
  113. package/dist/components/q2-section.js +1 -1
  114. package/dist/components/q2-select.js +181 -427
  115. package/dist/components/q2-stepper-pane.js +1 -1
  116. package/dist/components/q2-stepper-vertical.js +1 -1
  117. package/dist/components/q2-stepper.js +1 -1
  118. package/dist/components/q2-tab-container.js +1 -1
  119. package/dist/components/q2-tag.js +24 -8
  120. package/dist/components/q2-textarea.js +1 -1
  121. package/dist/esm/action-sheet-a9597b32.js +81 -0
  122. package/dist/esm/charting-2a73ba8e.js +3113 -0
  123. package/dist/esm/{index-9c591682.js → index-ca21e539.js} +32 -8
  124. package/dist/esm/{installCanvasRenderer-0143b52d.js → installCanvasRenderer-4a470516.js} +188 -1123
  125. package/dist/esm/installLabelLayout-d660eaad.js +1042 -0
  126. package/dist/esm/loader.js +1 -1
  127. package/dist/esm/q2-action-sheet.entry.js +214 -0
  128. package/dist/esm/q2-badge_2.entry.js +1 -1
  129. package/dist/esm/q2-btn_2.entry.js +2 -2
  130. package/dist/esm/q2-calendar.entry.js +1 -1
  131. package/dist/esm/q2-card.entry.js +2 -2
  132. package/dist/esm/q2-carousel-pane.entry.js +1 -1
  133. package/dist/esm/q2-carousel.entry.js +1 -1
  134. package/dist/esm/q2-chart-area.entry.js +4565 -0
  135. package/dist/esm/q2-chart-bar.entry.js +11 -3119
  136. package/dist/esm/q2-chart-donut.entry.js +4 -3
  137. package/dist/esm/q2-checkbox-group.entry.js +1 -1
  138. package/dist/esm/q2-checkbox.entry.js +2 -2
  139. package/dist/esm/q2-dropdown-item.entry.js +1 -1
  140. package/dist/esm/q2-dropdown.entry.js +1 -1
  141. package/dist/esm/q2-editable-field.entry.js +1 -1
  142. package/dist/esm/q2-icon.entry.js +1 -1
  143. package/dist/esm/q2-loading-element.entry.js +1 -1
  144. package/dist/esm/q2-loc.entry.js +1 -1
  145. package/dist/esm/q2-message.entry.js +1 -1
  146. package/dist/esm/q2-month-picker.entry.js +1 -1
  147. package/dist/esm/q2-optgroup_2.entry.js +88 -0
  148. package/dist/esm/q2-option-list_2.entry.js +230 -88
  149. package/dist/esm/q2-pagination.entry.js +1 -1
  150. package/dist/esm/q2-pill.entry.js +57 -18
  151. package/dist/esm/q2-radio-group.entry.js +1 -1
  152. package/dist/esm/q2-radio.entry.js +1 -1
  153. package/dist/esm/q2-section.entry.js +1 -1
  154. package/dist/esm/q2-select.entry.js +149 -409
  155. package/dist/esm/q2-stepper-pane.entry.js +1 -1
  156. package/dist/esm/q2-stepper-vertical.entry.js +1 -1
  157. package/dist/esm/q2-stepper.entry.js +1 -1
  158. package/dist/esm/q2-tab-container.entry.js +1 -1
  159. package/dist/esm/q2-tag.entry.js +21 -6
  160. package/dist/esm/q2-tecton-elements.js +1 -1
  161. package/dist/esm/q2-textarea.entry.js +1 -1
  162. package/dist/q2-tecton-elements/{p-db873db2.entry.js → p-0473f4f7.entry.js} +1 -1
  163. package/dist/q2-tecton-elements/{p-520c40f6.entry.js → p-13a1390b.entry.js} +1 -1
  164. package/dist/q2-tecton-elements/{p-9ebb283a.entry.js → p-13deb3ed.entry.js} +1 -1
  165. package/dist/q2-tecton-elements/{p-0ba564b1.entry.js → p-1d854203.entry.js} +1 -1
  166. package/dist/q2-tecton-elements/p-1f71774f.entry.js +1 -0
  167. package/dist/q2-tecton-elements/{p-18cc4758.entry.js → p-256d3fe6.entry.js} +1 -1
  168. package/dist/q2-tecton-elements/{p-9281adaa.entry.js → p-282f0f8c.entry.js} +1 -1
  169. package/dist/q2-tecton-elements/{p-2d2c5af2.entry.js → p-30969629.entry.js} +1 -1
  170. package/dist/q2-tecton-elements/p-30cd888b.entry.js +1 -0
  171. package/dist/q2-tecton-elements/{p-fc134a5d.entry.js → p-37cf9c97.entry.js} +1 -1
  172. package/dist/q2-tecton-elements/{p-fb37e67e.entry.js → p-388349b5.entry.js} +1 -1
  173. package/dist/q2-tecton-elements/p-458b1987.js +1 -0
  174. package/dist/q2-tecton-elements/p-52063431.js +39 -0
  175. package/dist/q2-tecton-elements/p-5589ae0f.entry.js +1 -0
  176. package/dist/q2-tecton-elements/p-619aed74.entry.js +1 -0
  177. package/dist/q2-tecton-elements/{p-4625184b.entry.js → p-63b67260.entry.js} +1 -1
  178. package/dist/q2-tecton-elements/{p-e4dc9ac0.entry.js → p-63e363ad.entry.js} +1 -1
  179. package/dist/q2-tecton-elements/{p-cbd1289a.entry.js → p-6736df05.entry.js} +1 -1
  180. package/dist/q2-tecton-elements/p-72fe10cc.entry.js +1 -0
  181. package/dist/q2-tecton-elements/{p-c4640b55.entry.js → p-75b817c6.entry.js} +1 -1
  182. package/dist/q2-tecton-elements/{p-c3f27fe2.entry.js → p-7a116095.entry.js} +1 -1
  183. package/dist/q2-tecton-elements/p-7c94119b.entry.js +1 -0
  184. package/dist/q2-tecton-elements/p-833398d1.js +1 -0
  185. package/dist/q2-tecton-elements/{p-ce015552.entry.js → p-90572e43.entry.js} +1 -1
  186. package/dist/q2-tecton-elements/p-91153c61.entry.js +1 -0
  187. package/dist/q2-tecton-elements/p-9792de8a.entry.js +1 -0
  188. package/dist/q2-tecton-elements/p-9acfa94e.js +1 -0
  189. package/dist/q2-tecton-elements/p-a1926e65.js +1 -0
  190. package/dist/q2-tecton-elements/{p-ffb48ccc.entry.js → p-b3a8cdc5.entry.js} +1 -1
  191. package/dist/q2-tecton-elements/p-ce3f203c.entry.js +1 -0
  192. package/dist/q2-tecton-elements/{p-041b3a82.entry.js → p-ce91cd9b.entry.js} +1 -1
  193. package/dist/q2-tecton-elements/{p-b8b00394.entry.js → p-cefc9d0b.entry.js} +1 -1
  194. package/dist/q2-tecton-elements/p-d05beeb7.entry.js +1 -0
  195. package/dist/q2-tecton-elements/p-dc7c8371.entry.js +1 -0
  196. package/dist/q2-tecton-elements/{p-16c11d74.entry.js → p-e58581fc.entry.js} +1 -1
  197. package/dist/q2-tecton-elements/{p-f800fd1e.entry.js → p-e886c55b.entry.js} +1 -1
  198. package/dist/q2-tecton-elements/{p-6e6b5b80.entry.js → p-f0ec4d2c.entry.js} +1 -1
  199. package/dist/q2-tecton-elements/{p-97aa8423.entry.js → p-f94e7043.entry.js} +1 -1
  200. package/dist/q2-tecton-elements/{p-c444a60b.entry.js → p-fcb7d191.entry.js} +1 -1
  201. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  202. package/dist/test/helpers.js +3 -2
  203. package/dist/types/components/q2-action-sheet/index.d.ts +52 -0
  204. package/dist/types/components/q2-card/index.d.ts +1 -1
  205. package/dist/types/components/q2-chart-area/index.d.ts +40 -0
  206. package/dist/types/components/q2-chart-bar/index.d.ts +2 -2
  207. package/dist/types/components/q2-chart-donut/index.d.ts +1 -1
  208. package/dist/types/components/q2-checkbox/index.d.ts +4 -1
  209. package/dist/types/components/q2-option/index.d.ts +0 -3
  210. package/dist/types/components/q2-option-list/index.d.ts +16 -8
  211. package/dist/types/components/q2-pill/index.d.ts +10 -1
  212. package/dist/types/components/q2-popover/index.d.ts +2 -0
  213. package/dist/types/components/q2-select/index.d.ts +46 -47
  214. package/dist/types/components/q2-tag/index.d.ts +3 -2
  215. package/dist/types/components.d.ts +100 -13
  216. package/dist/types/global.d.ts +10 -1
  217. package/dist/types/utils/action-sheet.d.ts +12 -0
  218. package/dist/types/utils/index.d.ts +3 -1
  219. package/dist/types/workspace/workspace/{_production_release_1.22.x-alpha → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +1 -1
  220. package/package.json +3 -2
  221. package/dist/cjs/q2-optgroup.cjs.entry.js +0 -56
  222. package/dist/cjs/q2-option.cjs.entry.js +0 -46
  223. package/dist/esm/q2-optgroup.entry.js +0 -52
  224. package/dist/esm/q2-option.entry.js +0 -42
  225. package/dist/q2-tecton-elements/p-0d8dd75a.entry.js +0 -1
  226. package/dist/q2-tecton-elements/p-0fad9c5a.entry.js +0 -1
  227. package/dist/q2-tecton-elements/p-1f85cced.js +0 -39
  228. package/dist/q2-tecton-elements/p-2c9b1308.entry.js +0 -1
  229. package/dist/q2-tecton-elements/p-5e374fbd.js +0 -1
  230. package/dist/q2-tecton-elements/p-6b52a262.entry.js +0 -1
  231. package/dist/q2-tecton-elements/p-aaf42539.entry.js +0 -1
  232. package/dist/q2-tecton-elements/p-cf41970f.entry.js +0 -1
  233. package/dist/q2-tecton-elements/p-de164483.entry.js +0 -1
  234. package/dist/q2-tecton-elements/p-e6d26f39.entry.js +0 -1
  235. package/dist/q2-tecton-elements/p-f1d06917.entry.js +0 -1
  236. package/dist/q2-tecton-elements/p-f35bf6a3.entry.js +0 -1
@@ -1,13 +1,18 @@
1
1
  import { h, } from '@stencil/core';
2
- import { createGuid, handleAriaLabel, isEventFromElement, isRelatedTargetWithinHost, loc, overrideFocus, resizeIframe, setPopProperties, } from 'src/utils';
2
+ import { handleAriaLabel, isEventFromElement, isHostLosingFocus, isRelatedTargetWithinHost, loc, overrideFocus, } from '../../utils';
3
+ import { shouldShowActionSheet, showActionSheetList } from 'src/utils/action-sheet';
3
4
  export class Q2Select {
4
5
  constructor() {
6
+ var _a;
5
7
  this.scheduledAfterRender = [];
6
- this.keyStore = {
7
- queue: [],
8
- lastPressedAt: new Date(),
8
+ this.showSelectedOptions = (event) => {
9
+ event.stopPropagation();
10
+ this.showSelected = true;
11
+ };
12
+ this.showAllOptions = (event) => {
13
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
14
+ this.showSelected = false;
9
15
  };
10
- this.guid = createGuid();
11
16
  this.onMutationObserved = () => {
12
17
  const slotContainer = this.hostElement.querySelector('.custom-display-content');
13
18
  const displaySlot = this.hostElement.shadowRoot.querySelector('slot[name="q2-select-display"]');
@@ -17,201 +22,62 @@ export class Q2Select {
17
22
  if (this.hasCustomDisplay !== hasCustomDisplay) {
18
23
  this.hasCustomDisplay = hasCustomDisplay;
19
24
  }
20
- if (this.multiple) {
21
- this.updateMultipleOptionAttrs();
22
- return;
23
- }
24
- this.updateSingleOptionAttrs();
25
- const activeOption = this.optionElements[this.activeIndex];
26
- if (!activeOption || activeOption.id !== this.activeOptionId) {
27
- this.activeIndex = this.getDefaultActiveIndex();
28
- this.setActiveOption();
29
- }
30
25
  };
31
- this.searchAndFocus = keyValue => {
32
- // pseudo search in non-searchable select
33
- const reorder = () => {
34
- this.pivotIndex = this.pivotIndex === undefined ? 0 : (this.activeIndex || 0) + 1;
35
- const list = this.optionElements.map((element, index) => ({ element, index }));
36
- return [...list.slice(this.pivotIndex), ...list.slice(0, this.pivotIndex)];
37
- };
38
- const buildQueue = () => {
39
- const now = new Date();
40
- if (now.getTime() - this.keyStore.lastPressedAt.getTime() > 1000) {
41
- // empty stored keys if delay > 1s
42
- this.keyStore.queue = [];
43
- }
44
- if (this.keyStore.queue.length !== 1 || this.keyStore.queue[0] !== keyValue) {
45
- this.keyStore.queue.push(keyValue);
46
- }
47
- this.keyStore.lastPressedAt = now;
48
- };
49
- const searchIndex = list => {
50
- return list.find(v => {
51
- return (!v.element.disabled &&
52
- v.element.display &&
53
- v.element.display.replace(/\s/g, '').match(new RegExp(`^${this.keyStore.queue.join('')}`, 'i')));
54
- });
55
- };
56
- const setFocus = ({ element, index }) => {
57
- if (this.dropdownOpen || this.multiple) {
58
- // multiple: should open to make sure that which options are selected
59
- this.openDropdownWithActiveElement(index);
60
- }
61
- else {
62
- this.activeIndex = index;
63
- this.change.emit({ value: element.value });
64
- }
65
- };
66
- buildQueue();
67
- const matched = searchIndex(reorder());
68
- if (matched) {
69
- setFocus(matched);
70
- }
26
+ this.onOptionListChange = (event) => {
27
+ event.stopPropagation();
28
+ const { values } = event.detail;
29
+ if (values.length === 0)
30
+ this.showAllOptions();
31
+ this.handleSelectionChanges(event.detail);
71
32
  };
72
33
  /// Event handlers ///
73
- this.dropdownFocusoutHandler = (event) => {
74
- const { relatedTarget } = event;
75
- const isInDropdown = this.dropdownContainer.contains(relatedTarget);
76
- const isInLightDom = !isInDropdown && this.hostElement.contains(relatedTarget);
77
- if (isInDropdown || isInLightDom)
34
+ this.popoverStateChanged = ({ detail: { open } }) => {
35
+ if (this.open === open)
78
36
  return;
79
- if (!this.dropdownOpen)
37
+ this.open = open;
38
+ if (open && !this.searchText)
80
39
  return;
81
- this.closeDropdown();
40
+ this.optionList.setActiveElement(null);
41
+ this.inputField.focus();
82
42
  };
83
- /* tslint:disable:cyclomatic-complexity */
84
- this.dropdownKeydownHandler = (event) => {
85
- event.stopPropagation();
86
- const { activeIndex, searchable, optionElements, multiSelectHeader } = this;
87
- const { key, shiftKey } = event;
88
- if (this.readonly ||
89
- (multiSelectHeader && multiSelectHeader.contains(event.target) && [' ', 'Enter'].includes(key)))
43
+ this.inputKeydownHandler = (event) => {
44
+ if (this.readonly || this.disabled)
90
45
  return;
91
- switch (key) {
92
- case ' ':
93
- case 'Enter':
94
- event.preventDefault();
95
- const newOption = this.hostElement.querySelector(`[option-id="${this.activeOptionId}"]`);
96
- if (!newOption || newOption.disabled)
97
- break;
98
- this.selectOption(newOption, true);
99
- break;
100
- case 'ArrowUp':
101
- event.preventDefault();
102
- const isFirstOption = activeIndex === 0;
103
- if (isFirstOption)
104
- break;
105
- if (activeIndex !== undefined) {
106
- const nextIndex = this.getNextVisibleIndex(-1);
107
- if (nextIndex === -1)
108
- break;
109
- this.adjustActiveOptionAndScroll(nextIndex - activeIndex);
110
- }
111
- else {
112
- this.setDefaultActiveElement();
113
- }
114
- break;
115
- case 'ArrowDown':
116
- event.preventDefault();
117
- const isLastOption = activeIndex === optionElements.length - 1;
118
- if (isLastOption)
119
- break;
120
- if (activeIndex !== undefined) {
121
- const nextIndex = this.getNextVisibleIndex(1);
122
- if (nextIndex === -1)
123
- break;
124
- this.adjustActiveOptionAndScroll(nextIndex - activeIndex);
125
- }
126
- else {
127
- this.setDefaultActiveElement();
128
- }
129
- break;
130
- case 'Home':
131
- event.preventDefault();
132
- this.openDropdownWithActiveElement(0);
133
- break;
134
- case 'End':
135
- event.preventDefault();
136
- this.openDropdownWithActiveElement(optionElements.length - 1);
137
- break;
138
- case 'PageUp':
139
- event.preventDefault();
140
- this.openDropdownWithActiveElement(Math.max(activeIndex - 10, 0));
141
- break;
142
- case 'PageDown':
143
- event.preventDefault();
144
- this.openDropdownWithActiveElement(Math.min(activeIndex + 10, optionElements.length - 1));
145
- break;
146
- case 'Tab':
147
- if (shiftKey)
148
- break;
149
- const myOption = this.hostElement.querySelector(`[option-id="${this.activeOptionId}"]`);
150
- if (!myOption || myOption.disabled)
151
- return;
152
- if (myOption.selected)
153
- return;
154
- this.selectOption(myOption);
155
- break;
156
- case 'Esc':
157
- case 'Escape':
158
- this.closeDropdown();
159
- this.focusInput();
160
- break;
161
- default:
162
- if (searchable)
163
- break;
164
- if (!key.match(/^[A-Za-z0-9]$/))
165
- break;
166
- // search in non-searchable select: alpha-numeric only
167
- this.searchAndFocus(key);
168
- break;
46
+ const keysForOptionListToHandle = [
47
+ 'ArrowDown',
48
+ 'ArrowUp',
49
+ 'PageDown',
50
+ 'PageUp',
51
+ 'Home',
52
+ 'End',
53
+ 'Escape',
54
+ 'Tab',
55
+ ];
56
+ if (shouldShowActionSheet(this, event)) {
57
+ return this.executeActionSheet(event);
169
58
  }
59
+ if (this.searchable && !keysForOptionListToHandle.includes(event.key))
60
+ return;
61
+ if (this.shouldClearSearchText(event))
62
+ this.clearSearchText();
63
+ this.optionList.handleExternalKeydown(event);
170
64
  };
171
- /* tslint:enable:cyclomatic-complexity */
172
- this.inputKeydownHandler = (event) => {
173
- event.stopPropagation();
174
- const { key } = event;
175
- const { optionElements, searchable } = this;
176
- switch (key) {
177
- case 'ArrowDown':
178
- event.preventDefault();
179
- this.openDropdownWithActiveElement(this.getDefaultActiveIndex());
180
- break;
181
- case 'ArrowUp':
182
- event.preventDefault();
183
- this.openDropdownWithActiveElement(this.getLastEnabledIndex());
184
- this.setFocusedOption();
185
- break;
186
- case 'Home':
187
- event.preventDefault();
188
- this.openDropdownWithActiveElement(0);
189
- break;
190
- case 'End':
191
- event.preventDefault();
192
- this.openDropdownWithActiveElement(optionElements.length - 1);
193
- break;
194
- case 'Escape':
195
- case 'Esc':
196
- this.closeDropdown();
197
- break;
198
- case 'Tab':
199
- this.closeDropdown();
200
- break;
201
- default:
202
- if (!key.match(/^[A-Za-z0-9]$/))
203
- break;
204
- if (searchable) {
205
- this.openDropdownWithoutActiveElement();
206
- break;
207
- }
208
- // search in non-searchable select: alpha-numeric only
209
- this.searchAndFocus(key);
65
+ this.visibilityToggleKeyDown = (event) => {
66
+ const keysForOptionListToHandle = ['ArrowDown', 'ArrowUp'];
67
+ const keysThatTriggerClick = ['Enter', ' '];
68
+ const key = event.key;
69
+ if (keysForOptionListToHandle.includes(key)) {
70
+ this.optionList.handleExternalKeydown(event);
71
+ }
72
+ else if (keysThatTriggerClick.includes(key)) {
73
+ event.target.dispatchEvent(new MouseEvent('click'));
210
74
  }
211
75
  };
212
- this.inputClickHandler = (event) => {
76
+ this.inputClickHandler = async (event) => {
213
77
  event.stopPropagation();
214
- setPopProperties(this);
78
+ if (shouldShowActionSheet(this)) {
79
+ return this.executeActionSheet(event);
80
+ }
215
81
  this.toggleDropdown();
216
82
  this.focusInput();
217
83
  };
@@ -221,10 +87,9 @@ export class Q2Select {
221
87
  const eventValue = event.detail.value;
222
88
  const didChangeText = inputValue !== eventValue;
223
89
  const shouldClearValue = !!this.value && didChangeText;
224
- if (shouldClearValue) {
225
- this.selectOption(null);
226
- }
227
- if (!this.dropdownOpen)
90
+ if (shouldClearValue)
91
+ this.clearValue();
92
+ if (!this.open)
228
93
  this.openDropdownWithoutActiveElement();
229
94
  this.prioritizeSearch = true;
230
95
  this.searchText = eventValue;
@@ -241,32 +106,18 @@ export class Q2Select {
241
106
  };
242
107
  this.clickedElsewhere = (event) => {
243
108
  const target = event.target;
244
- if (target.localName === 'click-elsewhere') {
245
- event.stopPropagation();
246
- if (this.dropdownOpen) {
247
- this.closeDropdown();
248
- }
249
- }
109
+ if (target.localName !== 'click-elsewhere')
110
+ return;
111
+ event.stopPropagation();
112
+ if (!this.open)
113
+ return;
114
+ this.closeDropdown();
250
115
  };
251
116
  this.onCustomDisplayClick = (event) => {
252
117
  event.stopPropagation();
253
118
  this.focusInput();
254
119
  this.toggleDropdown();
255
120
  };
256
- this.showSelectedOptions = (event) => {
257
- event.stopImmediatePropagation();
258
- this.onlyShowingSelected = true;
259
- this.optionElements.forEach(optionElement => {
260
- optionElement._multiSelectHidden = !optionElement.selected;
261
- });
262
- };
263
- this.showAllOptions = (event) => {
264
- event.stopPropagation();
265
- this.onlyShowingSelected = false;
266
- this.optionElements.forEach(optionElement => {
267
- optionElement._multiSelectHidden = false;
268
- });
269
- };
270
121
  this.label = undefined;
271
122
  this.hideLabel = undefined;
272
123
  this.value = undefined;
@@ -282,18 +133,22 @@ export class Q2Select {
282
133
  this.searchable = false;
283
134
  this.multilineOptions = false;
284
135
  this.optional = false;
285
- this.dropdownOpen = false;
286
- this.onlyShowingSelected = false;
287
- this.activeOptionId = undefined;
136
+ this.placeholder = undefined;
137
+ this.hoist = !!((_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.useActionSheets);
138
+ this.open = false;
139
+ this.showSelected = false;
288
140
  this.searchText = '';
289
141
  this.hasCustomDisplay = false;
290
142
  this.inputFocused = false;
291
143
  this.statusMessage = undefined;
292
144
  this.prioritizeSearch = false;
145
+ this.structuredSelectedOptions = [];
293
146
  }
294
147
  /// Lifecycle Hooks ///
295
148
  componentWillLoad() {
296
149
  handleAriaLabel(this);
150
+ this.buildStructuredSelectedOptions();
151
+ this.handleMultilineOptionsUpdate(this.multilineOptions, false);
297
152
  }
298
153
  componentDidLoad() {
299
154
  const observer = new MutationObserver(this.onMutationObserved);
@@ -315,22 +170,17 @@ export class Q2Select {
315
170
  this.mutationObserver = null;
316
171
  }
317
172
  /// Getters ///
318
- get isComponentFocused() {
319
- return document.activeElement === this.hostElement || !!this.hostElement.querySelector(':focus');
320
- }
321
- get isSearchMode() {
322
- return (this.searchable && this.inputFocused) || this.searchText;
323
- }
324
173
  get badgeValue() {
174
+ var _a, _b;
325
175
  if (!this.multiple)
326
- return;
327
- const optionsLength = this.selectedOptions.length;
328
- if (this.dropdownOpen && this.searchable)
329
- return optionsLength || null;
176
+ return null;
177
+ const optionsLength = (_b = (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
178
+ if (this.open && this.searchable)
179
+ return optionsLength ? `${optionsLength}` : null;
330
180
  else
331
181
  return optionsLength > 1 ? `+${optionsLength - 1}` : null;
332
182
  }
333
- get minPopHeight() {
183
+ get popoverMinHeight() {
334
184
  const { minRows } = this;
335
185
  const firstOption = this.hostElement.querySelector('q2-option:not([hidden])');
336
186
  const minHeight = firstOption ? window.getComputedStyle(firstOption).minHeight : '44px';
@@ -347,10 +197,8 @@ export class Q2Select {
347
197
  return this.hostElement.querySelector('[slot="_selected-display"]');
348
198
  }
349
199
  get firstSelectedValue() {
350
- var _a, _b;
351
- if (this.multiple)
352
- return (_b = (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : null;
353
- return this.value;
200
+ var _a;
201
+ return this.multiple ? (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a[0] : this.value;
354
202
  }
355
203
  get firstSelectedOptionElement() {
356
204
  const { firstSelectedValue } = this;
@@ -359,14 +207,9 @@ export class Q2Select {
359
207
  get optionElements() {
360
208
  return Array.from(this.hostElement.querySelectorAll('q2-option'));
361
209
  }
362
- get visibleOptionElements() {
363
- return Array.from(this.hostElement.querySelectorAll('q2-option:not([_multiselecthidden])'));
364
- }
365
210
  get wrapperClasses() {
366
211
  const { errors } = this;
367
212
  const classes = ['q2-select-container'];
368
- if (this.dropdownOpen)
369
- classes.push('dropdown-open');
370
213
  if (Array.isArray(errors) && errors.length > 0)
371
214
  classes.push('has-error');
372
215
  if (this.inputFocused)
@@ -376,33 +219,39 @@ export class Q2Select {
376
219
  return classes.join(' ');
377
220
  }
378
221
  /// Watchers ///
222
+ buildStructuredSelectedOptions() {
223
+ const { multiple, selectedOptions, value } = this;
224
+ if (multiple) {
225
+ this.structuredSelectedOptions = !!(selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length)
226
+ ? selectedOptions.map(option => (typeof option === 'string' ? { value: option } : option))
227
+ : [];
228
+ }
229
+ else {
230
+ this.structuredSelectedOptions = value ? [{ value }] : [];
231
+ }
232
+ }
379
233
  ariaLabelObserver() {
380
234
  handleAriaLabel(this);
381
235
  }
382
236
  valueUpdated() {
383
237
  if (this.multiple)
384
238
  return;
385
- this.updateSingleOptionAttrs();
239
+ this.clearSearchText();
386
240
  }
387
- selectedOptionsUpdated() {
388
- if (!this.multiple)
389
- return;
390
- this.updateMultipleOptionAttrs();
391
- }
392
- multilineOptionsChanged(newValue, oldValue) {
241
+ handleMultilineOptionsUpdate(newValue, oldValue) {
393
242
  if (newValue === oldValue)
394
243
  return;
395
244
  this.optionElements.forEach(element => (element.multiline = newValue));
396
245
  }
397
- dropdownOpenChanged(isOpen) {
246
+ openChanged(isOpen) {
398
247
  this.scheduledAfterRender.push(() => {
399
- const { multiple, multiSelectHeader, dropdownContainer } = this;
248
+ const { multiple, multiSelectHeader, popoverElement } = this;
400
249
  const height = (isOpen && multiple && (multiSelectHeader === null || multiSelectHeader === void 0 ? void 0 : multiSelectHeader.offsetHeight)) || 0;
401
250
  if (height) {
402
- dropdownContainer.style.setProperty('--comp-multi-select-header-height', `${height}px`);
251
+ popoverElement.style.setProperty('--comp-multi-select-header-height', `${height}px`);
403
252
  }
404
253
  else {
405
- dropdownContainer.style.removeProperty('--comp-multi-select-header-height');
254
+ popoverElement.style.removeProperty('--comp-multi-select-header-height');
406
255
  }
407
256
  });
408
257
  }
@@ -411,15 +260,17 @@ export class Q2Select {
411
260
  this.inputKeydownHandler(event);
412
261
  }
413
262
  onHostElementChange(event) {
414
- if (this.readonly)
263
+ if (this.readonly || this.disabled)
415
264
  return;
416
265
  if (event.target !== this.hostElement || this.hostElement.onchange)
417
266
  return;
418
267
  if (this.multiple) {
268
+ this.value = null;
419
269
  this.selectedOptions = event.detail.selectedOptions;
420
270
  }
421
271
  else {
422
272
  this.value = event.detail.value;
273
+ this.selectedOptions = [];
423
274
  }
424
275
  }
425
276
  onHostElementInput(event) {
@@ -461,54 +312,33 @@ export class Q2Select {
461
312
  }
462
313
  }
463
314
  handleFocusout(event) {
464
- this.prioritizeSearch = !isRelatedTargetWithinHost(event, this.hostElement) && this.searchable;
465
- }
466
- clickHandler(event) {
467
- const selectedOption = event.target.closest('q2-option');
468
- if (!selectedOption ||
469
- (selectedOption.hasAttribute('disabled') && selectedOption.getAttribute('disabled') !== 'false'))
470
- return;
471
- this.selectOption(selectedOption, true);
315
+ const isLeavingHost = isHostLosingFocus(event, this.hostElement);
316
+ if (isLeavingHost)
317
+ this.closeDropdown();
318
+ this.prioritizeSearch = !isLeavingHost && this.searchable;
472
319
  }
473
320
  /// Helpers ///
474
- getDefaultActiveIndex() {
475
- const firstSelected = this.optionElements.findIndex(element => element.selected && !element.hidden);
476
- if (firstSelected > -1)
477
- return firstSelected;
478
- const firstEnabled = this.optionElements.findIndex(element => !element.hidden);
479
- if (firstEnabled > -1)
480
- return firstEnabled;
481
- else
482
- return 0;
483
- }
484
- getLastEnabledIndex() {
485
- const enabledIndexes = this.optionElements.reduce((acc, element, index) => {
486
- if (!element.hidden && !element.disabled)
487
- acc.push(index);
488
- return acc;
489
- }, []);
490
- return enabledIndexes[enabledIndexes.length - 1];
491
- }
492
- setActiveOption() {
493
- if (!this.dropdownOpen)
494
- return;
495
- const activeIndex = this.activeIndex;
496
- this.optionElements.forEach((element, elementIndex) => {
497
- if (activeIndex === elementIndex) {
498
- element.active = true;
499
- this.activeOptionId = element.optionId;
500
- }
501
- else {
502
- element.active = false;
503
- }
321
+ async executeActionSheet(event) {
322
+ const result = await showActionSheetList(this, event);
323
+ this.handleSelectionChanges(result);
324
+ }
325
+ handleSelectionChanges(changeDetails) {
326
+ const { value = '', values = [] } = changeDetails;
327
+ const selectedOptionValues = values.map(value => value.value);
328
+ const { multiple } = this;
329
+ if (!this.hostElement.onchange) {
330
+ this.selectedOptions = selectedOptionValues;
331
+ }
332
+ this.change.emit({
333
+ value: multiple ? undefined : value,
334
+ selectedOptions: multiple ? selectedOptionValues : undefined,
504
335
  });
505
336
  }
506
- setFocusedOption() {
507
- const option = this.optionElements[this.activeIndex];
508
- if (!option)
509
- return;
510
- option.dispatchEvent(new FocusEvent('focus'));
511
- option.focus();
337
+ clearValue() {
338
+ const { multiple } = this;
339
+ this.value = '';
340
+ this.selectedOptions = [];
341
+ this.change.emit({ value: multiple ? undefined : '', selectedOptions: multiple ? [] : undefined });
512
342
  }
513
343
  calculateMultiSelectSelectedDisplay() {
514
344
  var _a;
@@ -527,130 +357,36 @@ export class Q2Select {
527
357
  const { firstSelectedOptionElement } = this;
528
358
  return ((firstSelectedOptionElement === null || firstSelectedOptionElement === void 0 ? void 0 : firstSelectedOptionElement.display) && loc(firstSelectedOptionElement.display)) || this.value || '';
529
359
  }
530
- updateSingleOptionAttrs() {
531
- const { value, guid, multilineOptions } = this;
532
- this.optionElements.forEach((element, index) => {
533
- element.selected = element.value === value;
534
- element.optionId = `q2-select-${guid}-option-${index}`;
535
- element.multiline = multilineOptions;
536
- });
537
- }
538
- updateMultipleOptionAttrs() {
539
- if (this.selectedOptions.length === 0) {
540
- this.onlyShowingSelected = false;
541
- }
542
- const { selectedOptions, onlyShowingSelected, guid, multilineOptions } = this;
543
- this.optionElements.forEach((element, index) => {
544
- element.selected = selectedOptions.includes(element.value);
545
- element._multiSelectHidden = onlyShowingSelected ? !element.selected : false;
546
- element.optionId = `q2-select-${guid}-option-${index}`;
547
- element.multiline = multilineOptions;
548
- });
549
- }
550
- focusSelectedSibling(option) {
551
- if (!this.onlyShowingSelected)
552
- return;
553
- const { visibleOptionElements } = this;
554
- if (visibleOptionElements.length < 2)
555
- return;
556
- const optionIndex = visibleOptionElements.indexOf(option);
557
- const visibleFocusIndex = optionIndex ? optionIndex - 1 : optionIndex + 1;
558
- const optionToFocus = visibleOptionElements[visibleFocusIndex];
559
- const focusIndex = this.optionElements.indexOf(optionToFocus);
560
- this.activeIndex = focusIndex;
561
- this.setFocusedOption();
562
- }
563
- selectOption(option, focusInputOnClose = false) {
564
- var _a;
565
- const value = (_a = option === null || option === void 0 ? void 0 : option.value) !== null && _a !== void 0 ? _a : '';
566
- if (this.multiple) {
567
- const isSelected = this.selectedOptions.includes(value);
568
- if (isSelected) {
569
- this.focusSelectedSibling(option);
570
- this.change.emit({
571
- selectedOptions: this.selectedOptions.filter(selectedValue => selectedValue !== value),
572
- });
573
- }
574
- else if (value) {
575
- this.change.emit({ selectedOptions: [...this.selectedOptions, value] });
576
- }
577
- }
578
- else {
579
- this.change.emit({ value });
580
- this.closeDropdown();
581
- if (focusInputOnClose)
582
- this.focusInput();
583
- }
584
- }
585
- scrollToActiveOption() {
586
- const activeOption = this.optionElements[this.activeIndex];
587
- activeOption === null || activeOption === void 0 ? void 0 : activeOption.scrollIntoView({ block: 'nearest' });
588
- }
589
360
  openDropdownWithoutActiveElement() {
590
- if (this.readonly)
591
- return;
592
- this.activeIndex = undefined;
593
- this.setActiveOption();
594
- this.dropdownOpen = true;
595
- this.scheduledAfterRender.push(resizeIframe);
596
- }
597
- openDropdownWithActiveElement(activeIndex) {
598
- if (this.readonly)
361
+ if (this.readonly || this.disabled)
599
362
  return;
600
- this.activeIndex = activeIndex;
601
- this.dropdownOpen = true;
602
- this.setActiveOption();
603
- this.scheduledAfterRender.push(() => {
604
- this.setFocusedOption();
605
- this.scrollToActiveOption();
606
- resizeIframe();
607
- });
363
+ this.optionList.setActiveElement(null);
364
+ this.open = true;
608
365
  }
609
366
  closeDropdown() {
610
- this.dropdownOpen = false;
611
- if (this.searchText) {
612
- this.searchText = '';
613
- this.input.emit({ query: '' });
614
- }
615
- this.scheduledAfterRender.push(resizeIframe);
367
+ this.open = false;
368
+ this.clearSearchText();
369
+ }
370
+ clearSearchText() {
371
+ if (!this.searchText)
372
+ return;
373
+ this.searchText = '';
374
+ this.input.emit({ query: '' });
616
375
  }
617
376
  toggleDropdown() {
618
- if (this.disabled)
377
+ if (this.readonly || this.disabled)
619
378
  return;
620
- if (this.dropdownOpen && !this.searchText) {
379
+ if (this.open && !this.searchText) {
621
380
  this.closeDropdown();
622
381
  }
623
382
  else {
624
383
  this.openDropdownWithoutActiveElement();
625
384
  }
626
385
  }
627
- adjustActiveOptionAndScroll(numToAdd) {
628
- this.activeIndex += numToAdd;
629
- this.setActiveOption();
630
- this.setFocusedOption();
631
- this.scrollToActiveOption();
632
- }
633
- setDefaultActiveElement() {
634
- this.activeIndex = this.getDefaultActiveIndex();
635
- this.setActiveOption();
636
- this.setFocusedOption();
637
- }
638
386
  focusInput() {
639
387
  var _a;
640
388
  (_a = this.inputField) === null || _a === void 0 ? void 0 : _a.dispatchEvent(new FocusEvent('focus'));
641
389
  }
642
- getNextVisibleIndex(direction) {
643
- let index = this.activeIndex + direction;
644
- const { optionElements } = this;
645
- while (index >= 0 && index <= optionElements.length - 1) {
646
- const { display, visibility } = window.getComputedStyle(optionElements[index]);
647
- if (display !== 'none' && visibility !== 'hidden') {
648
- return index;
649
- }
650
- index = index + direction;
651
- }
652
- return -1;
653
- }
654
390
  setStatusMessage(message) {
655
391
  clearTimeout(this.statusMessageTimer);
656
392
  this.statusMessage = '';
@@ -665,7 +401,7 @@ export class Q2Select {
665
401
  checkSelectedDisplay() {
666
402
  let namedSlot = this.selectedDisplaySlot;
667
403
  const { value, multiple, selectedOptions, multilineOptions, firstSelectedOptionElement, prioritizeSearch } = this;
668
- const hasNoValue = !value && multiple && !selectedOptions.length;
404
+ const hasNoValue = !value && multiple && !(selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length);
669
405
  if (prioritizeSearch || !multilineOptions || hasNoValue)
670
406
  return this.clearSelectedDisplay();
671
407
  if (!firstSelectedOptionElement || firstSelectedOptionElement.display)
@@ -694,6 +430,9 @@ export class Q2Select {
694
430
  return;
695
431
  selectedDisplaySlot.style.setProperty('--comp-selected-display-height', '44px');
696
432
  }
433
+ shouldClearSearchText(event) {
434
+ return this.searchable && !!this.searchText && event.key === 'Escape';
435
+ }
697
436
  /// DOM ///
698
437
  renderCustomDisplay() {
699
438
  const hasSelectedDisplay = this.checkSelectedDisplay();
@@ -708,15 +447,16 @@ export class Q2Select {
708
447
  this.errors.length > 0 &&
709
448
  this.errors.map(error => loc(error))) ||
710
449
  (this.invalid && ['tecton.element.select.invalid']) ||
711
- [], disabled: this.disabled, optional: this.optional, readonly: this.readonly, hideLabel: this.hideLabel, ariaExpanded: `${!!this.dropdownOpen}`, ariaOwns: "dropdown", 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.isComponentFocused ? '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()));
450
+ [], 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()));
712
451
  }
713
452
  optionsDropdown() {
714
- const dropDirection = this.privatePopDirection === 'up' ? 'dropup' : '';
715
- return (h("div", { class: `q2-select-dropdown q2-element-dropdown ${dropDirection}`, ref: el => (this.dropdownContainer = el), onKeyDown: this.dropdownKeydownHandler, onFocusout: this.dropdownFocusoutHandler }, this.multiple ? this.visibilityToggle() : '', h("div", { class: "q2-select-options", id: "dropdown", role: "listbox" }, h("slot", null))));
453
+ 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))));
716
454
  }
717
455
  visibilityToggle() {
718
- const selectedOptionsCount = this.selectedOptions.length;
719
- return (h("div", { class: "multi-select-header", ref: el => (this.multiSelectHeader = el) }, loc('tecton.element.select.multiHeader.showing'), h("q2-btn", { class: `show-all-options${this.onlyShowingSelected ? '' : ' selected'}`, badge: true, "aria-selected": !this.onlyShowingSelected || undefined, "test-id": "allOptionsButton", onClick: this.showAllOptions, label: loc('tecton.element.select.multiHeader.allAriaLabel'), "hide-label": true }, loc('tecton.element.select.multiHeader.all')), h("q2-btn", { class: `show-selected-options${this.onlyShowingSelected ? ' selected' : ''}`, "aria-selected": this.onlyShowingSelected || undefined, disabled: this.selectedOptions.length === 0, badge: true, "test-id": "selectedOptionsButton", onClick: this.showSelectedOptions, label: loc('tecton.element.select.multiHeader.selectedAriaLabel', [selectedOptionsCount]), "hide-label": true }, loc('tecton.element.select.multiHeader.selected', [selectedOptionsCount]))));
456
+ var _a, _b;
457
+ const selectedOptionsCount = (_b = (_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
458
+ const { showSelected } = this;
459
+ return (h("div", { class: "multi-select-header", ref: el => (this.multiSelectHeader = el) }, h("span", null, loc('tecton.element.select.multiHeader.showing')), h("q2-btn", { class: showSelected ? '' : 'selected', badge: true, "aria-selected": !showSelected || undefined, "test-id": "allOptionsButton", onClick: this.showAllOptions, onKeyDown: this.visibilityToggleKeyDown, label: loc('tecton.element.select.multiHeader.allAriaLabel'), "hide-label": true }, loc('tecton.element.select.multiHeader.all')), h("q2-btn", { class: showSelected ? 'selected' : '', "aria-selected": showSelected || undefined, disabled: selectedOptionsCount === 0, badge: true, "test-id": "selectedOptionsButton", onClick: this.showSelectedOptions, onKeyDown: this.visibilityToggleKeyDown, label: loc('tecton.element.select.multiHeader.selectedAriaLabel', [selectedOptionsCount]), "hide-label": true }, loc('tecton.element.select.multiHeader.selected', [selectedOptionsCount]))));
720
460
  }
721
461
  static get is() { return "q2-select"; }
722
462
  static get encapsulation() { return "shadow"; }
@@ -801,11 +541,11 @@ export class Q2Select {
801
541
  "reflect": true
802
542
  },
803
543
  "selectedOptions": {
804
- "type": "any",
544
+ "type": "unknown",
805
545
  "mutable": true,
806
546
  "complexType": {
807
- "original": "any",
808
- "resolved": "any",
547
+ "original": "string[]",
548
+ "resolved": "string[]",
809
549
  "references": {}
810
550
  },
811
551
  "required": false,
@@ -814,8 +554,6 @@ export class Q2Select {
814
554
  "tags": [],
815
555
  "text": ""
816
556
  },
817
- "attribute": "selected-options",
818
- "reflect": false,
819
557
  "defaultValue": "[]"
820
558
  },
821
559
  "disabled": {
@@ -992,19 +730,54 @@ export class Q2Select {
992
730
  "attribute": "optional",
993
731
  "reflect": true,
994
732
  "defaultValue": "false"
733
+ },
734
+ "placeholder": {
735
+ "type": "string",
736
+ "mutable": false,
737
+ "complexType": {
738
+ "original": "string",
739
+ "resolved": "string",
740
+ "references": {}
741
+ },
742
+ "required": false,
743
+ "optional": false,
744
+ "docs": {
745
+ "tags": [],
746
+ "text": ""
747
+ },
748
+ "attribute": "placeholder",
749
+ "reflect": true
750
+ },
751
+ "hoist": {
752
+ "type": "boolean",
753
+ "mutable": false,
754
+ "complexType": {
755
+ "original": "boolean",
756
+ "resolved": "boolean",
757
+ "references": {}
758
+ },
759
+ "required": false,
760
+ "optional": false,
761
+ "docs": {
762
+ "tags": [],
763
+ "text": ""
764
+ },
765
+ "attribute": "hoist",
766
+ "reflect": false,
767
+ "defaultValue": "!!window.Tecton?.useActionSheets"
995
768
  }
996
769
  };
997
770
  }
998
771
  static get states() {
999
772
  return {
1000
- "dropdownOpen": {},
1001
- "onlyShowingSelected": {},
1002
- "activeOptionId": {},
773
+ "open": {},
774
+ "showSelected": {},
1003
775
  "searchText": {},
1004
776
  "hasCustomDisplay": {},
1005
777
  "inputFocused": {},
1006
778
  "statusMessage": {},
1007
- "prioritizeSearch": {}
779
+ "prioritizeSearch": {},
780
+ "structuredSelectedOptions": {}
1008
781
  };
1009
782
  }
1010
783
  static get events() {
@@ -1019,8 +792,8 @@ export class Q2Select {
1019
792
  "text": ""
1020
793
  },
1021
794
  "complexType": {
1022
- "original": "any",
1023
- "resolved": "any",
795
+ "original": "{ value: string; selectedOptions: string[] }",
796
+ "resolved": "{ value: string; selectedOptions: string[]; }",
1024
797
  "references": {}
1025
798
  }
1026
799
  }, {
@@ -1043,20 +816,23 @@ export class Q2Select {
1043
816
  static get elementRef() { return "hostElement"; }
1044
817
  static get watchers() {
1045
818
  return [{
819
+ "propName": "value",
820
+ "methodName": "buildStructuredSelectedOptions"
821
+ }, {
822
+ "propName": "selectedOptions",
823
+ "methodName": "buildStructuredSelectedOptions"
824
+ }, {
1046
825
  "propName": "ariaLabel",
1047
826
  "methodName": "ariaLabelObserver"
1048
827
  }, {
1049
828
  "propName": "value",
1050
829
  "methodName": "valueUpdated"
1051
- }, {
1052
- "propName": "selectedOptions",
1053
- "methodName": "selectedOptionsUpdated"
1054
830
  }, {
1055
831
  "propName": "multilineOptions",
1056
- "methodName": "multilineOptionsChanged"
832
+ "methodName": "handleMultilineOptionsUpdate"
1057
833
  }, {
1058
- "propName": "dropdownOpen",
1059
- "methodName": "dropdownOpenChanged"
834
+ "propName": "open",
835
+ "methodName": "openChanged"
1060
836
  }];
1061
837
  }
1062
838
  static get listeners() {
@@ -1090,12 +866,6 @@ export class Q2Select {
1090
866
  "target": undefined,
1091
867
  "capture": false,
1092
868
  "passive": false
1093
- }, {
1094
- "name": "click",
1095
- "method": "clickHandler",
1096
- "target": undefined,
1097
- "capture": false,
1098
- "passive": false
1099
869
  }];
1100
870
  }
1101
871
  }