q2-tecton-elements 1.27.1 → 1.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/{action-sheet-4b366e9a.js → action-sheet-ab1abf24.js} +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/q2-option-list_2.cjs.entry.js +9 -7
  4. package/dist/cjs/q2-pill.cjs.entry.js +28 -23
  5. package/dist/cjs/q2-select.cjs.entry.js +6 -3
  6. package/dist/cjs/q2-tag.cjs.entry.js +18 -13
  7. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  8. package/dist/collection/components/q2-option-list/index.js +33 -27
  9. package/dist/collection/components/q2-pill/index.js +63 -23
  10. package/dist/collection/components/q2-popover/styles.css +2 -3
  11. package/dist/collection/components/q2-select/index.js +5 -2
  12. package/dist/collection/components/q2-tag/index.js +55 -14
  13. package/dist/collection/utils/action-sheet.js +1 -1
  14. package/dist/components/action-sheet.js +1 -1
  15. package/dist/components/index13.js +10 -8
  16. package/dist/components/index14.js +1 -1
  17. package/dist/components/q2-pill.js +30 -23
  18. package/dist/components/q2-select.js +5 -2
  19. package/dist/components/q2-tag.js +21 -14
  20. package/dist/docs.json +98 -20
  21. package/dist/esm/{action-sheet-a9597b32.js → action-sheet-bfcbe154.js} +1 -1
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/q2-option-list_2.entry.js +10 -8
  24. package/dist/esm/q2-pill.entry.js +28 -23
  25. package/dist/esm/q2-select.entry.js +6 -3
  26. package/dist/esm/q2-tag.entry.js +19 -14
  27. package/dist/esm/q2-tecton-elements.js +1 -1
  28. package/dist/q2-tecton-elements/p-788adb51.js +1 -0
  29. package/dist/q2-tecton-elements/p-8fd3b580.entry.js +1 -0
  30. package/dist/q2-tecton-elements/p-a300d517.entry.js +1 -0
  31. package/dist/q2-tecton-elements/p-ceabfa93.entry.js +1 -0
  32. package/dist/q2-tecton-elements/p-dd1115c6.entry.js +1 -0
  33. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  34. package/dist/types/components/q2-option-list/index.d.ts +5 -1
  35. package/dist/types/components/q2-pill/index.d.ts +5 -2
  36. package/dist/types/components/q2-select/index.d.ts +1 -1
  37. package/dist/types/components/q2-tag/index.d.ts +5 -2
  38. package/dist/types/components.d.ts +18 -2
  39. package/package.json +3 -3
  40. package/dist/q2-tecton-elements/p-04b9a7ee.entry.js +0 -1
  41. package/dist/q2-tecton-elements/p-521c9085.entry.js +0 -1
  42. package/dist/q2-tecton-elements/p-8e652d59.entry.js +0 -1
  43. package/dist/q2-tecton-elements/p-a1926e65.js +0 -1
  44. package/dist/q2-tecton-elements/p-aae8b9fc.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { o as overrideFocus, w as waitForNextPaint, n as nextPaint, a as isEventFromElement } from './index15.js';
2
+ import { n as nextPaint, l as loc, o as overrideFocus, w as waitForNextPaint, a as isEventFromElement } from './index15.js';
3
3
 
4
4
  const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{position:relative;width:100%;display:block;line-height:var(--tct-option-list-line-height, var(--t-option-list-line-height, var(--app-line-height, 1.428571429em)))}.content{text-align:start}:host([is-sizeable]) .content{display:block;height:auto}";
5
5
 
@@ -77,21 +77,23 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
77
77
  this.searchOptions(key, true);
78
78
  break;
79
79
  }
