@12-apps/ui 6.78.2 → 6.78.3
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/dist/_internal/components/data-display/CardKit/use-remove-confirm.js +5 -5
- package/dist/_internal/components/data-display/CardKit/use-row-confirm.js +5 -5
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +7 -7
- package/dist/_internal/components/data-display/DataViews/ManageViewsDialog.js +5 -5
- package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +6 -6
- package/dist/_internal/components/feedback/ConfirmAction/ConfirmAction.js +2 -2
- package/dist/_internal/components/feedback/ConfirmAction/ConfirmAction.parts.js +5 -3
- package/dist/_internal/components/feedback/ConfirmAction/ConfirmButton.js +3 -3
- package/dist/_internal/components/feedback/ConfirmAction/with-confirmation.js +2 -2
- package/dist/_internal/components/feedback/index.js +4 -4
- package/dist/_internal/components/index.js +4 -4
- package/dist/{chunk-XGKUXYAD.js → chunk-3Z3WIQ5M.js} +2 -2
- package/dist/{chunk-Z7COWR4K.js → chunk-5M2NWXN4.js} +2 -2
- package/dist/{chunk-6J7RGNSF.js → chunk-7HA7UH7O.js} +2 -2
- package/dist/{chunk-C7CIUDXZ.js → chunk-7JOLSD2W.js} +2 -2
- package/dist/{chunk-QBH36OBQ.js → chunk-BWFUZ4N2.js} +2 -2
- package/dist/{chunk-SFT4YN6O.js → chunk-FCVPVEAS.js} +2 -2
- package/dist/{chunk-KYTADPS2.js → chunk-GRMBCJS6.js} +2 -2
- package/dist/{chunk-K44FSPU7.js → chunk-LBZEPWYK.js} +2 -2
- package/dist/{chunk-LTLOZQPP.js → chunk-MM7BPTVV.js} +11 -3
- package/dist/chunk-MM7BPTVV.js.map +1 -0
- package/dist/data-display/CardKit.js +6 -6
- package/dist/data-display/DataViews.js +7 -7
- package/dist/feedback/ConfirmAction.js +4 -4
- package/dist/types/components/feedback/ConfirmAction/ConfirmAction.parts.d.ts +6 -0
- package/dist/types/components/feedback/ConfirmAction/ConfirmAction.parts.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/feedback/ConfirmAction/ConfirmAction.md +3 -2
- package/src/components/feedback/ConfirmAction/ConfirmAction.parts.tsx +17 -3
- package/dist/chunk-LTLOZQPP.js.map +0 -1
- /package/dist/{chunk-XGKUXYAD.js.map → chunk-3Z3WIQ5M.js.map} +0 -0
- /package/dist/{chunk-Z7COWR4K.js.map → chunk-5M2NWXN4.js.map} +0 -0
- /package/dist/{chunk-6J7RGNSF.js.map → chunk-7HA7UH7O.js.map} +0 -0
- /package/dist/{chunk-C7CIUDXZ.js.map → chunk-7JOLSD2W.js.map} +0 -0
- /package/dist/{chunk-QBH36OBQ.js.map → chunk-BWFUZ4N2.js.map} +0 -0
- /package/dist/{chunk-SFT4YN6O.js.map → chunk-FCVPVEAS.js.map} +0 -0
- /package/dist/{chunk-KYTADPS2.js.map → chunk-GRMBCJS6.js.map} +0 -0
- /package/dist/{chunk-K44FSPU7.js.map → chunk-LBZEPWYK.js.map} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useRemoveConfirm
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-3Z3WIQ5M.js";
|
|
5
5
|
import "../../../../chunk-RCTHCXS6.js";
|
|
6
6
|
import "../../../../chunk-XCBQXSTR.js";
|
|
7
|
-
import "../../../../chunk-
|
|
8
|
-
import "../../../../chunk-
|
|
9
|
-
import "../../../../chunk-
|
|
10
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-5M2NWXN4.js";
|
|
8
|
+
import "../../../../chunk-BWFUZ4N2.js";
|
|
9
|
+
import "../../../../chunk-LBZEPWYK.js";
|
|
10
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
11
11
|
import "../../../../chunk-EMYESBIT.js";
|
|
12
12
|
import "../../../../chunk-LZRVUOMU.js";
|
|
13
13
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
useRowConfirm
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-GRMBCJS6.js";
|
|
5
5
|
import "../../../../chunk-XCBQXSTR.js";
|
|
6
|
-
import "../../../../chunk-
|
|
7
|
-
import "../../../../chunk-
|
|
8
|
-
import "../../../../chunk-
|
|
9
|
-
import "../../../../chunk-
|
|
6
|
+
import "../../../../chunk-5M2NWXN4.js";
|
|
7
|
+
import "../../../../chunk-BWFUZ4N2.js";
|
|
8
|
+
import "../../../../chunk-LBZEPWYK.js";
|
|
9
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
10
10
|
import "../../../../chunk-EMYESBIT.js";
|
|
11
11
|
import "../../../../chunk-LZRVUOMU.js";
|
|
12
12
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DataViewsTableBase
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-FCVPVEAS.js";
|
|
5
5
|
import "../../../../chunk-4HUSG5MR.js";
|
|
6
6
|
import "../../../../chunk-LI6XSM5D.js";
|
|
7
7
|
import "../../../../chunk-ZOLAYP2D.js";
|
|
@@ -30,9 +30,9 @@ import "../../../../chunk-33MMQHYU.js";
|
|
|
30
30
|
import "../../../../chunk-7D7CJRL7.js";
|
|
31
31
|
import "../../../../chunk-GCZJH4XL.js";
|
|
32
32
|
import "../../../../chunk-CBOB5AV6.js";
|
|
33
|
-
import "../../../../chunk-
|
|
33
|
+
import "../../../../chunk-7HA7UH7O.js";
|
|
34
34
|
import "../../../../chunk-LG52LMAM.js";
|
|
35
|
-
import "../../../../chunk-
|
|
35
|
+
import "../../../../chunk-7JOLSD2W.js";
|
|
36
36
|
import "../../../../chunk-5M4TYFR3.js";
|
|
37
37
|
import "../../../../chunk-O36MIQIO.js";
|
|
38
38
|
import "../../../../chunk-M3DSPEZ3.js";
|
|
@@ -129,10 +129,10 @@ import "../../../../chunk-PN4HVM43.js";
|
|
|
129
129
|
import "../../../../chunk-C3UKR3NT.js";
|
|
130
130
|
import "../../../../chunk-D6KL74KI.js";
|
|
131
131
|
import "../../../../chunk-XCBQXSTR.js";
|
|
132
|
-
import "../../../../chunk-
|
|
133
|
-
import "../../../../chunk-
|
|
134
|
-
import "../../../../chunk-
|
|
135
|
-
import "../../../../chunk-
|
|
132
|
+
import "../../../../chunk-5M2NWXN4.js";
|
|
133
|
+
import "../../../../chunk-BWFUZ4N2.js";
|
|
134
|
+
import "../../../../chunk-LBZEPWYK.js";
|
|
135
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
136
136
|
import "../../../../chunk-EMYESBIT.js";
|
|
137
137
|
import "../../../../chunk-LZRVUOMU.js";
|
|
138
138
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
ManageViewsDialog
|
|
4
|
-
} from "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-7JOLSD2W.js";
|
|
5
5
|
import "../../../../chunk-KHG57NAE.js";
|
|
6
6
|
import "../../../../chunk-XCBQXSTR.js";
|
|
7
|
-
import "../../../../chunk-
|
|
8
|
-
import "../../../../chunk-
|
|
9
|
-
import "../../../../chunk-
|
|
10
|
-
import "../../../../chunk-
|
|
7
|
+
import "../../../../chunk-5M2NWXN4.js";
|
|
8
|
+
import "../../../../chunk-BWFUZ4N2.js";
|
|
9
|
+
import "../../../../chunk-LBZEPWYK.js";
|
|
10
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
11
11
|
import "../../../../chunk-EMYESBIT.js";
|
|
12
12
|
import "../../../../chunk-LZRVUOMU.js";
|
|
13
13
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
ViewDialogs,
|
|
4
4
|
ViewMutationErrorAlert,
|
|
5
5
|
ViewsMenuSlot
|
|
6
|
-
} from "../../../../chunk-
|
|
6
|
+
} from "../../../../chunk-7HA7UH7O.js";
|
|
7
7
|
import "../../../../chunk-LG52LMAM.js";
|
|
8
|
-
import "../../../../chunk-
|
|
8
|
+
import "../../../../chunk-7JOLSD2W.js";
|
|
9
9
|
import "../../../../chunk-5M4TYFR3.js";
|
|
10
10
|
import "../../../../chunk-DUVH273U.js";
|
|
11
11
|
import "../../../../chunk-KHG57NAE.js";
|
|
@@ -32,10 +32,10 @@ import "../../../../chunk-MO4FFK62.js";
|
|
|
32
32
|
import "../../../../chunk-4AJY7HMH.js";
|
|
33
33
|
import "../../../../chunk-KLJYIS5L.js";
|
|
34
34
|
import "../../../../chunk-XCBQXSTR.js";
|
|
35
|
-
import "../../../../chunk-
|
|
36
|
-
import "../../../../chunk-
|
|
37
|
-
import "../../../../chunk-
|
|
38
|
-
import "../../../../chunk-
|
|
35
|
+
import "../../../../chunk-5M2NWXN4.js";
|
|
36
|
+
import "../../../../chunk-BWFUZ4N2.js";
|
|
37
|
+
import "../../../../chunk-LBZEPWYK.js";
|
|
38
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
39
39
|
import "../../../../chunk-EMYESBIT.js";
|
|
40
40
|
import "../../../../chunk-LZRVUOMU.js";
|
|
41
41
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfirmAction
|
|
3
|
-
} from "../../../../chunk-
|
|
4
|
-
import "../../../../chunk-
|
|
3
|
+
} from "../../../../chunk-BWFUZ4N2.js";
|
|
4
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
5
5
|
import "../../../../chunk-EMYESBIT.js";
|
|
6
6
|
import "../../../../chunk-LZRVUOMU.js";
|
|
7
7
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ConfirmActionDialog
|
|
3
|
-
|
|
2
|
+
ConfirmActionDialog,
|
|
3
|
+
typedMatches
|
|
4
|
+
} from "../../../../chunk-MM7BPTVV.js";
|
|
4
5
|
import "../../../../chunk-LZRVUOMU.js";
|
|
5
6
|
import "../../../../chunk-EEB66IVH.js";
|
|
6
7
|
import "../../../../chunk-2IBFEHIX.js";
|
|
@@ -13,6 +14,7 @@ import "../../../../chunk-N3GAFIXG.js";
|
|
|
13
14
|
import "../../../../chunk-YKCAJ2TN.js";
|
|
14
15
|
import "../../../../chunk-PZ5AY32C.js";
|
|
15
16
|
export {
|
|
16
|
-
ConfirmActionDialog
|
|
17
|
+
ConfirmActionDialog,
|
|
18
|
+
typedMatches
|
|
17
19
|
};
|
|
18
20
|
//# sourceMappingURL=ConfirmAction.parts.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createConfirmButton
|
|
3
|
-
} from "../../../../chunk-
|
|
4
|
-
import "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
3
|
+
} from "../../../../chunk-5M2NWXN4.js";
|
|
4
|
+
import "../../../../chunk-LBZEPWYK.js";
|
|
5
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
6
6
|
import "../../../../chunk-EMYESBIT.js";
|
|
7
7
|
import "../../../../chunk-LZRVUOMU.js";
|
|
8
8
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withConfirmation
|
|
3
|
-
} from "../../../../chunk-
|
|
4
|
-
import "../../../../chunk-
|
|
3
|
+
} from "../../../../chunk-LBZEPWYK.js";
|
|
4
|
+
import "../../../../chunk-MM7BPTVV.js";
|
|
5
5
|
import "../../../../chunk-EMYESBIT.js";
|
|
6
6
|
import "../../../../chunk-LZRVUOMU.js";
|
|
7
7
|
import "../../../../chunk-EEB66IVH.js";
|
|
@@ -68,16 +68,16 @@ import {
|
|
|
68
68
|
import "../../../chunk-XCBQXSTR.js";
|
|
69
69
|
import {
|
|
70
70
|
createConfirmButton
|
|
71
|
-
} from "../../../chunk-
|
|
71
|
+
} from "../../../chunk-5M2NWXN4.js";
|
|
72
72
|
import {
|
|
73
73
|
ConfirmAction
|
|
74
|
-
} from "../../../chunk-
|
|
74
|
+
} from "../../../chunk-BWFUZ4N2.js";
|
|
75
75
|
import {
|
|
76
76
|
withConfirmation
|
|
77
|
-
} from "../../../chunk-
|
|
77
|
+
} from "../../../chunk-LBZEPWYK.js";
|
|
78
78
|
import {
|
|
79
79
|
ConfirmActionDialog
|
|
80
|
-
} from "../../../chunk-
|
|
80
|
+
} from "../../../chunk-MM7BPTVV.js";
|
|
81
81
|
import {
|
|
82
82
|
useConfirmAction
|
|
83
83
|
} from "../../../chunk-EMYESBIT.js";
|
|
@@ -681,16 +681,16 @@ import {
|
|
|
681
681
|
import "../../chunk-XCBQXSTR.js";
|
|
682
682
|
import {
|
|
683
683
|
createConfirmButton
|
|
684
|
-
} from "../../chunk-
|
|
684
|
+
} from "../../chunk-5M2NWXN4.js";
|
|
685
685
|
import {
|
|
686
686
|
ConfirmAction
|
|
687
|
-
} from "../../chunk-
|
|
687
|
+
} from "../../chunk-BWFUZ4N2.js";
|
|
688
688
|
import {
|
|
689
689
|
withConfirmation
|
|
690
|
-
} from "../../chunk-
|
|
690
|
+
} from "../../chunk-LBZEPWYK.js";
|
|
691
691
|
import {
|
|
692
692
|
ConfirmActionDialog
|
|
693
|
-
} from "../../chunk-
|
|
693
|
+
} from "../../chunk-MM7BPTVV.js";
|
|
694
694
|
import {
|
|
695
695
|
useConfirmAction
|
|
696
696
|
} from "../../chunk-EMYESBIT.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-RCTHCXS6.js";
|
|
4
4
|
import {
|
|
5
5
|
ConfirmActionDialog
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MM7BPTVV.js";
|
|
7
7
|
import {
|
|
8
8
|
useConfirmAction
|
|
9
9
|
} from "./chunk-EMYESBIT.js";
|
|
@@ -50,4 +50,4 @@ function useRemoveConfirm({
|
|
|
50
50
|
export {
|
|
51
51
|
useRemoveConfirm
|
|
52
52
|
};
|
|
53
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-3Z3WIQ5M.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withConfirmation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LBZEPWYK.js";
|
|
4
4
|
import {
|
|
5
5
|
Button
|
|
6
6
|
} from "./chunk-5USHYSCO.js";
|
|
@@ -18,4 +18,4 @@ function createConfirmButton(copy, errorText) {
|
|
|
18
18
|
export {
|
|
19
19
|
createConfirmButton
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-5M2NWXN4.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-LG52LMAM.js";
|
|
4
4
|
import {
|
|
5
5
|
ManageViewsDialog
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7JOLSD2W.js";
|
|
7
7
|
import {
|
|
8
8
|
useDataViewsCopy
|
|
9
9
|
} from "./chunk-KHG57NAE.js";
|
|
@@ -121,4 +121,4 @@ export {
|
|
|
121
121
|
ViewsMenuSlot,
|
|
122
122
|
ViewDialogs
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-7HA7UH7O.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-KHG57NAE.js";
|
|
4
4
|
import {
|
|
5
5
|
createConfirmButton
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5M2NWXN4.js";
|
|
7
7
|
import {
|
|
8
8
|
Dialog,
|
|
9
9
|
DialogContent
|
|
@@ -128,4 +128,4 @@ function ManageViewsDialog({
|
|
|
128
128
|
export {
|
|
129
129
|
ManageViewsDialog
|
|
130
130
|
};
|
|
131
|
-
//# sourceMappingURL=chunk-
|
|
131
|
+
//# sourceMappingURL=chunk-7JOLSD2W.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfirmActionDialog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MM7BPTVV.js";
|
|
4
4
|
import {
|
|
5
5
|
useConfirmAction
|
|
6
6
|
} from "./chunk-EMYESBIT.js";
|
|
@@ -23,4 +23,4 @@ ConfirmAction.displayName = "ConfirmAction";
|
|
|
23
23
|
export {
|
|
24
24
|
ConfirmAction
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-BWFUZ4N2.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
ViewDialogs,
|
|
12
12
|
ViewMutationErrorAlert
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-7HA7UH7O.js";
|
|
14
14
|
import {
|
|
15
15
|
useUrlEchoGuard,
|
|
16
16
|
useUrlSyncState
|
|
@@ -166,4 +166,4 @@ function renderViewDialogs(ctl, fields, columns, views, testIdPrefix, onSaved) {
|
|
|
166
166
|
export {
|
|
167
167
|
DataViewsTableBase
|
|
168
168
|
};
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-FCVPVEAS.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfirmActionDialog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MM7BPTVV.js";
|
|
4
4
|
import {
|
|
5
5
|
useConfirmAction
|
|
6
6
|
} from "./chunk-EMYESBIT.js";
|
|
@@ -43,4 +43,4 @@ function useRowConfirm({
|
|
|
43
43
|
export {
|
|
44
44
|
useRowConfirm
|
|
45
45
|
};
|
|
46
|
-
//# sourceMappingURL=chunk-
|
|
46
|
+
//# sourceMappingURL=chunk-GRMBCJS6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfirmActionDialog
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MM7BPTVV.js";
|
|
4
4
|
import {
|
|
5
5
|
useConfirmAction
|
|
6
6
|
} from "./chunk-EMYESBIT.js";
|
|
@@ -40,4 +40,4 @@ function withConfirmation(Wrapped, defaults) {
|
|
|
40
40
|
export {
|
|
41
41
|
withConfirmation
|
|
42
42
|
};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-LBZEPWYK.js.map
|
|
@@ -23,6 +23,9 @@ function resolveInitialFocus(tone, initialFocus) {
|
|
|
23
23
|
if (initialFocus) return initialFocus;
|
|
24
24
|
return tone === "destructive" ? "cancel" : "confirm";
|
|
25
25
|
}
|
|
26
|
+
function typedMatches(typed, expected) {
|
|
27
|
+
return typed.trim().toLocaleLowerCase("pt-BR") === expected.trim().toLocaleLowerCase("pt-BR");
|
|
28
|
+
}
|
|
26
29
|
function TypeToConfirmField({
|
|
27
30
|
expected,
|
|
28
31
|
label,
|
|
@@ -43,7 +46,11 @@ function TypeToConfirmField({
|
|
|
43
46
|
onChange: (event) => onChange(event.target.value),
|
|
44
47
|
inputProps: {
|
|
45
48
|
"aria-label": label ?? copy.typeToConfirm(expected),
|
|
46
|
-
"data-testid": `${dataTestId}-type-to-confirm
|
|
49
|
+
"data-testid": `${dataTestId}-type-to-confirm`,
|
|
50
|
+
// A word to copy, not prose: the phone keeps its hands off it.
|
|
51
|
+
autoCapitalize: "none",
|
|
52
|
+
autoCorrect: "off",
|
|
53
|
+
spellCheck: false
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
)
|
|
@@ -67,7 +74,7 @@ function ConfirmActionDialog({
|
|
|
67
74
|
React.useEffect(() => {
|
|
68
75
|
if (state.open) setTyped("");
|
|
69
76
|
}, [state.open]);
|
|
70
|
-
const gateUnmet = typeToConfirm !== void 0 && typed
|
|
77
|
+
const gateUnmet = typeToConfirm !== void 0 && !typedMatches(typed, typeToConfirm);
|
|
71
78
|
return /* @__PURE__ */ jsxs(
|
|
72
79
|
AlertDialog,
|
|
73
80
|
{
|
|
@@ -104,6 +111,7 @@ function ConfirmActionDialog({
|
|
|
104
111
|
}
|
|
105
112
|
|
|
106
113
|
export {
|
|
114
|
+
typedMatches,
|
|
107
115
|
ConfirmActionDialog
|
|
108
116
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
117
|
+
//# sourceMappingURL=chunk-MM7BPTVV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/feedback/ConfirmAction/ConfirmAction.parts.tsx"],"sourcesContent":["import type { ConfirmActionCopy } from \"../../../copy\";\nimport Alert from '@mui/material/Alert/index.js';\nimport Stack from '@mui/material/Stack/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport React, { type ReactNode } from 'react';\n\nimport { AlertDialog } from '../../data-display/AlertDialog';\nimport { OutlinedTextFieldSlim } from '../../form/Input/outlined/text-field-slim-outlined';\n\nimport type {\n ConfirmInitialFocus,\n ConfirmOptions,\n ConfirmTone,\n UseConfirmActionResult,\n} from './ConfirmAction.types';\n\nconst DEFAULT_TEST_ID = 'confirm-action';\n\n/**\n * The popup's body: the row being acted on, then what happens to it.\n *\n * The NAME is rendered in its own right rather than woven into the sentence, so\n * it is there whatever the caller wrote — \"the popup names the specific entity\"\n * is the one thing that must not depend on each call site remembering to\n * mention it. A body with neither a name nor a description would leave the\n * operator with only the title to decide on, so a neutral fallback covers that.\n */\nfunction confirmBody(\n description: ReactNode,\n copy: ConfirmActionCopy,\n entityName?: string,\n): ReactNode {\n if (!entityName) return description ?? copy.irreversible;\n return (\n <>\n <Typography component=\"span\" sx={{ fontWeight: 600, display: \"block\" }}>\n {entityName}\n </Typography>\n {description}\n </>\n );\n}\n\n/** Destructive dialogs open on Cancel; anything else opens on the confirm. */\nfunction resolveInitialFocus(\n tone: ConfirmTone,\n initialFocus?: ConfirmInitialFocus,\n): ConfirmInitialFocus {\n if (initialFocus) return initialFocus;\n return tone === 'destructive' ? 'cancel' : 'confirm';\n}\n\n/**\n * Whether what was typed is the word asked for — trimmed, and in any case.\n * The gate is a pause, not a spelling test: a phone's automatic capital C\n * (\"Confirmar\") or a held Caps Lock must not lock the act (FUT-3905).\n */\nexport function typedMatches(typed: string, expected: string): boolean {\n return typed.trim().toLocaleLowerCase('pt-BR') === expected.trim().toLocaleLowerCase('pt-BR');\n}\n\n/**\n * The type-to-confirm field. Rendered only when `typeToConfirm` is set, which\n * should be rare: it is the guard for actions with NO recovery path, where a\n * click is too cheap a gesture. Comparison ignores case and surrounding\n * whitespace ({@link typedMatches}): a phone capitalises the first letter, and\n * \"Confirmar\" must unlock what \"confirmar\" does (FUT-3905).\n */\nfunction TypeToConfirmField({\n expected,\n label,\n value,\n onChange,\n disabled,\n dataTestId,\n copy,\n}: {\n expected: string;\n label?: string;\n /** The words this prompt renders. REQUIRED — no default copy. */\n copy: ConfirmActionCopy;\n value: string;\n onChange: (next: string) => void;\n disabled: boolean;\n dataTestId: string;\n}): React.ReactElement {\n return (\n <Stack spacing={1} sx={{ mt: 2 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {label ?? copy.typeToConfirm(expected)}\n </Typography>\n {/*\n * The outlined slim field, not MUI's `TextField` (FUT-3429): same\n * composition and DOM, but no `Select` branch, so a screen that can open\n * this popup no longer ships `Select`, `Menu`, `MenuList`, `NativeSelect`\n * and `List` for a box that only ever takes a word.\n */}\n <OutlinedTextFieldSlim\n size=\"small\"\n value={value}\n disabled={disabled}\n onChange={(event) => onChange(event.target.value)}\n // On the INPUT rather than the wrapper: a test id on MUI's TextField\n // lands on the outer div, which is not the node a test can type into.\n inputProps={{\n 'aria-label': label ?? copy.typeToConfirm(expected),\n 'data-testid': `${dataTestId}-type-to-confirm`,\n // A word to copy, not prose: the phone keeps its hands off it.\n autoCapitalize: 'none',\n autoCorrect: 'off',\n spellCheck: false,\n }}\n />\n </Stack>\n );\n}\n\nexport interface ConfirmActionDialogProps extends ConfirmOptions {\n /** The fallback body when no entity is named. REQUIRED — no default copy. */\n copy: ConfirmActionCopy;\n state: UseConfirmActionResult;\n}\n\n/**\n * The popup itself: an `AlertDialog` in its destructive skin, plus the two\n * things a bare AlertDialog has no opinion about — the failure the last attempt\n * produced (shown IN the dialog, which stays open, rather than closing over a\n * write that never landed) and the optional type-to-confirm gate.\n */\nexport function ConfirmActionDialog({\n state,\n title,\n description,\n entityName,\n confirmText,\n cancelText,\n typeToConfirm,\n typeToConfirmLabel,\n tone = 'destructive',\n initialFocus,\n dataTestId = DEFAULT_TEST_ID,\n copy,\n}: ConfirmActionDialogProps): React.ReactElement {\n const [typed, setTyped] = React.useState('');\n\n // Every fresh open starts from an empty field: carrying the previous answer\n // over would hand the next delete a pre-satisfied gate.\n React.useEffect(() => {\n if (state.open) setTyped('');\n }, [state.open]);\n\n const gateUnmet = typeToConfirm !== undefined && !typedMatches(typed, typeToConfirm);\n\n return (\n <AlertDialog\n open={state.open}\n variant={tone === 'destructive' ? 'destructive' : 'default'}\n title={title}\n description={confirmBody(description, copy, entityName)}\n confirmText={confirmText}\n // `copy.cancel` is the fallback, NOT `AlertDialog`'s own. The 6.3.0 copy\n // sweep deleted this component's `cancelText = 'Cancelar'` default and\n // put the word in `ConfirmActionCopy` — where nothing then read it, so\n // every confirmation that names no `cancelText` of its own fell through\n // to `AlertDialog`'s English `'Cancel'`, in a pt-BR dialog. That is the\n // precise failure the sweep exists to prevent, one layer down: a port\n // that is required, supplied, and ignored.\n cancelText={cancelText ?? copy.cancel}\n loading={state.pending}\n confirmDisabled={gateUnmet}\n initialFocus={resolveInitialFocus(tone, initialFocus)}\n onConfirm={state.confirm}\n onCancel={state.cancel}\n onClose={state.cancel}\n data-testid={dataTestId}\n >\n {state.error && (\n <Alert severity=\"error\" sx={{ mt: 1 }} data-testid={`${dataTestId}-error`}>\n {state.error}\n </Alert>\n )}\n {typeToConfirm !== undefined && (\n <TypeToConfirmField\n expected={typeToConfirm}\n label={typeToConfirmLabel}\n value={typed}\n onChange={setTyped}\n disabled={state.pending}\n dataTestId={dataTestId}\n copy={copy}\n />\n )}\n </AlertDialog>\n );\n}\n"],"mappings":";;;;;;;;AACA,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,WAA+B;AA8BlC,mBACE,KADF;AAlBJ,IAAM,kBAAkB;AAWxB,SAAS,YACP,aACA,MACA,YACW;AACX,MAAI,CAAC,WAAY,QAAO,eAAe,KAAK;AAC5C,SACE,iCACE;AAAA,wBAAC,cAAW,WAAU,QAAO,IAAI,EAAE,YAAY,KAAK,SAAS,QAAQ,GAClE,sBACH;AAAA,IACC;AAAA,KACH;AAEJ;AAGA,SAAS,oBACP,MACA,cACqB;AACrB,MAAI,aAAc,QAAO;AACzB,SAAO,SAAS,gBAAgB,WAAW;AAC7C;AAOO,SAAS,aAAa,OAAe,UAA2B;AACrE,SAAO,MAAM,KAAK,EAAE,kBAAkB,OAAO,MAAM,SAAS,KAAK,EAAE,kBAAkB,OAAO;AAC9F;AASA,SAAS,mBAAmB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GASuB;AACrB,SACE,qBAAC,SAAM,SAAS,GAAG,IAAI,EAAE,IAAI,EAAE,GAC7B;AAAA,wBAAC,cAAW,SAAQ,SAAQ,OAAM,kBAC/B,mBAAS,KAAK,cAAc,QAAQ,GACvC;AAAA,IAOA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,UAAU,CAAC,UAAU,SAAS,MAAM,OAAO,KAAK;AAAA,QAGhD,YAAY;AAAA,UACV,cAAc,SAAS,KAAK,cAAc,QAAQ;AAAA,UAClD,eAAe,GAAG,UAAU;AAAA;AAAA,UAE5B,gBAAgB;AAAA,UAChB,aAAa;AAAA,UACb,YAAY;AAAA,QACd;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAcO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,aAAa;AAAA,EACb;AACF,GAAiD;AAC/C,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,EAAE;AAI3C,QAAM,UAAU,MAAM;AACpB,QAAI,MAAM,KAAM,UAAS,EAAE;AAAA,EAC7B,GAAG,CAAC,MAAM,IAAI,CAAC;AAEf,QAAM,YAAY,kBAAkB,UAAa,CAAC,aAAa,OAAO,aAAa;AAEnF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,MAAM;AAAA,MACZ,SAAS,SAAS,gBAAgB,gBAAgB;AAAA,MAClD;AAAA,MACA,aAAa,YAAY,aAAa,MAAM,UAAU;AAAA,MACtD;AAAA,MAQA,YAAY,cAAc,KAAK;AAAA,MAC/B,SAAS,MAAM;AAAA,MACf,iBAAiB;AAAA,MACjB,cAAc,oBAAoB,MAAM,YAAY;AAAA,MACpD,WAAW,MAAM;AAAA,MACjB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,MACf,eAAa;AAAA,MAEZ;AAAA,cAAM,SACL,oBAAC,SAAM,UAAS,SAAQ,IAAI,EAAE,IAAI,EAAE,GAAG,eAAa,GAAG,UAAU,UAC9D,gBAAM,OACT;AAAA,QAED,kBAAkB,UACjB;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,OAAO;AAAA,YACP,OAAO;AAAA,YACP,UAAU;AAAA,YACV,UAAU,MAAM;AAAA,YAChB;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRowConfirm
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-GRMBCJS6.js";
|
|
4
4
|
import {
|
|
5
5
|
useRemoveConfirm
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3Z3WIQ5M.js";
|
|
7
7
|
import {
|
|
8
8
|
rowActionsToMenuItems
|
|
9
9
|
} from "../chunk-ZBXG6RVJ.js";
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
import "../chunk-WVML3ENZ.js";
|
|
25
25
|
import "../chunk-AY5GKCH7.js";
|
|
26
26
|
import "../chunk-XCBQXSTR.js";
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
29
|
-
import "../chunk-
|
|
30
|
-
import "../chunk-
|
|
27
|
+
import "../chunk-5M2NWXN4.js";
|
|
28
|
+
import "../chunk-BWFUZ4N2.js";
|
|
29
|
+
import "../chunk-LBZEPWYK.js";
|
|
30
|
+
import "../chunk-MM7BPTVV.js";
|
|
31
31
|
import "../chunk-EMYESBIT.js";
|
|
32
32
|
import "../chunk-LZRVUOMU.js";
|
|
33
33
|
import "../chunk-EEB66IVH.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../chunk-MBMZNSBP.js";
|
|
4
4
|
import {
|
|
5
5
|
DataViewsTableBase
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-FCVPVEAS.js";
|
|
7
7
|
import "../chunk-4HUSG5MR.js";
|
|
8
8
|
import {
|
|
9
9
|
DataViewsGrid
|
|
@@ -50,9 +50,9 @@ import "../chunk-33MMQHYU.js";
|
|
|
50
50
|
import "../chunk-7D7CJRL7.js";
|
|
51
51
|
import "../chunk-GCZJH4XL.js";
|
|
52
52
|
import "../chunk-CBOB5AV6.js";
|
|
53
|
-
import "../chunk-
|
|
53
|
+
import "../chunk-7HA7UH7O.js";
|
|
54
54
|
import "../chunk-LG52LMAM.js";
|
|
55
|
-
import "../chunk-
|
|
55
|
+
import "../chunk-7JOLSD2W.js";
|
|
56
56
|
import "../chunk-5M4TYFR3.js";
|
|
57
57
|
import "../chunk-O36MIQIO.js";
|
|
58
58
|
import "../chunk-M3DSPEZ3.js";
|
|
@@ -173,10 +173,10 @@ import "../chunk-PN4HVM43.js";
|
|
|
173
173
|
import "../chunk-C3UKR3NT.js";
|
|
174
174
|
import "../chunk-D6KL74KI.js";
|
|
175
175
|
import "../chunk-XCBQXSTR.js";
|
|
176
|
-
import "../chunk-
|
|
177
|
-
import "../chunk-
|
|
178
|
-
import "../chunk-
|
|
179
|
-
import "../chunk-
|
|
176
|
+
import "../chunk-5M2NWXN4.js";
|
|
177
|
+
import "../chunk-BWFUZ4N2.js";
|
|
178
|
+
import "../chunk-LBZEPWYK.js";
|
|
179
|
+
import "../chunk-MM7BPTVV.js";
|
|
180
180
|
import "../chunk-EMYESBIT.js";
|
|
181
181
|
import "../chunk-LZRVUOMU.js";
|
|
182
182
|
import "../chunk-EEB66IVH.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "../chunk-XCBQXSTR.js";
|
|
2
2
|
import {
|
|
3
3
|
createConfirmButton
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-5M2NWXN4.js";
|
|
5
5
|
import {
|
|
6
6
|
ConfirmAction
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BWFUZ4N2.js";
|
|
8
8
|
import {
|
|
9
9
|
withConfirmation
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-LBZEPWYK.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfirmActionDialog
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-MM7BPTVV.js";
|
|
14
14
|
import {
|
|
15
15
|
useConfirmAction
|
|
16
16
|
} from "../chunk-EMYESBIT.js";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { ConfirmActionCopy } from "../../../copy";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { ConfirmOptions, UseConfirmActionResult } from './ConfirmAction.types';
|
|
4
|
+
/**
|
|
5
|
+
* Whether what was typed is the word asked for — trimmed, and in any case.
|
|
6
|
+
* The gate is a pause, not a spelling test: a phone's automatic capital C
|
|
7
|
+
* ("Confirmar") or a held Caps Lock must not lock the act (FUT-3905).
|
|
8
|
+
*/
|
|
9
|
+
export declare function typedMatches(typed: string, expected: string): boolean;
|
|
4
10
|
export interface ConfirmActionDialogProps extends ConfirmOptions {
|
|
5
11
|
/** The fallback body when no entity is named. REQUIRED — no default copy. */
|
|
6
12
|
copy: ConfirmActionCopy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmAction.parts.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/ConfirmAction/ConfirmAction.parts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,OAAO,KAAyB,MAAM,OAAO,CAAC;AAK9C,OAAO,KAAK,EAEV,cAAc,EAEd,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmAction.parts.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/ConfirmAction/ConfirmAction.parts.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAIvD,OAAO,KAAyB,MAAM,OAAO,CAAC;AAK9C,OAAO,KAAK,EAEV,cAAc,EAEd,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAsC/B;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAErE;AA0DD,MAAM,WAAW,wBAAyB,SAAQ,cAAc;IAC9D,6EAA6E;IAC7E,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,sBAAsB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,IAAoB,EACpB,YAAY,EACZ,UAA4B,EAC5B,IAAI,GACL,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAoD/C"}
|
package/package.json
CHANGED
|
@@ -114,7 +114,8 @@ with `<ConfirmActionDialog state={…} />` or your own surface.
|
|
|
114
114
|
- `description` should say whether the action can be undone. A soft delete goes
|
|
115
115
|
to the recycle bin and comes back; a purge does not. Say which. Without one,
|
|
116
116
|
the popup falls back to naming the affected row.
|
|
117
|
-
- `typeToConfirm` requires the operator to type
|
|
117
|
+
- `typeToConfirm` requires the operator to type a string (any case, trimmed — a
|
|
118
|
+
phone's automatic capital must not lock it, FUT-3905) before the
|
|
118
119
|
confirm enables. Reserve it for actions with **no** recovery path — a
|
|
119
120
|
permanent purge, suspending a live store. Everywhere else it is friction that
|
|
120
121
|
buys nothing.
|
|
@@ -128,7 +129,7 @@ with `<ConfirmActionDialog state={…} />` or your own surface.
|
|
|
128
129
|
| `description` | `ReactNode` | derived from `entityName` | The consequence. |
|
|
129
130
|
| `entityName` | `string` | — | The row being acted on, echoed into the body. |
|
|
130
131
|
| `cancelText` | `string` | `Cancelar` | |
|
|
131
|
-
| `typeToConfirm` | `string` | — | Gates the confirm until typed
|
|
132
|
+
| `typeToConfirm` | `string` | — | Gates the confirm until typed (any case, trimmed). |
|
|
132
133
|
| `typeToConfirmLabel` | `string` | derived | Label above the field. |
|
|
133
134
|
| `tone` | `'destructive' \| 'default'` | `destructive` | Colour + default focus. |
|
|
134
135
|
| `initialFocus` | `'confirm' \| 'cancel'` | `cancel` when destructive | |
|
|
@@ -50,11 +50,21 @@ function resolveInitialFocus(
|
|
|
50
50
|
return tone === 'destructive' ? 'cancel' : 'confirm';
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Whether what was typed is the word asked for — trimmed, and in any case.
|
|
55
|
+
* The gate is a pause, not a spelling test: a phone's automatic capital C
|
|
56
|
+
* ("Confirmar") or a held Caps Lock must not lock the act (FUT-3905).
|
|
57
|
+
*/
|
|
58
|
+
export function typedMatches(typed: string, expected: string): boolean {
|
|
59
|
+
return typed.trim().toLocaleLowerCase('pt-BR') === expected.trim().toLocaleLowerCase('pt-BR');
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
/**
|
|
54
63
|
* The type-to-confirm field. Rendered only when `typeToConfirm` is set, which
|
|
55
64
|
* should be rare: it is the guard for actions with NO recovery path, where a
|
|
56
|
-
* click is too cheap a gesture. Comparison
|
|
57
|
-
* whitespace
|
|
65
|
+
* click is too cheap a gesture. Comparison ignores case and surrounding
|
|
66
|
+
* whitespace ({@link typedMatches}): a phone capitalises the first letter, and
|
|
67
|
+
* "Confirmar" must unlock what "confirmar" does (FUT-3905).
|
|
58
68
|
*/
|
|
59
69
|
function TypeToConfirmField({
|
|
60
70
|
expected,
|
|
@@ -95,6 +105,10 @@ function TypeToConfirmField({
|
|
|
95
105
|
inputProps={{
|
|
96
106
|
'aria-label': label ?? copy.typeToConfirm(expected),
|
|
97
107
|
'data-testid': `${dataTestId}-type-to-confirm`,
|
|
108
|
+
// A word to copy, not prose: the phone keeps its hands off it.
|
|
109
|
+
autoCapitalize: 'none',
|
|
110
|
+
autoCorrect: 'off',
|
|
111
|
+
spellCheck: false,
|
|
98
112
|
}}
|
|
99
113
|
/>
|
|
100
114
|
</Stack>
|
|
@@ -135,7 +149,7 @@ export function ConfirmActionDialog({
|
|
|
135
149
|
if (state.open) setTyped('');
|
|
136
150
|
}, [state.open]);
|
|
137
151
|
|
|
138
|
-
const gateUnmet = typeToConfirm !== undefined && typed
|
|
152
|
+
const gateUnmet = typeToConfirm !== undefined && !typedMatches(typed, typeToConfirm);
|
|
139
153
|
|
|
140
154
|
return (
|
|
141
155
|
<AlertDialog
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/feedback/ConfirmAction/ConfirmAction.parts.tsx"],"sourcesContent":["import type { ConfirmActionCopy } from \"../../../copy\";\nimport Alert from '@mui/material/Alert/index.js';\nimport Stack from '@mui/material/Stack/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport React, { type ReactNode } from 'react';\n\nimport { AlertDialog } from '../../data-display/AlertDialog';\nimport { OutlinedTextFieldSlim } from '../../form/Input/outlined/text-field-slim-outlined';\n\nimport type {\n ConfirmInitialFocus,\n ConfirmOptions,\n ConfirmTone,\n UseConfirmActionResult,\n} from './ConfirmAction.types';\n\nconst DEFAULT_TEST_ID = 'confirm-action';\n\n/**\n * The popup's body: the row being acted on, then what happens to it.\n *\n * The NAME is rendered in its own right rather than woven into the sentence, so\n * it is there whatever the caller wrote — \"the popup names the specific entity\"\n * is the one thing that must not depend on each call site remembering to\n * mention it. A body with neither a name nor a description would leave the\n * operator with only the title to decide on, so a neutral fallback covers that.\n */\nfunction confirmBody(\n description: ReactNode,\n copy: ConfirmActionCopy,\n entityName?: string,\n): ReactNode {\n if (!entityName) return description ?? copy.irreversible;\n return (\n <>\n <Typography component=\"span\" sx={{ fontWeight: 600, display: \"block\" }}>\n {entityName}\n </Typography>\n {description}\n </>\n );\n}\n\n/** Destructive dialogs open on Cancel; anything else opens on the confirm. */\nfunction resolveInitialFocus(\n tone: ConfirmTone,\n initialFocus?: ConfirmInitialFocus,\n): ConfirmInitialFocus {\n if (initialFocus) return initialFocus;\n return tone === 'destructive' ? 'cancel' : 'confirm';\n}\n\n/**\n * The type-to-confirm field. Rendered only when `typeToConfirm` is set, which\n * should be rare: it is the guard for actions with NO recovery path, where a\n * click is too cheap a gesture. Comparison is exact — trimmed of surrounding\n * whitespace only, so a trailing space from a paste does not read as a mismatch.\n */\nfunction TypeToConfirmField({\n expected,\n label,\n value,\n onChange,\n disabled,\n dataTestId,\n copy,\n}: {\n expected: string;\n label?: string;\n /** The words this prompt renders. REQUIRED — no default copy. */\n copy: ConfirmActionCopy;\n value: string;\n onChange: (next: string) => void;\n disabled: boolean;\n dataTestId: string;\n}): React.ReactElement {\n return (\n <Stack spacing={1} sx={{ mt: 2 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {label ?? copy.typeToConfirm(expected)}\n </Typography>\n {/*\n * The outlined slim field, not MUI's `TextField` (FUT-3429): same\n * composition and DOM, but no `Select` branch, so a screen that can open\n * this popup no longer ships `Select`, `Menu`, `MenuList`, `NativeSelect`\n * and `List` for a box that only ever takes a word.\n */}\n <OutlinedTextFieldSlim\n size=\"small\"\n value={value}\n disabled={disabled}\n onChange={(event) => onChange(event.target.value)}\n // On the INPUT rather than the wrapper: a test id on MUI's TextField\n // lands on the outer div, which is not the node a test can type into.\n inputProps={{\n 'aria-label': label ?? copy.typeToConfirm(expected),\n 'data-testid': `${dataTestId}-type-to-confirm`,\n }}\n />\n </Stack>\n );\n}\n\nexport interface ConfirmActionDialogProps extends ConfirmOptions {\n /** The fallback body when no entity is named. REQUIRED — no default copy. */\n copy: ConfirmActionCopy;\n state: UseConfirmActionResult;\n}\n\n/**\n * The popup itself: an `AlertDialog` in its destructive skin, plus the two\n * things a bare AlertDialog has no opinion about — the failure the last attempt\n * produced (shown IN the dialog, which stays open, rather than closing over a\n * write that never landed) and the optional type-to-confirm gate.\n */\nexport function ConfirmActionDialog({\n state,\n title,\n description,\n entityName,\n confirmText,\n cancelText,\n typeToConfirm,\n typeToConfirmLabel,\n tone = 'destructive',\n initialFocus,\n dataTestId = DEFAULT_TEST_ID,\n copy,\n}: ConfirmActionDialogProps): React.ReactElement {\n const [typed, setTyped] = React.useState('');\n\n // Every fresh open starts from an empty field: carrying the previous answer\n // over would hand the next delete a pre-satisfied gate.\n React.useEffect(() => {\n if (state.open) setTyped('');\n }, [state.open]);\n\n const gateUnmet = typeToConfirm !== undefined && typed.trim() !== typeToConfirm;\n\n return (\n <AlertDialog\n open={state.open}\n variant={tone === 'destructive' ? 'destructive' : 'default'}\n title={title}\n description={confirmBody(description, copy, entityName)}\n confirmText={confirmText}\n // `copy.cancel` is the fallback, NOT `AlertDialog`'s own. The 6.3.0 copy\n // sweep deleted this component's `cancelText = 'Cancelar'` default and\n // put the word in `ConfirmActionCopy` — where nothing then read it, so\n // every confirmation that names no `cancelText` of its own fell through\n // to `AlertDialog`'s English `'Cancel'`, in a pt-BR dialog. That is the\n // precise failure the sweep exists to prevent, one layer down: a port\n // that is required, supplied, and ignored.\n cancelText={cancelText ?? copy.cancel}\n loading={state.pending}\n confirmDisabled={gateUnmet}\n initialFocus={resolveInitialFocus(tone, initialFocus)}\n onConfirm={state.confirm}\n onCancel={state.cancel}\n onClose={state.cancel}\n data-testid={dataTestId}\n >\n {state.error && (\n <Alert severity=\"error\" sx={{ mt: 1 }} data-testid={`${dataTestId}-error`}>\n {state.error}\n </Alert>\n )}\n {typeToConfirm !== undefined && (\n <TypeToConfirmField\n expected={typeToConfirm}\n label={typeToConfirmLabel}\n value={typed}\n onChange={setTyped}\n disabled={state.pending}\n dataTestId={dataTestId}\n copy={copy}\n />\n )}\n </AlertDialog>\n );\n}\n"],"mappings":";;;;;;;;AACA,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,WAA+B;AA8BlC,mBACE,KADF;AAlBJ,IAAM,kBAAkB;AAWxB,SAAS,YACP,aACA,MACA,YACW;AACX,MAAI,CAAC,WAAY,QAAO,eAAe,KAAK;AAC5C,SACE,iCACE;AAAA,wBAAC,cAAW,WAAU,QAAO,IAAI,EAAE,YAAY,KAAK,SAAS,QAAQ,GAClE,sBACH;AAAA,IACC;AAAA,KACH;AAEJ;AAGA,SAAS,oBACP,MACA,cACqB;AACrB,MAAI,aAAc,QAAO;AACzB,SAAO,SAAS,gBAAgB,WAAW;AAC7C;AAQA,SAAS,mBAAmB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GASuB;AACrB,SACE,qBAAC,SAAM,SAAS,GAAG,IAAI,EAAE,IAAI,EAAE,GAC7B;AAAA,wBAAC,cAAW,SAAQ,SAAQ,OAAM,kBAC/B,mBAAS,KAAK,cAAc,QAAQ,GACvC;AAAA,IAOA;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA,UAAU,CAAC,UAAU,SAAS,MAAM,OAAO,KAAK;AAAA,QAGhD,YAAY;AAAA,UACV,cAAc,SAAS,KAAK,cAAc,QAAQ;AAAA,UAClD,eAAe,GAAG,UAAU;AAAA,QAC9B;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAcO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA,aAAa;AAAA,EACb;AACF,GAAiD;AAC/C,QAAM,CAAC,OAAO,QAAQ,IAAI,MAAM,SAAS,EAAE;AAI3C,QAAM,UAAU,MAAM;AACpB,QAAI,MAAM,KAAM,UAAS,EAAE;AAAA,EAC7B,GAAG,CAAC,MAAM,IAAI,CAAC;AAEf,QAAM,YAAY,kBAAkB,UAAa,MAAM,KAAK,MAAM;AAElE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,MAAM;AAAA,MACZ,SAAS,SAAS,gBAAgB,gBAAgB;AAAA,MAClD;AAAA,MACA,aAAa,YAAY,aAAa,MAAM,UAAU;AAAA,MACtD;AAAA,MAQA,YAAY,cAAc,KAAK;AAAA,MAC/B,SAAS,MAAM;AAAA,MACf,iBAAiB;AAAA,MACjB,cAAc,oBAAoB,MAAM,YAAY;AAAA,MACpD,WAAW,MAAM;AAAA,MACjB,UAAU,MAAM;AAAA,MAChB,SAAS,MAAM;AAAA,MACf,eAAa;AAAA,MAEZ;AAAA,cAAM,SACL,oBAAC,SAAM,UAAS,SAAQ,IAAI,EAAE,IAAI,EAAE,GAAG,eAAa,GAAG,UAAU,UAC9D,gBAAM,OACT;AAAA,QAED,kBAAkB,UACjB;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,OAAO;AAAA,YACP,OAAO;AAAA,YACP,UAAU;AAAA,YACV,UAAU,MAAM;AAAA,YAChB;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|