@overmap-ai/core 1.0.33-revamp-forms-builder.6 → 1.0.33-revamp-forms-builder.8
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/forms/fields/FieldSection/FieldSectionLayout.d.ts +1 -1
- package/dist/forms/fields/NumberField/NumberInput.d.ts +1 -1
- package/dist/forms/fields/constants.d.ts +2 -1
- package/dist/overmap-core.js +101 -112
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +101 -112
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/style.css +48 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { NumberField } from ".";
|
|
2
|
+
import type { NumberField } from "./NumberField.tsx";
|
|
3
3
|
import { ComponentProps } from "../typings.ts";
|
|
4
4
|
export declare const NumberInput: import("react").NamedExoticComponent<ComponentProps<NumberField>>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { StringField, TextField } from "./StringOrTextFields";
|
|
2
2
|
import { BooleanField } from "./BooleanField";
|
|
3
3
|
import { DateField } from "./DateField";
|
|
4
|
+
import { NumberField } from "./NumberField";
|
|
4
5
|
import { MultiSelectField, SelectField } from "./SelectField";
|
|
5
6
|
import { CustomField } from "./CustomField";
|
|
6
7
|
import { MultiStringField } from "./MultiStringField";
|
|
7
8
|
import { UploadField } from "./UploadField";
|
|
8
9
|
export declare const FieldTypeToClsMapping: {
|
|
9
10
|
readonly date: typeof DateField;
|
|
10
|
-
readonly number: typeof
|
|
11
|
+
readonly number: typeof NumberField;
|
|
11
12
|
readonly boolean: typeof BooleanField;
|
|
12
13
|
readonly select: typeof SelectField;
|
|
13
14
|
readonly string: typeof StringField;
|
package/dist/overmap-core.js
CHANGED
|
@@ -375,7 +375,7 @@ function Item(fun, array) {
|
|
|
375
375
|
Item.prototype.run = function() {
|
|
376
376
|
this.fun.apply(null, this.array);
|
|
377
377
|
};
|
|
378
|
-
var title = "browser";
|
|
378
|
+
var title$1 = "browser";
|
|
379
379
|
var platform = "browser";
|
|
380
380
|
var browser = true;
|
|
381
381
|
var env = {};
|
|
@@ -431,7 +431,7 @@ function uptime() {
|
|
|
431
431
|
}
|
|
432
432
|
var browser$1 = {
|
|
433
433
|
nextTick,
|
|
434
|
-
title,
|
|
434
|
+
title: title$1,
|
|
435
435
|
browser,
|
|
436
436
|
env,
|
|
437
437
|
argv,
|
|
@@ -3441,15 +3441,15 @@ const defaultStore = configureStore({
|
|
|
3441
3441
|
});
|
|
3442
3442
|
}
|
|
3443
3443
|
});
|
|
3444
|
-
function extractResponseFromError(
|
|
3444
|
+
function extractResponseFromError(error2) {
|
|
3445
3445
|
function isResponse(response) {
|
|
3446
3446
|
const knownKeys = ["ok", "redirect", "clientError", "serverError", "error"];
|
|
3447
3447
|
return typeof response === "object" && response !== null && knownKeys.every((key) => key in response);
|
|
3448
3448
|
}
|
|
3449
|
-
if (isResponse(
|
|
3450
|
-
return
|
|
3451
|
-
if (typeof
|
|
3452
|
-
const typedError =
|
|
3449
|
+
if (isResponse(error2))
|
|
3450
|
+
return error2;
|
|
3451
|
+
if (typeof error2 === "object" && error2 !== null) {
|
|
3452
|
+
const typedError = error2;
|
|
3453
3453
|
if (isResponse(typedError.response))
|
|
3454
3454
|
return typedError.response;
|
|
3455
3455
|
if (typedError.response && isResponse(typedError.response.response))
|
|
@@ -3566,8 +3566,8 @@ async function performRequest(action, client) {
|
|
|
3566
3566
|
}
|
|
3567
3567
|
try {
|
|
3568
3568
|
return await requestToSend.query(queryParams);
|
|
3569
|
-
} catch (
|
|
3570
|
-
const errorResponse = extractResponseFromError(
|
|
3569
|
+
} catch (error2) {
|
|
3570
|
+
const errorResponse = extractResponseFromError(error2);
|
|
3571
3571
|
const status = errorResponse == null ? void 0 : errorResponse.status;
|
|
3572
3572
|
if (status === 401) {
|
|
3573
3573
|
console.debug("Forbidden; renewing tokens and retrying.");
|
|
@@ -3575,8 +3575,8 @@ async function performRequest(action, client) {
|
|
|
3575
3575
|
await client.auth.renewTokens();
|
|
3576
3576
|
console.debug("Successfully renewed tokens; retrying request.");
|
|
3577
3577
|
return await requestToSend.query(queryParams);
|
|
3578
|
-
} catch (
|
|
3579
|
-
console.warn("Failed to renew tokens.",
|
|
3578
|
+
} catch (error22) {
|
|
3579
|
+
console.warn("Failed to renew tokens.", error22);
|
|
3580
3580
|
const loggedIn = state.authReducer.isLoggedIn;
|
|
3581
3581
|
if (loggedIn) {
|
|
3582
3582
|
console.warn("Signing out already signed-in user.");
|
|
@@ -3589,7 +3589,7 @@ async function performRequest(action, client) {
|
|
|
3589
3589
|
});
|
|
3590
3590
|
}
|
|
3591
3591
|
}
|
|
3592
|
-
const apiErrorMessage = extractErrorMessage(errorResponse,
|
|
3592
|
+
const apiErrorMessage = extractErrorMessage(errorResponse, error2) || "An unexpected error occurred.";
|
|
3593
3593
|
throw new APIError(apiErrorMessage, errorResponse, {
|
|
3594
3594
|
discard: discardStatuses.includes(status)
|
|
3595
3595
|
});
|
|
@@ -3781,9 +3781,9 @@ class BaseApiService {
|
|
|
3781
3781
|
};
|
|
3782
3782
|
performRequest(fullOfflineAction, this.client).then((result) => {
|
|
3783
3783
|
promise.resolve(result.body);
|
|
3784
|
-
}).catch((
|
|
3785
|
-
discard(
|
|
3786
|
-
promise.reject(
|
|
3784
|
+
}).catch((error2) => {
|
|
3785
|
+
discard(error2, fullOfflineAction);
|
|
3786
|
+
promise.reject(error2);
|
|
3787
3787
|
});
|
|
3788
3788
|
} else {
|
|
3789
3789
|
const innerPromise = store.dispatch(
|
|
@@ -3793,19 +3793,19 @@ class BaseApiService {
|
|
|
3793
3793
|
if (response) {
|
|
3794
3794
|
promise.resolve(response.body);
|
|
3795
3795
|
} else {
|
|
3796
|
-
const
|
|
3796
|
+
const error2 = new APIError(
|
|
3797
3797
|
"Could not get a response from the server.",
|
|
3798
3798
|
response,
|
|
3799
3799
|
{
|
|
3800
3800
|
discard: true
|
|
3801
3801
|
}
|
|
3802
3802
|
);
|
|
3803
|
-
promise.reject(
|
|
3803
|
+
promise.reject(error2);
|
|
3804
3804
|
}
|
|
3805
3805
|
};
|
|
3806
|
-
const errorHandler = (
|
|
3807
|
-
|
|
3808
|
-
promise.reject(
|
|
3806
|
+
const errorHandler = (error2) => {
|
|
3807
|
+
error2.options.discard = true;
|
|
3808
|
+
promise.reject(error2);
|
|
3809
3809
|
};
|
|
3810
3810
|
innerPromise.then(successOrUndefinedHandler, errorHandler);
|
|
3811
3811
|
}
|
|
@@ -4752,17 +4752,17 @@ class IssueService extends BaseApiService {
|
|
|
4752
4752
|
});
|
|
4753
4753
|
void promise.then((result) => {
|
|
4754
4754
|
store.dispatch(updateIssue(result));
|
|
4755
|
-
}).catch((
|
|
4755
|
+
}).catch((error2) => {
|
|
4756
4756
|
var _a2;
|
|
4757
|
-
console.error(
|
|
4758
|
-
if (
|
|
4757
|
+
console.error(error2);
|
|
4758
|
+
if (error2 instanceof APIError) {
|
|
4759
4759
|
(_a2 = unsafeShowToast) == null ? void 0 : _a2({
|
|
4760
4760
|
title: "Could not create issue",
|
|
4761
4761
|
description: "An unexpected error occurred while creating the issue."
|
|
4762
4762
|
});
|
|
4763
4763
|
}
|
|
4764
4764
|
store.dispatch(removeIssue(issuePayload.offline_id));
|
|
4765
|
-
throw
|
|
4765
|
+
throw error2;
|
|
4766
4766
|
});
|
|
4767
4767
|
return [issuePayload, promise];
|
|
4768
4768
|
}
|
|
@@ -6089,6 +6089,20 @@ const OvermapProvider = (props) => {
|
|
|
6089
6089
|
}
|
|
6090
6090
|
return /* @__PURE__ */ jsx(OvermapContext.Provider, { value: null, children: ret });
|
|
6091
6091
|
};
|
|
6092
|
+
const tabsList = "_tabsList_h0sgi_1";
|
|
6093
|
+
const tabTrigger = "_tabTrigger_h0sgi_9";
|
|
6094
|
+
const floatingButtonContainer = "_floatingButtonContainer_h0sgi_13";
|
|
6095
|
+
const title = "_title_h0sgi_20";
|
|
6096
|
+
const description$2 = "_description_h0sgi_26";
|
|
6097
|
+
const error = "_error_h0sgi_33";
|
|
6098
|
+
const styles$7 = {
|
|
6099
|
+
tabsList,
|
|
6100
|
+
tabTrigger,
|
|
6101
|
+
floatingButtonContainer,
|
|
6102
|
+
title,
|
|
6103
|
+
description: description$2,
|
|
6104
|
+
error
|
|
6105
|
+
};
|
|
6092
6106
|
class BaseFormElement {
|
|
6093
6107
|
constructor(options) {
|
|
6094
6108
|
__publicField(this, "type");
|
|
@@ -6155,15 +6169,15 @@ class BaseField extends BaseFormElement {
|
|
|
6155
6169
|
return "This field is required.";
|
|
6156
6170
|
}
|
|
6157
6171
|
for (const validator of this.getFieldValidators()) {
|
|
6158
|
-
const
|
|
6159
|
-
if (
|
|
6160
|
-
return
|
|
6172
|
+
const error2 = validator(value);
|
|
6173
|
+
if (error2)
|
|
6174
|
+
return error2;
|
|
6161
6175
|
}
|
|
6162
6176
|
if (allValues) {
|
|
6163
6177
|
for (const validator of this.getFormValidators()) {
|
|
6164
|
-
const
|
|
6165
|
-
if (
|
|
6166
|
-
return
|
|
6178
|
+
const error2 = validator(value, allValues);
|
|
6179
|
+
if (error2)
|
|
6180
|
+
return error2;
|
|
6167
6181
|
}
|
|
6168
6182
|
}
|
|
6169
6183
|
}
|
|
@@ -6185,7 +6199,7 @@ class BaseField extends BaseFormElement {
|
|
|
6185
6199
|
__publicField(BaseField, "fieldTypeName");
|
|
6186
6200
|
__publicField(BaseField, "fieldTypeDescription");
|
|
6187
6201
|
const description$1 = "_description_17zed_1";
|
|
6188
|
-
const styles$
|
|
6202
|
+
const styles$6 = {
|
|
6189
6203
|
description: description$1
|
|
6190
6204
|
};
|
|
6191
6205
|
const InputWithLabel = (props) => {
|
|
@@ -6199,7 +6213,7 @@ const InputWithHelpText = (props) => {
|
|
|
6199
6213
|
const { helpText, children, severity } = props;
|
|
6200
6214
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
|
|
6201
6215
|
children,
|
|
6202
|
-
/* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx(Text, { size: "1", severity, className: styles$
|
|
6216
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx(Text, { size: "1", severity, className: styles$6.description, children: helpText }) })
|
|
6203
6217
|
] });
|
|
6204
6218
|
};
|
|
6205
6219
|
const InputWithLabelAndHelpText = (props) => {
|
|
@@ -8217,20 +8231,20 @@ __publicField(StringOrTextField, "_validateMax", (path) => (value, allValues) =>
|
|
|
8217
8231
|
});
|
|
8218
8232
|
const clickableLinkContainer = "_clickableLinkContainer_1ace7_1";
|
|
8219
8233
|
const TextFieldInputCopy = "_TextFieldInputCopy_1ace7_5";
|
|
8220
|
-
const styles$
|
|
8234
|
+
const styles$5 = {
|
|
8221
8235
|
clickableLinkContainer,
|
|
8222
8236
|
TextFieldInputCopy
|
|
8223
8237
|
};
|
|
8224
8238
|
const StringInput = memo(function StringInput2(props) {
|
|
8225
8239
|
const [{ inputId, labelId, size, severity, helpText, label, fieldProps, field }, rest] = useFormikInput(props);
|
|
8226
8240
|
const color = useSeverityColor(severity);
|
|
8227
|
-
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(InputWithLabel, { size, severity, inputId, labelId, label, children: !rest.disabled ? /* @__PURE__ */ jsx(TextField$1.Input, { ...rest, ...fieldProps, type: field.inputType, id: inputId, color }) : /* @__PURE__ */ jsxs(TextField$1.Root, { className: styles$
|
|
8241
|
+
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(InputWithLabel, { size, severity, inputId, labelId, label, children: !rest.disabled ? /* @__PURE__ */ jsx(TextField$1.Input, { ...rest, ...fieldProps, type: field.inputType, id: inputId, color }) : /* @__PURE__ */ jsxs(TextField$1.Root, { className: styles$5.clickableLinkContainer, children: [
|
|
8228
8242
|
/* @__PURE__ */ jsx(
|
|
8229
8243
|
"div",
|
|
8230
8244
|
{
|
|
8231
8245
|
className: classNames$1(
|
|
8232
8246
|
"rt-TextFieldInput rt-r-size-2 rt-variant-surface",
|
|
8233
|
-
styles$
|
|
8247
|
+
styles$5.TextFieldInputCopy
|
|
8234
8248
|
),
|
|
8235
8249
|
children: /* @__PURE__ */ jsx(
|
|
8236
8250
|
Linkify,
|
|
@@ -8894,7 +8908,7 @@ class CustomField extends BaseField {
|
|
|
8894
8908
|
__publicField(CustomField, "fieldTypeName", "Custom");
|
|
8895
8909
|
__publicField(CustomField, "fieldTypeDescription", "Allows re-rendering of field already in the form");
|
|
8896
8910
|
const previewImage = "_previewImage_1ig84_1";
|
|
8897
|
-
const styles$
|
|
8911
|
+
const styles$4 = {
|
|
8898
8912
|
previewImage
|
|
8899
8913
|
};
|
|
8900
8914
|
const convertBytesToLargestUnit = (bytes) => {
|
|
@@ -8983,7 +8997,7 @@ const NumberInput = memo(function NumberInput22(props) {
|
|
|
8983
8997
|
});
|
|
8984
8998
|
const DisplayFile = memo(function DisplayFile2({ file, field, onRemove, disabled }) {
|
|
8985
8999
|
const [resolvedFile, setResolvedFile] = useState(null);
|
|
8986
|
-
const
|
|
9000
|
+
const error2 = useMemo(() => resolvedFile && field.getError([resolvedFile]), [field, resolvedFile]);
|
|
8987
9001
|
const { url, name, size } = useMemo(() => {
|
|
8988
9002
|
let url2 = null;
|
|
8989
9003
|
let name2;
|
|
@@ -9023,10 +9037,10 @@ const DisplayFile = memo(function DisplayFile2({ file, field, onRemove, disabled
|
|
|
9023
9037
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
|
|
9024
9038
|
/* @__PURE__ */ jsx(Text, { children: name }),
|
|
9025
9039
|
/* @__PURE__ */ jsx(Text, { size: "1", children: size }),
|
|
9026
|
-
|
|
9040
|
+
error2 && /* @__PURE__ */ jsx(Text, { size: "1", severity: "danger", children: error2 })
|
|
9027
9041
|
] })
|
|
9028
9042
|
] }),
|
|
9029
|
-
url && /* @__PURE__ */ jsx("img", { className: styles$
|
|
9043
|
+
url && /* @__PURE__ */ jsx("img", { className: styles$4.previewImage, src: url, alt: name })
|
|
9030
9044
|
] }) });
|
|
9031
9045
|
});
|
|
9032
9046
|
const emptyUploadField = {
|
|
@@ -9154,9 +9168,11 @@ __publicField(_UploadField, "fieldTypeName", "Upload");
|
|
|
9154
9168
|
__publicField(_UploadField, "fieldTypeDescription", "Allows a file to be uploaded.");
|
|
9155
9169
|
__publicField(_UploadField, "Icon", UploadIcon);
|
|
9156
9170
|
let UploadField = _UploadField;
|
|
9171
|
+
console.log(NumberField);
|
|
9172
|
+
console.log(DateField);
|
|
9157
9173
|
const FieldTypeToClsMapping = {
|
|
9158
9174
|
date: DateField,
|
|
9159
|
-
number:
|
|
9175
|
+
number: NumberField,
|
|
9160
9176
|
boolean: BooleanField,
|
|
9161
9177
|
select: SelectField,
|
|
9162
9178
|
string: StringField,
|
|
@@ -9236,7 +9252,7 @@ const FieldSectionLayout = memo(function FieldSectionLayout2(props) {
|
|
|
9236
9252
|
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "3", children: [
|
|
9237
9253
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
9238
9254
|
/* @__PURE__ */ jsx(Heading, { as: "h3", size: "3", children: label }),
|
|
9239
|
-
/* @__PURE__ */ jsx(Text, { className: styles$
|
|
9255
|
+
/* @__PURE__ */ jsx(Text, { className: styles$6.description, children: description2 })
|
|
9240
9256
|
] }),
|
|
9241
9257
|
inputs
|
|
9242
9258
|
] }) });
|
|
@@ -9363,9 +9379,9 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
9363
9379
|
const errors = {};
|
|
9364
9380
|
for (const field of this.fields) {
|
|
9365
9381
|
const id = field.getId();
|
|
9366
|
-
const
|
|
9367
|
-
if (
|
|
9368
|
-
set(errors, field.getId(),
|
|
9382
|
+
const error2 = field.getError(get(allValues, id), allValues);
|
|
9383
|
+
if (error2) {
|
|
9384
|
+
set(errors, field.getId(), error2);
|
|
9369
9385
|
}
|
|
9370
9386
|
}
|
|
9371
9387
|
return errors;
|
|
@@ -9566,9 +9582,9 @@ const validateForm = (schema, form) => {
|
|
|
9566
9582
|
throw new Error("Invalid field type");
|
|
9567
9583
|
}
|
|
9568
9584
|
const id = field.getId();
|
|
9569
|
-
const
|
|
9570
|
-
if (
|
|
9571
|
-
set(errors, id,
|
|
9585
|
+
const error2 = field.getError(get(form, id), form);
|
|
9586
|
+
if (error2)
|
|
9587
|
+
set(errors, id, error2);
|
|
9572
9588
|
}
|
|
9573
9589
|
}
|
|
9574
9590
|
if (hasKeys(errors))
|
|
@@ -9629,7 +9645,7 @@ const FormRenderer = memo(
|
|
|
9629
9645
|
[schema.title]
|
|
9630
9646
|
);
|
|
9631
9647
|
const Description = useMemo(
|
|
9632
|
-
() => typeof schema.description === "string" ? /* @__PURE__ */ jsx(Text, { className: styles$
|
|
9648
|
+
() => typeof schema.description === "string" ? /* @__PURE__ */ jsx(Text, { className: styles$6.description, children: schema.description }) : schema.description,
|
|
9633
9649
|
[schema.description]
|
|
9634
9650
|
);
|
|
9635
9651
|
const inputs = useFieldInputs(schema.fields, { formId: formId2, disabled: readonly });
|
|
@@ -9706,7 +9722,7 @@ const FormSubmissionViewer = memo(
|
|
|
9706
9722
|
);
|
|
9707
9723
|
const favoriteIcon = "_favoriteIcon_1bixi_1";
|
|
9708
9724
|
const regularIcon = "_regularIcon_1bixi_9";
|
|
9709
|
-
const styles$
|
|
9725
|
+
const styles$3 = {
|
|
9710
9726
|
favoriteIcon,
|
|
9711
9727
|
regularIcon
|
|
9712
9728
|
};
|
|
@@ -9818,7 +9834,7 @@ const FormBrowserEntry = (props) => {
|
|
|
9818
9834
|
/* @__PURE__ */ jsx(
|
|
9819
9835
|
IconButton,
|
|
9820
9836
|
{
|
|
9821
|
-
className: classNames$1(form.favorite ? styles$
|
|
9837
|
+
className: classNames$1(form.favorite ? styles$3.favoriteIcon : styles$3.regularIcon),
|
|
9822
9838
|
variant: "ghost",
|
|
9823
9839
|
onClick: handleFavoriteClick,
|
|
9824
9840
|
"aria-label": form.favorite ? "Favorite form" : "Standard form",
|
|
@@ -9844,7 +9860,7 @@ const FormBrowserEntry = (props) => {
|
|
|
9844
9860
|
};
|
|
9845
9861
|
const submissionsContainer = "_submissionsContainer_9iirt_1";
|
|
9846
9862
|
const stopHorizontalOverflow = "_stopHorizontalOverflow_9iirt_6";
|
|
9847
|
-
const styles$
|
|
9863
|
+
const styles$2 = {
|
|
9848
9864
|
submissionsContainer,
|
|
9849
9865
|
stopHorizontalOverflow
|
|
9850
9866
|
};
|
|
@@ -9875,7 +9891,7 @@ const FormSubmissionBrowserEntry = memo(function FormSubmissionBrowserEntry2(pro
|
|
|
9875
9891
|
}
|
|
9876
9892
|
}, [submission, onSubmissionClick]);
|
|
9877
9893
|
const row = /* @__PURE__ */ jsx(ButtonList.Item, { onClick: handleClick, asChild: true, children: /* @__PURE__ */ jsxs(Flex, { grow: "1", width: "100%", p: "2", gap: "2", justify: "between", children: [
|
|
9878
|
-
/* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", className: styles$
|
|
9894
|
+
/* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", className: styles$2.stopHorizontalOverflow, children: [
|
|
9879
9895
|
/* @__PURE__ */ jsx(Avatar, { src: creatorProfileSrc, size: "1", fallback: creatorProfileFallback }),
|
|
9880
9896
|
/* @__PURE__ */ jsx(Text, { size: "2", noWrap: true, children: labelType === "creator" ? (createdBy || currentUser).username : revision.title })
|
|
9881
9897
|
] }),
|
|
@@ -9919,7 +9935,7 @@ const FormSubmissionBrowser = memo(function FormSubmissionBrowser2(props) {
|
|
|
9919
9935
|
return /* @__PURE__ */ jsx(
|
|
9920
9936
|
ButtonList.Root,
|
|
9921
9937
|
{
|
|
9922
|
-
className: classNames$1(styles$
|
|
9938
|
+
className: classNames$1(styles$2.submissionsContainer, className),
|
|
9923
9939
|
size: "small",
|
|
9924
9940
|
variant,
|
|
9925
9941
|
before: !compact && /* @__PURE__ */ jsxs(Text, { severity: "info", children: [
|
|
@@ -9983,11 +9999,11 @@ const PatchFormProvider = memo(
|
|
|
9983
9999
|
);
|
|
9984
10000
|
const validate = useCallback(
|
|
9985
10001
|
(form) => {
|
|
9986
|
-
const
|
|
9987
|
-
if (
|
|
9988
|
-
onError(
|
|
10002
|
+
const error2 = validateForm(schema, form);
|
|
10003
|
+
if (error2) {
|
|
10004
|
+
onError(error2);
|
|
9989
10005
|
}
|
|
9990
|
-
return
|
|
10006
|
+
return error2;
|
|
9991
10007
|
},
|
|
9992
10008
|
[schema, onError]
|
|
9993
10009
|
);
|
|
@@ -10008,6 +10024,10 @@ const PatchFormProvider = memo(
|
|
|
10008
10024
|
return /* @__PURE__ */ jsx(FormikProvider, { value: formik, children: /* @__PURE__ */ jsx("form", { ...rest, ref, onSubmit: formik.handleSubmit, children }) });
|
|
10009
10025
|
})
|
|
10010
10026
|
);
|
|
10027
|
+
const typeBadge$1 = "_typeBadge_m8kq2_1";
|
|
10028
|
+
const styles$1 = {
|
|
10029
|
+
typeBadge: typeBadge$1
|
|
10030
|
+
};
|
|
10011
10031
|
const formId = "form-builder";
|
|
10012
10032
|
const fieldsToChoose = [
|
|
10013
10033
|
["string", "text"],
|
|
@@ -10168,8 +10188,12 @@ const FieldActions = memo((props) => {
|
|
|
10168
10188
|
] });
|
|
10169
10189
|
});
|
|
10170
10190
|
FieldActions.displayName = "FieldActions";
|
|
10171
|
-
const
|
|
10191
|
+
const popoverInputsContainer = "_popoverInputsContainer_12h31_1";
|
|
10192
|
+
const typeBadge = "_typeBadge_12h31_5";
|
|
10193
|
+
const description = "_description_12h31_10";
|
|
10172
10194
|
const styles = {
|
|
10195
|
+
popoverInputsContainer,
|
|
10196
|
+
typeBadge,
|
|
10173
10197
|
description
|
|
10174
10198
|
};
|
|
10175
10199
|
const FieldSettingsPopover = memo((props) => {
|
|
@@ -10193,7 +10217,7 @@ const FieldSettingsPopover = memo((props) => {
|
|
|
10193
10217
|
},
|
|
10194
10218
|
"settings"
|
|
10195
10219
|
),
|
|
10196
|
-
children: () => /* @__PURE__ */ jsx(Flex, {
|
|
10220
|
+
children: () => /* @__PURE__ */ jsx(Flex, { className: styles.popoverInputsContainer, direction: "column", children: popoverInputs })
|
|
10197
10221
|
}
|
|
10198
10222
|
);
|
|
10199
10223
|
});
|
|
@@ -10292,8 +10316,8 @@ const FieldBuilder = memo((props) => {
|
|
|
10292
10316
|
showPopoverInputs = initial.conditional;
|
|
10293
10317
|
}
|
|
10294
10318
|
const popoverHasErrors = popoverFields.some((field) => {
|
|
10295
|
-
const
|
|
10296
|
-
return
|
|
10319
|
+
const error2 = get(errors, fieldCls === FieldSection ? `${parentPath}.${index2}.condition` : field.getId());
|
|
10320
|
+
return error2 && (typeof error2 !== "object" || hasKeys(error2));
|
|
10297
10321
|
});
|
|
10298
10322
|
return /* @__PURE__ */ jsxs(Flex, { align: "center", grow: "1", children: [
|
|
10299
10323
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
@@ -10328,7 +10352,7 @@ const FieldBuilder = memo((props) => {
|
|
|
10328
10352
|
}
|
|
10329
10353
|
),
|
|
10330
10354
|
/* @__PURE__ */ jsxs(Flex, { align: "center", gap: "3", children: [
|
|
10331
|
-
/* @__PURE__ */ jsx(Badge, {
|
|
10355
|
+
/* @__PURE__ */ jsx(Badge, { className: styles.typeBadge, children: (_f = fieldTypeItems.flat().find((item) => item.value === type)) == null ? void 0 : _f.content }),
|
|
10332
10356
|
showPopoverInputs && /* @__PURE__ */ jsx(FieldSettingsPopover, { popoverInputs, hasError: popoverHasErrors })
|
|
10333
10357
|
] })
|
|
10334
10358
|
] }),
|
|
@@ -10339,7 +10363,6 @@ const FieldBuilder = memo((props) => {
|
|
|
10339
10363
|
render: ({ setValue, value }) => /* @__PURE__ */ jsx(
|
|
10340
10364
|
Input,
|
|
10341
10365
|
{
|
|
10342
|
-
className: styles.Input,
|
|
10343
10366
|
placeholder: `Enter a ${type === "section" ? "section" : "field"} label`,
|
|
10344
10367
|
value,
|
|
10345
10368
|
onChange: (event) => {
|
|
@@ -10360,7 +10383,7 @@ const FieldBuilder = memo((props) => {
|
|
|
10360
10383
|
render: ({ setValue, value }) => /* @__PURE__ */ jsx(
|
|
10361
10384
|
TextArea,
|
|
10362
10385
|
{
|
|
10363
|
-
|
|
10386
|
+
className: styles.description,
|
|
10364
10387
|
placeholder: `Enter a ${type === "section" ? "section" : "field"} description`,
|
|
10365
10388
|
value,
|
|
10366
10389
|
onChange: (event) => {
|
|
@@ -10745,7 +10768,7 @@ const BasicFieldSection = memo((props) => {
|
|
|
10745
10768
|
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", children: [
|
|
10746
10769
|
/* @__PURE__ */ jsxs(Flex, { direction: "row", gap: "2", children: [
|
|
10747
10770
|
/* @__PURE__ */ jsx(Text, { size: "4", children: field.label }),
|
|
10748
|
-
/* @__PURE__ */ jsx(Badge, {
|
|
10771
|
+
/* @__PURE__ */ jsx(Badge, { className: styles$1.typeBadge, children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
10749
10772
|
field.fields.length,
|
|
10750
10773
|
" Fields"
|
|
10751
10774
|
] }) })
|
|
@@ -10753,7 +10776,7 @@ const BasicFieldSection = memo((props) => {
|
|
|
10753
10776
|
/* @__PURE__ */ jsx(Flex, { direction: "row", gap: "2", children: field.fields.map((child) => {
|
|
10754
10777
|
const childInfo = FieldTypeToClsMapping[child.type];
|
|
10755
10778
|
const Icon = childInfo.Icon;
|
|
10756
|
-
return /* @__PURE__ */ jsx(Flex, { gap: "3", children: /* @__PURE__ */ jsxs(Badge, {
|
|
10779
|
+
return /* @__PURE__ */ jsx(Flex, { gap: "3", children: /* @__PURE__ */ jsxs(Badge, { className: styles$1.typeBadge, children: [
|
|
10757
10780
|
/* @__PURE__ */ jsx(Icon, {}),
|
|
10758
10781
|
/* @__PURE__ */ jsx(Text, { children: childInfo.fieldTypeName })
|
|
10759
10782
|
] }) }, child.identifier);
|
|
@@ -10905,22 +10928,10 @@ const FormBuilder = memo(
|
|
|
10905
10928
|
});
|
|
10906
10929
|
const previewSchema = useMemo(() => formRevisionToSchema(formik.values), [formik.values]);
|
|
10907
10930
|
return /* @__PURE__ */ jsx(Tabs.Root, { ref, defaultValue: "edit", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", children: [
|
|
10908
|
-
/* @__PURE__ */ jsxs(
|
|
10909
|
-
Tabs.
|
|
10910
|
-
{
|
|
10911
|
-
|
|
10912
|
-
display: "flex",
|
|
10913
|
-
position: "sticky",
|
|
10914
|
-
top: 0,
|
|
10915
|
-
zIndex: 2e3,
|
|
10916
|
-
backgroundColor: "var(--color-background)"
|
|
10917
|
-
},
|
|
10918
|
-
children: [
|
|
10919
|
-
/* @__PURE__ */ jsx(Tabs.Trigger, { style: { flex: 1 }, value: "edit", children: "Edit" }),
|
|
10920
|
-
/* @__PURE__ */ jsx(Tabs.Trigger, { style: { flex: 1 }, value: "preview", children: "Preview" })
|
|
10921
|
-
]
|
|
10922
|
-
}
|
|
10923
|
-
),
|
|
10931
|
+
/* @__PURE__ */ jsxs(Tabs.List, { className: styles$7.TabsList, children: [
|
|
10932
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { className: styles$7.tabTrigger, value: "edit", children: "Edit" }),
|
|
10933
|
+
/* @__PURE__ */ jsx(Tabs.Trigger, { className: styles$7.tabTrigger, value: "preview", children: "Preview" })
|
|
10934
|
+
] }),
|
|
10924
10935
|
/* @__PURE__ */ jsxs(Tabs.Content, { value: "edit", children: [
|
|
10925
10936
|
/* @__PURE__ */ jsxs(Text, { children: [
|
|
10926
10937
|
"Create your form using various field types. Sections can be",
|
|
@@ -10939,12 +10950,9 @@ const FormBuilder = memo(
|
|
|
10939
10950
|
render: ({ setValue, value, meta }) => /* @__PURE__ */ jsx(InputWithHelpText, { severity: "danger", helpText: meta.error ?? null, children: /* @__PURE__ */ jsx(
|
|
10940
10951
|
Input,
|
|
10941
10952
|
{
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
paddingLeft: "8px",
|
|
10946
|
-
fontWeight: "bold"
|
|
10947
|
-
},
|
|
10953
|
+
className: classNames$1(styles$7.title, {
|
|
10954
|
+
[styles$7.error]: meta.error
|
|
10955
|
+
}),
|
|
10948
10956
|
placeholder: "Form title",
|
|
10949
10957
|
value,
|
|
10950
10958
|
onChange: (event) => {
|
|
@@ -10965,12 +10973,7 @@ const FormBuilder = memo(
|
|
|
10965
10973
|
render: ({ setValue, value }) => /* @__PURE__ */ jsx(
|
|
10966
10974
|
TextArea,
|
|
10967
10975
|
{
|
|
10968
|
-
|
|
10969
|
-
minHeight: "max-content",
|
|
10970
|
-
border: "1px solid #5a6169",
|
|
10971
|
-
paddingLeft: "8px",
|
|
10972
|
-
paddingTop: "8px"
|
|
10973
|
-
},
|
|
10976
|
+
className: styles$7.description,
|
|
10974
10977
|
placeholder: "Explain the purpose of this form",
|
|
10975
10978
|
value,
|
|
10976
10979
|
onChange: (event) => {
|
|
@@ -10987,24 +10990,10 @@ const FormBuilder = memo(
|
|
|
10987
10990
|
/* @__PURE__ */ jsx(FieldsEditor, {}),
|
|
10988
10991
|
/* @__PURE__ */ jsx(Text, { severity: "danger", size: "1", children: typeof formik.errors.fields === "string" && formik.errors.fields })
|
|
10989
10992
|
] }),
|
|
10990
|
-
/* @__PURE__ */ jsxs(
|
|
10991
|
-
|
|
10992
|
-
{
|
|
10993
|
-
|
|
10994
|
-
align: "center",
|
|
10995
|
-
gap: "2",
|
|
10996
|
-
style: {
|
|
10997
|
-
position: "sticky",
|
|
10998
|
-
bottom: 0,
|
|
10999
|
-
paddingBottom: "10px",
|
|
11000
|
-
paddingRight: "10px"
|
|
11001
|
-
},
|
|
11002
|
-
children: [
|
|
11003
|
-
/* @__PURE__ */ jsx(Button, { type: "button", variant: "solid", severity: "info", onClick: onCancel, children: "Cancel" }),
|
|
11004
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", children: "Save form" })
|
|
11005
|
-
]
|
|
11006
|
-
}
|
|
11007
|
-
)
|
|
10993
|
+
/* @__PURE__ */ jsxs(Flex, { className: styles$7.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
|
|
10994
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "solid", severity: "info", onClick: onCancel, children: "Cancel" }),
|
|
10995
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", children: "Save form" })
|
|
10996
|
+
] })
|
|
11008
10997
|
] }) })
|
|
11009
10998
|
] }),
|
|
11010
10999
|
/* @__PURE__ */ jsx(Tabs.Content, { value: "preview", children: /* @__PURE__ */ jsx(FormRenderer, { schema: previewSchema, onSubmit: previewSubmit }) })
|