@delmaredigital/payload-puck 0.1.3 → 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.
@@ -575,25 +575,23 @@ function responsiveValueToCSS(value, converter, uniqueId) {
575
575
  mediaQueryCSS: ""
576
576
  };
577
577
  }
578
- const mediaQueries = [];
579
- let baseStyles = {};
578
+ const cssRules = [];
580
579
  BREAKPOINTS.forEach((bp) => {
581
580
  const bpValue = value[bp.key];
582
581
  if (bpValue === void 0) return;
583
582
  const cssProps = converter(bpValue);
584
583
  if (!cssProps) return;
584
+ const styleString = cssPropertiesToString(cssProps);
585
+ if (!styleString) return;
585
586
  if (bp.key === "xs") {
586
- baseStyles = cssProps;
587
+ cssRules.push(`.${uniqueId} { ${styleString} }`);
587
588
  } else {
588
- const styleString = cssPropertiesToString(cssProps);
589
- if (styleString) {
590
- mediaQueries.push(
591
- `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
592
- );
593
- }
589
+ cssRules.push(
590
+ `@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
591
+ );
594
592
  }
595
593
  });
596
- return { baseStyles, mediaQueryCSS: mediaQueries.join("\n") };
594
+ return { baseStyles: {}, mediaQueryCSS: cssRules.join("\n") };
597
595
  }
