@spectrum-web-components/swatch 1.7.0 → 1.8.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 CHANGED
@@ -1,4 +1,4 @@
1
- ## Description
1
+ ## Overview
2
2
 
3
3
  An `<sp-swatch>` shows a small sample of a fill — such as a color, gradient, texture, or material — that is intended to be applied to an object.
4
4
 
@@ -7,23 +7,25 @@ An `<sp-swatch>` shows a small sample of a fill — such as a color, gradient, t
7
7
  [![See it on NPM!](https://img.shields.io/npm/v/@spectrum-web-components/swatch?style=for-the-badge)](https://www.npmjs.com/package/@spectrum-web-components/swatch)
8
8
  [![How big is this package in your project?](https://img.shields.io/bundlephobia/minzip/@spectrum-web-components/swatch?style=for-the-badge)](https://bundlephobia.com/result?p=@spectrum-web-components/swatch)
9
9
 
10
- ```
10
+ ```bash
11
11
  yarn add @spectrum-web-components/swatch
12
12
  ```
13
13
 
14
14
  Import the side effectful registration of `<sp-swatch>` via:
15
15
 
16
- ```
16
+ ```js
17
17
  import '@spectrum-web-components/swatch/sp-swatch.js';
18
18
  ```
19
19
 
20
20
  When looking to leverage the `Swatch` base class as a type and/or for extension purposes, do so via:
21
21
 
22
- ```
22
+ ```js
23
23
  import { Swatch } from '@spectrum-web-components/swatch';
24
24
  ```
25
25
 
26
- ## Sizes
26
+ ### Options
27
+
28
+ #### Sizes
27
29
 
28
30
  <sp-tabs selected="m" auto label="Size Attribute Options">
29
31
  <sp-tab value="xs">Extra Small</sp-tab>
@@ -156,11 +158,13 @@ import { Swatch } from '@spectrum-web-components/swatch';
156
158
  </sp-tab-panel>
157
159
  </sp-tabs>
158
160
 
159
- ## Modifying attributes
161
+ #### Variants
160
162
 
161
163
  An `<sp-swatch>` element can be modified by the following attributes/properties to customize its delivery as desired for your use case: `border`, `color`, `disabled`, `mixedValue` (accepted as the `mixed-value` attribute), `nothing`, `rounding`, and `shape`. Use these in concert with each other for a variety of final visual deliveries.
162
164
 
163
- ### Border
165
+ <sp-tabs selected="border" auto label="Variant Options">
166
+ <sp-tab value="border">Border</sp-tab>
167
+ <sp-tab-panel value="border">
164
168
 
165
169
  The `border` attribute/property is not required and when applied accepts the values of `none` or `light`.
166
170
 
@@ -172,7 +176,9 @@ The `border` attribute/property is not required and when applied accepts the val
172
176
  </sp-swatch-group>
173
177
  ```
174
178
 
175
- ### Color
179
+ </sp-tab-panel>
180
+ <sp-tab value="color">Color</sp-tab>
181
+ <sp-tab-panel value="color">
176
182
 
177
183
  The `color` attribute/property determines the color value that the `<sp-swatch>` element will deliver.
178
184
 
@@ -184,19 +190,9 @@ The `color` attribute/property determines the color value that the `<sp-swatch>`
184
190
  </sp-swatch-group>
185
191
  ```
186
192
 
187
- ### Disabled
188
-
189
- The `disabled` attribute/property determines prevents interaction on the `<sp-swatch>` element.
190
-
191
- ```html
192
- <sp-swatch-group>
193
- <sp-swatch disabled color="rgb(255 0 0 / 0.7)"></sp-swatch>
194
- <sp-swatch disabled color="orange"></sp-swatch>
195
- <sp-swatch disabled color="var(--spectrum-magenta-500)"></sp-swatch>
196
- </sp-swatch-group>
197
- ```
198
-
199
- ### Mixed value
193
+ </sp-tab-panel>
194
+ <sp-tab value="mixed-value">Mixed Value</sp-tab>
195
+ <sp-tab-panel value="mixed-value">
200
196
 
201
197
  The `mixed-value` attribute and `mixedValue` property outline when an `<sp-swatch>` element represents more than one color.
202
198
 
@@ -210,7 +206,9 @@ The `mixed-value` attribute and `mixedValue` property outline when an `<sp-swatc
210
206
 
211
207
  Please note that the `aria-checked="mixed"` value only applies when the swatch is in a group with `selects="multiple"`
212
208
 
213
- ### Nothing
209
+ </sp-tab-panel>
210
+ <sp-tab value="nothing">Nothing</sp-tab>
211
+ <sp-tab-panel value="nothing">
214
212
 
215
213
  The `nothing` attribute/property outlines that the `<sp-swatch>` represents no color or that it represents "transparent".
216
214
 
@@ -222,7 +220,9 @@ The `nothing` attribute/property outlines that the `<sp-swatch>` represents no c
222
220
  </sp-swatch-group>
223
221
  ```
224
222
 
225
- ### Rounding
223
+ </sp-tab-panel>
224
+ <sp-tab value="rounding">Rounding</sp-tab>
225
+ <sp-tab-panel value="rounding">
226
226
 
227
227
  The `rounding` attribute/property is not required and when applied accepts the values of `none` or `full`.
228
228
 
@@ -234,7 +234,9 @@ The `rounding` attribute/property is not required and when applied accepts the v
234
234
  </sp-swatch-group>
235
235
  ```
236
236
 
237
- ### Shape
237
+ </sp-tab-panel>
238
+ <sp-tab value="shape">Shape</sp-tab>
239
+ <sp-tab-panel value="shape">
238
240
 
239
241
  The `shape` attribute/property is not required and when applied accepts the values of `rectangle`.
240
242
 
@@ -244,3 +246,33 @@ The `shape` attribute/property is not required and when applied accepts the valu
244
246
  <sp-swatch color="rgb(255 0 0 / 0.7)" shape="rectangle"></sp-swatch>
245
247
  </sp-swatch-group>
246
248
  ```
249
+
250
+ </sp-tab-panel>
251
+ </sp-tabs>
252
+
253
+ ### States
254
+
255
+ #### Disabled
256
+
257
+ The `disabled` attribute/property determines prevents interaction on the `<sp-swatch>` element.
258
+
259
+ ```html
260
+ <sp-swatch-group>
261
+ <sp-swatch disabled color="rgb(255 0 0 / 0.7)"></sp-swatch>
262
+ <sp-swatch disabled color="orange"></sp-swatch>
263
+ <sp-swatch disabled color="var(--spectrum-magenta-500)"></sp-swatch>
264
+ </sp-swatch-group>
265
+ ```
266
+
267
+ ### Accessibility
268
+
269
+ #### Best practices
270
+
271
+ - Ensure swatches have sufficient color contrast for visibility.
272
+ - Verify that swatches are appropriately labeled for screen readers.
273
+
274
+ #### Keyboard navigation
275
+
276
+ - `Tab`: Move focus to the next focusable element
277
+ - `Arrow keys`: Navigate between swatches in the group and move the focus indicator
278
+ - `Enter` or `Space`: Select the focused swatch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/swatch",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -75,12 +75,12 @@
75
75
  ],
76
76
  "dependencies": {
77
77
  "@lit-labs/observers": "^2.0.2",
78
- "@spectrum-web-components/base": "1.7.0",
79
- "@spectrum-web-components/icon": "1.7.0",
80
- "@spectrum-web-components/icons-ui": "1.7.0",
81
- "@spectrum-web-components/opacity-checkerboard": "1.7.0",
82
- "@spectrum-web-components/reactive-controllers": "1.7.0",
83
- "@spectrum-web-components/shared": "1.7.0"
78
+ "@spectrum-web-components/base": "1.8.0",
79
+ "@spectrum-web-components/icon": "1.8.0",
80
+ "@spectrum-web-components/icons-ui": "1.8.0",
81
+ "@spectrum-web-components/opacity-checkerboard": "1.8.0",
82
+ "@spectrum-web-components/reactive-controllers": "1.8.0",
83
+ "@spectrum-web-components/shared": "1.8.0"
84
84
  },
85
85
  "types": "./src/index.d.ts",
86
86
  "customElements": "custom-elements.json",
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { SwatchGroup } from './src/SwatchGroup.js';
2
13
  declare global {
3
14
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-swatch-group.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 { SwatchGroup } from './src/SwatchGroup.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch-group', SwatchGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch-group': SwatchGroup;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { SwatchGroup } from './src/SwatchGroup.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch-group', SwatchGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch-group': SwatchGroup;\n }\n}\n"],
5
5
  "mappings": ";AAWA,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,cAAc,mBAAmB,WAAW;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-swatch-group.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 { SwatchGroup } from './src/SwatchGroup.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch-group', SwatchGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch-group': SwatchGroup;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { SwatchGroup } from './src/SwatchGroup.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch-group', SwatchGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch-group': SwatchGroup;\n }\n}\n"],
5
5
  "mappings": "aAWA,OAAS,eAAAA,MAAmB,uBAC5B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,kBAAmBD,CAAW",
6
6
  "names": ["SwatchGroup", "defineElement"]
7
7
  }
package/sp-swatch.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { Swatch } from './src/Swatch.js';
2
13
  declare global {
3
14
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-swatch.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 { Swatch } from './src/Swatch.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch', Swatch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch': Swatch;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { Swatch } from './src/Swatch.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch', Swatch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch': Swatch;\n }\n}\n"],
5
5
  "mappings": ";AAWA,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,cAAc,aAAa,MAAM;",
6
6
  "names": []
7
7
  }
package/sp-swatch.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-swatch.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 { Swatch } from './src/Swatch.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch', Swatch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch': Swatch;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { Swatch } from './src/Swatch.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch', Swatch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch': Swatch;\n }\n}\n"],
5
5
  "mappings": "aAWA,OAAS,UAAAA,MAAc,kBACvB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,YAAaD,CAAM",
6
6
  "names": ["Swatch", "defineElement"]
7
7
  }
package/src/Swatch.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
2
13
  import { Focusable } from '@spectrum-web-components/shared/src/focusable.js';
3
14
  import '@spectrum-web-components/icons-ui/icons/sp-icon-dash75.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Swatch.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 {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport {\n ifDefined,\n when,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport opacityCheckerboardStyles from '@spectrum-web-components/opacity-checkerboard/src/opacity-checkerboard.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash300.js';\n\nimport styles from './swatch.css.js';\nimport dashStyles from '@spectrum-web-components/icon/src/spectrum-icon-dash.css.js';\n\nexport type SwatchBorder = 'light' | 'none' | undefined;\nexport type SwatchRounding = 'none' | 'full' | undefined;\nexport type SwatchShape = 'rectangle' | undefined;\n\nconst dashIcon: Record<string, () => TemplateResult> = {\n xs: () => html`\n <sp-icon-dash75\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash75\"\n ></sp-icon-dash75>\n `,\n s: () => html`\n <sp-icon-dash100\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash100\"\n ></sp-icon-dash100>\n `,\n m: () => html`\n <sp-icon-dash200\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash200\"\n ></sp-icon-dash200>\n `,\n l: () => html`\n <sp-icon-dash300\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash300\"\n ></sp-icon-dash300>\n `,\n};\n\n/**\n * @element sp-swatch\n */\nexport class Swatch extends SizedMixin(Focusable, {\n validSizes: ['xs', 's', 'm', 'l'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [opacityCheckerboardStyles, styles, dashStyles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property()\n public color = '';\n\n @property()\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'mixed-value' })\n public mixedValue = false;\n\n @property({ type: Boolean, reflect: true })\n public nothing = false;\n\n @property({ reflect: true })\n public override role = 'button';\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property()\n get value(): string {\n return this._value || this.color || this.label;\n }\n\n set value(value: string) {\n if (value === this._value) return;\n const oldValue = this.value;\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n private _value?: string;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n public toggle(force?: boolean): void {\n this.selected = force ?? !this.selected;\n }\n\n private handleClick(): void {\n if (this.disabled || this.mixedValue) return;\n this.toggle();\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.toggle();\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n event.preventDefault();\n this.addEventListener('keyup', this.handleKeyup);\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n private handleKeypress(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Enter':\n case 'NumpadEnter':\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n this.removeEventListener('keyup', this.handleKeyup);\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected renderDisabled = (): TemplateResult => {\n return html`\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"disabledIcon\"\n viewBox=\"0 0 20 20\"\n >\n <path\n d=\"M9.889,1a8.889,8.889,0,1,0,8.889,8.889A8.889,8.889,0,0,0,9.889,1Zm6.667,8.889a6.635,6.635,0,0,1-1.233,3.863l-9.3-9.3A6.667,6.667,0,0,1,16.556,9.889Zm-13.333,0A6.636,6.636,0,0,1,4.455,6.026l9.3,9.3A6.667,6.667,0,0,1,3.222,9.889Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-color)\"\n />\n <path\n d=\"M 9.888889312744141 1 C 4.979689598083496 1 1 4.979689598083496 1 9.888889312744141 C 1 14.7980899810791 4.979689598083496 18.77777862548828 9.888889312744141 18.77777862548828 C 14.7980899810791 18.77777862548828 18.77777862548828 14.7980899810791 18.77777862548828 9.888889312744141 C 18.77777862548828 4.979689598083496 14.7980899810791 1 9.888889312744141 1 M 15.32277870178223 13.75166893005371 L 6.02610969543457 4.454998970031738 C 8.059318542480469 3.009572982788086 10.72937774658203 2.820217132568359 12.9462194442749 3.964249610900879 C 15.16304969787598 5.10828971862793 16.55568885803223 7.394259452819824 16.5555591583252 9.888889312744141 C 16.55776977539062 11.27357959747314 16.126708984375 12.62425994873047 15.32277870178223 13.75166893005371 M 9.888258934020996 16.55648612976074 C 8.843273162841797 16.55648612976074 7.794573783874512 16.31111145019531 6.831318855285645 15.8139591217041 C 4.614439010620117 14.66977882385254 3.221879959106445 12.38361930847168 3.222219467163086 9.888889312744141 C 3.220088958740234 8.504219055175781 3.651140213012695 7.153559684753418 4.454998970031738 6.02610969543457 L 13.75166893005371 15.32333946228027 C 12.60186290740967 16.14075088500977 11.24825286865234 16.55648612976074 9.888258934020996 16.55648612976074 M 9.888889312744141 0 C 15.34163951873779 0 19.77777862548828 4.436139106750488 19.77777862548828 9.888889312744141 C 19.77777862548828 15.34163951873779 15.34163951873779 19.77777862548828 9.888889312744141 19.77777862548828 C 4.436139106750488 19.77777862548828 0 15.34163951873779 0 9.888889312744141 C 0 4.436139106750488 4.436139106750488 0 9.888889312744141 0 Z M 15.10232830047607 12.11699867248535 C 15.40205764770508 11.41858959197998 15.55679702758789 10.66494941711426 15.5555591583252 9.89048957824707 C 15.5556697845459 7.759209632873535 14.38009929656982 5.829549789428711 12.48761940002441 4.852889060974121 C 11.68764972686768 4.440059661865234 10.78924942016602 4.22184944152832 9.889529228210449 4.22184944152832 C 9.114802360534668 4.22184944152832 8.360831260681152 4.377038955688477 7.661839485168457 4.676509857177734 L 15.10232830047607 12.11699867248535 Z M 12.11597919464111 15.10181331634521 L 4.675475120544434 7.660861015319824 C 4.375750541687012 8.359296798706055 4.221027374267578 9.112875938415527 4.222219467163086 9.887349128723145 C 4.221929550170898 12.01874923706055 5.397418975830078 13.94855880737305 7.289958953857422 14.92533874511719 C 8.08997917175293 15.3382396697998 8.988459587097168 15.55648994445801 9.888258934020996 15.55648994445801 C 10.66298007965088 15.55648994445801 11.41698551177979 15.40128421783447 12.11597919464111 15.10181331634521 Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-stroke-color)\"\n />\n </svg>\n `;\n };\n\n protected renderMixedValue = (): TemplateResult => {\n return dashIcon[this.size]();\n };\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=\"opacity-checkerboard fill\"\n style=${ifDefined(\n this.color\n ? `--spectrum-picked-color: ${this.color}`\n : undefined\n )}\n >\n <slot name=\"image\"></slot>\n ${when(this.disabled, this.renderDisabled)}\n ${when(this.mixedValue, this.renderMixedValue)}\n </div>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.getAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n if (changes.has('selected') || changes.has('role')) {\n const selectedAttribute =\n this.role === 'button' ? 'aria-pressed' : 'aria-checked';\n const removedSelectedAttribute =\n this.role === 'button' ? 'aria-checked' : 'aria-pressed';\n if (changes.has('role')) {\n this.removeAttribute(removedSelectedAttribute);\n }\n this.setAttribute(\n selectedAttribute,\n this.selected ? 'true' : 'false'\n );\n }\n\n // aria-label should be in sync with changes in label and color.\n if (\n changes.has('label') ||\n changes.has('color') ||\n changes.has('mixedValue')\n ) {\n if (this.label !== this.color && this.label?.length) {\n this.setAttribute('aria-label', this.label);\n } else if (this.color) {\n this.setAttribute('aria-label', this.color);\n } else if (this.mixedValue) {\n this.setAttribute('aria-label', 'Mixed');\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport {\n ifDefined,\n when,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport opacityCheckerboardStyles from '@spectrum-web-components/opacity-checkerboard/src/opacity-checkerboard.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash300.js';\n\nimport styles from './swatch.css.js';\nimport dashStyles from '@spectrum-web-components/icon/src/spectrum-icon-dash.css.js';\n\nexport type SwatchBorder = 'light' | 'none' | undefined;\nexport type SwatchRounding = 'none' | 'full' | undefined;\nexport type SwatchShape = 'rectangle' | undefined;\n\nconst dashIcon: Record<string, () => TemplateResult> = {\n xs: () => html`\n <sp-icon-dash75\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash75\"\n ></sp-icon-dash75>\n `,\n s: () => html`\n <sp-icon-dash100\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash100\"\n ></sp-icon-dash100>\n `,\n m: () => html`\n <sp-icon-dash200\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash200\"\n ></sp-icon-dash200>\n `,\n l: () => html`\n <sp-icon-dash300\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash300\"\n ></sp-icon-dash300>\n `,\n};\n\n/**\n * @element sp-swatch\n */\nexport class Swatch extends SizedMixin(Focusable, {\n validSizes: ['xs', 's', 'm', 'l'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [opacityCheckerboardStyles, styles, dashStyles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property()\n public color = '';\n\n @property()\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'mixed-value' })\n public mixedValue = false;\n\n @property({ type: Boolean, reflect: true })\n public nothing = false;\n\n @property({ reflect: true })\n public override role = 'button';\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property()\n get value(): string {\n return this._value || this.color || this.label;\n }\n\n set value(value: string) {\n if (value === this._value) return;\n const oldValue = this.value;\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n private _value?: string;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n public toggle(force?: boolean): void {\n this.selected = force ?? !this.selected;\n }\n\n private handleClick(): void {\n if (this.disabled || this.mixedValue) return;\n this.toggle();\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.toggle();\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n event.preventDefault();\n this.addEventListener('keyup', this.handleKeyup);\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n private handleKeypress(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Enter':\n case 'NumpadEnter':\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n this.removeEventListener('keyup', this.handleKeyup);\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected renderDisabled = (): TemplateResult => {\n return html`\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"disabledIcon\"\n viewBox=\"0 0 20 20\"\n >\n <path\n d=\"M9.889,1a8.889,8.889,0,1,0,8.889,8.889A8.889,8.889,0,0,0,9.889,1Zm6.667,8.889a6.635,6.635,0,0,1-1.233,3.863l-9.3-9.3A6.667,6.667,0,0,1,16.556,9.889Zm-13.333,0A6.636,6.636,0,0,1,4.455,6.026l9.3,9.3A6.667,6.667,0,0,1,3.222,9.889Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-color)\"\n />\n <path\n d=\"M 9.888889312744141 1 C 4.979689598083496 1 1 4.979689598083496 1 9.888889312744141 C 1 14.7980899810791 4.979689598083496 18.77777862548828 9.888889312744141 18.77777862548828 C 14.7980899810791 18.77777862548828 18.77777862548828 14.7980899810791 18.77777862548828 9.888889312744141 C 18.77777862548828 4.979689598083496 14.7980899810791 1 9.888889312744141 1 M 15.32277870178223 13.75166893005371 L 6.02610969543457 4.454998970031738 C 8.059318542480469 3.009572982788086 10.72937774658203 2.820217132568359 12.9462194442749 3.964249610900879 C 15.16304969787598 5.10828971862793 16.55568885803223 7.394259452819824 16.5555591583252 9.888889312744141 C 16.55776977539062 11.27357959747314 16.126708984375 12.62425994873047 15.32277870178223 13.75166893005371 M 9.888258934020996 16.55648612976074 C 8.843273162841797 16.55648612976074 7.794573783874512 16.31111145019531 6.831318855285645 15.8139591217041 C 4.614439010620117 14.66977882385254 3.221879959106445 12.38361930847168 3.222219467163086 9.888889312744141 C 3.220088958740234 8.504219055175781 3.651140213012695 7.153559684753418 4.454998970031738 6.02610969543457 L 13.75166893005371 15.32333946228027 C 12.60186290740967 16.14075088500977 11.24825286865234 16.55648612976074 9.888258934020996 16.55648612976074 M 9.888889312744141 0 C 15.34163951873779 0 19.77777862548828 4.436139106750488 19.77777862548828 9.888889312744141 C 19.77777862548828 15.34163951873779 15.34163951873779 19.77777862548828 9.888889312744141 19.77777862548828 C 4.436139106750488 19.77777862548828 0 15.34163951873779 0 9.888889312744141 C 0 4.436139106750488 4.436139106750488 0 9.888889312744141 0 Z M 15.10232830047607 12.11699867248535 C 15.40205764770508 11.41858959197998 15.55679702758789 10.66494941711426 15.5555591583252 9.89048957824707 C 15.5556697845459 7.759209632873535 14.38009929656982 5.829549789428711 12.48761940002441 4.852889060974121 C 11.68764972686768 4.440059661865234 10.78924942016602 4.22184944152832 9.889529228210449 4.22184944152832 C 9.114802360534668 4.22184944152832 8.360831260681152 4.377038955688477 7.661839485168457 4.676509857177734 L 15.10232830047607 12.11699867248535 Z M 12.11597919464111 15.10181331634521 L 4.675475120544434 7.660861015319824 C 4.375750541687012 8.359296798706055 4.221027374267578 9.112875938415527 4.222219467163086 9.887349128723145 C 4.221929550170898 12.01874923706055 5.397418975830078 13.94855880737305 7.289958953857422 14.92533874511719 C 8.08997917175293 15.3382396697998 8.988459587097168 15.55648994445801 9.888258934020996 15.55648994445801 C 10.66298007965088 15.55648994445801 11.41698551177979 15.40128421783447 12.11597919464111 15.10181331634521 Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-stroke-color)\"\n />\n </svg>\n `;\n };\n\n protected renderMixedValue = (): TemplateResult => {\n return dashIcon[this.size]();\n };\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=\"opacity-checkerboard fill\"\n style=${ifDefined(\n this.color\n ? `--spectrum-picked-color: ${this.color}`\n : undefined\n )}\n >\n <slot name=\"image\"></slot>\n ${when(this.disabled, this.renderDisabled)}\n ${when(this.mixedValue, this.renderMixedValue)}\n </div>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.getAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n if (changes.has('selected') || changes.has('role')) {\n const selectedAttribute =\n this.role === 'button' ? 'aria-pressed' : 'aria-checked';\n const removedSelectedAttribute =\n this.role === 'button' ? 'aria-checked' : 'aria-pressed';\n if (changes.has('role')) {\n this.removeAttribute(removedSelectedAttribute);\n }\n this.setAttribute(\n selectedAttribute,\n this.selected ? 'true' : 'false'\n );\n }\n\n // aria-label should be in sync with changes in label and color.\n if (\n changes.has('label') ||\n changes.has('color') ||\n changes.has('mixedValue')\n ) {\n if (this.label !== this.color && this.label?.length) {\n this.setAttribute('aria-label', this.label);\n } else if (this.color) {\n this.setAttribute('aria-label', this.color);\n } else if (this.mixedValue) {\n this.setAttribute('aria-label', 'Mixed');\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,iBAAiB;AAC1B,OAAO,+BAA+B;AACtC,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAEP,OAAO,YAAY;AACnB,OAAO,gBAAgB;AAMvB,MAAM,WAAiD;AAAA,EACnD,IAAI,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMV,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,GAAG,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAMb;AAKO,aAAM,eAAe,WAAW,WAAW;AAAA,EAC9C,YAAY,CAAC,MAAM,KAAK,KAAK,GAAG;AAAA,EAChC,eAAe;AACnB,CAAC,EAAE;AAAA,EAHI;AAAA;AAYH,SAAO,QAAQ;AAGf,SAAO,QAAQ;AAGf,SAAO,aAAa;AAGpB,SAAO,UAAU;AAGjB,SAAgB,OAAO;AAMvB,SAAO,WAAW;AAgFlB,SAAU,iBAAiB,MAAsB;AAC7C,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAkBX;AAEA,SAAU,mBAAmB,MAAsB;AAC/C,aAAO,SAAS,KAAK,IAAI,EAAE;AAAA,IAC/B;AAAA;AAAA,EAjIA,WAA2B,SAAyB;AAChD,WAAO,CAAC,2BAA2B,QAAQ,UAAU;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AK,aAAa,UAAU,GAAG;AAChC,WAAK,aAAa,YAAY,GAAG;AAAA,IACrC;AAAA,EACJ;AACJ;AA5LW;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GARlB,OASF;AAGA;AAAA,EADN,SAAS;AAAA,GAXD,OAYF;AAGA;AAAA,EADN,SAAS;AAAA,GAdD,OAeF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,cAAc,CAAC;AAAA,GAjB3D,OAkBF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GApBjC,OAqBF;AAGS;AAAA,EADf,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAvBlB,OAwBO;AAGT;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GA1BlB,OA2BF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA7BjC,OA8BF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAhClB,OAiCF;AAGH;AAAA,EADH,SAAS;AAAA,GAnCD,OAoCL;",
6
6
  "names": []
7
7
  }
package/src/Swatch.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Swatch.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 {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport {\n ifDefined,\n when,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport opacityCheckerboardStyles from '@spectrum-web-components/opacity-checkerboard/src/opacity-checkerboard.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash300.js';\n\nimport styles from './swatch.css.js';\nimport dashStyles from '@spectrum-web-components/icon/src/spectrum-icon-dash.css.js';\n\nexport type SwatchBorder = 'light' | 'none' | undefined;\nexport type SwatchRounding = 'none' | 'full' | undefined;\nexport type SwatchShape = 'rectangle' | undefined;\n\nconst dashIcon: Record<string, () => TemplateResult> = {\n xs: () => html`\n <sp-icon-dash75\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash75\"\n ></sp-icon-dash75>\n `,\n s: () => html`\n <sp-icon-dash100\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash100\"\n ></sp-icon-dash100>\n `,\n m: () => html`\n <sp-icon-dash200\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash200\"\n ></sp-icon-dash200>\n `,\n l: () => html`\n <sp-icon-dash300\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash300\"\n ></sp-icon-dash300>\n `,\n};\n\n/**\n * @element sp-swatch\n */\nexport class Swatch extends SizedMixin(Focusable, {\n validSizes: ['xs', 's', 'm', 'l'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [opacityCheckerboardStyles, styles, dashStyles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property()\n public color = '';\n\n @property()\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'mixed-value' })\n public mixedValue = false;\n\n @property({ type: Boolean, reflect: true })\n public nothing = false;\n\n @property({ reflect: true })\n public override role = 'button';\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property()\n get value(): string {\n return this._value || this.color || this.label;\n }\n\n set value(value: string) {\n if (value === this._value) return;\n const oldValue = this.value;\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n private _value?: string;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n public toggle(force?: boolean): void {\n this.selected = force ?? !this.selected;\n }\n\n private handleClick(): void {\n if (this.disabled || this.mixedValue) return;\n this.toggle();\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.toggle();\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n event.preventDefault();\n this.addEventListener('keyup', this.handleKeyup);\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n private handleKeypress(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Enter':\n case 'NumpadEnter':\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n this.removeEventListener('keyup', this.handleKeyup);\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected renderDisabled = (): TemplateResult => {\n return html`\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"disabledIcon\"\n viewBox=\"0 0 20 20\"\n >\n <path\n d=\"M9.889,1a8.889,8.889,0,1,0,8.889,8.889A8.889,8.889,0,0,0,9.889,1Zm6.667,8.889a6.635,6.635,0,0,1-1.233,3.863l-9.3-9.3A6.667,6.667,0,0,1,16.556,9.889Zm-13.333,0A6.636,6.636,0,0,1,4.455,6.026l9.3,9.3A6.667,6.667,0,0,1,3.222,9.889Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-color)\"\n />\n <path\n d=\"M 9.888889312744141 1 C 4.979689598083496 1 1 4.979689598083496 1 9.888889312744141 C 1 14.7980899810791 4.979689598083496 18.77777862548828 9.888889312744141 18.77777862548828 C 14.7980899810791 18.77777862548828 18.77777862548828 14.7980899810791 18.77777862548828 9.888889312744141 C 18.77777862548828 4.979689598083496 14.7980899810791 1 9.888889312744141 1 M 15.32277870178223 13.75166893005371 L 6.02610969543457 4.454998970031738 C 8.059318542480469 3.009572982788086 10.72937774658203 2.820217132568359 12.9462194442749 3.964249610900879 C 15.16304969787598 5.10828971862793 16.55568885803223 7.394259452819824 16.5555591583252 9.888889312744141 C 16.55776977539062 11.27357959747314 16.126708984375 12.62425994873047 15.32277870178223 13.75166893005371 M 9.888258934020996 16.55648612976074 C 8.843273162841797 16.55648612976074 7.794573783874512 16.31111145019531 6.831318855285645 15.8139591217041 C 4.614439010620117 14.66977882385254 3.221879959106445 12.38361930847168 3.222219467163086 9.888889312744141 C 3.220088958740234 8.504219055175781 3.651140213012695 7.153559684753418 4.454998970031738 6.02610969543457 L 13.75166893005371 15.32333946228027 C 12.60186290740967 16.14075088500977 11.24825286865234 16.55648612976074 9.888258934020996 16.55648612976074 M 9.888889312744141 0 C 15.34163951873779 0 19.77777862548828 4.436139106750488 19.77777862548828 9.888889312744141 C 19.77777862548828 15.34163951873779 15.34163951873779 19.77777862548828 9.888889312744141 19.77777862548828 C 4.436139106750488 19.77777862548828 0 15.34163951873779 0 9.888889312744141 C 0 4.436139106750488 4.436139106750488 0 9.888889312744141 0 Z M 15.10232830047607 12.11699867248535 C 15.40205764770508 11.41858959197998 15.55679702758789 10.66494941711426 15.5555591583252 9.89048957824707 C 15.5556697845459 7.759209632873535 14.38009929656982 5.829549789428711 12.48761940002441 4.852889060974121 C 11.68764972686768 4.440059661865234 10.78924942016602 4.22184944152832 9.889529228210449 4.22184944152832 C 9.114802360534668 4.22184944152832 8.360831260681152 4.377038955688477 7.661839485168457 4.676509857177734 L 15.10232830047607 12.11699867248535 Z M 12.11597919464111 15.10181331634521 L 4.675475120544434 7.660861015319824 C 4.375750541687012 8.359296798706055 4.221027374267578 9.112875938415527 4.222219467163086 9.887349128723145 C 4.221929550170898 12.01874923706055 5.397418975830078 13.94855880737305 7.289958953857422 14.92533874511719 C 8.08997917175293 15.3382396697998 8.988459587097168 15.55648994445801 9.888258934020996 15.55648994445801 C 10.66298007965088 15.55648994445801 11.41698551177979 15.40128421783447 12.11597919464111 15.10181331634521 Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-stroke-color)\"\n />\n </svg>\n `;\n };\n\n protected renderMixedValue = (): TemplateResult => {\n return dashIcon[this.size]();\n };\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=\"opacity-checkerboard fill\"\n style=${ifDefined(\n this.color\n ? `--spectrum-picked-color: ${this.color}`\n : undefined\n )}\n >\n <slot name=\"image\"></slot>\n ${when(this.disabled, this.renderDisabled)}\n ${when(this.mixedValue, this.renderMixedValue)}\n </div>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.getAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n if (changes.has('selected') || changes.has('role')) {\n const selectedAttribute =\n this.role === 'button' ? 'aria-pressed' : 'aria-checked';\n const removedSelectedAttribute =\n this.role === 'button' ? 'aria-checked' : 'aria-pressed';\n if (changes.has('role')) {\n this.removeAttribute(removedSelectedAttribute);\n }\n this.setAttribute(\n selectedAttribute,\n this.selected ? 'true' : 'false'\n );\n }\n\n // aria-label should be in sync with changes in label and color.\n if (\n changes.has('label') ||\n changes.has('color') ||\n changes.has('mixedValue')\n ) {\n if (this.label !== this.color && this.label?.length) {\n this.setAttribute('aria-label', this.label);\n } else if (this.color) {\n this.setAttribute('aria-label', this.color);\n } else if (this.mixedValue) {\n this.setAttribute('aria-label', 'Mixed');\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport {\n ifDefined,\n when,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport opacityCheckerboardStyles from '@spectrum-web-components/opacity-checkerboard/src/opacity-checkerboard.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-dash300.js';\n\nimport styles from './swatch.css.js';\nimport dashStyles from '@spectrum-web-components/icon/src/spectrum-icon-dash.css.js';\n\nexport type SwatchBorder = 'light' | 'none' | undefined;\nexport type SwatchRounding = 'none' | 'full' | undefined;\nexport type SwatchShape = 'rectangle' | undefined;\n\nconst dashIcon: Record<string, () => TemplateResult> = {\n xs: () => html`\n <sp-icon-dash75\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash75\"\n ></sp-icon-dash75>\n `,\n s: () => html`\n <sp-icon-dash100\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash100\"\n ></sp-icon-dash100>\n `,\n m: () => html`\n <sp-icon-dash200\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash200\"\n ></sp-icon-dash200>\n `,\n l: () => html`\n <sp-icon-dash300\n slot=\"icon\"\n class=\"mixedValueIcon spectrum-UIIcon-Dash300\"\n ></sp-icon-dash300>\n `,\n};\n\n/**\n * @element sp-swatch\n */\nexport class Swatch extends SizedMixin(Focusable, {\n validSizes: ['xs', 's', 'm', 'l'],\n noDefaultSize: true,\n}) {\n public static override get styles(): CSSResultArray {\n return [opacityCheckerboardStyles, styles, dashStyles];\n }\n\n @property({ reflect: true })\n public border: SwatchBorder;\n\n @property()\n public color = '';\n\n @property()\n public label = '';\n\n @property({ type: Boolean, reflect: true, attribute: 'mixed-value' })\n public mixedValue = false;\n\n @property({ type: Boolean, reflect: true })\n public nothing = false;\n\n @property({ reflect: true })\n public override role = 'button';\n\n @property({ reflect: true })\n public rounding: SwatchRounding;\n\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n @property({ reflect: true })\n public shape: SwatchShape;\n\n @property()\n get value(): string {\n return this._value || this.color || this.label;\n }\n\n set value(value: string) {\n if (value === this._value) return;\n const oldValue = this.value;\n this._value = value;\n this.requestUpdate('value', oldValue);\n }\n\n private _value?: string;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n public toggle(force?: boolean): void {\n this.selected = force ?? !this.selected;\n }\n\n private handleClick(): void {\n if (this.disabled || this.mixedValue) return;\n this.toggle();\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n })\n );\n if (!applyDefault) {\n this.toggle();\n }\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n event.preventDefault();\n this.addEventListener('keyup', this.handleKeyup);\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n private handleKeypress(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Enter':\n case 'NumpadEnter':\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n this.removeEventListener('keyup', this.handleKeyup);\n this.click();\n break;\n /* c8 ignore next 2 */\n default:\n break;\n }\n }\n\n protected renderDisabled = (): TemplateResult => {\n return html`\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"disabledIcon\"\n viewBox=\"0 0 20 20\"\n >\n <path\n d=\"M9.889,1a8.889,8.889,0,1,0,8.889,8.889A8.889,8.889,0,0,0,9.889,1Zm6.667,8.889a6.635,6.635,0,0,1-1.233,3.863l-9.3-9.3A6.667,6.667,0,0,1,16.556,9.889Zm-13.333,0A6.636,6.636,0,0,1,4.455,6.026l9.3,9.3A6.667,6.667,0,0,1,3.222,9.889Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-color)\"\n />\n <path\n d=\"M 9.888889312744141 1 C 4.979689598083496 1 1 4.979689598083496 1 9.888889312744141 C 1 14.7980899810791 4.979689598083496 18.77777862548828 9.888889312744141 18.77777862548828 C 14.7980899810791 18.77777862548828 18.77777862548828 14.7980899810791 18.77777862548828 9.888889312744141 C 18.77777862548828 4.979689598083496 14.7980899810791 1 9.888889312744141 1 M 15.32277870178223 13.75166893005371 L 6.02610969543457 4.454998970031738 C 8.059318542480469 3.009572982788086 10.72937774658203 2.820217132568359 12.9462194442749 3.964249610900879 C 15.16304969787598 5.10828971862793 16.55568885803223 7.394259452819824 16.5555591583252 9.888889312744141 C 16.55776977539062 11.27357959747314 16.126708984375 12.62425994873047 15.32277870178223 13.75166893005371 M 9.888258934020996 16.55648612976074 C 8.843273162841797 16.55648612976074 7.794573783874512 16.31111145019531 6.831318855285645 15.8139591217041 C 4.614439010620117 14.66977882385254 3.221879959106445 12.38361930847168 3.222219467163086 9.888889312744141 C 3.220088958740234 8.504219055175781 3.651140213012695 7.153559684753418 4.454998970031738 6.02610969543457 L 13.75166893005371 15.32333946228027 C 12.60186290740967 16.14075088500977 11.24825286865234 16.55648612976074 9.888258934020996 16.55648612976074 M 9.888889312744141 0 C 15.34163951873779 0 19.77777862548828 4.436139106750488 19.77777862548828 9.888889312744141 C 19.77777862548828 15.34163951873779 15.34163951873779 19.77777862548828 9.888889312744141 19.77777862548828 C 4.436139106750488 19.77777862548828 0 15.34163951873779 0 9.888889312744141 C 0 4.436139106750488 4.436139106750488 0 9.888889312744141 0 Z M 15.10232830047607 12.11699867248535 C 15.40205764770508 11.41858959197998 15.55679702758789 10.66494941711426 15.5555591583252 9.89048957824707 C 15.5556697845459 7.759209632873535 14.38009929656982 5.829549789428711 12.48761940002441 4.852889060974121 C 11.68764972686768 4.440059661865234 10.78924942016602 4.22184944152832 9.889529228210449 4.22184944152832 C 9.114802360534668 4.22184944152832 8.360831260681152 4.377038955688477 7.661839485168457 4.676509857177734 L 15.10232830047607 12.11699867248535 Z M 12.11597919464111 15.10181331634521 L 4.675475120544434 7.660861015319824 C 4.375750541687012 8.359296798706055 4.221027374267578 9.112875938415527 4.222219467163086 9.887349128723145 C 4.221929550170898 12.01874923706055 5.397418975830078 13.94855880737305 7.289958953857422 14.92533874511719 C 8.08997917175293 15.3382396697998 8.988459587097168 15.55648994445801 9.888258934020996 15.55648994445801 C 10.66298007965088 15.55648994445801 11.41698551177979 15.40128421783447 12.11597919464111 15.10181331634521 Z\"\n stroke=\"none\"\n fill=\"var(--spectrum-swatch-disabled-icon-stroke-color)\"\n />\n </svg>\n `;\n };\n\n protected renderMixedValue = (): TemplateResult => {\n return dashIcon[this.size]();\n };\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=\"opacity-checkerboard fill\"\n style=${ifDefined(\n this.color\n ? `--spectrum-picked-color: ${this.color}`\n : undefined\n )}\n >\n <slot name=\"image\"></slot>\n ${when(this.disabled, this.renderDisabled)}\n ${when(this.mixedValue, this.renderMixedValue)}\n </div>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.getAttribute('role')) {\n this.setAttribute('role', 'button');\n }\n if (changes.has('selected') || changes.has('role')) {\n const selectedAttribute =\n this.role === 'button' ? 'aria-pressed' : 'aria-checked';\n const removedSelectedAttribute =\n this.role === 'button' ? 'aria-checked' : 'aria-pressed';\n if (changes.has('role')) {\n this.removeAttribute(removedSelectedAttribute);\n }\n this.setAttribute(\n selectedAttribute,\n this.selected ? 'true' : 'false'\n );\n }\n\n // aria-label should be in sync with changes in label and color.\n if (\n changes.has('label') ||\n changes.has('color') ||\n changes.has('mixedValue')\n ) {\n if (this.label !== this.color && this.label?.length) {\n this.setAttribute('aria-label', this.label);\n } else if (this.color) {\n this.setAttribute('aria-label', this.color);\n } else if (this.mixedValue) {\n this.setAttribute('aria-label', 'Mixed');\n } else {\n this.removeAttribute('aria-label');\n }\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n if (!this.hasAttribute('tabindex')) {\n this.setAttribute('tabindex', '0');\n }\n }\n}\n"],
5
5
  "mappings": "qNAWA,OAEI,QAAAA,EAEA,cAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OACI,aAAAC,EACA,QAAAC,MACG,kDACP,OAAS,aAAAC,MAAiB,mDAC1B,OAAOC,MAA+B,gFACtC,MAAO,4DACP,MAAO,6DACP,MAAO,6DACP,MAAO,6DAEP,OAAOC,MAAY,kBACnB,OAAOC,MAAgB,8DAMvB,MAAMC,EAAiD,CACnD,GAAI,IAAMT;AAAA;AAAA;AAAA;AAAA;AAAA,MAMV,EAAG,IAAMA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMT,EAAG,IAAMA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMT,EAAG,IAAMA;AAAA;AAAA;AAAA;AAAA;AAAA,KAM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AK,iBAAiB,UAAW,KAAK,aAAa,EACnD,KAAK,iBAAiB,WAAY,KAAK,cAAc,EAChD,KAAK,aAAa,UAAU,GAC7B,KAAK,aAAa,WAAY,GAAG,CAEzC,CACJ,CA5LWI,EAAA,CADNjB,EAAS,CAAE,QAAS,EAAK,CAAC,GARlB,OASF,sBAGAiB,EAAA,CADNjB,EAAS,GAXD,OAYF,qBAGAiB,EAAA,CADNjB,EAAS,GAdD,OAeF,qBAGAiB,EAAA,CADNjB,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,aAAc,CAAC,GAjB3D,OAkBF,0BAGAiB,EAAA,CADNjB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GApBjC,OAqBF,uBAGSiB,EAAA,CADfjB,EAAS,CAAE,QAAS,EAAK,CAAC,GAvBlB,OAwBO,oBAGTiB,EAAA,CADNjB,EAAS,CAAE,QAAS,EAAK,CAAC,GA1BlB,OA2BF,wBAGAiB,EAAA,CADNjB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA7BjC,OA8BF,wBAGAiB,EAAA,CADNjB,EAAS,CAAE,QAAS,EAAK,CAAC,GAhClB,OAiCF,qBAGHiB,EAAA,CADHjB,EAAS,GAnCD,OAoCL",
6
6
  "names": ["html", "SizedMixin", "property", "ifDefined", "when", "Focusable", "opacityCheckerboardStyles", "styles", "dashStyles", "dashIcon", "value", "oldValue", "force", "event", "code", "changes", "_a", "selectedAttribute", "removedSelectedAttribute", "__decorateClass"]
7
7
  }
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { CSSResultArray, ElementSize, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
13
  import { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';
3
14
  import type { Swatch, SwatchBorder, SwatchRounding, SwatchShape } from './Swatch.js';
@@ -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 {\n property,\n queryAssignedElements,\n} 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 noDefaultSize: true,\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 density: 'compact' | 'spacious' | undefined;\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\n const oldSelected = this.selected;\n this._selected = selected;\n this.requestUpdate('selected', oldSelected);\n }\n\n // Specifically surface `_selected` internally so that change can be made to this value internally\n // without triggering the update lifecycle directly.\n private _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 @queryAssignedElements({ flatten: true })\n public swatches!: Swatch[];\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.swatches,\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 = async (): Promise<void> => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n await Promise.all(this.swatches.map((swatch) => swatch.updateComplete));\n this.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 this.rovingTabindexController.clearElementCache();\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 !== 'm' || 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 let 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 const doActions = (): void => {\n nextSelected = new Set(this.selected);\n\n // Do Swatch actions to each Swatch in the collection.\n this.swatches.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.values()].filter(\n (selectedValue) => currentValues.has(selectedValue)\n );\n }\n };\n\n if (this.hasUpdated) {\n // Do actions immediately when the element has already updated.\n doActions();\n } else {\n // On first update wait for a `slotchange` event, which is not currently managed\n // by the element lifecycle before allowing Swatch actions to be commited.\n this.shadowRoot.addEventListener(\n 'slotchange',\n () => {\n requestAnimationFrame(doActions);\n },\n { once: true }\n );\n }\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing 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 {\n property,\n queryAssignedElements,\n} 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 noDefaultSize: true,\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 density: 'compact' | 'spacious' | undefined;\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\n const oldSelected = this.selected;\n this._selected = selected;\n this.requestUpdate('selected', oldSelected);\n }\n\n // Specifically surface `_selected` internally so that change can be made to this value internally\n // without triggering the update lifecycle directly.\n private _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 @queryAssignedElements({ flatten: true })\n public swatches!: Swatch[];\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.swatches,\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 = async (): Promise<void> => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n await Promise.all(this.swatches.map((swatch) => swatch.updateComplete));\n this.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 this.rovingTabindexController.clearElementCache();\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 !== 'm' || 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 let 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 const doActions = (): void => {\n nextSelected = new Set(this.selected);\n\n // Do Swatch actions to each Swatch in the collection.\n this.swatches.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.values()].filter(\n (selectedValue) => currentValues.has(selectedValue)\n );\n }\n };\n\n if (this.hasUpdated) {\n // Do actions immediately when the element has already updated.\n doActions();\n } else {\n // On first update wait for a `slotchange` event, which is not currently managed\n // by the element lifecycle before allowing Swatch actions to be commited.\n this.shadowRoot.addEventListener(\n 'slotchange',\n () => {\n requestAnimationFrame(doActions);\n },\n { once: true }\n );\n }\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;AAYA;AAAA,EAGI;AAAA,EAEA;AAAA,EACA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAEnC,OAAO,YAAY;AAgBZ,aAAM,oBAAoB,WAAW,iBAAiB;AAAA,EACzD,YAAY,CAAC,MAAM,KAAK,KAAK,GAAG;AAAA,EAChC,eAAe;AACnB,CAAC,EAAE;AAAA,EA0CC,cAAc;AACV,UAAM;AAdV;AAAA;AAAA,SAAQ,YAAsB,CAAC;AAK/B,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,eAAO,SAAS,kBAAkB,IAC5B,qBACA;AAAA,MACV;AAAA,MACA,UAAU,MAAM,KAAK;AAAA,MACrB,oBAAoB,CAAC,OAAe,CAAC,GAAG;AAAA,IAC5C,CAAC;AA+CD,SAAQ,eAAe,YAA2B;AAC9C,YAAM,aAAa,oBAAI,IAAI;AAC3B,WAAK,cAAc,IAAI,IAAI,KAAK,QAAQ;AACxC,YAAM,QAAQ,IAAI,KAAK,S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M,MAAM,CAAC;AAAA,GAjBhB,YAkBE;AAiBJ;AAAA,EADN,SAAS;AAAA,GAlCD,YAmCF;AAKA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAvClB,YAwCF;AAGA;AAAA,EADN,sBAAsB,EAAE,SAAS,KAAK,CAAC;AAAA,GA1C/B,YA2CF;",
6
6
  "names": []
7
7
  }
@@ -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 {\n property,\n queryAssignedElements,\n} 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 noDefaultSize: true,\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 density: 'compact' | 'spacious' | undefined;\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\n const oldSelected = this.selected;\n this._selected = selected;\n this.requestUpdate('selected', oldSelected);\n }\n\n // Specifically surface `_selected` internally so that change can be made to this value internally\n // without triggering the update lifecycle directly.\n private _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 @queryAssignedElements({ flatten: true })\n public swatches!: Swatch[];\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.swatches,\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 = async (): Promise<void> => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n await Promise.all(this.swatches.map((swatch) => swatch.updateComplete));\n this.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 this.rovingTabindexController.clearElementCache();\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 !== 'm' || 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 let 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 const doActions = (): void => {\n nextSelected = new Set(this.selected);\n\n // Do Swatch actions to each Swatch in the collection.\n this.swatches.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.values()].filter(\n (selectedValue) => currentValues.has(selectedValue)\n );\n }\n };\n\n if (this.hasUpdated) {\n // Do actions immediately when the element has already updated.\n doActions();\n } else {\n // On first update wait for a `slotchange` event, which is not currently managed\n // by the element lifecycle before allowing Swatch actions to be commited.\n this.shadowRoot.addEventListener(\n 'slotchange',\n () => {\n requestAnimationFrame(doActions);\n },\n { once: true }\n );\n }\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing 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 {\n property,\n queryAssignedElements,\n} 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 noDefaultSize: true,\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 density: 'compact' | 'spacious' | undefined;\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\n const oldSelected = this.selected;\n this._selected = selected;\n this.requestUpdate('selected', oldSelected);\n }\n\n // Specifically surface `_selected` internally so that change can be made to this value internally\n // without triggering the update lifecycle directly.\n private _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 @queryAssignedElements({ flatten: true })\n public swatches!: Swatch[];\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.swatches,\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 = async (): Promise<void> => {\n const presentSet = new Set();\n this.selectedSet = new Set(this.selected);\n await Promise.all(this.swatches.map((swatch) => swatch.updateComplete));\n this.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 this.rovingTabindexController.clearElementCache();\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 !== 'm' || 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 let 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 const doActions = (): void => {\n nextSelected = new Set(this.selected);\n\n // Do Swatch actions to each Swatch in the collection.\n this.swatches.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.values()].filter(\n (selectedValue) => currentValues.has(selectedValue)\n );\n }\n };\n\n if (this.hasUpdated) {\n // Do actions immediately when the element has already updated.\n doActions();\n } else {\n // On first update wait for a `slotchange` event, which is not currently managed\n // by the element lifecycle before allowing Swatch actions to be commited.\n this.shadowRoot.addEventListener(\n 'slotchange',\n () => {\n requestAnimationFrame(doActions);\n },\n { once: true }\n );\n }\n }\n}\n"],
5
5
  "mappings": "qNAYA,OAGI,QAAAA,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,yBAAAC,MACG,kDACP,OAAS,4BAAAC,MAAgC,sEACzC,OAAS,sBAAAC,MAA0B,6CAEnC,OAAOC,MAAY,wBAgBZ,aAAM,oBAAoBN,EAAWC,EAAiB,CACzD,WAAY,CAAC,KAAM,IAAK,IAAK,GAAG,EAChC,cAAe,EACnB,CAAC,CAAE,CA0CC,aAAc,CACV,MAAM,EAdV,KAAQ,UAAsB,CAAC,EAK/B,KAAQ,YAAc,IAAI,IAuB1B,8BAA2B,IAAIG,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,KAAK,SACrB,mBAAqBE,GAAe,CAACA,EAAG,QAC5C,CAAC,EA+CD,KAAQ,aAAe,SAA2B,CAC9C,MAAME,EAAa,IAAI,IACvB,KAAK,YAAc,IAAI,IAAI,KAAK,QAAQ,EACxC,MAAM,QAAQ,IAAI,KAAK,SAAS,IAAKC,GAAWA,EAAO,cAAc,CAAC,EACtE,KAAK,SAAS,QAASA,GAAW,CAC9BD,EAAW,IAAIC,EAAO,KAAK,EACvBA,EAAO,UACP,K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,YAYF,uBAGA+B,EAAA,CADN/B,EAAS,CAAE,QAAS,EAAK,CAAC,GAdlB,YAeF,wBAGI+B,EAAA,CADV/B,EAAS,CAAE,KAAM,KAAM,CAAC,GAjBhB,YAkBE,wBAiBJ+B,EAAA,CADN/B,EAAS,GAlCD,YAmCF,uBAKA+B,EAAA,CADN/B,EAAS,CAAE,QAAS,EAAK,CAAC,GAvClB,YAwCF,qBAGA+B,EAAA,CADN9B,EAAsB,CAAE,QAAS,EAAK,CAAC,GA1C/B,YA2CF",
6
6
  "names": ["html", "SizedMixin", "SpectrumElement", "property", "queryAssignedElements", "RovingTabindexController", "MutationController", "styles", "elements", "firstEnabledIndex", "firstSelectedIndex", "el", "index", "presentSet", "swatch", "value", "selected", "oldSelected", "options", "event", "target", "child", "changes", "targetValues", "passThroughSwatchActions", "selectionSwatchActions", "swatchRoles", "swatchRole", "swatchActions", "nextSelected", "currentValues", "doActions", "action", "selectedValue", "__decorateClass"]
7
7
  }
package/src/index.d.ts CHANGED
@@ -1,2 +1,13 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  export * from './Swatch.js';
2
13
  export * from './SwatchGroup.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.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*/\nexport * from './Swatch.dev.js'\nexport * from './SwatchGroup.dev.js'\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport * from './Swatch.dev.js'\nexport * from './SwatchGroup.dev.js'\n"],
5
5
  "mappings": ";AAWA,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
package/src/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.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*/\nexport * from './Swatch.js';\nexport * from './SwatchGroup.js';\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport * from './Swatch.js';\nexport * from './SwatchGroup.js';\n"],
5
5
  "mappings": "aAWA,WAAc,cACd,WAAc",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["spectrum-swatch-group.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["spectrum-swatch-group.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["spectrum-swatch.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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 @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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["spectrum-swatch.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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 @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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch-group-overrides.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch-group-overrides.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{--spectrum-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch-group.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}:host{--spectrum-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}:host{--spectrum-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch-group.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}:host{--spectrum-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{justify-content:flex-start;align-items:flex-start;gap:var(--mod-swatchgroup-spacing-regular,var(--spectrum-swatchgroup-spacing-regular));flex-flow:wrap;display:inline-flex}:host([density=compact]){gap:var(--mod-swatchgroup-spacing-compact,var(--spectrum-swatchgroup-spacing-compact))}:host([density=spacious]){gap:var(--mod-swatchgroup-spacing-spacious,var(--spectrum-swatchgroup-spacing-spacious))}:host{--spectrum-swatchgroup-spacing-compact:var(--system-swatch-group-spacing-compact);--spectrum-swatchgroup-spacing-regular:var(--system-swatch-group-spacing-regular);--spectrum-swatchgroup-spacing-spacious:var(--system-swatch-group-spacing-spacious)}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch-overrides.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch-overrides.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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 @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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}:host([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}.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:0 0}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}:host([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}.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:0 0}\n`;\nexport default styles;"],
5
5
  "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["swatch.css.ts"],
4
- "sourcesContent": ["/*\nCopyright 2025 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 @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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}:host([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}.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:0 0}\n`;\nexport default styles;"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\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]),:host([disabled]){--highcontrast-swatch-border-color:GrayText}}:host{inline-size:var(--mod-swatch-size,var(--spectrum-swatch-size));block-size:var(--mod-swatch-size,var(--spectrum-swatch-size));-webkit-user-select:none;user-select:none;outline:none;justify-content:center;align-items:center;display:flex;position:relative}.disabledIcon{inline-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size));block-size:var(--mod-swatch-disabled-icon-size,var(--spectrum-swatch-disabled-icon-size))}:host,:host:before{border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius))}:host([selected]){background-color:var(--highcontrast-swatch-background-color-selected,var(--mod-swatch-inner-border-color-selected,var(--spectrum-swatch-inner-border-color-selected)))}:host([selected]) .fill{clip-path:polygon(calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2),calc(var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)calc(100% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2));border-radius:0}:host([selected]) .fill:before{box-shadow:none;border-radius:0}:host([selected]):before{opacity:1}:host .is-image .fill:before{background-color:initial}:host([mixed-value]) .fill{background:0 0;background:var(--spectrum-picked-color,transparent)}:host([mixed-value]) .mixedValueIcon{color:var(--spectrum-swatch-dash-icon-color);display:block}:host([nothing]) .fill{background-color:initial;background-color:var(--spectrum-picked-color,transparent);background-image:none}:host([nothing]) .fill:after{inline-size:var(--mod-swatch-slash-thickness,var(--spectrum-swatch-slash-thickness));content:\"\";block-size:200%;background:var(--highcontrast-swatch-fill-foreground-color,var(--mod-swatch-slash-icon-color,var(--spectrum-swatch-slash-icon-color)));position:absolute;transform:rotate(-45deg)}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{display:block}:host:before{content:\"\";border-width:var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected));border-style:solid;border-color:var(--highcontrast-swatch-border-color-selected,var(--mod-swatch-border-color-selected,var(--spectrum-swatch-border-color-selected)));opacity:0;pointer-events:none;position:absolute;inset:0}:host:after{content:\"\";inset:calc(var(--mod-swatch-focus-indicator-gap,var(--spectrum-swatch-focus-indicator-gap))*-2);opacity:0;border-width:var(--mod-swatch-focus-indicator-thickness,var(--spectrum-swatch-focus-indicator-thickness));border-style:solid;border-color:var(--highcontrast-swatch-focus-indicator-color,var(--mod-swatch-focus-indicator-color,var(--spectrum-swatch-focus-indicator-color)));border-radius:var(--mod-swatch-focus-indicator-border-radius,var(--spectrum-swatch-focus-indicator-border-radius));transition:opacity var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out;position:absolute}:host(:focus-visible):after{opacity:1}.fill{inline-size:100%;block-size:100%;box-sizing:border-box;border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));justify-content:center;align-items:center;display:flex;position:relative;overflow:hidden}.fill:before{content:\"\";z-index:0;box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color,var(--mod-swatch-border-color,var(--spectrum-swatch-border-color)));border-radius:var(--mod-swatch-border-radius,var(--spectrum-swatch-border-radius));position:absolute;inset:0}:host([border=none]) .fill:before,.fill:before{background-color:initial;background-color:var(--spectrum-picked-color,transparent)}:host([border=none]) .fill:before{box-shadow:none}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--mod-swatch-border-thickness,var(--spectrum-swatch-border-thickness))var(--highcontrast-swatch-border-color-light,var(--mod-swatch-border-color-light,var(--spectrum-swatch-border-color-light)))}.mixedValueIcon{pointer-events:none;color:#0000;color:var(--spectrum-picked-color,transparent);display:none}.disabledIcon{z-index:1;pointer-events:none;color:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));stroke:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)));display:none;position:relative}.disabledIcon path:first-child{fill:var(--highcontrast-swatch-disabled-icon-color,var(--mod-swatch-disabled-icon-color,var(--spectrum-swatch-disabled-icon-color)))}.disabledIcon path:last-child{fill:var(--mod-swatch-icon-border-color,var(--spectrum-swatch-icon-border-color))}:host([shape=rectangle]){inline-size: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][selected]) .fill,:host([rounding=none][selected]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before{border-radius:0}:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before,: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{border-radius:100%}:host([rounding=full][selected]:not([shape=rectangle])) .fill{clip-path:circle(calc(50% - var(--mod-swatch-border-thickness-selected,var(--spectrum-swatch-border-thickness-selected))*2)at 50% 50%)}::slotted([slot=image]){object-fit:contain;inline-size:100%;block-size:100%;transition:width var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out,height var(--mod-animation-duration-100,var(--spectrum-animation-duration-100))ease-in-out}:host([size=l]){--spectrum-swatch-size:var(--system-swatch-size-l-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-l-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-l-slash-thickness)}:host([size=s]){--spectrum-swatch-size:var(--system-swatch-size-s-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-s-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-s-slash-thickness)}:host([size=xs]){--spectrum-swatch-size:var(--system-swatch-size-xs-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-xs-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-xs-slash-thickness)}:host{--spectrum-swatch-size:var(--system-swatch-size-m-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-size-m-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-size-m-slash-thickness)}:host{--spectrum-swatch-border-radius:var(--system-swatch-border-radius);--spectrum-swatch-focus-indicator-border-radius:var(--system-swatch-focus-indicator-border-radius);--spectrum-swatch-border-thickness:var(--system-swatch-border-thickness);--spectrum-swatch-border-thickness-selected:var(--system-swatch-border-thickness-selected);--spectrum-swatch-focus-indicator-thickness:var(--system-swatch-focus-indicator-thickness);--spectrum-swatch-focus-indicator-gap:var(--system-swatch-focus-indicator-gap);--spectrum-swatch-border-color-opacity:var(--system-swatch-border-color-opacity);--spectrum-swatch-border-color-light-opacity:var(--system-swatch-border-color-light-opacity);--spectrum-swatch-border-color:var(--system-swatch-border-color);--spectrum-swatch-icon-border-color:var(--system-swatch-icon-border-color);--spectrum-swatch-border-color-light:var(--system-swatch-border-color-light);--spectrum-swatch-border-color-selected:var(--system-swatch-border-color-selected);--spectrum-swatch-inner-border-color-selected:var(--system-swatch-inner-border-color-selected);--spectrum-swatch-disabled-icon-color:var(--system-swatch-disabled-icon-color);--spectrum-swatch-dash-icon-color:var(--system-swatch-dash-icon-color);--spectrum-swatch-slash-icon-color:var(--system-swatch-slash-icon-color);--spectrum-swatch-focus-indicator-color:var(--system-swatch-focus-indicator-color);--spectrum-swatch-size:var(--system-swatch-size);--spectrum-swatch-disabled-icon-size:var(--system-swatch-disabled-icon-size);--spectrum-swatch-slash-thickness:var(--system-swatch-slash-thickness)}.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:0 0}\n`;\nexport default styles;"],
5
5
  "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
6
6
  "names": ["css", "styles"]
7
7
  }