@fixefy/fixefy-ui-components 0.3.12 → 0.3.14

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.
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
- export interface Tab {
3
- value: string | number | boolean;
2
+ export interface FxTab {
3
+ value: string | number;
4
4
  label: string;
5
- show: boolean;
6
- maxWidth?: number | string;
7
- minWidth?: number | string;
5
+ tabContent: any;
8
6
  }
9
- export declare const FxTabs: ({ activeTab, tabsData, handleClickPOV, }: {
7
+ export declare const FxTabs: ({ activeTab, tabsData, onChange, divider, adjecentComponent, }: {
10
8
  activeTab: string;
11
- tabsData: Tab[];
12
- handleClickPOV: any;
9
+ tabsData: FxTab[];
10
+ onChange: any;
11
+ divider?: boolean;
12
+ adjecentComponent?: any;
13
13
  }) => React.JSX.Element;
@@ -10,58 +10,66 @@ Object.defineProperty(exports, "FxTabs", {
10
10
  });
11
11
  const _jsxruntime = require("react/jsx-runtime");
12
12
  const _react = /*#__PURE__*/ _interop_require_default(require("react"));
13
+ const _lab = require("@mui/lab");
13
14
  const _material = require("@mui/material");
15
+ const _fixefyuiutils = require("@fixefy/fixefy-ui-utils");
14
16
  function _interop_require_default(obj) {
15
17
  return obj && obj.__esModule ? obj : {
16
18
  default: obj
17
19
  };
18
20
  }
19
- const FxTabs = ({ activeTab, tabsData, handleClickPOV })=>{
20
- // const [activeTab, setActiveTab] = useState(tabsData[0].value)
21
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButtonGroup, {
22
- sx: {
23
- height: '40px',
24
- backgroundColor: '#fff'
25
- },
26
- color: "primary",
21
+ const FxTabs = ({ activeTab, tabsData, onChange, divider = false, adjecentComponent })=>{
22
+ const theme = (0, _material.useTheme)();
23
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_lab.TabContext, {
27
24
  value: activeTab,
28
- exclusive: true,
29
- onChange: (e, val)=>{
30
- e.preventDefault();
31
- setTimeout(()=>{
32
- // setActiveTab(val)
33
- handleClickPOV(val);
34
- }, 500);
35
- },
36
- children: tabsData.map((tab, i)=>{
37
- const { value, show, label, maxWidth, minWidth } = tab;
38
- return show && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
39
- disabled: activeTab === value,
40
- //@ts-ignore
25
+ children: [
26
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_lab.TabList, {
41
27
  sx: {
42
- '&.Mui-disabled': {
43
- border: '1px solid #568793 !important'
44
- },
45
- '&.MuiToggleButtonGroup-grouped': {
46
- borderRadius: 'inherit',
47
- maxWidth: maxWidth || '161px',
48
- minWidth: minWidth || '161px'
49
- },
50
- '&.Mui-selected': {
51
- backgroundColor: '#F1FBFE',
52
- border: '1px solid #568793'
28
+ '.MuiTabs-flexContainer': {
29
+ gap: '28px',
30
+ padding: '0 32px'
53
31
  }
54
32
  },
55
- value: value,
56
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
57
- lineHeight: '24px',
58
- fontSize: '12px',
59
- fontWeight: 500,
60
- color: 'primary',
61
- variant: "button",
62
- children: label
33
+ children: [
34
+ tabsData.map((tab, i)=>{
35
+ const { value, label } = tab;
36
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tab, {
37
+ onClick: ()=>{
38
+ onChange(value);
39
+ },
40
+ sx: {
41
+ minWidth: 'auto',
42
+ p: '0 4px',
43
+ textTransform: 'capitalize',
44
+ '&.Mui-selected': {
45
+ //@ts-ignore
46
+ color: theme.palette.primary[500],
47
+ fontWeight: 700
48
+ }
49
+ },
50
+ label: (0, _fixefyuiutils.titleCase)(label),
51
+ value: value
52
+ }, i);
53
+ }),
54
+ adjecentComponent
55
+ ]
56
+ }),
57
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
58
+ sx: {
59
+ borderTop: divider ? '1px solid #C5C8C9' : 'none',
60
+ margin: '0 32px'
61
+ },
62
+ children: tabsData.map((tab, i)=>{
63
+ const { value, tabContent } = tab;
64
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_lab.TabPanel, {
65
+ value: value,
66
+ sx: {
67
+ padding: '24px 0'
68
+ },
69
+ children: tabContent
70
+ }, i);
63
71
  })
64
- }, i);
65
- })
72
+ })
73
+ ]
66
74
  });
67
75
  };
@@ -6,8 +6,8 @@ export interface Tab {
6
6
  maxWidth?: number | string;
7
7
  minWidth?: number | string;
8
8
  }
9
- export declare const FxToggleButtons: ({ activeTab, tabsData, handleClickPOV, }: {
9
+ export declare const FxToggleButtons: ({ activeTab, tabsData, onChange, }: {
10
10
  activeTab: string;
11
11
  tabsData: Tab[];
12
- handleClickPOV: any;
12
+ onChange: any;
13
13
  }) => React.JSX.Element;
@@ -16,8 +16,7 @@ function _interop_require_default(obj) {
16
16
  default: obj
17
17
  };
18
18
  }
19
- const FxToggleButtons = ({ activeTab, tabsData, handleClickPOV })=>{
20
- // const [activeTab, setActiveTab] = useState(tabsData[0].value)
19
+ const FxToggleButtons = ({ activeTab, tabsData, onChange })=>{
21
20
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButtonGroup, {
22
21
  sx: {
23
22
  height: '40px',
@@ -29,8 +28,7 @@ const FxToggleButtons = ({ activeTab, tabsData, handleClickPOV })=>{
29
28
  onChange: (e, val)=>{
30
29
  e.preventDefault();
31
30
  setTimeout(()=>{
32
- // setActiveTab(val)
33
- handleClickPOV(val);
31
+ onChange(val);
34
32
  }, 500);
35
33
  },
36
34
  children: tabsData.map((tab, i)=>{
package/package.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "@apollo/client": "3.10.4",
8
8
  "@fixefy/fixefy-ui-utils": "0.2.45",
9
9
  "@mui/icons-material": "5.16.7",
10
+ "@mui/lab": "6.0.0-beta.7",
10
11
  "@mui/material": "5.16.7",
11
12
  "@mui/styled-engine": "5.15.14",
12
13
  "@mui/styles": "5.16.7",
@@ -65,5 +66,5 @@
65
66
  "require": "./dist/index.js"
66
67
  }
67
68
  },
68
- "version": "0.3.12"
69
+ "version": "0.3.14"
69
70
  }