@dxc-technology/halstack-react 0.0.0-0da54d8 → 0.0.0-0e90110

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 (173) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -3
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +5 -8
  5. package/V3Select/V3Select.js +2 -2
  6. package/V3Textarea/V3Textarea.js +2 -2
  7. package/accordion/Accordion.js +2 -2
  8. package/accordion-group/AccordionGroup.js +2 -2
  9. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  10. package/alert/Alert.js +2 -2
  11. package/alert/Alert.stories.tsx +170 -0
  12. package/alert/types.d.ts +1 -1
  13. package/badge/Badge.js +1 -1
  14. package/box/Box.d.ts +4 -0
  15. package/box/Box.js +6 -32
  16. package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
  17. package/box/types.d.ts +43 -0
  18. package/box/types.js +5 -0
  19. package/button/Button.d.ts +1 -1
  20. package/button/Button.js +9 -12
  21. package/button/Button.stories.tsx +217 -234
  22. package/button/types.d.ts +11 -11
  23. package/card/Card.js +5 -6
  24. package/card/Card.stories.tsx +201 -0
  25. package/card/ice-cream.jpg +0 -0
  26. package/card/types.d.ts +4 -6
  27. package/checkbox/Checkbox.js +2 -2
  28. package/checkbox/Checkbox.stories.tsx +192 -0
  29. package/checkbox/types.d.ts +1 -1
  30. package/chip/Chip.d.ts +4 -0
  31. package/chip/Chip.js +1 -23
  32. package/chip/Chip.stories.tsx +121 -0
  33. package/chip/types.d.ts +53 -0
  34. package/chip/types.js +5 -0
  35. package/common/variables.js +32 -23
  36. package/date/Date.js +1 -1
  37. package/date-input/DateInput.js +1 -1
  38. package/date-input/DateInput.stories.tsx +138 -0
  39. package/dialog/Dialog.js +2 -2
  40. package/dialog/Dialog.stories.tsx +212 -0
  41. package/dropdown/Dropdown.js +1 -1
  42. package/dropdown/types.d.ts +1 -1
  43. package/file-input/FileInput.d.ts +4 -0
  44. package/file-input/FileInput.js +30 -51
  45. package/file-input/FileItem.d.ts +14 -0
  46. package/file-input/FileItem.js +10 -19
  47. package/file-input/types.d.ts +87 -0
  48. package/file-input/types.js +5 -0
  49. package/footer/Footer.js +2 -2
  50. package/footer/Footer.stories.jsx +151 -0
  51. package/footer/types.d.ts +22 -14
  52. package/header/Header.d.ts +7 -0
  53. package/header/Header.js +28 -30
  54. package/header/Header.stories.tsx +162 -0
  55. package/header/Icons.js +2 -27
  56. package/header/types.d.ts +47 -0
  57. package/header/types.js +5 -0
  58. package/heading/Heading.d.ts +4 -0
  59. package/heading/Heading.js +7 -24
  60. package/heading/Heading.stories.tsx +53 -0
  61. package/heading/types.d.ts +33 -0
  62. package/heading/types.js +5 -0
  63. package/input-text/InputText.js +2 -2
  64. package/layout/ApplicationLayout.d.ts +10 -0
  65. package/layout/ApplicationLayout.js +7 -18
  66. package/layout/types.d.ts +57 -0
  67. package/layout/types.js +5 -0
  68. package/link/Link.d.ts +3 -0
  69. package/link/Link.js +4 -26
  70. package/link/Link.stories.tsx +146 -0
  71. package/link/types.d.ts +74 -0
  72. package/link/types.js +5 -0
  73. package/main.d.ts +2 -2
  74. package/main.js +2 -2
  75. package/number-input/NumberInput.d.ts +4 -0
  76. package/number-input/NumberInput.js +2 -44
  77. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  78. package/number-input/NumberInputContext.d.ts +4 -0
  79. package/number-input/NumberInputContext.js +5 -2
  80. package/number-input/numberInputContextTypes.d.ts +19 -0
  81. package/number-input/numberInputContextTypes.js +5 -0
  82. package/number-input/types.d.ts +117 -0
  83. package/number-input/types.js +5 -0
  84. package/package.json +1 -1
  85. package/paginator/Paginator.js +2 -2
  86. package/paginator/Paginator.stories.tsx +63 -0
  87. package/password-input/PasswordInput.d.ts +4 -0
  88. package/password-input/PasswordInput.js +7 -42
  89. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  90. package/password-input/types.d.ts +107 -0
  91. package/password-input/types.js +5 -0
  92. package/progress-bar/ProgressBar.js +3 -3
  93. package/progress-bar/ProgressBar.stories.jsx +58 -0
  94. package/radio/Radio.js +2 -2
  95. package/radio/Radio.stories.tsx +192 -0
  96. package/radio/types.d.ts +2 -2
  97. package/resultsetTable/ResultsetTable.d.ts +4 -0
  98. package/resultsetTable/ResultsetTable.js +4 -27
  99. package/resultsetTable/types.d.ts +67 -0
  100. package/resultsetTable/types.js +5 -0
  101. package/select/Select.js +2 -2
  102. package/select/Select.stories.tsx +572 -0
  103. package/sidenav/Sidenav.d.ts +9 -0
  104. package/sidenav/Sidenav.js +6 -15
  105. package/sidenav/Sidenav.stories.tsx +165 -0
  106. package/sidenav/types.d.ts +50 -0
  107. package/sidenav/types.js +5 -0
  108. package/slider/Slider.d.ts +1 -1
  109. package/slider/Slider.js +43 -32
  110. package/slider/Slider.stories.tsx +177 -0
  111. package/slider/types.d.ts +2 -7
  112. package/spinner/Spinner.d.ts +4 -0
  113. package/spinner/Spinner.js +8 -25
  114. package/spinner/Spinner.stories.jsx +102 -0
  115. package/spinner/types.d.ts +32 -0
  116. package/spinner/types.js +5 -0
  117. package/switch/Switch.js +4 -4
  118. package/switch/Switch.stories.tsx +160 -0
  119. package/table/Table.d.ts +4 -0
  120. package/table/Table.js +3 -3
  121. package/table/Table.stories.jsx +276 -0
  122. package/table/types.d.ts +21 -0
  123. package/table/types.js +5 -0
  124. package/tabs/Tabs.js +4 -2
  125. package/tabs/Tabs.stories.tsx +121 -0
  126. package/tabs/types.d.ts +3 -4
  127. package/tag/Tag.d.ts +4 -0
  128. package/tag/Tag.js +21 -36
  129. package/tag/Tag.stories.tsx +145 -0
  130. package/tag/types.d.ts +60 -0
  131. package/tag/types.js +5 -0
  132. package/text-input/TextInput.d.ts +4 -0
  133. package/text-input/TextInput.js +28 -65
  134. package/text-input/TextInput.stories.tsx +456 -0
  135. package/text-input/types.d.ts +159 -0
  136. package/text-input/types.js +5 -0
  137. package/textarea/Textarea.js +15 -16
  138. package/textarea/index.d.ts +18 -8
  139. package/toggle/Toggle.js +1 -1
  140. package/toggle-group/ToggleGroup.d.ts +4 -0
  141. package/toggle-group/ToggleGroup.js +6 -32
  142. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  143. package/toggle-group/types.d.ts +84 -0
  144. package/toggle-group/types.js +5 -0
  145. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  146. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  147. package/upload/file-upload/FileToUpload.js +1 -1
  148. package/upload/files-upload/FilesToUpload.js +1 -1
  149. package/upload/transaction/Transaction.js +2 -2
  150. package/upload/transactions/Transactions.js +1 -1
  151. package/useTheme.d.ts +2 -0
  152. package/useTheme.js +1 -1
  153. package/wizard/Wizard.d.ts +4 -0
  154. package/wizard/Wizard.js +12 -52
  155. package/wizard/Wizard.stories.jsx +224 -0
  156. package/wizard/types.d.ts +64 -0
  157. package/wizard/types.js +5 -0
  158. package/box/index.d.ts +0 -25
  159. package/chip/index.d.ts +0 -22
  160. package/file-input/index.d.ts +0 -81
  161. package/header/index.d.ts +0 -25
  162. package/heading/index.d.ts +0 -17
  163. package/link/index.d.ts +0 -23
  164. package/number-input/index.d.ts +0 -113
  165. package/password-input/index.d.ts +0 -94
  166. package/resultsetTable/index.d.ts +0 -19
  167. package/sidenav/index.d.ts +0 -13
  168. package/spinner/index.d.ts +0 -17
  169. package/table/index.d.ts +0 -13
  170. package/tag/index.d.ts +0 -24
  171. package/text-input/index.d.ts +0 -135
  172. package/toggle-group/index.d.ts +0 -21
  173. package/wizard/index.d.ts +0 -18
