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