@spectrum-web-components/swatch 0.1.2-devmode.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -5
- package/sp-swatch-group.js +14 -3
- package/sp-swatch-group.js.map +1 -7
- package/sp-swatch.js +14 -3
- package/sp-swatch.js.map +1 -7
- package/src/Swatch.js +170 -165
- package/src/Swatch.js.map +1 -7
- package/src/SwatchGroup.js +216 -201
- package/src/SwatchGroup.js.map +1 -7
- package/src/index.js +14 -3
- package/src/index.js.map +1 -7
- package/src/spectrum-swatch-group.css.js +14 -3
- package/src/spectrum-swatch-group.css.js.map +1 -7
- package/src/spectrum-swatch.css.js +14 -3
- package/src/spectrum-swatch.css.js.map +1 -7
- package/src/swatch-group.css.js +14 -3
- package/src/swatch-group.css.js.map +1 -7
- package/src/swatch.css.js +14 -3
- package/src/swatch.css.js.map +1 -7
- package/stories/swatch-group.stories.js +133 -124
- package/stories/swatch-group.stories.js.map +1 -7
- package/stories/swatch-sizes.stories.js +21 -15
- package/stories/swatch-sizes.stories.js.map +1 -7
- package/stories/swatch.stories.js +73 -69
- package/stories/swatch.stories.js.map +1 -7
- package/test/benchmark/basic-test.js +16 -5
- package/test/benchmark/basic-test.js.map +1 -7
- package/test/swatch-group.test-vrt.js +15 -4
- package/test/swatch-group.test-vrt.js.map +1 -7
- package/test/swatch-group.test.js +240 -229
- package/test/swatch-group.test.js.map +1 -7
- package/test/swatch-sizes.test-vrt.js +15 -4
- package/test/swatch-sizes.test-vrt.js.map +1 -7
- package/test/swatch.test-vrt.js +15 -4
- package/test/swatch.test-vrt.js.map +1 -7
- package/test/swatch.test.js +135 -124
- package/test/swatch.test.js.map +1 -7
- package/sp-swatch-group.dev.js +0 -3
- package/sp-swatch-group.dev.js.map +0 -7
- package/sp-swatch.dev.js +0 -3
- package/sp-swatch.dev.js.map +0 -7
- package/src/Swatch.dev.js +0 -219
- package/src/Swatch.dev.js.map +0 -7
- package/src/SwatchGroup.dev.js +0 -220
- package/src/SwatchGroup.dev.js.map +0 -7
- package/src/index.dev.js +0 -3
- package/src/index.dev.js.map +0 -7
- package/src/spectrum-swatch-group.css.dev.js +0 -10
- package/src/spectrum-swatch-group.css.dev.js.map +0 -7
- package/src/spectrum-swatch.css.dev.js +0 -66
- package/src/spectrum-swatch.css.dev.js.map +0 -7
- package/src/swatch-group.css.dev.js +0 -10
- package/src/swatch-group.css.dev.js.map +0 -7
- package/src/swatch.css.dev.js +0 -66
- package/src/swatch.css.dev.js.map +0 -7
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["spectrum-swatch.css.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 { 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%}\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;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"spectrum-swatch.css.js","sourceRoot":"","sources":["spectrum-swatch.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DjB,CAAC;AACF,eAAe,MAAM,CAAC","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%}\n`;\nexport default styles;"]}
|
package/src/swatch-group.css.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 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
|
+
*/
|
|
12
|
+
import { css } from '@spectrum-web-components/base';
|
|
13
|
+
const styles = css `
|
|
3
14
|
: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(
|
|
4
15
|
--spectrum-global-dimension-size-25
|
|
5
16
|
)}:host([density=spacious]){gap:var(
|
|
@@ -7,4 +18,4 @@ const styles = css`
|
|
|
7
18
|
)}
|
|
8
19
|
`;
|
|
9
20
|
export default styles;
|
|
10
|
-
//# sourceMappingURL=swatch-group.css.js.map
|
|
21
|
+
//# sourceMappingURL=swatch-group.css.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["swatch-group.css.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 { 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;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"swatch-group.css.js","sourceRoot":"","sources":["swatch-group.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;CAMjB,CAAC;AACF,eAAe,MAAM,CAAC","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;"]}
|
package/src/swatch.css.js
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 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
|
+
*/
|
|
12
|
+
import { css } from '@spectrum-web-components/base';
|
|
13
|
+
const styles = css `
|
|
3
14
|
:host{--spectrum-swatch-size-xs:var(
|
|
4
15
|
--spectrum-global-dimension-size-200
|
|
5
16
|
);--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(
|
|
@@ -63,4 +74,4 @@ const styles = css`
|
|
|
63
74
|
)}: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%}
|
|
64
75
|
`;
|
|
65
76
|
export default styles;
|
|
66
|
-
//# sourceMappingURL=swatch.css.js.map
|
|
77
|
+
//# sourceMappingURL=swatch.css.js.map
|
package/src/swatch.css.js.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["swatch.css.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 { 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%}\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;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"swatch.css.js","sourceRoot":"","sources":["swatch.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DjB,CAAC;AACF,eAAe,MAAM,CAAC","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%}\n`;\nexport default styles;"]}
|
|
@@ -1,125 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 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
|
+
*/
|
|
12
|
+
import { html } from '@spectrum-web-components/base';
|
|
13
|
+
import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
|
|
14
|
+
import '../sp-swatch-group.js';
|
|
15
|
+
import '../sp-swatch.js';
|
|
5
16
|
export default {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
title: 'Swatch group',
|
|
18
|
+
component: 'sp-swatch-group',
|
|
19
|
+
args: {},
|
|
20
|
+
argTypes: {
|
|
21
|
+
border: {
|
|
22
|
+
name: 'border',
|
|
23
|
+
type: { name: 'string', required: false },
|
|
24
|
+
description: 'The border to apply to the Swatch children.',
|
|
25
|
+
table: {
|
|
26
|
+
defaultValue: { summary: '' },
|
|
27
|
+
},
|
|
28
|
+
control: {
|
|
29
|
+
type: 'inline-radio',
|
|
30
|
+
options: ['normal', 'light', 'none'],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
density: {
|
|
34
|
+
name: 'density',
|
|
35
|
+
type: { name: 'string', required: false },
|
|
36
|
+
description: 'The density at which to display the Swatch children.',
|
|
37
|
+
table: {
|
|
38
|
+
defaultValue: { summary: '' },
|
|
39
|
+
},
|
|
40
|
+
control: {
|
|
41
|
+
type: 'inline-radio',
|
|
42
|
+
options: ['normal', 'compact', 'spacious'],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
rounding: {
|
|
46
|
+
name: 'rounding',
|
|
47
|
+
type: { name: 'string', required: false },
|
|
48
|
+
description: 'The rounding to apply to the Swatch children.',
|
|
49
|
+
table: {
|
|
50
|
+
defaultValue: { summary: '' },
|
|
51
|
+
},
|
|
52
|
+
control: {
|
|
53
|
+
type: 'inline-radio',
|
|
54
|
+
options: ['normal', 'none', 'full'],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
selects: {
|
|
58
|
+
name: 'selects',
|
|
59
|
+
type: { name: 'string', required: false },
|
|
60
|
+
description: 'Whether the Swatch Group manages a selection, and whether it is a sinlge or multiple selection.',
|
|
61
|
+
table: {
|
|
62
|
+
defaultValue: { summary: '' },
|
|
63
|
+
},
|
|
64
|
+
control: {
|
|
65
|
+
type: 'inline-radio',
|
|
66
|
+
options: ['none', 'single', 'multiple'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
shape: {
|
|
70
|
+
name: 'shape',
|
|
71
|
+
type: { name: 'string', required: false },
|
|
72
|
+
description: 'The shape to apply to the Swatch children.',
|
|
73
|
+
table: {
|
|
74
|
+
defaultValue: { summary: '' },
|
|
75
|
+
},
|
|
76
|
+
control: {
|
|
77
|
+
type: 'inline-radio',
|
|
78
|
+
options: ['normal', 'rectangle'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
21
81
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type: { name: "string", required: false },
|
|
25
|
-
description: "The density at which to display the Swatch children.",
|
|
26
|
-
table: {
|
|
27
|
-
defaultValue: { summary: "" }
|
|
28
|
-
},
|
|
29
|
-
control: {
|
|
30
|
-
type: "inline-radio",
|
|
31
|
-
options: ["normal", "compact", "spacious"]
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
rounding: {
|
|
35
|
-
name: "rounding",
|
|
36
|
-
type: { name: "string", required: false },
|
|
37
|
-
description: "The rounding to apply to the Swatch children.",
|
|
38
|
-
table: {
|
|
39
|
-
defaultValue: { summary: "" }
|
|
40
|
-
},
|
|
41
|
-
control: {
|
|
42
|
-
type: "inline-radio",
|
|
43
|
-
options: ["normal", "none", "full"]
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
selects: {
|
|
47
|
-
name: "selects",
|
|
48
|
-
type: { name: "string", required: false },
|
|
49
|
-
description: "Whether the Swatch Group manages a selection, and whether it is a sinlge or multiple selection.",
|
|
50
|
-
table: {
|
|
51
|
-
defaultValue: { summary: "" }
|
|
52
|
-
},
|
|
53
|
-
control: {
|
|
54
|
-
type: "inline-radio",
|
|
55
|
-
options: ["none", "single", "multiple"]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
shape: {
|
|
59
|
-
name: "shape",
|
|
60
|
-
type: { name: "string", required: false },
|
|
61
|
-
description: "The shape to apply to the Swatch children.",
|
|
62
|
-
table: {
|
|
63
|
-
defaultValue: { summary: "" }
|
|
64
|
-
},
|
|
65
|
-
control: {
|
|
66
|
-
type: "inline-radio",
|
|
67
|
-
options: ["normal", "rectangle"]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
decorators: [
|
|
72
|
-
(story) => html`
|
|
82
|
+
decorators: [
|
|
83
|
+
(story) => html `
|
|
73
84
|
<div
|
|
74
85
|
@change=${async (event) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
await 0;
|
|
87
|
+
if (event.defaultPrevented)
|
|
88
|
+
return;
|
|
89
|
+
const next = event.target
|
|
90
|
+
.nextElementSibling;
|
|
91
|
+
next.textContent = `Selected: ${JSON.stringify(event.target.selected)}`;
|
|
92
|
+
}}
|
|
81
93
|
>
|
|
82
94
|
${story()}
|
|
83
95
|
<div>Selected: []</div>
|
|
84
96
|
</div>
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
`,
|
|
98
|
+
],
|
|
87
99
|
};
|
|
88
100
|
const colors = [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
'--spectrum-global-color-gray-500',
|
|
102
|
+
'--spectrum-global-color-red-500',
|
|
103
|
+
'--spectrum-global-color-orange-500',
|
|
104
|
+
'--spectrum-global-color-yellow-500',
|
|
105
|
+
'--spectrum-global-color-chartreuse-500',
|
|
106
|
+
'--spectrum-global-color-celery-500',
|
|
107
|
+
'--spectrum-global-color-green-500',
|
|
108
|
+
'--spectrum-global-color-seafoam-500',
|
|
109
|
+
'--spectrum-global-color-blue-500',
|
|
110
|
+
'--spectrum-global-color-indigo-500',
|
|
111
|
+
'--spectrum-global-color-purple-500',
|
|
112
|
+
'--spectrum-global-color-fuchsia-500',
|
|
113
|
+
'--spectrum-global-color-magenta-500',
|
|
102
114
|
];
|
|
103
|
-
const template = ({
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}) => {
|
|
111
|
-
const groupLabel = !!selects ? selects === "single" ? "Select a color" : "Selects color(s)" : void 0;
|
|
112
|
-
return html`
|
|
115
|
+
const template = ({ border, density, rounding, selects, selected = [], shape, }) => {
|
|
116
|
+
const groupLabel = !!selects
|
|
117
|
+
? selects === 'single'
|
|
118
|
+
? 'Select a color'
|
|
119
|
+
: 'Selects color(s)'
|
|
120
|
+
: undefined;
|
|
121
|
+
return html `
|
|
113
122
|
<sp-swatch-group
|
|
114
|
-
border=${ifDefined(border ===
|
|
115
|
-
density=${ifDefined(density ===
|
|
116
|
-
rounding=${ifDefined(rounding ===
|
|
117
|
-
selects=${ifDefined(selects ===
|
|
123
|
+
border=${ifDefined(border === 'normal' ? undefined : border)}
|
|
124
|
+
density=${ifDefined(density === 'normal' ? undefined : density)}
|
|
125
|
+
rounding=${ifDefined(rounding === 'normal' ? undefined : rounding)}
|
|
126
|
+
selects=${ifDefined(selects === 'none' ? undefined : selects)}
|
|
118
127
|
.selected=${selected}
|
|
119
|
-
shape=${ifDefined(shape ===
|
|
128
|
+
shape=${ifDefined(shape === 'normal' ? undefined : shape)}
|
|
120
129
|
aria-label=${ifDefined(groupLabel)}
|
|
121
130
|
>
|
|
122
|
-
${colors.map((color) => html`
|
|
131
|
+
${colors.map((color) => html `
|
|
123
132
|
<sp-swatch
|
|
124
133
|
color="var(${color})"
|
|
125
134
|
label=${color}
|
|
@@ -133,45 +142,45 @@ export const Default = (args) => template(args);
|
|
|
133
142
|
Default.args = {};
|
|
134
143
|
export const densityCompact = (args) => template(args);
|
|
135
144
|
densityCompact.args = {
|
|
136
|
-
|
|
145
|
+
density: 'compact',
|
|
137
146
|
};
|
|
138
147
|
export const densitySpacious = (args) => template(args);
|
|
139
148
|
densitySpacious.args = {
|
|
140
|
-
|
|
149
|
+
density: 'spacious',
|
|
141
150
|
};
|
|
142
151
|
export const selectsSingle = (args) => template(args);
|
|
143
152
|
selectsSingle.args = {
|
|
144
|
-
|
|
145
|
-
|
|
153
|
+
selects: 'single',
|
|
154
|
+
selected: ['--spectrum-global-color-yellow-500'],
|
|
146
155
|
};
|
|
147
156
|
export const selectsMultiple = (args) => template(args);
|
|
148
157
|
selectsMultiple.args = {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
selects: 'multiple',
|
|
159
|
+
selected: [
|
|
160
|
+
'--spectrum-global-color-celery-500',
|
|
161
|
+
'--spectrum-global-color-red-500',
|
|
162
|
+
'--spectrum-global-color-purple-500',
|
|
163
|
+
'--spectrum-global-color-blue-500',
|
|
164
|
+
],
|
|
156
165
|
};
|
|
157
166
|
export const borderLight = (args) => template(args);
|
|
158
167
|
borderLight.args = {
|
|
159
|
-
|
|
168
|
+
border: 'light',
|
|
160
169
|
};
|
|
161
170
|
export const borderNone = (args) => template(args);
|
|
162
171
|
borderNone.args = {
|
|
163
|
-
|
|
172
|
+
border: 'none',
|
|
164
173
|
};
|
|
165
174
|
export const roundingNone = (args) => template(args);
|
|
166
175
|
roundingNone.args = {
|
|
167
|
-
|
|
176
|
+
rounding: 'none',
|
|
168
177
|
};
|
|
169
178
|
export const roundingFull = (args) => template(args);
|
|
170
179
|
roundingFull.args = {
|
|
171
|
-
|
|
180
|
+
rounding: 'full',
|
|
172
181
|
};
|
|
173
182
|
export const shapeRectangle = (args) => template(args);
|
|
174
183
|
shapeRectangle.args = {
|
|
175
|
-
|
|
184
|
+
shape: 'rectangle',
|
|
176
185
|
};
|
|
177
|
-
//# sourceMappingURL=swatch-group.stories.js.map
|
|
186
|
+
//# sourceMappingURL=swatch-group.stories.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["swatch-group.stories.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '../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;AACA;AAEA;AACA;AAiBA,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM,CAAC;AAAA,EACP,UAAU;AAAA,IACN,QAAQ;AAAA,MACJ,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,MACxC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,cAAc,EAAE,SAAS,GAAG;AAAA,MAChC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,QACN,SAAS,CAAC,UAAU,SAAS,MAAM;AAAA,MACvC;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,MACL,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,MACxC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,cAAc,EAAE,SAAS,GAAG;AAAA,MAChC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,QACN,SAAS,CAAC,UAAU,WAAW,UAAU;AAAA,MAC7C;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,MACN,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,MACxC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,cAAc,EAAE,SAAS,GAAG;AAAA,MAChC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,QACN,SA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/E,UAAU,CAAC,IAAI,GAAG;IACd,MAAM,EAAE,MAAM;CACH,CAAC;AAChB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnB,YAAY,CAAC,IAAI,GAAG;IAChB,QAAQ,EAAE,MAAM;CACL,CAAC;AAChB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAC7D,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnB,YAAY,CAAC,IAAI,GAAG;IAChB,QAAQ,EAAE,MAAM;CACL,CAAC;AAChB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAC/D,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnB,cAAc,CAAC,IAAI,GAAG;IAClB,KAAK,EAAE,WAAW;CACP,CAAC","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"]}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 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
|
+
*/
|
|
12
|
+
import { html, } from '@spectrum-web-components/base';
|
|
13
|
+
import '../sp-swatch.js';
|
|
5
14
|
export default {
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
title: 'Swatch/Sizes',
|
|
16
|
+
component: 'sp-swatch',
|
|
8
17
|
};
|
|
9
|
-
const template = ({
|
|
10
|
-
size,
|
|
11
|
-
color = "rgb(255 0 0 / 0.7)"
|
|
12
|
-
}) => html`
|
|
18
|
+
const template = ({ size, color = 'rgb(255 0 0 / 0.7)', }) => html `
|
|
13
19
|
<div style="display: flex; gap: 5px;">
|
|
14
20
|
<sp-swatch color=${color} size=${size}></sp-swatch>
|
|
15
21
|
<sp-swatch color=${color} rounding="none" size=${size}></sp-swatch>
|
|
@@ -32,8 +38,8 @@ const template = ({
|
|
|
32
38
|
></sp-swatch>
|
|
33
39
|
</div>
|
|
34
40
|
`;
|
|
35
|
-
export const XS = () => template({ size:
|
|
36
|
-
export const s = () => template({ size:
|
|
37
|
-
export const m = () => template({ size:
|
|
38
|
-
export const l = () => template({ size:
|
|
39
|
-
//# sourceMappingURL=swatch-sizes.stories.js.map
|
|
41
|
+
export const XS = () => template({ size: 'xs' });
|
|
42
|
+
export const s = () => template({ size: 's' });
|
|
43
|
+
export const m = () => template({ size: 'm' });
|
|
44
|
+
export const l = () => template({ size: 'l' });
|
|
45
|
+
//# sourceMappingURL=swatch-sizes.stories.js.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["swatch-sizes.stories.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport {\n ElementSize,\n html,\n TemplateResult,\n} from '@spectrum-web-components/base';\n\nimport '../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;AAAA;AAAA;AAMA;AAEA,eAAe;AAAA,EACX,OAAO;AAAA,EACP,WAAW;AACf;AAEA,MAAM,WAAW,CAAC;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,MAIU;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
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"swatch-sizes.stories.js","sourceRoot":"","sources":["swatch-sizes.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAEH,IAAI,GAEP,MAAM,+BAA+B,CAAC;AAEvC,OAAO,iBAAiB,CAAC;AAEzB,eAAe;IACX,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE,WAAW;CACzB,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,EACd,IAAI,EACJ,KAAK,GAAG,oBAAoB,GAI/B,EAAkB,EAAE,CAAC,IAAI,CAAA;;2BAEC,KAAK,SAAS,IAAI;2BAClB,KAAK,yBAAyB,IAAI;2BAClC,KAAK,yBAAyB,IAAI;2BAClC,KAAK,wBAAwB,IAAI;2BACjC,KAAK,uBAAuB,IAAI;kCACzB,IAAI;2BACX,KAAK,2BAA2B,IAAI;;oBAE3C,KAAK;;mBAEN,IAAI;;;;;;mBAMJ,IAAI;;;;CAItB,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,GAAmB,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAE/D,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC","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"]}
|