@dxc-technology/halstack-react 0.0.0-89de434 → 0.0.0-8a597df
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.accessibility.test.js +71 -0
- package/accordion/Accordion.js +8 -21
- package/accordion/Accordion.stories.tsx +4 -36
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +3 -3
- package/accordion-group/AccordionGroupAccordion.js +2 -2
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +1 -1
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.js +4 -3
- package/action-icon/ActionIcon.stories.tsx +3 -3
- package/action-icon/types.d.ts +1 -1
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +15 -69
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.js +6 -4
- package/badge/Badge.stories.tsx +11 -11
- package/badge/types.d.ts +1 -1
- package/box/Box.accessibility.test.js +33 -0
- package/bulleted-list/BulletedList.accessibility.test.js +107 -0
- package/bulleted-list/BulletedList.js +6 -3
- package/bulleted-list/BulletedList.stories.tsx +1 -1
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +4 -3
- package/button/Button.stories.tsx +32 -51
- package/button/types.d.ts +1 -1
- package/card/Card.accessibility.test.js +36 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +8 -5
- package/chip/Chip.stories.tsx +5 -24
- package/chip/Chip.test.js +4 -4
- package/contextual-menu/ContextualMenu.accessibility.test.js +86 -0
- package/date-input/DateInput.accessibility.test.js +216 -0
- package/date-input/DateInput.js +1 -2
- package/date-input/DatePicker.js +12 -6
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.test.js +1 -1
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/types.d.ts +3 -1
- package/dropdown/Dropdown.accessibility.test.js +180 -0
- package/dropdown/Dropdown.js +12 -29
- package/dropdown/Dropdown.stories.tsx +5 -16
- package/dropdown/DropdownMenuItem.js +6 -3
- package/dropdown/types.d.ts +2 -4
- package/file-input/FileInput.accessibility.test.js +160 -0
- package/file-input/FileInput.js +3 -39
- package/file-input/FileInput.test.js +7 -84
- package/file-input/FileItem.js +13 -27
- package/footer/Footer.accessibility.test.js +117 -0
- package/footer/Footer.js +7 -5
- package/footer/Footer.stories.tsx +28 -3
- package/footer/types.d.ts +1 -1
- package/header/Header.accessibility.test.js +84 -0
- package/header/Header.js +9 -20
- package/heading/Heading.accessibility.test.js +33 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.js +1 -1
- package/icon/Icon.stories.tsx +5 -3
- package/image/Image.accessibility.test.js +56 -0
- package/layout/ApplicationLayout.js +1 -1
- package/layout/Icons.js +0 -2
- package/link/Link.accessibility.test.js +112 -0
- package/link/Link.js +7 -5
- package/link/Link.stories.tsx +2 -2
- package/link/types.d.ts +1 -1
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +3 -3
- package/nav-tabs/NavTabs.stories.tsx +26 -23
- package/nav-tabs/NavTabs.test.js +1 -2
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +13 -14
- package/nav-tabs/types.d.ts +1 -1
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +0 -7
- package/number-input/NumberInput.js +3 -3
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +6 -0
- package/package.json +11 -11
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +274 -0
- package/resultset-table/ResultsetTable.d.ts +1 -1
- package/resultset-table/ResultsetTable.js +10 -6
- package/resultset-table/ResultsetTable.stories.tsx +5 -1
- package/resultset-table/ResultsetTable.test.js +14 -4
- package/resultset-table/types.d.ts +38 -11
- package/select/Select.accessibility.test.js +217 -0
- package/select/Select.stories.tsx +0 -1
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.js +16 -12
- package/sidenav/Sidenav.stories.tsx +4 -9
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.js +104 -0
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/switch/Switch.accessibility.test.js +89 -0
- package/table/Table.accessibility.test.js +82 -0
- package/table/Table.js +1 -10
- package/table/Table.stories.tsx +2 -9
- package/table/types.d.ts +1 -15
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +6 -6
- package/tag/Tag.stories.tsx +4 -7
- package/tag/Tag.test.js +4 -12
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestions.js +5 -3
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +10 -8
- package/text-input/TextInput.stories.tsx +1 -1
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.js +4 -3
- package/toggle-group/ToggleGroup.stories.tsx +3 -3
- package/toggle-group/types.d.ts +2 -2
- package/typography/Typography.accessibility.test.js +339 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -56
- /package/{layout → sidenav}/SidenavContext.d.ts +0 -0
- /package/{layout → sidenav}/SidenavContext.js +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _jestAxe = require("jest-axe");
|
|
9
|
+
var _Icon = _interopRequireDefault(require("./Icon"));
|
|
10
|
+
describe("Icon component accessibility tests", function () {
|
|
11
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
12
|
+
var _render, container, results;
|
|
13
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
14
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
17
|
+
icon: "home"
|
|
18
|
+
})), container = _render.container;
|
|
19
|
+
_context.next = 3;
|
|
20
|
+
return (0, _jestAxe.axe)(container);
|
|
21
|
+
case 3:
|
|
22
|
+
results = _context.sent;
|
|
23
|
+
expect(results).toHaveNoViolations();
|
|
24
|
+
case 5:
|
|
25
|
+
case "end":
|
|
26
|
+
return _context.stop();
|
|
27
|
+
}
|
|
28
|
+
}, _callee);
|
|
29
|
+
})));
|
|
30
|
+
});
|
package/icon/Icon.js
CHANGED
|
@@ -25,7 +25,7 @@ var DxcIcon = function DxcIcon(_ref) {
|
|
|
25
25
|
"aria-hidden": "true"
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
-
var IconContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n font-family: \"Material Symbols Outlined\";\n font-weight: normal;\n font-style: normal;\n
|
|
28
|
+
var IconContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n font-family: \"Material Symbols Outlined\";\n font-weight: normal;\n font-style: normal;\n line-height: 1;\n letter-spacing: normal;\n text-transform: none;\n display: inline-block;\n white-space: nowrap;\n word-wrap: normal;\n direction: ltr;\n -webkit-font-feature-settings: \"liga\";\n -webkit-font-smoothing: antialiased;\n text-rendering: optimizeLegibility;\n -moz-osx-font-smoothing: grayscale;\n font-variation-settings: ", ";\n ::before {\n content: \"", "\";\n }\n"])), function (props) {
|
|
29
29
|
return props.filled ? "'FILL' 1" : "'FILL' 0";
|
|
30
30
|
}, function (props) {
|
|
31
31
|
return props.icon;
|
package/icon/Icon.stories.tsx
CHANGED
|
@@ -13,11 +13,13 @@ export const Chromatic = () => (
|
|
|
13
13
|
<>
|
|
14
14
|
<Title title="Icon component" theme="light" level={2} />
|
|
15
15
|
<ExampleContainer>
|
|
16
|
-
<
|
|
17
|
-
|
|
16
|
+
<DxcTypography as="p" fontSize="1.5rem">
|
|
17
|
+
<DxcIcon icon="home" />
|
|
18
|
+
<DxcIcon icon="filled_home" />
|
|
19
|
+
</DxcTypography>
|
|
18
20
|
</ExampleContainer>
|
|
19
21
|
<ExampleContainer>
|
|
20
|
-
<DxcTypography as="p" color="#b182e3">
|
|
22
|
+
<DxcTypography as="p" fontSize="1.5rem" color="#b182e3">
|
|
21
23
|
<DxcIcon icon="home" />
|
|
22
24
|
<DxcIcon icon="filled_home" />
|
|
23
25
|
</DxcTypography>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _jestAxe = require("jest-axe");
|
|
9
|
+
var _Image = _interopRequireDefault(require("./Image"));
|
|
10
|
+
describe("Image component accessibility tests", function () {
|
|
11
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
12
|
+
var _render, container, results;
|
|
13
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
14
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Image["default"], {
|
|
17
|
+
alt: "Example image",
|
|
18
|
+
width: "100%",
|
|
19
|
+
src: "https://images.ctfassets.net/hrltx12pl8hq/5596z2BCR9KmT1KeRBrOQa/4070fd4e2f1a13f71c2c46afeb18e41c/shutterstock_451077043-hero1.jpg",
|
|
20
|
+
caption: "Caption"
|
|
21
|
+
})), container = _render.container;
|
|
22
|
+
_context.next = 3;
|
|
23
|
+
return (0, _jestAxe.axe)(container);
|
|
24
|
+
case 3:
|
|
25
|
+
results = _context.sent;
|
|
26
|
+
expect(results).toHaveNoViolations();
|
|
27
|
+
case 5:
|
|
28
|
+
case "end":
|
|
29
|
+
return _context.stop();
|
|
30
|
+
}
|
|
31
|
+
}, _callee);
|
|
32
|
+
})));
|
|
33
|
+
it("Should not have basic accessibility issues for lazy-loading mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
34
|
+
var _render2, container, results;
|
|
35
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
36
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
37
|
+
case 0:
|
|
38
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Image["default"], {
|
|
39
|
+
alt: "Example image",
|
|
40
|
+
width: "100%",
|
|
41
|
+
src: "https://images.ctfassets.net/hrltx12pl8hq/5596z2BCR9KmT1KeRBrOQa/4070fd4e2f1a13f71c2c46afeb18e41c/shutterstock_451077043-hero1.jpg",
|
|
42
|
+
caption: "Caption",
|
|
43
|
+
lazyLoading: true
|
|
44
|
+
})), container = _render2.container;
|
|
45
|
+
_context2.next = 3;
|
|
46
|
+
return (0, _jestAxe.axe)(container);
|
|
47
|
+
case 3:
|
|
48
|
+
results = _context2.sent;
|
|
49
|
+
expect(results).toHaveNoViolations();
|
|
50
|
+
case 5:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context2.stop();
|
|
53
|
+
}
|
|
54
|
+
}, _callee2);
|
|
55
|
+
})));
|
|
56
|
+
});
|
|
@@ -15,7 +15,7 @@ var _Sidenav = _interopRequireDefault(require("../sidenav/Sidenav"));
|
|
|
15
15
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
16
16
|
var _variables = require("../common/variables");
|
|
17
17
|
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
18
|
-
var _SidenavContext = require("
|
|
18
|
+
var _SidenavContext = require("../sidenav/SidenavContext");
|
|
19
19
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
20
20
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
package/layout/Icons.js
CHANGED
|
@@ -9,7 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var layoutIcons = {
|
|
10
10
|
facebookLogo: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
11
|
version: "1.1",
|
|
12
|
-
id: "Capa_1",
|
|
13
12
|
x: "0px",
|
|
14
13
|
y: "0px",
|
|
15
14
|
width: "438.536px",
|
|
@@ -36,7 +35,6 @@ var layoutIcons = {
|
|
|
36
35
|
})),
|
|
37
36
|
linkedinLogo: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
38
37
|
version: "1.1",
|
|
39
|
-
id: "Capa_1",
|
|
40
38
|
x: "0px",
|
|
41
39
|
y: "0px",
|
|
42
40
|
width: "438.536px",
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _jestAxe = require("jest-axe");
|
|
9
|
+
var _Link = _interopRequireDefault(require("./Link.tsx"));
|
|
10
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex.tsx"));
|
|
11
|
+
var icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
12
|
+
viewBox: "0 0 24 24",
|
|
13
|
+
enableBackground: "new 0 0 24 24",
|
|
14
|
+
fill: "currentColor"
|
|
15
|
+
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
16
|
+
id: "Bounding_Box"
|
|
17
|
+
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
18
|
+
fill: "none",
|
|
19
|
+
width: "24",
|
|
20
|
+
height: "24"
|
|
21
|
+
})), /*#__PURE__*/_react["default"].createElement("g", {
|
|
22
|
+
id: "Master"
|
|
23
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
24
|
+
d: "M19,9.3V4h-3v2.6L12,3L2,12h3v8h5v-6h4v6h5v-8h3L19,9.3z M10,10c0-1.1,0.9-2,2-2s2,0.9,2,2H10z"
|
|
25
|
+
})));
|
|
26
|
+
describe("Link component accessibility tests", function () {
|
|
27
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
28
|
+
var _render, container, results;
|
|
29
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
30
|
+
while (1) switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
33
|
+
href: "https://www.google.com",
|
|
34
|
+
icon: icon,
|
|
35
|
+
iconPosition: "before",
|
|
36
|
+
margin: "medium"
|
|
37
|
+
}, "Link"), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
38
|
+
href: "https://www.google.com",
|
|
39
|
+
icon: icon,
|
|
40
|
+
iconPosition: "after",
|
|
41
|
+
margin: "medium"
|
|
42
|
+
}, "Link"))), container = _render.container;
|
|
43
|
+
_context.next = 3;
|
|
44
|
+
return (0, _jestAxe.axe)(container);
|
|
45
|
+
case 3:
|
|
46
|
+
results = _context.sent;
|
|
47
|
+
expect(results).toHaveNoViolations();
|
|
48
|
+
case 5:
|
|
49
|
+
case "end":
|
|
50
|
+
return _context.stop();
|
|
51
|
+
}
|
|
52
|
+
}, _callee);
|
|
53
|
+
})));
|
|
54
|
+
it("Should not have basic accessibility issues for disabled mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
55
|
+
var _render2, container, results;
|
|
56
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
57
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
58
|
+
case 0:
|
|
59
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
60
|
+
href: "https://www.google.com",
|
|
61
|
+
icon: icon,
|
|
62
|
+
iconPosition: "before",
|
|
63
|
+
margin: "medium",
|
|
64
|
+
disabled: true
|
|
65
|
+
}, "Link"), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
66
|
+
href: "https://www.google.com",
|
|
67
|
+
icon: icon,
|
|
68
|
+
iconPosition: "after",
|
|
69
|
+
margin: "medium",
|
|
70
|
+
disabled: true
|
|
71
|
+
}, "Link"))), container = _render2.container;
|
|
72
|
+
_context2.next = 3;
|
|
73
|
+
return (0, _jestAxe.axe)(container);
|
|
74
|
+
case 3:
|
|
75
|
+
results = _context2.sent;
|
|
76
|
+
expect(results).toHaveNoViolations();
|
|
77
|
+
case 5:
|
|
78
|
+
case "end":
|
|
79
|
+
return _context2.stop();
|
|
80
|
+
}
|
|
81
|
+
}, _callee2);
|
|
82
|
+
})));
|
|
83
|
+
it("Should not have basic accessibility issues for new-window mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
84
|
+
var _render3, container, results;
|
|
85
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
86
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
87
|
+
case 0:
|
|
88
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
89
|
+
href: "https://www.google.com",
|
|
90
|
+
icon: icon,
|
|
91
|
+
iconPosition: "before",
|
|
92
|
+
margin: "medium",
|
|
93
|
+
newWindow: true
|
|
94
|
+
}, "Link"), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
95
|
+
href: "https://www.google.com",
|
|
96
|
+
icon: icon,
|
|
97
|
+
iconPosition: "after",
|
|
98
|
+
margin: "medium",
|
|
99
|
+
newWindow: true
|
|
100
|
+
}, "Link"))), container = _render3.container;
|
|
101
|
+
_context3.next = 3;
|
|
102
|
+
return (0, _jestAxe.axe)(container);
|
|
103
|
+
case 3:
|
|
104
|
+
results = _context3.sent;
|
|
105
|
+
expect(results).toHaveNoViolations();
|
|
106
|
+
case 5:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context3.stop();
|
|
109
|
+
}
|
|
110
|
+
}, _callee3);
|
|
111
|
+
})));
|
|
112
|
+
});
|
package/link/Link.js
CHANGED
|
@@ -14,7 +14,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
15
15
|
var _variables = require("../common/variables");
|
|
16
16
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
17
|
-
var
|
|
17
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
18
|
+
var _templateObject, _templateObject2;
|
|
18
19
|
var _excluded = ["inheritColor", "disabled", "icon", "iconPosition", "href", "newWindow", "onClick", "margin", "tabIndex", "children"];
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -24,8 +25,8 @@ var LinkContent = /*#__PURE__*/_react["default"].memo(function (_ref) {
|
|
|
24
25
|
children = _ref.children;
|
|
25
26
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, iconPosition === "after" && children, icon && /*#__PURE__*/_react["default"].createElement(LinkIconContainer, {
|
|
26
27
|
iconPosition: iconPosition
|
|
27
|
-
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(
|
|
28
|
-
|
|
28
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
29
|
+
icon: icon
|
|
29
30
|
}) : icon), iconPosition === "before" && children);
|
|
30
31
|
});
|
|
31
32
|
var DxcLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
@@ -104,12 +105,13 @@ var StyledLink = _styledComponents["default"].div(_templateObject || (_templateO
|
|
|
104
105
|
}, function (props) {
|
|
105
106
|
return "color: ".concat(props.theme.activeFontColor, " !important;\n border-bottom-color: ").concat(props.theme.activeUnderlineColor, " !important;");
|
|
106
107
|
});
|
|
107
|
-
var
|
|
108
|
-
var LinkIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n align-self: center;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
108
|
+
var LinkIconContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n align-self: center;\n\n font-size: ", ";\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
109
109
|
return props.theme.iconSize;
|
|
110
110
|
}, function (props) {
|
|
111
111
|
return props.theme.iconSize;
|
|
112
112
|
}, function (props) {
|
|
113
113
|
return "".concat(props.iconPosition === "before" ? "margin-right" : "margin-left", ": ").concat(props.theme.iconSpacing);
|
|
114
|
+
}, function (props) {
|
|
115
|
+
return props.theme.iconSize;
|
|
114
116
|
});
|
|
115
117
|
var _default = exports["default"] = DxcLink;
|
package/link/Link.stories.tsx
CHANGED
|
@@ -33,7 +33,7 @@ export const Chromatic = () => (
|
|
|
33
33
|
<Title title="Disabled" theme="light" level={4} />
|
|
34
34
|
<DxcLink disabled>Test</DxcLink>
|
|
35
35
|
<Title title="Icon before" theme="light" level={4} />
|
|
36
|
-
<DxcLink href="https://www.google.com" icon=
|
|
36
|
+
<DxcLink href="https://www.google.com" icon="lock" iconPosition="before">
|
|
37
37
|
Test
|
|
38
38
|
</DxcLink>
|
|
39
39
|
<Title title="Icon after" theme="light" level={4} />
|
|
@@ -76,7 +76,7 @@ export const Chromatic = () => (
|
|
|
76
76
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
77
77
|
<Title title="Long text with hover" theme="light" level={4} />
|
|
78
78
|
Lorem{" "}
|
|
79
|
-
<DxcLink href="https://www.google.com" icon=
|
|
79
|
+
<DxcLink href="https://www.google.com" icon="filled_home">
|
|
80
80
|
Test
|
|
81
81
|
</DxcLink>{" "}
|
|
82
82
|
ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
|
package/link/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type LinkProps = {
|
|
|
17
17
|
*/
|
|
18
18
|
inheritColor?: boolean;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Material Symbol name or SVG element as the icon that will be placed next to the link text.
|
|
21
21
|
*/
|
|
22
22
|
icon?: string | SVG;
|
|
23
23
|
/**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _jestAxe = require("jest-axe");
|
|
9
|
+
var _NavTabs = _interopRequireDefault(require("./NavTabs.tsx"));
|
|
10
|
+
var favoriteIcon = 'filled_Favorite';
|
|
11
|
+
var pinIcon = 'Location_On';
|
|
12
|
+
describe("Tabs component accessibility tests", function () {
|
|
13
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
14
|
+
var _render, container, results;
|
|
15
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], {
|
|
19
|
+
iconPosition: "left"
|
|
20
|
+
}, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
21
|
+
href: "/test1",
|
|
22
|
+
icon: favoriteIcon,
|
|
23
|
+
active: true
|
|
24
|
+
}, "Tab 1"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
25
|
+
href: "/test2",
|
|
26
|
+
icon: favoriteIcon,
|
|
27
|
+
disabled: true
|
|
28
|
+
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
29
|
+
href: "/test3",
|
|
30
|
+
icon: pinIcon,
|
|
31
|
+
notificationNumber: 12
|
|
32
|
+
}, "Tab 3"))), container = _render.container;
|
|
33
|
+
_context.next = 3;
|
|
34
|
+
return (0, _jestAxe.axe)(container);
|
|
35
|
+
case 3:
|
|
36
|
+
results = _context.sent;
|
|
37
|
+
expect(results).toHaveNoViolations();
|
|
38
|
+
case 5:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}, _callee);
|
|
43
|
+
})));
|
|
44
|
+
});
|
package/nav-tabs/NavTabs.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import NavTabsPropsType
|
|
3
|
-
export declare const NavTabsContext: React.Context<NavTabsContextProps>;
|
|
2
|
+
import NavTabsPropsType from "./types";
|
|
4
3
|
declare const DxcNavTabs: {
|
|
5
4
|
({ iconPosition, tabIndex, children }: NavTabsPropsType): JSX.Element;
|
|
6
5
|
Tab: React.ForwardRefExoticComponent<import("./types").TabProps & React.RefAttributes<HTMLAnchorElement>>;
|
package/nav-tabs/NavTabs.js
CHANGED
|
@@ -5,17 +5,17 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] =
|
|
8
|
+
exports["default"] = void 0;
|
|
9
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
13
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
14
14
|
var _Tab = _interopRequireDefault(require("./Tab"));
|
|
15
|
+
var _NavTabsContext = require("./NavTabsContext");
|
|
15
16
|
var _templateObject, _templateObject2;
|
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
18
|
-
var NavTabsContext = exports.NavTabsContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
19
19
|
var getPropInChild = function getPropInChild(child, propName) {
|
|
20
20
|
return child.props ? child.props[propName] ? child.props[propName] : child.props.children ? getPropInChild(child.props.children, propName) : undefined : undefined;
|
|
21
21
|
};
|
|
@@ -81,7 +81,7 @@ var DxcNavTabs = function DxcNavTabs(_ref) {
|
|
|
81
81
|
onKeyDown: handleOnKeyDown,
|
|
82
82
|
role: "tablist",
|
|
83
83
|
"aria-label": "Navigation tabs"
|
|
84
|
-
}, /*#__PURE__*/_react["default"].createElement(NavTabsContext.Provider, {
|
|
84
|
+
}, /*#__PURE__*/_react["default"].createElement(_NavTabsContext.NavTabsContext.Provider, {
|
|
85
85
|
value: contextValue
|
|
86
86
|
}, children), /*#__PURE__*/_react["default"].createElement(Underline, null)));
|
|
87
87
|
};
|
|
@@ -16,7 +16,10 @@ const iconSVG = (
|
|
|
16
16
|
</svg>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
const favoriteIcon = 'filled_Favorite'
|
|
21
|
+
|
|
22
|
+
const pinIcon = 'Location_On';
|
|
20
23
|
|
|
21
24
|
const opinionatedTheme = {
|
|
22
25
|
navTabs: {
|
|
@@ -105,10 +108,10 @@ export const Chromatic = () => (
|
|
|
105
108
|
<DxcNavTabs.Tab href="#" disabled icon={iconSVG}>
|
|
106
109
|
Tab 2
|
|
107
110
|
</DxcNavTabs.Tab>
|
|
108
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
111
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon}>
|
|
109
112
|
Tab 3
|
|
110
113
|
</DxcNavTabs.Tab>
|
|
111
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
114
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon}>
|
|
112
115
|
Tab 4
|
|
113
116
|
</DxcNavTabs.Tab>
|
|
114
117
|
</DxcNavTabs>
|
|
@@ -116,16 +119,16 @@ export const Chromatic = () => (
|
|
|
116
119
|
<ExampleContainer>
|
|
117
120
|
<Title title="With icon position left" theme="light" level={4} />
|
|
118
121
|
<DxcNavTabs iconPosition="left">
|
|
119
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
122
|
+
<DxcNavTabs.Tab href="#" active icon={pinIcon}>
|
|
120
123
|
Tab 1
|
|
121
124
|
</DxcNavTabs.Tab>
|
|
122
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
125
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon}>
|
|
123
126
|
Tab 2
|
|
124
127
|
</DxcNavTabs.Tab>
|
|
125
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
128
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
126
129
|
Tab 3
|
|
127
130
|
</DxcNavTabs.Tab>
|
|
128
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
131
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
129
132
|
Tab 4
|
|
130
133
|
</DxcNavTabs.Tab>
|
|
131
134
|
</DxcNavTabs>
|
|
@@ -133,16 +136,16 @@ export const Chromatic = () => (
|
|
|
133
136
|
<ExampleContainer>
|
|
134
137
|
<Title title="With icon and notification number" theme="light" level={4} />
|
|
135
138
|
<DxcNavTabs>
|
|
136
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
139
|
+
<DxcNavTabs.Tab href="#" active icon={pinIcon} notificationNumber>
|
|
137
140
|
Tab 1
|
|
138
141
|
</DxcNavTabs.Tab>
|
|
139
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
142
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
140
143
|
Tab 2
|
|
141
144
|
</DxcNavTabs.Tab>
|
|
142
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
145
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
|
|
143
146
|
Tab 3
|
|
144
147
|
</DxcNavTabs.Tab>
|
|
145
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
148
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={12}>
|
|
146
149
|
Tab 4
|
|
147
150
|
</DxcNavTabs.Tab>
|
|
148
151
|
</DxcNavTabs>
|
|
@@ -150,16 +153,16 @@ export const Chromatic = () => (
|
|
|
150
153
|
<ExampleContainer>
|
|
151
154
|
<Title title="With icon on the left and notification number" theme="light" level={4} />
|
|
152
155
|
<DxcNavTabs iconPosition="left">
|
|
153
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
156
|
+
<DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
|
|
154
157
|
Tab 1
|
|
155
158
|
</DxcNavTabs.Tab>
|
|
156
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
159
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
157
160
|
Tab 2
|
|
158
161
|
</DxcNavTabs.Tab>
|
|
159
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
162
|
+
<DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={120}>
|
|
160
163
|
Tab 3
|
|
161
164
|
</DxcNavTabs.Tab>
|
|
162
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
165
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
|
|
163
166
|
Tab 4
|
|
164
167
|
</DxcNavTabs.Tab>
|
|
165
168
|
</DxcNavTabs>
|
|
@@ -170,10 +173,10 @@ export const Chromatic = () => (
|
|
|
170
173
|
<DxcNavTabs.Tab href="#" active>
|
|
171
174
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
172
175
|
</DxcNavTabs.Tab>
|
|
173
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
176
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
|
|
174
177
|
Tab 2
|
|
175
178
|
</DxcNavTabs.Tab>
|
|
176
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
179
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
177
180
|
Tab 3
|
|
178
181
|
</DxcNavTabs.Tab>
|
|
179
182
|
</DxcNavTabs>
|
|
@@ -184,10 +187,10 @@ export const Chromatic = () => (
|
|
|
184
187
|
<DxcNavTabs.Tab href="#" active>
|
|
185
188
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
|
186
189
|
</DxcNavTabs.Tab>
|
|
187
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
190
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
|
|
188
191
|
Tab 2
|
|
189
192
|
</DxcNavTabs.Tab>
|
|
190
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
193
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon}>
|
|
191
194
|
Tab 3
|
|
192
195
|
</DxcNavTabs.Tab>
|
|
193
196
|
</DxcNavTabs>
|
|
@@ -257,16 +260,16 @@ export const Chromatic = () => (
|
|
|
257
260
|
<Title title="With icon and notification number" theme="light" level={4} />
|
|
258
261
|
<HalstackProvider theme={opinionatedTheme}>
|
|
259
262
|
<DxcNavTabs>
|
|
260
|
-
<DxcNavTabs.Tab href="#" active icon={
|
|
263
|
+
<DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
|
|
261
264
|
Tab 1
|
|
262
265
|
</DxcNavTabs.Tab>
|
|
263
|
-
<DxcNavTabs.Tab href="#" disabled icon={
|
|
266
|
+
<DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
|
|
264
267
|
Tab 2
|
|
265
268
|
</DxcNavTabs.Tab>
|
|
266
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
269
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
|
|
267
270
|
Tab 3
|
|
268
271
|
</DxcNavTabs.Tab>
|
|
269
|
-
<DxcNavTabs.Tab href="#" icon={
|
|
272
|
+
<DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
|
|
270
273
|
Tab 4
|
|
271
274
|
</DxcNavTabs.Tab>
|
|
272
275
|
</DxcNavTabs>
|
package/nav-tabs/NavTabs.test.js
CHANGED
|
@@ -46,7 +46,7 @@ describe("Tabs component tests", function () {
|
|
|
46
46
|
}, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
|
|
47
47
|
href: "/test3",
|
|
48
48
|
notificationNumber: 1000,
|
|
49
|
-
icon: "
|
|
49
|
+
icon: "Settings"
|
|
50
50
|
}, "Tab 3"))),
|
|
51
51
|
getByText = _render2.getByText,
|
|
52
52
|
getByRole = _render2.getByRole,
|
|
@@ -54,7 +54,6 @@ describe("Tabs component tests", function () {
|
|
|
54
54
|
expect(getByText("10")).toBeTruthy();
|
|
55
55
|
expect(queryByText("20")).toBeFalsy();
|
|
56
56
|
expect(getByText("+99")).toBeTruthy();
|
|
57
|
-
expect(getByRole("img")).toBeTruthy();
|
|
58
57
|
});
|
|
59
58
|
test("Tabs render with correct tab index", function () {
|
|
60
59
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], {
|
package/nav-tabs/Tab.js
CHANGED
|
@@ -13,9 +13,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
14
14
|
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
15
15
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
16
|
-
var _NavTabs = require("./NavTabs");
|
|
17
16
|
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
18
17
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
18
|
+
var _NavTabsContext = require("./NavTabsContext");
|
|
19
|
+
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
19
20
|
var _templateObject, _templateObject2, _templateObject3;
|
|
20
21
|
var _excluded = ["href", "active", "icon", "disabled", "notificationNumber", "children"];
|
|
21
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -33,7 +34,7 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
33
34
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
34
35
|
var tabRef = (0, _react.useRef)();
|
|
35
36
|
var colorsTheme = (0, _useTheme["default"])();
|
|
36
|
-
var _useContext = (0, _react.useContext)(
|
|
37
|
+
var _useContext = (0, _react.useContext)(_NavTabsContext.NavTabsContext),
|
|
37
38
|
iconPosition = _useContext.iconPosition,
|
|
38
39
|
tabIndex = _useContext.tabIndex,
|
|
39
40
|
focusedLabel = _useContext.focusedLabel;
|
|
@@ -71,9 +72,11 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
71
72
|
onKeyDown: handleOnKeyDown,
|
|
72
73
|
tabIndex: active ? tabIndex : -1
|
|
73
74
|
}, otherProps), icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
|
|
74
|
-
iconPosition: iconPosition
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
iconPosition: iconPosition,
|
|
76
|
+
active: active,
|
|
77
|
+
disabled: disabled
|
|
78
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
79
|
+
icon: icon
|
|
77
80
|
}) : icon), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
78
81
|
alignItems: "center",
|
|
79
82
|
gap: "0.5rem"
|
|
@@ -92,14 +95,8 @@ var DxcTab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, _ref2) {
|
|
|
92
95
|
label: typeof notificationNumber === "number" && notificationNumber
|
|
93
96
|
}))));
|
|
94
97
|
});
|
|
95
|
-
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: stretch;\n border-bottom: 2px solid ", ";\n padding: 0.5rem;\n z-index: 1;\n
|
|
96
|
-
return props.active ? props.theme.selectedUnderlineColor :
|
|
97
|
-
}, function (props) {
|
|
98
|
-
return props.theme.unselectedIconColor;
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return props.theme.selectedIconColor;
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return props.theme.disabledIconColor;
|
|
98
|
+
var TabContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n align-items: stretch;\n border-bottom: 2px solid ", ";\n padding: 0.5rem;\n z-index: 1;\n"])), function (props) {
|
|
99
|
+
return props.active ? props.theme.selectedUnderlineColor : "transparent";
|
|
103
100
|
});
|
|
104
101
|
var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: ", ";\n justify-content: center;\n align-items: center;\n gap: ", ";\n height: ", ";\n min-width: 176px;\n min-height: 44px;\n padding: 0.375rem;\n border-radius: 4px;\n background: ", ";\n text-decoration-color: transparent;\n text-decoration-line: none;\n cursor: ", ";\n\n ", "\n"])), function (props) {
|
|
105
102
|
return props.hasIcon && props.iconPosition === "top" ? "column" : "row";
|
|
@@ -114,5 +111,7 @@ var Tab = _styledComponents["default"].a(_templateObject2 || (_templateObject2 =
|
|
|
114
111
|
}, function (props) {
|
|
115
112
|
return !props.disabled && "\n :hover {\n background: ".concat(props.theme.hoverBackgroundColor, ";\n }\n :focus {\n outline: 2px solid ").concat(props.theme.focusOutline, ";\n }\n :active {\n background: ").concat(props.theme.pressedBackgroundColor, ";\n outline: 2px solid #33aaff};\n }\n ");
|
|
116
113
|
});
|
|
117
|
-
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n
|
|
114
|
+
var TabIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n font-size: 24px;\n color: ", ";\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
115
|
+
return props.active ? props.theme.selectedIconColor : props.disabled ? props.theme.disabledIconColor : props.theme.unselectedIconColor;
|
|
116
|
+
});
|
|
118
117
|
var _default = exports["default"] = DxcTab;
|