@dxc-technology/halstack-react 3.3.0 → 4.0.1

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 (254) hide show
  1. package/{dist/BackgroundColorContext.js → BackgroundColorContext.js} +0 -0
  2. package/ThemeContext.js +250 -0
  3. package/{dist/select/Select.js → V3Select/V3Select.js} +175 -189
  4. package/V3Select/index.d.ts +27 -0
  5. package/{dist/textarea/Textarea.js → V3Textarea/V3Textarea.js} +30 -26
  6. package/V3Textarea/index.d.ts +27 -0
  7. package/{dist/accordion → accordion}/Accordion.js +66 -59
  8. package/accordion/index.d.ts +28 -0
  9. package/{dist/accordion-group → accordion-group}/AccordionGroup.js +1 -3
  10. package/accordion-group/index.d.ts +16 -0
  11. package/{dist/alert → alert}/Alert.js +126 -111
  12. package/alert/index.d.ts +51 -0
  13. package/{dist/badge → badge}/Badge.js +0 -0
  14. package/{dist/box → box}/Box.js +1 -9
  15. package/box/index.d.ts +25 -0
  16. package/button/Button.js +238 -0
  17. package/button/Button.stories.js +27 -0
  18. package/button/index.d.ts +24 -0
  19. package/{dist/card → card}/Card.js +0 -0
  20. package/card/index.d.ts +22 -0
  21. package/{dist/checkbox → checkbox}/Checkbox.js +26 -21
  22. package/checkbox/index.d.ts +24 -0
  23. package/{dist/chip → chip}/Chip.js +21 -25
  24. package/chip/index.d.ts +22 -0
  25. package/{dist/common → common}/OpenSans.css +0 -0
  26. package/{dist/common → common}/RequiredComponent.js +0 -0
  27. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  28. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  29. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  30. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  31. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  32. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  33. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  34. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  35. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  36. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  37. package/{dist/common → common}/utils.js +0 -0
  38. package/common/variables.js +1567 -0
  39. package/{dist/date → date}/Date.js +7 -9
  40. package/date/index.d.ts +27 -0
  41. package/date-input/DateInput.js +400 -0
  42. package/date-input/index.d.ts +95 -0
  43. package/{dist/dialog → dialog}/Dialog.js +15 -32
  44. package/dialog/index.d.ts +18 -0
  45. package/{dist/dropdown → dropdown}/Dropdown.js +117 -66
  46. package/dropdown/index.d.ts +26 -0
  47. package/file-input/FileInput.js +644 -0
  48. package/file-input/FileItem.js +287 -0
  49. package/file-input/index.d.ts +81 -0
  50. package/{dist/footer → footer}/Footer.js +63 -49
  51. package/footer/Icons.js +77 -0
  52. package/footer/index.d.ts +25 -0
  53. package/{dist/header → header}/Header.js +123 -84
  54. package/header/Icons.js +59 -0
  55. package/header/index.d.ts +25 -0
  56. package/{dist/heading → heading}/Heading.js +13 -5
  57. package/heading/index.d.ts +17 -0
  58. package/input-text/Icons.js +22 -0
  59. package/{dist/input-text → input-text}/InputText.js +96 -63
  60. package/input-text/index.d.ts +36 -0
  61. package/{dist/layout → layout}/ApplicationLayout.js +5 -9
  62. package/layout/Icons.js +55 -0
  63. package/{dist/link → link}/Link.js +4 -8
  64. package/link/index.d.ts +23 -0
  65. package/main.d.ts +40 -0
  66. package/{dist/main.js → main.js} +62 -14
  67. package/number-input/NumberInput.js +136 -0
  68. package/number-input/NumberInputContext.js +16 -0
  69. package/number-input/index.d.ts +113 -0
  70. package/package.json +23 -17
  71. package/paginator/Icons.js +66 -0
  72. package/{dist/paginator → paginator}/Paginator.js +60 -38
  73. package/paginator/index.d.ts +20 -0
  74. package/password-input/PasswordInput.js +203 -0
  75. package/password-input/index.d.ts +94 -0
  76. package/{dist/progress-bar → progress-bar}/ProgressBar.js +63 -27
  77. package/progress-bar/index.d.ts +18 -0
  78. package/{dist/radio → radio}/Radio.js +0 -0
  79. package/radio/index.d.ts +23 -0
  80. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +1 -1
  81. package/resultsetTable/index.d.ts +19 -0
  82. package/select/Select.js +1138 -0
  83. package/select/index.d.ts +131 -0
  84. package/{dist/sidenav → sidenav}/Sidenav.js +11 -15
  85. package/sidenav/index.d.ts +13 -0
  86. package/{dist/slider → slider}/Slider.js +155 -66
  87. package/slider/index.d.ts +29 -0
  88. package/spinner/Spinner.js +381 -0
  89. package/spinner/index.d.ts +17 -0
  90. package/{dist/switch → switch}/Switch.js +0 -0
  91. package/switch/index.d.ts +24 -0
  92. package/{dist/table → table}/Table.js +5 -1
  93. package/table/index.d.ts +13 -0
  94. package/{dist/tabs → tabs}/Tabs.js +0 -0
  95. package/tabs/index.d.ts +19 -0
  96. package/{dist/tag → tag}/Tag.js +37 -35
  97. package/tag/index.d.ts +24 -0
  98. package/text-input/TextInput.js +992 -0
  99. package/text-input/index.d.ts +135 -0
  100. package/textarea/Textarea.js +369 -0
  101. package/textarea/index.d.ts +117 -0
  102. package/{dist/toggle → toggle}/Toggle.js +0 -0
  103. package/toggle/index.d.ts +21 -0
  104. package/toggle-group/ToggleGroup.js +327 -0
  105. package/toggle-group/index.d.ts +21 -0
  106. package/{dist/upload → upload}/Upload.js +0 -0
  107. package/{dist/upload → upload}/buttons-upload/ButtonsUpload.js +12 -12
  108. package/upload/buttons-upload/Icons.js +40 -0
  109. package/{dist/upload → upload}/dragAndDropArea/DragAndDropArea.js +23 -19
  110. package/upload/dragAndDropArea/Icons.js +39 -0
  111. package/{dist/upload → upload}/file-upload/FileToUpload.js +27 -22
  112. package/upload/file-upload/Icons.js +66 -0
  113. package/{dist/upload → upload}/files-upload/FilesToUpload.js +0 -0
  114. package/upload/index.d.ts +15 -0
  115. package/upload/transaction/Icons.js +160 -0
  116. package/{dist/upload → upload}/transaction/Transaction.js +18 -41
  117. package/{dist/upload → upload}/transactions/Transactions.js +11 -11
  118. package/{dist/useTheme.js → useTheme.js} +0 -0
  119. package/wizard/Icons.js +65 -0
  120. package/{dist/wizard → wizard}/Wizard.js +11 -17
  121. package/wizard/index.d.ts +18 -0
  122. package/README.md +0 -66
  123. package/babel.config.js +0 -8
  124. package/dist/ThemeContext.js +0 -216
  125. package/dist/accordion/Accordion.stories.js +0 -207
  126. package/dist/accordion/readme.md +0 -96
  127. package/dist/accordion-group/AccordionGroup.stories.js +0 -207
  128. package/dist/accordion-group/readme.md +0 -70
  129. package/dist/alert/Alert.stories.js +0 -158
  130. package/dist/alert/close.svg +0 -4
  131. package/dist/alert/error.svg +0 -4
  132. package/dist/alert/info.svg +0 -4
  133. package/dist/alert/readme.md +0 -43
  134. package/dist/alert/success.svg +0 -4
  135. package/dist/alert/warning.svg +0 -4
  136. package/dist/button/Button.js +0 -232
  137. package/dist/button/Button.stories.js +0 -224
  138. package/dist/button/readme.md +0 -93
  139. package/dist/checkbox/Checkbox.stories.js +0 -144
  140. package/dist/checkbox/readme.md +0 -116
  141. package/dist/common/variables.js +0 -1158
  142. package/dist/date/Date.stories.js +0 -205
  143. package/dist/date/readme.md +0 -73
  144. package/dist/dialog/Dialog.stories.js +0 -217
  145. package/dist/dialog/readme.md +0 -32
  146. package/dist/dropdown/Dropdown.stories.js +0 -249
  147. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  148. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  149. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  150. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  151. package/dist/dropdown/readme.md +0 -69
  152. package/dist/footer/Footer.stories.js +0 -94
  153. package/dist/footer/dxc_logo.svg +0 -15
  154. package/dist/footer/readme.md +0 -41
  155. package/dist/header/Header.stories.js +0 -176
  156. package/dist/header/close_icon.svg +0 -1
  157. package/dist/header/dxc_logo_black.svg +0 -8
  158. package/dist/header/hamb_menu_black.svg +0 -1
  159. package/dist/header/hamb_menu_white.svg +0 -1
  160. package/dist/header/readme.md +0 -33
  161. package/dist/input-text/InputText.stories.js +0 -209
  162. package/dist/input-text/error.svg +0 -1
  163. package/dist/input-text/readme.md +0 -91
  164. package/dist/layout/facebook.svg +0 -45
  165. package/dist/layout/linkedin.svg +0 -50
  166. package/dist/layout/twitter.svg +0 -53
  167. package/dist/link/readme.md +0 -51
  168. package/dist/paginator/images/next.svg +0 -3
  169. package/dist/paginator/images/nextPage.svg +0 -3
  170. package/dist/paginator/images/previous.svg +0 -3
  171. package/dist/paginator/images/previousPage.svg +0 -3
  172. package/dist/paginator/readme.md +0 -50
  173. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  174. package/dist/progress-bar/readme.md +0 -63
  175. package/dist/radio/Radio.stories.js +0 -166
  176. package/dist/radio/readme.md +0 -70
  177. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  178. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  179. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  180. package/dist/select/Select.stories.js +0 -235
  181. package/dist/select/readme.md +0 -72
  182. package/dist/slider/Slider.stories.js +0 -241
  183. package/dist/slider/readme.md +0 -64
  184. package/dist/spinner/Spinner.js +0 -214
  185. package/dist/spinner/Spinner.stories.js +0 -183
  186. package/dist/spinner/readme.md +0 -65
  187. package/dist/switch/Switch.stories.js +0 -134
  188. package/dist/switch/readme.md +0 -133
  189. package/dist/tabs/Tabs.stories.js +0 -130
  190. package/dist/tabs/readme.md +0 -78
  191. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  192. package/dist/tabs-for-sections/readme.md +0 -78
  193. package/dist/toggle/Toggle.stories.js +0 -297
  194. package/dist/toggle/readme.md +0 -80
  195. package/dist/toggle-group/ToggleGroup.js +0 -241
  196. package/dist/toggle-group/readme.md +0 -82
  197. package/dist/upload/Upload.stories.js +0 -72
  198. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  199. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  200. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  201. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  202. package/dist/upload/file-upload/audio-icon.svg +0 -4
  203. package/dist/upload/file-upload/close.svg +0 -4
  204. package/dist/upload/file-upload/file-icon.svg +0 -4
  205. package/dist/upload/file-upload/video-icon.svg +0 -4
  206. package/dist/upload/readme.md +0 -37
  207. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  208. package/dist/upload/transaction/audio-icon.svg +0 -4
  209. package/dist/upload/transaction/error-icon.svg +0 -4
  210. package/dist/upload/transaction/file-icon-err.svg +0 -4
  211. package/dist/upload/transaction/file-icon.svg +0 -4
  212. package/dist/upload/transaction/image-icon-err.svg +0 -4
  213. package/dist/upload/transaction/image-icon.svg +0 -4
  214. package/dist/upload/transaction/success-icon.svg +0 -4
  215. package/dist/upload/transaction/video-icon-err.svg +0 -4
  216. package/dist/upload/transaction/video-icon.svg +0 -4
  217. package/dist/wizard/invalid_icon.svg +0 -5
  218. package/dist/wizard/valid_icon.svg +0 -5
  219. package/dist/wizard/validation-wrong.svg +0 -6
  220. package/test/Accordion.test.js +0 -33
  221. package/test/AccordionGroup.test.js +0 -125
  222. package/test/Alert.test.js +0 -53
  223. package/test/Box.test.js +0 -10
  224. package/test/Button.test.js +0 -18
  225. package/test/Card.test.js +0 -30
  226. package/test/Checkbox.test.js +0 -45
  227. package/test/Chip.test.js +0 -25
  228. package/test/Date.test.js +0 -393
  229. package/test/Dialog.test.js +0 -23
  230. package/test/Dropdown.test.js +0 -130
  231. package/test/Footer.test.js +0 -99
  232. package/test/Header.test.js +0 -39
  233. package/test/Heading.test.js +0 -35
  234. package/test/InputText.test.js +0 -240
  235. package/test/Link.test.js +0 -43
  236. package/test/Paginator.test.js +0 -177
  237. package/test/ProgressBar.test.js +0 -35
  238. package/test/Radio.test.js +0 -37
  239. package/test/ResultsetTable.test.js +0 -330
  240. package/test/Select.test.js +0 -192
  241. package/test/Sidenav.test.js +0 -45
  242. package/test/Slider.test.js +0 -82
  243. package/test/Spinner.test.js +0 -27
  244. package/test/Switch.test.js +0 -45
  245. package/test/Table.test.js +0 -36
  246. package/test/Tabs.test.js +0 -109
  247. package/test/TabsForSections.test.js +0 -34
  248. package/test/Tag.test.js +0 -32
  249. package/test/TextArea.test.js +0 -52
  250. package/test/ToggleGroup.test.js +0 -81
  251. package/test/Upload.test.js +0 -60
  252. package/test/Wizard.test.js +0 -130
  253. package/test/mocks/pngMock.js +0 -1
  254. package/test/mocks/svgMock.js +0 -1
