@overmap-ai/core 1.0.38-component-fields.3 → 1.0.38-component-fields.5

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.
@@ -5436,7 +5436,6 @@ var __publicField = (obj, key, value) => {
5436
5436
  const activeWorkspaceId = state.workspaceReducer.activeWorkspaceId;
5437
5437
  const offlineFormPayload = offline({});
5438
5438
  const offlineRevisionPayload = offline(initialRevision);
5439
- console.log(componentType);
5440
5439
  const retForm = {
5441
5440
  ...offlineFormPayload,
5442
5441
  index_workspace: activeWorkspaceId,
@@ -5446,7 +5445,6 @@ var __publicField = (obj, key, value) => {
5446
5445
  ...componentType && { component_type: componentType },
5447
5446
  ...ownerAttrs
5448
5447
  };
5449
- console.log(retForm);
5450
5448
  const { payloadWithoutImage, images } = await separateImageFromFields(offlineRevisionPayload);
5451
5449
  const retRevision = {
5452
5450
  ...payloadWithoutImage,
@@ -5464,7 +5462,11 @@ var __publicField = (obj, key, value) => {
5464
5462
  queryParams: activeWorkspaceId ? {
5465
5463
  workspace_id: activeWorkspaceId
5466
5464
  } : void 0,
5467
- payload: { ...offlineFormPayload, initial_revision: payloadWithoutImage },
5465
+ payload: {
5466
+ ...offlineFormPayload,
5467
+ ...componentType && { component_type: componentType },
5468
+ initial_revision: payloadWithoutImage
5469
+ },
5468
5470
  blockers: [],
5469
5471
  blocks: [offlineFormPayload.offline_id, payloadWithoutImage.offline_id]
5470
5472
  });
@@ -10839,19 +10841,24 @@ var __publicField = (obj, key, value) => {
10839
10841
  const { parentPath, index: index2, initial, conditionalSourceFields } = props;
10840
10842
  const { values, setFieldValue, errors } = formik.useFormikContext();
10841
10843
  const fieldTypeItems = useFieldTypeItems();
10844
+ const containerRef = React.useRef(null);
10842
10845
  const RADIX_SM_MIN_WIDTH = 576;
10843
- const [isLargeScreen, setIsLargeScreen] = React.useState(
10844
- window.matchMedia(`(min-width: ${RADIX_SM_MIN_WIDTH}px)`).matches
10846
+ const [isLargeContainer, setIsLargeContainer] = React.useState(
10847
+ containerRef.current && containerRef.current.getBoundingClientRect().width >= RADIX_SM_MIN_WIDTH
10845
10848
  );
10846
10849
  React.useEffect(() => {
10847
- const mediaQuery = window.matchMedia(`(min-width: ${RADIX_SM_MIN_WIDTH}px)`);
10848
- const handleMediaQueryChange = (event) => {
10849
- setIsLargeScreen(event.matches);
10850
- };
10851
- mediaQuery.addEventListener("change", handleMediaQueryChange);
10852
- return () => {
10853
- mediaQuery.removeEventListener("change", handleMediaQueryChange);
10854
- };
10850
+ const container = containerRef.current;
10851
+ if (container) {
10852
+ const observer = new ResizeObserver((entries) => {
10853
+ if (entries[0]) {
10854
+ setIsLargeContainer(entries[0].contentRect.width >= RADIX_SM_MIN_WIDTH);
10855
+ }
10856
+ });
10857
+ observer.observe(container);
10858
+ return () => {
10859
+ observer.disconnect();
10860
+ };
10861
+ }
10855
10862
  }, []);
10856
10863
  const [resolvedImage, setResolvedImage] = React.useState(void 0);
10857
10864
  const [showImagePreview, setShowImagePreview] = React.useState(false);
@@ -10928,7 +10935,7 @@ var __publicField = (obj, key, value) => {
10928
10935
  const fieldObject = fieldCls.getFieldCreationSchema(
10929
10936
  `${parentPath}.${index2}`
10930
10937
  );
10931
- if (isLargeScreen) {
10938
+ if (isLargeContainer) {
10932
10939
  directlyShownFields2 = [
10933
10940
  ...directlyShownFields2,
10934
10941
  ...fieldObject.filter((field) => field.showDirectly).map((field) => field.field)
@@ -10942,7 +10949,7 @@ var __publicField = (obj, key, value) => {
10942
10949
  }
10943
10950
  }
10944
10951
  return [directlyShownFields2, popoverFields2];
10945
- }, [fieldCls, conditionalSourceFields, parentPath, index2, isLargeScreen]);
10952
+ }, [fieldCls, conditionalSourceFields, parentPath, index2, isLargeContainer]);
10946
10953
  const directlyShownInputs = useFieldInputs(directlyShownFields, {
10947
10954
  formId,
10948
10955
  disabled: false,
@@ -10962,7 +10969,7 @@ var __publicField = (obj, key, value) => {
10962
10969
  });
10963
10970
  const deserializedField = React.useMemo(() => deserialize(initial), [initial]);
10964
10971
  const previewInput2 = useFieldInput(deserializedField, { formId, disabled: true, showInputOnly: true });
10965
- return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { align: "center", grow: "1", children: [
10972
+ return /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { ref: containerRef, align: "center", grow: "1", children: [
10966
10973
  /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", width: "100%", children: [
10967
10974
  fieldCls === FieldSection && /* @__PURE__ */ jsxRuntime.jsxs(blocks.Flex, { direction: "column", gap: "1", children: [
10968
10975
  directlyShownFields.length > 0 && directlyShownInputs,