598
596
  var DEFAULT_VISIBILITY = {
599
597
  xs: true,
@@ -1973,12 +1971,12 @@ var Checkbox = React6__namespace.forwardRef(
1973
1971
  );
1974
1972
  Checkbox.displayName = "Checkbox";
1975
1973
  var DEFAULT_VALUE3 = {
1976
- mode: "contained",
1974
+ mode: "full",
1977
1975
  alignment: "center",
1978
1976
  maxWidth: {
1979
- value: 1200,
1977
+ value: 0,
1980
1978
  unit: "px",
1981
- enabled: true
1979
+ enabled: false
1982
1980
  },
1983
1981
  advancedMode: false
1984
1982
  };
@@ -2205,11 +2203,13 @@ function DimensionsFieldInner({
2205
2203
  const handleAdvancedToggle = React6.useCallback(() => {
2206
2204
  const newAdvancedMode = !advancedMode;
2207
2205
  setAdvancedMode(newAdvancedMode);
2208
- onChange({
2209
- ...currentValue,
2210
- advancedMode: newAdvancedMode
2211
- });
2212
- }, [advancedMode, currentValue, onChange]);
2206
+ if (value !== null) {
2207
+ onChange({
2208
+ ...currentValue,
2209
+ advancedMode: newAdvancedMode
2210
+ });
2211
+ }
2212
+ }, [advancedMode, currentValue, onChange, value]);
2213
2213
  const modeConfig = [
2214
2214
  { mode: "full", icon: lucideReact.MoveHorizontal, label: "Full", title: "Full width (100%)" },
2215
2215
  { mode: "contained", icon: lucideReact.Square, label: "Contain", title: "Contained (centered with max-width)" },
@@ -4747,7 +4747,7 @@ function ResponsiveFieldInner({
4747
4747
  }) {
4748
4748
  const [activeBreakpoint, setActiveBreakpoint] = React6.useState("xs");
4749
4749
  const getCurrentValue = React6.useCallback(() => {
4750
- if (!value) return defaultValue ?? null;
4750
+ if (!value) return null;
4751
4751
  if (activeBreakpoint === "xs") {
4752
4752
  return value.xs ?? defaultValue ?? null;
4753
4753
  }
@@ -4769,21 +4769,35 @@ function ResponsiveFieldInner({
4769
4769
  const hasOverride = React6.useCallback(
4770
4770
  (breakpoint) => {
4771
4771
  if (!value) return false;
4772
- if (breakpoint === "xs") return value.xs !== void 0;
4772
+ if (breakpoint === "xs") return false;
4773
4773
  return value[breakpoint] !== void 0;
4774
4774
  },
4775
4775
  [value]
4776
4776
  );
4777
+ const getInheritanceSource = React6.useCallback(() => {
4778
+ if (!value || activeBreakpoint === "xs") return null;
4779
+ if (value[activeBreakpoint] !== void 0) return null;
4780
+ const breakpointOrder = ["xl", "lg", "md", "sm", "xs"];
4781
+ const activeIndex = breakpointOrder.indexOf(activeBreakpoint);
4782
+ for (let i = activeIndex + 1; i < breakpointOrder.length; i++) {
4783
+ const bp = breakpointOrder[i];
4784
+ if (value[bp] !== void 0) {
4785
+ return bp;
4786
+ }
4787
+ }
4788
+ return null;
4789
+ }, [value, activeBreakpoint]);
4777
4790
  const handleInnerChange = React6.useCallback(
4778
4791
  (newValue) => {
4779
4792
  if (activeBreakpoint === "xs") {
4780
- if (newValue === null && defaultValue !== void 0) {
4781
- onChange({ ...value, xs: defaultValue });
4782
- } else if (newValue !== null) {
4793
+ if (newValue === null) {
4794
+ onChange(null);
4795
+ } else {
4783
4796
  onChange({ ...value, xs: newValue });
4784
4797
  }
4785
4798
  } else {
4786
4799
  if (newValue === null) {
4800
+ if (!value) return;
4787
4801
  const newResponsive = { ...value };
4788
4802
  delete newResponsive[activeBreakpoint];
4789
4803
  onChange(newResponsive);
@@ -4812,6 +4826,7 @@ function ResponsiveFieldInner({
4812
4826
  const currentValue = getCurrentValue();
4813
4827
  const isOverrideBreakpoint = activeBreakpoint !== "xs";
4814
4828
  const currentHasOverride = hasOverride(activeBreakpoint);
4829
+ const inheritanceSource = getInheritanceSource();
4815
4830
  const overrideCount = value ? ["sm", "md", "lg", "xl"].filter((bp) => value[bp] !== void 0).length : 0;
4816
4831
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "puck-field space-y-3", children: [
4817
4832
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -4853,7 +4868,11 @@ function ResponsiveFieldInner({
4853
4868
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: activeBreakpoint === "xs" ? "Extra small screens (0-639px)" : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4854
4869
  BREAKPOINTS.find((bp) => bp.key === activeBreakpoint)?.minWidth,
4855
4870
  "px and up",
4856
- !currentHasOverride && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: " (inheriting from xs)" })
4871
+ !currentHasOverride && inheritanceSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground/60", children: [
4872
+ " (inheriting from ",
4873
+ inheritanceSource.toUpperCase(),
4874
+ ")"
4875
+ ] })
4857
4876
  ] }) }),
4858
4877
  isOverrideBreakpoint && currentHasOverride && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
4859
4878
  Button,
@@ -5005,11 +5024,6 @@ function createResponsiveVisibilityField(config = {}) {
5005
5024
  )
5006
5025
  };
5007
5026
  }
5008
- var DEFAULT_DIMENSIONS = {
5009
- mode: "contained",
5010
- alignment: "center",
5011
- maxWidth: { value: 1200, unit: "px", enabled: true }
5012
- };
5013
5027
  var DEFAULT_PADDING = {
5014
5028
  top: 0,
5015
5029
  right: 0,
@@ -5018,18 +5032,20 @@ var DEFAULT_PADDING = {
5018
5032
  unit: "px",
5019
5033
  linked: true
5020
5034
  };
5035
+ var DEFAULT_DIMENSIONS = {
5036
+ mode: "full",
5037
+ alignment: "center",
5038
+ maxWidth: { value: 100, unit: "%", enabled: true }
5039
+ };
5021
5040
  var defaultProps = {
5022
5041
  content: [],
5023
- background: null,
5024
- customPadding: null,
5042
+ visibility: null,
5025
5043
  dimensions: null,
5044
+ background: null,
5026
5045
  border: null,
5046
+ padding: null,
5027
5047
  margin: null,
5028
- animation: null,
5029
- innerBackground: null,
5030
- innerPadding: null,
5031
- innerBorder: null,
5032
- visibility: null
5048
+ animation: null
5033
5049
  };
5034
5050
  var ContainerConfig = {
5035
5051
  label: "Container",
@@ -5038,119 +5054,113 @@ var ContainerConfig = {
5038
5054
  content: {
5039
5055
  type: "slot"
5040
5056
  },
5041
- // Responsive visibility control
5057
+ // Visibility first
5042
5058
  visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5043
- // Outer (section-level) options
5044
- background: createBackgroundField({ label: "Outer Background" }),
5045
- border: createBorderField({ label: "Outer Border" }),
5046
- // Responsive dimensions field
5059
+ // Dimensions
5047
5060
  dimensions: createResponsiveField({
5048
- label: "Dimensions (Responsive)",
5061
+ label: "Dimensions",
5049
5062
  innerField: (config) => createDimensionsField(config),
5050
5063
  defaultValue: DEFAULT_DIMENSIONS
5051
5064
  }),
5052
- animation: createAnimationField({ label: "Animation" }),
5053
- // Inner (content container) options
5054
- innerBackground: createBackgroundField({ label: "Inner Background" }),
5055
- innerBorder: createBorderField({ label: "Inner Border" }),
5056
- // Responsive inner padding
5057
- innerPadding: createResponsiveField({
5058
- label: "Inner Padding (Responsive)",
5065
+ // Styling
5066
+ background: createBackgroundField({ label: "Background" }),
5067
+ border: createBorderField({ label: "Border" }),
5068
+ // Spacing
5069
+ padding: createResponsiveField({
5070
+ label: "Padding",
5059
5071
  innerField: (config) => createPaddingField(config),
5060
5072
  defaultValue: DEFAULT_PADDING
5061
5073
  }),
5062
- // Spacing (grouped at bottom) - Responsive
5063
5074
  margin: createResponsiveField({
5064
- label: "Margin (Responsive)",
5075
+ label: "Margin",
5065
5076
  innerField: (config) => createMarginField(config),
5066
5077
  defaultValue: DEFAULT_PADDING
5067
5078
  }),
5068
- customPadding: createResponsiveField({
5069
- label: "Outer Padding (Responsive)",
5070
- innerField: (config) => createPaddingField(config),
5071
- defaultValue: DEFAULT_PADDING
5072
- })
5079
+ // Animation
5080
+ animation: createAnimationField({ label: "Animation" })
5073
5081
  },
5074
5082
  defaultProps,
5075
5083
  render: ({
5076
5084
  content: Content3,
5077
- background,
5078
- customPadding,
5085
+ visibility,
5079
5086
  dimensions,
5087
+ background,
5080
5088
  border,
5089
+ padding,
5081
5090
  margin,
5082
- animation,
5083
- innerBackground,
5084
- innerPadding,
5085
- innerBorder,
5086
- visibility
5091
+ animation
5087
5092
  }) => {
5088
5093
  const uniqueId = React6.useId().replace(/:/g, "");
5089
- const outerClass = `puck-container-outer-${uniqueId}`;
5090
- const innerClass = `puck-container-inner-${uniqueId}`;
5094
+ const containerClass = `puck-container-${uniqueId}`;
5091
5095
  const mediaQueries = [];
5092
- const outerBackgroundStyles = backgroundValueToCSS(background);
5093
- const outerStyles = {
5094
- ...outerBackgroundStyles
5095
- };
5096
- const outerPaddingResult = responsiveValueToCSS(
5097
- customPadding,
5098
- (v) => ({ padding: paddingValueToCSS(v) }),
5099
- outerClass
5100
- );
5101
- Object.assign(outerStyles, outerPaddingResult.baseStyles);
5102
- if (outerPaddingResult.mediaQueryCSS) {
5103
- mediaQueries.push(outerPaddingResult.mediaQueryCSS);
5104
- }
5105
- const outerBorderStyles = borderValueToCSS(border);
5106
- if (outerBorderStyles) {
5107
- Object.assign(outerStyles, outerBorderStyles);
5096
+ const containerStyles = {};
5097
+ const backgroundStyles = backgroundValueToCSS(background);
5098
+ if (backgroundStyles) {
5099
+ Object.assign(containerStyles, backgroundStyles);
5108
5100
  }
5109
- const marginResult = responsiveValueToCSS(
5110
- margin,
5111
- (v) => ({ margin: marginValueToCSS(v) }),
5112
- outerClass
5113
- );
5114
- Object.assign(outerStyles, marginResult.baseStyles);
5115
- if (marginResult.mediaQueryCSS) {
5116
- mediaQueries.push(marginResult.mediaQueryCSS);
5101
+ const borderStyles = borderValueToCSS(border);
5102
+ if (borderStyles) {
5103
+ Object.assign(containerStyles, borderStyles);
5117
5104
  }
5118
- const innerBackgroundStyles = backgroundValueToCSS(innerBackground);
5119
- const innerStyles = {
5120
- ...innerBackgroundStyles
5121
- };
5122
5105
  const dimensionsResult = responsiveValueToCSS(
5123
5106
  dimensions,
5124
5107
  dimensionsValueToCSS,
5125
- innerClass
5108
+ containerClass
5126
5109
  );
5127
- Object.assign(innerStyles, dimensionsResult.baseStyles);
5110
+ Object.assign(containerStyles, dimensionsResult.baseStyles);
5128
5111
  if (dimensionsResult.mediaQueryCSS) {
5129
5112
  mediaQueries.push(dimensionsResult.mediaQueryCSS);
5130
5113
  }
5131
- const innerPaddingResult = responsiveValueToCSS(
5132
- innerPadding,
5114
+ const hasMinHeight = (() => {
5115
+ if (!dimensions) return false;
5116
+ if (typeof dimensions === "object" && "xs" in dimensions) {
5117
+ const responsiveDims = dimensions;
5118
+ return Object.values(responsiveDims).some((v) => {
5119
+ if (!v || typeof v !== "object") return false;
5120
+ const dim2 = v;
5121
+ return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
5122
+ });
5123
+ }
5124
+ const dim = dimensions;
5125
+ return dim.minHeight?.enabled && dim.minHeight?.value > 0;
5126
+ })();
5127
+ if (hasMinHeight) {
5128
+ containerStyles.display = "flex";
5129
+ containerStyles.flexDirection = "column";
5130
+ }
5131
+ const paddingResult = responsiveValueToCSS(
5132
+ padding,
5133
5133
  (v) => ({ padding: paddingValueToCSS(v) }),
5134
- innerClass
5134
+ containerClass
5135
5135
  );
5136
- Object.assign(innerStyles, innerPaddingResult.baseStyles);
5137
- if (innerPaddingResult.mediaQueryCSS) {
5138
- mediaQueries.push(innerPaddingResult.mediaQueryCSS);
5136
+ Object.assign(containerStyles, paddingResult.baseStyles);
5137
+ if (paddingResult.mediaQueryCSS) {
5138
+ mediaQueries.push(paddingResult.mediaQueryCSS);
5139
5139
  }
5140
- const innerBorderStyles = borderValueToCSS(innerBorder);
5141
- if (innerBorderStyles) {
5142
- Object.assign(innerStyles, innerBorderStyles);
5140
+ const marginResult = responsiveValueToCSS(
5141
+ margin,
5142
+ (v) => ({ margin: marginValueToCSS(v) }),
5143
+ containerClass
5144
+ );
5145
+ Object.assign(containerStyles, marginResult.baseStyles);
5146
+ if (marginResult.mediaQueryCSS) {
5147
+ mediaQueries.push(marginResult.mediaQueryCSS);
5143
5148
  }
5144
- const visibilityCSS = visibilityValueToCSS(visibility, outerClass);
5149
+ const visibilityCSS = visibilityValueToCSS(visibility, containerClass);
5145
5150
  if (visibilityCSS) {
5146
5151
  mediaQueries.push(visibilityCSS);
5147
5152
  }
5148
- const contentClasses = cn("px-4", innerClass);
5149
- const hasInnerStyles = Object.keys(innerStyles).length > 0;
5150
5153
  const allMediaQueryCSS = mediaQueries.join("\n");
5154
+ const hasStyles = Object.keys(containerStyles).length > 0;
5155
+ const renderContent = () => {
5156
+ if (hasMinHeight) {
5157
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(Content3, { style: { flex: 1 } }) });
5158
+ }
5159
+ return /* @__PURE__ */ jsxRuntime.jsx(Content3, {});
5160
+ };
5151
5161
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
5152
5162
  allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
5153
- /* @__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 }) })
5163
+ hasStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClass, style: containerStyles, children: renderContent() }) : /* @__PURE__ */ jsxRuntime.jsx(Content3, { className: containerClass })
5154
5164
  ] });
5155
5165
  }
5156
5166
  };
@@ -5645,20 +5655,33 @@ var DEFAULT_PADDING4 = {
5645
5655
  unit: "px",
5646
5656
  linked: true
5647
5657
  };
5648
- var DEFAULT_DIMENSIONS4 = {
5649
- mode: "full",
5658
+ var DEFAULT_CONTENT_DIMENSIONS = {
5659
+ mode: "contained",
5650
5660
  alignment: "center",
5651
- maxWidth: { value: 100, unit: "%", enabled: true }
5661
+ maxWidth: { value: 1200, unit: "px", enabled: true }
5662
+ };
5663
+ var DEFAULT_CONTENT_PADDING = {
5664
+ top: 0,
5665
+ right: 16,
5666
+ bottom: 0,
5667
+ left: 16,
5668
+ unit: "px",
5669
+ linked: false
5652
5670
  };
5653
5671
  var defaultProps4 = {
5654
5672
  id: "",
5655
5673
  content: [],
5656
- background: null,
5657
- fullWidth: false,
5658
- customPadding: null,
5659
- dimensions: null,
5660
- border: null,
5661
- margin: null,
5674
+ // Section layer defaults
5675
+ sectionBackground: null,
5676
+ sectionBorder: null,
5677
+ sectionPadding: null,
5678
+ sectionMargin: null,
5679
+ // Content layer defaults - 1200px max-width so two-layer design is immediately visible
5680
+ contentDimensions: { xs: DEFAULT_CONTENT_DIMENSIONS },
5681
+ contentBackground: null,
5682
+ contentBorder: null,
5683
+ contentPadding: { xs: DEFAULT_CONTENT_PADDING },
5684
+ // Other
5662
5685
  animation: null,
5663
5686
  visibility: null
5664
5687
  };
@@ -5666,6 +5689,9 @@ var SectionConfig = {
5666
5689
  label: "Section",
5667
5690
  fields: {
5668
5691
  _reset: createResetField({ defaultProps: defaultProps4 }),
5692
+ // Visibility first
5693
+ visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5694
+ // Section ID for anchors
5669
5695
  id: {
5670
5696
  type: "text",
5671
5697
  label: "Section ID"
@@ -5673,49 +5699,47 @@ var SectionConfig = {
5673
5699
  content: {
5674
5700
  type: "slot"
5675
5701
  },
5676
- // Responsive visibility control
5677
- visibility: createResponsiveVisibilityField({ label: "Visibility" }),
5678
- fullWidth: {
5679
- type: "radio",
5680
- label: "Full Width Content",
5681
- options: [
5682
- { label: "Yes", value: true },
5683
- { label: "No", value: false }
5684
- ]
5685
- },
5686
- // Background
5687
- background: createBackgroundField({ label: "Background" }),
5688
- // Advanced custom options
5689
- border: createBorderField({ label: "Border" }),
5690
- // Responsive dimensions
5691
- dimensions: createResponsiveField({
5692
- label: "Dimensions (Responsive)",
5693
- innerField: (config) => createDimensionsField(config),
5694
- defaultValue: DEFAULT_DIMENSIONS4
5702
+ // Section layer (outer)
5703
+ sectionBackground: createBackgroundField({ label: "Section Background" }),
5704
+ sectionBorder: createBorderField({ label: "Section Border" }),
5705
+ sectionPadding: createResponsiveField({
5706
+ label: "Section Padding",
5707
+ innerField: (config) => createPaddingField(config),
5708
+ defaultValue: DEFAULT_PADDING4
5695
5709
  }),
5696
- animation: createAnimationField({ label: "Animation" }),
5697
- // Spacing (grouped at bottom) - Responsive
5698
- margin: createResponsiveField({
5699
- label: "Margin (Responsive)",
5710
+ sectionMargin: createResponsiveField({
5711
+ label: "Section Margin",
5700
5712
  innerField: (config) => createMarginField(config),
5701
5713
  defaultValue: DEFAULT_PADDING4
5702
5714
  }),
5703
- customPadding: createResponsiveField({
5704
- label: "Padding (Responsive)",
5715
+ // Content layer (inner)
5716
+ contentDimensions: createResponsiveField({
5717
+ label: "Content Dimensions",
5718
+ innerField: (config) => createDimensionsField(config),
5719
+ defaultValue: DEFAULT_CONTENT_DIMENSIONS
5720
+ }),
5721
+ contentBackground: createBackgroundField({ label: "Content Background" }),
5722
+ contentBorder: createBorderField({ label: "Content Border" }),
5723
+ contentPadding: createResponsiveField({
5724
+ label: "Content Padding",
5705
5725
  innerField: (config) => createPaddingField(config),
5706
5726
  defaultValue: DEFAULT_PADDING4
5707
- })
5727
+ }),
5728
+ // Animation
5729
+ animation: createAnimationField({ label: "Animation" })
5708
5730
  },
5709
5731
  defaultProps: defaultProps4,
5710
5732
  render: ({
5711
5733
  id,
5712
5734
  content: Content3,
5713
- background,
5714
- fullWidth,
5715
- customPadding,
5716
- dimensions,
5717
- border,
5718
- margin,
5735
+ sectionBackground,
5736
+ sectionBorder,
5737
+ sectionPadding,
5738
+ sectionMargin,
5739
+ contentDimensions,
5740
+ contentBackground,
5741
+ contentBorder,
5742
+ contentPadding,
5719
5743
  animation,
5720
5744
  visibility
5721
5745
  }) => {
@@ -5723,52 +5747,89 @@ var SectionConfig = {
5723
5747
  const sectionClass = `puck-section-${uniqueId}`;
5724
5748
  const contentClass = `puck-section-content-${uniqueId}`;
5725
5749
  const mediaQueries = [];
5726
- const backgroundStyles = backgroundValueToCSS(background);
5750
+ const sectionBackgroundStyles = backgroundValueToCSS(sectionBackground);
5727
5751
  const sectionStyles = {
5728
- ...backgroundStyles
5752
+ ...sectionBackgroundStyles
5729
5753
  };
5730
- const paddingResult = responsiveValueToCSS(
5731
- customPadding,
5754
+ const sectionBorderStyles = borderValueToCSS(sectionBorder);
5755
+ if (sectionBorderStyles) {
5756
+ Object.assign(sectionStyles, sectionBorderStyles);
5757
+ }
5758
+ const sectionPaddingResult = responsiveValueToCSS(
5759
+ sectionPadding,
5732
5760
  (v) => ({ padding: paddingValueToCSS(v) }),
5733
5761
  sectionClass
5734
5762
  );
5735
- Object.assign(sectionStyles, paddingResult.baseStyles);
5736
- if (paddingResult.mediaQueryCSS) {
5737
- mediaQueries.push(paddingResult.mediaQueryCSS);
5738
- }
5739
- const borderStyles = borderValueToCSS(border);
5740
- if (borderStyles) {
5741
- Object.assign(sectionStyles, borderStyles);
5763
+ Object.assign(sectionStyles, sectionPaddingResult.baseStyles);
5764
+ if (sectionPaddingResult.mediaQueryCSS) {
5765
+ mediaQueries.push(sectionPaddingResult.mediaQueryCSS);
5742
5766
  }
5743
- const marginResult = responsiveValueToCSS(
5744
- margin,
5767
+ const sectionMarginResult = responsiveValueToCSS(
5768
+ sectionMargin,
5745
5769
  (v) => ({ margin: marginValueToCSS(v) }),
5746
5770
  sectionClass
5747
5771
  );
5748
- Object.assign(sectionStyles, marginResult.baseStyles);
5749
- if (marginResult.mediaQueryCSS) {
5750
- mediaQueries.push(marginResult.mediaQueryCSS);
5772
+ Object.assign(sectionStyles, sectionMarginResult.baseStyles);
5773
+ if (sectionMarginResult.mediaQueryCSS) {
5774
+ mediaQueries.push(sectionMarginResult.mediaQueryCSS);
5751
5775
  }
5752
5776
  const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
5753
5777
  if (visibilityCSS) {
5754
5778
  mediaQueries.push(visibilityCSS);
5755
5779
  }
5756
- const sectionClasses = cn("relative w-full", sectionClass);
5757
- const dimensionsResult = responsiveValueToCSS(
5758
- dimensions,
5780
+ const contentBackgroundStyles = backgroundValueToCSS(contentBackground);
5781
+ const contentStyles = {
5782
+ ...contentBackgroundStyles
5783
+ };
5784
+ const contentDimensionsResult = responsiveValueToCSS(
5785
+ contentDimensions,
5759
5786
  dimensionsValueToCSS,
5760
5787
  contentClass
5761
5788
  );
5762
- if (dimensionsResult.mediaQueryCSS) {
5763
- mediaQueries.push(dimensionsResult.mediaQueryCSS);
5764
- }
5765
- const contentClasses = cn(
5766
- "relative z-10",
5767
- // Only apply preset content width if no dimensions set
5768
- !dimensions && !fullWidth && "max-w-[1200px] mx-auto px-4",
5789
+ Object.assign(contentStyles, contentDimensionsResult.baseStyles);
5790
+ if (contentDimensionsResult.mediaQueryCSS) {
5791
+ mediaQueries.push(contentDimensionsResult.mediaQueryCSS);
5792
+ }
5793
+ const hasMinHeight = (() => {
5794
+ if (!contentDimensions) return false;
5795
+ if (typeof contentDimensions === "object" && "xs" in contentDimensions) {
5796
+ const responsiveDims = contentDimensions;
5797
+ return Object.values(responsiveDims).some((v) => {
5798
+ if (!v || typeof v !== "object") return false;
5799
+ const dim2 = v;
5800
+ return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
5801
+ });
5802
+ }
5803
+ const dim = contentDimensions;
5804
+ return dim.minHeight?.enabled && dim.minHeight?.value > 0;
5805
+ })();
5806
+ if (hasMinHeight) {
5807
+ contentStyles.display = "flex";
5808
+ contentStyles.flexDirection = "column";
5809
+ }
5810
+ const contentBorderStyles = borderValueToCSS(contentBorder);
5811
+ if (contentBorderStyles) {
5812
+ Object.assign(contentStyles, contentBorderStyles);
5813
+ }
5814
+ const contentPaddingResult = responsiveValueToCSS(
5815
+ contentPadding,
5816
+ (v) => ({ padding: paddingValueToCSS(v) }),
5769
5817
  contentClass
5770
5818
  );
5819
+ Object.assign(contentStyles, contentPaddingResult.baseStyles);
5820
+ if (contentPaddingResult.mediaQueryCSS) {
5821
+ mediaQueries.push(contentPaddingResult.mediaQueryCSS);
5822
+ }
5823
+ const sectionClasses = cn("relative w-full", sectionClass);
5824
+ const contentClasses = cn("relative z-10", contentClass);
5825
+ const hasContentStyles = Object.keys(contentStyles).length > 0;
5771
5826
  const allMediaQueryCSS = mediaQueries.join("\n");
5827
+ const renderContent = () => {
5828
+ if (hasMinHeight) {
5829
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(Content3, { style: { flex: 1 } }) });
5830
+ }
5831
+ return /* @__PURE__ */ jsxRuntime.jsx(Content3, {});
5832
+ };
5772
5833
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
5773
5834
  allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
5774
5835
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -5777,7 +5838,7 @@ var SectionConfig = {
5777
5838
  id: id || void 0,
5778
5839
  className: sectionClasses,
5779
5840
  style: sectionStyles,
5780
- children: /* @__PURE__ */ jsxRuntime.jsx(Content3, { className: contentClasses, style: dimensionsResult.baseStyles })
5841
+ children: hasContentStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClasses, style: contentStyles, children: renderContent() }) : /* @__PURE__ */ jsxRuntime.jsx(Content3, { className: contentClasses })
5781
5842
  }
5782
5843
  )
5783
5844
  ] });
@@ -6271,7 +6332,7 @@ var DEFAULT_PADDING5 = {
6271
6332
  unit: "px",
6272
6333
  linked: true
6273
6334
  };
6274
- var DEFAULT_DIMENSIONS5 = {
6335
+ var DEFAULT_DIMENSIONS4 = {
6275
6336
  mode: "full",
6276
6337
  alignment: "center",
6277
6338
  maxWidth: { value: 100, unit: "%", enabled: true }
@@ -6298,7 +6359,7 @@ var TemplateConfig = {
6298
6359
  dimensions: createResponsiveField({
6299
6360
  label: "Dimensions (Responsive)",
6300
6361
  innerField: (config) => createDimensionsField(config),
6301
- defaultValue: DEFAULT_DIMENSIONS5
6362
+ defaultValue: DEFAULT_DIMENSIONS4
6302
6363
  }),
6303
6364
  // Spacing (grouped at bottom) - Responsive
6304
6365
  margin: createResponsiveField({
@@ -6627,6 +6688,14 @@ var TextConfig = {
6627
6688
  ) });
6628
6689
  }
6629
6690
  };
6691
+ var DEFAULT_PADDING6 = {
6692
+ top: 0,
6693
+ right: 16,
6694
+ bottom: 0,
6695
+ left: 16,
6696
+ unit: "px",
6697
+ linked: false
6698
+ };
6630
6699
  var defaultProps10 = {
6631
6700
  content: "<p>Enter your content here...</p>",
6632
6701
  alignment: null,
@@ -6634,7 +6703,8 @@ var defaultProps10 = {
6634
6703
  dimensions: null,
6635
6704
  animation: null,
6636
6705
  margin: null,
6637
- customPadding: null
6706
+ customPadding: DEFAULT_PADDING6
6707
+ // Default 16px horizontal padding, visible in editor
6638
6708
  };
6639
6709
  var RichTextConfig = {
6640
6710
  label: "Rich Text",
@@ -6673,12 +6743,12 @@ var RichTextConfig = {
6673
6743
  const alignmentValue = alignment ?? "left";
6674
6744
  const alignmentClass = alignmentMap[alignmentValue] || alignmentMap.left;
6675
6745
  if (!content || content === "<p></p>") {
6676
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "No content available" }) }) }) }) });
6746
+ return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert max-w-none", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "No content available" }) }) }) }) });
6677
6747
  }
6678
- return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
6748
+ return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
6679
6749
  "div",
6680
6750
  {
6681
- className: "prose dark:prose-invert",
6751
+ className: "prose dark:prose-invert max-w-none",
6682
6752
  dangerouslySetInnerHTML: { __html: content }
6683
6753
  }
6684
6754
  ) }) });
@@ -7836,7 +7906,7 @@ function RichTextRender({
7836
7906
  }
7837
7907
  return Object.keys(s).length > 0 ? s : void 0;
7838
7908
  }, [dimensions, margin, customPadding]);
7839
- return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "relative overflow-hidden", style, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert", dangerouslySetInnerHTML: { __html: content } }) });
7909
+ 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 } }) });
7840
7910
  }
