@dxc-technology/halstack-react 0.0.0-d20b360 → 0.0.0-d3554d7
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.d.ts +10 -0
- package/BackgroundColorContext.js +1 -4
- package/ThemeContext.d.ts +10 -0
- package/ThemeContext.js +26 -29
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +11 -22
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/Accordion.test.js +57 -0
- package/accordion/types.d.ts +4 -8
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/AccordionGroup.test.js +133 -0
- package/accordion-group/types.d.ts +4 -8
- package/alert/Alert.js +2 -2
- package/alert/Alert.stories.tsx +170 -0
- package/alert/Alert.test.js +92 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +1 -1
- package/badge/types.d.ts +4 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +84 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +13 -0
- package/bleed/types.js +5 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +6 -32
- package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +15 -26
- package/button/Button.stories.tsx +223 -242
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +9 -13
- package/card/Card.js +5 -6
- package/card/Card.stories.tsx +201 -0
- package/card/Card.test.js +50 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/Checkbox.test.js +65 -0
- package/checkbox/types.d.ts +2 -2
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +119 -0
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +85 -281
- package/date-input/DateInput.js +10 -13
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/DateInput.test.js +469 -0
- package/dialog/Dialog.js +4 -3
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/Dialog.test.js +40 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +13 -35
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/Dropdown.test.js +189 -0
- package/dropdown/types.d.ts +6 -15
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +167 -109
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +12 -21
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +28 -36
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +22 -18
- package/header/Header.js +2 -2
- package/header/Header.stories.tsx +162 -0
- package/header/Header.test.js +63 -0
- package/header/Icons.d.ts +2 -0
- package/header/types.d.ts +4 -2
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +186 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +84 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +13 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +17 -21
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +10 -40
- package/link/Link.stories.tsx +151 -0
- package/link/Link.test.js +91 -0
- package/link/types.d.ts +70 -0
- package/link/types.js +5 -0
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +10 -8
- package/main.js +54 -38
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +5 -50
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
- package/number-input/NumberInput.test.js +508 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +4 -2
- package/paginator/Paginator.js +2 -8
- package/paginator/Paginator.test.js +266 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +19 -55
- package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +4 -4
- package/password-input/PasswordInput.test.js +183 -0
- package/password-input/types.d.ts +107 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.js +4 -4
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/ProgressBar.test.js +65 -0
- package/radio/Radio.js +2 -2
- package/radio/Radio.test.js +71 -0
- package/radio/types.d.ts +2 -2
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +141 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +279 -0
- package/radio-group/RadioGroup.stories.tsx +96 -0
- package/radio-group/RadioGroup.test.js +694 -0
- package/radio-group/types.d.ts +37 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +9 -29
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/ResultsetTable.test.js +306 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +26 -22
- package/select/Select.stories.tsx +582 -0
- package/select/Select.test.js +1900 -0
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +6 -15
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/sidenav/Sidenav.test.js +56 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +43 -32
- package/slider/Slider.stories.tsx +177 -0
- package/slider/Slider.test.js +129 -0
- package/slider/types.d.ts +2 -7
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +2 -19
- package/spinner/Spinner.stories.jsx +1 -0
- package/spinner/Spinner.test.js +64 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.js +4 -4
- package/switch/Switch.stories.tsx +160 -0
- package/switch/Switch.test.js +73 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +2 -1
- package/table/Table.test.js +26 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.js +11 -9
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/Tabs.test.js +123 -0
- package/tabs/types.d.ts +25 -18
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +26 -46
- package/tag/Tag.stories.tsx +138 -0
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +59 -88
- package/text-input/TextInput.stories.tsx +474 -0
- package/text-input/TextInput.test.js +1691 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +32 -63
- package/textarea/Textarea.stories.jsx +34 -12
- package/textarea/Textarea.test.js +436 -0
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +16 -45
- package/toggle-group/ToggleGroup.stories.tsx +173 -0
- package/toggle-group/ToggleGroup.test.js +125 -0
- package/toggle-group/types.d.ts +97 -0
- package/toggle-group/types.js +5 -0
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +69 -59
- package/wizard/Wizard.stories.tsx +224 -0
- package/wizard/Wizard.test.js +128 -0
- package/wizard/types.d.ts +60 -0
- package/wizard/types.js +5 -0
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/box/index.d.ts +0 -25
- package/chip/index.d.ts +0 -22
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/file-input/index.d.ts +0 -81
- package/heading/index.d.ts +0 -17
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/toggle-group/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
package/footer/Footer.js
CHANGED
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -21,13 +21,13 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
21
21
|
|
|
22
22
|
var _variables = require("../common/variables.js");
|
|
23
23
|
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
|
-
var _BackgroundColorContext = require("../BackgroundColorContext
|
|
26
|
+
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
27
27
|
|
|
28
|
-
var _Icons =
|
|
28
|
+
var _Icons = require("./Icons");
|
|
29
29
|
|
|
30
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
30
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14;
|
|
31
31
|
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
|
|
@@ -37,7 +37,7 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
37
37
|
var socialLinks = _ref.socialLinks,
|
|
38
38
|
bottomLinks = _ref.bottomLinks,
|
|
39
39
|
_ref$copyright = _ref.copyright,
|
|
40
|
-
copyright = _ref$copyright === void 0 ? "" : _ref$copyright,
|
|
40
|
+
copyright = _ref$copyright === void 0 ? "\xA9 DXC Technology ".concat(new Date().getFullYear(), ". All rights reserved.") : _ref$copyright,
|
|
41
41
|
children = _ref.children,
|
|
42
42
|
padding = _ref.padding,
|
|
43
43
|
margin = _ref.margin,
|
|
@@ -63,7 +63,7 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
63
63
|
var colorsTheme = (0, _useTheme["default"])();
|
|
64
64
|
var footerLogo = (0, _react.useMemo)(function () {
|
|
65
65
|
if (!colorsTheme.footer.logo) {
|
|
66
|
-
return _Icons
|
|
66
|
+
return _Icons.dxcLogo;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (typeof colorsTheme.footer.logo === "string") {
|
|
@@ -110,9 +110,9 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
110
110
|
key: "social".concat(index).concat(link.href),
|
|
111
111
|
index: index,
|
|
112
112
|
href: link && link.href ? link.href : ""
|
|
113
|
-
},
|
|
114
|
-
src: link.
|
|
115
|
-
}));
|
|
113
|
+
}, /*#__PURE__*/_react["default"].createElement(SocialIconContainer, null, typeof link.logo === "string" ? /*#__PURE__*/_react["default"].createElement(SocialIconImg, {
|
|
114
|
+
src: link.logo
|
|
115
|
+
}) : link.logo));
|
|
116
116
|
});
|
|
117
117
|
var bottomLink = bottomLinks === null || bottomLinks === void 0 ? void 0 : bottomLinks.map(function (link, index) {
|
|
118
118
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -130,19 +130,17 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
130
130
|
margin: margin,
|
|
131
131
|
refSize: refSize,
|
|
132
132
|
ref: ref
|
|
133
|
-
}, /*#__PURE__*/_react["default"].createElement(FooterHeader,
|
|
134
|
-
className: "footerFooter",
|
|
133
|
+
}, /*#__PURE__*/_react["default"].createElement(FooterHeader, {
|
|
135
134
|
refSize: refSize
|
|
136
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
137
|
-
refSize: refSize
|
|
138
|
-
}, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, {
|
|
135
|
+
}, /*#__PURE__*/_react["default"].createElement(LogoContainer, null, footerLogo), /*#__PURE__*/_react["default"].createElement(SocialLinkContainer, {
|
|
139
136
|
refSize: refSize
|
|
140
|
-
},
|
|
137
|
+
}, socialLink)), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(ChildComponents, {
|
|
141
138
|
padding: padding
|
|
142
139
|
}, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
143
140
|
color: colorsTheme.footer.backgroundColor
|
|
144
141
|
}, children)), /*#__PURE__*/_react["default"].createElement(FooterFooter, {
|
|
145
|
-
className: "footerFooter"
|
|
142
|
+
className: "footerFooter",
|
|
143
|
+
refSize: refSize
|
|
146
144
|
}, /*#__PURE__*/_react["default"].createElement(BottomLinks, {
|
|
147
145
|
refSize: refSize
|
|
148
146
|
}, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, {
|
|
@@ -160,9 +158,9 @@ var FooterContainer = _styledComponents["default"].footer(_templateObject || (_t
|
|
|
160
158
|
return props.theme.height;
|
|
161
159
|
});
|
|
162
160
|
|
|
163
|
-
var FooterHeader = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n"])));
|
|
161
|
+
var FooterHeader = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n row-gap: 24px;\n"])));
|
|
164
162
|
|
|
165
|
-
var FooterFooter = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n flex-direction: ", ";\n align-items: ", ";\n border-top: ", ";\n"])), function (props) {
|
|
163
|
+
var FooterFooter = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n flex-direction: ", ";\n align-items: ", ";\n border-top: ", ";\n margin-top: 16px;\n"])), function (props) {
|
|
166
164
|
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "column" : "row";
|
|
167
165
|
}, function (props) {
|
|
168
166
|
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "center" : "";
|
|
@@ -170,17 +168,15 @@ var FooterFooter = _styledComponents["default"].div(_templateObject3 || (_templa
|
|
|
170
168
|
return "".concat(props.theme.bottomLinksDividerThickness, " ").concat(props.theme.bottomLinksDividerStyle, " ").concat(props.theme.bottomLinksDividerColor);
|
|
171
169
|
});
|
|
172
170
|
|
|
173
|
-
var BottomLinks = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n display: inline-flex;\n flex-wrap: wrap;\n max-width: ", ";\n width: ", ";\n & > span:last-child span {\n display: none;\n }\n
|
|
171
|
+
var BottomLinks = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n display: inline-flex;\n flex-wrap: wrap;\n max-width: ", ";\n width: ", ";\n & > span:last-child span {\n display: none;\n }\n align-self: center;\n"])), function (props) {
|
|
174
172
|
return props.theme.bottomLinksDividerSpacing;
|
|
175
173
|
}, function (props) {
|
|
176
174
|
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "60%";
|
|
177
175
|
}, function (props) {
|
|
178
176
|
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "";
|
|
179
|
-
}, function (props) {
|
|
180
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "40px 0 40px 0" : "";
|
|
181
177
|
});
|
|
182
178
|
|
|
183
|
-
var ChildComponents = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n min-height:
|
|
179
|
+
var ChildComponents = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 16px;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n overflow: hidden;\n"])), function (props) {
|
|
184
180
|
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
185
181
|
}, function (props) {
|
|
186
182
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
@@ -207,7 +203,7 @@ var Copyright = _styledComponents["default"].div(_templateObject6 || (_templateO
|
|
|
207
203
|
}, function (props) {
|
|
208
204
|
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "";
|
|
209
205
|
}, function (props) {
|
|
210
|
-
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "
|
|
206
|
+
return props.refSize <= _variables.responsiveSizes.mobileLarge ? "left" : "right";
|
|
211
207
|
}, function (props) {
|
|
212
208
|
return props.theme.bottomLinksDividerSpacing;
|
|
213
209
|
});
|
|
@@ -224,19 +220,15 @@ var LogoImg = _styledComponents["default"].img(_templateObject8 || (_templateObj
|
|
|
224
220
|
return props.theme.logoWidth;
|
|
225
221
|
});
|
|
226
222
|
|
|
227
|
-
var
|
|
223
|
+
var SocialLinkContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-self: center;\n"])));
|
|
224
|
+
|
|
225
|
+
var SocialAnchor = _styledComponents["default"].a(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n margin-left: ", ";\n }\n"])), function (props) {
|
|
228
226
|
return props.index === 0 ? "0px" : props.theme.socialLinksGutter;
|
|
229
227
|
});
|
|
230
228
|
|
|
231
|
-
var
|
|
232
|
-
return props.theme.socialLinksSize;
|
|
233
|
-
}, function (props) {
|
|
234
|
-
return props.theme.socialLinksSize;
|
|
235
|
-
}, function (props) {
|
|
236
|
-
return props.theme.socialLinksColor;
|
|
237
|
-
});
|
|
229
|
+
var SocialIconImg = _styledComponents["default"].img(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
238
230
|
|
|
239
|
-
var SocialIconContainer = _styledComponents["default"].div(
|
|
231
|
+
var SocialIconContainer = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n color: ", ";\n }\n\n overflow: hidden;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
240
232
|
return props.theme.socialLinksSize;
|
|
241
233
|
}, function (props) {
|
|
242
234
|
return props.theme.socialLinksSize;
|
|
@@ -244,11 +236,11 @@ var SocialIconContainer = _styledComponents["default"].div(_templateObject11 ||
|
|
|
244
236
|
return props.theme.socialLinksColor;
|
|
245
237
|
});
|
|
246
238
|
|
|
247
|
-
var Point = _styledComponents["default"].span(
|
|
239
|
+
var Point = _styledComponents["default"].span(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px 10px;\n color: ", ";\n"])), function (props) {
|
|
248
240
|
return props.theme.bottomLinksFontColor;
|
|
249
241
|
});
|
|
250
242
|
|
|
251
|
-
var BottomLink = _styledComponents["default"].a(
|
|
243
|
+
var BottomLink = _styledComponents["default"].a(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
252
244
|
return props.theme.bottomLinksTextDecoration;
|
|
253
245
|
}, function (props) {
|
|
254
246
|
return props.theme.bottomLinksFontColor;
|
|
@@ -28,28 +28,7 @@ const social = [
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
href: "https://twitter.com/dxctechnology",
|
|
31
|
-
logo:
|
|
32
|
-
<svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 438.536 438.536" fill="currentColor">
|
|
33
|
-
<g>
|
|
34
|
-
<path
|
|
35
|
-
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
36
|
-
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
37
|
-
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
38
|
-
C438.532,59.576,430.49,40.204,414.41,24.123z M335.471,168.735c0.191,1.713,0.288,4.278,0.288,7.71
|
|
39
|
-
c0,15.989-2.334,32.025-6.995,48.104c-4.661,16.087-11.8,31.504-21.416,46.254c-9.606,14.749-21.074,27.791-34.396,39.115
|
|
40
|
-
c-13.325,11.32-29.311,20.365-47.968,27.117c-18.648,6.762-38.637,10.143-59.953,10.143c-33.116,0-63.76-8.952-91.931-26.836
|
|
41
|
-
c4.568,0.568,9.329,0.855,14.275,0.855c27.6,0,52.439-8.565,74.519-25.7c-12.941-0.185-24.506-4.179-34.688-11.991
|
|
42
|
-
c-10.185-7.803-17.273-17.699-21.271-29.691c4.947,0.76,8.658,1.137,11.132,1.137c4.187,0,9.042-0.76,14.56-2.279
|
|
43
|
-
c-13.894-2.669-25.598-9.562-35.115-20.697c-9.519-11.136-14.277-23.84-14.277-38.114v-0.571
|
|
44
|
-
c10.085,4.755,19.602,7.229,28.549,7.422c-17.321-11.613-25.981-28.265-25.981-49.963c0-10.66,2.758-20.747,8.278-30.264
|
|
45
|
-
c15.035,18.464,33.311,33.213,54.816,44.252c21.507,11.038,44.54,17.227,69.092,18.558c-0.95-3.616-1.427-8.186-1.427-13.704
|
|
46
|
-
c0-16.562,5.853-30.692,17.56-42.399c11.703-11.706,25.837-17.561,42.394-17.561c17.515,0,32.079,6.283,43.688,18.846
|
|
47
|
-
c13.134-2.474,25.892-7.33,38.26-14.56c-4.757,14.652-13.613,25.788-26.55,33.402c12.368-1.716,23.88-4.95,34.537-9.708
|
|
48
|
-
C357.458,149.793,347.462,160.166,335.471,168.735z"
|
|
49
|
-
/>
|
|
50
|
-
</g>
|
|
51
|
-
</svg>
|
|
52
|
-
),
|
|
31
|
+
logo: "http://assets.stickpng.com/images/580b57fcd9996e24bc43c53e.png",
|
|
53
32
|
},
|
|
54
33
|
{
|
|
55
34
|
href: "https://www.facebook.com/DXCTechnology/",
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _linkedin = _interopRequireDefault(require("../../app/src/images/linkedin.svg"));
|
|
10
|
+
|
|
11
|
+
var _Footer = _interopRequireDefault(require("./Footer"));
|
|
12
|
+
|
|
13
|
+
describe("Footer component tests", function () {
|
|
14
|
+
test("Footer renders with default logo", function () {
|
|
15
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], null)),
|
|
16
|
+
getByTitle = _render.getByTitle;
|
|
17
|
+
|
|
18
|
+
expect(getByTitle("DXC Logo")).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
test("Footer renders with social links", function () {
|
|
21
|
+
var social = [{
|
|
22
|
+
href: "https://www.test.com/test",
|
|
23
|
+
logo: _linkedin["default"]
|
|
24
|
+
}];
|
|
25
|
+
|
|
26
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
27
|
+
socialLinks: social
|
|
28
|
+
})),
|
|
29
|
+
getByRole = _render2.getByRole;
|
|
30
|
+
|
|
31
|
+
var socialIcon = getByRole("link");
|
|
32
|
+
expect(socialIcon.getAttribute("href")).toBe("https://www.test.com/test");
|
|
33
|
+
});
|
|
34
|
+
test("Footer renders with bottom links", function () {
|
|
35
|
+
var bottom = [{
|
|
36
|
+
href: "https://www.test.com/test",
|
|
37
|
+
text: "bottom-link-text"
|
|
38
|
+
}];
|
|
39
|
+
|
|
40
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
41
|
+
bottomLinks: bottom
|
|
42
|
+
})),
|
|
43
|
+
getByText = _render3.getByText;
|
|
44
|
+
|
|
45
|
+
var link = getByText("bottom-link-text");
|
|
46
|
+
expect(link.getAttribute("href")).toBe("https://www.test.com/test");
|
|
47
|
+
});
|
|
48
|
+
test("Footer renders with copyright text", function () {
|
|
49
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
50
|
+
copyright: "test-copyright"
|
|
51
|
+
})),
|
|
52
|
+
getByText = _render4.getByText;
|
|
53
|
+
|
|
54
|
+
expect(getByText("test-copyright")).toBeTruthy();
|
|
55
|
+
});
|
|
56
|
+
test("Footer renders with correct children", function () {
|
|
57
|
+
//We need to force the offsetWidth value
|
|
58
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
59
|
+
configurable: true,
|
|
60
|
+
value: 1024
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], null, /*#__PURE__*/_react["default"].createElement("p", null, "footer-child-text"))),
|
|
64
|
+
getByText = _render5.getByText;
|
|
65
|
+
|
|
66
|
+
expect(getByText("footer-child-text")).toBeTruthy();
|
|
67
|
+
});
|
|
68
|
+
test("Footer renders with children in mobile", function () {
|
|
69
|
+
//425 is mobile width
|
|
70
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
71
|
+
configurable: true,
|
|
72
|
+
value: 425
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], null, /*#__PURE__*/_react["default"].createElement("p", null, "footer-child-text"))),
|
|
76
|
+
queryByText = _render6.queryByText;
|
|
77
|
+
|
|
78
|
+
expect(queryByText("footer-child-text")).toBeTruthy();
|
|
79
|
+
});
|
|
80
|
+
test("Footer is fully rendered", function () {
|
|
81
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
82
|
+
configurable: true,
|
|
83
|
+
value: 1024
|
|
84
|
+
});
|
|
85
|
+
var social = [{
|
|
86
|
+
href: "https://www.test.com/social",
|
|
87
|
+
logo: _linkedin["default"]
|
|
88
|
+
}];
|
|
89
|
+
var bottom = [{
|
|
90
|
+
href: "https://www.test.com/bottom",
|
|
91
|
+
text: "bottom-link-text"
|
|
92
|
+
}];
|
|
93
|
+
|
|
94
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
95
|
+
socialLinks: social,
|
|
96
|
+
bottomLinks: bottom,
|
|
97
|
+
copyright: "test-copyright"
|
|
98
|
+
}, /*#__PURE__*/_react["default"].createElement("p", null, "footer-child-text"))),
|
|
99
|
+
getAllByRole = _render7.getAllByRole,
|
|
100
|
+
getByText = _render7.getByText;
|
|
101
|
+
|
|
102
|
+
var socialIcon = getAllByRole("link")[0];
|
|
103
|
+
expect(socialIcon.getAttribute("href")).toBe("https://www.test.com/social");
|
|
104
|
+
var bottomLink = getByText("bottom-link-text");
|
|
105
|
+
expect(bottomLink.getAttribute("href")).toBe("https://www.test.com/bottom");
|
|
106
|
+
expect(getByText("test-copyright")).toBeTruthy();
|
|
107
|
+
expect(getByText("footer-child-text")).toBeTruthy();
|
|
108
|
+
});
|
|
109
|
+
});
|
package/footer/Icons.js
CHANGED
|
@@ -5,11 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports.dxcLogo = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
13
13
|
id: "g10",
|
|
14
14
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15
15
|
width: "280.781",
|
|
@@ -74,4 +74,4 @@ var _default = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
74
74
|
fill: "#fff"
|
|
75
75
|
})));
|
|
76
76
|
|
|
77
|
-
exports
|
|
77
|
+
exports.dxcLogo = dxcLogo;
|
package/footer/types.d.ts
CHANGED
|
@@ -6,39 +6,43 @@ declare type Size = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
9
10
|
declare type SocialLink = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Element used as the icon for the link.
|
|
13
|
+
*/
|
|
14
|
+
logo: string | SVG;
|
|
15
|
+
/**
|
|
16
|
+
* URL of the page the link goes to.
|
|
17
|
+
*/
|
|
18
|
+
href: string;
|
|
13
19
|
};
|
|
14
20
|
declare type BottomLink = {
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Text for the link.
|
|
23
|
+
*/
|
|
24
|
+
text: string;
|
|
25
|
+
/**
|
|
26
|
+
* URL of the page the link goes to.
|
|
27
|
+
*/
|
|
28
|
+
href: string;
|
|
17
29
|
};
|
|
18
|
-
declare type ImgElement = HTMLElement & (SVGElement | HTMLImageElement);
|
|
19
30
|
declare type FooterPropsType = {
|
|
20
31
|
/**
|
|
21
32
|
* An array of objects representing the links that will be rendered as
|
|
22
|
-
* icons at the top-right side of the footer.
|
|
23
|
-
* following properties:
|
|
24
|
-
* - logo: Element used as the icon for the link.
|
|
25
|
-
* - logoSrc: The path of an icon for the link. @deprecated
|
|
26
|
-
* - href: URL of the page the link goes to.
|
|
33
|
+
* icons at the top-right side of the footer.
|
|
27
34
|
*/
|
|
28
|
-
socialLinks?:
|
|
35
|
+
socialLinks?: SocialLink[];
|
|
29
36
|
/**
|
|
30
37
|
* An array of objects representing the links that will be rendered at
|
|
31
|
-
* the bottom part of the footer.
|
|
32
|
-
* properties:
|
|
33
|
-
* - text: Text for the link.
|
|
34
|
-
* - href: URL of the page the link goes to.
|
|
38
|
+
* the bottom part of the footer.
|
|
35
39
|
*/
|
|
36
|
-
bottomLinks?:
|
|
40
|
+
bottomLinks?: BottomLink[];
|
|
37
41
|
/**
|
|
38
42
|
* The center section of the footer. Can be used to render custom
|
|
39
43
|
* content in this area.
|
|
40
44
|
*/
|
|
41
|
-
children
|
|
45
|
+
children?: React.ReactNode;
|
|
42
46
|
/**
|
|
43
47
|
* The text that will be displayed as copyright disclaimer.
|
|
44
48
|
*/
|
package/header/Header.js
CHANGED
|
@@ -27,9 +27,9 @@ var _Icons = require("./Icons");
|
|
|
27
27
|
|
|
28
28
|
var _variables = require("../common/variables.js");
|
|
29
29
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
30
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
|
-
var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext
|
|
32
|
+
var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext"));
|
|
33
33
|
|
|
34
34
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
|
35
35
|
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcHeader from "./Header";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { userEvent, waitFor, within } from "@storybook/testing-library";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Header",
|
|
9
|
+
component: DxcHeader,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const options: any = [
|
|
13
|
+
{
|
|
14
|
+
value: 1,
|
|
15
|
+
label: "Amazon",
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export const Chromatic = () => (
|
|
20
|
+
<>
|
|
21
|
+
<ExampleContainer>
|
|
22
|
+
<Title title="Default with dropdown" theme="light" level={4} />
|
|
23
|
+
<DxcHeader content={<DxcHeader.Dropdown options={options} label="Default Dropdown" />} />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Underlined with text" theme="light" level={4} />
|
|
27
|
+
<DxcHeader underlined content={<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>} />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
31
|
+
<div style={{ width: "400px" }}>
|
|
32
|
+
<DxcHeader
|
|
33
|
+
responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
|
|
34
|
+
underlined
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
<Title title="Margins" theme="light" level={2} />
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
41
|
+
<DxcHeader underlined margin="xxsmall" />
|
|
42
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
43
|
+
</ExampleContainer>
|
|
44
|
+
<ExampleContainer>
|
|
45
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
46
|
+
<DxcHeader underlined margin="xsmall" />
|
|
47
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
51
|
+
<DxcHeader underlined margin="small" />
|
|
52
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
56
|
+
<DxcHeader underlined margin="medium" />
|
|
57
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
58
|
+
</ExampleContainer>
|
|
59
|
+
<ExampleContainer>
|
|
60
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
61
|
+
<DxcHeader underlined margin="large" />
|
|
62
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
63
|
+
</ExampleContainer>
|
|
64
|
+
<ExampleContainer>
|
|
65
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
66
|
+
<DxcHeader underlined margin="xlarge" />
|
|
67
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
68
|
+
</ExampleContainer>
|
|
69
|
+
<ExampleContainer>
|
|
70
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
71
|
+
<DxcHeader underlined margin="xxlarge" />
|
|
72
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
|
|
75
|
+
<Title title="Paddings" theme="light" level={2} />
|
|
76
|
+
<ExampleContainer>
|
|
77
|
+
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
78
|
+
<DxcHeader underlined padding="xxsmall" />
|
|
79
|
+
</ExampleContainer>
|
|
80
|
+
<ExampleContainer>
|
|
81
|
+
<Title title="Xsmall padding" theme="light" level={4} />
|
|
82
|
+
<DxcHeader underlined padding="xsmall" />
|
|
83
|
+
</ExampleContainer>
|
|
84
|
+
<ExampleContainer>
|
|
85
|
+
<Title title="Small padding" theme="light" level={4} />
|
|
86
|
+
<DxcHeader underlined padding="small" />
|
|
87
|
+
</ExampleContainer>
|
|
88
|
+
<ExampleContainer>
|
|
89
|
+
<Title title="Medium padding" theme="light" level={4} />
|
|
90
|
+
<DxcHeader underlined padding="medium" />
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Large padding" theme="light" level={4} />
|
|
94
|
+
<DxcHeader underlined padding="large" />
|
|
95
|
+
</ExampleContainer>
|
|
96
|
+
<ExampleContainer>
|
|
97
|
+
<Title title="Xlarge padding" theme="light" level={4} />
|
|
98
|
+
<DxcHeader underlined padding="xlarge" />
|
|
99
|
+
</ExampleContainer>
|
|
100
|
+
<ExampleContainer>
|
|
101
|
+
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
102
|
+
<DxcHeader underlined padding="xxlarge" />
|
|
103
|
+
</ExampleContainer>
|
|
104
|
+
</>
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const RespHeader = () => (
|
|
108
|
+
<ExampleContainer>
|
|
109
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
110
|
+
<div style={{ maxWidth: "400px" }}>
|
|
111
|
+
<DxcHeader
|
|
112
|
+
responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
|
|
113
|
+
underlined
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
</ExampleContainer>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const RespHeaderFocus = () => (
|
|
120
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
121
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
122
|
+
<div style={{ maxWidth: "400px" }}>
|
|
123
|
+
<DxcHeader
|
|
124
|
+
responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
|
|
125
|
+
underlined
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
</ExampleContainer>
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const RespHeaderHover = () => (
|
|
132
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
133
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
134
|
+
<div style={{ maxWidth: "400px" }}>
|
|
135
|
+
<DxcHeader
|
|
136
|
+
responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
|
|
137
|
+
underlined
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
</ExampleContainer>
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
export const ResponsiveHeader = RespHeader.bind({});
|
|
144
|
+
ResponsiveHeader.play = async ({ canvasElement }) => {
|
|
145
|
+
const canvas = within(canvasElement);
|
|
146
|
+
await waitFor(() => canvas.findByText("Menu"));
|
|
147
|
+
await userEvent.click(canvas.getByText("Menu"));
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const ResponsiveHeaderFocus = RespHeaderFocus.bind({});
|
|
151
|
+
ResponsiveHeaderFocus.play = async ({ canvasElement }) => {
|
|
152
|
+
const canvas = within(canvasElement);
|
|
153
|
+
await waitFor(() => canvas.findByText("Menu"));
|
|
154
|
+
await userEvent.click(canvas.getByText("Menu"));
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const ResponsiveHeaderHover = RespHeaderHover.bind({});
|
|
158
|
+
ResponsiveHeaderHover.play = async ({ canvasElement }) => {
|
|
159
|
+
const canvas = within(canvasElement);
|
|
160
|
+
await waitFor(() => canvas.findByText("Menu"));
|
|
161
|
+
await userEvent.click(canvas.getByText("Menu"));
|
|
162
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _Header = _interopRequireDefault(require("./Header"));
|
|
10
|
+
|
|
11
|
+
var _linkedin = _interopRequireDefault(require("../../app/src/images/linkedin.svg"));
|
|
12
|
+
|
|
13
|
+
describe("Header component tests", function () {
|
|
14
|
+
test("Header renders with default logo", function () {
|
|
15
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], null)),
|
|
16
|
+
getByTitle = _render.getByTitle;
|
|
17
|
+
|
|
18
|
+
expect(getByTitle("DXC Logo")).toBeTruthy();
|
|
19
|
+
});
|
|
20
|
+
test("Call correct function on logo click", function () {
|
|
21
|
+
var onClick = jest.fn();
|
|
22
|
+
|
|
23
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
24
|
+
onClick: onClick
|
|
25
|
+
})),
|
|
26
|
+
getByTitle = _render2.getByTitle;
|
|
27
|
+
|
|
28
|
+
var logo = getByTitle("DXC Logo");
|
|
29
|
+
|
|
30
|
+
_react2.fireEvent.click(logo);
|
|
31
|
+
|
|
32
|
+
expect(onClick).toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
test("Header renders with correct children", function () {
|
|
35
|
+
// We need to force the offsetWidth value
|
|
36
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
37
|
+
configurable: true,
|
|
38
|
+
value: 1024
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
42
|
+
content: /*#__PURE__*/_react["default"].createElement("p", null, "header-child-text")
|
|
43
|
+
})),
|
|
44
|
+
getByText = _render3.getByText;
|
|
45
|
+
|
|
46
|
+
expect(getByText("header-child-text")).toBeTruthy();
|
|
47
|
+
});
|
|
48
|
+
test("Header renders menu button in mobile", function () {
|
|
49
|
+
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
50
|
+
configurable: true,
|
|
51
|
+
value: 425
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
55
|
+
responsiveContent: function responsiveContent(closeMenu) {
|
|
56
|
+
return /*#__PURE__*/_react["default"].createElement("p", null, "header-child-text");
|
|
57
|
+
}
|
|
58
|
+
})),
|
|
59
|
+
getByText = _render4.getByText;
|
|
60
|
+
|
|
61
|
+
expect(getByText("Menu")).toBeTruthy();
|
|
62
|
+
});
|
|
63
|
+
});
|
package/header/types.d.ts
CHANGED
|
@@ -27,11 +27,13 @@ declare type Props = {
|
|
|
27
27
|
*/
|
|
28
28
|
onClick?: () => void;
|
|
29
29
|
/**
|
|
30
|
-
* Size of the bottom margin to be applied to the header
|
|
30
|
+
* Size of the bottom margin to be applied to the header
|
|
31
|
+
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
31
32
|
*/
|
|
32
33
|
margin?: Space;
|
|
33
34
|
/**
|
|
34
|
-
* Size of the padding to be applied to the custom area of the component
|
|
35
|
+
* Size of the padding to be applied to the custom area of the component
|
|
36
|
+
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
35
37
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
|
|
36
38
|
* order to specify different padding sizes.
|
|
37
39
|
*/
|