@dxc-technology/halstack-react 0.0.0-7550efd → 0.0.0-757bc34

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 (279) hide show
  1. package/BackgroundColorContext.d.ts +3 -3
  2. package/BackgroundColorContext.js +6 -18
  3. package/HalstackContext.d.ts +1347 -6
  4. package/HalstackContext.js +125 -110
  5. package/README.md +47 -0
  6. package/accordion/Accordion.d.ts +1 -1
  7. package/accordion/Accordion.js +116 -157
  8. package/accordion/Accordion.stories.tsx +101 -125
  9. package/accordion/Accordion.test.js +25 -41
  10. package/accordion/types.d.ts +5 -16
  11. package/accordion-group/AccordionGroup.d.ts +4 -3
  12. package/accordion-group/AccordionGroup.js +30 -98
  13. package/accordion-group/AccordionGroup.stories.tsx +94 -67
  14. package/accordion-group/AccordionGroup.test.js +52 -105
  15. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  16. package/accordion-group/AccordionGroupAccordion.js +31 -0
  17. package/accordion-group/types.d.ts +11 -16
  18. package/alert/Alert.js +19 -55
  19. package/alert/Alert.stories.tsx +28 -0
  20. package/alert/Alert.test.js +29 -46
  21. package/alert/types.d.ts +5 -5
  22. package/badge/Badge.js +4 -17
  23. package/badge/types.d.ts +1 -1
  24. package/bleed/Bleed.js +13 -21
  25. package/bleed/Bleed.stories.tsx +1 -0
  26. package/bleed/types.d.ts +2 -2
  27. package/box/Box.d.ts +1 -1
  28. package/box/Box.js +18 -56
  29. package/box/Box.stories.tsx +38 -51
  30. package/box/Box.test.js +2 -7
  31. package/box/types.d.ts +3 -14
  32. package/bulleted-list/BulletedList.js +11 -35
  33. package/bulleted-list/BulletedList.stories.tsx +8 -92
  34. package/bulleted-list/types.d.ts +32 -5
  35. package/button/Button.d.ts +1 -1
  36. package/button/Button.js +65 -100
  37. package/button/Button.stories.tsx +152 -91
  38. package/button/Button.test.js +18 -17
  39. package/button/types.d.ts +8 -4
  40. package/card/Card.d.ts +1 -1
  41. package/card/Card.js +48 -89
  42. package/card/Card.stories.tsx +12 -42
  43. package/card/Card.test.js +11 -22
  44. package/card/types.d.ts +6 -11
  45. package/checkbox/Checkbox.d.ts +2 -2
  46. package/checkbox/Checkbox.js +141 -178
  47. package/checkbox/Checkbox.stories.tsx +128 -94
  48. package/checkbox/Checkbox.test.js +160 -39
  49. package/checkbox/types.d.ts +11 -3
  50. package/chip/Chip.js +39 -79
  51. package/chip/Chip.stories.tsx +121 -26
  52. package/chip/Chip.test.js +16 -31
  53. package/chip/types.d.ts +4 -4
  54. package/common/OpenSans.css +68 -80
  55. package/common/coreTokens.d.ts +237 -0
  56. package/common/coreTokens.js +184 -0
  57. package/common/utils.d.ts +1 -0
  58. package/common/utils.js +6 -12
  59. package/common/variables.d.ts +1499 -0
  60. package/common/variables.js +1008 -1145
  61. package/container/Container.d.ts +4 -0
  62. package/container/Container.js +198 -0
  63. package/container/Container.stories.tsx +229 -0
  64. package/container/types.d.ts +74 -0
  65. package/date-input/Calendar.d.ts +4 -0
  66. package/date-input/Calendar.js +214 -0
  67. package/date-input/DateInput.js +150 -299
  68. package/date-input/DateInput.stories.tsx +203 -56
  69. package/date-input/DateInput.test.js +700 -371
  70. package/date-input/DatePicker.d.ts +4 -0
  71. package/date-input/DatePicker.js +115 -0
  72. package/date-input/Icons.d.ts +6 -0
  73. package/date-input/Icons.js +58 -0
  74. package/date-input/YearPicker.d.ts +4 -0
  75. package/date-input/YearPicker.js +100 -0
  76. package/date-input/types.d.ts +72 -15
  77. package/dialog/Dialog.d.ts +1 -1
  78. package/dialog/Dialog.js +61 -116
  79. package/dialog/Dialog.stories.tsx +320 -166
  80. package/dialog/Dialog.test.js +269 -32
  81. package/dialog/types.d.ts +18 -25
  82. package/dropdown/Dropdown.js +72 -125
  83. package/dropdown/Dropdown.stories.tsx +210 -84
  84. package/dropdown/Dropdown.test.js +410 -402
  85. package/dropdown/DropdownMenu.js +20 -37
  86. package/dropdown/DropdownMenuItem.js +10 -35
  87. package/dropdown/types.d.ts +17 -19
  88. package/file-input/FileInput.d.ts +2 -2
  89. package/file-input/FileInput.js +241 -355
  90. package/file-input/FileInput.stories.tsx +123 -12
  91. package/file-input/FileInput.test.js +369 -367
  92. package/file-input/FileItem.d.ts +4 -14
  93. package/file-input/FileItem.js +45 -96
  94. package/file-input/types.d.ts +25 -8
  95. package/flex/Flex.d.ts +1 -1
  96. package/flex/Flex.js +40 -40
  97. package/flex/Flex.stories.tsx +35 -26
  98. package/flex/types.d.ts +84 -8
  99. package/footer/Footer.d.ts +1 -1
  100. package/footer/Footer.js +53 -104
  101. package/footer/Footer.stories.tsx +41 -19
  102. package/footer/Footer.test.js +33 -57
  103. package/footer/Icons.d.ts +2 -2
  104. package/footer/Icons.js +2 -7
  105. package/footer/types.d.ts +21 -28
  106. package/grid/Grid.d.ts +7 -0
  107. package/grid/Grid.js +76 -0
  108. package/grid/Grid.stories.tsx +219 -0
  109. package/grid/types.d.ts +115 -0
  110. package/header/Header.d.ts +4 -3
  111. package/header/Header.js +41 -116
  112. package/header/Header.stories.tsx +118 -39
  113. package/header/Header.test.js +13 -26
  114. package/header/Icons.d.ts +2 -2
  115. package/header/Icons.js +2 -7
  116. package/header/types.d.ts +5 -19
  117. package/heading/Heading.js +10 -32
  118. package/heading/Heading.test.js +71 -88
  119. package/heading/types.d.ts +7 -7
  120. package/image/Image.d.ts +4 -0
  121. package/image/Image.js +70 -0
  122. package/image/Image.stories.tsx +127 -0
  123. package/image/types.d.ts +72 -0
  124. package/inset/Inset.js +13 -21
  125. package/inset/Inset.stories.tsx +2 -1
  126. package/inset/types.d.ts +2 -2
  127. package/layout/ApplicationLayout.d.ts +5 -5
  128. package/layout/ApplicationLayout.js +29 -66
  129. package/layout/ApplicationLayout.stories.tsx +1 -1
  130. package/layout/Icons.d.ts +8 -5
  131. package/layout/Icons.js +51 -59
  132. package/layout/SidenavContext.d.ts +1 -1
  133. package/layout/SidenavContext.js +3 -9
  134. package/layout/types.d.ts +5 -6
  135. package/link/Link.js +25 -46
  136. package/link/Link.stories.tsx +60 -0
  137. package/link/Link.test.js +24 -44
  138. package/link/types.d.ts +14 -14
  139. package/main.d.ts +6 -3
  140. package/main.js +25 -51
  141. package/{tabs-nav → nav-tabs}/NavTabs.d.ts +2 -2
  142. package/{tabs-nav → nav-tabs}/NavTabs.js +17 -52
  143. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +111 -7
  144. package/{tabs-nav → nav-tabs}/NavTabs.test.js +37 -44
  145. package/nav-tabs/Tab.js +117 -0
  146. package/{tabs-nav → nav-tabs}/types.d.ts +14 -15
  147. package/nav-tabs/types.js +5 -0
  148. package/number-input/NumberInput.d.ts +7 -0
  149. package/number-input/NumberInput.js +26 -35
  150. package/number-input/NumberInput.stories.tsx +42 -26
  151. package/number-input/NumberInput.test.js +701 -377
  152. package/number-input/types.d.ts +11 -5
  153. package/package.json +37 -40
  154. package/paginator/Icons.d.ts +5 -0
  155. package/paginator/Icons.js +21 -47
  156. package/paginator/Paginator.js +22 -55
  157. package/paginator/Paginator.stories.tsx +24 -0
  158. package/paginator/Paginator.test.js +253 -226
  159. package/paginator/types.d.ts +3 -3
  160. package/paragraph/Paragraph.d.ts +3 -4
  161. package/paragraph/Paragraph.js +6 -17
  162. package/paragraph/Paragraph.stories.tsx +0 -17
  163. package/password-input/Icons.d.ts +6 -0
  164. package/password-input/Icons.js +35 -0
  165. package/password-input/PasswordInput.js +57 -126
  166. package/password-input/PasswordInput.stories.tsx +1 -32
  167. package/password-input/PasswordInput.test.js +160 -142
  168. package/password-input/types.d.ts +8 -7
  169. package/progress-bar/ProgressBar.d.ts +2 -2
  170. package/progress-bar/ProgressBar.js +21 -47
  171. package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +36 -3
  172. package/progress-bar/ProgressBar.test.js +36 -53
  173. package/progress-bar/types.d.ts +4 -3
  174. package/quick-nav/QuickNav.js +15 -39
  175. package/quick-nav/QuickNav.stories.tsx +112 -20
  176. package/quick-nav/types.d.ts +10 -10
  177. package/radio-group/Radio.d.ts +1 -1
  178. package/radio-group/Radio.js +59 -76
  179. package/radio-group/RadioGroup.js +59 -105
  180. package/radio-group/RadioGroup.stories.tsx +132 -18
  181. package/radio-group/RadioGroup.test.js +518 -457
  182. package/radio-group/types.d.ts +10 -10
  183. package/resultset-table/Icons.d.ts +7 -0
  184. package/resultset-table/Icons.js +47 -0
  185. package/resultset-table/ResultsetTable.js +159 -0
  186. package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +50 -25
  187. package/{resultsetTable → resultset-table}/ResultsetTable.test.js +101 -144
  188. package/{resultsetTable → resultset-table}/types.d.ts +7 -7
  189. package/resultset-table/types.js +5 -0
  190. package/select/Icons.d.ts +7 -7
  191. package/select/Icons.js +1 -5
  192. package/select/Listbox.d.ts +1 -1
  193. package/select/Listbox.js +17 -73
  194. package/select/Option.js +20 -50
  195. package/select/Select.js +95 -156
  196. package/select/Select.stories.tsx +497 -153
  197. package/select/Select.test.js +1934 -1775
  198. package/select/types.d.ts +16 -17
  199. package/sidenav/Icons.d.ts +7 -0
  200. package/sidenav/Icons.js +47 -0
  201. package/sidenav/Sidenav.d.ts +2 -2
  202. package/sidenav/Sidenav.js +80 -149
  203. package/sidenav/Sidenav.stories.tsx +165 -63
  204. package/sidenav/Sidenav.test.js +3 -10
  205. package/sidenav/types.d.ts +31 -28
  206. package/slider/Slider.d.ts +2 -2
  207. package/slider/Slider.js +57 -96
  208. package/slider/Slider.test.js +108 -104
  209. package/slider/types.d.ts +7 -3
  210. package/spinner/Spinner.js +27 -63
  211. package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
  212. package/spinner/Spinner.test.js +26 -35
  213. package/spinner/types.d.ts +3 -3
  214. package/switch/Switch.d.ts +3 -3
  215. package/switch/Switch.js +112 -144
  216. package/switch/Switch.stories.tsx +33 -34
  217. package/switch/Switch.test.js +70 -102
  218. package/switch/types.d.ts +8 -3
  219. package/table/Table.js +7 -26
  220. package/table/{Table.stories.jsx → Table.stories.tsx} +80 -1
  221. package/table/Table.test.js +3 -8
  222. package/table/types.d.ts +8 -8
  223. package/tabs/Tab.js +22 -44
  224. package/tabs/Tabs.js +59 -141
  225. package/tabs/Tabs.stories.tsx +45 -5
  226. package/tabs/Tabs.test.js +66 -123
  227. package/tabs/types.d.ts +19 -19
  228. package/tag/Tag.js +29 -61
  229. package/tag/Tag.stories.tsx +14 -1
  230. package/tag/Tag.test.js +20 -31
  231. package/tag/types.d.ts +7 -7
  232. package/text-input/Icons.d.ts +8 -0
  233. package/text-input/Icons.js +56 -0
  234. package/text-input/Suggestion.js +40 -28
  235. package/text-input/Suggestions.d.ts +4 -0
  236. package/text-input/Suggestions.js +89 -0
  237. package/text-input/TextInput.js +272 -441
  238. package/text-input/TextInput.stories.tsx +266 -274
  239. package/text-input/TextInput.test.js +1402 -1375
  240. package/text-input/types.d.ts +43 -16
  241. package/textarea/Textarea.js +63 -100
  242. package/textarea/Textarea.stories.tsx +175 -0
  243. package/textarea/Textarea.test.js +152 -183
  244. package/textarea/types.d.ts +9 -5
  245. package/toggle-group/ToggleGroup.d.ts +2 -2
  246. package/toggle-group/ToggleGroup.js +95 -106
  247. package/toggle-group/ToggleGroup.stories.tsx +49 -4
  248. package/toggle-group/ToggleGroup.test.js +69 -88
  249. package/toggle-group/types.d.ts +26 -17
  250. package/typography/Typography.d.ts +2 -2
  251. package/typography/Typography.js +15 -123
  252. package/typography/Typography.stories.tsx +1 -1
  253. package/typography/types.d.ts +1 -1
  254. package/useTheme.d.ts +1251 -1
  255. package/useTheme.js +2 -9
  256. package/useTranslatedLabels.d.ts +84 -1
  257. package/useTranslatedLabels.js +1 -7
  258. package/utils/BaseTypography.d.ts +21 -0
  259. package/utils/BaseTypography.js +94 -0
  260. package/utils/FocusLock.d.ts +13 -0
  261. package/utils/FocusLock.js +121 -0
  262. package/wizard/Wizard.js +16 -51
  263. package/wizard/Wizard.stories.tsx +20 -0
  264. package/wizard/Wizard.test.js +54 -81
  265. package/wizard/types.d.ts +8 -9
  266. package/card/ice-cream.jpg +0 -0
  267. package/common/RequiredComponent.js +0 -32
  268. package/number-input/NumberInputContext.d.ts +0 -4
  269. package/number-input/NumberInputContext.js +0 -19
  270. package/number-input/numberInputContextTypes.d.ts +0 -19
  271. package/resultsetTable/ResultsetTable.js +0 -254
  272. package/slider/Slider.stories.tsx +0 -183
  273. package/tabs-nav/Tab.js +0 -130
  274. package/textarea/Textarea.stories.jsx +0 -157
  275. /package/{resultsetTable → container}/types.js +0 -0
  276. /package/{tabs-nav → grid}/types.js +0 -0
  277. /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
  278. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  279. /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