7841
7911
  var RichTextEditorConfig = {
7842
7912
  label: "Rich Text",
@@ -8276,6 +8346,14 @@ function createTransformField(config) {
8276
8346
  )
8277
8347
  };
8278
8348
  }
8349
+ var DEFAULT_PADDING7 = {
8350
+ top: 16,
8351
+ right: 16,
8352
+ bottom: 16,
8353
+ left: 16,
8354
+ unit: "px",
8355
+ linked: true
8356
+ };
8279
8357
  var defaultProps12 = {
8280
8358
  image: null,
8281
8359
  alt: "",
@@ -8288,7 +8366,8 @@ var defaultProps12 = {
8288
8366
  alignment: null,
8289
8367
  transform: null,
8290
8368
  animation: null,
8291
- customPadding: null,
8369
+ customPadding: DEFAULT_PADDING7,
8370
+ // Default 16px padding, visible in editor
8292
8371
  visibility: null
8293
8372
  };
8294
8373
  var ImageConfig = {
@@ -8359,7 +8438,7 @@ var ImageConfig = {
8359
8438
  if (!image?.url) {
8360
8439
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
8361
8440
  visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
8362
- /* @__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(
8441
+ /* @__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(
8363
8442
  "div",
8364
8443
  {
8365
8444
  className: cn(
@@ -8398,7 +8477,7 @@ var ImageConfig = {
8398
8477
  ) : imageElement;
8399
8478
  return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper, { animation, children: [
8400
8479
  visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
8401
- /* @__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 }) })
8480
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: content }) })
8402
8481
  ] });
8403
8482
  }
8404
8483
  };
@@ -8746,6 +8825,14 @@ var ButtonConfig = {
8746
8825
  );
8747
8826
  }
8748
8827
  };
8828
+ var DEFAULT_CONTENT_PADDING2 = {
8829
+ top: 16,
8830
+ right: 16,
8831
+ bottom: 16,
8832
+ left: 16,
8833
+ unit: "px",
8834
+ linked: true
8835
+ };
8749
8836
  var defaultProps14 = {
8750
8837
  image: null,
8751
8838
  heading: "Card Heading",
@@ -8760,7 +8847,8 @@ var defaultProps14 = {
8760
8847
  alignment: null,
8761
8848
  transform: null,
8762
8849
  animation: null,
8763
- customPadding: null
8850
+ contentPadding: DEFAULT_CONTENT_PADDING2
8851
+ // Default 16px padding, visible in editor
8764
8852
  };
8765
8853
  var CardConfig = {
8766
8854
  label: "Card",
@@ -8804,10 +8892,10 @@ var CardConfig = {
8804
8892
  animation: createAnimationField({ label: "Animation" }),
8805
8893
  // Spacing (grouped at bottom)
8806
8894
  margin: createMarginField({ label: "Margin" }),
8807
- customPadding: createPaddingField({ label: "Padding" })
8895
+ contentPadding: createPaddingField({ label: "Content Padding" })
8808
8896
  },
8809
8897
  defaultProps: defaultProps14,
8810
- render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, customPadding }) => {
8898
+ render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, contentPadding }) => {
8811
8899
  const hasBorderRadius = border?.radius && border.radius > 0;
8812
8900
  const cardClasses = cn(
8813
8901
  "overflow-hidden transition-all bg-card",
@@ -8843,9 +8931,10 @@ var CardConfig = {
8843
8931
  if (borderStyles) {
8844
8932
  Object.assign(cardStyle, borderStyles);
8845
8933
  }
8846
- const paddingCSS = paddingValueToCSS(customPadding);
8847
- if (paddingCSS) {
8848
- cardStyle.padding = paddingCSS;
8934
+ const contentStyle = {};
8935
+ const contentPaddingCSS = paddingValueToCSS(contentPadding);
8936
+ if (contentPaddingCSS) {
8937
+ contentStyle.padding = contentPaddingCSS;
8849
8938
  }
8850
8939
  const cardContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardClasses, style: cardStyle, children: [
8851
8940
  image?.url ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -8856,7 +8945,7 @@ var CardConfig = {
8856
8945
  className: "w-full h-full object-cover"
8857
8946
  }
8858
8947
  ) }) : /* @__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" }) }),
8859
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
8948
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle, children: [
8860
8949
  heading && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
8861
8950
  text && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: text })
8862
8951
  ] })
@@ -8877,6 +8966,14 @@ var CardConfig = {
8877
8966
  return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: wrapperStyle, children: cardContent }) }) });
8878
8967
  }
8879
8968
  };
8969
+ var DEFAULT_PADDING8 = {
8970
+ top: 0,
8971
+ right: 16,
8972
+ bottom: 0,
8973
+ left: 16,
8974
+ unit: "px",
8975
+ linked: false
8976
+ };
8880
8977
  var defaultProps15 = {
8881
8978
  style: "solid",
8882
8979
  color: null,
@@ -8884,7 +8981,8 @@ var defaultProps15 = {
8884
8981
  dimensions: null,
8885
8982
  transform: null,
8886
8983
  animation: null,
8887
- customPadding: null
8984
+ customPadding: DEFAULT_PADDING8
8985
+ // Default 16px horizontal padding, visible in editor
8888
8986
  };
8889
8987
  var DividerConfig = {
8890
8988
  label: "Divider",
@@ -8919,7 +9017,7 @@ var DividerConfig = {
8919
9017
  }
8920
9018
  const customColor = colorValueToCSS(color);
8921
9019
  const hrStyle = customColor ? { borderColor: customColor } : void 0;
8922
- 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(
9020
+ return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
8923
9021
  "hr",
8924
9022
  {
8925
9023
  className: cn(
@@ -9034,9 +9132,9 @@ function AccordionRenderer({
9034
9132
  Object.assign(style, transformStyles);
9035
9133
  }
9036
9134
  if (!items || items.length === 0) {
9037
- 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." }) }) }) });
9135
+ 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." }) }) }) });
9038
9136
  }
9039
- 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(
9137
+ 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(
9040
9138
  AccordionItem,
9041
9139
  {
9042
9140
  item,
@@ -9047,6 +9145,14 @@ function AccordionRenderer({
9047
9145
  index
9048
9146
  )) }) }) });
9049
9147
  }
9148
+ var DEFAULT_PADDING9 = {
9149
+ top: 0,
9150
+ right: 16,
9151
+ bottom: 0,
9152
+ left: 16,
9153
+ unit: "px",
9154
+ linked: false
9155
+ };
9050
9156
  var defaultProps16 = {
9051
9157
  items: [
9052
9158
  {
@@ -9067,7 +9173,8 @@ var defaultProps16 = {
9067
9173
  dimensions: null,
9068
9174
  transform: null,
9069
9175
  animation: null,
9070
- customPadding: null
9176
+ customPadding: DEFAULT_PADDING9
9177
+ // Default 16px horizontal padding, visible in editor
9071
9178
  };
9072
9179
  var AccordionConfig = {
9073
9180
  label: "Accordion",