@team-monolith/cds 1.76.4 → 1.76.6
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,13 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
export declare const bookClasses: {
|
|
3
|
+
readonly cover: "Book-cover";
|
|
4
|
+
readonly progressText: "Book-progressText";
|
|
5
|
+
readonly progressBase: "Book-progressBase";
|
|
6
|
+
readonly progressBar: "Book-progressBar";
|
|
7
|
+
};
|
|
2
8
|
export interface ProgressInfo {
|
|
3
9
|
/** 프로그레스 바 상단에 표시되는 텍스트 */
|
|
4
10
|
title: string;
|
|
5
11
|
/** 프로그레스 바 진행도 (0 ~ 1 사이 숫자) */
|
|
6
12
|
value: number;
|
|
7
|
-
/** 프로그레스 바 배경 및 텍스트 색상 */
|
|
8
|
-
baseColor: string;
|
|
9
|
-
/** 프로그레스 바 진행도 색상 */
|
|
10
|
-
barColor: string;
|
|
11
13
|
}
|
|
12
14
|
export interface BookProps {
|
|
13
15
|
className?: string;
|
|
@@ -31,8 +33,6 @@ export interface BookProps {
|
|
|
31
33
|
onCoverClick?: () => void;
|
|
32
34
|
/** 커버에 노출되는 아이콘 */
|
|
33
35
|
icon?: React.ReactNode;
|
|
34
|
-
/** 커버 색상 */
|
|
35
|
-
coverColor: string;
|
|
36
36
|
/** 진행도 프로그레스 바 영역 */
|
|
37
37
|
progressInfo?: ProgressInfo;
|
|
38
38
|
}
|
|
@@ -6,6 +6,12 @@ import { forwardRef, useState } from "react";
|
|
|
6
6
|
import shadows from "../../foundation/shadows";
|
|
7
7
|
import { EyeOffFillIcon } from "../../icons";
|
|
8
8
|
import { motion } from "framer-motion";
|
|
9
|
+
export const bookClasses = {
|
|
10
|
+
cover: "Book-cover",
|
|
11
|
+
progressText: "Book-progressText",
|
|
12
|
+
progressBase: "Book-progressBase",
|
|
13
|
+
progressBar: "Book-progressBar",
|
|
14
|
+
};
|
|
9
15
|
// 이 ZINDEX는 Book 컴포넌트 내의 Stacking Context 에서 활용되므로
|
|
10
16
|
// 다른 글로벌 ZINDEX와 충돌을 고려할 필요가 없습니다.
|
|
11
17
|
const ZINDEX_BUTTONS = 5;
|
|
@@ -73,7 +79,7 @@ const CARD_COLOR_PALETTE = (theme) => ({
|
|
|
73
79
|
* @returns
|
|
74
80
|
*/
|
|
75
81
|
function Book(props, ref) {
|
|
76
|
-
const { className, title, subtitle, subtitleBold,
|
|
82
|
+
const { className, title, subtitle, subtitleBold, isHidden = false, buttons, open: controlledOpen, onHoverStart, onHoverEnd, onCoverClick, icon, progressInfo, } = props;
|
|
77
83
|
const theme = useTheme();
|
|
78
84
|
const [open, setOpen] = useState(false);
|
|
79
85
|
return (_jsxs(Container, Object.assign({ initial: "closed", animate: (controlledOpen !== null && controlledOpen !== void 0 ? controlledOpen : open) ? "open" : "closed", ref: ref, onHoverStart: () => {
|
|
@@ -82,10 +88,10 @@ function Book(props, ref) {
|
|
|
82
88
|
}, onHoverEnd: () => {
|
|
83
89
|
setOpen(false);
|
|
84
90
|
onHoverEnd === null || onHoverEnd === void 0 ? void 0 : onHoverEnd();
|
|
85
|
-
} }, { children: [_jsxs(Cover, Object.assign({ className: className
|
|
91
|
+
} }, { children: [_jsxs(Cover, Object.assign({ className: `${className} ${bookClasses.cover}`, css: onCoverClick &&
|
|
86
92
|
css `
|
|
87
93
|
cursor: pointer;
|
|
88
|
-
`,
|
|
94
|
+
`, variants: coverMotion, onClick: () => {
|
|
89
95
|
setOpen(!open);
|
|
90
96
|
onCoverClick === null || onCoverClick === void 0 ? void 0 : onCoverClick();
|
|
91
97
|
} }, { children: [icon && _jsx(CoverIcon, { children: icon }), isHidden && (_jsxs(_Fragment, { children: [_jsx(Hide, {}), _jsx(EyeOffFillIcon, { color: theme.color.foreground.neutralAlt, css: css `
|
|
@@ -97,24 +103,19 @@ function Book(props, ref) {
|
|
|
97
103
|
opacity: 0.8;
|
|
98
104
|
` })] })), _jsxs(CoverTexts, Object.assign({ variants: buttons ? textMotion : undefined }, { children: [_jsx(Subtitle, { children: subtitle }), _jsx(Subtitle, Object.assign({ css: css `
|
|
99
105
|
font-weight: 800;
|
|
100
|
-
` }, { children: subtitleBold })), _jsx(CoverTitle, Object.assign({ showProgress: Boolean(progressInfo) }, { children: title })), progressInfo && (_jsxs(Progress, { children: [_jsx("div", Object.assign({ css: css `
|
|
101
|
-
color: ${progressInfo.baseColor};
|
|
102
|
-
` }, { children: progressInfo.title })), _jsxs("div", Object.assign({ css: css `
|
|
106
|
+
` }, { children: subtitleBold })), _jsx(CoverTitle, Object.assign({ showProgress: Boolean(progressInfo) }, { children: title })), progressInfo && (_jsxs(Progress, { children: [_jsx("div", Object.assign({ className: bookClasses.progressText }, { children: progressInfo.title })), _jsxs("div", Object.assign({ css: css `
|
|
103
107
|
display: flex;
|
|
104
108
|
justify-content: space-between;
|
|
105
109
|
align-items: center;
|
|
106
|
-
` }, { children: [_jsx("div", Object.assign({ css: css `
|
|
110
|
+
` }, { children: [_jsx("div", Object.assign({ className: bookClasses.progressBase, css: css `
|
|
107
111
|
overflow: hidden;
|
|
108
|
-
background-color: ${progressInfo.baseColor};
|
|
109
112
|
width: 128px;
|
|
110
113
|
height: 6px;
|
|
111
114
|
border-radius: 3px;
|
|
112
|
-
` }, { children: _jsx("div", { css: css `
|
|
113
|
-
background-color: ${progressInfo.barColor};
|
|
115
|
+
` }, { children: _jsx("div", { className: bookClasses.progressBar, css: css `
|
|
114
116
|
width: ${progressInfo.value * 100}%;
|
|
115
117
|
height: 6px;
|
|
116
|
-
` }) })), _jsxs("div", Object.assign({ css: css `
|
|
117
|
-
color: ${progressInfo.baseColor};
|
|
118
|
+
` }) })), _jsxs("div", Object.assign({ className: bookClasses.progressText, css: css `
|
|
118
119
|
width: 32px;
|
|
119
120
|
display: flex;
|
|
120
121
|
justify-content: center;
|
|
@@ -133,24 +134,21 @@ const Container = styled(motion.div) `
|
|
|
133
134
|
|
|
134
135
|
padding-top: ${HOVER_Y_OFFSET}px;
|
|
135
136
|
`;
|
|
136
|
-
const Cover = styled(motion.div
|
|
137
|
-
|
|
138
|
-
})(({ backgroundColor }) => css `
|
|
139
|
-
height: ${BOOK_HEIGHT}px;
|
|
137
|
+
const Cover = styled(motion.div) `
|
|
138
|
+
height: ${BOOK_HEIGHT}px;
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
box-shadow: ${shadows.shadow04};
|
|
140
|
+
border-radius: 8px;
|
|
141
|
+
box-shadow: ${shadows.shadow04};
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-direction: row;
|
|
145
|
+
gap: 12px;
|
|
146
|
+
overflow: hidden;
|
|
149
147
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
position: relative;
|
|
149
|
+
bottom: 0px;
|
|
150
|
+
z-index: ${ZINDEX_COVER};
|
|
151
|
+
`;
|
|
154
152
|
const CoverTexts = styled(motion.div) `
|
|
155
153
|
width: 100%;
|
|
156
154
|
height: 100%;
|