package/tabs/Tab.js CHANGED
@@ -1,48 +1,35 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports["default"] = void 0;
11
-
12
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
10
  var _react = _interopRequireWildcard(require("react"));
15
-
16
11
  var _styledComponents = _interopRequireDefault(require("styled-components"));
17
-
18
12
  var _Badge = _interopRequireDefault(require("../badge/Badge"));
19
-
20
- var _Typography = _interopRequireDefault(require("../typography/Typography"));
21
-
13
+ var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
22
14
  var _useTheme = _interopRequireDefault(require("../useTheme"));
23
-
24
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
25
-
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
15
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
16
+ 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; }
30
18
  var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
31
19
  var active = _ref.active,
32
- tab = _ref.tab,
33
- tabIndex = _ref.tabIndex,
34
- hasLabelAndIcon = _ref.hasLabelAndIcon,
35
- iconPosition = _ref.iconPosition,
36
- _onClick = _ref.onClick,
37
- _onMouseEnter = _ref.onMouseEnter,
38
- _onMouseLeave = _ref.onMouseLeave;
20
+ tab = _ref.tab,
21
+ tabIndex = _ref.tabIndex,
22
+ hasLabelAndIcon = _ref.hasLabelAndIcon,
23
+ iconPosition = _ref.iconPosition,
24
+ _onClick = _ref.onClick,
25
+ _onMouseEnter = _ref.onMouseEnter,
26
+ _onMouseLeave = _ref.onMouseLeave;
39
27
  var colorsTheme = (0, _useTheme["default"])();