80
- else if (this.role === 'menu') {
80
+ else if (this.type === 'menu') {
81
81
  this.activeIndex = 0;
82
82
  this.openDropdownWithActiveElement(0);
83
83
  }
84
84
  else {
85
85
  this.setDefaultActiveElement();
86
+ nextPaint(() => this.popoverState.emit({ open: true, action: 'open' }));
86
87
  }
87
88
  break;
88
89
  case 'Enter':
89
- if (this.role === 'menu') {
90
+ if (this.type === 'menu') {
90
91
  this.activeIndex = 0;
91
92
  this.openDropdownWithActiveElement(0);
92
93
  }
93
94
  else {
94
95
  this.setDefaultActiveElement();
96
+ nextPaint(() => this.popoverState.emit({ open: true, action: 'open' }));
95
97
  }
96
98
  break;
97
99
  case 'ArrowUp':
@@ -221,7 +223,7 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
221
223
  case 'Tab':
222
224
  if (shiftKey)
223
225
  break;
224
- if (this.multiple && this.role === 'listbox')
226
+ if (this.multiple && this.type === 'listbox')
225
227
  break;
226
228
  newOption = allOptions.find(element => element.active);
227
229
  if (!newOption || newOption.disabled)
@@ -257,7 +259,6 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
257
259
  const option = target.closest('q2-option');
258
260
  this.selectOption(option);
259
261
  };
260
- this.role = 'listbox';
261
262
  this.customSearch = undefined;
262
263
  this.noSelect = undefined;
263
264
  this.align = undefined;
@@ -265,7 +266,8 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
265
266
  this.multiple = undefined;
266
267
  this.disabled = undefined;
267
268
  this.showSelected = undefined;
268
- this.type = undefined;
269
+ this.type = 'listbox';
270
+ this.label = loc('tecton.element.optionList.label');
269
271
  this.hasOptions = undefined;
270
272
  }
271
273
  /// LifeCycle Hooks ///
@@ -527,7 +529,7 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
527
529
  }
528
530
  /// DOM ///
529
531
  render() {
530
- 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.internalKeydownHandler, onClick: this.clickHandler }, h("slot", null)))));
532
+ return (h(Host, null, h("div", { class: "content", ref: el => (this.contentElement = el), onFocusout: this.focusoutHandler }, h("div", { class: "options", "aria-label": loc('tecton.element.optionList.label', [this.label]), role: this.type || 'listbox', onKeyDown: this.internalKeydownHandler, onClick: this.clickHandler }, h("slot", null)))));
531
533
  }
532
534
  get hostElement() { return this; }
533
535
  static get watchers() { return {
@@ -536,7 +538,6 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
536
538
  }; }
537
539
  static get style() { return stylesCss; }
