@spectrum-web-components/thumbnail 0.31.1-react.21 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -41
- package/custom-elements.json +45 -9
- package/package.json +4 -4
- package/src/Thumbnail.d.ts +10 -7
- package/src/Thumbnail.dev.js +89 -14
- package/src/Thumbnail.dev.js.map +2 -2
- package/src/Thumbnail.js +15 -9
- package/src/Thumbnail.js.map +3 -3
- package/src/spectrum-config.js +16 -5
- package/src/spectrum-thumbnail.css.dev.js +181 -111
- package/src/spectrum-thumbnail.css.dev.js.map +2 -2
- package/src/spectrum-thumbnail.css.js +183 -113
- package/src/spectrum-thumbnail.css.js.map +2 -2
- package/src/thumbnail.css.dev.js +181 -111
- package/src/thumbnail.css.dev.js.map +2 -2
- package/src/thumbnail.css.js +183 -113
- package/src/thumbnail.css.js.map +2 -2
- package/stories/thumbnail-sizes.stories.js +12 -5
- package/stories/thumbnail-sizes.stories.js.map +2 -2
- package/stories/thumbnail.stories.js +18 -4
- package/stories/thumbnail.stories.js.map +2 -2
- package/test/thumbnail.test.js +3 -3
- package/test/thumbnail.test.js.map +2 -2
package/README.md
CHANGED
|
@@ -26,52 +26,122 @@ import { Thumbnail } from '@spectrum-web-components/thumbnail';
|
|
|
26
26
|
|
|
27
27
|
## Sizes
|
|
28
28
|
|
|
29
|
-
<sp-tabs selected="
|
|
30
|
-
<sp-tab value="
|
|
31
|
-
<sp-tab-panel value="
|
|
29
|
+
<sp-tabs selected="500" auto label="Size Attribute Options">
|
|
30
|
+
<sp-tab value="50">50</sp-tab>
|
|
31
|
+
<sp-tab-panel value="50">
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<sp-thumbnail size="
|
|
34
|
+
<sp-thumbnail size="50">
|
|
35
35
|
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
36
36
|
</sp-thumbnail>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
</sp-tab-panel>
|
|
40
|
-
<sp-tab value="
|
|
41
|
-
<sp-tab-panel value="
|
|
40
|
+
<sp-tab value="75">75</sp-tab>
|
|
41
|
+
<sp-tab-panel value="75">
|
|
42
42
|
|
|
43
43
|
```html
|
|
44
|
-
<sp-thumbnail size="
|
|
44
|
+
<sp-thumbnail size="75">
|
|
45
45
|
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
46
46
|
</sp-thumbnail>
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
</sp-tab-panel>
|
|
50
|
-
<sp-tab value="
|
|
51
|
-
<sp-tab-panel value="
|
|
50
|
+
<sp-tab value="100">100</sp-tab>
|
|
51
|
+
<sp-tab-panel value="100">
|
|
52
52
|
|
|
53
53
|
```html
|
|
54
|
-
<sp-thumbnail size="
|
|
54
|
+
<sp-thumbnail size="100">
|
|
55
55
|
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
56
56
|
</sp-thumbnail>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
</sp-tab-panel>
|
|
60
|
-
<sp-tab value="
|
|
61
|
-
<sp-tab-panel value="
|
|
60
|
+
<sp-tab value="200">200</sp-tab>
|
|
61
|
+
<sp-tab-panel value="200">
|
|
62
62
|
|
|
63
63
|
```html
|
|
64
|
-
<sp-thumbnail size="
|
|
64
|
+
<sp-thumbnail size="200">
|
|
65
65
|
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
66
66
|
</sp-thumbnail>
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
</sp-tab-panel>
|
|
70
|
-
<sp-tab value="
|
|
71
|
-
<sp-tab-panel value="
|
|
70
|
+
<sp-tab value="300">300</sp-tab>
|
|
71
|
+
<sp-tab-panel value="300">
|
|
72
72
|
|
|
73
73
|
```html
|
|
74
|
-
<sp-thumbnail size="
|
|
74
|
+
<sp-thumbnail size="300">
|
|
75
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
76
|
+
</sp-thumbnail>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
</sp-tab-panel>
|
|
80
|
+
<sp-tab value="400">400</sp-tab>
|
|
81
|
+
<sp-tab-panel value="400">
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<sp-thumbnail size="400">
|
|
85
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
86
|
+
</sp-thumbnail>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
</sp-tab-panel>
|
|
90
|
+
<sp-tab value="500">500</sp-tab>
|
|
91
|
+
<sp-tab-panel value="500">
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<sp-thumbnail size="500">
|
|
95
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
96
|
+
</sp-thumbnail>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
</sp-tab-panel>
|
|
100
|
+
<sp-tab value="600">600</sp-tab>
|
|
101
|
+
<sp-tab-panel value="600">
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<sp-thumbnail size="600">
|
|
105
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
106
|
+
</sp-thumbnail>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
</sp-tab-panel>
|
|
110
|
+
<sp-tab value="700">700</sp-tab>
|
|
111
|
+
<sp-tab-panel value="700">
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<sp-thumbnail size="700">
|
|
115
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
116
|
+
</sp-thumbnail>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
</sp-tab-panel>
|
|
120
|
+
<sp-tab value="800">800</sp-tab>
|
|
121
|
+
<sp-tab-panel value="800">
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<sp-thumbnail size="800">
|
|
125
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
126
|
+
</sp-thumbnail>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
</sp-tab-panel>
|
|
130
|
+
<sp-tab value="900">900</sp-tab>
|
|
131
|
+
<sp-tab-panel value="900">
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<sp-thumbnail size="900">
|
|
135
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
136
|
+
</sp-thumbnail>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
</sp-tab-panel>
|
|
140
|
+
<sp-tab value="1000">1000</sp-tab>
|
|
141
|
+
<sp-tab-panel value="1000">
|
|
142
|
+
|
|
143
|
+
```html
|
|
144
|
+
<sp-thumbnail size="1000">
|
|
75
145
|
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
76
146
|
</sp-thumbnail>
|
|
77
147
|
```
|
|
@@ -79,19 +149,25 @@ import { Thumbnail } from '@spectrum-web-components/thumbnail';
|
|
|
79
149
|
</sp-tab-panel>
|
|
80
150
|
</sp-tabs>
|
|
81
151
|
|
|
82
|
-
## Focused
|
|
152
|
+
## Focused
|
|
83
153
|
|
|
84
|
-
When `focused`
|
|
154
|
+
When `focused` the `sp-thumbnail` element will be displayed as follows:
|
|
85
155
|
|
|
86
156
|
```html
|
|
87
|
-
<
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
157
|
+
<sp-thumbnail focused>
|
|
158
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
159
|
+
</sp-thumbnail>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Disabled
|
|
163
|
+
|
|
164
|
+
Thumbnail should only be displayed as disabled if the entire componet is also disabled.
|
|
165
|
+
When `disabled` the `sp-thumbnail` element will be displayed as follows:
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<sp-thumbnail disabled>
|
|
169
|
+
<img src="https://place.dog/100/100" alt="Demo Image" />
|
|
170
|
+
</sp-thumbnail>
|
|
95
171
|
```
|
|
96
172
|
|
|
97
173
|
## Representing non-square content
|
|
@@ -101,14 +177,11 @@ By default, an `sp-thumbnail` will ensure that the entirety of the content that
|
|
|
101
177
|
```html
|
|
102
178
|
<div style="display: flex; gap: var(--spectrum-spacing-100);">
|
|
103
179
|
<sp-thumbnail>
|
|
104
|
-
<img src="https://place.dog/300/400" alt="
|
|
180
|
+
<img src="https://place.dog/300/400" alt="Demo Image" />
|
|
105
181
|
</sp-thumbnail>
|
|
106
182
|
|
|
107
183
|
<sp-thumbnail>
|
|
108
|
-
<img
|
|
109
|
-
src="https://place.dog/500/100"
|
|
110
|
-
alt="Landscape with mountains and lake"
|
|
111
|
-
/>
|
|
184
|
+
<img src="https://place.dog/500/100" alt="Demo Image" />
|
|
112
185
|
</sp-thumbnail>
|
|
113
186
|
</div>
|
|
114
187
|
```
|
|
@@ -118,14 +191,11 @@ The `background` attribute takes a string value of the CSS "background" property
|
|
|
118
191
|
```html
|
|
119
192
|
<div style="display: flex; gap: var(--spectrum-spacing-100);">
|
|
120
193
|
<sp-thumbnail background="red">
|
|
121
|
-
<img src="https://place.dog/300/400" alt="
|
|
194
|
+
<img src="https://place.dog/300/400" alt="Demo Image" />
|
|
122
195
|
</sp-thumbnail>
|
|
123
196
|
|
|
124
197
|
<sp-thumbnail background="#00ff00">
|
|
125
|
-
<img
|
|
126
|
-
src="https://place.dog/500/100"
|
|
127
|
-
alt="Landscape with mountains and lake"
|
|
128
|
-
/>
|
|
198
|
+
<img src="https://place.dog/500/100" alt="Demo Image" />
|
|
129
199
|
</sp-thumbnail>
|
|
130
200
|
</div>
|
|
131
201
|
```
|
|
@@ -135,14 +205,27 @@ The `cover` attribute will cause the content to fill the space provided by the `
|
|
|
135
205
|
```html
|
|
136
206
|
<div style="display: flex; gap: var(--spectrum-spacing-100);">
|
|
137
207
|
<sp-thumbnail cover>
|
|
138
|
-
<img src="https://place.dog/300/400" alt="
|
|
208
|
+
<img src="https://place.dog/300/400" alt="Demo Image" />
|
|
139
209
|
</sp-thumbnail>
|
|
140
210
|
|
|
141
211
|
<sp-thumbnail cover>
|
|
142
|
-
<img
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
212
|
+
<img src="https://place.dog/500/100" alt="Demo Image" />
|
|
213
|
+
</sp-thumbnail>
|
|
214
|
+
</div>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Layer and Layer Selected
|
|
218
|
+
|
|
219
|
+
For when `sp-thumbail` is used in layer management (such as the Compact or Detail Layers panels). The thumbnail is given a thick blue border to indicate its selection when used in layer management.
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<div style="display: flex; gap: var(--spectrum-spacing-100);">
|
|
223
|
+
<sp-thumbnail layer>
|
|
224
|
+
<img src="https://place.dog/400/400" alt="Demo Image" />
|
|
225
|
+
</sp-thumbnail>
|
|
226
|
+
|
|
227
|
+
<sp-thumbnail layer selected>
|
|
228
|
+
<img src="https://place.dog/500/100" alt="Demo Image" />
|
|
146
229
|
</sp-thumbnail>
|
|
147
230
|
</div>
|
|
148
231
|
```
|
package/custom-elements.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"modules": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "javascript-module",
|
|
7
|
-
"path": "sp-thumbnail.
|
|
7
|
+
"path": "sp-thumbnail.js",
|
|
8
8
|
"declarations": [],
|
|
9
9
|
"exports": [
|
|
10
10
|
{
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"kind": "javascript-module",
|
|
22
|
-
"path": "src/Thumbnail.
|
|
22
|
+
"path": "src/Thumbnail.js",
|
|
23
23
|
"declarations": [
|
|
24
24
|
{
|
|
25
25
|
"kind": "class",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"slots": [
|
|
29
29
|
{
|
|
30
30
|
"description": "image element to present in the Thumbnail",
|
|
31
|
-
"name": ""
|
|
31
|
+
"name": "image"
|
|
32
32
|
}
|
|
33
33
|
],
|
|
34
34
|
"members": [
|
|
@@ -52,6 +52,33 @@
|
|
|
52
52
|
"default": "false",
|
|
53
53
|
"attribute": "cover",
|
|
54
54
|
"reflects": true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "field",
|
|
58
|
+
"name": "layer",
|
|
59
|
+
"type": {
|
|
60
|
+
"text": "boolean"
|
|
61
|
+
},
|
|
62
|
+
"privacy": "public",
|
|
63
|
+
"default": "false",
|
|
64
|
+
"attribute": "layer",
|
|
65
|
+
"reflects": true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"kind": "field",
|
|
69
|
+
"name": "size",
|
|
70
|
+
"type": {
|
|
71
|
+
"text": "ThumbnailSize"
|
|
72
|
+
},
|
|
73
|
+
"privacy": "public",
|
|
74
|
+
"attribute": "size",
|
|
75
|
+
"reflects": true
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"kind": "field",
|
|
79
|
+
"name": "_size",
|
|
80
|
+
"privacy": "private",
|
|
81
|
+
"default": "validSizes[6]"
|
|
55
82
|
}
|
|
56
83
|
],
|
|
57
84
|
"attributes": [
|
|
@@ -69,12 +96,21 @@
|
|
|
69
96
|
},
|
|
70
97
|
"default": "false",
|
|
71
98
|
"fieldName": "cover"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
"mixins": [
|
|
99
|
+
},
|
|
75
100
|
{
|
|
76
|
-
"name": "
|
|
77
|
-
"
|
|
101
|
+
"name": "layer",
|
|
102
|
+
"type": {
|
|
103
|
+
"text": "boolean"
|
|
104
|
+
},
|
|
105
|
+
"default": "false",
|
|
106
|
+
"fieldName": "layer"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "size",
|
|
110
|
+
"type": {
|
|
111
|
+
"text": "ThumbnailSize"
|
|
112
|
+
},
|
|
113
|
+
"fieldName": "size"
|
|
78
114
|
}
|
|
79
115
|
],
|
|
80
116
|
"superclass": {
|
|
@@ -91,7 +127,7 @@
|
|
|
91
127
|
"name": "Thumbnail",
|
|
92
128
|
"declaration": {
|
|
93
129
|
"name": "Thumbnail",
|
|
94
|
-
"module": "src/Thumbnail.
|
|
130
|
+
"module": "src/Thumbnail.js"
|
|
95
131
|
}
|
|
96
132
|
}
|
|
97
133
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/thumbnail",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"lit-html"
|
|
58
58
|
],
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@spectrum-web-components/base": "^0.
|
|
60
|
+
"@spectrum-web-components/base": "^0.32.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@spectrum-css/thumbnail": "^
|
|
63
|
+
"@spectrum-css/thumbnail": "^3.0.5"
|
|
64
64
|
},
|
|
65
65
|
"types": "./src/index.d.ts",
|
|
66
66
|
"customElements": "custom-elements.json",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"./sp-*.js",
|
|
69
69
|
"./**/*.dev.js"
|
|
70
70
|
],
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "c5f67662ac54d0e37debaf7cbd7c2df60e8b294e"
|
|
72
72
|
}
|
package/src/Thumbnail.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { CSSResultArray, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
-
declare const
|
|
3
|
-
|
|
4
|
-
prototype: import("@spectrum-web-components/base").SizedElementInterface;
|
|
5
|
-
};
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
declare const validSizes: string[];
|
|
3
|
+
export declare type ThumbnailSize = typeof validSizes[number];
|
|
6
4
|
/**
|
|
7
5
|
* @element sp-thumbnail
|
|
8
6
|
*
|
|
9
|
-
* @slot - image element to present in the Thumbnail
|
|
7
|
+
* @slot image - image element to present in the Thumbnail
|
|
10
8
|
*/
|
|
11
|
-
export declare class Thumbnail extends
|
|
9
|
+
export declare class Thumbnail extends SpectrumElement {
|
|
12
10
|
static get styles(): CSSResultArray;
|
|
13
11
|
background?: string;
|
|
14
12
|
cover: boolean;
|
|
13
|
+
layer: boolean;
|
|
14
|
+
get size(): ThumbnailSize;
|
|
15
|
+
set size(value: ThumbnailSize);
|
|
16
|
+
private _size;
|
|
17
|
+
protected update(changes: PropertyValues): void;
|
|
15
18
|
protected render(): TemplateResult;
|
|
16
19
|
}
|
|
17
20
|
export {};
|
package/src/Thumbnail.dev.js
CHANGED
|
@@ -12,32 +12,101 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
12
12
|
};
|
|
13
13
|
import {
|
|
14
14
|
html,
|
|
15
|
-
SizedMixin,
|
|
16
15
|
SpectrumElement
|
|
17
16
|
} from "@spectrum-web-components/base";
|
|
18
17
|
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
19
18
|
import styles from "./thumbnail.css.js";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const validSizes = [
|
|
20
|
+
"50",
|
|
21
|
+
"75",
|
|
22
|
+
"100",
|
|
23
|
+
"200",
|
|
24
|
+
"300",
|
|
25
|
+
"400",
|
|
26
|
+
"500",
|
|
27
|
+
"600",
|
|
28
|
+
"700",
|
|
29
|
+
"800",
|
|
30
|
+
"900",
|
|
31
|
+
"1000"
|
|
32
|
+
];
|
|
33
|
+
const defaultSize = validSizes[6];
|
|
34
|
+
export class Thumbnail extends SpectrumElement {
|
|
24
35
|
constructor() {
|
|
25
36
|
super(...arguments);
|
|
26
37
|
this.cover = false;
|
|
38
|
+
this.layer = false;
|
|
39
|
+
this._size = defaultSize;
|
|
27
40
|
}
|
|
28
41
|
static get styles() {
|
|
29
42
|
return [styles];
|
|
30
43
|
}
|
|
44
|
+
get size() {
|
|
45
|
+
return this._size;
|
|
46
|
+
}
|
|
47
|
+
set size(value) {
|
|
48
|
+
const deprecatedSizes = ["xxs", "xs", "s", "m", "l"];
|
|
49
|
+
const managedSizes = {
|
|
50
|
+
xxs: "100",
|
|
51
|
+
xs: "300",
|
|
52
|
+
s: "500",
|
|
53
|
+
m: "700",
|
|
54
|
+
l: "900"
|
|
55
|
+
};
|
|
56
|
+
const usesDeprecatedSize = deprecatedSizes.includes(value);
|
|
57
|
+
if (usesDeprecatedSize) {
|
|
58
|
+
if (true) {
|
|
59
|
+
window.__swc.warn(
|
|
60
|
+
this,
|
|
61
|
+
`The "size" attribute/property for <${this.localName}> no longer supports the value "${value}". Use one of the following values, instead:`,
|
|
62
|
+
"https://opensource.adobe.com/spectrum-web-components/components/thumbnail/#sizes",
|
|
63
|
+
{
|
|
64
|
+
level: "deprecation",
|
|
65
|
+
issues: validSizes
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
value = managedSizes[value];
|
|
70
|
+
}
|
|
71
|
+
const size = validSizes.includes(value) ? value : defaultSize;
|
|
72
|
+
if (size) {
|
|
73
|
+
this.setAttribute("size", `${size}`);
|
|
74
|
+
}
|
|
75
|
+
if (this._size === size) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const oldSize = this._size;
|
|
79
|
+
this._size = size;
|
|
80
|
+
this.requestUpdate("size", oldSize);
|
|
81
|
+
}
|
|
82
|
+
update(changes) {
|
|
83
|
+
if (!this.hasAttribute("size")) {
|
|
84
|
+
this.setAttribute("size", this.size);
|
|
85
|
+
}
|
|
86
|
+
super.update(changes);
|
|
87
|
+
}
|
|
31
88
|
render() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
89
|
+
if (this.background) {
|
|
90
|
+
return html`
|
|
91
|
+
<div class="background" style="background: ${this.background}">
|
|
92
|
+
<div class="image-wrapper">
|
|
93
|
+
<slot></slot>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
`;
|
|
97
|
+
} else if (this.layer) {
|
|
98
|
+
return html`
|
|
99
|
+
<div class="layer-inner">
|
|
100
|
+
<slot></slot>
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
} else {
|
|
104
|
+
return html`
|
|
105
|
+
<div class="image-wrapper">
|
|
106
|
+
<slot></slot>
|
|
107
|
+
</div>
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
41
110
|
}
|
|
42
111
|
}
|
|
43
112
|
__decorateClass([
|
|
@@ -46,4 +115,10 @@ __decorateClass([
|
|
|
46
115
|
__decorateClass([
|
|
47
116
|
property({ type: Boolean, reflect: true })
|
|
48
117
|
], Thumbnail.prototype, "cover", 2);
|
|
118
|
+
__decorateClass([
|
|
119
|
+
property({ type: Boolean, reflect: true })
|
|
120
|
+
], Thumbnail.prototype, "layer", 2);
|
|
121
|
+
__decorateClass([
|
|
122
|
+
property({ type: String, reflect: true })
|
|
123
|
+
], Thumbnail.prototype, "size", 1);
|
|
49
124
|
//# sourceMappingURL=Thumbnail.dev.js.map
|
package/src/Thumbnail.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Thumbnail.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*/\n\nimport {\n CSSResultArray,\n html,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,
|
|
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*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './thumbnail.css.js';\n\nconst validSizes = [\n '50',\n '75',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '1000',\n];\nexport type ThumbnailSize = typeof validSizes[number];\n\nconst defaultSize = validSizes[6];\n\n/**\n * @element sp-thumbnail\n *\n * @slot image - image element to present in the Thumbnail\n */\n\nexport class Thumbnail extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public background?: string;\n\n @property({ type: Boolean, reflect: true })\n public cover = false;\n\n @property({ type: Boolean, reflect: true })\n public layer = false;\n\n @property({ type: String, reflect: true })\n public get size(): ThumbnailSize {\n return this._size;\n }\n\n public set size(value: ThumbnailSize) {\n const deprecatedSizes = ['xxs', 'xs', 's', 'm', 'l'];\n type DeprecatedThumbnailSize = typeof deprecatedSizes[number];\n const managedSizes: Record<DeprecatedThumbnailSize, ThumbnailSize> = {\n xxs: '100',\n xs: '300',\n s: '500',\n m: '700',\n l: '900',\n };\n const usesDeprecatedSize = deprecatedSizes.includes(value);\n if (usesDeprecatedSize) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"size\" attribute/property for <${this.localName}> no longer supports the value \"${value}\". Use one of the following values, instead:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/thumbnail/#sizes',\n {\n level: 'deprecation',\n issues: validSizes as unknown as string[],\n }\n );\n }\n value = managedSizes[value];\n }\n const size = (\n validSizes.includes(value) ? value : defaultSize\n ) as ThumbnailSize;\n if (size) {\n this.setAttribute('size', `${size}`);\n }\n if (this._size === size) {\n return;\n }\n const oldSize = this._size;\n this._size = size;\n this.requestUpdate('size', oldSize);\n }\n\n private _size = defaultSize;\n\n protected override update(changes: PropertyValues): void {\n if (!this.hasAttribute('size')) {\n this.setAttribute('size', this.size);\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n if (this.background) {\n return html`\n <div class=\"background\" style=\"background: ${this.background}\">\n <div class=\"image-wrapper\">\n <slot></slot>\n </div>\n </div>\n `;\n } else if (this.layer) {\n return html`\n <div class=\"layer-inner\">\n <slot></slot>\n </div>\n `;\n } else {\n return html`\n <div class=\"image-wrapper\">\n <slot></slot>\n </div>\n `;\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO,YAAY;AAEnB,MAAM,aAAa;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAGA,MAAM,cAAc,WAAW,CAAC;AAQzB,aAAM,kBAAkB,gBAAgB;AAAA,EAAxC;AAAA;AASH,SAAO,QAAQ;AAGf,SAAO,QAAQ;AA8Cf,SAAQ,QAAQ;AAAA;AAAA,EAzDhB,WAA2B,SAAyB;AAChD,WAAO,CAAC,MAAM;AAAA,EAClB;AAAA,EAYA,IAAW,OAAsB;AAC7B,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAW,KAAK,OAAsB;AAClC,UAAM,kBAAkB,CAAC,OAAO,MAAM,KAAK,KAAK,GAAG;AAEnD,UAAM,eAA+D;AAAA,MACjE,KAAK;AAAA,MACL,IAAI;AAAA,MACJ,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IACP;AACA,UAAM,qBAAqB,gBAAgB,SAAS,KAAK;AACzD,QAAI,oBAAoB;AACpB,UAAI,MAAoB;AACpB,eAAO,MAAM;AAAA,UACT;AAAA,UACA,sCAAsC,KAAK,4CAA4C;AAAA,UACvF;AAAA,UACA;AAAA,YACI,OAAO;AAAA,YACP,QAAQ;AAAA,UACZ;AAAA,QACJ;AAAA,MACJ;AACA,cAAQ,aAAa,KAAK;AAAA,IAC9B;AACA,UAAM,OACF,WAAW,SAAS,KAAK,IAAI,QAAQ;AAEzC,QAAI,MAAM;AACN,WAAK,aAAa,QAAQ,GAAG,MAAM;AAAA,IACvC;AACA,QAAI,KAAK,UAAU,MAAM;AACrB;AAAA,IACJ;AACA,UAAM,UAAU,KAAK;AACrB,SAAK,QAAQ;AACb,SAAK,cAAc,QAAQ,OAAO;AAAA,EACtC;AAAA,EAImB,OAAO,SAA+B;AACrD,QAAI,CAAC,KAAK,aAAa,MAAM,GAAG;AAC5B,WAAK,aAAa,QAAQ,KAAK,IAAI;AAAA,IACvC;AACA,UAAM,OAAO,OAAO;AAAA,EACxB;AAAA,EAEmB,SAAyB;AACxC,QAAI,KAAK,YAAY;AACjB,aAAO;AAAA,6DAC0C,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAM1D,WAAW,KAAK,OAAO;AACnB,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKX,OAAO;AACH,aAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAKX;AAAA,EACJ;AACJ;AApFW;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GALhC,UAMF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GARjC,UASF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAXjC,UAYF;AAGI;AAAA,EADV,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAdhC,UAeE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Thumbnail.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";var z=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var o=(n,r,e,i)=>{for(var t=i>1?void 0:i?m(r,e):r,l=n.length-1,s;l>=0;l--)(s=n[l])&&(t=(i?s(r,e,t):s(t))||t);return i&&t&&z(r,e,t),t};import{html as p,SpectrumElement as h}from"@spectrum-web-components/base";import{property as a}from"@spectrum-web-components/base/src/decorators.js";import b from"./thumbnail.css.js";const u=["50","75","100","200","300","400","500","600","700","800","900","1000"],c=u[6];export class Thumbnail extends h{constructor(){super(...arguments);this.cover=!1;this.layer=!1;this._size=c}static get styles(){return[b]}get size(){return this._size}set size(e){const i=["xxs","xs","s","m","l"],t={xxs:"100",xs:"300",s:"500",m:"700",l:"900"};i.includes(e)&&(e=t[e]);const s=u.includes(e)?e:c;if(s&&this.setAttribute("size",`${s}`),this._size===s)return;const d=this._size;this._size=s,this.requestUpdate("size",d)}update(e){this.hasAttribute("size")||this.setAttribute("size",this.size),super.update(e)}render(){return this.background?p`
|
|
2
|
+
<div class="background" style="background: ${this.background}">
|
|
3
|
+
<div class="image-wrapper">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
`:this.layer?p`
|
|
8
|
+
<div class="layer-inner">
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</div>
|
|
11
|
+
`:p`
|
|
12
|
+
<div class="image-wrapper">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
`}}o([a({type:String,reflect:!0})],Thumbnail.prototype,"background",2),o([a({type:Boolean,reflect:!0})],Thumbnail.prototype,"cover",2),o([a({type:Boolean,reflect:!0})],Thumbnail.prototype,"layer",2),o([a({type:String,reflect:!0})],Thumbnail.prototype,"size",1);
|
|
10
16
|
//# sourceMappingURL=Thumbnail.js.map
|
package/src/Thumbnail.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Thumbnail.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*/\n\nimport {\n CSSResultArray,\n html,\n
|
|
5
|
-
"mappings": "qNAYA,OAEI,QAAAA,
|
|
6
|
-
"names": ["html", "
|
|
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*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport styles from './thumbnail.css.js';\n\nconst validSizes = [\n '50',\n '75',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '1000',\n];\nexport type ThumbnailSize = typeof validSizes[number];\n\nconst defaultSize = validSizes[6];\n\n/**\n * @element sp-thumbnail\n *\n * @slot image - image element to present in the Thumbnail\n */\n\nexport class Thumbnail extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: String, reflect: true })\n public background?: string;\n\n @property({ type: Boolean, reflect: true })\n public cover = false;\n\n @property({ type: Boolean, reflect: true })\n public layer = false;\n\n @property({ type: String, reflect: true })\n public get size(): ThumbnailSize {\n return this._size;\n }\n\n public set size(value: ThumbnailSize) {\n const deprecatedSizes = ['xxs', 'xs', 's', 'm', 'l'];\n type DeprecatedThumbnailSize = typeof deprecatedSizes[number];\n const managedSizes: Record<DeprecatedThumbnailSize, ThumbnailSize> = {\n xxs: '100',\n xs: '300',\n s: '500',\n m: '700',\n l: '900',\n };\n const usesDeprecatedSize = deprecatedSizes.includes(value);\n if (usesDeprecatedSize) {\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"size\" attribute/property for <${this.localName}> no longer supports the value \"${value}\". Use one of the following values, instead:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/thumbnail/#sizes',\n {\n level: 'deprecation',\n issues: validSizes as unknown as string[],\n }\n );\n }\n value = managedSizes[value];\n }\n const size = (\n validSizes.includes(value) ? value : defaultSize\n ) as ThumbnailSize;\n if (size) {\n this.setAttribute('size', `${size}`);\n }\n if (this._size === size) {\n return;\n }\n const oldSize = this._size;\n this._size = size;\n this.requestUpdate('size', oldSize);\n }\n\n private _size = defaultSize;\n\n protected override update(changes: PropertyValues): void {\n if (!this.hasAttribute('size')) {\n this.setAttribute('size', this.size);\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n if (this.background) {\n return html`\n <div class=\"background\" style=\"background: ${this.background}\">\n <div class=\"image-wrapper\">\n <slot></slot>\n </div>\n </div>\n `;\n } else if (this.layer) {\n return html`\n <div class=\"layer-inner\">\n <slot></slot>\n </div>\n `;\n } else {\n return html`\n <div class=\"image-wrapper\">\n <slot></slot>\n </div>\n `;\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAY,qBAEnB,MAAMC,EAAa,CACf,KACA,KACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACJ,EAGMC,EAAcD,EAAW,CAAC,EAQzB,aAAM,kBAAkBH,CAAgB,CAAxC,kCASH,KAAO,MAAQ,GAGf,KAAO,MAAQ,GA8Cf,KAAQ,MAAQI,EAzDhB,WAA2B,QAAyB,CAChD,MAAO,CAACF,CAAM,CAClB,CAYA,IAAW,MAAsB,CAC7B,OAAO,KAAK,KAChB,CAEA,IAAW,KAAKG,EAAsB,CAClC,MAAMC,EAAkB,CAAC,MAAO,KAAM,IAAK,IAAK,GAAG,EAE7CC,EAA+D,CACjE,IAAK,MACL,GAAI,MACJ,EAAG,MACH,EAAG,MACH,EAAG,KACP,EAC2BD,EAAgB,SAASD,CAAK,IAarDA,EAAQE,EAAaF,CAAK,GAE9B,MAAMG,EACFL,EAAW,SAASE,CAAK,EAAIA,EAAQD,EAKzC,GAHII,GACA,KAAK,aAAa,OAAQ,GAAGA,GAAM,EAEnC,KAAK,QAAUA,EACf,OAEJ,MAAMC,EAAU,KAAK,MACrB,KAAK,MAAQD,EACb,KAAK,cAAc,OAAQC,CAAO,CACtC,CAImB,OAAOC,EAA+B,CAChD,KAAK,aAAa,MAAM,GACzB,KAAK,aAAa,OAAQ,KAAK,IAAI,EAEvC,MAAM,OAAOA,CAAO,CACxB,CAEmB,QAAyB,CACxC,OAAI,KAAK,WACEX;AAAA,6DAC0C,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,cAM/C,KAAK,MACLA;AAAA;AAAA;AAAA;AAAA,cAMAA;AAAA;AAAA;AAAA;AAAA,aAMf,CACJ,CApFWY,EAAA,CADNV,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GALhC,UAMF,0BAGAU,EAAA,CADNV,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GARjC,UASF,qBAGAU,EAAA,CADNV,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAXjC,UAYF,qBAGIU,EAAA,CADVV,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAdhC,UAeE",
|
|
6
|
+
"names": ["html", "SpectrumElement", "property", "styles", "validSizes", "defaultSize", "value", "deprecatedSizes", "managedSizes", "size", "oldSize", "changes", "__decorateClass"]
|
|
7
7
|
}
|
package/src/spectrum-config.js
CHANGED
|
@@ -28,18 +28,29 @@ export default {
|
|
|
28
28
|
converter.classToHost(),
|
|
29
29
|
converter.classToAttribute('is-selected', 'selected'),
|
|
30
30
|
converter.classToAttribute('is-focused', 'focused'),
|
|
31
|
+
converter.classToAttribute('is-disabled', 'disabled'),
|
|
31
32
|
converter.classToAttribute('spectrum-Thumbnail--cover'),
|
|
33
|
+
converter.classToAttribute('spectrum-Thumbnail-layer'),
|
|
32
34
|
...converter.enumerateAttributes(
|
|
33
35
|
[
|
|
34
|
-
['spectrum-Thumbnail--
|
|
35
|
-
['spectrum-Thumbnail--
|
|
36
|
-
['spectrum-Thumbnail--
|
|
37
|
-
['spectrum-Thumbnail--
|
|
38
|
-
['spectrum-Thumbnail--
|
|
36
|
+
['spectrum-Thumbnail--size50', '50'],
|
|
37
|
+
['spectrum-Thumbnail--size75', '75'],
|
|
38
|
+
['spectrum-Thumbnail--size100', '100'],
|
|
39
|
+
['spectrum-Thumbnail--size200', '200'],
|
|
40
|
+
['spectrum-Thumbnail--size300', '300'],
|
|
41
|
+
['spectrum-Thumbnail--size400', '400'],
|
|
42
|
+
['spectrum-Thumbnail--size500', '500'],
|
|
43
|
+
['spectrum-Thumbnail--size600', '600'],
|
|
44
|
+
['spectrum-Thumbnail--size700', '700'],
|
|
45
|
+
['spectrum-Thumbnail--size800', '800'],
|
|
46
|
+
['spectrum-Thumbnail--size900', '900'],
|
|
47
|
+
['spectrum-Thumbnail--size1000', '1000'],
|
|
39
48
|
],
|
|
40
49
|
'size'
|
|
41
50
|
),
|
|
42
51
|
converter.classToClass('spectrum-Thumbnail-background'),
|
|
52
|
+
converter.classToClass('spectrum-Thumbnail-image-wrapper'),
|
|
53
|
+
converter.classToClass('spectrum-Thumbnail-layer-inner'),
|
|
43
54
|
converter.classToSlotted('spectrum-Thumbnail-image'),
|
|
44
55
|
],
|
|
45
56
|
},
|