40
28
  return /*#__PURE__*/_react["default"].createElement(TabContainer, {
41
29
  role: "tab",
42
30
  type: "button",
43
31
  tabIndex: tabIndex,
44
32
  disabled: tab.isDisabled,
45
- "aria-disabled": tab.isDisabled,
46
33
  "aria-selected": active,
47
34
  hasLabelAndIcon: hasLabelAndIcon,
48
35
  iconPosition: iconPosition,
@@ -57,15 +44,15 @@ var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
57
44
  _onMouseLeave();
58
45
  }
59
46
  }, /*#__PURE__*/_react["default"].createElement(MainLabelContainer, {
60
- hasBadge: tab.notificationNumber,
47
+ notificationNumber: tab.notificationNumber,
61
48
  hasLabelAndIcon: hasLabelAndIcon,
62
49
  iconPosition: iconPosition
63
50
  }, tab.icon && /*#__PURE__*/_react["default"].createElement(TabIconContainer, {
64
51
  hasLabelAndIcon: hasLabelAndIcon,
65
52
  iconPosition: iconPosition
66
- }, typeof tab.icon === "string" ? /*#__PURE__*/_react["default"].createElement(TabIcon, {
53
+ }, typeof tab.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
67
54
  src: tab.icon
68
- }) : tab.icon), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
55
+ }) : tab.icon), /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
69
56
  color: tab.isDisabled ? colorsTheme.tabs.disabledFontColor : active ? colorsTheme.tabs.selectedFontColor : colorsTheme.tabs.unselectedFontColor,
