@amplifyup/sdk 0.1.53 → 0.1.54

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/react.d.mts CHANGED
@@ -97,7 +97,7 @@ declare function Field(props: {
97
97
  fallback?: ReactNode;
98
98
  className?: string;
99
99
  render?: (value: any) => ReactNode;
100
- }): string | number | true | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | null;
100
+ }): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
101
101
  /**
102
102
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
103
103
  *
package/dist/react.d.ts CHANGED
@@ -97,7 +97,7 @@ declare function Field(props: {
97
97
  fallback?: ReactNode;
98
98
  className?: string;
99
99
  render?: (value: any) => ReactNode;
100
- }): string | number | true | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | null;
100
+ }): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
101
101
  /**
102
102
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
103
103
  *
package/dist/react.js CHANGED
@@ -3440,11 +3440,9 @@ function EmptySlotHint({
3440
3440
  }
3441
3441
  var ComponentContext = React.createContext(null);
3442
3442
  function useLiveComposerProps(layoutNodeId, props) {
3443
- const [live, setLive] = React.useState(props);
3444
- React.useEffect(() => {
3445
- setLive(props);
3446
- }, [props]);
3443
+ const [patch, setPatch] = React.useState(null);
3447
3444
  React.useEffect(() => {
3445
+ setPatch(null);
3448
3446
  const matchesNode = (nodeId) => {
3449
3447
  if (nodeId && layoutNodeId && String(nodeId) !== String(layoutNodeId)) {
3450
3448
  return false;
@@ -3454,15 +3452,15 @@ function useLiveComposerProps(layoutNodeId, props) {
3454
3452
  const applyField = (fieldName, value, nodeId) => {
3455
3453
  if (!fieldName || typeof fieldName !== "string") return;
3456
3454
  if (!matchesNode(nodeId)) return;
3457
- setLive((prev) => ({ ...prev, [fieldName]: value }));
3455
+ setPatch((prev) => ({ ...prev || {}, [fieldName]: value }));
3458
3456
  };
3459
3457
  const applyProps = (nextProps, nodeId) => {
3460
3458
  if (!nextProps || typeof nextProps !== "object" || Array.isArray(nextProps)) {
3461
3459
  return;
3462
3460
  }
3463
3461
  if (!matchesNode(nodeId)) return;
3464
- setLive((prev) => ({
3465
- ...prev,
3462
+ setPatch((prev) => ({
3463
+ ...prev || {},
3466
3464
  ...nextProps
3467
3465
  }));
3468
3466
  };
@@ -3491,7 +3489,7 @@ function useLiveComposerProps(layoutNodeId, props) {
3491
3489
  window.removeEventListener("message", onMessage);
3492
3490
  };
3493
3491
  }, [layoutNodeId]);
3494
- return live;
3492
+ return patch ? { ...props, ...patch } : props;
3495
3493
  }
3496
3494
  function useComponentProps() {
3497
3495
  const context = React.useContext(ComponentContext);
@@ -3790,9 +3788,10 @@ function ComposerInlineField({
3790
3788
  event.stopPropagation();
3791
3789
  },
3792
3790
  onClick: (event) => {
3791
+ if (!isComposerEditMode()) return;
3793
3792
  const link = event.target?.closest?.("a");
3794
3793
  if (link) event.preventDefault();
3795
- if (render && isComposerEditMode()) {
3794
+ if (render) {
3796
3795
  setEditing(true);
3797
3796
  }
3798
3797
  },