538
540
  }, [1, "q2-option-list", {
539
- "role": [513],
540
541
  "customSearch": [516, "custom-search"],
541
542
  "noSelect": [516, "no-select"],
542
543
  "align": [513],
@@ -545,6 +546,7 @@ const Q2OptionList = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
545
546
  "disabled": [516],
546
547
  "showSelected": [1540, "show-selected"],
547
548
  "type": [1],
549
+ "label": [1],
548
550
  "hasOptions": [32],
549
551
  "setDefaultActiveElement": [64],
550
552
  "setActiveElement": [64],
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { r as resizeIframe, w as waitForNextPaint } from './index15.js';
3
3
 
4
- const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block;width:100%}:host([align=right]){display:block;position:absolute;right:0;text-align:end;left:unset}.container{display:none;overflow:hidden;opacity:0;height:0;position:absolute;top:var(--tct-popover-top, var(--t-popover-top, initial));visibility:hidden;background-color:var(--tct-popover-background-color, var(--t-popover-background-color, var(--app-white, #ffffff)));color:var(--tct-popover-text-color, var(--t-popover-text-color, var(--t-text, #4d4d4d)));z-index:var(--tct-popover-z-index, var(--t-popover-z-index, 100));width:max-content;min-width:var(--tct-popover-min-width, var(--t-popover-min-width, 135px));box-shadow:var(--tct-popover-box-shadow, var(--t-popover-box-shadow, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3))));text-align:start;left:0;transition:opacity var(--app-tween-1, 0.2s ease), max-height var(--app-tween-1, 0.2s ease);border-radius:var(--tct-popover-border-radius, var(--t-popover-border-radius, 0));max-height:var(--comp-pop-max-height);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.container::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.container::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.container::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}:host([block]) .container{left:unset;right:unset;width:100%;min-width:unset}:host([align=right]) .container{right:0;text-align:end;left:unset}.container :host([open]){display:block}:host([open]) .container.show{height:auto;overflow:auto;opacity:1;visibility:visible}.container.up{bottom:var(--comp-pop-offset)}click-elsewhere{position:relative;display:block}.content{height:auto}";
4
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block;width:100%}:host([align=right]){display:block;position:absolute;right:0;text-align:end;left:unset}.container{display:none;overflow:hidden;opacity:0;height:0;position:absolute;top:var(--tct-popover-top, var(--t-popover-top, initial));visibility:hidden;background-color:var(--tct-popover-background-color, var(--t-popover-background-color, var(--app-white, #ffffff)));color:var(--tct-popover-text-color, var(--t-popover-text-color, var(--t-text, #4d4d4d)));z-index:var(--tct-popover-z-index, var(--t-popover-z-index, 100));width:max-content;min-width:var(--tct-popover-min-width, var(--t-popover-min-width, 135px));box-shadow:var(--tct-popover-box-shadow, var(--t-popover-box-shadow, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3))));text-align:start;left:0;transition:opacity var(--app-tween-1, 0.2s ease), max-height var(--app-tween-1, 0.2s ease);border-radius:var(--tct-popover-border-radius, var(--t-popover-border-radius, 0));max-height:var(--comp-pop-max-height);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.container::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.container::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.container::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}:host([block]) .container{left:unset;right:unset;width:100%;min-width:unset}:host([align=right]) .container{right:0;text-align:end;left:unset}:host([open]) .container{visibility:visible}:host([open]) .container.show{height:auto;overflow:auto;opacity:1}.container.up{bottom:var(--comp-pop-offset)}click-elsewhere{position:relative;display:block}.content{height:auto}";
5
5
 
6
6
  const Q2Popover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
7
  constructor() {
@@ -35,16 +35,16 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
35
35
  };
36
36
  this.updateSelectedOptionElements = async () => {
37
37
  var _a;
38
- const { selectedOptions } = this;
38
+ const { selectedOptions = [] } = this;
39
39
  const selectedValues = selectedOptions.map(option => option.value);
40
40
  const options = await ((_a = this.optionList) === null || _a === void 0 ? void 0 : _a.getOptions());
41
- if (this.hasOptions)
41
+ if (this.optionCount)
42
42
  this.active = !!selectedValues.length;
43
43
  this.selectedOptionElements = (options === null || options === void 0 ? void 0 : options.filter(option => selectedValues.includes(option.value))) || [];
44
44
  };
45
- this.determineHasOptions = () => {
46
- const hasOptions = !!this.hostElement.querySelectorAll('q2-option').length;
47
- this.hasOptions = hasOptions;
45
+ this.determineOptionCount = () => {
46
+ const numberOfOptions = this.hostElement.querySelectorAll('q2-option').length;
47
+ this.optionCount = numberOfOptions;
48
48
  };
49
49
  this.clearSelectedOptions = () => {
50
50
  this.selectedOptions = [];
@@ -60,7 +60,7 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
60
60
  event.stopPropagation();
61
61
  if (this.disabled)
62
62
  return;
63
- if (this.hasOptions) {
63
+ if (this.optionCount) {
64
64
  if (shouldShowActionSheet(this)) {
65
65
  this.executeActionSheet(event);
66
66
  }
@@ -82,7 +82,7 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
82
82
  };
83
83
  this.handleKeydown = async (event) => {
84
84
  const isTabMetaOrCtrl = event.metaKey || event.ctrlKey || event.key === 'Tab';
85
- if (!this.hasOptions || this.disabled || isTabMetaOrCtrl)
85
+ if (!this.optionCount || this.disabled || isTabMetaOrCtrl)
86
86
  return;
87
87
  event.preventDefault();
88
88
  if (shouldShowActionSheet(this, event)) {
@@ -101,7 +101,7 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
101
101
  };
102
102
  this.handleChange = event => {
103
103
  event.stopPropagation();
104
- if (!this.hasOptions)
104
+ if (!this.optionCount)
105
105
  return;
106
106
  this.handleSelectionChanges(event.detail);
107
107
  };
@@ -131,12 +131,14 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
131
131
  this.selectedOptions = [];
132
132
  this.popoverMinHeight = 150;
133
133
  this.popoverDirection = undefined;
134
- this.hasOptions = undefined;
134
+ this.popoverAlignment = 'right';
135
+ this.optionListLabel = undefined;
136
+ this.optionCount = undefined;
135
137
  this.selectedOptionElements = [];
136
138
  }
137
139
  /// LifeCycle Hooks ///
138
140
  componentWillLoad() {
139
- const observer = new MutationObserver(this.determineHasOptions);
141
+ const observer = new MutationObserver(this.determineOptionCount);
140
142
  observer.observe(this.hostElement, { childList: true, attributes: true });
141
143
  this.mutationObserver = observer;
142
144
  }
@@ -154,8 +156,8 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
154
156
  }
155
157
  /// Getters ///
156
158
  get buttonContent() {
157
- const { label, selectedOptions, selectedOptionElements, hasOptions } = this;
158
- if (!hasOptions || selectedOptionElements.length === 0)
159
+ const { label, selectedOptions, selectedOptionElements, optionCount } = this;
160
+ if (!optionCount || selectedOptionElements.length === 0)
159
161
  return label;
160
162
  else if (selectedOptionElements.length === 1)
161
163
  return selectedOptionElements[0].display;
@@ -185,8 +187,8 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
185
187
  const selectedOption = await this.getOption(value);
186
188
  this.selectedOptions = selectedOption
187
189
  ? [{ value: selectedOption.value, display: selectedOption.display }]
188
- : undefined;
189
- this.value = selectedOption.value || undefined;
190
+ : [];
191
+ this.value = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) || undefined;
190
192
  }
191
193
  }
192
194
  this.change.emit({
@@ -207,7 +209,7 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
207
209
  else {
208
210
  const selectedOption = await this.getOption(newValue);
209
211
  const { value, display } = selectedOption || { value: newValue, display: null };
210
- this.selectedOptions = [{ value, display }];
212
+ this.selectedOptions = value ? [{ value, display }] : [];
211
213
  }
212
214
  }
213
215
  selectedOptionsChanged(newValue) {
@@ -241,20 +243,23 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
241
243
  }
242
244
  /// DOM ///
243
245
  generateIcon() {
244
- const { hasOptions, active } = this;
245
- const isButton = hasOptions && active;
246
+ const { optionCount, active } = this;
247
+ const isButton = optionCount && active;
246
248
  const TagName = isButton ? 'button' : 'div';
247
- const iconName = isButton || !hasOptions ? 'close' : 'chevron-down';
249
+ const iconName = isButton || !optionCount ? 'close' : 'chevron-down';
248
250
  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 })));
249
251
  }
252
+ generateHiddenElement() {
253
+ return (h("div", { id: "option-description", class: "sr", "aria-hidden": "true" }, loc('tecton.element.optionList.optionCount', [this.optionCount])));
254
+ }
250
255
  render() {
251
- const { hasOptions, active, open } = this;
256
+ const { optionCount, active, open } = this;
252
257
  const wrapperClassNames = ['btn-wrapper'];
253
- if (hasOptions || active)
258
+ if (optionCount || active)
254
259
  wrapperClassNames.push('has-icon');
255
- if (hasOptions)
260
+ if (optionCount)
256
261
  wrapperClassNames.push('has-options');
257
- return (h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' ') }, h("div", { class: "btn-height-wrapper", ref: el => (this.primaryBtnWrapper = el), onClick: this.handleWrapperClick, tabIndex: -1 }, h("button", { class: "btn-primary", "test-id": "btn-control", type: "button", ref: el => (this.primaryBtn = el), onClick: this.handleClick, onKeyDown: this.handleKeydown, onFocusout: this.handleButtonFocusout, disabled: this.disabled, "aria-selected": !hasOptions && active ? 'true' : 'false', "aria-roledescription": !hasOptions && 'filter', "aria-controls": hasOptions && 'option-list', "aria-haspopup": hasOptions && 'true', "aria-expanded": (hasOptions && `${!!open}`) || undefined, "aria-label": this.maxLength && this.buttonContent }, this.truncatedButtonContent, !hasOptions && active && h("span", { class: "sr" }, "(", loc('tecton.element.pill.active'), ")"))), this.generateIcon()), this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.primaryBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { role: "menu", ref: el => (this.optionList = el), id: "option-list", onChange: this.handleChange, multiple: this.multiple, selectedOptions: this.selectedOptions, onReady: () => this.updateSelectedOptionElements() }, h("slot", null))))));
262
+ return (h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' ') }, h("div", { class: "btn-height-wrapper", ref: el => (this.primaryBtnWrapper = el), onClick: this.handleWrapperClick, tabIndex: -1 }, h("button", { class: "btn-primary", "test-id": "btn-control", type: "button", role: "combobox", ref: el => (this.primaryBtn = el), onClick: this.handleClick, onKeyDown: this.handleKeydown, onFocusout: this.handleButtonFocusout, disabled: this.disabled, "aria-roledescription": !optionCount && 'filter', "aria-controls": optionCount && 'option-list', "aria-expanded": (optionCount && `${!!open}`) || undefined, "aria-label": this.maxLength && this.buttonContent, "aria-describedby": (optionCount && 'option-description') || undefined }, this.truncatedButtonContent, !optionCount && active && h("span", { class: "sr" }, "(", loc('tecton.element.pill.active'), ")"))), this.generateIcon(), this.generateHiddenElement()), this.optionCount && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.primaryBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { type: "listbox", ref: el => (this.optionList = el), id: "option-list", onChange: this.handleChange, multiple: this.multiple, selectedOptions: this.selectedOptions, onReady: () => this.updateSelectedOptionElements(), label: loc('tecton.element.optionList.label', [this.optionListLabel]) }, h("slot", null))))));
258
263
  }
