@12-apps/ui 6.39.13 → 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.
Files changed (45) hide show
  1. package/NATIVE.md +1 -1
  2. package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +7 -7
  3. package/dist/_internal/components/data-display/DataViews/DeleteViewDialog.js +3 -3
  4. package/dist/_internal/components/data-display/DataViews/ManageViewsDialog.js +3 -3
  5. package/dist/_internal/components/data-display/DataViews/SaveViewModal.js +3 -3
  6. package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +5 -5
  7. package/dist/_internal/components/feedback/Dialog/Dialog.js +2 -2
  8. package/dist/_internal/components/feedback/Dialog/Dialog.slots.js +10 -0
  9. package/dist/_internal/components/feedback/index.js +2 -2
  10. package/dist/_internal/components/index.js +3 -3
  11. package/dist/_internal/components/navigation/AppHeader/AppHeader.details.js +3 -3
  12. package/dist/_internal/components/navigation/index.js +3 -3
  13. package/dist/chunk-5HW37NSW.js +34 -0
  14. package/dist/chunk-5HW37NSW.js.map +1 -0
  15. package/dist/{chunk-INMKA5SF.js → chunk-ARDLCGBK.js} +3 -3
  16. package/dist/{chunk-UEROWH53.js → chunk-GAMLBJE6.js} +58 -39
  17. package/dist/chunk-GAMLBJE6.js.map +1 -0
  18. package/dist/{chunk-3333KCAW.js → chunk-P22W4N5K.js} +2 -2
  19. package/dist/{chunk-IYF246UA.js → chunk-SA65SDOY.js} +2 -2
  20. package/dist/{chunk-ZNDDILNQ.js → chunk-UBEAJFMW.js} +3 -3
  21. package/dist/{chunk-DXZOSP6P.js → chunk-WVJGNIJZ.js} +2 -2
  22. package/dist/{chunk-ECIHOZPK.js → chunk-WWGD5YVW.js} +2 -2
  23. package/dist/data-display/DataViews.js +7 -7
  24. package/dist/feedback/Dialog.js +2 -2
  25. package/dist/navigation/AppHeader.js +3 -3
  26. package/dist/types/components/feedback/Dialog/Dialog.d.ts.map +1 -1
  27. package/dist/types/components/feedback/Dialog/Dialog.slots.d.ts +43 -0
  28. package/dist/types/components/feedback/Dialog/Dialog.slots.d.ts.map +1 -0
  29. package/package.json +1 -1
  30. package/src/components/feedback/Dialog/Dialog.slots.ts +100 -0
  31. package/src/components/feedback/Dialog/Dialog.tsx +86 -34
  32. package/dist/_internal/components/feedback/Dialog/Dialog.paper.js +0 -8
  33. package/dist/chunk-UEROWH53.js.map +0 -1
  34. package/dist/chunk-Y4O4DITI.js +0 -25
  35. package/dist/chunk-Y4O4DITI.js.map +0 -1
  36. package/dist/types/components/feedback/Dialog/Dialog.paper.d.ts +0 -31
  37. package/dist/types/components/feedback/Dialog/Dialog.paper.d.ts.map +0 -1
  38. package/src/components/feedback/Dialog/Dialog.paper.ts +0 -64
  39. /package/dist/_internal/components/feedback/Dialog/{Dialog.paper.js.map → Dialog.slots.js.map} +0 -0
  40. /package/dist/{chunk-INMKA5SF.js.map → chunk-ARDLCGBK.js.map} +0 -0
  41. /package/dist/{chunk-3333KCAW.js.map → chunk-P22W4N5K.js.map} +0 -0
  42. /package/dist/{chunk-IYF246UA.js.map → chunk-SA65SDOY.js.map} +0 -0
  43. /package/dist/{chunk-ZNDDILNQ.js.map → chunk-UBEAJFMW.js.map} +0 -0
  44. /package/dist/{chunk-DXZOSP6P.js.map → chunk-WVJGNIJZ.js.map} +0 -0
  45. /package/dist/{chunk-ECIHOZPK.js.map → chunk-WWGD5YVW.js.map} +0 -0
@@ -3,8 +3,8 @@ import {
3
3
  } from "../chunk-I5T5PQQW.js";
