@dxc-technology/halstack-react 11.0.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/BackgroundColorContext.d.ts +1 -10
  2. package/BackgroundColorContext.js +3 -8
  3. package/HalstackContext.d.ts +32 -142
  4. package/HalstackContext.js +2 -2
  5. package/accordion/Accordion.accessibility.test.js +71 -0
  6. package/accordion/Accordion.js +13 -27
  7. package/accordion/Accordion.stories.tsx +7 -49
  8. package/accordion/types.d.ts +1 -1
  9. package/accordion-group/AccordionGroup.accessibility.test.js +88 -0
  10. package/accordion-group/AccordionGroup.d.ts +2 -3
  11. package/accordion-group/AccordionGroup.js +4 -4
  12. package/accordion-group/AccordionGroup.stories.tsx +23 -23
  13. package/accordion-group/AccordionGroupAccordion.js +3 -3
  14. package/accordion-group/AccordionGroupContext.d.ts +3 -0
  15. package/accordion-group/AccordionGroupContext.js +8 -0
  16. package/accordion-group/types.d.ts +1 -1
  17. package/action-icon/ActionIcon.accessibility.test.js +63 -0
  18. package/action-icon/ActionIcon.d.ts +4 -0
  19. package/action-icon/ActionIcon.js +48 -0
  20. package/action-icon/ActionIcon.stories.tsx +41 -0
  21. package/action-icon/ActionIcon.test.js +64 -0
  22. package/action-icon/types.d.ts +26 -0
  23. package/action-icon/types.js +5 -0
  24. package/alert/Alert.accessibility.test.js +95 -0
  25. package/alert/Alert.js +21 -75
  26. package/badge/Badge.accessibility.test.js +129 -0
  27. package/badge/Badge.d.ts +1 -1
  28. package/badge/Badge.js +141 -28
  29. package/badge/Badge.stories.tsx +210 -0
  30. package/badge/Badge.test.js +30 -0
  31. package/badge/types.d.ts +52 -3
  32. package/box/Box.accessibility.test.js +33 -0
  33. package/box/Box.js +2 -5
  34. package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
  35. package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
  36. package/breadcrumbs/Breadcrumbs.d.ts +4 -0
  37. package/breadcrumbs/Breadcrumbs.js +79 -0
  38. package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
  39. package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
  40. package/breadcrumbs/Breadcrumbs.test.js +169 -0
  41. package/breadcrumbs/Item.d.ts +4 -0
  42. package/breadcrumbs/Item.js +52 -0
  43. package/breadcrumbs/dropdownTheme.d.ts +53 -0
  44. package/breadcrumbs/dropdownTheme.js +62 -0
  45. package/breadcrumbs/types.d.ts +16 -0
  46. package/breadcrumbs/types.js +5 -0
  47. package/bulleted-list/BulletedList.accessibility.test.js +119 -0
  48. package/bulleted-list/BulletedList.js +16 -23
  49. package/bulleted-list/BulletedList.stories.tsx +1 -2
  50. package/button/Button.accessibility.test.js +127 -0
  51. package/button/Button.js +16 -16
  52. package/button/Button.stories.tsx +34 -53
  53. package/button/Button.test.js +3 -1
  54. package/button/types.d.ts +1 -1
  55. package/card/Card.accessibility.test.js +36 -0
  56. package/card/Card.js +3 -2
  57. package/checkbox/Checkbox.accessibility.test.js +87 -0
  58. package/checkbox/Checkbox.js +31 -36
  59. package/chip/Chip.accessibility.test.js +67 -0
  60. package/chip/Chip.js +11 -6
  61. package/chip/Chip.stories.tsx +10 -25
  62. package/chip/Chip.test.js +4 -4
  63. package/common/coreTokens.d.ts +105 -14
  64. package/common/coreTokens.js +40 -22
  65. package/common/variables.d.ts +31 -138
  66. package/common/variables.js +103 -210
  67. package/container/Container.d.ts +4 -0
  68. package/container/Container.js +194 -0
  69. package/container/Container.stories.tsx +214 -0
  70. package/container/types.d.ts +74 -0
  71. package/container/types.js +5 -0
  72. package/contextual-menu/ContextualMenu.accessibility.test.js +97 -0
  73. package/contextual-menu/ContextualMenu.d.ts +5 -0
  74. package/contextual-menu/ContextualMenu.js +88 -0
  75. package/contextual-menu/ContextualMenu.stories.tsx +232 -0
  76. package/contextual-menu/ContextualMenu.test.js +205 -0
  77. package/contextual-menu/GroupItem.d.ts +4 -0
  78. package/contextual-menu/GroupItem.js +67 -0
  79. package/contextual-menu/ItemAction.d.ts +4 -0
  80. package/contextual-menu/ItemAction.js +51 -0
  81. package/contextual-menu/MenuItem.d.ts +4 -0
  82. package/contextual-menu/MenuItem.js +29 -0
  83. package/contextual-menu/SingleItem.d.ts +4 -0
  84. package/contextual-menu/SingleItem.js +38 -0
  85. package/contextual-menu/types.d.ts +58 -0
  86. package/contextual-menu/types.js +5 -0
  87. package/date-input/Calendar.js +1 -1
  88. package/date-input/DateInput.accessibility.test.js +228 -0
  89. package/date-input/DateInput.js +4 -5
  90. package/date-input/DateInput.stories.tsx +15 -8
  91. package/date-input/DatePicker.js +13 -7
  92. package/date-input/YearPicker.js +1 -1
  93. package/date-input/types.d.ts +2 -2
  94. package/dialog/Dialog.accessibility.test.js +69 -0
  95. package/dialog/Dialog.js +11 -25
  96. package/dialog/Dialog.stories.tsx +176 -0
  97. package/dialog/Dialog.test.js +1 -1
  98. package/divider/Divider.accessibility.test.js +33 -0
  99. package/divider/Divider.d.ts +4 -0
  100. package/divider/Divider.js +36 -0
  101. package/divider/Divider.stories.tsx +223 -0
  102. package/divider/Divider.test.js +38 -0
  103. package/divider/types.d.ts +21 -0
  104. package/divider/types.js +5 -0
  105. package/dropdown/Dropdown.accessibility.test.js +180 -0
  106. package/dropdown/Dropdown.js +26 -39
  107. package/dropdown/Dropdown.stories.tsx +15 -26
  108. package/dropdown/Dropdown.test.js +18 -18
  109. package/dropdown/DropdownMenu.js +4 -4
  110. package/dropdown/DropdownMenuItem.js +8 -4
  111. package/dropdown/types.d.ts +3 -5
  112. package/file-input/FileInput.accessibility.test.js +160 -0
  113. package/file-input/FileInput.js +126 -141
  114. package/file-input/FileInput.test.js +84 -110
  115. package/file-input/FileItem.js +18 -28
  116. package/file-input/types.d.ts +1 -1
  117. package/footer/Footer.accessibility.test.js +125 -0
  118. package/footer/Footer.d.ts +1 -1
  119. package/footer/Footer.js +36 -31
  120. package/footer/Footer.stories.tsx +58 -2
  121. package/footer/Icons.d.ts +1 -0
  122. package/footer/Icons.js +52 -16
  123. package/footer/types.d.ts +8 -8
  124. package/header/Header.accessibility.test.js +93 -0
  125. package/header/Header.js +20 -41
  126. package/header/Header.stories.tsx +16 -0
  127. package/header/Icons.js +1 -6
  128. package/header/types.d.ts +4 -3
  129. package/heading/Heading.accessibility.test.js +33 -0
  130. package/heading/Heading.js +1 -1
  131. package/icon/Icon.accessibility.test.js +30 -0
  132. package/icon/Icon.d.ts +4 -0
  133. package/icon/Icon.js +33 -0
  134. package/icon/Icon.stories.tsx +28 -0
  135. package/icon/types.d.ts +4 -0
  136. package/icon/types.js +5 -0
  137. package/image/Image.accessibility.test.js +56 -0
  138. package/image/Image.js +1 -1
  139. package/image/Image.stories.tsx +3 -1
  140. package/layout/ApplicationLayout.d.ts +1 -1
  141. package/layout/ApplicationLayout.js +10 -7
  142. package/layout/Icons.d.ts +0 -1
  143. package/layout/Icons.js +1 -11
  144. package/link/Link.accessibility.test.js +108 -0
  145. package/link/Link.js +8 -6
  146. package/link/Link.stories.tsx +4 -4
  147. package/link/types.d.ts +1 -1
  148. package/main.d.ts +7 -3
  149. package/main.js +37 -9
  150. package/nav-tabs/NavTabs.accessibility.test.js +44 -0
  151. package/nav-tabs/NavTabs.d.ts +1 -2
  152. package/nav-tabs/NavTabs.js +10 -7
  153. package/nav-tabs/NavTabs.stories.tsx +29 -24
  154. package/nav-tabs/NavTabs.test.js +11 -9
  155. package/nav-tabs/NavTabsContext.d.ts +3 -0
  156. package/nav-tabs/NavTabsContext.js +8 -0
  157. package/nav-tabs/Tab.js +23 -23
  158. package/nav-tabs/types.d.ts +1 -1
  159. package/number-input/NumberInput.accessibility.test.js +228 -0
  160. package/number-input/NumberInput.d.ts +0 -7
  161. package/number-input/NumberInput.js +24 -5
  162. package/number-input/NumberInput.test.js +165 -6
  163. package/number-input/NumberInputContext.d.ts +3 -0
  164. package/number-input/NumberInputContext.js +8 -0
  165. package/number-input/types.d.ts +6 -0
  166. package/package.json +16 -14
  167. package/paginator/Paginator.accessibility.test.js +79 -0
  168. package/paginator/Paginator.js +14 -14
  169. package/paragraph/Paragraph.accessibility.test.js +28 -0
  170. package/paragraph/Paragraph.js +2 -7
  171. package/password-input/PasswordInput.accessibility.test.js +153 -0
  172. package/password-input/PasswordInput.js +7 -7
  173. package/password-input/PasswordInput.stories.tsx +0 -1
  174. package/password-input/PasswordInput.test.js +4 -4
  175. package/progress-bar/ProgressBar.accessibility.test.js +35 -0
  176. package/progress-bar/ProgressBar.js +11 -15
  177. package/quick-nav/QuickNav.accessibility.test.js +57 -0
  178. package/quick-nav/QuickNav.js +1 -1
  179. package/radio-group/Radio.js +1 -1
  180. package/radio-group/RadioGroup.accessibility.test.js +97 -0
  181. package/radio-group/RadioGroup.js +3 -2
  182. package/resultset-table/ResultsetTable.accessibility.test.js +285 -0
  183. package/resultset-table/ResultsetTable.d.ts +4 -1
  184. package/resultset-table/ResultsetTable.js +25 -13
  185. package/resultset-table/ResultsetTable.stories.tsx +118 -5
  186. package/resultset-table/ResultsetTable.test.js +76 -0
  187. package/resultset-table/types.d.ts +40 -7
  188. package/select/Listbox.js +28 -16
  189. package/select/Option.js +19 -10
  190. package/select/Select.accessibility.test.js +228 -0
  191. package/select/Select.js +57 -37
  192. package/select/Select.stories.tsx +59 -111
  193. package/select/Select.test.js +387 -456
  194. package/select/types.d.ts +3 -3
  195. package/sidenav/Sidenav.accessibility.test.js +59 -0
  196. package/sidenav/Sidenav.js +21 -19
  197. package/sidenav/Sidenav.stories.tsx +4 -9
  198. package/sidenav/types.d.ts +2 -2
  199. package/slider/Slider.accessibility.test.js +104 -0
  200. package/slider/Slider.js +40 -48
  201. package/spinner/Spinner.accessibility.test.js +96 -0
  202. package/spinner/Spinner.js +12 -16
  203. package/status-light/StatusLight.accessibility.test.js +157 -0
  204. package/status-light/StatusLight.d.ts +4 -0
  205. package/status-light/StatusLight.js +51 -0
  206. package/status-light/StatusLight.stories.tsx +74 -0
  207. package/status-light/StatusLight.test.js +25 -0
  208. package/status-light/types.d.ts +17 -0
  209. package/status-light/types.js +5 -0
  210. package/switch/Switch.accessibility.test.js +98 -0
  211. package/switch/Switch.js +24 -29
  212. package/switch/Switch.stories.tsx +12 -0
  213. package/table/DropdownTheme.js +62 -0
  214. package/table/Table.accessibility.test.js +93 -0
  215. package/table/Table.d.ts +6 -2
  216. package/table/Table.js +74 -12
  217. package/table/Table.stories.tsx +309 -2
  218. package/table/Table.test.js +92 -0
  219. package/table/types.d.ts +28 -0
  220. package/tabs/Tab.js +13 -9
  221. package/tabs/Tabs.accessibility.test.js +56 -0
  222. package/tabs/Tabs.js +12 -24
  223. package/tabs/Tabs.stories.tsx +8 -4
  224. package/tabs/Tabs.test.js +19 -37
  225. package/tabs/types.d.ts +2 -2
  226. package/tag/Tag.accessibility.test.js +69 -0
  227. package/tag/Tag.js +7 -7
  228. package/tag/Tag.stories.tsx +4 -7
  229. package/tag/Tag.test.js +4 -12
  230. package/tag/types.d.ts +2 -2
  231. package/text-input/Suggestion.js +1 -1
  232. package/text-input/Suggestions.js +19 -14
  233. package/text-input/TextInput.accessibility.test.js +321 -0
  234. package/text-input/TextInput.js +84 -105
  235. package/text-input/TextInput.stories.tsx +17 -8
  236. package/text-input/TextInput.test.js +96 -79
  237. package/textarea/Textarea.accessibility.test.js +155 -0
  238. package/textarea/Textarea.js +12 -17
  239. package/textarea/Textarea.stories.tsx +0 -1
  240. package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
  241. package/toggle-group/ToggleGroup.js +6 -8
  242. package/toggle-group/ToggleGroup.stories.tsx +3 -3
  243. package/toggle-group/types.d.ts +2 -2
  244. package/typography/Typography.accessibility.test.js +339 -0
  245. package/useTheme.d.ts +31 -138
  246. package/utils/BaseTypography.js +1 -1
  247. package/utils/FocusLock.js +16 -6
  248. package/wizard/Wizard.accessibility.test.js +55 -0
  249. package/wizard/Wizard.js +14 -25
  250. package/wizard/Wizard.stories.tsx +19 -0
  251. package/wizard/types.d.ts +2 -2
  252. package/common/OpenSans.css +0 -69
  253. package/common/fonts/OpenSans-Bold.ttf +0 -0
  254. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  255. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  256. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  257. package/common/fonts/OpenSans-Italic.ttf +0 -0
  258. package/common/fonts/OpenSans-Light.ttf +0 -0
  259. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  260. package/common/fonts/OpenSans-Regular.ttf +0 -0
  261. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  262. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  263. package/date-input/Icons.d.ts +0 -6
  264. package/date-input/Icons.js +0 -58
  265. package/paginator/Icons.d.ts +0 -5
  266. package/paginator/Icons.js +0 -40
  267. package/password-input/Icons.d.ts +0 -6
  268. package/password-input/Icons.js +0 -35
  269. package/select/Icons.d.ts +0 -10
  270. package/select/Icons.js +0 -89
  271. package/sidenav/Icons.d.ts +0 -7
  272. package/sidenav/Icons.js +0 -47
  273. package/text-input/Icons.d.ts +0 -8
  274. package/text-input/Icons.js +0 -56
  275. /package/{layout → sidenav}/SidenavContext.d.ts +0 -0
  276. /package/{layout → sidenav}/SidenavContext.js +0 -0
