@dxc-technology/halstack-react 0.0.0-ee92231 → 0.0.0-efa7c74

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 (92) hide show
  1. package/alert/Alert.stories.tsx +170 -0
  2. package/alert/types.d.ts +1 -1
  3. package/box/Box.d.ts +1 -1
  4. package/box/Box.js +2 -5
  5. package/box/types.d.ts +0 -4
  6. package/button/Button.d.ts +1 -1
  7. package/button/Button.js +4 -2
  8. package/button/Button.stories.tsx +216 -233
  9. package/button/types.d.ts +2 -2
  10. package/card/Card.js +4 -5
  11. package/card/Card.stories.tsx +201 -0
  12. package/card/ice-cream.jpg +0 -0
  13. package/card/types.d.ts +4 -6
  14. package/checkbox/types.d.ts +1 -1
  15. package/chip/Chip.stories.tsx +121 -0
  16. package/common/variables.js +13 -5
  17. package/date-input/DateInput.stories.tsx +138 -0
  18. package/dialog/Dialog.stories.tsx +212 -0
  19. package/file-input/FileInput.d.ts +4 -0
  20. package/file-input/FileInput.js +7 -28
  21. package/file-input/FileItem.d.ts +14 -0
  22. package/file-input/FileItem.js +4 -15
  23. package/file-input/types.d.ts +87 -0
  24. package/file-input/types.js +5 -0
  25. package/footer/types.d.ts +1 -1
  26. package/header/Header.stories.tsx +162 -0
  27. package/header/types.d.ts +4 -2
  28. package/heading/Heading.d.ts +4 -0
  29. package/heading/Heading.js +6 -23
  30. package/heading/Heading.stories.tsx +53 -0
  31. package/heading/types.d.ts +33 -0
  32. package/heading/types.js +5 -0
  33. package/link/Link.js +2 -2
  34. package/link/Link.stories.tsx +146 -0
  35. package/number-input/NumberInput.d.ts +4 -0
  36. package/number-input/NumberInput.js +2 -44
  37. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  38. package/number-input/NumberInputContext.d.ts +4 -0
  39. package/number-input/NumberInputContext.js +5 -2
  40. package/number-input/numberInputContextTypes.d.ts +19 -0
  41. package/number-input/numberInputContextTypes.js +5 -0
  42. package/number-input/types.d.ts +117 -0
  43. package/number-input/types.js +5 -0
  44. package/package.json +1 -1
  45. package/password-input/types.d.ts +13 -8
  46. package/radio/types.d.ts +2 -2
  47. package/resultsetTable/ResultsetTable.d.ts +4 -0
  48. package/resultsetTable/ResultsetTable.js +0 -25
  49. package/resultsetTable/types.d.ts +63 -0
  50. package/resultsetTable/types.js +5 -0
  51. package/select/Select.stories.tsx +572 -0
  52. package/sidenav/Sidenav.d.ts +9 -0
  53. package/sidenav/Sidenav.js +4 -13
  54. package/sidenav/Sidenav.stories.tsx +165 -0
  55. package/sidenav/types.d.ts +50 -0
  56. package/sidenav/types.js +5 -0
  57. package/slider/Slider.d.ts +1 -1
  58. package/slider/Slider.js +41 -30
  59. package/slider/Slider.stories.tsx +177 -0
  60. package/slider/types.d.ts +2 -7
  61. package/table/Table.js +1 -1
  62. package/tabs/Tabs.js +3 -1
  63. package/tabs/Tabs.stories.tsx +121 -0
  64. package/tabs/types.d.ts +2 -3
  65. package/tag/Tag.d.ts +4 -0
  66. package/tag/Tag.js +3 -24
  67. package/tag/{Tag.stories.jsx → Tag.stories.tsx} +0 -0
  68. package/tag/types.d.ts +60 -0
  69. package/tag/types.js +5 -0
  70. package/text-input/TextInput.d.ts +4 -0
  71. package/text-input/TextInput.js +4 -44
  72. package/text-input/types.d.ts +157 -0
  73. package/text-input/types.js +5 -0
  74. package/toggle-group/ToggleGroup.d.ts +4 -0
  75. package/toggle-group/ToggleGroup.js +5 -31
  76. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  77. package/toggle-group/types.d.ts +84 -0
  78. package/toggle-group/types.js +5 -0
  79. package/wizard/Wizard.d.ts +4 -0
  80. package/wizard/Wizard.js +11 -51
  81. package/wizard/Wizard.stories.jsx +224 -0
  82. package/wizard/types.d.ts +64 -0
  83. package/wizard/types.js +5 -0
  84. package/file-input/index.d.ts +0 -81
  85. package/heading/index.d.ts +0 -17
  86. package/number-input/index.d.ts +0 -113
  87. package/resultsetTable/index.d.ts +0 -19
  88. package/sidenav/index.d.ts +0 -13
  89. package/tag/index.d.ts +0 -24
  90. package/text-input/index.d.ts +0 -135
  91. package/toggle-group/index.d.ts +0 -21
  92. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,212 @@
