@dxc-technology/halstack-react 0.0.0-d4fec82 → 0.0.0-d618bea

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 (191) 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 +44 -37
  36. package/date/Date.js +1 -1
  37. package/date-input/DateInput.js +4 -7
  38. package/date-input/DateInput.stories.tsx +138 -0
  39. package/dialog/Dialog.d.ts +4 -0
  40. package/dialog/Dialog.js +6 -25
  41. package/dialog/Dialog.stories.tsx +212 -0
  42. package/dialog/types.d.ts +43 -0
  43. package/dialog/types.js +5 -0
  44. package/dropdown/Dropdown.js +1 -1
  45. package/dropdown/types.d.ts +1 -1
  46. package/file-input/FileInput.d.ts +4 -0
  47. package/file-input/FileInput.js +65 -76
  48. package/file-input/FileItem.d.ts +14 -0
  49. package/file-input/FileItem.js +12 -21
  50. package/file-input/types.d.ts +112 -0
  51. package/file-input/types.js +5 -0
  52. package/footer/Footer.d.ts +1 -1
  53. package/footer/Footer.js +8 -8
  54. package/footer/Footer.stories.tsx +151 -0
  55. package/footer/types.d.ts +22 -18
  56. package/header/Header.d.ts +7 -0
  57. package/header/Header.js +28 -30
  58. package/header/Header.stories.tsx +162 -0
  59. package/header/Icons.js +2 -27
  60. package/header/types.d.ts +47 -0
  61. package/header/types.js +5 -0
  62. package/heading/Heading.d.ts +4 -0
  63. package/heading/Heading.js +7 -24
  64. package/heading/Heading.stories.tsx +53 -0
  65. package/heading/types.d.ts +33 -0
  66. package/heading/types.js +5 -0
  67. package/input-text/InputText.js +2 -2
  68. package/layout/ApplicationLayout.d.ts +10 -0
  69. package/layout/ApplicationLayout.js +8 -18
  70. package/layout/ApplicationLayout.stories.tsx +171 -0
  71. package/layout/types.d.ts +57 -0
  72. package/layout/types.js +5 -0
  73. package/link/Link.d.ts +3 -0
  74. package/link/Link.js +4 -26
  75. package/link/Link.stories.tsx +146 -0
  76. package/link/types.d.ts +74 -0
  77. package/link/types.js +5 -0
  78. package/list/List.d.ts +7 -0
  79. package/list/List.js +37 -0
  80. package/list/List.stories.tsx +70 -0
  81. package/main.d.ts +7 -3
  82. package/main.js +34 -2
  83. package/number-input/NumberInput.d.ts +4 -0
  84. package/number-input/NumberInput.js +5 -50
  85. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  86. package/number-input/NumberInputContext.d.ts +4 -0
  87. package/number-input/NumberInputContext.js +5 -2
  88. package/number-input/numberInputContextTypes.d.ts +19 -0
  89. package/number-input/numberInputContextTypes.js +5 -0
  90. package/number-input/types.d.ts +117 -0
  91. package/number-input/types.js +5 -0
  92. package/package.json +1 -1
  93. package/paginator/Paginator.js +2 -8
  94. package/paginator/Paginator.stories.tsx +63 -0
  95. package/password-input/PasswordInput.d.ts +4 -0
  96. package/password-input/PasswordInput.js +19 -55
  97. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  98. package/password-input/types.d.ts +107 -0
  99. package/password-input/types.js +5 -0
  100. package/progress-bar/ProgressBar.js +3 -3
  101. package/progress-bar/ProgressBar.stories.jsx +58 -0
  102. package/radio/Radio.js +2 -2
  103. package/radio/Radio.stories.tsx +192 -0
  104. package/radio/types.d.ts +2 -2
  105. package/resultsetTable/ResultsetTable.d.ts +4 -0
  106. package/resultsetTable/ResultsetTable.js +4 -27
  107. package/resultsetTable/types.d.ts +67 -0
  108. package/resultsetTable/types.js +5 -0
  109. package/row/Row.d.ts +11 -0
  110. package/row/Row.js +124 -0
  111. package/row/Row.stories.tsx +223 -0
  112. package/select/Select.js +15 -17
  113. package/select/Select.stories.tsx +572 -0
  114. package/sidenav/Sidenav.d.ts +9 -0
  115. package/sidenav/Sidenav.js +6 -15
  116. package/sidenav/Sidenav.stories.tsx +165 -0
  117. package/sidenav/types.d.ts +50 -0
  118. package/sidenav/types.js +5 -0
  119. package/slider/Slider.d.ts +1 -1
  120. package/slider/Slider.js +43 -32
  121. package/slider/Slider.stories.tsx +177 -0
  122. package/slider/types.d.ts +2 -7
  123. package/spinner/Spinner.d.ts +4 -0
  124. package/spinner/Spinner.js +8 -25
  125. package/spinner/Spinner.stories.jsx +102 -0
  126. package/spinner/types.d.ts +32 -0
  127. package/spinner/types.js +5 -0
  128. package/stack/Stack.d.ts +10 -0
  129. package/stack/Stack.js +94 -0
  130. package/stack/Stack.stories.tsx +150 -0
  131. package/switch/Switch.js +4 -4
  132. package/switch/Switch.stories.tsx +160 -0
  133. package/table/Table.d.ts +4 -0
  134. package/table/Table.js +3 -3
  135. package/table/Table.stories.jsx +276 -0
  136. package/table/types.d.ts +21 -0
  137. package/table/types.js +5 -0
  138. package/tabs/Tabs.js +4 -2
  139. package/tabs/Tabs.stories.tsx +121 -0
  140. package/tabs/types.d.ts +3 -4
  141. package/tag/Tag.d.ts +4 -0
  142. package/tag/Tag.js +21 -36
  143. package/tag/Tag.stories.tsx +145 -0
  144. package/tag/types.d.ts +60 -0
  145. package/tag/types.js +5 -0
  146. package/text/Text.d.ts +7 -0
  147. package/text/Text.js +30 -0
  148. package/text/Text.stories.tsx +19 -0
  149. package/text-input/TextInput.d.ts +4 -0
  150. package/text-input/TextInput.js +42 -81
  151. package/text-input/TextInput.stories.tsx +456 -0
  152. package/text-input/types.d.ts +159 -0
  153. package/text-input/types.js +5 -0
  154. package/textarea/Textarea.js +29 -32
  155. package/textarea/index.d.ts +18 -8
  156. package/toggle/Toggle.js +1 -1
  157. package/toggle-group/ToggleGroup.d.ts +4 -0
  158. package/toggle-group/ToggleGroup.js +8 -34
  159. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  160. package/toggle-group/types.d.ts +84 -0
  161. package/toggle-group/types.js +5 -0
  162. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  163. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  164. package/upload/file-upload/FileToUpload.js +1 -1
  165. package/upload/files-upload/FilesToUpload.js +1 -1
  166. package/upload/transaction/Transaction.js +2 -2
  167. package/upload/transactions/Transactions.js +1 -1
  168. package/useTheme.d.ts +2 -0
  169. package/useTheme.js +1 -1
  170. package/wizard/Wizard.d.ts +4 -0
  171. package/wizard/Wizard.js +13 -53
  172. package/wizard/Wizard.stories.jsx +224 -0
  173. package/wizard/types.d.ts +64 -0
  174. package/wizard/types.js +5 -0
  175. package/box/index.d.ts +0 -25
  176. package/chip/index.d.ts +0 -22
  177. package/dialog/index.d.ts +0 -18
  178. package/file-input/index.d.ts +0 -81
  179. package/header/index.d.ts +0 -25
  180. package/heading/index.d.ts +0 -17
  181. package/link/index.d.ts +0 -23
  182. package/number-input/index.d.ts +0 -113
  183. package/password-input/index.d.ts +0 -94
  184. package/resultsetTable/index.d.ts +0 -19
  185. package/sidenav/index.d.ts +0 -13
  186. package/spinner/index.d.ts +0 -17
  187. package/table/index.d.ts +0 -13
  188. package/tag/index.d.ts +0 -24
  189. package/text-input/index.d.ts +0 -135
  190. package/toggle-group/index.d.ts +0 -21
  191. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,43 @@
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
+ * If true, the close 'x' button will be visible.
12
+ */
13
+ isCloseVisible?: boolean;
14
+ /**
15
+ * This function will be called when the user clicks the close 'x' button.
16
+ * The responsibility of hiding the modal lies with the user.
17
+ */
18
+ onCloseClick?: () => void;
19
+ /**
20
+ * If true, the dialog will be displayed over a darker background that covers the content behind.
21
+ */
22
+ overlay?: boolean;
23
+ /**
24
+ * This function will be called when the user clicks background of the modal.
25
+ * The responsibility of hiding the modal lies with the user.
26
+ */
27
+ onBackgroundClick?: () => void;
28
+ /**
29
+ * Size of the padding to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
30
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
31
+ */
32
+ padding?: Padding | Space;
33
+ /**
34
+ * Value of the tabindex given to the close 'x' button.
35
+ */
36
+ tabIndex?: number;
37
+ /**
38
+ * The area inside the dialog. This area can be used to render
39
+ * custom content.
40
+ */
41
+ children: React.ReactNode;
42
+ };
43
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -35,7 +35,7 @@ var _variables = require("../common/variables.js");
35
35
 
