@payloadcms/ui 3.0.0-beta.43 → 3.0.0-beta.45
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/elements/Autosave/index.d.ts.map +1 -1
- package/dist/elements/Autosave/index.js +91 -70
- package/dist/elements/Autosave/index.js.map +1 -1
- package/dist/elements/DeleteDocument/index.d.ts.map +1 -1
- package/dist/elements/DeleteDocument/index.js +2 -3
- package/dist/elements/DeleteDocument/index.js.map +1 -1
- package/dist/elements/DeleteMany/index.d.ts.map +1 -1
- package/dist/elements/DeleteMany/index.js +3 -6
- package/dist/elements/DeleteMany/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerContent.js +2 -3
- package/dist/elements/DocumentDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/DocumentDrawer/index.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/index.js +1 -2
- package/dist/elements/DocumentDrawer/index.js.map +1 -1
- package/dist/elements/Drawer/index.d.ts.map +1 -1
- package/dist/elements/Drawer/index.js +1 -3
- package/dist/elements/Drawer/index.js.map +1 -1
- package/dist/elements/DuplicateDocument/index.d.ts.map +1 -1
- package/dist/elements/DuplicateDocument/index.js +4 -9
- package/dist/elements/DuplicateDocument/index.js.map +1 -1
- package/dist/elements/EditMany/index.d.ts.map +1 -1
- package/dist/elements/EditMany/index.js +1 -2
- package/dist/elements/EditMany/index.js.map +1 -1
- package/dist/elements/EditUpload/index.d.ts.map +1 -1
- package/dist/elements/EditUpload/index.js +1 -5
- package/dist/elements/EditUpload/index.js.map +1 -1
- package/dist/elements/GenerateConfirmation/index.d.ts.map +1 -1
- package/dist/elements/GenerateConfirmation/index.js +3 -6
- package/dist/elements/GenerateConfirmation/index.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +1 -2
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/elements/ListDrawer/DrawerContent.js +1 -2
- package/dist/elements/ListDrawer/DrawerContent.js.map +1 -1
- package/dist/elements/ListDrawer/index.d.ts.map +1 -1
- package/dist/elements/ListDrawer/index.js +1 -2
- package/dist/elements/ListDrawer/index.js.map +1 -1
- package/dist/elements/Modal/index.d.ts +1 -7
- package/dist/elements/Modal/index.d.ts.map +1 -1
- package/dist/elements/Modal/index.js +1 -7
- package/dist/elements/Modal/index.js.map +1 -1
- package/dist/elements/Nav/NavToggler/index.d.ts.map +1 -1
- package/dist/elements/Nav/NavToggler/index.js +1 -2
- package/dist/elements/Nav/NavToggler/index.js.map +1 -1
- package/dist/elements/Nav/context.d.ts.map +1 -1
- package/dist/elements/Nav/context.js +1 -2
- package/dist/elements/Nav/context.js.map +1 -1
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +1 -2
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PreviewButton/usePreviewURL.js +1 -1
- package/dist/elements/PreviewButton/usePreviewURL.js.map +1 -1
- package/dist/elements/PublishMany/index.d.ts.map +1 -1
- package/dist/elements/PublishMany/index.js +2 -3
- package/dist/elements/PublishMany/index.js.map +1 -1
- package/dist/elements/Status/index.d.ts.map +1 -1
- package/dist/elements/Status/index.js +2 -3
- package/dist/elements/Status/index.js.map +1 -1
- package/dist/elements/StayLoggedIn/index.d.ts.map +1 -1
- package/dist/elements/StayLoggedIn/index.js +1 -2
- package/dist/elements/StayLoggedIn/index.js.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
- package/dist/elements/TableColumns/buildColumnState.js +2 -1
- package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
- package/dist/elements/UnpublishMany/index.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/index.js +2 -3
- package/dist/elements/UnpublishMany/index.js.map +1 -1
- package/dist/elements/WindowInfo/index.d.ts +1 -3
- package/dist/elements/WindowInfo/index.d.ts.map +1 -1
- package/dist/elements/WindowInfo/index.js +1 -7
- package/dist/elements/WindowInfo/index.js.map +1 -1
- package/dist/exports/elements.d.ts +2 -10
- package/dist/exports/elements.d.ts.map +1 -1
- package/dist/exports/elements.js +2 -10
- package/dist/exports/elements.js.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.d.ts.map +1 -1
- package/dist/fields/Blocks/BlocksDrawer/index.js +1 -2
- package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
- package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
- package/dist/fields/Blocks/RowActions.js +1 -2
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js +1 -0
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Tabs/index.d.ts.map +1 -1
- package/dist/fields/Tabs/index.js +10 -1
- package/dist/fields/Tabs/index.js.map +1 -1
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +39 -9
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/hooks/useHotkey.d.ts.map +1 -1
- package/dist/hooks/useHotkey.js +1 -2
- package/dist/hooks/useHotkey.js.map +1 -1
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +2 -3
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.js +10 -1
- package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
- package/dist/providers/Root/index.d.ts.map +1 -1
- package/dist/providers/Root/index.js +5 -19
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/providers/ToastContainer/icons/Error.d.ts +3 -0
- package/dist/providers/ToastContainer/icons/Error.d.ts.map +1 -0
- package/dist/providers/ToastContainer/icons/Error.js +25 -0
- package/dist/providers/ToastContainer/icons/Error.js.map +1 -0
- package/dist/providers/ToastContainer/icons/Info.d.ts +3 -0
- package/dist/providers/ToastContainer/icons/Info.d.ts.map +1 -0
- package/dist/providers/ToastContainer/icons/Info.js +25 -0
- package/dist/providers/ToastContainer/icons/Info.js.map +1 -0
- package/dist/providers/ToastContainer/icons/Success.d.ts +3 -0
- package/dist/providers/ToastContainer/icons/Success.d.ts.map +1 -0
- package/dist/providers/ToastContainer/icons/Success.js +25 -0
- package/dist/providers/ToastContainer/icons/Success.js.map +1 -0
- package/dist/providers/ToastContainer/icons/Warning.d.ts +3 -0
- package/dist/providers/ToastContainer/icons/Warning.d.ts.map +1 -0
- package/dist/providers/ToastContainer/icons/Warning.js +25 -0
- package/dist/providers/ToastContainer/icons/Warning.js.map +1 -0
- package/dist/providers/ToastContainer/index.d.ts +3 -0
- package/dist/providers/ToastContainer/index.d.ts.map +1 -0
- package/dist/providers/ToastContainer/index.js +39 -0
- package/dist/providers/ToastContainer/index.js.map +1 -0
- package/dist/scss/app.scss +1 -1
- package/dist/scss/toasts.scss +111 -0
- package/dist/utilities/reduceFieldsToValuesWithValidation.d.ts +15 -0
- package/dist/utilities/reduceFieldsToValuesWithValidation.d.ts.map +1 -0
- package/dist/utilities/reduceFieldsToValuesWithValidation.js +29 -0
- package/dist/utilities/reduceFieldsToValuesWithValidation.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Warning.d.ts","sourceRoot":"","sources":["../../../../src/providers/ToastContainer/icons/Warning.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAe3B,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export const Warning = ()=>{
|
|
4
|
+
return /*#__PURE__*/ _jsxs("svg", {
|
|
5
|
+
fill: "none",
|
|
6
|
+
height: "26",
|
|
7
|
+
viewBox: "0 0 26 26",
|
|
8
|
+
width: "26",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ _jsx("path", {
|
|
12
|
+
d: "M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z",
|
|
13
|
+
fill: "#E4E694"
|
|
14
|
+
}),
|
|
15
|
+
/*#__PURE__*/ _jsx("path", {
|
|
16
|
+
d: "M13 10V13.2M13 16.4H13.008",
|
|
17
|
+
stroke: "black",
|
|
18
|
+
strokeLinecap: "round",
|
|
19
|
+
strokeLinejoin: "round"
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=Warning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/providers/ToastContainer/icons/Warning.tsx"],"sourcesContent":["import React from 'react'\n\nexport const Warning: React.FC = () => {\n return (\n <svg fill=\"none\" height=\"26\" viewBox=\"0 0 26 26\" width=\"26\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M13 21C17.4183 21 21 17.4183 21 13C21 8.58172 17.4183 5 13 5C8.58172 5 5 8.58172 5 13C5 17.4183 8.58172 21 13 21Z\"\n fill=\"#E4E694\"\n />\n <path\n d=\"M13 10V13.2M13 16.4H13.008\"\n stroke=\"black\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )\n}\n"],"names":["React","Warning","svg","fill","height","viewBox","width","xmlns","path","d","stroke","strokeLinecap","strokeLinejoin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,MAAMC,UAAoB;IAC/B,qBACE,MAACC;QAAIC,MAAK;QAAOC,QAAO;QAAKC,SAAQ;QAAYC,OAAM;QAAKC,OAAM;;0BAChE,KAACC;gBACCC,GAAE;gBACFN,MAAK;;0BAEP,KAACK;gBACCC,GAAE;gBACFC,QAAO;gBACPC,eAAc;gBACdC,gBAAe;;;;AAIvB,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/ToastContainer/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EA8BlC,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Toaster } from 'sonner';
|
|
5
|
+
import { Error } from './icons/Error.js';
|
|
6
|
+
import { Info } from './icons/Info.js';
|
|
7
|
+
import { Success } from './icons/Success.js';
|
|
8
|
+
import { Warning } from './icons/Warning.js';
|
|
9
|
+
export const ToastContainer = ()=>{
|
|
10
|
+
return /*#__PURE__*/ _jsx(Toaster, {
|
|
11
|
+
className: "payload-toast-container",
|
|
12
|
+
closeButton: true,
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
dir: "undefined",
|
|
15
|
+
icons: {
|
|
16
|
+
error: /*#__PURE__*/ _jsx(Error, {}),
|
|
17
|
+
info: /*#__PURE__*/ _jsx(Info, {}),
|
|
18
|
+
success: /*#__PURE__*/ _jsx(Success, {}),
|
|
19
|
+
warning: /*#__PURE__*/ _jsx(Warning, {})
|
|
20
|
+
},
|
|
21
|
+
offset: "36px",
|
|
22
|
+
toastOptions: {
|
|
23
|
+
classNames: {
|
|
24
|
+
closeButton: 'payload-toast-close-button',
|
|
25
|
+
content: 'toast-content',
|
|
26
|
+
error: 'toast-error',
|
|
27
|
+
icon: 'toast-icon',
|
|
28
|
+
info: 'toast-info',
|
|
29
|
+
success: 'toast-success',
|
|
30
|
+
toast: 'payload-toast-item',
|
|
31
|
+
warning: 'toast-warning'
|
|
32
|
+
},
|
|
33
|
+
unstyled: true
|
|
34
|
+
},
|
|
35
|
+
visibleToasts: 5
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/providers/ToastContainer/index.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\nimport { Toaster } from 'sonner'\n\nimport { Error } from './icons/Error.js'\nimport { Info } from './icons/Info.js'\nimport { Success } from './icons/Success.js'\nimport { Warning } from './icons/Warning.js'\n\nexport const ToastContainer: React.FC = () => {\n return (\n <Toaster\n className=\"payload-toast-container\"\n closeButton\n // @ts-expect-error\n dir=\"undefined\"\n icons={{\n error: <Error />,\n info: <Info />,\n success: <Success />,\n warning: <Warning />,\n }}\n offset=\"36px\"\n toastOptions={{\n classNames: {\n closeButton: 'payload-toast-close-button',\n content: 'toast-content',\n error: 'toast-error',\n icon: 'toast-icon',\n info: 'toast-info',\n success: 'toast-success',\n toast: 'payload-toast-item',\n warning: 'toast-warning',\n },\n unstyled: true,\n }}\n visibleToasts={5}\n />\n )\n}\n"],"names":["React","Toaster","Error","Info","Success","Warning","ToastContainer","className","closeButton","dir","icons","error","info","success","warning","offset","toastOptions","classNames","content","icon","toast","unstyled","visibleToasts"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AACzB,SAASC,OAAO,QAAQ,SAAQ;AAEhC,SAASC,KAAK,QAAQ,mBAAkB;AACxC,SAASC,IAAI,QAAQ,kBAAiB;AACtC,SAASC,OAAO,QAAQ,qBAAoB;AAC5C,SAASC,OAAO,QAAQ,qBAAoB;AAE5C,OAAO,MAAMC,iBAA2B;IACtC,qBACE,KAACL;QACCM,WAAU;QACVC,WAAW;QACX,mBAAmB;QACnBC,KAAI;QACJC,OAAO;YACLC,qBAAO,KAACT;YACRU,oBAAM,KAACT;YACPU,uBAAS,KAACT;YACVU,uBAAS,KAACT;QACZ;QACAU,QAAO;QACPC,cAAc;YACZC,YAAY;gBACVT,aAAa;gBACbU,SAAS;gBACTP,OAAO;gBACPQ,MAAM;gBACNP,MAAM;gBACNC,SAAS;gBACTO,OAAO;gBACPN,SAAS;YACX;YACAO,UAAU;QACZ;QACAC,eAAe;;AAGrB,EAAC"}
|
package/dist/scss/app.scss
CHANGED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
.payload-toast-container {
|
|
2
|
+
.payload-toast-close-button {
|
|
3
|
+
left: unset;
|
|
4
|
+
right: 0.5rem;
|
|
5
|
+
top: 1.55rem;
|
|
6
|
+
color: var(--theme-elevation-400);
|
|
7
|
+
background: unset;
|
|
8
|
+
border: none;
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 1.25rem;
|
|
11
|
+
height: 1.25rem;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
|
|
15
|
+
&:hover {
|
|
16
|
+
background: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
svg {
|
|
20
|
+
width: 2rem;
|
|
21
|
+
height: 2rem;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[dir='RTL'] & {
|
|
25
|
+
right: unset;
|
|
26
|
+
left: 0.5rem;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.payload-toast-item {
|
|
31
|
+
padding: 1rem 2.5rem 1rem 1rem;
|
|
32
|
+
color: var(--theme-text);
|
|
33
|
+
font-style: normal;
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
display: flex;
|
|
36
|
+
gap: 1rem;
|
|
37
|
+
align-items: center;
|
|
38
|
+
width: 100%;
|
|
39
|
+
border-radius: 0.15rem;
|
|
40
|
+
border: 1px solid var(--theme-border-color);
|
|
41
|
+
background: var(--theme-input-bg);
|
|
42
|
+
box-shadow:
|
|
43
|
+
0px 10px 4px -8px rgba(0, 2, 4, 0.02),
|
|
44
|
+
0px 2px 3px 0px rgba(0, 2, 4, 0.05);
|
|
45
|
+
|
|
46
|
+
.toast-content {
|
|
47
|
+
transition: opacity 100ms cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&[data-front='false'] {
|
|
51
|
+
.toast-content {
|
|
52
|
+
opacity: 0;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&[data-expanded='true'] {
|
|
57
|
+
.toast-content {
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.toast-icon {
|
|
63
|
+
svg {
|
|
64
|
+
width: 2.4rem;
|
|
65
|
+
height: 2.4rem;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.toast-warning {
|
|
70
|
+
border-color: var(--theme-warning-200);
|
|
71
|
+
background-color: var(--theme-warning-100);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.toast-error {
|
|
75
|
+
border-color: var(--theme-error-300);
|
|
76
|
+
background-color: var(--theme-error-150);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.toast-success {
|
|
80
|
+
border-color: var(--theme-success-200);
|
|
81
|
+
background-color: var(--theme-success-100);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.toast-info {
|
|
85
|
+
border-color: var(--theme-elevation-250);
|
|
86
|
+
background-color: var(--theme-elevation-100);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[data-theme='light'] & {
|
|
90
|
+
&.toast-warning {
|
|
91
|
+
border-color: var(--theme-warning-550);
|
|
92
|
+
background-color: var(--theme-warning-100);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&.toast-error {
|
|
96
|
+
border-color: var(--theme-error-200);
|
|
97
|
+
background-color: var(--theme-error-50);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.toast-success {
|
|
101
|
+
border-color: var(--theme-success-550);
|
|
102
|
+
background-color: var(--theme-success-50);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.toast-info {
|
|
106
|
+
border-color: var(--theme-border-color);
|
|
107
|
+
background-color: var(--theme-elevation-50);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Data, FormState } from 'payload/types';
|
|
2
|
+
type ReturnType = {
|
|
3
|
+
data: Data;
|
|
4
|
+
valid: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Reduce flattened form fields (Fields) to just map to the respective values instead of the full FormField object
|
|
8
|
+
*
|
|
9
|
+
* @param unflatten This also unflattens the data if `unflatten` is true. The unflattened data should match the original data structure
|
|
10
|
+
* @param ignoreDisableFormData - if true, will include fields that have `disableFormData` set to true, for example, blocks or arrays fields.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare const reduceFieldsToValuesWithValidation: (fields: FormState, unflatten?: boolean, ignoreDisableFormData?: boolean) => ReturnType;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=reduceFieldsToValuesWithValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reduceFieldsToValuesWithValidation.d.ts","sourceRoot":"","sources":["../../src/utilities/reduceFieldsToValuesWithValidation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAKpD,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,WACrC,SAAS,cACL,OAAO,0BACK,OAAO,KAC9B,UAoBF,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import flatleyImport from 'flatley';
|
|
2
|
+
const { unflatten: flatleyUnflatten } = flatleyImport;
|
|
3
|
+
/**
|
|
4
|
+
* Reduce flattened form fields (Fields) to just map to the respective values instead of the full FormField object
|
|
5
|
+
*
|
|
6
|
+
* @param unflatten This also unflattens the data if `unflatten` is true. The unflattened data should match the original data structure
|
|
7
|
+
* @param ignoreDisableFormData - if true, will include fields that have `disableFormData` set to true, for example, blocks or arrays fields.
|
|
8
|
+
*
|
|
9
|
+
*/ export const reduceFieldsToValuesWithValidation = (fields, unflatten, ignoreDisableFormData)=>{
|
|
10
|
+
const state = {
|
|
11
|
+
data: {},
|
|
12
|
+
valid: true
|
|
13
|
+
};
|
|
14
|
+
if (!fields) return state;
|
|
15
|
+
Object.keys(fields).forEach((key)=>{
|
|
16
|
+
if (ignoreDisableFormData === true || !fields[key]?.disableFormData) {
|
|
17
|
+
state.data[key] = fields[key]?.value;
|
|
18
|
+
if (!fields[key].valid) state.valid = false;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
if (unflatten) {
|
|
22
|
+
state.data = flatleyUnflatten(state.data, {
|
|
23
|
+
safe: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return state;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=reduceFieldsToValuesWithValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/reduceFieldsToValuesWithValidation.ts"],"sourcesContent":["import type { Data, FormState } from 'payload/types'\n\nimport flatleyImport from 'flatley'\nconst { unflatten: flatleyUnflatten } = flatleyImport\n\ntype ReturnType = {\n data: Data\n valid: boolean\n}\n\n/**\n * Reduce flattened form fields (Fields) to just map to the respective values instead of the full FormField object\n *\n * @param unflatten This also unflattens the data if `unflatten` is true. The unflattened data should match the original data structure\n * @param ignoreDisableFormData - if true, will include fields that have `disableFormData` set to true, for example, blocks or arrays fields.\n *\n */\nexport const reduceFieldsToValuesWithValidation = (\n fields: FormState,\n unflatten?: boolean,\n ignoreDisableFormData?: boolean,\n): ReturnType => {\n const state: ReturnType = {\n data: {},\n valid: true,\n }\n\n if (!fields) return state\n\n Object.keys(fields).forEach((key) => {\n if (ignoreDisableFormData === true || !fields[key]?.disableFormData) {\n state.data[key] = fields[key]?.value\n if (!fields[key].valid) state.valid = false\n }\n })\n\n if (unflatten) {\n state.data = flatleyUnflatten(state.data, { safe: true })\n }\n\n return state\n}\n"],"names":["flatleyImport","unflatten","flatleyUnflatten","reduceFieldsToValuesWithValidation","fields","ignoreDisableFormData","state","data","valid","Object","keys","forEach","key","disableFormData","value","safe"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAOA,mBAAmB,UAAS;AACnC,MAAM,EAAEC,WAAWC,gBAAgB,EAAE,GAAGF;AAOxC;;;;;;CAMC,GACD,OAAO,MAAMG,qCAAqC,CAChDC,QACAH,WACAI;IAEA,MAAMC,QAAoB;QACxBC,MAAM,CAAC;QACPC,OAAO;IACT;IAEA,IAAI,CAACJ,QAAQ,OAAOE;IAEpBG,OAAOC,IAAI,CAACN,QAAQO,OAAO,CAAC,CAACC;QAC3B,IAAIP,0BAA0B,QAAQ,CAACD,MAAM,CAACQ,IAAI,EAAEC,iBAAiB;YACnEP,MAAMC,IAAI,CAACK,IAAI,GAAGR,MAAM,CAACQ,IAAI,EAAEE;YAC/B,IAAI,CAACV,MAAM,CAACQ,IAAI,CAACJ,KAAK,EAAEF,MAAME,KAAK,GAAG;QACxC;IACF;IAEA,IAAIP,WAAW;QACbK,MAAMC,IAAI,GAAGL,iBAAiBI,MAAMC,IAAI,EAAE;YAAEQ,MAAM;QAAK;IACzD;IAEA,OAAOT;AACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/ui",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.45",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@dnd-kit/core": "6.0.8",
|
|
96
96
|
"@dnd-kit/sortable": "7.0.2",
|
|
97
|
-
"@faceless-ui/modal": "
|
|
98
|
-
"@faceless-ui/scroll-info": "
|
|
99
|
-
"@faceless-ui/window-info": "
|
|
97
|
+
"@faceless-ui/modal": "3.0.0-beta.0",
|
|
98
|
+
"@faceless-ui/scroll-info": "2.0.0-beta.0",
|
|
99
|
+
"@faceless-ui/window-info": "3.0.0-beta.0",
|
|
100
100
|
"@monaco-editor/react": "4.5.1",
|
|
101
101
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
102
102
|
"bson-objectid": "2.0.4",
|
|
@@ -110,11 +110,11 @@
|
|
|
110
110
|
"react-datepicker": "6.9.0",
|
|
111
111
|
"react-image-crop": "10.1.8",
|
|
112
112
|
"react-select": "5.8.0",
|
|
113
|
-
"react-toastify": "10.0.5",
|
|
114
113
|
"scheduler": "0.25.0-rc-f994737d14-20240522",
|
|
114
|
+
"sonner": "^1.5.0",
|
|
115
115
|
"use-context-selector": "2.0.0",
|
|
116
116
|
"uuid": "^9.0.1",
|
|
117
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
117
|
+
"@payloadcms/translations": "3.0.0-beta.45"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
120
|
"@babel/cli": "^7.24.5",
|
|
@@ -141,14 +141,14 @@
|
|
|
141
141
|
"terser-webpack-plugin": "^5.3.10",
|
|
142
142
|
"webpack": "^5.78.0",
|
|
143
143
|
"webpack-cli": "^5.1.4",
|
|
144
|
-
"
|
|
145
|
-
"
|
|
144
|
+
"@payloadcms/eslint-config": "1.1.1",
|
|
145
|
+
"payload": "3.0.0-beta.45"
|
|
146
146
|
},
|
|
147
147
|
"peerDependencies": {
|
|
148
148
|
"next": "^15.0.0-rc.0",
|
|
149
149
|
"react": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
|
|
150
150
|
"react-dom": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
|
|
151
|
-
"payload": "3.0.0-beta.
|
|
151
|
+
"payload": "3.0.0-beta.45"
|
|
152
152
|
},
|
|
153
153
|
"engines": {
|
|
154
154
|
"node": "^18.20.2 || >=20.9.0"
|