@spectrum-web-components/swatch 0.34.0 → 0.35.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/README.md +1 -1
- package/custom-elements.json +4 -11
- package/package.json +9 -9
- package/src/SwatchGroup.d.ts +3 -4
- package/src/SwatchGroup.dev.js +20 -15
- package/src/SwatchGroup.dev.js.map +2 -2
- package/src/SwatchGroup.js +2 -2
- package/src/SwatchGroup.js.map +3 -3
- package/src/spectrum-swatch.css.dev.js +1 -1
- package/src/spectrum-swatch.css.dev.js.map +1 -1
- package/src/spectrum-swatch.css.js +1 -1
- package/src/spectrum-swatch.css.js.map +1 -1
- package/src/swatch.css.dev.js +1 -1
- package/src/swatch.css.dev.js.map +1 -1
- package/src/swatch.css.js +1 -1
- package/src/swatch.css.js.map +1 -1
- package/stories/swatch-group.stories.js +2 -2
- package/stories/swatch-group.stories.js.map +1 -1
- package/stories/swatch-sizes.stories.js +1 -1
- package/stories/swatch-sizes.stories.js.map +1 -1
- package/stories/swatch.stories.js +1 -1
- package/stories/swatch.stories.js.map +1 -1
- package/test/swatch-group.test.js +55 -2
- package/test/swatch-group.test.js.map +2 -2
- package/test/swatch.test.js +1 -1
- package/test/swatch.test.js.map +1 -1
package/README.md
CHANGED
|
@@ -201,7 +201,7 @@ The `disabled` attribute/property determines prevents interaction on the `<sp-sw
|
|
|
201
201
|
The `mixed-value` attribute and `mixedValue` property outline when an `<sp-swatch>` element represents more than one color.
|
|
202
202
|
|
|
203
203
|
```html
|
|
204
|
-
<sp-swatch-group>
|
|
204
|
+
<sp-swatch-group selects="multiple">
|
|
205
205
|
<sp-swatch mixed-value></sp-swatch>
|
|
206
206
|
<sp-swatch mixed-value rounding="full"></sp-swatch>
|
|
207
207
|
<sp-swatch mixed-value shape="rectangle"></sp-swatch>
|
package/custom-elements.json
CHANGED
|
@@ -407,22 +407,14 @@
|
|
|
407
407
|
"text": "string[]"
|
|
408
408
|
},
|
|
409
409
|
"privacy": "public",
|
|
410
|
+
"default": "[]",
|
|
410
411
|
"attribute": "selected"
|
|
411
412
|
},
|
|
412
|
-
{
|
|
413
|
-
"kind": "field",
|
|
414
|
-
"name": "_selected",
|
|
415
|
-
"type": {
|
|
416
|
-
"text": "string[]"
|
|
417
|
-
},
|
|
418
|
-
"privacy": "private",
|
|
419
|
-
"default": "[]"
|
|
420
|
-
},
|
|
421
413
|
{
|
|
422
414
|
"kind": "field",
|
|
423
415
|
"name": "selects",
|
|
424
416
|
"type": {
|
|
425
|
-
"text": "
|
|
417
|
+
"text": "SwatchSelects"
|
|
426
418
|
},
|
|
427
419
|
"privacy": "public",
|
|
428
420
|
"attribute": "selects"
|
|
@@ -565,12 +557,13 @@
|
|
|
565
557
|
"type": {
|
|
566
558
|
"text": "string[]"
|
|
567
559
|
},
|
|
560
|
+
"default": "[]",
|
|
568
561
|
"fieldName": "selected"
|
|
569
562
|
},
|
|
570
563
|
{
|
|
571
564
|
"name": "selects",
|
|
572
565
|
"type": {
|
|
573
|
-
"text": "
|
|
566
|
+
"text": "SwatchSelects"
|
|
574
567
|
},
|
|
575
568
|
"fieldName": "selects"
|
|
576
569
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/swatch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -67,15 +67,15 @@
|
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@lit-labs/observers": "^2.0.0",
|
|
70
|
-
"@spectrum-web-components/base": "^0.
|
|
71
|
-
"@spectrum-web-components/icon": "^0.
|
|
72
|
-
"@spectrum-web-components/icons-ui": "^0.
|
|
73
|
-
"@spectrum-web-components/reactive-controllers": "^0.
|
|
74
|
-
"@spectrum-web-components/shared": "^0.
|
|
70
|
+
"@spectrum-web-components/base": "^0.35.0",
|
|
71
|
+
"@spectrum-web-components/icon": "^0.35.0",
|
|
72
|
+
"@spectrum-web-components/icons-ui": "^0.35.0",
|
|
73
|
+
"@spectrum-web-components/reactive-controllers": "^0.35.0",
|
|
74
|
+
"@spectrum-web-components/shared": "^0.35.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@spectrum-css/swatch": "^4.0.
|
|
78
|
-
"@spectrum-css/swatchgroup": "^2.0.
|
|
77
|
+
"@spectrum-css/swatch": "^4.0.31",
|
|
78
|
+
"@spectrum-css/swatchgroup": "^2.0.55"
|
|
79
79
|
},
|
|
80
80
|
"types": "./src/index.d.ts",
|
|
81
81
|
"customElements": "custom-elements.json",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"./sp-*.js",
|
|
84
84
|
"./**/*.dev.js"
|
|
85
85
|
],
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "1ee5a6c92838cdf48321276d97f61c20f8476ac1"
|
|
87
87
|
}
|
package/src/SwatchGroup.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CSSResultArray, ElementSize, PropertyValues, SpectrumElement, TemplateR
|
|
|
2
2
|
import { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';
|
|
3
3
|
import type { Swatch, SwatchBorder, SwatchRounding, SwatchShape } from './Swatch.js';
|
|
4
4
|
export declare type SwatchGroupSizes = Exclude<ElementSize, 'xxs' | 'xl' | 'xxl'>;
|
|
5
|
+
export declare type SwatchSelects = 'single' | 'multiple' | undefined;
|
|
5
6
|
declare const SwatchGroup_base: typeof SpectrumElement & {
|
|
6
7
|
new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
|
|
7
8
|
prototype: import("@spectrum-web-components/base").SizedElementInterface;
|
|
@@ -15,10 +16,8 @@ export declare class SwatchGroup extends SwatchGroup_base {
|
|
|
15
16
|
static get styles(): CSSResultArray;
|
|
16
17
|
border: SwatchBorder;
|
|
17
18
|
rounding: SwatchRounding;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
private _selected;
|
|
21
|
-
selects: 'single' | 'multiple' | undefined;
|
|
19
|
+
selected: string[];
|
|
20
|
+
selects: SwatchSelects;
|
|
22
21
|
private selectedSet;
|
|
23
22
|
shape: SwatchShape;
|
|
24
23
|
density: 'compact' | 'spacious' | undefined;
|
package/src/SwatchGroup.dev.js
CHANGED
|
@@ -24,7 +24,7 @@ export class SwatchGroup extends SizedMixin(SpectrumElement, {
|
|
|
24
24
|
}) {
|
|
25
25
|
constructor() {
|
|
26
26
|
super();
|
|
27
|
-
this.
|
|
27
|
+
this.selected = [];
|
|
28
28
|
this.selectedSet = /* @__PURE__ */ new Set();
|
|
29
29
|
this.rovingTabindexController = new RovingTabindexController(this, {
|
|
30
30
|
focusInIndex: (elements) => {
|
|
@@ -55,7 +55,7 @@ export class SwatchGroup extends SizedMixin(SpectrumElement, {
|
|
|
55
55
|
this.selectedSet.delete(value);
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
-
this.
|
|
58
|
+
this.selected = [...this.selectedSet];
|
|
59
59
|
};
|
|
60
60
|
new MutationController(this, {
|
|
61
61
|
config: {
|
|
@@ -71,16 +71,6 @@ export class SwatchGroup extends SizedMixin(SpectrumElement, {
|
|
|
71
71
|
static get styles() {
|
|
72
72
|
return [styles];
|
|
73
73
|
}
|
|
74
|
-
get selected() {
|
|
75
|
-
return this._selected;
|
|
76
|
-
}
|
|
77
|
-
set selected(selected) {
|
|
78
|
-
if (selected === this.selected)
|
|
79
|
-
return;
|
|
80
|
-
const oldSelected = this.selected;
|
|
81
|
-
this._selected = selected;
|
|
82
|
-
this.requestUpdate("selected", oldSelected);
|
|
83
|
-
}
|
|
84
74
|
focus(options) {
|
|
85
75
|
this.rovingTabindexController.focus(options);
|
|
86
76
|
}
|
|
@@ -113,7 +103,7 @@ export class SwatchGroup extends SizedMixin(SpectrumElement, {
|
|
|
113
103
|
this.selectedSet.delete(target.value);
|
|
114
104
|
}
|
|
115
105
|
}
|
|
116
|
-
this.
|
|
106
|
+
this.selected = [...this.selectedSet];
|
|
117
107
|
const applyDefault = this.dispatchEvent(
|
|
118
108
|
new Event("change", {
|
|
119
109
|
cancelable: true,
|
|
@@ -127,6 +117,9 @@ export class SwatchGroup extends SizedMixin(SpectrumElement, {
|
|
|
127
117
|
}
|
|
128
118
|
getPassthroughSwatchActions(changes) {
|
|
129
119
|
const targetValues = {};
|
|
120
|
+
if (changes.has("selects") && (this.selects || typeof changes.get("selects") !== "undefined")) {
|
|
121
|
+
targetValues.selects = this.selects;
|
|
122
|
+
}
|
|
130
123
|
if (changes.has("border") && (this.border || typeof changes.get("border") !== "undefined")) {
|
|
131
124
|
targetValues.border = this.border;
|
|
132
125
|
}
|
|
@@ -142,6 +135,18 @@ export class SwatchGroup extends SizedMixin(SpectrumElement, {
|
|
|
142
135
|
const passThroughSwatchActions = [];
|
|
143
136
|
if (Object.keys(targetValues).length) {
|
|
144
137
|
passThroughSwatchActions.push((swatch) => {
|
|
138
|
+
if (true) {
|
|
139
|
+
if ("selects" in targetValues && targetValues.selects !== "multiple" && swatch.mixedValue) {
|
|
140
|
+
window.__swc.warn(
|
|
141
|
+
this,
|
|
142
|
+
`<sp-swatch> elements can only leverage the "mixed-value" attribute when their <sp-swatch-group> parent element is also leveraging "selects="multiple""`,
|
|
143
|
+
"https://opensource.adobe.com/spectrum-web-components/components/swatch-group/#multiple",
|
|
144
|
+
{
|
|
145
|
+
type: "accessibility"
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
145
150
|
if ("border" in targetValues)
|
|
146
151
|
swatch.border = targetValues.border;
|
|
147
152
|
if ("rounding" in targetValues)
|
|
@@ -194,7 +199,7 @@ export class SwatchGroup extends SizedMixin(SpectrumElement, {
|
|
|
194
199
|
if (changes.has("selected")) {
|
|
195
200
|
swatchActions.push((swatch) => {
|
|
196
201
|
currentValues.add(swatch.value);
|
|
197
|
-
if (nextSelected.has(swatch.value) || swatch.selected) {
|
|
202
|
+
if (nextSelected.has(swatch.value) || !this.hasUpdated && swatch.selected) {
|
|
198
203
|
swatch.selected = true;
|
|
199
204
|
} else {
|
|
200
205
|
swatch.selected = false;
|
|
@@ -222,7 +227,7 @@ __decorateClass([
|
|
|
222
227
|
], SwatchGroup.prototype, "rounding", 2);
|
|
223
228
|
__decorateClass([
|
|
224
229
|
property({ type: Array })
|
|
225
|
-
], SwatchGroup.prototype, "selected",
|
|
230
|
+
], SwatchGroup.prototype, "selected", 2);
|
|
226
231
|
__decorateClass([
|
|
227
232
|
property()
|
|
228
233
|
], SwatchGroup.prototype, "selects", 2);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["SwatchGroup.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 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 ElementSize,\n html,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\nimport styles from './swatch-group.css.js';\nimport type {\n Swatch,\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from './Swatch.dev.js'\n\nexport type SwatchGroupSizes = Exclude<ElementSize, 'xxs' | 'xl' | 'xxl'>;\n\n/**\n * @element sp-swatch-group\n *\n * @slot - Swatch elements to manage as a group\n */\nexport class SwatchGroup extends SizedMixin(SpectrumElement, {\n validSizes: ['xs', 's', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Array })\n public get selected(): string[] {\n return this._selected;\n }\n\n public set selected(selected: string[]) {\n if (selected === this.selected) return;\n const oldSelected = this.selected;\n this._selected = selected;\n this.requestUpdate('selected', oldSelected);\n }\n\n private _selected: string[] = [];\n\n @property()\n public selects: 'single' | 'multiple' | undefined;\n\n private selectedSet = new Set<string>();\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property({ reflect: true })\n public density: 'compact' | 'spacious' | undefined;\n\n constructor() {\n super();\n\n new MutationController(this, {\n config: {\n attributes: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.manageChange();\n },\n });\n }\n\n rovingTabindexController = new RovingTabindexController<Swatch>(this, {\n focusInIndex: (elements: Swatch[]) => {\n let firstEnabledIndex = -1;\n const firstSelectedIndex = elements.findIndex((el, index) => {\n if (!elements[firstEnabledIndex] && !el.disabled) {\n firstEnabledIndex = index;\n }\n return el.selected && !el.disabled;\n });\n return elements[firstSelectedIndex]\n ? firstSelectedIndex\n : firstEnabledIndex;\n },\n elements: () => [...this.children] as Swatch[],\n isFocusableElement: (el: Swatch) => !el.disabled,\n });\n\n public override focus(options?: FocusOptions): void {\n this.rovingTabindexController.focus(options);\n }\n\n protected handleChange(event: Event & { target: Swatch }): void {\n event.stopPropagation();\n const oldSelected = this.selected;\n if (!this.selects) {\n event.preventDefault();\n return;\n }\n if (this.selects === 'single') {\n const { target } = event;\n target.tabIndex = 0;\n target.selected = true;\n if (this.selectedSet.has(target.value)) {\n return;\n }\n this.selectedSet.clear();\n this.selectedSet.add(target.value);\n this.rovingTabindexController.elements.forEach((child) => {\n if (child === target) return;\n child.selected = false;\n });\n } else if (this.selects === 'multiple') {\n const { target } = event;\n if (target.selected) {\n this.selectedSet.add(target.value);\n } else {\n this.selectedSet.delete(target.value);\n }\n }\n this._selected = [...this.selectedSet];\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.selected = oldSelected;\n event.preventDefault();\n }\n }\n\n private manageChange = (): void => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n const swatches = [...this.children] as Swatch[];\n swatches.forEach((swatch) => {\n presentSet.add(swatch.value);\n if (swatch.selected) {\n this.selectedSet.add(swatch.value);\n }\n });\n this.selectedSet.forEach((value) => {\n if (!presentSet.has(value)) {\n this.selectedSet.delete(value);\n }\n });\n this._selected = [...this.selectedSet];\n };\n\n private getPassthroughSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const targetValues: {\n border?: SwatchBorder;\n rounding?: SwatchRounding;\n shape?: SwatchShape;\n size?: SwatchGroupSizes;\n } = {};\n if (\n changes.has('border') &&\n (this.border || typeof changes.get('border') !== 'undefined')\n ) {\n targetValues.border = this.border;\n }\n if (\n changes.has('rounding') &&\n (this.rounding || typeof changes.get('rounding') !== 'undefined')\n ) {\n targetValues.rounding = this.rounding;\n }\n if (\n changes.has('size') &&\n (this.size || typeof changes.get('size') !== 'undefined')\n ) {\n targetValues.size = this.size as SwatchGroupSizes;\n }\n if (\n changes.has('shape') &&\n (this.shape || typeof changes.get('shape') !== 'undefined')\n ) {\n targetValues.shape = this.shape;\n }\n const passThroughSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (Object.keys(targetValues).length) {\n passThroughSwatchActions.push((swatch) => {\n if ('border' in targetValues)\n swatch.border = targetValues.border;\n if ('rounding' in targetValues)\n swatch.rounding = targetValues.rounding;\n if ('shape' in targetValues) swatch.shape = targetValues.shape;\n if ('size' in targetValues)\n swatch.size = targetValues.size as SwatchGroupSizes;\n });\n }\n return passThroughSwatchActions;\n }\n\n private getSelectionSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const selectionSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (!changes.has('selects')) return selectionSwatchActions;\n if (this.selects) {\n this.setAttribute(\n 'role',\n this.selects === 'single' ? 'radiogroup' : 'group'\n );\n } else {\n this.removeAttribute('role');\n }\n const swatchRoles = {\n single: 'radio',\n multiple: 'checkbox',\n };\n const swatchRole = this.selects ? swatchRoles[this.selects] : 'button';\n selectionSwatchActions.push((swatch) => {\n swatch.setAttribute('role', swatchRole);\n });\n return selectionSwatchActions;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot\n @change=${this.handleChange}\n @slotchange=${this.manageChange}\n ></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n const swatchActions = [\n ...this.getPassthroughSwatchActions(changes),\n ...this.getSelectionSwatchActions(changes),\n ];\n\n // Create Swatch actions that build state to be applied later.\n const nextSelected = new Set(this.selected);\n const currentValues = new Set();\n if (changes.has('selected')) {\n swatchActions.push((swatch) => {\n currentValues.add(swatch.value);\n if (nextSelected.has(swatch.value) || swatch.selected) {\n swatch.selected = true;\n } else {\n swatch.selected = false;\n }\n });\n }\n\n // Do Swatch actions to each Swach in the collection.\n this.rovingTabindexController.elements.forEach((swatch) => {\n swatchActions.forEach((action) => {\n action(swatch);\n });\n });\n\n // Apply state built in actions back to the Swatch Group\n if (changes.has('selected')) {\n this.selected = [...nextSelected].filter((selectedValue) =>\n currentValues.has(selectedValue)\n );\n this.rovingTabindexController.clearElementCache();\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAGI;AAAA,EAEA;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAEnC,OAAO,YAAY;
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 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 ElementSize,\n html,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\nimport styles from './swatch-group.css.js';\nimport type {\n Swatch,\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from './Swatch.dev.js'\n\nexport type SwatchGroupSizes = Exclude<ElementSize, 'xxs' | 'xl' | 'xxl'>;\nexport type SwatchSelects = 'single' | 'multiple' | undefined;\n\n/**\n * @element sp-swatch-group\n *\n * @slot - Swatch elements to manage as a group\n */\nexport class SwatchGroup extends SizedMixin(SpectrumElement, {\n validSizes: ['xs', 's', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Array })\n public selected: string[] = [];\n\n @property()\n public selects: SwatchSelects;\n\n private selectedSet = new Set<string>();\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property({ reflect: true })\n public density: 'compact' | 'spacious' | undefined;\n\n constructor() {\n super();\n\n new MutationController(this, {\n config: {\n attributes: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.manageChange();\n },\n });\n }\n\n rovingTabindexController = new RovingTabindexController<Swatch>(this, {\n focusInIndex: (elements: Swatch[]) => {\n let firstEnabledIndex = -1;\n const firstSelectedIndex = elements.findIndex((el, index) => {\n if (!elements[firstEnabledIndex] && !el.disabled) {\n firstEnabledIndex = index;\n }\n return el.selected && !el.disabled;\n });\n return elements[firstSelectedIndex]\n ? firstSelectedIndex\n : firstEnabledIndex;\n },\n elements: () => [...this.children] as Swatch[],\n isFocusableElement: (el: Swatch) => !el.disabled,\n });\n\n public override focus(options?: FocusOptions): void {\n this.rovingTabindexController.focus(options);\n }\n\n protected handleChange(event: Event & { target: Swatch }): void {\n event.stopPropagation();\n const oldSelected = this.selected;\n if (!this.selects) {\n event.preventDefault();\n return;\n }\n if (this.selects === 'single') {\n const { target } = event;\n target.tabIndex = 0;\n target.selected = true;\n if (this.selectedSet.has(target.value)) {\n return;\n }\n this.selectedSet.clear();\n this.selectedSet.add(target.value);\n this.rovingTabindexController.elements.forEach((child) => {\n if (child === target) return;\n child.selected = false;\n });\n } else if (this.selects === 'multiple') {\n const { target } = event;\n if (target.selected) {\n this.selectedSet.add(target.value);\n } else {\n this.selectedSet.delete(target.value);\n }\n }\n this.selected = [...this.selectedSet];\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.selected = oldSelected;\n event.preventDefault();\n }\n }\n\n private manageChange = (): void => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n const swatches = [...this.children] as Swatch[];\n swatches.forEach((swatch) => {\n presentSet.add(swatch.value);\n if (swatch.selected) {\n this.selectedSet.add(swatch.value);\n }\n });\n this.selectedSet.forEach((value) => {\n if (!presentSet.has(value)) {\n this.selectedSet.delete(value);\n }\n });\n this.selected = [...this.selectedSet];\n };\n\n private getPassthroughSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const targetValues: {\n border?: SwatchBorder;\n rounding?: SwatchRounding;\n shape?: SwatchShape;\n size?: SwatchGroupSizes;\n selects?: SwatchSelects;\n } = {};\n if (\n changes.has('selects') &&\n (this.selects || typeof changes.get('selects') !== 'undefined')\n ) {\n targetValues.selects = this.selects;\n }\n if (\n changes.has('border') &&\n (this.border || typeof changes.get('border') !== 'undefined')\n ) {\n targetValues.border = this.border;\n }\n if (\n changes.has('rounding') &&\n (this.rounding || typeof changes.get('rounding') !== 'undefined')\n ) {\n targetValues.rounding = this.rounding;\n }\n if (\n changes.has('size') &&\n (this.size || typeof changes.get('size') !== 'undefined')\n ) {\n targetValues.size = this.size as SwatchGroupSizes;\n }\n if (\n changes.has('shape') &&\n (this.shape || typeof changes.get('shape') !== 'undefined')\n ) {\n targetValues.shape = this.shape;\n }\n const passThroughSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (Object.keys(targetValues).length) {\n passThroughSwatchActions.push((swatch) => {\n if (window.__swc.DEBUG) {\n if (\n 'selects' in targetValues &&\n targetValues.selects !== 'multiple' &&\n swatch.mixedValue\n ) {\n window.__swc.warn(\n this,\n `<sp-swatch> elements can only leverage the \"mixed-value\" attribute when their <sp-swatch-group> parent element is also leveraging \"selects=\"multiple\"\"`,\n 'https://opensource.adobe.com/spectrum-web-components/components/swatch-group/#multiple',\n {\n type: 'accessibility',\n }\n );\n }\n }\n if ('border' in targetValues)\n swatch.border = targetValues.border;\n if ('rounding' in targetValues)\n swatch.rounding = targetValues.rounding;\n if ('shape' in targetValues) swatch.shape = targetValues.shape;\n if ('size' in targetValues)\n swatch.size = targetValues.size as SwatchGroupSizes;\n });\n }\n return passThroughSwatchActions;\n }\n\n private getSelectionSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const selectionSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (!changes.has('selects')) return selectionSwatchActions;\n if (this.selects) {\n this.setAttribute(\n 'role',\n this.selects === 'single' ? 'radiogroup' : 'group'\n );\n } else {\n this.removeAttribute('role');\n }\n const swatchRoles = {\n single: 'radio',\n multiple: 'checkbox',\n };\n const swatchRole = this.selects ? swatchRoles[this.selects] : 'button';\n selectionSwatchActions.push((swatch) => {\n swatch.setAttribute('role', swatchRole);\n });\n return selectionSwatchActions;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot\n @change=${this.handleChange}\n @slotchange=${this.manageChange}\n ></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n const swatchActions = [\n ...this.getPassthroughSwatchActions(changes),\n ...this.getSelectionSwatchActions(changes),\n ];\n\n // Create Swatch actions that build state to be applied later.\n const nextSelected = new Set(this.selected);\n const currentValues = new Set();\n if (changes.has('selected')) {\n swatchActions.push((swatch) => {\n currentValues.add(swatch.value);\n if (\n nextSelected.has(swatch.value) ||\n (!this.hasUpdated && swatch.selected)\n ) {\n swatch.selected = true;\n } else {\n swatch.selected = false;\n }\n });\n }\n\n // Do Swatch actions to each Swach in the collection.\n this.rovingTabindexController.elements.forEach((swatch) => {\n swatchActions.forEach((action) => {\n action(swatch);\n });\n });\n\n // Apply state built in actions back to the Swatch Group\n if (changes.has('selected')) {\n this.selected = [...nextSelected].filter((selectedValue) =>\n currentValues.has(selectedValue)\n );\n this.rovingTabindexController.clearElementCache();\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAGI;AAAA,EAEA;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAEnC,OAAO,YAAY;AAgBZ,aAAM,oBAAoB,WAAW,iBAAiB;AAAA,EACzD,YAAY,CAAC,MAAM,KAAK,KAAK,GAAG;AACpC,CAAC,EAAE;AAAA,EAyBC,cAAc;AACV,UAAM;AAdV,SAAO,WAAqB,CAAC;AAK7B,SAAQ,cAAc,oBAAI,IAAY;AAuBtC,oCAA2B,IAAI,yBAAiC,MAAM;AAAA,MAClE,cAAc,CAAC,aAAuB;AAClC,YAAI,oBAAoB;AACxB,cAAM,qBAAqB,SAAS,UAAU,CAAC,IAAI,UAAU;AACzD,cAAI,CAAC,SAAS,iBAAiB,KAAK,CAAC,GAAG,UAAU;AAC9C,gCAAoB;AAAA,UACxB;AACA,iBAAO,GAAG,YAAY,CAAC,GAAG;AAAA,QAC9B,CAAC;AACD,eA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|
1
|
-
"use strict";var d=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=(c,
|
|
1
|
+
"use strict";var d=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var l=(c,a,e,t)=>{for(var i=t>1?void 0:t?h(a,e):a,s=c.length-1,r;s>=0;s--)(r=c[s])&&(i=(t?r(a,e,i):r(i))||i);return t&&i&&d(a,e,i),i};import{html as u,SizedMixin as p,SpectrumElement as S}from"@spectrum-web-components/base";import{property as o}from"@spectrum-web-components/base/src/decorators.js";import{RovingTabindexController as f}from"@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";import{MutationController as g}from"@lit-labs/observers/mutation-controller.js";import w from"./swatch-group.css.js";export class SwatchGroup extends p(S,{validSizes:["xs","s","m","l"]}){constructor(){super();this.selected=[];this.selectedSet=new Set;this.rovingTabindexController=new f(this,{focusInIndex:e=>{let t=-1;const i=e.findIndex((s,r)=>(!e[t]&&!s.disabled&&(t=r),s.selected&&!s.disabled));return e[i]?i:t},elements:()=>[...this.children],isFocusableElement:e=>!e.disabled});this.manageChange=()=>{const e=new Set;this.selectedSet=new Set(this.selected),[...this.children].forEach(i=>{e.add(i.value),i.selected&&this.selectedSet.add(i.value)}),this.selectedSet.forEach(i=>{e.has(i)||this.selectedSet.delete(i)}),this.selected=[...this.selectedSet]};new g(this,{config:{attributes:!0,childList:!0,subtree:!0},callback:()=>{this.manageChange()}})}static get styles(){return[w]}focus(e){this.rovingTabindexController.focus(e)}handleChange(e){e.stopPropagation();const t=this.selected;if(!this.selects){e.preventDefault();return}if(this.selects==="single"){const{target:s}=e;if(s.tabIndex=0,s.selected=!0,this.selectedSet.has(s.value))return;this.selectedSet.clear(),this.selectedSet.add(s.value),this.rovingTabindexController.elements.forEach(r=>{r!==s&&(r.selected=!1)})}else if(this.selects==="multiple"){const{target:s}=e;s.selected?this.selectedSet.add(s.value):this.selectedSet.delete(s.value)}this.selected=[...this.selectedSet],this.dispatchEvent(new Event("change",{cancelable:!0,bubbles:!0}))||(this.selected=t,e.preventDefault())}getPassthroughSwatchActions(e){const t={};e.has("selects")&&(this.selects||typeof e.get("selects")!="undefined")&&(t.selects=this.selects),e.has("border")&&(this.border||typeof e.get("border")!="undefined")&&(t.border=this.border),e.has("rounding")&&(this.rounding||typeof e.get("rounding")!="undefined")&&(t.rounding=this.rounding),e.has("size")&&(this.size||typeof e.get("size")!="undefined")&&(t.size=this.size),e.has("shape")&&(this.shape||typeof e.get("shape")!="undefined")&&(t.shape=this.shape);const i=[];return Object.keys(t).length&&i.push(s=>{"border"in t&&(s.border=t.border),"rounding"in t&&(s.rounding=t.rounding),"shape"in t&&(s.shape=t.shape),"size"in t&&(s.size=t.size)}),i}getSelectionSwatchActions(e){const t=[];if(!e.has("selects"))return t;this.selects?this.setAttribute("role",this.selects==="single"?"radiogroup":"group"):this.removeAttribute("role");const i={single:"radio",multiple:"checkbox"},s=this.selects?i[this.selects]:"button";return t.push(r=>{r.setAttribute("role",s)}),t}render(){return u`
|
|
2
2
|
<slot
|
|
3
3
|
@change=${this.handleChange}
|
|
4
4
|
@slotchange=${this.manageChange}
|
|
5
5
|
></slot>
|
|
6
|
-
`}willUpdate(e){const t=[...this.getPassthroughSwatchActions(e),...this.getSelectionSwatchActions(e)],i=new Set(this.selected),s=new Set;e.has("selected")&&t.push(r=>{s.add(r.value),i.has(r.value)
|
|
6
|
+
`}willUpdate(e){const t=[...this.getPassthroughSwatchActions(e),...this.getSelectionSwatchActions(e)],i=new Set(this.selected),s=new Set;e.has("selected")&&t.push(r=>{s.add(r.value),i.has(r.value)||!this.hasUpdated&&r.selected?r.selected=!0:r.selected=!1}),this.rovingTabindexController.elements.forEach(r=>{t.forEach(n=>{n(r)})}),e.has("selected")&&(this.selected=[...i].filter(r=>s.has(r)),this.rovingTabindexController.clearElementCache())}}l([o({reflect:!0})],SwatchGroup.prototype,"border",2),l([o({reflect:!0})],SwatchGroup.prototype,"rounding",2),l([o({type:Array})],SwatchGroup.prototype,"selected",2),l([o()],SwatchGroup.prototype,"selects",2),l([o({reflect:!0})],SwatchGroup.prototype,"shape",2),l([o({reflect:!0})],SwatchGroup.prototype,"density",2);
|
|
7
7
|
//# sourceMappingURL=SwatchGroup.js.map
|
package/src/SwatchGroup.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["SwatchGroup.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 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 ElementSize,\n html,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\nimport styles from './swatch-group.css.js';\nimport type {\n Swatch,\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from './Swatch.js';\n\nexport type SwatchGroupSizes = Exclude<ElementSize, 'xxs' | 'xl' | 'xxl'>;\n\n/**\n * @element sp-swatch-group\n *\n * @slot - Swatch elements to manage as a group\n */\nexport class SwatchGroup extends SizedMixin(SpectrumElement, {\n validSizes: ['xs', 's', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Array })\n public get selected(): string[] {\n return this._selected;\n }\n\n public set selected(selected: string[]) {\n if (selected === this.selected) return;\n const oldSelected = this.selected;\n this._selected = selected;\n this.requestUpdate('selected', oldSelected);\n }\n\n private _selected: string[] = [];\n\n @property()\n public selects: 'single' | 'multiple' | undefined;\n\n private selectedSet = new Set<string>();\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property({ reflect: true })\n public density: 'compact' | 'spacious' | undefined;\n\n constructor() {\n super();\n\n new MutationController(this, {\n config: {\n attributes: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.manageChange();\n },\n });\n }\n\n rovingTabindexController = new RovingTabindexController<Swatch>(this, {\n focusInIndex: (elements: Swatch[]) => {\n let firstEnabledIndex = -1;\n const firstSelectedIndex = elements.findIndex((el, index) => {\n if (!elements[firstEnabledIndex] && !el.disabled) {\n firstEnabledIndex = index;\n }\n return el.selected && !el.disabled;\n });\n return elements[firstSelectedIndex]\n ? firstSelectedIndex\n : firstEnabledIndex;\n },\n elements: () => [...this.children] as Swatch[],\n isFocusableElement: (el: Swatch) => !el.disabled,\n });\n\n public override focus(options?: FocusOptions): void {\n this.rovingTabindexController.focus(options);\n }\n\n protected handleChange(event: Event & { target: Swatch }): void {\n event.stopPropagation();\n const oldSelected = this.selected;\n if (!this.selects) {\n event.preventDefault();\n return;\n }\n if (this.selects === 'single') {\n const { target } = event;\n target.tabIndex = 0;\n target.selected = true;\n if (this.selectedSet.has(target.value)) {\n return;\n }\n this.selectedSet.clear();\n this.selectedSet.add(target.value);\n this.rovingTabindexController.elements.forEach((child) => {\n if (child === target) return;\n child.selected = false;\n });\n } else if (this.selects === 'multiple') {\n const { target } = event;\n if (target.selected) {\n this.selectedSet.add(target.value);\n } else {\n this.selectedSet.delete(target.value);\n }\n }\n this._selected = [...this.selectedSet];\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.selected = oldSelected;\n event.preventDefault();\n }\n }\n\n private manageChange = (): void => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n const swatches = [...this.children] as Swatch[];\n swatches.forEach((swatch) => {\n presentSet.add(swatch.value);\n if (swatch.selected) {\n this.selectedSet.add(swatch.value);\n }\n });\n this.selectedSet.forEach((value) => {\n if (!presentSet.has(value)) {\n this.selectedSet.delete(value);\n }\n });\n this._selected = [...this.selectedSet];\n };\n\n private getPassthroughSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const targetValues: {\n border?: SwatchBorder;\n rounding?: SwatchRounding;\n shape?: SwatchShape;\n size?: SwatchGroupSizes;\n } = {};\n if (\n changes.has('border') &&\n (this.border || typeof changes.get('border') !== 'undefined')\n ) {\n targetValues.border = this.border;\n }\n if (\n changes.has('rounding') &&\n (this.rounding || typeof changes.get('rounding') !== 'undefined')\n ) {\n targetValues.rounding = this.rounding;\n }\n if (\n changes.has('size') &&\n (this.size || typeof changes.get('size') !== 'undefined')\n ) {\n targetValues.size = this.size as SwatchGroupSizes;\n }\n if (\n changes.has('shape') &&\n (this.shape || typeof changes.get('shape') !== 'undefined')\n ) {\n targetValues.shape = this.shape;\n }\n const passThroughSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (Object.keys(targetValues).length) {\n passThroughSwatchActions.push((swatch) => {\n if ('border' in targetValues)\n swatch.border = targetValues.border;\n if ('rounding' in targetValues)\n swatch.rounding = targetValues.rounding;\n if ('shape' in targetValues) swatch.shape = targetValues.shape;\n if ('size' in targetValues)\n swatch.size = targetValues.size as SwatchGroupSizes;\n });\n }\n return passThroughSwatchActions;\n }\n\n private getSelectionSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const selectionSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (!changes.has('selects')) return selectionSwatchActions;\n if (this.selects) {\n this.setAttribute(\n 'role',\n this.selects === 'single' ? 'radiogroup' : 'group'\n );\n } else {\n this.removeAttribute('role');\n }\n const swatchRoles = {\n single: 'radio',\n multiple: 'checkbox',\n };\n const swatchRole = this.selects ? swatchRoles[this.selects] : 'button';\n selectionSwatchActions.push((swatch) => {\n swatch.setAttribute('role', swatchRole);\n });\n return selectionSwatchActions;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot\n @change=${this.handleChange}\n @slotchange=${this.manageChange}\n ></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n const swatchActions = [\n ...this.getPassthroughSwatchActions(changes),\n ...this.getSelectionSwatchActions(changes),\n ];\n\n // Create Swatch actions that build state to be applied later.\n const nextSelected = new Set(this.selected);\n const currentValues = new Set();\n if (changes.has('selected')) {\n swatchActions.push((swatch) => {\n currentValues.add(swatch.value);\n if (nextSelected.has(swatch.value) || swatch.selected) {\n swatch.selected = true;\n } else {\n swatch.selected = false;\n }\n });\n }\n\n // Do Swatch actions to each Swach in the collection.\n this.rovingTabindexController.elements.forEach((swatch) => {\n swatchActions.forEach((action) => {\n action(swatch);\n });\n });\n\n // Apply state built in actions back to the Swatch Group\n if (changes.has('selected')) {\n this.selected = [...nextSelected].filter((selectedValue) =>\n currentValues.has(selectedValue)\n );\n this.rovingTabindexController.clearElementCache();\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "qNAYA,OAGI,QAAAA,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,4BAAAC,MAAgC,sEACzC,OAAS,sBAAAC,MAA0B,6CAEnC,OAAOC,MAAY,
|
|
6
|
-
"names": ["html", "SizedMixin", "SpectrumElement", "property", "RovingTabindexController", "MutationController", "styles", "elements", "firstEnabledIndex", "firstSelectedIndex", "el", "index", "presentSet", "swatch", "value", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 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 ElementSize,\n html,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\nimport { MutationController } from '@lit-labs/observers/mutation-controller.js';\n\nimport styles from './swatch-group.css.js';\nimport type {\n Swatch,\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from './Swatch.js';\n\nexport type SwatchGroupSizes = Exclude<ElementSize, 'xxs' | 'xl' | 'xxl'>;\nexport type SwatchSelects = 'single' | 'multiple' | undefined;\n\n/**\n * @element sp-swatch-group\n *\n * @slot - Swatch elements to manage as a group\n */\nexport class SwatchGroup extends SizedMixin(SpectrumElement, {\n validSizes: ['xs', 's', 'm', 'l'],\n}) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Array })\n public selected: string[] = [];\n\n @property()\n public selects: SwatchSelects;\n\n private selectedSet = new Set<string>();\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property({ reflect: true })\n public density: 'compact' | 'spacious' | undefined;\n\n constructor() {\n super();\n\n new MutationController(this, {\n config: {\n attributes: true,\n childList: true,\n subtree: true,\n },\n callback: () => {\n this.manageChange();\n },\n });\n }\n\n rovingTabindexController = new RovingTabindexController<Swatch>(this, {\n focusInIndex: (elements: Swatch[]) => {\n let firstEnabledIndex = -1;\n const firstSelectedIndex = elements.findIndex((el, index) => {\n if (!elements[firstEnabledIndex] && !el.disabled) {\n firstEnabledIndex = index;\n }\n return el.selected && !el.disabled;\n });\n return elements[firstSelectedIndex]\n ? firstSelectedIndex\n : firstEnabledIndex;\n },\n elements: () => [...this.children] as Swatch[],\n isFocusableElement: (el: Swatch) => !el.disabled,\n });\n\n public override focus(options?: FocusOptions): void {\n this.rovingTabindexController.focus(options);\n }\n\n protected handleChange(event: Event & { target: Swatch }): void {\n event.stopPropagation();\n const oldSelected = this.selected;\n if (!this.selects) {\n event.preventDefault();\n return;\n }\n if (this.selects === 'single') {\n const { target } = event;\n target.tabIndex = 0;\n target.selected = true;\n if (this.selectedSet.has(target.value)) {\n return;\n }\n this.selectedSet.clear();\n this.selectedSet.add(target.value);\n this.rovingTabindexController.elements.forEach((child) => {\n if (child === target) return;\n child.selected = false;\n });\n } else if (this.selects === 'multiple') {\n const { target } = event;\n if (target.selected) {\n this.selectedSet.add(target.value);\n } else {\n this.selectedSet.delete(target.value);\n }\n }\n this.selected = [...this.selectedSet];\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.selected = oldSelected;\n event.preventDefault();\n }\n }\n\n private manageChange = (): void => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n const swatches = [...this.children] as Swatch[];\n swatches.forEach((swatch) => {\n presentSet.add(swatch.value);\n if (swatch.selected) {\n this.selectedSet.add(swatch.value);\n }\n });\n this.selectedSet.forEach((value) => {\n if (!presentSet.has(value)) {\n this.selectedSet.delete(value);\n }\n });\n this.selected = [...this.selectedSet];\n };\n\n private getPassthroughSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const targetValues: {\n border?: SwatchBorder;\n rounding?: SwatchRounding;\n shape?: SwatchShape;\n size?: SwatchGroupSizes;\n selects?: SwatchSelects;\n } = {};\n if (\n changes.has('selects') &&\n (this.selects || typeof changes.get('selects') !== 'undefined')\n ) {\n targetValues.selects = this.selects;\n }\n if (\n changes.has('border') &&\n (this.border || typeof changes.get('border') !== 'undefined')\n ) {\n targetValues.border = this.border;\n }\n if (\n changes.has('rounding') &&\n (this.rounding || typeof changes.get('rounding') !== 'undefined')\n ) {\n targetValues.rounding = this.rounding;\n }\n if (\n changes.has('size') &&\n (this.size || typeof changes.get('size') !== 'undefined')\n ) {\n targetValues.size = this.size as SwatchGroupSizes;\n }\n if (\n changes.has('shape') &&\n (this.shape || typeof changes.get('shape') !== 'undefined')\n ) {\n targetValues.shape = this.shape;\n }\n const passThroughSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (Object.keys(targetValues).length) {\n passThroughSwatchActions.push((swatch) => {\n if (window.__swc.DEBUG) {\n if (\n 'selects' in targetValues &&\n targetValues.selects !== 'multiple' &&\n swatch.mixedValue\n ) {\n window.__swc.warn(\n this,\n `<sp-swatch> elements can only leverage the \"mixed-value\" attribute when their <sp-swatch-group> parent element is also leveraging \"selects=\"multiple\"\"`,\n 'https://opensource.adobe.com/spectrum-web-components/components/swatch-group/#multiple',\n {\n type: 'accessibility',\n }\n );\n }\n }\n if ('border' in targetValues)\n swatch.border = targetValues.border;\n if ('rounding' in targetValues)\n swatch.rounding = targetValues.rounding;\n if ('shape' in targetValues) swatch.shape = targetValues.shape;\n if ('size' in targetValues)\n swatch.size = targetValues.size as SwatchGroupSizes;\n });\n }\n return passThroughSwatchActions;\n }\n\n private getSelectionSwatchActions(\n changes: PropertyValues\n ): ((swatch: Swatch) => void)[] {\n const selectionSwatchActions: ((swatch: Swatch) => void)[] = [];\n if (!changes.has('selects')) return selectionSwatchActions;\n if (this.selects) {\n this.setAttribute(\n 'role',\n this.selects === 'single' ? 'radiogroup' : 'group'\n );\n } else {\n this.removeAttribute('role');\n }\n const swatchRoles = {\n single: 'radio',\n multiple: 'checkbox',\n };\n const swatchRole = this.selects ? swatchRoles[this.selects] : 'button';\n selectionSwatchActions.push((swatch) => {\n swatch.setAttribute('role', swatchRole);\n });\n return selectionSwatchActions;\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot\n @change=${this.handleChange}\n @slotchange=${this.manageChange}\n ></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n const swatchActions = [\n ...this.getPassthroughSwatchActions(changes),\n ...this.getSelectionSwatchActions(changes),\n ];\n\n // Create Swatch actions that build state to be applied later.\n const nextSelected = new Set(this.selected);\n const currentValues = new Set();\n if (changes.has('selected')) {\n swatchActions.push((swatch) => {\n currentValues.add(swatch.value);\n if (\n nextSelected.has(swatch.value) ||\n (!this.hasUpdated && swatch.selected)\n ) {\n swatch.selected = true;\n } else {\n swatch.selected = false;\n }\n });\n }\n\n // Do Swatch actions to each Swach in the collection.\n this.rovingTabindexController.elements.forEach((swatch) => {\n swatchActions.forEach((action) => {\n action(swatch);\n });\n });\n\n // Apply state built in actions back to the Swatch Group\n if (changes.has('selected')) {\n this.selected = [...nextSelected].filter((selectedValue) =>\n currentValues.has(selectedValue)\n );\n this.rovingTabindexController.clearElementCache();\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAGI,QAAAA,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,4BAAAC,MAAgC,sEACzC,OAAS,sBAAAC,MAA0B,6CAEnC,OAAOC,MAAY,wBAgBZ,aAAM,oBAAoBL,EAAWC,EAAiB,CACzD,WAAY,CAAC,KAAM,IAAK,IAAK,GAAG,CACpC,CAAC,CAAE,CAyBC,aAAc,CACV,MAAM,EAdV,KAAO,SAAqB,CAAC,EAK7B,KAAQ,YAAc,IAAI,IAuB1B,8BAA2B,IAAIE,EAAiC,KAAM,CAClE,aAAeG,GAAuB,CAClC,IAAIC,EAAoB,GACxB,MAAMC,EAAqBF,EAAS,UAAU,CAACG,EAAIC,KAC3C,CAACJ,EAASC,CAAiB,GAAK,CAACE,EAAG,WACpCF,EAAoBG,GAEjBD,EAAG,UAAY,CAACA,EAAG,SAC7B,EACD,OAAOH,EAASE,CAAkB,EAC5BA,EACAD,CACV,EACA,SAAU,IAAM,CAAC,GAAG,KAAK,QAAQ,EACjC,mBAAqBE,GAAe,CAACA,EAAG,QAC5C,CAAC,EA+CD,KAAQ,aAAe,IAAY,CAC/B,MAAME,EAAa,IAAI,IAC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"SizedMixin", "SpectrumElement", "property", "RovingTabindexController", "MutationController", "styles", "elements", "firstEnabledIndex", "firstSelectedIndex", "el", "index", "presentSet", "swatch", "value", "options", "event", "oldSelected", "target", "child", "changes", "targetValues", "passThroughSwatchActions", "selectionSwatchActions", "swatchRoles", "swatchRole", "swatchActions", "nextSelected", "currentValues", "action", "selectedValue", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -23,7 +23,7 @@ const styles = css`
|
|
|
23
23
|
--spectrum-workflow-icon-size-200
|
|
24
24
|
);--spectrum-swatch-slash-thickness:var(
|
|
25
25
|
--spectrum-swatch-slash-thickness-large
|
|
26
|
-
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled])
|
|
26
|
+
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(
|
|
27
27
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
|
28
28
|
);width:var(
|
|
29
29
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-swatch.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]) .fill{forced-color-adjust:auto}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}\n`;\nexport default styles;"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuHf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
--spectrum-workflow-icon-size-200
|
|
22
22
|
);--spectrum-swatch-slash-thickness:var(
|
|
23
23
|
--spectrum-swatch-slash-thickness-large
|
|
24
|
-
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled])
|
|
24
|
+
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(
|
|
25
25
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
|
26
26
|
);width:var(
|
|
27
27
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-swatch.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]) .fill{forced-color-adjust:auto}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}\n`;\nexport default styles;"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuHf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
package/src/swatch.css.dev.js
CHANGED
|
@@ -23,7 +23,7 @@ const styles = css`
|
|
|
23
23
|
--spectrum-workflow-icon-size-200
|
|
24
24
|
);--spectrum-swatch-slash-thickness:var(
|
|
25
25
|
--spectrum-swatch-slash-thickness-large
|
|
26
|
-
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled])
|
|
26
|
+
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(
|
|
27
27
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
|
28
28
|
);width:var(
|
|
29
29
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]) .fill{forced-color-adjust:auto}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}.fill:before{background:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{background:var(--spectrum-picked-color,transparent)}:host .is-image .fill:before{background:#0000}\n`;\nexport default styles;"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}.fill:before{background:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{background:var(--spectrum-picked-color,transparent)}:host .is-image .fill:before{background:#0000}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuHf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/swatch.css.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
--spectrum-workflow-icon-size-200
|
|
22
22
|
);--spectrum-swatch-slash-thickness:var(
|
|
23
23
|
--spectrum-swatch-slash-thickness-large
|
|
24
|
-
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled])
|
|
24
|
+
)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(
|
|
25
25
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
|
26
26
|
);width:var(
|
|
27
27
|
--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)
|
package/src/swatch.css.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]) .fill{forced-color-adjust:auto}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}.fill:before{background:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{background:var(--spectrum-picked-color,transparent)}:host .is-image .fill:before{background:#0000}\n`;\nexport default styles;"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2023 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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-focus-indicator-border-radius:8px;--spectrum-swatch-icon-border-color:#00000082;--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-border-radius:var(--spectrum-corner-radius-100);--spectrum-swatch-border-thickness:var(--spectrum-border-width-100);--spectrum-swatch-border-thickness-selected:var(\n--spectrum-border-width-200\n);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n);--spectrum-swatch-focus-indicator-thickness:var(\n--spectrum-focus-indicator-thickness\n);--spectrum-swatch-focus-indicator-gap:var(--spectrum-focus-indicator-gap);--spectrum-swatch-border-color-selected:var(--spectrum-gray-900);--spectrum-swatch-inner-border-color-selected:var(--spectrum-gray-50);--spectrum-swatch-disabled-icon-border-color:var(\n--spectrum-swatch-disabled-icon-border-color\n);--spectrum-swatch-disabled-icon-color:var(--spectrum-white);--spectrum-swatch-dash-icon-color:var(--spectrum-gray-800);--spectrum-swatch-slash-icon-color:var(--spectrum-red-900);--spectrum-swatch-focus-indicator-color:var(\n--spectrum-focus-indicator-color\n)}:host([size=xs]){--spectrum-swatch-size:var(--spectrum-swatch-size-extra-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-extra-small\n)}:host([size=s]){--spectrum-swatch-size:var(--spectrum-swatch-size-small);--spectrum-swatch-disabled-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-small\n)}:host([size=m]){--spectrum-swatch-size:var(--spectrum-swatch-size-medium);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-100\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-medium\n)}:host([size=l]){--spectrum-swatch-size:var(--spectrum-swatch-size-large);--spectrum-swatch-disabled-icon-size:var(\n--spectrum-workflow-icon-size-200\n);--spectrum-swatch-slash-thickness:var(\n--spectrum-swatch-slash-thickness-large\n)}@media (forced-colors:active){:host{--highcontrast-swatch-disabled-icon-color:GrayText;--highcontrast-swatch-focus-indicator-color:ButtonText;--highcontrast-swatch-background-color-selected:Background;--highcontrast-swatch-border-color-selected:Highlight;--highcontrast-swatch-border-color:ButtonText;--highcontrast-swatch-fill-foreground-color:ButtonText}.fill{forced-color-adjust:none}:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{align-items:center;display:flex;height:var(--mod-swatch-size,var(--spectrum-swatch-size));justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none;width:var(--mod-swatch-size,var(--spectrum-swatch-size))}.disabledIcon{height:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n);width:var(\n--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size)\n)}:host,:host:before{border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n)}:host([selected]){background-color:var(\n--highcontrast-swatch-background-color-selected,var(\n--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)\n)\n)}:host([selected]) .fill{border-radius:0;clip-path:polygon(calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2),calc(var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) calc(100% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2))}:host([selected]) .fill:before{border-radius:0;box-shadow:none}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:#0000}:host([mixed-value]) .fill{background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);visibility:visible}:host([nothing]) .fill{background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{background:var(\n--highcontrast-swatch-fill-foreground-color,var(\n--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)\n)\n);content:\"\";height:var(\n--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness)\n);position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon{visibility:visible}:host:before{border-color:var(\n--highcontrast-swatch-border-color-selected,var(\n--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)\n)\n);border-style:solid;border-width:var(\n--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected)\n);content:\"\";inset:0;opacity:0;pointer-events:none;position:absolute}:host:after{border-color:var(\n--highcontrast-swatch-focus-indicator-color,var(\n--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)\n)\n);border-radius:var(\n--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius)\n);border-style:solid;border-width:var(\n--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness)\n);content:\"\";inset:calc(var(\n--mod-swatch-focus-indicator-gap,\nvar(--spectrum-swatch-focus-indicator-gap)\n)*-2);opacity:0;position:absolute;transition:opacity var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out}:host(.focus-visible):after{opacity:1}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}.fill{--spectrum-swatch-checkerboard-size:var(\n--spectrum-opacity-checkerboard-square-size\n);--spectrum-swatch-checkerboard-dark-color:var(\n--spectrum-opacity-checkerboard-square-dark\n);--spectrum-swatch-checkerboard-light-color:var(\n--spectrum-opacity-checkerboard-square-light\n);align-items:center;background:repeating-conic-gradient(var(--spectrum-swatch-checkerboard-light-color) 0 25%,var(--spectrum-swatch-checkerboard-dark-color) 0 50%) 0 0 /calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(\n--mod-swatch-border-radius,var(--spectrum-swatch-border-radius)\n);box-shadow:inset 0 0 0 var(\n--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness)\n) var(\n--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color))\n);content:\"\";inset:0;position:absolute;z-index:0}:host([border=none]) .fill:before{background-color:var(--spectrum-picked-color,transparent);box-shadow:none}.mixedValueIcon{color:var(--spectrum-picked-color,transparent)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);color:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n);position:relative;z-index:2}.disabledIcon path:first-child{fill:var(\n--highcontrast-swatch-disabled-icon-color,var(\n--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)\n)\n)}.disabledIcon path:last-child{fill:var(\n--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color)\n)}:host([shape=rectangle]){width:calc(var(--mod-swatch-size, var(--spectrum-swatch-size))*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full]:not([shape=rectangle])[selected]) .fill,:host([rounding=full]:not([shape=rectangle])[selected]) .fill:before{border-radius:100%}:host([rounding=full]:not([shape=rectangle])[selected]) .fill{clip-path:circle(calc(50% - var(\n--mod-swatch-border-thickness-selected,\nvar(--spectrum-swatch-border-thickness-selected)\n)*2) at 50% 50%)}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out,height var(\n--mod-animation-duration-100,var(--spectrum-animation-duration-100)\n) ease-in-out;width:100%}.fill:before{background:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{background:var(--spectrum-picked-color,transparent)}:host .is-image .fill:before{background:#0000}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuHf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { html } from "@spectrum-web-components/base";
|
|
3
3
|
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
4
|
+
import "@spectrum-web-components/swatch/sp-swatch-group.js";
|
|
5
|
+
import "@spectrum-web-components/swatch/sp-swatch.js";
|
|
6
6
|
export default {
|
|
7
7
|
title: "Swatch group",
|
|
8
8
|
component: "sp-swatch-group",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch-group.stories.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/swatch/sp-swatch-group.js';\nimport '@spectrum-web-components/swatch/sp-swatch.js';\nimport type {\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from '../src/Swatch.js';\nimport { SwatchGroup } from '../src/SwatchGroup.js';\n\ntype Properties = {\n border: SwatchBorder | 'normal';\n density?: 'normal' | 'spacious' | 'compact';\n rounding?: SwatchRounding | 'normal';\n selected?: string[];\n selects?: 'none' | 'single' | 'multiple';\n shape?: SwatchShape | 'normal';\n};\n\nexport default {\n title: 'Swatch group',\n component: 'sp-swatch-group',\n args: {},\n argTypes: {\n border: {\n name: 'border',\n type: { name: 'string', required: false },\n description: 'The border to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'light', 'none'],\n },\n },\n density: {\n name: 'density',\n type: { name: 'string', required: false },\n description: 'The density at which to display the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'compact', 'spacious'],\n },\n },\n rounding: {\n name: 'rounding',\n type: { name: 'string', required: false },\n description: 'The rounding to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'none', 'full'],\n },\n },\n selects: {\n name: 'selects',\n type: { name: 'string', required: false },\n description:\n 'Whether the Swatch Group manages a selection, and whether it is a sinlge or multiple selection.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['none', 'single', 'multiple'],\n },\n },\n shape: {\n name: 'shape',\n type: { name: 'string', required: false },\n description: 'The shape to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'rectangle'],\n },\n },\n },\n decorators: [\n (\n story: () => TemplateResult,\n {\n args: { selected = [] },\n }: {\n args: {\n selected: string[];\n };\n }\n ): TemplateResult => html`\n <div\n @change=${async (event: Event & { target: SwatchGroup }) => {\n await 0;\n if (event.defaultPrevented) return;\n const next = event.target\n .nextElementSibling as HTMLDivElement;\n next.textContent = `Selected: ${JSON.stringify(\n event.target.selected\n )}`;\n }}\n >\n ${story()}\n <div>Selected: ${JSON.stringify(selected)}</div>\n </div>\n `,\n ],\n};\n\nconst colors = [\n '--spectrum-global-color-gray-500',\n '--spectrum-global-color-red-500',\n '--spectrum-global-color-orange-500',\n '--spectrum-global-color-yellow-500',\n '--spectrum-global-color-chartreuse-500',\n '--spectrum-global-color-celery-500',\n '--spectrum-global-color-green-500',\n '--spectrum-global-color-seafoam-500',\n '--spectrum-global-color-blue-500',\n '--spectrum-global-color-indigo-500',\n '--spectrum-global-color-purple-500',\n '--spectrum-global-color-fuchsia-500',\n '--spectrum-global-color-magenta-500',\n];\n\nconst template = ({\n border,\n density,\n rounding,\n selects,\n selected = [],\n shape,\n}: Properties): TemplateResult => {\n const groupLabel = !!selects\n ? selects === 'single'\n ? 'Select a color'\n : 'Selects color(s)'\n : undefined;\n return html`\n <sp-swatch-group\n border=${ifDefined(border === 'normal' ? undefined : border)}\n density=${ifDefined(density === 'normal' ? undefined : density)}\n rounding=${ifDefined(rounding === 'normal' ? undefined : rounding)}\n selects=${ifDefined(selects === 'none' ? undefined : selects)}\n .selected=${selected}\n shape=${ifDefined(shape === 'normal' ? undefined : shape)}\n aria-label=${ifDefined(groupLabel)}\n >\n ${colors.map(\n (color) => html`\n <sp-swatch\n color=\"var(${color})\"\n label=${color}\n value=${color}\n ></sp-swatch>\n `\n )}\n </sp-swatch-group>\n `;\n};\n\nexport const Default = (args: Properties): TemplateResult => template(args);\nDefault.args = {} as Properties;\nexport const densityCompact = (args: Properties): TemplateResult =>\n template(args);\ndensityCompact.args = {\n density: 'compact',\n} as Properties;\nexport const densitySpacious = (args: Properties): TemplateResult =>\n template(args);\ndensitySpacious.args = {\n density: 'spacious',\n} as Properties;\nexport const selectsSingle = (args: Properties): TemplateResult =>\n template(args);\nselectsSingle.args = {\n selects: 'single',\n selected: ['--spectrum-global-color-yellow-500'],\n} as Properties;\nexport const selectsMultiple = (args: Properties): TemplateResult =>\n template(args);\nselectsMultiple.args = {\n selects: 'multiple',\n selected: [\n '--spectrum-global-color-celery-500',\n '--spectrum-global-color-red-500',\n '--spectrum-global-color-purple-500',\n '--spectrum-global-color-blue-500',\n ],\n} as Properties;\nexport const borderLight = (args: Properties): TemplateResult => template(args);\nborderLight.args = {\n border: 'light',\n} as Properties;\nexport const borderNone = (args: Properties): TemplateResult => template(args);\nborderNone.args = {\n border: 'none',\n} as Properties;\nexport const roundingNone = (args: Properties): TemplateResult =>\n template(args);\nroundingNone.args = {\n rounding: 'none',\n} as Properties;\nexport const roundingFull = (args: Properties): TemplateResult =>\n template(args);\nroundingFull.args = {\n rounding: 'full',\n} as Properties;\nexport const shapeRectangle = (args: Properties): TemplateResult =>\n template(args);\nshapeRectangle.args = {\n shape: 'rectangle',\n} as Properties;\n"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAE1B,OAAO;AACP,OAAO;AAiBP,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM,CAAC;AAA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AAC,SAAqC,SAAS,IAAI;AAC1E,QAAQ,OAAO,CAAC;AACT,aAAM,iBAAiB,CAAC,SAC3B,SAAS,IAAI;AACjB,eAAe,OAAO;AAAA,EAClB,SAAS;AACb;AACO,aAAM,kBAAkB,CAAC,SAC5B,SAAS,IAAI;AACjB,gBAAgB,OAAO;AAAA,EACnB,SAAS;AACb;AACO,aAAM,gBAAgB,CAAC,SAC1B,SAAS,IAAI;AACjB,cAAc,OAAO;AAAA,EACjB,SAAS;AAAA,EACT,UAAU,CAAC,oCAAoC;AACnD;AACO,aAAM,kBAAkB,CAAC,SAC5B,SAAS,IAAI;AACjB,gBAAgB,OAAO;AAAA,EACnB,SAAS;AAAA,EACT,UAAU;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AACO,aAAM,cAAc,CAAC,SAAqC,SAAS,IAAI;AAC9E,YAAY,OAAO;AAAA,EACf,QAAQ;AACZ;AACO,aAAM,aAAa,CAAC,SAAqC,SAAS,IAAI;AAC7E,WAAW,OAAO;AAAA,EACd,QAAQ;AACZ;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,iBAAiB,CAAC,SAC3B,SAAS,IAAI;AACjB,eAAe,OAAO;AAAA,EAClB,OAAO;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch-sizes.stories.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 {\n ElementSize,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\n\nimport '
|
|
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 {\n ElementSize,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/swatch/sp-swatch.js';\n\nexport default {\n title: 'Swatch/Sizes',\n component: 'sp-swatch',\n};\n\nconst template = ({\n size,\n color = 'rgb(255 0 0 / 0.7)',\n}: {\n size: ElementSize;\n color?: string;\n}): TemplateResult => html`\n <div style=\"display: flex; gap: 5px;\">\n <sp-swatch color=${color} size=${size}></sp-swatch>\n <sp-swatch color=${color} rounding=\"none\" size=${size}></sp-swatch>\n <sp-swatch color=${color} rounding=\"full\" size=${size}></sp-swatch>\n <sp-swatch color=${color} border=\"light\" size=${size}></sp-swatch>\n <sp-swatch color=${color} border=\"none\" size=${size}></sp-swatch>\n <sp-swatch nothing size=${size}></sp-swatch>\n <sp-swatch color=${color} shape=\"rectangle\" size=${size}></sp-swatch>\n <sp-swatch\n color=${color}\n shape=\"rectangle\"\n size=${size}\n disabled\n ></sp-swatch>\n <sp-swatch\n rounding=\"full\"\n shape=\"rectangle\"\n size=${size}\n mixed-value\n ></sp-swatch>\n </div>\n`;\n\nexport const XS = (): TemplateResult => template({ size: 'xs' });\n\nexport const s = (): TemplateResult => template({ size: 's' });\n\nexport const m = (): TemplateResult => template({ size: 'm' });\n\nexport const l = (): TemplateResult => template({ size: 'l' });\n"],
|
|
5
5
|
"mappings": ";AAWA;AAAA,EAEI;AAAA,OAEG;AAEP,OAAO;AAEP,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AACf;AAEA,MAAM,WAAW,CAAC;AAAA,EACd;AAAA,EACA,QAAQ;AACZ,MAGsB;AAAA;AAAA,2BAEK,cAAc;AAAA,2BACd,8BAA8B;AAAA,2BAC9B,8BAA8B;AAAA,2BAC9B,6BAA6B;AAAA,2BAC7B,4BAA4B;AAAA,kCACrB;AAAA,2BACP,gCAAgC;AAAA;AAAA,oBAEvC;AAAA;AAAA,mBAED;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMA;AAAA;AAAA;AAAA;AAAA;AAMZ,aAAM,KAAK,MAAsB,SAAS,EAAE,MAAM,KAAK,CAAC;AAExD,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;AAEtD,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;AAEtD,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { html } from "@spectrum-web-components/base";
|
|
3
3
|
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
4
|
-
import "
|
|
4
|
+
import "@spectrum-web-components/swatch/sp-swatch.js";
|
|
5
5
|
export default {
|
|
6
6
|
title: "Swatch",
|
|
7
7
|
component: "sp-swatch",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch.stories.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '@spectrum-web-components/swatch/sp-swatch.js';\nimport type {\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from '../src/Swatch.js';\n\ntype Properties = {\n color: string;\n border: SwatchBorder | 'normal';\n rounding: SwatchRounding | 'normal';\n shape: SwatchShape | 'normal';\n mixedValue?: boolean;\n nothing?: boolean;\n};\n\nexport default {\n title: 'Swatch',\n component: 'sp-swatch',\n args: {\n color: '#ff0000',\n },\n argTypes: {\n color: { control: 'color' },\n border: {\n name: 'border',\n type: { name: 'string', required: false },\n description: 'The border to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'light', 'none'],\n },\n },\n rounding: {\n name: 'rounding',\n type: { name: 'string', required: false },\n description: 'The rounding to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'none', 'full'],\n },\n },\n shape: {\n name: 'shape',\n type: { name: 'string', required: false },\n description: 'The shape to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'rectangle'],\n },\n },\n },\n};\n\nconst template = ({\n color,\n border,\n rounding,\n shape,\n mixedValue,\n nothing,\n}: Properties): TemplateResult => {\n return html`\n <sp-swatch\n border=${ifDefined(border === 'normal' ? undefined : border)}\n rounding=${ifDefined(rounding === 'normal' ? undefined : rounding)}\n shape=${ifDefined(shape === 'normal' ? undefined : shape)}\n color=${color}\n ?mixed-value=${mixedValue}\n ?nothing=${nothing}\n ></sp-swatch>\n `;\n};\n\nexport const Default = (args: Properties): TemplateResult => template(args);\nexport const gradient = (args: Properties): TemplateResult => template(args);\ngradient.args = {\n color: 'linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%)',\n};\nexport const mixedValue = (args: Properties): TemplateResult => template(args);\nmixedValue.args = {\n mixedValue: true,\n color: '',\n};\nexport const nothing = (args: Properties): TemplateResult => template(args);\nnothing.args = {\n nothing: true,\n color: '',\n};\nexport const borderLight = (args: Properties): TemplateResult => template(args);\nborderLight.args = {\n border: 'light',\n};\nexport const borderNone = (args: Properties): TemplateResult => template(args);\nborderNone.args = {\n border: 'none',\n};\nexport const roundingNone = (args: Properties): TemplateResult =>\n template(args);\nroundingNone.args = {\n rounding: 'none',\n};\nexport const roundingFull = (args: Properties): TemplateResult =>\n template(args);\nroundingFull.args = {\n rounding: 'full',\n};\nexport const shapeRectangle = (args: Properties): TemplateResult =>\n template(args);\nshapeRectangle.args = {\n shape: 'rectangle',\n};\n"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,YAA4B;AACrC,SAAS,iBAAiB;AAE1B,OAAO;AAgBP,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,IACF,OAAO;AAAA,EACX;AAAA,EACA,UAAU;AAAA,IACN,OAAO,EAAE,SAAS,QA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OAAO;AAAA,EACZ,OAAO;AACX;AACO,aAAM,aAAa,CAAC,SAAqC,SAAS,IAAI;AAC7E,WAAW,OAAO;AAAA,EACd,YAAY;AAAA,EACZ,OAAO;AACX;AACO,aAAM,UAAU,CAAC,SAAqC,SAAS,IAAI;AAC1E,QAAQ,OAAO;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AACX;AACO,aAAM,cAAc,CAAC,SAAqC,SAAS,IAAI;AAC9E,YAAY,OAAO;AAAA,EACf,QAAQ;AACZ;AACO,aAAM,aAAa,CAAC,SAAqC,SAAS,IAAI;AAC7E,WAAW,OAAO;AAAA,EACd,QAAQ;AACZ;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,iBAAiB,CAAC,SAC3B,SAAS,IAAI;AACjB,eAAe,OAAO;AAAA,EAClB,OAAO;AACX;",
|
|
6
6
|
"names": ["mixedValue", "nothing"]
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { elementUpdated, expect, fixture, nextFrame } from "@open-wc/testing";
|
|
3
3
|
import { sendKeys } from "@web/test-runner-commands";
|
|
4
|
-
import "
|
|
4
|
+
import "@spectrum-web-components/swatch/sp-swatch.js";
|
|
5
5
|
import { Default } from "../stories/swatch-group.stories.js";
|
|
6
|
-
import { spy } from "sinon";
|
|
6
|
+
import { spy, stub } from "sinon";
|
|
7
7
|
import { html } from "@spectrum-web-components/base";
|
|
8
8
|
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
9
9
|
describe("Swatch Group", () => {
|
|
@@ -238,6 +238,45 @@ describe("Swatch Group", () => {
|
|
|
238
238
|
});
|
|
239
239
|
});
|
|
240
240
|
describe("Swatch Group - DOM selected", () => {
|
|
241
|
+
describe("dev mode", () => {
|
|
242
|
+
let consoleWarnStub;
|
|
243
|
+
before(() => {
|
|
244
|
+
window.__swc.verbose = true;
|
|
245
|
+
consoleWarnStub = stub(console, "warn");
|
|
246
|
+
});
|
|
247
|
+
afterEach(() => {
|
|
248
|
+
consoleWarnStub.resetHistory();
|
|
249
|
+
});
|
|
250
|
+
after(() => {
|
|
251
|
+
window.__swc.verbose = false;
|
|
252
|
+
consoleWarnStub.restore();
|
|
253
|
+
});
|
|
254
|
+
it('warns in Dev Mode when mixed-value attribute is added in sp-swatch when parent sp-swatch-group is not having selects="multiple"', async () => {
|
|
255
|
+
const el = await fixture(
|
|
256
|
+
html`
|
|
257
|
+
<sp-swatch-group selects="single">
|
|
258
|
+
<sp-swatch mixed-value></sp-swatch>
|
|
259
|
+
</sp-swatch-group>
|
|
260
|
+
`
|
|
261
|
+
);
|
|
262
|
+
await elementUpdated(el);
|
|
263
|
+
expect(consoleWarnStub.called).to.be.true;
|
|
264
|
+
const spyCall = consoleWarnStub.getCall(0);
|
|
265
|
+
expect(
|
|
266
|
+
spyCall.args.at(0).includes(
|
|
267
|
+
'<sp-swatch> elements can only leverage the "mixed-value" attribute when their <sp-swatch-group> parent element is also leveraging "selects="multiple"'
|
|
268
|
+
),
|
|
269
|
+
"confirm warning message"
|
|
270
|
+
).to.be.true;
|
|
271
|
+
expect(spyCall.args.at(-1), "confirm `data` shape").to.deep.equal({
|
|
272
|
+
data: {
|
|
273
|
+
localName: "sp-swatch-group",
|
|
274
|
+
type: "accessibility",
|
|
275
|
+
level: "default"
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
});
|
|
241
280
|
it("accepts selection from DOM", async () => {
|
|
242
281
|
const el = await fixture(html`
|
|
243
282
|
<sp-swatch-group selects="multiple">
|
|
@@ -278,5 +317,19 @@ describe("Swatch Group - DOM selected", () => {
|
|
|
278
317
|
await elementUpdated(el);
|
|
279
318
|
expect(el.selected).to.deep.equal(["color-3", "color-1"]);
|
|
280
319
|
});
|
|
320
|
+
it("clears previously selected children when updating `selected`", async () => {
|
|
321
|
+
const el = await fixture(html`
|
|
322
|
+
<sp-swatch-group selects="single" .selected=${["color-1"]}>
|
|
323
|
+
<sp-swatch value="color-0" color="red"></sp-swatch>
|
|
324
|
+
<sp-swatch value="color-1" color="green"></sp-swatch>
|
|
325
|
+
<sp-swatch value="color-2" color="blue"></sp-swatch>
|
|
326
|
+
</sp-swatch-group>
|
|
327
|
+
`);
|
|
328
|
+
await elementUpdated(el);
|
|
329
|
+
expect(el.selected).to.deep.equal(["color-1"]);
|
|
330
|
+
el.selected = ["color-2"];
|
|
331
|
+
await elementUpdated(el);
|
|
332
|
+
expect(el.selected).to.deep.equal(["color-2"]);
|
|
333
|
+
});
|
|
281
334
|
});
|
|
282
335
|
//# sourceMappingURL=swatch-group.test.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch-group.test.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 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 { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\n\nimport '../sp-swatch.js';\nimport { Swatch, SwatchGroup } from '../';\nimport { Default } from '../stories/swatch-group.stories.js';\nimport { spy } from 'sinon';\nimport { html } from '@spectrum-web-components/base';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Swatch Group', () => {\n let el: SwatchGroup;\n beforeEach(async () => {\n el = await fixture<SwatchGroup>(Default(Default.args));\n\n await elementUpdated(el);\n });\n testForLitDevWarnings(\n async () => await fixture<SwatchGroup>(Default(Default.args))\n );\n it('loads default swatch accessibly', async () => {\n await expect(el).to.be.accessible();\n });\n it('forwards `border` to children', async () => {\n el.border = 'light';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.equal('light');\n });\n });\n it('forwards `rounding` to children', async () => {\n el.rounding = 'full';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.rounding).to.equal('full');\n });\n });\n it('forwards `size` to children', async () => {\n el.size = 'xs';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.size).to.equal('xs');\n });\n });\n it('forwards `shape` to children', async () => {\n el.shape = 'rectangle';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.shape).to.equal('rectangle');\n });\n });\n it('unsets forwarding', async () => {\n el.border = 'light';\n el.rounding = 'full';\n el.size = 'xs';\n el.shape = 'rectangle';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.not.be.undefined;\n expect(child.rounding).to.not.be.undefined;\n expect(child.size).to.not.equal('m');\n expect(child.shape).to.not.be.undefined;\n });\n\n el.border = undefined;\n el.rounding = undefined;\n el.removeAttribute('size');\n el.shape = undefined;\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.equal(undefined);\n expect(child.rounding).to.equal(undefined);\n expect(child.size).to.equal('m');\n expect(child.shape).to.equal(undefined);\n });\n });\n it('does not dispatch `change` events without `selects` attribute', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild.click();\n\n expect(changeSpy.called).to.be.false;\n expect(el.selected).to.deep.equal([]);\n });\n it('dispatches `change` events as [selects=\"single\"]', async () => {\n el.selects = 'single';\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n\n selectedChild.click();\n\n expect(changeSpy.calledOnce).to.be.true;\n expect(el.selected).to.deep.equal([selectedChild.value]);\n expect(selectedChild.selected).to.be.true;\n\n selectedChild.click();\n\n expect(changeSpy.calledOnce).to.be.true;\n expect(el.selected).to.deep.equal([selectedChild.value]);\n expect(selectedChild.selected).to.be.true;\n });\n it('can have `change` events prevented', async () => {\n el.selects = 'single';\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n\n selectedChild.click();\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n });\n it('dispatches `change` events as [selects=\"multiple\"]', async () => {\n el.selects = 'multiple';\n const selectedChild0 = el.querySelector(\n ':scope > sp-swatch:nth-child(1)'\n ) as Swatch;\n const selectedChild1 = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n const selectedChild2 = el.querySelector(\n ':scope > sp-swatch:nth-child(6)'\n ) as Swatch;\n\n await elementUpdated(selectedChild0);\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild0.click();\n selectedChild1.click();\n selectedChild2.click();\n\n expect(changeSpy.callCount).to.equal(3);\n expect(el.selected).to.deep.equal([\n selectedChild0.value,\n selectedChild1.value,\n selectedChild2.value,\n ]);\n });\n it('filters `selected` when a selected Swatch is removed from the DOM', async () => {\n el.selects = 'multiple';\n const selectedChild0 = el.querySelector(\n ':scope > sp-swatch:nth-child(1)'\n ) as Swatch;\n const selectedChild1 = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n const selectedChild2 = el.querySelector(\n ':scope > sp-swatch:nth-child(6)'\n ) as Swatch;\n\n await elementUpdated(selectedChild0);\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild0.click();\n selectedChild1.click();\n selectedChild2.click();\n\n expect(el.selected).to.deep.equal([\n selectedChild0.value,\n selectedChild1.value,\n selectedChild2.value,\n ]);\n\n selectedChild0.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([\n selectedChild1.value,\n selectedChild2.value,\n ]);\n\n selectedChild2.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([selectedChild1.value]);\n\n selectedChild1.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([]);\n });\n it('maintains a single tab stop', async () => {\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n expect(document.activeElement === el.children[0]).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.true;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.true;\n });\n it('makes the first selected child the single tab stop', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n expect(selectedChild.selected).to.be.false;\n\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n el.selects = 'single';\n el.selected = [selectedChild.value];\n await elementUpdated(el);\n await nextFrame();\n\n expect(selectedChild.selected).to.be.true;\n\n expect(document.activeElement === selectedChild).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === selectedChild).to.be.true;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === selectedChild).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === selectedChild).to.be.true;\n });\n it('focus()es to the first Swatch', async () => {\n el.focus();\n expect(document.activeElement === el.children[0]).to.be.true;\n });\n it('focus()es to the first selected Swatch', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n expect(selectedChild.selected).to.be.false;\n el.selects = 'single';\n el.selected = [selectedChild.value];\n await elementUpdated(el);\n await nextFrame();\n\n expect(selectedChild.selected).to.be.true;\n el.focus();\n expect(document.activeElement === selectedChild).to.be.true;\n });\n});\n\ndescribe('Swatch Group - DOM selected', () => {\n it('accepts selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\">\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\" selected></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-1', 'color-3']);\n });\n it('merges `selected` and selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\" .selected=${['color-1']}>\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\"></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-1', 'color-3']);\n });\n it('lazily accepts selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\">\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\"></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n const color1 = el.querySelector('[value=\"color-1\"]') as Swatch;\n\n expect(el.selected).to.deep.equal(['color-3']);\n\n color1.selected = true;\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-3', 'color-1']);\n });\n});\n"],
|
|
5
|
-
"mappings": ";AAWA,SAAS,gBAAgB,QAAQ,SAAS,iBAAiB;AAC3D,SAAS,gBAAgB;AAEzB,OAAO;AAEP,SAAS,eAAe;AACxB,SAAS,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 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 { elementUpdated, expect, fixture, nextFrame } from '@open-wc/testing';\nimport { sendKeys } from '@web/test-runner-commands';\n\nimport '@spectrum-web-components/swatch/sp-swatch.js';\nimport { Swatch, SwatchGroup } from '../';\nimport { Default } from '../stories/swatch-group.stories.js';\nimport { spy, stub } from 'sinon';\nimport { html } from '@spectrum-web-components/base';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Swatch Group', () => {\n let el: SwatchGroup;\n beforeEach(async () => {\n el = await fixture<SwatchGroup>(Default(Default.args));\n\n await elementUpdated(el);\n });\n testForLitDevWarnings(\n async () => await fixture<SwatchGroup>(Default(Default.args))\n );\n it('loads default swatch accessibly', async () => {\n await expect(el).to.be.accessible();\n });\n it('forwards `border` to children', async () => {\n el.border = 'light';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.equal('light');\n });\n });\n it('forwards `rounding` to children', async () => {\n el.rounding = 'full';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.rounding).to.equal('full');\n });\n });\n it('forwards `size` to children', async () => {\n el.size = 'xs';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.size).to.equal('xs');\n });\n });\n it('forwards `shape` to children', async () => {\n el.shape = 'rectangle';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.shape).to.equal('rectangle');\n });\n });\n it('unsets forwarding', async () => {\n el.border = 'light';\n el.rounding = 'full';\n el.size = 'xs';\n el.shape = 'rectangle';\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.not.be.undefined;\n expect(child.rounding).to.not.be.undefined;\n expect(child.size).to.not.equal('m');\n expect(child.shape).to.not.be.undefined;\n });\n\n el.border = undefined;\n el.rounding = undefined;\n el.removeAttribute('size');\n el.shape = undefined;\n await elementUpdated(el);\n\n ([...el.children] as Swatch[]).forEach((child) => {\n expect(child.border).to.equal(undefined);\n expect(child.rounding).to.equal(undefined);\n expect(child.size).to.equal('m');\n expect(child.shape).to.equal(undefined);\n });\n });\n it('does not dispatch `change` events without `selects` attribute', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild.click();\n\n expect(changeSpy.called).to.be.false;\n expect(el.selected).to.deep.equal([]);\n });\n it('dispatches `change` events as [selects=\"single\"]', async () => {\n el.selects = 'single';\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n\n selectedChild.click();\n\n expect(changeSpy.calledOnce).to.be.true;\n expect(el.selected).to.deep.equal([selectedChild.value]);\n expect(selectedChild.selected).to.be.true;\n\n selectedChild.click();\n\n expect(changeSpy.calledOnce).to.be.true;\n expect(el.selected).to.deep.equal([selectedChild.value]);\n expect(selectedChild.selected).to.be.true;\n });\n it('can have `change` events prevented', async () => {\n el.selects = 'single';\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n\n el.addEventListener('change', (event: Event) => event.preventDefault());\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n\n selectedChild.click();\n\n expect(el.selected).to.deep.equal([]);\n expect(selectedChild.selected).to.be.false;\n });\n it('dispatches `change` events as [selects=\"multiple\"]', async () => {\n el.selects = 'multiple';\n const selectedChild0 = el.querySelector(\n ':scope > sp-swatch:nth-child(1)'\n ) as Swatch;\n const selectedChild1 = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n const selectedChild2 = el.querySelector(\n ':scope > sp-swatch:nth-child(6)'\n ) as Swatch;\n\n await elementUpdated(selectedChild0);\n\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild0.click();\n selectedChild1.click();\n selectedChild2.click();\n\n expect(changeSpy.callCount).to.equal(3);\n expect(el.selected).to.deep.equal([\n selectedChild0.value,\n selectedChild1.value,\n selectedChild2.value,\n ]);\n });\n it('filters `selected` when a selected Swatch is removed from the DOM', async () => {\n el.selects = 'multiple';\n const selectedChild0 = el.querySelector(\n ':scope > sp-swatch:nth-child(1)'\n ) as Swatch;\n const selectedChild1 = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n const selectedChild2 = el.querySelector(\n ':scope > sp-swatch:nth-child(6)'\n ) as Swatch;\n\n await elementUpdated(selectedChild0);\n\n expect(el.selected).to.deep.equal([]);\n\n selectedChild0.click();\n selectedChild1.click();\n selectedChild2.click();\n\n expect(el.selected).to.deep.equal([\n selectedChild0.value,\n selectedChild1.value,\n selectedChild2.value,\n ]);\n\n selectedChild0.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([\n selectedChild1.value,\n selectedChild2.value,\n ]);\n\n selectedChild2.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([selectedChild1.value]);\n\n selectedChild1.remove();\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal([]);\n });\n it('maintains a single tab stop', async () => {\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n expect(document.activeElement === el.children[0]).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.true;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === el.children[0]).to.be.true;\n });\n it('makes the first selected child the single tab stop', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n expect(selectedChild.selected).to.be.false;\n\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n el.selects = 'single';\n el.selected = [selectedChild.value];\n await elementUpdated(el);\n await nextFrame();\n\n expect(selectedChild.selected).to.be.true;\n\n expect(document.activeElement === selectedChild).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === selectedChild).to.be.true;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === selectedChild).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === selectedChild).to.be.true;\n });\n it('focus()es to the first Swatch', async () => {\n el.focus();\n expect(document.activeElement === el.children[0]).to.be.true;\n });\n it('focus()es to the first selected Swatch', async () => {\n const selectedChild = el.querySelector(\n ':scope > sp-swatch:nth-child(4)'\n ) as Swatch;\n expect(selectedChild.selected).to.be.false;\n el.selects = 'single';\n el.selected = [selectedChild.value];\n await elementUpdated(el);\n await nextFrame();\n\n expect(selectedChild.selected).to.be.true;\n el.focus();\n expect(document.activeElement === selectedChild).to.be.true;\n });\n});\n\ndescribe('Swatch Group - DOM selected', () => {\n describe('dev mode', () => {\n let consoleWarnStub!: ReturnType<typeof stub>;\n before(() => {\n window.__swc.verbose = true;\n consoleWarnStub = stub(console, 'warn');\n });\n afterEach(() => {\n consoleWarnStub.resetHistory();\n });\n after(() => {\n window.__swc.verbose = false;\n consoleWarnStub.restore();\n });\n\n it('warns in Dev Mode when mixed-value attribute is added in sp-swatch when parent sp-swatch-group is not having selects=\"multiple\"', async () => {\n const el = await fixture<SwatchGroup>(\n html`\n <sp-swatch-group selects=\"single\">\n <sp-swatch mixed-value></sp-swatch>\n </sp-swatch-group>\n `\n );\n\n await elementUpdated(el);\n\n expect(consoleWarnStub.called).to.be.true;\n const spyCall = consoleWarnStub.getCall(0);\n\n expect(\n (spyCall.args.at(0) as string).includes(\n '<sp-swatch> elements can only leverage the \"mixed-value\" attribute when their <sp-swatch-group> parent element is also leveraging \"selects=\"multiple\"'\n ),\n 'confirm warning message'\n ).to.be.true;\n\n expect(spyCall.args.at(-1), 'confirm `data` shape').to.deep.equal({\n data: {\n localName: 'sp-swatch-group',\n type: 'accessibility',\n level: 'default',\n },\n });\n });\n });\n it('accepts selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\">\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\" selected></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-1', 'color-3']);\n });\n it('merges `selected` and selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\" .selected=${['color-1']}>\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\"></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-1', 'color-3']);\n });\n it('lazily accepts selection from DOM', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"multiple\">\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\"></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n <sp-swatch value=\"color-3\" color=\"yellow\" selected></sp-swatch>\n </sp-swatch-group>\n `);\n\n await elementUpdated(el);\n const color1 = el.querySelector('[value=\"color-1\"]') as Swatch;\n\n expect(el.selected).to.deep.equal(['color-3']);\n\n color1.selected = true;\n await elementUpdated(el);\n\n expect(el.selected).to.deep.equal(['color-3', 'color-1']);\n });\n it('clears previously selected children when updating `selected`', async () => {\n const el = await fixture<SwatchGroup>(html`\n <sp-swatch-group selects=\"single\" .selected=${['color-1']}>\n <sp-swatch value=\"color-0\" color=\"red\"></sp-swatch>\n <sp-swatch value=\"color-1\" color=\"green\"></sp-swatch>\n <sp-swatch value=\"color-2\" color=\"blue\"></sp-swatch>\n </sp-swatch-group>\n `);\n await elementUpdated(el);\n expect(el.selected).to.deep.equal(['color-1']);\n el.selected = ['color-2'];\n await elementUpdated(el);\n expect(el.selected).to.deep.equal(['color-2']);\n });\n});\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,gBAAgB,QAAQ,SAAS,iBAAiB;AAC3D,SAAS,gBAAgB;AAEzB,OAAO;AAEP,SAAS,eAAe;A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AAG,KAAK,MAAM,CAAC,SAAS,CAAC;AAC7C,OAAG,WAAW,CAAC,SAAS;AACxB,UAAM,eAAe,EAAE;AACvB,WAAO,GAAG,QAAQ,EAAE,GAAG,KAAK,MAAM,CAAC,SAAS,CAAC;AAAA,EACjD,CAAC;AACL,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/swatch.test.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
3
3
|
import { spy } from "sinon";
|
|
4
4
|
import { sendKeys } from "@web/test-runner-commands";
|
|
5
|
-
import "
|
|
5
|
+
import "@spectrum-web-components/swatch/sp-swatch.js";
|
|
6
6
|
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
7
7
|
describe("Swatch", () => {
|
|
8
8
|
let el;
|
package/test/swatch.test.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["swatch.test.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { spy } from 'sinon';\nimport { sendKeys } from '@web/test-runner-commands';\n\nimport '
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { spy } from 'sinon';\nimport { sendKeys } from '@web/test-runner-commands';\n\nimport '@spectrum-web-components/swatch/sp-swatch.js';\nimport { Swatch } from '../src/Swatch.js';\nimport { ElementSize } from '@spectrum-web-components/base';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Swatch', () => {\n let el: Swatch;\n beforeEach(async () => {\n el = await fixture<Swatch>(\n html`\n <sp-swatch color=\"red\" label=\"Red\"></sp-swatch>\n `\n );\n\n await elementUpdated(el);\n });\n testForLitDevWarnings(\n async () =>\n await fixture<Swatch>(\n html`\n <sp-swatch color=\"red\" label=\"Red\"></sp-swatch>\n `\n )\n );\n it(`loads default swatch accessibly`, async () => {\n await expect(el).to.be.accessible();\n });\n it('loads [mixed-value] swatch accessibly', async () => {\n el.mixedValue = true;\n await expect(el).to.be.accessible();\n expect(el.getAttribute('aria-checked')).to.equal('mixed');\n });\n it('loads [nothing] swatch accessibly', async () => {\n el.nothing = true;\n el.removeAttribute('color');\n el.label = 'Transparent';\n\n await expect(el).to.be.accessible();\n expect(el.getAttribute('aria-label')).to.equal('Transparent');\n });\n (['xs', 's', 'm', 'l'] as ElementSize[]).map((size) => {\n it(`loads [mixed-value] swatch accessibly as [size=${size}]`, async () => {\n el.mixedValue = true;\n el.removeAttribute('color');\n el.label = 'Mixed Value';\n el.size = size;\n\n await expect(el).to.be.accessible();\n expect(el.getAttribute('aria-label')).to.equal('Mixed Value');\n });\n });\n it('toggles on `click`', async () => {\n expect(el.selected).to.be.false;\n\n el.click();\n\n expect(el.selected).to.be.true;\n await expect(el).to.be.accessible();\n });\n it('toggles on `click` as [role=\"checkbox\"]', async () => {\n el.role = 'checkbox';\n await elementUpdated(el);\n\n expect(el.selected).to.be.false;\n await expect(el).to.be.accessible();\n\n el.click();\n\n expect(el.selected).to.be.true;\n await expect(el).to.be.accessible();\n });\n it('toggles on `Space`', async () => {\n expect(el.selected).to.be.false;\n\n el.focus();\n await sendKeys({\n press: 'Space',\n });\n\n expect(el.selected).to.be.true;\n });\n it('toggles on `Enter`', async () => {\n expect(el.selected).to.be.false;\n\n el.focus();\n await sendKeys({\n press: 'Enter',\n });\n\n expect(el.selected).to.be.true;\n\n await sendKeys({\n press: 'NumpadEnter',\n });\n\n expect(el.selected).to.be.false;\n });\n it('dispatches `change`', async () => {\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n\n el.click();\n\n expect(changeSpy.calledOnce).to.be.true;\n });\n it('does not dispatch `change` when [disabled]', async () => {\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n el.disabled = true;\n await elementUpdated(el);\n\n el.click();\n\n expect(changeSpy.calledOnce).to.be.false;\n });\n it('does not dispatch `change` when [mixed-value]', async () => {\n const changeSpy = spy();\n\n el.addEventListener('change', () => changeSpy());\n el.mixedValue = true;\n await elementUpdated(el);\n\n el.click();\n\n expect(changeSpy.calledOnce).to.be.false;\n });\n it('can have `change` prevented', async () => {\n el.addEventListener('change', (event: Event) => {\n event.preventDefault();\n });\n\n expect(el.selected).to.false;\n\n el.click();\n\n expect(el.selected).to.false;\n });\n it('is in the tab order', async () => {\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n expect(document.activeElement === el).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el).to.be.true;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === el).to.be.true;\n });\n it('is not in the tab order when [disabled]', async () => {\n const inputBefore = document.createElement('input');\n const inputAfter = document.createElement('input');\n el.insertAdjacentElement('beforebegin', inputBefore);\n el.insertAdjacentElement('afterend', inputAfter);\n inputBefore.focus();\n el.disabled = true;\n await elementUpdated(el);\n\n expect(document.activeElement === el).to.be.false;\n await sendKeys({\n press: 'Tab',\n });\n expect(document.activeElement === el).to.be.false;\n await sendKeys({\n press: 'Shift+Tab',\n });\n expect(document.activeElement === el).to.be.false;\n });\n});\n"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AACtD,SAAS,WAAW;AACpB,SAAS,gBAAgB;AAEzB,OAAO;AAGP,SAAS,6BAA6B;AAEtC,SAAS,UAAU,MAAM;AACrB,MAAI;AACJ,aAAW,YAAY;AACnB,SAAK,MAAM;AAAA,MACP;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAAA,EAC3B,CAAC;AACD;AAAA,IACI,YACI,MAAM;AAAA,MACF;AAAA;AAAA;AAAA,IAGJ;AAAA,EACR;AACA,KAAG,mCAAmC,YAAY;AAC9C,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,yCAAyC,YAAY;AACpD,OAAG,aAAa;AAChB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAClC,WAAO,GAAG,aAAa,cAAc,CAAC,EAAE,GAAG,MAAM,OAAO;AAAA,EAC5D,CAAC;AACD,KAAG,qCAAqC,YAAY;AAChD,OAAG,UAAU;AACb,OAAG,gBAAgB,OAAO;AAC1B,OAAG,QAAQ;AAEX,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAClC,WAAO,GAAG,aAAa,YAAY,CAAC,EAAE,GAAG,MAAM,aAAa;AAAA,EAChE,CAAC;AACD,EAAC,CAAC,MAAM,KAAK,KAAK,GAAG,EAAoB,IAAI,CAAC,SAAS;AACnD,OAAG,kDAAkD,SAAS,YAAY;AACtE,SAAG,aAAa;AAChB,SAAG,gBAAgB,OAAO;AAC1B,SAAG,QAAQ;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