@dxc-technology/halstack-react 0.0.0-8b5e703 → 0.0.0-8b61ced
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/HalstackContext.js +7 -11
- package/accordion/Accordion.js +122 -103
- package/accordion/Accordion.stories.tsx +2 -3
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +2 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +23 -33
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +43 -61
- package/button/Button.stories.tsx +9 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +34 -36
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/types.d.ts +1 -1
- package/common/variables.js +75 -48
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +247 -247
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +504 -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/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/{radio → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +2 -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 +3 -2
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +70 -117
- package/layout/ApplicationLayout.stories.tsx +84 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.js +12 -5
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +1 -1
- package/main.d.ts +5 -9
- package/main.js +28 -60
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -20
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.test.js +43 -1
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- 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/quick-nav/QuickNav.js +25 -20
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +23 -22
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +65 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +53 -7
- package/select/Select.js +43 -43
- package/select/Select.stories.tsx +133 -103
- package/select/Select.test.js +363 -250
- package/select/types.d.ts +2 -5
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +184 -52
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +2 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- 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 -1
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.d.ts +2 -1
- package/tabs-nav/NavTabs.js +40 -21
- package/tabs-nav/Tab.js +29 -16
- package/tabs-nav/types.d.ts +7 -5
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +38 -9
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +189 -282
- package/text-input/TextInput.stories.tsx +194 -182
- package/text-input/TextInput.test.js +737 -725
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/{row → typography}/types.js +0 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/common/RequiredComponent.js +0 -32
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/stack/types.js +0 -5
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
package/layout/types.d.ts
CHANGED
|
@@ -1,54 +1,39 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
declare type
|
|
3
|
-
declare type Padding = {
|
|
4
|
-
top?: Space;
|
|
5
|
-
bottom?: Space;
|
|
6
|
-
left?: Space;
|
|
7
|
-
right?: Space;
|
|
8
|
-
};
|
|
9
|
-
declare type ChildrenType = AppLayoutHeaderPropsType | AppLayoutMainPropsType | AppLayoutFooterPropsType | AppLayoutSidenavPropsType;
|
|
10
|
-
export declare type AppLayoutHeaderPropsType = {
|
|
11
|
-
/**
|
|
12
|
-
* Everything between this tags will be displayed as a header, at the top of the screen.
|
|
13
|
-
* This is optional and if it is not specified, the DxcHeader will be shown by default.
|
|
14
|
-
*/
|
|
15
|
-
children?: React.ReactNode;
|
|
16
|
-
};
|
|
2
|
+
declare type ChildrenType = AppLayoutMainPropsType | AppLayoutSidenavPropsType;
|
|
17
3
|
export declare type AppLayoutMainPropsType = {
|
|
18
4
|
/**
|
|
19
5
|
* Everything between the tags will be displayed as the content of the main part of the application.
|
|
20
6
|
*/
|
|
21
7
|
children: React.ReactNode;
|
|
22
8
|
};
|
|
23
|
-
export declare type
|
|
9
|
+
export declare type AppLayoutSidenavPropsType = {
|
|
10
|
+
/**
|
|
11
|
+
* The area inside the sidenav. This area can be used to render the content inside the sidenav.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
24
14
|
/**
|
|
25
|
-
*
|
|
26
|
-
* This is optional and if it is not specified, the DxcFooter will be shown by default.
|
|
15
|
+
* The area assigned to render the sidenav title. It is highly recommended to use the sidenav title.
|
|
27
16
|
*/
|
|
28
|
-
|
|
17
|
+
title?: React.ReactNode;
|
|
29
18
|
};
|
|
30
|
-
|
|
19
|
+
declare type AppLayoutPropsType = {
|
|
31
20
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
21
|
+
* Text to be placed next to the hamburger button that toggles the
|
|
22
|
+
* visibility of the sidenav.
|
|
34
23
|
*/
|
|
35
|
-
|
|
24
|
+
visibilityToggleLabel?: string;
|
|
36
25
|
/**
|
|
37
|
-
*
|
|
26
|
+
* Header content.
|
|
38
27
|
*/
|
|
39
|
-
|
|
28
|
+
header?: React.ReactNode;
|
|
40
29
|
/**
|
|
41
|
-
*
|
|
42
|
-
* In lower resolutions the arrow will be always displayed.
|
|
30
|
+
* Sidenav content
|
|
43
31
|
*/
|
|
44
|
-
|
|
32
|
+
sidenav?: React.ReactNode;
|
|
45
33
|
/**
|
|
46
|
-
*
|
|
47
|
-
* In lower resolutions the mode will always be overlay.
|
|
34
|
+
* Footer content
|
|
48
35
|
*/
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
declare type AppLayoutPropsType = {
|
|
36
|
+
footer?: React.ReactNode;
|
|
52
37
|
/**
|
|
53
38
|
* The area inside the sidenav. This area can be used to render custom content.
|
|
54
39
|
*/
|
package/link/Link.js
CHANGED
|
@@ -13,6 +13,10 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
17
|
+
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
|
+
|
|
16
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
21
|
|
|
18
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
@@ -23,6 +27,8 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
23
27
|
|
|
24
28
|
var _templateObject, _templateObject2, _templateObject3;
|
|
25
29
|
|
|
30
|
+
var _excluded = ["inheritColor", "disabled", "icon", "iconPosition", "href", "newWindow", "onClick", "margin", "tabIndex", "children"];
|
|
31
|
+
|
|
26
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
33
|
|
|
28
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -54,28 +60,29 @@ var DxcLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
54
60
|
margin = _ref2.margin,
|
|
55
61
|
_ref2$tabIndex = _ref2.tabIndex,
|
|
56
62
|
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex,
|
|
57
|
-
children = _ref2.children
|
|
63
|
+
children = _ref2.children,
|
|
64
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
58
65
|
var colorsTheme = (0, _useTheme["default"])();
|
|
59
66
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
60
67
|
theme: colorsTheme.link
|
|
61
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledLink, {
|
|
68
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledLink, (0, _extends2["default"])({
|
|
62
69
|
as: href ? "a" : "button",
|
|
63
70
|
tabIndex: tabIndex,
|
|
64
|
-
onClick: !disabled
|
|
71
|
+
onClick: !disabled ? onClick : undefined,
|
|
65
72
|
href: !disabled && href ? href : undefined,
|
|
66
73
|
target: href ? newWindow ? "_blank" : "_self" : undefined,
|
|
67
74
|
disabled: disabled,
|
|
68
75
|
inheritColor: inheritColor,
|
|
69
76
|
margin: margin,
|
|
70
77
|
ref: ref
|
|
71
|
-
}, /*#__PURE__*/_react["default"].createElement(LinkContent, {
|
|
78
|
+
}, otherProps), /*#__PURE__*/_react["default"].createElement(LinkContent, {
|
|
72
79
|
iconPosition: iconPosition,
|
|
73
80
|
icon: icon,
|
|
74
81
|
children: children
|
|
75
82
|
})));
|
|
76
83
|
});
|
|
77
84
|
|
|
78
|
-
var StyledLink = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-size: ", ";\n font-weight: ", ";\n font-style: ", ";\n font-family: ", ";\n text-decoration-color: transparent;\n width: fit-content;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
|
|
85
|
+
var StyledLink = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: baseline;\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-size: ", ";\n font-weight: ", ";\n font-style: ", ";\n font-family: ", ";\n text-decoration-color: transparent;\n width: fit-content;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
|
|
79
86
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
80
87
|
}, function (props) {
|
|
81
88
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
package/link/Link.stories.tsx
CHANGED
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
const icon = (
|
|
12
|
-
<svg viewBox="0 0 24 24"
|
|
12
|
+
<svg viewBox="0 0 24 24" enableBackground="new 0 0 24 24" fill="currentColor">
|
|
13
13
|
<g id="Bounding_Box">
|
|
14
14
|
<rect fill="none" width="24" height="24" />
|
|
15
15
|
</g>
|
|
@@ -68,11 +68,18 @@ export const Chromatic = () => (
|
|
|
68
68
|
</ExampleContainer>
|
|
69
69
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
70
70
|
<Title title="Long text with hover" theme="light" level={4} />
|
|
71
|
-
Lorem
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
Lorem{" "}
|
|
72
|
+
<DxcLink href="https://www.google.com" icon={icon}>
|
|
73
|
+
Test
|
|
74
|
+
</DxcLink>{" "}
|
|
75
|
+
ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
|
76
|
+
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
77
|
+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
78
|
+
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit{" "}
|
|
79
|
+
<DxcLink href="https://www.google.com" icon={icon} iconPosition="after">
|
|
80
|
+
Test
|
|
81
|
+
</DxcLink>{" "}
|
|
82
|
+
anim id est laborum.
|
|
76
83
|
</ExampleContainer>
|
|
77
84
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
78
85
|
<Title title="Long text with focus" theme="light" level={4} />
|
package/link/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
9
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
10
|
export declare type LinkProps = {
|
|
11
11
|
/**
|
|
12
12
|
* If true, the color is inherited from parent.
|
package/main.d.ts
CHANGED
|
@@ -5,9 +5,6 @@ import DxcCard from "./card/Card";
|
|
|
5
5
|
import DxcCheckbox from "./checkbox/Checkbox";
|
|
6
6
|
import DxcDialog from "./dialog/Dialog";
|
|
7
7
|
import DxcDropdown from "./dropdown/Dropdown";
|
|
8
|
-
import DxcFooter from "./footer/Footer";
|
|
9
|
-
import DxcHeader from "./header/Header";
|
|
10
|
-
import DxcRadio from "./radio/Radio";
|
|
11
8
|
import DxcSlider from "./slider/Slider";
|
|
12
9
|
import DxcSwitch from "./switch/Switch";
|
|
13
10
|
import DxcTabs from "./tabs/Tabs";
|
|
@@ -17,7 +14,6 @@ import DxcTable from "./table/Table";
|
|
|
17
14
|
import DxcBox from "./box/Box";
|
|
18
15
|
import DxcTag from "./tag/Tag";
|
|
19
16
|
import DxcPaginator from "./paginator/Paginator";
|
|
20
|
-
import DxcSidenav from "./sidenav/Sidenav";
|
|
21
17
|
import DxcWizard from "./wizard/Wizard";
|
|
22
18
|
import DxcLink from "./link/Link";
|
|
23
19
|
import DxcHeading from "./heading/Heading";
|
|
@@ -34,15 +30,15 @@ import DxcNumberInput from "./number-input/NumberInput";
|
|
|
34
30
|
import DxcTextarea from "./textarea/Textarea";
|
|
35
31
|
import DxcSelect from "./select/Select";
|
|
36
32
|
import DxcFileInput from "./file-input/FileInput";
|
|
37
|
-
import DxcStack from "./stack/Stack";
|
|
38
|
-
import DxcRow from "./row/Row";
|
|
39
|
-
import DxcText from "./text/Text";
|
|
40
|
-
import DxcList from "./list/List";
|
|
41
33
|
import DxcRadioGroup from "./radio-group/RadioGroup";
|
|
42
34
|
import DxcBleed from "./bleed/Bleed";
|
|
43
35
|
import DxcInset from "./inset/Inset";
|
|
44
36
|
import DxcQuickNav from "./quick-nav/QuickNav";
|
|
45
37
|
import DxcNavTabs from "./tabs-nav/NavTabs";
|
|
38
|
+
import DxcFlex from "./flex/Flex";
|
|
39
|
+
import DxcTypography from "./typography/Typography";
|
|
40
|
+
import DxcParagraph from "./paragraph/Paragraph";
|
|
41
|
+
import DxcBulletedList from "./bulleted-list/BulletedList";
|
|
46
42
|
import HalstackContext, { HalstackProvider, HalstackLanguageContext } from "./HalstackContext";
|
|
47
43
|
import { BackgroundColorProvider } from "./BackgroundColorContext";
|
|
48
|
-
export { DxcAlert, DxcButton,
|
|
44
|
+
export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, };
|
package/main.js
CHANGED
|
@@ -55,6 +55,12 @@ Object.defineProperty(exports, "DxcBox", {
|
|
|
55
55
|
return _Box["default"];
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
|
+
Object.defineProperty(exports, "DxcBulletedList", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function get() {
|
|
61
|
+
return _BulletedList["default"];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
58
64
|
Object.defineProperty(exports, "DxcButton", {
|
|
59
65
|
enumerable: true,
|
|
60
66
|
get: function get() {
|
|
@@ -103,16 +109,10 @@ Object.defineProperty(exports, "DxcFileInput", {
|
|
|
103
109
|
return _FileInput["default"];
|
|
104
110
|
}
|
|
105
111
|
});
|
|
106
|
-
Object.defineProperty(exports, "
|
|
112
|
+
Object.defineProperty(exports, "DxcFlex", {
|
|
107
113
|
enumerable: true,
|
|
108
114
|
get: function get() {
|
|
109
|
-
return
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
Object.defineProperty(exports, "DxcHeader", {
|
|
113
|
-
enumerable: true,
|
|
114
|
-
get: function get() {
|
|
115
|
-
return _Header["default"];
|
|
115
|
+
return _Flex["default"];
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
Object.defineProperty(exports, "DxcHeading", {
|
|
@@ -133,12 +133,6 @@ Object.defineProperty(exports, "DxcLink", {
|
|
|
133
133
|
return _Link["default"];
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
|
-
Object.defineProperty(exports, "DxcList", {
|
|
137
|
-
enumerable: true,
|
|
138
|
-
get: function get() {
|
|
139
|
-
return _List["default"];
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
136
|
Object.defineProperty(exports, "DxcNavTabs", {
|
|
143
137
|
enumerable: true,
|
|
144
138
|
get: function get() {
|
|
@@ -157,6 +151,12 @@ Object.defineProperty(exports, "DxcPaginator", {
|
|
|
157
151
|
return _Paginator["default"];
|
|
158
152
|
}
|
|
159
153
|
});
|
|
154
|
+
Object.defineProperty(exports, "DxcParagraph", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function get() {
|
|
157
|
+
return _Paragraph["default"];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
160
|
Object.defineProperty(exports, "DxcPasswordInput", {
|
|
161
161
|
enumerable: true,
|
|
162
162
|
get: function get() {
|
|
@@ -175,12 +175,6 @@ Object.defineProperty(exports, "DxcQuickNav", {
|
|
|
175
175
|
return _QuickNav["default"];
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
|
-
Object.defineProperty(exports, "DxcRadio", {
|
|
179
|
-
enumerable: true,
|
|
180
|
-
get: function get() {
|
|
181
|
-
return _Radio["default"];
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
178
|
Object.defineProperty(exports, "DxcRadioGroup", {
|
|
185
179
|
enumerable: true,
|
|
186
180
|
get: function get() {
|
|
@@ -193,24 +187,12 @@ Object.defineProperty(exports, "DxcResultsetTable", {
|
|
|
193
187
|
return _ResultsetTable["default"];
|
|
194
188
|
}
|
|
195
189
|
});
|
|
196
|
-
Object.defineProperty(exports, "DxcRow", {
|
|
197
|
-
enumerable: true,
|
|
198
|
-
get: function get() {
|
|
199
|
-
return _Row["default"];
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
190
|
Object.defineProperty(exports, "DxcSelect", {
|
|
203
191
|
enumerable: true,
|
|
204
192
|
get: function get() {
|
|
205
193
|
return _Select["default"];
|
|
206
194
|
}
|
|
207
195
|
});
|
|
208
|
-
Object.defineProperty(exports, "DxcSidenav", {
|
|
209
|
-
enumerable: true,
|
|
210
|
-
get: function get() {
|
|
211
|
-
return _Sidenav["default"];
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
196
|
Object.defineProperty(exports, "DxcSlider", {
|
|
215
197
|
enumerable: true,
|
|
216
198
|
get: function get() {
|
|
@@ -223,12 +205,6 @@ Object.defineProperty(exports, "DxcSpinner", {
|
|
|
223
205
|
return _Spinner["default"];
|
|
224
206
|
}
|
|
225
207
|
});
|
|
226
|
-
Object.defineProperty(exports, "DxcStack", {
|
|
227
|
-
enumerable: true,
|
|
228
|
-
get: function get() {
|
|
229
|
-
return _Stack["default"];
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
208
|
Object.defineProperty(exports, "DxcSwitch", {
|
|
233
209
|
enumerable: true,
|
|
234
210
|
get: function get() {
|
|
@@ -253,12 +229,6 @@ Object.defineProperty(exports, "DxcTag", {
|
|
|
253
229
|
return _Tag["default"];
|
|
254
230
|
}
|
|
255
231
|
});
|
|
256
|
-
Object.defineProperty(exports, "DxcText", {
|
|
257
|
-
enumerable: true,
|
|
258
|
-
get: function get() {
|
|
259
|
-
return _Text["default"];
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
232
|
Object.defineProperty(exports, "DxcTextInput", {
|
|
263
233
|
enumerable: true,
|
|
264
234
|
get: function get() {
|
|
@@ -277,6 +247,12 @@ Object.defineProperty(exports, "DxcToggleGroup", {
|
|
|
277
247
|
return _ToggleGroup["default"];
|
|
278
248
|
}
|
|
279
249
|
});
|
|
250
|
+
Object.defineProperty(exports, "DxcTypography", {
|
|
251
|
+
enumerable: true,
|
|
252
|
+
get: function get() {
|
|
253
|
+
return _Typography["default"];
|
|
254
|
+
}
|
|
255
|
+
});
|
|
280
256
|
Object.defineProperty(exports, "DxcWizard", {
|
|
281
257
|
enumerable: true,
|
|
282
258
|
get: function get() {
|
|
@@ -316,12 +292,6 @@ var _Dialog = _interopRequireDefault(require("./dialog/Dialog"));
|
|
|
316
292
|
|
|
317
293
|
var _Dropdown = _interopRequireDefault(require("./dropdown/Dropdown"));
|
|
318
294
|
|
|
319
|
-
var _Footer = _interopRequireDefault(require("./footer/Footer"));
|
|
320
|
-
|
|
321
|
-
var _Header = _interopRequireDefault(require("./header/Header"));
|
|
322
|
-
|
|
323
|
-
var _Radio = _interopRequireDefault(require("./radio/Radio"));
|
|
324
|
-
|
|
325
295
|
var _Slider = _interopRequireDefault(require("./slider/Slider"));
|
|
326
296
|
|
|
327
297
|
var _Switch = _interopRequireDefault(require("./switch/Switch"));
|
|
@@ -340,8 +310,6 @@ var _Tag = _interopRequireDefault(require("./tag/Tag"));
|
|
|
340
310
|
|
|
341
311
|
var _Paginator = _interopRequireDefault(require("./paginator/Paginator"));
|
|
342
312
|
|
|
343
|
-
var _Sidenav = _interopRequireDefault(require("./sidenav/Sidenav"));
|
|
344
|
-
|
|
345
313
|
var _Wizard = _interopRequireDefault(require("./wizard/Wizard"));
|
|
346
314
|
|
|
347
315
|
var _Link = _interopRequireDefault(require("./link/Link"));
|
|
@@ -374,14 +342,6 @@ var _Select = _interopRequireDefault(require("./select/Select"));
|
|
|
374
342
|
|
|
375
343
|
var _FileInput = _interopRequireDefault(require("./file-input/FileInput"));
|
|
376
344
|
|
|
377
|
-
var _Stack = _interopRequireDefault(require("./stack/Stack"));
|
|
378
|
-
|
|
379
|
-
var _Row = _interopRequireDefault(require("./row/Row"));
|
|
380
|
-
|
|
381
|
-
var _Text = _interopRequireDefault(require("./text/Text"));
|
|
382
|
-
|
|
383
|
-
var _List = _interopRequireDefault(require("./list/List"));
|
|
384
|
-
|
|
385
345
|
var _RadioGroup = _interopRequireDefault(require("./radio-group/RadioGroup"));
|
|
386
346
|
|
|
387
347
|
var _Bleed = _interopRequireDefault(require("./bleed/Bleed"));
|
|
@@ -392,6 +352,14 @@ var _QuickNav = _interopRequireDefault(require("./quick-nav/QuickNav"));
|
|
|
392
352
|
|
|
393
353
|
var _NavTabs = _interopRequireDefault(require("./tabs-nav/NavTabs"));
|
|
394
354
|
|
|
355
|
+
var _Flex = _interopRequireDefault(require("./flex/Flex"));
|
|
356
|
+
|
|
357
|
+
var _Typography = _interopRequireDefault(require("./typography/Typography"));
|
|
358
|
+
|
|
359
|
+
var _Paragraph = _interopRequireDefault(require("./paragraph/Paragraph"));
|
|
360
|
+
|
|
361
|
+
var _BulletedList = _interopRequireDefault(require("./bulleted-list/BulletedList"));
|
|
362
|
+
|
|
395
363
|
var _HalstackContext = _interopRequireWildcard(require("./HalstackContext"));
|
|
396
364
|
|
|
397
365
|
var _BackgroundColorContext = require("./BackgroundColorContext");
|
|
@@ -83,7 +83,7 @@ describe("Number input component tests", function () {
|
|
|
83
83
|
})),
|
|
84
84
|
getByRole = _render8.getByRole;
|
|
85
85
|
|
|
86
|
-
var input = getByRole("
|
|
86
|
+
var input = getByRole("spinbutton");
|
|
87
87
|
|
|
88
88
|
_userEvent["default"].type(input, "1");
|
|
89
89
|
|
|
@@ -366,12 +366,7 @@ describe("Number input component tests", function () {
|
|
|
366
366
|
expect(number.value).toBe("10");
|
|
367
367
|
});
|
|
368
368
|
test("Increment and decrement the value with min, max and step", function () {
|
|
369
|
-
var onBlur = jest.fn(
|
|
370
|
-
var value = _ref3.value,
|
|
371
|
-
error = _ref3.error;
|
|
372
|
-
expect(value).toBe("1");
|
|
373
|
-
expect(error).toBe("Value must be greater than or equal to 5.");
|
|
374
|
-
});
|
|
369
|
+
var onBlur = jest.fn();
|
|
375
370
|
|
|
376
371
|
var _render20 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NumberInput["default"], {
|
|
377
372
|
label: "Number input label",
|
|
@@ -389,6 +384,10 @@ describe("Number input component tests", function () {
|
|
|
389
384
|
|
|
390
385
|
_react2.fireEvent.blur(number);
|
|
391
386
|
|
|
387
|
+
expect(onBlur).toHaveBeenCalledWith({
|
|
388
|
+
value: "1",
|
|
389
|
+
error: "Value must be greater than or equal to 5."
|
|
390
|
+
});
|
|
392
391
|
var increment = getAllByRole("button")[1];
|
|
393
392
|
|
|
394
393
|
_userEvent["default"].click(increment);
|
|
@@ -503,4 +502,41 @@ describe("Number input component tests", function () {
|
|
|
503
502
|
var increment = getAllByRole("button")[1];
|
|
504
503
|
expect(increment.getAttribute("aria-label")).toBe("Increment value");
|
|
505
504
|
});
|
|
505
|
+
test("Number input submits correct values in a form", function () {
|
|
506
|
+
var handlerOnSubmit = jest.fn(function (e) {
|
|
507
|
+
e.preventDefault();
|
|
508
|
+
var formData = new FormData(e.target);
|
|
509
|
+
var formProps = Object.fromEntries(formData);
|
|
510
|
+
expect(formProps).toStrictEqual({
|
|
511
|
+
data: "0"
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
var _render23 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement("form", {
|
|
516
|
+
onSubmit: handlerOnSubmit
|
|
517
|
+
}, /*#__PURE__*/_react["default"].createElement(_NumberInput["default"], {
|
|
518
|
+
label: "Number input label",
|
|
519
|
+
name: "data"
|
|
520
|
+
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
521
|
+
type: "submit"
|
|
522
|
+
}, "Submit"))),
|
|
523
|
+
getByText = _render23.getByText,
|
|
524
|
+
getAllByRole = _render23.getAllByRole;
|
|
525
|
+
|
|
526
|
+
var less = getAllByRole("button")[0];
|
|
527
|
+
var more = getAllByRole("button")[1];
|
|
528
|
+
var submit = getByText("Submit");
|
|
529
|
+
|
|
530
|
+
_userEvent["default"].click(more);
|
|
531
|
+
|
|
532
|
+
expect(handlerOnSubmit).not.toHaveBeenCalled();
|
|
533
|
+
|
|
534
|
+
_userEvent["default"].click(less);
|
|
535
|
+
|
|
536
|
+
expect(handlerOnSubmit).not.toHaveBeenCalled();
|
|
537
|
+
|
|
538
|
+
_userEvent["default"].click(submit);
|
|
539
|
+
|
|
540
|
+
expect(handlerOnSubmit).toHaveBeenCalled();
|
|
541
|
+
});
|
|
506
542
|
});
|
package/package.json
CHANGED
|
@@ -1,40 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxc-technology/halstack-react",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-8b61ced",
|
|
4
4
|
"description": "DXC Halstack React components library",
|
|
5
5
|
"repository": "dxc-technology/halstack-react",
|
|
6
|
-
"homepage": "
|
|
6
|
+
"homepage": "https://developer.dxc.com/halstack",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "DXC Technology",
|
|
10
10
|
"email": "DigitalInsurance@dxc.com",
|
|
11
|
-
"url": "https://dxc.com"
|
|
11
|
+
"url": "https://developer.dxc.com"
|
|
12
12
|
},
|
|
13
13
|
"main": "./main.js",
|
|
14
14
|
"types": "./main.d.ts",
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"react": "^
|
|
17
|
-
"react-dom": "^
|
|
16
|
+
"react": "^18.x",
|
|
17
|
+
"react-dom": "^18.x",
|
|
18
18
|
"styled-components": "^5.0.1"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"@material-ui/core": "4.11.1",
|
|
23
|
-
"@material-ui/icons": "4.4.3",
|
|
24
|
-
"@material-ui/lab": "4.0.0-alpha.17",
|
|
25
|
-
"@material-ui/pickers": "3.2.2",
|
|
26
|
-
"@material-ui/styles": "4.0.2",
|
|
21
|
+
"@radix-ui/react-popover": "0.1.6",
|
|
27
22
|
"@types/styled-components": "^5.1.24",
|
|
28
23
|
"@types/uuid": "^8.3.4",
|
|
29
24
|
"color": "^3.1.3",
|
|
30
25
|
"dayjs": "^1.11.1",
|
|
31
|
-
"prop-types": "^15.7.2",
|
|
32
26
|
"rgb-hex": "^3.0.0",
|
|
33
27
|
"slugify": "^1.6.5",
|
|
34
28
|
"uuid": "^8.3.2"
|
|
35
29
|
},
|
|
36
30
|
"scripts": {
|
|
37
|
-
"test": "jest",
|
|
31
|
+
"test": "jest --env=jsdom",
|
|
38
32
|
"test:watch": "npm test -- --watch --coverage",
|
|
39
33
|
"build": "babel src --extensions .js,.jsx,.ts,.tsx --out-dir ../dist --copy-files --verbose && node ../scripts/build/copy-package.js && tsc ",
|
|
40
34
|
"build:watch": "babel src --watch --extensions .js,.jsx,.ts,.tsx --out-dir ../dist --copy-files --verbose",
|
|
@@ -55,9 +49,9 @@
|
|
|
55
49
|
"@storybook/addon-links": "^6.4.9",
|
|
56
50
|
"@storybook/react": "^6.4.9",
|
|
57
51
|
"@storybook/testing-library": "0.0.7",
|
|
58
|
-
"@testing-library/react": "^
|
|
59
|
-
"@testing-library/user-event": "^
|
|
60
|
-
"@types/react": "
|
|
52
|
+
"@testing-library/react": "^13.0.0",
|
|
53
|
+
"@testing-library/user-event": "^13.0.0",
|
|
54
|
+
"@types/react": "^18.0.18",
|
|
61
55
|
"babel-jest": "^24.8.0",
|
|
62
56
|
"babel-loader": "^8.0.6",
|
|
63
57
|
"chromatic": "^6.3.3",
|
|
@@ -71,9 +65,10 @@
|
|
|
71
65
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
72
66
|
"eslint-plugin-storybook": "^0.5.5",
|
|
73
67
|
"identity-obj-proxy": "^3.0.0",
|
|
74
|
-
"jest": "^
|
|
75
|
-
"
|
|
76
|
-
"react
|
|
68
|
+
"jest": "^29.2.2",
|
|
69
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
70
|
+
"react": "^18.x",
|
|
71
|
+
"react-dom": "^18.x",
|
|
77
72
|
"react-test-renderer": "^16.8.6",
|
|
78
73
|
"storybook-addon-pseudo-states": "^1.0.0",
|
|
79
74
|
"styled-components": "^5.0.1",
|
|
@@ -83,7 +78,8 @@
|
|
|
83
78
|
"moduleNameMapper": {
|
|
84
79
|
"\\.(css|less|scss|sass)$": "identity-obj-proxy",
|
|
85
80
|
"\\.(svg)$": "<rootDir>/test/mocks/svgMock.js",
|
|
86
|
-
"\\.(png)$": "<rootDir>/test/mocks/pngMock.js"
|
|
81
|
+
"\\.(png)$": "<rootDir>/test/mocks/pngMock.js",
|
|
82
|
+
"^uuid$": "uuid"
|
|
87
83
|
}
|
|
88
84
|
}
|
|
89
85
|
}
|
package/paginator/Paginator.js
CHANGED
|
@@ -153,7 +153,7 @@ var ItemsPageContainer = _styledComponents["default"].span(_templateObject3 || (
|
|
|
153
153
|
|
|
154
154
|
var ItemsLabel = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 0.5rem;\n"])));
|
|
155
155
|
|
|
156
|
-
var GoToLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 0.5rem;\n margin-left:
|
|
156
|
+
var GoToLabel = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 0.5rem;\n margin-left: 0.5rem;\n"])));
|
|
157
157
|
|
|
158
158
|
var TotalItemsContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
159
159
|
return props.theme.totalItemsContainerMarginRight;
|
|
@@ -163,7 +163,7 @@ var TotalItemsContainer = _styledComponents["default"].span(_templateObject6 ||
|
|
|
163
163
|
|
|
164
164
|
var LabelsContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n gap: 0.5rem;\n width: 100%;\n justify-content: flex-end;\n align-items: center;\n"])));
|
|
165
165
|
|
|
166
|
-
var PageToSelectContainer = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n\n label {\n height: 0px;\n }\n label + .MuiInput-formControl {\n margin-top: 0px;\n }\n"])));
|
|
166
|
+
var PageToSelectContainer = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n margin-right: 0.5rem;\n\n label {\n height: 0px;\n }\n label + .MuiInput-formControl {\n margin-top: 0px;\n }\n"])));
|
|
167
167
|
|
|
168
168
|
var TextContainer = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
169
169
|
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
6
|
+
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
|
|
5
9
|
var _react = _interopRequireDefault(require("react"));
|
|
6
10
|
|
|
7
11
|
var _react2 = require("@testing-library/react");
|
|
@@ -10,6 +14,44 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
|
10
14
|
|
|
11
15
|
var _Paginator = _interopRequireDefault(require("./Paginator"));
|
|
12
16
|
|
|
17
|
+
// Mocking DOMRect for Radix Primitive Popover
|
|
18
|
+
global.globalThis = global;
|
|
19
|
+
|
|
20
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
21
|
+
function ResizeObserver(cb) {
|
|
22
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
23
|
+
this.cb = cb;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
(0, _createClass2["default"])(ResizeObserver, [{
|
|
27
|
+
key: "observe",
|
|
28
|
+
value: function observe() {
|
|
29
|
+
this.cb([{
|
|
30
|
+
borderBoxSize: {
|
|
31
|
+
inlineSize: 0,
|
|
32
|
+
blockSize: 0
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "unobserve",
|
|
38
|
+
value: function unobserve() {}
|
|
39
|
+
}]);
|
|
40
|
+
return ResizeObserver;
|
|
41
|
+
}();
|
|
42
|
+
|
|
43
|
+
global.DOMRect = {
|
|
44
|
+
fromRect: function fromRect() {
|
|
45
|
+
return {
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
right: 0,
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
13
55
|
describe("Paginator component tests", function () {
|
|
14
56
|
test("Paginator renders with default values", function () {
|
|
15
57
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Paginator["default"], null)),
|
|
@@ -35,7 +77,7 @@ describe("Paginator component tests", function () {
|
|
|
35
77
|
})),
|
|
36
78
|
getByText = _render3.getByText;
|
|
37
79
|
|
|
38
|
-
expect(getByText("Items per page")).toBeTruthy();
|
|
80
|
+
expect(getByText("Items per page:")).toBeTruthy();
|
|
39
81
|
});
|
|
40
82
|
test("Paginator renders with itemsPerPageOptions", function () {
|
|
41
83
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Paginator["default"], {
|