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

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 (203) 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.js +2 -2
  8. package/accordion/Accordion.stories.tsx +307 -0
  9. package/accordion/types.d.ts +1 -1
  10. package/accordion-group/AccordionGroup.js +2 -2
  11. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  12. package/accordion-group/types.d.ts +1 -1
  13. package/alert/Alert.js +2 -2
  14. package/alert/Alert.stories.tsx +170 -0
  15. package/alert/types.d.ts +1 -1
  16. package/badge/Badge.js +1 -1
  17. package/bleed/Bleed.d.ts +3 -0
  18. package/bleed/Bleed.js +84 -0
  19. package/bleed/Bleed.stories.tsx +342 -0
  20. package/bleed/types.d.ts +13 -0
  21. package/bleed/types.js +5 -0
  22. package/box/Box.d.ts +1 -1
  23. package/box/Box.js +4 -7
  24. package/box/types.d.ts +0 -4
  25. package/button/Button.d.ts +1 -1
  26. package/button/Button.js +13 -19
  27. package/button/Button.stories.tsx +222 -241
  28. package/button/types.d.ts +5 -9
  29. package/card/Card.js +5 -6
  30. package/card/Card.stories.tsx +201 -0
  31. package/card/ice-cream.jpg +0 -0
  32. package/card/types.d.ts +4 -6
  33. package/checkbox/Checkbox.js +2 -2
  34. package/checkbox/types.d.ts +2 -2
  35. package/chip/Chip.d.ts +4 -0
  36. package/chip/Chip.js +5 -27
  37. package/chip/Chip.stories.tsx +121 -0
  38. package/chip/types.d.ts +53 -0
  39. package/chip/types.js +5 -0
  40. package/common/variables.js +70 -27
  41. package/date/Date.js +1 -1
  42. package/date-input/DateInput.js +10 -13
  43. package/date-input/DateInput.stories.tsx +138 -0
  44. package/dialog/Dialog.js +4 -3
  45. package/dialog/Dialog.stories.tsx +212 -0
  46. package/dropdown/Dropdown.js +1 -1
  47. package/dropdown/Dropdown.stories.tsx +247 -0
  48. package/dropdown/types.d.ts +1 -1
  49. package/file-input/FileInput.d.ts +4 -0
  50. package/file-input/FileInput.js +167 -109
  51. package/file-input/FileInput.stories.tsx +507 -0
  52. package/file-input/FileItem.d.ts +14 -0
  53. package/file-input/FileItem.js +12 -21
  54. package/file-input/types.d.ts +112 -0
  55. package/file-input/types.js +5 -0
  56. package/footer/Footer.d.ts +1 -1
  57. package/footer/Footer.js +28 -36
  58. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  59. package/footer/Icons.d.ts +2 -0
  60. package/footer/Icons.js +3 -3
  61. package/footer/types.d.ts +22 -18
  62. package/header/Header.js +2 -2
  63. package/header/Header.stories.tsx +162 -0
  64. package/header/Icons.d.ts +2 -0
  65. package/header/types.d.ts +4 -2
  66. package/heading/Heading.d.ts +4 -0
  67. package/heading/Heading.js +7 -24
  68. package/heading/Heading.stories.tsx +54 -0
  69. package/heading/types.d.ts +33 -0
  70. package/heading/types.js +5 -0
  71. package/input-text/InputText.js +2 -2
  72. package/inset/Inset.d.ts +3 -0
  73. package/inset/Inset.js +84 -0
  74. package/inset/Inset.stories.tsx +229 -0
  75. package/inset/types.d.ts +13 -0
  76. package/inset/types.js +5 -0
  77. package/layout/ApplicationLayout.d.ts +10 -0
  78. package/layout/ApplicationLayout.js +9 -19
  79. package/layout/ApplicationLayout.stories.tsx +171 -0
  80. package/layout/types.d.ts +57 -0
  81. package/layout/types.js +5 -0
  82. package/link/Link.js +3 -3
  83. package/link/Link.stories.tsx +146 -0
  84. package/list/List.d.ts +4 -0
  85. package/list/List.js +47 -0
  86. package/list/List.stories.tsx +95 -0
  87. package/list/types.d.ts +7 -0
  88. package/list/types.js +5 -0
  89. package/main.d.ts +7 -3
  90. package/main.js +34 -2
  91. package/number-input/NumberInput.d.ts +4 -0
  92. package/number-input/NumberInput.js +5 -50
  93. package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
  94. package/number-input/NumberInputContext.d.ts +4 -0
  95. package/number-input/NumberInputContext.js +5 -2
  96. package/number-input/numberInputContextTypes.d.ts +19 -0
  97. package/number-input/numberInputContextTypes.js +5 -0
  98. package/number-input/types.d.ts +117 -0
  99. package/number-input/types.js +5 -0
  100. package/package.json +4 -2
  101. package/paginator/Paginator.js +2 -8
  102. package/password-input/PasswordInput.js +19 -18
  103. package/password-input/PasswordInput.stories.tsx +3 -3
  104. package/password-input/types.d.ts +17 -10
  105. package/progress-bar/ProgressBar.js +4 -4
  106. package/radio/Radio.js +2 -2
  107. package/radio/types.d.ts +2 -2
  108. package/radio-group/Radio.d.ts +4 -0
  109. package/radio-group/Radio.js +140 -0
  110. package/radio-group/RadioGroup.d.ts +4 -0
  111. package/radio-group/RadioGroup.js +273 -0
  112. package/radio-group/RadioGroup.stories.tsx +79 -0
  113. package/radio-group/RadioGroup.test.js +248 -0
  114. package/radio-group/types.d.ts +36 -0
  115. package/radio-group/types.js +5 -0
  116. package/resultsetTable/ResultsetTable.d.ts +4 -0
  117. package/resultsetTable/ResultsetTable.js +5 -28
  118. package/resultsetTable/ResultsetTable.stories.tsx +275 -0
  119. package/resultsetTable/types.d.ts +67 -0
  120. package/resultsetTable/types.js +5 -0
  121. package/row/Row.d.ts +3 -0
  122. package/row/Row.js +127 -0
  123. package/row/Row.stories.tsx +237 -0
  124. package/row/types.d.ts +10 -0
  125. package/row/types.js +5 -0
  126. package/select/Select.d.ts +4 -0
  127. package/select/Select.js +20 -22
  128. package/select/Select.stories.tsx +572 -0
  129. package/select/types.d.ts +170 -0
  130. package/select/types.js +5 -0
  131. package/sidenav/Sidenav.d.ts +9 -0
  132. package/sidenav/Sidenav.js +6 -15
  133. package/sidenav/Sidenav.stories.tsx +182 -0
  134. package/sidenav/types.d.ts +50 -0
  135. package/sidenav/types.js +5 -0
  136. package/slider/Slider.d.ts +1 -1
  137. package/slider/Slider.js +43 -32
  138. package/slider/Slider.stories.tsx +177 -0
  139. package/slider/types.d.ts +2 -7
  140. package/spinner/Spinner.js +2 -2
  141. package/spinner/Spinner.stories.jsx +1 -0
  142. package/stack/Stack.d.ts +3 -0
  143. package/stack/Stack.js +97 -0
  144. package/stack/Stack.stories.tsx +164 -0
  145. package/stack/types.d.ts +9 -0
  146. package/stack/types.js +5 -0
  147. package/switch/Switch.js +2 -2
  148. package/switch/Switch.stories.tsx +1 -1
  149. package/table/Table.js +3 -3
  150. package/table/Table.stories.jsx +2 -1
  151. package/tabs/Tabs.js +11 -9
  152. package/tabs/Tabs.stories.tsx +120 -0
  153. package/tabs/types.d.ts +25 -18
  154. package/tag/Tag.d.ts +4 -0
  155. package/tag/Tag.js +4 -25
  156. package/tag/{Tag.stories.jsx → Tag.stories.tsx} +1 -1
  157. package/tag/types.d.ts +60 -0
  158. package/tag/types.js +5 -0
  159. package/text/Text.d.ts +7 -0
  160. package/text/Text.js +30 -0
  161. package/text/Text.stories.tsx +19 -0
  162. package/text-input/TextInput.d.ts +4 -0
  163. package/text-input/TextInput.js +54 -85
  164. package/text-input/TextInput.stories.tsx +456 -0
  165. package/text-input/types.d.ts +159 -0
  166. package/text-input/types.js +5 -0
  167. package/textarea/Textarea.d.ts +4 -0
  168. package/textarea/Textarea.js +27 -60
  169. package/textarea/Textarea.stories.jsx +4 -3
  170. package/textarea/types.d.ts +130 -0
  171. package/textarea/types.js +5 -0
  172. package/toggle/Toggle.js +1 -1
  173. package/toggle-group/ToggleGroup.d.ts +4 -0
  174. package/toggle-group/ToggleGroup.js +16 -45
  175. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  176. package/toggle-group/types.d.ts +97 -0
  177. package/toggle-group/types.js +5 -0
  178. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  179. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  180. package/upload/file-upload/FileToUpload.js +1 -1
  181. package/upload/files-upload/FilesToUpload.js +1 -1
  182. package/upload/transaction/Transaction.js +2 -2
  183. package/upload/transactions/Transactions.js +1 -1
  184. package/useTheme.d.ts +2 -0
  185. package/useTheme.js +1 -1
  186. package/wizard/Wizard.d.ts +4 -0
  187. package/wizard/Wizard.js +69 -59
  188. package/wizard/Wizard.stories.tsx +224 -0
  189. package/wizard/types.d.ts +60 -0
  190. package/wizard/types.js +5 -0
  191. package/chip/index.d.ts +0 -22
  192. package/file-input/index.d.ts +0 -81
  193. package/heading/index.d.ts +0 -17
  194. package/number-input/index.d.ts +0 -113
  195. package/resultsetTable/index.d.ts +0 -19
  196. package/select/index.d.ts +0 -131
  197. package/sidenav/index.d.ts +0 -13
  198. package/tag/index.d.ts +0 -24
  199. package/text-input/index.d.ts +0 -135
  200. package/textarea/index.d.ts +0 -117
  201. package/toggle-group/index.d.ts +0 -21
  202. package/wizard/Icons.js +0 -65
  203. package/wizard/index.d.ts +0 -18
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() {
@@ -169,6 +175,12 @@ Object.defineProperty(exports, "DxcResultsetTable", {
169
175
  return _ResultsetTable["default"];
170
176
  }
171
177
  });
