@phillips/seldon 1.273.0 → 1.275.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/dist/_virtual/index10.cjs +1 -1
- package/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/_virtual/index9.js +2 -2
- package/dist/components/Article/Article.cjs +1 -1
- package/dist/components/Article/Article.js +17 -16
- package/dist/components/Card/Card.cjs +1 -1
- package/dist/components/Card/Card.js +14 -11
- package/dist/components/ExitGateCard/ExitGateCard.cjs +1 -1
- package/dist/components/ExitGateCard/ExitGateCard.js +18 -17
- package/dist/components/SeldonImage/SeldonImage.cjs +1 -1
- package/dist/components/SeldonImage/SeldonImage.d.ts +1 -1
- package/dist/components/SeldonImage/SeldonImage.js +45 -44
- package/dist/components/SeldonImage/SeldonImage.stories.d.ts +73 -6
- package/dist/components/SeldonImage/index.d.ts +1 -0
- package/dist/components/SeldonImage/types.cjs +1 -0
- package/dist/components/SeldonImage/types.d.ts +6 -0
- package/dist/components/SeldonImage/types.js +4 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +55 -53
- package/dist/node_modules/ics/dist/index.cjs +1 -1
- package/dist/node_modules/ics/dist/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.cjs +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/patterns/FavoritesCollectionTile/FavoritesCollectionTile.cjs +1 -1
- package/dist/patterns/FavoritesCollectionTile/FavoritesCollectionTile.js +35 -34
- package/dist/patterns/ObjectTile/ObjectTile.cjs +1 -1
- package/dist/patterns/ObjectTile/ObjectTile.js +31 -30
- package/dist/patterns/SaleHeaderBanner/SaleHeaderBanner.cjs +1 -1
- package/dist/patterns/SaleHeaderBanner/SaleHeaderBanner.js +32 -31
- package/dist/scss/components/SeldonImage/_seldonImage.scss +21 -0
- package/dist/scss/site-furniture/Footer/_footer.scss +2 -11
- package/dist/static/test-image-1200x1600.jpg +0 -0
- package/dist/static/test-image-1600x1600.jpg +0 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={exports:{}};exports.__module=e;
|
package/dist/_virtual/index10.js
CHANGED
package/dist/_virtual/index9.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
|
package/dist/_virtual/index9.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),q=require("react"),j=require("../../utils/index.cjs"),p=require("../../_virtual/index2.cjs"),N=require("../SeldonImage/SeldonImage.cjs"),$=require("../SeldonImage/types.cjs"),s=require("../Text/Text.cjs"),u=require("../Text/types.cjs"),h=require("../Link/Link.cjs"),v=require("../Link/types.cjs"),o=q.forwardRef(({className:d,imageSrc:l,label:a,header:n,description:r,linkElement:m=h.default,linkLabel:i,linkHref:x,...c},_)=>{const{className:t,...f}=j.getCommonProps(c,"Article");return e.jsxs("article",{...f,className:p.default(t,d),...c,ref:_,children:[l?e.jsx(N.default,{aspectRatio:$.AspectRatio.Landscape,src:l,alt:n??""}):null,e.jsxs("div",{className:`${t}__content`,children:[a?e.jsx(s.default,{variant:u.TextVariants.labelSmall,className:`${t}__content-label`,children:a}):null,n?e.jsx(s.default,{variant:u.TextVariants.headingMedium,className:`${t}__content-title`,children:n}):null,r?e.jsx(s.default,{className:`${t}__content-description`,element:"p",children:r}):null,i?e.jsx(m,{href:x,variant:v.LinkVariants.linkMedium,className:`${t}__content-link`,children:i}):null]})]})});o.displayName="Article";exports.default=o;
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { jsxs as s, jsx as
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as N } from "react";
|
|
3
3
|
import { getCommonProps as h } from "../../utils/index.js";
|
|
4
4
|
import x from "../../_virtual/index2.js";
|
|
5
5
|
import $ from "../SeldonImage/SeldonImage.js";
|
|
6
|
-
import
|
|
6
|
+
import { AspectRatio as k } from "../SeldonImage/types.js";
|
|
7
|
+
import l from "../Text/Text.js";
|
|
7
8
|
import { TextVariants as c } from "../Text/types.js";
|
|
8
|
-
import
|
|
9
|
-
import { LinkVariants as
|
|
10
|
-
const
|
|
11
|
-
({ className:
|
|
12
|
-
const { className:
|
|
13
|
-
return /* @__PURE__ */ s("article", { ...
|
|
14
|
-
n ? /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */ s("div", { className: `${
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
m ? /* @__PURE__ */ l
|
|
19
|
-
|
|
9
|
+
import v from "../Link/Link.js";
|
|
10
|
+
import { LinkVariants as A } from "../Link/types.js";
|
|
11
|
+
const R = N(
|
|
12
|
+
({ className: p, imageSrc: n, label: r, header: a, description: m, linkElement: f = v, linkLabel: o, linkHref: d, ...i }, _) => {
|
|
13
|
+
const { className: t, ...u } = h(i, "Article");
|
|
14
|
+
return /* @__PURE__ */ s("article", { ...u, className: x(t, p), ...i, ref: _, children: [
|
|
15
|
+
n ? /* @__PURE__ */ e($, { aspectRatio: k.Landscape, src: n, alt: a ?? "" }) : null,
|
|
16
|
+
/* @__PURE__ */ s("div", { className: `${t}__content`, children: [
|
|
17
|
+
r ? /* @__PURE__ */ e(l, { variant: c.labelSmall, className: `${t}__content-label`, children: r }) : null,
|
|
18
|
+
a ? /* @__PURE__ */ e(l, { variant: c.headingMedium, className: `${t}__content-title`, children: a }) : null,
|
|
19
|
+
m ? /* @__PURE__ */ e(l, { className: `${t}__content-description`, element: "p", children: m }) : null,
|
|
20
|
+
o ? /* @__PURE__ */ e(f, { href: d, variant: A.linkMedium, className: `${t}__content-link`, children: o }) : null
|
|
20
21
|
] })
|
|
21
22
|
] });
|
|
22
23
|
}
|
|
23
24
|
);
|
|
24
|
-
|
|
25
|
+
R.displayName = "Article";
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
R as default
|
|
27
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),l=require("../../_virtual/index2.cjs"),s=require("react"),d=require("../../utils/index.cjs"),q=require("./types.cjs"),V=require("../Link/Link.cjs"),v=require("../Link/types.cjs"),i=require("../Text/Text.cjs"),n=require("../Text/types.cjs"),T=require("../Video/Video.cjs"),S=require("../SeldonImage/SeldonImage.cjs"),c=s.forwardRef(({element:e="div",className:t,id:a,variant:o=q.CardVariants.default,...m}
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),l=require("../../_virtual/index2.cjs"),s=require("react"),d=require("../../utils/index.cjs"),q=require("./types.cjs"),V=require("../Link/Link.cjs"),v=require("../Link/types.cjs"),i=require("../Text/Text.cjs"),n=require("../Text/types.cjs"),T=require("../Video/Video.cjs"),S=require("../SeldonImage/SeldonImage.cjs"),M=require("../SeldonImage/types.cjs"),c=s.forwardRef(({element:e="div",className:t,id:a,variant:o=q.CardVariants.default,...m},w)=>{const{className:f,...j}=d.getCommonProps({id:a,...m},"Card"),b=l.default(f,t,{[`${f}--${o}`]:o});return r.jsx(e,{className:b,id:a,ref:w,...j,...m})}),u=s.forwardRef(({aspectRatio:e=M.AspectRatio.Landscape,...t},a)=>r.jsx(S.default,{...t,aspectRatio:e,className:`${d.px}-card__image`,ref:a})),C=s.forwardRef(({aspectRatio:e=16/9,className:t,...a},o)=>r.jsx(T.default,{...a,ref:o,aspectRatio:e,className:l.default(`${d.px}-card__video`,t)})),p=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{...t,className:l.default(`${d.px}-card__details`,e),ref:a})),x=s.forwardRef(({className:e,...t},a)=>r.jsx(i.default,{...t,className:l.default(`${d.px}-card__eyebrow`,e),ref:a,variant:n.TextVariants.labelSmall})),N=s.forwardRef(({className:e,...t},a)=>r.jsx(i.default,{...t,className:l.default(`${d.px}-card__title`,e),ref:a,variant:n.TextVariants.headingSmall})),_=s.forwardRef(({className:e,...t},a)=>r.jsx(i.default,{...t,className:l.default(`${d.px}-card__description`,e),ref:a,variant:n.TextVariants.bodySmall})),y=s.forwardRef(({className:e,...t},a)=>r.jsx(i.default,{...t,className:l.default(`${d.px}-card__badge`,e),ref:a,variant:n.TextVariants.badgeSmall})),R=s.forwardRef(({className:e,...t},a)=>r.jsx("div",{...t,className:l.default(`${d.px}-card__meta`,e),ref:a})),$=s.forwardRef(({className:e,...t},a)=>r.jsx(i.default,{...t,className:l.default(`${d.px}-card__meta-item`,e),ref:a,variant:n.TextVariants.labelSmall})),g=s.forwardRef(({className:e,variant:t=v.LinkVariants.linkSmall,...a},o)=>r.jsx(V.default,{...a,ref:o,className:l.default(`${d.px}-card__cta`,e),variant:t}));c.displayName="Card.Root";u.displayName="Card.Image";C.displayName="Card.Video";p.displayName="Card.Content";x.displayName="Card.Eyebrow";N.displayName="Card.Title";_.displayName="Card.Description";y.displayName="Card.Badge";R.displayName="Card.Meta";$.displayName="Card.MetaItem";g.displayName="Card.Cta";const I=Object.assign(c,{Root:c,Image:u,Video:C,Content:p,Eyebrow:x,Title:N,Description:_,Badge:y,Meta:R,MetaItem:$,Cta:g});exports.default=I;
|
|
@@ -3,12 +3,13 @@ import m from "../../_virtual/index2.js";
|
|
|
3
3
|
import { forwardRef as s } from "react";
|
|
4
4
|
import { getCommonProps as w, px as o } from "../../utils/index.js";
|
|
5
5
|
import { CardVariants as x } from "./types.js";
|
|
6
|
-
import
|
|
7
|
-
import { LinkVariants as
|
|
6
|
+
import R from "../Link/Link.js";
|
|
7
|
+
import { LinkVariants as T } from "../Link/types.js";
|
|
8
8
|
import i from "../Text/Text.js";
|
|
9
9
|
import { TextVariants as l } from "../Text/types.js";
|
|
10
10
|
import k from "../Video/Video.js";
|
|
11
11
|
import u from "../SeldonImage/SeldonImage.js";
|
|
12
|
+
import { AspectRatio as B } from "../SeldonImage/types.js";
|
|
12
13
|
const c = s(
|
|
13
14
|
({ element: e = "div", className: r, id: a, variant: d = x.default, ...n }, S) => {
|
|
14
15
|
const { className: C, ...V } = w({ id: a, ...n }, "Card"), M = m(C, r, {
|
|
@@ -16,7 +17,9 @@ const c = s(
|
|
|
16
17
|
});
|
|
17
18
|
return /* @__PURE__ */ t(e, { className: M, id: a, ref: S, ...V, ...n });
|
|
18
19
|
}
|
|
19
|
-
), p = s(
|
|
20
|
+
), p = s(
|
|
21
|
+
({ aspectRatio: e = B.Landscape, ...r }, a) => /* @__PURE__ */ t(u, { ...r, aspectRatio: e, className: `${o}-card__image`, ref: a })
|
|
22
|
+
), N = s(({ aspectRatio: e = 16 / 9, className: r, ...a }, d) => /* @__PURE__ */ t(k, { ...a, ref: d, aspectRatio: e, className: m(`${o}-card__video`, r) })), _ = s(({ className: e, ...r }, a) => /* @__PURE__ */ t("div", { ...r, className: m(`${o}-card__details`, e), ref: a })), f = s(({ className: e, ...r }, a) => /* @__PURE__ */ t(
|
|
20
23
|
i,
|
|
21
24
|
{
|
|
22
25
|
...r,
|
|
@@ -24,7 +27,7 @@ const c = s(
|
|
|
24
27
|
ref: a,
|
|
25
28
|
variant: l.labelSmall
|
|
26
29
|
}
|
|
27
|
-
)),
|
|
30
|
+
)), y = s(({ className: e, ...r }, a) => /* @__PURE__ */ t(
|
|
28
31
|
i,
|
|
29
32
|
{
|
|
30
33
|
...r,
|
|
@@ -49,26 +52,26 @@ const c = s(
|
|
|
49
52
|
variant: l.labelSmall
|
|
50
53
|
}
|
|
51
54
|
)), I = s(
|
|
52
|
-
({ className: e, variant: r =
|
|
55
|
+
({ className: e, variant: r = T.linkSmall, ...a }, d) => /* @__PURE__ */ t(R, { ...a, ref: d, className: m(`${o}-card__cta`, e), variant: r })
|
|
53
56
|
);
|
|
54
57
|
c.displayName = "Card.Root";
|
|
55
58
|
p.displayName = "Card.Image";
|
|
56
59
|
N.displayName = "Card.Video";
|
|
57
60
|
_.displayName = "Card.Content";
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
f.displayName = "Card.Eyebrow";
|
|
62
|
+
y.displayName = "Card.Title";
|
|
60
63
|
g.displayName = "Card.Description";
|
|
61
64
|
$.displayName = "Card.Badge";
|
|
62
65
|
b.displayName = "Card.Meta";
|
|
63
66
|
v.displayName = "Card.MetaItem";
|
|
64
67
|
I.displayName = "Card.Cta";
|
|
65
|
-
const
|
|
68
|
+
const H = Object.assign(c, {
|
|
66
69
|
Root: c,
|
|
67
70
|
Image: p,
|
|
68
71
|
Video: N,
|
|
69
72
|
Content: _,
|
|
70
|
-
Eyebrow:
|
|
71
|
-
Title:
|
|
73
|
+
Eyebrow: f,
|
|
74
|
+
Title: y,
|
|
72
75
|
Description: g,
|
|
73
76
|
Badge: $,
|
|
74
77
|
Meta: b,
|
|
@@ -76,5 +79,5 @@ const F = Object.assign(c, {
|
|
|
76
79
|
Cta: I
|
|
77
80
|
});
|
|
78
81
|
export {
|
|
79
|
-
|
|
82
|
+
H as default
|
|
80
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime")
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),g=require("../../_virtual/index2.cjs"),y=require("react"),v=require("../../utils/index.cjs"),b=require("../Button/Button.cjs"),C=require("../Button/types.cjs"),E=require("../SeldonImage/SeldonImage.cjs"),R=require("../SeldonImage/types.cjs"),a=require("../Text/Text.cjs"),d=require("../Text/types.cjs"),G=require("../Link/Link.cjs"),m=y.forwardRef(({className:x,imageSrc:s,label:n,header:r,description:l,linkLabel:i,linkHref:c,linkElement:o=G.default,variant:_=C.ButtonVariants.secondary,altText:f="Exit Gate Card Image",imageSrcSet:j,imageSizes:p,imageLoading:q,imageFetchPriority:N,...u},h)=>{const{className:t,...$}=v.getCommonProps(u,"ExitGateCard");return e.jsxs("article",{...$,className:g.default(t,x),...u,ref:h,children:[s?e.jsx(E.default,{objectFit:"cover",aspectRatio:R.AspectRatio.Landscape,src:s,alt:f,srcSet:j,sizes:p,loading:q,fetchPriority:N,className:`${t}__desktop_image`}):null,e.jsxs("div",{className:`${t}__content`,children:[n?e.jsx(a.default,{variant:d.TextVariants.labelMedium,element:"span",className:`${t}__content-label`,children:n}):null,r?e.jsx(a.default,{variant:d.TextVariants.headingLarge,element:"span",className:`${t}__content-title`,children:r}):null,l?e.jsx(a.default,{element:"span",className:`${t}__content-description`,children:l}):null,(i||o)&&c?e.jsx(o,{href:c,children:e.jsx(b.default,{variant:_,tabIndex:-1,className:`${t}__content-link`,children:i})}):null]})]})});m.displayName="ExitGateCard";exports.default=m;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import E from "../../_virtual/index2.js";
|
|
3
3
|
import { forwardRef as v } from "react";
|
|
4
4
|
import { getCommonProps as G } from "../../utils/index.js";
|
|
5
5
|
import b from "../Button/Button.js";
|
|
6
6
|
import { ButtonVariants as j } from "../Button/types.js";
|
|
7
7
|
import y from "../SeldonImage/SeldonImage.js";
|
|
8
|
+
import { AspectRatio as I } from "../SeldonImage/types.js";
|
|
8
9
|
import a from "../Text/Text.js";
|
|
9
10
|
import { TextVariants as p } from "../Text/types.js";
|
|
10
|
-
import
|
|
11
|
-
const
|
|
11
|
+
import P from "../Link/Link.js";
|
|
12
|
+
const R = v(
|
|
12
13
|
({
|
|
13
14
|
className: f,
|
|
14
15
|
imageSrc: r,
|
|
@@ -16,8 +17,8 @@ const P = v(
|
|
|
16
17
|
header: o,
|
|
17
18
|
description: s,
|
|
18
19
|
linkLabel: m,
|
|
19
|
-
linkHref:
|
|
20
|
-
linkElement:
|
|
20
|
+
linkHref: i,
|
|
21
|
+
linkElement: l = P,
|
|
21
22
|
variant: _ = j.secondary,
|
|
22
23
|
altText: u = "Exit Gate Card Image",
|
|
23
24
|
imageSrcSet: x,
|
|
@@ -26,32 +27,32 @@ const P = v(
|
|
|
26
27
|
imageFetchPriority: g,
|
|
27
28
|
...c
|
|
28
29
|
}, $) => {
|
|
29
|
-
const { className:
|
|
30
|
-
return /* @__PURE__ */ d("article", { ...C, className: E(
|
|
31
|
-
r ? /* @__PURE__ */
|
|
30
|
+
const { className: t, ...C } = G(c, "ExitGateCard");
|
|
31
|
+
return /* @__PURE__ */ d("article", { ...C, className: E(t, f), ...c, ref: $, children: [
|
|
32
|
+
r ? /* @__PURE__ */ e(
|
|
32
33
|
y,
|
|
33
34
|
{
|
|
34
35
|
objectFit: "cover",
|
|
35
|
-
aspectRatio:
|
|
36
|
+
aspectRatio: I.Landscape,
|
|
36
37
|
src: r,
|
|
37
38
|
alt: u,
|
|
38
39
|
srcSet: x,
|
|
39
40
|
sizes: N,
|
|
40
41
|
loading: h,
|
|
41
42
|
fetchPriority: g,
|
|
42
|
-
className: `${
|
|
43
|
+
className: `${t}__desktop_image`
|
|
43
44
|
}
|
|
44
45
|
) : null,
|
|
45
|
-
/* @__PURE__ */ d("div", { className: `${
|
|
46
|
-
n ? /* @__PURE__ */
|
|
47
|
-
o ? /* @__PURE__ */
|
|
48
|
-
s ? /* @__PURE__ */
|
|
49
|
-
(m ||
|
|
46
|
+
/* @__PURE__ */ d("div", { className: `${t}__content`, children: [
|
|
47
|
+
n ? /* @__PURE__ */ e(a, { variant: p.labelMedium, element: "span", className: `${t}__content-label`, children: n }) : null,
|
|
48
|
+
o ? /* @__PURE__ */ e(a, { variant: p.headingLarge, element: "span", className: `${t}__content-title`, children: o }) : null,
|
|
49
|
+
s ? /* @__PURE__ */ e(a, { element: "span", className: `${t}__content-description`, children: s }) : null,
|
|
50
|
+
(m || l) && i ? /* @__PURE__ */ e(l, { href: i, children: /* @__PURE__ */ e(b, { variant: _, tabIndex: -1, className: `${t}__content-link`, children: m }) }) : null
|
|
50
51
|
] })
|
|
51
52
|
] });
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
|
-
|
|
55
|
+
R.displayName = "ExitGateCard";
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
R as default
|
|
57
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),r=require("react"),u=require("../../_virtual/index2.cjs"),w=require("../../utils/index.cjs"),P=require("./utils.cjs"),v=require("./types.cjs"),x=require("../Icon/Icon.cjs"),C=typeof window>"u",y=r.memo(r.forwardRef(({className:N,aspectRatio:c=v.AspectRatio.None,objectFit:g="none",hasBlurBackground:h=!1,imageClassName:j,imageStyle:q,src:a,alt:f,srcSet:i,sizes:n,loading:E,fetchPriority:R,errorText:L="Error loading image",imageBlocked:t=!1,...$},S)=>{const{className:e,...b}=w.getCommonProps($,"SeldonImage"),I=r.useRef(null),[l,s]=r.useState(()=>{if(C)return"loading";const d=document.getElementById(a);if(d instanceof HTMLImageElement&&!d.classList.contains(`${e}-img--hidden`))return"loaded";const m=document.createElement("img");return i&&(m.srcset=i),n&&(m.sizes=n),m.src=a,m.complete?"loaded":"loading"}),p=r.useCallback(async()=>{const d=await P.isImageValid({img:I.current,src:a,srcSet:i,sizes:n});s(d?"loaded":"error")},[a,i,n]);return r.useEffect(()=>{p()},[p]),o.jsxs("div",{"data-chromatic":"ignore",ref:S,className:u.default(e,N,{[`${e}--aspect-ratio-${c.replace("/","-")}`]:c!==v.AspectRatio.None,[`${e}--error-image`]:l==="error"||t}),role:"img","aria-label":f,...$,...b,children:[h&&o.jsx("div",{className:u.default(`${e}-blur`,{[`${e}-blur--hidden`]:l==="loading"||l==="error"||t}),style:{backgroundImage:`url(${a})`}}),l==="error"||t?o.jsx("div",{className:`${e}--error`,children:t?o.jsx(x.default,{icon:"ImageUnavailable","aria-label":"Image Unavailable",role:"img"}):o.jsx(x.default,{icon:"PhillipsLogo","aria-label":L,role:"img",color:"$black-25"})}):null,o.jsx("img",{className:u.default(`${e}-img`,j,{[`${e}-img--hidden`]:l==="error"||t,[`${e}-img--object-fit-${g}`]:g!=="none"}),id:a,style:q,src:a,srcSet:i,sizes:n,alt:f,"data-testid":`${b["data-testid"]}-img`,ref:I,loading:E,fetchpriority:R,onLoad:()=>{s("loaded")},onError:()=>{s("error")}})]})}));y.displayName="SeldonImage";exports.default=y;
|
|
@@ -1,93 +1,94 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
1
|
+
import { jsxs as P, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { memo as R, forwardRef as S, useRef as j, useState as U, useCallback as V, useEffect as A } from "react";
|
|
3
3
|
import s from "../../_virtual/index2.js";
|
|
4
4
|
import { getCommonProps as H } from "../../utils/index.js";
|
|
5
5
|
import { isImageValid as M } from "./utils.js";
|
|
6
|
-
import I from "
|
|
7
|
-
|
|
6
|
+
import { AspectRatio as I } from "./types.js";
|
|
7
|
+
import N from "../Icon/Icon.js";
|
|
8
|
+
const T = typeof window > "u", q = R(
|
|
8
9
|
S(
|
|
9
10
|
({
|
|
10
11
|
className: h,
|
|
11
|
-
aspectRatio: g =
|
|
12
|
+
aspectRatio: g = I.None,
|
|
12
13
|
objectFit: c = "none",
|
|
13
14
|
hasBlurBackground: v = !1,
|
|
14
15
|
imageClassName: y,
|
|
15
|
-
imageStyle:
|
|
16
|
-
src:
|
|
16
|
+
imageStyle: E,
|
|
17
|
+
src: o,
|
|
17
18
|
alt: f,
|
|
18
|
-
srcSet:
|
|
19
|
+
srcSet: a,
|
|
19
20
|
sizes: r,
|
|
20
|
-
loading:
|
|
21
|
-
fetchPriority:
|
|
22
|
-
errorText:
|
|
23
|
-
imageBlocked:
|
|
21
|
+
loading: L,
|
|
22
|
+
fetchPriority: w,
|
|
23
|
+
errorText: x = "Error loading image",
|
|
24
|
+
imageBlocked: i = !1,
|
|
24
25
|
...u
|
|
25
|
-
},
|
|
26
|
-
const { className: e,
|
|
26
|
+
}, C) => {
|
|
27
|
+
const { className: e, ...p } = H(u, "SeldonImage"), $ = j(null), [n, t] = U(() => {
|
|
27
28
|
if (T)
|
|
28
29
|
return "loading";
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
30
|
+
const m = document.getElementById(o);
|
|
31
|
+
if (m instanceof HTMLImageElement && !m.classList.contains(`${e}-img--hidden`))
|
|
31
32
|
return "loaded";
|
|
32
33
|
const d = document.createElement("img");
|
|
33
|
-
return
|
|
34
|
-
}), b =
|
|
35
|
-
const
|
|
36
|
-
img:
|
|
37
|
-
src:
|
|
38
|
-
srcSet:
|
|
34
|
+
return a && (d.srcset = a), r && (d.sizes = r), d.src = o, d.complete ? "loaded" : "loading";
|
|
35
|
+
}), b = V(async () => {
|
|
36
|
+
const m = await M({
|
|
37
|
+
img: $.current,
|
|
38
|
+
src: o,
|
|
39
|
+
srcSet: a,
|
|
39
40
|
sizes: r
|
|
40
41
|
});
|
|
41
|
-
m
|
|
42
|
-
}, [
|
|
43
|
-
return
|
|
42
|
+
t(m ? "loaded" : "error");
|
|
43
|
+
}, [o, a, r]);
|
|
44
|
+
return A(() => {
|
|
44
45
|
b();
|
|
45
|
-
}, [b]), /* @__PURE__ */
|
|
46
|
+
}, [b]), /* @__PURE__ */ P(
|
|
46
47
|
"div",
|
|
47
48
|
{
|
|
48
49
|
"data-chromatic": "ignore",
|
|
49
|
-
ref:
|
|
50
|
+
ref: C,
|
|
50
51
|
className: s(e, h, {
|
|
51
|
-
[`${e}--aspect-ratio-${g.replace("/", "-")}`]: g !==
|
|
52
|
-
[`${e}--error-image`]:
|
|
52
|
+
[`${e}--aspect-ratio-${g.replace("/", "-")}`]: g !== I.None,
|
|
53
|
+
[`${e}--error-image`]: n === "error" || i
|
|
53
54
|
}),
|
|
54
55
|
role: "img",
|
|
55
56
|
"aria-label": f,
|
|
56
57
|
...u,
|
|
57
|
-
|
|
58
|
+
...p,
|
|
58
59
|
children: [
|
|
59
60
|
v && /* @__PURE__ */ l(
|
|
60
61
|
"div",
|
|
61
62
|
{
|
|
62
63
|
className: s(`${e}-blur`, {
|
|
63
|
-
[`${e}-blur--hidden`]:
|
|
64
|
+
[`${e}-blur--hidden`]: n === "loading" || n === "error" || i
|
|
64
65
|
}),
|
|
65
|
-
style: { backgroundImage: `url(${
|
|
66
|
+
style: { backgroundImage: `url(${o})` }
|
|
66
67
|
}
|
|
67
68
|
),
|
|
68
|
-
|
|
69
|
+
n === "error" || i ? /* @__PURE__ */ l("div", { className: `${e}--error`, children: i ? /* @__PURE__ */ l(N, { icon: "ImageUnavailable", "aria-label": "Image Unavailable", role: "img" }) : /* @__PURE__ */ l(N, { icon: "PhillipsLogo", "aria-label": x, role: "img", color: "$black-25" }) }) : null,
|
|
69
70
|
/* @__PURE__ */ l(
|
|
70
71
|
"img",
|
|
71
72
|
{
|
|
72
73
|
className: s(`${e}-img`, y, {
|
|
73
|
-
[`${e}-img--hidden`]:
|
|
74
|
+
[`${e}-img--hidden`]: n === "error" || i,
|
|
74
75
|
[`${e}-img--object-fit-${c}`]: c !== "none"
|
|
75
76
|
}),
|
|
76
|
-
id:
|
|
77
|
-
style:
|
|
78
|
-
src:
|
|
79
|
-
srcSet:
|
|
77
|
+
id: o,
|
|
78
|
+
style: E,
|
|
79
|
+
src: o,
|
|
80
|
+
srcSet: a,
|
|
80
81
|
sizes: r,
|
|
81
82
|
alt: f,
|
|
82
|
-
"data-testid": `${
|
|
83
|
-
ref:
|
|
84
|
-
loading:
|
|
85
|
-
fetchpriority:
|
|
83
|
+
"data-testid": `${p["data-testid"]}-img`,
|
|
84
|
+
ref: $,
|
|
85
|
+
loading: L,
|
|
86
|
+
fetchpriority: w,
|
|
86
87
|
onLoad: () => {
|
|
87
|
-
|
|
88
|
+
t("loaded");
|
|
88
89
|
},
|
|
89
90
|
onError: () => {
|
|
90
|
-
|
|
91
|
+
t("error");
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
94
|
)
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { Decorator } from '@storybook/react-vite';
|
|
1
2
|
import { default as SeldonImage } from './SeldonImage';
|
|
3
|
+
import { AspectRatio } from './types';
|
|
2
4
|
declare const meta: {
|
|
3
5
|
title: string;
|
|
4
6
|
component: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<import('./SeldonImage').SeldonImageProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>>;
|
|
7
|
+
argTypes: {
|
|
8
|
+
aspectRatio: {
|
|
9
|
+
control: "select";
|
|
10
|
+
options: AspectRatio[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
5
13
|
};
|
|
6
14
|
export default meta;
|
|
7
15
|
export declare const Playground: {
|
|
@@ -9,16 +17,75 @@ export declare const Playground: {
|
|
|
9
17
|
args: {
|
|
10
18
|
src: string;
|
|
11
19
|
alt: string;
|
|
12
|
-
aspectRatio:
|
|
20
|
+
aspectRatio: AspectRatio;
|
|
13
21
|
};
|
|
14
|
-
|
|
22
|
+
decorators: Decorator[];
|
|
23
|
+
};
|
|
24
|
+
export declare const AspectRatioLandscape: {
|
|
25
|
+
(props: React.ComponentProps<typeof SeldonImage>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
args: {
|
|
27
|
+
src: string;
|
|
28
|
+
alt: string;
|
|
29
|
+
aspectRatio: AspectRatio;
|
|
30
|
+
objectFit: string;
|
|
31
|
+
};
|
|
32
|
+
decorators: Decorator[];
|
|
33
|
+
};
|
|
34
|
+
export declare const AspectRatioPortrait: {
|
|
35
|
+
(props: React.ComponentProps<typeof SeldonImage>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
args: {
|
|
37
|
+
src: string;
|
|
38
|
+
alt: string;
|
|
39
|
+
aspectRatio: AspectRatio;
|
|
40
|
+
objectFit: string;
|
|
41
|
+
};
|
|
42
|
+
decorators: Decorator[];
|
|
43
|
+
};
|
|
44
|
+
export declare const AspectRatioSquare: {
|
|
45
|
+
(props: React.ComponentProps<typeof SeldonImage>): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
args: {
|
|
47
|
+
src: string;
|
|
48
|
+
alt: string;
|
|
49
|
+
aspectRatio: AspectRatio;
|
|
50
|
+
objectFit: string;
|
|
51
|
+
};
|
|
52
|
+
decorators: Decorator[];
|
|
53
|
+
};
|
|
54
|
+
export declare const AspectRatioPortraitHeightConstrained: {
|
|
55
|
+
(props: React.ComponentProps<typeof SeldonImage>): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
args: {
|
|
57
|
+
src: string;
|
|
58
|
+
alt: string;
|
|
59
|
+
aspectRatio: AspectRatio;
|
|
60
|
+
objectFit: string;
|
|
61
|
+
};
|
|
62
|
+
decorators: Decorator[];
|
|
63
|
+
};
|
|
64
|
+
export declare const AspectRatioSquareHeightConstrained: {
|
|
65
|
+
(props: React.ComponentProps<typeof SeldonImage>): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
args: {
|
|
67
|
+
src: string;
|
|
68
|
+
alt: string;
|
|
69
|
+
aspectRatio: AspectRatio;
|
|
70
|
+
objectFit: string;
|
|
71
|
+
};
|
|
72
|
+
decorators: Decorator[];
|
|
73
|
+
};
|
|
74
|
+
export declare const AspectRatioNone: {
|
|
75
|
+
(props: React.ComponentProps<typeof SeldonImage>): import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
args: {
|
|
77
|
+
src: string;
|
|
78
|
+
alt: string;
|
|
79
|
+
aspectRatio: AspectRatio;
|
|
80
|
+
};
|
|
81
|
+
decorators: Decorator[];
|
|
15
82
|
};
|
|
16
83
|
export declare const CircleImage: {
|
|
17
84
|
(props: React.ComponentProps<typeof SeldonImage>): import("react/jsx-runtime").JSX.Element;
|
|
18
85
|
args: {
|
|
19
86
|
src: string;
|
|
20
87
|
alt: string;
|
|
21
|
-
aspectRatio:
|
|
88
|
+
aspectRatio: AspectRatio;
|
|
22
89
|
objectFit: string;
|
|
23
90
|
imageStyle: {
|
|
24
91
|
borderRadius: string;
|
|
@@ -31,7 +98,7 @@ export declare const BlurBackground: {
|
|
|
31
98
|
args: {
|
|
32
99
|
src: string;
|
|
33
100
|
alt: string;
|
|
34
|
-
aspectRatio:
|
|
101
|
+
aspectRatio: AspectRatio;
|
|
35
102
|
objectFit: string;
|
|
36
103
|
hasBlurBackground: boolean;
|
|
37
104
|
};
|
|
@@ -42,7 +109,7 @@ export declare const BrokenImage: {
|
|
|
42
109
|
args: {
|
|
43
110
|
src: string;
|
|
44
111
|
alt: string;
|
|
45
|
-
aspectRatio:
|
|
112
|
+
aspectRatio: AspectRatio;
|
|
46
113
|
objectFit: string;
|
|
47
114
|
};
|
|
48
115
|
argTypes: {};
|
|
@@ -52,7 +119,7 @@ export declare const ImageBlocked: {
|
|
|
52
119
|
args: {
|
|
53
120
|
src: string;
|
|
54
121
|
alt: string;
|
|
55
|
-
aspectRatio:
|
|
122
|
+
aspectRatio: AspectRatio;
|
|
56
123
|
objectFit: string;
|
|
57
124
|
imageBlocked: boolean;
|
|
58
125
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var r=(e=>(e.Landscape="16/9",e.Portrait="3/4",e.Square="1/1",e.None="none",e))(r||{});exports.AspectRatio=r;
|