@phillips/seldon 1.139.0 → 1.140.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,64 +1,68 @@
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";
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";
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
11
  import { differenceInHours as p } from "../../node_modules/date-fns/differenceInHours.js";
12
12
  import { differenceInMinutes as h } from "../../node_modules/date-fns/differenceInMinutes.js";
13
13
  import { differenceInSeconds as w } from "../../node_modules/date-fns/differenceInSeconds.js";
14
- const H = x(
14
+ import { differenceInMilliseconds as S } from "../../node_modules/date-fns/differenceInMilliseconds.js";
15
+ const U = x(
15
16
  ({
16
17
  endDateTime: o,
17
- formatDurationStr: e,
18
- label: m = "Lots Close in",
18
+ formatDurationStr: t,
19
+ label: i = "Lots Close in",
19
20
  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,
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,
28
29
  hours: p(o, n) > 0 ? p(o, n) % 24 : 0,
29
30
  minutes: h(o, n) > 0 ? h(o, n) % 60 : 0,
30
31
  seconds: (w(o, n) > 0 ? w(o, n) % 60 : 0) % 60
31
32
  };
32
- return j(() => {
33
+ j(() => {
33
34
  const v = setInterval(() => {
34
35
  b(/* @__PURE__ */ new Date());
35
36
  }, 1e3);
36
37
  return () => clearInterval(v);
37
- }, [o]), z(() => new Date(o).getTime() > (/* @__PURE__ */ new Date()).getTime(), [o]) ? /* @__PURE__ */ d(
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
41
  "div",
39
42
  {
40
- ...L,
41
- className: P(t, y, {
42
- [`${t}--compact`]: c === u.compact,
43
- [`${t}--show-bottom-border`]: N
43
+ ...$,
44
+ className: E(r, g, {
45
+ [`${r}--compact`]: m === c.compact,
46
+ [`${r}--show-bottom-border`]: I,
47
+ [`${r}--closing-lot`]: _
44
48
  }),
45
- ...i,
46
- ref: g,
49
+ ...u,
50
+ ref: N,
47
51
  children: [
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
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
54
58
  ] }),
55
- c === u.default ? /* @__PURE__ */ s("span", { children: C }) : null
59
+ m === c.default ? /* @__PURE__ */ e("span", { children: C }) : null
56
60
  ]
57
61
  }
58
62
  ) : null;
59
63
  }
60
64
  );
61
- H.displayName = "Countdown";
65
+ U.displayName = "Countdown";
62
66
  export {
63
- H as default
67
+ U as default
64
68
  };
@@ -1,4 +1,5 @@
1
1
  import { CountdownProps } from './Countdown';
2
+ import { CountdownVariants } from './types';
2
3
  declare const meta: {
3
4
  title: string;
4
5
  component: import('react').ForwardRefExoticComponent<Omit<CountdownProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -11,6 +12,10 @@ export declare const Playground: {
11
12
  type: string;
12
13
  options: string[];
13
14
  };
15
+ variant: {
16
+ type: string;
17
+ options: CountdownVariants[];
18
+ };
14
19
  };
15
20
  };
16
21
  export declare const Days: (props: CountdownProps) => import("react/jsx-runtime").JSX.Element;
@@ -18,3 +23,12 @@ export declare const Hours: (props: CountdownProps) => import("react/jsx-runtime
18
23
  export declare const Minutes: (props: CountdownProps) => import("react/jsx-runtime").JSX.Element;
19
24
  export declare const Seconds: (props: CountdownProps) => import("react/jsx-runtime").JSX.Element;
20
25
  export declare const Compact: (props: CountdownProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const ClosingCountdown: {
27
+ (props: CountdownProps): import("react/jsx-runtime").JSX.Element;
28
+ argTypes: {
29
+ variant: {
30
+ type: string;
31
+ options: CountdownVariants[];
32
+ };
33
+ };
34
+ };
@@ -31,8 +31,18 @@
31
31
  &--compact {
32
32
  .#{$px}-countdown__countdown-container {
33
33
  @include Montserrat;
34
+ .#{$px}-duration {
35
+ @include Montserrat;
36
+ }
34
37
 
35
38
  gap: $spacing-xsm;
36
39
  }
37
40
  }
41
+
42
+ &--closing-lot {
43
+ .#{$px}-duration,
44
+ .#{$px}-countdown__label {
45
+ color: $countdown-compact;
46
+ }
47
+ }
38
48
  }
@@ -6,9 +6,3 @@
6
6
  display: flex;
7
7
  gap: $spacing-micro;
8
8
  }
9
-
10
- .#{$px}-countdown--compact .#{$px}-duration {
11
- @include Montserrat;
12
-
13
- color: $countdown-compact;
14
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.139.0",
3
+ "version": "1.140.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"