178
+ Object.defineProperty(exports, "DxcRow", {
179
+ enumerable: true,
180
+ get: function get() {
181
+ return _Row["default"];
182
+ }
183
+ });
172
184
  Object.defineProperty(exports, "DxcSelect", {
173
185
  enumerable: true,
174
186
  get: function get() {
@@ -193,6 +205,12 @@ Object.defineProperty(exports, "DxcSpinner", {
193
205
  return _Spinner["default"];
194
206
  }
195
207
  });
208
+ Object.defineProperty(exports, "DxcStack", {
209
+ enumerable: true,
210
+ get: function get() {
211
+ return _Stack["default"];
212
+ }
213
+ });
196
214
  Object.defineProperty(exports, "DxcSwitch", {
197
215
  enumerable: true,
198
216
  get: function get() {
@@ -217,6 +235,12 @@ Object.defineProperty(exports, "DxcTag", {
217
235
  return _Tag["default"];
218
236
  }
219
237
  });
238
+ Object.defineProperty(exports, "DxcText", {
239
+ enumerable: true,
240
+ get: function get() {
241
+ return _Text["default"];
242
+ }
243
+ });
220
244
  Object.defineProperty(exports, "DxcTextInput", {
221
245
  enumerable: true,
222
246
  get: function get() {
@@ -354,9 +378,17 @@ var _Select = _interopRequireDefault(require("./select/Select"));
354
378
 
355
379
  var _FileInput = _interopRequireDefault(require("./file-input/FileInput"));
356
380
 
357
- var _ThemeContext = _interopRequireWildcard(require("./ThemeContext.js"));
381
+ var _Stack = _interopRequireDefault(require("./stack/Stack"));
382
+
383
+ var _Row = _interopRequireDefault(require("./row/Row"));
384
+
385
+ var _Text = _interopRequireDefault(require("./text/Text"));
386
+
387
+ var _List = _interopRequireDefault(require("./list/List"));
388
+
389
+ var _ThemeContext = _interopRequireWildcard(require("./ThemeContext"));
358
390
 
359
- var _BackgroundColorContext = require("./BackgroundColorContext.js");
391
+ var _BackgroundColorContext = require("./BackgroundColorContext");
360
392
 
361
393
  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
394
 
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import NumberInputPropsType from "./types";
3
+ declare const DxcNumberInput: React.ForwardRefExoticComponent<NumberInputPropsType & React.RefAttributes<HTMLDivElement>>;
4
+ export default DxcNumberInput;
@@ -7,32 +7,24 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
11
 
14
12
  var _react = _interopRequireDefault(require("react"));
15
13
 
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
14
  var _styledComponents = _interopRequireDefault(require("styled-components"));
19
15
 
20
16
  var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
21
17
 
22
18
  var _NumberInputContext = _interopRequireDefault(require("./NumberInputContext"));
23
19
 
24
- var _variables = require("../common/variables.js");
25
-
26
20
  var _templateObject;
27
21
 
28
22
  var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
29
- var _ref$label = _ref.label,
30
- label = _ref$label === void 0 ? "" : _ref$label,
23
+ var label = _ref.label,
31
24
  _ref$name = _ref.name,
32
25
  name = _ref$name === void 0 ? "" : _ref$name,
33
26
  value = _ref.value,
34
- _ref$helperText = _ref.helperText,
35
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
27
+ helperText = _ref.helperText,
36
28
  _ref$placeholder = _ref.placeholder,
37
29
  placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
38
30
  _ref$disabled = _ref.disabled,
@@ -45,11 +37,11 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
45
37
  suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
46
38
  min = _ref.min,
47
39
  max = _ref.max,
48
- step = _ref.step,
40
+ _ref$step = _ref.step,
41
+ step = _ref$step === void 0 ? 1 : _ref$step,
49
42
  onChange = _ref.onChange,
50
43
  onBlur = _ref.onBlur,
51
- _ref$error = _ref.error,
52
- error = _ref$error === void 0 ? "" : _ref$error,
44
+ error = _ref.error,
53
45
  _ref$autocomplete = _ref.autocomplete,
54
46
  autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
55
47
  margin = _ref.margin,
@@ -85,44 +77,7 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
85
77
  })));
86
78
  });
87
79
 
88
- var sizes = {
89
- small: "240px",
90
- medium: "360px",
91
- large: "480px",
92
- fillParent: "100%"
93
- };
94
-
95
80
  var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])));
