@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 e } from "react/jsx-runtime";
2
- import { forwardRef as L, useState as b, useEffect as g } from "react";
3
- import { getCommonProps as v } from "../../utils/index.js";
4
- import x from "../../node_modules/classnames/index.js";
5
- import { SupportedLanguages as $ } from "../../types/commonTypes.js";
6
- import { CountdownVariants as i } from "./types.js";
7
- import { Duration as m } from "./Duration.js";
8
- import { zhCN as j } from "../../node_modules/date-fns/locale/zh-CN.js";
9
- import { enUS as z } from "../../node_modules/date-fns/locale/en-US.js";
10
- import { differenceInDays as P } from "../../node_modules/date-fns/differenceInDays.js";
11
- import { differenceInHours as _ } from "../../node_modules/date-fns/differenceInHours.js";
12
- import { differenceInMinutes as E } from "../../node_modules/date-fns/differenceInMinutes.js";
13
- import { differenceInSeconds as F } from "../../node_modules/date-fns/differenceInSeconds.js";
14
- const H = L(
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: n,
17
- formatDurationStr: s,
18
- label: l = "Lots Close in",
19
- intervalDescription: f,
20
- className: p,
21
- locale: h = "en",
22
- showBottomBorder: w = !0,
23
- variant: u = i.default,
24
- ...c
25
- }, y) => {
26
- const { className: r, ...C } = v(c, "Countdown"), [t, I] = b(/* @__PURE__ */ new Date()), a = h === $.zh ? j : z, o = {
27
- days: P(n, t),
28
- hours: _(n, t) % 24,
29
- minutes: E(n, t) % 60,
30
- seconds: F(n, t) % 60 % 60
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 g(() => {
33
- const N = setInterval(() => {
34
- I(/* @__PURE__ */ new Date());
32
+ return j(() => {
33
+ const v = setInterval(() => {
34
+ b(/* @__PURE__ */ new Date());
35
35
  }, 1e3);
36
- return () => clearInterval(N);
37
- }, [n]), o.days > 0 || o.hours > 0 || o.minutes > 0 || o.seconds > 0 ? /* @__PURE__ */ d(
36
+ return () => clearInterval(v);
37
+ }, [o]), z(() => new Date(o).getTime() > (/* @__PURE__ */ new Date()).getTime(), [o]) ? /* @__PURE__ */ d(
38
38
  "div",
39
39
  {
40
- ...C,
41
- className: x(r, p, {
42
- [`${r}--compact`]: u === i.compact,
43
- [`${r}--show-bottom-border`]: w
40
+ ...L,
41
+ className: P(t, y, {
42
+ [`${t}--compact`]: c === u.compact,
43
+ [`${t}--show-bottom-border`]: N
44
44
  }),
45
- ...c,
46
- ref: y,
45
+ ...i,
46
+ ref: g,
47
47
  children: [
48
- /* @__PURE__ */ d("div", { className: `${r}__countdown-container`, role: "timer", "aria-label": l, children: [
49
- /* @__PURE__ */ e("span", { children: l }),
50
- o.days > 0 ? /* @__PURE__ */ e(m, { duration: o, unit: "days", locale: a, formatDurationStr: s }) : null,
51
- o.days > 0 || o.hours > 0 ? /* @__PURE__ */ e(m, { duration: o, unit: "hours", locale: a, formatDurationStr: s }) : null,
52
- o.days === 0 ? /* @__PURE__ */ e(m, { duration: o, unit: "minutes", locale: a, formatDurationStr: s }) : null,
53
- o.days === 0 && o.hours === 0 ? /* @__PURE__ */ e(m, { duration: o, unit: "seconds", locale: a, formatDurationStr: s }) : null
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
- u === i.default ? /* @__PURE__ */ e("span", { children: f }) : null
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 o, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as j } from "react";
3
- import { getCommonProps as H } from "../../utils/index.js";
4
- import y from "../../node_modules/classnames/index.js";
5
- import p from "../../components/Countdown/Countdown.js";
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 R from "../../components/PageContentWrapper/PageContentWrapper.js";
11
- const z = j(
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: s,
14
- auctionTitle: i,
15
- imageSrcUrl: f,
16
- imageSrcSet: h,
17
- imageSizes: v,
18
- imageLoading: N,
19
- imageFetchPriority: g,
20
- location: u,
21
- countdownTimerLabel: S,
22
- countdownFormatDuration: $,
23
- auctionState: w,
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: A,
26
- children: x,
27
- className: B,
26
+ onClick: z,
27
+ children: C,
28
+ className: P,
28
29
  footerElement: b,
29
- headerLabel: C,
30
- ...n
31
- }, c) => {
32
- const { className: e, ...l } = H(n, "SaleHeaderBanner"), m = w === F.live, d = {
33
- endDateTime: s,
34
- label: S,
35
- formatDurationStr: $
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__ */ o("div", { ...l, className: y(e, B), ...n, ref: c, children: [
38
- m && s ? /* @__PURE__ */ a("div", { className: `${e}__stack__mobile-countdown`, children: /* @__PURE__ */ a(p, { ...d, showBottomBorder: !1 }) }) : null,
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: f,
44
- alt: String(i),
45
+ src: g,
46
+ alt: String(o),
45
47
  objectFit: "cover",
46
48
  className: `${e}__image`,
47
- srcSet: h,
48
- sizes: v,
49
- loading: N,
50
- fetchPriority: g
49
+ srcSet: v,
50
+ sizes: N,
51
+ loading: u,
52
+ fetchPriority: S
51
53
  }
52
54
  ),
53
- /* @__PURE__ */ a(R, { className: `${e}__stack-wrapper`, ...l, ...n, ref: c, children: /* @__PURE__ */ o("div", { className: `${e}__stack`, children: [
54
- m && s ? /* @__PURE__ */ a("div", { className: `${e}__stack__desktop-countdown`, children: /* @__PURE__ */ a(p, { ...d }) }) : null,
55
- /* @__PURE__ */ a(t, { variant: r.badge, children: C }),
56
- /* @__PURE__ */ a(t, { variant: r.title1, children: i }),
57
- /* @__PURE__ */ a(t, { variant: r.string2, className: `${e}__location`, children: u }),
58
- /* @__PURE__ */ o("div", { className: `${e}__occurrence-details`, children: [
59
- k.map(({ date: _, occurrenceLabel: P }) => /* @__PURE__ */ o("div", { className: `${e}__occurrence-details-text`, children: [
60
- /* @__PURE__ */ a(t, { variant: r.string2, children: P }),
61
- /* @__PURE__ */ a(t, { variant: r.string2, className: `${e}__date`, children: _ })
62
- ] }, String(_))),
63
- x
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
- z.displayName = "SaleHeaderBanner";
72
+ q.displayName = "SaleHeaderBanner";
71
73
  export {
72
- z as default
74
+ q as default
73
75
  };
@@ -22,22 +22,9 @@
22
22
  justify-content: center;
23
23
  padding: $spacing-md 0;
24
24
 
25
- &__mobile-countdown {
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.110.4",
3
+ "version": "1.111.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"