@dxc-technology/halstack-react 0.0.0-ee92231 → 0.0.0-f0d662d
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 -4
- 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.js +2 -2
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +1 -1
- 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/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +84 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +13 -0
- package/bleed/types.js +5 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +4 -7
- package/box/types.d.ts +0 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +13 -19
- package/button/Button.stories.tsx +222 -241
- package/button/types.d.ts +5 -9
- package/card/Card.js +5 -6
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/types.d.ts +2 -2
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +5 -27
- package/chip/Chip.stories.tsx +121 -0
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +70 -27
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +10 -13
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.js +4 -3
- package/dialog/Dialog.stories.tsx +212 -0
- package/dropdown/Dropdown.js +1 -1
- package/dropdown/Dropdown.stories.tsx +247 -0
- package/dropdown/types.d.ts +1 -1
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +167 -109
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +12 -21
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +28 -36
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +22 -18
- package/header/Header.js +2 -2
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.d.ts +2 -0
- package/header/types.d.ts +4 -2
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +54 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/input-text/InputText.js +2 -2
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +84 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +13 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +9 -19
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.js +3 -3
- package/link/Link.stories.tsx +146 -0
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +7 -3
- package/main.js +34 -2
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +5 -50
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -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 +4 -2
- package/paginator/Paginator.js +2 -8
- package/password-input/PasswordInput.js +19 -18
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/types.d.ts +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/radio/Radio.js +2 -2
- package/radio/types.d.ts +2 -2
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +140 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +273 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/RadioGroup.test.js +248 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +5 -28
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +20 -22
- package/select/Select.stories.tsx +572 -0
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +6 -15
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +43 -32
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +2 -7
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.js +3 -3
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.js +11 -9
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/types.d.ts +25 -18
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +4 -25
- package/tag/{Tag.stories.jsx → Tag.stories.tsx} +1 -1
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +54 -85
- 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.d.ts +4 -0
- package/textarea/Textarea.js +27 -60
- package/textarea/Textarea.stories.jsx +4 -3
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +16 -45
- package/toggle-group/ToggleGroup.stories.tsx +173 -0
- package/toggle-group/types.d.ts +97 -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 +69 -59
- package/wizard/Wizard.stories.tsx +224 -0
- package/wizard/types.d.ts +60 -0
- package/wizard/types.js +5 -0
- package/chip/index.d.ts +0 -22
- package/file-input/index.d.ts +0 -81
- package/heading/index.d.ts +0 -17
- package/number-input/index.d.ts +0 -113
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle-group/index.d.ts +0 -21
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
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,54 @@
|
|
|
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={2} weight="normal" />
|
|
32
|
+
<Title title="'bold' Weight" theme="light" level={4} />
|
|
33
|
+
<DxcHeading text="Heading for sections within the page" level={2} 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
|
+
<hr />
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
@@ -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
|
|
package/inset/Inset.d.ts
ADDED
package/inset/Inset.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
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"] = Inset;
|
|
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;
|
|
17
|
+
|
|
18
|
+
function Inset(_ref) {
|
|
19
|
+
var space = _ref.space,
|
|
20
|
+
horizontal = _ref.horizontal,
|
|
21
|
+
vertical = _ref.vertical,
|
|
22
|
+
top = _ref.top,
|
|
23
|
+
right = _ref.right,
|
|
24
|
+
bottom = _ref.bottom,
|
|
25
|
+
left = _ref.left,
|
|
26
|
+
children = _ref.children;
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(StyledInset, {
|
|
28
|
+
space: space,
|
|
29
|
+
horizontal: horizontal,
|
|
30
|
+
vertical: vertical,
|
|
31
|
+
top: top,
|
|
32
|
+
right: right,
|
|
33
|
+
bottom: bottom,
|
|
34
|
+
left: left
|
|
35
|
+
}, children);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getSpacingValue(spacingName) {
|
|
39
|
+
switch (spacingName) {
|
|
40
|
+
case "none":
|
|
41
|
+
return "0rem";
|
|
42
|
+
|
|
43
|
+
case "xxxsmall":
|
|
44
|
+
return "0.125rem";
|
|
45
|
+
|
|
46
|
+
case "xxsmall":
|
|
47
|
+
return "0.25rem";
|
|
48
|
+
|
|
49
|
+
case "xsmall":
|
|
50
|
+
return "0.5rem";
|
|
51
|
+
|
|
52
|
+
case "small":
|
|
53
|
+
return "1rem";
|
|
54
|
+
|
|
55
|
+
case "medium":
|
|
56
|
+
return "1.5rem";
|
|
57
|
+
|
|
58
|
+
case "large":
|
|
59
|
+
return "2rem";
|
|
60
|
+
|
|
61
|
+
case "xlarge":
|
|
62
|
+
return "3rem";
|
|
63
|
+
|
|
64
|
+
case "xxlarge":
|
|
65
|
+
return "4rem";
|
|
66
|
+
|
|
67
|
+
case "xxxlarge":
|
|
68
|
+
return "5rem";
|
|
69
|
+
|
|
70
|
+
default:
|
|
71
|
+
return "0rem";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var StyledInset = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n"])), function (_ref2) {
|
|
76
|
+
var space = _ref2.space,
|
|
77
|
+
horizontal = _ref2.horizontal,
|
|
78
|
+
vertical = _ref2.vertical,
|
|
79
|
+
top = _ref2.top,
|
|
80
|
+
right = _ref2.right,
|
|
81
|
+
bottom = _ref2.bottom,
|
|
82
|
+
left = _ref2.left;
|
|
83
|
+
return "\n padding: ".concat(getSpacingValue(top || vertical || space), " ").concat(getSpacingValue(right || horizontal || space), "\n ").concat(getSpacingValue(bottom || vertical || space), " ").concat(getSpacingValue(left || horizontal || space), ";\n");
|
|
84
|
+
});
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcStack from "./../stack/Stack";
|
|
5
|
+
import DxcInset from "./Inset";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Inset",
|
|
9
|
+
component: DxcInset,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Chromatic = () => (
|
|
13
|
+
<>
|
|
14
|
+
<Title title="Default" level={4} />
|
|
15
|
+
<Container>
|
|
16
|
+
<DxcInset>
|
|
17
|
+
<Placeholder></Placeholder>
|
|
18
|
+
</DxcInset>
|
|
19
|
+
</Container>
|
|
20
|
+
<Title title="space = none" level={4} />
|
|
21
|
+
<Container>
|
|
22
|
+
<DxcInset space="none">
|
|
23
|
+
<Placeholder></Placeholder>
|
|
24
|
+
</DxcInset>
|
|
25
|
+
</Container>
|
|
26
|
+
<Title title="space = xxxsmall" level={4} />
|
|
27
|
+
<Container>
|
|
28
|
+
<DxcInset space="xxxsmall">
|
|
29
|
+
<Placeholder></Placeholder>
|
|
30
|
+
</DxcInset>
|
|
31
|
+
</Container>
|
|
32
|
+
<Title title="space = xxsmall" level={4} />
|
|
33
|
+
<Container>
|
|
34
|
+
<DxcInset space="xxsmall">
|
|
35
|
+
<Placeholder></Placeholder>
|
|
36
|
+
</DxcInset>
|
|
37
|
+
</Container>
|
|
38
|
+
<Title title="space = xsmall" level={4} />
|
|
39
|
+
<Container>
|
|
40
|
+
<DxcInset space="xsmall">
|
|
41
|
+
<Placeholder></Placeholder>
|
|
42
|
+
</DxcInset>
|
|
43
|
+
</Container>
|
|
44
|
+
<Title title="space = small" level={4} />
|
|
45
|
+
<Container>
|
|
46
|
+
<DxcInset space="small">
|
|
47
|
+
<Placeholder></Placeholder>
|
|
48
|
+
</DxcInset>
|
|
49
|
+
</Container>
|
|
50
|
+
<Title title="space = medium" level={4} />
|
|
51
|
+
<Container>
|
|
52
|
+
<DxcInset space="medium">
|
|
53
|
+
<Placeholder></Placeholder>
|
|
54
|
+
</DxcInset>
|
|
55
|
+
</Container>
|
|
56
|
+
<Title title="space = large" level={4} />
|
|
57
|
+
<Container>
|
|
58
|
+
<DxcInset space="large">
|
|
59
|
+
<Placeholder></Placeholder>
|
|
60
|
+
</DxcInset>
|
|
61
|
+
</Container>
|
|
62
|
+
<Title title="space = xlarge" level={4} />
|
|
63
|
+
<Container>
|
|
64
|
+
<DxcInset space="xlarge">
|
|
65
|
+
<Placeholder></Placeholder>
|
|
66
|
+
</DxcInset>
|
|
67
|
+
</Container>
|
|
68
|
+
<Title title="space = xxlarge" level={4} />
|
|
69
|
+
<Container>
|
|
70
|
+
<DxcInset space="xxlarge">
|
|
71
|
+
<Placeholder></Placeholder>
|
|
72
|
+
</DxcInset>
|
|
73
|
+
</Container>
|
|
74
|
+
<Title title="space = xxxlarge" level={4} />
|
|
75
|
+
<Container>
|
|
76
|
+
<DxcInset space="xxxlarge">
|
|
77
|
+
<Placeholder></Placeholder>
|
|
78
|
+
</DxcInset>
|
|
79
|
+
</Container>
|
|
80
|
+
<Title title="horizontal = none" level={4} />
|
|
81
|
+
<Container>
|
|
82
|
+
<DxcInset horizontal="none">
|
|
83
|
+
<Placeholder></Placeholder>
|
|
84
|
+
</DxcInset>
|
|
85
|
+
</Container>
|
|
86
|
+
<Title title="horizontal = xxxsmall" level={4} />
|
|
87
|
+
<Container>
|
|
88
|
+
<DxcInset horizontal="xxxsmall">
|
|
89
|
+
<Placeholder></Placeholder>
|
|
90
|
+
</DxcInset>
|
|
91
|
+
</Container>
|
|
92
|
+
<Title title="horizontal = xxsmall" level={4} />
|
|
93
|
+
<Container>
|
|
94
|
+
<DxcInset horizontal="xxsmall">
|
|
95
|
+
<Placeholder></Placeholder>
|
|
96
|
+
</DxcInset>
|
|
97
|
+
</Container>
|
|
98
|
+
<Title title="horizontal = xsmall" level={4} />
|
|
99
|
+
<Container>
|
|
100
|
+
<DxcInset horizontal="xsmall">
|
|
101
|
+
<Placeholder></Placeholder>
|
|
102
|
+
</DxcInset>
|
|
103
|
+
</Container>
|
|
104
|
+
<Title title="horizontal = small" level={4} />
|
|
105
|
+
<Container>
|
|
106
|
+
<DxcInset horizontal="small">
|
|
107
|
+
<Placeholder></Placeholder>
|
|
108
|
+
</DxcInset>
|
|
109
|
+
</Container>
|
|
110
|
+
<Title title="horizontal = medium" level={4} />
|
|
111
|
+
<Container>
|
|
112
|
+
<DxcInset horizontal="medium">
|
|
113
|
+
<Placeholder></Placeholder>
|
|
114
|
+
</DxcInset>
|
|
115
|
+
</Container>
|
|
116
|
+
<Title title="horizontal = large" level={4} />
|
|
117
|
+
<Container>
|
|
118
|
+
<DxcInset horizontal="large">
|
|
119
|
+
<Placeholder></Placeholder>
|
|
120
|
+
</DxcInset>
|
|
121
|
+
</Container>
|
|
122
|
+
<Title title="horizontal = xlarge" level={4} />
|
|
123
|
+
<Container>
|
|
124
|
+
<DxcInset horizontal="xlarge">
|
|
125
|
+
<Placeholder></Placeholder>
|
|
126
|
+
</DxcInset>
|
|
127
|
+
</Container>
|
|
128
|
+
<Title title="horizontal = xxlarge" level={4} />
|
|
129
|
+
<Container>
|
|
130
|
+
<DxcInset horizontal="xxlarge">
|
|
131
|
+
<Placeholder></Placeholder>
|
|
132
|
+
</DxcInset>
|
|
133
|
+
</Container>
|
|
134
|
+
<Title title="horizontal = xxxlarge" level={4} />
|
|
135
|
+
<Container>
|
|
136
|
+
<DxcInset horizontal="xxxlarge">
|
|
137
|
+
<Placeholder></Placeholder>
|
|
138
|
+
</DxcInset>
|
|
139
|
+
</Container>
|
|
140
|
+
<Title title="vertical = none" level={4} />
|
|
141
|
+
<Container>
|
|
142
|
+
<DxcInset vertical="none">
|
|
143
|
+
<Placeholder></Placeholder>
|
|
144
|
+
</DxcInset>
|
|
145
|
+
</Container>
|
|
146
|
+
<Title title="vertical = xxxsmall" level={4} />
|
|
147
|
+
<Container>
|
|
148
|
+
<DxcInset vertical="xxxsmall">
|
|
149
|
+
<Placeholder></Placeholder>
|
|
150
|
+
</DxcInset>
|
|
151
|
+
</Container>
|
|
152
|
+
<Title title="vertical = xxsmall" level={4} />
|
|
153
|
+
<Container>
|
|
154
|
+
<DxcInset vertical="xxsmall">
|
|
155
|
+
<Placeholder></Placeholder>
|
|
156
|
+
</DxcInset>
|
|
157
|
+
</Container>
|
|
158
|
+
<Title title="vertical = xsmall" level={4} />
|
|
159
|
+
<Container>
|
|
160
|
+
<DxcInset vertical="xsmall">
|
|
161
|
+
<Placeholder></Placeholder>
|
|
162
|
+
</DxcInset>
|
|
163
|
+
</Container>
|
|
164
|
+
<Title title="vertical = small" level={4} />
|
|
165
|
+
<Container>
|
|
166
|
+
<DxcInset vertical="small">
|
|
167
|
+
<Placeholder></Placeholder>
|
|
168
|
+
</DxcInset>
|
|
169
|
+
</Container>
|
|
170
|
+
<Title title="vertical = medium" level={4} />
|
|
171
|
+
<Container>
|
|
172
|
+
<DxcInset vertical="medium">
|
|
173
|
+
<Placeholder></Placeholder>
|
|
174
|
+
</DxcInset>
|
|
175
|
+
</Container>
|
|
176
|
+
<Title title="vertical = large" level={4} />
|
|
177
|
+
<Container>
|
|
178
|
+
<DxcInset vertical="large">
|
|
179
|
+
<Placeholder></Placeholder>
|
|
180
|
+
</DxcInset>
|
|
181
|
+
</Container>
|
|
182
|
+
<Title title="vertical = xlarge" level={4} />
|
|
183
|
+
<Container>
|
|
184
|
+
<DxcInset vertical="xlarge">
|
|
185
|
+
<Placeholder></Placeholder>
|
|
186
|
+
</DxcInset>
|
|
187
|
+
</Container>
|
|
188
|
+
<Title title="vertical = xxlarge" level={4} />
|
|
189
|
+
<Container>
|
|
190
|
+
<DxcInset vertical="xxlarge">
|
|
191
|
+
<Placeholder></Placeholder>
|
|
192
|
+
</DxcInset>
|
|
193
|
+
</Container>
|
|
194
|
+
<Title title="vertical = xxxlarge" level={4} />
|
|
195
|
+
<Container>
|
|
196
|
+
<DxcInset vertical="xxxlarge">
|
|
197
|
+
<Placeholder></Placeholder>
|
|
198
|
+
</DxcInset>
|
|
199
|
+
</Container>
|
|
200
|
+
<Title title="top = xxsmall, right= medium, bottom = large and left = xxlarge" level={4} />
|
|
201
|
+
<Container>
|
|
202
|
+
<DxcInset top="xxsmall" right="medium" bottom="large" left="xxlarge">
|
|
203
|
+
<Placeholder></Placeholder>
|
|
204
|
+
</DxcInset>
|
|
205
|
+
</Container>
|
|
206
|
+
<Title title="Inside a stack" level={4} />
|
|
207
|
+
<Container>
|
|
208
|
+
<DxcStack gutter="medium" divider>
|
|
209
|
+
<Placeholder></Placeholder>
|
|
210
|
+
<DxcInset top="xxsmall" right="medium" bottom="large" left="xxlarge">
|
|
211
|
+
<Placeholder></Placeholder>
|
|
212
|
+
</DxcInset>
|
|
213
|
+
<Placeholder></Placeholder>
|
|
214
|
+
</DxcStack>
|
|
215
|
+
</Container>
|
|
216
|
+
</>
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const Container = styled.div`
|
|
220
|
+
background: #f2eafa;
|
|
221
|
+
margin: 2.5rem;
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
const Placeholder = styled.div`
|
|
225
|
+
min-height: 40px;
|
|
226
|
+
min-width: 120px;
|
|
227
|
+
border: 1px solid #a46ede;
|
|
228
|
+
background-color: #e5d5f6;
|
|
229
|
+
`;
|
package/inset/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Spacing = "none" | "xxxsmall" | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "xxxlarge";
|
|
3
|
+
declare type Props = {
|
|
4
|
+
space?: Spacing;
|
|
5
|
+
horizontal?: Spacing;
|
|
6
|
+
vertical?: Spacing;
|
|
7
|
+
top?: Spacing;
|
|
8
|
+
right?: Spacing;
|
|
9
|
+
bottom?: Spacing;
|
|
10
|
+
left?: Spacing;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export default Props;
|
package/inset/types.js
ADDED
|
@@ -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
|
|
@@ -223,7 +213,7 @@ var SideNavArrowContainer = _styledComponents["default"].div(_templateObject8 ||
|
|
|
223
213
|
|
|
224
214
|
var ArrowContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n height: calc(100vh - 64px);\n left: 279px;\n"])));
|
|
225
215
|
|
|
226
|
-
var ArrowTrigger = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n position: sticky;\n top: 45vh;\n width: 42px;\n min-height: 42px;\n background-color: ", ";\n border-radius: 50%;\n transform: ", ";\n transition: transform 0.4s ease-in-out;\n z-index: 1250;\n cursor: pointer;\n & > svg {\n fill: ", ";\n }\n"])), function (props) {
|
|
216
|
+
var ArrowTrigger = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n position: sticky;\n top: 45vh;\n width: 42px;\n min-height: 42px;\n background-color: ", ";\n border-radius: 50%;\n transform: ", ";\n transition: transform 0.4s ease-in-out;\n z-index: 1250;\n cursor: pointer;\n & > svg {\n fill: ", ";\n }\n :focus {\n outline: #0095ff auto 1px;\n }\n"])), function (props) {
|
|
227
217
|
return "".concat(props.theme.arrowContainerColor);
|
|
228
218
|
}, function (props) {
|
|
229
219
|
return props.isSideNavVisible ? "rotate(-180deg)" : "rotate(0deg)";
|