70
57
  fontFamily: colorsTheme.tabs.fontFamily,
71
58
  fontSize: colorsTheme.tabs.fontSize,
@@ -74,15 +61,14 @@ var Tab = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
74
61
  textAlign: "center",
75
62
  letterSpacing: "0.025em",
76
63
  lineHeight: "1.715em"
77
- }, tab.label)), tab.notificationNumber && tab.notificationNumber && /*#__PURE__*/_react["default"].createElement(BadgeContainer, {
64
+ }, tab.label)), tab.notificationNumber && /*#__PURE__*/_react["default"].createElement(BadgeContainer, {
78
65
  hasLabelAndIcon: hasLabelAndIcon,
79
66
  iconPosition: iconPosition
80
67
  }, /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
81
- notificationText: tab.notificationNumber > 99 ? "+99" : tab.notificationNumber
68
+ notificationText: typeof tab.notificationNumber === "number" && tab.notificationNumber > 99 ? "+99" : tab.notificationNumber
82
69
  })));
83
70
  });
84
-
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 svg {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n\n &[aria-selected=\"true\"] {\n background-color: ", ";\n svg {\n color: ", ";\n }\n opacity: 1;\n }\n\n &[aria-disabled=\"true\"] {\n background-color: ", " !important;\n cursor: not-allowed !important;\n pointer-events: all;\n font-style: ", ";\n svg {\n color: ", ";\n }\n outline: none !important;\n > div {\n opacity: 0.5;\n }\n }\n"])), function (props) {
71
+ 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
72
  return props.theme.fontTextTransform;
87
73
  }, function (props) {
88
74
  return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
@@ -92,14 +78,14 @@ var TabContainer = _styledComponents["default"].button(_templateObject || (_temp
92
78
  return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "47px" || "71px";
93
79
  }, function (props) {
94
80
  return props.theme.unselectedBackgroundColor;
95
- }, function (props) {
96
- return props.theme.unselectedIconColor;
97
81
  }, function (props) {
98
82
  return "".concat(props.theme.hoverBackgroundColor, " !important");
99
83
  }, function (props) {
100
84
  return "".concat(props.theme.pressedBackgroundColor, " !important");
101
85
  }, function (props) {
102
86
  return props.theme.focusOutline;
87
+ }, function (props) {
88
+ return props.theme.unselectedIconColor;
103
89
  }, function (props) {
104
90
  return props.theme.selectedBackgroundColor;
105
91
  }, function (props) {
@@ -111,25 +97,17 @@ var TabContainer = _styledComponents["default"].button(_templateObject || (_temp
111
97
  }, function (props) {
112
98
  return props.theme.disabledIconColor;
113
99
  });
114
-
115
100
  var BadgeContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: 12px;\n height: 100%;\n display: flex;\n align-items: ", ";\n"])), function (props) {
116
101
  return props.hasLabelAndIcon && props.iconPosition === "top" ? "flex-start" : "center";
117
102
  });
118
-
119
103
  var MainLabelContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n align-items: center;\n margin-left: ", ";\n"])), function (props) {
120
104
  return props.hasLabelAndIcon && props.iconPosition === "top" && "column" || "row";
121
105
  }, function (props) {
122
- return props.hasBadge ? typeof props.hasBadge === "number" ? "calc(".concat(props.theme.badgeWidthWithNotificationNumber, " + 12px)") : "calc(".concat(props.theme.badgeWidth, " + 12px)") : "unset";
106
+ return props.notificationNumber ? typeof props.notificationNumber === "number" ? "calc(".concat(props.theme.badgeWidthWithNotificationNumber, " + 12px)") : "calc(".concat(props.theme.badgeWidth, " + 12px)") : "unset";
123
107
  });
124
-
125
- var TabIconContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 22px;\n max-width: 22px;\n margin-bottom: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n align-items: center;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
108
+ var TabIconContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n margin-bottom: ", ";\n margin-right: ", ";\n\n img,\n svg {\n height: 22px;\n width: 22px;\n }\n"])), function (props) {
126
109
  return props.hasLabelAndIcon && props.iconPosition === "top" && "8px" || "";
127
110
  }, function (props) {
128
111
  return props.hasLabelAndIcon && props.iconPosition === "left" && "12px" || "";
129
112
  });