36
36
  var _utils = require("../common/utils.js");
37
37
 
38
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
38
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
39
39
 
40
40
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
41
41
 
@@ -30,7 +30,7 @@ declare type Props = {
30
30
  /**
31
31
  * An array of objects representing the options.
32
32
  */
33
- options: [Option, ...Option[]];
33
+ options: Option[];
34
34
  /**
35
35
  * In case options include icons, whether the icon should appear
36
36
  * after or before the label.
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import FileInputPropsType from "./types";
3
+ declare const DxcFileInput: ({ name, mode, label, buttonLabel, dropAreaLabel, helperText, accept, minSize, maxSize, showPreview, multiple, disabled, callbackFile, value, margin, tabIndex, }: FileInputPropsType) => JSX.Element;
4
+ export default DxcFileInput;
@@ -23,21 +23,19 @@ 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
 
38
36
  var _FileItem = _interopRequireDefault(require("./FileItem"));
39
37
 
40
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
38
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
41
39
 
42
40
  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); }
43
41
 
@@ -89,6 +87,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
89
87
  mode = _ref$mode === void 0 ? "file" : _ref$mode,
90
88
  _ref$label = _ref.label,
91
89
  label = _ref$label === void 0 ? "" : _ref$label,
90
+ buttonLabel = _ref.buttonLabel,
91
+ dropAreaLabel = _ref.dropAreaLabel,
92
92
  _ref$helperText = _ref.helperText,
93
93
  helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
94
94
  accept = _ref.accept,
@@ -103,7 +103,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
103
103
  callbackFile = _ref.callbackFile,
104
104
  value = _ref.value,
105
105
  margin = _ref.margin,
106
- tabIndex = _ref.tabIndex;
106
+ _ref$tabIndex = _ref.tabIndex,
107
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
107
108
 
108
109
  var _useState = (0, _react.useState)(false),
109
110
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -297,18 +298,12 @@ var DxcFileInput = function DxcFileInput(_ref) {
297
298
  };
298
299
 
299
300
  var handleDragIn = function handleDragIn(e) {
300
- e.preventDefault();
301
- e.stopPropagation();
302
-
303
- if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
304
- setIsDragging(true);
305
- }
301
+ if (e.dataTransfer.items && e.dataTransfer.items.length > 0) setIsDragging(true);
306
302
  };
307
303
 
308
304
  var handleDragOut = function handleDragOut(e) {
309
- e.preventDefault();
310
- e.stopPropagation();
311
- setIsDragging(false);
305
+ // only if dragged items leave container (outside, not to childs)
306
+ if (!e.currentTarget.contains(e.relatedTarget)) setIsDragging(false);
312
307
  };
313
308
 
314
309
  var handleDrop = function handleDrop(e) {
@@ -329,8 +324,7 @@ var DxcFileInput = function DxcFileInput(_ref) {
329
324
  theme: colorsTheme.fileInput
330
325
  }, /*#__PURE__*/_react["default"].createElement(FileInputContainer, {
331
326
  margin: margin,
332
- name: name,
333
- tabIndex: tabIndex
327
+ name: name
334
328
  }, /*#__PURE__*/_react["default"].createElement(Label, {
335
329
  htmlFor: fileInputId,
336
330
  disabled: disabled
@@ -339,22 +333,20 @@ var DxcFileInput = function DxcFileInput(_ref) {
339
333
  }, helperText), mode === "file" ? /*#__PURE__*/_react["default"].createElement(FileContainer, {
340
334
  multiple: multiple,
341
335
  files: files
342
- }, /*#__PURE__*/_react["default"].createElement(ButtonErrorContainer, null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
343
- mode: "secondary",
344
- label: "Select files",
345
- onClick: handleClick,
346
- disabled: disabled,
347
- size: "medium",
348
- tabIndex: tabIndex
349
- }), /*#__PURE__*/_react["default"].createElement("input", {
336
+ }, /*#__PURE__*/_react["default"].createElement(HiddenInputFile, {
350
337
  id: fileInputId,
351
338
  type: "file",
352
339
  accept: accept,
353
340
  multiple: multiple,
354
341
  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) {
342
+ }), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
343
+ mode: "secondary",
344
+ label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : multiple ? "Select files" : "Select file",
345
+ onClick: handleClick,
346
+ disabled: disabled,
347
+ size: "medium",
348
+ tabIndex: tabIndex
349
+ }), files.map(function (file) {
358
350
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(FileItemContainer, {
359
351
  mode: mode,
360
352
  multiple: multiple,
@@ -368,9 +360,16 @@ var DxcFileInput = function DxcFileInput(_ref) {
368
360
  numFiles: files.length,
369
361
  preview: file.preview,
370
362
  type: file.file.type,
371
- onDelete: onDelete
363
+ onDelete: onDelete,
364
+ tabIndex: tabIndex
372
365
  })));
373
- })) : /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(DragDropArea, {
366
+ })) : /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(HiddenInputFile, {
367
+ id: fileInputId,
368
+ type: "file",
369
+ accept: accept,
370
+ multiple: multiple,
371
+ onChange: selectFiles
372
+ }), /*#__PURE__*/_react["default"].createElement(DragDropArea, {
374
373
  isDragging: isDragging,
375
374
  disabled: disabled,
376
375
  mode: mode,
@@ -382,19 +381,15 @@ var DxcFileInput = function DxcFileInput(_ref) {
382
381
  mode: mode
383
382
  }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
384
383
  mode: "secondary",
385
- label: "Select",
384
+ label: buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : "Select",
386
385
  onClick: handleClick,
387
386
  disabled: disabled,
388
387
  size: "fitContent"
389
- }), /*#__PURE__*/_react["default"].createElement("input", {
390
- id: fileInputId,
391
- type: "file",
392
- accept: accept,
393
- multiple: multiple,
394
- onChange: selectFiles
395
- })), /*#__PURE__*/_react["default"].createElement(DropLabel, {
388
+ })), mode === "dropzone" ? /*#__PURE__*/_react["default"].createElement(DropzoneLabel, {
389
+ disabled: disabled
390
+ }, dropAreaLabel !== null && dropAreaLabel !== void 0 ? dropAreaLabel : multiple ? "or drop files" : "or drop a file") : /*#__PURE__*/_react["default"].createElement(FiledropLabel, {
396
391
  disabled: disabled
397
- }, "or drop files")), files.map(function (file) {
392
+ }, dropAreaLabel !== null && dropAreaLabel !== void 0 ? dropAreaLabel : multiple ? "or drop files" : "or drop a file")), files.map(function (file) {
398
393
  return /*#__PURE__*/_react["default"].createElement(FileItemContainer, {
399
394
  mode: mode,
400
395
  multiple: multiple,
@@ -408,9 +403,12 @@ var DxcFileInput = function DxcFileInput(_ref) {
408
403
  numFiles: files.length,
409
404
  preview: file.preview,
410
405
  type: file.file.type,
411
- onDelete: onDelete
406
+ onDelete: onDelete,
407
+ tabIndex: tabIndex
412
408
  }));
413
- }))));
409
+ })), files.length === 1 && files.map(function (file) {
410
+ return file.error && mode === "file" && !multiple && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, file.error);
411
+ })));
414
412
  };
