q2-tecton-elements 1.71.0 → 1.71.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/bundle-report.json +34 -34
  2. package/dist/cjs/{action-sheet-D71RSc-w.js → action-sheet-DUBlF_x3.js} +1 -0
  3. package/dist/cjs/click-elsewhere_3.cjs.entry.js +1 -1
  4. package/dist/cjs/q2-action-sheet.cjs.entry.js +5 -3
  5. package/dist/cjs/q2-badge_2.cjs.entry.js +2 -2
  6. package/dist/cjs/q2-checkbox_2.cjs.entry.js +1 -1
  7. package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
  8. package/dist/cjs/q2-pill.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-search.cjs.entry.js +11 -2
  10. package/dist/cjs/q2-select.cjs.entry.js +6 -3
  11. package/dist/collection/components/click-elsewhere/click-elsewhere.js +1 -1
  12. package/dist/collection/components/q2-action-sheet/q2-action-sheet.js +5 -3
  13. package/dist/collection/components/q2-input/q2-input.js +2 -2
  14. package/dist/collection/components/q2-search/q2-search.js +11 -2
  15. package/dist/collection/components/q2-select/q2-select.js +5 -2
  16. package/dist/collection/utils/action-sheet.js +1 -0
  17. package/dist/collection/utils/test/vr-helpers.js +3 -1
  18. package/dist/components/action-sheet.js +28 -27
  19. package/dist/components/click-elsewhere2.js +1 -1
  20. package/dist/components/q2-action-sheet.js +12 -9
  21. package/dist/components/q2-input2.js +4 -4
  22. package/dist/components/q2-search.js +16 -11
  23. package/dist/components/q2-select2.js +4 -4
  24. package/dist/esm/{action-sheet-B7adb3xs.js → action-sheet-DuQ7VZ08.js} +1 -0
  25. package/dist/esm/click-elsewhere_3.entry.js +1 -1
  26. package/dist/esm/q2-action-sheet.entry.js +5 -3
  27. package/dist/esm/q2-badge_2.entry.js +2 -2
  28. package/dist/esm/q2-checkbox_2.entry.js +1 -1
  29. package/dist/esm/q2-dropdown.entry.js +1 -1
  30. package/dist/esm/q2-pill.entry.js +1 -1
  31. package/dist/esm/q2-search.entry.js +11 -2
  32. package/dist/esm/q2-select.entry.js +6 -3
  33. package/dist/q2-tecton-elements/action-sheet-DuQ7VZ08.js +65 -0
  34. package/dist/q2-tecton-elements/click-elsewhere_3.entry.js +1 -1
  35. package/dist/q2-tecton-elements/q2-action-sheet.entry.js +12 -9
  36. package/dist/q2-tecton-elements/q2-badge_2.entry.js +4 -4
  37. package/dist/q2-tecton-elements/q2-checkbox_2.entry.js +1 -1
  38. package/dist/q2-tecton-elements/q2-dropdown.entry.js +1 -1
  39. package/dist/q2-tecton-elements/q2-pill.entry.js +1 -1
  40. package/dist/q2-tecton-elements/q2-search.entry.js +21 -16
  41. package/dist/q2-tecton-elements/q2-select.entry.js +5 -5
  42. package/dist/types/components/q2-search/q2-search.d.ts +1 -0
  43. package/package.json +3 -3
  44. package/dist/q2-tecton-elements/action-sheet-B7adb3xs.js +0 -64
@@ -13,6 +13,7 @@ const Q2Search = class {
13
13
  // #region Own Properties
14
14
  // Viewport edge buffer (px) — popover falls back to input-width when it would otherwise overflow.
15
15
  this.displayBuffer = 10;
16
+ this.optionFingerprint = '';
16
17
  this.popoverWidthWarned = false;
17
18
  // #endregion
18
19
  // #region State Properties
@@ -185,7 +186,7 @@ const Q2Search = class {
185
186
  }
186
187
  };
187
188
  this.onMutationObserved = () => {
188
- var _a, _b, _c;
189
+ var _a, _b, _c, _d;
189
190
  const root = this.hostElement.shadowRoot;
190
191
  if (!root)
191
192
  return;
@@ -210,6 +211,14 @@ const Q2Search = class {
210
211
  this.checkSelectedOptions();
211
212
  if (this.multilineOptions)
212
213
  this.applyMultilineOptions();
214
+ // Reset the option list's active index whenever the slotted option set changes so that
215
+ // the next ArrowDown/ArrowUp always starts from the first visible item rather than a
216
+ // stale position left over from a previous, different options list.
217
+ const fingerprint = this.optionElements.map(o => o.value).join('\x00');
218
+ if (fingerprint !== this.optionFingerprint) {
219
+ this.optionFingerprint = fingerprint;
220
+ (_d = this.optionList) === null || _d === void 0 ? void 0 : _d.setActiveElement(undefined);
221
+ }
213
222
  };
214
223
  this.onOptionListChange = (event) => {
215
224
  event.stopPropagation();
@@ -761,7 +770,7 @@ const Q2Search = class {
761
770
  return (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: (_a = this.innerInputContainer) !== null && _a !== void 0 ? _a : undefined, open: this.open, maxHeight: this.popoverMaxHeight, minHeight: this.popoverMinHeight, align: useBlock ? undefined : this.popoverAlignment, block: useBlock }, h("div", { class: "popover-content", "data-loading": this.loading ? 'true' : 'false', "aria-busy": this.loading ? 'true' : null }, h("div", { class: "popover-top-container", hidden: !this.hasPopoverTop && !(this.multiple && this.showSelectedToggle), tabindex: "-1" }, h("slot", { name: "popover-top" }), !this.loading && this.renderMultiSelectHeader()), h("q2-option-list", { ref: el => (this.optionList = el), type: "listbox", id: this.optionListId, label: loc(this.listLabel), multiple: this.multiple, selectedOptions: this.structuredSelectedOptions, showSelected: this.showSelected, customSearch: true, hidden: this.loading, onChange: (e) => e.stopPropagation(), onTctChange: this.onOptionListChange }, h("slot", null)), showEmpty && this.renderEmpty(), h("div", { class: "popover-bottom-container", hidden: !this.hasPopoverBottom, tabindex: "-1" }, h("slot", { name: "popover-bottom" })), this.loading && (h("div", { class: "loading-overlay", "aria-hidden": "true" }, h("q2-loading", { type: "spinner" }))))));
762
771
  }
