@spectrum-web-components/swatch 0.0.0-20241209155954
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -0
- package/package.json +89 -0
- package/sp-swatch-group.d.ts +6 -0
- package/sp-swatch-group.dev.js +5 -0
- package/sp-swatch-group.dev.js.map +7 -0
- package/sp-swatch-group.js +2 -0
- package/sp-swatch-group.js.map +7 -0
- package/sp-swatch.d.ts +6 -0
- package/sp-swatch.dev.js +5 -0
- package/sp-swatch.dev.js.map +7 -0
- package/sp-swatch.js +2 -0
- package/sp-swatch.js.map +7 -0
- package/src/Swatch.d.ts +43 -0
- package/src/Swatch.dev.js +243 -0
- package/src/Swatch.dev.js.map +7 -0
- package/src/Swatch.js +48 -0
- package/src/Swatch.js.map +7 -0
- package/src/SwatchGroup.d.ts +39 -0
- package/src/SwatchGroup.dev.js +268 -0
- package/src/SwatchGroup.dev.js.map +7 -0
- package/src/SwatchGroup.js +7 -0
- package/src/SwatchGroup.js.map +7 -0
- package/src/index.d.ts +2 -0
- package/src/index.dev.js +4 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/spectrum-config.js +123 -0
- package/src/spectrum-swatch-group.css.d.ts +2 -0
- package/src/spectrum-swatch-group.css.dev.js +7 -0
- package/src/spectrum-swatch-group.css.dev.js.map +7 -0
- package/src/spectrum-swatch-group.css.js +4 -0
- package/src/spectrum-swatch-group.css.js.map +7 -0
- package/src/spectrum-swatch.css.d.ts +2 -0
- package/src/spectrum-swatch.css.dev.js +7 -0
- package/src/spectrum-swatch.css.dev.js.map +7 -0
- package/src/spectrum-swatch.css.js +4 -0
- package/src/spectrum-swatch.css.js.map +7 -0
- package/src/swatch-group-overrides.css.d.ts +2 -0
- package/src/swatch-group-overrides.css.dev.js +7 -0
- package/src/swatch-group-overrides.css.dev.js.map +7 -0
- package/src/swatch-group-overrides.css.js +4 -0
- package/src/swatch-group-overrides.css.js.map +7 -0
- package/src/swatch-group.css.d.ts +2 -0
- package/src/swatch-group.css.dev.js +7 -0
- package/src/swatch-group.css.dev.js.map +7 -0
- package/src/swatch-group.css.js +4 -0
- package/src/swatch-group.css.js.map +7 -0
- package/src/swatch-overrides.css.d.ts +2 -0
- package/src/swatch-overrides.css.dev.js +7 -0
- package/src/swatch-overrides.css.dev.js.map +7 -0
- package/src/swatch-overrides.css.js +4 -0
- package/src/swatch-overrides.css.js.map +7 -0
- package/src/swatch.css.d.ts +2 -0
- package/src/swatch.css.dev.js +7 -0
- package/src/swatch.css.dev.js.map +7 -0
- package/src/swatch.css.js +4 -0
- package/src/swatch.css.js.map +7 -0
package/README.md
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
An `<sp-swatch>` shows a small sample of a fill — such as a color, gradient, texture, or material — that is intended to be applied to an object.
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@spectrum-web-components/swatch)
|
|
8
|
+
[](https://bundlephobia.com/result?p=@spectrum-web-components/swatch)
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
yarn add @spectrum-web-components/swatch
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Import the side effectful registration of `<sp-swatch>` via:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
import '@spectrum-web-components/swatch/sp-swatch.js';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
When looking to leverage the `Swatch` base class as a type and/or for extension purposes, do so via:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
import { Swatch } from '@spectrum-web-components/swatch';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Sizes
|
|
27
|
+
|
|
28
|
+
<sp-tabs selected="m" auto label="Size Attribute Options">
|
|
29
|
+
<sp-tab value="xs">Extra Small</sp-tab>
|
|
30
|
+
<sp-tab-panel value="xs">
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<div style="display: flex;gap: 5px;">
|
|
34
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" size="xs"></sp-swatch>
|
|
35
|
+
<sp-swatch rounding="none" color="rgb(255 0 0 / 0.7)" size="xs"></sp-swatch>
|
|
36
|
+
<sp-swatch rounding="full" color="rgb(255 0 0 / 0.7)" size="xs"></sp-swatch>
|
|
37
|
+
<sp-swatch border="light" color="rgb(255 0 0 / 0.7)" size="xs"></sp-swatch>
|
|
38
|
+
<sp-swatch border="none" color="rgb(255 0 0 / 0.7)" size="xs"></sp-swatch>
|
|
39
|
+
<sp-swatch nothing size="xs"></sp-swatch>
|
|
40
|
+
<sp-swatch
|
|
41
|
+
shape="rectangle"
|
|
42
|
+
color="rgb(255 0 0 / 0.7)"
|
|
43
|
+
size="xs"
|
|
44
|
+
></sp-swatch>
|
|
45
|
+
<sp-swatch
|
|
46
|
+
shape="rectangle"
|
|
47
|
+
disabled
|
|
48
|
+
color="rgb(255 0 0 / 0.7)"
|
|
49
|
+
size="xs"
|
|
50
|
+
></sp-swatch>
|
|
51
|
+
<sp-swatch
|
|
52
|
+
rounding="full"
|
|
53
|
+
shape="rectangle"
|
|
54
|
+
mixed-value
|
|
55
|
+
size="xs"
|
|
56
|
+
></sp-swatch>
|
|
57
|
+
</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
</sp-tab-panel>
|
|
61
|
+
<sp-tab value="s">Small</sp-tab>
|
|
62
|
+
<sp-tab-panel value="s">
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<div style="display: flex;gap: 5px;">
|
|
66
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" size="s"></sp-swatch>
|
|
67
|
+
<sp-swatch rounding="none" color="rgb(255 0 0 / 0.7)" size="s"></sp-swatch>
|
|
68
|
+
<sp-swatch rounding="full" color="rgb(255 0 0 / 0.7)" size="s"></sp-swatch>
|
|
69
|
+
<sp-swatch border="light" color="rgb(255 0 0 / 0.7)" size="s"></sp-swatch>
|
|
70
|
+
<sp-swatch border="none" color="rgb(255 0 0 / 0.7)" size="s"></sp-swatch>
|
|
71
|
+
<sp-swatch nothing size="s"></sp-swatch>
|
|
72
|
+
<sp-swatch
|
|
73
|
+
shape="rectangle"
|
|
74
|
+
color="rgb(255 0 0 / 0.7)"
|
|
75
|
+
size="s"
|
|
76
|
+
></sp-swatch>
|
|
77
|
+
<sp-swatch
|
|
78
|
+
shape="rectangle"
|
|
79
|
+
disabled
|
|
80
|
+
color="rgb(255 0 0 / 0.7)"
|
|
81
|
+
size="s"
|
|
82
|
+
></sp-swatch>
|
|
83
|
+
<sp-swatch
|
|
84
|
+
rounding="full"
|
|
85
|
+
shape="rectangle"
|
|
86
|
+
mixed-value
|
|
87
|
+
size="s"
|
|
88
|
+
></sp-swatch>
|
|
89
|
+
</div>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
</sp-tab-panel>
|
|
93
|
+
<sp-tab value="m">Medium</sp-tab>
|
|
94
|
+
<sp-tab-panel value="m">
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<div style="display: flex;gap: 5px;">
|
|
98
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" size="m"></sp-swatch>
|
|
99
|
+
<sp-swatch rounding="none" color="rgb(255 0 0 / 0.7)" size="m"></sp-swatch>
|
|
100
|
+
<sp-swatch rounding="full" color="rgb(255 0 0 / 0.7)" size="m"></sp-swatch>
|
|
101
|
+
<sp-swatch border="light" color="rgb(255 0 0 / 0.7)" size="m"></sp-swatch>
|
|
102
|
+
<sp-swatch border="none" color="rgb(255 0 0 / 0.7)" size="m"></sp-swatch>
|
|
103
|
+
<sp-swatch nothing size="m"></sp-swatch>
|
|
104
|
+
<sp-swatch
|
|
105
|
+
shape="rectangle"
|
|
106
|
+
color="rgb(255 0 0 / 0.7)"
|
|
107
|
+
size="m"
|
|
108
|
+
></sp-swatch>
|
|
109
|
+
<sp-swatch
|
|
110
|
+
shape="rectangle"
|
|
111
|
+
disabled
|
|
112
|
+
color="rgb(255 0 0 / 0.7)"
|
|
113
|
+
size="m"
|
|
114
|
+
></sp-swatch>
|
|
115
|
+
<sp-swatch
|
|
116
|
+
rounding="full"
|
|
117
|
+
shape="rectangle"
|
|
118
|
+
mixed-value
|
|
119
|
+
size="m"
|
|
120
|
+
></sp-swatch>
|
|
121
|
+
</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
</sp-tab-panel>
|
|
125
|
+
<sp-tab value="l">Large</sp-tab>
|
|
126
|
+
<sp-tab-panel value="l">
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<div style="display: flex;gap: 5px;">
|
|
130
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" size="l"></sp-swatch>
|
|
131
|
+
<sp-swatch rounding="none" color="rgb(255 0 0 / 0.7)" size="l"></sp-swatch>
|
|
132
|
+
<sp-swatch rounding="full" color="rgb(255 0 0 / 0.7)" size="l"></sp-swatch>
|
|
133
|
+
<sp-swatch border="light" color="rgb(255 0 0 / 0.7)" size="l"></sp-swatch>
|
|
134
|
+
<sp-swatch border="none" color="rgb(255 0 0 / 0.7)" size="l"></sp-swatch>
|
|
135
|
+
<sp-swatch nothing size="l"></sp-swatch>
|
|
136
|
+
<sp-swatch
|
|
137
|
+
shape="rectangle"
|
|
138
|
+
color="rgb(255 0 0 / 0.7)"
|
|
139
|
+
size="l"
|
|
140
|
+
></sp-swatch>
|
|
141
|
+
<sp-swatch
|
|
142
|
+
shape="rectangle"
|
|
143
|
+
disabled
|
|
144
|
+
color="rgb(255 0 0 / 0.7)"
|
|
145
|
+
size="l"
|
|
146
|
+
></sp-swatch>
|
|
147
|
+
<sp-swatch
|
|
148
|
+
rounding="full"
|
|
149
|
+
shape="rectangle"
|
|
150
|
+
mixed-value
|
|
151
|
+
size="l"
|
|
152
|
+
></sp-swatch>
|
|
153
|
+
</div>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
</sp-tab-panel>
|
|
157
|
+
</sp-tabs>
|
|
158
|
+
|
|
159
|
+
## Modifying attributes
|
|
160
|
+
|
|
161
|
+
An `<sp-swatch>` element can be modified by the following attributes/properties to customize its delivery as desired for your use case: `border`, `color`, `disabled`, `mixedValue` (accepted as the `mixed-value` attribute), `nothing`, `rounding`, and `shape`. Use these in concert with each other for a variety of final visual deliveries.
|
|
162
|
+
|
|
163
|
+
### Border
|
|
164
|
+
|
|
165
|
+
The `border` attribute/property is not required and when applied accepts the values of `none` or `light`.
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<sp-swatch-group>
|
|
169
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)"></sp-swatch>
|
|
170
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" border="light"></sp-swatch>
|
|
171
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" border="none"></sp-swatch>
|
|
172
|
+
</sp-swatch-group>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Color
|
|
176
|
+
|
|
177
|
+
The `color` attribute/property determines the color value that the `<sp-swatch>` element will deliver.
|
|
178
|
+
|
|
179
|
+
```html
|
|
180
|
+
<sp-swatch-group>
|
|
181
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)"></sp-swatch>
|
|
182
|
+
<sp-swatch color="orange"></sp-swatch>
|
|
183
|
+
<sp-swatch color="var(--spectrum-magenta-500)"></sp-swatch>
|
|
184
|
+
</sp-swatch-group>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Disabled
|
|
188
|
+
|
|
189
|
+
The `disabled` attribute/property determines prevents interaction on the `<sp-swatch>` element.
|
|
190
|
+
|
|
191
|
+
```html
|
|
192
|
+
<sp-swatch-group>
|
|
193
|
+
<sp-swatch disabled color="rgb(255 0 0 / 0.7)"></sp-swatch>
|
|
194
|
+
<sp-swatch disabled color="orange"></sp-swatch>
|
|
195
|
+
<sp-swatch disabled color="var(--spectrum-magenta-500)"></sp-swatch>
|
|
196
|
+
</sp-swatch-group>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Mixed value
|
|
200
|
+
|
|
201
|
+
The `mixed-value` attribute and `mixedValue` property outline when an `<sp-swatch>` element represents more than one color.
|
|
202
|
+
|
|
203
|
+
```html
|
|
204
|
+
<sp-swatch-group selects="multiple">
|
|
205
|
+
<sp-swatch mixed-value></sp-swatch>
|
|
206
|
+
<sp-swatch mixed-value rounding="full"></sp-swatch>
|
|
207
|
+
<sp-swatch mixed-value shape="rectangle"></sp-swatch>
|
|
208
|
+
</sp-swatch-group>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Please note that the `aria-checked="mixed"` value only applies when the swatch is in a group with `selects="multiple"`
|
|
212
|
+
|
|
213
|
+
### Nothing
|
|
214
|
+
|
|
215
|
+
The `nothing` attribute/property outlines that the `<sp-swatch>` represents no color or that it represents "transparent".
|
|
216
|
+
|
|
217
|
+
```html
|
|
218
|
+
<sp-swatch-group>
|
|
219
|
+
<sp-swatch nothing></sp-swatch>
|
|
220
|
+
<sp-swatch nothing rounding="full"></sp-swatch>
|
|
221
|
+
<sp-swatch nothing shape="rectangle"></sp-swatch>
|
|
222
|
+
</sp-swatch-group>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Rounding
|
|
226
|
+
|
|
227
|
+
The `rounding` attribute/property is not required and when applied accepts the values of `none` or `full`.
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<sp-swatch-group>
|
|
231
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)"></sp-swatch>
|
|
232
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" rounding="none"></sp-swatch>
|
|
233
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" rounding="full"></sp-swatch>
|
|
234
|
+
</sp-swatch-group>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Shape
|
|
238
|
+
|
|
239
|
+
The `shape` attribute/property is not required and when applied accepts the values of `rectangle`.
|
|
240
|
+
|
|
241
|
+
```html
|
|
242
|
+
<sp-swatch-group>
|
|
243
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)"></sp-swatch>
|
|
244
|
+
<sp-swatch color="rgb(255 0 0 / 0.7)" shape="rectangle"></sp-swatch>
|
|
245
|
+
</sp-swatch-group>
|
|
246
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spectrum-web-components/swatch",
|
|
3
|
+
"version": "0.0.0-20241209155954",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "Web component implementation of a Spectrum design Swatch",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/adobe/spectrum-web-components.git",
|
|
12
|
+
"directory": "packages/swatch"
|
|
13
|
+
},
|
|
14
|
+
"author": "",
|
|
15
|
+
"homepage": "https://opensource.adobe.com/spectrum-web-components/components/swatch",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/adobe/spectrum-web-components/issues"
|
|
18
|
+
},
|
|
19
|
+
"main": "src/index.js",
|
|
20
|
+
"module": "src/index.js",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"development": "./src/index.dev.js",
|
|
25
|
+
"default": "./src/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
"./src/Swatch.js": {
|
|
29
|
+
"development": "./src/Swatch.dev.js",
|
|
30
|
+
"default": "./src/Swatch.js"
|
|
31
|
+
},
|
|
32
|
+
"./src/SwatchGroup.js": {
|
|
33
|
+
"development": "./src/SwatchGroup.dev.js",
|
|
34
|
+
"default": "./src/SwatchGroup.js"
|
|
35
|
+
},
|
|
36
|
+
"./src/index.js": {
|
|
37
|
+
"development": "./src/index.dev.js",
|
|
38
|
+
"default": "./src/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./src/swatch-group-overrides.css.js": "./src/swatch-group-overrides.css.js",
|
|
41
|
+
"./src/swatch-group.css.js": "./src/swatch-group.css.js",
|
|
42
|
+
"./src/swatch-overrides.css.js": "./src/swatch-overrides.css.js",
|
|
43
|
+
"./src/swatch.css.js": "./src/swatch.css.js",
|
|
44
|
+
"./sp-swatch.js": {
|
|
45
|
+
"development": "./sp-swatch.dev.js",
|
|
46
|
+
"default": "./sp-swatch.js"
|
|
47
|
+
},
|
|
48
|
+
"./sp-swatch-group.js": {
|
|
49
|
+
"development": "./sp-swatch-group.dev.js",
|
|
50
|
+
"default": "./sp-swatch-group.js"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"**/*.d.ts",
|
|
58
|
+
"**/*.js",
|
|
59
|
+
"**/*.js.map",
|
|
60
|
+
"custom-elements.json",
|
|
61
|
+
"!stories/",
|
|
62
|
+
"!test/"
|
|
63
|
+
],
|
|
64
|
+
"keywords": [
|
|
65
|
+
"spectrum css",
|
|
66
|
+
"web components",
|
|
67
|
+
"lit-element",
|
|
68
|
+
"lit-html"
|
|
69
|
+
],
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@lit-labs/observers": "^2.0.2",
|
|
72
|
+
"@spectrum-web-components/base": "0.0.0-20241209155954",
|
|
73
|
+
"@spectrum-web-components/icon": "0.0.0-20241209155954",
|
|
74
|
+
"@spectrum-web-components/icons-ui": "0.0.0-20241209155954",
|
|
75
|
+
"@spectrum-web-components/opacity-checkerboard": "0.0.0-20241209155954",
|
|
76
|
+
"@spectrum-web-components/reactive-controllers": "0.0.0-20241209155954",
|
|
77
|
+
"@spectrum-web-components/shared": "0.0.0-20241209155954"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@spectrum-css/swatch": "^7.0.0-s2-foundations.17",
|
|
81
|
+
"@spectrum-css/swatchgroup": "^4.0.0-s2-foundations.15"
|
|
82
|
+
},
|
|
83
|
+
"types": "./src/index.d.ts",
|
|
84
|
+
"customElements": "custom-elements.json",
|
|
85
|
+
"sideEffects": [
|
|
86
|
+
"./sp-*.js",
|
|
87
|
+
"./**/*.dev.js"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-swatch-group.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { SwatchGroup } from './src/SwatchGroup.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch-group', SwatchGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch-group': SwatchGroup;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,cAAc,mBAAmB,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-swatch-group.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { SwatchGroup } from './src/SwatchGroup.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch-group', SwatchGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch-group': SwatchGroup;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,eAAAA,MAAmB,uBAC5B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,kBAAmBD,CAAW",
|
|
6
|
+
"names": ["SwatchGroup", "defineElement"]
|
|
7
|
+
}
|
package/sp-swatch.d.ts
ADDED
package/sp-swatch.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-swatch.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Swatch } from './src/Swatch.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch', Swatch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch': Swatch;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,cAAc,aAAa,MAAM;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-swatch.js
ADDED
package/sp-swatch.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["sp-swatch.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Swatch } from './src/Swatch.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-swatch', Swatch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-swatch': Swatch;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,UAAAA,MAAc,kBACvB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,YAAaD,CAAM",
|
|
6
|
+
"names": ["Swatch", "defineElement"]
|
|
7
|
+
}
|
package/src/Swatch.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
import { Focusable } from '@spectrum-web-components/shared/src/focusable.js';
|
|
3
|
+
import '@spectrum-web-components/icons-ui/icons/sp-icon-dash75.js';
|
|
4
|
+
import '@spectrum-web-components/icons-ui/icons/sp-icon-dash100.js';
|
|
5
|
+
import '@spectrum-web-components/icons-ui/icons/sp-icon-dash200.js';
|
|
6
|
+
import '@spectrum-web-components/icons-ui/icons/sp-icon-dash300.js';
|
|
7
|
+
export type SwatchBorder = 'light' | 'none' | undefined;
|
|
8
|
+
export type SwatchRounding = 'none' | 'full' | undefined;
|
|
9
|
+
export type SwatchShape = 'rectangle' | undefined;
|
|
10
|
+
declare const Swatch_base: typeof Focusable & {
|
|
11
|
+
new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
|
|
12
|
+
prototype: import("@spectrum-web-components/base").SizedElementInterface;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* @element sp-swatch
|
|
16
|
+
*/
|
|
17
|
+
export declare class Swatch extends Swatch_base {
|
|
18
|
+
static get styles(): CSSResultArray;
|
|
19
|
+
border: SwatchBorder;
|
|
20
|
+
color: string;
|
|
21
|
+
label: string;
|
|
22
|
+
mixedValue: boolean;
|
|
23
|
+
nothing: boolean;
|
|
24
|
+
role: string;
|
|
25
|
+
rounding: SwatchRounding;
|
|
26
|
+
selected: boolean;
|
|
27
|
+
shape: SwatchShape;
|
|
28
|
+
get value(): string;
|
|
29
|
+
set value(value: string);
|
|
30
|
+
private _value?;
|
|
31
|
+
get focusElement(): HTMLElement;
|
|
32
|
+
toggle(force?: boolean): void;
|
|
33
|
+
private handleClick;
|
|
34
|
+
protected handleKeydown(event: KeyboardEvent): void;
|
|
35
|
+
private handleKeypress;
|
|
36
|
+
protected handleKeyup(event: KeyboardEvent): void;
|
|
37
|
+
protected renderDisabled: () => TemplateResult;
|
|
38
|
+
protected renderMixedValue: () => TemplateResult;
|
|
39
|
+
protected render(): TemplateResult;
|
|
40
|
+
protected willUpdate(changes: PropertyValues): void;
|
|
41
|
+
protected firstUpdated(changes: PropertyValues): void;
|
|
42
|
+
}
|
|
43
|
+
export {};
|