@@ -23,15 +23,13 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
23
23
 
24
24
  var _react = _interopRequireWildcard(require("react"));
25
25
 
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
27
-
28
26
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
29
27
 
30
28
  var _uuid = require("uuid");
31
29
 
32
30
  var _variables = require("../common/variables.js");
33
31
 
34
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
32
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
35
33
 
36
34
  var _Button = _interopRequireDefault(require("../button/Button"));
37
35
 
@@ -103,7 +101,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
103
101
  callbackFile = _ref.callbackFile,
104
102
  value = _ref.value,
105
103
  margin = _ref.margin,
106
- tabIndex = _ref.tabIndex;
104
+ _ref$tabIndex = _ref.tabIndex,
105
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
107
106
 
108
107
  var _useState = (0, _react.useState)(false),
109
108
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -329,8 +328,7 @@ var DxcFileInput = function DxcFileInput(_ref) {
329
328
  theme: colorsTheme.fileInput
330
329
  }, /*#__PURE__*/_react["default"].createElement(FileInputContainer, {
331
330
  margin: margin,
332
- name: name,
333
- tabIndex: tabIndex
331
+ name: name
334
332
  }, /*#__PURE__*/_react["default"].createElement(Label, {
335
333
  htmlFor: fileInputId,
336
334
  disabled: disabled
@@ -339,22 +337,20 @@ var DxcFileInput = function DxcFileInput(_ref) {
339
337
  }, helperText), mode === "file" ? /*#__PURE__*/_react["default"].createElement(FileContainer, {
340
338
  multiple: multiple,
341
339
  files: files
342
- }, /*#__PURE__*/_react["default"].createElement(ButtonErrorContainer, null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
340
+ }, /*#__PURE__*/_react["default"].createElement(HiddenInputFile, {
341
+ id: fileInputId,
342
+ type: "file",
343
+ accept: accept,
344
+ multiple: multiple,
345
+ onChange: selectFiles
346
+ }), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
343
347
  mode: "secondary",
344
348
  label: "Select files",
345
349
  onClick: handleClick,
346
350
  disabled: disabled,
347
351
  size: "medium",
348
352
  tabIndex: tabIndex
349
- }), /*#__PURE__*/_react["default"].createElement("input", {
350
- id: fileInputId,
351
- type: "file",
352
- accept: accept,
353
- multiple: multiple,
354
- onChange: selectFiles
355
- }), files.length === 1 && files.map(function (file) {
356
- return file.error && mode === "file" && !multiple && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, file.error);
357
- })), files.map(function (file) {
353
+ }), files.map(function (file) {
358
354
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(FileItemContainer, {
359
355
  mode: mode,
360
356
  multiple: multiple,
@@ -368,7 +364,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
368
364
  numFiles: files.length,
369
365
  preview: file.preview,
370
366
  type: file.file.type,
371
- onDelete: onDelete
367
+ onDelete: onDelete,
368
+ tabIndex: tabIndex
372
369
  })));
