@delmaredigital/payload-puck 0.1.2 → 0.2.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.
@@ -573,25 +573,23 @@ function responsiveValueToCSS(value, converter, uniqueId) {
573
573
  mediaQueryCSS: ""
574
574
  };
575
575
  }
576
- const mediaQueries = [];
577
- let baseStyles = {};
576
+ const cssRules = [];
578
577
  BREAKPOINTS.forEach((bp) => {
579
578
  const bpValue = value[bp.key];
580
579
  if (bpValue === void 0) return;
581
580
  const cssProps = converter(bpValue);
582
581
  if (!cssProps) return;
582
+ const styleString = cssPropertiesToString(cssProps);
583
+ if (!styleString) return;
583
584
  if (bp.key === "xs") {
584
- baseStyles = cssProps;
585
+ cssRules.push(`.${uniqueId} { ${styleString} }`);
585
586
  } else {
586
- const styleString = cssPropertiesToString(cssProps);
587
- if (styleString) {
588
- mediaQueries.push(
589
- `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
590
- );
591
- }
587
+ cssRules.push(
588
+ `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
589
+ );
592
590
  }
593
591
  });
594
- return { baseStyles, mediaQueryCSS: mediaQueries.join("\n") };
592
+ return { baseStyles: {}, mediaQueryCSS: cssRules.join("\n") };
595
593
  }
596
594
  var DEFAULT_VISIBILITY = {
597
595
  xs: true,
@@ -3750,12 +3748,12 @@ function createBorderField(config) {
3750
3748
  };
3751
3749
  }
3752
3750
  var DEFAULT_VALUE4 = {
3753
- mode: "contained",
3751
+ mode: "full",
3754
3752
  alignment: "center",
3755
3753
  maxWidth: {
3756
- value: 1200,
3754
+ value: 0,
3757
3755
  unit: "px",
3758
- enabled: true
3756
+ enabled: false
3759
3757
  },
3760
3758
  advancedMode: false
3761
3759
  };