4
4
  import {
5
5
  DataViewsTableBase
6
- } from "../chunk-ZNDDILNQ.js";
7
- import "../chunk-3333KCAW.js";
6
+ } from "../chunk-UBEAJFMW.js";
7
+ import "../chunk-P22W4N5K.js";
8
8
  import {
9
9
  DataViewsGrid
10
10
  } from "../chunk-5WT4YWXC.js";
@@ -68,9 +68,9 @@ import {
68
68
  cardScaleForZoom
69
69
  } from "../chunk-XZJM6EPC.js";
70
70
  import "../chunk-M4KVKQRN.js";
71
- import "../chunk-INMKA5SF.js";
72
- import "../chunk-IYF246UA.js";
73
- import "../chunk-ECIHOZPK.js";
71
+ import "../chunk-ARDLCGBK.js";
72
+ import "../chunk-SA65SDOY.js";
73
+ import "../chunk-WWGD5YVW.js";
74
74
  import "../chunk-5M4TYFR3.js";
75
75
  import "../chunk-HR7YTBR7.js";
76
76
  import "../chunk-DZEC6RFM.js";
@@ -164,9 +164,9 @@ import "../chunk-FWPFCK4D.js";
164
164
  import "../chunk-BJZOBG24.js";
165
165
  import "../chunk-EMYESBIT.js";
166
166
  import "../chunk-KFJKOVDD.js";
167
- import "../chunk-UEROWH53.js";
167
+ import "../chunk-GAMLBJE6.js";
168
168
  import "../chunk-2WU52FLP.js";
169
- import "../chunk-Y4O4DITI.js";
169
+ import "../chunk-5HW37NSW.js";
170
170
  import "../chunk-GVGJMH77.js";
171
171
  import "../chunk-GYXUCS37.js";
172
172
  import "../chunk-CN46HGXE.js";
@@ -4,9 +4,9 @@ import {
4
4
  DialogActions,
5
5
  DialogContent,
6
6
  DialogHeader
7
- } from "../chunk-UEROWH53.js";
7
+ } from "../chunk-GAMLBJE6.js";
8
8
  import "../chunk-2WU52FLP.js";
9
- import "../chunk-Y4O4DITI.js";
9
+ import "../chunk-5HW37NSW.js";
10
10
  import "../chunk-GVGJMH77.js";
11
11
  import "../chunk-GYXUCS37.js";
12
12
  import "../chunk-TYJR4GOF.js";
@@ -17,7 +17,7 @@ import {
17
17
  } from "../chunk-IQU4HKND.js";
18
18
  import {
19
19
  AppHeaderDetails
20
- } from "../chunk-DXZOSP6P.js";
20
+ } from "../chunk-WVJGNIJZ.js";
21
21
  import "../chunk-QXSV7Z57.js";
22
22
  import "../chunk-3U3H3BZM.js";
23
23
  import "../chunk-EJYJLVPK.js";
@@ -25,9 +25,9 @@ import "../chunk-FPVYD7BO.js";
25
25
  import "../chunk-LYVTJLCF.js";
26
26
  import "../chunk-CRN4KKNI.js";
27
27
  import "../chunk-IM4DMKH4.js";
28
- import "../chunk-UEROWH53.js";
28
+ import "../chunk-GAMLBJE6.js";
29
29
  import "../chunk-2WU52FLP.js";
30
- import "../chunk-Y4O4DITI.js";
30
+ import "../chunk-5HW37NSW.js";
31
31
  import "../chunk-GVGJMH77.js";
32
32
  import "../chunk-GYXUCS37.js";
