@overmap-ai/forms 1.0.10-conditional-arrows-2.4 → 1.0.10

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.
@@ -1,11 +1,12 @@
1
1
  /// <reference types="react" />
2
+ import { DraggableProvidedDragHandleProps } from "@hello-pangea/dnd";
2
3
  import { FieldBuilderArgs } from "./FieldBuilder";
3
4
  interface FieldActionsProps {
4
5
  remove: () => void;
6
+ dragHandleProps: DraggableProvidedDragHandleProps | null | undefined;
5
7
  editProps: FieldBuilderArgs;
6
8
  insertAfterProps: FieldBuilderArgs;
7
9
  duplicateProps: FieldBuilderArgs;
8
- type?: string;
9
10
  }
10
11
  export declare const FieldActions: import("react").NamedExoticComponent<FieldActionsProps>;
11
12
  export {};
@@ -4,7 +4,6 @@ import { DropState } from "./DropDispatch";
4
4
  interface FieldSectionWithActionsProps {
5
5
  field: SerializedFieldSection;
6
6
  index: number;
7
- conditionalFieldCounts: (number | null)[];
8
7
  dropState: DropState;
9
8
  }
10
9
  export declare const FieldSectionWithActions: import("react").NamedExoticComponent<FieldSectionWithActionsProps>;
@@ -2,7 +2,7 @@ import { ISerializedField, SerializedBooleanField } from "@overmap-ai/core";
2
2
  import { BaseField, ChildFieldOptions } from "../BaseField";
3
3
  import { ChangeEvent, ReactNode } from "react";
4
4
  import { ComponentProps } from "../typings";