373
370
  })) : /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(DragDropArea, {
374
371
  isDragging: isDragging,
@@ -378,7 +375,13 @@ var DxcFileInput = function DxcFileInput(_ref) {
378
375
  onDragEnter: handleDragIn,
379
376
  onDragOver: handleDrag,
380
377
  onDragLeave: handleDragOut
381
- }, /*#__PURE__*/_react["default"].createElement(ButtonContainer, {
378
+ }, /*#__PURE__*/_react["default"].createElement(HiddenInputFile, {
379
+ id: fileInputId,
380
+ type: "file",
381
+ accept: accept,
382
+ multiple: multiple,
383
+ onChange: selectFiles
384
+ }), /*#__PURE__*/_react["default"].createElement(ButtonContainer, {
382
385
  mode: mode
383
386
  }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
384
387
  mode: "secondary",
@@ -386,12 +389,6 @@ var DxcFileInput = function DxcFileInput(_ref) {
386
389
  onClick: handleClick,
387
390
  disabled: disabled,
388
391
  size: "fitContent"
389
- }), /*#__PURE__*/_react["default"].createElement("input", {
390
- id: fileInputId,
391
- type: "file",
392
- accept: accept,
393
- multiple: multiple,
394
- onChange: selectFiles
395
392
  })), /*#__PURE__*/_react["default"].createElement(DropLabel, {
396
393
  disabled: disabled
397
394
  }, "or drop files")), files.map(function (file) {
@@ -408,9 +405,12 @@ var DxcFileInput = function DxcFileInput(_ref) {
408
405
  numFiles: files.length,
409
406
  preview: file.preview,
410
407
  type: file.file.type,
411
- onDelete: onDelete
408
+ onDelete: onDelete,
409
+ tabIndex: tabIndex
412
410
  }));
413
- }))));
411
+ })), files.length === 1 && files.map(function (file) {
412
+ return file.error && mode === "file" && !multiple && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, file.error);
413
+ })));
414
414
  };
