@contentful/experiences-visual-editor-react 1.1.0 → 1.2.0-beta.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
@@ -911,7 +911,7 @@ const optionalBuiltInStyles = {
911
911
  },
912
912
  };
913
913
 
914
- const designTokensRegistry = {};
914
+ let designTokensRegistry = {};
915
915
  /**
916
916
  * Register design tokens styling
917
917
  * @param designTokenDefinition - {[key:string]: Record<string, string>}
@@ -2441,11 +2441,16 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
2441
2441
  const dataSource = useEditorStore((state) => state.dataSource);
2442
2442
  const entityStore = useEntityStore((state) => state.entityStore);
2443
2443
  const props = useMemo(() => {
2444
+ const propsBase = node.data.props?.cfSsrClassName
2445
+ ? {
2446
+ cfSsrClassName: resolveDesignValue(node.data.props.cfSsrClassName.valuesByBreakpoint, 'cfSsrClassName'),
2447
+ }
2448
+ : {};
2444
2449
  // Don't enrich the assembly wrapper node with props
2445
2450
  if (!definition || node.type === ASSEMBLY_NODE_TYPE) {
2446
- return {};
2451
+ return propsBase;
2447
2452
  }
2448
- return Object.entries(definition.variables).reduce((acc, [variableName, variableDefinition]) => {
2453
+ const extractedProps = Object.entries(definition.variables).reduce((acc, [variableName, variableDefinition]) => {
2449
2454
  const variableMapping = node.data.props[variableName];
2450
2455
  if (!variableMapping) {
2451
2456
  return {
@@ -2520,6 +2525,10 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
2520
2525
  return { ...acc };
2521
2526
  }
2522
2527
  }, {});
2528
+ return {
2529
+ ...propsBase,
2530
+ ...extractedProps,
2531
+ };
2523
2532
  }, [
2524
2533
  hyperlinkPattern,
2525
2534
  node,
@@ -2581,7 +2590,7 @@ const useComponentProps = ({ node, areEntitiesFetched, resolveDesignValue, rende
2581
2590
  const stylesToKeep = ['cfImageAsset'];
2582
2591
  const stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));
2583
2592
  const componentProps = {
2584
- className: componentClass,
2593
+ className: props.cfSsrClassName ?? componentClass,
2585
2594
  editorMode: true,
2586
2595
  node,
2587
2596
  renderDropzone,