@dxc-technology/halstack-react 0.0.0-bfdc357 → 0.0.0-c1c5f49
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.
- package/alert/types.d.ts +1 -1
- package/button/Button.d.ts +1 -1
- package/button/Button.js +4 -2
- package/button/types.d.ts +2 -2
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/types.d.ts +1 -1
- package/common/variables.js +3 -2
- package/file-input/FileInput.js +22 -22
- package/file-input/FileItem.js +5 -3
- package/header/types.d.ts +4 -2
- package/heading/Heading.stories.tsx +53 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/package.json +1 -1
- package/password-input/PasswordInput.js +4 -2
- package/password-input/types.d.ts +17 -10
- package/radio/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +3 -26
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/select/Select.js +1 -1
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/slider/Slider.js +2 -2
- package/table/Table.js +1 -1
- package/tabs/Tabs.js +3 -1
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +2 -3
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +18 -57
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.js +13 -14
- package/textarea/index.d.ts +18 -8
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +5 -31
- package/toggle-group/types.d.ts +84 -0
- package/toggle-group/types.js +5 -0
- package/resultsetTable/index.d.ts +0 -19
- package/text-input/index.d.ts +0 -135
- package/toggle-group/index.d.ts +0 -21
|
@@ -0,0 +1,159 @@
|
|
|
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 SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
10
|
+
declare type Action = {
|
|
11
|
+
/**
|
|
12
|
+
* This function will be called when the user clicks the action.
|
|
13
|
+
*/
|
|
14
|
+
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Icon to be shown in the action.
|
|
17
|
+
*/
|
|
18
|
+
icon: string | SVG;
|
|
19
|
+
/**
|
|
20
|
+
* Title of the action.
|
|
21
|
+
*/
|
|
22
|
+
title?: string;
|
|
23
|
+
};
|
|
24
|
+
declare type Props = {
|
|
25
|
+
/**
|
|
26
|
+
* Text to be placed above the input. This label will be used as the aria-label attribute of the list of suggestions.
|
|
27
|
+
*/
|
|
28
|
+
label?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Name attribute of the input element.
|
|
31
|
+
*/
|
|
32
|
+
name?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Value of the input. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
35
|
+
*/
|
|
36
|
+
value?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Helper text to be placed above the input.
|
|
39
|
+
*/
|
|
40
|
+
helperText?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Text to be put as placeholder of the input.
|
|
43
|
+
*/
|
|
44
|
+
placeholder?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Action to be shown in the input. This is an object composed of an onClick function and an icon,
|
|
47
|
+
* being the latter either an inline svg or a URL to the image.
|
|
48
|
+
*/
|
|
49
|
+
action?: Action;
|
|
50
|
+
/**
|
|
51
|
+
* If true, the input will have an action to clear the entered value.
|
|
52
|
+
*/
|
|
53
|
+
clearable?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* If true, the component will be disabled.
|
|
56
|
+
*/
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* If true, the input will be optional, showing '(Optional)'
|
|
60
|
+
* next to the label. Otherwise, the field will be considered required and an error will be
|
|
61
|
+
* passed as a parameter to the OnBlur and onChange functions when it has
|
|
62
|
+
* not been filled.
|
|
63
|
+
*/
|
|
64
|
+
optional?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Prefix to be placed before the input value.
|
|
67
|
+
*/
|
|
68
|
+
prefix?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Suffix to be placed after the input value.
|
|
71
|
+
*/
|
|
72
|
+
suffix?: string;
|
|
73
|
+
/**
|
|
74
|
+
* This function will be called when the user types within the input
|
|
75
|
+
* element of the component. An object including the current value and
|
|
76
|
+
* the error (if the value entered is not valid) will be passed to this
|
|
77
|
+
* function. If there is no error, error will be null.
|
|
78
|
+
*/
|
|
79
|
+
onChange?: (val: {
|
|
80
|
+
value: string;
|
|
81
|
+
error: string | null;
|
|
82
|
+
}) => void;
|
|
83
|
+
/**
|
|
84
|
+
* This function will be called when the input element loses the focus.
|
|
85
|
+
* An object including the input value and the error (if the value
|
|
86
|
+
* entered is not valid) will be passed to this function. If there is no error,
|
|
87
|
+
* error will be null.
|
|
88
|
+
*/
|
|
89
|
+
onBlur?: (val: {
|
|
90
|
+
value: string;
|
|
91
|
+
error: string | null;
|
|
92
|
+
}) => void;
|
|
93
|
+
/**
|
|
94
|
+
* If it is defined, the component will change its appearance, showing
|
|
95
|
+
* the error below the input component. If it is not defined, the error
|
|
96
|
+
* messages will be managed internally, but never displayed on its own.
|
|
97
|
+
*/
|
|
98
|
+
error?: string;
|
|
99
|
+
/**
|
|
100
|
+
* These are the options to be displayed as suggestions. It can be either an array or a function:
|
|
101
|
+
* - Array: Array of options that will be filtered by the component.
|
|
102
|
+
* - Function: This function will be called when the user changes the value, we will send as a parameter the new value;
|
|
103
|
+
* apart from that this function should return one promise on which we should make 'then' to get the suggestions filtered.
|
|
104
|
+
*/
|
|
105
|
+
suggestions?: string[] | ((value: string) => Promise<string[]>);
|
|
106
|
+
/**
|
|
107
|
+
* Regular expression that defines the valid format allowed by the input.
|
|
108
|
+
* This will be checked both when the input element loses the focus and
|
|
109
|
+
* while typing within it. If the string entered does not match the
|
|
110
|
+
* pattern, the onBlur and onChange functions will be called with the
|
|
111
|
+
* current value and an internal error informing that this value does not
|
|
112
|
+
* match the pattern. If the pattern is met, the error parameter of both
|
|
113
|
+
* events will be null.
|
|
114
|
+
*/
|
|
115
|
+
pattern?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Specifies the minimun length allowed by the input.
|
|
118
|
+
* This will be checked both when the input element loses the
|
|
119
|
+
* focus and while typing within it. If the string entered does not
|
|
120
|
+
* comply the minimum length, the onBlur and onChange functions will be called
|
|
121
|
+
* with the current value and an internal error informing that the value
|
|
122
|
+
* length does not comply the specified range. If a valid length is
|
|
123
|
+
* reached, the error parameter of both events will be null.
|
|
124
|
+
*/
|
|
125
|
+
minLength?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Specifies the maximum length allowed by the input.
|
|
128
|
+
* This will be checked both when the input element loses the
|
|
129
|
+
* focus and while typing within it. If the string entered does not
|
|
130
|
+
* comply the maximum length, the onBlur and onChange functions will be called
|
|
131
|
+
* with the current value and an internal error informing that the value
|
|
132
|
+
* length does not comply the specified range. If a valid length is
|
|
133
|
+
* reached, the error parameter of both events will be null.
|
|
134
|
+
*/
|
|
135
|
+
maxLength?: number;
|
|
136
|
+
/**
|
|
137
|
+
* HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
|
|
138
|
+
* Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
|
|
139
|
+
*/
|
|
140
|
+
autocomplete?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
143
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
144
|
+
*/
|
|
145
|
+
margin?: Space | Margin;
|
|
146
|
+
/**
|
|
147
|
+
* Size of the component ('small' | 'medium' | 'large' | 'fillParent').
|
|
148
|
+
*/
|
|
149
|
+
size?: "small" | "medium" | "large" | "fillParent";
|
|
150
|
+
/**
|
|
151
|
+
* Value of the tabindex attribute.
|
|
152
|
+
*/
|
|
153
|
+
tabIndex?: number;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Reference to the component.
|
|
157
|
+
*/
|
|
158
|
+
export declare type RefType = HTMLDivElement;
|
|
159
|
+
export default Props;
|
package/textarea/Textarea.js
CHANGED
|
@@ -43,10 +43,6 @@ var getNotOptionalErrorMessage = function getNotOptionalErrorMessage() {
|
|
|
43
43
|
return "This field is required. Please, enter a value.";
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
var getLengthErrorMessage = function getLengthErrorMessage(length) {
|
|
47
|
-
return "Min length ".concat(length.min, ", max length ").concat(length.max, ".");
|
|
48
|
-
};
|
|
49
|
-
|
|
50
46
|
var getPatternErrorMessage = function getPatternErrorMessage() {
|
|
51
47
|
return "Please match the format requested.";
|
|
52
48
|
};
|
|
@@ -78,7 +74,8 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
78
74
|
_ref$error = _ref.error,
|
|
79
75
|
error = _ref$error === void 0 ? "" : _ref$error,
|
|
80
76
|
pattern = _ref.pattern,
|
|
81
|
-
|
|
77
|
+
minLength = _ref.minLength,
|
|
78
|
+
maxLength = _ref.maxLength,
|
|
82
79
|
_ref$autocomplete = _ref.autocomplete,
|
|
83
80
|
autocomplete = _ref$autocomplete === void 0 ? "off" : _ref$autocomplete,
|
|
84
81
|
margin = _ref.margin,
|
|
@@ -101,12 +98,16 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
101
98
|
var textareaRef = (0, _react.useRef)(null);
|
|
102
99
|
var errorId = "error-message-".concat(textareaId);
|
|
103
100
|
|
|
101
|
+
var getLengthErrorMessage = function getLengthErrorMessage() {
|
|
102
|
+
return "Min length ".concat(minLength, ", max length ").concat(maxLength, ".");
|
|
103
|
+
};
|
|
104
|
+
|
|
104
105
|
var isNotOptional = function isNotOptional(value) {
|
|
105
106
|
return value === "" && !optional;
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
var isLengthIncorrect = function isLengthIncorrect(value) {
|
|
109
|
-
return value !== "" &&
|
|
110
|
+
return value !== "" && minLength && maxLength && (value.length < minLength || value.length > maxLength);
|
|
110
111
|
};
|
|
111
112
|
|
|
112
113
|
var changeValue = function changeValue(newValue) {
|
|
@@ -116,7 +117,7 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
116
117
|
error: getNotOptionalErrorMessage()
|
|
117
118
|
});else if (isLengthIncorrect(newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
118
119
|
value: newValue,
|
|
119
|
-
error: getLengthErrorMessage(
|
|
120
|
+
error: getLengthErrorMessage()
|
|
120
121
|
});else if (newValue && pattern && !patternMatch(pattern, newValue)) onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
121
122
|
value: newValue,
|
|
122
123
|
error: getPatternErrorMessage()
|
|
@@ -132,7 +133,7 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
132
133
|
error: getNotOptionalErrorMessage()
|
|
133
134
|
});else if (isLengthIncorrect(event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
134
135
|
value: event.target.value,
|
|
135
|
-
error: getLengthErrorMessage(
|
|
136
|
+
error: getLengthErrorMessage()
|
|
136
137
|
});else if (event.target.value && pattern && !patternMatch(pattern, event.target.value)) onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
137
138
|
value: event.target.value,
|
|
138
139
|
error: getPatternErrorMessage()
|
|
@@ -179,8 +180,8 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
179
180
|
onBlur: handleTOnBlur,
|
|
180
181
|
disabled: disabled,
|
|
181
182
|
error: error,
|
|
182
|
-
minLength:
|
|
183
|
-
maxLength:
|
|
183
|
+
minLength: minLength,
|
|
184
|
+
maxLength: maxLength,
|
|
184
185
|
autoComplete: autocomplete,
|
|
185
186
|
backgroundType: backgroundType,
|
|
186
187
|
ref: textareaRef,
|
|
@@ -293,10 +294,8 @@ DxcTextarea.propTypes = {
|
|
|
293
294
|
placeholder: _propTypes["default"].string,
|
|
294
295
|
verticalGrow: _propTypes["default"].oneOf(["auto", "none", "manual"]),
|
|
295
296
|
rows: _propTypes["default"].number,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
max: _propTypes["default"].number
|
|
299
|
-
}),
|
|
297
|
+
minLength: _propTypes["default"].number,
|
|
298
|
+
maxLength: _propTypes["default"].number,
|
|
300
299
|
pattern: _propTypes["default"].string,
|
|
301
300
|
disabled: _propTypes["default"].bool,
|
|
302
301
|
optional: _propTypes["default"].bool,
|
package/textarea/index.d.ts
CHANGED
|
@@ -33,9 +33,9 @@ type Props = {
|
|
|
33
33
|
*/
|
|
34
34
|
disabled?: boolean;
|
|
35
35
|
/**
|
|
36
|
-
* If true, the textarea will be optional, showing '(Optional)'
|
|
37
|
-
* next to the label. Otherwise, the field will be considered required
|
|
38
|
-
* and an error will be passed as a parameter to the OnBlur and onChange functions
|
|
36
|
+
* If true, the textarea will be optional, showing '(Optional)'
|
|
37
|
+
* next to the label. Otherwise, the field will be considered required
|
|
38
|
+
* and an error will be passed as a parameter to the OnBlur and onChange functions
|
|
39
39
|
* when it has not been filled.
|
|
40
40
|
*/
|
|
41
41
|
optional?: boolean;
|
|
@@ -53,14 +53,14 @@ type Props = {
|
|
|
53
53
|
/**
|
|
54
54
|
* This function will be called when the user types within the textarea.
|
|
55
55
|
* An object including the current value and the error (if the value
|
|
56
|
-
* entered is not valid) will be passed to this function.
|
|
56
|
+
* entered is not valid) will be passed to this function.
|
|
57
57
|
* If there is no error, error will be null.
|
|
58
58
|
*/
|
|
59
59
|
onChange?: (val: { value: string; error: string }) => void;
|
|
60
60
|
/**
|
|
61
61
|
* This function will be called when the textarea loses the focus. An
|
|
62
62
|
* object including the textarea value and the error (if the value entered
|
|
63
|
-
* is not valid) will be passed to this function. If there is no error,
|
|
63
|
+
* is not valid) will be passed to this function. If there is no error,
|
|
64
64
|
* error will be null.
|
|
65
65
|
*/
|
|
66
66
|
onBlur?: (val: { value: string; error: string }) => void;
|
|
@@ -81,15 +81,25 @@ type Props = {
|
|
|
81
81
|
*/
|
|
82
82
|
pattern?: string;
|
|
83
83
|
/**
|
|
84
|
-
* Specifies the minimun
|
|
84
|
+
* Specifies the minimun length allowed by the textarea.
|
|
85
85
|
* This will be checked both when the textarea loses the
|
|
86
86
|
* focus and while typing within it. If the string entered does not
|
|
87
|
-
* comply the length, the onBlur and onChange functions will be called
|
|
87
|
+
* comply the minimum length, the onBlur and onChange functions will be called
|
|
88
88
|
* with the current value and an internal error informing that the value
|
|
89
89
|
* length does not comply the specified range. If a valid length is
|
|
90
90
|
* reached, the error parameter of both events will be null.
|
|
91
91
|
*/
|
|
92
|
-
|
|
92
|
+
minLength?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Specifies the maximum length allowed by the textarea.
|
|
95
|
+
* This will be checked both when the textarea loses the
|
|
96
|
+
* focus and while typing within it. If the string entered does not
|
|
97
|
+
* comply the maximum length, the onBlur and onChange functions will be called
|
|
98
|
+
* with the current value and an internal error informing that the value
|
|
99
|
+
* length does not comply the specified range. If a valid length is
|
|
100
|
+
* reached, the error parameter of both events will be null.
|
|
101
|
+
*/
|
|
102
|
+
maxLength?: number;
|
|
93
103
|
/**
|
|
94
104
|
* HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the textarea value.
|
|
95
105
|
* Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
|
|
@@ -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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -23,8 +21,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
23
21
|
|
|
24
22
|
var _uuid = require("uuid");
|
|
25
23
|
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
24
|
var _variables = require("../common/variables.js");
|
|
29
25
|
|
|
30
26
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
@@ -42,8 +38,7 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
42
38
|
onChange = _ref.onChange,
|
|
43
39
|
_ref$disabled = _ref.disabled,
|
|
44
40
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
45
|
-
|
|
46
|
-
options = _ref$options === void 0 ? [] : _ref$options,
|
|
41
|
+
options = _ref.options,
|
|
47
42
|
margin = _ref.margin,
|
|
48
43
|
_ref$multiple = _ref.multiple,
|
|
49
44
|
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
|
|
@@ -51,7 +46,7 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
51
46
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
52
47
|
var colorsTheme = (0, _useTheme["default"])();
|
|
53
48
|
|
|
54
|
-
var _useState = (0, _react.useState)(multiple ? [] :
|
|
49
|
+
var _useState = (0, _react.useState)(multiple ? [] : ""),
|
|
55
50
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
56
51
|
selectedValue = _useState2[0],
|
|
57
52
|
setSelectedValue = _useState2[1];
|
|
@@ -64,7 +59,7 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
64
59
|
var newSelectedOptions;
|
|
65
60
|
|
|
66
61
|
if (value == null) {
|
|
67
|
-
if (multiple) {
|
|
62
|
+
if (multiple && Array.isArray(selectedValue)) {
|
|
68
63
|
newSelectedOptions = selectedValue.map(function (value) {
|
|
69
64
|
return value;
|
|
70
65
|
});
|
|
@@ -79,9 +74,9 @@ var DxcToggleGroup = function DxcToggleGroup(_ref) {
|
|
|
79
74
|
setSelectedValue(newSelectedOptions);
|
|
80
75
|
} else setSelectedValue(selectedOption === selectedValue ? null : selectedOption);
|
|
81
76
|
} else if (multiple) {
|
|
82
|
-
newSelectedOptions = value.map(function (v) {
|
|
77
|
+
newSelectedOptions = Array.isArray(value) ? value.map(function (v) {
|
|
83
78
|
return v;
|
|
84
|
-
});
|
|
79
|
+
}) : value;
|
|
85
80
|
|
|
86
81
|
if (newSelectedOptions.includes(selectedOption)) {
|
|
87
82
|
var _index = newSelectedOptions.indexOf(selectedOption);
|
|
@@ -218,26 +213,5 @@ var IconContainer = _styledComponents["default"].div(_templateObject9 || (_templ
|
|
|
218
213
|
return props.optionLabel && props.theme.iconMarginRight;
|
|
219
214
|
});
|
|
220
215
|
|
|
221
|
-
DxcToggleGroup.propTypes = {
|
|
222
|
-
label: _propTypes["default"].string,
|
|
223
|
-
helperText: _propTypes["default"].string,
|
|
224
|
-
value: _propTypes["default"].any,
|
|
225
|
-
onChange: _propTypes["default"].func,
|
|
226
|
-
disabled: _propTypes["default"].bool,
|
|
227
|
-
multiple: _propTypes["default"].bool,
|
|
228
|
-
options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
229
|
-
value: _propTypes["default"].any.isRequired,
|
|
230
|
-
label: _propTypes["default"].string,
|
|
231
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
232
|
-
iconSrc: _propTypes["default"].string
|
|
233
|
-
})),
|
|
234
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
235
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
236
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
237
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
238
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
239
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
240
|
-
tabIndex: _propTypes["default"].number
|
|
241
|
-
};
|
|
242
216
|
var _default = DxcToggleGroup;
|
|
243
217
|
exports["default"] = _default;
|
|
@@ -0,0 +1,84 @@
|
|
|
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 SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
10
|
+
declare type OptionCommons = {
|
|
11
|
+
/**
|
|
12
|
+
* Number with the option inner value.
|
|
13
|
+
*/
|
|
14
|
+
value: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated URL of the icon that will be placed. IconSrc and label can't be used at same time.
|
|
17
|
+
*/
|
|
18
|
+
iconSrc?: string;
|
|
19
|
+
};
|
|
20
|
+
declare type OptionIcon = OptionCommons & {
|
|
21
|
+
/**
|
|
22
|
+
* String with the option display value.
|
|
23
|
+
*/
|
|
24
|
+
label?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Element used as the icon. Icon and label can't be used at same time.
|
|
27
|
+
*/
|
|
28
|
+
icon: SVG;
|
|
29
|
+
};
|
|
30
|
+
declare type OptionLabel = OptionCommons & {
|
|
31
|
+
/**
|
|
32
|
+
* String with the option display value.
|
|
33
|
+
*/
|
|
34
|
+
label: string;
|
|
35
|
+
/**
|
|
36
|
+
* Element used as the icon. Icon and label can't be used at same time.
|
|
37
|
+
*/
|
|
38
|
+
icon?: SVG;
|
|
39
|
+
};
|
|
40
|
+
declare type Option = OptionIcon | OptionLabel;
|
|
41
|
+
declare type Props = {
|
|
42
|
+
/**
|
|
43
|
+
* Text to be placed above the component.
|
|
44
|
+
*/
|
|
45
|
+
label?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Helper text to be placed above the component.
|
|
48
|
+
*/
|
|
49
|
+
helperText?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The key(s) of the selected value(s). If the toggle group component doesn't allow multiple selection,
|
|
52
|
+
* it must be one unique value. If the component allows multiple selection, value must be an array.
|
|
53
|
+
* If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
54
|
+
*/
|
|
55
|
+
value?: string | string[];
|
|
56
|
+
/**
|
|
57
|
+
* This function will be called every time the selection changes. The number with the key of the selected
|
|
58
|
+
* value will be passed as a parameter to this function.
|
|
59
|
+
* If multiple selection is allowed, an array of keys will be passed.
|
|
60
|
+
*/
|
|
61
|
+
onChange?: (optionIndex: number | number[]) => void;
|
|
62
|
+
/**
|
|
63
|
+
* If true, the component will be disabled.
|
|
64
|
+
*/
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* An array of objects representing the selectable options.
|
|
68
|
+
*/
|
|
69
|
+
options: [Option, ...Option[]];
|
|
70
|
+
/**
|
|
71
|
+
* If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
|
|
72
|
+
*/
|
|
73
|
+
multiple?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
76
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
77
|
+
*/
|
|
78
|
+
margin?: Space | Margin;
|
|
79
|
+
/**
|
|
80
|
+
* Value of the tabindex.
|
|
81
|
+
*/
|
|
82
|
+
tabIndex?: number;
|
|
83
|
+
};
|
|
84
|
+
export default Props;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
type Margin = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
columns?: any;
|
|
11
|
-
rows?: any;
|
|
12
|
-
itemsPerPage?: number;
|
|
13
|
-
itemsPerPageOptions?: number[];
|
|
14
|
-
itemsPerPageFunction?: void,
|
|
15
|
-
margin?: Space | Margin;
|
|
16
|
-
tabIndex?: number;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export default function DxcResultsetTable(props: Props): JSX.Element;
|
package/text-input/index.d.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
type Size = "small" | "medium" | "large" | "fillParent";
|
|
2
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
type Margin = {
|
|
4
|
-
top?: Space;
|
|
5
|
-
bottom?: Space;
|
|
6
|
-
left?: Space;
|
|
7
|
-
right?: Space;
|
|
8
|
-
};
|
|
9
|
-
type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
10
|
-
type Action = {
|
|
11
|
-
onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
12
|
-
icon: string | SVG;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
type Props = {
|
|
16
|
-
/**
|
|
17
|
-
* Text to be placed above the input. This label will be used as the aria-label attribute of the list of suggestions.
|
|
18
|
-
*/
|
|
19
|
-
label?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Name attribute of the input element.
|
|
22
|
-
*/
|
|
23
|
-
name?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Value of the input. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
26
|
-
*/
|
|
27
|
-
value?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Helper text to be placed above the input.
|
|
30
|
-
*/
|
|
31
|
-
helperText?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Text to be put as placeholder of the input.
|
|
34
|
-
*/
|
|
35
|
-
placeholder?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Action to be shown in the input. This is an object composed of an onClick function and an icon,
|
|
38
|
-
* being the latter either an inline svg or a URL to the image.
|
|
39
|
-
*/
|
|
40
|
-
action?: Action;
|
|
41
|
-
/**
|
|
42
|
-
* If true, the input will have an action to clear the entered value.
|
|
43
|
-
*/
|
|
44
|
-
clearable?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* If true, the component will be disabled.
|
|
47
|
-
*/
|
|
48
|
-
disabled?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* If true, the input will be optional, showing '(Optional)'
|
|
51
|
-
* next to the label. Otherwise, the field will be considered required and an error will be
|
|
52
|
-
* passed as a parameter to the OnBlur and onChange functions when it has
|
|
53
|
-
* not been filled.
|
|
54
|
-
*/
|
|
55
|
-
optional?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Prefix to be placed before the input value.
|
|
58
|
-
*/
|
|
59
|
-
prefix?: string;
|
|
60
|
-
/**
|
|
61
|
-
* Suffix to be placed after the input value.
|
|
62
|
-
*/
|
|
63
|
-
suffix?: string;
|
|
64
|
-
/**
|
|
65
|
-
* This function will be called when the user types within the input
|
|
66
|
-
* element of the component. An object including the current value and
|
|
67
|
-
* the error (if the value entered is not valid) will be passed to this
|
|
68
|
-
* function. If there is no error, error will be null.
|
|
69
|
-
*/
|
|
70
|
-
onChange?: (val: { value: string; error: string }) => void;
|
|
71
|
-
/**
|
|
72
|
-
* This function will be called when the input element loses the focus.
|
|
73
|
-
* An object including the input value and the error (if the value
|
|
74
|
-
* entered is not valid) will be passed to this function. If there is no error,
|
|
75
|
-
* error will be null.
|
|
76
|
-
*/
|
|
77
|
-
onBlur?: (obj: { value: string; error: string }) => void;
|
|
78
|
-
/**
|
|
79
|
-
* If it is defined, the component will change its appearance, showing
|
|
80
|
-
* the error below the input component. If it is not defined, the error
|
|
81
|
-
* messages will be managed internally, but never displayed on its own.
|
|
82
|
-
*/
|
|
83
|
-
error?: string;
|
|
84
|
-
/**
|
|
85
|
-
* These are the options to be displayed as suggestions. It can be either an array or a function:
|
|
86
|
-
* - Array: Array of options that will be filtered by the component.
|
|
87
|
-
* - Function: This function will be called when the user changes the value, we will send as a parameter the new value;
|
|
88
|
-
* apart from that this function should return one promise on which we should make 'then' to get the suggestions filtered.
|
|
89
|
-
*/
|
|
90
|
-
suggestions?: string[] | (() => void);
|
|
91
|
-
/**
|
|
92
|
-
* Regular expression that defines the valid format allowed by the input.
|
|
93
|
-
* This will be checked both when the input element loses the focus and
|
|
94
|
-
* while typing within it. If the string entered does not match the
|
|
95
|
-
* pattern, the onBlur and onChange functions will be called with the
|
|
96
|
-
* current value and an internal error informing that this value does not
|
|
97
|
-
* match the pattern. If the pattern is met, the error parameter of both
|
|
98
|
-
* events will be null.
|
|
99
|
-
*/
|
|
100
|
-
pattern?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Specifies the minimun and maximum length allowed by the input.
|
|
103
|
-
* This will be checked both when the input element loses the
|
|
104
|
-
* focus and while typing within it. If the string entered does not
|
|
105
|
-
* comply the length, the onBlur and onChange functions will be called
|
|
106
|
-
* with the current value and an internal error informing that the value
|
|
107
|
-
* length does not comply the specified range. If a valid length is
|
|
108
|
-
* reached, the error parameter of both events will be null.
|
|
109
|
-
*/
|
|
110
|
-
length?: { min?: number; max?: number };
|
|
111
|
-
/**
|
|
112
|
-
* HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
|
|
113
|
-
* Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
|
|
114
|
-
*/
|
|
115
|
-
autocomplete?: string;
|
|
116
|
-
/**
|
|
117
|
-
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
118
|
-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
119
|
-
*/
|
|
120
|
-
margin?: Space | Margin;
|
|
121
|
-
/**
|
|
122
|
-
* Size of the component ('small' | 'medium' | 'large' | 'fillParent').
|
|
123
|
-
*/
|
|
124
|
-
size?: Size;
|
|
125
|
-
/**
|
|
126
|
-
* Value of the tabindex attribute.
|
|
127
|
-
*/
|
|
128
|
-
tabIndex?: number;
|
|
129
|
-
/**
|
|
130
|
-
* Reference to the component.
|
|
131
|
-
*/
|
|
132
|
-
ref?: React.RefObject<HTMLDivElement>;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export default function DxcTextInput(props: Props): JSX.Element;
|
package/toggle-group/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
type Margin = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type Props = {
|
|
10
|
-
label?: string;
|
|
11
|
-
helperText?: string;
|
|
12
|
-
value?: any;
|
|
13
|
-
onChange?: void;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
options?: any;
|
|
16
|
-
multiple?: boolean;
|
|
17
|
-
margin?: Space | Margin;
|
|
18
|
-
tabIndex?: number;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default function DxcToggleGroup(props: Props): JSX.Element;
|