@etsoo/react 1.4.42 → 1.4.43

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.
@@ -12,6 +12,10 @@ export interface TabBoxPanel extends Omit<TabProps, 'value' | 'children'> {
12
12
  * Panel box props
13
13
  */
14
14
  panel?: Omit<BoxProps, 'hidden'>;
15
+ /**
16
+ * To URL
17
+ */
18
+ to?: string;
15
19
  }
16
20
  /**
17
21
  * Tabs with box props
package/lib/mu/TabBox.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Utils } from '@etsoo/shared';
2
2
  import { Box, Tab, Tabs } from '@mui/material';
3
+ import { Link } from '@reach/router';
3
4
  import React from 'react';
4
5
  /**
5
6
  * Tabs with box
@@ -25,6 +26,6 @@ export function TabBox(props) {
25
26
  setValue(newValue);
26
27
  if (onChange)
27
28
  onChange(event, newValue);
28
- }, ...rest }, tabs.map(({ children, panel, ...tabRest }, index) => (React.createElement(Tab, { key: index, value: index, ...tabRest }))))),
29
+ }, ...rest }, tabs.map(({ children, panel, ...tabRest }, index) => (React.createElement(Tab, { key: index, value: index, LinkComponent: tabRest.to ? Link : undefined, ...tabRest }))))),
29
30
  tabs.map(({ children, panel }, index) => (React.createElement(Box, { key: index, hidden: value !== index, ...panel }, Utils.getResult(children, value === index))))));
30
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.42",
3
+ "version": "1.4.43",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/mu/TabBox.tsx CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Utils } from '@etsoo/shared';
2
2
  import { Box, BoxProps, Tab, TabProps, Tabs, TabsProps } from '@mui/material';
3
+ import { Link } from '@reach/router';
3
4
  import React from 'react';
4
5
 
5
6
  /**
@@ -15,6 +16,11 @@ export interface TabBoxPanel extends Omit<TabProps, 'value' | 'children'> {
15
16
  * Panel box props
16
17
  */
17
18
  panel?: Omit<BoxProps, 'hidden'>;
19
+
20
+ /**
21
+ * To URL
22
+ */
23
+ to?: string;
18
24
  }
19
25
 
20
26
  /**
@@ -93,7 +99,12 @@ export function TabBox(props: TabBoxPros) {
93
99
  {...rest}
94
100
  >
95
101
  {tabs.map(({ children, panel, ...tabRest }, index) => (
96
- <Tab key={index} value={index} {...tabRest} />
102
+ <Tab
103
+ key={index}
104
+ value={index}
105
+ LinkComponent={tabRest.to ? Link : undefined}
106
+ {...tabRest}
107
+ />
97
108
  ))}
98
109
  </Tabs>
99
110
  </Box>