@dxc-technology/halstack-react 0.0.0-e1c85bf → 0.0.0-e3641f4

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 (321) hide show
  1. package/BackgroundColorContext.js +50 -0
  2. package/ThemeContext.js +246 -0
  3. package/{dist/select/Select.js → V3Select/V3Select.js} +38 -132
  4. package/V3Select/index.d.ts +27 -0
  5. package/{dist/textarea/Textarea.js → V3Textarea/V3Textarea.js} +14 -18
  6. package/V3Textarea/index.d.ts +27 -0
  7. package/accordion/Accordion.d.ts +4 -0
  8. package/{dist/accordion → accordion}/Accordion.js +35 -130
  9. package/accordion/types.d.ts +68 -0
  10. package/accordion/types.js +5 -0
  11. package/accordion-group/AccordionGroup.d.ts +7 -0
  12. package/accordion-group/AccordionGroup.js +170 -0
  13. package/accordion-group/types.d.ts +72 -0
  14. package/accordion-group/types.js +5 -0
  15. package/alert/Alert.d.ts +4 -0
  16. package/{dist/alert → alert}/Alert.js +41 -154
  17. package/alert/Alert.stories.tsx +170 -0
  18. package/alert/types.d.ts +49 -0
  19. package/alert/types.js +5 -0
  20. package/badge/Badge.js +59 -0
  21. package/box/Box.d.ts +4 -0
  22. package/{dist/box → box}/Box.js +18 -45
  23. package/box/Box.stories.tsx +132 -0
  24. package/box/types.d.ts +47 -0
  25. package/box/types.js +5 -0
  26. package/button/Button.d.ts +4 -0
  27. package/{dist/button → button}/Button.js +23 -84
  28. package/button/Button.stories.tsx +276 -0
  29. package/button/types.d.ts +57 -0
  30. package/button/types.js +5 -0
  31. package/card/Card.d.ts +4 -0
  32. package/{dist/card → card}/Card.js +32 -121
  33. package/card/types.d.ts +69 -0
  34. package/card/types.js +5 -0
  35. package/checkbox/Checkbox.d.ts +4 -0
  36. package/{dist/checkbox → checkbox}/Checkbox.js +16 -63
  37. package/checkbox/Checkbox.stories.tsx +192 -0
  38. package/checkbox/types.d.ts +60 -0
  39. package/checkbox/types.js +5 -0
  40. package/{dist/chip → chip}/Chip.js +17 -61
  41. package/chip/index.d.ts +22 -0
  42. package/{dist/common → common}/OpenSans.css +0 -0
  43. package/{dist/common → common}/RequiredComponent.js +3 -11
  44. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  45. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  46. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  47. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  48. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  49. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  50. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  51. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  52. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  53. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  54. package/{dist/common → common}/utils.js +0 -0
  55. package/{dist/common → common}/variables.js +255 -119
  56. package/{dist/date → date}/Date.js +16 -22
  57. package/date/index.d.ts +27 -0
  58. package/date-input/DateInput.d.ts +4 -0
  59. package/{dist/new-date/NewDate.js → date-input/DateInput.js} +55 -94
  60. package/date-input/DateInput.stories.tsx +138 -0
  61. package/date-input/types.d.ts +100 -0
  62. package/date-input/types.js +5 -0
  63. package/dialog/Dialog.d.ts +4 -0
  64. package/{dist/dialog → dialog}/Dialog.js +20 -73
  65. package/dialog/types.d.ts +43 -0
  66. package/dialog/types.js +5 -0
  67. package/dropdown/Dropdown.d.ts +4 -0
  68. package/{dist/dropdown → dropdown}/Dropdown.js +44 -171
  69. package/dropdown/types.d.ts +89 -0
  70. package/dropdown/types.js +5 -0
  71. package/{dist/file-input → file-input}/FileInput.js +53 -162
  72. package/file-input/FileItem.js +193 -0
  73. package/{dist/file-input → file-input}/index.d.ts +1 -1
  74. package/footer/Footer.d.ts +4 -0
  75. package/footer/Footer.js +266 -0
  76. package/footer/Footer.stories.jsx +151 -0
  77. package/footer/Icons.js +77 -0
  78. package/footer/types.d.ts +61 -0
  79. package/footer/types.js +5 -0
  80. package/header/Header.d.ts +7 -0
  81. package/header/Header.js +324 -0
  82. package/header/Icons.js +34 -0
  83. package/header/types.d.ts +45 -0
  84. package/header/types.js +5 -0
  85. package/{dist/heading → heading}/Heading.js +30 -72
  86. package/heading/index.d.ts +17 -0
  87. package/input-text/Icons.js +22 -0
  88. package/{dist/input-text → input-text}/InputText.js +37 -133
  89. package/input-text/index.d.ts +36 -0
  90. package/{dist/layout → layout}/ApplicationLayout.js +35 -131
  91. package/layout/Icons.js +55 -0
  92. package/link/Link.d.ts +3 -0
  93. package/{dist/link → link}/Link.js +18 -94
  94. package/link/Link.stories.tsx +70 -0
  95. package/link/types.d.ts +74 -0
  96. package/link/types.js +5 -0
  97. package/main.d.ts +44 -0
  98. package/{dist/main.js → main.js} +100 -96
  99. package/number-input/NumberInput.d.ts +4 -0
  100. package/number-input/NumberInput.js +86 -0
  101. package/number-input/NumberInput.stories.tsx +115 -0
  102. package/{dist/number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
  103. package/number-input/types.d.ts +117 -0
  104. package/number-input/types.js +5 -0
  105. package/package.json +32 -25
  106. package/paginator/Icons.js +66 -0
  107. package/paginator/Paginator.d.ts +4 -0
  108. package/paginator/Paginator.js +198 -0
  109. package/paginator/Paginator.stories.tsx +63 -0
  110. package/paginator/types.d.ts +38 -0
  111. package/paginator/types.js +5 -0
  112. package/password-input/PasswordInput.d.ts +4 -0
  113. package/{dist/password/Password.js → password-input/PasswordInput.js} +26 -64
  114. package/password-input/PasswordInput.stories.tsx +131 -0
  115. package/password-input/types.d.ts +100 -0
  116. package/password-input/types.js +5 -0
  117. package/progress-bar/ProgressBar.d.ts +4 -0
  118. package/{dist/progress-bar → progress-bar}/ProgressBar.js +20 -92
  119. package/progress-bar/ProgressBar.stories.jsx +58 -0
  120. package/progress-bar/types.d.ts +37 -0
  121. package/progress-bar/types.js +5 -0
  122. package/radio/Radio.d.ts +4 -0
  123. package/{dist/radio → radio}/Radio.js +15 -50
  124. package/radio/Radio.stories.tsx +192 -0
  125. package/radio/types.d.ts +54 -0
  126. package/radio/types.js +5 -0
  127. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +35 -119
  128. package/resultsetTable/index.d.ts +19 -0
  129. package/select/Select.js +865 -0
  130. package/select/index.d.ts +131 -0
  131. package/{dist/sidenav → sidenav}/Sidenav.js +15 -49
  132. package/sidenav/index.d.ts +13 -0
  133. package/slider/Slider.d.ts +4 -0
  134. package/slider/Slider.js +317 -0
  135. package/slider/Slider.stories.tsx +172 -0
  136. package/slider/types.d.ts +78 -0
  137. package/slider/types.js +5 -0
  138. package/spinner/Spinner.d.ts +4 -0
  139. package/spinner/Spinner.js +250 -0
  140. package/spinner/Spinner.stories.jsx +102 -0
  141. package/spinner/types.d.ts +32 -0
  142. package/spinner/types.js +5 -0
  143. package/switch/Switch.d.ts +4 -0
  144. package/{dist/switch → switch}/Switch.js +26 -69
  145. package/switch/Switch.stories.tsx +160 -0
  146. package/switch/types.d.ts +58 -0
  147. package/switch/types.js +5 -0
  148. package/table/Table.d.ts +4 -0
  149. package/{dist/table → table}/Table.js +10 -24
  150. package/table/Table.stories.jsx +276 -0
  151. package/table/types.d.ts +21 -0
  152. package/table/types.js +5 -0
  153. package/tabs/Tabs.d.ts +4 -0
  154. package/tabs/Tabs.js +211 -0
  155. package/tabs/types.d.ts +71 -0
  156. package/tabs/types.js +5 -0
  157. package/tag/Tag.d.ts +4 -0
  158. package/tag/Tag.js +193 -0
  159. package/tag/Tag.stories.tsx +145 -0
  160. package/tag/types.d.ts +60 -0
  161. package/tag/types.js +5 -0
  162. package/{dist/new-input-text/NewInputText.js → text-input/TextInput.js} +270 -427
  163. package/{dist/new-input-text → text-input}/index.d.ts +3 -3
  164. package/{dist/new-textarea/NewTextarea.js → textarea/Textarea.js} +31 -76
  165. package/textarea/Textarea.stories.jsx +135 -0
  166. package/{dist/new-textarea → textarea}/index.d.ts +1 -1
  167. package/{dist/toggle → toggle}/Toggle.js +15 -49
  168. package/toggle/index.d.ts +21 -0
  169. package/toggle-group/ToggleGroup.js +243 -0
  170. package/toggle-group/index.d.ts +21 -0
  171. package/{dist/upload → upload}/Upload.js +11 -15
  172. package/upload/buttons-upload/ButtonsUpload.js +111 -0
  173. package/upload/buttons-upload/Icons.js +40 -0
  174. package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
  175. package/upload/dragAndDropArea/Icons.js +39 -0
  176. package/upload/file-upload/FileToUpload.js +115 -0
  177. package/upload/file-upload/Icons.js +66 -0
  178. package/{dist/upload → upload}/files-upload/FilesToUpload.js +12 -26
  179. package/upload/index.d.ts +15 -0
  180. package/upload/transaction/Icons.js +160 -0
  181. package/upload/transaction/Transaction.js +104 -0
  182. package/upload/transactions/Transactions.js +94 -0
  183. package/{dist/useTheme.js → useTheme.js} +0 -0
  184. package/wizard/Icons.js +65 -0
  185. package/{dist/wizard → wizard}/Wizard.js +32 -172
  186. package/wizard/index.d.ts +18 -0
  187. package/README.md +0 -66
  188. package/babel.config.js +0 -8
  189. package/dist/BackgroundColorContext.js +0 -46
  190. package/dist/ThemeContext.js +0 -248
  191. package/dist/accordion-group/AccordionGroup.js +0 -186
  192. package/dist/alert/index.d.ts +0 -51
  193. package/dist/badge/Badge.js +0 -63
  194. package/dist/checkbox/Checkbox.stories.js +0 -144
  195. package/dist/checkbox/readme.md +0 -116
  196. package/dist/date/Date.stories.js +0 -205
  197. package/dist/date/readme.md +0 -73
  198. package/dist/file-input/FileItem.js +0 -265
  199. package/dist/footer/Footer.js +0 -395
  200. package/dist/footer/Footer.stories.js +0 -94
  201. package/dist/footer/dxc_logo.svg +0 -15
  202. package/dist/footer/readme.md +0 -41
  203. package/dist/header/Header.js +0 -403
  204. package/dist/header/Header.stories.js +0 -176
  205. package/dist/header/close_icon.svg +0 -1
  206. package/dist/header/dxc_logo_black.svg +0 -8
  207. package/dist/header/hamb_menu_black.svg +0 -1
  208. package/dist/header/hamb_menu_white.svg +0 -1
  209. package/dist/header/readme.md +0 -33
  210. package/dist/input-text/InputText.stories.js +0 -209
  211. package/dist/input-text/error.svg +0 -1
  212. package/dist/input-text/readme.md +0 -91
  213. package/dist/layout/facebook.svg +0 -45
  214. package/dist/layout/linkedin.svg +0 -50
  215. package/dist/layout/twitter.svg +0 -53
  216. package/dist/link/readme.md +0 -51
  217. package/dist/main.d.ts +0 -7
  218. package/dist/new-date/index.d.ts +0 -95
  219. package/dist/number/Number.js +0 -138
  220. package/dist/number/index.d.ts +0 -113
  221. package/dist/paginator/Paginator.js +0 -289
  222. package/dist/paginator/images/next.svg +0 -3
  223. package/dist/paginator/images/nextPage.svg +0 -3
  224. package/dist/paginator/images/previous.svg +0 -3
  225. package/dist/paginator/images/previousPage.svg +0 -3
  226. package/dist/paginator/readme.md +0 -50
  227. package/dist/password/index.d.ts +0 -94
  228. package/dist/password/styles.css +0 -3
  229. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  230. package/dist/progress-bar/readme.md +0 -63
  231. package/dist/radio/Radio.stories.js +0 -166
  232. package/dist/radio/readme.md +0 -70
  233. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  234. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  235. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  236. package/dist/slider/Slider.js +0 -319
  237. package/dist/slider/Slider.stories.js +0 -241
  238. package/dist/slider/readme.md +0 -64
  239. package/dist/spinner/Spinner.js +0 -381
  240. package/dist/spinner/Spinner.stories.js +0 -183
  241. package/dist/spinner/readme.md +0 -65
  242. package/dist/switch/Switch.stories.js +0 -134
  243. package/dist/switch/readme.md +0 -133
  244. package/dist/tabs/Tabs.js +0 -343
  245. package/dist/tabs/Tabs.stories.js +0 -130
  246. package/dist/tabs/readme.md +0 -78
  247. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  248. package/dist/tabs-for-sections/readme.md +0 -78
  249. package/dist/tag/Tag.js +0 -282
  250. package/dist/toggle/Toggle.stories.js +0 -297
  251. package/dist/toggle/readme.md +0 -80
  252. package/dist/toggle-group/ToggleGroup.js +0 -223
  253. package/dist/upload/Upload.stories.js +0 -72
  254. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
  255. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  256. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  257. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  258. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  259. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  260. package/dist/upload/file-upload/FileToUpload.js +0 -184
  261. package/dist/upload/file-upload/audio-icon.svg +0 -4
  262. package/dist/upload/file-upload/close.svg +0 -4
  263. package/dist/upload/file-upload/file-icon.svg +0 -4
  264. package/dist/upload/file-upload/video-icon.svg +0 -4
  265. package/dist/upload/readme.md +0 -37
  266. package/dist/upload/transaction/Transaction.js +0 -175
  267. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  268. package/dist/upload/transaction/audio-icon.svg +0 -4
  269. package/dist/upload/transaction/error-icon.svg +0 -4
  270. package/dist/upload/transaction/file-icon-err.svg +0 -4
  271. package/dist/upload/transaction/file-icon.svg +0 -4
  272. package/dist/upload/transaction/image-icon-err.svg +0 -4
  273. package/dist/upload/transaction/image-icon.svg +0 -4
  274. package/dist/upload/transaction/success-icon.svg +0 -4
  275. package/dist/upload/transaction/video-icon-err.svg +0 -4
  276. package/dist/upload/transaction/video-icon.svg +0 -4
  277. package/dist/upload/transactions/Transactions.js +0 -138
  278. package/dist/wizard/invalid_icon.svg +0 -5
  279. package/dist/wizard/valid_icon.svg +0 -5
  280. package/dist/wizard/validation-wrong.svg +0 -6
  281. package/test/Accordion.test.js +0 -33
  282. package/test/AccordionGroup.test.js +0 -125
  283. package/test/Alert.test.js +0 -53
  284. package/test/Box.test.js +0 -10
  285. package/test/Button.test.js +0 -18
  286. package/test/Card.test.js +0 -30
  287. package/test/Checkbox.test.js +0 -45
  288. package/test/Chip.test.js +0 -25
  289. package/test/Date.test.js +0 -393
  290. package/test/Dialog.test.js +0 -23
  291. package/test/Dropdown.test.js +0 -145
  292. package/test/FileInput.test.js +0 -201
  293. package/test/Footer.test.js +0 -99
  294. package/test/Header.test.js +0 -39
  295. package/test/Heading.test.js +0 -35
  296. package/test/InputText.test.js +0 -240
  297. package/test/Link.test.js +0 -43
  298. package/test/NewDate.test.js +0 -232
  299. package/test/NewInputText.test.js +0 -734
  300. package/test/NewTextarea.test.js +0 -195
  301. package/test/Number.test.js +0 -257
  302. package/test/Paginator.test.js +0 -177
  303. package/test/Password.test.js +0 -83
  304. package/test/ProgressBar.test.js +0 -35
  305. package/test/Radio.test.js +0 -37
  306. package/test/ResultsetTable.test.js +0 -329
  307. package/test/Select.test.js +0 -212
  308. package/test/Sidenav.test.js +0 -45
  309. package/test/Slider.test.js +0 -82
  310. package/test/Spinner.test.js +0 -32
  311. package/test/Switch.test.js +0 -45
  312. package/test/Table.test.js +0 -36
  313. package/test/Tabs.test.js +0 -109
  314. package/test/TabsForSections.test.js +0 -34
  315. package/test/Tag.test.js +0 -32
  316. package/test/TextArea.test.js +0 -52
  317. package/test/ToggleGroup.test.js +0 -81
  318. package/test/Upload.test.js +0 -60
  319. package/test/Wizard.test.js +0 -130
  320. package/test/mocks/pngMock.js +0 -1
  321. package/test/mocks/svgMock.js +0 -1
@@ -0,0 +1,324 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
16
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
+
18
+ var _react = _interopRequireWildcard(require("react"));
19
+
20
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
+
22
+ var _AppBar = _interopRequireDefault(require("@material-ui/core/AppBar"));
23
+
24
+ var _Dropdown = _interopRequireDefault(require("../dropdown/Dropdown"));
25
+
26
+ var _Icons = require("./Icons");
27
+
28
+ var _variables = require("../common/variables.js");
29
+
30
+ var _useTheme = _interopRequireDefault(require("../useTheme.js"));
31
+
32
+ var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext.js"));
33
+
34
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
35
+
36
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
+
38
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
39
+
40
+ var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
41
+ xmlns: "http://www.w3.org/2000/svg",
42
+ height: "24",
43
+ viewBox: "0 0 24 24",
44
+ width: "24"
45
+ }, /*#__PURE__*/_react["default"].createElement("path", {
46
+ 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 12z"
47
+ }), /*#__PURE__*/_react["default"].createElement("path", {
48
+ d: "M0 0h24v24H0z",
49
+ fill: "none"
50
+ }));
51
+
52
+ var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
53
+ xmlns: "http://www.w3.org/2000/svg",
54
+ viewBox: "0 0 24 24",
55
+ width: "24",
56
+ height: "24"
57
+ }, /*#__PURE__*/_react["default"].createElement("path", {
58
+ d: "M3,8H21a1,1,0,0,0,0-2H3A1,1,0,0,0,3,8Zm18,8H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Zm0-5H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Z"
59
+ }));
60
+
61
+ var Dropdown = function Dropdown(props) {
62
+ return /*#__PURE__*/_react["default"].createElement(HeaderDropdown, null, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], props));
63
+ };
64
+
65
+ var HeaderDropdown = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n button {\n background-color: transparent;\n :hover {\n background-color: transparent;\n }\n }\n"])));
66
+
67
+ var getLogoElement = function getLogoElement(themeInput) {
68
+ if (!themeInput) {
69
+ return _Icons.dxcLogo;
70
+ }
71
+
72
+ if (typeof themeInput === "string") {
73
+ return /*#__PURE__*/_react["default"].createElement(LogoImg, {
74
+ alt: "Logo",
75
+ src: themeInput
76
+ });
77
+ }
78
+
79
+ return themeInput;
80
+ };
81
+
82
+ var DxcHeader = function DxcHeader(_ref) {
83
+ var _ref$underlined = _ref.underlined,
84
+ underlined = _ref$underlined === void 0 ? false : _ref$underlined,
85
+ content = _ref.content,
86
+ responsiveContent = _ref.responsiveContent,
87
+ onClick = _ref.onClick,
88
+ margin = _ref.margin,
89
+ padding = _ref.padding,
90
+ _ref$tabIndex = _ref.tabIndex,
91
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
92
+ var colorsTheme = (0, _useTheme["default"])();
93
+ var ref = (0, _react.useRef)(null);
94
+
95
+ var _useState = (0, _react.useState)(),
96
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
97
+ refSize = _useState2[0],
98
+ setRefSize = _useState2[1];
99
+
100
+ var _useState3 = (0, _react.useState)(false),
101
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
102
+ isResponsive = _useState4[0],
103
+ setIsResponsive = _useState4[1];
104
+
105
+ var _useState5 = (0, _react.useState)(false),
106
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
107
+ isMenuVisible = _useState6[0],
108
+ setIsMenuVisible = _useState6[1];
109
+
110
+ var handleResize = function handleResize(refWidth) {
111
+ if (refWidth) {
112
+ setRefSize(refWidth);
113
+
114
+ if (refWidth <= _variables.responsiveSizes.tablet && !isResponsive) {
115
+ setIsResponsive(true);
116
+ } else {
117
+ setIsResponsive(false);
118
+ }
119
+ }
120
+ };
121
+
122
+ var ContentContainerComponent = function ContentContainerComponent() {
123
+ var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
124
+ return isResponsive && /*#__PURE__*/_react["default"].createElement(MenuContent, {
125
+ backgroundType: backgroundType
126
+ }, responsiveContent(handleMenu)) || /*#__PURE__*/_react["default"].createElement(ContentContainer, {
127
+ padding: padding,
128
+ backgroundType: backgroundType
129
+ }, content);
130
+ };
131
+
132
+ var handleMenu = function handleMenu() {
133
+ if (isResponsive && !isMenuVisible) {
134
+ setIsMenuVisible(!isMenuVisible);
135
+ } else {
136
+ setIsMenuVisible(!isMenuVisible);
137
+ }
138
+ };
139
+
140
+ var headerLogo = (0, _react.useMemo)(function () {
141
+ return getLogoElement(colorsTheme.header.logo);
142
+ }, [colorsTheme.header.logo]);
143
+ var headerResponsiveLogo = (0, _react.useMemo)(function () {
144
+ return getLogoElement(colorsTheme.header.logoResponsive);
145
+ }, [colorsTheme.header.logoResponsive]);
146
+
147
+ var handleEventListener = function handleEventListener() {
148
+ handleResize(ref.current.offsetWidth);
149
+ };
150
+
151
+ (0, _react.useEffect)(function () {
152
+ if (ref.current) {
153
+ window.addEventListener("resize", handleEventListener);
154
+ handleResize(ref.current.offsetWidth);
155
+ }
156
+
157
+ return function () {
158
+ window.removeEventListener("resize", handleEventListener);
159
+ };
160
+ }, []);
161
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
162
+ theme: colorsTheme.header
163
+ }, /*#__PURE__*/_react["default"].createElement(HeaderContainer, {
164
+ $underlined: underlined,
165
+ position: "static",
166
+ margin: margin,
167
+ ref: ref
168
+ }, /*#__PURE__*/_react["default"].createElement(LogoAnchor, {
169
+ tabIndex: typeof onClick === "function" ? tabIndex : -1,
170
+ interactuable: typeof onClick === "function",
171
+ onClick: onClick
172
+ }, /*#__PURE__*/_react["default"].createElement(LogoContainer, null, headerLogo)), isResponsive && responsiveContent && /*#__PURE__*/_react["default"].createElement(MainContainer, null, /*#__PURE__*/_react["default"].createElement(ChildContainer, {
173
+ padding: padding
174
+ }, /*#__PURE__*/_react["default"].createElement(HamburguerItem, {
175
+ tabIndex: tabIndex,
176
+ underlined: underlined,
177
+ onClick: handleMenu
178
+ }, hamburgerIcon, /*#__PURE__*/_react["default"].createElement(HamburguerTitle, null, "Menu"))), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(ResponsiveMenu, {
179
+ hasVisibility: isMenuVisible,
180
+ refSize: refSize
181
+ }, /*#__PURE__*/_react["default"].createElement(ResponsiveLogoContainer, null, headerResponsiveLogo), /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
182
+ color: colorsTheme.header.menuBackgroundColor
183
+ }, /*#__PURE__*/_react["default"].createElement(ContentContainerComponent, null)), /*#__PURE__*/_react["default"].createElement(CloseContainer, {
184
+ tabIndex: tabIndex,
185
+ onClick: handleMenu,
186
+ className: "closeIcon"
187
+ }, closeIcon)), /*#__PURE__*/_react["default"].createElement(Overlay, {
188
+ onClick: handleMenu,
189
+ hasVisibility: isMenuVisible,
190
+ refSize: refSize
191
+ }))), !isResponsive && /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
192
+ color: colorsTheme.header.backgroundColor
193
+ }, /*#__PURE__*/_react["default"].createElement(ContentContainerComponent, null))));
194
+ };
195
+
196
+ DxcHeader.Dropdown = Dropdown;
197
+ var HeaderContainer = (0, _styledComponents["default"])(_AppBar["default"])(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n margin-bottom: ", ";\n\n &.MuiAppBar-colorPrimary {\n background-color: ", ";\n border-bottom: ", ";\n\n &.MuiPaper-elevation4 {\n box-shadow: none;\n }\n .ChildComponents {\n display: flex;\n align-items: center;\n }\n }\n & {\n min-height: ", ";\n }\n &.MuiAppBar-root {\n flex-direction: row;\n align-items: center;\n padding: ", ";\n justify-content: space-between;\n }\n"])), function (props) {
198
+ return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
199
+ }, function (props) {
200
+ return props.theme.backgroundColor;
201
+ }, function (props) {
202
+ return props.$underlined && "".concat(props.theme.underlinedThickness, " ").concat(props.theme.underlinedStyle, " ").concat(props.theme.underlinedColor);
203
+ }, function (props) {
204
+ return props.theme.minHeight;
205
+ }, function (props) {
206
+ return "".concat(props.theme.paddingTop, " ").concat(props.theme.paddingRight, " ").concat(props.theme.paddingBottom, " ").concat(props.theme.paddingLeft);
207
+ });
208
+
209
+ var LogoAnchor = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n"])), function (props) {
210
+ if (!props.interactuable) {
211
+ return "cursor: default; outline:none;";
212
+ }
213
+
214
+ return "cursor: pointer;";
215
+ });
216
+
217
+ var LogoImg = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"])), function (props) {
218
+ return props.theme.logoHeight;
219
+ }, function (props) {
220
+ return props.theme.logoWidth;
221
+ });
222
+
223
+ var LogoContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n vertical-align: middle;\n"])), function (props) {
224
+ return props.theme.logoHeight;
225
+ }, function (props) {
226
+ return props.theme.logoWidth;
227
+ });
228
+
229
+ var ChildContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: calc(100% - 186px);\n display: flex;\n align-items: center;\n flex-grow: 1;\n\n justify-content: flex-end;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
230
+ return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
231
+ }, function (props) {
232
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
233
+ }, function (props) {
234
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.right ? _variables.spaces[props.padding.right] : "";
235
+ }, function (props) {
236
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
237
+ }, function (props) {
238
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
239
+ });
240
+
241
+ var ContentContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n width: calc(100% - 186px);\n display: flex;\n align-items: center;\n flex-grow: 1;\n color: ", ";\n\n justify-content: flex-end;\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
242
+ return props.backgroundType === "dark" ? props.theme.contentColorOnDark : props.theme.contentColor;
243
+ }, function (props) {
244
+ return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
245
+ }, function (props) {
246
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
247
+ }, function (props) {
248
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.right ? _variables.spaces[props.padding.right] : "";
249
+ }, function (props) {
250
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
251
+ }, function (props) {
252
+ return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
253
+ });
254
+
255
+ var HamburguerItem = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 54px;\n cursor: pointer;\n :hover {\n background-color: ", ";\n }\n &:focus {\n outline: ", " auto 1px;\n }\n & > svg {\n fill: ", ";\n }\n"])), function (props) {
256
+ return props.theme.hamburguerHoverColor;
257
+ }, function (props) {
258
+ return props.theme.hamburguerFocusColor;
259
+ }, function (props) {
260
+ return props.theme.hamburguerIconColor;
261
+ });
262
+
263
+ var HamburguerTitle = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n text-transform: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (props) {
264
+ return props.theme.hamburguerFontFamily;
265
+ }, function (props) {
266
+ return props.theme.hamburguerFontStyle;
267
+ }, function (props) {
268
+ return props.theme.hamburguerFontSize;
269
+ }, function (props) {
270
+ return props.theme.hamburguerTextTransform;
271
+ }, function (props) {
272
+ return props.theme.hamburguerFontWeight;
273
+ }, function (props) {
274
+ return props.theme.hamburguerFontColor;
275
+ });
276
+
277
+ var MainContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-grow: 1;\n"])));
278
+
279
+ var ResponsiveMenu = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-evenly;\n background-color: ", ";\n position: fixed;\n top: 0;\n right: 0;\n z-index: ", ";\n width: ", ";\n height: 100vh;\n padding: 20px;\n transform: ", ";\n opacity: ", ";\n transition-property: transform, opacity;\n transition-duration: 0.6s;\n transition-timing-function: ease-in-out;\n box-sizing: border-box;\n"])), function (props) {
280
+ return props.theme.menuBackgroundColor;
281
+ }, function (props) {
282
+ return props.theme.menuZindex;
283
+ }, function (props) {
284
+ return props.refSize <= _variables.responsiveSizes.laptop && props.refSize > _variables.responsiveSizes.mobileLarge ? "".concat(function (props) {
285
+ return props.theme.menuTabletWidth;
286
+ }) : "".concat(function (props) {
287
+ return props.theme.menuMobileWidth;
288
+ });
289
+ }, function (props) {
290
+ return props.hasVisibility ? "translateX(0)" : "translateX(100vw)";
291
+ }, function (props) {
292
+ return props.hasVisibility ? "1" : "0.96";
293
+ });
294
+
295
+ var ResponsiveLogoContainer = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n position: absolute;\n top: 23px;\n left: 20px;\n"])), function (props) {
296
+ return props.theme.logoHeight;
297
+ }, function (props) {
298
+ return props.theme.logoWidth;
299
+ });
300
+
301
+ var CloseContainer = _styledComponents["default"].div(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n cursor: pointer;\n :focus {\n outline: ", " auto 1px;\n }\n position: fixed;\n top: 23px;\n right: 20px;\n width: 24px;\n height: 24px;\n padding: ", ";\n"])), function (props) {
302
+ return props.theme.hamburguerFocusColor;
303
+ }, _variables.spaces.xxsmall);
304
+
305
+ var MenuContent = _styledComponents["default"].div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n height: 100%;\n margin-top: 40px;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n color: ", ";\n"])), function (props) {
306
+ return props.backgroundType === "dark" ? props.theme.contentColorOnDark : props.theme.contentColor;
307
+ });
308
+
309
+ var Overlay = _styledComponents["default"].div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: ", ";\n opacity: ", " !important;\n visibility: ", ";\n opacity: ", ";\n display: ", ";\n transition: opacity 0.2s 0.2s ease-in-out;\n z-index: ", ";\n"])), function (props) {
310
+ return props.theme.overlayColor;
311
+ }, function (props) {
312
+ return props.theme.overlayOpacity;
313
+ }, function (props) {
314
+ return props.hasVisibility ? "visible" : "hidden";
315
+ }, function (props) {
316
+ return props.hasVisibility ? "1" : "0";
317
+ }, function (props) {
318
+ return props.refSize <= _variables.responsiveSizes.mobileLarge ? "none" : "";
319
+ }, function (props) {
320
+ return props.theme.overlayZindex;
321
+ });
322
+
323
+ var _default = DxcHeader;
324
+ exports["default"] = _default;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.dxcLogo = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: "73",
15
+ height: "40",
16
+ viewBox: "0 0 73 40"
17
+ }, /*#__PURE__*/_react["default"].createElement("title", null, "DXC Logo"), /*#__PURE__*/_react["default"].createElement("g", {
18
+ id: "g10",
19
+ transform: "translate(0)"
20
+ }, /*#__PURE__*/_react["default"].createElement("g", {
21
+ id: "g12"
22
+ }, /*#__PURE__*/_react["default"].createElement("path", {
23
+ id: "path14",
24
+ d: "M91.613-28.177v2.514H90.231V-28.15l-2.415-3.82h1.616l1.5,2.532,1.526-2.532h1.571ZM83.9-25.555A3.15,3.15,0,0,1,80.6-28.8v-.018a3.231,3.231,0,0,1,3.294-3.262,3.442,3.442,0,0,1,2.469.865l-.87,1.054a2.311,2.311,0,0,0-1.643-.64,1.891,1.891,0,0,0-1.8,1.964v.018a1.886,1.886,0,0,0,1.9,2,2.2,2.2,0,0,0,1.3-.378v-.9H83.858v-1.2h2.729v2.738A4.071,4.071,0,0,1,83.9-25.555Zm-6.416-3.261a1.913,1.913,0,0,0-1.9-1.982A1.883,1.883,0,0,0,73.7-28.835v.018a1.913,1.913,0,0,0,1.9,1.982A1.883,1.883,0,0,0,77.486-28.8Zm-1.9,3.261a3.225,3.225,0,0,1-3.33-3.243v-.018A3.255,3.255,0,0,1,75.6-32.078a3.225,3.225,0,0,1,3.331,3.243v.018A3.255,3.255,0,0,1,75.583-25.555Zm-9.173-.108V-31.97h1.382v5.045h3.133v1.261Zm-3.433-3.153a1.913,1.913,0,0,0-1.9-1.982,1.883,1.883,0,0,0-1.886,1.964v.018a1.913,1.913,0,0,0,1.9,1.982A1.883,1.883,0,0,0,62.978-28.8Zm-1.9,3.261a3.225,3.225,0,0,1-3.33-3.243v-.018a3.255,3.255,0,0,1,3.348-3.262,3.225,3.225,0,0,1,3.331,3.243v.018A3.255,3.255,0,0,1,61.075-25.555Zm-6.508-.108-3.043-4.009v4.009H50.159V-31.97h1.275l2.944,3.883V-31.97h1.364v6.306Zm-8.246,0v-2.531h-2.55v2.531H42.389V-31.97h1.382v2.5h2.55v-2.5H47.7v6.306Zm-8.432.108A3.178,3.178,0,0,1,34.666-28.8v-.018a3.2,3.2,0,0,1,3.276-3.262,3.237,3.237,0,0,1,2.478.973l-.88,1.018a2.315,2.315,0,0,0-1.606-.712,1.866,1.866,0,0,0-1.822,1.964v.018a1.87,1.87,0,0,0,1.822,1.982,2.265,2.265,0,0,0,1.651-.739l.88.891A3.206,3.206,0,0,1,37.889-25.555Zm-9.805-.108V-31.97h4.739v1.235H29.458v1.279h2.962v1.234H29.458V-26.9h3.411v1.234ZM24.322-30.69v5.027H22.939V-30.69H21.028v-1.28h5.206v1.28H24.322",
25
+ transform: "translate(-21.028 65.555)",
26
+ fill: "#100f0d"
27
+ }), /*#__PURE__*/_react["default"].createElement("path", {
28
+ id: "path16",
29
+ d: "M75.836-76.712a8.975,8.975,0,0,1,2.246-3.9,8.393,8.393,0,0,1,6.058-2.457h9.824v-5.67H84.139a14.611,14.611,0,0,0-10.232,4.221,14.509,14.509,0,0,0-3.076,4.536,11.913,11.913,0,0,0-.973,3.271Zm0,4.325a8.978,8.978,0,0,0,2.246,3.9,8.394,8.394,0,0,0,6.058,2.457h9.824v5.67H84.139A14.611,14.611,0,0,1,73.907-64.58a14.506,14.506,0,0,1-3.076-4.536,11.91,11.91,0,0,1-.973-3.271ZM57.522-69.832l-7.5,9.473H42.581L53.818-74.55,42.581-88.739H50.02l7.5,9.472,7.5-9.472h7.439L61.225-74.55l11.237,14.19H65.023Zm-12.336-6.88a11.935,11.935,0,0,0-.973-3.271,14.515,14.515,0,0,0-3.076-4.536A14.612,14.612,0,0,0,30.9-88.739H21.081v5.67H30.9a8.394,8.394,0,0,1,6.058,2.457,8.978,8.978,0,0,1,2.246,3.9Zm0,4.325a11.932,11.932,0,0,1-.973,3.271,14.511,14.511,0,0,1-3.076,4.536A14.611,14.611,0,0,1,30.9-60.359H21.081v-5.67H30.9a8.4,8.4,0,0,0,6.058-2.457,8.981,8.981,0,0,0,2.246-3.9h5.978",
30
+ transform: "translate(-21.049 88.739)",
31
+ fill: "#100f0d"
32
+ }))));
33
+
34
+ exports.dxcLogo = dxcLogo;
@@ -0,0 +1,45 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Padding = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type Props = {
10
+ /**
11
+ * Wether a contrast line should appear at the bottom of the header.
12
+ */
13
+ underlined?: boolean;
14
+ /**
15
+ * Content showed in the header. Take into account that the component applies styles
16
+ * for the first child in the content, so we recommend the use of React.Fragment
17
+ * to be applied correctly. Otherwise, the styles can be modified.
18
+ */
19
+ content?: React.ReactNode;
20
+ /**
21
+ * Content showed in responsive version. It receives the close menu handler that can
22
+ * be used to add that functionality when a element is clicked.
23
+ */
24
+ responsiveContent?: (closeHandler: () => void) => React.ReactNode;
25
+ /**
26
+ * This function will be called when the user clicks the header logo.
27
+ */
28
+ onClick?: () => void;
29
+ /**
30
+ * Size of the bottom margin to be applied to the header.
31
+ */
32
+ margin?: Space;
33
+ /**
34
+ * Size of the padding to be applied to the custom area of the component.
35
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
36
+ * order to specify different padding sizes.
37
+ */
38
+ padding?: Space | Padding;
39
+ /**
40
+ * Value of the tabindex for all interactuable elements, except those inside the
41
+ * custom area.
42
+ */
43
+ tabIndex?: number;
44
+ };
45
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
5
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
@@ -25,93 +25,50 @@ var _variables = require("../common/variables.js");
25
25
 
