@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.
- package/README.md +77 -0
- package/dist/AccordionClient.d.mts +1 -1
- package/dist/AccordionClient.d.ts +1 -1
- package/dist/AccordionClient.js +2 -2
- package/dist/AccordionClient.mjs +2 -2
- package/dist/AnimatedWrapper.d.mts +1 -1
- package/dist/AnimatedWrapper.d.ts +1 -1
- package/dist/components/index.d.mts +15 -18
- package/dist/components/index.d.ts +15 -18
- package/dist/components/index.js +305 -198
- package/dist/components/index.mjs +305 -198
- package/dist/config/config.editor.d.mts +1 -1
- package/dist/config/config.editor.d.ts +1 -1
- package/dist/config/config.editor.js +292 -194
- package/dist/config/config.editor.mjs +292 -194
- package/dist/config/index.js +214 -123
- package/dist/config/index.mjs +214 -123
- package/dist/editor/index.js +221 -129
- package/dist/editor/index.mjs +221 -129
- package/dist/fields/index.d.mts +2 -2
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +43 -24
- package/dist/fields/index.mjs +43 -24
- package/dist/render/index.js +214 -123
- package/dist/render/index.mjs +214 -123
- package/dist/{shared-DeNKN95N.d.mts → shared-X9UpCJKW.d.mts} +3 -1
- package/dist/{shared-DeNKN95N.d.ts → shared-X9UpCJKW.d.ts} +3 -1
- package/package.json +3 -2
package/dist/render/index.mjs
CHANGED
|
@@ -485,25 +485,23 @@ function responsiveValueToCSS(value, converter, uniqueId) {
|
|
|
485
485
|
mediaQueryCSS: ""
|
|
486
486
|
};
|
|
487
487
|
}
|
|
488
|
-
const
|
|
489
|
-
let baseStyles = {};
|
|
488
|
+
const cssRules = [];
|
|
490
489
|
BREAKPOINTS.forEach((bp) => {
|
|
491
490
|
const bpValue = value[bp.key];
|
|
492
491
|
if (bpValue === void 0) return;
|
|
493
492
|
const cssProps = converter(bpValue);
|
|
494
493
|
if (!cssProps) return;
|
|
494
|
+
const styleString = cssPropertiesToString(cssProps);
|
|
495
|
+
if (!styleString) return;
|
|
495
496
|
if (bp.key === "xs") {
|
|
496
|
-
|
|
497
|
+
cssRules.push(`.${uniqueId} { ${styleString} }`);
|
|
497
498
|
} else {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
502
|
-
);
|
|
503
|
-
}
|
|
499
|
+
cssRules.push(
|
|
500
|
+
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
501
|
+
);
|
|
504
502
|
}
|
|
505
503
|
});
|
|
506
|
-
return { baseStyles, mediaQueryCSS:
|
|
504
|
+
return { baseStyles: {}, mediaQueryCSS: cssRules.join("\n") };
|
|
507
505
|
}
|
|
508
506
|
function visibilityValueToCSS(visibility, uniqueId) {
|
|
509
507
|
if (!visibility) return "";
|
|
@@ -670,16 +668,13 @@ function generateUniqueId() {
|
|
|
670
668
|
}
|
|
671
669
|
var defaultProps = {
|
|
672
670
|
content: [],
|
|
673
|
-
|
|
674
|
-
customPadding: null,
|
|
671
|
+
visibility: null,
|
|
675
672
|
dimensions: null,
|
|
673
|
+
background: null,
|
|
676
674
|
border: null,
|
|
675
|
+
padding: null,
|
|
677
676
|
margin: null,
|
|
678
|
-
animation: null
|
|
679
|
-
innerBackground: null,
|
|
680
|
-
innerPadding: null,
|
|
681
|
-
innerBorder: null,
|
|
682
|
-
visibility: null
|
|
677
|
+
animation: null
|
|
683
678
|
};
|
|
684
679
|
var ContainerConfig = {
|
|
685
680
|
label: "Container",
|
|
@@ -689,84 +684,86 @@ var ContainerConfig = {
|
|
|
689
684
|
defaultProps,
|
|
690
685
|
render: ({
|
|
691
686
|
content: Content,
|
|
692
|
-
|
|
693
|
-
customPadding,
|
|
687
|
+
visibility,
|
|
694
688
|
dimensions,
|
|
689
|
+
background,
|
|
695
690
|
border,
|
|
691
|
+
padding,
|
|
696
692
|
margin,
|
|
697
|
-
animation
|
|
698
|
-
innerBackground,
|
|
699
|
-
innerPadding,
|
|
700
|
-
innerBorder,
|
|
701
|
-
visibility
|
|
693
|
+
animation
|
|
702
694
|
}) => {
|
|
703
695
|
const uniqueId = generateUniqueId();
|
|
704
|
-
const
|
|
705
|
-
const innerClass = `puck-container-inner-${uniqueId}`;
|
|
696
|
+
const containerClass = `puck-container-${uniqueId}`;
|
|
706
697
|
const mediaQueries = [];
|
|
707
|
-
const
|
|
708
|
-
const
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
const outerPaddingResult = responsiveValueToCSS(
|
|
712
|
-
customPadding,
|
|
713
|
-
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
714
|
-
outerClass
|
|
715
|
-
);
|
|
716
|
-
Object.assign(outerStyles, outerPaddingResult.baseStyles);
|
|
717
|
-
if (outerPaddingResult.mediaQueryCSS) {
|
|
718
|
-
mediaQueries.push(outerPaddingResult.mediaQueryCSS);
|
|
719
|
-
}
|
|
720
|
-
const outerBorderStyles = borderValueToCSS(border);
|
|
721
|
-
if (outerBorderStyles) {
|
|
722
|
-
Object.assign(outerStyles, outerBorderStyles);
|
|
698
|
+
const containerStyles = {};
|
|
699
|
+
const backgroundStyles = backgroundValueToCSS(background);
|
|
700
|
+
if (backgroundStyles) {
|
|
701
|
+
Object.assign(containerStyles, backgroundStyles);
|
|
723
702
|
}
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
(
|
|
727
|
-
outerClass
|
|
728
|
-
);
|
|
729
|
-
Object.assign(outerStyles, marginResult.baseStyles);
|
|
730
|
-
if (marginResult.mediaQueryCSS) {
|
|
731
|
-
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
703
|
+
const borderStyles = borderValueToCSS(border);
|
|
704
|
+
if (borderStyles) {
|
|
705
|
+
Object.assign(containerStyles, borderStyles);
|
|
732
706
|
}
|
|
733
|
-
const innerBackgroundStyles = backgroundValueToCSS(innerBackground);
|
|
734
|
-
const innerStyles = {
|
|
735
|
-
...innerBackgroundStyles
|
|
736
|
-
};
|
|
737
707
|
const dimensionsResult = responsiveValueToCSS(
|
|
738
708
|
dimensions,
|
|
739
709
|
dimensionsValueToCSS,
|
|
740
|
-
|
|
710
|
+
containerClass
|
|
741
711
|
);
|
|
742
|
-
Object.assign(
|
|
712
|
+
Object.assign(containerStyles, dimensionsResult.baseStyles);
|
|
743
713
|
if (dimensionsResult.mediaQueryCSS) {
|
|
744
714
|
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
745
715
|
}
|
|
746
|
-
const
|
|
747
|
-
|
|
716
|
+
const hasMinHeight = (() => {
|
|
717
|
+
if (!dimensions) return false;
|
|
718
|
+
if (typeof dimensions === "object" && "xs" in dimensions) {
|
|
719
|
+
const responsiveDims = dimensions;
|
|
720
|
+
return Object.values(responsiveDims).some((v) => {
|
|
721
|
+
if (!v || typeof v !== "object") return false;
|
|
722
|
+
const dim2 = v;
|
|
723
|
+
return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
const dim = dimensions;
|
|
727
|
+
return dim.minHeight?.enabled && dim.minHeight?.value > 0;
|
|
728
|
+
})();
|
|
729
|
+
if (hasMinHeight) {
|
|
730
|
+
containerStyles.display = "flex";
|
|
731
|
+
containerStyles.flexDirection = "column";
|
|
732
|
+
}
|
|
733
|
+
const paddingResult = responsiveValueToCSS(
|
|
734
|
+
padding,
|
|
748
735
|
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
749
|
-
|
|
736
|
+
containerClass
|
|
750
737
|
);
|
|
751
|
-
Object.assign(
|
|
752
|
-
if (
|
|
753
|
-
mediaQueries.push(
|
|
738
|
+
Object.assign(containerStyles, paddingResult.baseStyles);
|
|
739
|
+
if (paddingResult.mediaQueryCSS) {
|
|
740
|
+
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
754
741
|
}
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
|
|
742
|
+
const marginResult = responsiveValueToCSS(
|
|
743
|
+
margin,
|
|
744
|
+
(v) => ({ margin: marginValueToCSS(v) }),
|
|
745
|
+
containerClass
|
|
746
|
+
);
|
|
747
|
+
Object.assign(containerStyles, marginResult.baseStyles);
|
|
748
|
+
if (marginResult.mediaQueryCSS) {
|
|
749
|
+
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
758
750
|
}
|
|
759
|
-
const visibilityCSS = visibilityValueToCSS(visibility,
|
|
751
|
+
const visibilityCSS = visibilityValueToCSS(visibility, containerClass);
|
|
760
752
|
if (visibilityCSS) {
|
|
761
753
|
mediaQueries.push(visibilityCSS);
|
|
762
754
|
}
|
|
763
|
-
const contentClasses = cn("px-4", innerClass);
|
|
764
|
-
const hasInnerStyles = Object.keys(innerStyles).length > 0;
|
|
765
755
|
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
756
|
+
const hasStyles = Object.keys(containerStyles).length > 0;
|
|
766
757
|
const ContentSlot = Content;
|
|
758
|
+
const renderContent = () => {
|
|
759
|
+
if (hasMinHeight) {
|
|
760
|
+
return /* @__PURE__ */ jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsx(ContentSlot, { style: { flex: 1 } }) });
|
|
761
|
+
}
|
|
762
|
+
return /* @__PURE__ */ jsx(ContentSlot, {});
|
|
763
|
+
};
|
|
767
764
|
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
768
765
|
allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
|
|
769
|
-
|
|
766
|
+
hasStyles ? /* @__PURE__ */ jsx("div", { className: containerClass, style: containerStyles, children: renderContent() }) : /* @__PURE__ */ jsx(ContentSlot, { className: containerClass })
|
|
770
767
|
] });
|
|
771
768
|
}
|
|
772
769
|
};
|
|
@@ -994,15 +991,33 @@ var idCounter4 = 0;
|
|
|
994
991
|
function generateUniqueId4() {
|
|
995
992
|
return `s${(++idCounter4).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
996
993
|
}
|
|
994
|
+
var DEFAULT_CONTENT_DIMENSIONS = {
|
|
995
|
+
mode: "contained",
|
|
996
|
+
alignment: "center",
|
|
997
|
+
maxWidth: { value: 1200, unit: "px", enabled: true }
|
|
998
|
+
};
|
|
999
|
+
var DEFAULT_CONTENT_PADDING = {
|
|
1000
|
+
top: 0,
|
|
1001
|
+
right: 16,
|
|
1002
|
+
bottom: 0,
|
|
1003
|
+
left: 16,
|
|
1004
|
+
unit: "px",
|
|
1005
|
+
linked: false
|
|
1006
|
+
};
|
|
997
1007
|
var defaultProps4 = {
|
|
998
1008
|
id: "",
|
|
999
1009
|
content: [],
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1010
|
+
// Section layer defaults
|
|
1011
|
+
sectionBackground: null,
|
|
1012
|
+
sectionBorder: null,
|
|
1013
|
+
sectionPadding: null,
|
|
1014
|
+
sectionMargin: null,
|
|
1015
|
+
// Content layer defaults - 1200px max-width so two-layer design is immediately visible
|
|
1016
|
+
contentDimensions: { xs: DEFAULT_CONTENT_DIMENSIONS },
|
|
1017
|
+
contentBackground: null,
|
|
1018
|
+
contentBorder: null,
|
|
1019
|
+
contentPadding: { xs: DEFAULT_CONTENT_PADDING },
|
|
1020
|
+
// Other
|
|
1006
1021
|
animation: null,
|
|
1007
1022
|
visibility: null
|
|
1008
1023
|
};
|
|
@@ -1015,12 +1030,14 @@ var SectionConfig = {
|
|
|
1015
1030
|
render: ({
|
|
1016
1031
|
id,
|
|
1017
1032
|
content: Content,
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1033
|
+
sectionBackground,
|
|
1034
|
+
sectionBorder,
|
|
1035
|
+
sectionPadding,
|
|
1036
|
+
sectionMargin,
|
|
1037
|
+
contentDimensions,
|
|
1038
|
+
contentBackground,
|
|
1039
|
+
contentBorder,
|
|
1040
|
+
contentPadding,
|
|
1024
1041
|
animation,
|
|
1025
1042
|
visibility
|
|
1026
1043
|
}) => {
|
|
@@ -1028,53 +1045,90 @@ var SectionConfig = {
|
|
|
1028
1045
|
const sectionClass = `puck-section-${uniqueId}`;
|
|
1029
1046
|
const contentClass = `puck-section-content-${uniqueId}`;
|
|
1030
1047
|
const mediaQueries = [];
|
|
1031
|
-
const
|
|
1048
|
+
const sectionBackgroundStyles = backgroundValueToCSS(sectionBackground);
|
|
1032
1049
|
const sectionStyles = {
|
|
1033
|
-
...
|
|
1050
|
+
...sectionBackgroundStyles
|
|
1034
1051
|
};
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1052
|
+
const sectionBorderStyles = borderValueToCSS(sectionBorder);
|
|
1053
|
+
if (sectionBorderStyles) {
|
|
1054
|
+
Object.assign(sectionStyles, sectionBorderStyles);
|
|
1055
|
+
}
|
|
1056
|
+
const sectionPaddingResult = responsiveValueToCSS(
|
|
1057
|
+
sectionPadding,
|
|
1037
1058
|
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
1038
1059
|
sectionClass
|
|
1039
1060
|
);
|
|
1040
|
-
Object.assign(sectionStyles,
|
|
1041
|
-
if (
|
|
1042
|
-
mediaQueries.push(
|
|
1043
|
-
}
|
|
1044
|
-
const borderStyles = borderValueToCSS(border);
|
|
1045
|
-
if (borderStyles) {
|
|
1046
|
-
Object.assign(sectionStyles, borderStyles);
|
|
1061
|
+
Object.assign(sectionStyles, sectionPaddingResult.baseStyles);
|
|
1062
|
+
if (sectionPaddingResult.mediaQueryCSS) {
|
|
1063
|
+
mediaQueries.push(sectionPaddingResult.mediaQueryCSS);
|
|
1047
1064
|
}
|
|
1048
|
-
const
|
|
1049
|
-
|
|
1065
|
+
const sectionMarginResult = responsiveValueToCSS(
|
|
1066
|
+
sectionMargin,
|
|
1050
1067
|
(v) => ({ margin: marginValueToCSS(v) }),
|
|
1051
1068
|
sectionClass
|
|
1052
1069
|
);
|
|
1053
|
-
Object.assign(sectionStyles,
|
|
1054
|
-
if (
|
|
1055
|
-
mediaQueries.push(
|
|
1070
|
+
Object.assign(sectionStyles, sectionMarginResult.baseStyles);
|
|
1071
|
+
if (sectionMarginResult.mediaQueryCSS) {
|
|
1072
|
+
mediaQueries.push(sectionMarginResult.mediaQueryCSS);
|
|
1056
1073
|
}
|
|
1057
1074
|
const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
|
|
1058
1075
|
if (visibilityCSS) {
|
|
1059
1076
|
mediaQueries.push(visibilityCSS);
|
|
1060
1077
|
}
|
|
1061
|
-
const
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1078
|
+
const contentBackgroundStyles = backgroundValueToCSS(contentBackground);
|
|
1079
|
+
const contentStyles = {
|
|
1080
|
+
...contentBackgroundStyles
|
|
1081
|
+
};
|
|
1082
|
+
const contentDimensionsResult = responsiveValueToCSS(
|
|
1083
|
+
contentDimensions,
|
|
1064
1084
|
dimensionsValueToCSS,
|
|
1065
1085
|
contentClass
|
|
1066
1086
|
);
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1087
|
+
Object.assign(contentStyles, contentDimensionsResult.baseStyles);
|
|
1088
|
+
if (contentDimensionsResult.mediaQueryCSS) {
|
|
1089
|
+
mediaQueries.push(contentDimensionsResult.mediaQueryCSS);
|
|
1090
|
+
}
|
|
1091
|
+
const hasMinHeight = (() => {
|
|
1092
|
+
if (!contentDimensions) return false;
|
|
1093
|
+
if (typeof contentDimensions === "object" && "xs" in contentDimensions) {
|
|
1094
|
+
const responsiveDims = contentDimensions;
|
|
1095
|
+
return Object.values(responsiveDims).some((v) => {
|
|
1096
|
+
if (!v || typeof v !== "object") return false;
|
|
1097
|
+
const dim2 = v;
|
|
1098
|
+
return dim2.minHeight?.enabled && dim2.minHeight?.value > 0;
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
const dim = contentDimensions;
|
|
1102
|
+
return dim.minHeight?.enabled && dim.minHeight?.value > 0;
|
|
1103
|
+
})();
|
|
1104
|
+
if (hasMinHeight) {
|
|
1105
|
+
contentStyles.display = "flex";
|
|
1106
|
+
contentStyles.flexDirection = "column";
|
|
1107
|
+
}
|
|
1108
|
+
const contentBorderStyles = borderValueToCSS(contentBorder);
|
|
1109
|
+
if (contentBorderStyles) {
|
|
1110
|
+
Object.assign(contentStyles, contentBorderStyles);
|
|
1111
|
+
}
|
|
1112
|
+
const contentPaddingResult = responsiveValueToCSS(
|
|
1113
|
+
contentPadding,
|
|
1114
|
+
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
1074
1115
|
contentClass
|
|
1075
1116
|
);
|
|
1117
|
+
Object.assign(contentStyles, contentPaddingResult.baseStyles);
|
|
1118
|
+
if (contentPaddingResult.mediaQueryCSS) {
|
|
1119
|
+
mediaQueries.push(contentPaddingResult.mediaQueryCSS);
|
|
1120
|
+
}
|
|
1121
|
+
const sectionClasses = cn("relative w-full", sectionClass);
|
|
1122
|
+
const contentClasses = cn("relative z-10", contentClass);
|
|
1123
|
+
const hasContentStyles = Object.keys(contentStyles).length > 0;
|
|
1076
1124
|
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
1077
1125
|
const ContentSlot = Content;
|
|
1126
|
+
const renderContent = () => {
|
|
1127
|
+
if (hasMinHeight) {
|
|
1128
|
+
return /* @__PURE__ */ jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: /* @__PURE__ */ jsx(ContentSlot, { style: { flex: 1 } }) });
|
|
1129
|
+
}
|
|
1130
|
+
return /* @__PURE__ */ jsx(ContentSlot, {});
|
|
1131
|
+
};
|
|
1078
1132
|
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
1079
1133
|
allMediaQueryCSS && /* @__PURE__ */ jsx("style", { children: allMediaQueryCSS }),
|
|
1080
1134
|
/* @__PURE__ */ jsx(
|
|
@@ -1083,7 +1137,7 @@ var SectionConfig = {
|
|
|
1083
1137
|
id: id || void 0,
|
|
1084
1138
|
className: sectionClasses,
|
|
1085
1139
|
style: sectionStyles,
|
|
1086
|
-
children: /* @__PURE__ */ jsx(
|
|
1140
|
+
children: hasContentStyles ? /* @__PURE__ */ jsx("div", { className: contentClasses, style: contentStyles, children: renderContent() }) : /* @__PURE__ */ jsx(ContentSlot, { className: contentClasses })
|
|
1087
1141
|
}
|
|
1088
1142
|
)
|
|
1089
1143
|
] });
|
|
@@ -1304,6 +1358,14 @@ var TextConfig = {
|
|
|
1304
1358
|
) });
|
|
1305
1359
|
}
|
|
1306
1360
|
};
|
|
1361
|
+
var DEFAULT_PADDING = {
|
|
1362
|
+
top: 0,
|
|
1363
|
+
right: 16,
|
|
1364
|
+
bottom: 0,
|
|
1365
|
+
left: 16,
|
|
1366
|
+
unit: "px",
|
|
1367
|
+
linked: false
|
|
1368
|
+
};
|
|
1307
1369
|
var defaultProps9 = {
|
|
1308
1370
|
content: "<p>Enter your content here...</p>",
|
|
1309
1371
|
alignment: null,
|
|
@@ -1311,7 +1373,8 @@ var defaultProps9 = {
|
|
|
1311
1373
|
dimensions: null,
|
|
1312
1374
|
animation: null,
|
|
1313
1375
|
margin: null,
|
|
1314
|
-
customPadding:
|
|
1376
|
+
customPadding: DEFAULT_PADDING
|
|
1377
|
+
// Default 16px horizontal padding
|
|
1315
1378
|
};
|
|
1316
1379
|
var RichTextConfig = {
|
|
1317
1380
|
label: "Rich Text",
|
|
@@ -1336,17 +1399,25 @@ var RichTextConfig = {
|
|
|
1336
1399
|
const alignmentValue = alignment ?? "left";
|
|
1337
1400
|
const alignmentClass = alignmentMap[alignmentValue] || alignmentMap.left;
|
|
1338
1401
|
if (!content || content === "<p></p>") {
|
|
1339
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("section", { className: cn("relative overflow-hidden
|
|
1402
|
+
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("section", { className: cn("relative overflow-hidden", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: "prose dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("em", { children: "No content available" }) }) }) }) });
|
|
1340
1403
|
}
|
|
1341
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("section", { className: cn("relative overflow-hidden
|
|
1404
|
+
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("section", { className: cn("relative overflow-hidden", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx(
|
|
1342
1405
|
"div",
|
|
1343
1406
|
{
|
|
1344
|
-
className: "prose dark:prose-invert",
|
|
1407
|
+
className: "prose dark:prose-invert max-w-none",
|
|
1345
1408
|
dangerouslySetInnerHTML: { __html: content }
|
|
1346
1409
|
}
|
|
1347
1410
|
) }) });
|
|
1348
1411
|
}
|
|
1349
1412
|
};
|
|
1413
|
+
var DEFAULT_PADDING2 = {
|
|
1414
|
+
top: 16,
|
|
1415
|
+
right: 16,
|
|
1416
|
+
bottom: 16,
|
|
1417
|
+
left: 16,
|
|
1418
|
+
unit: "px",
|
|
1419
|
+
linked: true
|
|
1420
|
+
};
|
|
1350
1421
|
var idCounter7 = 0;
|
|
1351
1422
|
function generateUniqueId7() {
|
|
1352
1423
|
return `i${(++idCounter7).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
@@ -1363,7 +1434,8 @@ var defaultProps10 = {
|
|
|
1363
1434
|
alignment: null,
|
|
1364
1435
|
transform: null,
|
|
1365
1436
|
animation: null,
|
|
1366
|
-
customPadding:
|
|
1437
|
+
customPadding: DEFAULT_PADDING2,
|
|
1438
|
+
// Default 16px padding
|
|
1367
1439
|
visibility: null
|
|
1368
1440
|
};
|
|
1369
1441
|
var ImageConfig = {
|
|
@@ -1403,7 +1475,7 @@ var ImageConfig = {
|
|
|
1403
1475
|
if (!image?.url) {
|
|
1404
1476
|
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
1405
1477
|
visibilityCSS && /* @__PURE__ */ jsx("style", { children: visibilityCSS }),
|
|
1406
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
1478
|
+
/* @__PURE__ */ jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx(
|
|
1407
1479
|
"div",
|
|
1408
1480
|
{
|
|
1409
1481
|
className: cn(
|
|
@@ -1442,7 +1514,7 @@ var ImageConfig = {
|
|
|
1442
1514
|
) : imageElement;
|
|
1443
1515
|
return /* @__PURE__ */ jsxs(AnimatedWrapper, { animation, children: [
|
|
1444
1516
|
visibilityCSS && /* @__PURE__ */ jsx("style", { children: visibilityCSS }),
|
|
1445
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
1517
|
+
/* @__PURE__ */ jsx("div", { className: wrapperClass, style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: content }) })
|
|
1446
1518
|
] });
|
|
1447
1519
|
}
|
|
1448
1520
|
};
|
|
@@ -1836,6 +1908,14 @@ var ButtonConfig = {
|
|
|
1836
1908
|
);
|
|
1837
1909
|
}
|
|
1838
1910
|
};
|
|
1911
|
+
var DEFAULT_CONTENT_PADDING2 = {
|
|
1912
|
+
top: 16,
|
|
1913
|
+
right: 16,
|
|
1914
|
+
bottom: 16,
|
|
1915
|
+
left: 16,
|
|
1916
|
+
unit: "px",
|
|
1917
|
+
linked: true
|
|
1918
|
+
};
|
|
1839
1919
|
var defaultProps12 = {
|
|
1840
1920
|
image: null,
|
|
1841
1921
|
heading: "Card Heading",
|
|
@@ -1850,12 +1930,13 @@ var defaultProps12 = {
|
|
|
1850
1930
|
alignment: null,
|
|
1851
1931
|
transform: null,
|
|
1852
1932
|
animation: null,
|
|
1853
|
-
|
|
1933
|
+
contentPadding: DEFAULT_CONTENT_PADDING2
|
|
1934
|
+
// Default 16px padding
|
|
1854
1935
|
};
|
|
1855
1936
|
var CardConfig = {
|
|
1856
1937
|
label: "Card",
|
|
1857
1938
|
defaultProps: defaultProps12,
|
|
1858
|
-
render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation,
|
|
1939
|
+
render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, contentPadding }) => {
|
|
1859
1940
|
const hasBorderRadius = border?.radius && border.radius > 0;
|
|
1860
1941
|
const cardClasses = cn(
|
|
1861
1942
|
"overflow-hidden transition-all bg-card",
|
|
@@ -1891,9 +1972,10 @@ var CardConfig = {
|
|
|
1891
1972
|
if (borderStyles) {
|
|
1892
1973
|
Object.assign(cardStyle, borderStyles);
|
|
1893
1974
|
}
|
|
1894
|
-
const
|
|
1895
|
-
|
|
1896
|
-
|
|
1975
|
+
const contentStyle = {};
|
|
1976
|
+
const contentPaddingCSS = paddingValueToCSS(contentPadding);
|
|
1977
|
+
if (contentPaddingCSS) {
|
|
1978
|
+
contentStyle.padding = contentPaddingCSS;
|
|
1897
1979
|
}
|
|
1898
1980
|
const cardContent = /* @__PURE__ */ jsxs("div", { className: cardClasses, style: cardStyle, children: [
|
|
1899
1981
|
image?.url ? /* @__PURE__ */ jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
@@ -1904,7 +1986,7 @@ var CardConfig = {
|
|
|
1904
1986
|
className: "w-full h-full object-cover"
|
|
1905
1987
|
}
|
|
1906
1988
|
) }) : /* @__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" }) }),
|
|
1907
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1989
|
+
/* @__PURE__ */ jsxs("div", { style: contentStyle, children: [
|
|
1908
1990
|
heading && /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
|
|
1909
1991
|
text && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: text })
|
|
1910
1992
|
] })
|
|
@@ -1925,6 +2007,14 @@ var CardConfig = {
|
|
|
1925
2007
|
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: cardContent }) }) });
|
|
1926
2008
|
}
|
|
1927
2009
|
};
|
|
2010
|
+
var DEFAULT_PADDING3 = {
|
|
2011
|
+
top: 0,
|
|
2012
|
+
right: 16,
|
|
2013
|
+
bottom: 0,
|
|
2014
|
+
left: 16,
|
|
2015
|
+
unit: "px",
|
|
2016
|
+
linked: false
|
|
2017
|
+
};
|
|
1928
2018
|
var defaultProps13 = {
|
|
1929
2019
|
style: "solid",
|
|
1930
2020
|
color: null,
|
|
@@ -1932,7 +2022,8 @@ var defaultProps13 = {
|
|
|
1932
2022
|
dimensions: null,
|
|
1933
2023
|
transform: null,
|
|
1934
2024
|
animation: null,
|
|
1935
|
-
customPadding:
|
|
2025
|
+
customPadding: DEFAULT_PADDING3
|
|
2026
|
+
// Default 16px horizontal padding
|
|
1936
2027
|
};
|
|
1937
2028
|
var DividerConfig = {
|
|
1938
2029
|
label: "Divider",
|
|
@@ -1956,7 +2047,7 @@ var DividerConfig = {
|
|
|
1956
2047
|
}
|
|
1957
2048
|
const customColor = colorValueToCSS(color);
|
|
1958
2049
|
const hrStyle = customColor ? { borderColor: customColor } : void 0;
|
|
1959
|
-
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", {
|
|
2050
|
+
return /* @__PURE__ */ jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsx("div", { style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsx(
|
|
1960
2051
|
"hr",
|
|
1961
2052
|
{
|
|
1962
2053
|
className: cn(
|
|
@@ -343,7 +343,8 @@ declare function transformValueToCSS(transform: TransformValue | null | undefine
|
|
|
343
343
|
type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
344
344
|
/**
|
|
345
345
|
* Responsive value that can have different values at different breakpoints.
|
|
346
|
-
*
|
|
346
|
+
* Uses mobile-first approach: xs is the required base, larger breakpoints inherit upward.
|
|
347
|
+
* sm/md/lg/xl are optional overrides that apply at their breakpoint and above.
|
|
347
348
|
*/
|
|
348
349
|
interface ResponsiveValue<T> {
|
|
349
350
|
xs: T;
|
|
@@ -362,6 +363,7 @@ declare const BREAKPOINTS: Array<{
|
|
|
362
363
|
}>;
|
|
363
364
|
/**
|
|
364
365
|
* Type guard to check if a value is a ResponsiveValue (has breakpoint structure)
|
|
366
|
+
* Checks for the required xs property which indicates mobile-first responsive value
|
|
365
367
|
*/
|
|
366
368
|
declare function isResponsiveValue<T>(value: unknown): value is ResponsiveValue<T>;
|
|
367
369
|
/**
|
|
@@ -343,7 +343,8 @@ declare function transformValueToCSS(transform: TransformValue | null | undefine
|
|
|
343
343
|
type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
344
344
|
/**
|
|
345
345
|
* Responsive value that can have different values at different breakpoints.
|
|
346
|
-
*
|
|
346
|
+
* Uses mobile-first approach: xs is the required base, larger breakpoints inherit upward.
|
|
347
|
+
* sm/md/lg/xl are optional overrides that apply at their breakpoint and above.
|
|
347
348
|
*/
|
|
348
349
|
interface ResponsiveValue<T> {
|
|
349
350
|
xs: T;
|
|
@@ -362,6 +363,7 @@ declare const BREAKPOINTS: Array<{
|
|
|
362
363
|
}>;
|
|
363
364
|
/**
|
|
364
365
|
* Type guard to check if a value is a ResponsiveValue (has breakpoint structure)
|
|
366
|
+
* Checks for the required xs property which indicates mobile-first responsive value
|
|
365
367
|
*/
|
|
366
368
|
declare function isResponsiveValue<T>(value: unknown): value is ResponsiveValue<T>;
|
|
367
369
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delmaredigital/payload-puck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Puck visual page builder plugin for Payload CMS",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -87,7 +87,8 @@
|
|
|
87
87
|
"build": "tsup",
|
|
88
88
|
"dev": "tsup --watch",
|
|
89
89
|
"typecheck": "tsc --noEmit",
|
|
90
|
-
"prepublishOnly": "pnpm build"
|
|
90
|
+
"prepublishOnly": "pnpm build",
|
|
91
|
+
"dev-publish": "pnpm build && pnpm version prerelease --preid=dev && pnpm publish --registry http://localhost:4873"
|
|
91
92
|
},
|
|
92
93
|
"peerDependencies": {
|
|
93
94
|
"@measured/puck": ">=0.20.0",
|