@contentful/experiences-visual-editor-react 3.0.0-alpha-20250711T0717-d5ee667.0 → 3.0.0-alpha-20250801T0844-68b7839.0

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/index.js CHANGED
@@ -1444,6 +1444,17 @@ const propsToRemove = [
1444
1444
  const sanitizeNodeProps = (nodeProps) => {
1445
1445
  return omit(nodeProps, stylesToRemove, propsToRemove);
1446
1446
  };
1447
+
1448
+ /** Turn the visibility value into a style object that can be used for inline styles in React */
1449
+ const transformVisibility = (value) => {
1450
+ if (value === false) {
1451
+ return {
1452
+ display: 'none !important',
1453
+ };
1454
+ }
1455
+ // Don't explicitly set anything when visible to not overwrite values like `grid` or `flex`.
1456
+ return {};
1457
+ };
1447
1458
  const transformGridColumn = (span) => {
1448
1459
  if (!span) {
1449
1460
  return {};
@@ -4691,7 +4702,12 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
4691
4702
  entityStore,
4692
4703
  findNodeById,
4693
4704
  ]);
4694
- const cfStyles = useMemo(() => buildCfStyles(props), [props]);
4705
+ const cfStyles = useMemo(() => ({
4706
+ ...buildCfStyles(props),
4707
+ // The visibility needs to be transformed separately as it requires
4708
+ // a special handling for preview & SSR rendering (not here though).
4709
+ ...transformVisibility(props.cfVisibility),
4710
+ }), [props]);
4695
4711
  const shouldRenderEmptySpaceWithMinSize = useMemo(() => {
4696
4712
  if (node.children.length)
4697
4713
  return false;