33
33
  import "../chunk-HM2JJNUE.js";
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/Dialog/Dialog.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AA6ExB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA2ExC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqEpD,CAAC;AA0BF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsBpD,CAAC;AAEJ,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6BtD,CAAC"}
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/Dialog/Dialog.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,KAAK,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAwIxB,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAoExC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqEpD,CAAC;AA0BF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsBpD,CAAC;AAEJ,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6BtD,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { SxProps, Theme } from '@mui/material/styles/index.js';
2
+ /**
3
+ * A caller's slot props, MERGED over the Dialog's own rather than replacing
4
+ * them — for the paper (FUT-2613) and the backdrop (FUT-2672).
5
+ *
6
+ * MUI reaches each slot through two props, and both used to replace ours
7
+ * whole: the deprecated `PaperProps`/`BackdropProps` (spread after ours) and
8
+ * `slotProps.paper`/`slotProps.backdrop` (which MUI itself puts over the
9
+ * deprecated one). A caller asking for one class, or one `sx` tweak, lost the
10
+ * variant's radius, width, background and the paper's test id with it — or,
11
+ * on the backdrop, the scrim and the `glass` blur.
12
+ *
13
+ * Only the keys the merge reads are typed here; every other key the caller
14
+ * passed rides the spread through untouched.
15
+ */
16
+ interface SlotValue {
17
+ sx?: SxProps<Theme>;
18
+ className?: string;
19
+ }
20
+ interface PaperSlotValue extends SlotValue {
21
+ 'data-testid'?: string;
22
+ }
23
+ /** A slot as MUI takes it: an object, or a function of the owner state. */
24
+ type Slot<V, O> = V | ((ownerState: O) => V);
25
+ /**
26
+ * The paper slot: the variant's `look`, then `PaperProps`, then
27
+ * `slotProps.paper`.
28
+ *
29
+ * `testId` names the paper unless the caller's props name it; the drawer passes
30
+ * none, because its id already sits on the Drawer root.
31
+ */
32
+ export declare function mergedPaperSlot<O>(look: SxProps<Theme>, testId: string | undefined, legacy: PaperSlotValue | undefined, slot: Slot<PaperSlotValue, O> | undefined): Slot<PaperSlotValue, O>;
33
+ /**
34
+ * The backdrop slot: the scrim (`backdropSxOf`), then `BackdropProps`, then
35
+ * `slotProps.backdrop`. Both renderers need it: MUI's `Dialog` would replace
36
+ * our backdrop props with a caller's, and MUI's `Drawer` takes
37
+ * `slotProps.backdrop` INSTEAD of `BackdropProps` whenever it is given — so
38
+ * once the scrim rides `slotProps.backdrop`, a caller's `BackdropProps` would
39
+ * silently drop unless it is folded in here.
40
+ */
41
+ export declare function mergedBackdropSlot<O>(look: SxProps<Theme>, legacy: SlotValue | undefined, slot: Slot<SlotValue, O> | undefined): Slot<SlotValue, O>;
42
+ export {};
43
+ //# sourceMappingURL=Dialog.slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.slots.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/Dialog/Dialog.slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,UAAU,SAAS;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAe,SAAQ,SAAS;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,2EAA2E;AAC3E,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAuC7C;;;;;;GAMG;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,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,GAAG,SAAS,GACxC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAMzB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EACpB,MAAM,EAAE,SAAS,GAAG,SAAS,EAC7B,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,GAAG,SAAS,GACnC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAEpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12-apps/ui",
3
- "version": "6.39.13",
3
+ "version": "6.39.14",
4
4
  "license": "MIT",
5
5
  "packageManager": "pnpm@10.34.5",
6
6
  "type": "module",