415
413
 
416
414
  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) {
@@ -449,35 +447,37 @@ var HelperText = _styledComponents["default"].span(_templateObject3 || (_templat
449
447
  return props.theme.helperTextLineHeight;
450
448
  });
451
449
 
452
- var DragDropArea = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: calc(320px - 2px);\n display: flex;\n flex-direction: ", ";\n align-items: center;\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n background-color: ", ";\n border-color: ", ";\n cursor: ", ";\n"])), function (props) {
453
- return props.mode === "filedrop" ? "calc(48px - 2px)" : "calc(160px - 2px)";
454
- }, function (props) {
450
+ var DragDropArea = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n overflow: hidden;\n box-sizing: border-box;\n flex-direction: ", ";\n ", ";\n align-items: center;\n height: ", ";\n width: 320px;\n\n box-shadow: 0 0 0 2px transparent;\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n\n ", "\n\n cursor: ", ";\n"])), function (props) {
455
451
  return props.mode === "filedrop" ? "row" : "column";
452
+ }, function (props) {
453
+ return props.mode === "dropzone" && "justify-content: center; padding: 1rem;";
454
+ }, function (props) {
455
+ return props.mode === "filedrop" ? "48px" : "160px";
456
456
  }, function (props) {
457
457
  return props.theme.dropBorderRadius;
458
458
  }, function (props) {
459
- return !props.isDragging ? props.theme.dropBorderThickness : "2px";
459
+ return props.theme.dropBorderThickness;
460
460
  }, function (props) {
461
- return !props.isDragging ? props.theme.dropBorderStyle : "solid";
461
+ return props.theme.dropBorderStyle;
462
462
  }, function (props) {
463
- return props.isDragging && props.theme.dragoverDropBackgroundColor;
463
+ return props.disabled ? props.theme.disabledDropBorderColor : props.theme.dropBorderColor;
464
464
  }, function (props) {
465
- return props.disabled ? props.theme.disabledDropBorderColor : props.isDragging ? props.theme.focusDropBorderColor : props.theme.dropBorderColor;
465
+ return props.isDragging && "\n background-color: ".concat(props.theme.dragoverDropBackgroundColor, ";\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(props.theme.focusDropBorderColor, ";\n ");
466
466
  }, function (props) {
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) {
477
- return props.mode === "filedrop" ? "2px 12px 2px 2px" : "47px 122px 8px 122px";
476
+ var ButtonContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n"])), function (props) {
477
+ return props.mode === "filedrop" && "padding: 2px 12px 2px 3px";
478
478
  });
