@dxc-technology/halstack-react 0.0.0-d238e47 → 0.0.0-d30020b

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 (161) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -4
  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.d.ts +1 -1
  8. package/accordion/Accordion.js +11 -22
  9. package/accordion/Accordion.stories.tsx +307 -0
  10. package/accordion/types.d.ts +4 -8
  11. package/accordion-group/AccordionGroup.js +2 -2
  12. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  13. package/accordion-group/types.d.ts +4 -8
  14. package/alert/Alert.js +2 -2
  15. package/badge/Badge.js +1 -1
  16. package/bleed/Bleed.d.ts +3 -0
  17. package/bleed/Bleed.js +84 -0
  18. package/bleed/Bleed.stories.tsx +342 -0
  19. package/bleed/types.d.ts +13 -0
  20. package/bleed/types.js +5 -0
  21. package/box/Box.js +2 -2
  22. package/button/Button.d.ts +1 -1
  23. package/button/Button.js +9 -17
  24. package/button/Button.stories.tsx +6 -8
  25. package/button/types.d.ts +3 -7
  26. package/card/Card.js +1 -1
  27. package/card/Card.stories.tsx +1 -1
  28. package/checkbox/Checkbox.js +2 -2
  29. package/checkbox/types.d.ts +1 -1
  30. package/chip/Chip.d.ts +4 -0
  31. package/chip/Chip.js +16 -76
  32. package/chip/Chip.stories.tsx +6 -8
  33. package/chip/types.d.ts +45 -0
  34. package/chip/types.js +5 -0
  35. package/common/variables.js +57 -23
  36. package/date/Date.js +1 -1
  37. package/date-input/DateInput.js +10 -13
  38. package/dialog/Dialog.js +4 -3
  39. package/dropdown/Dropdown.d.ts +1 -1
  40. package/dropdown/Dropdown.js +13 -35
  41. package/dropdown/Dropdown.stories.tsx +249 -0
  42. package/dropdown/types.d.ts +6 -15
  43. package/file-input/FileInput.d.ts +1 -1
  44. package/file-input/FileInput.js +160 -81
  45. package/file-input/FileInput.stories.tsx +507 -0
  46. package/file-input/FileItem.js +8 -6
  47. package/file-input/types.d.ts +32 -7
  48. package/footer/Footer.d.ts +1 -1
  49. package/footer/Footer.js +28 -36
  50. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  51. package/footer/Icons.d.ts +2 -0
  52. package/footer/Icons.js +3 -3
  53. package/footer/types.d.ts +21 -17
  54. package/header/Header.js +2 -2
  55. package/header/Icons.d.ts +2 -0
  56. package/heading/Heading.js +1 -1
  57. package/heading/Heading.stories.tsx +3 -2
  58. package/input-text/InputText.js +2 -2
  59. package/inset/Inset.d.ts +3 -0
  60. package/inset/Inset.js +84 -0
  61. package/inset/Inset.stories.tsx +229 -0
  62. package/inset/types.d.ts +13 -0
  63. package/inset/types.js +5 -0
  64. package/layout/ApplicationLayout.d.ts +10 -0
  65. package/layout/ApplicationLayout.js +17 -21
  66. package/layout/ApplicationLayout.stories.tsx +171 -0
  67. package/layout/types.d.ts +57 -0
  68. package/layout/types.js +5 -0
  69. package/link/Link.js +8 -16
  70. package/link/Link.stories.tsx +6 -1
  71. package/link/types.d.ts +5 -9
  72. package/list/List.d.ts +4 -0
  73. package/list/List.js +47 -0
  74. package/list/List.stories.tsx +95 -0
  75. package/list/types.d.ts +7 -0
  76. package/list/types.js +5 -0
  77. package/main.d.ts +8 -3
  78. package/main.js +42 -2
  79. package/number-input/NumberInput.js +3 -6
  80. package/package.json +4 -2
  81. package/paginator/Paginator.js +2 -8
  82. package/password-input/PasswordInput.js +19 -18
  83. package/password-input/PasswordInput.stories.tsx +3 -3
  84. package/password-input/types.d.ts +13 -11
  85. package/progress-bar/ProgressBar.js +4 -4
  86. package/radio/Radio.js +2 -2
  87. package/radio-group/Radio.d.ts +4 -0
  88. package/radio-group/Radio.js +140 -0
  89. package/radio-group/RadioGroup.d.ts +4 -0
  90. package/radio-group/RadioGroup.js +273 -0
  91. package/radio-group/RadioGroup.stories.tsx +79 -0
  92. package/radio-group/RadioGroup.test.js +248 -0
  93. package/radio-group/types.d.ts +36 -0
  94. package/radio-group/types.js +5 -0
  95. package/resultsetTable/ResultsetTable.d.ts +1 -1
  96. package/resultsetTable/ResultsetTable.js +9 -4
  97. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  98. package/resultsetTable/types.d.ts +6 -2
  99. package/row/Row.d.ts +3 -0
  100. package/row/Row.js +127 -0
  101. package/row/Row.stories.tsx +237 -0
  102. package/row/types.d.ts +10 -0
  103. package/row/types.js +5 -0
  104. package/select/Select.d.ts +4 -0
  105. package/select/Select.js +20 -22
  106. package/select/types.d.ts +170 -0
  107. package/select/types.js +5 -0
  108. package/sidenav/Sidenav.js +2 -2
  109. package/sidenav/Sidenav.stories.tsx +18 -1
  110. package/slider/Slider.js +2 -2
  111. package/spinner/Spinner.js +2 -2
  112. package/spinner/Spinner.stories.jsx +1 -0
  113. package/stack/Stack.d.ts +3 -0
  114. package/stack/Stack.js +97 -0
  115. package/stack/Stack.stories.tsx +164 -0
  116. package/stack/types.d.ts +9 -0
  117. package/stack/types.js +5 -0
  118. package/switch/Switch.js +2 -2
  119. package/switch/Switch.stories.tsx +1 -1
  120. package/table/Table.js +2 -2
  121. package/table/Table.stories.jsx +2 -1
  122. package/tabs/Tabs.js +8 -8
  123. package/tabs/Tabs.stories.tsx +120 -0
  124. package/tabs/types.d.ts +23 -15
  125. package/tag/Tag.d.ts +1 -1
  126. package/tag/Tag.js +7 -12
  127. package/tag/Tag.stories.tsx +15 -22
  128. package/tag/types.d.ts +23 -14
  129. package/text/Text.d.ts +7 -0
  130. package/text/Text.js +30 -0
  131. package/text/Text.stories.tsx +19 -0
  132. package/text-input/TextInput.js +50 -41
  133. package/text-input/TextInput.stories.tsx +456 -0
  134. package/text-input/types.d.ts +14 -12
  135. package/textarea/Textarea.d.ts +4 -0
  136. package/textarea/Textarea.js +27 -60
  137. package/textarea/Textarea.stories.jsx +4 -3
  138. package/textarea/types.d.ts +130 -0
  139. package/textarea/types.js +5 -0
  140. package/toggle/Toggle.js +1 -1
  141. package/toggle-group/ToggleGroup.d.ts +4 -0
  142. package/toggle-group/ToggleGroup.js +16 -45
  143. package/toggle-group/ToggleGroup.stories.tsx +23 -28
  144. package/toggle-group/types.d.ts +97 -0
  145. package/toggle-group/types.js +5 -0
  146. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  147. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  148. package/upload/file-upload/FileToUpload.js +1 -1
  149. package/upload/files-upload/FilesToUpload.js +1 -1
  150. package/upload/transaction/Transaction.js +2 -2
  151. package/upload/transactions/Transactions.js +1 -1
  152. package/useTheme.d.ts +2 -0
  153. package/useTheme.js +1 -1
  154. package/wizard/Wizard.js +59 -9
  155. package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
  156. package/wizard/types.d.ts +3 -7
  157. package/chip/index.d.ts +0 -22
  158. package/select/index.d.ts +0 -131
  159. package/textarea/index.d.ts +0 -117
  160. package/toggle-group/index.d.ts +0 -21
  161. package/wizard/Icons.js +0 -65
