@dxc-technology/halstack-react 0.0.0-5168fa4 → 0.0.0-51a5c42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +1 -1
  2. package/babel.config.js +6 -2
  3. package/dist/BackgroundColorContext.js +46 -0
  4. package/dist/ThemeContext.js +235 -2
  5. package/dist/V3Textarea/V3Textarea.js +264 -0
  6. package/dist/accordion/Accordion.js +170 -81
  7. package/dist/accordion-group/AccordionGroup.js +186 -0
  8. package/dist/alert/Alert.js +184 -83
  9. package/dist/alert/index.d.ts +51 -0
  10. package/dist/badge/Badge.js +63 -0
  11. package/dist/box/Box.js +31 -23
  12. package/dist/button/Button.js +82 -27
  13. package/dist/card/Card.js +64 -56
  14. package/dist/checkbox/Checkbox.js +108 -32
  15. package/dist/chip/Chip.js +135 -40
  16. package/dist/common/RequiredComponent.js +2 -8
  17. package/dist/common/utils.js +2 -22
  18. package/dist/common/variables.js +1471 -134
  19. package/dist/date/Date.js +97 -62
  20. package/dist/date-input/DateInput.js +400 -0
  21. package/dist/date-input/index.d.ts +95 -0
  22. package/dist/dialog/Dialog.js +61 -36
  23. package/dist/dropdown/Dropdown.js +226 -94
  24. package/dist/file-input/FileInput.js +644 -0
  25. package/dist/file-input/FileItem.js +280 -0
  26. package/dist/file-input/index.d.ts +81 -0
  27. package/dist/footer/Footer.js +90 -36
  28. package/dist/footer/dxc_logo.svg +15 -0
  29. package/dist/footer/readme.md +1 -1
  30. package/dist/header/Header.js +173 -89
  31. package/dist/header/Icons.js +59 -0
  32. package/dist/heading/Heading.js +81 -22
  33. package/dist/input-text/InputText.js +292 -104
  34. package/dist/layout/ApplicationLayout.js +331 -0
  35. package/dist/layout/facebook.svg +45 -0
  36. package/dist/layout/linkedin.svg +50 -0
  37. package/dist/layout/twitter.svg +53 -0
  38. package/dist/link/Link.js +142 -34
  39. package/dist/main.d.ts +8 -0
  40. package/dist/main.js +111 -7
  41. package/dist/new-select/NewSelect.js +836 -0
  42. package/dist/new-select/index.d.ts +53 -0
  43. package/dist/number-input/NumberInput.js +136 -0
  44. package/dist/number-input/NumberInputContext.js +16 -0
  45. package/dist/number-input/index.d.ts +113 -0
  46. package/dist/paginator/Paginator.js +160 -49
  47. package/dist/password-input/PasswordInput.js +198 -0
  48. package/dist/password-input/index.d.ts +94 -0
  49. package/dist/progress-bar/ProgressBar.js +97 -44
  50. package/dist/radio/Radio.js +39 -21
  51. package/dist/resultsetTable/ResultsetTable.js +93 -69
  52. package/dist/select/Select.js +250 -143
  53. package/dist/sidenav/Sidenav.js +87 -125
  54. package/dist/slider/Slider.js +206 -70
  55. package/dist/spinner/Spinner.js +249 -64
  56. package/dist/switch/Switch.js +52 -25
  57. package/dist/table/Table.js +63 -15
  58. package/dist/tabs/Tabs.js +208 -35
  59. package/dist/tabs-for-sections/TabsForSections.js +1 -16
  60. package/dist/tag/Tag.js +100 -35
  61. package/dist/text-input/TextInput.js +971 -0
  62. package/dist/text-input/index.d.ts +135 -0
  63. package/dist/textarea/Textarea.js +250 -107
  64. package/dist/textarea/index.d.ts +117 -0
  65. package/dist/toggle/Toggle.js +16 -19
  66. package/dist/toggle-group/ToggleGroup.js +327 -0
  67. package/dist/upload/Upload.js +16 -11
  68. package/dist/upload/buttons-upload/ButtonsUpload.js +34 -20
  69. package/dist/upload/dragAndDropArea/DragAndDropArea.js +78 -31
  70. package/dist/upload/file-upload/FileToUpload.js +50 -24
  71. package/dist/upload/files-upload/FilesToUpload.js +16 -16
  72. package/dist/upload/readme.md +2 -2
  73. package/dist/upload/transaction/Transaction.js +44 -24
  74. package/dist/upload/transactions/Transactions.js +38 -20
  75. package/dist/useTheme.js +22 -0
  76. package/dist/wizard/Wizard.js +156 -55
  77. package/dist/wizard/invalid_icon.svg +4 -5
  78. package/dist/wizard/valid_icon.svg +4 -5
  79. package/package.json +14 -6
  80. package/test/AccordionGroup.test.js +125 -0
  81. package/test/Date.test.js +49 -45
  82. package/test/DateInput.test.js +242 -0
  83. package/test/Dropdown.test.js +19 -4
  84. package/test/FileInput.test.js +201 -0
  85. package/test/Header.test.js +5 -10
  86. package/test/InputText.test.js +53 -41
  87. package/test/Link.test.js +25 -7
  88. package/test/NumberInput.test.js +259 -0
  89. package/test/Paginator.test.js +72 -60
  90. package/test/PasswordInput.test.js +83 -0
  91. package/test/ResultsetTable.test.js +66 -19
  92. package/test/Select.test.js +55 -34
  93. package/test/Sidenav.test.js +22 -64
  94. package/test/Slider.test.js +17 -0
  95. package/test/Spinner.test.js +5 -0
  96. package/test/Tabs.test.js +21 -0
  97. package/test/TextInput.test.js +732 -0
  98. package/test/Textarea.test.js +193 -0
  99. package/test/ToggleGroup.test.js +85 -0
  100. package/test/Upload.test.js +5 -5
  101. package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
  102. package/dist/accordion/Accordion.stories.js +0 -207
  103. package/dist/accordion/readme.md +0 -96
  104. package/dist/alert/Alert.stories.js +0 -158
  105. package/dist/alert/close.svg +0 -4
  106. package/dist/alert/error.svg +0 -4
  107. package/dist/alert/info.svg +0 -4
  108. package/dist/alert/readme.md +0 -43
  109. package/dist/alert/success.svg +0 -4
  110. package/dist/alert/warning.svg +0 -4
  111. package/dist/button/Button.stories.js +0 -224
  112. package/dist/button/readme.md +0 -93
  113. package/dist/common/services/example-service.js +0 -10
  114. package/dist/common/services/example-service.test.js +0 -12
  115. package/dist/date/calendar.svg +0 -1
  116. package/dist/date/calendar_dark.svg +0 -1
  117. package/dist/dialog/Dialog.stories.js +0 -217
  118. package/dist/dialog/readme.md +0 -32
  119. package/dist/dropdown/Dropdown.stories.js +0 -249
  120. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  121. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  122. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  123. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  124. package/dist/dropdown/readme.md +0 -69
  125. package/dist/footer/Footer.stories.js +0 -94
  126. package/dist/footer/dxc_logo_wht.png +0 -0
  127. package/dist/header/Header.stories.js +0 -176
  128. package/dist/header/close_icon.svg +0 -1
  129. package/dist/header/dxc_logo_black.png +0 -0
  130. package/dist/header/dxc_logo_white.png +0 -0
  131. package/dist/header/hamb_menu_black.svg +0 -1
  132. package/dist/header/hamb_menu_white.svg +0 -1
  133. package/dist/header/readme.md +0 -33
  134. package/dist/input-text/InputText.stories.js +0 -209
  135. package/dist/select/Select.stories.js +0 -235
  136. package/dist/select/readme.md +0 -72
  137. package/dist/sidenav/arrow_icon.svg +0 -3
  138. package/dist/slider/Slider.stories.js +0 -241
  139. package/test/Toggle.test.js +0 -43
