@dxc-technology/halstack-react 0.0.0-bd24f1d → 0.0.0-beebecd
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/dist/ThemeContext.js +131 -99
- package/dist/accordion/Accordion.js +44 -39
- package/dist/accordion-group/AccordionGroup.js +1 -3
- package/dist/alert/Alert.js +5 -5
- package/dist/alert/index.d.ts +51 -0
- package/dist/button/Button.js +29 -22
- package/dist/common/variables.js +419 -280
- package/dist/date/Date.js +5 -7
- package/dist/{new-date/NewDate.js → date-input/DateInput.js} +69 -72
- package/dist/date-input/index.d.ts +95 -0
- package/dist/dropdown/Dropdown.js +108 -68
- package/dist/file-input/FileInput.js +644 -0
- package/dist/file-input/FileItem.js +280 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/header/Header.js +3 -23
- package/dist/input-text/InputText.js +3 -3
- package/dist/layout/ApplicationLayout.js +1 -1
- package/dist/link/Link.js +4 -8
- package/dist/main.d.ts +8 -0
- package/dist/main.js +29 -13
- package/dist/new-select/NewSelect.js +836 -0
- package/dist/new-select/index.d.ts +53 -0
- package/dist/new-textarea/NewTextarea.js +62 -39
- package/dist/new-textarea/index.d.ts +117 -0
- package/dist/{number/Number.js → number-input/NumberInput.js} +9 -11
- package/dist/{number/NumberContext.js → number-input/NumberInputContext.js} +2 -2
- package/dist/number-input/index.d.ts +113 -0
- package/dist/{password/Password.js → password-input/PasswordInput.js} +11 -13
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +62 -26
- package/dist/select/Select.js +122 -158
- package/dist/sidenav/Sidenav.js +6 -4
- package/dist/slider/Slider.js +89 -14
- package/dist/spinner/Spinner.js +217 -54
- package/dist/tag/Tag.js +26 -32
- package/dist/{new-input-text/NewInputText.js → text-input/TextInput.js} +180 -170
- package/dist/text-input/index.d.ts +135 -0
- package/dist/toggle-group/ToggleGroup.js +132 -28
- package/dist/upload/transaction/Transaction.js +2 -2
- package/package.json +2 -1
- package/test/{NewDate.test.js → DateInput.test.js} +66 -27
- package/test/FileInput.test.js +201 -0
- package/test/InputText.test.js +24 -16
- package/test/NewTextarea.test.js +95 -101
- package/test/{Number.test.js → NumberInput.test.js} +84 -66
- package/test/Paginator.test.js +1 -1
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +1 -2
- package/test/Select.test.js +40 -17
- package/test/Spinner.test.js +5 -0
- package/test/{NewInputText.test.js → TextInput.test.js} +146 -231
- package/test/ToggleGroup.test.js +5 -1
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/password/styles.css +0 -3
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/slider/Slider.stories.js +0 -241
- package/test/Password.test.js +0 -76
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
/**
|
|
12
|
+
* Text to be placed above the password.
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Name attribute of the input element.
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Value of the input element. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
21
|
+
*/
|
|
22
|
+
value?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Helper text to be placed above the password.
|
|
25
|
+
*/
|
|
26
|
+
helperText?: string;
|
|
27
|
+
/**
|
|
28
|
+
* If true, the password input will have an action to clear the entered value.
|
|
29
|
+
*/
|
|
30
|
+
clearable?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* This function will be called when the user types within the input
|
|
33
|
+
* element of the component. An object including the current value and
|
|
34
|
+
* the error (if the value entered is not valid) will be passed to this
|
|
35
|
+
* function. If there is no error, error will be null.
|
|
36
|
+
* */
|
|
37
|
+
onChange?: (val: { value: string; error: string }) => void;
|
|
38
|
+
/**
|
|
39
|
+
* This function will be called when the input element loses the focus.
|
|
40
|
+
* An object including the input value and the error (if the value entered is
|
|
41
|
+
* not valid) will be passed to this function. If there is no error, error will be null.
|
|
42
|
+
*/
|
|
43
|
+
onBlur?: (val: { value: string; error: string }) => void;
|
|
44
|
+
/**
|
|
45
|
+
* If it is defined, the component will change its appearance, showing
|
|
46
|
+
* the error below the password input component. If it is not defined, the
|
|
47
|
+
* error messages will be managed internally, but never displayed on its own.
|
|
48
|
+
*/
|
|
49
|
+
error?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Regular expression that defines the valid format allowed by the
|
|
52
|
+
* password input. This will be checked both when the input element loses the
|
|
53
|
+
* focus and while typing within it. If the string entered does not match
|
|
54
|
+
* the pattern, the onBlur and onChange functions will be called with the
|
|
55
|
+
* current value and an internal error informing that this value does not
|
|
56
|
+
* match the pattern. If the pattern is met, the error parameter of both
|
|
57
|
+
* events will be null.
|
|
58
|
+
*/
|
|
59
|
+
pattern?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Specifies the minimun and maximum length allowed by the password input.
|
|
62
|
+
* This will be checked both when the input element loses the
|
|
63
|
+
* focus and while typing within it. If the string entered does not
|
|
64
|
+
* comply the length, the onBlur and onChange functions will be called
|
|
65
|
+
* with the current value and an internal error informing that the value
|
|
66
|
+
* length does not comply the specified range. If a valid length is
|
|
67
|
+
* reached, the error parameter of both events will be null.
|
|
68
|
+
*/
|
|
69
|
+
length?: { min?: number; max?: number };
|
|
70
|
+
/**
|
|
71
|
+
* HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
|
|
72
|
+
* Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
|
|
73
|
+
*/
|
|
74
|
+
autocomplete?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
77
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
78
|
+
*/
|
|
79
|
+
margin?: Space | Margin;
|
|
80
|
+
/**
|
|
81
|
+
* Size of the component ('small' | 'medium' | 'large' | 'fillParent').
|
|
82
|
+
*/
|
|
83
|
+
size?: Size;
|
|
84
|
+
/**
|
|
85
|
+
* Value of the tabindex attribute.
|
|
86
|
+
*/
|
|
87
|
+
tabIndex?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Reference to the component.
|
|
90
|
+
*/
|
|
91
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default function DxcPasswordInput(props: Props): JSX.Element;
|
|
@@ -9,13 +9,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
12
14
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
15
|
|
|
14
16
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
17
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireDefault(require("react"));
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
@@ -27,6 +27,18 @@ var _variables = require("../common/variables.js");
|
|
|
27
27
|
|
|
28
28
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
29
29
|
|
|
30
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
31
|
+
|
|
32
|
+
function _templateObject6() {
|
|
33
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"]);
|
|
34
|
+
|
|
35
|
+
_templateObject6 = function _templateObject6() {
|
|
36
|
+
return data;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
|
|
30
42
|
function _templateObject5() {
|
|
31
43
|
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n display: ", ";\n flex-shrink: 0;\n"]);
|
|
32
44
|
|
|
@@ -58,7 +70,7 @@ function _templateObject3() {
|
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
function _templateObject2() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n z-index: ", ";\n width: ", ";\n .MuiLinearProgress-root {\n height: ", ";\n background-color: ", ";\n border-radius: ", ";\n }\n .MuiLinearProgress-bar {\n background-color: ", ";\n }\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
|
|
73
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n z-index: ", ";\n width: ", ";\n .MuiLinearProgress-root {\n height: ", ";\n background-color: ", ";\n border-radius: ", ";\n margin-bottom: ", ";\n }\n .MuiLinearProgress-bar {\n background-color: ", ";\n }\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
|
|
62
74
|
|
|
63
75
|
_templateObject2 = function _templateObject2() {
|
|
64
76
|
return data;
|
|
@@ -68,7 +80,7 @@ function _templateObject2() {
|
|
|
68
80
|
}
|
|
69
81
|
|
|
70
82
|
function _templateObject() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n opacity: ", ";\n width: ", ";\n display: flex;\n flex-wrap: wrap;\n justify-content: ", ";\n height: ", ";\n align-items: ", ";\n min-width: 100px;\n max-width: ", ";\n position: ", ";\n top: ", ";\n bottom: ", ";\n left: ", ";\n right: ", ";\n z-index: ", ";\n"]);
|
|
83
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n opacity: ", ";\n width: ", ";\n display: flex;\n flex-wrap: wrap;\n justify-content: ", ";\n height: ", ";\n align-items: ", ";\n min-width: 100px;\n max-width: ", ";\n position: ", ";\n top: ", ";\n bottom: ", ";\n left: ", ";\n right: ", ";\n z-index: ", ";\n width: 100%;\n"]);
|
|
72
84
|
|
|
73
85
|
_templateObject = function _templateObject() {
|
|
74
86
|
return data;
|
|
@@ -80,6 +92,8 @@ function _templateObject() {
|
|
|
80
92
|
var DxcProgressBar = function DxcProgressBar(_ref) {
|
|
81
93
|
var _ref$label = _ref.label,
|
|
82
94
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
95
|
+
_ref$helperText = _ref.helperText,
|
|
96
|
+
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
83
97
|
_ref$overlay = _ref.overlay,
|
|
84
98
|
overlay = _ref$overlay === void 0 ? true : _ref$overlay,
|
|
85
99
|
value = _ref.value,
|
|
@@ -87,35 +101,30 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
|
|
|
87
101
|
showValue = _ref$showValue === void 0 ? false : _ref$showValue,
|
|
88
102
|
margin = _ref.margin;
|
|
89
103
|
var colorsTheme = (0, _useTheme["default"])();
|
|
104
|
+
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
90
105
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
91
106
|
theme: colorsTheme.progressBar
|
|
92
107
|
}, _react["default"].createElement(BackgroundProgressBar, {
|
|
93
108
|
overlay: overlay
|
|
94
109
|
}, _react["default"].createElement(DXCProgressBar, {
|
|
95
110
|
overlay: overlay,
|
|
96
|
-
margin: margin
|
|
111
|
+
margin: margin,
|
|
112
|
+
backgroundType: backgroundType
|
|
97
113
|
}, _react["default"].createElement(InfoProgressBar, null, _react["default"].createElement(ProgressBarLabel, {
|
|
98
|
-
overlay: overlay
|
|
114
|
+
overlay: overlay,
|
|
115
|
+
backgroundType: backgroundType
|
|
99
116
|
}, label), _react["default"].createElement(ProgressBarProgress, {
|
|
100
117
|
overlay: overlay,
|
|
101
|
-
showValue: showValue
|
|
118
|
+
showValue: showValue,
|
|
119
|
+
backgroundType: backgroundType
|
|
102
120
|
}, value === "" ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100, " %")), _react["default"].createElement(_LinearProgress["default"], {
|
|
103
121
|
variant: showValue ? "determinate" : "indeterminate",
|
|
104
|
-
value: value === "" ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
overlay: _propTypes["default"].bool,
|
|
111
|
-
value: _propTypes["default"].number,
|
|
112
|
-
showValue: _propTypes["default"].bool,
|
|
113
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
114
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
115
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
116
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
117
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
118
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
122
|
+
value: value === "" ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100,
|
|
123
|
+
helperText: helperText
|
|
124
|
+
}), helperText && _react["default"].createElement(HelperText, {
|
|
125
|
+
overlay: overlay,
|
|
126
|
+
backgroundType: backgroundType
|
|
127
|
+
}, helperText))));
|
|
119
128
|
};
|
|
120
129
|
|
|
121
130
|
var BackgroundProgressBar = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
@@ -157,7 +166,9 @@ var DXCProgressBar = _styledComponents["default"].div(_templateObject2(), functi
|
|
|
157
166
|
}, function (props) {
|
|
158
167
|
return props.theme.borderRadius;
|
|
159
168
|
}, function (props) {
|
|
160
|
-
return props.
|
|
169
|
+
return props.helperText !== "" && "8px";
|
|
170
|
+
}, function (props) {
|
|
171
|
+
return props.backgroundType === "dark" ? props.theme.trackLineColorOnDark : props.theme.trackLineColor;
|
|
161
172
|
}, function (props) {
|
|
162
173
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
163
174
|
}, function (props) {
|
|
@@ -183,7 +194,7 @@ var ProgressBarLabel = _styledComponents["default"].div(_templateObject4(), func
|
|
|
183
194
|
}, function (props) {
|
|
184
195
|
return props.theme.labelFontTextTransform;
|
|
185
196
|
}, function (props) {
|
|
186
|
-
return props.overlay === true ? "#FFFFFF" : props.theme.labelFontColor;
|
|
197
|
+
return props.backgroundType === "dark" ? props.theme.labelFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.labelFontColor;
|
|
187
198
|
});
|
|
188
199
|
|
|
189
200
|
var ProgressBarProgress = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
@@ -197,10 +208,35 @@ var ProgressBarProgress = _styledComponents["default"].div(_templateObject5(), f
|
|
|
197
208
|
}, function (props) {
|
|
198
209
|
return props.theme.valueFontTextTransform;
|
|
199
210
|
}, function (props) {
|
|
200
|
-
return props.overlay === true ? "#FFFFFF" : props.theme.valueFontColor;
|
|
211
|
+
return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.valueFontColor;
|
|
201
212
|
}, function (props) {
|
|
202
213
|
return props.value !== "" && props.showValue === true && "block" || "none";
|
|
203
214
|
});
|
|
204
215
|
|
|
216
|
+
var HelperText = _styledComponents["default"].span(_templateObject6(), function (props) {
|
|
217
|
+
return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.helperTextFontColor;
|
|
218
|
+
}, function (props) {
|
|
219
|
+
return props.theme.fontFamily;
|
|
220
|
+
}, function (props) {
|
|
221
|
+
return props.theme.helperTextFontSize;
|
|
222
|
+
}, function (props) {
|
|
223
|
+
return props.theme.helperTextFontStyle;
|
|
224
|
+
}, function (props) {
|
|
225
|
+
return props.theme.helperTextFontWeight;
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
DxcProgressBar.propTypes = {
|
|
229
|
+
label: _propTypes["default"].string,
|
|
230
|
+
helperText: _propTypes["default"].string,
|
|
231
|
+
overlay: _propTypes["default"].bool,
|
|
232
|
+
value: _propTypes["default"].number,
|
|
233
|
+
showValue: _propTypes["default"].bool,
|
|
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
|
+
};
|
|
205
241
|
var _default = DxcProgressBar;
|
|
206
242
|
exports["default"] = _default;
|