@contentful/experiences-visual-editor-react 1.40.0 → 1.40.1-dev-20250605T1324-83179af.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
@@ -1406,6 +1406,7 @@ const sanitizeNodeProps = (nodeProps) => {
1406
1406
  return omit(nodeProps, stylesToRemove, propsToRemove);
1407
1407
  };
1408
1408
 
1409
+ /** Turn the visibility value into a style object that can be used for inline styles in React */
1409
1410
  const transformVisibility = (value) => {
1410
1411
  if (value === false) {
1411
1412
  return {
@@ -1574,7 +1575,6 @@ const buildStyleTag = ({ styles, nodeId }) => {
1574
1575
  const buildCfStyles = (values) => {
1575
1576
  const cssProperties = {
1576
1577
  boxSizing: 'border-box',
1577
- ...transformVisibility(values.cfVisibility),
1578
1578
  margin: values.cfMargin,
1579
1579
  padding: values.cfPadding,
1580
1580
  backgroundColor: values.cfBackgroundColor,
@@ -4813,7 +4813,11 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
4813
4813
  entityStore,
4814
4814
  renderDropzone,
4815
4815
  ]);
4816
- const cfStyles = useMemo(() => buildCfStyles(props), [props]);
4816
+ const cfStyles = useMemo(() => ({
4817
+ ...buildCfStyles(props),
4818
+ // This is not handled by buildCfStyles as it requires separate disjunct media queries in preview mode
4819
+ ...transformVisibility(props.cfVisibility),
4820
+ }), [props]);
4817
4821
  const cfVisibility = props['cfVisibility'];
4818
4822
  const isAssemblyBlock = node.type === ASSEMBLY_BLOCK_NODE_TYPE;
4819
4823
  const isSingleColumn = node?.data.blockId === CONTENTFUL_COMPONENTS$1.columns.id;