@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
package/card/Card.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"));
|
|
@@ -21,8 +19,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
21
19
|
|
|
22
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
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"));
|
|
@@ -37,18 +33,22 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
37
33
|
|
|
38
34
|
var DxcCard = function DxcCard(_ref) {
|
|
39
35
|
var imageSrc = _ref.imageSrc,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
_ref$imageBgColor = _ref.imageBgColor,
|
|
37
|
+
imageBgColor = _ref$imageBgColor === void 0 ? "black" : _ref$imageBgColor,
|
|
38
|
+
imagePadding = _ref.imagePadding,
|
|
39
|
+
_ref$imagePosition = _ref.imagePosition,
|
|
40
|
+
imagePosition = _ref$imagePosition === void 0 ? "before" : _ref$imagePosition,
|
|
43
41
|
linkHref = _ref.linkHref,
|
|
44
42
|
onClick = _ref.onClick,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
imageCover = _ref.imageCover,
|
|
43
|
+
_ref$imageCover = _ref.imageCover,
|
|
44
|
+
imageCover = _ref$imageCover === void 0 ? false : _ref$imageCover,
|
|
45
|
+
margin = _ref.margin,
|
|
46
|
+
contentPadding = _ref.contentPadding,
|
|
50
47
|
_ref$tabIndex = _ref.tabIndex,
|
|
51
|
-
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex
|
|
48
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
49
|
+
_ref$outlined = _ref.outlined,
|
|
50
|
+
outlined = _ref$outlined === void 0 ? false : _ref$outlined,
|
|
51
|
+
children = _ref.children;
|
|
52
52
|
var colorsTheme = (0, _useTheme["default"])();
|
|
53
53
|
|
|
54
54
|
var _useState = (0, _react.useState)(false),
|
|
@@ -161,40 +161,5 @@ var CardContent = _styledComponents["default"].div(_templateObject6 || (_templat
|
|
|
161
161
|
return contentPadding && (0, _typeof2["default"])(contentPadding) === "object" && contentPadding.left ? _variables.spaces[contentPadding.left] : "";
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
DxcCard.propTypes = {
|
|
165
|
-
imageSrc: _propTypes["default"].string,
|
|
166
|
-
imageBgColor: _propTypes["default"].string,
|
|
167
|
-
imagePadding: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces))),
|
|
168
|
-
imagePosition: _propTypes["default"].oneOf(["before", "after"]),
|
|
169
|
-
linkHref: _propTypes["default"].string,
|
|
170
|
-
onClick: _propTypes["default"].func,
|
|
171
|
-
outlined: _propTypes["default"].bool,
|
|
172
|
-
imageCover: _propTypes["default"].bool,
|
|
173
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
174
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
175
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
176
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
177
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
178
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
179
|
-
contentPadding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
180
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
181
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
182
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
183
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
184
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
185
|
-
tabIndex: _propTypes["default"].number
|
|
186
|
-
};
|
|
187
|
-
DxcCard.defaultProps = {
|
|
188
|
-
imageSrc: null,
|
|
189
|
-
margin: null,
|
|
190
|
-
contentPadding: null,
|
|
191
|
-
outlined: false,
|
|
192
|
-
imagePadding: null,
|
|
193
|
-
imageCover: false,
|
|
194
|
-
linkHref: null,
|
|
195
|
-
onClick: null,
|
|
196
|
-
imageBgColor: "black",
|
|
197
|
-
imagePosition: "before"
|
|
198
|
-
};
|
|
199
164
|
var _default = DxcCard;
|
|
200
165
|
exports["default"] = _default;
|
package/card/types.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Size = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* URL of the image that will be placed in the card component.
|
|
12
|
+
* In case of omission, the image container will not appear and
|
|
13
|
+
* the content will occupy its space.
|
|
14
|
+
*/
|
|
15
|
+
imageSrc?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Color of the image background.
|
|
18
|
+
*/
|
|
19
|
+
imageBgColor?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Size of the padding to be applied to the image section of the
|
|
22
|
+
* component. You can pass an object with 'top', 'bottom', 'left'
|
|
23
|
+
* and 'right' properties in order to specify different padding sizes.
|
|
24
|
+
*/
|
|
25
|
+
imagePadding?: Space | Size;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the image should appear in relation to the content.
|
|
28
|
+
*/
|
|
29
|
+
imagePosition?: "before" | "after";
|
|
30
|
+
/**
|
|
31
|
+
* If defined, the tag will be displayed as an anchor, using this prop
|
|
32
|
+
* as "href". Component will show some visual feedback on hover.
|
|
33
|
+
*/
|
|
34
|
+
linkHref?: string;
|
|
35
|
+
/**
|
|
36
|
+
* This function will be called when the user clicks the card. Component
|
|
37
|
+
* will show some visual feedback on hover.
|
|
38
|
+
*/
|
|
39
|
+
onClick?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the image must cover the whole image area of the card.
|
|
42
|
+
*/
|
|
43
|
+
imageCover?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Size of the margin to be applied to the component. You can pass
|
|
46
|
+
* an object with 'top', 'bottom', 'left' and 'right' properties
|
|
47
|
+
* in order to specify different margin sizes.
|
|
48
|
+
*/
|
|
49
|
+
margin?: Space | Size;
|
|
50
|
+
/**
|
|
51
|
+
* Size of the padding to be applied to the content area. You can pass
|
|
52
|
+
* an object with 'top', 'bottom', 'left' and 'right' properties in
|
|
53
|
+
* order to specify different padding sizes.
|
|
54
|
+
*/
|
|
55
|
+
contentPadding?: Space | Size;
|
|
56
|
+
/**
|
|
57
|
+
* Value of the tabindex given when there is an href.
|
|
58
|
+
*/
|
|
59
|
+
tabIndex?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the card must be outlined.
|
|
62
|
+
*/
|
|
63
|
+
outlined?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Custom content that will be placed in the card component.
|
|
66
|
+
*/
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
};
|
|
69
|
+
export default Props;
|
package/card/types.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcCheckbox from "./Checkbox";
|
|
3
|
+
import { BackgroundColorProvider } from "../BackgroundColorContext";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import DarkContainer from "../../.storybook/components/DarkSection";
|
|
7
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: "Checkbox",
|
|
11
|
+
component: DxcCheckbox,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Checkbox = () => (
|
|
15
|
+
<>
|
|
16
|
+
<>
|
|
17
|
+
<ExampleContainer>
|
|
18
|
+
<Title title="Default" theme="light" level={4} />
|
|
19
|
+
<DxcCheckbox label="Checkbox" />
|
|
20
|
+
</ExampleContainer>
|
|
21
|
+
<ExampleContainer>
|
|
22
|
+
<Title title="Focused" theme="light" level={4} />
|
|
23
|
+
<DxcCheckbox label="Focused" />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Checked" theme="light" level={4} />
|
|
27
|
+
<DxcCheckbox label="Checkbox" checked />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Required" theme="light" level={4} />
|
|
31
|
+
<DxcCheckbox label="Checkbox" required />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Disabled and checked" theme="light" level={4} />
|
|
35
|
+
<DxcCheckbox label="Checkbox" disabled checked />
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<ExampleContainer>
|
|
38
|
+
<Title title="Disabled and required" theme="light" level={4} />
|
|
39
|
+
<DxcCheckbox label="Checkbox" disabled required />
|
|
40
|
+
</ExampleContainer>
|
|
41
|
+
<ExampleContainer>
|
|
42
|
+
<Title title="Disabled, required and checked" theme="light" level={4} />
|
|
43
|
+
<DxcCheckbox label="Checkbox" disabled required checked />
|
|
44
|
+
</ExampleContainer>
|
|
45
|
+
<ExampleContainer>
|
|
46
|
+
<Title title="Label after" theme="light" level={4} />
|
|
47
|
+
<DxcCheckbox label="Checkbox" labelPosition="after" />
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Checked with label after" theme="light" level={4} />
|
|
51
|
+
<DxcCheckbox label="Checkbox" checked labelPosition="after" />
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<Title title="Required with label after" theme="light" level={4} />
|
|
55
|
+
<DxcCheckbox label="Checkbox" required labelPosition="after" />
|
|
56
|
+
</ExampleContainer>
|
|
57
|
+
<ExampleContainer>
|
|
58
|
+
<Title title="Disabled and checked with label after" theme="light" level={4} />
|
|
59
|
+
<DxcCheckbox label="Checkbox" disabled checked labelPosition="after" />
|
|
60
|
+
</ExampleContainer>
|
|
61
|
+
<ExampleContainer>
|
|
62
|
+
<Title title="Disabled and required with label after" theme="light" level={4} />
|
|
63
|
+
<DxcCheckbox label="Checkbox" disabled required labelPosition="after" />
|
|
64
|
+
</ExampleContainer>
|
|
65
|
+
<ExampleContainer>
|
|
66
|
+
<Title title="Disabled, required and checked with label after" theme="light" level={4} />
|
|
67
|
+
<DxcCheckbox label="Checkbox" disabled required checked labelPosition="after" />
|
|
68
|
+
</ExampleContainer>
|
|
69
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
70
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
71
|
+
<DxcCheckbox label="Hovered" />
|
|
72
|
+
</ExampleContainer>
|
|
73
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
74
|
+
<Title title="Hovered and checked" theme="light" level={4} />
|
|
75
|
+
<DxcCheckbox label="Hovered" checked />
|
|
76
|
+
</ExampleContainer>
|
|
77
|
+
</>
|
|
78
|
+
<BackgroundColorProvider color="#333333">
|
|
79
|
+
<DarkContainer>
|
|
80
|
+
<>
|
|
81
|
+
<ExampleContainer>
|
|
82
|
+
<Title title="Default" theme="dark" level={4} />
|
|
83
|
+
<DxcCheckbox label="Checkbox" />
|
|
84
|
+
</ExampleContainer>
|
|
85
|
+
<ExampleContainer>
|
|
86
|
+
<Title title="Checked" theme="dark" level={4} />
|
|
87
|
+
<DxcCheckbox label="Checkbox" checked />
|
|
88
|
+
</ExampleContainer>
|
|
89
|
+
<ExampleContainer>
|
|
90
|
+
<Title title="Required" theme="dark" level={4} />
|
|
91
|
+
<DxcCheckbox label="Checkbox" required />
|
|
92
|
+
</ExampleContainer>
|
|
93
|
+
<ExampleContainer>
|
|
94
|
+
<Title title="Disabled and checked" theme="dark" level={4} />
|
|
95
|
+
<DxcCheckbox label="Checkbox" disabled checked />
|
|
96
|
+
</ExampleContainer>
|
|
97
|
+
<ExampleContainer>
|
|
98
|
+
<Title title="Disabled and required" theme="dark" level={4} />
|
|
99
|
+
<DxcCheckbox label="Checkbox" disabled required />
|
|
100
|
+
</ExampleContainer>
|
|
101
|
+
<ExampleContainer>
|
|
102
|
+
<Title title="Disabled, required and checked" theme="dark" level={4} />
|
|
103
|
+
<DxcCheckbox label="Checkbox" disabled required checked />
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
<ExampleContainer>
|
|
106
|
+
<Title title="Label after" theme="dark" level={4} />
|
|
107
|
+
<DxcCheckbox label="Checkbox" labelPosition="after" />
|
|
108
|
+
</ExampleContainer>
|
|
109
|
+
<ExampleContainer>
|
|
110
|
+
<Title title="Checked with label after" theme="dark" level={4} />
|
|
111
|
+
<DxcCheckbox label="Checkbox" checked labelPosition="after" />
|
|
112
|
+
</ExampleContainer>
|
|
113
|
+
<ExampleContainer>
|
|
114
|
+
<Title title="Required with label after" theme="dark" level={4} />
|
|
115
|
+
<DxcCheckbox label="Checkbox" required labelPosition="after" />
|
|
116
|
+
</ExampleContainer>
|
|
117
|
+
<ExampleContainer>
|
|
118
|
+
<Title title="Disabled and checked with label after" theme="dark" level={4} />
|
|
119
|
+
<DxcCheckbox label="Checkbox" disabled checked labelPosition="after" />
|
|
120
|
+
</ExampleContainer>
|
|
121
|
+
<ExampleContainer>
|
|
122
|
+
<Title title="Disabled and required with label after" theme="dark" level={4} />
|
|
123
|
+
<DxcCheckbox label="Checkbox" disabled required labelPosition="after" />
|
|
124
|
+
</ExampleContainer>
|
|
125
|
+
<ExampleContainer>
|
|
126
|
+
<Title title="Disabled, required and checked with label after" theme="dark" level={4} />
|
|
127
|
+
<DxcCheckbox label="Checkbox" disabled required checked labelPosition="after" />
|
|
128
|
+
</ExampleContainer>
|
|
129
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
130
|
+
<Title title="Hovered" theme="dark" level={4} />
|
|
131
|
+
<DxcCheckbox label="Hovered" />
|
|
132
|
+
</ExampleContainer>
|
|
133
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
134
|
+
<Title title="Hovered and checked" theme="dark" level={4} />
|
|
135
|
+
<DxcCheckbox label="Hovered" checked />
|
|
136
|
+
</ExampleContainer>
|
|
137
|
+
</>
|
|
138
|
+
</DarkContainer>
|
|
139
|
+
</BackgroundColorProvider>
|
|
140
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
141
|
+
<ExampleContainer>
|
|
142
|
+
<DxcCheckbox label="Small" size="small" />
|
|
143
|
+
</ExampleContainer>
|
|
144
|
+
<ExampleContainer>
|
|
145
|
+
<DxcCheckbox label="Medium" size="medium" />
|
|
146
|
+
</ExampleContainer>
|
|
147
|
+
<ExampleContainer>
|
|
148
|
+
<DxcCheckbox label="Large" size="large" />
|
|
149
|
+
</ExampleContainer>
|
|
150
|
+
<ExampleContainer>
|
|
151
|
+
<DxcCheckbox label="FitContent" size="fitContent" />
|
|
152
|
+
</ExampleContainer>
|
|
153
|
+
<ExampleContainer>
|
|
154
|
+
<DxcCheckbox label="FillParent" size="fillParent" />
|
|
155
|
+
</ExampleContainer>
|
|
156
|
+
<Title title="Margins" theme="light" level={2} />
|
|
157
|
+
<ExampleContainer>
|
|
158
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
159
|
+
<DxcCheckbox label="Xxsmall" margin={"xxsmall"} />
|
|
160
|
+
</ExampleContainer>
|
|
161
|
+
<ExampleContainer>
|
|
162
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
163
|
+
<DxcCheckbox label="Xsmall" margin={"xsmall"} />
|
|
164
|
+
</ExampleContainer>
|
|
165
|
+
<ExampleContainer>
|
|
166
|
+
<Title title="Small" theme="light" level={4} />
|
|
167
|
+
<DxcCheckbox label="Small" margin={"small"} />
|
|
168
|
+
</ExampleContainer>
|
|
169
|
+
<ExampleContainer>
|
|
170
|
+
<Title title="Medium" theme="light" level={4} />
|
|
171
|
+
<DxcCheckbox label="Medium" margin={"medium"} />
|
|
172
|
+
</ExampleContainer>
|
|
173
|
+
<ExampleContainer>
|
|
174
|
+
<Title title="Large" theme="light" level={4} />
|
|
175
|
+
<DxcCheckbox label="Large" margin={"large"} />
|
|
176
|
+
</ExampleContainer>
|
|
177
|
+
<ExampleContainer>
|
|
178
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
179
|
+
<DxcCheckbox label="Xlarge" margin={"xlarge"} />
|
|
180
|
+
</ExampleContainer>
|
|
181
|
+
<ExampleContainer>
|
|
182
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
183
|
+
<DxcCheckbox label="Xxlarge" margin={"xxlarge"} />
|
|
184
|
+
</ExampleContainer>
|
|
185
|
+
</>
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
export const Chromatic = Checkbox.bind({});
|
|
189
|
+
Chromatic.play = async () => {
|
|
190
|
+
await userEvent.tab();
|
|
191
|
+
await userEvent.tab();
|
|
192
|
+
};
|
package/checkbox/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
declare type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
2
1
|
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
2
|
declare type Margin = {
|
|
4
3
|
top?: Space;
|
|
@@ -20,7 +19,7 @@ declare type Props = {
|
|
|
20
19
|
/**
|
|
21
20
|
* Text to be placed next to the checkbox.
|
|
22
21
|
*/
|
|
23
|
-
label
|
|
22
|
+
label: string;
|
|
24
23
|
/**
|
|
25
24
|
* Whether the label should appear after or before the checkbox.
|
|
26
25
|
*/
|
|
@@ -52,7 +51,7 @@ declare type Props = {
|
|
|
52
51
|
/**
|
|
53
52
|
* Size of the component ('small' | 'medium' | 'large' | 'fillParent' | 'fitContent').
|
|
54
53
|
*/
|
|
55
|
-
size?:
|
|
54
|
+
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
56
55
|
/**
|
|
57
56
|
* Value of the tabindex.
|
|
58
57
|
*/
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import DxcChip from "./Chip";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Chip",
|
|
9
|
+
component: DxcChip,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const iconSVG = () => {
|
|
13
|
+
return (
|
|
14
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
15
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
16
|
+
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Chromatic = () => (
|
|
22
|
+
<>
|
|
23
|
+
<ExampleContainer>
|
|
24
|
+
<Title title="Basic chip" theme="light" level={4} />
|
|
25
|
+
<DxcChip label="Default Chip" />
|
|
26
|
+
</ExampleContainer>
|
|
27
|
+
<ExampleContainer>
|
|
28
|
+
<Title title="Chip with prefix" theme="light" level={4} />
|
|
29
|
+
<DxcChip label="Chip with prefix" prefixIcon={iconSVG} />
|
|
30
|
+
</ExampleContainer>
|
|
31
|
+
<ExampleContainer>
|
|
32
|
+
<Title title="Chip with suffix" theme="light" level={4} />
|
|
33
|
+
<DxcChip label="Chip with suffix" suffixIcon={iconSVG} />
|
|
34
|
+
</ExampleContainer>
|
|
35
|
+
<ExampleContainer>
|
|
36
|
+
<Title title="Chip with prefix and suffix" theme="light" level={4} />
|
|
37
|
+
<DxcChip label="Chip with prefix and suffix" prefixIcon={iconSVG} suffixIcon={iconSVG} />
|
|
38
|
+
</ExampleContainer>
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Disabled chip" theme="light" level={4} />
|
|
41
|
+
<DxcChip label="Disabled" disabled prefixIcon={iconSVG} suffixIcon={iconSVG} />
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="Chip with ellipsis" theme="light" level={4} />
|
|
45
|
+
<DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Chip with ellipsis and suffix" theme="light" level={4} />
|
|
49
|
+
<DxcChip
|
|
50
|
+
suffixIcon={iconSVG}
|
|
51
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
52
|
+
/>
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Chip with ellipsis and prefix" theme="light" level={4} />
|
|
56
|
+
<DxcChip
|
|
57
|
+
prefixIcon={iconSVG}
|
|
58
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
59
|
+
/>
|
|
60
|
+
</ExampleContainer>
|
|
61
|
+
<ExampleContainer>
|
|
62
|
+
<Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
|
|
63
|
+
<DxcChip
|
|
64
|
+
prefixIcon={iconSVG}
|
|
65
|
+
suffixIcon={iconSVG}
|
|
66
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
|
|
67
|
+
/>
|
|
68
|
+
</ExampleContainer>
|
|
69
|
+
<Title title="Margins" theme="light" level={2} />
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
72
|
+
<DxcChip label="xxsmall" margin="xxsmall" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
76
|
+
<DxcChip label="xsmall" margin="xsmall" />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
80
|
+
<DxcChip label="small" margin="small" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<ExampleContainer>
|
|
83
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
84
|
+
<DxcChip label="medium" margin="medium" />
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
88
|
+
<DxcChip label="large" margin="large" />
|
|
89
|
+
</ExampleContainer>
|
|
90
|
+
<ExampleContainer>
|
|
91
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
92
|
+
<DxcChip label="xlarge" margin="xlarge" />
|
|
93
|
+
</ExampleContainer>
|
|
94
|
+
<ExampleContainer>
|
|
95
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
96
|
+
<DxcChip label="xxlarge" margin="xxlarge" />
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
</>
|
|
99
|
+
);
|
|
100
|
+
const ChipPrefixFocused = () => (
|
|
101
|
+
<ExampleContainer>
|
|
102
|
+
<Title title="Chip with prefix" theme="light" level={4} />
|
|
103
|
+
<DxcChip label="Chip with prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} />
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
);
|
|
106
|
+
const ChipSuffixFocused = () => (
|
|
107
|
+
<ExampleContainer>
|
|
108
|
+
<Title title="Chip with suffix" theme="light" level={4} />
|
|
109
|
+
<DxcChip label="Chip with suffix" suffixIcon={iconSVG} onClickSuffix={() => {}} />
|
|
110
|
+
</ExampleContainer>
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
export const PrefixFocused = ChipPrefixFocused.bind({});
|
|
114
|
+
PrefixFocused.play = async ({ canvasElement }) => {
|
|
115
|
+
await userEvent.tab();
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const SuffixFocused = ChipSuffixFocused.bind({});
|
|
119
|
+
SuffixFocused.play = async ({ canvasElement }) => {
|
|
120
|
+
await userEvent.tab();
|
|
121
|
+
};
|
package/common/variables.js
CHANGED
|
@@ -780,7 +780,7 @@ var componentTokens = {
|
|
|
780
780
|
activeActionBackgroundColor: globalTokens.hal_grey_l_80,
|
|
781
781
|
activeActionBackgroundColorOnDark: globalTokens.hal_grey_l_60,
|
|
782
782
|
listDialogBackgroundColor: globalTokens.hal_white,
|
|
783
|
-
listDialogBorderColor: globalTokens.
|
|
783
|
+
listDialogBorderColor: globalTokens.hal_grey_l_75,
|
|
784
784
|
listOptionDividerColor: globalTokens.hal_grey_l_90,
|
|
785
785
|
listOptionFontColor: globalTokens.hal_black,
|
|
786
786
|
listOptionFontSize: globalTokens.type_scale_02,
|
|
@@ -1042,9 +1042,13 @@ var componentTokens = {
|
|
|
1042
1042
|
},
|
|
1043
1043
|
slider: {
|
|
1044
1044
|
fontFamily: globalTokens.type_sans,
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1045
|
+
limitValuesFontColor: globalTokens.hal_black,
|
|
1046
|
+
limitValuesFontColorOnDark: globalTokens.hal_white,
|
|
1047
|
+
limitValuesFontSize: globalTokens.type_scale_03,
|
|
1048
|
+
limitValuesFontStyle: globalTokens.type_normal,
|
|
1049
|
+
limitValuesFontWeight: globalTokens.type_regular,
|
|
1050
|
+
limitValuesFontLetterSpacing: globalTokens.type_spacing_normal,
|
|
1051
|
+
disabledLimitValuesFontColor: globalTokens.hal_grey_l_60,
|
|
1048
1052
|
labelFontFamily: globalTokens.type_sans,
|
|
1049
1053
|
labelFontSize: globalTokens.type_scale_02,
|
|
1050
1054
|
labelFontStyle: globalTokens.type_normal,
|
|
@@ -1058,9 +1062,13 @@ var componentTokens = {
|
|
|
1058
1062
|
fontColor: globalTokens.hal_black,
|
|
1059
1063
|
fontColorOnDark: globalTokens.hal_white,
|
|
1060
1064
|
labelFontColor: globalTokens.hal_black,
|
|
1065
|
+
labelFontColorOnDark: globalTokens.hal_white,
|
|
1061
1066
|
helperTextFontColor: globalTokens.hal_black,
|
|
1062
|
-
|
|
1063
|
-
|
|
1067
|
+
helperTextFontColorOnDark: globalTokens.hal_white,
|
|
1068
|
+
disabledLabelFontColor: globalTokens.hal_grey_l_60,
|
|
1069
|
+
disabledLabelFontColorOnDark: globalTokens.hal_grey_l_60,
|
|
1070
|
+
disabledHelperTextFontColor: globalTokens.hal_grey_l_60,
|
|
1071
|
+
disabledHelperTextFontColorOnDark: globalTokens.hal_grey_l_60,
|
|
1064
1072
|
thumbHeight: "12px",
|
|
1065
1073
|
thumbWidth: "12px",
|
|
1066
1074
|
hoverThumbHeight: "14px",
|
|
@@ -1142,30 +1150,30 @@ var componentTokens = {
|
|
|
1142
1150
|
"switch": {
|
|
1143
1151
|
checkedTrackBackgroundColor: globalTokens.hal_purple_s_38,
|
|
1144
1152
|
checkedTrackBackgroundColorOnDark: globalTokens.hal_purple_s_38,
|
|
1145
|
-
checkedThumbBackgroundColor: globalTokens.
|
|
1146
|
-
checkedThumbBackgroundColorOnDark: globalTokens.
|
|
1147
|
-
uncheckedTrackBackgroundColor: globalTokens.
|
|
1148
|
-
uncheckedTrackBackgroundColorOnDark: globalTokens.
|
|
1149
|
-
uncheckedThumbBackgroundColor: globalTokens.
|
|
1150
|
-
uncheckedThumbBackgroundColorOnDark: globalTokens.
|
|
1151
|
-
disabledCheckedTrackBackgroundColor: globalTokens.
|
|
1153
|
+
checkedThumbBackgroundColor: globalTokens.hal_white,
|
|
1154
|
+
checkedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1155
|
+
uncheckedTrackBackgroundColor: globalTokens.hal_grey_l_75,
|
|
1156
|
+
uncheckedTrackBackgroundColorOnDark: globalTokens.hal_grey_l_75,
|
|
1157
|
+
uncheckedThumbBackgroundColor: globalTokens.hal_white,
|
|
1158
|
+
uncheckedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1159
|
+
disabledCheckedTrackBackgroundColor: globalTokens.hal_purple_l_95,
|
|
1152
1160
|
disabledCheckedTrackBackgroundColorOnDark: "#1c0b24",
|
|
1153
|
-
disabledCheckedThumbBackgroundColor: globalTokens.
|
|
1154
|
-
disabledCheckedThumbBackgroundColorOnDark: globalTokens.
|
|
1155
|
-
disabledUncheckedTrackBackgroundColor: globalTokens.
|
|
1161
|
+
disabledCheckedThumbBackgroundColor: globalTokens.hal_white,
|
|
1162
|
+
disabledCheckedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1163
|
+
disabledUncheckedTrackBackgroundColor: globalTokens.hal_grey_l_95,
|
|
1156
1164
|
disabledUncheckedTrackBackgroundColorOnDark: "#363636",
|
|
1157
|
-
disabledUncheckedThumbBackgroundColor: globalTokens.
|
|
1158
|
-
disabledUncheckedThumbBackgroundColorOnDark: globalTokens.
|
|
1159
|
-
disabledLabelFontColor: globalTokens.
|
|
1165
|
+
disabledUncheckedThumbBackgroundColor: globalTokens.hal_white,
|
|
1166
|
+
disabledUncheckedThumbBackgroundColorOnDark: globalTokens.hal_white,
|
|
1167
|
+
disabledLabelFontColor: globalTokens.hal_grey_l_60,
|
|
1160
1168
|
disabledLabelFontColorOnDark: "#575757",
|
|
1161
1169
|
disabledLabelFontStyle: globalTokens.type_normal,
|
|
1162
1170
|
labelFontFamily: globalTokens.type_sans,
|
|
1163
1171
|
labelFontSize: globalTokens.type_scale_root,
|
|
1164
1172
|
labelFontStyle: globalTokens.type_normal,
|
|
1165
1173
|
labelFontWeight: globalTokens.type_regular,
|
|
1166
|
-
labelFontColor: globalTokens.
|
|
1167
|
-
labelFontColorOnDark: globalTokens.
|
|
1168
|
-
thumbFocusColor: globalTokens.
|
|
1174
|
+
labelFontColor: globalTokens.hal_black,
|
|
1175
|
+
labelFontColorOnDark: globalTokens.hal_white,
|
|
1176
|
+
thumbFocusColor: globalTokens.hal_blue_l_50,
|
|
1169
1177
|
thumbFocusColorOnDark: "#1682FF",
|
|
1170
1178
|
thumbHeight: "24px",
|
|
1171
1179
|
thumbWidth: "24px",
|