@overmap-ai/core 1.0.33 → 1.0.34-image-preview.1

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,12 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { FieldTypeIdentifier } from "../typings";
3
2
  interface FieldActionsProps {
4
3
  index: number;
5
4
  sectionIndex?: number;
6
- type: FieldTypeIdentifier;
7
5
  remove: () => void;
8
6
  duplicate: () => void;
9
- addAfter?: (type: FieldTypeIdentifier) => void;
10
7
  move: (direction: "up" | "down") => void;
11
8
  }
12
9
  export declare const FieldActions: import("react").MemoExoticComponent<(props: FieldActionsProps) => import("react/jsx-runtime").JSX.Element>;
@@ -8,7 +8,7 @@ var _a;
8
8
  import * as React from "react";
9
9
  import React__default, { useState, useEffect, useRef, memo, useMemo, forwardRef, createElement, useCallback, createContext, useContext, Children, isValidElement, cloneElement, Fragment, useLayoutEffect, useReducer } from "react";
10
10
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
11
- import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex, Text, useSeverityColor, Checkbox, TextArea, Select, useToast, IconButton, Badge, MultiSelect, Button, ButtonList, divButtonProps, Tooltip, DropdownItemMenu, DropdownMenu, DropdownMenuItemGroup, DropdownMenuSubMenuGroup, Popover, Input, useAlertDialog } from "@overmap-ai/blocks";
11
+ import { unsafeShowToast, AlertDialogProvider, ToastProvider, DefaultTheme, Flex, Text, useSeverityColor, Checkbox, TextArea, Select, useToast, IconButton, Badge, MultiSelect, Button, ButtonList, divButtonProps, Tooltip, DropdownItemMenu, Popover, Input, useAlertDialog } from "@overmap-ai/blocks";
12
12
  import { DepGraph } from "dependency-graph";
13
13
  import { offline as offline$1 } from "@redux-offline/redux-offline";
14
14
  import offlineConfig from "@redux-offline/redux-offline/lib/defaults";
@@ -26,6 +26,7 @@ import { useField, useFormikContext, useFormik, FormikProvider } from "formik";
26
26
  import get from "lodash.get";
27
27
  import Linkify from "linkify-react";
28
28
  import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
29
+ import { saveAs } from "file-saver";
29
30
  import set from "lodash.set";
30
31
  import cloneDeep from "lodash.clonedeep";
31
32
  import { flushSync } from "react-dom";
@@ -5887,8 +5888,8 @@ class FileService extends BaseApiService {
5887
5888
  if (!extension) {
5888
5889
  throw new Error("File has no extension");
5889
5890
  }
5890
- const fileName = downloadedName ?? actualSha1 + "." + extension;
5891
- file = getRenamedFile(file, fileName);
5891
+ const fileName2 = downloadedName ?? actualSha1 + "." + extension;
5892
+ file = getRenamedFile(file, fileName2);
5892
5893
  if (!file.name) {
5893
5894
  throw new Error("Failed to set file's name");
5894
5895
  }
@@ -6334,6 +6335,24 @@ var ArrowDownIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
6334
6335
  clipRule: "evenodd"
6335
6336
  }));
6336
6337
  });
6338
+ var _excluded$f = ["color"];
6339
+ var ArrowLeftIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
6340
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$f);
6341
+ return createElement("svg", Object.assign({
6342
+ width: "15",
6343
+ height: "15",
6344
+ viewBox: "0 0 15 15",
6345
+ fill: "none",
6346
+ xmlns: "http://www.w3.org/2000/svg"
6347
+ }, props, {
6348
+ ref: forwardedRef
6349
+ }), createElement("path", {
6350
+ d: "M6.85355 3.14645C7.04882 3.34171 7.04882 3.65829 6.85355 3.85355L3.70711 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H3.70711L6.85355 11.1464C7.04882 11.3417 7.04882 11.6583 6.85355 11.8536C6.65829 12.0488 6.34171 12.0488 6.14645 11.8536L2.14645 7.85355C1.95118 7.65829 1.95118 7.34171 2.14645 7.14645L6.14645 3.14645C6.34171 2.95118 6.65829 2.95118 6.85355 3.14645Z",
6351
+ fill: color,
6352
+ fillRule: "evenodd",
6353
+ clipRule: "evenodd"
6354
+ }));
6355
+ });
6337
6356
  var _excluded$j = ["color"];
