@spectrum-web-components/swatch 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/package.json +5 -5
  2. package/sp-swatch-group.dev.js +1 -0
  3. package/sp-swatch-group.dev.js.map +1 -1
  4. package/sp-swatch-group.js +1 -1
  5. package/sp-swatch-group.js.map +2 -2
  6. package/sp-swatch.dev.js +1 -0
  7. package/sp-swatch.dev.js.map +1 -1
  8. package/sp-swatch.js +1 -1
  9. package/sp-swatch.js.map +2 -2
  10. package/src/Swatch.dev.js +11 -5
  11. package/src/Swatch.dev.js.map +1 -1
  12. package/src/Swatch.js +7 -7
  13. package/src/Swatch.js.map +2 -2
  14. package/src/SwatchGroup.dev.js +14 -6
  15. package/src/SwatchGroup.dev.js.map +1 -1
  16. package/src/SwatchGroup.js +2 -2
  17. package/src/SwatchGroup.js.map +2 -2
  18. package/src/index.dev.js +1 -0
  19. package/src/index.dev.js.map +1 -1
  20. package/src/index.js +1 -1
  21. package/src/index.js.map +1 -1
  22. package/src/spectrum-swatch-group.css.dev.js +1 -0
  23. package/src/spectrum-swatch-group.css.dev.js.map +1 -1
  24. package/src/spectrum-swatch-group.css.js +1 -1
  25. package/src/spectrum-swatch-group.css.js.map +2 -2
  26. package/src/spectrum-swatch.css.dev.js +1 -0
  27. package/src/spectrum-swatch.css.dev.js.map +1 -1
  28. package/src/spectrum-swatch.css.js +1 -1
  29. package/src/spectrum-swatch.css.js.map +2 -2
  30. package/src/swatch-group.css.dev.js +1 -0
  31. package/src/swatch-group.css.dev.js.map +1 -1
  32. package/src/swatch-group.css.js +1 -1
  33. package/src/swatch-group.css.js.map +2 -2
  34. package/src/swatch.css.dev.js +1 -0
  35. package/src/swatch.css.dev.js.map +1 -1
  36. package/src/swatch.css.js +1 -1
  37. package/src/swatch.css.js.map +2 -2
  38. package/stories/swatch-group.stories.js +172 -17
  39. package/stories/swatch-group.stories.js.map +1 -1
  40. package/stories/swatch-sizes.stories.js +28 -12
  41. package/stories/swatch-sizes.stories.js.map +1 -1
  42. package/stories/swatch.stories.js +98 -8
  43. package/stories/swatch.stories.js.map +2 -2
  44. package/test/benchmark/basic-test.js +5 -1
  45. package/test/benchmark/basic-test.js.map +1 -1
  46. package/test/swatch-group.test-vrt.js +4 -1
  47. package/test/swatch-group.test-vrt.js.map +1 -1
  48. package/test/swatch-group.test.js +259 -4
  49. package/test/swatch-group.test.js.map +1 -1
  50. package/test/swatch-sizes.test-vrt.js +4 -1
  51. package/test/swatch-sizes.test-vrt.js.map +1 -1
  52. package/test/swatch.test-vrt.js +4 -1
  53. package/test/swatch.test-vrt.js.map +1 -1
  54. package/test/swatch.test.js +145 -3
  55. package/test/swatch.test.js.map +1 -1
