@dxc-technology/halstack-react 0.0.0-b92e300 → 0.0.0-b9523dd
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/types.d.ts +1 -1
- package/accordion-group/types.d.ts +1 -1
- package/box/Box.stories.jsx +132 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +7 -12
- package/button/Button.stories.tsx +1 -1
- package/button/types.d.ts +10 -10
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +4 -23
- 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/number-input/NumberInput.stories.jsx +115 -0
- package/package.json +1 -1
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.stories.jsx +1 -1
- package/progress-bar/ProgressBar.js +1 -1
- package/radio/Radio.stories.tsx +192 -0
- package/select/index.d.ts +2 -2
- 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/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.js +17 -11
- package/tag/Tag.stories.jsx +145 -0
- package/text-input/index.d.ts +2 -2
- 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/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
package/accordion/types.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare type Padding = {
|
|
|
12
12
|
left?: Space;
|
|
13
13
|
right?: Space;
|
|
14
14
|
};
|
|
15
|
-
declare type SVG =
|
|
15
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
16
16
|
declare type Props = {
|
|
17
17
|
/**
|
|
18
18
|
* The panel label.
|
|
@@ -12,7 +12,7 @@ declare type Padding = {
|
|
|
12
12
|
left?: Space;
|
|
13
13
|
right?: Space;
|
|
14
14
|
};
|
|
15
|
-
declare type SVG =
|
|
15
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
16
16
|
export declare type AccordionPropsType = {
|
|
17
17
|
/**
|
|
18
18
|
* The panel label.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcBox from "./Box";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Box ",
|
|
8
|
+
component: DxcBox,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Display flex" theme="light" level={2} />
|
|
14
|
+
<ExampleContainer>
|
|
15
|
+
<DxcBox display="flex" padding="medium">
|
|
16
|
+
Box
|
|
17
|
+
</DxcBox>
|
|
18
|
+
</ExampleContainer>
|
|
19
|
+
<Title title="ShadowDepth" theme="light" level={2} />
|
|
20
|
+
<ExampleContainer>
|
|
21
|
+
<Title title="ShadowDepth 0" theme="light" level={4} />
|
|
22
|
+
<DxcBox shadowDepth={0} margin="medium" padding="medium">
|
|
23
|
+
Box
|
|
24
|
+
</DxcBox>
|
|
25
|
+
</ExampleContainer>
|
|
26
|
+
<ExampleContainer>
|
|
27
|
+
<Title title="ShadowDepth 1" theme="light" level={4} />
|
|
28
|
+
<DxcBox shadowDepth={1} margin="medium" padding="medium">
|
|
29
|
+
Box
|
|
30
|
+
</DxcBox>
|
|
31
|
+
</ExampleContainer>
|
|
32
|
+
<ExampleContainer>
|
|
33
|
+
<Title title="ShadowDepth 2" theme="light" level={4} />
|
|
34
|
+
<DxcBox shadowDepth={2} margin="medium" padding="medium">
|
|
35
|
+
Box
|
|
36
|
+
</DxcBox>
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
<Title title="Paddings" theme="light" level={2} />
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
41
|
+
<DxcBox padding="xxsmall">Box</DxcBox>
|
|
42
|
+
</ExampleContainer>
|
|
43
|
+
<ExampleContainer>
|
|
44
|
+
<Title title="Xsmall padding" theme="light" level={4} />
|
|
45
|
+
<DxcBox padding="xsmall">Box</DxcBox>
|
|
46
|
+
</ExampleContainer>
|
|
47
|
+
<ExampleContainer>
|
|
48
|
+
<Title title="Small padding" theme="light" level={4} />
|
|
49
|
+
<DxcBox padding="small">Box</DxcBox>
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
<ExampleContainer>
|
|
52
|
+
<Title title="Medium padding" theme="light" level={4} />
|
|
53
|
+
<DxcBox padding="medium">Box</DxcBox>
|
|
54
|
+
</ExampleContainer>
|
|
55
|
+
<ExampleContainer>
|
|
56
|
+
<Title title="Large padding" theme="light" level={4} />
|
|
57
|
+
<DxcBox padding="large">Box</DxcBox>
|
|
58
|
+
</ExampleContainer>
|
|
59
|
+
<ExampleContainer>
|
|
60
|
+
<Title title="Xlarge padding" theme="light" level={4} />
|
|
61
|
+
<DxcBox padding="xlarge">Box</DxcBox>
|
|
62
|
+
</ExampleContainer>
|
|
63
|
+
<ExampleContainer>
|
|
64
|
+
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
65
|
+
<DxcBox padding="xxlarge">Box</DxcBox>
|
|
66
|
+
</ExampleContainer>
|
|
67
|
+
<Title title="Margins" theme="light" level={2} />
|
|
68
|
+
<ExampleContainer>
|
|
69
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
70
|
+
<DxcBox margin="xxsmall" padding="medium">
|
|
71
|
+
Box
|
|
72
|
+
</DxcBox>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
76
|
+
<DxcBox margin="xsmall" padding="medium">
|
|
77
|
+
Box
|
|
78
|
+
</DxcBox>
|
|
79
|
+
</ExampleContainer>
|
|
80
|
+
<ExampleContainer>
|
|
81
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
82
|
+
<DxcBox margin="small" padding="medium">
|
|
83
|
+
Box
|
|
84
|
+
</DxcBox>
|
|
85
|
+
</ExampleContainer>
|
|
86
|
+
<ExampleContainer>
|
|
87
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
88
|
+
<DxcBox margin="medium" padding="medium">
|
|
89
|
+
Box
|
|
90
|
+
</DxcBox>
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
94
|
+
<DxcBox margin="large" padding="medium">
|
|
95
|
+
Box
|
|
96
|
+
</DxcBox>
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer>
|
|
99
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
100
|
+
<DxcBox margin="xlarge" padding="medium">
|
|
101
|
+
Box
|
|
102
|
+
</DxcBox>
|
|
103
|
+
</ExampleContainer>
|
|
104
|
+
<ExampleContainer>
|
|
105
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
106
|
+
<DxcBox margin="xxlarge" padding="medium">
|
|
107
|
+
Box
|
|
108
|
+
</DxcBox>
|
|
109
|
+
</ExampleContainer>
|
|
110
|
+
<Title title="Sizes" theme="light" level={2} />
|
|
111
|
+
<ExampleContainer>
|
|
112
|
+
<Title title="Small size" theme="light" level={4} />
|
|
113
|
+
<DxcBox size="small">Box</DxcBox>
|
|
114
|
+
</ExampleContainer>
|
|
115
|
+
<ExampleContainer>
|
|
116
|
+
<Title title="Medium size" theme="light" level={4} />
|
|
117
|
+
<DxcBox size="medium">Box</DxcBox>
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
<ExampleContainer>
|
|
120
|
+
<Title title="Large size" theme="light" level={4} />
|
|
121
|
+
<DxcBox size="large">Box</DxcBox>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="FillParent size" theme="light" level={4} />
|
|
125
|
+
<DxcBox size="fillParent">Box</DxcBox>
|
|
126
|
+
</ExampleContainer>
|
|
127
|
+
<ExampleContainer>
|
|
128
|
+
<Title title="FitContent" theme="light" level={4} />
|
|
129
|
+
<DxcBox size="fitContent">Box</DxcBox>
|
|
130
|
+
</ExampleContainer>
|
|
131
|
+
</>
|
|
132
|
+
);
|
package/button/Button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import ButtonPropsType from "./types";
|
|
3
|
-
declare const DxcButton: ({ label, mode, disabled, iconPosition, type,
|
|
3
|
+
declare const DxcButton: ({ label, mode, disabled, iconPosition, type, icon, iconSrc, onClick, margin, size, tabIndex }: ButtonPropsType) => JSX.Element;
|
|
4
4
|
export default DxcButton;
|
package/button/Button.js
CHANGED
|
@@ -44,16 +44,15 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
44
44
|
iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
|
|
45
45
|
_ref$type = _ref.type,
|
|
46
46
|
type = _ref$type === void 0 ? "button" : _ref$type,
|
|
47
|
+
icon = _ref.icon,
|
|
47
48
|
_ref$iconSrc = _ref.iconSrc,
|
|
48
49
|
iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
|
|
49
|
-
|
|
50
|
-
_ref$onClick = _ref.onClick,
|
|
51
|
-
_onClick = _ref$onClick === void 0 ? "" : _ref$onClick,
|
|
50
|
+
onClick = _ref.onClick,
|
|
52
51
|
margin = _ref.margin,
|
|
53
|
-
size = _ref.size,
|
|
52
|
+
_ref$size = _ref.size,
|
|
53
|
+
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
54
54
|
_ref$tabIndex = _ref.tabIndex,
|
|
55
55
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
56
|
-
|
|
57
56
|
var colorsTheme = (0, _useTheme["default"])();
|
|
58
57
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
59
58
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
@@ -68,16 +67,12 @@ var DxcButton = function DxcButton(_ref) {
|
|
|
68
67
|
backgroundType: backgroundType,
|
|
69
68
|
icon: icon
|
|
70
69
|
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
71
|
-
disabled: disabled,
|
|
72
70
|
type: type,
|
|
71
|
+
disabled: disabled,
|
|
73
72
|
disableRipple: true,
|
|
74
|
-
"aria-disabled": disabled
|
|
73
|
+
"aria-disabled": disabled,
|
|
75
74
|
tabIndex: disabled ? -1 : tabIndex,
|
|
76
|
-
onClick:
|
|
77
|
-
if (_onClick) {
|
|
78
|
-
_onClick();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
75
|
+
onClick: onClick
|
|
81
76
|
}, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
82
77
|
icon: icon,
|
|
83
78
|
iconPosition: iconPosition
|
package/button/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
3
|
declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
@@ -6,7 +6,7 @@ declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG =
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
10
10
|
declare type Props = {
|
|
11
11
|
/**
|
|
12
12
|
* Text to be placed next to the button.
|
|
@@ -28,29 +28,29 @@ declare type Props = {
|
|
|
28
28
|
* This prop corresponds to the 'type' prop of the button in html.
|
|
29
29
|
*/
|
|
30
30
|
type?: "button" | "reset" | "submit";
|
|
31
|
-
/**
|
|
32
|
-
* DEPRECATED. URL of the icon that will be placed next to the button label.
|
|
33
|
-
*/
|
|
34
|
-
iconSrc?: string;
|
|
35
31
|
/**
|
|
36
32
|
* Element used as the icon that will be placed next to the button label.
|
|
37
33
|
*/
|
|
38
34
|
icon?: SVG;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated URL of the icon that will be placed next to the button label.
|
|
37
|
+
*/
|
|
38
|
+
iconSrc?: string;
|
|
39
39
|
/**
|
|
40
40
|
* This function will be called when the user clicks the button. The event object will be passed as a parameter.
|
|
41
41
|
*/
|
|
42
|
-
onClick?:
|
|
42
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
43
43
|
/**
|
|
44
44
|
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
45
45
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
46
46
|
*/
|
|
47
47
|
margin?: Space | Margin;
|
|
48
48
|
/**
|
|
49
|
-
* Size of the component
|
|
49
|
+
* Size of the component.
|
|
50
50
|
*/
|
|
51
|
-
size?:
|
|
51
|
+
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
52
52
|
/**
|
|
53
|
-
* Value of the tabindex.
|
|
53
|
+
* Value of the tabindex attribute.
|
|
54
54
|
*/
|
|
55
55
|
tabIndex?: number;
|
|
56
56
|
};
|
|
@@ -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/dialog/Dialog.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 _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
25
23
|
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
24
|
var _variables = require("../common/variables.js");
|
|
29
25
|
|
|
30
26
|
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
@@ -49,7 +45,7 @@ var DxcDialog = function DxcDialog(_ref) {
|
|
|
49
45
|
_ref$tabIndex = _ref.tabIndex,
|
|
50
46
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
51
47
|
|
|
52
|
-
var _useState = (0, _react.useState)(),
|
|
48
|
+
var _useState = (0, _react.useState)(false),
|
|
53
49
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
54
50
|
isResponsive = _useState2[0],
|
|
55
51
|
setIsResponsive = _useState2[1];
|
|
@@ -57,15 +53,15 @@ var DxcDialog = function DxcDialog(_ref) {
|
|
|
57
53
|
var colorsTheme = (0, _useTheme["default"])();
|
|
58
54
|
|
|
59
55
|
var handleClose = function handleClose() {
|
|
60
|
-
|
|
56
|
+
onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
|
|
61
57
|
};
|
|
62
58
|
|
|
63
59
|
var handleOverlayClick = function handleOverlayClick() {
|
|
64
|
-
|
|
60
|
+
onBackgroundClick === null || onBackgroundClick === void 0 ? void 0 : onBackgroundClick();
|
|
65
61
|
};
|
|
66
62
|
|
|
67
63
|
var handleResize = function handleResize(width) {
|
|
68
|
-
width && width <= _variables.responsiveSizes.tablet
|
|
64
|
+
setIsResponsive(width && width <= _variables.responsiveSizes.tablet);
|
|
69
65
|
};
|
|
70
66
|
|
|
71
67
|
var handleEventListener = function handleEventListener() {
|
|
@@ -165,20 +161,5 @@ var CloseIcon = _styledComponents["default"].svg(_templateObject4 || (_templateO
|
|
|
165
161
|
return props.theme.closeIconBorderColor;
|
|
166
162
|
});
|
|
167
163
|
|
|
168
|
-
DxcDialog.propTypes = {
|
|
169
|
-
padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
170
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
171
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
172
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
173
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
174
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
175
|
-
isVisible: _propTypes["default"].bool,
|
|
176
|
-
isCloseVisible: _propTypes["default"].bool,
|
|
177
|
-
onClose: _propTypes["default"].func,
|
|
178
|
-
onCloseClick: _propTypes["default"].func,
|
|
179
|
-
onBackgroundClick: _propTypes["default"].func,
|
|
180
|
-
overlay: _propTypes["default"].bool,
|
|
181
|
-
tabIndex: _propTypes["default"].number
|
|
182
|
-
};
|
|
183
164
|
var _default = DxcDialog;
|
|
184
165
|
exports["default"] = _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Padding = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* If true, the close 'x' button will be visible.
|
|
12
|
+
*/
|
|
13
|
+
isCloseVisible?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* This function will be called when the user clicks the close 'x' button.
|
|
16
|
+
* The responsibility of hiding the modal lies with the user.
|
|
17
|
+
*/
|
|
18
|
+
onCloseClick?: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* If true, the dialog will be displayed over a darker background that covers the content behind.
|
|
21
|
+
*/
|
|
22
|
+
overlay?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* This function will be called when the user clicks background of the modal.
|
|
25
|
+
* The responsibility of hiding the modal lies with the user.
|
|
26
|
+
*/
|
|
27
|
+
onBackgroundClick?: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Size of the padding to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
30
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
|
|
31
|
+
*/
|
|
32
|
+
padding?: Padding | Space;
|
|
33
|
+
/**
|
|
34
|
+
* Value of the tabindex given to the close 'x' button.
|
|
35
|
+
*/
|
|
36
|
+
tabIndex?: number;
|
|
37
|
+
/**
|
|
38
|
+
* The area inside the dialog. This area can be used to render
|
|
39
|
+
* custom content.
|
|
40
|
+
*/
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
};
|
|
43
|
+
export default Props;
|
package/dialog/types.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import DropdownPropsType from "./types";
|
|
3
|
+
declare const DxcDropdown: ({ options, optionsIconPosition, icon, iconSrc, iconPosition, label, caretHidden, onSelectOption, expandOnHover, margin, size, tabIndex, disabled, }: DropdownPropsType) => JSX.Element;
|
|
4
|
+
export default DxcDropdown;
|