@measured/puck 0.16.0-canary.abe8c52 → 0.16.0-canary.cad95b8
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/dist/{Config-VOJqVbHe.d.ts → Config-DCrYvDkL.d.ts} +9 -1
- package/dist/index.css +95 -78
- package/dist/index.d.ts +40 -6
- package/dist/index.js +693 -537
- package/dist/rsc.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -7536,7 +7536,7 @@ var require_react_dom_development = __commonJS({
|
|
7536
7536
|
var HostPortal = 4;
|
7537
7537
|
var HostComponent = 5;
|
7538
7538
|
var HostText = 6;
|
7539
|
-
var
|
7539
|
+
var Fragment20 = 7;
|
7540
7540
|
var Mode = 8;
|
7541
7541
|
var ContextConsumer = 9;
|
7542
7542
|
var ContextProvider = 10;
|
@@ -8692,7 +8692,7 @@ var require_react_dom_development = __commonJS({
|
|
8692
8692
|
return "DehydratedFragment";
|
8693
8693
|
case ForwardRef:
|
8694
8694
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
8695
|
-
case
|
8695
|
+
case Fragment20:
|
8696
8696
|
return "Fragment";
|
8697
8697
|
case HostComponent:
|
8698
8698
|
return type;
|
@@ -18343,7 +18343,7 @@ var require_react_dom_development = __commonJS({
|
|
18343
18343
|
}
|
18344
18344
|
}
|
18345
18345
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
18346
|
-
if (current2 === null || current2.tag !==
|
18346
|
+
if (current2 === null || current2.tag !== Fragment20) {
|
18347
18347
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
18348
18348
|
created.return = returnFiber;
|
18349
18349
|
return created;
|
@@ -18746,7 +18746,7 @@ var require_react_dom_development = __commonJS({
|
|
18746
18746
|
if (child.key === key) {
|
18747
18747
|
var elementType = element.type;
|
18748
18748
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
18749
|
-
if (child.tag ===
|
18749
|
+
if (child.tag === Fragment20) {
|
18750
18750
|
deleteRemainingChildren(returnFiber, child.sibling);
|
18751
18751
|
var existing = useFiber(child, element.props.children);
|
18752
18752
|
existing.return = returnFiber;
|
@@ -22921,7 +22921,7 @@ var require_react_dom_development = __commonJS({
|
|
22921
22921
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
22922
22922
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
22923
22923
|
}
|
22924
|
-
case
|
22924
|
+
case Fragment20:
|
22925
22925
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
22926
22926
|
case Mode:
|
22927
22927
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -23193,7 +23193,7 @@ var require_react_dom_development = __commonJS({
|
|
23193
23193
|
case SimpleMemoComponent:
|
23194
23194
|
case FunctionComponent:
|
23195
23195
|
case ForwardRef:
|
23196
|
-
case
|
23196
|
+
case Fragment20:
|
23197
23197
|
case Mode:
|
23198
23198
|
case Profiler:
|
23199
23199
|
case ContextConsumer:
|
@@ -27444,7 +27444,7 @@ var require_react_dom_development = __commonJS({
|
|
27444
27444
|
return fiber;
|
27445
27445
|
}
|
27446
27446
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
27447
|
-
var fiber = createFiber(
|
27447
|
+
var fiber = createFiber(Fragment20, elements, key, mode);
|
27448
27448
|
fiber.lanes = lanes;
|
27449
27449
|
return fiber;
|
27450
27450
|
}
|
@@ -28567,6 +28567,8 @@ var require_react_dom = __commonJS({
|
|
28567
28567
|
// index.ts
|
28568
28568
|
var core_exports = {};
|
28569
28569
|
__export(core_exports, {
|
28570
|
+
Action: () => Action,
|
28571
|
+
ActionBar: () => ActionBar,
|
28570
28572
|
AutoField: () => AutoField,
|
28571
28573
|
AutoFieldPrivate: () => AutoFieldPrivate,
|
28572
28574
|
Button: () => Button,
|
@@ -28596,7 +28598,7 @@ init_react_import();
|
|
28596
28598
|
// types/Fields.ts
|
28597
28599
|
init_react_import();
|
28598
28600
|
|
28599
|
-
// components/
|
28601
|
+
// components/ActionBar/index.tsx
|
28600
28602
|
init_react_import();
|
28601
28603
|
|
28602
28604
|
// lib/get-class-name-factory.ts
|
@@ -28631,9 +28633,33 @@ var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (optio
|
|
28631
28633
|
};
|
28632
28634
|
var get_class_name_factory_default = getClassNameFactory;
|
28633
28635
|
|
28636
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css#css-module
|
28637
|
+
init_react_import();
|
28638
|
+
var styles_module_default = { "ActionBarComponent": "_ActionBarComponent_8nyey_1", "ActionBarComponent-actionsLabel": "_ActionBarComponent-actionsLabel_8nyey_15", "ActionBarComponent-action": "_ActionBarComponent-action_8nyey_15" };
|
28639
|
+
|
28640
|
+
// components/ActionBar/index.tsx
|
28641
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
28642
|
+
var getClassName = get_class_name_factory_default("ActionBarComponent", styles_module_default);
|
28643
|
+
var ActionBar = ({
|
28644
|
+
label,
|
28645
|
+
children
|
28646
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: getClassName(), children: [
|
28647
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("actionsLabel"), children: label }),
|
28648
|
+
children
|
28649
|
+
] });
|
28650
|
+
var Action = ({
|
28651
|
+
children,
|
28652
|
+
label,
|
28653
|
+
onClick
|
28654
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: getClassName("action"), onClick, title: label, children });
|
28655
|
+
ActionBar.Action = Action;
|
28656
|
+
|
28657
|
+
// components/AutoField/index.tsx
|
28658
|
+
init_react_import();
|
28659
|
+
|
28634
28660
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
28635
28661
|
init_react_import();
|
28636
|
-
var
|
28662
|
+
var styles_module_default2 = { "Input": "_Input_3pq3z_1", "Input-label": "_Input-label_3pq3z_26", "Input-labelIcon": "_Input-labelIcon_3pq3z_35", "Input-disabledIcon": "_Input-disabledIcon_3pq3z_42", "Input-input": "_Input-input_3pq3z_47", "Input--readOnly": "_Input--readOnly_3pq3z_91", "Input-radioGroupItems": "_Input-radioGroupItems_3pq3z_102", "Input-radio": "_Input-radio_3pq3z_102", "Input-radioInner": "_Input-radioInner_3pq3z_119", "Input-radioInput": "_Input-radioInput_3pq3z_164" };
|
28637
28663
|
|
28638
28664
|
// components/AutoField/index.tsx
|
28639
28665
|
var import_react11 = require("react");
|
@@ -28646,7 +28672,7 @@ init_react_import();
|
|
28646
28672
|
|
28647
28673
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/fields/ArrayField/styles.module.css#css-module
|
28648
28674
|
init_react_import();
|
28649
|
-
var
|
28675
|
+
var styles_module_default3 = { "ArrayField": "_ArrayField_1go19_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1go19_13", "ArrayField-addButton": "_ArrayField-addButton_1go19_18", "ArrayField--hasItems": "_ArrayField--hasItems_1go19_33", "ArrayFieldItem": "_ArrayFieldItem_1go19_63", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1go19_71", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1go19_81", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1go19_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_1go19_128", "ArrayFieldItem-body": "_ArrayFieldItem-body_1go19_164", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1go19_173", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1go19_181", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1go19_187" };
|
28650
28676
|
|
28651
28677
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
28652
28678
|
init_react_import();
|
@@ -28958,11 +28984,11 @@ var replace = (list, index, newItem) => {
|
|
28958
28984
|
|
28959
28985
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
28960
28986
|
init_react_import();
|
28961
|
-
var
|
28987
|
+
var styles_module_default4 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
28962
28988
|
|
28963
28989
|
// components/Loader/index.tsx
|
28964
|
-
var
|
28965
|
-
var
|
28990
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
28991
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default4);
|
28966
28992
|
var Loader = (_a) => {
|
28967
28993
|
var _b = _a, {
|
28968
28994
|
color,
|
@@ -28971,10 +28997,10 @@ var Loader = (_a) => {
|
|
28971
28997
|
"color",
|
28972
28998
|
"size"
|
28973
28999
|
]);
|
28974
|
-
return /* @__PURE__ */ (0,
|
29000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
28975
29001
|
"span",
|
28976
29002
|
__spreadValues({
|
28977
|
-
className:
|
29003
|
+
className: getClassName2(),
|
28978
29004
|
style: {
|
28979
29005
|
width: size,
|
28980
29006
|
height: size,
|
@@ -28986,8 +29012,8 @@ var Loader = (_a) => {
|
|
28986
29012
|
};
|
28987
29013
|
|
28988
29014
|
// components/IconButton/IconButton.tsx
|
28989
|
-
var
|
28990
|
-
var
|
29015
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
29016
|
+
var getClassName3 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
28991
29017
|
var IconButton = ({
|
28992
29018
|
children,
|
28993
29019
|
href,
|
@@ -29002,10 +29028,10 @@ var IconButton = ({
|
|
29002
29028
|
}) => {
|
29003
29029
|
const [loading, setLoading] = (0, import_react3.useState)(false);
|
29004
29030
|
const ElementType = href ? "a" : "button";
|
29005
|
-
const el = /* @__PURE__ */ (0,
|
29031
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
29006
29032
|
ElementType,
|
29007
29033
|
{
|
29008
|
-
className:
|
29034
|
+
className: getClassName3({
|
29009
29035
|
primary: variant === "primary",
|
29010
29036
|
secondary: variant === "secondary",
|
29011
29037
|
disabled,
|
@@ -29026,11 +29052,11 @@ var IconButton = ({
|
|
29026
29052
|
href,
|
29027
29053
|
title,
|
29028
29054
|
children: [
|
29029
|
-
/* @__PURE__ */ (0,
|
29055
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: getClassName3("title"), children: title }),
|
29030
29056
|
children,
|
29031
|
-
loading && /* @__PURE__ */ (0,
|
29057
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
29032
29058
|
"\xA0\xA0",
|
29033
|
-
/* @__PURE__ */ (0,
|
29059
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 14 })
|
29034
29060
|
] })
|
29035
29061
|
]
|
29036
29062
|
}
|
@@ -29085,7 +29111,7 @@ var defaultViewports = [
|
|
29085
29111
|
|
29086
29112
|
// components/Puck/context.tsx
|
29087
29113
|
var import_ua_parser_js = require("ua-parser-js");
|
29088
|
-
var
|
29114
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
29089
29115
|
var defaultAppState = {
|
29090
29116
|
data: { content: [], root: { props: {} } },
|
29091
29117
|
ui: {
|
@@ -29125,7 +29151,8 @@ var defaultContext = {
|
|
29125
29151
|
status: "LOADING",
|
29126
29152
|
setStatus: () => null,
|
29127
29153
|
iframe: {},
|
29128
|
-
safariFallbackMode: false
|
29154
|
+
safariFallbackMode: false,
|
29155
|
+
globalPermissions: {}
|
29129
29156
|
};
|
29130
29157
|
var appContext = (0, import_react4.createContext)(defaultContext);
|
29131
29158
|
var AppProvider = ({
|
@@ -29155,7 +29182,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
29155
29182
|
setSafariFallbackMode(true);
|
29156
29183
|
}
|
29157
29184
|
}, []);
|
29158
|
-
return /* @__PURE__ */ (0,
|
29185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29159
29186
|
appContext.Provider,
|
29160
29187
|
{
|
29161
29188
|
value: __spreadProps(__spreadValues({}, value), {
|
@@ -29186,7 +29213,7 @@ function useAppContext() {
|
|
29186
29213
|
}
|
29187
29214
|
|
29188
29215
|
// components/Droppable/index.tsx
|
29189
|
-
var
|
29216
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
29190
29217
|
var defaultProvided = {
|
29191
29218
|
droppableProps: {
|
29192
29219
|
"data-rfd-droppable-context-id": "",
|
@@ -29201,17 +29228,17 @@ var defaultSnapshot = {
|
|
29201
29228
|
draggingFromThisWith: null,
|
29202
29229
|
isUsingPlaceholder: false
|
29203
29230
|
};
|
29204
|
-
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0,
|
29231
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
29205
29232
|
var Droppable = (props) => {
|
29206
29233
|
const { status } = useAppContext();
|
29207
29234
|
const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
|
29208
|
-
return /* @__PURE__ */ (0,
|
29235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(El, __spreadValues({}, props));
|
29209
29236
|
};
|
29210
29237
|
|
29211
29238
|
// components/Draggable/index.tsx
|
29212
29239
|
init_react_import();
|
29213
29240
|
var import_dnd2 = require("@measured/dnd");
|
29214
|
-
var
|
29241
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
29215
29242
|
var defaultProvided2 = {
|
29216
29243
|
draggableProps: {
|
29217
29244
|
"data-rfd-draggable-context-id": "",
|
@@ -29235,7 +29262,7 @@ var defaultRubric = {
|
|
29235
29262
|
type: "",
|
29236
29263
|
source: { droppableId: "", index: 0 }
|
29237
29264
|
};
|
29238
|
-
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0,
|
29265
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
29239
29266
|
var Draggable = ({
|
29240
29267
|
className,
|
29241
29268
|
children,
|
@@ -29247,22 +29274,23 @@ var Draggable = ({
|
|
29247
29274
|
}) => {
|
29248
29275
|
const { status } = useAppContext();
|
29249
29276
|
const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
|
29250
|
-
return /* @__PURE__ */ (0,
|
29277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
|
29251
29278
|
var _a;
|
29252
|
-
return /* @__PURE__ */ (0,
|
29253
|
-
/* @__PURE__ */ (0,
|
29279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
29280
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29254
29281
|
"div",
|
29255
29282
|
__spreadProps(__spreadValues(__spreadValues({
|
29256
29283
|
className: className && className(provided, snapshot),
|
29257
29284
|
ref: provided.innerRef
|
29258
29285
|
}, provided.draggableProps), provided.dragHandleProps), {
|
29259
29286
|
style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
|
29260
|
-
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
|
29287
|
+
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)",
|
29288
|
+
cursor: isDragDisabled ? "no-drop" : "grab"
|
29261
29289
|
}),
|
29262
29290
|
children: children(provided, snapshot)
|
29263
29291
|
})
|
29264
29292
|
),
|
29265
|
-
showShadow && snapshot.isDragging && /* @__PURE__ */ (0,
|
29293
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29266
29294
|
"div",
|
29267
29295
|
{
|
29268
29296
|
className: className && className(provided, snapshot),
|
@@ -29282,28 +29310,28 @@ init_react_import();
|
|
29282
29310
|
|
29283
29311
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
|
29284
29312
|
init_react_import();
|
29285
|
-
var
|
29313
|
+
var styles_module_default5 = { "DragIcon": "_DragIcon_17p8x_1", "DragIcon--disabled": "_DragIcon--disabled_17p8x_8" };
|
29286
29314
|
|
29287
29315
|
// components/DragIcon/index.tsx
|
29288
|
-
var
|
29289
|
-
var
|
29290
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
29316
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
29317
|
+
var getClassName4 = get_class_name_factory_default("DragIcon", styles_module_default5);
|
29318
|
+
var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4({ disabled: isDragDisabled }), 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" }) }) });
|
29291
29319
|
|
29292
29320
|
// components/DragDropContext/index.tsx
|
29293
29321
|
init_react_import();
|
29294
29322
|
var import_dnd3 = require("@measured/dnd");
|
29295
|
-
var
|
29296
|
-
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0,
|
29323
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
29324
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
|
29297
29325
|
var DragDropContext = (props) => {
|
29298
29326
|
const { status } = useAppContext();
|
29299
29327
|
const El = status !== "LOADING" ? import_dnd3.DragDropContext : DefaultDragDropContext;
|
29300
|
-
return /* @__PURE__ */ (0,
|
29328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(El, __spreadValues({}, props));
|
29301
29329
|
};
|
29302
29330
|
|
29303
29331
|
// components/AutoField/fields/ArrayField/index.tsx
|
29304
|
-
var
|
29305
|
-
var
|
29306
|
-
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem",
|
29332
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
29333
|
+
var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
|
29334
|
+
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
|
29307
29335
|
var ArrayField = ({
|
29308
29336
|
field,
|
29309
29337
|
onChange,
|
@@ -29312,7 +29340,7 @@ var ArrayField = ({
|
|
29312
29340
|
label,
|
29313
29341
|
readOnly,
|
29314
29342
|
id,
|
29315
|
-
Label = (props) => /* @__PURE__ */ (0,
|
29343
|
+
Label = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", __spreadValues({}, props))
|
29316
29344
|
}) => {
|
29317
29345
|
const { state, setUi, selectedItem } = useAppContext();
|
29318
29346
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
@@ -29375,14 +29403,14 @@ var ArrayField = ({
|
|
29375
29403
|
return null;
|
29376
29404
|
}
|
29377
29405
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
29378
|
-
return /* @__PURE__ */ (0,
|
29406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29379
29407
|
Label,
|
29380
29408
|
{
|
29381
29409
|
label: label || name,
|
29382
|
-
icon: /* @__PURE__ */ (0,
|
29410
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(List, { size: 16 }),
|
29383
29411
|
el: "div",
|
29384
29412
|
readOnly,
|
29385
|
-
children: /* @__PURE__ */ (0,
|
29413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29386
29414
|
DragDropContext,
|
29387
29415
|
{
|
29388
29416
|
onDragEnd: (event) => {
|
@@ -29409,12 +29437,12 @@ var ArrayField = ({
|
|
29409
29437
|
});
|
29410
29438
|
}
|
29411
29439
|
},
|
29412
|
-
children: /* @__PURE__ */ (0,
|
29413
|
-
return /* @__PURE__ */ (0,
|
29440
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
29441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
29414
29442
|
"div",
|
29415
29443
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
29416
29444
|
ref: provided.innerRef,
|
29417
|
-
className:
|
29445
|
+
className: getClassName5({
|
29418
29446
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
29419
29447
|
hasItems: Array.isArray(value) && value.length > 0,
|
29420
29448
|
addDisabled
|
@@ -29431,7 +29459,7 @@ var ArrayField = ({
|
|
29431
29459
|
localState.arrayState.items.map((item, i) => {
|
29432
29460
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
29433
29461
|
const data = Array.from(localState.value || [])[i] || {};
|
29434
|
-
return /* @__PURE__ */ (0,
|
29462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29435
29463
|
Draggable,
|
29436
29464
|
{
|
29437
29465
|
id: _arrayId,
|
@@ -29442,8 +29470,8 @@ var ArrayField = ({
|
|
29442
29470
|
readOnly
|
29443
29471
|
}),
|
29444
29472
|
isDragDisabled: readOnly || !hovering,
|
29445
|
-
children: () => /* @__PURE__ */ (0,
|
29446
|
-
/* @__PURE__ */ (0,
|
29473
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
29474
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
29447
29475
|
"div",
|
29448
29476
|
{
|
29449
29477
|
onClick: () => {
|
@@ -29464,8 +29492,8 @@ var ArrayField = ({
|
|
29464
29492
|
className: getClassNameItem("summary"),
|
29465
29493
|
children: [
|
29466
29494
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
29467
|
-
/* @__PURE__ */ (0,
|
29468
|
-
!readOnly && /* @__PURE__ */ (0,
|
29495
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
29496
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29469
29497
|
IconButton,
|
29470
29498
|
{
|
29471
29499
|
type: "button",
|
@@ -29488,20 +29516,20 @@ var ArrayField = ({
|
|
29488
29516
|
);
|
29489
29517
|
},
|
29490
29518
|
title: "Delete",
|
29491
|
-
children: /* @__PURE__ */ (0,
|
29519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Trash, { size: 16 })
|
29492
29520
|
}
|
29493
29521
|
) }) }),
|
29494
|
-
/* @__PURE__ */ (0,
|
29522
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DragIcon, {}) })
|
29495
29523
|
] })
|
29496
29524
|
]
|
29497
29525
|
}
|
29498
29526
|
),
|
29499
|
-
/* @__PURE__ */ (0,
|
29527
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
29500
29528
|
(fieldName) => {
|
29501
29529
|
const subField = field.arrayFields[fieldName];
|
29502
29530
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
29503
29531
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
29504
|
-
return /* @__PURE__ */ (0,
|
29532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29505
29533
|
AutoFieldPrivate,
|
29506
29534
|
{
|
29507
29535
|
name: subFieldName,
|
@@ -29529,11 +29557,11 @@ var ArrayField = ({
|
|
29529
29557
|
);
|
29530
29558
|
}),
|
29531
29559
|
provided.placeholder,
|
29532
|
-
!addDisabled && /* @__PURE__ */ (0,
|
29560
|
+
!addDisabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29533
29561
|
"button",
|
29534
29562
|
{
|
29535
29563
|
type: "button",
|
29536
|
-
className:
|
29564
|
+
className: getClassName5("addButton"),
|
29537
29565
|
onClick: () => {
|
29538
29566
|
const existingValue = value || [];
|
29539
29567
|
const newValue = [
|
@@ -29543,7 +29571,7 @@ var ArrayField = ({
|
|
29543
29571
|
const newArrayState = regenerateArrayState(newValue);
|
29544
29572
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
29545
29573
|
},
|
29546
|
-
children: /* @__PURE__ */ (0,
|
29574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Plus, { size: 21 })
|
29547
29575
|
}
|
29548
29576
|
)
|
29549
29577
|
]
|
@@ -29558,8 +29586,8 @@ var ArrayField = ({
|
|
29558
29586
|
|
29559
29587
|
// components/AutoField/fields/DefaultField/index.tsx
|
29560
29588
|
init_react_import();
|
29561
|
-
var
|
29562
|
-
var
|
29589
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
29590
|
+
var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
|
29563
29591
|
var DefaultField = ({
|
29564
29592
|
field,
|
29565
29593
|
onChange,
|
@@ -29570,19 +29598,19 @@ var DefaultField = ({
|
|
29570
29598
|
Label,
|
29571
29599
|
id
|
29572
29600
|
}) => {
|
29573
|
-
return /* @__PURE__ */ (0,
|
29601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
29574
29602
|
Label,
|
29575
29603
|
{
|
29576
29604
|
label: label || name,
|
29577
|
-
icon: /* @__PURE__ */ (0,
|
29578
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
29579
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
29605
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
29606
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Type, { size: 16 }),
|
29607
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hash, { size: 16 })
|
29580
29608
|
] }),
|
29581
29609
|
readOnly,
|
29582
|
-
children: /* @__PURE__ */ (0,
|
29610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
29583
29611
|
"input",
|
29584
29612
|
{
|
29585
|
-
className:
|
29613
|
+
className: getClassName6("input"),
|
29586
29614
|
autoComplete: "off",
|
29587
29615
|
type: field.type,
|
29588
29616
|
name,
|
@@ -29615,7 +29643,7 @@ var import_react8 = require("react");
|
|
29615
29643
|
|
29616
29644
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
29617
29645
|
init_react_import();
|
29618
|
-
var
|
29646
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_19obq_1", "ExternalInput-button": "_ExternalInput-button_19obq_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_19obq_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_19obq_32", "ExternalInputModal": "_ExternalInputModal_19obq_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_19obq_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_19obq_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_19obq_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_19obq_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_19obq_128", "ExternalInputModal-table": "_ExternalInputModal-table_19obq_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_19obq_144", "ExternalInputModal-th": "_ExternalInputModal-th_19obq_144", "ExternalInputModal-td": "_ExternalInputModal-td_19obq_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_19obq_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_19obq_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_19obq_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_19obq_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_19obq_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_19obq_222", "ExternalInputModal-search": "_ExternalInputModal-search_19obq_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_19obq_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_19obq_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_19obq_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_19obq_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_19obq_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_19obq_325" };
|
29619
29647
|
|
29620
29648
|
// components/Modal/index.tsx
|
29621
29649
|
init_react_import();
|
@@ -29623,12 +29651,12 @@ var import_react6 = require("react");
|
|
29623
29651
|
|
29624
29652
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
29625
29653
|
init_react_import();
|
29626
|
-
var
|
29654
|
+
var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
|
29627
29655
|
|
29628
29656
|
// components/Modal/index.tsx
|
29629
29657
|
var import_react_dom = __toESM(require_react_dom());
|
29630
|
-
var
|
29631
|
-
var
|
29658
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
29659
|
+
var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
|
29632
29660
|
var Modal = ({
|
29633
29661
|
children,
|
29634
29662
|
onClose,
|
@@ -29639,13 +29667,13 @@ var Modal = ({
|
|
29639
29667
|
setRootEl(document.getElementById("puck-portal-root"));
|
29640
29668
|
}, []);
|
29641
29669
|
if (!rootEl) {
|
29642
|
-
return /* @__PURE__ */ (0,
|
29670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {});
|
29643
29671
|
}
|
29644
29672
|
return (0, import_react_dom.createPortal)(
|
29645
|
-
/* @__PURE__ */ (0,
|
29673
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
29646
29674
|
"div",
|
29647
29675
|
{
|
29648
|
-
className:
|
29676
|
+
className: getClassName7("inner"),
|
29649
29677
|
onClick: (e) => e.stopPropagation(),
|
29650
29678
|
children
|
29651
29679
|
}
|
@@ -29659,17 +29687,17 @@ init_react_import();
|
|
29659
29687
|
|
29660
29688
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
29661
29689
|
init_react_import();
|
29662
|
-
var
|
29690
|
+
var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
29663
29691
|
|
29664
29692
|
// components/Heading/index.tsx
|
29665
|
-
var
|
29666
|
-
var
|
29693
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
29694
|
+
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
|
29667
29695
|
var Heading = ({ children, rank, size = "m" }) => {
|
29668
29696
|
const Tag = rank ? `h${rank}` : "span";
|
29669
|
-
return /* @__PURE__ */ (0,
|
29697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
29670
29698
|
Tag,
|
29671
29699
|
{
|
29672
|
-
className:
|
29700
|
+
className: getClassName8({
|
29673
29701
|
[size]: true
|
29674
29702
|
}),
|
29675
29703
|
children
|
@@ -29689,8 +29717,8 @@ init_react_import();
|
|
29689
29717
|
var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
|
29690
29718
|
|
29691
29719
|
// components/Button/Button.tsx
|
29692
|
-
var
|
29693
|
-
var
|
29720
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
29721
|
+
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
29694
29722
|
var Button = ({
|
29695
29723
|
children,
|
29696
29724
|
href,
|
@@ -29708,10 +29736,10 @@ var Button = ({
|
|
29708
29736
|
const [loading, setLoading] = (0, import_react7.useState)(loadingProp);
|
29709
29737
|
(0, import_react7.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
29710
29738
|
const ElementType = href ? "a" : type ? "button" : "span";
|
29711
|
-
const el = /* @__PURE__ */ (0,
|
29739
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
29712
29740
|
ElementType,
|
29713
29741
|
{
|
29714
|
-
className:
|
29742
|
+
className: getClassName9({
|
29715
29743
|
primary: variant === "primary",
|
29716
29744
|
secondary: variant === "secondary",
|
29717
29745
|
disabled,
|
@@ -29732,9 +29760,9 @@ var Button = ({
|
|
29732
29760
|
rel: newTab ? "noreferrer" : void 0,
|
29733
29761
|
href,
|
29734
29762
|
children: [
|
29735
|
-
icon && /* @__PURE__ */ (0,
|
29763
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("icon"), children: icon }),
|
29736
29764
|
children,
|
29737
|
-
loading && /* @__PURE__ */ (0,
|
29765
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 14 }) })
|
29738
29766
|
]
|
29739
29767
|
}
|
29740
29768
|
);
|
@@ -29742,9 +29770,9 @@ var Button = ({
|
|
29742
29770
|
};
|
29743
29771
|
|
29744
29772
|
// components/ExternalInput/index.tsx
|
29745
|
-
var
|
29746
|
-
var
|
29747
|
-
var getClassNameModal = get_class_name_factory_default("ExternalInputModal",
|
29773
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
29774
|
+
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
29775
|
+
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
29748
29776
|
var dataCache = {};
|
29749
29777
|
var ExternalInput = ({
|
29750
29778
|
field,
|
@@ -29795,40 +29823,40 @@ var ExternalInput = ({
|
|
29795
29823
|
(0, import_react8.useEffect)(() => {
|
29796
29824
|
search(searchQuery, filters);
|
29797
29825
|
}, []);
|
29798
|
-
return /* @__PURE__ */ (0,
|
29826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
29799
29827
|
"div",
|
29800
29828
|
{
|
29801
|
-
className:
|
29829
|
+
className: getClassName10({
|
29802
29830
|
dataSelected: !!value,
|
29803
29831
|
modalVisible: isOpen
|
29804
29832
|
}),
|
29805
29833
|
id,
|
29806
29834
|
children: [
|
29807
|
-
/* @__PURE__ */ (0,
|
29808
|
-
/* @__PURE__ */ (0,
|
29835
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName10("actions"), children: [
|
29836
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29809
29837
|
"button",
|
29810
29838
|
{
|
29811
29839
|
type: "button",
|
29812
29840
|
onClick: () => setOpen(true),
|
29813
|
-
className:
|
29814
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
29815
|
-
/* @__PURE__ */ (0,
|
29816
|
-
/* @__PURE__ */ (0,
|
29841
|
+
className: getClassName10("button"),
|
29842
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
29843
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: "16" }),
|
29844
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: field.placeholder })
|
29817
29845
|
] })
|
29818
29846
|
}
|
29819
29847
|
),
|
29820
|
-
value && /* @__PURE__ */ (0,
|
29848
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29821
29849
|
"button",
|
29822
29850
|
{
|
29823
|
-
className:
|
29851
|
+
className: getClassName10("detachButton"),
|
29824
29852
|
onClick: () => {
|
29825
29853
|
onChange(null);
|
29826
29854
|
},
|
29827
|
-
children: /* @__PURE__ */ (0,
|
29855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Unlock, { size: 16 })
|
29828
29856
|
}
|
29829
29857
|
)
|
29830
29858
|
] }),
|
29831
|
-
/* @__PURE__ */ (0,
|
29859
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
29832
29860
|
"form",
|
29833
29861
|
{
|
29834
29862
|
className: getClassNameModal({
|
@@ -29842,11 +29870,11 @@ var ExternalInput = ({
|
|
29842
29870
|
search(searchQuery, filters);
|
29843
29871
|
},
|
29844
29872
|
children: [
|
29845
|
-
/* @__PURE__ */ (0,
|
29846
|
-
/* @__PURE__ */ (0,
|
29847
|
-
/* @__PURE__ */ (0,
|
29848
|
-
/* @__PURE__ */ (0,
|
29849
|
-
/* @__PURE__ */ (0,
|
29873
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
29874
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: getClassNameModal("search"), children: [
|
29875
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
29876
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Search, { size: "18" }) }),
|
29877
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29850
29878
|
"input",
|
29851
29879
|
{
|
29852
29880
|
className: getClassNameModal("searchInput"),
|
@@ -29861,9 +29889,9 @@ var ExternalInput = ({
|
|
29861
29889
|
}
|
29862
29890
|
)
|
29863
29891
|
] }),
|
29864
|
-
/* @__PURE__ */ (0,
|
29865
|
-
/* @__PURE__ */ (0,
|
29866
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
29892
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
29893
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
29894
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29867
29895
|
IconButton,
|
29868
29896
|
{
|
29869
29897
|
title: "Toggle filters",
|
@@ -29872,15 +29900,15 @@ var ExternalInput = ({
|
|
29872
29900
|
e.stopPropagation();
|
29873
29901
|
setFiltersToggled(!filtersToggled);
|
29874
29902
|
},
|
29875
|
-
children: /* @__PURE__ */ (0,
|
29903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlidersHorizontal, { size: 20 })
|
29876
29904
|
}
|
29877
29905
|
) })
|
29878
29906
|
] })
|
29879
|
-
] }) : /* @__PURE__ */ (0,
|
29880
|
-
/* @__PURE__ */ (0,
|
29881
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
29907
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
29908
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
29909
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
29882
29910
|
const filterField = filterFields[fieldName];
|
29883
|
-
return /* @__PURE__ */ (0,
|
29911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29884
29912
|
AutoFieldPrivate,
|
29885
29913
|
{
|
29886
29914
|
field: filterField,
|
@@ -29897,9 +29925,9 @@ var ExternalInput = ({
|
|
29897
29925
|
fieldName
|
29898
29926
|
);
|
29899
29927
|
}) }),
|
29900
|
-
/* @__PURE__ */ (0,
|
29901
|
-
/* @__PURE__ */ (0,
|
29902
|
-
/* @__PURE__ */ (0,
|
29928
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
29929
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: getClassNameModal("table"), children: [
|
29930
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29903
29931
|
"th",
|
29904
29932
|
{
|
29905
29933
|
className: getClassNameModal("th"),
|
@@ -29908,8 +29936,8 @@ var ExternalInput = ({
|
|
29908
29936
|
},
|
29909
29937
|
key
|
29910
29938
|
)) }) }),
|
29911
|
-
/* @__PURE__ */ (0,
|
29912
|
-
return /* @__PURE__ */ (0,
|
29939
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
29940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29913
29941
|
"tr",
|
29914
29942
|
{
|
29915
29943
|
style: { whiteSpace: "nowrap" },
|
@@ -29918,16 +29946,16 @@ var ExternalInput = ({
|
|
29918
29946
|
onChange(mapProp(data[i]));
|
29919
29947
|
setOpen(false);
|
29920
29948
|
},
|
29921
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
29949
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
29922
29950
|
},
|
29923
29951
|
i
|
29924
29952
|
);
|
29925
29953
|
}) })
|
29926
29954
|
] }),
|
29927
|
-
/* @__PURE__ */ (0,
|
29955
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loader, { size: 24 }) })
|
29928
29956
|
] })
|
29929
29957
|
] }),
|
29930
|
-
/* @__PURE__ */ (0,
|
29958
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
29931
29959
|
mappedData.length,
|
29932
29960
|
" result",
|
29933
29961
|
mappedData.length === 1 ? "" : "s"
|
@@ -29941,7 +29969,7 @@ var ExternalInput = ({
|
|
29941
29969
|
};
|
29942
29970
|
|
29943
29971
|
// components/AutoField/fields/ExternalField/index.tsx
|
29944
|
-
var
|
29972
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
29945
29973
|
var ExternalField = ({
|
29946
29974
|
field,
|
29947
29975
|
onChange,
|
@@ -29964,7 +29992,7 @@ var ExternalField = ({
|
|
29964
29992
|
if (field.type !== "external") {
|
29965
29993
|
return null;
|
29966
29994
|
}
|
29967
|
-
return /* @__PURE__ */ (0,
|
29995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
29968
29996
|
ExternalInput,
|
29969
29997
|
{
|
29970
29998
|
name,
|
@@ -29988,8 +30016,8 @@ var ExternalField = ({
|
|
29988
30016
|
|
29989
30017
|
// components/AutoField/fields/RadioField/index.tsx
|
29990
30018
|
init_react_import();
|
29991
|
-
var
|
29992
|
-
var
|
30019
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
30020
|
+
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
29993
30021
|
var RadioField = ({
|
29994
30022
|
field,
|
29995
30023
|
onChange,
|
@@ -30003,23 +30031,23 @@ var RadioField = ({
|
|
30003
30031
|
if (field.type !== "radio" || !field.options) {
|
30004
30032
|
return null;
|
30005
30033
|
}
|
30006
|
-
return /* @__PURE__ */ (0,
|
30034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
30007
30035
|
Label,
|
30008
30036
|
{
|
30009
|
-
icon: /* @__PURE__ */ (0,
|
30037
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckCircle, { size: 16 }),
|
30010
30038
|
label: label || name,
|
30011
30039
|
readOnly,
|
30012
30040
|
el: "div",
|
30013
|
-
children: /* @__PURE__ */ (0,
|
30041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
30014
30042
|
"label",
|
30015
30043
|
{
|
30016
|
-
className:
|
30044
|
+
className: getClassName11("radio"),
|
30017
30045
|
children: [
|
30018
|
-
/* @__PURE__ */ (0,
|
30046
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
30019
30047
|
"input",
|
30020
30048
|
{
|
30021
30049
|
type: "radio",
|
30022
|
-
className:
|
30050
|
+
className: getClassName11("radioInput"),
|
30023
30051
|
value: option.value,
|
30024
30052
|
name,
|
30025
30053
|
onChange: (e) => {
|
@@ -30033,7 +30061,7 @@ var RadioField = ({
|
|
30033
30061
|
checked: value === option.value
|
30034
30062
|
}
|
30035
30063
|
),
|
30036
|
-
/* @__PURE__ */ (0,
|
30064
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
30037
30065
|
]
|
30038
30066
|
},
|
30039
30067
|
option.label + option.value
|
@@ -30044,8 +30072,8 @@ var RadioField = ({
|
|
30044
30072
|
|
30045
30073
|
// components/AutoField/fields/SelectField/index.tsx
|
30046
30074
|
init_react_import();
|
30047
|
-
var
|
30048
|
-
var
|
30075
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
30076
|
+
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
30049
30077
|
var SelectField = ({
|
30050
30078
|
field,
|
30051
30079
|
onChange,
|
@@ -30059,17 +30087,17 @@ var SelectField = ({
|
|
30059
30087
|
if (field.type !== "select" || !field.options) {
|
30060
30088
|
return null;
|
30061
30089
|
}
|
30062
|
-
return /* @__PURE__ */ (0,
|
30090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
30063
30091
|
Label,
|
30064
30092
|
{
|
30065
30093
|
label: label || name,
|
30066
|
-
icon: /* @__PURE__ */ (0,
|
30094
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDown, { size: 16 }),
|
30067
30095
|
readOnly,
|
30068
|
-
children: /* @__PURE__ */ (0,
|
30096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
30069
30097
|
"select",
|
30070
30098
|
{
|
30071
30099
|
id,
|
30072
|
-
className:
|
30100
|
+
className: getClassName12("input"),
|
30073
30101
|
disabled: readOnly,
|
30074
30102
|
onChange: (e) => {
|
30075
30103
|
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
@@ -30079,7 +30107,7 @@ var SelectField = ({
|
|
30079
30107
|
onChange(e.currentTarget.value);
|
30080
30108
|
},
|
30081
30109
|
value,
|
30082
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
30110
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
30083
30111
|
"option",
|
30084
30112
|
{
|
30085
30113
|
label: option.label,
|
@@ -30095,8 +30123,8 @@ var SelectField = ({
|
|
30095
30123
|
|
30096
30124
|
// components/AutoField/fields/TextareaField/index.tsx
|
30097
30125
|
init_react_import();
|
30098
|
-
var
|
30099
|
-
var
|
30126
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
30127
|
+
var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
|
30100
30128
|
var TextareaField = ({
|
30101
30129
|
onChange,
|
30102
30130
|
readOnly,
|
@@ -30106,11 +30134,11 @@ var TextareaField = ({
|
|
30106
30134
|
Label,
|
30107
30135
|
id
|
30108
30136
|
}) => {
|
30109
|
-
return /* @__PURE__ */ (0,
|
30137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
30110
30138
|
"textarea",
|
30111
30139
|
{
|
30112
30140
|
id,
|
30113
|
-
className:
|
30141
|
+
className: getClassName13("input"),
|
30114
30142
|
autoComplete: "off",
|
30115
30143
|
name,
|
30116
30144
|
value: typeof value === "undefined" ? "" : value,
|
@@ -30130,11 +30158,11 @@ init_react_import();
|
|
30130
30158
|
|
30131
30159
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/fields/ObjectField/styles.module.css#css-module
|
30132
30160
|
init_react_import();
|
30133
|
-
var
|
30161
|
+
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
30134
30162
|
|
30135
30163
|
// components/AutoField/fields/ObjectField/index.tsx
|
30136
|
-
var
|
30137
|
-
var
|
30164
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
30165
|
+
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
30138
30166
|
var ObjectField = ({
|
30139
30167
|
field,
|
30140
30168
|
onChange,
|
@@ -30151,18 +30179,18 @@ var ObjectField = ({
|
|
30151
30179
|
}
|
30152
30180
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
30153
30181
|
const data = value || {};
|
30154
|
-
return /* @__PURE__ */ (0,
|
30182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
30155
30183
|
Label,
|
30156
30184
|
{
|
30157
30185
|
label: label || name,
|
30158
|
-
icon: /* @__PURE__ */ (0,
|
30186
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MoreVertical, { size: 16 }),
|
30159
30187
|
el: "div",
|
30160
30188
|
readOnly,
|
30161
|
-
children: /* @__PURE__ */ (0,
|
30189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
|
30162
30190
|
const subField = field.objectFields[fieldName];
|
30163
30191
|
const subFieldName = `${name}.${fieldName}`;
|
30164
30192
|
const wildcardFieldName = `${name}.${fieldName}`;
|
30165
|
-
return /* @__PURE__ */ (0,
|
30193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
30166
30194
|
AutoFieldPrivate,
|
30167
30195
|
{
|
30168
30196
|
name: subFieldName,
|
@@ -30206,8 +30234,8 @@ var useSafeId = () => {
|
|
30206
30234
|
};
|
30207
30235
|
|
30208
30236
|
// components/AutoField/index.tsx
|
30209
|
-
var
|
30210
|
-
var
|
30237
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
30238
|
+
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
30211
30239
|
var FieldLabel = ({
|
30212
30240
|
children,
|
30213
30241
|
icon,
|
@@ -30217,11 +30245,11 @@ var FieldLabel = ({
|
|
30217
30245
|
className
|
30218
30246
|
}) => {
|
30219
30247
|
const El = el;
|
30220
|
-
return /* @__PURE__ */ (0,
|
30221
|
-
/* @__PURE__ */ (0,
|
30222
|
-
icon ? /* @__PURE__ */ (0,
|
30248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(El, { className, children: [
|
30249
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName15("label"), children: [
|
30250
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {}),
|
30223
30251
|
label,
|
30224
|
-
readOnly && /* @__PURE__ */ (0,
|
30252
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Lock, { size: "12" }) })
|
30225
30253
|
] }),
|
30226
30254
|
children
|
30227
30255
|
] });
|
@@ -30239,14 +30267,14 @@ var FieldLabelInternal2 = ({
|
|
30239
30267
|
[overrides]
|
30240
30268
|
);
|
30241
30269
|
if (!label) {
|
30242
|
-
return /* @__PURE__ */ (0,
|
30270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
30243
30271
|
}
|
30244
|
-
return /* @__PURE__ */ (0,
|
30272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
30245
30273
|
Wrapper,
|
30246
30274
|
{
|
30247
30275
|
label,
|
30248
30276
|
icon,
|
30249
|
-
className:
|
30277
|
+
className: getClassName15({ readOnly }),
|
30250
30278
|
readOnly,
|
30251
30279
|
el,
|
30252
30280
|
children
|
@@ -30290,11 +30318,11 @@ function AutoFieldInternal(props) {
|
|
30290
30318
|
return null;
|
30291
30319
|
}
|
30292
30320
|
const CustomField = field.render;
|
30293
|
-
return /* @__PURE__ */ (0,
|
30321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomField, __spreadValues({}, mergedProps)) });
|
30294
30322
|
}
|
30295
30323
|
const children = defaultFields[field.type](mergedProps);
|
30296
30324
|
const Render2 = render[field.type];
|
30297
|
-
return /* @__PURE__ */ (0,
|
30325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
30298
30326
|
}
|
30299
30327
|
function AutoFieldPrivate(props) {
|
30300
30328
|
const { value, onChange } = props;
|
@@ -30317,11 +30345,11 @@ function AutoFieldPrivate(props) {
|
|
30317
30345
|
value: localValue,
|
30318
30346
|
onChange: onChangeLocal
|
30319
30347
|
};
|
30320
|
-
return /* @__PURE__ */ (0,
|
30348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
30321
30349
|
}
|
30322
|
-
var DefaultLabel = (props) => /* @__PURE__ */ (0,
|
30350
|
+
var DefaultLabel = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", __spreadValues({}, props));
|
30323
30351
|
function AutoField(props) {
|
30324
|
-
return /* @__PURE__ */ (0,
|
30352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
|
30325
30353
|
}
|
30326
30354
|
|
30327
30355
|
// components/Drawer/index.tsx
|
@@ -30329,49 +30357,62 @@ init_react_import();
|
|
30329
30357
|
|
30330
30358
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
|
30331
30359
|
init_react_import();
|
30332
|
-
var
|
30360
|
+
var styles_module_default10 = { "Drawer": "_Drawer_4yfqn_1", "DrawerItem--disabled": "_DrawerItem--disabled_4yfqn_5", "DrawerItem-default": "_DrawerItem-default_4yfqn_11", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_4yfqn_11", "DrawerItem": "_DrawerItem_4yfqn_5", "DrawerItem-draggable": "_DrawerItem-draggable_4yfqn_11", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_4yfqn_36", "DrawerItem-name": "_DrawerItem-name_4yfqn_54" };
|
30333
30361
|
|
30334
30362
|
// components/Drawer/index.tsx
|
30335
30363
|
var import_react12 = require("react");
|
30336
|
-
var
|
30337
|
-
var
|
30338
|
-
var getClassNameItem2 = get_class_name_factory_default("DrawerItem",
|
30364
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
30365
|
+
var getClassName16 = get_class_name_factory_default("Drawer", styles_module_default10);
|
30366
|
+
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
30339
30367
|
var drawerContext = (0, import_react12.createContext)({
|
30340
30368
|
droppableId: ""
|
30341
30369
|
});
|
30342
30370
|
var DrawerDraggable = ({
|
30343
30371
|
children,
|
30344
30372
|
id,
|
30345
|
-
index
|
30346
|
-
|
30347
|
-
|
30348
|
-
|
30349
|
-
|
30350
|
-
|
30351
|
-
|
30352
|
-
|
30353
|
-
|
30354
|
-
|
30355
|
-
|
30356
|
-
|
30357
|
-
)
|
30373
|
+
index,
|
30374
|
+
isDragDisabled
|
30375
|
+
}) => {
|
30376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
30377
|
+
Draggable,
|
30378
|
+
{
|
30379
|
+
id,
|
30380
|
+
index,
|
30381
|
+
isDragDisabled,
|
30382
|
+
showShadow: true,
|
30383
|
+
disableAnimations: true,
|
30384
|
+
className: () => getClassNameItem2({ disabled: isDragDisabled }),
|
30385
|
+
children: () => children
|
30386
|
+
},
|
30387
|
+
id
|
30388
|
+
);
|
30389
|
+
};
|
30358
30390
|
var DrawerItem = ({
|
30359
30391
|
name,
|
30360
30392
|
children,
|
30361
30393
|
id,
|
30362
30394
|
label,
|
30363
|
-
index
|
30395
|
+
index,
|
30396
|
+
isDragDisabled
|
30364
30397
|
}) => {
|
30365
30398
|
const ctx = (0, import_react12.useContext)(drawerContext);
|
30366
30399
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
30367
30400
|
const CustomInner = (0, import_react12.useMemo)(
|
30368
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0,
|
30401
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
30369
30402
|
[children]
|
30370
30403
|
);
|
30371
|
-
return /* @__PURE__ */ (0,
|
30372
|
-
|
30373
|
-
|
30374
|
-
|
30404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
30405
|
+
DrawerDraggable,
|
30406
|
+
{
|
30407
|
+
id: resolvedId,
|
30408
|
+
index,
|
30409
|
+
isDragDisabled,
|
30410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
30411
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
30412
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DragIcon, { isDragDisabled }) })
|
30413
|
+
] }) }) })
|
30414
|
+
}
|
30415
|
+
);
|
30375
30416
|
};
|
30376
30417
|
var Drawer = ({
|
30377
30418
|
children,
|
@@ -30379,16 +30420,16 @@ var Drawer = ({
|
|
30379
30420
|
direction = "vertical"
|
30380
30421
|
}) => {
|
30381
30422
|
const droppableId = `component-list:${_droppableId}`;
|
30382
|
-
return /* @__PURE__ */ (0,
|
30423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
30383
30424
|
"div",
|
30384
30425
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
30385
30426
|
ref: provided.innerRef,
|
30386
|
-
className:
|
30427
|
+
className: getClassName16({
|
30387
30428
|
isDraggingFrom: !!snapshot.draggingFromThisWith
|
30388
30429
|
}),
|
30389
30430
|
children: [
|
30390
30431
|
children,
|
30391
|
-
/* @__PURE__ */ (0,
|
30432
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
30392
30433
|
]
|
30393
30434
|
})
|
30394
30435
|
) }) });
|
@@ -30397,16 +30438,16 @@ Drawer.Item = DrawerItem;
|
|
30397
30438
|
|
30398
30439
|
// components/DropZone/index.tsx
|
30399
30440
|
init_react_import();
|
30400
|
-
var
|
30441
|
+
var import_react17 = require("react");
|
30401
30442
|
|
30402
30443
|
// components/DraggableComponent/index.tsx
|
30403
30444
|
init_react_import();
|
30404
|
-
var
|
30445
|
+
var import_react15 = require("react");
|
30405
30446
|
var import_dnd4 = require("@measured/dnd");
|
30406
30447
|
|
30407
30448
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
30408
30449
|
init_react_import();
|
30409
|
-
var
|
30450
|
+
var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1bhad_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1bhad_11", "DraggableComponent-contents": "_DraggableComponent-contents_1bhad_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1bhad_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1bhad_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1bhad_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1bhad_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1bhad_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1bhad_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1bhad_97", "DraggableComponent-actions": "_DraggableComponent-actions_1bhad_97" };
|
30410
30451
|
|
30411
30452
|
// lib/use-modifier-held.ts
|
30412
30453
|
init_react_import();
|
@@ -30446,13 +30487,92 @@ var isIos = () => [
|
|
30446
30487
|
].includes(navigator.platform) || // iPad on iOS 13 detection
|
30447
30488
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
30448
30489
|
|
30490
|
+
// components/DefaultOverride/index.tsx
|
30491
|
+
init_react_import();
|
30492
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
30493
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children });
|
30494
|
+
|
30495
|
+
// lib/use-loaded-overrides.ts
|
30496
|
+
init_react_import();
|
30497
|
+
var import_react14 = require("react");
|
30498
|
+
|
30499
|
+
// lib/load-overrides.ts
|
30500
|
+
init_react_import();
|
30501
|
+
var loadOverrides = ({
|
30502
|
+
overrides,
|
30503
|
+
plugins
|
30504
|
+
}) => {
|
30505
|
+
const collected = __spreadValues({}, overrides);
|
30506
|
+
plugins.forEach((plugin) => {
|
30507
|
+
Object.keys(plugin.overrides).forEach((overridesType) => {
|
30508
|
+
if (overridesType === "fieldTypes") {
|
30509
|
+
const fieldTypes = plugin.overrides.fieldTypes;
|
30510
|
+
Object.keys(fieldTypes).forEach((fieldType) => {
|
30511
|
+
collected.fieldTypes = collected.fieldTypes || {};
|
30512
|
+
const childNode2 = collected.fieldTypes[fieldType];
|
30513
|
+
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
30514
|
+
children: childNode2 ? childNode2(props) : props.children
|
30515
|
+
}));
|
30516
|
+
collected.fieldTypes[fieldType] = Comp2;
|
30517
|
+
});
|
30518
|
+
return;
|
30519
|
+
}
|
30520
|
+
const childNode = collected[overridesType];
|
30521
|
+
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
30522
|
+
children: childNode ? childNode(props) : props.children
|
30523
|
+
}));
|
30524
|
+
collected[overridesType] = Comp;
|
30525
|
+
});
|
30526
|
+
});
|
30527
|
+
return collected;
|
30528
|
+
};
|
30529
|
+
|
30530
|
+
// lib/use-loaded-overrides.ts
|
30531
|
+
var useLoadedOverrides = ({
|
30532
|
+
overrides,
|
30533
|
+
plugins
|
30534
|
+
}) => {
|
30535
|
+
return (0, import_react14.useMemo)(() => {
|
30536
|
+
return loadOverrides({ overrides, plugins });
|
30537
|
+
}, [plugins, overrides]);
|
30538
|
+
};
|
30539
|
+
|
30540
|
+
// lib/get-permissions.ts
|
30541
|
+
init_react_import();
|
30542
|
+
var getPermissions = ({
|
30543
|
+
selectedItem,
|
30544
|
+
type,
|
30545
|
+
globalPermissions,
|
30546
|
+
config
|
30547
|
+
}) => {
|
30548
|
+
const componentType = type || selectedItem && selectedItem.type || "";
|
30549
|
+
let componentPermissions = getInitialPermissions({
|
30550
|
+
componentType,
|
30551
|
+
config,
|
30552
|
+
globalPermissions
|
30553
|
+
});
|
30554
|
+
return componentPermissions;
|
30555
|
+
};
|
30556
|
+
var getInitialPermissions = ({
|
30557
|
+
componentType,
|
30558
|
+
globalPermissions,
|
30559
|
+
config
|
30560
|
+
}) => {
|
30561
|
+
var _a;
|
30562
|
+
return __spreadValues(__spreadValues({}, globalPermissions), (_a = config.components[componentType]) == null ? void 0 : _a.permissions);
|
30563
|
+
};
|
30564
|
+
|
30449
30565
|
// components/DraggableComponent/index.tsx
|
30450
|
-
var
|
30451
|
-
var
|
30566
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
30567
|
+
var getClassName17 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
30452
30568
|
var space = 8;
|
30453
30569
|
var actionsOverlayTop = space * 6.5;
|
30454
30570
|
var actionsTop = -(actionsOverlayTop - 8);
|
30455
30571
|
var actionsRight = space;
|
30572
|
+
var DefaultActionBar = ({
|
30573
|
+
label,
|
30574
|
+
children
|
30575
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar, { label, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DefaultOverride, { children }) });
|
30456
30576
|
var DraggableComponent = ({
|
30457
30577
|
children,
|
30458
30578
|
id,
|
@@ -30475,30 +30595,50 @@ var DraggableComponent = ({
|
|
30475
30595
|
indicativeHover = false,
|
30476
30596
|
style
|
30477
30597
|
}) => {
|
30478
|
-
const {
|
30598
|
+
const {
|
30599
|
+
zoomConfig,
|
30600
|
+
status,
|
30601
|
+
overrides,
|
30602
|
+
plugins,
|
30603
|
+
selectedItem,
|
30604
|
+
config,
|
30605
|
+
globalPermissions
|
30606
|
+
} = useAppContext();
|
30479
30607
|
const isModifierHeld = useModifierHeld("Alt");
|
30480
|
-
const { status } = useAppContext();
|
30481
30608
|
const El = status !== "LOADING" ? import_dnd4.Draggable : DefaultDraggable;
|
30482
|
-
(0,
|
30483
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0,
|
30484
|
-
(0,
|
30609
|
+
(0, import_react15.useEffect)(onMount, []);
|
30610
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react15.useState)(false);
|
30611
|
+
(0, import_react15.useEffect)(() => {
|
30485
30612
|
if (isIos()) {
|
30486
30613
|
setDisableSecondaryAnimation(true);
|
30487
30614
|
}
|
30488
30615
|
}, []);
|
30489
|
-
|
30616
|
+
const loadedOverrides = useLoadedOverrides({
|
30617
|
+
overrides,
|
30618
|
+
plugins
|
30619
|
+
});
|
30620
|
+
const CustomActionBar = (0, import_react15.useMemo)(
|
30621
|
+
() => loadedOverrides.actionBar || DefaultActionBar,
|
30622
|
+
[loadedOverrides]
|
30623
|
+
);
|
30624
|
+
const permissions = selectedItem && getPermissions({
|
30625
|
+
selectedItem,
|
30626
|
+
globalPermissions: globalPermissions || {},
|
30627
|
+
config
|
30628
|
+
});
|
30629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30490
30630
|
El,
|
30491
30631
|
{
|
30492
30632
|
draggableId: id,
|
30493
30633
|
index,
|
30494
30634
|
isDragDisabled,
|
30495
30635
|
disableSecondaryAnimation,
|
30496
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
30636
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
30497
30637
|
"div",
|
30498
30638
|
__spreadProps(__spreadValues(__spreadValues({
|
30499
30639
|
ref: provided.innerRef
|
30500
30640
|
}, provided.draggableProps), provided.dragHandleProps), {
|
30501
|
-
className:
|
30641
|
+
className: getClassName17({
|
30502
30642
|
isSelected,
|
30503
30643
|
isModifierHeld,
|
30504
30644
|
isDragging: snapshot.isDragging,
|
@@ -30507,7 +30647,7 @@ var DraggableComponent = ({
|
|
30507
30647
|
indicativeHover
|
30508
30648
|
}),
|
30509
30649
|
style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
|
30510
|
-
cursor: isModifierHeld ? "initial" : "grab"
|
30650
|
+
cursor: isModifierHeld || isDragDisabled ? "initial" : "grab"
|
30511
30651
|
}),
|
30512
30652
|
onMouseOver,
|
30513
30653
|
onMouseOut,
|
@@ -30516,34 +30656,33 @@ var DraggableComponent = ({
|
|
30516
30656
|
onClick,
|
30517
30657
|
children: [
|
30518
30658
|
debug,
|
30519
|
-
isLoading && /* @__PURE__ */ (0,
|
30520
|
-
/* @__PURE__ */ (0,
|
30659
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loader, {}) }),
|
30660
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30521
30661
|
"div",
|
30522
30662
|
{
|
30523
|
-
className:
|
30663
|
+
className: getClassName17("actionsOverlay"),
|
30524
30664
|
style: {
|
30525
30665
|
top: actionsOverlayTop / zoomConfig.zoom
|
30526
30666
|
},
|
30527
|
-
children: /* @__PURE__ */ (0,
|
30667
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30528
30668
|
"div",
|
30529
30669
|
{
|
30530
|
-
className:
|
30670
|
+
className: getClassName17("actions"),
|
30531
30671
|
style: {
|
30532
30672
|
transform: `scale(${1 / zoomConfig.zoom}`,
|
30533
30673
|
top: actionsTop / zoomConfig.zoom,
|
30534
30674
|
right: actionsRight / zoomConfig.zoom
|
30535
30675
|
},
|
30536
|
-
children: [
|
30537
|
-
|
30538
|
-
/* @__PURE__ */ (0,
|
30539
|
-
|
30540
|
-
]
|
30676
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(CustomActionBar, { label, children: [
|
30677
|
+
permissions && permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Copy, { size: 16 }) }),
|
30678
|
+
permissions && permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Trash, { size: 16 }) })
|
30679
|
+
] })
|
30541
30680
|
}
|
30542
30681
|
)
|
30543
30682
|
}
|
30544
30683
|
),
|
30545
|
-
/* @__PURE__ */ (0,
|
30546
|
-
/* @__PURE__ */ (0,
|
30684
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("overlay") }),
|
30685
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("contents"), children })
|
30547
30686
|
]
|
30548
30687
|
})
|
30549
30688
|
)
|
@@ -30554,11 +30693,11 @@ var DraggableComponent = ({
|
|
30554
30693
|
|
30555
30694
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
30556
30695
|
init_react_import();
|
30557
|
-
var
|
30696
|
+
var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-content": "_DropZone-content_djoti_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_djoti_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_djoti_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_djoti_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_djoti_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_djoti_27", "DropZone--isDisabled": "_DropZone--isDisabled_djoti_28", "DropZone--isRootZone": "_DropZone--isRootZone_djoti_29", "DropZone--hasChildren": "_DropZone--hasChildren_djoti_30", "DropZone--isDestination": "_DropZone--isDestination_djoti_40", "DropZone-item": "_DropZone-item_djoti_52", "DropZone-hitbox": "_DropZone-hitbox_djoti_56" };
|
30558
30697
|
|
30559
30698
|
// components/DropZone/context.tsx
|
30560
30699
|
init_react_import();
|
30561
|
-
var
|
30700
|
+
var import_react16 = require("react");
|
30562
30701
|
var import_use_debounce2 = require("use-debounce");
|
30563
30702
|
|
30564
30703
|
// lib/get-zone-id.ts
|
@@ -30574,30 +30713,30 @@ var getZoneId = (zoneCompound) => {
|
|
30574
30713
|
};
|
30575
30714
|
|
30576
30715
|
// components/DropZone/context.tsx
|
30577
|
-
var
|
30578
|
-
var dropZoneContext = (0,
|
30716
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
30717
|
+
var dropZoneContext = (0, import_react16.createContext)(null);
|
30579
30718
|
var DropZoneProvider = ({
|
30580
30719
|
children,
|
30581
30720
|
value
|
30582
30721
|
}) => {
|
30583
|
-
const [hoveringArea, setHoveringArea] = (0,
|
30584
|
-
const [hoveringZone, setHoveringZone] = (0,
|
30722
|
+
const [hoveringArea, setHoveringArea] = (0, import_react16.useState)(null);
|
30723
|
+
const [hoveringZone, setHoveringZone] = (0, import_react16.useState)(
|
30585
30724
|
rootDroppableId
|
30586
30725
|
);
|
30587
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30726
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react16.useState)();
|
30588
30727
|
const [hoveringAreaDb] = (0, import_use_debounce2.useDebounce)(hoveringArea, 75, { leading: false });
|
30589
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30728
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react16.useState)(
|
30590
30729
|
{}
|
30591
30730
|
);
|
30592
|
-
const [activeZones, setActiveZones] = (0,
|
30731
|
+
const [activeZones, setActiveZones] = (0, import_react16.useState)({});
|
30593
30732
|
const { dispatch = null } = value ? value : {};
|
30594
|
-
const registerZoneArea = (0,
|
30733
|
+
const registerZoneArea = (0, import_react16.useCallback)(
|
30595
30734
|
(area) => {
|
30596
30735
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
30597
30736
|
},
|
30598
30737
|
[setAreasWithZones]
|
30599
30738
|
);
|
30600
|
-
const registerZone = (0,
|
30739
|
+
const registerZone = (0, import_react16.useCallback)(
|
30601
30740
|
(zoneCompound) => {
|
30602
30741
|
if (!dispatch) {
|
30603
30742
|
return;
|
@@ -30610,7 +30749,7 @@ var DropZoneProvider = ({
|
|
30610
30749
|
},
|
30611
30750
|
[setActiveZones, dispatch]
|
30612
30751
|
);
|
30613
|
-
const unregisterZone = (0,
|
30752
|
+
const unregisterZone = (0, import_react16.useCallback)(
|
30614
30753
|
(zoneCompound) => {
|
30615
30754
|
if (!dispatch) {
|
30616
30755
|
return;
|
@@ -30625,8 +30764,8 @@ var DropZoneProvider = ({
|
|
30625
30764
|
},
|
30626
30765
|
[setActiveZones, dispatch]
|
30627
30766
|
);
|
30628
|
-
const [pathData, setPathData] = (0,
|
30629
|
-
const registerPath = (0,
|
30767
|
+
const [pathData, setPathData] = (0, import_react16.useState)();
|
30768
|
+
const registerPath = (0, import_react16.useCallback)(
|
30630
30769
|
(selector) => {
|
30631
30770
|
if (!(value == null ? void 0 : value.data)) {
|
30632
30771
|
return;
|
@@ -30651,8 +30790,8 @@ var DropZoneProvider = ({
|
|
30651
30790
|
},
|
30652
30791
|
[value, setPathData]
|
30653
30792
|
);
|
30654
|
-
const [zoneWillDrag, setZoneWillDrag] = (0,
|
30655
|
-
return /* @__PURE__ */ (0,
|
30793
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react16.useState)("");
|
30794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
30656
30795
|
dropZoneContext.Provider,
|
30657
30796
|
{
|
30658
30797
|
value: __spreadValues({
|
@@ -30678,12 +30817,12 @@ var DropZoneProvider = ({
|
|
30678
30817
|
};
|
30679
30818
|
|
30680
30819
|
// components/DropZone/index.tsx
|
30681
|
-
var
|
30682
|
-
var
|
30820
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
30821
|
+
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
30683
30822
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
30684
30823
|
var _a;
|
30685
30824
|
const appContext2 = useAppContext();
|
30686
|
-
const ctx = (0,
|
30825
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30687
30826
|
const {
|
30688
30827
|
// These all need setting via context
|
30689
30828
|
data,
|
@@ -30702,12 +30841,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30702
30841
|
} = ctx || {};
|
30703
30842
|
let content = data.content || [];
|
30704
30843
|
let zoneCompound = rootDroppableId;
|
30705
|
-
(0,
|
30844
|
+
(0, import_react17.useEffect)(() => {
|
30706
30845
|
if (areaId && registerZoneArea) {
|
30707
30846
|
registerZoneArea(areaId);
|
30708
30847
|
}
|
30709
30848
|
}, [areaId]);
|
30710
|
-
(0,
|
30849
|
+
(0, import_react17.useEffect)(() => {
|
30711
30850
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
30712
30851
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
30713
30852
|
}
|
@@ -30733,7 +30872,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30733
30872
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
30734
30873
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
30735
30874
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
30736
|
-
return /* @__PURE__ */ (0,
|
30875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: "DropZone requires context to work." });
|
30737
30876
|
}
|
30738
30877
|
const {
|
30739
30878
|
hoveringArea = "root",
|
@@ -30774,10 +30913,10 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30774
30913
|
}
|
30775
30914
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30776
30915
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30777
|
-
return /* @__PURE__ */ (0,
|
30916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30778
30917
|
"div",
|
30779
30918
|
{
|
30780
|
-
className:
|
30919
|
+
className: getClassName18({
|
30781
30920
|
isRootZone,
|
30782
30921
|
userIsDragging,
|
30783
30922
|
draggingOverArea,
|
@@ -30791,17 +30930,17 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30791
30930
|
onMouseUp: () => {
|
30792
30931
|
setZoneWillDrag("");
|
30793
30932
|
},
|
30794
|
-
children: /* @__PURE__ */ (0,
|
30933
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30795
30934
|
Droppable,
|
30796
30935
|
{
|
30797
30936
|
droppableId: zoneCompound,
|
30798
30937
|
direction: "vertical",
|
30799
30938
|
isDropDisabled: !isEnabled,
|
30800
30939
|
children: (provided, snapshot) => {
|
30801
|
-
return /* @__PURE__ */ (0,
|
30940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
30802
30941
|
"div",
|
30803
30942
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30804
|
-
className:
|
30943
|
+
className: getClassName18("content"),
|
30805
30944
|
ref: provided == null ? void 0 : provided.innerRef,
|
30806
30945
|
style,
|
30807
30946
|
id: zoneCompound,
|
@@ -30828,25 +30967,33 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30828
30967
|
"draggable-"
|
30829
30968
|
)[1] === componentId;
|
30830
30969
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30831
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
30970
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
30832
30971
|
"No configuration for ",
|
30833
30972
|
item.type
|
30834
30973
|
] });
|
30835
30974
|
const componentConfig = config.components[item.type];
|
30836
30975
|
const label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
30837
|
-
|
30976
|
+
const canDrag = getPermissions({
|
30977
|
+
selectedItem: getItem(
|
30978
|
+
{ index: i, zone: zoneCompound },
|
30979
|
+
appContext2.state.data
|
30980
|
+
),
|
30981
|
+
config: appContext2.config,
|
30982
|
+
globalPermissions: appContext2.globalPermissions || {}
|
30983
|
+
}).drag;
|
30984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
30838
30985
|
"div",
|
30839
30986
|
{
|
30840
|
-
className:
|
30987
|
+
className: getClassName18("item"),
|
30841
30988
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30842
30989
|
children: [
|
30843
|
-
/* @__PURE__ */ (0,
|
30990
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30844
30991
|
DropZoneProvider,
|
30845
30992
|
{
|
30846
30993
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30847
30994
|
areaId: componentId
|
30848
30995
|
}),
|
30849
|
-
children: /* @__PURE__ */ (0,
|
30996
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30850
30997
|
DraggableComponent,
|
30851
30998
|
{
|
30852
30999
|
label,
|
@@ -30855,6 +31002,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30855
31002
|
isSelected,
|
30856
31003
|
isLocked: userIsDragging,
|
30857
31004
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
31005
|
+
isDragDisabled: !canDrag,
|
30858
31006
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
30859
31007
|
isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
|
30860
31008
|
onMount: () => {
|
@@ -30913,15 +31061,15 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30913
31061
|
style: {
|
30914
31062
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30915
31063
|
},
|
30916
|
-
children: /* @__PURE__ */ (0,
|
31064
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
30917
31065
|
}
|
30918
31066
|
)
|
30919
31067
|
}
|
30920
31068
|
),
|
30921
|
-
userIsDragging && /* @__PURE__ */ (0,
|
31069
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30922
31070
|
"div",
|
30923
31071
|
{
|
30924
|
-
className:
|
31072
|
+
className: getClassName18("hitbox"),
|
30925
31073
|
onMouseOver: (e) => {
|
30926
31074
|
e.stopPropagation();
|
30927
31075
|
setHoveringArea(zoneArea);
|
@@ -30935,7 +31083,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30935
31083
|
);
|
30936
31084
|
}),
|
30937
31085
|
provided == null ? void 0 : provided.placeholder,
|
30938
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
31086
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30939
31087
|
"div",
|
30940
31088
|
{
|
30941
31089
|
"data-puck-placeholder": true,
|
@@ -30956,7 +31104,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30956
31104
|
);
|
30957
31105
|
}
|
30958
31106
|
function DropZoneRender({ zone }) {
|
30959
|
-
const ctx = (0,
|
31107
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30960
31108
|
const { data, areaId = "root", config } = ctx || {};
|
30961
31109
|
let zoneCompound = rootDroppableId;
|
30962
31110
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -30967,14 +31115,14 @@ function DropZoneRender({ zone }) {
|
|
30967
31115
|
zoneCompound = `${areaId}:${zone}`;
|
30968
31116
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30969
31117
|
}
|
30970
|
-
return /* @__PURE__ */ (0,
|
31118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: content.map((item) => {
|
30971
31119
|
const Component = config.components[item.type];
|
30972
31120
|
if (Component) {
|
30973
|
-
return /* @__PURE__ */ (0,
|
31121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30974
31122
|
DropZoneProvider,
|
30975
31123
|
{
|
30976
31124
|
value: { data, config, areaId: item.props.id },
|
30977
|
-
children: /* @__PURE__ */ (0,
|
31125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30978
31126
|
Component.render,
|
30979
31127
|
__spreadProps(__spreadValues({}, item.props), {
|
30980
31128
|
puck: { renderDropZone: DropZone }
|
@@ -30988,20 +31136,20 @@ function DropZoneRender({ zone }) {
|
|
30988
31136
|
}) });
|
30989
31137
|
}
|
30990
31138
|
function DropZone(props) {
|
30991
|
-
const ctx = (0,
|
31139
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30992
31140
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30993
|
-
return /* @__PURE__ */ (0,
|
31141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30994
31142
|
}
|
30995
|
-
return /* @__PURE__ */ (0,
|
31143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender, __spreadValues({}, props));
|
30996
31144
|
}
|
30997
31145
|
|
30998
31146
|
// components/Puck/index.tsx
|
30999
31147
|
init_react_import();
|
31000
|
-
var
|
31148
|
+
var import_react31 = require("react");
|
31001
31149
|
|
31002
31150
|
// lib/use-placeholder-style.ts
|
31003
31151
|
init_react_import();
|
31004
|
-
var
|
31152
|
+
var import_react18 = require("react");
|
31005
31153
|
|
31006
31154
|
// lib/get-frame.ts
|
31007
31155
|
init_react_import();
|
@@ -31016,7 +31164,7 @@ var getFrame = () => {
|
|
31016
31164
|
// lib/use-placeholder-style.ts
|
31017
31165
|
var usePlaceholderStyle = () => {
|
31018
31166
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
31019
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
31167
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react18.useState)();
|
31020
31168
|
const onDragStartOrUpdate = (draggedItem) => {
|
31021
31169
|
var _a;
|
31022
31170
|
const draggableId = draggedItem.draggableId;
|
@@ -31065,11 +31213,11 @@ init_react_import();
|
|
31065
31213
|
|
31066
31214
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
31067
31215
|
init_react_import();
|
31068
|
-
var
|
31216
|
+
var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "SidebarSection-title": "_SidebarSection-title_125qe_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_125qe_20", "SidebarSection-content": "_SidebarSection-content_125qe_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_125qe_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_125qe_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_125qe_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_125qe_41", "SidebarSection-heading": "_SidebarSection-heading_125qe_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_125qe_86" };
|
31069
31217
|
|
31070
31218
|
// lib/use-breadcrumbs.ts
|
31071
31219
|
init_react_import();
|
31072
|
-
var
|
31220
|
+
var import_react19 = require("react");
|
31073
31221
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
31074
31222
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
31075
31223
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -31119,8 +31267,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
31119
31267
|
state: { data },
|
31120
31268
|
selectedItem
|
31121
31269
|
} = useAppContext();
|
31122
|
-
const dzContext = (0,
|
31123
|
-
return (0,
|
31270
|
+
const dzContext = (0, import_react19.useContext)(dropZoneContext);
|
31271
|
+
return (0, import_react19.useMemo)(() => {
|
31124
31272
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
31125
31273
|
selectedItem,
|
31126
31274
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -31134,8 +31282,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
31134
31282
|
};
|
31135
31283
|
|
31136
31284
|
// components/SidebarSection/index.tsx
|
31137
|
-
var
|
31138
|
-
var
|
31285
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
31286
|
+
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
31139
31287
|
var SidebarSection = ({
|
31140
31288
|
children,
|
31141
31289
|
title,
|
@@ -31147,28 +31295,28 @@ var SidebarSection = ({
|
|
31147
31295
|
}) => {
|
31148
31296
|
const { setUi } = useAppContext();
|
31149
31297
|
const breadcrumbs = useBreadcrumbs(1);
|
31150
|
-
return /* @__PURE__ */ (0,
|
31298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
31151
31299
|
"div",
|
31152
31300
|
{
|
31153
|
-
className:
|
31301
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
31154
31302
|
style: { background },
|
31155
31303
|
children: [
|
31156
|
-
/* @__PURE__ */ (0,
|
31157
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
31158
|
-
/* @__PURE__ */ (0,
|
31304
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
31305
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
31306
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
31159
31307
|
"button",
|
31160
31308
|
{
|
31161
|
-
className:
|
31309
|
+
className: getClassName19("breadcrumbLabel"),
|
31162
31310
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
31163
31311
|
children: breadcrumb.label
|
31164
31312
|
}
|
31165
31313
|
),
|
31166
|
-
/* @__PURE__ */ (0,
|
31314
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight, { size: 16 })
|
31167
31315
|
] }, i)) : null,
|
31168
|
-
/* @__PURE__ */ (0,
|
31316
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
31169
31317
|
] }) }),
|
31170
|
-
/* @__PURE__ */ (0,
|
31171
|
-
isLoading && /* @__PURE__ */ (0,
|
31318
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
|
31319
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: 32 }) })
|
31172
31320
|
]
|
31173
31321
|
}
|
31174
31322
|
);
|
@@ -31537,7 +31685,7 @@ var flushZones = (appState) => {
|
|
31537
31685
|
|
31538
31686
|
// lib/use-resolved-data.ts
|
31539
31687
|
init_react_import();
|
31540
|
-
var
|
31688
|
+
var import_react20 = require("react");
|
31541
31689
|
|
31542
31690
|
// lib/resolve-component-data.ts
|
31543
31691
|
init_react_import();
|
@@ -31646,13 +31794,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
31646
31794
|
|
31647
31795
|
// lib/use-resolved-data.ts
|
31648
31796
|
var useResolvedData = (appState, config, dispatch) => {
|
31649
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
31797
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react20.useState)({
|
31650
31798
|
resolverKey: 0,
|
31651
31799
|
newAppState: appState
|
31652
31800
|
});
|
31653
|
-
const [componentState, setComponentState] = (0,
|
31801
|
+
const [componentState, setComponentState] = (0, import_react20.useState)({});
|
31654
31802
|
const deferredSetStates = {};
|
31655
|
-
const setComponentLoading = (0,
|
31803
|
+
const setComponentLoading = (0, import_react20.useCallback)(
|
31656
31804
|
(id, loading, defer2 = 0) => {
|
31657
31805
|
if (deferredSetStates[id]) {
|
31658
31806
|
clearTimeout(deferredSetStates[id]);
|
@@ -31722,10 +31870,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31722
31870
|
});
|
31723
31871
|
yield Promise.all(promises);
|
31724
31872
|
});
|
31725
|
-
(0,
|
31873
|
+
(0, import_react20.useEffect)(() => {
|
31726
31874
|
runResolvers();
|
31727
31875
|
}, [resolverKey]);
|
31728
|
-
const resolveData = (0,
|
31876
|
+
const resolveData = (0, import_react20.useCallback)((newAppState2 = appState) => {
|
31729
31877
|
setResolverState((curr) => ({
|
31730
31878
|
resolverKey: curr.resolverKey + 1,
|
31731
31879
|
newAppState: newAppState2
|
@@ -31742,11 +31890,11 @@ init_react_import();
|
|
31742
31890
|
|
31743
31891
|
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
31744
31892
|
init_react_import();
|
31745
|
-
var
|
31893
|
+
var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
31746
31894
|
|
31747
31895
|
// components/MenuBar/index.tsx
|
31748
|
-
var
|
31749
|
-
var
|
31896
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
31897
|
+
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
31750
31898
|
var MenuBar = ({
|
31751
31899
|
appState,
|
31752
31900
|
data = { content: [], root: {} },
|
@@ -31760,10 +31908,10 @@ var MenuBar = ({
|
|
31760
31908
|
history: { back, forward, historyStore }
|
31761
31909
|
} = useAppContext();
|
31762
31910
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31763
|
-
return /* @__PURE__ */ (0,
|
31911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
31764
31912
|
"div",
|
31765
31913
|
{
|
31766
|
-
className:
|
31914
|
+
className: getClassName20({ menuOpen }),
|
31767
31915
|
onClick: (event) => {
|
31768
31916
|
var _a;
|
31769
31917
|
const element = event.target;
|
@@ -31774,12 +31922,12 @@ var MenuBar = ({
|
|
31774
31922
|
setMenuOpen(false);
|
31775
31923
|
}
|
31776
31924
|
},
|
31777
|
-
children: /* @__PURE__ */ (0,
|
31778
|
-
/* @__PURE__ */ (0,
|
31779
|
-
/* @__PURE__ */ (0,
|
31780
|
-
/* @__PURE__ */ (0,
|
31925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("inner"), children: [
|
31926
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("history"), children: [
|
31927
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Undo2, { size: 21 }) }),
|
31928
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Redo2, { size: 21 }) })
|
31781
31929
|
] }),
|
31782
|
-
/* @__PURE__ */ (0,
|
31930
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31783
31931
|
state: appState,
|
31784
31932
|
dispatch
|
31785
31933
|
}) })
|
@@ -31790,26 +31938,26 @@ var MenuBar = ({
|
|
31790
31938
|
|
31791
31939
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
31792
31940
|
init_react_import();
|
31793
|
-
var
|
31941
|
+
var styles_module_default15 = { "Puck": "_Puck_1g88c_19", "Puck-portal": "_Puck-portal_1g88c_24", "PuckLayout": "_PuckLayout_1g88c_31", "PuckLayout-inner": "_PuckLayout-inner_1g88c_39", "PuckLayout--mounted": "_PuckLayout--mounted_1g88c_51", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1g88c_55", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1g88c_61", "PuckLayout-mounted": "_PuckLayout-mounted_1g88c_75", "PuckLayout-header": "_PuckLayout-header_1g88c_116", "PuckLayout-headerInner": "_PuckLayout-headerInner_1g88c_125", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_1g88c_135", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_1g88c_142", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_1g88c_143", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_1g88c_147", "PuckLayout-headerPath": "_PuckLayout-headerPath_1g88c_151", "PuckLayout-headerTools": "_PuckLayout-headerTools_1g88c_158", "PuckLayout-menuButton": "_PuckLayout-menuButton_1g88c_164", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_1g88c_169", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_1g88c_143", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_1g88c_142" };
|
31794
31942
|
|
31795
31943
|
// components/Puck/components/Fields/index.tsx
|
31796
31944
|
init_react_import();
|
31797
31945
|
|
31798
31946
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
31799
31947
|
init_react_import();
|
31800
|
-
var
|
31948
|
+
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
31801
31949
|
|
31802
31950
|
// components/Puck/components/Fields/index.tsx
|
31803
|
-
var
|
31804
|
-
var
|
31805
|
-
var
|
31951
|
+
var import_react21 = require("react");
|
31952
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
31953
|
+
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
31806
31954
|
var defaultPageFields = {
|
31807
31955
|
title: { type: "text" }
|
31808
31956
|
};
|
31809
31957
|
var DefaultFields = ({
|
31810
31958
|
children
|
31811
31959
|
}) => {
|
31812
|
-
return /* @__PURE__ */ (0,
|
31960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
31813
31961
|
};
|
31814
31962
|
var useResolvedFields = () => {
|
31815
31963
|
var _a;
|
@@ -31819,14 +31967,14 @@ var useResolvedFields = () => {
|
|
31819
31967
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
31820
31968
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
31821
31969
|
const rootProps = data.root.props || data.root;
|
31822
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
31970
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)(
|
31823
31971
|
{}
|
31824
31972
|
);
|
31825
|
-
const [resolvedFields, setResolvedFields] = (0,
|
31826
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
31973
|
+
const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
|
31974
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
|
31827
31975
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
31828
31976
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
31829
|
-
const resolveFields = (0,
|
31977
|
+
const resolveFields = (0, import_react21.useCallback)(
|
31830
31978
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
31831
31979
|
var _a2, _b, _c;
|
31832
31980
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : {};
|
@@ -31862,7 +32010,7 @@ var useResolvedFields = () => {
|
|
31862
32010
|
}),
|
31863
32011
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
31864
32012
|
);
|
31865
|
-
(0,
|
32013
|
+
(0, import_react21.useEffect)(() => {
|
31866
32014
|
setFieldsLoading(true);
|
31867
32015
|
resolveFields(defaultFields).then((fields) => {
|
31868
32016
|
setResolvedFields(fields || {});
|
@@ -31880,7 +32028,8 @@ var Fields = () => {
|
|
31880
32028
|
config,
|
31881
32029
|
resolveData,
|
31882
32030
|
componentState,
|
31883
|
-
overrides
|
32031
|
+
overrides,
|
32032
|
+
globalPermissions
|
31884
32033
|
} = useAppContext();
|
31885
32034
|
const { data, ui } = state;
|
31886
32035
|
const { itemSelector } = ui;
|
@@ -31888,16 +32037,16 @@ var Fields = () => {
|
|
31888
32037
|
const componentResolving = selectedItem ? (_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loading : (_b = componentState["puck-root"]) == null ? void 0 : _b.loading;
|
31889
32038
|
const isLoading = fieldsResolving || componentResolving;
|
31890
32039
|
const rootProps = data.root.props || data.root;
|
31891
|
-
const Wrapper = (0,
|
31892
|
-
return /* @__PURE__ */ (0,
|
32040
|
+
const Wrapper = (0, import_react21.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
31893
32042
|
"form",
|
31894
32043
|
{
|
31895
|
-
className:
|
32044
|
+
className: getClassName21(),
|
31896
32045
|
onSubmit: (e) => {
|
31897
32046
|
e.preventDefault();
|
31898
32047
|
},
|
31899
32048
|
children: [
|
31900
|
-
/* @__PURE__ */ (0,
|
32049
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
31901
32050
|
const field = fields[fieldName];
|
31902
32051
|
if (!(field == null ? void 0 : field.type)) return null;
|
31903
32052
|
const onChange = (value, updatedUi) => {
|
@@ -31964,13 +32113,18 @@ var Fields = () => {
|
|
31964
32113
|
};
|
31965
32114
|
if (selectedItem && itemSelector) {
|
31966
32115
|
const { readOnly = {} } = selectedItem;
|
31967
|
-
|
32116
|
+
const { edit } = getPermissions({
|
32117
|
+
selectedItem,
|
32118
|
+
config,
|
32119
|
+
globalPermissions: globalPermissions || {}
|
32120
|
+
});
|
32121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
31968
32122
|
AutoFieldPrivate,
|
31969
32123
|
{
|
31970
32124
|
field,
|
31971
32125
|
name: fieldName,
|
31972
32126
|
id: `${selectedItem.props.id}_${fieldName}`,
|
31973
|
-
readOnly: readOnly[fieldName],
|
32127
|
+
readOnly: !edit || readOnly[fieldName],
|
31974
32128
|
value: selectedItem.props[fieldName],
|
31975
32129
|
onChange
|
31976
32130
|
},
|
@@ -31978,7 +32132,7 @@ var Fields = () => {
|
|
31978
32132
|
);
|
31979
32133
|
} else {
|
31980
32134
|
const { readOnly = {} } = data.root;
|
31981
|
-
return /* @__PURE__ */ (0,
|
32135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
31982
32136
|
AutoFieldPrivate,
|
31983
32137
|
{
|
31984
32138
|
field,
|
@@ -31992,7 +32146,7 @@ var Fields = () => {
|
|
31992
32146
|
);
|
31993
32147
|
}
|
31994
32148
|
}) }),
|
31995
|
-
isLoading && /* @__PURE__ */ (0,
|
32149
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 16 }) }) })
|
31996
32150
|
]
|
31997
32151
|
}
|
31998
32152
|
);
|
@@ -32003,25 +32157,39 @@ init_react_import();
|
|
32003
32157
|
|
32004
32158
|
// lib/use-component-list.tsx
|
32005
32159
|
init_react_import();
|
32006
|
-
var
|
32160
|
+
var import_react22 = require("react");
|
32007
32161
|
|
32008
32162
|
// components/ComponentList/index.tsx
|
32009
32163
|
init_react_import();
|
32010
32164
|
|
32011
32165
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
32012
32166
|
init_react_import();
|
32013
|
-
var
|
32167
|
+
var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
|
32014
32168
|
|
32015
32169
|
// components/ComponentList/index.tsx
|
32016
|
-
var
|
32017
|
-
var
|
32170
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32171
|
+
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
32018
32172
|
var ComponentListItem = ({
|
32019
32173
|
name,
|
32020
32174
|
label,
|
32021
32175
|
index
|
32022
32176
|
}) => {
|
32023
|
-
const { overrides } = useAppContext();
|
32024
|
-
|
32177
|
+
const { overrides, config, globalPermissions } = useAppContext();
|
32178
|
+
const canInsert = getPermissions({
|
32179
|
+
type: name,
|
32180
|
+
config,
|
32181
|
+
globalPermissions: globalPermissions || {}
|
32182
|
+
}).insert;
|
32183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32184
|
+
Drawer.Item,
|
32185
|
+
{
|
32186
|
+
label,
|
32187
|
+
name,
|
32188
|
+
index,
|
32189
|
+
isDragDisabled: !canInsert,
|
32190
|
+
children: overrides.componentItem
|
32191
|
+
}
|
32192
|
+
);
|
32025
32193
|
};
|
32026
32194
|
var ComponentList = ({
|
32027
32195
|
children,
|
@@ -32030,11 +32198,11 @@ var ComponentList = ({
|
|
32030
32198
|
}) => {
|
32031
32199
|
const { config, state, setUi } = useAppContext();
|
32032
32200
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32033
|
-
return /* @__PURE__ */ (0,
|
32034
|
-
title && /* @__PURE__ */ (0,
|
32201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
|
32202
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
32035
32203
|
"button",
|
32036
32204
|
{
|
32037
|
-
className:
|
32205
|
+
className: getClassName22("title"),
|
32038
32206
|
onClick: () => setUi({
|
32039
32207
|
componentList: __spreadProps(__spreadValues({}, state.ui.componentList), {
|
32040
32208
|
[id]: __spreadProps(__spreadValues({}, state.ui.componentList[id]), {
|
@@ -32044,14 +32212,14 @@ var ComponentList = ({
|
|
32044
32212
|
}),
|
32045
32213
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32046
32214
|
children: [
|
32047
|
-
/* @__PURE__ */ (0,
|
32048
|
-
/* @__PURE__ */ (0,
|
32215
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: title }),
|
32216
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { size: 12 }) })
|
32049
32217
|
]
|
32050
32218
|
}
|
32051
32219
|
),
|
32052
|
-
/* @__PURE__ */ (0,
|
32220
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i) => {
|
32053
32221
|
var _a;
|
32054
|
-
return /* @__PURE__ */ (0,
|
32222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32055
32223
|
ComponentListItem,
|
32056
32224
|
{
|
32057
32225
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -32066,10 +32234,10 @@ var ComponentList = ({
|
|
32066
32234
|
ComponentList.Item = ComponentListItem;
|
32067
32235
|
|
32068
32236
|
// lib/use-component-list.tsx
|
32069
|
-
var
|
32237
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32070
32238
|
var useComponentList = (config, ui) => {
|
32071
|
-
const [componentList, setComponentList] = (0,
|
32072
|
-
(0,
|
32239
|
+
const [componentList, setComponentList] = (0, import_react22.useState)();
|
32240
|
+
(0, import_react22.useEffect)(() => {
|
32073
32241
|
var _a, _b, _c;
|
32074
32242
|
if (Object.keys(ui.componentList).length > 0) {
|
32075
32243
|
const matchedComponents = [];
|
@@ -32079,7 +32247,7 @@ var useComponentList = (config, ui) => {
|
|
32079
32247
|
if (category.visible === false || !category.components) {
|
32080
32248
|
return null;
|
32081
32249
|
}
|
32082
|
-
return /* @__PURE__ */ (0,
|
32250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32083
32251
|
ComponentList,
|
32084
32252
|
{
|
32085
32253
|
id: categoryKey,
|
@@ -32088,7 +32256,7 @@ var useComponentList = (config, ui) => {
|
|
32088
32256
|
var _a2;
|
32089
32257
|
matchedComponents.push(componentName);
|
32090
32258
|
const componentConf = config.components[componentName] || {};
|
32091
|
-
return /* @__PURE__ */ (0,
|
32259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32092
32260
|
ComponentList.Item,
|
32093
32261
|
{
|
32094
32262
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -32108,7 +32276,7 @@ var useComponentList = (config, ui) => {
|
|
32108
32276
|
);
|
32109
32277
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32110
32278
|
_componentList.push(
|
32111
|
-
/* @__PURE__ */ (0,
|
32279
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32112
32280
|
ComponentList,
|
32113
32281
|
{
|
32114
32282
|
id: "other",
|
@@ -32116,7 +32284,7 @@ var useComponentList = (config, ui) => {
|
|
32116
32284
|
children: remainingComponents.map((componentName, i) => {
|
32117
32285
|
var _a2;
|
32118
32286
|
const componentConf = config.components[componentName] || {};
|
32119
|
-
return /* @__PURE__ */ (0,
|
32287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32120
32288
|
ComponentList.Item,
|
32121
32289
|
{
|
32122
32290
|
name: componentName,
|
@@ -32138,25 +32306,25 @@ var useComponentList = (config, ui) => {
|
|
32138
32306
|
};
|
32139
32307
|
|
32140
32308
|
// components/Puck/components/Components/index.tsx
|
32141
|
-
var
|
32142
|
-
var
|
32309
|
+
var import_react23 = require("react");
|
32310
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32143
32311
|
var Components = () => {
|
32144
32312
|
const { config, state, overrides } = useAppContext();
|
32145
32313
|
const componentList = useComponentList(config, state.ui);
|
32146
|
-
const Wrapper = (0,
|
32147
|
-
return /* @__PURE__ */ (0,
|
32314
|
+
const Wrapper = (0, import_react23.useMemo)(() => overrides.components || "div", [overrides]);
|
32315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentList, { id: "all" }) });
|
32148
32316
|
};
|
32149
32317
|
|
32150
32318
|
// components/Puck/components/Preview/index.tsx
|
32151
32319
|
init_react_import();
|
32152
|
-
var
|
32320
|
+
var import_react25 = require("react");
|
32153
32321
|
|
32154
32322
|
// components/AutoFrame/index.tsx
|
32155
32323
|
init_react_import();
|
32156
|
-
var
|
32324
|
+
var import_react24 = __toESM(require("react"));
|
32157
32325
|
var import_react_frame_component = __toESM(require("react-frame-component"));
|
32158
32326
|
var import_object_hash = __toESM(require("object-hash"));
|
32159
|
-
var
|
32327
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
32160
32328
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
32161
32329
|
var collectStyles = (doc) => {
|
32162
32330
|
const collected = [];
|
@@ -32199,7 +32367,7 @@ var CopyHostStyles = ({
|
|
32199
32367
|
onStylesLoaded = () => null
|
32200
32368
|
}) => {
|
32201
32369
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
32202
|
-
(0,
|
32370
|
+
(0, import_react24.useEffect)(() => {
|
32203
32371
|
if (!win || !doc) {
|
32204
32372
|
return () => {
|
32205
32373
|
};
|
@@ -32356,12 +32524,12 @@ var CopyHostStyles = ({
|
|
32356
32524
|
observer.disconnect();
|
32357
32525
|
};
|
32358
32526
|
}, []);
|
32359
|
-
return /* @__PURE__ */ (0,
|
32527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
|
32360
32528
|
};
|
32361
|
-
var AutoFrameComponent =
|
32529
|
+
var AutoFrameComponent = import_react24.default.forwardRef(
|
32362
32530
|
function(_a, ref) {
|
32363
32531
|
var _b = _a, { children, debug, onStylesLoaded } = _b, props = __objRest(_b, ["children", "debug", "onStylesLoaded"]);
|
32364
|
-
return /* @__PURE__ */ (0,
|
32532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_frame_component.default, __spreadProps(__spreadValues({}, props), { ref, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
|
32365
32533
|
}
|
32366
32534
|
);
|
32367
32535
|
AutoFrameComponent.displayName = "AutoFrameComponent";
|
@@ -32369,14 +32537,14 @@ var AutoFrame_default = AutoFrameComponent;
|
|
32369
32537
|
|
32370
32538
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
32371
32539
|
init_react_import();
|
32372
|
-
var
|
32540
|
+
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
32373
32541
|
|
32374
32542
|
// components/Puck/components/Preview/index.tsx
|
32375
|
-
var
|
32376
|
-
var
|
32543
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
32544
|
+
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
32377
32545
|
var Preview = ({ id = "puck-preview" }) => {
|
32378
32546
|
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32379
|
-
const Page = (0,
|
32547
|
+
const Page = (0, import_react25.useCallback)(
|
32380
32548
|
(pageProps) => {
|
32381
32549
|
var _a, _b;
|
32382
32550
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
|
@@ -32385,33 +32553,33 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32385
32553
|
editMode: true,
|
32386
32554
|
// DEPRECATED
|
32387
32555
|
puck: { renderDropZone: DropZone, isEditing: true }
|
32388
|
-
})) : /* @__PURE__ */ (0,
|
32556
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
32389
32557
|
},
|
32390
32558
|
[config.root]
|
32391
32559
|
);
|
32392
32560
|
const rootProps = state.data.root.props || state.data.root;
|
32393
|
-
const ref = (0,
|
32394
|
-
return /* @__PURE__ */ (0,
|
32561
|
+
const ref = (0, import_react25.useRef)(null);
|
32562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
32395
32563
|
"div",
|
32396
32564
|
{
|
32397
|
-
className:
|
32565
|
+
className: getClassName23(),
|
32398
32566
|
id,
|
32399
32567
|
onClick: () => {
|
32400
32568
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32401
32569
|
},
|
32402
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
32570
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
32403
32571
|
AutoFrame_default,
|
32404
32572
|
{
|
32405
32573
|
id: "preview-frame",
|
32406
|
-
className:
|
32574
|
+
className: getClassName23("frame"),
|
32407
32575
|
"data-rfd-iframe": true,
|
32408
32576
|
ref,
|
32409
32577
|
onStylesLoaded: () => {
|
32410
32578
|
setStatus("READY");
|
32411
32579
|
},
|
32412
|
-
children: /* @__PURE__ */ (0,
|
32580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) }))
|
32413
32581
|
}
|
32414
|
-
) : /* @__PURE__ */ (0,
|
32582
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) })) })
|
32415
32583
|
}
|
32416
32584
|
);
|
32417
32585
|
};
|
@@ -32445,7 +32613,7 @@ init_react_import();
|
|
32445
32613
|
|
32446
32614
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
32447
32615
|
init_react_import();
|
32448
|
-
var
|
32616
|
+
var styles_module_default19 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
|
32449
32617
|
|
32450
32618
|
// lib/scroll-into-view.ts
|
32451
32619
|
init_react_import();
|
@@ -32459,7 +32627,7 @@ var scrollIntoView = (el) => {
|
|
32459
32627
|
};
|
32460
32628
|
|
32461
32629
|
// components/LayerTree/index.tsx
|
32462
|
-
var
|
32630
|
+
var import_react26 = require("react");
|
32463
32631
|
|
32464
32632
|
// lib/is-child-of-zone.ts
|
32465
32633
|
init_react_import();
|
@@ -32473,9 +32641,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32473
32641
|
};
|
32474
32642
|
|
32475
32643
|
// components/LayerTree/index.tsx
|
32476
|
-
var
|
32477
|
-
var
|
32478
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
32644
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
32645
|
+
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
32646
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
32479
32647
|
var LayerTree = ({
|
32480
32648
|
data,
|
32481
32649
|
config,
|
@@ -32486,15 +32654,15 @@ var LayerTree = ({
|
|
32486
32654
|
label
|
32487
32655
|
}) => {
|
32488
32656
|
const zones = data.zones || {};
|
32489
|
-
const ctx = (0,
|
32490
|
-
return /* @__PURE__ */ (0,
|
32491
|
-
label && /* @__PURE__ */ (0,
|
32492
|
-
/* @__PURE__ */ (0,
|
32657
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
32659
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
32660
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
32493
32661
|
" ",
|
32494
32662
|
label
|
32495
32663
|
] }),
|
32496
|
-
/* @__PURE__ */ (0,
|
32497
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32664
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
32665
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
32498
32666
|
zoneContent.map((item, i) => {
|
32499
32667
|
var _a;
|
32500
32668
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32512,7 +32680,7 @@ var LayerTree = ({
|
|
32512
32680
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32513
32681
|
const componentConfig = config.components[item.type];
|
32514
32682
|
const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
|
32515
|
-
return /* @__PURE__ */ (0,
|
32683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
32516
32684
|
"li",
|
32517
32685
|
{
|
32518
32686
|
className: getClassNameLayer({
|
@@ -32522,7 +32690,7 @@ var LayerTree = ({
|
|
32522
32690
|
childIsSelected
|
32523
32691
|
}),
|
32524
32692
|
children: [
|
32525
|
-
/* @__PURE__ */ (0,
|
32693
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
32526
32694
|
"button",
|
32527
32695
|
{
|
32528
32696
|
className: getClassNameLayer("clickable"),
|
@@ -32554,22 +32722,22 @@ var LayerTree = ({
|
|
32554
32722
|
setHoveringComponent(null);
|
32555
32723
|
},
|
32556
32724
|
children: [
|
32557
|
-
containsZone && /* @__PURE__ */ (0,
|
32725
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32558
32726
|
"div",
|
32559
32727
|
{
|
32560
32728
|
className: getClassNameLayer("chevron"),
|
32561
32729
|
title: isSelected ? "Collapse" : "Expand",
|
32562
|
-
children: /* @__PURE__ */ (0,
|
32730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
32563
32731
|
}
|
32564
32732
|
),
|
32565
|
-
/* @__PURE__ */ (0,
|
32566
|
-
/* @__PURE__ */ (0,
|
32567
|
-
/* @__PURE__ */ (0,
|
32733
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
32734
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayoutGrid, { size: "16" }) }),
|
32735
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
32568
32736
|
] })
|
32569
32737
|
]
|
32570
32738
|
}
|
32571
32739
|
) }),
|
32572
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
32740
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32573
32741
|
LayerTree,
|
32574
32742
|
{
|
32575
32743
|
config,
|
@@ -32591,13 +32759,13 @@ var LayerTree = ({
|
|
32591
32759
|
};
|
32592
32760
|
|
32593
32761
|
// components/Puck/components/Outline/index.tsx
|
32594
|
-
var
|
32595
|
-
var
|
32762
|
+
var import_react27 = require("react");
|
32763
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
32596
32764
|
var Outline = () => {
|
32597
32765
|
const { dispatch, state, overrides, config } = useAppContext();
|
32598
32766
|
const { data, ui } = state;
|
32599
32767
|
const { itemSelector } = ui;
|
32600
|
-
const setItemSelector = (0,
|
32768
|
+
const setItemSelector = (0, import_react27.useCallback)(
|
32601
32769
|
(newItemSelector) => {
|
32602
32770
|
dispatch({
|
32603
32771
|
type: "setUi",
|
@@ -32606,9 +32774,9 @@ var Outline = () => {
|
|
32606
32774
|
},
|
32607
32775
|
[]
|
32608
32776
|
);
|
32609
|
-
const Wrapper = (0,
|
32610
|
-
return /* @__PURE__ */ (0,
|
32611
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
32777
|
+
const Wrapper = (0, import_react27.useMemo)(() => overrides.outline || "div", [overrides]);
|
32778
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
32779
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
32612
32780
|
LayerTree,
|
32613
32781
|
{
|
32614
32782
|
config,
|
@@ -32621,7 +32789,7 @@ var Outline = () => {
|
|
32621
32789
|
),
|
32622
32790
|
Object.entries(findZonesForArea(data, "root")).map(
|
32623
32791
|
([zoneKey, zone]) => {
|
32624
|
-
return /* @__PURE__ */ (0,
|
32792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
32625
32793
|
LayerTree,
|
32626
32794
|
{
|
32627
32795
|
config,
|
@@ -32639,37 +32807,6 @@ var Outline = () => {
|
|
32639
32807
|
] }) }) });
|
32640
32808
|
};
|
32641
32809
|
|
32642
|
-
// lib/load-overrides.ts
|
32643
|
-
init_react_import();
|
32644
|
-
var loadOverrides = ({
|
32645
|
-
overrides,
|
32646
|
-
plugins
|
32647
|
-
}) => {
|
32648
|
-
const collected = __spreadValues({}, overrides);
|
32649
|
-
plugins.forEach((plugin) => {
|
32650
|
-
Object.keys(plugin.overrides).forEach((overridesType) => {
|
32651
|
-
if (overridesType === "fieldTypes") {
|
32652
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
32653
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
32654
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
32655
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
32656
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
32657
|
-
children: childNode2 ? childNode2(props) : props.children
|
32658
|
-
}));
|
32659
|
-
collected.fieldTypes[fieldType] = Comp2;
|
32660
|
-
});
|
32661
|
-
return;
|
32662
|
-
}
|
32663
|
-
const childNode = collected[overridesType];
|
32664
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
32665
|
-
children: childNode ? childNode(props) : props.children
|
32666
|
-
}));
|
32667
|
-
collected[overridesType] = Comp;
|
32668
|
-
});
|
32669
|
-
});
|
32670
|
-
return collected;
|
32671
|
-
};
|
32672
|
-
|
32673
32810
|
// lib/use-puck-history.ts
|
32674
32811
|
init_react_import();
|
32675
32812
|
var import_react_hotkeys_hook = require("react-hotkeys-hook");
|
@@ -32726,19 +32863,19 @@ function usePuckHistory({
|
|
32726
32863
|
|
32727
32864
|
// lib/use-history-store.ts
|
32728
32865
|
init_react_import();
|
32729
|
-
var
|
32866
|
+
var import_react28 = require("react");
|
32730
32867
|
var import_use_debounce3 = require("use-debounce");
|
32731
32868
|
var EMPTY_HISTORY_INDEX = -1;
|
32732
32869
|
function useHistoryStore(initialHistory) {
|
32733
32870
|
var _a, _b;
|
32734
|
-
const [histories, setHistories] = (0,
|
32871
|
+
const [histories, setHistories] = (0, import_react28.useState)(
|
32735
32872
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
32736
32873
|
);
|
32737
32874
|
const updateHistories = (histories2) => {
|
32738
32875
|
setHistories(histories2);
|
32739
32876
|
setIndex(histories2.length - 1);
|
32740
32877
|
};
|
32741
|
-
const [index, setIndex] = (0,
|
32878
|
+
const [index, setIndex] = (0, import_react28.useState)(
|
32742
32879
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
32743
32880
|
);
|
32744
32881
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -32898,25 +33035,25 @@ var getBox = function getBox2(el) {
|
|
32898
33035
|
};
|
32899
33036
|
|
32900
33037
|
// components/Puck/components/Canvas/index.tsx
|
32901
|
-
var
|
33038
|
+
var import_react30 = require("react");
|
32902
33039
|
|
32903
33040
|
// components/ViewportControls/index.tsx
|
32904
33041
|
init_react_import();
|
32905
|
-
var
|
33042
|
+
var import_react29 = require("react");
|
32906
33043
|
|
32907
33044
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
32908
33045
|
init_react_import();
|
32909
|
-
var
|
33046
|
+
var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
|
32910
33047
|
|
32911
33048
|
// components/ViewportControls/index.tsx
|
32912
|
-
var
|
33049
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
32913
33050
|
var icons = {
|
32914
|
-
Smartphone: /* @__PURE__ */ (0,
|
32915
|
-
Tablet: /* @__PURE__ */ (0,
|
32916
|
-
Monitor: /* @__PURE__ */ (0,
|
33051
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
|
33052
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
|
33053
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
|
32917
33054
|
};
|
32918
|
-
var
|
32919
|
-
var getClassNameButton = get_class_name_factory_default("ViewportButton",
|
33055
|
+
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
33056
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
32920
33057
|
var ViewportButton = ({
|
32921
33058
|
children,
|
32922
33059
|
height = "auto",
|
@@ -32925,11 +33062,11 @@ var ViewportButton = ({
|
|
32925
33062
|
onClick
|
32926
33063
|
}) => {
|
32927
33064
|
const { state } = useAppContext();
|
32928
|
-
const [isActive, setIsActive] = (0,
|
32929
|
-
(0,
|
33065
|
+
const [isActive, setIsActive] = (0, import_react29.useState)(false);
|
33066
|
+
(0, import_react29.useEffect)(() => {
|
32930
33067
|
setIsActive(width === state.ui.viewports.current.width);
|
32931
33068
|
}, [width, state.ui.viewports.current.width]);
|
32932
|
-
return /* @__PURE__ */ (0,
|
33069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32933
33070
|
IconButton,
|
32934
33071
|
{
|
32935
33072
|
title,
|
@@ -32938,7 +33075,7 @@ var ViewportButton = ({
|
|
32938
33075
|
e.stopPropagation();
|
32939
33076
|
onClick({ width, height });
|
32940
33077
|
},
|
32941
|
-
children: /* @__PURE__ */ (0,
|
33078
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
32942
33079
|
}
|
32943
33080
|
) });
|
32944
33081
|
};
|
@@ -32962,7 +33099,7 @@ var ViewportControls = ({
|
|
32962
33099
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
32963
33100
|
(option) => option.value === autoZoom
|
32964
33101
|
);
|
32965
|
-
const zoomOptions = (0,
|
33102
|
+
const zoomOptions = (0, import_react29.useMemo)(
|
32966
33103
|
() => [
|
32967
33104
|
...defaultZoomOptions,
|
32968
33105
|
...defaultsContainAutoZoom ? [] : [
|
@@ -32974,8 +33111,8 @@ var ViewportControls = ({
|
|
32974
33111
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
32975
33112
|
[autoZoom]
|
32976
33113
|
);
|
32977
|
-
return /* @__PURE__ */ (0,
|
32978
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
33114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
33115
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32979
33116
|
ViewportButton,
|
32980
33117
|
{
|
32981
33118
|
height: viewport.height,
|
@@ -32986,8 +33123,8 @@ var ViewportControls = ({
|
|
32986
33123
|
},
|
32987
33124
|
i
|
32988
33125
|
)),
|
32989
|
-
/* @__PURE__ */ (0,
|
32990
|
-
/* @__PURE__ */ (0,
|
33126
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
33127
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32991
33128
|
IconButton,
|
32992
33129
|
{
|
32993
33130
|
title: "Zoom viewport out",
|
@@ -33001,10 +33138,10 @@ var ViewportControls = ({
|
|
33001
33138
|
)].value
|
33002
33139
|
);
|
33003
33140
|
},
|
33004
|
-
children: /* @__PURE__ */ (0,
|
33141
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
33005
33142
|
}
|
33006
33143
|
),
|
33007
|
-
/* @__PURE__ */ (0,
|
33144
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33008
33145
|
IconButton,
|
33009
33146
|
{
|
33010
33147
|
title: "Zoom viewport in",
|
@@ -33018,19 +33155,19 @@ var ViewportControls = ({
|
|
33018
33155
|
)].value
|
33019
33156
|
);
|
33020
33157
|
},
|
33021
|
-
children: /* @__PURE__ */ (0,
|
33158
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
33022
33159
|
}
|
33023
33160
|
),
|
33024
|
-
/* @__PURE__ */ (0,
|
33025
|
-
/* @__PURE__ */ (0,
|
33161
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
33162
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33026
33163
|
"select",
|
33027
33164
|
{
|
33028
|
-
className:
|
33165
|
+
className: getClassName25("zoomSelect"),
|
33029
33166
|
value: zoom.toString(),
|
33030
33167
|
onChange: (e) => {
|
33031
33168
|
onZoom(parseFloat(e.currentTarget.value));
|
33032
33169
|
},
|
33033
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
33170
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33034
33171
|
"option",
|
33035
33172
|
{
|
33036
33173
|
value: option.value,
|
@@ -33045,7 +33182,7 @@ var ViewportControls = ({
|
|
33045
33182
|
|
33046
33183
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
33047
33184
|
init_react_import();
|
33048
|
-
var
|
33185
|
+
var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_6zd4y_1", "PuckCanvas-controls": "_PuckCanvas-controls_6zd4y_16", "PuckCanvas-inner": "_PuckCanvas-inner_6zd4y_21", "PuckCanvas-root": "_PuckCanvas-root_6zd4y_32", "PuckCanvas--ready": "_PuckCanvas--ready_6zd4y_56" };
|
33049
33186
|
|
33050
33187
|
// lib/get-zoom-config.ts
|
33051
33188
|
init_react_import();
|
@@ -33078,24 +33215,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
33078
33215
|
};
|
33079
33216
|
|
33080
33217
|
// components/Puck/components/Canvas/index.tsx
|
33081
|
-
var
|
33082
|
-
var
|
33218
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
33219
|
+
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
33083
33220
|
var ZOOM_ON_CHANGE = true;
|
33084
33221
|
var Canvas = () => {
|
33085
33222
|
const { status, iframe } = useAppContext();
|
33086
33223
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33087
33224
|
const { ui } = state;
|
33088
|
-
const frameRef = (0,
|
33089
|
-
const [showTransition, setShowTransition] = (0,
|
33090
|
-
const defaultRender = (0,
|
33091
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
33225
|
+
const frameRef = (0, import_react30.useRef)(null);
|
33226
|
+
const [showTransition, setShowTransition] = (0, import_react30.useState)(false);
|
33227
|
+
const defaultRender = (0, import_react30.useMemo)(() => {
|
33228
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
33092
33229
|
return PuckDefault;
|
33093
33230
|
}, []);
|
33094
|
-
const CustomPreview = (0,
|
33231
|
+
const CustomPreview = (0, import_react30.useMemo)(
|
33095
33232
|
() => overrides.preview || defaultRender,
|
33096
33233
|
[overrides]
|
33097
33234
|
);
|
33098
|
-
const getFrameDimensions = (0,
|
33235
|
+
const getFrameDimensions = (0, import_react30.useCallback)(() => {
|
33099
33236
|
if (frameRef.current) {
|
33100
33237
|
const frame = frameRef.current;
|
33101
33238
|
const box = getBox(frame);
|
@@ -33103,7 +33240,7 @@ var Canvas = () => {
|
|
33103
33240
|
}
|
33104
33241
|
return { width: 0, height: 0 };
|
33105
33242
|
}, [frameRef]);
|
33106
|
-
const resetAutoZoom = (0,
|
33243
|
+
const resetAutoZoom = (0, import_react30.useCallback)(
|
33107
33244
|
(ui2 = state.ui) => {
|
33108
33245
|
if (frameRef.current) {
|
33109
33246
|
setZoomConfig(
|
@@ -33113,11 +33250,11 @@ var Canvas = () => {
|
|
33113
33250
|
},
|
33114
33251
|
[frameRef, zoomConfig, state.ui]
|
33115
33252
|
);
|
33116
|
-
(0,
|
33253
|
+
(0, import_react30.useEffect)(() => {
|
33117
33254
|
setShowTransition(false);
|
33118
33255
|
resetAutoZoom();
|
33119
33256
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33120
|
-
(0,
|
33257
|
+
(0, import_react30.useEffect)(() => {
|
33121
33258
|
const { height: frameHeight } = getFrameDimensions();
|
33122
33259
|
if (ui.viewports.current.height === "auto") {
|
33123
33260
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -33125,7 +33262,7 @@ var Canvas = () => {
|
|
33125
33262
|
}));
|
33126
33263
|
}
|
33127
33264
|
}, [zoomConfig.zoom]);
|
33128
|
-
(0,
|
33265
|
+
(0, import_react30.useEffect)(() => {
|
33129
33266
|
const observer = new ResizeObserver(() => {
|
33130
33267
|
setShowTransition(false);
|
33131
33268
|
resetAutoZoom();
|
@@ -33137,10 +33274,10 @@ var Canvas = () => {
|
|
33137
33274
|
observer.disconnect();
|
33138
33275
|
};
|
33139
33276
|
}, []);
|
33140
|
-
return /* @__PURE__ */ (0,
|
33277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
33141
33278
|
"div",
|
33142
33279
|
{
|
33143
|
-
className:
|
33280
|
+
className: getClassName26({
|
33144
33281
|
ready: status === "READY" || !iframe.enabled
|
33145
33282
|
}),
|
33146
33283
|
onClick: () => dispatch({
|
@@ -33149,7 +33286,7 @@ var Canvas = () => {
|
|
33149
33286
|
recordHistory: true
|
33150
33287
|
}),
|
33151
33288
|
children: [
|
33152
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
33289
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
33153
33290
|
ViewportControls,
|
33154
33291
|
{
|
33155
33292
|
autoZoom: zoomConfig.autoZoom,
|
@@ -33174,10 +33311,10 @@ var Canvas = () => {
|
|
33174
33311
|
}
|
33175
33312
|
}
|
33176
33313
|
) }),
|
33177
|
-
/* @__PURE__ */ (0,
|
33314
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
33178
33315
|
"div",
|
33179
33316
|
{
|
33180
|
-
className:
|
33317
|
+
className: getClassName26("root"),
|
33181
33318
|
style: {
|
33182
33319
|
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
33183
33320
|
height: zoomConfig.rootHeight,
|
@@ -33186,7 +33323,7 @@ var Canvas = () => {
|
|
33186
33323
|
overflow: iframe.enabled ? void 0 : "auto"
|
33187
33324
|
},
|
33188
33325
|
suppressHydrationWarning: true,
|
33189
|
-
children: /* @__PURE__ */ (0,
|
33326
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
|
33190
33327
|
}
|
33191
33328
|
) })
|
33192
33329
|
]
|
@@ -33227,9 +33364,9 @@ var insertComponent = (componentType, zone, index, {
|
|
33227
33364
|
};
|
33228
33365
|
|
33229
33366
|
// components/Puck/index.tsx
|
33230
|
-
var
|
33231
|
-
var
|
33232
|
-
var getLayoutClassName = get_class_name_factory_default("PuckLayout",
|
33367
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
33368
|
+
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
33369
|
+
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
33233
33370
|
function Puck({
|
33234
33371
|
children,
|
33235
33372
|
config,
|
@@ -33238,6 +33375,7 @@ function Puck({
|
|
33238
33375
|
onChange,
|
33239
33376
|
onPublish,
|
33240
33377
|
onAction,
|
33378
|
+
permissions = {},
|
33241
33379
|
plugins = [],
|
33242
33380
|
overrides = {},
|
33243
33381
|
renderHeader,
|
@@ -33253,10 +33391,10 @@ function Puck({
|
|
33253
33391
|
}) {
|
33254
33392
|
var _a;
|
33255
33393
|
const historyStore = useHistoryStore(initialHistory);
|
33256
|
-
const [reducer] = (0,
|
33394
|
+
const [reducer] = (0, import_react31.useState)(
|
33257
33395
|
() => createReducer({ config, record: historyStore.record, onAction })
|
33258
33396
|
);
|
33259
|
-
const [initialAppState] = (0,
|
33397
|
+
const [initialAppState] = (0, import_react31.useState)(() => {
|
33260
33398
|
var _a2, _b, _c, _d, _e, _f, _g;
|
33261
33399
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33262
33400
|
let clientUiState = {};
|
@@ -33314,7 +33452,7 @@ function Puck({
|
|
33314
33452
|
})
|
33315
33453
|
});
|
33316
33454
|
});
|
33317
|
-
const [appState, dispatch] = (0,
|
33455
|
+
const [appState, dispatch] = (0, import_react31.useReducer)(
|
33318
33456
|
reducer,
|
33319
33457
|
flushZones(initialAppState)
|
33320
33458
|
);
|
@@ -33325,9 +33463,9 @@ function Puck({
|
|
33325
33463
|
config,
|
33326
33464
|
dispatch
|
33327
33465
|
);
|
33328
|
-
const [menuOpen, setMenuOpen] = (0,
|
33466
|
+
const [menuOpen, setMenuOpen] = (0, import_react31.useState)(false);
|
33329
33467
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
33330
|
-
const setItemSelector = (0,
|
33468
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
33331
33469
|
(newItemSelector) => {
|
33332
33470
|
if (newItemSelector === itemSelector) return;
|
33333
33471
|
dispatch({
|
@@ -33339,13 +33477,13 @@ function Puck({
|
|
33339
33477
|
[itemSelector]
|
33340
33478
|
);
|
33341
33479
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
33342
|
-
(0,
|
33480
|
+
(0, import_react31.useEffect)(() => {
|
33343
33481
|
if (onChange) onChange(data);
|
33344
33482
|
}, [data]);
|
33345
33483
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
33346
|
-
const [draggedItem, setDraggedItem] = (0,
|
33484
|
+
const [draggedItem, setDraggedItem] = (0, import_react31.useState)();
|
33347
33485
|
const rootProps = data.root.props || data.root;
|
33348
|
-
const toggleSidebars = (0,
|
33486
|
+
const toggleSidebars = (0, import_react31.useCallback)(
|
33349
33487
|
(sidebar) => {
|
33350
33488
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
33351
33489
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -33359,7 +33497,7 @@ function Puck({
|
|
33359
33497
|
},
|
33360
33498
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
33361
33499
|
);
|
33362
|
-
(0,
|
33500
|
+
(0, import_react31.useEffect)(() => {
|
33363
33501
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
33364
33502
|
dispatch({
|
33365
33503
|
type: "setUi",
|
@@ -33382,11 +33520,7 @@ function Puck({
|
|
33382
33520
|
window.removeEventListener("resize", handleResize);
|
33383
33521
|
};
|
33384
33522
|
}, []);
|
33385
|
-
const
|
33386
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: children2 });
|
33387
|
-
return PuckDefault;
|
33388
|
-
}, []);
|
33389
|
-
const defaultHeaderRender = (0, import_react30.useMemo)(() => {
|
33523
|
+
const defaultHeaderRender = (0, import_react31.useMemo)(() => {
|
33390
33524
|
if (renderHeader) {
|
33391
33525
|
console.warn(
|
33392
33526
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -33394,48 +33528,49 @@ function Puck({
|
|
33394
33528
|
const RenderHeader = (_a2) => {
|
33395
33529
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
33396
33530
|
const Comp = renderHeader;
|
33397
|
-
return /* @__PURE__ */ (0,
|
33531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
33398
33532
|
};
|
33399
33533
|
return RenderHeader;
|
33400
33534
|
}
|
33401
|
-
return
|
33535
|
+
return DefaultOverride;
|
33402
33536
|
}, [renderHeader]);
|
33403
|
-
const defaultHeaderActionsRender = (0,
|
33537
|
+
const defaultHeaderActionsRender = (0, import_react31.useMemo)(() => {
|
33404
33538
|
if (renderHeaderActions) {
|
33405
33539
|
console.warn(
|
33406
33540
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
33407
33541
|
);
|
33408
33542
|
const RenderHeader = (props) => {
|
33409
33543
|
const Comp = renderHeaderActions;
|
33410
|
-
return /* @__PURE__ */ (0,
|
33544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
33411
33545
|
};
|
33412
33546
|
return RenderHeader;
|
33413
33547
|
}
|
33414
|
-
return
|
33548
|
+
return DefaultOverride;
|
33415
33549
|
}, [renderHeader]);
|
33416
|
-
const loadedOverrides = (
|
33417
|
-
|
33418
|
-
|
33419
|
-
|
33420
|
-
|
33550
|
+
const loadedOverrides = useLoadedOverrides({
|
33551
|
+
overrides,
|
33552
|
+
plugins
|
33553
|
+
});
|
33554
|
+
const CustomPuck = (0, import_react31.useMemo)(
|
33555
|
+
() => loadedOverrides.puck || DefaultOverride,
|
33421
33556
|
[loadedOverrides]
|
33422
33557
|
);
|
33423
|
-
const CustomHeader = (0,
|
33558
|
+
const CustomHeader = (0, import_react31.useMemo)(
|
33424
33559
|
() => loadedOverrides.header || defaultHeaderRender,
|
33425
33560
|
[loadedOverrides]
|
33426
33561
|
);
|
33427
|
-
const CustomHeaderActions = (0,
|
33562
|
+
const CustomHeaderActions = (0, import_react31.useMemo)(
|
33428
33563
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
33429
33564
|
[loadedOverrides]
|
33430
33565
|
);
|
33431
|
-
const [mounted, setMounted] = (0,
|
33432
|
-
(0,
|
33566
|
+
const [mounted, setMounted] = (0, import_react31.useState)(false);
|
33567
|
+
(0, import_react31.useEffect)(() => {
|
33433
33568
|
setMounted(true);
|
33434
33569
|
}, []);
|
33435
33570
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
33436
33571
|
const selectedComponentLabel = selectedItem ? (_a = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a : selectedItem.type.toString() : "";
|
33437
|
-
return /* @__PURE__ */ (0,
|
33438
|
-
/* @__PURE__ */ (0,
|
33572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
33573
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33439
33574
|
AppProvider,
|
33440
33575
|
{
|
33441
33576
|
value: {
|
@@ -33448,9 +33583,16 @@ function Puck({
|
|
33448
33583
|
overrides: loadedOverrides,
|
33449
33584
|
history,
|
33450
33585
|
viewports,
|
33451
|
-
iframe
|
33586
|
+
iframe,
|
33587
|
+
globalPermissions: __spreadValues({
|
33588
|
+
delete: true,
|
33589
|
+
drag: true,
|
33590
|
+
duplicate: true,
|
33591
|
+
insert: true,
|
33592
|
+
edit: true
|
33593
|
+
}, permissions)
|
33452
33594
|
},
|
33453
|
-
children: /* @__PURE__ */ (0,
|
33595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33454
33596
|
DragDropContext,
|
33455
33597
|
{
|
33456
33598
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -33502,7 +33644,7 @@ function Puck({
|
|
33502
33644
|
});
|
33503
33645
|
}
|
33504
33646
|
},
|
33505
|
-
children: /* @__PURE__ */ (0,
|
33647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33506
33648
|
DropZoneProvider,
|
33507
33649
|
{
|
33508
33650
|
value: {
|
@@ -33516,7 +33658,7 @@ function Puck({
|
|
33516
33658
|
mode: "edit",
|
33517
33659
|
areaId: "root"
|
33518
33660
|
},
|
33519
|
-
children: /* @__PURE__ */ (0,
|
33661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33520
33662
|
"div",
|
33521
33663
|
{
|
33522
33664
|
className: getLayoutClassName({
|
@@ -33525,64 +33667,64 @@ function Puck({
|
|
33525
33667
|
mounted,
|
33526
33668
|
rightSideBarVisible
|
33527
33669
|
}),
|
33528
|
-
children: /* @__PURE__ */ (0,
|
33529
|
-
/* @__PURE__ */ (0,
|
33670
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
33671
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33530
33672
|
CustomHeader,
|
33531
33673
|
{
|
33532
|
-
actions: /* @__PURE__ */ (0,
|
33674
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33533
33675
|
Button,
|
33534
33676
|
{
|
33535
33677
|
onClick: () => {
|
33536
33678
|
onPublish && onPublish(data);
|
33537
33679
|
},
|
33538
|
-
icon: /* @__PURE__ */ (0,
|
33680
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
33539
33681
|
children: "Publish"
|
33540
33682
|
}
|
33541
33683
|
) }) }),
|
33542
|
-
children: /* @__PURE__ */ (0,
|
33543
|
-
/* @__PURE__ */ (0,
|
33544
|
-
/* @__PURE__ */ (0,
|
33684
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
33685
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
33686
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33545
33687
|
"div",
|
33546
33688
|
{
|
33547
33689
|
className: getLayoutClassName(
|
33548
33690
|
"leftSideBarToggle"
|
33549
33691
|
),
|
33550
|
-
children: /* @__PURE__ */ (0,
|
33692
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33551
33693
|
IconButton,
|
33552
33694
|
{
|
33553
33695
|
onClick: () => {
|
33554
33696
|
toggleSidebars("left");
|
33555
33697
|
},
|
33556
33698
|
title: "Toggle left sidebar",
|
33557
|
-
children: /* @__PURE__ */ (0,
|
33699
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
33558
33700
|
}
|
33559
33701
|
)
|
33560
33702
|
}
|
33561
33703
|
),
|
33562
|
-
/* @__PURE__ */ (0,
|
33704
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33563
33705
|
"div",
|
33564
33706
|
{
|
33565
33707
|
className: getLayoutClassName(
|
33566
33708
|
"rightSideBarToggle"
|
33567
33709
|
),
|
33568
|
-
children: /* @__PURE__ */ (0,
|
33710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33569
33711
|
IconButton,
|
33570
33712
|
{
|
33571
33713
|
onClick: () => {
|
33572
33714
|
toggleSidebars("right");
|
33573
33715
|
},
|
33574
33716
|
title: "Toggle right sidebar",
|
33575
|
-
children: /* @__PURE__ */ (0,
|
33717
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
33576
33718
|
}
|
33577
33719
|
)
|
33578
33720
|
}
|
33579
33721
|
)
|
33580
33722
|
] }),
|
33581
|
-
/* @__PURE__ */ (0,
|
33723
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33582
33724
|
headerTitle || rootProps.title || "Page",
|
33583
|
-
headerPath && /* @__PURE__ */ (0,
|
33725
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
33584
33726
|
" ",
|
33585
|
-
/* @__PURE__ */ (0,
|
33727
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33586
33728
|
"code",
|
33587
33729
|
{
|
33588
33730
|
className: getLayoutClassName("headerPath"),
|
@@ -33591,18 +33733,18 @@ function Puck({
|
|
33591
33733
|
)
|
33592
33734
|
] })
|
33593
33735
|
] }) }),
|
33594
|
-
/* @__PURE__ */ (0,
|
33595
|
-
/* @__PURE__ */ (0,
|
33736
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
33737
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33596
33738
|
IconButton,
|
33597
33739
|
{
|
33598
33740
|
onClick: () => {
|
33599
33741
|
return setMenuOpen(!menuOpen);
|
33600
33742
|
},
|
33601
33743
|
title: "Toggle menu bar",
|
33602
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33744
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
33603
33745
|
}
|
33604
33746
|
) }),
|
33605
|
-
/* @__PURE__ */ (0,
|
33747
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33606
33748
|
MenuBar,
|
33607
33749
|
{
|
33608
33750
|
appState,
|
@@ -33610,13 +33752,13 @@ function Puck({
|
|
33610
33752
|
dispatch,
|
33611
33753
|
onPublish,
|
33612
33754
|
menuOpen,
|
33613
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33755
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33614
33756
|
Button,
|
33615
33757
|
{
|
33616
33758
|
onClick: () => {
|
33617
33759
|
onPublish && onPublish(data);
|
33618
33760
|
},
|
33619
|
-
icon: /* @__PURE__ */ (0,
|
33761
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
33620
33762
|
children: "Publish"
|
33621
33763
|
}
|
33622
33764
|
) }),
|
@@ -33627,19 +33769,19 @@ function Puck({
|
|
33627
33769
|
] }) })
|
33628
33770
|
}
|
33629
33771
|
),
|
33630
|
-
/* @__PURE__ */ (0,
|
33631
|
-
/* @__PURE__ */ (0,
|
33632
|
-
/* @__PURE__ */ (0,
|
33772
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
33773
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
|
33774
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
|
33633
33775
|
] }),
|
33634
|
-
/* @__PURE__ */ (0,
|
33635
|
-
/* @__PURE__ */ (0,
|
33776
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
|
33777
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33636
33778
|
SidebarSection,
|
33637
33779
|
{
|
33638
33780
|
noPadding: true,
|
33639
33781
|
noBorderTop: true,
|
33640
33782
|
showBreadcrumbs: true,
|
33641
33783
|
title: selectedItem ? selectedComponentLabel : "Page",
|
33642
|
-
children: /* @__PURE__ */ (0,
|
33784
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
33643
33785
|
}
|
33644
33786
|
) })
|
33645
33787
|
] })
|
@@ -33651,7 +33793,7 @@ function Puck({
|
|
33651
33793
|
)
|
33652
33794
|
}
|
33653
33795
|
),
|
33654
|
-
/* @__PURE__ */ (0,
|
33796
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
33655
33797
|
] });
|
33656
33798
|
}
|
33657
33799
|
Puck.Components = Components;
|
@@ -33661,7 +33803,7 @@ Puck.Preview = Preview;
|
|
33661
33803
|
|
33662
33804
|
// components/Render/index.tsx
|
33663
33805
|
init_react_import();
|
33664
|
-
var
|
33806
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
33665
33807
|
function Render({
|
33666
33808
|
config,
|
33667
33809
|
data
|
@@ -33674,7 +33816,7 @@ function Render({
|
|
33674
33816
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
33675
33817
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33676
33818
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33677
|
-
return /* @__PURE__ */ (0,
|
33819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
33678
33820
|
config.root.render,
|
33679
33821
|
__spreadProps(__spreadValues({}, rootProps), {
|
33680
33822
|
puck: {
|
@@ -33684,11 +33826,11 @@ function Render({
|
|
33684
33826
|
title,
|
33685
33827
|
editMode: false,
|
33686
33828
|
id: "puck-root",
|
33687
|
-
children: /* @__PURE__ */ (0,
|
33829
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId })
|
33688
33830
|
})
|
33689
33831
|
) });
|
33690
33832
|
}
|
33691
|
-
return /* @__PURE__ */ (0,
|
33833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId }) });
|
33692
33834
|
}
|
33693
33835
|
|
33694
33836
|
// lib/migrate.ts
|
@@ -33796,12 +33938,24 @@ var usePuck = () => {
|
|
33796
33938
|
config,
|
33797
33939
|
history,
|
33798
33940
|
dispatch,
|
33799
|
-
selectedItem
|
33941
|
+
selectedItem: currentItem,
|
33942
|
+
globalPermissions
|
33800
33943
|
} = useAppContext();
|
33801
33944
|
return {
|
33802
33945
|
appState,
|
33803
33946
|
config,
|
33804
33947
|
dispatch,
|
33948
|
+
getPermissions: ({
|
33949
|
+
item,
|
33950
|
+
type
|
33951
|
+
} = {}) => {
|
33952
|
+
return getPermissions({
|
33953
|
+
selectedItem: item || currentItem,
|
33954
|
+
type,
|
33955
|
+
globalPermissions: globalPermissions || {},
|
33956
|
+
config
|
33957
|
+
});
|
33958
|
+
},
|
33805
33959
|
history: {
|
33806
33960
|
back: history.back,
|
33807
33961
|
forward: history.forward,
|
@@ -33813,11 +33967,13 @@ var usePuck = () => {
|
|
33813
33967
|
index: history.historyStore.index,
|
33814
33968
|
historyStore: history.historyStore
|
33815
33969
|
},
|
33816
|
-
selectedItem:
|
33970
|
+
selectedItem: currentItem || null
|
33817
33971
|
};
|
33818
33972
|
};
|
33819
33973
|
// Annotate the CommonJS export names for ESM import in node:
|
33820
33974
|
0 && (module.exports = {
|
33975
|
+
Action,
|
33976
|
+
ActionBar,
|
33821
33977
|
AutoField,
|
33822
33978
|
AutoFieldPrivate,
|
33823
33979
|
Button,
|