479
479
 
480
- var DropLabel = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), function (props) {
480
+ var DropzoneLabel = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: -webkit-box;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-line-clamp: 3;\n text-align: center;\n margin-top: 0.5rem;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"])), function (props) {
481
481
  return props.disabled ? props.theme.disabledDropLabelFontColor : props.theme.dropLabelFontColor;
482
482
  }, function (props) {
483
483
  return props.theme.dropLabelFontFamily;
@@ -487,15 +487,25 @@ var DropLabel = _styledComponents["default"].span(_templateObject8 || (_template
487
487
  return props.theme.dropLabelFontWeight;
488
488
  });
489
489
 
490
- var Container = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin-top: 0.25rem;\n"])));
490
+ var FiledropLabel = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n margin-right: 1rem;\n"])), function (props) {
491
+ return props.disabled ? props.theme.disabledDropLabelFontColor : props.theme.dropLabelFontColor;
492
+ }, function (props) {
493
+ return props.theme.dropLabelFontFamily;
494
+ }, function (props) {
495
+ return props.theme.dropLabelFontSize;
496
+ }, function (props) {
497
+ return props.theme.dropLabelFontWeight;
498
+ });
491
499
 
492
- var FileItemContainer = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n margin-top: ", ";\n margin-left: ", ";\n"])), function (props) {
500
+ var Container = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin-top: 0.25rem;\n"])));
501
+
502
+ var FileItemContainer = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n margin-top: ", ";\n margin-left: ", ";\n"])), function (props) {
493
503
  return (props.multiple || props.files.length > 1 || props.mode !== "file") && "4px";
