@panneau/forms 5.0.0-alpha.17 → 5.0.0-alpha.19
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/README.md +2 -1
- package/dist/Form.css +10 -2
- package/dist/Form.module.js +5 -3
- package/dist/Form.module.js.map +1 -1
- package/dist/FormBinding.d.ts.map +1 -1
- package/dist/FormBinding.js +5 -8
- package/dist/FormBinding.js.map +1 -1
- package/dist/FormSkeleton.d.ts.map +1 -1
- package/dist/FormSkeleton.js +0 -1
- package/dist/FormSkeleton.js.map +1 -1
- package/dist/FormView.d.ts +15 -2
- package/dist/FormView.d.ts.map +1 -1
- package/dist/FormView.js +221 -182
- package/dist/FormView.js.map +1 -1
- package/dist/context.d.ts +7 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +8 -2
- package/dist/context.js.map +1 -1
- package/dist/formatError.d.ts.map +1 -1
- package/dist/formatError.js +2 -2
- package/dist/formatError.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/layout/Layout.d.ts +10 -0
- package/dist/layout/Layout.d.ts.map +1 -1
- package/dist/layout/Layout.js +126 -86
- package/dist/layout/Layout.js.map +1 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +2 -1
- package/dist/paths.js.map +1 -1
- package/dist/publication/Publication.d.ts +33 -0
- package/dist/publication/Publication.d.ts.map +1 -0
- package/dist/publication/Publication.js +218 -0
- package/dist/publication/Publication.js.map +1 -0
- package/dist/publication/index.d.ts +3 -0
- package/dist/publication/index.d.ts.map +1 -0
- package/dist/publication/index.js +1 -0
- package/package.json +14 -7
package/dist/FormView.js
CHANGED
|
@@ -2,7 +2,7 @@ import { messages } from "./messages.js";
|
|
|
2
2
|
import { ConflictDialog } from "./ConflictDialog.js";
|
|
3
3
|
import Form_module_default from "./Form.module.js";
|
|
4
4
|
import { ErrorSummary } from "./ErrorSummary.js";
|
|
5
|
-
import { FormContext, RevealContext, createRevealRegistry, useFormState } from "./context.js";
|
|
5
|
+
import { ErrorSectionsContext, FormContext, RevealContext, createRevealRegistry as createRevealRegistry$1, useFormState } from "./context.js";
|
|
6
6
|
import { FormBinding } from "./FormBinding.js";
|
|
7
7
|
import { cx } from "./cx.js";
|
|
8
8
|
import { FormSkeleton } from "./FormSkeleton.js";
|
|
@@ -10,8 +10,9 @@ import { FieldFlow, LayoutNodes } from "./layout/Layout.js";
|
|
|
10
10
|
import { useBeforeUnloadGuard, useLeaveConfirmation } from "./unsaved.js";
|
|
11
11
|
import { c } from "react/compiler-runtime";
|
|
12
12
|
import { getLayoutFieldNames, getProblem, resolveFields, selectVisible, useLeaveGuard, usePanneau, usePlugins } from "@panneau/core";
|
|
13
|
-
import { Alert, Button, usePanneauIntl, useToast } from "@panneau/ui";
|
|
14
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Alert, Button, Icon, Tooltip, isApplePlatform, usePanneauIntl, useToast, useToastOffset } from "@panneau/ui";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { CircleCheck } from "lucide-react";
|
|
15
16
|
import { useRef, useState } from "react";
|
|
16
17
|
import { FieldsProvider, builtInFields } from "@panneau/fields";
|
|
17
18
|
//#region src/FormView.tsx
|
|
@@ -47,27 +48,41 @@ function orderErrors(names, errors, locales = []) {
|
|
|
47
48
|
function isUnplacedField(node, placed) {
|
|
48
49
|
return node?.type === "field" && node.name !== void 0 && !placed.has(node.name);
|
|
49
50
|
}
|
|
51
|
+
/** Whether a key press saves: ⌘ Enter on Apple platforms, Ctrl Enter elsewhere. */
|
|
52
|
+
function isSaveShortcut(event, apple) {
|
|
53
|
+
return event.key === "Enter" && (apple ? event.metaKey : event.ctrlKey) && !event.altKey && !event.shiftKey && !event.repeat && !event.nativeEvent.isComposing;
|
|
54
|
+
}
|
|
50
55
|
/**
|
|
51
56
|
* Renders a form: its fields in their layout, bound to the form state of `@panneau/core`, with
|
|
52
57
|
* an error summary, a scroll to the first error, error counts on tabs and sections, a guard for
|
|
53
58
|
* unsaved changes and the dialog of version conflicts. Saving is the job of the form's
|
|
54
59
|
* `onSubmit`.
|
|
60
|
+
*
|
|
61
|
+
* ⌘ Enter (Ctrl Enter elsewhere) saves from any of its fields. After a failed save, every
|
|
62
|
+
* collapsed section that holds an error opens, and the first error is focused.
|
|
55
63
|
*/
|
|
56
64
|
function FormView(t0) {
|
|
57
|
-
const $ = c(
|
|
58
|
-
const { form, fields, layout: t1, locales, relationSource, uploadSource, checkSource, components, submitLabel, actions, onSubmitted, onReload, guardUnsavedChanges: t2, showSavedToast: t3,
|
|
65
|
+
const $ = c(49);
|
|
66
|
+
const { form, fields, layout: t1, locales, relationSource, uploadSource, checkSource, components, submitLabel, actions, onSubmitted, onReload, guardUnsavedChanges: t2, showSavedToast: t3, saved: t4, isLoading: t5, id, "aria-label": ariaLabel, className, layoutClassName, sidebarClassName, footerClassName, summaryClassName } = t0;
|
|
59
67
|
const layout = t1 === void 0 ? [] : t1;
|
|
60
68
|
const guardUnsavedChanges = t2 === void 0 ? true : t2;
|
|
61
69
|
const showSavedToast = t3 === void 0 ? true : t3;
|
|
62
|
-
const
|
|
70
|
+
const saved = t4 === void 0 ? false : t4;
|
|
71
|
+
const isLoading = t5 === void 0 ? false : t5;
|
|
63
72
|
const intl = usePanneauIntl();
|
|
64
73
|
const toasts = useToast();
|
|
65
74
|
const { definition } = usePanneau();
|
|
66
75
|
const plugins = usePlugins();
|
|
67
76
|
const state = useFormState(form);
|
|
68
|
-
const [registry] = useState(createRevealRegistry);
|
|
77
|
+
const [registry] = useState(createRevealRegistry$1);
|
|
78
|
+
const [errorSections] = useState(createRevealRegistry$1);
|
|
69
79
|
const [resolving, setResolving] = useState(false);
|
|
70
80
|
const root = useRef(null);
|
|
81
|
+
const footer = useRef(null);
|
|
82
|
+
const hasFooter = submitLabel !== null || actions !== void 0;
|
|
83
|
+
useToastOffset(footer, hasFooter && !isLoading);
|
|
84
|
+
const [savedShown, setSavedShown] = useState(saved);
|
|
85
|
+
if (savedShown && state.dirty) setSavedShown(false);
|
|
71
86
|
const guarded = guardUnsavedChanges && state.dirty;
|
|
72
87
|
useBeforeUnloadGuard(guarded);
|
|
73
88
|
const leave = useLeaveConfirmation(guarded);
|
|
@@ -80,33 +95,33 @@ function FormView(t0) {
|
|
|
80
95
|
while (split > 0 && isUnplacedField(main[split - 1], placed)) split = split - 1;
|
|
81
96
|
const flow = main.slice(split);
|
|
82
97
|
const laidOut = main.slice(0, split);
|
|
83
|
-
let
|
|
98
|
+
let t6;
|
|
84
99
|
if ($[0] !== state) {
|
|
85
|
-
|
|
100
|
+
t6 = (node_0) => node_0.type === "sidebar" && selectVisible(state, node_0);
|
|
86
101
|
$[0] = state;
|
|
87
|
-
$[1] =
|
|
88
|
-
} else
|
|
89
|
-
const sidebar = resolved.layout.filter(
|
|
102
|
+
$[1] = t6;
|
|
103
|
+
} else t6 = $[1];
|
|
104
|
+
const sidebar = resolved.layout.filter(t6);
|
|
90
105
|
const order = [...getLayoutFieldNames(main), ...getLayoutFieldNames(sidebar.flatMap(_temp2))];
|
|
91
|
-
let
|
|
106
|
+
let t7;
|
|
92
107
|
if ($[2] !== plugins.fields) {
|
|
93
|
-
|
|
108
|
+
t7 = Object.fromEntries(plugins.fields);
|
|
94
109
|
$[2] = plugins.fields;
|
|
95
|
-
$[3] =
|
|
96
|
-
} else
|
|
97
|
-
const
|
|
98
|
-
let
|
|
99
|
-
if ($[4] !== components || $[5] !==
|
|
100
|
-
|
|
110
|
+
$[3] = t7;
|
|
111
|
+
} else t7 = $[3];
|
|
112
|
+
const t8 = t7;
|
|
113
|
+
let t9;
|
|
114
|
+
if ($[4] !== components || $[5] !== t8) {
|
|
115
|
+
t9 = {
|
|
101
116
|
...builtInFields,
|
|
102
|
-
...
|
|
117
|
+
...t8,
|
|
103
118
|
...components
|
|
104
119
|
};
|
|
105
120
|
$[4] = components;
|
|
106
|
-
$[5] =
|
|
107
|
-
$[6] =
|
|
108
|
-
} else
|
|
109
|
-
const entries =
|
|
121
|
+
$[5] = t8;
|
|
122
|
+
$[6] = t9;
|
|
123
|
+
} else t9 = $[6];
|
|
124
|
+
const entries = t9;
|
|
110
125
|
const goTo = (path) => {
|
|
111
126
|
registry.reveal(path);
|
|
112
127
|
const show = (frames) => {
|
|
@@ -128,22 +143,17 @@ function FormView(t0) {
|
|
|
128
143
|
const handle = (result) => {
|
|
129
144
|
if (result === null) return;
|
|
130
145
|
if (result.status === "invalid") {
|
|
146
|
+
Object.keys(result.errors).forEach((path_0) => errorSections.reveal(path_0));
|
|
131
147
|
const first = Object.keys(orderErrors(order, result.errors, formLocales))[0];
|
|
132
148
|
if (first !== void 0) goTo(first);
|
|
133
149
|
} else if (result.status === "submitted") {
|
|
134
|
-
|
|
150
|
+
setSavedShown(true);
|
|
151
|
+
if (showSavedToast && !hasFooter) toasts.show({
|
|
135
152
|
title: intl.formatMessage(messages.saved),
|
|
136
153
|
tone: "success"
|
|
137
|
-
});
|
|
154
|
+
}, { key: "panneau-form-saved" });
|
|
138
155
|
onSubmitted?.(result.result);
|
|
139
|
-
}
|
|
140
|
-
title: intl.formatMessage(messages.saveFailed),
|
|
141
|
-
tone: "danger",
|
|
142
|
-
action: {
|
|
143
|
-
label: intl.formatMessage(messages.retry),
|
|
144
|
-
onAction: () => void form.submit().then(handle)
|
|
145
|
-
}
|
|
146
|
-
}, { timeout: 8e3 });
|
|
156
|
+
}
|
|
147
157
|
};
|
|
148
158
|
const resolve = async (choice) => {
|
|
149
159
|
if (choice === "reload" && state.conflict?.current === null && onReload !== void 0) {
|
|
@@ -153,14 +163,31 @@ function FormView(t0) {
|
|
|
153
163
|
setResolving(true);
|
|
154
164
|
await form.resolveConflict(choice).then(handle).finally(() => setResolving(false));
|
|
155
165
|
};
|
|
156
|
-
let
|
|
157
|
-
if ($[7]
|
|
158
|
-
|
|
159
|
-
$[7] =
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
166
|
+
let t10;
|
|
167
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
168
|
+
t10 = isApplePlatform();
|
|
169
|
+
$[7] = t10;
|
|
170
|
+
} else t10 = $[7];
|
|
171
|
+
const apple = t10;
|
|
172
|
+
let t11;
|
|
173
|
+
if ($[8] !== apple) {
|
|
174
|
+
t11 = (event) => {
|
|
175
|
+
if (!isSaveShortcut(event, apple) || !(event.target instanceof Node) || !event.currentTarget.contains(event.target)) return;
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
event.currentTarget.requestSubmit();
|
|
178
|
+
};
|
|
179
|
+
$[8] = apple;
|
|
180
|
+
$[9] = t11;
|
|
181
|
+
} else t11 = $[9];
|
|
182
|
+
const onKeyDown = t11;
|
|
183
|
+
let t12;
|
|
184
|
+
if ($[10] !== state.error || $[11] !== state.status) {
|
|
185
|
+
t12 = state.status === "error" ? getProblem(state.error) : null;
|
|
186
|
+
$[10] = state.error;
|
|
187
|
+
$[11] = state.status;
|
|
188
|
+
$[12] = t12;
|
|
189
|
+
} else t12 = $[12];
|
|
190
|
+
const problem = t12;
|
|
164
191
|
const errorDetail = problem?.detail ?? (problem === null && state.error instanceof Error ? state.error.message : void 0);
|
|
165
192
|
const showSummary = state.status === "invalid" && state.submitCount > 0;
|
|
166
193
|
if (isLoading) return /* @__PURE__ */ jsx(FormSkeleton, {
|
|
@@ -168,39 +195,39 @@ function FormView(t0) {
|
|
|
168
195
|
flow,
|
|
169
196
|
sidebar: resolved.layout.filter(_temp3),
|
|
170
197
|
fields: resolved.fieldsByName,
|
|
171
|
-
footer:
|
|
198
|
+
footer: hasFooter,
|
|
172
199
|
className,
|
|
173
200
|
layoutClassName,
|
|
174
201
|
sidebarClassName,
|
|
175
202
|
footerClassName
|
|
176
203
|
});
|
|
177
|
-
let t10;
|
|
178
|
-
if ($[10] !== relationSource) {
|
|
179
|
-
t10 = relationSource !== void 0 ? { relationSource } : {};
|
|
180
|
-
$[10] = relationSource;
|
|
181
|
-
$[11] = t10;
|
|
182
|
-
} else t10 = $[11];
|
|
183
|
-
let t11;
|
|
184
|
-
if ($[12] !== uploadSource) {
|
|
185
|
-
t11 = uploadSource !== void 0 ? { uploadSource } : {};
|
|
186
|
-
$[12] = uploadSource;
|
|
187
|
-
$[13] = t11;
|
|
188
|
-
} else t11 = $[13];
|
|
189
|
-
let t12;
|
|
190
|
-
if ($[14] !== checkSource) {
|
|
191
|
-
t12 = checkSource !== void 0 ? { checkSource } : {};
|
|
192
|
-
$[14] = checkSource;
|
|
193
|
-
$[15] = t12;
|
|
194
|
-
} else t12 = $[15];
|
|
195
204
|
let t13;
|
|
196
|
-
if ($[
|
|
197
|
-
t13 =
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
} else t13 = $[
|
|
205
|
+
if ($[13] !== relationSource) {
|
|
206
|
+
t13 = relationSource !== void 0 ? { relationSource } : {};
|
|
207
|
+
$[13] = relationSource;
|
|
208
|
+
$[14] = t13;
|
|
209
|
+
} else t13 = $[14];
|
|
201
210
|
let t14;
|
|
202
|
-
if ($[
|
|
203
|
-
t14 =
|
|
211
|
+
if ($[15] !== uploadSource) {
|
|
212
|
+
t14 = uploadSource !== void 0 ? { uploadSource } : {};
|
|
213
|
+
$[15] = uploadSource;
|
|
214
|
+
$[16] = t14;
|
|
215
|
+
} else t14 = $[16];
|
|
216
|
+
let t15;
|
|
217
|
+
if ($[17] !== checkSource) {
|
|
218
|
+
t15 = checkSource !== void 0 ? { checkSource } : {};
|
|
219
|
+
$[17] = checkSource;
|
|
220
|
+
$[18] = t15;
|
|
221
|
+
} else t15 = $[18];
|
|
222
|
+
let t16;
|
|
223
|
+
if ($[19] !== className) {
|
|
224
|
+
t16 = cx(Form_module_default.form, className);
|
|
225
|
+
$[19] = className;
|
|
226
|
+
$[20] = t16;
|
|
227
|
+
} else t16 = $[20];
|
|
228
|
+
let t17;
|
|
229
|
+
if ($[21] !== errorDetail || $[22] !== intl || $[23] !== state.status) {
|
|
230
|
+
t17 = state.status === "error" ? /* @__PURE__ */ jsx(Alert, {
|
|
204
231
|
tone: "danger",
|
|
205
232
|
role: "alert",
|
|
206
233
|
title: intl.formatMessage(messages.saveFailed),
|
|
@@ -211,138 +238,150 @@ function FormView(t0) {
|
|
|
211
238
|
}),
|
|
212
239
|
children: errorDetail
|
|
213
240
|
}) : null;
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
} else
|
|
219
|
-
const
|
|
220
|
-
let
|
|
221
|
-
if ($[
|
|
222
|
-
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
} else
|
|
227
|
-
let
|
|
228
|
-
if ($[
|
|
229
|
-
|
|
241
|
+
$[21] = errorDetail;
|
|
242
|
+
$[22] = intl;
|
|
243
|
+
$[23] = state.status;
|
|
244
|
+
$[24] = t17;
|
|
245
|
+
} else t17 = $[24];
|
|
246
|
+
const t18 = sidebar.length > 0 && Form_module_default.withSidebar;
|
|
247
|
+
let t19;
|
|
248
|
+
if ($[25] !== layoutClassName || $[26] !== t18) {
|
|
249
|
+
t19 = cx(Form_module_default.layout, t18, layoutClassName);
|
|
250
|
+
$[25] = layoutClassName;
|
|
251
|
+
$[26] = t18;
|
|
252
|
+
$[27] = t19;
|
|
253
|
+
} else t19 = $[27];
|
|
254
|
+
let t20;
|
|
255
|
+
if ($[28] !== actions || $[29] !== apple || $[30] !== footerClassName || $[31] !== hasFooter || $[32] !== intl || $[33] !== savedShown || $[34] !== state.dirty || $[35] !== state.status || $[36] !== submitLabel) {
|
|
256
|
+
t20 = hasFooter ? /* @__PURE__ */ jsxs("div", {
|
|
257
|
+
ref: footer,
|
|
230
258
|
className: cx(Form_module_default.footer, footerClassName),
|
|
231
259
|
children: [
|
|
232
|
-
|
|
233
|
-
className: Form_module_default.
|
|
260
|
+
/* @__PURE__ */ jsx("span", {
|
|
261
|
+
className: cx(Form_module_default.status, state.status === "error" && Form_module_default.statusError),
|
|
234
262
|
role: "status",
|
|
235
|
-
children: intl.formatMessage(messages.unsaved)
|
|
236
|
-
})
|
|
263
|
+
children: state.status === "error" ? intl.formatMessage(messages.saveFailed) : state.dirty ? intl.formatMessage(messages.unsaved) : savedShown && state.status !== "submitting" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Icon, { icon: CircleCheck }), intl.formatMessage(messages.saved)] }) : null
|
|
264
|
+
}),
|
|
237
265
|
actions,
|
|
238
|
-
submitLabel !== null ? /* @__PURE__ */ jsx(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
266
|
+
submitLabel !== null ? /* @__PURE__ */ jsx(Tooltip, {
|
|
267
|
+
content: intl.formatMessage(messages.saveShortcut, { modifier: apple ? "⌘" : "Ctrl" }),
|
|
268
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
269
|
+
type: "submit",
|
|
270
|
+
variant: "primary",
|
|
271
|
+
isPending: state.status === "submitting",
|
|
272
|
+
"aria-keyshortcuts": apple ? "Meta+Enter" : "Control+Enter",
|
|
273
|
+
children: submitLabel ?? intl.formatMessage(messages.save)
|
|
274
|
+
})
|
|
243
275
|
}) : null
|
|
244
276
|
]
|
|
245
277
|
}) : null;
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
278
|
+
$[28] = actions;
|
|
279
|
+
$[29] = apple;
|
|
280
|
+
$[30] = footerClassName;
|
|
281
|
+
$[31] = hasFooter;
|
|
282
|
+
$[32] = intl;
|
|
283
|
+
$[33] = savedShown;
|
|
284
|
+
$[34] = state.dirty;
|
|
285
|
+
$[35] = state.status;
|
|
286
|
+
$[36] = submitLabel;
|
|
287
|
+
$[37] = t20;
|
|
288
|
+
} else t20 = $[37];
|
|
289
|
+
const t21 = state.status === "conflict" || resolving;
|
|
290
|
+
const t22 = state.conflict?.current ?? null;
|
|
291
|
+
let t23;
|
|
292
|
+
let t24;
|
|
293
|
+
if ($[38] !== resolve) {
|
|
294
|
+
t23 = () => void resolve("reload");
|
|
295
|
+
t24 = () => void resolve("overwrite");
|
|
296
|
+
$[38] = resolve;
|
|
297
|
+
$[39] = t23;
|
|
298
|
+
$[40] = t24;
|
|
264
299
|
} else {
|
|
265
|
-
|
|
266
|
-
|
|
300
|
+
t23 = $[39];
|
|
301
|
+
t24 = $[40];
|
|
267
302
|
}
|
|
268
|
-
let
|
|
269
|
-
if ($[
|
|
270
|
-
|
|
271
|
-
isOpen:
|
|
303
|
+
let t25;
|
|
304
|
+
if ($[41] !== resolved.fields || $[42] !== resolving || $[43] !== state.values || $[44] !== t21 || $[45] !== t22 || $[46] !== t23 || $[47] !== t24) {
|
|
305
|
+
t25 = /* @__PURE__ */ jsx(ConflictDialog, {
|
|
306
|
+
isOpen: t21,
|
|
272
307
|
fields: resolved.fields,
|
|
273
308
|
values: state.values,
|
|
274
|
-
current:
|
|
309
|
+
current: t22,
|
|
275
310
|
isPending: resolving,
|
|
276
|
-
onReload:
|
|
277
|
-
onOverwrite:
|
|
311
|
+
onReload: t23,
|
|
312
|
+
onOverwrite: t24
|
|
278
313
|
});
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
} else
|
|
314
|
+
$[41] = resolved.fields;
|
|
315
|
+
$[42] = resolving;
|
|
316
|
+
$[43] = state.values;
|
|
317
|
+
$[44] = t21;
|
|
318
|
+
$[45] = t22;
|
|
319
|
+
$[46] = t23;
|
|
320
|
+
$[47] = t24;
|
|
321
|
+
$[48] = t25;
|
|
322
|
+
} else t25 = $[48];
|
|
288
323
|
return /* @__PURE__ */ jsx(FormContext, {
|
|
289
324
|
value: form,
|
|
290
325
|
children: /* @__PURE__ */ jsx(RevealContext, {
|
|
291
326
|
value: registry,
|
|
292
|
-
children: /* @__PURE__ */
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
fields: resolved.fieldsByName
|
|
325
|
-
}), flow.length > 0 ? /* @__PURE__ */ jsx(FieldFlow, {
|
|
326
|
-
nodes: flow,
|
|
327
|
-
fields: resolved.fieldsByName
|
|
328
|
-
}) : null]
|
|
329
|
-
}), sidebar.length > 0 ? /* @__PURE__ */ jsx("aside", {
|
|
330
|
-
className: cx(Form_module_default.sidebar, sidebarClassName),
|
|
331
|
-
children: sidebar.map((node_3, index) => /* @__PURE__ */ jsx("div", {
|
|
327
|
+
children: /* @__PURE__ */ jsx(ErrorSectionsContext, {
|
|
328
|
+
value: errorSections,
|
|
329
|
+
children: /* @__PURE__ */ jsxs(FieldsProvider, {
|
|
330
|
+
components: entries,
|
|
331
|
+
locales: formLocales,
|
|
332
|
+
...t13,
|
|
333
|
+
...t14,
|
|
334
|
+
...t15,
|
|
335
|
+
binding: FormBinding,
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ jsxs("form", {
|
|
338
|
+
ref: root,
|
|
339
|
+
id,
|
|
340
|
+
"aria-label": ariaLabel,
|
|
341
|
+
noValidate: true,
|
|
342
|
+
className: t16,
|
|
343
|
+
onSubmit: (event_0) => {
|
|
344
|
+
event_0.preventDefault();
|
|
345
|
+
form.submit().then(handle);
|
|
346
|
+
},
|
|
347
|
+
onKeyDown,
|
|
348
|
+
children: [
|
|
349
|
+
showSummary ? /* @__PURE__ */ jsx(ErrorSummary, {
|
|
350
|
+
errors: orderErrors(order, state.errors, formLocales),
|
|
351
|
+
fields: resolved.fields,
|
|
352
|
+
onSelect: goTo,
|
|
353
|
+
...summaryClassName !== void 0 ? { className: summaryClassName } : {}
|
|
354
|
+
}) : null,
|
|
355
|
+
t17,
|
|
356
|
+
/* @__PURE__ */ jsxs("div", {
|
|
357
|
+
className: t19,
|
|
358
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
332
359
|
className: Form_module_default.stack,
|
|
333
|
-
children: /* @__PURE__ */ jsx(LayoutNodes, {
|
|
334
|
-
nodes:
|
|
360
|
+
children: [/* @__PURE__ */ jsx(LayoutNodes, {
|
|
361
|
+
nodes: laidOut,
|
|
362
|
+
fields: resolved.fieldsByName
|
|
363
|
+
}), flow.length > 0 ? /* @__PURE__ */ jsx(FieldFlow, {
|
|
364
|
+
nodes: flow,
|
|
335
365
|
fields: resolved.fieldsByName
|
|
336
|
-
})
|
|
337
|
-
},
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
366
|
+
}) : null]
|
|
367
|
+
}), sidebar.length > 0 ? /* @__PURE__ */ jsx("aside", {
|
|
368
|
+
className: cx(Form_module_default.sidebar, sidebarClassName),
|
|
369
|
+
children: sidebar.map((node_3, index) => /* @__PURE__ */ jsx("div", {
|
|
370
|
+
className: Form_module_default.stack,
|
|
371
|
+
children: /* @__PURE__ */ jsx(LayoutNodes, {
|
|
372
|
+
nodes: node_3.children ?? [],
|
|
373
|
+
fields: resolved.fieldsByName
|
|
374
|
+
})
|
|
375
|
+
}, index))
|
|
376
|
+
}) : null]
|
|
377
|
+
}),
|
|
378
|
+
t20
|
|
379
|
+
]
|
|
380
|
+
}),
|
|
381
|
+
t25,
|
|
382
|
+
leave.dialog
|
|
383
|
+
]
|
|
384
|
+
})
|
|
346
385
|
})
|
|
347
386
|
})
|
|
348
387
|
});
|