@laerdal/life-react-components 1.3.2-dev.1.full → 1.3.2-dev.11
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/esm/Accordion/ContentAccordion.js +238 -0
- package/dist/esm/Accordion/ContentAccordion.js.map +1 -0
- package/dist/esm/Accordion/__tests__/ContetnAccordion.test.js +137 -0
- package/dist/esm/Accordion/__tests__/ContetnAccordion.test.js.map +1 -0
- package/dist/esm/Accordion/index.js +1 -0
- package/dist/esm/Accordion/index.js.map +1 -1
- package/dist/esm/AuthPage/AuthPage.js +1 -1
- package/dist/esm/AuthPage/AuthPage.js.map +1 -1
- package/dist/esm/AuthPage/Information.js +1 -1
- package/dist/esm/AuthPage/Information.js.map +1 -1
- package/dist/esm/Banners/Banner.js +16 -16
- package/dist/esm/Banners/Banner.js.map +1 -1
- package/dist/esm/Button/Iconbutton.js +0 -1
- package/dist/esm/Button/Iconbutton.js.map +1 -1
- package/dist/esm/Dropdown/ChipDropdownInput.js +2 -2
- package/dist/esm/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/esm/Dropdown/CommonStyling.js +4 -0
- package/dist/esm/Dropdown/CommonStyling.js.map +1 -1
- package/dist/esm/Dropdown/DropdownButton.js +5 -2
- package/dist/esm/Dropdown/DropdownButton.js.map +1 -1
- package/dist/esm/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/esm/HyperLink/HyperLink.js +2 -1
- package/dist/esm/HyperLink/HyperLink.js.map +1 -1
- package/dist/esm/InputFields/Checkbox.js +23 -13
- package/dist/esm/InputFields/Checkbox.js.map +1 -1
- package/dist/esm/Table/Table.js +113 -181
- package/dist/esm/Table/Table.js.map +1 -1
- package/dist/esm/Table/TableBody.js +135 -0
- package/dist/esm/Table/TableBody.js.map +1 -0
- package/dist/esm/Table/TableFooter.js +60 -0
- package/dist/esm/Table/TableFooter.js.map +1 -0
- package/dist/esm/Table/TableHeaders.js +55 -0
- package/dist/esm/Table/TableHeaders.js.map +1 -0
- package/dist/esm/Table/TableStyles.js +130 -117
- package/dist/esm/Table/TableStyles.js.map +1 -1
- package/dist/esm/Table/__tests__/Table.test.js +0 -21
- package/dist/esm/Table/__tests__/Table.test.js.map +1 -1
- package/dist/esm/Tabs/TabLink.js +1 -0
- package/dist/esm/Tabs/TabLink.js.map +1 -1
- package/dist/esm/styles/typography.js +66 -66
- package/dist/esm/styles/typography.js.map +1 -1
- package/dist/js/Accordion/ContentAccordion.d.ts +18 -0
- package/dist/js/Accordion/ContentAccordion.js +151 -0
- package/dist/js/Accordion/ContentAccordion.js.map +1 -0
- package/dist/js/Accordion/__tests__/ContetnAccordion.test.js +151 -0
- package/dist/js/Accordion/__tests__/ContetnAccordion.test.js.map +1 -0
- package/dist/js/Accordion/index.d.ts +1 -0
- package/dist/js/Accordion/index.js +8 -0
- package/dist/js/Accordion/index.js.map +1 -1
- package/dist/js/AuthPage/AuthPage.js +1 -1
- package/dist/js/AuthPage/AuthPage.js.map +1 -1
- package/dist/js/AuthPage/Information.d.ts +1 -1
- package/dist/js/AuthPage/Information.js +1 -1
- package/dist/js/AuthPage/Information.js.map +1 -1
- package/dist/js/Banners/Banner.js +16 -19
- package/dist/js/Banners/Banner.js.map +1 -1
- package/dist/js/Button/Iconbutton.d.ts +2 -2
- package/dist/js/Button/Iconbutton.js +0 -1
- package/dist/js/Button/Iconbutton.js.map +1 -1
- package/dist/js/Dropdown/ChipDropdownInput.js +3 -1
- package/dist/js/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/js/Dropdown/CommonStyling.js +1 -1
- package/dist/js/Dropdown/CommonStyling.js.map +1 -1
- package/dist/js/Dropdown/DropdownButton.d.ts +1 -1
- package/dist/js/Dropdown/DropdownButton.js +5 -2
- package/dist/js/Dropdown/DropdownButton.js.map +1 -1
- package/dist/js/Dropdown/DropdownButtonTypes.d.ts +1 -0
- package/dist/js/Dropdown/DropdownFilter.d.ts +1 -1
- package/dist/js/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/js/HyperLink/HyperLink.d.ts +1 -1
- package/dist/js/HyperLink/HyperLink.js +2 -2
- package/dist/js/HyperLink/HyperLink.js.map +1 -1
- package/dist/js/InputFields/Checkbox.d.ts +3 -2
- package/dist/js/InputFields/Checkbox.js +13 -11
- package/dist/js/InputFields/Checkbox.js.map +1 -1
- package/dist/js/Table/Table.js +143 -209
- package/dist/js/Table/Table.js.map +1 -1
- package/dist/js/Table/TableBody.d.ts +9 -0
- package/dist/js/Table/TableBody.js +167 -0
- package/dist/js/Table/TableBody.js.map +1 -0
- package/dist/js/Table/TableFooter.d.ts +13 -0
- package/dist/js/Table/TableFooter.js +82 -0
- package/dist/js/Table/TableFooter.js.map +1 -0
- package/dist/js/Table/TableHeaders.d.ts +9 -0
- package/dist/js/Table/TableHeaders.js +77 -0
- package/dist/js/Table/TableHeaders.js.map +1 -0
- package/dist/js/Table/TableStyles.d.ts +17 -7
- package/dist/js/Table/TableStyles.js +58 -16
- package/dist/js/Table/TableStyles.js.map +1 -1
- package/dist/js/Table/TableTypes.d.ts +23 -16
- package/dist/js/Table/__tests__/Table.test.js +8 -30
- package/dist/js/Table/__tests__/Table.test.js.map +1 -1
- package/dist/js/Tabs/TabLink.js +1 -1
- package/dist/js/Tabs/TabLink.js.map +1 -1
- package/dist/js/styles/typography.d.ts +6 -6
- package/dist/js/styles/typography.js +66 -66
- package/dist/js/styles/typography.js.map +1 -1
- package/dist/umd/Accordion/ContentAccordion.js +266 -0
- package/dist/umd/Accordion/ContentAccordion.js.map +1 -0
- package/dist/umd/Accordion/__tests__/ContetnAccordion.test.js +165 -0
- package/dist/umd/Accordion/__tests__/ContetnAccordion.test.js.map +1 -0
- package/dist/umd/Accordion/index.js +10 -4
- package/dist/umd/Accordion/index.js.map +1 -1
- package/dist/umd/AuthPage/AuthPage.js +1 -1
- package/dist/umd/AuthPage/AuthPage.js.map +1 -1
- package/dist/umd/AuthPage/Information.js +1 -1
- package/dist/umd/AuthPage/Information.js.map +1 -1
- package/dist/umd/Banners/Banner.js +16 -16
- package/dist/umd/Banners/Banner.js.map +1 -1
- package/dist/umd/Button/Iconbutton.js +0 -1
- package/dist/umd/Button/Iconbutton.js.map +1 -1
- package/dist/umd/Dropdown/ChipDropdownInput.js +2 -2
- package/dist/umd/Dropdown/ChipDropdownInput.js.map +1 -1
- package/dist/umd/Dropdown/CommonStyling.js +4 -0
- package/dist/umd/Dropdown/CommonStyling.js.map +1 -1
- package/dist/umd/Dropdown/DropdownButton.js +5 -2
- package/dist/umd/Dropdown/DropdownButton.js.map +1 -1
- package/dist/umd/Dropdown/DropdownFilter.js.map +1 -1
- package/dist/umd/HyperLink/HyperLink.js +2 -1
- package/dist/umd/HyperLink/HyperLink.js.map +1 -1
- package/dist/umd/InputFields/Checkbox.js +23 -13
- package/dist/umd/InputFields/Checkbox.js.map +1 -1
- package/dist/umd/Table/Table.js +139 -188
- package/dist/umd/Table/Table.js.map +1 -1
- package/dist/umd/Table/TableBody.js +270 -0
- package/dist/umd/Table/TableBody.js.map +1 -0
- package/dist/umd/Table/TableFooter.js +82 -0
- package/dist/umd/Table/TableFooter.js.map +1 -0
- package/dist/umd/Table/TableHeaders.js +91 -0
- package/dist/umd/Table/TableHeaders.js.map +1 -0
- package/dist/umd/Table/TableStyles.js +134 -122
- package/dist/umd/Table/TableStyles.js.map +1 -1
- package/dist/umd/Table/__tests__/Table.test.js +0 -21
- package/dist/umd/Table/__tests__/Table.test.js.map +1 -1
- package/dist/umd/Tabs/TabLink.js +1 -0
- package/dist/umd/Tabs/TabLink.js.map +1 -1
- package/dist/umd/styles/typography.js +66 -66
- package/dist/umd/styles/typography.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import _pt from "prop-types";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { Size } from '../types';
|
|
5
|
+
import { SystemIcons } from '../icons';
|
|
6
|
+
import { ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle } from '../styles/typography';
|
|
7
|
+
import { COLORS } from '../styles';
|
|
8
|
+
import { Z_INDEXES } from '../styles/z-indexes';
|
|
9
|
+
const ContentAccordionWrapper = styled.div`
|
|
10
|
+
width: 100%;
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.content-accordion-item {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
border-top: 1px solid ${COLORS.neutral_100};
|
|
18
|
+
|
|
19
|
+
.item-header {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
min-height: 48px;
|
|
24
|
+
color: ${COLORS.neutral_600};
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
color: ${COLORS.primary_700};
|
|
29
|
+
background-color: ${COLORS.primary_20};
|
|
30
|
+
z-index: ${Z_INDEXES.hover};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:focus {
|
|
34
|
+
box-shadow: 0 4px 12px rgba(46, 127, 161, 0.25), 0 0 8px #2E7FA1;
|
|
35
|
+
background-color: ${COLORS.white};
|
|
36
|
+
z-index: ${Z_INDEXES.focus};
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:active {
|
|
41
|
+
color: ${COLORS.primary_800};
|
|
42
|
+
background-color: ${COLORS.primary_100};
|
|
43
|
+
box-shadow: none;
|
|
44
|
+
z-index: ${Z_INDEXES.active};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.item-header-icon,
|
|
48
|
+
.item-header-icon svg {
|
|
49
|
+
width: 24px;
|
|
50
|
+
height: 24px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.item-header-text {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.item-content {
|
|
58
|
+
display: none;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
|
|
61
|
+
.item-content-header {
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.item-content-body {
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.item-content-footer {
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.active {
|
|
74
|
+
.item-content {
|
|
75
|
+
display: flex;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.disabled {
|
|
80
|
+
.item-header {
|
|
81
|
+
color: ${COLORS.neutral_300};
|
|
82
|
+
cursor: not-allowed;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.content-accordion-item:last-child {
|
|
89
|
+
border-bottom: 1px solid ${COLORS.neutral_100};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&.small {
|
|
93
|
+
min-width: 320px;
|
|
94
|
+
max-width: 528px;
|
|
95
|
+
|
|
96
|
+
.item-header {
|
|
97
|
+
gap: 8px;
|
|
98
|
+
padding: 0 8px;
|
|
99
|
+
${ComponentSStyling(ComponentTextStyle.Regular, null)}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.item-content {
|
|
103
|
+
padding: 0 8px 16px 40px;
|
|
104
|
+
gap: 8px;
|
|
105
|
+
|
|
106
|
+
.item-content-header {
|
|
107
|
+
${ComponentSStyling(ComponentTextStyle.Bold, null)}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.item-content-body {
|
|
111
|
+
${ComponentSStyling(ComponentTextStyle.Regular, null)}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
&.medium {
|
|
118
|
+
min-width: 344px;
|
|
119
|
+
max-width: 584px;
|
|
120
|
+
|
|
121
|
+
.item-header {
|
|
122
|
+
gap: 12px;
|
|
123
|
+
padding: 0 12px;
|
|
124
|
+
${ComponentMStyling(ComponentTextStyle.Regular, null)}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.item-content {
|
|
128
|
+
padding: 8px 12px 24px 48px;
|
|
129
|
+
gap: 12px;
|
|
130
|
+
|
|
131
|
+
.item-content-header {
|
|
132
|
+
${ComponentMStyling(ComponentTextStyle.Bold, null)}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.item-content-body {
|
|
136
|
+
${ComponentMStyling(ComponentTextStyle.Regular, null)}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
&.large {
|
|
143
|
+
min-width: 384px;
|
|
144
|
+
max-width: 656px;
|
|
145
|
+
|
|
146
|
+
.item-header {
|
|
147
|
+
gap: 16px;
|
|
148
|
+
padding: 0 16px;
|
|
149
|
+
${ComponentLStyling(ComponentTextStyle.Regular, null)}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.item-content {
|
|
153
|
+
padding: 16px 16px 32px 56px;
|
|
154
|
+
gap: 16px;
|
|
155
|
+
|
|
156
|
+
.item-content-header {
|
|
157
|
+
${ComponentLStyling(ComponentTextStyle.Bold, null)}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.item-content-body {
|
|
161
|
+
${ComponentLStyling(ComponentTextStyle.Regular, null)}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
export const ContentAccordion = props => {
|
|
167
|
+
const [opened, setOpened] = React.useState([]);
|
|
168
|
+
React.useEffect(() => {
|
|
169
|
+
if (props.multi) {
|
|
170
|
+
setOpened(props.items.filter(item => item.active).map(item => item.key));
|
|
171
|
+
} else {
|
|
172
|
+
let active = props.items.find(item => !!item.active)?.key;
|
|
173
|
+
|
|
174
|
+
if (active) {
|
|
175
|
+
setOpened([active]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, [props.items, props.multi]);
|
|
179
|
+
|
|
180
|
+
const onItemClick = item => {
|
|
181
|
+
if (item.disabled) return;
|
|
182
|
+
|
|
183
|
+
if (opened.includes(item.key)) {
|
|
184
|
+
setOpened(opened.filter(key => key !== item.key));
|
|
185
|
+
} else {
|
|
186
|
+
if (props.multi) {
|
|
187
|
+
setOpened([...opened, item.key]);
|
|
188
|
+
} else {
|
|
189
|
+
setOpened([item.key]);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const renderItem = item => {
|
|
195
|
+
const isActive = opened.includes(item.key);
|
|
196
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
197
|
+
key: item.key,
|
|
198
|
+
id: `item_${item.key}`,
|
|
199
|
+
className: 'content-accordion-item'.concat(isActive ? ' active' : '').concat(item.disabled ? ' disabled' : '')
|
|
200
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
className: 'item-header',
|
|
202
|
+
tabIndex: !item.disabled ? 0 : undefined,
|
|
203
|
+
onMouseDown: e => e.preventDefault(),
|
|
204
|
+
onClick: () => !item.disabled && onItemClick(item),
|
|
205
|
+
onKeyPress: event => event.key === 'Enter' && onItemClick(item)
|
|
206
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
207
|
+
className: 'item-header-icon'
|
|
208
|
+
}, props.multi ? isActive ? /*#__PURE__*/React.createElement(SystemIcons.Minus, null) : /*#__PURE__*/React.createElement(SystemIcons.Plus, null) : isActive ? /*#__PURE__*/React.createElement(SystemIcons.ChevronDown, null) : /*#__PURE__*/React.createElement(SystemIcons.ChevronRight, null)), /*#__PURE__*/React.createElement("div", {
|
|
209
|
+
className: 'item-header-text'
|
|
210
|
+
}, item.title)), /*#__PURE__*/React.createElement("div", {
|
|
211
|
+
className: 'item-content'
|
|
212
|
+
}, item.header && /*#__PURE__*/React.createElement("div", {
|
|
213
|
+
className: 'item-content-header'
|
|
214
|
+
}, item.header), /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: 'item-content-body'
|
|
216
|
+
}, item.body), item.footer && /*#__PURE__*/React.createElement("div", {
|
|
217
|
+
className: 'item-content-footer'
|
|
218
|
+
}, item.footer)));
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
return /*#__PURE__*/React.createElement(ContentAccordionWrapper, {
|
|
222
|
+
className: 'content-accordion'.concat(` ${props.size ?? Size.Medium}`)
|
|
223
|
+
}, props.items.map(item => renderItem(item)));
|
|
224
|
+
};
|
|
225
|
+
ContentAccordion.propTypes = {
|
|
226
|
+
items: _pt.arrayOf(_pt.shape({
|
|
227
|
+
key: _pt.string.isRequired,
|
|
228
|
+
title: _pt.string.isRequired,
|
|
229
|
+
header: _pt.string,
|
|
230
|
+
body: _pt.any.isRequired,
|
|
231
|
+
footer: _pt.any,
|
|
232
|
+
disabled: _pt.bool,
|
|
233
|
+
active: _pt.bool
|
|
234
|
+
})).isRequired,
|
|
235
|
+
multi: _pt.bool
|
|
236
|
+
};
|
|
237
|
+
export default ContentAccordion;
|
|
238
|
+
//# sourceMappingURL=ContentAccordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/Accordion/ContentAccordion.tsx"],"names":["React","styled","Size","SystemIcons","ComponentLStyling","ComponentMStyling","ComponentSStyling","ComponentTextStyle","COLORS","Z_INDEXES","ContentAccordionWrapper","div","neutral_100","neutral_600","primary_700","primary_20","hover","white","focus","primary_800","primary_100","active","neutral_300","Regular","Bold","ContentAccordion","props","opened","setOpened","useState","useEffect","multi","items","filter","item","map","key","find","onItemClick","disabled","includes","renderItem","isActive","concat","undefined","e","preventDefault","event","title","header","body","footer","size","Medium"],"mappings":";AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,IAAR,QAAmB,UAAnB;AACA,SAAQC,WAAR,QAA0B,UAA1B;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,EAAiEC,kBAAjE,QAA0F,sBAA1F;AACA,SAAQC,MAAR,QAAqB,WAArB;AACA,SAAQC,SAAR,QAAwB,qBAAxB;AAGA,MAAMC,uBAAuB,GAAGT,MAAM,CAACU,GAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4BH,MAAM,CAACI,WAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,eAAeJ,MAAM,CAACK,WAAY;AAClC;AACA;AACA;AACA,iBAAiBL,MAAM,CAACM,WAAY;AACpC,4BAA4BN,MAAM,CAACO,UAAW;AAC9C,mBAAmBN,SAAS,CAACO,KAAM;AACnC;AACA;AACA;AACA;AACA,4BAA4BR,MAAM,CAACS,KAAM;AACzC,mBAAmBR,SAAS,CAACS,KAAM;AACnC;AACA;AACA;AACA;AACA,iBAAiBV,MAAM,CAACW,WAAY;AACpC,4BAA4BX,MAAM,CAACY,WAAY;AAC/C;AACA,mBAAmBX,SAAS,CAACY,MAAO;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBb,MAAM,CAACc,WAAY;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+Bd,MAAM,CAACI,WAAY;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQN,iBAAiB,CAACC,kBAAkB,CAACgB,OAApB,EAA6B,IAA7B,CAAmC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAUjB,iBAAiB,CAACC,kBAAkB,CAACiB,IAApB,EAA0B,IAA1B,CAAgC;AAC3D;AACA;AACA;AACA,UAAUlB,iBAAiB,CAACC,kBAAkB,CAACgB,OAApB,EAA6B,IAA7B,CAAmC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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IAAD,CAHjD;AAIK,MAAA,UAAU,EAAEa,KAAK,IAAIA,KAAK,CAACX,GAAN,KAAc,OAAd,IAAyBE,WAAW,CAACJ,IAAD;AAJ9D,oBAKE;AAAK,MAAA,SAAS,EAAE;AAAhB,OAEIR,KAAK,CAACK,KAAN,GACIW,QAAQ,gBACN,oBAAC,WAAD,CAAa,KAAb,OADM,gBAEN,oBAAC,WAAD,CAAa,IAAb,OAHN,GAIIA,QAAQ,gBACN,oBAAC,WAAD,CAAa,WAAb,OADM,gBAEN,oBAAC,WAAD,CAAa,YAAb,OARV,CALF,eAgBE;AAAK,MAAA,SAAS,EAAE;AAAhB,OACGR,IAAI,CAACc,KADR,CAhBF,CAHF,eAuBE;AAAK,MAAA,SAAS,EAAE;AAAhB,OAEId,IAAI,CAACe,MAAL,iBACA;AAAK,MAAA,SAAS,EAAE;AAAhB,OACGf,IAAI,CAACe,MADR,CAHJ,eAOE;AAAK,MAAA,SAAS,EAAE;AAAhB,OACGf,IAAI,CAACgB,IADR,CAPF,EAWIhB,IAAI,CAACiB,MAAL,iBACA;AAAK,MAAA,SAAS,EAAE;AAAhB,OACGjB,IAAI,CAACiB,MADR,CAZJ,CAvBF,CADF;AA2CD,GA9CD;;AAgDA,sBACE,oBAAC,uBAAD;AAAyB,IAAA,SAAS,EAAE,oBAAoBR,MAApB,CAA4B,IAAGjB,KAAK,CAAC0B,IAAN,IAAclD,IAAI,CAACmD,MAAO,EAAzD;AAApC,KACG3B,KAAK,CAACM,KAAN,CAAYG,GAAZ,CAAgBD,IAAI,IAAIO,UAAU,CAACP,IAAD,CAAlC,CADH,CADF;AAKD,CAjFM;;AALLF,EAAAA,K;AAVAI,IAAAA,G;AACAY,IAAAA,K;AACAC,IAAAA,M;AACAC,IAAAA,I;AACAC,IAAAA,M;AACAZ,IAAAA,Q;AACAlB,IAAAA,M;;AAKAU,EAAAA,K;;AAuFF,eAAeN,gBAAf","sourcesContent":["import React from 'react'\nimport styled from 'styled-components';\nimport {Size} from '../types';\nimport {SystemIcons} from '../icons';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling, ComponentTextStyle} from '../styles/typography';\nimport {COLORS} from '../styles';\nimport {Z_INDEXES} from '../styles/z-indexes';\n\n\nconst ContentAccordionWrapper = styled.div`\n width: 100%;\n position: relative;\n\n\n .content-accordion-item {\n display: flex;\n flex-direction: column;\n border-top: 1px solid ${COLORS.neutral_100};\n\n .item-header {\n display: flex;\n align-items: center;\n box-sizing: border-box;\n min-height: 48px;\n color: ${COLORS.neutral_600};\n cursor: pointer;\n\n &:hover {\n color: ${COLORS.primary_700};\n background-color: ${COLORS.primary_20};\n z-index: ${Z_INDEXES.hover};\n }\n\n &:focus {\n box-shadow: 0 4px 12px rgba(46, 127, 161, 0.25), 0 0 8px #2E7FA1;\n background-color: ${COLORS.white};\n z-index: ${Z_INDEXES.focus};\n outline: none;\n }\n\n &:active {\n color: ${COLORS.primary_800};\n background-color: ${COLORS.primary_100};\n box-shadow: none;\n z-index: ${Z_INDEXES.active};\n }\n\n .item-header-icon,\n .item-header-icon svg {\n width: 24px;\n height: 24px;\n }\n\n .item-header-text {\n }\n }\n\n .item-content {\n display: none;\n flex-direction: column;\n\n .item-content-header {\n\n }\n\n .item-content-body {\n\n }\n\n .item-content-footer {\n }\n }\n\n &.active {\n .item-content {\n display: flex;\n }\n }\n\n &.disabled {\n .item-header {\n color: ${COLORS.neutral_300};\n cursor: not-allowed;\n pointer-events: none;\n }\n }\n }\n\n .content-accordion-item:last-child {\n border-bottom: 1px solid ${COLORS.neutral_100};\n }\n\n &.small {\n min-width: 320px;\n max-width: 528px;\n\n .item-header {\n gap: 8px;\n padding: 0 8px;\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\n }\n\n .item-content {\n padding: 0 8px 16px 40px;\n gap: 8px;\n\n .item-content-header {\n ${ComponentSStyling(ComponentTextStyle.Bold, null)}\n }\n\n .item-content-body {\n ${ComponentSStyling(ComponentTextStyle.Regular, null)}\n }\n }\n }\n\n\n &.medium {\n min-width: 344px;\n max-width: 584px;\n\n .item-header {\n gap: 12px;\n padding: 0 12px;\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\n }\n\n .item-content {\n padding: 8px 12px 24px 48px;\n gap: 12px;\n\n .item-content-header {\n ${ComponentMStyling(ComponentTextStyle.Bold, null)}\n }\n\n .item-content-body {\n ${ComponentMStyling(ComponentTextStyle.Regular, null)}\n }\n\n }\n }\n\n &.large {\n min-width: 384px;\n max-width: 656px;\n\n .item-header {\n gap: 16px;\n padding: 0 16px;\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\n }\n\n .item-content {\n padding: 16px 16px 32px 56px;\n gap: 16px;\n\n .item-content-header {\n ${ComponentLStyling(ComponentTextStyle.Bold, null)}\n }\n\n .item-content-body {\n ${ComponentLStyling(ComponentTextStyle.Regular, null)}\n }\n }\n }\n`;\n\nexport interface ContentAccordionItem {\n key: string;\n title: string;\n header?: string;\n body: any;\n footer?: any;\n disabled?: boolean;\n active?: boolean;\n}\n\nexport interface ContentAccordionProps {\n items: ContentAccordionItem[];\n multi?: boolean;\n size?: Size;\n}\n\nexport const ContentAccordion: React.FunctionComponent<ContentAccordionProps> = (props) => {\n\n const [opened, setOpened] = React.useState<string[]>([]);\n\n React.useEffect(() => {\n if (props.multi) {\n setOpened(props.items.filter(item => item.active).map(item => item.key));\n } else {\n let active = props.items.find(item => !!item.active)?.key;\n if (active) {\n setOpened([active]);\n }\n }\n }, [props.items, props.multi]);\n\n const onItemClick = (item: ContentAccordionItem) => {\n if (item.disabled) return;\n if (opened.includes(item.key)) {\n setOpened(opened.filter(key => key !== item.key));\n } else {\n if (props.multi) {\n setOpened([...opened, item.key]);\n } else {\n setOpened([item.key]);\n }\n }\n }\n\n const renderItem = (item: ContentAccordionItem) => {\n const isActive = opened.includes(item.key);\n\n return (\n <div key={item.key}\n id={`item_${item.key}`}\n className={'content-accordion-item'.concat(isActive ? ' active' : '').concat(item.disabled ? ' disabled' : '')}>\n <div className={'item-header'}\n tabIndex={!item.disabled ? 0 : undefined}\n onMouseDown={e => e.preventDefault()}\n onClick={() => !item.disabled && onItemClick(item)}\n onKeyPress={event => event.key === 'Enter' && onItemClick(item)}>\n <div className={'item-header-icon'}>\n {\n props.multi\n ? isActive\n ? <SystemIcons.Minus/>\n : <SystemIcons.Plus/>\n : isActive\n ? <SystemIcons.ChevronDown/>\n : <SystemIcons.ChevronRight/>\n }\n </div>\n <div className={'item-header-text'}>\n {item.title}\n </div>\n </div>\n <div className={'item-content'}>\n {\n item.header &&\n <div className={'item-content-header'}>\n {item.header}\n </div>\n }\n <div className={'item-content-body'}>\n {item.body}\n </div>\n {\n item.footer &&\n <div className={'item-content-footer'}>\n {item.footer}\n </div>\n }\n </div>\n </div>\n );\n }\n\n return (\n <ContentAccordionWrapper className={'content-accordion'.concat(` ${props.size ?? Size.Medium}`)}>\n {props.items.map(item => renderItem(item))}\n </ContentAccordionWrapper>\n );\n};\n\nexport default ContentAccordion;\n"],"file":"ContentAccordion.js"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ContentAccordion from '../ContentAccordion';
|
|
3
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
4
|
+
import { Size } from '../../types';
|
|
5
|
+
describe('ContentAccordion', () => {
|
|
6
|
+
const contentAccordionItemsWithBody = [{
|
|
7
|
+
key: '1',
|
|
8
|
+
title: 'Item 1',
|
|
9
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
|
10
|
+
}, {
|
|
11
|
+
key: '2',
|
|
12
|
+
title: 'Item 2',
|
|
13
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
14
|
+
active: true
|
|
15
|
+
}, {
|
|
16
|
+
key: '3',
|
|
17
|
+
title: 'Item 3',
|
|
18
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
19
|
+
disabled: true
|
|
20
|
+
}, {
|
|
21
|
+
key: '4',
|
|
22
|
+
title: 'Item 4',
|
|
23
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
|
|
24
|
+
}];
|
|
25
|
+
const contentAccordionItemsWithBodyAndHeaderAndFooter = [{
|
|
26
|
+
key: '1',
|
|
27
|
+
title: 'Item 1',
|
|
28
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
29
|
+
header: 'Header 1',
|
|
30
|
+
footer: /*#__PURE__*/React.createElement("span", null)
|
|
31
|
+
}, {
|
|
32
|
+
key: '2',
|
|
33
|
+
title: 'Item 2',
|
|
34
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
35
|
+
header: 'Header 2',
|
|
36
|
+
footer: /*#__PURE__*/React.createElement("span", null)
|
|
37
|
+
}, {
|
|
38
|
+
key: '3',
|
|
39
|
+
title: 'Item 3',
|
|
40
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
41
|
+
header: 'Header 3',
|
|
42
|
+
footer: /*#__PURE__*/React.createElement("span", null),
|
|
43
|
+
disabled: true
|
|
44
|
+
}, {
|
|
45
|
+
key: '4',
|
|
46
|
+
title: 'Item 4',
|
|
47
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
48
|
+
header: 'Header 4',
|
|
49
|
+
footer: /*#__PURE__*/React.createElement("span", null)
|
|
50
|
+
}];
|
|
51
|
+
it('should render items in correct state', () => {
|
|
52
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
53
|
+
items: contentAccordionItemsWithBody
|
|
54
|
+
}));
|
|
55
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item').length).toBe(4);
|
|
56
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item disabled').length).toBe(1);
|
|
57
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item disabled')[0].id).toBe('item_3');
|
|
58
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(1);
|
|
59
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_2');
|
|
60
|
+
});
|
|
61
|
+
it('should not render header if not provided', () => {
|
|
62
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
63
|
+
items: contentAccordionItemsWithBody
|
|
64
|
+
}));
|
|
65
|
+
expect(wrapper.baseElement.getElementsByClassName('item-content-body').length).toBe(4);
|
|
66
|
+
expect(wrapper.baseElement.getElementsByClassName('item-content-header').length).toBe(0);
|
|
67
|
+
});
|
|
68
|
+
it('should not render footer if not provided', () => {
|
|
69
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
70
|
+
items: contentAccordionItemsWithBody
|
|
71
|
+
}));
|
|
72
|
+
expect(wrapper.baseElement.getElementsByClassName('item-content-body').length).toBe(4);
|
|
73
|
+
expect(wrapper.baseElement.getElementsByClassName('item-content-footer').length).toBe(0);
|
|
74
|
+
});
|
|
75
|
+
it('should render body, header, and footer if all are provided', () => {
|
|
76
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
77
|
+
items: contentAccordionItemsWithBodyAndHeaderAndFooter
|
|
78
|
+
}));
|
|
79
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item').length).toBe(4);
|
|
80
|
+
expect(wrapper.baseElement.getElementsByClassName('item-content-body').length).toBe(4);
|
|
81
|
+
expect(wrapper.baseElement.getElementsByClassName('item-content-header').length).toBe(4);
|
|
82
|
+
expect(wrapper.baseElement.getElementsByClassName('item-content-footer').length).toBe(4);
|
|
83
|
+
});
|
|
84
|
+
it('should set correct size class name for small accordion', () => {
|
|
85
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
86
|
+
items: contentAccordionItemsWithBodyAndHeaderAndFooter,
|
|
87
|
+
size: Size.Small
|
|
88
|
+
}));
|
|
89
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion small').length).toBe(1);
|
|
90
|
+
});
|
|
91
|
+
it('should set correct size class name for medium accordion', () => {
|
|
92
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
93
|
+
items: contentAccordionItemsWithBodyAndHeaderAndFooter,
|
|
94
|
+
size: Size.Medium
|
|
95
|
+
}));
|
|
96
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion medium').length).toBe(1);
|
|
97
|
+
});
|
|
98
|
+
it('should set correct size class name for large accordion', () => {
|
|
99
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
100
|
+
items: contentAccordionItemsWithBodyAndHeaderAndFooter,
|
|
101
|
+
size: Size.Large
|
|
102
|
+
}));
|
|
103
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion large').length).toBe(1);
|
|
104
|
+
});
|
|
105
|
+
it('should change active state when item header is clicked', () => {
|
|
106
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
107
|
+
items: contentAccordionItemsWithBody,
|
|
108
|
+
multi: false
|
|
109
|
+
}));
|
|
110
|
+
const itemHeader = wrapper.baseElement.getElementsByClassName('item-header')[3];
|
|
111
|
+
fireEvent.click(itemHeader);
|
|
112
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(1);
|
|
113
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_4');
|
|
114
|
+
});
|
|
115
|
+
it('should not change active state when disabled item header is clicked', () => {
|
|
116
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
117
|
+
items: contentAccordionItemsWithBody,
|
|
118
|
+
multi: false
|
|
119
|
+
}));
|
|
120
|
+
const itemHeader = wrapper.baseElement.getElementsByClassName('item-header')[2];
|
|
121
|
+
fireEvent.click(itemHeader);
|
|
122
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(1);
|
|
123
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_2');
|
|
124
|
+
});
|
|
125
|
+
it('should append active items if multi property is true', () => {
|
|
126
|
+
const wrapper = render( /*#__PURE__*/React.createElement(ContentAccordion, {
|
|
127
|
+
items: contentAccordionItemsWithBody,
|
|
128
|
+
multi: true
|
|
129
|
+
}));
|
|
130
|
+
const itemHeader = wrapper.baseElement.getElementsByClassName('item-header')[3];
|
|
131
|
+
fireEvent.click(itemHeader);
|
|
132
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(2);
|
|
133
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_2');
|
|
134
|
+
expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[1].id).toBe('item_4');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=ContetnAccordion.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/Accordion/__tests__/ContetnAccordion.test.tsx"],"names":["React","ContentAccordion","fireEvent","render","Size","describe","contentAccordionItemsWithBody","key","title","body","active","disabled","contentAccordionItemsWithBodyAndHeaderAndFooter","header","footer","it","wrapper","expect","baseElement","getElementsByClassName","length","toBe","id","Small","Medium","Large","itemHeader","click"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,SAAQC,SAAR,EAAmBC,MAAnB,QAAgC,wBAAhC;AACA,SAAQC,IAAR,QAAmB,aAA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AA2C,aAA3C,EAA0D,CAA1D,CAAnB;AAEAjB,IAAAA,SAAS,CAACyB,KAAV,CAAgBD,UAAhB;AAEAT,IAAAA,MAAM,CAACD,OAAO,CAACE,WAAR,CAAoBC,sBAApB,CAA2C,+BAA3C,EAA4EC,MAA7E,CAAN,CAA2FC,IAA3F,CAAgG,CAAhG;AACAJ,IAAAA,MAAM,CAACD,OAAO,CAACE,WAAR,CAAoBC,sBAApB,CAA2C,+BAA3C,EAA4E,CAA5E,EAA+EG,EAAhF,CAAN,CAA0FD,IAA1F,CAA+F,QAA/F;AACAJ,IAAAA,MAAM,CAACD,OAAO,CAACE,WAAR,CAAoBC,sBAApB,CAA2C,+BAA3C,EAA4E,CAA5E,EAA+EG,EAAhF,CAAN,CAA0FD,IAA1F,CAA+F,QAA/F;AACD,GATC,CAAF;AAWD,CA5IO,CAAR","sourcesContent":["import React from 'react';\nimport ContentAccordion from '../ContentAccordion';\nimport {fireEvent, render} from '@testing-library/react';\nimport {Size} from '../../types';\n\ndescribe('ContentAccordion', () => {\n const contentAccordionItemsWithBody = [\n {\n key: '1',\n title: 'Item 1',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'\n },\n {\n key: '2',\n title: 'Item 2',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',\n active: true\n },\n {\n key: '3',\n title: 'Item 3',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',\n disabled: true\n },\n {\n key: '4',\n title: 'Item 4',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'\n }\n ];\n\n const contentAccordionItemsWithBodyAndHeaderAndFooter = [\n {\n key: '1',\n title: 'Item 1',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',\n header: 'Header 1',\n footer: <span/>,\n },\n {\n key: '2',\n title: 'Item 2',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',\n header: 'Header 2',\n footer: <span/>,\n },\n {\n key: '3',\n title: 'Item 3',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',\n header: 'Header 3',\n footer: <span/>,\n disabled: true\n },\n {\n key: '4',\n title: 'Item 4',\n body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',\n header: 'Header 4',\n footer: <span/>,\n }\n ];\n\n it('should render items in correct state', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody}/>);\n\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item').length).toBe(4);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item disabled').length).toBe(1);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item disabled')[0].id).toBe('item_3');\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(1);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_2');\n });\n\n it('should not render header if not provided', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody}/>);\n\n expect(wrapper.baseElement.getElementsByClassName('item-content-body').length).toBe(4);\n expect(wrapper.baseElement.getElementsByClassName('item-content-header').length).toBe(0);\n });\n\n it('should not render footer if not provided', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody}/>);\n\n expect(wrapper.baseElement.getElementsByClassName('item-content-body').length).toBe(4);\n expect(wrapper.baseElement.getElementsByClassName('item-content-footer').length).toBe(0);\n });\n\n it('should render body, header, and footer if all are provided', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}/>);\n\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item').length).toBe(4);\n expect(wrapper.baseElement.getElementsByClassName('item-content-body').length).toBe(4);\n expect(wrapper.baseElement.getElementsByClassName('item-content-header').length).toBe(4);\n expect(wrapper.baseElement.getElementsByClassName('item-content-footer').length).toBe(4);\n });\n\n it('should set correct size class name for small accordion', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}\n size={Size.Small}/>);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion small').length).toBe(1);\n });\n\n it('should set correct size class name for medium accordion', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}\n size={Size.Medium}/>);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion medium').length).toBe(1);\n });\n\n it('should set correct size class name for large accordion', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBodyAndHeaderAndFooter}\n size={Size.Large}/>);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion large').length).toBe(1);\n });\n\n it('should change active state when item header is clicked', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody} multi={false}/>);\n const itemHeader = wrapper.baseElement.getElementsByClassName('item-header')[3];\n\n fireEvent.click(itemHeader);\n\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(1);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_4');\n });\n\n it('should not change active state when disabled item header is clicked', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody} multi={false}/>);\n const itemHeader = wrapper.baseElement.getElementsByClassName('item-header')[2];\n\n fireEvent.click(itemHeader);\n\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(1);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_2');\n });\n\n it('should append active items if multi property is true', () => {\n const wrapper = render(<ContentAccordion items={contentAccordionItemsWithBody} multi={true}/>);\n const itemHeader = wrapper.baseElement.getElementsByClassName('item-header')[3];\n\n fireEvent.click(itemHeader);\n\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active').length).toBe(2);\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[0].id).toBe('item_2');\n expect(wrapper.baseElement.getElementsByClassName('content-accordion-item active')[1].id).toBe('item_4');\n });\n\n});\n"],"file":"ContetnAccordion.test.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Accordion/index.ts"],"names":["default","AccordionMenu","AccordionMenuItem","AccordionMenuWrapper"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/Accordion/index.ts"],"names":["default","AccordionMenu","AccordionMenuItem","ContentAccordion","AccordionMenuWrapper"],"mappings":"AAAA,SAAQA,OAAO,IAAIC,aAAnB,QAAuC,iBAAvC;AACA,SAAQD,OAAO,IAAIE,iBAAnB,QAA2C,iBAA3C;AACA,SAAQC,gBAAR,QAA+B,oBAA/B;AACA,SAAQC,oBAAR,QAAmC,UAAnC","sourcesContent":["export {default as AccordionMenu} from './AccordionMenu';\nexport {default as AccordionMenuItem} from './AccordionMenu';\nexport {ContentAccordion} from './ContentAccordion';\nexport {AccordionMenuWrapper} from './styles';\n"],"file":"index.js"}
|
|
@@ -23,7 +23,7 @@ const AuthPage = ({
|
|
|
23
23
|
screenSetsContainerId
|
|
24
24
|
}) => {
|
|
25
25
|
return /*#__PURE__*/React.createElement(React.Fragment, null, showInformationSection && /*#__PURE__*/React.createElement(InformationContainer, {
|
|
26
|
-
color: signUp ? COLORS.accent1_20 : COLORS.primary_20
|
|
26
|
+
$color: signUp ? COLORS.accent1_20 : COLORS.primary_20
|
|
27
27
|
}, /*#__PURE__*/React.createElement(InformationContent, null, (signUpPlaceholderImage || signInPlaceholderImage) && /*#__PURE__*/React.createElement(InformationImage, {
|
|
28
28
|
src: signUp ? signUpPlaceholderImage : signInPlaceholderImage,
|
|
29
29
|
alt: signUp ? signUpPlaceholderImageAlt : signInPlaceholderImageAlt
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/AuthPage/AuthPage.tsx"],"names":["React","COLORS","ScreenSetsContainer","InformationContainer","InformationContent","InformationHeader","InformationText","InformationImage","AuthPage","showInformationSection","signUp","signUpPlaceholderImage","signInPlaceholderImage","signUpPlaceholderImageAlt","signInPlaceholderImageAlt","signUpInformationHeader","signInInformationHeader","signUpInformationText","signInInformationText","screenSetsContainerId","accent1_20","primary_20"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,OAAOC,mBAAP,MAAgC,uBAAhC;AACA,SAASC,oBAAT,EAA+BC,kBAA/B,EAAmDC,iBAAnD,EAAsEC,eAAtE,EAAuFC,gBAAvF,QAA+G,eAA/G;;AA4BA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,CAAC;AAChBC,EAAAA,sBADgB;AAEhBC,EAAAA,MAFgB;AAGhBC,EAAAA,sBAHgB;AAIhBC,EAAAA,sBAJgB;AAKhBC,EAAAA,yBALgB;AAMhBC,EAAAA,yBANgB;AAOhBC,EAAAA,uBAPgB;AAQhBC,EAAAA,uBARgB;AAShBC,EAAAA,qBATgB;AAUhBC,EAAAA,qBAVgB;AAWhBC,EAAAA;AAXgB,CAAD,KAYI;AACnB,sBACE,0CACGV,sBAAsB,iBACrB,oBAAC,oBAAD;AAAsB,IAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/AuthPage/AuthPage.tsx"],"names":["React","COLORS","ScreenSetsContainer","InformationContainer","InformationContent","InformationHeader","InformationText","InformationImage","AuthPage","showInformationSection","signUp","signUpPlaceholderImage","signInPlaceholderImage","signUpPlaceholderImageAlt","signInPlaceholderImageAlt","signUpInformationHeader","signInInformationHeader","signUpInformationText","signInInformationText","screenSetsContainerId","accent1_20","primary_20"],"mappings":";AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,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AAAA,sB;AAEAC,EAAAA,yB;AAEAC,EAAAA,yB;AAEAC,EAAAA,uB;AAEAC,EAAAA,uB;AAEAC,EAAAA,qB;AAEAC,EAAAA,qB;AAEAC,EAAAA,qB;;AAuCF,eAAeX,QAAf","sourcesContent":["import * as React from 'react';\nimport { COLORS } from '../styles';\nimport ScreenSetsContainer from './ScreenSetsContainer';\nimport { InformationContainer, InformationContent, InformationHeader, InformationText, InformationImage } from './Information';\n\ntype AuthPageProps = {\n /** set this to 'false' to hide the left side illustration/information section */\n showInformationSection: boolean;\n /** true if 'sign-up' screen-set is showing, otherwise false.\n * The value can be set using 'onBeforeScreenLoad' in 'gigya.accounts.showScreenSet(...)' and checking the loaded screen-set */\n signUp: boolean;\n /** img src string for 'sign-up' placeholder image */\n signUpPlaceholderImage?: string;\n /** img src string for 'sign-in' placeholder image */\n signInPlaceholderImage?: string;\n /** img alt text string for 'sign-up' placeholder image */\n signUpPlaceholderImageAlt?: string;\n /** img alt text string for 'sign-in' placeholder image */\n signInPlaceholderImageAlt?: string;\n /** information header text string below 'sign-up' placeholder image */\n signUpInformationHeader?: string;\n /** information header text string below 'sign-in' placeholder image */\n signInInformationHeader?: string;\n /** information text string below 'sign-up' header text */\n signUpInformationText?: string;\n /** information text string below 'sign-in' header text */\n signInInformationText?: string;\n /** ID that will be given to the SAP CDC screen-sets container (must match 'containerID' in 'gigya.accounts.showScreenSet(...)'!) */\n screenSetsContainerId: string;\n};\n\n/**\n * The 'AuthPage' component consist of two containers: an 'Information' container on the left, and a 'ScreenSetsContainer' on the right.\n * The 'Information' container is optional and its contents depend on the context (sign-up or sign-in).\n * The 'ScreenSetsContainer' will contain the SAP CDC screen-sets.\n */\nconst AuthPage = ({\n showInformationSection,\n signUp,\n signUpPlaceholderImage,\n signInPlaceholderImage,\n signUpPlaceholderImageAlt,\n signInPlaceholderImageAlt,\n signUpInformationHeader,\n signInInformationHeader,\n signUpInformationText,\n signInInformationText,\n screenSetsContainerId,\n}: AuthPageProps) => {\n return (\n <>\n {showInformationSection && (\n <InformationContainer $color={signUp ? COLORS.accent1_20 : COLORS.primary_20}>\n <InformationContent>\n {(signUpPlaceholderImage || signInPlaceholderImage) && (\n <InformationImage src={signUp ? signUpPlaceholderImage : signInPlaceholderImage} alt={signUp ? signUpPlaceholderImageAlt : signInPlaceholderImageAlt} />\n )}\n {(signUpInformationHeader || signInInformationHeader) && <InformationHeader>{signUp ? signUpInformationHeader : signInInformationHeader}</InformationHeader>}\n {(signUpInformationText || signInInformationText) && <InformationText>{signUp ? signUpInformationText : signInInformationText}</InformationText>}\n </InformationContent>\n </InformationContainer>\n )}\n <ScreenSetsContainer id={screenSetsContainerId} centerContents={!showInformationSection} />\n </>\n );\n};\n\nexport default AuthPage;\n"],"file":"AuthPage.js"}
|
|
@@ -4,7 +4,7 @@ import { BREAKPOINTS, COLORS, ParagraphTextStyle } from '../styles';
|
|
|
4
4
|
import { HeadlineXLStyling, ParagraphLStyling } from '../styles/typography';
|
|
5
5
|
export const InformationContainer = styled(AuthPageSection)`
|
|
6
6
|
display: none;
|
|
7
|
-
background: ${props => props
|
|
7
|
+
background: ${props => props.$color};
|
|
8
8
|
|
|
9
9
|
${BREAKPOINTS.MEDIUM} {
|
|
10
10
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/AuthPage/Information.tsx"],"names":["styled","AuthPageSection","BREAKPOINTS","COLORS","ParagraphTextStyle","HeadlineXLStyling","ParagraphLStyling","InformationContainer","props","color","MEDIUM","InformationContent","div","LARGE","InformationHeader","h2","black","InformationText","p","Regular","neutral_600","InformationImage","img"],"mappings":"AACA,OAAOA,MAAP,MAAmB,mBAAnB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,
|
|
1
|
+
{"version":3,"sources":["../../../src/AuthPage/Information.tsx"],"names":["styled","AuthPageSection","BREAKPOINTS","COLORS","ParagraphTextStyle","HeadlineXLStyling","ParagraphLStyling","InformationContainer","props","$color","MEDIUM","InformationContent","div","LARGE","InformationHeader","h2","black","InformationText","p","Regular","neutral_600","InformationImage","img"],"mappings":"AACA,OAAOA,MAAP,MAAmB,mBAAnB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,SAASC,WAAT,EAAsBC,MAAtB,EAA8DC,kBAA9D,QAAwF,WAAxF;AACA,SAA4BC,iBAA5B,EAA+CC,iBAA/C,QAAwE,sBAAxE;AAEA,OAAO,MAAMC,oBAAoB,GAAGP,MAAM,CAACC,eAAD,CAAsC;AAChF;AACA,gBAAiBO,KAAD,IAAWA,KAAK,CAACC,MAAO;AACxC;AACA,IAAIP,WAAW,CAACQ,MAAO;AACvB;AACA;AACA;AACA,CARO;AAUP,OAAO,MAAMC,kBAAkB,GAAGX,MAAM,CAACY,GAAI;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIV,WAAW,CAACW,KAAM;AACtB;AACA;AACA;AACA,CAZO;AAcP,OAAO,MAAMC,iBAAiB,GAAGd,MAAM,CAACe,EAAG;AAC3C,IAAIV,iBAAiB,CAACF,MAAM,CAACa,KAAR,CAAe;AACpC;AACA;AACA,CAJO;AAMP,OAAO,MAAMC,eAAe,GAAGjB,MAAM,CAACkB,CAAE;AACxC,IAAIZ,iBAAiB,CAACF,kBAAkB,CAACe,OAApB,EAA6BhB,MAAM,CAACiB,WAApC,CAAiD;AACtE;AACA,CAHO;AAKP,OAAO,MAAMC,gBAAgB,GAAGrB,MAAM,CAACsB,GAAI;AAC3C;AACA;AACA,CAHO","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport AuthPageSection from './_AuthPageSection';\nimport { BREAKPOINTS, COLORS, ComponentTextStyle, HeadlineXL, ParagraphTextStyle } from '../styles';\nimport { ComponentLStyling, HeadlineXLStyling, ParagraphLStyling } from '../styles/typography';\n\nexport const InformationContainer = styled(AuthPageSection)<{ $color: string }>`\n display: none;\n background: ${(props) => props.$color};\n\n ${BREAKPOINTS.MEDIUM} {\n display: flex;\n padding-top: 56px;\n }\n`;\n\nexport const InformationContent = styled.div`\n display: flex;\n flex-direction: column;\n align-self: center;\n align-items: center;\n text-align: center;\n max-width: 100%;\n\n ${BREAKPOINTS.LARGE} {\n align-self: flex-end;\n margin-right: 48px;\n }\n`;\n\nexport const InformationHeader = styled.h2`\n ${HeadlineXLStyling(COLORS.black)}\n font-weight: 300;\n margin-bottom: 0;\n`;\n\nexport const InformationText = styled.p`\n ${ParagraphLStyling(ParagraphTextStyle.Regular, COLORS.neutral_600)}\n margin: 8px 0;\n`;\n\nexport const InformationImage = styled.img`\n height: 275px;\n max-width: 100%;\n`;\n"],"file":"Information.js"}
|
|
@@ -12,7 +12,7 @@ import { HyperLink } from '../HyperLink';
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const BannerContainer = styled.div`
|
|
15
|
-
background: ${props => props
|
|
15
|
+
background: ${props => props.$type ? props.$type : COLORS.correct_100};
|
|
16
16
|
min-height: 48px;
|
|
17
17
|
display: flex;
|
|
18
18
|
color: ${COLORS.black};
|
|
@@ -43,8 +43,8 @@ const BannerContainer = styled.div`
|
|
|
43
43
|
}
|
|
44
44
|
`;
|
|
45
45
|
const BannerCenter = styled.div`
|
|
46
|
-
${props => ComponentMStyling(ComponentTextStyle.Regular, props
|
|
47
|
-
|
|
46
|
+
${props => ComponentMStyling(ComponentTextStyle.Regular, props.$color)}
|
|
47
|
+
|
|
48
48
|
display: flex;
|
|
49
49
|
width: 100%;
|
|
50
50
|
margin: 0 0 0 16px;
|
|
@@ -74,7 +74,7 @@ const ButtonWrapper = styled.div`
|
|
|
74
74
|
`;
|
|
75
75
|
const ButtonContainer = styled.div`
|
|
76
76
|
display: contents;
|
|
77
|
-
${props => props
|
|
77
|
+
${props => props.$type ? getButtonStyle(props.$type) : null};
|
|
78
78
|
`;
|
|
79
79
|
const BannerContentWrapper = styled.div`
|
|
80
80
|
display: flex;
|
|
@@ -111,12 +111,12 @@ const Banner = ({
|
|
|
111
111
|
case 'warning':
|
|
112
112
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
113
113
|
"data-testid": testId,
|
|
114
|
-
type: COLORS.warning_100,
|
|
114
|
+
$type: COLORS.warning_100,
|
|
115
115
|
link: COLORS.warning_700,
|
|
116
116
|
hover: COLORS.warning_20,
|
|
117
117
|
bottom: bottom
|
|
118
118
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
119
|
-
color: COLORS.warning_700,
|
|
119
|
+
$color: COLORS.warning_700,
|
|
120
120
|
className: size
|
|
121
121
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(Help, {
|
|
122
122
|
color: COLORS.warning_700,
|
|
@@ -130,7 +130,7 @@ const Banner = ({
|
|
|
130
130
|
href: link,
|
|
131
131
|
variant: "default"
|
|
132
132
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
133
|
-
type: formatTypeToLowerCase
|
|
133
|
+
$type: formatTypeToLowerCase
|
|
134
134
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
135
135
|
variant: "secondary",
|
|
136
136
|
shape: "circular",
|
|
@@ -145,13 +145,13 @@ const Banner = ({
|
|
|
145
145
|
case 'critical':
|
|
146
146
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
147
147
|
"data-testid": testId,
|
|
148
|
-
type: COLORS.critical_100,
|
|
148
|
+
$type: COLORS.critical_100,
|
|
149
149
|
link: COLORS.critical_700,
|
|
150
150
|
hover: COLORS.critical_20,
|
|
151
151
|
bottom: bottom,
|
|
152
152
|
className: size
|
|
153
153
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
154
|
-
color: COLORS.critical_700,
|
|
154
|
+
$color: COLORS.critical_700,
|
|
155
155
|
className: size
|
|
156
156
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(TechnicalWarning, {
|
|
157
157
|
color: COLORS.critical_700,
|
|
@@ -165,7 +165,7 @@ const Banner = ({
|
|
|
165
165
|
href: link,
|
|
166
166
|
variant: "default"
|
|
167
167
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
168
|
-
type: formatTypeToLowerCase
|
|
168
|
+
$type: formatTypeToLowerCase
|
|
169
169
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
170
170
|
variant: "secondary",
|
|
171
171
|
shape: "circular",
|
|
@@ -180,13 +180,13 @@ const Banner = ({
|
|
|
180
180
|
case 'positive':
|
|
181
181
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
182
182
|
"data-testid": testId,
|
|
183
|
-
type: COLORS.correct_100,
|
|
183
|
+
$type: COLORS.correct_100,
|
|
184
184
|
link: COLORS.correct_700,
|
|
185
185
|
hover: COLORS.correct_20,
|
|
186
186
|
bottom: bottom,
|
|
187
187
|
className: size
|
|
188
188
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
189
|
-
color: COLORS.correct_700,
|
|
189
|
+
$color: COLORS.correct_700,
|
|
190
190
|
className: size
|
|
191
191
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(ThumbsUp, {
|
|
192
192
|
color: COLORS.correct_700,
|
|
@@ -200,7 +200,7 @@ const Banner = ({
|
|
|
200
200
|
href: link,
|
|
201
201
|
variant: "default"
|
|
202
202
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
203
|
-
type: formatTypeToLowerCase
|
|
203
|
+
$type: formatTypeToLowerCase
|
|
204
204
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
205
205
|
variant: "secondary",
|
|
206
206
|
shape: "circular",
|
|
@@ -215,13 +215,13 @@ const Banner = ({
|
|
|
215
215
|
default:
|
|
216
216
|
return /*#__PURE__*/React.createElement(BannerContainer, {
|
|
217
217
|
"data-testid": testId,
|
|
218
|
-
type: COLORS.primary_100,
|
|
218
|
+
$type: COLORS.primary_100,
|
|
219
219
|
link: COLORS.primary_700,
|
|
220
220
|
hover: COLORS.primary_20,
|
|
221
221
|
bottom: bottom,
|
|
222
222
|
className: size
|
|
223
223
|
}, /*#__PURE__*/React.createElement(BannerCenter, {
|
|
224
|
-
color: COLORS.primary_700,
|
|
224
|
+
$color: COLORS.primary_700,
|
|
225
225
|
className: size
|
|
226
226
|
}, icon ? icon : noIcon ? null : /*#__PURE__*/React.createElement(Tip, {
|
|
227
227
|
color: COLORS.primary_700,
|
|
@@ -235,7 +235,7 @@ const Banner = ({
|
|
|
235
235
|
href: link,
|
|
236
236
|
variant: "default"
|
|
237
237
|
}, linkText))), onClose && /*#__PURE__*/React.createElement(ButtonWrapper, null, /*#__PURE__*/React.createElement(ButtonContainer, {
|
|
238
|
-
type: "neutral"
|
|
238
|
+
$type: "neutral"
|
|
239
239
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
240
240
|
variant: "secondary",
|
|
241
241
|
shape: "circular",
|