@spectrum-web-components/tags 1.1.0 → 1.2.0-beta.0
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/package.json +6 -6
- package/sp-tag.d.ts +6 -0
- package/sp-tag.dev.js +5 -0
- package/sp-tag.dev.js.map +7 -0
- package/sp-tag.js +2 -0
- package/sp-tag.js.map +7 -0
- package/sp-tags.d.ts +6 -0
- package/sp-tags.dev.js +5 -0
- package/sp-tags.dev.js.map +7 -0
- package/sp-tags.js +2 -0
- package/sp-tags.js.map +7 -0
- package/src/Tag.d.ts +28 -0
- package/src/Tag.dev.js +119 -0
- package/src/Tag.dev.js.map +7 -0
- package/src/Tag.js +16 -0
- package/src/Tag.js.map +7 -0
- package/src/Tags.d.ts +24 -0
- package/src/Tags.dev.js +97 -0
- package/src/Tags.dev.js.map +7 -0
- package/src/Tags.js +4 -0
- package/src/Tags.js.map +7 -0
- package/src/index.d.ts +2 -0
- package/src/index.dev.js +4 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-tag.css.d.ts +2 -0
- package/src/spectrum-tag.css.dev.js +7 -0
- package/src/spectrum-tag.css.dev.js.map +7 -0
- package/src/spectrum-tag.css.js +4 -0
- package/src/spectrum-tag.css.js.map +7 -0
- package/src/spectrum-tags.css.d.ts +2 -0
- package/src/spectrum-tags.css.dev.js +7 -0
- package/src/spectrum-tags.css.dev.js.map +7 -0
- package/src/spectrum-tags.css.js +4 -0
- package/src/spectrum-tags.css.js.map +7 -0
- package/src/tag-overrides.css.d.ts +2 -0
- package/src/tag-overrides.css.dev.js +7 -0
- package/src/tag-overrides.css.dev.js.map +7 -0
- package/src/tag-overrides.css.js +4 -0
- package/src/tag-overrides.css.js.map +7 -0
- package/src/tag.css.d.ts +2 -0
- package/src/tag.css.dev.js +7 -0
- package/src/tag.css.dev.js.map +7 -0
- package/src/tag.css.js +4 -0
- package/src/tag.css.js.map +7 -0
- package/src/tags-overrides.css.d.ts +2 -0
- package/src/tags-overrides.css.dev.js +7 -0
- package/src/tags-overrides.css.dev.js.map +7 -0
- package/src/tags-overrides.css.js +4 -0
- package/src/tags-overrides.css.js.map +7 -0
- package/src/tags.css.d.ts +2 -0
- package/src/tags.css.dev.js +7 -0
- package/src/tags.css.dev.js.map +7 -0
- package/src/tags.css.js +4 -0
- package/src/tags.css.js.map +7 -0
- package/stories/tags-sizes.stories.js +33 -0
- package/stories/tags-sizes.stories.js.map +7 -0
- package/stories/tags.stories.js +138 -0
- package/stories/tags.stories.js.map +7 -0
- package/test/benchmark/basic-test.js +13 -0
- package/test/benchmark/basic-test.js.map +7 -0
- package/test/tag.test.js +162 -0
- package/test/tag.test.js.map +7 -0
- package/test/tags-memory.test.js +13 -0
- package/test/tags-memory.test.js.map +7 -0
- package/test/tags-sizes.test-vrt.js +5 -0
- package/test/tags-sizes.test-vrt.js.map +7 -0
- package/test/tags.test-vrt.js +5 -0
- package/test/tags.test-vrt.js.map +7 -0
- package/test/tags.test.js +301 -0
- package/test/tags.test.js.map +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/tags",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-beta.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -68,10 +68,10 @@
|
|
|
68
68
|
"lit-html"
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@spectrum-web-components/base": "^1.
|
|
72
|
-
"@spectrum-web-components/button": "^1.
|
|
73
|
-
"@spectrum-web-components/reactive-controllers": "^1.
|
|
74
|
-
"@spectrum-web-components/shared": "^1.
|
|
71
|
+
"@spectrum-web-components/base": "^1.2.0-beta.0",
|
|
72
|
+
"@spectrum-web-components/button": "^1.2.0-beta.0",
|
|
73
|
+
"@spectrum-web-components/reactive-controllers": "^1.2.0-beta.0",
|
|
74
|
+
"@spectrum-web-components/shared": "^1.2.0-beta.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@spectrum-css/tag": "10.0.0-s2-foundations.15",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"./sp-*.js",
|
|
84
84
|
"./**/*.dev.js"
|
|
85
85
|
],
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "809bd734313fe289067108bf1dea2a48cc103a9f"
|
|
87
87
|
}
|
package/sp-tag.d.ts
ADDED
package/sp-tag.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-tag.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tag } from './src/Tag.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tag', Tag);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tag': Tag;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,SAAS,qBAAqB;AAE9B,cAAc,UAAU,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-tag.js
ADDED
package/sp-tag.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-tag.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tag } from './src/Tag.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tag', Tag);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tag': Tag;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,OAAAA,MAAW,eACpB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,SAAUD,CAAG",
|
|
6
|
+
"names": ["Tag", "defineElement"]
|
|
7
|
+
}
|
package/sp-tags.d.ts
ADDED
package/sp-tags.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-tags.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tags } from './src/Tags.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tags', Tags);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tags': Tags;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,YAAY;AACrB,SAAS,qBAAqB;AAE9B,cAAc,WAAW,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-tags.js
ADDED
package/sp-tags.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-tags.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Tags } from './src/Tags.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-tags', Tags);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-tags': Tags;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,QAAAA,MAAY,gBACrB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,UAAWD,CAAI",
|
|
6
|
+
"names": ["Tags", "defineElement"]
|
|
7
|
+
}
|
package/src/Tag.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import '@spectrum-web-components/button/sp-clear-button.js';
|
|
3
|
+
declare const Tag_base: typeof SpectrumElement & {
|
|
4
|
+
new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
|
|
5
|
+
prototype: import("@spectrum-web-components/base").SizedElementInterface;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* @element sp-tag
|
|
9
|
+
*
|
|
10
|
+
* @slot - text content for labeling the tag
|
|
11
|
+
* @slot avatar - an avatar element to display within the Tag
|
|
12
|
+
* @slot icon - an icon element to display within the Tag
|
|
13
|
+
*/
|
|
14
|
+
export declare class Tag extends Tag_base {
|
|
15
|
+
static get styles(): CSSResultArray;
|
|
16
|
+
deletable: boolean;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
readonly: boolean;
|
|
19
|
+
constructor();
|
|
20
|
+
private handleFocusin;
|
|
21
|
+
private handleFocusout;
|
|
22
|
+
private handleKeydown;
|
|
23
|
+
private delete;
|
|
24
|
+
protected render(): TemplateResult;
|
|
25
|
+
protected firstUpdated(changes: PropertyValues): void;
|
|
26
|
+
protected updated(changes: PropertyValues): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
package/src/Tag.dev.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
nothing,
|
|
15
|
+
SizedMixin,
|
|
16
|
+
SpectrumElement
|
|
17
|
+
} from "@spectrum-web-components/base";
|
|
18
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
19
|
+
import "@spectrum-web-components/button/sp-clear-button.js";
|
|
20
|
+
import styles from "./tag.css.js";
|
|
21
|
+
export class Tag extends SizedMixin(SpectrumElement, {
|
|
22
|
+
validSizes: ["s", "m", "l"],
|
|
23
|
+
noDefaultSize: true
|
|
24
|
+
}) {
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
this.deletable = false;
|
|
28
|
+
this.disabled = false;
|
|
29
|
+
this.readonly = false;
|
|
30
|
+
this.handleFocusin = () => {
|
|
31
|
+
this.addEventListener("focusout", this.handleFocusout);
|
|
32
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
33
|
+
};
|
|
34
|
+
this.handleFocusout = () => {
|
|
35
|
+
this.removeEventListener("keydown", this.handleKeydown);
|
|
36
|
+
this.removeEventListener("focusout", this.handleFocusout);
|
|
37
|
+
};
|
|
38
|
+
this.handleKeydown = (event) => {
|
|
39
|
+
if (!this.deletable || this.disabled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const { code } = event;
|
|
43
|
+
switch (code) {
|
|
44
|
+
case "Backspace":
|
|
45
|
+
case "Space":
|
|
46
|
+
case "Delete":
|
|
47
|
+
this.delete();
|
|
48
|
+
default:
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
this.addEventListener("focusin", this.handleFocusin);
|
|
53
|
+
}
|
|
54
|
+
static get styles() {
|
|
55
|
+
return [styles];
|
|
56
|
+
}
|
|
57
|
+
delete() {
|
|
58
|
+
if (this.readonly) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const applyDefault = this.dispatchEvent(
|
|
62
|
+
new Event("delete", {
|
|
63
|
+
bubbles: true,
|
|
64
|
+
cancelable: true,
|
|
65
|
+
composed: true
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
if (!applyDefault) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.remove();
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return html`
|
|
75
|
+
<slot name="avatar"></slot>
|
|
76
|
+
<slot name="icon"></slot>
|
|
77
|
+
<span class="label"><slot></slot></span>
|
|
78
|
+
${this.deletable ? html`
|
|
79
|
+
<sp-clear-button
|
|
80
|
+
class="clear-button"
|
|
81
|
+
?disabled=${this.disabled}
|
|
82
|
+
label="Remove"
|
|
83
|
+
size="s"
|
|
84
|
+
tabindex="-1"
|
|
85
|
+
@click=${this.delete}
|
|
86
|
+
></sp-clear-button>
|
|
87
|
+
` : nothing}
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
firstUpdated(changes) {
|
|
91
|
+
super.firstUpdated(changes);
|
|
92
|
+
if (!this.hasAttribute("role")) {
|
|
93
|
+
this.setAttribute("role", "listitem");
|
|
94
|
+
}
|
|
95
|
+
if (this.deletable) {
|
|
96
|
+
this.setAttribute("tabindex", "0");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
updated(changes) {
|
|
100
|
+
super.updated(changes);
|
|
101
|
+
if (changes.has("disabled")) {
|
|
102
|
+
if (this.disabled) {
|
|
103
|
+
this.setAttribute("aria-disabled", "true");
|
|
104
|
+
} else {
|
|
105
|
+
this.removeAttribute("aria-disabled");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
__decorateClass([
|
|
111
|
+
property({ type: Boolean, reflect: true })
|
|
112
|
+
], Tag.prototype, "deletable", 2);
|
|
113
|
+
__decorateClass([
|
|
114
|
+
property({ type: Boolean, reflect: true })
|
|
115
|
+
], Tag.prototype, "disabled", 2);
|
|
116
|
+
__decorateClass([
|
|
117
|
+
property({ type: Boolean, reflect: true })
|
|
118
|
+
], Tag.prototype, "readonly", 2);
|
|
119
|
+
//# sourceMappingURL=Tag.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Tag.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/button/sp-clear-button.js';\n\nimport styles from './tag.css.js';\n\n/**\n * @element sp-tag\n *\n * @slot - text content for labeling the tag\n * @slot avatar - an avatar element to display within the Tag\n * @slot icon - an icon element to display within the Tag\n */\nexport class Tag extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public deletable = false;\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public readonly = false;\n\n constructor() {\n super();\n this.addEventListener('focusin', this.handleFocusin);\n }\n\n private handleFocusin = (): void => {\n this.addEventListener('focusout', this.handleFocusout);\n this.addEventListener('keydown', this.handleKeydown);\n };\n\n private handleFocusout = (): void => {\n this.removeEventListener('keydown', this.handleKeydown);\n this.removeEventListener('focusout', this.handleFocusout);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (!this.deletable || this.disabled) {\n return;\n }\n const { code } = event;\n\n switch (code) {\n case 'Backspace':\n case 'Space':\n case 'Delete':\n this.delete();\n default:\n return;\n }\n };\n\n private delete(): void {\n if (this.readonly) {\n return;\n }\n const applyDefault = this.dispatchEvent(\n new Event('delete', {\n bubbles: true,\n cancelable: true,\n composed: true,\n })\n );\n if (!applyDefault) {\n return;\n }\n this.remove();\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot name=\"avatar\"></slot>\n <slot name=\"icon\"></slot>\n <span class=\"label\"><slot></slot></span>\n ${this.deletable\n ? html`\n <sp-clear-button\n class=\"clear-button\"\n ?disabled=${this.disabled}\n label=\"Remove\"\n size=\"s\"\n tabindex=\"-1\"\n @click=${this.delete}\n ></sp-clear-button>\n `\n : nothing}\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'listitem');\n }\n if (this.deletable) {\n this.setAttribute('tabindex', '0');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO;AAEP,OAAO,YAAY;AASZ,aAAM,YAAY,WAAW,iBAAiB;AAAA,EACjD,YAAY,CAAC,KAAK,KAAK,GAAG;AAAA,EAC1B,eAAe;AACnB,CAAC,EAAE;AAAA,EAcC,cAAc;AACV,UAAM;AATV,SAAO,YAAY;AAGnB,SAAO,WAAW;AAGlB,SAAO,WAAW;AAOlB,SAAQ,gBAAgB,MAAY;AAChC,WAAK,iBAAiB,YAAY,KAAK,cAAc;AACrD,WAAK,iBAAiB,WAAW,KAAK,aAAa;AAAA,IACvD;AAEA,SAAQ,iBAAiB,MAAY;AACjC,WAAK,oBAAoB,WAAW,KAAK,aAAa;AACtD,WAAK,oBAAoB,YAAY,KAAK,cAAc;AAAA,IAC5D;AAEA,SAAQ,gBAAgB,CAAC,UAA+B;AACpD,UAAI,CAAC,KAAK,aAAa,KAAK,UAAU;AAClC;AAAA,MACJ;AACA,YAAM,EAAE,KAAK,IAAI;AAEjB,cAAQ,MAAM;AAAA,QACV,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AACD,eAAK,OAAO;AAAA,QAChB;AACI;AAAA,MACR;AAAA,IACJ;AA3BI,SAAK,iBAAiB,WAAW,KAAK,aAAa;AAAA,EACvD;AAAA,EAhBA,WAA2B,SAAyB;AAChD,WAAO,CAAC,M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1,16 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var r=(l,i,e,s)=>{for(var t=s>1?void 0:s?p(i,e):i,a=l.length-1,o;a>=0;a--)(o=l[a])&&(t=(s?o(i,e,t):o(t))||t);return s&&t&&u(i,e,t),t};import{html as n,nothing as c,SizedMixin as h,SpectrumElement as b}from"@spectrum-web-components/base";import{property as d}from"@spectrum-web-components/base/src/decorators.js";import"@spectrum-web-components/button/sp-clear-button.js";import v from"./tag.css.js";export class Tag extends h(b,{validSizes:["s","m","l"],noDefaultSize:!0}){constructor(){super();this.deletable=!1;this.disabled=!1;this.readonly=!1;this.handleFocusin=()=>{this.addEventListener("focusout",this.handleFocusout),this.addEventListener("keydown",this.handleKeydown)};this.handleFocusout=()=>{this.removeEventListener("keydown",this.handleKeydown),this.removeEventListener("focusout",this.handleFocusout)};this.handleKeydown=e=>{if(!this.deletable||this.disabled)return;const{code:s}=e;switch(s){case"Backspace":case"Space":case"Delete":this.delete();default:return}};this.addEventListener("focusin",this.handleFocusin)}static get styles(){return[v]}delete(){this.readonly||!this.dispatchEvent(new Event("delete",{bubbles:!0,cancelable:!0,composed:!0}))||this.remove()}render(){return n`
|
|
2
|
+
<slot name="avatar"></slot>
|
|
3
|
+
<slot name="icon"></slot>
|
|
4
|
+
<span class="label"><slot></slot></span>
|
|
5
|
+
${this.deletable?n`
|
|
6
|
+
<sp-clear-button
|
|
7
|
+
class="clear-button"
|
|
8
|
+
?disabled=${this.disabled}
|
|
9
|
+
label="Remove"
|
|
10
|
+
size="s"
|
|
11
|
+
tabindex="-1"
|
|
12
|
+
@click=${this.delete}
|
|
13
|
+
></sp-clear-button>
|
|
14
|
+
`:c}
|
|
15
|
+
`}firstUpdated(e){super.firstUpdated(e),this.hasAttribute("role")||this.setAttribute("role","listitem"),this.deletable&&this.setAttribute("tabindex","0")}updated(e){super.updated(e),e.has("disabled")&&(this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"))}}r([d({type:Boolean,reflect:!0})],Tag.prototype,"deletable",2),r([d({type:Boolean,reflect:!0})],Tag.prototype,"disabled",2),r([d({type:Boolean,reflect:!0})],Tag.prototype,"readonly",2);
|
|
16
|
+
//# sourceMappingURL=Tag.js.map
|
package/src/Tag.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Tag.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport '@spectrum-web-components/button/sp-clear-button.js';\n\nimport styles from './tag.css.js';\n\n/**\n * @element sp-tag\n *\n * @slot - text content for labeling the tag\n * @slot avatar - an avatar element to display within the Tag\n * @slot icon - an icon element to display within the Tag\n */\nexport class Tag extends SizedMixin(SpectrumElement, {\n validSizes: ['s', 'm', 'l'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true })\n public deletable = false;\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public readonly = false;\n\n constructor() {\n super();\n this.addEventListener('focusin', this.handleFocusin);\n }\n\n private handleFocusin = (): void => {\n this.addEventListener('focusout', this.handleFocusout);\n this.addEventListener('keydown', this.handleKeydown);\n };\n\n private handleFocusout = (): void => {\n this.removeEventListener('keydown', this.handleKeydown);\n this.removeEventListener('focusout', this.handleFocusout);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n if (!this.deletable || this.disabled) {\n return;\n }\n const { code } = event;\n\n switch (code) {\n case 'Backspace':\n case 'Space':\n case 'Delete':\n this.delete();\n default:\n return;\n }\n };\n\n private delete(): void {\n if (this.readonly) {\n return;\n }\n const applyDefault = this.dispatchEvent(\n new Event('delete', {\n bubbles: true,\n cancelable: true,\n composed: true,\n })\n );\n if (!applyDefault) {\n return;\n }\n this.remove();\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot name=\"avatar\"></slot>\n <slot name=\"icon\"></slot>\n <span class=\"label\"><slot></slot></span>\n ${this.deletable\n ? html`\n <sp-clear-button\n class=\"clear-button\"\n ?disabled=${this.disabled}\n label=\"Remove\"\n size=\"s\"\n tabindex=\"-1\"\n @click=${this.delete}\n ></sp-clear-button>\n `\n : nothing}\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'listitem');\n }\n if (this.deletable) {\n this.setAttribute('tabindex', '0');\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,MAAO,qDAEP,OAAOC,MAAY,eASZ,aAAM,YAAYH,EAAWC,EAAiB,CACjD,WAAY,CAAC,IAAK,IAAK,GAAG,EAC1B,cAAe,EACnB,CAAC,CAAE,CAcC,aAAc,CACV,MAAM,EATV,KAAO,UAAY,GAGnB,KAAO,SAAW,GAGlB,KAAO,SAAW,GAOlB,KAAQ,cAAgB,IAAY,CAChC,KAAK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,KAAM,QAAS,QAAS,EAAK,CAAC,GAXjC,IAYF,wBAGAK,EAAA,CADNL,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAdjC,IAeF",
|
|
6
|
+
"names": ["html", "nothing", "SizedMixin", "SpectrumElement", "property", "styles", "event", "code", "changes", "__decorateClass"]
|
|
7
|
+
}
|
package/src/Tags.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CSSResultArray, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';
|
|
3
|
+
import { Tag } from './Tag.js';
|
|
4
|
+
declare const Tags_base: typeof SpectrumElement;
|
|
5
|
+
/**
|
|
6
|
+
* @element sp-tags
|
|
7
|
+
*
|
|
8
|
+
* @slot - Tag elements to manage as a group
|
|
9
|
+
*/
|
|
10
|
+
export declare class Tags extends Tags_base {
|
|
11
|
+
static get styles(): CSSResultArray;
|
|
12
|
+
defaultNodes: Node[];
|
|
13
|
+
get tags(): Tag[];
|
|
14
|
+
rovingTabindexController: RovingTabindexController<Tag>;
|
|
15
|
+
constructor();
|
|
16
|
+
focus(): void;
|
|
17
|
+
private handleFocusin;
|
|
18
|
+
private handleKeydown;
|
|
19
|
+
private handleFocusout;
|
|
20
|
+
private handleSlotchange;
|
|
21
|
+
protected render(): TemplateResult;
|
|
22
|
+
protected firstUpdated(): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
package/src/Tags.dev.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
SpectrumElement
|
|
15
|
+
} from "@spectrum-web-components/base";
|
|
16
|
+
import { queryAssignedNodes } from "@spectrum-web-components/base/src/decorators.js";
|
|
17
|
+
import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared/src/focus-visible.js";
|
|
18
|
+
import { RovingTabindexController } from "@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";
|
|
19
|
+
import { Tag } from "./Tag.dev.js";
|
|
20
|
+
import styles from "./tags.css.js";
|
|
21
|
+
export class Tags extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
this.rovingTabindexController = new RovingTabindexController(this, {
|
|
25
|
+
focusInIndex: (elements) => {
|
|
26
|
+
return elements.findIndex((el) => {
|
|
27
|
+
return !el.disabled && el.deletable;
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
elements: () => this.tags,
|
|
31
|
+
isFocusableElement: (el) => !el.disabled && el.deletable
|
|
32
|
+
});
|
|
33
|
+
this.handleFocusin = () => {
|
|
34
|
+
this.addEventListener("focusout", this.handleFocusout);
|
|
35
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
36
|
+
};
|
|
37
|
+
this.handleKeydown = (event) => {
|
|
38
|
+
const { code } = event;
|
|
39
|
+
if (code !== "PageUp" && code !== "PageDown") return;
|
|
40
|
+
const circularIndexedElement = (list, index) => list[(list.length + index) % list.length];
|
|
41
|
+
const tagsSiblings = [
|
|
42
|
+
...this.getRootNode().querySelectorAll(
|
|
43
|
+
"sp-tags"
|
|
44
|
+
)
|
|
45
|
+
];
|
|
46
|
+
if (tagsSiblings.length < 2) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
const currentIndex = tagsSiblings.indexOf(this);
|
|
51
|
+
const offset = code === "PageUp" ? -1 : 1;
|
|
52
|
+
let nextTagsIndex = currentIndex + offset;
|
|
53
|
+
let nextTags = circularIndexedElement(tagsSiblings, nextTagsIndex);
|
|
54
|
+
while (!nextTags.tags.length) {
|
|
55
|
+
nextTagsIndex += offset;
|
|
56
|
+
nextTags = circularIndexedElement(tagsSiblings, nextTagsIndex);
|
|
57
|
+
}
|
|
58
|
+
nextTags.focus();
|
|
59
|
+
};
|
|
60
|
+
this.handleFocusout = () => {
|
|
61
|
+
this.removeEventListener("keydown", this.handleKeydown);
|
|
62
|
+
this.removeEventListener("focusout", this.handleFocusout);
|
|
63
|
+
};
|
|
64
|
+
this.addEventListener("focusin", this.handleFocusin);
|
|
65
|
+
}
|
|
66
|
+
static get styles() {
|
|
67
|
+
return [styles];
|
|
68
|
+
}
|
|
69
|
+
get tags() {
|
|
70
|
+
return this.defaultNodes.filter(
|
|
71
|
+
(node) => node instanceof Tag
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
focus() {
|
|
75
|
+
this.rovingTabindexController.focus();
|
|
76
|
+
}
|
|
77
|
+
handleSlotchange() {
|
|
78
|
+
this.rovingTabindexController.clearElementCache();
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
return html`
|
|
82
|
+
<slot @slotchange=${this.handleSlotchange}></slot>
|
|
83
|
+
`;
|
|
84
|
+
}
|
|
85
|
+
firstUpdated() {
|
|
86
|
+
if (!this.hasAttribute("role")) {
|
|
87
|
+
this.setAttribute("role", "list");
|
|
88
|
+
}
|
|
89
|
+
if (!this.hasAttribute("aria-label")) {
|
|
90
|
+
this.setAttribute("aria-label", "Tags");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
__decorateClass([
|
|
95
|
+
queryAssignedNodes()
|
|
96
|
+
], Tags.prototype, "defaultNodes", 2);
|
|
97
|
+
//# sourceMappingURL=Tags.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Tags.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { queryAssignedNodes } from '@spectrum-web-components/base/src/decorators.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\nimport { Tag } from './Tag.dev.js'\n\nimport styles from './tags.css.js';\n\n/**\n * @element sp-tags\n *\n * @slot - Tag elements to manage as a group\n */\nexport class Tags extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @queryAssignedNodes()\n public defaultNodes!: Node[];\n\n public get tags(): Tag[] {\n return this.defaultNodes.filter(\n (node) => (node as HTMLElement) instanceof Tag\n ) as Tag[];\n }\n\n rovingTabindexController = new RovingTabindexController<Tag>(this, {\n focusInIndex: (elements: Tag[]) => {\n return elements.findIndex((el) => {\n return !el.disabled && el.deletable;\n });\n },\n elements: () => this.tags,\n isFocusableElement: (el: Tag) => !el.disabled && el.deletable,\n });\n\n constructor() {\n super();\n this.addEventListener('focusin', this.handleFocusin);\n }\n\n public override focus(): void {\n this.rovingTabindexController.focus();\n }\n\n private handleFocusin = (): void => {\n this.addEventListener('focusout', this.handleFocusout);\n this.addEventListener('keydown', this.handleKeydown);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n const { code } = event;\n if (code !== 'PageUp' && code !== 'PageDown') return;\n\n const circularIndexedElement = <T extends HTMLElement>(\n list: T[],\n index: number\n ): T => list[(list.length + index) % list.length];\n const tagsSiblings = [\n ...(this.getRootNode() as Document).querySelectorAll<Tags>(\n 'sp-tags'\n ),\n ];\n if (tagsSiblings.length < 2) {\n return;\n }\n event.preventDefault();\n const currentIndex = tagsSiblings.indexOf(this);\n const offset = code === 'PageUp' ? -1 : 1;\n let nextTagsIndex = currentIndex + offset;\n let nextTags = circularIndexedElement(tagsSiblings, nextTagsIndex);\n while (!nextTags.tags.length) {\n nextTagsIndex += offset;\n nextTags = circularIndexedElement(tagsSiblings, nextTagsIndex);\n }\n nextTags.focus();\n };\n\n private handleFocusout = (): void => {\n this.removeEventListener('keydown', this.handleKeydown);\n this.removeEventListener('focusout', this.handleFocusout);\n };\n\n private handleSlotchange(): void {\n this.rovingTabindexController.clearElementCache();\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n `;\n }\n\n protected override firstUpdated(): void {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'list');\n }\n if (!this.hasAttribute('aria-label')) {\n this.setAttribute('aria-label', 'Tags');\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,0BAA0B;AACnC,SAAS,iCAAiC;AAC1C,SAAS,gCAAgC;AAEzC,SAAS,WAAW;AAEpB,OAAO,YAAY;AAOZ,aAAM,aAAa,0BAA0B,eAAe,EAAE;AAAA,EAwBjE,cAAc;AACV,UAAM;AAXV,oCAA2B,IAAI,yBAA8B,MAAM;AAAA,MAC/D,cAAc,CAAC,aAAoB;AAC/B,eAAO,SAAS,UAAU,CAAC,OAAO;AAC9B,iBAAO,CAAC,GAAG,YAAY,GAAG;AAAA,QAC9B,CAAC;AA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AwCQ,mBAAyB;AAC7B,SAAK,yBAAyB,kBAAkB;AAAA,EACpD;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA,gCACiB,KAAK,gBAAgB;AAAA;AAAA,EAEjD;AAAA,EAEmB,eAAqB;AACpC,QAAI,CAAC,KAAK,aAAa,MAAM,GAAG;AAC5B,WAAK,aAAa,QAAQ,MAAM;AAAA,IACpC;AACA,QAAI,CAAC,KAAK,aAAa,YAAY,GAAG;AAClC,WAAK,aAAa,cAAc,MAAM;AAAA,IAC1C;AAAA,EACJ;AACJ;AAnFW;AAAA,EADN,mBAAmB;AAAA,GALX,KAMF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/Tags.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=(r,n,e,t)=>{for(var s=t>1?void 0:t?f(n,e):n,o=r.length-1,i;o>=0;o--)(i=r[o])&&(s=(t?i(n,e,s):i(s))||s);return t&&s&&g(n,e,s),s};import{html as m,SpectrumElement as p}from"@spectrum-web-components/base";import{queryAssignedNodes as v}from"@spectrum-web-components/base/src/decorators.js";import{FocusVisiblePolyfillMixin as b}from"@spectrum-web-components/shared/src/focus-visible.js";import{RovingTabindexController as T}from"@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";import{Tag as x}from"./Tag.js";import y from"./tags.css.js";export class Tags extends b(p){constructor(){super();this.rovingTabindexController=new T(this,{focusInIndex:e=>e.findIndex(t=>!t.disabled&&t.deletable),elements:()=>this.tags,isFocusableElement:e=>!e.disabled&&e.deletable});this.handleFocusin=()=>{this.addEventListener("focusout",this.handleFocusout),this.addEventListener("keydown",this.handleKeydown)};this.handleKeydown=e=>{const{code:t}=e;if(t!=="PageUp"&&t!=="PageDown")return;const s=(d,c)=>d[(d.length+c)%d.length],o=[...this.getRootNode().querySelectorAll("sp-tags")];if(o.length<2)return;e.preventDefault();const i=o.indexOf(this),u=t==="PageUp"?-1:1;let l=i+u,a=s(o,l);for(;!a.tags.length;)l+=u,a=s(o,l);a.focus()};this.handleFocusout=()=>{this.removeEventListener("keydown",this.handleKeydown),this.removeEventListener("focusout",this.handleFocusout)};this.addEventListener("focusin",this.handleFocusin)}static get styles(){return[y]}get tags(){return this.defaultNodes.filter(e=>e instanceof x)}focus(){this.rovingTabindexController.focus()}handleSlotchange(){this.rovingTabindexController.clearElementCache()}render(){return m`
|
|
2
|
+
<slot @slotchange=${this.handleSlotchange}></slot>
|
|
3
|
+
`}firstUpdated(){this.hasAttribute("role")||this.setAttribute("role","list"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Tags")}}h([v()],Tags.prototype,"defaultNodes",2);
|
|
4
|
+
//# sourceMappingURL=Tags.js.map
|
package/src/Tags.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Tags.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { queryAssignedNodes } from '@spectrum-web-components/base/src/decorators.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\nimport { Tag } from './Tag.js';\n\nimport styles from './tags.css.js';\n\n/**\n * @element sp-tags\n *\n * @slot - Tag elements to manage as a group\n */\nexport class Tags extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @queryAssignedNodes()\n public defaultNodes!: Node[];\n\n public get tags(): Tag[] {\n return this.defaultNodes.filter(\n (node) => (node as HTMLElement) instanceof Tag\n ) as Tag[];\n }\n\n rovingTabindexController = new RovingTabindexController<Tag>(this, {\n focusInIndex: (elements: Tag[]) => {\n return elements.findIndex((el) => {\n return !el.disabled && el.deletable;\n });\n },\n elements: () => this.tags,\n isFocusableElement: (el: Tag) => !el.disabled && el.deletable,\n });\n\n constructor() {\n super();\n this.addEventListener('focusin', this.handleFocusin);\n }\n\n public override focus(): void {\n this.rovingTabindexController.focus();\n }\n\n private handleFocusin = (): void => {\n this.addEventListener('focusout', this.handleFocusout);\n this.addEventListener('keydown', this.handleKeydown);\n };\n\n private handleKeydown = (event: KeyboardEvent): void => {\n const { code } = event;\n if (code !== 'PageUp' && code !== 'PageDown') return;\n\n const circularIndexedElement = <T extends HTMLElement>(\n list: T[],\n index: number\n ): T => list[(list.length + index) % list.length];\n const tagsSiblings = [\n ...(this.getRootNode() as Document).querySelectorAll<Tags>(\n 'sp-tags'\n ),\n ];\n if (tagsSiblings.length < 2) {\n return;\n }\n event.preventDefault();\n const currentIndex = tagsSiblings.indexOf(this);\n const offset = code === 'PageUp' ? -1 : 1;\n let nextTagsIndex = currentIndex + offset;\n let nextTags = circularIndexedElement(tagsSiblings, nextTagsIndex);\n while (!nextTags.tags.length) {\n nextTagsIndex += offset;\n nextTags = circularIndexedElement(tagsSiblings, nextTagsIndex);\n }\n nextTags.focus();\n };\n\n private handleFocusout = (): void => {\n this.removeEventListener('keydown', this.handleKeydown);\n this.removeEventListener('focusout', this.handleFocusout);\n };\n\n private handleSlotchange(): void {\n this.rovingTabindexController.clearElementCache();\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot @slotchange=${this.handleSlotchange}></slot>\n `;\n }\n\n protected override firstUpdated(): void {\n if (!this.hasAttribute('role')) {\n this.setAttribute('role', 'list');\n }\n if (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tD,KAAK,oBAAoB,WAAY,KAAK,cAAc,CAC5D,EA3CI,KAAK,iBAAiB,UAAW,KAAK,aAAa,CACvD,CA1BA,WAA2B,QAAyB,CAChD,MAAO,CAACZ,CAAM,CAClB,CAKA,IAAW,MAAc,CACrB,OAAO,KAAK,aAAa,OACpBa,GAAUA,aAAgCd,CAC/C,CACJ,CAiBgB,OAAc,CAC1B,KAAK,yBAAyB,MAAM,CACxC,CAwCQ,kBAAyB,CAC7B,KAAK,yBAAyB,kBAAkB,CACpD,CAEmB,QAAyB,CACxC,OAAOL;AAAA,gCACiB,KAAK,gBAAgB;AAAA,SAEjD,CAEmB,cAAqB,CAC/B,KAAK,aAAa,MAAM,GACzB,KAAK,aAAa,OAAQ,MAAM,EAE/B,KAAK,aAAa,YAAY,GAC/B,KAAK,aAAa,aAAc,MAAM,CAE9C,CACJ,CAnFWoB,EAAA,CADNlB,EAAmB,GALX,KAMF",
|
|
6
|
+
"names": ["html", "SpectrumElement", "queryAssignedNodes", "FocusVisiblePolyfillMixin", "RovingTabindexController", "Tag", "styles", "elements", "el", "event", "code", "circularIndexedElement", "list", "index", "tagsSiblings", "currentIndex", "offset", "nextTagsIndex", "nextTags", "node", "__decorateClass"]
|
|
7
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './Tags.dev.js'\nexport * from './Tag.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAYA,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nexport * from './Tags.js';\nexport * from './Tag.js';\n"],
|
|
5
|
+
"mappings": "aAYA,WAAc,YACd,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{border-color:var(--highcontrast-tag-border-color,var(--mod-tag-border-color,var(--spectrum-tag-border-color)));background-color:var(--highcontrast-tag-background-color,var(--mod-tag-background-color,var(--spectrum-tag-background-color)));color:var(--highcontrast-tag-content-color,var(--mod-tag-content-color,var(--spectrum-tag-content-color)));border-radius:var(--mod-tag-corner-radius,var(--spectrum-tag-corner-radius));border-width:var(--mod-tag-border-width,var(--spectrum-tag-border-width));block-size:var(--mod-tag-height,var(--spectrum-tag-height));box-sizing:border-box;vertical-align:bottom;max-inline-size:100%;-webkit-user-select:none;user-select:none;transition:border-color var(--mod-tag-animation-duration,var(--spectrum-tag-animation-duration))ease-in-out,color var(--mod-tag-animation-duration,var(--spectrum-tag-animation-duration))ease-in-out,box-shadow var(--mod-tag-animation-duration,var(--spectrum-tag-animation-duration))ease-in-out,background-color var(--mod-tag-animation-duration,var(--spectrum-tag-animation-duration))ease-in-out;border-style:solid;outline:none;align-items:center;padding-inline-start:calc(var(--mod-tag-spacing-inline-start,var(--spectrum-tag-spacing-inline-start)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));padding-inline-end:0;display:inline-flex;position:relative}::slotted([slot=icon]){block-size:var(--mod-tag-icon-size,var(--spectrum-tag-icon-size));inline-size:var(--mod-tag-icon-size,var(--spectrum-tag-icon-size));flex-shrink:0;margin-block-start:calc(var(--mod-tag-icon-spacing-block-start,var(--spectrum-tag-icon-spacing-block-start)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));margin-block-end:calc(var(--mod-tag-icon-spacing-block-end,var(--spectrum-tag-icon-spacing-block-end)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));margin-inline-end:var(--mod-tag-icon-spacing-inline-end,var(--spectrum-tag-icon-spacing-inline-end))}::slotted([slot=avatar]){margin-block-start:calc(var(--mod-tag-avatar-spacing-block-start,var(--spectrum-tag-avatar-spacing-block-start)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));margin-block-end:calc(var(--mod-tag-avatar-spacing-block-end,var(--spectrum-tag-avatar-spacing-block-end)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));margin-inline-end:var(--mod-tag-avatar-spacing-inline-end,var(--spectrum-tag-avatar-spacing-inline-end))}.clear-button{--mod-clear-button-width:fit-content;--spectrum-clearbutton-fill-size:fit-content;--spectrum-clearbutton-fill-background-color:transparent;box-sizing:border-box;color:currentColor;margin-inline-start:calc(var(--mod-tag-clear-button-spacing-inline-start,var(--spectrum-tag-clear-button-spacing-inline-start)) + var(--mod-tag-label-spacing-inline-end,var(--spectrum-tag-label-spacing-inline-end))*-1);margin-inline-end:calc(var(--mod-tag-clear-button-spacing-inline-end,var(--spectrum-tag-clear-button-spacing-inline-end)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));padding-block-start:calc(var(--mod-tag-clear-button-spacing-block,var(--spectrum-tag-clear-button-spacing-block)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));padding-block-end:calc(var(--mod-tag-clear-button-spacing-block,var(--spectrum-tag-clear-button-spacing-block)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)))}.clear-button .spectrum-ClearButton-fill{background-color:var(--mod-clearbutton-fill-background-color,var(--spectrum-clearbutton-fill-background-color));inline-size:var(--mod-clearbutton-fill-size,var(--spectrum-clearbutton-fill-size));block-size:var(--mod-clearbutton-fill-size,var(--spectrum-clearbutton-fill-size))}.label{block-size:100%;box-sizing:border-box;line-height:var(--mod-tag-label-line-height,var(--spectrum-tag-label-line-height));font-weight:var(--mod-tag-label-font-weight,var(--spectrum-tag-label-font-weight));font-size:var(--mod-tag-font-size,var(--spectrum-tag-font-size));cursor:default;white-space:nowrap;text-overflow:ellipsis;flex:auto;margin-inline-end:calc(var(--mod-tag-label-spacing-inline-end,var(--spectrum-tag-label-spacing-inline-end)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));padding-block-start:calc(var(--mod-tag-label-spacing-block,var(--spectrum-tag-label-spacing-block)) - var(--mod-tag-border-width,var(--spectrum-tag-border-width)));overflow:hidden}:host(:is(:active,[active])){border-color:var(--highcontrast-tag-border-color-active,var(--mod-tag-border-color-active,var(--spectrum-tag-border-color-active)));background-color:var(--highcontrast-tag-background-color-active,var(--mod-tag-background-color-active,var(--spectrum-tag-background-color-active)));color:var(--highcontrast-tag-content-color-active,var(--mod-tag-content-color-active,var(--spectrum-tag-content-color-active)))}:host([focused]),:host(:focus-visible){border-color:var(--highcontrast-tag-border-color-focus,var(--mod-tag-border-color-focus,var(--spectrum-tag-border-color-focus)));background-color:var(--highcontrast-tag-background-color-focus,var(--mod-tag-background-color-focus,var(--spectrum-tag-background-color-focus)));color:var(--highcontrast-tag-content-color-focus,var(--mod-tag-content-color-focus,var(--spectrum-tag-content-color-focus)))}:host([focused]):after,:host(:focus-visible):after{content:"";border-color:var(--highcontrast-tag-focus-ring-color,var(--mod-tag-focus-ring-color,var(--spectrum-tag-focus-ring-color)));border-radius:calc(var(--mod-tag-corner-radius,var(--spectrum-tag-corner-radius)) + var(--mod-tag-focus-ring-gap,var(--spectrum-tag-focus-ring-gap)) + var(--mod-tag-border-width,var(--spectrum-tag-border-width)));border-width:var(--mod-tag-focus-ring-thickness,var(--spectrum-tag-focus-ring-thickness));pointer-events:none;border-style:solid;display:inline-block;position:absolute;inset-block-start:calc(var(--mod-tag-focus-ring-gap,var(--spectrum-tag-focus-ring-gap))*-1 - var(--mod-tag-border-width,var(--spectrum-tag-border-width)) - var(--mod-tag-focus-ring-thickness,var(--spectrum-tag-focus-ring-thickness)));inset-block-end:calc(var(--mod-tag-focus-ring-gap,var(--spectrum-tag-focus-ring-gap))*-1 - var(--mod-tag-border-width,var(--spectrum-tag-border-width)) - var(--mod-tag-focus-ring-thickness,var(--spectrum-tag-focus-ring-thickness)));inset-inline-start:calc(var(--mod-tag-focus-ring-gap,var(--spectrum-tag-focus-ring-gap))*-1 - var(--mod-tag-border-width,var(--spectrum-tag-border-width)) - var(--mod-tag-focus-ring-thickness,var(--spectrum-tag-focus-ring-thickness)));inset-inline-end:calc(var(--mod-tag-focus-ring-gap,var(--spectrum-tag-focus-ring-gap))*-1 - var(--mod-tag-border-width,var(--spectrum-tag-border-width)) - var(--mod-tag-focus-ring-thickness,var(--spectrum-tag-focus-ring-thickness)))}:host([selected]){border-color:var(--highcontrast-tag-border-color-selected,var(--mod-tag-border-color-selected,var(--spectrum-tag-border-color-selected)));background-color:var(--highcontrast-tag-background-color-selected,var(--mod-tag-background-color-selected,var(--spectrum-tag-background-color-selected)));color:var(--highcontrast-tag-content-color-selected,var(--mod-tag-content-color-selected,var(--spectrum-tag-content-color-selected)))}:host([selected]:is(:active,[active])){border-color:var(--highcontrast-tag-border-color-selected-active,var(--mod-tag-border-color-selected-active,var(--spectrum-tag-border-color-selected-active)));background-color:var(--highcontrast-tag-background-color-selected-active,var(--mod-tag-background-color-selected-active,var(--spectrum-tag-background-color-selected-active)))}:host([selected][focused]),:host([selected]:focus-visible){border-color:var(--highcontrast-tag-border-color-selected-focus,var(--mod-tag-border-color-selected-focus,var(--spectrum-tag-border-color-selected-focus)));background-color:var(--highcontrast-tag-background-color-selected-focus,var(--mod-tag-background-color-selected-focus,var(--spectrum-tag-background-color-selected-focus)))}:host([invalid]){border-color:var(--highcontrast-tag-border-color-invalid,var(--mod-tag-border-color-invalid,var(--spectrum-tag-border-color-invalid)));color:var(--highcontrast-tag-content-color-invalid,var(--mod-tag-content-color-invalid,var(--spectrum-tag-content-color-invalid)))}:host([invalid]:is(:active,[active])){border-color:var(--highcontrast-tag-border-color-invalid-active,var(--mod-tag-border-color-invalid-active,var(--spectrum-tag-border-color-invalid-active)));color:var(--highcontrast-tag-content-color-invalid-active,var(--mod-tag-content-color-invalid-active,var(--spectrum-tag-content-color-invalid-active)))}:host([invalid][focused]),:host([invalid]:focus-visible){border-color:var(--highcontrast-tag-border-color-invalid-focus,var(--mod-tag-border-color-invalid-focus,var(--spectrum-tag-border-color-invalid-focus)));color:var(--highcontrast-tag-content-color-invalid-focus,var(--mod-tag-content-color-invalid-focus,var(--spectrum-tag-content-color-invalid-focus)))}:host([invalid][selected]){border-color:var(--highcontrast-tag-border-color-invalid-selected,var(--mod-tag-border-color-invalid-selected,var(--spectrum-tag-border-color-invalid-selected)));background-color:var(--highcontrast-tag-background-color-invalid-selected,var(--mod-tag-background-color-invalid-selected,var(--spectrum-tag-background-color-invalid-selected)));color:var(--highcontrast-tag-content-color-invalid-selected,var(--mod-tag-content-color-invalid-selected,var(--spectrum-tag-content-color-invalid-selected)))}:host([invalid][selected]:is(:active,[active])){border-color:var(--highcontrast-tag-border-color-invalid-selected-active,var(--mod-tag-border-color-invalid-selected-active,var(--spectrum-tag-border-color-invalid-selected-active)));background-color:var(--highcontrast-tag-background-color-invalid-selected-active,var(--mod-tag-background-color-invalid-selected-active,var(--spectrum-tag-background-color-invalid-selected-active)))}:host([invalid][selected][focused]),:host([invalid][selected]:focus-visible){border-color:var(--highcontrast-tag-border-color-invalid-selected-focus,var(--mod-tag-border-color-invalid-selected-focus,var(--spectrum-tag-border-color-invalid-selected-focus)));background-color:var(--highcontrast-tag-background-color-invalid-selected-focus,var(--mod-tag-background-color-invalid-selected-focus,var(--spectrum-tag-background-color-invalid-selected-focus)))}:host([emphasized]){border-color:var(--highcontrast-tag-border-color-emphasized,var(--mod-tag-border-color-emphasized,var(--spectrum-tag-border-color-emphasized)));background-color:var(--highcontrast-tag-background-color-emphasized,var(--mod-tag-background-color-emphasized,var(--spectrum-tag-background-color-emphasized)));color:var(--highcontrast-tag-content-color-emphasized,var(--mod-tag-content-color-emphasized,var(--spectrum-tag-content-color-emphasized)))}@media (hover:hover){:host(:hover){border-color:var(--highcontrast-tag-border-color-hover,var(--mod-tag-border-color-hover,var(--spectrum-tag-border-color-hover)));background-color:var(--highcontrast-tag-background-color-hover,var(--mod-tag-background-color-hover,var(--spectrum-tag-background-color-hover)));color:var(--highcontrast-tag-content-color-hover,var(--mod-tag-content-color-hover,var(--spectrum-tag-content-color-hover)))}:host([selected]:hover){border-color:var(--highcontrast-tag-border-color-selected-hover,var(--mod-tag-border-color-selected-hover,var(--spectrum-tag-border-color-selected-hover)));background-color:var(--highcontrast-tag-background-color-selected-hover,var(--mod-tag-background-color-selected-hover,var(--spectrum-tag-background-color-selected-hover)));color:var(--highcontrast-tag-content-color-selected,var(--mod-tag-content-color-selected,var(--spectrum-tag-content-color-selected)))}:host([invalid]:hover){border-color:var(--highcontrast-tag-border-color-invalid-hover,var(--mod-tag-border-color-invalid-hover,var(--spectrum-tag-border-color-invalid-hover)));color:var(--highcontrast-tag-content-color-invalid-hover,var(--mod-tag-content-color-invalid-hover,var(--spectrum-tag-content-color-invalid-hover)))}:host([invalid][selected]:hover){border-color:var(--highcontrast-tag-border-color-invalid-selected-hover,var(--mod-tag-border-color-invalid-selected-hover,var(--spectrum-tag-border-color-invalid-selected-hover)));background-color:var(--highcontrast-tag-background-color-invalid-selected-hover,var(--mod-tag-background-color-invalid-selected-hover,var(--spectrum-tag-background-color-invalid-selected-hover)));color:var(--highcontrast-tag-content-color-invalid-selected,var(--mod-tag-content-color-invalid-selected,var(--spectrum-tag-content-color-invalid-selected)))}:host([emphasized]:hover){border-color:var(--highcontrast-tag-border-color-emphasized-hover,var(--mod-tag-border-color-emphasized-hover,var(--spectrum-tag-border-color-emphasized-hover)));background-color:var(--highcontrast-tag-background-color-emphasized-hover,var(--mod-tag-background-color-emphasized-hover,var(--spectrum-tag-background-color-emphasized-hover)));color:var(--highcontrast-tag-content-color-emphasized,var(--mod-tag-content-color-emphasized,var(--spectrum-tag-content-color-emphasized)))}}:host([emphasized]:is(:active,[active])){border-color:var(--highcontrast-tag-border-color-emphasized-active,var(--mod-tag-border-color-emphasized-active,var(--spectrum-tag-border-color-emphasized-active)));background-color:var(--highcontrast-tag-background-color-emphasized-active,var(--mod-tag-background-color-emphasized-active,var(--spectrum-tag-background-color-emphasized-active)))}:host([emphasized][focused]),:host([emphasized]:focus-visible){border-color:var(--highcontrast-tag-border-color-emphasized-focus,var(--mod-tag-border-color-emphasized-focus,var(--spectrum-tag-border-color-emphasized-focus)));background-color:var(--highcontrast-tag-background-color-emphasized-focus,var(--mod-tag-background-color-emphasized-focus,var(--spectrum-tag-background-color-emphasized-focus)))}:host([disabled]){border-color:var(--highcontrast-tag-border-color-disabled,var(--mod-tag-border-color-disabled,var(--spectrum-tag-border-color-disabled)));background-color:var(--highcontrast-tag-background-color-disabled,var(--mod-tag-background-color-disabled,var(--spectrum-tag-background-color-disabled)));color:var(--highcontrast-tag-content-color-disabled,var(--mod-tag-content-color-disabled,var(--spectrum-tag-content-color-disabled)));pointer-events:none}:host([disabled]) ::slotted([slot=avatar]){opacity:var(--mod-avatar-opacity-disabled,var(--spectrum-avatar-opacity-disabled))}@media (forced-colors:active){:host{--highcontrast-tag-border-color:ButtonText;--highcontrast-tag-border-color-hover:ButtonText;--highcontrast-tag-border-color-active:ButtonText;--highcontrast-tag-border-color-focus:Highlight;--highcontrast-tag-background-color:ButtonFace;--highcontrast-tag-background-color-hover:ButtonFace;--highcontrast-tag-background-color-active:ButtonFace;--highcontrast-tag-background-color-focus:ButtonFace;--highcontrast-tag-content-color:ButtonText;--highcontrast-tag-content-color-hover:ButtonText;--highcontrast-tag-content-color-active:ButtonText;--highcontrast-tag-content-color-focus:ButtonText;--highcontrast-tag-focus-ring-color:Highlight;forced-color-adjust:none}:host([selected]){--highcontrast-tag-border-color-selected:Highlight;--highcontrast-tag-border-color-selected-hover:Highlight;--highcontrast-tag-border-color-selected-active:Highlight;--highcontrast-tag-border-color-selected-focus:Highlight;--highcontrast-tag-background-color-selected:Highlight;--highcontrast-tag-background-color-selected-hover:Highlight;--highcontrast-tag-background-color-selected-active:Highlight;--highcontrast-tag-background-color-selected-focus:Highlight;--highcontrast-tag-content-color-selected:HighlightText}:host([disabled]){--highcontrast-tag-border-color-disabled:GrayText;--highcontrast-tag-background-color-disabled:ButtonFace;--highcontrast-tag-content-color-disabled:GrayText}:host([invalid]){--highcontrast-tag-border-color-invalid:Highlight;--highcontrast-tag-border-color-invalid-hover:Highlight;--highcontrast-tag-border-color-invalid-active:Highlight;--highcontrast-tag-border-color-invalid-focus:Highlight;--highcontrast-tag-content-color-invalid:CanvasText;--highcontrast-tag-content-color-invalid-hover:CanvasText;--highcontrast-tag-content-color-invalid-active:CanvasText;--highcontrast-tag-content-color-invalid-focus:CanvasText}:host([invalid][selected]){--highcontrast-tag-border-color-invalid-selected:Highlight;--highcontrast-tag-border-color-invalid-selected-hover:Highlight;--highcontrast-tag-border-color-invalid-selected-focus:Highlight;--highcontrast-tag-border-color-invalid-selected-active:Highlight;--highcontrast-tag-background-color-invalid-selected:Highlight;--highcontrast-tag-background-color-invalid-selected-hover:Highlight;--highcontrast-tag-background-color-invalid-selected-active:Highlight;--highcontrast-tag-background-color-invalid-selected-focus:Highlight;--highcontrast-tag-content-color-invalid-selected:HighlightText}:host([emphasized]){--highcontrast-tag-border-color-emphasized:Highlight;--highcontrast-tag-border-color-emphasized-hover:Highlight;--highcontrast-tag-border-color-emphasized-active:Highlight;--highcontrast-tag-border-color-emphasized-focus:Highlight;--highcontrast-tag-background-color-emphasized:ButtonFace;--highcontrast-tag-background-color-emphasized-hover:ButtonFace;--highcontrast-tag-background-color-emphasized-active:ButtonFace;--highcontrast-tag-background-color-emphasized-focus:ButtonFace;--highcontrast-tag-content-color-emphasized:CanvasText}}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=spectrum-tag.css.dev.js.map
|