259
264
  get hostElement() { return this; }
260
265
  static get watchers() { return {
@@ -275,7 +280,9 @@ const Q2Pill$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
275
280
  "selectedOptions": [1040],
276
281
  "popoverMinHeight": [2, "popover-min-height"],
277
282
  "popoverDirection": [1, "popover-direction"],
278
- "hasOptions": [32],
283
+ "popoverAlignment": [1025, "popover-alignment"],
284
+ "optionListLabel": [1, "option-list-label"],
285
+ "optionCount": [32],
279
286
  "selectedOptionElements": [32]
280
287
  }, [[0, "focus", "delegateFocus"], [0, "popoverStateChanged", "popoverStateHandler"]]]);
281
288
  function defineCustomElement$1() {
@@ -74,6 +74,9 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
74
74
  return;
75
75
  if (this.shouldClearSearchText(event))
76
76
  this.clearSearchText();
77
+ // Prevent click event from firing when spacebar is pressed
78
+ if (event.key === ' ')
79
+ event.preventDefault();
77
80
  this.optionList.handleExternalKeydown(event);
78
81
  };
79
82
  this.visibilityToggleKeyDown = (event) => {
@@ -473,10 +476,10 @@ const Q2Select$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
473
476
  this.errors.length > 0 &&
474
477
  this.errors.map(error => loc(error))) ||