130
-
131
- var TabIcon = _styledComponents["default"].img(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n display: inline-flex;\n align-items: center;\n flex-direction: column;\n justify-content: center;\n"])));
132
-
133
- var _default = /*#__PURE__*/_react["default"].memo(Tab);
134
-
135
- exports["default"] = _default;
113
+ var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(Tab);
package/tabs/Tabs.js CHANGED
@@ -1,38 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports["default"] = void 0;
11
-
12
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
12
  var _react = _interopRequireWildcard(require("react"));
19
-
20
13
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
-
22
- var _variables = require("../common/variables.js");
23
-
14
+ var _variables = require("../common/variables");
24
15
  var _useTheme = _interopRequireDefault(require("../useTheme"));
25
-
26
16
  var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
27
-
28
17
  var _Tab = _interopRequireDefault(require("./Tab"));
29
-
30
18
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
31
-
32
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
-
34
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
-
19
+ 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; }
36
21
  var arrowIcons = {
37
22
  left: /*#__PURE__*/_react["default"].createElement("svg", {
38
23
  focusable: "false",
@@ -49,16 +34,13 @@ var arrowIcons = {
49
34
  d: "M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
50
35
  }))
51
36
  };
52
-
53
37
  var useResize = function useResize(refTabList) {
54
38
  var _useState = (0, _react.useState)(0),
55
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
56
- viewWidth = _useState2[0],
57
- setViewWidth = _useState2[1];
58
-
39
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
40
+ viewWidth = _useState2[0],
41
+ setViewWidth = _useState2[1];
59
42
  var handleWindowSizeChange = (0, _react.useCallback)(function () {
60
43
  var _refTabList$current;
61
-
62
44
  setViewWidth(refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current = refTabList.current) === null || _refTabList$current === void 0 ? void 0 : _refTabList$current.offsetWidth);
63
45
  }, [refTabList]);
64
46
  (0, _react.useEffect)(function () {
@@ -71,18 +53,17 @@ var useResize = function useResize(refTabList) {
71
53
  }, [handleWindowSizeChange]);
72
54
  return viewWidth;
73
55
  };