@@ -3982,11 +3980,13 @@ function DimensionsFieldInner({
3982
3980
  const handleAdvancedToggle = React7.useCallback(() => {
3983
3981
  const newAdvancedMode = !advancedMode;
3984
3982
  setAdvancedMode(newAdvancedMode);
3985
- onChange({
3986
- ...currentValue,
3987
- advancedMode: newAdvancedMode
3988
- });
3989
- }, [advancedMode, currentValue, onChange]);
3983
+ if (value !== null) {
3984
+ onChange({
3985
+ ...currentValue,
3986
+ advancedMode: newAdvancedMode
3987
+ });
3988
+ }
3989
+ }, [advancedMode, currentValue, onChange, value]);
3990
3990
  const modeConfig = [
3991
3991
  { mode: "full", icon: lucideReact.MoveHorizontal, label: "Full", title: "Full width (100%)" },
3992
3992
  { mode: "contained", icon: lucideReact.Square, label: "Contain", title: "Contained (centered with max-width)" },
@@ -4955,7 +4955,7 @@ function ResponsiveFieldInner({
4955
4955
  }) {
4956
4956
  const [activeBreakpoint, setActiveBreakpoint] = React7.useState("xs");
4957
4957
  const getCurrentValue = React7.useCallback(() => {
4958
- if (!value) return defaultValue ?? null;
4958
+ if (!value) return null;
4959
4959
  if (activeBreakpoint === "xs") {
4960
4960
  return value.xs ?? defaultValue ?? null;
4961
4961
  }
@@ -4977,21 +4977,35 @@ function ResponsiveFieldInner({
4977
4977
  const hasOverride = React7.useCallback(
4978
4978
  (breakpoint) => {
4979
4979
  if (!value) return false;
4980
- if (breakpoint === "xs") return value.xs !== void 0;
4980
+ if (breakpoint === "xs") return false;
4981
4981
  return value[breakpoint] !== void 0;
4982
4982
  },
4983
4983
  [value]
4984
4984
  );
4985
+ const getInheritanceSource = React7.useCallback(() => {
4986
+ if (!value || activeBreakpoint === "xs") return null;
4987
+ if (value[activeBreakpoint] !== void 0) return null;
4988
+ const breakpointOrder = ["xl", "lg", "md", "sm", "xs"];
4989
+ const activeIndex = breakpointOrder.indexOf(activeBreakpoint);
4990
+ for (let i = activeIndex + 1; i < breakpointOrder.length; i++) {
4991
+ const bp = breakpointOrder[i];
4992
+ if (value[bp] !== void 0) {
4993
+ return bp;
4994
+ }
4995
+ }
4996
+ return null;
4997
+ }, [value, activeBreakpoint]);
4985
4998
  const handleInnerChange = React7.useCallback(
4986
4999
  (newValue) => {
4987
5000
  if (activeBreakpoint === "xs") {
4988
- if (newValue === null && defaultValue !== void 0) {
4989
- onChange({ ...value, xs: defaultValue });
4990
- } else if (newValue !== null) {
5001
+ if (newValue === null) {
5002
+ onChange(null);
5003
+ } else {
4991
5004
  onChange({ ...value, xs: newValue });
4992
5005
  }
4993
5006
  } else {
4994
5007
  if (newValue === null) {
5008
+ if (!value) return;
4995
5009
  const newResponsive = { ...value };
4996
5010
  delete newResponsive[activeBreakpoint];
4997
5011
  onChange(newResponsive);
@@ -5020,6 +5034,7 @@ function ResponsiveFieldInner({
5020
5034
  const currentValue = getCurrentValue();
5021
5035
  const isOverrideBreakpoint = activeBreakpoint !== "xs";
5022
5036
  const currentHasOverride = hasOverride(activeBreakpoint);
5037
+ const inheritanceSource = getInheritanceSource();
5023
5038
  const overrideCount = value ? ["sm", "md", "lg", "xl"].filter((bp) => value[bp] !== void 0).length : 0;
5024
5039
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "puck-field space-y-3", children: [
5025
5040
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -5061,7 +5076,11 @@ function ResponsiveFieldInner({
5061
5076
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: activeBreakpoint === "xs" ? "Extra small screens (0-639px)" : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5062
5077
  BREAKPOINTS.find((bp) => bp.key === activeBreakpoint)?.minWidth,
5063
5078
  "px and up",
5064
- !currentHasOverride && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: " (inheriting from xs)" })
5079
+ !currentHasOverride && inheritanceSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground/60", children: [
5080
+ " (inheriting from ",
5081
+ inheritanceSource.toUpperCase(),
5082
+ ")"
5083
+ ] })
5065
5084
  ] }) }),
5066
5085
  isOverrideBreakpoint && currentHasOverride && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
5067
5086
  Button,
@@ -5213,11 +5232,6 @@ function createResponsiveVisibilityField(config = {}) {
5213
5232
  )
5214
5233
  };
5215
5234
  }
5216
- var DEFAULT_DIMENSIONS = {
5217
- mode: "contained",
5218
- alignment: "center",
5219
- maxWidth: { value: 1200, unit: "px", enabled: true }
5220
- };
5221
5235
  var DEFAULT_PADDING = {
5222
5236
  top: 0,
5223
5237
  right: 0,
@@ -5226,18 +5240,20 @@ var DEFAULT_PADDING = {
5226
5240
  unit: "px",
5227
5241
  linked: true
5228
5242
  };
5243
+ var DEFAULT_DIMENSIONS = {
5244
+ mode: "full",
5245
+ alignment: "center",
5246
+ maxWidth: { value: 100, unit: "%", enabled: true }
5247
+ };
5229
5248
  var defaultProps = {
5230
5249
  content: [],
5231
- background: null,
5232
- customPadding: null,
5250
+ visibility: null,
5233
5251
  dimensions: null,
5252
+ background: null,
5234
5253
  border: null,
5254
+ padding: null,
5235
5255
  margin: null,
5236
- animation: null,
5237
- innerBackground: null,
5238
- innerPadding: null,
5239
- innerBorder: null,
5240
- visibility: null
5256
+ animation: null
5241
5257
  };
5242
5258
  var ContainerConfig = {
5243
5259
  label: "Container",
@@ -5246,119 +5262,113 @@ var ContainerConfig = {
5246
5262
  content: {
5247
5263
  type: "slot"
5248
5264
  },
5249
- // Responsive visibility control
5265
+ // Visibility first
5250
5266
  visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5251
- // Outer (section-level) options
5252
- background: createBackgroundField({ label: "Outer Background" }),
5253
- border: createBorderField({ label: "Outer Border" }),
5254
- // Responsive dimensions field
5267
+ // Dimensions
5255
5268
  dimensions: createResponsiveField({
5256
- label: "Dimensions (Responsive)",
5269
+ label: "Dimensions",
5257
5270
  innerField: (config) => createDimensionsField(config),
5258
5271
  defaultValue: DEFAULT_DIMENSIONS
5259
5272
  }),
5260
- animation: createAnimationField({ label: "Animation" }),
5261
- // Inner (content container) options
5262
- innerBackground: createBackgroundField({ label: "Inner Background" }),
5263
- innerBorder: createBorderField({ label: "Inner Border" }),
5264
- // Responsive inner padding
5265
- innerPadding: createResponsiveField({
5266
- label: "Inner Padding (Responsive)",
5273
+ // Styling
5274
+ background: createBackgroundField({ label: "Background" }),
5275
+ border: createBorderField({ label: "Border" }),
5276
+ // Spacing
5277
+ padding: createResponsiveField({
5278
+ label: "Padding",
5267
5279
  innerField: (config) => createPaddingField(config),
5268
5280
  defaultValue: DEFAULT_PADDING
5269
5281
  }),
5270
- // Spacing (grouped at bottom) - Responsive
5271
5282
  margin: createResponsiveField({
5272
- label: "Margin (Responsive)",
5283
+ label: "Margin",
5273
5284
  innerField: (config) => createMarginField(config),
5274
5285
  defaultValue: DEFAULT_PADDING
5275
5286
  }),
5276
- customPadding: createResponsiveField({
5277
- label: "Outer Padding (Responsive)",
5278
- innerField: (config) => createPaddingField(config),
5279
- defaultValue: DEFAULT_PADDING
5280
- })
5287
+ // Animation
5288
+ animation: createAnimationField({ label: "Animation" })
5281
5289
  },
5282
5290
  defaultProps,
5283
5291
  render: ({
5284
5292
  content: Content3,
5285
- background,
5286
- customPadding,
5293
+ visibility,
5287
5294
  dimensions,
5295
+ background,
5288
5296
  border,
5297
+ padding,
5289
5298
  margin,
5290
- animation,
5291
- innerBackground,
5292
- innerPadding,
5293
- innerBorder,
5294
- visibility
5299
+ animation
5295
5300
  }) => {
5296
5301
  const uniqueId = React7.useId().replace(/:/g, "");
5297
- const outerClass = `puck-container-outer-${uniqueId}`;
5298
- const innerClass = `puck-container-inner-${uniqueId}`;
5302
+ const containerClass = `puck-container-${uniqueId}`;
5299
5303
  const mediaQueries = [];
5300
- const outerBackgroundStyles = backgroundValueToCSS(background);
5301
- const outerStyles = {
5302
- ...outerBackgroundStyles
5303
- };
5304
- const outerPaddingResult = responsiveValueToCSS(
5305
- customPadding,
5306
- (v) => ({ padding: paddingValueToCSS(v) }),
5307
- outerClass
5308
- );
5309
- Object.assign(outerStyles, outerPaddingResult.baseStyles);
5310
- if (outerPaddingResult.mediaQueryCSS) {
5311
- mediaQueries.push(outerPaddingResult.mediaQueryCSS);
5312
- }
5313
- const outerBorderStyles = borderValueToCSS(border);
5314
- if (outerBorderStyles) {
5315
- Object.assign(outerStyles, outerBorderStyles);
5304
+ const containerStyles = {};
5305
+ const backgroundStyles = backgroundValueToCSS(background);
5306
+ if (backgroundStyles) {
5307
+ Object.assign(containerStyles, backgroundStyles);
5316
5308
  }
5317
- const marginResult = responsiveValueToCSS(
5318
- margin,
5319
- (v) => ({ margin: marginValueToCSS(v) }),
5320
- outerClass
5321
- );
5322
- Object.assign(outerStyles, marginResult.baseStyles);
5323
- if (marginResult.mediaQueryCSS) {
5324
- mediaQueries.push(marginResult.mediaQueryCSS);
5309
+ const borderStyles = borderValueToCSS(border);
5310
+ if (borderStyles) {
5311
+ Object.assign(containerStyles, borderStyles);
5325
5312
  }
5326
- const innerBackgroundStyles = backgroundValueToCSS(innerBackground);
5327
- const innerStyles = {
5328
- ...innerBackgroundStyles
5329
- };
5330
5313
  const dimensionsResult = responsiveValueToCSS(
5331
5314
  dimensions,
5332
5315
  dimensionsValueToCSS,
5333
- innerClass
5316
+ containerClass
5334
5317
  );
5335
- Object.assign(innerStyles, dimensionsResult.baseStyles);
5318
+ Object.assign(containerStyles, dimensionsResult.baseStyles);
5336
5319
  if (dimensionsResult.mediaQueryCSS) {
5337
5320
  mediaQueries.push(dimensionsResult.mediaQueryCSS);
5338
5321
  }
5339
- const innerPaddingResult = responsiveValueToCSS(
5340
- innerPadding,
5322
+ const hasMinHeight = (() => {
5323
+ if (!dimensions) return false;
5324
+ if (typeof dimensions === "object" && "xs" in dimensions) {
5325
+ const responsiveDims = dimensions;
5326
+ return Object.values(responsiveDims).some((v) => {
5327
+ if (!v || typeof v !== "object") return false;
5328
+ const dim2 = v;
5329
+ return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
5330
+ });
5331
+ }
5332
+ const dim = dimensions;
5333
+ return dim.minHeight?.enabled && dim.minHeight?.value > 0;
5334
+ })();
5335
+ if (hasMinHeight) {
5336
+ containerStyles.display = "flex";
5337
+ containerStyles.flexDirection = "column";
5338
+ }
5339
+ const paddingResult = responsiveValueToCSS(
5340
+ padding,
5341
5341
  (v) => ({ padding: paddingValueToCSS(v) }),
5342
- innerClass
5342
+ containerClass
5343
5343
  );
5344
- Object.assign(innerStyles, innerPaddingResult.baseStyles);
5345
- if (innerPaddingResult.mediaQueryCSS) {
5346
- mediaQueries.push(innerPaddingResult.mediaQueryCSS);
5344
+ Object.assign(containerStyles, paddingResult.baseStyles);
5345
+ if (paddingResult.mediaQueryCSS) {
5346
+ mediaQueries.push(paddingResult.mediaQueryCSS);
5347
5347
  }
5348
- const innerBorderStyles = borderValueToCSS(innerBorder);
5349
- if (innerBorderStyles) {
5350
- Object.assign(innerStyles, innerBorderStyles);
5348
+ const marginResult = responsiveValueToCSS(
5349
+ margin,
5350
+ (v) => ({ margin: marginValueToCSS(v) }),
5351
+ containerClass
5352
+ );
5353
+ Object.assign(containerStyles, marginResult.baseStyles);
5354
+ if (marginResult.mediaQueryCSS) {
5355
+ mediaQueries.push(marginResult.mediaQueryCSS);
5351
5356
  }
5352
- const visibilityCSS = visibilityValueToCSS(visibility, outerClass);
5357
+ const visibilityCSS = visibilityValueToCSS(visibility, containerClass);
5353
5358
  if (visibilityCSS) {
5354
5359
  mediaQueries.push(visibilityCSS);
5355
5360
  }
5356
- const contentClasses = cn("px-4", innerClass);
5357
- const hasInnerStyles = Object.keys(innerStyles).length > 0;
5358
5361
  const allMediaQueryCSS = mediaQueries.join("\n");
5362
+ const hasStyles = Object.keys(containerStyles).length > 0;
5363
+ const renderContent = () => {
5364
+ if (hasMinHeight) {
5365
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(Content3, { style: { flex: 1 } }) });
5366
+ }
5367
+ return /* @__PURE__ */ jsxRuntime.jsx(Content3, {});
5368
+ };
5359
5369
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
5360
5370
  allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
5361
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: outerClass, style: outerStyles, children: hasInnerStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClasses, style: innerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(Content3, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(Content3, { className: contentClasses, style: innerStyles }) })
5371
+ hasStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClass, style: containerStyles, children: renderContent() }) : /* @__PURE__ */ jsxRuntime.jsx(Content3, { className: containerClass })
5362
5372
  ] });
5363
5373
  }
5364
5374
  };
@@ -5853,20 +5863,33 @@ var DEFAULT_PADDING4 = {
5853
5863
  unit: "px",
5854
5864
  linked: true
5855
5865
  };
5856
- var DEFAULT_DIMENSIONS4 = {
5857
- mode: "full",
5866
+ var DEFAULT_CONTENT_DIMENSIONS = {
5867
+ mode: "contained",
5858
5868
  alignment: "center",
5859
- maxWidth: { value: 100, unit: "%", enabled: true }
5869
+ maxWidth: { value: 1200, unit: "px", enabled: true }
5870
+ };
5871
+ var DEFAULT_CONTENT_PADDING = {
5872
+ top: 0,
5873
+ right: 16,
5874
+ bottom: 0,
5875
+ left: 16,
5876
+ unit: "px",
5877
+ linked: false
5860
5878
  };
5861
5879
  var defaultProps4 = {
5862
5880
  id: "",
5863
5881
  content: [],
5864
- background: null,
5865
- fullWidth: false,
5866
- customPadding: null,
5867
- dimensions: null,
5868
- border: null,
5869
- margin: null,
5882
+ // Section layer defaults
5883
+ sectionBackground: null,
5884
+ sectionBorder: null,
5885
+ sectionPadding: null,
5886
+ sectionMargin: null,
5887
+ // Content layer defaults - 1200px max-width so two-layer design is immediately visible
5888
+ contentDimensions: { xs: DEFAULT_CONTENT_DIMENSIONS },
5889
+ contentBackground: null,
5890
+ contentBorder: null,
5891
+ contentPadding: { xs: DEFAULT_CONTENT_PADDING },
5892
+ // Other
5870
5893
  animation: null,
5871
5894
  visibility: null
5872
5895
  };
@@ -5874,6 +5897,9 @@ var SectionConfig = {
5874
5897
  label: "Section",
5875
5898
  fields: {
5876
5899
  _reset: createResetField({ defaultProps: defaultProps4 }),
5900
+ // Visibility first
5901
+ visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5902
+ // Section ID for anchors
5877
5903
  id: {
5878
5904
  type: "text",
5879
5905
  label: "Section ID"
@@ -5881,49 +5907,47 @@ var SectionConfig = {
5881
5907
  content: {
5882
5908
  type: "slot"
5883
5909
  },
5884
- // Responsive visibility control
5885
- visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5886
- fullWidth: {
5887
- type: "radio",
5888
- label: "Full Width Content",
5889
- options: [
5890
- { label: "Yes", value: true },
5891
- { label: "No", value: false }
5892
- ]
5893
- },
5894
- // Background
5895
- background: createBackgroundField({ label: "Background" }),
5896
- // Advanced custom options
5897
- border: createBorderField({ label: "Border" }),
5898
- // Responsive dimensions
5899
- dimensions: createResponsiveField({
5900
- label: "Dimensions (Responsive)",
5901
- innerField: (config) => createDimensionsField(config),
5902
- defaultValue: DEFAULT_DIMENSIONS4
5910
+ // Section layer (outer)
5911
+ sectionBackground: createBackgroundField({ label: "Section Background" }),
5912
+ sectionBorder: createBorderField({ label: "Section Border" }),
5913
+ sectionPadding: createResponsiveField({
5914
+ label: "Section Padding",
5915
+ innerField: (config) => createPaddingField(config),
5916
+ defaultValue: DEFAULT_PADDING4
5903
5917
  }),
5904
- animation: createAnimationField({ label: "Animation" }),
5905
- // Spacing (grouped at bottom) - Responsive
5906
- margin: createResponsiveField({
5907
- label: "Margin (Responsive)",
5918
+ sectionMargin: createResponsiveField({
5919
+ label: "Section Margin",
5908
5920
  innerField: (config) => createMarginField(config),
5909
5921
  defaultValue: DEFAULT_PADDING4
5910
5922
  }),
5911
- customPadding: createResponsiveField({
5912
- label: "Padding (Responsive)",
5923
+ // Content layer (inner)
5924
+ contentDimensions: createResponsiveField({
5925
+ label: "Content Dimensions",
5926
+ innerField: (config) => createDimensionsField(config),
5927
+ defaultValue: DEFAULT_CONTENT_DIMENSIONS
5928
+ }),
5929
+ contentBackground: createBackgroundField({ label: "Content Background" }),
5930
+ contentBorder: createBorderField({ label: "Content Border" }),
5931
+ contentPadding: createResponsiveField({
5932
+ label: "Content Padding",
5913
5933
  innerField: (config) => createPaddingField(config),
5914
5934
  defaultValue: DEFAULT_PADDING4
5915
- })
5935
+ }),
5936
+ // Animation
5937
+ animation: createAnimationField({ label: "Animation" })
5916
5938
  },
5917
5939
  defaultProps: defaultProps4,
5918
5940
  render: ({
5919
5941
  id,
5920
5942
  content: Content3,
5921
- background,
5922
- fullWidth,
5923
- customPadding,
5924
- dimensions,
5925
- border,
5926
- margin,
5943
+ sectionBackground,
5944
+ sectionBorder,
5945
+ sectionPadding,
5946
+ sectionMargin,
5947
+ contentDimensions,
5948
+ contentBackground,
5949
+ contentBorder,
5950
+ contentPadding,
5927
5951
  animation,
5928
5952
  visibility
5929
5953
  }) => {
@@ -5931,52 +5955,89 @@ var SectionConfig = {
5931
5955
  const sectionClass = `puck-section-${uniqueId}`;
5932
5956
  const contentClass = `puck-section-content-${uniqueId}`;
5933
5957
  const mediaQueries = [];
5934
- const backgroundStyles = backgroundValueToCSS(background);
5958
+ const sectionBackgroundStyles = backgroundValueToCSS(sectionBackground);
5935
5959
  const sectionStyles = {
5936
- ...backgroundStyles
5960
+ ...sectionBackgroundStyles
5937
5961
  };
5938
- const paddingResult = responsiveValueToCSS(
5939
- customPadding,
5962
+ const sectionBorderStyles = borderValueToCSS(sectionBorder);
5963
+ if (sectionBorderStyles) {
5964
+ Object.assign(sectionStyles, sectionBorderStyles);
5965
+ }
5966
+ const sectionPaddingResult = responsiveValueToCSS(
5967
+ sectionPadding,
5940
5968
  (v) => ({ padding: paddingValueToCSS(v) }),
5941
5969
  sectionClass
5942
5970
  );
5943
- Object.assign(sectionStyles, paddingResult.baseStyles);
5944
- if (paddingResult.mediaQueryCSS) {
5945
- mediaQueries.push(paddingResult.mediaQueryCSS);
5971
+ Object.assign(sectionStyles, sectionPaddingResult.baseStyles);
5972
+ if (sectionPaddingResult.mediaQueryCSS) {
5973
+ mediaQueries.push(sectionPaddingResult.mediaQueryCSS);
5946
5974
  }
5947
- const borderStyles = borderValueToCSS(border);
5948
- if (borderStyles) {
5949
- Object.assign(sectionStyles, borderStyles);
5950
- }
5951
- const marginResult = responsiveValueToCSS(
5952
- margin,
5975
+ const sectionMarginResult = responsiveValueToCSS(
5976
+ sectionMargin,
5953
5977
  (v) => ({ margin: marginValueToCSS(v) }),
5954
5978
  sectionClass
5955
5979
  );
5956
- Object.assign(sectionStyles, marginResult.baseStyles);
5957
- if (marginResult.mediaQueryCSS) {
5958
- mediaQueries.push(marginResult.mediaQueryCSS);
5980
+ Object.assign(sectionStyles, sectionMarginResult.baseStyles);
5981
+ if (sectionMarginResult.mediaQueryCSS) {
5982
+ mediaQueries.push(sectionMarginResult.mediaQueryCSS);
5959
5983
  }
5960
5984
  const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
5961
5985
  if (visibilityCSS) {
5962
5986
  mediaQueries.push(visibilityCSS);
5963
5987
  }
5964
- const sectionClasses = cn("relative w-full", sectionClass);
5965
- const dimensionsResult = responsiveValueToCSS(
5966
- dimensions,
5988
+ const contentBackgroundStyles = backgroundValueToCSS(contentBackground);
5989
+ const contentStyles = {
5990
+ ...contentBackgroundStyles
5991
+ };
5992
+ const contentDimensionsResult = responsiveValueToCSS(
5993
+ contentDimensions,
5967
5994
  dimensionsValueToCSS,
5968
5995
  contentClass
5969
5996
  );
5970
- if (dimensionsResult.mediaQueryCSS) {
5971
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
5972
- }
5973
- const contentClasses = cn(
5974
- "relative z-10",
5975
- // Only apply preset content width if no dimensions set
5976
- !dimensions && !fullWidth && "max-w-[1200px] mx-auto px-4",
5997
+ Object.assign(contentStyles, contentDimensionsResult.baseStyles);
5998
+ if (contentDimensionsResult.mediaQueryCSS) {
5999
+ mediaQueries.push(contentDimensionsResult.mediaQueryCSS);
6000
+ }
6001
+ const hasMinHeight = (() => {
6002
+ if (!contentDimensions) return false;
6003
+ if (typeof contentDimensions === "object" && "xs" in contentDimensions) {
6004
+ const responsiveDims = contentDimensions;
6005
+ return Object.values(responsiveDims).some((v) => {
6006
+ if (!v || typeof v !== "object") return false;
6007
+ const dim2 = v;
6008
+ return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
6009
+ });
6010
+ }
6011
+ const dim = contentDimensions;
6012
+ return dim.minHeight?.enabled && dim.minHeight?.value > 0;
6013
+ })();
6014
+ if (hasMinHeight) {
6015
+ contentStyles.display = "flex";
6016
+ contentStyles.flexDirection = "column";
6017
+ }
6018
+ const contentBorderStyles = borderValueToCSS(contentBorder);
6019
+ if (contentBorderStyles) {
6020
+ Object.assign(contentStyles, contentBorderStyles);
6021
+ }
6022
+ const contentPaddingResult = responsiveValueToCSS(
6023
+ contentPadding,
6024
+ (v) => ({ padding: paddingValueToCSS(v) }),
5977
6025
  contentClass
5978
6026
  );
6027
+ Object.assign(contentStyles, contentPaddingResult.baseStyles);
6028
+ if (contentPaddingResult.mediaQueryCSS) {
6029
+ mediaQueries.push(contentPaddingResult.mediaQueryCSS);
6030
+ }
6031
+ const sectionClasses = cn("relative w-full", sectionClass);
6032
+ const contentClasses = cn("relative z-10", contentClass);
6033
+ const hasContentStyles = Object.keys(contentStyles).length > 0;
5979
6034
  const allMediaQueryCSS = mediaQueries.join("\n");
6035
+ const renderContent = () => {
6036
+ if (hasMinHeight) {
6037
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(Content3, { style: { flex: 1 } }) });
6038
+ }
6039
+ return /* @__PURE__ */ jsxRuntime.jsx(Content3, {});
6040
+ };
5980
6041
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
5981
6042
  allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
5982
6043
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5985,7 +6046,7 @@ var SectionConfig = {
5985
6046
  id: id || void 0,
5986
6047
  className: sectionClasses,
5987
6048
  style: sectionStyles,
5988
- children: /* @__PURE__ */ jsxRuntime.jsx(Content3, { className: contentClasses, style: dimensionsResult.baseStyles })
6049
+ children: hasContentStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClasses, style: contentStyles, children: renderContent() }) : /* @__PURE__ */ jsxRuntime.jsx(Content3, { className: contentClasses })
5989
6050
  }
5990
6051
  )
5991
6052
  ] });
@@ -6479,7 +6540,7 @@ var DEFAULT_PADDING5 = {
6479
6540
  unit: "px",
6480
6541
  linked: true
6481
6542
  };
6482
- var DEFAULT_DIMENSIONS5 = {
6543
+ var DEFAULT_DIMENSIONS4 = {
6483
6544
  mode: "full",
6484
6545
  alignment: "center",
6485
6546
  maxWidth: { value: 100, unit: "%", enabled: true }
@@ -6506,7 +6567,7 @@ var TemplateConfig = {
6506
6567
  dimensions: createResponsiveField({
6507
6568
  label: "Dimensions (Responsive)",
6508
6569
  innerField: (config) => createDimensionsField(config),
6509
- defaultValue: DEFAULT_DIMENSIONS5
6570
+ defaultValue: DEFAULT_DIMENSIONS4
6510
6571
  }),
6511
6572
  // Spacing (grouped at bottom) - Responsive
6512
6573
  margin: createResponsiveField({
@@ -7911,7 +7972,7 @@ function RichTextRender({
7911
7972
  }
7912
7973
  return Object.keys(s).length > 0 ? s : void 0;
7913
7974
  }, [dimensions, margin, customPadding]);
7914
- return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "relative overflow-hidden", style, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert", dangerouslySetInnerHTML: { __html: content } }) });
7975
+ return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "relative overflow-hidden", style, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert max-w-none", dangerouslySetInnerHTML: { __html: content } }) });
7915
7976
  }
7916
7977
  var RichTextEditorConfig = {
7917
7978
  label: "Rich Text",
@@ -8351,6 +8412,14 @@ function createTransformField(config) {
8351
8412
  )
8352
8413
  };
8353
8414
  }
8415
+ var DEFAULT_PADDING6 = {
8416
+ top: 16,
8417
+ right: 16,
8418
+ bottom: 16,
8419
+ left: 16,
8420
+ unit: "px",
8421
+ linked: true
8422
+ };
8354
8423
  var defaultProps10 = {
8355
8424
  image: null,
8356
8425
  alt: "",
@@ -8363,7 +8432,8 @@ var defaultProps10 = {
8363
8432
  alignment: null,
8364
8433
  transform: null,
8365
8434
  animation: null,
8366
- customPadding: null,
8435
+ customPadding: DEFAULT_PADDING6,
8436
+ // Default 16px padding, visible in editor
8367
8437
  visibility: null
8368
8438
  };
8369
8439
  var ImageConfig = {
@@ -8434,7 +8504,7 @@ var ImageConfig = {
8434
8504
  if (!image?.url) {
8435
8505
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
8436
8506
  visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
8437
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
8507
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
8438
8508
  "div",
8439
8509
  {
8440
8510
  className: cn(
@@ -8473,7 +8543,7 @@ var ImageConfig = {
8473
8543
  ) : imageElement;
8474
8544
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
8475
8545
  visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
8476
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: content }) })
8546
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: content }) })
8477
8547
  ] });
8478
8548
  }
8479
8549
  };
@@ -8821,6 +8891,14 @@ var ButtonConfig = {
8821
8891
  );
8822
8892
  }
8823
8893
  };
8894
+ var DEFAULT_CONTENT_PADDING2 = {
8895
+ top: 16,
8896
+ right: 16,
8897
+ bottom: 16,
8898
+ left: 16,
8899
+ unit: "px",
8900
+ linked: true
8901
+ };
8824
8902
  var defaultProps12 = {
8825
8903
  image: null,
8826
8904
  heading: "Card Heading",
@@ -8835,7 +8913,8 @@ var defaultProps12 = {
8835
8913
  alignment: null,
8836
8914
  transform: null,
8837
8915
  animation: null,
8838
- customPadding: null
8916
+ contentPadding: DEFAULT_CONTENT_PADDING2
8917
+ // Default 16px padding, visible in editor
8839
8918
  };
8840
8919
  var CardConfig = {
8841
8920
  label: "Card",
@@ -8879,10 +8958,10 @@ var CardConfig = {
8879
8958
  animation: createAnimationField({ label: "Animation" }),
8880
8959
  // Spacing (grouped at bottom)
8881
8960
  margin: createMarginField({ label: "Margin" }),
8882
- customPadding: createPaddingField({ label: "Padding" })
8961
+ contentPadding: createPaddingField({ label: "Content Padding" })
8883
8962
  },
8884
8963
  defaultProps: defaultProps12,
8885
- render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, customPadding }) => {
8964
+ render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, contentPadding }) => {
8886
8965
  const hasBorderRadius = border?.radius && border.radius > 0;
8887
8966
  const cardClasses = cn(
8888
8967
  "overflow-hidden transition-all bg-card",
@@ -8918,9 +8997,10 @@ var CardConfig = {
8918
8997
  if (borderStyles) {
8919
8998
  Object.assign(cardStyle, borderStyles);
8920
8999
  }
8921
- const paddingCSS = paddingValueToCSS(customPadding);
8922
- if (paddingCSS) {
8923
- cardStyle.padding = paddingCSS;
9000
+ const contentStyle = {};
9001
+ const contentPaddingCSS = paddingValueToCSS(contentPadding);
9002
+ if (contentPaddingCSS) {
9003
+ contentStyle.padding = contentPaddingCSS;
8924
9004
  }
8925
9005
  const cardContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardClasses, style: cardStyle, children: [
8926
9006
  image?.url ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -8931,7 +9011,7 @@ var CardConfig = {
8931
9011
  className: "w-full h-full object-cover"
8932
9012
  }
8933
9013
  ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video w-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No image" }) }),
8934
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
9014
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle, children: [
8935
9015
  heading && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
8936
9016
  text && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: text })
8937
9017
  ] })
@@ -8952,6 +9032,14 @@ var CardConfig = {
8952
9032
  return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: wrapperStyle, children: cardContent }) }) });
