q2-tecton-elements 1.11.4 → 1.12.1

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 (126) hide show
  1. package/dist/cjs/{index-f5807a6a.js → index-773c3eec.js} +13 -11
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/q2-btn_2.cjs.entry.js +2 -2
  4. package/dist/cjs/q2-calendar.cjs.entry.js +12 -2
  5. package/dist/cjs/q2-card.cjs.entry.js +1 -1
  6. package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
  7. package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
  8. package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-checkbox.cjs.entry.js +4 -3
  10. package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
  11. package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
  12. package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
  13. package/dist/cjs/q2-icon.cjs.entry.js +1 -1
  14. package/dist/cjs/q2-input.cjs.entry.js +4 -4
  15. package/dist/cjs/q2-loc.cjs.entry.js +1 -1
  16. package/dist/cjs/q2-message.cjs.entry.js +1 -1
  17. package/dist/cjs/q2-optgroup.cjs.entry.js +1 -1
  18. package/dist/cjs/q2-option-list.cjs.entry.js +357 -0
  19. package/dist/cjs/q2-option.cjs.entry.js +2 -10
  20. package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
  21. package/dist/cjs/q2-pill.cjs.entry.js +137 -0
  22. package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
  23. package/dist/cjs/q2-radio.cjs.entry.js +1 -1
  24. package/dist/cjs/q2-section.cjs.entry.js +1 -1
  25. package/dist/cjs/q2-select.cjs.entry.js +15 -6
  26. package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
  27. package/dist/cjs/q2-stepper.cjs.entry.js +2 -2
  28. package/dist/cjs/q2-tab-container.cjs.entry.js +5 -1
  29. package/dist/cjs/q2-tag.cjs.entry.js +94 -0
  30. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  31. package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
  32. package/dist/collection/collection-manifest.json +3 -0
  33. package/dist/collection/components/q2-btn/styles.css +1 -1
  34. package/dist/collection/components/q2-calendar/helpers.js +6 -0
  35. package/dist/collection/components/q2-calendar/index.js +6 -2
  36. package/dist/collection/components/q2-checkbox/index.js +3 -2
  37. package/dist/collection/components/q2-input/index.js +4 -3
  38. package/dist/collection/components/q2-input/styles.css +9 -2
  39. package/dist/collection/components/q2-option/index.js +19 -25
  40. package/dist/collection/components/q2-option/styles.css +5 -0
  41. package/dist/collection/components/q2-option-list/index.js +646 -0
  42. package/dist/collection/components/q2-option-list/styles.css +128 -0
  43. package/dist/collection/components/q2-pill/index.js +324 -0
  44. package/dist/collection/components/q2-pill/styles.css +227 -0
  45. package/dist/collection/components/q2-select/index.js +14 -5
  46. package/dist/collection/components/q2-stepper/styles.css +1 -1
  47. package/dist/collection/components/q2-tab-container/index.js +4 -0
  48. package/dist/collection/components/q2-tag/index.js +200 -0
  49. package/dist/collection/components/q2-tag/styles.css +141 -0
  50. package/dist/collection/utils/index.js +13 -11
  51. package/dist/esm/{index-0e13a57f.js → index-fa32f694.js} +13 -11
  52. package/dist/esm/loader.js +1 -1
  53. package/dist/esm/q2-btn_2.entry.js +2 -2
  54. package/dist/esm/q2-calendar.entry.js +12 -2
  55. package/dist/esm/q2-card.entry.js +1 -1
  56. package/dist/esm/q2-carousel-pane.entry.js +1 -1
  57. package/dist/esm/q2-carousel.entry.js +1 -1
  58. package/dist/esm/q2-checkbox-group.entry.js +1 -1
  59. package/dist/esm/q2-checkbox.entry.js +4 -3
  60. package/dist/esm/q2-dropdown-item.entry.js +1 -1
  61. package/dist/esm/q2-dropdown.entry.js +1 -1
  62. package/dist/esm/q2-editable-field.entry.js +1 -1
  63. package/dist/esm/q2-icon.entry.js +1 -1
  64. package/dist/esm/q2-input.entry.js +4 -4
  65. package/dist/esm/q2-loc.entry.js +1 -1
  66. package/dist/esm/q2-message.entry.js +1 -1
  67. package/dist/esm/q2-optgroup.entry.js +1 -1
  68. package/dist/esm/q2-option-list.entry.js +353 -0
  69. package/dist/esm/q2-option.entry.js +3 -11
  70. package/dist/esm/q2-pagination.entry.js +1 -1
  71. package/dist/esm/q2-pill.entry.js +133 -0
  72. package/dist/esm/q2-radio-group.entry.js +1 -1
  73. package/dist/esm/q2-radio.entry.js +1 -1
  74. package/dist/esm/q2-section.entry.js +1 -1
  75. package/dist/esm/q2-select.entry.js +15 -6
  76. package/dist/esm/q2-stepper-pane.entry.js +1 -1
  77. package/dist/esm/q2-stepper.entry.js +2 -2
  78. package/dist/esm/q2-tab-container.entry.js +5 -1
  79. package/dist/esm/q2-tag.entry.js +90 -0
  80. package/dist/esm/q2-tecton-elements.js +1 -1
  81. package/dist/esm/q2-textarea.entry.js +1 -1
  82. package/dist/q2-tecton-elements/{p-ca847db7.entry.js → p-08668234.entry.js} +1 -1
  83. package/dist/q2-tecton-elements/{p-2be33492.entry.js → p-0a7cff38.entry.js} +1 -1
  84. package/dist/q2-tecton-elements/p-167a19fd.entry.js +1 -0
  85. package/dist/q2-tecton-elements/{p-a72e7a12.entry.js → p-2afdc922.entry.js} +1 -1
  86. package/dist/q2-tecton-elements/{p-fe61c1aa.entry.js → p-30bf5f44.entry.js} +1 -1
  87. package/dist/q2-tecton-elements/{p-f85bf7fb.entry.js → p-34415315.entry.js} +1 -1
  88. package/dist/q2-tecton-elements/{p-3479847c.entry.js → p-54300d2f.entry.js} +1 -1
  89. package/dist/q2-tecton-elements/p-54f0d64e.entry.js +1 -0
  90. package/dist/q2-tecton-elements/p-5b906cf1.entry.js +1 -0
  91. package/dist/q2-tecton-elements/p-5effd81a.entry.js +1 -0
  92. package/dist/q2-tecton-elements/{p-27ec0a16.entry.js → p-7ce98c1a.entry.js} +1 -1
  93. package/dist/q2-tecton-elements/{p-346b65d5.entry.js → p-91dba21f.entry.js} +1 -1
  94. package/dist/q2-tecton-elements/{p-2372f988.entry.js → p-9a3c37ab.entry.js} +1 -1
  95. package/dist/q2-tecton-elements/{p-c83dba0a.entry.js → p-a0248299.entry.js} +1 -1
  96. package/dist/q2-tecton-elements/{p-f435dc7e.entry.js → p-aca8302b.entry.js} +1 -1
  97. package/dist/q2-tecton-elements/{p-bfd77f9b.entry.js → p-b9c2c1d3.entry.js} +1 -1
  98. package/dist/q2-tecton-elements/{p-f85da2a8.js → p-c3d68d5c.js} +1 -1
  99. package/dist/q2-tecton-elements/{p-841ec108.entry.js → p-c460e5ed.entry.js} +1 -1
  100. package/dist/q2-tecton-elements/{p-88bc2f49.entry.js → p-c5199147.entry.js} +1 -1
  101. package/dist/q2-tecton-elements/{p-492dfb55.entry.js → p-c5e6f7fa.entry.js} +1 -1
  102. package/dist/q2-tecton-elements/{p-9ccbc3d8.entry.js → p-d3058002.entry.js} +1 -1
  103. package/dist/q2-tecton-elements/{p-fc318ae2.entry.js → p-d65aaed2.entry.js} +1 -1
  104. package/dist/q2-tecton-elements/{p-701b381a.entry.js → p-d9bc6494.entry.js} +1 -1
  105. package/dist/q2-tecton-elements/p-df86f160.entry.js +1 -0
  106. package/dist/q2-tecton-elements/{p-f73df612.entry.js → p-e38080d2.entry.js} +1 -1
  107. package/dist/q2-tecton-elements/p-e9d69ba8.entry.js +1 -0
  108. package/dist/q2-tecton-elements/{p-d199fca8.entry.js → p-f98dc161.entry.js} +1 -1
  109. package/dist/q2-tecton-elements/{p-6a83a97c.entry.js → p-fa9e3825.entry.js} +1 -1
  110. package/dist/q2-tecton-elements/{p-b5b12e46.entry.js → p-fe6407a4.entry.js} +1 -1
  111. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  112. package/dist/test/elements/q2-tag-test.js +151 -0
  113. package/dist/test/helpers.js +7 -0
  114. package/dist/types/components/q2-calendar/helpers.d.ts +1 -0
  115. package/dist/types/components/q2-checkbox/index.d.ts +1 -1
  116. package/dist/types/components/q2-option/index.d.ts +2 -3
  117. package/dist/types/components/q2-option-list/index.d.ts +62 -0
  118. package/dist/types/components/q2-pill/index.d.ts +39 -0
  119. package/dist/types/components/q2-tag/index.d.ts +28 -0
  120. package/dist/types/components.d.ts +95 -1
  121. package/dist/types/workspace/workspace/tecton-production_release_1.12.x/packages/q2-tecton-elements/.stencil/test/elements/q2-tag-test.d.ts +1 -0
  122. package/dist/types/workspace/workspace/{tecton-production_release_1.11.x → tecton-production_release_1.12.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +1 -0
  123. package/package.json +2 -2
  124. package/dist/q2-tecton-elements/p-564154f3.entry.js +0 -1
  125. package/dist/q2-tecton-elements/p-6702eb4d.entry.js +0 -1
  126. package/dist/q2-tecton-elements/p-dffbcec3.entry.js +0 -1
@@ -0,0 +1,353 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-be8376c0.js';
2
+ import { o as overrideFocus, i as isEventFromElement } from './index-fa32f694.js';
3
+
4
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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}.content{margin-top:var(--tct-option-list-margin, var(--t-option-list-margin, var(--app-scale-1x, 5px)));position:absolute;height:0;opacity:0;visibility:hidden;background-color:var(--app-white);color:var(--t-font-color);z-index:100;width:max-content;min-width:var(--tct-option-list-min-width, var(--t-option-list-min-width, 135px));box-shadow:var(--app-shadow-1);overflow:hidden;text-align:start;transition:opacity var(--app-tween-1);border-radius:var(--tct-option-list-border-radius, var(--t-option-list-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}.content::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.content::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.content::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}:host(:not([align=right])) .content{left:0}:host([align=right]) .content{right:0}:host([open]) .content{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}:host([is-sizeable]) .content{display:block;height:auto}:host([alignment=right]) .content{left:unset;right:0}";
5
+
6
+ const Q2OptionList = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.change = createEvent(this, "change", 7);
10
+ this.optionListState = createEvent(this, "optionListState", 7);
11
+ this.role = 'listbox';
12
+ this.direction = 'down';
13
+ this.selectedOptions = [];
14
+ this.scheduledAfterRender = [];
15
+ /// Event Handlers ///
16
+ this.keydownHandler = (event, ignoreSelectionEvents) => {
17
+ event.stopPropagation();
18
+ const { activeIndex, customSearch, allOptions } = this;
19
+ const { key, shiftKey } = event;
20
+ let newOption;
21
+ switch (key) {
22
+ case ' ':
23
+ case 'Enter':
24
+ if (ignoreSelectionEvents) {
25
+ this.setDefaultActiveElement();
26
+ break;
27
+ }
28
+ event.preventDefault();
29
+ newOption = allOptions.find(element => element.active);
30
+ if (!newOption || newOption.disabled)
31
+ break;
32
+ this.selectOption(newOption.value);
33
+ break;
34
+ case 'ArrowUp':
35
+ event.preventDefault();
36
+ const isFirstOption = activeIndex === 0;
37
+ if (isFirstOption)
38
+ break;
39
+ if (activeIndex === undefined) {
40
+ this.setDefaultActiveElement();
41
+ }
42
+ else {
43
+ const nextIndex = this.getNextVisibleIndex(-1);
44
+ if (nextIndex === -1)
45
+ break;
46
+ this.adjustActiveOptionAndScroll(nextIndex - activeIndex);
47
+ }
48
+ break;
49
+ case 'ArrowDown':
50
+ event.preventDefault();
51
+ const isLastOption = activeIndex === allOptions.length - 1;
52
+ if (isLastOption)
53
+ break;
54
+ if (activeIndex === undefined) {
55
+ this.setDefaultActiveElement();
56
+ }
57
+ else {
58
+ const nextIndex = this.getNextVisibleIndex(1);
59
+ if (nextIndex === -1)
60
+ break;
61
+ this.adjustActiveOptionAndScroll(nextIndex - activeIndex);
62
+ }
63
+ break;
64
+ case 'Home':
65
+ event.preventDefault();
66
+ this.openDropdownWithActiveElement(0);
67
+ break;
68
+ case 'End':
69
+ event.preventDefault();
70
+ this.openDropdownWithActiveElement(allOptions.length - 1);
71
+ break;
72
+ case 'PageUp':
73
+ event.preventDefault();
74
+ this.openDropdownWithActiveElement(Math.max(activeIndex - 10, 0));
75
+ break;
76
+ case 'PageDown':
77
+ event.preventDefault();
78
+ this.openDropdownWithActiveElement(Math.min(activeIndex + 10, allOptions.length - 1));
79
+ break;
80
+ case 'Tab':
81
+ if (ignoreSelectionEvents)
82
+ break;
83
+ if (shiftKey)
84
+ break;
85
+ newOption = allOptions.find(element => element.active);
86
+ if (!newOption || newOption.disabled)
87
+ return;
88
+ this.selectOption(newOption.value);
89
+ break;
90
+ case 'Esc':
91
+ case 'Escape':
92
+ if (this.noSelect)
93
+ this.setActiveElement(null);
94
+ this.open = false;
95
+ break;
96
+ default:
97
+ if (customSearch)
98
+ break;
99
+ if (!key.match(/^[A-Za-z0-9]$/))
100
+ break;
101
+ // search in non-searchable select: alpha-numeric only
102
+ this.searchAndFocus(key);
103
+ break;
104
+ }
105
+ };
106
+ this.focusoutHandler = (event) => {
107
+ const { relatedTarget } = event;
108
+ const isInDropdown = this.allOptions.includes(relatedTarget);
109
+ const isInLightDom = !isInDropdown && this.hostElement.contains(relatedTarget);
110
+ if (isInDropdown || isInLightDom) {
111
+ event.stopPropagation();
112
+ }
113
+ };
114
+ this.clickHandler = (event) => {
115
+ const target = event.target;
116
+ if (target.localName !== 'q2-option' || target.disabled) {
117
+ return;
118
+ }
119
+ this.selectOption(target.value);
120
+ };
121
+ }
122
+ /// LifeCycle Hooks ///
123
+ componentWillLoad() {
124
+ this.hasOptions = !!this.hostElement.querySelectorAll('q2-option').length;
125
+ }
126
+ componentDidLoad() {
127
+ overrideFocus(this.hostElement);
128
+ this.checkOptions();
129
+ }
130
+ componentDidRender() {
131
+ this.scheduledAfterRender.forEach(fn => fn());
132
+ this.scheduledAfterRender = [];
133
+ }
134
+ /// Getters ///
135
+ get allOptions() {
136
+ return this.getRootSlot(this.hostElement);
137
+ }
138
+ /// Helpers ///
139
+ checkOptions() {
140
+ const { noSelect, type, allOptions } = this;
141
+ if (!noSelect && !type)
142
+ return;
143
+ const optionRole = type === 'menu' ? 'menuitem' : 'option';
144
+ allOptions.forEach(option => {
145
+ if (noSelect)
146
+ option.noSelect = true;
147
+ if (type)
148
+ option.role = optionRole;
149
+ });
150
+ }
151
+ getRootSlot(element) {
152
+ var _a;
153
+ const slot = element.querySelector('slot');
154
+ const assignedElements = (_a = slot === null || slot === void 0 ? void 0 : slot.assignedElements()) !== null && _a !== void 0 ? _a : Array.from(element.children);
155
+ const hasAnotherSlot = !!assignedElements.length && assignedElements[0].tagName === 'SLOT';
156
+ if (hasAnotherSlot) {
157
+ return this.getRootSlot(assignedElements[0]);
158
+ }
159
+ else {
160
+ return assignedElements;
161
+ }
162
+ }
163
+ scrollToActiveOption() {
164
+ const activeOption = this.allOptions[this.activeIndex];
165
+ activeOption === null || activeOption === void 0 ? void 0 : activeOption.scrollIntoView({ block: 'nearest' });
166
+ }
167
+ resizeIframe() {
168
+ var _a, _b;
169
+ return (_b = (_a = window.TectonElements) === null || _a === void 0 ? void 0 : _a.resizeIframe) === null || _b === void 0 ? void 0 : _b.call(_a);
170
+ }
171
+ openDropdownWithActiveElement(activeIndex) {
172
+ if (this.disabled)
173
+ return;
174
+ this.activeIndex = activeIndex;
175
+ this.open = true;
176
+ this.setActiveOption();
177
+ this.setFocusedOption();
178
+ this.scheduledAfterRender.push(() => {
179
+ this.scrollToActiveOption();
180
+ this.resizeIframe();
181
+ });
182
+ }
183
+ getDefaultActiveIndex() {
184
+ const { allOptions } = this;
185
+ const firstSelected = allOptions.findIndex(element => element.selected);
186
+ if (firstSelected > -1)
187
+ return firstSelected;
188
+ const firstEnabled = allOptions.findIndex(element => !element.hidden);
189
+ if (firstEnabled > -1)
190
+ return firstEnabled;
191
+ return 0;
192
+ }
193
+ updateSingleOptionAttrs() {
194
+ var _a, _b;
195
+ const { allOptions, selectedOptions } = this;
196
+ const singleValue = (_b = (_a = selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : undefined;
197
+ allOptions.forEach(element => {
198
+ element.selected = element.value === singleValue;
199
+ });
200
+ }
201
+ updateMultipleOptionAttrs() {
202
+ const { allOptions, selectedOptions } = this;
203
+ const selectedValues = selectedOptions.map(option => option.value);
204
+ allOptions.forEach(element => {
205
+ element.selected = selectedValues.includes(element.value);
206
+ });
207
+ }
208
+ setActiveOption() {
209
+ if (!this.open)
210
+ return;
211
+ const activeIndex = this.activeIndex;
212
+ this.allOptions.forEach((element, elementIndex) => {
213
+ element.active = activeIndex === elementIndex;
214
+ });
215
+ }
216
+ setFocusedOption() {
217
+ const option = this.allOptions[this.activeIndex];
218
+ if (!option)
219
+ return;
220
+ setTimeout(() => {
221
+ option.focus();
222
+ }, 25);
223
+ }
224
+ getNextVisibleIndex(direction) {
225
+ let index = this.activeIndex + direction;
226
+ while (index >= 0 && index <= this.allOptions.length - 1) {
227
+ const { display, visibility } = window.getComputedStyle(this.allOptions[index]);
228
+ if (display !== 'none' && visibility !== 'hidden') {
229
+ return index;
230
+ }
231
+ index = index + direction;
232
+ }
233
+ return -1;
234
+ }
235
+ selectOption(selectedValue) {
236
+ const option = this.allOptions.find(({ value }) => value === selectedValue);
237
+ const valueObject = {
238
+ value: selectedValue,
239
+ display: option.display || option.innerText.trim()
240
+ };
241
+ const { multiple, noSelect } = this;
242
+ let values;
243
+ if (multiple) {
244
+ const { selectedOptions = [] } = this;
245
+ const isAlreadySelected = !!selectedOptions.find(({ value }) => value === selectedValue);
246
+ if (isAlreadySelected) {
247
+ values = selectedOptions.filter(({ value }) => value !== selectedValue);
248
+ }
249
+ else {
250
+ values = [...selectedOptions, valueObject];
251
+ }
252
+ }
253
+ else {
254
+ values = [valueObject];
255
+ }
256
+ if (noSelect)
257
+ this.setActiveElement(null);
258
+ else
259
+ this.selectedOptions = values;
260
+ this.change.emit({ value: selectedValue, values });
261
+ if (multiple)
262
+ return;
263
+ this.open = false;
264
+ }
265
+ adjustActiveOptionAndScroll(numToAdd) {
266
+ this.activeIndex += numToAdd;
267
+ this.setActiveOption();
268
+ this.setFocusedOption();
269
+ this.scrollToActiveOption();
270
+ }
271
+ resetTimer() {
272
+ if (this.searchStringTimer) {
273
+ clearTimeout(this.searchStringTimer);
274
+ }
275
+ this.searchStringTimer = window.setTimeout(() => {
276
+ this.searchString = null;
277
+ }, 2000);
278
+ }
279
+ searchAndFocus(key) {
280
+ this.resetTimer();
281
+ let searchString = this.searchString ? `${this.searchString}${key}` : key;
282
+ searchString = searchString.replace(/[^0-9a-z]/gi, '');
283
+ this.searchString = searchString;
284
+ const searchRegEx = new RegExp(searchString, 'i');
285
+ const foundIndex = this.allOptions.findIndex(option => option.value === searchString || option.textContent.match(searchRegEx));
286
+ if (foundIndex === -1)
287
+ return;
288
+ this.setActiveElement(foundIndex);
289
+ }
290
+ /// Watchers ///
291
+ selectedOptionsUpdated() {
292
+ if (this.multiple) {
293
+ this.updateMultipleOptionAttrs();
294
+ }
295
+ else {
296
+ this.updateSingleOptionAttrs();
297
+ }
298
+ }
299
+ openChanged(newValue) {
300
+ this.optionListState.emit({ open: newValue });
301
+ }
302
+ /// Listeners ///
303
+ delegateFocus(event) {
304
+ if (!isEventFromElement(event, this.hostElement))
305
+ return;
306
+ this.open = true;
307
+ this.setDefaultActiveElement();
308
+ }
309
+ handleClick(event) {
310
+ event.stopPropagation();
311
+ }
312
+ /// Public Methods ///
313
+ toggle() {
314
+ const isOpen = !this.open;
315
+ this.open = isOpen;
316
+ }
317
+ setDefaultActiveElement() {
318
+ this.activeIndex = this.getDefaultActiveIndex();
319
+ this.setActiveOption();
320
+ this.setFocusedOption();
321
+ }
322
+ setActiveElement(index) {
323
+ this.activeIndex = index;
324
+ this.setActiveOption();
325
+ this.setFocusedOption();
326
+ }
327
+ handleExternalKeydown(event) {
328
+ const keysThatTriggerOpen = ['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp', 'Home', 'End'];
329
+ if (keysThatTriggerOpen.includes(event.key)) {
330
+ this.open = true;
331
+ }
332
+ const keysThatTriggerDefault = ['ArrowDown', 'ArrowUp'];
333
+ if (keysThatTriggerDefault.includes(event.key)) {
334
+ event.preventDefault();
335
+ this.setDefaultActiveElement();
336
+ }
337
+ else {
338
+ this.keydownHandler(event, true);
339
+ }
340
+ }
341
+ /// DOM ///
342
+ render() {
343
+ return (h(Host, null, h("div", { class: "content", ref: el => (this.contentElement = el), onFocusout: this.focusoutHandler }, h("div", { class: "options", role: this.type || 'listbox', onKeyDown: this.keydownHandler, onClick: this.clickHandler }, h("slot", null)))));
344
+ }
345
+ get hostElement() { return getElement(this); }
346
+ static get watchers() { return {
347
+ "selectedOptions": ["selectedOptionsUpdated"],
348
+ "open": ["openChanged"]
349
+ }; }
350
+ };
351
+ Q2OptionList.style = stylesCss;
352
+
353
+ export { Q2OptionList as q2_option_list };
@@ -1,26 +1,18 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-be8376c0.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement } from './index-be8376c0.js';
2
2
 