1
+ import React from "react";
2
+ import { userEvent, within } from "@storybook/testing-library";
3
+ import DxcDialog from "./Dialog";
4
+ import Title from "../../.storybook/components/Title";
5
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
6
+
7
+ export default {
8
+ title: "Dialog ",
9
+ component: DxcDialog,
10
+ };
11
+
12
+ export const DefaultDialog = () => (
13
+ <>
14
+ <ExampleContainer expanded={true}>
15
+ <Title title="Default dialog" theme="light" level={4} />
16
+ <DxcDialog>
17
+ {" "}
18
+ <p>
19
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
20
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
21
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
22
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
23
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
24
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
25
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
26
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
27
+ dignissim, pharetra neque molestie, molestie lectus.
28
+ </p>{" "}
29
+ </DxcDialog>
30
+ </ExampleContainer>
31
+ </>
32
+ );
33
+
34
+ export const DialogWithoutOverlay = () => (
35
+ <ExampleContainer expanded={true}>
36
+ <Title title="Dialog Without Overlay" theme="light" level={4} />
37
+ <DxcDialog overlay={false}>
38
+ {" "}
39
+ <p>
40
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
41
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
42
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
43
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
44
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
45
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
46
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
47
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
48
+ dignissim, pharetra neque molestie, molestie lectus.
49
+ </p>{" "}
50
+ </DxcDialog>
51
+ </ExampleContainer>
52
+ );
53
+
54
+ export const DialogCloseVisibleFalse = () => (
55
+ <ExampleContainer expanded={true}>
56
+ <Title title="Dialog Close Visible" theme="dark" level={4} />
57
+ <DxcDialog isCloseVisible={false}>
58
+ {" "}
59
+ <p>
60
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
61
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
62
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
63
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
64
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
65
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
66
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
67
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
68
+ dignissim, pharetra neque molestie, molestie lectus.
69
+ </p>{" "}
70
+ </DxcDialog>
71
+ </ExampleContainer>
72
+ );
73
+
74
+ export const DialogWithXxsmallPadding = () => (
75
+ <ExampleContainer expanded={true}>
76
+ <Title title="Dialog With Xxsmall Padding" theme="light" level={4} />
77
+ <DxcDialog padding={"xxsmall"}>
78
+ {" "}
79
+ <p>
80
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
81
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
82
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
83
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
84
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
85
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
86
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
87
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
88
+ dignissim, pharetra neque molestie, molestie lectus.
89
+ </p>{" "}
90
+ </DxcDialog>
91
+ </ExampleContainer>
92
+ );
93
+
94
+ export const DialogWithXsmallPadding = () => (
95
+ <ExampleContainer expanded={true}>
96
+ <Title title="Dialog With Xsmall Padding" theme="light" level={4} />
97
+ <DxcDialog padding={"xsmall"}>
98
+ {" "}
99
+ <p>
100
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
101
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
102
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
103
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
104
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
105
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
106
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
107
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
108
+ dignissim, pharetra neque molestie, molestie lectus.
109
+ </p>{" "}
110
+ </DxcDialog>
111
+ </ExampleContainer>
112
+ );
113
+
114
+ export const DialogWithSmallPadding = () => (
115
+ <ExampleContainer expanded={true}>
116
+ <Title title="Dialog With Small Padding" theme="light" level={4} />
117
+ <DxcDialog padding={"small"}>
118
+ {" "}
119
+ <p>
120
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
121
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
122
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
123
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
124
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
125
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
126
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
127
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
128
+ dignissim, pharetra neque molestie, molestie lectus.
129
+ </p>{" "}
130
+ </DxcDialog>
131
+ </ExampleContainer>
132
+ );
133
+
134
+ export const DialogWithMediumPadding = () => (
135
+ <ExampleContainer expanded={true}>
136
+ <Title title="Dialog With Medium Padding" theme="light" level={4} />
137
+ <DxcDialog padding={"medium"}>
138
+ {" "}
139
+ <p>
140
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
141
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
142
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
143
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
144
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
145
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
146
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
147
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
148
+ dignissim, pharetra neque molestie, molestie lectus.
149
+ </p>{" "}
150
+ </DxcDialog>
151
+ </ExampleContainer>
152
+ );
153
+
154
+ export const DialogWithLargePadding = () => (
155
+ <ExampleContainer expanded={true}>
156
+ <Title title="Dialog With Large Padding" theme="light" level={4} />
157
+ <DxcDialog padding={"large"}>
158
+ {" "}
159
+ <p>
160
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
161
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
162
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
163
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
164
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
165
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
166
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
167
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
168
+ dignissim, pharetra neque molestie, molestie lectus.
169
+ </p>{" "}
170
+ </DxcDialog>
171
+ </ExampleContainer>
172
+ );
173
+
174
+ export const DialogWithXlargePadding = () => (
175
+ <ExampleContainer expanded={true}>
176
+ <Title title="Dialog With Xlarge Padding" theme="light" level={4} />
177
+ <DxcDialog padding={"xlarge"}>
178
+ {" "}
179
+ <p>
180
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
181
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
182
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
183
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
184
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
185
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
186
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
187
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
188
+ dignissim, pharetra neque molestie, molestie lectus.
189
+ </p>{" "}
190
+ </DxcDialog>
191
+ </ExampleContainer>
192
+ );
193
+
194
+ export const DialogWithXxlargePadding = () => (
195
+ <ExampleContainer expanded={true}>
196
+ <Title title="Dialog With Xxlarge Padding" theme="light" level={4} />
197
+ <DxcDialog padding={"xxlarge"}>
198
+ {" "}
199
+ <p>
200
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
201
+ placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
202
+ elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
203
+ tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
204
+ eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
205
+ enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
206
+ fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
207
+ augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
208
+ dignissim, pharetra neque molestie, molestie lectus.
209
+ </p>{" "}
210
+ </DxcDialog>
211
+ </ExampleContainer>
212
+ );
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import FileInputPropsType from "./types";
3
+ declare const DxcFileInput: ({ name, mode, label, helperText, accept, minSize, maxSize, showPreview, multiple, disabled, callbackFile, value, margin, tabIndex, }: FileInputPropsType) => JSX.Element;
4
+ export default DxcFileInput;
@@ -23,8 +23,6 @@ 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");
@@ -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
@@ -368,7 +366,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
368
366
  numFiles: files.length,
