@12-apps/ui 6.39.12 → 6.39.14
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 +5 -5
- package/dist/_internal/components/layout/Separator/Separator.js +2 -2
- package/dist/_internal/components/layout/Separator/Separator.styles.js +1 -1
- package/dist/_internal/components/layout/index.js +2 -2
- package/dist/_internal/components/navigation/AppHeader/AppHeader.details.js +3 -3
- package/dist/_internal/components/navigation/index.js +3 -3
- package/dist/_internal/social-login-button/social-login-button.js +3 -3
- package/dist/{chunk-SYNB3IIB.js → chunk-35443PF6.js} +8 -5
- package/dist/chunk-35443PF6.js.map +1 -0
- 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-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-5KWHINO5.js → chunk-SLDSWQVE.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-XSSCSRUX.js → chunk-X53F33KA.js} +4 -2
- package/dist/chunk-X53F33KA.js.map +1 -0
- package/dist/data-display/DataViews.js +7 -7
- package/dist/feedback/Dialog.js +2 -2
- package/dist/layout/Separator.js +2 -2
- package/dist/navigation/AppHeader.js +3 -3
- package/dist/social-login-button.js +3 -3
- 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/layout/Separator/Separator.d.ts.map +1 -1
- package/dist/types/components/layout/Separator/Separator.styles.d.ts +12 -4
- package/dist/types/components/layout/Separator/Separator.styles.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/layout/Separator/Separator.styles.ts +26 -8
- package/src/components/layout/Separator/Separator.tsx +6 -0
- package/dist/_internal/components/feedback/Dialog/Dialog.paper.js +0 -8
- package/dist/chunk-SYNB3IIB.js.map +0 -1
- package/dist/chunk-UEROWH53.js.map +0 -1
- package/dist/chunk-XSSCSRUX.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-3333KCAW.js.map → chunk-P22W4N5K.js.map} +0 -0
- /package/dist/{chunk-IYF246UA.js.map → chunk-SA65SDOY.js.map} +0 -0
- /package/dist/{chunk-5KWHINO5.js.map → chunk-SLDSWQVE.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CloseIcon from '@mui/icons-material/Close';
|
|
2
2
|
import Backdrop from '@mui/material/Backdrop/index.js';
|
|
3
3
|
import Box from '@mui/material/Box/index.js';
|
|
4
|
-
import MuiDialog from '@mui/material/Dialog/index.js';
|
|
4
|
+
import MuiDialog, { type DialogProps as MuiDialogProps } from '@mui/material/Dialog/index.js';
|
|
5
5
|
import MuiDialogActions from '@mui/material/DialogActions/index.js';
|
|
6
6
|
import MuiDialogContent from '@mui/material/DialogContent/index.js';
|
|
7
7
|
import MuiDialogTitle from '@mui/material/DialogTitle/index.js';
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
DIALOG_TITLE,
|
|
21
21
|
DIALOG_TITLED_BODY_PADDING_TOP_UNITS,
|
|
22
22
|
} from './Dialog.metrics';
|
|
23
|
-
import { mergedPaperSlot } from './Dialog.
|
|
23
|
+
import { mergedBackdropSlot, mergedPaperSlot } from './Dialog.slots';
|
|
24
24
|
import { backdropSxOf, variantStylesOf } from './Dialog.styles';
|
|
25
25
|
import { childTestId, resolveTestId, slotTestId, withoutTestIdProps } from '../../../platform/test-id';
|
|
26
26
|
import type {
|
|
@@ -75,30 +75,89 @@ function bodyOf(children: React.ReactNode, hasTitle: boolean): React.ReactNode {
|
|
|
75
75
|
return <Box sx={{ ...BODY_SX, pt }}>{children}</Box>;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/**
|
|
79
|
+
* MUI's `onClose` for either renderer: a `persistent` dialog swallows the
|
|
80
|
+
* backdrop press and Escape, and the caller's `onClose` is called with no
|
|
81
|
+
* arguments, as `Dialog.base.ts` promises. The drawer used to get the caller's
|
|
82
|
+
* raw `onClose` — so it closed when `persistent` said it must not, and was
|
|
83
|
+
* handed MUI's `(event, reason)` (FUT-2673).
|
|
84
|
+
*/
|
|
85
|
+
function closeHandlerOf(persistent: boolean, onClose: (() => void) | undefined) {
|
|
86
|
+
return (_event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
|
87
|
+
if (persistent && (reason === 'backdropClick' || reason === 'escapeKeyDown')) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
onClose?.();
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The looks the Dialog lays under a caller's paper and backdrop props. */
|
|
95
|
+
interface DialogLooks {
|
|
96
|
+
paperSx: SxProps<Theme>;
|
|
97
|
+
backdropSx: SxProps<Theme>;
|
|
98
|
+
testId: string | undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** What either renderer below takes: the looks, and the dialog's own children. */
|
|
102
|
+
type RendererProps = DialogLooks & { children: React.ReactNode };
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Every variant but the drawer: MUI's `Dialog`. The scrim reaches MUI through
|
|
106
|
+
* `slotProps.backdrop`, not the deprecated `BackdropProps`, and a caller's
|
|
107
|
+
* backdrop props from either spelling merge over it rather than replacing it
|
|
108
|
+
* (FUT-2672) — as their paper props merge over the variant's look (FUT-2613).
|
|
109
|
+
*/
|
|
110
|
+
function ModalDialog({
|
|
111
|
+
paperSx,
|
|
112
|
+
backdropSx,
|
|
113
|
+
testId,
|
|
114
|
+
dialogProps,
|
|
115
|
+
children,
|
|
116
|
+
}: RendererProps & { dialogProps: MuiDialogProps }) {
|
|
117
|
+
const { PaperProps: callerPaper, BackdropProps: callerBackdrop, slotProps, ...rest } = dialogProps;
|
|
118
|
+
return (
|
|
119
|
+
<MuiDialog
|
|
120
|
+
{...rest}
|
|
121
|
+
slotProps={{
|
|
122
|
+
...slotProps,
|
|
123
|
+
paper: mergedPaperSlot(paperSx, testId, callerPaper, slotProps?.paper),
|
|
124
|
+
backdrop: mergedBackdropSlot(backdropSx, callerBackdrop, slotProps?.backdrop),
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
{children}
|
|
128
|
+
</MuiDialog>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
78
132
|
/**
|
|
79
133
|
* The drawer variant: MUI's `Drawer`, with the variant's look on the Drawer's
|
|
80
134
|
* OWN paper — on an inner Box it left the paper 0px wide and clipped the panel —
|
|
81
135
|
* and a caller's paper props merged over it rather than replacing it. The
|
|
82
136
|
* test id stays on the Drawer root, so the paper carries none of its own.
|
|
137
|
+
*
|
|
138
|
+
* The scrim rides the drawer's backdrop exactly as it rides the dialog's, so
|
|
139
|
+
* `glass` blurs it here too; the paper does not frost (FUT-2673). MUI's
|
|
140
|
+
* `Drawer` does not merge `BackdropProps` into `slotProps.backdrop` — it takes
|
|
141
|
+
* one or the other — so both are folded into the one slot here.
|
|
83
142
|
*/
|
|
84
143
|
function DrawerDialog({
|
|
85
144
|
paperSx,
|
|
145
|
+
backdropSx,
|
|
86
146
|
testId,
|
|
87
147
|
drawerProps,
|
|
88
148
|
children,
|
|
89
|
-
}: {
|
|
90
|
-
|
|
91
|
-
testId: string | undefined;
|
|
92
|
-
drawerProps: DrawerProps;
|
|
93
|
-
children: React.ReactNode;
|
|
94
|
-
}) {
|
|
95
|
-
const { PaperProps: callerPaper, slotProps, ...rest } = drawerProps;
|
|
149
|
+
}: RendererProps & { drawerProps: DrawerProps }) {
|
|
150
|
+
const { PaperProps: callerPaper, BackdropProps: callerBackdrop, slotProps, ...rest } = drawerProps;
|
|
96
151
|
return (
|
|
97
152
|
<Drawer
|
|
98
153
|
anchor="right"
|
|
99
154
|
data-testid={testId}
|
|
100
155
|
{...rest}
|
|
101
|
-
slotProps={{
|
|
156
|
+
slotProps={{
|
|
157
|
+
...slotProps,
|
|
158
|
+
paper: mergedPaperSlot(paperSx, undefined, callerPaper, slotProps?.paper),
|
|
159
|
+
backdrop: mergedBackdropSlot(backdropSx, callerBackdrop, slotProps?.backdrop),
|
|
160
|
+
}}
|
|
102
161
|
>
|
|
103
162
|
{children}
|
|
104
163
|
</Drawer>
|
|
@@ -130,17 +189,13 @@ export const Dialog: React.FC<DialogProps> = (rawProps) => {
|
|
|
130
189
|
// Native's name for it and is not a DOM attribute. The native `Dialog` does
|
|
131
190
|
// the same in reverse.
|
|
132
191
|
const testId = resolveTestId(others, 'dialog');
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
variant, size, borderRadius, glass, gradient, glow, pulse,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => {
|
|
139
|
-
if (persistent && (reason === 'backdropClick' || reason === 'escapeKeyDown')) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
onClose?.();
|
|
192
|
+
const props = withoutTestIdProps(others);
|
|
193
|
+
const looks: DialogLooks = {
|
|
194
|
+
paperSx: variantStylesOf(theme, { variant, size, borderRadius, glass, gradient, glow, pulse }),
|
|
195
|
+
backdropSx: backdropSxOf(theme, glass),
|
|
196
|
+
testId,
|
|
143
197
|
};
|
|
198
|
+
const handleClose = closeHandlerOf(persistent, onClose);
|
|
144
199
|
|
|
145
200
|
const header = title ? (
|
|
146
201
|
<DialogHeader
|
|
@@ -155,11 +210,7 @@ export const Dialog: React.FC<DialogProps> = (rawProps) => {
|
|
|
155
210
|
|
|
156
211
|
if (variant === 'drawer') {
|
|
157
212
|
return (
|
|
158
|
-
<DrawerDialog
|
|
159
|
-
paperSx={paperSx}
|
|
160
|
-
testId={testId}
|
|
161
|
-
drawerProps={{ ...props, PaperProps: callerPaper, slotProps, open, onClose }}
|
|
162
|
-
>
|
|
213
|
+
<DrawerDialog {...looks} drawerProps={{ ...props, open, onClose: handleClose }}>
|
|
163
214
|
{header}
|
|
164
215
|
{body}
|
|
165
216
|
</DrawerDialog>
|
|
@@ -167,18 +218,19 @@ export const Dialog: React.FC<DialogProps> = (rawProps) => {
|
|
|
167
218
|
}
|
|
168
219
|
|
|
169
220
|
return (
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
221
|
+
<ModalDialog
|
|
222
|
+
{...looks}
|
|
223
|
+
dialogProps={{
|
|
224
|
+
open,
|
|
225
|
+
onClose: handleClose,
|
|
226
|
+
fullScreen: variant === 'fullscreen',
|
|
227
|
+
BackdropComponent: backdrop ? Backdrop : undefined,
|
|
228
|
+
...props,
|
|
229
|
+
}}
|
|
178
230
|
>
|
|
179
231
|
{header}
|
|
180
232
|
{body}
|
|
181
|
-
</
|
|
233
|
+
</ModalDialog>
|
|
182
234
|
);
|
|
183
235
|
};
|
|
184
236
|
|
|
@@ -128,17 +128,33 @@ const ruleLength = (theme: Theme, length: SeparatorProps['length']): string => {
|
|
|
128
128
|
return length <= 1 ? `${length * 100}%` : rem(theme, length);
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Whether a set `length` is a fraction of the parent rather than a fixed
|
|
133
|
+
* extent: a number of 1 or less, as {@link ruleLength} reads it, or any string
|
|
134
|
+
* that carries a percentage (`'50%'`, `'calc(50% - 8px)'`).
|
|
135
|
+
*/
|
|
136
|
+
const isRelativeLength = (length: number | string): boolean =>
|
|
137
|
+
typeof length === 'number' ? length <= 1 : length.includes('%');
|
|
138
|
+
|
|
131
139
|
/**
|
|
132
140
|
* What a labelled separator's rules add to {@link separatorStyles}, and whether
|
|
133
|
-
* the group stretches to its parent (FUT-2617).
|
|
141
|
+
* the group stretches to its parent (FUT-2617, FUT-2675).
|
|
134
142
|
*
|
|
135
143
|
* A labelled VERTICAL separator is a flex COLUMN — rule, label, rule — and with
|
|
136
144
|
* no `length` each rule is `height: 100%` of a column whose height is its own
|
|
137
145
|
* content: both resolved to 0px and only the label showed. So the column
|
|
138
146
|
* stretches to the row it sits in and the two rules split what the label
|
|
139
|
-
* leaves, equally (`flex: 1 1 0`), never shorter than a visible minimum.
|
|
140
|
-
*
|
|
141
|
-
*
|
|
147
|
+
* leaves, equally (`flex: 1 1 0`), never shorter than a visible minimum.
|
|
148
|
+
*
|
|
149
|
+
* A RELATIVE `length` (FUT-2675) resolved against that same content-height
|
|
150
|
+
* column and drew 0px too. It now means what it means on a horizontal labelled
|
|
151
|
+
* separator: that fraction of the run. The column stretches as above and each
|
|
152
|
+
* rule is `length` of it, with no grow and the default shrink, so rule, label
|
|
153
|
+
* and rule never overflow the row; the same minimum holds, and is all a block
|
|
154
|
+
* parent (where `align-self` does nothing) gets.
|
|
155
|
+
*
|
|
156
|
+
* An ABSOLUTE `length` is exactly that long: no grow, no shrink, no basis, and
|
|
157
|
+
* the column keeps its content height, centred as before.
|
|
142
158
|
*
|
|
143
159
|
* Only the labelled branch reads this. The plain separator keeps
|
|
144
160
|
* `separatorStyles` as is, since `flex: 1 1 0` there would widen a vertical
|
|
@@ -151,11 +167,13 @@ export const labelledSeparatorLayout = (
|
|
|
151
167
|
length: SeparatorProps['length'],
|
|
152
168
|
): { rule: CSSObject; group: CSSObject } => {
|
|
153
169
|
if (isHorizontal) return { rule: {}, group: {} };
|
|
154
|
-
if (length) return { rule: { flex: 'none' }, group: {} };
|
|
170
|
+
if (length && !isRelativeLength(length)) return { rule: { flex: 'none' }, group: {} };
|
|
155
171
|
return {
|
|
156
|
-
//
|
|
157
|
-
//
|
|
158
|
-
|
|
172
|
+
// Unset, the rules share the run; relative, each is its own fraction of it.
|
|
173
|
+
// Either way a design 16px floor, as long as the gap beside the label at
|
|
174
|
+
// the default spacing, so a short or unsized row still shows two rules and
|
|
175
|
+
// not a word.
|
|
176
|
+
rule: { flex: length ? '0 1 auto' : '1 1 0', minHeight: rem(theme, 16) },
|
|
159
177
|
group: { alignSelf: 'stretch' },
|
|
160
178
|
};
|
|
161
179
|
};
|
|
@@ -35,6 +35,12 @@ export const Separator: React.FC<SeparatorProps> = ({
|
|
|
35
35
|
// silently dropped it, so a LABELLED separator was the one variant no
|
|
36
36
|
// test could address except through its own words.
|
|
37
37
|
data-testid={dataTestId}
|
|
38
|
+
// The same semantics as the plain branch, on the group, as MUI's
|
|
39
|
+
// `Divider` does with children (FUT-2674). Without them a screen reader
|
|
40
|
+
// heard the label with nothing marking a boundary. The label stays
|
|
41
|
+
// inside, and the separator takes no name from it.
|
|
42
|
+
role="separator"
|
|
43
|
+
aria-orientation={orientation}
|
|
38
44
|
sx={{
|
|
39
45
|
display: 'flex',
|
|
40
46
|
alignItems: 'center',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/layout/Separator/Separator.styles.ts"],"sourcesContent":["import type { CSSObject, Theme } from '@mui/material/styles/index.js';\n\nimport type {\n SeparatorOrientation,\n SeparatorProps,\n SeparatorSize,\n SeparatorVariant,\n} from './Separator.types';\nimport { FIELD_BORDER_WIDTH } from '../../../tokens/field-height.core';\nimport { rem } from '../../../tokens/relative';\n\nconst THICKNESS_PX: Record<SeparatorSize, number> = {\n xs: 1,\n sm: 2,\n md: 3,\n lg: 4,\n xl: 6,\n};\n\nconst MARGIN_PX: Record<SeparatorSize, number> = {\n xs: 4,\n sm: 8,\n md: 16,\n lg: 24,\n xl: 32,\n};\n\nconst separatorThickness = (size: SeparatorSize): number =>\n THICKNESS_PX[size] ?? THICKNESS_PX.md;\n\n/** An explicit `margin` wins; otherwise the size picks one. */\nexport const separatorMargin = (\n size: SeparatorSize,\n margin?: number | string,\n): number | string => margin ?? MARGIN_PX[size] ?? MARGIN_PX.md;\n\n// `gradient` paints a background rather than a border, so it draws its line as a\n// solid border of zero visual consequence.\nconst borderStyleFor = (variant: SeparatorVariant): 'dashed' | 'dotted' | 'solid' => {\n switch (variant) {\n case 'dashed':\n return 'dashed';\n case 'dotted':\n return 'dotted';\n default:\n return 'solid';\n }\n};\n\nconst gradientBackground = (\n variant: SeparatorVariant,\n orientation: SeparatorOrientation,\n color: string,\n): string | undefined => {\n if (variant !== 'gradient') return undefined;\n const angle = orientation === 'horizontal' ? '90deg' : '180deg';\n return `linear-gradient(${angle}, transparent 0%, ${color} 50%, transparent 100%)`;\n};\n\n// Only the leading edge carries the rule; the other three are zeroed explicitly so\n// a parent's border shorthand cannot leak through.\nconst borderEdges = (\n isHorizontal: boolean,\n thickness: string,\n style: 'dashed' | 'dotted' | 'solid',\n color: string,\n): CSSObject => {\n const leading = isHorizontal ? 'Top' : 'Left';\n const blank: CSSObject = {\n borderTopWidth: 0,\n borderBottomWidth: 0,\n borderLeftWidth: 0,\n borderRightWidth: 0,\n borderTopStyle: 'none',\n borderBottomStyle: 'none',\n borderLeftStyle: 'none',\n borderRightStyle: 'none',\n borderTopColor: 'transparent',\n borderBottomColor: 'transparent',\n borderLeftColor: 'transparent',\n borderRightColor: 'transparent',\n };\n\n return {\n ...blank,\n [`border${leading}Width`]: thickness,\n [`border${leading}Style`]: style,\n [`border${leading}Color`]: color,\n };\n};\n\ntype SeparatorStyleArgs = Required<\n Pick<SeparatorProps, 'variant' | 'orientation' | 'size'>\n> &\n Pick<SeparatorProps, 'color' | 'length'> & {\n /** From {@link separatorBlockMargin}, which both the plain and the labelled separator read. */\n blockMargin: string;\n };\n\n/**\n * The separator's margin, on the axis it separates along only: above and below\n * a horizontal rule, either side of a vertical one. A margin given as a string\n * carries its own units; a number is design px, through the type scale.\n *\n * The LABELLED separator uses this too. It used to hand the number straight to\n * `sx.margin`, where a number is SPACING UNITS — `md`'s 16 drew 128px on all\n * four sides, against 16px above and below for the unlabelled one.\n */\nexport const separatorBlockMargin = (\n theme: Theme,\n size: SeparatorSize,\n margin: number | string | undefined,\n isHorizontal: boolean,\n): string => {\n const value = separatorMargin(size, margin);\n const length = typeof value === 'string' ? value : rem(theme, value);\n return isHorizontal ? `${length} 0` : `0 ${length}`;\n};\n\n/**\n * The rule's extent along its axis. It lands in `sx`, which reads a number of 1\n * or less as a fraction of the parent, and that stays so; any other number is\n * design px, through the type scale. Unset (or `0`/`''`) is the full run.\n */\nconst ruleLength = (theme: Theme, length: SeparatorProps['length']): string => {\n if (!length) return '100%';\n if (typeof length === 'string') return length;\n return length <= 1 ? `${length * 100}%` : rem(theme, length);\n};\n\n/**\n * What a labelled separator's rules add to {@link separatorStyles}, and whether\n * the group stretches to its parent (FUT-2617).\n *\n * A labelled VERTICAL separator is a flex COLUMN — rule, label, rule — and with\n * no `length` each rule is `height: 100%` of a column whose height is its own\n * content: both resolved to 0px and only the label showed. So the column\n * stretches to the row it sits in and the two rules split what the label\n * leaves, equally (`flex: 1 1 0`), never shorter than a visible minimum. With a\n * `length` the rule is exactly that long: no grow, no shrink, no basis, and the\n * column keeps its content height, centred as before.\n *\n * Only the labelled branch reads this. The plain separator keeps\n * `separatorStyles` as is, since `flex: 1 1 0` there would widen a vertical\n * separator sitting in a row. The horizontal rules already shrink around the\n * label in their row, so they are left alone.\n */\nexport const labelledSeparatorLayout = (\n theme: Theme,\n isHorizontal: boolean,\n length: SeparatorProps['length'],\n): { rule: CSSObject; group: CSSObject } => {\n if (isHorizontal) return { rule: {}, group: {} };\n if (length) return { rule: { flex: 'none' }, group: {} };\n return {\n // A design 16px, as long as the gap beside the label at the default\n // spacing, so a short or unsized row still shows two rules and not a word.\n rule: { flex: '1 1 0', minHeight: rem(theme, 16) },\n group: { alignSelf: 'stretch' },\n };\n};\n\nexport const separatorStyles = (\n theme: Theme,\n { variant, orientation, size, color, blockMargin, length }: SeparatorStyleArgs,\n): CSSObject => {\n const isHorizontal = orientation === 'horizontal';\n // `xs` is the 1px hairline: it stays one device-independent pixel at every\n // root size, like every other hairline in the package; heavier rules scale.\n const thicknessPx = separatorThickness(size);\n const thickness = thicknessPx === FIELD_BORDER_WIDTH ? `${FIELD_BORDER_WIDTH}px` : rem(theme, thicknessPx);\n const along = ruleLength(theme, length);\n const resolvedColor = color || theme.palette.divider;\n\n const baseStyles: CSSObject = {\n display: 'flex',\n alignItems: 'center',\n margin: blockMargin,\n width: isHorizontal ? along : thickness,\n height: isHorizontal ? thickness : along,\n boxSizing: 'border-box',\n };\n\n if (variant === 'gradient') {\n return {\n ...baseStyles,\n background: gradientBackground(variant, orientation, resolvedColor),\n };\n }\n\n return {\n ...baseStyles,\n backgroundColor: 'transparent',\n ...borderEdges(isHorizontal, thickness, borderStyleFor(variant), resolvedColor),\n };\n};\n"],"mappings":";;;;;;;;AAWA,IAAM,eAA8C;AAAA,EAClD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,IAAM,YAA2C;AAAA,EAC/C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,IAAM,qBAAqB,CAAC,SAC1B,aAAa,IAAI,KAAK,aAAa;AAG9B,IAAM,kBAAkB,CAC7B,MACA,WACoB,UAAU,UAAU,IAAI,KAAK,UAAU;AAI7D,IAAM,iBAAiB,CAAC,YAA6D;AACnF,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,IAAM,qBAAqB,CACzB,SACA,aACA,UACuB;AACvB,MAAI,YAAY,WAAY,QAAO;AACnC,QAAM,QAAQ,gBAAgB,eAAe,UAAU;AACvD,SAAO,mBAAmB,KAAK,qBAAqB,KAAK;AAC3D;AAIA,IAAM,cAAc,CAClB,cACA,WACA,OACA,UACc;AACd,QAAM,UAAU,eAAe,QAAQ;AACvC,QAAM,QAAmB;AAAA,IACvB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,IAChB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,gBAAgB;AA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AgB,SAAS,MAAM,QAAQ;AAE7C,QAAM,aAAwB;AAAA,IAC5B,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,OAAO,eAAe,QAAQ;AAAA,IAC9B,QAAQ,eAAe,YAAY;AAAA,IACnC,WAAW;AAAA,EACb;AAEA,MAAI,YAAY,YAAY;AAC1B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY,mBAAmB,SAAS,aAAa,aAAa;AAAA,IACpE;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,iBAAiB;AAAA,IACjB,GAAG,YAAY,cAAc,WAAW,eAAe,OAAO,GAAG,aAAa;AAAA,EAChF;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"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":";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,6BAA6B,QAAQ,6BAA6B;AAAA,MACnF,CAAC,oBAAoB,GAAG,EAAE,YAAY,wBAAwB;AAAA,MAC9D,+BAA+B;AAAA,QAC7B,WAAW,WAAW,cAAc;AAAA,QACpC,cAAc,WAAW,cAAc;AAAA,QACvC,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACC,GAAG,mBAAmB,MAAM;AAAA,IAE5B;AAAA;AACH;AAGG,IAAM,gBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA,YAAY;AAAA,EACZ,UAAU,eAAe;AAAA,EACzB,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,MAAM;AAC9B,YAAQ,WAAW;AAAA,MACjB,KAAK;AAAQ,eAAO;AAAA,MACpB,KAAK;AAAU,eAAO;AAAA,MACtB,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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/layout/Separator/Separator.tsx"],"sourcesContent":["import Box from '@mui/material/Box/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport { useTheme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport { labelledSeparatorLayout, separatorBlockMargin, separatorStyles } from './Separator.styles';\nimport type { SeparatorProps } from './Separator.types';\n\nexport const Separator: React.FC<SeparatorProps> = ({\n variant = 'solid',\n orientation = 'horizontal',\n size = 'md',\n color,\n margin,\n length,\n children,\n className,\n 'data-testid': dataTestId,\n}) => {\n const theme = useTheme();\n const isHorizontal = orientation === 'horizontal';\n const blockMargin = separatorBlockMargin(theme, size, margin, isHorizontal);\n const styles = separatorStyles(theme, { variant, orientation, size, color, blockMargin, length });\n\n if (children) {\n // The rules either side of the label sit INSIDE the row, which carries the\n // margin; their own would add it a second time.\n const layout = labelledSeparatorLayout(theme, isHorizontal, length);\n const ruleStyles = { ...styles, margin: 0, ...layout.rule };\n\n return (\n <Box\n className={className}\n // The plain branch below has always carried the caller's hook; this one\n // silently dropped it, so a LABELLED separator was the one variant no\n // test could address except through its own words.\n data-testid={dataTestId}\n sx={{\n display: 'flex',\n alignItems: 'center',\n margin: blockMargin,\n flexDirection: isHorizontal ? 'row' : 'column',\n gap: theme.spacing(2),\n ...layout.group,\n }}\n >\n <Box sx={ruleStyles} />\n {/*\n No background behind the label. The two rules and the words are a FLEX\n ROW — the rules stop where the label starts — so there is nothing for a\n background to mask, and painting one made the label a coloured pill on\n every surface that is not `background.default`. On a white card it read\n as a highlight nobody had asked for.\n */}\n <Typography\n variant=\"body2\"\n color=\"text.secondary\"\n sx={{ flexShrink: 0, padding: theme.spacing(0, 1) }}\n >\n {children}\n </Typography>\n <Box sx={ruleStyles} />\n </Box>\n );\n }\n\n return (\n <Box\n className={className}\n sx={styles}\n role=\"separator\"\n aria-orientation={orientation}\n data-testid={dataTestId}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA,OAAO,SAAS;AAChB,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AA6BnB,SAeE,KAfF;AAvBC,IAAM,YAAsC,CAAC;AAAA,EAClD,UAAU;AAAA,EACV,cAAc;AAAA,EACd,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,MAAM;AACJ,QAAM,QAAQ,SAAS;AACvB,QAAM,eAAe,gBAAgB;AACrC,QAAM,cAAc,qBAAqB,OAAO,MAAM,QAAQ,YAAY;AAC1E,QAAM,SAAS,gBAAgB,OAAO,EAAE,SAAS,aAAa,MAAM,OAAO,aAAa,OAAO,CAAC;AAEhG,MAAI,UAAU;AAGZ,UAAM,SAAS,wBAAwB,OAAO,cAAc,MAAM;AAClE,UAAM,aAAa,EAAE,GAAG,QAAQ,QAAQ,GAAG,GAAG,OAAO,KAAK;AAE1D,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QAIA,eAAa;AAAA,QACb,IAAI;AAAA,UACF,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,QAAQ;AAAA,UACR,eAAe,eAAe,QAAQ;AAAA,UACtC,KAAK,MAAM,QAAQ,CAAC;AAAA,UACpB,GAAG,OAAO;AAAA,QACZ;AAAA,QAEA;AAAA,8BAAC,OAAI,IAAI,YAAY;AAAA,UAQrB;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,OAAM;AAAA,cACN,IAAI,EAAE,YAAY,GAAG,SAAS,MAAM,QAAQ,GAAG,CAAC,EAAE;AAAA,cAEjD;AAAA;AAAA,UACH;AAAA,UACA,oBAAC,OAAI,IAAI,YAAY;AAAA;AAAA;AAAA,IACvB;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,IAAI;AAAA,MACJ,MAAK;AAAA,MACL,oBAAkB;AAAA,MAClB,eAAa;AAAA;AAAA,EACf;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
|