package/link/types.d.ts CHANGED
@@ -15,10 +15,6 @@ declare type LinkCommonProps = {
15
15
  * If true, the link is disabled.
16
16
  */
17
17
  disabled?: boolean;
18
- /**
19
- * @Deprecated Source of the icon.
20
- */
21
- iconSrc?: string;
22
18
  /**
23
19
  * Indicates the position of the icon in the component.
24
20
  */
@@ -52,9 +48,9 @@ export declare type LinkTextProps = LinkCommonProps & {
52
48
  */
53
49
  text: string;
54
50
  /**
55
- * Element used as the icon that will be placed next to the link text.
51
+ * Element or path used as the icon that will be placed next to the link text.
56
52
  */
57
- icon?: SVG;
53
+ icon?: string | SVG;
58
54
  };
59
55
  export declare type LinkIconProps = LinkCommonProps & {
60
56
  /**
@@ -62,13 +58,13 @@ export declare type LinkIconProps = LinkCommonProps & {
62
58
  */
63
59
  text?: string;
64
60
  /**
65
- * Element used as the icon that will be placed next to the link text.
61
+ * Element or path used as the icon that will be placed next to the link text.
66
62
  */
67
- icon: SVG;
63
+ icon: string | SVG;
68
64
  };
69
65
  declare type Overload = {
70
66
  (props: LinkTextProps): JSX.Element;
71
67
  (props: LinkIconProps): JSX.Element;
72
68
  };
73
- declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
69
+ declare type SVG = React.SVGProps<SVGSVGElement>;
74
70
  export default Overload;
package/list/List.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import ListPropsType from "./types";
3
+ declare function List({ children, type, gutter }: ListPropsType): JSX.Element;
4
+ export default List;
package/list/List.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
15
+
16
+ var _Stack = _interopRequireDefault(require("../stack/Stack"));
17
+
18
+ var _Text = _interopRequireDefault(require("../text/Text"));
19
+
20
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
21
+
22
+ function List(_ref) {
23
+ var children = _ref.children,
24
+ _ref$type = _ref.type,
25
+ type = _ref$type === void 0 ? "disc" : _ref$type,
26
+ _ref$gutter = _ref.gutter,
27
+ gutter = _ref$gutter === void 0 ? "xxsmall" : _ref$gutter;
28
+ return /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
29
+ as: type === "number" ? "ol" : "ul",
30
+ gutter: gutter
31
+ }, _react["default"].Children.map(children, function (child, index) {
32
+ return /*#__PURE__*/_react["default"].createElement(ListItem, null, type === "number" ? /*#__PURE__*/_react["default"].createElement(Number, null, /*#__PURE__*/_react["default"].createElement(_Text["default"], null, index + 1, ".")) : type === "square" ? /*#__PURE__*/_react["default"].createElement(Square, null) : type === "circle" ? /*#__PURE__*/_react["default"].createElement(Circle, null) : /*#__PURE__*/_react["default"].createElement(Disc, null), child);
33
+ }));
34
+ }
35
+
36
+ var Number = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n user-select: none;\n margin-right: 10px;\n flex-shrink: 0;\n"])));
37
+
38
+ var Square = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: black;\n width: 5px;\n height: 5px;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n"])));
39
+
40
+ var Circle = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 5px;\n height: 5px;\n border-radius: 50%;\n border: 1px solid black;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n box-sizing: border-box;\n"])));
41
+
42
+ var Disc = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: black;\n width: 5px;\n height: 5px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-top: 10px;\n margin-right: 10px;\n"])));
43
+
44
+ var ListItem = _styledComponents["default"].li(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n padding: 0px;\n list-style: none;\n display: flex;\n"])));
45
+
46
+ var _default = List;
47
+ exports["default"] = _default;
@@ -0,0 +1,95 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import Title from "../../.storybook/components/Title";
4
+ import DxcList from "./List";
5
+ import DxcText from "../text/Text";
6
+
7
+ export default {
8
+ title: "List",
9
+ component: DxcList,
10
+ };
11
+
12
+ export const Chromatic = () => (
13
+ <>
14
+ <Title title="Default list" theme="light" level={4} />
15
+ <DxcList>
16
+ <DxcText>Text 1.</DxcText>
17
+ <DxcText>Text 2.</DxcText>
18
+ </DxcList>
19
+ <Title title="Number" theme="light" level={4} />
20
+ <DxcList type="number">
21
+ <DxcText>Text 1.</DxcText>
22
+ <DxcText>Text 2.</DxcText>
23
+ </DxcList>
24
+ <Title title="Square" theme="light" level={4} />
25
+ <DxcList type="square">
26
+ <DxcText>Text 1.</DxcText>
27
+ <DxcText>Text 2.</DxcText>
28
+ </DxcList>
29
+ <Title title="Circle" theme="light" level={4} />
30
+ <DxcList type="circle">
31
+ <DxcText>Text 1.</DxcText>
32
+ <DxcText>Text 2.</DxcText>
33
+ </DxcList>
34
+ <Title title="Multiple lines" theme="light" level={4} />
35
+ <Container>
36
+ <DxcList>
37
+ <DxcText>
38
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
39
+ magna aliqua.
40
+ </DxcText>
41
+ <DxcText>Text 2.</DxcText>
42
+ </DxcList>
43
+ </Container>
44
+ <Title title="gutter = xxxsmall" theme="light" level={4} />
45
+ <DxcList gutter="xxsmall">
46
+ <DxcText>Text 1.</DxcText>
47
+ <DxcText>Text 2.</DxcText>
48
+ </DxcList>
49
+ <Title title="gutter = xxsmall" theme="light" level={4} />
50
+ <DxcList gutter="xxsmall">
51
+ <DxcText>Text 1.</DxcText>
52
+ <DxcText>Text 2.</DxcText>
53
+ </DxcList>
54
+ <Title title="gutter = xsmall" theme="light" level={4} />
55
+ <DxcList gutter="xsmall">
56
+ <DxcText>Text 1.</DxcText>
57
+ <DxcText>Text 2.</DxcText>
58
+ </DxcList>
59
+ <Title title="gutter = small" theme="light" level={4} />
60
+ <DxcList gutter="small">
61
+ <DxcText>Text 1.</DxcText>
62
+ <DxcText>Text 2.</DxcText>
63
+ </DxcList>
64
+ <Title title="gutter = medium" theme="light" level={4} />
65
+ <DxcList gutter="medium">
66
+ <DxcText>Text 1.</DxcText>
67
+ <DxcText>Text 2.</DxcText>
68
+ </DxcList>
69
+ <Title title="gutter = large" theme="light" level={4} />
70
+ <DxcList gutter="large">
71
+ <DxcText>Text 1.</DxcText>
72
+ <DxcText>Text 2.</DxcText>
73
+ </DxcList>
74
+ <Title title="gutter = xlarge" theme="light" level={4} />
75
+ <DxcList gutter="xlarge">
76
+ <DxcText>Text 1.</DxcText>
77
+ <DxcText>Text 2.</DxcText>
78
+ </DxcList>
79
+ <Title title="gutter = xxlarge" theme="light" level={4} />
80
+ <DxcList gutter="xxlarge">
81
+ <DxcText>Text 1.</DxcText>
82
+ <DxcText>Text 2.</DxcText>
83
+ </DxcList>
84
+ <Title title="gutter = xxxlarge" theme="light" level={4} />
85
+ <DxcList gutter="xxxlarge">
86
+ <DxcText>Text 1.</DxcText>
87
+ <DxcText>Text 2.</DxcText>
88
+ </DxcList>
89
+
90
+ </>
91
+ );
92
+
93
+ const Container = styled.div`
94
+ width: 400px;
95
+ `;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ children: React.ReactNode;
4
+ gutter?: "none" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
5
+ type?: "disc" | "circle" | "square" | "number";
6
+ };
7
+ export default Props;
package/list/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/main.d.ts CHANGED
@@ -39,6 +39,11 @@ import DxcNumberInput from "./number-input/NumberInput";
39
39
  import DxcTextarea from "./textarea/Textarea";
