@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/fields/index.js
CHANGED
|
@@ -810,25 +810,23 @@ function responsiveValueToCSS(value, converter, uniqueId) {
|
|
|
810
810
|
mediaQueryCSS: ""
|
|
811
811
|
};
|
|
812
812
|
}
|
|
813
|
-
const
|
|
814
|
-
let baseStyles = {};
|
|
813
|
+
const cssRules = [];
|
|
815
814
|
BREAKPOINTS.forEach((bp) => {
|
|
816
815
|
const bpValue = value[bp.key];
|
|
817
816
|
if (bpValue === void 0) return;
|
|
818
817
|
const cssProps = converter(bpValue);
|
|
819
818
|
if (!cssProps) return;
|
|
819
|
+
const styleString = cssPropertiesToString(cssProps);
|
|
820
|
+
if (!styleString) return;
|
|
820
821
|
if (bp.key === "xs") {
|
|
821
|
-
|
|
822
|
+
cssRules.push(`.${uniqueId} { ${styleString} }`);
|
|
822
823
|
} else {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
827
|
-
);
|
|
828
|
-
}
|
|
824
|
+
cssRules.push(
|
|
825
|
+
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
826
|
+
);
|
|
829
827
|
}
|
|
830
828
|
});
|
|
831
|
-
return { baseStyles, mediaQueryCSS:
|
|
829
|
+
return { baseStyles: {}, mediaQueryCSS: cssRules.join("\n") };
|
|
832
830
|
}
|
|
833
831
|
var DEFAULT_VISIBILITY = {
|
|
834
832
|
xs: true,
|
|
@@ -4196,12 +4194,12 @@ var Checkbox = React12__namespace.forwardRef(
|
|
|
4196
4194
|
);
|
|
4197
4195
|
Checkbox.displayName = "Checkbox";
|
|
4198
4196
|
var DEFAULT_VALUE5 = {
|
|
4199
|
-
mode: "
|
|
4197
|
+
mode: "full",
|
|
4200
4198
|
alignment: "center",
|
|
4201
4199
|
maxWidth: {
|
|
4202
|
-
value:
|
|
4200
|
+
value: 0,
|
|
4203
4201
|
unit: "px",
|
|
4204
|
-
enabled:
|
|
4202
|
+
enabled: false
|
|
4205
4203
|
},
|
|
4206
4204
|
advancedMode: false
|
|
4207
4205
|
};
|
|
@@ -4428,11 +4426,13 @@ function DimensionsFieldInner({
|
|
|
4428
4426
|
const handleAdvancedToggle = React12.useCallback(() => {
|
|
4429
4427
|
const newAdvancedMode = !advancedMode;
|
|
4430
4428
|
setAdvancedMode(newAdvancedMode);
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4429
|
+
if (value !== null) {
|
|
4430
|
+
onChange({
|
|
4431
|
+
...currentValue,
|
|
4432
|
+
advancedMode: newAdvancedMode
|
|
4433
|
+
});
|
|
4434
|
+
}
|
|
4435
|
+
}, [advancedMode, currentValue, onChange, value]);
|
|
4436
4436
|
const modeConfig = [
|
|
4437
4437
|
{ mode: "full", icon: lucideReact.MoveHorizontal, label: "Full", title: "Full width (100%)" },
|
|
4438
4438
|
{ mode: "contained", icon: lucideReact.Square, label: "Contain", title: "Contained (centered with max-width)" },
|
|
@@ -6434,7 +6434,7 @@ function ResponsiveFieldInner({
|
|
|
6434
6434
|
}) {
|
|
6435
6435
|
const [activeBreakpoint, setActiveBreakpoint] = React12.useState("xs");
|
|
6436
6436
|
const getCurrentValue = React12.useCallback(() => {
|
|
6437
|
-
if (!value) return
|
|
6437
|
+
if (!value) return null;
|
|
6438
6438
|
if (activeBreakpoint === "xs") {
|
|
6439
6439
|
return value.xs ?? defaultValue ?? null;
|
|
6440
6440
|
}
|
|
@@ -6456,21 +6456,35 @@ function ResponsiveFieldInner({
|
|
|
6456
6456
|
const hasOverride = React12.useCallback(
|
|
6457
6457
|
(breakpoint) => {
|
|
6458
6458
|
if (!value) return false;
|
|
6459
|
-
if (breakpoint === "xs") return
|
|
6459
|
+
if (breakpoint === "xs") return false;
|
|
6460
6460
|
return value[breakpoint] !== void 0;
|
|
6461
6461
|
},
|
|
6462
6462
|
[value]
|
|
6463
6463
|
);
|
|
6464
|
+
const getInheritanceSource = React12.useCallback(() => {
|
|
6465
|
+
if (!value || activeBreakpoint === "xs") return null;
|
|
6466
|
+
if (value[activeBreakpoint] !== void 0) return null;
|
|
6467
|
+
const breakpointOrder = ["xl", "lg", "md", "sm", "xs"];
|
|
6468
|
+
const activeIndex = breakpointOrder.indexOf(activeBreakpoint);
|
|
6469
|
+
for (let i = activeIndex + 1; i < breakpointOrder.length; i++) {
|
|
6470
|
+
const bp = breakpointOrder[i];
|
|
6471
|
+
if (value[bp] !== void 0) {
|
|
6472
|
+
return bp;
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
return null;
|
|
6476
|
+
}, [value, activeBreakpoint]);
|
|
6464
6477
|
const handleInnerChange = React12.useCallback(
|
|
6465
6478
|
(newValue) => {
|
|
6466
6479
|
if (activeBreakpoint === "xs") {
|
|
6467
|
-
if (newValue === null
|
|
6468
|
-
onChange(
|
|
6469
|
-
} else
|
|
6480
|
+
if (newValue === null) {
|
|
6481
|
+
onChange(null);
|
|
6482
|
+
} else {
|
|
6470
6483
|
onChange({ ...value, xs: newValue });
|
|
6471
6484
|
}
|
|
6472
6485
|
} else {
|
|
6473
6486
|
if (newValue === null) {
|
|
6487
|
+
if (!value) return;
|
|
6474
6488
|
const newResponsive = { ...value };
|
|
6475
6489
|
delete newResponsive[activeBreakpoint];
|
|
6476
6490
|
onChange(newResponsive);
|
|
@@ -6499,6 +6513,7 @@ function ResponsiveFieldInner({
|
|
|
6499
6513
|
const currentValue = getCurrentValue();
|
|
6500
6514
|
const isOverrideBreakpoint = activeBreakpoint !== "xs";
|
|
6501
6515
|
const currentHasOverride = hasOverride(activeBreakpoint);
|
|
6516
|
+
const inheritanceSource = getInheritanceSource();
|
|
6502
6517
|
const overrideCount = value ? ["sm", "md", "lg", "xl"].filter((bp) => value[bp] !== void 0).length : 0;
|
|
6503
6518
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "puck-field space-y-3", children: [
|
|
6504
6519
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -6540,7 +6555,11 @@ function ResponsiveFieldInner({
|
|
|
6540
6555
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: activeBreakpoint === "xs" ? "Extra small screens (0-639px)" : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6541
6556
|
BREAKPOINTS.find((bp) => bp.key === activeBreakpoint)?.minWidth,
|
|
6542
6557
|
"px and up",
|
|
6543
|
-
!currentHasOverride && /* @__PURE__ */ jsxRuntime.
|
|
6558
|
+
!currentHasOverride && inheritanceSource && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-muted-foreground/60", children: [
|
|
6559
|
+
" (inheriting from ",
|
|
6560
|
+
inheritanceSource.toUpperCase(),
|
|
6561
|
+
")"
|
|
6562
|
+
] })
|
|
6544
6563
|
] }) }),
|
|
6545
6564
|
isOverrideBreakpoint && currentHasOverride && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6546
6565
|
Button,
|
package/dist/fields/index.mjs
CHANGED
|
@@ -779,25 +779,23 @@ function responsiveValueToCSS(value, converter, uniqueId) {
|
|
|
779
779
|
mediaQueryCSS: ""
|
|
780
780
|
};
|
|
781
781
|
}
|
|
782
|
-
const
|
|
783
|
-
let baseStyles = {};
|
|
782
|
+
const cssRules = [];
|
|
784
783
|
BREAKPOINTS.forEach((bp) => {
|
|
785
784
|
const bpValue = value[bp.key];
|
|
786
785
|
if (bpValue === void 0) return;
|
|
787
786
|
const cssProps = converter(bpValue);
|
|
788
787
|
if (!cssProps) return;
|
|
788
|
+
const styleString = cssPropertiesToString(cssProps);
|
|
789
|
+
if (!styleString) return;
|
|
789
790
|
if (bp.key === "xs") {
|
|
790
|
-
|
|
791
|
+
cssRules.push(`.${uniqueId} { ${styleString} }`);
|
|
791
792
|
} else {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
796
|
-
);
|
|
797
|
-
}
|
|
793
|
+
cssRules.push(
|
|
794
|
+
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
795
|
+
);
|
|
798
796
|
}
|
|
799
797
|
});
|
|
800
|
-
return { baseStyles, mediaQueryCSS:
|
|
798
|
+
return { baseStyles: {}, mediaQueryCSS: cssRules.join("\n") };
|
|
801
799
|
}
|
|
802
800
|
var DEFAULT_VISIBILITY = {
|
|
803
801
|
xs: true,
|
|
@@ -4165,12 +4163,12 @@ var Checkbox = React12.forwardRef(
|
|
|
4165
4163
|
);
|
|
4166
4164
|
Checkbox.displayName = "Checkbox";
|
|
4167
4165
|
var DEFAULT_VALUE5 = {
|
|
4168
|
-
mode: "
|
|
4166
|
+
mode: "full",
|
|
4169
4167
|
alignment: "center",
|
|
4170
4168
|
maxWidth: {
|
|
4171
|
-
value:
|
|
4169
|
+
value: 0,
|
|
4172
4170
|
unit: "px",
|
|
4173
|
-
enabled:
|
|
4171
|
+
enabled: false
|
|
4174
4172
|
},
|
|
4175
4173
|
advancedMode: false
|
|
4176
4174
|
};
|
|
@@ -4397,11 +4395,13 @@ function DimensionsFieldInner({
|
|
|
4397
4395
|
const handleAdvancedToggle = useCallback(() => {
|
|
4398
4396
|
const newAdvancedMode = !advancedMode;
|
|
4399
4397
|
setAdvancedMode(newAdvancedMode);
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4398
|
+
if (value !== null) {
|
|
4399
|
+
onChange({
|
|
4400
|
+
...currentValue,
|
|
4401
|
+
advancedMode: newAdvancedMode
|
|
4402
|
+
});
|
|
4403
|
+
}
|
|
4404
|
+
}, [advancedMode, currentValue, onChange, value]);
|
|
4405
4405
|
const modeConfig = [
|
|
4406
4406
|
{ mode: "full", icon: MoveHorizontal, label: "Full", title: "Full width (100%)" },
|
|
4407
4407
|
{ mode: "contained", icon: Square, label: "Contain", title: "Contained (centered with max-width)" },
|
|
@@ -6403,7 +6403,7 @@ function ResponsiveFieldInner({
|
|
|
6403
6403
|
}) {
|
|
6404
6404
|
const [activeBreakpoint, setActiveBreakpoint] = useState("xs");
|
|
6405
6405
|
const getCurrentValue = useCallback(() => {
|
|
6406
|
-
if (!value) return
|
|
6406
|
+
if (!value) return null;
|
|
6407
6407
|
if (activeBreakpoint === "xs") {
|
|
6408
6408
|
return value.xs ?? defaultValue ?? null;
|
|
6409
6409
|
}
|
|
@@ -6425,21 +6425,35 @@ function ResponsiveFieldInner({
|
|
|
6425
6425
|
const hasOverride = useCallback(
|
|
6426
6426
|
(breakpoint) => {
|
|
6427
6427
|
if (!value) return false;
|
|
6428
|
-
if (breakpoint === "xs") return
|
|
6428
|
+
if (breakpoint === "xs") return false;
|
|
6429
6429
|
return value[breakpoint] !== void 0;
|
|
6430
6430
|
},
|
|
6431
6431
|
[value]
|
|
6432
6432
|
);
|
|
6433
|
+
const getInheritanceSource = useCallback(() => {
|
|
6434
|
+
if (!value || activeBreakpoint === "xs") return null;
|
|
6435
|
+
if (value[activeBreakpoint] !== void 0) return null;
|
|
6436
|
+
const breakpointOrder = ["xl", "lg", "md", "sm", "xs"];
|
|
6437
|
+
const activeIndex = breakpointOrder.indexOf(activeBreakpoint);
|
|
6438
|
+
for (let i = activeIndex + 1; i < breakpointOrder.length; i++) {
|
|
6439
|
+
const bp = breakpointOrder[i];
|
|
6440
|
+
if (value[bp] !== void 0) {
|
|
6441
|
+
return bp;
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
return null;
|
|
6445
|
+
}, [value, activeBreakpoint]);
|
|
6433
6446
|
const handleInnerChange = useCallback(
|
|
6434
6447
|
(newValue) => {
|
|
6435
6448
|
if (activeBreakpoint === "xs") {
|
|
6436
|
-
if (newValue === null
|
|
6437
|
-
onChange(
|
|
6438
|
-
} else
|
|
6449
|
+
if (newValue === null) {
|
|
6450
|
+
onChange(null);
|
|
6451
|
+
} else {
|
|
6439
6452
|
onChange({ ...value, xs: newValue });
|
|
6440
6453
|
}
|
|
6441
6454
|
} else {
|
|
6442
6455
|
if (newValue === null) {
|
|
6456
|
+
if (!value) return;
|
|
6443
6457
|
const newResponsive = { ...value };
|
|
6444
6458
|
delete newResponsive[activeBreakpoint];
|
|
6445
6459
|
onChange(newResponsive);
|
|
@@ -6468,6 +6482,7 @@ function ResponsiveFieldInner({
|
|
|
6468
6482
|
const currentValue = getCurrentValue();
|
|
6469
6483
|
const isOverrideBreakpoint = activeBreakpoint !== "xs";
|
|
6470
6484
|
const currentHasOverride = hasOverride(activeBreakpoint);
|
|
6485
|
+
const inheritanceSource = getInheritanceSource();
|
|
6471
6486
|
const overrideCount = value ? ["sm", "md", "lg", "xl"].filter((bp) => value[bp] !== void 0).length : 0;
|
|
6472
6487
|
return /* @__PURE__ */ jsxs("div", { className: "puck-field space-y-3", children: [
|
|
6473
6488
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -6509,7 +6524,11 @@ function ResponsiveFieldInner({
|
|
|
6509
6524
|
/* @__PURE__ */ jsx("span", { children: activeBreakpoint === "xs" ? "Extra small screens (0-639px)" : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6510
6525
|
BREAKPOINTS.find((bp) => bp.key === activeBreakpoint)?.minWidth,
|
|
6511
6526
|
"px and up",
|
|
6512
|
-
!currentHasOverride && /* @__PURE__ */
|
|
6527
|
+
!currentHasOverride && inheritanceSource && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/60", children: [
|
|
6528
|
+
" (inheriting from ",
|
|
6529
|
+
inheritanceSource.toUpperCase(),
|
|
6530
|
+
")"
|
|
6531
|
+
] })
|
|
6513
6532
|
] }) }),
|
|
6514
6533
|
isOverrideBreakpoint && currentHasOverride && !readOnly && /* @__PURE__ */ jsx(
|
|
6515
6534
|
Button,
|