6338
6357
  var ArrowUpIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
6339
6358
  var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$j);
@@ -6460,6 +6479,24 @@ var DotsVerticalIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
6460
6479
  clipRule: "evenodd"
6461
6480
  }));
6462
6481
  });
6482
+ var _excluded$1P = ["color"];
6483
+ var DownloadIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
6484
+ var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1P);
6485
+ return createElement("svg", Object.assign({
6486
+ width: "15",
6487
+ height: "15",
6488
+ viewBox: "0 0 15 15",
6489
+ fill: "none",
6490
+ xmlns: "http://www.w3.org/2000/svg"
6491
+ }, props, {
6492
+ ref: forwardedRef
6493
+ }), createElement("path", {
6494
+ d: "M7.50005 1.04999C7.74858 1.04999 7.95005 1.25146 7.95005 1.49999V8.41359L10.1819 6.18179C10.3576 6.00605 10.6425 6.00605 10.8182 6.18179C10.994 6.35753 10.994 6.64245 10.8182 6.81819L7.81825 9.81819C7.64251 9.99392 7.35759 9.99392 7.18185 9.81819L4.18185 6.81819C4.00611 6.64245 4.00611 6.35753 4.18185 6.18179C4.35759 6.00605 4.64251 6.00605 4.81825 6.18179L7.05005 8.41359V1.49999C7.05005 1.25146 7.25152 1.04999 7.50005 1.04999ZM2.5 10C2.77614 10 3 10.2239 3 10.5V12C3 12.5539 3.44565 13 3.99635 13H11.0012C11.5529 13 12 12.5528 12 12V10.5C12 10.2239 12.2239 10 12.5 10C12.7761 10 13 10.2239 13 10.5V12C13 13.1041 12.1062 14 11.0012 14H3.99635C2.89019 14 2 13.103 2 12V10.5C2 10.2239 2.22386 10 2.5 10Z",
6495
+ fill: color,
6496
+ fillRule: "evenodd",
6497
+ clipRule: "evenodd"
6498
+ }));
6499
+ });
6463
6500
  var _excluded$1W = ["color"];
