@carrier-dpx/air-react-library 0.7.13 → 0.7.15
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/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import figma from "@figma/code-connect";
|
|
8
8
|
import AppBar from "./AppBar";
|
|
9
|
-
import
|
|
9
|
+
import Toolbar from "../Toolbar";
|
|
10
10
|
import IconButton from "@mui/material/IconButton";
|
|
11
11
|
import Typography from "../Typography";
|
|
12
12
|
import Button from "../Button";
|
|
@@ -52,32 +52,21 @@ figma.connect(
|
|
|
52
52
|
* Maps Figma's "elevation" boolean property to React's "elevation" prop
|
|
53
53
|
*/
|
|
54
54
|
elevation: figma.boolean("elevation"),
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* POSITION
|
|
58
|
-
* AppBar position prop (optional)
|
|
59
|
-
*/
|
|
60
|
-
position: figma.enum("position", {
|
|
61
|
-
static: "static",
|
|
62
|
-
fixed: "fixed",
|
|
63
|
-
absolute: "absolute",
|
|
64
|
-
sticky: "sticky",
|
|
65
|
-
relative: "relative",
|
|
66
|
-
}),
|
|
67
55
|
},
|
|
68
56
|
|
|
69
57
|
/**
|
|
70
58
|
* CODE EXAMPLE TEMPLATE
|
|
71
59
|
*
|
|
72
60
|
* Shows how AppBar should be used with Toolbar and content
|
|
61
|
+
* Note: position is set to "static" by default (not mapped from Figma)
|
|
73
62
|
*/
|
|
74
|
-
example: ({ size, color, divider, elevation
|
|
63
|
+
example: ({ size, color, divider, elevation }) => (
|
|
75
64
|
<AppBar
|
|
76
65
|
size={size}
|
|
77
66
|
color={color}
|
|
78
67
|
divider={divider}
|
|
79
68
|
elevation={elevation}
|
|
80
|
-
position=
|
|
69
|
+
position="static"
|
|
81
70
|
>
|
|
82
71
|
<Toolbar>
|
|
83
72
|
<IconButton
|
|
@@ -50,6 +50,8 @@ const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
const appBarHeight = getHeight();
|
|
54
|
+
|
|
53
55
|
return (
|
|
54
56
|
<MuiAppBar
|
|
55
57
|
{...rest}
|
|
@@ -58,7 +60,10 @@ const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
|
|
|
58
60
|
sx={(theme) =>
|
|
59
61
|
({
|
|
60
62
|
...getSxStyles(theme, sx),
|
|
61
|
-
height:
|
|
63
|
+
height: appBarHeight,
|
|
64
|
+
display: "flex",
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
justifyContent: "center",
|
|
62
67
|
...(divider && {
|
|
63
68
|
borderBottom: `1px solid ${theme.palette.divider}`,
|
|
64
69
|
}),
|
|
@@ -82,6 +87,13 @@ const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
|
|
|
82
87
|
backgroundColor: theme.palette.base?.dark,
|
|
83
88
|
color: theme.palette.base?.contrastText,
|
|
84
89
|
}),
|
|
90
|
+
// Ensure Toolbar inside matches AppBar height and centers content
|
|
91
|
+
"& .MuiToolbar-root": {
|
|
92
|
+
minHeight: appBarHeight,
|
|
93
|
+
height: appBarHeight,
|
|
94
|
+
display: "flex",
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
},
|
|
85
97
|
} as CSSObject)
|
|
86
98
|
}
|
|
87
99
|
ref={ref}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
|
|
3
|
+
import MuiToolbar, {
|
|
4
|
+
ToolbarProps as MuiToolbarProps,
|
|
5
|
+
} from "@mui/material/Toolbar";
|
|
6
|
+
|
|
7
|
+
export interface ToolbarProps extends MuiToolbarProps {}
|
|
8
|
+
|
|
9
|
+
/** Toolbar
|
|
10
|
+
*
|
|
11
|
+
* `import Toolbar from '@carrier-dpx/air-react-library/Toolbar'`
|
|
12
|
+
* `import { Toolbar } from '@carrier-dpx/air-react-library'`
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>((props, ref) => {
|
|
16
|
+
return <MuiToolbar {...props} ref={ref} />;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
Toolbar.displayName = "Toolbar";
|
|
20
|
+
|
|
21
|
+
export default Toolbar;
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,8 @@ export type { BottomNavigationProps } from "./components/BottomNavigation";
|
|
|
24
24
|
export type { BottomNavigationActionProps } from "./components/BottomNavigation/BottomNavigationAction";
|
|
25
25
|
export { default as AppBar } from "./components/AppBar";
|
|
26
26
|
export type { AppBarProps } from "./components/AppBar";
|
|
27
|
+
export { default as Toolbar } from "./components/Toolbar";
|
|
28
|
+
export type { ToolbarProps } from "./components/Toolbar";
|
|
27
29
|
export * from "./components/theme";
|
|
28
30
|
|
|
29
31
|
// Demo Icons - exported from main index to avoid deep-path imports
|