415
415
 
416
416
  var FileInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: fit-content;\n"])), function (props) {
@@ -467,13 +467,13 @@ var DragDropArea = _styledComponents["default"].div(_templateObject4 || (_templa
467
467
  return props.disabled && "not-allowed";
468
468
  });
469
469
 
470
- var FileContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n"])), function (props) {
470
+ var FileContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n margin-top: 0.25rem;\n"])), function (props) {
471
471
  return props.multiple || props.files.length > 1 ? "column" : "row";
472
472
  });
473
473
 
474
- var ButtonErrorContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin-top: 0.25rem;\n\n input[type=\"file\"] {\n visibility: hidden;\n position: absolute;\n width: 0px;\n height: 0px;\n }\n"])));
474
+ var HiddenInputFile = _styledComponents["default"].input(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n visibility: hidden;\n position: absolute;\n width: 0px;\n height: 0px;\n"])));
475
475
 
476
- var ButtonContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n padding: ", ";\n input[type=\"file\"] {\n visibility: hidden;\n position: absolute;\n width: 0px;\n height: 0px;\n }\n"])), function (props) {
476
+ var ButtonContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n padding: ", ";\n"])), function (props) {
477
477
  return props.mode === "filedrop" ? "2px 12px 2px 2px" : "47px 122px 8px 122px";
478
478
  });
479
479
 
@@ -495,7 +495,7 @@ var FileItemContainer = _styledComponents["default"].div(_templateObject10 || (_
495
495
  return props.mode === "file" && props.files.length === 1 && !props.multiple && "4px";
496
496
  });
497
497
 
498
- var ErrorMessage = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
498
+ var ErrorMessage = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n margin-top: 0.25rem;\n"])), function (props) {
499
499
  return props.theme.errorMessageFontColor;
500
500
  }, function (props) {
501
501
  return props.theme.errorMessageFontFamily;
@@ -507,26 +507,5 @@ var ErrorMessage = _styledComponents["default"].div(_templateObject11 || (_templ
507
507
  return props.theme.errorMessageLineHeight;
508
508
  });
509
509
 
510
- DxcFileInput.propTypes = {
511
- name: _propTypes["default"].string,
512
- mode: _propTypes["default"].oneOf(["file", "filedrop", "dropzone"]),
513
- label: _propTypes["default"].string,
514
- helperText: _propTypes["default"].string,
515
- accept: _propTypes["default"].array,
516
- maxSize: _propTypes["default"].number,
517
- minSize: _propTypes["default"].number,
518
- multiple: _propTypes["default"].bool,
519
- showPreview: _propTypes["default"].bool,
520
- disabled: _propTypes["default"].bool,
521
- callbackFile: _propTypes["default"].func,
522
- value: _propTypes["default"].array,
523
- tabIndex: _propTypes["default"].number,
524
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
525
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
526
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
527
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
528
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
529
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
530
- };
531
510
  var _default = DxcFileInput;
532
511
  exports["default"] = _default;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ declare const FileItem: ({ mode, multiple, name, error, showPreview, preview, type, numFiles, onDelete, tabIndex, }: {
3
+ mode: any;
4
+ multiple: any;
5
+ name?: string;
6
+ error?: string;
7
+ showPreview: any;
8
+ preview: any;
9
+ type: any;
10
+ numFiles: any;
11
+ onDelete: any;
12
+ tabIndex: any;
13
+ }) => JSX.Element;
14
+ export default FileItem;
@@ -13,11 +13,9 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
13
13
 
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
 
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
16
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
17
 
20
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
18
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
21
19
 
22
20
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
23
21
 
@@ -59,7 +57,8 @@ var FileItem = function FileItem(_ref) {
59
57
  preview = _ref.preview,
60
58
  type = _ref.type,
61
59
  numFiles = _ref.numFiles,
62
- onDelete = _ref.onDelete;
60
+ onDelete = _ref.onDelete,
61
+ tabIndex = _ref.tabIndex;
63
62
  var colorsTheme = (0, _useTheme["default"])();
64
63
  var isImage = type.includes("image");
65
64
 
@@ -104,12 +103,13 @@ var FileItem = function FileItem(_ref) {
104
103
  onClick: function onClick() {
105
104
  return onDelete(name);
106
105
  },
107
- "aria-label": "Remove ".concat(name)
106
+ "aria-label": "Remove ".concat(name),
107
+ tabIndex: tabIndex
108
108
  }, deleteIcon)), error && (multiple || numFiles > 1) && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, error))));
