@dxc-technology/halstack-react 9.0.1 → 9.1.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 -1
- package/HalstackContext.js +1 -1
- package/accordion/Accordion.stories.tsx +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/button/Button.js +0 -1
- package/button/Button.stories.tsx +1 -1
- package/flex/Flex.stories.tsx +19 -24
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/inset/Inset.stories.tsx +1 -0
- package/layout/ApplicationLayout.d.ts +2 -2
- package/layout/types.d.ts +2 -3
- package/main.d.ts +2 -1
- package/main.js +8 -0
- package/package.json +1 -1
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +49 -75
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/types.d.ts +21 -18
- package/tabs/Tab.js +1 -2
- package/tabs/Tabs.js +10 -14
- package/textarea/Textarea.js +0 -1
- package/textarea/Textarea.test.js +1 -3
- package/utils/FocusLock.js +1 -1
package/tabs/Tab.js
CHANGED
|
@@ -42,7 +42,6 @@ var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
42
42
|
type: "button",
|
|
43
43
|
tabIndex: tabIndex,
|
|
44
44
|
disabled: tab.isDisabled,
|
|
45
|
-
"aria-disabled": tab.isDisabled,
|
|
46
45
|
"aria-selected": active,
|
|
47
46
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
48
47
|
iconPosition: iconPosition,
|
|
@@ -82,7 +81,7 @@ var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
82
81
|
})));
|
|
83
82
|
});
|
|
84
83
|
|
|
85
|
-
var TabContainer = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n text-transform: ", ";\n overflow: hidden;\n flex-shrink: 0;\n border: 0;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n user-select: none;\n vertical-align: middle;\n justify-content: center;\n min-width: 90px;\n max-width: 360px;\n padding: ", ";\n height: ", ";\n min-height: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n svg {\n color: ", ";\n }\n\n &[aria-selected=\"true\"] {\n background-color: ", ";\n svg {\n color: ", ";\n }\n opacity: 1;\n }\n\n
|
|
84
|
+
var TabContainer = _styledComponents["default"].button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n text-transform: ", ";\n overflow: hidden;\n flex-shrink: 0;\n border: 0;\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n user-select: none;\n vertical-align: middle;\n justify-content: center;\n min-width: 90px;\n max-width: 360px;\n padding: ", ";\n height: ", ";\n min-height: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n svg {\n color: ", ";\n }\n\n &[aria-selected=\"true\"] {\n background-color: ", ";\n svg {\n color: ", ";\n }\n opacity: 1;\n }\n\n &:disabled {\n background-color: ", " !important;\n cursor: not-allowed !important;\n pointer-events: all;\n font-style: ", ";\n outline: none !important;\n\n svg {\n color: ", ";\n }\n > div {\n opacity: 0.5;\n }\n }\n"])), function (props) {
|
|
86
85
|
return props.theme.fontTextTransform;
|
|
87
86
|
}, function (props) {
|
|
88
87
|
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
|
package/tabs/Tabs.js
CHANGED
|
@@ -193,7 +193,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
193
193
|
var _refTabList$current3;
|
|
194
194
|
|
|
195
195
|
var scrollWidth = (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current3 = refTabList.current) === null || _refTabList$current3 === void 0 ? void 0 : _refTabList$current3.offsetWidth) * 0.75;
|
|
196
|
-
var moveX;
|
|
196
|
+
var moveX = 0;
|
|
197
197
|
|
|
198
198
|
if (countClick <= scrollWidth) {
|
|
199
199
|
moveX = 0;
|
|
@@ -213,7 +213,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
213
213
|
var _refTabList$current4, _refTabList$current5;
|
|
214
214
|
|
|
215
215
|
var scrollWidth = (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current4 = refTabList.current) === null || _refTabList$current4 === void 0 ? void 0 : _refTabList$current4.offsetWidth) * 0.75;
|
|
216
|
-
var moveX;
|
|
216
|
+
var moveX = 0;
|
|
217
217
|
|
|
218
218
|
if (countClick + scrollWidth + (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current5 = refTabList.current) === null || _refTabList$current5 === void 0 ? void 0 : _refTabList$current5.offsetWidth) >= totalTabsWidth) {
|
|
219
219
|
var _refTabList$current6;
|
|
@@ -344,7 +344,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
344
344
|
}, /*#__PURE__*/_react["default"].createElement(ScrollIndicator, {
|
|
345
345
|
onClick: scrollLeft,
|
|
346
346
|
enabled: enabledIndicator,
|
|
347
|
-
|
|
347
|
+
disabled: !scrollLeftEnabled,
|
|
348
348
|
"aria-label": translatedLabels.tabs.scrollLeft,
|
|
349
349
|
tabIndex: scrollLeftEnabled ? tabIndex : -1,
|
|
350
350
|
minHeightTabs: minHeightTabs
|
|
@@ -386,14 +386,14 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
386
386
|
}))), /*#__PURE__*/_react["default"].createElement(ScrollIndicator, {
|
|
387
387
|
onClick: scrollRight,
|
|
388
388
|
enabled: enabledIndicator,
|
|
389
|
-
|
|
389
|
+
disabled: !scrollRightEnabled,
|
|
390
390
|
"aria-label": translatedLabels.tabs.scrollRight,
|
|
391
391
|
tabIndex: scrollRightEnabled ? tabIndex : -1,
|
|
392
392
|
minHeightTabs: minHeightTabs
|
|
393
393
|
}, arrowIcons.right))));
|
|
394
394
|
};
|
|
395
395
|
|
|
396
|
-
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n left: 0;\n bottom: 0;\n width: 100%;\n
|
|
396
|
+
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: ", ";\n background-color: ", ";\n"])), function (props) {
|
|
397
397
|
return props.theme.dividerThickness;
|
|
398
398
|
}, function (props) {
|
|
399
399
|
return props.theme.dividerColor;
|
|
@@ -419,16 +419,12 @@ var Tabs = _styledComponents["default"].div(_templateObject3 || (_templateObject
|
|
|
419
419
|
return props.theme.unselectedBackgroundColor;
|
|
420
420
|
});
|
|
421
421
|
|
|
422
|
-
var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n
|
|
422
|
+
var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: ", ";\n justify-content: center;\n min-width: ", ";\n height: ", "px;\n padding: 0;\n border: none;\n background-color: #ffffff;\n font-size: 1.25rem;\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n &:active {\n background-color: ", ";\n }\n &:disabled {\n cursor: default;\n svg {\n visibility: hidden;\n }\n &:focus {\n outline: none;\n }\n &:hover,\n &:active {\n background-color: transparent !important;\n }\n }\n\n svg {\n align-self: center;\n height: 20px;\n width: 20px;\n fill: ", ";\n }\n"])), function (props) {
|
|
423
423
|
return props.enabled ? "flex" : "none";
|
|
424
424
|
}, function (props) {
|
|
425
425
|
return props.theme.scrollButtonsWidth;
|
|
426
426
|
}, function (props) {
|
|
427
427
|
return props.minHeightTabs - 1;
|
|
428
|
-
}, function (props) {
|
|
429
|
-
return props.theme.dividerThickness;
|
|
430
|
-
}, function (props) {
|
|
431
|
-
return props.theme.dividerColor;
|
|
432
428
|
}, function (props) {
|
|
433
429
|
return "".concat(props.theme.hoverBackgroundColor, " !important");
|
|
434
430
|
}, function (props) {
|
|
@@ -439,19 +435,19 @@ var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_
|
|
|
439
435
|
return props.theme.unselectedFontColor;
|
|
440
436
|
});
|
|
441
437
|
|
|
442
|
-
var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
438
|
+
var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n bottom: 0;\n left: ", ";\n width: ", ";\n height: ", ";\n background-color: ", ";\n &[aria-disabled=\"true\"] {\n background-color: ", ";\n display: none;\n }\n"])), function (props) {
|
|
443
439
|
return "".concat(props.tabLeft, "px");
|
|
444
440
|
}, function (props) {
|
|
445
441
|
return "".concat(props.tabWidth, "px");
|
|
446
|
-
}, function (props) {
|
|
447
|
-
return props.theme.selectedUnderlineColor;
|
|
448
442
|
}, function (props) {
|
|
449
443
|
return props.theme.selectedUnderlineThickness;
|
|
444
|
+
}, function (props) {
|
|
445
|
+
return props.theme.selectedUnderlineColor;
|
|
450
446
|
}, function (props) {
|
|
451
447
|
return props.theme.disabledFontColor;
|
|
452
448
|
});
|
|
453
449
|
|
|
454
|
-
var TabsContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
450
|
+
var TabsContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n flex: 1 1 auto;\n display: inline-block;\n position: relative;\n white-space: nowrap;\n overflow-x: scroll;\n ::-webkit-scrollbar {\n display: none;\n }\n"])));
|
|
455
451
|
|
|
456
452
|
var TabList = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n min-height: ", "px;\n"])), function (props) {
|
|
457
453
|
return props.minHeightTabs;
|
package/textarea/Textarea.js
CHANGED
|
@@ -171,7 +171,6 @@ var DxcTextarea = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
|
|
|
171
171
|
backgroundType: backgroundType,
|
|
172
172
|
ref: textareaRef,
|
|
173
173
|
tabIndex: tabIndex,
|
|
174
|
-
"aria-disabled": disabled,
|
|
175
174
|
"aria-invalid": error ? "true" : "false",
|
|
176
175
|
"aria-errormessage": error ? errorId : undefined,
|
|
177
176
|
"aria-required": optional ? "false" : "true"
|
|
@@ -85,7 +85,6 @@ describe("Textarea component tests", function () {
|
|
|
85
85
|
getByLabelText = _render7.getByLabelText;
|
|
86
86
|
|
|
87
87
|
var textarea = getByLabelText("Example label");
|
|
88
|
-
expect(textarea.getAttribute("aria-disabled")).toBe("false");
|
|
89
88
|
expect(textarea.getAttribute("aria-invalid")).toBe("false");
|
|
90
89
|
expect(textarea.getAttribute("aria-describedBy")).toBeNull();
|
|
91
90
|
expect(textarea.getAttribute("aria-required")).toBe("true");
|
|
@@ -101,7 +100,7 @@ describe("Textarea component tests", function () {
|
|
|
101
100
|
var textarea = getByLabelText("Example label");
|
|
102
101
|
expect(textarea.value).toBe("Example text");
|
|
103
102
|
});
|
|
104
|
-
test("Disabled textarea
|
|
103
|
+
test("Disabled textarea can not be modified", function () {
|
|
105
104
|
var onChange = jest.fn();
|
|
106
105
|
|
|
107
106
|
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
@@ -112,7 +111,6 @@ describe("Textarea component tests", function () {
|
|
|
112
111
|
getByLabelText = _render9.getByLabelText;
|
|
113
112
|
|
|
114
113
|
var textarea = getByLabelText("Example label");
|
|
115
|
-
expect(textarea.getAttribute("aria-disabled")).toBe("true");
|
|
116
114
|
|
|
117
115
|
_userEvent["default"].type(textarea, "Test");
|
|
118
116
|
|
package/utils/FocusLock.js
CHANGED
|
@@ -20,7 +20,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
20
20
|
var not = {
|
|
21
21
|
inert: ":not([inert]):not([inert] *)",
|
|
22
22
|
negTabIndex: ':not([tabindex^="-"])',
|
|
23
|
-
disabled: ":not(:disabled)
|
|
23
|
+
disabled: ":not(:disabled)"
|
|
24
24
|
};
|
|
25
25
|
var focusableQuery = ["a[href]".concat(not.inert).concat(not.negTabIndex), "area[href]".concat(not.inert).concat(not.negTabIndex), "input:not([type=\"hidden\"])".concat(not.inert).concat(not.negTabIndex).concat(not.disabled), "select".concat(not.inert).concat(not.negTabIndex).concat(not.disabled), "textarea".concat(not.inert).concat(not.negTabIndex).concat(not.disabled), "button".concat(not.inert).concat(not.negTabIndex).concat(not.disabled), "details".concat(not.inert, " > summary:first-of-type").concat(not.negTabIndex), "iframe".concat(not.inert).concat(not.negTabIndex), "audio[controls]".concat(not.inert).concat(not.negTabIndex), "video[controls]".concat(not.inert).concat(not.negTabIndex), "[contenteditable]".concat(not.inert).concat(not.negTabIndex), "[tabindex]".concat(not.inert).concat(not.negTabIndex).concat(not.disabled)].join(",");
|
|
26
26
|
|