@@ -0,0 +1,108 @@
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 _axeHelper = require("../../test/accessibility/axe-helper.js");
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", null, /*#__PURE__*/_react["default"].createElement("rect", {
16
+ fill: "none",
17
+ width: "24",
18
+ height: "24"
19
+ })), /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
20
+ 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"
21
+ })));
22
+ describe("Link component accessibility tests", function () {
23
+ it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
24
+ var _render, container, results;
25
+ return _regenerator["default"].wrap(function _callee$(_context) {
26
+ while (1) switch (_context.prev = _context.next) {
27
+ case 0:
28
+ _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
29
+ href: "https://www.google.com",
30
+ icon: icon,
31
+ iconPosition: "before",
32
+ margin: "medium"
33
+ }, "Link"), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
34
+ href: "https://www.google.com",
35
+ icon: icon,
36
+ iconPosition: "after",
37
+ margin: "medium"
38
+ }, "Link"))), container = _render.container;
39
+ _context.next = 3;
40
+ return (0, _axeHelper.axe)(container);
41
+ case 3:
42
+ results = _context.sent;
43
+ expect(results).toHaveNoViolations();
44
+ case 5:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }, _callee);
49
+ })));
50
+ it("Should not have basic accessibility issues for disabled mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
51
+ var _render2, container, results;
52
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
53
+ while (1) switch (_context2.prev = _context2.next) {
54
+ case 0:
55
+ _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
56
+ href: "https://www.google.com",
57
+ icon: icon,
58
+ iconPosition: "before",
59
+ margin: "medium",
60
+ disabled: true
61
+ }, "Link"), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
62
+ href: "https://www.google.com",
63
+ icon: icon,
64
+ iconPosition: "after",
65
+ margin: "medium",
66
+ disabled: true
67
+ }, "Link"))), container = _render2.container;
68
+ _context2.next = 3;
69
+ return (0, _axeHelper.axe)(container);
70
+ case 3:
71
+ results = _context2.sent;
72
+ expect(results).toHaveNoViolations();
73
+ case 5:
74
+ case "end":
75
+ return _context2.stop();
76
+ }
77
+ }, _callee2);
78
+ })));
79
+ it("Should not have basic accessibility issues for new-window mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
80
+ var _render3, container, results;
81
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
82
+ while (1) switch (_context3.prev = _context3.next) {
83
+ case 0:
84
+ _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Flex["default"], null, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
85
+ href: "https://www.google.com",
86
+ icon: icon,
87
+ iconPosition: "before",
88
+ margin: "medium",
89
+ newWindow: true
90
+ }, "Link"), /*#__PURE__*/_react["default"].createElement(_Link["default"], {
91
+ href: "https://www.google.com",
92
+ icon: icon,
93
+ iconPosition: "after",
94
+ margin: "medium",
95
+ newWindow: true
96
+ }, "Link"))), container = _render3.container;
97
+ _context3.next = 3;
98
+ return (0, _axeHelper.axe)(container);
99
+ case 3:
100
+ results = _context3.sent;
101
+ expect(results).toHaveNoViolations();
102
+ case 5:
103
+ case "end":
104
+ return _context3.stop();
105
+ }
106
+ }, _callee3);
107
+ })));
108
+ });
package/link/Link.js CHANGED
@@ -14,18 +14,19 @@ 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 _templateObject, _templateObject2, _templateObject3;
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
- 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; }
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 && {}.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; }
21
22
  var LinkContent = /*#__PURE__*/_react["default"].memo(function (_ref) {
22
23
  var iconPosition = _ref.iconPosition,
23
24
  icon = _ref.icon,
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(LinkIcon, {
28
- src: icon
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 LinkIcon = _styledComponents["default"].img(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])([""])));
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;
@@ -11,10 +11,10 @@ export default {
11
11
 
12
12
  const icon = (
13
13
  <svg viewBox="0 0 24 24" enableBackground="new 0 0 24 24" fill="currentColor">
14
- <g id="Bounding_Box">
14
+ <g>
15
15
  <rect fill="none" width="24" height="24" />
16
16
  </g>
17
- <g id="Master">
17
+ <g>
18
18
  <path 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" />
19
19
  </g>
20
20
  </svg>
@@ -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={icon} iconPosition="before">
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={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
- * Element or path used as the icon that will be placed next to the link text.
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
  /**
package/main.d.ts CHANGED
@@ -22,7 +22,6 @@ import DxcChip from "./chip/Chip";
22
22
  import DxcApplicationLayout from "./layout/ApplicationLayout";
23
23
  import DxcToggleGroup from "./toggle-group/ToggleGroup";
24
24
  import DxcAccordionGroup from "./accordion-group/AccordionGroup";
25
- import DxcBadge from "./badge/Badge";
26
25
  import DxcTextInput from "./text-input/TextInput";
27
26
  import DxcPasswordInput from "./password-input/PasswordInput";
28
27
  import DxcDateInput from "./date-input/DateInput";
@@ -41,6 +40,11 @@ import DxcParagraph from "./paragraph/Paragraph";
41
40
  import DxcBulletedList from "./bulleted-list/BulletedList";
42
41
  import DxcGrid from "./grid/Grid";
43
42
  import DxcImage from "./image/Image";
43
+ import DxcContainer from "./container/Container";
44
+ import DxcBadge from "./badge/Badge";
45
+ import DxcStatusLight from "./status-light/StatusLight";
46
+ import DxcContextualMenu from "./contextual-menu/ContextualMenu";
47
+ import DxcDivider from "./divider/Divider";
48
+ import DxcBreadcrumbs from "./breadcrumbs/Breadcrumbs";
44
49
  import HalstackContext, { HalstackProvider, HalstackLanguageContext } from "./HalstackContext";
45
- import { BackgroundColorProvider } from "./BackgroundColorContext";
46
- export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, DxcGrid, DxcImage, };
50
+ export { DxcAlert, DxcButton, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, DxcAccordionGroup, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcFlex, DxcTypography, DxcParagraph, DxcBulletedList, DxcGrid, DxcImage, DxcContainer, DxcBadge, DxcStatusLight, DxcContextualMenu, DxcDivider, DxcBreadcrumbs, };
package/main.js CHANGED
@@ -5,12 +5,6 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- Object.defineProperty(exports, "BackgroundColorProvider", {
9
- enumerable: true,
10
- get: function get() {
11
- return _BackgroundColorContext.BackgroundColorProvider;
12
- }
13
- });
14
8
  Object.defineProperty(exports, "DxcAccordion", {
15
9
  enumerable: true,
16
10
  get: function get() {
@@ -53,6 +47,12 @@ Object.defineProperty(exports, "DxcBox", {
53
47
  return _Box["default"];
54
48
  }
55
49
  });
50
+ Object.defineProperty(exports, "DxcBreadcrumbs", {
51
+ enumerable: true,
52
+ get: function get() {
53
+ return _Breadcrumbs["default"];
54
+ }
55
+ });
56
56
  Object.defineProperty(exports, "DxcBulletedList", {
57
57
  enumerable: true,
58
58
  get: function get() {
@@ -83,6 +83,18 @@ Object.defineProperty(exports, "DxcChip", {
83
83
  return _Chip["default"];
84
84
  }
85
85
  });
86
+ Object.defineProperty(exports, "DxcContainer", {
87
+ enumerable: true,
88
+ get: function get() {
89
+ return _Container["default"];
90
+ }
91
+ });
92
+ Object.defineProperty(exports, "DxcContextualMenu", {
93
+ enumerable: true,
94
+ get: function get() {
95
+ return _ContextualMenu["default"];
96
+ }
97
+ });
86
98
  Object.defineProperty(exports, "DxcDateInput", {
87
99
  enumerable: true,
88
100
  get: function get() {
@@ -95,6 +107,12 @@ Object.defineProperty(exports, "DxcDialog", {
95
107
  return _Dialog["default"];
96
108
  }
97
109
  });
110
+ Object.defineProperty(exports, "DxcDivider", {
111
+ enumerable: true,
112
+ get: function get() {
113
+ return _Divider["default"];
114
+ }
115
+ });
98
116
  Object.defineProperty(exports, "DxcDropdown", {
99
117
  enumerable: true,
100
118
  get: function get() {
@@ -215,6 +233,12 @@ Object.defineProperty(exports, "DxcSpinner", {
215
233
  return _Spinner["default"];
216
234
  }
217
235
  });
236
+ Object.defineProperty(exports, "DxcStatusLight", {
237
+ enumerable: true,
238
+ get: function get() {
239
+ return _StatusLight["default"];
240
+ }
241
+ });
218
242
  Object.defineProperty(exports, "DxcSwitch", {
219
243
  enumerable: true,
220
244
  get: function get() {
@@ -311,7 +335,6 @@ var _Chip = _interopRequireDefault(require("./chip/Chip"));
311
335
  var _ApplicationLayout = _interopRequireDefault(require("./layout/ApplicationLayout"));
312
336
  var _ToggleGroup = _interopRequireDefault(require("./toggle-group/ToggleGroup"));
313
337
  var _AccordionGroup = _interopRequireDefault(require("./accordion-group/AccordionGroup"));
314
- var _Badge = _interopRequireDefault(require("./badge/Badge"));
315
338
  var _TextInput = _interopRequireDefault(require("./text-input/TextInput"));
316
339
  var _PasswordInput = _interopRequireDefault(require("./password-input/PasswordInput"));
317
340
  var _DateInput = _interopRequireDefault(require("./date-input/DateInput"));
@@ -330,7 +353,12 @@ var _Paragraph = _interopRequireDefault(require("./paragraph/Paragraph"));
330
353
  var _BulletedList = _interopRequireDefault(require("./bulleted-list/BulletedList"));
331
354
  var _Grid = _interopRequireDefault(require("./grid/Grid"));
332
355
  var _Image = _interopRequireDefault(require("./image/Image"));
356
+ var _Container = _interopRequireDefault(require("./container/Container"));
357
+ var _Badge = _interopRequireDefault(require("./badge/Badge"));
358
+ var _StatusLight = _interopRequireDefault(require("./status-light/StatusLight"));
359
+ var _ContextualMenu = _interopRequireDefault(require("./contextual-menu/ContextualMenu"));
360
+ var _Divider = _interopRequireDefault(require("./divider/Divider"));
361
+ var _Breadcrumbs = _interopRequireDefault(require("./breadcrumbs/Breadcrumbs"));
333
362
  var _HalstackContext = _interopRequireWildcard(require("./HalstackContext"));
334
- var _BackgroundColorContext = require("./BackgroundColorContext");
335
363
  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); }
336
- 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; }
364
+ 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 && {}.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; }
@@ -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 _axeHelper = require("../../test/accessibility/axe-helper.js");
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, _axeHelper.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
+ });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
- import NavTabsPropsType, { NavTabsContextProps } from "./types";
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>>;
@@ -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"] = exports.NavTabsContext = void 0;
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 _templateObject;
15
+ var _NavTabsContext = require("./NavTabsContext");
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
- 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);
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 && {}.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; }
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,10 +81,13 @@ 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
- }, children)));
86
+ }, children), /*#__PURE__*/_react["default"].createElement(Underline, null)));
87
87
  };
88
+ var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 2px;\n background-color: ", ";\n"])), function (props) {
89
+ return props.theme.dividerColor;
90
+ });
88
91
  DxcNavTabs.Tab = _Tab["default"];