40
40
  import DxcSelect from "./select/Select";
41
41
  import DxcFileInput from "./file-input/FileInput";
42
- import ThemeContext, { ThemeProvider } from "./ThemeContext.js";
43
- import { BackgroundColorProvider } from "./BackgroundColorContext.js";
44
- export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, V3DxcSelect, DxcInput, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcRadio, DxcDate, DxcHeader, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcUpload, DxcBox, DxcTag, DxcPaginator, DxcSidenav, DxcWizard, DxcLink, DxcHeading, V3DxcTextarea, DxcResultsetTable, DxcChip, DxcApplicationLayout, ThemeContext, ThemeProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, };
42
+ import DxcStack from "./stack/Stack";
43
+ import DxcRow from "./row/Row";
44
+ import DxcText from "./text/Text";
45
+ import DxcList from "./list/List";
46
+ import DxcRadioGroup from "./radio-group/RadioGroup";
47
+ import ThemeContext, { ThemeProvider } from "./ThemeContext";
48
+ import { BackgroundColorProvider } from "./BackgroundColorContext";
49
+ export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, V3DxcSelect, DxcInput, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcRadio, DxcDate, DxcHeader, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcUpload, DxcBox, DxcTag, DxcPaginator, DxcSidenav, DxcWizard, DxcLink, DxcHeading, V3DxcTextarea, DxcResultsetTable, DxcChip, DxcApplicationLayout, ThemeContext, ThemeProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcStack, DxcRow, DxcText, DxcList, DxcRadioGroup, };
package/main.js CHANGED
@@ -133,6 +133,12 @@ Object.defineProperty(exports, "DxcLink", {
133
133
  return _Link["default"];
134
134
  }
135
135
  });
