@etsoo/react 1.4.41 → 1.4.45

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.
@@ -147,7 +147,7 @@ export function ResponsibleContainer(props) {
147
147
  ? undefined
148
148
  : containerBoxSx(paddings, showDataGrid) },
149
149
  React.createElement(Stack, null,
150
- React.createElement(Box, { ref: dimensions[0][0], className: "SearchBox" }, searchBar),
150
+ React.createElement(Box, { ref: dimensions[0][0], className: "SearchBox", sx: { height: searchBar == null ? 0 : 40 } }, searchBar),
151
151
  list),
152
152
  pullToRefresh && pullContainer && (React.createElement(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => { var _a; return (_a = state.ref) === null || _a === void 0 ? void 0 : _a.reset(); }, shouldPullToRefresh: () => {
153
153
  const container = document.querySelector(pullContainer);
@@ -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
  }
@@ -23,5 +23,5 @@ export function EditPage(props) {
23
23
  paddingTop: paddings
24
24
  } },
25
25
  isEditing && onDelete && (React.createElement(Button, { color: "primary", variant: "outlined", onClick: () => onDelete(), startIcon: React.createElement(DeleteIcon, { color: "warning" }) }, labels.delete)),
26
- React.createElement(Button, { variant: "contained", type: "submit", fullWidth: true, startIcon: React.createElement(SaveIcon, null), sx: { flexGrow: 1 } }, labels.save)))));
26
+ React.createElement(Button, { variant: "contained", type: "submit", startIcon: React.createElement(SaveIcon, null), sx: { flexGrow: 1 } }, labels.save)))));
27
27
  }
@@ -23,9 +23,9 @@ export function ResponsivePage(props) {
23
23
  const half = MUGlobal.half(paddings);
24
24
  // .SearchBox keep the same to avoid flick when switching between DataGrid and List
25
25
  return {
26
+ paddingTop: paddings,
26
27
  '& .SearchBox': {
27
28
  marginLeft: paddings,
28
- marginTop: paddings,
29
29
  marginRight: paddings,
30
30
  marginBottom: half
31
31
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.4.41",
3
+ "version": "1.4.45",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "@emotion/react": "^11.7.1",
51
51
  "@emotion/style": "^0.8.0",
52
52
  "@emotion/styled": "^11.6.0",
53
- "@etsoo/appscript": "^1.2.22",
53
+ "@etsoo/appscript": "^1.2.24",
54
54
  "@etsoo/notificationbase": "^1.1.0",
55
55
  "@etsoo/shared": "^1.1.3",
56
56
  "@mui/icons-material": "^5.2.5",
@@ -91,7 +91,7 @@
91
91
  "eslint-plugin-react": "^7.28.0",
92
92
  "jest": "^27.4.7",
93
93
  "react-test-renderer": "^17.0.2",
94
- "ts-jest": "^27.1.2",
94
+ "ts-jest": "^27.1.3",
95
95
  "typescript": "^4.5.4"
96
96
  }
97
97
  }
@@ -349,7 +349,11 @@ export function ResponsibleContainer<
349
349
  }
350
350
  >
351
351
  <Stack>
352
- <Box ref={dimensions[0][0]} className="SearchBox">
352
+ <Box
353
+ ref={dimensions[0][0]}
354
+ className="SearchBox"
355
+ sx={{ height: searchBar == null ? 0 : 40 }}
356
+ >
353
357
  {searchBar}
354
358
  </Box>
355
359
  {list}
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>
@@ -86,7 +86,6 @@ export function EditPage(props: EditPageProps) {
86
86
  <Button
87
87
  variant="contained"
88
88
  type="submit"
89
- fullWidth
90
89
  startIcon={<SaveIcon />}
91
90
  sx={{ flexGrow: 1 }}
92
91
  >
@@ -40,9 +40,9 @@ export function ResponsivePage<
40
40
 
41
41
  // .SearchBox keep the same to avoid flick when switching between DataGrid and List
42
42
  return {
43
+ paddingTop: paddings,
43
44
  '& .SearchBox': {
44
45
  marginLeft: paddings,
45
- marginTop: paddings,
46
46
  marginRight: paddings,
47
47
  marginBottom: half
48
48
  },