@phillips/seldon 1.142.0 → 1.143.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.
@@ -30,6 +30,7 @@ export interface CountdownProps extends ComponentProps<'div'> {
30
30
  * Variant of the countdown
31
31
  */
32
32
  variant?: CountdownVariants;
33
+ currentDateTime?: Date;
33
34
  }
34
35
  /**
35
36
  * ## Overview
@@ -1,68 +1,69 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as x, useState as M, useEffect as j, useMemo as z } from "react";
3
- import { getCommonProps as P } from "../../utils/index.js";
4
- import E from "../../node_modules/classnames/index.js";
5
- import { SupportedLanguages as F } from "../../types/commonTypes.js";
6
- import { CountdownVariants as c } from "./types.js";
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import { forwardRef as j, useState as z, useEffect as E, useMemo as F } from "react";
3
+ import { getCommonProps as H } from "../../utils/index.js";
4
+ import R from "../../node_modules/classnames/index.js";
5
+ import { SupportedLanguages as S } from "../../types/commonTypes.js";
6
+ import { CountdownVariants as i } from "./types.js";
7
7
  import { Duration as a } from "./Duration.js";
8
- import { zhCN as H } from "../../node_modules/date-fns/locale/zh-CN.js";
9
- import { enUS as R } from "../../node_modules/date-fns/locale/en-US.js";
10
- import { differenceInDays as d } 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
- import { differenceInMilliseconds as S } from "../../node_modules/date-fns/differenceInMilliseconds.js";
15
- const U = x(
8
+ import { zhCN as U } from "../../node_modules/date-fns/locale/zh-CN.js";
9
+ import { enUS as V } 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 h } from "../../node_modules/date-fns/differenceInHours.js";
12
+ import { differenceInMinutes as w } from "../../node_modules/date-fns/differenceInMinutes.js";
13
+ import { differenceInSeconds as C } from "../../node_modules/date-fns/differenceInSeconds.js";
14
+ import { differenceInMilliseconds as k } from "../../node_modules/date-fns/differenceInMilliseconds.js";
15
+ const q = j(
16
16
  ({
17
17
  endDateTime: o,
18
18
  formatDurationStr: t,
19
- label: i = "Lots Close in",
20
- intervalDescription: C,
21
- className: g,
22
- locale: y = "en",
23
- showBottomBorder: I = !0,
24
- variant: m = c.default,
25
- ...u
26
- }, N) => {
27
- const { className: r, ...$ } = P(u, "Countdown"), [n, b] = M(/* @__PURE__ */ new Date()), l = y === F.zh ? H : R, s = {
28
- days: d(o, n) > 0 ? d(o, n) : 0,
29
- hours: p(o, n) > 0 ? p(o, n) % 24 : 0,
30
- minutes: h(o, n) > 0 ? h(o, n) % 60 : 0,
31
- seconds: (w(o, n) > 0 ? w(o, n) % 60 : 0) % 60
19
+ label: m = "Lots Close in",
20
+ intervalDescription: g,
21
+ className: y,
22
+ locale: I = "en",
23
+ showBottomBorder: N = !0,
24
+ variant: u = i.default,
25
+ currentDateTime: l = /* @__PURE__ */ new Date(),
26
+ ...f
27
+ }, $) => {
28
+ const { className: r, ...b } = H(f, "Countdown"), [n, L] = z(l), c = I === S.zh ? U : V, s = {
29
+ days: p(o, n) > 0 ? p(o, n) : 0,
30
+ hours: h(o, n) > 0 ? h(o, n) % 24 : 0,
31
+ minutes: w(o, n) > 0 ? w(o, n) % 60 : 0,
32
+ seconds: (C(o, n) > 0 ? C(o, n) % 60 : 0) % 60
32
33
  };
33
- j(() => {
34
- const v = setInterval(() => {
35
- b(/* @__PURE__ */ new Date());
34
+ E(() => {
35
+ const x = setInterval(() => {
36
+ L((M) => new Date(M.getTime() + 1e3));
36
37
  }, 1e3);
37
- return () => clearInterval(v);
38
- }, [o]);
39
- const L = z(() => new Date(o).getTime() > (/* @__PURE__ */ new Date()).getTime(), [o]), _ = S(o, n) <= 3 * 60 * 1e3;
40
- return L ? /* @__PURE__ */ f(
38
+ return () => clearInterval(x);
39
+ }, [o, l]);
40
+ const _ = F(() => new Date(o).getTime() > l.getTime(), [o, l]), v = k(o, n) <= 3 * 60 * 1e3;
41
+ return _ ? /* @__PURE__ */ d(
41
42
  "div",
42
43
  {
43
- ...$,
44
- className: E(r, g, {
45
- [`${r}--compact`]: m === c.compact,
46
- [`${r}--show-bottom-border`]: I,
47
- [`${r}--closing-lot`]: _
44
+ ...b,
45
+ className: R(r, y, {
46
+ [`${r}--compact`]: u === i.compact,
47
+ [`${r}--show-bottom-border`]: N,
48
+ [`${r}--closing-lot`]: v
48
49
  }),
49
- ...u,
50
- ref: N,
50
+ ...f,
51
+ ref: $,
51
52
  children: [
52
- /* @__PURE__ */ f("div", { className: `${r}__countdown-container`, role: "timer", "aria-label": i, children: [
53
- /* @__PURE__ */ e("span", { className: `${r}__label`, children: i }),
54
- s.days > 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "days", locale: l, formatDurationStr: t }) : null,
55
- s.days > 0 || s.hours > 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "hours", locale: l, formatDurationStr: t }) : null,
56
- s.days === 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "minutes", locale: l, formatDurationStr: t }) : null,
57
- s.days === 0 && s.hours === 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "seconds", locale: l, formatDurationStr: t }) : null
53
+ /* @__PURE__ */ d("div", { className: `${r}__countdown-container`, role: "timer", "aria-label": m, children: [
54
+ /* @__PURE__ */ e("span", { className: `${r}__label`, children: m }),
55
+ s.days > 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "days", locale: c, formatDurationStr: t }) : null,
56
+ s.days > 0 || s.hours > 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "hours", locale: c, formatDurationStr: t }) : null,
57
+ s.days === 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "minutes", locale: c, formatDurationStr: t }) : null,
58
+ s.days === 0 && s.hours === 0 ? /* @__PURE__ */ e(a, { duration: s, unit: "seconds", locale: c, formatDurationStr: t }) : null
58
59
  ] }),