494
504
  }, function (props) {
495
505
  return props.mode === "file" && props.files.length === 1 && !props.multiple && "4px";
496
506
  });
497
507
 
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) {
508
+ var ErrorMessage = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (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
509
  return props.theme.errorMessageFontColor;
500
510
  }, function (props) {
501
511
  return props.theme.errorMessageFontFamily;
@@ -507,26 +517,5 @@ var ErrorMessage = _styledComponents["default"].div(_templateObject11 || (_templ
507
517
  return props.theme.errorMessageLineHeight;
508
518
  });
509
519
 
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
520
  var _default = DxcFileInput;
532
521
  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,14 +156,16 @@ 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
- return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
162
+ return props.theme.hoverDeleteFileItemBackgroundColor;
163
+ }, function (props) {
164
+ return props.theme.focusActionBorderColor;
163
165
  }, function (props) {
164
- return props.error ? props.theme.errorHoverDeleteFileItemBackgroundColor : props.theme.hoverDeleteFileItemBackgroundColor;
166
+ return props.theme.focusActionBorderColor;
165
167
  }, function (props) {
166
- return props.error ? props.theme.errorActiveDeleteFileItemBackgroundColor : props.theme.activeDeleteFileItemBackgroundColor;
168
+ return props.theme.activeDeleteFileItemBackgroundColor;
167
169
  });
