@dxc-technology/halstack-react 0.0.0-8d633bd → 0.0.0-9196773
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 +69 -61
- package/dist/alert/Alert.js +4 -4
- package/dist/alert/index.d.ts +30 -5
- package/dist/common/variables.js +199 -47
- package/dist/date/Date.js +4 -6
- package/dist/{new-date/NewDate.js → date-input/DateInput.js} +69 -72
- package/dist/date-input/index.d.ts +95 -0
- package/dist/file-input/FileInput.js +11 -8
- package/dist/file-input/FileItem.js +25 -8
- package/dist/file-input/index.d.ts +81 -0
- package/dist/input-text/InputText.js +3 -3
- package/dist/main.d.ts +7 -1
- package/dist/main.js +22 -14
- package/dist/new-select/NewSelect.js +836 -0
- package/dist/new-select/index.d.ts +53 -0
- package/dist/new-textarea/NewTextarea.js +52 -48
- 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/slider/Slider.js +89 -14
- package/dist/{new-input-text/NewInputText.js → text-input/TextInput.js} +129 -135
- package/dist/text-input/index.d.ts +135 -0
- package/dist/toggle-group/ToggleGroup.js +132 -28
- package/dist/upload/Upload.js +3 -3
- package/dist/upload/readme.md +2 -2
- package/package.json +1 -1
- package/test/{NewDate.test.js → DateInput.test.js} +66 -27
- package/test/FileInput.test.js +164 -2
- package/test/InputText.test.js +24 -16
- package/test/NewTextarea.test.js +71 -128
- package/test/{Number.test.js → NumberInput.test.js} +84 -66
- package/test/PasswordInput.test.js +83 -0
- package/test/{NewInputText.test.js → TextInput.test.js} +134 -268
- package/test/ToggleGroup.test.js +5 -1
- package/test/Upload.test.js +5 -5
- 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/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;
|
package/dist/slider/Slider.js
CHANGED
|
@@ -35,9 +35,39 @@ var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
|
35
35
|
|
|
36
36
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function _templateObject7() {
|
|
39
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n label + .MuiInput-formControl {\n margin-top: 2px;\n }\n"]);
|
|
40
|
+
|
|
41
|
+
_templateObject7 = function _templateObject7() {
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function _templateObject6() {
|
|
39
49
|
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n margin-left: ", ";\n"]);
|
|
40
50
|
|
|
51
|
+
_templateObject6 = function _templateObject6() {
|
|
52
|
+
return data;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function _templateObject5() {
|
|
59
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n margin-right: ", ";\n"]);
|
|
60
|
+
|
|
61
|
+
_templateObject5 = function _templateObject5() {
|
|
62
|
+
return data;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return data;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function _templateObject4() {
|
|
69
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 48px;\n align-items: center;\n\n .MultiSlider-root {\n display: flex;\n align-items: center;\n }\n .MuiSlider-container {\n padding: 30px 24px;\n }\n .MuiSlider-root.Mui-disabled {\n color: ", ";\n cursor: not-allowed;\n }\n .Mui-disabled {\n & .MuiSlider-thumb {\n height: ", ";\n width: ", ";\n background-color: ", ";\n top: ", ";\n }\n & .MuiSlider-track {\n background-color: ", ";\n }\n & .MuiSlider-rail {\n background-color: ", ";\n }\n & > .MuiSlider-mark.MuiSlider-markActive {\n background-color: ", " !important;\n }\n & > .MuiSlider-mark {\n background-color: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n top: ", ";\n }\n }\n .MuiSlider-thumb {\n height: ", ";\n width: ", ";\n background-color: ", ";\n top: ", ";\n border-radius: 9999px;\n\n :hover,\n &.Mui-focusVisible {\n box-shadow: none;\n }\n &.MuiSlider-active {\n box-shadow: none;\n }\n :focus {\n outline: ", "\n auto 1px;\n outline-offset: 2px;\n background-color: ", ";\n }\n :hover {\n background-color: ", ";\n transform: scale(", ");\n transform-origin: center;\n height: ", ";\n width: ", ";\n top: ", ";\n }\n :active {\n background-color: ", ";\n transform: scale(", ");\n transform-origin: center;\n }\n }\n .MuiSlider-track {\n background-color: ", ";\n height: ", ";\n top: ", ";\n border-radius: 9999px;\n }\n .MuiSlider-track.MuiSlider-trackAfter {\n background-color: ", ";\n }\n .MuiSlider-rail {\n background-color: ", ";\n height: ", ";\n top: ", ";\n }\n .MuiSlider-mark.MuiSlider-markActive {\n background-color: ", ";\n }\n .MuiSlider-mark {\n background-color: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n top: ", ";\n }\n"]);
|
|
70
|
+
|
|
41
71
|
_templateObject4 = function _templateObject4() {
|
|
42
72
|
return data;
|
|
43
73
|
};
|
|
@@ -46,7 +76,7 @@ function _templateObject4() {
|
|
|
46
76
|
}
|
|
47
77
|
|
|
48
78
|
function _templateObject3() {
|
|
49
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
79
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
50
80
|
|
|
51
81
|
_templateObject3 = function _templateObject3() {
|
|
52
82
|
return data;
|
|
@@ -56,7 +86,7 @@ function _templateObject3() {
|
|
|
56
86
|
}
|
|
57
87
|
|
|
58
88
|
function _templateObject2() {
|
|
59
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
89
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
60
90
|
|
|
61
91
|
_templateObject2 = function _templateObject2() {
|
|
62
92
|
return data;
|
|
@@ -66,7 +96,7 @@ function _templateObject2() {
|
|
|
66
96
|
}
|
|
67
97
|
|
|
68
98
|
function _templateObject() {
|
|
69
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
99
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n"]);
|
|
70
100
|
|
|
71
101
|
_templateObject = function _templateObject() {
|
|
72
102
|
return data;
|
|
@@ -76,7 +106,9 @@ function _templateObject() {
|
|
|
76
106
|
}
|
|
77
107
|
|
|
78
108
|
var DxcSlider = function DxcSlider(_ref) {
|
|
79
|
-
var
|
|
109
|
+
var label = _ref.label,
|
|
110
|
+
helperText = _ref.helperText,
|
|
111
|
+
_ref$minValue = _ref.minValue,
|
|
80
112
|
minValue = _ref$minValue === void 0 ? 0 : _ref$minValue,
|
|
81
113
|
_ref$maxValue = _ref.maxValue,
|
|
82
114
|
maxValue = _ref$maxValue === void 0 ? 100 : _ref$maxValue,
|
|
@@ -139,9 +171,10 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
139
171
|
|
|
140
172
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
141
173
|
theme: colorsTheme.slider
|
|
142
|
-
}, _react["default"].createElement(
|
|
174
|
+
}, _react["default"].createElement(Container, {
|
|
143
175
|
margin: margin,
|
|
144
|
-
size: size
|
|
176
|
+
size: size
|
|
177
|
+
}, _react["default"].createElement(Label, null, label), _react["default"].createElement(HelperText, null, helperText), _react["default"].createElement(SliderContainer, {
|
|
145
178
|
backgroundType: backgroundType
|
|
146
179
|
}, showLimitsValues && _react["default"].createElement(MinLabelContainer, {
|
|
147
180
|
backgroundType: backgroundType,
|
|
@@ -167,7 +200,7 @@ var DxcSlider = function DxcSlider(_ref) {
|
|
|
167
200
|
disabled: disabled,
|
|
168
201
|
onChange: handlerInputChange,
|
|
169
202
|
size: "small"
|
|
170
|
-
}))));
|
|
203
|
+
})))));
|
|
171
204
|
};
|
|
172
205
|
|
|
173
206
|
var sizes = {
|
|
@@ -180,9 +213,7 @@ var calculateWidth = function calculateWidth(margin, size) {
|
|
|
180
213
|
return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
|
|
181
214
|
};
|
|
182
215
|
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
var SliderContainer = _styledComponents["default"].div(_templateObject2(), function (props) {
|
|
216
|
+
var Container = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
186
217
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
187
218
|
}, function (props) {
|
|
188
219
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -194,7 +225,37 @@ var SliderContainer = _styledComponents["default"].div(_templateObject2(), funct
|
|
|
194
225
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
195
226
|
}, function (props) {
|
|
196
227
|
return calculateWidth(props.margin, props.size);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
var Label = _styledComponents["default"].label(_templateObject2(), function (props) {
|
|
231
|
+
return props.theme.labelFontColor;
|
|
232
|
+
}, function (props) {
|
|
233
|
+
return props.theme.labelFontFamily;
|
|
234
|
+
}, function (props) {
|
|
235
|
+
return props.theme.labelFontSize;
|
|
236
|
+
}, function (props) {
|
|
237
|
+
return props.theme.labelFontStyle;
|
|
238
|
+
}, function (props) {
|
|
239
|
+
return props.theme.labelFontWeight;
|
|
240
|
+
}, function (props) {
|
|
241
|
+
return props.theme.labelLineHeight;
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
var HelperText = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
245
|
+
return props.theme.helperTextFontColor;
|
|
246
|
+
}, function (props) {
|
|
247
|
+
return props.theme.helperTextFontFamily;
|
|
197
248
|
}, function (props) {
|
|
249
|
+
return props.theme.helperTextFontSize;
|
|
250
|
+
}, function (props) {
|
|
251
|
+
return props.theme.helperTextFontstyle;
|
|
252
|
+
}, function (props) {
|
|
253
|
+
return props.theme.helperTextFontWeight;
|
|
254
|
+
}, function (props) {
|
|
255
|
+
return props.theme.helperTextLineHeight;
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
var SliderContainer = _styledComponents["default"].div(_templateObject4(), function (props) {
|
|
198
259
|
return props.backgroundType === "dark" ? props.theme.disabledThumbBackgroundColorOnDark : props.theme.disabledThumbBackgroundColor;
|
|
199
260
|
}, function (props) {
|
|
200
261
|
return props.theme.thumbHeight;
|
|
@@ -234,6 +295,12 @@ var SliderContainer = _styledComponents["default"].div(_templateObject2(), funct
|
|
|
234
295
|
return props.backgroundType === "dark" ? props.theme.hoverThumbBackgroundColorOnDark : props.theme.hoverThumbBackgroundColor;
|
|
235
296
|
}, function (props) {
|
|
236
297
|
return props.theme.hoverThumbScale;
|
|
298
|
+
}, function (props) {
|
|
299
|
+
return props.theme.hoverThumbHeight;
|
|
300
|
+
}, function (props) {
|
|
301
|
+
return props.theme.hoverThumbWidth;
|
|
302
|
+
}, function (props) {
|
|
303
|
+
return props.theme.hoverThumbVerticalPosition;
|
|
237
304
|
}, function (props) {
|
|
238
305
|
return props.backgroundType === "dark" ? props.theme.activeThumbBackgroundColorOnDark : props.theme.activeThumbBackgroundColor;
|
|
239
306
|
}, function (props) {
|
|
@@ -264,7 +331,7 @@ var SliderContainer = _styledComponents["default"].div(_templateObject2(), funct
|
|
|
264
331
|
return props.theme.tickVerticalPosition;
|
|
265
332
|
});
|
|
266
333
|
|
|
267
|
-
var MinLabelContainer = _styledComponents["default"].span(
|
|
334
|
+
var MinLabelContainer = _styledComponents["default"].span(_templateObject5(), function (props) {
|
|
268
335
|
return props.theme.fontFamily;
|
|
269
336
|
}, function (props) {
|
|
270
337
|
return props.theme.fontSize;
|
|
@@ -276,9 +343,11 @@ var MinLabelContainer = _styledComponents["default"].span(_templateObject3(), fu
|
|
|
276
343
|
return props.disabled ? props.theme.disabledFontColor : props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
|
|
277
344
|
}, function (props) {
|
|
278
345
|
return props.theme.fontLetterSpacing;
|
|
346
|
+
}, function (props) {
|
|
347
|
+
return props.theme.floorLabelMarginRight;
|
|
279
348
|
});
|
|
280
349
|
|
|
281
|
-
var MaxLabelContainer = _styledComponents["default"].span(
|
|
350
|
+
var MaxLabelContainer = _styledComponents["default"].span(_templateObject6(), function (props) {
|
|
282
351
|
return props.theme.fontFamily;
|
|
283
352
|
}, function (props) {
|
|
284
353
|
return props.theme.fontSize;
|
|
@@ -291,10 +360,16 @@ var MaxLabelContainer = _styledComponents["default"].span(_templateObject4(), fu
|
|
|
291
360
|
}, function (props) {
|
|
292
361
|
return props.theme.fontLetterSpacing;
|
|
293
362
|
}, function (props) {
|
|
294
|
-
return props.step === 1 ?
|
|
363
|
+
return props.step === 1 ? props.theme.ceilLabelMarginLeft : "1.25rem";
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
var StyledTextInput = _styledComponents["default"].div(_templateObject7(), function (props) {
|
|
367
|
+
return props.theme.inputMarginLeft;
|
|
295
368
|
});
|
|
296
369
|
|
|
297
370
|
DxcSlider.propTypes = {
|
|
371
|
+
label: _propTypes["default"].string,
|
|
372
|
+
helperText: _propTypes["default"].string,
|
|
298
373
|
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
299
374
|
minValue: _propTypes["default"].number,
|
|
300
375
|
maxValue: _propTypes["default"].number,
|