@dxc-technology/halstack-react 0.0.0-e628009 → 0.0.0-e690193

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 (136) hide show
  1. package/README.md +27 -47
  2. package/dist/index.d.mts +3923 -0
  3. package/dist/index.d.ts +3923 -0
  4. package/dist/index.js +14133 -0
  5. package/dist/index.mjs +14045 -0
  6. package/package.json +92 -68
  7. package/babel.config.js +0 -8
  8. package/dist/BackgroundColorContext.js +0 -46
  9. package/dist/ThemeContext.js +0 -248
  10. package/dist/V3Textarea/V3Textarea.js +0 -264
  11. package/dist/accordion/Accordion.js +0 -353
  12. package/dist/accordion-group/AccordionGroup.js +0 -186
  13. package/dist/alert/Alert.js +0 -403
  14. package/dist/alert/index.d.ts +0 -51
  15. package/dist/badge/Badge.js +0 -63
  16. package/dist/box/Box.js +0 -156
  17. package/dist/button/Button.js +0 -238
  18. package/dist/card/Card.js +0 -254
  19. package/dist/checkbox/Checkbox.js +0 -300
  20. package/dist/chip/Chip.js +0 -265
  21. package/dist/common/OpenSans.css +0 -81
  22. package/dist/common/RequiredComponent.js +0 -40
  23. package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
  24. package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  25. package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  26. package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  27. package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
  28. package/dist/common/fonts/OpenSans-Light.ttf +0 -0
  29. package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
  30. package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
  31. package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
  32. package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  33. package/dist/common/utils.js +0 -22
  34. package/dist/common/variables.js +0 -1569
  35. package/dist/date/Date.js +0 -379
  36. package/dist/date-input/DateInput.js +0 -400
  37. package/dist/date-input/index.d.ts +0 -95
  38. package/dist/dialog/Dialog.js +0 -218
  39. package/dist/dropdown/Dropdown.js +0 -544
  40. package/dist/file-input/FileInput.js +0 -644
  41. package/dist/file-input/FileItem.js +0 -280
  42. package/dist/file-input/index.d.ts +0 -81
  43. package/dist/footer/Footer.js +0 -421
  44. package/dist/footer/Icons.js +0 -77
  45. package/dist/header/Header.js +0 -434
  46. package/dist/header/Icons.js +0 -59
  47. package/dist/heading/Heading.js +0 -230
  48. package/dist/input-text/Icons.js +0 -22
  49. package/dist/input-text/InputText.js +0 -705
  50. package/dist/layout/ApplicationLayout.js +0 -327
  51. package/dist/layout/Icons.js +0 -55
  52. package/dist/link/Link.js +0 -237
  53. package/dist/main.d.ts +0 -8
  54. package/dist/main.js +0 -367
  55. package/dist/new-select/NewSelect.js +0 -836
  56. package/dist/new-select/index.d.ts +0 -53
  57. package/dist/number-input/NumberInput.js +0 -136
  58. package/dist/number-input/NumberInputContext.js +0 -16
  59. package/dist/number-input/index.d.ts +0 -113
  60. package/dist/paginator/Icons.js +0 -66
  61. package/dist/paginator/Paginator.js +0 -283
  62. package/dist/password-input/PasswordInput.js +0 -198
  63. package/dist/password-input/index.d.ts +0 -94
  64. package/dist/progress-bar/ProgressBar.js +0 -242
  65. package/dist/radio/Radio.js +0 -209
  66. package/dist/resultsetTable/ResultsetTable.js +0 -358
  67. package/dist/select/Select.js +0 -549
  68. package/dist/sidenav/Sidenav.js +0 -179
  69. package/dist/slider/Slider.js +0 -404
  70. package/dist/spinner/Spinner.js +0 -381
  71. package/dist/switch/Switch.js +0 -222
  72. package/dist/table/Table.js +0 -132
  73. package/dist/tabs/Tabs.js +0 -343
  74. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  75. package/dist/tag/Tag.js +0 -282
  76. package/dist/text-input/TextInput.js +0 -971
  77. package/dist/text-input/index.d.ts +0 -135
  78. package/dist/textarea/Textarea.js +0 -369
  79. package/dist/textarea/index.d.ts +0 -117
  80. package/dist/toggle/Toggle.js +0 -220
  81. package/dist/toggle-group/ToggleGroup.js +0 -327
  82. package/dist/upload/Upload.js +0 -205
  83. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
  84. package/dist/upload/buttons-upload/Icons.js +0 -40
  85. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  86. package/dist/upload/dragAndDropArea/Icons.js +0 -39
  87. package/dist/upload/file-upload/FileToUpload.js +0 -189
  88. package/dist/upload/file-upload/Icons.js +0 -66
  89. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  90. package/dist/upload/transaction/Icons.js +0 -160
  91. package/dist/upload/transaction/Transaction.js +0 -148
  92. package/dist/upload/transactions/Transactions.js +0 -138
  93. package/dist/useTheme.js +0 -22
  94. package/dist/wizard/Icons.js +0 -65
  95. package/dist/wizard/Wizard.js +0 -405
  96. package/test/Accordion.test.js +0 -33
  97. package/test/AccordionGroup.test.js +0 -125
  98. package/test/Alert.test.js +0 -53
  99. package/test/Box.test.js +0 -10
  100. package/test/Button.test.js +0 -18
  101. package/test/Card.test.js +0 -30
  102. package/test/Checkbox.test.js +0 -45
  103. package/test/Chip.test.js +0 -25
  104. package/test/Date.test.js +0 -397
  105. package/test/DateInput.test.js +0 -242
  106. package/test/Dialog.test.js +0 -23
  107. package/test/Dropdown.test.js +0 -145
  108. package/test/FileInput.test.js +0 -201
  109. package/test/Footer.test.js +0 -94
  110. package/test/Header.test.js +0 -34
  111. package/test/Heading.test.js +0 -83
  112. package/test/InputText.test.js +0 -248
  113. package/test/Link.test.js +0 -43
  114. package/test/NumberInput.test.js +0 -259
  115. package/test/Paginator.test.js +0 -177
  116. package/test/PasswordInput.test.js +0 -83
  117. package/test/ProgressBar.test.js +0 -35
  118. package/test/Radio.test.js +0 -37
  119. package/test/ResultsetTable.test.js +0 -329
  120. package/test/Select.test.js +0 -212
  121. package/test/Sidenav.test.js +0 -45
  122. package/test/Slider.test.js +0 -74
  123. package/test/Spinner.test.js +0 -32
  124. package/test/Switch.test.js +0 -45
  125. package/test/Table.test.js +0 -36
  126. package/test/Tabs.test.js +0 -109
  127. package/test/TabsForSections.test.js +0 -34
  128. package/test/Tag.test.js +0 -32
  129. package/test/TextInput.test.js +0 -732
  130. package/test/Textarea.test.js +0 -193
  131. package/test/ToggleGroup.test.js +0 -85
  132. package/test/Upload.test.js +0 -60
  133. package/test/V3TextArea.test.js +0 -51
  134. package/test/Wizard.test.js +0 -130
  135. package/test/mocks/pngMock.js +0 -1
  136. package/test/mocks/svgMock.js +0 -1