26
26
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
27
27
 
28
- function _templateObject6() {
29
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"]);
30
-
31
- _templateObject6 = function _templateObject6() {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- function _templateObject5() {
39
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"]);
40
-
41
- _templateObject5 = function _templateObject5() {
42
- return data;
43
- };
44
-
45
- return data;
46
- }
47
-
48
- function _templateObject4() {
49
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"]);
50
-
51
- _templateObject4 = function _templateObject4() {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
28
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
57
29
 
58
- function _templateObject3() {
59
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"]);
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
60
31
 
61
- _templateObject3 = function _templateObject3() {
62
- return data;
63
- };
64
-
65
- return data;
66
- }
67
-
68
- function _templateObject2() {
69
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"]);
70
-
71
- _templateObject2 = function _templateObject2() {
72
- return data;
73
- };
74
-
75
- return data;
76
- }
77
-
78
- function _templateObject() {
79
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
80
-
81
- _templateObject = function _templateObject() {
82
- return data;
83
- };
84
-
85
- return data;
86
- }
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
87
33
 
88
34
  var DxcHeading = function DxcHeading(_ref) {
89
35
  var _ref$level = _ref.level,
90
36
  level = _ref$level === void 0 ? 1 : _ref$level,
91
37
  _ref$text = _ref.text,
92
38
  text = _ref$text === void 0 ? "" : _ref$text,
39
+ as = _ref.as,
93
40
  _ref$weight = _ref.weight,
94
41
  weight = _ref$weight === void 0 ? "" : _ref$weight,
95
42
  margin = _ref.margin;
96
43
  var colorsTheme = (0, _useTheme["default"])();
97
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
44
+
45
+ var checkValidAs = function checkValidAs() {
46
+ if (as === "h1" || as === "h2" || as === "h3" || as === "h4" || as === "h5") return as;
47
+ };
48
+
49
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
98
50
  theme: colorsTheme.heading
99
- }, _react["default"].createElement(HeadingContainer, {
51
+ }, /*#__PURE__*/_react["default"].createElement(HeadingContainer, {
100
52
  margin: margin
101
- }, level === 1 ? _react["default"].createElement(HeadingLevel1, {
53
+ }, level === 1 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel1, {
54
+ as: checkValidAs(as),
102
55
  weight: weight
103
- }, text) : level === 2 ? _react["default"].createElement(HeadingLevel2, {
56
+ }, text) : level === 2 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel2, {
57
+ as: checkValidAs(as),
104
58
  weight: weight
105
- }, text) : level === 3 ? _react["default"].createElement(HeadingLevel3, {
59
+ }, text) : level === 3 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel3, {
60
+ as: checkValidAs(as),
106
61
  weight: weight
107
- }, text) : level === 4 ? _react["default"].createElement(HeadingLevel4, {
62
+ }, text) : level === 4 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel4, {
63
+ as: checkValidAs(as),
108
64
  weight: weight
109
- }, text) : _react["default"].createElement(HeadingLevel5, {
65
+ }, text) : /*#__PURE__*/_react["default"].createElement(HeadingLevel5, {
66
+ as: checkValidAs(as),
110
67
  weight: weight
111
68
  }, text)));
112
69
  };
