@dxc-technology/halstack-react 0.0.0-7da4f49 → 0.0.0-7e6bf6c
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 +1 -4
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/box/Box.js +22 -32
- package/common/variables.js +4 -18
- package/layout/ApplicationLayout.d.ts +4 -3
- package/layout/ApplicationLayout.js +83 -102
- package/layout/ApplicationLayout.stories.tsx +14 -59
- 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 +5 -10
- package/link/Link.js +15 -10
- package/main.d.ts +2 -2
- package/main.js +8 -8
- package/package.json +1 -1
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +20 -9
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/{radio → tabs-nav}/types.js +0 -0
- 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/radio/Radio.test.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
|
-
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
|
-
var _Radio = _interopRequireDefault(require("./Radio"));
|
|
10
|
-
|
|
11
|
-
describe("Radio component tests", function () {
|
|
12
|
-
test("Radio renders correctly", function () {
|
|
13
|
-
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
14
|
-
label: "Radio button"
|
|
15
|
-
})),
|
|
16
|
-
getByText = _render.getByText;
|
|
17
|
-
|
|
18
|
-
expect(getByText("Radio button")).toBeTruthy();
|
|
19
|
-
});
|
|
20
|
-
test("Calls correct function on click", function () {
|
|
21
|
-
var onClick = jest.fn();
|
|
22
|
-
|
|
23
|
-
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
24
|
-
label: "Radio button",
|
|
25
|
-
onClick: onClick
|
|
26
|
-
})),
|
|
27
|
-
getByText = _render2.getByText;
|
|
28
|
-
|
|
29
|
-
_react2.fireEvent.click(getByText("Radio button"));
|
|
30
|
-
|
|
31
|
-
expect(onClick).toHaveBeenCalled();
|
|
32
|
-
expect(onClick).toHaveBeenCalledWith(true);
|
|
33
|
-
});
|
|
34
|
-
test("Controlled Radio", function () {
|
|
35
|
-
var onClick = jest.fn();
|
|
36
|
-
|
|
37
|
-
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
38
|
-
label: "Radio button",
|
|
39
|
-
checked: false,
|
|
40
|
-
onClick: onClick
|
|
41
|
-
})),
|
|
42
|
-
getByText = _render3.getByText,
|
|
43
|
-
getByRole = _render3.getByRole;
|
|
44
|
-
|
|
45
|
-
expect(getByRole("radio").checked).toBe(false);
|
|
46
|
-
|
|
47
|
-
_react2.fireEvent.click(getByText("Radio button"));
|
|
48
|
-
|
|
49
|
-
expect(onClick).toHaveBeenCalled();
|
|
50
|
-
expect(onClick).toHaveBeenCalledWith(true);
|
|
51
|
-
expect(getByRole("radio").checked).toBe(false);
|
|
52
|
-
});
|
|
53
|
-
test("Uncontrolled Radio", function () {
|
|
54
|
-
var onClick = jest.fn();
|
|
55
|
-
|
|
56
|
-
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
|
|
57
|
-
label: "Radio button",
|
|
58
|
-
onClick: onClick
|
|
59
|
-
})),
|
|
60
|
-
getByText = _render4.getByText,
|
|
61
|
-
getByRole = _render4.getByRole;
|
|
62
|
-
|
|
63
|
-
expect(getByRole("radio").checked).toBe(false);
|
|
64
|
-
|
|
65
|
-
_react2.fireEvent.click(getByText("Radio button"));
|
|
66
|
-
|
|
67
|
-
expect(onClick).toHaveBeenCalled();
|
|
68
|
-
expect(onClick).toHaveBeenCalledWith(true);
|
|
69
|
-
expect(getByRole("radio").checked).toBe(false);
|
|
70
|
-
});
|
|
71
|
-
});
|
package/radio/types.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
declare type Margin = {
|
|
3
|
-
top?: Space;
|
|
4
|
-
bottom?: Space;
|
|
5
|
-
left?: Space;
|
|
6
|
-
right?: Space;
|
|
7
|
-
};
|
|
8
|
-
declare type Props = {
|
|
9
|
-
/**
|
|
10
|
-
* If true, the radio is selected. If undefined the component will be uncontrolled
|
|
11
|
-
* and the value will be managed internally by the component.
|
|
12
|
-
*/
|
|
13
|
-
checked?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Will be passed to the value attribute of the html input element. When inside a
|
|
16
|
-
* form, this value will be only submitted if the radio is checked.
|
|
17
|
-
*/
|
|
18
|
-
value?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Text to be placed next to the radio.
|
|
21
|
-
*/
|
|
22
|
-
label: string;
|
|
23
|
-
/**
|
|
24
|
-
* Whether the label should appear after or before the radio.
|
|
25
|
-
*/
|
|
26
|
-
labelPosition?: "before" | "after";
|
|
27
|
-
/**
|
|
28
|
-
* Name attribute of the input element.
|
|
29
|
-
*/
|
|
30
|
-
name?: string;
|
|
31
|
-
/**
|
|
32
|
-
* If true, the component will be disabled.
|
|
33
|
-
*/
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* If true, the radio will change its appearence, showing that the value is required.
|
|
37
|
-
*/
|
|
38
|
-
required?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* This function will be called when the user clicks the radio. The new value will
|
|
41
|
-
* be passed as a parameter.
|
|
42
|
-
*/
|
|
43
|
-
onClick?: (val: boolean) => void;
|
|
44
|
-
/**
|
|
45
|
-
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
46
|
-
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
47
|
-
*/
|
|
48
|
-
margin?: Space | Margin;
|
|
49
|
-
/**
|
|
50
|
-
* Size of the component.
|
|
51
|
-
*/
|
|
52
|
-
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
53
|
-
};
|
|
54
|
-
export default Props;
|