5
- import { CheckCircledIcon } from "@overmap-ai/blocks";
5
+ import { CheckCircledIcon } from "@radix-ui/react-icons";
6
6
  export declare class BooleanField extends BaseField<boolean, "boolean"> {
7
7
  static readonly fieldTypeName = "Checkbox";
8
8
  static readonly fieldTypeDescription = "Perfect for both optional and required yes/no questions.";
@@ -2,7 +2,7 @@ import { ISerializedField, SerializedDateField } from "@overmap-ai/core";
2
2
  import { BaseField, ChildFieldOptions } from "../BaseField";
3
3
  import { GetInputProps } from "../typings";
4
4
  import React from "react";
5
- import { CalendarIcon } from "@overmap-ai/blocks";
5
+ import { CalendarIcon } from "@radix-ui/react-icons";
6
6
  export declare class DateField extends BaseField<string, "date"> {
7
7
  static readonly fieldTypeName = "Date";
8
8
  static readonly fieldTypeDescription = "Allows specifying a date.";
@@ -2,7 +2,7 @@ import { BaseField, ChildFieldOptions } from "../BaseField";
2
2
  import { ISerializedField, SelectFieldOption, SerializedMultiStringField } from "@overmap-ai/core";
3
3
  import { GetInputProps, InputFieldLevelValidator } from "../typings.ts";
4
4
  import { ReactNode } from "react";
5
- import { ListBulletIcon } from "@overmap-ai/blocks";
5
+ import { ListBulletIcon } from "@radix-ui/react-icons";
6
6
  type MultiStringFieldOptions = ChildFieldOptions<SelectFieldOption[]> & {
7
7
  minimum_length?: number;
8
8
  maximum_length?: number;
@@ -3,7 +3,7 @@ import { BooleanField } from "../BooleanField";
3
3
  import { BaseField, ChildFieldOptions } from "../BaseField";
4
4
  import { GetInputProps, InputFieldLevelValidator, InputValidator } from "../typings";
5
5
  import { ChangeEvent, ReactNode } from "react";
6
- import { FontFamilyIcon } from "@overmap-ai/blocks";
6
+ import { FontFamilyIcon } from "@radix-ui/react-icons";
7
7
  export type NumberFieldValue = number | "";
8
8
  export interface NumberFieldOptions extends ChildFieldOptions<NumberFieldValue> {
9
9
  maximum?: number;
@@ -2,7 +2,7 @@ import { ISerializedField, SelectFieldOptionValue, SerializedMultiSelectField }
2
2
  import { ReactNode } from "react";
3
3
  import { GetInputProps } from "../typings";
4
4
  import { BaseSelectField, BaseSelectFieldOptions } from "./BaseSelectField";
5
- import { CheckboxIcon } from "@overmap-ai/blocks";
5
+ import { CheckboxIcon } from "@radix-ui/react-icons";
6
6
  /**
7
7
  * The options passed to the constructor of MultiSelectField.
8
8
  */
@@ -2,7 +2,7 @@ import { ISerializedField, SelectFieldOptionValue, SerializedSelectField } from
2
2
  import { ReactNode } from "react";
3
3
  import { GetInputProps } from "../typings";
4
4
  import { BaseSelectField, BaseSelectFieldOptions } from "./BaseSelectField";
5
- import { DropdownMenuIcon } from "@overmap-ai/blocks";
5
+ import { DropdownMenuIcon } from "@radix-ui/react-icons";
6
6
  /**
7
7
  * The options passed to the constructor of SelectField.
8
8
  */
@@ -2,7 +2,7 @@ import { ISerializedField, SerializedStringField, StringInputType } from "@overm
2
2
  import { StringOrTextField, StringOrTextFieldOptions } from "../StringOrTextField";
3
3
  import { GetInputProps } from "../../typings";
4
4
  import React from "react";
5
- import { InputIcon } from "@overmap-ai/blocks";
5
+ import { InputIcon } from "@radix-ui/react-icons";
6
6
  interface StringFieldOptions extends Omit<StringOrTextFieldOptions, "type"> {
7
7
  inputType?: StringInputType;
8
8
  }
@@ -2,7 +2,7 @@ import { ISerializedField, SerializedTextField } from "@overmap-ai/core";
2
2
  import { StringOrTextField, StringOrTextFieldOptions } from "../StringOrTextField";
3
3
  import { GetInputProps } from "../../typings";
4
4
  import React from "react";
5
- import { RowsIcon } from "@overmap-ai/blocks";
5
+ import { RowsIcon } from "@radix-ui/react-icons";
6
6
  export interface TextFieldOptions extends Omit<StringOrTextFieldOptions, "type"> {
7
7
  }
8
8
  export declare class TextField extends StringOrTextField<"text"> {
@@ -2,7 +2,7 @@ import { ISerializedField, SerializedUploadField } from "@overmap-ai/core";
2
2
  import { BaseField, ChildFieldOptions } from "../BaseField";
3
3
  import { GetInputProps, InputFieldLevelValidator } from "../typings";
4
4
  import { ChangeEvent, ReactNode } from "react";
5
- import { UploadIcon } from "@overmap-ai/blocks";
5
+ import { UploadIcon } from "@radix-ui/react-icons";
6
6
  import { NumberField } from "../NumberField";
7
7
  import { MultiSelectField } from "../SelectField";
8
8
  export interface UploadFieldOptions extends ChildFieldOptions<File[]> {
package/dist/forms.js CHANGED
@@ -5,15 +5,16 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
8
- import { Flex, Text, useSeverityColor, Checkbox, CheckCircledIcon, TextField as TextField$1, FontFamilyIcon, CalendarIcon, InputIcon, TextArea, RowsIcon, Select, Box, IconButton, PlusIcon, Badge, Cross1Icon, ListBulletIcon, DropdownMenuIcon, MultiSelect, CheckboxIcon, Card, Heading, Button, UploadIcon, ButtonList, divButtonProps, StarFilledIcon, StarIcon, QuestionMarkCircledIcon, PersonIcon, Tooltip, Avatar, Separator, useDiscardAlertDialog, Dialog, Pencil1Icon, TrashIcon, CopyIcon, DropdownItemMenu, DotsVerticalIcon, useAlertDialog, Em, Strong, useToast, Tabs } from "@overmap-ai/blocks";
8
+ import { Flex, Text, useSeverityColor, Checkbox, TextArea, Select, IconButton, Badge, MultiSelect, Button, ButtonList, divButtonProps, Tooltip, Separator, useDiscardAlertDialog, Dialog, DropdownItemMenu, useAlertDialog, useToast } from "@overmap-ai/blocks";
9
9
  import { useField, useFormikContext, useFormik, FormikProvider } from "formik";
10
10
  import React, { useMemo, memo, useCallback, useState, useEffect, useRef, forwardRef, useReducer } from "react";
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
+ import { TextField as TextField$1, Box, Card, Heading, Avatar, Em, Strong, Tabs } from "@radix-ui/themes";
11
13
  import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
12
14
  import { slugify, useAppSelector, selectFormRevision, useSDK, selectSubmissionAttachments, selectFilteredUserForms, selectUserFormMapping, selectOrganization, selectUser, selectNumberOfUserForms, selectCurrentUser, classNames, isToday, getLocalDateString, selectLatestFormRevision, useFileSrc, selectSubmissionsForForm } from "@overmap-ai/core";
13
15
  import get from "lodash.get";
14
16
  import set from "lodash.set";
15
17
  import cloneDeep from "lodash.clonedeep";
16
- import Xarrow, { useXarrow, Xwrapper } from "react-xarrows";
17
18
  class BaseFormElement {
18
19
  constructor(options) {
19
20
  __publicField(this, "type");
@@ -104,11 +105,9 @@ class BaseField extends BaseFormElement {
104
105
  }
105
106
  __publicField(BaseField, "fieldTypeName");
106
107
  __publicField(BaseField, "fieldTypeDescription");
107
- const description$1 = "_description_1se5r_1";
108
- const sectionContainer = "_sectionContainer_1se5r_5";
108
+ const description$1 = "_description_17zed_1";
109
109
  const styles$3 = {
110
- description: description$1,
111
- sectionContainer
110
+ description: description$1
112
111
  };
113
112
  const InputWithLabel = (props) => {
114
113
  const { label, children, severity, inputId, labelId, flexProps } = props;
@@ -2070,8 +2069,12 @@ const FieldBuilder = memo(function FieldBuilder2(props) {
2070
2069
  return /* @__PURE__ */ jsx(Dialog, { onCloseInterrupt: handleCloseInterrupt, title: title2, description: description2, content: dialogContent, children });
2071
2070
  });
2072
2071
  const DefaultWrapper = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
2072
+ const forMobile = (mobile, display) => ({
2073
+ initial: mobile ? display : "none",
2074
+ sm: mobile ? "none" : display
2075
+ });
2073
2076
  const FieldActions = memo(function FieldActions2(props) {
2074
- const { remove: remove2, editProps, insertAfterProps, duplicateProps, type } = props;
2077
+ const { remove: remove2, dragHandleProps, editProps, insertAfterProps, duplicateProps } = props;
2075
2078
  const actions = useMemo(
2076
2079
  () => [
2077
2080
  {
@@ -2097,39 +2100,53 @@ const FieldActions = memo(function FieldActions2(props) {
2097
2100
  Wrapper: FieldBuilder,
2098
2101
  wrapperProps: insertAfterProps,
2099
2102
  Icon: PlusIcon,
2100
- text: `Add ${type === "section" ? "section" : "field"}`
2103
+ text: "Add after"
2104
+ },
2105
+ {
2106
+ // Wrapping icon in a div so that the asChild turns the button into a div
2107
+ // so that the drag handle props are not applied to the icon
2108
+ // Note: b/c the <button> does not handle the space-press event correctly
2109
+ Icon: (props2) => /* @__PURE__ */ jsx("div", { ...props2, children: /* @__PURE__ */ jsx(DragHandleDots2Icon, {}) }),
2110
+ text: "Reorder",
2111
+ disableOnMobile: true,
2112
+ buttonProps: { ...dragHandleProps, asChild: true }
2101
2113
  }
2102
2114
  ],
2103
- [duplicateProps, editProps, insertAfterProps, remove2, type]
2115
+ [dragHandleProps, duplicateProps, editProps, insertAfterProps, remove2]
2104
2116
  );
2105
- const actionDropdownMenuItems = useMemo(() => {
2106
- return actions.map((Action) => {
2107
- var _a;
2117
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
2118
+ /* @__PURE__ */ jsx(Flex, { gap: "4", display: forMobile(false, "flex"), children: actions.map((Action) => {
2108
2119
  const Wrapper = Action.Wrapper ?? DefaultWrapper;
2109
- return {
2110
- ...Action.buttonProps,
2111
- onSelect: (_a = Action.buttonProps) == null ? void 0 : _a.onClick,
2112
- content: /* @__PURE__ */ jsx(Wrapper, { ...Action.wrapperProps, children: /* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", role: "button", children: [
2113
- /* @__PURE__ */ jsx(Action.Icon, {}),
2114
- Action.text
2115
- ] }) })
2116
- };
2117
- });
2118
- }, [actions]);
2119
- return /* @__PURE__ */ jsx(Box, { display: "block", children: /* @__PURE__ */ jsx(
2120
- DropdownItemMenu,
2121
- {
2122
- trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(DotsVerticalIcon, {}) }),
2123
- items: actionDropdownMenuItems
2124
- }
2125
- ) });
2120
+ return /* @__PURE__ */ jsx(Wrapper, { ...Action.wrapperProps, children: /* @__PURE__ */ jsx(IconButton, { type: "button", variant: "ghost", "aria-label": Action.text, ...Action.buttonProps, children: /* @__PURE__ */ jsx(Action.Icon, {}) }) }, Action.text);
2121
+ }) }),
2122
+ /* @__PURE__ */ jsx(Box, { display: forMobile(true, "block"), children: /* @__PURE__ */ jsx(
2123
+ DropdownItemMenu,
2124
+ {
2125
+ trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(DotsVerticalIcon, {}) }),
2126
+ closeOnSelect: false,
2127
+ items: actions.map((Action) => {
2128
+ var _a;
2129
+ if (Action.disableOnMobile)
2130
+ return null;
2131
+ const Wrapper = Action.Wrapper ?? DefaultWrapper;
2132
+ return {
2133
+ ...Action.buttonProps,
2134
+ onSelect: (_a = Action.buttonProps) == null ? void 0 : _a.onClick,
2135
+ content: /* @__PURE__ */ jsx(Wrapper, { ...Action.wrapperProps, children: /* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", children: [
2136
+ /* @__PURE__ */ jsx(Action.Icon, {}),
2137
+ Action.text
2138
+ ] }) })
2139
+ };
2140
+ }).filter((x) => x !== null)
2141
+ }
2142
+ ) })
2143
+ ] });
2126
2144
  });