@@ -0,0 +1,100 @@
1
+ import type { SxProps, Theme } from '@mui/material/styles/index.js';
2
+
3
+ /**
4
+ * A caller's slot props, MERGED over the Dialog's own rather than replacing
5
+ * them — for the paper (FUT-2613) and the backdrop (FUT-2672).
6
+ *
7
+ * MUI reaches each slot through two props, and both used to replace ours
8
+ * whole: the deprecated `PaperProps`/`BackdropProps` (spread after ours) and
9
+ * `slotProps.paper`/`slotProps.backdrop` (which MUI itself puts over the
10
+ * deprecated one). A caller asking for one class, or one `sx` tweak, lost the
11
+ * variant's radius, width, background and the paper's test id with it — or,
12
+ * on the backdrop, the scrim and the `glass` blur.
13
+ *
14
+ * Only the keys the merge reads are typed here; every other key the caller
15
+ * passed rides the spread through untouched.
16
+ */
17
+ interface SlotValue {
18
+ sx?: SxProps<Theme>;
19
+ className?: string;
20
+ }
21
+
22
+ interface PaperSlotValue extends SlotValue {
23
+ 'data-testid'?: string;
24
+ }
25
+
26
+ /** A slot as MUI takes it: an object, or a function of the owner state. */
27
+ type Slot<V, O> = V | ((ownerState: O) => V);
28
+
29
+ /** Our look first, then whatever `sx` the caller adds — so the caller's escape hatch still wins. */
30
+ function sxList(caller: SxProps<Theme> | undefined): readonly unknown[] {
31
+ if (caller === undefined) return [];
32
+ return Array.isArray(caller) ? caller : [caller];
33
+ }
34
+
35
+ function mergeOver<V extends SlotValue>(
36
+ look: SxProps<Theme>,
37
+ legacy: V | undefined,
38
+ slot: V | undefined,
39
+ ): V {
40
+ // MUI's own order: `slotProps.<slot>` over the deprecated `<Slot>Props`.
41
+ return {
42
+ ...legacy,
43
+ ...slot,
44
+ sx: [look, ...sxList(legacy?.sx), ...sxList(slot?.sx)] as SxProps<Theme>,
45
+ } as V;
46
+ }
47
+
48
+ /**
49
+ * The one slot to hand MUI: the Dialog's `look`, then the deprecated prop,
50
+ * then `slotProps.<slot>`, each value passed through `finish`. A function slot
51
+ * stays a function, so MUI still calls it with its owner state and its result
52
+ * merges the same way.
53
+ */
54
+ function mergedSlot<V extends SlotValue, O>(
55
+ look: SxProps<Theme>,
56
+ legacy: V | undefined,
57
+ slot: Slot<V, O> | undefined,
58
+ finish: (merged: V) => V = (merged) => merged,
59
+ ): Slot<V, O> {
60
+ if (typeof slot === 'function') {
61
+ return (ownerState: O) => finish(mergeOver(look, legacy, slot(ownerState)));
62
+ }
63
+ return finish(mergeOver(look, legacy, slot));
64
+ }
65
+
66
+ /**
67
+ * The paper slot: the variant's `look`, then `PaperProps`, then
68
+ * `slotProps.paper`.
69
+ *
70
+ * `testId` names the paper unless the caller's props name it; the drawer passes
71
+ * none, because its id already sits on the Drawer root.
72
+ */
73
+ export function mergedPaperSlot<O>(
74
+ look: SxProps<Theme>,
75
+ testId: string | undefined,
76
+ legacy: PaperSlotValue | undefined,
77
+ slot: Slot<PaperSlotValue, O> | undefined,
78
+ ): Slot<PaperSlotValue, O> {
79
+ return mergedSlot(look, legacy, slot, (merged) => ({
80
+ ...merged,
81
+ // A key the caller set to `undefined` does not erase the dialog's id.
82
+ 'data-testid': merged['data-testid'] ?? testId,
83
+ }));
84
+ }
85
+
86
+ /**
87
+ * The backdrop slot: the scrim (`backdropSxOf`), then `BackdropProps`, then
88
+ * `slotProps.backdrop`. Both renderers need it: MUI's `Dialog` would replace
89
+ * our backdrop props with a caller's, and MUI's `Drawer` takes
90
+ * `slotProps.backdrop` INSTEAD of `BackdropProps` whenever it is given — so
91
+ * once the scrim rides `slotProps.backdrop`, a caller's `BackdropProps` would
92
+ * silently drop unless it is folded in here.
93
+ */
94
+ export function mergedBackdropSlot<O>(
95
+ look: SxProps<Theme>,
96
+ legacy: SlotValue | undefined,
97
+ slot: Slot<SlotValue, O> | undefined,
98
+ ): Slot<SlotValue, O> {
99
+ return mergedSlot(look, legacy, slot);
100
+ }
@@ -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.paper';
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
- paperSx: SxProps<Theme>;
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={{ ...slotProps, paper: mergedPaperSlot(paperSx, undefined, callerPaper, slotProps?.paper) }}
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 { PaperProps: callerPaper, slotProps, ...props } = withoutTestIdProps(others);
134
- const paperSx = variantStylesOf(theme, {
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
- <MuiDialog
171
- open={open}
172
- onClose={handleClose}
173
- fullScreen={variant === 'fullscreen'}
174
- BackdropComponent={backdrop ? Backdrop : undefined}
175
- BackdropProps={{ sx: backdropSxOf(theme, glass) }}
176
- {...props}
177
- slotProps={{ ...slotProps, paper: mergedPaperSlot(paperSx, testId, callerPaper, slotProps?.paper) }}
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
- </MuiDialog>
233
+ </ModalDialog>
182
234
  );
183
235
  };
184
236
 
@@ -1,8 +0,0 @@
1
- import {
2
- mergedPaperSlot
3
- } from "../../../../chunk-Y4O4DITI.js";
4
- import "../../../../chunk-PZ5AY32C.js";
5
- export {
6
- mergedPaperSlot
7
- };
8
- //# sourceMappingURL=Dialog.paper.js.map
@@ -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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","names":[]}
@@ -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
- }