@nectary/components 5.53.2 → 5.53.4
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/bundle.js +17 -1
- package/input/index.d.ts +2 -0
- package/input/index.js +6 -0
- package/package.json +2 -2
- package/select-menu/index.js +11 -1
- package/utils/dom.d.ts +5 -0
package/bundle.js
CHANGED
|
@@ -7325,6 +7325,12 @@ class Input extends NectaryElement {
|
|
|
7325
7325
|
get focusable() {
|
|
7326
7326
|
return true;
|
|
7327
7327
|
}
|
|
7328
|
+
get ariaActiveDescendantElement() {
|
|
7329
|
+
return this.#$input.ariaActiveDescendantElement;
|
|
7330
|
+
}
|
|
7331
|
+
set ariaActiveDescendantElement(element) {
|
|
7332
|
+
this.#$input.ariaActiveDescendantElement = element;
|
|
7333
|
+
}
|
|
7328
7334
|
focus(options) {
|
|
7329
7335
|
this.#$input.focus(options);
|
|
7330
7336
|
}
|
|
@@ -16084,10 +16090,11 @@ class SelectMenuOption extends NectaryElement {
|
|
|
16084
16090
|
}
|
|
16085
16091
|
defineCustomElement("sinch-select-menu-option", SelectMenuOption);
|
|
16086
16092
|
const isSelectMenuOption = (el) => el.localName === "sinch-select-menu-option";
|
|
16087
|
-
const templateHTML$h = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#no-results{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#no-results:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="no-results"><sinch-text id="no-results-text" type="m"></sinch-text></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
|
|
16093
|
+
const templateHTML$h = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#no-results{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#announcer{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}#no-results:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="no-results"><sinch-text id="no-results-text" type="m"></sinch-text></div><div id="announcer" role="status" aria-live="polite" aria-atomic="true"></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
|
|
16088
16094
|
const ITEM_HEIGHT = 40;
|
|
16089
16095
|
const DEFAULT_SEARCH_LABEL = "Search";
|
|
16090
16096
|
const DEFAULT_NO_RESULTS_TEXT = "No results";
|
|
16097
|
+
const SUPPORTS_ACTIVE_DESCENDANT_ELEMENT = "ariaActiveDescendantElement" in Element.prototype;
|
|
16091
16098
|
const template$h = document.createElement("template");
|
|
16092
16099
|
template$h.innerHTML = templateHTML$h;
|
|
16093
16100
|
class SelectMenu extends NectaryElement {
|
|
@@ -16097,6 +16104,7 @@ class SelectMenu extends NectaryElement {
|
|
|
16097
16104
|
#$searchClear;
|
|
16098
16105
|
#$noResults;
|
|
16099
16106
|
#$noResultsText;
|
|
16107
|
+
#$announcer;
|
|
16100
16108
|
#controller = null;
|
|
16101
16109
|
#searchDebounce;
|
|
16102
16110
|
#internals;
|
|
@@ -16113,6 +16121,7 @@ class SelectMenu extends NectaryElement {
|
|
|
16113
16121
|
this.#$searchClear = shadowRoot.querySelector("#search-clear");
|
|
16114
16122
|
this.#$noResults = shadowRoot.querySelector("#no-results");
|
|
16115
16123
|
this.#$noResultsText = shadowRoot.querySelector("#no-results-text");
|
|
16124
|
+
this.#$announcer = shadowRoot.querySelector("#announcer");
|
|
16116
16125
|
this.#searchDebounce = debounceTimeout(200)(this.#updateSearchValue);
|
|
16117
16126
|
}
|
|
16118
16127
|
connectedCallback() {
|
|
@@ -16575,6 +16584,13 @@ class SelectMenu extends NectaryElement {
|
|
|
16575
16584
|
$op.scrollIntoView?.({ block: "nearest" });
|
|
16576
16585
|
}
|
|
16577
16586
|
}
|
|
16587
|
+
if (SUPPORTS_ACTIVE_DESCENDANT_ELEMENT) {
|
|
16588
|
+
const isSearchActive = hasClass(this.#$search, "active");
|
|
16589
|
+
this.#$search.ariaActiveDescendantElement = isSearchActive ? $option : null;
|
|
16590
|
+
this.ariaActiveDescendantElement = isSearchActive ? null : $option;
|
|
16591
|
+
} else {
|
|
16592
|
+
this.#$announcer.textContent = $option?.text ?? "";
|
|
16593
|
+
}
|
|
16578
16594
|
}
|
|
16579
16595
|
#getOptionElements() {
|
|
16580
16596
|
const assignedElements = this.#$optionSlot.assignedElements();
|
package/input/index.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export declare class Input extends NectaryElement {
|
|
|
41
41
|
set selectionDirection(value: HTMLInputElement['selectionDirection']);
|
|
42
42
|
setSelectionRange(selectionStart: number, selectionEnd: number): void;
|
|
43
43
|
get focusable(): boolean;
|
|
44
|
+
get ariaActiveDescendantElement(): Element | null;
|
|
45
|
+
set ariaActiveDescendantElement(element: Element | null);
|
|
44
46
|
focus(options?: FocusOptions): void;
|
|
45
47
|
blur(): void;
|
|
46
48
|
}
|
package/input/index.js
CHANGED
|
@@ -390,6 +390,12 @@ class Input extends NectaryElement {
|
|
|
390
390
|
get focusable() {
|
|
391
391
|
return true;
|
|
392
392
|
}
|
|
393
|
+
get ariaActiveDescendantElement() {
|
|
394
|
+
return this.#$input.ariaActiveDescendantElement;
|
|
395
|
+
}
|
|
396
|
+
set ariaActiveDescendantElement(element) {
|
|
397
|
+
this.#$input.ariaActiveDescendantElement = element;
|
|
398
|
+
}
|
|
393
399
|
focus(options) {
|
|
394
400
|
this.#$input.focus(options);
|
|
395
401
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nectary/components",
|
|
3
|
-
"version": "5.53.
|
|
3
|
+
"version": "5.53.4",
|
|
4
4
|
"files": [
|
|
5
5
|
"**/*/*.css",
|
|
6
6
|
"**/*/*.json",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.22.15",
|
|
27
|
-
"@nectary/assets": "3.
|
|
27
|
+
"@nectary/assets": "3.7.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/cli": "^7.22.15",
|
package/select-menu/index.js
CHANGED
|
@@ -10,10 +10,11 @@ import { debounceTimeout } from "../utils/debounce.js";
|
|
|
10
10
|
import { getReactEventHandler } from "../utils/get-react-event-handler.js";
|
|
11
11
|
import { isTargetEqual } from "../utils/event-target.js";
|
|
12
12
|
import { setFormValue, CSVToFormData } from "../utils/form.js";
|
|
13
|
-
const templateHTML = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#no-results{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#no-results:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="no-results"><sinch-text id="no-results-text" type="m"></sinch-text></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
|
|
13
|
+
const templateHTML = '<style>:host{display:block;outline:0}#listbox{overflow-y:auto;max-height:var(--sinch-comp-select-menu-font-max-height)}#search{display:none;margin:10px}#search.active{display:block}#search-clear:not(.active){display:none}#no-results{display:flex;align-items:center;justify-content:center;width:100%;height:30px;margin-bottom:10px;pointer-events:none;user-select:none;--sinch-comp-text-font:var(--sinch-comp-select-menu-font-not-found-text);--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-not-found-text-initial)}#announcer{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}#no-results:not(.active){display:none}::slotted(.hidden){display:none}::slotted(sinch-title){padding:8px 16px;--sinch-global-color-text:var(--sinch-comp-select-menu-color-default-title-initial)}</style><sinch-input id="search" size="s" placeholder="Search" aria-label="Search"><sinch-icon icons-version="2" name="magnifying-glass" id="icon-search" slot="icon"></sinch-icon><sinch-button id="search-clear" slot="right"><sinch-icon icons-version="2" name="fa-xmark" slot="icon"></sinch-icon></sinch-button></sinch-input><div id="no-results"><sinch-text id="no-results-text" type="m"></sinch-text></div><div id="announcer" role="status" aria-live="polite" aria-atomic="true"></div><div id="listbox" role="listbox" tabindex="-1"><slot></slot></div>';
|
|
14
14
|
const ITEM_HEIGHT = 40;
|
|
15
15
|
const DEFAULT_SEARCH_LABEL = "Search";
|
|
16
16
|
const DEFAULT_NO_RESULTS_TEXT = "No results";
|
|
17
|
+
const SUPPORTS_ACTIVE_DESCENDANT_ELEMENT = "ariaActiveDescendantElement" in Element.prototype;
|
|
17
18
|
const template = document.createElement("template");
|
|
18
19
|
template.innerHTML = templateHTML;
|
|
19
20
|
class SelectMenu extends NectaryElement {
|
|
@@ -23,6 +24,7 @@ class SelectMenu extends NectaryElement {
|
|
|
23
24
|
#$searchClear;
|
|
24
25
|
#$noResults;
|
|
25
26
|
#$noResultsText;
|
|
27
|
+
#$announcer;
|
|
26
28
|
#controller = null;
|
|
27
29
|
#searchDebounce;
|
|
28
30
|
#internals;
|
|
@@ -39,6 +41,7 @@ class SelectMenu extends NectaryElement {
|
|
|
39
41
|
this.#$searchClear = shadowRoot.querySelector("#search-clear");
|
|
40
42
|
this.#$noResults = shadowRoot.querySelector("#no-results");
|
|
41
43
|
this.#$noResultsText = shadowRoot.querySelector("#no-results-text");
|
|
44
|
+
this.#$announcer = shadowRoot.querySelector("#announcer");
|
|
42
45
|
this.#searchDebounce = debounceTimeout(200)(this.#updateSearchValue);
|
|
43
46
|
}
|
|
44
47
|
connectedCallback() {
|
|
@@ -501,6 +504,13 @@ class SelectMenu extends NectaryElement {
|
|
|
501
504
|
$op.scrollIntoView?.({ block: "nearest" });
|
|
502
505
|
}
|
|
503
506
|
}
|
|
507
|
+
if (SUPPORTS_ACTIVE_DESCENDANT_ELEMENT) {
|
|
508
|
+
const isSearchActive = hasClass(this.#$search, "active");
|
|
509
|
+
this.#$search.ariaActiveDescendantElement = isSearchActive ? $option : null;
|
|
510
|
+
this.ariaActiveDescendantElement = isSearchActive ? null : $option;
|
|
511
|
+
} else {
|
|
512
|
+
this.#$announcer.textContent = $option?.text ?? "";
|
|
513
|
+
}
|
|
504
514
|
}
|
|
505
515
|
#getOptionElements() {
|
|
506
516
|
const assignedElements = this.#$optionSlot.assignedElements();
|
package/utils/dom.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface ARIAMixin {
|
|
3
|
+
ariaActiveDescendantElement: Element | null;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
1
6
|
export declare const updateExplicitBooleanAttribute: ($element: Element, attrName: string, attrValue: boolean | null | undefined) => void;
|
|
2
7
|
export declare const isAttrTrue: (attrValue: string | null) => boolean;
|
|
3
8
|
export declare const getBooleanAttribute: ($element: Element, attrName: string) => boolean;
|