@phillips/seldon 1.221.0 → 1.223.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.
|
@@ -1,85 +1,87 @@
|
|
|
1
|
-
import { jsxs as w, jsx as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { jsxs as w, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { memo as L, forwardRef as C, useRef as S, useState as T, useCallback as V, useEffect as j } from "react";
|
|
3
3
|
import d from "../../node_modules/classnames/index.js";
|
|
4
|
-
import { getCommonProps as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
4
|
+
import { getCommonProps as k } from "../../utils/index.js";
|
|
5
|
+
import { TextVariants as M } from "../Text/types.js";
|
|
6
|
+
import P from "../Text/Text.js";
|
|
7
|
+
import { isImageValid as R } from "./utils.js";
|
|
8
|
+
const B = typeof window > "u", H = L(
|
|
8
9
|
C(
|
|
9
10
|
({
|
|
10
11
|
className: I,
|
|
11
12
|
aspectRatio: s = "none",
|
|
12
13
|
objectFit: g = "none",
|
|
13
|
-
hasBlurBackground:
|
|
14
|
-
imageClassName:
|
|
15
|
-
imageStyle:
|
|
16
|
-
src:
|
|
17
|
-
alt:
|
|
18
|
-
srcSet:
|
|
14
|
+
hasBlurBackground: y = !1,
|
|
15
|
+
imageClassName: N,
|
|
16
|
+
imageStyle: b,
|
|
17
|
+
src: a,
|
|
18
|
+
alt: f,
|
|
19
|
+
srcSet: o,
|
|
19
20
|
sizes: r,
|
|
20
|
-
loading:
|
|
21
|
-
fetchPriority:
|
|
22
|
-
errorText:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const { className: e, ...u } =
|
|
26
|
-
if (
|
|
21
|
+
loading: h,
|
|
22
|
+
fetchPriority: v,
|
|
23
|
+
errorText: x = "Image Unavailable",
|
|
24
|
+
...c
|
|
25
|
+
}, E) => {
|
|
26
|
+
const { className: e, ...u } = k(c, "SeldonImage"), p = S(null), [n, i] = T(() => {
|
|
27
|
+
if (B)
|
|
27
28
|
return "loading";
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
29
|
+
const t = document.getElementById(a);
|
|
30
|
+
if (t instanceof HTMLImageElement && !t.classList.contains(`${e}-img--hidden`))
|
|
30
31
|
return "loaded";
|
|
31
32
|
const m = document.createElement("img");
|
|
32
|
-
return
|
|
33
|
-
}), $ =
|
|
34
|
-
const
|
|
33
|
+
return o && (m.srcset = o), r && (m.sizes = r), m.src = a, m.complete ? "loaded" : "loading";
|
|
34
|
+
}), $ = V(async () => {
|
|
35
|
+
const t = await R({
|
|
35
36
|
img: p.current,
|
|
36
|
-
src:
|
|
37
|
-
srcSet:
|
|
37
|
+
src: a,
|
|
38
|
+
srcSet: o,
|
|
38
39
|
sizes: r
|
|
39
40
|
});
|
|
40
|
-
i(
|
|
41
|
-
}, [
|
|
42
|
-
return
|
|
41
|
+
i(t ? "loaded" : "error");
|
|
42
|
+
}, [a, o, r]);
|
|
43
|
+
return j(() => {
|
|
43
44
|
$();
|
|
44
45
|
}, [$]), /* @__PURE__ */ w(
|
|
45
46
|
"div",
|
|
46
47
|
{
|
|
47
|
-
ref:
|
|
48
|
+
ref: E,
|
|
48
49
|
className: d(e, I, {
|
|
49
|
-
[`${e}--aspect-ratio-${s.replace("/", "-")}`]: s !== "none"
|
|
50
|
+
[`${e}--aspect-ratio-${s.replace("/", "-")}`]: s !== "none",
|
|
51
|
+
[`${e}--error-image`]: n === "error"
|
|
50
52
|
}),
|
|
51
53
|
role: "img",
|
|
52
|
-
"aria-label":
|
|
53
|
-
...
|
|
54
|
+
"aria-label": f,
|
|
55
|
+
...c,
|
|
54
56
|
...u,
|
|
55
57
|
children: [
|
|
56
|
-
|
|
58
|
+
y && /* @__PURE__ */ l(
|
|
57
59
|
"div",
|
|
58
60
|
{
|
|
59
61
|
className: d(`${e}-blur`, {
|
|
60
62
|
[`${e}-blur--hidden`]: n === "loading" || n === "error"
|
|
61
63
|
}),
|
|
62
|
-
style: { backgroundImage: `url(${
|
|
64
|
+
style: { backgroundImage: `url(${a})` }
|
|
63
65
|
}
|
|
64
66
|
),
|
|
65
|
-
n === "error" ? /* @__PURE__ */
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
+
n === "error" ? /* @__PURE__ */ l("div", { className: `${e}--error`, children: /* @__PURE__ */ l(P, { variant: M.displayMedium, className: `${e}--error-text`, children: x }) }) : null,
|
|
68
|
+
/* @__PURE__ */ l(
|
|
67
69
|
"img",
|
|
68
70
|
{
|
|
69
|
-
className: d(`${e}-img`,
|
|
71
|
+
className: d(`${e}-img`, N, {
|
|
70
72
|
[`${e}-img--hidden`]: n === "error",
|
|
71
73
|
[`${e}-img--object-fit-${g}`]: g !== "none"
|
|
72
74
|
}),
|
|
73
|
-
id:
|
|
74
|
-
style:
|
|
75
|
-
src:
|
|
76
|
-
srcSet:
|
|
75
|
+
id: a,
|
|
76
|
+
style: b,
|
|
77
|
+
src: a,
|
|
78
|
+
srcSet: o,
|
|
77
79
|
sizes: r,
|
|
78
|
-
alt:
|
|
80
|
+
alt: f,
|
|
79
81
|
"data-testid": `${u["data-testid"]}-img`,
|
|
80
82
|
ref: p,
|
|
81
|
-
loading:
|
|
82
|
-
fetchpriority:
|
|
83
|
+
loading: h,
|
|
84
|
+
fetchpriority: v,
|
|
83
85
|
onLoad: () => {
|
|
84
86
|
i("loaded");
|
|
85
87
|
},
|
|
@@ -94,7 +96,7 @@ const H = typeof window > "u", M = x(
|
|
|
94
96
|
}
|
|
95
97
|
)
|
|
96
98
|
);
|
|
97
|
-
|
|
99
|
+
H.displayName = "SeldonImage";
|
|
98
100
|
export {
|
|
99
|
-
|
|
101
|
+
H as default
|
|
100
102
|
};
|
|
@@ -15,14 +15,16 @@
|
|
|
15
15
|
&--error {
|
|
16
16
|
width: 100%;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
&-image {
|
|
19
|
+
background-color: $bg-soft;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
&-text {
|
|
23
|
+
color: $black-50;
|
|
23
24
|
left: 50%;
|
|
24
|
-
max-width: 50%;
|
|
25
25
|
position: absolute;
|
|
26
|
+
text-align: center;
|
|
27
|
+
text-transform: uppercase;
|
|
26
28
|
top: 50%;
|
|
27
29
|
transform: translate(-50%, -50%);
|
|
28
30
|
}
|
|
@@ -8,15 +8,16 @@
|
|
|
8
8
|
width: 635px;
|
|
9
9
|
|
|
10
10
|
@media (max-width: $breakpoint-md) {
|
|
11
|
-
height:
|
|
11
|
+
height: 100dvh;
|
|
12
12
|
width: 100%;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
&__wrapper {
|
|
17
17
|
display: flex;
|
|
18
|
+
flex: 1;
|
|
18
19
|
flex-direction: column;
|
|
19
|
-
height:
|
|
20
|
+
min-height: -webkit-fill-available;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
&__header {
|
|
@@ -84,6 +85,12 @@
|
|
|
84
85
|
&::placeholder {
|
|
85
86
|
font-variation-settings: 'wght' 700;
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
// Remove iOS gray background
|
|
90
|
+
@supports (-webkit-touch-callout: none) {
|
|
91
|
+
appearance: none;
|
|
92
|
+
background-color: $white-100;
|
|
93
|
+
}
|
|
87
94
|
}
|
|
88
95
|
}
|
|
89
96
|
|