pds-dev-kit-web-test 0.2.0 → 0.2.1
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/components/Box.d.ts +13 -0
- package/dist/src/sub/DynamicLayout/components/Box.js +73 -0
- package/dist/src/sub/DynamicLayout/components/index.d.ts +1 -0
- package/dist/src/sub/DynamicLayout/components/index.js +6 -1
- package/dist/src/sub/DynamicLayout/custonSectionSampleData.d.ts +45 -0
- package/dist/src/sub/DynamicLayout/custonSectionSampleData.js +31 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/BlockMatcher.js +6 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/Accordion.d.ts +12 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/Accordion.js +46 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionBody.d.ts +8 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionBody.js +74 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionCore.d.ts +13 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionCore.js +25 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionHeader.d.ts +7 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionHeader.js +49 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionItem.d.ts +7 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/AccordionItem.js +19 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/index.d.ts +4 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/index.js +14 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/index.d.ts +1 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/index.js +3 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/types.d.ts +10 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/types.js +2 -1
- package/package.json +1 -1
- package/release-note.md +3 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
declare type Props = {
|
|
3
|
+
direction?: 'vertical' | 'horizontal';
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
relative?: boolean;
|
|
6
|
+
justifyContent?: boolean;
|
|
7
|
+
alignItems?: boolean;
|
|
8
|
+
flex?: boolean;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
|
+
declare function Box({ direction, children, relative, justifyContent, alignItems, flex, style, className }: Props): JSX.Element;
|
|
13
|
+
export default Box;
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
39
|
+
function Box(_a) {
|
|
40
|
+
var _b = _a.direction, direction = _b === void 0 ? 'horizontal' : _b, children = _a.children, relative = _a.relative, justifyContent = _a.justifyContent, alignItems = _a.alignItems, flex = _a.flex, style = _a.style, className = _a.className;
|
|
41
|
+
if (direction === 'horizontal') {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(Row, __assign({ style: style, relative: relative, justifyContent: justifyContent, alignItems: alignItems, flex: flex, className: className }, { children: children }), void 0));
|
|
43
|
+
}
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(Col, __assign({ style: style, relative: relative, justifyContent: justifyContent, alignItems: alignItems, flex: flex, className: className }, { children: children }), void 0));
|
|
45
|
+
}
|
|
46
|
+
exports.default = Box;
|
|
47
|
+
var Col = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n\n ", ";\n\n ", ";\n\n ", ";\n\n ", ";\n"], ["\n display: flex;\n flex-direction: column;\n\n ", ";\n\n ", ";\n\n ", ";\n\n ", ";\n"])), function (_a) {
|
|
48
|
+
var relative = _a.relative;
|
|
49
|
+
return relative && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n "], ["\n position: relative;\n "])));
|
|
50
|
+
}, function (_a) {
|
|
51
|
+
var justifyContent = _a.justifyContent;
|
|
52
|
+
return justifyContent && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n justify-content: center;\n "], ["\n justify-content: center;\n "])));
|
|
53
|
+
}, function (_a) {
|
|
54
|
+
var alignItems = _a.alignItems;
|
|
55
|
+
return alignItems && (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-items: center;\n "], ["\n align-items: center;\n "])));
|
|
56
|
+
}, function (_a) {
|
|
57
|
+
var flex = _a.flex;
|
|
58
|
+
return flex && (0, styled_components_1.css)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex: 1;\n "], ["\n flex: 1;\n "])));
|
|
59
|
+
});
|
|
60
|
+
var Row = styled_components_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n\n ", ";\n\n ", ";\n\n ", ";\n\n ", ";\n"], ["\n display: flex;\n flex-direction: row;\n\n ", ";\n\n ", ";\n\n ", ";\n\n ", ";\n"])), function (_a) {
|
|
61
|
+
var relative = _a.relative;
|
|
62
|
+
return relative && (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n position: relative;\n "], ["\n position: relative;\n "])));
|
|
63
|
+
}, function (_a) {
|
|
64
|
+
var justifyContent = _a.justifyContent;
|
|
65
|
+
return justifyContent && (0, styled_components_1.css)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n justify-content: center;\n "], ["\n justify-content: center;\n "])));
|
|
66
|
+
}, function (_a) {
|
|
67
|
+
var alignItems = _a.alignItems;
|
|
68
|
+
return alignItems && (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n align-items: center;\n "], ["\n align-items: center;\n "])));
|
|
69
|
+
}, function (_a) {
|
|
70
|
+
var flex = _a.flex;
|
|
71
|
+
return flex && (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n flex: 1;\n "], ["\n flex: 1;\n "])));
|
|
72
|
+
});
|
|
73
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10;
|
|
@@ -9,8 +9,13 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
12
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.Section = void 0;
|
|
16
|
+
exports.Box = exports.Section = void 0;
|
|
14
17
|
__exportStar(require("./pdsOriginal"), exports);
|
|
15
18
|
var Section_1 = require("./Section");
|
|
16
19
|
Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return Section_1.Section; } });
|
|
20
|
+
var Box_1 = require("./Box");
|
|
21
|
+
Object.defineProperty(exports, "Box", { enumerable: true, get: function () { return __importDefault(Box_1).default; } });
|
|
@@ -18,6 +18,8 @@ export declare const customsectionMock: ({
|
|
|
18
18
|
accountId?: undefined;
|
|
19
19
|
startAt?: undefined;
|
|
20
20
|
endAt?: undefined;
|
|
21
|
+
accordionItems?: undefined;
|
|
22
|
+
openedItemId?: undefined;
|
|
21
23
|
};
|
|
22
24
|
};
|
|
23
25
|
};
|
|
@@ -50,6 +52,8 @@ export declare const customsectionMock: ({
|
|
|
50
52
|
accountId?: undefined;
|
|
51
53
|
startAt?: undefined;
|
|
52
54
|
endAt?: undefined;
|
|
55
|
+
accordionItems?: undefined;
|
|
56
|
+
openedItemId?: undefined;
|
|
53
57
|
};
|
|
54
58
|
};
|
|
55
59
|
};
|
|
@@ -78,6 +82,8 @@ export declare const customsectionMock: ({
|
|
|
78
82
|
accountId?: undefined;
|
|
79
83
|
startAt?: undefined;
|
|
80
84
|
endAt?: undefined;
|
|
85
|
+
accordionItems?: undefined;
|
|
86
|
+
openedItemId?: undefined;
|
|
81
87
|
};
|
|
82
88
|
};
|
|
83
89
|
};
|
|
@@ -106,6 +112,8 @@ export declare const customsectionMock: ({
|
|
|
106
112
|
accountId?: undefined;
|
|
107
113
|
startAt?: undefined;
|
|
108
114
|
endAt?: undefined;
|
|
115
|
+
accordionItems?: undefined;
|
|
116
|
+
openedItemId?: undefined;
|
|
109
117
|
};
|
|
110
118
|
};
|
|
111
119
|
};
|
|
@@ -134,6 +142,8 @@ export declare const customsectionMock: ({
|
|
|
134
142
|
alt?: undefined;
|
|
135
143
|
startAt?: undefined;
|
|
136
144
|
endAt?: undefined;
|
|
145
|
+
accordionItems?: undefined;
|
|
146
|
+
openedItemId?: undefined;
|
|
137
147
|
};
|
|
138
148
|
};
|
|
139
149
|
};
|
|
@@ -162,6 +172,41 @@ export declare const customsectionMock: ({
|
|
|
162
172
|
size?: undefined;
|
|
163
173
|
alt?: undefined;
|
|
164
174
|
accountId?: undefined;
|
|
175
|
+
accordionItems?: undefined;
|
|
176
|
+
openedItemId?: undefined;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
style: {
|
|
181
|
+
backgroundColor: string;
|
|
182
|
+
};
|
|
183
|
+
layout: {};
|
|
184
|
+
hoverStyle?: undefined;
|
|
185
|
+
} | {
|
|
186
|
+
type: string;
|
|
187
|
+
gridItemData: {
|
|
188
|
+
x: number;
|
|
189
|
+
y: number;
|
|
190
|
+
w: number;
|
|
191
|
+
h: number;
|
|
192
|
+
i: string;
|
|
193
|
+
};
|
|
194
|
+
content: {
|
|
195
|
+
data: {
|
|
196
|
+
type: string;
|
|
197
|
+
value: {
|
|
198
|
+
accordionItems: {
|
|
199
|
+
title: string;
|
|
200
|
+
description: string;
|
|
201
|
+
}[];
|
|
202
|
+
openedItemId: string;
|
|
203
|
+
text?: undefined;
|
|
204
|
+
size?: undefined;
|
|
205
|
+
src?: undefined;
|
|
206
|
+
alt?: undefined;
|
|
207
|
+
accountId?: undefined;
|
|
208
|
+
startAt?: undefined;
|
|
209
|
+
endAt?: undefined;
|
|
165
210
|
};
|
|
166
211
|
};
|
|
167
212
|
};
|
|
@@ -163,5 +163,36 @@ exports.customsectionMock = [
|
|
|
163
163
|
backgroundColor: 'yellow'
|
|
164
164
|
},
|
|
165
165
|
layout: {}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: 'ACCORDION',
|
|
169
|
+
gridItemData: {
|
|
170
|
+
x: 5,
|
|
171
|
+
y: 5,
|
|
172
|
+
w: 6,
|
|
173
|
+
h: 10,
|
|
174
|
+
i: '8'
|
|
175
|
+
},
|
|
176
|
+
content: {
|
|
177
|
+
data: {
|
|
178
|
+
type: 'ACCORDION',
|
|
179
|
+
value: {
|
|
180
|
+
accordionItems: [
|
|
181
|
+
{ title: 'title1', description: 'description1' },
|
|
182
|
+
{ title: 'title2', description: 'description2' },
|
|
183
|
+
{ title: 'title3', description: 'description3' }
|
|
184
|
+
],
|
|
185
|
+
openedItemId: '0'
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
style: {
|
|
190
|
+
backgroundColor: 'white'
|
|
191
|
+
// display: 'flex',
|
|
192
|
+
// flexDirection: 'column',
|
|
193
|
+
// justifyContent: 'center',
|
|
194
|
+
// alignItems: 'center'
|
|
195
|
+
},
|
|
196
|
+
layout: {}
|
|
166
197
|
}
|
|
167
198
|
];
|
|
@@ -57,6 +57,12 @@ function BlockMatcher(_a) {
|
|
|
57
57
|
}
|
|
58
58
|
return (0, jsx_runtime_1.jsx)("div", { children: "Error" }, void 0);
|
|
59
59
|
}
|
|
60
|
+
case 'ACCORDION': {
|
|
61
|
+
if ('accordionItems' in value && 'openedItemId' in value) {
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(blocks_1.Accordion, { accordionItems: value.accordionItems, openedItemId: value.openedItemId, style: style }, void 0));
|
|
63
|
+
}
|
|
64
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Error" }, void 0);
|
|
65
|
+
}
|
|
60
66
|
// eslint-disable-next-line no-fallthrough
|
|
61
67
|
default:
|
|
62
68
|
return (0, jsx_runtime_1.jsx)("div", { children: "Error" }, void 0);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare type AccordionItem = {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type AccordionProps = {
|
|
7
|
+
accordionItems: AccordionItem[];
|
|
8
|
+
openedItemId?: string;
|
|
9
|
+
style: React.CSSProperties;
|
|
10
|
+
};
|
|
11
|
+
declare function Accordion({ accordionItems, openedItemId, style }: AccordionProps): JSX.Element;
|
|
12
|
+
export default Accordion;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 react_1 = require("react");
|
|
23
|
+
var index_1 = require("../../../../../../desktop/index");
|
|
24
|
+
var components_1 = require("../../../../../../hybrid/components");
|
|
25
|
+
var components_2 = require("../../../../../DynamicLayout/components");
|
|
26
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
27
|
+
var AccordionCore_1 = require("./AccordionCore");
|
|
28
|
+
function Accordion(_a) {
|
|
29
|
+
var accordionItems = _a.accordionItems, openedItemId = _a.openedItemId, style = _a.style;
|
|
30
|
+
var _b = (0, react_1.useState)(''), openedId = _b[0], setOpen = _b[1];
|
|
31
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
32
|
+
setOpen(openedItemId !== null && openedItemId !== void 0 ? openedItemId : '');
|
|
33
|
+
}, [openedItemId]);
|
|
34
|
+
var toggleAccordion = function (id) {
|
|
35
|
+
if (openedId === id) {
|
|
36
|
+
setOpen('');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
setOpen(id);
|
|
40
|
+
};
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(S_AccordionBox, __assign({ style: style }, { children: (0, jsx_runtime_1.jsx)(AccordionCore_1.AccordionCore, __assign({ openedId: openedId, toggle: toggleAccordion }, { children: accordionItems.map(function (each, index) { return ((0, jsx_runtime_1.jsxs)(AccordionCore_1.AccordionItem, __assign({ style: { backgroundColor: style.backgroundColor } }, { children: [(0, jsx_runtime_1.jsx)(AccordionCore_1.AccordionHeader, { targetId: index.toString(), text: each.title }, void 0), (0, jsx_runtime_1.jsxs)(AccordionCore_1.AccordionBody, __assign({ targetId: index.toString() }, { children: [(0, jsx_runtime_1.jsxs)(components_2.Box, __assign({ direction: "horizontal" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Spacing, { size: "spacing_e", spacingType: "width" }, void 0), (0, jsx_runtime_1.jsx)(index_1.D_TextLabel, { text: each.description, styleTheme: "caption1Regular", colorTheme: "sysTextSecondary" }, void 0)] }), void 0), (0, jsx_runtime_1.jsx)(components_1.Spacing, { size: "spacing_e" }, void 0)] }), void 0), (0, jsx_runtime_1.jsx)(S_Divider, {}, void 0)] }), index.toString())); }) }), void 0) }), void 0));
|
|
42
|
+
}
|
|
43
|
+
var S_Divider = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: #dfdfdf;\n height: 1px;\n width: 100%;\n"], ["\n background-color: #dfdfdf;\n height: 1px;\n width: 100%;\n"])));
|
|
44
|
+
var S_AccordionBox = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 100%;\n\n * {\n color: black;\n }\n"], ["\n height: 100%;\n\n * {\n color: black;\n }\n"])));
|
|
45
|
+
exports.default = Accordion;
|
|
46
|
+
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccordionItemIdType } from './AccordionCore';
|
|
3
|
+
declare type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
targetId: AccordionItemIdType;
|
|
6
|
+
};
|
|
7
|
+
declare function AccordionBody({ children, targetId }: Props): JSX.Element;
|
|
8
|
+
export default AccordionBody;
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
var react_1 = require("react");
|
|
39
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
40
|
+
var AccordionCore_1 = require("./AccordionCore");
|
|
41
|
+
function AccordionBody(_a) {
|
|
42
|
+
var children = _a.children, targetId = _a.targetId;
|
|
43
|
+
var _b = (0, react_1.useState)('SHOW'), state = _b[0], setState = _b[1];
|
|
44
|
+
var _c = (0, react_1.useState)(0), height = _c[0], setHeight = _c[1];
|
|
45
|
+
var openedId = (0, react_1.useContext)(AccordionCore_1.AccordionContext).openedId;
|
|
46
|
+
var childrenRef = (0, react_1.useRef)(null);
|
|
47
|
+
(0, react_1.useEffect)(function () {
|
|
48
|
+
if (!childrenRef.current) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
var off = childrenRef.current.offsetHeight;
|
|
52
|
+
setHeight(off);
|
|
53
|
+
}, [children]);
|
|
54
|
+
(0, react_1.useLayoutEffect)(function () {
|
|
55
|
+
if (openedId !== targetId) {
|
|
56
|
+
setState('COLLAPSE');
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
setState('SHOW');
|
|
60
|
+
}, [openedId]);
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(S_AccordionBody, __assign({ state: state, height: height }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ ref: childrenRef }, { children: children }), void 0) }), void 0));
|
|
62
|
+
}
|
|
63
|
+
var S_AccordionBody = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n height: ", ";\n overflow: hidden;\n\n ", ";\n\n ", ";\n\n transition: height 0.35s ease;\n"], ["\n height: ", ";\n overflow: hidden;\n\n ", ";\n\n ", ";\n\n transition: height 0.35s ease;\n"])), function (_a) {
|
|
64
|
+
var height = _a.height;
|
|
65
|
+
return height + "px";
|
|
66
|
+
}, function (_a) {
|
|
67
|
+
var state = _a.state, height = _a.height;
|
|
68
|
+
return state === 'SHOW' && (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: ", " + 'px';\n "], ["\n height: ", " + 'px';\n "])), height);
|
|
69
|
+
}, function (_a) {
|
|
70
|
+
var state = _a.state;
|
|
71
|
+
return state === 'COLLAPSE' && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 0;\n "], ["\n height: 0;\n "])));
|
|
72
|
+
});
|
|
73
|
+
exports.default = AccordionBody;
|
|
74
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type AccordionItemIdType = string | number;
|
|
3
|
+
declare type Props = {
|
|
4
|
+
openedId: AccordionItemIdType;
|
|
5
|
+
toggle: (id: AccordionItemIdType) => void;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const AccordionContext: React.Context<{
|
|
9
|
+
openedId: AccordionItemIdType;
|
|
10
|
+
toggle: (id: AccordionItemIdType) => void;
|
|
11
|
+
}>;
|
|
12
|
+
declare function AccordionCore({ openedId, children, toggle }: Props): JSX.Element;
|
|
13
|
+
export default AccordionCore;
|
|
@@ -0,0 +1,25 @@
|
|
|
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.AccordionContext = void 0;
|
|
15
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
var react_1 = require("react");
|
|
17
|
+
exports.AccordionContext = (0, react_1.createContext)({
|
|
18
|
+
openedId: '',
|
|
19
|
+
toggle: function () { return null; }
|
|
20
|
+
});
|
|
21
|
+
function AccordionCore(_a) {
|
|
22
|
+
var openedId = _a.openedId, children = _a.children, toggle = _a.toggle;
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(exports.AccordionContext.Provider, __assign({ value: { openedId: openedId, toggle: toggle } }, { children: children }), void 0));
|
|
24
|
+
}
|
|
25
|
+
exports.default = AccordionCore;
|
|
@@ -0,0 +1,49 @@
|
|
|
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 react_1 = require("react");
|
|
23
|
+
var components_1 = require("../../../../../../DynamicLayout/components");
|
|
24
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
25
|
+
var AccordionCore_1 = require("./AccordionCore");
|
|
26
|
+
function AccordionHeader(_a) {
|
|
27
|
+
var text = _a.text, targetId = _a.targetId;
|
|
28
|
+
var _b = (0, react_1.useContext)(AccordionCore_1.AccordionContext), openedId = _b.openedId, toggle = _b.toggle;
|
|
29
|
+
var onClickToggle = function () {
|
|
30
|
+
toggle(targetId);
|
|
31
|
+
};
|
|
32
|
+
return ((0, jsx_runtime_1.jsxs)(S_Box, __assign({ alignItems: true }, { children: [(0, jsx_runtime_1.jsx)(components_1.D_TextLabel, { text: text }, void 0), (0, jsx_runtime_1.jsx)(D_IconWrapper, __assign({ isOpened: openedId === targetId }, { children: (0, jsx_runtime_1.jsx)(components_1.D_IconButton, { iconSize: 20, baseSize: "large", iconName: "ic_arrow_down", iconColorKey: "ui_cpnt_icon_sys_grey_02", baseColorKey: "ui_cpnt_button_fill_base_transparent", onClick: onClickToggle }, void 0) }), void 0)] }), void 0));
|
|
33
|
+
}
|
|
34
|
+
var S_Box = (0, styled_components_1.default)(components_1.Box)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n justify-content: space-between;\n padding-left: ", ";\n"], ["\n justify-content: space-between;\n padding-left: ", ";\n"])), function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return theme.spacing.spacingE;
|
|
37
|
+
});
|
|
38
|
+
var D_IconWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: fit-content;\n padding-left: ", ";\n padding-right: ", ";\n\n & > button {\n transform: ", ";\n transition: transform 0.2s ease-in-out;\n }\n"], ["\n height: fit-content;\n padding-left: ", ";\n padding-right: ", ";\n\n & > button {\n transform: ", ";\n transition: transform 0.2s ease-in-out;\n }\n"])), function (_a) {
|
|
39
|
+
var theme = _a.theme;
|
|
40
|
+
return theme.spacing.spacingD;
|
|
41
|
+
}, function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return theme.spacing.spacingC;
|
|
44
|
+
}, function (_a) {
|
|
45
|
+
var isOpened = _a.isOpened;
|
|
46
|
+
return (isOpened ? 'rotate(-180deg)' : ' rotate(0deg)');
|
|
47
|
+
});
|
|
48
|
+
exports.default = AccordionHeader;
|
|
49
|
+
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
function AccordionItem(_a) {
|
|
16
|
+
var children = _a.children, style = _a.style;
|
|
17
|
+
return (0, jsx_runtime_1.jsx)("div", __assign({ style: style }, { children: children }), void 0);
|
|
18
|
+
}
|
|
19
|
+
exports.default = AccordionItem;
|
package/dist/src/sub/DynamicLayout/sections/CustomSection/BlockMatcher/blocks/AccordionCore/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AccordionItem = exports.AccordionHeader = exports.AccordionBody = exports.AccordionCore = void 0;
|
|
7
|
+
var AccordionCore_1 = require("./AccordionCore");
|
|
8
|
+
Object.defineProperty(exports, "AccordionCore", { enumerable: true, get: function () { return __importDefault(AccordionCore_1).default; } });
|
|
9
|
+
var AccordionBody_1 = require("./AccordionBody");
|
|
10
|
+
Object.defineProperty(exports, "AccordionBody", { enumerable: true, get: function () { return __importDefault(AccordionBody_1).default; } });
|
|
11
|
+
var AccordionHeader_1 = require("./AccordionHeader");
|
|
12
|
+
Object.defineProperty(exports, "AccordionHeader", { enumerable: true, get: function () { return __importDefault(AccordionHeader_1).default; } });
|
|
13
|
+
var AccordionItem_1 = require("./AccordionItem");
|
|
14
|
+
Object.defineProperty(exports, "AccordionItem", { enumerable: true, get: function () { return __importDefault(AccordionItem_1).default; } });
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Youtube = exports.Divider = exports.Twitter = exports.Instagram = exports.Button = exports.RichText = exports.Image = exports.Text = void 0;
|
|
6
|
+
exports.Accordion = exports.Youtube = exports.Divider = exports.Twitter = exports.Instagram = exports.Button = exports.RichText = exports.Image = exports.Text = void 0;
|
|
7
7
|
var Text_1 = require("./Text");
|
|
8
8
|
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return __importDefault(Text_1).default; } });
|
|
9
9
|
var Image_1 = require("./Image");
|
|
@@ -20,3 +20,5 @@ var Divider_1 = require("./Divider");
|
|
|
20
20
|
Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return __importDefault(Divider_1).default; } });
|
|
21
21
|
var Youtube_1 = require("./Youtube");
|
|
22
22
|
Object.defineProperty(exports, "Youtube", { enumerable: true, get: function () { return __importDefault(Youtube_1).default; } });
|
|
23
|
+
var Accordion_1 = require("./Accordion");
|
|
24
|
+
Object.defineProperty(exports, "Accordion", { enumerable: true, get: function () { return __importDefault(Accordion_1).default; } });
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AccordionItem } from './BlockMatcher/blocks/Accordion';
|
|
1
2
|
import type React from 'react';
|
|
2
3
|
export declare const ComponentNames: {
|
|
3
4
|
TEXT: string;
|
|
@@ -8,6 +9,7 @@ export declare const ComponentNames: {
|
|
|
8
9
|
YOUTUBE: string;
|
|
9
10
|
TWITTER: string;
|
|
10
11
|
INSTAGRAM: string;
|
|
12
|
+
ACCORDION: string;
|
|
11
13
|
};
|
|
12
14
|
export declare type BlockComponents = typeof ComponentNames;
|
|
13
15
|
export declare type BlockNames = keyof BlockComponents;
|
|
@@ -62,7 +64,14 @@ export declare type YoutubeComponentDataType = {
|
|
|
62
64
|
endAt: number;
|
|
63
65
|
};
|
|
64
66
|
};
|
|
65
|
-
export declare type
|
|
67
|
+
export declare type AccordionComponentDataType = {
|
|
68
|
+
type: BlockComponents['ACCORDION'];
|
|
69
|
+
value: {
|
|
70
|
+
accordionItems: AccordionItem[];
|
|
71
|
+
openedItemId?: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export declare type ComponentDataPairType = TextComponentDataType | ImageComponentDataType | TwitterComponentDataType | RichTextComponentDataType | ButtonComponentDataType | DividerComponentDataType | YoutubeComponentDataType | AccordionComponentDataType;
|
|
66
75
|
export declare type ContentType = {
|
|
67
76
|
data: ComponentDataPairType;
|
|
68
77
|
link?: LinkContentType;
|
package/package.json
CHANGED
package/release-note.md
CHANGED