@dxc-technology/halstack-react 0.0.0-a7043e2 → 0.0.0-a799608
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.js +122 -103
- package/accordion/Accordion.stories.tsx +1 -2
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +4 -4
- package/accordion-group/AccordionGroup.js +1 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +9 -3
- package/bulleted-list/types.d.ts +1 -1
- package/button/types.d.ts +1 -1
- package/chip/types.d.ts +1 -1
- package/common/variables.js +18 -7
- package/date-input/DateInput.js +3 -3
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +1 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +242 -246
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +510 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/flex/Flex.js +1 -1
- package/flex/types.d.ts +1 -1
- package/footer/Footer.stories.tsx +8 -1
- package/footer/types.d.ts +1 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +2 -2
- package/layout/ApplicationLayout.js +3 -3
- package/layout/ApplicationLayout.stories.tsx +1 -0
- package/link/types.d.ts +1 -1
- package/package.json +9 -9
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/radio-group/RadioGroup.js +11 -13
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +25 -1
- package/select/Select.js +14 -31
- package/select/Select.stories.tsx +6 -5
- package/select/Select.test.js +63 -50
- package/select/types.d.ts +2 -4
- package/sidenav/types.d.ts +1 -1
- package/slider/Slider.js +112 -97
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +2 -2
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +110 -54
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +122 -8
- package/switch/types.d.ts +3 -4
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +74 -0
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.js +5 -5
- package/tabs-nav/Tab.js +3 -5
- package/tabs-nav/types.d.ts +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/TextInput.js +12 -21
- package/text-input/TextInput.stories.tsx +1 -2
- package/text-input/types.d.ts +1 -1
- package/toggle-group/types.d.ts +1 -1
- package/wizard/types.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
declare type Margin = {
|
|
2
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
export declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
@@ -12,7 +12,7 @@ declare type Padding = {
|
|
|
12
12
|
left?: Space;
|
|
13
13
|
right?: Space;
|
|
14
14
|
};
|
|
15
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
15
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
16
16
|
export declare type AccordionPropsType = {
|
|
17
17
|
/**
|
|
18
18
|
* The panel label.
|
|
@@ -69,4 +69,10 @@ declare type Props = {
|
|
|
69
69
|
*/
|
|
70
70
|
children: React.ReactElement<AccordionPropsType>[] | React.ReactElement<AccordionPropsType>;
|
|
71
71
|
};
|
|
72
|
+
export declare type AccordionGroupAccordionContextProps = {
|
|
73
|
+
activeIndex: number;
|
|
74
|
+
handlerActiveChange: (index: number) => void;
|
|
75
|
+
disabled: boolean;
|
|
76
|
+
index: number;
|
|
77
|
+
};
|
|
72
78
|
export default Props;
|
package/bulleted-list/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement
|
|
2
|
+
declare type SVG = React.ReactNode & (React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>);
|
|
3
3
|
declare type Props = {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
type?: "disc" | "circle" | "square" | "number" | "icon";
|
package/button/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
export declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
9
|
+
export declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
10
|
declare type Props = {
|
|
11
11
|
/**
|
|
12
12
|
* Text to be placed in the button.
|
package/chip/types.d.ts
CHANGED
package/common/variables.js
CHANGED
|
@@ -179,13 +179,13 @@ var componentTokens = {
|
|
|
179
179
|
titleLabelFontStyle: globalTokens.type_normal,
|
|
180
180
|
titleLabelFontColor: globalTokens.hal_black,
|
|
181
181
|
disabledTitleLabelFontColor: globalTokens.hal_grey_l_60,
|
|
182
|
-
titleLabelPaddingLeft: "0px",
|
|
183
|
-
titleLabelPaddingRight: "16px",
|
|
184
182
|
titleLabelPaddingTop: "0px",
|
|
185
183
|
titleLabelPaddingBottom: "0px",
|
|
184
|
+
titleLabelPaddingLeft: "0px",
|
|
185
|
+
titleLabelPaddingRight: "16px",
|
|
186
|
+
focusBorderColor: globalTokens.hal_blue_l_50,
|
|
186
187
|
focusBorderStyle: "solid",
|
|
187
188
|
focusBorderThickness: "2px",
|
|
188
|
-
focusBorderColor: globalTokens.hal_blue_l_50,
|
|
189
189
|
borderRadius: "4px",
|
|
190
190
|
boxShadowOffsetX: "0px",
|
|
191
191
|
boxShadowOffsetY: "6px",
|
|
@@ -435,7 +435,10 @@ var componentTokens = {
|
|
|
435
435
|
boxShadowOffsetY: "1px",
|
|
436
436
|
boxShadowBlur: "3px",
|
|
437
437
|
boxShadowColor: "rgba(0, 0, 0, 0.2)",
|
|
438
|
-
overlayOpacity: "0.7"
|
|
438
|
+
overlayOpacity: "0.7",
|
|
439
|
+
fontFamily: globalTokens.type_sans,
|
|
440
|
+
fontSize: globalTokens.type_scale_03,
|
|
441
|
+
fontWeight: globalTokens.type_regular
|
|
439
442
|
},
|
|
440
443
|
dropdown: {
|
|
441
444
|
buttonBackgroundColor: globalTokens.hal_white,
|
|
@@ -1103,10 +1106,10 @@ var componentTokens = {
|
|
|
1103
1106
|
thumbFocusColorOnDark: "#1682FF",
|
|
1104
1107
|
thumbHeight: "24px",
|
|
1105
1108
|
thumbWidth: "24px",
|
|
1106
|
-
thumbShift: "
|
|
1109
|
+
thumbShift: "1.25rem",
|
|
1107
1110
|
trackHeight: "12px",
|
|
1108
|
-
trackWidth: "
|
|
1109
|
-
spaceBetweenLabelSwitch: "
|
|
1111
|
+
trackWidth: "36px",
|
|
1112
|
+
spaceBetweenLabelSwitch: "8px"
|
|
1110
1113
|
},
|
|
1111
1114
|
tag: {
|
|
1112
1115
|
fontFamily: globalTokens.type_sans,
|
|
@@ -1444,6 +1447,10 @@ var defaultTranslatedComponentLabels = {
|
|
|
1444
1447
|
return "\xA9 DXC Technology ".concat(year, ". All rights reserved.");
|
|
1445
1448
|
}
|
|
1446
1449
|
},
|
|
1450
|
+
header: {
|
|
1451
|
+
closeIcon: "Close menu",
|
|
1452
|
+
hamburguerTitle: "Menu"
|
|
1453
|
+
},
|
|
1447
1454
|
numberInput: {
|
|
1448
1455
|
valueGreaterThanOrEqualToErrorMessage: function valueGreaterThanOrEqualToErrorMessage(value) {
|
|
1449
1456
|
return "Value must be greater than or equal to ".concat(value, ".");
|
|
@@ -1479,6 +1486,10 @@ var defaultTranslatedComponentLabels = {
|
|
|
1479
1486
|
actionClearSelectionTitle: "Clear selection",
|
|
1480
1487
|
actionClearSearchTitle: "Clear search"
|
|
1481
1488
|
},
|
|
1489
|
+
tabs: {
|
|
1490
|
+
scrollLeft: "Scroll left",
|
|
1491
|
+
scrollRight: "Scroll right"
|
|
1492
|
+
},
|
|
1482
1493
|
textInput: {
|
|
1483
1494
|
clearFieldActionTitle: "Clear field",
|
|
1484
1495
|
searchingMessage: "Searching...",
|
package/date-input/DateInput.js
CHANGED
|
@@ -93,9 +93,9 @@ var DxcDateInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
93
93
|
var refDate = ref || (0, _react.useRef)(null);
|
|
94
94
|
|
|
95
95
|
var handleCalendarOnKeyDown = function handleCalendarOnKeyDown(event) {
|
|
96
|
-
switch (event.
|
|
97
|
-
case
|
|
98
|
-
|
|
96
|
+
switch (event.key) {
|
|
97
|
+
case "Esc":
|
|
98
|
+
case "Escape":
|
|
99
99
|
event.preventDefault();
|
|
100
100
|
setIsOpen(false);
|
|
101
101
|
break;
|
package/dialog/Dialog.js
CHANGED
|
@@ -13,19 +13,17 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
-
var _react =
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
|
-
var _Dialog = _interopRequireDefault(require("@material-ui/core/Dialog"));
|
|
21
|
-
|
|
22
20
|
var _variables = require("../common/variables.js");
|
|
23
21
|
|
|
24
22
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
23
|
|
|
26
24
|
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
27
25
|
|
|
28
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
26
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
29
27
|
|
|
30
28
|
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); }
|
|
31
29
|
|
|
@@ -53,15 +51,37 @@ var DxcDialog = function DxcDialog(_ref) {
|
|
|
53
51
|
onBackgroundClick === null || onBackgroundClick === void 0 ? void 0 : onBackgroundClick();
|
|
54
52
|
};
|
|
55
53
|
|
|
54
|
+
var handleOnKeyDown = function handleOnKeyDown(event) {
|
|
55
|
+
if (event.key === "Escape") {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
handleClose();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
if (isCloseVisible) {
|
|
63
|
+
window.addEventListener("keydown", handleOnKeyDown);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return function () {
|
|
67
|
+
window.removeEventListener("keydown", handleOnKeyDown);
|
|
68
|
+
};
|
|
69
|
+
}, [isCloseVisible]);
|
|
56
70
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
57
71
|
theme: colorsTheme.dialog
|
|
58
|
-
}, /*#__PURE__*/_react["default"].createElement(DialogContainer, {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
}, /*#__PURE__*/_react["default"].createElement(BodyStyle, null), /*#__PURE__*/_react["default"].createElement(DialogContainer, {
|
|
73
|
+
role: "presentation"
|
|
74
|
+
}, overlay && /*#__PURE__*/_react["default"].createElement(Overlay, {
|
|
75
|
+
onClick: handleOverlayClick
|
|
76
|
+
}), /*#__PURE__*/_react["default"].createElement(Dialog, {
|
|
77
|
+
role: "dialog",
|
|
78
|
+
"aria-modal": overlay,
|
|
79
|
+
isCloseVisible: isCloseVisible
|
|
80
|
+
}, /*#__PURE__*/_react["default"].createElement(Children, {
|
|
63
81
|
padding: padding
|
|
64
|
-
},
|
|
82
|
+
}, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
83
|
+
color: colorsTheme.dialog.backgroundColor
|
|
84
|
+
}, children)), isCloseVisible && /*#__PURE__*/_react["default"].createElement(CloseIconContainer, {
|
|
65
85
|
onClick: handleClose,
|
|
66
86
|
tabIndex: tabIndex
|
|
67
87
|
}, /*#__PURE__*/_react["default"].createElement(CloseIcon, {
|
|
@@ -75,24 +95,34 @@ var DxcDialog = function DxcDialog(_ref) {
|
|
|
75
95
|
fill: "none"
|
|
76
96
|
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
77
97
|
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
78
|
-
})))
|
|
79
|
-
color: colorsTheme.dialog.backgroundColor
|
|
80
|
-
}, children))));
|
|
98
|
+
}))))));
|
|
81
99
|
};
|
|
82
100
|
|
|
83
|
-
var
|
|
101
|
+
var BodyStyle = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n body {\n overflow: hidden;\n }\n"])));
|
|
102
|
+
|
|
103
|
+
var DialogContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n position: fixed;\n inset: 0px;\n height: 100%;\n z-index: 1300;\n"])));
|
|
104
|
+
|
|
105
|
+
var Overlay = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n position: fixed;\n inset: 0px;\n height: 100%;\n background-color: ", ";\n opacity: ", ";\n"])), function (props) {
|
|
106
|
+
return props.theme.overlayColor;
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.theme.overlayOpacity;
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
var Dialog = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n z-index: 1300;\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n ", "\n box-sizing: border-box;\n box-shadow: ", ";\n border-radius: 4px;\n\n @media (min-width: ", "rem) {\n max-width: 80%;\n min-width: 800px;\n }\n\n @media (max-width: ", "rem) {\n //mobile phones\n max-width: 92%;\n min-width: 92%;\n }\n"])), function (props) {
|
|
112
|
+
return props.theme.backgroundColor;
|
|
113
|
+
}, function (props) {
|
|
84
114
|
return props.theme.fontFamily;
|
|
85
115
|
}, function (props) {
|
|
86
|
-
return props.
|
|
116
|
+
return props.theme.fontSize;
|
|
87
117
|
}, function (props) {
|
|
88
|
-
return props.
|
|
118
|
+
return props.theme.fontWeight;
|
|
89
119
|
}, function (props) {
|
|
90
|
-
return props.
|
|
91
|
-
}, _variables.responsiveSizes.medium, _variables.responsiveSizes.medium, function (props) {
|
|
92
|
-
return props.isCloseVisible ? "72px" : "";
|
|
120
|
+
return props.isCloseVisible && "min-height: 72px;";
|
|
93
121
|
}, function (props) {
|
|
94
122
|
return "".concat(props.theme.boxShadowOffsetX, " ").concat(props.theme.boxShadowOffsetY, " ").concat(props.theme.boxShadowBlur, " ").concat(props.theme.boxShadowColor);
|
|
95
|
-
},
|
|
123
|
+
}, _variables.responsiveSizes.medium, _variables.responsiveSizes.medium);
|
|
124
|
+
|
|
125
|
+
var Children = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
96
126
|
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : _variables.spaces["small"];
|
|
97
127
|
}, function (props) {
|
|
98
128
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
@@ -104,13 +134,7 @@ var DialogContainer = (0, _styledComponents["default"])(_Dialog["default"])(_tem
|
|
|
104
134
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
105
135
|
});
|
|
106
136
|
|
|
107
|
-
var
|
|
108
|
-
|
|
109
|
-
var CloseIconContainer = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: flex-end;\n position: absolute;\n top: ", ";\n right: ", ";\n cursor: pointer;\n padding: 0;\n margin: 0;\n background: none;\n color: ", ";\n width: ", ";\n height: ", ";\n border: none;\n"])), function (props) {
|
|
110
|
-
return props.theme.closeIconTopPosition;
|
|
111
|
-
}, function (props) {
|
|
112
|
-
return props.theme.closeIconRightPosition;
|
|
113
|
-
}, function (props) {
|
|
137
|
+
var CloseIconContainer = _styledComponents["default"].button(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n cursor: pointer;\n padding: 0;\n margin: 0;\n background: none;\n border: none;\n position: relative;\n top: 20px;\n right: 20px;\n color: ", ";\n width: ", ";\n height: ", ";\n"])), function (props) {
|
|
114
138
|
return props.theme.closeIconColor;
|
|
115
139
|
}, function (props) {
|
|
116
140
|
return props.theme.closeIconWidth;
|
|
@@ -118,7 +142,7 @@ var CloseIconContainer = _styledComponents["default"].button(_templateObject3 ||
|
|
|
118
142
|
return props.theme.closeIconHeight;
|
|
119
143
|
});
|
|
120
144
|
|
|
121
|
-
var CloseIcon = _styledComponents["default"].svg(
|
|
145
|
+
var CloseIcon = _styledComponents["default"].svg(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n"])), function (props) {
|
|
122
146
|
return props.theme.closeIconBackgroundColor;
|
|
123
147
|
}, function (props) {
|
|
124
148
|
return props.theme.closeIconWidth;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/testing-library";
|
|
3
2
|
import DxcDialog from "./Dialog";
|
|
4
3
|
import Title from "../../.storybook/components/Title";
|
|
5
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
@@ -209,4 +208,4 @@ export const DialogWithXxlargePadding = () => (
|
|
|
209
208
|
</p>{" "}
|
|
210
209
|
</DxcDialog>
|
|
211
210
|
</ExampleContainer>
|
|
212
|
-
);
|
|
211
|
+
);
|
package/dialog/Dialog.test.js
CHANGED
|
@@ -9,10 +9,13 @@ var _react2 = require("@testing-library/react");
|
|
|
9
9
|
var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
10
10
|
|
|
11
11
|
describe("Dialog component tests", function () {
|
|
12
|
-
test("Dialog renders with correct text", function () {
|
|
12
|
+
test("Dialog renders with correct text and accesibility attributes", function () {
|
|
13
13
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, "dialog-text")),
|
|
14
|
-
getByText = _render.getByText
|
|
14
|
+
getByText = _render.getByText,
|
|
15
|
+
getByRole = _render.getByRole;
|
|
15
16
|
|
|
17
|
+
expect(getByRole("dialog")).toBeTruthy();
|
|
18
|
+
expect(getByRole("dialog").getAttribute("aria-modal")).toBe("true");
|
|
16
19
|
expect(getByText("dialog-text")).toBeTruthy();
|
|
17
20
|
});
|
|
18
21
|
test("Dialog renders without close button", function () {
|
|
@@ -23,18 +26,45 @@ describe("Dialog component tests", function () {
|
|
|
23
26
|
|
|
24
27
|
expect(queryByRole("button")).toBeFalsy();
|
|
25
28
|
});
|
|
29
|
+
test("Dialog renders with aria-modal false when overlay is not used", function () {
|
|
30
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
31
|
+
isCloseVisible: false,
|
|
32
|
+
overlay: false
|
|
33
|
+
}, "dialog-text")),
|
|
34
|
+
getByRole = _render3.getByRole;
|
|
35
|
+
|
|
36
|
+
expect(getByRole("dialog")).toBeTruthy();
|
|
37
|
+
expect(getByRole("dialog").getAttribute("aria-modal")).toBe("false");
|
|
38
|
+
});
|
|
26
39
|
test("Calls correct function onCloseClick", function () {
|
|
27
40
|
var onCloseClick = jest.fn();
|
|
28
41
|
|
|
29
|
-
var
|
|
42
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
30
43
|
onCloseClick: onCloseClick
|
|
31
44
|
}, "dialog-text")),
|
|
32
|
-
getByRole =
|
|
45
|
+
getByRole = _render4.getByRole;
|
|
33
46
|
|
|
34
47
|
var closeButton = getByRole("button");
|
|
35
48
|
|
|
36
49
|
_react2.fireEvent.click(closeButton);
|
|
37
50
|
|
|
51
|
+
expect(onCloseClick).toHaveBeenCalled();
|
|
52
|
+
});
|
|
53
|
+
test("Calls correct function onCloseClick when 'escape' key is pressed", function () {
|
|
54
|
+
var onCloseClick = jest.fn();
|
|
55
|
+
|
|
56
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
57
|
+
onCloseClick: onCloseClick
|
|
58
|
+
}, "dialog-text")),
|
|
59
|
+
getByRole = _render5.getByRole;
|
|
60
|
+
|
|
61
|
+
_react2.fireEvent.keyDown(getByRole("button"), {
|
|
62
|
+
key: "Escape",
|
|
63
|
+
code: "Escape",
|
|
64
|
+
keyCode: 27,
|
|
65
|
+
charCode: 27
|
|
66
|
+
});
|
|
67
|
+
|
|
38
68
|
expect(onCloseClick).toHaveBeenCalled();
|
|
39
69
|
});
|
|
40
70
|
});
|
package/dialog/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
declare type Padding = {
|
|
2
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
export declare type Padding = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
package/dropdown/Dropdown.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import DropdownPropsType from "./types";
|
|
3
|
-
declare const DxcDropdown: ({ options, optionsIconPosition, icon, iconPosition, label, caretHidden,
|
|
3
|
+
declare const DxcDropdown: ({ options, optionsIconPosition, icon, iconPosition, label, caretHidden, disabled, expandOnHover, onSelectOption, margin, size, tabIndex, }: DropdownPropsType) => JSX.Element;
|
|
4
4
|
export default DxcDropdown;
|