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.
- package/dist/cjs/{action-sheet-4b366e9a.js → action-sheet-ab1abf24.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-option-list_2.cjs.entry.js +9 -7
- package/dist/cjs/q2-pill.cjs.entry.js +28 -23
- package/dist/cjs/q2-select.cjs.entry.js +6 -3
- package/dist/cjs/q2-tag.cjs.entry.js +18 -13
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/collection/components/q2-option-list/index.js +33 -27
- package/dist/collection/components/q2-pill/index.js +63 -23
- package/dist/collection/components/q2-popover/styles.css +2 -3
- package/dist/collection/components/q2-select/index.js +5 -2
- package/dist/collection/components/q2-tag/index.js +55 -14
- package/dist/collection/utils/action-sheet.js +1 -1
- package/dist/components/action-sheet.js +1 -1
- package/dist/components/index13.js +10 -8
- package/dist/components/index14.js +1 -1
- package/dist/components/q2-pill.js +30 -23
- package/dist/components/q2-select.js +5 -2
- package/dist/components/q2-tag.js +21 -14
- package/dist/docs.json +98 -20
- package/dist/esm/{action-sheet-a9597b32.js → action-sheet-bfcbe154.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-option-list_2.entry.js +10 -8
- package/dist/esm/q2-pill.entry.js +28 -23
- package/dist/esm/q2-select.entry.js +6 -3
- package/dist/esm/q2-tag.entry.js +19 -14
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/q2-tecton-elements/p-788adb51.js +1 -0
- package/dist/q2-tecton-elements/p-8fd3b580.entry.js +1 -0
- package/dist/q2-tecton-elements/p-a300d517.entry.js +1 -0
- package/dist/q2-tecton-elements/p-ceabfa93.entry.js +1 -0
- package/dist/q2-tecton-elements/p-dd1115c6.entry.js +1 -0
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/types/components/q2-option-list/index.d.ts +5 -1
- package/dist/types/components/q2-pill/index.d.ts +5 -2
- package/dist/types/components/q2-select/index.d.ts +1 -1
- package/dist/types/components/q2-tag/index.d.ts +5 -2
- package/dist/types/components.d.ts +18 -2
- package/package.json +3 -3
- package/dist/q2-tecton-elements/p-04b9a7ee.entry.js +0 -1
- package/dist/q2-tecton-elements/p-521c9085.entry.js +0 -1
- package/dist/q2-tecton-elements/p-8e652d59.entry.js +0 -1
- package/dist/q2-tecton-elements/p-a1926e65.js +0 -1
- 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 {
|
|
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.
|
|
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.
|
|
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.
|
|
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 =
|
|
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}
|
|
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.
|
|
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.
|
|
46
|
-
const
|
|
47
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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,
|
|
158
|
-
if (!
|
|
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
|
-
:
|
|
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 {
|
|
245
|
-
const isButton =
|
|
246
|
+
const { optionCount, active } = this;
|
|
247
|
+
const isButton = optionCount && active;
|
|
246
248
|
const TagName = isButton ? 'button' : 'div';
|
|
247
|
-
const iconName = isButton || !
|
|
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 {
|
|
256
|
+
const { optionCount, active, open } = this;
|
|
252
257
|
const wrapperClassNames = ['btn-wrapper'];
|
|
253
|
-
if (
|
|
258
|
+
if (optionCount || active)
|
|
254
259
|
wrapperClassNames.push('has-icon');
|
|
255
|
-
if (
|
|
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-
|
|
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
|
-
"
|
|
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:
|
|
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.
|
|
21
|
-
const
|
|
22
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 {
|
|
117
|
-
const wrapperClassNames = ['tag
|
|
118
|
-
if (
|
|
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 },
|
|
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
|
-
"
|
|
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": "
|
|
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": "
|
|
5823
|
-
"type": "
|
|
5822
|
+
"name": "label",
|
|
5823
|
+
"type": "string",
|
|
5824
5824
|
"mutable": false,
|
|
5825
|
-
"attr": "
|
|
5826
|
-
"reflectToAttr":
|
|
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": "
|
|
5832
|
+
"type": "string"
|
|
5832
5833
|
}
|
|
5833
5834
|
],
|
|
5834
5835
|
"optional": false,
|
|
5835
5836
|
"required": false
|
|
5836
5837
|
},
|
|
5837
5838
|
{
|
|
5838
|
-
"name": "
|
|
5839
|
+
"name": "multiple",
|
|
5839
5840
|
"type": "boolean",
|
|
5840
5841
|
"mutable": false,
|
|
5841
|
-
"attr": "
|
|
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": "
|
|
5855
|
-
"type": "
|
|
5855
|
+
"name": "noSelect",
|
|
5856
|
+
"type": "boolean",
|
|
5856
5857
|
"mutable": false,
|
|
5857
|
-
"attr": "
|
|
5858
|
+
"attr": "no-select",
|
|
5858
5859
|
"reflectToAttr": true,
|
|
5859
5860
|
"docs": "",
|
|
5860
5861
|
"docsTags": [],
|
|
5861
|
-
"default": "'listbox'",
|
|
5862
5862
|
"values": [
|
|
5863
5863
|
{
|
|
5864
|
-
"
|
|
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;
|