pds-dev-kit-web 2.2.89 → 2.2.93

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.
Files changed (28) hide show
  1. package/dist/src/common/assets/icons/image/index.js +1 -1
  2. package/dist/src/common/styles/colorSet/PaletteColor_Dark.json +3 -2
  3. package/dist/src/common/styles/colorSet/PaletteColor_light.json +4 -3
  4. package/dist/src/common/styles/colorSet/UIColor.json +3 -1
  5. package/dist/src/common/styles/colorSet/index.d.ts +6 -2
  6. package/dist/src/common/styles/colorSet/index.js +2 -2
  7. package/dist/src/common/styles/colorSet/ui-type.d.ts +2 -0
  8. package/dist/src/sub/DynamicLayout/components/SectionMatcher/SectionMatcher.js +5 -1
  9. package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +10300 -0
  10. package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +30935 -2
  11. package/dist/src/sub/DynamicLayout/sectionActionTypes.d.ts +11 -0
  12. package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.d.ts +1 -0
  13. package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +28 -6
  14. package/dist/src/sub/DynamicLayout/sections/CustomSection/FlexGridCustomSection.d.ts +13 -0
  15. package/dist/src/sub/DynamicLayout/sections/CustomSection/FlexGridCustomSection.js +256 -0
  16. package/dist/src/sub/DynamicLayout/sections/CustomSection/FlexGridItem.d.ts +11 -0
  17. package/dist/src/sub/DynamicLayout/sections/CustomSection/FlexGridItem.js +72 -0
  18. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +1 -1
  19. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +5 -2
  20. package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useIsMounted.d.ts +1 -0
  21. package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useIsMounted.js +15 -0
  22. package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useResizableObserver.d.ts +12 -0
  23. package/dist/src/sub/DynamicLayout/sections/CustomSection/hooks/useResizableObserver.js +74 -0
  24. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +3 -2
  25. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.d.ts +2 -0
  26. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parsePlacement.js +8 -5
  27. package/package.json +2 -2
  28. package/release-note.md +2 -2
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { ISection } from '../../types';
3
+ import type { Layout } from 'publ-echo/dist/lib/GridLayoutEditor/types';
4
+ export type LayoutsType = {
5
+ sm: Layout;
6
+ lg: Layout;
7
+ };
8
+ export type CustomSectionImperativeHandleRef = {
9
+ selectCB: (cbId: number | 'group') => void;
10
+ selectCBInBulk: (cbIds: string[]) => void;
11
+ };
12
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<ISection & React.RefAttributes<unknown>>>;
13
+ export default _default;
@@ -0,0 +1,256 @@
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
+ };
6
+ var __assign = (this && this.__assign) || function () {
7
+ __assign = Object.assign || function(t) {
8
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
+ t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ var jsx_runtime_1 = require("react/jsx-runtime");
45
+ var react_1 = __importStar(require("react"));
46
+ var ErrorBoundary_1 = require("../../../DynamicLayout/components/Section/ErrorBoundary");
47
+ var dynamicLayoutContext_1 = require("../../../DynamicLayout/dynamicLayoutContext");
48
+ var styled_components_1 = __importDefault(require("styled-components"));
49
+ var components_1 = require("../../components");
50
+ var CustomSection_1 = require("./CustomSection");
51
+ var FlexGridItem_1 = __importDefault(require("./FlexGridItem"));
52
+ var useGroupDrag_1 = require("./hooks/useGroupDrag");
53
+ var useGroupDrag_2 = require("./hooks/useGroupDrag/useGroupDrag");
54
+ var utils_1 = require("./hooks/useGroupDrag/utils");
55
+ var useResizableObserver_1 = require("./hooks/useResizableObserver");
56
+ var util_1 = require("./util");
57
+ var parseSectionPadding_1 = __importDefault(require("./util/layoutPropParsers/parseSectionPadding"));
58
+ var GRID_CELL_MIN = 24;
59
+ var DESKTOP_GRID_COLS = 24;
60
+ var MOBILE_GRID_COLS = 8;
61
+ var GLE_MIN_WIDTH_DESKTOP_PX = "".concat(GRID_CELL_MIN * DESKTOP_GRID_COLS, "px");
62
+ var GLE_MIN_WIDTH_MOBILE_PX = "".concat(GRID_CELL_MIN * MOBILE_GRID_COLS, "px");
63
+ var CustomSection = (0, react_1.forwardRef)(function CustomSection(props, ref) {
64
+ var _a;
65
+ var _b = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _b.device, editingSectionId = _b.editingSectionId, mode = _b.mode, shortcutKeyMode = _b.shortcutKeyMode, sectionActionHandler = _b.sectionActionHandler;
66
+ var componentBlocks = props.componentBlocks, jsonProperties = props.jsonProperties;
67
+ var _c = jsonProperties.data, CB_PLACEMENT_PROP_SECTION = _c.CB_PLACEMENT_PROP_SECTION, CB_LAYOUT_PROP_PADDING = _c.CB_LAYOUT_PROP_PADDING;
68
+ var containerRef = (0, react_1.useRef)(null);
69
+ var size = (0, useResizableObserver_1.useResizeObserver)({ ref: containerRef, box: 'border-box' });
70
+ var _d = (0, react_1.useState)(null), selectedCB = _d[0], setSelectedCB = _d[1];
71
+ var gleRef = (0, react_1.useRef)(null);
72
+ var isMobile = device === 'MOBILE';
73
+ var isEditMode = mode === 'EDIT';
74
+ var layoutByDevice = device === 'DESKTOP' ? 'lg' : 'sm';
75
+ var _e = (0, react_1.useState)(function () {
76
+ var _a = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []), lg = _a.lg, sm = _a.sm;
77
+ return {
78
+ lg: lg,
79
+ sm: sm
80
+ };
81
+ }), layouts = _e[0], setLayouts = _e[1];
82
+ var _f = (0, useGroupDrag_1.useGroupDrag)({
83
+ setLayouts: setLayouts,
84
+ device: device,
85
+ sectionActionHandler: sectionActionHandler
86
+ }), breakGroupCB = _f.breakGroupCB, makeAllInOneGroup = _f.makeAllInOneGroup, makeCollisionGroup = _f.makeCollisionGroup;
87
+ (0, react_1.useImperativeHandle)(ref, function () {
88
+ return {
89
+ selectCB: function (cbId) {
90
+ setSelectedCB(cbId);
91
+ },
92
+ selectCBInBulk: function (cbIds) {
93
+ var parsedLayouts = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []);
94
+ setLayouts(function (prev) {
95
+ var _a;
96
+ var filteredLayout = (0, useGroupDrag_2.filterItemsById)(parsedLayouts[layoutByDevice], cbIds);
97
+ var newGroupLayout = (0, utils_1.getGroupForMultiple)(parsedLayouts[layoutByDevice].filter(function (each) { return cbIds.includes(each.i); }));
98
+ filteredLayout.push(newGroupLayout);
99
+ return __assign(__assign({}, prev), (_a = {}, _a[layoutByDevice] = filteredLayout, _a));
100
+ });
101
+ }
102
+ };
103
+ }, [componentBlocks]);
104
+ (0, react_1.useLayoutEffect)(function () {
105
+ var parsedLayouts = (0, util_1.parsePlacement)(componentBlocks !== null && componentBlocks !== void 0 ? componentBlocks : []);
106
+ setLayouts(function (prev) {
107
+ var _a;
108
+ var _b;
109
+ var group = (0, useGroupDrag_2.getGroupCB)(prev[layoutByDevice]);
110
+ var groupedCBIds = (_b = group === null || group === void 0 ? void 0 : group.childrenIds) !== null && _b !== void 0 ? _b : [];
111
+ var filteredLayout = (0, useGroupDrag_2.filterItemsById)(parsedLayouts[layoutByDevice], groupedCBIds);
112
+ if (group === null || group === void 0 ? void 0 : group.groupLayouts) {
113
+ var groupCbs = parsedLayouts[layoutByDevice].filter(function (each) {
114
+ return groupedCBIds.includes(each.i);
115
+ });
116
+ if (groupCbs.length > 0) {
117
+ var newGroupLayout = (0, utils_1.getGroupForMultiple)(groupCbs);
118
+ filteredLayout.push(newGroupLayout);
119
+ }
120
+ }
121
+ return __assign(__assign({}, prev), (_a = {}, _a[layoutByDevice] = filteredLayout, _a));
122
+ });
123
+ }, [componentBlocks, useGroupDrag_2.getGroupCB, layoutByDevice]);
124
+ (0, react_1.useEffect)(function () {
125
+ if (editingSectionId !== props.id) {
126
+ setSelectedCB(null);
127
+ breakGroupCB();
128
+ }
129
+ }, [editingSectionId]);
130
+ // NOTE: 추후에 event를 외부에서 전달받게하거나, 아예 상태를 끌어올리거나 해야합니다.
131
+ (0, react_1.useLayoutEffect)(function () {
132
+ if (props.id !== editingSectionId) {
133
+ return;
134
+ }
135
+ if (!shortcutKeyMode) {
136
+ return;
137
+ }
138
+ if (shortcutKeyMode === 'SELECT_ALL') {
139
+ if ((componentBlocks === null || componentBlocks === void 0 ? void 0 : componentBlocks.length) === 1) {
140
+ setSelectedCB(componentBlocks[0].id);
141
+ return;
142
+ }
143
+ makeAllInOneGroup();
144
+ return;
145
+ }
146
+ if (shortcutKeyMode === 'MANUAL_BULK_BREAK') {
147
+ breakGroupCB();
148
+ setSelectedCB(null);
149
+ return;
150
+ }
151
+ }, [shortcutKeyMode, setSelectedCB, breakGroupCB]);
152
+ (0, react_1.useLayoutEffect)(function () {
153
+ if (props.id !== editingSectionId) {
154
+ return;
155
+ }
156
+ if (shortcutKeyMode === 'MANUAL_COLLISION_SELECT') {
157
+ if (!selectedCB || selectedCB === 'group') {
158
+ return;
159
+ }
160
+ makeCollisionGroup(selectedCB);
161
+ sectionActionHandler &&
162
+ sectionActionHandler({
163
+ type: '@CUSTOMSECTION/CB_CLICKED',
164
+ payload: {
165
+ id: 'group'
166
+ }
167
+ });
168
+ setSelectedCB('group');
169
+ }
170
+ }, [selectedCB, shortcutKeyMode, makeCollisionGroup, sectionActionHandler, setSelectedCB]);
171
+ var _g = (0, util_1.parseCustomSectionPlacement)({
172
+ isMobile: isMobile,
173
+ customSectionProps: CB_PLACEMENT_PROP_SECTION
174
+ }), width = _g.width, minHeight = _g.minHeight, isFullWidth = _g.isFullWidth;
175
+ var customSectionStyles = {
176
+ minHeight: "".concat(minHeight, "vh"),
177
+ width: '100%',
178
+ maxWidth: isFullWidth ? '' : "".concat(width, "px")
179
+ };
180
+ var onClickSection = function () {
181
+ if (!isEditMode) {
182
+ return;
183
+ }
184
+ if ((0, useGroupDrag_2.getGroupCB)(layouts[layoutByDevice])) {
185
+ breakGroupCB();
186
+ }
187
+ setSelectedCB(null);
188
+ sectionActionHandler &&
189
+ sectionActionHandler({
190
+ type: '@CUSTOMSECTION/SECTION_CLICKED',
191
+ payload: {
192
+ sectionId: props.id
193
+ }
194
+ });
195
+ };
196
+ var padding = (0, parseSectionPadding_1.default)(CB_LAYOUT_PROP_PADDING, device);
197
+ var sectionRow = CB_PLACEMENT_PROP_SECTION[device === 'DESKTOP'
198
+ ? 'CB_PLACEMENT_PROP_SECTION_SPEC_ROWS'
199
+ : 'CB_PLACEMENT_PROP_SECTION_SPEC_ROWS:MOBILE'];
200
+ var rowHeight = (function () {
201
+ if (!size.width) {
202
+ return 50;
203
+ }
204
+ if (device === 'MOBILE') {
205
+ var cellWidth_1 = size.width / MOBILE_GRID_COLS;
206
+ return cellWidth_1 * 0.56;
207
+ }
208
+ var cellWidth = size.width / DESKTOP_GRID_COLS;
209
+ return cellWidth * 0.56;
210
+ })();
211
+ var baseFontSize = (function () {
212
+ var _a, _b;
213
+ if (!size.width) {
214
+ return 16;
215
+ }
216
+ var responsiveFontMode = !!((_b = (_a = props.jsonProperties) === null || _a === void 0 ? void 0 : _a.data.CB_CONTENT_PROP_SECTION) === null || _b === void 0 ? void 0 : _b.CB_CONTENT_PROP_SECTION_SPEC_VARIABLEROOTFONTSIZE);
217
+ if (device === 'MOBILE') {
218
+ if (responsiveFontMode) {
219
+ return size.width * 0.0421;
220
+ }
221
+ if (size.width < 327) {
222
+ return Math.max(getDefensiveFontSize(device, size.width), 14);
223
+ }
224
+ return 16;
225
+ }
226
+ if (responsiveFontMode) {
227
+ return size.width * 0.0133;
228
+ }
229
+ if (size.width < 1200) {
230
+ return Math.max(getDefensiveFontSize(device, size.width), 14);
231
+ }
232
+ return 16;
233
+ })();
234
+ return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(CustomSection_1.S_gleStyles, { children: (0, jsx_runtime_1.jsx)(S_SectionWrapper, __assign({ ref: gleRef, "x-dlayout-section-type": "NO_NAME", onClick: onClickSection }, { children: (0, jsx_runtime_1.jsx)(components_1.CustomSection, __assign({}, props, { isMobile: isMobile, overrideStyles: {
235
+ minHeight: customSectionStyles.minHeight,
236
+ paddingTop: padding.top,
237
+ paddingBottom: padding.bottom,
238
+ paddingRight: padding.right,
239
+ paddingLeft: padding.left
240
+ } }, { children: (0, jsx_runtime_1.jsx)(GridContainer, __assign({ ref: containerRef, cols: isMobile ? 8 : 24, rowHeight: rowHeight, sectionRow: sectionRow !== null && sectionRow !== void 0 ? sectionRow : 0, style: {
241
+ width: customSectionStyles.width,
242
+ maxWidth: customSectionStyles.maxWidth,
243
+ minWidth: isMobile ? GLE_MIN_WIDTH_MOBILE_PX : GLE_MIN_WIDTH_DESKTOP_PX,
244
+ fontSize: "".concat(baseFontSize, "px")
245
+ } }, { children: (_a = props.componentBlocks) === null || _a === void 0 ? void 0 : _a.map(function (cb, index) { return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { children: (0, jsx_runtime_1.jsx)(FlexGridItem_1.default, { cb: cb, index: index, device: device, rowHeight: rowHeight }) }, cb.id)); }) })) })) })) }) }));
246
+ });
247
+ var GridContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: grid; /* Space between grid items */\n gap: 10px;\n grid-template-columns: repeat(", ", 1fr);\n grid-template-rows: repeat(\n ", ",\n minmax(", ", auto)\n );\n padding: 0 10px;\n\n * {\n box-sizing: border-box;\n }\n"], ["\n display: grid; /* Space between grid items */\n gap: 10px;\n grid-template-columns: repeat(", ", 1fr);\n grid-template-rows: repeat(\n ", ",\n minmax(", ", auto)\n );\n padding: 0 10px;\n\n * {\n box-sizing: border-box;\n }\n"])), function (props) { return props.cols; }, function (props) { return props.sectionRow; }, function (props) { return "".concat(props.rowHeight, "px"); });
248
+ var S_SectionWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
249
+ exports.default = react_1.default.memo(CustomSection);
250
+ function getDefensiveFontSize(device, width) {
251
+ if (device === 'MOBILE') {
252
+ return width * (0.0000868 * width + 0.0202);
253
+ }
254
+ return width * (0.0000246 * width - 0.01618);
255
+ }
256
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { ComponentBlock } from './types';
3
+ import type { Device } from './util/types';
4
+ type Props = {
5
+ cb: ComponentBlock;
6
+ index: number;
7
+ device: Device;
8
+ rowHeight: number;
9
+ };
10
+ declare function FlexGridItem({ cb, index, device, rowHeight }: Props): JSX.Element;
11
+ export default FlexGridItem;
@@ -0,0 +1,72 @@
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
+ };
6
+ var __assign = (this && this.__assign) || function () {
7
+ __assign = Object.assign || function(t) {
8
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
+ t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var jsx_runtime_1 = require("react/jsx-runtime");
22
+ var styled_components_1 = __importDefault(require("styled-components"));
23
+ var ComponentBlockMatcher_1 = __importDefault(require("./components/ComponentBlock/ComponentBlockMatcher"));
24
+ var gap = 10;
25
+ function FlexGridItem(_a) {
26
+ var cb = _a.cb, index = _a.index, device = _a.device, rowHeight = _a.rowHeight;
27
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
28
+ var defaultHeight = getMaxHeight(cb.jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, device, rowHeight);
29
+ var gridArea = getGridAreaFromCB(cb.jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, device);
30
+ var zIndex = device === 'DESKTOP'
31
+ ? cb.jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX
32
+ : cb.jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX:MOBILE'];
33
+ return ((0, jsx_runtime_1.jsx)(GridItem, __assign({ style: {
34
+ zIndex: zIndex,
35
+ gridArea: gridArea
36
+ // maxHeight: cb.componentBlockCode !== CB_ALL_CODES.CB_TEXT ? defaultHeight : undefined
37
+ } }, { children: (0, jsx_runtime_1.jsx)(ComponentBlockMatcher_1.default, { cbProps: cb, device: device, index: index }) })));
38
+ }
39
+ var GridItem = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: auto;\n word-break: break-word;\n"], ["\n height: auto;\n word-break: break-word;\n"])));
40
+ function getMaxHeight(props, device, rowHeight) {
41
+ if (device === 'DESKTOP') {
42
+ var CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS;
43
+ var height_1 = CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS * rowHeight +
44
+ (CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS - 1) * gap;
45
+ return height_1;
46
+ }
47
+ var rowsMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'];
48
+ var height = rowsMobile * rowHeight + (rowsMobile - 1) * gap;
49
+ return height;
50
+ }
51
+ function getGridAreaFromCB(props, device) {
52
+ var CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX, CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY, cols = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS, rows = props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS;
53
+ if (device === 'DESKTOP') {
54
+ var colStart_1 = CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX + 1;
55
+ var rowStart_1 = CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY + 1;
56
+ var rowEnd_1 = rows + rowStart_1;
57
+ var colEnd_1 = cols + colStart_1;
58
+ // <grid-row-start> / <grid-column-start> / <grid-row-end> / <grid-column-end>;
59
+ return "".concat(rowStart_1, " / ").concat(colStart_1, " / ").concat(rowEnd_1, " / ").concat(colEnd_1);
60
+ }
61
+ var startXMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX:MOBILE'];
62
+ var startYMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY:MOBILE'];
63
+ var colsMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS:MOBILE'];
64
+ var rowsMobile = props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'];
65
+ var colStart = startXMobile + 1;
66
+ var rowStart = startYMobile + 1;
67
+ var rowEnd = rowsMobile + rowStart;
68
+ var colEnd = colsMobile + colStart;
69
+ return "".concat(rowStart, " / ").concat(colStart, " / ").concat(rowEnd, " / ").concat(colEnd);
70
+ }
71
+ exports.default = FlexGridItem;
72
+ var templateObject_1;
@@ -115,7 +115,7 @@ function parseImageCBStyle(style, hoverStyle, mode) {
115
115
  };
116
116
  return { boxStyle: boxStyle, imgStyle: imgStyle };
117
117
  }
118
- var S_ImageWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n width: 100%;\n"], ["\n height: 100%;\n width: 100%;\n"])));
118
+ var S_ImageWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n max-height: 100%;\n width: 100%;\n"], ["\n height: 100%;\n max-height: 100%;\n width: 100%;\n"])));
119
119
  var S_Image = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-image: ", ";\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n\n ", ";\n\n &:hover {\n ", ";\n }\n\n & img {\n ", ";\n }\n\n &:hover img {\n ", ";\n }\n"], ["\n background-image: ", ";\n background-repeat: no-repeat;\n height: 100%;\n width: 100%;\n\n ", ";\n\n &:hover {\n ", ";\n }\n\n & img {\n ", ";\n }\n\n &:hover img {\n ", ";\n }\n"])), function (_a) {
120
120
  var src = _a.src;
121
121
  return "url(".concat(src, ")");
@@ -15,7 +15,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  var jsx_runtime_1 = require("react/jsx-runtime");
18
- /* eslint-disable no-console */
19
18
  /* eslint-disable react/destructuring-assignment */
20
19
  var react_1 = require("react");
21
20
  var DynamicLayout_1 = require("../../../../../../../DynamicLayout");
@@ -56,7 +55,11 @@ function Text(props) {
56
55
  : CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
57
56
  var hasEffect = !isNoneEffectType;
58
57
  var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
59
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsx)(S_CB_Box_1.S_CB_Box, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign(__assign({}, textStyle), propsStyle), layoutStyle), effectCssProperties), { whiteSpace: 'pre-wrap', wordBreak: 'break-word', cursor: CLINKCursor }), hoverStyle: __assign(__assign(__assign({}, textHoverStyle), propsHoverStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }), onClick: onClickCLINK }, { children: props.CB_CONTENT_PROP_TEXT.CB_CONTENT_PROP_TEXT_SPEC_TEXT })) }))] }));
58
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ style: {
59
+ height: '100%',
60
+ display: 'flex',
61
+ alignItems: textStyle.alignItems
62
+ }, ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsx)(S_CB_Box_1.S_CB_Box, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign(__assign(__assign({}, textStyle), propsStyle), layoutStyle), effectCssProperties), { whiteSpace: 'pre-wrap', wordBreak: 'break-word', cursor: CLINKCursor, height: 'fit-content', minWidth: "calc(2ch + ".concat(layoutStyle.paddingLeft, " + ").concat(layoutStyle.paddingRight, ")") }), textStyle), hoverStyle: __assign(__assign(__assign({}, textHoverStyle), propsHoverStyle), { whiteSpace: 'pre-wrap', wordBreak: 'break-word' }), onClick: onClickCLINK }, { children: props.CB_CONTENT_PROP_TEXT.CB_CONTENT_PROP_TEXT_SPEC_TEXT })) }))] }));
60
63
  }