@@ -0,0 +1,287 @@
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 &:hover {\n background-color: ", ";\n }\n &:focus {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\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
+ error: error,
198
+ onClick: function onClick() {
199
+ return onDelete(name);
200
+ },
201
+ "aria-label": "Remove ".concat(name)
202
+ }, deleteIcon)), error && (multiple || numFiles > 1) && _react["default"].createElement(ErrorMessage, null, error))));
203
+ };
204
+
205
+ var Container = _styledComponents["default"].div(_templateObject(), function (props) {
206
+ return props.showPreview ? "8px" : "8px 8px 8px 16px";
207
+ }, function (props) {
208
+ return props.error && props.theme.errorFileItemBackgroundColor;
209
+ }, function (props) {
210
+ return props.theme.fileItemBorderRadius;
211
+ }, function (props) {
212
+ return props.mode === "file" && !props.multiple && props.numFiles === 1 ? "calc(230px - 26px)" : !props.showPreview ? "calc(320px - 26px)" : props.showPreview && "calc(320px - 18px)";
213
+ }, function (props) {
214
+ 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)";
215
+ }, function (props) {
216
+ return props.error ? props.theme.errorFileItemBorderColor : props.theme.fileItemBorderColor;
217
+ }, function (props) {
218
+ return props.theme.fileItemBorderThickness;
219
+ }, function (props) {
220
+ return props.theme.fileItemBorderStyle;
221
+ });
222
+
223
+ var FileItemContent = _styledComponents["default"].div(_templateObject2());
224
+
225
+ var FileItemContainer = _styledComponents["default"].div(_templateObject3());
226
+
227
+ var ImagePreview = _styledComponents["default"].img(_templateObject4());
228
+
229
+ var IconPreviewContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
230
+ return props.error ? props.theme.errorFileItemIconBackgroundColor : props.theme.fileItemIconBackgroundColor;
231
+ }, function (props) {
232
+ return props.error ? props.theme.errorFileItemIconColor : props.theme.fileItemIconColor;
233
+ });
234
+
235
+ var IconPreview = _styledComponents["default"].div(_templateObject6());
236
+
237
+ var FileName = _styledComponents["default"].span(_templateObject7(), function (props) {
238
+ return props.theme.fileNameFontColor;
239
+ }, function (props) {
240
+ 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)";
241
+ }, function (props) {
242
+ return props.theme.fileItemFontFamily;
243
+ }, function (props) {
244
+ return props.theme.fileItemFontSize;
245
+ }, function (props) {
246
+ return props.theme.fileItemFontWeight;
247
+ }, function (props) {
248
+ return props.theme.fileItemLineHeight;
249
+ });
250
+
251
+ var ErrorIcon = _styledComponents["default"].span(_templateObject8());
252
+
253
+ var DeleteIcon = _styledComponents["default"].button(_templateObject9(), function (props) {
254
+ return props.theme.fontFamily;
255
+ }, function (props) {
256
+ return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
257
+ }, function (props) {
258
+ return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
259
+ }, function (props) {
260
+ return props.error ? props.theme.errorActiveDeleteFileItemBackgroundColor : props.theme.activeDeleteFileItemBackgroundColor;
261
+ });
262
+
263
+ var ErrorMessage = _styledComponents["default"].span(_templateObject10(), function (props) {
264
+ return props.theme.errorMessageFontColor;
265
+ }, function (props) {
266
+ return props.theme.errorMessageFontFamily;
267
+ }, function (props) {
268
+ return props.theme.errorMessageFontSize;
269
+ }, function (props) {
270
+ return props.theme.errorMessageFontWeight;
271
+ }, function (props) {
272
+ return props.theme.errorMessageLineHeight;
273
+ });
274
+
275
+ FileItem.propTypes = {
276
+ mode: _propTypes["default"].string,
277
+ multiple: _propTypes["default"].bool,
278
+ name: _propTypes["default"].string,
279
+ type: _propTypes["default"].string,
280
+ showPreview: _propTypes["default"]["boolean"],
281
+ numFiles: _propTypes["default"].number,
282
+ preview: _propTypes["default"].string,
283
+ error: _propTypes["default"].string,
284
+ onDelete: _propTypes["default"].func
285
+ };
286
+ var _default = FileItem;
287
+ 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 DxcFileInput(props: Props): JSX.Element;
@@ -27,9 +27,23 @@ var _variables = require("../common/variables.js");
27
27
 