6464
6501
  var DropdownMenuIcon = /* @__PURE__ */ forwardRef(function(_ref, forwardedRef) {
6465
6502
  var _ref$color = _ref.color, color = _ref$color === void 0 ? "currentColor" : _ref$color, props = _objectWithoutPropertiesLoose(_ref, _excluded$1W);
@@ -9150,9 +9187,23 @@ class FieldInputClonerField extends CustomField {
9150
9187
  super(options, FieldInputCloner);
9151
9188
  }
9152
9189
  }
9153
- const previewImage = "_previewImage_1ig84_1";
9190
+ const previewImage = "_previewImage_y4yd1_1";
9191
+ const nameContainer = "_nameContainer_y4yd1_9";
9192
+ const hasPreview = "_hasPreview_y4yd1_14";
9193
+ const useEllipsis = "_useEllipsis_y4yd1_19";
9194
+ const FullScreenImageContainer = "_FullScreenImageContainer_y4yd1_25";
9195
+ const fileName = "_fileName_y4yd1_35";
9196
+ const longIconButton = "_longIconButton_y4yd1_40";
9197
+ const FullScreenImage = "_FullScreenImage_y4yd1_25";
9154
9198
  const styles$4 = {
9155
- previewImage
9199
+ previewImage,
9200
+ nameContainer,
9201
+ hasPreview,
9202
+ useEllipsis,
9203
+ FullScreenImageContainer,
9204
+ fileName,
9205
+ longIconButton,
9206
+ FullScreenImage
9156
9207
  };
9157
9208
  const convertBytesToLargestUnit = (bytes) => {
9158
9209
  const units = ["byte", "kilobyte", "megabyte"];
@@ -9246,6 +9297,7 @@ NumberInput.displayName = "NumberInput";
9246
9297
  const DisplayFile = memo((props) => {
9247
9298
  const { file, field, onRemove, disabled } = props;
9248
9299
  const [resolvedFile, setResolvedFile] = useState(null);
9300
+ const [showPreview, setShowPreview] = useState(false);
9249
9301
  const error2 = useMemo(() => resolvedFile && field.getError([resolvedFile]), [field, resolvedFile]);
9250
9302
  const { url, name, size } = useMemo(() => {
9251
9303
  let url2 = null;
@@ -9270,26 +9322,116 @@ const DisplayFile = memo((props) => {
9270
9322
  setResolvedFile(file);
9271
9323
  }
9272
9324
  }, [file]);
9325
+ const handleDownload = useCallback(
9326
+ (event) => {
9327
+ event.stopPropagation();
9328
+ if (!resolvedFile) {
9329
+ throw new Error("Cannot download a file that is not resolved.");
9330
+ }
9331
+ const blob = new Blob([resolvedFile]);
9332
+ saveAs(blob, name);
9333
+ },
9334
+ [name, resolvedFile]
9335
+ );
9273
9336
  return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Flex, { direction: { initial: "column", sm: "row" }, gap: "3", justify: "between", children: [
9274
9337
  /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: "3", align: "center", grow: "1", shrink: "0", children: [
9338
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", children: [
9339
+ /* @__PURE__ */ jsx(
9340
+ IconButton,
9341
+ {
9342
+ variant: "soft",
9343
+ "aria-label": `Download ${name}`,
9344
+ onClick: handleDownload,
9345
+ disabled: !resolvedFile,
9346
+ children: /* @__PURE__ */ jsx(DownloadIcon, {})
9347
+ }
9348
+ ),
9349
+ /* @__PURE__ */ jsx(
9350
+ IconButton,
9351
+ {
9352
+ severity: "info",
9353
+ variant: "soft",
9354
+ "aria-label": `Remove ${name}`,
9355
+ disabled,
9356
+ onClick: onRemove,
9357
+ children: /* @__PURE__ */ jsx(Cross1Icon, {})
9358
+ }
9359
+ )
9360
+ ] }),
9361
+ /* @__PURE__ */ jsxs(
9362
+ Flex,
9363
+ {
9364
+ className: classNames$1(styles$4.nameContainer, { [styles$4.hasPreview]: !!url }),
9365
+ direction: "column",
9366
+ gap: "1",
9367
+ children: [
9368
+ /* @__PURE__ */ jsx(Text, { className: styles$4.useEllipsis, children: name }),
9369
+ /* @__PURE__ */ jsx(Text, { size: "1", children: size }),
9370
+ error2 && /* @__PURE__ */ jsx(Text, { size: "1", severity: "danger", children: error2 })
9371
+ ]
9372
+ }
9373
+ )
9374
+ ] }),
9375
+ url && /* @__PURE__ */ jsxs(Fragment$1, { children: [
9275
9376
  /* @__PURE__ */ jsx(
9276
- IconButton,
9377
+ "img",
9277
9378
  {
9278
- severity: "info",
9279
- variant: "outline",
9280
- "aria-label": `Remove ${name}`,
9281
- disabled,
9282
- onClick: onRemove,
9283
- children: /* @__PURE__ */ jsx(Cross1Icon, {})
9379
+ className: styles$4.previewImage,
9380
+ src: url,
9381
+ alt: name,
9382
+ onClick: () => {
9383
+ setShowPreview(true);
9384
+ }
9284
9385
  }
9285
9386
  ),
9286
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", children: [
9287
- /* @__PURE__ */ jsx(Text, { children: name }),
9288
- /* @__PURE__ */ jsx(Text, { size: "1", children: size }),
9289
- error2 && /* @__PURE__ */ jsx(Text, { size: "1", severity: "danger", children: error2 })
9290
- ] })
9291
- ] }),
9292
- url && /* @__PURE__ */ jsx("img", { className: styles$4.previewImage, src: url, alt: name })
9387
+ showPreview && /* @__PURE__ */ jsxs(
9388
+ "div",
9389
+ {
9390
+ className: styles$4.FullScreenImageContainer,
9391
+ onClick: () => {
9392
+ setShowPreview(false);
9393
+ },
9394
+ children: [
9395
+ /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
9396
+ /* @__PURE__ */ jsx(
9397
+ IconButton,
9398
+ {
9399
+ className: styles$4.longIconButton,
9400
+ variant: "soft",
9401
+ "aria-label": "Exit preview",
9402
+ onClick: () => {
9403
+ setShowPreview(false);
9404
+ },
9405
+ children: /* @__PURE__ */ jsx(ArrowLeftIcon, {})
9406
+ }
9407
+ ),
9408
+ /* @__PURE__ */ jsx(Text, { className: styles$4.fileName, children: name }),
9409
+ /* @__PURE__ */ jsx(
9410
+ IconButton,
9411
+ {
9412
+ className: styles$4.longIconButton,
9413
+ variant: "soft",
9414
+ "aria-label": `Download ${name}`,
9415
+ onClick: handleDownload,
9416
+ children: /* @__PURE__ */ jsx(DownloadIcon, {})
9417
+ }
9418
+ )
9419
+ ] }),
9420
+ /* @__PURE__ */ jsx(
9421
+ "img",
9422
+ {
9423
+ className: styles$4.FullScreenImage,
9424
+ src: url,
9425
+ alt: name,
9426
+ onClick: (e) => {
9427
+ e.stopPropagation();
9428
+ }
9429
+ }
9430
+ )
9431
+ ]
9432
+ }
9433
+ )
9434
+ ] })
9293
9435
  ] }) });
