@bento-core/tab 1.0.0-c3dc.0 → 1.0.1-CDS.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tabs.js +32 -24
- package/dist/tabsStyle.js +10 -37
- package/package.json +6 -3
- package/src/Tabs.js +30 -29
- package/src/tabsStyle.js +9 -36
package/dist/Tabs.js
CHANGED
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _ToolTip = _interopRequireDefault(require("@bento-core/tool-tip/src/ToolTip"));
|
|
8
9
|
var _core = require("@material-ui/core");
|
|
9
|
-
var _toolTip = _interopRequireDefault(require("@bento-core/tool-tip"));
|
|
10
10
|
var _defaultTheme = require("./defaultTheme");
|
|
11
|
+
var _generateStyle = _interopRequireDefault(require("./utils/generateStyle"));
|
|
12
|
+
const _excluded = ["title"];
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
15
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -15,6 +17,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
15
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
19
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
18
22
|
const TabItems = _ref => {
|
|
19
23
|
let {
|
|
20
24
|
tabItems,
|
|
@@ -23,7 +27,10 @@ const TabItems = _ref => {
|
|
|
23
27
|
orientation,
|
|
24
28
|
customTheme = {}
|
|
25
29
|
} = _ref;
|
|
26
|
-
const
|
|
30
|
+
const generatedStyle = (0, _generateStyle.default)();
|
|
31
|
+
const useStyles = (0, _core.makeStyles)(generatedStyle);
|
|
32
|
+
const classes = useStyles();
|
|
33
|
+
const getTabLabel = _ref2 => {
|
|
27
34
|
let {
|
|
28
35
|
name,
|
|
29
36
|
count,
|
|
@@ -34,27 +41,28 @@ const TabItems = _ref => {
|
|
|
34
41
|
className: "index_".concat(index, " ").concat(clsName, "_count")
|
|
35
42
|
}, count)));
|
|
36
43
|
};
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
index
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
const CustomTab = tabItems.map((tab, index) => {
|
|
45
|
+
const _ref3 = tab.tooltipConfig || {},
|
|
46
|
+
{
|
|
47
|
+
title: tooltipTitle
|
|
48
|
+
} = _ref3,
|
|
49
|
+
tooltipProps = _objectWithoutProperties(_ref3, _excluded);
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_ToolTip.default, _extends({
|
|
51
|
+
key: "tab_".concat(index, "_").concat(tab.name),
|
|
52
|
+
title: tooltipTitle || '',
|
|
53
|
+
classes: {
|
|
54
|
+
tooltip: classes.customTooltip,
|
|
55
|
+
arrow: classes.customArrow
|
|
56
|
+
}
|
|
57
|
+
}, tooltipProps), /*#__PURE__*/_react.default.createElement(_core.Tab, {
|
|
58
|
+
index: index,
|
|
59
|
+
label: getTabLabel(_objectSpread(_objectSpread({}, tab), {}, {
|
|
60
|
+
index
|
|
61
|
+
})),
|
|
62
|
+
className: tab.clsName,
|
|
63
|
+
disableRipple: true
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
58
66
|
const themeConfig = (0, _core.createTheme)({
|
|
59
67
|
overrides: _objectSpread(_objectSpread({}, (0, _defaultTheme.defaultTheme)()), customTheme)
|
|
60
68
|
});
|
|
@@ -69,7 +77,7 @@ const TabItems = _ref => {
|
|
|
69
77
|
}
|
|
70
78
|
},
|
|
71
79
|
orientation: orientation
|
|
72
|
-
},
|
|
80
|
+
}, CustomTab));
|
|
73
81
|
};
|
|
74
82
|
var _default = TabItems;
|
|
75
83
|
exports.default = _default;
|
package/dist/tabsStyle.js
CHANGED
|
@@ -6,45 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
const tabsStyle = {
|
|
8
8
|
tabsContainer: {},
|
|
9
|
-
muiTabs: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
overflow: 'visible !important'
|
|
16
|
-
},
|
|
17
|
-
indicator: {
|
|
18
|
-
display: 'none'
|
|
19
|
-
}
|
|
9
|
+
muiTabs: {},
|
|
10
|
+
muiTab: {},
|
|
11
|
+
tabsLabel: {},
|
|
12
|
+
tabsPanel: {},
|
|
13
|
+
customTooltip: {
|
|
14
|
+
border: '#03A383 1px solid'
|
|
20
15
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
height: '45px',
|
|
25
|
-
minHeight: '40px',
|
|
26
|
-
marginRight: '10px',
|
|
27
|
-
background: '#EAEAEA',
|
|
28
|
-
fontSize: '18px',
|
|
29
|
-
fontFamily: 'Raleway',
|
|
30
|
-
fontWeight: '400',
|
|
31
|
-
lineHeight: '18px',
|
|
32
|
-
paddingLeft: '5px',
|
|
33
|
-
letterSpacing: '0.25px',
|
|
34
|
-
borderTop: '1px solid black',
|
|
35
|
-
borderLeft: '1px solid black',
|
|
36
|
-
borderRight: '1px solid black',
|
|
37
|
-
'&$selected': {
|
|
38
|
-
fontWeight: 'bolder'
|
|
39
|
-
}
|
|
16
|
+
customArrow: {
|
|
17
|
+
'&::before': {
|
|
18
|
+
border: '#03A383 1px solid'
|
|
40
19
|
}
|
|
41
|
-
}
|
|
42
|
-
tabsLabel: {
|
|
43
|
-
fontFamily: 'Lato',
|
|
44
|
-
textTransform: 'capitalize',
|
|
45
|
-
fontSize: '21px'
|
|
46
|
-
},
|
|
47
|
-
tabsPanel: {}
|
|
20
|
+
}
|
|
48
21
|
};
|
|
49
22
|
var _default = tabsStyle;
|
|
50
23
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/tab",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-CDS.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,13 +12,16 @@
|
|
|
12
12
|
"publishConfig": {
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@bento-core/tool-tip": "^1.0.0"
|
|
17
|
+
},
|
|
15
18
|
"peerDependencies": {
|
|
16
19
|
"@material-ui/core": "^4.12.4",
|
|
17
|
-
"@bento-core/tool-tip": "^0.2.0",
|
|
18
20
|
"react": "^17.0.2",
|
|
19
21
|
"react-dom": "^17.0.0",
|
|
20
22
|
"react-redux": "^7.2.1"
|
|
21
23
|
},
|
|
22
24
|
"author": "CTOS Bento Team",
|
|
23
|
-
"license": "ISC"
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"gitHead": "12ceec27794b24a5ab2870e421cbb6ff5970b438"
|
|
24
27
|
}
|
package/src/Tabs.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import ToolTip from '@bento-core/tool-tip/src/ToolTip';
|
|
2
3
|
import {
|
|
3
4
|
Tab,
|
|
4
5
|
Tabs,
|
|
5
6
|
createTheme,
|
|
6
7
|
ThemeProvider,
|
|
8
|
+
makeStyles,
|
|
7
9
|
} from '@material-ui/core';
|
|
8
|
-
import ToolTip from '@bento-core/tool-tip';
|
|
9
10
|
import { defaultTheme } from './defaultTheme';
|
|
11
|
+
import generateStyle from './utils/generateStyle';
|
|
10
12
|
|
|
11
13
|
const TabItems = ({
|
|
12
14
|
tabItems,
|
|
@@ -15,52 +17,51 @@ const TabItems = ({
|
|
|
15
17
|
orientation,
|
|
16
18
|
customTheme = {},
|
|
17
19
|
}) => {
|
|
18
|
-
const
|
|
20
|
+
const generatedStyle = generateStyle();
|
|
21
|
+
const useStyles = makeStyles(generatedStyle);
|
|
22
|
+
const classes = useStyles();
|
|
23
|
+
|
|
24
|
+
const getTabLabel = ({
|
|
19
25
|
name, count, clsName, index,
|
|
20
26
|
}) => (
|
|
21
27
|
<>
|
|
22
28
|
<span>
|
|
23
29
|
{name}
|
|
24
30
|
{count && (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
<span
|
|
32
|
+
className={`index_${index} ${clsName}_count`}
|
|
33
|
+
>
|
|
34
|
+
{count}
|
|
35
|
+
</span>
|
|
30
36
|
)}
|
|
31
37
|
</span>
|
|
32
38
|
</>
|
|
33
39
|
);
|
|
34
40
|
|
|
35
|
-
const
|
|
41
|
+
const CustomTab = tabItems.map((tab, index) => {
|
|
42
|
+
const { title: tooltipTitle, ...tooltipProps } = tab.tooltipConfig || {};
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<ToolTip
|
|
44
|
+
return (
|
|
45
|
+
(
|
|
46
|
+
<ToolTip
|
|
47
|
+
key={`tab_${index}_${tab.name}`}
|
|
48
|
+
title={tooltipTitle || ''}
|
|
49
|
+
classes={{
|
|
50
|
+
tooltip: classes.customTooltip,
|
|
51
|
+
arrow: classes.customArrow,
|
|
52
|
+
}}
|
|
53
|
+
{...tooltipProps}
|
|
54
|
+
>
|
|
40
55
|
<Tab
|
|
41
56
|
index={index}
|
|
42
|
-
label={
|
|
43
|
-
getTabLalbel({ ...tab, index })
|
|
44
|
-
}
|
|
45
|
-
key={index}
|
|
57
|
+
label={getTabLabel({ ...tab, index })}
|
|
46
58
|
className={tab.clsName}
|
|
47
59
|
disableRipple
|
|
48
60
|
/>
|
|
49
61
|
</ToolTip>
|
|
50
62
|
)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
index={index}
|
|
54
|
-
label={
|
|
55
|
-
getTabLalbel({ ...tab, index })
|
|
56
|
-
}
|
|
57
|
-
key={index}
|
|
58
|
-
className={tab.clsName}
|
|
59
|
-
disableRipple
|
|
60
|
-
/>
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
));
|
|
63
|
+
);
|
|
64
|
+
});
|
|
64
65
|
|
|
65
66
|
const themeConfig = createTheme({ overrides: { ...defaultTheme(), ...customTheme } });
|
|
66
67
|
return (
|
|
@@ -71,7 +72,7 @@ const TabItems = ({
|
|
|
71
72
|
TabIndicatorProps={{ style: { background: 'none' } }}
|
|
72
73
|
orientation={orientation}
|
|
73
74
|
>
|
|
74
|
-
{
|
|
75
|
+
{CustomTab}
|
|
75
76
|
</Tabs>
|
|
76
77
|
</ThemeProvider>
|
|
77
78
|
);
|
package/src/tabsStyle.js
CHANGED
|
@@ -1,44 +1,17 @@
|
|
|
1
1
|
const tabsStyle = {
|
|
2
2
|
tabsContainer: {},
|
|
3
|
-
muiTabs: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
overflow: 'visible !important',
|
|
10
|
-
},
|
|
11
|
-
indicator: {
|
|
12
|
-
display: 'none',
|
|
13
|
-
},
|
|
3
|
+
muiTabs: {},
|
|
4
|
+
muiTab: {},
|
|
5
|
+
tabsLabel: {},
|
|
6
|
+
tabsPanel: {},
|
|
7
|
+
customTooltip: {
|
|
8
|
+
border: '#03A383 1px solid',
|
|
14
9
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
height: '45px',
|
|
19
|
-
minHeight: '40px',
|
|
20
|
-
marginRight: '10px',
|
|
21
|
-
background: '#EAEAEA',
|
|
22
|
-
fontSize: '18px',
|
|
23
|
-
fontFamily: 'Raleway',
|
|
24
|
-
fontWeight: '400',
|
|
25
|
-
lineHeight: '18px',
|
|
26
|
-
paddingLeft: '5px',
|
|
27
|
-
letterSpacing: '0.25px',
|
|
28
|
-
borderTop: '1px solid black',
|
|
29
|
-
borderLeft: '1px solid black',
|
|
30
|
-
borderRight: '1px solid black',
|
|
31
|
-
'&$selected': {
|
|
32
|
-
fontWeight: 'bolder',
|
|
33
|
-
},
|
|
10
|
+
customArrow: {
|
|
11
|
+
'&::before': {
|
|
12
|
+
border: '#03A383 1px solid',
|
|
34
13
|
},
|
|
35
14
|
},
|
|
36
|
-
tabsLabel: {
|
|
37
|
-
fontFamily: 'Lato',
|
|
38
|
-
textTransform: 'capitalize',
|
|
39
|
-
fontSize: '21px',
|
|
40
|
-
},
|
|
41
|
-
tabsPanel: {},
|
|
42
15
|
};
|
|
43
16
|
|
|
44
17
|
export default tabsStyle;
|