@dxc-technology/halstack-react 9.0.0 → 9.1.0
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/BackgroundColorContext.d.ts +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1332 -5
- package/HalstackContext.js +59 -67
- package/accordion/Accordion.js +6 -11
- package/accordion/Accordion.stories.tsx +1 -1
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +3 -3
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.test.js +1 -1
- package/accordion-group/types.d.ts +2 -2
- package/alert/Alert.js +3 -5
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.js +2 -2
- package/box/Box.test.js +1 -1
- package/button/Button.js +2 -3
- package/button/Button.stories.tsx +1 -1
- package/button/Button.test.js +1 -1
- package/button/types.d.ts +3 -3
- package/card/Card.js +12 -13
- package/card/Card.stories.tsx +12 -13
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.js +3 -3
- package/checkbox/Checkbox.test.js +1 -1
- package/checkbox/types.d.ts +2 -2
- package/chip/Chip.js +2 -4
- package/chip/Chip.test.js +3 -5
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1625 -0
- package/common/variables.js +2 -2
- package/dialog/Dialog.js +1 -1
- package/dialog/Dialog.test.js +24 -24
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.js +2 -2
- package/dropdown/Dropdown.test.js +3 -2
- package/dropdown/DropdownMenuItem.js +0 -2
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.js +1 -2
- package/file-input/FileInput.test.js +1 -1
- package/flex/Flex.stories.tsx +19 -24
- package/footer/Footer.js +6 -8
- package/footer/Footer.test.js +14 -26
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.d.ts +3 -2
- package/header/Header.js +3 -3
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/inset/Inset.stories.tsx +1 -0
- package/layout/ApplicationLayout.d.ts +3 -3
- package/layout/ApplicationLayout.js +1 -1
- package/layout/types.d.ts +2 -3
- package/link/Link.js +2 -2
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- package/main.d.ts +2 -1
- package/main.js +8 -0
- package/nav-tabs/NavTabs.test.js +1 -1
- package/nav-tabs/Tab.js +7 -7
- package/number-input/NumberInput.test.js +1 -1
- package/package.json +2 -2
- package/paginator/Paginator.js +1 -3
- package/paginator/Paginator.test.js +27 -37
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/PasswordInput.test.js +1 -1
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/radio-group/RadioGroup.test.js +1 -1
- package/resultsetTable/ResultsetTable.js +2 -2
- package/resultsetTable/ResultsetTable.test.js +1 -1
- package/resultsetTable/types.d.ts +3 -3
- package/select/Select.js +13 -11
- package/select/Select.test.js +59 -59
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +50 -76
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/types.d.ts +21 -18
- package/slider/Slider.js +2 -3
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +2 -2
- package/spinner/Spinner.js +15 -21
- package/spinner/Spinner.stories.jsx +28 -28
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.js +2 -2
- package/switch/Switch.test.js +1 -1
- package/switch/types.d.ts +2 -2
- package/table/Table.js +2 -2
- package/table/Table.test.js +1 -1
- package/tabs/Tab.js +9 -10
- package/tabs/Tabs.js +11 -17
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.test.js +1 -1
- package/text-input/Suggestion.js +2 -2
- package/text-input/TextInput.js +3 -3
- package/text-input/TextInput.test.js +1 -2
- package/textarea/Textarea.js +3 -4
- package/textarea/Textarea.test.js +2 -4
- package/toggle-group/ToggleGroup.js +7 -4
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.js +1 -1
- package/wizard/Wizard.js +2 -2
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
package/common/variables.js
CHANGED
|
@@ -663,8 +663,8 @@ var componentTokens = {
|
|
|
663
663
|
focusColor: globalTokens.hal_blue_l_50
|
|
664
664
|
},
|
|
665
665
|
navTabs: {
|
|
666
|
-
selectedBackgroundColor: globalTokens.
|
|
667
|
-
unselectedBackgroundColor: globalTokens.
|
|
666
|
+
selectedBackgroundColor: globalTokens.hal_white,
|
|
667
|
+
unselectedBackgroundColor: globalTokens.hal_white,
|
|
668
668
|
hoverBackgroundColor: globalTokens.hal_grey_l_95,
|
|
669
669
|
pressedBackgroundColor: globalTokens.hal_grey_l_90,
|
|
670
670
|
selectedFontColor: globalTokens.hal_grey_s_40,
|
package/dialog/Dialog.js
CHANGED
|
@@ -17,7 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
|
-
var _variables = require("../common/variables
|
|
20
|
+
var _variables = require("../common/variables");
|
|
21
21
|
|
|
22
22
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
23
|
|
package/dialog/Dialog.test.js
CHANGED
|
@@ -8,28 +8,41 @@ var _react2 = require("@testing-library/react");
|
|
|
8
8
|
|
|
9
9
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
10
10
|
|
|
11
|
-
var _Dialog = _interopRequireDefault(require("./Dialog"));
|
|
11
|
+
var _Dialog = _interopRequireDefault(require("./Dialog.tsx"));
|
|
12
12
|
|
|
13
|
-
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
13
|
+
var _TextInput = _interopRequireDefault(require("../text-input/TextInput.tsx"));
|
|
14
14
|
|
|
15
|
-
var _Textarea = _interopRequireDefault(require("../textarea/Textarea"));
|
|
15
|
+
var _Textarea = _interopRequireDefault(require("../textarea/Textarea.tsx"));
|
|
16
16
|
|
|
17
|
-
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
|
|
17
|
+
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox.tsx"));
|
|
18
18
|
|
|
19
|
-
var _Select = _interopRequireDefault(require("../select/Select"));
|
|
19
|
+
var _Select = _interopRequireDefault(require("../select/Select.tsx"));
|
|
20
20
|
|
|
21
|
-
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
21
|
+
var _Button = _interopRequireDefault(require("../button/Button.tsx"));
|
|
22
22
|
|
|
23
|
-
var _Link = _interopRequireDefault(require("../link/Link"));
|
|
23
|
+
var _Link = _interopRequireDefault(require("../link/Link.tsx"));
|
|
24
24
|
|
|
25
|
-
var _Card = _interopRequireDefault(require("../card/Card"));
|
|
25
|
+
var _Card = _interopRequireDefault(require("../card/Card.tsx"));
|
|
26
26
|
|
|
27
|
-
var _RadioGroup = _interopRequireDefault(require("../radio-group/RadioGroup"));
|
|
27
|
+
var _RadioGroup = _interopRequireDefault(require("../radio-group/RadioGroup.tsx"));
|
|
28
28
|
|
|
29
|
-
var _Slider = _interopRequireDefault(require("../slider/Slider"));
|
|
29
|
+
var _Slider = _interopRequireDefault(require("../slider/Slider.tsx"));
|
|
30
30
|
|
|
31
|
-
var _Switch = _interopRequireDefault(require("../switch/Switch"));
|
|
31
|
+
var _Switch = _interopRequireDefault(require("../switch/Switch.tsx"));
|
|
32
32
|
|
|
33
|
+
var options = [{
|
|
34
|
+
label: "Female",
|
|
35
|
+
value: "female"
|
|
36
|
+
}, {
|
|
37
|
+
label: "Male",
|
|
38
|
+
value: "male"
|
|
39
|
+
}, {
|
|
40
|
+
label: "Non-binary",
|
|
41
|
+
value: "non-binary"
|
|
42
|
+
}, {
|
|
43
|
+
label: "Other",
|
|
44
|
+
value: "other"
|
|
45
|
+
}];
|
|
33
46
|
describe("Dialog component tests", function () {
|
|
34
47
|
test("Dialog renders with correct text and accesibility attributes", function () {
|
|
35
48
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, "dialog-text")),
|
|
@@ -90,19 +103,6 @@ describe("Dialog component tests", function () {
|
|
|
90
103
|
expect(onCloseClick).toHaveBeenCalled();
|
|
91
104
|
});
|
|
92
105
|
});
|
|
93
|
-
var options = [{
|
|
94
|
-
label: "Female",
|
|
95
|
-
value: "female"
|
|
96
|
-
}, {
|
|
97
|
-
label: "Male",
|
|
98
|
-
value: "male"
|
|
99
|
-
}, {
|
|
100
|
-
label: "Non-binary",
|
|
101
|
-
value: "non-binary"
|
|
102
|
-
}, {
|
|
103
|
-
label: "Other",
|
|
104
|
-
value: "other"
|
|
105
|
-
}];
|
|
106
106
|
describe("Dialog component: Focus lock tests", function () {
|
|
107
107
|
test("Close action: when there's no focusable content, the focus never leaves the close action (unless you click outside)", function () {
|
|
108
108
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, "example-dialog")),
|
package/dialog/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Padding = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
package/dropdown/Dropdown.js
CHANGED
|
@@ -19,9 +19,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _variables = require("../common/variables
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
|
-
var _utils = require("../common/utils
|
|
24
|
+
var _utils = require("../common/utils");
|
|
25
25
|
|
|
26
26
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
27
|
|
|
@@ -10,10 +10,11 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
|
|
11
11
|
var _react2 = require("@testing-library/react");
|
|
12
12
|
|
|
13
|
-
var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
|
14
|
-
|
|
15
13
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
16
14
|
|
|
15
|
+
var _Dropdown = _interopRequireDefault(require("./Dropdown.tsx"));
|
|
16
|
+
|
|
17
|
+
// Mocking DOMRect for Radix Primitive Popover
|
|
17
18
|
global.globalThis = global;
|
|
18
19
|
global.DOMRect = {
|
|
19
20
|
fromRect: function fromRect() {
|
|
@@ -30,8 +30,6 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
|
|
|
30
30
|
role: "menuitem",
|
|
31
31
|
tabIndex: -1
|
|
32
32
|
}, iconPosition === "after" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label), option.icon && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemIcon, {
|
|
33
|
-
iconPosition: iconPosition,
|
|
34
|
-
label: option.label,
|
|
35
33
|
role: typeof option.icon === "string" ? undefined : "img"
|
|
36
34
|
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
37
35
|
src: option.icon
|
package/dropdown/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
declare type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
10
10
|
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
11
11
|
export declare type Option = {
|
|
12
12
|
/**
|
package/file-input/FileInput.js
CHANGED
|
@@ -29,7 +29,7 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
29
29
|
|
|
30
30
|
var _uuid = require("uuid");
|
|
31
31
|
|
|
32
|
-
var _variables = require("../common/variables
|
|
32
|
+
var _variables = require("../common/variables");
|
|
33
33
|
|
|
34
34
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
35
35
|
|
|
@@ -371,7 +371,6 @@ var DxcFileInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
371
371
|
theme: colorsTheme.fileInput
|
|
372
372
|
}, /*#__PURE__*/_react["default"].createElement(FileInputContainer, {
|
|
373
373
|
margin: margin,
|
|
374
|
-
name: name,
|
|
375
374
|
ref: ref
|
|
376
375
|
}, /*#__PURE__*/_react["default"].createElement(Label, {
|
|
377
376
|
htmlFor: fileInputId,
|
|
@@ -12,7 +12,7 @@ var _react2 = require("@testing-library/react");
|
|
|
12
12
|
|
|
13
13
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
14
14
|
|
|
15
|
-
var _FileInput = _interopRequireDefault(require("./FileInput"));
|
|
15
|
+
var _FileInput = _interopRequireDefault(require("./FileInput.tsx"));
|
|
16
16
|
|
|
17
17
|
var file1 = new File(["file1"], "file1.png", {
|
|
18
18
|
type: "image/png"
|
package/flex/Flex.stories.tsx
CHANGED
|
@@ -14,19 +14,19 @@ export const Chromatic = () => (
|
|
|
14
14
|
<Container>
|
|
15
15
|
<DxcFlex>
|
|
16
16
|
<Placeholder />
|
|
17
|
-
<Placeholder
|
|
17
|
+
<Placeholder minWidth="50px" />
|
|
18
18
|
<Placeholder />
|
|
19
|
-
<Placeholder
|
|
20
|
-
<Placeholder
|
|
19
|
+
<Placeholder minWidth="50px" />
|
|
20
|
+
<Placeholder minWidth="50px" />
|
|
21
21
|
</DxcFlex>
|
|
22
22
|
</Container>
|
|
23
23
|
<Title title="Direction column, wrap, justify content end, align items center and gap" level={4} />
|
|
24
24
|
<Container>
|
|
25
25
|
<DxcFlex direction="column" wrap="wrap" justifyContent="end" alignItems="center" gap="20px">
|
|
26
26
|
<Placeholder />
|
|
27
|
-
<Placeholder
|
|
27
|
+
<Placeholder minWidth="100px" />
|
|
28
28
|
<Placeholder />
|
|
29
|
-
<Placeholder
|
|
29
|
+
<Placeholder minWidth="100px" />
|
|
30
30
|
<Placeholder />
|
|
31
31
|
</DxcFlex>
|
|
32
32
|
</Container>
|
|
@@ -37,13 +37,13 @@ export const Chromatic = () => (
|
|
|
37
37
|
<Placeholder />
|
|
38
38
|
<Placeholder />
|
|
39
39
|
<Placeholder />
|
|
40
|
-
<Placeholder
|
|
40
|
+
<Placeholder minWidth="100px" />
|
|
41
41
|
<Placeholder />
|
|
42
42
|
<Placeholder />
|
|
43
|
-
<Placeholder
|
|
43
|
+
<Placeholder minWidth="100px" />
|
|
44
44
|
<Placeholder />
|
|
45
45
|
<Placeholder />
|
|
46
|
-
<Placeholder
|
|
46
|
+
<Placeholder minWidth="100px" />
|
|
47
47
|
<Placeholder />
|
|
48
48
|
</DxcFlex>
|
|
49
49
|
</Container>
|
|
@@ -51,16 +51,16 @@ export const Chromatic = () => (
|
|
|
51
51
|
<Container height="75px">
|
|
52
52
|
<DxcFlex basis="100%">
|
|
53
53
|
<DxcFlex order={3} grow={1} alignSelf="flex-end">
|
|
54
|
-
<
|
|
54
|
+
<Placeholder width="100%" minWidth="0">order 3, grow 1, align self end</Placeholder>
|
|
55
55
|
</DxcFlex>
|
|
56
56
|
<DxcFlex order={-1} grow={4}>
|
|
57
|
-
<
|
|
57
|
+
<Placeholder width="100%" minWidth="0">order -1, grow 4</Placeholder>
|
|
58
58
|
</DxcFlex>
|
|
59
59
|
<DxcFlex order={5} grow={1}>
|
|
60
|
-
<
|
|
60
|
+
<Placeholder width="100%" minWidth="0">order 5, grow 1</Placeholder>
|
|
61
61
|
</DxcFlex>
|
|
62
62
|
<DxcFlex order={2} grow={2}>
|
|
63
|
-
<
|
|
63
|
+
<Placeholder width="100%" minWidth="0">order 2. grow 2</Placeholder>
|
|
64
64
|
</DxcFlex>
|
|
65
65
|
</DxcFlex>
|
|
66
66
|
</Container>
|
|
@@ -68,13 +68,13 @@ export const Chromatic = () => (
|
|
|
68
68
|
<Container>
|
|
69
69
|
<DxcFlex basis="600px">
|
|
70
70
|
<DxcFlex shrink={4} basis="400px">
|
|
71
|
-
<
|
|
71
|
+
<Placeholder width="100%" minWidth="0">shrink 4</Placeholder>
|
|
72
72
|
</DxcFlex>
|
|
73
73
|
<DxcFlex shrink={2} basis="400px">
|
|
74
|
-
<
|
|
74
|
+
<Placeholder width="100%" minWidth="0">shrink 2</Placeholder>
|
|
75
75
|
</DxcFlex>
|
|
76
76
|
<DxcFlex shrink={1} basis="400px">
|
|
77
|
-
<
|
|
77
|
+
<Placeholder width="100%" minWidth="0">shrink 1</Placeholder>
|
|
78
78
|
</DxcFlex>
|
|
79
79
|
</DxcFlex>
|
|
80
80
|
</Container>
|
|
@@ -88,16 +88,11 @@ const Container = styled.div<{ height?: string }>`
|
|
|
88
88
|
${({ height }) => (height ? `height: ${height}` : "max-height: 150px")};
|
|
89
89
|
`;
|
|
90
90
|
|
|
91
|
-
const Placeholder = styled.div<{ width?: string }>`
|
|
91
|
+
const Placeholder = styled.div<{ minWidth?: string, width?: string }>`
|
|
92
92
|
height: 40px;
|
|
93
|
-
min-width: ${({
|
|
94
|
-
|
|
95
|
-
background-color: #e5d5f6;
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
const PlaceholderGrowAndShrink = styled.div`
|
|
99
|
-
height: 40px;
|
|
100
|
-
width: 100%;
|
|
93
|
+
min-width: ${({ minWidth }) => minWidth ?? "200px"};
|
|
94
|
+
width: ${({ width }) => width};
|
|
101
95
|
border: 1px solid #a46ede;
|
|
96
|
+
border-radius: 0.5rem;
|
|
102
97
|
background-color: #e5d5f6;
|
|
103
98
|
`;
|
package/footer/Footer.js
CHANGED
|
@@ -17,7 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
20
|
-
var _variables = require("../common/variables
|
|
20
|
+
var _variables = require("../common/variables");
|
|
21
21
|
|
|
22
22
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
23
|
|
|
@@ -74,9 +74,7 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
74
74
|
}, /*#__PURE__*/_react["default"].createElement(BottomLink, {
|
|
75
75
|
tabIndex: tabIndex,
|
|
76
76
|
href: link && link.href ? link.href : ""
|
|
77
|
-
}, link && link.text ? link.text : ""), /*#__PURE__*/_react["default"].createElement(Point,
|
|
78
|
-
index: index
|
|
79
|
-
}, "\xB7"));
|
|
77
|
+
}, link && link.text ? link.text : ""), /*#__PURE__*/_react["default"].createElement(Point, null, "\xB7"));
|
|
80
78
|
});
|
|
81
79
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
82
80
|
theme: colorsTheme.footer
|
|
@@ -91,7 +89,7 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
91
89
|
}, /*#__PURE__*/_react["default"].createElement(BottomLinks, null, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, null, copyright || translatedLabels.footer.copyrightText(new Date().getFullYear()))))));
|
|
92
90
|
};
|
|
93
91
|
|
|
94
|
-
var FooterContainer = _styledComponents["default"].footer(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n @media (min-width: ", "rem) {\n padding: 24px 36px 24px 36px;\n }\n\n @media (max-width: ", "rem) {\n
|
|
92
|
+
var FooterContainer = _styledComponents["default"].footer(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n @media (min-width: ", "rem) {\n padding: 24px 36px 24px 36px;\n }\n\n @media (max-width: ", "rem) {\n padding: 20px;\n }\n\n background-color: ", ";\n margin-top: ", ";\n width: 100%;\n box-sizing: border-box;\n min-height: ", ";\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n"])), _variables.responsiveSizes.small, _variables.responsiveSizes.small, function (props) {
|
|
95
93
|
return props.theme.backgroundColor;
|
|
96
94
|
}, function (props) {
|
|
97
95
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -101,11 +99,11 @@ var FooterContainer = _styledComponents["default"].footer(_templateObject || (_t
|
|
|
101
99
|
|
|
102
100
|
var FooterHeader = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n row-gap: 24px;\n"])));
|
|
103
101
|
|
|
104
|
-
var FooterFooter = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n\n @media (min-width: ", "rem) {\n flex-direction: row;\n }\n\n @media (max-width: ", "rem) {\n
|
|
102
|
+
var FooterFooter = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n\n @media (min-width: ", "rem) {\n flex-direction: row;\n }\n\n @media (max-width: ", "rem) {\n flex-direction: column;\n align-items: center;\n }\n\n border-top: ", ";\n margin-top: 16px;\n"])), _variables.responsiveSizes.small, _variables.responsiveSizes.small, function (props) {
|
|
105
103
|
return "".concat(props.theme.bottomLinksDividerThickness, " ").concat(props.theme.bottomLinksDividerStyle, " ").concat(props.theme.bottomLinksDividerColor);
|
|
106
104
|
});
|
|
107
105
|
|
|
108
|
-
var BottomLinks = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n display: inline-flex;\n flex-wrap: wrap;\n\n @media (min-width: ", "rem) {\n max-width: 60%;\n }\n\n @media (max-width: ", "rem) {\n
|
|
106
|
+
var BottomLinks = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n display: inline-flex;\n flex-wrap: wrap;\n\n @media (min-width: ", "rem) {\n max-width: 60%;\n }\n\n @media (max-width: ", "rem) {\n max-width: 100%;\n width: 100%;\n }\n\n & > span:last-child span {\n display: none;\n }\n align-self: center;\n"])), function (props) {
|
|
109
107
|
return props.theme.bottomLinksDividerSpacing;
|
|
110
108
|
}, _variables.responsiveSizes.small, _variables.responsiveSizes.small);
|
|
111
109
|
|
|
@@ -121,7 +119,7 @@ var ChildComponents = _styledComponents["default"].div(_templateObject5 || (_tem
|
|
|
121
119
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
122
120
|
});
|
|
123
121
|
|
|
124
|
-
var Copyright = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n\n @media (min-width: ", "rem) {\n max-width: 40%;\n text-align: right;\n }\n\n @media (max-width: ", "rem) {\n
|
|
122
|
+
var Copyright = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n\n @media (min-width: ", "rem) {\n max-width: 40%;\n text-align: right;\n }\n\n @media (max-width: ", "rem) {\n max-width: 100%;\n width: 100%;\n text-align: left;\n }\n\n padding-top: ", ";\n"])), function (props) {
|
|
125
123
|
return props.theme.copyrightFontFamily;
|
|
126
124
|
}, function (props) {
|
|
127
125
|
return props.theme.copyrightFontSize;
|
package/footer/Footer.test.js
CHANGED
|
@@ -6,10 +6,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
9
|
+
var _Footer = _interopRequireDefault(require("./Footer.tsx"));
|
|
10
|
+
|
|
11
|
+
var social = [{
|
|
12
|
+
href: "https://www.test.com/social",
|
|
13
|
+
logo: "https://developer.apple.com/design/human-interface-guidelines/foundations/app-icons/images/icon-and-image-large-icon-settings_2x.png"
|
|
14
|
+
}];
|
|
15
|
+
var bottom = [{
|
|
16
|
+
href: "https://www.test.com/bottom",
|
|
17
|
+
text: "bottom-link-text"
|
|
18
|
+
}];
|
|
13
19
|
describe("Footer component tests", function () {
|
|
14
20
|
test("Footer renders with default logo", function () {
|
|
15
21
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], null)),
|
|
@@ -18,32 +24,22 @@ describe("Footer component tests", function () {
|
|
|
18
24
|
expect(getByTitle("DXC Logo")).toBeTruthy();
|
|
19
25
|
});
|
|
20
26
|
test("Footer renders with social links", function () {
|
|
21
|
-
var social = [{
|
|
22
|
-
href: "https://www.test.com/test",
|
|
23
|
-
logo: _linkedin["default"]
|
|
24
|
-
}];
|
|
25
|
-
|
|
26
27
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
27
28
|
socialLinks: social
|
|
28
29
|
})),
|
|
29
30
|
getByRole = _render2.getByRole;
|
|
30
31
|
|
|
31
32
|
var socialIcon = getByRole("link");
|
|
32
|
-
expect(socialIcon.getAttribute("href")).toBe("https://www.test.com/
|
|
33
|
+
expect(socialIcon.getAttribute("href")).toBe("https://www.test.com/social");
|
|
33
34
|
});
|
|
34
35
|
test("Footer renders with bottom links", function () {
|
|
35
|
-
var bottom = [{
|
|
36
|
-
href: "https://www.test.com/test",
|
|
37
|
-
text: "bottom-link-text"
|
|
38
|
-
}];
|
|
39
|
-
|
|
40
36
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
41
37
|
bottomLinks: bottom
|
|
42
38
|
})),
|
|
43
39
|
getByText = _render3.getByText;
|
|
44
40
|
|
|
45
41
|
var link = getByText("bottom-link-text");
|
|
46
|
-
expect(link.getAttribute("href")).toBe("https://www.test.com/
|
|
42
|
+
expect(link.getAttribute("href")).toBe("https://www.test.com/bottom");
|
|
47
43
|
});
|
|
48
44
|
test("Footer renders with copyright text", function () {
|
|
49
45
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
@@ -54,7 +50,7 @@ describe("Footer component tests", function () {
|
|
|
54
50
|
expect(getByText("test-copyright")).toBeTruthy();
|
|
55
51
|
});
|
|
56
52
|
test("Footer renders with correct children", function () {
|
|
57
|
-
//We need to force the offsetWidth value
|
|
53
|
+
// We need to force the offsetWidth value
|
|
58
54
|
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
59
55
|
configurable: true,
|
|
60
56
|
value: 1024
|
|
@@ -66,7 +62,7 @@ describe("Footer component tests", function () {
|
|
|
66
62
|
expect(getByText("footer-child-text")).toBeTruthy();
|
|
67
63
|
});
|
|
68
64
|
test("Footer renders with children in mobile", function () {
|
|
69
|
-
//425 is mobile width
|
|
65
|
+
// 425 is mobile width
|
|
70
66
|
Object.defineProperty(HTMLElement.prototype, "offsetWidth", {
|
|
71
67
|
configurable: true,
|
|
72
68
|
value: 425
|
|
@@ -82,14 +78,6 @@ describe("Footer component tests", function () {
|
|
|
82
78
|
configurable: true,
|
|
83
79
|
value: 1024
|
|
84
80
|
});
|
|
85
|
-
var social = [{
|
|
86
|
-
href: "https://www.test.com/social",
|
|
87
|
-
logo: _linkedin["default"]
|
|
88
|
-
}];
|
|
89
|
-
var bottom = [{
|
|
90
|
-
href: "https://www.test.com/bottom",
|
|
91
|
-
text: "bottom-link-text"
|
|
92
|
-
}];
|
|
93
81
|
|
|
94
82
|
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Footer["default"], {
|
|
95
83
|
socialLinks: social,
|
package/grid/Grid.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import GridPropsType, { GridItemProps } from "./types";
|
|
3
|
+
declare const DxcGrid: {
|
|
4
|
+
(props: GridPropsType): JSX.Element;
|
|
5
|
+
GridItem: import("styled-components").StyledComponent<"div", any, GridItemProps, never>;
|
|
6
|
+
};
|
|
7
|
+
export default DxcGrid;
|
package/grid/Grid.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _templateObject, _templateObject2;
|
|
17
|
+
|
|
18
|
+
var DxcGrid = function DxcGrid(props) {
|
|
19
|
+
return /*#__PURE__*/_react["default"].createElement(Grid, props);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var Grid = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: grid;\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n ", "\n \n ", "\n ", "\n ", "\n ", "\n"])), function (_ref) {
|
|
23
|
+
var templateColumns = _ref.templateColumns;
|
|
24
|
+
return templateColumns && "grid-template-columns: ".concat(templateColumns.join(" "), ";");
|
|
25
|
+
}, function (_ref2) {
|
|
26
|
+
var templateRows = _ref2.templateRows;
|
|
27
|
+
return templateRows && "grid-template-rows: ".concat(templateRows.join(" "), ";");
|
|
28
|
+
}, function (_ref3) {
|
|
29
|
+
var templateAreas = _ref3.templateAreas;
|
|
30
|
+
return templateAreas && "grid-template-areas: ".concat(templateAreas.map(function (row) {
|
|
31
|
+
return "\"".concat(row, "\"");
|
|
32
|
+
}).join(" "), ";");
|
|
33
|
+
}, function (_ref4) {
|
|
34
|
+
var autoColumns = _ref4.autoColumns;
|
|
35
|
+
return autoColumns && "grid-auto-columns: ".concat(autoColumns, ";");
|
|
36
|
+
}, function (_ref5) {
|
|
37
|
+
var autoRows = _ref5.autoRows;
|
|
38
|
+
return autoRows && "grid-auto-rows: ".concat(autoRows, ";");
|
|
39
|
+
}, function (_ref6) {
|
|
40
|
+
var autoFlow = _ref6.autoFlow;
|
|
41
|
+
return autoFlow && "grid-auto-flow: ".concat(autoFlow, ";");
|
|
42
|
+
}, function (_ref7) {
|
|
43
|
+
var _gap$rowGap, _gap$columnGap;
|
|
44
|
+
|
|
45
|
+
var gap = _ref7.gap;
|
|
46
|
+
return gap != null && (typeof gap === "string" ? "gap: ".concat(gap, ";") : "row-gap: ".concat((_gap$rowGap = gap.rowGap) !== null && _gap$rowGap !== void 0 ? _gap$rowGap : "", "; column-gap: ").concat((_gap$columnGap = gap.columnGap) !== null && _gap$columnGap !== void 0 ? _gap$columnGap : "", ";"));
|
|
47
|
+
}, function (_ref8) {
|
|
48
|
+
var _placeItems$alignItem, _placeItems$justifyIt;
|
|
49
|
+
|
|
50
|
+
var placeItems = _ref8.placeItems;
|
|
51
|
+
return placeItems && (typeof placeItems === "string" ? "place-items: ".concat(placeItems) : "align-items: ".concat((_placeItems$alignItem = placeItems.alignItems) !== null && _placeItems$alignItem !== void 0 ? _placeItems$alignItem : "", "; justify-items: ").concat((_placeItems$justifyIt = placeItems.justifyItems) !== null && _placeItems$justifyIt !== void 0 ? _placeItems$justifyIt : "", ";"));
|
|
52
|
+
}, function (_ref9) {
|
|
53
|
+
var _placeContent$alignCo, _placeContent$justify;
|
|
54
|
+
|
|
55
|
+
var placeContent = _ref9.placeContent;
|
|
56
|
+
return placeContent && (typeof placeContent === "string" ? "place-content: ".concat(placeContent) : "align-content: ".concat((_placeContent$alignCo = placeContent.alignContent) !== null && _placeContent$alignCo !== void 0 ? _placeContent$alignCo : "", "; justify-content: ").concat((_placeContent$justify = placeContent.justifyContent) !== null && _placeContent$justify !== void 0 ? _placeContent$justify : "", ";"));
|
|
57
|
+
}, function (_ref10) {
|
|
58
|
+
var areaName = _ref10.areaName;
|
|
59
|
+
return areaName && "grid-area: ".concat(areaName, ";");
|
|
60
|
+
}, function (_ref11) {
|
|
61
|
+
var column = _ref11.column;
|
|
62
|
+
return column && "grid-column: ".concat(typeof column === "string" || typeof column === "number" ? column : "".concat(column.start, " / ").concat(column.end, ";"), ";");
|
|
63
|
+
}, function (_ref12) {
|
|
64
|
+
var row = _ref12.row;
|
|
65
|
+
return row && "grid-row: ".concat(typeof row === "string" || typeof row === "number" ? row : "".concat(row.start, " / ").concat(row.end, ";"), ";");
|
|
66
|
+
}, function (_ref13) {
|
|
67
|
+
var _placeSelf$alignSelf, _placeSelf$justifySel;
|
|
68
|
+
|
|
69
|
+
var placeSelf = _ref13.placeSelf;
|
|
70
|
+
return placeSelf && (typeof placeSelf === "string" ? "place-self: ".concat(placeSelf) : "align-self: ".concat((_placeSelf$alignSelf = placeSelf.alignSelf) !== null && _placeSelf$alignSelf !== void 0 ? _placeSelf$alignSelf : "", "; justify-self: ").concat((_placeSelf$justifySel = placeSelf.justifySelf) !== null && _placeSelf$justifySel !== void 0 ? _placeSelf$justifySel : "", ";"));
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
var GridItem = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n ", "\n ", "\n ", "\n"])), function (_ref14) {
|
|
74
|
+
var areaName = _ref14.areaName;
|
|
75
|
+
return areaName && "grid-area: ".concat(areaName, ";");
|
|
76
|
+
}, function (_ref15) {
|
|
77
|
+
var column = _ref15.column;
|
|
78
|
+
return column && "grid-column: ".concat(typeof column === "string" || typeof column === "number" ? column : "".concat(column.start, " / ").concat(column.end, ";"), ";");
|
|
79
|
+
}, function (_ref16) {
|
|
80
|
+
var row = _ref16.row;
|
|
81
|
+
return row && "grid-row: ".concat(typeof row === "string" || typeof row === "number" ? row : "".concat(row.start, " / ").concat(row.end, ";"), ";");
|
|
82
|
+
}, function (_ref17) {
|
|
83
|
+
var _placeSelf$alignSelf2, _placeSelf$justifySel2;
|
|
84
|
+
|
|
85
|
+
var placeSelf = _ref17.placeSelf;
|
|
86
|
+
return placeSelf && (typeof placeSelf === "string" ? "place-self: ".concat(placeSelf) : "align-self: ".concat((_placeSelf$alignSelf2 = placeSelf.alignSelf) !== null && _placeSelf$alignSelf2 !== void 0 ? _placeSelf$alignSelf2 : "", "; justify-self: ").concat((_placeSelf$justifySel2 = placeSelf.justifySelf) !== null && _placeSelf$justifySel2 !== void 0 ? _placeSelf$justifySel2 : "", ";"));
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
DxcGrid.GridItem = GridItem;
|
|
90
|
+
var _default = DxcGrid;
|
|
91
|
+
exports["default"] = _default;
|