9294
9436
  });
9295
9437
  DisplayFile.displayName = "DisplayFile";
@@ -10116,6 +10258,98 @@ const styles$1 = {
10116
10258
  typeBadge: typeBadge$1,
10117
10259
  addSectionButton
10118
10260
  };
10261
+ const forMobile = (mobile, display) => ({
10262
+ initial: mobile ? display : "none",
10263
+ sm: mobile ? "none" : display
10264
+ });
10265
+ const FieldActions = memo((props) => {
10266
+ const { index: index2, sectionIndex, remove: remove2, duplicate, move } = props;
10267
+ const { values } = useFormikContext();
10268
+ const actions = useMemo(() => {
10269
+ const actions2 = [
10270
+ {
10271
+ Icon: TrashIcon,
10272
+ buttonProps: { onClick: remove2 },
10273
+ key: "delete",
10274
+ text: "Delete"
10275
+ },
10276
+ {
10277
+ Icon: CopyIcon,
10278
+ key: "duplicate",
10279
+ text: "Duplicate",
10280
+ buttonProps: { onClick: duplicate }
10281
+ }
10282
+ ];
10283
+ if (sectionIndex === void 0 && index2 !== 0 || sectionIndex !== void 0 && (sectionIndex !== 0 || index2 !== 0)) {
10284
+ actions2.push({
10285
+ Icon: ArrowUpIcon,
10286
+ key: "moveUp",
10287
+ text: "Move up",
10288
+ buttonProps: {
10289
+ onClick: () => {
10290
+ move("up");
10291
+ }
10292
+ }
10293
+ });
10294
+ }
10295
+ if (sectionIndex === void 0 && index2 !== values.fields.length - 1 || sectionIndex !== void 0 && (sectionIndex < values.fields.length - 1 || index2 !== values.fields[sectionIndex].fields.length - 1)) {
10296
+ actions2.push({
10297
+ Icon: ArrowDownIcon,
10298
+ key: "moveDown",
10299
+ text: "Move down",
10300
+ buttonProps: {
10301
+ onClick: () => {
10302
+ move("down");
10303
+ }
10304
+ }
10305
+ });
10306
+ }
10307
+ return actions2;
10308
+ }, [duplicate, index2, move, remove2, sectionIndex, values.fields]);
10309
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
10310
+ /* @__PURE__ */ jsx(Flex, { gap: "4", display: forMobile(false, "flex"), children: actions.map((Action) => /* @__PURE__ */ jsx(
10311
+ IconButton,
10312
+ {
10313
+ type: "button",
10314
+ variant: "ghost",
10315
+ severity: Action.key.startsWith("move") ? "info" : "primary",
10316
+ "aria-label": Action.text,
10317
+ ...Action.buttonProps,
10318
+ children: /* @__PURE__ */ jsx(Action.Icon, {})
10319
+ },
10320
+ Action.key
10321
+ )) }),
10322
+ /* @__PURE__ */ jsx(Box, { display: forMobile(true, "block"), children: /* @__PURE__ */ jsx(
10323
+ DropdownItemMenu,
10324
+ {
10325
+ trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(DotsVerticalIcon, {}) }),
10326
+ items: actions.map((Action) => {
10327
+ var _a2;
10328
+ return {
10329
+ content: /* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", children: [
10330
+ /* @__PURE__ */ jsx(Action.Icon, {}),
10331
+ Action.text
10332
+ ] }, Action.key),
10333
+ onSelect: (_a2 = Action.buttonProps) == null ? void 0 : _a2.onClick
10334
+ };
10335
+ })
10336
+ }
10337
+ ) })
10338
+ ] });
10339
+ });
10340
+ FieldActions.displayName = "FieldActions";
10341
+ const popoverInputsContainer = "_popoverInputsContainer_ny0l1_1";
10342
+ const typeBadge = "_typeBadge_ny0l1_5";
10343
+ const previewInput = "_previewInput_ny0l1_10";
10344
+ const directInput = "_directInput_ny0l1_14";
10345
+ const grow = "_grow_ny0l1_18";
10346
+ const styles = {
10347
+ popoverInputsContainer,
10348
+ typeBadge,
10349
+ previewInput,
10350
+ directInput,
10351
+ grow
10352
+ };
10119
10353
  const formId = "form-builder";
