@dxc-technology/halstack-react 0.0.0-e628009 → 0.0.0-e884f9f
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/BackgroundColorContext.js +50 -0
- package/ThemeContext.js +246 -0
- package/{dist/select/Select.js → V3Select/V3Select.js} +38 -132
- package/V3Select/index.d.ts +27 -0
- package/{dist/V3Textarea → V3Textarea}/V3Textarea.js +10 -14
- package/V3Textarea/index.d.ts +27 -0
- package/accordion/Accordion.d.ts +4 -0
- package/{dist/accordion → accordion}/Accordion.js +35 -130
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +170 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/{dist/alert → alert}/Alert.js +38 -151
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.js +59 -0
- package/box/Box.d.ts +4 -0
- package/{dist/box → box}/Box.js +13 -43
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/{dist/button → button}/Button.js +22 -83
- package/button/Button.stories.tsx +276 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/{dist/card → card}/Card.js +33 -123
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/{dist/checkbox → checkbox}/Checkbox.js +16 -63
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +60 -0
- package/checkbox/types.js +5 -0
- package/{dist/chip → chip}/Chip.js +17 -61
- package/chip/Chip.stories.tsx +121 -0
- package/chip/index.d.ts +22 -0
- package/{dist/common → common}/OpenSans.css +0 -0
- package/{dist/common → common}/RequiredComponent.js +3 -11
- package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/{dist/common → common}/utils.js +0 -0
- package/{dist/common → common}/variables.js +160 -152
- package/{dist/date → date}/Date.js +21 -27
- package/date/index.d.ts +27 -0
- package/date-input/DateInput.d.ts +4 -0
- package/{dist/date-input → date-input}/DateInput.js +22 -61
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/types.d.ts +100 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/{dist/dialog → dialog}/Dialog.js +20 -73
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/{dist/dropdown → dropdown}/Dropdown.js +44 -171
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/{dist/file-input → file-input}/FileInput.js +56 -189
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +182 -0
- package/file-input/types.d.ts +87 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/{dist/footer → footer}/Footer.js +38 -193
- package/footer/Footer.stories.jsx +151 -0
- package/{dist/footer → footer}/Icons.js +13 -13
- package/footer/types.d.ts +61 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +324 -0
- package/header/Header.stories.tsx +162 -0
- package/{dist/header → header}/Icons.js +7 -32
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/{dist/heading → heading}/Heading.js +24 -95
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/{dist/input-text → input-text}/Icons.js +2 -2
- package/{dist/input-text → input-text}/InputText.js +36 -130
- package/input-text/index.d.ts +36 -0
- package/{dist/layout → layout}/ApplicationLayout.js +31 -123
- package/{dist/layout → layout}/Icons.js +7 -7
- package/link/Link.d.ts +3 -0
- package/{dist/link → link}/Link.js +18 -94
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/main.d.ts +44 -0
- package/{dist/main.js → main.js} +93 -97
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +86 -0
- package/number-input/NumberInput.stories.tsx +115 -0
- package/{dist/number-input → number-input}/NumberInputContext.js +1 -1
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +32 -25
- package/{dist/paginator → paginator}/Icons.js +9 -9
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +198 -0
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/{dist/password-input → password-input}/PasswordInput.js +24 -60
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/types.d.ts +100 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/{dist/progress-bar → progress-bar}/ProgressBar.js +20 -92
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.d.ts +4 -0
- package/{dist/radio → radio}/Radio.js +15 -50
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +54 -0
- package/radio/types.js +5 -0
- package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +35 -119
- package/resultsetTable/index.d.ts +19 -0
- package/select/Select.js +865 -0
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +131 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/{dist/sidenav → sidenav}/Sidenav.js +19 -62
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/{dist/slider → slider}/Slider.js +71 -158
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +250 -0
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/{dist/switch → switch}/Switch.js +26 -69
- package/switch/Switch.stories.tsx +160 -0
- package/switch/types.d.ts +58 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/{dist/table → table}/Table.js +10 -24
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +213 -0
- package/tabs/types.d.ts +70 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +193 -0
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/{dist/text-input → text-input}/TextInput.js +244 -390
- package/{dist/text-input → text-input}/index.d.ts +2 -2
- package/{dist/textarea → textarea}/Textarea.js +20 -72
- package/textarea/Textarea.stories.jsx +135 -0
- package/{dist/textarea → textarea}/index.d.ts +0 -0
- package/{dist/toggle → toggle}/Toggle.js +15 -49
- package/toggle/index.d.ts +21 -0
- package/{dist/toggle-group → toggle-group}/ToggleGroup.js +23 -107
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/index.d.ts +21 -0
- package/{dist/upload → upload}/Upload.js +14 -18
- package/{dist/upload → upload}/buttons-upload/ButtonsUpload.js +13 -37
- package/{dist/upload → upload}/buttons-upload/Icons.js +7 -7
- package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
- package/{dist/upload → upload}/dragAndDropArea/Icons.js +6 -6
- package/upload/file-upload/FileToUpload.js +115 -0
- package/{dist/upload → upload}/file-upload/Icons.js +13 -13
- package/{dist/upload → upload}/files-upload/FilesToUpload.js +12 -26
- package/upload/index.d.ts +15 -0
- package/{dist/upload → upload}/transaction/Icons.js +31 -31
- package/upload/transaction/Transaction.js +104 -0
- package/upload/transactions/Transactions.js +94 -0
- package/{dist/useTheme.js → useTheme.js} +0 -0
- package/{dist/wizard → wizard}/Icons.js +8 -8
- package/wizard/Wizard.d.ts +4 -0
- package/{dist/wizard → wizard}/Wizard.js +32 -206
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/README.md +0 -66
- package/babel.config.js +0 -8
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -248
- package/dist/accordion-group/AccordionGroup.js +0 -186
- package/dist/alert/index.d.ts +0 -51
- package/dist/badge/Badge.js +0 -63
- package/dist/date-input/index.d.ts +0 -95
- package/dist/file-input/FileItem.js +0 -280
- package/dist/file-input/index.d.ts +0 -81
- package/dist/header/Header.js +0 -434
- package/dist/main.d.ts +0 -8
- package/dist/new-select/NewSelect.js +0 -836
- package/dist/new-select/index.d.ts +0 -53
- package/dist/number-input/NumberInput.js +0 -136
- package/dist/number-input/index.d.ts +0 -113
- package/dist/paginator/Paginator.js +0 -283
- package/dist/password-input/index.d.ts +0 -94
- package/dist/spinner/Spinner.js +0 -381
- package/dist/tabs/Tabs.js +0 -343
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tag/Tag.js +0 -282
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/dist/upload/file-upload/FileToUpload.js +0 -189
- package/dist/upload/transaction/Transaction.js +0 -148
- package/dist/upload/transactions/Transactions.js +0 -138
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -125
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -397
- package/test/DateInput.test.js +0 -242
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -145
- package/test/FileInput.test.js +0 -201
- package/test/Footer.test.js +0 -94
- package/test/Header.test.js +0 -34
- package/test/Heading.test.js +0 -83
- package/test/InputText.test.js +0 -248
- package/test/Link.test.js +0 -43
- package/test/NumberInput.test.js +0 -259
- package/test/Paginator.test.js +0 -177
- package/test/PasswordInput.test.js +0 -83
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -329
- package/test/Select.test.js +0 -212
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -74
- package/test/Spinner.test.js +0 -32
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextInput.test.js +0 -732
- package/test/Textarea.test.js +0 -193
- package/test/ToggleGroup.test.js +0 -85
- package/test/Upload.test.js +0 -60
- package/test/V3TextArea.test.js +0 -51
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
|
-
var _Icons = require("./Icons");
|
|
21
|
-
|
|
22
|
-
var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
|
|
23
|
-
|
|
24
|
-
function _templateObject8() {
|
|
25
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n border: none;\n display: flex;\n margin-right: 30px;\n margin-top: 11px;\n padding: 0px;\n background: none;\n &:focus {\n visibility: visible;\n }\n & svg {\n fill: ", ";\n height: ", ";\n width: ", ";\n }\n"]);
|
|
26
|
-
|
|
27
|
-
_templateObject8 = function _templateObject8() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _templateObject7() {
|
|
35
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n"]);
|
|
36
|
-
|
|
37
|
-
_templateObject7 = function _templateObject7() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _templateObject6() {
|
|
45
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-bottom: 12px;\n"]);
|
|
46
|
-
|
|
47
|
-
_templateObject6 = function _templateObject6() {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _templateObject5() {
|
|
55
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n"]);
|
|
56
|
-
|
|
57
|
-
_templateObject5 = function _templateObject5() {
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _templateObject4() {
|
|
65
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 30px;\n width: 70px;\n height: 52px;\n & svg {\n width: 70px;\n height: 52px;\n }\n"]);
|
|
66
|
-
|
|
67
|
-
_templateObject4 = function _templateObject4() {
|
|
68
|
-
return data;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return data;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function _templateObject3() {
|
|
75
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 30px;\n width: 70px;\n height: 52px;\n object-fit: contain;\n"]);
|
|
76
|
-
|
|
77
|
-
_templateObject3 = function _templateObject3() {
|
|
78
|
-
return data;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return data;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function _templateObject2() {
|
|
85
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n margin-bottom: 25px;\n margin-left: 40px;\n"]);
|
|
86
|
-
|
|
87
|
-
_templateObject2 = function _templateObject2() {
|
|
88
|
-
return data;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
return data;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function _templateObject() {
|
|
95
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n max-width: 100%;\n height: 52px;\n display: flex;\n flex-direction: column;\n padding-bottom: 25px;\n padding-top: 25px;\n border-bottom: ", " solid ", ";\n :hover {\n background: ", ";\n &:hover {\n cursor: pointer;\n }\n }\n"]);
|
|
96
|
-
|
|
97
|
-
_templateObject = function _templateObject() {
|
|
98
|
-
return data;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
return data;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
var DxcFileToUpload = function DxcFileToUpload(_ref) {
|
|
105
|
-
var _ref$name = _ref.name,
|
|
106
|
-
name = _ref$name === void 0 ? "" : _ref$name,
|
|
107
|
-
_ref$type = _ref.type,
|
|
108
|
-
type = _ref$type === void 0 ? "" : _ref$type,
|
|
109
|
-
image = _ref.image,
|
|
110
|
-
onDelete = _ref.onDelete,
|
|
111
|
-
tabIndexValue = _ref.tabIndexValue;
|
|
112
|
-
|
|
113
|
-
var icon = type.includes("video") && _Icons.videoIcon || type.includes("audio") && _Icons.audioIcon || _Icons.defaultIcon;
|
|
114
|
-
|
|
115
|
-
var hasImage = image && image.includes("image");
|
|
116
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
117
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
118
|
-
theme: colorsTheme.upload
|
|
119
|
-
}, _react["default"].createElement(DXCFileToUpload, null, _react["default"].createElement(FileContent, null, hasImage && _react["default"].createElement(FileImage, {
|
|
120
|
-
src: image
|
|
121
|
-
}) || _react["default"].createElement(FileIconContainer, null, icon), _react["default"].createElement(FileInfo, null, _react["default"].createElement(FileName, null, name), _react["default"].createElement(FileType, null, type)), _react["default"].createElement(DeleteFile, {
|
|
122
|
-
onClick: onDelete,
|
|
123
|
-
tabIndex: tabIndexValue
|
|
124
|
-
}, _Icons.closeIcon))));
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
DxcFileToUpload.propTypes = {
|
|
128
|
-
name: _propTypes["default"].string,
|
|
129
|
-
type: _propTypes["default"].string,
|
|
130
|
-
image: _propTypes["default"].string,
|
|
131
|
-
onDelete: _propTypes["default"].func
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
var DXCFileToUpload = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
135
|
-
return props.theme.fontFamily;
|
|
136
|
-
}, function (props) {
|
|
137
|
-
return props.theme.fileUnderlineThickness;
|
|
138
|
-
}, function (props) {
|
|
139
|
-
return props.theme.fileUnderlineColor;
|
|
140
|
-
}, function (props) {
|
|
141
|
-
return props.theme.hoverFileColor;
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
var FileContent = _styledComponents["default"].div(_templateObject2());
|
|
145
|
-
|
|
146
|
-
var FileImage = _styledComponents["default"].img(_templateObject3());
|
|
147
|
-
|
|
148
|
-
var FileIconContainer = _styledComponents["default"].div(_templateObject4());
|
|
149
|
-
|
|
150
|
-
var FileInfo = _styledComponents["default"].div(_templateObject5());
|
|
151
|
-
|
|
152
|
-
var FileName = _styledComponents["default"].div(_templateObject6(), function (props) {
|
|
153
|
-
return props.theme.fileNameFontSize;
|
|
154
|
-
}, function (props) {
|
|
155
|
-
return props.theme.fileNameFontStyle;
|
|
156
|
-
}, function (props) {
|
|
157
|
-
return props.theme.fileNameFontWeight;
|
|
158
|
-
}, function (props) {
|
|
159
|
-
return props.theme.fileNameFontTextTransform;
|
|
160
|
-
}, function (props) {
|
|
161
|
-
return props.theme.fileNameFontColor;
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
var FileType = _styledComponents["default"].div(_templateObject7(), function (props) {
|
|
165
|
-
return props.theme.fileTypeFontSize;
|
|
166
|
-
}, function (props) {
|
|
167
|
-
return props.theme.fileTypeFontStyle;
|
|
168
|
-
}, function (props) {
|
|
169
|
-
return props.theme.fileTypeFontWeight;
|
|
170
|
-
}, function (props) {
|
|
171
|
-
return props.theme.fileTypeFontTextTransform;
|
|
172
|
-
}, function (props) {
|
|
173
|
-
return props.theme.fileTypeFontColor;
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
var DeleteFile = _styledComponents["default"].button(_templateObject8(), function (props) {
|
|
177
|
-
return props.theme.fileDeleteIconSize;
|
|
178
|
-
}, function (props) {
|
|
179
|
-
return props.theme.fileDeleteIconSize;
|
|
180
|
-
}, function (props) {
|
|
181
|
-
return props.theme.fileDeleteIconColor;
|
|
182
|
-
}, function (props) {
|
|
183
|
-
return props.theme.fileDeleteIconSize;
|
|
184
|
-
}, function (props) {
|
|
185
|
-
return props.theme.fileDeleteIconSize;
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
var _default = DxcFileToUpload;
|
|
189
|
-
exports["default"] = _default;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
21
|
-
|
|
22
|
-
var _Icons = require("./Icons");
|
|
23
|
-
|
|
24
|
-
var _Spinner = _interopRequireDefault(require("../../spinner/Spinner"));
|
|
25
|
-
|
|
26
|
-
var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
|
|
27
|
-
|
|
28
|
-
var _BackgroundColorContext = require("../../BackgroundColorContext.js");
|
|
29
|
-
|
|
30
|
-
function _templateObject5() {
|
|
31
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n width: 80%;\n"]);
|
|
32
|
-
|
|
33
|
-
_templateObject5 = function _templateObject5() {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _templateObject4() {
|
|
41
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 25px;\n height: 20px;\n max-width: 20%;\n"]);
|
|
42
|
-
|
|
43
|
-
_templateObject4 = function _templateObject4() {
|
|
44
|
-
return data;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _templateObject3() {
|
|
51
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-right: 16px;\n width: 80%;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"]);
|
|
52
|
-
|
|
53
|
-
_templateObject3 = function _templateObject3() {
|
|
54
|
-
return data;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _templateObject2() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n mask-size: ", ";\n height: ", ";\n width: ", ";\n margin-right: 16px;\n max-width: 20%;\n & svg {\n fill: ", ";\n }\n"]);
|
|
62
|
-
|
|
63
|
-
_templateObject2 = function _templateObject2() {
|
|
64
|
-
return data;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return data;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function _templateObject() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n max-width: 100%;\n display: flex;\n flex-direction: row;\n margin-bottom: 16px;\n color: ", ";\n .MuiCircularProgress-root {\n width: 28px !important;\n height: 28px !important;\n }\n"]);
|
|
72
|
-
|
|
73
|
-
_templateObject = function _templateObject() {
|
|
74
|
-
return data;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return data;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
var DxcTransaction = function DxcTransaction(_ref) {
|
|
81
|
-
var _ref$name = _ref.name,
|
|
82
|
-
name = _ref$name === void 0 ? "" : _ref$name,
|
|
83
|
-
_ref$type = _ref.type,
|
|
84
|
-
type = _ref$type === void 0 ? "" : _ref$type,
|
|
85
|
-
_ref$status = _ref.status,
|
|
86
|
-
status = _ref$status === void 0 ? "" : _ref$status,
|
|
87
|
-
_ref$message = _ref.message,
|
|
88
|
-
message = _ref$message === void 0 ? "" : _ref$message;
|
|
89
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
90
|
-
|
|
91
|
-
var icon = status === "error" && (type.includes("image") && _Icons.imageIconError || type.includes("video") && _Icons.videoIconError || type.includes("audio") && _Icons.audioIconError || _Icons.defaultIconError) || type.includes("image") && _Icons.imageIcon || type.includes("video") && _Icons.videoIcon || type.includes("audio") && _Icons.audioIcon || _Icons.defaultIcon;
|
|
92
|
-
|
|
93
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
94
|
-
theme: colorsTheme.upload
|
|
95
|
-
}, _react["default"].createElement(DXCTransaction, {
|
|
96
|
-
status: status
|
|
97
|
-
}, _react["default"].createElement(FileImage, {
|
|
98
|
-
status: status
|
|
99
|
-
}, icon), status === "processing" && _react["default"].createElement(FileData, null, _react["default"].createElement(FileName, null, name), _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
100
|
-
color: colorsTheme.upload.backgroundColor
|
|
101
|
-
}, _react["default"].createElement(_Spinner["default"], {
|
|
102
|
-
mode: "small"
|
|
103
|
-
}))) || status === "success" && _react["default"].createElement(FileData, null, _react["default"].createElement(FileName, null, name), _react["default"].createElement(FileStatus, null, _Icons.successIcon)) || status === "error" && _react["default"].createElement(FileData, null, _react["default"].createElement(_Tooltip["default"], {
|
|
104
|
-
title: message
|
|
105
|
-
}, _react["default"].createElement(FileName, null, name)), _react["default"].createElement(FileStatus, null, _Icons.errorIcon), " ")));
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
DxcTransaction.propTypes = {
|
|
109
|
-
name: _propTypes["default"].string,
|
|
110
|
-
type: _propTypes["default"].string,
|
|
111
|
-
status: _propTypes["default"].string,
|
|
112
|
-
message: _propTypes["default"].string
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
var DXCTransaction = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
116
|
-
return props.theme.fontFamily;
|
|
117
|
-
}, function (props) {
|
|
118
|
-
return props.status === "error" && props.theme.errorColor;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
var FileImage = _styledComponents["default"].div(_templateObject2(), function (props) {
|
|
122
|
-
return "".concat(props.theme.uploadedFileIconSize, " ").concat(props.theme.uploadedFileIconSize);
|
|
123
|
-
}, function (props) {
|
|
124
|
-
return props.theme.uploadedFileIconSize;
|
|
125
|
-
}, function (props) {
|
|
126
|
-
return props.theme.uploadedFileIconSize;
|
|
127
|
-
}, function (props) {
|
|
128
|
-
return props.status === "error" && props.theme.errorColor || props.theme.uploadedFileIconColor;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
var FileName = _styledComponents["default"].div(_templateObject3(), function (props) {
|
|
132
|
-
return props.theme.fileNameFontSize;
|
|
133
|
-
}, function (props) {
|
|
134
|
-
return props.theme.fileNameFontStyle;
|
|
135
|
-
}, function (props) {
|
|
136
|
-
return props.theme.fileNameFontWeight;
|
|
137
|
-
}, function (props) {
|
|
138
|
-
return props.theme.fileNameFontTextTransform;
|
|
139
|
-
}, function (props) {
|
|
140
|
-
return props.theme.fileNameFontColor;
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
var FileStatus = _styledComponents["default"].div(_templateObject4());
|
|
144
|
-
|
|
145
|
-
var FileData = _styledComponents["default"].div(_templateObject5());
|
|
146
|
-
|
|
147
|
-
var _default = DxcTransaction;
|
|
148
|
-
exports["default"] = _default;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
-
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
|
-
var _Transaction = _interopRequireDefault(require("../transaction/Transaction"));
|
|
21
|
-
|
|
22
|
-
var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
|
|
23
|
-
|
|
24
|
-
function _templateObject5() {
|
|
25
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
|
|
26
|
-
|
|
27
|
-
_templateObject5 = function _templateObject5() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _templateObject4() {
|
|
35
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n"]);
|
|
36
|
-
|
|
37
|
-
_templateObject4 = function _templateObject4() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _templateObject3() {
|
|
45
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-bottom: 4px;\n"]);
|
|
46
|
-
|
|
47
|
-
_templateObject3 = function _templateObject3() {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _templateObject2() {
|
|
55
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n padding-bottom: 35px;\n"]);
|
|
56
|
-
|
|
57
|
-
_templateObject2 = function _templateObject2() {
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _templateObject() {
|
|
65
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n max-width: 100%;\n width: 35%;\n padding-top: 46px;\n padding-left: 65px;\n border-radius: 4px 0px 4px 4px;\n box-shadow: 0px 0px 1px ", ";\n background-color: ", ";\n overflow: auto;\n ::-webkit-scrollbar {\n width: 3px;\n height: 3px;\n }\n ::-webkit-scrollbar-track {\n border-radius: 3px;\n background-color: ", ";\n }\n ::-webkit-scrollbar-thumb {\n border-radius: 3px;\n background-color: ", ";\n }\n"]);
|
|
66
|
-
|
|
67
|
-
_templateObject = function _templateObject() {
|
|
68
|
-
return data;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return data;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var DxcTransactions = function DxcTransactions(_ref) {
|
|
75
|
-
var transactions = _ref.transactions;
|
|
76
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
77
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
78
|
-
theme: colorsTheme.upload
|
|
79
|
-
}, _react["default"].createElement(DXCTransactions, null, _react["default"].createElement(TransactionsText, null, _react["default"].createElement(TransactionsTitle, null, "Files uploaded"), _react["default"].createElement(TransactionsSubTitle, null, _react["default"].createElement(TransactionsNumber, null, transactions && transactions.filter(function (file) {
|
|
80
|
-
return file.status === "success";
|
|
81
|
-
}).length), " ", "documents in total")), transactions.map(function (transaction) {
|
|
82
|
-
return _react["default"].createElement(_Transaction["default"], {
|
|
83
|
-
name: transaction.name,
|
|
84
|
-
type: transaction.type,
|
|
85
|
-
status: transaction.status,
|
|
86
|
-
message: transaction.message
|
|
87
|
-
});
|
|
88
|
-
})));
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
DxcTransactions.propTypes = {
|
|
92
|
-
transactions: _propTypes["default"].array
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
var DXCTransactions = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
96
|
-
return props.theme.fontFamily;
|
|
97
|
-
}, function (props) {
|
|
98
|
-
return props.theme.shadowColor;
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return props.theme.backgroundColor;
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return props.theme.scrollBarTrackColor;
|
|
103
|
-
}, function (props) {
|
|
104
|
-
return props.theme.scrollBarThumbColor;
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
var TransactionsText = _styledComponents["default"].span(_templateObject2());
|
|
108
|
-
|
|
109
|
-
var TransactionsTitle = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
110
|
-
return props.theme.uploadedFilesTitleFontSize;
|
|
111
|
-
}, function (props) {
|
|
112
|
-
return props.theme.uploadedFilesTitleFontStyle;
|
|
113
|
-
}, function (props) {
|
|
114
|
-
return props.theme.uploadedFilesTitleFontWeight;
|
|
115
|
-
}, function (props) {
|
|
116
|
-
return props.theme.uploadedFilesTitleFontTextTransform;
|
|
117
|
-
}, function (props) {
|
|
118
|
-
return props.theme.uploadedFilesTitleFontColor;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
var TransactionsSubTitle = _styledComponents["default"].span(_templateObject4(), function (props) {
|
|
122
|
-
return props.theme.uploadedFilesSubtitleFontSize;
|
|
123
|
-
}, function (props) {
|
|
124
|
-
return props.theme.uploadedFilesSubtitleFontStyle;
|
|
125
|
-
}, function (props) {
|
|
126
|
-
return props.theme.uploadedFilesSubtitleFontWeight;
|
|
127
|
-
}, function (props) {
|
|
128
|
-
return props.theme.uploadedFilesSubtitleFontTextTransform;
|
|
129
|
-
}, function (props) {
|
|
130
|
-
return props.theme.uploadedFilesSubtitleFontColor;
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
var TransactionsNumber = _styledComponents["default"].span(_templateObject5(), function (props) {
|
|
134
|
-
return props.theme.uploadedFilesNumberFontWeight;
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
var _default = DxcTransactions;
|
|
138
|
-
exports["default"] = _default;
|
package/test/Accordion.test.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcAccordion from "../src/accordion/Accordion";
|
|
4
|
-
|
|
5
|
-
describe("Accordion component tests", () => {
|
|
6
|
-
test("Accordion renders with correct text", () => {
|
|
7
|
-
const onChange = jest.fn();
|
|
8
|
-
const { getByText } = render(<DxcAccordion label="Accordion" onChange={onChange} />);
|
|
9
|
-
|
|
10
|
-
expect(getByText("Accordion")).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("Calls correct function on click", () => {
|
|
14
|
-
const onChange = jest.fn();
|
|
15
|
-
const { getByText } = render(<DxcAccordion label="Accordion" onChange={onChange} />);
|
|
16
|
-
|
|
17
|
-
fireEvent.click(getByText("Accordion"));
|
|
18
|
-
expect(onChange).toHaveBeenCalled();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("Controlled accordion", () => {
|
|
22
|
-
const onChange = jest.fn();
|
|
23
|
-
const { getByText } = render(<DxcAccordion label="Accordion" onChange={onChange} isExpanded={true} />);
|
|
24
|
-
|
|
25
|
-
fireEvent.click(getByText("Accordion"));
|
|
26
|
-
fireEvent.click(getByText("Accordion"));
|
|
27
|
-
fireEvent.click(getByText("Accordion"));
|
|
28
|
-
expect(onChange).toHaveBeenCalledTimes(3);
|
|
29
|
-
expect(onChange.mock.calls[0][0]).toBe(false);
|
|
30
|
-
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
31
|
-
expect(onChange.mock.calls[2][0]).toBe(false);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcAccordionGroup from "../src/accordion-group/AccordionGroup";
|
|
4
|
-
|
|
5
|
-
describe("Accordion component tests", () => {
|
|
6
|
-
test("Uncontrolled accordion group renders with children", () => {
|
|
7
|
-
const { getByText, getAllByRole } = render(
|
|
8
|
-
<DxcAccordionGroup>
|
|
9
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
|
|
10
|
-
<div>
|
|
11
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
12
|
-
leo lobortis eget.
|
|
13
|
-
</div>
|
|
14
|
-
</DxcAccordionGroup.Accordion>
|
|
15
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
16
|
-
<div>
|
|
17
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
18
|
-
leo lobortis eget.
|
|
19
|
-
</div>
|
|
20
|
-
</DxcAccordionGroup.Accordion>
|
|
21
|
-
</DxcAccordionGroup>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(getByText("Accordion1")).toBeTruthy();
|
|
25
|
-
expect(getByText("Accordion2")).toBeTruthy();
|
|
26
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
27
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test("Uncontrolled accordion group renders with only one children", () => {
|
|
31
|
-
const { getByText, getAllByRole } = render(
|
|
32
|
-
<DxcAccordionGroup>
|
|
33
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
|
|
34
|
-
<div>
|
|
35
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
36
|
-
leo lobortis eget.
|
|
37
|
-
</div>
|
|
38
|
-
</DxcAccordionGroup.Accordion>
|
|
39
|
-
</DxcAccordionGroup>
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
expect(getByText("Accordion1")).toBeTruthy();
|
|
43
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test("Uncontrolled accordion group calls correct function on click", () => {
|
|
47
|
-
const onActiveChange = jest.fn();
|
|
48
|
-
const { getByText, getAllByRole } = render(
|
|
49
|
-
<DxcAccordionGroup margin="large" onActiveChange={onActiveChange}>
|
|
50
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
51
|
-
<div>
|
|
52
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
53
|
-
leo lobortis eget.
|
|
54
|
-
</div>
|
|
55
|
-
</DxcAccordionGroup.Accordion>
|
|
56
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
57
|
-
<div>
|
|
58
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
59
|
-
leo lobortis eget.
|
|
60
|
-
</div>
|
|
61
|
-
</DxcAccordionGroup.Accordion>
|
|
62
|
-
</DxcAccordionGroup>
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
66
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
67
|
-
fireEvent.click(getByText("Accordion1"));
|
|
68
|
-
expect(onActiveChange).toHaveBeenCalled();
|
|
69
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("true");
|
|
70
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test("Controlled accordion with indexActive change", () => {
|
|
74
|
-
const onActiveChange = jest.fn();
|
|
75
|
-
const { getByText, getAllByRole, rerender } = render(
|
|
76
|
-
<DxcAccordionGroup margin="large" indexActive={1} onActiveChange={onActiveChange}>
|
|
77
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
78
|
-
<div>Text1</div>
|
|
79
|
-
</DxcAccordionGroup.Accordion>
|
|
80
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
81
|
-
<div>Text2</div>
|
|
82
|
-
</DxcAccordionGroup.Accordion>
|
|
83
|
-
</DxcAccordionGroup>
|
|
84
|
-
);
|
|
85
|
-
expect(getByText("Text1")).toBeTruthy();
|
|
86
|
-
expect(getByText("Text2")).toBeTruthy();
|
|
87
|
-
fireEvent.click(getByText("Accordion1"));
|
|
88
|
-
fireEvent.click(getByText("Accordion2"));
|
|
89
|
-
expect(onActiveChange.mock.calls[0][0]).toBe(0);
|
|
90
|
-
expect(onActiveChange.mock.calls[1][0]).toBe(1);
|
|
91
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
92
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("true");
|
|
93
|
-
|
|
94
|
-
rerender(
|
|
95
|
-
<DxcAccordionGroup margin="large" indexActive={0} onActiveChange={onActiveChange}>
|
|
96
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
97
|
-
<div>Text1</div>
|
|
98
|
-
</DxcAccordionGroup.Accordion>
|
|
99
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
100
|
-
<div>Text2</div>
|
|
101
|
-
</DxcAccordionGroup.Accordion>
|
|
102
|
-
</DxcAccordionGroup>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("true");
|
|
106
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test("Disabled uncontrolled accordion group", () => {
|
|
110
|
-
const onActiveChange = jest.fn();
|
|
111
|
-
const { getByText } = render(
|
|
112
|
-
<DxcAccordionGroup margin="large" onActiveChange={onActiveChange} disabled={true}>
|
|
113
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
114
|
-
<div>Text1</div>
|
|
115
|
-
</DxcAccordionGroup.Accordion>
|
|
116
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
117
|
-
<div>Text2</div>
|
|
118
|
-
</DxcAccordionGroup.Accordion>
|
|
119
|
-
</DxcAccordionGroup>
|
|
120
|
-
);
|
|
121
|
-
fireEvent.click(getByText("Accordion1"));
|
|
122
|
-
fireEvent.click(getByText("Accordion2"));
|
|
123
|
-
expect(onActiveChange).toHaveBeenCalledTimes(0);
|
|
124
|
-
});
|
|
125
|
-
});
|