@dxc-technology/halstack-react 0.0.0-c24450b → 0.0.0-c6243ef

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 (129) hide show
  1. package/babel.config.js +6 -2
  2. package/dist/BackgroundColorContext.js +46 -0
  3. package/dist/ThemeContext.js +235 -2
  4. package/dist/accordion/Accordion.js +170 -81
  5. package/dist/accordion-group/AccordionGroup.js +186 -0
  6. package/dist/alert/Alert.js +184 -83
  7. package/dist/alert/index.d.ts +51 -0
  8. package/dist/badge/Badge.js +63 -0
  9. package/dist/box/Box.js +31 -23
  10. package/dist/button/Button.js +82 -27
  11. package/dist/card/Card.js +72 -35
  12. package/dist/checkbox/Checkbox.js +108 -32
  13. package/dist/chip/Chip.js +129 -35
  14. package/dist/common/RequiredComponent.js +2 -8
  15. package/dist/common/utils.js +2 -22
  16. package/dist/common/variables.js +1457 -210
  17. package/dist/date/Date.js +81 -59
  18. package/dist/dialog/Dialog.js +58 -37
  19. package/dist/dropdown/Dropdown.js +229 -68
  20. package/dist/file-input/FileInput.js +644 -0
  21. package/dist/file-input/FileItem.js +280 -0
  22. package/dist/file-input/index.d.ts +81 -0
  23. package/dist/footer/Footer.js +87 -38
  24. package/dist/footer/dxc_logo.svg +15 -0
  25. package/dist/footer/readme.md +1 -1
  26. package/dist/header/Header.js +121 -72
  27. package/dist/header/dxc_logo_black.svg +8 -0
  28. package/dist/header/readme.md +1 -1
  29. package/dist/heading/Heading.js +81 -22
  30. package/dist/input-text/InputText.js +289 -101
  31. package/dist/layout/ApplicationLayout.js +331 -0
  32. package/dist/layout/facebook.svg +45 -0
  33. package/dist/layout/linkedin.svg +50 -0
  34. package/dist/layout/twitter.svg +53 -0
  35. package/dist/link/Link.js +136 -35
  36. package/dist/main.d.ts +8 -0
  37. package/dist/main.js +105 -1
  38. package/dist/new-date/NewDate.js +400 -0
  39. package/dist/new-date/index.d.ts +95 -0
  40. package/dist/new-select/NewSelect.js +836 -0
  41. package/dist/new-select/index.d.ts +53 -0
  42. package/dist/new-textarea/NewTextarea.js +369 -0
  43. package/dist/new-textarea/index.d.ts +117 -0
  44. package/dist/number/Number.js +136 -0
  45. package/dist/number/NumberContext.js +16 -0
  46. package/dist/number/index.d.ts +113 -0
  47. package/dist/paginator/Paginator.js +160 -49
  48. package/dist/password-input/PasswordInput.js +198 -0
  49. package/dist/password-input/index.d.ts +94 -0
  50. package/dist/progress-bar/ProgressBar.js +97 -44
  51. package/dist/radio/Radio.js +39 -21
  52. package/dist/resultsetTable/ResultsetTable.js +93 -69
  53. package/dist/select/Select.js +250 -143
  54. package/dist/sidenav/Sidenav.js +85 -143
  55. package/dist/slider/Slider.js +206 -70
  56. package/dist/spinner/Spinner.js +249 -64
  57. package/dist/switch/Switch.js +51 -26
  58. package/dist/table/Table.js +63 -15
  59. package/dist/tabs/Tabs.js +208 -35
  60. package/dist/tabs-for-sections/TabsForSections.js +1 -16
  61. package/dist/tag/Tag.js +100 -35
  62. package/dist/text-input/TextInput.js +971 -0
  63. package/dist/text-input/index.d.ts +135 -0
  64. package/dist/textarea/Textarea.js +81 -43
  65. package/dist/toggle/Toggle.js +16 -19
  66. package/dist/toggle-group/ToggleGroup.js +327 -0
  67. package/dist/upload/Upload.js +13 -8
  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/transaction/Transaction.js +44 -24
  73. package/dist/upload/transactions/Transactions.js +38 -20
  74. package/dist/useTheme.js +22 -0
  75. package/dist/wizard/Wizard.js +142 -51
  76. package/dist/wizard/invalid_icon.svg +4 -5
  77. package/dist/wizard/valid_icon.svg +4 -5
  78. package/package.json +14 -6
  79. package/test/AccordionGroup.test.js +125 -0
  80. package/test/Date.test.js +13 -13
  81. package/test/Dropdown.test.js +19 -4
  82. package/test/FileInput.test.js +201 -0
  83. package/test/InputText.test.js +30 -26
  84. package/test/Link.test.js +25 -7
  85. package/test/NewDate.test.js +232 -0
  86. package/test/NewTextarea.test.js +195 -0
  87. package/test/Number.test.js +257 -0
  88. package/test/Paginator.test.js +72 -60
  89. package/test/PasswordInput.test.js +83 -0
  90. package/test/ResultsetTable.test.js +66 -19
  91. package/test/Select.test.js +55 -34
  92. package/test/Sidenav.test.js +22 -64
  93. package/test/Slider.test.js +17 -0
  94. package/test/Spinner.test.js +5 -0
  95. package/test/Tabs.test.js +21 -0
  96. package/test/TextInput.test.js +732 -0
  97. package/test/ToggleGroup.test.js +85 -0
  98. package/dist/accordion/Accordion.stories.js +0 -207
  99. package/dist/accordion/readme.md +0 -96
  100. package/dist/alert/Alert.stories.js +0 -158
  101. package/dist/alert/close.svg +0 -4
  102. package/dist/alert/error.svg +0 -4
  103. package/dist/alert/info.svg +0 -4
  104. package/dist/alert/readme.md +0 -43
  105. package/dist/alert/success.svg +0 -4
  106. package/dist/alert/warning.svg +0 -4
  107. package/dist/button/Button.stories.js +0 -224
  108. package/dist/button/readme.md +0 -93
  109. package/dist/common/services/example-service.js +0 -10
  110. package/dist/common/services/example-service.test.js +0 -12
  111. package/dist/date/calendar.svg +0 -1
  112. package/dist/date/calendar_dark.svg +0 -1
  113. package/dist/dialog/Dialog.stories.js +0 -217
  114. package/dist/dialog/readme.md +0 -32
  115. package/dist/dropdown/Dropdown.stories.js +0 -249
  116. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  117. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  118. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  119. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  120. package/dist/dropdown/readme.md +0 -69
  121. package/dist/footer/Footer.stories.js +0 -94
  122. package/dist/footer/dxc_logo_wht.png +0 -0
  123. package/dist/header/dxc_logo_black.png +0 -0
  124. package/dist/header/dxc_logo_white.png +0 -0
  125. package/dist/input-text/InputText.stories.js +0 -209
  126. package/dist/select/Select.stories.js +0 -235
  127. package/dist/select/readme.md +0 -72
  128. package/dist/sidenav/arrow_icon.svg +0 -3
  129. 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,18 +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"]);