74
-
75
56
  var DxcTabs = function DxcTabs(_ref) {
76
57
  var defaultActiveTabIndex = _ref.defaultActiveTabIndex,
77
- activeTabIndex = _ref.activeTabIndex,
78
- tabs = _ref.tabs,
79
- onTabClick = _ref.onTabClick,
80
- onTabHover = _ref.onTabHover,
81
- margin = _ref.margin,
82
- _ref$iconPosition = _ref.iconPosition,
83
- iconPosition = _ref$iconPosition === void 0 ? "top" : _ref$iconPosition,
84
- _ref$tabIndex = _ref.tabIndex,
85
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
58
+ activeTabIndex = _ref.activeTabIndex,
59
+ tabs = _ref.tabs,
60
+ onTabClick = _ref.onTabClick,
61
+ onTabHover = _ref.onTabHover,
62
+ margin = _ref.margin,
63
+ _ref$iconPosition = _ref.iconPosition,
64
+ iconPosition = _ref$iconPosition === void 0 ? "top" : _ref$iconPosition,
65
+ _ref$tabIndex = _ref.tabIndex,
66
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
86
67
  var colorsTheme = (0, _useTheme["default"])();
87
68
  var hasLabelAndIcon = tabs && tabs.filter(function (tab) {
88
69
  return tab.label && tab.icon;
@@ -90,62 +71,50 @@ var DxcTabs = function DxcTabs(_ref) {
90
71
  var firstFocus = tabs && tabs.findIndex(function (tab) {
91
72
  return !tab.isDisabled;
92
73
  });
93
-
94
74
  var _useState3 = (0, _react.useState)(tabs && defaultActiveTabIndex && !tabs[defaultActiveTabIndex].isDisabled ? defaultActiveTabIndex : firstFocus),
95
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
96
- innerActiveTabIndex = _useState4[0],
97
- setInnerActiveTabIndex = _useState4[1];
98
-
75
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
76
+ innerActiveTabIndex = _useState4[0],
77
+ setInnerActiveTabIndex = _useState4[1];
99
78
  var _useState5 = (0, _react.useState)(0),
100
- _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
101
- activeIndicatorWidth = _useState6[0],
102
- setActiveIndicatorWidth = _useState6[1];
103
-
79
+ _useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
80
+ activeIndicatorWidth = _useState6[0],
81
+ setActiveIndicatorWidth = _useState6[1];
104
82
  var _useState7 = (0, _react.useState)(0),
105
- _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
106
- activeIndicatorLeft = _useState8[0],
107
- setActiveIndicatorLeft = _useState8[1];
108
-
83
+ _useState8 = (0, _slicedToArray2["default"])(_useState7, 2),
84
+ activeIndicatorLeft = _useState8[0],
85
+ setActiveIndicatorLeft = _useState8[1];
109
86
  var _useState9 = (0, _react.useState)(0),
110
- _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
111
- translateScroll = _useState10[0],
112
- setTranslateScroll = _useState10[1];
113
-
87
+ _useState10 = (0, _slicedToArray2["default"])(_useState9, 2),
88
+ translateScroll = _useState10[0],
89
+ setTranslateScroll = _useState10[1];
114
90
  var _useState11 = (0, _react.useState)(true),
115
- _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
116
- scrollRightEnabled = _useState12[0],
117
- setScrollRightEnabled = _useState12[1];
118
-
91
+ _useState12 = (0, _slicedToArray2["default"])(_useState11, 2),
92
+ scrollRightEnabled = _useState12[0],
93
+ setScrollRightEnabled = _useState12[1];
119
94
  var _useState13 = (0, _react.useState)(false),
120
- _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
121
- scrollLeftEnabled = _useState14[0],
122
- setScrollLeftEnabled = _useState14[1];
123
-
95
+ _useState14 = (0, _slicedToArray2["default"])(_useState13, 2),
96
+ scrollLeftEnabled = _useState14[0],
97
+ setScrollLeftEnabled = _useState14[1];
124
98
  var _useState15 = (0, _react.useState)(0),
125
- _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
126
- countClick = _useState16[0],
127
- setCountClick = _useState16[1];
128
-
99
+ _useState16 = (0, _slicedToArray2["default"])(_useState15, 2),
100
+ countClick = _useState16[0],
101
+ setCountClick = _useState16[1];
129
102
  var _useState17 = (0, _react.useState)(0),
130
- _useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
131
- totalTabsWidth = _useState18[0],
132
- setTotalTabsWidth = _useState18[1];
133
-
103
+ _useState18 = (0, _slicedToArray2["default"])(_useState17, 2),
104
+ totalTabsWidth = _useState18[0],
105
+ setTotalTabsWidth = _useState18[1];
134
106
  var _useState19 = (0, _react.useState)(activeTabIndex !== null && activeTabIndex !== void 0 ? activeTabIndex : innerActiveTabIndex),
135
- _useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
136
- currentFocusIndex = _useState20[0],
137
- setCurrentFocusIndex = _useState20[1];
138
-
107
+ _useState20 = (0, _slicedToArray2["default"])(_useState19, 2),
108
+ currentFocusIndex = _useState20[0],
109
+ setCurrentFocusIndex = _useState20[1];
139
110
  var _useState21 = (0, _react.useState)(activeTabIndex !== null && activeTabIndex !== void 0 ? activeTabIndex : innerActiveTabIndex),
140
- _useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
141
- temporalFocusIndex = _useState22[0],
142
- setTemporalFocusIndex = _useState22[1];
143
-
111
+ _useState22 = (0, _slicedToArray2["default"])(_useState21, 2),
112
+ temporalFocusIndex = _useState22[0],
113
+ setTemporalFocusIndex = _useState22[1];
144
114
  var _useState23 = (0, _react.useState)(0),
145
- _useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
146
- minHeightTabs = _useState24[0],
147
- setMinHeightTabs = _useState24[1];
148
-
115
+ _useState24 = (0, _slicedToArray2["default"])(_useState23, 2),
116
+ minHeightTabs = _useState24[0],
117
+ setMinHeightTabs = _useState24[1];
149
118
  var refTabs = (0, _react.useRef)([]);
150
119
  var refTabList = (0, _react.useRef)(null);
151
120
  var viewWidth = useResize(refTabList);
@@ -155,7 +124,6 @@ var DxcTabs = function DxcTabs(_ref) {
155
124
  }, [viewWidth]);
156
125
  (0, _react.useEffect)(function () {
157
126
  var _refTabs$current, _refTabs$current2, _refTabs$current3;
158
-
159
127
  var sumWidth = refTabs === null || refTabs === void 0 ? void 0 : (_refTabs$current = refTabs.current) === null || _refTabs$current === void 0 ? void 0 : _refTabs$current.reduce(function (count, obj) {
160
128
  return count + obj.offsetWidth;
161
129
  }, 0);
@@ -165,36 +133,28 @@ var DxcTabs = function DxcTabs(_ref) {
165
133
  }, [refTabs]);
166
134
  (0, _react.useEffect)(function () {
167
135
  var _refTabList$current2;
168
-
169
136
  setMinHeightTabs((refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current2 = refTabList.current) === null || _refTabList$current2 === void 0 ? void 0 : _refTabList$current2.offsetHeight) + 1);
170
137
  }, [refTabList]);
171
138
  (0, _react.useEffect)(function () {
172
139
  if (activeTabIndex >= 0) {
173
140
  var _refTabs$current$acti, _refTabs$current$acti2;
174
-
175
141
  setActiveIndicatorWidth(refTabs === null || refTabs === void 0 ? void 0 : (_refTabs$current$acti = refTabs.current[activeTabIndex]) === null || _refTabs$current$acti === void 0 ? void 0 : _refTabs$current$acti.offsetWidth);
176
142
  setActiveIndicatorLeft(refTabs === null || refTabs === void 0 ? void 0 : (_refTabs$current$acti2 = refTabs.current[activeTabIndex]) === null || _refTabs$current$acti2 === void 0 ? void 0 : _refTabs$current$acti2.offsetLeft);
177
143
  }
178
144
  }, [activeTabIndex]);
179
-
180
145
  var handleSelected = function handleSelected(newValue) {
181
146
  activeTabIndex !== null && activeTabIndex !== void 0 ? activeTabIndex : setInnerActiveTabIndex(newValue);
182
147
  onTabClick === null || onTabClick === void 0 ? void 0 : onTabClick(newValue);
183
-
184
148
  if (activeTabIndex === undefined) {
185
149
  var _refTabs$current$newV, _refTabs$current$newV2;
186
-
187
150
  setActiveIndicatorWidth(refTabs === null || refTabs === void 0 ? void 0 : (_refTabs$current$newV = refTabs.current[newValue]) === null || _refTabs$current$newV === void 0 ? void 0 : _refTabs$current$newV.offsetWidth);
188
151
  setActiveIndicatorLeft(refTabs === null || refTabs === void 0 ? void 0 : (_refTabs$current$newV2 = refTabs.current[newValue]) === null || _refTabs$current$newV2 === void 0 ? void 0 : _refTabs$current$newV2.offsetLeft);
189
152
  }
190
153
  };
191
-
192
154
  var scrollLeft = function scrollLeft() {
193
155
  var _refTabList$current3;
194
-
195
156
  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;
197
-
157
+ var moveX = 0;
198
158
  if (countClick <= scrollWidth) {
199
159
  moveX = 0;
200
160
  setScrollLeftEnabled(false);
@@ -204,20 +164,15 @@ var DxcTabs = function DxcTabs(_ref) {
204
164
  setScrollRightEnabled(true);
205
165
  setScrollLeftEnabled(true);
206
166
  }
207
-
208
167
  setTranslateScroll(-moveX);
209
168
  setCountClick(moveX);
210
169
  };
211
-
212
170
  var scrollRight = function scrollRight() {
213
171
  var _refTabList$current4, _refTabList$current5;
214
-
215
172
  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;
217
-
173
+ var moveX = 0;
218
174
  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
175
  var _refTabList$current6;
220
-
221
176
  moveX = totalTabsWidth - (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current6 = refTabList.current) === null || _refTabList$current6 === void 0 ? void 0 : _refTabList$current6.offsetWidth);
222
177
  setScrollRightEnabled(false);
223
178
  setScrollLeftEnabled(true);
@@ -226,19 +181,15 @@ var DxcTabs = function DxcTabs(_ref) {
226
181
  setScrollLeftEnabled(true);
227
182
  setScrollRightEnabled(true);
228
183
  }
229
-
230
184
  setTranslateScroll(-moveX);
231
185
  setCountClick(moveX);
232
186
  };
233
-
234
187
  var setPreviousTabFocus = function setPreviousTabFocus() {
235
188
  setTemporalFocusIndex(function (temporalFocusIndex) {
236
189
  var index = temporalFocusIndex === 0 ? tabs.length - 1 : temporalFocusIndex - 1;
237
-
238
190
  while (tabs[index].isDisabled) {
239
191
  index = index === 0 ? tabs.length - 1 : index - 1;
240
192
  }
241
-
242
193
  refTabs === null || refTabs === void 0 ? void 0 : refTabs.current[index].focus({
243
194
  preventScroll: true
244
195
  });
@@ -246,15 +197,12 @@ var DxcTabs = function DxcTabs(_ref) {
246
197
  return index;
247
198
  });
248
199
  };
249
-
250
200
  var setNextTabFocus = function setNextTabFocus() {
251
201
  setTemporalFocusIndex(function (temporalFocusIndex) {
252
202
  var index = temporalFocusIndex === tabs.length - 1 ? 0 : temporalFocusIndex + 1;
253
-
254
203
  while (tabs[index].isDisabled) {
255
204
  index = index === tabs.length - 1 ? 0 : index + 1;
256
205
  }
257
-
258
206
  refTabs === null || refTabs === void 0 ? void 0 : refTabs.current[index].focus({
259
207
  preventScroll: true
260
208
  });
@@ -262,10 +210,8 @@ var DxcTabs = function DxcTabs(_ref) {
262
210
  return index;
263
211
  });
264
212
  };
265
-
266
213
  var setScrollFocus = function setScrollFocus(actualIndex) {
267
214
  var _refTabs$current4, _refTabList$current8;
268
-
269
215
  var sumPrev = 0;
270
216
  refTabs === null || refTabs === void 0 ? void 0 : (_refTabs$current4 = refTabs.current) === null || _refTabs$current4 === void 0 ? void 0 : _refTabs$current4.map(function (item, index) {
271
217
  if (index <= actualIndex) {
@@ -273,29 +219,23 @@ var DxcTabs = function DxcTabs(_ref) {
273
219
  }
274
220
  });
275
221
  var moveX = 0;
276
-
277
222
  if (actualIndex === tabs.length - 1) {
278
223
  var _refTabList$current7;
279
-
280
224
  moveX = totalTabsWidth - (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current7 = refTabList.current) === null || _refTabList$current7 === void 0 ? void 0 : _refTabList$current7.offsetWidth);
281
225
  setScrollLeftEnabled(true);
282
226
  setScrollRightEnabled(false);
283
227
  } else if (sumPrev > (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current8 = refTabList.current) === null || _refTabList$current8 === void 0 ? void 0 : _refTabList$current8.offsetWidth)) {
284
228
  var _refTabList$current9;
285
-
286
229
  moveX = sumPrev - (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current9 = refTabList.current) === null || _refTabList$current9 === void 0 ? void 0 : _refTabList$current9.offsetWidth) + 1; //plus 1px for the outline
287
-
288
230
  setScrollLeftEnabled(true);
289
231
  setScrollRightEnabled(true);
290
232
  } else {
291
233
  setScrollLeftEnabled(false);
292
234
  setScrollRightEnabled(true);
293
235
  }
294
-
295
236
  setTranslateScroll(-moveX);
296
237
  setCountClick(moveX);
297
238
  };
298
-
299
239
  var handleOnKeyDown = function handleOnKeyDown(event) {
300
240
  switch (event.key) {
301
241
  case "Left":
@@ -303,36 +243,30 @@ var DxcTabs = function DxcTabs(_ref) {
303
243
  event.preventDefault();
304
244
  setPreviousTabFocus();
305
245
  break;
306
-
307
246
  case "Right":
308
247
  case "ArrowRight":
309
248
  event.preventDefault();
310
249
  setNextTabFocus();
311
250
  break;
312
-
313
251
  case "Enter":
314
252
  case " ":
315
253
  event.preventDefault();
316
254
  setCurrentFocusIndex(temporalFocusIndex);
317
255
  handleSelected(temporalFocusIndex);
318
256
  break;
319
-
320
257
  case "Tab":
321
258
  if (temporalFocusIndex !== currentFocusIndex) {
322
259
  event.preventDefault();
323
260
  setTemporalFocusIndex(currentFocusIndex);
324
261
  refTabs === null || refTabs === void 0 ? void 0 : refTabs.current[currentFocusIndex].focus();
325
262
  }
326
-
327
263
  handleSelected(currentFocusIndex);
328
264
  break;
329
265
  }
330
266
  };
331
-
332
267
  var isTabActive = function isTabActive(index) {
333
268
  return activeTabIndex >= 0 ? activeTabIndex === index : innerActiveTabIndex === index;
334
269
  };
335
-
336
270
  var isActiveIndicatorDisabled = firstFocus === -1 || tabs && activeTabIndex >= 0 && tabs[activeTabIndex].isDisabled;
337
271
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
338
272
  theme: colorsTheme.tabs
@@ -343,9 +277,8 @@ var DxcTabs = function DxcTabs(_ref) {
343
277
  iconPosition: iconPosition
344
278
  }, /*#__PURE__*/_react["default"].createElement(ScrollIndicator, {
345
279
  onClick: scrollLeft,
346
- scrollLeftEnabled: scrollLeftEnabled,
347
280
  enabled: enabledIndicator,
348
- "aria-disabled": !scrollLeftEnabled,
281
+ disabled: !scrollLeftEnabled,
349
282
  "aria-label": translatedLabels.tabs.scrollLeft,
350
283
  tabIndex: scrollLeftEnabled ? tabIndex : -1,
351
284
  minHeightTabs: minHeightTabs
@@ -386,21 +319,18 @@ var DxcTabs = function DxcTabs(_ref) {
386
319
  "aria-disabled": isActiveIndicatorDisabled
387
320
  }))), /*#__PURE__*/_react["default"].createElement(ScrollIndicator, {
388
321
  onClick: scrollRight,
389
- scrollRightEnabled: scrollRightEnabled,
390
322
  enabled: enabledIndicator,
391
- "aria-disabled": !scrollRightEnabled,
323
+ disabled: !scrollRightEnabled,
392
324
  "aria-label": translatedLabels.tabs.scrollRight,
393
325
  tabIndex: scrollRightEnabled ? tabIndex : -1,
394
326
  minHeightTabs: minHeightTabs
395
327
  }, arrowIcons.right))));
