@phillips/seldon 1.110.4 → 1.111.1
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,58 +1,58 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import
|
|
5
|
-
import { SupportedLanguages as
|
|
6
|
-
import { CountdownVariants as
|
|
7
|
-
import { Duration as
|
|
8
|
-
import { zhCN as
|
|
9
|
-
import { enUS as
|
|
10
|
-
import { differenceInDays as
|
|
11
|
-
import { differenceInHours as
|
|
12
|
-
import { differenceInMinutes as
|
|
13
|
-
import { differenceInSeconds as
|
|
14
|
-
const H =
|
|
1
|
+
import { jsxs as d, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as x, useState as $, useEffect as j, useMemo as z } from "react";
|
|
3
|
+
import { getCommonProps as M } from "../../utils/index.js";
|
|
4
|
+
import P from "../../node_modules/classnames/index.js";
|
|
5
|
+
import { SupportedLanguages as _ } from "../../types/commonTypes.js";
|
|
6
|
+
import { CountdownVariants as u } from "./types.js";
|
|
7
|
+
import { Duration as l } from "./Duration.js";
|
|
8
|
+
import { zhCN as E } from "../../node_modules/date-fns/locale/zh-CN.js";
|
|
9
|
+
import { enUS as F } from "../../node_modules/date-fns/locale/en-US.js";
|
|
10
|
+
import { differenceInDays as f } from "../../node_modules/date-fns/differenceInDays.js";
|
|
11
|
+
import { differenceInHours as p } from "../../node_modules/date-fns/differenceInHours.js";
|
|
12
|
+
import { differenceInMinutes as h } from "../../node_modules/date-fns/differenceInMinutes.js";
|
|
13
|
+
import { differenceInSeconds as w } from "../../node_modules/date-fns/differenceInSeconds.js";
|
|
14
|
+
const H = x(
|
|
15
15
|
({
|
|
16
|
-
endDateTime:
|
|
17
|
-
formatDurationStr:
|
|
18
|
-
label:
|
|
19
|
-
intervalDescription:
|
|
20
|
-
className:
|
|
21
|
-
locale:
|
|
22
|
-
showBottomBorder:
|
|
23
|
-
variant:
|
|
24
|
-
...
|
|
25
|
-
},
|
|
26
|
-
const { className:
|
|
27
|
-
days:
|
|
28
|
-
hours:
|
|
29
|
-
minutes:
|
|
30
|
-
seconds:
|
|
16
|
+
endDateTime: o,
|
|
17
|
+
formatDurationStr: e,
|
|
18
|
+
label: m = "Lots Close in",
|
|
19
|
+
intervalDescription: C,
|
|
20
|
+
className: y,
|
|
21
|
+
locale: I = "en",
|
|
22
|
+
showBottomBorder: N = !0,
|
|
23
|
+
variant: c = u.default,
|
|
24
|
+
...i
|
|
25
|
+
}, g) => {
|
|
26
|
+
const { className: t, ...L } = M(i, "Countdown"), [n, b] = $(/* @__PURE__ */ new Date()), a = I === _.zh ? E : F, r = {
|
|
27
|
+
days: f(o, n) > 0 ? f(o, n) : 0,
|
|
28
|
+
hours: p(o, n) > 0 ? p(o, n) % 24 : 0,
|
|
29
|
+
minutes: h(o, n) > 0 ? h(o, n) % 60 : 0,
|
|
30
|
+
seconds: (w(o, n) > 0 ? w(o, n) % 60 : 0) % 60
|
|
31
31
|
};
|
|
32
|
-
return
|
|
33
|
-
const
|
|
34
|
-
|
|
32
|
+
return j(() => {
|
|
33
|
+
const v = setInterval(() => {
|
|
34
|
+
b(/* @__PURE__ */ new Date());
|
|
35
35
|
}, 1e3);
|
|
36
|
-
return () => clearInterval(
|
|
37
|
-
}, [
|
|
36
|
+
return () => clearInterval(v);
|
|
37
|
+
}, [o]), z(() => new Date(o).getTime() > (/* @__PURE__ */ new Date()).getTime(), [o]) ? /* @__PURE__ */ d(
|
|
38
38
|
"div",
|
|
39
39
|
{
|
|
40
|
-
...
|
|
41
|
-
className:
|
|
42
|
-
[`${
|
|
43
|
-
[`${
|
|
40
|
+
...L,
|
|
41
|
+
className: P(t, y, {
|
|
42
|
+
[`${t}--compact`]: c === u.compact,
|
|
43
|
+
[`${t}--show-bottom-border`]: N
|
|
44
44
|
}),
|
|
45
|
-
...
|
|
46
|
-
ref:
|
|
45
|
+
...i,
|
|
46
|
+
ref: g,
|
|
47
47
|
children: [
|
|
48
|
-
/* @__PURE__ */ d("div", { className: `${
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
/* @__PURE__ */ d("div", { className: `${t}__countdown-container`, role: "timer", "aria-label": m, children: [
|
|
49
|
+
/* @__PURE__ */ s("span", { children: m }),
|
|
50
|
+
r.days > 0 ? /* @__PURE__ */ s(l, { duration: r, unit: "days", locale: a, formatDurationStr: e }) : null,
|
|
51
|
+
r.days > 0 || r.hours > 0 ? /* @__PURE__ */ s(l, { duration: r, unit: "hours", locale: a, formatDurationStr: e }) : null,
|
|
52
|
+
r.days === 0 ? /* @__PURE__ */ s(l, { duration: r, unit: "minutes", locale: a, formatDurationStr: e }) : null,
|
|
53
|
+
r.days === 0 && r.hours === 0 ? /* @__PURE__ */ s(l, { duration: r, unit: "seconds", locale: a, formatDurationStr: e }) : null
|
|
54
54
|
] }),
|
|
55
|
-
|
|
55
|
+
c === u.default ? /* @__PURE__ */ s("span", { children: C }) : null
|
|
56
56
|
]
|
|
57
57
|
}
|
|
58
58
|
) : null;
|
|
@@ -64,6 +64,10 @@ export interface SaleHeaderBannerProps extends ComponentProps<'div'> {
|
|
|
64
64
|
* An element to be rendered at the bottom of the banner
|
|
65
65
|
*/
|
|
66
66
|
footerElement?: React.ReactNode;
|
|
67
|
+
/**
|
|
68
|
+
* Determines if the countdown timer should be shown (if relevant)
|
|
69
|
+
*/
|
|
70
|
+
showTimer: boolean;
|
|
67
71
|
/**
|
|
68
72
|
* What action does the CTA take?
|
|
69
73
|
*/
|
|
@@ -1,73 +1,75 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as H } from "react";
|
|
3
|
+
import { getCommonProps as M } from "../../utils/index.js";
|
|
4
|
+
import R from "../../node_modules/classnames/index.js";
|
|
5
|
+
import h from "../../components/Countdown/Countdown.js";
|
|
6
6
|
import D from "../../components/SeldonImage/SeldonImage.js";
|
|
7
7
|
import { AuctionStatus as F } from "../../types/commonTypes.js";
|
|
8
8
|
import { TextVariants as r } from "../../components/Text/types.js";
|
|
9
9
|
import t from "../../components/Text/Text.js";
|
|
10
|
-
import
|
|
11
|
-
|
|
10
|
+
import O from "../../components/PageContentWrapper/PageContentWrapper.js";
|
|
11
|
+
import { SSRMediaQuery as f } from "../../providers/SeldonProvider/utils.js";
|
|
12
|
+
const q = H(
|
|
12
13
|
({
|
|
13
|
-
auctionEndTime:
|
|
14
|
-
auctionTitle:
|
|
15
|
-
imageSrcUrl:
|
|
16
|
-
imageSrcSet:
|
|
17
|
-
imageSizes:
|
|
18
|
-
imageLoading:
|
|
19
|
-
imageFetchPriority:
|
|
20
|
-
location:
|
|
21
|
-
countdownTimerLabel:
|
|
22
|
-
countdownFormatDuration:
|
|
23
|
-
auctionState:
|
|
14
|
+
auctionEndTime: i,
|
|
15
|
+
auctionTitle: o,
|
|
16
|
+
imageSrcUrl: g,
|
|
17
|
+
imageSrcSet: v,
|
|
18
|
+
imageSizes: N,
|
|
19
|
+
imageLoading: u,
|
|
20
|
+
imageFetchPriority: S,
|
|
21
|
+
location: $,
|
|
22
|
+
countdownTimerLabel: w,
|
|
23
|
+
countdownFormatDuration: x,
|
|
24
|
+
auctionState: B,
|
|
24
25
|
occurrenceInformation: k,
|
|
25
|
-
onClick:
|
|
26
|
-
children:
|
|
27
|
-
className:
|
|
26
|
+
onClick: z,
|
|
27
|
+
children: C,
|
|
28
|
+
className: P,
|
|
28
29
|
footerElement: b,
|
|
29
|
-
headerLabel:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
headerLabel: j,
|
|
31
|
+
showTimer: c,
|
|
32
|
+
...s
|
|
33
|
+
}, l) => {
|
|
34
|
+
const { className: e, ...m } = M(s, "SaleHeaderBanner"), d = B === F.live, _ = {
|
|
35
|
+
endDateTime: i,
|
|
36
|
+
label: w,
|
|
37
|
+
formatDurationStr: x
|
|
36
38
|
};
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
39
|
+
return /* @__PURE__ */ n("div", { ...m, className: R(e, P), ...s, ref: l, children: [
|
|
40
|
+
d && i && c ? /* @__PURE__ */ a(f.Media, { lessThan: "md", children: /* @__PURE__ */ a("div", { className: `${e}__stack__countdown`, children: /* @__PURE__ */ a(h, { ..._, showBottomBorder: !1 }) }) }) : null,
|
|
39
41
|
/* @__PURE__ */ a(
|
|
40
42
|
D,
|
|
41
43
|
{
|
|
42
44
|
aspectRatio: "16/9",
|
|
43
|
-
src:
|
|
44
|
-
alt: String(
|
|
45
|
+
src: g,
|
|
46
|
+
alt: String(o),
|
|
45
47
|
objectFit: "cover",
|
|
46
48
|
className: `${e}__image`,
|
|
47
|
-
srcSet:
|
|
48
|
-
sizes:
|
|
49
|
-
loading:
|
|
50
|
-
fetchPriority:
|
|
49
|
+
srcSet: v,
|
|
50
|
+
sizes: N,
|
|
51
|
+
loading: u,
|
|
52
|
+
fetchPriority: S
|
|
51
53
|
}
|
|
52
54
|
),
|
|
53
|
-
/* @__PURE__ */ a(
|
|
54
|
-
|
|
55
|
-
/* @__PURE__ */ a(t, { variant: r.badge, children:
|
|
56
|
-
/* @__PURE__ */ a(t, { variant: r.title1, children:
|
|
57
|
-
/* @__PURE__ */ a(t, { variant: r.string2, className: `${e}__location`, children:
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
k.map(({ date:
|
|
60
|
-
/* @__PURE__ */ a(t, { variant: r.string2, children:
|
|
61
|
-
/* @__PURE__ */ a(t, { variant: r.string2, className: `${e}__date`, children:
|
|
62
|
-
] }, String(
|
|
63
|
-
|
|
55
|
+
/* @__PURE__ */ a(O, { className: `${e}__stack-wrapper`, ...m, ...s, ref: l, children: /* @__PURE__ */ n("div", { className: `${e}__stack`, children: [
|
|
56
|
+
d && i && c ? /* @__PURE__ */ a(f.Media, { greaterThanOrEqual: "md", children: /* @__PURE__ */ a("div", { className: `${e}__stack__countdown`, children: /* @__PURE__ */ a(h, { ..._ }) }) }) : null,
|
|
57
|
+
/* @__PURE__ */ a(t, { variant: r.badge, children: j }),
|
|
58
|
+
/* @__PURE__ */ a(t, { variant: r.title1, children: o }),
|
|
59
|
+
/* @__PURE__ */ a(t, { variant: r.string2, className: `${e}__location`, children: $ }),
|
|
60
|
+
/* @__PURE__ */ n("div", { className: `${e}__occurrence-details`, children: [
|
|
61
|
+
k.map(({ date: p, occurrenceLabel: y }) => /* @__PURE__ */ n("div", { className: `${e}__occurrence-details-text`, children: [
|
|
62
|
+
/* @__PURE__ */ a(t, { variant: r.string2, children: y }),
|
|
63
|
+
/* @__PURE__ */ a(t, { variant: r.string2, className: `${e}__date`, children: p })
|
|
64
|
+
] }, String(p))),
|
|
65
|
+
C
|
|
64
66
|
] }),
|
|
65
67
|
b
|
|
66
68
|
] }) })
|
|
67
69
|
] });
|
|
68
70
|
}
|
|
69
71
|
);
|
|
70
|
-
|
|
72
|
+
q.displayName = "SaleHeaderBanner";
|
|
71
73
|
export {
|
|
72
|
-
|
|
74
|
+
q as default
|
|
73
75
|
};
|
|
@@ -22,22 +22,9 @@
|
|
|
22
22
|
justify-content: center;
|
|
23
23
|
padding: $spacing-md 0;
|
|
24
24
|
|
|
25
|
-
&
|
|
25
|
+
&__countdown {
|
|
26
26
|
display: flex;
|
|
27
27
|
width: 100%;
|
|
28
|
-
|
|
29
|
-
@include media($size-md, $type: 'min') {
|
|
30
|
-
display: none;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&__desktop-countdown {
|
|
35
|
-
display: none;
|
|
36
|
-
width: 100%;
|
|
37
|
-
|
|
38
|
-
@include media($size-md, $type: 'min') {
|
|
39
|
-
display: flex;
|
|
40
|
-
}
|
|
41
28
|
}
|
|
42
29
|
}
|
|
43
30
|
|