136
+ Object.defineProperty(exports, "DxcList", {
137
+ enumerable: true,
138
+ get: function get() {
139
+ return _List["default"];
140
+ }
141
+ });
136
142
  Object.defineProperty(exports, "DxcNumberInput", {
137
143
  enumerable: true,
138
144
  get: function get() {
@@ -163,12 +169,24 @@ Object.defineProperty(exports, "DxcRadio", {
163
169
  return _Radio["default"];
164
170
  }
165
171
  });
172
+ Object.defineProperty(exports, "DxcRadioGroup", {
173
+ enumerable: true,
174
+ get: function get() {
175
+ return _RadioGroup["default"];
176
+ }
177
+ });
166
178
  Object.defineProperty(exports, "DxcResultsetTable", {
167
179
  enumerable: true,
168
180
  get: function get() {
169
181
  return _ResultsetTable["default"];
170
182
  }
171
183
  });
184
+ Object.defineProperty(exports, "DxcRow", {
185
+ enumerable: true,
186
+ get: function get() {
187
+ return _Row["default"];
188
+ }
189
+ });
172
190
  Object.defineProperty(exports, "DxcSelect", {
173
191
  enumerable: true,
174
192
  get: function get() {
@@ -193,6 +211,12 @@ Object.defineProperty(exports, "DxcSpinner", {
193
211
  return _Spinner["default"];
194
212
  }
195
213
  });
214
+ Object.defineProperty(exports, "DxcStack", {
215
+ enumerable: true,
216
+ get: function get() {
217
+ return _Stack["default"];
218
+ }
219
+ });
196
220
  Object.defineProperty(exports, "DxcSwitch", {
197
221
  enumerable: true,
198
222
  get: function get() {
@@ -217,6 +241,12 @@ Object.defineProperty(exports, "DxcTag", {
217
241
  return _Tag["default"];
218
242
  }
219
243
  });
244
+ Object.defineProperty(exports, "DxcText", {
245
+ enumerable: true,
246
+ get: function get() {
247
+ return _Text["default"];
248
+ }
249
+ });
220
250
  Object.defineProperty(exports, "DxcTextInput", {
221
251
  enumerable: true,
222
252
  get: function get() {
@@ -354,9 +384,19 @@ var _Select = _interopRequireDefault(require("./select/Select"));
354
384
 
355
385
  var _FileInput = _interopRequireDefault(require("./file-input/FileInput"));
356
386
 
357
- var _ThemeContext = _interopRequireWildcard(require("./ThemeContext.js"));
387
+ var _Stack = _interopRequireDefault(require("./stack/Stack"));
388
+
389
+ var _Row = _interopRequireDefault(require("./row/Row"));
390
+
391
+ var _Text = _interopRequireDefault(require("./text/Text"));
392
+
393
+ var _List = _interopRequireDefault(require("./list/List"));
394
+
395
+ var _RadioGroup = _interopRequireDefault(require("./radio-group/RadioGroup"));
396
+
397
+ var _ThemeContext = _interopRequireWildcard(require("./ThemeContext"));
358
398
 
359
- var _BackgroundColorContext = require("./BackgroundColorContext.js");
399
+ var _BackgroundColorContext = require("./BackgroundColorContext");
360
400
 
361
401
  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); }
362
402
 
@@ -20,13 +20,11 @@ var _NumberInputContext = _interopRequireDefault(require("./NumberInputContext")
20
20
  var _templateObject;
21
21
 
22
22
  var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
23
- var _ref$label = _ref.label,
24
- label = _ref$label === void 0 ? "" : _ref$label,
23
+ var label = _ref.label,
25
24
  _ref$name = _ref.name,
26
25
  name = _ref$name === void 0 ? "" : _ref$name,
27
26
  value = _ref.value,
28
- _ref$helperText = _ref.helperText,
29
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
27
+ helperText = _ref.helperText,
30
28
  _ref$placeholder = _ref.placeholder,
31
29
  placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
32
30
  _ref$disabled = _ref.disabled,
@@ -43,8 +41,7 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
43
41
  step = _ref$step === void 0 ? 1 : _ref$step,
44
42
  onChange = _ref.onChange,
45
43
  onBlur = _ref.onBlur,
46
- _ref$error = _ref.error,
47
- error = _ref$error === void 0 ? "" : _ref$error,
44
+ error = _ref.error,
48
45
  _ref$autocomplete = _ref.autocomplete,
49
46
  autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
50
47
  margin = _ref.margin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxc-technology/halstack-react",
3
- "version": "0.0.0-d238e47",
3
+ "version": "0.0.0-d30020b",
4
4
  "description": "DXC Halstack React components library",
5
5
  "repository": "dxc-technology/halstack-react",
6
6
  "homepage": "http://developer.dxc.com/tools/react",
@@ -24,6 +24,8 @@
24
24
  "@material-ui/lab": "4.0.0-alpha.17",
25
25
  "@material-ui/pickers": "3.2.2",
26
26
  "@material-ui/styles": "4.0.2",
27
+ "@types/styled-components": "^5.1.24",
28
+ "@types/uuid": "^8.3.4",
27
29
  "color": "^3.1.3",
28
30
  "date-fns": "^2.0.0-beta.4",
29
31
  "moment": "2.24.0",
@@ -52,8 +54,8 @@
52
54
  "@storybook/addon-essentials": "^6.4.9",
53
55
  "@storybook/addon-links": "^6.4.9",
54
56
  "@storybook/react": "^6.4.9",
55
- "@testing-library/react": "^11.2.5",
56
57
  "@storybook/testing-library": "0.0.7",
58
+ "@testing-library/react": "^11.2.5",
57
59
  "@testing-library/user-event": "^12.6.3",
58
60
  "babel-jest": "^24.8.0",
59
61
  "babel-loader": "^8.0.6",
@@ -15,7 +15,7 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
17
 
18
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
18
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
19
19
 
20
20
  var _Button = _interopRequireDefault(require("../button/Button"));
21
21
 
@@ -23,7 +23,7 @@ var _Select = _interopRequireDefault(require("../select/Select"));
23
23
 
24
24
  var _Icons = require("./Icons");
25
25
 
26
- var _BackgroundColorContext = require("../BackgroundColorContext.js");
26
+ var _BackgroundColorContext = require("../BackgroundColorContext");
27
27
 
28
28
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
29
29
 
@@ -67,9 +67,6 @@ var DxcPaginator = function DxcPaginator(_ref) {
67
67
  },
68
68
  value: itemsPerPage.toString(),
69
69
  size: "fillParent",
70
- margin: {
71
- top: "xsmall"
72
- },
73
70
  tabIndex: tabIndex
74
71
  }))), /*#__PURE__*/_react["default"].createElement(TotalItemsContainer, null, minItemsPerPage, " to ", maxItemsPerPage, " of ", totalItems), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
75
72
  size: "small",
@@ -109,9 +106,6 @@ var DxcPaginator = function DxcPaginator(_ref) {
109
106
  },
110
107
  value: currentPage.toString(),
111
108
  size: "fillParent",
112
- margin: {
113
- top: "xsmall"
114
- },
115
109
  tabIndex: tabIndex
116
110
  }))) || /*#__PURE__*/_react["default"].createElement(TextContainer, null, "Page: ", currentPageInternal, " of ", totalPages), onPageChange && /*#__PURE__*/_react["default"].createElement(_Button["default"], {
117
111
  size: "small",
@@ -26,21 +26,19 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
26
26
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
27
 
28
28
  var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
29
- var _ref$label = _ref.label,
30
- label = _ref$label === void 0 ? "" : _ref$label,
29
+ var label = _ref.label,
31
30
  _ref$name = _ref.name,
32
31
  name = _ref$name === void 0 ? "" : _ref$name,
33
32
  value = _ref.value,
34
- _ref$helperText = _ref.helperText,
35
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
33
+ helperText = _ref.helperText,
36
34
  _ref$clearable = _ref.clearable,
37
35
  clearable = _ref$clearable === void 0 ? false : _ref$clearable,
38
36
  onChange = _ref.onChange,
39
37
  onBlur = _ref.onBlur,
40
- _ref$error = _ref.error,
41
- error = _ref$error === void 0 ? "" : _ref$error,
38
+ error = _ref.error,
42
39
  pattern = _ref.pattern,
43
- length = _ref.length,
40
+ minLength = _ref.minLength,
41
+ maxLength = _ref.maxLength,
44
42
  _ref$autocomplete = _ref.autocomplete,
45
43
  autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
46
44
  margin = _ref.margin,
@@ -59,25 +57,27 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
59
57
  var setInputType = function setInputType(type) {
60
58
  var _inputRef$current, _inputRef$current$chi;
61
59
 
62
- inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$chi = _inputRef$current.children[2]) === null || _inputRef$current$chi === void 0 ? void 0 : _inputRef$current$chi.children[0].setAttribute("type", type);
60
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : (_inputRef$current$chi = _inputRef$current.children[label && helperText ? 2 : label || helperText ? 1 : 0]) === null || _inputRef$current$chi === void 0 ? void 0 : _inputRef$current$chi.children[0].setAttribute("type", type);
63
61
  };
64
62
 
65
63
  var setAriaAttributes = function setAriaAttributes(ariaExpanded, ariaLabel) {
64
+ var inputIndex = label && helperText ? 2 : label || helperText ? 1 : 0;
65
+
66
66
  if (error && clearable && value) {
67
67
  var _inputRef$current2, _inputRef$current2$ch, _inputRef$current2$ch2, _inputRef$current3, _inputRef$current3$ch, _inputRef$current3$ch2;
68
68
 
69
- inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : (_inputRef$current2$ch = _inputRef$current2.children[2]) === null || _inputRef$current2$ch === void 0 ? void 0 : (_inputRef$current2$ch2 = _inputRef$current2$ch.children[3]) === null || _inputRef$current2$ch2 === void 0 ? void 0 : _inputRef$current2$ch2.setAttribute("aria-expanded", ariaExpanded);
70
- inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : (_inputRef$current3$ch = _inputRef$current3.children[2]) === null || _inputRef$current3$ch === void 0 ? void 0 : (_inputRef$current3$ch2 = _inputRef$current3$ch.children[3]) === null || _inputRef$current3$ch2 === void 0 ? void 0 : _inputRef$current3$ch2.setAttribute("aria-label", ariaLabel);
69
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : (_inputRef$current2$ch = _inputRef$current2.children[inputIndex]) === null || _inputRef$current2$ch === void 0 ? void 0 : (_inputRef$current2$ch2 = _inputRef$current2$ch.children[3]) === null || _inputRef$current2$ch2 === void 0 ? void 0 : _inputRef$current2$ch2.setAttribute("aria-expanded", ariaExpanded);
70
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : (_inputRef$current3$ch = _inputRef$current3.children[inputIndex]) === null || _inputRef$current3$ch === void 0 ? void 0 : (_inputRef$current3$ch2 = _inputRef$current3$ch.children[3]) === null || _inputRef$current3$ch2 === void 0 ? void 0 : _inputRef$current3$ch2.setAttribute("aria-label", ariaLabel);
71
71
  } else if (error || clearable && !value) {
72
72
  var _inputRef$current4, _inputRef$current4$ch, _inputRef$current4$ch2, _inputRef$current5, _inputRef$current5$ch, _inputRef$current5$ch2;
73
73
 
74
- inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : (_inputRef$current4$ch = _inputRef$current4.children[2]) === null || _inputRef$current4$ch === void 0 ? void 0 : (_inputRef$current4$ch2 = _inputRef$current4$ch.children[2]) === null || _inputRef$current4$ch2 === void 0 ? void 0 : _inputRef$current4$ch2.setAttribute("aria-expanded", ariaExpanded);
75
- inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : (_inputRef$current5$ch = _inputRef$current5.children[2]) === null || _inputRef$current5$ch === void 0 ? void 0 : (_inputRef$current5$ch2 = _inputRef$current5$ch.children[2]) === null || _inputRef$current5$ch2 === void 0 ? void 0 : _inputRef$current5$ch2.setAttribute("aria-label", ariaLabel);
74
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : (_inputRef$current4$ch = _inputRef$current4.children[inputIndex]) === null || _inputRef$current4$ch === void 0 ? void 0 : (_inputRef$current4$ch2 = _inputRef$current4$ch.children[2]) === null || _inputRef$current4$ch2 === void 0 ? void 0 : _inputRef$current4$ch2.setAttribute("aria-expanded", ariaExpanded);
75
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : (_inputRef$current5$ch = _inputRef$current5.children[inputIndex]) === null || _inputRef$current5$ch === void 0 ? void 0 : (_inputRef$current5$ch2 = _inputRef$current5$ch.children[2]) === null || _inputRef$current5$ch2 === void 0 ? void 0 : _inputRef$current5$ch2.setAttribute("aria-label", ariaLabel);
76
76
  } else {
77
77
  var _inputRef$current6, _inputRef$current6$ch, _inputRef$current6$ch2, _inputRef$current7, _inputRef$current7$ch, _inputRef$current7$ch2;
78
78
 
79
- inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : (_inputRef$current6$ch = _inputRef$current6.children[2]) === null || _inputRef$current6$ch === void 0 ? void 0 : (_inputRef$current6$ch2 = _inputRef$current6$ch.children[1]) === null || _inputRef$current6$ch2 === void 0 ? void 0 : _inputRef$current6$ch2.setAttribute("aria-expanded", ariaExpanded);
80
- inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : (_inputRef$current7$ch = _inputRef$current7.children[2]) === null || _inputRef$current7$ch === void 0 ? void 0 : (_inputRef$current7$ch2 = _inputRef$current7$ch.children[1]) === null || _inputRef$current7$ch2 === void 0 ? void 0 : _inputRef$current7$ch2.setAttribute("aria-label", ariaLabel);
79
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : (_inputRef$current6$ch = _inputRef$current6.children[inputIndex]) === null || _inputRef$current6$ch === void 0 ? void 0 : (_inputRef$current6$ch2 = _inputRef$current6$ch.children[1]) === null || _inputRef$current6$ch2 === void 0 ? void 0 : _inputRef$current6$ch2.setAttribute("aria-expanded", ariaExpanded);
80
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current7 = inputRef.current) === null || _inputRef$current7 === void 0 ? void 0 : (_inputRef$current7$ch = _inputRef$current7.children[inputIndex]) === null || _inputRef$current7$ch === void 0 ? void 0 : (_inputRef$current7$ch2 = _inputRef$current7$ch.children[1]) === null || _inputRef$current7$ch2 === void 0 ? void 0 : _inputRef$current7$ch2.setAttribute("aria-label", ariaLabel);
81
81
  }
82
82
  };