@@ -0,0 +1,280 @@
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 _useTheme = _interopRequireDefault(require("../useTheme.js"));
21
+
22
+ function _templateObject10() {
23
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
24
+
25
+ _templateObject10 = function _templateObject10() {
26
+ return data;
27
+ };
28
+
29
+ return data;
30
+ }
31
+
32
+ function _templateObject9() {
33
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 4px;\n margin-left: 4px;\n background-color: transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n"]);
34
+
35
+ _templateObject9 = function _templateObject9() {
36
+ return data;
37
+ };
38
+
39
+ return data;
40
+ }
41
+
42
+ function _templateObject8() {
43
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\n"]);
44
+
45
+ _templateObject8 = function _templateObject8() {
46
+ return data;
47
+ };
48
+
49
+ return data;
50
+ }
51
+
52
+ function _templateObject7() {
53
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n width: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
54
+
55
+ _templateObject7 = function _templateObject7() {
56
+ return data;
57
+ };
58
+
59
+ return data;
60
+ }
61
+
62
+ function _templateObject6() {
63
+ var data = (0, _taggedTemplateLiteral2["default"])([""]);
64
+
65
+ _templateObject6 = function _templateObject6() {
66
+ return data;
67
+ };
68
+
69
+ return data;
70
+ }
71
+
72
+ function _templateObject5() {
73
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n background-color: ", ";\n width: 48px;\n height: 48px;\n border-radius: 2px;\n color: ", ";\n"]);
74
+
75
+ _templateObject5 = function _templateObject5() {
76
+ return data;
77
+ };
78
+
79
+ return data;
80
+ }
81
+
82
+ function _templateObject4() {
83
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"]);
84
+
85
+ _templateObject4 = function _templateObject4() {
86
+ return data;
87
+ };
88
+
89
+ return data;
90
+ }
91
+
92
+ function _templateObject3() {
93
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"]);
94
+
95
+ _templateObject3 = function _templateObject3() {
96
+ return data;
97
+ };
98
+
99
+ return data;
100
+ }
101
+
102
+ function _templateObject2() {
103
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n"]);
104
+
105
+ _templateObject2 = function _templateObject2() {
106
+ return data;
107
+ };
108
+
109
+ return data;
110
+ }
111
+
112
+ function _templateObject() {
113
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n padding: ", ";\n background-color: ", ";\n border-radius: ", ";\n width: ", ";\n min-height: ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n display: flex;\n justify-content: center;\n"]);
114
+
115
+ _templateObject = function _templateObject() {
116
+ return data;
117
+ };
118
+
119
+ return data;
120
+ }
121
+
122
+ var deleteIcon = _react["default"].createElement("svg", {
123
+ xmlns: "http://www.w3.org/2000/svg",
124
+ width: "24",
125
+ height: "24",
126
+ viewBox: "0 0 24 24",
127
+ fill: "currentColor"
128
+ }, _react["default"].createElement("path", {
129
+ d: "M0 0h24v24H0V0z",
130
+ fill: "none"
131
+ }), _react["default"].createElement("path", {
132
+ d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
133
+ }));
134
+
135
+ var errorIcon = _react["default"].createElement("svg", {
136
+ xmlns: "http://www.w3.org/2000/svg",
137
+ height: "24px",
138
+ viewBox: "0 0 24 24",
139
+ width: "24px",
140
+ fill: "currentColor"
141
+ }, _react["default"].createElement("path", {
142
+ d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"
143
+ }));
144
+
145
+ var FileItem = function FileItem(_ref) {
146
+ var mode = _ref.mode,
147
+ multiple = _ref.multiple,
148
+ _ref$name = _ref.name,
149
+ name = _ref$name === void 0 ? "" : _ref$name,
150
+ _ref$error = _ref.error,
151
+ error = _ref$error === void 0 ? "" : _ref$error,
152
+ showPreview = _ref.showPreview,
153
+ preview = _ref.preview,
154
+ type = _ref.type,
155
+ numFiles = _ref.numFiles,
156
+ onDelete = _ref.onDelete;
157
+ var colorsTheme = (0, _useTheme["default"])();
158
+ var isImage = type.includes("image");
159
+
160
+ var getIconAriaLabel = function getIconAriaLabel() {
161
+ if (type.includes("video")) {
162
+ return "video";
163
+ }
164
+
165
+ if (type.includes("audio")) {
166
+ return "audio";
167
+ }
168
+
169
+ return "file";
170
+ };
171
+
172
+ return _react["default"].createElement(_styledComponents.ThemeProvider, {
173
+ theme: colorsTheme.fileInput
174
+ }, _react["default"].createElement(Container, {
175
+ mode: mode,
176
+ multiple: multiple,
177
+ error: error,
178
+ showPreview: showPreview,
179
+ numFiles: numFiles
180
+ }, showPreview && (isImage ? _react["default"].createElement(ImagePreview, {
181
+ src: preview,
182
+ alt: name
183
+ }) : _react["default"].createElement(IconPreviewContainer, {
184
+ error: error,
185
+ "aria-label": getIconAriaLabel()
186
+ }, _react["default"].createElement(IconPreview, {
187
+ error: error
188
+ }, preview))), _react["default"].createElement(FileItemContent, null, _react["default"].createElement(FileItemContainer, null, _react["default"].createElement(FileName, {
189
+ mode: mode,
190
+ multiple: multiple,
191
+ error: error,
192
+ showPreview: showPreview,
193
+ numFiles: numFiles
194
+ }, name), error && _react["default"].createElement(ErrorIcon, {
195
+ "aria-label": "Error"
196
+ }, errorIcon), _react["default"].createElement(DeleteIcon, {
197
+ onClick: function onClick() {
198
+ return onDelete(name);
199
+ },
200
+ "aria-label": "Remove ".concat(name)
201
+ }, deleteIcon)), error && (multiple || numFiles > 1) && _react["default"].createElement(ErrorMessage, null, error))));
202
+ };
203
+
204
+ var Container = _styledComponents["default"].div(_templateObject(), function (props) {
205
+ return props.showPreview ? "8px" : "8px 8px 8px 16px";
206
+ }, function (props) {
207
+ return props.error && props.theme.errorFileItemBackgroundColor;
208
+ }, function (props) {
209
+ return props.theme.fileItemBorderRadius;
210
+ }, function (props) {
211
+ return props.mode === "file" && !props.multiple && props.numFiles === 1 ? "calc(230px - 26px)" : !props.showPreview ? "calc(320px - 26px)" : props.showPreview && "calc(320px - 18px)";
212
+ }, function (props) {
213
+ return props.mode === "file" && !props.multiple && props.numFiles === 1 || !props.showPreview && !props.error ? "calc(40px - 18px)" : !props.showPreview && props.error ? "calc(59px - 18px)" : "calc(64px - 18px)";
214
+ }, function (props) {
215
+ return props.error ? props.theme.errorFileItemBorderColor : props.theme.fileItemBorderColor;
216
+ }, function (props) {
217
+ return props.theme.fileItemBorderThickness;
218
+ }, function (props) {
219
+ return props.theme.fileItemBorderStyle;
220
+ });
221
+
222
+ var FileItemContent = _styledComponents["default"].div(_templateObject2());
223
+
224
+ var FileItemContainer = _styledComponents["default"].div(_templateObject3());
225
+
226
+ var ImagePreview = _styledComponents["default"].img(_templateObject4());
227
+
228
+ var IconPreviewContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
229
+ return props.error ? props.theme.errorFileItemIconBackgroundColor : props.theme.fileItemIconBackgroundColor;
230
+ }, function (props) {
231
+ return props.error ? props.theme.errorFileItemIconColor : props.theme.fileItemIconColor;
232
+ });
233
+
234
+ var IconPreview = _styledComponents["default"].div(_templateObject6());
235
+
236
+ var FileName = _styledComponents["default"].span(_templateObject7(), function (props) {
237
+ return props.theme.fileNameFontColor;
238
+ }, function (props) {
239
+ return props.mode === "file" && !props.multiple && props.error && props.numFiles === 1 ? "calc(230px - 76px)" : props.mode === "file" && !props.multiple && !props.error && props.numFiles === 1 ? "calc(230px - 50px)" : !props.showPreview && !props.error ? "calc(320px - 52px)" : !props.showPreview && props.error ? "calc(320px - 76px)" : props.showPreview && props.error ? "calc(320px - 128px)" : props.showPreview && !props.error && "calc(320px - 102px)";
240
+ }, function (props) {
241
+ return props.theme.fileItemFontFamily;
242
+ }, function (props) {
243
+ return props.theme.fileItemFontSize;
244
+ }, function (props) {
245
+ return props.theme.fileItemFontWeight;
246
+ }, function (props) {
247
+ return props.theme.fileItemLineHeight;
248
+ });
249
+
250
+ var ErrorIcon = _styledComponents["default"].span(_templateObject8());
251
+
252
+ var DeleteIcon = _styledComponents["default"].button(_templateObject9(), function (props) {
253
+ return props.theme.fontFamily;
254
+ });
255
+
256
+ var ErrorMessage = _styledComponents["default"].span(_templateObject10(), function (props) {
257
+ return props.theme.errorMessageFontColor;
258
+ }, function (props) {
259
+ return props.theme.errorMessageFontFamily;
260
+ }, function (props) {
261
+ return props.theme.errorMessageFontSize;
262
+ }, function (props) {
263
+ return props.theme.errorMessageFontWeight;
264
+ }, function (props) {
265
+ return props.theme.errorMessageLineHeight;
266
+ });
267
+
268
+ FileItem.propTypes = {
269
+ mode: _propTypes["default"].string,
270
+ multiple: _propTypes["default"].bool,
271
+ name: _propTypes["default"].string,
272
+ type: _propTypes["default"].string,
273
+ showPreview: _propTypes["default"]["boolean"],
274
+ numFiles: _propTypes["default"].number,
275
+ preview: _propTypes["default"].string,
276
+ error: _propTypes["default"].string,
277
+ onDelete: _propTypes["default"].func
278
+ };
279
+ var _default = FileItem;
280
+ exports["default"] = _default;
@@ -0,0 +1,81 @@
1
+ type Size = "small" | "medium" | "large" | "fillParent";
2
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ type FileData = {
10
+ error?: string;
11
+ file?: File;
12
+ preview?: string;
13
+ };
14
+
15
+ type Props = {
16
+ /**
17
+ * Name attribute of the file input element.
18
+ */
19
+ name?: string;
20
+ /**
21
+ * Text to be placed above the file input.
22
+ */
23
+ label?: string;
24
+ /**
25
+ * Uses one of the available file input modes:
26
+ * 'file': Files are selected by clicking the button and selecting it through the file explorer.
27
+ * 'filedrop': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
28
+ * 'dropzone': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
29
+ * The drag and drop area of this mode is bigger than the one of the filedrop mode.
30
+ */
31
+ mode?: "file" | "filedrop" | "dropzone";
32
+ /**
33
+ * Helper text to be placed above the file input.
34
+ */
35
+ helperText?: string;
36
+ /**
37
+ * Defines the file types accepted by the component. It is not possible to select a file with a non valid type.
38
+ */
39
+ accept?: string;
40
+ /**
41
+ * An array of FileData representing the selected files.
42
+ */
43
+ value?: FileData[];
44
+ /**
45
+ * Minimum file size allowed (in bytes). If the file size does not comply the minSize, an error will be passed to the FileData.
46
+ */
47
+ minSize?: number;
48
+ /**
49
+ * Maximum file size allowed (in bytes). If the file size does not comply the maxSize, an error will be passed to the FileData.
50
+ */
51
+ maxSize?: number;
52
+ /**
53
+ * If true and if the file is an image, a preview of it will be shown. If it is not an image, an icon refering to the file's type will be shown.
54
+ * If mode is not multiple and there is one file already selected, the file will be replaced by the last selected one.
55
+ */
56
+ showPreview?: boolean;
57
+ /**
58
+ * If true, more than one file can be selected. If false, only one file can be selected.
59
+ */
60
+ multiple?: boolean;
61
+ /**
62
+ * If true, the component will be disabled.
63
+ */
64
+ disabled?: boolean;
65
+ /**
66
+ * This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
67
+ * In this function, the files can be updated or returned as they come. These files must be passed to the value in order to be shown.
68
+ */
69
+ callbackFile?: (files: FileData[]) => void;
70
+ /**
71
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
72
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
73
+ */
74
+ margin?: Space | Margin;
75
+ /**
76
+ * Value of the tabindex attribute.
77
+ */
78
+ tabIndex?: number;
79
+ };
80
+
81
+ export default function DxcTextInput(props: Props): JSX.Element;
@@ -11,10 +11,10 @@ exports["default"] = void 0;
11
11
 
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
13
 
