@fluid-topics/ft-chip 2.2.25 → 2.2.26
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/build/ft-chip.d.ts +2 -0
- package/build/ft-chip.js +11 -3
- package/build/ft-chip.light.js +181 -175
- package/build/ft-chip.min.js +173 -167
- package/build/ft-chip.property.d.ts +1 -0
- package/package.json +7 -7
package/build/ft-chip.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare class FtChip extends FtLitElement implements FtChipProperties {
|
|
|
17
17
|
label: string;
|
|
18
18
|
iconLabel: string;
|
|
19
19
|
hideIconTooltip: boolean;
|
|
20
|
+
accessibleLabelOnIcon: boolean;
|
|
20
21
|
icon?: string;
|
|
21
22
|
iconVariant?: FtIconVariants;
|
|
22
23
|
trailingIcon: boolean;
|
|
@@ -26,6 +27,7 @@ export declare class FtChip extends FtLitElement implements FtChipProperties {
|
|
|
26
27
|
protected render(): import("lit").TemplateResult<1>;
|
|
27
28
|
private get interactionsOnChip();
|
|
28
29
|
private get interactionsOnIcon();
|
|
30
|
+
private get labelOnIconOnly();
|
|
29
31
|
private renderIcon;
|
|
30
32
|
private onKeyUp;
|
|
31
33
|
private onIconKeyUp;
|
package/build/ft-chip.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html } from "lit";
|
|
7
|
+
import { html, nothing, } from "lit";
|
|
8
8
|
import { property, query, } from "lit/decorators.js";
|
|
9
9
|
import { classMap } from "lit/directives/class-map.js";
|
|
10
10
|
import { FtLitElement, isSafari, unslotText, } from "@fluid-topics/ft-wc-utils";
|
|
@@ -31,6 +31,7 @@ export class FtChip extends FtLitElement {
|
|
|
31
31
|
this.label = "";
|
|
32
32
|
this.iconLabel = "";
|
|
33
33
|
this.hideIconTooltip = false;
|
|
34
|
+
this.accessibleLabelOnIcon = false;
|
|
34
35
|
this.icon = undefined;
|
|
35
36
|
this.trailingIcon = false;
|
|
36
37
|
}
|
|
@@ -49,12 +50,13 @@ export class FtChip extends FtLitElement {
|
|
|
49
50
|
};
|
|
50
51
|
return html `
|
|
51
52
|
<div class="${classMap(classes)}"
|
|
52
|
-
aria-label="${this.getLabel()}"
|
|
53
|
+
aria-label="${this.labelOnIconOnly ? nothing : this.getLabel()}"
|
|
53
54
|
tabindex="${this.interactionsOnChip ? 0 : -1}"
|
|
54
55
|
@keyup=${this.onKeyUp}
|
|
55
56
|
part="chip">
|
|
56
57
|
<ft-ripple ?disabled=${!this.interactionsOnChip}></ft-ripple>
|
|
57
|
-
<ft-typography variant="${(_a = this.typographyVariant) !== null && _a !== void 0 ? _a : "body2"}" element="span" class="ft-chip--label" part="label"
|
|
58
|
+
<ft-typography variant="${(_a = this.typographyVariant) !== null && _a !== void 0 ? _a : "body2"}" element="span" class="ft-chip--label" part="label"
|
|
59
|
+
aria-hidden="${this.labelOnIconOnly ? "true" : nothing}">
|
|
58
60
|
<slot @slotchange=${this.onSlotchange}></slot>
|
|
59
61
|
</ft-typography>
|
|
60
62
|
${this.internalIcon ? this.renderIcon() : null}
|
|
@@ -67,6 +69,9 @@ export class FtChip extends FtLitElement {
|
|
|
67
69
|
get interactionsOnIcon() {
|
|
68
70
|
return (this.iconClickable || this.removable) && !this.disabled;
|
|
69
71
|
}
|
|
72
|
+
get labelOnIconOnly() {
|
|
73
|
+
return this.accessibleLabelOnIcon && this.interactionsOnIcon;
|
|
74
|
+
}
|
|
70
75
|
renderIcon() {
|
|
71
76
|
return this.interactionsOnIcon
|
|
72
77
|
? html `
|
|
@@ -157,6 +162,9 @@ __decorate([
|
|
|
157
162
|
__decorate([
|
|
158
163
|
property({ type: Boolean })
|
|
159
164
|
], FtChip.prototype, "hideIconTooltip", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
property({ type: Boolean })
|
|
167
|
+
], FtChip.prototype, "accessibleLabelOnIcon", void 0);
|
|
160
168
|
__decorate([
|
|
161
169
|
property()
|
|
162
170
|
], FtChip.prototype, "icon", void 0);
|