475
478
  (this.invalid && ['tecton.element.select.invalid']) ||
476
- [], disabled: this.disabled, optional: this.optional, readonly: this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${this.open}`, ariaControls: "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()));
479
+ [], disabled: this.disabled, optional: this.optional, readonly: this.readonly, placeholder: this.placeholder || undefined, hideLabel: this.hideLabel, ariaExpanded: `${this.open}`, ariaControls: "option-list", ariaHaspopup: "listbox", role: "combobox", 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()));
477
480
  }
478
481
  optionsDropdown() {
479
- return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.innerInputField, open: this.open, minHeight: this.popoverMinHeight, direction: this.popDirection, onPopoverStateChanged: this.popoverStateChanged, block: true }, h("div", { class: "popover-content", tabindex: "-1" }, h("q2-option-list", { ref: el => (this.optionList = el), id: "option-list", "show-selected": this.showSelected, "aria-label": this.listLabel, multiple: this.multiple, selectedOptions: this.structuredSelectedOptions, onChange: this.onOptionListChange }, h("slot", null)), this.multiple && this.visibilityToggle())));
482
+ return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.innerInputField, open: this.open, minHeight: this.popoverMinHeight, direction: this.popDirection, onPopoverStateChanged: this.popoverStateChanged, block: true }, h("div", { class: "popover-content", tabindex: "-1" }, h("q2-option-list", { ref: el => (this.optionList = el), type: "listbox", id: "option-list", "show-selected": this.showSelected, "aria-label": this.listLabel, multiple: this.multiple, selectedOptions: this.structuredSelectedOptions, onChange: this.onOptionListChange }, h("slot", null)), this.multiple && this.visibilityToggle())));
480
483
  }
481
484
  visibilityToggle() {
482
485
  var _a, _b;
@@ -1,4 +1,4 @@
1
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
2
2
  import { o as overrideFocus, a as isEventFromElement, l as loc } from './index15.js';
3
3
  import { s as shouldShowActionSheet, a as showActionSheetList } from './action-sheet.js';
4
4
  import { d as defineCustomElement$5 } from './index2.js';
@@ -17,9 +17,9 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
17
17
  var _a;
18
18
  /// Getters ///
19
19
  /// Helpers
20
- this.determineHasOptions = () => {
21
- const hasOptions = !!this.hostElement.querySelectorAll('q2-option').length;
22
- this.hasOptions = hasOptions;
20
+ this.determineOptionCount = () => {
21
+ const numberOfOptions = this.hostElement.querySelectorAll('q2-option').length;
22
+ this.optionCount = numberOfOptions;
23
23
  };
24
24
  /// Event Handlers ///
25
25
  this.onClickElsewhere = (event) => {
@@ -34,7 +34,7 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
34
34
  };
35
35
  this.handleChange = event => {
36
36
  event.stopPropagation();
37
- if (!this.hasOptions)
37
+ if (!this.optionCount)
38
38
  return;
39
39
  const { value } = event.detail;
40
40
  this.click.emit({ value });
@@ -47,7 +47,7 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
47
47
  this.click.emit({ value });
48
48
  }
49
49
  else {
50
- this.popoverElement.toggle();
50
+ await this.popoverElement.toggle();
51
51
  }
52
52
  };
53
53
  this.handleKeydown = async (event) => {
@@ -81,11 +81,13 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
81
81
  this.theme = undefined;
82
82
  this.popoverMinHeight = 150;
83
83
  this.popoverDirection = undefined;
84
- this.hasOptions = undefined;
84
+ this.popoverAlignment = 'right';
85
+ this.optionListLabel = 'options';
86
+ this.optionCount = undefined;
85
87
  }
86
88
  /// LifeCycle Hooks ///
87
89
  componentWillLoad() {
88
- const observer = new MutationObserver(this.determineHasOptions);
90
+ const observer = new MutationObserver(this.determineOptionCount);
89
91
  observer.observe(this.hostElement, { childList: true, attributes: true });
90
92
  this.mutationObserver = observer;
91
93
  }
@@ -100,7 +102,7 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
100
102
  delegateFocus(event) {
101
103
  if (!isEventFromElement(event, this.hostElement))
102
104
  return;
103
- if (!this.hasOptions)
105
+ if (!this.optionCount)
104
106
  return;
105
107
  this.dropdownBtn.focus();
106
108
  }
@@ -112,12 +114,15 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
112
114
  this.optionList.setActiveElement(null);
113
115
  }
114
116
  /// DOM ///
117
+ generateHiddenElement() {
118
+ return (h("div", { id: "option-description", class: "sr", "aria-hidden": "true" }, loc('tecton.element.optionList.optionCount', [this.optionCount])));
119
+ }
115
120
  render() {
116
- const { hasOptions, open } = this;
117
- const wrapperClassNames = ['tag-wrapper'];
118
- if (hasOptions)
121
+ const { optionCount, open } = this;
122
+ const wrapperClassNames = ['tag'];
123
+ if (optionCount)
119
124
  wrapperClassNames.push('has-options');
120
- return (h(Host, { role: "listitem" }, h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' '), onClick: e => e.stopPropagation() }, h("div", { class: "tag" }, this.label), this.hasOptions && (h("div", { class: "btn-wrapper", onClick: this.handleWrapperClick }, h("button", { ref: el => (this.dropdownBtn = el), "test-id": "btn-control", onClick: this.handleClick, onKeyDown: this.handleKeydown, onFocusout: this.handleButtonFocusout, "aria-controls": "option-list", "aria-haspopup": "true", "aria-expanded": open ? 'true' : 'false', "aria-label": loc('tecton.element.tag.viewOptions') }, h("q2-icon", { type: "options" }))))), this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.dropdownBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { id: "option-list", role: "menu", ref: el => (this.optionList = el), onChange: this.handleChange, align: "right", type: "menu", "no-select": true }, h("slot", null)))))));
125
+ return (h(Host, { role: "listitem" }, h("click-elsewhere", { onChange: this.onClickElsewhere }, this.optionCount ? (h(Fragment, null, h("div", { class: "btn-wrapper", onClick: this.handleWrapperClick }, h("button", { class: "tag-wrapper", ref: el => (this.dropdownBtn = el), "test-id": "btn-control", type: "button", role: "combobox", onClick: this.handleClick, onKeyDown: this.handleKeydown, onFocusout: this.handleButtonFocusout, "aria-controls": "option-list", "aria-expanded": open ? 'true' : 'false', "aria-describedby": "option-description" }, h("div", { class: wrapperClassNames.join(' ') }, this.label), h("q2-icon", { type: "options" }))), this.generateHiddenElement())) : (h("div", { class: "tag-wrapper", onClick: e => e.stopPropagation() }, h("div", { class: wrapperClassNames.join(' ') }, this.label))), this.optionCount && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.dropdownBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection, align: "right" }, h("q2-option-list", { id: "option-list", ref: el => (this.optionList = el), onChange: this.handleChange, type: "menu", align: "right", label: loc('tecton.element.optionList.label', [this.optionListLabel]), "no-select": true }, h("slot", null)))))));
121
126
  }
122
127
  get hostElement() { return this; }
123
128
  static get style() { return stylesCss; }
@@ -128,7 +133,9 @@ const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
128
133
  "theme": [513],
129
134
  "popoverMinHeight": [2, "popover-min-height"],
130
135
  "popoverDirection": [1, "popover-direction"],
131
- "hasOptions": [32]
136
+ "popoverAlignment": [1025, "popover-alignment"],
137
+ "optionListLabel": [1, "option-list-label"],
138
+ "optionCount": [32]
132
139
  }, [[0, "focus", "delegateFocus"], [0, "popoverStateChanged", "popoverStateHandler"]]]);
133
140
  function defineCustomElement$1() {
134
141
  if (typeof customElements === "undefined") {
package/dist/docs.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-06-15T20:43:40",
2
+ "timestamp": "2024-02-09T23:39:36",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "2.19.2",
@@ -5819,26 +5819,27 @@
5819
5819
  "required": false
5820
5820
  },
5821
5821
  {
5822
- "name": "multiple",
5823
- "type": "boolean",
5822
+ "name": "label",
5823
+ "type": "string",
5824
5824
  "mutable": false,
5825
- "attr": "multiple",
5826
- "reflectToAttr": true,
5825
+ "attr": "label",
5826
+ "reflectToAttr": false,
5827
5827
  "docs": "",
5828
5828
  "docsTags": [],
5829
+ "default": "loc('tecton.element.optionList.label')",
5829
5830
  "values": [
5830
5831
  {
5831
- "type": "boolean"
5832
+ "type": "string"
5832
5833
  }
5833
5834
  ],
5834
5835
  "optional": false,
5835
5836
  "required": false
5836
5837
  },
5837
5838
  {
5838
- "name": "noSelect",
5839
+ "name": "multiple",
5839
5840
  "type": "boolean",
5840
5841
  "mutable": false,
5841
- "attr": "no-select",
5842
+ "attr": "multiple",
5842
5843
  "reflectToAttr": true,
5843
5844
  "docs": "",
5844
5845
  "docsTags": [],
@@ -5851,22 +5852,16 @@
5851
5852
  "required": false
5852
5853
  },
5853
5854
  {
5854
- "name": "role",
5855
- "type": "\"listbox\" | \"menu\"",
5855
+ "name": "noSelect",
5856
+ "type": "boolean",
5856
5857
  "mutable": false,
5857
- "attr": "role",
5858
+ "attr": "no-select",
5858
5859
  "reflectToAttr": true,
5859
5860
  "docs": "",
5860
5861
  "docsTags": [],
5861
- "default": "'listbox'",
5862
5862
  "values": [
5863
5863
  {
5864
- "value": "listbox",
5865
- "type": "string"
5866
- },
5867
- {
5868
- "value": "menu",
5869
- "type": "string"
5864
+ "type": "boolean"
5870
5865
  }
5871
5866
  ],
5872
5867
  "optional": false,
@@ -5910,8 +5905,14 @@
5910
5905
  "mutable": false,
5911
5906
  "attr": "type",
5912
5907
  "reflectToAttr": false,
5913
- "docs": "",
5914
- "docsTags": [],
5908
+ "docs": "Translates to the role of the option list",
5909
+ "docsTags": [
5910
+ {
5911
+ "name": "type",
5912
+ "text": "{('menu' | 'listbox')}"
5913
+ }
5914
+ ],
5915
+ "default": "'listbox'",
5915
5916
  "values": [
5916
5917
  {
5917
5918
  "value": "listbox",
@@ -6335,6 +6336,44 @@
6335
6336
  "optional": false,
6336
6337
  "required": false
6337
6338
  },
6339
+ {
6340
+ "name": "optionListLabel",
6341
+ "type": "string",
6342
+ "mutable": false,
6343
+ "attr": "option-list-label",
6344
+ "reflectToAttr": false,
6345
+ "docs": "",
6346
+ "docsTags": [],
6347
+ "values": [
6348
+ {
6349
+ "type": "string"
6350
+ }
6351
+ ],
6352
+ "optional": false,
6353
+ "required": false
6354
+ },
6355
+ {
6356
+ "name": "popoverAlignment",
6357
+ "type": "\"left\" | \"right\"",
6358
+ "mutable": true,
6359
+ "attr": "popover-alignment",
6360
+ "reflectToAttr": false,
6361
+ "docs": "",
6362
+ "docsTags": [],
6363
+ "default": "'right'",
6364
+ "values": [
6365
+ {
6366
+ "value": "left",
6367
+ "type": "string"
6368
+ },
6369
+ {
6370
+ "value": "right",
6371
+ "type": "string"
6372
+ }
6373
+ ],
6374
+ "optional": false,
6375
+ "required": false
6376
+ },
6338
6377
  {
6339
6378
  "name": "popoverDirection",
6340
6379
  "type": "\"down\" | \"up\"",
@@ -8356,6 +8395,45 @@
8356
8395
  "optional": false,
8357
8396
  "required": false
8358
8397
  },
8398
+ {
8399
+ "name": "optionListLabel",
8400
+ "type": "string",
8401
+ "mutable": false,
8402
+ "attr": "option-list-label",
8403
+ "reflectToAttr": false,
8404
+ "docs": "",
8405
+ "docsTags": [],
8406
+ "default": "'options'",
8407
+ "values": [
8408
+ {
8409
+ "type": "string"
8410
+ }
8411
+ ],
8412
+ "optional": false,
8413
+ "required": false
8414
+ },
8415
+ {
8416
+ "name": "popoverAlignment",
8417
+ "type": "\"left\" | \"right\"",
8418
+ "mutable": true,
8419
+ "attr": "popover-alignment",
8420
+ "reflectToAttr": false,
8421
+ "docs": "",
8422
+ "docsTags": [],
8423
+ "default": "'right'",
8424
+ "values": [
8425
+ {
8426
+ "value": "left",
8427
+ "type": "string"
8428
+ },
8429
+ {
8430
+ "value": "right",
8431
+ "type": "string"
8432
+ }
8433
+ ],
8434
+ "optional": false,
8435
+ "required": false
8436
+ },
8359
8437
  {
8360
8438
  "name": "popoverDirection",
8361
8439
  "type": "\"down\" | \"up\"",
@@ -6,7 +6,7 @@ const shouldShowActionSheet = (component, event) => {
6
6
  const canShowActionSheet = !!((_a = window.TectonElements) === null || _a === void 0 ? void 0 : _a.showActionSheet);
7
7
  if (!canShowActionSheet)
8
8
  return false;
9
- const keysThatTriggerOpen = ['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp', 'Home', 'End'];
9
+ const keysThatTriggerOpen = ['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp', 'Home', 'End', 'Enter', ' '];
10
10
  if (event) {
11
11
  const eventIsKeyboardEvent = event instanceof KeyboardEvent;
12
12
  const eventIsMouseEvent = event instanceof MouseEvent;