59
- m === c.default ? /* @__PURE__ */ e("span", { children: C }) : null
60
+ u === i.default ? /* @__PURE__ */ e("span", { children: g }) : null
60
61
  ]
61
62
  }
62
63
  ) : null;
63
64
  }
64
65
  );
65
- U.displayName = "Countdown";
66
+ q.displayName = "Countdown";
66
67
  export {
67
- U as default
68
+ q as default
68
69
  };
@@ -70,6 +70,10 @@ export interface BidSnapshotProps extends ComponentProps<'div'> {
70
70
  * Won for label text, a string for label of won for detail
71
71
  */
72
72
  wonForText?: string;
73
+ /**
74
+ * Current date time
75
+ */
76
+ currentDateTime?: Date;
73
77
  }
74
78
  /**
75
79
  * ## Overview
@@ -1,21 +1,21 @@
1
1
  import { jsxs as S, jsx as e } from "react/jsx-runtime";
2
- import { forwardRef as V } from "react";
3
- import k from "../../node_modules/classnames/index.js";
4
- import { getCommonProps as q, findChildrenOfType as z, findChildrenExcludingTypes as D } from "../../utils/index.js";
5
- import F from "../DetailList/DetailList.js";
2
+ import { forwardRef as k } from "react";
3
+ import q from "../../node_modules/classnames/index.js";
4
+ import { getCommonProps as z, findChildrenOfType as D, findChildrenExcludingTypes as F } from "../../utils/index.js";
5
+ import G from "../DetailList/DetailList.js";
6
6
  import d from "../../components/Detail/Detail.js";
7
- import { LotStatus as n, SupportedLanguages as G } from "../../types/commonTypes.js";
8
- import H from "../../components/Countdown/Countdown.js";
9
- import { CountdownVariants as J } from "../../components/Countdown/types.js";
10
- import { BidStatusEnum as K } from "./types.js";
7
+ import { LotStatus as n, SupportedLanguages as H } from "../../types/commonTypes.js";
8
+ import J from "../../components/Countdown/Countdown.js";
9
+ import { CountdownVariants as K } from "../../components/Countdown/types.js";
10
+ import { BidStatusEnum as Q } from "./types.js";
11
11
  import v from "./BidMessage.js";
12
12
  import { isAfter as L } from "../../node_modules/date-fns/isAfter.js";
13
- import { differenceInMinutes as Q } from "../../node_modules/date-fns/differenceInMinutes.js";
14
- const U = (o) => o === 1 ? `${o} bid` : `${o} bids`, X = V(
13
+ import { differenceInMinutes as U } from "../../node_modules/date-fns/differenceInMinutes.js";
14
+ const X = (o) => o === 1 ? `${o} bid` : `${o} bids`, Y = k(
15
15
  ({
16
16
  lotStatus: o = n.ready,
17
17
  bidStatus: p,
18
- bidsLabelText: w = U,
18
+ bidsLabelText: w = X,
19
19
  children: c,
20
20
  className: C,
21
21
  closingText: x = "Closes in",
@@ -32,18 +32,19 @@ const U = (o) => o === 1 ? `${o} bid` : `${o} bids`, X = V(
32
32
  soldPrice: u,
33
33
  soldForText: M = "Sold for",
34
34
  wonForText: j = "Won for",
35
+ currentDateTime: E = /* @__PURE__ */ new Date(),
35
36
  ...$