96
81
 
97
- DxcNumberInput.propTypes = {
98
- label: _propTypes["default"].string,
99
- name: _propTypes["default"].string,
100
- value: _propTypes["default"].string,
101
- helperText: _propTypes["default"].string,
102
- placeholder: _propTypes["default"].string,
103
- error: _propTypes["default"].string,
104
- disabled: _propTypes["default"].bool,
105
- optional: _propTypes["default"].bool,
106
- prefix: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({
107
- type: _propTypes["default"].oneOf(["svg"])
108
- })]),
109
- suffix: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({
110
- type: _propTypes["default"].oneOf(["svg"])
111
- })]),
112
- min: _propTypes["default"].number,
113
- max: _propTypes["default"].number,
114
- step: _propTypes["default"].number,
115
- onChange: _propTypes["default"].func,
116
- onBlur: _propTypes["default"].func,
117
- autocomplete: _propTypes["default"].string,
118
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
119
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
120
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
121
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
122
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
123
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
124
- size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
125
- tabIndex: _propTypes["default"].number
126
- };
127
82
  var _default = DxcNumberInput;
128
83
  exports["default"] = _default;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import NumberInputContextPropsType from "./numberInputContextTypes";
3
+ declare const NumberInputContext: React.Context<NumberInputContextPropsType>;
4
+ export default NumberInputContext;
@@ -9,8 +9,11 @@ exports["default"] = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
12
- /* eslint-disable prefer-template */
13
- var NumberInputContext = /*#__PURE__*/_react["default"].createContext();
12
+ var defaultState = {
13
+ stepNumber: 1
14
+ };
15
+
16
+ var NumberInputContext = /*#__PURE__*/_react["default"].createContext(defaultState);
14
17
 
