@dxc-technology/halstack-react 0.0.0-e884f9f → 0.0.0-e9cf865

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 (112) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -3
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +5 -8
  5. package/V3Select/V3Select.js +2 -2
  6. package/V3Textarea/V3Textarea.js +2 -2
  7. package/accordion/Accordion.js +2 -2
  8. package/accordion-group/AccordionGroup.js +2 -2
  9. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  10. package/alert/Alert.js +2 -2
  11. package/badge/Badge.js +1 -1
  12. package/box/Box.js +2 -2
  13. package/button/Button.d.ts +1 -1
  14. package/button/Button.js +6 -4
  15. package/button/types.d.ts +2 -2
  16. package/card/Card.js +1 -1
  17. package/checkbox/Checkbox.js +2 -2
  18. package/chip/Chip.d.ts +4 -0
  19. package/chip/Chip.js +1 -23
  20. package/chip/types.d.ts +53 -0
  21. package/chip/types.js +5 -0
  22. package/common/variables.js +19 -22
  23. package/date/Date.js +1 -1
  24. package/date-input/DateInput.js +4 -7
  25. package/dialog/Dialog.js +2 -2
  26. package/dropdown/Dropdown.js +1 -1
  27. package/dropdown/types.d.ts +1 -1
  28. package/file-input/FileInput.d.ts +1 -1
  29. package/file-input/FileInput.js +58 -48
  30. package/file-input/FileItem.js +8 -6
  31. package/file-input/types.d.ts +32 -7
  32. package/footer/Footer.d.ts +1 -1
  33. package/footer/Footer.js +11 -17
  34. package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
  35. package/footer/Icons.d.ts +2 -0
  36. package/footer/Icons.js +3 -3
  37. package/footer/types.d.ts +21 -17
  38. package/header/Header.js +2 -2
  39. package/header/Icons.d.ts +2 -0
  40. package/heading/Heading.js +1 -1
  41. package/input-text/InputText.js +2 -2
  42. package/layout/ApplicationLayout.d.ts +10 -0
  43. package/layout/ApplicationLayout.js +8 -18
  44. package/layout/ApplicationLayout.stories.tsx +171 -0
  45. package/layout/types.d.ts +57 -0
  46. package/layout/types.js +5 -0
  47. package/link/Link.js +1 -1
  48. package/list/List.d.ts +7 -0
  49. package/list/List.js +37 -0
  50. package/list/List.stories.tsx +70 -0
  51. package/main.d.ts +7 -3
  52. package/main.js +34 -2
  53. package/number-input/NumberInput.js +3 -6
  54. package/number-input/NumberInputContext.d.ts +4 -0
  55. package/number-input/NumberInputContext.js +5 -2
  56. package/number-input/numberInputContextTypes.d.ts +19 -0
  57. package/number-input/numberInputContextTypes.js +5 -0
  58. package/package.json +1 -1
  59. package/paginator/Paginator.js +2 -8
  60. package/password-input/PasswordInput.js +19 -18
  61. package/password-input/types.d.ts +17 -10
  62. package/progress-bar/ProgressBar.js +2 -2
  63. package/radio/Radio.js +2 -2
  64. package/resultsetTable/ResultsetTable.d.ts +4 -0
  65. package/resultsetTable/ResultsetTable.js +4 -27
  66. package/resultsetTable/types.d.ts +67 -0
  67. package/resultsetTable/types.js +5 -0
  68. package/row/Row.d.ts +11 -0
  69. package/row/Row.js +124 -0
  70. package/row/Row.stories.tsx +223 -0
  71. package/select/Select.js +15 -17
  72. package/sidenav/Sidenav.js +2 -2
  73. package/slider/Slider.js +4 -4
  74. package/spinner/Spinner.js +2 -2
  75. package/stack/Stack.d.ts +10 -0
  76. package/stack/Stack.js +94 -0
  77. package/stack/Stack.stories.tsx +150 -0
  78. package/switch/Switch.js +2 -2
  79. package/table/Table.js +3 -3
  80. package/tabs/Tabs.js +1 -1
  81. package/tabs/Tabs.stories.tsx +121 -0
  82. package/tabs/types.d.ts +1 -1
  83. package/tag/Tag.js +1 -1
  84. package/text/Text.d.ts +7 -0
  85. package/text/Text.js +30 -0
  86. package/text/Text.stories.tsx +19 -0
  87. package/text-input/TextInput.d.ts +4 -0
  88. package/text-input/TextInput.js +42 -81
  89. package/text-input/TextInput.stories.tsx +456 -0
  90. package/text-input/types.d.ts +159 -0
  91. package/text-input/types.js +5 -0
  92. package/textarea/Textarea.js +29 -32
  93. package/textarea/index.d.ts +18 -8
  94. package/toggle/Toggle.js +1 -1
  95. package/toggle-group/ToggleGroup.d.ts +4 -0
  96. package/toggle-group/ToggleGroup.js +8 -34
  97. package/toggle-group/types.d.ts +84 -0
  98. package/toggle-group/types.js +5 -0
  99. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  100. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  101. package/upload/file-upload/FileToUpload.js +1 -1
  102. package/upload/files-upload/FilesToUpload.js +1 -1
  103. package/upload/transaction/Transaction.js +2 -2
  104. package/upload/transactions/Transactions.js +1 -1
  105. package/useTheme.d.ts +2 -0
  106. package/useTheme.js +1 -1
  107. package/wizard/Wizard.js +2 -2
  108. package/wizard/types.d.ts +1 -1
  109. package/chip/index.d.ts +0 -22
  110. package/resultsetTable/index.d.ts +0 -19
  111. package/text-input/index.d.ts +0 -135
  112. package/toggle-group/index.d.ts +0 -21
