@measured/puck 0.16.0-canary.c7007ac → 0.16.0-canary.d08a794
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-CkVFT1_w.d.ts} +15 -1
- package/dist/index.css +95 -78
- package/dist/index.d.ts +45 -6
- package/dist/index.js +838 -608
- 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,151 @@ 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
|
+
|
30543
|
+
// lib/get-changed.ts
|
30544
|
+
init_react_import();
|
30545
|
+
var getChanged = (newItem, oldItem) => {
|
30546
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
30547
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
30548
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
30549
|
+
return __spreadProps(__spreadValues({}, acc), {
|
30550
|
+
[item]: oldItemProps[item] !== newItemProps[item]
|
30551
|
+
});
|
30552
|
+
}, {}) : {};
|
30553
|
+
};
|
30554
|
+
|
30555
|
+
// lib/resolve-permissions.ts
|
30556
|
+
init_react_import();
|
30557
|
+
var resolvePermissions = ({
|
30558
|
+
selectedItem,
|
30559
|
+
config,
|
30560
|
+
changed,
|
30561
|
+
lastPermissions,
|
30562
|
+
initialPermissions,
|
30563
|
+
appState
|
30564
|
+
}) => {
|
30565
|
+
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
30566
|
+
if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolvePermissions)) {
|
30567
|
+
return componentConfig.resolvePermissions(selectedItem, {
|
30568
|
+
changed,
|
30569
|
+
lastPermissions,
|
30570
|
+
initialPermissions,
|
30571
|
+
appState
|
30572
|
+
});
|
30573
|
+
}
|
30574
|
+
return {};
|
30575
|
+
};
|
30576
|
+
|
30577
|
+
// lib/get-permissions.ts
|
30578
|
+
var cache = { lastPermissions: {}, lastSelected: {} };
|
30579
|
+
var getPermissions = ({
|
30580
|
+
selectedItem,
|
30581
|
+
type,
|
30582
|
+
globalPermissions,
|
30583
|
+
config,
|
30584
|
+
appState
|
30585
|
+
}) => {
|
30586
|
+
const componentType = type || selectedItem && selectedItem.type || "";
|
30587
|
+
const componentId = selectedItem && selectedItem.props.id || "";
|
30588
|
+
let componentPermissions = getInitialPermissions({
|
30589
|
+
componentType,
|
30590
|
+
config,
|
30591
|
+
globalPermissions
|
30592
|
+
});
|
30593
|
+
const changed = getChanged(selectedItem, cache.lastSelected);
|
30594
|
+
if (Object.values(changed).some((el) => el === true)) {
|
30595
|
+
const resolvedPermissions = resolvePermissions({
|
30596
|
+
selectedItem,
|
30597
|
+
config,
|
30598
|
+
changed,
|
30599
|
+
lastPermissions: cache.lastPermissions[componentId] || componentPermissions,
|
30600
|
+
initialPermissions: componentPermissions,
|
30601
|
+
appState
|
30602
|
+
});
|
30603
|
+
if (resolvedPermissions !== void 0) {
|
30604
|
+
componentPermissions = __spreadValues(__spreadValues({}, componentPermissions), resolvedPermissions);
|
30605
|
+
}
|
30606
|
+
cache.lastSelected = selectedItem;
|
30607
|
+
cache.lastPermissions[componentId] = componentPermissions;
|
30608
|
+
return componentPermissions;
|
30609
|
+
}
|
30610
|
+
if (Object.keys(componentId && cache.lastPermissions[componentId]).length !== 0) {
|
30611
|
+
componentPermissions = cache.lastPermissions[componentId];
|
30612
|
+
}
|
30613
|
+
return componentPermissions;
|
30614
|
+
};
|
30615
|
+
var getInitialPermissions = ({
|
30616
|
+
componentType,
|
30617
|
+
globalPermissions,
|
30618
|
+
config
|
30619
|
+
}) => {
|
30620
|
+
var _a;
|
30621
|
+
return __spreadValues(__spreadValues({}, globalPermissions), (_a = config.components[componentType]) == null ? void 0 : _a.permissions);
|
30622
|
+
};
|
30623
|
+
|
30449
30624
|
// components/DraggableComponent/index.tsx
|
30450
|
-
var
|
30451
|
-
var
|
30625
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
30626
|
+
var getClassName17 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
30452
30627
|
var space = 8;
|
30453
30628
|
var actionsOverlayTop = space * 6.5;
|
30454
30629
|
var actionsTop = -(actionsOverlayTop - 8);
|
30455
30630
|
var actionsRight = space;
|
30631
|
+
var DefaultActionBar = ({
|
30632
|
+
label,
|
30633
|
+
children
|
30634
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar, { label, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DefaultOverride, { children }) });
|
30456
30635
|
var DraggableComponent = ({
|
30457
30636
|
children,
|
30458
30637
|
id,
|
@@ -30475,30 +30654,52 @@ var DraggableComponent = ({
|
|
30475
30654
|
indicativeHover = false,
|
30476
30655
|
style
|
30477
30656
|
}) => {
|
30478
|
-
const {
|
30657
|
+
const {
|
30658
|
+
zoomConfig,
|
30659
|
+
status,
|
30660
|
+
overrides,
|
30661
|
+
plugins,
|
30662
|
+
selectedItem,
|
30663
|
+
config,
|
30664
|
+
globalPermissions,
|
30665
|
+
state
|
30666
|
+
} = useAppContext();
|
30479
30667
|
const isModifierHeld = useModifierHeld("Alt");
|
30480
|
-
const { status } = useAppContext();
|
30481
30668
|
const El = status !== "LOADING" ? import_dnd4.Draggable : DefaultDraggable;
|
30482
|
-
(0,
|
30483
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0,
|
30484
|
-
(0,
|
30669
|
+
(0, import_react15.useEffect)(onMount, []);
|
30670
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react15.useState)(false);
|
30671
|
+
(0, import_react15.useEffect)(() => {
|
30485
30672
|
if (isIos()) {
|
30486
30673
|
setDisableSecondaryAnimation(true);
|
30487
30674
|
}
|
30488
30675
|
}, []);
|
30489
|
-
|
30676
|
+
const loadedOverrides = useLoadedOverrides({
|
30677
|
+
overrides,
|
30678
|
+
plugins
|
30679
|
+
});
|
30680
|
+
const CustomActionBar = (0, import_react15.useMemo)(
|
30681
|
+
() => loadedOverrides.actionBar || DefaultActionBar,
|
30682
|
+
[loadedOverrides]
|
30683
|
+
);
|
30684
|
+
const permissions = selectedItem && getPermissions({
|
30685
|
+
selectedItem,
|
30686
|
+
globalPermissions: globalPermissions || {},
|
30687
|
+
config,
|
30688
|
+
appState: state
|
30689
|
+
});
|
30690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30490
30691
|
El,
|
30491
30692
|
{
|
30492
30693
|
draggableId: id,
|
30493
30694
|
index,
|
30494
30695
|
isDragDisabled,
|
30495
30696
|
disableSecondaryAnimation,
|
30496
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
30697
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
30497
30698
|
"div",
|
30498
30699
|
__spreadProps(__spreadValues(__spreadValues({
|
30499
30700
|
ref: provided.innerRef
|
30500
30701
|
}, provided.draggableProps), provided.dragHandleProps), {
|
30501
|
-
className:
|
30702
|
+
className: getClassName17({
|
30502
30703
|
isSelected,
|
30503
30704
|
isModifierHeld,
|
30504
30705
|
isDragging: snapshot.isDragging,
|
@@ -30507,7 +30708,7 @@ var DraggableComponent = ({
|
|
30507
30708
|
indicativeHover
|
30508
30709
|
}),
|
30509
30710
|
style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
|
30510
|
-
cursor: isModifierHeld ? "initial" : "grab"
|
30711
|
+
cursor: isModifierHeld || isDragDisabled ? "initial" : "grab"
|
30511
30712
|
}),
|
30512
30713
|
onMouseOver,
|
30513
30714
|
onMouseOut,
|
@@ -30516,34 +30717,33 @@ var DraggableComponent = ({
|
|
30516
30717
|
onClick,
|
30517
30718
|
children: [
|
30518
30719
|
debug,
|
30519
|
-
isLoading && /* @__PURE__ */ (0,
|
30520
|
-
/* @__PURE__ */ (0,
|
30720
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loader, {}) }),
|
30721
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30521
30722
|
"div",
|
30522
30723
|
{
|
30523
|
-
className:
|
30724
|
+
className: getClassName17("actionsOverlay"),
|
30524
30725
|
style: {
|
30525
30726
|
top: actionsOverlayTop / zoomConfig.zoom
|
30526
30727
|
},
|
30527
|
-
children: /* @__PURE__ */ (0,
|
30728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30528
30729
|
"div",
|
30529
30730
|
{
|
30530
|
-
className:
|
30731
|
+
className: getClassName17("actions"),
|
30531
30732
|
style: {
|
30532
30733
|
transform: `scale(${1 / zoomConfig.zoom}`,
|
30533
30734
|
top: actionsTop / zoomConfig.zoom,
|
30534
30735
|
right: actionsRight / zoomConfig.zoom
|
30535
30736
|
},
|
30536
|
-
children: [
|
30537
|
-
|
30538
|
-
/* @__PURE__ */ (0,
|
30539
|
-
|
30540
|
-
]
|
30737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(CustomActionBar, { label, children: [
|
30738
|
+
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 }) }),
|
30739
|
+
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 }) })
|
30740
|
+
] })
|
30541
30741
|
}
|
30542
30742
|
)
|
30543
30743
|
}
|
30544
30744
|
),
|
30545
|
-
/* @__PURE__ */ (0,
|
30546
|
-
/* @__PURE__ */ (0,
|
30745
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("overlay") }),
|
30746
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("contents"), children })
|
30547
30747
|
]
|
30548
30748
|
})
|
30549
30749
|
)
|
@@ -30554,11 +30754,11 @@ var DraggableComponent = ({
|
|
30554
30754
|
|
30555
30755
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
30556
30756
|
init_react_import();
|
30557
|
-
var
|
30757
|
+
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
30758
|
|
30559
30759
|
// components/DropZone/context.tsx
|
30560
30760
|
init_react_import();
|
30561
|
-
var
|
30761
|
+
var import_react16 = require("react");
|
30562
30762
|
var import_use_debounce2 = require("use-debounce");
|
30563
30763
|
|
30564
30764
|
// lib/get-zone-id.ts
|
@@ -30574,30 +30774,30 @@ var getZoneId = (zoneCompound) => {
|
|
30574
30774
|
};
|
30575
30775
|
|
30576
30776
|
// components/DropZone/context.tsx
|
30577
|
-
var
|
30578
|
-
var dropZoneContext = (0,
|
30777
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
30778
|
+
var dropZoneContext = (0, import_react16.createContext)(null);
|
30579
30779
|
var DropZoneProvider = ({
|
30580
30780
|
children,
|
30581
30781
|
value
|
30582
30782
|
}) => {
|
30583
|
-
const [hoveringArea, setHoveringArea] = (0,
|
30584
|
-
const [hoveringZone, setHoveringZone] = (0,
|
30783
|
+
const [hoveringArea, setHoveringArea] = (0, import_react16.useState)(null);
|
30784
|
+
const [hoveringZone, setHoveringZone] = (0, import_react16.useState)(
|
30585
30785
|
rootDroppableId
|
30586
30786
|
);
|
30587
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30787
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react16.useState)();
|
30588
30788
|
const [hoveringAreaDb] = (0, import_use_debounce2.useDebounce)(hoveringArea, 75, { leading: false });
|
30589
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30789
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react16.useState)(
|
30590
30790
|
{}
|
30591
30791
|
);
|
30592
|
-
const [activeZones, setActiveZones] = (0,
|
30792
|
+
const [activeZones, setActiveZones] = (0, import_react16.useState)({});
|
30593
30793
|
const { dispatch = null } = value ? value : {};
|
30594
|
-
const registerZoneArea = (0,
|
30794
|
+
const registerZoneArea = (0, import_react16.useCallback)(
|
30595
30795
|
(area) => {
|
30596
30796
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
30597
30797
|
},
|
30598
30798
|
[setAreasWithZones]
|
30599
30799
|
);
|
30600
|
-
const registerZone = (0,
|
30800
|
+
const registerZone = (0, import_react16.useCallback)(
|
30601
30801
|
(zoneCompound) => {
|
30602
30802
|
if (!dispatch) {
|
30603
30803
|
return;
|
@@ -30610,7 +30810,7 @@ var DropZoneProvider = ({
|
|
30610
30810
|
},
|
30611
30811
|
[setActiveZones, dispatch]
|
30612
30812
|
);
|
30613
|
-
const unregisterZone = (0,
|
30813
|
+
const unregisterZone = (0, import_react16.useCallback)(
|
30614
30814
|
(zoneCompound) => {
|
30615
30815
|
if (!dispatch) {
|
30616
30816
|
return;
|
@@ -30625,8 +30825,8 @@ var DropZoneProvider = ({
|
|
30625
30825
|
},
|
30626
30826
|
[setActiveZones, dispatch]
|
30627
30827
|
);
|
30628
|
-
const [pathData, setPathData] = (0,
|
30629
|
-
const registerPath = (0,
|
30828
|
+
const [pathData, setPathData] = (0, import_react16.useState)();
|
30829
|
+
const registerPath = (0, import_react16.useCallback)(
|
30630
30830
|
(selector) => {
|
30631
30831
|
if (!(value == null ? void 0 : value.data)) {
|
30632
30832
|
return;
|
@@ -30651,8 +30851,8 @@ var DropZoneProvider = ({
|
|
30651
30851
|
},
|
30652
30852
|
[value, setPathData]
|
30653
30853
|
);
|
30654
|
-
const [zoneWillDrag, setZoneWillDrag] = (0,
|
30655
|
-
return /* @__PURE__ */ (0,
|
30854
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react16.useState)("");
|
30855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
30656
30856
|
dropZoneContext.Provider,
|
30657
30857
|
{
|
30658
30858
|
value: __spreadValues({
|
@@ -30678,12 +30878,12 @@ var DropZoneProvider = ({
|
|
30678
30878
|
};
|
30679
30879
|
|
30680
30880
|
// components/DropZone/index.tsx
|
30681
|
-
var
|
30682
|
-
var
|
30881
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
30882
|
+
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
30683
30883
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
30684
30884
|
var _a;
|
30685
30885
|
const appContext2 = useAppContext();
|
30686
|
-
const ctx = (0,
|
30886
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30687
30887
|
const {
|
30688
30888
|
// These all need setting via context
|
30689
30889
|
data,
|
@@ -30702,12 +30902,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30702
30902
|
} = ctx || {};
|
30703
30903
|
let content = data.content || [];
|
30704
30904
|
let zoneCompound = rootDroppableId;
|
30705
|
-
(0,
|
30905
|
+
(0, import_react17.useEffect)(() => {
|
30706
30906
|
if (areaId && registerZoneArea) {
|
30707
30907
|
registerZoneArea(areaId);
|
30708
30908
|
}
|
30709
30909
|
}, [areaId]);
|
30710
|
-
(0,
|
30910
|
+
(0, import_react17.useEffect)(() => {
|
30711
30911
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
30712
30912
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
30713
30913
|
}
|
@@ -30733,7 +30933,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30733
30933
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
30734
30934
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
30735
30935
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
30736
|
-
return /* @__PURE__ */ (0,
|
30936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: "DropZone requires context to work." });
|
30737
30937
|
}
|
30738
30938
|
const {
|
30739
30939
|
hoveringArea = "root",
|
@@ -30774,10 +30974,10 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30774
30974
|
}
|
30775
30975
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30776
30976
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30777
|
-
return /* @__PURE__ */ (0,
|
30977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30778
30978
|
"div",
|
30779
30979
|
{
|
30780
|
-
className:
|
30980
|
+
className: getClassName18({
|
30781
30981
|
isRootZone,
|
30782
30982
|
userIsDragging,
|
30783
30983
|
draggingOverArea,
|
@@ -30791,17 +30991,17 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30791
30991
|
onMouseUp: () => {
|
30792
30992
|
setZoneWillDrag("");
|
30793
30993
|
},
|
30794
|
-
children: /* @__PURE__ */ (0,
|
30994
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30795
30995
|
Droppable,
|
30796
30996
|
{
|
30797
30997
|
droppableId: zoneCompound,
|
30798
30998
|
direction: "vertical",
|
30799
30999
|
isDropDisabled: !isEnabled,
|
30800
31000
|
children: (provided, snapshot) => {
|
30801
|
-
return /* @__PURE__ */ (0,
|
31001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
30802
31002
|
"div",
|
30803
31003
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30804
|
-
className:
|
31004
|
+
className: getClassName18("content"),
|
30805
31005
|
ref: provided == null ? void 0 : provided.innerRef,
|
30806
31006
|
style,
|
30807
31007
|
id: zoneCompound,
|
@@ -30828,25 +31028,34 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30828
31028
|
"draggable-"
|
30829
31029
|
)[1] === componentId;
|
30830
31030
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30831
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
31031
|
+
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
31032
|
"No configuration for ",
|
30833
31033
|
item.type
|
30834
31034
|
] });
|
30835
31035
|
const componentConfig = config.components[item.type];
|
30836
31036
|
const label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
30837
|
-
|
31037
|
+
const canDrag = getPermissions({
|
31038
|
+
selectedItem: getItem(
|
31039
|
+
{ index: i, zone: zoneCompound },
|
31040
|
+
appContext2.state.data
|
31041
|
+
),
|
31042
|
+
config: appContext2.config,
|
31043
|
+
globalPermissions: appContext2.globalPermissions || {},
|
31044
|
+
appState: appContext2.state
|
31045
|
+
}).drag;
|
31046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
30838
31047
|
"div",
|
30839
31048
|
{
|
30840
|
-
className:
|
31049
|
+
className: getClassName18("item"),
|
30841
31050
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30842
31051
|
children: [
|
30843
|
-
/* @__PURE__ */ (0,
|
31052
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30844
31053
|
DropZoneProvider,
|
30845
31054
|
{
|
30846
31055
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30847
31056
|
areaId: componentId
|
30848
31057
|
}),
|
30849
|
-
children: /* @__PURE__ */ (0,
|
31058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30850
31059
|
DraggableComponent,
|
30851
31060
|
{
|
30852
31061
|
label,
|
@@ -30855,6 +31064,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30855
31064
|
isSelected,
|
30856
31065
|
isLocked: userIsDragging,
|
30857
31066
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
31067
|
+
isDragDisabled: !canDrag,
|
30858
31068
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
30859
31069
|
isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
|
30860
31070
|
onMount: () => {
|
@@ -30913,15 +31123,15 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30913
31123
|
style: {
|
30914
31124
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30915
31125
|
},
|
30916
|
-
children: /* @__PURE__ */ (0,
|
31126
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
30917
31127
|
}
|
30918
31128
|
)
|
30919
31129
|
}
|
30920
31130
|
),
|
30921
|
-
userIsDragging && /* @__PURE__ */ (0,
|
31131
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30922
31132
|
"div",
|
30923
31133
|
{
|
30924
|
-
className:
|
31134
|
+
className: getClassName18("hitbox"),
|
30925
31135
|
onMouseOver: (e) => {
|
30926
31136
|
e.stopPropagation();
|
30927
31137
|
setHoveringArea(zoneArea);
|
@@ -30935,7 +31145,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30935
31145
|
);
|
30936
31146
|
}),
|
30937
31147
|
provided == null ? void 0 : provided.placeholder,
|
30938
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
31148
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30939
31149
|
"div",
|
30940
31150
|
{
|
30941
31151
|
"data-puck-placeholder": true,
|
@@ -30956,7 +31166,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30956
31166
|
);
|
30957
31167
|
}
|
30958
31168
|
function DropZoneRender({ zone }) {
|
30959
|
-
const ctx = (0,
|
31169
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30960
31170
|
const { data, areaId = "root", config } = ctx || {};
|
30961
31171
|
let zoneCompound = rootDroppableId;
|
30962
31172
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -30967,14 +31177,14 @@ function DropZoneRender({ zone }) {
|
|
30967
31177
|
zoneCompound = `${areaId}:${zone}`;
|
30968
31178
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30969
31179
|
}
|
30970
|
-
return /* @__PURE__ */ (0,
|
31180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: content.map((item) => {
|
30971
31181
|
const Component = config.components[item.type];
|
30972
31182
|
if (Component) {
|
30973
|
-
return /* @__PURE__ */ (0,
|
31183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30974
31184
|
DropZoneProvider,
|
30975
31185
|
{
|
30976
31186
|
value: { data, config, areaId: item.props.id },
|
30977
|
-
children: /* @__PURE__ */ (0,
|
31187
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30978
31188
|
Component.render,
|
30979
31189
|
__spreadProps(__spreadValues({}, item.props), {
|
30980
31190
|
puck: { renderDropZone: DropZone }
|
@@ -30988,20 +31198,20 @@ function DropZoneRender({ zone }) {
|
|
30988
31198
|
}) });
|
30989
31199
|
}
|
30990
31200
|
function DropZone(props) {
|
30991
|
-
const ctx = (0,
|
31201
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30992
31202
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30993
|
-
return /* @__PURE__ */ (0,
|
31203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30994
31204
|
}
|
30995
|
-
return /* @__PURE__ */ (0,
|
31205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender, __spreadValues({}, props));
|
30996
31206
|
}
|
30997
31207
|
|
30998
31208
|
// components/Puck/index.tsx
|
30999
31209
|
init_react_import();
|
31000
|
-
var
|
31210
|
+
var import_react31 = require("react");
|
31001
31211
|
|
31002
31212
|
// lib/use-placeholder-style.ts
|
31003
31213
|
init_react_import();
|
31004
|
-
var
|
31214
|
+
var import_react18 = require("react");
|
31005
31215
|
|
31006
31216
|
// lib/get-frame.ts
|
31007
31217
|
init_react_import();
|
@@ -31016,7 +31226,7 @@ var getFrame = () => {
|
|
31016
31226
|
// lib/use-placeholder-style.ts
|
31017
31227
|
var usePlaceholderStyle = () => {
|
31018
31228
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
31019
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
31229
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react18.useState)();
|
31020
31230
|
const onDragStartOrUpdate = (draggedItem) => {
|
31021
31231
|
var _a;
|
31022
31232
|
const draggableId = draggedItem.draggableId;
|
@@ -31065,11 +31275,11 @@ init_react_import();
|
|
31065
31275
|
|
31066
31276
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
31067
31277
|
init_react_import();
|
31068
|
-
var
|
31278
|
+
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
31279
|
|
31070
31280
|
// lib/use-breadcrumbs.ts
|
31071
31281
|
init_react_import();
|
31072
|
-
var
|
31282
|
+
var import_react19 = require("react");
|
31073
31283
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
31074
31284
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
31075
31285
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -31119,8 +31329,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
31119
31329
|
state: { data },
|
31120
31330
|
selectedItem
|
31121
31331
|
} = useAppContext();
|
31122
|
-
const dzContext = (0,
|
31123
|
-
return (0,
|
31332
|
+
const dzContext = (0, import_react19.useContext)(dropZoneContext);
|
31333
|
+
return (0, import_react19.useMemo)(() => {
|
31124
31334
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
31125
31335
|
selectedItem,
|
31126
31336
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -31134,8 +31344,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
31134
31344
|
};
|
31135
31345
|
|
31136
31346
|
// components/SidebarSection/index.tsx
|
31137
|
-
var
|
31138
|
-
var
|
31347
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
31348
|
+
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
31139
31349
|
var SidebarSection = ({
|
31140
31350
|
children,
|
31141
31351
|
title,
|
@@ -31147,28 +31357,28 @@ var SidebarSection = ({
|
|
31147
31357
|
}) => {
|
31148
31358
|
const { setUi } = useAppContext();
|
31149
31359
|
const breadcrumbs = useBreadcrumbs(1);
|
31150
|
-
return /* @__PURE__ */ (0,
|
31360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
31151
31361
|
"div",
|
31152
31362
|
{
|
31153
|
-
className:
|
31363
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
31154
31364
|
style: { background },
|
31155
31365
|
children: [
|
31156
|
-
/* @__PURE__ */ (0,
|
31157
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
31158
|
-
/* @__PURE__ */ (0,
|
31366
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
31367
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
31368
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
31159
31369
|
"button",
|
31160
31370
|
{
|
31161
|
-
className:
|
31371
|
+
className: getClassName19("breadcrumbLabel"),
|
31162
31372
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
31163
31373
|
children: breadcrumb.label
|
31164
31374
|
}
|
31165
31375
|
),
|
31166
|
-
/* @__PURE__ */ (0,
|
31376
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight, { size: 16 })
|
31167
31377
|
] }, i)) : null,
|
31168
|
-
/* @__PURE__ */ (0,
|
31378
|
+
/* @__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
31379
|
] }) }),
|
31170
|
-
/* @__PURE__ */ (0,
|
31171
|
-
isLoading && /* @__PURE__ */ (0,
|
31380
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
|
31381
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: 32 }) })
|
31172
31382
|
]
|
31173
31383
|
}
|
31174
31384
|
);
|
@@ -31282,34 +31492,37 @@ var replaceAction = (data, action) => {
|
|
31282
31492
|
})
|
31283
31493
|
});
|
31284
31494
|
};
|
31285
|
-
var
|
31286
|
-
|
31287
|
-
|
31288
|
-
|
31289
|
-
|
31290
|
-
|
31291
|
-
|
31292
|
-
|
31293
|
-
if (action.destinationZone === rootDroppableId) {
|
31294
|
-
return __spreadProps(__spreadValues({}, data), {
|
31295
|
-
content: insert(
|
31296
|
-
data.content,
|
31297
|
-
action.destinationIndex,
|
31298
|
-
emptyComponentData
|
31299
|
-
)
|
31300
|
-
});
|
31301
|
-
}
|
31302
|
-
const newData = setupZone(data, action.destinationZone);
|
31495
|
+
var insertAction = (data, action, config) => {
|
31496
|
+
const emptyComponentData = {
|
31497
|
+
type: action.componentType,
|
31498
|
+
props: __spreadProps(__spreadValues({}, config.components[action.componentType].defaultProps || {}), {
|
31499
|
+
id: action.id || generateId(action.componentType)
|
31500
|
+
})
|
31501
|
+
};
|
31502
|
+
if (action.destinationZone === rootDroppableId) {
|
31303
31503
|
return __spreadProps(__spreadValues({}, data), {
|
31304
|
-
|
31305
|
-
|
31306
|
-
|
31307
|
-
|
31308
|
-
|
31309
|
-
)
|
31310
|
-
})
|
31504
|
+
content: insert(
|
31505
|
+
data.content,
|
31506
|
+
action.destinationIndex,
|
31507
|
+
emptyComponentData
|
31508
|
+
)
|
31311
31509
|
});
|
31312
31510
|
}
|
31511
|
+
const newData = setupZone(data, action.destinationZone);
|
31512
|
+
return __spreadProps(__spreadValues({}, data), {
|
31513
|
+
zones: __spreadProps(__spreadValues({}, newData.zones), {
|
31514
|
+
[action.destinationZone]: insert(
|
31515
|
+
newData.zones[action.destinationZone],
|
31516
|
+
action.destinationIndex,
|
31517
|
+
emptyComponentData
|
31518
|
+
)
|
31519
|
+
})
|
31520
|
+
});
|
31521
|
+
};
|
31522
|
+
var reduceData = (data, action, config) => {
|
31523
|
+
if (action.type === "insert") {
|
31524
|
+
return insertAction(data, action, config);
|
31525
|
+
}
|
31313
31526
|
if (action.type === "duplicate") {
|
31314
31527
|
const item = getItem(
|
31315
31528
|
{ index: action.sourceIndex, zone: action.sourceZone },
|
@@ -31534,25 +31747,11 @@ var flushZones = (appState) => {
|
|
31534
31747
|
|
31535
31748
|
// lib/use-resolved-data.ts
|
31536
31749
|
init_react_import();
|
31537
|
-
var
|
31750
|
+
var import_react20 = require("react");
|
31538
31751
|
|
31539
31752
|
// lib/resolve-component-data.ts
|
31540
31753
|
init_react_import();
|
31541
|
-
|
31542
|
-
// lib/get-changed.ts
|
31543
|
-
init_react_import();
|
31544
|
-
var getChanged = (newItem, oldItem) => {
|
31545
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
31546
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
31547
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
31548
|
-
return __spreadProps(__spreadValues({}, acc), {
|
31549
|
-
[item]: oldItemProps[item] !== newItemProps[item]
|
31550
|
-
});
|
31551
|
-
}, {}) : {};
|
31552
|
-
};
|
31553
|
-
|
31554
|
-
// lib/resolve-component-data.ts
|
31555
|
-
var cache = { lastChange: {} };
|
31754
|
+
var cache2 = { lastChange: {} };
|
31556
31755
|
var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
31557
31756
|
return yield Promise.all(
|
31558
31757
|
content.map((item) => __async(void 0, null, function* () {
|
@@ -31568,7 +31767,7 @@ var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) =>
|
|
31568
31767
|
var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
31569
31768
|
const configForItem = config.components[item.type];
|
31570
31769
|
if (configForItem.resolveData) {
|
31571
|
-
const { item: oldItem = {}, resolved = {} } =
|
31770
|
+
const { item: oldItem = {}, resolved = {} } = cache2.lastChange[item.props.id] || {};
|
31572
31771
|
if (item && item === oldItem) {
|
31573
31772
|
return resolved;
|
31574
31773
|
}
|
@@ -31585,7 +31784,7 @@ var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __asy
|
|
31585
31784
|
if (Object.keys(newReadOnly).length) {
|
31586
31785
|
resolvedItem.readOnly = newReadOnly;
|
31587
31786
|
}
|
31588
|
-
|
31787
|
+
cache2.lastChange[item.props.id] = {
|
31589
31788
|
item,
|
31590
31789
|
resolved: resolvedItem
|
31591
31790
|
};
|
@@ -31617,20 +31816,20 @@ var applyDynamicProps = (data, dynamicProps, rootData) => {
|
|
31617
31816
|
|
31618
31817
|
// lib/resolve-root-data.ts
|
31619
31818
|
init_react_import();
|
31620
|
-
var
|
31819
|
+
var cache3 = {};
|
31621
31820
|
var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
31622
31821
|
var _a, _b, _c, _d, _e;
|
31623
31822
|
if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
|
31624
|
-
if (((_b =
|
31625
|
-
return
|
31823
|
+
if (((_b = cache3.lastChange) == null ? void 0 : _b.original) === data.root) {
|
31824
|
+
return cache3.lastChange.resolved;
|
31626
31825
|
}
|
31627
|
-
const changed = getChanged(data.root, (_c =
|
31826
|
+
const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
|
31628
31827
|
const rootWithProps = data.root;
|
31629
31828
|
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
31630
31829
|
changed,
|
31631
|
-
lastData: ((_d =
|
31830
|
+
lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
|
31632
31831
|
});
|
31633
|
-
|
31832
|
+
cache3.lastChange = {
|
31634
31833
|
original: data.root,
|
31635
31834
|
resolved: resolvedRoot
|
31636
31835
|
};
|
@@ -31643,13 +31842,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
31643
31842
|
|
31644
31843
|
// lib/use-resolved-data.ts
|
31645
31844
|
var useResolvedData = (appState, config, dispatch) => {
|
31646
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
31845
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react20.useState)({
|
31647
31846
|
resolverKey: 0,
|
31648
31847
|
newAppState: appState
|
31649
31848
|
});
|
31650
|
-
const [componentState, setComponentState] = (0,
|
31849
|
+
const [componentState, setComponentState] = (0, import_react20.useState)({});
|
31651
31850
|
const deferredSetStates = {};
|
31652
|
-
const setComponentLoading = (0,
|
31851
|
+
const setComponentLoading = (0, import_react20.useCallback)(
|
31653
31852
|
(id, loading, defer2 = 0) => {
|
31654
31853
|
if (deferredSetStates[id]) {
|
31655
31854
|
clearTimeout(deferredSetStates[id]);
|
@@ -31719,10 +31918,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31719
31918
|
});
|
31720
31919
|
yield Promise.all(promises);
|
31721
31920
|
});
|
31722
|
-
(0,
|
31921
|
+
(0, import_react20.useEffect)(() => {
|
31723
31922
|
runResolvers();
|
31724
31923
|
}, [resolverKey]);
|
31725
|
-
const resolveData = (0,
|
31924
|
+
const resolveData = (0, import_react20.useCallback)((newAppState2 = appState) => {
|
31726
31925
|
setResolverState((curr) => ({
|
31727
31926
|
resolverKey: curr.resolverKey + 1,
|
31728
31927
|
newAppState: newAppState2
|
@@ -31739,11 +31938,11 @@ init_react_import();
|
|
31739
31938
|
|
31740
31939
|
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
31741
31940
|
init_react_import();
|
31742
|
-
var
|
31941
|
+
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" };
|
31743
31942
|
|
31744
31943
|
// components/MenuBar/index.tsx
|
31745
|
-
var
|
31746
|
-
var
|
31944
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
31945
|
+
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
31747
31946
|
var MenuBar = ({
|
31748
31947
|
appState,
|
31749
31948
|
data = { content: [], root: {} },
|
@@ -31757,10 +31956,10 @@ var MenuBar = ({
|
|
31757
31956
|
history: { back, forward, historyStore }
|
31758
31957
|
} = useAppContext();
|
31759
31958
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31760
|
-
return /* @__PURE__ */ (0,
|
31959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
31761
31960
|
"div",
|
31762
31961
|
{
|
31763
|
-
className:
|
31962
|
+
className: getClassName20({ menuOpen }),
|
31764
31963
|
onClick: (event) => {
|
31765
31964
|
var _a;
|
31766
31965
|
const element = event.target;
|
@@ -31771,24 +31970,12 @@ var MenuBar = ({
|
|
31771
31970
|
setMenuOpen(false);
|
31772
31971
|
}
|
31773
31972
|
},
|
31774
|
-
children: /* @__PURE__ */ (0,
|
31775
|
-
/* @__PURE__ */ (0,
|
31776
|
-
/* @__PURE__ */ (0,
|
31777
|
-
|
31778
|
-
{
|
31779
|
-
size: 21,
|
31780
|
-
stroke: hasPast ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31781
|
-
}
|
31782
|
-
) }),
|
31783
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
31784
|
-
Redo2,
|
31785
|
-
{
|
31786
|
-
size: 21,
|
31787
|
-
stroke: hasFuture ? "var(--puck-color-black)" : "var(--puck-color-grey-08)"
|
31788
|
-
}
|
31789
|
-
) })
|
31973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("inner"), children: [
|
31974
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("history"), children: [
|
31975
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Undo2, { size: 21 }) }),
|
31976
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Redo2, { size: 21 }) })
|
31790
31977
|
] }),
|
31791
|
-
/* @__PURE__ */ (0,
|
31978
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31792
31979
|
state: appState,
|
31793
31980
|
dispatch
|
31794
31981
|
}) })
|
@@ -31799,26 +31986,26 @@ var MenuBar = ({
|
|
31799
31986
|
|
31800
31987
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
31801
31988
|
init_react_import();
|
31802
|
-
var
|
31989
|
+
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" };
|
31803
31990
|
|
31804
31991
|
// components/Puck/components/Fields/index.tsx
|
31805
31992
|
init_react_import();
|
31806
31993
|
|
31807
31994
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
31808
31995
|
init_react_import();
|
31809
|
-
var
|
31996
|
+
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" };
|
31810
31997
|
|
31811
31998
|
// components/Puck/components/Fields/index.tsx
|
31812
|
-
var
|
31813
|
-
var
|
31814
|
-
var
|
31999
|
+
var import_react21 = require("react");
|
32000
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
32001
|
+
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
31815
32002
|
var defaultPageFields = {
|
31816
32003
|
title: { type: "text" }
|
31817
32004
|
};
|
31818
32005
|
var DefaultFields = ({
|
31819
32006
|
children
|
31820
32007
|
}) => {
|
31821
|
-
return /* @__PURE__ */ (0,
|
32008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
31822
32009
|
};
|
31823
32010
|
var useResolvedFields = () => {
|
31824
32011
|
var _a;
|
@@ -31828,14 +32015,14 @@ var useResolvedFields = () => {
|
|
31828
32015
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
31829
32016
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
31830
32017
|
const rootProps = data.root.props || data.root;
|
31831
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
32018
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)(
|
31832
32019
|
{}
|
31833
32020
|
);
|
31834
|
-
const [resolvedFields, setResolvedFields] = (0,
|
31835
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
32021
|
+
const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
|
32022
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
|
31836
32023
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
31837
32024
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
31838
|
-
const resolveFields = (0,
|
32025
|
+
const resolveFields = (0, import_react21.useCallback)(
|
31839
32026
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
31840
32027
|
var _a2, _b, _c;
|
31841
32028
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : {};
|
@@ -31871,7 +32058,7 @@ var useResolvedFields = () => {
|
|
31871
32058
|
}),
|
31872
32059
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
31873
32060
|
);
|
31874
|
-
(0,
|
32061
|
+
(0, import_react21.useEffect)(() => {
|
31875
32062
|
setFieldsLoading(true);
|
31876
32063
|
resolveFields(defaultFields).then((fields) => {
|
31877
32064
|
setResolvedFields(fields || {});
|
@@ -31889,7 +32076,8 @@ var Fields = () => {
|
|
31889
32076
|
config,
|
31890
32077
|
resolveData,
|
31891
32078
|
componentState,
|
31892
|
-
overrides
|
32079
|
+
overrides,
|
32080
|
+
globalPermissions
|
31893
32081
|
} = useAppContext();
|
31894
32082
|
const { data, ui } = state;
|
31895
32083
|
const { itemSelector } = ui;
|
@@ -31897,16 +32085,16 @@ var Fields = () => {
|
|
31897
32085
|
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;
|
31898
32086
|
const isLoading = fieldsResolving || componentResolving;
|
31899
32087
|
const rootProps = data.root.props || data.root;
|
31900
|
-
const Wrapper = (0,
|
31901
|
-
return /* @__PURE__ */ (0,
|
32088
|
+
const Wrapper = (0, import_react21.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
31902
32090
|
"form",
|
31903
32091
|
{
|
31904
|
-
className:
|
32092
|
+
className: getClassName21(),
|
31905
32093
|
onSubmit: (e) => {
|
31906
32094
|
e.preventDefault();
|
31907
32095
|
},
|
31908
32096
|
children: [
|
31909
|
-
/* @__PURE__ */ (0,
|
32097
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
31910
32098
|
const field = fields[fieldName];
|
31911
32099
|
if (!(field == null ? void 0 : field.type)) return null;
|
31912
32100
|
const onChange = (value, updatedUi) => {
|
@@ -31973,13 +32161,19 @@ var Fields = () => {
|
|
31973
32161
|
};
|
31974
32162
|
if (selectedItem && itemSelector) {
|
31975
32163
|
const { readOnly = {} } = selectedItem;
|
31976
|
-
|
32164
|
+
const { edit } = getPermissions({
|
32165
|
+
selectedItem,
|
32166
|
+
config,
|
32167
|
+
globalPermissions: globalPermissions || {},
|
32168
|
+
appState: state
|
32169
|
+
});
|
32170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
31977
32171
|
AutoFieldPrivate,
|
31978
32172
|
{
|
31979
32173
|
field,
|
31980
32174
|
name: fieldName,
|
31981
32175
|
id: `${selectedItem.props.id}_${fieldName}`,
|
31982
|
-
readOnly: readOnly[fieldName],
|
32176
|
+
readOnly: !edit || readOnly[fieldName],
|
31983
32177
|
value: selectedItem.props[fieldName],
|
31984
32178
|
onChange
|
31985
32179
|
},
|
@@ -31987,7 +32181,7 @@ var Fields = () => {
|
|
31987
32181
|
);
|
31988
32182
|
} else {
|
31989
32183
|
const { readOnly = {} } = data.root;
|
31990
|
-
return /* @__PURE__ */ (0,
|
32184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
31991
32185
|
AutoFieldPrivate,
|
31992
32186
|
{
|
31993
32187
|
field,
|
@@ -32001,7 +32195,7 @@ var Fields = () => {
|
|
32001
32195
|
);
|
32002
32196
|
}
|
32003
32197
|
}) }),
|
32004
|
-
isLoading && /* @__PURE__ */ (0,
|
32198
|
+
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 }) }) })
|
32005
32199
|
]
|
32006
32200
|
}
|
32007
32201
|
);
|
@@ -32012,25 +32206,40 @@ init_react_import();
|
|
32012
32206
|
|
32013
32207
|
// lib/use-component-list.tsx
|
32014
32208
|
init_react_import();
|
32015
|
-
var
|
32209
|
+
var import_react22 = require("react");
|
32016
32210
|
|
32017
32211
|
// components/ComponentList/index.tsx
|
32018
32212
|
init_react_import();
|
32019
32213
|
|
32020
32214
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
32021
32215
|
init_react_import();
|
32022
|
-
var
|
32216
|
+
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" };
|
32023
32217
|
|
32024
32218
|
// components/ComponentList/index.tsx
|
32025
|
-
var
|
32026
|
-
var
|
32219
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32220
|
+
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
32027
32221
|
var ComponentListItem = ({
|
32028
32222
|
name,
|
32029
32223
|
label,
|
32030
32224
|
index
|
32031
32225
|
}) => {
|
32032
|
-
const { overrides } = useAppContext();
|
32033
|
-
|
32226
|
+
const { overrides, config, globalPermissions, state } = useAppContext();
|
32227
|
+
const canInsert = getPermissions({
|
32228
|
+
type: name,
|
32229
|
+
config,
|
32230
|
+
globalPermissions: globalPermissions || {},
|
32231
|
+
appState: state
|
32232
|
+
}).insert;
|
32233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32234
|
+
Drawer.Item,
|
32235
|
+
{
|
32236
|
+
label,
|
32237
|
+
name,
|
32238
|
+
index,
|
32239
|
+
isDragDisabled: !canInsert,
|
32240
|
+
children: overrides.componentItem
|
32241
|
+
}
|
32242
|
+
);
|
32034
32243
|
};
|
32035
32244
|
var ComponentList = ({
|
32036
32245
|
children,
|
@@ -32039,11 +32248,11 @@ var ComponentList = ({
|
|
32039
32248
|
}) => {
|
32040
32249
|
const { config, state, setUi } = useAppContext();
|
32041
32250
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32042
|
-
return /* @__PURE__ */ (0,
|
32043
|
-
title && /* @__PURE__ */ (0,
|
32251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
|
32252
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
32044
32253
|
"button",
|
32045
32254
|
{
|
32046
|
-
className:
|
32255
|
+
className: getClassName22("title"),
|
32047
32256
|
onClick: () => setUi({
|
32048
32257
|
componentList: __spreadProps(__spreadValues({}, state.ui.componentList), {
|
32049
32258
|
[id]: __spreadProps(__spreadValues({}, state.ui.componentList[id]), {
|
@@ -32053,14 +32262,14 @@ var ComponentList = ({
|
|
32053
32262
|
}),
|
32054
32263
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32055
32264
|
children: [
|
32056
|
-
/* @__PURE__ */ (0,
|
32057
|
-
/* @__PURE__ */ (0,
|
32265
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: title }),
|
32266
|
+
/* @__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 }) })
|
32058
32267
|
]
|
32059
32268
|
}
|
32060
32269
|
),
|
32061
|
-
/* @__PURE__ */ (0,
|
32270
|
+
/* @__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) => {
|
32062
32271
|
var _a;
|
32063
|
-
return /* @__PURE__ */ (0,
|
32272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32064
32273
|
ComponentListItem,
|
32065
32274
|
{
|
32066
32275
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -32075,10 +32284,10 @@ var ComponentList = ({
|
|
32075
32284
|
ComponentList.Item = ComponentListItem;
|
32076
32285
|
|
32077
32286
|
// lib/use-component-list.tsx
|
32078
|
-
var
|
32287
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32079
32288
|
var useComponentList = (config, ui) => {
|
32080
|
-
const [componentList, setComponentList] = (0,
|
32081
|
-
(0,
|
32289
|
+
const [componentList, setComponentList] = (0, import_react22.useState)();
|
32290
|
+
(0, import_react22.useEffect)(() => {
|
32082
32291
|
var _a, _b, _c;
|
32083
32292
|
if (Object.keys(ui.componentList).length > 0) {
|
32084
32293
|
const matchedComponents = [];
|
@@ -32088,7 +32297,7 @@ var useComponentList = (config, ui) => {
|
|
32088
32297
|
if (category.visible === false || !category.components) {
|
32089
32298
|
return null;
|
32090
32299
|
}
|
32091
|
-
return /* @__PURE__ */ (0,
|
32300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32092
32301
|
ComponentList,
|
32093
32302
|
{
|
32094
32303
|
id: categoryKey,
|
@@ -32097,7 +32306,7 @@ var useComponentList = (config, ui) => {
|
|
32097
32306
|
var _a2;
|
32098
32307
|
matchedComponents.push(componentName);
|
32099
32308
|
const componentConf = config.components[componentName] || {};
|
32100
|
-
return /* @__PURE__ */ (0,
|
32309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32101
32310
|
ComponentList.Item,
|
32102
32311
|
{
|
32103
32312
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -32117,7 +32326,7 @@ var useComponentList = (config, ui) => {
|
|
32117
32326
|
);
|
32118
32327
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32119
32328
|
_componentList.push(
|
32120
|
-
/* @__PURE__ */ (0,
|
32329
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32121
32330
|
ComponentList,
|
32122
32331
|
{
|
32123
32332
|
id: "other",
|
@@ -32125,7 +32334,7 @@ var useComponentList = (config, ui) => {
|
|
32125
32334
|
children: remainingComponents.map((componentName, i) => {
|
32126
32335
|
var _a2;
|
32127
32336
|
const componentConf = config.components[componentName] || {};
|
32128
|
-
return /* @__PURE__ */ (0,
|
32337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32129
32338
|
ComponentList.Item,
|
32130
32339
|
{
|
32131
32340
|
name: componentName,
|
@@ -32147,25 +32356,25 @@ var useComponentList = (config, ui) => {
|
|
32147
32356
|
};
|
32148
32357
|
|
32149
32358
|
// components/Puck/components/Components/index.tsx
|
32150
|
-
var
|
32151
|
-
var
|
32359
|
+
var import_react23 = require("react");
|
32360
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32152
32361
|
var Components = () => {
|
32153
32362
|
const { config, state, overrides } = useAppContext();
|
32154
32363
|
const componentList = useComponentList(config, state.ui);
|
32155
|
-
const Wrapper = (0,
|
32156
|
-
return /* @__PURE__ */ (0,
|
32364
|
+
const Wrapper = (0, import_react23.useMemo)(() => overrides.components || "div", [overrides]);
|
32365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentList, { id: "all" }) });
|
32157
32366
|
};
|
32158
32367
|
|
32159
32368
|
// components/Puck/components/Preview/index.tsx
|
32160
32369
|
init_react_import();
|
32161
|
-
var
|
32370
|
+
var import_react25 = require("react");
|
32162
32371
|
|
32163
32372
|
// components/AutoFrame/index.tsx
|
32164
32373
|
init_react_import();
|
32165
|
-
var
|
32374
|
+
var import_react24 = __toESM(require("react"));
|
32166
32375
|
var import_react_frame_component = __toESM(require("react-frame-component"));
|
32167
32376
|
var import_object_hash = __toESM(require("object-hash"));
|
32168
|
-
var
|
32377
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
32169
32378
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
32170
32379
|
var collectStyles = (doc) => {
|
32171
32380
|
const collected = [];
|
@@ -32208,7 +32417,7 @@ var CopyHostStyles = ({
|
|
32208
32417
|
onStylesLoaded = () => null
|
32209
32418
|
}) => {
|
32210
32419
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
32211
|
-
(0,
|
32420
|
+
(0, import_react24.useEffect)(() => {
|
32212
32421
|
if (!win || !doc) {
|
32213
32422
|
return () => {
|
32214
32423
|
};
|
@@ -32365,12 +32574,12 @@ var CopyHostStyles = ({
|
|
32365
32574
|
observer.disconnect();
|
32366
32575
|
};
|
32367
32576
|
}, []);
|
32368
|
-
return /* @__PURE__ */ (0,
|
32577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
|
32369
32578
|
};
|
32370
|
-
var AutoFrameComponent =
|
32579
|
+
var AutoFrameComponent = import_react24.default.forwardRef(
|
32371
32580
|
function(_a, ref) {
|
32372
32581
|
var _b = _a, { children, debug, onStylesLoaded } = _b, props = __objRest(_b, ["children", "debug", "onStylesLoaded"]);
|
32373
|
-
return /* @__PURE__ */ (0,
|
32582
|
+
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 }) }));
|
32374
32583
|
}
|
32375
32584
|
);
|
32376
32585
|
AutoFrameComponent.displayName = "AutoFrameComponent";
|
@@ -32378,14 +32587,15 @@ var AutoFrame_default = AutoFrameComponent;
|
|
32378
32587
|
|
32379
32588
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
32380
32589
|
init_react_import();
|
32381
|
-
var
|
32590
|
+
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
32382
32591
|
|
32383
32592
|
// components/Puck/components/Preview/index.tsx
|
32384
|
-
var
|
32385
|
-
var
|
32593
|
+
var import_react_frame_component2 = require("react-frame-component");
|
32594
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
32595
|
+
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
32386
32596
|
var Preview = ({ id = "puck-preview" }) => {
|
32387
|
-
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32388
|
-
const Page = (0,
|
32597
|
+
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
32598
|
+
const Page = (0, import_react25.useCallback)(
|
32389
32599
|
(pageProps) => {
|
32390
32600
|
var _a, _b;
|
32391
32601
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
|
@@ -32394,33 +32604,36 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32394
32604
|
editMode: true,
|
32395
32605
|
// DEPRECATED
|
32396
32606
|
puck: { renderDropZone: DropZone, isEditing: true }
|
32397
|
-
})) : /* @__PURE__ */ (0,
|
32607
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
32398
32608
|
},
|
32399
32609
|
[config.root]
|
32400
32610
|
);
|
32611
|
+
const Frame2 = (0, import_react25.useMemo)(() => overrides.iframe || "div", [overrides]);
|
32401
32612
|
const rootProps = state.data.root.props || state.data.root;
|
32402
|
-
const ref = (0,
|
32403
|
-
return /* @__PURE__ */ (0,
|
32613
|
+
const ref = (0, import_react25.useRef)(null);
|
32614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
32404
32615
|
"div",
|
32405
32616
|
{
|
32406
|
-
className:
|
32617
|
+
className: getClassName23(),
|
32407
32618
|
id,
|
32408
32619
|
onClick: () => {
|
32409
32620
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32410
32621
|
},
|
32411
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
32622
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
32412
32623
|
AutoFrame_default,
|
32413
32624
|
{
|
32414
32625
|
id: "preview-frame",
|
32415
|
-
className:
|
32626
|
+
className: getClassName23("frame"),
|
32416
32627
|
"data-rfd-iframe": true,
|
32417
32628
|
ref,
|
32418
32629
|
onStylesLoaded: () => {
|
32419
32630
|
setStatus("READY");
|
32420
32631
|
},
|
32421
|
-
children: /* @__PURE__ */ (0,
|
32632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_frame_component2.FrameContextConsumer, { children: ({ document: document2 }) => {
|
32633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame2, { document: document2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) })) });
|
32634
|
+
} })
|
32422
32635
|
}
|
32423
|
-
) : /* @__PURE__ */ (0,
|
32636
|
+
) : /* @__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 }) })) })
|
32424
32637
|
}
|
32425
32638
|
);
|
32426
32639
|
};
|
@@ -32454,7 +32667,7 @@ init_react_import();
|
|
32454
32667
|
|
32455
32668
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
32456
32669
|
init_react_import();
|
32457
|
-
var
|
32670
|
+
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" };
|
32458
32671
|
|
32459
32672
|
// lib/scroll-into-view.ts
|
32460
32673
|
init_react_import();
|
@@ -32468,7 +32681,7 @@ var scrollIntoView = (el) => {
|
|
32468
32681
|
};
|
32469
32682
|
|
32470
32683
|
// components/LayerTree/index.tsx
|
32471
|
-
var
|
32684
|
+
var import_react26 = require("react");
|
32472
32685
|
|
32473
32686
|
// lib/is-child-of-zone.ts
|
32474
32687
|
init_react_import();
|
@@ -32482,9 +32695,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32482
32695
|
};
|
32483
32696
|
|
32484
32697
|
// components/LayerTree/index.tsx
|
32485
|
-
var
|
32486
|
-
var
|
32487
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
32698
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
32699
|
+
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
32700
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
32488
32701
|
var LayerTree = ({
|
32489
32702
|
data,
|
32490
32703
|
config,
|
@@ -32495,15 +32708,15 @@ var LayerTree = ({
|
|
32495
32708
|
label
|
32496
32709
|
}) => {
|
32497
32710
|
const zones = data.zones || {};
|
32498
|
-
const ctx = (0,
|
32499
|
-
return /* @__PURE__ */ (0,
|
32500
|
-
label && /* @__PURE__ */ (0,
|
32501
|
-
/* @__PURE__ */ (0,
|
32711
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
32713
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
32714
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
32502
32715
|
" ",
|
32503
32716
|
label
|
32504
32717
|
] }),
|
32505
|
-
/* @__PURE__ */ (0,
|
32506
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32718
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
32719
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
32507
32720
|
zoneContent.map((item, i) => {
|
32508
32721
|
var _a;
|
32509
32722
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32521,7 +32734,7 @@ var LayerTree = ({
|
|
32521
32734
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32522
32735
|
const componentConfig = config.components[item.type];
|
32523
32736
|
const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
|
32524
|
-
return /* @__PURE__ */ (0,
|
32737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
32525
32738
|
"li",
|
32526
32739
|
{
|
32527
32740
|
className: getClassNameLayer({
|
@@ -32531,7 +32744,7 @@ var LayerTree = ({
|
|
32531
32744
|
childIsSelected
|
32532
32745
|
}),
|
32533
32746
|
children: [
|
32534
|
-
/* @__PURE__ */ (0,
|
32747
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
32535
32748
|
"button",
|
32536
32749
|
{
|
32537
32750
|
className: getClassNameLayer("clickable"),
|
@@ -32563,22 +32776,22 @@ var LayerTree = ({
|
|
32563
32776
|
setHoveringComponent(null);
|
32564
32777
|
},
|
32565
32778
|
children: [
|
32566
|
-
containsZone && /* @__PURE__ */ (0,
|
32779
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32567
32780
|
"div",
|
32568
32781
|
{
|
32569
32782
|
className: getClassNameLayer("chevron"),
|
32570
32783
|
title: isSelected ? "Collapse" : "Expand",
|
32571
|
-
children: /* @__PURE__ */ (0,
|
32784
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
32572
32785
|
}
|
32573
32786
|
),
|
32574
|
-
/* @__PURE__ */ (0,
|
32575
|
-
/* @__PURE__ */ (0,
|
32576
|
-
/* @__PURE__ */ (0,
|
32787
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
32788
|
+
/* @__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" }) }),
|
32789
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
32577
32790
|
] })
|
32578
32791
|
]
|
32579
32792
|
}
|
32580
32793
|
) }),
|
32581
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
32794
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32582
32795
|
LayerTree,
|
32583
32796
|
{
|
32584
32797
|
config,
|
@@ -32600,13 +32813,13 @@ var LayerTree = ({
|
|
32600
32813
|
};
|
32601
32814
|
|
32602
32815
|
// components/Puck/components/Outline/index.tsx
|
32603
|
-
var
|
32604
|
-
var
|
32816
|
+
var import_react27 = require("react");
|
32817
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
32605
32818
|
var Outline = () => {
|
32606
32819
|
const { dispatch, state, overrides, config } = useAppContext();
|
32607
32820
|
const { data, ui } = state;
|
32608
32821
|
const { itemSelector } = ui;
|
32609
|
-
const setItemSelector = (0,
|
32822
|
+
const setItemSelector = (0, import_react27.useCallback)(
|
32610
32823
|
(newItemSelector) => {
|
32611
32824
|
dispatch({
|
32612
32825
|
type: "setUi",
|
@@ -32615,9 +32828,9 @@ var Outline = () => {
|
|
32615
32828
|
},
|
32616
32829
|
[]
|
32617
32830
|
);
|
32618
|
-
const Wrapper = (0,
|
32619
|
-
return /* @__PURE__ */ (0,
|
32620
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
32831
|
+
const Wrapper = (0, import_react27.useMemo)(() => overrides.outline || "div", [overrides]);
|
32832
|
+
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: [
|
32833
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
32621
32834
|
LayerTree,
|
32622
32835
|
{
|
32623
32836
|
config,
|
@@ -32630,7 +32843,7 @@ var Outline = () => {
|
|
32630
32843
|
),
|
32631
32844
|
Object.entries(findZonesForArea(data, "root")).map(
|
32632
32845
|
([zoneKey, zone]) => {
|
32633
|
-
return /* @__PURE__ */ (0,
|
32846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
32634
32847
|
LayerTree,
|
32635
32848
|
{
|
32636
32849
|
config,
|
@@ -32648,37 +32861,6 @@ var Outline = () => {
|
|
32648
32861
|
] }) }) });
|
32649
32862
|
};
|
32650
32863
|
|
32651
|
-
// lib/load-overrides.ts
|
32652
|
-
init_react_import();
|
32653
|
-
var loadOverrides = ({
|
32654
|
-
overrides,
|
32655
|
-
plugins
|
32656
|
-
}) => {
|
32657
|
-
const collected = __spreadValues({}, overrides);
|
32658
|
-
plugins.forEach((plugin) => {
|
32659
|
-
Object.keys(plugin.overrides).forEach((overridesType) => {
|
32660
|
-
if (overridesType === "fieldTypes") {
|
32661
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
32662
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
32663
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
32664
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
32665
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
32666
|
-
children: childNode2 ? childNode2(props) : props.children
|
32667
|
-
}));
|
32668
|
-
collected.fieldTypes[fieldType] = Comp2;
|
32669
|
-
});
|
32670
|
-
return;
|
32671
|
-
}
|
32672
|
-
const childNode = collected[overridesType];
|
32673
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
32674
|
-
children: childNode ? childNode(props) : props.children
|
32675
|
-
}));
|
32676
|
-
collected[overridesType] = Comp;
|
32677
|
-
});
|
32678
|
-
});
|
32679
|
-
return collected;
|
32680
|
-
};
|
32681
|
-
|
32682
32864
|
// lib/use-puck-history.ts
|
32683
32865
|
init_react_import();
|
32684
32866
|
var import_react_hotkeys_hook = require("react-hotkeys-hook");
|
@@ -32735,19 +32917,19 @@ function usePuckHistory({
|
|
32735
32917
|
|
32736
32918
|
// lib/use-history-store.ts
|
32737
32919
|
init_react_import();
|
32738
|
-
var
|
32920
|
+
var import_react28 = require("react");
|
32739
32921
|
var import_use_debounce3 = require("use-debounce");
|
32740
32922
|
var EMPTY_HISTORY_INDEX = -1;
|
32741
32923
|
function useHistoryStore(initialHistory) {
|
32742
32924
|
var _a, _b;
|
32743
|
-
const [histories, setHistories] = (0,
|
32925
|
+
const [histories, setHistories] = (0, import_react28.useState)(
|
32744
32926
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
32745
32927
|
);
|
32746
32928
|
const updateHistories = (histories2) => {
|
32747
32929
|
setHistories(histories2);
|
32748
32930
|
setIndex(histories2.length - 1);
|
32749
32931
|
};
|
32750
|
-
const [index, setIndex] = (0,
|
32932
|
+
const [index, setIndex] = (0, import_react28.useState)(
|
32751
32933
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
32752
32934
|
);
|
32753
32935
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -32907,25 +33089,25 @@ var getBox = function getBox2(el) {
|
|
32907
33089
|
};
|
32908
33090
|
|
32909
33091
|
// components/Puck/components/Canvas/index.tsx
|
32910
|
-
var
|
33092
|
+
var import_react30 = require("react");
|
32911
33093
|
|
32912
33094
|
// components/ViewportControls/index.tsx
|
32913
33095
|
init_react_import();
|
32914
|
-
var
|
33096
|
+
var import_react29 = require("react");
|
32915
33097
|
|
32916
33098
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
32917
33099
|
init_react_import();
|
32918
|
-
var
|
33100
|
+
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" };
|
32919
33101
|
|
32920
33102
|
// components/ViewportControls/index.tsx
|
32921
|
-
var
|
33103
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
32922
33104
|
var icons = {
|
32923
|
-
Smartphone: /* @__PURE__ */ (0,
|
32924
|
-
Tablet: /* @__PURE__ */ (0,
|
32925
|
-
Monitor: /* @__PURE__ */ (0,
|
33105
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
|
33106
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
|
33107
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
|
32926
33108
|
};
|
32927
|
-
var
|
32928
|
-
var getClassNameButton = get_class_name_factory_default("ViewportButton",
|
33109
|
+
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
33110
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
32929
33111
|
var ViewportButton = ({
|
32930
33112
|
children,
|
32931
33113
|
height = "auto",
|
@@ -32934,11 +33116,11 @@ var ViewportButton = ({
|
|
32934
33116
|
onClick
|
32935
33117
|
}) => {
|
32936
33118
|
const { state } = useAppContext();
|
32937
|
-
const [isActive, setIsActive] = (0,
|
32938
|
-
(0,
|
33119
|
+
const [isActive, setIsActive] = (0, import_react29.useState)(false);
|
33120
|
+
(0, import_react29.useEffect)(() => {
|
32939
33121
|
setIsActive(width === state.ui.viewports.current.width);
|
32940
33122
|
}, [width, state.ui.viewports.current.width]);
|
32941
|
-
return /* @__PURE__ */ (0,
|
33123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32942
33124
|
IconButton,
|
32943
33125
|
{
|
32944
33126
|
title,
|
@@ -32947,7 +33129,7 @@ var ViewportButton = ({
|
|
32947
33129
|
e.stopPropagation();
|
32948
33130
|
onClick({ width, height });
|
32949
33131
|
},
|
32950
|
-
children: /* @__PURE__ */ (0,
|
33132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
32951
33133
|
}
|
32952
33134
|
) });
|
32953
33135
|
};
|
@@ -32971,7 +33153,7 @@ var ViewportControls = ({
|
|
32971
33153
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
32972
33154
|
(option) => option.value === autoZoom
|
32973
33155
|
);
|
32974
|
-
const zoomOptions = (0,
|
33156
|
+
const zoomOptions = (0, import_react29.useMemo)(
|
32975
33157
|
() => [
|
32976
33158
|
...defaultZoomOptions,
|
32977
33159
|
...defaultsContainAutoZoom ? [] : [
|
@@ -32983,8 +33165,8 @@ var ViewportControls = ({
|
|
32983
33165
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
32984
33166
|
[autoZoom]
|
32985
33167
|
);
|
32986
|
-
return /* @__PURE__ */ (0,
|
32987
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
33168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
33169
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32988
33170
|
ViewportButton,
|
32989
33171
|
{
|
32990
33172
|
height: viewport.height,
|
@@ -32995,8 +33177,8 @@ var ViewportControls = ({
|
|
32995
33177
|
},
|
32996
33178
|
i
|
32997
33179
|
)),
|
32998
|
-
/* @__PURE__ */ (0,
|
32999
|
-
/* @__PURE__ */ (0,
|
33180
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
33181
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33000
33182
|
IconButton,
|
33001
33183
|
{
|
33002
33184
|
title: "Zoom viewport out",
|
@@ -33010,10 +33192,10 @@ var ViewportControls = ({
|
|
33010
33192
|
)].value
|
33011
33193
|
);
|
33012
33194
|
},
|
33013
|
-
children: /* @__PURE__ */ (0,
|
33195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
33014
33196
|
}
|
33015
33197
|
),
|
33016
|
-
/* @__PURE__ */ (0,
|
33198
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33017
33199
|
IconButton,
|
33018
33200
|
{
|
33019
33201
|
title: "Zoom viewport in",
|
@@ -33027,19 +33209,19 @@ var ViewportControls = ({
|
|
33027
33209
|
)].value
|
33028
33210
|
);
|
33029
33211
|
},
|
33030
|
-
children: /* @__PURE__ */ (0,
|
33212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
33031
33213
|
}
|
33032
33214
|
),
|
33033
|
-
/* @__PURE__ */ (0,
|
33034
|
-
/* @__PURE__ */ (0,
|
33215
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
33216
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33035
33217
|
"select",
|
33036
33218
|
{
|
33037
|
-
className:
|
33219
|
+
className: getClassName25("zoomSelect"),
|
33038
33220
|
value: zoom.toString(),
|
33039
33221
|
onChange: (e) => {
|
33040
33222
|
onZoom(parseFloat(e.currentTarget.value));
|
33041
33223
|
},
|
33042
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
33224
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33043
33225
|
"option",
|
33044
33226
|
{
|
33045
33227
|
value: option.value,
|
@@ -33054,7 +33236,7 @@ var ViewportControls = ({
|
|
33054
33236
|
|
33055
33237
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
33056
33238
|
init_react_import();
|
33057
|
-
var
|
33239
|
+
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" };
|
33058
33240
|
|
33059
33241
|
// lib/get-zoom-config.ts
|
33060
33242
|
init_react_import();
|
@@ -33087,24 +33269,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
33087
33269
|
};
|
33088
33270
|
|
33089
33271
|
// components/Puck/components/Canvas/index.tsx
|
33090
|
-
var
|
33091
|
-
var
|
33272
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
33273
|
+
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
33092
33274
|
var ZOOM_ON_CHANGE = true;
|
33093
33275
|
var Canvas = () => {
|
33094
33276
|
const { status, iframe } = useAppContext();
|
33095
33277
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33096
33278
|
const { ui } = state;
|
33097
|
-
const frameRef = (0,
|
33098
|
-
const [showTransition, setShowTransition] = (0,
|
33099
|
-
const defaultRender = (0,
|
33100
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
33279
|
+
const frameRef = (0, import_react30.useRef)(null);
|
33280
|
+
const [showTransition, setShowTransition] = (0, import_react30.useState)(false);
|
33281
|
+
const defaultRender = (0, import_react30.useMemo)(() => {
|
33282
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
33101
33283
|
return PuckDefault;
|
33102
33284
|
}, []);
|
33103
|
-
const CustomPreview = (0,
|
33285
|
+
const CustomPreview = (0, import_react30.useMemo)(
|
33104
33286
|
() => overrides.preview || defaultRender,
|
33105
33287
|
[overrides]
|
33106
33288
|
);
|
33107
|
-
const getFrameDimensions = (0,
|
33289
|
+
const getFrameDimensions = (0, import_react30.useCallback)(() => {
|
33108
33290
|
if (frameRef.current) {
|
33109
33291
|
const frame = frameRef.current;
|
33110
33292
|
const box = getBox(frame);
|
@@ -33112,7 +33294,7 @@ var Canvas = () => {
|
|
33112
33294
|
}
|
33113
33295
|
return { width: 0, height: 0 };
|
33114
33296
|
}, [frameRef]);
|
33115
|
-
const resetAutoZoom = (0,
|
33297
|
+
const resetAutoZoom = (0, import_react30.useCallback)(
|
33116
33298
|
(ui2 = state.ui) => {
|
33117
33299
|
if (frameRef.current) {
|
33118
33300
|
setZoomConfig(
|
@@ -33122,11 +33304,11 @@ var Canvas = () => {
|
|
33122
33304
|
},
|
33123
33305
|
[frameRef, zoomConfig, state.ui]
|
33124
33306
|
);
|
33125
|
-
(0,
|
33307
|
+
(0, import_react30.useEffect)(() => {
|
33126
33308
|
setShowTransition(false);
|
33127
33309
|
resetAutoZoom();
|
33128
33310
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33129
|
-
(0,
|
33311
|
+
(0, import_react30.useEffect)(() => {
|
33130
33312
|
const { height: frameHeight } = getFrameDimensions();
|
33131
33313
|
if (ui.viewports.current.height === "auto") {
|
33132
33314
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -33134,7 +33316,7 @@ var Canvas = () => {
|
|
33134
33316
|
}));
|
33135
33317
|
}
|
33136
33318
|
}, [zoomConfig.zoom]);
|
33137
|
-
(0,
|
33319
|
+
(0, import_react30.useEffect)(() => {
|
33138
33320
|
const observer = new ResizeObserver(() => {
|
33139
33321
|
setShowTransition(false);
|
33140
33322
|
resetAutoZoom();
|
@@ -33146,10 +33328,10 @@ var Canvas = () => {
|
|
33146
33328
|
observer.disconnect();
|
33147
33329
|
};
|
33148
33330
|
}, []);
|
33149
|
-
return /* @__PURE__ */ (0,
|
33331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
33150
33332
|
"div",
|
33151
33333
|
{
|
33152
|
-
className:
|
33334
|
+
className: getClassName26({
|
33153
33335
|
ready: status === "READY" || !iframe.enabled
|
33154
33336
|
}),
|
33155
33337
|
onClick: () => dispatch({
|
@@ -33158,7 +33340,7 @@ var Canvas = () => {
|
|
33158
33340
|
recordHistory: true
|
33159
33341
|
}),
|
33160
33342
|
children: [
|
33161
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
33343
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
33162
33344
|
ViewportControls,
|
33163
33345
|
{
|
33164
33346
|
autoZoom: zoomConfig.autoZoom,
|
@@ -33183,10 +33365,10 @@ var Canvas = () => {
|
|
33183
33365
|
}
|
33184
33366
|
}
|
33185
33367
|
) }),
|
33186
|
-
/* @__PURE__ */ (0,
|
33368
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
33187
33369
|
"div",
|
33188
33370
|
{
|
33189
|
-
className:
|
33371
|
+
className: getClassName26("root"),
|
33190
33372
|
style: {
|
33191
33373
|
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
33192
33374
|
height: zoomConfig.rootHeight,
|
@@ -33195,7 +33377,7 @@ var Canvas = () => {
|
|
33195
33377
|
overflow: iframe.enabled ? void 0 : "auto"
|
33196
33378
|
},
|
33197
33379
|
suppressHydrationWarning: true,
|
33198
|
-
children: /* @__PURE__ */ (0,
|
33380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
|
33199
33381
|
}
|
33200
33382
|
) })
|
33201
33383
|
]
|
@@ -33203,10 +33385,42 @@ var Canvas = () => {
|
|
33203
33385
|
);
|
33204
33386
|
};
|
33205
33387
|
|
33388
|
+
// lib/insert-component.ts
|
33389
|
+
init_react_import();
|
33390
|
+
var insertComponent = (componentType, zone, index, {
|
33391
|
+
config,
|
33392
|
+
dispatch,
|
33393
|
+
resolveData,
|
33394
|
+
state
|
33395
|
+
}) => {
|
33396
|
+
const id = generateId(componentType);
|
33397
|
+
const insertActionData = {
|
33398
|
+
type: "insert",
|
33399
|
+
componentType,
|
33400
|
+
destinationIndex: index,
|
33401
|
+
destinationZone: zone,
|
33402
|
+
id
|
33403
|
+
};
|
33404
|
+
const insertedData = insertAction(state.data, insertActionData, config);
|
33405
|
+
dispatch(__spreadProps(__spreadValues({}, insertActionData), {
|
33406
|
+
// Dispatch insert rather set, as user's may rely on this via onAction
|
33407
|
+
recordHistory: false
|
33408
|
+
}));
|
33409
|
+
const itemSelector = {
|
33410
|
+
index,
|
33411
|
+
zone
|
33412
|
+
};
|
33413
|
+
dispatch({ type: "setUi", ui: { itemSelector } });
|
33414
|
+
resolveData({
|
33415
|
+
data: insertedData,
|
33416
|
+
ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector })
|
33417
|
+
});
|
33418
|
+
};
|
33419
|
+
|
33206
33420
|
// components/Puck/index.tsx
|
33207
|
-
var
|
33208
|
-
var
|
33209
|
-
var getLayoutClassName = get_class_name_factory_default("PuckLayout",
|
33421
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
33422
|
+
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
33423
|
+
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
33210
33424
|
function Puck({
|
33211
33425
|
children,
|
33212
33426
|
config,
|
@@ -33215,6 +33429,7 @@ function Puck({
|
|
33215
33429
|
onChange,
|
33216
33430
|
onPublish,
|
33217
33431
|
onAction,
|
33432
|
+
permissions = {},
|
33218
33433
|
plugins = [],
|
33219
33434
|
overrides = {},
|
33220
33435
|
renderHeader,
|
@@ -33230,10 +33445,10 @@ function Puck({
|
|
33230
33445
|
}) {
|
33231
33446
|
var _a;
|
33232
33447
|
const historyStore = useHistoryStore(initialHistory);
|
33233
|
-
const [reducer] = (0,
|
33448
|
+
const [reducer] = (0, import_react31.useState)(
|
33234
33449
|
() => createReducer({ config, record: historyStore.record, onAction })
|
33235
33450
|
);
|
33236
|
-
const [initialAppState] = (0,
|
33451
|
+
const [initialAppState] = (0, import_react31.useState)(() => {
|
33237
33452
|
var _a2, _b, _c, _d, _e, _f, _g;
|
33238
33453
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33239
33454
|
let clientUiState = {};
|
@@ -33291,7 +33506,7 @@ function Puck({
|
|
33291
33506
|
})
|
33292
33507
|
});
|
33293
33508
|
});
|
33294
|
-
const [appState, dispatch] = (0,
|
33509
|
+
const [appState, dispatch] = (0, import_react31.useReducer)(
|
33295
33510
|
reducer,
|
33296
33511
|
flushZones(initialAppState)
|
33297
33512
|
);
|
@@ -33302,9 +33517,9 @@ function Puck({
|
|
33302
33517
|
config,
|
33303
33518
|
dispatch
|
33304
33519
|
);
|
33305
|
-
const [menuOpen, setMenuOpen] = (0,
|
33520
|
+
const [menuOpen, setMenuOpen] = (0, import_react31.useState)(false);
|
33306
33521
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
33307
|
-
const setItemSelector = (0,
|
33522
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
33308
33523
|
(newItemSelector) => {
|
33309
33524
|
if (newItemSelector === itemSelector) return;
|
33310
33525
|
dispatch({
|
@@ -33316,13 +33531,13 @@ function Puck({
|
|
33316
33531
|
[itemSelector]
|
33317
33532
|
);
|
33318
33533
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
33319
|
-
(0,
|
33534
|
+
(0, import_react31.useEffect)(() => {
|
33320
33535
|
if (onChange) onChange(data);
|
33321
33536
|
}, [data]);
|
33322
33537
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
33323
|
-
const [draggedItem, setDraggedItem] = (0,
|
33538
|
+
const [draggedItem, setDraggedItem] = (0, import_react31.useState)();
|
33324
33539
|
const rootProps = data.root.props || data.root;
|
33325
|
-
const toggleSidebars = (0,
|
33540
|
+
const toggleSidebars = (0, import_react31.useCallback)(
|
33326
33541
|
(sidebar) => {
|
33327
33542
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
33328
33543
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -33336,7 +33551,7 @@ function Puck({
|
|
33336
33551
|
},
|
33337
33552
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
33338
33553
|
);
|
33339
|
-
(0,
|
33554
|
+
(0, import_react31.useEffect)(() => {
|
33340
33555
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
33341
33556
|
dispatch({
|
33342
33557
|
type: "setUi",
|
@@ -33359,11 +33574,7 @@ function Puck({
|
|
33359
33574
|
window.removeEventListener("resize", handleResize);
|
33360
33575
|
};
|
33361
33576
|
}, []);
|
33362
|
-
const
|
33363
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: children2 });
|
33364
|
-
return PuckDefault;
|
33365
|
-
}, []);
|
33366
|
-
const defaultHeaderRender = (0, import_react30.useMemo)(() => {
|
33577
|
+
const defaultHeaderRender = (0, import_react31.useMemo)(() => {
|
33367
33578
|
if (renderHeader) {
|
33368
33579
|
console.warn(
|
33369
33580
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -33371,48 +33582,49 @@ function Puck({
|
|
33371
33582
|
const RenderHeader = (_a2) => {
|
33372
33583
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
33373
33584
|
const Comp = renderHeader;
|
33374
|
-
return /* @__PURE__ */ (0,
|
33585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
33375
33586
|
};
|
33376
33587
|
return RenderHeader;
|
33377
33588
|
}
|
33378
|
-
return
|
33589
|
+
return DefaultOverride;
|
33379
33590
|
}, [renderHeader]);
|
33380
|
-
const defaultHeaderActionsRender = (0,
|
33591
|
+
const defaultHeaderActionsRender = (0, import_react31.useMemo)(() => {
|
33381
33592
|
if (renderHeaderActions) {
|
33382
33593
|
console.warn(
|
33383
33594
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
33384
33595
|
);
|
33385
33596
|
const RenderHeader = (props) => {
|
33386
33597
|
const Comp = renderHeaderActions;
|
33387
|
-
return /* @__PURE__ */ (0,
|
33598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
33388
33599
|
};
|
33389
33600
|
return RenderHeader;
|
33390
33601
|
}
|
33391
|
-
return
|
33602
|
+
return DefaultOverride;
|
33392
33603
|
}, [renderHeader]);
|
33393
|
-
const loadedOverrides = (
|
33394
|
-
|
33395
|
-
|
33396
|
-
|
33397
|
-
|
33604
|
+
const loadedOverrides = useLoadedOverrides({
|
33605
|
+
overrides,
|
33606
|
+
plugins
|
33607
|
+
});
|
33608
|
+
const CustomPuck = (0, import_react31.useMemo)(
|
33609
|
+
() => loadedOverrides.puck || DefaultOverride,
|
33398
33610
|
[loadedOverrides]
|
33399
33611
|
);
|
33400
|
-
const CustomHeader = (0,
|
33612
|
+
const CustomHeader = (0, import_react31.useMemo)(
|
33401
33613
|
() => loadedOverrides.header || defaultHeaderRender,
|
33402
33614
|
[loadedOverrides]
|
33403
33615
|
);
|
33404
|
-
const CustomHeaderActions = (0,
|
33616
|
+
const CustomHeaderActions = (0, import_react31.useMemo)(
|
33405
33617
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
33406
33618
|
[loadedOverrides]
|
33407
33619
|
);
|
33408
|
-
const [mounted, setMounted] = (0,
|
33409
|
-
(0,
|
33620
|
+
const [mounted, setMounted] = (0, import_react31.useState)(false);
|
33621
|
+
(0, import_react31.useEffect)(() => {
|
33410
33622
|
setMounted(true);
|
33411
33623
|
}, []);
|
33412
33624
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
33413
33625
|
const selectedComponentLabel = selectedItem ? (_a = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a : selectedItem.type.toString() : "";
|
33414
|
-
return /* @__PURE__ */ (0,
|
33415
|
-
/* @__PURE__ */ (0,
|
33626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
33627
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33416
33628
|
AppProvider,
|
33417
33629
|
{
|
33418
33630
|
value: {
|
@@ -33425,9 +33637,16 @@ function Puck({
|
|
33425
33637
|
overrides: loadedOverrides,
|
33426
33638
|
history,
|
33427
33639
|
viewports,
|
33428
|
-
iframe
|
33640
|
+
iframe,
|
33641
|
+
globalPermissions: __spreadValues({
|
33642
|
+
delete: true,
|
33643
|
+
drag: true,
|
33644
|
+
duplicate: true,
|
33645
|
+
insert: true,
|
33646
|
+
edit: true
|
33647
|
+
}, permissions)
|
33429
33648
|
},
|
33430
|
-
children: /* @__PURE__ */ (0,
|
33649
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33431
33650
|
DragDropContext,
|
33432
33651
|
{
|
33433
33652
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -33448,16 +33667,12 @@ function Puck({
|
|
33448
33667
|
}
|
33449
33668
|
if (droppedItem.source.droppableId.startsWith("component-list") && droppedItem.destination) {
|
33450
33669
|
const [_, componentType] = droppedItem.draggableId.split("::");
|
33451
|
-
|
33452
|
-
|
33453
|
-
|
33454
|
-
|
33455
|
-
|
33456
|
-
|
33457
|
-
setItemSelector({
|
33458
|
-
index: droppedItem.destination.index,
|
33459
|
-
zone: droppedItem.destination.droppableId
|
33460
|
-
});
|
33670
|
+
insertComponent(
|
33671
|
+
componentType || droppedItem.draggableId,
|
33672
|
+
droppedItem.destination.droppableId,
|
33673
|
+
droppedItem.destination.index,
|
33674
|
+
{ config, dispatch, resolveData, state: appState }
|
33675
|
+
);
|
33461
33676
|
return;
|
33462
33677
|
} else {
|
33463
33678
|
const { source, destination } = droppedItem;
|
@@ -33483,7 +33698,7 @@ function Puck({
|
|
33483
33698
|
});
|
33484
33699
|
}
|
33485
33700
|
},
|
33486
|
-
children: /* @__PURE__ */ (0,
|
33701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33487
33702
|
DropZoneProvider,
|
33488
33703
|
{
|
33489
33704
|
value: {
|
@@ -33497,7 +33712,7 @@ function Puck({
|
|
33497
33712
|
mode: "edit",
|
33498
33713
|
areaId: "root"
|
33499
33714
|
},
|
33500
|
-
children: /* @__PURE__ */ (0,
|
33715
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33501
33716
|
"div",
|
33502
33717
|
{
|
33503
33718
|
className: getLayoutClassName({
|
@@ -33506,64 +33721,64 @@ function Puck({
|
|
33506
33721
|
mounted,
|
33507
33722
|
rightSideBarVisible
|
33508
33723
|
}),
|
33509
|
-
children: /* @__PURE__ */ (0,
|
33510
|
-
/* @__PURE__ */ (0,
|
33724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
33725
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33511
33726
|
CustomHeader,
|
33512
33727
|
{
|
33513
|
-
actions: /* @__PURE__ */ (0,
|
33728
|
+
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)(
|
33514
33729
|
Button,
|
33515
33730
|
{
|
33516
33731
|
onClick: () => {
|
33517
33732
|
onPublish && onPublish(data);
|
33518
33733
|
},
|
33519
|
-
icon: /* @__PURE__ */ (0,
|
33734
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
33520
33735
|
children: "Publish"
|
33521
33736
|
}
|
33522
33737
|
) }) }),
|
33523
|
-
children: /* @__PURE__ */ (0,
|
33524
|
-
/* @__PURE__ */ (0,
|
33525
|
-
/* @__PURE__ */ (0,
|
33738
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
33739
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
33740
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33526
33741
|
"div",
|
33527
33742
|
{
|
33528
33743
|
className: getLayoutClassName(
|
33529
33744
|
"leftSideBarToggle"
|
33530
33745
|
),
|
33531
|
-
children: /* @__PURE__ */ (0,
|
33746
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33532
33747
|
IconButton,
|
33533
33748
|
{
|
33534
33749
|
onClick: () => {
|
33535
33750
|
toggleSidebars("left");
|
33536
33751
|
},
|
33537
33752
|
title: "Toggle left sidebar",
|
33538
|
-
children: /* @__PURE__ */ (0,
|
33753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
33539
33754
|
}
|
33540
33755
|
)
|
33541
33756
|
}
|
33542
33757
|
),
|
33543
|
-
/* @__PURE__ */ (0,
|
33758
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33544
33759
|
"div",
|
33545
33760
|
{
|
33546
33761
|
className: getLayoutClassName(
|
33547
33762
|
"rightSideBarToggle"
|
33548
33763
|
),
|
33549
|
-
children: /* @__PURE__ */ (0,
|
33764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33550
33765
|
IconButton,
|
33551
33766
|
{
|
33552
33767
|
onClick: () => {
|
33553
33768
|
toggleSidebars("right");
|
33554
33769
|
},
|
33555
33770
|
title: "Toggle right sidebar",
|
33556
|
-
children: /* @__PURE__ */ (0,
|
33771
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
33557
33772
|
}
|
33558
33773
|
)
|
33559
33774
|
}
|
33560
33775
|
)
|
33561
33776
|
] }),
|
33562
|
-
/* @__PURE__ */ (0,
|
33777
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33563
33778
|
headerTitle || rootProps.title || "Page",
|
33564
|
-
headerPath && /* @__PURE__ */ (0,
|
33779
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
33565
33780
|
" ",
|
33566
|
-
/* @__PURE__ */ (0,
|
33781
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33567
33782
|
"code",
|
33568
33783
|
{
|
33569
33784
|
className: getLayoutClassName("headerPath"),
|
@@ -33572,18 +33787,18 @@ function Puck({
|
|
33572
33787
|
)
|
33573
33788
|
] })
|
33574
33789
|
] }) }),
|
33575
|
-
/* @__PURE__ */ (0,
|
33576
|
-
/* @__PURE__ */ (0,
|
33790
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
33791
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33577
33792
|
IconButton,
|
33578
33793
|
{
|
33579
33794
|
onClick: () => {
|
33580
33795
|
return setMenuOpen(!menuOpen);
|
33581
33796
|
},
|
33582
33797
|
title: "Toggle menu bar",
|
33583
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33798
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
33584
33799
|
}
|
33585
33800
|
) }),
|
33586
|
-
/* @__PURE__ */ (0,
|
33801
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33587
33802
|
MenuBar,
|
33588
33803
|
{
|
33589
33804
|
appState,
|
@@ -33591,13 +33806,13 @@ function Puck({
|
|
33591
33806
|
dispatch,
|
33592
33807
|
onPublish,
|
33593
33808
|
menuOpen,
|
33594
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33809
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33595
33810
|
Button,
|
33596
33811
|
{
|
33597
33812
|
onClick: () => {
|
33598
33813
|
onPublish && onPublish(data);
|
33599
33814
|
},
|
33600
|
-
icon: /* @__PURE__ */ (0,
|
33815
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
33601
33816
|
children: "Publish"
|
33602
33817
|
}
|
33603
33818
|
) }),
|
@@ -33608,19 +33823,19 @@ function Puck({
|
|
33608
33823
|
] }) })
|
33609
33824
|
}
|
33610
33825
|
),
|
33611
|
-
/* @__PURE__ */ (0,
|
33612
|
-
/* @__PURE__ */ (0,
|
33613
|
-
/* @__PURE__ */ (0,
|
33826
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
33827
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
|
33828
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
|
33614
33829
|
] }),
|
33615
|
-
/* @__PURE__ */ (0,
|
33616
|
-
/* @__PURE__ */ (0,
|
33830
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
|
33831
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33617
33832
|
SidebarSection,
|
33618
33833
|
{
|
33619
33834
|
noPadding: true,
|
33620
33835
|
noBorderTop: true,
|
33621
33836
|
showBreadcrumbs: true,
|
33622
33837
|
title: selectedItem ? selectedComponentLabel : "Page",
|
33623
|
-
children: /* @__PURE__ */ (0,
|
33838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
33624
33839
|
}
|
33625
33840
|
) })
|
33626
33841
|
] })
|
@@ -33632,7 +33847,7 @@ function Puck({
|
|
33632
33847
|
)
|
33633
33848
|
}
|
33634
33849
|
),
|
33635
|
-
/* @__PURE__ */ (0,
|
33850
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
33636
33851
|
] });
|
33637
33852
|
}
|
33638
33853
|
Puck.Components = Components;
|
@@ -33642,7 +33857,7 @@ Puck.Preview = Preview;
|
|
33642
33857
|
|
33643
33858
|
// components/Render/index.tsx
|
33644
33859
|
init_react_import();
|
33645
|
-
var
|
33860
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
33646
33861
|
function Render({
|
33647
33862
|
config,
|
33648
33863
|
data
|
@@ -33655,7 +33870,7 @@ function Render({
|
|
33655
33870
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
33656
33871
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33657
33872
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33658
|
-
return /* @__PURE__ */ (0,
|
33873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
33659
33874
|
config.root.render,
|
33660
33875
|
__spreadProps(__spreadValues({}, rootProps), {
|
33661
33876
|
puck: {
|
@@ -33665,11 +33880,11 @@ function Render({
|
|
33665
33880
|
title,
|
33666
33881
|
editMode: false,
|
33667
33882
|
id: "puck-root",
|
33668
|
-
children: /* @__PURE__ */ (0,
|
33883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId })
|
33669
33884
|
})
|
33670
33885
|
) });
|
33671
33886
|
}
|
33672
|
-
return /* @__PURE__ */ (0,
|
33887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId }) });
|
33673
33888
|
}
|
33674
33889
|
|
33675
33890
|
// lib/migrate.ts
|
@@ -33777,12 +33992,25 @@ var usePuck = () => {
|
|
33777
33992
|
config,
|
33778
33993
|
history,
|
33779
33994
|
dispatch,
|
33780
|
-
selectedItem
|
33995
|
+
selectedItem: currentItem,
|
33996
|
+
globalPermissions
|
33781
33997
|
} = useAppContext();
|
33782
33998
|
return {
|
33783
33999
|
appState,
|
33784
34000
|
config,
|
33785
34001
|
dispatch,
|
34002
|
+
getPermissions: ({
|
34003
|
+
item,
|
34004
|
+
type
|
34005
|
+
} = {}) => {
|
34006
|
+
return getPermissions({
|
34007
|
+
selectedItem: item || currentItem,
|
34008
|
+
type,
|
34009
|
+
globalPermissions: globalPermissions || {},
|
34010
|
+
config,
|
34011
|
+
appState
|
34012
|
+
});
|
34013
|
+
},
|
33786
34014
|
history: {
|
33787
34015
|
back: history.back,
|
33788
34016
|
forward: history.forward,
|
@@ -33794,11 +34022,13 @@ var usePuck = () => {
|
|
33794
34022
|
index: history.historyStore.index,
|
33795
34023
|
historyStore: history.historyStore
|
33796
34024
|
},
|
33797
|
-
selectedItem:
|
34025
|
+
selectedItem: currentItem || null
|
33798
34026
|
};
|
33799
34027
|
};
|
33800
34028
|
// Annotate the CommonJS export names for ESM import in node:
|
33801
34029
|
0 && (module.exports = {
|
34030
|
+
Action,
|
34031
|
+
ActionBar,
|
33802
34032
|
AutoField,
|
33803
34033
|
AutoFieldPrivate,
|
33804
34034
|
Button,
|