@dxc-technology/halstack-react 0.0.0-e081e21 → 0.0.0-e1a279c
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/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +12 -43
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +58 -72
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.stories.tsx +170 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +9 -32
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +47 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +7 -12
- package/button/Button.stories.tsx +244 -274
- package/button/types.d.ts +10 -10
- package/card/Card.d.ts +4 -0
- package/card/Card.js +13 -48
- package/card/types.d.ts +69 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +2 -3
- package/chip/Chip.stories.tsx +121 -0
- package/common/variables.js +30 -22
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +3 -38
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/types.d.ts +100 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +4 -23
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +7 -40
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +4 -35
- package/footer/Footer.stories.jsx +151 -0
- package/footer/types.d.ts +61 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +26 -28
- package/header/Icons.js +2 -27
- package/header/types.d.ts +45 -0
- package/header/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +1 -23
- package/link/Link.stories.tsx +70 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +2 -44
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +3 -3
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +2 -39
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/types.d.ts +100 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +3 -21
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.d.ts +4 -0
- package/radio/Radio.js +3 -24
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +54 -0
- package/radio/types.js +5 -0
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +4 -4
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +4 -13
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +59 -82
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +6 -23
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +160 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +5 -53
- package/tabs/types.d.ts +71 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +20 -35
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text-input/index.d.ts +2 -2
- package/textarea/Textarea.stories.jsx +135 -0
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +11 -51
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/box/index.d.ts +0 -25
- package/card/index.d.ts +0 -22
- package/date-input/index.d.ts +0 -95
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/radio/index.d.ts +0 -23
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcPaginator from "./Paginator";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Paginator",
|
|
8
|
+
component: DxcPaginator,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<ExampleContainer>
|
|
14
|
+
<Title title="Default" theme="light" level={4} />
|
|
15
|
+
<DxcPaginator />
|
|
16
|
+
</ExampleContainer>
|
|
17
|
+
<ExampleContainer>
|
|
18
|
+
<Title title="Default with items per page options" theme="light" level={4} />
|
|
19
|
+
<DxcPaginator itemsPerPageOptions={[5, 10, 15]} />
|
|
20
|
+
</ExampleContainer>
|
|
21
|
+
<ExampleContainer>
|
|
22
|
+
<Title title="Default with show go to page selector" theme="light" level={4} />
|
|
23
|
+
<DxcPaginator showGoToPage />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Page change in first page" theme="light" level={4} />
|
|
27
|
+
<DxcPaginator currentPage={1} itemsPerPage={10} totalItems={27} onPageChange={() => {}} />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Page change in middle page" theme="light" level={4} />
|
|
31
|
+
<DxcPaginator currentPage={2} itemsPerPage={10} totalItems={27} onPageChange={() => {}} />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Page change in last page" theme="light" level={4} />
|
|
35
|
+
<DxcPaginator currentPage={3} itemsPerPage={10} totalItems={27} onPageChange={() => {}} />
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<ExampleContainer>
|
|
38
|
+
<Title title="Page change and items per page options" theme="light" level={4} />
|
|
39
|
+
<DxcPaginator
|
|
40
|
+
currentPage={1}
|
|
41
|
+
itemsPerPage={10}
|
|
42
|
+
totalItems={27}
|
|
43
|
+
onPageChange={() => {}}
|
|
44
|
+
itemsPerPageOptions={[5, 10, 15]}
|
|
45
|
+
/>
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Page change and show go to page selector" theme="light" level={4} />
|
|
49
|
+
<DxcPaginator currentPage={1} itemsPerPage={10} totalItems={27} onPageChange={() => {}} showGoToPage />
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
<ExampleContainer>
|
|
52
|
+
<Title title="Page change, show go to page and items per page selectors" theme="light" level={4} />
|
|
53
|
+
<DxcPaginator
|
|
54
|
+
currentPage={1}
|
|
55
|
+
itemsPerPage={10}
|
|
56
|
+
totalItems={27}
|
|
57
|
+
onPageChange={() => {}}
|
|
58
|
+
itemsPerPageOptions={[5, 10, 15]}
|
|
59
|
+
showGoToPage
|
|
60
|
+
/>
|
|
61
|
+
</ExampleContainer>
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
13
|
|
|
16
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -19,12 +17,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
17
|
|
|
20
18
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
19
|
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
20
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
25
21
|
|
|
26
|
-
var _variables = require("../common/variables.js");
|
|
27
|
-
|
|
28
22
|
var _templateObject;
|
|
29
23
|
|
|
30
24
|
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); }
|
|
@@ -120,7 +114,7 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
120
114
|
height: "24px",
|
|
121
115
|
viewBox: "0 0 24 24",
|
|
122
116
|
width: "24px",
|
|
123
|
-
fill: "
|
|
117
|
+
fill: "currentColor"
|
|
124
118
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
125
119
|
d: "M0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0z",
|
|
126
120
|
fill: "none"
|
|
@@ -131,7 +125,7 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
131
125
|
height: "24px",
|
|
132
126
|
viewBox: "0 0 24 24",
|
|
133
127
|
width: "24px",
|
|
134
|
-
fill: "
|
|
128
|
+
fill: "currentColor"
|
|
135
129
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
136
130
|
d: "M0 0h24v24H0V0z",
|
|
137
131
|
fill: "none"
|
|
@@ -162,38 +156,7 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
162
156
|
}));
|
|
163
157
|
});
|
|
164
158
|
|
|
165
|
-
var sizes = {
|
|
166
|
-
small: "240px",
|
|
167
|
-
medium: "360px",
|
|
168
|
-
large: "480px",
|
|
169
|
-
fillParent: "100%"
|
|
170
|
-
};
|
|
171
|
-
|
|
172
159
|
var PasswordInput = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n & ::-ms-reveal {\n display: none;\n }\n"])));
|
|
173
160
|
|
|
174
|
-
DxcPasswordInput.propTypes = {
|
|
175
|
-
label: _propTypes["default"].string,
|
|
176
|
-
name: _propTypes["default"].string,
|
|
177
|
-
value: _propTypes["default"].string,
|
|
178
|
-
helperText: _propTypes["default"].string,
|
|
179
|
-
error: _propTypes["default"].string,
|
|
180
|
-
clearable: _propTypes["default"].bool,
|
|
181
|
-
onChange: _propTypes["default"].func,
|
|
182
|
-
onBlur: _propTypes["default"].func,
|
|
183
|
-
autocomplete: _propTypes["default"].string,
|
|
184
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
185
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
186
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
187
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
188
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
189
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
190
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
191
|
-
pattern: _propTypes["default"].string,
|
|
192
|
-
length: _propTypes["default"].shape({
|
|
193
|
-
min: _propTypes["default"].number,
|
|
194
|
-
max: _propTypes["default"].number
|
|
195
|
-
}),
|
|
196
|
-
tabIndex: _propTypes["default"].number
|
|
197
|
-
};
|
|
198
161
|
var _default = DxcPasswordInput;
|
|
199
162
|
exports["default"] = _default;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import DxcPasswordInput from "./PasswordInput";
|
|
4
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
5
|
+
import Title from "../../.storybook/components/Title";
|
|
6
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
7
|
+
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Password input",
|
|
11
|
+
component: DxcPasswordInput,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Chromatic = () => (
|
|
15
|
+
<>
|
|
16
|
+
<ExampleContainer>
|
|
17
|
+
<Title title="Without label" theme="light" level={4} />
|
|
18
|
+
<DxcPasswordInput />
|
|
19
|
+
</ExampleContainer>
|
|
20
|
+
<ExampleContainer>
|
|
21
|
+
<Title title="With label" theme="light" level={4} />
|
|
22
|
+
<DxcPasswordInput label="Password input" clearable />
|
|
23
|
+
</ExampleContainer>
|
|
24
|
+
<ExampleContainer>
|
|
25
|
+
<Title title="Clearable" theme="light" level={4} />
|
|
26
|
+
<DxcPasswordInput label="Password input" clearable value="password" />
|
|
27
|
+
</ExampleContainer>
|
|
28
|
+
<ExampleContainer>
|
|
29
|
+
<Title title="Non clearable" theme="light" level={4} />
|
|
30
|
+
<DxcPasswordInput label="Non clearable password input" value="password" />
|
|
31
|
+
</ExampleContainer>
|
|
32
|
+
<ExampleContainer>
|
|
33
|
+
<Title title="Helper text" theme="light" level={4} />
|
|
34
|
+
<DxcPasswordInput label="Help password input" helperText="Help message" />
|
|
35
|
+
</ExampleContainer>
|
|
36
|
+
<ExampleContainer>
|
|
37
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
38
|
+
<DxcPasswordInput label="Error password input" error="Error message." />
|
|
39
|
+
</ExampleContainer>
|
|
40
|
+
<BackgroundColorProvider color="#333333">
|
|
41
|
+
<DarkContainer>
|
|
42
|
+
<Title title="Dark" theme="dark" level={2} />
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="With label, helper text and value" theme="dark" level={4} />
|
|
45
|
+
<DxcPasswordInput label="Password input" helperText="Help message" value="Password" />
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="With label, helper text, value and error" theme="dark" level={4} />
|
|
49
|
+
<DxcPasswordInput label="Password input" helperText="Help message" error="Error message." value="Password" />
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
</DarkContainer>
|
|
52
|
+
</BackgroundColorProvider>
|
|
53
|
+
<Title title="Margins" theme="light" level={2} />
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
56
|
+
<DxcPasswordInput label="Xxsmmall" margin="xxsmall" />
|
|
57
|
+
</ExampleContainer>
|
|
58
|
+
<ExampleContainer>
|
|
59
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
60
|
+
<DxcPasswordInput label="Xsmall" margin="xsmall" />
|
|
61
|
+
</ExampleContainer>
|
|
62
|
+
<ExampleContainer>
|
|
63
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
64
|
+
<DxcPasswordInput label="Small" margin="small" />
|
|
65
|
+
</ExampleContainer>
|
|
66
|
+
<ExampleContainer>
|
|
67
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
68
|
+
<DxcPasswordInput label="Medium" margin="medium" />
|
|
69
|
+
</ExampleContainer>
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
72
|
+
<DxcPasswordInput label="Large" margin="large" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
76
|
+
<DxcPasswordInput label="Xlarge" margin="xlarge" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
80
|
+
<DxcPasswordInput label="Xxlarge" margin="xxlarge" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
83
|
+
<ExampleContainer>
|
|
84
|
+
<Title title="Small size" theme="light" level={4} />
|
|
85
|
+
<DxcPasswordInput label="Small" size="small" />
|
|
86
|
+
</ExampleContainer>
|
|
87
|
+
<ExampleContainer>
|
|
88
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
89
|
+
<DxcPasswordInput label="Medium" size="medium" />
|
|
90
|
+
</ExampleContainer>
|
|
91
|
+
<ExampleContainer>
|
|
92
|
+
<Title title="Large size" theme="light" level={4} />
|
|
93
|
+
<DxcPasswordInput label="Large" size="large" />
|
|
94
|
+
</ExampleContainer>
|
|
95
|
+
<ExampleContainer>
|
|
96
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
97
|
+
<DxcPasswordInput label="FillParent" size="fillParent" />
|
|
98
|
+
</ExampleContainer>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const Password = () => (
|
|
103
|
+
<ExampleContainer>
|
|
104
|
+
<Title title="Show password" theme="light" level={4} />
|
|
105
|
+
<DxcPasswordInput label="Password input" value="Password" />
|
|
106
|
+
</ExampleContainer>
|
|
107
|
+
);
|
|
108
|
+
const PasswordDark = () => (
|
|
109
|
+
<BackgroundColorProvider color="#333333">
|
|
110
|
+
<DarkContainer>
|
|
111
|
+
<ExampleContainer>
|
|
112
|
+
<Title title="Show password" theme="dark" level={4} />
|
|
113
|
+
<DxcPasswordInput label="Password input" value="Password" />
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
</DarkContainer>
|
|
116
|
+
</BackgroundColorProvider>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
export const ShowPassword = Password.bind({});
|
|
120
|
+
ShowPassword.play = async ({ canvasElement }) => {
|
|
121
|
+
const canvas = within(canvasElement);
|
|
122
|
+
const passwordBtn = canvas.getByRole("button");
|
|
123
|
+
await userEvent.click(passwordBtn);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const ShowPasswordDark = PasswordDark.bind({});
|
|
127
|
+
ShowPasswordDark.play = async ({ canvasElement }) => {
|
|
128
|
+
const canvas = within(canvasElement);
|
|
129
|
+
const passwordBtn = canvas.getByRole("button");
|
|
130
|
+
await userEvent.click(passwordBtn);
|
|
131
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
declare type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Text to be placed above the password.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Name attribute of the input element.
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Value of the input element. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
19
|
+
*/
|
|
20
|
+
value?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Helper text to be placed above the password.
|
|
23
|
+
*/
|
|
24
|
+
helperText?: string;
|
|
25
|
+
/**
|
|
26
|
+
* If true, the password input will have an action to clear the entered value.
|
|
27
|
+
*/
|
|
28
|
+
clearable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* This function will be called when the user types within the input
|
|
31
|
+
* element of the component. An object including the current value and
|
|
32
|
+
* the error (if the value entered is not valid) will be passed to this
|
|
33
|
+
* function. If there is no error, error will be null.
|
|
34
|
+
* */
|
|
35
|
+
onChange?: (val: {
|
|
36
|
+
value: string;
|
|
37
|
+
error: string | null;
|
|
38
|
+
}) => void;
|
|
39
|
+
/**
|
|
40
|
+
* This function will be called when the input element loses the focus.
|
|
41
|
+
* An object including the input value and the error (if the value entered is
|
|
42
|
+
* not valid) will be passed to this function. If there is no error, error will be null.
|
|
43
|
+
*/
|
|
44
|
+
onBlur?: (val: {
|
|
45
|
+
value: string;
|
|
46
|
+
error: string | null;
|
|
47
|
+
}) => void;
|
|
48
|
+
/**
|
|
49
|
+
* If it is defined, the component will change its appearance, showing
|
|
50
|
+
* the error below the password input component. If it is not defined, the
|
|
51
|
+
* error messages will be managed internally, but never displayed on its own.
|
|
52
|
+
*/
|
|
53
|
+
error?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Regular expression that defines the valid format allowed by the
|
|
56
|
+
* password input. This will be checked both when the input element loses the
|
|
57
|
+
* focus and while typing within it. If the string entered does not match
|
|
58
|
+
* the pattern, the onBlur and onChange functions will be called with the
|
|
59
|
+
* current value and an internal error informing that this value does not
|
|
60
|
+
* match the pattern. If the pattern is met, the error parameter of both
|
|
61
|
+
* events will be null.
|
|
62
|
+
*/
|
|
63
|
+
pattern?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Specifies the minimun and maximum 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 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
|
+
length?: {
|
|
74
|
+
min?: number;
|
|
75
|
+
max?: number;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* 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
|
+
* Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
|
|
80
|
+
*/
|
|
81
|
+
autocomplete?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
84
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
85
|
+
*/
|
|
86
|
+
margin?: Space | Margin;
|
|
87
|
+
/**
|
|
88
|
+
* Size of the component ('small' | 'medium' | 'large' | 'fillParent').
|
|
89
|
+
*/
|
|
90
|
+
size?: "small" | "medium" | "large" | "fillParent";
|
|
91
|
+
/**
|
|
92
|
+
* Value of the tabindex attribute.
|
|
93
|
+
*/
|
|
94
|
+
tabIndex?: number;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Reference to the component.
|
|
98
|
+
*/
|
|
99
|
+
export declare type RefType = HTMLDivElement;
|
|
100
|
+
export default Props;
|
|
@@ -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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
@@ -21,8 +19,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
21
19
|
|
|
22
20
|
var _LinearProgress = _interopRequireDefault(require("@material-ui/core/LinearProgress"));
|
|
23
21
|
|
|
24
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
22
|
var _variables = require("../common/variables.js");
|
|
27
23
|
|
|
28
24
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
@@ -63,10 +59,9 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
|
|
|
63
59
|
overlay: overlay,
|
|
64
60
|
showValue: showValue,
|
|
65
61
|
backgroundType: backgroundType
|
|
66
|
-
}, value ===
|
|
62
|
+
}, value === null ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100, " %")), /*#__PURE__*/_react["default"].createElement(_LinearProgress["default"], {
|
|
67
63
|
variant: showValue ? "determinate" : "indeterminate",
|
|
68
|
-
value: value ===
|
|
69
|
-
helperText: helperText
|
|
64
|
+
value: value === null ? 0 : value >= 0 && value <= 100 ? value : value < 0 ? 0 : 100
|
|
70
65
|
}), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
71
66
|
overlay: overlay,
|
|
72
67
|
backgroundType: backgroundType
|
|
@@ -162,7 +157,7 @@ var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (
|
|
|
162
157
|
var HelperText = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"])), function (props) {
|
|
163
158
|
return props.backgroundType === "dark" ? props.theme.helperTextFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.helperTextFontColor;
|
|
164
159
|
}, function (props) {
|
|
165
|
-
return props.theme.
|
|
160
|
+
return props.theme.helperTextFontFamily;
|
|
166
161
|
}, function (props) {
|
|
167
162
|
return props.theme.helperTextFontSize;
|
|
168
163
|
}, function (props) {
|
|
@@ -171,18 +166,5 @@ var HelperText = _styledComponents["default"].span(_templateObject6 || (_templat
|
|
|
171
166
|
return props.theme.helperTextFontWeight;
|
|
172
167
|
});
|
|
173
168
|
|
|
174
|
-
DxcProgressBar.propTypes = {
|
|
175
|
-
label: _propTypes["default"].string,
|
|
176
|
-
helperText: _propTypes["default"].string,
|
|
177
|
-
overlay: _propTypes["default"].bool,
|
|
178
|
-
value: _propTypes["default"].number,
|
|
179
|
-
showValue: _propTypes["default"].bool,
|
|
180
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
181
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
182
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
183
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
184
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
185
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
186
|
-
};
|
|
187
169
|
var _default = DxcProgressBar;
|
|
188
170
|
exports["default"] = _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcProgressBar from "./ProgressBar";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "ProgressBar",
|
|
8
|
+
component: DxcProgressBar,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<ExampleContainer>
|
|
14
|
+
<Title title="Without labels" theme="light" level={4} />
|
|
15
|
+
<DxcProgressBar overlay={false} value={50} showValue />
|
|
16
|
+
<Title title="With helperText" theme="light" level={4} />
|
|
17
|
+
<DxcProgressBar helperText="Helper text" value={50} overlay={false} showValue />
|
|
18
|
+
<Title title="Without default value" theme="light" level={4} />
|
|
19
|
+
<DxcProgressBar label="Loading..." overlay={false} showValue />
|
|
20
|
+
</ExampleContainer>
|
|
21
|
+
<Title title="Margins" theme="light" level={2} />
|
|
22
|
+
<ExampleContainer>
|
|
23
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
24
|
+
<DxcProgressBar label="Margin xxsmall" margin="xxsmall" overlay={false} value={50} showValue />
|
|
25
|
+
</ExampleContainer>
|
|
26
|
+
<ExampleContainer>
|
|
27
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
28
|
+
<DxcProgressBar label="Margin xsmall" margin="xsmall" overlay={false} value={50} showValue />
|
|
29
|
+
</ExampleContainer>
|
|
30
|
+
<ExampleContainer>
|
|
31
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
32
|
+
<DxcProgressBar label="Margin small" margin="small" overlay={false} value={50} showValue />
|
|
33
|
+
</ExampleContainer>
|
|
34
|
+
<ExampleContainer>
|
|
35
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
36
|
+
<DxcProgressBar label="Margin medium" margin="medium" overlay={false} value={50} showValue />
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
<ExampleContainer>
|
|
39
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
40
|
+
<DxcProgressBar label="Margin large" margin="large" overlay={false} value={50} showValue />
|
|
41
|
+
</ExampleContainer>
|
|
42
|
+
<ExampleContainer>
|
|
43
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
44
|
+
<DxcProgressBar label="Margin xlarge" margin="xlarge" overlay={false} value={50} showValue />
|
|
45
|
+
</ExampleContainer>
|
|
46
|
+
<ExampleContainer>
|
|
47
|
+
<Title title="XxLarge margin" theme="light" level={4} />
|
|
48
|
+
<DxcProgressBar label="Margin xxlarge" margin="xxlarge" overlay={false} value={50} showValue />
|
|
49
|
+
</ExampleContainer>
|
|
50
|
+
</>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
export const ProgressBarOverlay = () => (
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Overlay" theme="dark" level={4} />
|
|
56
|
+
<DxcProgressBar label="Overlay" helperText="Helper text" showValue value={50} />
|
|
57
|
+
</ExampleContainer>
|
|
58
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Size = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
declare type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Text to be placed above the progress bar.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Helper text to be placed under the progress bar.
|
|
15
|
+
*/
|
|
16
|
+
helperText?: string;
|
|
17
|
+
/**
|
|
18
|
+
* If true, the progress bar will be displayed as a modal.
|
|
19
|
+
*/
|
|
20
|
+
overlay?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The value of the progress indicator. If it's received the component is
|
|
23
|
+
* determinate otherwise is indeterminate.
|
|
24
|
+
*/
|
|
25
|
+
value?: number;
|
|
26
|
+
/**
|
|
27
|
+
* If true, the value is displayed above the progress bar.
|
|
28
|
+
*/
|
|
29
|
+
showValue?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Size of the margin to be applied to the component. You can pass
|
|
32
|
+
* an object with 'top', 'bottom', 'left' and 'right' properties
|
|
33
|
+
* in order to specify different margin sizes.
|
|
34
|
+
*/
|
|
35
|
+
margin?: Space | Size;
|
|
36
|
+
};
|
|
37
|
+
export default Props;
|
package/radio/Radio.d.ts
ADDED
package/radio/Radio.js
CHANGED
|
@@ -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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
@@ -23,8 +21,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
23
21
|
|
|
24
22
|
var _Radio = _interopRequireDefault(require("@material-ui/core/Radio"));
|
|
25
23
|
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
24
|
var _RequiredComponent = _interopRequireDefault(require("../common/RequiredComponent"));
|
|
29
25
|
|
|
30
26
|
var _variables = require("../common/variables.js");
|
|
@@ -45,7 +41,8 @@ var DxcRadio = function DxcRadio(_ref) {
|
|
|
45
41
|
var _ref$checked = _ref.checked,
|
|
46
42
|
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
47
43
|
value = _ref.value,
|
|
48
|
-
label = _ref.label,
|
|
44
|
+
_ref$label = _ref.label,
|
|
45
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
49
46
|
_ref$labelPosition = _ref.labelPosition,
|
|
50
47
|
labelPosition = _ref$labelPosition === void 0 ? "before" : _ref$labelPosition,
|
|
51
48
|
name = _ref.name,
|
|
@@ -66,7 +63,7 @@ var DxcRadio = function DxcRadio(_ref) {
|
|
|
66
63
|
var colorsTheme = (0, _useTheme["default"])();
|
|
67
64
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
68
65
|
|
|
69
|
-
var handlerRadioChange = function handlerRadioChange(
|
|
66
|
+
var handlerRadioChange = function handlerRadioChange() {
|
|
70
67
|
if (checked == null) {
|
|
71
68
|
setInnerChecked(true);
|
|
72
69
|
}
|
|
@@ -90,7 +87,6 @@ var DxcRadio = function DxcRadio(_ref) {
|
|
|
90
87
|
name: name,
|
|
91
88
|
onClick: handlerRadioChange,
|
|
92
89
|
value: value,
|
|
93
|
-
label: label,
|
|
94
90
|
disabled: disabled,
|
|
95
91
|
disableRipple: true
|
|
96
92
|
}), /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
@@ -174,22 +170,5 @@ var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_tem
|
|
|
174
170
|
return props.disabled === true ? "not-allowed" : "pointer";
|
|
175
171
|
});
|
|
176
172
|
|
|
177
|
-
DxcRadio.propTypes = {
|
|
178
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
179
|
-
checked: _propTypes["default"].bool,
|
|
180
|
-
value: _propTypes["default"].any,
|
|
181
|
-
label: _propTypes["default"].string,
|
|
182
|
-
labelPosition: _propTypes["default"].oneOf(["after", "before", ""]),
|
|
183
|
-
name: _propTypes["default"].string,
|
|
184
|
-
disabled: _propTypes["default"].bool,
|
|
185
|
-
onClick: _propTypes["default"].func,
|
|
186
|
-
required: _propTypes["default"].bool,
|
|
187
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
188
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
189
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
190
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
191
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
192
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
193
|
-
};
|
|
194
173
|
var _default = DxcRadio;
|
|
195
174
|
exports["default"] = _default;
|