@dxc-technology/halstack-react 0.0.0-7ffdc43 → 0.0.0-824a373
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/accordion/Accordion.js +122 -103
- package/accordion/Accordion.stories.tsx +1 -2
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +1 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/box/Box.js +1 -1
- package/box/types.d.ts +1 -0
- package/bulleted-list/types.d.ts +1 -1
- package/button/types.d.ts +1 -1
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/types.d.ts +1 -1
- package/common/variables.js +26 -14
- package/date-input/DateInput.js +3 -3
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +244 -247
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +509 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +173 -217
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +31 -19
- package/flex/types.d.ts +15 -4
- package/footer/Footer.stories.tsx +8 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/layout/ApplicationLayout.stories.tsx +1 -0
- package/link/types.d.ts +1 -1
- package/number-input/NumberInput.test.js +38 -1
- package/package.json +10 -10
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.test.js +1 -1
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +11 -12
- package/quick-nav/QuickNav.stories.tsx +97 -19
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +24 -24
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.js +1 -3
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +25 -2
- package/select/Select.js +17 -32
- package/select/Select.stories.tsx +6 -5
- package/select/Select.test.js +321 -250
- package/select/types.d.ts +2 -4
- package/sidenav/types.d.ts +1 -1
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +74 -0
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.js +5 -5
- package/tabs-nav/Tab.js +3 -5
- package/tabs-nav/types.d.ts +1 -1
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +7 -5
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +189 -282
- package/text-input/TextInput.stories.tsx +189 -182
- package/text-input/TextInput.test.js +222 -163
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -1
- package/wizard/types.d.ts +1 -1
|
@@ -13,19 +13,19 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
+
|
|
16
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
19
|
|
|
18
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
21
|
|
|
20
|
-
var _LinearProgress = _interopRequireDefault(require("@material-ui/core/LinearProgress"));
|
|
21
|
-
|
|
22
22
|
var _variables = require("../common/variables.js");
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
26
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
27
27
|
|
|
28
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
28
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
29
29
|
|
|
30
30
|
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); }
|
|
31
31
|
|
|
@@ -44,72 +44,56 @@ var DxcProgressBar = function DxcProgressBar(_ref) {
|
|
|
44
44
|
margin = _ref.margin;
|
|
45
45
|
var colorsTheme = (0, _useTheme["default"])();
|
|
46
46
|
var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
|
|
47
|
+
|
|
48
|
+
var _useState = (0, _react.useState)(0),
|
|
49
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
50
|
+
valueProgressBar = _useState2[0],
|
|
51
|
+
setValueProgressBar = _useState2[1];
|
|
52
|
+
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
setValueProgressBar(value === null || value === undefined || value < 0 ? 0 : value >= 0 && value <= 100 ? value : 100);
|
|
55
|
+
}, [value]);
|
|
47
56
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
48
57
|
theme: colorsTheme.progressBar
|
|
49
58
|
}, /*#__PURE__*/_react["default"].createElement(BackgroundProgressBar, {
|
|
50
59
|
overlay: overlay
|
|
51
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement(ProgressBarContainer, {
|
|
52
61
|
overlay: overlay,
|
|
53
|
-
margin: margin
|
|
54
|
-
backgroundType: backgroundType
|
|
62
|
+
margin: margin
|
|
55
63
|
}, /*#__PURE__*/_react["default"].createElement(InfoProgressBar, null, /*#__PURE__*/_react["default"].createElement(ProgressBarLabel, {
|
|
56
64
|
overlay: overlay,
|
|
57
|
-
backgroundType: backgroundType
|
|
65
|
+
backgroundType: backgroundType,
|
|
66
|
+
"aria-label": label || undefined
|
|
58
67
|
}, label), /*#__PURE__*/_react["default"].createElement(ProgressBarProgress, {
|
|
59
68
|
overlay: overlay,
|
|
60
69
|
showValue: showValue,
|
|
61
|
-
backgroundType: backgroundType
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
backgroundType: backgroundType,
|
|
71
|
+
value: valueProgressBar
|
|
72
|
+
}, valueProgressBar, " %")), /*#__PURE__*/_react["default"].createElement(LinearProgress, {
|
|
73
|
+
role: "progressbar",
|
|
74
|
+
helperText: helperText,
|
|
75
|
+
"aria-valuenow": showValue ? valueProgressBar : undefined
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement(LinearProgressBar, {
|
|
77
|
+
backgroundType: backgroundType,
|
|
78
|
+
variant: value === null || value === undefined ? "indeterminate" : "determinate",
|
|
79
|
+
container: "first",
|
|
80
|
+
value: valueProgressBar
|
|
81
|
+
})), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
|
|
66
82
|
overlay: overlay,
|
|
67
83
|
backgroundType: backgroundType
|
|
68
84
|
}, helperText))));
|
|
69
85
|
};
|
|
70
86
|
|
|
71
|
-
var BackgroundProgressBar = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
75
|
-
}, function (props) {
|
|
76
|
-
return props.overlay === true ? "100%" : "";
|
|
77
|
-
}, function (props) {
|
|
78
|
-
return props.overlay === true ? "center" : "";
|
|
79
|
-
}, function (props) {
|
|
80
|
-
return props.overlay === true ? "100vh" : "";
|
|
81
|
-
}, function (props) {
|
|
82
|
-
return props.overlay === true ? "center" : "";
|
|
83
|
-
}, function (props) {
|
|
84
|
-
return props.overlay === true ? "100%" : "";
|
|
85
|
-
}, function (props) {
|
|
86
|
-
return props.overlay === true ? "fixed" : "";
|
|
87
|
-
}, function (props) {
|
|
88
|
-
return props.overlay === true ? "0" : "";
|
|
89
|
-
}, function (props) {
|
|
90
|
-
return props.overlay === true ? "0" : "";
|
|
91
|
-
}, function (props) {
|
|
92
|
-
return props.overlay === true ? "0" : "";
|
|
93
|
-
}, function (props) {
|
|
94
|
-
return props.overlay === true ? "0" : "";
|
|
95
|
-
}, function (props) {
|
|
96
|
-
return props.overlay ? 1300 : "";
|
|
87
|
+
var BackgroundProgressBar = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n display: flex;\n flex-wrap: wrap;\n min-width: 100px;\n width: 100%;\n"])), function (_ref2) {
|
|
88
|
+
var overlay = _ref2.overlay,
|
|
89
|
+
theme = _ref2.theme;
|
|
90
|
+
return overlay ? "background-color: ".concat(theme.overlayColor, ";\n opacity: 0.8;\n width: 100%;\n justify-content: center;\n height: 100vh;\n align-items: center;\n max-width: 100%;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1300;") : "background-color: \"transparent\";";
|
|
97
91
|
});
|
|
98
92
|
|
|
99
|
-
var
|
|
93
|
+
var ProgressBarContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: ", ";\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
100
94
|
return props.overlay === true && "100" || "0";
|
|
101
95
|
}, function (props) {
|
|
102
96
|
return props.overlay === true ? "80%" : "100%";
|
|
103
|
-
}, function (props) {
|
|
104
|
-
return props.theme.thickness;
|
|
105
|
-
}, function (props) {
|
|
106
|
-
return props.theme.totalLineColor;
|
|
107
|
-
}, function (props) {
|
|
108
|
-
return props.theme.borderRadius;
|
|
109
|
-
}, function (props) {
|
|
110
|
-
return props.helperText !== "" && "8px";
|
|
111
|
-
}, function (props) {
|
|
112
|
-
return props.backgroundType === "dark" ? props.theme.trackLineColorOnDark : props.theme.trackLineColor;
|
|
113
97
|
}, function (props) {
|
|
114
98
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
115
99
|
}, function (props) {
|
|
@@ -151,7 +135,7 @@ var ProgressBarProgress = _styledComponents["default"].div(_templateObject5 || (
|
|
|
151
135
|
}, function (props) {
|
|
152
136
|
return props.backgroundType === "dark" ? props.theme.valueFontColorOnDark : props.overlay === true ? "#FFFFFF" : props.theme.valueFontColor;
|
|
153
137
|
}, function (props) {
|
|
154
|
-
return props.value !==
|
|
138
|
+
return props.value !== undefined && props.value !== null && props.showValue === true && "block" || "none";
|
|
155
139
|
});
|
|
156
140
|
|
|
157
141
|
var HelperText = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5em;\n"])), function (props) {
|
|
@@ -166,5 +150,27 @@ var HelperText = _styledComponents["default"].span(_templateObject6 || (_templat
|
|
|
166
150
|
return props.theme.helperTextFontWeight;
|
|
167
151
|
});
|
|
168
152
|
|
|
153
|
+
var LinearProgress = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n background-color: ", ";\n border-radius: ", ";\n margin-bottom: ", ";\n overflow: hidden;\n position: relative;\n"])), function (props) {
|
|
154
|
+
return props.theme.thickness;
|
|
155
|
+
}, function (props) {
|
|
156
|
+
return props.theme.totalLineColor;
|
|
157
|
+
}, function (props) {
|
|
158
|
+
return props.theme.borderRadius;
|
|
159
|
+
}, function (props) {
|
|
160
|
+
return props.helperText !== "" && "8px";
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
var LinearProgressBar = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n transform: ", ";\n top: 0;\n left: 0;\n width: 100%;\n bottom: 0;\n position: absolute;\n transition: ", ";\n transform-origin: left;\n ", ";\n ", ";\n\n @keyframes keyframes-indeterminate-first {\n 0% {\n left: -35%;\n right: 100%;\n }\n 60% {\n left: 100%;\n right: -90%;\n }\n 100% {\n left: 100%;\n right: -90%;\n }\n }\n\n @keyframes keyframes-indeterminate-second {\n 0% {\n left: -200%;\n right: 100%;\n }\n 60% {\n left: 107%;\n right: -8%;\n }\n 100% {\n left: 107%;\n right: -8%;\n }\n }\n"])), function (props) {
|
|
164
|
+
return props.backgroundType === "dark" ? props.theme.trackLineColorOnDark : props.theme.trackLineColor;
|
|
165
|
+
}, function (props) {
|
|
166
|
+
return "translateX(-".concat(props.variant === "determinate" ? 100 - props.value : 0, "%)");
|
|
167
|
+
}, function (props) {
|
|
168
|
+
return props.variant === "determinate" ? "transform .4s linear" : "transform 0.2s linear";
|
|
169
|
+
}, function (props) {
|
|
170
|
+
return props.variant === "indeterminate" && "width: auto;";
|
|
171
|
+
}, function (props) {
|
|
172
|
+
return props.variant === "indeterminate" ? props.container === "first" ? "animation: keyframes-indeterminate-first 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;" : "animation: keyframes-indeterminate-second 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;" : "";
|
|
173
|
+
});
|
|
174
|
+
|
|
169
175
|
var _default = DxcProgressBar;
|
|
170
176
|
exports["default"] = _default;
|
|
@@ -14,9 +14,11 @@ export const Chromatic = () => (
|
|
|
14
14
|
<Title title="Without labels" theme="light" level={4} />
|
|
15
15
|
<DxcProgressBar value={50} showValue />
|
|
16
16
|
<Title title="With helperText" theme="light" level={4} />
|
|
17
|
-
<DxcProgressBar helperText="Helper text" value={
|
|
17
|
+
<DxcProgressBar helperText="Helper text" value={24} showValue />
|
|
18
18
|
<Title title="Without default value" theme="light" level={4} />
|
|
19
19
|
<DxcProgressBar label="Loading..." showValue />
|
|
20
|
+
<Title title="With full value" theme="light" level={4} />
|
|
21
|
+
<DxcProgressBar label="Loading..." value={100} showValue />
|
|
20
22
|
</ExampleContainer>
|
|
21
23
|
<Title title="Margins" theme="light" level={2} />
|
|
22
24
|
<ExampleContainer>
|
|
@@ -9,57 +9,102 @@ var _react2 = require("@testing-library/react");
|
|
|
9
9
|
var _ProgressBar = _interopRequireDefault(require("./ProgressBar"));
|
|
10
10
|
|
|
11
11
|
describe("ProgressBar component tests", function () {
|
|
12
|
-
test("ProgressBar renders with label", function () {
|
|
12
|
+
test("ProgressBar renders with label and helperText", function () {
|
|
13
13
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], {
|
|
14
|
-
label: "test-label"
|
|
14
|
+
label: "test-label",
|
|
15
|
+
helperText: "helper-text"
|
|
15
16
|
})),
|
|
16
17
|
getByText = _render.getByText;
|
|
17
18
|
|
|
18
19
|
expect(getByText("test-label")).toBeTruthy();
|
|
20
|
+
expect(getByText("helper-text")).toBeTruthy();
|
|
19
21
|
});
|
|
20
|
-
test("
|
|
22
|
+
test("ProgressBar renders with default value", function () {
|
|
23
|
+
var value = 0;
|
|
24
|
+
|
|
21
25
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], {
|
|
22
|
-
|
|
23
|
-
overlay: true
|
|
26
|
+
showValue: true
|
|
24
27
|
})),
|
|
25
|
-
getByText = _render2.getByText
|
|
28
|
+
getByText = _render2.getByText,
|
|
29
|
+
getByRole = _render2.getByRole;
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
var progressBar = getByRole("progressbar");
|
|
32
|
+
expect(getByText("0 %")).toBeTruthy();
|
|
33
|
+
expect(progressBar.getAttribute("aria-valuenow")).toEqual(value.toString());
|
|
28
34
|
});
|
|
29
|
-
test("ProgressBar renders with
|
|
35
|
+
test("ProgressBar renders with value", function () {
|
|
36
|
+
var value = 25;
|
|
37
|
+
|
|
30
38
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], {
|
|
31
|
-
showValue: true
|
|
39
|
+
showValue: true,
|
|
40
|
+
value: value
|
|
32
41
|
})),
|
|
33
|
-
getByText = _render3.getByText
|
|
42
|
+
getByText = _render3.getByText,
|
|
43
|
+
getByRole = _render3.getByRole;
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
var progressBar = getByRole("progressbar");
|
|
46
|
+
expect(getByText("25 %")).toBeTruthy();
|
|
47
|
+
expect(progressBar.getAttribute("aria-valuenow")).toEqual(value.toString());
|
|
36
48
|
});
|
|
37
|
-
test("
|
|
49
|
+
test("ProgressBar renders with negative value", function () {
|
|
50
|
+
var value = 0;
|
|
51
|
+
|
|
38
52
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], {
|
|
39
53
|
showValue: true,
|
|
40
|
-
|
|
54
|
+
value: -20
|
|
41
55
|
})),
|
|
42
|
-
getByText = _render4.getByText
|
|
56
|
+
getByText = _render4.getByText,
|
|
57
|
+
getByRole = _render4.getByRole;
|
|
43
58
|
|
|
59
|
+
var progressBar = getByRole("progressbar");
|
|
44
60
|
expect(getByText("0 %")).toBeTruthy();
|
|
61
|
+
expect(progressBar.getAttribute("aria-valuenow")).toEqual(value.toString());
|
|
45
62
|
});
|
|
46
|
-
test("ProgressBar renders
|
|
47
|
-
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"],
|
|
63
|
+
test("ProgressBar renders as indeterminate", function () {
|
|
64
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], null)),
|
|
65
|
+
getByRole = _render5.getByRole;
|
|
66
|
+
|
|
67
|
+
var progressBar = getByRole("progressbar");
|
|
68
|
+
expect(progressBar.getAttribute("aria-valuenow")).toBe(null);
|
|
69
|
+
});
|
|
70
|
+
test("Overlay progressBar renders with label and helperText", function () {
|
|
71
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], {
|
|
72
|
+
label: "test-label",
|
|
73
|
+
helperText: "helper-text",
|
|
74
|
+
overlay: true
|
|
75
|
+
})),
|
|
76
|
+
getByText = _render6.getByText;
|
|
77
|
+
|
|
78
|
+
expect(getByText("test-label")).toBeTruthy();
|
|
79
|
+
expect(getByText("helper-text")).toBeTruthy();
|
|
80
|
+
});
|
|
81
|
+
test("Overlay progressBar renders with default value", function () {
|
|
82
|
+
var value = 0;
|
|
83
|
+
|
|
84
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], {
|
|
48
85
|
showValue: true,
|
|
49
|
-
|
|
86
|
+
overlay: true
|
|
50
87
|
})),
|
|
51
|
-
getByText =
|
|
88
|
+
getByText = _render7.getByText,
|
|
89
|
+
getByRole = _render7.getByRole;
|
|
52
90
|
|
|
53
|
-
|
|
91
|
+
var progressBar = getByRole("progressbar");
|
|
92
|
+
expect(getByText("0 %")).toBeTruthy();
|
|
93
|
+
expect(progressBar.getAttribute("aria-valuenow")).toEqual(value.toString());
|
|
54
94
|
});
|
|
55
95
|
test("Overlay progressBar renders with value", function () {
|
|
56
|
-
var
|
|
96
|
+
var value = 25;
|
|
97
|
+
|
|
98
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], {
|
|
57
99
|
showValue: true,
|
|
58
|
-
value:
|
|
100
|
+
value: value,
|
|
59
101
|
overlay: true
|
|
60
102
|
})),
|
|
61
|
-
getByText =
|
|
103
|
+
getByText = _render8.getByText,
|
|
104
|
+
getByRole = _render8.getByRole;
|
|
62
105
|
|
|
106
|
+
var progressBar = getByRole("progressbar");
|
|
63
107
|
expect(getByText("25 %")).toBeTruthy();
|
|
108
|
+
expect(progressBar.getAttribute("aria-valuenow")).toEqual(value.toString());
|
|
64
109
|
});
|
|
65
110
|
});
|
package/progress-bar/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
-
declare type Size = {
|
|
1
|
+
export declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
export declare type Size = {
|
|
3
3
|
top?: Space;
|
|
4
4
|
bottom?: Space;
|
|
5
5
|
left?: Space;
|
|
6
6
|
right?: Space;
|
|
7
7
|
};
|
|
8
|
-
declare type Props = {
|
|
8
|
+
export declare type Props = {
|
|
9
9
|
/**
|
|
10
10
|
* Text to be placed above the progress bar.
|
|
11
11
|
*/
|
|
@@ -34,4 +34,3 @@ declare type Props = {
|
|
|
34
34
|
*/
|
|
35
35
|
margin?: Space | Size;
|
|
36
36
|
};
|
|
37
|
-
export default Props;
|
package/quick-nav/QuickNav.js
CHANGED
|
@@ -48,13 +48,10 @@ var DxcQuickNav = function DxcQuickNav(_ref) {
|
|
|
48
48
|
}, /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
49
49
|
level: 4,
|
|
50
50
|
text: title || translatedLabels.quickNav.contentTitle
|
|
51
|
-
}), /*#__PURE__*/_react["default"].createElement(ListColumn, null,
|
|
52
|
-
direction: "column",
|
|
53
|
-
gap: "0.5rem"
|
|
54
|
-
}, links.map(function (link) {
|
|
51
|
+
}), /*#__PURE__*/_react["default"].createElement(ListColumn, null, links.map(function (link) {
|
|
55
52
|
var _link$links;
|
|
56
53
|
|
|
57
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
54
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
58
55
|
key: link.label
|
|
59
56
|
}, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
|
|
60
57
|
space: "0.25rem"
|
|
@@ -62,18 +59,20 @@ var DxcQuickNav = function DxcQuickNav(_ref) {
|
|
|
62
59
|
href: "#".concat((0, _slugify["default"])(link === null || link === void 0 ? void 0 : link.label, {
|
|
63
60
|
lower: true
|
|
64
61
|
}))
|
|
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) {
|
|
66
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
62
|
+
}, link === null || link === void 0 ? void 0 : link.label), /*#__PURE__*/_react["default"].createElement(ListSecondColumn, null, (_link$links = link.links) === null || _link$links === void 0 ? void 0 : _link$links.map(function (sublink) {
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
67
64
|
key: sublink.label
|
|
68
65
|
}, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
|
|
69
66
|
horizontal: "0.5rem"
|
|
70
67
|
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
|
|
71
|
-
href: "#".concat((0, _slugify["default"])(
|
|
68
|
+
href: "#".concat((0, _slugify["default"])(link === null || link === void 0 ? void 0 : link.label, {
|
|
69
|
+
lower: true
|
|
70
|
+
}), "-").concat((0, _slugify["default"])(sublink === null || sublink === void 0 ? void 0 : sublink.label, {
|
|
72
71
|
lower: true
|
|
73
72
|
}))
|
|
74
73
|
}, sublink === null || sublink === void 0 ? void 0 : sublink.label))));
|
|
75
|
-
}))));
|
|
76
|
-
})))))
|
|
74
|
+
})))));
|
|
75
|
+
})))));
|
|
77
76
|
};
|
|
78
77
|
|
|
79
78
|
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) {
|
|
@@ -88,9 +87,9 @@ var QuickNavContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
88
87
|
return props.theme.dividerBorderColor;
|
|
89
88
|
});
|
|
90
89
|
|
|
91
|
-
var ListColumn = _styledComponents["default"].ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
90
|
+
var ListColumn = _styledComponents["default"].ul(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n margin: 0;\n padding: 0;\n list-style-type: none;\n"])));
|
|
92
91
|
|
|
93
|
-
var
|
|
92
|
+
var ListSecondColumn = _styledComponents["default"].ul(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n list-style-type: none;\n"])));
|
|
94
93
|
|
|
95
94
|
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
95
|
return props.theme.fontSize;
|
|
@@ -11,33 +11,60 @@ export default {
|
|
|
11
11
|
component: DxcQuickNav,
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
const defaultLinks = [
|
|
15
|
+
{
|
|
16
|
+
label: "Overview",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "Principles",
|
|
20
|
+
links: [{ label: "Color" }, { label: "Spacing" }, { label: "Typography" }],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "Components",
|
|
24
|
+
links: [
|
|
25
|
+
{
|
|
26
|
+
label: "Accordion",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: "Button",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
14
35
|
const links = [
|
|
15
36
|
{
|
|
16
37
|
label: "Overview",
|
|
17
|
-
id: "overview",
|
|
18
38
|
links: [
|
|
19
39
|
{
|
|
20
40
|
label: "Introduction",
|
|
21
|
-
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Components",
|
|
46
|
+
links: [
|
|
47
|
+
{
|
|
48
|
+
label: "Introduction",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "Accordion",
|
|
22
52
|
},
|
|
23
53
|
],
|
|
24
54
|
},
|
|
25
55
|
{
|
|
26
56
|
label: "Principles very very very very very very very very long",
|
|
27
|
-
id: "principles",
|
|
28
57
|
links: [
|
|
29
|
-
{ label: "Color very very very very very very very very long"
|
|
30
|
-
{ label: "Spacingveryveryveryveryveryveryveryverylong"
|
|
31
|
-
{ label: "Typography"
|
|
58
|
+
{ label: "Color very very very very very very very very long" },
|
|
59
|
+
{ label: "Spacingveryveryveryveryveryveryveryverylong" },
|
|
60
|
+
{ label: "Typography" },
|
|
32
61
|
],
|
|
33
62
|
},
|
|
34
63
|
{
|
|
35
64
|
label: "Componentsveryveryveryveryveryveryveryverylong",
|
|
36
|
-
id: "components",
|
|
37
65
|
links: [
|
|
38
66
|
{
|
|
39
67
|
label: "Accordion",
|
|
40
|
-
id: "accordion",
|
|
41
68
|
},
|
|
42
69
|
],
|
|
43
70
|
},
|
|
@@ -48,19 +75,25 @@ export const Chromatic = () => (
|
|
|
48
75
|
<ExampleContainer>
|
|
49
76
|
<Title title="Default" level={4} />
|
|
50
77
|
<QuickNavContainer>
|
|
51
|
-
<DxcQuickNav links={
|
|
78
|
+
<DxcQuickNav links={defaultLinks} />
|
|
79
|
+
</QuickNavContainer>
|
|
80
|
+
</ExampleContainer>
|
|
81
|
+
<ExampleContainer>
|
|
82
|
+
<Title title="Text overflow" level={4} />
|
|
83
|
+
<QuickNavContainer>
|
|
84
|
+
<DxcQuickNav links={links} />
|
|
52
85
|
</QuickNavContainer>
|
|
53
86
|
</ExampleContainer>
|
|
54
87
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
55
88
|
<Title title="Link hovered" level={4} />
|
|
56
89
|
<QuickNavContainer>
|
|
57
|
-
<DxcQuickNav links={links}
|
|
90
|
+
<DxcQuickNav links={links} />
|
|
58
91
|
</QuickNavContainer>
|
|
59
92
|
</ExampleContainer>
|
|
60
93
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
61
94
|
<Title title="Link focus" level={4} />
|
|
62
95
|
<QuickNavContainer>
|
|
63
|
-
<DxcQuickNav links={links}
|
|
96
|
+
<DxcQuickNav links={links} />
|
|
64
97
|
</QuickNavContainer>
|
|
65
98
|
</ExampleContainer>
|
|
66
99
|
<ExampleContainer>
|
|
@@ -87,7 +120,44 @@ export const Chromatic = () => (
|
|
|
87
120
|
open source design system for insurance products and digital experiences. Our system provides all the
|
|
88
121
|
tools and resources needed to create superior, beautiful but above all, functional user experiences.
|
|
89
122
|
</DxcParagraph>
|
|
90
|
-
<Content id="introduction">
|
|
123
|
+
<Content id="overview-introduction">
|
|
124
|
+
<DxcHeading level={2} text="Introduction" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
125
|
+
<DxcParagraph>
|
|
126
|
+
Design principles Halstack design principles are the fundamental part of DXC Technology's approach to
|
|
127
|
+
provide guidance for development teams in order to deliver delightful and consistent user experiences to
|
|
128
|
+
our customers: Balance Consistency Visual hierarchy All our components, design tokens, accessibility
|
|
129
|
+
guidelines, responsive design techniques, and layout proposals have been carefully curated by DXC design
|
|
130
|
+
and engineering teams with the objective of creating a unique visual language and ecosystem for our
|
|
131
|
+
applications. This is the DXC way of creating User Experiences. Open Source Halstack is an open source
|
|
132
|
+
design system, this means that we work towards DXC Technology bussines needs, but it is open for anyone
|
|
133
|
+
to use and contribute back to. We are charmed to receive external contributions to help us find bugs,
|
|
134
|
+
design new features, or help us improve the project documentation. If you're interested, definitely
|
|
135
|
+
check out our contribution guidelines.Design principles Halstack design principles are the fundamental
|
|
136
|
+
part of DXC Technology's approach to provide guidance for development teams in order to deliver
|
|
137
|
+
delightful and consistent user experiences to our customers: Balance Consistency Visual hierarchy All
|
|
138
|
+
our components, design tokens, accessibility guidelines, responsive design techniques, and layout
|
|
139
|
+
proposals have been carefully curated by DXC design and engineering teams with the objective of creating
|
|
140
|
+
a unique visual language and ecosystem for our applications. This is the DXC way of creating User
|
|
141
|
+
Experiences. Open Source Halstack is an open source design system, this means that we work towards DXC
|
|
142
|
+
Technology bussines needs, but it is open for anyone to use and contribute back to. We are charmed to
|
|
143
|
+
receive external contributions to help us find bugs, design new features, or help us improve the project
|
|
144
|
+
documentation. If you're interested, definitely check out our contribution guidelines.Design principles
|
|
145
|
+
Halstack design principles are the fundamental part of DXC Technology's approach to provide guidance for
|
|
146
|
+
development teams in order to deliver delightful and consistent user experiences to our customers:
|
|
147
|
+
Balance Consistency Visual hierarchy All our components, design tokens, accessibility guidelines,
|
|
148
|
+
responsive design techniques, and layout proposals have been carefully curated by DXC design and
|
|
149
|
+
engineering teams with the objective of creating a unique visual language and ecosystem for our
|
|
150
|
+
applications. This is the DXC way of creating User Experiences. Open Source Halstack is an open source
|
|
151
|
+
design system, this means that we work towards DXC Technology bussines needs, but it is open for anyone
|
|
152
|
+
to use and contribute back to. We are charmed to receive external contributions to help us find bugs,
|
|
153
|
+
design new features, or help us improve the project documentation. If you're interested, definitely
|
|
154
|
+
check out our contribution guidelines.
|
|
155
|
+
</DxcParagraph>
|
|
156
|
+
</Content>
|
|
157
|
+
</Content>
|
|
158
|
+
<Content id="components">
|
|
159
|
+
<DxcHeading level={1} text="Components" margin={{ top: "small", bottom: "xsmall" }} />
|
|
160
|
+
<Content id="components-introduction">
|
|
91
161
|
<DxcHeading level={2} text="Introduction" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
92
162
|
<DxcParagraph>
|
|
93
163
|
Design principles Halstack design principles are the fundamental part of DXC Technology's approach to
|
|
@@ -121,10 +191,18 @@ export const Chromatic = () => (
|
|
|
121
191
|
check out our contribution guidelines.
|
|
122
192
|
</DxcParagraph>
|
|
123
193
|
</Content>
|
|
194
|
+
<Content id="components-accordion">
|
|
195
|
+
<DxcHeading level={2} text="Accordion" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
196
|
+
<DxcParagraph>
|
|
197
|
+
Accordions are used to group similar content and hide or show it depending on user needs or preferences.
|
|
198
|
+
Accordions give users more granular control over the interface and help digest content in stages, rather
|
|
199
|
+
than all at once.
|
|
200
|
+
</DxcParagraph>
|
|
201
|
+
</Content>
|
|
124
202
|
</Content>
|
|
125
|
-
<Content id="principles">
|
|
203
|
+
<Content id="principles-very-very-very-very-very-very-very-very-long">
|
|
126
204
|
<DxcHeading level={1} text="Principles" margin={{ top: "small", bottom: "xsmall" }} />
|
|
127
|
-
<Content id="color">
|
|
205
|
+
<Content id="principles-very-very-very-very-very-very-very-very-long-color-very-very-very-very-very-very-very-very-long">
|
|
128
206
|
<DxcHeading level={2} text="Color" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
129
207
|
<DxcParagraph>
|
|
130
208
|
The color palette is an essential asset as a communication resource of our design system. Halstack color
|
|
@@ -161,7 +239,7 @@ export const Chromatic = () => (
|
|
|
161
239
|
role-based color palettes and must not be used outside this context.
|
|
162
240
|
</DxcParagraph>
|
|
163
241
|
</Content>
|
|
164
|
-
<Content id="
|
|
242
|
+
<Content id="principles-very-very-very-very-very-very-very-very-long-spacingveryveryveryveryveryveryveryverylong">
|
|
165
243
|
<DxcHeading level={2} text="Spacing" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
166
244
|
<DxcParagraph>
|
|
167
245
|
In the search of consistent alignment between the elements we provide a spacing scale based on a root
|
|
@@ -183,7 +261,7 @@ export const Chromatic = () => (
|
|
|
183
261
|
easily multiplied, they provide flexible and consistent, yet distinct enough, steps between them.
|
|
184
262
|
</DxcParagraph>
|
|
185
263
|
</Content>
|
|
186
|
-
<Content id="typography">
|
|
264
|
+
<Content id="principles-very-very-very-very-very-very-very-very-long-typography">
|
|
187
265
|
<DxcHeading level={2} text="Typography" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
188
266
|
<DxcParagraph>
|
|
189
267
|
Our selected typography helps in structuring our user's experience based on the visual impact that it
|
|
@@ -220,9 +298,9 @@ export const Chromatic = () => (
|
|
|
220
298
|
</DxcParagraph>
|
|
221
299
|
</Content>
|
|
222
300
|
</Content>
|
|
223
|
-
<Content id="
|
|
301
|
+
<Content id="componentsveryveryveryveryveryveryveryverylong">
|
|
224
302
|
<DxcHeading level={1} text="Components" margin={{ top: "small", bottom: "xsmall" }} />
|
|
225
|
-
<Content id="accordion">
|
|
303
|
+
<Content id="componentsveryveryveryveryveryveryveryverylong-accordion">
|
|
226
304
|
<DxcHeading level={2} text="Accordion" margin={{ top: "xsmall", bottom: "xsmall" }} />
|
|
227
305
|
<DxcParagraph>
|
|
228
306
|
Accordions are used to group similar content and hide or show it depending on user needs or preferences.
|
|
@@ -233,7 +311,7 @@ export const Chromatic = () => (
|
|
|
233
311
|
</Content>
|
|
234
312
|
</ContentContainer>
|
|
235
313
|
<QuickNavContainer>
|
|
236
|
-
<DxcQuickNav title="Sections" links={links}
|
|
314
|
+
<DxcQuickNav title="Sections" links={links} />
|
|
237
315
|
</QuickNavContainer>
|
|
238
316
|
</Container>
|
|
239
317
|
</ExampleContainer>
|
package/radio-group/Radio.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { RadioProps } from "./types";
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ label, checked, onClick, error, disabled, focused, readonly, tabIndex, }: RadioProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|