@@ -1,4 +1,4 @@
1
- import{css as e}from"@spectrum-web-components/base";const r=e`
1
+ "use strict";import{css as e}from"@spectrum-web-components/base";const r=e`
2
2
  :host{--spectrum-swatch-size-xs:var(
3
3
  --spectrum-global-dimension-size-200
4
4
  );--spectrum-swatch-size-s:var(--spectrum-global-dimension-size-300);--spectrum-swatch-size-m:var(--spectrum-global-dimension-size-400);--spectrum-swatch-size-l:var(--spectrum-global-dimension-size-500);--spectrum-swatch-disabled-icon-size-xs:var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["spectrum-swatch.css.ts"],
4
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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-size-xs:var(\n--spectrum-global-dimension-size-200\n);--spectrum-swatch-size-s:var(--spectrum-global-dimension-size-300);--spectrum-swatch-size-m:var(--spectrum-global-dimension-size-400);--spectrum-swatch-size-l:var(--spectrum-global-dimension-size-500);--spectrum-swatch-disabled-icon-size-xs:var(\n--spectrum-global-dimension-size-150\n);--spectrum-swatch-disabled-icon-size-s:var(\n--spectrum-global-dimension-size-200\n);--spectrum-swatch-disabled-icon-size-m:var(\n--spectrum-global-dimension-size-225\n);--spectrum-swatch-disabled-icon-size-l:var(\n--spectrum-global-dimension-size-250\n);--spectrum-swatch-disabled-icon-color:var(\n--spectrum-global-color-static-gray-50,rgb(var(--spectrum-global-color-static-gray-50-rgb))\n);--spectrum-swatch-disabled-icon-stroke-color:rgba(var(--spectrum-global-color-static-black-rgb,0,0,0),0.51);--spectrum-swatch-selection-padding:var(\n--spectrum-global-dimension-size-100\n);--spectrum-swatch-selection-indicator-border-width:var(\n--spectrum-global-dimension-size-25\n);--spectrum-swatch-selection-indicator-border-color:var(\n--spectrum-global-color-gray-900\n);--spectrum-swatch-background-color-selected:var(\n--spectrum-global-color-gray-50\n);--spectrum-swatch-border-radius:var(\n--spectrum-alias-border-radius-regular,var(--spectrum-global-dimension-size-50)\n);--spectrum-swatch-fill-border-radius-selected:var(\n--spectrum-alias-border-radius-small,var(--spectrum-global-dimension-size-25)\n);--spectrum-swatch-fill-border-width:var(\n--spectrum-alias-border-size-thin,var(--spectrum-global-dimension-static-size-10)\n);--spectrum-swatch-fill-border-color:rgba(var(--spectrum-global-color-gray-900-rgb),0.51);--spectrum-swatch-fill-border-color-light:rgba(var(--spectrum-global-color-gray-900-rgb),0.2);--spectrum-swatch-background-offset:0px;--spectrum-swatch-checkerboard-size:var(\n--spectrum-global-dimension-static-size-100,8px\n);align-items:center;display:flex;justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none}:host,:host:before{border-radius:var(\n--spectrum-swatch-border-radius\n)}:host([selected]){--spectrum-swatch-background-offset:-4px;background-color:var(\n--spectrum-swatch-background-color-selected\n)}:host([selected]) .fill{border-radius:var(--spectrum-swatch-fill-border-radius-selected);height:calc(100% - var(--spectrum-swatch-selection-padding));width:calc(100% - var(--spectrum-swatch-selection-padding))}:host([selected]) .fill:before{border-radius:var(\n--spectrum-swatch-fill-border-radius-selected\n);box-shadow:none}:host([selected]):before{opacity:1}:host([mixed-value]) .fill{background:var(\n--spectrum-swatch-background-color-selected\n)}:host([mixed-value]) .mixedValueIcon{visibility:visible}:host([nothing]) .fill{background:var(\n--spectrum-swatch-background-color-selected\n)}:host([nothing]) .fill:after{background:var(--spectrum-global-color-red-500);content:\"\";position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([nothing][size=xs]) .fill:after{height:2px}:host([nothing][size=s]) .fill:after{height:3px}:host([nothing][size=m]) .fill:after{height:4px}:host([nothing][size=l]) .fill:after{height:5px}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{visibility:visible}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}:host:before{border:var(--spectrum-swatch-selection-indicator-border-width) solid var(--spectrum-swatch-selection-indicator-border-color);bottom:0;content:\"\";left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0}:host:after{border:var(--spectrum-global-dimension-static-size-25,2px) solid var(\n--spectrum-alias-focus-ring-color,var(--spectrum-alias-focus-color)\n);border-radius:var(--spectrum-alias-focus-ring-border-radius-regular);bottom:calc(var(--spectrum-global-dimension-size-50)*-1);content:\"\";left:calc(var(--spectrum-global-dimension-size-50)*-1);opacity:0;position:absolute;right:calc(var(--spectrum-global-dimension-size-50)*-1);top:calc(var(--spectrum-global-dimension-size-50)*-1);transition:opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out}.fill{align-items:center;background-color:var(\n--spectrum-colorcontrol-checkerboard-light-color,var(--spectrum-global-color-static-white)\n);background-image:linear-gradient(-45deg,transparent 75.5%,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 75.5%),linear-gradient(45deg,transparent 75.5%,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 75.5%),linear-gradient(-45deg,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 25.5%,transparent 25.5%),linear-gradient(45deg,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 25.5%,transparent 25.5%);background-position:var(--spectrum-swatch-background-offset) var(--spectrum-swatch-background-offset),var(--spectrum-swatch-background-offset) calc(var(--spectrum-swatch-checkerboard-size) + var(--spectrum-swatch-background-offset)),calc(var(--spectrum-swatch-checkerboard-size) + var(--spectrum-swatch-background-offset)) calc(var(--spectrum-swatch-checkerboard-size)*-1 + var(--spectrum-swatch-background-offset)),calc(var(--spectrum-swatch-checkerboard-size)*-1 + var(--spectrum-swatch-background-offset)) var(--spectrum-swatch-background-offset);background-size:calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(--spectrum-swatch-border-radius);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(--spectrum-swatch-border-radius);bottom:0;box-shadow:inset 0 0 0 var(--spectrum-swatch-fill-border-width) var(--spectrum-swatch-fill-border-color);content:\"\";left:0;position:absolute;right:0;top:0;z-index:0}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--spectrum-swatch-fill-border-width) var(--spectrum-swatch-fill-border-color-light)}:host([border=none]) .fill:before{box-shadow:none}.mixedValueIcon{color:var(\n--spectrum-global-color-gray-700\n)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(--spectrum-swatch-disabled-icon-stroke-color);color:var(--spectrum-swatch-disabled-icon-color);position:relative;z-index:2}:host([size=xs]){height:var(--spectrum-swatch-size-xs);width:var(--spectrum-swatch-size-xs)}:host([size=xs]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-xs);width:var(\n--spectrum-swatch-disabled-icon-size-xs\n)}:host([size=s]){height:var(--spectrum-swatch-size-s);width:var(--spectrum-swatch-size-s)}:host([size=s]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-s);width:var(\n--spectrum-swatch-disabled-icon-size-s\n)}:host([size=m]){height:var(--spectrum-swatch-size-m);width:var(--spectrum-swatch-size-m)}:host([size=m]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-m);width:var(\n--spectrum-swatch-disabled-icon-size-m\n)}:host([size=l]){height:var(--spectrum-swatch-size-l);width:var(--spectrum-swatch-size-l)}:host([size=l]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-l);width:var(\n--spectrum-swatch-disabled-icon-size-l\n)}:host([shape=rectangle][size=xs]){width:calc(var(--spectrum-swatch-size-xs)*2)}:host([shape=rectangle][size=s]){width:calc(var(--spectrum-swatch-size-s)*2)}:host([shape=rectangle][size=m]){width:calc(var(--spectrum-swatch-size-m)*2)}:host([shape=rectangle][size=l]){width:calc(var(--spectrum-swatch-size-l)*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before{border-radius:100%}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(--spectrum-global-animation-duration-100,.13s) ease-in-out,height var(--spectrum-global-animation-duration-100,.13s) ease-in-out;width:100%}@media (forced-colors:active){.fill{forced-color-adjust:none}:host{--spectrum-swatch-disabled-icon-color:grayText;--spectrum-alias-focus-ring-color:ButtonText;--spectrum-swatch-selection-indicator-border-color:Highlight;--spectrum-swatch-fill-border-color:ButtonText;--spectrum-swatch-fill-border-color-light:ButtonText;--spectrum-swatch-background-color-selected:ButtonFace}:host([disabled]) .fill{forced-color-adjust:auto}:host([nothing]) .fill:after{background:ButtonText}}\n`;\nexport default styles;"],
5
- "mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+Df,cAAe",
6
- "names": []
5
+ "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+Df,eAAeC",
6
+ "names": ["css", "styles"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { css } from "@spectrum-web-components/base";
2
3
  const styles = css`
3
4
  :host{align-items:flex-start;display:inline-flex;flex-direction:row;flex-wrap:wrap;gap:var(--spectrum-global-dimension-size-50);justify-content:flex-start}:host([density=compact]){gap:var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["swatch-group.css.ts"],
4
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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{align-items:flex-start;display:inline-flex;flex-direction:row;flex-wrap:wrap;gap:var(--spectrum-global-dimension-size-50);justify-content:flex-start}:host([density=compact]){gap:var(\n--spectrum-global-dimension-size-25\n)}:host([density=spacious]){gap:var(\n--spectrum-global-dimension-size-100\n)}\n`;\nexport default styles;"],
5
- "mappings": "AAWA;AACA,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOf,eAAe;",
5
+ "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOf,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import{css as s}from"@spectrum-web-components/base";const e=s`
1
+ "use strict";import{css as s}from"@spectrum-web-components/base";const e=s`
2
2
  :host{align-items:flex-start;display:inline-flex;flex-direction:row;flex-wrap:wrap;gap:var(--spectrum-global-dimension-size-50);justify-content:flex-start}:host([density=compact]){gap:var(
3
3
  --spectrum-global-dimension-size-25
4
4
  )}:host([density=spacious]){gap:var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["swatch-group.css.ts"],
4
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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{align-items:flex-start;display:inline-flex;flex-direction:row;flex-wrap:wrap;gap:var(--spectrum-global-dimension-size-50);justify-content:flex-start}:host([density=compact]){gap:var(\n--spectrum-global-dimension-size-25\n)}:host([density=spacious]){gap:var(\n--spectrum-global-dimension-size-100\n)}\n`;\nexport default styles;"],
5
- "mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOf,cAAe",
6
- "names": []
5
+ "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOf,eAAeC",
6
+ "names": ["css", "styles"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import { css } from "@spectrum-web-components/base";
2
3
  const styles = css`
3
4
  :host{--spectrum-swatch-size-xs:var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["swatch.css.ts"],
4
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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-size-xs:var(\n--spectrum-global-dimension-size-200\n);--spectrum-swatch-size-s:var(--spectrum-global-dimension-size-300);--spectrum-swatch-size-m:var(--spectrum-global-dimension-size-400);--spectrum-swatch-size-l:var(--spectrum-global-dimension-size-500);--spectrum-swatch-disabled-icon-size-xs:var(\n--spectrum-global-dimension-size-150\n);--spectrum-swatch-disabled-icon-size-s:var(\n--spectrum-global-dimension-size-200\n);--spectrum-swatch-disabled-icon-size-m:var(\n--spectrum-global-dimension-size-225\n);--spectrum-swatch-disabled-icon-size-l:var(\n--spectrum-global-dimension-size-250\n);--spectrum-swatch-disabled-icon-color:var(\n--spectrum-global-color-static-gray-50,rgb(var(--spectrum-global-color-static-gray-50-rgb))\n);--spectrum-swatch-disabled-icon-stroke-color:rgba(var(--spectrum-global-color-static-black-rgb,0,0,0),0.51);--spectrum-swatch-selection-padding:var(\n--spectrum-global-dimension-size-100\n);--spectrum-swatch-selection-indicator-border-width:var(\n--spectrum-global-dimension-size-25\n);--spectrum-swatch-selection-indicator-border-color:var(\n--spectrum-global-color-gray-900\n);--spectrum-swatch-background-color-selected:var(\n--spectrum-global-color-gray-50\n);--spectrum-swatch-border-radius:var(\n--spectrum-alias-border-radius-regular,var(--spectrum-global-dimension-size-50)\n);--spectrum-swatch-fill-border-radius-selected:var(\n--spectrum-alias-border-radius-small,var(--spectrum-global-dimension-size-25)\n);--spectrum-swatch-fill-border-width:var(\n--spectrum-alias-border-size-thin,var(--spectrum-global-dimension-static-size-10)\n);--spectrum-swatch-fill-border-color:rgba(var(--spectrum-global-color-gray-900-rgb),0.51);--spectrum-swatch-fill-border-color-light:rgba(var(--spectrum-global-color-gray-900-rgb),0.2);--spectrum-swatch-background-offset:0px;--spectrum-swatch-checkerboard-size:var(\n--spectrum-global-dimension-static-size-100,8px\n);align-items:center;display:flex;justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none}:host,:host:before{border-radius:var(\n--spectrum-swatch-border-radius\n)}:host([selected]){--spectrum-swatch-background-offset:-4px;background-color:var(\n--spectrum-swatch-background-color-selected\n)}:host([selected]) .fill{border-radius:var(--spectrum-swatch-fill-border-radius-selected);height:calc(100% - var(--spectrum-swatch-selection-padding));width:calc(100% - var(--spectrum-swatch-selection-padding))}:host([selected]) .fill:before{border-radius:var(\n--spectrum-swatch-fill-border-radius-selected\n);box-shadow:none}:host([selected]):before{opacity:1}:host([mixed-value]) .fill{background:var(\n--spectrum-swatch-background-color-selected\n)}:host([mixed-value]) .mixedValueIcon{visibility:visible}:host([nothing]) .fill{background:var(\n--spectrum-swatch-background-color-selected\n)}:host([nothing]) .fill:after{background:var(--spectrum-global-color-red-500);content:\"\";position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([nothing][size=xs]) .fill:after{height:2px}:host([nothing][size=s]) .fill:after{height:3px}:host([nothing][size=m]) .fill:after{height:4px}:host([nothing][size=l]) .fill:after{height:5px}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{visibility:visible}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}:host:before{border:var(--spectrum-swatch-selection-indicator-border-width) solid var(--spectrum-swatch-selection-indicator-border-color);bottom:0;content:\"\";left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0}:host:after{border:var(--spectrum-global-dimension-static-size-25,2px) solid var(\n--spectrum-alias-focus-ring-color,var(--spectrum-alias-focus-color)\n);border-radius:var(--spectrum-alias-focus-ring-border-radius-regular);bottom:calc(var(--spectrum-global-dimension-size-50)*-1);content:\"\";left:calc(var(--spectrum-global-dimension-size-50)*-1);opacity:0;position:absolute;right:calc(var(--spectrum-global-dimension-size-50)*-1);top:calc(var(--spectrum-global-dimension-size-50)*-1);transition:opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out}.fill{align-items:center;background-color:var(\n--spectrum-colorcontrol-checkerboard-light-color,var(--spectrum-global-color-static-white)\n);background-image:linear-gradient(-45deg,transparent 75.5%,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 75.5%),linear-gradient(45deg,transparent 75.5%,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 75.5%),linear-gradient(-45deg,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 25.5%,transparent 25.5%),linear-gradient(45deg,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 25.5%,transparent 25.5%);background-position:var(--spectrum-swatch-background-offset) var(--spectrum-swatch-background-offset),var(--spectrum-swatch-background-offset) calc(var(--spectrum-swatch-checkerboard-size) + var(--spectrum-swatch-background-offset)),calc(var(--spectrum-swatch-checkerboard-size) + var(--spectrum-swatch-background-offset)) calc(var(--spectrum-swatch-checkerboard-size)*-1 + var(--spectrum-swatch-background-offset)),calc(var(--spectrum-swatch-checkerboard-size)*-1 + var(--spectrum-swatch-background-offset)) var(--spectrum-swatch-background-offset);background-size:calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(--spectrum-swatch-border-radius);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(--spectrum-swatch-border-radius);bottom:0;box-shadow:inset 0 0 0 var(--spectrum-swatch-fill-border-width) var(--spectrum-swatch-fill-border-color);content:\"\";left:0;position:absolute;right:0;top:0;z-index:0}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--spectrum-swatch-fill-border-width) var(--spectrum-swatch-fill-border-color-light)}:host([border=none]) .fill:before{box-shadow:none}.mixedValueIcon{color:var(\n--spectrum-global-color-gray-700\n)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(--spectrum-swatch-disabled-icon-stroke-color);color:var(--spectrum-swatch-disabled-icon-color);position:relative;z-index:2}:host([size=xs]){height:var(--spectrum-swatch-size-xs);width:var(--spectrum-swatch-size-xs)}:host([size=xs]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-xs);width:var(\n--spectrum-swatch-disabled-icon-size-xs\n)}:host([size=s]){height:var(--spectrum-swatch-size-s);width:var(--spectrum-swatch-size-s)}:host([size=s]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-s);width:var(\n--spectrum-swatch-disabled-icon-size-s\n)}:host([size=m]){height:var(--spectrum-swatch-size-m);width:var(--spectrum-swatch-size-m)}:host([size=m]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-m);width:var(\n--spectrum-swatch-disabled-icon-size-m\n)}:host([size=l]){height:var(--spectrum-swatch-size-l);width:var(--spectrum-swatch-size-l)}:host([size=l]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-l);width:var(\n--spectrum-swatch-disabled-icon-size-l\n)}:host([shape=rectangle][size=xs]){width:calc(var(--spectrum-swatch-size-xs)*2)}:host([shape=rectangle][size=s]){width:calc(var(--spectrum-swatch-size-s)*2)}:host([shape=rectangle][size=m]){width:calc(var(--spectrum-swatch-size-m)*2)}:host([shape=rectangle][size=l]){width:calc(var(--spectrum-swatch-size-l)*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before{border-radius:100%}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(--spectrum-global-animation-duration-100,.13s) ease-in-out,height var(--spectrum-global-animation-duration-100,.13s) ease-in-out;width:100%}@media (forced-colors:active){.fill{forced-color-adjust:none}:host{--spectrum-swatch-disabled-icon-color:grayText;--spectrum-alias-focus-ring-color:ButtonText;--spectrum-swatch-selection-indicator-border-color:Highlight;--spectrum-swatch-fill-border-color:ButtonText;--spectrum-swatch-fill-border-color-light:ButtonText;--spectrum-swatch-background-color-selected:ButtonFace}:host([disabled]) .fill{forced-color-adjust:auto}:host([nothing]) .fill:after{background:ButtonText}}\n`;\nexport default styles;"],
5
- "mappings": "AAWA;AACA,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+Df,eAAe;",
5
+ "mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+Df,eAAe;",
6
6
  "names": []
7
7
  }
package/src/swatch.css.js CHANGED
@@ -1,4 +1,4 @@
1
- import{css as e}from"@spectrum-web-components/base";const r=e`
1
+ "use strict";import{css as e}from"@spectrum-web-components/base";const r=e`
2
2
  :host{--spectrum-swatch-size-xs:var(
3
3
  --spectrum-global-dimension-size-200
4
4
  );--spectrum-swatch-size-s:var(--spectrum-global-dimension-size-300);--spectrum-swatch-size-m:var(--spectrum-global-dimension-size-400);--spectrum-swatch-size-l:var(--spectrum-global-dimension-size-500);--spectrum-swatch-disabled-icon-size-xs:var(
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["swatch.css.ts"],
4
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 { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-swatch-size-xs:var(\n--spectrum-global-dimension-size-200\n);--spectrum-swatch-size-s:var(--spectrum-global-dimension-size-300);--spectrum-swatch-size-m:var(--spectrum-global-dimension-size-400);--spectrum-swatch-size-l:var(--spectrum-global-dimension-size-500);--spectrum-swatch-disabled-icon-size-xs:var(\n--spectrum-global-dimension-size-150\n);--spectrum-swatch-disabled-icon-size-s:var(\n--spectrum-global-dimension-size-200\n);--spectrum-swatch-disabled-icon-size-m:var(\n--spectrum-global-dimension-size-225\n);--spectrum-swatch-disabled-icon-size-l:var(\n--spectrum-global-dimension-size-250\n);--spectrum-swatch-disabled-icon-color:var(\n--spectrum-global-color-static-gray-50,rgb(var(--spectrum-global-color-static-gray-50-rgb))\n);--spectrum-swatch-disabled-icon-stroke-color:rgba(var(--spectrum-global-color-static-black-rgb,0,0,0),0.51);--spectrum-swatch-selection-padding:var(\n--spectrum-global-dimension-size-100\n);--spectrum-swatch-selection-indicator-border-width:var(\n--spectrum-global-dimension-size-25\n);--spectrum-swatch-selection-indicator-border-color:var(\n--spectrum-global-color-gray-900\n);--spectrum-swatch-background-color-selected:var(\n--spectrum-global-color-gray-50\n);--spectrum-swatch-border-radius:var(\n--spectrum-alias-border-radius-regular,var(--spectrum-global-dimension-size-50)\n);--spectrum-swatch-fill-border-radius-selected:var(\n--spectrum-alias-border-radius-small,var(--spectrum-global-dimension-size-25)\n);--spectrum-swatch-fill-border-width:var(\n--spectrum-alias-border-size-thin,var(--spectrum-global-dimension-static-size-10)\n);--spectrum-swatch-fill-border-color:rgba(var(--spectrum-global-color-gray-900-rgb),0.51);--spectrum-swatch-fill-border-color-light:rgba(var(--spectrum-global-color-gray-900-rgb),0.2);--spectrum-swatch-background-offset:0px;--spectrum-swatch-checkerboard-size:var(\n--spectrum-global-dimension-static-size-100,8px\n);align-items:center;display:flex;justify-content:center;outline:none;position:relative;-webkit-user-select:none;user-select:none}:host,:host:before{border-radius:var(\n--spectrum-swatch-border-radius\n)}:host([selected]){--spectrum-swatch-background-offset:-4px;background-color:var(\n--spectrum-swatch-background-color-selected\n)}:host([selected]) .fill{border-radius:var(--spectrum-swatch-fill-border-radius-selected);height:calc(100% - var(--spectrum-swatch-selection-padding));width:calc(100% - var(--spectrum-swatch-selection-padding))}:host([selected]) .fill:before{border-radius:var(\n--spectrum-swatch-fill-border-radius-selected\n);box-shadow:none}:host([selected]):before{opacity:1}:host([mixed-value]) .fill{background:var(\n--spectrum-swatch-background-color-selected\n)}:host([mixed-value]) .mixedValueIcon{visibility:visible}:host([nothing]) .fill{background:var(\n--spectrum-swatch-background-color-selected\n)}:host([nothing]) .fill:after{background:var(--spectrum-global-color-red-500);content:\"\";position:absolute;transform:rotate(-45deg);width:200%}:host([nothing][shape=rectangle]) .fill:after{transform:rotate(-25deg)}:host([nothing][size=xs]) .fill:after{height:2px}:host([nothing][size=s]) .fill:after{height:3px}:host([nothing][size=m]) .fill:after{height:4px}:host([nothing][size=l]) .fill:after{height:5px}:host([disabled]) .disabledIcon,:host([disabled]) .disabledIcon{visibility:visible}:host(.focus-visible):after{opacity:1}:host(:focus-visible):after{opacity:1}:host:before{border:var(--spectrum-swatch-selection-indicator-border-width) solid var(--spectrum-swatch-selection-indicator-border-color);bottom:0;content:\"\";left:0;opacity:0;pointer-events:none;position:absolute;right:0;top:0}:host:after{border:var(--spectrum-global-dimension-static-size-25,2px) solid var(\n--spectrum-alias-focus-ring-color,var(--spectrum-alias-focus-color)\n);border-radius:var(--spectrum-alias-focus-ring-border-radius-regular);bottom:calc(var(--spectrum-global-dimension-size-50)*-1);content:\"\";left:calc(var(--spectrum-global-dimension-size-50)*-1);opacity:0;position:absolute;right:calc(var(--spectrum-global-dimension-size-50)*-1);top:calc(var(--spectrum-global-dimension-size-50)*-1);transition:opacity var(--spectrum-global-animation-duration-100,.13s) ease-in-out}.fill{align-items:center;background-color:var(\n--spectrum-colorcontrol-checkerboard-light-color,var(--spectrum-global-color-static-white)\n);background-image:linear-gradient(-45deg,transparent 75.5%,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 75.5%),linear-gradient(45deg,transparent 75.5%,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 75.5%),linear-gradient(-45deg,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 25.5%,transparent 25.5%),linear-gradient(45deg,var(\n--spectrum-colorcontrol-checkerboard-dark-color,var(--spectrum-global-color-static-gray-300)\n) 25.5%,transparent 25.5%);background-position:var(--spectrum-swatch-background-offset) var(--spectrum-swatch-background-offset),var(--spectrum-swatch-background-offset) calc(var(--spectrum-swatch-checkerboard-size) + var(--spectrum-swatch-background-offset)),calc(var(--spectrum-swatch-checkerboard-size) + var(--spectrum-swatch-background-offset)) calc(var(--spectrum-swatch-checkerboard-size)*-1 + var(--spectrum-swatch-background-offset)),calc(var(--spectrum-swatch-checkerboard-size)*-1 + var(--spectrum-swatch-background-offset)) var(--spectrum-swatch-background-offset);background-size:calc(var(--spectrum-swatch-checkerboard-size)*2) calc(var(--spectrum-swatch-checkerboard-size)*2);border-radius:var(--spectrum-swatch-border-radius);box-sizing:border-box;display:flex;height:100%;justify-content:center;overflow:hidden;position:relative;width:100%}.fill:before{background-color:var(--spectrum-picked-color,transparent);border-radius:var(--spectrum-swatch-border-radius);bottom:0;box-shadow:inset 0 0 0 var(--spectrum-swatch-fill-border-width) var(--spectrum-swatch-fill-border-color);content:\"\";left:0;position:absolute;right:0;top:0;z-index:0}:host([border=light]) .fill:before{box-shadow:inset 0 0 0 var(--spectrum-swatch-fill-border-width) var(--spectrum-swatch-fill-border-color-light)}:host([border=none]) .fill:before{box-shadow:none}.mixedValueIcon{color:var(\n--spectrum-global-color-gray-700\n)}.disabledIcon,.mixedValueIcon{pointer-events:none;visibility:hidden}.disabledIcon{stroke:var(--spectrum-swatch-disabled-icon-stroke-color);color:var(--spectrum-swatch-disabled-icon-color);position:relative;z-index:2}:host([size=xs]){height:var(--spectrum-swatch-size-xs);width:var(--spectrum-swatch-size-xs)}:host([size=xs]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-xs);width:var(\n--spectrum-swatch-disabled-icon-size-xs\n)}:host([size=s]){height:var(--spectrum-swatch-size-s);width:var(--spectrum-swatch-size-s)}:host([size=s]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-s);width:var(\n--spectrum-swatch-disabled-icon-size-s\n)}:host([size=m]){height:var(--spectrum-swatch-size-m);width:var(--spectrum-swatch-size-m)}:host([size=m]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-m);width:var(\n--spectrum-swatch-disabled-icon-size-m\n)}:host([size=l]){height:var(--spectrum-swatch-size-l);width:var(--spectrum-swatch-size-l)}:host([size=l]) .disabledIcon{height:var(--spectrum-swatch-disabled-icon-size-l);width:var(\n--spectrum-swatch-disabled-icon-size-l\n)}:host([shape=rectangle][size=xs]){width:calc(var(--spectrum-swatch-size-xs)*2)}:host([shape=rectangle][size=s]){width:calc(var(--spectrum-swatch-size-s)*2)}:host([shape=rectangle][size=m]){width:calc(var(--spectrum-swatch-size-m)*2)}:host([shape=rectangle][size=l]){width:calc(var(--spectrum-swatch-size-l)*2)}:host([rounding=none]),:host([rounding=none]) .fill,:host([rounding=none]) .fill:before,:host([rounding=none]):after,:host([rounding=none]):before,:host([rounding=none][selected]) .fill,:host([rounding=none][selected]) .fill:before{border-radius:0}:host([rounding=full]:not([shape=rectangle])),:host([rounding=full]:not([shape=rectangle])) .fill,:host([rounding=full]:not([shape=rectangle])) .fill:before,:host([rounding=full]:not([shape=rectangle])):after,:host([rounding=full]:not([shape=rectangle])):before,:host([rounding=full][selected]:not([shape=rectangle])) .fill,:host([rounding=full][selected]:not([shape=rectangle])) .fill:before{border-radius:100%}::slotted([slot=image]){height:100%;object-fit:contain;transition:width var(--spectrum-global-animation-duration-100,.13s) ease-in-out,height var(--spectrum-global-animation-duration-100,.13s) ease-in-out;width:100%}@media (forced-colors:active){.fill{forced-color-adjust:none}:host{--spectrum-swatch-disabled-icon-color:grayText;--spectrum-alias-focus-ring-color:ButtonText;--spectrum-swatch-selection-indicator-border-color:Highlight;--spectrum-swatch-fill-border-color:ButtonText;--spectrum-swatch-fill-border-color-light:ButtonText;--spectrum-swatch-background-color-selected:ButtonFace}:host([disabled]) .fill{forced-color-adjust:auto}:host([nothing]) .fill:after{background:ButtonText}}\n`;\nexport default styles;"],
5
- "mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+Df,cAAe",
6
- "names": []
5
+ "mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA+Df,eAAeC",
6
+ "names": ["css", "styles"]
7
7
  }
@@ -1,27 +1,182 @@
1
- import{html as n}from"@spectrum-web-components/base";import{ifDefined as o}from"@spectrum-web-components/base/src/directives.js";import"../sp-swatch-group.js";import"../sp-swatch.js";export default{title:"Swatch group",component:"sp-swatch-group",args:{},argTypes:{border:{name:"border",type:{name:"string",required:!1},description:"The border to apply to the Swatch children.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["normal","light","none"]}},density:{name:"density",type:{name:"string",required:!1},description:"The density at which to display the Swatch children.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["normal","compact","spacious"]}},rounding:{name:"rounding",type:{name:"string",required:!1},description:"The rounding to apply to the Swatch children.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["normal","none","full"]}},selects:{name:"selects",type:{name:"string",required:!1},description:"Whether the Swatch Group manages a selection, and whether it is a sinlge or multiple selection.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["none","single","multiple"]}},shape:{name:"shape",type:{name:"string",required:!1},description:"The shape to apply to the Swatch children.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["normal","rectangle"]}}},decorators:[e=>n`
1
+ "use strict";
2
+ import { html } from "@spectrum-web-components/base";
3
+ import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
4
+ import "../sp-swatch-group.js";
5
+ import "../sp-swatch.js";
6
+ export default {
7
+ title: "Swatch group",
8
+ component: "sp-swatch-group",
9
+ args: {},
10
+ argTypes: {
11
+ border: {
12
+ name: "border",
13
+ type: { name: "string", required: false },
14
+ description: "The border to apply to the Swatch children.",
15
+ table: {
16
+ defaultValue: { summary: "" }
17
+ },
18
+ control: {
19
+ type: "inline-radio",
20
+ options: ["normal", "light", "none"]
21
+ }
22
+ },
23
+ density: {
24
+ name: "density",
25
+ type: { name: "string", required: false },
26
+ description: "The density at which to display the Swatch children.",
27
+ table: {
28
+ defaultValue: { summary: "" }
29
+ },
30
+ control: {
31
+ type: "inline-radio",
32
+ options: ["normal", "compact", "spacious"]
33
+ }
34
+ },
35
+ rounding: {
36
+ name: "rounding",
37
+ type: { name: "string", required: false },
38
+ description: "The rounding to apply to the Swatch children.",
39
+ table: {
40
+ defaultValue: { summary: "" }
41
+ },
42
+ control: {
43
+ type: "inline-radio",
44
+ options: ["normal", "none", "full"]
45
+ }
46
+ },
47
+ selects: {
48
+ name: "selects",
49
+ type: { name: "string", required: false },
50
+ description: "Whether the Swatch Group manages a selection, and whether it is a sinlge or multiple selection.",
51
+ table: {
52
+ defaultValue: { summary: "" }
53
+ },
54
+ control: {
55
+ type: "inline-radio",
56
+ options: ["none", "single", "multiple"]
57
+ }
58
+ },
59
+ shape: {
60
+ name: "shape",
61
+ type: { name: "string", required: false },
62
+ description: "The shape to apply to the Swatch children.",
63
+ table: {
64
+ defaultValue: { summary: "" }
65
+ },
66
+ control: {
67
+ type: "inline-radio",
68
+ options: ["normal", "rectangle"]
69
+ }
70
+ }
71
+ },
72
+ decorators: [
73
+ (story) => html`
2
74
  <div
3
- @change=${async r=>{if(await 0,r.defaultPrevented)return;const l=r.target.nextElementSibling;l.textContent=`Selected: ${JSON.stringify(r.target.selected)}`}}
75
+ @change=${async (event) => {
76
+ await 0;
77
+ if (event.defaultPrevented)
78
+ return;
79
+ const next = event.target.nextElementSibling;
80
+ next.textContent = `Selected: ${JSON.stringify(
81
+ event.target.selected
82
+ )}`;
83
+ }}
4
84
  >
5
- ${e()}
85
+ ${story()}
6
86
  <div>Selected: []</div>
7
87
  </div>
8
- `]};const u=["--spectrum-global-color-gray-500","--spectrum-global-color-red-500","--spectrum-global-color-orange-500","--spectrum-global-color-yellow-500","--spectrum-global-color-chartreuse-500","--spectrum-global-color-celery-500","--spectrum-global-color-green-500","--spectrum-global-color-seafoam-500","--spectrum-global-color-blue-500","--spectrum-global-color-indigo-500","--spectrum-global-color-purple-500","--spectrum-global-color-fuchsia-500","--spectrum-global-color-magenta-500"],t=({border:e,density:r,rounding:l,selects:a,selected:i=[],shape:p})=>{const c=a?a==="single"?"Select a color":"Selects color(s)":void 0;return n`
88
+ `
89
+ ]
90
+ };
91
+ const colors = [
92
+ "--spectrum-global-color-gray-500",
93
+ "--spectrum-global-color-red-500",
94
+ "--spectrum-global-color-orange-500",
95
+ "--spectrum-global-color-yellow-500",
96
+ "--spectrum-global-color-chartreuse-500",
97
+ "--spectrum-global-color-celery-500",
98
+ "--spectrum-global-color-green-500",
99
+ "--spectrum-global-color-seafoam-500",
100
+ "--spectrum-global-color-blue-500",
101
+ "--spectrum-global-color-indigo-500",
102
+ "--spectrum-global-color-purple-500",
103
+ "--spectrum-global-color-fuchsia-500",
104
+ "--spectrum-global-color-magenta-500"
105
+ ];
106
+ const template = ({
107
+ border,
108
+ density,
109
+ rounding,
110
+ selects,
111
+ selected = [],
112
+ shape
113
+ }) => {
114
+ const groupLabel = !!selects ? selects === "single" ? "Select a color" : "Selects color(s)" : void 0;
115
+ return html`
9
116
  <sp-swatch-group
10
- border=${o(e==="normal"?void 0:e)}
11
- density=${o(r==="normal"?void 0:r)}
12
- rounding=${o(l==="normal"?void 0:l)}
13
- selects=${o(a==="none"?void 0:a)}
14
- .selected=${i}
15
- shape=${o(p==="normal"?void 0:p)}
16
- aria-label=${o(c)}
117
+ border=${ifDefined(border === "normal" ? void 0 : border)}
118
+ density=${ifDefined(density === "normal" ? void 0 : density)}
119
+ rounding=${ifDefined(rounding === "normal" ? void 0 : rounding)}
120
+ selects=${ifDefined(selects === "none" ? void 0 : selects)}
121
+ .selected=${selected}
122
+ shape=${ifDefined(shape === "normal" ? void 0 : shape)}
123
+ aria-label=${ifDefined(groupLabel)}
17
124
  >
18
- ${u.map(s=>n`
125
+ ${colors.map(
126
+ (color) => html`
19
127
  <sp-swatch
20
- color="var(${s})"
21
- label=${s}
22
- value=${s}
128
+ color="var(${color})"
129
+ label=${color}
130
+ value=${color}
23
131
  ></sp-swatch>
24
- `)}
132
+ `
133
+ )}
25
134
  </sp-swatch-group>
26
- `};export const Default=e=>t(e);Default.args={};export const densityCompact=e=>t(e);densityCompact.args={density:"compact"};export const densitySpacious=e=>t(e);densitySpacious.args={density:"spacious"};export const selectsSingle=e=>t(e);selectsSingle.args={selects:"single",selected:["--spectrum-global-color-yellow-500"]};export const selectsMultiple=e=>t(e);selectsMultiple.args={selects:"multiple",selected:["--spectrum-global-color-celery-500","--spectrum-global-color-red-500","--spectrum-global-color-purple-500","--spectrum-global-color-blue-500"]};export const borderLight=e=>t(e);borderLight.args={border:"light"};export const borderNone=e=>t(e);borderNone.args={border:"none"};export const roundingNone=e=>t(e);roundingNone.args={rounding:"none"};export const roundingFull=e=>t(e);roundingFull.args={rounding:"full"};export const shapeRectangle=e=>t(e);shapeRectangle.args={shape:"rectangle"};
135
+ `;
136
+ };
137
+ export const Default = (args) => template(args);
138
+ Default.args = {};
139
+ export const densityCompact = (args) => template(args);
140
+ densityCompact.args = {
141
+ density: "compact"
142
+ };
143
+ export const densitySpacious = (args) => template(args);
144
+ densitySpacious.args = {
145
+ density: "spacious"
146
+ };
147
+ export const selectsSingle = (args) => template(args);
148
+ selectsSingle.args = {
149
+ selects: "single",
150
+ selected: ["--spectrum-global-color-yellow-500"]
151
+ };
152
+ export const selectsMultiple = (args) => template(args);
153
+ selectsMultiple.args = {
154
+ selects: "multiple",
155
+ selected: [
156
+ "--spectrum-global-color-celery-500",
157
+ "--spectrum-global-color-red-500",
158
+ "--spectrum-global-color-purple-500",
159
+ "--spectrum-global-color-blue-500"
160
+ ]
161
+ };
162
+ export const borderLight = (args) => template(args);
163
+ borderLight.args = {
164
+ border: "light"
165
+ };
166
+ export const borderNone = (args) => template(args);
167
+ borderNone.args = {
168
+ border: "none"
169
+ };
170
+ export const roundingNone = (args) => template(args);
171
+ roundingNone.args = {
172
+ rounding: "none"
173
+ };
174
+ export const roundingFull = (args) => template(args);
175
+ roundingFull.args = {
176
+ rounding: "full"
177
+ };
178
+ export const shapeRectangle = (args) => template(args);
179
+ shapeRectangle.args = {
180
+ shape: "rectangle"
181
+ };
27
182
  //# sourceMappingURL=swatch-group.stories.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["swatch-group.stories.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '../sp-swatch-group.js';\nimport '../sp-swatch.js';\nimport type {\n SwatchBorder,\n SwatchRounding,\n SwatchShape,\n} from '../src/Swatch.js';\nimport { SwatchGroup } from '../src/SwatchGroup.js';\n\ntype Properties = {\n border: SwatchBorder | 'normal';\n density?: 'normal' | 'spacious' | 'compact';\n rounding?: SwatchRounding | 'normal';\n selected?: string[];\n selects?: 'none' | 'single' | 'multiple';\n shape?: SwatchShape | 'normal';\n};\n\nexport default {\n title: 'Swatch group',\n component: 'sp-swatch-group',\n args: {},\n argTypes: {\n border: {\n name: 'border',\n type: { name: 'string', required: false },\n description: 'The border to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'light', 'none'],\n },\n },\n density: {\n name: 'density',\n type: { name: 'string', required: false },\n description: 'The density at which to display the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'compact', 'spacious'],\n },\n },\n rounding: {\n name: 'rounding',\n type: { name: 'string', required: false },\n description: 'The rounding to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'none', 'full'],\n },\n },\n selects: {\n name: 'selects',\n type: { name: 'string', required: false },\n description:\n 'Whether the Swatch Group manages a selection, and whether it is a sinlge or multiple selection.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['none', 'single', 'multiple'],\n },\n },\n shape: {\n name: 'shape',\n type: { name: 'string', required: false },\n description: 'The shape to apply to the Swatch children.',\n table: {\n defaultValue: { summary: '' },\n },\n control: {\n type: 'inline-radio',\n options: ['normal', 'rectangle'],\n },\n },\n },\n decorators: [\n (story: () => TemplateResult): TemplateResult => html`\n <div\n @change=${async (event: Event & { target: SwatchGroup }) => {\n await 0;\n if (event.defaultPrevented) return;\n const next = event.target\n .nextElementSibling as HTMLDivElement;\n next.textContent = `Selected: ${JSON.stringify(\n event.target.selected\n )}`;\n }}\n >\n ${story()}\n <div>Selected: []</div>\n </div>\n `,\n ],\n};\n\nconst colors = [\n '--spectrum-global-color-gray-500',\n '--spectrum-global-color-red-500',\n '--spectrum-global-color-orange-500',\n '--spectrum-global-color-yellow-500',\n '--spectrum-global-color-chartreuse-500',\n '--spectrum-global-color-celery-500',\n '--spectrum-global-color-green-500',\n '--spectrum-global-color-seafoam-500',\n '--spectrum-global-color-blue-500',\n '--spectrum-global-color-indigo-500',\n '--spectrum-global-color-purple-500',\n '--spectrum-global-color-fuchsia-500',\n '--spectrum-global-color-magenta-500',\n];\n\nconst template = ({\n border,\n density,\n rounding,\n selects,\n selected = [],\n shape,\n}: Properties): TemplateResult => {\n const groupLabel = !!selects\n ? selects === 'single'\n ? 'Select a color'\n : 'Selects color(s)'\n : undefined;\n return html`\n <sp-swatch-group\n border=${ifDefined(border === 'normal' ? undefined : border)}\n density=${ifDefined(density === 'normal' ? undefined : density)}\n rounding=${ifDefined(rounding === 'normal' ? undefined : rounding)}\n selects=${ifDefined(selects === 'none' ? undefined : selects)}\n .selected=${selected}\n shape=${ifDefined(shape === 'normal' ? undefined : shape)}\n aria-label=${ifDefined(groupLabel)}\n >\n ${colors.map(\n (color) => html`\n <sp-swatch\n color=\"var(${color})\"\n label=${color}\n value=${color}\n ></sp-swatch>\n `\n )}\n </sp-swatch-group>\n `;\n};\n\nexport const Default = (args: Properties): TemplateResult => template(args);\nDefault.args = {} as Properties;\nexport const densityCompact = (args: Properties): TemplateResult =>\n template(args);\ndensityCompact.args = {\n density: 'compact',\n} as Properties;\nexport const densitySpacious = (args: Properties): TemplateResult =>\n template(args);\ndensitySpacious.args = {\n density: 'spacious',\n} as Properties;\nexport const selectsSingle = (args: Properties): TemplateResult =>\n template(args);\nselectsSingle.args = {\n selects: 'single',\n selected: ['--spectrum-global-color-yellow-500'],\n} as Properties;\nexport const selectsMultiple = (args: Properties): TemplateResult =>\n template(args);\nselectsMultiple.args = {\n selects: 'multiple',\n selected: [\n '--spectrum-global-color-celery-500',\n '--spectrum-global-color-red-500',\n '--spectrum-global-color-purple-500',\n '--spectrum-global-color-blue-500',\n ],\n} as Properties;\nexport const borderLight = (args: Properties): TemplateResult => template(args);\nborderLight.args = {\n border: 'light',\n} as Properties;\nexport const borderNone = (args: Properties): TemplateResult => template(args);\nborderNone.args = {\n border: 'none',\n} as Properties;\nexport const roundingNone = (args: Properties): TemplateResult =>\n template(args);\nroundingNone.args = {\n rounding: 'none',\n} as Properties;\nexport const roundingFull = (args: Properties): TemplateResult =>\n template(args);\nroundingFull.args = {\n rounding: 'full',\n} as Properties;\nexport const shapeRectangle = (args: Properties): TemplateResult =>\n template(args);\nshapeRectangle.args = {\n shape: 'rectangle',\n} as Properties;\n"],
5
- "mappings": "AAWA,qDACA,4EAEA,8BACA,wBAiBA,cAAe,CACX,MAAO,eACP,UAAW,kBACX,KAAM,CAAC,EACP,SAAU,CACN,OAAQ,CACJ,KAAM,SACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YAAa,8CACb,MAAO,CACH,aAAc,CAAE,QAAS,EAAG,CAChC,EACA,QAAS,CACL,KAAM,eACN,QAAS,CAAC,SAAU,QAAS,MAAM,CACvC,CACJ,EACA,QAAS,CACL,KAAM,UACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YAAa,uDACb,MAAO,CACH,aAAc,CAAE,QAAS,EAAG,CAChC,EACA,QAAS,CACL,KAAM,eACN,QAAS,CAAC,SAAU,UAAW,UAAU,CAC7C,CACJ,EACA,SAAU,CACN,KAAM,WACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YAAa,gDACb,MAAO,CACH,aAAc,CAAE,QAAS,EAAG,CAChC,EACA,QAAS,CACL,KAAM,eACN,QAAS,CAAC,SAAU,OAAQ,MAAM,CACtC,CACJ,EACA,QAAS,CACL,KAAM,UACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YACI,kGACJ,MAAO,CACH,aAAc,CAAE,QAAS,EAAG,CAChC,EACA,QAAS,CACL,KAAM,eACN,QAAS,CAAC,OAAQ,SAAU,UAAU,CAC1C,CACJ,EACA,MAAO,CACH,KAAM,QACN,KAAM,CAAE,KAAM,SAAU,SAAU,EAAM,EACxC,YAAa,6CACb,MAAO,CACH,aAAc,CAAE,QAAS,EA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,aAAa,CAAC,SAAqC,SAAS,IAAI;AAC7E,WAAW,OAAO;AAAA,EACd,QAAQ;AACZ;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,iBAAiB,CAAC,SAC3B,SAAS,IAAI;AACjB,eAAe,OAAO;AAAA,EAClB,OAAO;AACX;",
6
6
  "names": []
7
7
  }
@@ -1,24 +1,40 @@
1
- import{html as a}from"@spectrum-web-components/base";import"../sp-swatch.js";export default{title:"Swatch/Sizes",component:"sp-swatch"};const p=({size:t,color:e="rgb(255 0 0 / 0.7)"})=>a`
1
+ "use strict";
2
+ import {
3
+ html
4
+ } from "@spectrum-web-components/base";
5
+ import "../sp-swatch.js";
6
+ export default {
7
+ title: "Swatch/Sizes",
8
+ component: "sp-swatch"
9
+ };
10
+ const template = ({
11
+ size,
12
+ color = "rgb(255 0 0 / 0.7)"
13
+ }) => html`
2
14
  <div style="display: flex; gap: 5px;">
3
- <sp-swatch color=${e} size=${t}></sp-swatch>
4
- <sp-swatch color=${e} rounding="none" size=${t}></sp-swatch>
5
- <sp-swatch color=${e} rounding="full" size=${t}></sp-swatch>
6
- <sp-swatch color=${e} border="light" size=${t}></sp-swatch>
7
- <sp-swatch color=${e} border="none" size=${t}></sp-swatch>
8
- <sp-swatch nothing size=${t}></sp-swatch>
9
- <sp-swatch color=${e} shape="rectangle" size=${t}></sp-swatch>
15
+ <sp-swatch color=${color} size=${size}></sp-swatch>
16
+ <sp-swatch color=${color} rounding="none" size=${size}></sp-swatch>
17
+ <sp-swatch color=${color} rounding="full" size=${size}></sp-swatch>
18
+ <sp-swatch color=${color} border="light" size=${size}></sp-swatch>
19
+ <sp-swatch color=${color} border="none" size=${size}></sp-swatch>
20
+ <sp-swatch nothing size=${size}></sp-swatch>
21
+ <sp-swatch color=${color} shape="rectangle" size=${size}></sp-swatch>
10
22
  <sp-swatch
11
- color=${e}
23
+ color=${color}
12
24
  shape="rectangle"
13
- size=${t}
25
+ size=${size}
14
26
  disabled
15
27
  ></sp-swatch>
16
28
  <sp-swatch
17
29
  rounding="full"
18
30
  shape="rectangle"
19
- size=${t}
31
+ size=${size}
20
32
  mixed-value
21
33
  ></sp-swatch>
22
34
  </div>
23
- `;export const XS=()=>p({size:"xs"}),s=()=>p({size:"s"}),m=()=>p({size:"m"}),l=()=>p({size:"l"});
35
+ `;
36
+ export const XS = () => template({ size: "xs" });
37
+ export const s = () => template({ size: "s" });
38
+ export const m = () => template({ size: "m" });
39
+ export const l = () => template({ size: "l" });
24
40
  //# sourceMappingURL=swatch-sizes.stories.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["swatch-sizes.stories.ts"],
4
4
  "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementSize,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\n\nimport '../sp-swatch.js';\n\nexport default {\n title: 'Swatch/Sizes',\n component: 'sp-swatch',\n};\n\nconst template = ({\n size,\n color = 'rgb(255 0 0 / 0.7)',\n}: {\n size: ElementSize;\n color?: string;\n}): TemplateResult => html`\n <div style=\"display: flex; gap: 5px;\">\n <sp-swatch color=${color} size=${size}></sp-swatch>\n <sp-swatch color=${color} rounding=\"none\" size=${size}></sp-swatch>\n <sp-swatch color=${color} rounding=\"full\" size=${size}></sp-swatch>\n <sp-swatch color=${color} border=\"light\" size=${size}></sp-swatch>\n <sp-swatch color=${color} border=\"none\" size=${size}></sp-swatch>\n <sp-swatch nothing size=${size}></sp-swatch>\n <sp-swatch color=${color} shape=\"rectangle\" size=${size}></sp-swatch>\n <sp-swatch\n color=${color}\n shape=\"rectangle\"\n size=${size}\n disabled\n ></sp-swatch>\n <sp-swatch\n rounding=\"full\"\n shape=\"rectangle\"\n size=${size}\n mixed-value\n ></sp-swatch>\n </div>\n`;\n\nexport const XS = (): TemplateResult => template({ size: 'xs' });\n\nexport const s = (): TemplateResult => template({ size: 's' });\n\nexport const m = (): TemplateResult => template({ size: 'm' });\n\nexport const l = (): TemplateResult => template({ size: 'l' });\n"],
5
- "mappings": "AAWA,qDAMA,wBAEA,cAAe,CACX,MAAO,eACP,UAAW,WACf,EAEA,KAAM,GAAW,CAAC,CACd,OACA,QAAQ,wBAIU;AAAA;AAAA,2BAEK,UAAc;AAAA,2BACd,0BAA8B;AAAA,2BAC9B,0BAA8B;AAAA,2BAC9B,yBAA6B;AAAA,2BAC7B,wBAA4B;AAAA,kCACrB;AAAA,2BACP,4BAAgC;AAAA;AAAA,oBAEvC;AAAA;AAAA,mBAED;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMA;AAAA;AAAA;AAAA;AAAA,EAMZ,YAAM,IAAK,IAAsB,EAAS,CAAE,KAAM,IAAK,CAAC,EAElD,EAAI,IAAsB,EAAS,CAAE,KAAM,GAAI,CAAC,EAEhD,EAAI,IAAsB,EAAS,CAAE,KAAM,GAAI,CAAC,EAEhD,EAAI,IAAsB,EAAS,CAAE,KAAM,GAAI,CAAC",
5
+ "mappings": ";AAWA;AAAA,EAEI;AAAA,OAEG;AAEP,OAAO;AAEP,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AACf;AAEA,MAAM,WAAW,CAAC;AAAA,EACd;AAAA,EACA,QAAQ;AACZ,MAGsB;AAAA;AAAA,2BAEK,cAAc;AAAA,2BACd,8BAA8B;AAAA,2BAC9B,8BAA8B;AAAA,2BAC9B,6BAA6B;AAAA,2BAC7B,4BAA4B;AAAA,kCACrB;AAAA,2BACP,gCAAgC;AAAA;AAAA,oBAEvC;AAAA;AAAA,mBAED;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAMA;AAAA;AAAA;AAAA;AAAA;AAMZ,aAAM,KAAK,MAAsB,SAAS,EAAE,MAAM,KAAK,CAAC;AAExD,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;AAEtD,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;AAEtD,aAAM,IAAI,MAAsB,SAAS,EAAE,MAAM,IAAI,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,101 @@
1
- import{html as s}from"@spectrum-web-components/base";import{ifDefined as r}from"@spectrum-web-components/base/src/directives.js";import"../sp-swatch.js";export default{title:"Swatch",component:"sp-swatch",args:{color:"#ff0000"},argTypes:{color:{control:"color"},border:{name:"border",type:{name:"string",required:!1},description:"The border to apply to the Swatch children.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["normal","light","none"]}},rounding:{name:"rounding",type:{name:"string",required:!1},description:"The rounding to apply to the Swatch children.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["normal","none","full"]}},shape:{name:"shape",type:{name:"string",required:!1},description:"The shape to apply to the Swatch children.",table:{defaultValue:{summary:""}},control:{type:"inline-radio",options:["normal","rectangle"]}}}};const t=({color:e,border:o,rounding:n,shape:a,mixedValue:l,nothing:i})=>s`
1
+ "use strict";
2
+ import { html } from "@spectrum-web-components/base";
3
+ import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
4
+ import "../sp-swatch.js";
5
+ export default {
6
+ title: "Swatch",
7
+ component: "sp-swatch",
8
+ args: {
9
+ color: "#ff0000"
10
+ },
11
+ argTypes: {
12
+ color: { control: "color" },
13
+ border: {
14
+ name: "border",
15
+ type: { name: "string", required: false },
16
+ description: "The border to apply to the Swatch children.",
17
+ table: {
18
+ defaultValue: { summary: "" }
19
+ },
20
+ control: {
21
+ type: "inline-radio",
22
+ options: ["normal", "light", "none"]
23
+ }
24
+ },
25
+ rounding: {
26
+ name: "rounding",
27
+ type: { name: "string", required: false },
28
+ description: "The rounding to apply to the Swatch children.",
29
+ table: {
30
+ defaultValue: { summary: "" }
31
+ },
32
+ control: {
33
+ type: "inline-radio",
34
+ options: ["normal", "none", "full"]
35
+ }
36
+ },
37
+ shape: {
38
+ name: "shape",
39
+ type: { name: "string", required: false },
40
+ description: "The shape to apply to the Swatch children.",
41
+ table: {
42
+ defaultValue: { summary: "" }
43
+ },
44
+ control: {
45
+ type: "inline-radio",
46
+ options: ["normal", "rectangle"]
47
+ }
48
+ }
49
+ }
50
+ };
51
+ const template = ({
52
+ color,
53
+ border,
54
+ rounding,
55
+ shape,
56
+ mixedValue: mixedValue2,
57
+ nothing: nothing2
58
+ }) => {
59
+ return html`
2
60
  <sp-swatch
