@spectrum-web-components/swatch 0.1.2 → 0.1.4-devmode.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/custom-elements.json +6 -6
  2. package/package.json +37 -16
  3. package/sp-swatch-group.dev.js +3 -0
  4. package/sp-swatch-group.dev.js.map +7 -0
  5. package/sp-swatch-group.js +3 -14
  6. package/sp-swatch-group.js.map +7 -1
  7. package/sp-swatch.dev.js +3 -0
  8. package/sp-swatch.dev.js.map +7 -0
  9. package/sp-swatch.js +3 -14
  10. package/sp-swatch.js.map +7 -1
  11. package/src/Swatch.dev.js +219 -0
  12. package/src/Swatch.dev.js.map +7 -0
  13. package/src/Swatch.js +165 -170
  14. package/src/Swatch.js.map +7 -1
  15. package/src/SwatchGroup.dev.js +220 -0
  16. package/src/SwatchGroup.dev.js.map +7 -0
  17. package/src/SwatchGroup.js +201 -216
  18. package/src/SwatchGroup.js.map +7 -1
  19. package/src/index.dev.js +3 -0
  20. package/src/index.dev.js.map +7 -0
  21. package/src/index.js +3 -14
  22. package/src/index.js.map +7 -1
  23. package/src/spectrum-swatch-group.css.dev.js +10 -0
  24. package/src/spectrum-swatch-group.css.dev.js.map +7 -0
  25. package/src/spectrum-swatch-group.css.js +3 -14
  26. package/src/spectrum-swatch-group.css.js.map +7 -1
  27. package/src/spectrum-swatch.css.dev.js +66 -0
  28. package/src/spectrum-swatch.css.dev.js.map +7 -0
  29. package/src/spectrum-swatch.css.js +4 -15
  30. package/src/spectrum-swatch.css.js.map +7 -1
  31. package/src/swatch-group.css.dev.js +10 -0
  32. package/src/swatch-group.css.dev.js.map +7 -0
  33. package/src/swatch-group.css.js +3 -14
  34. package/src/swatch-group.css.js.map +7 -1
  35. package/src/swatch.css.dev.js +66 -0
  36. package/src/swatch.css.dev.js.map +7 -0
  37. package/src/swatch.css.js +4 -15
  38. package/src/swatch.css.js.map +7 -1
  39. package/stories/swatch-group.stories.js +124 -133
  40. package/stories/swatch-group.stories.js.map +7 -1
  41. package/stories/swatch-sizes.stories.js +15 -21
  42. package/stories/swatch-sizes.stories.js.map +7 -1
  43. package/stories/swatch.stories.js +69 -73
  44. package/stories/swatch.stories.js.map +7 -1
  45. package/test/benchmark/basic-test.js +5 -16
  46. package/test/benchmark/basic-test.js.map +7 -1
  47. package/test/swatch-group.test-vrt.js +4 -15
  48. package/test/swatch-group.test-vrt.js.map +7 -1
  49. package/test/swatch-group.test.js +231 -240
  50. package/test/swatch-group.test.js.map +7 -1
  51. package/test/swatch-sizes.test-vrt.js +4 -15
  52. package/test/swatch-sizes.test-vrt.js.map +7 -1
  53. package/test/swatch.test-vrt.js +4 -15
  54. package/test/swatch.test-vrt.js.map +7 -1
  55. package/test/swatch.test.js +128 -135
  56. package/test/swatch.test.js.map +7 -1
