@dxc-technology/halstack-react 0.0.0-b39a2d8 → 0.0.0-b3e1a2f
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/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +1 -4
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +5 -8
- package/V3Select/V3Select.js +2 -2
- package/V3Textarea/V3Textarea.js +2 -2
- package/accordion/Accordion.js +2 -2
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +1 -1
- package/alert/Alert.js +2 -2
- package/badge/Badge.js +1 -1
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +84 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +13 -0
- package/bleed/types.js +5 -0
- package/box/Box.js +2 -2
- package/button/Button.d.ts +1 -1
- package/button/Button.js +13 -19
- package/button/Button.stories.tsx +6 -8
- package/button/types.d.ts +5 -9
- package/card/Card.js +1 -1
- package/card/Card.stories.tsx +1 -1
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +5 -27
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +57 -22
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +10 -13
- package/dialog/Dialog.js +4 -3
- package/dropdown/Dropdown.js +1 -1
- package/dropdown/Dropdown.stories.tsx +247 -0
- package/dropdown/types.d.ts +1 -1
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +160 -81
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.js +8 -6
- package/file-input/types.d.ts +32 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +12 -18
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +21 -17
- package/header/Header.js +2 -2
- package/header/Icons.d.ts +2 -0
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +54 -0
- package/input-text/InputText.js +2 -2
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +84 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +13 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +9 -19
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.js +1 -1
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +7 -3
- package/main.js +34 -2
- package/number-input/NumberInput.js +3 -6
- 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 +4 -2
- package/paginator/Paginator.js +2 -8
- package/password-input/PasswordInput.js +19 -18
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/types.d.ts +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/radio/Radio.js +2 -2
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +130 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +268 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +5 -28
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +20 -22
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.js +2 -2
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/slider/Slider.js +4 -4
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.js +11 -9
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/types.d.ts +23 -15
- package/tag/Tag.js +1 -1
- package/tag/Tag.stories.tsx +1 -1
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +54 -85
- 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.d.ts +4 -0
- package/textarea/Textarea.js +27 -60
- package/textarea/Textarea.stories.jsx +4 -3
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +16 -45
- package/toggle-group/ToggleGroup.stories.tsx +23 -28
- package/toggle-group/types.d.ts +97 -0
- package/toggle-group/types.js +5 -0
- package/upload/buttons-upload/ButtonsUpload.js +2 -2
- package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
- package/upload/file-upload/FileToUpload.js +1 -1
- package/upload/files-upload/FilesToUpload.js +1 -1
- package/upload/transaction/Transaction.js +2 -2
- package/upload/transactions/Transactions.js +1 -1
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.js +59 -9
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
- package/wizard/types.d.ts +3 -7
- package/chip/index.d.ts +0 -22
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle-group/index.d.ts +0 -21
- package/wizard/Icons.js +0 -65
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxc-technology/halstack-react",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-b3e1a2f",
|
|
4
4
|
"description": "DXC Halstack React components library",
|
|
5
5
|
"repository": "dxc-technology/halstack-react",
|
|
6
6
|
"homepage": "http://developer.dxc.com/tools/react",
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"@material-ui/lab": "4.0.0-alpha.17",
|
|
25
25
|
"@material-ui/pickers": "3.2.2",
|
|
26
26
|
"@material-ui/styles": "4.0.2",
|
|
27
|
+
"@types/styled-components": "^5.1.24",
|
|
28
|
+
"@types/uuid": "^8.3.4",
|
|
27
29
|
"color": "^3.1.3",
|
|
28
30
|
"date-fns": "^2.0.0-beta.4",
|
|
29
31
|
"moment": "2.24.0",
|
|
@@ -52,8 +54,8 @@
|
|
|
52
54
|
"@storybook/addon-essentials": "^6.4.9",
|
|
53
55
|
"@storybook/addon-links": "^6.4.9",
|
|
54
56
|
"@storybook/react": "^6.4.9",
|
|
55
|
-
"@testing-library/react": "^11.2.5",
|
|
56
57
|
"@storybook/testing-library": "0.0.7",
|
|
58
|
+
"@testing-library/react": "^11.2.5",
|
|
57
59
|
"@testing-library/user-event": "^12.6.3",
|
|
58
60
|
"babel-jest": "^24.8.0",
|
|
59
61
|
"babel-loader": "^8.0.6",
|
package/paginator/Paginator.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
41
|
-
error = _ref$error === void 0 ? "" : _ref$error,
|
|
38
|
+
error = _ref.error,
|
|
42
39
|
pattern = _ref.pattern,
|
|
43
|
-
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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[
|
|
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
|
-
|
|
153
|
+
minLength: minLength,
|
|
154
|
+
maxLength: maxLength,
|
|
154
155
|
autocomplete: autocomplete,
|
|
155
156
|
tabIndex: tabIndex
|
|
156
157
|
}));
|
|
@@ -53,7 +53,7 @@ export const Chromatic = () => (
|
|
|
53
53
|
<Title title="Margins" theme="light" level={2} />
|
|
54
54
|
<ExampleContainer>
|
|
55
55
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
56
|
-
<DxcPasswordInput label="
|
|
56
|
+
<DxcPasswordInput label="Xxsmall" margin="xxsmall" />
|
|
57
57
|
</ExampleContainer>
|
|
58
58
|
<ExampleContainer>
|
|
59
59
|
<Title title="Xsmall margin" theme="light" level={4} />
|
|
@@ -100,7 +100,7 @@ export const Chromatic = () => (
|
|
|
100
100
|
);
|
|
101
101
|
|
|
102
102
|
const Password = () => (
|
|
103
|
-
<ExampleContainer>
|
|
103
|
+
<ExampleContainer expanded>
|
|
104
104
|
<Title title="Show password" theme="light" level={4} />
|
|
105
105
|
<DxcPasswordInput label="Password input" value="Password" />
|
|
106
106
|
</ExampleContainer>
|
|
@@ -108,7 +108,7 @@ const Password = () => (
|
|
|
108
108
|
const PasswordDark = () => (
|
|
109
109
|
<BackgroundColorProvider color="#333333">
|
|
110
110
|
<DarkContainer>
|
|
111
|
-
<ExampleContainer>
|
|
111
|
+
<ExampleContainer expanded>
|
|
112
112
|
<Title title="Show password" theme="dark" level={4} />
|
|
113
113
|
<DxcPasswordInput label="Password input" value="Password" />
|
|
114
114
|
</ExampleContainer>
|
|
@@ -37,10 +37,10 @@ declare type Props = {
|
|
|
37
37
|
error: string | null;
|
|
38
38
|
}) => void;
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
26
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
27
27
|
|
|
28
28
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
29
29
|
|
|
@@ -59,9 +59,9 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
|
|
|
59
59
|
overlay: overlay,
|
|
60
60
|
showValue: showValue,
|
|
61
61
|
backgroundType: backgroundType
|
|
62
|
-
}, value === null ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100, " %")), /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], {
|
|
62
|
+
}, value === null || value === undefined ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100, " %")), /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], {
|
|
63
63
|
variant: showValue ? "determinate" : "indeterminate",
|
|
64
|
-
value: value === null ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100
|
|
64
|
+
value: value === null || value === undefined ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100
|
|
65
65
|
}), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
66
66
|
overlay: overlay,
|
|
67
67
|
backgroundType: backgroundType
|
package/radio/Radio.js
CHANGED
|
@@ -27,9 +27,9 @@ var _variables = require("../common/variables.js");
|
|
|
27
27
|
|
|
28
28
|
var _utils = require("../common/utils.js");
|
|
29
29
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
30
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
|
-
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext
|
|
32
|
+
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
33
33
|
|
|
34
34
|
var _templateObject, _templateObject2;
|
|
35
35
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _uuid = require("uuid");
|
|
21
|
+
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
+
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
25
|
+
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
var DxcRadio = function DxcRadio(_ref) {
|
|
31
|
+
var option = _ref.option,
|
|
32
|
+
currentValue = _ref.currentValue,
|
|
33
|
+
_onClick = _ref.onClick,
|
|
34
|
+
onFocus = _ref.onFocus,
|
|
35
|
+
error = _ref.error,
|
|
36
|
+
disabled = _ref.disabled,
|
|
37
|
+
focused = _ref.focused,
|
|
38
|
+
readonly = _ref.readonly;
|
|
39
|
+
|
|
40
|
+
var _useState = (0, _react.useState)("radio-".concat((0, _uuid.v4)())),
|
|
41
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 1),
|
|
42
|
+
radioLabelId = _useState2[0];
|
|
43
|
+
|
|
44
|
+
var ref = (0, _react.useRef)(null);
|
|
45
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
46
|
+
var checked = option.value === currentValue;
|
|
47
|
+
|
|
48
|
+
var _useState3 = (0, _react.useState)(true),
|
|
49
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
50
|
+
firstUpdate = _useState4[0],
|
|
51
|
+
setFirstUpdate = _useState4[1];
|
|
52
|
+
|
|
53
|
+
(0, _react.useLayoutEffect)(function () {
|
|
54
|
+
var _ref$current;
|
|
55
|
+
|
|
56
|
+
// Don't apply in the first render
|
|
57
|
+
if (firstUpdate) {
|
|
58
|
+
setFirstUpdate(false);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
focused && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
|
|
63
|
+
}, [focused]);
|
|
64
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
65
|
+
theme: colorsTheme.radioGroup
|
|
66
|
+
}, /*#__PURE__*/_react["default"].createElement(RadioContainer, null, /*#__PURE__*/_react["default"].createElement(RadioInputContainer, null, /*#__PURE__*/_react["default"].createElement(RadioInput, {
|
|
67
|
+
error: error,
|
|
68
|
+
disabled: disabled,
|
|
69
|
+
readonly: readonly,
|
|
70
|
+
onClick: _onClick,
|
|
71
|
+
onFocus: onFocus,
|
|
72
|
+
role: "radio",
|
|
73
|
+
"aria-checked": checked,
|
|
74
|
+
"aria-disabled": option.disabled,
|
|
75
|
+
"aria-labelledby": radioLabelId,
|
|
76
|
+
tabIndex: disabled ? -1 : focused ? 0 : -1,
|
|
77
|
+
ref: ref
|
|
78
|
+
}, checked && /*#__PURE__*/_react["default"].createElement(Dot, {
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
readonly: readonly,
|
|
81
|
+
error: error
|
|
82
|
+
}))), /*#__PURE__*/_react["default"].createElement(Label, {
|
|
83
|
+
id: radioLabelId,
|
|
84
|
+
onMouseDown: function onMouseDown(event) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
},
|
|
87
|
+
onClick: function onClick() {
|
|
88
|
+
var _ref$current2;
|
|
89
|
+
|
|
90
|
+
ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
|
|
91
|
+
|
|
92
|
+
_onClick();
|
|
93
|
+
},
|
|
94
|
+
disabled: disabled
|
|
95
|
+
}, option.label)));
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var RadioContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n"])));
|
|
99
|
+
|
|
100
|
+
var RadioInputContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
|
|
101
|
+
|
|
102
|
+
var RadioInput = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n border: 2px solid\n ", ";\n border-radius: 50%;\n box-shadow: 0 0 0 2px transparent;\n\n ", "\n"])), function (props) {
|
|
103
|
+
if (props.disabled) return props.theme.disabledRadioInputColor;else if (props.error) return props.theme.errorRadioInputColor;else if (props.readonly) return props.theme.readonlyRadioInputColor;else return props.theme.radioInputColor;
|
|
104
|
+
}, function (props) {
|
|
105
|
+
return !props.disabled ? "\n &:focus {\n outline: 2px solid ".concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n &:focus-visible {\n outline: 2px solid ").concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n &:hover {\n cursor: pointer;\n border-color: ").concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n }\n }\n &:active {\n cursor: pointer;\n border-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n }\n }\n ") : "\n cursor: not-allowed;\n pointer-events: none;\n :focus-visible {\n outline: none;\n }\n ";
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
var Dot = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background-color: ", ";\n"])), function (props) {
|
|
109
|
+
if (props.disabled) return props.theme.disabledRadioInputColor;else if (props.error) return props.theme.errorRadioInputColor;else if (props.readonly) return props.theme.readonlyRadioInputColor;else return props.theme.radioInputColor;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
var Label = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
|
|
113
|
+
return props.theme.radioInputLabelMargin;
|
|
114
|
+
}, function (props) {
|
|
115
|
+
return props.theme.fontFamily;
|
|
116
|
+
}, function (props) {
|
|
117
|
+
return props.theme.radioInputLabelFontSize;
|
|
118
|
+
}, function (props) {
|
|
119
|
+
return props.theme.radioInputLabelFontStyle;
|
|
120
|
+
}, function (props) {
|
|
121
|
+
return props.theme.radioInputLabelFontWeight;
|
|
122
|
+
}, function (props) {
|
|
123
|
+
return props.theme.radioInputLabelLineHeight;
|
|
124
|
+
}, function (props) {
|
|
125
|
+
return props.disabled ? "color: ".concat(props.theme.disabledRadioInputLabelFontColor, "; pointer-events: none;") : "cursor: pointer;";
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
var _default = /*#__PURE__*/_react["default"].memo(DxcRadio);
|
|
129
|
+
|
|
130
|
+
exports["default"] = _default;
|