14
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
-
16
14
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
15
 
16
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
17
+
18
18
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
@@ -23,16 +23,24 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
23
 
24
24
  var _propTypes = _interopRequireDefault(require("prop-types"));
25
25
 
26
- var _dxc_logo_wht = _interopRequireDefault(require("./dxc_logo_wht.png"));
26
+ var _variables = require("../common/variables.js");
27
27
 
28
- require("../common/OpenSans.css");
28
+ var _useTheme = _interopRequireDefault(require("../useTheme.js"));
29
29
 
30
- var _variables = require("../common/variables.js");
30
+ var _BackgroundColorContext = require("../BackgroundColorContext.js");
31
+
32
+ function _templateObject12() {
33
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
34
+
35
+ _templateObject12 = function _templateObject12() {
36
+ return data;
37
+ };
31
38
 
32
- var _ThemeContext = _interopRequireDefault(require("../ThemeContext.js"));
39
+ return data;
40
+ }
33
41
 
34
42
  function _templateObject11() {
35
- var data = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n color: ", ";\n font-size: 12px;\n"]);
43
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px 10px;\n color: ", ";\n"]);
36
44
 
37
45
  _templateObject11 = function _templateObject11() {
38
46
  return data;
@@ -42,7 +50,7 @@ function _templateObject11() {
42
50
  }
43
51
 
44
52
  function _templateObject10() {
45
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px 10px;\n color: ", ";\n"]);
53
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n color: ", ";\n }\n\n overflow: hidden;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"]);
46
54
 
47
55
  _templateObject10 = function _templateObject10() {
48
56
  return data;
@@ -52,7 +60,7 @@ function _templateObject10() {
52
60
  }
53
61
 
54
62
  function _templateObject9() {
55
- var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: 25px;\n width: 25px;\n fill: ", ";\n }\n"]);
63
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n fill: ", ";\n }\n"]);
56
64
 
57
65
  _templateObject9 = function _templateObject9() {
58
66
  return data;
@@ -72,7 +80,7 @@ function _templateObject8() {
72
80
  }
73
81
 
74
82
  function _templateObject7() {
75
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 34px;\n width: auto;\n"]);
83
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"]);
76
84
 
77
85
  _templateObject7 = function _templateObject7() {
78
86
  return data;
@@ -82,7 +90,7 @@ function _templateObject7() {
82
90
  }
83
91
 
84
92
  function _templateObject6() {
85
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: 12px;\n color: ", ";\n max-width: ", ";\n width: ", ";\n text-align: ", ";\n"]);
93
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n max-width: ", ";\n width: ", ";\n text-align: ", ";\n padding-top: ", ";\n"]);
86
94
 
87
95
  _templateObject6 = function _templateObject6() {
88
96
  return data;
@@ -92,7 +100,7 @@ function _templateObject6() {
92
100
  }
93
101
 
94
102
  function _templateObject5() {
95
- var data = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 15px;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n color: ", ";\n overflow: hidden;\n"]);
103
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 15px;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n overflow: hidden;\n"]);
96
104
 
97
105
  _templateObject5 = function _templateObject5() {
98
106
  return data;
@@ -102,7 +110,7 @@ function _templateObject5() {
102
110
  }
103
111
 
104
112
  function _templateObject4() {
105
- var data = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: 6px;\n border-top: 2px solid ", ";\n display: inline-flex;\n flex-wrap: wrap;\n max-width: ", ";\n width: ", ";\n & > span:last-child span {\n display: none;\n }\n margin: ", ";\n"]);
113
+ var data = (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 margin: ", ";\n"]);
106
114
 
107
115
  _templateObject4 = function _templateObject4() {
108
116
  return data;
@@ -112,7 +120,7 @@ function _templateObject4() {
112
120
  }
113
121
 
114
122
  function _templateObject3() {
115
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n flex-direction: ", ";\n align-items: ", ";\n"]);
123
+ var data = (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"]);
116
124
 
117
125
  _templateObject3 = function _templateObject3() {
118
126
  return data;
@@ -132,7 +140,7 @@ function _templateObject2() {
132
140
  }
133
141
 
134
142
  function _templateObject() {
135
- var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n padding: ", ";\n font-family: \"Open Sans\", sans-serif;\n background-color: ", ";\n margin-top: ", ";\n }\n"]);
143
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: ", ";\n background-color: ", ";\n margin-top: ", ";\n width: 100%;\n box-sizing: border-box;\n min-height: ", ";\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n"]);
136
144
 
137
145
  _templateObject = function _templateObject() {
138
146
  return data;
@@ -152,7 +160,9 @@ var DxcFooter = function DxcFooter(_ref) {
152
160
  logoSrc = _ref$logoSrc === void 0 ? "default" : _ref$logoSrc,
153
161
  children = _ref.children,
154
162
  padding = _ref.padding,
155
- margin = _ref.margin;
163
+ margin = _ref.margin,
164
+ _ref$tabIndex = _ref.tabIndex,
165
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
156
166
  var ref = (0, _react.useRef)(null);
157
167
 
158
168
  var _useState = (0, _react.useState)(),
@@ -170,7 +180,7 @@ var DxcFooter = function DxcFooter(_ref) {
170
180
  isResponsivePhone = _useState6[0],
171
181
  setIsResponsivePhone = _useState6[1];
172
182
 
173
- var colorsTheme = (0, _react.useContext)(_ThemeContext["default"]) || _variables.colors;
183
+ var colorsTheme = (0, _useTheme["default"])();
174
184
 
175
185
  var handleResize = function handleResize(refWidth) {
176
186
  if (ref.current) {
@@ -202,10 +212,11 @@ var DxcFooter = function DxcFooter(_ref) {
202
212
  }, []);
203
213
  var socialLink = socialLinks.map(function (link, index) {
204
214
  return _react["default"].createElement(SocialAnchor, {
215
+ tabIndex: tabIndex,
205
216
  key: "social".concat(index).concat(link.href),
206
217
  index: index,
207
218
  href: link && link.href ? link.href : ""
208
- }, link && link.logoSrc && _react["default"].createElement(SocialIcon, {
219
+ }, link.logo ? _react["default"].createElement(SocialIconContainer, null, (0, _typeof2["default"])(link.logo) === "object" ? link.logo : _react["default"].createElement(link.logo)) : link && link.logoSrc && _react["default"].createElement(SocialIcon, {
209
220
  src: link.logoSrc
210
221
  }));
211
222
  });
@@ -213,20 +224,21 @@ var DxcFooter = function DxcFooter(_ref) {
213
224
  return _react["default"].createElement("span", {
214
225
  key: "bottom".concat(index).concat(link.text)
215
226
  }, _react["default"].createElement(BottomLink, {
227
+ tabIndex: tabIndex,
216
228
  href: link && link.href ? link.href : ""
217
229
  }, link && link.text ? link.text : ""), _react["default"].createElement(Point, {
218
230
  index: index
219
231
  }, "\xB7"));
220
232
  });
221
233
  return _react["default"].createElement(_styledComponents.ThemeProvider, {
222
- theme: colorsTheme
234
+ theme: colorsTheme.footer
223
235
  }, _react["default"].createElement(FooterContainer, {
224
236
  margin: margin,
225
237
  refSize: refSize,
226
238
  ref: ref
227
239
  }, _react["default"].createElement(FooterHeader, null, _react["default"].createElement(LogoIcon, {
228
240
  logoSrc: logoSrc,
229
- src: logoSrc === "default" ? _dxc_logo_wht["default"] : logoSrc
241
+ src: logoSrc === "default" ? colorsTheme.footer.logo : logoSrc
230
242
  }), _react["default"].createElement("div", null, socialLink)), isResponsivePhone && _react["default"].createElement("div", null, _react["default"].createElement(FooterFooter, {
231
243
  className: "footerFooter",
232
244
  refSize: refSize
@@ -236,7 +248,9 @@ var DxcFooter = function DxcFooter(_ref) {
236
248
  refSize: refSize
237
249
  }, copyright))), (!isResponsiveTablet && !isResponsivePhone || isResponsiveTablet) && _react["default"].createElement("div", null, _react["default"].createElement(ChildComponents, {
238
250
  padding: padding
239
- }, children), _react["default"].createElement(FooterFooter, {
251
+ }, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
252
+ color: colorsTheme.footer.backgroundColor
253
+ }, children)), _react["default"].createElement(FooterFooter, {
240
254
  className: "footerFooter"
241
255
  }, _react["default"].createElement(BottomLinks, {
242
256
  refSize: refSize
@@ -245,12 +259,14 @@ var DxcFooter = function DxcFooter(_ref) {
245
259
  }, copyright)))));
246
260
  };
247
261
 
248
- var FooterContainer = _styledComponents["default"].div(_templateObject(), function (props) {
249
- return props.refSize <= _variables.responsiveSizes.mobileLarge ? "20px 20px 20px 20px" : "20px 60px 20px 20px";
262
+ var FooterContainer = _styledComponents["default"].footer(_templateObject(), function (props) {
263
+ return props.refSize <= _variables.responsiveSizes.mobileLarge ? "20px 20px 20px 20px" : "24px 36px 24px 36px";
250
264
  }, function (props) {
251
- return props.theme.black;
265
+ return props.theme.backgroundColor;
252
266
  }, function (props) {
253
267
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
268
+ }, function (props) {
269
+ return props.theme.height;
254
270
  });
255
271
 
256
272
  var FooterHeader = _styledComponents["default"].div(_templateObject2());
@@ -259,10 +275,12 @@ var FooterFooter = _styledComponents["default"].div(_templateObject3(), function
259
275
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "column" : "row";
260
276
  }, function (props) {
261
277
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "center" : "";
278
+ }, function (props) {
279
+ return "".concat(props.theme.bottomLinksDividerThickness, " ").concat(props.theme.bottomLinksDividerStyle, " ").concat(props.theme.bottomLinksDividerColor);
262
280
  });
263
281
 
264
282
  var BottomLinks = _styledComponents["default"].div(_templateObject4(), function (props) {
265
- return props.theme.yellow;
283
+ return props.theme.bottomLinksDividerSpacing;
266
284
  }, function (props) {
267
285
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "60%";
268
286
  }, function (props) {
@@ -281,41 +299,76 @@ var ChildComponents = _styledComponents["default"].div(_templateObject5(), funct
281
299
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
282
300
  }, function (props) {
283
301
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
284
- }, function (props) {
285
- return props.theme.white;
286
302
  });
287
303
 
288
304
  var Copyright = _styledComponents["default"].div(_templateObject6(), function (props) {
289
- return props.theme.white;
305
+ return props.theme.copyrightFontFamily;
306
+ }, function (props) {
307
+ return props.theme.copyrightFontSize;
308
+ }, function (props) {
309
+ return props.theme.copyrightFontStyle;
310
+ }, function (props) {
311
+ return props.theme.copyrightFontWeight;
312
+ }, function (props) {
313
+ return props.theme.copyrightFontColor;
290
314
  }, function (props) {
291
315
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "40%";
292
316
  }, function (props) {
293
317
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "";
294
318
  }, function (props) {
295
319
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "center" : "right";
320
+ }, function (props) {
321
+ return props.theme.bottomLinksDividerSpacing;
296
322
  });
297
323
 
298
- var LogoIcon = _styledComponents["default"].img(_templateObject7());
324
+ var LogoIcon = _styledComponents["default"].img(_templateObject7(), function (props) {
325
+ return props.theme.logoHeight;
326
+ }, function (props) {
327
+ return props.theme.logoWidth;
328
+ });
299
329
 
300
330
  var SocialAnchor = _styledComponents["default"].a(_templateObject8(), function (props) {
301
- return props.index === 0 ? "0px" : "15px";
331
+ return props.index === 0 ? "0px" : props.theme.socialLinksGutter;
302
332
  });
303
333
 
304
334
  var SocialIcon = _styledComponents["default"].img(_templateObject9(), function (props) {
305
- return props.theme.white;
335
+ return props.theme.socialLinksSize;
336
+ }, function (props) {
337
+ return props.theme.socialLinksSize;
338
+ }, function (props) {
339
+ return props.theme.socialLinksColor;
340
+ });
341
+
342
+ var SocialIconContainer = _styledComponents["default"].div(_templateObject10(), function (props) {
343
+ return props.theme.socialLinksSize;
344
+ }, function (props) {
345
+ return props.theme.socialLinksSize;
346
+ }, function (props) {
347
+ return props.theme.socialLinksColor;
306
348
  });
307
349
 
308
- var Point = _styledComponents["default"].span(_templateObject10(), function (props) {
309
- return props.theme.white;
350
+ var Point = _styledComponents["default"].span(_templateObject11(), function (props) {
351
+ return props.theme.bottomLinksFontColor;
310
352
  });
311
353
 
312
- var BottomLink = _styledComponents["default"].a(_templateObject11(), function (props) {
313
- return props.theme.white;
354
+ var BottomLink = _styledComponents["default"].a(_templateObject12(), function (props) {
355
+ return props.theme.bottomLinksTextDecoration;
356
+ }, function (props) {
357
+ return props.theme.bottomLinksFontColor;
358
+ }, function (props) {
359
+ return props.theme.bottomLinksFontFamily;
360
+ }, function (props) {
361
+ return props.theme.bottomLinksFontSize;
362
+ }, function (props) {
363
+ return props.theme.bottomLinksFontStyle;
364
+ }, function (props) {
365
+ return props.theme.bottomLinksFontWeight;
314
366
  });
315
367
 
316
368
  DxcFooter.propTypes = {
317
369
  logoSrc: _propTypes["default"].string,
318
370
  socialLinks: _propTypes["default"].arrayOf(_propTypes["default"].shape({
371
+ logo: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
319
372
  logoSrc: _propTypes["default"].string.isRequired,
320
373
  href: _propTypes["default"].string
321
374
  })),
@@ -335,7 +388,8 @@ DxcFooter.propTypes = {
335
388
  bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
336
389
  left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
337
390
  right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
338
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
391
+ }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
392
+ tabIndex: _propTypes["default"].number
339
393
  };
340
394
  var _default = DxcFooter;
341
395
  exports["default"] = _default;