36
- }, E) => {
37
- const { className: s, ...P } = q($, "BidSnapshot"), l = f !== null && h > 0, b = o === n.ready, a = o === n.live, g = o === n.past, m = /* @__PURE__ */ new Date(), R = a && i && L(i, m) && r && (Q(r, m) < 60 || L(m, r)), _ = z(c, v), A = D(c, [v]), I = k(s, C, {
37
+ }, P) => {
38
+ const { className: s, ...R } = z($, "BidSnapshot"), l = f !== null && h > 0, b = o === n.ready, a = o === n.live, g = o === n.past, m = E, _ = a && i && L(i, m) && r && (U(r, m) < 60 || L(m, r)), A = D(c, v), I = F(c, [v]), V = q(s, C, {
38
39
  [`${s}--live`]: a,
39
40
  [`${s}--has-bids`]: l || g
40
41
  });
41
- return /* @__PURE__ */ S("div", { ...P, ...$, ref: E, className: I, children: [
42
- /* @__PURE__ */ S(F, { hasSeparators: !0, className: `${s}__text`, children: [
42
+ return /* @__PURE__ */ S("div", { ...R, ...$, ref: P, className: V, children: [
43
+ /* @__PURE__ */ S(G, { hasSeparators: !0, className: `${s}__text`, children: [
43
44
  g ? /* @__PURE__ */ e(
44
45
  d,
45
46
  {
46
- label: p === K.Won ? j : M,
47
+ label: p === Q.Won ? j : M,
47
48
  value: u ? `${t}${u?.toLocaleString()}` : "",
48
49
  hasWrap: !1
49
50
  }
@@ -59,15 +60,15 @@ const U = (o) => o === 1 ? `${o} bid` : `${o} bids`, X = V(
59
60
  ) : null,
60
61
  b || a && !l ? /* @__PURE__ */ e(d, { label: B, value: `${t}${y?.toLocaleString()}`, hasWrap: !1 }) : null
61
62
  ] }),
62
- p && !b ? _ : null,
63
- A,
64
- R ? /* @__PURE__ */ e(
65
- H,
63
+ p && !b ? A : null,
64
+ I,
65
+ _ ? /* @__PURE__ */ e(
66
+ J,
66
67
  {
67
68
  endDateTime: i,
68
69
  label: x,
69
- variant: J.compact,
70
- locale: G[W],
70
+ variant: K.compact,
71
+ locale: H[W],
71
72
  formatDurationStr: T,
72
73
  showBottomBorder: !1
73
74
  }
@@ -75,7 +76,7 @@ const U = (o) => o === 1 ? `${o} bid` : `${o} bids`, X = V(
75
76
  ] });
76
77
  }
77
78
  );
78
- X.displayName = "BidSnapshot";
79
+ Y.displayName = "BidSnapshot";
79
80
  export {
80
- X as default
81
+ Y as default
81
82
  };
@@ -1,30 +1,30 @@
1
- import { jsx as o, Fragment as x, jsxs as r } from "react/jsx-runtime";
1
+ import { jsx as o, Fragment as x, jsxs as s } from "react/jsx-runtime";
2
2
  import { forwardRef as A } from "react";
3
3
  import { getCommonProps as w, noOp as C } from "../../utils/index.js";
4
4
  import $ from "../../node_modules/classnames/index.js";
5
- import { AuthState as e } from "./types.js";
6
- import { TextVariants as m } from "../../components/Text/types.js";
7
- import s from "../../components/Text/Text.js";
8
- import i from "../../components/Icon/Icon.js";
5
+ import { AuthState as t } from "./types.js";
6
+ import { TextVariants as i } from "../../components/Text/types.js";
7
+ import r from "../../components/Text/Text.js";
8
+ import m from "../../components/Icon/Icon.js";
9
9
  const b = A(
10
10
  ({
11
11
  accountDetailsLinkComponent: l = "a",
12
12
  className: d,
13
13
  onLogin: g = C,
14
- authState: t = e.LoggedOut,
14
+ authState: a = t.LoggedOut,
15
15
  loginLabel: h = "Login",
16
16
  accountLabel: u = "Account",
17
17
  href: f = "/account",
18
- disabled: a = !1,
18
+ disabled: e = !1,
19
19
  ...c
20
20
  }, p) => {
21
- const { className: n, ...N } = w(c, "UserManagement"), _ = t === e.LoggedIn, L = t !== e.Loading;
22
- return /* @__PURE__ */ o("div", { ...N, className: $(n, d), ...c, ref: p, children: L && /* @__PURE__ */ o(x, { children: _ ? /* @__PURE__ */ r(l, { className: `${n}__login`, href: f, disabled: a, children: [
23
- /* @__PURE__ */ o(i, { icon: "Account", className: `${n}__account-icon`, height: "1rem", width: "1rem" }),
24
- /* @__PURE__ */ o(s, { variant: m.body3, children: u })
25
- ] }) : /* @__PURE__ */ r("button", { className: `${n}__login`, onClick: g, disabled: a, children: [
26
- /* @__PURE__ */ o(i, { icon: "Account", className: `${n}__account-icon`, height: "1rem", width: "1rem" }),
27
- /* @__PURE__ */ o(s, { variant: m.body3, children: h })
21
+ const { className: n, ...N } = w(c, "UserManagement"), _ = a === t.LoggedIn, L = a !== t.Loading;
22
+ return /* @__PURE__ */ o("div", { ...N, className: $(n, d), ...c, ref: p, children: L && /* @__PURE__ */ o(x, { children: _ ? /* @__PURE__ */ s(l, { className: `${n}__login`, href: f, disabled: e, children: [
23
+ /* @__PURE__ */ o(m, { icon: "Account", className: `${n}__account-icon`, height: "100%", width: "100%" }),
24
+ /* @__PURE__ */ o(r, { variant: i.body3, children: u })
25
+ ] }) : /* @__PURE__ */ s("button", { className: `${n}__login`, onClick: g, disabled: e, children: [
26
+ /* @__PURE__ */ o(m, { icon: "Account", className: `${n}__account-icon`, height: "100%", width: "100%" }),
27
+ /* @__PURE__ */ o(r, { variant: i.body3, children: h })
28
28
  ] }) }) });
29
29
  }
30
30
  );
@@ -55,17 +55,12 @@
55
55
  }
56
56
 
57
57
  &__account-icon {
58
- a {
59
- align-items: center;
60
- display: flex;
61
- height: $mobile-minimum-clickable-area;
62
- justify-content: center;
63
- width: $mobile-minimum-clickable-area;
64
- }
58
+ height: 1.5rem;
59
+ width: 1.5rem;
65
60
 
66
61
  @include isHeaderDesktop {
67
- height: 1.5rem;
68
- width: 1.5rem;
62
+ height: 1rem;
63
+ width: 1rem;
69
64
  }
70
65
  }
71
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.142.0",
3
+ "version": "1.143.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"