@dxc-technology/halstack-react 12.0.2 → 12.2.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 +23 -0
- package/HalstackContext.js +31 -21
- package/breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/breadcrumbs/Breadcrumbs.test.js +1 -2
- package/breadcrumbs/types.d.ts +24 -0
- package/card/Card.stories.tsx +1 -1
- package/chip/Chip.stories.tsx +2 -6
- package/common/coreTokens.d.ts +0 -1
- package/common/coreTokens.js +0 -1
- package/common/variables.d.ts +29 -0
- package/common/variables.js +25 -2
- package/container/types.d.ts +113 -11
- package/contextual-menu/ContextualMenu.js +56 -8
- package/contextual-menu/ContextualMenu.stories.tsx +50 -51
- package/contextual-menu/ContextualMenu.test.js +108 -66
- package/contextual-menu/GroupItem.js +9 -9
- package/contextual-menu/ItemAction.d.ts +1 -1
- package/contextual-menu/ItemAction.js +52 -15
- package/contextual-menu/SingleItem.d.ts +1 -1
- package/contextual-menu/SingleItem.js +14 -14
- package/contextual-menu/types.d.ts +13 -6
- package/date-input/Calendar.js +46 -30
- package/date-input/DateInput.accessibility.test.js +12 -13
- package/date-input/DateInput.js +9 -3
- package/date-input/DateInput.stories.tsx +5 -6
- package/date-input/DateInput.test.js +30 -31
- package/date-input/YearPicker.js +9 -4
- package/dialog/Dialog.stories.tsx +2 -3
- package/dialog/Dialog.test.js +1 -2
- package/divider/Divider.stories.tsx +2 -1
- package/dropdown/Dropdown.accessibility.test.js +1 -2
- package/dropdown/Dropdown.stories.tsx +1 -1
- package/dropdown/Dropdown.test.js +1 -2
- package/file-input/FileInput.js +1 -3
- package/file-input/FileItem.js +1 -1
- package/file-input/types.d.ts +0 -4
- package/grid/Grid.stories.tsx +3 -1
- package/header/Header.stories.tsx +1 -1
- package/icon/Icon.stories.tsx +1 -1
- package/number-input/NumberInput.accessibility.test.js +1 -2
- package/number-input/NumberInput.js +5 -2
- package/number-input/NumberInput.stories.tsx +11 -16
- package/number-input/NumberInput.test.js +1 -2
- package/package.json +19 -16
- package/paginator/Paginator.accessibility.test.js +1 -2
- package/paginator/Paginator.test.js +1 -2
- package/password-input/PasswordInput.accessibility.test.js +1 -2
- package/password-input/PasswordInput.js +6 -3
- package/password-input/PasswordInput.stories.tsx +10 -1
- package/password-input/PasswordInput.test.js +1 -2
- package/resultset-table/ResultsetTable.accessibility.test.js +1 -2
- package/resultset-table/ResultsetTable.js +33 -9
- package/resultset-table/ResultsetTable.stories.tsx +2 -2
- package/resultset-table/ResultsetTable.test.js +102 -32
- package/resultset-table/types.d.ts +3 -2
- package/select/Select.accessibility.test.js +1 -2
- package/select/Select.js +3 -1
- package/select/Select.stories.tsx +11 -2
- package/select/Select.test.js +1 -2
- package/sidenav/Sidenav.stories.tsx +1 -1
- package/slider/Slider.accessibility.test.js +1 -2
- package/slider/Slider.test.js +1 -2
- package/table/Table.accessibility.test.js +1 -2
- package/table/Table.stories.tsx +1 -1
- package/table/Table.test.js +1 -2
- package/tabs/Tabs.stories.tsx +2 -2
- package/tag/Tag.stories.tsx +1 -1
- package/text-input/TextInput.accessibility.test.js +1 -2
- package/text-input/TextInput.js +3 -1
- package/text-input/TextInput.stories.tsx +11 -8
- package/text-input/TextInput.test.js +1 -2
- package/toggle-group/ToggleGroup.stories.tsx +1 -1
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/typography/Typography.stories.tsx +1 -3
- package/typography/Typography.test.js +23 -0
- package/useTheme.d.ts +23 -0
- package/utils/BaseTypography.js +44 -40
- package/utils/FocusLock.js +2 -1
- package/wizard/Wizard.stories.tsx +1 -1
package/date-input/YearPicker.js
CHANGED
|
@@ -26,13 +26,14 @@ var YearPicker = function YearPicker(_ref) {
|
|
|
26
26
|
var onYearSelect = _ref.onYearSelect,
|
|
27
27
|
selectedDate = _ref.selectedDate,
|
|
28
28
|
today = _ref.today;
|
|
29
|
+
var id = (0, _react.useId)();
|
|
29
30
|
var _useState = (0, _react.useState)(selectedDate ? selectedDate.get("year") : (0, _dayjs["default"])().get("year")),
|
|
30
31
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
31
32
|
yearToFocus = _useState2[0],
|
|
32
33
|
setYearToFocus = _useState2[1];
|
|
33
34
|
(0, _react.useEffect)(function () {
|
|
34
35
|
var _yearToFocusEl$scroll;
|
|
35
|
-
var yearToFocusEl = document.getElementById("
|
|
36
|
+
var yearToFocusEl = document.getElementById("".concat(id, "_year_").concat(yearToFocus));
|
|
36
37
|
yearToFocusEl === null || yearToFocusEl === void 0 ? void 0 : (_yearToFocusEl$scroll = yearToFocusEl.scrollIntoView) === null || _yearToFocusEl$scroll === void 0 ? void 0 : _yearToFocusEl$scroll.call(yearToFocusEl, {
|
|
37
38
|
block: "nearest",
|
|
38
39
|
inline: "start"
|
|
@@ -53,7 +54,10 @@ var YearPicker = function YearPicker(_ref) {
|
|
|
53
54
|
break;
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
|
-
return /*#__PURE__*/_react["default"].createElement(YearPickerContainer,
|
|
57
|
+
return /*#__PURE__*/_react["default"].createElement(YearPickerContainer, {
|
|
58
|
+
role: "listbox",
|
|
59
|
+
"aria-label": "Year Picker"
|
|
60
|
+
}, yearList.map(function (year) {
|
|
57
61
|
return /*#__PURE__*/_react["default"].createElement(YearPickerButton, {
|
|
58
62
|
"aria-label": year,
|
|
59
63
|
key: year,
|
|
@@ -64,10 +68,11 @@ var YearPicker = function YearPicker(_ref) {
|
|
|
64
68
|
onKeyDown: function onKeyDown(event) {
|
|
65
69
|
return handleDayKeyboardEvent(event);
|
|
66
70
|
},
|
|
67
|
-
id: "
|
|
71
|
+
id: "".concat(id, "_year_").concat(year),
|
|
68
72
|
onClick: function onClick() {
|
|
69
73
|
onYearSelect(year);
|
|
70
|
-
}
|
|
74
|
+
},
|
|
75
|
+
role: "option"
|
|
71
76
|
}, year);
|
|
72
77
|
}));
|
|
73
78
|
};
|
|
@@ -10,7 +10,7 @@ import { HalstackProvider } from "../HalstackContext";
|
|
|
10
10
|
import DxcHeading from "../heading/Heading";
|
|
11
11
|
import DxcParagraph from "../paragraph/Paragraph";
|
|
12
12
|
import DxcAlert from "../alert/Alert";
|
|
13
|
-
import { userEvent, within } from "@storybook/
|
|
13
|
+
import { userEvent, within } from "@storybook/test";
|
|
14
14
|
import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
|
|
15
15
|
|
|
16
16
|
export default {
|
|
@@ -362,8 +362,7 @@ MobileResponsiveDialog.parameters = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
export const ScrollDialog = ScrollingDialog.bind({});
|
|
365
|
-
ScrollDialog.play = async (
|
|
366
|
-
const canvas = within(canvasElement);
|
|
365
|
+
ScrollDialog.play = async () => {
|
|
367
366
|
await userEvent.tab();
|
|
368
367
|
await userEvent.tab();
|
|
369
368
|
await userEvent.tab();
|
package/dialog/Dialog.test.js
CHANGED
|
@@ -38,7 +38,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
38
38
|
function ResizeObserver() {
|
|
39
39
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
40
40
|
}
|
|
41
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
41
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
42
42
|
key: "observe",
|
|
43
43
|
value: function observe() {}
|
|
44
44
|
}, {
|
|
@@ -48,7 +48,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
48
48
|
key: "disconnect",
|
|
49
49
|
value: function disconnect() {}
|
|
50
50
|
}]);
|
|
51
|
-
return ResizeObserver;
|
|
52
51
|
}();
|
|
53
52
|
var options = [{
|
|
54
53
|
label: "Female",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Title from "../../.storybook/components/Title";
|
|
3
3
|
import DxcDivider from "./Divider";
|
|
4
|
-
import
|
|
4
|
+
import DxcFlex from "../flex/Flex";
|
|
5
|
+
import DxcParagraph from "../paragraph/Paragraph";
|
|
5
6
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
@@ -40,7 +40,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
40
40
|
function ResizeObserver() {
|
|
41
41
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
42
42
|
}
|
|
43
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
43
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
44
44
|
key: "observe",
|
|
45
45
|
value: function observe() {}
|
|
46
46
|
}, {
|
|
@@ -50,7 +50,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
50
50
|
key: "disconnect",
|
|
51
51
|
value: function disconnect() {}
|
|
52
52
|
}]);
|
|
53
|
-
return ResizeObserver;
|
|
54
53
|
}();
|
|
55
54
|
var options = [{
|
|
56
55
|
value: "1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import DxcDropdown from "./Dropdown";
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
var options = [{
|
|
43
42
|
value: "1",
|
package/file-input/FileInput.js
CHANGED
|
@@ -79,9 +79,7 @@ var isFileIncluded = function isFileIncluded(file, fileList) {
|
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
81
|
var DxcFileInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref3, ref) {
|
|
82
|
-
var _ref3$
|
|
83
|
-
name = _ref3$name === void 0 ? "" : _ref3$name,
|
|
84
|
-
_ref3$mode = _ref3.mode,
|
|
82
|
+
var _ref3$mode = _ref3.mode,
|
|
85
83
|
mode = _ref3$mode === void 0 ? "file" : _ref3$mode,
|
|
86
84
|
_ref3$label = _ref3.label,
|
|
87
85
|
label = _ref3$label === void 0 ? "" : _ref3$label,
|
package/file-input/FileItem.js
CHANGED
|
@@ -100,7 +100,7 @@ var FileName = _styledComponents["default"].span(_templateObject5 || (_templateO
|
|
|
100
100
|
return props.theme.fileItemLineHeight;
|
|
101
101
|
});
|
|
102
102
|
var ErrorIcon = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n font-size: 18px;\n color: #d0011b;\n"])));
|
|
103
|
-
var DeleteFileAction = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (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 background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n cursor: pointer;\n color: ", ";\n font-size: 18px;\n &:hover {\n background-color: ", ";\n }\n &:focus,\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
103
|
+
var DeleteFileAction = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n justify-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 background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n cursor: pointer;\n color: ", ";\n font-size: 18px;\n &:hover {\n background-color: ", ";\n }\n &:focus,\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
104
104
|
return props.theme.fontFamily;
|
|
105
105
|
}, function (props) {
|
|
106
106
|
return props.theme.deleteFileItemColor;
|
package/file-input/types.d.ts
CHANGED
package/grid/Grid.stories.tsx
CHANGED
|
@@ -209,7 +209,9 @@ const ColoredContainer = styled.div<{ color?: string; width?: string; height?: s
|
|
|
209
209
|
padding: 1rem;
|
|
210
210
|
border: 1px solid #a46ede;
|
|
211
211
|
border-radius: 0.5rem;
|
|
212
|
-
font-family:
|
|
212
|
+
font-family:
|
|
213
|
+
Open Sans,
|
|
214
|
+
sans-serif;
|
|
213
215
|
font-size: 1.5rem;
|
|
214
216
|
font-weight: bold;
|
|
215
217
|
color: #a46ede;
|
|
@@ -3,7 +3,7 @@ import DxcHeader from "./Header";
|
|
|
3
3
|
import DxcButton from "../button/Button";
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
-
import { userEvent, waitFor, within } from "@storybook/
|
|
6
|
+
import { userEvent, waitFor, within } from "@storybook/test";
|
|
7
7
|
import DxcFlex from "../flex/Flex";
|
|
8
8
|
import DxcLink from "../link/Link";
|
|
9
9
|
import { HalstackProvider } from "../HalstackContext";
|
package/icon/Icon.stories.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import DxcIcon from "./Icon";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
-
import
|
|
5
|
+
import DxcTypography from "../typography/Typography";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title: "Icon",
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
describe("Number input component accessibility tests", function () {
|
|
43
42
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -59,7 +59,8 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
|
|
|
59
59
|
stepNumber: step
|
|
60
60
|
}
|
|
61
61
|
}, /*#__PURE__*/_react["default"].createElement(NumberInputContainer, {
|
|
62
|
-
ref: numberInputRef
|
|
62
|
+
ref: numberInputRef,
|
|
63
|
+
size: size
|
|
63
64
|
}, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
64
65
|
label: label,
|
|
65
66
|
name: name,
|
|
@@ -82,5 +83,7 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
|
|
|
82
83
|
ref: ref
|
|
83
84
|
})));
|
|
84
85
|
});
|
|
85
|
-
var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])))
|
|
86
|
+
var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])), function (props) {
|
|
87
|
+
return props.size == "fillParent" && "width: 100%;";
|
|
88
|
+
});
|
|
86
89
|
var _default = exports["default"] = DxcNumberInput;
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import Title from "../../.storybook/components/Title";
|
|
3
3
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
4
|
import DxcNumberInput from "./NumberInput";
|
|
5
|
+
import DxcFlex from "../flex/Flex";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Number Input",
|
|
@@ -32,25 +33,11 @@ export const Chromatic = () => (
|
|
|
32
33
|
</ExampleContainer>
|
|
33
34
|
<ExampleContainer>
|
|
34
35
|
<Title title="Read only" theme="light" level={4} />
|
|
35
|
-
<DxcNumberInput
|
|
36
|
-
label="Example label"
|
|
37
|
-
helperText="Help message"
|
|
38
|
-
readOnly
|
|
39
|
-
optional
|
|
40
|
-
prefix="€"
|
|
41
|
-
defaultValue="33"
|
|
42
|
-
/>
|
|
36
|
+
<DxcNumberInput label="Example label" helperText="Help message" readOnly optional prefix="€" defaultValue="33" />
|
|
43
37
|
</ExampleContainer>
|
|
44
38
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
45
39
|
<Title title="Hovered read only" theme="light" level={4} />
|
|
46
|
-
<DxcNumberInput
|
|
47
|
-
label="Example label"
|
|
48
|
-
helperText="Help message"
|
|
49
|
-
readOnly
|
|
50
|
-
optional
|
|
51
|
-
prefix="€"
|
|
52
|
-
defaultValue="1"
|
|
53
|
-
/>
|
|
40
|
+
<DxcNumberInput label="Example label" helperText="Help message" readOnly optional prefix="€" defaultValue="1" />
|
|
54
41
|
</ExampleContainer>
|
|
55
42
|
<ExampleContainer pseudoState="pseudo-active">
|
|
56
43
|
<Title title="Active read only" theme="light" level={4} />
|
|
@@ -127,5 +114,13 @@ export const Chromatic = () => (
|
|
|
127
114
|
<Title title="FillParent size" theme="light" level={4} />
|
|
128
115
|
<DxcNumberInput label="FillParent" size="fillParent" />
|
|
129
116
|
</ExampleContainer>
|
|
117
|
+
<ExampleContainer>
|
|
118
|
+
<Title title="Different sizes inside a flex" theme="light" level={4} />
|
|
119
|
+
<DxcFlex justifyContent="space-between" gap="1rem">
|
|
120
|
+
<DxcNumberInput label="fillParent" size="fillParent" />
|
|
121
|
+
<DxcNumberInput label="medium" size="medium" />
|
|
122
|
+
<DxcNumberInput label="large" size="large" />
|
|
123
|
+
</DxcFlex>
|
|
124
|
+
</ExampleContainer>
|
|
130
125
|
</>
|
|
131
126
|
);
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
describe("Number input component tests", function () {
|
|
43
42
|
test("Number input renders with label, helper text, placeholder and increment/decrement action buttons", function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxc-technology/halstack-react",
|
|
3
|
-
"version": "12.0
|
|
3
|
+
"version": "12.2.0",
|
|
4
4
|
"description": "DXC Halstack React components library",
|
|
5
5
|
"repository": "dxc-technology/halstack-react",
|
|
6
6
|
"homepage": "https://developer.dxc.com/halstack",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@radix-ui/react-popover": "^1.0.7",
|
|
22
|
+
"@radix-ui/react-tooltip": "^1.0.7",
|
|
22
23
|
"color": "^3.1.3",
|
|
23
24
|
"dayjs": "^1.11.1",
|
|
24
25
|
"slugify": "^1.6.5"
|
|
@@ -36,33 +37,35 @@
|
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@babel/cli": "^7.16.8",
|
|
39
|
-
"@babel/core": "^7.24.
|
|
40
|
+
"@babel/core": "^7.24.5",
|
|
40
41
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
|
|
41
42
|
"@babel/plugin-proposal-optional-chaining": "^7.13.8",
|
|
42
43
|
"@babel/plugin-transform-runtime": "^7.16.8",
|
|
43
44
|
"@babel/preset-env": "^7.16.8",
|
|
44
45
|
"@babel/preset-react": "^7.16.7",
|
|
45
46
|
"@babel/preset-typescript": "^7.16.7",
|
|
46
|
-
"@storybook
|
|
47
|
-
"@storybook/addon-
|
|
48
|
-
"@storybook/addon-
|
|
49
|
-
"@storybook/addon-
|
|
50
|
-
"@storybook/
|
|
51
|
-
"@storybook/
|
|
52
|
-
"@storybook/
|
|
53
|
-
"@storybook/
|
|
54
|
-
"@storybook/
|
|
47
|
+
"@chromatic-com/storybook": "^1.3.3",
|
|
48
|
+
"@storybook/addon-a11y": "^8.0.8",
|
|
49
|
+
"@storybook/addon-essentials": "^8.0.8",
|
|
50
|
+
"@storybook/addon-interactions": "^8.0.8",
|
|
51
|
+
"@storybook/addon-links": "^8.0.8",
|
|
52
|
+
"@storybook/blocks": "^8.0.8",
|
|
53
|
+
"@storybook/builder-vite": "^8.0.8",
|
|
54
|
+
"@storybook/react": "^8.0.8",
|
|
55
|
+
"@storybook/react-vite": "^8.0.8",
|
|
56
|
+
"@storybook/test": "^8.0.9",
|
|
57
|
+
"@storybook/test-runner": "^0.17.0",
|
|
55
58
|
"@testing-library/react": "^13.0.0",
|
|
56
59
|
"@testing-library/user-event": "^13.0.0",
|
|
57
60
|
"@types/color": "^3.0.3",
|
|
58
61
|
"@types/jest": "^29.5.12",
|
|
59
62
|
"@types/jest-axe": "^3.5.9",
|
|
60
|
-
"@types/react": "^18.
|
|
63
|
+
"@types/react": "^18.2.79",
|
|
61
64
|
"@types/styled-components": "5.1.29",
|
|
62
65
|
"axe-playwright": "^2.0.1",
|
|
63
66
|
"babel-jest": "^24.8.0",
|
|
64
67
|
"babel-loader": "^8.0.6",
|
|
65
|
-
"chromatic": "^
|
|
68
|
+
"chromatic": "^11.3.0",
|
|
66
69
|
"css-loader": "^7.1.1",
|
|
67
70
|
"eslint": "^8.53.0",
|
|
68
71
|
"eslint-config-airbnb": "^19.0.4",
|
|
@@ -70,9 +73,9 @@
|
|
|
70
73
|
"eslint-plugin-import": "^2.29.0",
|
|
71
74
|
"eslint-plugin-jest": "^27.6.0",
|
|
72
75
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
73
|
-
"eslint-plugin-react": "^7.
|
|
76
|
+
"eslint-plugin-react": "^7.34.1",
|
|
74
77
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
75
|
-
"eslint-plugin-storybook": "^0.
|
|
78
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
76
79
|
"identity-obj-proxy": "^3.0.0",
|
|
77
80
|
"jest": "^29.7.0",
|
|
78
81
|
"jest-axe": "^8.0.0",
|
|
@@ -80,7 +83,7 @@
|
|
|
80
83
|
"playwright": "^1.41.2",
|
|
81
84
|
"react": "^18.2.0",
|
|
82
85
|
"react-dom": "^18.2.0",
|
|
83
|
-
"storybook": "^
|
|
86
|
+
"storybook": "^8.0.8",
|
|
84
87
|
"storybook-addon-pseudo-states": "^3.0.1",
|
|
85
88
|
"style-loader": "^4.0.0",
|
|
86
89
|
"styled-components": "^5.0.1",
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
global.DOMRect = {
|
|
43
42
|
fromRect: function fromRect() {
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
global.DOMRect = {
|
|
43
42
|
fromRect: function fromRect() {
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
describe("Password input component accessibility tests", function () {
|
|
43
42
|
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
@@ -64,7 +64,8 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
64
64
|
}, [isPasswordVisible, passwordInput]);
|
|
65
65
|
return /*#__PURE__*/_react["default"].createElement(PasswordInput, {
|
|
66
66
|
ref: ref,
|
|
67
|
-
role: "group"
|
|
67
|
+
role: "group",
|
|
68
|
+
size: size
|
|
68
69
|
}, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
69
70
|
label: label,
|
|
70
71
|
name: name,
|
|
@@ -76,7 +77,7 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
76
77
|
return !isPasswordVisible;
|
|
77
78
|
});
|
|
78
79
|
},
|
|
79
|
-
icon: isPasswordVisible ?
|
|
80
|
+
icon: isPasswordVisible ? "Visibility_Off" : "Visibility",
|
|
80
81
|
title: isPasswordVisible ? passwordInput.inputHidePasswordTitle : passwordInput.inputShowPasswordTitle
|
|
81
82
|
},
|
|
82
83
|
error: error,
|
|
@@ -93,5 +94,7 @@ var DxcPasswordInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref,
|
|
|
93
94
|
tabIndex: tabIndex
|
|
94
95
|
}));
|
|
95
96
|
});
|
|
96
|
-
var PasswordInput = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n & ::-ms-reveal {\n display: none;\n }\n"])))
|
|
97
|
+
var PasswordInput = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n ", "\n & ::-ms-reveal {\n display: none;\n }\n"])), function (props) {
|
|
98
|
+
return props.size == "fillParent" && "width: 100%;";
|
|
99
|
+
});
|
|
97
100
|
var _default = exports["default"] = DxcPasswordInput;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { userEvent, within } from "@storybook/
|
|
2
|
+
import { userEvent, within } from "@storybook/test";
|
|
3
3
|
import DxcPasswordInput from "./PasswordInput";
|
|
4
4
|
import Title from "../../.storybook/components/Title";
|
|
5
5
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import DxcFlex from "../flex/Flex";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: "Password Input",
|
|
@@ -81,6 +82,14 @@ export const Chromatic = () => (
|
|
|
81
82
|
<Title title="FillParent size" theme="light" level={4} />
|
|
82
83
|
<DxcPasswordInput label="FillParent" size="fillParent" />
|
|
83
84
|
</ExampleContainer>
|
|
85
|
+
<ExampleContainer>
|
|
86
|
+
<Title title="Without label" theme="light" level={4} />
|
|
87
|
+
<DxcFlex justifyContent="space-between" gap="1rem">
|
|
88
|
+
<DxcPasswordInput label="fillParent" size="fillParent" />
|
|
89
|
+
<DxcPasswordInput label="medium" size="medium" />
|
|
90
|
+
<DxcPasswordInput label="large" size="large" />
|
|
91
|
+
</DxcFlex>
|
|
92
|
+
</ExampleContainer>
|
|
84
93
|
</>
|
|
85
94
|
);
|
|
86
95
|
|
|
@@ -27,7 +27,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
27
27
|
function ResizeObserver() {
|
|
28
28
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
29
29
|
}
|
|
30
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
30
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
31
31
|
key: "observe",
|
|
32
32
|
value: function observe() {}
|
|
33
33
|
}, {
|
|
@@ -37,7 +37,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
37
37
|
key: "disconnect",
|
|
38
38
|
value: function disconnect() {}
|
|
39
39
|
}]);
|
|
40
|
-
return ResizeObserver;
|
|
41
40
|
}();
|
|
42
41
|
describe("Password input component tests", function () {
|
|
43
42
|
test("Password input renders with label and helper text", function () {
|
|
@@ -51,7 +51,7 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
51
51
|
function ResizeObserver() {
|
|
52
52
|
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
53
53
|
}
|
|
54
|
-
(0, _createClass2["default"])(ResizeObserver, [{
|
|
54
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
55
55
|
key: "observe",
|
|
56
56
|
value: function observe() {}
|
|
57
57
|
}, {
|
|
@@ -61,7 +61,6 @@ global.ResizeObserver = /*#__PURE__*/function () {
|
|
|
61
61
|
key: "disconnect",
|
|
62
62
|
value: function disconnect() {}
|
|
63
63
|
}]);
|
|
64
|
-
return ResizeObserver;
|
|
65
64
|
}();
|
|
66
65
|
var actions = [{
|
|
67
66
|
title: "icon",
|
|
@@ -26,8 +26,8 @@ var normalizeSortValue = function normalizeSortValue(sortValue) {
|
|
|
26
26
|
};
|
|
27
27
|
var sortArray = function sortArray(index, order, resultset) {
|
|
28
28
|
return resultset.slice().sort(function (element1, element2) {
|
|
29
|
-
var sortValueA = normalizeSortValue(element1[index].sortValue || element1[index].displayValue);
|
|
30
|
-
var sortValueB = normalizeSortValue(element2[index].sortValue || element2[index].displayValue);
|
|
29
|
+
var sortValueA = normalizeSortValue(element1.cells[index].sortValue || element1[index].displayValue);
|
|
30
|
+
var sortValueB = normalizeSortValue(element2.cells[index].sortValue || element2[index].displayValue);
|
|
31
31
|
var comparison = 0;
|
|
32
32
|
if ((0, _typeof2["default"])(sortValueA) === "object") {
|
|
33
33
|
comparison = -1;
|
|
@@ -47,6 +47,17 @@ var getMinItemsPerPageIndex = function getMinItemsPerPageIndex(currentPageIntern
|
|
|
47
47
|
var getMaxItemsPerPageIndex = function getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, resultset, page) {
|
|
48
48
|
return minItemsPerPageIndex + itemsPerPage > resultset.length ? resultset.length : itemsPerPage * page - 1;
|
|
49
49
|
};
|
|
50
|
+
var assignIdsToRows = function assignIdsToRows(resultset) {
|
|
51
|
+
if (resultset.length > 0) {
|
|
52
|
+
return resultset.map(function (row, index) {
|
|
53
|
+
return {
|
|
54
|
+
cells: row,
|
|
55
|
+
id: "row_".concat(index)
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return [];
|
|
60
|
+
};
|
|
50
61
|
var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
51
62
|
var columns = _ref.columns,
|
|
52
63
|
rows = _ref.rows,
|
|
@@ -76,6 +87,10 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
76
87
|
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
77
88
|
sortOrder = _useState6[0],
|
|
78
89
|
changeSortOrder = _useState6[1];
|
|
90
|
+
var prevRowCountRef = (0, _react.useRef)(rows.length);
|
|
91
|
+
var rowsWithIds = (0, _react.useMemo)(function () {
|
|
92
|
+
return assignIdsToRows(rows);
|
|
93
|
+
}, [rows]);
|
|
79
94
|
var minItemsPerPageIndex = (0, _react.useMemo)(function () {
|
|
80
95
|
return getMinItemsPerPageIndex(page, itemsPerPage, page);
|
|
81
96
|
}, [itemsPerPage, page]);
|
|
@@ -83,8 +98,8 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
83
98
|
return getMaxItemsPerPageIndex(minItemsPerPageIndex, itemsPerPage, rows, page);
|
|
84
99
|
}, [itemsPerPage, minItemsPerPageIndex, page, rows]);
|
|
85
100
|
var sortedResultset = (0, _react.useMemo)(function () {
|
|
86
|
-
return sortColumnIndex !== -1 ? sortArray(sortColumnIndex, sortOrder,
|
|
87
|
-
}, [sortColumnIndex, sortOrder,
|
|
101
|
+
return sortColumnIndex !== -1 ? sortArray(sortColumnIndex, sortOrder, rowsWithIds) : rowsWithIds;
|
|
102
|
+
}, [sortColumnIndex, sortOrder, rowsWithIds]);
|
|
88
103
|
var filteredResultset = (0, _react.useMemo)(function () {
|
|
89
104
|
return sortedResultset && sortedResultset.slice(minItemsPerPageIndex, maxItemsPerPageIndex + 1);
|
|
90
105
|
}, [sortedResultset, minItemsPerPageIndex, maxItemsPerPageIndex]);
|
|
@@ -98,9 +113,18 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
98
113
|
};
|
|
99
114
|
(0, _react.useEffect)(function () {
|
|
100
115
|
if (!hidePaginator) {
|
|
101
|
-
rows.length
|
|
116
|
+
if (rows.length === 0) {
|
|
117
|
+
changePage(0);
|
|
118
|
+
} else if (rows.length < prevRowCountRef.current) {
|
|
119
|
+
var lastPage = Math.ceil(rows.length / itemsPerPage);
|
|
120
|
+
var prevLastPage = Math.ceil(prevRowCountRef.current / itemsPerPage);
|
|
121
|
+
if (lastPage < prevLastPage) {
|
|
122
|
+
changePage(Math.min(lastPage, page));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
prevRowCountRef.current = rows.length;
|
|
102
126
|
}
|
|
103
|
-
}, [rows]);
|
|
127
|
+
}, [rows.length]);
|
|
104
128
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
105
129
|
theme: colorsTheme.table
|
|
106
130
|
}, /*#__PURE__*/_react["default"].createElement(DxcResultsetTableContainer, {
|
|
@@ -122,10 +146,10 @@ var DxcResultsetTable = function DxcResultsetTable(_ref) {
|
|
|
122
146
|
mode: mode,
|
|
123
147
|
"aria-label": column.isSortable ? "Sort column" : undefined
|
|
124
148
|
}, /*#__PURE__*/_react["default"].createElement("span", null, column.displayValue), column.isSortable && /*#__PURE__*/_react["default"].createElement(SortIcon, null, sortColumnIndex === index ? sortOrder === "ascending" ? _Icons["default"].arrowUp : _Icons["default"].arrowDown : _Icons["default"].bothArrows)));
|
|
125
|
-
}))), /*#__PURE__*/_react["default"].createElement("tbody", null, filteredResultset.map(function (
|
|
149
|
+
}))), /*#__PURE__*/_react["default"].createElement("tbody", null, filteredResultset.map(function (row) {
|
|
126
150
|
return /*#__PURE__*/_react["default"].createElement("tr", {
|
|
127
|
-
key: "resultSetTableCell_".concat(
|
|
128
|
-
}, cells.map(function (cellContent, cellIndex) {
|
|
151
|
+
key: "resultSetTableCell_".concat(row.id)
|
|
152
|
+
}, row.cells.map(function (cellContent, cellIndex) {
|
|
129
153
|
return /*#__PURE__*/_react["default"].createElement("td", {
|
|
130
154
|
key: "resultSetTableCellContent_".concat(cellIndex)
|
|
131
155
|
}, cellContent.displayValue);
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import DxcResultsetTable from "./ResultsetTable";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
-
import { userEvent, within } from "@storybook/
|
|
5
|
+
import { userEvent, within } from "@storybook/test";
|
|
6
6
|
import styled from "styled-components";
|
|
7
7
|
import { HalstackProvider } from "../HalstackContext";
|
|
8
8
|
import { disabledRules } from "../../test/accessibility/rules/specific/resultset-table/disabledRules";
|
|
@@ -409,5 +409,5 @@ export const DropdownAction = ResultsetActionsCellDropdown.bind({});
|
|
|
409
409
|
DropdownAction.play = async ({ canvasElement }) => {
|
|
410
410
|
const canvas = within(canvasElement);
|
|
411
411
|
const dropdown = canvas.getAllByRole("button")[5];
|
|
412
|
-
|
|
412
|
+
userEvent.click(dropdown);
|
|
413
413
|
};
|