28
28
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
29
29
 
30
- function _templateObject12() {
30
+ var _BackgroundColorContext = require("../BackgroundColorContext.js");
31
+
32
+ var _Icons = _interopRequireDefault(require("./Icons"));
33
+
34
+ function _templateObject13() {
31
35
  var data = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: ", ";\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"]);
32
36
 
37
+ _templateObject13 = function _templateObject13() {
38
+ return data;
39
+ };
40
+
41
+ return data;
42
+ }
43
+
44
+ function _templateObject12() {
45
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px 10px;\n color: ", ";\n"]);
46
+
33
47
  _templateObject12 = function _templateObject12() {
34
48
  return data;
35
49
  };
@@ -38,7 +52,7 @@ function _templateObject12() {
38
52
  }
39
53
 
40
54
  function _templateObject11() {
41
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px 10px;\n color: ", ";\n"]);
55
+ 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"]);
42
56
 
43
57
  _templateObject11 = function _templateObject11() {
44
58
  return data;
@@ -48,7 +62,7 @@ function _templateObject11() {
48
62
  }
49
63
 
50
64
  function _templateObject10() {
51
- 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"]);
65
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n fill: ", ";\n }\n"]);
52
66
 
53
67
  _templateObject10 = function _templateObject10() {
54
68
  return data;
@@ -58,7 +72,7 @@ function _templateObject10() {
58
72
  }
59
73
 
60
74
  function _templateObject9() {
61
- var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n fill: ", ";\n }\n"]);
75
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n margin-left: ", ";\n }\n"]);
62
76
 
63
77
  _templateObject9 = function _templateObject9() {
64
78
  return data;
@@ -68,7 +82,7 @@ function _templateObject9() {
68
82
  }
69
83
 
70
84
  function _templateObject8() {
71
- var data = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n margin-left: ", ";\n }\n"]);
85
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"]);
72
86
 
73
87
  _templateObject8 = function _templateObject8() {
74
88
  return data;
@@ -78,7 +92,7 @@ function _templateObject8() {
78
92
  }
79
93
 
80
94
  function _templateObject7() {
81
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n"]);
95
+ var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"]);
82
96
 
83
97
  _templateObject7 = function _templateObject7() {
84
98
  return data;
@@ -98,7 +112,7 @@ function _templateObject6() {
98
112
  }
99
113
 
100
114
  function _templateObject5() {
101
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n min-height: 16px;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n color: ", ";\n overflow: hidden;\n"]);
115
+ 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"]);
102
116
 
103
117
  _templateObject5 = function _templateObject5() {
104
118
  return data;
@@ -118,7 +132,7 @@ function _templateObject4() {
118
132
  }
119
133
 
120
134
  function _templateObject3() {
121
- 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"]);
135
+ 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"]);
122
136
 
123
137
  _templateObject3 = function _templateObject3() {
124
138
  return data;
@@ -138,7 +152,7 @@ function _templateObject2() {
138
152
  }
139
153
 
140
154
  function _templateObject() {
141
- 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 color: ", ";\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n"]);
155
+ 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"]);
142
156
 
143
157
  _templateObject = function _templateObject() {
144
158
  return data;
@@ -154,8 +168,6 @@ var DxcFooter = function DxcFooter(_ref) {
154
168
  bottomLinks = _ref$bottomLinks === void 0 ? [] : _ref$bottomLinks,
155
169
  _ref$copyright = _ref.copyright,
156
170
  copyright = _ref$copyright === void 0 ? "" : _ref$copyright,
157
- _ref$logoSrc = _ref.logoSrc,
158
- logoSrc = _ref$logoSrc === void 0 ? "default" : _ref$logoSrc,
159
171
  children = _ref.children,
160
172
  padding = _ref.padding,
161
173
  margin = _ref.margin,
@@ -179,6 +191,20 @@ var DxcFooter = function DxcFooter(_ref) {
179
191
  setIsResponsivePhone = _useState6[1];
180
192
 
181
193
  var colorsTheme = (0, _useTheme["default"])();
194
+ var footerLogo = (0, _react.useMemo)(function () {
195
+ if (!colorsTheme.footer.logo) {
196
+ return _Icons["default"];
197
+ }
198
+
199
+ if (typeof colorsTheme.footer.logo === "string") {
200
+ return _react["default"].createElement(LogoImg, {
201
+ alt: "Logo",
202
+ src: colorsTheme.footer.logo
203
+ });
204
+ }
205
+
206
+ return colorsTheme.footer.logo;
207
+ }, [colorsTheme.footer.logo]);
182
208
 
183
209
  var handleResize = function handleResize(refWidth) {
184
210
  if (ref.current) {
@@ -234,10 +260,7 @@ var DxcFooter = function DxcFooter(_ref) {
234
260
  margin: margin,
235
261
  refSize: refSize,
236
262
  ref: ref
237
- }, _react["default"].createElement(FooterHeader, null, _react["default"].createElement(LogoIcon, {
238
- logoSrc: logoSrc,
239
- src: logoSrc === "default" ? colorsTheme.footer.logo : logoSrc
240
- }), _react["default"].createElement("div", null, socialLink)), isResponsivePhone && _react["default"].createElement("div", null, _react["default"].createElement(FooterFooter, {
263
+ }, _react["default"].createElement(FooterHeader, null, _react["default"].createElement(LogoContainer, null, footerLogo), _react["default"].createElement("div", null, socialLink)), isResponsivePhone && _react["default"].createElement("div", null, _react["default"].createElement(FooterFooter, {
241
264
  className: "footerFooter",
242
265
  refSize: refSize
243
266
  }, _react["default"].createElement(BottomLinks, {
@@ -246,7 +269,9 @@ var DxcFooter = function DxcFooter(_ref) {
246
269
  refSize: refSize
247
270
  }, copyright))), (!isResponsiveTablet && !isResponsivePhone || isResponsiveTablet) && _react["default"].createElement("div", null, _react["default"].createElement(ChildComponents, {
248
271
  padding: padding
249
- }, children), _react["default"].createElement(FooterFooter, {
272
+ }, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
273
+ color: colorsTheme.footer.backgroundColor
274
+ }, children)), _react["default"].createElement(FooterFooter, {
250
275
  className: "footerFooter"
251
276
  }, _react["default"].createElement(BottomLinks, {
252
277
  refSize: refSize
@@ -262,9 +287,7 @@ var FooterContainer = _styledComponents["default"].footer(_templateObject(), fun
262
287
  }, function (props) {
263
288
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
264
289
  }, function (props) {
265
- return props.theme.minHeight;
266
- }, function (props) {
267
- return props.theme.fontColorBase;
290
+ return props.theme.height;
268
291
  });
269
292
 
270
293
  var FooterHeader = _styledComponents["default"].div(_templateObject2());
@@ -274,11 +297,7 @@ var FooterFooter = _styledComponents["default"].div(_templateObject3(), function
274
297
  }, function (props) {
275
298
  return props.refSize <= _variables.responsiveSizes.mobileLarge ? "center" : "";
276
299
  }, function (props) {
277
- return props.theme.bottomLinksDividerThickness;
278
- }, function (props) {
279
- return props.theme.bottomLinksDividerStyle;
280
- }, function (props) {
281
- return props.theme.bottomLinksDividerColor;
300
+ return "".concat(props.theme.bottomLinksDividerThickness, " ").concat(props.theme.bottomLinksDividerStyle, " ").concat(props.theme.bottomLinksDividerColor);
282
301
  });
283
302
 
284
303
  var BottomLinks = _styledComponents["default"].div(_templateObject4(), function (props) {
@@ -292,14 +311,6 @@ var BottomLinks = _styledComponents["default"].div(_templateObject4(), function
292
311
  });
293
312
 
294
313
  var ChildComponents = _styledComponents["default"].div(_templateObject5(), function (props) {
295
- return props.theme.customContentFontFamily;
296
- }, function (props) {
297
- return props.theme.customContentFontSize;
298
- }, function (props) {
299
- return props.theme.customContentFontStyle;
300
- }, function (props) {
301
- return props.theme.customContentFontWeight;
302
- }, function (props) {
303
314
  return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
304
315
  }, function (props) {
305
316
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
@@ -309,8 +320,6 @@ var ChildComponents = _styledComponents["default"].div(_templateObject5(), funct
309
320
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
310
321
  }, function (props) {
311
322
  return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
312
- }, function (props) {
313
- return props.theme.customContentFontColor;
314
323
  });
315
324
 
316
325
  var Copyright = _styledComponents["default"].div(_templateObject6(), function (props) {
@@ -333,40 +342,46 @@ var Copyright = _styledComponents["default"].div(_templateObject6(), function (p
333
342
  return props.theme.bottomLinksDividerSpacing;
334
343
  });
335
344
 
336
- var LogoIcon = _styledComponents["default"].img(_templateObject7(), function (props) {
345
+ var LogoContainer = _styledComponents["default"].div(_templateObject7(), function (props) {
337
346
  return props.theme.logoHeight;
338
347
  }, function (props) {
339
348
  return props.theme.logoWidth;
340
349
  });
341
350
 
342
- var SocialAnchor = _styledComponents["default"].a(_templateObject8(), function (props) {
343
- return props.index === 0 ? "0px" : props.theme.socialIconsGutter;
351
+ var LogoImg = _styledComponents["default"].img(_templateObject8(), function (props) {
352
+ return props.theme.logoHeight;
353
+ }, function (props) {
354
+ return props.theme.logoWidth;
355
+ });
356
+
357
+ var SocialAnchor = _styledComponents["default"].a(_templateObject9(), function (props) {
358
+ return props.index === 0 ? "0px" : props.theme.socialLinksGutter;
344
359
  });
345
360
 
346
- var SocialIcon = _styledComponents["default"].img(_templateObject9(), function (props) {
347
- return props.theme.socialIconSize;
361
+ var SocialIcon = _styledComponents["default"].img(_templateObject10(), function (props) {
362
+ return props.theme.socialLinksSize;
348
363
  }, function (props) {
349
- return props.theme.socialIconSize;
364
+ return props.theme.socialLinksSize;
350
365
  }, function (props) {
351
- return props.theme.fontColorBase;
366
+ return props.theme.socialLinksColor;
352
367
  });
353
368
 
354
- var SocialIconContainer = _styledComponents["default"].div(_templateObject10(), function (props) {
355
- return props.theme.socialIconSize;
369
+ var SocialIconContainer = _styledComponents["default"].div(_templateObject11(), function (props) {
370
+ return props.theme.socialLinksSize;
356
371
  }, function (props) {
357
- return props.theme.socialIconSize;
372
+ return props.theme.socialLinksSize;
358
373
  }, function (props) {
359
- return props.theme.fontColorBase;
374
+ return props.theme.socialLinksColor;
360
375
  });
361
376
 
362
- var Point = _styledComponents["default"].span(_templateObject11(), function (props) {
377
+ var Point = _styledComponents["default"].span(_templateObject12(), function (props) {
363
378
  return props.theme.bottomLinksFontColor;
364
379
  });
365
380
 
366
- var BottomLink = _styledComponents["default"].a(_templateObject12(), function (props) {
381
+ var BottomLink = _styledComponents["default"].a(_templateObject13(), function (props) {
367
382
  return props.theme.bottomLinksTextDecoration;
368
383
  }, function (props) {
369
- return props.theme.bottomLinksFontColor || props.theme.fontColorBase;
384
+ return props.theme.bottomLinksFontColor;
370
385
  }, function (props) {
371
386
  return props.theme.bottomLinksFontFamily;
372
387
  }, function (props) {
@@ -378,7 +393,6 @@ var BottomLink = _styledComponents["default"].a(_templateObject12(), function (p
378
393
  });
379
394
 
380
395
  DxcFooter.propTypes = {
381
- logoSrc: _propTypes["default"].string,
382
396
  socialLinks: _propTypes["default"].arrayOf(_propTypes["default"].shape({
383
397
  logo: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
384
398
  logoSrc: _propTypes["default"].string.isRequired,