@@ -1,134 +1,125 @@
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';
1
+ import { html } from "@spectrum-web-components/base";
2
+ import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
3
+ import "../sp-swatch-group.js";
4
+ import "../sp-swatch.js";
16
5
  export default {
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
- },
6
+ title: "Swatch group",
7
+ component: "sp-swatch-group",
8
+ args: {},
9
+ argTypes: {
10
+ border: {
11
+ name: "border",
12
+ type: { name: "string", required: false },
13
+ description: "The border to apply to the Swatch children.",
14
+ table: {
15
+ defaultValue: { summary: "" }
16
+ },
17
+ control: {
18
+ type: "inline-radio",
19
+ options: ["normal", "light", "none"]
20
+ }
81
21
  },
82
- decorators: [
83
- (story) => html `
22
+ density: {
23
+ name: "density",
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`
84
73
  <div
85
74
  @change=${async (event) => {
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
- }}
75
+ await 0;
76
+ if (event.defaultPrevented)
77
+ return;
78
+ const next = event.target.nextElementSibling;
79
+ next.textContent = `Selected: ${JSON.stringify(event.target.selected)}`;
80
+ }}
93
81
  >
94
82
  ${story()}
95
83
  <div>Selected: []</div>
96
84
  </div>
97
- `,
98
- ],
85
+ `
86
+ ]
99
87
  };
100
88
  const colors = [
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',
89
+ "--spectrum-global-color-gray-500",
90
+ "--spectrum-global-color-red-500",
91
+ "--spectrum-global-color-orange-500",
92
+ "--spectrum-global-color-yellow-500",
93
+ "--spectrum-global-color-chartreuse-500",
94
+ "--spectrum-global-color-celery-500",
95
+ "--spectrum-global-color-green-500",
96
+ "--spectrum-global-color-seafoam-500",
97
+ "--spectrum-global-color-blue-500",
98
+ "--spectrum-global-color-indigo-500",
99
+ "--spectrum-global-color-purple-500",
100
+ "--spectrum-global-color-fuchsia-500",
101
+ "--spectrum-global-color-magenta-500"
114
102
  ];
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 `
103
+ const template = ({
104
+ border,
105
+ density,
106
+ rounding,
107
+ selects,
108
+ selected = [],
109
+ shape
110
+ }) => {
111
+ const groupLabel = !!selects ? selects === "single" ? "Select a color" : "Selects color(s)" : void 0;
112
+ return html`
122
113
  <sp-swatch-group
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)}
114
+ border=${ifDefined(border === "normal" ? void 0 : border)}
115
+ density=${ifDefined(density === "normal" ? void 0 : density)}
116
+ rounding=${ifDefined(rounding === "normal" ? void 0 : rounding)}
117
+ selects=${ifDefined(selects === "none" ? void 0 : selects)}
127
118
  .selected=${selected}
128
- shape=${ifDefined(shape === 'normal' ? undefined : shape)}
119
+ shape=${ifDefined(shape === "normal" ? void 0 : shape)}
129
120
  aria-label=${ifDefined(groupLabel)}
130
121
  >