10120
10354
  const fieldsToChoose = [
10121
10355
  ["string", "text"],
@@ -10146,147 +10380,6 @@ const useFieldTypeItems = (onSelect = () => null) => {
10146
10380
  });
10147
10381
  }, [onSelect]);
10148
10382
  };
10149
- const FieldTypeDropdown = memo((props) => {
10150
- const { setFieldType, children } = props;
10151
- const fieldTypeItems = useFieldTypeItems(setFieldType);
10152
- return /* @__PURE__ */ jsx(DropdownItemMenu, { trigger: children, items: fieldTypeItems.flat() });
10153
- });
10154
- FieldTypeDropdown.displayName = "FieldTypeDropdown";
10155
- const forMobile = (mobile, display) => ({
10156
- initial: mobile ? display : "none",
10157
- sm: mobile ? "none" : display
10158
- });
10159
- const FieldActions = memo((props) => {
10160
- const { index: index2, sectionIndex, type, remove: remove2, duplicate, addAfter, move } = props;
10161
- if (type !== "section" && !addAfter) {
10162
- throw new Error("addAfter is required for non-section fields");
10163
- }
10164
- const { values } = useFormikContext();
10165
- const fieldTypeItems = useFieldTypeItems(addAfter);
10166
- const [actions, mobileActions] = useMemo(() => {
10167
- const getActions = (isMobile) => {
10168
- const actions2 = [
10169
- {
10170
- Icon: TrashIcon,
10171
- buttonProps: { onClick: remove2 },
10172
- key: "delete",
10173
- text: "Delete"
10174
- },
10175
- {
10176
- Icon: CopyIcon,
10177
- key: "duplicate",
10178
- text: "Duplicate",
10179
- buttonProps: { onClick: duplicate }
10180
- }
10181
- ];
10182
- if (type !== "section") {
10183
- actions2.push({
10184
- // We want to show a dropdown with field types if "Add after" is clicked
10185
- isComponent: true,
10186
- Component: isMobile ? /* @__PURE__ */ jsx(DropdownMenuItemGroup, { items: fieldTypeItems.flat() }) : /* @__PURE__ */ jsx(FieldTypeDropdown, { setFieldType: addAfter, children: /* @__PURE__ */ jsx(IconButton, { type: "button", variant: "ghost", "aria-label": "Add after", children: /* @__PURE__ */ jsx(PlusIcon, {}) }) }),
10187
- Icon: PlusIcon,
10188
- key: "add",
10189
- text: "Add after"
10190
- });
10191
- }
10192
- if (sectionIndex === void 0 && index2 !== 0 || sectionIndex !== void 0 && (sectionIndex !== 0 || index2 !== 0)) {
10193
- actions2.push({
10194
- Icon: ArrowUpIcon,
10195
- key: "moveUp",
10196
- text: "Move up",
10197
- buttonProps: {
10198
- onClick: () => {
10199
- move("up");
10200
- }
10201
- }
10202
- });
10203
- }
10204
- if (sectionIndex === void 0 && index2 !== values.fields.length - 1 || sectionIndex !== void 0 && (sectionIndex < values.fields.length - 1 || index2 !== values.fields[sectionIndex].fields.length - 1)) {
10205
- actions2.push({
10206
- Icon: ArrowDownIcon,
10207
- key: "moveDown",
10208
- text: "Move down",
10209
- buttonProps: {
10210
- onClick: () => {
10211
- move("down");
10212
- }
10213
- }
10214
- });
10215
- }
10216
- return actions2;
10217
- };
10218
- return [getActions(false), getActions(true)];
10219
- }, [addAfter, duplicate, fieldTypeItems, index2, move, remove2, sectionIndex, type, values.fields]);
10220
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [
10221
- /* @__PURE__ */ jsx(Flex, { gap: "4", display: forMobile(false, "flex"), children: actions.map((Action) => {
10222
- if (Action.isComponent) {
10223
- return Action.Component;
10224
- }
10225
- return /* @__PURE__ */ jsx(
10226
- IconButton,
10227
- {
10228
- type: "button",
10229
- variant: "ghost",
10230
- severity: Action.key.startsWith("move") ? "info" : "primary",
10231
- "aria-label": Action.text,
10232
- ...Action.buttonProps,
10233
- children: /* @__PURE__ */ jsx(Action.Icon, {})
10234
- },
10235
- Action.key
10236
- );
10237
- }) }),
10238
- /* @__PURE__ */ jsx(Box, { display: forMobile(true, "block"), children: /* @__PURE__ */ jsxs(
10239
- DropdownMenu,
10240
- {
10241
- trigger: /* @__PURE__ */ jsx(IconButton, { variant: "ghost", "aria-label": "Actions menu", children: /* @__PURE__ */ jsx(DotsVerticalIcon, {}) }),
10242
- children: [
10243
- /* @__PURE__ */ jsx(
10244
- DropdownMenuItemGroup,
10245
- {
10246
- items: mobileActions.filter((Action) => !Action.isComponent).map((Action) => {
10247
- var _a2;
10248
- return {
10249
- content: /* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", children: [
10250
- /* @__PURE__ */ jsx(Action.Icon, {}),
10251
- Action.text
10252
- ] }, Action.key),
10253
- value: Action.key,
10254
- onSelect: (_a2 = Action.buttonProps) == null ? void 0 : _a2.onClick
10255
- };
10256
- })
10257
- }
10258
- ),
10259
- /* @__PURE__ */ jsx(
10260
- DropdownMenuSubMenuGroup,
10261
- {
10262
- items: mobileActions.filter((Action) => Action.isComponent).map((Action) => ({
10263
- content: /* @__PURE__ */ jsxs(Flex, { gap: "2", align: "center", children: [
10264
- /* @__PURE__ */ jsx(Action.Icon, {}),
10265
- Action.text
10266
- ] }, Action.key),
10267
- subContent: Action.Component,
10268
- triggerIndicator: null
10269
- }))
10270
- }
10271
- )
10272
- ]
10273
- }
10274
- ) })
10275
- ] });
10276
- });
10277
- FieldActions.displayName = "FieldActions";
10278
- const popoverInputsContainer = "_popoverInputsContainer_ny0l1_1";
10279
- const typeBadge = "_typeBadge_ny0l1_5";
10280
- const previewInput = "_previewInput_ny0l1_10";
10281
- const directInput = "_directInput_ny0l1_14";
10282
- const grow = "_grow_ny0l1_18";
10283
- const styles = {
10284
- popoverInputsContainer,
10285
- typeBadge,
10286
- previewInput,
10287
- directInput,
10288
- grow
10289
- };
10290
10383
  const FieldSettingsPopover = memo((props) => {
10291
10384
  const { popoverInputs, hasError } = props;
10292
10385
  return /* @__PURE__ */ jsx(
@@ -10529,21 +10622,6 @@ const FieldWithActions = memo((props) => {
10529
10622
  };
10530
10623
  createNewField(parentPath, index2 + 1, duplicatedField, values, setFieldValue);
10531
10624
  }, [field, takenLabels, parentPath, index2, values, setFieldValue]);
10532
- const createFieldAfter = useCallback(
10533
- (type) => {
10534
- if (type === "section") {
10535
- throw new Error("Section type unexpected");
10536
- }
10537
- createNewField(
10538
- parentPath,
10539
- index2 + 1,
10540
- FieldTypeToEmptyFieldMapping[type],
10541
- values,
10542
- setFieldValue
10543
- );
10544
- },
10545
- [parentPath, index2, values, setFieldValue]
10546
- );
10547
10625
  const moveField = useCallback(
10548
10626
  (direction) => {
10549
10627
  const srcSectionIndex = sectionIndex;
@@ -10589,10 +10667,8 @@ const FieldWithActions = memo((props) => {
10589
10667
  {
10590
10668
  index: index2,
10591
10669
  sectionIndex,
10592
- type: field.type,
10593
10670
  remove: remove2,
10594
10671
  duplicate: duplicateField,
10595
- addAfter: createFieldAfter,
10596
10672
  move: moveField
10597
10673
  }
10598
10674
  )
@@ -10601,6 +10677,12 @@ const FieldWithActions = memo((props) => {
10601
10677
  ) });
10602
10678
  });
10603
10679
  FieldWithActions.displayName = "FieldWithActions";
10680
+ const FieldTypeDropdown = memo((props) => {
10681
+ const { setFieldType, children } = props;
10682
+ const fieldTypeItems = useFieldTypeItems(setFieldType);
10683
+ return /* @__PURE__ */ jsx(DropdownItemMenu, { trigger: children, items: fieldTypeItems.flat() });
10684
+ });
10685
+ FieldTypeDropdown.displayName = "FieldTypeDropdown";
10604
10686
  const FieldSectionWithActions = memo((props) => {
10605
10687
  var _a2;
10606
10688
  const { field, index: sectionIndex, dropState } = props;
@@ -10789,7 +10871,6 @@ const FieldSectionWithActions = memo((props) => {
10789
10871
  FieldActions,
10790
10872
  {
10791
10873
  index: sectionIndex,
10792
- type: field.type,
10793
10874
  remove: removeSection,
10794
10875
  duplicate: duplicateSection,
10795
10876
  move: moveSection