83
83
 
@@ -86,14 +86,14 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
86
86
  };
87
87
 
88
88
  (0, _react.useEffect)(function () {
89
- setAriaAttributes(false, "Show");
89
+ setAriaAttributes(false, "Show password");
90
90
 
91
91
  if (isPasswordVisible) {
92
92
  setInputType("text");
93
- setAriaAttributes(true, "Hide");
93
+ setAriaAttributes(true, "Hide password");
94
94
  } else {
95
95
  setInputType("password");
96
- setAriaAttributes(false, "Show");
96
+ setAriaAttributes(false, "Show password");
97
97
  }
98
98
  }, [isPasswordVisible]);
99
99
 
@@ -150,7 +150,8 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
150
150
  margin: margin,
151
151
  size: size,
152
152
  pattern: pattern,
153
- length: length,
153
+ minLength: minLength,
154
+ maxLength: maxLength,
154
155
  autocomplete: autocomplete,
155
156
  tabIndex: tabIndex
156
157
  }));
@@ -53,7 +53,7 @@ export const Chromatic = () => (
53
53
  <Title title="Margins" theme="light" level={2} />
54
54
  <ExampleContainer>
55
55
  <Title title="Xxsmall margin" theme="light" level={4} />
56
- <DxcPasswordInput label="Xxsmmall" margin="xxsmall" />
56
+ <DxcPasswordInput label="Xxsmall" margin="xxsmall" />
57
57
  </ExampleContainer>
58
58
  <ExampleContainer>
59
59
  <Title title="Xsmall margin" theme="light" level={4} />
@@ -100,7 +100,7 @@ export const Chromatic = () => (
100
100
  );
101
101
 
102
102
  const Password = () => (
103
- <ExampleContainer>
103
+ <ExampleContainer expanded>
104
104
  <Title title="Show password" theme="light" level={4} />
105
105
  <DxcPasswordInput label="Password input" value="Password" />
106
106
  </ExampleContainer>
@@ -108,7 +108,7 @@ const Password = () => (
108
108
  const PasswordDark = () => (
109
109
  <BackgroundColorProvider color="#333333">
110
110
  <DarkContainer>
111
- <ExampleContainer>
111
+ <ExampleContainer expanded>
112
112
  <Title title="Show password" theme="dark" level={4} />
113
113
  <DxcPasswordInput label="Password input" value="Password" />
114
114
  </ExampleContainer>
@@ -5,14 +5,6 @@ declare type Margin = {
5
5
  left?: Space;
6
6
  right?: Space;
7
7
  };
8
- declare type RequiredMinLength = {
9
- min: number;
10
- max?: number;
11
- };
12
- declare type RequiredMaxLength = {
13
- min?: number;
14
- max: number;
15
- };
16
8
  declare type Props = {
17
9
  /**
18
10
  * Text to be placed above the password.
@@ -70,15 +62,25 @@ declare type Props = {
70
62
  */
71
63
  pattern?: string;
72
64
  /**
73
- * Specifies the minimun and maximum length allowed by the password input.
65
+ * Specifies the minimun length allowed by the password input.
66
+ * This will be checked both when the input element loses the
67
+ * focus and while typing within it. If the string entered does not
68
+ * comply the minimum length, the onBlur and onChange functions will be called
69
+ * with the current value and an internal error informing that the value
70
+ * length does not comply the specified range. If a valid length is
71
+ * reached, the error parameter of both events will be null.
72
+ */
73
+ minLength?: number;
74
+ /**
75
+ * Specifies the maximum length allowed by the password input.
74
76
  * This will be checked both when the input element loses the
75
77
  * focus and while typing within it. If the string entered does not
76
- * comply the length, the onBlur and onChange functions will be called
78
+ * comply the maximum length, the onBlur and onChange functions will be called
77
79
  * with the current value and an internal error informing that the value
78
80
  * length does not comply the specified range. If a valid length is
79
81
  * reached, the error parameter of both events will be null.
80
82
  */
81
- length?: RequiredMinLength | RequiredMaxLength;
83
+ maxLength?: number;
82
84
  /**
83
85
  * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
84
86
  * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
@@ -21,9 +21,9 @@ var _LinearProgress = _interopRequireDefault(require("@material-ui/core/LinearPr
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 = _interopRequireDefault(require("../BackgroundColorContext.js"));
26
+ var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
27
27
 
28
28
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
29
29
 
@@ -59,9 +59,9 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
59
59
  overlay: overlay,
60
60
  showValue: showValue,
61
61
  backgroundType: backgroundType
62
- }, value === null ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100, " %")), /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], {
62
+ }, value === null || value === undefined ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100, " %")), /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], {
63
63
  variant: showValue ? "determinate" : "indeterminate",
64
- value: value === null ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100
64
+ value: value === null || value === undefined ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100
65
65
  }), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
66
66
  overlay: overlay,
67
67
  backgroundType: backgroundType
package/radio/Radio.js CHANGED
@@ -27,9 +27,9 @@ var _variables = require("../common/variables.js");
27
27
 
28
28
  var _utils = require("../common/utils.js");
29
29
 
30
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
30
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
31
31
 
32
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
32
+ var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
33
33
 
34
34
  var _templateObject, _templateObject2;
35
35
 
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { RadioProps } from "./types";
3
+ declare const _default: React.MemoExoticComponent<({ option, currentValue, onClick, onFocus, error, disabled, focused, readonly, }: RadioProps) => JSX.Element>;
4
+ export default _default;