131
- ${colors.map((color) => html `
122
+ ${colors.map((color) => html`
132
123
  <sp-swatch
133
124
  color="var(${color})"
134
125
  label=${color}
@@ -142,45 +133,45 @@ export const Default = (args) => template(args);
142
133
  Default.args = {};
143
134
  export const densityCompact = (args) => template(args);
144
135
  densityCompact.args = {
145
- density: 'compact',
136
+ density: "compact"
146
137
  };
147
138
  export const densitySpacious = (args) => template(args);
148
139
  densitySpacious.args = {
149
- density: 'spacious',
140
+ density: "spacious"
150
141
  };
151
142
  export const selectsSingle = (args) => template(args);
152
143
  selectsSingle.args = {
153
- selects: 'single',
154
- selected: ['--spectrum-global-color-yellow-500'],
144
+ selects: "single",
145
+ selected: ["--spectrum-global-color-yellow-500"]
155
146
  };
156
147
  export const selectsMultiple = (args) => template(args);
157
148
  selectsMultiple.args = {
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
- ],
149
+ selects: "multiple",
150
+ selected: [
151
+ "--spectrum-global-color-celery-500",
152
+ "--spectrum-global-color-red-500",
153
+ "--spectrum-global-color-purple-500",
154
+ "--spectrum-global-color-blue-500"
155
+ ]
165
156
  };
166
157
  export const borderLight = (args) => template(args);
167
158
  borderLight.args = {
168
- border: 'light',
159
+ border: "light"
169
160
  };
170
161
  export const borderNone = (args) => template(args);
171
162
  borderNone.args = {
172
- border: 'none',
163
+ border: "none"
173
164
  };
174
165
  export const roundingNone = (args) => template(args);
175
166
  roundingNone.args = {
176
- rounding: 'none',
167
+ rounding: "none"
177
168
  };
178
169
  export const roundingFull = (args) => template(args);
179
170
  roundingFull.args = {
180
- rounding: 'full',
171
+ rounding: "full"
181
172
  };
182
173
  export const shapeRectangle = (args) => template(args);
183
174
  shapeRectangle.args = {
184
- shape: 'rectangle',
175
+ shape: "rectangle"
185
176
  };
186
- //# sourceMappingURL=swatch-group.stories.js.map
177
+ //# sourceMappingURL=swatch-group.stories.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"swatch-group.stories.js","sourceRoot":"","sources":["swatch-group.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,O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AC,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
+ {
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;AAA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AA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;AACO,aAAM,cAAc,CAAC,SAAqC,SAAS,IAAI;AAC9E,YAAY,OAAO;AAAA,EACf,QAAQ;AACZ;AACO,aAAM,aAAa,CAAC,SAAqC,SAAS,IAAI;AAC7E,WAAW,OAAO;AAAA,EACd,QAAQ;AACZ;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,eAAe,CAAC,SACzB,SAAS,IAAI;AACjB,aAAa,OAAO;AAAA,EAChB,UAAU;AACd;AACO,aAAM,iBAAiB,CAAC,SAC3B,SAAS,IAAI;AACjB,eAAe,OAAO;AAAA,EAClB,OAAO;AACX;",
6
+ "names": []
7
+ }
@@ -1,21 +1,15 @@
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';
1
+ import {
2
+ html
3
+ } from "@spectrum-web-components/base";
4
+ import "../sp-swatch.js";
14
5
  export default {
15
- title: 'Swatch/Sizes',
16
- component: 'sp-swatch',
6
+ title: "Swatch/Sizes",
7
+ component: "sp-swatch"
17
8
  };
18
- const template = ({ size, color = 'rgb(255 0 0 / 0.7)', }) => html `
9
+ const template = ({
10
+ size,
11
+ color = "rgb(255 0 0 / 0.7)"
12
+ }) => html`
19
13
  <div style="display: flex; gap: 5px;">
20
14
  <sp-swatch color=${color} size=${size}></sp-swatch>
21
15
  <sp-swatch color=${color} rounding="none" size=${size}></sp-swatch>
@@ -38,8 +32,8 @@ const template = ({ size, color = 'rgb(255 0 0 / 0.7)', }) => html `
38
32
  ></sp-swatch>
39
33
  </div>
40
34
  `;
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
35
+ export const XS = () => template({ size: "xs" });
36
+ export const s = () => template({ size: "s" });
37
+ export const m = () => template({ size: "m" });
38
+ export const l = () => template({ size: "l" });
39
+ //# sourceMappingURL=swatch-sizes.stories.js.map
@@ -1 +1,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"]}
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,104 +1,100 @@
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.js';
1
+ import { html } from "@spectrum-web-components/base";
2
+ import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
3
+ import "../sp-swatch.js";
15
4
  export default {
16
- title: 'Swatch',
17
- component: 'sp-swatch',
18
- args: {
19
- color: '#ff0000',
5
+ title: "Swatch",
6
+ component: "sp-swatch",
7
+ args: {
8
+ color: "#ff0000"
9
+ },
10
+ argTypes: {
11
+ color: { control: "color" },
12
+ border: {
13
+ name: "border",
14
+ type: { name: "string", required: false },
15
+ description: "The border to apply to the Swatch children.",
16
+ table: {
17
+ defaultValue: { summary: "" }
18
+ },
19
+ control: {
20
+ type: "inline-radio",
21
+ options: ["normal", "light", "none"]
22
+ }
20
23
  },
21
- argTypes: {
22
- color: { control: 'color' },
23
- border: {
24
- name: 'border',
25
- type: { name: 'string', required: false },
26
- description: 'The border to apply to the Swatch children.',
27
- table: {
28
- defaultValue: { summary: '' },
29
- },
30
- control: {
31
- type: 'inline-radio',
32
- options: ['normal', 'light', 'none'],
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
- shape: {
48
- name: 'shape',
49
- type: { name: 'string', required: false },
50
- description: 'The shape to apply to the Swatch children.',
51
- table: {
52
- defaultValue: { summary: '' },
53
- },
54
- control: {
55
- type: 'inline-radio',
56
- options: ['normal', 'rectangle'],
57
- },
58
- },
24
+ rounding: {
25
+ name: "rounding",
26
+ type: { name: "string", required: false },
27
+ description: "The rounding to apply to the Swatch children.",
28
+ table: {
29
+ defaultValue: { summary: "" }
30
+ },
31
+ control: {
32
+ type: "inline-radio",
33
+ options: ["normal", "none", "full"]
34
+ }
59
35
  },
36
+ shape: {
37
+ name: "shape",
38
+ type: { name: "string", required: false },
39
+ description: "The shape to apply to the Swatch children.",
40
+ table: {
41
+ defaultValue: { summary: "" }
42
+ },
43
+ control: {
44
+ type: "inline-radio",
45
+ options: ["normal", "rectangle"]
46
+ }
47
+ }
48
+ }
60
49
  };
61
- const template = ({ color, border, rounding, shape, mixedValue, nothing, }) => {
62
- return html `
50
+ const template = ({
51
+ color,
52
+ border,
53
+ rounding,
54
+ shape,
55
+ mixedValue: mixedValue2,
56
+ nothing: nothing2
57
+ }) => {
58
+ return html`
63
59
  <sp-swatch
64
- border=${ifDefined(border === 'normal' ? undefined : border)}
65
- rounding=${ifDefined(rounding === 'normal' ? undefined : rounding)}
66
- shape=${ifDefined(shape === 'normal' ? undefined : shape)}
60
+ border=${ifDefined(border === "normal" ? void 0 : border)}
61
+ rounding=${ifDefined(rounding === "normal" ? void 0 : rounding)}
62
+ shape=${ifDefined(shape === "normal" ? void 0 : shape)}
67
63
  color=${color}
68
- ?mixed-value=${mixedValue}
69
- ?nothing=${nothing}
64
+ ?mixed-value=${mixedValue2}
65
+ ?nothing=${nothing2}
70
66
  ></sp-swatch>
71
67
  `;
72
68
  };
73
69
  export const Default = (args) => template(args);
74
70
  export const mixedValue = (args) => template(args);
75
71
  mixedValue.args = {
76
- mixedValue: true,
77
- color: '',
72
+ mixedValue: true,
73
+ color: ""
78
74
  };
79
75
  export const nothing = (args) => template(args);
80
76
  nothing.args = {
81
- nothing: true,
82
- color: '',
77
+ nothing: true,
78
+ color: ""
83
79
  };
84
80
  export const borderLight = (args) => template(args);
85
81
  borderLight.args = {
86
- border: 'light',
82
+ border: "light"
87
83
  };
88
84
  export const borderNone = (args) => template(args);
89
85
  borderNone.args = {
90
- border: 'none',
86
+ border: "none"
91
87
  };
92
88
  export const roundingNone = (args) => template(args);
93
89
  roundingNone.args = {
94
- rounding: 'none',
90
+ rounding: "none"
95
91
  };
96
92
  export const roundingFull = (args) => template(args);
97
93
  roundingFull.args = {
98
- rounding: 'full',
94
+ rounding: "full"
99
95
  };
100
96
  export const shapeRectangle = (args) => template(args);
101
97
  shapeRectangle.args = {
102
- shape: 'rectangle',
98
+ shape: "rectangle"
103
99
  };
104
- //# sourceMappingURL=swatch.stories.js.map
100
+ //# sourceMappingURL=swatch.stories.js.map