@dxc-technology/halstack-react 5.0.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HalstackContext.d.ts +4 -2
- package/HalstackContext.js +110 -58
- package/accordion/Accordion.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.js +1 -0
- 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 +94 -95
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +22 -32
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{list → bulleted-list}/types.js +0 -0
- package/button/Button.js +3 -1
- package/card/Card.js +34 -36
- package/checkbox/Checkbox.js +4 -1
- package/common/variables.js +211 -88
- package/date-input/DateInput.js +5 -2
- package/dropdown/Dropdown.stories.tsx +1 -1
- package/file-input/FileInput.js +9 -6
- package/file-input/FileItem.js +7 -5
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +21 -0
- package/{radio → flex}/types.js +0 -0
- package/footer/Footer.js +7 -5
- package/footer/Icons.js +1 -1
- package/header/Header.js +7 -4
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +70 -117
- package/layout/ApplicationLayout.stories.tsx +83 -93
- 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 +18 -33
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -70
- package/link/Link.stories.tsx +88 -53
- package/link/Link.test.js +7 -15
- package/link/types.d.ts +7 -23
- package/main.d.ts +7 -10
- package/main.js +38 -56
- package/number-input/types.d.ts +1 -1
- package/package.json +3 -1
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +42 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -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 +74 -20
- package/quick-nav/QuickNav.stories.tsx +43 -16
- package/quick-nav/types.d.ts +4 -4
- package/radio-group/Radio.js +1 -1
- package/radio-group/RadioGroup.js +10 -7
- 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 +6 -5
- package/sidenav/Sidenav.js +172 -52
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/spinner/Spinner.js +1 -1
- package/switch/Switch.js +4 -1
- 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/{row → tabs-nav}/types.js +0 -0
- 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/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/{stack → typography}/types.js +0 -0
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.js +36 -41
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +4 -3
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
|
@@ -12,40 +12,40 @@ export const Chromatic = () => (
|
|
|
12
12
|
<>
|
|
13
13
|
<ExampleContainer>
|
|
14
14
|
<Title title="Without labels" theme="light" level={4} />
|
|
15
|
-
<DxcProgressBar
|
|
15
|
+
<DxcProgressBar value={50} showValue />
|
|
16
16
|
<Title title="With helperText" theme="light" level={4} />
|
|
17
|
-
<DxcProgressBar helperText="Helper text" value={50}
|
|
17
|
+
<DxcProgressBar helperText="Helper text" value={50} showValue />
|
|
18
18
|
<Title title="Without default value" theme="light" level={4} />
|
|
19
|
-
<DxcProgressBar label="Loading..."
|
|
19
|
+
<DxcProgressBar label="Loading..." showValue />
|
|
20
20
|
</ExampleContainer>
|
|
21
21
|
<Title title="Margins" theme="light" level={2} />
|
|
22
22
|
<ExampleContainer>
|
|
23
23
|
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
24
|
-
<DxcProgressBar label="Margin xxsmall" margin="xxsmall"
|
|
24
|
+
<DxcProgressBar label="Margin xxsmall" margin="xxsmall" value={50} showValue />
|
|
25
25
|
</ExampleContainer>
|
|
26
26
|
<ExampleContainer>
|
|
27
27
|
<Title title="Xsmall margin" theme="light" level={4} />
|
|
28
|
-
<DxcProgressBar label="Margin xsmall" margin="xsmall"
|
|
28
|
+
<DxcProgressBar label="Margin xsmall" margin="xsmall" value={50} showValue />
|
|
29
29
|
</ExampleContainer>
|
|
30
30
|
<ExampleContainer>
|
|
31
31
|
<Title title="Small margin" theme="light" level={4} />
|
|
32
|
-
<DxcProgressBar label="Margin small" margin="small"
|
|
32
|
+
<DxcProgressBar label="Margin small" margin="small" value={50} showValue />
|
|
33
33
|
</ExampleContainer>
|
|
34
34
|
<ExampleContainer>
|
|
35
35
|
<Title title="Medium margin" theme="light" level={4} />
|
|
36
|
-
<DxcProgressBar label="Margin medium" margin="medium"
|
|
36
|
+
<DxcProgressBar label="Margin medium" margin="medium" value={50} showValue />
|
|
37
37
|
</ExampleContainer>
|
|
38
38
|
<ExampleContainer>
|
|
39
39
|
<Title title="Large margin" theme="light" level={4} />
|
|
40
|
-
<DxcProgressBar label="Margin large" margin="large"
|
|
40
|
+
<DxcProgressBar label="Margin large" margin="large" value={50} showValue />
|
|
41
41
|
</ExampleContainer>
|
|
42
42
|
<ExampleContainer>
|
|
43
43
|
<Title title="Xlarge margin" theme="light" level={4} />
|
|
44
|
-
<DxcProgressBar label="Margin xlarge" margin="xlarge"
|
|
44
|
+
<DxcProgressBar label="Margin xlarge" margin="xlarge" value={50} showValue />
|
|
45
45
|
</ExampleContainer>
|
|
46
46
|
<ExampleContainer>
|
|
47
47
|
<Title title="XxLarge margin" theme="light" level={4} />
|
|
48
|
-
<DxcProgressBar label="Margin xxlarge" margin="xxlarge"
|
|
48
|
+
<DxcProgressBar label="Margin xxlarge" margin="xxlarge" value={50} showValue />
|
|
49
49
|
</ExampleContainer>
|
|
50
50
|
</>
|
|
51
51
|
);
|
|
@@ -53,6 +53,6 @@ export const Chromatic = () => (
|
|
|
53
53
|
export const ProgressBarOverlay = () => (
|
|
54
54
|
<ExampleContainer>
|
|
55
55
|
<Title title="Overlay" theme="dark" level={4} />
|
|
56
|
-
<DxcProgressBar label="Overlay" helperText="Helper text" showValue value={50} />
|
|
56
|
+
<DxcProgressBar label="Overlay" helperText="Helper text" overlay={true} showValue value={50} />
|
|
57
57
|
</ExampleContainer>
|
|
58
58
|
);
|
package/quick-nav/QuickNav.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -11,54 +13,106 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
11
13
|
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
13
15
|
|
|
14
|
-
var _styledComponents =
|
|
16
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
17
|
|
|
16
18
|
var _slugify = _interopRequireDefault(require("slugify"));
|
|
17
19
|
|
|
20
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
21
|
+
|
|
18
22
|
var _Heading = _interopRequireDefault(require("../heading/Heading"));
|
|
19
23
|
|
|
20
|
-
var
|
|
24
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
21
25
|
|
|
22
26
|
var _Inset = _interopRequireDefault(require("../inset/Inset"));
|
|
23
27
|
|
|
24
|
-
var
|
|
28
|
+
var _Typography = _interopRequireDefault(require("../typography/Typography"));
|
|
29
|
+
|
|
30
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
25
31
|
|
|
26
|
-
var
|
|
32
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
27
33
|
|
|
28
|
-
var
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
37
|
|
|
30
38
|
var DxcQuickNav = function DxcQuickNav(_ref) {
|
|
31
39
|
var title = _ref.title,
|
|
32
40
|
links = _ref.links;
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
42
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
44
|
+
theme: colorsTheme.quickNav
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement(QuickNavContainer, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
46
|
+
direction: "column",
|
|
47
|
+
gap: "0.5rem"
|
|
35
48
|
}, /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
36
49
|
level: 4,
|
|
37
|
-
text: title
|
|
38
|
-
}), /*#__PURE__*/_react["default"].createElement(
|
|
50
|
+
text: title || translatedLabels.quickNav.contentTitle
|
|
51
|
+
}), /*#__PURE__*/_react["default"].createElement(ListColumn, null, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
52
|
+
direction: "column",
|
|
53
|
+
gap: "0.5rem"
|
|
54
|
+
}, links.map(function (link) {
|
|
39
55
|
var _link$links;
|
|
40
56
|
|
|
41
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
42
|
-
|
|
43
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
57
|
+
return /*#__PURE__*/_react["default"].createElement(ListRow, {
|
|
58
|
+
key: link.label
|
|
59
|
+
}, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
|
|
60
|
+
space: "0.25rem"
|
|
61
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
|
|
44
62
|
href: "#".concat((0, _slugify["default"])(link === null || link === void 0 ? void 0 : link.label, {
|
|
45
63
|
lower: true
|
|
46
64
|
}))
|
|
47
65
|
}, link === null || link === void 0 ? void 0 : link.label), (_link$links = link.links) === null || _link$links === void 0 ? void 0 : _link$links.map(function (sublink) {
|
|
48
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
49
|
-
|
|
50
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
66
|
+
return /*#__PURE__*/_react["default"].createElement(ListRow, {
|
|
67
|
+
key: sublink.label
|
|
68
|
+
}, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
|
|
69
|
+
horizontal: "0.5rem"
|
|
70
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
|
|
51
71
|
href: "#".concat((0, _slugify["default"])(sublink === null || sublink === void 0 ? void 0 : sublink.label, {
|
|
52
72
|
lower: true
|
|
53
73
|
}))
|
|
54
|
-
}, sublink === null || sublink === void 0 ? void 0 : sublink.label)));
|
|
55
|
-
})));
|
|
56
|
-
}))));
|
|
74
|
+
}, sublink === null || sublink === void 0 ? void 0 : sublink.label))));
|
|
75
|
+
}))));
|
|
76
|
+
}))))));
|
|
57
77
|
};
|
|
58
78
|
|
|
59
|
-
var QuickNavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding:
|
|
79
|
+
var QuickNavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n border-left: 2px solid ", ";\n"])), function (props) {
|
|
80
|
+
return props.theme.paddingTop;
|
|
81
|
+
}, function (props) {
|
|
82
|
+
return props.theme.paddingBottom;
|
|
83
|
+
}, function (props) {
|
|
84
|
+
return props.theme.paddingLeft;
|
|
85
|
+
}, function (props) {
|
|
86
|
+
return props.theme.paddingRight;
|
|
87
|
+
}, function (props) {
|
|
88
|
+
return props.theme.dividerBorderColor;
|
|
89
|
+
});
|
|
60
90
|
|
|
61
|
-
var
|
|
91
|
+
var ListColumn = _styledComponents["default"].ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n list-style-type: none;\n margin: 0;\n padding: 0;\n width: 100%;\n"])));
|
|
92
|
+
|
|
93
|
+
var ListRow = _styledComponents["default"].li(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n"])));
|
|
94
|
+
|
|
95
|
+
var Link = _styledComponents["default"].a(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n text-decoration: none;\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n display: block;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n width: fit-content;\n max-width: 100%;\n\n &:hover {\n color: ", ";\n }\n &:focus {\n outline-color: ", ";\n outline-style: ", ";\n outline-width: ", ";\n border-radius: ", ";\n }\n"])), function (props) {
|
|
96
|
+
return props.theme.fontSize;
|
|
97
|
+
}, function (props) {
|
|
98
|
+
return props.theme.fontFamily;
|
|
99
|
+
}, function (props) {
|
|
100
|
+
return props.theme.fontStyle;
|
|
101
|
+
}, function (props) {
|
|
102
|
+
return props.theme.fontWeight;
|
|
103
|
+
}, function (props) {
|
|
104
|
+
return props.theme.fontColor;
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.theme.hoverFontColor;
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.theme.focusBorderColor;
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return props.theme.focusBorderStyle;
|
|
111
|
+
}, function (props) {
|
|
112
|
+
return props.theme.focusBorderThickness;
|
|
113
|
+
}, function (props) {
|
|
114
|
+
return props.theme.focusBorderRadius;
|
|
115
|
+
});
|
|
62
116
|
|
|
63
117
|
var _default = DxcQuickNav;
|
|
64
118
|
exports["default"] = _default;
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import DxcQuickNav from "./QuickNav";
|
|
4
4
|
import DxcHeading from "../heading/Heading";
|
|
5
|
-
import
|
|
5
|
+
import DxcParagraph from "../paragraph/Paragraph";
|
|
6
6
|
import Title from "../../.storybook/components/Title";
|
|
7
7
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
8
8
|
|
|
@@ -23,14 +23,24 @@ const links = [
|
|
|
23
23
|
],
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
label: "Principles",
|
|
26
|
+
label: "Principles very very very very very very very very long",
|
|
27
27
|
id: "principles",
|
|
28
28
|
links: [
|
|
29
|
-
{ label: "Color", id: "color" },
|
|
30
|
-
{ label: "
|
|
29
|
+
{ label: "Color very very very very very very very very long", id: "color" },
|
|
30
|
+
{ label: "Spacingveryveryveryveryveryveryveryverylong", id: "spacing" },
|
|
31
31
|
{ label: "Typography", id: "typography" },
|
|
32
32
|
],
|
|
33
33
|
},
|
|
34
|
+
{
|
|
35
|
+
label: "Componentsveryveryveryveryveryveryveryverylong",
|
|
36
|
+
id: "components",
|
|
37
|
+
links: [
|
|
38
|
+
{
|
|
39
|
+
label: "Accordion",
|
|
40
|
+
id: "accordion",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
34
44
|
];
|
|
35
45
|
|
|
36
46
|
export const Chromatic = () => (
|
|
@@ -38,13 +48,19 @@ export const Chromatic = () => (
|
|
|
38
48
|
<ExampleContainer>
|
|
39
49
|
<Title title="Default" level={4} />
|
|
40
50
|
<QuickNavContainer>
|
|
41
|
-
<DxcQuickNav
|
|
51
|
+
<DxcQuickNav links={links}></DxcQuickNav>
|
|
42
52
|
</QuickNavContainer>
|
|
43
53
|
</ExampleContainer>
|
|
44
54
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
45
55
|
<Title title="Link hovered" level={4} />
|
|
46
56
|
<QuickNavContainer>
|
|
47
|
-
<DxcQuickNav
|
|
57
|
+
<DxcQuickNav links={links}></DxcQuickNav>
|
|
58
|
+
</QuickNavContainer>
|
|
59
|
+
</ExampleContainer>
|
|
60
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
61
|
+
<Title title="Link focus" level={4} />
|
|
62
|
+
<QuickNavContainer>
|
|
63
|
+
<DxcQuickNav links={links}></DxcQuickNav>
|
|
48
64
|
</QuickNavContainer>
|
|
49
65
|
</ExampleContainer>
|
|
50
66
|
<ExampleContainer>
|
|
@@ -53,7 +69,7 @@ export const Chromatic = () => (
|
|
|
53
69
|
<ContentContainer>
|
|
54
70
|
<Content id="overview">
|
|
55
71
|
<DxcHeading level={1} text="Overview" margin={{ bottom: "small" }} />
|
|
56
|
-
<
|
|
72
|
+
<DxcParagraph>
|
|
57
73
|
Halstack is the DXC Technology's open source design system for insurance products and digital experiences.
|
|
58
74
|
Our system provides all the tools and resources needed to create superior, beautiful but above all,
|
|
59
75
|
functional user experiences. Halstack is the DXC Technology's open source design system for insurance
|
|
@@ -70,10 +86,10 @@ export const Chromatic = () => (
|
|
|
70
86
|
create superior, beautiful but above all, functional user experiences.Halstack is the DXC Technology's
|
|
71
87
|
open source design system for insurance products and digital experiences. Our system provides all the
|
|
72
88
|
tools and resources needed to create superior, beautiful but above all, functional user experiences.
|
|
73
|
-
</
|
|
89
|
+
</DxcParagraph>
|
|
74
90
|
<Content id="introduction">
|
|
75
91
|
<DxcHeading level={2} text="Introduction" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
76
|
-
<
|
|
92
|
+
<DxcParagraph>
|
|
77
93
|
Design principles Halstack design principles are the fundamental part of DXC Technology's approach to
|
|
78
94
|
provide guidance for development teams in order to deliver delightful and consistent user experiences to
|
|
79
95
|
our customers: Balance Consistency Visual hierarchy All our components, design tokens, accessibility
|
|
@@ -103,14 +119,14 @@ export const Chromatic = () => (
|
|
|
103
119
|
to use and contribute back to. We are charmed to receive external contributions to help us find bugs,
|
|
104
120
|
design new features, or help us improve the project documentation. If you're interested, definitely
|
|
105
121
|
check out our contribution guidelines.
|
|
106
|
-
</
|
|
122
|
+
</DxcParagraph>
|
|
107
123
|
</Content>
|
|
108
124
|
</Content>
|
|
109
125
|
<Content id="principles">
|
|
110
126
|
<DxcHeading level={1} text="Principles" margin={{ top: "small", bottom: "xsmall" }} />
|
|
111
127
|
<Content id="color">
|
|
112
128
|
<DxcHeading level={2} text="Color" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
113
|
-
<
|
|
129
|
+
<DxcParagraph>
|
|
114
130
|
The color palette is an essential asset as a communication resource of our design system. Halstack color
|
|
115
131
|
palette brings a unified consistency and helps in guiding the user's perception order. Our color palette
|
|
116
132
|
is based in the HSL model . All our color families are calculated using the lightness value of the
|
|
@@ -143,11 +159,11 @@ export const Chromatic = () => (
|
|
|
143
159
|
tokens to manage color. Appart from a multi-purpose greyscale family, purple and blue are the core color
|
|
144
160
|
families used in our set of components. Additional families as red, green and yellow help as feedback
|
|
145
161
|
role-based color palettes and must not be used outside this context.
|
|
146
|
-
</
|
|
162
|
+
</DxcParagraph>
|
|
147
163
|
</Content>
|
|
148
164
|
<Content id="spacing">
|
|
149
165
|
<DxcHeading level={2} text="Spacing" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
150
|
-
<
|
|
166
|
+
<DxcParagraph>
|
|
151
167
|
In the search of consistent alignment between the elements we provide a spacing scale based on a root
|
|
152
168
|
values of 8px and 4px. The numbers 4 and 8 are easily multiplied, they provide flexible and consistent,
|
|
153
169
|
yet distinct enough, steps between them.In the search of consistent alignment between the elements we
|
|
@@ -165,11 +181,11 @@ export const Chromatic = () => (
|
|
|
165
181
|
consistent, yet distinct enough, steps between them.In the search of consistent alignment between the
|
|
166
182
|
elements we provide a spacing scale based on a root values of 8px and 4px. The numbers 4 and 8 are
|
|
167
183
|
easily multiplied, they provide flexible and consistent, yet distinct enough, steps between them.
|
|
168
|
-
</
|
|
184
|
+
</DxcParagraph>
|
|
169
185
|
</Content>
|
|
170
186
|
<Content id="typography">
|
|
171
187
|
<DxcHeading level={2} text="Typography" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
172
|
-
<
|
|
188
|
+
<DxcParagraph>
|
|
173
189
|
Our selected typography helps in structuring our user's experience based on the visual impact that it
|
|
174
190
|
has on the user interface content. It defines what is the first noticeable piece of information or data
|
|
175
191
|
based on the font shape, size, color, or type and it highlights some pieces of text over the rest. Some
|
|
@@ -201,7 +217,18 @@ export const Chromatic = () => (
|
|
|
201
217
|
Halstack Design System include headers, body, taglines, captions, and labels. Make sure you include all
|
|
202
218
|
the different typographic variants in order to enhance the application's content structure, including
|
|
203
219
|
the Heading component which defines different levels of page and section titles.
|
|
204
|
-
</
|
|
220
|
+
</DxcParagraph>
|
|
221
|
+
</Content>
|
|
222
|
+
</Content>
|
|
223
|
+
<Content id="components">
|
|
224
|
+
<DxcHeading level={1} text="Components" margin={{ top: "small", bottom: "xsmall" }} />
|
|
225
|
+
<Content id="accordion">
|
|
226
|
+
<DxcHeading level={2} text="Accordion" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
227
|
+
<DxcParagraph>
|
|
228
|
+
Accordions are used to group similar content and hide or show it depending on user needs or preferences.
|
|
229
|
+
Accordions give users more granular control over the interface and help digest content in stages, rather
|
|
230
|
+
than all at once.
|
|
231
|
+
</DxcParagraph>
|
|
205
232
|
</Content>
|
|
206
233
|
</Content>
|
|
207
234
|
</ContentContainer>
|
package/quick-nav/types.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ declare type Props = {
|
|
|
2
2
|
/**
|
|
3
3
|
* Title of the quick nav component.
|
|
4
4
|
*/
|
|
5
|
-
title
|
|
5
|
+
title?: string;
|
|
6
6
|
/**
|
|
7
7
|
* Links to be shown inside the quick nav component.
|
|
8
8
|
*/
|
|
9
|
-
links:
|
|
9
|
+
links: LinkType[];
|
|
10
10
|
};
|
|
11
|
-
declare type
|
|
11
|
+
declare type LinkType = {
|
|
12
12
|
/**
|
|
13
13
|
* Label to be shown in the link.
|
|
14
14
|
*/
|
|
@@ -16,6 +16,6 @@ declare type Link = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Sublinks of the link.
|
|
18
18
|
*/
|
|
19
|
-
links?:
|
|
19
|
+
links?: LinkType[];
|
|
20
20
|
};
|
|
21
21
|
export default Props;
|
package/radio-group/Radio.js
CHANGED
|
@@ -133,7 +133,7 @@ var Label = _styledComponents["default"].span(_templateObject6 || (_templateObje
|
|
|
133
133
|
}, function (props) {
|
|
134
134
|
return props.theme.radioInputLabelLineHeight;
|
|
135
135
|
}, function (props) {
|
|
136
|
-
return props.disabled
|
|
136
|
+
return props.disabled ? "color: ".concat(props.theme.disabledRadioInputLabelFontColor, "; pointer-events: none;") : "color: ".concat(props.theme.radioInputLabelFontColor);
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
var _default = /*#__PURE__*/_react["default"].memo(DxcRadio);
|
|
@@ -23,6 +23,8 @@ var _uuid = require("uuid");
|
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
27
|
+
|
|
26
28
|
var _Radio = _interopRequireDefault(require("./Radio"));
|
|
27
29
|
|
|
28
30
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
@@ -47,8 +49,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
47
49
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
48
50
|
_ref$optional = _ref.optional,
|
|
49
51
|
optional = _ref$optional === void 0 ? false : _ref$optional,
|
|
50
|
-
|
|
51
|
-
optionalItemLabel = _ref$optionalItemLabe === void 0 ? "N/A" : _ref$optionalItemLabe,
|
|
52
|
+
optionalItemLabel = _ref.optionalItemLabel,
|
|
52
53
|
_ref$readonly = _ref.readonly,
|
|
53
54
|
readonly = _ref$readonly === void 0 ? false : _ref$readonly,
|
|
54
55
|
_ref$stacking = _ref.stacking,
|
|
@@ -78,8 +79,10 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
78
79
|
firstTimeFocus = _useState6[0],
|
|
79
80
|
setFirstTimeFocus = _useState6[1];
|
|
80
81
|
|
|
82
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
83
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
81
84
|
var optionalItem = {
|
|
82
|
-
label: optionalItemLabel,
|
|
85
|
+
label: optionalItemLabel || translatedLabels.radioGroup.optionalItemLabelDefault,
|
|
83
86
|
value: "",
|
|
84
87
|
disabled: disabled
|
|
85
88
|
};
|
|
@@ -92,7 +95,6 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
92
95
|
currentFocusIndex = _useState8[0],
|
|
93
96
|
setCurrentFocusIndex = _useState8[1];
|
|
94
97
|
|
|
95
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
96
98
|
var handleOnChange = (0, _react.useCallback)(function (newValue) {
|
|
97
99
|
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
98
100
|
|
|
@@ -109,7 +111,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
109
111
|
var currentValue = value !== null && value !== void 0 ? value : innerValue;
|
|
110
112
|
!optional && !Boolean(currentValue) ? onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
111
113
|
value: currentValue,
|
|
112
|
-
error:
|
|
114
|
+
error: translatedLabels.formFields.requiredSelectionErrorMessage
|
|
113
115
|
}) : onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
|
114
116
|
value: currentValue
|
|
115
117
|
});
|
|
@@ -182,7 +184,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
182
184
|
id: radioGroupLabelId,
|
|
183
185
|
helperText: helperText,
|
|
184
186
|
disabled: disabled
|
|
185
|
-
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null,
|
|
187
|
+
}, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
186
188
|
disabled: disabled
|
|
187
189
|
}, helperText), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
|
|
188
190
|
onBlur: handleOnBlur,
|
|
@@ -214,7 +216,8 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
|
|
|
214
216
|
disabled: option.disabled || disabled,
|
|
215
217
|
focused: currentFocusIndex === index,
|
|
216
218
|
readonly: readonly,
|
|
217
|
-
tabIndex: tabIndex
|
|
219
|
+
tabIndex: tabIndex,
|
|
220
|
+
key: "radio-".concat(index)
|
|
218
221
|
});
|
|
219
222
|
})), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
|
|
220
223
|
id: errorId,
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
6
|
+
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
|
|
5
9
|
var _react = _interopRequireDefault(require("react"));
|
|
6
10
|
|
|
7
11
|
var _react2 = require("@testing-library/react");
|
|
@@ -10,6 +14,44 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
|
10
14
|
|
|
11
15
|
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable"));
|
|
12
16
|
|
|
17
|
+
// Mocking DOMRect for Radix Primitive Popover
|
|
18
|
+
global.globalThis = global;
|
|
19
|
+
|
|
20
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
21
|
+
function ResizeObserver(cb) {
|
|
22
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
23
|
+
this.cb = cb;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
(0, _createClass2["default"])(ResizeObserver, [{
|
|
27
|
+
key: "observe",
|
|
28
|
+
value: function observe() {
|
|
29
|
+
this.cb([{
|
|
30
|
+
borderBoxSize: {
|
|
31
|
+
inlineSize: 0,
|
|
32
|
+
blockSize: 0
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "unobserve",
|
|
38
|
+
value: function unobserve() {}
|
|
39
|
+
}]);
|
|
40
|
+
return ResizeObserver;
|
|
41
|
+
}();
|
|
42
|
+
|
|
43
|
+
global.DOMRect = {
|
|
44
|
+
fromRect: function fromRect() {
|
|
45
|
+
return {
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
right: 0,
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
13
55
|
var columns = [{
|
|
14
56
|
displayValue: "Id",
|
|
15
57
|
isSortable: false
|
package/select/Listbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ListboxProps } from "./types";
|
|
3
|
-
declare const _default: React.MemoExoticComponent<
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ id, currentValue, options, visualFocusIndex, lastOptionIndex, multiple, optional, optionalItem, searchable, handleOptionOnClick, styles, }: ListboxProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
package/select/Listbox.js
CHANGED
|
@@ -11,12 +11,14 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
-
var _react =
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
17
|
|
|
18
18
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
19
|
|
|
20
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
21
|
+
|
|
20
22
|
var _Option = _interopRequireDefault(require("./Option"));
|
|
21
23
|
|
|
22
24
|
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
@@ -35,7 +37,7 @@ var groupsHaveOptions = function groupsHaveOptions(options) {
|
|
|
35
37
|
}) : true;
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
var Listbox =
|
|
40
|
+
var Listbox = function Listbox(_ref) {
|
|
39
41
|
var id = _ref.id,
|
|
40
42
|
currentValue = _ref.currentValue,
|
|
41
43
|
options = _ref.options,
|
|
@@ -45,8 +47,11 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
45
47
|
optional = _ref.optional,
|
|
46
48
|
optionalItem = _ref.optionalItem,
|
|
47
49
|
searchable = _ref.searchable,
|
|
48
|
-
handleOptionOnClick = _ref.handleOptionOnClick
|
|
50
|
+
handleOptionOnClick = _ref.handleOptionOnClick,
|
|
51
|
+
styles = _ref.styles;
|
|
49
52
|
var colorsTheme = (0, _useTheme["default"])();
|
|
53
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
54
|
+
var listboxRef = (0, _react.useRef)(null);
|
|
50
55
|
var globalIndex = optional && !multiple ? 0 : -1; // index for options, starting from 0 to options.length -1
|
|
51
56
|
|
|
52
57
|
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
@@ -89,6 +94,26 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
89
94
|
}
|
|
90
95
|
};
|
|
91
96
|
|
|
97
|
+
(0, _react.useLayoutEffect)(function () {
|
|
98
|
+
if (currentValue && !multiple) {
|
|
99
|
+
var _listEl$scrollTo;
|
|
100
|
+
|
|
101
|
+
var listEl = listboxRef === null || listboxRef === void 0 ? void 0 : listboxRef.current;
|
|
102
|
+
var selectedListOptionEl = listEl === null || listEl === void 0 ? void 0 : listEl.querySelector("[aria-selected='true']");
|
|
103
|
+
listEl === null || listEl === void 0 ? void 0 : (_listEl$scrollTo = listEl.scrollTo) === null || _listEl$scrollTo === void 0 ? void 0 : _listEl$scrollTo.call(listEl, {
|
|
104
|
+
top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, [currentValue, multiple]);
|
|
108
|
+
(0, _react.useLayoutEffect)(function () {
|
|
109
|
+
var _listboxRef$current, _visualFocusedOptionE;
|
|
110
|
+
|
|
111
|
+
var visualFocusedOptionEl = listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
112
|
+
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
113
|
+
block: "nearest",
|
|
114
|
+
inline: "start"
|
|
115
|
+
});
|
|
116
|
+
}, [visualFocusIndex]);
|
|
92
117
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
93
118
|
theme: colorsTheme.select
|
|
94
119
|
}, /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
@@ -99,11 +124,13 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
99
124
|
onMouseDown: function onMouseDown(event) {
|
|
100
125
|
event.preventDefault();
|
|
101
126
|
},
|
|
102
|
-
ref:
|
|
127
|
+
ref: listboxRef,
|
|
103
128
|
role: "listbox",
|
|
104
129
|
"aria-multiselectable": multiple,
|
|
105
|
-
"aria-orientation": "vertical"
|
|
106
|
-
|
|
130
|
+
"aria-orientation": "vertical",
|
|
131
|
+
style: styles
|
|
132
|
+
}, searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, _Icons["default"].searchOff), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
133
|
+
key: "option-".concat(optionalItem.value),
|
|
107
134
|
id: "option-".concat(0),
|
|
108
135
|
option: optionalItem,
|
|
109
136
|
onClick: handleOptionOnClick,
|
|
@@ -113,9 +140,9 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
113
140
|
isLastOption: lastOptionIndex === 0,
|
|
114
141
|
isSelected: multiple ? currentValue.includes(optionalItem.value) : currentValue === optionalItem.value
|
|
115
142
|
}), options.map(mapOptionFunc)));
|
|
116
|
-
}
|
|
143
|
+
};
|
|
117
144
|
|
|
118
|
-
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
145
|
+
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 304px;\n overflow-y: auto;\n margin: 0;\n padding: 0.25rem 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
119
146
|
return props.theme.listDialogBackgroundColor;
|
|
120
147
|
}, function (props) {
|
|
121
148
|
return props.theme.listDialogBorderColor;
|