396
328
  };
397
-
398
- var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n left: 0;\n bottom: 0;\n width: 100%;\n position: absolute;\n height: ", ";\n background-color: ", ";\n z-index: 1;\n"])), function (props) {
329
+ 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) {
399
330
  return props.theme.dividerThickness;
400
331
  }, function (props) {
401
332
  return props.theme.dividerColor;
402
333
  });
403
-
404
334
  var TabsContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
405
335
  return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
406
336
  }, function (props) {
@@ -412,7 +342,6 @@ var TabsContainer = _styledComponents["default"].div(_templateObject2 || (_templ
412
342
  }, function (props) {
413
343
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
414
344
  });
415
-
416
345
  var Tabs = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: ", ";\n height: ", ";\n display: flex;\n overflow: hidden;\n background-color: ", ";\n"])), function (props) {
417
346
  return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
418
347
  }, function (props) {
@@ -420,17 +349,12 @@ var Tabs = _styledComponents["default"].div(_templateObject3 || (_templateObject
420
349
  }, function (props) {
421
350
  return props.theme.unselectedBackgroundColor;
422
351
  });
423
-
424
- var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n background-color: #ffffff;\n font-size: 1.25rem;\n min-width: ", ";\n height: ", "px;\n padding: 0;\n justify-content: center;\n cursor: pointer;\n border-bottom: solid ", " ", ";\n box-sizing: border-box;\n border: none;\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n &:active {\n background-color: ", ";\n }\n svg {\n height: 20px;\n width: 20px;\n align-self: center;\n fill: ", ";\n visibility: visible;\n }\n &[aria-disabled=\"true\"] {\n pointer-events: none;\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"])), function (props) {
352
+ 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) {
425
353
  return props.enabled ? "flex" : "none";
426
354
  }, function (props) {
427
355
  return props.theme.scrollButtonsWidth;
428
356
  }, function (props) {
429
357
  return props.minHeightTabs - 1;
430
- }, function (props) {
431
- return props.theme.dividerThickness;
432
- }, function (props) {
433
- return props.theme.dividerColor;
434
358
  }, function (props) {
435
359
  return "".concat(props.theme.hoverBackgroundColor, " !important");
436
360
  }, function (props) {
@@ -440,28 +364,22 @@ var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_
440
364
  }, function (props) {
441
365
  return props.theme.unselectedFontColor;
442
366
  });
