@aglyn/shared-ui-jsx 1.0.0-beta.250 → 1.0.0-beta.252
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-jsx",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.252",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.252",
|
|
29
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.252",
|
|
30
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.252",
|
|
31
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.252",
|
|
32
32
|
"@mdi/js": "^7.4.47",
|
|
33
33
|
"@swc/helpers": "0.5.23",
|
|
34
34
|
"change-case": "^5.4.4",
|
|
@@ -21,6 +21,11 @@ export interface CardDisplayProps extends CardProps {
|
|
|
21
21
|
contentGutterY?: boolean;
|
|
22
22
|
contentBordered?: 'all' | 'top' | 'bottom' | undefined;
|
|
23
23
|
headerCentered?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Fill the grid cell: as tall as the tallest card in its row, with the
|
|
26
|
+
* actions along the bottom. For a row of tiles (`GridItems masonry={false}`).
|
|
27
|
+
*/
|
|
28
|
+
fullHeight?: boolean;
|
|
24
29
|
header?: JSX.Children;
|
|
25
30
|
subheader?: JSX.Children;
|
|
26
31
|
actions?: JSX.Children;
|
|
@@ -27,8 +27,10 @@ const classKeys = generateComponentClassKeys('CardDisplay', [
|
|
|
27
27
|
'contentGutterY',
|
|
28
28
|
'headerCentered',
|
|
29
29
|
'headerBordered',
|
|
30
|
-
'actionsBordered'
|
|
30
|
+
'actionsBordered',
|
|
31
|
+
'fullHeight'
|
|
31
32
|
]);
|
|
33
|
+
/** The header's action slot, which the compact-action rule reads. */ const HEADER_ACTION = 'MuiCardHeader-action';
|
|
32
34
|
const Card = styled(MuiCard)(({ theme })=>{
|
|
33
35
|
const tv = theme.vars || theme;
|
|
34
36
|
return {
|
|
@@ -49,14 +51,41 @@ const Card = styled(MuiCard)(({ theme })=>{
|
|
|
49
51
|
*/ '.MuiCardHeader-root': {
|
|
50
52
|
fontWeight: theme.typography.fontWeightBold,
|
|
51
53
|
flexWrap: 'wrap',
|
|
52
|
-
rowGap: theme.spacing(1)
|
|
54
|
+
rowGap: theme.spacing(1),
|
|
55
|
+
/*
|
|
56
|
+
* A lone icon button or status chip (a pin, a menu, "Live") is narrow
|
|
57
|
+
* enough to share the title's row on any card, so it stays top right
|
|
58
|
+
* and the title gives way beside it instead of the action dropping
|
|
59
|
+
* under the title.
|
|
60
|
+
*/ [`&:has(> .${HEADER_ACTION} > :is(.MuiIconButton-root, .MuiChip-root):only-child)`]: {
|
|
61
|
+
flexWrap: 'nowrap',
|
|
62
|
+
'.MuiCardHeader-content': {
|
|
63
|
+
flexBasis: 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
53
66
|
},
|
|
54
67
|
'.MuiCardHeader-content': {
|
|
55
|
-
flex: `1 1 ${theme.spacing(24)}
|
|
68
|
+
flex: `1 1 ${theme.spacing(24)}`,
|
|
69
|
+
// A long title shortens inside the header (its ellipsis or its wrap)
|
|
70
|
+
// rather than shoving the avatar onto a row of its own or running past
|
|
71
|
+
// the card's edge.
|
|
72
|
+
minWidth: 0
|
|
56
73
|
},
|
|
57
|
-
|
|
74
|
+
[`.${HEADER_ACTION}`]: {
|
|
58
75
|
maxWidth: '100%'
|
|
59
76
|
},
|
|
77
|
+
/*
|
|
78
|
+
* Every card in a row as tall as the row (a grid of tiles): the content
|
|
79
|
+
* takes the spare height, so each card's actions line up along the
|
|
80
|
+
* bottom.
|
|
81
|
+
*/ [`&.${classKeys.fullHeight}`]: {
|
|
82
|
+
height: '100%',
|
|
83
|
+
display: 'flex',
|
|
84
|
+
flexDirection: 'column',
|
|
85
|
+
'.MuiCardContent-root': {
|
|
86
|
+
flexGrow: 1
|
|
87
|
+
}
|
|
88
|
+
},
|
|
60
89
|
[`&.${classKeys.contentGutterX}`]: {
|
|
61
90
|
'.MuiCardContent-root': {
|
|
62
91
|
paddingLeft: theme.spacing(2),
|
|
@@ -93,7 +122,7 @@ const Card = styled(MuiCard)(({ theme })=>{
|
|
|
93
122
|
});
|
|
94
123
|
const CardDisplay = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
95
124
|
var _help_title;
|
|
96
|
-
const { actions, classes, children, className, header, subheader, disableContentWrapper, help, ActionProps, HeaderProps, ContentProps, contentGutterX, contentGutterY, headerCentered, contentBordered } = props, rest = _object_without_properties_loose(props, [
|
|
125
|
+
const { actions, classes, children, className, header, subheader, disableContentWrapper, help, ActionProps, HeaderProps, ContentProps, contentGutterX, contentGutterY, headerCentered, contentBordered, fullHeight } = props, rest = _object_without_properties_loose(props, [
|
|
97
126
|
"actions",
|
|
98
127
|
"classes",
|
|
99
128
|
"children",
|
|
@@ -108,22 +137,36 @@ const CardDisplay = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
108
137
|
"contentGutterX",
|
|
109
138
|
"contentGutterY",
|
|
110
139
|
"headerCentered",
|
|
111
|
-
"contentBordered"
|
|
140
|
+
"contentBordered",
|
|
141
|
+
"fullHeight"
|
|
112
142
|
]);
|
|
113
143
|
const headerTitle = help && header != null ? /*#__PURE__*/ _jsxs(Box, {
|
|
114
144
|
component: "span",
|
|
115
145
|
sx: {
|
|
116
146
|
display: 'inline-flex',
|
|
117
147
|
alignItems: 'center',
|
|
118
|
-
gap: 0.5
|
|
148
|
+
gap: 0.5,
|
|
149
|
+
// Never wider than the title's line, so a long title is what gives
|
|
150
|
+
// way (its ellipsis, under a `noWrap` title) and the help stays.
|
|
151
|
+
maxWidth: '100%',
|
|
152
|
+
verticalAlign: 'top'
|
|
119
153
|
},
|
|
120
154
|
children: [
|
|
121
|
-
|
|
155
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
156
|
+
component: "span",
|
|
157
|
+
sx: {
|
|
158
|
+
minWidth: 0,
|
|
159
|
+
overflow: 'hidden',
|
|
160
|
+
textOverflow: 'ellipsis'
|
|
161
|
+
},
|
|
162
|
+
children: header
|
|
163
|
+
}),
|
|
122
164
|
/*#__PURE__*/ _jsx(HelpTip, _extends({}, help, {
|
|
123
165
|
title: (_help_title = help.title) != null ? _help_title : typeof header === 'string' ? header : undefined,
|
|
124
166
|
sx: {
|
|
125
167
|
fontSize: '0.8em',
|
|
126
|
-
my: -0.5
|
|
168
|
+
my: -0.5,
|
|
169
|
+
flexShrink: 0
|
|
127
170
|
}
|
|
128
171
|
}))
|
|
129
172
|
]
|
|
@@ -136,7 +179,8 @@ const CardDisplay = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
136
179
|
[classKeys.contentGutterY]: Boolean(contentGutterY),
|
|
137
180
|
[classKeys.headerBordered]: Boolean(allBordered || headerBordered),
|
|
138
181
|
[classKeys.actionsBordered]: Boolean(allBordered || actionsBordered),
|
|
139
|
-
[classKeys.headerCentered]: Boolean(headerCentered)
|
|
182
|
+
[classKeys.headerCentered]: Boolean(headerCentered),
|
|
183
|
+
[classKeys.fullHeight]: Boolean(fullHeight)
|
|
140
184
|
}, className);
|
|
141
185
|
return /*#__PURE__*/ _jsx(Card, _extends({
|
|
142
186
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/components/card-display.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorBoundaryComponent } from './error-boundary.component'\nimport { HelpTip, type HelpTipContent } from './help-tip.component'\nimport { generateComponentClassKeys, styled } from '@aglyn/shared-ui-theme'\nimport {\n Box,\n Card as MuiCard,\n CardActions as MuiCardActions,\n type CardActionsProps,\n CardContent as MuiCardContent,\n type CardContentProps,\n CardHeader as MuiCardHeader,\n type CardHeaderProps,\n type CardProps,\n} from '@mui/material'\nimport clsx from 'clsx'\nimport { forwardRef } from 'react'\n\nconst classKeys = generateComponentClassKeys('CardDisplay', [\n 'contentGutterX',\n 'contentGutterY',\n 'headerCentered',\n 'headerBordered',\n 'actionsBordered',\n])\n\nconst Card = styled(MuiCard)(({ theme }) => {\n const tv = (theme as any).vars || theme\n return {\n '.MuiCardContent-root': {\n padding: 0,\n borderWidth: 0,\n borderStyle: 'solid',\n borderColor: tv.palette.divider,\n ':last-of-type': {\n paddingBottom: 'initial',\n },\n },\n /*\n * A header action wider than the room beside the title wraps onto its own\n * line under it, instead of pushing past the card's edge where the card's\n * `overflow: hidden` clips it (AGL-3311). The title keeps a floor so a\n * short action still sits beside it, top right.\n */\n '.MuiCardHeader-root': {\n fontWeight: theme.typography.fontWeightBold,\n flexWrap: 'wrap',\n rowGap: theme.spacing(1),\n },\n '.MuiCardHeader-content': {\n flex: `1 1 ${theme.spacing(24)}`,\n },\n '.MuiCardHeader-action': {\n maxWidth: '100%',\n },\n [`&.${classKeys.contentGutterX}`]: {\n '.MuiCardContent-root': {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('md')]: {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n },\n },\n [`&.${classKeys.contentGutterY}`]: {\n '.MuiCardContent-root': {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n },\n [`&.${classKeys.headerCentered}`]: {\n '.MuiCardHeader-root': {\n marginBottom: theme.spacing(-1),\n alignSelf: 'center',\n },\n },\n [`&.${classKeys.headerBordered}`]: {\n '.MuiCardContent-root': {\n borderTopWidth: 1,\n },\n },\n [`&.${classKeys.actionsBordered}`]: {\n '.MuiCardContent-root': {\n borderBottomWidth: 1,\n },\n },\n }\n})\n\nexport interface CardDisplayProps extends CardProps {\n contentGutterX?: boolean\n contentGutterY?: boolean\n contentBordered?: 'all' | 'top' | 'bottom' | undefined\n headerCentered?: boolean\n header?: JSX.Children\n subheader?: JSX.Children\n actions?: JSX.Children\n disableContentWrapper?: boolean\n /** Contextual help affordance rendered beside the header title (AGL-601). */\n help?: HelpTipContent\n HeaderProps?: CardHeaderProps\n ContentProps?: CardContentProps\n ActionProps?: CardActionsProps\n}\n\nconst CardDisplay = forwardRef<any, CardDisplayProps>((props, ref) => {\n const {\n actions,\n classes,\n children,\n className,\n header,\n subheader,\n disableContentWrapper,\n help,\n ActionProps,\n HeaderProps,\n ContentProps,\n contentGutterX,\n contentGutterY,\n headerCentered,\n contentBordered,\n ...rest\n } = props\n\n const headerTitle =\n help && header != null ? (\n <Box\n component=\"span\"\n sx={{ display: 'inline-flex', alignItems: 'center', gap: 0.5 }}\n >\n {header}\n <HelpTip\n {...help}\n title={help.title ?? (typeof header === 'string' ? header : undefined)}\n sx={{ fontSize: '0.8em', my: -0.5 }}\n />\n </Box>\n ) : (\n header\n )\n\n const allBordered = contentBordered === 'all'\n const headerBordered = contentBordered === 'top'\n const actionsBordered = contentBordered === 'bottom'\n\n const cardClassName = clsx(\n {\n [classKeys.contentGutterX]: Boolean(contentGutterX),\n [classKeys.contentGutterY]: Boolean(contentGutterY),\n [classKeys.headerBordered]: Boolean(allBordered || headerBordered),\n [classKeys.actionsBordered]: Boolean(allBordered || actionsBordered),\n [classKeys.headerCentered]: Boolean(headerCentered),\n },\n className,\n )\n\n return (\n <Card ref={ref} className={cardClassName} {...rest}>\n <ErrorBoundaryComponent>\n {header || HeaderProps || subheader ? (\n <MuiCardHeader\n title={headerTitle}\n subheader={subheader}\n slotProps={{ title: { variant: 'h6', component: 'div' } }}\n {...HeaderProps}\n />\n ) : null}\n {disableContentWrapper ? (\n children\n ) : children || ContentProps ? (\n <MuiCardContent {...ContentProps}>\n {ContentProps?.children || children}\n </MuiCardContent>\n ) : null}\n {actions || ActionProps ? (\n <MuiCardActions {...ActionProps}>\n {ActionProps?.children || actions}\n </MuiCardActions>\n ) : null}\n </ErrorBoundaryComponent>\n </Card>\n )\n})\n\nCardDisplay.displayName = 'CardDisplayComponent'\n\nexport { CardDisplay }\nexport default CardDisplay\n"],"names":["ErrorBoundaryComponent","HelpTip","generateComponentClassKeys","styled","Box","Card","MuiCard","CardActions","MuiCardActions","CardContent","MuiCardContent","CardHeader","MuiCardHeader","clsx","forwardRef","classKeys","theme","tv","vars","padding","borderWidth","borderStyle","borderColor","palette","divider","paddingBottom","fontWeight","typography","fontWeightBold","flexWrap","rowGap","spacing","flex","maxWidth","contentGutterX","paddingLeft","paddingRight","breakpoints","up","contentGutterY","paddingTop","headerCentered","marginBottom","alignSelf","headerBordered","borderTopWidth","actionsBordered","borderBottomWidth","CardDisplay","props","ref","help","actions","classes","children","className","header","subheader","disableContentWrapper","ActionProps","HeaderProps","ContentProps","contentBordered","rest","headerTitle","component","sx","display","alignItems","gap","title","undefined","fontSize","my","allBordered","cardClassName","Boolean","slotProps","variant","displayName"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,QAAQ,gCAA4B;AACnE,SAASC,OAAO,QAA6B,0BAAsB;AACnE,S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EgC,QAAQF,eAAe9B;QACnD,CAAC7B,UAAU+B,eAAe,CAAC,EAAE8B,QAAQF,eAAe5B;QACpD,CAAC/B,UAAU0B,cAAc,CAAC,EAAEmC,QAAQnC;IACtC,GACAc;IAGF,qBACE,KAAClD;QAAK6C,KAAKA;QAAKK,WAAWoB;OAAmBZ;kBAC5C,cAAA,MAAC/D;;gBACEwD,UAAUI,eAAeH,0BACxB,KAAC7C;oBACC0D,OAAON;oBACPP,WAAWA;oBACXoB,WAAW;wBAAEP,OAAO;4BAAEQ,SAAS;4BAAMb,WAAW;wBAAM;oBAAE;mBACpDL,gBAEJ;gBACHF,wBACCJ,WACEA,YAAYO,6BACd,KAACnD,6BAAmBmD;8BACjBA,CAAAA,gCAAAA,aAAcP,QAAQ,KAAIA;sBAE3B;gBACHF,WAAWO,4BACV,KAACnD,6BAAmBmD;8BACjBA,CAAAA,+BAAAA,YAAaL,QAAQ,KAAIF;sBAE1B;;;;AAIZ;AAEAJ,YAAY+B,WAAW,GAAG;AAE1B,SAAS/B,WAAW,GAAE;AACtB,eAAeA,YAAW"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/components/card-display.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2022 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErrorBoundaryComponent } from './error-boundary.component'\nimport { HelpTip, type HelpTipContent } from './help-tip.component'\nimport { generateComponentClassKeys, styled } from '@aglyn/shared-ui-theme'\nimport {\n Box,\n Card as MuiCard,\n CardActions as MuiCardActions,\n type CardActionsProps,\n CardContent as MuiCardContent,\n type CardContentProps,\n CardHeader as MuiCardHeader,\n type CardHeaderProps,\n type CardProps,\n} from '@mui/material'\nimport clsx from 'clsx'\nimport { forwardRef } from 'react'\n\nconst classKeys = generateComponentClassKeys('CardDisplay', [\n 'contentGutterX',\n 'contentGutterY',\n 'headerCentered',\n 'headerBordered',\n 'actionsBordered',\n 'fullHeight',\n])\n\n/** The header's action slot, which the compact-action rule reads. */\nconst HEADER_ACTION = 'MuiCardHeader-action'\n\nconst Card = styled(MuiCard)(({ theme }) => {\n const tv = (theme as any).vars || theme\n return {\n '.MuiCardContent-root': {\n padding: 0,\n borderWidth: 0,\n borderStyle: 'solid',\n borderColor: tv.palette.divider,\n ':last-of-type': {\n paddingBottom: 'initial',\n },\n },\n /*\n * A header action wider than the room beside the title wraps onto its own\n * line under it, instead of pushing past the card's edge where the card's\n * `overflow: hidden` clips it (AGL-3311). The title keeps a floor so a\n * short action still sits beside it, top right.\n */\n '.MuiCardHeader-root': {\n fontWeight: theme.typography.fontWeightBold,\n flexWrap: 'wrap',\n rowGap: theme.spacing(1),\n /*\n * A lone icon button or status chip (a pin, a menu, \"Live\") is narrow\n * enough to share the title's row on any card, so it stays top right\n * and the title gives way beside it instead of the action dropping\n * under the title.\n */\n [`&:has(> .${HEADER_ACTION} > :is(.MuiIconButton-root, .MuiChip-root):only-child)`]:\n {\n flexWrap: 'nowrap',\n '.MuiCardHeader-content': {\n flexBasis: 0,\n },\n },\n },\n '.MuiCardHeader-content': {\n flex: `1 1 ${theme.spacing(24)}`,\n // A long title shortens inside the header (its ellipsis or its wrap)\n // rather than shoving the avatar onto a row of its own or running past\n // the card's edge.\n minWidth: 0,\n },\n [`.${HEADER_ACTION}`]: {\n maxWidth: '100%',\n },\n /*\n * Every card in a row as tall as the row (a grid of tiles): the content\n * takes the spare height, so each card's actions line up along the\n * bottom.\n */\n [`&.${classKeys.fullHeight}`]: {\n height: '100%',\n display: 'flex',\n flexDirection: 'column',\n '.MuiCardContent-root': {\n flexGrow: 1,\n },\n },\n [`&.${classKeys.contentGutterX}`]: {\n '.MuiCardContent-root': {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n [theme.breakpoints.up('md')]: {\n paddingLeft: theme.spacing(2),\n paddingRight: theme.spacing(2),\n },\n },\n },\n [`&.${classKeys.contentGutterY}`]: {\n '.MuiCardContent-root': {\n paddingTop: theme.spacing(2),\n paddingBottom: theme.spacing(2),\n },\n },\n [`&.${classKeys.headerCentered}`]: {\n '.MuiCardHeader-root': {\n marginBottom: theme.spacing(-1),\n alignSelf: 'center',\n },\n },\n [`&.${classKeys.headerBordered}`]: {\n '.MuiCardContent-root': {\n borderTopWidth: 1,\n },\n },\n [`&.${classKeys.actionsBordered}`]: {\n '.MuiCardContent-root': {\n borderBottomWidth: 1,\n },\n },\n }\n})\n\nexport interface CardDisplayProps extends CardProps {\n contentGutterX?: boolean\n contentGutterY?: boolean\n contentBordered?: 'all' | 'top' | 'bottom' | undefined\n headerCentered?: boolean\n /**\n * Fill the grid cell: as tall as the tallest card in its row, with the\n * actions along the bottom. For a row of tiles (`GridItems masonry={false}`).\n */\n fullHeight?: boolean\n header?: JSX.Children\n subheader?: JSX.Children\n actions?: JSX.Children\n disableContentWrapper?: boolean\n /** Contextual help affordance rendered beside the header title (AGL-601). */\n help?: HelpTipContent\n HeaderProps?: CardHeaderProps\n ContentProps?: CardContentProps\n ActionProps?: CardActionsProps\n}\n\nconst CardDisplay = forwardRef<any, CardDisplayProps>((props, ref) => {\n const {\n actions,\n classes,\n children,\n className,\n header,\n subheader,\n disableContentWrapper,\n help,\n ActionProps,\n HeaderProps,\n ContentProps,\n contentGutterX,\n contentGutterY,\n headerCentered,\n contentBordered,\n fullHeight,\n ...rest\n } = props\n\n const headerTitle =\n help && header != null ? (\n <Box\n component=\"span\"\n sx={{\n display: 'inline-flex',\n alignItems: 'center',\n gap: 0.5,\n // Never wider than the title's line, so a long title is what gives\n // way (its ellipsis, under a `noWrap` title) and the help stays.\n maxWidth: '100%',\n verticalAlign: 'top',\n }}\n >\n <Box\n component=\"span\"\n sx={{ minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis' }}\n >\n {header}\n </Box>\n <HelpTip\n {...help}\n title={help.title ?? (typeof header === 'string' ? header : undefined)}\n sx={{ fontSize: '0.8em', my: -0.5, flexShrink: 0 }}\n />\n </Box>\n ) : (\n header\n )\n\n const allBordered = contentBordered === 'all'\n const headerBordered = contentBordered === 'top'\n const actionsBordered = contentBordered === 'bottom'\n\n const cardClassName = clsx(\n {\n [classKeys.contentGutterX]: Boolean(contentGutterX),\n [classKeys.contentGutterY]: Boolean(contentGutterY),\n [classKeys.headerBordered]: Boolean(allBordered || headerBordered),\n [classKeys.actionsBordered]: Boolean(allBordered || actionsBordered),\n [classKeys.headerCentered]: Boolean(headerCentered),\n [classKeys.fullHeight]: Boolean(fullHeight),\n },\n className,\n )\n\n return (\n <Card ref={ref} className={cardClassName} {...rest}>\n <ErrorBoundaryComponent>\n {header || HeaderProps || subheader ? (\n <MuiCardHeader\n title={headerTitle}\n subheader={subheader}\n slotProps={{ title: { variant: 'h6', component: 'div' } }}\n {...HeaderProps}\n />\n ) : null}\n {disableContentWrapper ? (\n children\n ) : children || ContentProps ? (\n <MuiCardContent {...ContentProps}>\n {ContentProps?.children || children}\n </MuiCardContent>\n ) : null}\n {actions || ActionProps ? (\n <MuiCardActions {...ActionProps}>\n {ActionProps?.children || actions}\n </MuiCardActions>\n ) : null}\n </ErrorBoundaryComponent>\n </Card>\n )\n})\n\nCardDisplay.displayName = 'CardDisplayComponent'\n\nexport { CardDisplay }\nexport default CardDisplay\n"],"names":["ErrorBoundaryComponent","HelpTip","generateComponentClassKeys","styled","Box","Card","MuiCard","CardActions","MuiCardActions","CardContent","MuiCardContent","CardHeader","MuiCardHeader","clsx","forwardRef","classKeys","HEADER_ACTION","theme","tv","vars","padding","borderWidth","borderStyle","borderColor","palette","divider","paddingBottom","fontWeight","typography","fontWeightBold","flexWrap","rowGap","spacing","flexBasis","flex","minWidth","maxWidth","fullHeight","height","display","flexDirection","flexGrow","contentGutterX","paddingLeft","paddingRight","breakpoints","up","contentGutterY","paddingTop","headerCentered","marginBottom","alignSelf","headerBordered","borderTopWidth","actionsBordered","borderBottomWidth","CardDisplay","props","ref","help","actions","classes","children","className","header","subheader","disableContentWrapper","ActionProps","HeaderProps","ContentProps","contentBordered","rest","headerTitle","component","sx","alignItems","gap","verticalAlign","overflow","textOverflow","title","undefined","fontSize","my","flexShrink","allBordered","cardClassName","Boolean","slotProps","variant","displayName"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,QAAQ,gCAA4B;AACnE,SAASC,OAAO,QAA6B,0BAAsB;AACnE,SAASC,0BAA0B,EAAEC,MAAM,QAAQ,yBAAwB;AAC3E,SACEC,GAAG,EACHC,QAAQC,OAAO,EACfC,eAAeC,cAAc,EAE7BC,eAAeC,cAAc,EAE7BC,cAAcC,aAAa,QAGtB,gBAAe;AACtB,OAAOC,UAAU,OAAM;AACvB,SAASC,UAAU,QAAQ,QAAO;AAElC,MAAMC,YAAYb,2BAA2B,eAAe;IAC1D;IACA;IACA;IACA;IACA;IACA;CACD;AAED,mEAAmE,GACnE,MAAMc,gBAAgB;AAEtB,MAAMX,OAAOF,OAAOG,SAAS,CAAC,EAAEW,KAAK,EAAE;IACrC,MAAMC,KAAK,AAACD,MAAcE,IAAI,IAAIF;IAClC,OAAO;QACL,wBAAwB;YACtBG,SAAS;YACTC,aAAa;YACbC,aAAa;YACbC,aAAaL,GAAGM,OAAO,CAACC,OAAO;YAC/B,iBAAiB;gBACfC,eAAe;YACjB;QACF;QACA;;;;;KAKC,GACD,uBAAuB;YACrBC,YAAYV,MAAMW,UAAU,CAACC,cAAc;YAC3CC,UAAU;YACVC,QAAQd,MAAMe,OAAO,CAAC;YACtB;;;;;OAKC,GACD,CAAC,CAAC,SAAS,EAAEhB,cAAc,sDAAsD,CAAC,CAAC,EACjF;gBACEc,UAAU;gBACV,0BAA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