@@ -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,
@@ -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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxc-technology/halstack-react",
3
- "version": "0.0.0-e884f9f",
3
+ "version": "0.0.0-e9cf865",
4
4
  "description": "DXC Halstack React components library",
5
5
  "repository": "dxc-technology/halstack-react",
6
6
  "homepage": "http://developer.dxc.com/tools/react",
@@ -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
  }));
@@ -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
 
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
+ /// <reference types="react" />
2
+ import ResultsetTablePropsType from "./types";
3
+ declare const DxcResultsetTable: ({ columns, rows, showGoToPage, itemsPerPage, itemsPerPageOptions, itemsPerPageFunction, margin, tabIndex, }: ResultsetTablePropsType) => JSX.Element;
4
+ export default DxcResultsetTable;
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
13
 
16
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -21,15 +19,13 @@ var _react = _interopRequireWildcard(require("react"));
21
19
 
22
20
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
21
 
24
- var _propTypes = _interopRequireDefault(require("prop-types"));
25
-
26
22
  var _variables = require("../common/variables.js");
27
23
 
28
24
  var _Table = _interopRequireDefault(require("../table/Table"));
29
25
 
30
26
  var _Paginator = _interopRequireDefault(require("../paginator/Paginator"));
31
27
 
32
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
28
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
33
29
 
34
30
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
35
31
 
@@ -117,6 +113,8 @@ var BothArrows = function BothArrows() {
117
113
  var DxcResultsetTable = function DxcResultsetTable(_ref) {
118
114
  var columns = _ref.columns,
119
115
  rows = _ref.rows,
116
+ _ref$showGoToPage = _ref.showGoToPage,
117
+ showGoToPage = _ref$showGoToPage === void 0 ? true : _ref$showGoToPage,
120
118
  _ref$itemsPerPage = _ref.itemsPerPage,
121
119
  itemsPerPage = _ref$itemsPerPage === void 0 ? 5 : _ref$itemsPerPage,
122
120
  itemsPerPageOptions = _ref.itemsPerPageOptions,
@@ -205,7 +203,7 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
205
203
  itemsPerPageOptions: itemsPerPageOptions,
206
204
  itemsPerPageFunction: itemsPerPageFunction,
207
205
  currentPage: page,
208
- showGoToPage: true,
206
+ showGoToPage: showGoToPage,
209
207
  onPageChange: goToPage,
210
208
  tabIndex: tabIndex
211
209
  }))));
@@ -249,26 +247,5 @@ var DxcResultsetTableContainer = _styledComponents["default"].div(_templateObjec
249
247
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
250
248
  });
251
249
 
252
- DxcResultsetTable.propTypes = {
253
- rows: _propTypes["default"].array,
254
- columns: _propTypes["default"].array,
255
- itemsPerPage: _propTypes["default"].number,
256
- itemsPerPageOptions: _propTypes["default"].arrayOf(_propTypes["default"].number),
257
- itemsPerPageFunction: _propTypes["default"].func,
258
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
259
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
260
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
261
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
262
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
263
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
264
- tabIndex: _propTypes["default"].number
265
- };
266
- DxcResultsetTable.defaultProps = {
267
- rows: [],
268
- columns: [],
269
- itemsPerPage: 5,
270
- itemsPerPageOptions: null,
271
- itemsPerPageFunction: null
272
- };
273
250
  var _default = DxcResultsetTable;
274
251
  exports["default"] = _default;
