@overmap-ai/core 1.0.38-component-fields.8 → 1.0.38-component-fields.9

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.
@@ -5,6 +5,7 @@ interface FieldSectionWithActionsProps {
5
5
  field: SerializedFieldSection;
6
6
  index: number;
7
7
  dropState: DropState;
8
+ fieldsOnly: boolean;
8
9
  }
9
10
  export declare const FieldSectionWithActions: import("react").MemoExoticComponent<(props: FieldSectionWithActionsProps) => import("react/jsx-runtime").JSX.Element>;
10
11
  export {};
@@ -1,2 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare const FieldsEditor: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ interface FieldsEditorProps {
3
+ fieldsOnly: boolean;
4
+ }
5
+ export declare const FieldsEditor: import("react").MemoExoticComponent<(props: FieldsEditorProps) => import("react/jsx-runtime").JSX.Element>;
6
+ export {};
@@ -9,8 +9,16 @@ interface FormBuilderProps {
9
9
  initialTitle?: string;
10
10
  /** @default true */
11
11
  showExplainerText?: boolean;
12
- /** @default false */
13
- showSectionsOnly?: boolean;
12
+ /** @default true */
13
+ showFormTitle?: boolean;
14
+ /** Show and edit non-section fields only. Functionally, these fields will be in a single section with no label
15
+ * @default false
16
+ */
17
+ fieldsOnly?: boolean;
18
+ /** Show the Edit and Preview tabs at the top of the component. If false, the preview is entirely inaccessible.
19
+ * @default true
20
+ */
21
+ showTabs?: boolean;
14
22
  }
15
23
  export declare const FormBuilder: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<FormBuilderProps & import("react").RefAttributes<HTMLDivElement>>>;
16
24
  export {};