3
- const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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{padding:0 var(--tct-scale-2, var(--app-scale-2, 10px));min-height:44px;align-items:center;cursor:pointer;grid-template-columns:var(--tct-option-selected-icon-size, var(--tct-scale-3, var(--app-scale-3, 15px))) 1fr;align-items:center;grid-template-areas:\"icon content\";gap:var(--tct-scale-1, var(--app-scale-1, 5px))}:host([aria-disabled]){cursor:not-allowed;opacity:var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4));pointer-events:none}:host([aria-hidden]){display:none}:host(:not([hidden]):not([aria-hidden])){display:grid}:host(:not([aria-disabled]):hover),:host([active]),:host(:focus){background-color:var(--tct-option-active-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2)))))}q2-icon{grid-area:icon;--tct-icon-size:var(--tct-option-selected-icon-size, var(--tct-scale-3, var(--app-scale-3, 15px)))}.content{display:block;grid-area:content}:host(:not([multiline])) .content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}";
3
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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{padding:0 var(--tct-scale-2, var(--app-scale-2, 10px));min-height:44px;align-items:center;cursor:pointer;grid-template-columns:var(--tct-option-selected-icon-size, var(--tct-scale-3, var(--app-scale-3, 15px))) 1fr;align-items:center;grid-template-areas:\"icon content\";gap:var(--tct-scale-1, var(--app-scale-1, 5px))}:host([_no-select]){grid-template-columns:1fr;grid-template-areas:\"content\"}:host([aria-disabled]){cursor:not-allowed;opacity:var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4));pointer-events:none}:host([aria-hidden]){display:none}:host(:not([hidden]):not([aria-hidden])){display:grid}:host(:not([aria-disabled]):hover),:host([active]),:host(:focus){background-color:var(--tct-option-active-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2)))))}q2-icon{grid-area:icon;--tct-icon-size:var(--tct-option-selected-icon-size, var(--tct-scale-3, var(--app-scale-3, 15px)))}.content{display:block;grid-area:content}:host(:not([multiline])) .content{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}";
4
4
 
5
5
  const Q2Option = class {
6
6
  constructor(hostRef) {
7
7
  registerInstance(this, hostRef);
8
- this.click = createEvent(this, "click", 7);
9
8
  this.role = 'option';
10
9
  this.tabindex = '-1';
11
10
  this._multiSelectHidden = false;
12
- this.onClick = (event) => {
13
- event.stopImmediatePropagation();
14
- const { disabled, disabledGroup } = this;
15
- if (disabled || disabledGroup)
16
- return;
17
- this.click.emit();
18
- };
19
11
  }
20
12
  render() {
21
13
  const { disabled, disabledGroup, selected, _multiSelectHidden } = this;
22
14
  const isDisabled = disabled || disabledGroup;
23
- return (h(Host, { "aria-disabled": isDisabled ? 'true' : undefined, "aria-selected": selected ? 'true' : undefined, "aria-hidden": _multiSelectHidden ? 'true' : undefined }, this.selected && h("q2-icon", { type: "checkmark" }), h("div", { class: "content", onClick: this.onClick }, h("slot", null))));
15
+ return (h(Host, { "aria-disabled": isDisabled ? 'true' : undefined, "aria-selected": selected ? 'true' : undefined, "aria-hidden": _multiSelectHidden ? 'true' : undefined }, this.selected && h("q2-icon", { type: "checkmark" }), h("div", { class: "content" }, h("slot", null))));
24
16
  }
25
17
  get hostElement() { return getElement(this); }
26
18
  };
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-be8376c0.js';
2
- import { o as overrideFocus, i as isEventFromElement, l as loc, n as nextPaint } from './index-0e13a57f.js';
2
+ import { o as overrideFocus, i as isEventFromElement, l as loc, n as nextPaint } from './index-fa32f694.js';
3
3
 
4
4
  const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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{text-align:right;display:block}:host([hidden]){display:none}.container{display:inline-flex;column-gap:var(--tct-pagination-column-gap, var(--t-pagination-column-gap, var(--app-scale-2x, 10px)));align-items:center;height:var(--tct-pagination-height, var(--t-pagination-height, 44px))}.btn-group{display:flex;gap:var(--tct-pagination-btn-gap, var(--t-pagination-btn-gap, 0))}.description,.controls{white-space:nowrap}.controls{display:grid;grid-template-columns:auto 50px auto;align-items:center;gap:var(--tct-pagination-controls-gap, var(--t-pagination-controls-gap, var(--app-scale-1x, 5px)))}.controls[hidden]{display:none}.input-wrapper{height:var(--tct-pagination-height, var(--t-pagination-height, 44px));display:flex;align-items:center}q2-icon{--tct-icon-size:var(--tct-pagination-icon-size, var(--t-pagination-icon-size, 12px));color:var(--tct-pagination-icon-color, var(--t-pagination-icon-color, var(--t-text, #4d4d4d)))}q2-input{--tct-input-margin-top:0;--tct-input-margin-bottom:0;--tct-input-height:var(--tct-pagination-input-height, var(--t-pagination-input-height, 30px));--tct-input-min-height:var(--tct-input-height);--tct-input-align:center}";
5
5
 
@@ -0,0 +1,133 @@
1
+ import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-be8376c0.js';
2
+ import { o as overrideFocus, l as loc, i as isEventFromElement } from './index-fa32f694.js';
3
+
4
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:inline-block;position:relative}:host(:not(:last-child)){margin-inline-end:var(--tct-pill-margin, var(--t-pill-margin, var(--app-scale-2x, 10px)))}.btn-wrapper{--comp-pill-min-height:var(--tct-pill-min-height, var(--t-pill-min-height, 44px));--comp-pill-btn-border-width:var(--tct-pill-btn-border-width, var(--t-pill-btn-border-width, 2px));--comp-pill-btn-height:var(--tct-pill-btn-height, var(--t-pill-btn-height, 30px));--comp-close-size:0px;--comp-btn-background:var(--tct-pill-btn-background, var(--t-pill-btn-background, var(--t-base, #ffffff)));--compt-hover-btn-background:var(--tct-pill-hover-btn-background, var(--t-pill-hover-btn-background, var(--t-gray-13, #e6e6e6)));--comp-btn-padding:var(--tct-pill-btn-padding-inline, var(--t-pill-btn-padding-inline, var(--app-scale-3x, 15px)));--comp-btn-color:var(--tct-pill-btn-color, var(--t-pill-btn-color, var(--t-gray-3, #262626)));--comp-active-btn-background:var(--tct-pill-active-btn-background, var(--t-pill-active-btn-background, var(--t-gray-7, #666666)));--comp-active-btn-border-color:var(--tct-pill-active-btn-border-color, var(--t-pill-active-btn-border-color, var(--t-gray-7, #666666)));--comp-hover-active-btn-background:var(--tct-pill-active-btn-background, var(--t-pill-active-btn-background, var(--t-gray-6, #4d4d4d)));--comp-hover-active-btn-border-color:var(--tct-pill-active-btn-background, var(--t-pill-active-btn-background, var(--t-gray-6, #4d4d4d)));position:relative}:host(:not(:empty)) .btn-wrapper,.btn-wrapper.has-icon{--comp-close-size:var(--comp-pill-btn-height)}:host([active]) .btn-wrapper{--comp-btn-color:var(--tct-pill-active-btn-color, var(--t-pill-active-btn-color, var(--t-base, #ffffff)))}:host([theme=primary]) .btn-wrapper{--comp-active-btn-background:var(--t-primary-l5, #61c4ff);--comp-btn-color:var(--t-primary-text, #ffffff);--comp-active-btn-border-color:var(--t-primary-l5, #61c4ff);--comp-hover-active-btn-background:var(--t-primary-l3, #21acff);--comp-hover-active-btn-border-color:var(--t-primary-l3, #21acff)}:host([theme=secondary]) .btn-wrapper{--comp-active-btn-background:var(--t-secondary-l5, #61c4ff);--comp-btn-color:var(--t-secondary-text, #000000);--comp-active-btn-border-color:var(--t-secondary-l5, #61c4ff);--comp-hover-active-btn-background:var(--t-secondary-l3, #21acff);--comp-hover-active-btn-border-color:var(--t-secondary-l3, #21acff)}:host([theme=tertiary]) .btn-wrapper{--comp-active-btn-background:var(--t-tertiary-l5, #61c4ff);--comp-btn-color:var(--t-tertiary-text, #000000);--comp-active-btn-border-color:var(--t-tertiary-l5, #61c4ff);--comp-hover-active-btn-background:var(--t-tertiary-l3, #21acff);--comp-hover-active-btn-border-color:var(--t-tertiary-l3, #21acff)}q2-option-list{position:absolute;left:0}.btn-height-wrapper{height:var(--comp-pill-min-height);display:flex;align-items:center;cursor:pointer}.btn-height-wrapper:focus{box-shadow:none}:host([disabled]) .btn-height-wrapper{cursor:not-allowed}.btn-close,.btn-primary{cursor:pointer;height:var(--comp-pill-btn-height);border-style:solid;border-radius:var(--tct-pill-btn-border-radius, var(--t-pill-btn-border-radius, 30px));transition-property:background, color, padding, width, opacity;transition:var(--tct-pill-btn-tween, var(--t-pill-btn-tween, var(--app-tween-1, 0.2s ease)))}:host([disabled]) .btn-close,:host([disabled]) .btn-primary,:host([disabled]) q2-icon{opacity:var(--tct-pill-disabled-opacity, var(--t-pill-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))));cursor:not-allowed}.btn-primary{background:var(--comp-btn-background);border-width:var(--comp-pill-btn-border-width);border-color:var(--tct-pill-btn-border-color, var(--t-pill-btn-border-color, var(--t-gray-9, #999999)));padding-inline:var(--comp-btn-padding);padding-right:calc(var(--comp-btn-padding) + var(--comp-close-size));font-size:var(--tct-pill-btn-font-size, var(--t-pill-btn-font-size, var(--app-font-size, 14px)));color:var(--comp-btn-color);display:block;width:100%;text-align:start}.btn-primary:focus,.btn-primary:hover{background:var(--comp-hover-btn-background)}:host(:not(:empty)) .btn-primary,.has-icon .btn-primary{padding-right:calc( var(--tct-pill-icon-gap, var(--t-pill-icon-gap, var(--app-size-1x, 5px))) + var(--comp-close-size) )}.has-options .btn-primary{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:var(--tct-pill-max-width, var(--t-pill-max-width, 200px))}:host([active]) .btn-primary{background:var(--comp-active-btn-background);border-color:var(--comp-active-btn-border-color)}:host([active]) .btn-primary:focus,:host([active]) .btn-primary:hover{background:var(--comp-hover-active-btn-background);border-color:var(--comp-hover-active-btn-border-color)}.btn-close{background:transparent;border-color:transparent;border-width:var(--comp-pill-btn-border-width);width:var(--comp-close-size);height:var(--comp-close-size);padding:0;border:0;display:inline-flex;justify-content:center;align-items:center;position:absolute;right:0;top:50%;transform:translateY(-50%);opacity:0;stroke:var(--comp-btn-color);--tct-icon-stroke-primary:var(--comp-btn-color)}:host(:not(:empty)) .btn-close,.has-icon .btn-close{opacity:1}q2-icon{width:var(--tct-pill-icon-size, var(--t-pill-icon-size, 14px));height:var(--tct-pill-icon-size, var(--t-pill-icon-size, 14px));transition-property:transform;transition:var(--tct-pill-btn-tween, var(--t-pill-btn-tween, var(--app-tween-1, 0.2s ease)))}div.btn-close{pointer-events:none}:host([open]) div.btn-close q2-icon{transform:rotate(180deg)}:host([active]) button.btn-close:focus,:host([active]) button.btn-close:hover{background:var(--tct-pill-hover-close-btn-background, var(--t-pill-hover-close-btn-background, var(--t-top-a1, rgba(13, 13, 13, 0.35))));border-color:var(--tct-pill-hover-close-btn-border-color, var(--t-pill-hover-close-btn-border-color, var(--t-top-a1, rgba(13, 13, 13, 0.35))))}";
5
+
6
+ const Q2Pill = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.change = createEvent(this, "change", 7);
10
+ this.selectedOptions = [];
11
+ this.scheduledAfterRender = [];
12
+ /// Helpers
13
+ this.determineHasOptions = () => {
14
+ const hasOptions = !!this.hostElement.querySelectorAll('q2-option').length;
15
+ this.hasOptions = hasOptions;
16
+ };
17
+ this.clearSelectedOptions = () => {
18
+ this.selectedOptions = [];
19
+ this.active = false;
20
+ this.open = false;
21
+ this.primaryBtn.focus();
22
+ this.change.emit({ value: null, values: [], active: false });
23
+ };
24
+ /// Event Handlers ///
25
+ this.handleClick = (event) => {
26
+ event.stopPropagation();
27
+ if (this.disabled)
28
+ return;
29
+ if (this.hasOptions) {
30
+ this.optionList.toggle();
31
+ }
32
+ else {
33
+ const { value, label } = this;
34
+ const isActive = (this.active = !this.active);
35
+ const values = isActive ? [{ value, display: label }] : [];
36
+ this.selectedOptions = values;
37
+ this.change.emit({
38
+ value: value,
39
+ values,
40
+ active: isActive
41
+ });
42
+ }
43
+ };
44
+ this.handleKeydown = (event) => {
45
+ if (!this.hasOptions || this.disabled)
46
+ return;
47
+ this.optionList.handleExternalKeydown(event);
48
+ };
49
+ this.handleChange = event => {
50
+ if (!this.hasOptions)
51
+ return;
52
+ const { value, values } = event.detail;
53
+ const isActive = !!values.length;
54
+ if (!this.hostElement.onchange) {
55
+ this.selectedOptions = values;
56
+ this.active = isActive;
57
+ }
58
+ this.change.emit({ value: value, values, active: isActive });
59
+ };
60
+ this.handleFocusout = (event) => {
61
+ const relatedTarget = event.relatedTarget;
62
+ if (Array.from(this.hostElement.children).includes(relatedTarget))
63
+ return;
64
+ if (relatedTarget && !(event.relatedTarget instanceof HTMLElement))
65
+ return;
66
+ if (relatedTarget && relatedTarget.closest('.btn-height-wrapper'))
67
+ return;
68
+ this.optionList.open = false;
69
+ };
70
+ this.handleWrapperClick = () => {
71
+ this.primaryBtn.focus();
72
+ this.primaryBtn.click();
73
+ };
74
+ }
75
+ /// LifeCycle Hooks ///
76
+ componentWillLoad() {
77
+ const observer = new MutationObserver(this.determineHasOptions);
78
+ observer.observe(this.hostElement, { childList: true, attributes: true });
79
+ this.mutationObserver = observer;
80
+ }
81
+ componentDidLoad() {
82
+ overrideFocus(this.hostElement);
83
+ }
84
+ componentDidRender() {
85
+ this.scheduledAfterRender.forEach(fn => fn());
86
+ this.scheduledAfterRender = [];
87
+ }
88
+ disconnectedCallback() {
89
+ this.mutationObserver.disconnect();
90
+ this.mutationObserver = null;
91
+ }
92
+ /// Getters ///
93
+ get buttonContent() {
94
+ const { label, selectedOptions, hasOptions } = this;
95
+ if (!hasOptions || selectedOptions.length === 0)
96
+ return label;
97
+ else if (selectedOptions.length === 1)
98
+ return selectedOptions[0].display;
99
+ return loc('tecton.element.pill.activeCount', { count: selectedOptions.length });
100
+ }
101
+ /// Listeners ///
102
+ delegateFocus(event) {
103
+ if (!isEventFromElement(event, this.hostElement))
104
+ return;
105
+ this.primaryBtn.focus();
106
+ }
107
+ optionListStateEvent({ detail: { open } }) {
108
+ this.open = open;
109
+ if (!open)
110
+ this.primaryBtn.focus();
111
+ }
112
+ /// DOM ///
113
+ generateIcon() {
114
+ const { hasOptions, active } = this;
115
+ const isButton = hasOptions && active;
116
+ const TagName = isButton ? 'button' : 'div';
117
+ const iconName = isButton || !hasOptions ? 'close' : 'chevron-down';
118
+ return (h(TagName, { class: "btn-close", onClick: isButton && this.clearSelectedOptions, disabled: isButton && this.disabled, "aria-label": isButton && loc('tecton.element.pill.clearSelection'), type: isButton && 'button' }, h("q2-icon", { type: iconName })));
119
+ }
120
+ render() {
121
+ const { hasOptions, active, open } = this;
122
+ let wrapperClassNames = ['btn-wrapper'];
123
+ if (hasOptions || active)
124
+ wrapperClassNames.push('has-icon');
125
+ if (hasOptions)
126
+ wrapperClassNames.push('has-options');
127
+ return (h(Fragment, null, h("div", { class: wrapperClassNames.join(' ') }, h("div", { class: "btn-height-wrapper", onClick: this.handleWrapperClick, tabIndex: -1 }, h("button", { class: "btn-primary", type: "button", "test-id": "btn-control", ref: el => (this.primaryBtn = el), onClick: this.handleClick, onKeyDown: this.handleKeydown, disabled: this.disabled, onFocusout: this.handleFocusout, "aria-selected": !hasOptions && active ? 'true' : 'false', "aria-roledescription": !hasOptions && 'filter', "aria-controls": hasOptions && 'option-list', "aria-haspopup": hasOptions && 'true', "aria-expanded": hasOptions && open ? 'true' : 'false' }, this.buttonContent, !hasOptions && active && (h("span", { class: "sr" }, "(", loc('tecton.element.pill.active'), ")")))), this.generateIcon()), this.hasOptions && (h("q2-option-list", { id: "option-list", ref: el => (this.optionList = el), open: this.open, onChange: this.handleChange, multiple: this.multiple, onFocusout: this.handleFocusout, selectedOptions: this.selectedOptions }, h("slot", null)))));
128
+ }
129
+ get hostElement() { return getElement(this); }
130
+ };
131
+ Q2Pill.style = stylesCss;
132
+
133
+ export { Q2Pill as q2_pill };
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-be8376c0.js';
2
- import { c as createGuid, o as overrideFocus, i as isEventFromElement, l as loc } from './index-0e13a57f.js';
2
+ import { c as createGuid, o as overrideFocus, i as isEventFromElement, l as loc } from './index-fa32f694.js';
3
3
 
4
4
  const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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{margin-top:var(--tct-scale-2, var(--app-scale-2, 10px))}fieldset{padding:0;margin:0;border:0}fieldset.has-error{border-color:var(--tct-input-error-border-color, var(--const-stoplight-alert, #c30000));border-width:1px;border-style:solid;border-radius:var(--tct-border-radius-1, var(--app-border-radius-1, 2px));position:relative}fieldset.has-error .error-icon-container{top:8px;right:8px;position:absolute;width:40%;text-align:right;background:linear-gradient(to right, transparent, white)}fieldset.has-error legend+div.error-icon-container.no-label{top:28px}.group-legend{font-weight:600}legend.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;border:0}.optional-tag{margin-left:var(--tct-input-label-optional-margin-left, var(--t-input-label-optional-margin-left, var(--tct-scale-1, var(--app-scale-1, 5px))));color:var(--tct-input-label-optional-font-color, var(--t-input-label-optional-font-color, var(--t-textA, var(--t-a11y-gray-color, rgba(77, 77, 77, 0.77)))));font-size:var(--tct-input-label-optional-font-size, var(--t-input-label-optional-font-size, 12px));font-weight:var(--tct-input-label-optional-font-weight, var(--t-input-label-optional-font-weight, 400))}.flexed{margin:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:center}.flexed.left{justify-content:left}.flexed.right{justify-content:right}";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-be8376c0.js';
2
- import { c as createGuid, h as handleAriaLabel, o as overrideFocus, l as loc } from './index-0e13a57f.js';
2
+ import { c as createGuid, h as handleAriaLabel, o as overrideFocus, l as loc } from './index-fa32f694.js';
3
3
 
4
4
  const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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{margin-top:var(--tct-radio-margin-vertical, var(--tct-scale-2, 10px));margin-right:var(--tct-radio-margin-horizontal, var(--tct-scale-3, 15px));display:block}:host .radio-container{margin-bottom:var(--tct-radio-margin-vertical, var(--tct-scale-2, 10px))}:host .radio-container label[for]{font-weight:var(--tct-radio-font-weight, var(--tct-checkbox-font-weight, 400));align-items:center;cursor:pointer;margin-right:1rem;display:grid;grid-template-columns:18px 1fr;gap:var(--tct-scale-1, var(--app-scale-1, 5px))}:host .radio-container svg{border-radius:50%;transition:box-shadow var(--tct-tween-1, var(--app-tween-1, 0.2s ease));outline:0;width:100%}:host .radio-container circle:nth-child(1){stroke-width:2;stroke:var(--tct-radio-stroke-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)))))}:host .radio-container input:focus+label svg{box-shadow:var(--tct-global-focus, var(--const-global-focus, 0 0 0 2px #33b4ff))}:host .radio-container input:focus+label circle:nth-child(1){stroke:var(--tct-radio-focus-stroke-color, var(--tct-checkbox-check-stroke-color, var(--t-checkbox-fill, #2e2e2e)))}:host .radio-container input:checked+label circle:nth-child(1){background-color:var(--tct-radio-checked-bg, transparent);stroke:var(--tct-radio-checked-stroke-color, var(--tct-radio-stroke-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc))))))}:host .radio-container input:checked+label .label-content{font-weight:var(--tct-checkbox-selected-font-weight, 600);letter-spacing:var(--tct-checkbox-selected-letter-spacing, 0.25)}:host .radio-container input:checked+label circle:nth-child(2){fill:var(--tct-radio-checked-fill, var(--tct-checkbox-check-stroke-color, var(--t-checkbox-fill, #2e2e2e)))}:host .radio-tile{flex-basis:100px;flex-grow:0;flex-wrap:wrap}:host .radio-tile label[for]{align-items:center;border-radius:3px;border:2px solid var(--tct-radio-stroke-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)))));cursor:pointer;display:block;padding:1rem;position:relative;text-align:center;transition:border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease));white-space:nowrap}:host .radio-tile input:focus+label{border-color:#0079c1;box-shadow:var(--tct-global-focus, var(--const-global-focus, 0 0 0 2px #33b4ff))}:host .radio-tile input:checked+label{border-color:var(--tct-checkbox-check-stroke-color, var(--t-checkbox-fill, #2e2e2e));box-shadow:inset 0 0 0 2px #ffffff}:host .radio-tile input:checked+label:after{border-bottom-width:3px;border-bottom:5px solid #0079c1;border-left-width:5px;border-left:8px solid transparent;border-right-width:5px;border-right:8px solid transparent;bottom:0;content:\"\";height:0;left:50%;margin-left:-5px;position:absolute;width:0}:host input:disabled+label{cursor:not-allowed;opacity:var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))}";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-be8376c0.js';
2
- import { c as createGuid, o as overrideFocus, i as isEventFromElement, l as loc } from './index-0e13a57f.js';
2
+ import { c as createGuid, o as overrideFocus, i as isEventFromElement, l as loc } from './index-fa32f694.js';
3
3
 
4
4
  const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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}@keyframes expandVertical{0%{height:0}}@keyframes collapseVertical{100%{height:0}}:host{display:block;background-color:var(--tct-section-bg, var(--t-section-bg, var(--tct-white, var(--app-white, #ffffff))));color:var(--tct-section-font-color, var(--t-section-font-color, #2e2e2e));border-radius:var(--tct-section-border-radius, var(--t-section-border-radius, 3px));margin:var(--tct-scale-3, var(--app-scale-3, 15px))}@media screen and (max-width: 767px){:host{margin:var(--tct-scale-3, var(--app-scale-3, 15px)) 0}}.q2-section-wrapper{display:block;padding:var(--tct-scale-1, var(--app-scale-1, 5px)) 0}.q2-section-wrapper:hover{box-shadow:var(--tct-section-wrapper-hover-box-shadow, inherit)}.q2-section-header{padding:0 var(--tct-scale-3, var(--app-scale-3, 15px));display:flex}.has-header .q2-section-header{min-height:44px}.q2-section-header-content{flex:1 1 100%;min-width:0;align-self:center}.collapsible .q2-section-header-content{cursor:pointer}.title{margin:0;font-size:20px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px}.toggle-icon{transition:transform var(--tct-tween-1, var(--app-tween-1, 0.2s ease))}.collapsed .toggle-icon{transform:rotate(180deg)}.q2-section-content-wrapper{height:auto}.q2-section-content{padding:var(--tct-scale-2, var(--app-scale-2, 10px)) var(--tct-scale-3, var(--app-scale-3, 15px))}.q2-section-content:focus{box-shadow:none}.expanded.animate .q2-section-content-wrapper{animation:expandVertical var(--tct-tween-2, var(--app-tween-2, 0.4s ease)) forwards}.collapsed .q2-section-content-wrapper{height:0;animation:collapseVertical 0s forwards;animation-duration:0;padding-top:0;visibility:hidden;overflow:hidden}.collapsed.animate .q2-section-content-wrapper{animation:collapseVertical var(--tct-tween-1, var(--app-tween-1, 0.2s ease)) forwards}.animate .q2-section-content-wrapper{overflow:hidden}";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-be8376c0.js';
2
- import { c as createGuid, s as setPopProperties, l as loc, h as handleAriaLabel, o as overrideFocus, i as isEventFromElement } from './index-0e13a57f.js';
2
+ import { c as createGuid, s as setPopProperties, l as loc, h as handleAriaLabel, o as overrideFocus, i as isEventFromElement } from './index-fa32f694.js';
3
3
 
4
4
  const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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);color:var(--t-font-color);left:0;width:100%;z-index:100;margin-top:1px;box-shadow:var(--app-shadow-1);height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity var(--app-tween-1);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{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}.custom-display-content{position:absolute;bottom:0;left:calc(var-list(--tct-scale-2, --app-scale-2, 10px) + 1px);height:44px;width:calc(100% - 34px - var-list(--tct-scale-3, --app-scale-3, 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-list(--tct-scale-3, --app-scale-3, 15px) + 1px)}.has-error .custom-display-content{width:calc(100% - 68px - var-list(--tct-scale-3, --app-scale-3, 15px))}.dropdown-open .q2-select-dropdown{overflow-y:auto;max-height:300px}.multi-select-header{padding:var(--tct-scale-1, var(--app-scale-1, 5px)) var(--tct-scale-2, var(--app-scale-2, 10px))}.show-all-options{margin-right:var(--tct-scale-1, var(--app-scale-1, 5px));margin-left:var(--tct-scale-2, var(--app-scale-2, 10px))}.q2-element-dropdown.dropup{bottom:40px}";
5
5
 
@@ -18,6 +18,7 @@ const Q2Select = class {
18
18
  this.optional = false;
19
19
  this.dropdownOpen = false;
20
20
  this.onlyShowingSelected = false;
21
+ this.searchText = '';
21
22
  this.hasCustomDisplay = false;
22
23
  this.inputFocused = false;
23
24
  this.scheduledAfterRender = [];
@@ -238,10 +239,17 @@ const Q2Select = class {
238
239
  };
239
240
  this.inputInputHandler = (event) => {
240
241
  event.stopPropagation();
242
+ const inputValue = this.inputField.value;
243
+ const eventValue = event.detail.value;
244
+ const didChangeText = inputValue !== eventValue;
245
+ const shouldClearValue = !!this.value && didChangeText;
246
+ if (shouldClearValue) {
247
+ this.selectOption('');
248
+ }
241
249
  if (!this.dropdownOpen)
242
250
  this.openDropdownWithoutActiveElement();
243
- this.searchText = event.detail.value;
244
- this.input.emit({ query: event.detail.value });
251
+ this.searchText = eventValue;
252
+ this.input.emit({ query: eventValue });
245
253
  };
246
254
  this.inputFocusHandler = () => {
247
255
  this.inputFocused = true;
@@ -591,11 +599,12 @@ const Q2Select = class {
591
599
  }, 1000);
592
600
  }
593
601
  clickHandler(event) {
594
- const target = event.target;
595
- if (target.localName !== 'q2-option' || target.disabled) {
602
+ const selected = event.target.closest('q2-option');
603
+ if (!selected ||
604
+ (selected.hasAttribute('disabled') && selected.getAttribute('disabled') !== 'false')) {
596
605
  return;
597
606
  }
598
- this.selectOption(target.value, true);
607
+ this.selectOption(selected.getAttribute('value'), true);
599
608
  }
600
609
  keydownHandler(event) {
601
610
  this.inputKeydownHandler(event);
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-be8376c0.js';
2
- import { c as createGuid, l as loc } from './index-0e13a57f.js';
2
+ import { c as createGuid, l as loc } from './index-fa32f694.js';
3
3
 
4
4
  const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-global-focus)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size: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;position:relative}";
5
5