61
64
  function getTextStyles(props, device) {
62
65
  var availableSpecCodes = [
@@ -0,0 +1 @@
1
+ export declare function useIsMounted(): () => boolean;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useIsMounted = void 0;
4
+ var react_1 = require("react");
5
+ function useIsMounted() {
6
+ var isMounted = (0, react_1.useRef)(false);
7
+ (0, react_1.useEffect)(function () {
8
+ isMounted.current = true;
9
+ return function () {
10
+ isMounted.current = false;
11
+ };
12
+ }, []);
13
+ return (0, react_1.useCallback)(function () { return isMounted.current; }, []);
14
+ }
15
+ exports.useIsMounted = useIsMounted;
@@ -0,0 +1,12 @@
1
+ import type { RefObject } from 'react';
2
+ type Size = {
3
+ width: number | undefined;
4
+ height: number | undefined;
5
+ };
6
+ type UseResizeObserverOptions<T extends HTMLElement = HTMLElement> = {
7
+ ref: RefObject<T>;
8
+ onResize?: (size: Size) => void;
9
+ box?: 'border-box' | 'content-box' | 'device-pixel-content-box';
10
+ };
11
+ export declare function useResizeObserver<T extends HTMLElement = HTMLElement>(options: UseResizeObserverOptions<T>): Size;
12
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useResizeObserver = void 0;
15
+ var react_1 = require("react");
16
+ var useIsMounted_1 = require("./useIsMounted");
17
+ var initialSize = {
18
+ width: undefined,
19
+ height: undefined
20
+ };
21
+ function useResizeObserver(options) {
22
+ var ref = options.ref, _a = options.box, box = _a === void 0 ? 'content-box' : _a;
23
+ var _b = (0, react_1.useState)(initialSize), _c = _b[0], width = _c.width, height = _c.height, setSize = _b[1];
24
+ var isMounted = (0, useIsMounted_1.useIsMounted)();
25
+ var previousSize = (0, react_1.useRef)(__assign({}, initialSize));
26
+ var onResize = (0, react_1.useRef)(undefined);
27
+ onResize.current = options.onResize;
28
+ (0, react_1.useEffect)(function () {
29
+ if (!ref.current)
30
+ return;
31
+ if (typeof window === 'undefined' || !('ResizeObserver' in window))
32
+ return;
33
+ var observer = new ResizeObserver(function (_a) {
34
+ var entry = _a[0];
35
+ var boxProp = box === 'border-box'
36
+ ? 'borderBoxSize'
37
+ : box === 'device-pixel-content-box'
38
+ ? 'devicePixelContentBoxSize'
39
+ : 'contentBoxSize';
40
+ var newWidth = extractSize(entry, boxProp, 'inlineSize');
41
+ var newHeight = extractSize(entry, boxProp, 'blockSize');
42
+ var hasChanged = previousSize.current.width !== newWidth || previousSize.current.height !== newHeight;
43
+ if (hasChanged) {
44
+ var newSize = { width: newWidth, height: newHeight };
45
+ previousSize.current.width = newWidth;
46
+ previousSize.current.height = newHeight;
47
+ if (onResize.current) {
48
+ onResize.current(newSize);
49
+ }
50
+ else if (isMounted()) {
51
+ setSize(newSize);
52
+ }
53
+ }
54
+ });
55
+ observer.observe(ref.current, { box: box });
56
+ return function () {
57
+ observer.disconnect();
58
+ };
59
+ }, [box, ref, isMounted]);
60
+ return { width: width, height: height };
61
+ }
62
+ exports.useResizeObserver = useResizeObserver;
63
+ function extractSize(entry, box, sizeType) {
64
+ if (!entry[box]) {
65
+ if (box === 'contentBoxSize') {
66
+ return entry.contentRect[sizeType === 'inlineSize' ? 'width' : 'height'];
67
+ }
68
+ return undefined;
69
+ }
70
+ return Array.isArray(entry[box])
71
+ ? entry[box][0][sizeType]
72
+ : // @ts-ignore Support Firefox's non-standard behavior
73
+ entry[box][sizeType];
74
+ }
@@ -205,8 +205,9 @@ function getVerticalPositionValue(value) {
205
205
  }
206
206
  }
207
207
  function getEmFontSize(device, size) {
208
+ var preferred = size / 16;
208
209
  if (device === 'DESKTOP') {
209
- return "".concat((size / 16).toFixed(3), "em");
210
+ return "clamp(10px, ".concat(preferred, "em, ").concat(preferred, "em)");
210
211
  }
211
- return "".concat((size / 16).toFixed(3), "em");
212
+ return "clamp(6px, ".concat(preferred, "em, ").concat(preferred, "em)");
212
213
  }
@@ -7,6 +7,7 @@ export declare function parsePlacement(components: ComponentBlock[]): {
7
7
  w: number;
8
8
  h: number;
9
9
  z: number;
10
+ autoResize: boolean;
10
11
  }[];
11
12
  lg: {
12
13
  i: string;
@@ -15,6 +16,7 @@ export declare function parsePlacement(components: ComponentBlock[]): {
15
16
  w: number;
16
17
  h: number;
17
18
  z: number;
19
+ autoResize: boolean;
18
20
  }[];
19
21
  };
20
22
  export default parsePlacement;
@@ -10,10 +10,11 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.parsePlacement = void 0;
13
+ var types_1 = require("../types");
13
14
  function parsePlacement(components) {
14
15
  return components.reduce(function (acc, cur) {
15
- var id = cur.id, jsonProperties = cur.jsonProperties;
16
- var _a = parsePropPlacement(jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, id), mobileLayout = _a.mobileLayout, desktopLayout = _a.desktopLayout;
16
+ var id = cur.id, jsonProperties = cur.jsonProperties, componentBlockCode = cur.componentBlockCode;
17
+ var _a = parsePropPlacement(jsonProperties.data.CB_PLACEMENT_PROP_PLACEMENT, id, componentBlockCode), mobileLayout = _a.mobileLayout, desktopLayout = _a.desktopLayout;
17
18
  return {
18
19
  sm: __spreadArray(__spreadArray([], acc.sm, true), [mobileLayout], false),
19
20
  lg: __spreadArray(__spreadArray([], acc.lg, true), [desktopLayout], false)
@@ -21,14 +22,15 @@ function parsePlacement(components) {
21
22
  }, { sm: [], lg: [] });
22
23
  }
23
24
  exports.parsePlacement = parsePlacement;
24
- function parsePropPlacement(props, id) {
25
+ function parsePropPlacement(props, id, cbCode) {
25
26
  var desktopLayout = {
26
27
  i: id.toString(),
27
28
  x: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTX,
28
29
  y: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY,
29
30
  w: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS,
30
31
  h: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS,
31
- z: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX + 500
32
+ z: props.CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX + 500,
33
+ autoResize: cbCode === types_1.CB_ALL_CODES.CB_TEXT
32
34
  };
33
35
  var mobileLayout = {
34
36
  i: id.toString(),
@@ -36,7 +38,8 @@ function parsePropPlacement(props, id) {
36
38
  y: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_STARTY:MOBILE'],
37
39
  w: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_COLS:MOBILE'],
38
40
  h: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ROWS:MOBILE'],
39
- z: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX:MOBILE'] + 500
41
+ z: props['CB_PLACEMENT_PROP_PLACEMENT_SPEC_ZINDEX:MOBILE'] + 500,
42
+ autoResize: cbCode === types_1.CB_ALL_CODES.CB_TEXT
40
43
  };
41
44
  return {
42
45
  mobileLayout: mobileLayout,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web",
3
- "version": "2.2.89",
3
+ "version": "2.2.93",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "i18next-intervalplural-postprocessor": "^3.0.0",
23
23
  "lottie-react": "^2.3.1",
24
24
  "nuka-carousel": "^4.8.4",
25
- "publ-echo": "^0.0.45",
25
+ "publ-echo": "^0.0.94",
26
26
  "react-hook-form": "^7.28.1",
27
27
  "react-i18next": "^11.12.0",
28
28
  "react-router-dom": "^5.2.0",
package/release-note.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PDS-DEV-KIT-WEB Release Notes
2
- ## [v2.2.89]
2
+ ## [v2.2.93]
3
3
  ## daily|https://design.storybook.publ.biz/
4
4
 
5
5
  ### 업데이트 사항
6
- * [DAILY][PDS-1242] Icon의 type 확장 건
6
+ * Sync color keys