@@ -1,132 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _react = _interopRequireDefault(require("react"));
17
-
18
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
-
20
- var _variables = require("../common/variables.js");
21
-
22
- var _utils = require("../common/utils.js");
23
-
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
25
-
26
- var _BackgroundColorContext = require("../BackgroundColorContext.js");
27
-
28
- function _templateObject2() {
29
- var data = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n }\n"]);
30
-
31
- _templateObject2 = function _templateObject2() {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- function _templateObject() {
39
- var data = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n overflow: hidden auto;\n &::-webkit-scrollbar {\n width: 8px;\n }\n &::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 6px;\n }\n &::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 6px;\n }\n"]);
40
-
41
- _templateObject = function _templateObject() {
42
- return data;
43
- };
44
-
45
- return data;
46
- }
47
-
48
- var DxcTable = function DxcTable(_ref) {
49
- var children = _ref.children,
50
- margin = _ref.margin;
51
- var colorsTheme = (0, _useTheme["default"])();
52
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
53
- theme: colorsTheme.table
54
- }, _react["default"].createElement(DxcTableContainer, {
55
- margin: margin
56
- }, _react["default"].createElement(DxcTableContent, null, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
57
- color: colorsTheme.table.dataBackgroundColor
58
- }, children))));
59
- };
60
-
61
- var calculateWidth = function calculateWidth(margin) {
62
- return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
63
- };
64
-
65
- var DxcTableContainer = _styledComponents["default"].div(_templateObject(), function (props) {
66
- return calculateWidth(props.margin);
67
- }, function (props) {
68
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
69
- }, function (props) {
70
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
71
- }, function (props) {
72
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
73
- }, function (props) {
74
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
75
- }, function (props) {
76
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
77
- }, function (props) {
78
- return props.theme.scrollBarThumbColor;
79
- }, function (props) {
80
- return props.theme.scrollBarTrackColor;
81
- });
82
-
83
- var DxcTableContent = _styledComponents["default"].table(_templateObject2(), function (props) {
84
- return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
85
- }, function (props) {
86
- return props.theme.dataBackgroundColor;
87
- }, function (props) {
88
- return props.theme.dataFontFamily;
89
- }, function (props) {
90
- return props.theme.dataFontSize;
91
- }, function (props) {
92
- return props.theme.dataFontStyle;
93
- }, function (props) {
94
- return props.theme.dataFontWeight;
95
- }, function (props) {
96
- return props.theme.dataFontColor;
97
- }, function (props) {
98
- return props.theme.dataFontTextTransform;
99
- }, function (props) {
100
- return props.theme.dataTextAlign;
101
- }, function (props) {
102
- return props.theme.dataTextLineHeight;
103
- }, function (props) {
104
- return "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft);
105
- }, function (props) {
106
- return props.theme.headerBackgroundColor;
107
- }, function (props) {
108
- return props.theme.headerFontFamily;
109
- }, function (props) {
110
- return props.theme.headerFontSize;
111
- }, function (props) {
112
- return props.theme.headerFontStyle;
113
- }, function (props) {
114
- return props.theme.headerFontWeight;
115
- }, function (props) {
116
- return props.theme.headerFontColor;
117
- }, function (props) {
118
- return props.theme.headerFontTextTransform;
119
- }, function (props) {
120
- return props.theme.headerTextAlign;
121
- }, function (props) {
122
- return props.theme.headerTextLineHeight;
123
- }, function (props) {
124
- return "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft);
125
- }, function (props) {
126
- return props.theme.headerBorderRadius;
127
- }, function (props) {
128
- return props.theme.headerBorderRadius;
129
- });
130
-
131
- var _default = DxcTable;
132
- exports["default"] = _default;
package/dist/tabs/Tabs.js DELETED
@@ -1,343 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
17
-
18
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
19
-
20
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
21
-
22
- var _react = _interopRequireDefault(require("react"));
23
-
24
- var _Tabs = _interopRequireDefault(require("@material-ui/core/Tabs"));
25
-
26
- var _Tab = _interopRequireDefault(require("@material-ui/core/Tab"));
27
-
28
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
29
-
30
- var _propTypes = _interopRequireDefault(require("prop-types"));
31
-
32
- var _variables = require("../common/variables.js");
33
-
34
- var _Badge = _interopRequireDefault(require("../badge/Badge"));
35
-
36
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
37
-
38
- function _templateObject9() {
39
- var data = (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"]);
40
-
41
- _templateObject9 = function _templateObject9() {
42
- return data;
43
- };
44
-
45
- return data;
46
- }
47
-
48
- function _templateObject8() {
49
- var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 22px;\n max-width: 22px;\n"]);
50
-
51
- _templateObject8 = function _templateObject8() {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
57
-
58
- function _templateObject7() {
59
- var data = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n .MuiTabs-root {\n background: white;\n min-height: ", ";\n\n .MuiTabs-scroller {\n .MuiTabs-flexContainer + span {\n z-index: 4;\n }\n }\n .MuiTab-root {\n text-transform: ", " !important;\n }\n .MuiButtonBase-root {\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n\n padding: ", ";\n height: ", ";\n min-width: 90px;\n max-width: 360px;\n min-height: ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n font-weight: ", ";\n }\n &:not(.Mui-selected) {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-selected {\n background-color: ", ";\n color: ", ";\n svg {\n color: ", ";\n }\n }\n &.Mui-disabled {\n cursor: not-allowed !important;\n pointer-events: all;\n color: ", ";\n font-style: ", ";\n svg {\n color: ", ";\n }\n }\n &:focus {\n outline: ", " auto 1px;\n }\n }\n .MuiTabs-indicator {\n background-color: ", ";\n height: ", ";\n }\n .MuiTabs-scrollButtons {\n min-width: ", ";\n width: ", ";\n padding: 0;\n }\n @media (max-width: 599.95px) {\n .MuiTabs-scrollButtonsDesktop {\n display: flex;\n }\n }\n }\n"]);
60
-
61
- _templateObject7 = function _templateObject7() {
62
- return data;
63
- };
64
-
65
- return data;
66
- }
67
-
68
- function _templateObject6() {
69
- var data = (0, _taggedTemplateLiteral2["default"])(["\n left: 0px;\n bottom: 0;\n width: 100%;\n height: ", ";\n position: absolute;\n background-color: ", ";\n"]);
70
-
71
- _templateObject6 = function _templateObject6() {
72
- return data;
73
- };
74
-
75
- return data;
76
- }
77
-
78
- function _templateObject5() {
79
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n margin-left: ", ";\n margin-right: ", ";\n"]);
80
-
81
- _templateObject5 = function _templateObject5() {
82
- return data;
83
- };
84
-
85
- return data;
86
- }
87
-
88
- function _templateObject4() {
89
- var data = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n right: 0;\n top: ", ";\n width: 23px;\n height: 17px;\n"]);
90
-
91
- _templateObject4 = function _templateObject4() {
92
- return data;
93
- };
94
-
95
- return data;
96
- }
97
-
98
- function _templateObject3() {
99
- var data = (0, _taggedTemplateLiteral2["default"])([""]);
100
-
101
- _templateObject3 = function _templateObject3() {
102
- return data;
103
- };
104
-
105
- return data;
106
- }
107
-
108
- function _templateObject2() {
109
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n align-items: center;\n"]);
110
-
111
- _templateObject2 = function _templateObject2() {
112
- return data;
113
- };
114
-
115
- return data;
116
- }
117
-
118
- function _templateObject() {
119
- var data = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n"]);
120
-
121
- _templateObject = function _templateObject() {
122
- return data;
123
- };
124
-
125
- return data;
126
- }
127
-
128
- var DxcTabs = function DxcTabs(_ref) {
129
- var activeTabIndex = _ref.activeTabIndex,
130
- _ref$tabs = _ref.tabs,
131
- tabs = _ref$tabs === void 0 ? [] : _ref$tabs,
132
- onTabClick = _ref.onTabClick,
133
- onTabHover = _ref.onTabHover,
134
- margin = _ref.margin,
135
- _ref$iconPosition = _ref.iconPosition,
136
- iconPosition = _ref$iconPosition === void 0 ? "left" : _ref$iconPosition,
137
- _ref$tabIndex = _ref.tabIndex,
138
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
139
-
140
- var _React$useState = _react["default"].useState(0),
141
- _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
142
- innerActiveTabIndex = _React$useState2[0],
143
- setInnerActiveTabIndex = _React$useState2[1];
144
-
145
- var colorsTheme = (0, _useTheme["default"])();
146
- var hasLabelAndIcon = tabs && tabs.filter(function (tab) {
147
- return tab.label && tab.icon;
148
- }).length > 0;
149
-
150
- var handleChange = function handleChange(event, newValue) {
151
- if (activeTabIndex == null) {
152
- setInnerActiveTabIndex(newValue);
153
- }
154
-
155
- if (typeof onTabClick === "function") {
156
- onTabClick(newValue);
157
- }
158
- };
159
-
160
- var getTabIndex = function getTabIndex(index, disabled) {
161
- return (activeTabIndex === index || innerActiveTabIndex === index) && !disabled ? tabIndex : -1;
162
- };
163
-
164
- var getLabelForTab = function getLabelForTab(tab) {
165
- return _react["default"].createElement(ParentLabelSpan, null, _react["default"].createElement(MainLabelContainer, {
166
- hasBadge: tab.notificationNumber
167
- }, _react["default"].createElement(TabLabelContainer, {
168
- hasLabelAndIcon: hasLabelAndIcon,
169
- iconPosition: iconPosition
170
- }, tab.icon ? _react["default"].createElement(TabIconContainer, {
171
- hasLabelAndIcon: hasLabelAndIcon,
172
- iconPosition: iconPosition
173
- }, (0, _typeof2["default"])(tab.icon) === "object" ? tab.icon : _react["default"].createElement(tab.icon)) : tab.iconSrc && _react["default"].createElement(TabIcon, {
174
- src: tab.iconSrc
175
- }), _react["default"].createElement(LabelTextContainer, null, tab.label))), tab.notificationNumber && tab.notificationNumber !== false && _react["default"].createElement(BadgeContainer, {
176
- hasLabelAndIcon: hasLabelAndIcon,
177
- iconPosition: iconPosition
178
- }, _react["default"].createElement(_Badge["default"], {
179
- notificationText: tab.notificationNumber > 99 ? "+99" : tab.notificationNumber
180
- })));
181
- };
182
-
183
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
184
- theme: colorsTheme.tabs
185
- }, _react["default"].createElement(DxCTabs, {
186
- margin: margin,
187
- hasLabelAndIcon: hasLabelAndIcon,
188
- iconPosition: iconPosition
189
- }, _react["default"].createElement(Underline, null), _react["default"].createElement(_Tabs["default"], {
190
- value: activeTabIndex != null ? activeTabIndex : innerActiveTabIndex,
191
- onChange: handleChange,
192
- variant: "scrollable",
193
- scrollButtons: "auto"
194
- }, tabs.map(function (tab, i) {
195
- var tabContent = _react["default"].forwardRef(function (props, ref) {
196
- return _react["default"].createElement("div", (0, _extends2["default"])({
197
- role: "button"
198
- }, props, {
199
- ref: ref
200
- }));
201
- });
202
-
203
- return _react["default"].createElement(_Tab["default"], {
204
- tabIndex: (activeTabIndex === i || innerActiveTabIndex === i) && !tab.isDisabled ? tabIndex : -1,
205
- key: "tab".concat(i).concat(tab.label),
206
- label: getLabelForTab(tab),
207
- disabled: tab.isDisabled,
208
- disableRipple: true,
209
- onMouseEnter: function onMouseEnter() {
210
- onTabHover(i);
211
- },
212
- onMouseLeave: function onMouseLeave() {
213
- onTabHover(null);
214
- }
215
- });
216
- }))));
217
- };
218
-
219
- var ParentLabelSpan = _styledComponents["default"].div(_templateObject());
220
-
221
- var TabLabelContainer = _styledComponents["default"].div(_templateObject2(), function (props) {
222
- return props.hasLabelAndIcon && props.iconPosition === "top" && "column" || "row";
223
- });
224
-
225
- var LabelTextContainer = _styledComponents["default"].div(_templateObject3());
226
-
227
- var BadgeContainer = _styledComponents["default"].div(_templateObject4(), function (props) {
228
- return props.hasLabelAndIcon && props.iconPosition === "top" && "0" || "5px";
229
- });
230
-
231
- var MainLabelContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
232
- return props.hasBadge && "35px" || "unset";
233
- }, function (props) {
234
- return props.hasBadge && "35px" || "unset";
235
- });
236
-
237
- var Underline = _styledComponents["default"].div(_templateObject6(), function (props) {
238
- return props.theme.dividerThickness;
239
- }, function (props) {
240
- return props.theme.dividerColor;
241
- });
242
-
243
- var DxCTabs = _styledComponents["default"].div(_templateObject7(), function (props) {
244
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
245
- }, function (props) {
246
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
247
- }, function (props) {
248
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
249
- }, function (props) {
250
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
251
- }, function (props) {
252
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
253
- }, function (props) {
254
- return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
255
- }, function (props) {
256
- return props.theme.fontTextTransform;
257
- }, function (props) {
258
- return props.theme.fontFamily;
259
- }, function (props) {
260
- return props.theme.fontSize;
261
- }, function (props) {
262
- return props.theme.fontStyle;
263
- }, function (props) {
264
- return props.theme.fontWeight;
265
- }, function (props) {
266
- return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
267
- }, function (props) {
268
- return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
269
- }, function (props) {
270
- return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
271
- }, function (props) {
272
- return "".concat(props.theme.hoverBackgroundColor, " !important");
273
- }, function (props) {
274
- return "".concat(props.theme.pressedBackgroundColor, " !important");
275
- }, function (props) {
276
- return "".concat(props.theme.pressedFontWeight, " !important");
277
- }, function (props) {
278
- return props.theme.unselectedBackgroundColor;
279
- }, function (props) {
280
- return props.theme.unselectedFontColor;
281
- }, function (props) {
282
- return props.theme.unselectedIconColor;
283
- }, function (props) {
284
- return props.theme.selectedBackgroundColor;
285
- }, function (props) {
286
- return props.theme.selectedFontColor;
287
- }, function (props) {
288
- return props.theme.selectedIconColor;
289
- }, function (props) {
290
- return props.theme.disabledFontColor;
291
- }, function (props) {
292
- return props.theme.disabledFontStyle;
293
- }, function (props) {
294
- return props.theme.disabledIconColor;
295
- }, function (props) {
296
- return props.theme.focusOutline;
297
- }, function (props) {
298
- return props.theme.selectedUnderlineColor;
299
- }, function (props) {
300
- return props.theme.selectedUnderlineThickness;
301
- }, function (props) {
302
- return props.theme.scrollButtonsWidth;
303
- }, function (props) {
304
- return props.theme.scrollButtonsWidth;
305
- });
306
-
307
- var TabIcon = _styledComponents["default"].img(_templateObject8());
308
-
309
- var TabIconContainer = _styledComponents["default"].div(_templateObject9(), function (props) {
310
- return props.hasLabelAndIcon && props.iconPosition === "top" && "8px" || "";
311
- }, function (props) {
312
- return props.hasLabelAndIcon && props.iconPosition === "left" && "12px" || "";
313
- });
314
-
315
- DxcTabs.propTypes = {
316
- activeTabIndex: _propTypes["default"].number,
317
- onTabClick: _propTypes["default"].func,
318
- onTabHover: _propTypes["default"].func,
319
- tabs: _propTypes["default"].arrayOf(_propTypes["default"].shape({
320
- label: _propTypes["default"].string,
321
- icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
322
- iconSrc: _propTypes["default"].string,
323
- isDisabled: _propTypes["default"].bool,
324
- notificationNumber: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].string, _propTypes["default"].number])
325
- })),
326
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
327
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
328
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
329
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
330
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
331
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
332
- iconPosition: _propTypes["default"].oneOf(["top", "left"]),
333
- tabIndex: _propTypes["default"].number
334
- };
335
- DxcTabs.defaultProps = {
336
- activeTabIndex: null,
337
- tabs: [],
338
- onTabClick: function onTabClick() {},
339
- onTabHover: function onTabHover() {},
340
- iconPosition: "top"
341
- };
342
- var _default = DxcTabs;
343
- exports["default"] = _default;
@@ -1,92 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
-
12
- var _react = _interopRequireDefault(require("react"));
13
-
14
- var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
- var _reactUseScrollspy = _interopRequireDefault(require("react-use-scrollspy"));
19
-
20
- var _Tabs = _interopRequireDefault(require("../tabs/Tabs"));
21
-
22
- function _templateObject() {
23
- var data = (0, _taggedTemplateLiteral2["default"])(["\n z-index: 10;\n ", "\n"]);
24
-
25
- _templateObject = function _templateObject() {
26
- return data;
27
- };
28
-
29
- return data;
30
- }
31
-
32
- var TABS_HEIGHT = 54;
33
-
34
- var DxcTabsForSections = function DxcTabsForSections(_ref) {
35
- var _ref$sections = _ref.sections,
36
- sections = _ref$sections === void 0 ? [] : _ref$sections,
37
- _ref$stickAtPx = _ref.stickAtPx,
38
- stickAtPx = _ref$stickAtPx === void 0 ? 0 : _ref$stickAtPx;
39
- var tabs = sections.map(function (section) {
40
- return {
41
- label: section.tabLabel
42
- };
43
- });
44
- var refs = sections.map(function () {
45
- return _react["default"].createRef();
46
- });
47
- var activeTab = (0, _reactUseScrollspy["default"])({
48
- sectionElementRefs: refs,
49
- offsetPx: -stickAtPx - TABS_HEIGHT
50
- });
51
-
52
- var onTabClick = function onTabClick(tabId) {
53
- var topOfElement = refs[tabId].current.offsetTop - stickAtPx - TABS_HEIGHT + 5;
54
- window.scroll({
55
- top: topOfElement,
56
- behavior: "smooth"
57
- });
58
- };
59
-
60
- return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(StyledTabs, {
61
- stickAtPx: stickAtPx
62
- }, _react["default"].createElement(_Tabs["default"], {
63
- tabs: tabs,
64
- activeTabIndex: activeTab,
65
- onTabClick: onTabClick
66
- })), sections.map(function (section, i) {
67
- return _react["default"].createElement("div", {
68
- key: "section".concat(i),
69
- ref: refs[i]
70
- }, _react["default"].createElement(section.section, null));
71
- }));
72
- };
73
-
74
- DxcTabsForSections.propTypes = {
75
- stickAtPx: _propTypes["default"].number,
76
- sections: _propTypes["default"].arrayOf(_propTypes["default"].shape({
77
- tabLabel: _propTypes["default"].string,
78
- section: _propTypes["default"].func
79
- }))
80
- };
81
- DxcTabsForSections.defaultProps = {
82
- stickAtPx: 0,
83
- sections: []
84
- };
85
-
86
- var StyledTabs = _styledComponents["default"].div(_templateObject(), function (_ref2) {
87
- var stickAtPx = _ref2.stickAtPx;
88
- return stickAtPx && "\n position: sticky;\n top: ".concat(stickAtPx, "px;\n ");
89
- });
90
-
91
- var _default = DxcTabsForSections;
92
- exports["default"] = _default;