2127
2145
  const formId = "form-builder";
2128
2146
  const FieldWithActions = memo(function FieldWithActions2(props) {
2129
2147
  const { field, index, sectionIndex, takenLabels, remove: remove2 } = props;
2130
2148
  const deserializedField = useMemo(() => deserialize(field), [field]);
2131
2149
  const input = useFieldInput(deserializedField, { formId, disabled: true });
2132
- const updateXarrow = useXarrow();
2133
2150
  const duplicateField = useCallback(
2134
2151
  (field2) => {
2135
2152
  if (field2.label === null) {
@@ -2170,8 +2187,6 @@ const FieldWithActions = memo(function FieldWithActions2(props) {
2170
2187
  ref: draggableProvided.innerRef,
2171
2188
  ...draggableProvided.draggableProps,
2172
2189
  ...draggableProvided.dragHandleProps,
2173
- onDragStart: updateXarrow,
2174
- id: `${field.identifier}-card`,
2175
2190
  mb: "4",
2176
2191
  children: /* @__PURE__ */ jsxs(Flex, { gap: "4", justify: "between", align: "center", children: [
2177
2192
  input,
@@ -2181,91 +2196,20 @@ const FieldWithActions = memo(function FieldWithActions2(props) {
2181
2196
  remove: remove2,
2182
2197
  editProps: editFieldProps,
2183
2198
  duplicateProps: duplicateFieldProps,
2184
- insertAfterProps
2199
+ insertAfterProps,
2200
+ dragHandleProps: draggableProvided.dragHandleProps
2185
2201
  }
2186
2202
  )
2187
2203
  ] })
2188
2204
  }
2189
2205
  ) });
2190
2206
  });
2191
- const ArrowSpacingDiv = memo(function ArrowSpacingDiv2(props) {
2192
- const { identifier, index, conditionalFieldCounts } = props;
2193
- const HORIZONTAL_SPACE = 3;
2194
- const totalConditionals = conditionalFieldCounts.filter((count) => count !== null).length;
2195
- const conditionalNum = conditionalFieldCounts[index] ?? 0;
2196
- const marginLeft = HORIZONTAL_SPACE / totalConditionals * conditionalNum;
2197
- return /* @__PURE__ */ jsx(
2198
- "div",
2199
- {
2200
- id: `${identifier}-floating-point`,
2201
- style: {
2202
- width: `${HORIZONTAL_SPACE - marginLeft}%`,
2203
- marginLeft: `${marginLeft}%`
2204
- }
2205
- }
2206
- );
2207
- });
2208
- const ConditionalArrow = (props) => {
2209
- const { identifier, condition } = props;
2210
- const primaryColor = "var(--gray-a4)";
2211
- const hoverColor = "var(--primary-color)";
2212
- const [color, setColor] = useState(primaryColor);
2213
- const [zIndex, setZIndex] = useState(0);
2214
- const handleMouseEnter = useCallback(() => {
2215
- setColor(hoverColor);
2216
- setZIndex(1);
2217
- }, [hoverColor]);
2218
- const handleMouseLeave = useCallback(() => {
2219
- setColor(primaryColor);
2220
- setZIndex(0);
2221
- }, [primaryColor]);
2222
- const settings = useMemo(() => {
2223
- return {
2224
- strokeWidth: 1,
2225
- showHead: false,
2226
- color,
2227
- zIndex,
2228
- arrowBodyProps: {
2229
- onMouseEnter: handleMouseEnter,
2230
- onMouseLeave: handleMouseLeave
2231
- }
2232
- };
2233
- }, [color, handleMouseEnter, handleMouseLeave, zIndex]);
2234
- if (!condition)
2235
- return null;
2236
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2237
- /* @__PURE__ */ jsx(
2238
- Xarrow,
2239
- {
2240
- start: `${identifier}-card`,
2241
- end: `${identifier}-floating-point`,
2242
- startAnchor: "right",
2243
- endAnchor: "left",
2244
- path: "straight",
2245
- ...settings
2246
- }
2247
- ),
2248
- /* @__PURE__ */ jsx(
2249
- Xarrow,
2250
- {
2251
- start: `${identifier}-floating-point`,
2252
- end: `${condition.identifier}-card`,
2253
- startAnchor: "left",
2254
- endAnchor: "right",
2255
- path: "grid",
2256
- gridBreak: "0",
2257
- ...settings
2258
- }
2259
- )
2260
- ] });
2261
- };
2262
2207
  const FieldSectionWithActions = memo(function FieldSectionWithActions2(props) {
2263
2208
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2264
- const { field, index: sectionIndex, dropState, conditionalFieldCounts } = props;
2209
+ const { field, index: sectionIndex, dropState } = props;
2265
2210
  const isDropDisabled = (_a = dropState[field.identifier]) == null ? void 0 : _a.disabled;
2266
2211
  const { setFieldValue, values } = useFormikContext();
2267
2212
  const alertDialog = useAlertDialog();
2268
- const updateXarrow = useXarrow();
2269
2213
  const takenFieldLabels = getTakenFieldLabels(values.fields);
2270
2214
  const removeSectionConditions = useCallback(
2271
2215
  (sectionsToUpdate, allSections) => {
@@ -2416,95 +2360,64 @@ const FieldSectionWithActions = memo(function FieldSectionWithActions2(props) {
2416
2360
  throw new Error("File values are not supported for conditions.");
2417
2361
  const conditionValue = Array.isArray((_e = field.condition) == null ? void 0 : _e.value) ? (_g = (_f = field.condition) == null ? void 0 : _f.value) == null ? void 0 : _g.map((v) => typeof v === "string" ? v : v.label).join(", ") : (_i = (_h = field.condition) == null ? void 0 : _h.value) == null ? void 0 : _i.toString();
2418
2362
  return /* @__PURE__ */ jsx(Draggable, { draggableId: field.identifier, index: sectionIndex, children: (draggableProvided) => /* @__PURE__ */ jsx(
2419
- Flex,
2363
+ Card,
2420
2364
  {
2421
- className: styles$3.sectionContainer,
2422
2365
  ref: draggableProvided.innerRef,
2423
2366
  ...draggableProvided.draggableProps,
2424
- direction: "row",
2425
- justify: "center",
2426
- align: "center",
2367
+ ...draggableProvided.dragHandleProps,
2427
2368
  mb: "4",
2428
- children: /* @__PURE__ */ jsxs(Xwrapper, { children: [
2429
- /* @__PURE__ */ jsx(
2430
- Card,
2431
- {
2432
- ...draggableProvided.dragHandleProps,
2433
- onDragStart: updateXarrow,
2434
- id: `${field.identifier}-card`,
2435
- style: { flexGrow: "1" },
2436
- children: /* @__PURE__ */ jsxs(Flex, { gap: "3", justify: "between", align: "center", children: [
2437
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", grow: "1", children: [
2438
- /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
2439
- /* @__PURE__ */ jsx(Heading, { as: "h3", size: "3", children: field.label }),
2440
- /* @__PURE__ */ jsx(Text, { className: styles$3.description, children: field.description })
2441
- ] }),
2442
- field.condition && /* @__PURE__ */ jsx(Text, { size: "1", children: /* @__PURE__ */ jsxs(Em, { children: [
2443
- "Display only if ",
2444
- /* @__PURE__ */ jsx(Strong, { children: conditionLabel }),
2445
- " ",
2446
- conditionComparison,
2447
- " ",
2448
- /* @__PURE__ */ jsx(Strong, { children: conditionValue })
2449
- ] }) }),
2450
- /* @__PURE__ */ jsx(
2451
- Droppable,
2369
+ children: /* @__PURE__ */ jsxs(Flex, { gap: "3", justify: "between", align: "center", children: [
2370
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", grow: "1", children: [
2371
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", children: [
2372
+ /* @__PURE__ */ jsx(Heading, { as: "h3", size: "3", children: field.label }),
2373
+ /* @__PURE__ */ jsx(Text, { className: styles$3.description, children: field.description })
2374
+ ] }),
2375
+ field.condition && /* @__PURE__ */ jsx(Text, { size: "1", children: /* @__PURE__ */ jsxs(Em, { children: [
2376
+ "Display only if ",
2377
+ /* @__PURE__ */ jsx(Strong, { children: conditionLabel }),
2378
+ " ",
2379
+ conditionComparison,
2380
+ " ",
2381
+ /* @__PURE__ */ jsx(Strong, { children: conditionValue })
2382
+ ] }) }),
2383
+ /* @__PURE__ */ jsx(Droppable, { droppableId: field.identifier, type: "SECTION", isDropDisabled, children: (droppableProvided) => /* @__PURE__ */ jsxs(
2384
+ Flex,
2385
+ {
2386
+ ref: droppableProvided.innerRef,
2387
+ ...droppableProvided.droppableProps,
2388
+ direction: "column",
2389
+ gap: "0",
2390
+ children: [
2391
+ field.fields.map((child, i) => /* @__PURE__ */ jsx(
2392
+ FieldWithActions,
2452
2393
  {
2453
- droppableId: field.identifier,
2454
- type: "SECTION",
2455
- isDropDisabled,
2456
- children: (droppableProvided) => /* @__PURE__ */ jsxs(
2457
- Flex,
2458
- {
2459
- ref: droppableProvided.innerRef,
2460
- ...droppableProvided.droppableProps,
2461
- direction: "column",
2462
- gap: "0",
2463
- children: [
2464
- field.fields.map((child, i) => /* @__PURE__ */ jsx(
2465
- FieldWithActions,
2466
- {
2467
- field: child,
2468
- index: i,
2469
- sectionIndex,
2470
- remove: () => removeField(i),
2471
- takenLabels: takenFieldLabels
2472
- },
2473
- child.identifier
2474
- )),
2475
- droppableProvided.placeholder,
2476
- /* @__PURE__ */ jsx(FieldBuilder, { ...insertFieldAtEndOfSection, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", children: [
2477
- /* @__PURE__ */ jsx(PlusIcon, {}),
2478
- " Add a field"
2479
- ] }) })
2480
- ]
2481
- }
2482
- )
2483
- }
2484
- )
2485
- ] }),
2486
- /* @__PURE__ */ jsx(
2487
- FieldActions,
2488
- {
2489
- remove: removeSection,
2490
- insertAfterProps: insertSectionProps,
2491
- editProps: editSectionProps,
2492
- duplicateProps: duplicateSectionProps,
2493
- type: "section"
2494
- }
2495
- )
2496
- ] })
2497
- }
2498
- ),
2499
- conditionalFieldCounts.some((count) => count !== null) && /* @__PURE__ */ jsx(
2500
- ArrowSpacingDiv,
2394
+ field: child,
2395
+ index: i,
2396
+ sectionIndex,
2397
+ remove: () => removeField(i),
2398
+ takenLabels: takenFieldLabels
2399
+ },
2400
+ child.identifier
2401
+ )),
2402
+ droppableProvided.placeholder,
2403
+ /* @__PURE__ */ jsx(FieldBuilder, { ...insertFieldAtEndOfSection, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", children: [
2404
+ /* @__PURE__ */ jsx(PlusIcon, {}),
2405
+ " Add a field"
2406
+ ] }) })
2407
+ ]
2408
+ }
2409
+ ) })
2410
+ ] }),
2411
+ /* @__PURE__ */ jsx(
2412
+ FieldActions,
2501
2413
  {
2502
- identifier: field.identifier,
2503
- index: sectionIndex,
2504
- conditionalFieldCounts
2414
+ remove: removeSection,
2415
+ insertAfterProps: insertSectionProps,
2416
+ dragHandleProps: draggableProvided.dragHandleProps,
2417
+ editProps: editSectionProps,
2418
+ duplicateProps: duplicateSectionProps
2505
2419
  }
2506
- ),
2507
- field.condition && /* @__PURE__ */ jsx(ConditionalArrow, { identifier: field.identifier, condition: field.condition })
2420
+ )
2508
2421
  ] })
2509
2422
  }
2510
2423
  ) });
@@ -2642,12 +2555,6 @@ const FieldsEditor = memo(function FieldsEditor2() {
2642
2555
  }),
2643
2556
  [values.fields]
2644
2557
  );
2645
- const conditionalFieldCounts = () => {
2646
- let conditionalCount = 1;
2647
- return values.fields.map((field) => {
2648
- return field.conditional ? conditionalCount++ : null;
2649
- });
2650
- };
2651
2558
  return /* @__PURE__ */ jsx(DragDropContext, { onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsx(Droppable, { droppableId: "droppable", type: "ROOT", children: (droppableProvided) => /* @__PURE__ */ jsxs(
2652
2559
  Flex,
2653
2560
  {
@@ -2661,8 +2568,7 @@ const FieldsEditor = memo(function FieldsEditor2() {
2661
2568
  {
2662
2569
  field,
2663
2570
  index,
2664
- dropState,
2665
- conditionalFieldCounts: conditionalFieldCounts()
2571
+ dropState
2666
2572
  },
2667
2573
  field.label
2668
2574
  )),