@12-apps/ui 6.39.13 → 6.39.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/NATIVE.md +1 -1
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +7 -7
- package/dist/_internal/components/data-display/DataViews/DeleteViewDialog.js +3 -3
- package/dist/_internal/components/data-display/DataViews/ManageViewsDialog.js +3 -3
- package/dist/_internal/components/data-display/DataViews/SaveViewModal.js +3 -3
- package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +5 -5
- package/dist/_internal/components/feedback/Dialog/Dialog.js +2 -2
- package/dist/_internal/components/feedback/Dialog/Dialog.slots.js +10 -0
- package/dist/_internal/components/feedback/index.js +2 -2
- package/dist/_internal/components/index.js +7 -7
- package/dist/_internal/components/navigation/AppHeader/AppHeader.details.js +3 -3
- package/dist/_internal/components/navigation/NavigationMenu/NavigationMegaSection.js +2 -2
- package/dist/_internal/components/navigation/NavigationMenu/NavigationMenu.js +4 -4
- package/dist/_internal/components/navigation/NavigationMenu/NavigationMenuItem.js +1 -1
- package/dist/_internal/components/navigation/NavigationMenu/NavigationStandardBody.js +2 -2
- package/dist/_internal/components/navigation/index.js +7 -7
- package/dist/chunk-5HW37NSW.js +34 -0
- package/dist/chunk-5HW37NSW.js.map +1 -0
- package/dist/{chunk-INMKA5SF.js → chunk-ARDLCGBK.js} +3 -3
- package/dist/{chunk-VPRNKJHP.js → chunk-FBUCXTA4.js} +2 -2
- package/dist/{chunk-YHGOPZXW.js → chunk-FY6PONLA.js} +2 -2
- package/dist/{chunk-UEROWH53.js → chunk-GAMLBJE6.js} +58 -39
- package/dist/chunk-GAMLBJE6.js.map +1 -0
- package/dist/{chunk-3333KCAW.js → chunk-P22W4N5K.js} +2 -2
- package/dist/{chunk-IYF246UA.js → chunk-SA65SDOY.js} +2 -2
- package/dist/{chunk-ZNDDILNQ.js → chunk-UBEAJFMW.js} +3 -3
- package/dist/{chunk-DXZOSP6P.js → chunk-WVJGNIJZ.js} +2 -2
- package/dist/{chunk-ECIHOZPK.js → chunk-WWGD5YVW.js} +2 -2
- package/dist/{chunk-5OUEKIWQ.js → chunk-ZGWEFOW6.js} +4 -2
- package/dist/chunk-ZGWEFOW6.js.map +1 -0
- package/dist/{chunk-Y5UTYBZW.js → chunk-ZUME25DS.js} +3 -3
- package/dist/data-display/DataViews.js +7 -7
- package/dist/feedback/Dialog.js +2 -2
- package/dist/navigation/AppHeader.js +3 -3
- package/dist/navigation/NavigationMenu.js +4 -4
- package/dist/types/components/feedback/Dialog/Dialog.d.ts.map +1 -1
- package/dist/types/components/feedback/Dialog/Dialog.slots.d.ts +43 -0
- package/dist/types/components/feedback/Dialog/Dialog.slots.d.ts.map +1 -0
- package/dist/types/components/navigation/NavigationMenu/NavigationMenuItem.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/feedback/Dialog/Dialog.slots.ts +100 -0
- package/src/components/feedback/Dialog/Dialog.tsx +86 -34
- package/src/components/navigation/NavigationMenu/NavigationMenu.md +3 -1
- package/src/components/navigation/NavigationMenu/NavigationMenuItem.tsx +10 -1
- package/dist/_internal/components/feedback/Dialog/Dialog.paper.js +0 -8
- package/dist/chunk-5OUEKIWQ.js.map +0 -1
- package/dist/chunk-UEROWH53.js.map +0 -1
- package/dist/chunk-Y4O4DITI.js +0 -25
- package/dist/chunk-Y4O4DITI.js.map +0 -1
- package/dist/types/components/feedback/Dialog/Dialog.paper.d.ts +0 -31
- package/dist/types/components/feedback/Dialog/Dialog.paper.d.ts.map +0 -1
- package/src/components/feedback/Dialog/Dialog.paper.ts +0 -64
- /package/dist/_internal/components/feedback/Dialog/{Dialog.paper.js.map → Dialog.slots.js.map} +0 -0
- /package/dist/{chunk-INMKA5SF.js.map → chunk-ARDLCGBK.js.map} +0 -0
- /package/dist/{chunk-VPRNKJHP.js.map → chunk-FBUCXTA4.js.map} +0 -0
- /package/dist/{chunk-YHGOPZXW.js.map → chunk-FY6PONLA.js.map} +0 -0
- /package/dist/{chunk-3333KCAW.js.map → chunk-P22W4N5K.js.map} +0 -0
- /package/dist/{chunk-IYF246UA.js.map → chunk-SA65SDOY.js.map} +0 -0
- /package/dist/{chunk-ZNDDILNQ.js.map → chunk-UBEAJFMW.js.map} +0 -0
- /package/dist/{chunk-DXZOSP6P.js.map → chunk-WVJGNIJZ.js.map} +0 -0
- /package/dist/{chunk-ECIHOZPK.js.map → chunk-WWGD5YVW.js.map} +0 -0
- /package/dist/{chunk-Y5UTYBZW.js.map → chunk-ZUME25DS.js.map} +0 -0
|
@@ -19,6 +19,14 @@ import type { NavigationMenuItem } from './NavigationMenu.types';
|
|
|
19
19
|
import { onMedia, shadowInk, uiInk } from '../../../tokens/ink';
|
|
20
20
|
import { rem, rems, sxRem } from '../../../tokens/relative';
|
|
21
21
|
|
|
22
|
+
// A numeric or empty-string zero is treated the way the package's own Badge
|
|
23
|
+
// treats a zero count by default (`Badge.helpers.ts`'s `showZero: false`):
|
|
24
|
+
// hidden. `badge && …` prints a bare "0" text node for `badge: 0`, because
|
|
25
|
+
// `0 && …` evaluates to the falsy `0` itself rather than `false`. A caller
|
|
26
|
+
// who wants a visible zero passes the string `'0'`, which is truthy here.
|
|
27
|
+
const hasBadge = (badge: NavigationMenuItem['badge']): boolean =>
|
|
28
|
+
badge !== undefined && badge !== null && badge !== '' && badge !== 0;
|
|
29
|
+
|
|
22
30
|
const StyledListItem = styled(ListItem, {
|
|
23
31
|
shouldForwardProp: (prop) => !['variant', 'active', 'size', 'level'].includes(prop as string) })<{ variant?: string; active?: boolean; size?: string; level?: number }>(
|
|
24
32
|
({ theme, variant, level = 0 }) => ({
|
|
@@ -139,9 +147,10 @@ const MenuItemLabel: React.FC<{
|
|
|
139
147
|
opacity: 0.7,
|
|
140
148
|
transition: 'all 0.3s ease' } } }}
|
|
141
149
|
/>
|
|
142
|
-
{item.badge && (
|
|
150
|
+
{hasBadge(item.badge) && (
|
|
143
151
|
<Box
|
|
144
152
|
component="span"
|
|
153
|
+
data-testid={`navigation-menu-badge-${item.id}`}
|
|
145
154
|
sx={{
|
|
146
155
|
flexShrink: 0,
|
|
147
156
|
display: 'inline-flex',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/navigation/NavigationMenu/NavigationMenuItem.tsx"],"sourcesContent":["import ChevronRight from '@mui/icons-material/ChevronRight';\nimport ExpandMore from '@mui/icons-material/ExpandMore';\nimport Box from '@mui/material/Box/index.js';\nimport Collapse from '@mui/material/Collapse/index.js';\nimport Fade from '@mui/material/Fade/index.js';\nimport Grow from '@mui/material/Grow/index.js';\nimport List from '@mui/material/List/index.js';\nimport ListItem from '@mui/material/ListItem/index.js';\nimport ListItemButton from '@mui/material/ListItemButton/index.js';\nimport ListItemIcon from '@mui/material/ListItemIcon/index.js';\nimport ListItemText from '@mui/material/ListItemText/index.js';\nimport Popover from '@mui/material/Popover/index.js';\nimport { alpha, styled } from '@mui/material/styles/index.js';\nimport React, { } from 'react';\n\nimport { useMenuItemState } from './NavigationMenuItem.hooks';\nimport { navItemButtonStyles, pulseGlow } from './NavigationMenu.styles';\nimport type { NavigationMenuItem } from './NavigationMenu.types';\nimport { onMedia, shadowInk, uiInk } from '../../../tokens/ink';\nimport { rem, rems, sxRem } from '../../../tokens/relative';\n\nconst StyledListItem = styled(ListItem, {\n shouldForwardProp: (prop) => !['variant', 'active', 'size', 'level'].includes(prop as string) })<{ variant?: string; active?: boolean; size?: string; level?: number }>(\n ({ theme, variant, level = 0 }) => ({\n padding: 0,\n ...(variant === 'horizontal' && {\n width: 'auto' }),\n ...(level > 0 && {\n paddingLeft: theme.spacing(2 * level) }) }),\n);\n\nconst StyledListItemButton = styled(ListItemButton, {\n shouldForwardProp: (prop) => !['variant', 'active', 'size', 'collapsed', 'minimal'].includes(prop as string) })<{ variant?: string; active?: boolean; size?: string; collapsed?: boolean; minimal?: boolean }>(\n ({ theme, variant, active, size, collapsed, minimal }) => ({\n ...navItemButtonStyles({ theme, variant, active, size, collapsed, minimal }) }),\n);\n\ninterface MenuItemRendererProps {\n item: NavigationMenuItem;\n variant: string;\n size: string;\n collapsed: boolean;\n minimal: boolean;\n level: number;\n onItemClick?: (item: NavigationMenuItem) => void;\n}\n\n// Hover intent and open/anchor state live in NavigationMenuItem.hooks.\n\n// The flyout a horizontal menu opens on hover.\nconst MenuItemPopover: React.FC<{\n anchorEl: HTMLElement | null;\n item: NavigationMenuItem;\n size?: string;\n minimal?: boolean;\n onClose: () => void;\n onMouseEnter: () => void;\n onMouseLeave: () => void;\n onItemClick?: (item: NavigationMenuItem) => void;\n}> = ({ anchorEl, item, size, minimal, onClose, onMouseEnter, onMouseLeave, onItemClick }) => (\n <Popover\n open={Boolean(anchorEl)}\n anchorEl={anchorEl}\n onClose={onClose}\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'left' }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'left' }}\n disableRestoreFocus\n sx={{\n pointerEvents: 'none' }}\n slotProps={{\n paper: {\n onMouseEnter,\n onMouseLeave,\n sx: {\n pointerEvents: 'auto',\n mt: 0.5,\n borderRadius: 2,\n boxShadow: (theme) => `0 ${rems(theme, 12, 40)} ${shadowInk(theme, 0.15)}`,\n border: (theme) => `1px solid ${alpha(theme.palette.divider, 0.1)}`,\n background: (theme) =>\n `linear-gradient(145deg, ${theme.palette.background.paper} 0%, ${alpha(theme.palette.background.default, 0.95)} 100%)`,\n backdropFilter: (theme) => `blur(${rem(theme, 10)})`,\n minWidth: sxRem(200) } } }}\n >\n <List sx={{ p: 1 }}>\n {item.children?.map((child) => {\n const childHasChildren = child.children && child.children.length > 0;\n\n // Only close popover when clicking leaf nodes (items without children)\n if (childHasChildren) {\n return renderMenuItem(child, 'vertical', size, false, minimal, 0, onItemClick);\n }\n\n // For leaf nodes, wrap with onClick to close the popover\n return (\n <Box\n key={child.id}\n onClick={onClose}\n >\n {renderMenuItem(child, 'vertical', size, false, minimal, 0, onItemClick)}\n </Box>\n );\n })}\n </List>\n </Popover>\n);\n\n// Label, badge/chip and the expand chevron, faded out when the rail collapses.\nconst MenuItemLabel: React.FC<{\n item: NavigationMenuItem;\n collapsed?: boolean;\n minimal?: boolean;\n open: boolean;\n hasChildren?: boolean;\n size?: string;\n variant?: string;\n}> = ({ item, collapsed, open, hasChildren, size, variant }) => (\n <Fade in={!collapsed} timeout={400}>\n <Box sx={{ display: 'flex', alignItems: 'center', width: '100%', gap: 1 }}>\n <ListItemText\n primary={item.label}\n secondary={item.description}\n sx={{\n flex: 1,\n minWidth: 0, // Allows text truncation if needed\n }}\n slotProps={{\n primary: {\n variant: size === 'sm' ? 'body2' : size === 'lg' ? 'h6' : 'body1',\n sx: {\n fontWeight: item.active ? 600 : 400,\n transition: 'all 0.3s ease' } },\n secondary: {\n sx: {\n opacity: 0.7,\n transition: 'all 0.3s ease' } } }}\n />\n {item.badge && (\n <Box\n component=\"span\"\n sx={{\n flexShrink: 0,\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n minWidth: sxRem(20),\n height: sxRem(20),\n px: 0.75,\n borderRadius: sxRem(10),\n fontSize: sxRem(12),\n fontWeight: 600,\n color: (theme) => onMedia(theme),\n background: (theme) =>\n `linear-gradient(135deg, ${uiInk(theme).attention.from} 0%, ${uiInk(theme).attention.to} 100%)`,\n boxShadow: (theme) => `0 ${rems(theme, 2, 8)} ${alpha(uiInk(theme).attention.glow, 0.4)}`,\n animation: (theme) =>\n typeof item.badge === 'number' && item.badge > 0\n ? `${pulseGlow(theme)} 2s infinite`\n : 'none' }}\n >\n {item.badge}\n </Box>\n )}\n {hasChildren && (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n flexShrink: 0, // Prevents expand icon from shrinking\n transition: 'transform 0.3s ease',\n transform: open ? 'rotate(180deg)' : 'rotate(0deg)' }}\n >\n {variant === 'horizontal' ? <ChevronRight fontSize=\"small\" /> : <ExpandMore />}\n </Box>\n )}\n </Box>\n </Fade>\n);\n\n// The row itself: icon, label, badge and the expand chevron.\nconst MenuItemContent: React.FC<{\n item: NavigationMenuItem;\n variant?: string;\n size?: string;\n active?: boolean;\n collapsed?: boolean;\n minimal?: boolean;\n level: number;\n open: boolean;\n hasChildren?: boolean;\n onClick: (event: React.MouseEvent<HTMLElement>) => void;\n onMouseEnter: (event: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave: () => void;\n}> = ({\n item,\n variant,\n size,\n active: _active,\n collapsed,\n minimal,\n level,\n open,\n hasChildren,\n onClick,\n onMouseEnter,\n onMouseLeave }) => (\n<StyledListItem key={item.id} variant={variant} active={item.active} size={size} level={level}>\n <StyledListItemButton\n variant={variant}\n active={item.active}\n size={size}\n collapsed={collapsed}\n minimal={minimal}\n disabled={item.disabled}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n {...(item.href && !hasChildren\n ? {\n component: 'a' as React.ElementType,\n href: item.href,\n target: item.target }\n : {})}\n >\n {item.icon && (\n <ListItemIcon\n sx={{\n minWidth: collapsed ? 0 : sxRem(40),\n justifyContent: 'center',\n transition: 'all 0.3s ease',\n '& svg': {\n filter: (theme) => (item.active ? `drop-shadow(0 ${rems(theme, 2, 8)} ${shadowInk(theme, 0.15)})` : 'none'),\n transition: 'all 0.3s ease' } }}\n >\n <Grow in={true} timeout={600}>\n <Box>{item.icon}</Box>\n </Grow>\n </ListItemIcon>\n )}\n {!collapsed && (\n <MenuItemLabel\n item={item}\n collapsed={collapsed}\n minimal={minimal}\n open={open}\n hasChildren={hasChildren}\n size={size}\n variant={variant}\n />\n )}\n </StyledListItemButton>\n </StyledListItem>\n);\n\nconst MenuItemRenderer: React.FC<MenuItemRendererProps> = ({\n item,\n variant,\n size,\n collapsed,\n minimal,\n level,\n onItemClick }) => {\n const {\n open,\n anchorEl,\n hasChildren,\n handleClick,\n handleMouseEnter,\n handleMouseLeave,\n handlePopoverMouseEnter,\n handlePopoverMouseLeave,\n closePopover } = useMenuItemState({ item, variant, onItemClick });\n\n const itemContent = (\n <MenuItemContent\n item={item}\n variant={variant}\n size={size}\n active={item.active}\n collapsed={collapsed}\n minimal={minimal}\n level={level}\n open={open}\n hasChildren={hasChildren}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n />\n );\n\n // Horizontal variant with children - use Popover\n if (hasChildren && variant === 'horizontal') {\n return (\n <React.Fragment key={item.id}>\n {itemContent}\n <MenuItemPopover\n anchorEl={anchorEl}\n item={item}\n size={size}\n minimal={minimal}\n onClose={closePopover}\n onMouseEnter={handlePopoverMouseEnter}\n onMouseLeave={handlePopoverMouseLeave}\n onItemClick={onItemClick}\n />\n </React.Fragment>\n );\n }\n\n // Vertical variant with children - use Collapse\n if (hasChildren && variant !== 'horizontal') {\n return (\n <React.Fragment key={item.id}>\n {itemContent}\n {!collapsed && (\n <Collapse in={open} timeout=\"auto\" unmountOnExit>\n <List component=\"div\" disablePadding>\n {item.children?.map((child) =>\n renderMenuItem(child, variant, size, collapsed, minimal, level + 1, onItemClick),\n )}\n </List>\n </Collapse>\n )}\n </React.Fragment>\n );\n }\n\n return itemContent;\n};\n\nexport const renderMenuItem = (\n item: NavigationMenuItem,\n variant: string = 'vertical',\n size: string = 'md',\n collapsed: boolean = false,\n minimal: boolean = false,\n level: number = 0,\n onItemClick?: (item: NavigationMenuItem) => void,\n): React.ReactNode => (\n <MenuItemRenderer\n key={item.id}\n item={item}\n variant={variant}\n size={size}\n collapsed={collapsed}\n minimal={minimal}\n level={level}\n onItemClick={onItemClick}\n />\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,gBAAgB;AACvB,OAAO,SAAS;AAChB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,oBAAoB;AAC3B,OAAO,kBAAkB;AACzB,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,SAAS,OAAO,cAAc;AAC9B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"version":3,"sources":["../src/components/feedback/Dialog/Dialog.tsx"],"sourcesContent":["import CloseIcon from '@mui/icons-material/Close';\nimport Backdrop from '@mui/material/Backdrop/index.js';\nimport Box from '@mui/material/Box/index.js';\nimport MuiDialog from '@mui/material/Dialog/index.js';\nimport MuiDialogActions from '@mui/material/DialogActions/index.js';\nimport MuiDialogContent from '@mui/material/DialogContent/index.js';\nimport MuiDialogTitle from '@mui/material/DialogTitle/index.js';\nimport Drawer, { type DrawerProps } from '@mui/material/Drawer/index.js';\nimport IconButton from '@mui/material/IconButton/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport { useTheme, type SxProps, type Theme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport { hasSpacingSlot, withDialogDefaults } from './Dialog.helpers';\nimport {\n DIALOG_ACTIONS,\n DIALOG_BODY_PADDING_UNITS,\n DIALOG_CONTENT_PADDING_UNITS,\n DIALOG_HEADER_CHILDREN_PADDING_UNITS,\n DIALOG_TITLE,\n DIALOG_TITLED_BODY_PADDING_TOP_UNITS,\n} from './Dialog.metrics';\nimport { mergedPaperSlot } from './Dialog.paper';\nimport { backdropSxOf, variantStylesOf } from './Dialog.styles';\nimport { childTestId, resolveTestId, slotTestId, withoutTestIdProps } from '../../../platform/test-id';\nimport type {\n DialogActionsProps,\n DialogContentProps,\n DialogHeaderProps,\n DialogProps,\n} from './Dialog.types';\n\n/**\n * The padding a dialog gives children that are not managing their own — and the\n * rule that takes it back when it turns out they are.\n *\n * `:has()` is doing what {@link hasSpacingSlot} cannot. A slot passed through a\n * COMPONENT (`<Body />` rendering a `DialogContent`) is invisible to any check\n * on element type: React does not know what a component renders until it has\n * rendered it, and by then the wrapper is already in the tree. The selector\n * asks the question one step later, of the DOM, where the answer exists.\n *\n * `display: contents` rather than `padding: 0`, because the padding is only\n * half of what a wrapper does. The other half is standing between the paper and\n * its children: MUI's `scroll=\"paper\"` makes the paper a flex column with\n * `overflow-y: auto`, so a `DialogContent` that is no longer its direct child\n * cannot be the thing that scrolls — the whole dialog scrolls instead and\n * carries the `DialogActions` off the bottom with it. An element with\n * `display: contents` generates no box at all: its children become the paper's\n * flex items, and its padding is never applied. Both halves, one declaration.\n *\n * A browser without `:has()` falls back to the padded box — the layout this\n * had before, not a broken one.\n */\nconst BODY_SX = {\n px: DIALOG_BODY_PADDING_UNITS.horizontal,\n pb: DIALOG_BODY_PADDING_UNITS.bottom,\n '&:has(> .MuiDialogContent-root), &:has(> .MuiDialogActions-root)': {\n display: 'contents',\n },\n} as const;\n\n/**\n * The dialog body. Consumers that pass raw children (no <DialogContent>) used\n * to render them flush against the paper edges — give them comfortable default\n * padding; <DialogContent>/<DialogActions> users keep managing their own\n * spacing.\n */\nfunction bodyOf(children: React.ReactNode, hasTitle: boolean): React.ReactNode {\n // Read lazily: both slots are declared below this function.\n if (hasSpacingSlot(children, [DialogContent, DialogActions])) return children;\n const pt = hasTitle\n ? DIALOG_BODY_PADDING_UNITS.topUnderTitle\n : DIALOG_BODY_PADDING_UNITS.top;\n return <Box sx={{ ...BODY_SX, pt }}>{children}</Box>;\n}\n\n/**\n * The drawer variant: MUI's `Drawer`, with the variant's look on the Drawer's\n * OWN paper — on an inner Box it left the paper 0px wide and clipped the panel —\n * and a caller's paper props merged over it rather than replacing it. The\n * test id stays on the Drawer root, so the paper carries none of its own.\n */\nfunction DrawerDialog({\n paperSx,\n testId,\n drawerProps,\n children,\n}: {\n paperSx: SxProps<Theme>;\n testId: string | undefined;\n drawerProps: DrawerProps;\n children: React.ReactNode;\n}) {\n const { PaperProps: callerPaper, slotProps, ...rest } = drawerProps;\n return (\n <Drawer\n anchor=\"right\"\n data-testid={testId}\n {...rest}\n slotProps={{ ...slotProps, paper: mergedPaperSlot(paperSx, undefined, callerPaper, slotProps?.paper) }}\n >\n {children}\n </Drawer>\n );\n}\n\nexport const Dialog: React.FC<DialogProps> = (rawProps) => {\n const {\n children,\n variant,\n size,\n title,\n description,\n showCloseButton,\n backdrop,\n persistent,\n glass,\n gradient,\n glow,\n pulse,\n borderRadius,\n onClose,\n open,\n ...others\n } = withDialogDefaults(rawProps);\n const theme = useTheme();\n // Every spelling of the test id the shared contract allows, mapped to the one\n // the DOM reads, and stripped from what is spread — `testID` is React\n // Native's name for it and is not a DOM attribute. The native `Dialog` does\n // the same in reverse.\n const testId = resolveTestId(others, 'dialog');\n const { PaperProps: callerPaper, slotProps, ...props } = withoutTestIdProps(others);\n const paperSx = variantStylesOf(theme, {\n variant, size, borderRadius, glass, gradient, glow, pulse,\n });\n\n const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {\n if (persistent && (reason === 'backdropClick' || reason === 'escapeKeyDown')) {\n return;\n }\n onClose?.();\n };\n\n const header = title ? (\n <DialogHeader\n title={title}\n subtitle={description}\n showCloseButton={showCloseButton}\n onClose={onClose}\n dataTestId={testId}\n />\n ) : null;\n const body = bodyOf(children, Boolean(title));\n\n if (variant === 'drawer') {\n return (\n <DrawerDialog\n paperSx={paperSx}\n testId={testId}\n drawerProps={{ ...props, PaperProps: callerPaper, slotProps, open, onClose }}\n >\n {header}\n {body}\n </DrawerDialog>\n );\n }\n\n return (\n <MuiDialog\n open={open}\n onClose={handleClose}\n fullScreen={variant === 'fullscreen'}\n BackdropComponent={backdrop ? Backdrop : undefined}\n BackdropProps={{ sx: backdropSxOf(theme, glass) }}\n {...props}\n slotProps={{ ...slotProps, paper: mergedPaperSlot(paperSx, testId, callerPaper, slotProps?.paper) }}\n >\n {header}\n {body}\n </MuiDialog>\n );\n};\n\nexport const DialogHeader: React.FC<DialogHeaderProps> = ({\n children,\n title,\n subtitle,\n showCloseButton = true,\n onClose,\n ...others\n}) => {\n const props = withoutTestIdProps(others);\n\n if (children) {\n return (\n <Box\n data-testid={slotTestId(others, 'header', 'dialog')}\n sx={{\n p: DIALOG_HEADER_CHILDREN_PADDING_UNITS,\n borderBottom: '1px solid',\n borderColor: 'divider',\n }}\n >\n {children}\n </Box>\n );\n }\n\n return (\n <MuiDialogTitle\n data-testid={slotTestId(others, 'title', 'dialog')}\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n pb: subtitle\n ? DIALOG_TITLE.paddingBottomUnits.withSubtitle\n : DIALOG_TITLE.paddingBottomUnits.plain,\n }}\n {...props}\n >\n <Box>\n <Typography variant=\"h6\" component=\"div\">\n {title}\n </Typography>\n {subtitle && (\n <Typography\n variant=\"body2\"\n color=\"text.secondary\"\n sx={{ mt: DIALOG_TITLE.subtitleGapUnits }}\n >\n {subtitle}\n </Typography>\n )}\n </Box>\n {showCloseButton && onClose && (\n <IconButton\n aria-label=\"close\"\n onClick={onClose}\n data-testid={childTestId(others, 'close', 'dialog')}\n sx={{\n color: 'text.secondary',\n '&:hover': {\n backgroundColor: 'action.hover',\n },\n }}\n >\n <CloseIcon />\n </IconButton>\n )}\n </MuiDialogTitle>\n );\n};\n\n/**\n * Top padding for a body that sits directly under the title.\n *\n * MUI zeroes it there (`.MuiDialogTitle-root + &` on a non-`dividers` content),\n * assuming the title's own bottom padding is the whole gap. That assumption\n * breaks for a body opening with an outlined field: a filled field floats its\n * label ABOVE the input's border box, and `DialogContent` is `overflow-y: auto`\n * — a clipping box — so the label gets sliced in half (FUT-544: \"Tipo\" in the\n * \"Novo insumo\" dialog).\n *\n * Reserve the overhang rather than restore the full 24px: the title already\n * contributes its bottom padding, so a shrunk label's `translate(…, -9px)` is\n * all that is missing. 12px clears it and leaves the gap visually tight.\n */\nconst TITLED_BODY_PADDING_TOP = DIALOG_TITLED_BODY_PADDING_TOP_UNITS;\n\n/**\n * `.MuiDialogTitle-root + &` is `(0,2,0)`-specific and a plain `sx` entry is\n * `(0,1,0)`, so the padding above only survives the cascade by naming the class\n * again — `(0,3,0)`. Scoped to the title-following case so an untitled dialog\n * keeps MUI's roomier default.\n */\nconst TITLED_BODY_SELECTOR = '.MuiDialogTitle-root + &.MuiDialogContent-root';\n\nexport const DialogContent: React.FC<DialogContentProps> = ({\n children,\n dividers = false,\n dense = false,\n ...others\n}) => (\n <MuiDialogContent\n data-testid={slotTestId(others, 'content', 'dialog')}\n dividers={dividers}\n sx={{\n padding: dense ? DIALOG_CONTENT_PADDING_UNITS.dense : DIALOG_CONTENT_PADDING_UNITS.normal,\n [TITLED_BODY_SELECTOR]: { paddingTop: TITLED_BODY_PADDING_TOP },\n '&.MuiDialogContent-dividers': {\n borderTop: dividers ? '1px solid' : 'none',\n borderBottom: dividers ? '1px solid' : 'none',\n borderColor: 'divider',\n },\n }}\n {...withoutTestIdProps(others)}\n >\n {children}\n </MuiDialogContent>\n );\n\nexport const DialogActions: React.FC<DialogActionsProps> = ({\n children,\n alignment = 'right',\n spacing = DIALOG_ACTIONS.defaultSpacingUnits,\n ...others\n}) => {\n const getJustifyContent = () => {\n switch (alignment) {\n case 'left': return 'flex-start';\n case 'center': return 'center';\n case 'right': return 'flex-end';\n case 'space-between': return 'space-between';\n default: return 'flex-end';\n }\n };\n\n return (\n <MuiDialogActions\n data-testid={slotTestId(others, 'actions', 'dialog')}\n sx={{\n justifyContent: getJustifyContent(),\n gap: spacing,\n p: DIALOG_ACTIONS.paddingUnits,\n }}\n {...withoutTestIdProps(others)}\n >\n {children}\n </MuiDialogActions>\n );\n};"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,SAAS;AAChB,OAAO,eAAe;AACtB,OAAO,sBAAsB;AAC7B,OAAO,sBAAsB;AAC7B,OAAO,oBAAoB;AAC3B,OAAO,YAAkC;AACzC,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AACvB,SAAS,gBAA0C;AAgE1C,cAmFH,YAnFG;AApBT,IAAM,UAAU;AAAA,EACd,IAAI,0BAA0B;AAAA,EAC9B,IAAI,0BAA0B;AAAA,EAC9B,oEAAoE;AAAA,IAClE,SAAS;AAAA,EACX;AACF;AAQA,SAAS,OAAO,UAA2B,UAAoC;AAE7E,MAAI,eAAe,UAAU,CAAC,eAAe,aAAa,CAAC,EA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ACtB,KAAK;AAAS,eAAO;AAAA,MACrB,KAAK;AAAiB,eAAO;AAAA,MAC7B;AAAS,eAAO;AAAA,IAClB;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,WAAW,QAAQ,WAAW,QAAQ;AAAA,MACnD,IAAI;AAAA,QACF,gBAAgB,kBAAkB;AAAA,QAClC,KAAK;AAAA,QACL,GAAG,eAAe;AAAA,MACpB;AAAA,MACC,GAAG,mBAAmB,MAAM;AAAA,MAE5B;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
package/dist/chunk-Y4O4DITI.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// src/components/feedback/Dialog/Dialog.paper.ts
|
|
2
|
-
function sxList(caller) {
|
|
3
|
-
if (caller === void 0) return [];
|
|
4
|
-
return Array.isArray(caller) ? caller : [caller];
|
|
5
|
-
}
|
|
6
|
-
function mergeOver(look, testId, legacy, slot) {
|
|
7
|
-
const caller = { ...legacy, ...slot };
|
|
8
|
-
return {
|
|
9
|
-
...caller,
|
|
10
|
-
sx: [look, ...sxList(legacy?.sx), ...sxList(slot?.sx)],
|
|
11
|
-
// A key the caller set to `undefined` does not erase the dialog's id.
|
|
12
|
-
"data-testid": caller["data-testid"] ?? testId
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function mergedPaperSlot(look, testId, legacy, slot) {
|
|
16
|
-
if (typeof slot === "function") {
|
|
17
|
-
return (ownerState) => mergeOver(look, testId, legacy, slot(ownerState));
|
|
18
|
-
}
|
|
19
|
-
return mergeOver(look, testId, legacy, slot);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
mergedPaperSlot
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-Y4O4DITI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/feedback/Dialog/Dialog.paper.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles/index.js';\n\n/**\n * A caller's paper props, MERGED over the variant's rather than replacing them\n * (FUT-2613).\n *\n * MUI reaches the paper through two props, and both used to replace ours whole:\n * `PaperProps` (spread after ours) and `slotProps.paper` (which MUI itself puts\n * over `PaperProps`). A caller asking for one class, or one `sx` tweak, lost\n * the variant's radius, width, background and the paper's test id with it.\n *\n * Only the keys the merge reads are typed here; every other key the caller\n * passed rides the spread through untouched.\n */\ninterface PaperSlotValue {\n sx?: SxProps<Theme>;\n className?: string;\n 'data-testid'?: string;\n}\n\n/** A paper slot as MUI takes it: an object, or a function of the owner state. */\ntype PaperSlot<O> = PaperSlotValue | ((ownerState: O) => PaperSlotValue);\n\n/** Our look first, then whatever `sx` the caller adds — so the caller's escape hatch still wins. */\nfunction sxList(caller: SxProps<Theme> | undefined): readonly unknown[] {\n if (caller === undefined) return [];\n return Array.isArray(caller) ? caller : [caller];\n}\n\nfunction mergeOver(\n look: SxProps<Theme>,\n testId: string | undefined,\n legacy: PaperSlotValue | undefined,\n slot: PaperSlotValue | undefined,\n): PaperSlotValue {\n // MUI's own order: `slotProps.paper` over `PaperProps`.\n const caller: PaperSlotValue = { ...legacy, ...slot };\n return {\n ...caller,\n sx: [look, ...sxList(legacy?.sx), ...sxList(slot?.sx)] as SxProps<Theme>,\n // A key the caller set to `undefined` does not erase the dialog's id.\n 'data-testid': caller['data-testid'] ?? testId,\n };\n}\n\n/**\n * The one paper slot to hand MUI: the variant's `look`, then `PaperProps`, then\n * `slotProps.paper`. A function slot stays a function, so MUI still calls it\n * with its owner state and its result merges the same way.\n *\n * `testId` names the paper unless the caller's props name it; the drawer passes\n * none, because its id already sits on the Drawer root.\n */\nexport function mergedPaperSlot<O>(\n look: SxProps<Theme>,\n testId: string | undefined,\n legacy: PaperSlotValue | undefined,\n slot: PaperSlot<O> | undefined,\n): PaperSlot<O> {\n if (typeof slot === 'function') {\n return (ownerState: O) => mergeOver(look, testId, legacy, slot(ownerState));\n }\n return mergeOver(look, testId, legacy, slot);\n}\n"],"mappings":";AAwBA,SAAS,OAAO,QAAwD;AACtE,MAAI,WAAW,OAAW,QAAO,CAAC;AAClC,SAAO,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;AACjD;AAEA,SAAS,UACP,MACA,QACA,QACA,MACgB;AAEhB,QAAM,SAAyB,EAAE,GAAG,QAAQ,GAAG,KAAK;AACpD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,IAAI,CAAC,MAAM,GAAG,OAAO,QAAQ,EAAE,GAAG,GAAG,OAAO,MAAM,EAAE,CAAC;AAAA;AAAA,IAErD,eAAe,OAAO,aAAa,KAAK;AAAA,EAC1C;AACF;AAUO,SAAS,gBACd,MACA,QACA,QACA,MACc;AACd,MAAI,OAAO,SAAS,YAAY;AAC9B,WAAO,CAAC,eAAkB,UAAU,MAAM,QAAQ,QAAQ,KAAK,UAAU,CAAC;AAAA,EAC5E;AACA,SAAO,UAAU,MAAM,QAAQ,QAAQ,IAAI;AAC7C;","names":[]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { SxProps, Theme } from '@mui/material/styles/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* A caller's paper props, MERGED over the variant's rather than replacing them
|
|
4
|
-
* (FUT-2613).
|
|
5
|
-
*
|
|
6
|
-
* MUI reaches the paper through two props, and both used to replace ours whole:
|
|
7
|
-
* `PaperProps` (spread after ours) and `slotProps.paper` (which MUI itself puts
|
|
8
|
-
* over `PaperProps`). A caller asking for one class, or one `sx` tweak, lost
|
|
9
|
-
* the variant's radius, width, background and the paper's test id with it.
|
|
10
|
-
*
|
|
11
|
-
* Only the keys the merge reads are typed here; every other key the caller
|
|
12
|
-
* passed rides the spread through untouched.
|
|
13
|
-
*/
|
|
14
|
-
interface PaperSlotValue {
|
|
15
|
-
sx?: SxProps<Theme>;
|
|
16
|
-
className?: string;
|
|
17
|
-
'data-testid'?: string;
|
|
18
|
-
}
|
|
19
|
-
/** A paper slot as MUI takes it: an object, or a function of the owner state. */
|
|
20
|
-
type PaperSlot<O> = PaperSlotValue | ((ownerState: O) => PaperSlotValue);
|
|
21
|
-
/**
|
|
22
|
-
* The one paper slot to hand MUI: the variant's `look`, then `PaperProps`, then
|
|
23
|
-
* `slotProps.paper`. A function slot stays a function, so MUI still calls it
|
|
24
|
-
* with its owner state and its result merges the same way.
|
|
25
|
-
*
|
|
26
|
-
* `testId` names the paper unless the caller's props name it; the drawer passes
|
|
27
|
-
* none, because its id already sits on the Drawer root.
|
|
28
|
-
*/
|
|
29
|
-
export declare function mergedPaperSlot<O>(look: SxProps<Theme>, testId: string | undefined, legacy: PaperSlotValue | undefined, slot: PaperSlot<O> | undefined): PaperSlot<O>;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=Dialog.paper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.paper.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/Dialog/Dialog.paper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,UAAU,cAAc;IACtB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,iFAAiF;AACjF,KAAK,SAAS,CAAC,CAAC,IAAI,cAAc,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC;AAwBzE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EACpB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,GAC7B,SAAS,CAAC,CAAC,CAAC,CAKd"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { SxProps, Theme } from '@mui/material/styles/index.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A caller's paper props, MERGED over the variant's rather than replacing them
|
|
5
|
-
* (FUT-2613).
|
|
6
|
-
*
|
|
7
|
-
* MUI reaches the paper through two props, and both used to replace ours whole:
|
|
8
|
-
* `PaperProps` (spread after ours) and `slotProps.paper` (which MUI itself puts
|
|
9
|
-
* over `PaperProps`). A caller asking for one class, or one `sx` tweak, lost
|
|
10
|
-
* the variant's radius, width, background and the paper's test id with it.
|
|
11
|
-
*
|
|
12
|
-
* Only the keys the merge reads are typed here; every other key the caller
|
|
13
|
-
* passed rides the spread through untouched.
|
|
14
|
-
*/
|
|
15
|
-
interface PaperSlotValue {
|
|
16
|
-
sx?: SxProps<Theme>;
|
|
17
|
-
className?: string;
|
|
18
|
-
'data-testid'?: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** A paper slot as MUI takes it: an object, or a function of the owner state. */
|
|
22
|
-
type PaperSlot<O> = PaperSlotValue | ((ownerState: O) => PaperSlotValue);
|
|
23
|
-
|
|
24
|
-
/** Our look first, then whatever `sx` the caller adds — so the caller's escape hatch still wins. */
|
|
25
|
-
function sxList(caller: SxProps<Theme> | undefined): readonly unknown[] {
|
|
26
|
-
if (caller === undefined) return [];
|
|
27
|
-
return Array.isArray(caller) ? caller : [caller];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function mergeOver(
|
|
31
|
-
look: SxProps<Theme>,
|
|
32
|
-
testId: string | undefined,
|
|
33
|
-
legacy: PaperSlotValue | undefined,
|
|
34
|
-
slot: PaperSlotValue | undefined,
|
|
35
|
-
): PaperSlotValue {
|
|
36
|
-
// MUI's own order: `slotProps.paper` over `PaperProps`.
|
|
37
|
-
const caller: PaperSlotValue = { ...legacy, ...slot };
|
|
38
|
-
return {
|
|
39
|
-
...caller,
|
|
40
|
-
sx: [look, ...sxList(legacy?.sx), ...sxList(slot?.sx)] as SxProps<Theme>,
|
|
41
|
-
// A key the caller set to `undefined` does not erase the dialog's id.
|
|
42
|
-
'data-testid': caller['data-testid'] ?? testId,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The one paper slot to hand MUI: the variant's `look`, then `PaperProps`, then
|
|
48
|
-
* `slotProps.paper`. A function slot stays a function, so MUI still calls it
|
|
49
|
-
* with its owner state and its result merges the same way.
|
|
50
|
-
*
|
|
51
|
-
* `testId` names the paper unless the caller's props name it; the drawer passes
|
|
52
|
-
* none, because its id already sits on the Drawer root.
|
|
53
|
-
*/
|
|
54
|
-
export function mergedPaperSlot<O>(
|
|
55
|
-
look: SxProps<Theme>,
|
|
56
|
-
testId: string | undefined,
|
|
57
|
-
legacy: PaperSlotValue | undefined,
|
|
58
|
-
slot: PaperSlot<O> | undefined,
|
|
59
|
-
): PaperSlot<O> {
|
|
60
|
-
if (typeof slot === 'function') {
|
|
61
|
-
return (ownerState: O) => mergeOver(look, testId, legacy, slot(ownerState));
|
|
62
|
-
}
|
|
63
|
-
return mergeOver(look, testId, legacy, slot);
|
|
64
|
-
}
|
/package/dist/_internal/components/feedback/Dialog/{Dialog.paper.js.map → Dialog.slots.js.map}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|