369
367
  preview: file.preview,
370
368
  type: file.file.type,
371
- onDelete: onDelete
369
+ onDelete: onDelete,
370
+ tabIndex: tabIndex
372
371
  })));
373
372
  })) : /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(DragDropArea, {
374
373
  isDragging: isDragging,
@@ -408,7 +407,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
408
407
  numFiles: files.length,
409
408
  preview: file.preview,
410
409
  type: file.file.type,
411
- onDelete: onDelete
410
+ onDelete: onDelete,
411
+ tabIndex: tabIndex
412
412
  }));
413
413
  }))));
414
414
  };
@@ -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,8 +13,6 @@ 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
18
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
@@ -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,7 +103,8 @@ 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
 
@@ -178,16 +178,5 @@ var ErrorMessage = _styledComponents["default"].span(_templateObject10 || (_temp
178
178
  return props.theme.errorMessageLineHeight;
179
179
  });
180
180
 
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
181
  var _default = FileItem;
193
182
  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/types.d.ts CHANGED
@@ -38,7 +38,7 @@ declare type FooterPropsType = {
38
38
  * The center section of the footer. Can be used to render custom
39
39
  * content in this area.
40
40
  */
41
- children: React.ReactNode;
41
+ children?: React.ReactNode;
42
42
  /**
43
43
  * The text that will be displayed as copyright disclaimer.
44
44
  */
@@ -0,0 +1,162 @@
1
+ import React from "react";
2
+ import DxcHeader from "./Header";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+ import { userEvent, waitFor, within } from "@storybook/testing-library";
6
+
7
+ export default {
8
+ title: "Header",
9
+ component: DxcHeader,
10
+ };
11
+
12
+ const options: any = [
13
+ {
14
+ value: 1,
15
+ label: "Amazon",
16
+ },
17
+ ];
18
+
19
+ export const Chromatic = () => (
20
+ <>
21
+ <ExampleContainer>
22
+ <Title title="Default with dropdown" theme="light" level={4} />
23
+ <DxcHeader content={<DxcHeader.Dropdown options={options} label="Default Dropdown" />} />
24
+ </ExampleContainer>
25
+ <ExampleContainer>
26
+ <Title title="Underlined with text" theme="light" level={4} />
27
+ <DxcHeader underlined content={<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>} />
28
+ </ExampleContainer>
29
+ <ExampleContainer>
30
+ <Title title="Responsive" theme="light" level={4} />
31
+ <div style={{ width: "400px" }}>
32
+ <DxcHeader
33
+ responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
34
+ underlined
35
+ />
36
+ </div>
37
+ </ExampleContainer>
38
+ <Title title="Margins" theme="light" level={2} />
39
+ <ExampleContainer>
40
+ <Title title="Xxsmall margin" theme="light" level={4} />
41
+ <DxcHeader underlined margin="xxsmall" />
42
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
43
+ </ExampleContainer>
44
+ <ExampleContainer>
45
+ <Title title="Xsmall margin" theme="light" level={4} />
46
+ <DxcHeader underlined margin="xsmall" />
47
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
48
+ </ExampleContainer>
49
+ <ExampleContainer>
50
+ <Title title="Small margin" theme="light" level={4} />
51
+ <DxcHeader underlined margin="small" />
52
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
53
+ </ExampleContainer>
54
+ <ExampleContainer>
55
+ <Title title="Medium margin" theme="light" level={4} />
56
+ <DxcHeader underlined margin="medium" />
57
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
58
+ </ExampleContainer>
59
+ <ExampleContainer>
60
+ <Title title="Large margin" theme="light" level={4} />
61
+ <DxcHeader underlined margin="large" />
62
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
63
+ </ExampleContainer>
64
+ <ExampleContainer>
65
+ <Title title="Xlarge margin" theme="light" level={4} />
66
+ <DxcHeader underlined margin="xlarge" />
67
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
68
+ </ExampleContainer>
69
+ <ExampleContainer>
70
+ <Title title="Xxlarge margin" theme="light" level={4} />
71
+ <DxcHeader underlined margin="xxlarge" />
72
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
73
+ </ExampleContainer>
74
+
75
+ <Title title="Paddings" theme="light" level={2} />
76
+ <ExampleContainer>
77
+ <Title title="Xxsmall padding" theme="light" level={4} />
78
+ <DxcHeader underlined padding="xxsmall" />
79
+ </ExampleContainer>
80
+ <ExampleContainer>
81
+ <Title title="Xsmall padding" theme="light" level={4} />
82
+ <DxcHeader underlined padding="xsmall" />
83
+ </ExampleContainer>
84
+ <ExampleContainer>
85
+ <Title title="Small padding" theme="light" level={4} />
86
+ <DxcHeader underlined padding="small" />
87
+ </ExampleContainer>
88
+ <ExampleContainer>
89
+ <Title title="Medium padding" theme="light" level={4} />
90
+ <DxcHeader underlined padding="medium" />
91
+ </ExampleContainer>
92
+ <ExampleContainer>
93
+ <Title title="Large padding" theme="light" level={4} />
94
+ <DxcHeader underlined padding="large" />
95
+ </ExampleContainer>
96
+ <ExampleContainer>
97
+ <Title title="Xlarge padding" theme="light" level={4} />
98
+ <DxcHeader underlined padding="xlarge" />
99
+ </ExampleContainer>
100
+ <ExampleContainer>
101
+ <Title title="Xxlarge padding" theme="light" level={4} />
102
+ <DxcHeader underlined padding="xxlarge" />
103
+ </ExampleContainer>
104
+ </>
105
+ );
106
+
107
+ const RespHeader = () => (
108
+ <ExampleContainer>
109
+ <Title title="Responsive" theme="light" level={4} />
110
+ <div style={{ maxWidth: "400px" }}>
111
+ <DxcHeader
112
+ responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
113
+ underlined
114
+ />
115
+ </div>
116
+ </ExampleContainer>
117
+ );
118
+
119
+ const RespHeaderFocus = () => (
120
+ <ExampleContainer pseudoState="pseudo-focus">
121
+ <Title title="Responsive" theme="light" level={4} />
122
+ <div style={{ maxWidth: "400px" }}>
123
+ <DxcHeader
124
+ responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
125
+ underlined
126
+ />
127
+ </div>
128
+ </ExampleContainer>
129
+ );
130
+
131
+ const RespHeaderHover = () => (
132
+ <ExampleContainer pseudoState="pseudo-hover">
133
+ <Title title="Responsive" theme="light" level={4} />
134
+ <div style={{ maxWidth: "400px" }}>
135
+ <DxcHeader
136
+ responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
137
+ underlined
138
+ />
139
+ </div>
140
+ </ExampleContainer>
141
+ );
142
+
143
+ export const ResponsiveHeader = RespHeader.bind({});
144
+ ResponsiveHeader.play = async ({ canvasElement }) => {
145
+ const canvas = within(canvasElement);
146
+ await waitFor(() => canvas.findByText("Menu"));
147
+ await userEvent.click(canvas.getByText("Menu"));
148
+ };
149
+
150
+ export const ResponsiveHeaderFocus = RespHeaderFocus.bind({});
151
+ ResponsiveHeaderFocus.play = async ({ canvasElement }) => {
152
+ const canvas = within(canvasElement);
153
+ await waitFor(() => canvas.findByText("Menu"));
154
+ await userEvent.click(canvas.getByText("Menu"));
155
+ };
156
+
157
+ export const ResponsiveHeaderHover = RespHeaderHover.bind({});
158
+ ResponsiveHeaderHover.play = async ({ canvasElement }) => {
159
+ const canvas = within(canvasElement);
160
+ await waitFor(() => canvas.findByText("Menu"));
161
+ await userEvent.click(canvas.getByText("Menu"));
162
+ };
package/header/types.d.ts CHANGED
@@ -27,11 +27,13 @@ declare type Props = {
27
27
  */
28
28
  onClick?: () => void;
29
29
  /**
30
- * Size of the bottom margin to be applied to the header.
30
+ * Size of the bottom margin to be applied to the header
31
+ * ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
31
32
  */
32
33
  margin?: Space;
33
34
  /**
34
- * Size of the padding to be applied to the custom area of the component.
35
+ * Size of the padding to be applied to the custom area of the component
36
+ * ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
35
37
  * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
36
38
  * order to specify different padding sizes.
37
39
  */
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import HeadingPropsType from "./types";
3
+ declare const DxcHeading: ({ level, text, as, weight, margin }: HeadingPropsType) => JSX.Element;
4
+ export default DxcHeading;