@team-monolith/cds 1.76.3 → 1.76.5
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,16 +1,21 @@
|
|
|
1
|
+
/** @jsxImportSource @emotion/react */
|
|
2
|
+
import { SerializedStyles } from "@emotion/react";
|
|
1
3
|
import React from "react";
|
|
4
|
+
export declare const bookClasses: {
|
|
5
|
+
readonly cover: "Book-cover";
|
|
6
|
+
readonly progressText: "Book-progressText";
|
|
7
|
+
readonly progressBase: "Book-progressBase";
|
|
8
|
+
readonly progressBar: "Book-progressBar";
|
|
9
|
+
};
|
|
2
10
|
export interface ProgressInfo {
|
|
3
11
|
/** 프로그레스 바 상단에 표시되는 텍스트 */
|
|
4
|
-
|
|
12
|
+
title: string;
|
|
5
13
|
/** 프로그레스 바 진행도 (0 ~ 1 사이 숫자) */
|
|
6
|
-
|
|
7
|
-
/** 프로그레스 바 배경 및 텍스트 색상 */
|
|
8
|
-
progressBaseColor: string;
|
|
9
|
-
/** 프로그레스 바 진행도 색상 */
|
|
10
|
-
progressBarColor: string;
|
|
14
|
+
value: number;
|
|
11
15
|
}
|
|
12
16
|
export interface BookProps {
|
|
13
17
|
className?: string;
|
|
18
|
+
bookCss?: SerializedStyles;
|
|
14
19
|
/** 제목 영역 (하단에 노출되는) 텍스트 */
|
|
15
20
|
title?: string;
|
|
16
21
|
/** subtitle 영역 (상단) 텍스트 */
|
|
@@ -31,8 +36,6 @@ export interface BookProps {
|
|
|
31
36
|
onCoverClick?: () => void;
|
|
32
37
|
/** 커버에 노출되는 아이콘 */
|
|
33
38
|
icon?: React.ReactNode;
|
|
34
|
-
/** 커버 색상 */
|
|
35
|
-
coverColor: string;
|
|
36
39
|
/** 진행도 프로그레스 바 영역 */
|
|
37
40
|
progressInfo?: ProgressInfo;
|
|
38
41
|
}
|
|
@@ -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,19 +79,19 @@ 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, bookCss, 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
|
-
return (_jsxs(Container, Object.assign({ initial: "closed", animate: (controlledOpen !== null && controlledOpen !== void 0 ? controlledOpen : open) ? "open" : "closed", ref: ref, onHoverStart: () => {
|
|
85
|
+
return (_jsxs(Container, Object.assign({ css: bookCss, initial: "closed", animate: (controlledOpen !== null && controlledOpen !== void 0 ? controlledOpen : open) ? "open" : "closed", ref: ref, onHoverStart: () => {
|
|
80
86
|
setOpen(true);
|
|
81
87
|
onHoverStart === null || onHoverStart === void 0 ? void 0 : onHoverStart();
|
|
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,29 +103,24 @@ 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.progressBaseColor};
|
|
102
|
-
` }, { children: progressInfo.progressTitle })), _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.progressBaseColor};
|
|
109
112
|
width: 128px;
|
|
110
113
|
height: 6px;
|
|
111
114
|
border-radius: 3px;
|
|
112
|
-
` }, { children: _jsx("div", { css: css `
|
|
113
|
-
|
|
114
|
-
width: ${progressInfo.progressValue * 100}%;
|
|
115
|
+
` }, { children: _jsx("div", { className: bookClasses.progressBar, css: css `
|
|
116
|
+
width: ${progressInfo.value * 100}%;
|
|
115
117
|
height: 6px;
|
|
116
|
-
` }) })), _jsxs("div", Object.assign({ css: css `
|
|
117
|
-
color: ${progressInfo.progressBaseColor};
|
|
118
|
+
` }) })), _jsxs("div", Object.assign({ className: bookClasses.progressText, css: css `
|
|
118
119
|
width: 32px;
|
|
119
120
|
display: flex;
|
|
120
121
|
justify-content: center;
|
|
121
122
|
align-items: center;
|
|
122
|
-
` }, { children: [Math.round(progressInfo.
|
|
123
|
+
` }, { children: [Math.round(progressInfo.value * 100), "%"] }))] }))] }))] })), _jsx(BookGradient, {}), _jsx(Buttons, Object.assign({ variants: buttonsMotion, onClick: (e) => {
|
|
123
124
|
// Button 클릭 시에도 CoverClick 이벤트가 발생하지 않도록 막습니다.
|
|
124
125
|
e.stopPropagation();
|
|
125
126
|
} }, { children: buttons }))] })), _jsx(Shelf, {})] })));
|
|
@@ -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%;
|