pds-dev-kit-web-test 2.7.433 → 2.7.436
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/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.d.ts +6 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +67 -20
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +18 -9
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.d.ts +3 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +8 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.js +11 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.d.ts +6 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.js +54 -0
- package/package.json +1 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { CB_STYLE_PROP_TEXT_SPECS } from '../types';
|
|
3
|
+
import type { CB_BTN_PROPERTIES_TYPE, Device, IndexForIntersection } from '../../../../../../../DynamicLayout/sections/CustomSection/util/types';
|
|
3
4
|
type Props = CB_BTN_PROPERTIES_TYPE & IndexForIntersection;
|
|
4
5
|
declare function Button(props: Props): JSX.Element;
|
|
6
|
+
export declare function getTextStyles(props: CB_STYLE_PROP_TEXT_SPECS, device: Device): {
|
|
7
|
+
style: import("styled-components").CSSProperties;
|
|
8
|
+
hoverStyle: import("styled-components").CSSProperties;
|
|
9
|
+
};
|
|
5
10
|
export default Button;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
2
6
|
var __assign = (this && this.__assign) || function () {
|
|
3
7
|
__assign = Object.assign || function(t) {
|
|
4
8
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -25,27 +29,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
30
|
};
|
|
27
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.getTextStyles = void 0;
|
|
28
33
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
29
34
|
/* eslint-disable react/destructuring-assignment */
|
|
30
35
|
var react_1 = require("react");
|
|
36
|
+
var react_i18next_1 = require("react-i18next");
|
|
31
37
|
var DynamicLayout_1 = require("../../../../../../../DynamicLayout");
|
|
32
38
|
var compositionQueryContext_1 = require("../../../../../../../DynamicLayout/compositionQueryContext");
|
|
33
39
|
var hooks_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/hooks");
|
|
34
40
|
var useGoogleFonts_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/hooks/useGoogleFonts");
|
|
35
41
|
var newUtils_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/newUtils");
|
|
36
42
|
var colorUtil_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/newUtils/colorUtil");
|
|
43
|
+
var types_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/types");
|
|
37
44
|
var util_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/util");
|
|
45
|
+
var parseStylePropShadow_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow");
|
|
46
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
38
47
|
var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverBox");
|
|
39
|
-
var
|
|
48
|
+
var S_CB_Box_1 = require("../components/S_CB_Box");
|
|
49
|
+
require("../components/S_CB_BoxWithShadow");
|
|
50
|
+
var S_HeightFitContentCover_1 = require("../components/S_HeightFitContentCover");
|
|
40
51
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
|
41
52
|
var useCLINK_1 = __importDefault(require("../hooks/useCLINK"));
|
|
42
|
-
var Text_1 = require("../Text/Text");
|
|
43
53
|
var textSpecFormatOptions_1 = require("../Text/textSpecFormatOptions");
|
|
44
54
|
function Button(props) {
|
|
45
|
-
var _a, _b, _c;
|
|
46
|
-
var
|
|
55
|
+
var _a, _b, _c, _d, _e;
|
|
56
|
+
var _f = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _f.device, mode = _f.mode;
|
|
47
57
|
var queryContext = (0, compositionQueryContext_1.useCCBQueryPath)();
|
|
48
|
-
var index = props.index, CB_STYLE_PROP_COLOR = props.CB_STYLE_PROP_COLOR,
|
|
58
|
+
var index = props.index, CB_STYLE_PROP_COLOR = props.CB_STYLE_PROP_COLOR, _g = props.CB_CONTENT_PROP_CLINK, CB_CONTENT_PROP_CLINK_SPEC_SRC = _g.CB_CONTENT_PROP_CLINK_SPEC_SRC, CB_CONTENT_PROP_CLINK_SPEC_TYPE = _g.CB_CONTENT_PROP_CLINK_SPEC_TYPE, CB_CONTENT_PROP_CLINK_SPEC_NEWTAB = _g.CB_CONTENT_PROP_CLINK_SPEC_NEWTAB, CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC = _g.CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC, CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE = _g.CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE, CB_CONTENT_PROP_CLINK_SPEC_CONNECTDATA = _g.CB_CONTENT_PROP_CLINK_SPEC_CONNECTDATA, _h = props.CB_CONTENT_PROP_TEXT, CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE = _h.CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE, CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA = _h.CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA, CB_STYLE_PROP_SHADOW = props.CB_STYLE_PROP_SHADOW, CB_STYLE_PROP_BORDER = props.CB_STYLE_PROP_BORDER, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM, CB_CONTENT_PROP_TEXTOPTION = props.CB_CONTENT_PROP_TEXTOPTION, CB_STYLE_PROP_TEXT = props.CB_STYLE_PROP_TEXT;
|
|
49
59
|
var textSuffix = (_a = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_SUFFIX) !== null && _a !== void 0 ? _a : '';
|
|
50
60
|
var textPrefix = (_b = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_PREFIX) !== null && _b !== void 0 ? _b : '';
|
|
51
61
|
var textFormat = (_c = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_FORMAT) !== null && _c !== void 0 ? _c : 'NONE';
|
|
@@ -63,15 +73,15 @@ function Button(props) {
|
|
|
63
73
|
}
|
|
64
74
|
return CB_CONTENT_PROP_CLINK_SPEC_SRC;
|
|
65
75
|
};
|
|
66
|
-
var
|
|
76
|
+
var _j = (0, useCLINK_1.default)({
|
|
67
77
|
src: cLinkValue(),
|
|
68
78
|
type: CB_CONTENT_PROP_CLINK_SPEC_TYPE,
|
|
69
79
|
openNewTab: CB_CONTENT_PROP_CLINK_SPEC_NEWTAB,
|
|
70
80
|
internalSrc: String(CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC)
|
|
71
|
-
}), onClickCLINK =
|
|
72
|
-
var
|
|
73
|
-
var
|
|
74
|
-
var
|
|
81
|
+
}), onClickCLINK = _j.onClickCLINK, CLINKCursor = _j.CLINKCursor;
|
|
82
|
+
var _k = getTextStyles(props.CB_STYLE_PROP_TEXT, device), btnTextStyle = _k.style, btnTextHoverStyle = _k.hoverStyle;
|
|
83
|
+
var _l = getBTNColorStyles(CB_STYLE_PROP_COLOR, device), btnColorStyle = _l.style, btnColorHoverStyle = _l.hoverStyle;
|
|
84
|
+
var _m = (0, util_1.parseProperties)(props, device), propsStyle = _m.style, propsHoverStyle = _m.hoverStyle, _o = _m.layout, paddingLeft = _o.paddingLeft, paddingRight = _o.paddingRight, paddingTop = _o.paddingTop, paddingBottom = _o.paddingBottom, layoutStyle = __rest(_o, ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"]), effect = _m.effect;
|
|
75
85
|
var isEditModeAndHidden = propsStyle.visibility === 'hidden' && mode === 'EDIT';
|
|
76
86
|
var googleFonts = (0, useGoogleFonts_1.getGoogleFontsFromTextSpecCode)(props.CB_STYLE_PROP_TEXT, device === 'MOBILE');
|
|
77
87
|
(0, useGoogleFonts_1.useGoogleFonts)({ fonts: googleFonts });
|
|
@@ -132,16 +142,42 @@ function Button(props) {
|
|
|
132
142
|
}
|
|
133
143
|
return props.CB_CONTENT_PROP_TEXT.CB_CONTENT_PROP_TEXT_SPEC_TEXT;
|
|
134
144
|
};
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
var desktopHeightFitContent = (_d = CB_STYLE_PROP_TEXT === null || CB_STYLE_PROP_TEXT === void 0 ? void 0 : CB_STYLE_PROP_TEXT.CB_STYLE_PROP_TEXT_SPEC_FITCONTENT) !== null && _d !== void 0 ? _d : false;
|
|
146
|
+
var mobileHeightFitContent = (_e = CB_STYLE_PROP_TEXT === null || CB_STYLE_PROP_TEXT === void 0 ? void 0 : CB_STYLE_PROP_TEXT['CB_STYLE_PROP_TEXT_SPEC_FITCONTENT:MOBILE']) !== null && _e !== void 0 ? _e : desktopHeightFitContent;
|
|
147
|
+
var heightFitContent = device === 'MOBILE' ? mobileHeightFitContent : desktopHeightFitContent;
|
|
148
|
+
var isEditModeAndHeightFitContent = heightFitContent && mode === 'EDIT';
|
|
149
|
+
var t = (0, react_i18next_1.useTranslation)('translation').t;
|
|
150
|
+
var _p = (0, parseStylePropShadow_1.generateBoxShadow)(CB_STYLE_PROP_SHADOW, device), normalShadowStyle = _p.normalStyle, hoverShadowStyle = _p.hoverStyle;
|
|
151
|
+
var _q = extractBorderStyles(propsStyle), borderNormalStyle = _q.borderStyleProps, cleanedNormalStyle = _q.remainingStyle;
|
|
152
|
+
// hover 스타일 분리
|
|
153
|
+
var _r = extractBorderStyles(propsHoverStyle), borderHoverStyle = _r.borderStyleProps, cleanedHoverStyle = _r.remainingStyle;
|
|
154
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), isEditModeAndHeightFitContent && (0, jsx_runtime_1.jsx)(S_HeightFitContentCover_1.S_HeightFitContentCover, { bottomText: t('str_10106') }), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle, style: { paddingLeft: paddingLeft, paddingRight: paddingRight, paddingBottom: paddingBottom, paddingTop: paddingTop } }, { children: (0, jsx_runtime_1.jsx)(S_ShadowBox, __assign({ "$normalStyle": __assign(__assign(__assign({ height: '100%', display: 'flex', alignItems: "".concat(btnTextStyle.alignItems), overflowY: btnTextStyle.overflowY, scrollbarWidth: btnTextStyle.scrollbarWidth }, effectCssProperties), normalShadowStyle), borderNormalStyle), "$hoverStyle": __assign(__assign({}, hoverShadowStyle), borderHoverStyle) }, { children: (0, jsx_runtime_1.jsxs)(S_CB_Box_1.S_CB_Box, __assign({ onMouseLeave: function (e) {
|
|
141
155
|
e.currentTarget.classList.remove('hovered');
|
|
142
|
-
}, className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign(__assign({}, btnTextStyle),
|
|
156
|
+
}, className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign(__assign({}, btnTextStyle), cleanedNormalStyle), layoutStyle), btnColorStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word', cursor: CLINKCursor, overflowY: 'unset', scrollbarWidth: 'unset' }), hoverStyle: __assign(__assign(__assign(__assign({}, btnTextHoverStyle), cleanedHoverStyle), btnColorHoverStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }), onClick: onClickCLINK }, { children: [textPrefix, textValue(), textSuffix] })) })) }))] }));
|
|
157
|
+
}
|
|
158
|
+
function extractBorderStyles(style) {
|
|
159
|
+
var
|
|
160
|
+
// 추출할 키들
|
|
161
|
+
borderTopLeftRadius = style.borderTopLeftRadius, borderTopRightRadius = style.borderTopRightRadius, borderBottomLeftRadius = style.borderBottomLeftRadius, borderBottomRightRadius = style.borderBottomRightRadius, borderStyle = style.borderStyle, borderWidth = style.borderWidth, borderColor = style.borderColor,
|
|
162
|
+
// 나머지 모든 속성은 'rest'에 담김 (원본에서 제거된 효과)
|
|
163
|
+
rest = __rest(style, ["borderTopLeftRadius", "borderTopRightRadius", "borderBottomLeftRadius", "borderBottomRightRadius", "borderStyle", "borderWidth", "borderColor"]);
|
|
164
|
+
// 추출된 Border 스타일 객체
|
|
165
|
+
var borderStyleProps = {
|
|
166
|
+
borderTopLeftRadius: borderTopLeftRadius,
|
|
167
|
+
borderTopRightRadius: borderTopRightRadius,
|
|
168
|
+
borderBottomLeftRadius: borderBottomLeftRadius,
|
|
169
|
+
borderBottomRightRadius: borderBottomRightRadius,
|
|
170
|
+
borderStyle: borderStyle,
|
|
171
|
+
borderWidth: borderWidth,
|
|
172
|
+
borderColor: borderColor,
|
|
173
|
+
};
|
|
174
|
+
return {
|
|
175
|
+
borderStyleProps: borderStyleProps,
|
|
176
|
+
remainingStyle: rest, // border가 제거된 나머지 스타일
|
|
177
|
+
};
|
|
143
178
|
}
|
|
144
|
-
function
|
|
179
|
+
var S_ShadowBox = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n\n &:hover {\n ", "\n }\n"], ["\n ", "\n\n &:hover {\n ", "\n }\n"])), function (props) { return props.$normalStyle; }, function (props) { return props.$hoverStyle; });
|
|
180
|
+
function getTextStyles(props, device) {
|
|
145
181
|
var availableSpecCodes = [
|
|
146
182
|
'CB_STYLE_PROP_TEXT_SPEC_TYPEFACE',
|
|
147
183
|
'CB_STYLE_PROP_TEXT_SPEC_WEIGHT',
|
|
@@ -150,10 +186,20 @@ function getBTNStyles(props, device) {
|
|
|
150
186
|
'CB_STYLE_PROP_TEXT_SPEC_LETTERSPACING',
|
|
151
187
|
'CB_STYLE_PROP_TEXT_SPEC_COLOR',
|
|
152
188
|
'CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL',
|
|
153
|
-
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL'
|
|
189
|
+
'CB_STYLE_PROP_TEXT_SPEC_VERTICAL',
|
|
190
|
+
'CB_STYLE_PROP_TEXT_SPEC_FITCONTENT',
|
|
191
|
+
'CB_STYLE_PROP_TEXT_SPEC_SCROLLCONTENTS',
|
|
192
|
+
'CB_STYLE_PROP_TEXT_SPEC_SCROLLBAR'
|
|
154
193
|
];
|
|
155
|
-
return (0, newUtils_1.parseStyleTextToCSSProp)({
|
|
194
|
+
return (0, newUtils_1.parseStyleTextToCSSProp)({
|
|
195
|
+
availableSpecCodes: availableSpecCodes,
|
|
196
|
+
props: props,
|
|
197
|
+
device: device,
|
|
198
|
+
propKey: 'TEXT',
|
|
199
|
+
cbCode: types_1.CB_ALL_CODES.CB_BTN
|
|
200
|
+
});
|
|
156
201
|
}
|
|
202
|
+
exports.getTextStyles = getTextStyles;
|
|
157
203
|
function getBTNColorStyles(props, device) {
|
|
158
204
|
var availableSpecCodes = [
|
|
159
205
|
'CB_STYLE_PROP_COLOR_SPEC_ANGLE',
|
|
@@ -168,3 +214,4 @@ function getBTNColorStyles(props, device) {
|
|
|
168
214
|
return (0, colorUtil_1.parseStyleColorToCSSProp)({ availableSpecCodes: availableSpecCodes, props: props, propKey: 'COLOR', device: device });
|
|
169
215
|
}
|
|
170
216
|
exports.default = Button;
|
|
217
|
+
var templateObject_1;
|
|
@@ -21,6 +21,7 @@ var react_1 = require("react");
|
|
|
21
21
|
var react_i18next_1 = require("react-i18next");
|
|
22
22
|
var DynamicLayout_1 = require("../../../../../../../DynamicLayout");
|
|
23
23
|
var compositionQueryContext_1 = require("../../../../../../../DynamicLayout/compositionQueryContext");
|
|
24
|
+
var types_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/types");
|
|
24
25
|
var hooks_1 = require("../../../../hooks");
|
|
25
26
|
var getGoogleFonts_1 = require("../../../../hooks/useGoogleFonts/getGoogleFonts");
|
|
26
27
|
var useGoogleFonts_1 = __importDefault(require("../../../../hooks/useGoogleFonts/useGoogleFonts"));
|
|
@@ -34,10 +35,10 @@ var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
|
|
34
35
|
var useCLINK_1 = __importDefault(require("../hooks/useCLINK"));
|
|
35
36
|
var textSpecFormatOptions_1 = require("./textSpecFormatOptions");
|
|
36
37
|
function Text(props) {
|
|
37
|
-
var _a, _b, _c, _d;
|
|
38
|
-
var
|
|
38
|
+
var _a, _b, _c, _d, _e;
|
|
39
|
+
var _f = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _f.device, mode = _f.mode;
|
|
39
40
|
var queryContext = (0, compositionQueryContext_1.useCCBQueryPath)();
|
|
40
|
-
var index = props.index,
|
|
41
|
+
var index = props.index, _g = props.CB_CONTENT_PROP_CLINK, CB_CONTENT_PROP_CLINK_SPEC_SRC = _g.CB_CONTENT_PROP_CLINK_SPEC_SRC, CB_CONTENT_PROP_CLINK_SPEC_TYPE = _g.CB_CONTENT_PROP_CLINK_SPEC_TYPE, CB_CONTENT_PROP_CLINK_SPEC_NEWTAB = _g.CB_CONTENT_PROP_CLINK_SPEC_NEWTAB, CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC = _g.CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC, CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE = _g.CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE, CB_CONTENT_PROP_CLINK_SPEC_CONNECTDATA = _g.CB_CONTENT_PROP_CLINK_SPEC_CONNECTDATA, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM, _h = props.CB_CONTENT_PROP_TEXT, CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE = _h.CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE, CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA = _h.CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA, CB_CONTENT_PROP_TEXTOPTION = props.CB_CONTENT_PROP_TEXTOPTION, CB_STYLE_PROP_TEXT = props.CB_STYLE_PROP_TEXT;
|
|
41
42
|
// const {
|
|
42
43
|
// CB_CONTENT_PROP_TEXTOPTION_SPEC_SUFFIX,
|
|
43
44
|
// CB_CONTENT_PROP_TEXTOPTION_SPEC_PREFIX,
|
|
@@ -50,7 +51,9 @@ function Text(props) {
|
|
|
50
51
|
var textSuffix = (_a = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_SUFFIX) !== null && _a !== void 0 ? _a : '';
|
|
51
52
|
var textPrefix = (_b = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_PREFIX) !== null && _b !== void 0 ? _b : '';
|
|
52
53
|
var textFormat = (_c = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_FORMAT) !== null && _c !== void 0 ? _c : 'NONE';
|
|
53
|
-
var
|
|
54
|
+
var desktopHeightFitContent = (_d = CB_STYLE_PROP_TEXT === null || CB_STYLE_PROP_TEXT === void 0 ? void 0 : CB_STYLE_PROP_TEXT.CB_STYLE_PROP_TEXT_SPEC_FITCONTENT) !== null && _d !== void 0 ? _d : true;
|
|
55
|
+
var mobileHeightFitContent = (_e = CB_STYLE_PROP_TEXT === null || CB_STYLE_PROP_TEXT === void 0 ? void 0 : CB_STYLE_PROP_TEXT['CB_STYLE_PROP_TEXT_SPEC_FITCONTENT:MOBILE']) !== null && _e !== void 0 ? _e : desktopHeightFitContent;
|
|
56
|
+
var heightFitContent = device === 'MOBILE' ? mobileHeightFitContent : desktopHeightFitContent;
|
|
54
57
|
var cLinkValue = function () {
|
|
55
58
|
if (CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE === 'DATA' ||
|
|
56
59
|
CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE === 'DELEGATEDDATA') {
|
|
@@ -65,14 +68,14 @@ function Text(props) {
|
|
|
65
68
|
}
|
|
66
69
|
return CB_CONTENT_PROP_CLINK_SPEC_SRC;
|
|
67
70
|
};
|
|
68
|
-
var
|
|
71
|
+
var _j = (0, useCLINK_1.default)({
|
|
69
72
|
src: cLinkValue(),
|
|
70
73
|
type: CB_CONTENT_PROP_CLINK_SPEC_TYPE,
|
|
71
74
|
openNewTab: CB_CONTENT_PROP_CLINK_SPEC_NEWTAB,
|
|
72
75
|
internalSrc: String(CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC)
|
|
73
|
-
}), CLINKCursor =
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
+
}), CLINKCursor = _j.CLINKCursor, onClickCLINK = _j.onClickCLINK;
|
|
77
|
+
var _k = getTextStyles(props.CB_STYLE_PROP_TEXT, device), textStyle = _k.style, textHoverStyle = _k.hoverStyle;
|
|
78
|
+
var _l = (0, util_1.parseProperties)(props, device), propsStyle = _l.style, propsHoverStyle = _l.hoverStyle, layoutStyle = _l.layout, effect = _l.effect;
|
|
76
79
|
var isEditModeAndHidden = propsStyle.visibility === 'hidden' && mode === 'EDIT';
|
|
77
80
|
var isEditModeAndHeightFitContent = heightFitContent && mode === 'EDIT';
|
|
78
81
|
var googleFonts = (0, getGoogleFonts_1.getGoogleFontsFromTextSpecCode)(props.CB_STYLE_PROP_TEXT, device === 'MOBILE');
|
|
@@ -166,6 +169,12 @@ function getTextStyles(props, device) {
|
|
|
166
169
|
'CB_STYLE_PROP_TEXT_SPEC_SCROLLCONTENTS',
|
|
167
170
|
'CB_STYLE_PROP_TEXT_SPEC_SCROLLBAR'
|
|
168
171
|
];
|
|
169
|
-
return (0, textUtil_1.parseStyleTextToCSSProp)({
|
|
172
|
+
return (0, textUtil_1.parseStyleTextToCSSProp)({
|
|
173
|
+
availableSpecCodes: availableSpecCodes,
|
|
174
|
+
props: props,
|
|
175
|
+
device: device,
|
|
176
|
+
propKey: 'TEXT',
|
|
177
|
+
cbCode: types_1.CB_ALL_CODES.CB_TEXT
|
|
178
|
+
});
|
|
170
179
|
}
|
|
171
180
|
exports.getTextStyles = getTextStyles;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { CB_ALL_CODES } from '../types';
|
|
1
2
|
import type { Device } from '../util/types';
|
|
2
3
|
import type { CSSProperties } from 'styled-components';
|
|
3
|
-
export declare function parseStyleTextToCSSProp<T>({ availableSpecCodes, props, propKey, device }: ParseStyleTextProps<T>): {
|
|
4
|
+
export declare function parseStyleTextToCSSProp<T>({ availableSpecCodes, props, propKey, device, cbCode }: ParseStyleTextProps<T>): {
|
|
4
5
|
style: CSSProperties;
|
|
5
6
|
hoverStyle: CSSProperties;
|
|
6
7
|
};
|
|
@@ -9,6 +10,7 @@ type ParseStyleTextProps<T> = {
|
|
|
9
10
|
props: T;
|
|
10
11
|
propKey: 'TEXT';
|
|
11
12
|
device: Device;
|
|
13
|
+
cbCode: CB_ALL_CODES.CB_BTN | CB_ALL_CODES.CB_TEXT;
|
|
12
14
|
};
|
|
13
15
|
export declare function getTextCSSPropKey(key: string, cbName: 'TEXT'): "" | "color" | "letterSpacing" | "fontWeight" | "fontFamily" | "lineHeight" | "fontSize" | "HORIZONTAL" | "alignItems" | "overflowY" | "scrollbarWidth" | "overflow";
|
|
14
16
|
export {};
|
|
@@ -12,8 +12,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.getTextCSSPropKey = exports.parseStyleTextToCSSProp = void 0;
|
|
15
|
+
var types_1 = require("../types");
|
|
15
16
|
function parseStyleTextToCSSProp(_a) {
|
|
16
|
-
var
|
|
17
|
+
var _b, _c;
|
|
18
|
+
var availableSpecCodes = _a.availableSpecCodes, props = _a.props, propKey = _a.propKey, device = _a.device, cbCode = _a.cbCode;
|
|
17
19
|
var styleProps = availableSpecCodes.reduce(function (acc, currentKey) {
|
|
18
20
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
19
21
|
var stringifiedKey = currentKey.toString();
|
|
@@ -134,10 +136,11 @@ function parseStyleTextToCSSProp(_a) {
|
|
|
134
136
|
style: {},
|
|
135
137
|
hoverStyle: {}
|
|
136
138
|
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
var
|
|
139
|
+
// const cbCode = props
|
|
140
|
+
var defaultValue = cbCode === types_1.CB_ALL_CODES.CB_BTN ? false : true;
|
|
141
|
+
var desktopValue = (_b = props['CB_STYLE_PROP_TEXT_SPEC_FITCONTENT']) !== null && _b !== void 0 ? _b : defaultValue;
|
|
142
|
+
var mobileValue = (_c = props['CB_STYLE_PROP_TEXT_SPEC_FITCONTENT:MOBILE']) !== null && _c !== void 0 ? _c : desktopValue;
|
|
143
|
+
var fitContentValue = device === 'DESKTOP' ? desktopValue : mobileValue;
|
|
141
144
|
if (fitContentValue === true) {
|
|
142
145
|
styleProps.style.overflowY = 'hidden';
|
|
143
146
|
}
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.parsePlacement = exports.getHeightFitContent = void 0;
|
|
13
13
|
var types_1 = require("../types");
|
|
14
14
|
function getHeightFitContent(cb) {
|
|
15
|
-
var _a, _b, _c, _d;
|
|
15
|
+
var _a, _b, _c, _d, _e, _f;
|
|
16
16
|
if (cb.componentBlockCode === types_1.CB_ALL_CODES.CB_TEXT) {
|
|
17
17
|
var desktop = (_a = cb.jsonProperties.data.CB_STYLE_PROP_TEXT.CB_STYLE_PROP_TEXT_SPEC_FITCONTENT) !== null && _a !== void 0 ? _a : true;
|
|
18
18
|
var mobile = (_b = cb.jsonProperties.data.CB_STYLE_PROP_TEXT['CB_STYLE_PROP_TEXT_SPEC_FITCONTENT:MOBILE']) !== null && _b !== void 0 ? _b : desktop;
|
|
@@ -21,9 +21,17 @@ function getHeightFitContent(cb) {
|
|
|
21
21
|
mobile: mobile
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
if (cb.componentBlockCode === types_1.CB_ALL_CODES.CB_BTN) {
|
|
25
|
+
var desktop = (_c = cb.jsonProperties.data.CB_STYLE_PROP_TEXT.CB_STYLE_PROP_TEXT_SPEC_FITCONTENT) !== null && _c !== void 0 ? _c : false;
|
|
26
|
+
var mobile = (_d = cb.jsonProperties.data.CB_STYLE_PROP_TEXT['CB_STYLE_PROP_TEXT_SPEC_FITCONTENT:MOBILE']) !== null && _d !== void 0 ? _d : desktop;
|
|
27
|
+
return {
|
|
28
|
+
desktop: desktop,
|
|
29
|
+
mobile: mobile
|
|
30
|
+
};
|
|
31
|
+
}
|
|
24
32
|
if (cb.componentBlockCode === types_1.CB_ALL_CODES.CB_LIST) {
|
|
25
|
-
var desktop = (
|
|
26
|
-
var mobile = (
|
|
33
|
+
var desktop = (_e = cb.jsonProperties.data.CB_STYLE_PROP_CONTENTSLISTDESIGN.CB_STYLE_PROP_CONTENTSLISTDESIGN_SPEC_ITEMHEIGHTFITCONTENT) !== null && _e !== void 0 ? _e : true;
|
|
34
|
+
var mobile = (_f = cb.jsonProperties.data.CB_STYLE_PROP_CONTENTSLISTDESIGN['CB_STYLE_PROP_CONTENTSLISTDESIGN_SPEC_ITEMHEIGHTFITCONTENT:MOBILE']) !== null && _f !== void 0 ? _f : desktop;
|
|
27
35
|
return {
|
|
28
36
|
desktop: desktop,
|
|
29
37
|
mobile: mobile
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Device, ENUM_STRING, NUMBER_INTEGER, STRING_8DIGIT_HEX, StyleAndHoverStyle } from '../types';
|
|
2
2
|
import type { CB_STYLE_PROP_KEYS } from './types';
|
|
3
|
+
import type { CSSProperties } from 'styled-components';
|
|
3
4
|
export type NAMED_CB_STYLE_SHADOW_PROPS = {
|
|
4
5
|
name: CB_STYLE_PROP_KEYS.CB_STYLE_PROP_SHADOW;
|
|
5
6
|
specs: CB_STYLE_PROP_SHADOW_SPECS;
|
|
@@ -37,3 +38,8 @@ export type CB_STYLE_PROP_SHADOW_SPECS = CB_STYLE_PROP_SHADOW_SPECS_BASE & {
|
|
|
37
38
|
'CB_STYLE_PROP_SHADOW_SPEC_OPACITY:MOBILE': NUMBER_INTEGER | null | undefined;
|
|
38
39
|
'CB_STYLE_PROP_SHADOW_SPEC_OPACITY:MOBILE:HOVER': NUMBER_INTEGER | null | undefined;
|
|
39
40
|
};
|
|
41
|
+
export interface ShadowStyles {
|
|
42
|
+
normalStyle: CSSProperties;
|
|
43
|
+
hoverStyle: CSSProperties;
|
|
44
|
+
}
|
|
45
|
+
export declare function generateBoxShadow(specs: CB_STYLE_PROP_SHADOW_SPECS, device: Device): ShadowStyles;
|
|
@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.generateBoxShadow = void 0;
|
|
14
15
|
var AVAILABLE_SPECS = [
|
|
15
16
|
'CB_STYLE_PROP_SHADOW_SPEC_TYPE',
|
|
16
17
|
'CB_STYLE_PROP_SHADOW_SPEC_COLOR',
|
|
@@ -56,3 +57,56 @@ function valueGenerator(valueSet) {
|
|
|
56
57
|
return '';
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
var hex8ToRgba = function (hex, opacityFactor) {
|
|
61
|
+
var cleanHex = hex.replace('#', '');
|
|
62
|
+
if (cleanHex.length !== 8)
|
|
63
|
+
return hex; // Fallback if invalid
|
|
64
|
+
var r = parseInt(cleanHex.substring(0, 2), 16);
|
|
65
|
+
var g = parseInt(cleanHex.substring(2, 4), 16);
|
|
66
|
+
var b = parseInt(cleanHex.substring(4, 6), 16);
|
|
67
|
+
var aHex = parseInt(cleanHex.substring(6, 8), 16);
|
|
68
|
+
var alpha = (aHex / 255) * (opacityFactor / 100);
|
|
69
|
+
return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha.toFixed(3), ")");
|
|
70
|
+
};
|
|
71
|
+
function generateBoxShadow(specs, device) {
|
|
72
|
+
var resolve = function (baseKey, isHover) {
|
|
73
|
+
var _a, _b, _c;
|
|
74
|
+
var mobileKey = "".concat(baseKey, ":MOBILE");
|
|
75
|
+
var hoverKey = "".concat(baseKey, ":HOVER");
|
|
76
|
+
var mobileHoverKey = "".concat(baseKey, ":MOBILE:HOVER");
|
|
77
|
+
var baseVal = specs[baseKey];
|
|
78
|
+
if (device === 'MOBILE') {
|
|
79
|
+
var mobileVal = (_a = specs[mobileKey]) !== null && _a !== void 0 ? _a : baseVal;
|
|
80
|
+
if (isHover) {
|
|
81
|
+
return (_b = specs[mobileHoverKey]) !== null && _b !== void 0 ? _b : mobileVal;
|
|
82
|
+
}
|
|
83
|
+
return mobileVal;
|
|
84
|
+
}
|
|
85
|
+
// DESKTOP
|
|
86
|
+
if (isHover) {
|
|
87
|
+
return (_c = specs[hoverKey]) !== null && _c !== void 0 ? _c : baseVal;
|
|
88
|
+
}
|
|
89
|
+
return baseVal;
|
|
90
|
+
};
|
|
91
|
+
var buildShadowString = function (isHover) {
|
|
92
|
+
var type = resolve('CB_STYLE_PROP_SHADOW_SPEC_TYPE', isHover);
|
|
93
|
+
var colorHex = resolve('CB_STYLE_PROP_SHADOW_SPEC_COLOR', isHover);
|
|
94
|
+
var x = resolve('CB_STYLE_PROP_SHADOW_SPEC_X', isHover);
|
|
95
|
+
var y = resolve('CB_STYLE_PROP_SHADOW_SPEC_Y', isHover);
|
|
96
|
+
var blur = resolve('CB_STYLE_PROP_SHADOW_SPEC_BLUR', isHover);
|
|
97
|
+
var spread = resolve('CB_STYLE_PROP_SHADOW_SPEC_SPREAD', isHover);
|
|
98
|
+
var opacity = resolve('CB_STYLE_PROP_SHADOW_SPEC_OPACITY', isHover);
|
|
99
|
+
var finalColor = hex8ToRgba(colorHex, opacity);
|
|
100
|
+
var insetStr = type && type.toLowerCase() === 'inset' ? 'inset ' : '';
|
|
101
|
+
return "".concat(insetStr).concat(x, "px ").concat(y, "px ").concat(blur, "px ").concat(spread, "px ").concat(finalColor);
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
normalStyle: {
|
|
105
|
+
boxShadow: buildShadowString(false)
|
|
106
|
+
},
|
|
107
|
+
hoverStyle: {
|
|
108
|
+
boxShadow: buildShadowString(true)
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
exports.generateBoxShadow = generateBoxShadow;
|