8953
9033
  }
8954
9034
  };
9035
+ var DEFAULT_PADDING7 = {
9036
+ top: 0,
9037
+ right: 16,
9038
+ bottom: 0,
9039
+ left: 16,
9040
+ unit: "px",
9041
+ linked: false
9042
+ };
8955
9043
  var defaultProps13 = {
8956
9044
  style: "solid",
8957
9045
  color: null,
@@ -8959,7 +9047,8 @@ var defaultProps13 = {
8959
9047
  dimensions: null,
8960
9048
  transform: null,
8961
9049
  animation: null,
8962
- customPadding: null
9050
+ customPadding: DEFAULT_PADDING7
9051
+ // Default 16px horizontal padding, visible in editor
8963
9052
  };
8964
9053
  var DividerConfig = {
8965
9054
  label: "Divider",
@@ -8994,7 +9083,7 @@ var DividerConfig = {
8994
9083
  }
8995
9084
  const customColor = colorValueToCSS(color);
8996
9085
  const hrStyle = customColor ? { borderColor: customColor } : void 0;
8997
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
9086
+ return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
8998
9087
  "hr",
8999
9088
  {
9000
9089
  className: cn(
@@ -9109,9 +9198,9 @@ function AccordionRenderer({
9109
9198
  Object.assign(style, transformStyles);
9110
9199
  }
9111
9200
  if (!items || items.length === 0) {
9112
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: accordionClasses, style: accordionStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-muted-foreground", children: "No accordion items. Add items in the editor." }) }) }) });
9201
+ return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: accordionClasses, style: accordionStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-muted-foreground", children: "No accordion items. Add items in the editor." }) }) }) });
9113
9202
  }
9114
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: accordionClasses, style: accordionStyle, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
9203
+ return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: accordionClasses, style: accordionStyle, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
9115
9204
  AccordionItem,
9116
9205
  {
9117
9206
  item,
@@ -9122,6 +9211,14 @@ function AccordionRenderer({
9122
9211
  index
9123
9212
  )) }) }) });
9124
9213
  }
9214
+ var DEFAULT_PADDING8 = {
9215
+ top: 0,
9216
+ right: 16,
9217
+ bottom: 0,
9218
+ left: 16,
9219
+ unit: "px",
9220
+ linked: false
9221
+ };
9125
9222
  var defaultProps14 = {
9126
9223
  items: [
9127
9224
  {
@@ -9142,7 +9239,8 @@ var defaultProps14 = {
9142
9239
  dimensions: null,
9143
9240
  transform: null,
9144
9241
  animation: null,
9145
- customPadding: null
9242
+ customPadding: DEFAULT_PADDING8
9243
+ // Default 16px horizontal padding, visible in editor
9146
9244
  };
9147
9245
  var AccordionConfig = {
9148
9246
  label: "Accordion",