@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.
@@ -542,25 +542,23 @@ function responsiveValueToCSS(value, converter, uniqueId) {
542
542
  mediaQueryCSS: ""
543
543
  };
544
544
  }
545
- const mediaQueries = [];
546
- let baseStyles = {};
545
+ const cssRules = [];
547
546
  BREAKPOINTS.forEach((bp) => {
548
547
  const bpValue = value[bp.key];
549
548
  if (bpValue === void 0) return;
550
549
  const cssProps = converter(bpValue);
551
550
  if (!cssProps) return;
551
+ const styleString = cssPropertiesToString(cssProps);
552
+ if (!styleString) return;
552
553
  if (bp.key === "xs") {
553
- baseStyles = cssProps;
554
+ cssRules.push(`.${uniqueId} { ${styleString} }`);
554
555
  } else {
555
- const styleString = cssPropertiesToString(cssProps);
556
- if (styleString) {
557
- mediaQueries.push(
558
- `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
559
- );
560
- }
556
+ cssRules.push(
557
+ `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
558
+ );
561
559
  }
562
560
  });
563
- return { baseStyles, mediaQueryCSS: mediaQueries.join("\n") };
561
+ return { baseStyles: {}, mediaQueryCSS: cssRules.join("\n") };
564
562
  }
565
563
  var DEFAULT_VISIBILITY = {
566
564
  xs: true,
@@ -3719,12 +3717,12 @@ function createBorderField(config) {
3719
3717
  };
3720
3718
  }
3721
3719
  var DEFAULT_VALUE4 = {
3722
- mode: "contained",
3720
+ mode: "full",
3723
3721
  alignment: "center",
3724
3722
  maxWidth: {
3725
- value: 1200,
3723
+ value: 0,
3726
3724
  unit: "px",
3727
- enabled: true
3725
+ enabled: false
3728
3726
  },
3729
3727
  advancedMode: false
3730
3728
  };
