@dxc-technology/halstack-react 0.0.0-878c09d → 0.0.0-8c3739a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/babel.config.js +6 -2
- package/dist/BackgroundColorContext.js +46 -0
- package/dist/ThemeContext.js +235 -2
- package/dist/accordion/Accordion.js +152 -67
- package/dist/accordion-group/AccordionGroup.js +37 -10
- package/dist/alert/Alert.js +183 -84
- package/dist/alert/index.d.ts +51 -0
- package/dist/badge/Badge.js +23 -18
- package/dist/box/Box.js +31 -23
- package/dist/button/Button.js +61 -25
- package/dist/card/Card.js +72 -35
- package/dist/checkbox/Checkbox.js +98 -38
- package/dist/chip/Chip.js +97 -40
- package/dist/common/RequiredComponent.js +2 -8
- package/dist/common/utils.js +2 -22
- package/dist/common/variables.js +1439 -303
- package/dist/date/Date.js +69 -49
- package/dist/date-input/DateInput.js +400 -0
- package/dist/date-input/index.d.ts +95 -0
- package/dist/dialog/Dialog.js +58 -37
- package/dist/dropdown/Dropdown.js +176 -81
- package/dist/file-input/FileInput.js +644 -0
- package/dist/file-input/FileItem.js +280 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/footer/Footer.js +74 -50
- package/dist/footer/dxc_logo.svg +15 -0
- package/dist/header/Header.js +93 -63
- package/dist/header/dxc_logo_black.svg +8 -0
- package/dist/heading/Heading.js +81 -16
- package/dist/input-text/InputText.js +250 -113
- package/dist/layout/ApplicationLayout.js +14 -18
- package/dist/link/Link.js +86 -41
- package/dist/main.d.ts +8 -0
- package/dist/main.js +74 -2
- package/dist/new-select/NewSelect.js +836 -0
- package/dist/new-select/index.d.ts +53 -0
- package/dist/new-textarea/NewTextarea.js +369 -0
- package/dist/new-textarea/index.d.ts +117 -0
- package/dist/number-input/NumberInput.js +136 -0
- package/dist/number-input/NumberInputContext.js +16 -0
- package/dist/number-input/index.d.ts +113 -0
- package/dist/paginator/Paginator.js +113 -56
- package/dist/password-input/PasswordInput.js +198 -0
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +95 -38
- package/dist/radio/Radio.js +31 -17
- package/dist/resultsetTable/ResultsetTable.js +82 -65
- package/dist/select/Select.js +226 -150
- package/dist/sidenav/Sidenav.js +66 -15
- package/dist/slider/Slider.js +197 -69
- package/dist/spinner/Spinner.js +247 -59
- package/dist/switch/Switch.js +50 -27
- package/dist/table/Table.js +51 -24
- package/dist/tabs/Tabs.js +95 -43
- package/dist/tag/Tag.js +68 -35
- package/dist/text-input/TextInput.js +971 -0
- package/dist/text-input/index.d.ts +135 -0
- package/dist/textarea/Textarea.js +77 -40
- package/dist/toggle/Toggle.js +16 -19
- package/dist/toggle-group/ToggleGroup.js +142 -41
- package/dist/upload/Upload.js +13 -8
- package/dist/upload/buttons-upload/ButtonsUpload.js +31 -14
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +78 -28
- package/dist/upload/file-upload/FileToUpload.js +50 -24
- package/dist/upload/files-upload/FilesToUpload.js +16 -16
- package/dist/upload/transaction/Transaction.js +44 -24
- package/dist/upload/transactions/Transactions.js +38 -20
- package/dist/useTheme.js +22 -0
- package/dist/wizard/Wizard.js +127 -47
- package/dist/wizard/invalid_icon.svg +4 -5
- package/dist/wizard/valid_icon.svg +4 -5
- package/package.json +8 -2
- package/test/AccordionGroup.test.js +16 -0
- package/test/Date.test.js +13 -13
- package/test/DateInput.test.js +242 -0
- package/test/Dropdown.test.js +15 -0
- package/test/FileInput.test.js +201 -0
- package/test/InputText.test.js +25 -17
- package/test/Link.test.js +3 -2
- package/test/NewTextarea.test.js +195 -0
- package/test/NumberInput.test.js +259 -0
- package/test/Paginator.test.js +40 -57
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +33 -8
- package/test/Select.test.js +44 -24
- package/test/Spinner.test.js +5 -0
- package/test/TextInput.test.js +732 -0
- package/test/ToggleGroup.test.js +5 -1
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/common/services/example-service.js +0 -10
- package/dist/common/services/example-service.test.js +0 -12
- package/dist/date/calendar.svg +0 -1
- package/dist/date/calendar_dark.svg +0 -1
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_blk_rgb.svg +0 -6
- package/dist/header/dxc_logo_white.png +0 -0
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/toggle-group/readme.md +0 -82
package/dist/table/Table.js
CHANGED
|
@@ -13,7 +13,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
-
var _react =
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
|
|
18
18
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
19
|
|
|
@@ -21,20 +21,12 @@ var _variables = require("../common/variables.js");
|
|
|
21
21
|
|
|
22
22
|
var _utils = require("../common/utils.js");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
var data = (0, _taggedTemplateLiteral2["default"])([""]);
|
|
28
|
-
|
|
29
|
-
_templateObject3 = function _templateObject3() {
|
|
30
|
-
return data;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return data;
|
|
34
|
-
}
|
|
26
|
+
var _BackgroundColorContext = require("../BackgroundColorContext.js");
|
|
35
27
|
|
|
36
28
|
function _templateObject2() {
|
|
37
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom:
|
|
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"]);
|
|
38
30
|
|
|
39
31
|
_templateObject2 = function _templateObject2() {
|
|
40
32
|
return data;
|
|
@@ -44,7 +36,7 @@ function _templateObject2() {
|
|
|
44
36
|
}
|
|
45
37
|
|
|
46
38
|
function _templateObject() {
|
|
47
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
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"]);
|
|
48
40
|
|
|
49
41
|
_templateObject = function _templateObject() {
|
|
50
42
|
return data;
|
|
@@ -56,15 +48,14 @@ function _templateObject() {
|
|
|
56
48
|
var DxcTable = function DxcTable(_ref) {
|
|
57
49
|
var children = _ref.children,
|
|
58
50
|
margin = _ref.margin;
|
|
59
|
-
var
|
|
60
|
-
var colorsTheme = (0, _react.useMemo)(function () {
|
|
61
|
-
return (0, _utils.getCustomTheme)(_variables.theme, (0, _utils.getCustomTheme)(_variables.defaultTheme, customTheme));
|
|
62
|
-
}, [customTheme]);
|
|
51
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
63
52
|
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
64
53
|
theme: colorsTheme.table
|
|
65
54
|
}, _react["default"].createElement(DxcTableContainer, {
|
|
66
55
|
margin: margin
|
|
67
|
-
}, _react["default"].createElement(DxcTableContent, null, _react["default"].createElement(
|
|
56
|
+
}, _react["default"].createElement(DxcTableContent, null, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
57
|
+
color: colorsTheme.table.dataBackgroundColor
|
|
58
|
+
}, children))));
|
|
68
59
|
};
|
|
69
60
|
|
|
70
61
|
var calculateWidth = function calculateWidth(margin) {
|
|
@@ -84,22 +75,58 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject(), func
|
|
|
84
75
|
}, function (props) {
|
|
85
76
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
86
77
|
}, function (props) {
|
|
87
|
-
return props.theme.
|
|
78
|
+
return props.theme.scrollBarThumbColor;
|
|
88
79
|
}, function (props) {
|
|
89
|
-
return props.theme.
|
|
80
|
+
return props.theme.scrollBarTrackColor;
|
|
90
81
|
});
|
|
91
82
|
|
|
92
83
|
var DxcTableContent = _styledComponents["default"].table(_templateObject2(), function (props) {
|
|
93
|
-
return props.theme.
|
|
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;
|
|
94
99
|
}, function (props) {
|
|
95
|
-
return props.theme.
|
|
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);
|
|
96
105
|
}, function (props) {
|
|
97
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;
|
|
98
115
|
}, function (props) {
|
|
99
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;
|
|
100
129
|
});
|
|
101
130
|
|
|
102
|
-
var DxcTableTBody = _styledComponents["default"].tbody(_templateObject3());
|
|
103
|
-
|
|
104
131
|
var _default = DxcTable;
|
|
105
132
|
exports["default"] = _default;
|
package/dist/tabs/Tabs.js
CHANGED
|
@@ -19,7 +19,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
19
19
|
|
|
20
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
21
21
|
|
|
22
|
-
var _react =
|
|
22
|
+
var _react = _interopRequireDefault(require("react"));
|
|
23
23
|
|
|
24
24
|
var _Tabs = _interopRequireDefault(require("@material-ui/core/Tabs"));
|
|
25
25
|
|
|
@@ -29,18 +29,24 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
29
29
|
|
|
30
30
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
31
|
|
|
32
|
-
require("../common/OpenSans.css");
|
|
33
|
-
|
|
34
32
|
var _variables = require("../common/variables.js");
|
|
35
33
|
|
|
36
34
|
var _Badge = _interopRequireDefault(require("../badge/Badge"));
|
|
37
35
|
|
|
38
|
-
var
|
|
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
|
+
};
|
|
39
44
|
|
|
40
|
-
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
41
47
|
|
|
42
48
|
function _templateObject8() {
|
|
43
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 22px;\n max-width: 22px;\n
|
|
49
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 22px;\n max-width: 22px;\n"]);
|
|
44
50
|
|
|
45
51
|
_templateObject8 = function _templateObject8() {
|
|
46
52
|
return data;
|
|
@@ -50,7 +56,7 @@ function _templateObject8() {
|
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
function _templateObject7() {
|
|
53
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n max-height:
|
|
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"]);
|
|
54
60
|
|
|
55
61
|
_templateObject7 = function _templateObject7() {
|
|
56
62
|
return data;
|
|
@@ -60,7 +66,7 @@ function _templateObject7() {
|
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
function _templateObject6() {
|
|
63
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
69
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n left: 0px;\n bottom: 0;\n width: 100%;\n height: ", ";\n position: absolute;\n background-color: ", ";\n"]);
|
|
64
70
|
|
|
65
71
|
_templateObject6 = function _templateObject6() {
|
|
66
72
|
return data;
|
|
@@ -70,7 +76,7 @@ function _templateObject6() {
|
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
function _templateObject5() {
|
|
73
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
79
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n margin-left: ", ";\n margin-right: ", ";\n"]);
|
|
74
80
|
|
|
75
81
|
_templateObject5 = function _templateObject5() {
|
|
76
82
|
return data;
|
|
@@ -80,7 +86,7 @@ function _templateObject5() {
|
|
|
80
86
|
}
|
|
81
87
|
|
|
82
88
|
function _templateObject4() {
|
|
83
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
89
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n right: 0;\n top: ", ";\n width: 23px;\n height: 17px;\n"]);
|
|
84
90
|
|
|
85
91
|
_templateObject4 = function _templateObject4() {
|
|
86
92
|
return data;
|
|
@@ -90,7 +96,7 @@ function _templateObject4() {
|
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
function _templateObject3() {
|
|
93
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["
|
|
99
|
+
var data = (0, _taggedTemplateLiteral2["default"])([""]);
|
|
94
100
|
|
|
95
101
|
_templateObject3 = function _templateObject3() {
|
|
96
102
|
return data;
|
|
@@ -100,7 +106,7 @@ function _templateObject3() {
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
function _templateObject2() {
|
|
103
|
-
var data = (0, _taggedTemplateLiteral2["default"])([""]);
|
|
109
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n align-items: center;\n"]);
|
|
104
110
|
|
|
105
111
|
_templateObject2 = function _templateObject2() {
|
|
106
112
|
return data;
|
|
@@ -110,7 +116,7 @@ function _templateObject2() {
|
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
function _templateObject() {
|
|
113
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
119
|
+
var data = (0, _taggedTemplateLiteral2["default"])(["\n position: relative;\n"]);
|
|
114
120
|
|
|
115
121
|
_templateObject = function _templateObject() {
|
|
116
122
|
return data;
|
|
@@ -124,19 +130,19 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
124
130
|
_ref$tabs = _ref.tabs,
|
|
125
131
|
tabs = _ref$tabs === void 0 ? [] : _ref$tabs,
|
|
126
132
|
onTabClick = _ref.onTabClick,
|
|
133
|
+
onTabHover = _ref.onTabHover,
|
|
127
134
|
margin = _ref.margin,
|
|
128
135
|
_ref$iconPosition = _ref.iconPosition,
|
|
129
|
-
iconPosition = _ref$iconPosition === void 0 ? "left" : _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;
|
|
130
139
|
|
|
131
140
|
var _React$useState = _react["default"].useState(0),
|
|
132
141
|
_React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
|
|
133
142
|
innerActiveTabIndex = _React$useState2[0],
|
|
134
143
|
setInnerActiveTabIndex = _React$useState2[1];
|
|
135
144
|
|
|
136
|
-
var
|
|
137
|
-
var colorsTheme = (0, _react.useMemo)(function () {
|
|
138
|
-
return (0, _utils.getCustomTheme)(_variables.theme, (0, _utils.getCustomTheme)(_variables.defaultTheme, customTheme));
|
|
139
|
-
}, [customTheme]);
|
|
145
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
140
146
|
var hasLabelAndIcon = tabs && tabs.filter(function (tab) {
|
|
141
147
|
return tab.label && tab.icon;
|
|
142
148
|
}).length > 0;
|
|
@@ -151,8 +157,12 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
151
157
|
}
|
|
152
158
|
};
|
|
153
159
|
|
|
160
|
+
var getTabIndex = function getTabIndex(index, disabled) {
|
|
161
|
+
return (activeTabIndex === index || innerActiveTabIndex === index) && !disabled ? tabIndex : -1;
|
|
162
|
+
};
|
|
163
|
+
|
|
154
164
|
var getLabelForTab = function getLabelForTab(tab) {
|
|
155
|
-
return _react["default"].createElement(MainLabelContainer, {
|
|
165
|
+
return _react["default"].createElement(ParentLabelSpan, null, _react["default"].createElement(MainLabelContainer, {
|
|
156
166
|
hasBadge: tab.notificationNumber
|
|
157
167
|
}, _react["default"].createElement(TabLabelContainer, {
|
|
158
168
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
@@ -162,7 +172,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
162
172
|
iconPosition: iconPosition
|
|
163
173
|
}, (0, _typeof2["default"])(tab.icon) === "object" ? tab.icon : _react["default"].createElement(tab.icon)) : tab.iconSrc && _react["default"].createElement(TabIcon, {
|
|
164
174
|
src: tab.iconSrc
|
|
165
|
-
}), _react["default"].createElement(LabelTextContainer, null, tab.label)), tab.notificationNumber && tab.notificationNumber !== false && _react["default"].createElement(BadgeContainer, {
|
|
175
|
+
}), _react["default"].createElement(LabelTextContainer, null, tab.label))), tab.notificationNumber && tab.notificationNumber !== false && _react["default"].createElement(BadgeContainer, {
|
|
166
176
|
hasLabelAndIcon: hasLabelAndIcon,
|
|
167
177
|
iconPosition: iconPosition
|
|
168
178
|
}, _react["default"].createElement(_Badge["default"], {
|
|
@@ -191,35 +201,46 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
191
201
|
});
|
|
192
202
|
|
|
193
203
|
return _react["default"].createElement(_Tab["default"], {
|
|
204
|
+
tabIndex: (activeTabIndex === i || innerActiveTabIndex === i) && !tab.isDisabled ? tabIndex : -1,
|
|
194
205
|
key: "tab".concat(i).concat(tab.label),
|
|
195
206
|
label: getLabelForTab(tab),
|
|
196
207
|
disabled: tab.isDisabled,
|
|
197
|
-
disableRipple: true
|
|
208
|
+
disableRipple: true,
|
|
209
|
+
onMouseEnter: function onMouseEnter() {
|
|
210
|
+
onTabHover(i);
|
|
211
|
+
},
|
|
212
|
+
onMouseLeave: function onMouseLeave() {
|
|
213
|
+
onTabHover(null);
|
|
214
|
+
}
|
|
198
215
|
});
|
|
199
216
|
}))));
|
|
200
217
|
};
|
|
201
218
|
|
|
202
|
-
var
|
|
219
|
+
var ParentLabelSpan = _styledComponents["default"].div(_templateObject());
|
|
220
|
+
|
|
221
|
+
var TabLabelContainer = _styledComponents["default"].div(_templateObject2(), function (props) {
|
|
203
222
|
return props.hasLabelAndIcon && props.iconPosition === "top" && "column" || "row";
|
|
204
223
|
});
|
|
205
224
|
|
|
206
|
-
var LabelTextContainer = _styledComponents["default"].div(
|
|
225
|
+
var LabelTextContainer = _styledComponents["default"].div(_templateObject3());
|
|
207
226
|
|
|
208
|
-
var BadgeContainer = _styledComponents["default"].div(
|
|
209
|
-
return props.hasLabelAndIcon && props.iconPosition === "top" && "
|
|
227
|
+
var BadgeContainer = _styledComponents["default"].div(_templateObject4(), function (props) {
|
|
228
|
+
return props.hasLabelAndIcon && props.iconPosition === "top" && "0" || "5px";
|
|
210
229
|
});
|
|
211
230
|
|
|
212
|
-
var MainLabelContainer = _styledComponents["default"].div(
|
|
213
|
-
return props.hasBadge && "
|
|
231
|
+
var MainLabelContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
232
|
+
return props.hasBadge && "35px" || "unset";
|
|
214
233
|
}, function (props) {
|
|
215
|
-
return props.hasBadge && "
|
|
234
|
+
return props.hasBadge && "35px" || "unset";
|
|
216
235
|
});
|
|
217
236
|
|
|
218
|
-
var Underline = _styledComponents["default"].div(
|
|
219
|
-
return props.theme.
|
|
237
|
+
var Underline = _styledComponents["default"].div(_templateObject6(), function (props) {
|
|
238
|
+
return props.theme.dividerThickness;
|
|
239
|
+
}, function (props) {
|
|
240
|
+
return props.theme.dividerColor;
|
|
220
241
|
});
|
|
221
242
|
|
|
222
|
-
var DxCTabs = _styledComponents["default"].div(
|
|
243
|
+
var DxCTabs = _styledComponents["default"].div(_templateObject7(), function (props) {
|
|
223
244
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
224
245
|
}, function (props) {
|
|
225
246
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -229,35 +250,63 @@ var DxCTabs = _styledComponents["default"].div(_templateObject6(), function (pro
|
|
|
229
250
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
230
251
|
}, function (props) {
|
|
231
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;
|
|
232
265
|
}, function (props) {
|
|
233
266
|
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "12px 16px" || "8px 16px";
|
|
234
267
|
}, function (props) {
|
|
235
268
|
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
|
|
236
269
|
}, function (props) {
|
|
237
|
-
return props.
|
|
270
|
+
return (!props.hasLabelAndIcon || props.hasLabelAndIcon && props.iconPosition !== "top") && "48px" || "72px";
|
|
238
271
|
}, function (props) {
|
|
239
272
|
return "".concat(props.theme.hoverBackgroundColor, " !important");
|
|
240
273
|
}, function (props) {
|
|
241
274
|
return "".concat(props.theme.pressedBackgroundColor, " !important");
|
|
242
275
|
}, function (props) {
|
|
243
|
-
return props.theme.
|
|
276
|
+
return "".concat(props.theme.pressedFontWeight, " !important");
|
|
244
277
|
}, function (props) {
|
|
245
|
-
return props.theme.
|
|
278
|
+
return props.theme.unselectedBackgroundColor;
|
|
246
279
|
}, function (props) {
|
|
247
|
-
return props.theme.
|
|
280
|
+
return props.theme.unselectedFontColor;
|
|
248
281
|
}, function (props) {
|
|
249
|
-
return props.theme.
|
|
282
|
+
return props.theme.unselectedIconColor;
|
|
250
283
|
}, function (props) {
|
|
251
|
-
return props.theme.
|
|
284
|
+
return props.theme.selectedBackgroundColor;
|
|
252
285
|
}, function (props) {
|
|
253
286
|
return props.theme.selectedFontColor;
|
|
254
287
|
}, function (props) {
|
|
255
|
-
return props.theme.
|
|
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;
|
|
256
305
|
});
|
|
257
306
|
|
|
258
|
-
var TabIcon = _styledComponents["default"].img(
|
|
307
|
+
var TabIcon = _styledComponents["default"].img(_templateObject8());
|
|
259
308
|
|
|
260
|
-
var TabIconContainer = _styledComponents["default"].div(
|
|
309
|
+
var TabIconContainer = _styledComponents["default"].div(_templateObject9(), function (props) {
|
|
261
310
|
return props.hasLabelAndIcon && props.iconPosition === "top" && "8px" || "";
|
|
262
311
|
}, function (props) {
|
|
263
312
|
return props.hasLabelAndIcon && props.iconPosition === "left" && "12px" || "";
|
|
@@ -266,12 +315,13 @@ var TabIconContainer = _styledComponents["default"].div(_templateObject8(), func
|
|
|
266
315
|
DxcTabs.propTypes = {
|
|
267
316
|
activeTabIndex: _propTypes["default"].number,
|
|
268
317
|
onTabClick: _propTypes["default"].func,
|
|
318
|
+
onTabHover: _propTypes["default"].func,
|
|
269
319
|
tabs: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
270
320
|
label: _propTypes["default"].string,
|
|
271
321
|
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
272
322
|
iconSrc: _propTypes["default"].string,
|
|
273
|
-
isDisabled: _propTypes["default"]
|
|
274
|
-
notificationNumber: _propTypes["default"].oneOfType([_propTypes["default"]["
|
|
323
|
+
isDisabled: _propTypes["default"].bool,
|
|
324
|
+
notificationNumber: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].string, _propTypes["default"].number])
|
|
275
325
|
})),
|
|
276
326
|
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
277
327
|
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
@@ -279,12 +329,14 @@ DxcTabs.propTypes = {
|
|
|
279
329
|
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
280
330
|
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
281
331
|
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
282
|
-
iconPosition: _propTypes["default"].oneOf(["top", "left"])
|
|
332
|
+
iconPosition: _propTypes["default"].oneOf(["top", "left"]),
|
|
333
|
+
tabIndex: _propTypes["default"].number
|
|
283
334
|
};
|
|
284
335
|
DxcTabs.defaultProps = {
|
|
285
336
|
activeTabIndex: null,
|
|
286
337
|
tabs: [],
|
|
287
338
|
onTabClick: function onTabClick() {},
|
|
339
|
+
onTabHover: function onTabHover() {},
|
|
288
340
|
iconPosition: "top"
|
|
289
341
|
};
|
|
290
342
|
var _default = DxcTabs;
|