@dxc-technology/halstack-react 0.0.0-4254e6c → 0.0.0-4299a60
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 +10 -0
- package/BackgroundColorContext.js +1 -3
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +5 -8
- package/V3Select/V3Select.js +2 -2
- package/V3Textarea/V3Textarea.js +2 -2
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +14 -45
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +59 -73
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.js +2 -2
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +1 -1
- package/badge/Badge.js +1 -1
- package/box/Box.d.ts +4 -0
- package/box/Box.js +6 -32
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +9 -12
- package/button/Button.stories.tsx +217 -234
- package/button/types.d.ts +11 -11
- package/card/Card.d.ts +4 -0
- package/card/Card.js +17 -53
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +3 -4
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +1 -23
- package/chip/Chip.stories.tsx +121 -0
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +33 -24
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +1 -1
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +6 -25
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +8 -41
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +30 -51
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +10 -19
- package/file-input/types.d.ts +87 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +6 -37
- package/footer/Footer.stories.jsx +151 -0
- package/footer/types.d.ts +69 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +28 -30
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.js +2 -27
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/input-text/InputText.js +2 -2
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +8 -18
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +4 -26
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/main.d.ts +2 -2
- package/main.js +2 -2
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +2 -44
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +1 -1
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.stories.tsx +63 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +7 -42
- package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
- package/password-input/types.d.ts +107 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +5 -23
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.js +2 -2
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +4 -27
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/select/Select.js +2 -2
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +4 -4
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +6 -15
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +61 -84
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +8 -25
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.js +4 -4
- package/switch/Switch.stories.tsx +160 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +9 -55
- package/tabs/Tabs.stories.tsx +121 -0
- package/tabs/types.d.ts +70 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +21 -36
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +28 -65
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.js +15 -16
- package/textarea/Textarea.stories.jsx +135 -0
- package/textarea/index.d.ts +18 -8
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +6 -32
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/types.d.ts +84 -0
- package/toggle-group/types.js +5 -0
- package/upload/buttons-upload/ButtonsUpload.js +2 -2
- package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
- package/upload/file-upload/FileToUpload.js +1 -1
- package/upload/files-upload/FilesToUpload.js +1 -1
- package/upload/transaction/Transaction.js +2 -2
- package/upload/transactions/Transactions.js +1 -1
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +12 -52
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/accordion/index.d.ts +0 -28
- package/accordion-group/index.d.ts +0 -16
- package/box/index.d.ts +0 -25
- package/card/index.d.ts +0 -22
- package/chip/index.d.ts +0 -22
- package/dialog/index.d.ts +0 -18
- package/dropdown/index.d.ts +0 -26
- package/file-input/index.d.ts +0 -81
- package/footer/index.d.ts +0 -25
- package/header/index.d.ts +0 -25
- package/heading/index.d.ts +0 -17
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- package/progress-bar/index.d.ts +0 -18
- package/resultsetTable/index.d.ts +0 -19
- package/sidenav/index.d.ts +0 -13
- package/slider/index.d.ts +0 -29
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tabs/index.d.ts +0 -19
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/toggle-group/index.d.ts +0 -21
- package/wizard/index.d.ts +0 -18
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcHeader from "./Header";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { userEvent, waitFor, within } from "@storybook/testing-library";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Header",
|
|
9
|
+
component: DxcHeader,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const options: any = [
|
|
13
|
+
{
|
|
14
|
+
value: 1,
|
|
15
|
+
label: "Amazon",
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export const Chromatic = () => (
|
|
20
|
+
<>
|
|
21
|
+
<ExampleContainer>
|
|
22
|
+
<Title title="Default with dropdown" theme="light" level={4} />
|
|
23
|
+
<DxcHeader content={<DxcHeader.Dropdown options={options} label="Default Dropdown" />} />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Underlined with text" theme="light" level={4} />
|
|
27
|
+
<DxcHeader underlined content={<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>} />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
31
|
+
<div style={{ width: "400px" }}>
|
|
32
|
+
<DxcHeader
|
|
33
|
+
responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
|
|
34
|
+
underlined
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
<Title title="Margins" theme="light" level={2} />
|
|
39
|
+
<ExampleContainer>
|
|
40
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
41
|
+
<DxcHeader underlined margin="xxsmall" />
|
|
42
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
43
|
+
</ExampleContainer>
|
|
44
|
+
<ExampleContainer>
|
|
45
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
46
|
+
<DxcHeader underlined margin="xsmall" />
|
|
47
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
51
|
+
<DxcHeader underlined margin="small" />
|
|
52
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer>
|
|
55
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
56
|
+
<DxcHeader underlined margin="medium" />
|
|
57
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
58
|
+
</ExampleContainer>
|
|
59
|
+
<ExampleContainer>
|
|
60
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
61
|
+
<DxcHeader underlined margin="large" />
|
|
62
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
63
|
+
</ExampleContainer>
|
|
64
|
+
<ExampleContainer>
|
|
65
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
66
|
+
<DxcHeader underlined margin="xlarge" />
|
|
67
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
68
|
+
</ExampleContainer>
|
|
69
|
+
<ExampleContainer>
|
|
70
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
71
|
+
<DxcHeader underlined margin="xxlarge" />
|
|
72
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
|
|
75
|
+
<Title title="Paddings" theme="light" level={2} />
|
|
76
|
+
<ExampleContainer>
|
|
77
|
+
<Title title="Xxsmall padding" theme="light" level={4} />
|
|
78
|
+
<DxcHeader underlined padding="xxsmall" />
|
|
79
|
+
</ExampleContainer>
|
|
80
|
+
<ExampleContainer>
|
|
81
|
+
<Title title="Xsmall padding" theme="light" level={4} />
|
|
82
|
+
<DxcHeader underlined padding="xsmall" />
|
|
83
|
+
</ExampleContainer>
|
|
84
|
+
<ExampleContainer>
|
|
85
|
+
<Title title="Small padding" theme="light" level={4} />
|
|
86
|
+
<DxcHeader underlined padding="small" />
|
|
87
|
+
</ExampleContainer>
|
|
88
|
+
<ExampleContainer>
|
|
89
|
+
<Title title="Medium padding" theme="light" level={4} />
|
|
90
|
+
<DxcHeader underlined padding="medium" />
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Large padding" theme="light" level={4} />
|
|
94
|
+
<DxcHeader underlined padding="large" />
|
|
95
|
+
</ExampleContainer>
|
|
96
|
+
<ExampleContainer>
|
|
97
|
+
<Title title="Xlarge padding" theme="light" level={4} />
|
|
98
|
+
<DxcHeader underlined padding="xlarge" />
|
|
99
|
+
</ExampleContainer>
|
|
100
|
+
<ExampleContainer>
|
|
101
|
+
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
102
|
+
<DxcHeader underlined padding="xxlarge" />
|
|
103
|
+
</ExampleContainer>
|
|
104
|
+
</>
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const RespHeader = () => (
|
|
108
|
+
<ExampleContainer>
|
|
109
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
110
|
+
<div style={{ maxWidth: "400px" }}>
|
|
111
|
+
<DxcHeader
|
|
112
|
+
responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
|
|
113
|
+
underlined
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
</ExampleContainer>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const RespHeaderFocus = () => (
|
|
120
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
121
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
122
|
+
<div style={{ maxWidth: "400px" }}>
|
|
123
|
+
<DxcHeader
|
|
124
|
+
responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
|
|
125
|
+
underlined
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
</ExampleContainer>
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const RespHeaderHover = () => (
|
|
132
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
133
|
+
<Title title="Responsive" theme="light" level={4} />
|
|
134
|
+
<div style={{ maxWidth: "400px" }}>
|
|
135
|
+
<DxcHeader
|
|
136
|
+
responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
|
|
137
|
+
underlined
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
</ExampleContainer>
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
export const ResponsiveHeader = RespHeader.bind({});
|
|
144
|
+
ResponsiveHeader.play = async ({ canvasElement }) => {
|
|
145
|
+
const canvas = within(canvasElement);
|
|
146
|
+
await waitFor(() => canvas.findByText("Menu"));
|
|
147
|
+
await userEvent.click(canvas.getByText("Menu"));
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const ResponsiveHeaderFocus = RespHeaderFocus.bind({});
|
|
151
|
+
ResponsiveHeaderFocus.play = async ({ canvasElement }) => {
|
|
152
|
+
const canvas = within(canvasElement);
|
|
153
|
+
await waitFor(() => canvas.findByText("Menu"));
|
|
154
|
+
await userEvent.click(canvas.getByText("Menu"));
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export const ResponsiveHeaderHover = RespHeaderHover.bind({});
|
|
158
|
+
ResponsiveHeaderHover.play = async ({ canvasElement }) => {
|
|
159
|
+
const canvas = within(canvasElement);
|
|
160
|
+
await waitFor(() => canvas.findByText("Menu"));
|
|
161
|
+
await userEvent.click(canvas.getByText("Menu"));
|
|
162
|
+
};
|
package/header/Icons.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.dxcLogo = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
@@ -31,29 +31,4 @@ var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
31
31
|
fill: "#100f0d"
|
|
32
32
|
}))));
|
|
33
33
|
|
|
34
|
-
exports.dxcLogo = dxcLogo;
|
|
35
|
-
|
|
36
|
-
var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
37
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
38
|
-
height: "24",
|
|
39
|
-
viewBox: "0 0 24 24",
|
|
40
|
-
width: "24"
|
|
41
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
42
|
-
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 12z"
|
|
43
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
-
d: "M0 0h24v24H0z",
|
|
45
|
-
fill: "none"
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
exports.closeIcon = closeIcon;
|
|
49
|
-
|
|
50
|
-
var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
51
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
-
viewBox: "0 0 24 24",
|
|
53
|
-
width: "24",
|
|
54
|
-
height: "24"
|
|
55
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
56
|
-
d: "M3,8H21a1,1,0,0,0,0-2H3A1,1,0,0,0,3,8Zm18,8H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Zm0-5H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Z"
|
|
57
|
-
}));
|
|
58
|
-
|
|
59
|
-
exports.hamburgerIcon = hamburgerIcon;
|
|
34
|
+
exports.dxcLogo = dxcLogo;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Padding = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type Props = {
|
|
10
|
+
/**
|
|
11
|
+
* Wether a contrast line should appear at the bottom of the header.
|
|
12
|
+
*/
|
|
13
|
+
underlined?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Content showed in the header. Take into account that the component applies styles
|
|
16
|
+
* for the first child in the content, so we recommend the use of React.Fragment
|
|
17
|
+
* to be applied correctly. Otherwise, the styles can be modified.
|
|
18
|
+
*/
|
|
19
|
+
content?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Content showed in responsive version. It receives the close menu handler that can
|
|
22
|
+
* be used to add that functionality when a element is clicked.
|
|
23
|
+
*/
|
|
24
|
+
responsiveContent?: (closeHandler: () => void) => React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* This function will be called when the user clicks the header logo.
|
|
27
|
+
*/
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Size of the bottom margin to be applied to the header
|
|
31
|
+
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
32
|
+
*/
|
|
33
|
+
margin?: Space;
|
|
34
|
+
/**
|
|
35
|
+
* Size of the padding to be applied to the custom area of the component
|
|
36
|
+
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
37
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
|
|
38
|
+
* order to specify different padding sizes.
|
|
39
|
+
*/
|
|
40
|
+
padding?: Space | Padding;
|
|
41
|
+
/**
|
|
42
|
+
* Value of the tabindex for all interactuable elements, except those inside the
|
|
43
|
+
* custom area.
|
|
44
|
+
*/
|
|
45
|
+
tabIndex?: number;
|
|
46
|
+
};
|
|
47
|
+
export default Props;
|
package/header/types.js
ADDED
package/heading/Heading.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
16
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
@@ -19,11 +17,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
19
17
|
|
|
20
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
19
|
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
20
|
var _variables = require("../common/variables.js");
|
|
25
21
|
|
|
26
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
22
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
27
23
|
|
|
28
24
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
29
25
|
|
|
@@ -37,8 +33,7 @@ var DxcHeading = function DxcHeading(_ref) {
|
|
|
37
33
|
_ref$text = _ref.text,
|
|
38
34
|
text = _ref$text === void 0 ? "" : _ref$text,
|
|
39
35
|
as = _ref.as,
|
|
40
|
-
|
|
41
|
-
weight = _ref$weight === void 0 ? "" : _ref$weight,
|
|
36
|
+
weight = _ref.weight,
|
|
42
37
|
margin = _ref.margin;
|
|
43
38
|
var colorsTheme = (0, _useTheme["default"])();
|
|
44
39
|
|
|
@@ -51,19 +46,19 @@ var DxcHeading = function DxcHeading(_ref) {
|
|
|
51
46
|
}, /*#__PURE__*/_react["default"].createElement(HeadingContainer, {
|
|
52
47
|
margin: margin
|
|
53
48
|
}, level === 1 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel1, {
|
|
54
|
-
as: checkValidAs(
|
|
49
|
+
as: checkValidAs(),
|
|
55
50
|
weight: weight
|
|
56
51
|
}, text) : level === 2 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel2, {
|
|
57
|
-
as: checkValidAs(
|
|
52
|
+
as: checkValidAs(),
|
|
58
53
|
weight: weight
|
|
59
54
|
}, text) : level === 3 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel3, {
|
|
60
|
-
as: checkValidAs(
|
|
55
|
+
as: checkValidAs(),
|
|
61
56
|
weight: weight
|
|
62
57
|
}, text) : level === 4 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel4, {
|
|
63
|
-
as: checkValidAs(
|
|
58
|
+
as: checkValidAs(),
|
|
64
59
|
weight: weight
|
|
65
60
|
}, text) : /*#__PURE__*/_react["default"].createElement(HeadingLevel5, {
|
|
66
|
-
as: checkValidAs(
|
|
61
|
+
as: checkValidAs(),
|
|
67
62
|
weight: weight
|
|
68
63
|
}, text)));
|
|
69
64
|
};
|
|
@@ -160,17 +155,5 @@ var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6 || (_templa
|
|
|
160
155
|
return props.theme.level5FontColor;
|
|
161
156
|
});
|
|
162
157
|
|
|
163
|
-
DxcHeading.propTypes = {
|
|
164
|
-
level: _propTypes["default"].number,
|
|
165
|
-
text: _propTypes["default"].string,
|
|
166
|
-
as: _propTypes["default"].oneOf(["h1", "h2", "h3", "h4", "h5"]),
|
|
167
|
-
weight: _propTypes["default"].oneOf(["light", "normal", "bold", ""]),
|
|
168
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
169
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
170
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
171
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
172
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
173
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
174
|
-
};
|
|
175
158
|
var _default = DxcHeading;
|
|
176
159
|
exports["default"] = _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcHeading from "./Heading";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Heading",
|
|
8
|
+
component: DxcHeading,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Levels" theme="light" level={2} />
|
|
14
|
+
<ExampleContainer>
|
|
15
|
+
<Title title="Level 1" theme="light" level={4} />
|
|
16
|
+
<DxcHeading text="Heading for sections within the page" />
|
|
17
|
+
<Title title="Level 2" theme="light" level={4} />
|
|
18
|
+
<DxcHeading text="Heading for sections within the page" level={2} />
|
|
19
|
+
<Title title="Level 3" theme="light" level={4} />
|
|
20
|
+
<DxcHeading text="Heading for sections within the page" level={3} />
|
|
21
|
+
<Title title="Level 4" theme="light" level={4} />
|
|
22
|
+
<DxcHeading text="Heading for sections within the page" level={4} />
|
|
23
|
+
<Title title="Level 5" theme="light" level={4} />
|
|
24
|
+
<DxcHeading text="Heading for sections within the page" level={5} />
|
|
25
|
+
</ExampleContainer>
|
|
26
|
+
<Title title="Weights" theme="light" level={2} />
|
|
27
|
+
<ExampleContainer>
|
|
28
|
+
<Title title="'light' Weight" theme="light" level={4} />
|
|
29
|
+
<DxcHeading text="Heading for sections within the page" level={2} weight="light" />
|
|
30
|
+
<Title title="'normal' Weight" theme="light" level={4} />
|
|
31
|
+
<DxcHeading text="Heading for sections within the page" level={4} weight="normal" />
|
|
32
|
+
<Title title="'bold' Weight" theme="light" level={4} />
|
|
33
|
+
<DxcHeading text="Heading for sections within the page" weight="bold" />
|
|
34
|
+
</ExampleContainer>
|
|
35
|
+
<Title title="Margins" theme="light" level={2} />
|
|
36
|
+
<ExampleContainer>
|
|
37
|
+
<Title title="Xxsmall" theme="light" level={4} />
|
|
38
|
+
<DxcHeading text="Xxsmall" margin="xxsmall" />
|
|
39
|
+
<Title title="Xsmall" theme="light" level={4} />
|
|
40
|
+
<DxcHeading text="Xsmall" margin="xsmall" />
|
|
41
|
+
<Title title="Small" theme="light" level={4} />
|
|
42
|
+
<DxcHeading text="Small" margin="small" />
|
|
43
|
+
<Title title="Medium" theme="light" level={4} />
|
|
44
|
+
<DxcHeading text="Medium" margin="medium" />
|
|
45
|
+
<Title title="Large" theme="light" level={4} />
|
|
46
|
+
<DxcHeading text="Large" margin="large" />
|
|
47
|
+
<Title title="Xlarge" theme="light" level={4} />
|
|
48
|
+
<DxcHeading text="Xlarge" margin="xlarge" />
|
|
49
|
+
<Title title="Xxlarge" theme="light" level={4} />
|
|
50
|
+
<DxcHeading text="Xxlarge" margin="xxlarge" />
|
|
51
|
+
</ExampleContainer>
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
* Defines the heading level from 1 to 5. The styles of the heading are applied according to the level.
|
|
11
|
+
* The html tag of the heading will be the one specified in the 'as' prop.
|
|
12
|
+
* If 'as' is not specified, the html tag of the heading is the one specified in the 'level' prop.
|
|
13
|
+
*/
|
|
14
|
+
level?: 1 | 2 | 3 | 4 | 5;
|
|
15
|
+
/**
|
|
16
|
+
* Heading text.
|
|
17
|
+
*/
|
|
18
|
+
text: string;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the html tag of the heading.
|
|
21
|
+
*/
|
|
22
|
+
as?: "h1" | "h2" | "h3" | "h4" | "h5";
|
|
23
|
+
/**
|
|
24
|
+
* Modifies the default weight of the heading.
|
|
25
|
+
*/
|
|
26
|
+
weight?: "light" | "normal" | "bold";
|
|
27
|
+
/**
|
|
28
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
29
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
30
|
+
*/
|
|
31
|
+
margin?: Space | Margin;
|
|
32
|
+
};
|
|
33
|
+
export default Props;
|
package/heading/types.js
ADDED
package/input-text/InputText.js
CHANGED
|
@@ -39,11 +39,11 @@ var _variables = require("../common/variables.js");
|
|
|
39
39
|
|
|
40
40
|
var _utils = require("../common/utils.js");
|
|
41
41
|
|
|
42
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
42
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
43
43
|
|
|
44
44
|
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
45
45
|
|
|
46
|
-
var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext
|
|
46
|
+
var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext"));
|
|
47
47
|
|
|
48
48
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
49
49
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import AppLayoutPropsType, { AppLayoutFooterPropsType, AppLayoutMainPropsType, AppLayoutHeaderPropsType } from "./types";
|
|
3
|
+
declare const DxcApplicationLayout: {
|
|
4
|
+
({ children }: AppLayoutPropsType): JSX.Element;
|
|
5
|
+
Header: ({ children }: AppLayoutHeaderPropsType) => JSX.Element;
|
|
6
|
+
Main: ({ children }: AppLayoutMainPropsType) => JSX.Element;
|
|
7
|
+
Footer: ({ children }: AppLayoutFooterPropsType) => JSX.Element;
|
|
8
|
+
SideNav: (props: any) => JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
export default DxcApplicationLayout;
|
|
@@ -21,13 +21,11 @@ var _main = require("../main");
|
|
|
21
21
|
|
|
22
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
23
|
|
|
24
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
24
|
var _variables = require("../common/variables.js");
|
|
27
25
|
|
|
28
26
|
var _Icons = require("./Icons");
|
|
29
27
|
|
|
30
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
28
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
29
|
|
|
32
30
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
|
|
33
31
|
|
|
@@ -55,23 +53,14 @@ var Footer = function Footer(_ref3) {
|
|
|
55
53
|
};
|
|
56
54
|
|
|
57
55
|
var SideNav = function SideNav(props) {
|
|
58
|
-
var displayArrow = props.displayArrow,
|
|
59
|
-
|
|
56
|
+
var _props$displayArrow = props.displayArrow,
|
|
57
|
+
displayArrow = _props$displayArrow === void 0 ? true : _props$displayArrow,
|
|
58
|
+
_props$mode = props.mode,
|
|
59
|
+
mode = _props$mode === void 0 ? "overlay" : _props$mode,
|
|
60
60
|
childProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
61
61
|
return /*#__PURE__*/_react["default"].createElement(_main.DxcSidenav, childProps, childProps.children);
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
SideNav.propTypes = {
|
|
65
|
-
mode: _propTypes["default"].oneOf(["overlay", "push", ""]),
|
|
66
|
-
displayArrow: _propTypes["default"].bool,
|
|
67
|
-
padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
68
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
69
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
70
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
71
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
72
|
-
})])
|
|
73
|
-
};
|
|
74
|
-
|
|
75
64
|
var defaultFooter = function defaultFooter() {
|
|
76
65
|
return /*#__PURE__*/_react["default"].createElement(_main.DxcFooter, {
|
|
77
66
|
copyright: "\xA9 DXC Technology ".concat(year, "\u200B\u200B\u200B\u200B. All rights reserved."),
|
|
@@ -120,7 +109,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref4) {
|
|
|
120
109
|
isSideNavVisible = _useState2[0],
|
|
121
110
|
setIsSideNavVisible = _useState2[1];
|
|
122
111
|
|
|
123
|
-
var _useState3 = (0, _react.useState)(),
|
|
112
|
+
var _useState3 = (0, _react.useState)(false),
|
|
124
113
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
125
114
|
isResponsive = _useState4[0],
|
|
126
115
|
setIsResponsive = _useState4[1];
|
|
@@ -149,7 +138,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref4) {
|
|
|
149
138
|
|
|
150
139
|
var handleResize = function handleResize(width) {
|
|
151
140
|
if (width) {
|
|
152
|
-
|
|
141
|
+
setIsResponsive(width <= _variables.responsiveSizes.tablet);
|
|
153
142
|
setIsSideNavVisible(true);
|
|
154
143
|
}
|
|
155
144
|
};
|
|
@@ -180,6 +169,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref4) {
|
|
|
180
169
|
}, /*#__PURE__*/_react["default"].createElement(HeaderContainer, null, header), /*#__PURE__*/_react["default"].createElement(BodyContainer, null, /*#__PURE__*/_react["default"].createElement(ContentContainer, null, /*#__PURE__*/_react["default"].createElement(SideNavArrowContainer, {
|
|
181
170
|
isSideNavVisible: isSideNavVisible
|
|
182
171
|
}, sideNav, /*#__PURE__*/_react["default"].createElement(ArrowContainer, null, sideNav && (displayArrow || isResponsive) && /*#__PURE__*/_react["default"].createElement(ArrowTrigger, {
|
|
172
|
+
role: "button",
|
|
183
173
|
tabIndex: 0,
|
|
184
174
|
onClick: handleSidenav,
|
|
185
175
|
isSideNavVisible: isSideNavVisible
|