168
170
 
169
171
  var ErrorMessage = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
@@ -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,112 @@
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 CommonProps = {
23
+ /**
24
+ * Name attribute.
25
+ */
26
+ name?: string;
27
+ /**
28
+ * Text to be placed above the component.
29
+ */
30
+ label?: string;
31
+ /**
32
+ * Text to be placed inside the button.
33
+ */
34
+ buttonLabel?: string;
35
+ /**
36
+ * Helper text to be placed above the component.
37
+ */
38
+ helperText?: string;
39
+ /**
40
+ * 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.
41
+ */
42
+ accept?: string;
43
+ /**
44
+ * An array of files representing the selected files.
45
+ */
46
+ value: FileData[];
47
+ /**
48
+ * The minimum file size (in bytes) allowed. If the size of the file does not comply the minSize, the file will have an error.
49
+ */
50
+ minSize?: number;
51
+ /**
52
+ * The maximum file size (in bytes) allowed. If the size of the file does not comply the maxSize, the file will have an error.
53
+ */
54
+ maxSize?: number;
55
+ /**
56
+ * 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.
57
+ */
58
+ showPreview?: boolean;
59
+ /**
60
+ * 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
61
+ * file selected and a new one is chosen, it will be replaced by the new selected one.
62
+ */
63
+ multiple?: boolean;
64
+ /**
65
+ * If true, the component will be disabled.
66
+ */
67
+ disabled?: boolean;
68
+ /**
69
+ * This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
70
+ * 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.
71
+ */
72
+ callbackFile: (files: FileData[]) => void;
73
+ /**
74
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
75
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
76
+ */
77
+ margin?: Space | Margin;
78
+ /**
79
+ * Value of the tabindex attribute.
80
+ */
81
+ tabIndex?: number;
82
+ };
83
+ declare type DropModeProps = CommonProps & {
84
+ /**
85
+ * Uses one of the available file input modes:
86
+ * 'file': Files are selected by clicking the button and selecting it through the file explorer.
87
+ * '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.
88
+ * '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.
89
+ * The drag and drop area of this mode is bigger than the one of the filedrop mode.
90
+ */
91
+ mode: "filedrop" | "dropzone";
92
+ /**
93
+ * Text to be placed inside the drag and drop zone alongside the button.
94
+ */
95
+ dropAreaLabel?: string;
96
+ };
97
+ declare type FileModeProps = CommonProps & {
98
+ /**
99
+ * Uses one of the available file input modes:
100
+ * 'file': Files are selected by clicking the button and selecting it through the file explorer.
101
+ * '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.
102
+ * '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.
103
+ * The drag and drop area of this mode is bigger than the one of the filedrop mode.
104
+ */
105
+ mode?: "file";
106
+ /**
107
+ * Text to be placed inside the drag and drop zone alongside the button.
108
+ */
109
+ dropAreaLabel?: never;
110
+ };
111
+ declare type Props = DropModeProps | FileModeProps;
112
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import FooterPropsType from "./types";
3
- declare const DxcFooter: ({ socialLinks, bottomLinks, copyright, children, padding, margin, tabIndex }: FooterPropsType) => JSX.Element;
3
+ declare const DxcFooter: ({ socialLinks, bottomLinks, copyright, children, padding, margin, tabIndex, }: FooterPropsType) => JSX.Element;
4
4
  export default DxcFooter;