89
- var NavTabsContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n"])));
92
+ var NavTabsContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n"])));
90
93
  var _default = exports["default"] = DxcNavTabs;
@@ -16,7 +16,10 @@ const iconSVG = (
16
16
  </svg>
17
17
  );
18
18
 
19
- const largeIcon = "https://www.iconpacks.net/icons/1/free-pin-icon-48-thumb.png";
19
+
20
+ const favoriteIcon = 'filled_Favorite'
21
+
22
+ const pinIcon = 'Location_On';
20
23
 
21
24
  const opinionatedTheme = {
22
25
  navTabs: {
@@ -91,7 +94,9 @@ export const Chromatic = () => (
91
94
  <DxcNavTabs.Tab href="#" notificationNumber={120}>
92
95
  Tab 3
93
96
  </DxcNavTabs.Tab>
94
- <DxcNavTabs.Tab href="#">Tab 4</DxcNavTabs.Tab>
97
+ <DxcNavTabs.Tab href="#" notificationNumber={12}>
98
+ Tab 4
99
+ </DxcNavTabs.Tab>
95
100
  </DxcNavTabs>
96
101
  </ExampleContainer>
97
102
  <ExampleContainer>
@@ -103,10 +108,10 @@ export const Chromatic = () => (
103
108
  <DxcNavTabs.Tab href="#" disabled icon={iconSVG}>
104
109
  Tab 2
105
110
  </DxcNavTabs.Tab>
106
- <DxcNavTabs.Tab href="#" icon={largeIcon}>
111
+ <DxcNavTabs.Tab href="#" icon={pinIcon}>
107
112
  Tab 3
108
113
  </DxcNavTabs.Tab>
109
- <DxcNavTabs.Tab href="#" icon={largeIcon}>
114
+ <DxcNavTabs.Tab href="#" icon={pinIcon}>
110
115
  Tab 4
111
116
  </DxcNavTabs.Tab>
112
117
  </DxcNavTabs>
@@ -114,16 +119,16 @@ export const Chromatic = () => (
114
119
  <ExampleContainer>
115
120
  <Title title="With icon position left" theme="light" level={4} />
116
121
  <DxcNavTabs iconPosition="left">
117
- <DxcNavTabs.Tab href="#" active icon={largeIcon}>
122
+ <DxcNavTabs.Tab href="#" active icon={pinIcon}>
118
123
  Tab 1
119
124
  </DxcNavTabs.Tab>
120
- <DxcNavTabs.Tab href="#" disabled icon={iconSVG}>
125
+ <DxcNavTabs.Tab href="#" disabled icon={favoriteIcon}>
121
126
  Tab 2
122
127
  </DxcNavTabs.Tab>
123
- <DxcNavTabs.Tab href="#" icon={iconSVG}>
128
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon}>
124
129
  Tab 3
125
130
  </DxcNavTabs.Tab>
126
- <DxcNavTabs.Tab href="#" icon={iconSVG}>
131
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon}>
127
132
  Tab 4
128
133
  </DxcNavTabs.Tab>
129
134
  </DxcNavTabs>
@@ -131,16 +136,16 @@ export const Chromatic = () => (
131
136
  <ExampleContainer>
132
137
  <Title title="With icon and notification number" theme="light" level={4} />
133
138
  <DxcNavTabs>
134
- <DxcNavTabs.Tab href="#" active icon={largeIcon} notificationNumber>
139
+ <DxcNavTabs.Tab href="#" active icon={pinIcon} notificationNumber>
135
140
  Tab 1
136
141
  </DxcNavTabs.Tab>
137
- <DxcNavTabs.Tab href="#" disabled icon={iconSVG} notificationNumber={5}>
142
+ <DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
138
143
  Tab 2
139
144
  </DxcNavTabs.Tab>
140
- <DxcNavTabs.Tab href="#" icon={iconSVG} notificationNumber={120}>
145
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
141
146
  Tab 3
142
147
  </DxcNavTabs.Tab>
143
- <DxcNavTabs.Tab href="#" icon={largeIcon}>
148
+ <DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={12}>
144
149
  Tab 4
145
150
  </DxcNavTabs.Tab>
146
151
  </DxcNavTabs>
@@ -148,16 +153,16 @@ export const Chromatic = () => (
148
153
  <ExampleContainer>
149
154
  <Title title="With icon on the left and notification number" theme="light" level={4} />
150
155
  <DxcNavTabs iconPosition="left">
151
- <DxcNavTabs.Tab href="#" active icon={iconSVG} notificationNumber>
156
+ <DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
152
157
  Tab 1
153
158
  </DxcNavTabs.Tab>
154
- <DxcNavTabs.Tab href="#" disabled icon={iconSVG} notificationNumber={5}>
159
+ <DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
155
160
  Tab 2
156
161
  </DxcNavTabs.Tab>
157
- <DxcNavTabs.Tab href="#" icon={largeIcon} notificationNumber={120}>
162
+ <DxcNavTabs.Tab href="#" icon={pinIcon} notificationNumber={120}>
158
163
  Tab 3
159
164
  </DxcNavTabs.Tab>
160
- <DxcNavTabs.Tab href="#" icon={iconSVG}>
165
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
161
166
  Tab 4
162
167
  </DxcNavTabs.Tab>
163
168
  </DxcNavTabs>
@@ -168,10 +173,10 @@ export const Chromatic = () => (
168
173
  <DxcNavTabs.Tab href="#" active>
169
174
  Lorem ipsum dolor sit amet, consectetur adipiscing elit
170
175
  </DxcNavTabs.Tab>
171
- <DxcNavTabs.Tab href="#" icon={iconSVG} disabled notificationNumber={3}>
176
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
172
177
  Tab 2
173
178
  </DxcNavTabs.Tab>
174
- <DxcNavTabs.Tab href="#" icon={iconSVG}>
179
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon}>
175
180
  Tab 3
176
181
  </DxcNavTabs.Tab>
177
182
  </DxcNavTabs>
@@ -182,10 +187,10 @@ export const Chromatic = () => (
182
187
  <DxcNavTabs.Tab href="#" active>
183
188
  Lorem ipsum dolor sit amet, consectetur adipiscing elit
184
189
  </DxcNavTabs.Tab>
185
- <DxcNavTabs.Tab href="#" icon={iconSVG} disabled notificationNumber={3}>
190
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon} disabled notificationNumber={3}>
186
191
  Tab 2
187
192
  </DxcNavTabs.Tab>
188
- <DxcNavTabs.Tab href="#" icon={iconSVG}>
193
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon}>
189
194
  Tab 3
190
195
  </DxcNavTabs.Tab>
191
196
  </DxcNavTabs>
@@ -255,16 +260,16 @@ export const Chromatic = () => (
255
260
  <Title title="With icon and notification number" theme="light" level={4} />
256
261
  <HalstackProvider theme={opinionatedTheme}>
257
262
  <DxcNavTabs>
258
- <DxcNavTabs.Tab href="#" active icon={iconSVG} notificationNumber>
263
+ <DxcNavTabs.Tab href="#" active icon={favoriteIcon} notificationNumber>
259
264
  Tab 1
260
265
  </DxcNavTabs.Tab>
261
- <DxcNavTabs.Tab href="#" disabled icon={iconSVG} notificationNumber={5}>
266
+ <DxcNavTabs.Tab href="#" disabled icon={favoriteIcon} notificationNumber={5}>
262
267
  Tab 2
263
268
  </DxcNavTabs.Tab>
264
- <DxcNavTabs.Tab href="#" icon={iconSVG} notificationNumber={120}>
269
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={120}>
265
270
  Tab 3
266
271
  </DxcNavTabs.Tab>
267
- <DxcNavTabs.Tab href="#" icon={iconSVG}>
272
+ <DxcNavTabs.Tab href="#" icon={favoriteIcon} notificationNumber={12}>
268
273
  Tab 4
269
274
  </DxcNavTabs.Tab>
270
275
  </DxcNavTabs>
@@ -27,12 +27,14 @@ describe("Tabs component tests", function () {
27
27
  tabs.forEach(function (tab, index) {
28
28
  expect(tab.getAttribute("aria-selected")).toBe((index === 0).toString());
29
29
  });
30
- var anchors = getAllByRole("link");
31
- expect(anchors.length).toBe(2);
30
+ var anchors = getAllByRole("tab");
31
+ expect(anchors.length).toBe(3);
32
32
  expect(anchors[0].getAttribute("href")).toBe("/test1");
33
- expect(anchors[1].getAttribute("href")).toBe("/test3");
33
+ expect(anchors[1].getAttribute("href")).toBeFalsy();
34
+ expect(anchors[2].getAttribute("href")).toBe("/test3");
34
35
  expect(anchors[0].getAttribute("tabindex")).toBe("0");
35
36
  expect(anchors[1].getAttribute("tabindex")).toBe("-1");
37
+ expect(anchors[2].getAttribute("tabindex")).toBe("-1");
36
38
  });
37
39
  test("Tabs render with correct labels, badges and icons", function () {
38
40
  var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], null, /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
@@ -46,14 +48,13 @@ describe("Tabs component tests", function () {
46
48
  }, "Tab 2"), /*#__PURE__*/_react["default"].createElement(_NavTabs["default"].Tab, {
47
49
  href: "/test3",
48
50
  notificationNumber: 1000,
49
- icon: "/testIcon.png"
51
+ icon: "Settings"
50
52
  }, "Tab 3"))),
51
53
  getByText = _render2.getByText,
52
- getByRole = _render2.getByRole;
54
+ queryByText = _render2.queryByText;
53
55
  expect(getByText("10")).toBeTruthy();
54
- expect(getByText("20")).toBeTruthy();
56
+ expect(queryByText("20")).toBeFalsy();
55
57
  expect(getByText("+99")).toBeTruthy();
56
- expect(getByRole("img")).toBeTruthy();
57
58
  });
58
59
  test("Tabs render with correct tab index", function () {
59
60
  var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_NavTabs["default"], {
@@ -68,8 +69,9 @@ describe("Tabs component tests", function () {
68
69
  active: true
69
70
  }, "Tab 3"))),
70
71
  getAllByRole = _render3.getAllByRole;
71
- var tabs = getAllByRole("link");
72
+ var tabs = getAllByRole("tab");
72
73
  expect(tabs[0].getAttribute("tabindex")).toBe("-1");
73
- expect(tabs[1].getAttribute("tabindex")).toBe("3");
74
+ expect(tabs[1].getAttribute("tabindex")).toBe("-1");
75
+ expect(tabs[2].getAttribute("tabindex")).toBe("3");
74
76
  });
75
77
  });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { NavTabsContextProps } from "./types";
3
+ export declare const NavTabsContext: import("react").Context<NavTabsContextProps>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NavTabsContext = void 0;
7
+ var _react = require("react");
8
+ var NavTabsContext = exports.NavTabsContext = /*#__PURE__*/(0, _react.createContext)(null);