@@ -3951,11 +3949,13 @@ function DimensionsFieldInner({
3951
3949
  const handleAdvancedToggle = useCallback(() => {
3952
3950
  const newAdvancedMode = !advancedMode;
3953
3951
  setAdvancedMode(newAdvancedMode);
3954
- onChange({
3955
- ...currentValue,
3956
- advancedMode: newAdvancedMode
3957
- });
3958
- }, [advancedMode, currentValue, onChange]);
3952
+ if (value !== null) {
3953
+ onChange({
3954
+ ...currentValue,
3955
+ advancedMode: newAdvancedMode
3956
+ });
3957
+ }
3958
+ }, [advancedMode, currentValue, onChange, value]);
3959
3959
  const modeConfig = [
3960
3960
  { mode: "full", icon: MoveHorizontal, label: "Full", title: "Full width (100%)" },
3961
3961
  { mode: "contained", icon: Square, label: "Contain", title: "Contained (centered with max-width)" },
@@ -4924,7 +4924,7 @@ function ResponsiveFieldInner({
4924
4924
  }) {
4925
4925
  const [activeBreakpoint, setActiveBreakpoint] = useState("xs");
4926
4926
  const getCurrentValue = useCallback(() => {
4927
- if (!value) return defaultValue ?? null;
4927
+ if (!value) return null;
4928
4928
  if (activeBreakpoint === "xs") {
4929
4929
  return value.xs ?? defaultValue ?? null;
4930
4930
  }
@@ -4946,21 +4946,35 @@ function ResponsiveFieldInner({
4946
4946
  const hasOverride = useCallback(
4947
4947
  (breakpoint) => {
4948
4948
  if (!value) return false;
4949
- if (breakpoint === "xs") return value.xs !== void 0;
4949
+ if (breakpoint === "xs") return false;
4950
4950
  return value[breakpoint] !== void 0;
4951
4951
  },
4952
4952
  [value]
4953
4953
  );
4954
+ const getInheritanceSource = useCallback(() => {
4955
+ if (!value || activeBreakpoint === "xs") return null;
4956
+ if (value[activeBreakpoint] !== void 0) return null;
4957
+ const breakpointOrder = ["xl", "lg", "md", "sm", "xs"];
4958
+ const activeIndex = breakpointOrder.indexOf(activeBreakpoint);
4959
+ for (let i = activeIndex + 1; i < breakpointOrder.length; i++) {
4960
+ const bp = breakpointOrder[i];
4961
+ if (value[bp] !== void 0) {
4962
+ return bp;
4963
+ }
4964
+ }
4965
+ return null;
4966
+ }, [value, activeBreakpoint]);
4954
4967
  const handleInnerChange = useCallback(
4955
4968
  (newValue) => {
4956
4969
  if (activeBreakpoint === "xs") {
4957
- if (newValue === null && defaultValue !== void 0) {
4958
- onChange({ ...value, xs: defaultValue });
4959
- } else if (newValue !== null) {
4970
+ if (newValue === null) {
4971
+ onChange(null);
4972
+ } else {
4960
4973
  onChange({ ...value, xs: newValue });
4961
4974
  }
4962
4975
  } else {
4963
4976
  if (newValue === null) {
4977
+ if (!value) return;
4964
4978
  const newResponsive = { ...value };
4965
4979
  delete newResponsive[activeBreakpoint];
4966
4980
  onChange(newResponsive);
@@ -4989,6 +5003,7 @@ function ResponsiveFieldInner({
4989
5003
  const currentValue = getCurrentValue();
4990
5004
  const isOverrideBreakpoint = activeBreakpoint !== "xs";
4991
5005
  const currentHasOverride = hasOverride(activeBreakpoint);
5006
+ const inheritanceSource = getInheritanceSource();
4992
5007
  const overrideCount = value ? ["sm", "md", "lg", "xl"].filter((bp) => value[bp] !== void 0).length : 0;
4993
5008
  return /* @__PURE__ */ jsxs("div", { className: "puck-field space-y-3", children: [
4994
5009
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
@@ -5030,7 +5045,11 @@ function ResponsiveFieldInner({
5030
5045
  /* @__PURE__ */ jsx("span", { children: activeBreakpoint === "xs" ? "Extra small screens (0-639px)" : /* @__PURE__ */ jsxs(Fragment, { children: [
5031
5046
  BREAKPOINTS.find((bp) => bp.key === activeBreakpoint)?.minWidth,
5032
5047
  "px and up",
5033
- !currentHasOverride && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: " (inheriting from xs)" })
5048
+ !currentHasOverride && inheritanceSource && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/60", children: [
5049
+ " (inheriting from ",
5050
+ inheritanceSource.toUpperCase(),
5051
+ ")"
5052
+ ] })
5034
5053
  ] }) }),
5035
5054
  isOverrideBreakpoint && currentHasOverride && !readOnly && /* @__PURE__ */ jsx(
5036
5055
  Button,
@@ -5182,11 +5201,6 @@ function createResponsiveVisibilityField(config = {}) {
5182
5201
  )
5183
5202
  };
5184
5203
  }
5185
- var DEFAULT_DIMENSIONS = {
5186
- mode: "contained",
5187
- alignment: "center",
5188
- maxWidth: { value: 1200, unit: "px", enabled: true }
5189
- };
5190
5204
  var DEFAULT_PADDING = {
5191
5205
  top: 0,
5192
5206
  right: 0,
@@ -5195,18 +5209,20 @@ var DEFAULT_PADDING = {
5195
5209
  unit: "px",
5196
5210
  linked: true
5197
5211
  };
5212
+ var DEFAULT_DIMENSIONS = {
5213
+ mode: "full",
5214
+ alignment: "center",
5215
+ maxWidth: { value: 100, unit: "%", enabled: true }
5216
+ };
5198
5217
  var defaultProps = {
5199
5218
  content: [],
5200
- background: null,
5201
- customPadding: null,
5219
+ visibility: null,
5202
5220
  dimensions: null,
5221
+ background: null,
5203
5222
  border: null,
5223
+ padding: null,
5204
5224
  margin: null,
5205
- animation: null,
5206
- innerBackground: null,
5207
- innerPadding: null,
5208
- innerBorder: null,
5209
- visibility: null
5225
+ animation: null
5210
5226
  };
5211
5227
  var ContainerConfig = {
5212
5228
  label: "Container",
@@ -5215,119 +5231,113 @@ var ContainerConfig = {
5215
5231
  content: {
5216
5232
  type: "slot"
5217
5233
  },
5218
- // Responsive visibility control
5234
+ // Visibility first
5219
5235
  visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5220
- // Outer (section-level) options
5221
- background: createBackgroundField({ label: "Outer Background" }),
5222
- border: createBorderField({ label: "Outer Border" }),
5223
- // Responsive dimensions field
5236
+ // Dimensions
5224
5237
  dimensions: createResponsiveField({
5225
- label: "Dimensions (Responsive)",
5238
+ label: "Dimensions",
5226
5239
  innerField: (config) => createDimensionsField(config),
5227
5240
  defaultValue: DEFAULT_DIMENSIONS
5228
5241
  }),
5229
- animation: createAnimationField({ label: "Animation" }),
5230
- // Inner (content container) options
5231
- innerBackground: createBackgroundField({ label: "Inner Background" }),
5232
- innerBorder: createBorderField({ label: "Inner Border" }),
5233
- // Responsive inner padding
5234
- innerPadding: createResponsiveField({
5235
- label: "Inner Padding (Responsive)",
5242
+ // Styling
5243
+ background: createBackgroundField({ label: "Background" }),
5244
+ border: createBorderField({ label: "Border" }),
5245
+ // Spacing
5246
+ padding: createResponsiveField({
5247
+ label: "Padding",
5236
5248
  innerField: (config) => createPaddingField(config),
5237
5249
  defaultValue: DEFAULT_PADDING
5238
5250
  }),
5239
- // Spacing (grouped at bottom) - Responsive
5240
5251
  margin: createResponsiveField({
5241
- label: "Margin (Responsive)",
5252
+ label: "Margin",
5242
5253
  innerField: (config) => createMarginField(config),
5243
5254
  defaultValue: DEFAULT_PADDING
5244
5255
  }),
5245
- customPadding: createResponsiveField({
5246
- label: "Outer Padding (Responsive)",
5247
- innerField: (config) => createPaddingField(config),
5248
- defaultValue: DEFAULT_PADDING
5249
- })
5256
+ // Animation
5257
+ animation: createAnimationField({ label: "Animation" })
5250
5258
  },
5251
5259
  defaultProps,
5252
5260
  render: ({
5253
5261
  content: Content3,
5254
- background,
5255
- customPadding,
5262
+ visibility,
5256
5263
  dimensions,
5264
+ background,
5257
5265
  border,
5266
+ padding,
5258
5267
  margin,
5259
- animation,
5260
- innerBackground,
5261
- innerPadding,
5262
- innerBorder,
5263
- visibility
5268
+ animation
5264
5269
  }) => {
5265
5270
  const uniqueId = useId().replace(/:/g, "");
5266
- const outerClass = `puck-container-outer-${uniqueId}`;
5267
- const innerClass = `puck-container-inner-${uniqueId}`;
5271
+ const containerClass = `puck-container-${uniqueId}`;
5268
5272
  const mediaQueries = [];
5269
- const outerBackgroundStyles = backgroundValueToCSS(background);
5270
- const outerStyles = {
5271
- ...outerBackgroundStyles
5272
- };
5273
- const outerPaddingResult = responsiveValueToCSS(
5274
- customPadding,
5275
- (v) => ({ padding: paddingValueToCSS(v) }),
5276
- outerClass
5277
- );
5278
- Object.assign(outerStyles, outerPaddingResult.baseStyles);
5279
- if (outerPaddingResult.mediaQueryCSS) {
5280
- mediaQueries.push(outerPaddingResult.mediaQueryCSS);
5281
- }
5282
- const outerBorderStyles = borderValueToCSS(border);
5283
- if (outerBorderStyles) {
5284
- Object.assign(outerStyles, outerBorderStyles);
5273
+ const containerStyles = {};
5274
+ const backgroundStyles = backgroundValueToCSS(background);
5275
+ if (backgroundStyles) {
5276
+ Object.assign(containerStyles, backgroundStyles);
5285
5277
  }
5286
- const marginResult = responsiveValueToCSS(
5287
- margin,
5288
- (v) => ({ margin: marginValueToCSS(v) }),
5289
- outerClass
5290
- );
5291
- Object.assign(outerStyles, marginResult.baseStyles);
5292
- if (marginResult.mediaQueryCSS) {
5293
- mediaQueries.push(marginResult.mediaQueryCSS);
5278
+ const borderStyles = borderValueToCSS(border);
5279
+ if (borderStyles) {
5280
+ Object.assign(containerStyles, borderStyles);
5294
5281
  }
5295
- const innerBackgroundStyles = backgroundValueToCSS(innerBackground);
5296
- const innerStyles = {
5297
- ...innerBackgroundStyles
5298
- };
5299
5282
  const dimensionsResult = responsiveValueToCSS(
5300
5283
  dimensions,
5301
5284
  dimensionsValueToCSS,
5302
- innerClass
5285
+ containerClass
5303
5286
  );
5304
- Object.assign(innerStyles, dimensionsResult.baseStyles);
5287
+ Object.assign(containerStyles, dimensionsResult.baseStyles);
5305
5288
  if (dimensionsResult.mediaQueryCSS) {
5306
5289
  mediaQueries.push(dimensionsResult.mediaQueryCSS);
5307
5290
  }
5308
- const innerPaddingResult = responsiveValueToCSS(
5309
- innerPadding,
5291
+ const hasMinHeight = (() => {
5292
+ if (!dimensions) return false;
5293
+ if (typeof dimensions === "object" && "xs" in dimensions) {
5294
+ const responsiveDims = dimensions;
5295
+ return Object.values(responsiveDims).some((v) => {
5296
+ if (!v || typeof v !== "object") return false;
5297
+ const dim2 = v;
5298
+ return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
5299
+ });
5300
+ }
5301
+ const dim = dimensions;
5302
+ return dim.minHeight?.enabled && dim.minHeight?.value > 0;
5303
+ })();
5304
+ if (hasMinHeight) {
5305
+ containerStyles.display = "flex";
5306
+ containerStyles.flexDirection = "column";
5307
+ }
5308
+ const paddingResult = responsiveValueToCSS(
5309
+ padding,
5310
5310
  (v) => ({ padding: paddingValueToCSS(v) }),
5311
- innerClass
5311
+ containerClass
5312
5312
  );
5313
- Object.assign(innerStyles, innerPaddingResult.baseStyles);
5314
- if (innerPaddingResult.mediaQueryCSS) {
5315
- mediaQueries.push(innerPaddingResult.mediaQueryCSS);
5313
+ Object.assign(containerStyles, paddingResult.baseStyles);
5314
+ if (paddingResult.mediaQueryCSS) {
5315
+ mediaQueries.push(paddingResult.mediaQueryCSS);
5316
5316
  }
5317
- const innerBorderStyles = borderValueToCSS(innerBorder);
5318
- if (innerBorderStyles) {
5319
- Object.assign(innerStyles, innerBorderStyles);
5317
+ const marginResult = responsiveValueToCSS(
5318
+ margin,
5319
+ (v) => ({ margin: marginValueToCSS(v) }),
5320
+ containerClass
5321
+ );
5322
+ Object.assign(containerStyles, marginResult.baseStyles);
5323
+ if (marginResult.mediaQueryCSS) {
5324
+ mediaQueries.push(marginResult.mediaQueryCSS);
5320
5325
  }
5321
- const visibilityCSS = visibilityValueToCSS(visibility, outerClass);
5326
+ const visibilityCSS = visibilityValueToCSS(visibility, containerClass);
5322
5327
  if (visibilityCSS) {
5323
5328
  mediaQueries.push(visibilityCSS);
5324
5329
  }
5325
- const contentClasses = cn("px-4", innerClass);
5326
- const hasInnerStyles = Object.keys(innerStyles).length > 0;
5327
5330
  const allMediaQueryCSS = mediaQueries.join("\n");
5331
+ const hasStyles = Object.keys(containerStyles).length > 0;
5332
+ const renderContent = () => {
5333
+ if (hasMinHeight) {
5334
+ return /* @__PURE__ */ jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsx(Content3, { style: { flex: 1 } }) });
5335
+ }
5336
+ return /* @__PURE__ */ jsx(Content3, {});
5337
+ };
5328
5338
  return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
5329
5339
  allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
5330
- /* @__PURE__ */ jsx("div", { className: outerClass, style: outerStyles, children: hasInnerStyles ? /* @__PURE__ */ jsx("div", { className: contentClasses, style: innerStyles, children: /* @__PURE__ */ jsx(Content3, {}) }) : /* @__PURE__ */ jsx(Content3, { className: contentClasses, style: innerStyles }) })
5340
+ hasStyles ? /* @__PURE__ */ jsx("div", { className: containerClass, style: containerStyles, children: renderContent() }) : /* @__PURE__ */ jsx(Content3, { className: containerClass })
5331
5341
  ] });
5332
5342
  }
5333
5343
  };
@@ -5822,20 +5832,33 @@ var DEFAULT_PADDING4 = {
5822
5832
  unit: "px",
5823
5833
  linked: true
5824
5834
  };
5825
- var DEFAULT_DIMENSIONS4 = {
5826
- mode: "full",
5835
+ var DEFAULT_CONTENT_DIMENSIONS = {
5836
+ mode: "contained",
5827
5837
  alignment: "center",
5828
- maxWidth: { value: 100, unit: "%", enabled: true }
5838
+ maxWidth: { value: 1200, unit: "px", enabled: true }
5839
+ };
5840
+ var DEFAULT_CONTENT_PADDING = {
5841
+ top: 0,
5842
+ right: 16,
5843
+ bottom: 0,
5844
+ left: 16,
5845
+ unit: "px",
5846
+ linked: false
5829
5847
  };
5830
5848
  var defaultProps4 = {
5831
5849
  id: "",
5832
5850
  content: [],
5833
- background: null,
5834
- fullWidth: false,
5835
- customPadding: null,
5836
- dimensions: null,
5837
- border: null,
5838
- margin: null,
5851
+ // Section layer defaults
5852
+ sectionBackground: null,
5853
+ sectionBorder: null,
5854
+ sectionPadding: null,
5855
+ sectionMargin: null,
5856
+ // Content layer defaults - 1200px max-width so two-layer design is immediately visible
5857
+ contentDimensions: { xs: DEFAULT_CONTENT_DIMENSIONS },
5858
+ contentBackground: null,
5859
+ contentBorder: null,
5860
+ contentPadding: { xs: DEFAULT_CONTENT_PADDING },
5861
+ // Other
5839
5862
  animation: null,
5840
5863
  visibility: null
5841
5864
  };
@@ -5843,6 +5866,9 @@ var SectionConfig = {
5843
5866
  label: "Section",
5844
5867
  fields: {
5845
5868
  _reset: createResetField({ defaultProps: defaultProps4 }),
5869
+ // Visibility first
5870
+ visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5871
+ // Section ID for anchors
5846
5872
  id: {
5847
5873
  type: "text",
5848
5874
  label: "Section ID"
@@ -5850,49 +5876,47 @@ var SectionConfig = {
5850
5876
  content: {
5851
5877
  type: "slot"
5852
5878
  },
5853
- // Responsive visibility control
5854
- visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5855
- fullWidth: {
5856
- type: "radio",
5857
- label: "Full Width Content",
5858
- options: [
5859
- { label: "Yes", value: true },
5860
- { label: "No", value: false }
5861
- ]
5862
- },
5863
- // Background
5864
- background: createBackgroundField({ label: "Background" }),
5865
- // Advanced custom options
5866
- border: createBorderField({ label: "Border" }),
5867
- // Responsive dimensions
5868
- dimensions: createResponsiveField({
5869
- label: "Dimensions (Responsive)",
5870
- innerField: (config) => createDimensionsField(config),
5871
- defaultValue: DEFAULT_DIMENSIONS4
5879
+ // Section layer (outer)
5880
+ sectionBackground: createBackgroundField({ label: "Section Background" }),
5881
+ sectionBorder: createBorderField({ label: "Section Border" }),
5882
+ sectionPadding: createResponsiveField({
5883
+ label: "Section Padding",
5884
+ innerField: (config) => createPaddingField(config),
5885
+ defaultValue: DEFAULT_PADDING4
5872
5886
  }),
5873
- animation: createAnimationField({ label: "Animation" }),
5874
- // Spacing (grouped at bottom) - Responsive
5875
- margin: createResponsiveField({
5876
- label: "Margin (Responsive)",
5887
+ sectionMargin: createResponsiveField({
5888
+ label: "Section Margin",
5877
5889
  innerField: (config) => createMarginField(config),
5878
5890
  defaultValue: DEFAULT_PADDING4
5879
5891
  }),
5880
- customPadding: createResponsiveField({
5881
- label: "Padding (Responsive)",
5892
+ // Content layer (inner)
5893
+ contentDimensions: createResponsiveField({
5894
+ label: "Content Dimensions",
5895
+ innerField: (config) => createDimensionsField(config),
5896
+ defaultValue: DEFAULT_CONTENT_DIMENSIONS
5897
+ }),
5898
+ contentBackground: createBackgroundField({ label: "Content Background" }),
5899
+ contentBorder: createBorderField({ label: "Content Border" }),
5900
+ contentPadding: createResponsiveField({
5901
+ label: "Content Padding",
5882
5902
  innerField: (config) => createPaddingField(config),
5883
5903
  defaultValue: DEFAULT_PADDING4
5884
- })
5904
+ }),
5905
+ // Animation
5906
+ animation: createAnimationField({ label: "Animation" })
5885
5907
  },
5886
5908
  defaultProps: defaultProps4,
5887
5909
  render: ({
5888
5910
  id,
5889
5911
  content: Content3,
5890
- background,
5891
- fullWidth,
5892
- customPadding,
5893
- dimensions,
5894
- border,
5895
- margin,
5912
+ sectionBackground,
5913
+ sectionBorder,
5914
+ sectionPadding,
5915
+ sectionMargin,
5916
+ contentDimensions,
5917
+ contentBackground,
5918
+ contentBorder,
5919
+ contentPadding,
5896
5920
  animation,
5897
5921
  visibility
5898
5922
  }) => {
@@ -5900,52 +5924,89 @@ var SectionConfig = {
5900
5924
  const sectionClass = `puck-section-${uniqueId}`;
5901
5925
  const contentClass = `puck-section-content-${uniqueId}`;
5902
5926
  const mediaQueries = [];
5903
- const backgroundStyles = backgroundValueToCSS(background);
5927
+ const sectionBackgroundStyles = backgroundValueToCSS(sectionBackground);
5904
5928
  const sectionStyles = {
5905
- ...backgroundStyles
5929
+ ...sectionBackgroundStyles
5906
5930
  };
5907
- const paddingResult = responsiveValueToCSS(
5908
- customPadding,
5931
+ const sectionBorderStyles = borderValueToCSS(sectionBorder);
5932
+ if (sectionBorderStyles) {
5933
+ Object.assign(sectionStyles, sectionBorderStyles);
5934
+ }
5935
+ const sectionPaddingResult = responsiveValueToCSS(
5936
+ sectionPadding,
5909
5937
  (v) => ({ padding: paddingValueToCSS(v) }),
5910
5938
  sectionClass
5911
5939
  );
5912
- Object.assign(sectionStyles, paddingResult.baseStyles);
5913
- if (paddingResult.mediaQueryCSS) {
5914
- mediaQueries.push(paddingResult.mediaQueryCSS);
5940
+ Object.assign(sectionStyles, sectionPaddingResult.baseStyles);
5941
+ if (sectionPaddingResult.mediaQueryCSS) {
5942
+ mediaQueries.push(sectionPaddingResult.mediaQueryCSS);
5915
5943
  }
5916
- const borderStyles = borderValueToCSS(border);
5917
- if (borderStyles) {
5918
- Object.assign(sectionStyles, borderStyles);
5919
- }
5920
- const marginResult = responsiveValueToCSS(
5921
- margin,
5944
+ const sectionMarginResult = responsiveValueToCSS(
5945
+ sectionMargin,
5922
5946
  (v) => ({ margin: marginValueToCSS(v) }),
5923
5947
  sectionClass
5924
5948
  );
5925
- Object.assign(sectionStyles, marginResult.baseStyles);
5926
- if (marginResult.mediaQueryCSS) {
5927
- mediaQueries.push(marginResult.mediaQueryCSS);
5949
+ Object.assign(sectionStyles, sectionMarginResult.baseStyles);
5950
+ if (sectionMarginResult.mediaQueryCSS) {
5951
+ mediaQueries.push(sectionMarginResult.mediaQueryCSS);
5928
5952
  }
5929
5953
  const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
5930
5954
  if (visibilityCSS) {
5931
5955
  mediaQueries.push(visibilityCSS);
5932
5956
  }
5933
- const sectionClasses = cn("relative w-full", sectionClass);
5934
- const dimensionsResult = responsiveValueToCSS(
5935
- dimensions,
5957
+ const contentBackgroundStyles = backgroundValueToCSS(contentBackground);
5958
+ const contentStyles = {
5959
+ ...contentBackgroundStyles
5960
+ };
5961
+ const contentDimensionsResult = responsiveValueToCSS(
5962
+ contentDimensions,
5936
5963
  dimensionsValueToCSS,
5937
5964
  contentClass
5938
5965
  );
5939
- if (dimensionsResult.mediaQueryCSS) {
5940
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
5941
- }
5942
- const contentClasses = cn(
5943
- "relative z-10",
5944
- // Only apply preset content width if no dimensions set
5945
- !dimensions && !fullWidth && "max-w-[1200px] mx-auto px-4",
5966
+ Object.assign(contentStyles, contentDimensionsResult.baseStyles);
5967
+ if (contentDimensionsResult.mediaQueryCSS) {
5968
+ mediaQueries.push(contentDimensionsResult.mediaQueryCSS);
5969
+ }
5970
+ const hasMinHeight = (() => {
5971
+ if (!contentDimensions) return false;
5972
+ if (typeof contentDimensions === "object" && "xs" in contentDimensions) {
5973
+ const responsiveDims = contentDimensions;
5974
+ return Object.values(responsiveDims).some((v) => {
5975
+ if (!v || typeof v !== "object") return false;
5976
+ const dim2 = v;
5977
+ return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
5978
+ });
5979
+ }
5980
+ const dim = contentDimensions;
5981
+ return dim.minHeight?.enabled && dim.minHeight?.value > 0;
5982
+ })();
5983
+ if (hasMinHeight) {
5984
+ contentStyles.display = "flex";
5985
+ contentStyles.flexDirection = "column";
5986
+ }
5987
+ const contentBorderStyles = borderValueToCSS(contentBorder);
5988
+ if (contentBorderStyles) {
5989
+ Object.assign(contentStyles, contentBorderStyles);
5990
+ }
5991
+ const contentPaddingResult = responsiveValueToCSS(
5992
+ contentPadding,
5993
+ (v) => ({ padding: paddingValueToCSS(v) }),
5946
5994
  contentClass
5947
5995
  );
5996
+ Object.assign(contentStyles, contentPaddingResult.baseStyles);
5997
+ if (contentPaddingResult.mediaQueryCSS) {
5998
+ mediaQueries.push(contentPaddingResult.mediaQueryCSS);
5999
+ }
6000
+ const sectionClasses = cn("relative w-full", sectionClass);
6001
+ const contentClasses = cn("relative z-10", contentClass);
6002
+ const hasContentStyles = Object.keys(contentStyles).length > 0;
5948
6003
  const allMediaQueryCSS = mediaQueries.join("\n");
6004
+ const renderContent = () => {
6005
+ if (hasMinHeight) {
6006
+ return /* @__PURE__ */ jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsx(Content3, { style: { flex: 1 } }) });
6007
+ }
6008
+ return /* @__PURE__ */ jsx(Content3, {});
6009
+ };
5949
6010
  return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
5950
6011
  allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
5951
6012
  /* @__PURE__ */ jsx(
@@ -5954,7 +6015,7 @@ var SectionConfig = {
5954
6015
  id: id || void 0,
5955
6016
  className: sectionClasses,
5956
6017
  style: sectionStyles,
5957
- children: /* @__PURE__ */ jsx(Content3, { className: contentClasses, style: dimensionsResult.baseStyles })
6018
+ children: hasContentStyles ? /* @__PURE__ */ jsx("div", { className: contentClasses, style: contentStyles, children: renderContent() }) : /* @__PURE__ */ jsx(Content3, { className: contentClasses })
5958
6019
  }
5959
6020
  )
5960
6021
  ] });
@@ -6448,7 +6509,7 @@ var DEFAULT_PADDING5 = {
6448
6509
  unit: "px",
6449
6510
  linked: true
6450
6511
  };
6451
- var DEFAULT_DIMENSIONS5 = {
6512
+ var DEFAULT_DIMENSIONS4 = {
6452
6513
  mode: "full",
6453
6514
  alignment: "center",
6454
6515
  maxWidth: { value: 100, unit: "%", enabled: true }
@@ -6475,7 +6536,7 @@ var TemplateConfig = {
6475
6536
  dimensions: createResponsiveField({
6476
6537
  label: "Dimensions (Responsive)",
6477
6538
  innerField: (config) => createDimensionsField(config),
6478
- defaultValue: DEFAULT_DIMENSIONS5
6539
+ defaultValue: DEFAULT_DIMENSIONS4
6479
6540
  }),
6480
6541
  // Spacing (grouped at bottom) - Responsive
6481
6542
  margin: createResponsiveField({
@@ -7880,7 +7941,7 @@ function RichTextRender({
7880
7941
  }
7881
7942
  return Object.keys(s).length > 0 ? s : void 0;
7882
7943
  }, [dimensions, margin, customPadding]);
7883
- return /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden", style, children: /* @__PURE__ */ jsx("div", { className: "prose dark:prose-invert", dangerouslySetInnerHTML: { __html: content } }) });
7944
+ return /* @__PURE__ */ jsx("section", { className: "relative overflow-hidden", style, children: /* @__PURE__ */ jsx("div", { className: "prose dark:prose-invert max-w-none", dangerouslySetInnerHTML: { __html: content } }) });
7884
7945
  }
7885
7946
  var RichTextEditorConfig = {
7886
7947
  label: "Rich Text",
@@ -8320,6 +8381,14 @@ function createTransformField(config) {
8320
8381
  )
8321
8382
  };
8322
8383
  }
8384
+ var DEFAULT_PADDING6 = {
8385
+ top: 16,
8386
+ right: 16,
8387
+ bottom: 16,
8388
+ left: 16,
8389
+ unit: "px",
8390
+ linked: true
8391
+ };
8323
8392
  var defaultProps10 = {
8324
8393
  image: null,
8325
8394
  alt: "",
@@ -8332,7 +8401,8 @@ var defaultProps10 = {
8332
8401
  alignment: null,
8333
8402
  transform: null,
8334
8403
  animation: null,
8335
- customPadding: null,
8404
+ customPadding: DEFAULT_PADDING6,
8405
+ // Default 16px padding, visible in editor
8336
8406
  visibility: null
8337
8407
  };
8338
8408
  var ImageConfig = {
@@ -8403,7 +8473,7 @@ var ImageConfig = {
8403
8473
  if (!image?.url) {
8404
8474
  return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
8405
8475
  visibilityCSS && /* @__PURE__ */ jsx("style", { children: visibilityCSS }),
8406
- /* @__PURE__ */ jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx(
8476
+ /* @__PURE__ */ jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx(
8407
8477
  "div",
8408
8478
  {
8409
8479
  className: cn(
@@ -8442,7 +8512,7 @@ var ImageConfig = {
8442
8512
  ) : imageElement;
8443
8513
  return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
8444
8514
  visibilityCSS && /* @__PURE__ */ jsx("style", { children: visibilityCSS }),
8445
- /* @__PURE__ */ jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: content }) })
8515
+ /* @__PURE__ */ jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: content }) })
8446
8516
  ] });
8447
8517
  }
8448
8518
  };
@@ -8790,6 +8860,14 @@ var ButtonConfig = {
8790
8860
  );
8791
8861
  }
8792
8862
  };
8863
+ var DEFAULT_CONTENT_PADDING2 = {
8864
+ top: 16,
8865
+ right: 16,
8866
+ bottom: 16,
8867
+ left: 16,
8868
+ unit: "px",
8869
+ linked: true
8870
+ };
8793
8871
  var defaultProps12 = {
8794
8872
  image: null,
8795
8873
  heading: "Card Heading",
@@ -8804,7 +8882,8 @@ var defaultProps12 = {
8804
8882
  alignment: null,
8805
8883
  transform: null,
8806
8884
  animation: null,
8807
- customPadding: null
8885
+ contentPadding: DEFAULT_CONTENT_PADDING2
8886
+ // Default 16px padding, visible in editor
8808
8887
  };
8809
8888
  var CardConfig = {
8810
8889
  label: "Card",
@@ -8848,10 +8927,10 @@ var CardConfig = {
8848
8927
  animation: createAnimationField({ label: "Animation" }),
8849
8928
  // Spacing (grouped at bottom)
8850
8929
  margin: createMarginField({ label: "Margin" }),
8851
- customPadding: createPaddingField({ label: "Padding" })
8930
+ contentPadding: createPaddingField({ label: "Content Padding" })
8852
8931
  },
8853
8932
  defaultProps: defaultProps12,
8854
- render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, customPadding }) => {
8933
+ render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, contentPadding }) => {
8855
8934
  const hasBorderRadius = border?.radius && border.radius > 0;
8856
8935
  const cardClasses = cn(
8857
8936
  "overflow-hidden transition-all bg-card",
@@ -8887,9 +8966,10 @@ var CardConfig = {
8887
8966
  if (borderStyles) {
8888
8967
  Object.assign(cardStyle, borderStyles);
8889
8968
  }
8890
- const paddingCSS = paddingValueToCSS(customPadding);
8891
- if (paddingCSS) {
8892
- cardStyle.padding = paddingCSS;
8969
+ const contentStyle = {};
8970
+ const contentPaddingCSS = paddingValueToCSS(contentPadding);
8971
+ if (contentPaddingCSS) {
8972
+ contentStyle.padding = contentPaddingCSS;
8893
8973
  }
8894
8974
  const cardContent = /* @__PURE__ */ jsxs("div", { className: cardClasses, style: cardStyle, children: [
8895
8975
  image?.url ? /* @__PURE__ */ jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsx(
@@ -8900,7 +8980,7 @@ var CardConfig = {
8900
8980
  className: "w-full h-full object-cover"
8901
8981
  }
8902
8982
  ) }) : /* @__PURE__ */ jsx("div", { className: "aspect-video w-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "No image" }) }),
8903
- /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
8983
+ /* @__PURE__ */ jsxs("div", { style: contentStyle, children: [
8904
8984
  heading && /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
8905
8985
  text && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: text })
8906
8986
  ] })
@@ -8921,6 +9001,14 @@ var CardConfig = {
8921
9001
  return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: cardContent }) }) });
8922
9002
  }
8923
9003
  };
9004
+ var DEFAULT_PADDING7 = {
9005
+ top: 0,
9006
+ right: 16,
9007
+ bottom: 0,
9008
+ left: 16,
9009
+ unit: "px",
9010
+ linked: false
9011
+ };
8924
9012
  var defaultProps13 = {
8925
9013
  style: "solid",
8926
9014
  color: null,
@@ -8928,7 +9016,8 @@ var defaultProps13 = {
8928
9016
  dimensions: null,
8929
9017
  transform: null,
8930
9018
  animation: null,
8931
- customPadding: null
9019
+ customPadding: DEFAULT_PADDING7
9020
+ // Default 16px horizontal padding, visible in editor
8932
9021
  };
8933
9022
  var DividerConfig = {
8934
9023
  label: "Divider",
@@ -8963,7 +9052,7 @@ var DividerConfig = {
8963
9052
  }
8964
9053
  const customColor = colorValueToCSS(color);
8965
9054
  const hrStyle = customColor ? { borderColor: customColor } : void 0;
8966
- return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: "px-4", style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsx(
9055
+ return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsx(
8967
9056
  "hr",
8968
9057
  {
8969
9058
  className: cn(
@@ -9078,9 +9167,9 @@ function AccordionRenderer({
9078
9167
  Object.assign(style, transformStyles);
9079
9168
  }
9080
9169
  if (!items || items.length === 0) {
9081
- return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: accordionClasses, style: accordionStyle, children: /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-muted-foreground", children: "No accordion items. Add items in the editor." }) }) }) });
9170
+ return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: accordionClasses, style: accordionStyle, children: /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-muted-foreground", children: "No accordion items. Add items in the editor." }) }) }) });
9082
9171
  }
9083
- return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: accordionClasses, style: accordionStyle, children: items.map((item, index) => /* @__PURE__ */ jsx(
9172
+ return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: accordionClasses, style: accordionStyle, children: items.map((item, index) => /* @__PURE__ */ jsx(
9084
9173
  AccordionItem,
9085
9174
  {
9086
9175
  item,
@@ -9091,6 +9180,14 @@ function AccordionRenderer({
9091
9180
  index
9092
9181
  )) }) }) });
9093
9182
  }
9183
+ var DEFAULT_PADDING8 = {
9184
+ top: 0,
9185
+ right: 16,
9186
+ bottom: 0,
9187
+ left: 16,
9188
+ unit: "px",
9189
+ linked: false
9190
+ };
9094
9191
  var defaultProps14 = {
9095
9192
  items: [
9096
9193
  {
@@ -9111,7 +9208,8 @@ var defaultProps14 = {
9111
9208
  dimensions: null,
9112
9209
  transform: null,
9113
9210
  animation: null,
9114
- customPadding: null
9211
+ customPadding: DEFAULT_PADDING8
9212
+ // Default 16px horizontal padding, visible in editor
9115
9213
  };
9116
9214
  var AccordionConfig = {
9117
9215
  label: "Accordion",