109
109
  };
110
110
 
111
111
  var Container = _styledComponents["default"].div(_templateObject || (_templateObject = (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"])), function (props) {
112
- return props.showPreview ? "8px" : "8px 8px 8px 16px";
112
+ return props.showPreview ? "calc(8px - ".concat(props.theme.fileItemBorderThickness, ") 8px") : "calc(8px - ".concat(props.theme.fileItemBorderThickness, ") 8px calc(8px - ").concat(props.theme.fileItemBorderThickness, ") 16px");
113
113
  }, function (props) {
114
114
  return props.error && props.theme.errorFileItemBackgroundColor;
115
115
  }, function (props) {
@@ -156,12 +156,14 @@ var FileName = _styledComponents["default"].span(_templateObject7 || (_templateO
156
156
 
157
157
  var ErrorIcon = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (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"])));
158
158
 
159
- var DeleteIcon = _styledComponents["default"].button(_templateObject9 || (_templateObject9 = (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"])), function (props) {
159
+ var DeleteIcon = _styledComponents["default"].button(_templateObject9 || (_templateObject9 = (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: 2px;\n margin-left: 4px;\n background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
160
160
  return props.theme.fontFamily;
161
161
  }, function (props) {
162
162
  return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
163
163
  }, function (props) {
164
- return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
164
+ return props.theme.focusActionBorderColor;
165
+ }, function (props) {
166
+ return props.theme.focusActionBorderColor;
165
167
  }, function (props) {
166
168
  return props.error ? props.theme.errorActiveDeleteFileItemBackgroundColor : props.theme.activeDeleteFileItemBackgroundColor;
167
169
  });
@@ -178,16 +180,5 @@ var ErrorMessage = _styledComponents["default"].span(_templateObject10 || (_temp
178
180
  return props.theme.errorMessageLineHeight;
179
181
  });
180
182
 
181
- FileItem.propTypes = {
182
- mode: _propTypes["default"].string,
183
- multiple: _propTypes["default"].bool,
184
- name: _propTypes["default"].string,
185
- type: _propTypes["default"].string,
186
- showPreview: _propTypes["default"]["boolean"],
187
- numFiles: _propTypes["default"].number,
188
- preview: _propTypes["default"].string,
189
- error: _propTypes["default"].string,
190
- onDelete: _propTypes["default"].func
191
- };
192
183
  var _default = FileItem;
193
184
  exports["default"] = _default;
@@ -0,0 +1,87 @@
1
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
+ declare type Margin = {
3
+ top?: Space;
4
+ bottom?: Space;
5
+ left?: Space;
6
+ right?: Space;
7
+ };
8
+ declare type FileData = {
9
+ /**
10
+ * Selected file.
11
+ */
12
+ file: File;
13
+ /**
14
+ * Error of the file. If it is defined, it will be shown and the file item will be mark as invalid.
15
+ */
16
+ error?: string;
17
+ /**
18
+ * Preview of the file.
19
+ */
20
+ preview?: string;
21
+ };
22
+ declare type Props = {
23
+ /**
24
+ * Name attribute.
25
+ */
26
+ name?: string;
27
+ /**
28
+ * Text to be placed above the component.
29
+ */
30
+ label?: string;
31
+ /**
32
+ * Uses one of the available file input modes:
33
+ * 'file': Files are selected by clicking the button and selecting it through the file explorer.
34
+ * '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.
35
+ * '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.
36
+ * The drag and drop area of this mode is bigger than the one of the filedrop mode.
37
+ */
38
+ mode?: "file" | "filedrop" | "dropzone";
39
+ /**
40
+ * Helper text to be placed above the component.
41
+ */
42
+ helperText?: string;
43
+ /**
44
+ * The file types that the component accepts. Its value must be one of all the possible values of the HTML file input's accept attribute.
45
+ */
46
+ accept?: string;
47
+ /**
48
+ * An array of files representing the selected files.
49
+ */
50
+ value: FileData[];
51
+ /**
52
+ * The minimum file size (in bytes) allowed. If the size of the file does not comply the minSize, the file will have an error.
53
+ */
54
+ minSize?: number;
55
+ /**
56
+ * The maximum file size (in bytes) allowed. If the size of the file does not comply the maxSize, the file will have an error.
57
+ */
58
+ maxSize?: number;
59
+ /**
60
+ * If true, if the file is an image, a preview of it will be shown. If not, an icon refering to the file type will be shown.
61
+ */
62
+ showPreview?: boolean;
63
+ /**
64
+ * If true, the component allows multiple file items and will show all of them. If false, only one file will be shown, and if there is already one
65
+ * file selected and a new one is chosen, it will be replaced by the new selected one.
66
+ */
67
+ multiple?: boolean;
68
+ /**
69
+ * If true, the component will be disabled.
70
+ */
71
+ disabled?: boolean;
72
+ /**
73
+ * This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
74
+ * 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.
75
+ */
76
+ callbackFile: (files: FileData[]) => void;
77
+ /**
78
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
79
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
80
+ */
81
+ margin?: Space | Margin;
82
+ /**
83
+ * Value of the tabindex attribute.
84
+ */
85
+ tabIndex?: number;
86
+ };
87
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/footer/Footer.js CHANGED
@@ -21,9 +21,9 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
21
 
22
22
  var _variables = require("../common/variables.js");
23
23
 
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
24
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
25
25
 
26
- var _BackgroundColorContext = require("../BackgroundColorContext.js");
26
+ var _BackgroundColorContext = require("../BackgroundColorContext");
27
27
 
28
28
  var _Icons = _interopRequireDefault(require("./Icons"));
29
29
 
@@ -0,0 +1,151 @@
1
+ import React from "react";
2
+ import DxcFooter from "./Footer";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+
6
+ const social = [
7
+ {
8
+ href: "https://www.linkedin.com/company/dxctechnology",
9
+ logo: (
10
+ <svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 438.536 438.536" fill="currentColor">
11
+ <g>
12
+ <path
13
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
14
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
15
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
16
+ C438.532,59.576,430.49,40.204,414.41,24.123z M133.618,367.157H67.666V169.016h65.952V367.157z M127.626,132.332
17
+ c-6.851,6.567-15.893,9.851-27.124,9.851h-0.288c-10.848,0-19.648-3.284-26.407-9.851c-6.76-6.567-10.138-14.703-10.138-24.41
18
+ c0-9.897,3.476-18.083,10.421-24.556c6.95-6.471,15.942-9.708,26.98-9.708c11.039,0,19.89,3.237,26.553,9.708
19
+ c6.661,6.473,10.088,14.659,10.277,24.556C137.899,117.625,134.477,125.761,127.626,132.332z M370.873,367.157h-65.952v-105.92
20
+ c0-29.879-11.036-44.823-33.116-44.823c-8.374,0-15.42,2.331-21.128,6.995c-5.715,4.661-9.996,10.324-12.847,16.991
21
+ c-1.335,3.422-1.999,8.75-1.999,15.981v110.775h-65.952c0.571-119.529,0.571-185.579,0-198.142h65.952v27.974
22
+ c13.867-21.681,33.558-32.544,59.101-32.544c22.84,0,41.21,7.52,55.104,22.554c13.895,15.037,20.841,37.214,20.841,66.519v113.64
23
+ H370.873z"
24
+ />
25
+ </g>
26
+ </svg>
27
+ ),
28
+ },
29
+ {
30
+ href: "https://twitter.com/dxctechnology",
31
+ logo: (
32
+ <svg version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 438.536 438.536" fill="currentColor">
33
+ <g>
34
+ <path
35
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
36
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
37
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
38
+ C438.532,59.576,430.49,40.204,414.41,24.123z M335.471,168.735c0.191,1.713,0.288,4.278,0.288,7.71
39
+ c0,15.989-2.334,32.025-6.995,48.104c-4.661,16.087-11.8,31.504-21.416,46.254c-9.606,14.749-21.074,27.791-34.396,39.115
40
+ c-13.325,11.32-29.311,20.365-47.968,27.117c-18.648,6.762-38.637,10.143-59.953,10.143c-33.116,0-63.76-8.952-91.931-26.836
41
+ c4.568,0.568,9.329,0.855,14.275,0.855c27.6,0,52.439-8.565,74.519-25.7c-12.941-0.185-24.506-4.179-34.688-11.991
42
+ c-10.185-7.803-17.273-17.699-21.271-29.691c4.947,0.76,8.658,1.137,11.132,1.137c4.187,0,9.042-0.76,14.56-2.279
43
+ c-13.894-2.669-25.598-9.562-35.115-20.697c-9.519-11.136-14.277-23.84-14.277-38.114v-0.571
44
+ c10.085,4.755,19.602,7.229,28.549,7.422c-17.321-11.613-25.981-28.265-25.981-49.963c0-10.66,2.758-20.747,8.278-30.264
45
+ c15.035,18.464,33.311,33.213,54.816,44.252c21.507,11.038,44.54,17.227,69.092,18.558c-0.95-3.616-1.427-8.186-1.427-13.704
46
+ c0-16.562,5.853-30.692,17.56-42.399c11.703-11.706,25.837-17.561,42.394-17.561c17.515,0,32.079,6.283,43.688,18.846
47
+ c13.134-2.474,25.892-7.33,38.26-14.56c-4.757,14.652-13.613,25.788-26.55,33.402c12.368-1.716,23.88-4.95,34.537-9.708
48
+ C357.458,149.793,347.462,160.166,335.471,168.735z"
49
+ />
50
+ </g>
51
+ </svg>
52
+ ),
53
+ },
54
+ {
55
+ href: "https://www.facebook.com/DXCTechnology/",
56
+ logo: (
57
+ <svg
58
+ version="1.1"
59
+ id="Capa_1"
60
+ x="0px"
61
+ y="0px"
62
+ viewBox="0 0 438.536 438.536"
63
+ fill="currentColor"
64
+ width="1000px"
65
+ height="500px"
66
+ >
67
+ <g>
68
+ <path
69
+ d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
70
+ C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
71
+ h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
72
+ C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
73
+ c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
74
+ c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
75
+ />
76
+ </g>
77
+ </svg>
78
+ ),
79
+ },
80
+ ];
81
+
82
+ const bottom = [
83
+ {
84
+ href: "https://www.linkedin.com/company/dxctechnology",
85
+ text: "Linkedin",
86
+ },
87
+ {
88
+ href: "https://twitter.com/dxctechnology",
89
+ text: "Twitter",
90
+ },
91
+ {
92
+ href: "https://www.facebook.com/DXCTechnology/",
93
+ text: "Facebook",
94
+ },
95
+ ];
96
+
97
+ export default {
98
+ title: "Footer",
99
+ component: DxcFooter,
100
+ };
101
+
102
+ export const Chromatic = () => (
103
+ <>
104
+ <ExampleContainer>
105
+ <Title title="Default" theme="light" level={4} />
106
+ <DxcFooter />
107
+ </ExampleContainer>
108
+ <ExampleContainer>
109
+ <Title title="With children, copyright, bottom links and social links" theme="light" level={4} />
110
+ <DxcFooter copyright="Copyright" socialLinks={social} bottomLinks={bottom}>
111
+ <div>
112
+ <a href="https://www.linkedin.com/company/dxctechnology">Linkedin</a>
113
+ </div>
114
+ </DxcFooter>
115
+ </ExampleContainer>
116
+ <Title title="Margins" theme="light" level={2} />
117
+ <ExampleContainer>
118
+ <Title title="Xxsmall margin" theme="light" level={4} />
119
+ <DxcFooter margin="xxsmall"></DxcFooter>
120
+ <Title title="Xsmall margin" theme="light" level={4} />
121
+ <DxcFooter margin="xsmall"></DxcFooter>
122
+ <Title title="Small margin" theme="light" level={4} />
123
+ <DxcFooter margin="small"></DxcFooter>
124
+ <Title title="Medium margin" theme="light" level={4} />
125
+ <DxcFooter margin="medium"></DxcFooter>
126
+ <Title title="Large margin" theme="light" level={4} />
127
+ <DxcFooter margin="large"></DxcFooter>
128
+ <Title title="Xlarge margin" theme="light" level={4} />
129
+ <DxcFooter margin="xlarge"></DxcFooter>
130
+ <Title title="Xxlarge margin" theme="light" level={4} />
131
+ <DxcFooter margin="xxlarge"></DxcFooter>
132
+ </ExampleContainer>
133
+ <Title title="Padding" theme="light" level={2} />
134
+ <ExampleContainer>
135
+ <Title title="Xxsmall padding" theme="light" level={4} />
136
+ <DxcFooter padding="xxsmall"></DxcFooter>
137
+ <Title title="Xsmall padding" theme="light" level={4} />
138
+ <DxcFooter padding="xsmall"></DxcFooter>
139
+ <Title title="Small padding" theme="light" level={4} />
140
+ <DxcFooter padding="small"></DxcFooter>
141
+ <Title title="Medium padding" theme="light" level={4} />
142
+ <DxcFooter padding="medium"></DxcFooter>
143
+ <Title title="Large padding" theme="light" level={4} />
144
+ <DxcFooter padding="large"></DxcFooter>
145
+ <Title title="Xlarge padding" theme="light" level={4} />
146
+ <DxcFooter padding="xlarge"></DxcFooter>
147
+ <Title title="Xxlarge padding" theme="light" level={4} />
148
+ <DxcFooter padding="xxlarge"></DxcFooter>
149
+ </ExampleContainer>
150
+ </>
151
+ );
package/footer/types.d.ts CHANGED
@@ -6,39 +6,47 @@ declare type Size = {
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
+ declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
9
10
  declare type SocialLink = {
10
- logo?: ImgElement;
11
+ /**
12
+ * Element used as the icon for the link.
13
+ */
14
+ logo?: SVG;
15
+ /**
16
+ * @deprecated The path of an icon for the link.
17
+ */
11
18
  logoSrc?: string;
19
+ /**
20
+ * URL of the page the link goes to.
21
+ */
12
22
  href?: string;
13
23
  };
14
24
  declare type BottomLink = {
25
+ /**
26
+ * Text for the link.
27
+ */
15
28
  text?: string;
29
+ /**
30
+ * URL of the page the link goes to.
31
+ */
16
32
  href?: string;
17
33
  };
18
- declare type ImgElement = HTMLElement & (SVGElement | HTMLImageElement);
19
34
  declare type FooterPropsType = {
20
35
  /**
21
36
  * An array of objects representing the links that will be rendered as
22
- * icons at the top-right side of the footer. Each object has the
23
- * following properties:
24
- * - logo: Element used as the icon for the link.
25
- * - logoSrc: The path of an icon for the link. @deprecated
26
- * - href: URL of the page the link goes to.
37
+ * icons at the top-right side of the footer.
27
38
  */
28
- socialLinks?: [SocialLink, ...SocialLink[]];
39
+ socialLinks?: SocialLink[];
29
40
  /**
30
41
  * An array of objects representing the links that will be rendered at
31
- * the bottom part of the footer. Each object has the following
32
- * properties:
33
- * - text: Text for the link.
34
- * - href: URL of the page the link goes to.
42
+ * the bottom part of the footer.
35
43
  */
36
- bottomLinks?: [BottomLink, ...BottomLink[]];
44
+ bottomLinks?: BottomLink[];
37
45
  /**
38
46
  * The center section of the footer. Can be used to render custom
39
47
  * content in this area.
40
48
  */
41
- children: React.ReactNode;
49
+ children?: React.ReactNode;
42
50
  /**
43
51
  * The text that will be displayed as copyright disclaimer.
44
52
  */
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import HeaderPropsType from "./types";
3
+ declare const DxcHeader: {
4
+ ({ underlined, content, responsiveContent, onClick, margin, padding, tabIndex, }: HeaderPropsType): JSX.Element;
5
+ Dropdown: (props: any) => JSX.Element;
6
+ };
7
+ export default DxcHeader;