@measured/puck 0.11.3-canary.ab9d43f → 0.12.0-canary.01939fc
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 +20 -456
- package/dist/Config-a03de579.d.ts +196 -0
- package/dist/index.css +287 -150
- package/dist/index.d.ts +22 -208
- package/dist/index.js +572 -690
- package/dist/rsc.d.ts +10 -0
- package/dist/rsc.js +135 -0
- package/package.json +24 -4
package/dist/index.js
CHANGED
@@ -327,7 +327,7 @@ var require_react_is_development = __commonJS({
|
|
327
327
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
328
328
|
var Element = REACT_ELEMENT_TYPE;
|
329
329
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
330
|
-
var
|
330
|
+
var Fragment13 = REACT_FRAGMENT_TYPE;
|
331
331
|
var Lazy = REACT_LAZY_TYPE;
|
332
332
|
var Memo = REACT_MEMO_TYPE;
|
333
333
|
var Portal = REACT_PORTAL_TYPE;
|
@@ -386,7 +386,7 @@ var require_react_is_development = __commonJS({
|
|
386
386
|
exports.ContextProvider = ContextProvider;
|
387
387
|
exports.Element = Element;
|
388
388
|
exports.ForwardRef = ForwardRef;
|
389
|
-
exports.Fragment =
|
389
|
+
exports.Fragment = Fragment13;
|
390
390
|
exports.Lazy = Lazy;
|
391
391
|
exports.Memo = Memo;
|
392
392
|
exports.Portal = Portal;
|
@@ -760,7 +760,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
760
760
|
function validate(props, propName, componentName, location, propFullName) {
|
761
761
|
if (!(props[propName] instanceof expectedClass)) {
|
762
762
|
var expectedClassName = expectedClass.name || ANONYMOUS;
|
763
|
-
var actualClassName =
|
763
|
+
var actualClassName = getClassName19(props[propName]);
|
764
764
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
765
765
|
}
|
766
766
|
return null;
|
@@ -1012,7 +1012,7 @@ var require_factoryWithTypeCheckers = __commonJS({
|
|
1012
1012
|
return type;
|
1013
1013
|
}
|
1014
1014
|
}
|
1015
|
-
function
|
1015
|
+
function getClassName19(propValue) {
|
1016
1016
|
if (!propValue.constructor || !propValue.constructor.name) {
|
1017
1017
|
return ANONYMOUS;
|
1018
1018
|
}
|
@@ -9040,7 +9040,7 @@ var require_react_dom_development = __commonJS({
|
|
9040
9040
|
var HostPortal = 4;
|
9041
9041
|
var HostComponent = 5;
|
9042
9042
|
var HostText = 6;
|
9043
|
-
var
|
9043
|
+
var Fragment13 = 7;
|
9044
9044
|
var Mode = 8;
|
9045
9045
|
var ContextConsumer = 9;
|
9046
9046
|
var ContextProvider = 10;
|
@@ -10196,7 +10196,7 @@ var require_react_dom_development = __commonJS({
|
|
10196
10196
|
return "DehydratedFragment";
|
10197
10197
|
case ForwardRef:
|
10198
10198
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
10199
|
-
case
|
10199
|
+
case Fragment13:
|
10200
10200
|
return "Fragment";
|
10201
10201
|
case HostComponent:
|
10202
10202
|
return type;
|
@@ -14313,7 +14313,7 @@ var require_react_dom_development = __commonJS({
|
|
14313
14313
|
defaultPrevented: 0,
|
14314
14314
|
isTrusted: 0
|
14315
14315
|
};
|
14316
|
-
var
|
14316
|
+
var SyntheticEvent3 = createSyntheticEvent(EventInterface);
|
14317
14317
|
var UIEventInterface = assign({}, EventInterface, {
|
14318
14318
|
view: 0,
|
14319
14319
|
detail: 0
|
@@ -14789,7 +14789,7 @@ var require_react_dom_development = __commonJS({
|
|
14789
14789
|
enqueueStateRestore(target);
|
14790
14790
|
var listeners = accumulateTwoPhaseListeners(inst, "onChange");
|
14791
14791
|
if (listeners.length > 0) {
|
14792
|
-
var event = new
|
14792
|
+
var event = new SyntheticEvent3("onChange", "change", null, nativeEvent, target);
|
14793
14793
|
dispatchQueue.push({
|
14794
14794
|
event,
|
14795
14795
|
listeners
|
@@ -15293,7 +15293,7 @@ var require_react_dom_development = __commonJS({
|
|
15293
15293
|
lastSelection = currentSelection;
|
15294
15294
|
var listeners = accumulateTwoPhaseListeners(activeElementInst$1, "onSelect");
|
15295
15295
|
if (listeners.length > 0) {
|
15296
|
-
var event = new
|
15296
|
+
var event = new SyntheticEvent3("onSelect", "select", null, nativeEvent, nativeEventTarget);
|
15297
15297
|
dispatchQueue.push({
|
15298
15298
|
event,
|
15299
15299
|
listeners
|
@@ -15405,7 +15405,7 @@ var require_react_dom_development = __commonJS({
|
|
15405
15405
|
if (reactName === void 0) {
|
15406
15406
|
return;
|
15407
15407
|
}
|
15408
|
-
var SyntheticEventCtor =
|
15408
|
+
var SyntheticEventCtor = SyntheticEvent3;
|
15409
15409
|
var reactEventType = domEventName;
|
15410
15410
|
switch (domEventName) {
|
15411
15411
|
case "keypress":
|
@@ -19867,7 +19867,7 @@ var require_react_dom_development = __commonJS({
|
|
19867
19867
|
}
|
19868
19868
|
}
|
19869
19869
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
19870
|
-
if (current2 === null || current2.tag !==
|
19870
|
+
if (current2 === null || current2.tag !== Fragment13) {
|
19871
19871
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
19872
19872
|
created.return = returnFiber;
|
19873
19873
|
return created;
|
@@ -20270,7 +20270,7 @@ var require_react_dom_development = __commonJS({
|
|
20270
20270
|
if (child.key === key) {
|
20271
20271
|
var elementType = element.type;
|
20272
20272
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
20273
|
-
if (child.tag ===
|
20273
|
+
if (child.tag === Fragment13) {
|
20274
20274
|
deleteRemainingChildren(returnFiber, child.sibling);
|
20275
20275
|
var existing = useFiber(child, element.props.children);
|
20276
20276
|
existing.return = returnFiber;
|
@@ -24445,7 +24445,7 @@ var require_react_dom_development = __commonJS({
|
|
24445
24445
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
24446
24446
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
24447
24447
|
}
|
24448
|
-
case
|
24448
|
+
case Fragment13:
|
24449
24449
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
24450
24450
|
case Mode:
|
24451
24451
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -24718,7 +24718,7 @@ var require_react_dom_development = __commonJS({
|
|
24718
24718
|
case SimpleMemoComponent:
|
24719
24719
|
case FunctionComponent:
|
24720
24720
|
case ForwardRef:
|
24721
|
-
case
|
24721
|
+
case Fragment13:
|
24722
24722
|
case Mode:
|
24723
24723
|
case Profiler:
|
24724
24724
|
case ContextConsumer:
|
@@ -28977,7 +28977,7 @@ var require_react_dom_development = __commonJS({
|
|
28977
28977
|
return fiber;
|
28978
28978
|
}
|
28979
28979
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
28980
|
-
var fiber = createFiber(
|
28980
|
+
var fiber = createFiber(Fragment13, elements, key, mode);
|
28981
28981
|
fiber.lanes = lanes;
|
28982
28982
|
return fiber;
|
28983
28983
|
}
|
@@ -30125,7 +30125,7 @@ var import_react2 = require("react");
|
|
30125
30125
|
|
30126
30126
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Button/Button.module.css#css-module
|
30127
30127
|
init_react_import();
|
30128
|
-
var Button_module_default = { "Button": "
|
30128
|
+
var Button_module_default = { "Button": "_Button_zx1c8_1", "Button--medium": "_Button--medium_zx1c8_21", "Button--large": "_Button--large_zx1c8_28", "Button-icon": "_Button-icon_zx1c8_35", "Button--primary": "_Button--primary_zx1c8_43", "Button--secondary": "_Button--secondary_zx1c8_52", "Button--flush": "_Button--flush_zx1c8_63", "Button--disabled": "_Button--disabled_zx1c8_67", "Button--fullWidth": "_Button--fullWidth_zx1c8_77" };
|
30129
30129
|
|
30130
30130
|
// lib/get-class-name-factory.ts
|
30131
30131
|
init_react_import();
|
@@ -30213,12 +30213,12 @@ var Button = ({
|
|
30213
30213
|
|
30214
30214
|
// components/DropZone/index.tsx
|
30215
30215
|
init_react_import();
|
30216
|
-
var
|
30216
|
+
var import_react25 = require("react");
|
30217
30217
|
|
30218
30218
|
// components/DraggableComponent/index.tsx
|
30219
30219
|
init_react_import();
|
30220
30220
|
var import_react22 = require("react");
|
30221
|
-
var
|
30221
|
+
var import_dnd = require("@hello-pangea/dnd");
|
30222
30222
|
|
30223
30223
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
30224
30224
|
init_react_import();
|
@@ -31746,7 +31746,7 @@ var DraggableComponent = ({
|
|
31746
31746
|
const isModifierHeld = useModifierHeld("Alt");
|
31747
31747
|
(0, import_react22.useEffect)(onMount, []);
|
31748
31748
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
31749
|
-
|
31749
|
+
import_dnd.Draggable,
|
31750
31750
|
{
|
31751
31751
|
draggableId: id,
|
31752
31752
|
index,
|
@@ -31789,27 +31789,8 @@ var DraggableComponent = ({
|
|
31789
31789
|
);
|
31790
31790
|
};
|
31791
31791
|
|
31792
|
-
// components/
|
31793
|
-
|
31794
|
-
var import_react23 = require("react");
|
31795
|
-
var import_react_beautiful_dnd2 = require("react-beautiful-dnd");
|
31796
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
31797
|
-
var DroppableStrictMode = (_a) => {
|
31798
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
31799
|
-
const [enabled, setEnabled] = (0, import_react23.useState)(false);
|
31800
|
-
(0, import_react23.useEffect)(() => {
|
31801
|
-
const animation = requestAnimationFrame(() => setEnabled(true));
|
31802
|
-
return () => {
|
31803
|
-
cancelAnimationFrame(animation);
|
31804
|
-
setEnabled(false);
|
31805
|
-
};
|
31806
|
-
}, []);
|
31807
|
-
if (!enabled) {
|
31808
|
-
return null;
|
31809
|
-
}
|
31810
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_beautiful_dnd2.Droppable, __spreadProps(__spreadValues({}, props), { children }));
|
31811
|
-
};
|
31812
|
-
var DroppableStrictMode_default = DroppableStrictMode;
|
31792
|
+
// components/DropZone/index.tsx
|
31793
|
+
var import_dnd2 = require("@hello-pangea/dnd");
|
31813
31794
|
|
31814
31795
|
// lib/get-item.ts
|
31815
31796
|
init_react_import();
|
@@ -31870,7 +31851,7 @@ var styles_module_default2 = { "DropZone": "_DropZone_1akqa_1", "DropZone-conten
|
|
31870
31851
|
|
31871
31852
|
// components/DropZone/context.tsx
|
31872
31853
|
init_react_import();
|
31873
|
-
var
|
31854
|
+
var import_react23 = require("react");
|
31874
31855
|
var import_use_debounce = require("use-debounce");
|
31875
31856
|
|
31876
31857
|
// lib/get-zone-id.ts
|
@@ -31886,30 +31867,30 @@ var getZoneId = (zoneCompound) => {
|
|
31886
31867
|
};
|
31887
31868
|
|
31888
31869
|
// components/DropZone/context.tsx
|
31889
|
-
var
|
31890
|
-
var dropZoneContext = (0,
|
31870
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
31871
|
+
var dropZoneContext = (0, import_react23.createContext)(null);
|
31891
31872
|
var DropZoneProvider = ({
|
31892
31873
|
children,
|
31893
31874
|
value
|
31894
31875
|
}) => {
|
31895
|
-
const [hoveringArea, setHoveringArea] = (0,
|
31896
|
-
const [hoveringZone, setHoveringZone] = (0,
|
31876
|
+
const [hoveringArea, setHoveringArea] = (0, import_react23.useState)(null);
|
31877
|
+
const [hoveringZone, setHoveringZone] = (0, import_react23.useState)(
|
31897
31878
|
rootDroppableId
|
31898
31879
|
);
|
31899
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
31880
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react23.useState)();
|
31900
31881
|
const [hoveringAreaDb] = (0, import_use_debounce.useDebounce)(hoveringArea, 75, { leading: false });
|
31901
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
31882
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react23.useState)(
|
31902
31883
|
{}
|
31903
31884
|
);
|
31904
|
-
const [activeZones, setActiveZones] = (0,
|
31885
|
+
const [activeZones, setActiveZones] = (0, import_react23.useState)({});
|
31905
31886
|
const { dispatch = null } = value ? value : {};
|
31906
|
-
const registerZoneArea = (0,
|
31887
|
+
const registerZoneArea = (0, import_react23.useCallback)(
|
31907
31888
|
(area) => {
|
31908
31889
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
31909
31890
|
},
|
31910
31891
|
[setAreasWithZones]
|
31911
31892
|
);
|
31912
|
-
const registerZone = (0,
|
31893
|
+
const registerZone = (0, import_react23.useCallback)(
|
31913
31894
|
(zoneCompound) => {
|
31914
31895
|
if (!dispatch) {
|
31915
31896
|
return;
|
@@ -31922,7 +31903,7 @@ var DropZoneProvider = ({
|
|
31922
31903
|
},
|
31923
31904
|
[setActiveZones, dispatch]
|
31924
31905
|
);
|
31925
|
-
const unregisterZone = (0,
|
31906
|
+
const unregisterZone = (0, import_react23.useCallback)(
|
31926
31907
|
(zoneCompound) => {
|
31927
31908
|
if (!dispatch) {
|
31928
31909
|
return;
|
@@ -31937,8 +31918,8 @@ var DropZoneProvider = ({
|
|
31937
31918
|
},
|
31938
31919
|
[setActiveZones, dispatch]
|
31939
31920
|
);
|
31940
|
-
const [pathData, setPathData] = (0,
|
31941
|
-
const registerPath = (0,
|
31921
|
+
const [pathData, setPathData] = (0, import_react23.useState)();
|
31922
|
+
const registerPath = (0, import_react23.useCallback)(
|
31942
31923
|
(selector) => {
|
31943
31924
|
if (!(value == null ? void 0 : value.data)) {
|
31944
31925
|
return;
|
@@ -31963,7 +31944,7 @@ var DropZoneProvider = ({
|
|
31963
31944
|
},
|
31964
31945
|
[value, setPathData]
|
31965
31946
|
);
|
31966
|
-
return /* @__PURE__ */ (0,
|
31947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
31967
31948
|
dropZoneContext.Provider,
|
31968
31949
|
{
|
31969
31950
|
value: __spreadValues({
|
@@ -31988,7 +31969,7 @@ var DropZoneProvider = ({
|
|
31988
31969
|
|
31989
31970
|
// components/Puck/context.tsx
|
31990
31971
|
init_react_import();
|
31991
|
-
var
|
31972
|
+
var import_react24 = require("react");
|
31992
31973
|
var defaultAppState = {
|
31993
31974
|
data: { content: [], root: { title: "" } },
|
31994
31975
|
ui: {
|
@@ -31998,7 +31979,7 @@ var defaultAppState = {
|
|
31998
31979
|
componentList: {}
|
31999
31980
|
}
|
32000
31981
|
};
|
32001
|
-
var appContext = (0,
|
31982
|
+
var appContext = (0, import_react24.createContext)({
|
32002
31983
|
state: defaultAppState,
|
32003
31984
|
dispatch: () => null,
|
32004
31985
|
config: { components: {} },
|
@@ -32006,7 +31987,7 @@ var appContext = (0, import_react25.createContext)({
|
|
32006
31987
|
});
|
32007
31988
|
var AppProvider = appContext.Provider;
|
32008
31989
|
var useAppContext = () => {
|
32009
|
-
const mainContext = (0,
|
31990
|
+
const mainContext = (0, import_react24.useContext)(appContext);
|
32010
31991
|
const selectedItem = mainContext.state.ui.itemSelector ? getItem(mainContext.state.ui.itemSelector, mainContext.state.data) : void 0;
|
32011
31992
|
return __spreadProps(__spreadValues({}, mainContext), {
|
32012
31993
|
// Helpers
|
@@ -32022,12 +32003,12 @@ var useAppContext = () => {
|
|
32022
32003
|
};
|
32023
32004
|
|
32024
32005
|
// components/DropZone/index.tsx
|
32025
|
-
var
|
32006
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
32026
32007
|
var getClassName3 = get_class_name_factory_default("DropZone", styles_module_default2);
|
32027
32008
|
function DropZoneEdit({ zone, style }) {
|
32028
32009
|
var _a;
|
32029
32010
|
const appContext2 = useAppContext();
|
32030
|
-
const ctx = (0,
|
32011
|
+
const ctx = (0, import_react25.useContext)(dropZoneContext);
|
32031
32012
|
const {
|
32032
32013
|
// These all need setting via context
|
32033
32014
|
data,
|
@@ -32044,12 +32025,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32044
32025
|
} = ctx || {};
|
32045
32026
|
let content = data.content || [];
|
32046
32027
|
let zoneCompound = rootDroppableId;
|
32047
|
-
(0,
|
32028
|
+
(0, import_react25.useEffect)(() => {
|
32048
32029
|
if (areaId && registerZoneArea) {
|
32049
32030
|
registerZoneArea(areaId);
|
32050
32031
|
}
|
32051
32032
|
}, [areaId]);
|
32052
|
-
(0,
|
32033
|
+
(0, import_react25.useEffect)(() => {
|
32053
32034
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
32054
32035
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
32055
32036
|
}
|
@@ -32070,12 +32051,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32070
32051
|
const draggedDestinationId = draggedItem && ((_a = draggedItem.destination) == null ? void 0 : _a.droppableId);
|
32071
32052
|
const [zoneArea] = getZoneId(zoneCompound);
|
32072
32053
|
const [draggedSourceArea] = getZoneId(draggedSourceId);
|
32073
|
-
const [userWillDrag, setUserWillDrag] = (0,
|
32054
|
+
const [userWillDrag, setUserWillDrag] = (0, import_react25.useState)(false);
|
32074
32055
|
const userIsDragging = !!draggedItem;
|
32075
32056
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
32076
32057
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
32077
32058
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
32078
|
-
return /* @__PURE__ */ (0,
|
32059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: "DropZone requires context to work." });
|
32079
32060
|
}
|
32080
32061
|
const {
|
32081
32062
|
hoveringArea = "root",
|
@@ -32096,7 +32077,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32096
32077
|
}
|
32097
32078
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
32098
32079
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
32099
|
-
return /* @__PURE__ */ (0,
|
32080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32100
32081
|
"div",
|
32101
32082
|
{
|
32102
32083
|
className: getClassName3({
|
@@ -32110,14 +32091,14 @@ function DropZoneEdit({ zone, style }) {
|
|
32110
32091
|
isAreaSelected,
|
32111
32092
|
hasChildren: content.length > 0
|
32112
32093
|
}),
|
32113
|
-
children: /* @__PURE__ */ (0,
|
32114
|
-
|
32094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32095
|
+
import_dnd2.Droppable,
|
32115
32096
|
{
|
32116
32097
|
droppableId: zoneCompound,
|
32117
32098
|
direction: "vertical",
|
32118
32099
|
isDropDisabled: !isEnabled,
|
32119
32100
|
children: (provided, snapshot) => {
|
32120
|
-
return /* @__PURE__ */ (0,
|
32101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
32121
32102
|
"div",
|
32122
32103
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
32123
32104
|
className: getClassName3("content"),
|
@@ -32134,6 +32115,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32134
32115
|
var _a2, _b;
|
32135
32116
|
const componentId = item.props.id;
|
32136
32117
|
const defaultedProps = __spreadProps(__spreadValues(__spreadValues({}, (_a2 = config.components[item.type]) == null ? void 0 : _a2.defaultProps), item.props), {
|
32118
|
+
puck: { renderDropZone: DropZone },
|
32137
32119
|
editMode: true
|
32138
32120
|
});
|
32139
32121
|
const isSelected = (selectedItem == null ? void 0 : selectedItem.props.id) === componentId || false;
|
@@ -32141,23 +32123,23 @@ function DropZoneEdit({ zone, style }) {
|
|
32141
32123
|
"draggable-"
|
32142
32124
|
)[1] === componentId;
|
32143
32125
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
32144
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
32126
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
32145
32127
|
"No configuration for ",
|
32146
32128
|
item.type
|
32147
32129
|
] });
|
32148
|
-
return /* @__PURE__ */ (0,
|
32130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
32149
32131
|
"div",
|
32150
32132
|
{
|
32151
32133
|
className: getClassName3("item"),
|
32152
32134
|
style: { zIndex: isDragging ? 1 : void 0 },
|
32153
32135
|
children: [
|
32154
|
-
/* @__PURE__ */ (0,
|
32136
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32155
32137
|
DropZoneProvider,
|
32156
32138
|
{
|
32157
32139
|
value: __spreadProps(__spreadValues({}, ctx), {
|
32158
32140
|
areaId: componentId
|
32159
32141
|
}),
|
32160
|
-
children: /* @__PURE__ */ (0,
|
32142
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32161
32143
|
DraggableComponent,
|
32162
32144
|
{
|
32163
32145
|
label: item.type.toString(),
|
@@ -32228,12 +32210,12 @@ function DropZoneEdit({ zone, style }) {
|
|
32228
32210
|
style: {
|
32229
32211
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
32230
32212
|
},
|
32231
|
-
children: /* @__PURE__ */ (0,
|
32213
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { zoom: 0.75 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
32232
32214
|
}
|
32233
32215
|
)
|
32234
32216
|
}
|
32235
32217
|
),
|
32236
|
-
userIsDragging && /* @__PURE__ */ (0,
|
32218
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32237
32219
|
"div",
|
32238
32220
|
{
|
32239
32221
|
className: getClassName3("hitbox"),
|
@@ -32250,7 +32232,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32250
32232
|
);
|
32251
32233
|
}),
|
32252
32234
|
provided == null ? void 0 : provided.placeholder,
|
32253
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
32235
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32254
32236
|
"div",
|
32255
32237
|
{
|
32256
32238
|
"data-puck-placeholder": true,
|
@@ -32271,7 +32253,7 @@ function DropZoneEdit({ zone, style }) {
|
|
32271
32253
|
);
|
32272
32254
|
}
|
32273
32255
|
function DropZoneRender({ zone }) {
|
32274
|
-
const ctx = (0,
|
32256
|
+
const ctx = (0, import_react25.useContext)(dropZoneContext);
|
32275
32257
|
const { data, areaId = "root", config } = ctx || {};
|
32276
32258
|
let zoneCompound = rootDroppableId;
|
32277
32259
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -32282,14 +32264,19 @@ function DropZoneRender({ zone }) {
|
|
32282
32264
|
zoneCompound = `${areaId}:${zone}`;
|
32283
32265
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
32284
32266
|
}
|
32285
|
-
return /* @__PURE__ */ (0,
|
32267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: content.map((item) => {
|
32286
32268
|
const Component = config.components[item.type];
|
32287
32269
|
if (Component) {
|
32288
|
-
return /* @__PURE__ */ (0,
|
32270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32289
32271
|
DropZoneProvider,
|
32290
32272
|
{
|
32291
32273
|
value: { data, config, areaId: item.props.id },
|
32292
|
-
children: /* @__PURE__ */ (0,
|
32274
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
32275
|
+
Component.render,
|
32276
|
+
__spreadProps(__spreadValues({}, item.props), {
|
32277
|
+
puck: { renderDropZone: DropZone }
|
32278
|
+
})
|
32279
|
+
)
|
32293
32280
|
},
|
32294
32281
|
item.props.id
|
32295
32282
|
);
|
@@ -32298,11 +32285,11 @@ function DropZoneRender({ zone }) {
|
|
32298
32285
|
}) });
|
32299
32286
|
}
|
32300
32287
|
function DropZone(props) {
|
32301
|
-
const ctx = (0,
|
32288
|
+
const ctx = (0, import_react25.useContext)(dropZoneContext);
|
32302
32289
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
32303
|
-
return /* @__PURE__ */ (0,
|
32290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneEdit, __spreadValues({}, props));
|
32304
32291
|
}
|
32305
|
-
return /* @__PURE__ */ (0,
|
32292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropZoneRender, __spreadValues({}, props));
|
32306
32293
|
}
|
32307
32294
|
|
32308
32295
|
// components/IconButton/index.ts
|
@@ -32310,7 +32297,7 @@ init_react_import();
|
|
32310
32297
|
|
32311
32298
|
// components/IconButton/IconButton.tsx
|
32312
32299
|
init_react_import();
|
32313
|
-
var
|
32300
|
+
var import_react26 = require("react");
|
32314
32301
|
|
32315
32302
|
// css-module:/home/runner/work/puck/puck/packages/core/components/IconButton/IconButton.module.css#css-module
|
32316
32303
|
init_react_import();
|
@@ -32318,7 +32305,7 @@ var IconButton_module_default = { "IconButton": "_IconButton_13gzt_1" };
|
|
32318
32305
|
|
32319
32306
|
// components/IconButton/IconButton.tsx
|
32320
32307
|
var import_react_spinners3 = require("react-spinners");
|
32321
|
-
var
|
32308
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
32322
32309
|
var getClassName4 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
32323
32310
|
var IconButton = ({
|
32324
32311
|
children,
|
@@ -32332,9 +32319,9 @@ var IconButton = ({
|
|
32332
32319
|
fullWidth,
|
32333
32320
|
title
|
32334
32321
|
}) => {
|
32335
|
-
const [loading, setLoading] = (0,
|
32322
|
+
const [loading, setLoading] = (0, import_react26.useState)(false);
|
32336
32323
|
const ElementType = href ? "a" : "button";
|
32337
|
-
const el = /* @__PURE__ */ (0,
|
32324
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
32338
32325
|
ElementType,
|
32339
32326
|
{
|
32340
32327
|
className: getClassName4({
|
@@ -32360,9 +32347,9 @@ var IconButton = ({
|
|
32360
32347
|
title,
|
32361
32348
|
children: [
|
32362
32349
|
children,
|
32363
|
-
loading && /* @__PURE__ */ (0,
|
32350
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
32364
32351
|
"\xA0\xA0",
|
32365
|
-
/* @__PURE__ */ (0,
|
32352
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_spinners3.ClipLoader, { color: "inherit", size: "14px" })
|
32366
32353
|
] })
|
32367
32354
|
]
|
32368
32355
|
}
|
@@ -32373,14 +32360,14 @@ var IconButton = ({
|
|
32373
32360
|
// components/Puck/index.tsx
|
32374
32361
|
init_react_import();
|
32375
32362
|
var import_react39 = require("react");
|
32376
|
-
var
|
32363
|
+
var import_dnd7 = require("@hello-pangea/dnd");
|
32377
32364
|
|
32378
32365
|
// components/InputOrGroup/index.tsx
|
32379
32366
|
init_react_import();
|
32380
32367
|
|
32381
32368
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/styles.module.css#css-module
|
32382
32369
|
init_react_import();
|
32383
|
-
var styles_module_default3 = { "Input": "
|
32370
|
+
var styles_module_default3 = { "Input": "_Input_199j9_1", "Input-label": "_Input-label_199j9_27", "Input-labelIcon": "_Input-labelIcon_199j9_35", "Input-disabledIcon": "_Input-disabledIcon_199j9_41", "Input-input": "_Input-input_199j9_46", "Input--readOnly": "_Input--readOnly_199j9_68", "Input-radioGroupItems": "_Input-radioGroupItems_199j9_86", "Input-radio": "_Input-radio_199j9_86", "Input-radioInner": "_Input-radioInner_199j9_103", "Input-radioInput": "_Input-radioInput_199j9_125" };
|
32384
32371
|
|
32385
32372
|
// components/InputOrGroup/index.tsx
|
32386
32373
|
var import_react31 = require("react");
|
@@ -32393,15 +32380,16 @@ init_react_import();
|
|
32393
32380
|
|
32394
32381
|
// css-module:/home/runner/work/puck/puck/packages/core/components/InputOrGroup/fields/ArrayField/styles.module.css#css-module
|
32395
32382
|
init_react_import();
|
32396
|
-
var styles_module_default4 = { "ArrayField": "
|
32383
|
+
var styles_module_default4 = { "ArrayField": "_ArrayField_hsw7n_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_hsw7n_13", "ArrayField-addButton": "_ArrayField-addButton_hsw7n_17", "ArrayField--hasItems": "_ArrayField--hasItems_hsw7n_31", "ArrayFieldItem": "_ArrayFieldItem_hsw7n_45", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_hsw7n_53", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_hsw7n_58", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_hsw7n_73", "ArrayFieldItem--readOnly": "_ArrayFieldItem--readOnly_hsw7n_86", "ArrayFieldItem-body": "_ArrayFieldItem-body_hsw7n_107", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_hsw7n_115", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_hsw7n_122", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_hsw7n_128", "ArrayFieldItem-action": "_ArrayFieldItem-action_hsw7n_128" };
|
32397
32384
|
|
32398
32385
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32399
|
-
var
|
32386
|
+
var import_dnd4 = require("@hello-pangea/dnd");
|
32387
|
+
var import_dnd5 = require("@hello-pangea/dnd");
|
32400
32388
|
|
32401
32389
|
// components/Draggable/index.tsx
|
32402
32390
|
init_react_import();
|
32403
|
-
var
|
32404
|
-
var
|
32391
|
+
var import_dnd3 = require("@hello-pangea/dnd");
|
32392
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
32405
32393
|
var Draggable2 = ({
|
32406
32394
|
className,
|
32407
32395
|
children,
|
@@ -32411,16 +32399,16 @@ var Draggable2 = ({
|
|
32411
32399
|
disableAnimations = false,
|
32412
32400
|
isDragDisabled = false
|
32413
32401
|
}) => {
|
32414
|
-
return /* @__PURE__ */ (0,
|
32415
|
-
|
32402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
32403
|
+
import_dnd3.Draggable,
|
32416
32404
|
{
|
32417
32405
|
draggableId: id,
|
32418
32406
|
index,
|
32419
32407
|
isDragDisabled,
|
32420
32408
|
children: (provided, snapshot) => {
|
32421
32409
|
var _a;
|
32422
|
-
return /* @__PURE__ */ (0,
|
32423
|
-
/* @__PURE__ */ (0,
|
32410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
32411
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
32424
32412
|
"div",
|
32425
32413
|
__spreadProps(__spreadValues(__spreadValues({
|
32426
32414
|
className: className && className(provided, snapshot),
|
@@ -32432,7 +32420,7 @@ var Draggable2 = ({
|
|
32432
32420
|
children: children(provided, snapshot)
|
32433
32421
|
})
|
32434
32422
|
),
|
32435
|
-
showShadow && snapshot.isDragging && /* @__PURE__ */ (0,
|
32423
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
32436
32424
|
"div",
|
32437
32425
|
{
|
32438
32426
|
className: className && className(provided, snapshot),
|
@@ -32452,7 +32440,7 @@ var import_crypto = require("crypto");
|
|
32452
32440
|
var generateId = (type) => `${type}-${(0, import_crypto.randomBytes)(20).toString("hex")}`;
|
32453
32441
|
|
32454
32442
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32455
|
-
var
|
32443
|
+
var import_react27 = require("react");
|
32456
32444
|
|
32457
32445
|
// components/DragIcon/index.tsx
|
32458
32446
|
init_react_import();
|
@@ -32462,12 +32450,12 @@ init_react_import();
|
|
32462
32450
|
var styles_module_default5 = { "DragIcon": "_DragIcon_o29on_1" };
|
32463
32451
|
|
32464
32452
|
// components/DragIcon/index.tsx
|
32465
|
-
var
|
32453
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
32466
32454
|
var getClassName5 = get_class_name_factory_default("DragIcon", styles_module_default5);
|
32467
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
32455
|
+
var DragIcon = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName5(), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
|
32468
32456
|
|
32469
32457
|
// components/InputOrGroup/fields/ArrayField/index.tsx
|
32470
|
-
var
|
32458
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
32471
32459
|
var getClassName6 = get_class_name_factory_default("ArrayField", styles_module_default4);
|
32472
32460
|
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default4);
|
32473
32461
|
var ArrayField = ({
|
@@ -32479,32 +32467,39 @@ var ArrayField = ({
|
|
32479
32467
|
readOnly,
|
32480
32468
|
readOnlyFields = {}
|
32481
32469
|
}) => {
|
32482
|
-
const [arrayFieldId] = (0,
|
32470
|
+
const [arrayFieldId] = (0, import_react27.useState)(generateId("ArrayField"));
|
32483
32471
|
const { state, setUi } = useAppContext();
|
32484
|
-
const
|
32485
|
-
|
32486
|
-
|
32487
|
-
|
32488
|
-
}
|
32489
|
-
|
32490
|
-
|
32491
|
-
const setArrayState = (0,
|
32492
|
-
(
|
32472
|
+
const arrayStateRef = (0, import_react27.useRef)(
|
32473
|
+
state.ui.arrayState[arrayFieldId] || {
|
32474
|
+
items: [],
|
32475
|
+
openId: ""
|
32476
|
+
}
|
32477
|
+
);
|
32478
|
+
const arrayState = arrayStateRef.current;
|
32479
|
+
const setArrayState = (0, import_react27.useCallback)(
|
32480
|
+
(partialArrayState, recordHistory = false) => {
|
32493
32481
|
setUi(
|
32494
32482
|
{
|
32495
32483
|
arrayState: __spreadProps(__spreadValues({}, state.ui.arrayState), {
|
32496
|
-
[arrayFieldId]: __spreadValues(__spreadValues({}, arrayState),
|
32484
|
+
[arrayFieldId]: __spreadValues(__spreadValues({}, arrayState), partialArrayState)
|
32497
32485
|
})
|
32498
32486
|
},
|
32499
32487
|
recordHistory
|
32500
32488
|
);
|
32489
|
+
arrayStateRef.current = __spreadValues(__spreadValues({}, arrayState), partialArrayState);
|
32501
32490
|
},
|
32502
32491
|
[arrayState]
|
32503
32492
|
);
|
32504
|
-
(0,
|
32493
|
+
(0, import_react27.useEffect)(() => {
|
32494
|
+
let highestIndex = arrayState.items.reduce(
|
32495
|
+
(acc, item) => item._originalIndex > acc ? item._originalIndex : acc,
|
32496
|
+
-1
|
32497
|
+
);
|
32505
32498
|
const newItems = Array.from(value || []).map((item, idx) => {
|
32506
32499
|
var _a;
|
32500
|
+
const arrayStateItem = arrayState.items[idx];
|
32507
32501
|
return {
|
32502
|
+
_originalIndex: typeof (arrayStateItem == null ? void 0 : arrayStateItem._originalIndex) !== "undefined" ? arrayStateItem._originalIndex : ++highestIndex,
|
32508
32503
|
_arrayId: ((_a = arrayState.items[idx]) == null ? void 0 : _a._arrayId) || generateId("ArrayItem"),
|
32509
32504
|
data: item
|
32510
32505
|
};
|
@@ -32514,15 +32509,15 @@ var ArrayField = ({
|
|
32514
32509
|
if (field.type !== "array" || !field.arrayFields) {
|
32515
32510
|
return null;
|
32516
32511
|
}
|
32517
|
-
return /* @__PURE__ */ (0,
|
32512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32518
32513
|
FieldLabelInternal,
|
32519
32514
|
{
|
32520
32515
|
label: label || name,
|
32521
|
-
icon: /* @__PURE__ */ (0,
|
32516
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(list_default, { size: 16 }),
|
32522
32517
|
el: "div",
|
32523
32518
|
readOnly,
|
32524
|
-
children: /* @__PURE__ */ (0,
|
32525
|
-
|
32519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32520
|
+
import_dnd5.DragDropContext,
|
32526
32521
|
{
|
32527
32522
|
onDragEnd: (event) => {
|
32528
32523
|
var _a;
|
@@ -32536,8 +32531,8 @@ var ArrayField = ({
|
|
32536
32531
|
onChange(newValue.map(({ data }) => data));
|
32537
32532
|
}
|
32538
32533
|
},
|
32539
|
-
children: /* @__PURE__ */ (0,
|
32540
|
-
return /* @__PURE__ */ (0,
|
32534
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dnd4.Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
32535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32541
32536
|
"div",
|
32542
32537
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
32543
32538
|
ref: provided.innerRef,
|
@@ -32546,99 +32541,97 @@ var ArrayField = ({
|
|
32546
32541
|
hasItems: Array.isArray(value) && value.length > 0
|
32547
32542
|
}),
|
32548
32543
|
children: [
|
32549
|
-
|
32550
|
-
|
32551
|
-
|
32552
|
-
|
32553
|
-
|
32554
|
-
|
32555
|
-
|
32556
|
-
|
32557
|
-
|
32558
|
-
|
32559
|
-
|
32560
|
-
|
32561
|
-
|
32562
|
-
|
32563
|
-
|
32564
|
-
|
32565
|
-
|
32566
|
-
|
32567
|
-
|
32568
|
-
|
32569
|
-
|
32570
|
-
|
32571
|
-
|
32572
|
-
|
32573
|
-
|
32574
|
-
|
32575
|
-
|
32576
|
-
|
32577
|
-
|
32578
|
-
|
32579
|
-
|
32580
|
-
|
32581
|
-
{
|
32582
|
-
|
32583
|
-
|
32584
|
-
|
32585
|
-
|
32586
|
-
|
32587
|
-
|
32588
|
-
|
32589
|
-
|
32590
|
-
|
32591
|
-
|
32592
|
-
|
32593
|
-
|
32594
|
-
|
32595
|
-
|
32596
|
-
|
32597
|
-
|
32598
|
-
|
32599
|
-
|
32600
|
-
|
32601
|
-
|
32602
|
-
|
32603
|
-
|
32604
|
-
|
32605
|
-
|
32606
|
-
|
32607
|
-
|
32608
|
-
|
32609
|
-
|
32610
|
-
|
32611
|
-
|
32612
|
-
|
32613
|
-
|
32614
|
-
|
32615
|
-
|
32616
|
-
|
32617
|
-
|
32618
|
-
|
32619
|
-
|
32620
|
-
|
32621
|
-
|
32622
|
-
|
32623
|
-
|
32624
|
-
|
32625
|
-
|
32626
|
-
|
32627
|
-
|
32628
|
-
|
32629
|
-
|
32630
|
-
|
32631
|
-
|
32632
|
-
|
32633
|
-
|
32634
|
-
|
32635
|
-
|
32636
|
-
|
32637
|
-
|
32638
|
-
_arrayId
|
32639
|
-
)) : null,
|
32544
|
+
arrayState.items.map(({ data }, i) => {
|
32545
|
+
const { _arrayId, _originalIndex = i } = arrayState.items[i] || {};
|
32546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32547
|
+
Draggable2,
|
32548
|
+
{
|
32549
|
+
id: _arrayId,
|
32550
|
+
index: i,
|
32551
|
+
className: (_, snapshot2) => getClassNameItem({
|
32552
|
+
isExpanded: arrayState.openId === _arrayId,
|
32553
|
+
isDragging: snapshot2.isDragging,
|
32554
|
+
readOnly
|
32555
|
+
}),
|
32556
|
+
isDragDisabled: readOnly,
|
32557
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
32558
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
32559
|
+
"div",
|
32560
|
+
{
|
32561
|
+
onClick: () => {
|
32562
|
+
if (arrayState.openId === _arrayId) {
|
32563
|
+
setArrayState({
|
32564
|
+
openId: ""
|
32565
|
+
});
|
32566
|
+
} else {
|
32567
|
+
setArrayState({
|
32568
|
+
openId: _arrayId
|
32569
|
+
});
|
32570
|
+
}
|
32571
|
+
},
|
32572
|
+
className: getClassNameItem("summary"),
|
32573
|
+
children: [
|
32574
|
+
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
32575
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
32576
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32577
|
+
IconButton,
|
32578
|
+
{
|
32579
|
+
onClick: (e) => {
|
32580
|
+
e.stopPropagation();
|
32581
|
+
const existingValue = [
|
32582
|
+
...value || []
|
32583
|
+
];
|
32584
|
+
const existingItems = [
|
32585
|
+
...arrayState.items || []
|
32586
|
+
];
|
32587
|
+
existingValue.splice(i, 1);
|
32588
|
+
existingItems.splice(i, 1);
|
32589
|
+
setArrayState(
|
32590
|
+
{ items: existingItems },
|
32591
|
+
true
|
32592
|
+
);
|
32593
|
+
onChange(existingValue);
|
32594
|
+
},
|
32595
|
+
title: "Delete",
|
32596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(trash_default, { size: 16 })
|
32597
|
+
}
|
32598
|
+
) }) }),
|
32599
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DragIcon, {}) })
|
32600
|
+
] })
|
32601
|
+
]
|
32602
|
+
}
|
32603
|
+
),
|
32604
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
32605
|
+
(fieldName) => {
|
32606
|
+
const subField = field.arrayFields[fieldName];
|
32607
|
+
const subFieldName = `${name}[${i}].${fieldName}`;
|
32608
|
+
const wildcardFieldName = `${name}[*].${fieldName}`;
|
32609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32610
|
+
InputOrGroup,
|
32611
|
+
{
|
32612
|
+
name: subFieldName,
|
32613
|
+
label: subField.label || fieldName,
|
32614
|
+
readOnly: typeof readOnlyFields[subFieldName] !== "undefined" ? readOnlyFields[subFieldName] : readOnlyFields[wildcardFieldName],
|
32615
|
+
readOnlyFields,
|
32616
|
+
field: subField,
|
32617
|
+
value: data[fieldName],
|
32618
|
+
onChange: (val) => onChange(
|
32619
|
+
replace(value, i, __spreadProps(__spreadValues({}, data), {
|
32620
|
+
[fieldName]: val
|
32621
|
+
}))
|
32622
|
+
)
|
32623
|
+
},
|
32624
|
+
subFieldName
|
32625
|
+
);
|
32626
|
+
}
|
32627
|
+
) }) })
|
32628
|
+
] })
|
32629
|
+
},
|
32630
|
+
_arrayId
|
32631
|
+
);
|
32632
|
+
}),
|
32640
32633
|
provided.placeholder,
|
32641
|
-
/* @__PURE__ */ (0,
|
32634
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
32642
32635
|
"button",
|
32643
32636
|
{
|
32644
32637
|
className: getClassName6("addButton"),
|
@@ -32646,7 +32639,7 @@ var ArrayField = ({
|
|
32646
32639
|
const existingValue = value || [];
|
32647
32640
|
onChange([...existingValue, field.defaultItemProps || {}]);
|
32648
32641
|
},
|
32649
|
-
children: /* @__PURE__ */ (0,
|
32642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(plus_default, { size: "21" })
|
32650
32643
|
}
|
32651
32644
|
)
|
32652
32645
|
]
|
@@ -32661,7 +32654,7 @@ var ArrayField = ({
|
|
32661
32654
|
|
32662
32655
|
// components/InputOrGroup/fields/DefaultField/index.tsx
|
32663
32656
|
init_react_import();
|
32664
|
-
var
|
32657
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
32665
32658
|
var getClassName7 = get_class_name_factory_default("Input", styles_module_default3);
|
32666
32659
|
var DefaultField = ({
|
32667
32660
|
field,
|
@@ -32671,16 +32664,16 @@ var DefaultField = ({
|
|
32671
32664
|
name,
|
32672
32665
|
label
|
32673
32666
|
}) => {
|
32674
|
-
return /* @__PURE__ */ (0,
|
32667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
32675
32668
|
FieldLabelInternal,
|
32676
32669
|
{
|
32677
32670
|
label: label || name,
|
32678
|
-
icon: /* @__PURE__ */ (0,
|
32679
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
32680
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
32671
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
32672
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(type_default, { size: 16 }),
|
32673
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(hash_default, { size: 16 })
|
32681
32674
|
] }),
|
32682
32675
|
readOnly,
|
32683
|
-
children: /* @__PURE__ */ (0,
|
32676
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
32684
32677
|
"input",
|
32685
32678
|
{
|
32686
32679
|
className: getClassName7("input"),
|
@@ -32712,10 +32705,11 @@ var import_react29 = require("react");
|
|
32712
32705
|
|
32713
32706
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
32714
32707
|
init_react_import();
|
32715
|
-
var styles_module_default6 = { "ExternalInput": "
|
32708
|
+
var styles_module_default6 = { "ExternalInput": "_ExternalInput_157li_1", "ExternalInput-actions": "_ExternalInput-actions_157li_5", "ExternalInput-button": "_ExternalInput-button_157li_9", "ExternalInput-detachButton": "_ExternalInput-detachButton_157li_28", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_157li_35", "ExternalInputModal": "_ExternalInputModal_157li_56", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_157li_63", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_157li_68", "ExternalInputModal-table": "_ExternalInputModal-table_157li_68", "ExternalInputModal-thead": "_ExternalInputModal-thead_157li_83", "ExternalInputModal-th": "_ExternalInputModal-th_157li_83", "ExternalInputModal-td": "_ExternalInputModal-td_157li_97", "ExternalInputModal-tr": "_ExternalInputModal-tr_157li_102", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_157li_114", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_157li_133", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_157li_137", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_157li_145", "ExternalInputModal-noContentBanner": "_ExternalInputModal-noContentBanner_157li_149", "ExternalInputModal--loaded": "_ExternalInputModal--loaded_157li_153" };
|
32716
32709
|
|
32717
32710
|
// components/Modal/index.tsx
|
32718
32711
|
init_react_import();
|
32712
|
+
var import_react28 = require("react");
|
32719
32713
|
|
32720
32714
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
32721
32715
|
init_react_import();
|
@@ -32723,19 +32717,22 @@ var styles_module_default7 = { "Modal": "_Modal_hx2u6_1", "Modal--isOpen": "_Mod
|
|
32723
32717
|
|
32724
32718
|
// components/Modal/index.tsx
|
32725
32719
|
var import_react_dom = __toESM(require_react_dom());
|
32726
|
-
var
|
32720
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
32727
32721
|
var getClassName8 = get_class_name_factory_default("Modal", styles_module_default7);
|
32728
32722
|
var Modal = ({
|
32729
32723
|
children,
|
32730
32724
|
onClose,
|
32731
32725
|
isOpen
|
32732
32726
|
}) => {
|
32733
|
-
const rootEl =
|
32727
|
+
const [rootEl, setRootEl] = (0, import_react28.useState)(null);
|
32728
|
+
(0, import_react28.useEffect)(() => {
|
32729
|
+
setRootEl(document.getElementById("puck-portal-root"));
|
32730
|
+
}, []);
|
32734
32731
|
if (!rootEl) {
|
32735
|
-
return /* @__PURE__ */ (0,
|
32732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", {});
|
32736
32733
|
}
|
32737
32734
|
return (0, import_react_dom.createPortal)(
|
32738
|
-
/* @__PURE__ */ (0,
|
32735
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getClassName8({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
32739
32736
|
"div",
|
32740
32737
|
{
|
32741
32738
|
className: getClassName8("inner"),
|
@@ -32755,11 +32752,11 @@ init_react_import();
|
|
32755
32752
|
var styles_module_default8 = { "Heading": "_Heading_1bvy5_1", "Heading--xxxxl": "_Heading--xxxxl_1bvy5_13", "Heading--xxxl": "_Heading--xxxl_1bvy5_19", "Heading--xxl": "_Heading--xxl_1bvy5_23", "Heading--xl": "_Heading--xl_1bvy5_27", "Heading--l": "_Heading--l_1bvy5_31", "Heading--m": "_Heading--m_1bvy5_35", "Heading--s": "_Heading--s_1bvy5_39", "Heading--xs": "_Heading--xs_1bvy5_43" };
|
32756
32753
|
|
32757
32754
|
// components/Heading/index.tsx
|
32758
|
-
var
|
32755
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
32759
32756
|
var getClassName9 = get_class_name_factory_default("Heading", styles_module_default8);
|
32760
32757
|
var Heading = ({ children, rank, size = "m" }) => {
|
32761
32758
|
const Tag = rank ? `h${rank}` : "span";
|
32762
|
-
return /* @__PURE__ */ (0,
|
32759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
32763
32760
|
Tag,
|
32764
32761
|
{
|
32765
32762
|
className: getClassName9({
|
@@ -32772,7 +32769,7 @@ var Heading = ({ children, rank, size = "m" }) => {
|
|
32772
32769
|
|
32773
32770
|
// components/ExternalInput/index.tsx
|
32774
32771
|
var import_react_spinners4 = require("react-spinners");
|
32775
|
-
var
|
32772
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
32776
32773
|
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
32777
32774
|
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
32778
32775
|
var dataCache = {};
|
@@ -32807,7 +32804,7 @@ var ExternalInput = ({
|
|
32807
32804
|
}
|
32808
32805
|
}))();
|
32809
32806
|
}, []);
|
32810
|
-
return /* @__PURE__ */ (0,
|
32807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
32811
32808
|
"div",
|
32812
32809
|
{
|
32813
32810
|
className: getClassName10({
|
@@ -32815,30 +32812,30 @@ var ExternalInput = ({
|
|
32815
32812
|
modalVisible: isOpen
|
32816
32813
|
}),
|
32817
32814
|
children: [
|
32818
|
-
/* @__PURE__ */ (0,
|
32819
|
-
/* @__PURE__ */ (0,
|
32815
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName10("actions"), children: [
|
32816
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32820
32817
|
"button",
|
32821
32818
|
{
|
32822
32819
|
onClick: () => setOpen(true),
|
32823
32820
|
className: getClassName10("button"),
|
32824
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
32825
|
-
/* @__PURE__ */ (0,
|
32826
|
-
/* @__PURE__ */ (0,
|
32821
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
32822
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(link_default, { size: "16" }),
|
32823
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: field.placeholder })
|
32827
32824
|
] })
|
32828
32825
|
}
|
32829
32826
|
),
|
32830
|
-
value && /* @__PURE__ */ (0,
|
32827
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32831
32828
|
"button",
|
32832
32829
|
{
|
32833
32830
|
className: getClassName10("detachButton"),
|
32834
32831
|
onClick: () => {
|
32835
32832
|
onChange(null);
|
32836
32833
|
},
|
32837
|
-
children: /* @__PURE__ */ (0,
|
32834
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(unlock_default, { size: 16 })
|
32838
32835
|
}
|
32839
32836
|
)
|
32840
32837
|
] }),
|
32841
|
-
/* @__PURE__ */ (0,
|
32838
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
32842
32839
|
"div",
|
32843
32840
|
{
|
32844
32841
|
className: getClassNameModal({
|
@@ -32847,9 +32844,9 @@ var ExternalInput = ({
|
|
32847
32844
|
hasData: !!data
|
32848
32845
|
}),
|
32849
32846
|
children: [
|
32850
|
-
/* @__PURE__ */ (0,
|
32851
|
-
/* @__PURE__ */ (0,
|
32852
|
-
/* @__PURE__ */ (0,
|
32847
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("masthead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { rank: 2, size: "xxl", children: "Select content" }) }),
|
32848
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("tableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { className: getClassNameModal("table"), children: [
|
32849
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32853
32850
|
"th",
|
32854
32851
|
{
|
32855
32852
|
className: getClassNameModal("th"),
|
@@ -32858,8 +32855,8 @@ var ExternalInput = ({
|
|
32858
32855
|
},
|
32859
32856
|
key
|
32860
32857
|
)) }) }),
|
32861
|
-
/* @__PURE__ */ (0,
|
32862
|
-
return /* @__PURE__ */ (0,
|
32858
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: getClassNameModal("tbody"), children: data.map((item, i) => {
|
32859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
32863
32860
|
"tr",
|
32864
32861
|
{
|
32865
32862
|
style: { whiteSpace: "nowrap" },
|
@@ -32868,14 +32865,14 @@ var ExternalInput = ({
|
|
32868
32865
|
onChange(mapProp(item));
|
32869
32866
|
setOpen(false);
|
32870
32867
|
},
|
32871
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
32868
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
32872
32869
|
},
|
32873
32870
|
i
|
32874
32871
|
);
|
32875
32872
|
}) })
|
32876
32873
|
] }) }),
|
32877
|
-
/* @__PURE__ */ (0,
|
32878
|
-
/* @__PURE__ */ (0,
|
32874
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("noContentBanner"), children: "No content" }),
|
32875
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_spinners4.ClipLoader, { size: 24 }) })
|
32879
32876
|
]
|
32880
32877
|
}
|
32881
32878
|
) })
|
@@ -32885,7 +32882,7 @@ var ExternalInput = ({
|
|
32885
32882
|
};
|
32886
32883
|
|
32887
32884
|
// components/InputOrGroup/fields/ExternalField/index.tsx
|
32888
|
-
var
|
32885
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
32889
32886
|
var ExternalField = ({
|
32890
32887
|
field,
|
32891
32888
|
onChange,
|
@@ -32906,19 +32903,19 @@ var ExternalField = ({
|
|
32906
32903
|
if (field.type !== "external") {
|
32907
32904
|
return null;
|
32908
32905
|
}
|
32909
|
-
return /* @__PURE__ */ (0,
|
32906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
32910
32907
|
FieldLabelInternal,
|
32911
32908
|
{
|
32912
32909
|
label: label || name,
|
32913
|
-
icon: /* @__PURE__ */ (0,
|
32910
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(link_default, { size: 16 }),
|
32914
32911
|
el: "div",
|
32915
|
-
children: /* @__PURE__ */ (0,
|
32912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
32916
32913
|
ExternalInput,
|
32917
32914
|
{
|
32918
32915
|
name,
|
32919
32916
|
field: __spreadProps(__spreadValues({}, validField), {
|
32920
32917
|
// DEPRECATED
|
32921
|
-
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder,
|
32918
|
+
placeholder: ((_a = deprecatedField.adaptor) == null ? void 0 : _a.name) ? `Select from ${deprecatedField.adaptor.name}` : validField.placeholder || "Select data",
|
32922
32919
|
mapProp: ((_b = deprecatedField.adaptor) == null ? void 0 : _b.mapProp) || validField.mapProp,
|
32923
32920
|
fetchList: ((_c = deprecatedField.adaptor) == null ? void 0 : _c.fetchList) ? () => __async(void 0, null, function* () {
|
32924
32921
|
return yield deprecatedField.adaptor.fetchList(
|
@@ -32936,7 +32933,7 @@ var ExternalField = ({
|
|
32936
32933
|
|
32937
32934
|
// components/InputOrGroup/fields/RadioField/index.tsx
|
32938
32935
|
init_react_import();
|
32939
|
-
var
|
32936
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
32940
32937
|
var getClassName11 = get_class_name_factory_default("Input", styles_module_default3);
|
32941
32938
|
var RadioField = ({
|
32942
32939
|
field,
|
@@ -32948,19 +32945,19 @@ var RadioField = ({
|
|
32948
32945
|
if (field.type !== "radio" || !field.options) {
|
32949
32946
|
return null;
|
32950
32947
|
}
|
32951
|
-
return /* @__PURE__ */ (0,
|
32948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
32952
32949
|
FieldLabelInternal,
|
32953
32950
|
{
|
32954
|
-
icon: /* @__PURE__ */ (0,
|
32951
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(check_circle_default, { size: 16 }),
|
32955
32952
|
label: field.label || name,
|
32956
32953
|
readOnly,
|
32957
32954
|
el: "div",
|
32958
|
-
children: /* @__PURE__ */ (0,
|
32955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioGroupItems"), children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
32959
32956
|
"label",
|
32960
32957
|
{
|
32961
32958
|
className: getClassName11("radio"),
|
32962
32959
|
children: [
|
32963
|
-
/* @__PURE__ */ (0,
|
32960
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
32964
32961
|
"input",
|
32965
32962
|
{
|
32966
32963
|
type: "radio",
|
@@ -32978,7 +32975,7 @@ var RadioField = ({
|
|
32978
32975
|
defaultChecked: value === option.value
|
32979
32976
|
}
|
32980
32977
|
),
|
32981
|
-
/* @__PURE__ */ (0,
|
32978
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
32982
32979
|
]
|
32983
32980
|
},
|
32984
32981
|
option.label + option.value
|
@@ -32989,7 +32986,7 @@ var RadioField = ({
|
|
32989
32986
|
|
32990
32987
|
// components/InputOrGroup/fields/SelectField/index.tsx
|
32991
32988
|
init_react_import();
|
32992
|
-
var
|
32989
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
32993
32990
|
var getClassName12 = get_class_name_factory_default("Input", styles_module_default3);
|
32994
32991
|
var SelectField = ({
|
32995
32992
|
field,
|
@@ -33002,13 +32999,13 @@ var SelectField = ({
|
|
33002
32999
|
if (field.type !== "select" || !field.options) {
|
33003
33000
|
return null;
|
33004
33001
|
}
|
33005
|
-
return /* @__PURE__ */ (0,
|
33002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
33006
33003
|
FieldLabelInternal,
|
33007
33004
|
{
|
33008
33005
|
label: label || name,
|
33009
|
-
icon: /* @__PURE__ */ (0,
|
33006
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(chevron_down_default, { size: 16 }),
|
33010
33007
|
readOnly,
|
33011
|
-
children: /* @__PURE__ */ (0,
|
33008
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
33012
33009
|
"select",
|
33013
33010
|
{
|
33014
33011
|
className: getClassName12("input"),
|
@@ -33021,7 +33018,7 @@ var SelectField = ({
|
|
33021
33018
|
onChange(e.currentTarget.value);
|
33022
33019
|
},
|
33023
33020
|
value,
|
33024
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
33021
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
33025
33022
|
"option",
|
33026
33023
|
{
|
33027
33024
|
label: option.label,
|
@@ -33037,7 +33034,7 @@ var SelectField = ({
|
|
33037
33034
|
|
33038
33035
|
// components/InputOrGroup/fields/TextareaField/index.tsx
|
33039
33036
|
init_react_import();
|
33040
|
-
var
|
33037
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
33041
33038
|
var getClassName13 = get_class_name_factory_default("Input", styles_module_default3);
|
33042
33039
|
var TextareaField = ({
|
33043
33040
|
onChange,
|
@@ -33046,13 +33043,13 @@ var TextareaField = ({
|
|
33046
33043
|
name,
|
33047
33044
|
label
|
33048
33045
|
}) => {
|
33049
|
-
return /* @__PURE__ */ (0,
|
33046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
33050
33047
|
FieldLabelInternal,
|
33051
33048
|
{
|
33052
33049
|
label: label || name,
|
33053
|
-
icon: /* @__PURE__ */ (0,
|
33050
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(type_default, { size: 16 }),
|
33054
33051
|
readOnly,
|
33055
|
-
children: /* @__PURE__ */ (0,
|
33052
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
33056
33053
|
"textarea",
|
33057
33054
|
{
|
33058
33055
|
className: getClassName13("input"),
|
@@ -33070,7 +33067,7 @@ var TextareaField = ({
|
|
33070
33067
|
|
33071
33068
|
// components/InputOrGroup/index.tsx
|
33072
33069
|
var import_use_debounce2 = require("use-debounce");
|
33073
|
-
var
|
33070
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
33074
33071
|
var getClassName14 = get_class_name_factory_default("Input", styles_module_default3);
|
33075
33072
|
var FieldLabel = ({
|
33076
33073
|
children,
|
@@ -33081,11 +33078,11 @@ var FieldLabel = ({
|
|
33081
33078
|
className
|
33082
33079
|
}) => {
|
33083
33080
|
const El = el;
|
33084
|
-
return /* @__PURE__ */ (0,
|
33085
|
-
/* @__PURE__ */ (0,
|
33086
|
-
icon ? /* @__PURE__ */ (0,
|
33081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(El, { className, children: [
|
33082
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: getClassName14("label"), children: [
|
33083
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, {}),
|
33087
33084
|
label,
|
33088
|
-
readOnly && /* @__PURE__ */ (0,
|
33085
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(lock_default, { size: "12" }) })
|
33089
33086
|
] }),
|
33090
33087
|
children
|
33091
33088
|
] });
|
@@ -33098,7 +33095,7 @@ var FieldLabelInternal = ({
|
|
33098
33095
|
readOnly
|
33099
33096
|
}) => {
|
33100
33097
|
const El = el;
|
33101
|
-
return /* @__PURE__ */ (0,
|
33098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
33102
33099
|
FieldLabel,
|
33103
33100
|
{
|
33104
33101
|
label,
|
@@ -33133,42 +33130,43 @@ var InputOrGroup = (_a) => {
|
|
33133
33130
|
onChange: onChangeLocal
|
33134
33131
|
};
|
33135
33132
|
if (field.type === "array") {
|
33136
|
-
return /* @__PURE__ */ (0,
|
33133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ArrayField, __spreadValues(__spreadValues({}, props), localProps));
|
33137
33134
|
}
|
33138
33135
|
if (field.type === "external") {
|
33139
|
-
return /* @__PURE__ */ (0,
|
33136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ExternalField, __spreadValues(__spreadValues({}, props), localProps));
|
33140
33137
|
}
|
33141
33138
|
if (field.type === "select") {
|
33142
|
-
return /* @__PURE__ */ (0,
|
33139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SelectField, __spreadValues(__spreadValues({}, props), localProps));
|
33143
33140
|
}
|
33144
33141
|
if (field.type === "textarea") {
|
33145
|
-
return /* @__PURE__ */ (0,
|
33142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextareaField, __spreadValues(__spreadValues({}, props), localProps));
|
33146
33143
|
}
|
33147
33144
|
if (field.type === "radio") {
|
33148
|
-
return /* @__PURE__ */ (0,
|
33145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RadioField, __spreadValues(__spreadValues({}, props), localProps));
|
33149
33146
|
}
|
33150
33147
|
if (field.type === "custom") {
|
33151
33148
|
if (!field.render) {
|
33152
33149
|
return null;
|
33153
33150
|
}
|
33154
|
-
return /* @__PURE__ */ (0,
|
33151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: getClassName14(), children: field.render(__spreadValues({
|
33155
33152
|
field,
|
33156
33153
|
name,
|
33157
33154
|
readOnly
|
33158
33155
|
}, localProps)) });
|
33159
33156
|
}
|
33160
|
-
return /* @__PURE__ */ (0,
|
33157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DefaultField, __spreadValues(__spreadValues({}, props), localProps));
|
33161
33158
|
};
|
33162
33159
|
|
33163
33160
|
// components/ComponentList/index.tsx
|
33164
33161
|
init_react_import();
|
33162
|
+
var import_dnd6 = require("@hello-pangea/dnd");
|
33165
33163
|
|
33166
33164
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
33167
33165
|
init_react_import();
|
33168
|
-
var styles_module_default9 = { "ComponentList": "
|
33166
|
+
var styles_module_default9 = { "ComponentList": "_ComponentList_1m8r5_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1m8r5_6", "ComponentList-content": "_ComponentList-content_1m8r5_10", "ComponentList-title": "_ComponentList-title_1m8r5_18", "ComponentList-titleIcon": "_ComponentList-titleIcon_1m8r5_39", "ComponentListItem": "_ComponentListItem_1m8r5_43", "ComponentListItem-draggable": "_ComponentListItem-draggable_1m8r5_43", "ComponentListItem-name": "_ComponentListItem-name_1m8r5_60", "ComponentList--isDraggingFrom": "_ComponentList--isDraggingFrom_1m8r5_66" };
|
33169
33167
|
|
33170
33168
|
// components/ComponentList/index.tsx
|
33171
|
-
var
|
33169
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
33172
33170
|
var getClassName15 = get_class_name_factory_default("ComponentList", styles_module_default9);
|
33173
33171
|
var getClassNameItem2 = get_class_name_factory_default("ComponentListItem", styles_module_default9);
|
33174
33172
|
var ComponentListItem = ({
|
@@ -33176,7 +33174,7 @@ var ComponentListItem = ({
|
|
33176
33174
|
index,
|
33177
33175
|
id
|
33178
33176
|
}) => {
|
33179
|
-
return /* @__PURE__ */ (0,
|
33177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33180
33178
|
Draggable2,
|
33181
33179
|
{
|
33182
33180
|
id,
|
@@ -33184,9 +33182,9 @@ var ComponentListItem = ({
|
|
33184
33182
|
showShadow: true,
|
33185
33183
|
disableAnimations: true,
|
33186
33184
|
className: () => getClassNameItem2("draggable"),
|
33187
|
-
children: () => /* @__PURE__ */ (0,
|
33188
|
-
component,
|
33189
|
-
/* @__PURE__ */ (0,
|
33185
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
|
33186
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("name"), children: component }),
|
33187
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragIcon, {}) })
|
33190
33188
|
] })
|
33191
33189
|
},
|
33192
33190
|
component
|
@@ -33199,8 +33197,8 @@ var ComponentList = ({
|
|
33199
33197
|
}) => {
|
33200
33198
|
const { config, state, setUi } = useAppContext();
|
33201
33199
|
const { expanded = true } = state.ui.componentList[id] || {};
|
33202
|
-
return /* @__PURE__ */ (0,
|
33203
|
-
title && /* @__PURE__ */ (0,
|
33200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: getClassName15({ isExpanded: expanded }), children: [
|
33201
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
33204
33202
|
"div",
|
33205
33203
|
{
|
33206
33204
|
className: getClassName15("title"),
|
@@ -33213,17 +33211,17 @@ var ComponentList = ({
|
|
33213
33211
|
}),
|
33214
33212
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
33215
33213
|
children: [
|
33216
|
-
/* @__PURE__ */ (0,
|
33217
|
-
/* @__PURE__ */ (0,
|
33214
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: title }),
|
33215
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(chevron_up_default, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(chevron_down_default, { size: 12 }) })
|
33218
33216
|
]
|
33219
33217
|
}
|
33220
33218
|
),
|
33221
|
-
/* @__PURE__ */ (0,
|
33222
|
-
|
33219
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getClassName15("content"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33220
|
+
import_dnd6.Droppable,
|
33223
33221
|
{
|
33224
33222
|
droppableId: `component-list${title ? `:${title}` : ""}`,
|
33225
33223
|
isDropDisabled: true,
|
33226
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
33224
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
33227
33225
|
"div",
|
33228
33226
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
33229
33227
|
ref: provided.innerRef,
|
@@ -33232,7 +33230,7 @@ var ComponentList = ({
|
|
33232
33230
|
}),
|
33233
33231
|
children: [
|
33234
33232
|
children || Object.keys(config.components).map((componentKey, i) => {
|
33235
|
-
return /* @__PURE__ */ (0,
|
33233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
33236
33234
|
ComponentListItem,
|
33237
33235
|
{
|
33238
33236
|
component: componentKey,
|
@@ -33242,7 +33240,7 @@ var ComponentList = ({
|
|
33242
33240
|
componentKey
|
33243
33241
|
);
|
33244
33242
|
}),
|
33245
|
-
/* @__PURE__ */ (0,
|
33243
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
33246
33244
|
]
|
33247
33245
|
})
|
33248
33246
|
)
|
@@ -33256,7 +33254,7 @@ ComponentList.Item = ComponentListItem;
|
|
33256
33254
|
init_react_import();
|
33257
33255
|
var import_react32 = require("react");
|
33258
33256
|
var usePlaceholderStyle = () => {
|
33259
|
-
const queryAttr = "data-
|
33257
|
+
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
33260
33258
|
const [placeholderStyle, setPlaceholderStyle] = (0, import_react32.useState)();
|
33261
33259
|
const onDragStartOrUpdate = (draggedItem) => {
|
33262
33260
|
var _a;
|
@@ -33269,7 +33267,7 @@ var usePlaceholderStyle = () => {
|
|
33269
33267
|
return;
|
33270
33268
|
}
|
33271
33269
|
const targetListElement = document.querySelector(
|
33272
|
-
`[data-
|
33270
|
+
`[data-rfd-droppable-id='${droppableId}']`
|
33273
33271
|
);
|
33274
33272
|
const { clientHeight } = draggedDOM;
|
33275
33273
|
if (!targetListElement) {
|
@@ -33280,7 +33278,7 @@ var usePlaceholderStyle = () => {
|
|
33280
33278
|
if (destinationIndex > 0) {
|
33281
33279
|
const end = destinationIndex > draggedItem.source.index && isSameDroppable ? destinationIndex + 1 : destinationIndex;
|
33282
33280
|
const children = Array.from(targetListElement.children).filter(
|
33283
|
-
(item) => item !== draggedDOM && item.getAttributeNames().indexOf("data-puck-placeholder") === -1 && item.getAttributeNames().indexOf("data-
|
33281
|
+
(item) => item !== draggedDOM && item.getAttributeNames().indexOf("data-puck-placeholder") === -1 && item.getAttributeNames().indexOf("data-rfd-placeholder-context-id") === -1
|
33284
33282
|
).slice(0, end);
|
33285
33283
|
clientY = children.reduce(
|
33286
33284
|
(total, item) => total + item.clientHeight + parseInt(window.getComputedStyle(item).marginTop.replace("px", "")) + parseInt(
|
@@ -33305,7 +33303,7 @@ init_react_import();
|
|
33305
33303
|
|
33306
33304
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
33307
33305
|
init_react_import();
|
33308
|
-
var styles_module_default10 = { "SidebarSection": "
|
33306
|
+
var styles_module_default10 = { "SidebarSection": "_SidebarSection_1uyg2_1", "SidebarSection-title": "_SidebarSection-title_1uyg2_12", "SidebarSection-content": "_SidebarSection-content_1uyg2_19", "SidebarSection--noPadding": "_SidebarSection--noPadding_1uyg2_24", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_1uyg2_37", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_1uyg2_48", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_1uyg2_37", "SidebarSection-heading": "_SidebarSection-heading_1uyg2_60", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_1uyg2_64" };
|
33309
33307
|
|
33310
33308
|
// lib/use-breadcrumbs.ts
|
33311
33309
|
init_react_import();
|
@@ -33375,7 +33373,7 @@ var useBreadcrumbs = (renderCount) => {
|
|
33375
33373
|
|
33376
33374
|
// components/SidebarSection/index.tsx
|
33377
33375
|
var import_react_spinners5 = require("react-spinners");
|
33378
|
-
var
|
33376
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
33379
33377
|
var getClassName16 = get_class_name_factory_default("SidebarSection", styles_module_default10);
|
33380
33378
|
var SidebarSection = ({
|
33381
33379
|
children,
|
@@ -33387,10 +33385,10 @@ var SidebarSection = ({
|
|
33387
33385
|
}) => {
|
33388
33386
|
const { setUi } = useAppContext();
|
33389
33387
|
const breadcrumbs = useBreadcrumbs(1);
|
33390
|
-
return /* @__PURE__ */ (0,
|
33391
|
-
/* @__PURE__ */ (0,
|
33392
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
33393
|
-
/* @__PURE__ */ (0,
|
33388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16({ noPadding }), style: { background }, children: [
|
33389
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("title"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumbs"), children: [
|
33390
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: getClassName16("breadcrumb"), children: [
|
33391
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
33394
33392
|
"div",
|
33395
33393
|
{
|
33396
33394
|
className: getClassName16("breadcrumbLabel"),
|
@@ -33398,12 +33396,12 @@ var SidebarSection = ({
|
|
33398
33396
|
children: breadcrumb.label
|
33399
33397
|
}
|
33400
33398
|
),
|
33401
|
-
/* @__PURE__ */ (0,
|
33399
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(chevron_right_default, { size: 16 })
|
33402
33400
|
] }, i)) : null,
|
33403
|
-
/* @__PURE__ */ (0,
|
33401
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
33404
33402
|
] }) }),
|
33405
|
-
/* @__PURE__ */ (0,
|
33406
|
-
isLoading && /* @__PURE__ */ (0,
|
33403
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("content"), children }),
|
33404
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName16("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_spinners5.ClipLoader, {}) })
|
33407
33405
|
] });
|
33408
33406
|
};
|
33409
33407
|
|
@@ -33841,7 +33839,7 @@ init_react_import();
|
|
33841
33839
|
|
33842
33840
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
33843
33841
|
init_react_import();
|
33844
|
-
var styles_module_default11 = { "LayerTree": "
|
33842
|
+
var styles_module_default11 = { "LayerTree": "_LayerTree_o89yt_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_o89yt_11", "LayerTree-helper": "_LayerTree-helper_o89yt_17", "Layer": "_Layer_o89yt_1", "Layer-inner": "_Layer-inner_o89yt_29", "Layer--containsZone": "_Layer--containsZone_o89yt_35", "Layer-clickable": "_Layer-clickable_o89yt_39", "Layer--isSelected": "_Layer--isSelected_o89yt_48", "Layer--isHovering": "_Layer--isHovering_o89yt_49", "Layer-chevron": "_Layer-chevron_o89yt_65", "Layer--childIsSelected": "_Layer--childIsSelected_o89yt_66", "Layer-zones": "_Layer-zones_o89yt_70", "Layer-title": "_Layer-title_o89yt_84", "Layer-name": "_Layer-name_o89yt_93", "Layer-icon": "_Layer-icon_o89yt_99", "Layer-zoneIcon": "_Layer-zoneIcon_o89yt_104" };
|
33845
33843
|
|
33846
33844
|
// lib/scroll-into-view.ts
|
33847
33845
|
init_react_import();
|
@@ -33881,7 +33879,7 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
33881
33879
|
};
|
33882
33880
|
|
33883
33881
|
// components/LayerTree/index.tsx
|
33884
|
-
var
|
33882
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
33885
33883
|
var getClassName17 = get_class_name_factory_default("LayerTree", styles_module_default11);
|
33886
33884
|
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default11);
|
33887
33885
|
var LayerTree = ({
|
@@ -33894,14 +33892,14 @@ var LayerTree = ({
|
|
33894
33892
|
}) => {
|
33895
33893
|
const zones = data.zones || {};
|
33896
33894
|
const ctx = (0, import_react36.useContext)(dropZoneContext);
|
33897
|
-
return /* @__PURE__ */ (0,
|
33898
|
-
label && /* @__PURE__ */ (0,
|
33899
|
-
/* @__PURE__ */ (0,
|
33895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
33896
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName17("zoneTitle"), children: [
|
33897
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(layers_default, { size: "16" }) }),
|
33900
33898
|
" ",
|
33901
33899
|
label
|
33902
33900
|
] }),
|
33903
|
-
/* @__PURE__ */ (0,
|
33904
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
33901
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("ul", { className: getClassName17(), children: [
|
33902
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName17("helper"), children: "No items" }),
|
33905
33903
|
zoneContent.map((item, i) => {
|
33906
33904
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
33907
33905
|
const zonesForItem = findZonesForArea(data, item.props.id);
|
@@ -33916,7 +33914,7 @@ var LayerTree = ({
|
|
33916
33914
|
const selectedItem = itemSelector && data ? getItem(itemSelector, data) : null;
|
33917
33915
|
const isHovering = hoveringComponent === item.props.id;
|
33918
33916
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
33919
|
-
return /* @__PURE__ */ (0,
|
33917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
33920
33918
|
"li",
|
33921
33919
|
{
|
33922
33920
|
className: getClassNameLayer({
|
@@ -33926,7 +33924,7 @@ var LayerTree = ({
|
|
33926
33924
|
childIsSelected
|
33927
33925
|
}),
|
33928
33926
|
children: [
|
33929
|
-
/* @__PURE__ */ (0,
|
33927
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
33930
33928
|
"div",
|
33931
33929
|
{
|
33932
33930
|
className: getClassNameLayer("clickable"),
|
@@ -33942,7 +33940,7 @@ var LayerTree = ({
|
|
33942
33940
|
const id = zoneContent[i].props.id;
|
33943
33941
|
scrollIntoView(
|
33944
33942
|
document.querySelector(
|
33945
|
-
`[data-
|
33943
|
+
`[data-rfd-drag-handle-draggable-id="draggable-${id}"]`
|
33946
33944
|
)
|
33947
33945
|
);
|
33948
33946
|
},
|
@@ -33957,22 +33955,22 @@ var LayerTree = ({
|
|
33957
33955
|
setHoveringComponent(null);
|
33958
33956
|
},
|
33959
33957
|
children: [
|
33960
|
-
containsZone && /* @__PURE__ */ (0,
|
33958
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33961
33959
|
"div",
|
33962
33960
|
{
|
33963
33961
|
className: getClassNameLayer("chevron"),
|
33964
33962
|
title: isSelected ? "Collapse" : "Expand",
|
33965
|
-
children: /* @__PURE__ */ (0,
|
33963
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(chevron_down_default, { size: "12" })
|
33966
33964
|
}
|
33967
33965
|
),
|
33968
|
-
/* @__PURE__ */ (0,
|
33969
|
-
/* @__PURE__ */ (0,
|
33970
|
-
item.type
|
33966
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
33967
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(type_default, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(grid_default, { size: "16" }) }),
|
33968
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("name"), children: item.type })
|
33971
33969
|
] })
|
33972
33970
|
]
|
33973
33971
|
}
|
33974
33972
|
) }),
|
33975
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
33973
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
33976
33974
|
LayerTree,
|
33977
33975
|
{
|
33978
33976
|
data,
|
@@ -34019,7 +34017,7 @@ var flushZones = (appState) => {
|
|
34019
34017
|
// lib/use-component-list.tsx
|
34020
34018
|
init_react_import();
|
34021
34019
|
var import_react37 = require("react");
|
34022
|
-
var
|
34020
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
34023
34021
|
var useComponentList = (config, ui) => {
|
34024
34022
|
const [componentList, setComponentList] = (0, import_react37.useState)();
|
34025
34023
|
(0, import_react37.useEffect)(() => {
|
@@ -34032,14 +34030,14 @@ var useComponentList = (config, ui) => {
|
|
34032
34030
|
if (category.visible === false || !category.components) {
|
34033
34031
|
return null;
|
34034
34032
|
}
|
34035
|
-
return /* @__PURE__ */ (0,
|
34033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34036
34034
|
ComponentList,
|
34037
34035
|
{
|
34038
34036
|
id: categoryKey,
|
34039
34037
|
title: category.title || categoryKey,
|
34040
34038
|
children: category.components.map((componentName, i) => {
|
34041
34039
|
matchedComponents.push(componentName);
|
34042
|
-
return /* @__PURE__ */ (0,
|
34040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34043
34041
|
ComponentList.Item,
|
34044
34042
|
{
|
34045
34043
|
component: componentName,
|
@@ -34059,13 +34057,13 @@ var useComponentList = (config, ui) => {
|
|
34059
34057
|
);
|
34060
34058
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
34061
34059
|
_componentList.push(
|
34062
|
-
/* @__PURE__ */ (0,
|
34060
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34063
34061
|
ComponentList,
|
34064
34062
|
{
|
34065
34063
|
id: "other",
|
34066
34064
|
title: ((_c = ui.componentList.other) == null ? void 0 : _c.title) || "Other",
|
34067
34065
|
children: remainingComponents.map((componentName, i) => {
|
34068
|
-
return /* @__PURE__ */ (0,
|
34066
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
34069
34067
|
ComponentList.Item,
|
34070
34068
|
{
|
34071
34069
|
component: componentName,
|
@@ -34215,7 +34213,7 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34215
34213
|
clearTimeout(deferredSetStates[id]);
|
34216
34214
|
delete deferredSetStates[id];
|
34217
34215
|
}
|
34218
|
-
|
34216
|
+
deferredSetStates[id] = setTimeout(() => {
|
34219
34217
|
setComponentState((prev) => __spreadProps(__spreadValues({}, prev), {
|
34220
34218
|
[id]: __spreadProps(__spreadValues({}, prev[id]), { loading })
|
34221
34219
|
}));
|
@@ -34282,8 +34280,13 @@ var useResolvedData = (data, config, dispatch) => {
|
|
34282
34280
|
};
|
34283
34281
|
};
|
34284
34282
|
|
34283
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
34284
|
+
init_react_import();
|
34285
|
+
var styles_module_default12 = { "Puck": "_Puck_vj9gy_19", "Puck--leftSideBarVisible": "_Puck--leftSideBarVisible_vj9gy_36", "Puck-header": "_Puck-header_vj9gy_72", "Puck-headerInner": "_Puck-headerInner_vj9gy_79", "Puck-headerToggle": "_Puck-headerToggle_vj9gy_89", "Puck-headerTitle": "_Puck-headerTitle_vj9gy_93", "Puck-headerPath": "_Puck-headerPath_vj9gy_97", "Puck-headerTools": "_Puck-headerTools_vj9gy_104", "Puck-leftSideBar": "_Puck-leftSideBar_vj9gy_110", "Puck-frame": "_Puck-frame_vj9gy_119", "Puck-root": "_Puck-root_vj9gy_127", "Puck-page": "_Puck-page_vj9gy_139", "Puck-rightSideBar": "_Puck-rightSideBar_vj9gy_143" };
|
34286
|
+
|
34285
34287
|
// components/Puck/index.tsx
|
34286
|
-
var
|
34288
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
34289
|
+
var getClassName18 = get_class_name_factory_default("Puck", styles_module_default12);
|
34287
34290
|
var defaultPageFields = {
|
34288
34291
|
title: { type: "text" }
|
34289
34292
|
};
|
@@ -34295,7 +34298,7 @@ var PluginRenderer = ({
|
|
34295
34298
|
renderMethod
|
34296
34299
|
}) => {
|
34297
34300
|
return plugins.filter((item) => item[renderMethod]).map((item) => item[renderMethod]).reduce(
|
34298
|
-
(accChildren, Item) => /* @__PURE__ */ (0,
|
34301
|
+
(accChildren, Item) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Item, { dispatch, state, children: accChildren }),
|
34299
34302
|
children
|
34300
34303
|
);
|
34301
34304
|
};
|
@@ -34313,7 +34316,7 @@ function Puck({
|
|
34313
34316
|
}) {
|
34314
34317
|
var _a, _b;
|
34315
34318
|
const [reducer] = (0, import_react39.useState)(() => createReducer({ config }));
|
34316
|
-
const initialAppState = __spreadProps(__spreadValues({}, defaultAppState), {
|
34319
|
+
const [initialAppState] = (0, import_react39.useState)(__spreadProps(__spreadValues({}, defaultAppState), {
|
34317
34320
|
data: initialData,
|
34318
34321
|
ui: __spreadProps(__spreadValues({}, defaultAppState.ui), {
|
34319
34322
|
// Store categories under componentList on state to allow render functions and plugins to modify
|
@@ -34331,7 +34334,7 @@ function Puck({
|
|
34331
34334
|
{}
|
34332
34335
|
) : {}
|
34333
34336
|
})
|
34334
|
-
});
|
34337
|
+
}));
|
34335
34338
|
const [appState, dispatch] = (0, import_react39.useReducer)(
|
34336
34339
|
reducer,
|
34337
34340
|
flushZones(initialAppState)
|
@@ -34360,7 +34363,7 @@ function Puck({
|
|
34360
34363
|
const Page = (0, import_react39.useCallback)(
|
34361
34364
|
(pageProps) => {
|
34362
34365
|
var _a2, _b2;
|
34363
|
-
return /* @__PURE__ */ (0,
|
34366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34364
34367
|
PluginRenderer,
|
34365
34368
|
{
|
34366
34369
|
plugins,
|
@@ -34374,7 +34377,7 @@ function Puck({
|
|
34374
34377
|
[config.root]
|
34375
34378
|
);
|
34376
34379
|
const PageFieldWrapper = (0, import_react39.useCallback)(
|
34377
|
-
(props) => /* @__PURE__ */ (0,
|
34380
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34378
34381
|
PluginRenderer,
|
34379
34382
|
{
|
34380
34383
|
plugins,
|
@@ -34387,7 +34390,7 @@ function Puck({
|
|
34387
34390
|
[]
|
34388
34391
|
);
|
34389
34392
|
const ComponentFieldWrapper = (0, import_react39.useCallback)(
|
34390
|
-
(props) => /* @__PURE__ */ (0,
|
34393
|
+
(props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34391
34394
|
PluginRenderer,
|
34392
34395
|
{
|
34393
34396
|
plugins,
|
@@ -34400,7 +34403,7 @@ function Puck({
|
|
34400
34403
|
[]
|
34401
34404
|
);
|
34402
34405
|
const ComponentListWrapper = (0, import_react39.useCallback)((props) => {
|
34403
|
-
const children = /* @__PURE__ */ (0,
|
34406
|
+
const children = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34404
34407
|
PluginRenderer,
|
34405
34408
|
{
|
34406
34409
|
plugins,
|
@@ -34434,13 +34437,13 @@ function Puck({
|
|
34434
34437
|
);
|
34435
34438
|
}
|
34436
34439
|
}, []);
|
34437
|
-
return /* @__PURE__ */ (0,
|
34438
|
-
/* @__PURE__ */ (0,
|
34440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
34441
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34439
34442
|
AppProvider,
|
34440
34443
|
{
|
34441
34444
|
value: { state: appState, dispatch, config, componentState },
|
34442
|
-
children: /* @__PURE__ */ (0,
|
34443
|
-
|
34445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34446
|
+
import_dnd7.DragDropContext,
|
34444
34447
|
{
|
34445
34448
|
onDragUpdate: (update) => {
|
34446
34449
|
setDraggedItem(__spreadValues(__spreadValues({}, draggedItem), update));
|
@@ -34492,7 +34495,7 @@ function Puck({
|
|
34492
34495
|
});
|
34493
34496
|
}
|
34494
34497
|
},
|
34495
|
-
children: /* @__PURE__ */ (0,
|
34498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34496
34499
|
DropZoneProvider,
|
34497
34500
|
{
|
34498
34501
|
value: {
|
@@ -34506,363 +34509,239 @@ function Puck({
|
|
34506
34509
|
mode: "edit",
|
34507
34510
|
areaId: "root"
|
34508
34511
|
},
|
34509
|
-
children: /* @__PURE__ */ (0,
|
34512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(dropZoneContext.Consumer, { children: (ctx) => {
|
34510
34513
|
var _a2, _b2;
|
34511
|
-
return /* @__PURE__ */ (0,
|
34512
|
-
"
|
34513
|
-
|
34514
|
-
|
34515
|
-
|
34516
|
-
|
34517
|
-
|
34518
|
-
|
34519
|
-
|
34520
|
-
|
34521
|
-
|
34522
|
-
|
34523
|
-
|
34524
|
-
|
34525
|
-
|
34526
|
-
children:
|
34527
|
-
|
34528
|
-
|
34529
|
-
{
|
34530
|
-
|
34531
|
-
|
34532
|
-
|
34533
|
-
|
34534
|
-
|
34535
|
-
|
34536
|
-
|
34537
|
-
|
34538
|
-
|
34514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18({ leftSideBarVisible }), children: [
|
34515
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("header", { className: getClassName18("header"), children: renderHeader ? renderHeader({
|
34516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34517
|
+
Button,
|
34518
|
+
{
|
34519
|
+
onClick: () => {
|
34520
|
+
onPublish(data);
|
34521
|
+
},
|
34522
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34523
|
+
children: "Publish"
|
34524
|
+
}
|
34525
|
+
),
|
34526
|
+
dispatch,
|
34527
|
+
state: appState
|
34528
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("headerInner"), children: [
|
34529
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("headerToggle"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34530
|
+
IconButton,
|
34531
|
+
{
|
34532
|
+
onClick: () => dispatch({
|
34533
|
+
type: "setUi",
|
34534
|
+
ui: {
|
34535
|
+
leftSideBarVisible: !leftSideBarVisible
|
34536
|
+
}
|
34537
|
+
}),
|
34538
|
+
title: "Toggle left sidebar",
|
34539
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(sidebar_default, {})
|
34540
|
+
}
|
34541
|
+
) }),
|
34542
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34543
|
+
headerTitle || rootProps.title || "Page",
|
34544
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
34545
|
+
" ",
|
34546
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { className: getClassName18("headerPath"), children: headerPath })
|
34547
|
+
] })
|
34548
|
+
] }) }),
|
34549
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("headerTools"), children: [
|
34550
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex" }, children: [
|
34551
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34552
|
+
IconButton,
|
34553
|
+
{
|
34554
|
+
title: "undo",
|
34555
|
+
disabled: !canRewind,
|
34556
|
+
onClick: rewind,
|
34557
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34558
|
+
chevron_left_default,
|
34539
34559
|
{
|
34540
|
-
|
34541
|
-
|
34542
|
-
},
|
34543
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(globe_default, { size: "14px" }),
|
34544
|
-
children: "Publish"
|
34560
|
+
size: 21,
|
34561
|
+
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34545
34562
|
}
|
34546
|
-
)
|
34547
|
-
|
34548
|
-
|
34549
|
-
|
34550
|
-
|
34551
|
-
|
34552
|
-
|
34553
|
-
|
34554
|
-
|
34555
|
-
|
34556
|
-
|
34557
|
-
|
34558
|
-
|
34559
|
-
|
34560
|
-
|
34561
|
-
|
34562
|
-
|
34563
|
-
|
34564
|
-
|
34565
|
-
|
34566
|
-
|
34567
|
-
|
34568
|
-
|
34569
|
-
|
34570
|
-
|
34571
|
-
type: "setUi",
|
34572
|
-
ui: {
|
34573
|
-
leftSideBarVisible: !leftSideBarVisible
|
34574
|
-
}
|
34575
|
-
}),
|
34576
|
-
title: "Toggle left sidebar",
|
34577
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(sidebar_default, {})
|
34578
|
-
}
|
34579
|
-
)
|
34580
|
-
}
|
34581
|
-
),
|
34582
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34583
|
-
"div",
|
34584
|
-
{
|
34585
|
-
style: {
|
34586
|
-
display: "flex",
|
34587
|
-
justifyContent: "center",
|
34588
|
-
alignItems: "center"
|
34589
|
-
},
|
34590
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
34591
|
-
headerTitle || rootProps.title || "Page",
|
34592
|
-
headerPath && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34593
|
-
"small",
|
34594
|
-
{
|
34595
|
-
style: { fontWeight: 400, marginLeft: 4 },
|
34596
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("code", { children: headerPath })
|
34597
|
-
}
|
34598
|
-
)
|
34599
|
-
] })
|
34600
|
-
}
|
34601
|
-
),
|
34602
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
34603
|
-
"div",
|
34604
|
-
{
|
34605
|
-
style: {
|
34606
|
-
display: "flex",
|
34607
|
-
gap: 16,
|
34608
|
-
justifyContent: "flex-end"
|
34609
|
-
},
|
34610
|
-
children: [
|
34611
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex" }, children: [
|
34612
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34613
|
-
IconButton,
|
34614
|
-
{
|
34615
|
-
title: "undo",
|
34616
|
-
disabled: !canRewind,
|
34617
|
-
onClick: rewind,
|
34618
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34619
|
-
chevron_left_default,
|
34620
|
-
{
|
34621
|
-
size: 21,
|
34622
|
-
stroke: canRewind ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34623
|
-
}
|
34624
|
-
)
|
34625
|
-
}
|
34626
|
-
),
|
34627
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34628
|
-
IconButton,
|
34629
|
-
{
|
34630
|
-
title: "redo",
|
34631
|
-
disabled: !canForward,
|
34632
|
-
onClick: forward,
|
34633
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34634
|
-
chevron_right_default,
|
34635
|
-
{
|
34636
|
-
size: 21,
|
34637
|
-
stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34638
|
-
}
|
34639
|
-
)
|
34640
|
-
}
|
34641
|
-
)
|
34642
|
-
] }),
|
34643
|
-
renderHeaderActions && renderHeaderActions({
|
34644
|
-
state: appState,
|
34645
|
-
dispatch
|
34646
|
-
}),
|
34647
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34648
|
-
Button,
|
34649
|
-
{
|
34650
|
-
onClick: () => {
|
34651
|
-
onPublish(data);
|
34652
|
-
},
|
34653
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(globe_default, { size: "14px" }),
|
34654
|
-
children: "Publish"
|
34655
|
-
}
|
34656
|
-
)
|
34657
|
-
]
|
34658
|
-
}
|
34659
|
-
)
|
34660
|
-
]
|
34661
|
-
}
|
34662
|
-
)
|
34663
|
-
}
|
34664
|
-
),
|
34665
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
34666
|
-
"div",
|
34563
|
+
)
|
34564
|
+
}
|
34565
|
+
),
|
34566
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34567
|
+
IconButton,
|
34568
|
+
{
|
34569
|
+
title: "redo",
|
34570
|
+
disabled: !canForward,
|
34571
|
+
onClick: forward,
|
34572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34573
|
+
chevron_right_default,
|
34574
|
+
{
|
34575
|
+
size: 21,
|
34576
|
+
stroke: canForward ? "var(--puck-color-black)" : "var(--puck-color-grey-7)"
|
34577
|
+
}
|
34578
|
+
)
|
34579
|
+
}
|
34580
|
+
)
|
34581
|
+
] }),
|
34582
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: renderHeaderActions && renderHeaderActions({
|
34583
|
+
state: appState,
|
34584
|
+
dispatch
|
34585
|
+
}) }),
|
34586
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34587
|
+
Button,
|
34667
34588
|
{
|
34668
|
-
|
34669
|
-
|
34670
|
-
background: "var(--puck-color-grey-11)",
|
34671
|
-
borderRight: "1px solid var(--puck-color-grey-8)",
|
34672
|
-
overflowY: "auto",
|
34673
|
-
display: "flex",
|
34674
|
-
flexDirection: "column"
|
34589
|
+
onClick: () => {
|
34590
|
+
onPublish(data);
|
34675
34591
|
},
|
34676
|
-
|
34677
|
-
|
34678
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(SidebarSection, { title: "Outline", children: [
|
34679
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34680
|
-
LayerTree,
|
34681
|
-
{
|
34682
|
-
data,
|
34683
|
-
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
34684
|
-
zoneContent: data.content,
|
34685
|
-
setItemSelector,
|
34686
|
-
itemSelector
|
34687
|
-
}
|
34688
|
-
),
|
34689
|
-
Object.entries(findZonesForArea(data, "root")).map(
|
34690
|
-
([zoneKey, zone]) => {
|
34691
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34692
|
-
LayerTree,
|
34693
|
-
{
|
34694
|
-
data,
|
34695
|
-
label: zoneKey,
|
34696
|
-
zone: zoneKey,
|
34697
|
-
zoneContent: zone,
|
34698
|
-
setItemSelector,
|
34699
|
-
itemSelector
|
34700
|
-
},
|
34701
|
-
zoneKey
|
34702
|
-
);
|
34703
|
-
}
|
34704
|
-
)
|
34705
|
-
] })
|
34706
|
-
]
|
34592
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(globe_default, { size: "14px" }),
|
34593
|
+
children: "Publish"
|
34707
34594
|
}
|
34708
|
-
)
|
34709
|
-
|
34710
|
-
|
34595
|
+
) })
|
34596
|
+
] })
|
34597
|
+
] }) }),
|
34598
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: getClassName18("leftSideBar"), children: [
|
34599
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SidebarSection, { title: "Components", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentListWrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComponentList, { id: "all" }) }) }),
|
34600
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SidebarSection, { title: "Outline", children: [
|
34601
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34602
|
+
LayerTree,
|
34711
34603
|
{
|
34712
|
-
|
34713
|
-
|
34714
|
-
|
34715
|
-
|
34716
|
-
|
34717
|
-
flexDirection: "column"
|
34718
|
-
},
|
34719
|
-
onClick: () => setItemSelector(null),
|
34720
|
-
id: "puck-frame",
|
34721
|
-
children: [
|
34722
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34723
|
-
"div",
|
34724
|
-
{
|
34725
|
-
className: "puck-root",
|
34726
|
-
style: {
|
34727
|
-
boxShadow: "0px 0px 0px 32px var(--puck-color-grey-10)",
|
34728
|
-
margin: 32,
|
34729
|
-
zoom: 0.75
|
34730
|
-
},
|
34731
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34732
|
-
"div",
|
34733
|
-
{
|
34734
|
-
style: {
|
34735
|
-
border: "1px solid var(--puck-color-grey-8)"
|
34736
|
-
},
|
34737
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34738
|
-
Page,
|
34739
|
-
__spreadProps(__spreadValues({
|
34740
|
-
dispatch,
|
34741
|
-
state: appState
|
34742
|
-
}, data.root), {
|
34743
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId })
|
34744
|
-
})
|
34745
|
-
)
|
34746
|
-
}
|
34747
|
-
)
|
34748
|
-
}
|
34749
|
-
),
|
34750
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34751
|
-
"div",
|
34752
|
-
{
|
34753
|
-
style: {
|
34754
|
-
background: "var(--puck-color-grey-10)",
|
34755
|
-
height: "100%",
|
34756
|
-
flexGrow: 1
|
34757
|
-
}
|
34758
|
-
}
|
34759
|
-
)
|
34760
|
-
]
|
34604
|
+
data,
|
34605
|
+
label: areaContainsZones(data, "root") ? rootDroppableId : "",
|
34606
|
+
zoneContent: data.content,
|
34607
|
+
setItemSelector,
|
34608
|
+
itemSelector
|
34761
34609
|
}
|
34762
34610
|
),
|
34763
|
-
|
34764
|
-
|
34765
|
-
|
34766
|
-
|
34767
|
-
borderLeft: "1px solid var(--puck-color-grey-8)",
|
34768
|
-
overflowY: "auto",
|
34769
|
-
gridArea: "right",
|
34770
|
-
fontFamily: "var(--puck-font-stack)",
|
34771
|
-
display: "flex",
|
34772
|
-
flexDirection: "column",
|
34773
|
-
background: "var(--puck-color-white)"
|
34774
|
-
},
|
34775
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34776
|
-
SidebarSection,
|
34611
|
+
Object.entries(findZonesForArea(data, "root")).map(
|
34612
|
+
([zoneKey, zone]) => {
|
34613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34614
|
+
LayerTree,
|
34777
34615
|
{
|
34778
|
-
|
34779
|
-
|
34780
|
-
|
34781
|
-
|
34782
|
-
|
34783
|
-
|
34784
|
-
|
34785
|
-
|
34786
|
-
|
34787
|
-
if (selectedItem) {
|
34788
|
-
currentProps = selectedItem.props;
|
34789
|
-
} else {
|
34790
|
-
currentProps = data.root;
|
34791
|
-
}
|
34792
|
-
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
34793
|
-
[fieldName]: value
|
34794
|
-
});
|
34795
|
-
if (itemSelector) {
|
34796
|
-
const action = {
|
34797
|
-
type: "replace",
|
34798
|
-
destinationIndex: itemSelector.index,
|
34799
|
-
destinationZone: itemSelector.zone || rootDroppableId,
|
34800
|
-
data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
|
34801
|
-
};
|
34802
|
-
if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
|
34803
|
-
resolveData(replaceAction(data, action));
|
34804
|
-
} else {
|
34805
|
-
dispatch(action);
|
34806
|
-
}
|
34807
|
-
} else {
|
34808
|
-
if (data.root.props) {
|
34809
|
-
if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
|
34810
|
-
resolveData(__spreadProps(__spreadValues({}, data), {
|
34811
|
-
root: { props: { newProps } }
|
34812
|
-
}));
|
34813
|
-
} else {
|
34814
|
-
dispatch({
|
34815
|
-
type: "setData",
|
34816
|
-
data: { root: { props: { newProps } } }
|
34817
|
-
});
|
34818
|
-
}
|
34819
|
-
} else {
|
34820
|
-
dispatch({
|
34821
|
-
type: "setData",
|
34822
|
-
data: { root: newProps }
|
34823
|
-
});
|
34824
|
-
}
|
34825
|
-
}
|
34826
|
-
};
|
34827
|
-
if (selectedItem && itemSelector) {
|
34828
|
-
const { readOnly = {} } = selectedItem;
|
34829
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34830
|
-
InputOrGroup,
|
34831
|
-
{
|
34832
|
-
field,
|
34833
|
-
name: fieldName,
|
34834
|
-
label: field.label,
|
34835
|
-
readOnly: readOnly[fieldName],
|
34836
|
-
readOnlyFields: readOnly,
|
34837
|
-
value: selectedItem.props[fieldName],
|
34838
|
-
onChange: onChange2
|
34839
|
-
},
|
34840
|
-
`${selectedItem.props.id}_${fieldName}`
|
34841
|
-
);
|
34842
|
-
} else {
|
34843
|
-
const { readOnly = {} } = data.root;
|
34844
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34845
|
-
InputOrGroup,
|
34846
|
-
{
|
34847
|
-
field,
|
34848
|
-
name: fieldName,
|
34849
|
-
label: field.label,
|
34850
|
-
readOnly: readOnly[fieldName],
|
34851
|
-
readOnlyFields: readOnly,
|
34852
|
-
value: rootProps[fieldName],
|
34853
|
-
onChange: onChange2
|
34854
|
-
},
|
34855
|
-
`page_${fieldName}`
|
34856
|
-
);
|
34857
|
-
}
|
34858
|
-
})
|
34859
|
-
}
|
34860
|
-
) })
|
34616
|
+
data,
|
34617
|
+
label: zoneKey,
|
34618
|
+
zone: zoneKey,
|
34619
|
+
zoneContent: zone,
|
34620
|
+
setItemSelector,
|
34621
|
+
itemSelector
|
34622
|
+
},
|
34623
|
+
zoneKey
|
34624
|
+
);
|
34861
34625
|
}
|
34862
34626
|
)
|
34863
|
-
]
|
34864
|
-
}
|
34865
|
-
|
34627
|
+
] })
|
34628
|
+
] }),
|
34629
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
34630
|
+
"div",
|
34631
|
+
{
|
34632
|
+
className: getClassName18("frame"),
|
34633
|
+
onClick: () => setItemSelector(null),
|
34634
|
+
id: "puck-frame",
|
34635
|
+
children: [
|
34636
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("root"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("page"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34637
|
+
Page,
|
34638
|
+
__spreadProps(__spreadValues({
|
34639
|
+
dispatch,
|
34640
|
+
state: appState
|
34641
|
+
}, rootProps), {
|
34642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropZone, { zone: rootDroppableId })
|
34643
|
+
})
|
34644
|
+
) }) }),
|
34645
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34646
|
+
"div",
|
34647
|
+
{
|
34648
|
+
style: {
|
34649
|
+
background: "var(--puck-color-grey-10)",
|
34650
|
+
height: "100%",
|
34651
|
+
flexGrow: 1
|
34652
|
+
}
|
34653
|
+
}
|
34654
|
+
)
|
34655
|
+
]
|
34656
|
+
}
|
34657
|
+
),
|
34658
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: getClassName18("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldWrapper, { dispatch, state: appState, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34659
|
+
SidebarSection,
|
34660
|
+
{
|
34661
|
+
noPadding: true,
|
34662
|
+
showBreadcrumbs: true,
|
34663
|
+
title: selectedItem ? selectedItem.type : "Page",
|
34664
|
+
isLoading: selectedItem ? (_a2 = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a2.loading : (_b2 = componentState["puck-root"]) == null ? void 0 : _b2.loading,
|
34665
|
+
children: Object.keys(fields).map((fieldName) => {
|
34666
|
+
const field = fields[fieldName];
|
34667
|
+
const onChange2 = (value) => {
|
34668
|
+
var _a3, _b3;
|
34669
|
+
let currentProps;
|
34670
|
+
if (selectedItem) {
|
34671
|
+
currentProps = selectedItem.props;
|
34672
|
+
} else {
|
34673
|
+
currentProps = rootProps;
|
34674
|
+
}
|
34675
|
+
const newProps = __spreadProps(__spreadValues({}, currentProps), {
|
34676
|
+
[fieldName]: value
|
34677
|
+
});
|
34678
|
+
if (itemSelector) {
|
34679
|
+
const action = {
|
34680
|
+
type: "replace",
|
34681
|
+
destinationIndex: itemSelector.index,
|
34682
|
+
destinationZone: itemSelector.zone || rootDroppableId,
|
34683
|
+
data: __spreadProps(__spreadValues({}, selectedItem), { props: newProps })
|
34684
|
+
};
|
34685
|
+
if ((_a3 = config.components[selectedItem.type]) == null ? void 0 : _a3.resolveData) {
|
34686
|
+
resolveData(replaceAction(data, action));
|
34687
|
+
} else {
|
34688
|
+
dispatch(action);
|
34689
|
+
}
|
34690
|
+
} else {
|
34691
|
+
if (data.root.props) {
|
34692
|
+
if ((_b3 = config.root) == null ? void 0 : _b3.resolveData) {
|
34693
|
+
resolveData(__spreadProps(__spreadValues({}, data), {
|
34694
|
+
root: { props: newProps }
|
34695
|
+
}));
|
34696
|
+
} else {
|
34697
|
+
dispatch({
|
34698
|
+
type: "setData",
|
34699
|
+
data: { root: { props: newProps } }
|
34700
|
+
});
|
34701
|
+
}
|
34702
|
+
} else {
|
34703
|
+
dispatch({
|
34704
|
+
type: "setData",
|
34705
|
+
data: { root: newProps }
|
34706
|
+
});
|
34707
|
+
}
|
34708
|
+
}
|
34709
|
+
};
|
34710
|
+
if (selectedItem && itemSelector) {
|
34711
|
+
const { readOnly = {} } = selectedItem;
|
34712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34713
|
+
InputOrGroup,
|
34714
|
+
{
|
34715
|
+
field,
|
34716
|
+
name: fieldName,
|
34717
|
+
label: field.label,
|
34718
|
+
readOnly: readOnly[fieldName],
|
34719
|
+
readOnlyFields: readOnly,
|
34720
|
+
value: selectedItem.props[fieldName],
|
34721
|
+
onChange: onChange2
|
34722
|
+
},
|
34723
|
+
`${selectedItem.props.id}_${fieldName}`
|
34724
|
+
);
|
34725
|
+
} else {
|
34726
|
+
const { readOnly = {} } = data.root;
|
34727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
34728
|
+
InputOrGroup,
|
34729
|
+
{
|
34730
|
+
field,
|
34731
|
+
name: fieldName,
|
34732
|
+
label: field.label,
|
34733
|
+
readOnly: readOnly[fieldName],
|
34734
|
+
readOnlyFields: readOnly,
|
34735
|
+
value: rootProps[fieldName],
|
34736
|
+
onChange: onChange2
|
34737
|
+
},
|
34738
|
+
`page_${fieldName}`
|
34739
|
+
);
|
34740
|
+
}
|
34741
|
+
})
|
34742
|
+
}
|
34743
|
+
) }) })
|
34744
|
+
] });
|
34866
34745
|
} })
|
34867
34746
|
}
|
34868
34747
|
)
|
@@ -34870,29 +34749,32 @@ function Puck({
|
|
34870
34749
|
)
|
34871
34750
|
}
|
34872
34751
|
),
|
34873
|
-
/* @__PURE__ */ (0,
|
34752
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { id: "puck-portal-root" })
|
34874
34753
|
] });
|
34875
34754
|
}
|
34876
34755
|
|
34877
34756
|
// components/Render/index.tsx
|
34878
34757
|
init_react_import();
|
34879
|
-
var
|
34758
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
34880
34759
|
function Render({ config, data }) {
|
34881
34760
|
var _a;
|
34882
34761
|
const rootProps = data.root.props || data.root;
|
34883
34762
|
const title = rootProps.title || "";
|
34884
34763
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
34885
|
-
return /* @__PURE__ */ (0,
|
34764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
34886
34765
|
config.root.render,
|
34887
34766
|
__spreadProps(__spreadValues({}, rootProps), {
|
34767
|
+
puck: {
|
34768
|
+
renderDropZone: DropZone
|
34769
|
+
},
|
34888
34770
|
title,
|
34889
34771
|
editMode: false,
|
34890
34772
|
id: "puck-root",
|
34891
|
-
children: /* @__PURE__ */ (0,
|
34773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId })
|
34892
34774
|
})
|
34893
34775
|
) });
|
34894
34776
|
}
|
34895
|
-
return /* @__PURE__ */ (0,
|
34777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZoneProvider, { value: { data, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DropZone, { zone: rootDroppableId }) });
|
34896
34778
|
}
|
34897
34779
|
|
34898
34780
|
// lib/resolve-all-data.ts
|