15
18
  var _default = NumberInputContext;
16
19
  exports["default"] = _default;
@@ -0,0 +1,19 @@
1
+ declare type Props = {
2
+ /**
3
+ * Type of the input.
4
+ */
5
+ typeNumber?: string;
6
+ /**
7
+ * Minimum value allowed by the number input.
8
+ */
9
+ minNumber?: number;
10
+ /**
11
+ * Maximum value allowed by the number input.
12
+ */
13
+ maxNumber?: number;
14
+ /**
15
+ * The step interval to use when using the up and down arrows to adjust the value.
16
+ */
17
+ stepNumber?: number;
18
+ };
19
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,117 @@
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 Props = {
9
+ /**
10
+ * Text to be placed above the number.
11
+ */
12
+ label?: string;
13
+ /**
14
+ * Name attribute of the input element.
15
+ */
16
+ name?: string;
17
+ /**
18
+ * Value of the input element. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
19
+ */
20
+ value?: string;
21
+ /**
22
+ * Helper text to be placed above the number.
23
+ */
24
+ helperText?: string;
25
+ /**
26
+ * Text to be put as placeholder of the number.
27
+ */
28
+ placeholder?: string;
29
+ /**
30
+ * If true, the component will be disabled.
31
+ */
32
+ disabled?: boolean;
33
+ /**
34
+ * If true, the number will be optional, showing '(Optional)'
35
+ * next to the label. Otherwise, the field will be considered required
36
+ * and an error will be passed as a parameter to the OnBlur and onChange
37
+ * functions when it has not been filled.
38
+ */
39
+ optional?: boolean;
40
+ /**
41
+ * Prefix to be placed before the number value.
42
+ */
43
+ prefix?: string;
44
+ /**
45
+ * Suffix to be placed after the number value.
46
+ */
47
+ suffix?: string;
48
+ /**
49
+ * Minimum value allowed by the number input. If the typed value by the user is
50
+ * lower than min, the onBlur and onChange functions will be called with
51
+ * the current value and an internal error informing that the current
52
+ * value is not correct. If a valid state is reached, the error parameter
53
+ * will be null in both events.
54
+ */
55
+ min?: number;
56
+ /**
57
+ * Maximum value allowed by the number input. If the typed value by the user
58
+ * surpasses max, the onBlur and onChange functions will be called with
59
+ * the current value and an internal error informing that the current
60
+ * value is not correct. If a valid state is reached, the error parameter
61
+ * will be null in both events.
62
+ */
63
+ max?: number;
64
+ /**
65
+ * The step interval to use when using the up and down arrows to adjust the value.
66
+ */
67
+ step?: number;
68
+ /**
69
+ * This function will be called when the user types within the input
70
+ * element of the component. An object including the current value and
71
+ * the error (if the value entered is not valid) will be passed to this
72
+ * function. If there is no error, error will be null.
73
+ */
74
+ onChange?: (val: {
75
+ value: string;
76
+ error: string | null;
77
+ }) => void;
78
+ /**
79
+ * This function will be called when the input element loses the focus.
80
+ * An object including the input value and the error (if the value
81
+ * entered is not valid) will be passed to this function. If there is no error,
82
+ * error will be null.
83
+ */
84
+ onBlur?: (val: {
85
+ value: string;
86
+ error: string | null;
87
+ }) => void;
88
+ /**
89
+ * If it is defined, the component will change its appearance, showing
90
+ * the error below the input component. If it is not defined, the error
91
+ * messages will be managed internally, but never displayed on its own.
92
+ */
93
+ error?: string;
94
+ /**
95
+ * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
96
+ * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
97
+ */
98
+ autocomplete?: string;
99
+ /**
100
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
101
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
102
+ */
103
+ margin?: Space | Margin;
104
+ /**
105
+ * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
106
+ */
107
+ size?: "small" | "medium" | "large" | "fillParent";
108
+ /**
109
+ * Value of the tabindex attribute.
110
+ */
111
+ tabIndex?: number;
112
+ };
113
+ /**
114
+ * Reference to the component.
115
+ */
116
+ export declare type RefType = HTMLDivElement;
117
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxc-technology/halstack-react",
3
- "version": "0.0.0-ee92231",
3
+ "version": "0.0.0-f0d662d",
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>
@@ -37,10 +37,10 @@ declare type Props = {
37
37
  error: string | null;
38
38
  }) => void;
