@phillips/seldon 1.127.0 → 1.129.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,61 +1,62 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import { getCommonProps as
|
|
5
|
-
import
|
|
6
|
-
import { ButtonVariants as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { HeightUnits as
|
|
13
|
-
|
|
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:
|
|
16
|
-
children:
|
|
17
|
-
contentExpandText:
|
|
18
|
-
contentCollapseText:
|
|
19
|
-
maxHeight:
|
|
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:
|
|
22
|
-
...
|
|
23
|
-
},
|
|
24
|
-
const { className: e,
|
|
25
|
-
|
|
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 =
|
|
28
|
-
|
|
28
|
+
const n = o ?? s;
|
|
29
|
+
R(a.current.scrollHeight > n);
|
|
29
30
|
}
|
|
30
|
-
}, [
|
|
31
|
-
|
|
32
|
-
|
|
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__ */
|
|
35
|
-
|
|
38
|
+
return /* @__PURE__ */ d(
|
|
39
|
+
T,
|
|
36
40
|
{
|
|
37
|
-
id:
|
|
38
|
-
open:
|
|
39
|
-
onOpenChange:
|
|
40
|
-
className:
|
|
41
|
-
|
|
42
|
-
|
|
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__ */
|
|
49
|
-
|
|
49
|
+
/* @__PURE__ */ r(j, { className: `${e}-content`, ref: a, forceMount: !0, children: C }),
|
|
50
|
+
f ? /* @__PURE__ */ r(
|
|
50
51
|
"div",
|
|
51
52
|
{
|
|
52
|
-
className:
|
|
53
|
-
[`${e}-overlay--expanded`]:
|
|
54
|
-
[`${e}-overlay--gradient`]:
|
|
53
|
+
className: h(`${e}-overlay`, {
|
|
54
|
+
[`${e}-overlay--expanded`]: t,
|
|
55
|
+
[`${e}-overlay--gradient`]: f && !t
|
|
55
56
|
}),
|
|
56
|
-
children: /* @__PURE__ */
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
68
|
+
A.displayName = "ContentPeek";
|
|
68
69
|
export {
|
|
69
|
-
|
|
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:
|
|
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: {
|
package/dist/utils/constants.js
CHANGED