763
772
  render() {
764
- return (h(Fragment, { key: '7639a6dccbd55360c35c03c357fd64552dd9d2ba' }, h("div", { key: 'bf893491af923c9c2dc404a137df754297bd3ad5', "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("click-elsewhere", { key: '73e0045d7fc40c5d57fe26ed2993da24d5d42a04', class: this.wrapperClasses, role: "presentation", onChange: this.onClickElsewhere }, h("q2-input", { key: '5328d7d706f2f8bf3e8433d90c32e51b6abf4122', ref: el => (this.inputField = el), class: "q2-search-input", label: (this.label && loc(this.label)) || '', value: this.searchText, iconLeft: "search", clearable: this.clearable && !this.loading && !!this.searchText, disabled: this.disabled, optional: this.optional, readonly: !!this.readonly, placeholder: this.placeholder ? loc(this.placeholder) : undefined, hideLabel: this.hideLabel, errors: (Array.isArray(this.errors) && this.errors.length > 0 && this.errors.map(e => loc(e))) ||
773
+ return (h(Fragment, { key: '78ce7b735d59271600debb18ab2f0f5cf315e465' }, h("div", { key: 'd3e9a713581842cc62969a0df9556733edf6e378', "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("click-elsewhere", { key: '6912af1d8f31af8de7c7ffb28786756819c57afc', class: this.wrapperClasses, role: "presentation", onChange: this.onClickElsewhere }, h("q2-input", { key: '95a5397765aab6d3279b3d81cc31215f235aefc2', ref: el => (this.inputField = el), class: "q2-search-input", label: (this.label && loc(this.label)) || '', value: this.searchText, iconLeft: "search", clearable: this.clearable && !this.loading && !!this.searchText, disabled: this.disabled, optional: this.optional, readonly: !!this.readonly, placeholder: this.placeholder ? loc(this.placeholder) : undefined, hideLabel: this.hideLabel, errors: (Array.isArray(this.errors) && this.errors.length > 0 && this.errors.map(e => loc(e))) ||
765
774
  (this.invalid && ['tecton.element.search.invalid']) ||
766
775
  [], ariaExpanded: this.isInputOnlyMode ? undefined : `${this.open}`, ariaControls: this.isInputOnlyMode ? undefined : this.optionListId, ariaHaspopup: this.isInputOnlyMode ? undefined : 'listbox', hideMessages: true, _role: this.isInputOnlyMode ? undefined : 'combobox', onTctInput: this.inputInputHandler, onInput: (e) => e.stopImmediatePropagation(), onChange: (e) => e.stopPropagation(), onTctChange: (e) => e.stopPropagation(), badgeValue: this.badgeValue }, this.renderCustomDisplay()), this.renderOptionsDropdown())));
767
776
  }
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, F as Fragment, g as getElement } from './index-Cqkz7Bnm.js';
2
2
  import { c as createGuid, l as loc, g as isMobile, d as handleAriaLabel, o as overrideFocus, i as isEventFromElement, j as isRelatedTargetWithinHost, k as getBrowserInfo, w as waitForNextPaint } from './index-Cps4jSQM.js';
3
3
  import { m as mirrorEmit } from './mirror-emit-DUjY_ucm.js';
4
- import { s as shouldShowActionSheet, a as showActionSheetList } from './action-sheet-B7adb3xs.js';
4
+ import { s as shouldShowActionSheet, a as showActionSheetList } from './action-sheet-DuQ7VZ08.js';
5
5
 
6
6
  const q2SelectCss = () => `*{box-sizing:border-box}*:active{outline:none}*:focus-visible{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #0066cc)}: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}@container style(--t-prefers-motion: "reduced"){*,*::before,*::after{animation-duration:0.01ms !important;transition-duration:0.01ms !important;animation-delay:0ms !important;transition-delay:0ms !important}}@container (not style(--t-prefers-motion: "normal")) and (not style(--t-prefers-motion: "reduced")){@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:0.01ms !important;transition-duration:0.01ms !important;animation-delay:0ms !important;transition-delay:0ms !important}}}.q2-element-dropdown{display:none;position:absolute;background-color:var(--app-white, #ffffff);color:var(--t-text, #4d4d4d);left:0;width:100%;z-index:100;margin-top:1px;box-shadow:var(--app-shadow-1, 0px 0px 2px rgba(0, 0, 0, 0.12), 0px 2px 4px rgba(0, 0, 0, 0.14));height:0;overflow:hidden;opacity:0;visibility:hidden;transition:opacity var(--app-tween-1, 0.2s ease);border-radius:var(--tct-dropdown-border-radius, --t-dropdown-border-radius, 0);--comp-scrollbar-size:var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));--comp-scrollbar-border-radius:var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 4px)));--comp-scrollbar-color:var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));scrollbar-width:thin;scrollbar-color:var(--comp-scrollbar-color) transparent}.q2-element-dropdown::-webkit-scrollbar{width:var(--comp-scrollbar-size);height:var(--comp-scrollbar-size);margin:5px}.q2-element-dropdown::-webkit-scrollbar-thumb{background:var(--comp-scrollbar-color);border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown::-webkit-scrollbar-track{background:transparent;border-radius:var(--comp-scrollbar-border-radius)}.q2-element-dropdown.sizable{display:block;height:auto}.dropdown-open .q2-element-dropdown{display:block;height:auto;overflow:auto;opacity:1;visibility:visible}:host([alignment=right]) .q2-element-dropdown{left:auto;right:0}:host([block]) q2-btn,:host([block]){display:block}:host{--comp-default-select-margin:var(--tct-select-margin-top, var(--t-select-margin-top, var(--app-scale-5x, 25px))) 0 var(--tct-select-margin-bottom, var(--t-select-margin-bottom, var(--app-scale-5x, 25px)));display:block;margin:var(--tct-select-margin, var(--comp-default-select-margin))}.q2-select-container{position:relative;display:block}.q2-select-input{margin:0;--tct-input-min-height:var(--tct-select-input-min-height, var(--t-select-input-min-height));--tct-input-max-height:var(--tct-select-input-max-height, var(--t-select-input-max-height, none))}::slotted([slot=_selected-display]){width:100%;min-height:var(--comp-selected-display-height, 44px);padding-top:var(--tct-select-selected-display-padding, var(--app-scale-2x, 10px));padding-bottom:var(--tct-select-selected-display-padding, var(--app-scale-2x, 10px))}.custom-display-content{position:absolute;bottom:0;left:calc(var(--tct-scale-2, var(--app-scale-2x, 10px)) + 1px);height:44px;width:calc(100% - 34px - var(--tct-scale-3, var(--app-scale-3x, 15px)));overflow:hidden;cursor:pointer;transition:left var(--tct-tween-2, var(--app-tween-1, 0.2s ease))}.custom-display-content:not([hidden]){display:flex;align-items:center}.is-searchable.is-focused .custom-display-content,.is-searchable .custom-display-content:active{left:calc(var(--tct-scale-3, var(--app-scale-3x, 15px)) + 1px)}.has-error .custom-display-content{width:calc(100% - 68px - var(--tct-scale-3, var(--app-scale-3x, 15px)))}.popover-content{display:flex;flex-direction:column-reverse}.popover-bottom-container{position:sticky;bottom:0;z-index:5}.popover-top-container{position:sticky;top:0;z-index:5}.popover-top-container .multi-select-header{padding:var(--tct-scale-2, var(--app-scale-2x, 10px)) var(--tct-scale-2, var(--app-scale-2x, 10px));background:var(--app-white);display:flex;gap:var(--app-scale-2x, 10px);align-items:center}.popover-top-container .multi-select-header fieldset{margin:0;padding:0;border:0;display:flex;gap:var(--app-scale-2x, 10px)}.popover-top-container .multi-select-header legend{padding:0;float:left}.popover-top-container .multi-select-header label{cursor:pointer;padding:var(--tct-select-multi-select-option-padding, var(--t-select-multi-select-option-padding, var(--tct-btn-badge-padding, var(--t-btn-badge-padding, 2px 5px))));font-size:var(--tct-select-multi-select-option-font-size, var(--t-select-multi-select-option-font-size, var(--tct-btn-badge-font-size, var(--t-btn-badge-font-size, inherit))));border-radius:var(--tct-select-multi-select-option-radius, var(--t-select-multi-select-option-radius, var(--tct-btn-badge-border-radius, var(--t-btn-badge-border-radius, var(--app-border-radius-1, 4px)))));background:var(--tct-select-multi-select-option-background, var(--tct-select-multi-select-option-bg, var(--t-select-multi-select-option-bg, var(--tct-badge-background, var(--tct-btn-badge-bg, var(--t-btn-badge-bg, transparent))))));color:var(--tct-select-multi-select-option-color, var(--t-select-multi-select-option-color, var(--tct-btn-badge-font-color, var(--t-btn-badge-font-color, inherit))))}.popover-top-container .multi-select-header label:hover{background:var(--tct-select-multi-select-option-hover-background, var(--tct-select-multi-select-option-hover-background-color, var(--t-select-multi-select-option-hover-background-color, var(--tct-btn-badge-hover-bg, var(--t-btn-badge-hover-bg, var(--tct-gray-14, var(--t-gray-14, var(--app-gray-l3, #f2f2f2))))))));color:var(--tct-select-multi-select-option-hover-color, var(--tct-select-multi-select-option-color, var(--t-select-multi-select-option-color, var(--tct-btn-badge-hover-font-color, var(--t-btn-badge-hover-font-color, var(--tct-gray-5, var(--t-gray-5, var(--app-gray-d2, #404040))))))))}.popover-top-container .multi-select-header input:checked+label,.popover-top-container .multi-select-header input:checked+label:enabled:hover{background:var(--tct-select-multi-select-option-active-background, var(--tct-select-multi-select-option-active-background-color, var(--t-select-multi-select-option-active-background-color, var(--tct-btn-primary-bg, var(--t-btn-primary-bg, #2e2e2e)))));color:var(--tct-select-multi-select-option-active-color, var(--t-select-multi-select-option-active-color, var(--tct-btn-primary-font-color, var(--t-btn-primary-font-color, var(--app-white, #ffffff)))))}.popover-top-container .multi-select-header input:disabled+label{opacity:var(--tct-select-multi-select-option-disabled-opacity, var(--t-select-multi-select-option-disabled-opacity, var(--tct-btn-disabled-opacity, var(--t-btn-disabled-opacity, var(--app-disabled-opacity, 0.4)))));cursor:not-allowed}.popover-top-container .multi-select-header input:focus-visible+label{box-shadow:var(--const-double-focus-ring)}`;
7
7
 
@@ -361,6 +361,8 @@ const Q2Select = class {
361
361
  }
362
362
  onClearHandler(event) {
363
363
  var _a;
364
+ if (this.readonly || this.disabled)
365
+ return;
364
366
  // when multiple & searchable, it should not fire clearValue() if the type is `input` (cleared by key input) which is emitted from q2-input's handleDataInput
365
367
  if (this.multiple && this.searchable && ((_a = event === null || event === void 0 ? void 0 : event.detail) === null || _a === void 0 ? void 0 : _a.source) === 'input')
366
368
  return;
@@ -805,7 +807,8 @@ const Q2Select = class {
805
807
  }
806
808
  renderSelectField() {
807
809
  var _a;
808
- return (h(Fragment, null, h("div", { "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("q2-input", { ref: el => (this.inputField = el), class: "q2-select-input", label: (this.label && loc(this.label)) || '', value: this.selectedDisplay, clearable: (this.clearable && (!!this.value || !!((_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length))) || undefined, errors: (Array.isArray(this.errors) &&
810
+ return (h(Fragment, null, h("div", { "aria-live": "polite", "aria-atomic": "true", role: "status", class: "sr" }, this.statusMessage), h("q2-input", { ref: el => (this.inputField = el), class: "q2-select-input", label: (this.label && loc(this.label)) || '', value: this.selectedDisplay, clearable: (!this.disabled && this.clearable && (!!this.value || !!((_a = this.selectedOptions) === null || _a === void 0 ? void 0 : _a.length))) ||
811
+ undefined, errors: (Array.isArray(this.errors) &&
809
812
  this.errors.length > 0 &&
810
813
  this.errors.map(error => loc(error))) ||
811
814
  (this.invalid && ['tecton.element.select.invalid']) ||
@@ -820,7 +823,7 @@ const Q2Select = class {
820
823
  ]), checked: showSelected, "test-id": "selectedOptionsButton", onClick: this.showSelectedOptions, onKeyDown: this.visibilityToggleKeyDown }), h("label", { htmlFor: "selected" }, loc('tecton.element.select.multiHeader.selected', [selectedOptionsCount]))))));
821
824
  }
822
825
  render() {
823
- return (h("click-elsewhere", { key: 'a08e10cf8bd4e2d3f210d36003417f2a1dec4b21', class: this.wrapperClasses, role: "presentation", onChange: this.clickedElsewhere }, this.renderSelectField()));
826
+ return (h("click-elsewhere", { key: 'edb9951db5493781ee1f5da0ed5f6c03aff107e9', class: this.wrapperClasses, role: "presentation", onChange: this.clickedElsewhere }, this.renderSelectField()));
824
827
  }
825
828
  get hostElement() { return getElement(this); }
826
829
  static get watchers() { return {
@@ -0,0 +1,65 @@
1
+ const shouldShowActionSheet = (e, n) => {
2
+ var t;
3
+ if (!("open" in document.createElement("dialog"))) return !1;
4
+ if (!!!(null === (t = window.TectonElements) || void 0 === t ? void 0 : t.showActionSheet)) return !1;
5
+ if (n) {
6
+ const e = n instanceof KeyboardEvent, t = n instanceof MouseEvent, i = e && [ "ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", "Enter", " " ].includes(n.key);
7
+ if (!(t && "click" === n.type || i)) return !1;
8
+ }
9
+ return !!e.hoist;
10
+ }, parseOptions = e => {
11
+ const n = {
12
+ _hideSelectedBlock: !1,
13
+ disabled: !1,
14
+ separator: !1,
15
+ display: "",
16
+ hidden: !1,
17
+ multiline: !1,
18
+ value: "",
19
+ innerHTML: ""
20
+ }, t = Object.keys(n), i = {
21
+ disabled: !1,
22
+ label: "",
23
+ options: []
24
+ }, o = Object.keys(i);
25
+ return e.map((e => {
26
+ if ("Q2-OPTGROUP" === e.tagName) {
27
+ const n = e;
28
+ return o.reduce(((t, i) => {
29
+ if ("options" === i) {
30
+ const n = Array.from(e.children).filter((e => "Q2-OPTION" === e.tagName || "Q2-OPTGROUP" === e.tagName));
31
+ t[i] = parseOptions(n);
32
+ } else t[i] = n[i];
33
+ return t;
34
+ }), {
35
+ ...i
36
+ });
37
+ }
38
+ if ("Q2-OPTION" === e.tagName || "Q2-DROPDOWN-ITEM" === e.tagName) return t.reduce(((n, t) => (void 0 !== e[t] && (n[t] = e[t]),
39
+ n)), {
40
+ ...n
41
+ });
42
+ }));
43
+ }, showActionSheetList = async (e, n) => {
44
+ var t;
45
+ const i = await (async (e, n) => {
46
+ var t;
47
+ return {
48
+ appearance: "list",
49
+ title: e.label || "",
50
+ description: "",
51
+ event: n,
52
+ listProps: {
53
+ multiple: !!e.optionList.multiple,
54
+ selectedOptions: e.optionList.selectedOptions || [],
55
+ noSelect: !!e.optionList.noSelect
56
+ },
57
+ options: parseOptions(await e.optionList.getContents()),
58
+ // static html only
59
+ slotsHtml: await (null === (t = e._getSlotsHtml) || void 0 === t ? void 0 : t.call(e)) || []
60
+ };
61
+ })(e, n);
62
+ return null === (t = window.TectonElements) || void 0 === t ? void 0 : t.showActionSheet(i);
63
+ };
64
+
65
+ export { showActionSheetList as a, shouldShowActionSheet as s }
@@ -8,7 +8,7 @@ import { l as a, n as h, o as p, i as c, w as l, v as d, q as m, x as u, y as b,
8
8
 
9
9
  const f = class {
10
10
  constructor(o) {
11
- t(this, o), this.change = i(this, "change", 7), this.tctChange = i(this, "tctChange", 7),
11
+ t(this, o), this.change = i(this, "change", 7), this.tctChange = i(this, "tctChange", 5),
12
12
  // #region Own Properties
13
13
  this.isCurrentlyFocused = !1,
14
14
  /**
@@ -34,7 +34,10 @@ const l = class {
34
34
  }, this.generateOption = t => {
35
35
  const o = document.createElement("q2-option"), {innerHTML: i, ...e} = t;
36
36
  return i && (o.innerHTML = n(i)), Object.entries(e).forEach((([t, i]) => {
37
- void 0 !== i && ("boolean" == typeof i ? i && o.setAttribute(t, "") : o.setAttribute(t, i));
37
+ if (void 0 === i) return;
38
+ // Convert component prop names to HTML attributes, e.g. someLongPropertyName to some-long-property-name.
39
+ const e = t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
40
+ "boolean" == typeof i ? i && o.setAttribute(e, "") : o.setAttribute(e, i);
38
41
  })), o;
39
42
  },
40
43
  /**
@@ -225,21 +228,21 @@ const l = class {
225
228
  }
226
229
  const r = `interior is-${(null == o ? void 0 : o.appearance) || "slot"}`;
227
230
  return i("dialog", {
228
- key: "90b91ed23231e01c4a77cd4c22201f736942546f",
231
+ key: "840635222baf3ed3f7193c550bb73675d0b466d4",
229
232
  ref: t => this.dialogElement = t,
230
233
  class: a,
231
234
  onClick: this.onClick,
232
235
  "aria-labelledby": e ? "title" : void 0
233
236
  }, i("div", {
234
- key: "3a3d57295f090bec2fa4a0f4166ad47c020d02f9",
237
+ key: "c09338fde8ba753281162bd75714e29e6a8cc936",
235
238
  class: r
236
239
  }, e && i("header", {
237
- key: "d3c5e66fc04a501b2d57bc7ebb122e192343e30d"
240
+ key: "d3bb667204c262a28363b71ffe6fba8209454391"
238
241
  }, i("div", {
239
- key: "238957b01b452902f627aca97f590479f53886f1",
242
+ key: "8981cf55df99b607a49660fd6ecfe8ef827c100e",
240
243
  id: "title"
241
244
  }, (null == o ? void 0 : o.title) || this.title), !this.hideClose && i("q2-btn", {
242
- key: "cede4ee6deee3587043f01df525d12a1cd900a79",
245
+ key: "b4d175a3e7d0382ae9e4630a4fe0f85403af5888",
243
246
  ref: t => this.closeButtonElement = t,
244
247
  class: "btn-close",
245
248
  "test-id": "btnClose",
@@ -247,12 +250,12 @@ const l = class {
247
250
  label: "tecton.element.actionSheet.close",
248
251
  "hide-label": !0
249
252
  }, i("q2-icon", {
250
- key: "82e254b4b6419ea49f6647241a70f5203eb76624",
253
+ key: "95624ea4bcb5a9897a2b09326de718205a32e346",
251
254
  type: "close"
252
255
  }))), (null === (t = this.data) || void 0 === t ? void 0 : t.description) && i("p", {
253
- key: "78efd55feaad1979d540c49e94436e9da4c03cfe"
256
+ key: "4f599b2645c604bde96747af50f8d7344db60e11"
254
257
  }, o.description), s && i(s, {
255
- key: "fdf02d887e3366d9fdc90dcecd5717c126a10873",
258
+ key: "0878d252923c4c3a8b82cc89f8a88fc3bace794d",
256
259
  data: this.data
257
260
  })));
258
261
  }
@@ -3005,7 +3005,7 @@ const N = {
3005
3005
  constructor(r) {
3006
3006
  t(this, r), this.change = e(this, "change", 7), this.clear = e(this, "clear", 7),
3007
3007
  this.formatted = e(this, "formatted", 7), this.input = e(this, "input", 7), this.invalid = e(this, "invalid", 7),
3008
- this.tctChange = e(this, "tctChange", 7), this.tctClear = e(this, "tctClear", 7),
3008
+ this.tctChange = e(this, "tctChange", 5), this.tctClear = e(this, "tctClear", 7),
3009
3009
  this.tctFormatted = e(this, "tctFormatted", 7), this.tctInput = e(this, "tctInput", 7),
3010
3010
  this.tctInvalid = e(this, "tctInvalid", 7),
3011
3011
  // #region Own Properties
@@ -3627,15 +3627,15 @@ const N = {
3627
3627
  render() {
3628
3628
  const {ariaControls: t, ariaExpanded: a} = this.ariaAttributes;
3629
3629
  return r(o, {
3630
- key: "5255e58159b3c614913fec22cc38f8a31d5553bb",
3630
+ key: "877bcbc79e4891cab10a027fd4d53cab9852779e",
3631
3631
  role: this._role,
3632
3632
  "aria-controls": t,
3633
3633
  "aria-expanded": a
3634
3634
  }, r("div", {
3635
- key: "2dfaa5f10b49bb4ddbfe4c73467c9615559becd8",
3635
+ key: "0150e85d50d8c69dc16a50fc900cdc78729fc6ec",
3636
3636
  class: this.wrapperClasses
3637
3637
  }, r("div", {
3638
- key: "7995fb27f33ebfa79ace1e7cd0e737d8bd466978",
3638
+ key: "6fef0d2a694ef81a7967fd86365a64237ea29d96",
3639
3639
  class: "label-wrapper"
3640
3640
  }, x(this), this.renderCountDOM()), this.renderInputContainerDOM(), v(this)));
3641
3641
  }
@@ -4,7 +4,7 @@ import { c as a, d as s, o as h, i as l, b as d, l as n, w as k } from "./index-
4
4
 
5
5
  import { m as b } from "./mirror-emit-DUjY_ucm.js";
6
6
 
7
- import { s as v, a as p } from "./action-sheet-B7adb3xs.js";
7
+ import { s as v, a as p } from "./action-sheet-DuQ7VZ08.js";
8
8
 
9
9
  const f = class {
10
10
  constructor(o) {
@@ -1,6 +1,6 @@
1
1
  import { r as t, h as o, F as e, g as i } from "./index-Cqkz7Bnm.js";
2
2
 
3
- import { s as n, a as s } from "./action-sheet-B7adb3xs.js";
3
+ import { s as n, a as s } from "./action-sheet-DuQ7VZ08.js";
4
4
 
5
5
  import { o as a, i as r, w as d, b as l, d as h, l as p } from "./index-Cps4jSQM.js";
6
6
 
@@ -4,7 +4,7 @@ import { a, o as r, i as n, w as c, l as s } from "./index-Cps4jSQM.js";
4
4
 
5
5
  import { m as l } from "./mirror-emit-DUjY_ucm.js";
6
6
 
7
- import { a as p, s as d } from "./action-sheet-B7adb3xs.js";
7
+ import { a as p, s as d } from "./action-sheet-DuQ7VZ08.js";
8
8
 
9
9
  const v = class {
10
10
  constructor(i) {
@@ -8,7 +8,7 @@ const h = class {
8
8
  this.tctInput = i(this, "tctInput", 7), this.tctOpen = i(this, "tctOpen", 7),
9
9
  // #region Own Properties
10
10
  // Viewport edge buffer (px) — popover falls back to input-width when it would otherwise overflow.
11
- this.displayBuffer = 10, this.popoverWidthWarned = !1,
11
+ this.displayBuffer = 10, this.optionFingerprint = "", this.popoverWidthWarned = !1,
12
12
  // #endregion
13
13
  // #region State Properties
14
14
  this.hasEmptySlot = !1, this.hasOptions = !1, this.hasPopoverBottom = !1, this.hasPopoverTop = !1,
@@ -141,15 +141,20 @@ const h = class {
141
141
  }, this.onClickElsewhere = t => {
142
142
  "click-elsewhere" === t.target.localName && (t.stopPropagation(), "#document-fragment" !== this.hostElement.getRootNode().nodeName && this.closeDropdown());
143
143
  }, this.onMutationObserved = () => {
144
- var t, i, e;
145
- const s = this.hostElement.shadowRoot;
146
- if (!s) return;
147
- const o = s.querySelector('slot[name="popover-top"]'), n = s.querySelector('slot[name="popover-bottom"]'), r = s.querySelector('slot[name="empty"]'), l = (null !== (t = null == o ? void 0 : o.assignedNodes().length) && void 0 !== t ? t : 0) > 0, a = (null !== (i = null == n ? void 0 : n.assignedNodes().length) && void 0 !== i ? i : 0) > 0, h = (null !== (e = null == r ? void 0 : r.assignedNodes().length) && void 0 !== e ? e : 0) > 0, d = this.optionElements.length > 0;
148
- this.hasPopoverTop !== l && (this.hasPopoverTop = l), this.hasPopoverBottom !== a && (this.hasPopoverBottom = a),
149
- this.hasEmptySlot !== h && (this.hasEmptySlot = h), this.hasOptions !== d && (this.hasOptions = d),
144
+ var t, i, e, s;
145
+ const o = this.hostElement.shadowRoot;
146
+ if (!o) return;
147
+ const n = o.querySelector('slot[name="popover-top"]'), r = o.querySelector('slot[name="popover-bottom"]'), l = o.querySelector('slot[name="empty"]'), a = (null !== (t = null == n ? void 0 : n.assignedNodes().length) && void 0 !== t ? t : 0) > 0, h = (null !== (i = null == r ? void 0 : r.assignedNodes().length) && void 0 !== i ? i : 0) > 0, c = (null !== (e = null == l ? void 0 : l.assignedNodes().length) && void 0 !== e ? e : 0) > 0, d = this.optionElements.length > 0;
148
+ this.hasPopoverTop !== a && (this.hasPopoverTop = a), this.hasPopoverBottom !== h && (this.hasPopoverBottom = h),
149
+ this.hasEmptySlot !== c && (this.hasEmptySlot = c), this.hasOptions !== d && (this.hasOptions = d),
150
150
  // If input-only mode just turned on while popover was open, close it.
151
151
  this.open && this.isInputOnlyMode && this.closeDropdown(), this.checkSelectedOptions(),
152
152
  this.multilineOptions && this.applyMultilineOptions();
153
+ // Reset the option list's active index whenever the slotted option set changes so that
154
+ // the next ArrowDown/ArrowUp always starts from the first visible item rather than a
155
+ // stale position left over from a previous, different options list.
156
+ const p = this.optionElements.map((t => t.value)).join("\0");
157
+ p !== this.optionFingerprint && (this.optionFingerprint = p, null === (s = this.optionList) || void 0 === s || s.setActiveElement(void 0));
153
158
  }, this.onOptionListChange = t => {
154
159
  t.stopPropagation(), this.handleSelectionChanges(t.detail);
155
160
  }, this.onSelectedDisplayMousedown = t => {
@@ -404,13 +409,13 @@ const h = class {
404
409
  if (!a) return this.clearSelectedDisplay();
405
410
  const h = a.cloneNode(!0);
406
411
  h.querySelectorAll("[hide-on-select]").forEach((t => t.remove()));
407
- let d = this.selectedDisplaySlot;
408
- return d ? (null === (t = d.firstElementChild) || void 0 === t ? void 0 : t.outerHTML) !== h.outerHTML && d.replaceChildren(h) : (d = document.createElement("div"),
409
- d.slot = "_selected-display",
412
+ let c = this.selectedDisplaySlot;
413
+ return c ? (null === (t = c.firstElementChild) || void 0 === t ? void 0 : t.outerHTML) !== h.outerHTML && c.replaceChildren(h) : (c = document.createElement("div"),
414
+ c.slot = "_selected-display",
410
415
  // Prevent the non-focusable overlay from blurring the hidden input when clicked.
411
416
  // Same pattern used by q2-input's clear button (onMouseDown preventDefault).
412
- d.addEventListener("mousedown", this.onSelectedDisplayMousedown), d.appendChild(h),
413
- this.hostElement.appendChild(d)), d;
417
+ c.addEventListener("mousedown", this.onSelectedDisplayMousedown), c.appendChild(h),
418
+ this.hostElement.appendChild(c)), c;
414
419
  }
415
420
  checkSelectedOptions() {
416
421
  const {multiple: t, selectedOptions: i, value: e} = this;
@@ -596,20 +601,20 @@ const h = class {
596
601
  }
597
602
  render() {
598
603
  return e(s, {
599
- key: "7639a6dccbd55360c35c03c357fd64552dd9d2ba"
604
+ key: "78ce7b735d59271600debb18ab2f0f5cf315e465"
600
605
  }, e("div", {
601
- key: "bf893491af923c9c2dc404a137df754297bd3ad5",
606
+ key: "d3e9a713581842cc62969a0df9556733edf6e378",
602
607
  "aria-live": "polite",
603
608
  "aria-atomic": "true",
604
609
  role: "status",
605
610
  class: "sr"
606
611
  }, this.statusMessage), e("click-elsewhere", {
607
- key: "73e0045d7fc40c5d57fe26ed2993da24d5d42a04",
612
+ key: "6912af1d8f31af8de7c7ffb28786756819c57afc",
608
613
  class: this.wrapperClasses,
609
614
  role: "presentation",
610
615
  onChange: this.onClickElsewhere
611
616
  }, e("q2-input", {
612
- key: "5328d7d706f2f8bf3e8433d90c32e51b6abf4122",
617
+ key: "95a5397765aab6d3279b3d81cc31215f235aefc2",
613
618
  ref: t => this.inputField = t,
614
619
  class: "q2-search-input",
615
620
  label: this.label && a(this.label) || "",
@@ -4,7 +4,7 @@ import { c as l, l as n, g as a, d as r, o as c, i as h, j as d, k as p, w as u
4
4
 
5
5
  import { m as v } from "./mirror-emit-DUjY_ucm.js";
6
6
 
7
- import { s as m, a as b } from "./action-sheet-B7adb3xs.js";
7
+ import { s as m, a as b } from "./action-sheet-DuQ7VZ08.js";
8
8
 
9
9
  const g = class {
10
10
  constructor(i) {
@@ -212,9 +212,9 @@ const g = class {
212
212
  }
213
213
  onClearHandler(t) {
214
214
  var e;
215
+ this.readonly || this.disabled || this.multiple && this.searchable && "input" === (null === (e = null == t ? void 0 : t.detail) || void 0 === e ? void 0 : e.source) || this.clearValue();
215
216
  // when multiple & searchable, it should not fire clearValue() if the type is `input` (cleared by key input) which is emitted from q2-input's handleDataInput
216
- this.multiple && this.searchable && "input" === (null === (e = null == t ? void 0 : t.detail) || void 0 === e ? void 0 : e.source) || this.clearValue();
217
- }
217
+ }
218
218
  handleSelectedDisplay(t) {
219
219
  !this.multiple && this.value && this.value === t.detail.value && (this.inputField.value = t.detail.display);
220
220
  }
@@ -545,7 +545,7 @@ const g = class {
545
545
  class: "q2-select-input",
546
546
  label: this.label && n(this.label) || "",
547
547
  value: this.selectedDisplay,
548
- clearable: this.clearable && (!!this.value || !!(null === (t = this.selectedOptions) || void 0 === t ? void 0 : t.length)) || void 0,
548
+ clearable: !this.disabled && this.clearable && (!!this.value || !!(null === (t = this.selectedOptions) || void 0 === t ? void 0 : t.length)) || void 0,
549
549
  errors: Array.isArray(this.errors) && this.errors.length > 0 && this.errors.map((t => n(t))) || this.invalid && [ "tecton.element.select.invalid" ] || [],
550
550
  disabled: this.disabled,
551
551
  optional: this.optional,
@@ -617,7 +617,7 @@ const g = class {
617
617
  }
618
618
  render() {
619
619
  return i("click-elsewhere", {
620
- key: "a08e10cf8bd4e2d3f210d36003417f2a1dec4b21",
620
+ key: "edb9951db5493781ee1f5da0ed5f6c03aff107e9",
621
621
  class: this.wrapperClasses,
622
622
  role: "presentation",
623
623
  onChange: this.clickedElsewhere
@@ -15,6 +15,7 @@ export declare class Q2Search implements ComponentInterface {
15
15
  displayBuffer: number;
16
16
  inputField?: HTMLQ2InputElement;
17
17
  mutationObserver: MutationObserver;
18
+ optionFingerprint: string;
18
19
  optionList?: HTMLQ2OptionListElement;
19
20
  popoverElement?: HTMLQ2PopoverElement;
20
21
  popoverWidthWarned: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "q2-tecton-elements",
3
- "version": "1.71.0",
3
+ "version": "1.71.2",
4
4
  "description": "Q2 Tecton Custom Elements",
5
5
  "license": "MIT",
6
6
  "author": "Q2 Tecton Team",
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "@stencil/core": "~4.43.0",
66
- "q2-tecton-common": "1.71.0",
66
+ "q2-tecton-common": "1.71.2",
67
67
  "swiper": "^12.1.2"
68
68
  },
69
69
  "devDependencies": {
@@ -85,5 +85,5 @@
85
85
  "rollup-plugin-istanbul": "^5.0.0"
86
86
  },
87
87
  "packageManager": "pnpm@10.27.0",
88
- "gitHead": "71a344c4d6495bf70c23db0f492f2717e63bda91"
88
+ "gitHead": "7f59041ab15cbd3707d1b874babe55287419a019"
89
89
  }
@@ -1,64 +0,0 @@
1
- const shouldShowActionSheet = (n, e) => {
2
- var t;
3
- if (!("open" in document.createElement("dialog"))) return !1;
4
- if (!!!(null === (t = window.TectonElements) || void 0 === t ? void 0 : t.showActionSheet)) return !1;
5
- if (e) {
6
- const n = e instanceof KeyboardEvent, t = e instanceof MouseEvent, i = n && [ "ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", "Enter", " " ].includes(e.key);
7
- if (!(t && "click" === e.type || i)) return !1;
8
- }
9
- return !!n.hoist;
10
- }, parseOptions = n => {
11
- const e = {
12
- disabled: !1,
13
- separator: !1,
14
- display: "",
15
- hidden: !1,
16
- multiline: !1,
17
- value: "",
18
- innerHTML: ""
19
- }, t = Object.keys(e), i = {
20
- disabled: !1,
21
- label: "",
22
- options: []
23
- }, o = Object.keys(i);
24
- return n.map((n => {
25
- if ("Q2-OPTGROUP" === n.tagName) {
26
- const e = n;
27
- return o.reduce(((t, i) => {
28
- if ("options" === i) {
29
- const e = Array.from(n.children).filter((n => "Q2-OPTION" === n.tagName || "Q2-OPTGROUP" === n.tagName));
30
- t[i] = parseOptions(e);
31
- } else t[i] = e[i];
32
- return t;
33
- }), {
34
- ...i
35
- });
36
- }
37
- if ("Q2-OPTION" === n.tagName || "Q2-DROPDOWN-ITEM" === n.tagName) return t.reduce(((e, t) => (void 0 !== n[t] && (e[t] = n[t]),
38
- e)), {
39
- ...e
40
- });
41
- }));
42
- }, showActionSheetList = async (n, e) => {
43
- var t;
44
- const i = await (async (n, e) => {
45
- var t;
46
- return {
47
- appearance: "list",
48
- title: n.label || "",
49
- description: "",
50
- event: e,
51
- listProps: {
52
- multiple: !!n.optionList.multiple,
53
- selectedOptions: n.optionList.selectedOptions || [],
54
- noSelect: !!n.optionList.noSelect
55
- },
56
- options: parseOptions(await n.optionList.getContents()),
57
- // static html only
58
- slotsHtml: await (null === (t = n._getSlotsHtml) || void 0 === t ? void 0 : t.call(n)) || []
59
- };
60
- })(n, e);
61
- return null === (t = window.TectonElements) || void 0 === t ? void 0 : t.showActionSheet(i);
62
- };
63
-
64
- export { showActionSheetList as a, shouldShowActionSheet as s }