@kkcompany/app-ui 0.1.29 → 0.1.30
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.
- package/dist/index.cjs +6 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +7 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -808,17 +808,19 @@ const SeeMore = ({ style, messages = defaultMessages, children, ...rest }) => {
|
|
|
808
808
|
const [expandedHeight, setExpandedHeight] = (0, react.useState)();
|
|
809
809
|
const rootRef = (0, react.useRef)(null);
|
|
810
810
|
const containeRef = (0, react.useRef)();
|
|
811
|
-
(0, react.
|
|
811
|
+
(0, react.useLayoutEffect)(() => {
|
|
812
812
|
if (!rootRef.current) return;
|
|
813
|
-
|
|
813
|
+
const updateExpandStatus = () => {
|
|
814
814
|
if (!containeRef.current) return;
|
|
815
815
|
const collapsedLines = Number.parseInt(window.getComputedStyle(containeRef.current).getPropertyValue("--see-more-collapsed-lines"), 10) || 2;
|
|
816
816
|
const lineCount = getLineCount(containeRef.current);
|
|
817
817
|
const scrollable = lineCount > collapsedLines;
|
|
818
818
|
const fit = lineCount <= collapsedLines;
|
|
819
819
|
setStatus((current) => current === "no-expand" && scrollable ? "collapsed" : current !== "no-expand" && fit ? "no-expand" : current);
|
|
820
|
-
setExpandedHeight(containeRef.current
|
|
821
|
-
}
|
|
820
|
+
setExpandedHeight(containeRef.current.scrollHeight);
|
|
821
|
+
};
|
|
822
|
+
updateExpandStatus();
|
|
823
|
+
return onResize(rootRef.current, updateExpandStatus);
|
|
822
824
|
}, []);
|
|
823
825
|
const toggle = () => setStatus((current) => current === "collapsed" ? "expanded" : "collapsing");
|
|
824
826
|
return /* @__PURE__ */ (0, __emotion_react_jsx_runtime.jsxs)("div", {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react0 from "react";
|
|
2
2
|
import { ElementType, MouseEventHandler, ReactElement, ReactNode } from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _emotion_react_jsx_runtime2 from "@emotion/react/jsx-runtime";
|
|
4
4
|
import { CSSObject } from "@emotion/react";
|
|
5
5
|
import Link from "next/link";
|
|
6
6
|
|
|
@@ -65,7 +65,7 @@ declare const HiddenToggle: ({
|
|
|
65
65
|
defaultEnabled?: boolean;
|
|
66
66
|
children: any;
|
|
67
67
|
onChange: any;
|
|
68
|
-
}) =>
|
|
68
|
+
}) => _emotion_react_jsx_runtime2.JSX.Element;
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/Icon.d.ts
|
|
71
71
|
declare const Icon: ({
|
|
@@ -74,7 +74,7 @@ declare const Icon: ({
|
|
|
74
74
|
}: {
|
|
75
75
|
style?: {};
|
|
76
76
|
src: any;
|
|
77
|
-
}) =>
|
|
77
|
+
}) => _emotion_react_jsx_runtime2.JSX.Element;
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region src/SeeMore.d.ts
|
|
80
80
|
declare const defaultMessages: {
|
|
@@ -90,7 +90,7 @@ declare const SeeMore: ({
|
|
|
90
90
|
style?: CSSObject;
|
|
91
91
|
messages?: typeof defaultMessages;
|
|
92
92
|
children?: ReactNode;
|
|
93
|
-
}) =>
|
|
93
|
+
}) => _emotion_react_jsx_runtime2.JSX.Element;
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region src/VideoItem.d.ts
|
|
96
96
|
type VideoDetail = {
|
|
@@ -154,6 +154,6 @@ declare const VideoThumbnail: ({
|
|
|
154
154
|
Image?: ElementType;
|
|
155
155
|
};
|
|
156
156
|
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
157
|
-
}) =>
|
|
157
|
+
}) => _emotion_react_jsx_runtime2.JSX.Element;
|
|
158
158
|
//#endregion
|
|
159
159
|
export { Banner, Dropdown, HiddenToggle, Icon, SeeMore, VideoItem, VideoThumbnail };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Children, forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useReducer, useRef, useState } from "react";
|
|
1
|
+
import { Children, forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { jsx as jsx$1, jsxs } from "@emotion/react/jsx-runtime";
|
|
4
4
|
import { css } from "@emotion/react";
|
|
@@ -808,17 +808,19 @@ const SeeMore = ({ style, messages = defaultMessages, children, ...rest }) => {
|
|
|
808
808
|
const [expandedHeight, setExpandedHeight] = useState();
|
|
809
809
|
const rootRef = useRef(null);
|
|
810
810
|
const containeRef = useRef();
|
|
811
|
-
|
|
811
|
+
useLayoutEffect(() => {
|
|
812
812
|
if (!rootRef.current) return;
|
|
813
|
-
|
|
813
|
+
const updateExpandStatus = () => {
|
|
814
814
|
if (!containeRef.current) return;
|
|
815
815
|
const collapsedLines = Number.parseInt(window.getComputedStyle(containeRef.current).getPropertyValue("--see-more-collapsed-lines"), 10) || 2;
|
|
816
816
|
const lineCount = getLineCount(containeRef.current);
|
|
817
817
|
const scrollable = lineCount > collapsedLines;
|
|
818
818
|
const fit = lineCount <= collapsedLines;
|
|
819
819
|
setStatus((current) => current === "no-expand" && scrollable ? "collapsed" : current !== "no-expand" && fit ? "no-expand" : current);
|
|
820
|
-
setExpandedHeight(containeRef.current
|
|
821
|
-
}
|
|
820
|
+
setExpandedHeight(containeRef.current.scrollHeight);
|
|
821
|
+
};
|
|
822
|
+
updateExpandStatus();
|
|
823
|
+
return onResize(rootRef.current, updateExpandStatus);
|
|
822
824
|
}, []);
|
|
823
825
|
const toggle = () => setStatus((current) => current === "collapsed" ? "expanded" : "collapsing");
|
|
824
826
|
return /* @__PURE__ */ jsxs("div", {
|