@phillips/seldon 1.128.0 → 1.129.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,61 +1,62 @@
1
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as x, useState as f, useRef as P, useEffect as b, useCallback as k } from "react";
3
- import p from "../../node_modules/classnames/index.js";
4
- import { getCommonProps as R } from "../../utils/index.js";
5
- import w from "../Button/Button.js";
6
- import { ButtonVariants as E } from "../Button/types.js";
7
- import M from "../Collapsible/Collapsible.js";
8
- import O from "../Collapsible/CollapsibleContent.js";
9
- import S from "../Collapsible/CollapsibleTrigger.js";
10
- import j from "../../assets/plus.svg.js";
11
- import B from "../../assets/minus.svg.js";
12
- import { HeightUnits as I } from "./utils.js";
13
- const L = x(
1
+ import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as w, useState as u, useRef as I, useEffect as g, useCallback as M } from "react";
3
+ import h from "../../node_modules/classnames/index.js";
4
+ import { getCommonProps as S } from "../../utils/index.js";
5
+ import H from "../Button/Button.js";
6
+ import { ButtonVariants as O } from "../Button/types.js";
7
+ import T from "../Collapsible/Collapsible.js";
8
+ import j from "../Collapsible/CollapsibleContent.js";
9
+ import B from "../Collapsible/CollapsibleTrigger.js";
10
+ import L from "../../assets/plus.svg.js";
11
+ import _ from "../../assets/minus.svg.js";
12
+ import { HeightUnits as l } from "./utils.js";
13
+ import { DEFAULT_REM_SIZE as v } from "../../utils/constants.js";
14
+ const A = w(
14
15
  ({
15
- className: d,
16
- children: l,
17
- contentExpandText: u = "Read More",
18
- contentCollapseText: g = "Read Less",
19
- maxHeight: t = 480,
16
+ className: x,
17
+ children: C,
18
+ contentExpandText: y = "Read More",
19
+ contentCollapseText: P = "Read Less",
20
+ maxHeight: c = 480,
20
21
  minHeightThreshold: m,
21
- heightUnits: v = I.px,
22
- ...s
23
- }, C) => {
24
- const { className: e, ...h } = R(s, "ContentPeek"), [r, y] = f(!1), [i, N] = f(!1), a = P(null);
25
- b(() => {
22
+ heightUnits: p = l.px,
23
+ ...i
24
+ }, N) => {
25
+ const { className: e, ...$ } = S(i, "ContentPeek"), [t, E] = u(!1), [f, R] = u(!1), a = I(null), s = p === l.rem ? c * v : c, b = m ? m * v : null, o = p === l.rem ? b : m;
26
+ g(() => {
26
27
  if (a.current) {
27
- const n = m ?? t;
28
- N(a.current.scrollHeight > n);
28
+ const n = o ?? s;
29
+ R(a.current.scrollHeight > n);
29
30
  }
30
- }, [l, t, m]);
31
- const $ = k(() => {
32
- y((n) => !n);
31
+ }, [s, o]), g(() => {
32
+ const n = o && o >= s ? o : s;
33
+ a.current?.style.setProperty("--content-peek-max-height", `${n}${l.px}`);
34
+ }, [s, o]);
35
+ const k = M(() => {
36
+ E((n) => !n);
33
37
  }, []);
34
- return /* @__PURE__ */ c(
35
- M,
38
+ return /* @__PURE__ */ d(
39
+ T,
36
40
  {
37
- id: s?.id,
38
- open: r,
39
- onOpenChange: $,
40
- className: p(e, d),
41
- style: {
42
- "--content-peek-max-height": `${t}${v}`
43
- },
44
- ref: C,
45
- ...h,
46
- ...s,
41
+ id: i?.id,
42
+ open: t,
43
+ onOpenChange: k,
44
+ className: h(e, x),
45
+ ref: N,
46
+ ...$,
47
+ ...i,
47
48
  children: [
48
- /* @__PURE__ */ o(O, { className: `${e}-content`, ref: a, forceMount: !0, children: l }),
49
- i ? /* @__PURE__ */ o(
49
+ /* @__PURE__ */ r(j, { className: `${e}-content`, ref: a, forceMount: !0, children: C }),
50
+ f ? /* @__PURE__ */ r(
50
51
  "div",
51
52
  {
52
- className: p(`${e}-overlay`, {
53
- [`${e}-overlay--expanded`]: r,
54
- [`${e}-overlay--gradient`]: i && !r
53
+ className: h(`${e}-overlay`, {
54
+ [`${e}-overlay--expanded`]: t,
55
+ [`${e}-overlay--gradient`]: f && !t
55
56
  }),
56
- children: /* @__PURE__ */ o("div", { className: `${e}-overlay-trigger-wrapper`, children: /* @__PURE__ */ o(S, { asChild: !0, className: `${e}-overlay-trigger`, children: /* @__PURE__ */ c(w, { variant: E.secondary, children: [
57
- r ? /* @__PURE__ */ o(B, {}) : /* @__PURE__ */ o(j, {}),
58
- r ? g : u
57
+ children: /* @__PURE__ */ r("div", { className: `${e}-overlay-trigger-wrapper`, children: /* @__PURE__ */ r(B, { asChild: !0, className: `${e}-overlay-trigger`, children: /* @__PURE__ */ d(H, { variant: O.secondary, children: [
58
+ t ? /* @__PURE__ */ r(_, {}) : /* @__PURE__ */ r(L, {}),
59
+ t ? P : y
59
60
  ] }) }) })
60
61
  }
61
62
  ) : null
@@ -64,7 +65,7 @@ const L = x(
64
65
  );
65
66
  }
66
67
  );
67
- L.displayName = "ContentPeek";
68
+ A.displayName = "ContentPeek";
68
69
  export {
69
- L as default
70
+ A as default
70
71
  };
@@ -1,4 +1,5 @@
1
1
  import { ContentPeekProps } from './ContentPeek';
2
+ import { HeightUnits } from './utils';
2
3
  declare const meta: {
3
4
  title: string;
4
5
  component: import('react').ForwardRefExoticComponent<ContentPeekProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -13,7 +14,16 @@ declare const meta: {
13
14
  control: "number";
14
15
  };
15
16
  minHeightThreshold: {
16
- control: "number";
17
+ control: {
18
+ type: "number";
19
+ step: number;
20
+ };
21
+ };
22
+ heightUnits: {
23
+ control: {
24
+ type: "select";
25
+ };
26
+ options: HeightUnits[];
17
27
  };
18
28
  };
19
29
  };
@@ -24,6 +34,8 @@ export declare const Playground: {
24
34
  contentExpandText: string;
25
35
  contentCollapseText: string;
26
36
  maxHeight: number;
37
+ minHeightThreshold: number;
38
+ heightUnits: HeightUnits;
27
39
  };
28
40
  };
29
41
  export declare const CustomText: {
@@ -1,25 +1,25 @@
1
- import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
- import l from "../../node_modules/classnames/index.js";
1
+ import { jsx as o, jsxs as l } from "react/jsx-runtime";
2
+ import p from "../../node_modules/classnames/index.js";
3
3
  import { getCommonProps as f } from "../../utils/index.js";
4
- import { TextVariants as g } from "../../components/Text/types.js";
5
- import d from "../../components/Text/Text.js";
6
- import { BidMessageVariants as s } from "./types.js";
4
+ import { TextVariants as d } from "../../components/Text/types.js";
5
+ import g from "../../components/Text/Text.js";
6
+ import { BidMessageVariants as e } from "./types.js";
7
7
  import "react";
8
8
  import v from "../../assets/icon-green-circle.svg.js";
9
9
  import x from "../../assets/icon-red-circle.svg.js";
10
- const T = ({
11
- className: e,
12
- hasIcon: m = !0,
13
- message: t,
14
- variant: i = s.positive,
15
- ...o
10
+ const S = ({
11
+ className: t,
12
+ hasIcon: i = !0,
13
+ message: m,
14
+ variant: a = e.positive,
15
+ ...r
16
16
  }) => {
17
- const { className: a, ...n } = f(o, "BidMessage"), c = i === s.positive ? /* @__PURE__ */ r(v, {}) : /* @__PURE__ */ r(x, {});
18
- return /* @__PURE__ */ p(d, { ...n, className: l(a, e), ...o, variant: g.string2, children: [
19
- m ? c : null,
20
- t
17
+ const { className: s, ...n } = f(r, "BidMessage"), c = a === e.positive ? /* @__PURE__ */ o(v, {}) : /* @__PURE__ */ o(x, {});
18
+ return /* @__PURE__ */ l("div", { ...n, className: p(s, t), ...r, children: [
19
+ i ? c : null,
20
+ /* @__PURE__ */ o(g, { variant: d.string2, className: `${s}-text`, children: m })
21
21
  ] });
22
22
  };
23
23
  export {
24
- T as default
24
+ S as default
25
25
  };
@@ -44,7 +44,7 @@
44
44
  gap: $spacing-micro;
45
45
 
46
46
  // Override the default text style being too specific
47
- &.#{$px}-bid-message {
47
+ &-text {
48
48
  font-variation-settings: 'wght' 600;
49
49
  margin-bottom: 0;
50
50
  }
@@ -6,3 +6,4 @@ export declare const BREAKPOINTS: {
6
6
  lg: number;
7
7
  xl: number;
8
8
  };
9
+ export declare const DEFAULT_REM_SIZE = 16;
@@ -1,10 +1,11 @@
1
- const m = {
1
+ const s = {
2
2
  xsm: 0,
3
3
  sm: 361,
4
4
  md: 961,
5
5
  lg: 1401,
6
6
  xl: 1801
7
- };
7
+ }, E = 16;
8
8
  export {
9
- m as BREAKPOINTS
9
+ s as BREAKPOINTS,
10
+ E as DEFAULT_REM_SIZE
10
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.128.0",
3
+ "version": "1.129.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"