31
34
 
32
- var _ThemeContext = _interopRequireDefault(require("../ThemeContext.js"));
35
+ _templateObject12 = function _templateObject12() {
36
+ return data;
37
+ };
33
38
 
34
- var _utils = require("../common/utils.js");
39
+ return data;
40
+ }
35
41
 
36
42
  function _templateObject11() {
37
- 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"]);
38
44
 
39
45
  _templateObject11 = function _templateObject11() {
40
46
  return data;
@@ -44,7 +50,7 @@ function _templateObject11() {
44
50
  }
45
51
 
46
52
  function _templateObject10() {
47
- 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"]);
48
54
 
49
55
  _templateObject10 = function _templateObject10() {
50
56
  return data;
@@ -54,7 +60,7 @@ function _templateObject10() {
54
60
  }
55
61
 
56
62
  function _templateObject9() {
57
- 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"]);
58
64
 
59
65
  _templateObject9 = function _templateObject9() {
60
66
  return data;
@@ -74,7 +80,7 @@ function _templateObject8() {
74
80
  }
75
81
 
76
82
  function _templateObject7() {
77
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: 34px;\n width: auto;\n"]);
83
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"]);
78
84
 
79
85
  _templateObject7 = function _templateObject7() {
80
86
  return data;
@@ -84,7 +90,7 @@ function _templateObject7() {
84
90
  }
85
91
 
86
92
  function _templateObject6() {
87
- 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"]);
88
94
 
89
95
  _templateObject6 = function _templateObject6() {
90
96
  return data;
@@ -94,7 +100,7 @@ function _templateObject6() {
94
100
  }
95
101
 
96
102
  function _templateObject5() {
97
- 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"]);
98
104
 
99
105
  _templateObject5 = function _templateObject5() {
100
106
  return data;
@@ -104,7 +110,7 @@ function _templateObject5() {
104
110
  }
105
111
 
106
112
  function _templateObject4() {
107
- 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"]);
108
114
 
109
115
  _templateObject4 = function _templateObject4() {
110
116
  return data;
@@ -114,7 +120,7 @@ function _templateObject4() {
114
120
  }
115
121
 
116
122
  function _templateObject3() {
117
- 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"]);
118
124
 
119
125
  _templateObject3 = function _templateObject3() {
120
126
  return data;
@@ -134,7 +140,7 @@ function _templateObject2() {
134
140
  }
135
141
 
136
142
  function _templateObject() {
137
- 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"]);
138
144
 
139
145
  _templateObject = function _templateObject() {
140
146
  return data;
@@ -154,7 +160,9 @@ var DxcFooter = function DxcFooter(_ref) {
154
160
  logoSrc = _ref$logoSrc === void 0 ? "default" : _ref$logoSrc,
155
161
  children = _ref.children,
156
162
  padding = _ref.padding,
157
- margin = _ref.margin;
163
+ margin = _ref.margin,
164
+ _ref$tabIndex = _ref.tabIndex,
165
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
158
166
  var ref = (0, _react.useRef)(null);
159
167
 
160
168
  var _useState = (0, _react.useState)(),
@@ -172,10 +180,7 @@ var DxcFooter = function DxcFooter(_ref) {
172
180
  isResponsivePhone = _useState6[0],
173
181
  setIsResponsivePhone = _useState6[1];
174
182
 
175
- var customTheme = (0, _react.useContext)(_ThemeContext["default"]);
176
- var colorsTheme = (0, _react.useMemo)(function () {
177
- return (0, _utils.getCustomTheme)(_variables.theme, (0, _utils.getCustomTheme)(_variables.defaultTheme, customTheme));
178
- }, [customTheme]);
183
+ var colorsTheme = (0, _useTheme["default"])();
179
184
 
180
185
  var handleResize = function handleResize(refWidth) {
181
186
  if (ref.current) {
@@ -207,10 +212,11 @@ var DxcFooter = function DxcFooter(_ref) {
207
212
  }, []);
208
213
  var socialLink = socialLinks.map(function (link, index) {
209
214
  return _react["default"].createElement(SocialAnchor, {
215
+ tabIndex: tabIndex,
210
216
  key: "social".concat(index).concat(link.href),
211
217
  index: index,
212
218
  href: link && link.href ? link.href : ""
213
- }, 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, {
214
220
  src: link.logoSrc
215
221
  }));
216
222
  });
@@ -218,6 +224,7 @@ var DxcFooter = function DxcFooter(_ref) {
218
224
  return _react["default"].createElement("span", {
219
225
  key: "bottom".concat(index).concat(link.text)
220
226
  }, _react["default"].createElement(BottomLink, {
227
+ tabIndex: tabIndex,
221
228
  href: link && link.href ? link.href : ""
222
229
  }, link && link.text ? link.text : ""), _react["default"].createElement(Point, {
223
230
  index: index
@@ -231,7 +238,7 @@ var DxcFooter = function DxcFooter(_ref) {
231
238
  ref: ref
232
239
  }, _react["default"].createElement(FooterHeader, null, _react["default"].createElement(LogoIcon, {
233
240
  logoSrc: logoSrc,
234
- src: logoSrc === "default" ? _dxc_logo_wht["default"] : logoSrc
241
+ src: logoSrc === "default" ? colorsTheme.footer.logo : logoSrc
235
242
  }), _react["default"].createElement("div", null, socialLink)), isResponsivePhone && _react["default"].createElement("div", null, _react["default"].createElement(FooterFooter, {
236
243
  className: "footerFooter",
237
244
  refSize: refSize
@@ -241,7 +248,9 @@ var DxcFooter = function DxcFooter(_ref) {
241
248
  refSize: refSize
242
249
  }, copyright))), (!isResponsiveTablet && !isResponsivePhone || isResponsiveTablet) && _react["default"].createElement("div", null, _react["default"].createElement(ChildComponents, {
243
250
  padding: padding
244
- }, children), _react["default"].createElement(FooterFooter, {
251
+ }, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
252
+ color: colorsTheme.footer.backgroundColor
253
+ }, children)), _react["default"].createElement(FooterFooter, {
245
254
  className: "footerFooter"
246
255
  }, _react["default"].createElement(BottomLinks, {
247
256
  refSize: refSize
@@ -250,12 +259,14 @@ var DxcFooter = function DxcFooter(_ref) {
250
259
  }, copyright)))));
251
260
  };
252
261
 
253
- var FooterContainer = _styledComponents["default"].div(_templateObject(), function (props) {
254
- 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";
255
264
  }, function (props) {
256
265
  return props.theme.backgroundColor;
257
266
  }, function (props) {
258
267
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
268
+ }, function (props) {
269
+ return props.theme.height;
259
270
  });
260
271
 
261
272
  var FooterHeader = _styledComponents["default"].div(_templateObject2());
@@ -264,10 +275,12 @@ var FooterFooter = _styledComponents["default"].div(_templateObject3(), function
264
275
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "column" : "row";
265
276
  }, function (props) {
266
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);
267
280
  });
268
281
 
269
282
  var BottomLinks = _styledComponents["default"].div(_templateObject4(), function (props) {
270
- return props.theme.lineColor;
283
+ return props.theme.bottomLinksDividerSpacing;
271
284
  }, function (props) {
272
285
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "60%";
273
286
  }, function (props) {
@@ -286,41 +299,76 @@ var ChildComponents = _styledComponents["default"].div(_templateObject5(), funct
286
299
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
287
300
  }, function (props) {
288
301
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
289
- }, function (props) {
290
- return props.theme.fontColor;
291
302
  });
292
303
 
293
304
  var Copyright = _styledComponents["default"].div(_templateObject6(), function (props) {
294
- return props.theme.fontColor;
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;
295
314
  }, function (props) {
296
315
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "40%";
297
316
  }, function (props) {
298
317
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "100%" : "";
299
318
  }, function (props) {
300
319
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "center" : "right";
320
+ }, function (props) {
321
+ return props.theme.bottomLinksDividerSpacing;
301
322
  });
302
323
 
303
- 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
+ });
304
329
 
305
330
  var SocialAnchor = _styledComponents["default"].a(_templateObject8(), function (props) {
306
- return props.index === 0 ? "0px" : "15px";
331
+ return props.index === 0 ? "0px" : props.theme.socialLinksGutter;
307
332
  });
308
333
 
309
334
  var SocialIcon = _styledComponents["default"].img(_templateObject9(), function (props) {
310
- return props.theme.fontColor;
335
+ return props.theme.socialLinksSize;
336
+ }, function (props) {
337
+ return props.theme.socialLinksSize;
338
+ }, function (props) {
339
+ return props.theme.socialLinksColor;
311
340
  });
312
341
 
313
- var Point = _styledComponents["default"].span(_templateObject10(), function (props) {
314
- return props.theme.fontColor;
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;
315
348
  });
316
349
 
317
- var BottomLink = _styledComponents["default"].a(_templateObject11(), function (props) {
318
- return props.theme.fontColor;
350
+ var Point = _styledComponents["default"].span(_templateObject11(), function (props) {
351
+ return props.theme.bottomLinksFontColor;
352
+ });
353
+
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;
319
366
  });
320
367
 
321
368
  DxcFooter.propTypes = {
322
369
  logoSrc: _propTypes["default"].string,
323
370
  socialLinks: _propTypes["default"].arrayOf(_propTypes["default"].shape({
371
+ logo: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
324
372
  logoSrc: _propTypes["default"].string.isRequired,
325
373
  href: _propTypes["default"].string
326
374
  })),
@@ -340,7 +388,8 @@ DxcFooter.propTypes = {
340
388
  bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
341
389
  left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
342
390
  right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
343
- }), _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
344
393
  };
345
394
  var _default = DxcFooter;
346
395
  exports["default"] = _default;