@@ -11237,7 +11237,7 @@ const FieldWithActions = memo((props) => {
11237
11237
  FieldWithActions.displayName = "FieldWithActions";
11238
11238
  const FieldSectionWithActions = memo((props) => {
11239
11239
  var _a2;
11240
- const { field, index: sectionIndex, dropState } = props;
11240
+ const { field, index: sectionIndex, dropState, fieldsOnly } = props;
11241
11241
  const isDropDisabled = (_a2 = dropState[field.identifier]) == null ? void 0 : _a2.disabled;
11242
11242
  const { setFieldValue, values } = useFormikContext();
11243
11243
  const alertDialog = useAlertDialog();
@@ -11377,7 +11377,7 @@ const FieldSectionWithActions = memo((props) => {
11377
11377
  mb: "4",
11378
11378
  children: /* @__PURE__ */ jsxs(Flex, { gap: "3", justify: "between", align: "center", children: [
11379
11379
  /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", grow: "1", children: [
11380
- /* @__PURE__ */ jsx(FieldBuilder, { ...editSectionProps }),
11380
+ !fieldsOnly && /* @__PURE__ */ jsx(FieldBuilder, { ...editSectionProps }),
11381
11381
  /* @__PURE__ */ jsx(
11382
11382
  Droppable,
11383
11383
  {
@@ -11421,7 +11421,7 @@ const FieldSectionWithActions = memo((props) => {
11421
11421
  }
11422
11422
  )
11423
11423
  ] }),
11424
- /* @__PURE__ */ jsx(
11424
+ !fieldsOnly && /* @__PURE__ */ jsx(
11425
11425
  FieldActions,
11426
11426
  {
11427
11427
  index: sectionIndex,
@@ -11498,7 +11498,8 @@ const findSection = (fields, sectionId) => {
11498
11498
  return [section, i];
11499
11499
  }
11500
11500
  };
11501
- const FieldsEditor = memo(() => {
11501
+ const FieldsEditor = memo((props) => {
11502
+ const { fieldsOnly } = props;
11502
11503
  const { values, setFieldValue } = useFormikContext();
11503
11504
  const [dropState, dispatch] = useReducer(reducer, values.fields, initializer);
11504
11505
  const { reorderSection, reorderField } = useFieldReordering();
@@ -11551,8 +11552,16 @@ const FieldsEditor = memo(() => {
11551
11552
  gap: "0",
11552
11553
  children: [
11553
11554
  values.fields.map((field, index2) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
11554
- /* @__PURE__ */ jsx(FieldSectionWithActions, { field, index: index2, dropState }),
11555
- /* @__PURE__ */ jsxs(
11555
+ /* @__PURE__ */ jsx(
11556
+ FieldSectionWithActions,
11557
+ {
11558
+ field,
11559
+ index: index2,
11560
+ dropState,
11561
+ fieldsOnly
11562
+ }
11563
+ ),
11564
+ !fieldsOnly && /* @__PURE__ */ jsxs(
11556
11565
  Button,
11557
11566
  {
11558
11567
  className: styles$1.addSectionButton,
@@ -11580,7 +11589,16 @@ const previewSubmit = () => {
11580
11589
  };
11581
11590
  const FormBuilder = memo(
11582
11591
  forwardRef((props, ref) => {
11583
- const { onCancel, onSave, revision, initialTitle, showExplainerText = true, showSectionsOnly = false } = props;
11592
+ const {
11593
+ onCancel,
11594
+ onSave,
11595
+ revision,
11596
+ initialTitle,
11597
+ showExplainerText = true,
11598
+ showFormTitle = true,
11599
+ fieldsOnly = false,
11600
+ showTabs = true
11601
+ } = props;
11584
11602
  const { showError } = useToast();
11585
11603
  const validate = useCallback(
11586
11604
  (form) => {
@@ -11643,7 +11661,7 @@ const FormBuilder = memo(
11643
11661
  });
11644
11662
  const previewSchema = useMemo(() => formRevisionToSchema(formik.values), [formik.values]);
11645
11663
  return /* @__PURE__ */ jsx(Tabs.Root, { ref, defaultValue: "edit", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "2", children: [
11646
- /* @__PURE__ */ jsxs(Tabs.List, { className: styles$7.tabsList, children: [
11664
+ showTabs && /* @__PURE__ */ jsxs(Tabs.List, { className: styles$7.tabsList, children: [
11647
11665
  /* @__PURE__ */ jsx(Tabs.Trigger, { className: styles$7.tabTrigger, value: "edit", children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "2", children: [
11648
11666
  /* @__PURE__ */ jsx(Pencil1Icon, {}),
11649
11667
  "Edit"
@@ -11664,7 +11682,7 @@ const FormBuilder = memo(
11664
11682
  ] }),
11665
11683
  /* @__PURE__ */ jsx(Flex, { asChild: true, direction: "column", gap: "2", mt: "3", children: /* @__PURE__ */ jsxs("form", { id: formId, onSubmit: formik.handleSubmit, children: [
11666
11684
  /* @__PURE__ */ jsxs(FormikProvider, { value: formik, children: [
11667
- !showSectionsOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
11685
+ showFormTitle && /* @__PURE__ */ jsxs(Fragment, { children: [
11668
11686
  /* @__PURE__ */ jsx(
11669
11687
  PatchField,
11670
11688
  {
@@ -11710,7 +11728,7 @@ const FormBuilder = memo(
11710
11728
  }
11711
11729
  )
11712
11730
  ] }),
11713
- /* @__PURE__ */ jsx(FieldsEditor, {}),
11731
+ /* @__PURE__ */ jsx(FieldsEditor, { fieldsOnly }),
11714
11732
  /* @__PURE__ */ jsx(Text, { severity: "danger", size: "1", children: typeof formik.errors.fields === "string" && formik.errors.fields })
11715
11733
  ] }),
11716
11734
  /* @__PURE__ */ jsxs(Flex, { className: styles$7.floatingButtonContainer, align: "center", justify: "end", gap: "2", children: [
@@ -11719,7 +11737,7 @@ const FormBuilder = memo(
11719
11737
  ] })
11720
11738
  ] }) })
11721
11739
  ] }),
11722
- /* @__PURE__ */ jsx(Tabs.Content, { value: "preview", children: /* @__PURE__ */ jsx(FormRenderer, { schema: previewSchema, onSubmit: previewSubmit, hideTitle: showSectionsOnly }) })
11740
+ /* @__PURE__ */ jsx(Tabs.Content, { value: "preview", children: /* @__PURE__ */ jsx(FormRenderer, { schema: previewSchema, onSubmit: previewSubmit, hideTitle: !showFormTitle }) })
11723
11741
  ] }) });
11724
11742
  })
11725
11743
  );