39
39
  /**
40
- * This function will be called when the input element loses the focus.
41
- * An object including the input value and the error (if the value entered is
42
- * not valid) will be passed to this function. If there is no error, error will be null.
43
- */
40
+ * This function will be called when the input element loses the focus.
41
+ * An object including the input value and the error (if the value entered is
42
+ * not valid) will be passed to this function. If there is no error, error will be null.
43
+ */
44
44
  onBlur?: (val: {
45
45
  value: string;
46
46
  error: string | null;
@@ -62,18 +62,25 @@ declare type Props = {
62
62
  */
63
63
  pattern?: string;
64
64
  /**
65
- * 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.
66
76
  * This will be checked both when the input element loses the
67
77
  * focus and while typing within it. If the string entered does not
68
- * comply the length, the onBlur and onChange functions will be called
78
+ * comply the maximum length, the onBlur and onChange functions will be called
69
79
  * with the current value and an internal error informing that the value
70
80
  * length does not comply the specified range. If a valid length is
71
81
  * reached, the error parameter of both events will be null.
72
82
  */
73
- length?: {
74
- min?: number;
75
- max?: number;
76
- };
83
+ maxLength?: number;
77
84
  /**
78
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.
79
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
 
package/radio/types.d.ts CHANGED
@@ -42,8 +42,8 @@ declare type Props = {
42
42
  */
43
43
  onClick?: (val: boolean) => void;
44
44
  /**
45
- * Size of the margin to be applied to the component. You can pass an object with 'top',
46
- * 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
45
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
46
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
47
47
  */
48
48
  margin?: Space | Margin;
49
49
  /**
@@ -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;