@measured/puck 0.16.0-canary.7c79787 → 0.16.0-canary.7cac376
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Config-VOJqVbHe.d.ts → Config-CkVFT1_w.d.ts} +15 -1
- package/dist/index.css +95 -78
- package/dist/index.d.ts +44 -6
- package/dist/index.js +772 -561
- package/dist/rsc.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -7536,7 +7536,7 @@ var require_react_dom_development = __commonJS({
|
|
7536
7536
|
var HostPortal = 4;
|
7537
7537
|
var HostComponent = 5;
|
7538
7538
|
var HostText = 6;
|
7539
|
-
var
|
7539
|
+
var Fragment20 = 7;
|
7540
7540
|
var Mode = 8;
|
7541
7541
|
var ContextConsumer = 9;
|
7542
7542
|
var ContextProvider = 10;
|
@@ -8692,7 +8692,7 @@ var require_react_dom_development = __commonJS({
|
|
8692
8692
|
return "DehydratedFragment";
|
8693
8693
|
case ForwardRef:
|
8694
8694
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
8695
|
-
case
|
8695
|
+
case Fragment20:
|
8696
8696
|
return "Fragment";
|
8697
8697
|
case HostComponent:
|
8698
8698
|
return type;
|
@@ -18343,7 +18343,7 @@ var require_react_dom_development = __commonJS({
|
|
18343
18343
|
}
|
18344
18344
|
}
|
18345
18345
|
function updateFragment2(returnFiber, current2, fragment, lanes, key) {
|
18346
|
-
if (current2 === null || current2.tag !==
|
18346
|
+
if (current2 === null || current2.tag !== Fragment20) {
|
18347
18347
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
18348
18348
|
created.return = returnFiber;
|
18349
18349
|
return created;
|
@@ -18746,7 +18746,7 @@ var require_react_dom_development = __commonJS({
|
|
18746
18746
|
if (child.key === key) {
|
18747
18747
|
var elementType = element.type;
|
18748
18748
|
if (elementType === REACT_FRAGMENT_TYPE) {
|
18749
|
-
if (child.tag ===
|
18749
|
+
if (child.tag === Fragment20) {
|
18750
18750
|
deleteRemainingChildren(returnFiber, child.sibling);
|
18751
18751
|
var existing = useFiber(child, element.props.children);
|
18752
18752
|
existing.return = returnFiber;
|
@@ -22921,7 +22921,7 @@ var require_react_dom_development = __commonJS({
|
|
22921
22921
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
22922
22922
|
return updateForwardRef(current2, workInProgress2, type, _resolvedProps2, renderLanes2);
|
22923
22923
|
}
|
22924
|
-
case
|
22924
|
+
case Fragment20:
|
22925
22925
|
return updateFragment(current2, workInProgress2, renderLanes2);
|
22926
22926
|
case Mode:
|
22927
22927
|
return updateMode(current2, workInProgress2, renderLanes2);
|
@@ -23193,7 +23193,7 @@ var require_react_dom_development = __commonJS({
|
|
23193
23193
|
case SimpleMemoComponent:
|
23194
23194
|
case FunctionComponent:
|
23195
23195
|
case ForwardRef:
|
23196
|
-
case
|
23196
|
+
case Fragment20:
|
23197
23197
|
case Mode:
|
23198
23198
|
case Profiler:
|
23199
23199
|
case ContextConsumer:
|
@@ -27444,7 +27444,7 @@ var require_react_dom_development = __commonJS({
|
|
27444
27444
|
return fiber;
|
27445
27445
|
}
|
27446
27446
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
27447
|
-
var fiber = createFiber(
|
27447
|
+
var fiber = createFiber(Fragment20, elements, key, mode);
|
27448
27448
|
fiber.lanes = lanes;
|
27449
27449
|
return fiber;
|
27450
27450
|
}
|
@@ -28567,6 +28567,8 @@ var require_react_dom = __commonJS({
|
|
28567
28567
|
// index.ts
|
28568
28568
|
var core_exports = {};
|
28569
28569
|
__export(core_exports, {
|
28570
|
+
Action: () => Action,
|
28571
|
+
ActionBar: () => ActionBar,
|
28570
28572
|
AutoField: () => AutoField,
|
28571
28573
|
AutoFieldPrivate: () => AutoFieldPrivate,
|
28572
28574
|
Button: () => Button,
|
@@ -28596,7 +28598,7 @@ init_react_import();
|
|
28596
28598
|
// types/Fields.ts
|
28597
28599
|
init_react_import();
|
28598
28600
|
|
28599
|
-
// components/
|
28601
|
+
// components/ActionBar/index.tsx
|
28600
28602
|
init_react_import();
|
28601
28603
|
|
28602
28604
|
// lib/get-class-name-factory.ts
|
@@ -28631,9 +28633,33 @@ var getClassNameFactory = (rootClass, styles, { baseClass = "" } = {}) => (optio
|
|
28631
28633
|
};
|
28632
28634
|
var get_class_name_factory_default = getClassNameFactory;
|
28633
28635
|
|
28636
|
+
// css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css#css-module
|
28637
|
+
init_react_import();
|
28638
|
+
var styles_module_default = { "ActionBarComponent": "_ActionBarComponent_8nyey_1", "ActionBarComponent-actionsLabel": "_ActionBarComponent-actionsLabel_8nyey_15", "ActionBarComponent-action": "_ActionBarComponent-action_8nyey_15" };
|
28639
|
+
|
28640
|
+
// components/ActionBar/index.tsx
|
28641
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
28642
|
+
var getClassName = get_class_name_factory_default("ActionBarComponent", styles_module_default);
|
28643
|
+
var ActionBar = ({
|
28644
|
+
label,
|
28645
|
+
children
|
28646
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: getClassName(), children: [
|
28647
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: getClassName("actionsLabel"), children: label }),
|
28648
|
+
children
|
28649
|
+
] });
|
28650
|
+
var Action = ({
|
28651
|
+
children,
|
28652
|
+
label,
|
28653
|
+
onClick
|
28654
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { className: getClassName("action"), onClick, title: label, children });
|
28655
|
+
ActionBar.Action = Action;
|
28656
|
+
|
28657
|
+
// components/AutoField/index.tsx
|
28658
|
+
init_react_import();
|
28659
|
+
|
28634
28660
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css#css-module
|
28635
28661
|
init_react_import();
|
28636
|
-
var
|
28662
|
+
var styles_module_default2 = { "Input": "_Input_3pq3z_1", "Input-label": "_Input-label_3pq3z_26", "Input-labelIcon": "_Input-labelIcon_3pq3z_35", "Input-disabledIcon": "_Input-disabledIcon_3pq3z_42", "Input-input": "_Input-input_3pq3z_47", "Input--readOnly": "_Input--readOnly_3pq3z_91", "Input-radioGroupItems": "_Input-radioGroupItems_3pq3z_102", "Input-radio": "_Input-radio_3pq3z_102", "Input-radioInner": "_Input-radioInner_3pq3z_119", "Input-radioInput": "_Input-radioInput_3pq3z_164" };
|
28637
28663
|
|
28638
28664
|
// components/AutoField/index.tsx
|
28639
28665
|
var import_react11 = require("react");
|
@@ -28646,7 +28672,7 @@ init_react_import();
|
|
28646
28672
|
|
28647
28673
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/fields/ArrayField/styles.module.css#css-module
|
28648
28674
|
init_react_import();
|
28649
|
-
var
|
28675
|
+
var styles_module_default3 = { "ArrayField": "_ArrayField_1go19_5", "ArrayField--isDraggingFrom": "_ArrayField--isDraggingFrom_1go19_13", "ArrayField-addButton": "_ArrayField-addButton_1go19_18", "ArrayField--hasItems": "_ArrayField--hasItems_1go19_33", "ArrayFieldItem": "_ArrayFieldItem_1go19_63", "ArrayFieldItem--isDragging": "_ArrayFieldItem--isDragging_1go19_71", "ArrayFieldItem--isExpanded": "_ArrayFieldItem--isExpanded_1go19_81", "ArrayFieldItem-summary": "_ArrayFieldItem-summary_1go19_97", "ArrayField--addDisabled": "_ArrayField--addDisabled_1go19_128", "ArrayFieldItem-body": "_ArrayFieldItem-body_1go19_164", "ArrayFieldItem-fieldset": "_ArrayFieldItem-fieldset_1go19_173", "ArrayFieldItem-rhs": "_ArrayFieldItem-rhs_1go19_181", "ArrayFieldItem-actions": "_ArrayFieldItem-actions_1go19_187" };
|
28650
28676
|
|
28651
28677
|
// ../../node_modules/lucide-react/dist/esm/lucide-react.js
|
28652
28678
|
init_react_import();
|
@@ -28958,11 +28984,11 @@ var replace = (list, index, newItem) => {
|
|
28958
28984
|
|
28959
28985
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Loader/styles.module.css#css-module
|
28960
28986
|
init_react_import();
|
28961
|
-
var
|
28987
|
+
var styles_module_default4 = { "Loader": "_Loader_nacdm_13", "loader-animation": "_loader-animation_nacdm_1" };
|
28962
28988
|
|
28963
28989
|
// components/Loader/index.tsx
|
28964
|
-
var
|
28965
|
-
var
|
28990
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
28991
|
+
var getClassName2 = get_class_name_factory_default("Loader", styles_module_default4);
|
28966
28992
|
var Loader = (_a) => {
|
28967
28993
|
var _b = _a, {
|
28968
28994
|
color,
|
@@ -28971,10 +28997,10 @@ var Loader = (_a) => {
|
|
28971
28997
|
"color",
|
28972
28998
|
"size"
|
28973
28999
|
]);
|
28974
|
-
return /* @__PURE__ */ (0,
|
29000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
28975
29001
|
"span",
|
28976
29002
|
__spreadValues({
|
28977
|
-
className:
|
29003
|
+
className: getClassName2(),
|
28978
29004
|
style: {
|
28979
29005
|
width: size,
|
28980
29006
|
height: size,
|
@@ -28986,8 +29012,8 @@ var Loader = (_a) => {
|
|
28986
29012
|
};
|
28987
29013
|
|
28988
29014
|
// components/IconButton/IconButton.tsx
|
28989
|
-
var
|
28990
|
-
var
|
29015
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
29016
|
+
var getClassName3 = get_class_name_factory_default("IconButton", IconButton_module_default);
|
28991
29017
|
var IconButton = ({
|
28992
29018
|
children,
|
28993
29019
|
href,
|
@@ -29002,10 +29028,10 @@ var IconButton = ({
|
|
29002
29028
|
}) => {
|
29003
29029
|
const [loading, setLoading] = (0, import_react3.useState)(false);
|
29004
29030
|
const ElementType = href ? "a" : "button";
|
29005
|
-
const el = /* @__PURE__ */ (0,
|
29031
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
29006
29032
|
ElementType,
|
29007
29033
|
{
|
29008
|
-
className:
|
29034
|
+
className: getClassName3({
|
29009
29035
|
primary: variant === "primary",
|
29010
29036
|
secondary: variant === "secondary",
|
29011
29037
|
disabled,
|
@@ -29026,11 +29052,11 @@ var IconButton = ({
|
|
29026
29052
|
href,
|
29027
29053
|
title,
|
29028
29054
|
children: [
|
29029
|
-
/* @__PURE__ */ (0,
|
29055
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: getClassName3("title"), children: title }),
|
29030
29056
|
children,
|
29031
|
-
loading && /* @__PURE__ */ (0,
|
29057
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
29032
29058
|
"\xA0\xA0",
|
29033
|
-
/* @__PURE__ */ (0,
|
29059
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Loader, { size: 14 })
|
29034
29060
|
] })
|
29035
29061
|
]
|
29036
29062
|
}
|
@@ -29085,7 +29111,7 @@ var defaultViewports = [
|
|
29085
29111
|
|
29086
29112
|
// components/Puck/context.tsx
|
29087
29113
|
var import_ua_parser_js = require("ua-parser-js");
|
29088
|
-
var
|
29114
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
29089
29115
|
var defaultAppState = {
|
29090
29116
|
data: { content: [], root: { props: {} } },
|
29091
29117
|
ui: {
|
@@ -29125,7 +29151,8 @@ var defaultContext = {
|
|
29125
29151
|
status: "LOADING",
|
29126
29152
|
setStatus: () => null,
|
29127
29153
|
iframe: {},
|
29128
|
-
safariFallbackMode: false
|
29154
|
+
safariFallbackMode: false,
|
29155
|
+
globalPermissions: {}
|
29129
29156
|
};
|
29130
29157
|
var appContext = (0, import_react4.createContext)(defaultContext);
|
29131
29158
|
var AppProvider = ({
|
@@ -29155,7 +29182,7 @@ See https://github.com/measuredco/puck/issues/411 for more information. This mes
|
|
29155
29182
|
setSafariFallbackMode(true);
|
29156
29183
|
}
|
29157
29184
|
}, []);
|
29158
|
-
return /* @__PURE__ */ (0,
|
29185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
29159
29186
|
appContext.Provider,
|
29160
29187
|
{
|
29161
29188
|
value: __spreadProps(__spreadValues({}, value), {
|
@@ -29186,7 +29213,7 @@ function useAppContext() {
|
|
29186
29213
|
}
|
29187
29214
|
|
29188
29215
|
// components/Droppable/index.tsx
|
29189
|
-
var
|
29216
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
29190
29217
|
var defaultProvided = {
|
29191
29218
|
droppableProps: {
|
29192
29219
|
"data-rfd-droppable-context-id": "",
|
@@ -29201,17 +29228,17 @@ var defaultSnapshot = {
|
|
29201
29228
|
draggingFromThisWith: null,
|
29202
29229
|
isUsingPlaceholder: false
|
29203
29230
|
};
|
29204
|
-
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0,
|
29231
|
+
var DefaultDroppable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: children(defaultProvided, defaultSnapshot) });
|
29205
29232
|
var Droppable = (props) => {
|
29206
29233
|
const { status } = useAppContext();
|
29207
29234
|
const El = status !== "LOADING" ? import_dnd.Droppable : DefaultDroppable;
|
29208
|
-
return /* @__PURE__ */ (0,
|
29235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(El, __spreadValues({}, props));
|
29209
29236
|
};
|
29210
29237
|
|
29211
29238
|
// components/Draggable/index.tsx
|
29212
29239
|
init_react_import();
|
29213
29240
|
var import_dnd2 = require("@measured/dnd");
|
29214
|
-
var
|
29241
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
29215
29242
|
var defaultProvided2 = {
|
29216
29243
|
draggableProps: {
|
29217
29244
|
"data-rfd-draggable-context-id": "",
|
@@ -29235,7 +29262,7 @@ var defaultRubric = {
|
|
29235
29262
|
type: "",
|
29236
29263
|
source: { droppableId: "", index: 0 }
|
29237
29264
|
};
|
29238
|
-
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0,
|
29265
|
+
var DefaultDraggable = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: children(defaultProvided2, defaultSnapshot2, defaultRubric) });
|
29239
29266
|
var Draggable = ({
|
29240
29267
|
className,
|
29241
29268
|
children,
|
@@ -29247,22 +29274,23 @@ var Draggable = ({
|
|
29247
29274
|
}) => {
|
29248
29275
|
const { status } = useAppContext();
|
29249
29276
|
const El = status !== "LOADING" ? import_dnd2.Draggable : DefaultDraggable;
|
29250
|
-
return /* @__PURE__ */ (0,
|
29277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(El, { draggableId: id, index, isDragDisabled, children: (provided, snapshot) => {
|
29251
29278
|
var _a;
|
29252
|
-
return /* @__PURE__ */ (0,
|
29253
|
-
/* @__PURE__ */ (0,
|
29279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
29280
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29254
29281
|
"div",
|
29255
29282
|
__spreadProps(__spreadValues(__spreadValues({
|
29256
29283
|
className: className && className(provided, snapshot),
|
29257
29284
|
ref: provided.innerRef
|
29258
29285
|
}, provided.draggableProps), provided.dragHandleProps), {
|
29259
29286
|
style: __spreadProps(__spreadValues({}, provided.draggableProps.style), {
|
29260
|
-
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)"
|
29287
|
+
transform: snapshot.isDragging || !disableAnimations ? (_a = provided.draggableProps.style) == null ? void 0 : _a.transform : "translate(0px, 0px)",
|
29288
|
+
cursor: isDragDisabled ? "no-drop" : "grab"
|
29261
29289
|
}),
|
29262
29290
|
children: children(provided, snapshot)
|
29263
29291
|
})
|
29264
29292
|
),
|
29265
|
-
showShadow && snapshot.isDragging && /* @__PURE__ */ (0,
|
29293
|
+
showShadow && snapshot.isDragging && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
29266
29294
|
"div",
|
29267
29295
|
{
|
29268
29296
|
className: className && className(provided, snapshot),
|
@@ -29282,28 +29310,28 @@ init_react_import();
|
|
29282
29310
|
|
29283
29311
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DragIcon/styles.module.css#css-module
|
29284
29312
|
init_react_import();
|
29285
|
-
var
|
29313
|
+
var styles_module_default5 = { "DragIcon": "_DragIcon_17p8x_1", "DragIcon--disabled": "_DragIcon--disabled_17p8x_8" };
|
29286
29314
|
|
29287
29315
|
// components/DragIcon/index.tsx
|
29288
|
-
var
|
29289
|
-
var
|
29290
|
-
var DragIcon = () => /* @__PURE__ */ (0,
|
29316
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
29317
|
+
var getClassName4 = get_class_name_factory_default("DragIcon", styles_module_default5);
|
29318
|
+
var DragIcon = ({ isDragDisabled }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: getClassName4({ disabled: isDragDisabled }), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { viewBox: "0 0 20 20", width: "12", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z" }) }) });
|
29291
29319
|
|
29292
29320
|
// components/DragDropContext/index.tsx
|
29293
29321
|
init_react_import();
|
29294
29322
|
var import_dnd3 = require("@measured/dnd");
|
29295
|
-
var
|
29296
|
-
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0,
|
29323
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
29324
|
+
var DefaultDragDropContext = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children });
|
29297
29325
|
var DragDropContext = (props) => {
|
29298
29326
|
const { status } = useAppContext();
|
29299
29327
|
const El = status !== "LOADING" ? import_dnd3.DragDropContext : DefaultDragDropContext;
|
29300
|
-
return /* @__PURE__ */ (0,
|
29328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(El, __spreadValues({}, props));
|
29301
29329
|
};
|
29302
29330
|
|
29303
29331
|
// components/AutoField/fields/ArrayField/index.tsx
|
29304
|
-
var
|
29305
|
-
var
|
29306
|
-
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem",
|
29332
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
29333
|
+
var getClassName5 = get_class_name_factory_default("ArrayField", styles_module_default3);
|
29334
|
+
var getClassNameItem = get_class_name_factory_default("ArrayFieldItem", styles_module_default3);
|
29307
29335
|
var ArrayField = ({
|
29308
29336
|
field,
|
29309
29337
|
onChange,
|
@@ -29312,7 +29340,7 @@ var ArrayField = ({
|
|
29312
29340
|
label,
|
29313
29341
|
readOnly,
|
29314
29342
|
id,
|
29315
|
-
Label = (props) => /* @__PURE__ */ (0,
|
29343
|
+
Label = (props) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", __spreadValues({}, props))
|
29316
29344
|
}) => {
|
29317
29345
|
const { state, setUi, selectedItem } = useAppContext();
|
29318
29346
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
@@ -29375,14 +29403,14 @@ var ArrayField = ({
|
|
29375
29403
|
return null;
|
29376
29404
|
}
|
29377
29405
|
const addDisabled = field.max !== void 0 && localState.arrayState.items.length >= field.max || readOnly;
|
29378
|
-
return /* @__PURE__ */ (0,
|
29406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29379
29407
|
Label,
|
29380
29408
|
{
|
29381
29409
|
label: label || name,
|
29382
|
-
icon: /* @__PURE__ */ (0,
|
29410
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(List, { size: 16 }),
|
29383
29411
|
el: "div",
|
29384
29412
|
readOnly,
|
29385
|
-
children: /* @__PURE__ */ (0,
|
29413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29386
29414
|
DragDropContext,
|
29387
29415
|
{
|
29388
29416
|
onDragEnd: (event) => {
|
@@ -29409,12 +29437,12 @@ var ArrayField = ({
|
|
29409
29437
|
});
|
29410
29438
|
}
|
29411
29439
|
},
|
29412
|
-
children: /* @__PURE__ */ (0,
|
29413
|
-
return /* @__PURE__ */ (0,
|
29440
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Droppable, { droppableId: "array", isDropDisabled: readOnly, children: (provided, snapshot) => {
|
29441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
29414
29442
|
"div",
|
29415
29443
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
29416
29444
|
ref: provided.innerRef,
|
29417
|
-
className:
|
29445
|
+
className: getClassName5({
|
29418
29446
|
isDraggingFrom: !!snapshot.draggingFromThisWith,
|
29419
29447
|
hasItems: Array.isArray(value) && value.length > 0,
|
29420
29448
|
addDisabled
|
@@ -29431,7 +29459,7 @@ var ArrayField = ({
|
|
29431
29459
|
localState.arrayState.items.map((item, i) => {
|
29432
29460
|
const { _arrayId = `${id}-${i}`, _originalIndex = i } = item;
|
29433
29461
|
const data = Array.from(localState.value || [])[i] || {};
|
29434
|
-
return /* @__PURE__ */ (0,
|
29462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29435
29463
|
Draggable,
|
29436
29464
|
{
|
29437
29465
|
id: _arrayId,
|
@@ -29442,8 +29470,8 @@ var ArrayField = ({
|
|
29442
29470
|
readOnly
|
29443
29471
|
}),
|
29444
29472
|
isDragDisabled: readOnly || !hovering,
|
29445
|
-
children: () => /* @__PURE__ */ (0,
|
29446
|
-
/* @__PURE__ */ (0,
|
29473
|
+
children: () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
29474
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
29447
29475
|
"div",
|
29448
29476
|
{
|
29449
29477
|
onClick: () => {
|
@@ -29464,8 +29492,8 @@ var ArrayField = ({
|
|
29464
29492
|
className: getClassNameItem("summary"),
|
29465
29493
|
children: [
|
29466
29494
|
field.getItemSummary ? field.getItemSummary(data, i) : `Item #${_originalIndex}`,
|
29467
|
-
/* @__PURE__ */ (0,
|
29468
|
-
!readOnly && /* @__PURE__ */ (0,
|
29495
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: getClassNameItem("rhs"), children: [
|
29496
|
+
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("action"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29469
29497
|
IconButton,
|
29470
29498
|
{
|
29471
29499
|
type: "button",
|
@@ -29488,20 +29516,20 @@ var ArrayField = ({
|
|
29488
29516
|
);
|
29489
29517
|
},
|
29490
29518
|
title: "Delete",
|
29491
|
-
children: /* @__PURE__ */ (0,
|
29519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Trash, { size: 16 })
|
29492
29520
|
}
|
29493
29521
|
) }) }),
|
29494
|
-
/* @__PURE__ */ (0,
|
29522
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DragIcon, {}) })
|
29495
29523
|
] })
|
29496
29524
|
]
|
29497
29525
|
}
|
29498
29526
|
),
|
29499
|
-
/* @__PURE__ */ (0,
|
29527
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getClassNameItem("body"), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("fieldset", { className: getClassNameItem("fieldset"), children: Object.keys(field.arrayFields).map(
|
29500
29528
|
(fieldName) => {
|
29501
29529
|
const subField = field.arrayFields[fieldName];
|
29502
29530
|
const subFieldName = `${name}[${i}].${fieldName}`;
|
29503
29531
|
const wildcardFieldName = `${name}[*].${fieldName}`;
|
29504
|
-
return /* @__PURE__ */ (0,
|
29532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29505
29533
|
AutoFieldPrivate,
|
29506
29534
|
{
|
29507
29535
|
name: subFieldName,
|
@@ -29529,11 +29557,11 @@ var ArrayField = ({
|
|
29529
29557
|
);
|
29530
29558
|
}),
|
29531
29559
|
provided.placeholder,
|
29532
|
-
!addDisabled && /* @__PURE__ */ (0,
|
29560
|
+
!addDisabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
29533
29561
|
"button",
|
29534
29562
|
{
|
29535
29563
|
type: "button",
|
29536
|
-
className:
|
29564
|
+
className: getClassName5("addButton"),
|
29537
29565
|
onClick: () => {
|
29538
29566
|
const existingValue = value || [];
|
29539
29567
|
const newValue = [
|
@@ -29543,7 +29571,7 @@ var ArrayField = ({
|
|
29543
29571
|
const newArrayState = regenerateArrayState(newValue);
|
29544
29572
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
29545
29573
|
},
|
29546
|
-
children: /* @__PURE__ */ (0,
|
29574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Plus, { size: 21 })
|
29547
29575
|
}
|
29548
29576
|
)
|
29549
29577
|
]
|
@@ -29558,8 +29586,8 @@ var ArrayField = ({
|
|
29558
29586
|
|
29559
29587
|
// components/AutoField/fields/DefaultField/index.tsx
|
29560
29588
|
init_react_import();
|
29561
|
-
var
|
29562
|
-
var
|
29589
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
29590
|
+
var getClassName6 = get_class_name_factory_default("Input", styles_module_default2);
|
29563
29591
|
var DefaultField = ({
|
29564
29592
|
field,
|
29565
29593
|
onChange,
|
@@ -29570,19 +29598,19 @@ var DefaultField = ({
|
|
29570
29598
|
Label,
|
29571
29599
|
id
|
29572
29600
|
}) => {
|
29573
|
-
return /* @__PURE__ */ (0,
|
29601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
29574
29602
|
Label,
|
29575
29603
|
{
|
29576
29604
|
label: label || name,
|
29577
|
-
icon: /* @__PURE__ */ (0,
|
29578
|
-
field.type === "text" && /* @__PURE__ */ (0,
|
29579
|
-
field.type === "number" && /* @__PURE__ */ (0,
|
29605
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
29606
|
+
field.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Type, { size: 16 }),
|
29607
|
+
field.type === "number" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Hash, { size: 16 })
|
29580
29608
|
] }),
|
29581
29609
|
readOnly,
|
29582
|
-
children: /* @__PURE__ */ (0,
|
29610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
29583
29611
|
"input",
|
29584
29612
|
{
|
29585
|
-
className:
|
29613
|
+
className: getClassName6("input"),
|
29586
29614
|
autoComplete: "off",
|
29587
29615
|
type: field.type,
|
29588
29616
|
name,
|
@@ -29615,7 +29643,7 @@ var import_react8 = require("react");
|
|
29615
29643
|
|
29616
29644
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css#css-module
|
29617
29645
|
init_react_import();
|
29618
|
-
var
|
29646
|
+
var styles_module_default6 = { "ExternalInput-actions": "_ExternalInput-actions_19obq_1", "ExternalInput-button": "_ExternalInput-button_19obq_5", "ExternalInput--dataSelected": "_ExternalInput--dataSelected_19obq_25", "ExternalInput-detachButton": "_ExternalInput-detachButton_19obq_32", "ExternalInputModal": "_ExternalInputModal_19obq_74", "ExternalInputModal-grid": "_ExternalInputModal-grid_19obq_84", "ExternalInputModal--filtersToggled": "_ExternalInputModal--filtersToggled_19obq_95", "ExternalInputModal-filters": "_ExternalInputModal-filters_19obq_100", "ExternalInputModal-masthead": "_ExternalInputModal-masthead_19obq_119", "ExternalInputModal-tableWrapper": "_ExternalInputModal-tableWrapper_19obq_128", "ExternalInputModal-table": "_ExternalInputModal-table_19obq_128", "ExternalInputModal-thead": "_ExternalInputModal-thead_19obq_144", "ExternalInputModal-th": "_ExternalInputModal-th_19obq_144", "ExternalInputModal-td": "_ExternalInputModal-td_19obq_159", "ExternalInputModal-tr": "_ExternalInputModal-tr_19obq_164", "ExternalInputModal-tbody": "_ExternalInputModal-tbody_19obq_171", "ExternalInputModal--hasData": "_ExternalInputModal--hasData_19obq_197", "ExternalInputModal-loadingBanner": "_ExternalInputModal-loadingBanner_19obq_201", "ExternalInputModal--isLoading": "_ExternalInputModal--isLoading_19obq_218", "ExternalInputModal-searchForm": "_ExternalInputModal-searchForm_19obq_222", "ExternalInputModal-search": "_ExternalInputModal-search_19obq_222", "ExternalInputModal-searchIcon": "_ExternalInputModal-searchIcon_19obq_259", "ExternalInputModal-searchIconText": "_ExternalInputModal-searchIconText_19obq_284", "ExternalInputModal-searchInput": "_ExternalInputModal-searchInput_19obq_294", "ExternalInputModal-searchActions": "_ExternalInputModal-searchActions_19obq_308", "ExternalInputModal-searchActionIcon": "_ExternalInputModal-searchActionIcon_19obq_321", "ExternalInputModal-footer": "_ExternalInputModal-footer_19obq_325" };
|
29619
29647
|
|
29620
29648
|
// components/Modal/index.tsx
|
29621
29649
|
init_react_import();
|
@@ -29623,12 +29651,12 @@ var import_react6 = require("react");
|
|
29623
29651
|
|
29624
29652
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Modal/styles.module.css#css-module
|
29625
29653
|
init_react_import();
|
29626
|
-
var
|
29654
|
+
var styles_module_default7 = { "Modal": "_Modal_ikbaj_1", "Modal--isOpen": "_Modal--isOpen_ikbaj_15", "Modal-inner": "_Modal-inner_ikbaj_19" };
|
29627
29655
|
|
29628
29656
|
// components/Modal/index.tsx
|
29629
29657
|
var import_react_dom = __toESM(require_react_dom());
|
29630
|
-
var
|
29631
|
-
var
|
29658
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
29659
|
+
var getClassName7 = get_class_name_factory_default("Modal", styles_module_default7);
|
29632
29660
|
var Modal = ({
|
29633
29661
|
children,
|
29634
29662
|
onClose,
|
@@ -29639,13 +29667,13 @@ var Modal = ({
|
|
29639
29667
|
setRootEl(document.getElementById("puck-portal-root"));
|
29640
29668
|
}, []);
|
29641
29669
|
if (!rootEl) {
|
29642
|
-
return /* @__PURE__ */ (0,
|
29670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", {});
|
29643
29671
|
}
|
29644
29672
|
return (0, import_react_dom.createPortal)(
|
29645
|
-
/* @__PURE__ */ (0,
|
29673
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName7({ isOpen }), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
29646
29674
|
"div",
|
29647
29675
|
{
|
29648
|
-
className:
|
29676
|
+
className: getClassName7("inner"),
|
29649
29677
|
onClick: (e) => e.stopPropagation(),
|
29650
29678
|
children
|
29651
29679
|
}
|
@@ -29659,17 +29687,17 @@ init_react_import();
|
|
29659
29687
|
|
29660
29688
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Heading/styles.module.css#css-module
|
29661
29689
|
init_react_import();
|
29662
|
-
var
|
29690
|
+
var styles_module_default8 = { "Heading": "_Heading_qxrry_1", "Heading--xxxxl": "_Heading--xxxxl_qxrry_12", "Heading--xxxl": "_Heading--xxxl_qxrry_18", "Heading--xxl": "_Heading--xxl_qxrry_22", "Heading--xl": "_Heading--xl_qxrry_26", "Heading--l": "_Heading--l_qxrry_30", "Heading--m": "_Heading--m_qxrry_34", "Heading--s": "_Heading--s_qxrry_38", "Heading--xs": "_Heading--xs_qxrry_42" };
|
29663
29691
|
|
29664
29692
|
// components/Heading/index.tsx
|
29665
|
-
var
|
29666
|
-
var
|
29693
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
29694
|
+
var getClassName8 = get_class_name_factory_default("Heading", styles_module_default8);
|
29667
29695
|
var Heading = ({ children, rank, size = "m" }) => {
|
29668
29696
|
const Tag = rank ? `h${rank}` : "span";
|
29669
|
-
return /* @__PURE__ */ (0,
|
29697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
29670
29698
|
Tag,
|
29671
29699
|
{
|
29672
|
-
className:
|
29700
|
+
className: getClassName8({
|
29673
29701
|
[size]: true
|
29674
29702
|
}),
|
29675
29703
|
children
|
@@ -29689,8 +29717,8 @@ init_react_import();
|
|
29689
29717
|
var Button_module_default = { "Button": "_Button_1t64k_1", "Button--medium": "_Button--medium_1t64k_29", "Button--large": "_Button--large_1t64k_37", "Button-icon": "_Button-icon_1t64k_44", "Button--primary": "_Button--primary_1t64k_48", "Button--secondary": "_Button--secondary_1t64k_67", "Button--flush": "_Button--flush_1t64k_84", "Button--disabled": "_Button--disabled_1t64k_88", "Button--fullWidth": "_Button--fullWidth_1t64k_95", "Button-spinner": "_Button-spinner_1t64k_100" };
|
29690
29718
|
|
29691
29719
|
// components/Button/Button.tsx
|
29692
|
-
var
|
29693
|
-
var
|
29720
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
29721
|
+
var getClassName9 = get_class_name_factory_default("Button", Button_module_default);
|
29694
29722
|
var Button = ({
|
29695
29723
|
children,
|
29696
29724
|
href,
|
@@ -29708,10 +29736,10 @@ var Button = ({
|
|
29708
29736
|
const [loading, setLoading] = (0, import_react7.useState)(loadingProp);
|
29709
29737
|
(0, import_react7.useEffect)(() => setLoading(loadingProp), [loadingProp]);
|
29710
29738
|
const ElementType = href ? "a" : type ? "button" : "span";
|
29711
|
-
const el = /* @__PURE__ */ (0,
|
29739
|
+
const el = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
29712
29740
|
ElementType,
|
29713
29741
|
{
|
29714
|
-
className:
|
29742
|
+
className: getClassName9({
|
29715
29743
|
primary: variant === "primary",
|
29716
29744
|
secondary: variant === "secondary",
|
29717
29745
|
disabled,
|
@@ -29732,9 +29760,9 @@ var Button = ({
|
|
29732
29760
|
rel: newTab ? "noreferrer" : void 0,
|
29733
29761
|
href,
|
29734
29762
|
children: [
|
29735
|
-
icon && /* @__PURE__ */ (0,
|
29763
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("icon"), children: icon }),
|
29736
29764
|
children,
|
29737
|
-
loading && /* @__PURE__ */ (0,
|
29765
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getClassName9("spinner"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Loader, { size: 14 }) })
|
29738
29766
|
]
|
29739
29767
|
}
|
29740
29768
|
);
|
@@ -29742,9 +29770,9 @@ var Button = ({
|
|
29742
29770
|
};
|
29743
29771
|
|
29744
29772
|
// components/ExternalInput/index.tsx
|
29745
|
-
var
|
29746
|
-
var
|
29747
|
-
var getClassNameModal = get_class_name_factory_default("ExternalInputModal",
|
29773
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
29774
|
+
var getClassName10 = get_class_name_factory_default("ExternalInput", styles_module_default6);
|
29775
|
+
var getClassNameModal = get_class_name_factory_default("ExternalInputModal", styles_module_default6);
|
29748
29776
|
var dataCache = {};
|
29749
29777
|
var ExternalInput = ({
|
29750
29778
|
field,
|
@@ -29795,40 +29823,40 @@ var ExternalInput = ({
|
|
29795
29823
|
(0, import_react8.useEffect)(() => {
|
29796
29824
|
search(searchQuery, filters);
|
29797
29825
|
}, []);
|
29798
|
-
return /* @__PURE__ */ (0,
|
29826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
29799
29827
|
"div",
|
29800
29828
|
{
|
29801
|
-
className:
|
29829
|
+
className: getClassName10({
|
29802
29830
|
dataSelected: !!value,
|
29803
29831
|
modalVisible: isOpen
|
29804
29832
|
}),
|
29805
29833
|
id,
|
29806
29834
|
children: [
|
29807
|
-
/* @__PURE__ */ (0,
|
29808
|
-
/* @__PURE__ */ (0,
|
29835
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassName10("actions"), children: [
|
29836
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29809
29837
|
"button",
|
29810
29838
|
{
|
29811
29839
|
type: "button",
|
29812
29840
|
onClick: () => setOpen(true),
|
29813
|
-
className:
|
29814
|
-
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0,
|
29815
|
-
/* @__PURE__ */ (0,
|
29816
|
-
/* @__PURE__ */ (0,
|
29841
|
+
className: getClassName10("button"),
|
29842
|
+
children: value ? field.getItemSummary ? field.getItemSummary(value) : "External item" : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
29843
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Link, { size: "16" }),
|
29844
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: field.placeholder })
|
29817
29845
|
] })
|
29818
29846
|
}
|
29819
29847
|
),
|
29820
|
-
value && /* @__PURE__ */ (0,
|
29848
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29821
29849
|
"button",
|
29822
29850
|
{
|
29823
|
-
className:
|
29851
|
+
className: getClassName10("detachButton"),
|
29824
29852
|
onClick: () => {
|
29825
29853
|
onChange(null);
|
29826
29854
|
},
|
29827
|
-
children: /* @__PURE__ */ (0,
|
29855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Unlock, { size: 16 })
|
29828
29856
|
}
|
29829
29857
|
)
|
29830
29858
|
] }),
|
29831
|
-
/* @__PURE__ */ (0,
|
29859
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Modal, { onClose: () => setOpen(false), isOpen, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
29832
29860
|
"form",
|
29833
29861
|
{
|
29834
29862
|
className: getClassNameModal({
|
@@ -29842,11 +29870,11 @@ var ExternalInput = ({
|
|
29842
29870
|
search(searchQuery, filters);
|
29843
29871
|
},
|
29844
29872
|
children: [
|
29845
|
-
/* @__PURE__ */ (0,
|
29846
|
-
/* @__PURE__ */ (0,
|
29847
|
-
/* @__PURE__ */ (0,
|
29848
|
-
/* @__PURE__ */ (0,
|
29849
|
-
/* @__PURE__ */ (0,
|
29873
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("masthead"), children: field.showSearch ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchForm"), children: [
|
29874
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: getClassNameModal("search"), children: [
|
29875
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: getClassNameModal("searchIconText"), children: "Search" }),
|
29876
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Search, { size: "18" }) }),
|
29877
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29850
29878
|
"input",
|
29851
29879
|
{
|
29852
29880
|
className: getClassNameModal("searchInput"),
|
@@ -29861,9 +29889,9 @@ var ExternalInput = ({
|
|
29861
29889
|
}
|
29862
29890
|
)
|
29863
29891
|
] }),
|
29864
|
-
/* @__PURE__ */ (0,
|
29865
|
-
/* @__PURE__ */ (0,
|
29866
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
29892
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("searchActions"), children: [
|
29893
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { type: "submit", loading: isLoading, fullWidth: true, children: "Search" }),
|
29894
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("searchActionIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29867
29895
|
IconButton,
|
29868
29896
|
{
|
29869
29897
|
title: "Toggle filters",
|
@@ -29872,15 +29900,15 @@ var ExternalInput = ({
|
|
29872
29900
|
e.stopPropagation();
|
29873
29901
|
setFiltersToggled(!filtersToggled);
|
29874
29902
|
},
|
29875
|
-
children: /* @__PURE__ */ (0,
|
29903
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SlidersHorizontal, { size: 20 })
|
29876
29904
|
}
|
29877
29905
|
) })
|
29878
29906
|
] })
|
29879
|
-
] }) : /* @__PURE__ */ (0,
|
29880
|
-
/* @__PURE__ */ (0,
|
29881
|
-
hasFilterFields && /* @__PURE__ */ (0,
|
29907
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { rank: 2, size: "xs", children: field.placeholder || "Select data" }) }),
|
29908
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("grid"), children: [
|
29909
|
+
hasFilterFields && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("filters"), children: hasFilterFields && Object.keys(filterFields).map((fieldName) => {
|
29882
29910
|
const filterField = filterFields[fieldName];
|
29883
|
-
return /* @__PURE__ */ (0,
|
29911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29884
29912
|
AutoFieldPrivate,
|
29885
29913
|
{
|
29886
29914
|
field: filterField,
|
@@ -29897,9 +29925,9 @@ var ExternalInput = ({
|
|
29897
29925
|
fieldName
|
29898
29926
|
);
|
29899
29927
|
}) }),
|
29900
|
-
/* @__PURE__ */ (0,
|
29901
|
-
/* @__PURE__ */ (0,
|
29902
|
-
/* @__PURE__ */ (0,
|
29928
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("tableWrapper"), children: [
|
29929
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: getClassNameModal("table"), children: [
|
29930
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { className: getClassNameModal("thead"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tr", { className: getClassNameModal("tr"), children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29903
29931
|
"th",
|
29904
29932
|
{
|
29905
29933
|
className: getClassNameModal("th"),
|
@@ -29908,8 +29936,8 @@ var ExternalInput = ({
|
|
29908
29936
|
},
|
29909
29937
|
key
|
29910
29938
|
)) }) }),
|
29911
|
-
/* @__PURE__ */ (0,
|
29912
|
-
return /* @__PURE__ */ (0,
|
29939
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("tbody", { className: getClassNameModal("tbody"), children: mappedData.map((item, i) => {
|
29940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
29913
29941
|
"tr",
|
29914
29942
|
{
|
29915
29943
|
style: { whiteSpace: "nowrap" },
|
@@ -29918,16 +29946,16 @@ var ExternalInput = ({
|
|
29918
29946
|
onChange(mapProp(data[i]));
|
29919
29947
|
setOpen(false);
|
29920
29948
|
},
|
29921
|
-
children: keys.map((key) => /* @__PURE__ */ (0,
|
29949
|
+
children: keys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("td", { className: getClassNameModal("td"), children: item[key] }, key))
|
29922
29950
|
},
|
29923
29951
|
i
|
29924
29952
|
);
|
29925
29953
|
}) })
|
29926
29954
|
] }),
|
29927
|
-
/* @__PURE__ */ (0,
|
29955
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getClassNameModal("loadingBanner"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Loader, { size: 24 }) })
|
29928
29956
|
] })
|
29929
29957
|
] }),
|
29930
|
-
/* @__PURE__ */ (0,
|
29958
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: getClassNameModal("footer"), children: [
|
29931
29959
|
mappedData.length,
|
29932
29960
|
" result",
|
29933
29961
|
mappedData.length === 1 ? "" : "s"
|
@@ -29941,7 +29969,7 @@ var ExternalInput = ({
|
|
29941
29969
|
};
|
29942
29970
|
|
29943
29971
|
// components/AutoField/fields/ExternalField/index.tsx
|
29944
|
-
var
|
29972
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
29945
29973
|
var ExternalField = ({
|
29946
29974
|
field,
|
29947
29975
|
onChange,
|
@@ -29964,7 +29992,7 @@ var ExternalField = ({
|
|
29964
29992
|
if (field.type !== "external") {
|
29965
29993
|
return null;
|
29966
29994
|
}
|
29967
|
-
return /* @__PURE__ */ (0,
|
29995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { size: 16 }), el: "div", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
29968
29996
|
ExternalInput,
|
29969
29997
|
{
|
29970
29998
|
name,
|
@@ -29988,8 +30016,8 @@ var ExternalField = ({
|
|
29988
30016
|
|
29989
30017
|
// components/AutoField/fields/RadioField/index.tsx
|
29990
30018
|
init_react_import();
|
29991
|
-
var
|
29992
|
-
var
|
30019
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
30020
|
+
var getClassName11 = get_class_name_factory_default("Input", styles_module_default2);
|
29993
30021
|
var RadioField = ({
|
29994
30022
|
field,
|
29995
30023
|
onChange,
|
@@ -30003,23 +30031,23 @@ var RadioField = ({
|
|
30003
30031
|
if (field.type !== "radio" || !field.options) {
|
30004
30032
|
return null;
|
30005
30033
|
}
|
30006
|
-
return /* @__PURE__ */ (0,
|
30034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
30007
30035
|
Label,
|
30008
30036
|
{
|
30009
|
-
icon: /* @__PURE__ */ (0,
|
30037
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckCircle, { size: 16 }),
|
30010
30038
|
label: label || name,
|
30011
30039
|
readOnly,
|
30012
30040
|
el: "div",
|
30013
|
-
children: /* @__PURE__ */ (0,
|
30041
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioGroupItems"), id, children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
30014
30042
|
"label",
|
30015
30043
|
{
|
30016
|
-
className:
|
30044
|
+
className: getClassName11("radio"),
|
30017
30045
|
children: [
|
30018
|
-
/* @__PURE__ */ (0,
|
30046
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
30019
30047
|
"input",
|
30020
30048
|
{
|
30021
30049
|
type: "radio",
|
30022
|
-
className:
|
30050
|
+
className: getClassName11("radioInput"),
|
30023
30051
|
value: option.value,
|
30024
30052
|
name,
|
30025
30053
|
onChange: (e) => {
|
@@ -30033,7 +30061,7 @@ var RadioField = ({
|
|
30033
30061
|
checked: value === option.value
|
30034
30062
|
}
|
30035
30063
|
),
|
30036
|
-
/* @__PURE__ */ (0,
|
30064
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: getClassName11("radioInner"), children: option.label || option.value })
|
30037
30065
|
]
|
30038
30066
|
},
|
30039
30067
|
option.label + option.value
|
@@ -30044,8 +30072,8 @@ var RadioField = ({
|
|
30044
30072
|
|
30045
30073
|
// components/AutoField/fields/SelectField/index.tsx
|
30046
30074
|
init_react_import();
|
30047
|
-
var
|
30048
|
-
var
|
30075
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
30076
|
+
var getClassName12 = get_class_name_factory_default("Input", styles_module_default2);
|
30049
30077
|
var SelectField = ({
|
30050
30078
|
field,
|
30051
30079
|
onChange,
|
@@ -30059,17 +30087,17 @@ var SelectField = ({
|
|
30059
30087
|
if (field.type !== "select" || !field.options) {
|
30060
30088
|
return null;
|
30061
30089
|
}
|
30062
|
-
return /* @__PURE__ */ (0,
|
30090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
30063
30091
|
Label,
|
30064
30092
|
{
|
30065
30093
|
label: label || name,
|
30066
|
-
icon: /* @__PURE__ */ (0,
|
30094
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDown, { size: 16 }),
|
30067
30095
|
readOnly,
|
30068
|
-
children: /* @__PURE__ */ (0,
|
30096
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
30069
30097
|
"select",
|
30070
30098
|
{
|
30071
30099
|
id,
|
30072
|
-
className:
|
30100
|
+
className: getClassName12("input"),
|
30073
30101
|
disabled: readOnly,
|
30074
30102
|
onChange: (e) => {
|
30075
30103
|
if (e.currentTarget.value === "true" || e.currentTarget.value === "false") {
|
@@ -30079,7 +30107,7 @@ var SelectField = ({
|
|
30079
30107
|
onChange(e.currentTarget.value);
|
30080
30108
|
},
|
30081
30109
|
value,
|
30082
|
-
children: field.options.map((option) => /* @__PURE__ */ (0,
|
30110
|
+
children: field.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
30083
30111
|
"option",
|
30084
30112
|
{
|
30085
30113
|
label: option.label,
|
@@ -30095,8 +30123,8 @@ var SelectField = ({
|
|
30095
30123
|
|
30096
30124
|
// components/AutoField/fields/TextareaField/index.tsx
|
30097
30125
|
init_react_import();
|
30098
|
-
var
|
30099
|
-
var
|
30126
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
30127
|
+
var getClassName13 = get_class_name_factory_default("Input", styles_module_default2);
|
30100
30128
|
var TextareaField = ({
|
30101
30129
|
onChange,
|
30102
30130
|
readOnly,
|
@@ -30106,11 +30134,11 @@ var TextareaField = ({
|
|
30106
30134
|
Label,
|
30107
30135
|
id
|
30108
30136
|
}) => {
|
30109
|
-
return /* @__PURE__ */ (0,
|
30137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label, { label: label || name, icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Type, { size: 16 }), readOnly, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
30110
30138
|
"textarea",
|
30111
30139
|
{
|
30112
30140
|
id,
|
30113
|
-
className:
|
30141
|
+
className: getClassName13("input"),
|
30114
30142
|
autoComplete: "off",
|
30115
30143
|
name,
|
30116
30144
|
value: typeof value === "undefined" ? "" : value,
|
@@ -30130,11 +30158,11 @@ init_react_import();
|
|
30130
30158
|
|
30131
30159
|
// css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/fields/ObjectField/styles.module.css#css-module
|
30132
30160
|
init_react_import();
|
30133
|
-
var
|
30161
|
+
var styles_module_default9 = { "ObjectField": "_ObjectField_1ua3y_5", "ObjectField-fieldset": "_ObjectField-fieldset_1ua3y_13" };
|
30134
30162
|
|
30135
30163
|
// components/AutoField/fields/ObjectField/index.tsx
|
30136
|
-
var
|
30137
|
-
var
|
30164
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
30165
|
+
var getClassName14 = get_class_name_factory_default("ObjectField", styles_module_default9);
|
30138
30166
|
var ObjectField = ({
|
30139
30167
|
field,
|
30140
30168
|
onChange,
|
@@ -30151,18 +30179,18 @@ var ObjectField = ({
|
|
30151
30179
|
}
|
30152
30180
|
const readOnlyFields = (selectedItem == null ? void 0 : selectedItem.readOnly) || {};
|
30153
30181
|
const data = value || {};
|
30154
|
-
return /* @__PURE__ */ (0,
|
30182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
30155
30183
|
Label,
|
30156
30184
|
{
|
30157
30185
|
label: label || name,
|
30158
|
-
icon: /* @__PURE__ */ (0,
|
30186
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MoreVertical, { size: 16 }),
|
30159
30187
|
el: "div",
|
30160
30188
|
readOnly,
|
30161
|
-
children: /* @__PURE__ */ (0,
|
30189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getClassName14(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("fieldset", { className: getClassName14("fieldset"), children: Object.keys(field.objectFields).map((fieldName) => {
|
30162
30190
|
const subField = field.objectFields[fieldName];
|
30163
30191
|
const subFieldName = `${name}.${fieldName}`;
|
30164
30192
|
const wildcardFieldName = `${name}.${fieldName}`;
|
30165
|
-
return /* @__PURE__ */ (0,
|
30193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
30166
30194
|
AutoFieldPrivate,
|
30167
30195
|
{
|
30168
30196
|
name: subFieldName,
|
@@ -30206,8 +30234,8 @@ var useSafeId = () => {
|
|
30206
30234
|
};
|
30207
30235
|
|
30208
30236
|
// components/AutoField/index.tsx
|
30209
|
-
var
|
30210
|
-
var
|
30237
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
30238
|
+
var getClassName15 = get_class_name_factory_default("Input", styles_module_default2);
|
30211
30239
|
var FieldLabel = ({
|
30212
30240
|
children,
|
30213
30241
|
icon,
|
@@ -30217,11 +30245,11 @@ var FieldLabel = ({
|
|
30217
30245
|
className
|
30218
30246
|
}) => {
|
30219
30247
|
const El = el;
|
30220
|
-
return /* @__PURE__ */ (0,
|
30221
|
-
/* @__PURE__ */ (0,
|
30222
|
-
icon ? /* @__PURE__ */ (0,
|
30248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(El, { className, children: [
|
30249
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: getClassName15("label"), children: [
|
30250
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("labelIcon"), children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {}),
|
30223
30251
|
label,
|
30224
|
-
readOnly && /* @__PURE__ */ (0,
|
30252
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15("disabledIcon"), title: "Read-only", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Lock, { size: "12" }) })
|
30225
30253
|
] }),
|
30226
30254
|
children
|
30227
30255
|
] });
|
@@ -30239,14 +30267,14 @@ var FieldLabelInternal2 = ({
|
|
30239
30267
|
[overrides]
|
30240
30268
|
);
|
30241
30269
|
if (!label) {
|
30242
|
-
return /* @__PURE__ */ (0,
|
30270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children });
|
30243
30271
|
}
|
30244
|
-
return /* @__PURE__ */ (0,
|
30272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
30245
30273
|
Wrapper,
|
30246
30274
|
{
|
30247
30275
|
label,
|
30248
30276
|
icon,
|
30249
|
-
className:
|
30277
|
+
className: getClassName15({ readOnly }),
|
30250
30278
|
readOnly,
|
30251
30279
|
el,
|
30252
30280
|
children
|
@@ -30290,11 +30318,11 @@ function AutoFieldInternal(props) {
|
|
30290
30318
|
return null;
|
30291
30319
|
}
|
30292
30320
|
const CustomField = field.render;
|
30293
|
-
return /* @__PURE__ */ (0,
|
30321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getClassName15(), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CustomField, __spreadValues({}, mergedProps)) });
|
30294
30322
|
}
|
30295
30323
|
const children = defaultFields[field.type](mergedProps);
|
30296
30324
|
const Render2 = render[field.type];
|
30297
|
-
return /* @__PURE__ */ (0,
|
30325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
|
30298
30326
|
}
|
30299
30327
|
function AutoFieldPrivate(props) {
|
30300
30328
|
const { value, onChange } = props;
|
@@ -30317,11 +30345,11 @@ function AutoFieldPrivate(props) {
|
|
30317
30345
|
value: localValue,
|
30318
30346
|
onChange: onChangeLocal
|
30319
30347
|
};
|
30320
|
-
return /* @__PURE__ */ (0,
|
30348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
|
30321
30349
|
}
|
30322
|
-
var DefaultLabel = (props) => /* @__PURE__ */ (0,
|
30350
|
+
var DefaultLabel = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", __spreadValues({}, props));
|
30323
30351
|
function AutoField(props) {
|
30324
|
-
return /* @__PURE__ */ (0,
|
30352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
|
30325
30353
|
}
|
30326
30354
|
|
30327
30355
|
// components/Drawer/index.tsx
|
@@ -30329,49 +30357,62 @@ init_react_import();
|
|
30329
30357
|
|
30330
30358
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css#css-module
|
30331
30359
|
init_react_import();
|
30332
|
-
var
|
30360
|
+
var styles_module_default10 = { "Drawer": "_Drawer_4yfqn_1", "DrawerItem--disabled": "_DrawerItem--disabled_4yfqn_5", "DrawerItem-default": "_DrawerItem-default_4yfqn_11", "DrawerItem-draggableWrapper": "_DrawerItem-draggableWrapper_4yfqn_11", "DrawerItem": "_DrawerItem_4yfqn_5", "DrawerItem-draggable": "_DrawerItem-draggable_4yfqn_11", "Drawer--isDraggingFrom": "_Drawer--isDraggingFrom_4yfqn_36", "DrawerItem-name": "_DrawerItem-name_4yfqn_54" };
|
30333
30361
|
|
30334
30362
|
// components/Drawer/index.tsx
|
30335
30363
|
var import_react12 = require("react");
|
30336
|
-
var
|
30337
|
-
var
|
30338
|
-
var getClassNameItem2 = get_class_name_factory_default("DrawerItem",
|
30364
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
30365
|
+
var getClassName16 = get_class_name_factory_default("Drawer", styles_module_default10);
|
30366
|
+
var getClassNameItem2 = get_class_name_factory_default("DrawerItem", styles_module_default10);
|
30339
30367
|
var drawerContext = (0, import_react12.createContext)({
|
30340
30368
|
droppableId: ""
|
30341
30369
|
});
|
30342
30370
|
var DrawerDraggable = ({
|
30343
30371
|
children,
|
30344
30372
|
id,
|
30345
|
-
index
|
30346
|
-
|
30347
|
-
|
30348
|
-
|
30349
|
-
|
30350
|
-
|
30351
|
-
|
30352
|
-
|
30353
|
-
|
30354
|
-
|
30355
|
-
|
30356
|
-
|
30357
|
-
)
|
30373
|
+
index,
|
30374
|
+
isDragDisabled
|
30375
|
+
}) => {
|
30376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
30377
|
+
Draggable,
|
30378
|
+
{
|
30379
|
+
id,
|
30380
|
+
index,
|
30381
|
+
isDragDisabled,
|
30382
|
+
showShadow: true,
|
30383
|
+
disableAnimations: true,
|
30384
|
+
className: () => getClassNameItem2({ disabled: isDragDisabled }),
|
30385
|
+
children: () => children
|
30386
|
+
},
|
30387
|
+
id
|
30388
|
+
);
|
30389
|
+
};
|
30358
30390
|
var DrawerItem = ({
|
30359
30391
|
name,
|
30360
30392
|
children,
|
30361
30393
|
id,
|
30362
30394
|
label,
|
30363
|
-
index
|
30395
|
+
index,
|
30396
|
+
isDragDisabled
|
30364
30397
|
}) => {
|
30365
30398
|
const ctx = (0, import_react12.useContext)(drawerContext);
|
30366
30399
|
const resolvedId = `${ctx.droppableId}::${id || name}`;
|
30367
30400
|
const CustomInner = (0, import_react12.useMemo)(
|
30368
|
-
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0,
|
30401
|
+
() => children || (({ children: children2, name: name2 }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("default"), children: children2 })),
|
30369
30402
|
[children]
|
30370
30403
|
);
|
30371
|
-
return /* @__PURE__ */ (0,
|
30372
|
-
|
30373
|
-
|
30374
|
-
|
30404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
30405
|
+
DrawerDraggable,
|
30406
|
+
{
|
30407
|
+
id: resolvedId,
|
30408
|
+
index,
|
30409
|
+
isDragDisabled,
|
30410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomInner, { name, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("draggableWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getClassNameItem2("draggable"), children: [
|
30411
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("name"), children: label != null ? label : name }),
|
30412
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: getClassNameItem2("icon"), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DragIcon, { isDragDisabled }) })
|
30413
|
+
] }) }) })
|
30414
|
+
}
|
30415
|
+
);
|
30375
30416
|
};
|
30376
30417
|
var Drawer = ({
|
30377
30418
|
children,
|
@@ -30379,16 +30420,16 @@ var Drawer = ({
|
|
30379
30420
|
direction = "vertical"
|
30380
30421
|
}) => {
|
30381
30422
|
const droppableId = `component-list:${_droppableId}`;
|
30382
|
-
return /* @__PURE__ */ (0,
|
30423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(drawerContext.Provider, { value: { droppableId }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Droppable, { droppableId, isDropDisabled: true, direction, children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
30383
30424
|
"div",
|
30384
30425
|
__spreadProps(__spreadValues({}, provided.droppableProps), {
|
30385
30426
|
ref: provided.innerRef,
|
30386
|
-
className:
|
30427
|
+
className: getClassName16({
|
30387
30428
|
isDraggingFrom: !!snapshot.draggingFromThisWith
|
30388
30429
|
}),
|
30389
30430
|
children: [
|
30390
30431
|
children,
|
30391
|
-
/* @__PURE__ */ (0,
|
30432
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { style: { display: "none" }, children: provided.placeholder })
|
30392
30433
|
]
|
30393
30434
|
})
|
30394
30435
|
) }) });
|
@@ -30397,16 +30438,16 @@ Drawer.Item = DrawerItem;
|
|
30397
30438
|
|
30398
30439
|
// components/DropZone/index.tsx
|
30399
30440
|
init_react_import();
|
30400
|
-
var
|
30441
|
+
var import_react17 = require("react");
|
30401
30442
|
|
30402
30443
|
// components/DraggableComponent/index.tsx
|
30403
30444
|
init_react_import();
|
30404
|
-
var
|
30445
|
+
var import_react15 = require("react");
|
30405
30446
|
var import_dnd4 = require("@measured/dnd");
|
30406
30447
|
|
30407
30448
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css#css-module
|
30408
30449
|
init_react_import();
|
30409
|
-
var
|
30450
|
+
var styles_module_default11 = { "DraggableComponent": "_DraggableComponent_1bhad_1", "DraggableComponent--isDragging": "_DraggableComponent--isDragging_1bhad_11", "DraggableComponent-contents": "_DraggableComponent-contents_1bhad_16", "DraggableComponent-overlay": "_DraggableComponent-overlay_1bhad_29", "DraggableComponent-loadingOverlay": "_DraggableComponent-loadingOverlay_1bhad_49", "DraggableComponent--isLocked": "_DraggableComponent--isLocked_1bhad_65", "DraggableComponent--forceHover": "_DraggableComponent--forceHover_1bhad_71", "DraggableComponent--isSelected": "_DraggableComponent--isSelected_1bhad_76", "DraggableComponent--indicativeHover": "_DraggableComponent--indicativeHover_1bhad_81", "DraggableComponent-actionsOverlay": "_DraggableComponent-actionsOverlay_1bhad_97", "DraggableComponent-actions": "_DraggableComponent-actions_1bhad_97" };
|
30410
30451
|
|
30411
30452
|
// lib/use-modifier-held.ts
|
30412
30453
|
init_react_import();
|
@@ -30446,13 +30487,151 @@ var isIos = () => [
|
|
30446
30487
|
].includes(navigator.platform) || // iPad on iOS 13 detection
|
30447
30488
|
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
30448
30489
|
|
30490
|
+
// components/DefaultOverride/index.tsx
|
30491
|
+
init_react_import();
|
30492
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
30493
|
+
var DefaultOverride = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children });
|
30494
|
+
|
30495
|
+
// lib/use-loaded-overrides.ts
|
30496
|
+
init_react_import();
|
30497
|
+
var import_react14 = require("react");
|
30498
|
+
|
30499
|
+
// lib/load-overrides.ts
|
30500
|
+
init_react_import();
|
30501
|
+
var loadOverrides = ({
|
30502
|
+
overrides,
|
30503
|
+
plugins
|
30504
|
+
}) => {
|
30505
|
+
const collected = __spreadValues({}, overrides);
|
30506
|
+
plugins.forEach((plugin) => {
|
30507
|
+
Object.keys(plugin.overrides).forEach((overridesType) => {
|
30508
|
+
if (overridesType === "fieldTypes") {
|
30509
|
+
const fieldTypes = plugin.overrides.fieldTypes;
|
30510
|
+
Object.keys(fieldTypes).forEach((fieldType) => {
|
30511
|
+
collected.fieldTypes = collected.fieldTypes || {};
|
30512
|
+
const childNode2 = collected.fieldTypes[fieldType];
|
30513
|
+
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
30514
|
+
children: childNode2 ? childNode2(props) : props.children
|
30515
|
+
}));
|
30516
|
+
collected.fieldTypes[fieldType] = Comp2;
|
30517
|
+
});
|
30518
|
+
return;
|
30519
|
+
}
|
30520
|
+
const childNode = collected[overridesType];
|
30521
|
+
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
30522
|
+
children: childNode ? childNode(props) : props.children
|
30523
|
+
}));
|
30524
|
+
collected[overridesType] = Comp;
|
30525
|
+
});
|
30526
|
+
});
|
30527
|
+
return collected;
|
30528
|
+
};
|
30529
|
+
|
30530
|
+
// lib/use-loaded-overrides.ts
|
30531
|
+
var useLoadedOverrides = ({
|
30532
|
+
overrides,
|
30533
|
+
plugins
|
30534
|
+
}) => {
|
30535
|
+
return (0, import_react14.useMemo)(() => {
|
30536
|
+
return loadOverrides({ overrides, plugins });
|
30537
|
+
}, [plugins, overrides]);
|
30538
|
+
};
|
30539
|
+
|
30540
|
+
// lib/get-permissions.ts
|
30541
|
+
init_react_import();
|
30542
|
+
|
30543
|
+
// lib/get-changed.ts
|
30544
|
+
init_react_import();
|
30545
|
+
var getChanged = (newItem, oldItem) => {
|
30546
|
+
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
30547
|
+
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
30548
|
+
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
30549
|
+
return __spreadProps(__spreadValues({}, acc), {
|
30550
|
+
[item]: oldItemProps[item] !== newItemProps[item]
|
30551
|
+
});
|
30552
|
+
}, {}) : {};
|
30553
|
+
};
|
30554
|
+
|
30555
|
+
// lib/resolve-permissions.ts
|
30556
|
+
init_react_import();
|
30557
|
+
var resolvePermissions = ({
|
30558
|
+
selectedItem,
|
30559
|
+
config,
|
30560
|
+
changed,
|
30561
|
+
lastPermissions,
|
30562
|
+
initialPermissions,
|
30563
|
+
appState
|
30564
|
+
}) => {
|
30565
|
+
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
30566
|
+
if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolvePermissions)) {
|
30567
|
+
return componentConfig.resolvePermissions(selectedItem, {
|
30568
|
+
changed,
|
30569
|
+
lastPermissions,
|
30570
|
+
initialPermissions,
|
30571
|
+
appState
|
30572
|
+
});
|
30573
|
+
}
|
30574
|
+
return {};
|
30575
|
+
};
|
30576
|
+
|
30577
|
+
// lib/get-permissions.ts
|
30578
|
+
var cache = { lastPermissions: {}, lastSelected: {} };
|
30579
|
+
var getPermissions = ({
|
30580
|
+
selectedItem,
|
30581
|
+
type,
|
30582
|
+
globalPermissions,
|
30583
|
+
config,
|
30584
|
+
appState
|
30585
|
+
}) => {
|
30586
|
+
const componentType = type || selectedItem && selectedItem.type || "";
|
30587
|
+
const componentId = selectedItem && selectedItem.props.id || "";
|
30588
|
+
let componentPermissions = getInitialPermissions({
|
30589
|
+
componentType,
|
30590
|
+
config,
|
30591
|
+
globalPermissions
|
30592
|
+
});
|
30593
|
+
const changed = getChanged(selectedItem, cache.lastSelected);
|
30594
|
+
if (Object.values(changed).some((el) => el === true)) {
|
30595
|
+
const resolvedPermissions = resolvePermissions({
|
30596
|
+
selectedItem,
|
30597
|
+
config,
|
30598
|
+
changed,
|
30599
|
+
lastPermissions: cache.lastPermissions[componentId] || componentPermissions,
|
30600
|
+
initialPermissions: componentPermissions,
|
30601
|
+
appState
|
30602
|
+
});
|
30603
|
+
if (resolvedPermissions !== void 0) {
|
30604
|
+
componentPermissions = __spreadValues(__spreadValues({}, componentPermissions), resolvedPermissions);
|
30605
|
+
}
|
30606
|
+
cache.lastSelected = selectedItem;
|
30607
|
+
cache.lastPermissions[componentId] = componentPermissions;
|
30608
|
+
return componentPermissions;
|
30609
|
+
}
|
30610
|
+
if (Object.keys(componentId && cache.lastPermissions[componentId]).length !== 0) {
|
30611
|
+
componentPermissions = cache.lastPermissions[componentId];
|
30612
|
+
}
|
30613
|
+
return componentPermissions;
|
30614
|
+
};
|
30615
|
+
var getInitialPermissions = ({
|
30616
|
+
componentType,
|
30617
|
+
globalPermissions,
|
30618
|
+
config
|
30619
|
+
}) => {
|
30620
|
+
var _a;
|
30621
|
+
return __spreadValues(__spreadValues({}, globalPermissions), (_a = config.components[componentType]) == null ? void 0 : _a.permissions);
|
30622
|
+
};
|
30623
|
+
|
30449
30624
|
// components/DraggableComponent/index.tsx
|
30450
|
-
var
|
30451
|
-
var
|
30625
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
30626
|
+
var getClassName17 = get_class_name_factory_default("DraggableComponent", styles_module_default11);
|
30452
30627
|
var space = 8;
|
30453
30628
|
var actionsOverlayTop = space * 6.5;
|
30454
30629
|
var actionsTop = -(actionsOverlayTop - 8);
|
30455
30630
|
var actionsRight = space;
|
30631
|
+
var DefaultActionBar = ({
|
30632
|
+
label,
|
30633
|
+
children
|
30634
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar, { label, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DefaultOverride, { children }) });
|
30456
30635
|
var DraggableComponent = ({
|
30457
30636
|
children,
|
30458
30637
|
id,
|
@@ -30475,30 +30654,52 @@ var DraggableComponent = ({
|
|
30475
30654
|
indicativeHover = false,
|
30476
30655
|
style
|
30477
30656
|
}) => {
|
30478
|
-
const {
|
30657
|
+
const {
|
30658
|
+
zoomConfig,
|
30659
|
+
status,
|
30660
|
+
overrides,
|
30661
|
+
plugins,
|
30662
|
+
selectedItem,
|
30663
|
+
config,
|
30664
|
+
globalPermissions,
|
30665
|
+
state
|
30666
|
+
} = useAppContext();
|
30479
30667
|
const isModifierHeld = useModifierHeld("Alt");
|
30480
|
-
const { status } = useAppContext();
|
30481
30668
|
const El = status !== "LOADING" ? import_dnd4.Draggable : DefaultDraggable;
|
30482
|
-
(0,
|
30483
|
-
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0,
|
30484
|
-
(0,
|
30669
|
+
(0, import_react15.useEffect)(onMount, []);
|
30670
|
+
const [disableSecondaryAnimation, setDisableSecondaryAnimation] = (0, import_react15.useState)(false);
|
30671
|
+
(0, import_react15.useEffect)(() => {
|
30485
30672
|
if (isIos()) {
|
30486
30673
|
setDisableSecondaryAnimation(true);
|
30487
30674
|
}
|
30488
30675
|
}, []);
|
30489
|
-
|
30676
|
+
const loadedOverrides = useLoadedOverrides({
|
30677
|
+
overrides,
|
30678
|
+
plugins
|
30679
|
+
});
|
30680
|
+
const CustomActionBar = (0, import_react15.useMemo)(
|
30681
|
+
() => loadedOverrides.actionBar || DefaultActionBar,
|
30682
|
+
[loadedOverrides]
|
30683
|
+
);
|
30684
|
+
const permissions = selectedItem && getPermissions({
|
30685
|
+
selectedItem,
|
30686
|
+
globalPermissions: globalPermissions || {},
|
30687
|
+
config,
|
30688
|
+
appState: state
|
30689
|
+
});
|
30690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30490
30691
|
El,
|
30491
30692
|
{
|
30492
30693
|
draggableId: id,
|
30493
30694
|
index,
|
30494
30695
|
isDragDisabled,
|
30495
30696
|
disableSecondaryAnimation,
|
30496
|
-
children: (provided, snapshot) => /* @__PURE__ */ (0,
|
30697
|
+
children: (provided, snapshot) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
30497
30698
|
"div",
|
30498
30699
|
__spreadProps(__spreadValues(__spreadValues({
|
30499
30700
|
ref: provided.innerRef
|
30500
30701
|
}, provided.draggableProps), provided.dragHandleProps), {
|
30501
|
-
className:
|
30702
|
+
className: getClassName17({
|
30502
30703
|
isSelected,
|
30503
30704
|
isModifierHeld,
|
30504
30705
|
isDragging: snapshot.isDragging,
|
@@ -30507,7 +30708,7 @@ var DraggableComponent = ({
|
|
30507
30708
|
indicativeHover
|
30508
30709
|
}),
|
30509
30710
|
style: __spreadProps(__spreadValues(__spreadValues({}, style), provided.draggableProps.style), {
|
30510
|
-
cursor: isModifierHeld ? "initial" : "grab"
|
30711
|
+
cursor: isModifierHeld || isDragDisabled ? "initial" : "grab"
|
30511
30712
|
}),
|
30512
30713
|
onMouseOver,
|
30513
30714
|
onMouseOut,
|
@@ -30516,34 +30717,33 @@ var DraggableComponent = ({
|
|
30516
30717
|
onClick,
|
30517
30718
|
children: [
|
30518
30719
|
debug,
|
30519
|
-
isLoading && /* @__PURE__ */ (0,
|
30520
|
-
/* @__PURE__ */ (0,
|
30720
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Loader, {}) }),
|
30721
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30521
30722
|
"div",
|
30522
30723
|
{
|
30523
|
-
className:
|
30724
|
+
className: getClassName17("actionsOverlay"),
|
30524
30725
|
style: {
|
30525
30726
|
top: actionsOverlayTop / zoomConfig.zoom
|
30526
30727
|
},
|
30527
|
-
children: /* @__PURE__ */ (0,
|
30728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
30528
30729
|
"div",
|
30529
30730
|
{
|
30530
|
-
className:
|
30731
|
+
className: getClassName17("actions"),
|
30531
30732
|
style: {
|
30532
30733
|
transform: `scale(${1 / zoomConfig.zoom}`,
|
30533
30734
|
top: actionsTop / zoomConfig.zoom,
|
30534
30735
|
right: actionsRight / zoomConfig.zoom
|
30535
30736
|
},
|
30536
|
-
children: [
|
30537
|
-
|
30538
|
-
/* @__PURE__ */ (0,
|
30539
|
-
|
30540
|
-
]
|
30737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(CustomActionBar, { label, children: [
|
30738
|
+
permissions && permissions.duplicate && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar.Action, { onClick: onDuplicate, label: "Duplicate", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Copy, { size: 16 }) }),
|
30739
|
+
permissions && permissions.delete && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ActionBar.Action, { onClick: onDelete, label: "Delete", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Trash, { size: 16 }) })
|
30740
|
+
] })
|
30541
30741
|
}
|
30542
30742
|
)
|
30543
30743
|
}
|
30544
30744
|
),
|
30545
|
-
/* @__PURE__ */ (0,
|
30546
|
-
/* @__PURE__ */ (0,
|
30745
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("overlay") }),
|
30746
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: getClassName17("contents"), children })
|
30547
30747
|
]
|
30548
30748
|
})
|
30549
30749
|
)
|
@@ -30554,11 +30754,11 @@ var DraggableComponent = ({
|
|
30554
30754
|
|
30555
30755
|
// css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css#css-module
|
30556
30756
|
init_react_import();
|
30557
|
-
var
|
30757
|
+
var styles_module_default12 = { "DropZone": "_DropZone_djoti_1", "DropZone-content": "_DropZone-content_djoti_10", "DropZone--userIsDragging": "_DropZone--userIsDragging_djoti_15", "DropZone--draggingOverArea": "_DropZone--draggingOverArea_djoti_19", "DropZone--draggingNewComponent": "_DropZone--draggingNewComponent_djoti_20", "DropZone--isAreaSelected": "_DropZone--isAreaSelected_djoti_26", "DropZone--hoveringOverArea": "_DropZone--hoveringOverArea_djoti_27", "DropZone--isDisabled": "_DropZone--isDisabled_djoti_28", "DropZone--isRootZone": "_DropZone--isRootZone_djoti_29", "DropZone--hasChildren": "_DropZone--hasChildren_djoti_30", "DropZone--isDestination": "_DropZone--isDestination_djoti_40", "DropZone-item": "_DropZone-item_djoti_52", "DropZone-hitbox": "_DropZone-hitbox_djoti_56" };
|
30558
30758
|
|
30559
30759
|
// components/DropZone/context.tsx
|
30560
30760
|
init_react_import();
|
30561
|
-
var
|
30761
|
+
var import_react16 = require("react");
|
30562
30762
|
var import_use_debounce2 = require("use-debounce");
|
30563
30763
|
|
30564
30764
|
// lib/get-zone-id.ts
|
@@ -30574,30 +30774,30 @@ var getZoneId = (zoneCompound) => {
|
|
30574
30774
|
};
|
30575
30775
|
|
30576
30776
|
// components/DropZone/context.tsx
|
30577
|
-
var
|
30578
|
-
var dropZoneContext = (0,
|
30777
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
30778
|
+
var dropZoneContext = (0, import_react16.createContext)(null);
|
30579
30779
|
var DropZoneProvider = ({
|
30580
30780
|
children,
|
30581
30781
|
value
|
30582
30782
|
}) => {
|
30583
|
-
const [hoveringArea, setHoveringArea] = (0,
|
30584
|
-
const [hoveringZone, setHoveringZone] = (0,
|
30783
|
+
const [hoveringArea, setHoveringArea] = (0, import_react16.useState)(null);
|
30784
|
+
const [hoveringZone, setHoveringZone] = (0, import_react16.useState)(
|
30585
30785
|
rootDroppableId
|
30586
30786
|
);
|
30587
|
-
const [hoveringComponent, setHoveringComponent] = (0,
|
30787
|
+
const [hoveringComponent, setHoveringComponent] = (0, import_react16.useState)();
|
30588
30788
|
const [hoveringAreaDb] = (0, import_use_debounce2.useDebounce)(hoveringArea, 75, { leading: false });
|
30589
|
-
const [areasWithZones, setAreasWithZones] = (0,
|
30789
|
+
const [areasWithZones, setAreasWithZones] = (0, import_react16.useState)(
|
30590
30790
|
{}
|
30591
30791
|
);
|
30592
|
-
const [activeZones, setActiveZones] = (0,
|
30792
|
+
const [activeZones, setActiveZones] = (0, import_react16.useState)({});
|
30593
30793
|
const { dispatch = null } = value ? value : {};
|
30594
|
-
const registerZoneArea = (0,
|
30794
|
+
const registerZoneArea = (0, import_react16.useCallback)(
|
30595
30795
|
(area) => {
|
30596
30796
|
setAreasWithZones((latest) => __spreadProps(__spreadValues({}, latest), { [area]: true }));
|
30597
30797
|
},
|
30598
30798
|
[setAreasWithZones]
|
30599
30799
|
);
|
30600
|
-
const registerZone = (0,
|
30800
|
+
const registerZone = (0, import_react16.useCallback)(
|
30601
30801
|
(zoneCompound) => {
|
30602
30802
|
if (!dispatch) {
|
30603
30803
|
return;
|
@@ -30610,7 +30810,7 @@ var DropZoneProvider = ({
|
|
30610
30810
|
},
|
30611
30811
|
[setActiveZones, dispatch]
|
30612
30812
|
);
|
30613
|
-
const unregisterZone = (0,
|
30813
|
+
const unregisterZone = (0, import_react16.useCallback)(
|
30614
30814
|
(zoneCompound) => {
|
30615
30815
|
if (!dispatch) {
|
30616
30816
|
return;
|
@@ -30625,8 +30825,8 @@ var DropZoneProvider = ({
|
|
30625
30825
|
},
|
30626
30826
|
[setActiveZones, dispatch]
|
30627
30827
|
);
|
30628
|
-
const [pathData, setPathData] = (0,
|
30629
|
-
const registerPath = (0,
|
30828
|
+
const [pathData, setPathData] = (0, import_react16.useState)();
|
30829
|
+
const registerPath = (0, import_react16.useCallback)(
|
30630
30830
|
(selector) => {
|
30631
30831
|
if (!(value == null ? void 0 : value.data)) {
|
30632
30832
|
return;
|
@@ -30651,8 +30851,8 @@ var DropZoneProvider = ({
|
|
30651
30851
|
},
|
30652
30852
|
[value, setPathData]
|
30653
30853
|
);
|
30654
|
-
const [zoneWillDrag, setZoneWillDrag] = (0,
|
30655
|
-
return /* @__PURE__ */ (0,
|
30854
|
+
const [zoneWillDrag, setZoneWillDrag] = (0, import_react16.useState)("");
|
30855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: value && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
30656
30856
|
dropZoneContext.Provider,
|
30657
30857
|
{
|
30658
30858
|
value: __spreadValues({
|
@@ -30678,12 +30878,12 @@ var DropZoneProvider = ({
|
|
30678
30878
|
};
|
30679
30879
|
|
30680
30880
|
// components/DropZone/index.tsx
|
30681
|
-
var
|
30682
|
-
var
|
30881
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
30882
|
+
var getClassName18 = get_class_name_factory_default("DropZone", styles_module_default12);
|
30683
30883
|
function DropZoneEdit({ zone, allow, disallow, style }) {
|
30684
30884
|
var _a;
|
30685
30885
|
const appContext2 = useAppContext();
|
30686
|
-
const ctx = (0,
|
30886
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30687
30887
|
const {
|
30688
30888
|
// These all need setting via context
|
30689
30889
|
data,
|
@@ -30702,12 +30902,12 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30702
30902
|
} = ctx || {};
|
30703
30903
|
let content = data.content || [];
|
30704
30904
|
let zoneCompound = rootDroppableId;
|
30705
|
-
(0,
|
30905
|
+
(0, import_react17.useEffect)(() => {
|
30706
30906
|
if (areaId && registerZoneArea) {
|
30707
30907
|
registerZoneArea(areaId);
|
30708
30908
|
}
|
30709
30909
|
}, [areaId]);
|
30710
|
-
(0,
|
30910
|
+
(0, import_react17.useEffect)(() => {
|
30711
30911
|
if (ctx == null ? void 0 : ctx.registerZone) {
|
30712
30912
|
ctx == null ? void 0 : ctx.registerZone(zoneCompound);
|
30713
30913
|
}
|
@@ -30733,7 +30933,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30733
30933
|
const draggingOverArea = userIsDragging && zoneArea === draggedSourceArea;
|
30734
30934
|
const draggingNewComponent = draggedSourceId == null ? void 0 : draggedSourceId.startsWith("component-list");
|
30735
30935
|
if (!(ctx == null ? void 0 : ctx.config) || !ctx.setHoveringArea || !ctx.setHoveringZone || !ctx.setHoveringComponent || !ctx.setItemSelector || !ctx.registerPath || !ctx.dispatch) {
|
30736
|
-
return /* @__PURE__ */ (0,
|
30936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: "DropZone requires context to work." });
|
30737
30937
|
}
|
30738
30938
|
const {
|
30739
30939
|
hoveringArea = "root",
|
@@ -30774,10 +30974,10 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30774
30974
|
}
|
30775
30975
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
30776
30976
|
const isAreaSelected = selectedItem && zoneArea === selectedItem.props.id;
|
30777
|
-
return /* @__PURE__ */ (0,
|
30977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30778
30978
|
"div",
|
30779
30979
|
{
|
30780
|
-
className:
|
30980
|
+
className: getClassName18({
|
30781
30981
|
isRootZone,
|
30782
30982
|
userIsDragging,
|
30783
30983
|
draggingOverArea,
|
@@ -30791,17 +30991,17 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30791
30991
|
onMouseUp: () => {
|
30792
30992
|
setZoneWillDrag("");
|
30793
30993
|
},
|
30794
|
-
children: /* @__PURE__ */ (0,
|
30994
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30795
30995
|
Droppable,
|
30796
30996
|
{
|
30797
30997
|
droppableId: zoneCompound,
|
30798
30998
|
direction: "vertical",
|
30799
30999
|
isDropDisabled: !isEnabled,
|
30800
31000
|
children: (provided, snapshot) => {
|
30801
|
-
return /* @__PURE__ */ (0,
|
31001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
30802
31002
|
"div",
|
30803
31003
|
__spreadProps(__spreadValues({}, (provided || { droppableProps: {} }).droppableProps), {
|
30804
|
-
className:
|
31004
|
+
className: getClassName18("content"),
|
30805
31005
|
ref: provided == null ? void 0 : provided.innerRef,
|
30806
31006
|
style,
|
30807
31007
|
id: zoneCompound,
|
@@ -30828,25 +31028,34 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30828
31028
|
"draggable-"
|
30829
31029
|
)[1] === componentId;
|
30830
31030
|
const containsZone = areasWithZones ? areasWithZones[componentId] : false;
|
30831
|
-
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0,
|
31031
|
+
const Render2 = config.components[item.type] ? config.components[item.type].render : () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { padding: 48, textAlign: "center" }, children: [
|
30832
31032
|
"No configuration for ",
|
30833
31033
|
item.type
|
30834
31034
|
] });
|
30835
31035
|
const componentConfig = config.components[item.type];
|
30836
31036
|
const label = (_b = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _b : item.type.toString();
|
30837
|
-
|
31037
|
+
const canDrag = getPermissions({
|
31038
|
+
selectedItem: getItem(
|
31039
|
+
{ index: i, zone: zoneCompound },
|
31040
|
+
appContext2.state.data
|
31041
|
+
),
|
31042
|
+
config: appContext2.config,
|
31043
|
+
globalPermissions: appContext2.globalPermissions || {},
|
31044
|
+
appState: appContext2.state
|
31045
|
+
}).drag;
|
31046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
30838
31047
|
"div",
|
30839
31048
|
{
|
30840
|
-
className:
|
31049
|
+
className: getClassName18("item"),
|
30841
31050
|
style: { zIndex: isDragging ? 1 : void 0 },
|
30842
31051
|
children: [
|
30843
|
-
/* @__PURE__ */ (0,
|
31052
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30844
31053
|
DropZoneProvider,
|
30845
31054
|
{
|
30846
31055
|
value: __spreadProps(__spreadValues({}, ctx), {
|
30847
31056
|
areaId: componentId
|
30848
31057
|
}),
|
30849
|
-
children: /* @__PURE__ */ (0,
|
31058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30850
31059
|
DraggableComponent,
|
30851
31060
|
{
|
30852
31061
|
label,
|
@@ -30855,6 +31064,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30855
31064
|
isSelected,
|
30856
31065
|
isLocked: userIsDragging,
|
30857
31066
|
forceHover: hoveringComponent === componentId && !userIsDragging,
|
31067
|
+
isDragDisabled: !canDrag,
|
30858
31068
|
indicativeHover: userIsDragging && containsZone && hoveringArea === componentId,
|
30859
31069
|
isLoading: (_c = appContext2.componentState[componentId]) == null ? void 0 : _c.loading,
|
30860
31070
|
onMount: () => {
|
@@ -30913,15 +31123,15 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30913
31123
|
style: {
|
30914
31124
|
pointerEvents: userIsDragging && draggingNewComponent ? "all" : void 0
|
30915
31125
|
},
|
30916
|
-
children: /* @__PURE__ */ (0,
|
31126
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: getClassName18("renderWrapper"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Render2, __spreadValues({}, defaultedProps)) })
|
30917
31127
|
}
|
30918
31128
|
)
|
30919
31129
|
}
|
30920
31130
|
),
|
30921
|
-
userIsDragging && /* @__PURE__ */ (0,
|
31131
|
+
userIsDragging && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30922
31132
|
"div",
|
30923
31133
|
{
|
30924
|
-
className:
|
31134
|
+
className: getClassName18("hitbox"),
|
30925
31135
|
onMouseOver: (e) => {
|
30926
31136
|
e.stopPropagation();
|
30927
31137
|
setHoveringArea(zoneArea);
|
@@ -30935,7 +31145,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30935
31145
|
);
|
30936
31146
|
}),
|
30937
31147
|
provided == null ? void 0 : provided.placeholder,
|
30938
|
-
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0,
|
31148
|
+
(snapshot == null ? void 0 : snapshot.isDraggingOver) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30939
31149
|
"div",
|
30940
31150
|
{
|
30941
31151
|
"data-puck-placeholder": true,
|
@@ -30956,7 +31166,7 @@ function DropZoneEdit({ zone, allow, disallow, style }) {
|
|
30956
31166
|
);
|
30957
31167
|
}
|
30958
31168
|
function DropZoneRender({ zone }) {
|
30959
|
-
const ctx = (0,
|
31169
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30960
31170
|
const { data, areaId = "root", config } = ctx || {};
|
30961
31171
|
let zoneCompound = rootDroppableId;
|
30962
31172
|
let content = (data == null ? void 0 : data.content) || [];
|
@@ -30967,14 +31177,14 @@ function DropZoneRender({ zone }) {
|
|
30967
31177
|
zoneCompound = `${areaId}:${zone}`;
|
30968
31178
|
content = setupZone(data, zoneCompound).zones[zoneCompound];
|
30969
31179
|
}
|
30970
|
-
return /* @__PURE__ */ (0,
|
31180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: content.map((item) => {
|
30971
31181
|
const Component = config.components[item.type];
|
30972
31182
|
if (Component) {
|
30973
|
-
return /* @__PURE__ */ (0,
|
31183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30974
31184
|
DropZoneProvider,
|
30975
31185
|
{
|
30976
31186
|
value: { data, config, areaId: item.props.id },
|
30977
|
-
children: /* @__PURE__ */ (0,
|
31187
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
30978
31188
|
Component.render,
|
30979
31189
|
__spreadProps(__spreadValues({}, item.props), {
|
30980
31190
|
puck: { renderDropZone: DropZone }
|
@@ -30988,20 +31198,20 @@ function DropZoneRender({ zone }) {
|
|
30988
31198
|
}) });
|
30989
31199
|
}
|
30990
31200
|
function DropZone(props) {
|
30991
|
-
const ctx = (0,
|
31201
|
+
const ctx = (0, import_react17.useContext)(dropZoneContext);
|
30992
31202
|
if ((ctx == null ? void 0 : ctx.mode) === "edit") {
|
30993
|
-
return /* @__PURE__ */ (0,
|
31203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneEdit, __spreadValues({}, props));
|
30994
31204
|
}
|
30995
|
-
return /* @__PURE__ */ (0,
|
31205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropZoneRender, __spreadValues({}, props));
|
30996
31206
|
}
|
30997
31207
|
|
30998
31208
|
// components/Puck/index.tsx
|
30999
31209
|
init_react_import();
|
31000
|
-
var
|
31210
|
+
var import_react31 = require("react");
|
31001
31211
|
|
31002
31212
|
// lib/use-placeholder-style.ts
|
31003
31213
|
init_react_import();
|
31004
|
-
var
|
31214
|
+
var import_react18 = require("react");
|
31005
31215
|
|
31006
31216
|
// lib/get-frame.ts
|
31007
31217
|
init_react_import();
|
@@ -31016,7 +31226,7 @@ var getFrame = () => {
|
|
31016
31226
|
// lib/use-placeholder-style.ts
|
31017
31227
|
var usePlaceholderStyle = () => {
|
31018
31228
|
const queryAttr = "data-rfd-drag-handle-draggable-id";
|
31019
|
-
const [placeholderStyle, setPlaceholderStyle] = (0,
|
31229
|
+
const [placeholderStyle, setPlaceholderStyle] = (0, import_react18.useState)();
|
31020
31230
|
const onDragStartOrUpdate = (draggedItem) => {
|
31021
31231
|
var _a;
|
31022
31232
|
const draggableId = draggedItem.draggableId;
|
@@ -31065,11 +31275,11 @@ init_react_import();
|
|
31065
31275
|
|
31066
31276
|
// css-module:/home/runner/work/puck/puck/packages/core/components/SidebarSection/styles.module.css#css-module
|
31067
31277
|
init_react_import();
|
31068
|
-
var
|
31278
|
+
var styles_module_default13 = { "SidebarSection": "_SidebarSection_125qe_1", "SidebarSection-title": "_SidebarSection-title_125qe_12", "SidebarSection--noBorderTop": "_SidebarSection--noBorderTop_125qe_20", "SidebarSection-content": "_SidebarSection-content_125qe_24", "SidebarSection--noPadding": "_SidebarSection--noPadding_125qe_28", "SidebarSection-breadcrumbLabel": "_SidebarSection-breadcrumbLabel_125qe_41", "SidebarSection-breadcrumbs": "_SidebarSection-breadcrumbs_125qe_70", "SidebarSection-breadcrumb": "_SidebarSection-breadcrumb_125qe_41", "SidebarSection-heading": "_SidebarSection-heading_125qe_82", "SidebarSection-loadingOverlay": "_SidebarSection-loadingOverlay_125qe_86" };
|
31069
31279
|
|
31070
31280
|
// lib/use-breadcrumbs.ts
|
31071
31281
|
init_react_import();
|
31072
|
-
var
|
31282
|
+
var import_react19 = require("react");
|
31073
31283
|
var convertPathDataToBreadcrumbs = (selectedItem, pathData, data) => {
|
31074
31284
|
const id = selectedItem ? selectedItem == null ? void 0 : selectedItem.props.id : "";
|
31075
31285
|
const currentPathData = pathData && id && pathData[id] ? __spreadValues({}, pathData[id]) : { label: "Page", path: [] };
|
@@ -31119,8 +31329,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
31119
31329
|
state: { data },
|
31120
31330
|
selectedItem
|
31121
31331
|
} = useAppContext();
|
31122
|
-
const dzContext = (0,
|
31123
|
-
return (0,
|
31332
|
+
const dzContext = (0, import_react19.useContext)(dropZoneContext);
|
31333
|
+
return (0, import_react19.useMemo)(() => {
|
31124
31334
|
const breadcrumbs = convertPathDataToBreadcrumbs(
|
31125
31335
|
selectedItem,
|
31126
31336
|
dzContext == null ? void 0 : dzContext.pathData,
|
@@ -31134,8 +31344,8 @@ var useBreadcrumbs = (renderCount) => {
|
|
31134
31344
|
};
|
31135
31345
|
|
31136
31346
|
// components/SidebarSection/index.tsx
|
31137
|
-
var
|
31138
|
-
var
|
31347
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
31348
|
+
var getClassName19 = get_class_name_factory_default("SidebarSection", styles_module_default13);
|
31139
31349
|
var SidebarSection = ({
|
31140
31350
|
children,
|
31141
31351
|
title,
|
@@ -31147,28 +31357,28 @@ var SidebarSection = ({
|
|
31147
31357
|
}) => {
|
31148
31358
|
const { setUi } = useAppContext();
|
31149
31359
|
const breadcrumbs = useBreadcrumbs(1);
|
31150
|
-
return /* @__PURE__ */ (0,
|
31360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
31151
31361
|
"div",
|
31152
31362
|
{
|
31153
|
-
className:
|
31363
|
+
className: getClassName19({ noBorderTop, noPadding }),
|
31154
31364
|
style: { background },
|
31155
31365
|
children: [
|
31156
|
-
/* @__PURE__ */ (0,
|
31157
|
-
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0,
|
31158
|
-
/* @__PURE__ */ (0,
|
31366
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("title"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumbs"), children: [
|
31367
|
+
showBreadcrumbs ? breadcrumbs.map((breadcrumb, i) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: getClassName19("breadcrumb"), children: [
|
31368
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
31159
31369
|
"button",
|
31160
31370
|
{
|
31161
|
-
className:
|
31371
|
+
className: getClassName19("breadcrumbLabel"),
|
31162
31372
|
onClick: () => setUi({ itemSelector: breadcrumb.selector }),
|
31163
31373
|
children: breadcrumb.label
|
31164
31374
|
}
|
31165
31375
|
),
|
31166
|
-
/* @__PURE__ */ (0,
|
31376
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronRight, { size: 16 })
|
31167
31377
|
] }, i)) : null,
|
31168
|
-
/* @__PURE__ */ (0,
|
31378
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("heading"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Heading, { rank: 2, size: "xs", children: title }) })
|
31169
31379
|
] }) }),
|
31170
|
-
/* @__PURE__ */ (0,
|
31171
|
-
isLoading && /* @__PURE__ */ (0,
|
31380
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("content"), children }),
|
31381
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: getClassName19("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Loader, { size: 32 }) })
|
31172
31382
|
]
|
31173
31383
|
}
|
31174
31384
|
);
|
@@ -31537,25 +31747,11 @@ var flushZones = (appState) => {
|
|
31537
31747
|
|
31538
31748
|
// lib/use-resolved-data.ts
|
31539
31749
|
init_react_import();
|
31540
|
-
var
|
31750
|
+
var import_react20 = require("react");
|
31541
31751
|
|
31542
31752
|
// lib/resolve-component-data.ts
|
31543
31753
|
init_react_import();
|
31544
|
-
|
31545
|
-
// lib/get-changed.ts
|
31546
|
-
init_react_import();
|
31547
|
-
var getChanged = (newItem, oldItem) => {
|
31548
|
-
return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
|
31549
|
-
const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
|
31550
|
-
const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
|
31551
|
-
return __spreadProps(__spreadValues({}, acc), {
|
31552
|
-
[item]: oldItemProps[item] !== newItemProps[item]
|
31553
|
-
});
|
31554
|
-
}, {}) : {};
|
31555
|
-
};
|
31556
|
-
|
31557
|
-
// lib/resolve-component-data.ts
|
31558
|
-
var cache = { lastChange: {} };
|
31754
|
+
var cache2 = { lastChange: {} };
|
31559
31755
|
var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
31560
31756
|
return yield Promise.all(
|
31561
31757
|
content.map((item) => __async(void 0, null, function* () {
|
@@ -31571,7 +31767,7 @@ var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) =>
|
|
31571
31767
|
var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
|
31572
31768
|
const configForItem = config.components[item.type];
|
31573
31769
|
if (configForItem.resolveData) {
|
31574
|
-
const { item: oldItem = {}, resolved = {} } =
|
31770
|
+
const { item: oldItem = {}, resolved = {} } = cache2.lastChange[item.props.id] || {};
|
31575
31771
|
if (item && item === oldItem) {
|
31576
31772
|
return resolved;
|
31577
31773
|
}
|
@@ -31588,7 +31784,7 @@ var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __asy
|
|
31588
31784
|
if (Object.keys(newReadOnly).length) {
|
31589
31785
|
resolvedItem.readOnly = newReadOnly;
|
31590
31786
|
}
|
31591
|
-
|
31787
|
+
cache2.lastChange[item.props.id] = {
|
31592
31788
|
item,
|
31593
31789
|
resolved: resolvedItem
|
31594
31790
|
};
|
@@ -31620,20 +31816,20 @@ var applyDynamicProps = (data, dynamicProps, rootData) => {
|
|
31620
31816
|
|
31621
31817
|
// lib/resolve-root-data.ts
|
31622
31818
|
init_react_import();
|
31623
|
-
var
|
31819
|
+
var cache3 = {};
|
31624
31820
|
var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
31625
31821
|
var _a, _b, _c, _d, _e;
|
31626
31822
|
if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
|
31627
|
-
if (((_b =
|
31628
|
-
return
|
31823
|
+
if (((_b = cache3.lastChange) == null ? void 0 : _b.original) === data.root) {
|
31824
|
+
return cache3.lastChange.resolved;
|
31629
31825
|
}
|
31630
|
-
const changed = getChanged(data.root, (_c =
|
31826
|
+
const changed = getChanged(data.root, (_c = cache3.lastChange) == null ? void 0 : _c.original);
|
31631
31827
|
const rootWithProps = data.root;
|
31632
31828
|
const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
|
31633
31829
|
changed,
|
31634
|
-
lastData: ((_d =
|
31830
|
+
lastData: ((_d = cache3.lastChange) == null ? void 0 : _d.original) || {}
|
31635
31831
|
});
|
31636
|
-
|
31832
|
+
cache3.lastChange = {
|
31637
31833
|
original: data.root,
|
31638
31834
|
resolved: resolvedRoot
|
31639
31835
|
};
|
@@ -31646,13 +31842,13 @@ var resolveRootData = (data, config) => __async(void 0, null, function* () {
|
|
31646
31842
|
|
31647
31843
|
// lib/use-resolved-data.ts
|
31648
31844
|
var useResolvedData = (appState, config, dispatch) => {
|
31649
|
-
const [{ resolverKey, newAppState }, setResolverState] = (0,
|
31845
|
+
const [{ resolverKey, newAppState }, setResolverState] = (0, import_react20.useState)({
|
31650
31846
|
resolverKey: 0,
|
31651
31847
|
newAppState: appState
|
31652
31848
|
});
|
31653
|
-
const [componentState, setComponentState] = (0,
|
31849
|
+
const [componentState, setComponentState] = (0, import_react20.useState)({});
|
31654
31850
|
const deferredSetStates = {};
|
31655
|
-
const setComponentLoading = (0,
|
31851
|
+
const setComponentLoading = (0, import_react20.useCallback)(
|
31656
31852
|
(id, loading, defer2 = 0) => {
|
31657
31853
|
if (deferredSetStates[id]) {
|
31658
31854
|
clearTimeout(deferredSetStates[id]);
|
@@ -31722,10 +31918,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31722
31918
|
});
|
31723
31919
|
yield Promise.all(promises);
|
31724
31920
|
});
|
31725
|
-
(0,
|
31921
|
+
(0, import_react20.useEffect)(() => {
|
31726
31922
|
runResolvers();
|
31727
31923
|
}, [resolverKey]);
|
31728
|
-
const resolveData = (0,
|
31924
|
+
const resolveData = (0, import_react20.useCallback)((newAppState2 = appState) => {
|
31729
31925
|
setResolverState((curr) => ({
|
31730
31926
|
resolverKey: curr.resolverKey + 1,
|
31731
31927
|
newAppState: newAppState2
|
@@ -31742,11 +31938,11 @@ init_react_import();
|
|
31742
31938
|
|
31743
31939
|
// css-module:/home/runner/work/puck/puck/packages/core/components/MenuBar/styles.module.css#css-module
|
31744
31940
|
init_react_import();
|
31745
|
-
var
|
31941
|
+
var styles_module_default14 = { "MenuBar": "_MenuBar_8pf8c_1", "MenuBar--menuOpen": "_MenuBar--menuOpen_8pf8c_14", "MenuBar-inner": "_MenuBar-inner_8pf8c_29", "MenuBar-history": "_MenuBar-history_8pf8c_45" };
|
31746
31942
|
|
31747
31943
|
// components/MenuBar/index.tsx
|
31748
|
-
var
|
31749
|
-
var
|
31944
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
31945
|
+
var getClassName20 = get_class_name_factory_default("MenuBar", styles_module_default14);
|
31750
31946
|
var MenuBar = ({
|
31751
31947
|
appState,
|
31752
31948
|
data = { content: [], root: {} },
|
@@ -31760,10 +31956,10 @@ var MenuBar = ({
|
|
31760
31956
|
history: { back, forward, historyStore }
|
31761
31957
|
} = useAppContext();
|
31762
31958
|
const { hasFuture = false, hasPast = false } = historyStore || {};
|
31763
|
-
return /* @__PURE__ */ (0,
|
31959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
31764
31960
|
"div",
|
31765
31961
|
{
|
31766
|
-
className:
|
31962
|
+
className: getClassName20({ menuOpen }),
|
31767
31963
|
onClick: (event) => {
|
31768
31964
|
var _a;
|
31769
31965
|
const element = event.target;
|
@@ -31774,12 +31970,12 @@ var MenuBar = ({
|
|
31774
31970
|
setMenuOpen(false);
|
31775
31971
|
}
|
31776
31972
|
},
|
31777
|
-
children: /* @__PURE__ */ (0,
|
31778
|
-
/* @__PURE__ */ (0,
|
31779
|
-
/* @__PURE__ */ (0,
|
31780
|
-
/* @__PURE__ */ (0,
|
31973
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("inner"), children: [
|
31974
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getClassName20("history"), children: [
|
31975
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "undo", disabled: !hasPast, onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Undo2, { size: 21 }) }),
|
31976
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { title: "redo", disabled: !hasFuture, onClick: forward, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Redo2, { size: 21 }) })
|
31781
31977
|
] }),
|
31782
|
-
/* @__PURE__ */ (0,
|
31978
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children: renderHeaderActions && renderHeaderActions({
|
31783
31979
|
state: appState,
|
31784
31980
|
dispatch
|
31785
31981
|
}) })
|
@@ -31790,26 +31986,26 @@ var MenuBar = ({
|
|
31790
31986
|
|
31791
31987
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/styles.module.css#css-module
|
31792
31988
|
init_react_import();
|
31793
|
-
var
|
31989
|
+
var styles_module_default15 = { "Puck": "_Puck_1g88c_19", "Puck-portal": "_Puck-portal_1g88c_24", "PuckLayout": "_PuckLayout_1g88c_31", "PuckLayout-inner": "_PuckLayout-inner_1g88c_39", "PuckLayout--mounted": "_PuckLayout--mounted_1g88c_51", "PuckLayout--leftSideBarVisible": "_PuckLayout--leftSideBarVisible_1g88c_55", "PuckLayout--rightSideBarVisible": "_PuckLayout--rightSideBarVisible_1g88c_61", "PuckLayout-mounted": "_PuckLayout-mounted_1g88c_75", "PuckLayout-header": "_PuckLayout-header_1g88c_116", "PuckLayout-headerInner": "_PuckLayout-headerInner_1g88c_125", "PuckLayout-headerToggle": "_PuckLayout-headerToggle_1g88c_135", "PuckLayout-rightSideBarToggle": "_PuckLayout-rightSideBarToggle_1g88c_142", "PuckLayout-leftSideBarToggle": "_PuckLayout-leftSideBarToggle_1g88c_143", "PuckLayout-headerTitle": "_PuckLayout-headerTitle_1g88c_147", "PuckLayout-headerPath": "_PuckLayout-headerPath_1g88c_151", "PuckLayout-headerTools": "_PuckLayout-headerTools_1g88c_158", "PuckLayout-menuButton": "_PuckLayout-menuButton_1g88c_164", "PuckLayout--menuOpen": "_PuckLayout--menuOpen_1g88c_169", "PuckLayout-leftSideBar": "_PuckLayout-leftSideBar_1g88c_143", "PuckLayout-rightSideBar": "_PuckLayout-rightSideBar_1g88c_142" };
|
31794
31990
|
|
31795
31991
|
// components/Puck/components/Fields/index.tsx
|
31796
31992
|
init_react_import();
|
31797
31993
|
|
31798
31994
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Fields/styles.module.css#css-module
|
31799
31995
|
init_react_import();
|
31800
|
-
var
|
31996
|
+
var styles_module_default16 = { "PuckFields": "_PuckFields_jp3lw_1", "PuckFields--isLoading": "_PuckFields--isLoading_jp3lw_6", "PuckFields-loadingOverlay": "_PuckFields-loadingOverlay_jp3lw_10", "PuckFields-loadingOverlayInner": "_PuckFields-loadingOverlayInner_jp3lw_25" };
|
31801
31997
|
|
31802
31998
|
// components/Puck/components/Fields/index.tsx
|
31803
|
-
var
|
31804
|
-
var
|
31805
|
-
var
|
31999
|
+
var import_react21 = require("react");
|
32000
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
32001
|
+
var getClassName21 = get_class_name_factory_default("PuckFields", styles_module_default16);
|
31806
32002
|
var defaultPageFields = {
|
31807
32003
|
title: { type: "text" }
|
31808
32004
|
};
|
31809
32005
|
var DefaultFields = ({
|
31810
32006
|
children
|
31811
32007
|
}) => {
|
31812
|
-
return /* @__PURE__ */ (0,
|
32008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children });
|
31813
32009
|
};
|
31814
32010
|
var useResolvedFields = () => {
|
31815
32011
|
var _a;
|
@@ -31819,14 +32015,14 @@ var useResolvedFields = () => {
|
|
31819
32015
|
const componentConfig = selectedItem ? config.components[selectedItem.type] : null;
|
31820
32016
|
const defaultFields = selectedItem ? componentConfig == null ? void 0 : componentConfig.fields : rootFields;
|
31821
32017
|
const rootProps = data.root.props || data.root;
|
31822
|
-
const [lastSelectedData, setLastSelectedData] = (0,
|
32018
|
+
const [lastSelectedData, setLastSelectedData] = (0, import_react21.useState)(
|
31823
32019
|
{}
|
31824
32020
|
);
|
31825
|
-
const [resolvedFields, setResolvedFields] = (0,
|
31826
|
-
const [fieldsLoading, setFieldsLoading] = (0,
|
32021
|
+
const [resolvedFields, setResolvedFields] = (0, import_react21.useState)(defaultFields || {});
|
32022
|
+
const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
|
31827
32023
|
const defaultResolveFields = (_componentData, _params) => defaultFields;
|
31828
32024
|
const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
|
31829
|
-
const resolveFields = (0,
|
32025
|
+
const resolveFields = (0, import_react21.useCallback)(
|
31830
32026
|
(..._0) => __async(void 0, [..._0], function* (fields = {}) {
|
31831
32027
|
var _a2, _b, _c;
|
31832
32028
|
const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : {};
|
@@ -31862,7 +32058,7 @@ var useResolvedFields = () => {
|
|
31862
32058
|
}),
|
31863
32059
|
[data, config, componentData, selectedItem, resolvedFields, state]
|
31864
32060
|
);
|
31865
|
-
(0,
|
32061
|
+
(0, import_react21.useEffect)(() => {
|
31866
32062
|
setFieldsLoading(true);
|
31867
32063
|
resolveFields(defaultFields).then((fields) => {
|
31868
32064
|
setResolvedFields(fields || {});
|
@@ -31880,7 +32076,8 @@ var Fields = () => {
|
|
31880
32076
|
config,
|
31881
32077
|
resolveData,
|
31882
32078
|
componentState,
|
31883
|
-
overrides
|
32079
|
+
overrides,
|
32080
|
+
globalPermissions
|
31884
32081
|
} = useAppContext();
|
31885
32082
|
const { data, ui } = state;
|
31886
32083
|
const { itemSelector } = ui;
|
@@ -31888,16 +32085,16 @@ var Fields = () => {
|
|
31888
32085
|
const componentResolving = selectedItem ? (_a = componentState[selectedItem == null ? void 0 : selectedItem.props.id]) == null ? void 0 : _a.loading : (_b = componentState["puck-root"]) == null ? void 0 : _b.loading;
|
31889
32086
|
const isLoading = fieldsResolving || componentResolving;
|
31890
32087
|
const rootProps = data.root.props || data.root;
|
31891
|
-
const Wrapper = (0,
|
31892
|
-
return /* @__PURE__ */ (0,
|
32088
|
+
const Wrapper = (0, import_react21.useMemo)(() => overrides.fields || DefaultFields, [overrides]);
|
32089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
31893
32090
|
"form",
|
31894
32091
|
{
|
31895
|
-
className:
|
32092
|
+
className: getClassName21(),
|
31896
32093
|
onSubmit: (e) => {
|
31897
32094
|
e.preventDefault();
|
31898
32095
|
},
|
31899
32096
|
children: [
|
31900
|
-
/* @__PURE__ */ (0,
|
32097
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Wrapper, { isLoading, itemSelector, children: Object.keys(fields).map((fieldName) => {
|
31901
32098
|
const field = fields[fieldName];
|
31902
32099
|
if (!(field == null ? void 0 : field.type)) return null;
|
31903
32100
|
const onChange = (value, updatedUi) => {
|
@@ -31964,13 +32161,19 @@ var Fields = () => {
|
|
31964
32161
|
};
|
31965
32162
|
if (selectedItem && itemSelector) {
|
31966
32163
|
const { readOnly = {} } = selectedItem;
|
31967
|
-
|
32164
|
+
const { edit } = getPermissions({
|
32165
|
+
selectedItem,
|
32166
|
+
config,
|
32167
|
+
globalPermissions: globalPermissions || {},
|
32168
|
+
appState: state
|
32169
|
+
});
|
32170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
31968
32171
|
AutoFieldPrivate,
|
31969
32172
|
{
|
31970
32173
|
field,
|
31971
32174
|
name: fieldName,
|
31972
32175
|
id: `${selectedItem.props.id}_${fieldName}`,
|
31973
|
-
readOnly: readOnly[fieldName],
|
32176
|
+
readOnly: !edit || readOnly[fieldName],
|
31974
32177
|
value: selectedItem.props[fieldName],
|
31975
32178
|
onChange
|
31976
32179
|
},
|
@@ -31978,7 +32181,7 @@ var Fields = () => {
|
|
31978
32181
|
);
|
31979
32182
|
} else {
|
31980
32183
|
const { readOnly = {} } = data.root;
|
31981
|
-
return /* @__PURE__ */ (0,
|
32184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
31982
32185
|
AutoFieldPrivate,
|
31983
32186
|
{
|
31984
32187
|
field,
|
@@ -31992,7 +32195,7 @@ var Fields = () => {
|
|
31992
32195
|
);
|
31993
32196
|
}
|
31994
32197
|
}) }),
|
31995
|
-
isLoading && /* @__PURE__ */ (0,
|
32198
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlay"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getClassName21("loadingOverlayInner"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Loader, { size: 16 }) }) })
|
31996
32199
|
]
|
31997
32200
|
}
|
31998
32201
|
);
|
@@ -32003,25 +32206,40 @@ init_react_import();
|
|
32003
32206
|
|
32004
32207
|
// lib/use-component-list.tsx
|
32005
32208
|
init_react_import();
|
32006
|
-
var
|
32209
|
+
var import_react22 = require("react");
|
32007
32210
|
|
32008
32211
|
// components/ComponentList/index.tsx
|
32009
32212
|
init_react_import();
|
32010
32213
|
|
32011
32214
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ComponentList/styles.module.css#css-module
|
32012
32215
|
init_react_import();
|
32013
|
-
var
|
32216
|
+
var styles_module_default17 = { "ComponentList": "_ComponentList_odh9d_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_odh9d_5", "ComponentList-content": "_ComponentList-content_odh9d_9", "ComponentList-title": "_ComponentList-title_odh9d_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_odh9d_53" };
|
32014
32217
|
|
32015
32218
|
// components/ComponentList/index.tsx
|
32016
|
-
var
|
32017
|
-
var
|
32219
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
32220
|
+
var getClassName22 = get_class_name_factory_default("ComponentList", styles_module_default17);
|
32018
32221
|
var ComponentListItem = ({
|
32019
32222
|
name,
|
32020
32223
|
label,
|
32021
32224
|
index
|
32022
32225
|
}) => {
|
32023
|
-
const { overrides } = useAppContext();
|
32024
|
-
|
32226
|
+
const { overrides, config, globalPermissions, state } = useAppContext();
|
32227
|
+
const canInsert = getPermissions({
|
32228
|
+
type: name,
|
32229
|
+
config,
|
32230
|
+
globalPermissions: globalPermissions || {},
|
32231
|
+
appState: state
|
32232
|
+
}).insert;
|
32233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32234
|
+
Drawer.Item,
|
32235
|
+
{
|
32236
|
+
label,
|
32237
|
+
name,
|
32238
|
+
index,
|
32239
|
+
isDragDisabled: !canInsert,
|
32240
|
+
children: overrides.componentItem
|
32241
|
+
}
|
32242
|
+
);
|
32025
32243
|
};
|
32026
32244
|
var ComponentList = ({
|
32027
32245
|
children,
|
@@ -32030,11 +32248,11 @@ var ComponentList = ({
|
|
32030
32248
|
}) => {
|
32031
32249
|
const { config, state, setUi } = useAppContext();
|
32032
32250
|
const { expanded = true } = state.ui.componentList[id] || {};
|
32033
|
-
return /* @__PURE__ */ (0,
|
32034
|
-
title && /* @__PURE__ */ (0,
|
32251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: getClassName22({ isExpanded: expanded }), children: [
|
32252
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
32035
32253
|
"button",
|
32036
32254
|
{
|
32037
|
-
className:
|
32255
|
+
className: getClassName22("title"),
|
32038
32256
|
onClick: () => setUi({
|
32039
32257
|
componentList: __spreadProps(__spreadValues({}, state.ui.componentList), {
|
32040
32258
|
[id]: __spreadProps(__spreadValues({}, state.ui.componentList[id]), {
|
@@ -32044,14 +32262,14 @@ var ComponentList = ({
|
|
32044
32262
|
}),
|
32045
32263
|
title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
|
32046
32264
|
children: [
|
32047
|
-
/* @__PURE__ */ (0,
|
32048
|
-
/* @__PURE__ */ (0,
|
32265
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: title }),
|
32266
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("titleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDown, { size: 12 }) })
|
32049
32267
|
]
|
32050
32268
|
}
|
32051
32269
|
),
|
32052
|
-
/* @__PURE__ */ (0,
|
32270
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getClassName22("content"), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Drawer, { droppableId: title, children: children || Object.keys(config.components).map((componentKey, i) => {
|
32053
32271
|
var _a;
|
32054
|
-
return /* @__PURE__ */ (0,
|
32272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
32055
32273
|
ComponentListItem,
|
32056
32274
|
{
|
32057
32275
|
label: (_a = config.components[componentKey]["label"]) != null ? _a : componentKey,
|
@@ -32066,10 +32284,10 @@ var ComponentList = ({
|
|
32066
32284
|
ComponentList.Item = ComponentListItem;
|
32067
32285
|
|
32068
32286
|
// lib/use-component-list.tsx
|
32069
|
-
var
|
32287
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
32070
32288
|
var useComponentList = (config, ui) => {
|
32071
|
-
const [componentList, setComponentList] = (0,
|
32072
|
-
(0,
|
32289
|
+
const [componentList, setComponentList] = (0, import_react22.useState)();
|
32290
|
+
(0, import_react22.useEffect)(() => {
|
32073
32291
|
var _a, _b, _c;
|
32074
32292
|
if (Object.keys(ui.componentList).length > 0) {
|
32075
32293
|
const matchedComponents = [];
|
@@ -32079,7 +32297,7 @@ var useComponentList = (config, ui) => {
|
|
32079
32297
|
if (category.visible === false || !category.components) {
|
32080
32298
|
return null;
|
32081
32299
|
}
|
32082
|
-
return /* @__PURE__ */ (0,
|
32300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32083
32301
|
ComponentList,
|
32084
32302
|
{
|
32085
32303
|
id: categoryKey,
|
@@ -32088,7 +32306,7 @@ var useComponentList = (config, ui) => {
|
|
32088
32306
|
var _a2;
|
32089
32307
|
matchedComponents.push(componentName);
|
32090
32308
|
const componentConf = config.components[componentName] || {};
|
32091
|
-
return /* @__PURE__ */ (0,
|
32309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32092
32310
|
ComponentList.Item,
|
32093
32311
|
{
|
32094
32312
|
label: (_a2 = componentConf["label"]) != null ? _a2 : componentName,
|
@@ -32108,7 +32326,7 @@ var useComponentList = (config, ui) => {
|
|
32108
32326
|
);
|
32109
32327
|
if (remainingComponents.length > 0 && !((_a = ui.componentList.other) == null ? void 0 : _a.components) && ((_b = ui.componentList.other) == null ? void 0 : _b.visible) !== false) {
|
32110
32328
|
_componentList.push(
|
32111
|
-
/* @__PURE__ */ (0,
|
32329
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32112
32330
|
ComponentList,
|
32113
32331
|
{
|
32114
32332
|
id: "other",
|
@@ -32116,7 +32334,7 @@ var useComponentList = (config, ui) => {
|
|
32116
32334
|
children: remainingComponents.map((componentName, i) => {
|
32117
32335
|
var _a2;
|
32118
32336
|
const componentConf = config.components[componentName] || {};
|
32119
|
-
return /* @__PURE__ */ (0,
|
32337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
32120
32338
|
ComponentList.Item,
|
32121
32339
|
{
|
32122
32340
|
name: componentName,
|
@@ -32138,25 +32356,25 @@ var useComponentList = (config, ui) => {
|
|
32138
32356
|
};
|
32139
32357
|
|
32140
32358
|
// components/Puck/components/Components/index.tsx
|
32141
|
-
var
|
32142
|
-
var
|
32359
|
+
var import_react23 = require("react");
|
32360
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
32143
32361
|
var Components = () => {
|
32144
32362
|
const { config, state, overrides } = useAppContext();
|
32145
32363
|
const componentList = useComponentList(config, state.ui);
|
32146
|
-
const Wrapper = (0,
|
32147
|
-
return /* @__PURE__ */ (0,
|
32364
|
+
const Wrapper = (0, import_react23.useMemo)(() => overrides.components || "div", [overrides]);
|
32365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Wrapper, { children: componentList ? componentList : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ComponentList, { id: "all" }) });
|
32148
32366
|
};
|
32149
32367
|
|
32150
32368
|
// components/Puck/components/Preview/index.tsx
|
32151
32369
|
init_react_import();
|
32152
|
-
var
|
32370
|
+
var import_react25 = require("react");
|
32153
32371
|
|
32154
32372
|
// components/AutoFrame/index.tsx
|
32155
32373
|
init_react_import();
|
32156
|
-
var
|
32374
|
+
var import_react24 = __toESM(require("react"));
|
32157
32375
|
var import_react_frame_component = __toESM(require("react-frame-component"));
|
32158
32376
|
var import_object_hash = __toESM(require("object-hash"));
|
32159
|
-
var
|
32377
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
32160
32378
|
var styleSelector = 'style, link[rel="stylesheet"]';
|
32161
32379
|
var collectStyles = (doc) => {
|
32162
32380
|
const collected = [];
|
@@ -32199,7 +32417,7 @@ var CopyHostStyles = ({
|
|
32199
32417
|
onStylesLoaded = () => null
|
32200
32418
|
}) => {
|
32201
32419
|
const { document: doc, window: win } = (0, import_react_frame_component.useFrame)();
|
32202
|
-
(0,
|
32420
|
+
(0, import_react24.useEffect)(() => {
|
32203
32421
|
if (!win || !doc) {
|
32204
32422
|
return () => {
|
32205
32423
|
};
|
@@ -32356,12 +32574,12 @@ var CopyHostStyles = ({
|
|
32356
32574
|
observer.disconnect();
|
32357
32575
|
};
|
32358
32576
|
}, []);
|
32359
|
-
return /* @__PURE__ */ (0,
|
32577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
|
32360
32578
|
};
|
32361
|
-
var AutoFrameComponent =
|
32579
|
+
var AutoFrameComponent = import_react24.default.forwardRef(
|
32362
32580
|
function(_a, ref) {
|
32363
32581
|
var _b = _a, { children, debug, onStylesLoaded } = _b, props = __objRest(_b, ["children", "debug", "onStylesLoaded"]);
|
32364
|
-
return /* @__PURE__ */ (0,
|
32582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react_frame_component.default, __spreadProps(__spreadValues({}, props), { ref, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CopyHostStyles, { debug, onStylesLoaded, children }) }));
|
32365
32583
|
}
|
32366
32584
|
);
|
32367
32585
|
AutoFrameComponent.displayName = "AutoFrameComponent";
|
@@ -32369,14 +32587,15 @@ var AutoFrame_default = AutoFrameComponent;
|
|
32369
32587
|
|
32370
32588
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Preview/styles.module.css#css-module
|
32371
32589
|
init_react_import();
|
32372
|
-
var
|
32590
|
+
var styles_module_default18 = { "PuckPreview": "_PuckPreview_rxwlr_1", "PuckPreview-frame": "_PuckPreview-frame_rxwlr_5" };
|
32373
32591
|
|
32374
32592
|
// components/Puck/components/Preview/index.tsx
|
32375
|
-
var
|
32376
|
-
var
|
32593
|
+
var import_react_frame_component2 = require("react-frame-component");
|
32594
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
32595
|
+
var getClassName23 = get_class_name_factory_default("PuckPreview", styles_module_default18);
|
32377
32596
|
var Preview = ({ id = "puck-preview" }) => {
|
32378
|
-
const { config, dispatch, state, setStatus, iframe } = useAppContext();
|
32379
|
-
const Page = (0,
|
32597
|
+
const { config, dispatch, state, setStatus, iframe, overrides } = useAppContext();
|
32598
|
+
const Page = (0, import_react25.useCallback)(
|
32380
32599
|
(pageProps) => {
|
32381
32600
|
var _a, _b;
|
32382
32601
|
return ((_a = config.root) == null ? void 0 : _a.render) ? (_b = config.root) == null ? void 0 : _b.render(__spreadProps(__spreadValues({
|
@@ -32385,33 +32604,36 @@ var Preview = ({ id = "puck-preview" }) => {
|
|
32385
32604
|
editMode: true,
|
32386
32605
|
// DEPRECATED
|
32387
32606
|
puck: { renderDropZone: DropZone, isEditing: true }
|
32388
|
-
})) : /* @__PURE__ */ (0,
|
32607
|
+
})) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: pageProps.children });
|
32389
32608
|
},
|
32390
32609
|
[config.root]
|
32391
32610
|
);
|
32611
|
+
const Frame2 = (0, import_react25.useMemo)(() => overrides.iframe || "div", [overrides]);
|
32392
32612
|
const rootProps = state.data.root.props || state.data.root;
|
32393
|
-
const ref = (0,
|
32394
|
-
return /* @__PURE__ */ (0,
|
32613
|
+
const ref = (0, import_react25.useRef)(null);
|
32614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
32395
32615
|
"div",
|
32396
32616
|
{
|
32397
|
-
className:
|
32617
|
+
className: getClassName23(),
|
32398
32618
|
id,
|
32399
32619
|
onClick: () => {
|
32400
32620
|
dispatch({ type: "setUi", ui: __spreadProps(__spreadValues({}, state.ui), { itemSelector: null }) });
|
32401
32621
|
},
|
32402
|
-
children: iframe.enabled ? /* @__PURE__ */ (0,
|
32622
|
+
children: iframe.enabled ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
32403
32623
|
AutoFrame_default,
|
32404
32624
|
{
|
32405
32625
|
id: "preview-frame",
|
32406
|
-
className:
|
32626
|
+
className: getClassName23("frame"),
|
32407
32627
|
"data-rfd-iframe": true,
|
32408
32628
|
ref,
|
32409
32629
|
onStylesLoaded: () => {
|
32410
32630
|
setStatus("READY");
|
32411
32631
|
},
|
32412
|
-
children: /* @__PURE__ */ (0,
|
32632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_frame_component2.FrameContextConsumer, { children: ({ document: document2 }) => {
|
32633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Frame2, { document: document2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) })) });
|
32634
|
+
} })
|
32413
32635
|
}
|
32414
|
-
) : /* @__PURE__ */ (0,
|
32636
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { id: "preview-frame", className: getClassName23("frame"), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Page, __spreadProps(__spreadValues({ dispatch, state }, rootProps), { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DropZone, { zone: rootDroppableId }) })) })
|
32415
32637
|
}
|
32416
32638
|
);
|
32417
32639
|
};
|
@@ -32445,7 +32667,7 @@ init_react_import();
|
|
32445
32667
|
|
32446
32668
|
// css-module:/home/runner/work/puck/puck/packages/core/components/LayerTree/styles.module.css#css-module
|
32447
32669
|
init_react_import();
|
32448
|
-
var
|
32670
|
+
var styles_module_default19 = { "LayerTree": "_LayerTree_1pgw8_1", "LayerTree-zoneTitle": "_LayerTree-zoneTitle_1pgw8_11", "LayerTree-helper": "_LayerTree-helper_1pgw8_17", "Layer": "_Layer_1pgw8_1", "Layer-inner": "_Layer-inner_1pgw8_29", "Layer--containsZone": "_Layer--containsZone_1pgw8_35", "Layer-clickable": "_Layer-clickable_1pgw8_39", "Layer--isSelected": "_Layer--isSelected_1pgw8_61", "Layer-chevron": "_Layer-chevron_1pgw8_77", "Layer--childIsSelected": "_Layer--childIsSelected_1pgw8_78", "Layer-zones": "_Layer-zones_1pgw8_82", "Layer-title": "_Layer-title_1pgw8_96", "Layer-name": "_Layer-name_1pgw8_105", "Layer-icon": "_Layer-icon_1pgw8_111", "Layer-zoneIcon": "_Layer-zoneIcon_1pgw8_116" };
|
32449
32671
|
|
32450
32672
|
// lib/scroll-into-view.ts
|
32451
32673
|
init_react_import();
|
@@ -32459,7 +32681,7 @@ var scrollIntoView = (el) => {
|
|
32459
32681
|
};
|
32460
32682
|
|
32461
32683
|
// components/LayerTree/index.tsx
|
32462
|
-
var
|
32684
|
+
var import_react26 = require("react");
|
32463
32685
|
|
32464
32686
|
// lib/is-child-of-zone.ts
|
32465
32687
|
init_react_import();
|
@@ -32473,9 +32695,9 @@ var isChildOfZone = (item, maybeChild, ctx) => {
|
|
32473
32695
|
};
|
32474
32696
|
|
32475
32697
|
// components/LayerTree/index.tsx
|
32476
|
-
var
|
32477
|
-
var
|
32478
|
-
var getClassNameLayer = get_class_name_factory_default("Layer",
|
32698
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
32699
|
+
var getClassName24 = get_class_name_factory_default("LayerTree", styles_module_default19);
|
32700
|
+
var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default19);
|
32479
32701
|
var LayerTree = ({
|
32480
32702
|
data,
|
32481
32703
|
config,
|
@@ -32486,15 +32708,15 @@ var LayerTree = ({
|
|
32486
32708
|
label
|
32487
32709
|
}) => {
|
32488
32710
|
const zones = data.zones || {};
|
32489
|
-
const ctx = (0,
|
32490
|
-
return /* @__PURE__ */ (0,
|
32491
|
-
label && /* @__PURE__ */ (0,
|
32492
|
-
/* @__PURE__ */ (0,
|
32711
|
+
const ctx = (0, import_react26.useContext)(dropZoneContext);
|
32712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
32713
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassName24("zoneTitle"), children: [
|
32714
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("zoneIcon"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Layers, { size: "16" }) }),
|
32493
32715
|
" ",
|
32494
32716
|
label
|
32495
32717
|
] }),
|
32496
|
-
/* @__PURE__ */ (0,
|
32497
|
-
zoneContent.length === 0 && /* @__PURE__ */ (0,
|
32718
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("ul", { className: getClassName24(), children: [
|
32719
|
+
zoneContent.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassName24("helper"), children: "No items" }),
|
32498
32720
|
zoneContent.map((item, i) => {
|
32499
32721
|
var _a;
|
32500
32722
|
const isSelected = (itemSelector == null ? void 0 : itemSelector.index) === i && (itemSelector.zone === zone || itemSelector.zone === rootDroppableId && !zone);
|
@@ -32512,7 +32734,7 @@ var LayerTree = ({
|
|
32512
32734
|
const childIsSelected = isChildOfZone(item, selectedItem, ctx);
|
32513
32735
|
const componentConfig = config.components[item.type];
|
32514
32736
|
const label2 = (_a = componentConfig == null ? void 0 : componentConfig["label"]) != null ? _a : item.type.toString();
|
32515
|
-
return /* @__PURE__ */ (0,
|
32737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
32516
32738
|
"li",
|
32517
32739
|
{
|
32518
32740
|
className: getClassNameLayer({
|
@@ -32522,7 +32744,7 @@ var LayerTree = ({
|
|
32522
32744
|
childIsSelected
|
32523
32745
|
}),
|
32524
32746
|
children: [
|
32525
|
-
/* @__PURE__ */ (0,
|
32747
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("inner"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
32526
32748
|
"button",
|
32527
32749
|
{
|
32528
32750
|
className: getClassNameLayer("clickable"),
|
@@ -32554,22 +32776,22 @@ var LayerTree = ({
|
|
32554
32776
|
setHoveringComponent(null);
|
32555
32777
|
},
|
32556
32778
|
children: [
|
32557
|
-
containsZone && /* @__PURE__ */ (0,
|
32779
|
+
containsZone && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32558
32780
|
"div",
|
32559
32781
|
{
|
32560
32782
|
className: getClassNameLayer("chevron"),
|
32561
32783
|
title: isSelected ? "Collapse" : "Expand",
|
32562
|
-
children: /* @__PURE__ */ (0,
|
32784
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChevronDown, { size: "12" })
|
32563
32785
|
}
|
32564
32786
|
),
|
32565
|
-
/* @__PURE__ */ (0,
|
32566
|
-
/* @__PURE__ */ (0,
|
32567
|
-
/* @__PURE__ */ (0,
|
32787
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: getClassNameLayer("title"), children: [
|
32788
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("icon"), children: item.type === "Text" || item.type === "Heading" ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Type, { size: "16" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LayoutGrid, { size: "16" }) }),
|
32789
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("name"), children: label2 })
|
32568
32790
|
] })
|
32569
32791
|
]
|
32570
32792
|
}
|
32571
32793
|
) }),
|
32572
|
-
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0,
|
32794
|
+
containsZone && Object.keys(zonesForItem).map((zoneKey, idx) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: getClassNameLayer("zones"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
32573
32795
|
LayerTree,
|
32574
32796
|
{
|
32575
32797
|
config,
|
@@ -32591,13 +32813,13 @@ var LayerTree = ({
|
|
32591
32813
|
};
|
32592
32814
|
|
32593
32815
|
// components/Puck/components/Outline/index.tsx
|
32594
|
-
var
|
32595
|
-
var
|
32816
|
+
var import_react27 = require("react");
|
32817
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
32596
32818
|
var Outline = () => {
|
32597
32819
|
const { dispatch, state, overrides, config } = useAppContext();
|
32598
32820
|
const { data, ui } = state;
|
32599
32821
|
const { itemSelector } = ui;
|
32600
|
-
const setItemSelector = (0,
|
32822
|
+
const setItemSelector = (0, import_react27.useCallback)(
|
32601
32823
|
(newItemSelector) => {
|
32602
32824
|
dispatch({
|
32603
32825
|
type: "setUi",
|
@@ -32606,9 +32828,9 @@ var Outline = () => {
|
|
32606
32828
|
},
|
32607
32829
|
[]
|
32608
32830
|
);
|
32609
|
-
const Wrapper = (0,
|
32610
|
-
return /* @__PURE__ */ (0,
|
32611
|
-
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0,
|
32831
|
+
const Wrapper = (0, import_react27.useMemo)(() => overrides.outline || "div", [overrides]);
|
32832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dropZoneContext.Consumer, { children: (ctx) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
32833
|
+
(ctx == null ? void 0 : ctx.activeZones) && (ctx == null ? void 0 : ctx.activeZones[rootDroppableId]) && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
32612
32834
|
LayerTree,
|
32613
32835
|
{
|
32614
32836
|
config,
|
@@ -32621,7 +32843,7 @@ var Outline = () => {
|
|
32621
32843
|
),
|
32622
32844
|
Object.entries(findZonesForArea(data, "root")).map(
|
32623
32845
|
([zoneKey, zone]) => {
|
32624
|
-
return /* @__PURE__ */ (0,
|
32846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
32625
32847
|
LayerTree,
|
32626
32848
|
{
|
32627
32849
|
config,
|
@@ -32639,37 +32861,6 @@ var Outline = () => {
|
|
32639
32861
|
] }) }) });
|
32640
32862
|
};
|
32641
32863
|
|
32642
|
-
// lib/load-overrides.ts
|
32643
|
-
init_react_import();
|
32644
|
-
var loadOverrides = ({
|
32645
|
-
overrides,
|
32646
|
-
plugins
|
32647
|
-
}) => {
|
32648
|
-
const collected = __spreadValues({}, overrides);
|
32649
|
-
plugins.forEach((plugin) => {
|
32650
|
-
Object.keys(plugin.overrides).forEach((overridesType) => {
|
32651
|
-
if (overridesType === "fieldTypes") {
|
32652
|
-
const fieldTypes = plugin.overrides.fieldTypes;
|
32653
|
-
Object.keys(fieldTypes).forEach((fieldType) => {
|
32654
|
-
collected.fieldTypes = collected.fieldTypes || {};
|
32655
|
-
const childNode2 = collected.fieldTypes[fieldType];
|
32656
|
-
const Comp2 = (props) => fieldTypes[fieldType](__spreadProps(__spreadValues({}, props), {
|
32657
|
-
children: childNode2 ? childNode2(props) : props.children
|
32658
|
-
}));
|
32659
|
-
collected.fieldTypes[fieldType] = Comp2;
|
32660
|
-
});
|
32661
|
-
return;
|
32662
|
-
}
|
32663
|
-
const childNode = collected[overridesType];
|
32664
|
-
const Comp = (props) => plugin.overrides[overridesType](__spreadProps(__spreadValues({}, props), {
|
32665
|
-
children: childNode ? childNode(props) : props.children
|
32666
|
-
}));
|
32667
|
-
collected[overridesType] = Comp;
|
32668
|
-
});
|
32669
|
-
});
|
32670
|
-
return collected;
|
32671
|
-
};
|
32672
|
-
|
32673
32864
|
// lib/use-puck-history.ts
|
32674
32865
|
init_react_import();
|
32675
32866
|
var import_react_hotkeys_hook = require("react-hotkeys-hook");
|
@@ -32726,19 +32917,19 @@ function usePuckHistory({
|
|
32726
32917
|
|
32727
32918
|
// lib/use-history-store.ts
|
32728
32919
|
init_react_import();
|
32729
|
-
var
|
32920
|
+
var import_react28 = require("react");
|
32730
32921
|
var import_use_debounce3 = require("use-debounce");
|
32731
32922
|
var EMPTY_HISTORY_INDEX = -1;
|
32732
32923
|
function useHistoryStore(initialHistory) {
|
32733
32924
|
var _a, _b;
|
32734
|
-
const [histories, setHistories] = (0,
|
32925
|
+
const [histories, setHistories] = (0, import_react28.useState)(
|
32735
32926
|
(_a = initialHistory == null ? void 0 : initialHistory.histories) != null ? _a : []
|
32736
32927
|
);
|
32737
32928
|
const updateHistories = (histories2) => {
|
32738
32929
|
setHistories(histories2);
|
32739
32930
|
setIndex(histories2.length - 1);
|
32740
32931
|
};
|
32741
|
-
const [index, setIndex] = (0,
|
32932
|
+
const [index, setIndex] = (0, import_react28.useState)(
|
32742
32933
|
(_b = initialHistory == null ? void 0 : initialHistory.index) != null ? _b : EMPTY_HISTORY_INDEX
|
32743
32934
|
);
|
32744
32935
|
const hasPast = index > EMPTY_HISTORY_INDEX;
|
@@ -32898,25 +33089,25 @@ var getBox = function getBox2(el) {
|
|
32898
33089
|
};
|
32899
33090
|
|
32900
33091
|
// components/Puck/components/Canvas/index.tsx
|
32901
|
-
var
|
33092
|
+
var import_react30 = require("react");
|
32902
33093
|
|
32903
33094
|
// components/ViewportControls/index.tsx
|
32904
33095
|
init_react_import();
|
32905
|
-
var
|
33096
|
+
var import_react29 = require("react");
|
32906
33097
|
|
32907
33098
|
// css-module:/home/runner/work/puck/puck/packages/core/components/ViewportControls/styles.module.css#css-module
|
32908
33099
|
init_react_import();
|
32909
|
-
var
|
33100
|
+
var styles_module_default20 = { "ViewportControls": "_ViewportControls_g1wgg_1", "ViewportControls-divider": "_ViewportControls-divider_g1wgg_15", "ViewportControls-zoomSelect": "_ViewportControls-zoomSelect_g1wgg_21", "ViewportButton--isActive": "_ViewportButton--isActive_g1wgg_34", "ViewportButton-inner": "_ViewportButton-inner_g1wgg_34" };
|
32910
33101
|
|
32911
33102
|
// components/ViewportControls/index.tsx
|
32912
|
-
var
|
33103
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
32913
33104
|
var icons = {
|
32914
|
-
Smartphone: /* @__PURE__ */ (0,
|
32915
|
-
Tablet: /* @__PURE__ */ (0,
|
32916
|
-
Monitor: /* @__PURE__ */ (0,
|
33105
|
+
Smartphone: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Smartphone, { size: 16 }),
|
33106
|
+
Tablet: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Tablet, { size: 16 }),
|
33107
|
+
Monitor: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Monitor, { size: 16 })
|
32917
33108
|
};
|
32918
|
-
var
|
32919
|
-
var getClassNameButton = get_class_name_factory_default("ViewportButton",
|
33109
|
+
var getClassName25 = get_class_name_factory_default("ViewportControls", styles_module_default20);
|
33110
|
+
var getClassNameButton = get_class_name_factory_default("ViewportButton", styles_module_default20);
|
32920
33111
|
var ViewportButton = ({
|
32921
33112
|
children,
|
32922
33113
|
height = "auto",
|
@@ -32925,11 +33116,11 @@ var ViewportButton = ({
|
|
32925
33116
|
onClick
|
32926
33117
|
}) => {
|
32927
33118
|
const { state } = useAppContext();
|
32928
|
-
const [isActive, setIsActive] = (0,
|
32929
|
-
(0,
|
33119
|
+
const [isActive, setIsActive] = (0, import_react29.useState)(false);
|
33120
|
+
(0, import_react29.useEffect)(() => {
|
32930
33121
|
setIsActive(width === state.ui.viewports.current.width);
|
32931
33122
|
}, [width, state.ui.viewports.current.width]);
|
32932
|
-
return /* @__PURE__ */ (0,
|
33123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton({ isActive }), children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32933
33124
|
IconButton,
|
32934
33125
|
{
|
32935
33126
|
title,
|
@@ -32938,7 +33129,7 @@ var ViewportButton = ({
|
|
32938
33129
|
e.stopPropagation();
|
32939
33130
|
onClick({ width, height });
|
32940
33131
|
},
|
32941
|
-
children: /* @__PURE__ */ (0,
|
33132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: getClassNameButton("inner"), children })
|
32942
33133
|
}
|
32943
33134
|
) });
|
32944
33135
|
};
|
@@ -32962,7 +33153,7 @@ var ViewportControls = ({
|
|
32962
33153
|
const defaultsContainAutoZoom = defaultZoomOptions.find(
|
32963
33154
|
(option) => option.value === autoZoom
|
32964
33155
|
);
|
32965
|
-
const zoomOptions = (0,
|
33156
|
+
const zoomOptions = (0, import_react29.useMemo)(
|
32966
33157
|
() => [
|
32967
33158
|
...defaultZoomOptions,
|
32968
33159
|
...defaultsContainAutoZoom ? [] : [
|
@@ -32974,8 +33165,8 @@ var ViewportControls = ({
|
|
32974
33165
|
].filter((a) => a.value <= autoZoom).sort((a, b) => a.value > b.value ? 1 : -1),
|
32975
33166
|
[autoZoom]
|
32976
33167
|
);
|
32977
|
-
return /* @__PURE__ */ (0,
|
32978
|
-
viewports.map((viewport, i) => /* @__PURE__ */ (0,
|
33168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: getClassName25(), children: [
|
33169
|
+
viewports.map((viewport, i) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32979
33170
|
ViewportButton,
|
32980
33171
|
{
|
32981
33172
|
height: viewport.height,
|
@@ -32986,8 +33177,8 @@ var ViewportControls = ({
|
|
32986
33177
|
},
|
32987
33178
|
i
|
32988
33179
|
)),
|
32989
|
-
/* @__PURE__ */ (0,
|
32990
|
-
/* @__PURE__ */ (0,
|
33180
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
33181
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
32991
33182
|
IconButton,
|
32992
33183
|
{
|
32993
33184
|
title: "Zoom viewport out",
|
@@ -33001,10 +33192,10 @@ var ViewportControls = ({
|
|
33001
33192
|
)].value
|
33002
33193
|
);
|
33003
33194
|
},
|
33004
|
-
children: /* @__PURE__ */ (0,
|
33195
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomOut, { size: 16 })
|
33005
33196
|
}
|
33006
33197
|
),
|
33007
|
-
/* @__PURE__ */ (0,
|
33198
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33008
33199
|
IconButton,
|
33009
33200
|
{
|
33010
33201
|
title: "Zoom viewport in",
|
@@ -33018,19 +33209,19 @@ var ViewportControls = ({
|
|
33018
33209
|
)].value
|
33019
33210
|
);
|
33020
33211
|
},
|
33021
|
-
children: /* @__PURE__ */ (0,
|
33212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ZoomIn, { size: 16 })
|
33022
33213
|
}
|
33023
33214
|
),
|
33024
|
-
/* @__PURE__ */ (0,
|
33025
|
-
/* @__PURE__ */ (0,
|
33215
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: getClassName25("divider") }),
|
33216
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33026
33217
|
"select",
|
33027
33218
|
{
|
33028
|
-
className:
|
33219
|
+
className: getClassName25("zoomSelect"),
|
33029
33220
|
value: zoom.toString(),
|
33030
33221
|
onChange: (e) => {
|
33031
33222
|
onZoom(parseFloat(e.currentTarget.value));
|
33032
33223
|
},
|
33033
|
-
children: zoomOptions.map((option) => /* @__PURE__ */ (0,
|
33224
|
+
children: zoomOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
33034
33225
|
"option",
|
33035
33226
|
{
|
33036
33227
|
value: option.value,
|
@@ -33045,7 +33236,7 @@ var ViewportControls = ({
|
|
33045
33236
|
|
33046
33237
|
// css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
|
33047
33238
|
init_react_import();
|
33048
|
-
var
|
33239
|
+
var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_6zd4y_1", "PuckCanvas-controls": "_PuckCanvas-controls_6zd4y_16", "PuckCanvas-inner": "_PuckCanvas-inner_6zd4y_21", "PuckCanvas-root": "_PuckCanvas-root_6zd4y_32", "PuckCanvas--ready": "_PuckCanvas--ready_6zd4y_56" };
|
33049
33240
|
|
33050
33241
|
// lib/get-zoom-config.ts
|
33051
33242
|
init_react_import();
|
@@ -33078,24 +33269,24 @@ var getZoomConfig = (uiViewport, frame, zoom) => {
|
|
33078
33269
|
};
|
33079
33270
|
|
33080
33271
|
// components/Puck/components/Canvas/index.tsx
|
33081
|
-
var
|
33082
|
-
var
|
33272
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
33273
|
+
var getClassName26 = get_class_name_factory_default("PuckCanvas", styles_module_default21);
|
33083
33274
|
var ZOOM_ON_CHANGE = true;
|
33084
33275
|
var Canvas = () => {
|
33085
33276
|
const { status, iframe } = useAppContext();
|
33086
33277
|
const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
|
33087
33278
|
const { ui } = state;
|
33088
|
-
const frameRef = (0,
|
33089
|
-
const [showTransition, setShowTransition] = (0,
|
33090
|
-
const defaultRender = (0,
|
33091
|
-
const PuckDefault = ({ children }) => /* @__PURE__ */ (0,
|
33279
|
+
const frameRef = (0, import_react30.useRef)(null);
|
33280
|
+
const [showTransition, setShowTransition] = (0, import_react30.useState)(false);
|
33281
|
+
const defaultRender = (0, import_react30.useMemo)(() => {
|
33282
|
+
const PuckDefault = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children });
|
33092
33283
|
return PuckDefault;
|
33093
33284
|
}, []);
|
33094
|
-
const CustomPreview = (0,
|
33285
|
+
const CustomPreview = (0, import_react30.useMemo)(
|
33095
33286
|
() => overrides.preview || defaultRender,
|
33096
33287
|
[overrides]
|
33097
33288
|
);
|
33098
|
-
const getFrameDimensions = (0,
|
33289
|
+
const getFrameDimensions = (0, import_react30.useCallback)(() => {
|
33099
33290
|
if (frameRef.current) {
|
33100
33291
|
const frame = frameRef.current;
|
33101
33292
|
const box = getBox(frame);
|
@@ -33103,7 +33294,7 @@ var Canvas = () => {
|
|
33103
33294
|
}
|
33104
33295
|
return { width: 0, height: 0 };
|
33105
33296
|
}, [frameRef]);
|
33106
|
-
const resetAutoZoom = (0,
|
33297
|
+
const resetAutoZoom = (0, import_react30.useCallback)(
|
33107
33298
|
(ui2 = state.ui) => {
|
33108
33299
|
if (frameRef.current) {
|
33109
33300
|
setZoomConfig(
|
@@ -33113,11 +33304,11 @@ var Canvas = () => {
|
|
33113
33304
|
},
|
33114
33305
|
[frameRef, zoomConfig, state.ui]
|
33115
33306
|
);
|
33116
|
-
(0,
|
33307
|
+
(0, import_react30.useEffect)(() => {
|
33117
33308
|
setShowTransition(false);
|
33118
33309
|
resetAutoZoom();
|
33119
33310
|
}, [frameRef, ui.leftSideBarVisible, ui.rightSideBarVisible]);
|
33120
|
-
(0,
|
33311
|
+
(0, import_react30.useEffect)(() => {
|
33121
33312
|
const { height: frameHeight } = getFrameDimensions();
|
33122
33313
|
if (ui.viewports.current.height === "auto") {
|
33123
33314
|
setZoomConfig(__spreadProps(__spreadValues({}, zoomConfig), {
|
@@ -33125,7 +33316,7 @@ var Canvas = () => {
|
|
33125
33316
|
}));
|
33126
33317
|
}
|
33127
33318
|
}, [zoomConfig.zoom]);
|
33128
|
-
(0,
|
33319
|
+
(0, import_react30.useEffect)(() => {
|
33129
33320
|
const observer = new ResizeObserver(() => {
|
33130
33321
|
setShowTransition(false);
|
33131
33322
|
resetAutoZoom();
|
@@ -33137,10 +33328,10 @@ var Canvas = () => {
|
|
33137
33328
|
observer.disconnect();
|
33138
33329
|
};
|
33139
33330
|
}, []);
|
33140
|
-
return /* @__PURE__ */ (0,
|
33331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
33141
33332
|
"div",
|
33142
33333
|
{
|
33143
|
-
className:
|
33334
|
+
className: getClassName26({
|
33144
33335
|
ready: status === "READY" || !iframe.enabled
|
33145
33336
|
}),
|
33146
33337
|
onClick: () => dispatch({
|
@@ -33149,7 +33340,7 @@ var Canvas = () => {
|
|
33149
33340
|
recordHistory: true
|
33150
33341
|
}),
|
33151
33342
|
children: [
|
33152
|
-
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0,
|
33343
|
+
ui.viewports.controlsVisible && iframe.enabled && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("controls"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
33153
33344
|
ViewportControls,
|
33154
33345
|
{
|
33155
33346
|
autoZoom: zoomConfig.autoZoom,
|
@@ -33174,10 +33365,10 @@ var Canvas = () => {
|
|
33174
33365
|
}
|
33175
33366
|
}
|
33176
33367
|
) }),
|
33177
|
-
/* @__PURE__ */ (0,
|
33368
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getClassName26("inner"), ref: frameRef, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
33178
33369
|
"div",
|
33179
33370
|
{
|
33180
|
-
className:
|
33371
|
+
className: getClassName26("root"),
|
33181
33372
|
style: {
|
33182
33373
|
width: iframe.enabled ? ui.viewports.current.width : "100%",
|
33183
33374
|
height: zoomConfig.rootHeight,
|
@@ -33186,7 +33377,7 @@ var Canvas = () => {
|
|
33186
33377
|
overflow: iframe.enabled ? void 0 : "auto"
|
33187
33378
|
},
|
33188
33379
|
suppressHydrationWarning: true,
|
33189
|
-
children: /* @__PURE__ */ (0,
|
33380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CustomPreview, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Preview, {}) })
|
33190
33381
|
}
|
33191
33382
|
) })
|
33192
33383
|
]
|
@@ -33227,9 +33418,9 @@ var insertComponent = (componentType, zone, index, {
|
|
33227
33418
|
};
|
33228
33419
|
|
33229
33420
|
// components/Puck/index.tsx
|
33230
|
-
var
|
33231
|
-
var
|
33232
|
-
var getLayoutClassName = get_class_name_factory_default("PuckLayout",
|
33421
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
33422
|
+
var getClassName27 = get_class_name_factory_default("Puck", styles_module_default15);
|
33423
|
+
var getLayoutClassName = get_class_name_factory_default("PuckLayout", styles_module_default15);
|
33233
33424
|
function Puck({
|
33234
33425
|
children,
|
33235
33426
|
config,
|
@@ -33238,6 +33429,7 @@ function Puck({
|
|
33238
33429
|
onChange,
|
33239
33430
|
onPublish,
|
33240
33431
|
onAction,
|
33432
|
+
permissions = {},
|
33241
33433
|
plugins = [],
|
33242
33434
|
overrides = {},
|
33243
33435
|
renderHeader,
|
@@ -33253,10 +33445,10 @@ function Puck({
|
|
33253
33445
|
}) {
|
33254
33446
|
var _a;
|
33255
33447
|
const historyStore = useHistoryStore(initialHistory);
|
33256
|
-
const [reducer] = (0,
|
33448
|
+
const [reducer] = (0, import_react31.useState)(
|
33257
33449
|
() => createReducer({ config, record: historyStore.record, onAction })
|
33258
33450
|
);
|
33259
|
-
const [initialAppState] = (0,
|
33451
|
+
const [initialAppState] = (0, import_react31.useState)(() => {
|
33260
33452
|
var _a2, _b, _c, _d, _e, _f, _g;
|
33261
33453
|
const initial = __spreadValues(__spreadValues({}, defaultAppState.ui), initialUi);
|
33262
33454
|
let clientUiState = {};
|
@@ -33314,7 +33506,7 @@ function Puck({
|
|
33314
33506
|
})
|
33315
33507
|
});
|
33316
33508
|
});
|
33317
|
-
const [appState, dispatch] = (0,
|
33509
|
+
const [appState, dispatch] = (0, import_react31.useReducer)(
|
33318
33510
|
reducer,
|
33319
33511
|
flushZones(initialAppState)
|
33320
33512
|
);
|
@@ -33325,9 +33517,9 @@ function Puck({
|
|
33325
33517
|
config,
|
33326
33518
|
dispatch
|
33327
33519
|
);
|
33328
|
-
const [menuOpen, setMenuOpen] = (0,
|
33520
|
+
const [menuOpen, setMenuOpen] = (0, import_react31.useState)(false);
|
33329
33521
|
const { itemSelector, leftSideBarVisible, rightSideBarVisible } = ui;
|
33330
|
-
const setItemSelector = (0,
|
33522
|
+
const setItemSelector = (0, import_react31.useCallback)(
|
33331
33523
|
(newItemSelector) => {
|
33332
33524
|
if (newItemSelector === itemSelector) return;
|
33333
33525
|
dispatch({
|
@@ -33339,13 +33531,13 @@ function Puck({
|
|
33339
33531
|
[itemSelector]
|
33340
33532
|
);
|
33341
33533
|
const selectedItem = itemSelector ? getItem(itemSelector, data) : null;
|
33342
|
-
(0,
|
33534
|
+
(0, import_react31.useEffect)(() => {
|
33343
33535
|
if (onChange) onChange(data);
|
33344
33536
|
}, [data]);
|
33345
33537
|
const { onDragStartOrUpdate, placeholderStyle } = usePlaceholderStyle();
|
33346
|
-
const [draggedItem, setDraggedItem] = (0,
|
33538
|
+
const [draggedItem, setDraggedItem] = (0, import_react31.useState)();
|
33347
33539
|
const rootProps = data.root.props || data.root;
|
33348
|
-
const toggleSidebars = (0,
|
33540
|
+
const toggleSidebars = (0, import_react31.useCallback)(
|
33349
33541
|
(sidebar) => {
|
33350
33542
|
const widerViewport = window.matchMedia("(min-width: 638px)").matches;
|
33351
33543
|
const sideBarVisible = sidebar === "left" ? leftSideBarVisible : rightSideBarVisible;
|
@@ -33359,7 +33551,7 @@ function Puck({
|
|
33359
33551
|
},
|
33360
33552
|
[dispatch, leftSideBarVisible, rightSideBarVisible]
|
33361
33553
|
);
|
33362
|
-
(0,
|
33554
|
+
(0, import_react31.useEffect)(() => {
|
33363
33555
|
if (!window.matchMedia("(min-width: 638px)").matches) {
|
33364
33556
|
dispatch({
|
33365
33557
|
type: "setUi",
|
@@ -33382,11 +33574,7 @@ function Puck({
|
|
33382
33574
|
window.removeEventListener("resize", handleResize);
|
33383
33575
|
};
|
33384
33576
|
}, []);
|
33385
|
-
const
|
33386
|
-
const PuckDefault = ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: children2 });
|
33387
|
-
return PuckDefault;
|
33388
|
-
}, []);
|
33389
|
-
const defaultHeaderRender = (0, import_react30.useMemo)(() => {
|
33577
|
+
const defaultHeaderRender = (0, import_react31.useMemo)(() => {
|
33390
33578
|
if (renderHeader) {
|
33391
33579
|
console.warn(
|
33392
33580
|
"`renderHeader` is deprecated. Please use `overrides.header` and the `usePuck` hook instead"
|
@@ -33394,48 +33582,49 @@ function Puck({
|
|
33394
33582
|
const RenderHeader = (_a2) => {
|
33395
33583
|
var _b = _a2, { actions } = _b, props = __objRest(_b, ["actions"]);
|
33396
33584
|
const Comp = renderHeader;
|
33397
|
-
return /* @__PURE__ */ (0,
|
33585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState, children: actions }));
|
33398
33586
|
};
|
33399
33587
|
return RenderHeader;
|
33400
33588
|
}
|
33401
|
-
return
|
33589
|
+
return DefaultOverride;
|
33402
33590
|
}, [renderHeader]);
|
33403
|
-
const defaultHeaderActionsRender = (0,
|
33591
|
+
const defaultHeaderActionsRender = (0, import_react31.useMemo)(() => {
|
33404
33592
|
if (renderHeaderActions) {
|
33405
33593
|
console.warn(
|
33406
33594
|
"`renderHeaderActions` is deprecated. Please use `overrides.headerActions` and the `usePuck` hook instead."
|
33407
33595
|
);
|
33408
33596
|
const RenderHeader = (props) => {
|
33409
33597
|
const Comp = renderHeaderActions;
|
33410
|
-
return /* @__PURE__ */ (0,
|
33598
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Comp, __spreadProps(__spreadValues({}, props), { dispatch, state: appState }));
|
33411
33599
|
};
|
33412
33600
|
return RenderHeader;
|
33413
33601
|
}
|
33414
|
-
return
|
33602
|
+
return DefaultOverride;
|
33415
33603
|
}, [renderHeader]);
|
33416
|
-
const loadedOverrides = (
|
33417
|
-
|
33418
|
-
|
33419
|
-
|
33420
|
-
|
33604
|
+
const loadedOverrides = useLoadedOverrides({
|
33605
|
+
overrides,
|
33606
|
+
plugins
|
33607
|
+
});
|
33608
|
+
const CustomPuck = (0, import_react31.useMemo)(
|
33609
|
+
() => loadedOverrides.puck || DefaultOverride,
|
33421
33610
|
[loadedOverrides]
|
33422
33611
|
);
|
33423
|
-
const CustomHeader = (0,
|
33612
|
+
const CustomHeader = (0, import_react31.useMemo)(
|
33424
33613
|
() => loadedOverrides.header || defaultHeaderRender,
|
33425
33614
|
[loadedOverrides]
|
33426
33615
|
);
|
33427
|
-
const CustomHeaderActions = (0,
|
33616
|
+
const CustomHeaderActions = (0, import_react31.useMemo)(
|
33428
33617
|
() => loadedOverrides.headerActions || defaultHeaderActionsRender,
|
33429
33618
|
[loadedOverrides]
|
33430
33619
|
);
|
33431
|
-
const [mounted, setMounted] = (0,
|
33432
|
-
(0,
|
33620
|
+
const [mounted, setMounted] = (0, import_react31.useState)(false);
|
33621
|
+
(0, import_react31.useEffect)(() => {
|
33433
33622
|
setMounted(true);
|
33434
33623
|
}, []);
|
33435
33624
|
const selectedComponentConfig = selectedItem && config.components[selectedItem.type];
|
33436
33625
|
const selectedComponentLabel = selectedItem ? (_a = selectedComponentConfig == null ? void 0 : selectedComponentConfig["label"]) != null ? _a : selectedItem.type.toString() : "";
|
33437
|
-
return /* @__PURE__ */ (0,
|
33438
|
-
/* @__PURE__ */ (0,
|
33626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: `Puck ${getClassName27()}`, children: [
|
33627
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33439
33628
|
AppProvider,
|
33440
33629
|
{
|
33441
33630
|
value: {
|
@@ -33448,9 +33637,16 @@ function Puck({
|
|
33448
33637
|
overrides: loadedOverrides,
|
33449
33638
|
history,
|
33450
33639
|
viewports,
|
33451
|
-
iframe
|
33640
|
+
iframe,
|
33641
|
+
globalPermissions: __spreadValues({
|
33642
|
+
delete: true,
|
33643
|
+
drag: true,
|
33644
|
+
duplicate: true,
|
33645
|
+
insert: true,
|
33646
|
+
edit: true
|
33647
|
+
}, permissions)
|
33452
33648
|
},
|
33453
|
-
children: /* @__PURE__ */ (0,
|
33649
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33454
33650
|
DragDropContext,
|
33455
33651
|
{
|
33456
33652
|
autoScrollerOptions: { disabled: dnd == null ? void 0 : dnd.disableAutoScroll },
|
@@ -33502,7 +33698,7 @@ function Puck({
|
|
33502
33698
|
});
|
33503
33699
|
}
|
33504
33700
|
},
|
33505
|
-
children: /* @__PURE__ */ (0,
|
33701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33506
33702
|
DropZoneProvider,
|
33507
33703
|
{
|
33508
33704
|
value: {
|
@@ -33516,7 +33712,7 @@ function Puck({
|
|
33516
33712
|
mode: "edit",
|
33517
33713
|
areaId: "root"
|
33518
33714
|
},
|
33519
|
-
children: /* @__PURE__ */ (0,
|
33715
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomPuck, { children: children || /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33520
33716
|
"div",
|
33521
33717
|
{
|
33522
33718
|
className: getLayoutClassName({
|
@@ -33525,64 +33721,64 @@ function Puck({
|
|
33525
33721
|
mounted,
|
33526
33722
|
rightSideBarVisible
|
33527
33723
|
}),
|
33528
|
-
children: /* @__PURE__ */ (0,
|
33529
|
-
/* @__PURE__ */ (0,
|
33724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("inner"), children: [
|
33725
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33530
33726
|
CustomHeader,
|
33531
33727
|
{
|
33532
|
-
actions: /* @__PURE__ */ (0,
|
33728
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33533
33729
|
Button,
|
33534
33730
|
{
|
33535
33731
|
onClick: () => {
|
33536
33732
|
onPublish && onPublish(data);
|
33537
33733
|
},
|
33538
|
-
icon: /* @__PURE__ */ (0,
|
33734
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
33539
33735
|
children: "Publish"
|
33540
33736
|
}
|
33541
33737
|
) }) }),
|
33542
|
-
children: /* @__PURE__ */ (0,
|
33543
|
-
/* @__PURE__ */ (0,
|
33544
|
-
/* @__PURE__ */ (0,
|
33738
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("header", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerInner"), children: [
|
33739
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerToggle"), children: [
|
33740
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33545
33741
|
"div",
|
33546
33742
|
{
|
33547
33743
|
className: getLayoutClassName(
|
33548
33744
|
"leftSideBarToggle"
|
33549
33745
|
),
|
33550
|
-
children: /* @__PURE__ */ (0,
|
33746
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33551
33747
|
IconButton,
|
33552
33748
|
{
|
33553
33749
|
onClick: () => {
|
33554
33750
|
toggleSidebars("left");
|
33555
33751
|
},
|
33556
33752
|
title: "Toggle left sidebar",
|
33557
|
-
children: /* @__PURE__ */ (0,
|
33753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelLeft, { focusable: "false" })
|
33558
33754
|
}
|
33559
33755
|
)
|
33560
33756
|
}
|
33561
33757
|
),
|
33562
|
-
/* @__PURE__ */ (0,
|
33758
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33563
33759
|
"div",
|
33564
33760
|
{
|
33565
33761
|
className: getLayoutClassName(
|
33566
33762
|
"rightSideBarToggle"
|
33567
33763
|
),
|
33568
|
-
children: /* @__PURE__ */ (0,
|
33764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33569
33765
|
IconButton,
|
33570
33766
|
{
|
33571
33767
|
onClick: () => {
|
33572
33768
|
toggleSidebars("right");
|
33573
33769
|
},
|
33574
33770
|
title: "Toggle right sidebar",
|
33575
|
-
children: /* @__PURE__ */ (0,
|
33771
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PanelRight, { focusable: "false" })
|
33576
33772
|
}
|
33577
33773
|
)
|
33578
33774
|
}
|
33579
33775
|
)
|
33580
33776
|
] }),
|
33581
|
-
/* @__PURE__ */ (0,
|
33777
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("headerTitle"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Heading, { rank: 2, size: "xs", children: [
|
33582
33778
|
headerTitle || rootProps.title || "Page",
|
33583
|
-
headerPath && /* @__PURE__ */ (0,
|
33779
|
+
headerPath && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
33584
33780
|
" ",
|
33585
|
-
/* @__PURE__ */ (0,
|
33781
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33586
33782
|
"code",
|
33587
33783
|
{
|
33588
33784
|
className: getLayoutClassName("headerPath"),
|
@@ -33591,18 +33787,18 @@ function Puck({
|
|
33591
33787
|
)
|
33592
33788
|
] })
|
33593
33789
|
] }) }),
|
33594
|
-
/* @__PURE__ */ (0,
|
33595
|
-
/* @__PURE__ */ (0,
|
33790
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("headerTools"), children: [
|
33791
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("menuButton"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33596
33792
|
IconButton,
|
33597
33793
|
{
|
33598
33794
|
onClick: () => {
|
33599
33795
|
return setMenuOpen(!menuOpen);
|
33600
33796
|
},
|
33601
33797
|
title: "Toggle menu bar",
|
33602
|
-
children: menuOpen ? /* @__PURE__ */ (0,
|
33798
|
+
children: menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronUp, { focusable: "false" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(ChevronDown, { focusable: "false" })
|
33603
33799
|
}
|
33604
33800
|
) }),
|
33605
|
-
/* @__PURE__ */ (0,
|
33801
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33606
33802
|
MenuBar,
|
33607
33803
|
{
|
33608
33804
|
appState,
|
@@ -33610,13 +33806,13 @@ function Puck({
|
|
33610
33806
|
dispatch,
|
33611
33807
|
onPublish,
|
33612
33808
|
menuOpen,
|
33613
|
-
renderHeaderActions: () => /* @__PURE__ */ (0,
|
33809
|
+
renderHeaderActions: () => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(CustomHeaderActions, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33614
33810
|
Button,
|
33615
33811
|
{
|
33616
33812
|
onClick: () => {
|
33617
33813
|
onPublish && onPublish(data);
|
33618
33814
|
},
|
33619
|
-
icon: /* @__PURE__ */ (0,
|
33815
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Globe, { size: "14px" }),
|
33620
33816
|
children: "Publish"
|
33621
33817
|
}
|
33622
33818
|
) }),
|
@@ -33627,19 +33823,19 @@ function Puck({
|
|
33627
33823
|
] }) })
|
33628
33824
|
}
|
33629
33825
|
),
|
33630
|
-
/* @__PURE__ */ (0,
|
33631
|
-
/* @__PURE__ */ (0,
|
33632
|
-
/* @__PURE__ */ (0,
|
33826
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getLayoutClassName("leftSideBar"), children: [
|
33827
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Components", noBorderTop: true, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Components, {}) }),
|
33828
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(SidebarSection, { title: "Outline", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Outline, {}) })
|
33633
33829
|
] }),
|
33634
|
-
/* @__PURE__ */ (0,
|
33635
|
-
/* @__PURE__ */ (0,
|
33830
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Canvas, {}),
|
33831
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getLayoutClassName("rightSideBar"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
33636
33832
|
SidebarSection,
|
33637
33833
|
{
|
33638
33834
|
noPadding: true,
|
33639
33835
|
noBorderTop: true,
|
33640
33836
|
showBreadcrumbs: true,
|
33641
33837
|
title: selectedItem ? selectedComponentLabel : "Page",
|
33642
|
-
children: /* @__PURE__ */ (0,
|
33838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Fields, {})
|
33643
33839
|
}
|
33644
33840
|
) })
|
33645
33841
|
] })
|
@@ -33651,7 +33847,7 @@ function Puck({
|
|
33651
33847
|
)
|
33652
33848
|
}
|
33653
33849
|
),
|
33654
|
-
/* @__PURE__ */ (0,
|
33850
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: "puck-portal-root", className: getClassName27("portal") })
|
33655
33851
|
] });
|
33656
33852
|
}
|
33657
33853
|
Puck.Components = Components;
|
@@ -33661,7 +33857,7 @@ Puck.Preview = Preview;
|
|
33661
33857
|
|
33662
33858
|
// components/Render/index.tsx
|
33663
33859
|
init_react_import();
|
33664
|
-
var
|
33860
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
33665
33861
|
function Render({
|
33666
33862
|
config,
|
33667
33863
|
data
|
@@ -33674,7 +33870,7 @@ function Render({
|
|
33674
33870
|
const rootProps = defaultedData.root.props || defaultedData.root;
|
33675
33871
|
const title = (rootProps == null ? void 0 : rootProps.title) || "";
|
33676
33872
|
if ((_a = config.root) == null ? void 0 : _a.render) {
|
33677
|
-
return /* @__PURE__ */ (0,
|
33873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
33678
33874
|
config.root.render,
|
33679
33875
|
__spreadProps(__spreadValues({}, rootProps), {
|
33680
33876
|
puck: {
|
@@ -33684,11 +33880,11 @@ function Render({
|
|
33684
33880
|
title,
|
33685
33881
|
editMode: false,
|
33686
33882
|
id: "puck-root",
|
33687
|
-
children: /* @__PURE__ */ (0,
|
33883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId })
|
33688
33884
|
})
|
33689
33885
|
) });
|
33690
33886
|
}
|
33691
|
-
return /* @__PURE__ */ (0,
|
33887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZoneProvider, { value: { data: defaultedData, config, mode: "render" }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DropZone, { zone: rootDroppableId }) });
|
33692
33888
|
}
|
33693
33889
|
|
33694
33890
|
// lib/migrate.ts
|
@@ -33796,12 +33992,25 @@ var usePuck = () => {
|
|
33796
33992
|
config,
|
33797
33993
|
history,
|
33798
33994
|
dispatch,
|
33799
|
-
selectedItem
|
33995
|
+
selectedItem: currentItem,
|
33996
|
+
globalPermissions
|
33800
33997
|
} = useAppContext();
|
33801
33998
|
return {
|
33802
33999
|
appState,
|
33803
34000
|
config,
|
33804
34001
|
dispatch,
|
34002
|
+
getPermissions: ({
|
34003
|
+
item,
|
34004
|
+
type
|
34005
|
+
} = {}) => {
|
34006
|
+
return getPermissions({
|
34007
|
+
selectedItem: item || currentItem,
|
34008
|
+
type,
|
34009
|
+
globalPermissions: globalPermissions || {},
|
34010
|
+
config,
|
34011
|
+
appState
|
34012
|
+
});
|
34013
|
+
},
|
33805
34014
|
history: {
|
33806
34015
|
back: history.back,
|
33807
34016
|
forward: history.forward,
|
@@ -33813,11 +34022,13 @@ var usePuck = () => {
|
|
33813
34022
|
index: history.historyStore.index,
|
33814
34023
|
historyStore: history.historyStore
|
33815
34024
|
},
|
33816
|
-
selectedItem:
|
34025
|
+
selectedItem: currentItem || null
|
33817
34026
|
};
|
33818
34027
|
};
|
33819
34028
|
// Annotate the CommonJS export names for ESM import in node:
|
33820
34029
|
0 && (module.exports = {
|
34030
|
+
Action,
|
34031
|
+
ActionBar,
|
33821
34032
|
AutoField,
|
33822
34033
|
AutoFieldPrivate,
|
33823
34034
|
Button,
|