@phillips/seldon 1.110.4 → 1.111.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,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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.110.4",
3
+ "version": "1.111.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"