package/footer/Footer.js CHANGED
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
13
 
14
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
+
16
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
17
 
18
18
  var _react = _interopRequireWildcard(require("react"));
@@ -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
 
@@ -110,9 +110,9 @@ var DxcFooter = function DxcFooter(_ref) {
110
110
  key: "social".concat(index).concat(link.href),
111
111
  index: index,
112
112
  href: link && link.href ? link.href : ""
113
- }, link.logo ? /*#__PURE__*/_react["default"].createElement(SocialIconContainer, null, (0, _typeof2["default"])(link.logo) === "object" ? link.logo : /*#__PURE__*/_react["default"].createElement(link.logo)) : link && link.logoSrc && /*#__PURE__*/_react["default"].createElement(SocialIcon, {
114
- src: link.logoSrc
115
- }));
113
+ }, typeof link.logo === "string" ? /*#__PURE__*/_react["default"].createElement(SocialIconImg, {
114
+ src: link.logo
115
+ }) : /*#__PURE__*/_react["default"].createElement(SocialIconContainer, null, link.logo));
116
116
  });
117
117
  var bottomLink = bottomLinks === null || bottomLinks === void 0 ? void 0 : bottomLinks.map(function (link, index) {
118
118
  return /*#__PURE__*/_react["default"].createElement("span", {
@@ -228,7 +228,7 @@ var SocialAnchor = _styledComponents["default"].a(_templateObject9 || (_template
228
228
  return props.index === 0 ? "0px" : props.theme.socialLinksGutter;
229
229
  });
230
230
 
231
- var SocialIcon = _styledComponents["default"].img(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n fill: ", ";\n }\n"])), function (props) {
231
+ var SocialIconImg = _styledComponents["default"].img(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n & {\n display: inline-flex;\n height: ", ";\n width: ", ";\n fill: ", ";\n }\n"])), function (props) {
232
232
  return props.theme.socialLinksSize;
233
233
  }, function (props) {
234
234
  return props.theme.socialLinksSize;