@availity/mui-card 0.2.6 → 0.2.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.2.7](https://github.com/Availity/element/compare/@availity/mui-card@0.2.6...@availity/mui-card@0.2.7) (2023-12-14)
6
+
5
7
  ## [0.2.6](https://github.com/Availity/element/compare/@availity/mui-card@0.2.5...@availity/mui-card@0.2.6) (2023-12-04)
6
8
 
7
9
  ### Dependency Updates
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare const CardContent: ({ children, ...rest }: CardContentProps) => JSX.Elem
23
23
  interface CardHeaderProps extends Omit<CardHeaderProps$1, 'avatar'> {
24
24
  children?: React.ReactNode;
25
25
  }
26
- declare const CardHeader: ({ ...rest }: CardHeaderProps) => JSX.Element;
26
+ declare const CardHeader: ({ titleTypographyProps, subheaderTypographyProps, ...rest }: CardHeaderProps) => JSX.Element;
27
27
 
28
28
  interface CardMediaProps extends CardMediaProps$1 {
29
29
  children?: React.ReactNode;
package/dist/index.js CHANGED
@@ -71,13 +71,24 @@ var CardContent = ({ children, ...rest }) => {
71
71
  };
72
72
 
73
73
  // src/lib/CardHeader.tsx
74
+ var import_styles = require("@mui/material/styles");
74
75
  var import_material5 = require("@mui/material");
75
76
  var import_jsx_runtime = require("react/jsx-runtime");
76
- var CardHeader = ({ ...rest }) => {
77
+ var CardHeader = ({
78
+ titleTypographyProps,
79
+ subheaderTypographyProps,
80
+ ...rest
81
+ }) => {
82
+ var _a, _b, _c, _d;
83
+ const theme = (0, import_styles.useTheme)();
84
+ const titleVariant = (_d = (_c = (_b = (_a = theme.components) == null ? void 0 : _a.MuiCardHeader) == null ? void 0 : _b.defaultProps) == null ? void 0 : _c.titleTypographyProps) == null ? void 0 : _d.variant;
77
85
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material5.CardHeader, {
78
86
  ...rest,
79
- titleTypographyProps: { variant: "h6" },
80
- subheaderTypographyProps: { variant: "subtitle2" }
87
+ titleTypographyProps: {
88
+ variant: titleVariant,
89
+ ...titleTypographyProps
90
+ },
91
+ subheaderTypographyProps: { variant: "subtitle2", ...subheaderTypographyProps }
81
92
  });
82
93
  };
83
94
 
package/dist/index.mjs CHANGED
@@ -40,13 +40,24 @@ var CardContent = ({ children, ...rest }) => {
40
40
  };
41
41
 
42
42
  // src/lib/CardHeader.tsx
43
+ import { useTheme } from "@mui/material/styles";
43
44
  import { CardHeader as MuiCardHeader } from "@mui/material";
44
45
  import { jsx as jsx5 } from "react/jsx-runtime";
45
- var CardHeader = ({ ...rest }) => {
46
+ var CardHeader = ({
47
+ titleTypographyProps,
48
+ subheaderTypographyProps,
49
+ ...rest
50
+ }) => {
51
+ var _a, _b, _c, _d;
52
+ const theme = useTheme();
53
+ const titleVariant = (_d = (_c = (_b = (_a = theme.components) == null ? void 0 : _a.MuiCardHeader) == null ? void 0 : _b.defaultProps) == null ? void 0 : _c.titleTypographyProps) == null ? void 0 : _d.variant;
46
54
  return /* @__PURE__ */ jsx5(MuiCardHeader, {
47
55
  ...rest,
48
- titleTypographyProps: { variant: "h6" },
49
- subheaderTypographyProps: { variant: "subtitle2" }
56
+ titleTypographyProps: {
57
+ variant: titleVariant,
58
+ ...titleTypographyProps
59
+ },
60
+ subheaderTypographyProps: { variant: "subtitle2", ...subheaderTypographyProps }
50
61
  });
51
62
  };
52
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-card",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Availity MUI Card Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -1,15 +1,31 @@
1
+ import { useTheme } from '@mui/material/styles';
1
2
  import { CardHeader as MuiCardHeader, CardHeaderProps as MuiCardHeaderProps } from '@mui/material';
2
3
 
3
4
  export interface CardHeaderProps extends Omit<MuiCardHeaderProps, 'avatar'> {
4
5
  children?: React.ReactNode;
5
6
  }
6
7
 
7
- export const CardHeader = ({ ...rest }: CardHeaderProps): JSX.Element => {
8
+ export const CardHeader = ({
9
+ titleTypographyProps,
10
+ subheaderTypographyProps,
11
+ ...rest
12
+ }: CardHeaderProps): JSX.Element => {
13
+ const theme = useTheme();
14
+
15
+ /**
16
+ * This is ugly, but it allows us to define a default variant while retaining the rest of the
17
+ * titleTypographyProps that the user passed.
18
+ */
19
+ const titleVariant = theme.components?.MuiCardHeader?.defaultProps?.titleTypographyProps?.variant;
20
+
8
21
  return (
9
22
  <MuiCardHeader
10
23
  {...rest}
11
- titleTypographyProps={{ variant: 'h6' }}
12
- subheaderTypographyProps={{ variant: 'subtitle2' }}
24
+ titleTypographyProps={{
25
+ variant: titleVariant,
26
+ ...titleTypographyProps,
27
+ }}
28
+ subheaderTypographyProps={{ variant: 'subtitle2', ...subheaderTypographyProps }}
13
29
  />
14
30
  );
15
31
  };