@@ -0,0 +1,67 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type Column = {
10
+ /**
11
+ * Column display value.
12
+ */
13
+ displayValue: React.ReactNode;
14
+ /**
15
+ * Boolean value to indicate whether the column is sortable or not.
16
+ */
17
+ isSortable?: boolean;
18
+ };
19
+ declare type Row = {
20
+ /**
21
+ * Value to be displayed in the cell.
22
+ */
23
+ displayValue: React.ReactNode;
24
+ /**
25
+ * Value to be used when sorting the table by that
26
+ * column. If not indicated displayValue will be used for sorting.
27
+ */
28
+ sortValue?: string;
29
+ };
30
+ declare type Props = {
31
+ /**
32
+ * An array of objects representing the columns of the table.
33
+ */
34
+ columns: Column[];
35
+ /**
36
+ * An array of objects representing the rows of the table, you will have
37
+ * as many objects as columns in the table.
38
+ */
39
+ rows: Row[];
40
+ /**
41
+ * If true, a select component for navigation between pages will be displayed.
42
+ */
43
+ showGoToPage?: boolean;
44
+ /**
45
+ * Number of items per page.
46
+ */
47
+ itemsPerPage?: number;
48
+ /**
49
+ * An array of numbers representing the items per page options.
50
+ */
51
+ itemsPerPageOptions?: number[];
52
+ /**
53
+ * This function will be called when the user selects an item per page
54
+ * option. The value selected will be passed as a parameter.
55
+ */
56
+ itemsPerPageFunction?: (newValue: number) => void;
57
+ /**
58
+ * Size of the margin to be applied to the component. You can pass an object with 'top',
59
+ * 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
60
+ */
61
+ margin?: Space | Margin;
62
+ /**
63
+ * Value of the tabindex attribute given to the sortable icon.
64
+ */
65
+ tabIndex?: number;
66
+ };
67
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/row/Row.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ declare type RowProps = {
3
+ gutter?: "none" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
4
+ align?: "start" | "center" | "end" | "baseline" | "stretch";
5
+ justify?: "start" | "center" | "end" | "spaceBetween" | "spaceAround" | "spaceEvenly";
6
+ wrap?: boolean;
7
+ reverse?: boolean;
8
+ children: React.ReactNode;
9
+ };
10
+ export default function Row({ gutter, align, justify, wrap, reverse, children }: RowProps): JSX.Element;
11
+ export {};
package/row/Row.js ADDED
@@ -0,0 +1,124 @@
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"] = Row;
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 _templateObject;
17
+
18
+ function Row(_ref) {
19
+ var _ref$gutter = _ref.gutter,
20
+ gutter = _ref$gutter === void 0 ? "none" : _ref$gutter,
21
+ align = _ref.align,
22
+ justify = _ref.justify,
23
+ _ref$wrap = _ref.wrap,
24
+ wrap = _ref$wrap === void 0 ? true : _ref$wrap,
25
+ _ref$reverse = _ref.reverse,
26
+ reverse = _ref$reverse === void 0 ? false : _ref$reverse,
27
+ children = _ref.children;
28
+ return /*#__PURE__*/_react["default"].createElement(StyledRow, {
29
+ gutter: gutter,
30
+ align: align,
31
+ justify: justify,
32
+ wrap: wrap,
33
+ reverse: reverse
34
+ }, children);
35
+ }
36
+
37
+ var StyledRow = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n flex-wrap: ", ";\n align-items: ", "};\n justify-content: ", ";\n gap: ", ";\n"])), function (_ref2) {
38
+ var reverse = _ref2.reverse;
39
+ return reverse ? "row-reverse" : "row";
40
+ }, function (_ref3) {
41
+ var wrap = _ref3.wrap;
42
+ return wrap ? "wrap" : "nowrap";
43
+ }, function (_ref4) {
44
+ var align = _ref4.align;
45
+
46
+ switch (align) {
47
+ case "start":
48
+ return "flex-start";
49
+
50
+ case "center":
51
+ return "center";
52
+
53
+ case "end":
54
+ return "flex-end";
55
+
56
+ case "baseline":
57
+ return "baseline";
58
+
59
+ case "stretch":
60
+ return "stretch";
61
+
62
+ default:
63
+ return "initial";
64
+ }
65
+ }, function (_ref5) {
66
+ var justify = _ref5.justify;
67
+
68
+ switch (justify) {
69
+ case "spaceBetween":
70
+ return "space-between";
71
+
72
+ case "spaceAround":
73
+ return "space-around";
74
+
75
+ case "spaceEvenly":
76
+ return "space-evenly";
77
+
78
+ case "start":
79
+ return "flex-start";
80
+
81
+ case "center":
82
+ return "center";
83
+
84
+ case "end":
85
+ return "flex-end";
86
+
87
+ default:
88
+ return "initial";
89
+ }
90
+ }, function (_ref6) {
91
+ var gutter = _ref6.gutter;
92
+
93
+ switch (gutter) {
94
+ case "none":
95
+ return "0";
96
+
97
+ case "xxsmall":
98
+ return "0.125rem";
99
+
100
+ case "xsmall":
101
+ return "0.25rem";
102
+
103
+ case "small":
104
+ return "0.5rem";
105
+
106
+ case "medium":
107
+ return "1rem";
108
+
109
+ case "large":
110
+ return "1.5rem";
111
+
112
+ case "xlarge":
113
+ return "2rem";
114
+
115
+ case "xxlarge":
116
+ return "3rem";
117
+
118
+ case "xxxlarge":
119
+ return "4rem";
120
+
121
+ default:
122
+ return "0";
123
+ }
124
+ });