@nectary/components 5.43.0 → 5.43.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.js +14 -0
- package/color-swatch/index.js +14 -0
- package/package.json +1 -1
package/bundle.js
CHANGED
|
@@ -3241,6 +3241,7 @@ class ColorSwatch extends NectaryElement {
|
|
|
3241
3241
|
}
|
|
3242
3242
|
connectedCallback() {
|
|
3243
3243
|
super.connectedCallback();
|
|
3244
|
+
this.#updateA11yRole();
|
|
3244
3245
|
this.#updateColor();
|
|
3245
3246
|
}
|
|
3246
3247
|
disconnectedCallback() {
|
|
@@ -3255,6 +3256,10 @@ class ColorSwatch extends NectaryElement {
|
|
|
3255
3256
|
this.#updateColor();
|
|
3256
3257
|
break;
|
|
3257
3258
|
}
|
|
3259
|
+
case "aria-label": {
|
|
3260
|
+
this.#updateA11yRole();
|
|
3261
|
+
break;
|
|
3262
|
+
}
|
|
3258
3263
|
}
|
|
3259
3264
|
}
|
|
3260
3265
|
get name() {
|
|
@@ -3284,6 +3289,7 @@ class ColorSwatch extends NectaryElement {
|
|
|
3284
3289
|
if (exitingAriaLabel == null || isSwatchColor(exitingAriaLabel)) {
|
|
3285
3290
|
updateAttribute(this, "aria-label", colorName);
|
|
3286
3291
|
}
|
|
3292
|
+
this.#updateA11yRole();
|
|
3287
3293
|
const bg = getSwatchColorBg(colorName);
|
|
3288
3294
|
this.#$wrapper.style.setProperty("background-color", bg);
|
|
3289
3295
|
setClass(this.#$wrapper, "no-color", false);
|
|
@@ -3292,6 +3298,14 @@ class ColorSwatch extends NectaryElement {
|
|
|
3292
3298
|
setClass(this.#$wrapper, "no-color", false);
|
|
3293
3299
|
}
|
|
3294
3300
|
}
|
|
3301
|
+
#updateA11yRole() {
|
|
3302
|
+
const ariaLabel = getAttribute(this, "aria-label");
|
|
3303
|
+
if (ariaLabel != null) {
|
|
3304
|
+
updateAttribute(this, "role", "img");
|
|
3305
|
+
} else {
|
|
3306
|
+
updateAttribute(this, "role", null);
|
|
3307
|
+
}
|
|
3308
|
+
}
|
|
3295
3309
|
}
|
|
3296
3310
|
defineCustomElement("sinch-color-swatch", ColorSwatch);
|
|
3297
3311
|
const createThrottle = (delayFn, cancelFn) => (cb) => {
|
package/color-swatch/index.js
CHANGED
|
@@ -16,6 +16,7 @@ class ColorSwatch extends NectaryElement {
|
|
|
16
16
|
}
|
|
17
17
|
connectedCallback() {
|
|
18
18
|
super.connectedCallback();
|
|
19
|
+
this.#updateA11yRole();
|
|
19
20
|
this.#updateColor();
|
|
20
21
|
}
|
|
21
22
|
disconnectedCallback() {
|
|
@@ -30,6 +31,10 @@ class ColorSwatch extends NectaryElement {
|
|
|
30
31
|
this.#updateColor();
|
|
31
32
|
break;
|
|
32
33
|
}
|
|
34
|
+
case "aria-label": {
|
|
35
|
+
this.#updateA11yRole();
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
get name() {
|
|
@@ -59,6 +64,7 @@ class ColorSwatch extends NectaryElement {
|
|
|
59
64
|
if (exitingAriaLabel == null || isSwatchColor(exitingAriaLabel)) {
|
|
60
65
|
updateAttribute(this, "aria-label", colorName);
|
|
61
66
|
}
|
|
67
|
+
this.#updateA11yRole();
|
|
62
68
|
const bg = getSwatchColorBg(colorName);
|
|
63
69
|
this.#$wrapper.style.setProperty("background-color", bg);
|
|
64
70
|
setClass(this.#$wrapper, "no-color", false);
|
|
@@ -67,6 +73,14 @@ class ColorSwatch extends NectaryElement {
|
|
|
67
73
|
setClass(this.#$wrapper, "no-color", false);
|
|
68
74
|
}
|
|
69
75
|
}
|
|
76
|
+
#updateA11yRole() {
|
|
77
|
+
const ariaLabel = getAttribute(this, "aria-label");
|
|
78
|
+
if (ariaLabel != null) {
|
|
79
|
+
updateAttribute(this, "role", "img");
|
|
80
|
+
} else {
|
|
81
|
+
updateAttribute(this, "role", null);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
70
84
|
}
|
|
71
85
|
defineCustomElement("sinch-color-swatch", ColorSwatch);
|
|
72
86
|
export {
|