@overmap-ai/forms 1.0.12 → 1.0.13
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.js +35 -8
- package/dist/forms.js.map +1 -1
- package/dist/forms.umd.cjs +35 -9
- package/dist/forms.umd.cjs.map +1 -1
- package/dist/style.css +8 -0
- package/package.json +3 -1
package/dist/forms.js
CHANGED
|
@@ -10,8 +10,9 @@ import { useField, useFormikContext, useFormik, FormikProvider } from "formik";
|
|
|
10
10
|
import React, { useMemo, memo, useCallback, useState, useEffect, useRef, forwardRef, Fragment as Fragment$1, useReducer } from "react";
|
|
11
11
|
import { CheckCircledIcon, FontFamilyIcon, CalendarIcon, InputIcon, RowsIcon, PlusIcon, Cross1Icon, ListBulletIcon, DropdownMenuIcon, CheckboxIcon, UploadIcon, StarFilledIcon, StarIcon, QuestionMarkCircledIcon, PersonIcon, Pencil1Icon, TrashIcon, CopyIcon, DragHandleDots2Icon, DotsVerticalIcon } from "@radix-ui/react-icons";
|
|
12
12
|
import { TextField as TextField$1, Box, Card, Heading, Avatar, Em, Strong, Tabs } from "@radix-ui/themes";
|
|
13
|
+
import Linkify from "linkify-react";
|
|
14
|
+
import { classNames, slugify, useAppSelector, selectFormRevision, useSDK, selectSubmissionAttachments, selectFilteredUserForms, selectUserFormMapping, selectOrganization, selectUser, selectNumberOfUserForms, selectCurrentUser, isToday, getLocalDateString, selectLatestFormRevision, useFileSrc, selectSubmissionsForForm } from "@overmap-ai/core";
|
|
13
15
|
import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
|
|
14
|
-
import { slugify, useAppSelector, selectFormRevision, useSDK, selectSubmissionAttachments, selectFilteredUserForms, selectUserFormMapping, selectOrganization, selectUser, selectNumberOfUserForms, selectCurrentUser, classNames, isToday, getLocalDateString, selectLatestFormRevision, useFileSrc, selectSubmissionsForForm } from "@overmap-ai/core";
|
|
15
16
|
import get from "lodash.get";
|
|
16
17
|
import set from "lodash.set";
|
|
17
18
|
import cloneDeep from "lodash.clonedeep";
|
|
@@ -106,7 +107,7 @@ class BaseField extends BaseFormElement {
|
|
|
106
107
|
__publicField(BaseField, "fieldTypeName");
|
|
107
108
|
__publicField(BaseField, "fieldTypeDescription");
|
|
108
109
|
const description$1 = "_description_17zed_1";
|
|
109
|
-
const styles$
|
|
110
|
+
const styles$4 = {
|
|
110
111
|
description: description$1
|
|
111
112
|
};
|
|
112
113
|
const InputWithLabel = (props) => {
|
|
@@ -120,7 +121,7 @@ const InputWithLabelAndHelpText = (props) => {
|
|
|
120
121
|
const { helpText, children, severity } = props;
|
|
121
122
|
return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
|
|
122
123
|
children,
|
|
123
|
-
/* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx(Text, { size: "1", severity, className: styles$
|
|
124
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", children: /* @__PURE__ */ jsx(Text, { size: "1", severity, className: styles$4.description, children: helpText }) })
|
|
124
125
|
] });
|
|
125
126
|
};
|
|
126
127
|
const useFormikInput = (props) => {
|
|
@@ -472,10 +473,37 @@ __publicField(StringOrTextField, "_validateMax", (value, allValues) => {
|
|
|
472
473
|
}
|
|
473
474
|
return null;
|
|
474
475
|
});
|
|
476
|
+
const clickableLinkContainer = "_clickableLinkContainer_1ace7_1";
|
|
477
|
+
const TextFieldInputCopy = "_TextFieldInputCopy_1ace7_5";
|
|
478
|
+
const styles$3 = {
|
|
479
|
+
clickableLinkContainer,
|
|
480
|
+
TextFieldInputCopy
|
|
481
|
+
};
|
|
475
482
|
const StringInput = memo(function StringInput2(props) {
|
|
476
483
|
const [{ inputId, labelId, severity, helpText, label, fieldProps, field }, rest] = useFormikInput(props);
|
|
477
484
|
const color = useSeverityColor(severity);
|
|
478
|
-
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(InputWithLabel, { severity, inputId, labelId, label, children: /* @__PURE__ */ jsx(TextField$1.Input, { ...rest, ...fieldProps, type: field.inputType, id: inputId, color })
|
|
485
|
+
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText, severity, children: /* @__PURE__ */ jsx(InputWithLabel, { 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$3.clickableLinkContainer, children: [
|
|
486
|
+
/* @__PURE__ */ jsx(
|
|
487
|
+
"div",
|
|
488
|
+
{
|
|
489
|
+
className: classNames(
|
|
490
|
+
"rt-TextFieldInput rt-r-size-2 rt-variant-surface",
|
|
491
|
+
styles$3.TextFieldInputCopy
|
|
492
|
+
),
|
|
493
|
+
children: /* @__PURE__ */ jsx(
|
|
494
|
+
Linkify,
|
|
495
|
+
{
|
|
496
|
+
options: {
|
|
497
|
+
target: "_blank",
|
|
498
|
+
rel: "noopener"
|
|
499
|
+
},
|
|
500
|
+
children: fieldProps.value
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
}
|
|
504
|
+
),
|
|
505
|
+
/* @__PURE__ */ jsx("div", { className: "rt-TextFieldChrome" })
|
|
506
|
+
] }) }) });
|
|
479
507
|
});
|
|
480
508
|
const _StringField = class _StringField extends StringOrTextField {
|
|
481
509
|
constructor(options) {
|
|
@@ -1011,7 +1039,7 @@ const FieldSectionLayout = memo(function FieldSectionLayout2(props) {
|
|
|
1011
1039
|
return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "3", children: [
|
|
1012
1040
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
1013
1041
|
/* @__PURE__ */ jsx(Heading, { as: "h3", size: "3", children: label }),
|
|
1014
|
-
/* @__PURE__ */ jsx(Text, { className: styles$
|
|
1042
|
+
/* @__PURE__ */ jsx(Text, { className: styles$4.description, children: description2 })
|
|
1015
1043
|
] }),
|
|
1016
1044
|
inputs
|
|
1017
1045
|
] }) });
|
|
@@ -1534,7 +1562,7 @@ const FormRenderer = memo(
|
|
|
1534
1562
|
[schema.title]
|
|
1535
1563
|
);
|
|
1536
1564
|
const Description = useMemo(
|
|
1537
|
-
() => typeof schema.description === "string" ? /* @__PURE__ */ jsx(Text, { className: styles$
|
|
1565
|
+
() => typeof schema.description === "string" ? /* @__PURE__ */ jsx(Text, { className: styles$4.description, children: schema.description }) : schema.description,
|
|
1538
1566
|
[schema.description]
|
|
1539
1567
|
);
|
|
1540
1568
|
const inputs = useFieldInputs(schema.fields, { formId: formId2, disabled: readonly });
|
|
@@ -2153,7 +2181,6 @@ const FieldActions = memo(function FieldActions2(props) {
|
|
|
2153
2181
|
DropdownItemMenu,
|
|
2154
2182
|
{
|
|
2155
2183
|
trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(DotsVerticalIcon, {}) }),
|
|
2156
|
-
closeOnSelect: false,
|
|
2157
2184
|
items: actions.map((Action) => {
|
|
2158
2185
|
var _a;
|
|
2159
2186
|
if (Action.disableOnMobile)
|
|
@@ -2399,7 +2426,7 @@ const FieldSectionWithActions = memo(function FieldSectionWithActions2(props) {
|
|
|
2399
2426
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", grow: "1", children: [
|
|
2400
2427
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
|
|
2401
2428
|
/* @__PURE__ */ jsx(Heading, { as: "h3", size: "3", children: field.label }),
|
|
2402
|
-
/* @__PURE__ */ jsx(Text, { className: styles$
|
|
2429
|
+
/* @__PURE__ */ jsx(Text, { className: styles$4.description, children: field.description })
|
|
2403
2430
|
] }),
|
|
2404
2431
|
field.condition && /* @__PURE__ */ jsx(Text, { size: "1", children: /* @__PURE__ */ jsxs(Em, { children: [
|
|
2405
2432
|
"Display only if ",
|