3
- border=${r(o==="normal"?void 0:o)}
4
- rounding=${r(n==="normal"?void 0:n)}
5
- shape=${r(a==="normal"?void 0:a)}
6
- color=${e}
7
- ?mixed-value=${l}
8
- ?nothing=${i}
61
+ border=${ifDefined(border === "normal" ? void 0 : border)}
62
+ rounding=${ifDefined(rounding === "normal" ? void 0 : rounding)}
63
+ shape=${ifDefined(shape === "normal" ? void 0 : shape)}
64
+ color=${color}
65
+ ?mixed-value=${mixedValue2}
66
+ ?nothing=${nothing2}
9
67
  ></sp-swatch>
10
- `;export const Default=e=>t(e),mixedValue=e=>t(e);mixedValue.args={mixedValue:!0,color:""};export const nothing=e=>t(e);nothing.args={nothing:!0,color:""};export const borderLight=e=>t(e);borderLight.args={border:"light"};export const borderNone=e=>t(e);borderNone.args={border:"none"};export const roundingNone=e=>t(e);roundingNone.args={rounding:"none"};export const roundingFull=e=>t(e);roundingFull.args={rounding:"full"};export const shapeRectangle=e=>t(e);shapeRectangle.args={shape:"rectangle"};
68
+ `;
69
+ };
70
+ export const Default = (args) => template(args);
71
+ export const mixedValue = (args) => template(args);
72
+ mixedValue.args = {
73
+ mixedValue: true,
74
+ color: ""
75
+ };
76
+ export const nothing = (args) => template(args);
77
+ nothing.args = {
78
+ nothing: true,
79
+ color: ""
80
+ };
81
+ export const borderLight = (args) => template(args);
82
+ borderLight.args = {
83
+ border: "light"
84
+ };
85
+ export const borderNone = (args) => template(args);
86
+ borderNone.args = {
87
+ border: "none"
88
+ };
89
+ export const roundingNone = (args) => template(args);
90
+ roundingNone.args = {
91
+ rounding: "none"
92
+ };
93
+ export const roundingFull = (args) => template(args);
94
+ roundingFull.args = {
95
+ rounding: "full"
96
+ };
97
+ export const shapeRectangle = (args) => template(args);
98
+ shapeRectangle.args = {
99
+ shape: "rectangle"
100
+ };
11
101
  //# sourceMappingURL=swatch.stories.js.map