@dxc-technology/halstack-react 0.0.0-0e7fa98 → 0.0.0-0f1b72b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HalstackContext.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.js +4 -4
- package/accordion/Accordion.stories.tsx +3 -3
- package/alert/Alert.js +4 -1
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +1 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +31 -32
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +22 -32
- package/button/Button.js +12 -9
- package/card/Card.js +24 -27
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +38 -28
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/types.d.ts +3 -3
- package/common/variables.js +176 -78
- package/date-input/DateInput.js +16 -13
- package/dropdown/Dropdown.js +13 -17
- package/file-input/FileInput.js +9 -6
- package/file-input/FileItem.js +7 -5
- package/footer/Footer.js +7 -5
- package/header/Header.js +7 -4
- package/inline/Inline.d.ts +4 -0
- package/inline/Inline.js +54 -0
- package/inline/Inline.stories.tsx +240 -0
- package/inline/types.d.ts +32 -0
- package/{radio → inline}/types.js +0 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +32 -32
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +4 -3
- package/layout/ApplicationLayout.js +83 -102
- package/layout/ApplicationLayout.stories.tsx +14 -59
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +5 -10
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +87 -52
- package/link/Link.test.js +7 -15
- package/link/types.d.ts +7 -23
- package/main.d.ts +4 -3
- package/main.js +27 -13
- package/number-input/types.d.ts +1 -1
- package/package.json +5 -4
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +42 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +1 -2
- package/password-input/types.d.ts +1 -1
- package/progress-bar/ProgressBar.js +1 -1
- package/progress-bar/ProgressBar.stories.jsx +11 -11
- package/quick-nav/QuickNav.js +65 -17
- package/quick-nav/QuickNav.stories.tsx +2 -2
- package/quick-nav/types.d.ts +4 -4
- package/radio-group/Radio.js +1 -1
- package/radio-group/RadioGroup.js +8 -6
- package/resultsetTable/ResultsetTable.test.js +42 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +35 -8
- package/select/Select.js +83 -78
- package/select/Select.stories.tsx +144 -100
- package/select/Select.test.js +299 -194
- package/select/types.d.ts +3 -4
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +20 -9
- package/spinner/Spinner.js +1 -1
- package/switch/Switch.d.ts +1 -1
- package/switch/Switch.js +19 -16
- package/switch/Switch.stories.tsx +8 -8
- package/switch/types.d.ts +2 -2
- package/tabs/Tabs.stories.tsx +0 -6
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +132 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.js +5 -8
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +46 -72
- package/text-input/TextInput.test.js +1 -1
- package/text-input/types.d.ts +14 -2
- package/textarea/Textarea.js +10 -19
- package/textarea/types.d.ts +1 -1
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.js +27 -25
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
package/file-input/FileItem.js
CHANGED
|
@@ -133,9 +133,9 @@ var FileItemContainer = _styledComponents["default"].div(_templateObject3 || (_t
|
|
|
133
133
|
var ImagePreview = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"])));
|
|
134
134
|
|
|
135
135
|
var IconPreviewContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 12px;\n background-color: ", ";\n width: 48px;\n height: 48px;\n border-radius: 2px;\n color: ", ";\n"])), function (props) {
|
|
136
|
-
return props.error ? props.theme.
|
|
136
|
+
return props.error ? props.theme.errorFilePreviewBackgroundColor : props.theme.filePreviewBackgroundColor;
|
|
137
137
|
}, function (props) {
|
|
138
|
-
return props.error ? props.theme.
|
|
138
|
+
return props.error ? props.theme.errorFilePreviewIconColor : props.theme.filePreviewIconColor;
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
var IconPreview = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
@@ -156,14 +156,16 @@ var FileName = _styledComponents["default"].span(_templateObject7 || (_templateO
|
|
|
156
156
|
|
|
157
157
|
var ErrorIcon = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\n"])));
|
|
158
158
|
|
|
159
|
-
var DeleteIcon = _styledComponents["default"].button(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n margin-left: 4px;\n background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n cursor: pointer;\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
159
|
+
var DeleteIcon = _styledComponents["default"].button(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n margin-left: 4px;\n background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n cursor: pointer;\n color: ", ";\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
160
160
|
return props.theme.fontFamily;
|
|
161
|
+
}, function (props) {
|
|
162
|
+
return props.theme.deleteFileItemColor;
|
|
161
163
|
}, function (props) {
|
|
162
164
|
return props.theme.hoverDeleteFileItemBackgroundColor;
|
|
163
165
|
}, function (props) {
|
|
164
|
-
return props.theme.
|
|
166
|
+
return props.theme.focusDeleteFileItemBorderColor;
|
|
165
167
|
}, function (props) {
|
|
166
|
-
return props.theme.
|
|
168
|
+
return props.theme.focusDeleteFileItemBorderColor;
|
|
167
169
|
}, function (props) {
|
|
168
170
|
return props.theme.activeDeleteFileItemBackgroundColor;
|
|
169
171
|
});
|
package/footer/Footer.js
CHANGED
|
@@ -21,6 +21,8 @@ var _variables = require("../common/variables.js");
|
|
|
21
21
|
|
|
22
22
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
23
|
|
|
24
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
25
|
+
|
|
24
26
|
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
25
27
|
|
|
26
28
|
var _Icons = require("./Icons");
|
|
@@ -34,14 +36,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
34
36
|
var DxcFooter = function DxcFooter(_ref) {
|
|
35
37
|
var socialLinks = _ref.socialLinks,
|
|
36
38
|
bottomLinks = _ref.bottomLinks,
|
|
37
|
-
|
|
38
|
-
copyright = _ref$copyright === void 0 ? "\xA9 DXC Technology ".concat(new Date().getFullYear(), ". All rights reserved.") : _ref$copyright,
|
|
39
|
+
copyright = _ref.copyright,
|
|
39
40
|
children = _ref.children,
|
|
40
41
|
padding = _ref.padding,
|
|
41
42
|
margin = _ref.margin,
|
|
42
43
|
_ref$tabIndex = _ref.tabIndex,
|
|
43
44
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
44
45
|
var colorsTheme = (0, _useTheme["default"])();
|
|
46
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
45
47
|
var footerLogo = (0, _react.useMemo)(function () {
|
|
46
48
|
if (!colorsTheme.footer.logo) {
|
|
47
49
|
return _Icons.dxcLogo;
|
|
@@ -49,7 +51,7 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
49
51
|
|
|
50
52
|
if (typeof colorsTheme.footer.logo === "string") {
|
|
51
53
|
return /*#__PURE__*/_react["default"].createElement(LogoImg, {
|
|
52
|
-
alt:
|
|
54
|
+
alt: translatedLabels.formFields.logoAlternativeText,
|
|
53
55
|
src: colorsTheme.footer.logo
|
|
54
56
|
});
|
|
55
57
|
}
|
|
@@ -86,7 +88,7 @@ var DxcFooter = function DxcFooter(_ref) {
|
|
|
86
88
|
color: colorsTheme.footer.backgroundColor
|
|
87
89
|
}, children)), /*#__PURE__*/_react["default"].createElement(FooterFooter, {
|
|
88
90
|
className: "footerFooter"
|
|
89
|
-
}, /*#__PURE__*/_react["default"].createElement(BottomLinks, null, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, null, copyright)))));
|
|
91
|
+
}, /*#__PURE__*/_react["default"].createElement(BottomLinks, null, bottomLink), /*#__PURE__*/_react["default"].createElement(Copyright, null, copyright || translatedLabels.footer.copyrightText(new Date().getFullYear()))))));
|
|
90
92
|
};
|
|
91
93
|
|
|
92
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 //mobile phones\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) {
|
|
@@ -119,7 +121,7 @@ var ChildComponents = _styledComponents["default"].div(_templateObject5 || (_tem
|
|
|
119
121
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
120
122
|
});
|
|
121
123
|
|
|
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 //mobile phones\n max-width: 100%;\n width: 100%;\n text-align: left;\n }\n
|
|
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 //mobile phones\n max-width: 100%;\n width: 100%;\n text-align: left;\n }\n\n padding-top: ", ";\n"])), function (props) {
|
|
123
125
|
return props.theme.copyrightFontFamily;
|
|
124
126
|
}, function (props) {
|
|
125
127
|
return props.theme.copyrightFontSize;
|
package/header/Header.js
CHANGED
|
@@ -29,6 +29,8 @@ var _variables = require("../common/variables.js");
|
|
|
29
29
|
|
|
30
30
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
31
31
|
|
|
32
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
33
|
+
|
|
32
34
|
var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext"));
|
|
33
35
|
|
|
34
36
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
|
@@ -64,14 +66,14 @@ var Dropdown = function Dropdown(props) {
|
|
|
64
66
|
|
|
65
67
|
var HeaderDropdown = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n button {\n background-color: transparent;\n :hover {\n background-color: transparent;\n }\n }\n"])));
|
|
66
68
|
|
|
67
|
-
var getLogoElement = function getLogoElement(themeInput) {
|
|
69
|
+
var getLogoElement = function getLogoElement(themeInput, logoLabel) {
|
|
68
70
|
if (!themeInput) {
|
|
69
71
|
return _Icons.dxcLogo;
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
if (typeof themeInput === "string") {
|
|
73
75
|
return /*#__PURE__*/_react["default"].createElement(LogoImg, {
|
|
74
|
-
alt:
|
|
76
|
+
alt: logoLabel,
|
|
75
77
|
src: themeInput
|
|
76
78
|
});
|
|
77
79
|
}
|
|
@@ -90,6 +92,7 @@ var DxcHeader = function DxcHeader(_ref) {
|
|
|
90
92
|
_ref$tabIndex = _ref.tabIndex,
|
|
91
93
|
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
92
94
|
var colorsTheme = (0, _useTheme["default"])();
|
|
95
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
93
96
|
var ref = (0, _react.useRef)(null);
|
|
94
97
|
|
|
95
98
|
var _useState = (0, _react.useState)(false),
|
|
@@ -125,10 +128,10 @@ var DxcHeader = function DxcHeader(_ref) {
|
|
|
125
128
|
};
|
|
126
129
|
|
|
127
130
|
var headerLogo = (0, _react.useMemo)(function () {
|
|
128
|
-
return getLogoElement(colorsTheme.header.logo);
|
|
131
|
+
return getLogoElement(colorsTheme.header.logo, translatedLabels.formFields.logoAlternativeText);
|
|
129
132
|
}, [colorsTheme.header.logo]);
|
|
130
133
|
var headerResponsiveLogo = (0, _react.useMemo)(function () {
|
|
131
|
-
return getLogoElement(colorsTheme.header.logoResponsive);
|
|
134
|
+
return getLogoElement(colorsTheme.header.logoResponsive, translatedLabels.formFields.logoAlternativeText);
|
|
132
135
|
}, [colorsTheme.header.logoResponsive]);
|
|
133
136
|
(0, _react.useEffect)(function () {
|
|
134
137
|
if (ref.current) {
|
package/inline/Inline.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
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 DxcInline = function DxcInline(_ref) {
|
|
19
|
+
var _ref$alignX = _ref.alignX,
|
|
20
|
+
alignX = _ref$alignX === void 0 ? "start" : _ref$alignX,
|
|
21
|
+
_ref$alignY = _ref.alignY,
|
|
22
|
+
alignY = _ref$alignY === void 0 ? "stretch" : _ref$alignY,
|
|
23
|
+
_ref$as = _ref.as,
|
|
24
|
+
as = _ref$as === void 0 ? "div" : _ref$as,
|
|
25
|
+
_ref$divider = _ref.divider,
|
|
26
|
+
divider = _ref$divider === void 0 ? false : _ref$divider,
|
|
27
|
+
_ref$gutter = _ref.gutter,
|
|
28
|
+
gutter = _ref$gutter === void 0 ? "0rem" : _ref$gutter,
|
|
29
|
+
_ref$reverse = _ref.reverse,
|
|
30
|
+
reverse = _ref$reverse === void 0 ? false : _ref$reverse,
|
|
31
|
+
children = _ref.children;
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(Inline, {
|
|
33
|
+
as: as,
|
|
34
|
+
alignX: alignX,
|
|
35
|
+
alignY: alignY,
|
|
36
|
+
gutter: gutter,
|
|
37
|
+
reverse: reverse
|
|
38
|
+
}, _react["default"].Children.map(children, function (child, index) {
|
|
39
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, divider && index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
var Inline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", "\n flex-wrap: wrap;\n"])), function (_ref2) {
|
|
44
|
+
var alignX = _ref2.alignX,
|
|
45
|
+
alignY = _ref2.alignY,
|
|
46
|
+
gutter = _ref2.gutter,
|
|
47
|
+
reverse = _ref2.reverse;
|
|
48
|
+
return "\n flex-direction: ".concat(reverse ? "row-reverse" : "row", ";\n align-items: ").concat(alignY === "start" || alignY === "end" ? "flex-".concat(alignY) : alignY, ";\n justify-content: ").concat(alignX === "start" || alignX === "end" ? "flex-".concat(alignX) : alignX, ";\n gap: ").concat(gutter, ";\n ");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
var Divider = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 1px;\n background-color: #999999;\n"])));
|
|
52
|
+
|
|
53
|
+
var _default = DxcInline;
|
|
54
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcInline from "./Inline";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Inline",
|
|
8
|
+
component: DxcInline,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Default" theme="light" level={4} />
|
|
14
|
+
<Container>
|
|
15
|
+
<DxcInline>
|
|
16
|
+
<Placeholder height="small" width="small" />
|
|
17
|
+
<Placeholder height="medium" width="medium" />
|
|
18
|
+
<Placeholder height="large" width="large" />
|
|
19
|
+
<Placeholder height="small" width="large" />
|
|
20
|
+
</DxcInline>
|
|
21
|
+
</Container>
|
|
22
|
+
<Title title="Default with divider" theme="light" level={4} />
|
|
23
|
+
<Container>
|
|
24
|
+
<DxcInline divider>
|
|
25
|
+
<Placeholder height="small" width="small" />
|
|
26
|
+
<Placeholder height="medium" width="medium" />
|
|
27
|
+
<Placeholder height="large" width="large" />
|
|
28
|
+
<Placeholder height="small" width="large" />
|
|
29
|
+
<Placeholder height="large" width="large" />
|
|
30
|
+
<Placeholder height="medium" width="small" />
|
|
31
|
+
</DxcInline>
|
|
32
|
+
</Container>
|
|
33
|
+
<Title title="One child larger than flex container" theme="light" level={4} />
|
|
34
|
+
<FlexContainer customWidth>
|
|
35
|
+
<DxcInline>
|
|
36
|
+
<Placeholder height="large" width="xlarge" />
|
|
37
|
+
</DxcInline>
|
|
38
|
+
</FlexContainer>
|
|
39
|
+
<Title title="Wrap" theme="light" level={4} />
|
|
40
|
+
<Container customWidth>
|
|
41
|
+
<DxcInline>
|
|
42
|
+
<Placeholder height="large" width="small" />
|
|
43
|
+
<Placeholder height="large" width="medium" />
|
|
44
|
+
<Placeholder height="medium" width="small" />
|
|
45
|
+
<Placeholder height="large" width="medium" />
|
|
46
|
+
</DxcInline>
|
|
47
|
+
</Container>
|
|
48
|
+
<Title title="AlignY = start" theme="light" level={4} />
|
|
49
|
+
<Container>
|
|
50
|
+
<DxcInline alignY="stretch">
|
|
51
|
+
<Placeholder width="small" />
|
|
52
|
+
<Placeholder height="medium" width="medium" />
|
|
53
|
+
<Placeholder height="large" width="large" />
|
|
54
|
+
<Placeholder height="small" width="large" />
|
|
55
|
+
</DxcInline>
|
|
56
|
+
</Container>
|
|
57
|
+
<Title title="AlignY = end" theme="light" level={4} />
|
|
58
|
+
<Container>
|
|
59
|
+
<DxcInline alignY="end">
|
|
60
|
+
<Placeholder height="small" width="small" />
|
|
61
|
+
<Placeholder height="medium" width="medium" />
|
|
62
|
+
<Placeholder height="large" width="large" />
|
|
63
|
+
<Placeholder height="small" width="large" />
|
|
64
|
+
</DxcInline>
|
|
65
|
+
</Container>
|
|
66
|
+
<Title title="AlignY = center" theme="light" level={4} />
|
|
67
|
+
<Container>
|
|
68
|
+
<DxcInline alignY="center">
|
|
69
|
+
<Placeholder height="small" width="small" />
|
|
70
|
+
<Placeholder height="medium" width="medium" />
|
|
71
|
+
<Placeholder height="large" width="large" />
|
|
72
|
+
<Placeholder height="small" width="large" />
|
|
73
|
+
</DxcInline>
|
|
74
|
+
</Container>
|
|
75
|
+
<Title title="AlignY with wrapped items" theme="light" level={4} />
|
|
76
|
+
<Container customWidth>
|
|
77
|
+
<DxcInline alignY="end">
|
|
78
|
+
<Placeholder height="large" width="small" />
|
|
79
|
+
<Placeholder height="large" width="medium" />
|
|
80
|
+
<Placeholder height="medium" width="small" />
|
|
81
|
+
<Placeholder height="large" width="medium" />
|
|
82
|
+
<Placeholder height="medium" width="small" />
|
|
83
|
+
<Placeholder height="small" width="medium" />
|
|
84
|
+
</DxcInline>
|
|
85
|
+
</Container>
|
|
86
|
+
<Title title="AlignY = baseline" theme="light" level={4} />
|
|
87
|
+
<Container>
|
|
88
|
+
<DxcInline alignY="baseline">
|
|
89
|
+
<Placeholder height="small" width="small" />
|
|
90
|
+
<Placeholder height="medium" width="medium" />
|
|
91
|
+
<Placeholder height="large" width="large" />
|
|
92
|
+
<Placeholder height="small" width="large" />
|
|
93
|
+
</DxcInline>
|
|
94
|
+
</Container>
|
|
95
|
+
<Title title="AlignX = start" theme="light" level={4} />
|
|
96
|
+
<Container>
|
|
97
|
+
<DxcInline alignX="start">
|
|
98
|
+
<Placeholder height="small" width="small" />
|
|
99
|
+
<Placeholder height="medium" width="medium" />
|
|
100
|
+
<Placeholder height="large" width="large" />
|
|
101
|
+
<Placeholder height="small" />
|
|
102
|
+
</DxcInline>
|
|
103
|
+
</Container>
|
|
104
|
+
<Title title="AlignX = end" theme="light" level={4} />
|
|
105
|
+
<Container>
|
|
106
|
+
<DxcInline alignX="end">
|
|
107
|
+
<Placeholder height="small" width="small" />
|
|
108
|
+
<Placeholder height="medium" width="medium" />
|
|
109
|
+
<Placeholder height="small" width="small" />
|
|
110
|
+
<Placeholder height="large" width="large" />
|
|
111
|
+
<Placeholder height="small" width="large" />
|
|
112
|
+
</DxcInline>
|
|
113
|
+
</Container>
|
|
114
|
+
<Title title="AlignX = center" theme="light" level={4} />
|
|
115
|
+
<Container>
|
|
116
|
+
<DxcInline alignX="center">
|
|
117
|
+
<Placeholder height="small" width="small" />
|
|
118
|
+
<Placeholder height="medium" width="medium" />
|
|
119
|
+
<Placeholder height="large" width="large" />
|
|
120
|
+
<Placeholder height="small" width="large" />
|
|
121
|
+
</DxcInline>
|
|
122
|
+
</Container>
|
|
123
|
+
<Title title="AlignX with wrapped items" theme="light" level={4} />
|
|
124
|
+
<Container customWidth>
|
|
125
|
+
<DxcInline alignX="center">
|
|
126
|
+
<Placeholder height="small" width="small" />
|
|
127
|
+
<Placeholder height="large" width="medium" />
|
|
128
|
+
<Placeholder height="medium" width="small" />
|
|
129
|
+
<Placeholder height="large" width="large" />
|
|
130
|
+
<Placeholder height="medium" width="small" />
|
|
131
|
+
<Placeholder height="small" width="large" />
|
|
132
|
+
<Placeholder height="large" width="large" />
|
|
133
|
+
<Placeholder height="large" width="medium" />
|
|
134
|
+
</DxcInline>
|
|
135
|
+
</Container>
|
|
136
|
+
<Title title="Gutter = 0.125rem" theme="light" level={4} />
|
|
137
|
+
<Container>
|
|
138
|
+
<DxcInline gutter="0.125rem">
|
|
139
|
+
<Placeholder height="small" width="small" />
|
|
140
|
+
<Placeholder height="medium" width="medium" />
|
|
141
|
+
<Placeholder height="large" width="large" />
|
|
142
|
+
<Placeholder height="small" width="large" />
|
|
143
|
+
</DxcInline>
|
|
144
|
+
</Container>
|
|
145
|
+
<Title title="Gutter = 0.25rem" theme="light" level={4} />
|
|
146
|
+
<Container>
|
|
147
|
+
<DxcInline gutter="0.25rem">
|
|
148
|
+
<Placeholder height="small" width="small" />
|
|
149
|
+
<Placeholder height="medium" width="medium" />
|
|
150
|
+
<Placeholder height="large" width="large" />
|
|
151
|
+
<Placeholder height="small" width="large" />
|
|
152
|
+
</DxcInline>
|
|
153
|
+
</Container>
|
|
154
|
+
<Title title="Gutter = 0.5rem" theme="light" level={4} />
|
|
155
|
+
<Container>
|
|
156
|
+
<DxcInline gutter="0.5rem">
|
|
157
|
+
<Placeholder height="small" width="small" />
|
|
158
|
+
<Placeholder height="medium" width="medium" />
|
|
159
|
+
<Placeholder height="large" width="large" />
|
|
160
|
+
<Placeholder height="small" width="large" />
|
|
161
|
+
</DxcInline>
|
|
162
|
+
</Container>
|
|
163
|
+
<Title title="Gutter = 0.75rem" theme="light" level={4} />
|
|
164
|
+
<Container>
|
|
165
|
+
<DxcInline gutter="0.75rem">
|
|
166
|
+
<Placeholder height="small" width="small" />
|
|
167
|
+
<Placeholder height="medium" width="medium" />
|
|
168
|
+
<Placeholder height="large" width="large" />
|
|
169
|
+
<Placeholder height="small" width="large" />
|
|
170
|
+
</DxcInline>
|
|
171
|
+
</Container>
|
|
172
|
+
<Title title="Gutter = 1rem" theme="light" level={4} />
|
|
173
|
+
<Container>
|
|
174
|
+
<DxcInline gutter="1rem">
|
|
175
|
+
<Placeholder height="small" width="small" />
|
|
176
|
+
<Placeholder height="medium" width="medium" />
|
|
177
|
+
<Placeholder height="large" width="large" />
|
|
178
|
+
<Placeholder height="small" width="large" />
|
|
179
|
+
</DxcInline>
|
|
180
|
+
</Container>
|
|
181
|
+
<Title title="Gutter = 1.5rem" theme="light" level={4} />
|
|
182
|
+
<Container>
|
|
183
|
+
<DxcInline gutter="1.5rem">
|
|
184
|
+
<Placeholder height="small" width="small" />
|
|
185
|
+
<Placeholder height="medium" width="medium" />
|
|
186
|
+
<Placeholder height="large" width="large" />
|
|
187
|
+
<Placeholder height="small" width="large" />
|
|
188
|
+
</DxcInline>
|
|
189
|
+
</Container>
|
|
190
|
+
<Title title="Gutter = 2rem and divider" theme="light" level={4} />
|
|
191
|
+
<Container>
|
|
192
|
+
<DxcInline gutter="2rem" divider>
|
|
193
|
+
<Placeholder height="small" width="small" />
|
|
194
|
+
<Placeholder height="medium" width="medium" />
|
|
195
|
+
<Placeholder height="large" width="large" />
|
|
196
|
+
<Placeholder height="small" width="large" />
|
|
197
|
+
</DxcInline>
|
|
198
|
+
</Container>
|
|
199
|
+
<Title title="Reverse" theme="light" level={4} />
|
|
200
|
+
<Container>
|
|
201
|
+
<DxcInline reverse>
|
|
202
|
+
<Placeholder height="small" width="small">
|
|
203
|
+
1
|
|
204
|
+
</Placeholder>
|
|
205
|
+
<Placeholder height="medium" width="medium">
|
|
206
|
+
2
|
|
207
|
+
</Placeholder>
|
|
208
|
+
<Placeholder height="large" width="large">
|
|
209
|
+
3
|
|
210
|
+
</Placeholder>
|
|
211
|
+
<Placeholder height="small" width="large">
|
|
212
|
+
4
|
|
213
|
+
</Placeholder>
|
|
214
|
+
</DxcInline>
|
|
215
|
+
</Container>
|
|
216
|
+
</>
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const FlexContainer = styled.div<{ customWidth?: boolean }>`
|
|
220
|
+
display: flex;
|
|
221
|
+
${({ customWidth }) => customWidth && `width: 200px;`};
|
|
222
|
+
background: #f2eafa;
|
|
223
|
+
`;
|
|
224
|
+
|
|
225
|
+
const Container = styled.div<{ customWidth?: boolean }>`
|
|
226
|
+
background: #f2eafa;
|
|
227
|
+
${({ customWidth }) => customWidth && `width: 300px;`};
|
|
228
|
+
`;
|
|
229
|
+
|
|
230
|
+
type PlaceholderProps = {
|
|
231
|
+
width?: "xlarge" | "large" | "medium" | "small" | "auto";
|
|
232
|
+
height?: "large" | "medium" | "small" | "auto";
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const Placeholder = styled.div<PlaceholderProps>`
|
|
236
|
+
${({ width }) => width && `width: ${width === "xlarge" ? "350px" : width === "large" ? "150px" : width === "medium" ? "100px" : "50px"};`};
|
|
237
|
+
${({ height }) => height && `height: ${height === "large" ? "150px" : height === "medium" ? "100px" : "50px"};`};
|
|
238
|
+
border: 1px solid #a46ede;
|
|
239
|
+
background-color: #e5d5f6;
|
|
240
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Align children in the main axis.
|
|
5
|
+
*/
|
|
6
|
+
alignX?: "start" | "end" | "center";
|
|
7
|
+
/**
|
|
8
|
+
* Align children in the cross axis.
|
|
9
|
+
*/
|
|
10
|
+
alignY?: "start" | "end" | "center" | "baseline" | "stretch";
|
|
11
|
+
/**
|
|
12
|
+
* Set the component to a different HTML tag.
|
|
13
|
+
*/
|
|
14
|
+
as?: React.ElementType;
|
|
15
|
+
/**
|
|
16
|
+
* Add a divider between columns.
|
|
17
|
+
*/
|
|
18
|
+
divider?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Spacing between columns.
|
|
21
|
+
*/
|
|
22
|
+
gutter?: "0rem" | "0.125rem" | "0.25rem" | "0.5rem" | "0.75rem" | "1rem" | "1.5rem" | "2rem";
|
|
23
|
+
/**
|
|
24
|
+
* Change the flex-direction of the column to reverse.
|
|
25
|
+
*/
|
|
26
|
+
reverse?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Single column.
|
|
29
|
+
*/
|
|
30
|
+
children: React.ReactElement<React.ReactNode>[] | React.ReactElement<React.ReactNode>;
|
|
31
|
+
};
|
|
32
|
+
export default Props;
|
|
File without changes
|
package/inset/Inset.js
CHANGED
|
@@ -36,40 +36,7 @@ function Inset(_ref) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function getSpacingValue(spacingName) {
|
|
39
|
-
|
|
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
|
-
}
|
|
39
|
+
return spacingName ? spacingName : "0rem";
|
|
73
40
|
}
|
|
74
41
|
|
|
75
42
|
var StyledInset = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n"])), function (_ref2) {
|