@getflip/swirl-components 0.162.0 → 0.164.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/components.json +106 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-avatar.cjs.entry.js +13 -1
- package/dist/cjs/swirl-box.cjs.entry.js +4 -0
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-image-grid-item.cjs.entry.js +16 -2
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-avatar/swirl-avatar.js +71 -3
- package/dist/collection/components/swirl-box/swirl-box.js +38 -0
- package/dist/collection/components/swirl-image-grid-item/swirl-image-grid-item.css +14 -0
- package/dist/collection/components/swirl-image-grid-item/swirl-image-grid-item.js +48 -2
- package/dist/collection/components/swirl-image-grid-item/swirl-image-grid-item.stories.js +1 -1
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/swirl-avatar.js +19 -3
- package/dist/components/swirl-box2.js +6 -0
- package/dist/components/swirl-image-grid-item.js +25 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-avatar.entry.js +14 -2
- package/dist/esm/swirl-box.entry.js +4 -0
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-image-grid-item.entry.js +17 -3
- package/dist/swirl-components/p-c178103e.entry.js +1 -0
- package/dist/swirl-components/p-d43c4a4b.entry.js +1 -0
- package/dist/swirl-components/p-fb31fb32.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-avatar/swirl-avatar.d.ts +8 -0
- package/dist/types/components/swirl-box/swirl-box.d.ts +2 -0
- package/dist/types/components/swirl-image-grid-item/swirl-image-grid-item.d.ts +5 -0
- package/dist/types/components.d.ts +20 -2
- package/package.json +1 -1
- package/vscode-data.json +23 -0
- package/dist/swirl-components/p-1a46d85f.entry.js +0 -1
- package/dist/swirl-components/p-3aa956d6.entry.js +0 -1
- package/dist/swirl-components/p-b4c0ac86.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, Host } from "@stencil/core";
|
|
1
|
+
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
const swirlAvatarSizeMappings = {
|
|
4
4
|
"3xs": 20,
|
|
@@ -17,9 +17,15 @@ export class SwirlAvatar {
|
|
|
17
17
|
constructor() {
|
|
18
18
|
this.setImageAvailable = () => {
|
|
19
19
|
this.imageAvailable = true;
|
|
20
|
+
this.loadingError = false;
|
|
21
|
+
this.loaded = true;
|
|
22
|
+
this.imageLoad.emit();
|
|
20
23
|
};
|
|
21
24
|
this.setImageUnavailable = () => {
|
|
22
25
|
this.imageAvailable = false;
|
|
26
|
+
this.loaded = true;
|
|
27
|
+
this.loadingError = true;
|
|
28
|
+
this.imageError.emit();
|
|
23
29
|
};
|
|
24
30
|
this.onKeydown = (event) => {
|
|
25
31
|
// The interactive avatar is activated by the space key on the keyup event,
|
|
@@ -47,12 +53,16 @@ export class SwirlAvatar {
|
|
|
47
53
|
this.initials = undefined;
|
|
48
54
|
this.interactive = false;
|
|
49
55
|
this.label = undefined;
|
|
56
|
+
this.loading = undefined;
|
|
50
57
|
this.showLabel = false;
|
|
51
58
|
this.size = "m";
|
|
52
59
|
this.src = undefined;
|
|
53
60
|
this.toolPosition = "bottom";
|
|
54
61
|
this.variant = "round";
|
|
62
|
+
this.loadingError = false;
|
|
63
|
+
this.loaded = false;
|
|
55
64
|
this.imageAvailable = undefined;
|
|
65
|
+
this.inViewport = false;
|
|
56
66
|
}
|
|
57
67
|
watchSrcProp() {
|
|
58
68
|
this.imageAvailable = undefined;
|
|
@@ -72,7 +82,7 @@ export class SwirlAvatar {
|
|
|
72
82
|
});
|
|
73
83
|
const badgeClassName = classnames("avatar__badge", `avatar__badge--position-${this.badgePosition}`);
|
|
74
84
|
const toolClassName = classnames("avatar__tool", `avatar__tool--position-${this.toolPosition}`);
|
|
75
|
-
return (h(Host, { "aria-label": this.label, onKeydown: this.interactive ? this.onKeydown : undefined, onKeyup: this.interactive ? this.onKeyup : undefined, role: role, tabIndex: this.interactive ? 0 : undefined }, h("span", { class: className, part: "avatar" }, showImage && (h("span", { class: "avatar__image" }, h("img", { alt: "", height: swirlAvatarSizeMappings[this.size], onError: this.setImageUnavailable, onLoad: this.setImageAvailable, src: this.src, width: swirlAvatarSizeMappings[this.size] }))), showInitials && (h("span", { class: "avatar__initials" }, h("span", null, this.initials))), showIcon && h("span", { class: "avatar__icon", innerHTML: this.icon }), showFallbackIcon && (h("span", { class: "avatar__icon" }, h("swirl-icon-person", null))), showBadge && (h("span", { class: badgeClassName, innerHTML: this.badge })), h("span", { class: toolClassName }, h("slot", { name: "tool" }))), this.showLabel && (h("span", { "aria-hidden": true, class: "avatar__label" }, this.label))));
|
|
85
|
+
return (h(Host, { "aria-label": this.label, onKeydown: this.interactive ? this.onKeydown : undefined, onKeyup: this.interactive ? this.onKeyup : undefined, role: role, tabIndex: this.interactive ? 0 : undefined }, h("span", { class: className, part: "avatar" }, showImage && (h("span", { class: "avatar__image" }, h("img", { alt: "", height: swirlAvatarSizeMappings[this.size], loading: this.loading, onError: this.setImageUnavailable, onLoad: this.setImageAvailable, src: this.src, width: swirlAvatarSizeMappings[this.size] }))), showInitials && (h("span", { class: "avatar__initials" }, h("span", null, this.initials))), showIcon && h("span", { class: "avatar__icon", innerHTML: this.icon }), showFallbackIcon && (h("span", { class: "avatar__icon" }, h("swirl-icon-person", null))), showBadge && (h("span", { class: badgeClassName, innerHTML: this.badge })), h("span", { class: toolClassName }, h("slot", { name: "tool" }))), this.showLabel && (h("span", { "aria-hidden": true, class: "avatar__label" }, this.label))));
|
|
76
86
|
}
|
|
77
87
|
static get is() { return "swirl-avatar"; }
|
|
78
88
|
static get encapsulation() { return "shadow"; }
|
|
@@ -220,6 +230,28 @@ export class SwirlAvatar {
|
|
|
220
230
|
"attribute": "label",
|
|
221
231
|
"reflect": false
|
|
222
232
|
},
|
|
233
|
+
"loading": {
|
|
234
|
+
"type": "string",
|
|
235
|
+
"mutable": false,
|
|
236
|
+
"complexType": {
|
|
237
|
+
"original": "SwirlAvatarLoading",
|
|
238
|
+
"resolved": "\"auto\" | \"eager\" | \"lazy\"",
|
|
239
|
+
"references": {
|
|
240
|
+
"SwirlAvatarLoading": {
|
|
241
|
+
"location": "local",
|
|
242
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-avatar/swirl-avatar.tsx"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": true,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": ""
|
|
251
|
+
},
|
|
252
|
+
"attribute": "loading",
|
|
253
|
+
"reflect": false
|
|
254
|
+
},
|
|
223
255
|
"showLabel": {
|
|
224
256
|
"type": "boolean",
|
|
225
257
|
"mutable": false,
|
|
@@ -328,9 +360,45 @@ export class SwirlAvatar {
|
|
|
328
360
|
}
|
|
329
361
|
static get states() {
|
|
330
362
|
return {
|
|
331
|
-
"
|
|
363
|
+
"loadingError": {},
|
|
364
|
+
"loaded": {},
|
|
365
|
+
"imageAvailable": {},
|
|
366
|
+
"inViewport": {}
|
|
332
367
|
};
|
|
333
368
|
}
|
|
369
|
+
static get events() {
|
|
370
|
+
return [{
|
|
371
|
+
"method": "imageError",
|
|
372
|
+
"name": "imageError",
|
|
373
|
+
"bubbles": true,
|
|
374
|
+
"cancelable": true,
|
|
375
|
+
"composed": true,
|
|
376
|
+
"docs": {
|
|
377
|
+
"tags": [],
|
|
378
|
+
"text": ""
|
|
379
|
+
},
|
|
380
|
+
"complexType": {
|
|
381
|
+
"original": "void",
|
|
382
|
+
"resolved": "void",
|
|
383
|
+
"references": {}
|
|
384
|
+
}
|
|
385
|
+
}, {
|
|
386
|
+
"method": "imageLoad",
|
|
387
|
+
"name": "imageLoad",
|
|
388
|
+
"bubbles": true,
|
|
389
|
+
"cancelable": true,
|
|
390
|
+
"composed": true,
|
|
391
|
+
"docs": {
|
|
392
|
+
"tags": [],
|
|
393
|
+
"text": ""
|
|
394
|
+
},
|
|
395
|
+
"complexType": {
|
|
396
|
+
"original": "void",
|
|
397
|
+
"resolved": "void",
|
|
398
|
+
"references": {}
|
|
399
|
+
}
|
|
400
|
+
}];
|
|
401
|
+
}
|
|
334
402
|
static get elementRef() { return "element"; }
|
|
335
403
|
static get watchers() {
|
|
336
404
|
return [{
|
|
@@ -28,7 +28,9 @@ export class SwirlBox {
|
|
|
28
28
|
this.paddingInlineStart = undefined;
|
|
29
29
|
this.position = undefined;
|
|
30
30
|
this.right = undefined;
|
|
31
|
+
this.basis = undefined;
|
|
31
32
|
this.shrink = undefined;
|
|
33
|
+
this.grow = undefined;
|
|
32
34
|
this.top = undefined;
|
|
33
35
|
this.width = undefined;
|
|
34
36
|
this.zIndex = undefined;
|
|
@@ -38,7 +40,9 @@ export class SwirlBox {
|
|
|
38
40
|
alignItems: this.centerBlock ? "center" : undefined,
|
|
39
41
|
bottom: this.bottom,
|
|
40
42
|
display: this.centerBlock || this.centerInline ? "flex" : undefined,
|
|
43
|
+
flexBasis: this.basis,
|
|
41
44
|
flexShrink: this.shrink,
|
|
45
|
+
flexGrow: this.grow,
|
|
42
46
|
height: this.cover ? "100%" : this.height,
|
|
43
47
|
justifyContent: this.centerInline ? "center" : undefined,
|
|
44
48
|
left: this.left,
|
|
@@ -520,6 +524,23 @@ export class SwirlBox {
|
|
|
520
524
|
"attribute": "right",
|
|
521
525
|
"reflect": false
|
|
522
526
|
},
|
|
527
|
+
"basis": {
|
|
528
|
+
"type": "string",
|
|
529
|
+
"mutable": false,
|
|
530
|
+
"complexType": {
|
|
531
|
+
"original": "string",
|
|
532
|
+
"resolved": "string",
|
|
533
|
+
"references": {}
|
|
534
|
+
},
|
|
535
|
+
"required": false,
|
|
536
|
+
"optional": true,
|
|
537
|
+
"docs": {
|
|
538
|
+
"tags": [],
|
|
539
|
+
"text": ""
|
|
540
|
+
},
|
|
541
|
+
"attribute": "basis",
|
|
542
|
+
"reflect": false
|
|
543
|
+
},
|
|
523
544
|
"shrink": {
|
|
524
545
|
"type": "string",
|
|
525
546
|
"mutable": false,
|
|
@@ -537,6 +558,23 @@ export class SwirlBox {
|
|
|
537
558
|
"attribute": "shrink",
|
|
538
559
|
"reflect": false
|
|
539
560
|
},
|
|
561
|
+
"grow": {
|
|
562
|
+
"type": "string",
|
|
563
|
+
"mutable": false,
|
|
564
|
+
"complexType": {
|
|
565
|
+
"original": "string",
|
|
566
|
+
"resolved": "string",
|
|
567
|
+
"references": {}
|
|
568
|
+
},
|
|
569
|
+
"required": false,
|
|
570
|
+
"optional": true,
|
|
571
|
+
"docs": {
|
|
572
|
+
"tags": [],
|
|
573
|
+
"text": ""
|
|
574
|
+
},
|
|
575
|
+
"attribute": "grow",
|
|
576
|
+
"reflect": false
|
|
577
|
+
},
|
|
540
578
|
"top": {
|
|
541
579
|
"type": "string",
|
|
542
580
|
"mutable": false,
|
|
@@ -46,6 +46,10 @@ button.image-grid-item:focus-visible {
|
|
|
46
46
|
outline-offset: var(--s-space-2);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
.image-grid-item--has-error .image-grid-item__image {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
.image-grid-item--has-overlay .image-grid-item__image {
|
|
50
54
|
scale: 1.1;
|
|
51
55
|
filter: blur(5px);
|
|
@@ -117,3 +121,13 @@ button.image-grid-item:focus-visible {
|
|
|
117
121
|
background-color: rgba(0, 0, 0, 0.4);
|
|
118
122
|
inset: 0;
|
|
119
123
|
}
|
|
124
|
+
|
|
125
|
+
.image-grid-item__error {
|
|
126
|
+
position: absolute;
|
|
127
|
+
z-index: 3;
|
|
128
|
+
display: flex;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
align-items: center;
|
|
131
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
132
|
+
inset: 0;
|
|
133
|
+
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { h, Host } from "@stencil/core";
|
|
1
|
+
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
export class SwirlImageGridItem {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.onLoad = () => {
|
|
6
|
+
this.error = false;
|
|
6
7
|
this.loaded = true;
|
|
8
|
+
this.imageLoad.emit();
|
|
9
|
+
};
|
|
10
|
+
this.onError = () => {
|
|
11
|
+
this.loaded = true;
|
|
12
|
+
this.error = true;
|
|
13
|
+
this.imageError.emit();
|
|
7
14
|
};
|
|
8
15
|
this.alt = undefined;
|
|
9
16
|
this.icon = undefined;
|
|
@@ -11,6 +18,7 @@ export class SwirlImageGridItem {
|
|
|
11
18
|
this.loading = undefined;
|
|
12
19
|
this.overlay = undefined;
|
|
13
20
|
this.src = undefined;
|
|
21
|
+
this.error = false;
|
|
14
22
|
this.loaded = false;
|
|
15
23
|
this.inViewport = false;
|
|
16
24
|
}
|
|
@@ -37,6 +45,7 @@ export class SwirlImageGridItem {
|
|
|
37
45
|
render() {
|
|
38
46
|
const Tag = this.interactive ? "button" : "div";
|
|
39
47
|
const className = classnames("image-grid-item", {
|
|
48
|
+
"image-grid-item--has-error": this.error,
|
|
40
49
|
"image-grid-item--has-overlay": this.overlay,
|
|
41
50
|
});
|
|
42
51
|
return (h(Host, { role: "listitem" }, h(Tag, { class: className, type: this.interactive ? "button" : undefined }, h("div", { class: "image-grid-item__background", style: {
|
|
@@ -45,7 +54,10 @@ export class SwirlImageGridItem {
|
|
|
45
54
|
this.loaded
|
|
46
55
|
? `url(${this.src})`
|
|
47
56
|
: undefined,
|
|
48
|
-
} }), this.loading !== "intersecting" || this.inViewport ? (h("img", { alt: this.alt, class: "image-grid-item__image", loading: this.loading !== "intersecting" ? this.loading : undefined, onLoad: this.onLoad, src: this.src })) : (h("div", { class: "image-grid-item__loading-placeholder" })), this.loaded &&
|
|
57
|
+
} }), this.loading !== "intersecting" || this.inViewport ? (h("img", { alt: this.alt, class: "image-grid-item__image", loading: this.loading !== "intersecting" ? this.loading : undefined, onError: this.onError, onLoad: this.onLoad, src: this.src })) : (h("div", { class: "image-grid-item__loading-placeholder" })), this.loaded &&
|
|
58
|
+
!this.error &&
|
|
59
|
+
this.icon &&
|
|
60
|
+
!Boolean(this.overlay) && (h("div", { class: "image-grid-item__icon", innerHTML: this.icon })), this.overlay && (h("div", { class: "image-grid-item__overlay" }, this.overlay)), !this.loaded && (h("div", { class: "image-grid-item__spinner" }, h("swirl-spinner", null))), this.loaded && this.error && (h("div", { class: "image-grid-item__error" }, h("swirl-icon-error", { color: "critical" }))))));
|
|
49
61
|
}
|
|
50
62
|
static get is() { return "swirl-image-grid-item"; }
|
|
51
63
|
static get encapsulation() { return "shadow"; }
|
|
@@ -172,9 +184,43 @@ export class SwirlImageGridItem {
|
|
|
172
184
|
}
|
|
173
185
|
static get states() {
|
|
174
186
|
return {
|
|
187
|
+
"error": {},
|
|
175
188
|
"loaded": {},
|
|
176
189
|
"inViewport": {}
|
|
177
190
|
};
|
|
178
191
|
}
|
|
192
|
+
static get events() {
|
|
193
|
+
return [{
|
|
194
|
+
"method": "imageError",
|
|
195
|
+
"name": "imageError",
|
|
196
|
+
"bubbles": true,
|
|
197
|
+
"cancelable": true,
|
|
198
|
+
"composed": true,
|
|
199
|
+
"docs": {
|
|
200
|
+
"tags": [],
|
|
201
|
+
"text": ""
|
|
202
|
+
},
|
|
203
|
+
"complexType": {
|
|
204
|
+
"original": "void",
|
|
205
|
+
"resolved": "void",
|
|
206
|
+
"references": {}
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
"method": "imageLoad",
|
|
210
|
+
"name": "imageLoad",
|
|
211
|
+
"bubbles": true,
|
|
212
|
+
"cancelable": true,
|
|
213
|
+
"composed": true,
|
|
214
|
+
"docs": {
|
|
215
|
+
"tags": [],
|
|
216
|
+
"text": ""
|
|
217
|
+
},
|
|
218
|
+
"complexType": {
|
|
219
|
+
"original": "void",
|
|
220
|
+
"resolved": "void",
|
|
221
|
+
"references": {}
|
|
222
|
+
}
|
|
223
|
+
}];
|
|
224
|
+
}
|
|
179
225
|
static get elementRef() { return "el"; }
|
|
180
226
|
}
|