113
70
 
114
- var HeadingContainer = _styledComponents["default"].div(_templateObject(), function (props) {
71
+ var HeadingContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
115
72
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
116
73
  }, function (props) {
117
74
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
@@ -123,7 +80,7 @@ var HeadingContainer = _styledComponents["default"].div(_templateObject(), funct
123
80
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
124
81
  });
125
82
 
126
- var HeadingLevel1 = _styledComponents["default"].h1(_templateObject2(), function (props) {
83
+ var HeadingLevel1 = _styledComponents["default"].h1(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
127
84
  return props.theme.level1FontFamily;
128
85
  }, function (props) {
129
86
  return props.theme.level1FontStyle;
@@ -139,7 +96,7 @@ var HeadingLevel1 = _styledComponents["default"].h1(_templateObject2(), function
139
96
  return props.theme.level1FontColor;
140
97
  });
141
98
 
142
- var HeadingLevel2 = _styledComponents["default"].h2(_templateObject3(), function (props) {
99
+ var HeadingLevel2 = _styledComponents["default"].h2(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
143
100
  return props.theme.level2FontFamily;
144
101
  }, function (props) {
145
102
  return props.theme.level2FontStyle;
@@ -155,7 +112,7 @@ var HeadingLevel2 = _styledComponents["default"].h2(_templateObject3(), function
155
112
  return props.theme.level2FontColor;
156
113
  });
157
114
 
158
- var HeadingLevel3 = _styledComponents["default"].h3(_templateObject4(), function (props) {
115
+ var HeadingLevel3 = _styledComponents["default"].h3(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
159
116
  return props.theme.level3FontFamily;
160
117
  }, function (props) {
161
118
  return props.theme.level3FontStyle;
@@ -171,7 +128,7 @@ var HeadingLevel3 = _styledComponents["default"].h3(_templateObject4(), function
171
128
  return props.theme.level3FontColor;
172
129
  });
173
130
 
174
- var HeadingLevel4 = _styledComponents["default"].h4(_templateObject5(), function (props) {
131
+ var HeadingLevel4 = _styledComponents["default"].h4(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
175
132
  return props.theme.level4FontFamily;
176
133
  }, function (props) {
177
134
  return props.theme.level4FontStyle;
@@ -187,7 +144,7 @@ var HeadingLevel4 = _styledComponents["default"].h4(_templateObject5(), function
187
144
  return props.theme.level4FontColor;
188
145
  });
189
146
 
190
- var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6(), function (props) {
147
+ var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
191
148
  return props.theme.level5FontFamily;
192
149
  }, function (props) {
193
150
  return props.theme.level5FontStyle;
@@ -206,6 +163,7 @@ var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6(), function
206
163
  DxcHeading.propTypes = {
207
164
  level: _propTypes["default"].number,
208
165
  text: _propTypes["default"].string,
166
+ as: _propTypes["default"].oneOf(["h1", "h2", "h3", "h4", "h5"]),
209
167
  weight: _propTypes["default"].oneOf(["light", "normal", "bold", ""]),
210
168
  margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
211
169
  top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
@@ -0,0 +1,17 @@
1
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
+ type Margin = {
3
+ top?: Space;
4
+ bottom?: Space;
5
+ left?: Space;
6
+ right?: Space;
7
+ };
8
+
9
+ type Props = {
10
+ level?: 1 | 2 | 3 | 4 | 5;
11
+ text?: string;
12
+ as?: "h1" | "h2" | "h3" | "h4" | "h5";
13
+ weight?: "light" | "normal" | "bold";
14
+ margin?: Space | Margin;
15
+ };
16
+
17
+ export default function DxcHeading(props: Props): JSX.Element;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _default = /*#__PURE__*/_react["default"].createElement("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ height: "24px",
15
+ viewBox: "0 0 24 24",
16
+ width: "24px",
17
+ fill: "currentColor"
18
+ }, /*#__PURE__*/_react["default"].createElement("path", {
19
+ 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"
20
+ }));
21
+
22
+ exports["default"] = _default;