443
-
444
- var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n left: ", ";\n width: ", ";\n z-index: 2;\n background-color: ", ";\n bottom: 0;\n height: ", ";\n position: absolute;\n &[aria-disabled=\"true\"] {\n background-color: ", ";\n display: none;\n }\n"])), function (props) {
367
+ 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) {
445
368
  return "".concat(props.tabLeft, "px");
446
369
  }, function (props) {
447
370
  return "".concat(props.tabWidth, "px");
448
- }, function (props) {
449
- return props.theme.selectedUnderlineColor;
450
371
  }, function (props) {
451
372
  return props.theme.selectedUnderlineThickness;
373
+ }, function (props) {
374
+ return props.theme.selectedUnderlineColor;
452
375
  }, function (props) {
453
376
  return props.theme.disabledFontColor;
454
377
  });
455
-
456
- var TabsContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n z-index: 1;\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"])));
457
-
378
+ 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"])));
458
379
  var TabList = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n min-height: ", "px;\n"])), function (props) {
459
380
  return props.minHeightTabs;
460
381
  });
461
-
462
382
  var TabsContentScroll = _styledComponents["default"].div(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", ";\n transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n"])), function (props) {
463
383
  return props.enabled ? "transform: translateX(".concat(props.translateScroll, "px)") : "transform: translateX(0px)";
464
384
  });
465
-
466
- var _default = DxcTabs;
467
- exports["default"] = _default;
385
+ var _default = exports["default"] = DxcTabs;